Generator plugin



  • On 05/09/2017 at 07:55, xxxxxxxx wrote:

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

    ---------
    Hi All,

    I'm currently writing a c4d c++ object generator plugin, the plugin depends on the modification of
     other objects in the same scene, so when other objects updates the plugin should have an indicator
     that one or more dependent objects got updated so I can update the generated object in GetVirtualObject function.

    Problem is, when I check other object's dirty status using the following code:

    BaseObject::IsDirty(DIRTYFLAGS_MATRIX | DIRTYFLAGS_DATA | DIRTYFLAGS_CACHE)
    
    
      
    
    
    
    the code always returns false if the modified object is ABOVE the generator object in 
    
    
    ObjectManager panel! although, the same code returns true if the object is modified 
    
    
    but if it is BELOW the object generator node in ObjectManager panel!
    
    
      
    
    
    
    Can anyone please explain what is happening here? also, is there any better way to inform the 
    
    
    main object generator node that other objects were modified ?
    
    
      
    
    
    
    Also, note that none of the modified objects are children of the generator plugin
    
    
    the generator node just needs to update it's data when one of other objects update.
    
    
      
    
    
    
    Thanks in advance.
    


  • On 06/09/2017 at 06:16, xxxxxxxx wrote:

    Hi Mohamed, thanks for writing us.

    With reference to your support request, please consider that the way generators are designed to make use of input objects to compute the generated geometry officially sees input geometries as "children" of the generator. Any other approach aiming to produce a generator update based on objects, that are not generator's children, should make properly use of a SceneHookData-derived plugin responsible to track the changes of the input objects and consequently change the dirty status of the specific generator.
    This approach should be considered an hack to how Cinema generator are supposed to run and could have, if not properly designed, performance impacts on scene regeneration.

    Best, Riccardo

    Cheers,



  • On 06/09/2017 at 09:10, xxxxxxxx wrote:

    Hi Riccardo,

    Thanks for your reply. I actually found a way of doing this by storing the value that is returned from 
    calling BaseObject::GetDirty() for each object I need to check it's dirty status and then recheck the
    GetDirty function again in the main generator GetVirtualObjects function and compare both values and if they are different then I store the new value and mark object as dirty.

    Hope this helps other devs and thanks again.


Log in to reply