Reset Bind Pose



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

    On 30/09/2010 at 16:36, xxxxxxxx wrote:

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

    ---------
    In Cinema 4D, there's a button called "Reset Bind Pose" in the weight tag properties dialog.
    Can this command be called through the C++ SDK?  If so, how?
    If not, then how can I re-create what it does in SDK code?



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

    On 01/10/2010 at 01:30, xxxxxxxx wrote:

    You can do this by sending a MSG_DESCRIPTION_COMMAND to the button.

    here how it goes:

      
    DescriptionCommand dc;  
      
    //fill with the ID of the button; include _tcaweight.h_  
    dc.id = DescID(DescLevel(ID_CA_WEIGHT_TAG_RESET));  
      
    //send the message to the weight tag  
    tag->Message(MSG_DESCRIPTION_COMMAND, &dc);  
    

    cheers,
    Matthias



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

    On 01/10/2010 at 08:19, xxxxxxxx wrote:

    Thanks, I found the definition.
    I tried doing this in C++ SDK, but my scene doesn't change.

      
    #define ID_CA_WEIGHT_TAG_RESET 2001
    CAWeightTag* wt = (CAWeightTag* ) (ob->GetTag(Tweights));
    DescriptionCommand dc;  
    dc.id = DescID(DescLevel(ID_CA_WEIGHT_TAG_RESET));  
    wt->Message(MSG_DESCRIPTION_COMMAND, &dc);
    DrawViews(DRAWFLAGS_FORCEFULLREDRAW);  
    

    Do I have to call something else to see the results of my sent message?



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

    On 01/10/2010 at 10:35, xxxxxxxx wrote:

    When I click on the "Reset Bind Pose" button by hand, I can see changes being made.
    My character snaps back to its bind pose.  But, when I call it from my plugin, nothing happens.
    Here's what I tried so far, somewhat bit of desperate overkill:

      
     CAWeightTag* wt = (CAWeightTag* ) (ob->GetTag(Tweights));
     DescriptionCommand dc;  
     dc.id = DescID(DescLevel(ID_CA_WEIGHT_TAG_RESET)); // button ID  
     wt->Message( MSG_DESCRIPTION_COMMAND, &dc );  // send message to button  
     ob->Message( MSG_DESCRIPTION_COMMAND, &dc );  
     doc->Message( MSG_DESCRIPTION_COMMAND, &dc );
     wt->Message(MSG_POLYGONS_CHANGED);  
     wt->Message(MSG_UPDATE_NGONS);  
     wt->Message(MSG_CHANGE);  
     wt->Message(MSG_UPDATE);
     ob->Message(MSG_POLYGONS_CHANGED);  
     ob->Message(MSG_UPDATE_NGONS);  
     ob->Message(MSG_CHANGE);  
     ob->Message(MSG_UPDATE);
     doc->Message(MSG_POLYGONS_CHANGED);  
     doc->Message(MSG_UPDATE_NGONS);  
     doc->Message(MSG_CHANGE);  
     doc->Message(MSG_UPDATE);
     EventAdd(EVENT_FORCEREDRAW);  
     DrawViews(DRAWFLAGS_FORCEFULLREDRAW);
     // nothing! ![Dead](http://www.plugincafe.com/forum/smileys/smiley11.gif)  
    


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

    On 04/10/2010 at 06:40, xxxxxxxx wrote:

    Hm, it's working fine here.

    Here my test code:

      
    BaseObject *op = doc->GetActiveObject();  
    if (!op) return FALSE;  
      
    BaseTag *tag = op->GetTag(Tweights);  
    if (!tag) return FALSE;  
      
    DescriptionCommand dc;  
    dc.id = DescID(DescLevel(ID_CA_WEIGHT_TAG_RESET));  
    tag->Message(MSG_DESCRIPTION_COMMAND, &dc);  
      
    EventAdd();  
    

    cheers,
    Matthias



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

    On 04/10/2010 at 09:01, xxxxxxxx wrote:

    Thanks, I commented out everything except EventAdd(), and it started working.  Awesome. Smile
    When I added this line, my scene didn't change:
    DrawViews(DRAWFLAGS_FORCEFULLREDRAW);
    Calling DrawViews() seems to erase my bind pose, and force it into an animated pose again.
    I was just wondering, if I were call EventAdd() and then DrawViews(), is there some way to refresh
    the viewport so I can see the results of EventAdd() before calling DrawViews() ?  Without forcing
    the scene into an animated pose?



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

    On 04/10/2010 at 09:34, xxxxxxxx wrote:

    Here's my problem.  When I export a scene, the mesh's vertices are in a bind pose.  However, the document objects are in an animated pose.
    I was thinking I could just use the ResetBindPose button, but that might be problematic.
    Using the C++ SDK, how can I transform my mesh's bind pose vertices into an animated pose?
    Is there a SDK function that can help me do this?



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

    On 05/10/2010 at 05:55, xxxxxxxx wrote:

    I am not sure if I can follow you here. If you just want to get the current state of the mesh you have to use SendModelingCommand() with MCOMMAND_CURRENTSTATETOOBJECT. There is an example in the SDK docs.

    cheers,
    Matthias



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

    On 05/10/2010 at 11:17, xxxxxxxx wrote:

    Thanks, I tried it, but when I send it a polygon object, I'm getting back a "Onull" object with zero vertices/polys.

      
        if(ob->GetType() == Opolygon) {  
           BaseContainer bc;  
           ModelingCommandData dat;  
           dat.doc  = ob->GetDocument();  
           dat.op   = ob;  
           dat.bc   = &bc;  
           dat.mode = MODELINGCOMMANDMODE_ALL;
           // this doesn't help  
           //bc.SetData( MDATA_CURRENTSTATETOOBJECT_INHERITANCE, TRUE );  
           //bc.SetData( MDATA_CURRENTSTATETOOBJECT_KEEPANIMATION, TRUE );
           BOOL br = SendModelingCommand( MCOMMAND_CURRENTSTATETOOBJECT, dat );  
           BaseObject* res = static_cast<BaseObject*>(dat.result->GetIndex(0));  
           if(br && res) {  
              // "Onull" !  
           }  
           AtomArray::Free(dat.result);  
        }  
    

    Does this look correct?



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

    On 06/10/2010 at 20:32, xxxxxxxx wrote:

    Ok, I fixed the "Onull" problem.  But I hit a dead end again.  The joint list for the converted polygon returns NULL joint objects.
    Looks like I went full circle back to the joint bug again! 
    All I really need is the mesh and the object hierarchy to be in the same frame of reference.
    And the most desirable frame of reference is the bindpose.  And everything else, such as
    joints, weights, and animation, must stay intact.



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

    On 07/10/2010 at 02:11, xxxxxxxx wrote:

    I am sorry but I can't really follow you. Please tell me what you are trying to achieve? It seems you are writing some sort of exporter, what do you exactly want to export?

    cheers,
    Matthias



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

    On 07/10/2010 at 11:09, xxxxxxxx wrote:

    I'm exporting an animated character model with joints, using my own plugin.  And the reason
    why I'm having so many problems, is that the CAWeightTag joint-list goes missing (joint objects
    return NULL) when converting the mesh with MCOMMAND_CURRENTSTATETOOBJECT.
     I've noticed that Polygonize() also calls MCOMMAND_CURRENTSTATETOOBJECT, so I see now where the problem lies.
    I tried cloning it first, but no luck there.  And I always make sure I'm passing the original document, but still no luck.


Log in to reply