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

    Importing morph problem

    Cinema 4D SDK
    r21
    3
    12
    1.6k
    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.
    • A
      AiMiDi
      last edited by

      Hi,@m_magalhaes Thank you very much for your reply.

      The model_points is "ToPoly(model)->GetPointW()".
      I really want to import MMD data.
      But it's not an animation data, it's a model data.
      The detailed code can be viewed here.
      The MMD pmx file file structure document can be viewed here.

      Thank,
      AiMiDi

      1 Reply Last reply Reply Quote 0
      • ManuelM
        Manuel
        last edited by

        hi,

        does the provided code works for you ?
        i don't know how to read those file and what they contains, specially what they call morph may not be the equivalent of our morph.

        Cheers,
        Manuel

        MAXON SDK Specialist

        MAXON Registered Developer

        1 Reply Last reply Reply Quote 0
        • A
          AiMiDi
          last edited by

          hi,
          I read the code you provided, but I cannot use it.
          I want to read the morph data that I want to import from the file, and then write it to the tag instead of importing it from another object.

          The morph of the MMD model is indeed different from the c4d. I just want to import the morph of the MMD model.
          The file records the point index (I have ensured that these points exist in the model.) and the point displacement (this is a Vector32, which represents the displacement of the deformation point, and the final position of the point is "point position + point displacement").

          I noticed that you used "CAMorphNode". I don't know how to use it. Can you explain it in detail? I can't understand the document.
          When I try to use "CAMorphNode", I don't know if the point index recorded in it is the point index of the model.

          Thank,
          AiMiDi

          1 Reply Last reply Reply Quote 0
          • ManuelM
            Manuel
            last edited by

            hi,

            Taking the next objet was just to have a source of points/vectors. It can be any kind of source as long as you know if the vector are relative or absolute.

            You are saying that the morph vector are relative to the point position so you need to change the last flag of this line
            from CAMORPH_MODE::ABS to CAMORPH_MODE::REL

            newMorph->SetMode(doc, morph_tag, CAMORPH_MODE_FLAGS::ALL | CAMORPH_MODE_FLAGS::EXPAND, CAMORPH_MODE::REL);
            

            That way, the vector you pass will be added to the current point position.

            You got our manual about CAMorphNode
            It's an object stored specially useful if the morph tag is in Hierarchy mode.

            The point are the same, that's why you need to set the mode.
            First you need to EXPAND and once you are done, you need to COLLAPSE so only delta will be stored in the tag.

            let me know if it's still not clear 🙂

            Cheers,
            Manuel

            MAXON SDK Specialist

            MAXON Registered Developer

            1 Reply Last reply Reply Quote 0
            • A
              AiMiDi
              last edited by AiMiDi

              hi,
              I modified it based on the code you provided, and it works.
              I use multi-threading, but sometimes it will get stuck when calling multi-thread (console display handles are not equal). I don't know how to solve this problem.
              And if I use optimization commands, it will destroy morph, what should I do.

              Thank,
              AiMiDi

              1 Reply Last reply Reply Quote 0
              • ManuelM
                Manuel
                last edited by

                hi,

                it's a bit hard to tell without more informations.

                Could you provide an example of what's going on ? Code, Workflow, does Cinema 4D hangs, crash ? What is your expected result ?

                About the optimization command, of course optimizing the mesh may reduce the point number or the order of points.
                But what do you call "destroy morph" ? Are only the points that are optimized that get wrong ? Does every points get wrong ?
                Is it only the geometry or the uvs ?

                cheers,
                Manuel

                MAXON SDK Specialist

                MAXON Registered Developer

                1 Reply Last reply Reply Quote 0
                • A
                  AiMiDi
                  last edited by AiMiDi

                  hi,
                  The problem with multithreading is this:
                  The cpu is still occupied, but the utilization rate is very low, and the thread does not exit.
                  e23cf9b4-2055-45f7-b665-628c3d160177-image.png
                  When there is a problem, the console often has this:

                  Exception filter was modified, handler is 0x00007ffe2ff9f430 but should be 0x00007ffe2e4f7320
                  

                  The imported model is available, but after I use the optimization command,

                  doc->SetSelection(model);
                  doc->SetMode(Mpolygons);
                  BaseSelect* all_select = model->GetPolygonS();
                  all_select->SelectAll(0, model->GetPolygonCount() - 1);
                  CallCommand(14039);
                  all_select->DeselectAll();
                  doc->SetMode(Mmodel);
                  

                  it became as shown in the figure.
                  3286ac8f-2b5a-47b1-845c-9ae7b7e1ab91-image.png

                  The optimization command may change the index of the point, how do I get these changes, I noticed that some messages will be sent after the change, and how to use it.

                  Thank,
                  AiMiDi

                  1 Reply Last reply Reply Quote 0
                  • ManuelM
                    Manuel
                    last edited by Manuel

                    hi,

                    sorry for the delay, we have our internal summit and we have a bit less time this week to work on support cases.
                    it's a normal result, if you are changing the mesh, than the morph cannot convert the data.
                    You need to import all your mesh. combine them into one and optimize the mesh and than create your morph.

                    For that you need to track your points from what mesh they are coming from and what was the index on your morph.

                    To track the points, you can create and add a customDataTag that will store information for each points. (the orginal mesh name and the index from that mesh).
                    You can create one tag on each mesh part and when you combine all the parts, our core system will combine them. (you can implement the "add" function in your customDataTag to tell how you want to data to be combined)

                    You can read information about CustomDatTag in our manual
                    We also have examples in our sdk you can found them on github

                    I will try to test it myself.

                    Cheers,
                    Manuel

                    MAXON SDK Specialist

                    MAXON Registered Developer

                    1 Reply Last reply Reply Quote 0
                    • A
                      AiMiDi
                      last edited by

                      Thanks,
                      I will try it myself, thank you for your help.

                      Thank,
                      AiMiDi

                      1 Reply Last reply Reply Quote 0
                      • ferdinandF
                        ferdinand
                        last edited by

                        Hello @AiMiDi,

                        without any further feedback or questions, we will consider this topic as solved by Wednesday and flag it accordingly.

                        Thank you for your understanding,
                        Ferdinand

                        MAXON SDK Specialist
                        developers.maxon.net

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