Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Unread
    • Recent
    • Tags
    • Users
    • Login

    Cannot update values of BaseContainer of VideoPost

    Cinema 4D SDK
    python r19
    2
    5
    1.2k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • S
      shrvnn
      last edited by r_gigante

      I am using Indigo Renderer plugin in Cinema4D for rendering. I am trying to automate rendering. For that I need to change the value of Save Image path under Indigo Renderer settings in C4D Render Setttings.

      I have successfully accessed the value of Save Image path through code. But on modifying it doesn't reflect in render settings or even if I again fetch the values by repeating the same code. The values are not updated at all.

      rd = doc.GetActiveRenderData()   
      vp = rd.GetFirstVideoPost()
      while(vp.GetName() != "Indigo Renderer"): 
          vp = vp.GetNext()
          if(vp is None): 
              return
      bc = vp.GetData()
      
      #Getting the correct value as in Render Setting UI
      print bc[c4d.RS_IMAGE_SAVE_PATH]
      
      #Updating the file path
      bc[c4d.RS_IMAGE_SAVE_PATH] = "FileName"
      
      #Repeating the code to get the value after changing
      rd = doc.GetActiveRenderData()
      vp = rd.GetFirstVideoPost()
      while(vp.GetName() != "Indigo Renderer"): 
           vp = vp.GetNext()
           if(vp is None): 
               return      
       bc = vp.GetData()
      print rd[c4d.RS_IMAGE_SAVE_PATH]
      #The image path is not updated.
      

      I have also tried GetDataInstance() and then update, but didnt work.

      Please help!

      1 Reply Last reply Reply Quote 0
      • S
        s_bach
        last edited by s_bach

        Hello,

        I don't have Indigo Renderer so I can't make any statement about this specific scenario.

        But I can give some general advice on editing parameters and using the API.

        First, when searching for specific comment it is probably better to check for the ID of an element instead of the name. Sou you can use .GetType() to get the ID of the video post.

        Instead of accessing the BaseContainer you can also access parameters using GetParameter() and SetParameter(). Something like this:

        gpuVideoPost.SetParameter(c4d.VP_GPURENDERER_DEVICES_OVERRIDE_PREFS, True, c4d.DESCFLAGS_SET_0)
        gpuVideoPost.SetParameter(c4d.VP_GPURENDERER_DEVICE_CPU_OFFLINE, False, c4d.DESCFLAGS_SET_0)
        

        Finally, when you change something in the document or a component of the document you must inform Cinema 4D that something has changed. Only then Cinema will update the GUI. This is done by calling c4d.EventAdd().

        best wishes,
        Sebastian

        MAXON SDK Specialist

        Development Blog, MAXON Registered Developer

        1 Reply Last reply Reply Quote 0
        • S
          shrvnn
          last edited by

          That really worked! Thank you so much Sebastian! I had almost hit a wall solving this.

          1 Reply Last reply Reply Quote 0
          • S
            shrvnn
            last edited by

            I am facing a new problem. You said that c4d.EventAdd() will update the GUI.

            I am actually changing the Renderer from plugin which is called using CommandLine. When I make change, the value in drop down for Renderer changes from Standard to Indigo Renderer, but the sub menu doesn't refresh. The submenu has options like Output, Save, Material Override and so on.

            When I manually change it back to Standard and again back to Indigo renderer or any, the sub menu is refreshed and respective values are reflected. First it remain same as that of Standard Renderer.

            Is there any other way to update render settings menu?

            1 Reply Last reply Reply Quote 0
            • S
              s_bach
              last edited by

              Hello,

              I'm not really sure I understand what you are doing. Are you operating in a command line version of Cinema? Or is you code reacting to some command line arguments? Are you operating on the currently active BaseDocument?

              As I said, I don't have Indigo Renderer so I can't test this specific scenario.

              But when you "change" the renderer, you also have to "create" that renderer video post when operating in a new document. So it is not enough just to change the RDATA_RENDERENGINE parameter.

              This example shows how to set and create the "Hardware" renderer:

              renderData = doc.GetActiveRenderData()
              if renderData is None:
              		return
              
              # set Hardware as active renderer
              bc = renderData.GetDataInstance()
              bc[c4d.RDATA_RENDERENGINE] = c4d.RDATA_RENDERENGINE_PREVIEWHARDWARE
              
              # add Hardware post effect
              # in Python a BaseList2D object must be created
              videoPost = c4d.BaseList2D(c4d.RDATA_RENDERENGINE_PREVIEWHARDWARE)
              renderData.InsertVideoPost(videoPost)
              
              c4d.EventAdd()
              

              You find general information on RenderData also in the C++ documentation: RenderData Manual.

              best wishes,
              Sebastian

              MAXON SDK Specialist

              Development Blog, MAXON Registered Developer

              1 Reply Last reply Reply Quote 0
              • First post
                Last post