On 23/11/2017 at 07:57, xxxxxxxx wrote:
I am doing some Python Effector Experiments and would like to ask a few questions:
This is the simplest code to increment a variable inside the Effeector:
\> import c4d
\> from c4d.modules import mograph as mo
\> #Welcome to the world of Python
\> **num = False**
\> def main() :
\> global num
\> if doc.GetTime() == doc.GetMinTime() :
\> num = 0
\> num +=1
\> print (num)
the num=false, is there so that if I save the scene with the play head is NOT on frame 0, and reload, I don't get an error.
1. What exactly does num=false mean?
2. In the context of the Python Effector, what happens to anything outside the main function? When is it evaluated?
On 24/11/2017 at 04:26, xxxxxxxx wrote:
In "Parameter Control", main is called once for every clone (or even parameter? not entirely sure) and is
supposed to return a weight for that clone, which will be multiplied by the Python Effector's parameters in
the "Parameter" tab.
In "Full Control" mode, main() is called once to control all clones at once, requiring you to fill in all
the information for every clone in one go (as the example code shows by using md.GetArray() and
1. False is just a boolean value, indicating the absence or invalid nature of something ;) You can however
add a number of False and it will act like the integer 0. You can do the same with num=0 (which would
be more consistent with the rest of your code).
2. The outside of the main function is executed only when the Python generator is associated used by
a MoGraph object that is not empty, and only once to load the main() function into memory.
When you change the code and press the "Execute..." button in the editor or close and open the scene
again, the code will also be loaded once (with the above conditions still applying).
On 24/11/2017 at 04:31, xxxxxxxx wrote: