[Closed] Init, proceed and release events i PFlow scripts?
Maybe someone asked it before but searching for it basicaly returns all PFlow scripts on this forum
When exactly are these events called (happening) during a flow?
I have a folowing script in Script operator:
on Init pCont do ( print “init” )
on Proceed pCont do ( print “proceed”)
on Release pCont do ( print “release”)
The only time I see init and release printed out is when I close the Script operator editor window. After that when I move the time slider, particles comming in and out of the event, I see only “proceed” on every frame.
I can’t find the moments when Init and Release events occur
Quite obviously, Init is called when the Operator is first evaluated (either because you changed the script and it needs to reevaluate it, or because the operator just got loaded or the PFlow just got enabled).
For example, create a Standard Flow, add a Script Operator, copy your code into it.
Close the script editor and you get
MouseTool:ScriptAction3D573750
MouseTool:ScriptAction3D573750
“release”
“init”
“proceed”
Now click on the Disable (Lamp) icon of the PF_Source and you get
“release”
because the flow was disabled and it has to clean up memory.
Enable the flow again and you get
“init”
“proceed”
The init initializes any variables you might need to run it, the proceed evaluates the current frame (assuming you are on 0).
If you disable the flow (“release”), move to frame 5 and enable it again, you get
“init”
“proceed”
“proceed”
“proceed”
“proceed”
“proceed”
“proceed”
This is one “proceed” for each frame from 0 to 5.
Now go to Edit menu and select Hold (this saves the scene temporarily).
Then you select Edit>Fetch and you get
“release”
MouseTool:ScriptAction3BEBBD40
“init”
“proceed”
This shows how the old scene releases the memory, then the Operator gets evaluated, initialized and updated.
You can save the scene, close max (causes “release” to be called) and then load the scene and you will see the same messages as with Fetch…
Hope this helps.