Get Deformed Spline



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

    On 28/12/2003 at 09:34, xxxxxxxx wrote:

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

    ---------
    Hi,
    Im trying to make a clone of a deformed primitive spline.
    The code im using is:

        
        
        
        
        // obj1 is a Arc Spline (that has a bend deformer as its child)
        
        
        
        
         BaseObject *object = op->GetAndCheckHierarchyClone(hh, obj1, HCLONE_ASSPLINE, &dirty, 0, false);
        
        
        
        
         if(!dirty) return object;
        
        
        
        
         SplineObject *spline = static_cast<SplineObject*>(object)->GetRealSpline();
        
        
        
        
         if(!spline)   
         {  
          GePrint("Spline is null");  
          return NULL;  
         }
        
        
        
    

    The result of that returns "Spline is null in the console when I have a deformer as a child of the spline. If i remove or de-activate the deformer, the spline variable is valid and my plugin works like it should.
    What am I doing wrong?
    Thanks



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

    On 31/12/2003 at 02:15, xxxxxxxx wrote:

    A deformed spline is no longer a SplineObject, it's a LineObject. You might be able to use HCLONE_ASLINE. I prefer to use HCLONE_ASIS, SendModelingCommand(MCOMMAND_CURRENTSTATETOOBJECT) and then GetRealSpline() on that. If I get something back I consider it a spline object.
    The drawback is that once a spline is converted to a Line it loses its interpolation option, it's just a couple of line segments. So you'll lose precision when using e.g. GetSplineTangent(). Therefore you might want to provide a variant without the current state to object, to only accept undeformed splines.



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

    On 02/01/2004 at 08:29, xxxxxxxx wrote:

    Thanks Mikael,
    Worked a charm :) I used the HCLONE_ASIS/SendModelingCommand way


Log in to reply