Let's write python with cinema4d.

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

Where to write python in c4d

There are several.

First of all, in practice, I often used script tags or execution on the script manager.

Variables already defined

It seems that the cinema4d side defines the following variables as a shortcut.

Get an object and change its position

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. alt

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! alt

document

I will do my best to find the API from here. Or google! https://developers.maxon.net/docs/Cinema4DPythonSDK/html/index.html

Official sample

https://github.com/PluginCafe/cinema4d_py_sdk

Snippet

https://qiita.com/_nabe/items/8c106af9f9f541d3db95

Recommended Posts

Let's write python with cinema4d.
Let's run Excel with Python
python snippet collection with cinema4d
Write to csv with Python
Let's build git-cat with Python
[Python] Write to csv file with Python
Let's make a GUI with python.
[Python] Let's write briefly about comprehensions
Let's play with Excel with Python [Beginner]
Let's do image scraping with Python
Let's make a graph with python! !!
Read fbx from python with cinema4d
Let's analyze voice with Python # 1 FFT
Write a batch script with Python3.5 ~
FizzBuzz with Python3
Scraping with Python
Statistics with python
Scraping with Python
Python with Go
Let's create a free group with Python
Twilio with Python
Integrate with Python
Play with 2016-Python
[Introduction to Python] Let's use foreach with Python
AES256 with python
Let's read the RINEX file with Python ①
Tested with Python
Let's make a voice slowly with Python
python starts with ()
[Python] Let's make matplotlib compatible with Japanese
with syntax (Python)
Write a TCP client with Python Twisted
Bingo with python
Zundokokiyoshi with python
Let's do MySQL data manipulation with Python
Let's make a web framework with Python! (1)
Let's make a Twitter Bot with Python!
Let's develop an investment algorithm with Python 1
Let's get along with Python # 0 (Environment construction)
Let's make a web framework with Python! (2)
Excel with Python
Microcomputer with Python
[Blender x Python] Let's get started with Blender Python !!
Cast with python
Python hand play (let's get started with AtCoder?)
Let's solve simultaneous linear equations with Python sympy!
[Write to map with plotly] Dynamic visualization with plotly [python]
[Python3] Read and write with datetime isoformat with json
Let's control EV3 motors and sensors with Python
Let's replace UWSC with Python (5) Let's make a Robot
Let's write a Python program and run it
Write CSV data to AWS-S3 with AWS-Lambda + Python
Let's do web scraping with Python (weather forecast)
Let's do web scraping with Python (stock price)
I want to write to a file with Python
Serial communication with Python
Zip, unzip with python
Django 1.11 started with Python3.6
Primality test with Python
Python with eclipse + PyDev.
Socket communication with Python