CAPoseMorphTag access undeformed object. [SOLVED]



  • On 25/06/2015 at 06:08, xxxxxxxx wrote:

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

    ---------
    Hi,

    I'm working on a object modifier and i need to access the object undeformed.

    In the ModifyObject() function, i'm using GetCacheParent() and it's work perfectly with others deformers.

    But it get the mesh affected by the morph tag.

    How do i access the object unaffected by both the morph tag and deformers ?



  • On 25/06/2015 at 15:36, xxxxxxxx wrote:

    i did found something that work but i'm not sure it work on every case.

    BaseObject  *restObj ((BaseObject* )op->GetCacheParent()->GetClone(COPYFLAGS_0, nullptr));
    if (!restObj) return false;
      
    Vector64 *pAdrDef(ToPoly(defObj)->GetPointW());
      
      
     CAPoseMorphTag *morphTag = (CAPoseMorphTag* )restObj->GetTag(Tposemorph);
        if (morphTag) {
            CAMorph   *baseMorph =  morphTag->GetMorphBase();
            if (baseMorph) {
                CAMorphNode *firstMorph = baseMorph->GetFirst();
                if (firstMorph) {
                    for (Int32 i = 0 ; i < firstMorph->GetPointCount(); i++) {
                        pAdrRest[i] = firstMorph->GetPoint(i);
                    }
                }
            }
        }
      
      
      
      
        ... do my stuff
      
      
    BaseObject::Free(restObj);
    return true;
      
    
    


  • On 30/06/2015 at 03:31, xxxxxxxx wrote:

    Hello,

    why exactly do you need the undeformed object? Deformers should work in a pipeline so that the deformation result of one deformer is the input for the next one.

    Best wishes,
    Sebastian



  • On 30/06/2015 at 10:07, xxxxxxxx wrote:

    I'm playing with the delta mush algorithm from R&H.

    I need to calculate a laplacian smooth operation, the Tangent, Bi-tangent and normal for each points.

    And for both deformed and undeformed object.

    The best solution should be to get the undeformed state and calculate the PTBN matrix and store it. But i didn't found a good solution to do it. So i'm doing both in the "ModifyObject" function :S



  • On 01/07/2015 at 01:15, xxxxxxxx wrote:

    Hello,

    from what you tell it seems to me that you could also implement this feature as a tag not unlike the PoseMorph instead of a modifier.

    Best wishes,
    Sebastian



  • On 01/07/2015 at 02:24, xxxxxxxx wrote:

    Why not, but deformer have a falloff tab and i can use a restriction tag on it. Really helpful to paint weight.
    A tag will allow to have different iteration number for every object and could save a lot of CPU.

    I'm afraid i'll be facing the same problem as i need the state before and after every deformation (deformers and tags)

    Or do you think i should use both a tag and a deformer (as the weight tag and the skin deformer)



  • On 02/07/2015 at 06:54, xxxxxxxx wrote:

    Hello,

    you could save the initial state of the mesh with a button to save that state. Not unlike the "Init State" functionality in the Cloth tag or with the Base Morph in the Pose Morph Tag.

    Best wishes,
    Sebastian



  • On 02/07/2015 at 14:47, xxxxxxxx wrote:

    At first i was thinking about the smooth deformer that got a button to initialize.

    But the tag will resolve all my problems, thanks a lot for switching on the light ^^


Log in to reply