Arnold render settings are stored as a Video Post node. To set up the render settings programmatically you have to create a new video post instance and add it to the active render data.

The CINEMA 4D python SDK has a limitation and does not allow creating video post nodes. As a workaround C4DtoA offers a command to create the Arnold video post. The command id is 1039333.


Here's a simple example which returns the active Arnold render settings video post or creates and activates a new one if it does not exist yet:

ARNOLD_RENDERER = 1029988
ARNOLD_RENDERER_COMMAND = 1039333
 
def GetArnoldRenderSettings():
    rdata = doc.GetActiveRenderData()
 
    # find the active Arnold render settings
    videopost = rdata.GetFirstVideoPost()
    while videopost:
        if videopost.GetType() == ARNOLD_RENDERER:
            return videopost;
        videopost = videopost.GetNext()
    
    # create a new one when does not exist
    if videopost is None:
        c4d.CallCommand(ARNOLD_RENDERER_COMMAND)
        
        videopost = rdata.GetFirstVideoPost()
        while videopost:
            if videopost.GetType() == ARNOLD_RENDERER:
                return videopost;
            videopost = videopost.GetNext()
            
    return None


If you have the video post data you can change any render settings as you would do normally in other nodes:

# find the Arnold video post data    
arnoldRenderSettings = GetArnoldRenderSettings()
if arnoldRenderSettings is None:
    raise BaseException("Failed to find Arnold render settings")

# setup the settings
# see C4DtoA/res/description/ainode_options.res for the available parameter ids
# for example to change the Camera AA samples
arnoldRenderSettings[c4d.C4DAIP_OPTIONS_AA_SAMPLES] = 5
    
# update the scene
c4d.EventAdd()
  • No labels
Privacy settings / Do not sell my personal information / Privacy/Cookies