View Full Version : Setting the pivot points of polyLine nurbs curves generated through the API

05 May 2007, 09:44 PM
We have a plugin here that will read information about control points of a polyline curve from file, and then uses the API to generate the curve inside of Maya. The curve generation part works beautifully - but I'm running into problems setting the pivot points of the curve: whenever I try to set the pivot point of the curve, the pivot always ultimately gets set to the local origin. Which is usually, but not always, the global origin.

The artists aren't particularly found of having all of the pivot points for all of the curves at the origin (^_^).

here's a simplified version of my curve generating function:

MObject GeneratePolyline()
MStatus status;
MFnNurbsCurve curveFn;

//create the curve shape
MPointArray cvArray( (double (*)[4])pointcvs, numPoints );
MDoubleArray knotArray( knots, numKnots );
int degree = 1;
MObject curve = curveFn.create( cvArray, knotArray, degree, MFnNurbsCurve::kOpen,
false, false, MObject::kNullObj, &status );

if ( MS::kSuccess != status )
return status;

//create the transform that it goes under
MFnTransform curvexform(curve, &status);
if ( MS::kSuccess != status )
return status;

MPoint scale_pivot;
MPoint rotate_pivot;

GetPivotPoints(scale_pivot, rotate_pivot);

curvexform.setScalePivot( scale_pivot, MSpace::kObject, false );
curvexform.setRotatePivot( rotate_pivot, MSpace::kObject, false );

return curve;

I've bolded the two lines that seem to be the most relevant. The pivot points that we've stored in the file are in object space, so we try to use MSpace::kObject to communicated this. But we've also tried, kTransform, kPostTransform, kPreTransform and kWorld, and still the pivot points all get generated at the origin.

Any ideas?

05 May 2007, 09:17 PM
nevermind -the problem is elsewhere. The function above works in isolation.

CGTalk Moderation
05 May 2007, 09:18 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.