Exemple #1
0
MStatus sgBulgeDeformer::initialize()
{
	MStatus status;

	MFnNumericAttribute nAttr;
	MFnTypedAttribute tAttr;
	MFnMatrixAttribute mAttr;
	MFnCompoundAttribute cAttr;

	aBulgeWeight = nAttr.create(nameBulgeWeight, nameBulgeWeight, MFnNumericData::kFloat, 1.0);
	nAttr.setStorable(false);
	nAttr.setKeyable(true);
	addAttribute(aBulgeWeight);

	aBulgeRadius = nAttr.create(nameBulgeRadius, nameBulgeRadius, MFnNumericData::kDouble, 0);
	nAttr.setMin(0);
	nAttr.setStorable(false);
	nAttr.setKeyable(true);
	addAttribute(aBulgeRadius);

	aBulgeInputs = cAttr.create(nameBulgeInputs, nameBulgeInputs);
	aMatrix = mAttr.create(nameMatrix, nameMatrix);
	aMesh = tAttr.create(nameMesh, nameMesh, MFnData::kMesh );
	cAttr.addChild(aMatrix);
	cAttr.addChild(aMesh);
	cAttr.setArray(true);
	addAttribute(aBulgeInputs);

	attributeAffects(aBulgeWeight, outputGeom);
	attributeAffects(aBulgeRadius, outputGeom);
	attributeAffects(aBulgeInputs, outputGeom);

	return status;
}
MStatus  clusterControledCurve::initialize()
{
	MStatus  status;

	MFnNumericAttribute  nAttr;
	MFnMatrixAttribute   mAttr;
	MFnTypedAttribute    tAttr;
	MFnCompoundAttribute cAttr;

	aInputCurve = tAttr.create( "inputCurve", "inputCurve", MFnData::kNurbsCurve );
	tAttr.setStorable( true );
	CHECK_MSTATUS( addAttribute( aInputCurve ) );

	aInputCurveMatrix = mAttr.create( "inputCurveMatrix", "inputCurveMatrix" );
	mAttr.setStorable( true );
	CHECK_MSTATUS( addAttribute( aInputCurveMatrix ) );

	aDumyMatrix = mAttr.create( "dumyMatrix", "dumyMatrix" );
	mAttr.setStorable( true );
	CHECK_MSTATUS( addAttribute( aDumyMatrix ) );

	aBindPreMatrix = mAttr.create( "bindPreMatrix", "bindPreMatrix" );
	mAttr.setStorable( true );
	mAttr.setArray( true );
	nAttr.setUsesArrayDataBuilder( true );
	CHECK_MSTATUS( addAttribute( aBindPreMatrix ) );

	aMatrix = mAttr.create( "matrix", "matrix" );
	mAttr.setStorable( true );
	mAttr.setArray( true );
	CHECK_MSTATUS( addAttribute( aMatrix ) );

	aWeightList = cAttr.create( "weightList", "weightList" );
	aWeights = nAttr.create( "weights", "weights", MFnNumericData::kFloat, 0.0 );
	nAttr.setArray( true );
	nAttr.setUsesArrayDataBuilder( true );
	cAttr.addChild( aWeights );
	cAttr.setArray( true );
	cAttr.setStorable( true );
	CHECK_MSTATUS( addAttribute( aWeightList ) );

	aUpdate = nAttr.create( "update", "update", MFnNumericData::kBoolean, false );
	nAttr.setStorable( true );
	CHECK_MSTATUS( addAttribute( aUpdate ) );

	aOutputCurve = tAttr.create( "outputCurve", "outputCurve", MFnData::kNurbsCurve );
	CHECK_MSTATUS( addAttribute( aOutputCurve ) );

	CHECK_MSTATUS( attributeAffects( aInputCurve, aOutputCurve ) );
	CHECK_MSTATUS( attributeAffects( aInputCurveMatrix, aOutputCurve ) );
	CHECK_MSTATUS( attributeAffects( aDumyMatrix, aOutputCurve ) );
	CHECK_MSTATUS( attributeAffects( aBindPreMatrix, aOutputCurve ) );
	CHECK_MSTATUS( attributeAffects( aMatrix, aOutputCurve ) );
	CHECK_MSTATUS( attributeAffects( aWeightList, aOutputCurve ) );
	CHECK_MSTATUS( attributeAffects( aUpdate, aOutputCurve ) );

	return MS::kSuccess;
}
MPlug TransformationMatrixParameterHandler<T>::doCreate( IECore::ConstParameterPtr parameter, const MString &plugName, MObject &node ) const
{
	typename IECore::TypedParameter<IECore::TransformationMatrix<T> >::ConstPtr p = IECore::runTimeCast<const IECore::TypedParameter<IECore::TransformationMatrix<T> > >( parameter );
	if( !p )
	{
		return MPlug();
	}

	MFnCompoundAttribute fnCAttr;
	MObject attribute = fnCAttr.create( plugName, plugName );

	MFnNumericAttribute fnNAttr;
	MFnUnitAttribute fnUAttr;

	// As TransformationMatrix embodies a fairly comprehensive rotation model, were going to be a little
	// more basic here, and just supply a V3f rotation and pretend that the Quartonean isn't there.
	///\todo Expose rotation order and rotationOrientation.

	// These use the '0', '1' and '2' child suffixes instead of 'X' 'Y' and 'Z' to match those created by fnNAttr.create() @ L188.
	MObject p1 = fnUAttr.create( plugName + g_attributeNames[ TRANSLATE_INDEX ] + "0", plugName + g_attributeNames[ TRANSLATE_INDEX ] + "0", MFnUnitAttribute::kDistance );
	MObject p2 = fnUAttr.create( plugName + g_attributeNames[ TRANSLATE_INDEX ] + "1", plugName + g_attributeNames[ TRANSLATE_INDEX ] + "1", MFnUnitAttribute::kDistance );
	MObject p3 = fnUAttr.create( plugName + g_attributeNames[ TRANSLATE_INDEX ] + "2", plugName + g_attributeNames[ TRANSLATE_INDEX ] + "2", MFnUnitAttribute::kDistance );
	fnCAttr.addChild( fnNAttr.create( plugName + g_attributeNames[ TRANSLATE_INDEX ], plugName + g_attributeNames[ TRANSLATE_INDEX ], p1, p2, p3 ) );

	p1 = fnUAttr.create( plugName + g_attributeNames[ ROTATE_INDEX ] + "0", plugName + g_attributeNames[ ROTATE_INDEX ] + "0", MFnUnitAttribute::kAngle );
	p2 = fnUAttr.create( plugName + g_attributeNames[ ROTATE_INDEX ] + "1", plugName + g_attributeNames[ ROTATE_INDEX ] + "1", MFnUnitAttribute::kAngle );
	p3 = fnUAttr.create( plugName + g_attributeNames[ ROTATE_INDEX ] + "2", plugName + g_attributeNames[ ROTATE_INDEX ] + "2", MFnUnitAttribute::kAngle );
	fnCAttr.addChild( fnNAttr.create( plugName + g_attributeNames[ ROTATE_INDEX ], plugName + g_attributeNames[ ROTATE_INDEX ], p1, p2, p3 ) );

	for( unsigned int i=2; i<8; i++ )
	{
		fnCAttr.addChild( fnNAttr.create( plugName + g_attributeNames[i], plugName + g_attributeNames[i], NumericTraits<Imath::Vec3<T> >::dataType() ) );
	}

	MPlug result = finishCreating( parameter, attribute, node );

	if( !doUpdate( parameter, result ) )
	{
		return MPlug(); // failure
	}

	if( !finishUpdating( parameter, result ) )
	{
		return MPlug(); // failure
	}

	return result;
}
void MFnCompoundAttrAddBool( MFnCompoundAttribute &attr, const char* full, const char* brief, bool def )
{
	MStatus status;
	MFnNumericAttribute boolAttr;
	MObject boolObj = boolAttr.create( full, brief, MFnNumericData::kBoolean, (def? 1.0 : 0.0), &status );
	attr.addChild( boolObj );
}
Exemple #5
0
MStatus blendCurve::initialize()
{
	MStatus status;

	MFnNumericAttribute  nAttr;
	MFnTypedAttribute    tAttr;
	MFnCompoundAttribute cAttr;

	aInputs = cAttr.create( "inputs", "inputs" );

	aInputCurve = tAttr.create( "inputCurve", "inputCurve", MFnData::kNurbsCurve );
	tAttr.setStorable( false );
	aWeight = nAttr.create( "weight", "weight", MFnNumericData::kFloat, 1.0 );
	nAttr.setMin( 0.0 );
	nAttr.setMax( 1.0 );
	nAttr.setKeyable( true );
	aBlendPosition = nAttr.create( "blendPosition", "blendPosition", MFnNumericData::kFloat, 1.0 );
	nAttr.setMin( 0.0 );
	nAttr.setMax( 1.0 );
	nAttr.setKeyable( true );
	aBlendArea     = nAttr.create( "blendArea", "blendArea", MFnNumericData::kFloat, 0.5 );
	nAttr.setMin( 0.0 );
	nAttr.setMax( 1.0 );
	nAttr.setKeyable( true );
	cAttr.addChild( aInputCurve );
	cAttr.addChild( aWeight );
	cAttr.addChild( aBlendPosition );
	cAttr.addChild( aBlendArea );
	cAttr.setArray( true );

	CHECK_MSTATUS_AND_RETURN_IT( addAttribute( aInputs ) );
	CHECK_MSTATUS_AND_RETURN_IT( attributeAffects( aInputs, outputGeom ) );

	return MS::kSuccess;
}
void MFnCompoundAttrAddEnum( MFnCompoundAttribute &attr, const char* full, const char* brief, const char** pEnumStrings, unsigned short count, unsigned short def )
{
	MStatus status;
	MFnEnumAttribute enumAttr;
	MObject enumObj = enumAttr.create( full, brief, def, &status );

	for(short index = 0; index < count; ++index)
		enumAttr.addField( pEnumStrings[index], index );

	attr.addChild( enumObj );
}
MPlug BoxParameterHandler<T>::doCreate( IECore::ConstParameterPtr parameter, const MString &plugName, MObject &node ) const
{
	typename IECore::TypedParameter<Box<T> >::ConstPtr p = IECore::runTimeCast<const IECore::TypedParameter<Box<T > > >( parameter );
	if( !p )
	{
		return MPlug();
	}

	MFnNumericAttribute fnNAttr;
	MFnCompoundAttribute fnCAttr;
	MObject oMin, oMax;
	switch( T::dimensions() )
	{
		case 2 :
			{
				MObject oMinX = fnNAttr.create( plugName + "MinX", plugName + "MinX", NumericTraits<T>::baseDataType() );
				MObject oMinY = fnNAttr.create( plugName + "MinY", plugName + "MinY", NumericTraits<T>::baseDataType() );
				oMin = fnNAttr.create( plugName + "Min", plugName + "Min", oMinX, oMinY );

				MObject oMaxX = fnNAttr.create( plugName + "MaxX", plugName + "MaxX", NumericTraits<T>::baseDataType() );
				MObject oMaxY = fnNAttr.create( plugName + "MaxY", plugName + "MaxY", NumericTraits<T>::baseDataType() );
				oMax = fnNAttr.create( plugName + "Max", plugName + "Max", oMaxX, oMaxY );
			}
			break;
		case 3 :
			oMin = fnNAttr.createPoint( plugName + "Min", plugName + "Min" );
			oMax = fnNAttr.createPoint( plugName + "Max", plugName + "Max" );
			break;
		default :
			return MPlug();
	}

	MObject attribute = fnCAttr.create( plugName, plugName );
	fnCAttr.addChild( oMin );
	fnCAttr.addChild( oMax );

	MPlug result = finishCreating( parameter, attribute, node );
	doUpdate( parameter, result );

	return result;
}
Exemple #8
0
MStatus weightList::initialize()
{
        MStatus status;
	MFnNumericAttribute numAtt; 

	aBias = numAtt.create( "bias", "b", MFnNumericData::kFloat);
	addAttribute(aBias);

	aWeights = numAtt.create("weights", "w", MFnNumericData::kFloat, -1000.0, &status); 
	numAtt.setKeyable(true); 
	numAtt.setArray(true); 
	numAtt.setReadable(true); 
	numAtt.setUsesArrayDataBuilder(true); 
	// setIndexMatters() will only affect array attributes with setReadable set to false, 
	// i.e. destination attributes. We have set the default value to an unlikely value 
	// to guarantee an entry is created regardless of its value. 
	// numAtt.setIndexMatters(true);
	addAttribute(aWeights); 
	
	MFnCompoundAttribute cmpAttr; 
	aWeightsList = cmpAttr.create("weightsList", "wl", &status); 
	cmpAttr.setArray(true); 
	cmpAttr.addChild(aWeights); 
	cmpAttr.setReadable(true); 
	cmpAttr.setUsesArrayDataBuilder(true); 
	// cmpAttr.setIndexMatters(true);
	addAttribute(aWeightsList); 

	attributeAffects(aBias, aWeightsList);
	
	return MStatus::kSuccess;
}
void MFnCompoundAttrAddString( MFnCompoundAttribute &attr, const char* full, const char* brief, const char* def )
{
	MStatus status;
	MFnTypedAttribute stringAttribute;
	MObject strinAttrObj = stringAttribute.create( full, brief, MFnData::kString, &status );
	
	// Default strings don't get saved, so setting values for defaults in AddRenderContextAttribute
	//if( def != 0 )
	//{
	//	MFnStringData defaultString;
	//	MObject defaultStringObj = defaultString.create(def);
	//	stringAttribute.setDefault(defaultStringObj);
	//}

	attr.addChild( strinAttrObj );
}
MStatus geometrySurfaceConstraint::initialize()
{
	MFnNumericAttribute nAttr;
	MStatus				status;

	// constraint attributes

	{	// Geometry: mesh, readable, not writable, delete on disconnect
		MFnTypedAttribute typedAttrNotWritable;
		geometrySurfaceConstraint::constraintGeometry =
			typedAttrNotWritable.create( "constraintGeometry", "cg", MFnData::kMesh, &status ); 	
		if (!status) { status.perror("typedAttrNotWritable.create:cgeom"); return status;}
		status = typedAttrNotWritable.setReadable(true);
		if (!status) { status.perror("typedAttrNotWritable.setReadable:cgeom"); return status;}
		status = typedAttrNotWritable.setWritable(false);
		if (!status) { status.perror("typedAttrNotWritable.setWritable:cgeom"); return status;}
		status = typedAttrNotWritable.setDisconnectBehavior(MFnAttribute::kDelete);
		if (!status) { status.perror("typedAttrNotWritable.setDisconnectBehavior:cgeom"); return status;}
	}
// Parent inverse matrix: delete on disconnect
	MFnTypedAttribute typedAttr;
		geometrySurfaceConstraint::constraintParentInverseMatrix =
			typedAttr.create( "constraintPim", "ci", MFnData::kMatrix, &status ); 	
		if (!status) { status.perror("typedAttr.create:matrix"); return status;}
		status = typedAttr.setDisconnectBehavior(MFnAttribute::kDelete);
		if (!status) { status.perror("typedAttr.setDisconnectBehavior:cgeom"); return status;}

		// Target geometry: mesh, delete on disconnect
		geometrySurfaceConstraint::targetGeometry =
			typedAttr.create( "targetGeometry", "tg", MFnData::kMesh, &status ); 	
		if (!status) { status.perror("typedAttr.create:tgeom"); return status;}
		status = typedAttr.setDisconnectBehavior(MFnAttribute::kDelete);
		if (!status) { status.perror("typedAttr.setDisconnectBehavior:cgeom"); return status;}
    
    targetTransform = typedAttr.create( "targetTransform", "ttm", MFnData::kMatrix, &status ); 	
    if (!status) { status.perror("typedAttr.create:targetTransform"); return status;}
    status = typedAttr.setDisconnectBehavior(MFnAttribute::kDelete);
    if (!status) { status.perror("typedAttr.setDisconnectBehavior:targetTransform"); return status;}
    
// Target weight: double, min 0, default 1.0, keyable, delete on disconnect
	MFnNumericAttribute typedAttrKeyable;
		geometrySurfaceConstraint::targetWeight 
			= typedAttrKeyable.create( "weight", "wt", MFnNumericData::kDouble, 1.0, &status );
		if (!status) { status.perror("typedAttrKeyable.create:weight"); return status;}
		status = typedAttrKeyable.setMin( (double) 0 );
		if (!status) { status.perror("typedAttrKeyable.setMin"); return status;}
		status = typedAttrKeyable.setKeyable( true );
		if (!status) { status.perror("typedAttrKeyable.setKeyable"); return status;}
		status = typedAttrKeyable.setDisconnectBehavior(MFnAttribute::kDelete);
		if (!status) { status.perror("typedAttrKeyable.setDisconnectBehavior:cgeom"); return status;}

	{	// Compound target(geometry,weight): array, delete on disconnect
		MFnCompoundAttribute compoundAttr;
		geometrySurfaceConstraint::compoundTarget = 
			compoundAttr.create( "target", "tgt",&status );
		if (!status) { status.perror("compoundAttr.create"); return status;}
        status = compoundAttr.addChild( geometrySurfaceConstraint::targetTransform );
		if (!status) { status.perror("compoundAttr.addChild targetTransform"); return status;}
		status = compoundAttr.addChild( geometrySurfaceConstraint::targetGeometry );
		if (!status) { status.perror("compoundAttr.addChild"); return status;}
		status = compoundAttr.addChild( geometrySurfaceConstraint::targetWeight );
		if (!status) { status.perror("compoundAttr.addChild"); return status;}
		status = compoundAttr.setArray( true );
		if (!status) { status.perror("compoundAttr.setArray"); return status;}
		status = compoundAttr.setDisconnectBehavior(MFnAttribute::kDelete);
		if (!status) { status.perror("typedAttrKeyable.setDisconnectBehavior:cgeom"); return status;}
	}
    
    MFnNumericAttribute numAttr;
    constraintTranslateX = numAttr.create( "constraintTranslateX", "ctx", MFnNumericData::kDouble, 0.0, &status );
    if(!status) {
        MGlobal::displayInfo("failed to create attrib constraintTranslateX");
        return status;
    }
    numAttr.setReadable(true);
	numAttr.setWritable(false);
    addAttribute(constraintTranslateX);
    
    constraintTranslateY = numAttr.create( "constraintTranslateY", "cty", MFnNumericData::kDouble, 0.0, &status );
    if(!status) {
        MGlobal::displayInfo("failed to create attrib constraintTranslateY");
        return status;
    }
    numAttr.setReadable(true);
	numAttr.setWritable(false);
    addAttribute(constraintTranslateY);
    
    constraintTranslateZ = numAttr.create( "constraintTranslateZ", "ctz", MFnNumericData::kDouble, 0.0, &status );
    if(!status) {
        MGlobal::displayInfo("failed to create attrib constraintTranslateY");
        return status;
    }
    numAttr.setReadable(true);
	numAttr.setWritable(false);
    addAttribute(constraintTranslateZ);

	constraintTargetX = numAttr.create( "constraintTargetX", "ttx", MFnNumericData::kDouble, 0.0, &status );
    if(!status) {
        MGlobal::displayInfo("failed to create attrib constraintTargetX");
        return status;
    }
    addAttribute(constraintTargetX);
	
	constraintTargetY = numAttr.create( "constraintTargetY", "tty", MFnNumericData::kDouble, 0.0, &status );
    if(!status) {
        MGlobal::displayInfo("failed to create attrib constraintTargetY");
        return status;
    }
    addAttribute(constraintTargetY);
	
	constraintTargetZ = numAttr.create( "constraintTargetZ", "ttz", MFnNumericData::kDouble, 0.0, &status );
    if(!status) {
        MGlobal::displayInfo("failed to create attrib constraintTargetZ");
        return status;
    }
    addAttribute(constraintTargetZ);
	
	constraintObjectX = numAttr.create( "constraintObjectX", "otx", MFnNumericData::kDouble, 0.0, &status );
    if(!status) {
        MGlobal::displayInfo("failed to create attrib constraintObjectX");
        return status;
    }
    addAttribute(constraintObjectX);
	
	constraintObjectY = numAttr.create( "constraintObjectY", "oty", MFnNumericData::kDouble, 0.0, &status );
    if(!status) {
        MGlobal::displayInfo("failed to create attrib constraintObjectY");
        return status;
    }
    addAttribute(constraintObjectY);
	
	constraintObjectZ = numAttr.create( "constraintObjectZ", "otz", MFnNumericData::kDouble, 0.0, &status );
    if(!status) {
        MGlobal::displayInfo("failed to create attrib constraintObjectZ");
        return status;
    }
    addAttribute(constraintObjectZ);
    
    targetOffset = numAttr.create("targetOffset", "tgo", MFnNumericData::k3Double, 0.0, &status);
    if (!status) { status.perror("addAttribute targetOffset"); return status;}
    addAttribute(targetOffset);
    
    targetRestP = numAttr.create("targetRestAt", "tgrt", MFnNumericData::k3Double, 0.0, &status);
    if (!status) { status.perror("addAttribute targetRestAt"); return status;}
    addAttribute(targetRestP);
    
	status = addAttribute( geometrySurfaceConstraint::constraintParentInverseMatrix );
	if (!status) { status.perror("addAttribute"); return status;}
	status = addAttribute( geometrySurfaceConstraint::constraintGeometry );
	if (!status) { status.perror("addAttribute"); return status;}
	status = addAttribute( geometrySurfaceConstraint::compoundTarget );
	if (!status) { status.perror("addAttribute"); return status;}

	status = attributeAffects( compoundTarget, constraintGeometry );
	if (!status) { status.perror("attributeAffects"); return status;}
    status = attributeAffects( targetTransform, constraintGeometry );
	if (!status) { status.perror("attributeAffects"); return status;}
	status = attributeAffects( targetGeometry, constraintGeometry );
	if (!status) { status.perror("attributeAffects"); return status;}
	status = attributeAffects( targetWeight, constraintGeometry );
	if (!status) { status.perror("attributeAffects"); return status;}
	status = attributeAffects( constraintParentInverseMatrix, constraintGeometry );
	if (!status) { status.perror("attributeAffects"); return status;}
    
    attributeAffects(targetTransform, constraintTranslateX);
    attributeAffects(targetTransform, constraintTranslateY);
    attributeAffects(targetTransform, constraintTranslateZ);

	return MS::kSuccess;
}
// Attributes initialisation
MStatus DA_GridGenerator::initialize()
{
    MStatus stat;
    MFnCompoundAttribute cAttr;
    MFnNumericAttribute nAttr;
    MFnEnumAttribute eAttr;
    MFnTypedAttribute tAttr;

    //
    // Controls
    //
    aWidth = nAttr.create("width", "w", MFnNumericData::kDouble, 1.0);
    nAttr.setMin(0.001);
    nAttr.setChannelBox(true);
    nAttr.setKeyable(true);
    stat = addAttribute(aWidth);
    CHECK_MSTATUS(stat);

    aHeight = nAttr.create("height", "h", MFnNumericData::kDouble, 1.0);
    nAttr.setMin(0.001);
    nAttr.setChannelBox(true);
    nAttr.setKeyable(true);
    stat = addAttribute(aHeight);
    CHECK_MSTATUS(stat);

    aResolutionX = nAttr.create("resolutionX", "resx", MFnNumericData::kInt, 10);
    nAttr.setMin(2);
    nAttr.setChannelBox(true);
    nAttr.setKeyable(true);
    aResolutionY = nAttr.create("resolutionY", "resy", MFnNumericData::kInt, 10);
    nAttr.setMin(2);
    nAttr.setChannelBox(true);
    nAttr.setKeyable(true);
    aResolution = cAttr.create("resolution", "res");

    stat = cAttr.addChild(aResolutionX);
    CHECK_MSTATUS(stat);
    stat = cAttr.addChild(aResolutionY);
    CHECK_MSTATUS(stat);
    stat = addAttribute(aResolution);
    CHECK_MSTATUS(stat);


    aPattern = eAttr.create("pattern","pat",0);
    eAttr.addField(DA_GridGeneratorPatterns::NONE, 0);
    eAttr.addField(DA_GridGeneratorPatterns::BRICK_U, 1);
    eAttr.addField(DA_GridGeneratorPatterns::BRICK_V, 2);
    eAttr.setChannelBox(true);
    eAttr.setKeyable(true);

    stat = addAttribute(aPattern);
    CHECK_MSTATUS(stat);

    //
    // Outputs
    //

    aOutDynamicArray = tAttr.create("outDynamicArray", "oda", MFnData::kDynArrayAttrs);
    tAttr.setWritable(false); // Just output
    stat = addAttribute(aOutDynamicArray);
    CHECK_MSTATUS(stat);

    //
    // Attributes affects
    //

    attributeAffects(aWidth, aOutDynamicArray);
    attributeAffects(aHeight, aOutDynamicArray);

    attributeAffects(aResolutionX, aOutDynamicArray);
    attributeAffects(aResolutionY, aOutDynamicArray);

    attributeAffects(aPattern, aOutDynamicArray);

    // Done
    return stat;
}
MStatus SurfaceAttach::initialize() {
    MFnTypedAttribute fnTypeAttr;
    MFnNumericAttribute fnNumAttr;
    MFnUnitAttribute fnUnitAttr;
    MFnCompoundAttribute fnCompoundAttr;
    MFnEnumAttribute fnEnumAttr;
    MFnMatrixAttribute fnMatAttr;

    MStatus stat;

    // Input Attributes
    direction = fnEnumAttr.create("direction", "dire", 0);
    fnEnumAttr.addField("U", 0);
    fnEnumAttr.addField("V", 1);

    surface = fnTypeAttr.create("surface", "surface", MFnData::kNurbsSurface);

    parentInverse = fnMatAttr.create("parentInverse", "ps", MFnMatrixAttribute::kDouble);
    fnMatAttr.setKeyable(true);

    samples = fnNumAttr.create("samples", "samples", MFnNumericData::kInt, 1000);
    fnNumAttr.setKeyable(true);
    fnNumAttr.setMin(1.0);

    staticLength = fnNumAttr.create("staticLength", "staticLength", MFnNumericData::kDouble, 0.0001);
    fnNumAttr.setKeyable(true);
    fnNumAttr.setMin(0.0001);

    offset = fnNumAttr.create("offset", "offset", MFnNumericData::kDouble, 0.0);
    fnNumAttr.setKeyable(true);

    genus = fnEnumAttr.create("type", "type", 0);
    fnEnumAttr.addField("Parametric", 0);

    fnEnumAttr.addField("Percentage", 1);
    fnEnumAttr.addField("FixedLength", 2);
    fnEnumAttr.setKeyable(true);

    reverse = fnNumAttr.create("reverse", "reverse", MFnNumericData::kBoolean, false);
    fnNumAttr.setKeyable(true);

    inU = fnNumAttr.create("inU", "U", MFnNumericData::kDouble, 0.5);
    fnNumAttr.setKeyable(true);

    inV = fnNumAttr.create("inV", "V", MFnNumericData::kDouble, 0.5);
    fnNumAttr.setKeyable(true);

    inUV = fnCompoundAttr.create("inUV", "inUV");
    fnCompoundAttr.setKeyable(true);
    fnCompoundAttr.setArray(true);
    fnCompoundAttr.addChild(inU);
    fnCompoundAttr.addChild(inV);
    fnCompoundAttr.setUsesArrayDataBuilder(true);

    // Output Attributes
    translateX = fnNumAttr.create("translateX", "translateX", MFnNumericData::kDouble);
    fnNumAttr.setWritable(false);
    fnNumAttr.setStorable(false);

    translateY = fnNumAttr.create("translateY", "translateY", MFnNumericData::kDouble);
    fnNumAttr.setWritable(false);
    fnNumAttr.setStorable(false);

    translateZ = fnNumAttr.create("translateZ", "translateZ", MFnNumericData::kDouble);
    fnNumAttr.setWritable(false);
    fnNumAttr.setStorable(false);

    translate = fnNumAttr.create("translate", "translate", translateX, translateY, translateZ);
    fnNumAttr.setWritable(false);
    fnNumAttr.setStorable(false);

    rotateX = fnUnitAttr.create("rotateX", "rotateX", MFnUnitAttribute::kAngle);
    fnUnitAttr.setWritable(false);
    fnUnitAttr.setStorable(false);

    rotateY = fnUnitAttr.create("rotateY", "rotateY", MFnUnitAttribute::kAngle);
    fnUnitAttr.setWritable(false);
    fnUnitAttr.setStorable(false);

    rotateZ = fnUnitAttr.create("rotateZ", "rotateZ", MFnUnitAttribute::kAngle);
    fnUnitAttr.setWritable(false);
    fnUnitAttr.setStorable(false);

    rotate = fnNumAttr.create("rotate", "rotate", rotateX, rotateY, rotateZ);
    fnNumAttr.setWritable(false);

    out = fnCompoundAttr.create("out", "out");
    fnCompoundAttr.setWritable(false);
    fnCompoundAttr.setArray(true);
    fnCompoundAttr.addChild(translate);
    fnCompoundAttr.addChild(rotate);
    fnCompoundAttr.setUsesArrayDataBuilder(true);

    // These aren't going to fail, give me a break :)
    // Add Attributes
    SurfaceAttach::addAttribute(direction);
    SurfaceAttach::addAttribute(surface);
    SurfaceAttach::addAttribute(parentInverse);
    SurfaceAttach::addAttribute(samples);
    SurfaceAttach::addAttribute(staticLength);
    SurfaceAttach::addAttribute(offset);
    SurfaceAttach::addAttribute(genus);
    SurfaceAttach::addAttribute(reverse);
    SurfaceAttach::addAttribute(inUV);
    SurfaceAttach::addAttribute(out);

    // Attribute Affects
    SurfaceAttach::attributeAffects(direction, translate);
    SurfaceAttach::attributeAffects(surface, translate);
    SurfaceAttach::attributeAffects(parentInverse, translate);
    SurfaceAttach::attributeAffects(staticLength, translate);
    SurfaceAttach::attributeAffects(samples, translate);
    SurfaceAttach::attributeAffects(offset, translate);
    SurfaceAttach::attributeAffects(genus, translate);
    SurfaceAttach::attributeAffects(reverse, translate);
    SurfaceAttach::attributeAffects(inU, translate);
    SurfaceAttach::attributeAffects(inV, translate);

    SurfaceAttach::attributeAffects(direction, rotate);
    SurfaceAttach::attributeAffects(surface, rotate);
    SurfaceAttach::attributeAffects(parentInverse, rotate);
    SurfaceAttach::attributeAffects(staticLength, rotate);
    SurfaceAttach::attributeAffects(samples, rotate);
    SurfaceAttach::attributeAffects(offset, rotate);
    SurfaceAttach::attributeAffects(genus, rotate);
    SurfaceAttach::attributeAffects(reverse, rotate);
    SurfaceAttach::attributeAffects(inU, rotate);
    SurfaceAttach::attributeAffects(inV, rotate);

    return MS::kSuccess;
}
//-----------------------------------------------------------------------------
//
//-----------------------------------------------------------------------------
MStatus CVstWeldNode::Initialize()
{
	MFnCompoundAttribute cFn;
	MFnEnumAttribute eFn;
	MFnGenericAttribute gFn;
	MFnMatrixAttribute mFn;
	MFnNumericAttribute nFn;
	MFnTypedAttribute tFn;
	MFnUnitAttribute uFn;

	m_iaWorldGeometry = gFn.create( "worldGeometry", "wgeo" );
	gFn.setHidden( true );
	gFn.setStorable( false );
	gFn.addAccept( MFnData::kMesh );
	gFn.addAccept( MFnData::kNurbsCurve );
	gFn.addAccept( MFnData::kNurbsSurface );

	m_iaType = eFn.create( "type", "typ", kMeshFace );
	eFn.addField( "meshFace", kMeshFace );

	m_iaInt = nFn.create( "int", "i", MFnNumericData::kInt );

	m_iaFloat0 = nFn.create( "float0", "f0", MFnNumericData::kDouble );

	m_iaFloat1 = nFn.create( "float1", "f1", MFnNumericData::kDouble );

    m_iaOffsetMatrix = mFn.create( "offsetMatrix", "omat" );

    m_iaInverseParentSpace = mFn.create( "inverseParentSpace", "ips" );

	m_iaRotateOrder = eFn.create( "rotateOrder", "ro", 0 );
	eFn.addField( "xyz", 0 );
	eFn.addField( "yzx", 1 );
	eFn.addField( "zxy", 2 );
	eFn.addField( "xzy", 3 );
	eFn.addField( "yxz", 4 );
	eFn.addField( "zyx", 5 );

	m_iaWeldInput = cFn.create( "weldInput", "wi" );
	cFn.setArray( true );
	cFn.addChild( m_iaType );
	cFn.addChild( m_iaInt );
	cFn.addChild( m_iaFloat0 );
	cFn.addChild( m_iaFloat1 );
	cFn.addChild( m_iaOffsetMatrix );
	cFn.addChild( m_iaInverseParentSpace );
	cFn.addChild( m_iaRotateOrder );

	m_oaTranslateX = uFn.create( "translateX", "tx", MFnUnitAttribute::kDistance );
	m_oaTranslateY = uFn.create( "translateY", "ty", MFnUnitAttribute::kDistance );
	m_oaTranslateZ = uFn.create( "translateZ", "tz", MFnUnitAttribute::kDistance );
	m_oaTranslate = nFn.create( "translate", "t", m_oaTranslateX, m_oaTranslateY, m_oaTranslateZ );

	m_oaRotateX = uFn.create( "rotateX", "rx", MFnUnitAttribute::kAngle );
	m_oaRotateY = uFn.create( "rotateY", "ry", MFnUnitAttribute::kAngle );
	m_oaRotateZ = uFn.create( "rotateZ", "rz", MFnUnitAttribute::kAngle );
	m_oaRotate = nFn.create( "rotate", "r", m_oaRotateX, m_oaRotateY, m_oaRotateZ );

	m_oaWeldOutput = cFn.create( "weldOutput", "wo" );
	cFn.setArray( true );
	cFn.addChild( m_oaTranslate );
	cFn.addChild( m_oaRotate );
	cFn.setUsesArrayDataBuilder( true );

	addAttribute( m_iaWorldGeometry );
	addAttribute( m_iaWeldInput );
	addAttribute( m_oaWeldOutput );

	attributeAffects( m_iaWorldGeometry, m_oaWeldOutput );
	attributeAffects( m_iaWeldInput, m_oaWeldOutput );

	return MS::kSuccess;
}
MStatus sgHair_controlJoint::initialize()
{
	MStatus status;

	MFnTypedAttribute tAttr;
	MFnMatrixAttribute mAttr;
	MFnMessageAttribute msgAttr;
	MFnNumericAttribute nAttr;
	MFnUnitAttribute uAttr;
	MFnCompoundAttribute cAttr;

	aInputBaseCurve = tAttr.create( "inputBaseCurve", "inputBaseCurve", MFnData::kNurbsCurve );
	tAttr.setStorable( true );
	CHECK_MSTATUS_AND_RETURN_IT( addAttribute( aInputBaseCurve ) );

	aInputBaseCurveMatrix = mAttr.create( "inputBaseCurveMatrix", "inputBaseCurveMatrix" );
	mAttr.setStorable( true );
	CHECK_MSTATUS_AND_RETURN_IT( addAttribute( aInputBaseCurveMatrix ) );

	aJointParentBaseMatrix = mAttr.create( "jointParentBaseMatrix", "jointParentBaseMatrix" );
	mAttr.setStorable( true );
	CHECK_MSTATUS_AND_RETURN_IT( addAttribute( aJointParentBaseMatrix ) );

	aGravityParam  = nAttr.create( "gravityParam", "gravityParam", MFnNumericData::kDouble, 0.0 );
	nAttr.setMin( 0.0 );
	nAttr.setStorable( true );
	CHECK_MSTATUS_AND_RETURN_IT( addAttribute( aGravityParam ) );
	aGravityRange  = nAttr.create( "gravityRange", "gravityRange", MFnNumericData::kDouble, 0.0 );
	nAttr.setMin( 0.0 );
	nAttr.setStorable( true );
	CHECK_MSTATUS_AND_RETURN_IT( addAttribute( aGravityRange ) );
	aGravityWeight  = nAttr.create( "gravityWeight", "gravityWeight", MFnNumericData::kDouble, 0.0 );
	nAttr.setMin( 0.0 );
	nAttr.setMax( 1.0 );
	nAttr.setStorable( true );
	CHECK_MSTATUS_AND_RETURN_IT( addAttribute( aGravityWeight ) );
	aGravityOffsetMatrix = mAttr.create( "gravityOffsetMatrix", "gravityOffsetMatrix" );
	mAttr.setStorable( true );
	CHECK_MSTATUS_AND_RETURN_IT( addAttribute( aGravityOffsetMatrix ) );

	aStaticRotation = nAttr.create( "staticRotation", "staticRotation", MFnNumericData::kBoolean, false );
	nAttr.setStorable( true );
	CHECK_MSTATUS_AND_RETURN_IT( addAttribute( aStaticRotation ) );

	aOutput  = cAttr.create( "output", "output" );

	aOutTransX = nAttr.create( "outTransX", "otx", MFnNumericData::kDouble );
	aOutTransY = nAttr.create( "outTransY", "oty", MFnNumericData::kDouble );
	aOutTransZ = nAttr.create( "outTransZ", "otz", MFnNumericData::kDouble );
	aOutTrans  = nAttr.create( "outTrans", "ot", aOutTransX, aOutTransY, aOutTransZ );

	aOutOrientX = uAttr.create( "outRotateX", "orx", MFnUnitAttribute::kAngle, 0.0 );
	aOutOrientY = uAttr.create( "outRotateY", "ory", MFnUnitAttribute::kAngle, 0.0 );
	aOutOrientZ = uAttr.create( "outRotateZ", "orz", MFnUnitAttribute::kAngle, 0.0 );
	aOutOrient  = nAttr.create( "outRotate", "outRotate", aOutOrientX, aOutOrientY, aOutOrientZ );

	cAttr.addChild( aOutTrans );
	cAttr.addChild( aOutOrient );
	cAttr.setStorable( false );
	cAttr.setArray( true );
	cAttr.setUsesArrayDataBuilder( true );
	CHECK_MSTATUS_AND_RETURN_IT( addAttribute( aOutput ) );

	CHECK_MSTATUS_AND_RETURN_IT( attributeAffects( aGravityParam,  aOutput ) );
	CHECK_MSTATUS_AND_RETURN_IT( attributeAffects( aGravityRange,  aOutput ) );
	CHECK_MSTATUS_AND_RETURN_IT( attributeAffects( aGravityWeight, aOutput ) );
	CHECK_MSTATUS_AND_RETURN_IT( attributeAffects( aJointParentBaseMatrix, aOutput ) );
	CHECK_MSTATUS_AND_RETURN_IT( attributeAffects( aGravityOffsetMatrix, aOutput ) );
	CHECK_MSTATUS_AND_RETURN_IT( attributeAffects( aInputBaseCurve, aOutput ) );
	CHECK_MSTATUS_AND_RETURN_IT( attributeAffects( aInputBaseCurveMatrix, aOutput ) );
	CHECK_MSTATUS_AND_RETURN_IT( attributeAffects( aStaticRotation, aOutput ) );

	return MS::kSuccess;
}
Exemple #15
0
MStatus MG_nurbsRivet::initialize()
	{ 

		//This is the nurbs input attribute
		MFnTypedAttribute typedFn;
		MFnCompoundAttribute compund;
		MFnNumericAttribute numFn;
		MFnMatrixAttribute    matrixFn;

		inputNurbSurface  = typedFn.create("inputNurbSurface","in",MFnData::kNurbsSurface);
		typedFn.setStorable(true);
		addAttribute(inputNurbSurface);
		

		//This is the input point   attribute
		
		
		inputPointX = numFn.create("inputPointX","ipx",MFnNumericData::kDouble,0);
		numFn.setStorable(true);
		numFn.setKeyable(true);
		addAttribute(inputPointX);

		inputPointY = numFn.create("inputPointY","ipy",MFnNumericData::kDouble,0);
		numFn.setStorable(true);
		numFn.setKeyable(true);
		addAttribute(inputPointY);
		

		inputPointZ = numFn.create("inputPointZ","ipz",MFnNumericData::kDouble,0);
		numFn.setStorable(true);
		numFn.setKeyable(true);
		addAttribute(inputPointZ);




		
		inputPoint= compund.create("inputPoint","ip");
		compund.addChild(inputPointX);
		compund.addChild(inputPointY);
		compund.addChild(inputPointZ);
		addAttribute(inputPoint);
	

		//This is the recompute point checkbox
	
		recompute = numFn.create("recompute","r",MFnNumericData::kBoolean,1);
		numFn.setKeyable(true);
		numFn.setStorable(true);
		addAttribute(recompute);

		//This is U attribute
	
		uValue = numFn.create("uValue","u",MFnNumericData::kFloat , 0);
		numFn.setKeyable(true);
		numFn.setStorable(true);
		addAttribute(uValue);


		//This is V attribute
	
		vValue = numFn.create("vValue","v",MFnNumericData::kFloat , 0 );
		numFn.setKeyable(true);
		numFn.setStorable(true);
		addAttribute(vValue);



		//This is the output translate attribute 

		outputX = numFn.create("outputTranslateX","otx",MFnNumericData::kDouble,0);
		numFn.setStorable(true);
		numFn.setKeyable(true);
		addAttribute(outputX);

		outputY = numFn.create("outputTranslateY","oty",MFnNumericData::kDouble,0);
		numFn.setStorable(true);
		numFn.setKeyable(true);
		addAttribute(outputY);
		

		outputZ = numFn.create("outputTranslateZ","otz",MFnNumericData::kDouble,0);
		numFn.setStorable(true);
		numFn.setKeyable(true);
		addAttribute(outputZ);




		
		output= compund.create("outputTranslate","ot");
		compund.addChild(outputX);
		compund.addChild(outputY);
		compund.addChild(outputZ);
		compund.setKeyable(false);
		compund.setStorable(false);
		compund.setWritable(false);
		addAttribute(output);


		//output = numFn.createPoint("outputTranslate","ot");
		//numFn.setKeyable(false);
		//numFn.setStorable(false);
		//numFn.setWritable(false);
		//addAttribute(output);


		//This is the output rotate attribute 
		outputRotateX = numFn.create("outputRotateX","orx",MFnNumericData::kDouble,0);
		numFn.setStorable(true);
		numFn.setKeyable(true);
		addAttribute(outputRotateX);

		outputRotateY = numFn.create("outputRotateY","ory",MFnNumericData::kDouble,0);
		numFn.setStorable(true);
		numFn.setKeyable(true);
		addAttribute(outputRotateY);

		outputRotateZ = numFn.create("outputRotateZ","orz",MFnNumericData::kDouble,0);
		numFn.setStorable(true);
		numFn.setKeyable(true);
		addAttribute(outputRotateZ);


		outputRotate= compund.create("outputRotate","oro");
		compund.addChild(outputRotateX);
		compund.addChild(outputRotateY);
		compund.addChild(outputRotateZ);
		compund.setKeyable(false);
		compund.setStorable(false);
		compund.setWritable(false);
		addAttribute(outputRotate);

 
		//Those are all the matrix input 

		
		outputMatrix =matrixFn.create("outputMatrix","om");
		matrixFn.setKeyable(false);
		matrixFn.setStorable(false);
		matrixFn.setWritable(false);
		addAttribute(outputMatrix); 


		//offset matrix 

		offsetMatrix =matrixFn.create("offsetMatrix","ofm");
		MMatrix defMatrix;
		defMatrix.setToIdentity();
		matrixFn.setDefault(defMatrix);
		matrixFn.setKeyable(false);
		matrixFn.setStorable(true);
		matrixFn.setWritable(true);
		addAttribute(offsetMatrix); 

		//all the attr affects

		attributeAffects (recompute,output);
		attributeAffects (inputPoint,output);
		attributeAffects (inputNurbSurface,output);
		attributeAffects (uValue,output);
		attributeAffects (vValue,output);
		attributeAffects (offsetMatrix,output);

		attributeAffects (recompute,outputRotate);
		attributeAffects (inputPoint,outputRotate);
		attributeAffects (inputNurbSurface,outputRotate);
		attributeAffects (uValue,outputRotate);
		attributeAffects (vValue,outputRotate);
		attributeAffects (offsetMatrix,outputRotate);

		attributeAffects (recompute,outputMatrix);
		attributeAffects (inputPoint,outputMatrix);
		attributeAffects (inputNurbSurface,outputMatrix);
		attributeAffects (uValue,outputMatrix);
		attributeAffects (vValue,outputMatrix);
		attributeAffects (offsetMatrix,outputMatrix);

		return MS::kSuccess;
	}
Exemple #16
0
MStatus SargassoNode::initialize()
{
	MFnNumericAttribute nAttr;
	MStatus				status;

	MFnTypedAttribute typedAttr;
    
    MFnMatrixAttribute pimAttr;
    aconstraintParentInverseMatrix = pimAttr.create( "constraintParentInvMat", "cpim", MFnMatrixAttribute::kDouble, &status );
    pimAttr.setArray(true);	
    pimAttr.setStorable(false);	
    pimAttr.setDisconnectBehavior(MFnAttribute::kDelete);
	
    status = addAttribute(aconstraintParentInverseMatrix);
	if (!status) { status.perror("addAttribute parent inverse matrix"); return status;}
    
    MFnNumericAttribute numAttr;
    constraintTranslateX = numAttr.create( "constraintTranslateX", "ctx", MFnNumericData::kDouble, 0.0, &status );
    if(!status) {
        MGlobal::displayInfo("failed to create attrib constraintTranslateX");
        return status;
    }
    
    constraintTranslateY = numAttr.create( "constraintTranslateY", "cty", MFnNumericData::kDouble, 0.0, &status );
    if(!status) {
        MGlobal::displayInfo("failed to create attrib constraintTranslateY");
        return status;
    }
    
    constraintTranslateZ = numAttr.create( "constraintTranslateZ", "ctz", MFnNumericData::kDouble, 0.0, &status );
    if(!status) {
        MGlobal::displayInfo("failed to create attrib constraintTranslateY");
        return status;
    }
    
    MFnUnitAttribute angleAttr;
    constraintRotateX = angleAttr.create( "constraintRotateX", "crx", MFnUnitAttribute::kAngle , 0.0, &status );
    if(!status) {
        MGlobal::displayInfo("failed to create attrib constraintRotateX");
        return status;
    }
    
    constraintRotateY = angleAttr.create( "constraintRotateY", "cry", MFnUnitAttribute::kAngle , 0.0, &status );
    if(!status) {
        MGlobal::displayInfo("failed to create attrib constraintRotateY");
        return status;
    }
    
    constraintRotateZ = angleAttr.create( "constraintRotateZ", "crz", MFnUnitAttribute::kAngle , 0.0, &status );
    if(!status) {
        MGlobal::displayInfo("failed to create attrib constraintRotateY");
        return status;
    }
    
	{	// Compound target(geometry,weight): array, delete on disconnect
		MFnCompoundAttribute compoundAttr;
		compoundOutput = compoundAttr.create( "outValue", "otv",&status );
		if (!status) { status.perror("compoundAttr.create"); return status;}
        status = compoundAttr.addChild( constraintTranslateX );
		if (!status) { status.perror("compoundAttr.addChild tx"); return status;}
		status = compoundAttr.addChild( constraintTranslateY );
		if (!status) { status.perror("compoundAttr.addChild ty"); return status;}
		status = compoundAttr.addChild( constraintTranslateZ );
		if (!status) { status.perror("compoundAttr.addChild tz"); return status;}
		compoundAttr.addChild( constraintRotateX );
        compoundAttr.addChild( constraintRotateY );
        compoundAttr.addChild( constraintRotateZ );
        compoundAttr.setArray( true );
		//status = compoundAttr.setDisconnectBehavior(MFnAttribute::kDelete);
		//if (!status) { status.perror("typedAttrKeyable.setDisconnectBehavior:cgeom"); return status;}
	}

	status = addAttribute( compoundOutput );
	if (!status) { status.perror("addAttribute"); return status;}
    
	MPointArray defaultPntArray;
	MFnPointArrayData pntArrayDataFn;
	pntArrayDataFn.create( defaultPntArray );
	
	atargetRestP = typedAttr.create( "targetRestP", "tgrp", MFnData::kPointArray, pntArrayDataFn.object());
 	typedAttr.setStorable(true);
 	addAttribute(atargetRestP);
	
	MIntArray defaultIntArray;
	MFnIntArrayData intArrayDataFn;
	intArrayDataFn.create( defaultIntArray );
	
	atargetTri = typedAttr.create( "targetTriangle", "tgtri", MFnData::kIntArray, intArrayDataFn.object());
 	typedAttr.setStorable(true);
 	addAttribute(atargetTri);
	
	atargetBind = typedAttr.create( "targetBindId", "tgbdi", MFnData::kIntArray, intArrayDataFn.object());
 	typedAttr.setStorable(true);
 	addAttribute(atargetBind);
    
    aobjTri = typedAttr.create( "objectTriId", "obti", MFnData::kIntArray, intArrayDataFn.object());
 	typedAttr.setStorable(true);
 	addAttribute(aobjTri);
	
	atargetNv = numAttr.create( "targetNumV", "tgnv", MFnNumericData::kInt, 0, &status );
    addAttribute(atargetNv);
	
	atargetNt = numAttr.create( "targetNumTri", "tgnt", MFnNumericData::kInt, 0, &status );
    addAttribute(atargetNt);
	
	MVectorArray defaultVectArray;
	MFnVectorArrayData vectArrayDataFn;
	vectArrayDataFn.create( defaultVectArray );
	
	aobjLocal = typedAttr.create( "objectLocalP", "oblp", MFnData::kVectorArray, vectArrayDataFn.object());
 	typedAttr.setStorable(true);
 	addAttribute(aobjLocal);
	
	aobjN = numAttr.create( "objectCount", "obct", MFnNumericData::kInt, 0, &status );
    addAttribute(aobjN);
	
	atargetMesh = typedAttr.create("targetMesh", "tgms", MFnMeshData::kMesh, &status);
	typedAttr.setStorable(false);
	addAttribute(atargetMesh);
	
    attributeAffects(atargetMesh, compoundOutput);
    // attributeAffects(aconstraintParentInverseMatrix, compoundOutput);

	return MS::kSuccess;
}
Exemple #17
0
MStatus retargetLocator::initialize()
{
    MFnNumericAttribute nAttr;
	MFnMatrixAttribute mAttr;
	MFnEnumAttribute eAttr;
	MFnUnitAttribute uAttr;
	MFnCompoundAttribute cAttr;
	MFnTypedAttribute tAttr;
	
	aOutput = nAttr.create( "output", "output", MFnNumericData::kDouble );
	nAttr.setStorable( false );
	CHECK_MSTATUS( addAttribute( aOutput ) );

	aDiscMatrix = mAttr.create( "discMatrix", "discMatrix" );
	mAttr.setStorable( true );
	CHECK_MSTATUS( addAttribute( aDiscMatrix ) );
	CHECK_MSTATUS( attributeAffects( aDiscMatrix, aOutput ) );

	aDiscAxis = eAttr.create( "discAxis", "discAxis", 0 );
	eAttr.addField( "X", 0 );
	eAttr.addField( "Y", 1 );
	eAttr.addField( "Z", 2 );
	eAttr.setStorable( true );
	eAttr.setChannelBox( true );
	eAttr.setReadable( true );
	CHECK_MSTATUS( addAttribute( aDiscAxis ) );
	CHECK_MSTATUS( attributeAffects( aDiscAxis, aOutput ) );


	aDiscDivision = nAttr.create( "discDivision", "discDivision", MFnNumericData::kInt, 32 );
	nAttr.setMin( 1 );
	nAttr.setMax( 32 );
	nAttr.setStorable( true );
	nAttr.setChannelBox( true );
	CHECK_MSTATUS( addAttribute( aDiscDivision ) );
	CHECK_MSTATUS( attributeAffects( aDiscDivision, aOutput ) );


	aDiscAngle = uAttr.create( "discAngle", "discAngle", MFnUnitAttribute::kAngle, 0.0 );
	uAttr.setStorable( true );
	uAttr.setChannelBox( true );
	CHECK_MSTATUS( addAttribute( aDiscAngle ) );
	CHECK_MSTATUS( attributeAffects( aDiscAngle, aOutput ) );


	aDiscOffsetX = nAttr.create( "discOffsetX", "discOffsetX", MFnNumericData::kDouble, 0.0 );
	aDiscOffsetY = nAttr.create( "discOffsetY", "discOffsetY", MFnNumericData::kDouble, 0.0 );
	aDiscOffsetZ = nAttr.create( "discOffsetZ", "discOffsetZ", MFnNumericData::kDouble, 0.0 );
	aDiscOffset  = nAttr.create( "discOffset", "discOffset", aDiscOffsetX, aDiscOffsetY, aDiscOffsetZ );
	uAttr.setStorable( true );
	uAttr.setChannelBox( true );
	CHECK_MSTATUS( addAttribute( aDiscOffset ) );
	CHECK_MSTATUS( attributeAffects( aDiscOffset, aOutput ) );

	aDiscSizeX = nAttr.create( "discSizeX", "discSizeX", MFnNumericData::kDouble, 1.0 );
	aDiscSizeY = nAttr.create( "discSizeY", "discSizeY", MFnNumericData::kDouble, 1.0 );
	aDiscSizeZ = nAttr.create( "discSizeZ", "discSizeZ", MFnNumericData::kDouble, 1.0 );
	aDiscSize  = nAttr.create( "discSize", "discSize", aDiscSizeX, aDiscSizeY, aDiscSizeZ );
	uAttr.setStorable( true );
	uAttr.setChannelBox( true );
	CHECK_MSTATUS( addAttribute( aDiscSize ) );
	CHECK_MSTATUS( attributeAffects( aDiscSize, aOutput ) );


	aDiscActiveColor = nAttr.createColor( "discActiveColor", "discActiveColor" );
	nAttr.setStorable( true );
	nAttr.setUsedAsColor(true);
	nAttr.setDefault(1.0f, 1.0f, 1.0f);
	CHECK_MSTATUS( addAttribute( aDiscActiveColor ) );
	CHECK_MSTATUS( attributeAffects( aDiscActiveColor, aOutput ) );


	aDiscLeadColor = nAttr.createColor( "discLeadColor", "discLeadColor" );
	nAttr.setStorable( true );
	nAttr.setUsedAsColor(true);
	nAttr.setDefault(.263f, 1.0f, .639f);
	CHECK_MSTATUS( addAttribute( aDiscLeadColor ) );
	CHECK_MSTATUS( attributeAffects( aDiscLeadColor, aOutput ) );


	aDiscDefaultColor = nAttr.createColor( "discDefaultColor", "discDefaultColor" );
	nAttr.setStorable( true );
	nAttr.setUsedAsColor(true);
	nAttr.setDefault(.0f, .016f, .376f);
	CHECK_MSTATUS( addAttribute( aDiscDefaultColor ) );
	CHECK_MSTATUS( attributeAffects( aDiscDefaultColor, aOutput ) );

	aDiscFillAlpha = nAttr.create( "discFillAlpha", "discFillAlpha", MFnNumericData::kFloat, 0.1f );
	nAttr.setStorable( true );
	nAttr.setMin( 0.0f );
	nAttr.setMax( 1.0f );
	CHECK_MSTATUS( addAttribute( aDiscFillAlpha ) );
	CHECK_MSTATUS( attributeAffects( aDiscFillAlpha, aOutput ) );

	aDiscLineAlpha = nAttr.create( "discLineAlpha", "discLineAlpha", MFnNumericData::kFloat, 1.0f );
	nAttr.setStorable( true );
	nAttr.setMin( 0.0f );
	nAttr.setMax( 1.0f );
	CHECK_MSTATUS( addAttribute( aDiscLineAlpha ) );
	CHECK_MSTATUS( attributeAffects( aDiscLineAlpha, aOutput ) );

	aArrow = cAttr.create( "arrow", "arrow" );

	aInheritMatrix = nAttr.create( "inheritMatrix", "inheritMatrix", MFnNumericData::kBoolean, false );

	aInputMesh = tAttr.create( "inputMesh", "inputMesh", MFnData::kMesh );

	aAimMatrix = mAttr.create( "aimMatrix", "aimMatrix" );

	aStartSize = nAttr.create( "startSize", "startSize", MFnNumericData::kFloat, 0.5f );

	aSize = nAttr.create( "size", "size", MFnNumericData::kFloat, 1.0f );

	aActiveColor = nAttr.createColor( "activeColor", "activeColor" );
	nAttr.setUsedAsColor(true);
	nAttr.setDefault(1.0f, 1.0f, 1.0f);
	aLeadColor = nAttr.createColor( "leadColor", "leadColor" );
	nAttr.setUsedAsColor(true);
	nAttr.setDefault(.263f, 1.0f, .639f);
	aDefaultColor = nAttr.createColor( "defaultColor", "defaultColor" );
	nAttr.setUsedAsColor(true);
	nAttr.setDefault(.0f, .016f, .376f);

	aFillAlpha = nAttr.create( "fillAlpha", "fillAlpha", MFnNumericData::kFloat, 0.1f );
	aLineAlpha = nAttr.create( "lineAlpha", "lineAlpha", MFnNumericData::kFloat, 1.0f );

	aOffsetX = nAttr.create( "offsetX", "offsetX", MFnNumericData::kDouble, 0.0 );
	aOffsetY = nAttr.create( "offsetY", "offsetY", MFnNumericData::kDouble, 0.0 );
	aOffsetZ = nAttr.create( "offsetZ", "offsetZ", MFnNumericData::kDouble, 0.0 );
	aOffset = nAttr.create( "offset", "offset", aOffsetX, aOffsetY, aOffsetZ );

	cAttr.addChild( aInheritMatrix );
	cAttr.addChild( aAimMatrix );
	cAttr.addChild( aInputMesh );
	cAttr.addChild( aStartSize );
	cAttr.addChild( aSize );
	cAttr.addChild( aActiveColor );
	cAttr.addChild( aLeadColor );
	cAttr.addChild( aDefaultColor );
	cAttr.addChild( aFillAlpha );
	cAttr.addChild( aLineAlpha );
	cAttr.addChild( aOffset );
	cAttr.setArray( true );
	cAttr.setStorable( true );
	CHECK_MSTATUS( addAttribute( aArrow ) );
	CHECK_MSTATUS( attributeAffects( aArrow, aOutput ) );

	return MS::kSuccess;
}
MStatus geometrySurfaceConstraint::initialize()
{
	MFnNumericAttribute nAttr;
	MStatus				status;

	// constraint attributes

	{	// Geometry: mesh, readable, not writable, delete on disconnect
		MFnTypedAttribute typedAttrNotWritable;
		geometrySurfaceConstraint::constraintGeometry =
			typedAttrNotWritable.create( "constraintGeometry", "cg", MFnData::kMesh, &status ); 	
		if (!status) { status.perror("typedAttrNotWritable.create:cgeom"); return status;}
		status = typedAttrNotWritable.setReadable(true);
		if (!status) { status.perror("typedAttrNotWritable.setReadable:cgeom"); return status;}
		status = typedAttrNotWritable.setWritable(false);
		if (!status) { status.perror("typedAttrNotWritable.setWritable:cgeom"); return status;}
		status = typedAttrNotWritable.setDisconnectBehavior(MFnAttribute::kDelete);
		if (!status) { status.perror("typedAttrNotWritable.setDisconnectBehavior:cgeom"); return status;}
	}
	{	// Parent inverse matrix: delete on disconnect
		MFnTypedAttribute typedAttr;
		geometrySurfaceConstraint::constraintParentInverseMatrix =
			typedAttr.create( "constraintPim", "ci", MFnData::kMatrix, &status ); 	
		if (!status) { status.perror("typedAttr.create:matrix"); return status;}
		status = typedAttr.setDisconnectBehavior(MFnAttribute::kDelete);
		if (!status) { status.perror("typedAttr.setDisconnectBehavior:cgeom"); return status;}

		// Target geometry: mesh, delete on disconnect
		geometrySurfaceConstraint::targetGeometry =
			typedAttr.create( "targetGeometry", "tg", MFnData::kMesh, &status ); 	
		if (!status) { status.perror("typedAttr.create:tgeom"); return status;}
		status = typedAttr.setDisconnectBehavior(MFnAttribute::kDelete);
		if (!status) { status.perror("typedAttr.setDisconnectBehavior:cgeom"); return status;}
	}
	{	// Target weight: double, min 0, default 1.0, keyable, delete on disconnect
		MFnNumericAttribute typedAttrKeyable;
		geometrySurfaceConstraint::targetWeight 
			= typedAttrKeyable.create( "weight", "wt", MFnNumericData::kDouble, 1.0, &status );
		if (!status) { status.perror("typedAttrKeyable.create:weight"); return status;}
		status = typedAttrKeyable.setMin( (double) 0 );
		if (!status) { status.perror("typedAttrKeyable.setMin"); return status;}
		status = typedAttrKeyable.setKeyable( true );
		if (!status) { status.perror("typedAttrKeyable.setKeyable"); return status;}
		status = typedAttrKeyable.setDisconnectBehavior(MFnAttribute::kDelete);
		if (!status) { status.perror("typedAttrKeyable.setDisconnectBehavior:cgeom"); return status;}
	}
	{	// Compound target(geometry,weight): array, delete on disconnect
		MFnCompoundAttribute compoundAttr;
		geometrySurfaceConstraint::compoundTarget = 
			compoundAttr.create( "target", "tgt",&status );
		if (!status) { status.perror("compoundAttr.create"); return status;}
		status = compoundAttr.addChild( geometrySurfaceConstraint::targetGeometry );
		if (!status) { status.perror("compoundAttr.addChild"); return status;}
		status = compoundAttr.addChild( geometrySurfaceConstraint::targetWeight );
		if (!status) { status.perror("compoundAttr.addChild"); return status;}
		status = compoundAttr.setArray( true );
		if (!status) { status.perror("compoundAttr.setArray"); return status;}
		status = compoundAttr.setDisconnectBehavior(MFnAttribute::kDelete);
		if (!status) { status.perror("typedAttrKeyable.setDisconnectBehavior:cgeom"); return status;}
	}

	status = addAttribute( geometrySurfaceConstraint::constraintParentInverseMatrix );
	if (!status) { status.perror("addAttribute"); return status;}
	status = addAttribute( geometrySurfaceConstraint::constraintGeometry );
	if (!status) { status.perror("addAttribute"); return status;}
	status = addAttribute( geometrySurfaceConstraint::compoundTarget );
	if (!status) { status.perror("addAttribute"); return status;}

	status = attributeAffects( compoundTarget, constraintGeometry );
	if (!status) { status.perror("attributeAffects"); return status;}
	status = attributeAffects( targetGeometry, constraintGeometry );
	if (!status) { status.perror("attributeAffects"); return status;}
	status = attributeAffects( targetWeight, constraintGeometry );
	if (!status) { status.perror("attributeAffects"); return status;}
	status = attributeAffects( constraintParentInverseMatrix, constraintGeometry );
	if (!status) { status.perror("attributeAffects"); return status;}

	return MS::kSuccess;
}
Exemple #19
0
MStatus MG_vectorGL::initialize()
{ 
  
  //Declaring all the needed attribute function sets
  MFnEnumAttribute enumFn;
  MFnMatrixAttribute matrixFn;
  MFnNumericAttribute numFn;
  MFnCompoundAttribute compA;
  
  
  drawIt =numFn.create("drawIt","drw",MFnNumericData::kBoolean,1);
  numFn.setKeyable(true);
  numFn.setStorable(true);
  addAttribute(drawIt);
  
  arrowSize =numFn.create("arrowSize","as",MFnNumericData::kDouble,1);
  numFn.setKeyable(true);
  numFn.setStorable(true);
  addAttribute(arrowSize);
  
  
  fakeOut =numFn.create("fakeOut","fo",MFnNumericData::kBoolean,1);
  numFn.setKeyable(true);
  numFn.setStorable(true);
  addAttribute(fakeOut);
    
  
  
  upVecX =numFn.create("upVecX","uvx",MFnNumericData::kDouble,0);

  numFn.setStorable(true);
  addAttribute(upVecX);

  upVecY =numFn.create("upVecY","uvy",MFnNumericData::kDouble,1);

  numFn.setStorable(true);
  addAttribute(upVecY);


  upVecZ =numFn.create("upVecZ","uvz",MFnNumericData::kDouble,0);

  numFn.setStorable(true);
  addAttribute(upVecZ);

  upVec= compA.create("upVec","uv" );
  compA.addChild(upVecX);
  compA.addChild(upVecY);
  compA.addChild(upVecZ);

  addAttribute(upVec);
  
  vecX =numFn.create("vecX","vx",MFnNumericData::kDouble,0);

  numFn.setStorable(true);
  addAttribute(vecX);

  vecY =numFn.create("vecY","vy",MFnNumericData::kDouble,1);

  numFn.setStorable(true);
  addAttribute(vecY);


  vecZ =numFn.create("vecZ","vz",MFnNumericData::kDouble,0);

  numFn.setStorable(true);
  addAttribute(vecZ);

  vecs= compA.create("vecs","vs" );
  compA.addChild(vecX);
  compA.addChild(vecY);
  compA.addChild(vecZ);
  compA.setArray(true);

  addAttribute(vecs);  
  
  
  startPointX =numFn.create("startPointX","spx",MFnNumericData::kDouble,0);

  numFn.setStorable(true);
  addAttribute(startPointX);

  startPointY =numFn.create("startPointY","spy",MFnNumericData::kDouble,0);

  numFn.setStorable(true);
  addAttribute(startPointY);


  startPointZ =numFn.create("startPointZ","spz",MFnNumericData::kDouble,0);

  numFn.setStorable(true);
  addAttribute(startPointZ);

  startPoint= compA.create("startPoints","sp" );
  compA.addChild(startPointX);
  compA.addChild(startPointY);
  compA.addChild(startPointZ);
  compA.setArray(true);

  addAttribute(startPoint); 
  
  
  attributeAffects(arrowSize , fakeOut);
  attributeAffects(startPoint , fakeOut);
  attributeAffects(upVec , fakeOut);
  attributeAffects(drawIt , fakeOut);
  attributeAffects(vecs , fakeOut);
  
  return MS::kSuccess;
	

}
Exemple #20
0
MStatus MG_softIk::initialize()
	{ 		
	  
	  //This is the nurbs input attribute
	  MFnTypedAttribute typedFn;
	  MFnCompoundAttribute compund;
	  MFnNumericAttribute numFn;
	  MFnMatrixAttribute    matrixFn;
	  
	  
	  
	  startMatrix =matrixFn.create("startMatrix","stm");
	  addAttribute(startMatrix); 
		
	  endMatrix =matrixFn.create("endMatrix","enm");
	  addAttribute(endMatrix); 
	  
	  
	  upInitLength = numFn.create("upInitLength","uil",MFnNumericData::kDouble,0);
	  numFn.setStorable(true);
	  numFn.setKeyable(true);
	  addAttribute(upInitLength);
	  

	  
	  
	  downInitLength = numFn.create("downInitLength","dil",MFnNumericData::kDouble,0);
	  numFn.setStorable(true);
	  numFn.setKeyable(true);
	  addAttribute(downInitLength);
	  

	  globalScale = numFn.create("globalScale","gb",MFnNumericData::kDouble,0);
	  numFn.setStorable(true);
	  numFn.setKeyable(true);
	  numFn.setMin(0.001);
	  addAttribute(globalScale);

	  softDistance = numFn.create("softDistance","sd",MFnNumericData::kDouble,0);
	  numFn.setMin(0.001);
	  numFn.setStorable(true);
	  numFn.setKeyable(true);
	  addAttribute(softDistance);

	  stretch = numFn.create("stretch","str",MFnNumericData::kDouble,0);
	  numFn.setMin(0.0);
	  numFn.setMax(1.0);
	  numFn.setStorable(true);
	  numFn.setKeyable(true);
	  addAttribute(stretch);
	  
	  slide = numFn.create("slide","sld",MFnNumericData::kDouble,0.5);
	  numFn.setMin(0.0);
	  numFn.setMax(1.0);
	  numFn.setStorable(true);
	  numFn.setKeyable(true);
	  addAttribute(slide);
	  
	  upScale = numFn.create("upScale","ups",MFnNumericData::kDouble,1);
	  numFn.setStorable(false);
	  numFn.setKeyable(false);
	  numFn.setWritable(false);
	  addAttribute(upScale);
	  
	  

	  
	  downScale = numFn.create("downScale","dws",MFnNumericData::kDouble,1);
	  numFn.setStorable(false);
	  numFn.setKeyable(false);
	  numFn.setWritable(false);
	  addAttribute(downScale);
	
	  
	  outputTranslateX = numFn.create("outputTranslateX","otx",MFnNumericData::kDouble,0);
	  numFn.setStorable(false);
	  numFn.setKeyable(false);
	  numFn.setWritable(false);
	  addAttribute(outputTranslateX);

	  outputTranslateY = numFn.create("outputTranslateY","oty",MFnNumericData::kDouble,0);
	  numFn.setStorable(false);
	  numFn.setWritable(false);
	  numFn.setKeyable(false);
	  addAttribute(outputTranslateY);
	  

	  outputTranslateZ = numFn.create("outputTranslateZ","otz",MFnNumericData::kDouble,0);
	  numFn.setStorable(false);
	  numFn.setKeyable(false);
	  numFn.setWritable(false);
	  addAttribute(outputTranslateZ);

	  
	  outputTranslate= compund.create("outputTranslate","ot");
	  compund.addChild(outputTranslateX);
	  compund.addChild(outputTranslateY); 
	  compund.addChild(outputTranslateZ);
	  compund.setStorable(false);
	  compund.setKeyable(false);
	  compund.setWritable(false);
	  addAttribute(outputTranslate);
	  
	  
	  attributeAffects( startMatrix ,outputTranslate) ;
	  attributeAffects( endMatrix ,outputTranslate) ;
	  attributeAffects( softDistance ,outputTranslate) ;
	  attributeAffects( stretch ,outputTranslate) ;
	  attributeAffects( slide ,outputTranslate) ;
	  attributeAffects( globalScale ,outputTranslate) ;
	  
	  attributeAffects( startMatrix ,upScale) ;
	  attributeAffects( endMatrix ,upScale) ;
	  attributeAffects( stretch ,upScale) ;
	  attributeAffects( softDistance ,upScale) ;
	  attributeAffects( slide ,upScale) ;
	  attributeAffects( globalScale ,upScale) ;

	  attributeAffects( startMatrix ,downScale) ;
	  attributeAffects( endMatrix ,downScale) ;
	  attributeAffects( softDistance ,downScale) ;
	  attributeAffects( stretch ,downScale) ;
	  attributeAffects( slide ,downScale) ;
	  attributeAffects( globalScale ,downScale) ;

 	  return MS::kSuccess;
	}
Exemple #21
0
MStatus MG_dotProduct::initialize(){

//Input vector 1

		MFnNumericAttribute numericAttrFn;
		vector1 = numericAttrFn.createPoint("vector1","v1");
		addAttribute(vector1);
		numericAttrFn.setStorable(true);
 
		//Input vector 2

		vector2 = numericAttrFn.createPoint("vector2","v2");
		addAttribute(vector2);
		numericAttrFn.setStorable(true);


		//Projection axis attributes ,needs to be created as compound in order to set a default value 
		// X axis

		projAxisXa = numericAttrFn.create("xAxisProjectionX","xPrjx",MFnNumericData::kFloat,1);
		addAttribute(projAxisXa);
		numericAttrFn.setStorable(true);


		projAxisXb = numericAttrFn.create("xAxisProjectionY","xPrjy",MFnNumericData::kFloat,0);
		addAttribute(projAxisXa);
		numericAttrFn.setStorable(true);

		projAxisXc = numericAttrFn.create("xAxisProjectionZ","xPrjz",MFnNumericData::kFloat,0);
		addAttribute(projAxisXa);
		numericAttrFn.setStorable(true);



		MFnCompoundAttribute compund;
		projAxisX= compund.create("xAxisProjection","xproj");
		compund.addChild(projAxisXa);
		compund.addChild(projAxisXb);
		compund.addChild(projAxisXc);
		addAttribute(projAxisX);

		// Y axis

		projAxisYa = numericAttrFn.create("yAxisProjectionX","yPrjx",MFnNumericData::kFloat,0);
		addAttribute(projAxisYa);
		numericAttrFn.setStorable(true);


		projAxisYb = numericAttrFn.create("yAxisProjectionY","yPrjy",MFnNumericData::kFloat,1);
		addAttribute(projAxisYb);
		numericAttrFn.setStorable(true);

		projAxisYc = numericAttrFn.create("yAxisProjectionZ","yPrjz",MFnNumericData::kFloat,0);
		addAttribute(projAxisYc);
		numericAttrFn.setStorable(true);




		projAxisY= compund.create("yAxisProjection","yproj");
		compund.addChild(projAxisYa);
		compund.addChild(projAxisYb);
		compund.addChild(projAxisYc);
		addAttribute(projAxisY);

		// Z axis

		projAxisZa = numericAttrFn.create("zAxisProjectionX","zPrjx",MFnNumericData::kFloat,0);
		addAttribute(projAxisZa);
		numericAttrFn.setStorable(true);


		projAxisZb = numericAttrFn.create("zAxisProjectionY","zPrjy",MFnNumericData::kFloat,0);
		addAttribute(projAxisZb);
		numericAttrFn.setStorable(true);

		projAxisZc = numericAttrFn.create("zAxisProjectionZ","zPrjz",MFnNumericData::kFloat,1);
		addAttribute(projAxisZc);
		numericAttrFn.setStorable(true);




		projAxisZ= compund.create("zAxisProjection","zproj");
		compund.addChild(projAxisZa);
		compund.addChild(projAxisZb);
		compund.addChild(projAxisZc);
		addAttribute(projAxisZ);



		//normalize attribute 

		
		normalize=numericAttrFn.create("normalize","n",MFnNumericData::kBoolean );
		addAttribute(normalize);
		numericAttrFn.setStorable(true);


		//Output attribute that will hold the dot product value 

		dotProductA = numericAttrFn.create("dotProduct","dp",MFnNumericData::kFloat);
		addAttribute(dotProductA);
		numericAttrFn.setWritable(false);
		numericAttrFn.setStorable(false);

		//dot product max value

		dotProductMax = numericAttrFn.create("dotProductMaxValue","dpm",MFnNumericData::kFloat);
		addAttribute(dotProductMax);
		numericAttrFn.setWritable(false);
		numericAttrFn.setStorable(false);

		//Input vector1 projection on vector 2


		proj1on2 = numericAttrFn.createPoint("projectionV1onV2","pV1");
		addAttribute(proj1on2);
		numericAttrFn.setWritable(false);
		numericAttrFn.setStorable(false);


		//Input vector2 projection on vector 1


		proj2on1 = numericAttrFn.createPoint("projectionV2onV1","pV2");
		addAttribute(proj2on1);
		numericAttrFn.setWritable(false);
		numericAttrFn.setStorable(false);


		//angle inbetween

		angleInBetweenAttr = numericAttrFn.create("angleInBetween","aib",MFnNumericData::kFloat);
		addAttribute(angleInBetweenAttr);
		numericAttrFn.setWritable(false);
		numericAttrFn.setStorable(false);

		
		//Output attribute that will hold Xvalue of the angle inbetween
		angleX = numericAttrFn.create("angleX","ax",MFnNumericData::kFloat);
		addAttribute(angleX);
		numericAttrFn.setWritable(false);
		numericAttrFn.setStorable(false);

		//Output attribute that will hold Xvalue of the angle inbetween
		angleY = numericAttrFn.create("angleY","ay",MFnNumericData::kFloat);
		addAttribute(angleY);
		numericAttrFn.setWritable(false);
		numericAttrFn.setStorable(false);

		//Output attribute that will hold Xvalue of the angle inbetween
		angleZ = numericAttrFn.create("angleZ","az",MFnNumericData::kFloat);
		addAttribute(angleZ);
		numericAttrFn.setWritable(false);
		numericAttrFn.setStorable(false);
		

		//setting attribute affects
		attributeAffects(vector1,dotProductA);
		attributeAffects(vector2,dotProductA);
		attributeAffects(normalize,dotProductA);

		attributeAffects(vector1,dotProductMax);
		attributeAffects(vector2,dotProductMax);
		attributeAffects(normalize,dotProductMax);

		attributeAffects(vector1,proj1on2);
		attributeAffects(vector2,proj1on2);

		attributeAffects(vector1,proj2on1);
		attributeAffects(vector2,proj2on1);

		attributeAffects(vector1,angleInBetweenAttr);
		attributeAffects(vector2,angleInBetweenAttr);

		attributeAffects(vector1,angleX);
		attributeAffects(vector2,angleX);

		attributeAffects(vector1,angleY);
		attributeAffects(vector2,angleY);

		attributeAffects(vector1,angleZ);
		attributeAffects(vector2,angleZ);

		attributeAffects(projAxisXa,angleX);
		attributeAffects(projAxisXb,angleX);
		attributeAffects(projAxisXc,angleX);
		attributeAffects(projAxisYa,angleX);
		attributeAffects(projAxisYb,angleX);
		attributeAffects(projAxisYc,angleX);
		attributeAffects(projAxisZa,angleX);
		attributeAffects(projAxisZb,angleX);
		attributeAffects(projAxisZc,angleX);

		attributeAffects(projAxisXa,angleY);
		attributeAffects(projAxisXb,angleY);
		attributeAffects(projAxisXc,angleY);
		attributeAffects(projAxisYa,angleY);
		attributeAffects(projAxisYb,angleY);
		attributeAffects(projAxisYc,angleY);
		attributeAffects(projAxisZa,angleY);
		attributeAffects(projAxisZb,angleY);
		attributeAffects(projAxisZc,angleY);

		attributeAffects(projAxisXb,angleZ);
		attributeAffects(projAxisXc,angleZ);
		attributeAffects(projAxisYa,angleZ);
		attributeAffects(projAxisYb,angleZ);
		attributeAffects(projAxisYc,angleZ);
		attributeAffects(projAxisZa,angleZ);
		attributeAffects(projAxisZb,angleZ);
		attributeAffects(projAxisZc,angleZ);


		return MS::kSuccess;
	}