As I was trying to find out a solution on how to do this in this forum, I came across this reply on how to install pip in Cinema 4D:
Now how to install pip?
1. Downloads https://bootstrap.pypa.io/get-pip.py.
2. Downloads the c4dpy version matching your Cinema 4D version. (Already included in R21)
3. Moves c4dpy and get-pip.py in the Cinema 4D folder.
4. Opens a shell to the Cinema 4D folder:
Window: Type cmd in the top path and press Enter.
Mac: Open a new shell, then with cd navigate to your Cinema 4D folder. (You can drag and drop the path).
5. Runs this command line c4dpy get-pip.py. This will execute the get-pip script which will, download and install the pip module.
6. Now you can start to play with pip c4dpy -m pip install numpy. c4dpy allow to runs any module with the -m argument see c4dpy commandline. in this case I asked to pip to download and install numpy but any other 3rd party compatible with pip can be downloaded and used.
With that's said we do not provide support for 3rd party modules, so if it does not work with Cinema 4D Python environment, we can't help you.
I got some questions:
I want to use pip to make this line of code work inside Cinema 4D:
from pynput.keyboard import Key, Controller
keyboard = Controller()
Will this code work when I successfully follow the "how to install pip" instruction?
Thank you guys
What I want to do with this code is when i turn on the User Data (Boolean) of the Python Tag, it hits the "Record Animated":
pass #put in your code here
onoff = op[c4d.ID_USERDATA, 1]
print ("userdataXD: ", onoff)
if onoff == 1:
c4d.CallCommand(202665) # Record Animated
For some reason the call command for Record Animated does not work (but in theory it should; I am new at this so this might sound newbie to most of you guys)
I am kind of new to C4D python coding. I have good grasp of the coding basics (if-else, for/while loops, booleans, etc), but I want to know if there is a way to record keyframe of an object's property when it changes.
This is the rough draft of what I want to do:
Using a User Data (Boolean) that is added to a Python Tag of a Null Object (used just to hold the tag), the code will record the keyframe of an Object's property as it changes when timeline is played (let's just say the Object's property is controlled by a node in XPresso Tag, so there's no keyframe)
The User Data (Boolean) of the Python Tag is controlled by an XPresso Tag so that it detects whether or not the Object's property is changed
Basically, as the timeline is playing and the Object's property is changing, the code will create keyframes for those changes
Not sure if this is clear enough or not. Hopefully you guys can help me! I really want to learn this software so much.
(I want to use this code for character animation, so if it is possible, may the method of recording the keyframes be "Record Animated"-like (R23 feature, basically only records the properties that are touched or animated))
Thank you so much!