AWS Thinkbox Discussion Forums

PreJob Script for cinema4d

Tell me how cinema4d plugin start cinema. I have jobs c4d with Octane and i need change path for octane passes, but i don’t how run cinema with my flags. Now i use subprocces.call(). I need run cinema with flags: -nogui -my_flag “asdasd” -my_second_flag “123123”. No need to render. Just change scene and save. Plugin for c4d which triggered on this flags i have.

Well, it depends. There are two C4D plugins in Deadline - one called “Cinema4D”, and one “Cinema4Dbatch”. The latter is used if you check the option in the submitter to force it, or if you select a Python file and request to submit a Script Job where the renderer is not called, just the script is executed (maybe that would work for you?)

In both cases, navigate to the Repository and peek into the corresponding folder under \plugins\ to find the .py script that implements the communication with the application. You can learn from the scripts, or copy them under \YourRepository\custom\plugins\ and make modifications to add more logic, command line arguments, etc.

Similarly, the integrated submitter is located under \YourRepository\submission\cinema4D\, and the Monitor submitter is under \YourRepository\scripts\submission\

Take a look at these scripts, and figure out whether you need to add extra arguments, or whether you can simply submit a custom Python script as a Job Script to run all your code.

If you have specific questions about those scripts, please ask them in this thread…

1 Like

I am installing PreJob Script for certain scenes. The script should run c4d with my flags (commandline.exe -my_flag “data” -my_flag2 “data”) these flags will call the c4d plugin (not the Cinema4d deadline plugin). I am currently using the RunProcess (args, timeout = 60) command. Question: Which command should I use instead of RunProcess?

RunProcess() runs an unmanaged process, basically running a command in a shell.
RunManagedProcess() runs a managed process, and you can run a shell command as a managed process - look at the CommandLine.py Deadline plugin under \DeadlineRepository\plugins\CommandLine for an example that does both as options!

The relevant section in CommandLine.py looks like

def RenderTasks( self ):
    executable = self.GetRenderExecutable()
    arguments = self.GetRenderArguments()
    startupDir = self.GetStartupDirectory()

    shellExecute = self.GetBooleanPluginInfoEntryWithDefault( "ShellExecute", False )
    self.LogInfo( "Execute in Shell: %s" % shellExecute )

    if not shellExecute:
        self.LogInfo( "Invoking: Run Process" )
        # StdOut/Err will NOT be captured here as unmanaged process
        exitCode = self.RunProcess( executable, arguments, startupDir, -1 )
    else:
        self.LogInfo( "Invoking: Managed Shell Process" )
        self.ShProcess = ShellManagedProcess( self, arguments, startupDir )
        self.RunManagedProcess( self.ShProcess )
        exitCode = self.ShProcess.ExitCode

    self.LogInfo( "Process returned: %s" % exitCode )

    if exitCode != 0:
        self.FailRender( "Process returned non-zero exit code '{}'".format( exitCode ) )
1 Like
Privacy | Site terms | Cookie preferences