public override MMatrix asMatrix() 
		{
			// Get the current transform matrix
			MMatrix m = base.asMatrix();
			// Initialize the new matrix we will calculate
			MTransformationMatrix tm = new MTransformationMatrix( m );
			// Find the current rotation as a quaternion
			MQuaternion quat = rotation();
			// Convert the rocking value in degrees to radians
			DegreeRadianConverter conv = new DegreeRadianConverter();
			double newTheta = conv.degreesToRadians( getRockInX() );
			quat.setToXAxis( newTheta );
			// Apply the rocking rotation to the existing rotation
			tm.addRotationQuaternion( quat.x, quat.y, quat.z, quat.w, MSpace.Space.kTransform);
			// Let Maya know what the matrix should be
			return tm.asMatrixProperty;
		}
        public override MMatrix asMatrix()
        {
            // Get the current transform matrix
            MMatrix m = base.asMatrix();
            // Initialize the new matrix we will calculate
            MTransformationMatrix tm = new MTransformationMatrix(m);
            // Find the current rotation as a quaternion
            MQuaternion quat = rotation();
            // Convert the rocking value in degrees to radians
            DegreeRadianConverter conv = new DegreeRadianConverter();
            double newTheta            = conv.degreesToRadians(getRockInX());

            quat.setToXAxis(newTheta);
            // Apply the rocking rotation to the existing rotation
            tm.addRotationQuaternion(quat.x, quat.y, quat.z, quat.w, MSpace.Space.kTransform);
            // Let Maya know what the matrix should be
            return(tm.asMatrixProperty);
        }
        protected override MEulerRotation applyRotationLimits(MEulerRotation unlimitedRotation, MDataBlock block)
        {
            //
            // For demonstration purposes we limit the rotation to 60
            // degrees and bypass the rotation limit attributes
            //
            DegreeRadianConverter conv = new DegreeRadianConverter();
            double degrees             = conv.radiansToDegrees(unlimitedRotation.x);

            if (degrees < 60)
            {
                return(unlimitedRotation);
            }
            MEulerRotation euler = new MEulerRotation();

            euler.x = conv.degreesToRadians(60.0);
            return(euler);
        }
        public override MMatrix asMatrix(double percent)
        {
            MPxTransformationMatrix m = new MPxTransformationMatrix(this);
            //	Apply the percentage to the matrix components
            MVector trans = m.translation();

            trans *= percent;
            m.translateTo(trans);
            MPoint rotatePivotTrans = m.rotatePivot();

            rotatePivotTrans = rotatePivotTrans * percent;
            m.setRotatePivot(rotatePivotTrans);
            MPoint scalePivotTrans = new MPoint(m.scalePivotTranslation());

            scalePivotTrans = scalePivotTrans * percent;
            m.setScalePivotTranslation(new MVector(scalePivotTrans));

            //	Apply the percentage to the rotate value.  Same
            // as above + the percentage gets applied
            MQuaternion           quat = rotation();
            DegreeRadianConverter conv = new DegreeRadianConverter();
            double newTheta            = conv.degreesToRadians(getRockInX());

            quat.setToXAxis(newTheta);
            m.rotateBy(quat);
            MEulerRotation eulRotate = m.eulerRotation();

            m.rotateTo(eulRotate.multiply(percent), MSpace.Space.kTransform);

            //	Apply the percentage to the scale
            MVector s = new MVector(scale(MSpace.Space.kTransform));

            s.x = 1.0 + (s.x - 1.0) * percent;
            s.y = 1.0 + (s.y - 1.0) * percent;
            s.z = 1.0 + (s.z - 1.0) * percent;
            m.scaleTo(s, MSpace.Space.kTransform);

            return(m.asMatrix());
        }
 protected override MEulerRotation applyRotationLimits(MEulerRotation unlimitedRotation, MDataBlock block)
 {
     //
     // For demonstration purposes we limit the rotation to 60
     // degrees and bypass the rotation limit attributes
     //
     DegreeRadianConverter conv = new DegreeRadianConverter();
     double degrees = conv.radiansToDegrees( unlimitedRotation.x );
     if ( degrees < 60 )
         return unlimitedRotation;
     MEulerRotation euler = new MEulerRotation();
     euler.x = conv.degreesToRadians( 60.0 );
     return euler;
 }
        public override MMatrix asMatrix(double percent)
        {
            MPxTransformationMatrix m = new MPxTransformationMatrix(this);
            //	Apply the percentage to the matrix components
            MVector trans = m.translation();
            trans *= percent;
            m.translateTo( trans );
            MPoint rotatePivotTrans = m.rotatePivot();
            rotatePivotTrans = rotatePivotTrans * percent;
            m.setRotatePivot( rotatePivotTrans );
            MPoint scalePivotTrans = new MPoint(m.scalePivotTranslation());
            scalePivotTrans = scalePivotTrans * percent;
            m.setScalePivotTranslation( new MVector(scalePivotTrans));

            //	Apply the percentage to the rotate value.  Same
            // as above + the percentage gets applied
            MQuaternion quat = rotation();
            DegreeRadianConverter conv = new DegreeRadianConverter();
            double newTheta = conv.degreesToRadians( getRockInX() );
            quat.setToXAxis( newTheta );
            m.rotateBy( quat );
            MEulerRotation eulRotate = m.eulerRotation();
            m.rotateTo(  eulRotate.multiply(percent), MSpace.Space.kTransform);

            //	Apply the percentage to the scale
            MVector s = new MVector(scale(MSpace.Space.kTransform));
            s.x = 1.0 + (s.x - 1.0)*percent;
            s.y = 1.0 + (s.y - 1.0)*percent;
            s.z = 1.0 + (s.z - 1.0)*percent;
            m.scaleTo(s, MSpace.Space.kTransform);

            return m.asMatrix();
        }