Dynamic Render Region



  • On 18/07/2016 at 17:38, xxxxxxxx wrote:

    I have a tag that changes the Render Region parameters in the Render Settings.
    It all works fine while in the editor and while rendering a still.
    But, if I try to render an animation, the Render Region is not updated.
    All the frames are rendered with the initial Render Region values.
    The position of the Render Region is calculated based on the screen bounding box coordinates of an object.
    That is obtained from the BaseDraw.
    Isn't that available while rendering? Could it be due to that that the placement of the Render Region doesn't get updated?



  • On 18/07/2016 at 19:30, xxxxxxxx wrote:

    Ok, I found a way to bake the information.
    Also, I have a way to know if the main external renderer is happening.
    I'm loading the baked results in the Render Region of the active render but it is not updating.
    What type of message must I send to my document or to the render data to make it update during render?



  • On 19/07/2016 at 01:58, xxxxxxxx wrote:

    Hello,

    as always a tag should only store data or modify the host object. A tag (or to be more precise: a tag's Execute() function) should not modify the scene, especially not during rendering.

    Please post some code that shows what exactly you are doing.

    Best wishes,
    Sebastian



  • On 19/07/2016 at 02:41, xxxxxxxx wrote:

    Hello Sebastian

    The snippet of the Execute code that is trying to adjust the Render Region is this one:

      
        
        
        def Execute(self,tag,doc,op,bt,priority,flags) :  
        
        	if op==None: return c4d.EXECUTIONRESULT_OK  
        
        	if c4d.threading.GeIsMainThread() == False:  
        
        		the_thread = c4d.threading.GeGetCurrentThread()
        		render = c4d.threading.IdentifyThread(the_thread) == c4d.THREADTYPE_RENDEREXTERNAL
        		if render==True:
        			bc0=tag.GetData()  
        			# the data is stored inside a container with ID=10000  
        			bc1=bc0.GetData(10000)
        			if bc1==None: return c4d.EXECUTIONRESULT_OK  
        
        			fps=doc.GetFps()
        			ctime = doc.GetTime().GetFrame(fps)
        			bc2=bc1.GetData(ctime)  
        
        			if bc2 != None:
        				rd=doc.GetActiveRenderData()  
        				# each four values are stored inside a container with ID equal to the frame number  
        				rd[c4d.RDATA_RENDERREGION_LEFT]=bc2.GetLong(0)
        				rd[c4d.RDATA_RENDERREGION_RIGHT]=bc2.GetLong(1)
        				rd[c4d.RDATA_RENDERREGION_TOP]=bc2.GetLong(2)
        				rd[c4d.RDATA_RENDERREGION_BOTTOM]=bc2.GetLong(3)
        				doc.SetActiveRenderData(rd)
        				doc.Message(c4d.MSG_UPDATE)  
        
        			return c4d.EXECUTIONRESULT_OK  
        			...  
        			# the rest of the Execute code 
    


  • On 19/07/2016 at 06:36, xxxxxxxx wrote:

    I will be soooooo sad if this isn't possible :-(



  • On 19/07/2016 at 09:08, xxxxxxxx wrote:

    Hello,

    as you know, rendering is done using the RenderDocument() function. The second argument of the function is a BaseContainer that contains the render settings.

    Cinema 4D will (mostly) use the content of this BaseContainer to get the relevant settings for the given rendering process. As the data in this container is static, it cannot be changed during rendering.

    best wishes,
    Sebastian



  • On 19/07/2016 at 09:31, xxxxxxxx wrote:

    So, I will have to create my own rendering command, rendering each frame individually and adjusting the container for each frame, right?



  • On 19/07/2016 at 23:12, xxxxxxxx wrote:

    Hello,

    rendering each frame individually of course would work. But such a solution might not support inter-frame effects like motion-blur etc.

    best wishes,
    Sebastian



  • On 20/07/2016 at 00:24, xxxxxxxx wrote:

    Oh, damn!! :-(
    Well, I will have to warn about those limitations.



  • On 25/07/2016 at 00:00, xxxxxxxx wrote:

    Rui Batista , your plugin not work as expected.
    It does not work on my character

    Traceback (most recent call last) :  
    File "'Dynamic IRR.pypv'", line 729, in Execute  
    AttributeError: 'c4d.modules.character.CAJointObject' object has no attribute 'GetAllPoints'
    


  • On 25/07/2016 at 00:07, xxxxxxxx wrote:

    Thank you.
    I will check for Joints and I will update the code as soon as possible.


Log in to reply