is it possible for me to have a plugin that modifies some function of cinema 4d?
-
let's say I have a script (which will become a plugin) that needs to be executed before the "Render View" function is it possible to do this with just python?
I have no knowledge of c++ but I imagine it is possible to do this with c++
-
As far as I know there is no possibility to just "hook into" existing commands of Cinema4D.
You will have to provide your own command where you perform the "preliminaries" and then call the existing command.
In other words, for your example, you will want to create a 'My Render View' command which perform the tasks you want to see executed before 'Render View' and which after that just calls 'Render View'. -
yeah! I am aware of this but I would like to know if it is possible to change the command
-
No, it is not possible to change existing commands. Sorry.
-
Hey @everyone,
we will answer this tomorrow more thoroughly, but before @pyxelrigger gives up here, I wanted to point out that while @C4DS and @a_block answers (thanks for jumping in) are in principle correct, there is MSG_MULTI_RENDERNOTIFICATION with which one can react to upcoming renderings, including some form of detection in which context the rendering happens via RENDERFLAGS.
I am also pretty sure that we will ask for more details tomorrow, e.g., what that script is and into which plugin type you plan to convert it. There are restrictions for where you can receive
MSG_MULTI_RENDERNOTIFICATION
and what you can do in the context of the message. So, when you see this before tomorrow, @pyxelrigger, you should add this information.Cheers,
Ferdinand -
-
Hello @pyxelrigger,
thank for reaching out to us, and, big surprise, you topic has been assigned to me .
Thank you for providing more information, I assume from the context that your plugin interface is going to be a
CommandData
plugin.MSG_MULTI_RENDERNOTIFICATION
cannot be received in aCommandData
plugin, it is only being broadcasted toNodeData
plugins. You did not mention what your script is supposed to do, but the bottom line is that when you choose theMSG_MULTI_RENDERNOTIFICATION
approach, then you will not be able to modify the outcome of the rendering, as the render document has already been established at that point. All modifications to the active document will not be reflected in the render.The easiest path for your task seems to be the approach proposed by @C4DS. Just execute your script in the
CommandData
and callc4d.CallCommand(12163) # Render View
after that. You will then have two buttons for rendering, the actualRender View
button provided by Cinema 4D, and the button of your plugin. To make it more convenient, you could put your plugin on a shortcut similar to the default command or simply replace the original button shortcut with the command provided by your plugin.Cheers,
Ferdinand -
hi @ferdinand ,
I also forgot to mention that there will be a button to save the checkbox configuration.before Render To Picture Viewer runs, a dialog with two buttons will run "go to render" and "stop"
or a simple
c4d.gui.QuestionDialog()
I'm still decidingby chance, now taking advantage of it, I already had several other doubts that I had to resort here to the forum and the solution was always something related to MSG, I don't understand anything about this subject, where can I read more about this material?
-
Hello @pyxelrigger,
... MSG, I don't understand anything about this subject, where can I read more about this material?
You can read more about messages in the Python API in the Message Manual.
Cheers,
Ferdinand -
For what it's worth, besides this forum and SDK Team's great work, you may also want to check Cairyn's "Python Spoonfed" series on Patreon. And if these sources are not enough, you can also book me for 1:1 training.
-
Hello @pyxelrigger,
without any further activity before Wednesday, the 16.03.2022, we will consider this topic as solved and remove the "unsolved" state from this topic.
Thank you for your understanding,
Ferdinand