Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Unread
    • Recent
    • Tags
    • Users
    • Login

    is it possible for me to have a plugin that modifies some function of cinema 4d?

    Cinema 4D SDK
    4
    11
    1.5k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • pyxelriggerP
      pyxelrigger
      last edited by

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

      1 Reply Last reply Reply Quote 0
      • C4DSC
        C4DS
        last edited by C4DS

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

        1 Reply Last reply Reply Quote 0
        • pyxelriggerP
          pyxelrigger
          last edited by

          yeah! I am aware of this but I would like to know if it is possible to change the command

          1 Reply Last reply Reply Quote 0
          • a_blockA
            a_block
            last edited by

            No, it is not possible to change existing commands. Sorry.

            1 Reply Last reply Reply Quote 0
            • ferdinandF
              ferdinand
              last edited by

              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

              MAXON SDK Specialist
              developers.maxon.net

              1 Reply Last reply Reply Quote 0
              • pyxelriggerP
                pyxelrigger
                last edited by pyxelrigger

                I made a plugin to show you

                would be something like this:

                a7fda023-3207-4eaa-85e1-1f7f8f1e6272-image.png
                Coquito.pyp

                ferdinandF 1 Reply Last reply Reply Quote 0
                • ferdinandF
                  ferdinand @pyxelrigger
                  last edited by

                  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 a CommandData plugin, it is only being broadcasted to NodeData plugins. You did not mention what your script is supposed to do, but the bottom line is that when you choose the MSG_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 call c4d.CallCommand(12163) # Render View after that. You will then have two buttons for rendering, the actual Render 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

                  MAXON SDK Specialist
                  developers.maxon.net

                  1 Reply Last reply Reply Quote 0
                  • pyxelriggerP
                    pyxelrigger
                    last edited by

                    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"

                    a7ea3cbb-8075-42ff-a26e-6ed81a946f5d-image.png

                    or a simple c4d.gui.QuestionDialog() I'm still deciding

                    by 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?

                    ferdinandF a_blockA 3 Replies Last reply Reply Quote 0
                    • ferdinandF
                      ferdinand @pyxelrigger
                      last edited by

                      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

                      MAXON SDK Specialist
                      developers.maxon.net

                      1 Reply Last reply Reply Quote 0
                      • a_blockA
                        a_block @pyxelrigger
                        last edited by

                        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.

                        1 Reply Last reply Reply Quote 0
                        • ferdinandF
                          ferdinand @pyxelrigger
                          last edited by

                          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

                          MAXON SDK Specialist
                          developers.maxon.net

                          1 Reply Last reply Reply Quote 0
                          • First post
                            Last post