Plugin Cafe Homepage
Forum Home Forum Home > Plugin Cafe > SDK Help
  New Posts New Posts
  FAQ FAQ  Forum Search   Register Register  Login Login

Generator plugin

 Post Reply Post Reply
Author
Message
Mohamed Samir View Drop Down
Member
Member
Avatar

Joined: 2016 Jul 08
Online Status: Offline
Posts: 5
Post Options Post Options   Quote Mohamed Samir Quote  Post ReplyReply Direct Link To This Post Topic: Generator plugin
    Posted: 2017 Sep 05 at 7:55am

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.


Edited by Mohamed Samir - 2017 Sep 05 at 7:56am
Back to Top
knickknack View Drop Down
Forum Moderator
Forum Moderator


Joined: 2016 Jul 01
Location: Italy
Online Status: Offline
Posts: 165
Post Options Post Options   Quote knickknack Quote  Post ReplyReply Direct Link To This Post Posted: 2017 Sep 06 at 6:16am
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,


MAXON Computer GmbH
SDK Support Team
Back to Top
Mohamed Samir View Drop Down
Member
Member
Avatar

Joined: 2016 Jul 08
Online Status: Offline
Posts: 5
Post Options Post Options   Quote Mohamed Samir Quote  Post ReplyReply Direct Link To This Post Posted: 2017 Sep 06 at 9:10am
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.

Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Bulletin Board Software by Web Wiz Forums® version 9.61 [Free Express Edition]
Copyright ©2001-2009 Web Wiz

This page was generated in 0.094 seconds.