Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Unread
    • Recent
    • Tags
    • Users
    • Login

    GetVirtualObjects Help

    Scheduled Pinned Locked Moved SDK Help
    3 Posts 0 Posters 301 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • H Offline
      Helper
      last edited by

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

      On 07/12/2004 at 14:34, xxxxxxxx wrote:

      User Information:
      Cinema 4D Version:   8.200 
      Platform:      Mac OSX  ; 
      Language(s) :   C.O.F.F.E.E  ;  C++  ;

      ---------
      Hi,

      In trying to learn the ropes of CPP object plugin development and I realize that I don't understand how to display the child objects of the plugin in GetVirtualObjects.

      For now, as a simplification of what I am really trying to do, I am essentially trying to create an object plugin that would behave as a Null Object.

      From the atom.cpp I am creating instances of the children and attaching them to the plugin object, which works, but when I just try to attach the child itself to the returnObject I get a crash. As I step through the children, how do I attach them to the returnObject in GetVirtualObjects? Or, in the code below, what do I add between the comments with question marks?

        
      BaseObject *MyNullObject::GetVirtualObjects(PluginObject *pluginObject, HierarchyHelp *hh)  
      {  
        
        
           BaseObject*          returnObject = NULL;  
           BaseObject*      orig;  
           BaseObject*          res;  
           BaseObject           *obi        = NULL;       
           Bool                dirty;  
           BaseContainer*     data = pluginObject->GetDataInstance();  
        
        
           // request polygonized input  
           hh->AddVFlags(VFLAG_POLYGONAL);   
        
           orig = pluginObject->GetDown();  
           if (!orig) return NULL;   
             
           dirty = FALSE;  
           res = pluginObject->GetAndCheckHierarchyClone(hh,orig,HCLONE_ASPOLY,&dirty;,NULL,TRUE);   
        
           if (!dirty) {  
                return res;  
           }  
           if (!res) {  
                return NULL;  
           }   
        
        
        
           returnObject = BaseObject::Alloc(Onull);;  
             
           // STEP TRHOUGH EACH CHILD OF THE PLUGIN ONBJECT  
           while (orig) {  
                  
                BaseContainer *origdata = orig->GetDataInstance();  
                  
                  
                // ??? WHAT SHOULD I DO HERE TO JUST DISPLAY/RETURN THE CHILDREN INSTEAD OF INSTANCING THEM?  
                obi = BaseObject::Alloc(Oinstance);  
                AutoAlloc<BaseLink> link;  
                if (link) {  
                     link->SetLink(orig);  
                     obi->SetParameter(DescLevel(INSTANCEOBJECT_LINK), GeData(link), 0);                 
                }  
                // ????  
                  
                  
                obi->InsertUnderLast(returnObject);  
        
                orig = orig->GetNext();  
             
           }  
        
           if (!returnObject) goto Error;  
           returnObject->SetName(pluginObject->GetName());  
        
        
           return returnObject;  
        
      Error:  
           blDelete(returnObject);  
           return NULL;  
      }  
      
      1 Reply Last reply Reply Quote 0
      • H Offline
        Helper
        last edited by

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

        On 08/12/2004 at 01:00, xxxxxxxx wrote:

        You can't return the children themselves. That will cause a crash. You need to create clones of the children, just like the examples do.

        1 Reply Last reply Reply Quote 0
        • H Offline
          Helper
          last edited by

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

          On 08/12/2004 at 05:15, xxxxxxxx wrote:

          Thanks Mikael - that worked like a charm. I have one more related question: Based on the Atom example, I was not only using instances but also GetAndCheckHeirarchyClone to test if the object was dirty. But in MophMixer, they use CheckCache. When would one use one over the other?

          1 Reply Last reply Reply Quote 0
          • First post
            Last post