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

    Generator object not updating

    Scheduled Pinned Locked Moved SDK Help
    3 Posts 0 Posters 255 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 11/11/2012 at 02:50, xxxxxxxx wrote:

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

      ---------
      Hi all,
      I have written a generator object that implements GetVirtualObjects() to generate a new polygonobject based on the children of the generator. Everything works fine, except one problem:

      When I load a saved scene with my generator in it, the generator is not updated until I select the child of my generator in edge mode.

      Does anyone have any suggestions on how to resolve this? Here is my code, with some parts removed:

        
      BaseObject* SC_Modifier::GetVirtualObjects(BaseObject* op, HierarchyHelp* hh){   
           op->NewDependenceList();   
           BaseObject* child=op->GetDown();   
           if(!child ){   
                return PolygonObject::Alloc(0,0);   
           }   
        
           ModelingCommandData cd;   
           cd.doc = op->GetDocument();   
           cd.op = child;   
           if (!SendModelingCommand(MCOMMAND_CURRENTSTATETOOBJECT, cd)) return FALSE;   
        
           BaseObject* tmp=(BaseObject* )(cd.result->GetIndex(0));   
           if(!tmp->IsInstanceOf(Opolygon)){   
                return PolygonObject::Alloc(0,0);   
           }   
        
           PolygonObject* mesh = (PolygonObject* ) tmp;   
           op->AddDependence(hh, child);   
           op->TouchDependenceList();   
        
           AutoAlloc<Modeling> mod;   
           mod->InitObject(mesh);   
           //Do some modifications to "mesh" here   
           mod->Commit();   
        
           mesh->Message(MSG_UPDATE);   
           return mesh;   
      }   
      

      Thanks
      /Filip

      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 11/11/2012 at 06:50, xxxxxxxx wrote:

        You should be doing CURRENTSTATETOOBJECT in a dummy document (do a search here about this).

        Otherwise, not sure.  You might want to check all of your returns to see if any are being hit before the last one when you load the saved document.

        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 12/11/2012 at 00:33, xxxxxxxx wrote:

          Thanks for your input! I tried your suggestions but the problem remains. I'll keep bughunting and post here again if I find a solution.

          /Filip

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