Return to orginal before rendering?



  • On 04/08/2014 at 23:41, xxxxxxxx wrote:

    Hello, I am trying to find a way to return an object to it's original state before rendering and am trying to listing out for the rendering call with:

    pvrender = c4d.CheckIsRunning(c4d.CHECKISRUNNING_EXTERNALRENDERING)
    edrender = c4d.CheckIsRunning(c4d.CHECKISRUNNING_EDITORRENDERING)
    doc = c4d.documents.GetActiveDocument ()
    rd = doc.GetActiveRenderData ()
    mm = rd.MultiMessage (c4d.MULTIMSG_ROUTE_BROADCAST, c4d.MSG_MULTI_RENDERNOTIFICATION)
      
    if pvrender or edrender or mm:
    	#return original object
    else:
    	#act on object
    

    I'm getting a little confused with it as there isn't much in the python documentation to go by so I'm googling and getting no where. Could some one please shine a light on this? Would be very grateful.

    Thanks



  • On 05/08/2014 at 15:38, xxxxxxxx wrote:

    Hi
    I'm not sure i understand what you're trying to do :) Does the document contain unsaved changes and you want to render the saved state of the doc? Or are you rendering the selected object on its own?
    How do you determine what the original state of the object is?

    I'm not sure if can help you at all but i just don't understand the problem :)

    Cheers
    Bonsak



  • On 06/08/2014 at 01:54, xxxxxxxx wrote:

    Hi Bonsak,
    For example, I just have a sphere a scene. If I added a python tag to it and randomly reposition the points of the sphere within the tag, how would I, when it comes to rendering the scene in the picture viewer or editor viewer, render it so that the sphere is in its original state, before the random repositioning or the point via the python tag? Is that possible?

    Cheers



  • On 07/08/2014 at 02:37, xxxxxxxx wrote:

    Hm. Could you programatically disable the python tag on render?

    -b



  • On 07/08/2014 at 06:35, xxxxxxxx wrote:

    Yea that's what I'm trying to do but with no luck what's so ever. Has anyone on here done anything like this and could offer some help?



  • On 07/08/2014 at 07:37, xxxxxxxx wrote:

    What about randomly changing the points of the object only after a specific frame is reached in your code?

    -ScottA



  • On 07/08/2014 at 07:43, xxxxxxxx wrote:

    I'm not sure if this is what you're after but here's a simple script that shows how to disable all python tags in a document. Maybe this is something you can incorporate into your code?

    Cheers
    Bonsak

      
    import c4d   
      
    def process(op, switch) :   
      
        # Iterate over each of the object's tags.   
        for tag in op.GetTags() :   
      
             if tag.CheckType(c4d.Tpython) :   
      
                  tag[c4d.EXPRESSION_ENABLE] = switch   
      
        # Iterate over each of the object's children.   
        for child in op.GetChildren() :   
      
             # And repeat this process for each of them.   
             process(child, seen)   
      
    def main() :   
      
        # 0 for off 1 for on   
        switch = 0   
      
        for object in doc.GetObjects() :   
             process(object, switch)   
      
        # Update the UI of Cinema 4D.   
        c4d.EventAdd()   
      
      
    if __name__ == "__main__":   
        main()
    


  • On 08/08/2014 at 02:17, xxxxxxxx wrote:

    Thanks for you're reply Bonsak, unfortunately this is the part of the code I am having a problem with. It's how to listen out for a call to C4D to render, and then turn off the tag or what ever action required. I find it hard to believe that no one on here as implemented such a thing, or is it just that they know how to and are unwilling to share?

    Thanks anyway.



  • On 01/11/2014 at 05:06, xxxxxxxx wrote:



  • On 01/11/2014 at 05:07, xxxxxxxx wrote:

    I'm currently trying to do something similar - and seem to have got it working if you're still interested..


Log in to reply