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
    • Recent
    • Tags
    • Users
    • Login

    difference between BaseObjects???

    Scheduled Pinned Locked Moved SDK Help
    15 Posts 0 Posters 1.1k 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 15/03/2010 at 15:06, xxxxxxxx wrote:

      also,  be sure to check all of your pointers..   for example,   if you have.....

      BaseObject * op = BaseObject::Alloc(Osphere);

      make sure you have

      if (!op) return False;   or something like it.   🙂

      ~Shawn

      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 16/03/2010 at 00:40, xxxxxxxx wrote:

        ye, i'll try the thing with GePrint.. used it before. Sometimes i just dont see the wood because of the trees 🙂

        pointers are all checked. the strange thing is that it just happens when rendering. the object itself works and i can convert (using c) and this works too... only rendering crashes...

        cheers,
        ello

        btw, how can i know in an object plugin if the render has been called??

        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 16/03/2010 at 00:53, xxxxxxxx wrote:

          Originally posted by xxxxxxxx

          btw, how can i know in an object plugin if the render has been called??

          In GetVirtualObjects() check the HierarchyHelp's GetVFlags() method.

          cheers,
          Matthias

          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 16/03/2010 at 02:12, xxxxxxxx wrote:

            ok, i managed to find what is causing the crash now..
            Here is the relevant code:

              
            PolygonObject*  baseMesh = static_cast<PolygonObject*>(bc->GetLink(BASEMESH,doc));  
            if (!baseMesh) goto Error;  
            ...  
            op->NewDependenceList();  
            op->AddDependence(hh,baseMesh); // <--- this is causing the crash  
            
            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 16/03/2010 at 02:35, xxxxxxxx wrote:

              can someone point me on how exactly i can check if GetVFlags() contains VFLAG_INTERNALRENDERER or VFLAG_EXTERNALRENDERER ?? it returns 18(if rendered in editor) and 20 (if rendered in the image manager) but if i try this:

              if((hh->GetVFlags()!=18)&&(hh->GetVFlags()!=20))op->AddDependence(hh,baseMesh);  
              

              it still crashes...
              if i comment that line out, it doesnt crash anymore, but i need that line for performance reasons

              thanks and cheers,
              ello

              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 16/03/2010 at 03:03, xxxxxxxx wrote:

                GetVFlags() returns a bit mask. You have to mask the bits you want to check (single & and single | operator).

                  
                if (GetVFlags() & VFLAG_INTERNALRENDERER)  
                {  
                 //editor rendering  
                }  
                  
                else if (GetVFlags() & VFLAG_EXTERNALRENDERER)  
                {  
                 //external rendering  
                }  
                

                cheers,
                Matthias

                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 16/03/2010 at 03:07, xxxxxxxx wrote:

                  thank you! than it must be something other.. if i use the following line and render in the editor, it crashes:

                  if (!(hh->GetVFlags() & VFLAG_INTERNALRENDERER))op->AddDependence(hh,baseMesh);
                  

                  if i comment the whole thing out, it renders with no problem.

                  any ideas what could cause this strange behaviout? why does commenting works, but disabling when rendering doesnt??

                  cheers,
                  Ello

                  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 16/03/2010 at 03:38, xxxxxxxx wrote:

                    and to make it even more strange, rendering in into the image manager works, but rendering in the editor doesnt work:

                    Bool editing = TRUE;  
                    if (hh->GetVFlags() & VFLAG_INTERNALRENDERER) editing = FALSE;  
                    if (hh->GetVFlags() & VFLAG_EXTERNALRENDERER) editing = FALSE;  
                    if (editing) op->AddDependence(hh,baseMesh);  
                    else GePrint("rendering...");  
                    

                    any ideas?

                    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 16/03/2010 at 03:56, xxxxxxxx wrote:

                      Can you post a simplified version of your GetVirtualObjects() method that shows the problem?

                      cheers,
                      Matthias

                      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 16/03/2010 at 04:27, xxxxxxxx wrote:

                        ok, here it is.. hope it makes sense.

                          
                        BaseObject *cloneOnMesh::GetVirtualObjects(PluginObject *op, HierarchyHelp *hh)  
                          {           
                          editing = TRUE;  
                          if (hh->GetVFlags() & VFLAG_INTERNALRENDERER)   
                              {  
                              //GePrint ("rendering in editor");  
                              editing = FALSE;  
                              }  
                          if (hh->GetVFlags() & VFLAG_EXTERNALRENDERER)   
                              {  
                              //GePrint ("rendering in manager");  
                              editing = FALSE;  
                              }   
                          Bool facing = FALSE;  
                          BaseObject* child = NULL;  
                          Bool autoCalculate = FALSE;  
                          BaseObject* cloneOfBase = NULL;  
                          BaseObject* baseMesh = NULL;  
                          const Vector* padr;  
                          const CPolygon* pol;  
                          LONG numberofclones;  
                          LONG maxcount;  
                          BaseDocument* doc = op->GetDocument();  
                          BaseContainer *bc=op->GetDataInstance();  
                          BaseObject* targetHelper = NULL;  
                          Bool dirty;  
                          BaseObject *main = BaseObject::Alloc(Onull);  
                          main->SetName(pluginName);        
                          if (!main) goto Error;  
                          
                          //object which should be faced by clones  
                          targetHelper = static_cast<PolygonObject*>(bc->GetLink(FACING,doc));  
                          if (targetHelper) facing = TRUE;  
                          //find object to be cloned  
                          child = op->GetDown();   
                          if(!child) goto Error;  
                          //objects to place clones along  
                          baseMesh = static_cast<PolygonObject*>(bc->GetLink(BASEMESH,doc));  
                          if (!baseMesh) goto Error;  
                          
                          if (editing)  
                              {  
                              // start new list  
                              op->NewDependenceList();  
                              op->AddDependence(hh, child);  
                              op->AddDependence(hh,baseMesh);  
                              if (facing) op->AddDependence(hh, targetHelper);  
                          
                              dirty = op->CheckCache(hh) || op->IsDirty((autoCalculate*DIRTY_MATRIX)|DIRTY_DATA|DIRTY_CHILDREN);  
                              dirty = dirty || !op->CompareDependenceList();  
                              //return cache  
                              if (!dirty)   
                                  {  
                                  blDelete(main);                    
                                  op->TouchDependenceList();  
                                  return op->GetCache(hh);  
                                  }  
                              }  
                          cloneOfBase = op->GetAndCheckHierarchyClone(hh,baseMesh,HCLONE_ASPOLY,&dirty,NULL,FALSE);  
                          if (!cloneOfBase) goto Error;  
                          
                          padr = ToPoint(cloneOfBase)->GetPointR();  
                          pol = ToPoly(cloneOfBase)->GetPolygonR();  
                          numberofclones = maxcount = ToPoly(cloneOfBase)->GetPolygonCount();  
                          maxcount = ToPoly(cloneOfBase)->GetPolygonCount();  
                          
                          for (int i=0;i<numberofclones;i++)  
                              {  
                              // ... create clones and modify them  
                              }   
                          if (cloneOfBase) blDelete(cloneOfBase);  
                          
                          if (editing)  
                              {  
                              //if i dont do the following things the caching doesnt work  
                              //actually i dont understand why i need to do this again  
                              op->NewDependenceList();  
                              op->AddDependence(hh, child);  
                              op->AddDependence(hh,baseMesh);  
                              if (facing) op->AddDependence(hh, targetHelper);  
                              op->TouchDependenceList();       
                              }  
                          
                          return main;  
                          
                        Error:  
                          blDelete(main);  
                          return NULL;  
                          }  
                        

                        cheers,
                        ello

                        edit: i updated the code and with using the GetVFlags, it works now, so i guess it must be something other in my code where i am creating the clones (i'll double check the whole stuff again)...  nevertheless if there is something generally wrong with how i use the dependeceList, it'd be great if someone can point me to it.

                        cheers,
                        ello

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