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

    Run command, after c4d fully loaded...

    Cinema 4D SDK
    4
    5
    1.0k
    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.
    • ymoonY
      ymoon
      last edited by

      Run command, after c4d fully loaded...

      I'm trying to render hundreds of scenes.
      Currently using the C4D "Render Queue".
      However, C4D is crashing for some unknown reason.
      It's very tiring to keep watching C4D.
      I found a way to restart C4D whenever C4D crashes.

      Now I'm looking for a way to open the "render queue window" and run the "render start" command after the C4D is fully loaded.

      python_init.py is of no use as it is done before C4D is fully loaded.

      Is it possible in C4D to?
      1.Open C4D, Fully Loaded
      2.Open "Render Queue" Window
      3.Run Command "Render Start"(in Render Queue)

      Thank You....

      ferdinandF 1 Reply Last reply Reply Quote 0
      • fwilleke80F
        fwilleke80
        last edited by

        Shouldn't that be possible in PluginMessage() with id == C4DPL_STARTACTIVITY?

        https://developers.maxon.net/docs/py/2023_2/misc/pluginstructure.html?highlight=pluginmessage#PluginMessage

        Cheers,
        Frank

        www.frankwilleke.de
        Only asking personal code questions here.

        1 Reply Last reply Reply Quote 0
        • kbarK
          kbar
          last edited by kbar

          I actually sell a plugin that lets you specify a python file to run on startup but before the scene loads. And it also can call another python file after a scene loads. This is mainly used by Render Farms.

          https://plugins4d.gumroad.com/l/callpython

          You would start C4D like this

          c:\Program Files\Maxon Cinema 4D R25\Cinema 4D.exe -runpython "F:\createcube.py"

          https://www.gamelogicdesign.com
          https://www.plugins4d.com

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

            Hello @ymoon,

            thank you for reaching out to us and please excuse the slight delay in my answer. While the answers given here are all helpful (thanks guys!), I would press for taking a few steps back.

            1. It is neither normal, nor acceptable that Cinema 4D does crash. I would turn to customer support with your problem, to see if either your bug/problem is already known and/or if there does exist a workaround. This is primarily important because that there is no guarantee that turning to Python will make your problem go away. Please note that we are not customer support here, you can get it in the support center of ours.
            2. If your files are so heavy that your machine starts to buckle under the load of running a full Cinema 4D and rendering your scene, you can use one of the two GUI-less Cinema 4D instances we do offer, the Commandline and the c4dpy executables.
            3. In Python you can run the render queue. You can find the documentation for it under c4d.documents.BatchRender.
            4. I would normally either use c4dpy or just a normal Script Manager script for invoking a batch render, but if this is really the only option which fits your case, you could also write a plugin that listens in PluginMessage() for one of the early plugin messages, e.g., C4DPL_STARTACTIVITY as pointed out by Frank. But this solution of writing a full plugin seems unnecessarily complex.

            Cheers,
            Ferdinand

            MAXON SDK Specialist
            developers.maxon.net

            1 Reply Last reply Reply Quote 1
            • ymoonY
              ymoon
              last edited by

              Thank you.. It's Solved.
              @fwilleke80 @ferdinand and @kbar

              def PluginMessage(_id, data):
              if _id == c4d.C4DPL_PROGRAM_STARTED:

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