Exemple #1
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;
}
Exemple #2
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;
}
Exemple #3
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;
}
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;
}
Exemple #5
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;}
    
    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;
}
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 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 #9
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;
	

}
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;
}
//-----------------------------------------------------------------------------
//
//-----------------------------------------------------------------------------
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;
}
Exemple #12
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;
}