Python Effector¶
Introduction¶
The Python Effector is used to create custom Effector for a MoGraph object. It can be found in the MoGraph -> Effector menu.
The Python Effector is implemented through an EffectorData which is not available in Python. Take a look in the C++ doc for more information. The Python Effector offers two modes to execute code:
Parameter Control: called for each clone.
Full Control: called only one time to handle all clones at once.
Note
The Python Effector should not create/modify objects in the scene.
See also
The important Threading Information.
Example¶
# This code is used in a Python Effector
import c4d
def main():
md = c4d.modules.mograph.GeGetMoData(op)
if md is None:
return 1.0
# Generator object, same as c4d.modules.mograph.GetGenerator()
print(gen)
# Other variables are also available in a Python effector
print(doc) # Document where the effector is located
print(op) # Effector object
return 1.0
Methods¶
-
main
() Override - Mandatory method, used to set MoGraph data through
c4d.modules.mograph
. It can be called multiple time per frame.
Variables¶
- Next variables are defined in a Python Effector scope (in all functions even yours):
doc:
BaseDocument
: The document hosting the Python Effector.op:
BaseObject
: the Python Effector.gen:
BaseObject
: the MoGraph Generator (e.g. the cloner object which executes the Python Effector).