Let's write python with cinema4d. I didn't understand python well, so I wrote down the grammatical python below. http://qiita.com/_nabe/items/36f6f33397e9eec4e3b9
There are several.
First of all, in practice, I often used script tags or execution on the script manager.
It seems that the cinema4d side defines the following variables as a shortcut.
op = represents the script tag itself
Try moving the object randomly every frame. I wrote the following script in the script tag.
move.py
import c4d
import random
def main():
print "move!"
obj = op.GetObject()
obj[c4d.ID_BASEOBJECT_REL_POSITION,c4d.VECTOR_X] = 100 * (random.random()-0.5)
obj[c4d.ID_BASEOBJECT_REL_POSITION,c4d.VECTOR_Y] = 100 * (random.random()-0.5)
obj[c4d.ID_BASEOBJECT_REL_POSITION,c4d.VECTOR_Z] = 100 * (random.random()-0.5)
The capture looks like this.
Property names such as c4d.ID_BASEOBJECT_REL_POSITION, c4d.VECTOR_X are displayed by dragging the parameter name on the gui to the script editor on cinema4d!
I will do my best to find the API from here. Or google! https://developers.maxon.net/docs/Cinema4DPythonSDK/html/index.html
https://github.com/PluginCafe/cinema4d_py_sdk
https://qiita.com/_nabe/items/8c106af9f9f541d3db95
Recommended Posts