Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python 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

    Update RenderData from Xpresso

    Scheduled Pinned Locked Moved PYTHON Development
    5 Posts 0 Posters 722 Views
    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.
    • H Offline
      Helper
      last edited by

      THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

      On 18/07/2011 at 08:37, xxxxxxxx wrote:

      Hi folks,

      I bet this will be a pretty easy answer for you pros.
      Can anybody tell me how to upate the actual RenderData ?

      I want to achive that the Outputname of a file is changed to whatever I want to.

      renderdata = doc.GetActiveRenderData()
        rd_bc = renderdata.GetDataInstance()
        renderoutput = os.path.split(rd_bc.GetData(5041))
        new_name ="Blabla"
        new_output = os.path.join(renderoutput[0],new_name)
        print "New:", new_output
        rd_bc.SetData(5041,new_output)
        renderdata.Message(5041)

      But the only thing that happens is that the box in the rendersettings turns blank.
      But if I recheck it afterwards

      renderdata = doc.GetActiveRenderData()
          rd_bc = renderdata.GetDataInstance()
          renderoutput = os.path.split(rd_bc.GetData(5041))
          print renderoutput[1]

      It seems to work fine.
      I guess I forgot to pass an information to C4D !?

      Can anybody help me out please ?

      1 Reply Last reply Reply Quote 0
      • H Offline
        Helper
        last edited by

        THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

        On 18/07/2011 at 20:17, xxxxxxxx wrote:

        it may be this:

        rd_bc.SetData(5041,new_output)

        try this instead:

        renderdata.SetData(5041,new_output)

        what exactly is 5041 pointing to? i just ask because you may be able to directly access the attribute you are trying to set more like this:

        renderdata[c4d.RDATA_PATH] = new_output

        just a couple ideas.

        1 Reply Last reply Reply Quote 0
        • H Offline
          Helper
          last edited by

          THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

          On 19/07/2011 at 01:24, xxxxxxxx wrote:

          Thank you for your ideas,

          unfortunately none of this worked, the result is always the same.

          I become sus**cious because when I recheck it after the script it says it worked

          before

          (5041, '\\Footage\\Xpresso test\ hatstheoldname')

          after

          (5041, '\\Footage\\Xpresso test\\blabla')

          just the field in the rendersettingis empty 😵

          Oh maybe I should say that this is an Xpressonode where the code is stored ...

          1 Reply Last reply Reply Quote 0
          • H Offline
            Helper
            last edited by

            THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

            On 19/07/2011 at 04:53, xxxxxxxx wrote:

            Your approach isn't bad, especially the renderdata.Message(5041) part.
            But in the Message() method, you have to specify what type of message you want to send, not to what element the message goes to.
            Also, you can access the renderdata's container by using __setitem__ and __getitem__.

            The right code would look like this:

            rd = doc.GetFirstRenderData()   
            rd[c4d.RDATA_PATH] = r"\Some\Or\Any\Path\"   
            rd.Message(c4d.MSG_UPDATE)
            

            Remember to use constants from the c4d module rather than using the actual ID's.
            This makes the code more clear, easier to read and is more flexible for upcoming c4d releases.

            1 Reply Last reply Reply Quote 0
            • H Offline
              Helper
              last edited by

              THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

              On 19/07/2011 at 05:39, xxxxxxxx wrote:

              Oh man thank you nux95

              The strange thing was the behavior of c4d.

              I started a new scene from scratch, copy pasted your code.
              Et voilà, it worked as suspected.

              Then I copied your solution in my original scene, cleared all the rest of the code, and it did not work.

              Then I copy pasted my original scene setup to a new file and your code as well and it worked again ... 😕

              I have to learn more about the messages, cuz they make my 😵

              Anyway thank you very, very much for giving my a hand, again ! 🍺

              PS: How is it going since the last time we wrote ^^

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