Navigation

    • Register
    • Login
        No matches found
    • Search
    1. Home
    2. wen
    W

    wen

    @wen

    0
    Reputation
    8
    Posts
    15
    Profile views
    0
    Followers
    0
    Following
    Joined Last Online

    • Profile
    • More
      • Following
      • Followers
      • Topics
      • Posts
      • Best
      • Groups
    wen Follow

    Best posts made by wen

    This user hasn't posted anything yet.

    Latest posts made by wen

    RE: Access renderer specific settings with python

    Hi Ferdinand,

    I am indeed running R22. Your comment about using the document associated with the render was spot on. I assumed they would be the same document but apparently they are not. After changing this it works as expected.

    I've included a working example incase someone else is looking for the same thing.
    Render_viewTransform.c4d

    Got a new question though, what do you mean with:
    "In R25 Redshift does not have a "Raw" color profile anymore"
    Had a look at R25 and didn't see anything different in that regard.

    Thanks!

    posted in Cinema 4D SDK •
    RE: Access renderer specific settings with python

    Hi Ferdinant,
    Thanks for the example.
    I'm trying to use a python tag to set the view to raw when doing final renders and have it on SDR during interactive renders.
    The settings are being set but somehow this doesnt trigger an update it appears. Only when manually forcing an update on the rendersetting it is changed. This is the code I'm using:

    import c4d
    import redshift
    
    def changeSettings(obj, videoPost, isRendering):
        if isRendering:
            segs = 24
            view = r"Raw"
        else:
            segs = 3
            view = r"ACES 1.0 SDR-video"
    
        # avoid applying redundant changes
        if obj[c4d.PRIM_SPHERE_SUB] != segs:
            print("Setting to %d" %segs)
            obj[c4d.PRIM_SPHERE_SUB] = segs
            print(view)
            videoPost[c4d.REDSHIFT_RENDERER_COLOR_MANAGEMENT_OCIO_VIEW] = view
            obj.Message(c4d.MSG_CHANGE)
    
            # EvenAdd is only needed when modifying the active document
            if doc == c4d.documents.GetActiveDocument():
                c4d.EventAdd()
    
    def main():
        pass
    
    def message(msgType, data):
        print
        # Check for final renders
        if msgType==c4d.MSG_MULTI_RENDERNOTIFICATION:
            redshiftRenderEngineId = 1036219
            my_render_data = c4d.documents.GetActiveDocument().GetActiveRenderData()
            videoPost = my_render_data.GetFirstVideoPost()
    
            while (videoPost):
                if videoPost.CheckType(redshiftRenderEngineId):
                    break
                videoPost = videoPost.GetNext()
            started = data["start"]
            if started:
               print("Render Started")
            else:
               print("Render Finished")
    
            changeSettings(op.GetObject(), videoPost, started)
    

    I've also incuded a test file
    Render_viewTransform.c4d

    posted in Cinema 4D SDK •
    Access renderer specific settings with python

    Access renderer specific settings with python

    I'm looking for a way to acces the renderer specific rendersettings with Python. I can adjust common rendersettings like the width, height, start, end, etc. since they are stored in the RenderData. These are accessible through:

    #Store the RenderData object in a variable so it's easier to access
    my_render_data = c4d.documents.GetActiveDocument().GetActiveRenderData()
    
    #Set the render width
    my_render_data[c4d.RDATA_XRES] = 1920
    
    #Set the render height
    my_render_data[c4d.RDATA_YRES] = 1080
    
    #Set the startframe
    # - note we get a BaseTime object so we need to use GetFrame() to get a frameNumber from that. 
    my_render_data[c4d.RDATA_FRAMEFROM].GetFrame(25)
    
    #Set the endframe
    my_render_data[c4d.RDATA_FRAMETO].GetFrame(25)
    
    

    Unfortunately something like this won't work:

    my_render_data = c4d.documents.GetActiveDocument().GetActiveRenderData()
    
    print (my_render_data[c4d.REDSHIFT_RENDERER_COLOR_MANAGEMENT_OCIO_RENDERING_COLORSPACE])
    

    This returns "None" so the renderer specific settings seem to live somewhere else.
    Now I'm assuming if I want to to change renderer specific values I should point to the renderer somehow.
    With RDATA_RENDERENGINE I get the plugin ID. So let's go from there:

    my_render_data = c4d.documents.GetActiveDocument().GetActiveRenderData()
    print (c4d.plugins.FindPlugin(my_render_data[c4d.RDATA_RENDERENGINE]))
    

    This returns:

    <c4d.plugins.BasePlugin object called 'Redshift' with ID 8 at 0x0000027D8A30E590>
    

    Now I'm not sure if this is the right direction as it doesn't get me much further. I still can't acces plugin specific values.
    How do I get/adjust those?

    posted in Cinema 4D SDK •
    RE: Identify when scene is rendering (Redshift)

    After posting on the Redshift forum I got some help from one of the admins there. Although he could not help me finding out if an interactive render is running he had a great tip regarding finding if a render is currently running. His suggestion was to check for the MSG_MULTI_RENDERNOTIFICATION and that works really well including when rendering on the commandline.

    posted in Cinema 4D SDK •
    RE: Identify when scene is rendering (Redshift)

    Hi Riccardo,

    Thanks for your reply. I cant get c4d.GeGetVersionType() to work the way I expect it. I was thinking of output-ing it to a text object for testing purposes. That should than show me a different number when rendering depending on whether it's in the application or through the commandline. Both return 2.

    Furthermore most of the constants I would be checking against don't resolve in R20 but do in R21. Is this command changed significantly in R21? We're still using R20.

    VersionType.png

    posted in Cinema 4D SDK •
    Identify when scene is rendering (Redshift)

    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

    posted in Cinema 4D SDK •
    RE: Get mode (object, face, edge, point) with python

    Thanks Sebastian.

    posted in Cinema 4D SDK •
    Get mode (object, face, edge, point) with python

    I'm working on an alignment tool and I need to know if the user is currently manipulating edges, vertices or face or is in object mode.
    Is there a way to query the current mode state with python? So i want to know which of these buttons is selected.
    mode.png l)

    posted in Cinema 4D SDK •