get Generator dependencies

On 27/10/2015 at 09:22, xxxxxxxx wrote:

User Information:
Cinema 4D Version:   15+ 
Language(s) :     C++  ;

I want to get Caches of all objects, consider this simple case:

\+ HyperNurbs  
\+ + Cube  
\+ + Tube  

in this case, HyberNurbs affects the Cube only, and ignores the Tube
when generating Cache "by iterating all objects", this is what I get:

HyperNurbs Cube Cache  
Cube Cache    <<< I want to ignore this, as it is a HyberNurbs(generator) dependency  
Tube Cache  

I want to ignore the Cube Cache, as the Cube itself is already used inside the HyperNurbs, any ideas?

On 28/10/2015 at 03:04, xxxxxxxx wrote:

so it would be something similar to this "but I didn't find any function that can do this in the SDK, probably I missed?"

BaseObject* a;//our generator  
BaseObject* b;//any child to the generator a  
Bool checkdependency(b, a);  

pretty straight forward, any help?

On 28/10/2015 at 03:28, xxxxxxxx wrote:

I guess I found the solution "but I need a confirmation though, as I think I'm a bit lucky "
it is:

BaseObject* op;  
op->GetBit(BIT_CONTROLOBJECT);//this object is used by a generator  

On 28/10/2015 at 07:04, xxxxxxxx wrote:

Hi Mohamed,

you are a bit too fast for me.
Yes, I think, you can use the BIT_CONTROLOBJECT. BUT not directly. In general a generator object will mark it's input objects with the BIT_CONTROLOBJECT. But the generator object has this bit set as well.
Example (* means BIT_CONTROLOBJECT is set, # means it's not) :

\+ HyperNurbs  *
\+ + Poly1 *
\+ + Poly2 #

looks good so far... next example:

version a) :
\+ HyperNurbs  *
\+ + Cube *
\+ + Poly #
version b) :
\+ HyperNurbs  *
\+ + Poly *
\+ + Cube *

And with your example:

\+ HyperNurbs *
\+ + Cube *
\+ + Tube *

Now comes the fun part, examine the caches of the generators:

\+ HyperNurbs *
\+ + Cube.GetCache() *
\+ + Tube.GetCache() #

So, yes, you can use the BIT_CONTROLOBJECT to find the information you want, but it can get a bit complicated depending on the cache structure. Remember there are also DeformCaches.

I hope, it works for you.

On 28/10/2015 at 07:35, xxxxxxxx wrote:

Hi Andreas,

thanks for clarifications, it works for me very well "for generators, I get cache first.."
one related question, how to get the cache of render subdivision

for example like in HyperNurbs, when I GetCache() for it, it returns the editor subdivison BaseObject.

On 28/10/2015 at 07:42, xxxxxxxx wrote:

I guess it can be done by using GetCache(HH) , not sure though how should I fill it? "I guess it is filled by the GetCache.."

On 29/10/2015 at 11:04, xxxxxxxx wrote:

Hi Mohamed,

you can use ExecutePasses() with the BUILDFLAGS_EXTERNALRENDERER flag.
Another option would be to use the Hierarchy class.

On 29/10/2015 at 16:19, xxxxxxxx wrote:

thanks Andreas, you can consider this solved