start rendering in pictureviewer via script



  • On 23/09/2015 at 05:55, xxxxxxxx wrote:

    i want to start a rendering without a mouseclick on a remote maschine.

    to archived that i wrote a script which is able to call c4d like:

    ('"C:\Program Files\MAXON\CINEMA 4D R16\CINEMA 4D.exe" -render "'+c4d+'"')

    were c4d = the c4d file

    but i need to see the progress in the picture viewer. is there a sneaky way to get my desired results?

    an alternative is to use the autostart python thing for it.



  • On 24/09/2015 at 07:08, xxxxxxxx wrote:

    Hi,

    I don't think Commandline Renderer has such an option.
    But the "autostart python thing" can be used for it. Simply introduce your own commandline option, like so:

    import sys
    import c4d
      
    def PluginMessage(id, data) :
      if id == c4d.C4DPL_COMMANDLINEARGS:
        for arg in sys.argv:
          if arg.find("-render2pv") == 0:
            argComponents = arg.split(' ')
            c4d.documents.LoadFile(argComponents[1])
            c4d.CallCommand(12099, 12099)
            break
      return True
    

    I suggest to create an render2pv folder in your plugins folder. Then store the above code in a render2pv.pyp file into this folder.
    Then you can call Cinema 4D like so:
    C:\Program Files\MAXON\CINEMA 4D R16\CINEMA 4D.exe "-render2pv myscenefile.c4d"
    Just note, that I wrote the commandline parsing so that you have to pass -render2pv and the scenefile as one argument, thus the quotation marks. Because otherwise C4D would load the scene file automatically and then you run into problems, because C4D will load the file after this code and you'll end up with a requester asking if the identical file should be loaded again.
    Only remaining drawback, there will be a warning about the unknown commandline argument in the console.



  • On 26/09/2015 at 02:10, xxxxxxxx wrote:

    yay this is a quite neat solution for that!

    thank you!


Log in to reply