Update RenderData from Xpresso



  • 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 ?



  • 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.



  • 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 ...



  • 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.



  • 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 ^^


Log in to reply