DependenceList Issue

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 15/05/2009 at 16:34, xxxxxxxx wrote:

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

---------
hello,

i am using op->AddDependence(hh, child); and op->TouchDependenceList(); to hide the child objects of my object plugin. works fine as long as i dont use my object plugin as a child of another of my object plugins

e.g.
-plugin
--cube

works, the cube is invisible

plugin
-plugin
--cube

the cube is visible

i guess that it is a common mistake of mine which is causing this, any ideas?

thanks and cheers,
ello

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 18/05/2009 at 12:52, xxxxxxxx wrote:

hm, anyone? i still didnt manage to solve this problem

thanks,
ello

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 18/05/2009 at 13:30, xxxxxxxx wrote:

this is how i can hide the childs child;

> `

  
\>       if (child)  
\>       {  
\>            main->AddDependence(hh, child);  
\>            main->TouchDependenceList();  
\>            if (child->GetDown())  
\>            {  
\>                 main->AddDependence(hh, child->GetDown());  
\>                 main->TouchDependenceList();  
\>            }  
\>       }  
\>  

`

but if i cannot endlessly go deeper tis way. there must be another solution

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 19/05/2009 at 03:46, xxxxxxxx wrote:

Look into the SDK and search for GetAndCheckHierarchyClone()

Greetings,
Jack

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 21/05/2009 at 15:19, xxxxxxxx wrote:

ok, after checking the GetAndCheckHierarchyClone... i got the dependencies working for nested pluginobjects properly but always the child of the nested object isnt hided anymore. what do i need to do that none of those child objects is visible (without using SetEditorMode/SetRenderMode )??

thanks for your patience :)

cheers,
ello

code at the beginning regarding the dirty thing:

> `

  
\>       //walk thru childs and set dependence        
\>       BaseObject* tp = NULL;  
\>       Bool dirty=FALSE;  
\>       dirty = op->CheckCache(hh) || op->IsDirty(DIRTY_DATA|DIRTY_CHILDREN);  
\>       if (!dirty)   
\>       {  
\>            op->NewDependenceList();  
\>            for (tp=child;tp;tp=tp->GetNext())   
\>            {  
\>                 op->AddDependence(hh,tp);     
\>            }       
\>       }            
\>       dirty = dirty || !op->CompareDependenceList();  
\>       if (!dirty)  
\>       {          
\>            blDelete(main);   
\>            op->TouchDependenceList();  
\>            return op->GetCache(hh);  
\>       }  
\>  

`

at the end of the generator (right before the return main;) i have this code:
> `

  
\>         
\>       op->NewDependenceList();   
\>       child = op->GetDown();  
\>       for (tp=child;tp;tp=tp->GetNext())   
\>       {  
\>            op->AddDependence(hh,tp);  
\>       }       
\>       op->TouchDependenceList();  
\>       return main;  
\>  

`

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 22/05/2009 at 00:10, xxxxxxxx wrote:

Hm, don't know because I do it totally different in my plugin. I never used TouchDependencyList ;-) Maybe you'll have to iterate the hierarchy and touch all children yourself.

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 22/05/2009 at 02:22, xxxxxxxx wrote:

GetAndCheckHierarchyClone() does use it, so i thought its a good idea.. i'll do some more tests what happens when i remove it, but u thought it belongs there to hide the childs

i'll try the iterating again, maybe i did something wrong last night

thanks for your input

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 22/05/2009 at 09:28, xxxxxxxx wrote:

well, CompareDependenceList needs to be there, otherweise even the first child isnt hidden.

iterating the hierarchy doesnt help, or is this the wrong was to do so?

> `

  
\>            op->NewDependenceList();  
\>            for (tp=child;tp;tp=tp->GetNext())   
\>            {  
\>                 op->AddDependence(hh,tp);               
\>                 BaseObject *tp2 = tp->GetDown();  
\>                 if (tp2)  
\>                 {  
\>                      for (tp2=tp;tp2;tp2=tp2->GetNext())  
\>                      {     
\>                           op->AddDependence(hh,tp2);  
\>                      }        
\>                 }  
\>            }  
\>  

`

dowsnt work if i Touch them by myself, too:
> `

  
\>            BaseObject *tp2 = tp->GetDown();  
\>            if (tp2)  
\>            {  
\>                 for (tp2=tp;tp2;tp2=tp2->GetNext())  
\>                 {     
\>                      tp2->Touch();  
\>                 }        
\>            }  
\>  

`

any help here appreciated.. as its a bit frustrating :)

cheers,
ello

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 26/05/2009 at 02:47, xxxxxxxx wrote:

It looks like your are not going through all of the children objects. Here is some simple working sample code:

> \> void StepThru(BaseObject \*op, BaseObject \*child, HierarchyHelp \*hh, LONG &childcnt;) \> { \>      while (child && !child->GetBit(BIT_CONTROLOBJECT)) \>      { \>           op->AddDependence(hh, child); \> \>           StepThru(op, child->GetDown(), hh, childcnt); \> \>           child = child->GetNext(); \> \>           childcnt++; \>      } \> } \> \> // create morphed object \> BaseObject \*MorphMixerObject::GetVirtualObjects(PluginObject \*op, HierarchyHelp \*hh) \> { \>      BaseObject \*pp = NULL, \*child = NULL; \>      child = op->GetDown(); \>      if (!child) return NULL; \> \>      // start new list \>      op->NewDependenceList(); \> \>      // check cache for validity and check master object for changes \>      Bool dirty = op->CheckCache(hh) || op->IsDirty(DIRTY_DATA); \> \>      LONG childcnt = 0; \> \>      //step thru all children \>      StepThru(op, child, hh, childcnt); \> \>      // if child list has been modified somehow \>      if (!dirty) dirty = !op->CompareDependenceList(); \> \>      // mark child objects as processed \>      op->TouchDependenceList(); \> \>      // if no change has been detected, return original cache \>      if (!dirty) return op->GetCache(hh); \> \>      GePrint(LongToString(childcnt)); \> \>      return BaseObject::Alloc(Onull); //return your generated object \> } \>

cheers,
Matthias

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 26/05/2009 at 04:10, xxxxxxxx wrote:

Yes, some good old recursing action! To understand recursions, you first have to understand recursions. But once that's done, they're fun :)

Cheers,
Jack

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 26/05/2009 at 12:33, xxxxxxxx wrote:

wow, thank you so much Matthias, after some changes it works so cool! and it helps to understand the principle much better because it is so clean.

cheers,
Ello