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