MCOMMAND_JOIN issue.



  • 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,



  • 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 ..........


Log in to reply