ObjectPlugin child draw



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

    On 17/12/2010 at 02:38, xxxxxxxx wrote:

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

    ---------
    Hi all !

    I'm working on a little object plugin, the issue is that whatever object I put as a child of it, the child isn't visible anymore.

    I taught it was a redraw problem, but none of the messages, events, or drawview commands helped me.

    IMO it may come from the hierarchy that has to be updated... But how  ?

    If you have any idea ...

    Thanks

    Mike



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

    On 17/12/2010 at 03:32, xxxxxxxx wrote:

    Not visible in the Editor or in general ?
    What function did you use to insert the object ?



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

    On 17/12/2010 at 04:11, xxxxxxxx wrote:

    Not visible in the viewport only.

    I simply drag and drop an object (a cube as example) as a child of my plugin object. I can see the bounding box in the viewport and I can transform it but the object itself is not visible.

    Mike



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

    On 18/12/2010 at 18:54, xxxxxxxx wrote:

    What are you doing in GetVirtualObject()?



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

    On 18/12/2010 at 19:58, xxxxxxxx wrote:

    My thoughts exactly.  If there are no children, pass nothing back (or whatever is default).  If there are and nothing is being changed, pass the hierarchy as is (typically the result of GetAndCheckHierarchyClone() for instance).



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

    On 19/12/2010 at 02:52, xxxxxxxx wrote:

    Hi both !

    Thanks for helping.

    c4dJack :

    Here is my GetVirtualObject() dirty check for now.

    BaseObject    *cd=NULL,*orig=op->GetDown();

    op->NewDependenceList();

    Bool dirty = op->CheckCache(hh) || op->IsDirty(DIRTY_DATA)||op->IsDirty(DIRTY_CACHE);

    for (cd=orig; cd; cd=cd->GetNext())
          {
          op->AddDependence(hh,cd);
          }
    if (!dirty) dirty = !op->CompareDependenceList();

    op->TouchDependenceList();

    if (!dirty) return op->GetCache(hh);

    if (dirty)
     
      {
      Main code
      }

    kuroyume

    ok it seems like it is what i need but I can't get it work. Do you mean :

    If there are no children, pass nothing back (or whatever is default) :

    if (!op->GetDown()) {default code};

    If there are and nothing is being changed, pass the hierarchy as is (typically the result of GetAndCheckHierarchyClone() for instance).

    if (op->GetDown())
     {
     op->NewDependenceList();

    Bool dirty = op->CheckCache(hh) || op->IsDirty(DIRTY_DATA)||op->IsDirty(DIRTY_CACHE);

    for (cd=orig; cd; cd=cd->GetNext())
          {
          op->AddDependence(hh,cd);
          }

    if (!dirty) dirty = !op->CompareDependenceList();

    op->TouchDependenceList();

    if (!dirty) return op->GetAndCheckHierarchyClone();

    ?

    Thanks
    Mike



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

    On 19/12/2010 at 12:30, xxxxxxxx wrote:

    The way you are doing it (using a dependence list), the Triangulate example in the cinema4dsdk plugins should be the best to follow:

    BaseObject *TriangulateData::GetVirtualObjects(BaseObject *op, HierarchyHelp *hh)  
    {  
      if (!op->GetDown()) return NULL;  // No children to work on, return nothing  
      
      LineObject        *contour=NULL;      
      PolygonObject *pp=NULL;  
      Bool                    dirty=FALSE;  
      Matrix                ml;  
      
      op->NewDependenceList();  
      contour=PrepareSingleSpline(op,op->GetDown(),&ml,hh,&dirty);  
      if (!dirty) dirty = op->CheckCache(hh);                      
      if (!dirty) dirty = op->IsDirty(DIRTYFLAGS_DATA);          
      if (!dirty) dirty = !op->CompareDependenceList();  
      if (!dirty) return op->GetCache(hh); // No changes, return the cache (GetAndCheckHierarchyClone() is the simpler route when not using dependence lists)  
      
      if (!contour) return NULL;  
      
      pp = contour->Triangulate(0.0,hh->GetThread());  
      
      if (!pp) return NULL;  
      
      pp->SetPhong(TRUE,FALSE,0.0);  
      Transform(pp,ml);  
      pp->SetName(op->GetName());  
        
      if (hh->GetBuildFlags()&BUILDFLAGS_ISOPARM)  
      {  
          pp->SetIsoparm((LineObject* )contour->GetClone(COPYFLAGS_NO_HIERARCHY,NULL));  
          Transform(pp->GetIsoparm(),ml);  
      }  
      
      return pp;  
    }  
    


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

    On 22/12/2010 at 06:58, xxxxxxxx wrote:

    Thanks a lot ! I think I understand how dirty works much better now.

    Mike


Log in to reply