Ok, thanks for the confirmation. Already fixed it manually myself.
It seems that module c4d.bitmaps is missing from the auto completion package initialization:
/Applications/Maxon Cinema 4D R25/resource/modules/python/libs/python39/c4d/_ _ init _ _.py :
from c4d import documents
from c4d import gui
from c4d import modules
from c4d import plugins
from c4d import storage
from c4d import threading
from c4d import utils
All the other classes/modules are imported, except bitmaps. Is this intentional or a bug?
A big thumbs-up for this! I've also started using Python typing in PyCharm, now that C4D API is finally based on Python 3. Having correct typing also in the dummy package would be really useful.
Ok, thanks for the clarification.
CTrack documentation talks about ”index” a lot, when referring to keys, but I haven’t yet found any definite specification for it. Are the keys indexed in what order? Time? Order of insert? Random? Does the index start from 0 or 1?
Thank you, Cairyn. When you document method "SplurgeMiddlePhalange()" with "this method splurges your middle phalange", you're not really helping anyone...
A followup question: is there a way to get the time and/or value of previous/next keyframe of a CKey (on the same track)? I was hoping these mysterious left/right methods would do that, but apparently not.
Could someone please enlighten me: what exactly do these Python CKey left/right methods do? The documentation is somewhat... vague (the text below is taken directly from Maxon's Python API documentation pages).
CKey.GetTimeLeft(self) : "Get the left time of this key"
CKey.GetTimeRight(self) : "Get the left time of this key"
CKey.GetValueLeft(self) : "Get the value of this key"
CKey.GetValueRight(self) : "Get the right of this key"
CKey.SetValueLeft(self, seq, v) : "Set the left value of this key"
CKey.SetValueRight(self, seq, v) : "Set the right value of this key"
CKey.SetTimeLeft(self, seq, t) : "Set the left time of this key"
CKey.SetTimeRight(self, seq, t) : "Set the right time of this key"
(as I've suggested before: Maxon should really REALLY put more resources in the API documentation quality)
Thanks for the drag'n'drop tip Maxime, that feature is extremely useful!
Thanks PluginStudent, that was a lot easier than I thought!
C4D's Python SDK has method c4d.documents.AddMarker(), which only allows you to enter the marker's name and time position. What about other marker attributes, such as length, color, note etc.: is it possible to modify them after the new marker has been created?
With kind regards,
I know this is an old topic, but just for the record...
The same thing seems to happen on macOS as well (Cinema 4D R21.207, macOS Catalina 10.15.3).
If xpos and ypos are -2 (i.e. show the dialog in the middle of the screen), and pluginID is not given as parameter, the dialog dimensions are about half of what they're supposed to be. If a pluginID is given, dialog dimensions are correct.
The examples Maxon has in GitHub include "Py-TextureBaker", which seems to use threads. I'm currently going through that code (and trying to understand it...), because I'm facing the exact same challenge as OP: how to start something in a thread, and make that thread send messages to other plugins.
Ok, thanks for your reply. I think that particular help page should be rewritten completely, as there are many typographical problems regarding reserved words vs. placeholders. F.ex. words like "CONTAINER", "STRINGTABLE" and "INCLUDE" are meant to be reserved words (i.e. they should appear as-is in the .res or .str file). On the other hand, "ELEMENTTYPE" is not a reserved word (if I've understood the syntax correctly); it represents any valid attribute type, f.ex. "BOOL". There might be other examples as well.
This is probably all clear to experienced C4D developers, but for a newcomer such as myself, the documentation is somewhat confusing. Typography really matters, when you're defining a syntax to someone new.
The documentation on this page:
...defines the structure of a .str file like this:
ELEMENT_1 "Long Name";
ELEMENT_2 "Long Name" "Short Name";
...but all the examples I've seen so far look like this:
descriptionname "some text here";
Is there an error in the documentation or is this something that has changed in R21?
Ok, got it. Thank you for your reply and clear explanation, r_gigante, much appreciated!
Maxon's Python plugin structure page
mentions three different API calls PluginStart(), PluginEnd() and PluginMessage() in the message ID section. However, all the Python examples that I've found only implement PluginMessage(). Does this mean, that only PluginMessage() applies to Python plugins, and the other two are for C++ plugins only? I wrote a small Python test plugin with all three functions, and only PluginMessage() was ever called (with different message IDs).
I have tried to find some verification for this in Maxon's SDK documentation but haven't found anything so far (but I'm pretty new with this, so I might have missed something relevant...)
Regarding issue 1 (default.profraw): I got the same error message "Failed to write file 'default.profraw': Permission denied" when running c4dpy (Cinema 4D's own Python interpreter) for the first time. The file "default.profraw" is related to Xcode (Apple's IDE) and has something to do with the testing/debugging/profiling phase of program development.
My guess is, that in some parts of Cinema 4D, a debugging or profiling flag has been left "on" by mistake, and that's why the app (or some part of it) is trying to create this particular file "default.profraw". In my case, c4dpy was trying to create it in the main Cinema 4D directory, which is (by default) owned by root, and write-protected. When I changed the directory access rights (removed write-protection), the error message disappeared, but now a "default.profraw" appears in the Cinema 4D folder whenever I run c4dpy.
I have no idea if all this is general knowledge, or just a shot in the dark... hope it helps you guys...