Motion Blur



  • On 21/12/2017 at 13:14, xxxxxxxx wrote:

    User Information:
    Cinema 4D Version:   R14 
    Platform:   Windows  ;   
    Language(s) :     C++  ;

    ---------

    Hello,

    I am working on a tag plugin that will change the position of a baseobject that it is placed on. When I just play through the timeline the tag successfully changes the position based on a vector that I store inside the tag's basecontainer. Every time that the Execute function runs the stored vector is increased by a set amount.
    My problem comes in when I try to render out the scene with a Sub-Frame Motion Blur. It doesn't seem like the basecontainer is updated each time a sub-frame is run during the render process. In the render the baseobject doesn't have the motion blur because the baseobject's position is only updated a few times during the render.

    This is a trimmed down version of the code.

    EXECUTIONRESULT GorillaCamClass::Execute(BaseTag *tag, BaseDocument *doc, BaseObject *op, BaseThread *bt, LONG priority, EXECUTIONFLAGS flags)
    {
    	if(!doc || !op)
    		return EXECUTIONRESULT_OK ;
      
    	BaseContainer data = tag->GetData();
      
    	Vector distanceVector = data.GetVector(idSavedVector);
    	distanceVector = distanceVector + Vector(20);
    	op->SetAbsPos(distanceVector);
    	data.SetVector(idSavedVector, distanceVector);
    	tag->SetData(data);
    	return EXECUTIONRESULT_OK;
    }
    

    When I bake the baseobject's position the render properly displays the Motion Blur.

    Is there something that I am missing that would properly update the tag's basecontainer, any help would be greatly appreciated.

    Johan H.



  • On 22/12/2017 at 05:40, xxxxxxxx wrote:

    Hi Johan,

    How do you define idSavedVector in the code? Is it declared as a member variable?
    Maybe the implementation of CopyTo() is missing. The function should ensure every class member is copied to the destination object plugin.
    This issue has been already discussed here.

    Also, inside TagData::Execute() we usually retrieve the object's data container with GetDataInstance() so that a parameter can be directly changed.



  • On 22/12/2017 at 09:20, xxxxxxxx wrote:

    Hello Yannick,

    I was under the impression that you needed to use CopyTo() if you weren't storing all of the necessary information inside the plugin's Basecontainer, which I am doing. My problem is that the Basecontainer doesn't seem to be storing my updated values during the rendering process. I define  idSavedVector   as an enum value with a set id.

    Thanks for the reply.

    Johan H.


Log in to reply