Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware 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

    AddJoint fails

    SDK Help
    0
    19
    1.4k
    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
      Helper
      last edited by

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

      On 29/10/2010 at 00:43, xxxxxxxx wrote:

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

      ---------
      I'm using the Melange library to write a C4D file with joints, however the AddJoint() function fails every time.
      It always return -1.
      All pointers are valid.  All joints have already been added to the document.  And I made sure I was inserting the tag first
      before calling AddJoint(), but it still fails.  Any suggestions?

        
       BaseTag *tag = BaseTag::Alloc(Tweights);  
       WeightTagData *wt = (WeightTagData * )tag->GetNodeData();
       pPoly->InsertTag(tag);
       for(i=0; i < num_joints; i++) {  
          joint_index = wt->AddJoint( joints[i].ob ); // returns -1 ??  
       }  
      

      btw, if you're wondering, I'm doing the exact same thing in C++ SDK, and it works there.
      But with Melange, it fails.

      1 Reply Last reply Reply Quote 0
      • H
        Helper
        last edited by

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

        On 29/10/2010 at 15:27, xxxxxxxx wrote:

        This is what I use to allocate and insert joints:

          
         BaseObject *pBone = BaseObject::Alloc(Ojoint);
         joints[i].ob = pBone; // save for AddJoint later
         doc->InsertObject( pBone, pParent, pLast );  
        

        The objects sent to AddJoint are of type "Ojoint".  All pointers are valid.
        I still don't know why I'm getting -1? 
        Is the jointlist dynamically resized whenever a new joint binding is added? 
        I don't have to create the jointlist myself before adding a joint?
        This must be some kind of bug. 
        Can someone post the source code conditions where AddJoint returns -1?
        This is very frustrating.

        1 Reply Last reply Reply Quote 0
        • H
          Helper
          last edited by

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

          On 29/10/2010 at 17:39, xxxxxxxx wrote:

          Ok, I imported a good file with joints created by Cinema4D into Melange, and I got a good joint listing.
          Just to test it out, I called RemoveJoint(), but I don't think it got removed.  I immediately called
          GetJointCount() afterwards, and the joint count did not change.
          And I tried re-adding it again, but it just returned the same index as the original, as if the joint
          was never removed.

            
          for (i=0; i < joint_count; i++) {
             BaseObject *joint_ob = wt->GetJoint( i, doc );
             printf("GetJointCount before: %d\n", wt->GetJointCount() );  // same count  
             wt->RemoveJoint(joint_ob);       // not removed!  
             printf("GetJointCount after: %d\n", wt->GetJointCount() );  // same count
             LONG joint_index = wt->AddJoint( joint_ob );  
             printf("joint_index: %d\n", joint_index );    // same index as original joint  
          }  
          

          I definitely think there's something wrong here if I can't remove joints from the list.

          1 Reply Last reply Reply Quote 0
          • H
            Helper
            last edited by

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

            On 22/11/2010 at 14:17, xxxxxxxx wrote:

            hi,

            this seems to be an issue with the current melange version. please wait for the a new version coming this week. sorry for the inconvenience.

            jens

            1 Reply Last reply Reply Quote 0
            • H
              Helper
              last edited by

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

              On 22/11/2010 at 15:02, xxxxxxxx wrote:

              Thanks, I've compiled a list of R12 Melange bugs that I've encountered so far.  Some have no solution:
              1. AddJoint() always return -1.  No workaround.
              2. RemoveJoint() never removes a joint, even for a good joint listing.  No workaround.
              3. JointRestState matrices are ignored (or not calculated) when loading Melange-written files into Cinema4D.  No workaround.
              4. GetMg() returns an incorrect matrix.  Workaround: must use GetMl() to build world matrix yourself.

              1 Reply Last reply Reply Quote 0
              • H
                Helper
                last edited by

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

                On 25/11/2010 at 08:30, xxxxxxxx wrote:

                hi,

                thanks for the list. all these issues should be gone with the new version which is available now. you can find it here.

                please let me know if it works for you.

                jens

                1 Reply Last reply Reply Quote 0
                • H
                  Helper
                  last edited by

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

                  On 25/11/2010 at 21:59, xxxxxxxx wrote:

                  Thanks!  I tried it out, and my joints are getting added now.
                  One last question, when I import a C4D file created by Melange (with joints) into Cinema4D, the mesh is still distorted.
                  And I've called CalculateBoneStates() on the all joints to make sure they have valid matrices.
                  I've printed out all matrices in JointRestState, and they all look good.
                  In the C++ SDK, I call EventAdd() whenever an object needs updating, but Melange has no such function.
                  Is there a final function to call to make sure my Melange document (internal flags and data) is up-to-date?
                  Because, for some reason, Cinema4D is still ignoring my JointRestState matrices.

                  1 Reply Last reply Reply Quote 0
                  • H
                    Helper
                    last edited by

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

                    On 13/12/2010 at 02:17, xxxxxxxx wrote:

                    hi rootbender,

                    sorry for the delay. did you succeed in the meantime?
                    there're 4 functions to call, SetGeomMg(), AddJoint(), SetJointResState() and then CalculateBoneStates() (pass NOTOK to calculate it for all joints).

                    did you try this within the cinema sdk and was it working there?

                    could you send me the testscene you have written with melange and cinema has problems with?

                    cheers
                    jens

                    1 Reply Last reply Reply Quote 0
                    • H
                      Helper
                      last edited by

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

                      On 14/12/2010 at 12:52, xxxxxxxx wrote:

                      Hi,
                      I tried calling CalculateBoneStates with NOTOK, but it has no effect.
                       
                      The mesh is still distorted on imported.  Cinema4D behaves as if it's using the Identity matrix for
                      all bind matrices.  But, I checked, they are not identity.

                      1 Reply Last reply Reply Quote 0
                      • H
                        Helper
                        last edited by

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

                        On 15/12/2010 at 01:59, xxxxxxxx wrote:

                        hi!

                        could you try your code with the cinema sdk please? this would be very helpful to figure out if this a melange problem only or a generaly issue with the sdk.

                        i think i can have a look and try by myself tomorrow to create a setup like yours with melange.

                        cheers
                        jens

                        1 Reply Last reply Reply Quote 0
                        • H
                          Helper
                          last edited by

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

                          On 15/12/2010 at 20:18, xxxxxxxx wrote:

                          Yes, I also have the same problem with the C++ SDK.  The mesh distortion looks exactly the same as Melange.
                           
                          In fact, the distortion is very consistent.  It doesn't change at all.  It doesn't matter what values
                          I plug into the bind matrices, it always comes up looking the same shape.

                          1 Reply Last reply Reply Quote 0
                          • H
                            Helper
                            last edited by

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

                            On 16/12/2010 at 04:02, xxxxxxxx wrote:

                            hi,

                            thanks for checking this. could you provide us a complete code snipped please? the polygon object we could load but we have to know how do you setup the joint, skin object and the weight tag. i think this would be the fastest way to help you. you can send the code to my email (we'll keep it confidential if you want).

                            best
                            jens

                            1 Reply Last reply Reply Quote 0
                            • H
                              Helper
                              last edited by

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

                              On 06/01/2011 at 11:09, xxxxxxxx wrote:

                              Originally posted by xxxxxxxx

                              hi,

                              thanks for checking this. could you provide us a complete code snipped please? the polygon object we could load but we have to know how do you setup the joint, skin object and the weight tag. i think this would be the fastest way to help you. you can send the code to my email (we'll keep it confidential if you want).

                              best
                              jens

                              Source code was sent, so I hope you got a chance to look at it.
                              Do you know if this is something that I can fix myself, or is it a C4D problem?

                              1 Reply Last reply Reply Quote 0
                              • H
                                Helper
                                last edited by

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

                                On 07/01/2011 at 19:10, xxxxxxxx wrote:

                                Originally posted by xxxxxxxx

                                hi,

                                thanks for checking this. could you provide us a complete code snipped please? the polygon object we could load but we have to know how do you setup the joint, skin object and the weight tag. i think this would be the fastest way to help you. you can send the code to my email (we'll keep it confidential if you want).

                                best
                                jens

                                Hi,
                                I just discovered I was incorrect about the C++ SDK.  It does work there.  I created a working example
                                from static data and it worked.
                                It only fails when reading files created by Melange.
                                In your test code, I modified it so it loads melange files.  The mesh comes in distorted.

                                  
                                Bool SubDialogTest::Execute(BaseDocument *doc)  
                                {  
                                 BaseDocument *tmpDoc = LoadDocument(Filename("example_from_melange.c4d"),SCENEFILTER_OBJECTS,NULL);  
                                 if (!tmpDoc) {  
                                    return FALSE;  
                                 }
                                 InsertBaseDocument(tmpDoc);  
                                 tmpDoc=NULL;  // c4d takes control
                                 EventAdd();
                                 return TRUE;  
                                }  
                                

                                For some reason, the bind pose matices are being ignored.

                                1 Reply Last reply Reply Quote 0
                                • H
                                  Helper
                                  last edited by

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

                                  On 10/01/2011 at 00:10, xxxxxxxx wrote:

                                  hi,

                                  thanks for clarifying this. so it seems to be an issue in melange.
                                  could you send me this static data example please? i've to debug these functions in melange.

                                  best
                                  jens

                                  1 Reply Last reply Reply Quote 0
                                  • H
                                    Helper
                                    last edited by

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

                                    On 13/01/2011 at 04:48, xxxxxxxx wrote:

                                    hi,

                                    thanks for the code example. i've had a look and it works in melange. i've sent you necessary changes i did to your code per email. please have a look and let me know if it works and what changes you had to make.

                                    cheers
                                    jens

                                    1 Reply Last reply Reply Quote 0
                                    • H
                                      Helper
                                      last edited by

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

                                      On 13/01/2011 at 16:44, xxxxxxxx wrote:

                                      Thanks, I tried your code, but I still get the same distorted mesh.  I compared my scene_OUT.c4d file with yours,
                                      and they don't match.
                                      I sent you my scene_OUT.c4d file and the code used.
                                      btw, your scene_OUT.c4d works great, but I can't explain why mine is different.
                                      My commandline project is compiled in Release mode under Intel/PC platform (Windows XP), if that matters.

                                      1 Reply Last reply Reply Quote 0
                                      • H
                                        Helper
                                        last edited by

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

                                        On 14/01/2011 at 13:46, xxxxxxxx wrote:

                                        Great!  It's working now with latest changes.
                                        Thanks for all the help!

                                        1 Reply Last reply Reply Quote 0
                                        • H
                                          Helper
                                          last edited by

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

                                          On 20/01/2011 at 02:05, xxxxxxxx wrote:

                                          hi,

                                          the new melange 4.0 version is available now.
                                          can be downloaded from here.

                                          cheers
                                          jens

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