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
    • Register
    • Login

    MCOMMAND_JOIN issue.

    Scheduled Pinned Locked Moved SDK Help
    2 Posts 0 Posters 323 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 22/12/2005 at 00:58, xxxxxxxx wrote:

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

      ---------
      I have two root Null Objects (sourceNull and targetNull) with children. They are made-editable and triangulated for the collision engine. As a final step, I want to connect each Null Object, individually. Whenever I call SendModelingComamnd(MCOMMAND_JOIN..) with one of the Null Objects, the result contains everything! Even deselecting every object in the document, deselecting all of the polygons, and selecting just the Null Object and its children (and their polygons) has the same result.

      Here's the code:

      Note 1: obj = targetNull or sourceNull
      Note 2: baseDocument is set
      Note 3: mcd.doc = baseDocument has already been set
      Note 4: yes, ModelingCommandData mcd is a class member

        
      // Connect object and children  
      //*---------------------------------------------------------------------------*  
      PolygonObject* DropToTarget::Connect(BaseObject* obj)  
      //*---------------------------------------------------------------------------*  
      {  
           DeselectAll(baseDocument->GetFirstObject());  
           obj->SetBit(BIT_ACTIVE);  
           SelectConnect(obj->GetDown());  
           mcd.op =     obj;  
           mcd.mode =     MODIFY_ALL;  
           if (!SendModelingCommand(MCOMMAND_JOIN, mcd))     return static_cast<PolygonObject*>(ErrorException::NullThrow("Join Failed!"));  
           baseDocument->InsertObject(mcd.result1, NULL, NULL, FALSE);  
           return static_cast<PolygonObject*>(mcd.result1);  
      }  
      // Connect object and children  
      //*---------------------------------------------------------------------------*  
      void DropToTarget::DeselectAll(BaseObject* obj)  
      //*---------------------------------------------------------------------------*  
      {  
           for (obj; obj; obj = obj->GetNext())  
           {  
                mcd.op =     obj;  
                mcd.mode =     MODIFY_POLYGONSELECTION;  
                SendModelingCommand(MCOMMAND_DESELECTALL, mcd);  
                obj->DelBit(BIT_ACTIVE);  
                if (obj->GetDown()) DeselectAll(obj->GetDown());  
           }  
      }  
      // Connect object and children  
      //*---------------------------------------------------------------------------*  
      void DropToTarget::SelectConnect(BaseObject* obj)  
      //*---------------------------------------------------------------------------*  
      {  
           for (obj; obj; obj = obj->GetNext())  
           {  
                obj->SetBit(BIT_ACTIVE);  
                mcd.op =     obj;  
                mcd.mode =     MODIFY_POLYGONSELECTION;  
                SendModelingCommand(MCOMMAND_SELECTALL, mcd);  
                if (obj->GetDown()) SelectConnect(obj->GetDown());  
           }  
      }  
      

      You know, I'm going to personally go to Germany, to Maxon, and thrash you guys. No examples and no means to determine why such things occur. There are (and I just counted them) 70 commands for SendModelingCommand() in the 8.012 SDK and there are precisely three examples (two in the docs and one in the SDK examples). There are several more here in the forum.

      Figure out what's wrong, get back to me quickly, please!

      Thanks,

      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 22/12/2005 at 02:08, xxxxxxxx wrote:

        I see that the solution to this horrid command is hinted at in the archived forum threads - use a fake BaseDocument. That works. Move the object to be connected to the fake document, perform the MCOMMAND_JOIN there, move the object back, and insert the result.

        Why couldn't I think of that ..........

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