Surprisingly enough, I’ve been postponing switching to gamma for many years—but I’ve finally made the move. So, my question might seem like a total newbie one, and I apologize for that in advance.
I’m a bit confused about the Record/Class concept—not in how they handle data (which is clear), but rather in how Operations work inside those patches.
I’m trying to initialize my Record in the Create operation with some default values. My Record type includes a spread of another data type, the size of which should be initially set (based on an input in this particular case). My first thought was to use a ForEach loop to create the spread:
However, for some reason, I can’t assign the whole loop’s data flow to the Create operation (the pad was added as a weird(?) workaround). At first glance, this patch seems to work as expected—it populates the spread with the correct initial values. Assigning everything inside the ForEach region to Update produces the same result.
Still, in both cases, I’m not 100% sure whether the subsequent operations are actually executed during the Create phase.
Is this the correct way to initialize or create values, or have I completely misunderstood the Record/Class concept in gamma?
// Your Record pseudo definition
public record MyRecord {
// that's a constructor (Create)
MyRecord(Spread<SomeData> programData){
// now we need to assign 'programData' to something
_programData = programData;
}
// that's the pad:
private Spread<SomeData> _programData;
// that's operation to get data from MyRecord instance
public Spread<SomeData> GetSomeData() => _programData;
}
The concept is kinda easy, you create data type e.g. record, you want to store some data in that record, you use pad to store the data, you use Inputs/Outputs + Assign to access or modify data from outside…
When you create record like that, notice the output is MyRecord
Also notice the Filled circle - filled circle means we create new record every frame, to avoid this, we have to assign it to operation: