I'm trying so set up something that will switch between low resolution proxies during interactive sessions and the high resolution model when rendering. We are rendering with Redshift.
What I've got going is based on this: Thread 10877
I have added 2 layers to my scene. One containing the proxy objects ("Lyr_PROXY") the other("Lyr_HQ") holding the full resolution models. On a null object there is a python-tag with the following code:
import c4d
def main():
global render
obj = op.GetObject()
status = obj[c4d.ID_BASEOBJECT_GENERATOR_FLAG]
ON_list = obj[c4d.ID_USERDATA, 1] #use 1 for the first user data
OFF_list = obj[c4d.ID_USERDATA, 2]#use 2 for the second user data
if c4d.threading.GeIsMainThread()==False:
the_thread = c4d.threading.GeGetCurrentThread()
if c4d.threading.IdentifyThread(the_thread) == c4d.THREADTYPE_RENDEREXTERNAL:
render = True
elif c4d.threading.IdentifyThread(the_thread) == c4d.THREADTYPE_NONE:
render = True
elif c4d.threading.IdentifyThread(the_thread) == c4d.THREADTYPE_RENDEREDITOR:
render = True
else: render = False
layer_object_root = doc.GetLayerObjectRoot()
layers = layer_object_root.GetChildren()
setting_proxy = bool(int(not render) * int(status))
setting_hq = bool(int(render) + int(not status))
for layer in layers:
if layer.GetName() == "Lyr_PROXY":
layer.SetLayerData(doc,{ 'view':setting_proxy, 'render':setting_proxy, 'generators':setting_proxy, 'animation':setting_proxy })
if layer.GetName() == "Lyr_HQ":
layer.SetLayerData(doc,{ 'view':setting_hq, 'render':setting_hq, 'generators':setting_hq, 'animation':setting_hq })
This works when doing a bucket render to the pictureviewer or to the redshift renderviewer but not when doing interactive renders in the redshift renderview. It would be nice if this would work aswell but more importantly it also doesn't work when doing commandline renders with deadline. How do I know it's doing a commandline rendering? Or any other way of render with redshift?
I've looked at "4d.CheckIsRunning()" but that doesn't seem to be the answer.
Thanks. Bart