コード例 #1
0
MStatus nailConstraintNode::initialize()
{
    MStatus status;
    MFnMessageAttribute fnMsgAttr;
    MFnNumericAttribute fnNumericAttr;
    MFnMatrixAttribute fnMatrixAttr;

    ia_rigidBody = fnMsgAttr.create("inRigidBody", "inrb", &status);
    MCHECKSTATUS(status, "creating inRigidBody attribute")
    status = addAttribute(ia_rigidBody);
    MCHECKSTATUS(status, "adding inRigidBody attribute")

    ia_damping = fnNumericAttr.create("damping", "dmp", MFnNumericData::kDouble, 1.0, &status);
    MCHECKSTATUS(status, "creating damping attribute")
    fnNumericAttr.setKeyable(true);
    status = addAttribute(ia_damping);
    MCHECKSTATUS(status, "adding damping attribute")

    ca_constraint = fnNumericAttr.create("ca_constraint", "caco", MFnNumericData::kBoolean, 0, &status);
    MCHECKSTATUS(status, "creating ca_constraint attribute")
    fnNumericAttr.setConnectable(false);
    fnNumericAttr.setHidden(true);
    fnNumericAttr.setStorable(false);
    fnNumericAttr.setKeyable(false);
    status = addAttribute(ca_constraint);
    MCHECKSTATUS(status, "adding ca_constraint attribute")

    ca_constraintParam = fnNumericAttr.create("ca_constraintParam", "cacop", MFnNumericData::kBoolean, 0, &status);
    MCHECKSTATUS(status, "creating ca_constraintParam attribute")
    fnNumericAttr.setConnectable(false);
    fnNumericAttr.setHidden(true);
    fnNumericAttr.setStorable(false);
    fnNumericAttr.setKeyable(false);
    status = addAttribute(ca_constraintParam);
    MCHECKSTATUS(status, "adding ca_constraintParam attribute")


    status = attributeAffects(ia_rigidBody, ca_constraint);
    MCHECKSTATUS(status, "adding attributeAffects(ia_rigidBody, ca_constraint)")

    status = attributeAffects(ia_rigidBody, ca_constraintParam);
    MCHECKSTATUS(status, "adding attributeAffects(ia_rigidBody, ca_constraintParam)")

    status = attributeAffects(ia_damping, ca_constraintParam);
    MCHECKSTATUS(status, "adding attributeAffects(ia_damping, ca_constraintParam)")

    return MS::kSuccess;
}
コード例 #2
0
ファイル: zsoftIkSolver.cpp プロジェクト: ahmidou/aphid
MStatus ik2Bsolver::initialize()
{ 
    MFnNumericAttribute numattr;
	
	arestLength1 = numattr.create("restLength1", "rsl1", MFnNumericData::kDouble, 16.0);
	numattr.setMin(1.0);
	numattr.setKeyable(true); 
	numattr.setReadable(true);
	numattr.setConnectable(true);
	addAttribute(arestLength1);
	
	arestLength2 = numattr.create("restLength2", "rsl2", MFnNumericData::kDouble, 16.0);
	numattr.setMin(1.0);
	numattr.setKeyable(true); 
	numattr.setReadable(true);
	numattr.setConnectable(true);
	addAttribute(arestLength2);
	
	asoftDistance = numattr.create("softDistance", "sftd", MFnNumericData::kDouble, 1.0);
	numattr.setMin(0.01);
	numattr.setKeyable(true); 
	numattr.setReadable(true);
	numattr.setConnectable(true);
	numattr.setStorable(true);
	addAttribute(asoftDistance);
	
	amaxStretching = numattr.create("maxStretching", "mstc", MFnNumericData::kDouble, 4.0);
	numattr.setMin(0.0);
	numattr.setKeyable(true); 
	numattr.setReadable(true);
	numattr.setConnectable(true);
	numattr.setStorable(true);
	addAttribute(amaxStretching);
	
	attributeAffects(asoftDistance, ik2Bsolver::message);
	
	return MS::kSuccess;
}
コード例 #3
0
MStatus ParameterisedHolder<B>::initialize()
{
	MStatus s;
	MFnTypedAttribute tAttr;
	MFnNumericAttribute nAttr;

	aParameterisedClassName = tAttr.create( "className", "clas", MFnData::kString );
	tAttr.setReadable(true);
	tAttr.setWritable(true);
	tAttr.setStorable(true);
	tAttr.setConnectable(false);
	tAttr.setHidden(true);

	s = B::addAttribute( aParameterisedClassName );
	assert(s);

	aParameterisedVersion = nAttr.create("version", "ver", MFnNumericData::kInt, 1, &s );
	assert(s);
	nAttr.setReadable(true);
	nAttr.setWritable(true);
	nAttr.setStorable(true);
	nAttr.setConnectable(false);
	nAttr.setHidden(true);


	s = B::addAttribute( aParameterisedVersion );
	assert(s);

	aParameterisedSearchPathEnvVar = tAttr.create("searchPathEnvVar", "spev", MFnData::kString );
	tAttr.setReadable(true);
	tAttr.setWritable(true);
	tAttr.setStorable(true);
	tAttr.setConnectable(false);
	tAttr.setHidden(true);

	s = B::addAttribute( aParameterisedSearchPathEnvVar );
	assert(s);
	
	MPxManipContainer::addToManipConnectTable( id );

	return MS::kSuccess;
}
コード例 #4
0
ファイル: ProxyVizNode.cpp プロジェクト: spinos/aphid
MStatus ProxyViz::initialize()
{ 
	MFnNumericAttribute numFn;
	MStatus			 stat;
	
	alodgatehigh = numFn.create( "lodGateMax", "ldmx", MFnNumericData::kFloat, 1.f);
	numFn.setKeyable(true);
	numFn.setStorable(true);
	numFn.setMin(0.001f);
	numFn.setMax(2.f);
	addAttribute(alodgatehigh);
	
	alodgatelow = numFn.create( "lodGateMin", "ldmin", MFnNumericData::kFloat, 0.f);
	numFn.setKeyable(true);
	numFn.setStorable(true);
	numFn.setMin(0.f);
	numFn.setMax(0.999f);
	addAttribute(alodgatelow);

	abboxminx = numFn.create( "bBoxMinX", "bbmnx", MFnNumericData::kFloat, -1.f );
	numFn.setKeyable(true);
	numFn.setStorable(true);
	addAttribute(abboxminx);
	
	abboxminy = numFn.create( "bBoxMinY", "bbmny", MFnNumericData::kFloat, -1.f );
	numFn.setKeyable(true);
	numFn.setStorable(true);
	addAttribute(abboxminy);
	
	abboxminz = numFn.create( "bBoxMinZ", "bbmnz", MFnNumericData::kFloat, -1.f );
	numFn.setKeyable(true);
	numFn.setStorable(true);
	addAttribute(abboxminz);
	
	abboxmaxx = numFn.create( "bBoxMaxX", "bbmxx", MFnNumericData::kFloat, 1.f );
	numFn.setKeyable(true);
	numFn.setStorable(true);
	addAttribute(abboxmaxx);
	
	abboxmaxy = numFn.create( "bBoxMaxY", "bbmxy", MFnNumericData::kFloat, 1.f);
	numFn.setKeyable(true);
	numFn.setStorable(true);
	addAttribute(abboxmaxy);
	
	abboxmaxz = numFn.create( "bBoxMaxZ", "bbmxz", MFnNumericData::kFloat, 1.f);
	numFn.setKeyable(true);
	numFn.setStorable(true);
	addAttribute(abboxmaxz);
	
	aradiusMult = numFn.create( "radiusMultiplier", "rml", MFnNumericData::kFloat);
	numFn.setStorable(true);
	numFn.setKeyable(true);
	numFn.setDefault(1.f);
	numFn.setMin(.05f);
	addAttribute(aradiusMult);
	
	axmultiplier = numFn.create( "visualMultiplierX", "vmx", MFnNumericData::kFloat, 1.f);
	numFn.setKeyable(true);
	numFn.setStorable(true);
	numFn.setMin(0.001f);
	addAttribute(axmultiplier);	
	aymultiplier = numFn.create( "visualMultiplierY", "vmy", MFnNumericData::kFloat, 1.f);
	numFn.setKeyable(true);
	numFn.setStorable(true);
	numFn.setMin(0.001f);
	addAttribute(aymultiplier);
	
	azmultiplier = numFn.create( "visualMultiplierZ", "vmz", MFnNumericData::kFloat, 1.f);
	numFn.setKeyable(true);
	numFn.setStorable(true);
	numFn.setMin(0.001f);
	addAttribute(azmultiplier);
	
	agroupcount = numFn.create( "numberInstances", "nis", MFnNumericData::kInt, 1);
	numFn.setKeyable(false);
	numFn.setStorable(true);
	numFn.setMin(1);
	addAttribute(agroupcount);
	
	ainstanceId = numFn.create( "instanceId", "iis", MFnNumericData::kInt, 0);
	numFn.setKeyable(false);
	numFn.setStorable(true);
	numFn.setMin(0);
	addAttribute(ainstanceId);

	MFnTypedAttribute typedAttrFn;
	MVectorArray defaultVectArray;
	MFnVectorArrayData vectArrayDataFn;
	vectArrayDataFn.create( defaultVectArray );
	outPositionPP = typedAttrFn.create( "outPosition",
											"opos",
											MFnData::kVectorArray,
											vectArrayDataFn.object(),
											&stat );
												
												if(!stat) MGlobal::displayWarning("failed create pospp");

	typedAttrFn.setStorable(false);
	if(addAttribute( outPositionPP ) != MS::kSuccess) MGlobal::displayWarning("failed add pospp");
	
	outScalePP = typedAttrFn.create( "outScale",
											"oscl",
											MFnData::kVectorArray,
											vectArrayDataFn.object(),
											&stat );
												
												if(!stat) MGlobal::displayWarning("failed create sclpp");

        typedAttrFn.setStorable(false);
        if(addAttribute(outScalePP) != MS::kSuccess) MGlobal::displayWarning("failed add sclpp");
		
	outRotationPP = typedAttrFn.create( "outRotation",
											"orot",
											MFnData::kVectorArray,
											vectArrayDataFn.object(),
											&stat );
												
												if(!stat) MGlobal::displayWarning("failed create rotpp");

        typedAttrFn.setStorable(false);
        if(addAttribute(outRotationPP) != MS::kSuccess) MGlobal::displayWarning("failed add rotpp");
		
	MDoubleArray defaultDArray;
	MFnDoubleArrayData dArrayDataFn;
	dArrayDataFn.create( defaultDArray );
	
	outReplacePP = typedAttrFn.create( "outReplace", "orpl",
									MFnData::kDoubleArray, dArrayDataFn.object(),
									&stat );
											
	if(stat != MS::kSuccess) {
		MGlobal::displayWarning("failed create outReplace");
	}
	
	typedAttrFn.setStorable(false);
	
	stat = addAttribute(outReplacePP);
	if(stat != MS::kSuccess) {
		MGlobal::displayWarning("failed add outReplace");
	}
	
    outValue = numFn.create( "outValue", "ov", MFnNumericData::kFloat );
	numFn.setStorable(false);
	numFn.setWritable(false);
	addAttribute(outValue);
	
	outValue1 = numFn.create( "outValue1", "ov1", MFnNumericData::kFloat );
	numFn.setStorable(false);
	numFn.setWritable(false);
	addAttribute(outValue1);
	
	MFnTypedAttribute   stringAttr;
	acachename = stringAttr.create( "cachePath", "cp", MFnData::kString );
 	stringAttr.setStorable(true);
	addAttribute( acachename );
	
	astandinNames = stringAttr.create( "standinNames", "sdn", MFnData::kString );
 	stringAttr.setStorable(true);
	stringAttr.setArray(true);
	addAttribute(astandinNames);
	
	MFnMatrixAttribute matAttr;
	acameraspace = matAttr.create( "cameraSpace", "cspc", MFnMatrixAttribute::kDouble );
 	matAttr.setStorable(false);
	matAttr.setWritable(true);
	matAttr.setConnectable(true);
	addAttribute(acameraspace);
	
	ahapeture = numFn.create( "horizontalFilmAperture", "hfa", MFnNumericData::kDouble, 1.0 );
	numFn.setStorable(false);
	numFn.setConnectable(true);
	addAttribute( ahapeture );
	
	avapeture = numFn.create( "verticalFilmAperture", "vfa", MFnNumericData::kDouble, 1.0 );
	numFn.setStorable(false);
	numFn.setConnectable(true);
	addAttribute( avapeture );
	
	afocallength = numFn.create( "focalLength", "fl", MFnNumericData::kDouble );
	numFn.setStorable(false);
	numFn.setConnectable(true);
	addAttribute( afocallength );
	
	aconvertPercentage = numFn.create( "convertPercentage", "cvp", MFnNumericData::kDouble );
	numFn.setStorable(false);
	numFn.setConnectable(true);
	numFn.setDefault(1.0);
	numFn.setMax(1.0);
	numFn.setMin(0.01);
	addAttribute(aconvertPercentage);
    
    agroundMesh = typedAttrFn.create("groundMesh", "grdm", MFnMeshData::kMesh);
	typedAttrFn.setStorable(false);
	typedAttrFn.setWritable(true);
	typedAttrFn.setConnectable(true);
    typedAttrFn.setArray(true);
    typedAttrFn.setDisconnectBehavior(MFnAttribute::kDelete);
	addAttribute( agroundMesh );
	attributeAffects(agroundMesh, outValue);
	
	agroundSpace = matAttr.create("groundSpace", "grdsp", MFnMatrixAttribute::kDouble);
	matAttr.setStorable(false);
	matAttr.setWritable(true);
	matAttr.setConnectable(true);
    matAttr.setArray(true);
    matAttr.setDisconnectBehavior(MFnAttribute::kDelete);
	addAttribute( agroundSpace );
	attributeAffects(agroundSpace, outValue);
	
	MPointArray defaultPntArray;
	MFnPointArrayData pntArrayDataFn;
	pntArrayDataFn.create( defaultPntArray );
	aplantTransformCache = typedAttrFn.create( "transformCachePlant",
											"tmcpl",
											MFnData::kPointArray,
											pntArrayDataFn.object(),
											&stat );
    typedAttrFn.setStorable(true);
	addAttribute(aplantTransformCache);
	
	MIntArray defaultIntArray;
	MFnIntArrayData intArrayDataFn;
	
	intArrayDataFn.create( defaultIntArray );
	aplantIdCache = typedAttrFn.create( "idCachePlant",
											"idcpl",
											MFnData::kIntArray,
											intArrayDataFn.object(),
											&stat );
    typedAttrFn.setStorable(true);
	addAttribute(aplantIdCache);
	
	aplantTriangleIdCache = typedAttrFn.create( "triCachePlant",
											"trcpl",
											MFnData::kIntArray,
											intArrayDataFn.object(),
											&stat );
    typedAttrFn.setStorable(true);
	addAttribute(aplantTriangleIdCache);
	
	aplantTriangleCoordCache = typedAttrFn.create( "coordCachePlant",
											"crcpl",
											MFnData::kVectorArray,
											vectArrayDataFn.object(),
											&stat );
    typedAttrFn.setStorable(true);
	addAttribute(aplantTriangleCoordCache);
	
	aplantOffsetCache = typedAttrFn.create( "offsetCachePlant",
											"otcpl",
											MFnData::kVectorArray,
											vectArrayDataFn.object(),
											&stat );
    typedAttrFn.setStorable(true);
	addAttribute(aplantOffsetCache);
	
	ainexamp = typedAttrFn.create("inExample", "ixmp", MFnData::kPlugin);
	typedAttrFn.setStorable(false);
	typedAttrFn.setConnectable(true);
	typedAttrFn.setArray(true);
	addAttribute(ainexamp);
    
    adisplayVox = numFn.create( "showVoxelThreshold", "svt", MFnNumericData::kFloat );
	numFn.setDefault(1.0);
    numFn.setMin(.7);
    numFn.setMax(1.0);
    numFn.setStorable(true);
	numFn.setKeyable(true);
    addAttribute(adisplayVox);
	
	acheckDepth = numFn.create( "checkDepth", "cdp", MFnNumericData::kBoolean );
	numFn.setDefault(0);
	numFn.setStorable(false);
	addAttribute(acheckDepth);
	
	ainoverscan = numFn.create( "cameraOverscan", "cos", MFnNumericData::kDouble );
	numFn.setDefault(1.33);
	numFn.setStorable(false);
	addAttribute(ainoverscan);
    
    aactivated = numFn.create( "activated", "act", MFnNumericData::kBoolean );
	numFn.setDefault(0);
	numFn.setStorable(false);
	addAttribute(aactivated);
    
	attributeAffects(ainexamp, outValue1);
	attributeAffects(aradiusMult, outValue1);
	attributeAffects(abboxminx, outValue);
	attributeAffects(abboxmaxx, outValue);
	attributeAffects(abboxminy, outValue);
	attributeAffects(abboxmaxy, outValue);
	attributeAffects(abboxminz, outValue);
	attributeAffects(abboxmaxz, outValue);
	attributeAffects(outPositionPP, outValue);
	
	return MS::kSuccess;
}
コード例 #5
0
ファイル: PtexColorNode.cpp プロジェクト: Mankua/PtexShaders
// DESCRIPTION:
//
MStatus PtexColorNode::initialize()
{
	MStatus status;

	MFnNumericAttribute numericAttribute;

	// Input attributes

	MFnTypedAttribute fileNameAttribute;
	aPtexFileName = fileNameAttribute.create( "ptexFileName", "f", MFnData::kString );
	MAKE_INPUT( fileNameAttribute );
	fileNameAttribute.setConnectable(false);

	MFnEnumAttribute enumAttribute;
	aPtexFilterType = enumAttribute.create( "ptexFilterType", "t", 0, &status );
	MCHECKERROR( status, "create filterType attribute" );
	enumAttribute.addField( "Point",      0 );
	enumAttribute.addField( "Bilinear",   1 );
	enumAttribute.addField( "Box",        2 );
	enumAttribute.addField( "Gaussian",   3 );
	enumAttribute.addField( "Bicubic",    4 );
	enumAttribute.addField( "BSpline",    5 );
	enumAttribute.addField( "CatmullRom", 6 );
	enumAttribute.addField( "Mitchell",   7 );
	enumAttribute.setHidden( false );
	MAKE_INPUT( enumAttribute );
	enumAttribute.setConnectable(false);
	MCHECKERROR( status, "Error adding shapeType attribute." );

	MFnNumericAttribute filterSizeAttribute;
	aPtexFilterSize = filterSizeAttribute.create( "ptexFilterSize", "s", MFnNumericData::kFloat, 1.0 );
	MAKE_INPUT( filterSizeAttribute );
	filterSizeAttribute.setConnectable(false);

	// Implicit shading network attributes

	MObject child1 = numericAttribute.create( "uCoord", "u", MFnNumericData::kFloat);
	MObject child2 = numericAttribute.create( "vCoord", "v", MFnNumericData::kFloat);
	aUVPos = numericAttribute.create( "uvCoord", "uv", child1, child2);
	MAKE_INPUT( numericAttribute );
	CHECK_MSTATUS( numericAttribute.setHidden(true) );

	child1 = numericAttribute.create( "uvFilterSizeX", "fsx", MFnNumericData::kFloat);
	child2 = numericAttribute.create( "uvFilterSizeY", "fsy", MFnNumericData::kFloat);
	aUVSize = numericAttribute.create( "uvFilterSize", "fs", child1, child2 );
	MAKE_INPUT( numericAttribute );
	CHECK_MSTATUS( numericAttribute.setHidden(true) );

	// Output attributes
	aOutColor = numericAttribute.createColor("outColor", "oc");
	MAKE_OUTPUT(numericAttribute);

	// Add attributes to the node database.
	CHECK_MSTATUS( addAttribute(aPtexFileName) );
	CHECK_MSTATUS( addAttribute(aPtexFilterType) );
	CHECK_MSTATUS( addAttribute(aPtexFilterSize) );
	CHECK_MSTATUS( addAttribute(aUVPos) );
	CHECK_MSTATUS( addAttribute(aUVSize) );

	CHECK_MSTATUS( addAttribute(aOutColor) );

	// All input affect the output color
	CHECK_MSTATUS( attributeAffects( aPtexFileName,   aOutColor ) );
	CHECK_MSTATUS( attributeAffects( aPtexFilterSize, aOutColor ) );
	CHECK_MSTATUS( attributeAffects( aPtexFilterType, aOutColor ) );
	CHECK_MSTATUS( attributeAffects( aUVPos,          aOutColor ) );
	CHECK_MSTATUS( attributeAffects( aUVSize,         aOutColor ) );

	return MS::kSuccess;
}
コード例 #6
0
MStatus hingeConstraintNode::initialize()
{
    MStatus status;
    MFnMessageAttribute fnMsgAttr;
    MFnNumericAttribute fnNumericAttr;
    MFnMatrixAttribute fnMatrixAttr;

    ia_rigidBody = fnMsgAttr.create("inRigidBody", "inrb", &status);
    MCHECKSTATUS(status, "creating inRigidBody attribute")
    status = addAttribute(ia_rigidBody);
    MCHECKSTATUS(status, "adding inRigidBody attribute")

    ia_damping = fnNumericAttr.create("damping", "dmp", MFnNumericData::kDouble, 1.0, &status);
    MCHECKSTATUS(status, "creating damping attribute")
    fnNumericAttr.setKeyable(true);
    status = addAttribute(ia_damping);
    MCHECKSTATUS(status, "adding damping attribute")

    ia_lowerLimit = fnNumericAttr.create("lowerLimit", "llmt", MFnNumericData::kDouble, -1.57, &status);
    MCHECKSTATUS(status, "creating lower limit attribute")
    fnNumericAttr.setKeyable(true);
    status = addAttribute(ia_lowerLimit);
    MCHECKSTATUS(status, "adding lower limit attribute")

	ia_upperLimit = fnNumericAttr.create("upperLimit", "ulmt", MFnNumericData::kDouble, 1.57, &status);
    MCHECKSTATUS(status, "creating upper limit attribute")
    fnNumericAttr.setKeyable(true);
    status = addAttribute(ia_upperLimit);
    MCHECKSTATUS(status, "adding upper limit attribute")

	ia_limitSoftness = fnNumericAttr.create("limitSoftness", "lmSo", MFnNumericData::kDouble, 0.9, &status);
    MCHECKSTATUS(status, "creating limitSoftness attribute")
    fnNumericAttr.setKeyable(true);
    status = addAttribute(ia_limitSoftness);
    MCHECKSTATUS(status, "adding limitSoftness attribute")

	ia_biasFactor = fnNumericAttr.create("biasFactor", "biFa", MFnNumericData::kDouble, 0.3, &status);
    MCHECKSTATUS(status, "creating biasFactor attribute")
    fnNumericAttr.setKeyable(true);
    status = addAttribute(ia_biasFactor);
    MCHECKSTATUS(status, "adding biasFactor attribute")

	ia_relaxationFactor = fnNumericAttr.create("relaxationFactor", "reFa", MFnNumericData::kDouble, 1.0, &status);
    MCHECKSTATUS(status, "creating relaxationFactor attribute")
    fnNumericAttr.setKeyable(true);
    status = addAttribute(ia_relaxationFactor);
    MCHECKSTATUS(status, "adding relaxationFactor attribute")

	ia_hingeAxis = fnNumericAttr.createPoint("hingeAxis", "hgAx", &status);
	status = fnNumericAttr.setDefault((double) 0.0, (double) 0.0, (double) 1.0);
    MCHECKSTATUS(status, "creating hingeAxis attribute")
    status = addAttribute(ia_hingeAxis);
    MCHECKSTATUS(status, "adding hingeAxis attribute")

	//------------------------------------------------------------------------------
	
	ia_enableAngularMotor = fnNumericAttr.create("enableAngularMotor", "enAM", MFnNumericData::kBoolean, false, &status);
    MCHECKSTATUS(status, "creating enableAngularMotor attribute")
    status = addAttribute(ia_enableAngularMotor);
    MCHECKSTATUS(status, "adding enableAngularMotor attribute")

    ia_motorTargetVelocity = fnNumericAttr.create("motorTargetVelocity", "mTV", MFnNumericData::kDouble, 1, &status);
    MCHECKSTATUS(status, "creating motorTargetVelocity attribute")
    fnNumericAttr.setKeyable(true);
    status = addAttribute(ia_motorTargetVelocity);
    MCHECKSTATUS(status, "adding motorTargetVelocity attribute")

	ia_maxMotorImpulse = fnNumericAttr.create("maxMotorImpulse", "mMI", MFnNumericData::kDouble, 1, &status);
    MCHECKSTATUS(status, "creating maxMotorImpulse attribute")
    fnNumericAttr.setKeyable(true);
    status = addAttribute(ia_maxMotorImpulse);
    MCHECKSTATUS(status, "adding maxMotorImpulse attribute")

	//------------------------------------------------------------------------------

	ca_constraint = fnNumericAttr.create("ca_constraint", "caco", MFnNumericData::kBoolean, 0, &status);
    MCHECKSTATUS(status, "creating ca_constraint attribute")
    fnNumericAttr.setConnectable(false);
    fnNumericAttr.setHidden(true);
    fnNumericAttr.setStorable(false);
    fnNumericAttr.setKeyable(false);
    status = addAttribute(ca_constraint);
    MCHECKSTATUS(status, "adding ca_constraint attribute")

    ca_constraintParam = fnNumericAttr.create("ca_constraintParam", "cacop", MFnNumericData::kBoolean, 0, &status);
    MCHECKSTATUS(status, "creating ca_constraintParam attribute")
    fnNumericAttr.setConnectable(false);
    fnNumericAttr.setHidden(true);
    fnNumericAttr.setStorable(false);
    fnNumericAttr.setKeyable(false);
    status = addAttribute(ca_constraintParam);
    MCHECKSTATUS(status, "adding ca_constraintParam attribute")


    status = attributeAffects(ia_rigidBody, ca_constraint);
    MCHECKSTATUS(status, "adding attributeAffects(ia_rigidBody, ca_constraint)")

    status = attributeAffects(ia_rigidBody, ca_constraintParam);
    MCHECKSTATUS(status, "adding attributeAffects(ia_rigidBody, ca_constraintParam)")

    status = attributeAffects(ia_damping, ca_constraintParam);
    MCHECKSTATUS(status, "adding attributeAffects(ia_damping, ca_constraintParam)")

    status = attributeAffects(ia_lowerLimit, ca_constraintParam);
    MCHECKSTATUS(status, "adding attributeAffects(ia_lowerLimit, ca_constraintParam)")

	status = attributeAffects(ia_upperLimit, ca_constraintParam);
    MCHECKSTATUS(status, "adding attributeAffects(ia_upperLimit, ca_constraintParam)")

	status = attributeAffects(ia_limitSoftness, ca_constraintParam);
    MCHECKSTATUS(status, "adding attributeAffects(ia_limitSoftness, ca_constraintParam)")
	status = attributeAffects(ia_biasFactor, ca_constraintParam);
    MCHECKSTATUS(status, "adding attributeAffects(ia_biasFactor, ca_constraintParam)")
	status = attributeAffects(ia_relaxationFactor, ca_constraintParam);
    MCHECKSTATUS(status, "adding attributeAffects(ia_relaxationFactor, ca_constraintParam)")

	status = attributeAffects(ia_hingeAxis, ca_constraintParam);
    MCHECKSTATUS(status, "adding attributeAffects(ia_hingeAxis, ca_constraintParam)")

	status = attributeAffects(ia_enableAngularMotor, ca_constraintParam);
    MCHECKSTATUS(status, "adding attributeAffects(ia_enableAngularMotor, ca_constraintParam)")
	status = attributeAffects(ia_motorTargetVelocity, ca_constraintParam);
    MCHECKSTATUS(status, "adding attributeAffects(ia_motorTargetVelocity, ca_constraintParam)")
	status = attributeAffects(ia_maxMotorImpulse, ca_constraintParam);
    MCHECKSTATUS(status, "adding attributeAffects(ia_maxMotorImpulse, ca_constraintParam)")

	return MS::kSuccess;
}
コード例 #7
0
MStatus liqDisplacementNode::initialize()
{
  MFnTypedAttribute   tAttr;
  MFnStringData       tDefault;
  MFnNumericAttribute nAttr;
  MFnMessageAttribute mAttr;
  MFnEnumAttribute    eAttr;
  MStatus status;

  // Create input attributes

  aRmanShader = tAttr.create( MString("rmanShader"), MString("rms"), MFnData::kString, aRmanShader, &status );
  MAKE_INPUT(tAttr);

  aRmanShaderLong = tAttr.create( MString("rmanShaderLong"), MString("rml"), MFnData::kString, aRmanShaderLong, &status );
  MAKE_INPUT(tAttr);

  aRmanShaderLif = tAttr.create(  MString("rmanShaderLif"),  MString("lif"), MFnData::kString, aRmanShaderLif, &status );
  MAKE_INPUT(tAttr);

  aRmanParams = tAttr.create(  MString("rmanParams"),  MString("rpr"), MFnData::kStringArray, aRmanParams, &status );
  MAKE_INPUT(tAttr);

  aRmanDetails = tAttr.create(  MString("rmanDetails"),  MString("rdt"), MFnData::kStringArray, aRmanDetails, &status );
  MAKE_INPUT(tAttr);

  aRmanTypes = tAttr.create(  MString("rmanTypes"),  MString("rty"), MFnData::kStringArray, aRmanTypes, &status );
  MAKE_INPUT(tAttr);

  aRmanDefaults = tAttr.create(  MString("rmanDefaults"),  MString("rdf"), MFnData::kStringArray, aRmanDefaults, &status );
  MAKE_INPUT(tAttr);

  aRmanArraySizes = tAttr.create(  MString("rmanArraySizes"),  MString("ras"), MFnData::kIntArray, aRmanArraySizes, &status );
  MAKE_INPUT(tAttr);

  aRmanLifCmds = tAttr.create(  MString("rmanLifCmds"),  MString("rlc"), MFnData::kStringArray, aRmanLifCmds, &status );
  MAKE_INPUT(tAttr);

  aPreviewPrimitive = eAttr.create( "previewPrimitive", "pvp", 7, &status );
  eAttr.addField( "Sphere",   0 );
  eAttr.addField( "Cube",     1 );
  eAttr.addField( "Cylinder", 2 );
  eAttr.addField( "Torus",    3 );
  eAttr.addField( "Plane",    4 );
  eAttr.addField( "Teapot",   5 );
  eAttr.addField( "Custom",   6 );
  eAttr.addField( "(globals)",7 );
  MAKE_NONKEYABLE_INPUT(eAttr);
  CHECK_MSTATUS(eAttr.setConnectable(false));

  aPreviewCustomPrimitive = tAttr.create(  MString("previewCustomPrimitive"),  MString("pcp"), MFnData::kString, aPreviewCustomPrimitive, &status );
  MAKE_INPUT(tAttr);

  aPreviewCustomBackplane = tAttr.create(  MString("previewCustomBackplane"),  MString("pcb"), MFnData::kString, aPreviewCustomBackplane, &status );
  MAKE_INPUT(tAttr);

  aPreviewObjectSize = nAttr.create("previewObjectSize", "pos", MFnNumericData::kDouble, 1.0, &status);
  MAKE_NONKEYABLE_INPUT(nAttr);
  CHECK_MSTATUS(nAttr.setConnectable(false));

  aPreviewPixelSamples = nAttr.create("previewPixelSamples", "pxs",  MFnNumericData::kInt, 3, &status);
  MAKE_NONKEYABLE_INPUT(nAttr);
  CHECK_MSTATUS(nAttr.setConnectable(false));


  aPreviewShadingRate = nAttr.create("previewShadingRate", "psr", MFnNumericData::kDouble, 1.0, &status);
  MAKE_NONKEYABLE_INPUT(nAttr);
  CHECK_MSTATUS(nAttr.setConnectable(false));

  aPreviewBackplane = nAttr.create("previewBackplane", "pbp", MFnNumericData::kBoolean, true, &status);
  MAKE_NONKEYABLE_INPUT(nAttr);
  CHECK_MSTATUS(nAttr.setConnectable(false));

  aShaderSpace = tAttr.create( MString("shaderSpace"), MString("ssp"), MFnData::kString, aShaderSpace, &status );
  MAKE_INPUT(tAttr);

  aDisplacementBound = nAttr.create("displacementBound", "db", MFnNumericData::kDouble, 0.0, &status);
  MAKE_INPUT(nAttr);

  MObject defaultSpaceObj = tDefault.create( MString("shader"), &status);
  aDisplacementBoundSpace = tAttr.create( MString("displacementBoundSpace"), MString("dbs"), MFnData::kString, defaultSpaceObj, &status );
  MAKE_INPUT(tAttr);

  aOutputInShadow = nAttr.create("outputInShadow", "ois",  MFnNumericData::kBoolean, 0.0, &status);
  MAKE_NONKEYABLE_INPUT(nAttr);

  // refreshPreview must be true to allow refresh
  aRefreshPreview = nAttr.create("refreshPreview", "rfp",  MFnNumericData::kBoolean, 0.0, &status);
  MAKE_NONKEYABLE_INPUT(nAttr);
  CHECK_MSTATUS(nAttr.setHidden(true));

  // Create output attributes
  aDisplacement = nAttr.create("displacement", "d", MFnNumericData::kFloat, 0.0, &status);
  MAKE_OUTPUT(nAttr);
  aOutColor = nAttr.createColor("outColor", "oc");
  MAKE_OUTPUT(nAttr);
  aAssignedObjects = mAttr.create("liqAssignedObjects", "ao");
  MAKE_OUTPUT(mAttr);

  CHECK_MSTATUS(addAttribute(aRmanShader));
  CHECK_MSTATUS(addAttribute(aRmanShaderLong));
  CHECK_MSTATUS(addAttribute(aRmanShaderLif));
  CHECK_MSTATUS(addAttribute(aRmanParams));
  CHECK_MSTATUS(addAttribute(aRmanDetails));
  CHECK_MSTATUS(addAttribute(aRmanTypes));
  CHECK_MSTATUS(addAttribute(aRmanDefaults));
  CHECK_MSTATUS(addAttribute(aRmanArraySizes));
  CHECK_MSTATUS(addAttribute(aRmanLifCmds));

  CHECK_MSTATUS(addAttribute(aPreviewPrimitive));
  CHECK_MSTATUS(addAttribute(aPreviewCustomPrimitive));
  CHECK_MSTATUS(addAttribute(aPreviewCustomBackplane));
  CHECK_MSTATUS(addAttribute(aPreviewObjectSize));
  CHECK_MSTATUS(addAttribute(aPreviewPixelSamples));
  CHECK_MSTATUS(addAttribute(aPreviewShadingRate));
  CHECK_MSTATUS(addAttribute(aPreviewBackplane));
  CHECK_MSTATUS(addAttribute(aShaderSpace));
  CHECK_MSTATUS(addAttribute(aDisplacementBound));
  CHECK_MSTATUS(addAttribute(aDisplacementBoundSpace));
  CHECK_MSTATUS(addAttribute(aOutputInShadow));
  CHECK_MSTATUS(addAttribute(aRefreshPreview));

  CHECK_MSTATUS(addAttribute(aAssignedObjects));
  CHECK_MSTATUS(addAttribute(aDisplacement));
  CHECK_MSTATUS(addAttribute(aOutColor));

  CHECK_MSTATUS(attributeAffects(aRmanShaderLong, aDisplacement));
  CHECK_MSTATUS(attributeAffects(aRmanShaderLif, aDisplacement));

  return MS::kSuccess;
}
コード例 #8
0
MStatus collisionShapeNode::initialize()
{
	MStatus status;
	MFnMessageAttribute fnMsgAttr;
	MFnNumericAttribute fnNumericAttr;
	MFnEnumAttribute fnEnumAttr;

	ia_type = fnEnumAttr.create("type", "tp", 7, &status);
	MCHECKSTATUS(status, "creating type attribute")
		fnEnumAttr.addField("Convex Hull", 0);
	fnEnumAttr.addField("Mesh", 1);
	fnEnumAttr.addField("Cylinder", 2);
	fnEnumAttr.addField("Capsule", 3);
	fnEnumAttr.addField("Box", 4);
	fnEnumAttr.addField("Sphere", 5);
	fnEnumAttr.addField("Plane", 6);
	fnEnumAttr.addField("BvhMesh", 7);
	fnEnumAttr.addField("HACD", 8);
	fnEnumAttr.setKeyable(true);
	status = addAttribute(ia_type);
	MCHECKSTATUS(status, "adding type attribute")

		ia_scale = fnNumericAttr.createPoint("scale", "sc", &status);
	MCHECKSTATUS(status, "creating ia_scale attribute")
		fnNumericAttr.setDefault(1.0, 1.0, 1.0);
	fnNumericAttr.setKeyable(true);
	status = addAttribute(ia_scale);
	MCHECKSTATUS(status, "adding ia_scale attribute")

		oa_collisionShape = fnMsgAttr.create("outCollisionShape", "oucs", &status);
	MCHECKSTATUS(status, "creating outCollisionShape attribute")
		status = addAttribute(oa_collisionShape);
	MCHECKSTATUS(status, "adding outCollisionShape attribute")

		ia_shape = fnMsgAttr.create("inShape", "insh", &status);
	MCHECKSTATUS(status, "creating inShape attribute")
		status = addAttribute(ia_shape);
	MCHECKSTATUS(status, "adding inShape attribute")

		ca_collisionShape = fnNumericAttr.create("ca_collisionShape", "ccs", MFnNumericData::kBoolean, 0, &status);
	MCHECKSTATUS(status, "creating ca_collisionShape attribute")
		fnNumericAttr.setWorldSpace(true);
	fnNumericAttr.setConnectable(false);
	fnNumericAttr.setHidden(true);
	fnNumericAttr.setStorable(false);
	fnNumericAttr.setKeyable(false);
	status = addAttribute(ca_collisionShape);
	MCHECKSTATUS(status, "adding ca_collisionShape attribute")

		ca_collisionShapeParam = fnNumericAttr.create("collisionShapeParam", "cspm", MFnNumericData::kBoolean, 0, &status);
	MCHECKSTATUS(status, "creating ca_collisionShapeParam attribute")
		fnNumericAttr.setConnectable(false);
	fnNumericAttr.setHidden(true);
	fnNumericAttr.setStorable(false);
	fnNumericAttr.setKeyable(false);
	status = addAttribute(ca_collisionShapeParam);
	MCHECKSTATUS(status, "adding ca_collisionShapeParam attribute")

		//
		status = attributeAffects(ia_shape, oa_collisionShape);
	MCHECKSTATUS(status, "adding attributeAffects(ia_shape, oa_collisionShape)")

		status = attributeAffects(ia_type, oa_collisionShape);
	MCHECKSTATUS(status, "adding attributeAffects(ia_type, oa_collisionShape)")

		status = attributeAffects(ia_scale, oa_collisionShape);
	MCHECKSTATUS(status, "adding attributeAffects(ia_scale, oa_collisionShape)")

		//
		status = attributeAffects(ia_shape, ca_collisionShape);
	MCHECKSTATUS(status, "adding attributeAffects(ia_shape, ca_collisionShape)")

		status = attributeAffects(ia_type, ca_collisionShape);
	MCHECKSTATUS(status, "adding attributeAffects(ia_shape, ca_collisionShape)")

		//
		status = attributeAffects(ia_shape, ca_collisionShapeParam);
	MCHECKSTATUS(status, "adding attributeAffects(ia_shape, oa_collisionShapeParam)")

		status = attributeAffects(ia_scale, ca_collisionShapeParam);
	MCHECKSTATUS(status, "adding attributeAffects(ia_scale, oa_collisionShapeParam)")

		status = attributeAffects(ia_type, ca_collisionShapeParam);
	MCHECKSTATUS(status, "adding attributeAffects(ia_type, oa_collisionShapeParam)")

		return MS::kSuccess;
}
コード例 #9
0
ファイル: puttyNode.cpp プロジェクト: Leopardob/puttynodes
MStatus puttyNode::initialize()
{
	MStatus status;
	MFnNumericAttribute		nAttr;
  	MFnEnumAttribute		eAttr;
    MFnTypedAttribute       tAttr;
    MFnMatrixAttribute       mAttr;

    // the script


    aScript = tAttr.create( "script", "scr", MFnData::kString);
    tAttr.setStorable(true);
    tAttr.setKeyable(false);
	SYS_ERROR_CHECK( addAttribute( aScript ), "adding aScript" );  

	aCmdBaseName = tAttr.create( "cmdBaseName", "cbn", MFnData::kString);
    tAttr.setStorable(true);
    tAttr.setKeyable(false);
    tAttr.setHidden(true);    
	SYS_ERROR_CHECK( addAttribute( aCmdBaseName ), "adding aCmdBaseName" );  

    // refresh
    
    aSource = nAttr.create( "source", "src", MFnNumericData::kBoolean, 0 );
    nAttr.setHidden(true);    
    SYS_ERROR_CHECK( addAttribute( aSource ), "adding aSource" ); 
    
	// it is important that script sourced is initialised false and not storable
    // so this way the function gets sourced on maya startup    
    aScriptSourced = nAttr.create( "scriptSourced", "ssrc", MFnNumericData::kBoolean, 0 );
    nAttr.setStorable(false);
    nAttr.setHidden(true);        
    SYS_ERROR_CHECK( addAttribute( aScriptSourced ), "adding aScriptSourced" ); 


    aNodeReady = nAttr.create( "nodeReady", "nr", MFnNumericData::kBoolean, 0 );
    nAttr.setHidden(true);    
    SYS_ERROR_CHECK( addAttribute( aNodeReady ), "adding aNodeReady" ); 

    aDynDirty = nAttr.create( "dynDirty", "dd", MFnNumericData::kBoolean, 0 );
    nAttr.setHidden(true);    
    SYS_ERROR_CHECK( addAttribute( aDynDirty ), "adding aDynDirty" ); 

  
    // space
   	aDefSpace = eAttr.create("deformerSpace", "dsp", MSD_SPACE_OBJECT, &status);
	eAttr.addField("object (default)", MSD_SPACE_OBJECT);
	eAttr.addField("world (automatic conversion)", MSD_SPACE_WORLD);
   	eAttr.setKeyable(false);
	eAttr.setStorable(true);
	SYS_ERROR_CHECK( addAttribute( aDefSpace ), "adding aDefSpace" );

    // envelope
   	aDefEnvelope = eAttr.create("deformerEnvelope", "de", MSD_ENVELOPE_AUTO, &status);
	eAttr.addField("auto", MSD_ENVELOPE_AUTO);
    eAttr.addField("user", MSD_ENVELOPE_USER);    
   	eAttr.setKeyable(false);
	eAttr.setStorable(true);
	SYS_ERROR_CHECK( addAttribute( aDefEnvelope ), "adding aDefEnvelope" );

    // weights
   	aDefWeights = eAttr.create("deformerWeights", "dw", MSD_WEIGHTS_AUTO, &status);
	eAttr.addField("auto", MSD_WEIGHTS_AUTO);
    eAttr.addField("user", MSD_WEIGHTS_USER);    
   	eAttr.setKeyable(false);
	eAttr.setStorable(true);
	SYS_ERROR_CHECK( addAttribute( aDefWeights ), "adding aDefWeights" );

    /////////////////////////////////////////////////////////////////////////////    
    // current values
    aCurrPosition = tAttr.create( "currentPosition", "cpos", MFnData::kVectorArray);
    tAttr.setStorable(false);
    tAttr.setKeyable(false);
    tAttr.setConnectable(false);
    tAttr.setWritable(false);
	SYS_ERROR_CHECK( addAttribute( aCurrPosition ), "adding aCurrPos" );          

    aCurrWeight = tAttr.create( "currentWeight", "cwgh", MFnData::kDoubleArray);
    tAttr.setStorable(false);
    tAttr.setKeyable(false);
    tAttr.setConnectable(false);
    tAttr.setWritable(false);
	SYS_ERROR_CHECK( addAttribute( aCurrWeight ), "adding aCurrWeight" );          
    
    aCurrMultiIndex = nAttr.create("currentMultiIndex","cmi",MFnNumericData::kInt);
    nAttr.setStorable(false);
    nAttr.setKeyable(false);
    nAttr.setConnectable(false);
    nAttr.setWritable(false);
	SYS_ERROR_CHECK( addAttribute( aCurrMultiIndex ), "adding aCurrMultiIndex" );          

    aCurrWorldMatrix = mAttr.create("currentWorldMatrix","cwm"); 
    mAttr.setStorable(false);
    mAttr.setKeyable(false);
    mAttr.setConnectable(false);
    mAttr.setWritable(false);
	SYS_ERROR_CHECK( addAttribute( aCurrWorldMatrix ), "adding aCurrObjectName" );          

/*
    aCurrGeometryName= tAttr.create( "currentGeometryName", "con", MFnData::kString);
    tAttr.setStorable(false);
    tAttr.setKeyable(false);
    tAttr.setConnectable(false);
    tAttr.setWritable(false);
	SYS_ERROR_CHECK( addAttribute( aCurrGeometryName ), "adding aCurrObjectName" );          
*/       
    aCurrGeometryType= tAttr.create( "currentGeometryType", "cot", MFnData::kString);
    tAttr.setStorable(false);
    tAttr.setKeyable(false);
    tAttr.setConnectable(false);
    tAttr.setWritable(false);
	SYS_ERROR_CHECK( addAttribute( aCurrGeometryType ), "adding aCurrGeometryType" );


    /////////////////////////////////////////////////////////////////////////////    
    // affects
    attributeAffects( aScript ,aNodeReady);          
    attributeAffects( aSource, aNodeReady  );
    attributeAffects( aScriptSourced, aNodeReady  );
    
	attributeAffects( aScript,aScriptSourced);
	attributeAffects( aSource,aScriptSourced);
	
    attributeAffects( aScriptSourced, outputGeom  );    
	attributeAffects( aDynDirty,outputGeom ); 
	attributeAffects( aNodeReady,outputGeom ); 
    attributeAffects( aScript ,outputGeom); 
	attributeAffects(  aCmdBaseName  ,outputGeom);   
    attributeAffects( aSource ,outputGeom );        
    attributeAffects( aDefSpace, outputGeom  );
    attributeAffects( aDefWeights,outputGeom);
    attributeAffects( aDefEnvelope,outputGeom ); 
	return MS::kSuccess;
}
コード例 #10
0
ファイル: softBodyNode.cpp プロジェクト: benelot/dynamica
MStatus SoftBodyNode::initialize()
{
	MFnMessageAttribute fnMsgAttr;
	MStatus status = MStatus::kSuccess;

	ia_solver = fnMsgAttr.create("solver", "solv", &status);
	MCHECKSTATUS(status, "creating solver attribute")
		status = addAttribute(ia_solver);
	MCHECKSTATUS(status, "adding solver attribute")

		MFnNumericAttribute fnNumericAttr;
	ca_solver = fnNumericAttr.create("ca_solver", "caso", MFnNumericData::kBoolean, 0, &status);
	MCHECKSTATUS(status, "creating ca_solver attribute")
		fnNumericAttr.setConnectable(false);
	fnNumericAttr.setHidden(true);
	fnNumericAttr.setStorable(false);
	fnNumericAttr.setKeyable(false);
	status = addAttribute(ca_solver);
	MCHECKSTATUS(status, "adding ca_solver attribute")

		ca_softBody = fnNumericAttr.create("ca_softBody", "casb", MFnNumericData::kBoolean, 0, &status);   
	MCHECKSTATUS(status, "creating ca_softBody attribute")
		fnNumericAttr.setConnectable(false);
	fnNumericAttr.setHidden(true);
	fnNumericAttr.setStorable(false);
	fnNumericAttr.setKeyable(false);
	status = addAttribute(ca_softBody);
	MCHECKSTATUS(status, "adding ca_softBody attribute")

		inputMesh = fnMsgAttr.create("inMesh", "inmsh", &status);
	MCHECKSTATUS(status, "creating inMesh attribute")
		status = addAttribute(inputMesh);
	MCHECKSTATUS(status, "adding inMesh attribute")

		outputMesh = fnMsgAttr.create("outMesh", "outmsh", &status);
	MCHECKSTATUS(status, "creating outMesh attribute")
		status = addAttribute(outputMesh);
	MCHECKSTATUS(status, "adding outMesh attribute")
		/*
		Note that these initial* attributes are not in use for soft bodies at the moment
		*/
		ia_initialPosition = fnNumericAttr.createPoint("initialPosition", "inpo", &status);
	MCHECKSTATUS(status, "creating initialPosition attribute")
		status = addAttribute(ia_initialPosition);
	MCHECKSTATUS(status, "adding initialPosition attribute")

		ia_initialRotation = fnNumericAttr.createPoint("initialRotation", "inro", &status);
	MCHECKSTATUS(status, "creating initialRotation attribute")
		status = addAttribute(ia_initialRotation);
	MCHECKSTATUS(status, "adding initialRotation attribute")

		ia_initialVelocity = fnNumericAttr.createPoint("initialVelocity", "inve", &status);
	MCHECKSTATUS(status, "creating initialVelocity attribute")
		status = addAttribute(ia_initialVelocity);
	MCHECKSTATUS(status, "adding initialVelocity attribute")

		ia_initialSpin = fnNumericAttr.createPoint("initialSpin", "insp", &status);
	MCHECKSTATUS(status, "creating initialSpin attribute")
		status = addAttribute(ia_initialSpin);
	MCHECKSTATUS(status, "adding initialSpin attribute")

		// total soft body mass
		ia_mass = fnNumericAttr.create("mass", "ma", MFnNumericData::kDouble, DEFAULT_MASS, &status);
	MCHECKSTATUS(status, "creating mass attribute")
		fnNumericAttr.setKeyable(true);
	status = addAttribute(ia_mass);
	MCHECKSTATUS(status, "adding mass attribute")

		// create dynamic friction coefficient attribute
		ia_dynamicFrictionCoeff = fnNumericAttr.create("dynamicfrictioncoeff", "dfc", MFnNumericData::kDouble, DEFAULT_DFC, &status);
	MCHECKSTATUS(status, "creating dynamicfrictioncoeff attribute")
		fnNumericAttr.setKeyable(true);
	status = addAttribute(ia_dynamicFrictionCoeff);
	MCHECKSTATUS(status, "adding dynamicfrictioncoeff attribute")

		// create collision margin attribute
		ia_collisionMargin = fnNumericAttr.create("collisionmargin", "cmargin", MFnNumericData::kFloat, DEFAULT_CMARGIN, &status);
	MCHECKSTATUS(status, "creating collisionmargin attribute")
		fnNumericAttr.setKeyable(false);
	status = addAttribute(ia_collisionMargin);
	MCHECKSTATUS(status, "adding collision attribute")

		// collision clusters attribute
		ia_numClusters = fnNumericAttr.create("numclusters", "nclust", MFnNumericData::kInt, DEFAULT_CLUSTERS, &status);
	MCHECKSTATUS(status, "creating numclusters attribute")
		fnNumericAttr.setKeyable(false);
	status = addAttribute(ia_numClusters);
	MCHECKSTATUS(status, "adding numclusters attribute")

		ca_softBodyParam = fnNumericAttr.create("ca_softBodyParam", "casbp", MFnNumericData::kBoolean, 0, &status);
	MCHECKSTATUS(status, "creating ca_softBodyParam attribute")
		fnNumericAttr.setConnectable(false);
	fnNumericAttr.setHidden(true);
	fnNumericAttr.setStorable(false);
	fnNumericAttr.setKeyable(false);
	status = addAttribute(ca_softBodyParam);
	MCHECKSTATUS(status, "adding ca_softBodyParam attribute")

		status = attributeAffects(inputMesh, ca_softBody);
	MCHECKSTATUS(status, "adding attributeAffects(inputMesh, ca_softBody)")

		status = attributeAffects(ia_solver, ca_solver);
	MCHECKSTATUS(status, "adding attributeAffects(ia_solver, ca_solver)")

		// connect soft body parameters to ca_softBodyParam connection
		status = attributeAffects(ia_mass, ca_softBodyParam);
	MCHECKSTATUS(status, "adding attributeAffects(ia_mass, ca_softBodyParam)")

		status = attributeAffects(ia_dynamicFrictionCoeff, ca_softBodyParam);
	MCHECKSTATUS(status, "adding attributeAffects(ia_dynamicFrictionCoeff, ca_softBodyParam)")

		status = attributeAffects(ia_collisionMargin, ca_softBodyParam);
	MCHECKSTATUS(status, "adding attributeAffects(ia_collisionMargin, ca_softBodyParam)")

		status = attributeAffects(ia_numClusters, ca_softBodyParam);
	MCHECKSTATUS(status, "adding attributeAffects(ia_numClusters, ca_softBodyParam)")
		return status;
}
コード例 #11
0
ファイル: rigidBodyNode.cpp プロジェクト: benelot/dynamica
MStatus rigidBodyNode::initialize()
{
    MStatus status;
    MFnMessageAttribute fnMsgAttr;
    MFnNumericAttribute fnNumericAttr;
    MFnMatrixAttribute fnMatrixAttr;
	MFnTypedAttribute typedAttr;

    ia_collisionShape = fnMsgAttr.create("inCollisionShape", "incs", &status);
    MCHECKSTATUS(status, "creating inCollisionShape attribute")
    status = addAttribute(ia_collisionShape);
    MCHECKSTATUS(status, "adding inCollisionShape attribute")

    ia_solver = fnMsgAttr.create("solver", "solv", &status);
    MCHECKSTATUS(status, "creating solver attribute")
    status = addAttribute(ia_solver);
    MCHECKSTATUS(status, "adding solver attribute")

    ia_mass = fnNumericAttr.create("mass", "ma", MFnNumericData::kDouble, 1.0, &status);
    MCHECKSTATUS(status, "creating mass attribute")
    fnNumericAttr.setKeyable(true);
    status = addAttribute(ia_mass);
    MCHECKSTATUS(status, "adding mass attribute")

    ia_restitution = fnNumericAttr.create("restitution", "rst", MFnNumericData::kDouble, 0.1, &status);
    MCHECKSTATUS(status, "creating restitution attribute")
    fnNumericAttr.setKeyable(true);
    status = addAttribute(ia_restitution);
    MCHECKSTATUS(status, "adding restitution attribute")

    ia_friction = fnNumericAttr.create("friction", "fc", MFnNumericData::kDouble, 0.5, &status);
    MCHECKSTATUS(status, "creating friction attribute")
    fnNumericAttr.setKeyable(true);
    status = addAttribute(ia_friction);
    MCHECKSTATUS(status, "adding friction attribute")

    ia_linearDamping = fnNumericAttr.create("linearDamping", "ld", MFnNumericData::kDouble, 0.3, &status);
    MCHECKSTATUS(status, "creating linearDamping attribute")
    fnNumericAttr.setKeyable(true);
    status = addAttribute(ia_linearDamping);
    MCHECKSTATUS(status, "adding linearDamping attribute")

    ia_angularDamping = fnNumericAttr.create("angularDamping", "ad", MFnNumericData::kDouble, 0.3, &status);
    MCHECKSTATUS(status, "creating angularDamping attribute")
    fnNumericAttr.setKeyable(true);
    status = addAttribute(ia_angularDamping);
    MCHECKSTATUS(status, "adding angularDamping attribute")

    ia_initialPosition = fnNumericAttr.createPoint("initialPosition", "inpo", &status);
    MCHECKSTATUS(status, "creating initialPosition attribute")
    status = addAttribute(ia_initialPosition);
    MCHECKSTATUS(status, "adding initialPosition attribute")

    ia_initialRotation = fnNumericAttr.createPoint("initialRotation", "inro", &status);
    MCHECKSTATUS(status, "creating initialRotation attribute")
    status = addAttribute(ia_initialRotation);
    MCHECKSTATUS(status, "adding initialRotation attribute")

    ia_initialVelocity = fnNumericAttr.createPoint("initialVelocity", "inve", &status);
    MCHECKSTATUS(status, "creating initialVelocity attribute")
    status = addAttribute(ia_initialVelocity);
    MCHECKSTATUS(status, "adding initialVelocity attribute")

    ia_initialSpin = fnNumericAttr.createPoint("initialSpin", "insp", &status);
    MCHECKSTATUS(status, "creating initialSpin attribute")
    status = addAttribute(ia_initialSpin);
    MCHECKSTATUS(status, "adding initialSpin attribute")

	ia_externalForce = fnNumericAttr.createPoint("externalForce", "exfo", &status);
    MCHECKSTATUS(status, "creating externalForce attribute")
    status = addAttribute(ia_externalForce);
    MCHECKSTATUS(status, "adding externalForce attribute")

	ia_externalTorque = fnNumericAttr.createPoint("externalTorque", "exto", &status);
    MCHECKSTATUS(status, "creating externalTorque attribute")
    status = addAttribute(ia_externalTorque);
    MCHECKSTATUS(status, "adding externalTorque attribute")

    ca_rigidBody = fnNumericAttr.create("ca_rigidBody", "carb", MFnNumericData::kBoolean, 0, &status);
    MCHECKSTATUS(status, "creating ca_rigidBody attribute")
    fnNumericAttr.setConnectable(false);
    fnNumericAttr.setHidden(true);
    fnNumericAttr.setStorable(false);
    fnNumericAttr.setKeyable(false);
    status = addAttribute(ca_rigidBody);
    MCHECKSTATUS(status, "adding ca_rigidBody attribute")

    ca_rigidBodyParam = fnNumericAttr.create("ca_rigidBodyParam", "carbp", MFnNumericData::kBoolean, 0, &status);
    MCHECKSTATUS(status, "creating ca_rigidBodyParam attribute")
    fnNumericAttr.setConnectable(false);
    fnNumericAttr.setHidden(true);
    fnNumericAttr.setStorable(false);
    fnNumericAttr.setKeyable(false);
    status = addAttribute(ca_rigidBodyParam);
    MCHECKSTATUS(status, "adding ca_rigidBodyParam attribute")

    ca_solver = fnNumericAttr.create("ca_solver", "caso", MFnNumericData::kBoolean, 0, &status);
    MCHECKSTATUS(status, "creating ca_solver attribute")
    fnNumericAttr.setConnectable(false);
    fnNumericAttr.setHidden(true);
    fnNumericAttr.setStorable(false);
    fnNumericAttr.setKeyable(false);
    status = addAttribute(ca_solver);
    MCHECKSTATUS(status, "adding ca_solver attribute")

	oa_contactCount = fnNumericAttr.create("contactCount", "contactCount", MFnNumericData::kInt, 0, &status);
    MCHECKSTATUS(status, "creating oa_contactCount attribute")
    fnNumericAttr.setConnectable(true);
    fnNumericAttr.setHidden(true);
    fnNumericAttr.setStorable(false);
    fnNumericAttr.setKeyable(false);
    status = addAttribute(oa_contactCount);
    MCHECKSTATUS(status, "adding oa_contactCount attribute");

	MFnStringArrayData stringArrayData;
	oa_contactName = typedAttr.create("contactName", "contactName", MFnData::kStringArray, stringArrayData.create(), &status);
	MCHECKSTATUS(status, "creating oa_contactName attribute")
	typedAttr.setHidden(true);
	status = addAttribute(oa_contactName);
	MCHECKSTATUS(status, "adding oa_contactName attribute");

	oa_contactPosition = typedAttr.create("contactPosition", "contactPosition", MFnVectorArrayData::kVectorArray, &status);	 
	MCHECKSTATUS(status, "creating oa_contactPosition attribute")
	typedAttr.setHidden(true);
    status = addAttribute(oa_contactPosition);
	MCHECKSTATUS(status, "adding oa_contactPosition attribute");

	status = attributeAffects(ia_mass, ca_rigidBody);
    MCHECKSTATUS(status, "adding attributeAffects(ia_mass, ca_rigidBodyParam)")

    status = attributeAffects(ia_collisionShape, ca_rigidBody);
    MCHECKSTATUS(status, "adding attributeAffects(ia_collisionShape, ca_rigidBody)")

    status = attributeAffects(ia_collisionShape, ca_rigidBodyParam);
    MCHECKSTATUS(status, "adding attributeAffects(ia_collisionShape, ca_rigidBodyParam)")

    status = attributeAffects(ia_mass, ca_rigidBodyParam);
    MCHECKSTATUS(status, "adding attributeAffects(ia_mass, ca_rigidBodyParam)")

    status = attributeAffects(ia_restitution, ca_rigidBodyParam);
    MCHECKSTATUS(status, "adding attributeAffects(ia_restitution, ca_rigidBodyParam)")

    status = attributeAffects(ia_friction, ca_rigidBodyParam);
    MCHECKSTATUS(status, "adding attributeAffects(ia_friction, ca_rigidBodyParam)")

    status = attributeAffects(ia_linearDamping, ca_rigidBodyParam);
    MCHECKSTATUS(status, "adding attributeAffects(ia_linearDamping, ca_rigidBodyParam)")

    status = attributeAffects(ia_angularDamping, ca_rigidBodyParam);
    MCHECKSTATUS(status, "adding attributeAffects(ia_angularDamping, ca_rigidBodyParam)")

    status = attributeAffects(ia_initialPosition, ca_rigidBodyParam);
    MCHECKSTATUS(status, "adding attributeAffects(ia_initialPosition, ca_rigidBodyParam)")

    status = attributeAffects(ia_solver, ca_solver);
    MCHECKSTATUS(status, "adding attributeAffects(ia_solver, ca_solver)")


    return MS::kSuccess;
}
コード例 #12
0
MStatus liqSurfaceNode::initialize()
{
  MFnTypedAttribute   tAttr;
  MFnStringData       tDefault;
  MFnNumericAttribute nAttr;
  MFnEnumAttribute    eAttr;
  MFnMessageAttribute mAttr;
  MFnLightDataAttribute lAttr;
  MStatus status;

  // Create input attributes

  aRmanShader = tAttr.create( MString("rmanShader"), MString("rms"), MFnData::kString, aRmanShader, &status );
  MAKE_INPUT(tAttr);

  aRmanShaderLong = tAttr.create( MString("rmanShaderLong"), MString("rml"), MFnData::kString, aRmanShaderLong, &status );
  MAKE_INPUT(tAttr);

  aRmanShaderLif = tAttr.create(  MString("rmanShaderLif"),  MString("lif"), MFnData::kString, aRmanShaderLif, &status );
  MAKE_INPUT(tAttr);

  aRmanParams = tAttr.create(  MString("rmanParams"),  MString("rpr"), MFnData::kStringArray, aRmanParams, &status );
  MAKE_INPUT(tAttr);

  aRmanDetails = tAttr.create(  MString("rmanDetails"),  MString("rdt"), MFnData::kStringArray, aRmanDetails, &status );
  MAKE_INPUT(tAttr);

  aRmanTypes = tAttr.create(  MString("rmanTypes"),  MString("rty"), MFnData::kStringArray, aRmanTypes, &status );
  MAKE_INPUT(tAttr);

  aRmanDefaults = tAttr.create(  MString("rmanDefaults"),  MString("rdf"), MFnData::kStringArray, aRmanDefaults, &status );
  MAKE_INPUT(tAttr);

  aRmanArraySizes = tAttr.create(  MString("rmanArraySizes"),  MString("ras"), MFnData::kIntArray, aRmanArraySizes, &status );
  MAKE_INPUT(tAttr);

  aRmanLifCmds = tAttr.create(  MString("rmanLifCmds"),  MString("rlc"), MFnData::kStringArray, aRmanLifCmds, &status );
  MAKE_INPUT(tAttr);

  aPreviewPrimitive = eAttr.create( "previewPrimitive", "pvp", 7, &status );
  eAttr.addField( "Sphere",   0 );
  eAttr.addField( "Cube",     1 );
  eAttr.addField( "Cylinder", 2 );
  eAttr.addField( "Torus",    3 );
  eAttr.addField( "Plane",    4 );
  eAttr.addField( "Teapot",   5 );
  eAttr.addField( "Custom",   6 );
  eAttr.addField( "(globals)",7 );
  MAKE_NONKEYABLE_INPUT(eAttr);
  CHECK_MSTATUS(eAttr.setConnectable(false));

  aPreviewCustomPrimitive = tAttr.create(  MString("previewCustomPrimitive"),  MString("pcp"), MFnData::kString, aPreviewCustomPrimitive, &status );
  MAKE_INPUT(tAttr);

  aPreviewCustomBackplane = tAttr.create(  MString("previewCustomBackplane"),  MString("pcb"), MFnData::kString, aPreviewCustomBackplane, &status );
  MAKE_INPUT(tAttr);

  aPreviewCustomLightRig = tAttr.create(  MString("previewCustomLights"),  MString("pcl"), MFnData::kString, aPreviewCustomLightRig, &status );
  MAKE_INPUT(tAttr);

  aPreviewObjectSize = nAttr.create("previewObjectSize", "pos", MFnNumericData::kDouble, 1.0, &status);
  MAKE_NONKEYABLE_INPUT(nAttr);
  CHECK_MSTATUS(nAttr.setConnectable(false));

  aPreviewPixelSamples = nAttr.create("previewPixelSamples", "pxs",  MFnNumericData::kInt, 3, &status);
  MAKE_NONKEYABLE_INPUT(nAttr);
  CHECK_MSTATUS(nAttr.setConnectable(false));

  aPreviewShadingRate = nAttr.create("previewShadingRate", "psr", MFnNumericData::kDouble, 1.0, &status);
  MAKE_NONKEYABLE_INPUT(nAttr);
  CHECK_MSTATUS(nAttr.setConnectable(false));

  aPreviewBackplane = nAttr.create("previewBackplane", "pbp", MFnNumericData::kBoolean, true, &status);
  MAKE_NONKEYABLE_INPUT(nAttr);
  CHECK_MSTATUS(nAttr.setConnectable(false));

  aPreviewIntensity = nAttr.create("previewIntensity", "pi", MFnNumericData::kDouble, 1.0, &status);
  MAKE_NONKEYABLE_INPUT(nAttr);
  CHECK_MSTATUS(nAttr.setConnectable(false));

  aGLPreviewTexture = nAttr.createColor("GLPreviewTexture", "gpt");
  nAttr.setDefault( -1.0, -1.0, -1.0 );
  nAttr.setDisconnectBehavior( MFnAttribute::kReset );
  MAKE_INPUT(nAttr);



  aColor = nAttr.createColor("color", "cs");
  nAttr.setDefault( 1.0, 1.0, 1.0 );
  nAttr.setDisconnectBehavior( MFnAttribute::kReset );
  MAKE_INPUT(nAttr);

  aOpacity = nAttr.createColor("opacity", "os");
  nAttr.setDefault( 1.0, 1.0, 1.0 );
  MAKE_INPUT(nAttr);

  aShaderSpace = tAttr.create( MString("shaderSpace"), MString("ssp"), MFnData::kString, aShaderSpace, &status );
  MAKE_INPUT(tAttr);

  aDisplacementBound = nAttr.create("displacementBound", "db", MFnNumericData::kDouble, 0.0, &status);
  MAKE_INPUT(nAttr);

  MObject defaultSpaceObj = tDefault.create( MString("shader"), &status);
  aDisplacementBoundSpace = tAttr.create( MString("displacementBoundSpace"), MString("dbs"), MFnData::kString, defaultSpaceObj, &status );
  MAKE_INPUT(tAttr);

  aOutputInShadow = nAttr.create("outputInShadow", "ois",  MFnNumericData::kBoolean, 0.0, &status);
  MAKE_NONKEYABLE_INPUT(nAttr);

  // resolution attribute for maya's hardware renderer
  aResolution = nAttr.create("resolution", "res",  MFnNumericData::kInt, 8, &status);
  CHECK_MSTATUS(nAttr.setStorable( true ));
  CHECK_MSTATUS(nAttr.setReadable( true ));
  CHECK_MSTATUS(nAttr.setWritable( true ));
  CHECK_MSTATUS(nAttr.setHidden( true ));

  // refreshPreview must be true to allow refresh
  aRefreshPreview = nAttr.create("refreshPreview", "rfp",  MFnNumericData::kBoolean, 0.0, &status);
  MAKE_NONKEYABLE_INPUT(nAttr);
  CHECK_MSTATUS(nAttr.setHidden(true));

  // dynamic shader attr
  aCi = nAttr.createColor("Ci", "ci");
  nAttr.setDefault( 1.0, 1.0, 1.0 );
  MAKE_INPUT(nAttr);

  aOi = nAttr.createColor("Oi", "oi");
  nAttr.setDefault( 1.0, 1.0, 1.0 );
  MAKE_INPUT(nAttr);


  // create attributes for maya renderer

  // lambertian control
  aMayaIgnoreLights = nAttr.create("mayaIgnoreLights", "mil",  MFnNumericData::kBoolean, 0.0, &status);
  MAKE_INPUT(nAttr);
  aMayaKa = nAttr.create("mayaKa", "mka", MFnNumericData::kFloat, 0.2, &status);
  MAKE_INPUT(nAttr);
  aMayaKd = nAttr.create("mayaKd", "mkd", MFnNumericData::kFloat, 0.8, &status);
  MAKE_INPUT(nAttr);

  // Camera Normals
  aNormalCameraX = nAttr.create( "normalCameraX", "nx", MFnNumericData::kFloat, 0, &status );
  CHECK_MSTATUS( status );
  CHECK_MSTATUS( nAttr.setStorable( false ) );
  CHECK_MSTATUS( nAttr.setDefault( 1.0f ) );
  aNormalCameraY = nAttr.create( "normalCameraY", "ny", MFnNumericData::kFloat, 0, &status );
  CHECK_MSTATUS( status );
  CHECK_MSTATUS( nAttr.setStorable( false ) );
  CHECK_MSTATUS( nAttr.setDefault( 1.0f ) );
  aNormalCameraZ = nAttr.create( "normalCameraZ", "nz", MFnNumericData::kFloat, 0, &status );
  CHECK_MSTATUS( status );
  CHECK_MSTATUS( nAttr.setStorable( false ) );
  CHECK_MSTATUS( nAttr.setDefault( 1.0f ) );
  aNormalCamera = nAttr.create( "normalCamera","n", aNormalCameraX, aNormalCameraY, aNormalCameraZ, &status );
  CHECK_MSTATUS( status );
  CHECK_MSTATUS( nAttr.setStorable( false ) );
  CHECK_MSTATUS( nAttr.setDefault( 1.0f, 1.0f, 1.0f ) );
  CHECK_MSTATUS( nAttr.setHidden( true ) );

  // Light Direction
  aLightDirectionX = nAttr.create( "lightDirectionX", "ldx", MFnNumericData::kFloat, 0, &status );
  CHECK_MSTATUS( status );
  CHECK_MSTATUS( nAttr.setStorable( false ) );
  CHECK_MSTATUS( nAttr.setHidden( true ) );
  CHECK_MSTATUS( nAttr.setReadable( false ) );
  CHECK_MSTATUS( nAttr.setDefault( 1.0f ) );
  aLightDirectionY = nAttr.create( "lightDirectionY", "ldy", MFnNumericData::kFloat, 0, &status );
  CHECK_MSTATUS( status );
  CHECK_MSTATUS( nAttr.setStorable( false ) );
  CHECK_MSTATUS( nAttr.setHidden( true ) );
  CHECK_MSTATUS( nAttr.setReadable( false ) );
  CHECK_MSTATUS( nAttr.setDefault( 1.0f ) );
  aLightDirectionZ = nAttr.create( "lightDirectionZ", "ldz", MFnNumericData::kFloat, 0, &status );
  CHECK_MSTATUS( status );
  CHECK_MSTATUS( nAttr.setStorable( false ) );
  CHECK_MSTATUS( nAttr.setHidden( true ) );
  CHECK_MSTATUS( nAttr.setReadable( false ) );
  CHECK_MSTATUS( nAttr.setDefault( 1.0f ) );
  aLightDirection = nAttr.create( "lightDirection", "ld", aLightDirectionX, aLightDirectionY, aLightDirectionZ, &status );
  CHECK_MSTATUS( status );
  CHECK_MSTATUS( nAttr.setStorable( false ) );
  CHECK_MSTATUS( nAttr.setHidden( true ) );
  CHECK_MSTATUS( nAttr.setReadable( false ) );
  CHECK_MSTATUS( nAttr.setDefault( 1.0f, 1.0f, 1.0f ) );

  // Light Intensity
  aLightIntensityR = nAttr.create( "lightIntensityR", "lir", MFnNumericData::kFloat, 0, &status );
  CHECK_MSTATUS( status );
  CHECK_MSTATUS( nAttr.setStorable( false ) );
  CHECK_MSTATUS( nAttr.setHidden( true ) );
  CHECK_MSTATUS( nAttr.setReadable( false ) );
  CHECK_MSTATUS( nAttr.setDefault( 1.0f ) );
  aLightIntensityG = nAttr.create( "lightIntensityG", "lig", MFnNumericData::kFloat, 0, &status );
  CHECK_MSTATUS( status );
  CHECK_MSTATUS( nAttr.setStorable( false ) );
  CHECK_MSTATUS( nAttr.setHidden( true ) );
  CHECK_MSTATUS( nAttr.setReadable( false ) );
  CHECK_MSTATUS( nAttr.setDefault( 1.0f ) );
  aLightIntensityB = nAttr.create( "lightIntensityB", "lib", MFnNumericData::kFloat, 0, &status );
  CHECK_MSTATUS( status );
  CHECK_MSTATUS( nAttr.setStorable( false ) );
  CHECK_MSTATUS( nAttr.setHidden( true ) );
  CHECK_MSTATUS( nAttr.setReadable( false ) );
  CHECK_MSTATUS( nAttr.setDefault( 1.0f ) );
  aLightIntensity = nAttr.create( "lightIntensity", "li", aLightIntensityR, aLightIntensityG, aLightIntensityB, &status );
  CHECK_MSTATUS( status );
  CHECK_MSTATUS( nAttr.setStorable( false ) );
  CHECK_MSTATUS( nAttr.setHidden( true ) );
  CHECK_MSTATUS( nAttr.setReadable( false ) );
  CHECK_MSTATUS( nAttr.setDefault( 1.0f, 1.0f, 1.0f ) );

  // Light
  aLightAmbient = nAttr.create( "lightAmbient", "la", MFnNumericData::kBoolean, 0, &status );
  CHECK_MSTATUS( status );
  CHECK_MSTATUS( nAttr.setStorable( false ) );
  CHECK_MSTATUS( nAttr.setHidden( true ) );
  CHECK_MSTATUS( nAttr.setReadable( false ) );
  CHECK_MSTATUS( nAttr.setDefault( true ) );
  aLightDiffuse = nAttr.create( "lightDiffuse", "ldf", MFnNumericData::kBoolean, 0, &status );
  CHECK_MSTATUS( status );
  CHECK_MSTATUS( nAttr.setStorable( false ) );
  CHECK_MSTATUS( nAttr.setHidden( true ) );
  CHECK_MSTATUS( nAttr.setReadable( false ) );
  CHECK_MSTATUS( nAttr.setDefault( true ) );
  aLightSpecular = nAttr.create( "lightSpecular", "ls", MFnNumericData::kBoolean, 0, &status );
  CHECK_MSTATUS( status );
  CHECK_MSTATUS( nAttr.setStorable( false ) );
  CHECK_MSTATUS( nAttr.setHidden( true ) );
  CHECK_MSTATUS( nAttr.setReadable( false ) );
  CHECK_MSTATUS( nAttr.setDefault( false ) );
  aLightShadowFraction = nAttr.create( "lightShadowFraction", "lsf", MFnNumericData::kFloat, 0, &status );
  CHECK_MSTATUS( status );
  CHECK_MSTATUS( nAttr.setStorable( false ) );
  CHECK_MSTATUS( nAttr.setReadable( true ) );
  CHECK_MSTATUS( nAttr.setWritable( true ) );
  CHECK_MSTATUS( nAttr.setDefault( 1.0f ) );
  aPreShadowIntensity = nAttr.create( "preShadowIntensity", "psi", MFnNumericData::kFloat, 0, &status );
  CHECK_MSTATUS( status );
  CHECK_MSTATUS( nAttr.setStorable( false ) );
  CHECK_MSTATUS( nAttr.setHidden( true ) );
  CHECK_MSTATUS( nAttr.setReadable( false ) );
  CHECK_MSTATUS( nAttr.setDefault( 1.0f ) );

  #if MAYA_API_VERSION >= 800
  aLightBlindData = nAttr.createAddr( "lightBlindData", "lbld", 0, &status );
  CHECK_MSTATUS( status );
  CHECK_MSTATUS( nAttr.setStorable( false ) );
  CHECK_MSTATUS( nAttr.setHidden( true ) );
  CHECK_MSTATUS( nAttr.setReadable( false ) );
  CHECK_MSTATUS( nAttr.setDefault( (void*) 0 ) );
  #else
  aLightBlindData = nAttr.create( "lightBlindData", "lbld", MFnNumericData::kLong, 0, &status );
  CHECK_MSTATUS( status );
  CHECK_MSTATUS( nAttr.setStorable( false ) );
  CHECK_MSTATUS( nAttr.setHidden( true ) );
  CHECK_MSTATUS( nAttr.setReadable( false ) );
  CHECK_MSTATUS( nAttr.setDefault( 0 ) );
  #endif
  aLightData = lAttr.create( "lightDataArray", "ltd", aLightDirection,
                              aLightIntensity, aLightAmbient, aLightDiffuse, aLightSpecular,
                              aLightShadowFraction, aPreShadowIntensity, aLightBlindData,
                              &status );
  CHECK_MSTATUS( status );
  CHECK_MSTATUS( lAttr.setArray( true ) );
  CHECK_MSTATUS( lAttr.setStorable( false ) );
  CHECK_MSTATUS( lAttr.setHidden( true ) );
  CHECK_MSTATUS( lAttr.setDefault( 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, true, true, false, 1.0f, 1.0f, 0 ) );

  // Create output attributes
  aOutColor = nAttr.createColor("outColor", "oc");
  MAKE_OUTPUT(nAttr);
  aOutTransparency = nAttr.createColor("outTransparency", "ot");
  MAKE_OUTPUT(nAttr);
  aAssignedObjects = mAttr.create("liqAssignedObjects", "ao");
  MAKE_OUTPUT(mAttr);


  CHECK_MSTATUS(addAttribute(aRmanShader));
  CHECK_MSTATUS(addAttribute(aRmanShaderLong));
  CHECK_MSTATUS(addAttribute(aRmanShaderLif));
  CHECK_MSTATUS(addAttribute(aRmanParams));
  CHECK_MSTATUS(addAttribute(aRmanDetails));
  CHECK_MSTATUS(addAttribute(aRmanTypes));
  CHECK_MSTATUS(addAttribute(aRmanDefaults));
  CHECK_MSTATUS(addAttribute(aRmanArraySizes));
  CHECK_MSTATUS(addAttribute(aRmanLifCmds));

  CHECK_MSTATUS(addAttribute(aPreviewPrimitive));
  CHECK_MSTATUS(addAttribute(aPreviewCustomPrimitive));
  CHECK_MSTATUS(addAttribute(aPreviewCustomBackplane));
  CHECK_MSTATUS(addAttribute(aPreviewCustomLightRig));
  CHECK_MSTATUS(addAttribute(aPreviewObjectSize));
  CHECK_MSTATUS(addAttribute(aPreviewPixelSamples));
  CHECK_MSTATUS(addAttribute(aPreviewShadingRate));
  CHECK_MSTATUS(addAttribute(aPreviewBackplane));
  CHECK_MSTATUS(addAttribute(aPreviewIntensity));
  CHECK_MSTATUS(addAttribute(aGLPreviewTexture));
  CHECK_MSTATUS(addAttribute(aCi));
  CHECK_MSTATUS(addAttribute(aOi));

  CHECK_MSTATUS(addAttribute(aColor));
  CHECK_MSTATUS(addAttribute(aOpacity));
  CHECK_MSTATUS(addAttribute(aShaderSpace));
  CHECK_MSTATUS(addAttribute(aDisplacementBound));
  CHECK_MSTATUS(addAttribute(aDisplacementBoundSpace));
  CHECK_MSTATUS(addAttribute(aOutputInShadow));
  CHECK_MSTATUS(addAttribute(aResolution));
  CHECK_MSTATUS(addAttribute(aRefreshPreview));
  CHECK_MSTATUS(addAttribute(aMayaIgnoreLights));
  CHECK_MSTATUS(addAttribute(aMayaKa));
  CHECK_MSTATUS(addAttribute(aMayaKd));
  CHECK_MSTATUS(addAttribute(aNormalCamera));
  CHECK_MSTATUS(addAttribute(aLightData));
  CHECK_MSTATUS(addAttribute(aAssignedObjects));
  CHECK_MSTATUS(addAttribute(aOutColor));
  CHECK_MSTATUS(addAttribute(aOutTransparency));

  CHECK_MSTATUS(attributeAffects( aColor,               aOutColor ));
  CHECK_MSTATUS(attributeAffects( aOpacity,             aOutColor ));
  CHECK_MSTATUS(attributeAffects( aGLPreviewTexture,    aOutColor ));
  CHECK_MSTATUS(attributeAffects( aMayaIgnoreLights,    aOutColor ));
  CHECK_MSTATUS(attributeAffects( aMayaKa,              aOutColor ));
  CHECK_MSTATUS(attributeAffects( aMayaKd,              aOutColor ));
  CHECK_MSTATUS(attributeAffects( aLightIntensityR,     aOutColor ));
  CHECK_MSTATUS(attributeAffects( aLightIntensityB,     aOutColor ));
  CHECK_MSTATUS(attributeAffects( aLightIntensityG,     aOutColor ));
  CHECK_MSTATUS(attributeAffects( aLightIntensity,      aOutColor ));
  CHECK_MSTATUS(attributeAffects( aNormalCameraX,       aOutColor ));
  CHECK_MSTATUS(attributeAffects( aNormalCameraY,       aOutColor ));
  CHECK_MSTATUS(attributeAffects( aNormalCameraZ,       aOutColor ));
  CHECK_MSTATUS(attributeAffects( aNormalCamera,        aOutColor ));
  CHECK_MSTATUS(attributeAffects( aLightDirectionX,     aOutColor ));
  CHECK_MSTATUS(attributeAffects( aLightDirectionY,     aOutColor ));
  CHECK_MSTATUS(attributeAffects( aLightDirectionZ,     aOutColor ));
  CHECK_MSTATUS(attributeAffects( aLightDirection,      aOutColor ));
  CHECK_MSTATUS(attributeAffects( aLightAmbient,        aOutColor ));
  CHECK_MSTATUS(attributeAffects( aLightSpecular,       aOutColor ));
  CHECK_MSTATUS(attributeAffects( aLightDiffuse,        aOutColor ));
  CHECK_MSTATUS(attributeAffects( aLightShadowFraction, aOutColor ));
  CHECK_MSTATUS(attributeAffects( aPreShadowIntensity,  aOutColor ));
  CHECK_MSTATUS(attributeAffects( aLightBlindData,      aOutColor ));
  CHECK_MSTATUS(attributeAffects( aLightData,           aOutColor ));

  return MS::kSuccess;
}
コード例 #13
0
MStatus sixdofConstraintNode::initialize()
{
    MStatus status;
    MFnMessageAttribute fnMsgAttr;
    MFnNumericAttribute fnNumericAttr;
    MFnMatrixAttribute fnMatrixAttr;

    ia_rigidBodyA = fnMsgAttr.create("inRigidBodyA", "inrbA", &status);
    MCHECKSTATUS(status, "creating inRigidBodyA attribute")
    status = addAttribute(ia_rigidBodyA);
    MCHECKSTATUS(status, "adding inRigidBody attribute")

    ia_rigidBodyB = fnMsgAttr.create("inRigidBodyB", "inrbB", &status);
    MCHECKSTATUS(status, "creating inRigidBodyB attribute")
    status = addAttribute(ia_rigidBodyB);
    MCHECKSTATUS(status, "adding inRigidBodyB attribute")

	ia_damping = fnNumericAttr.create("damping", "dmp", MFnNumericData::kDouble, 1.0, &status);
    MCHECKSTATUS(status, "creating damping attribute")
    fnNumericAttr.setKeyable(true);
    status = addAttribute(ia_damping);
    MCHECKSTATUS(status, "adding damping attribute")

    ia_lowerLinLimit = fnNumericAttr.create("lowerLinLimit", "lllt", MFnNumericData::kDouble, 1, &status);
    MCHECKSTATUS(status, "creating lower linear limit attribute")
    fnNumericAttr.setKeyable(true);
    status = addAttribute(ia_lowerLinLimit);
    MCHECKSTATUS(status, "adding lower linear limit attribute")

	ia_upperLinLimit = fnNumericAttr.create("upperLinLimit", "ullt", MFnNumericData::kDouble, -1, &status);
    MCHECKSTATUS(status, "creating upper linear limit attribute")
    fnNumericAttr.setKeyable(true);
    status = addAttribute(ia_upperLinLimit);
    MCHECKSTATUS(status, "adding upper linear limit attribute")

    ia_lowerAngLimit = fnNumericAttr.create("lowerAngLimit", "lalt", MFnNumericData::kDouble, 0, &status);
    MCHECKSTATUS(status, "creating lower angular limit attribute")
    fnNumericAttr.setKeyable(true);
    status = addAttribute(ia_lowerAngLimit);
    MCHECKSTATUS(status, "adding lower angular limit attribute")

	ia_upperAngLimit = fnNumericAttr.create("upperAngLimit", "ualt", MFnNumericData::kDouble, 0, &status);
    MCHECKSTATUS(status, "creating upper angular limit attribute")
    fnNumericAttr.setKeyable(true);
    status = addAttribute(ia_upperAngLimit);
    MCHECKSTATUS(status, "adding upper angular limit attribute")

	ca_constraint = fnNumericAttr.create("ca_constraint", "caco", MFnNumericData::kBoolean, 0, &status);
    MCHECKSTATUS(status, "creating ca_constraint attribute")
    fnNumericAttr.setConnectable(false);
    fnNumericAttr.setHidden(true);
    fnNumericAttr.setStorable(false);
    fnNumericAttr.setKeyable(false);
    status = addAttribute(ca_constraint);
    MCHECKSTATUS(status, "adding ca_constraint attribute")

    ca_constraintParam = fnNumericAttr.create("ca_constraintParam", "cacop", MFnNumericData::kBoolean, 0, &status);
    MCHECKSTATUS(status, "creating ca_constraintParam attribute")
    fnNumericAttr.setConnectable(false);
    fnNumericAttr.setHidden(true);
    fnNumericAttr.setStorable(false);
    fnNumericAttr.setKeyable(false);
    status = addAttribute(ca_constraintParam);
    MCHECKSTATUS(status, "adding ca_constraintParam attribute")


    status = attributeAffects(ia_rigidBodyA, ca_constraint);
    MCHECKSTATUS(status, "adding attributeAffects(ia_rigidBodyA, ca_constraint)")

    status = attributeAffects(ia_rigidBodyA, ca_constraintParam);
    MCHECKSTATUS(status, "adding attributeAffects(ia_rigidBodyA, ca_constraintParam)")

    status = attributeAffects(ia_rigidBodyB, ca_constraint);
    MCHECKSTATUS(status, "adding attributeAffects(ia_rigidBodyB, ca_constraint)")

    status = attributeAffects(ia_rigidBodyB, ca_constraintParam);
    MCHECKSTATUS(status, "adding attributeAffects(ia_rigidBodyB, ca_constraintParam)")

	status = attributeAffects(ia_damping, ca_constraintParam);
    MCHECKSTATUS(status, "adding attributeAffects(ia_damping, ca_constraintParam)")

    status = attributeAffects(ia_lowerLinLimit, ca_constraintParam);
    MCHECKSTATUS(status, "adding attributeAffects(ia_lowerLinLimit, ca_constraintParam)")

	status = attributeAffects(ia_upperLinLimit, ca_constraintParam);
    MCHECKSTATUS(status, "adding attributeAffects(ia_upperLinLimit, ca_constraintParam)")

    status = attributeAffects(ia_lowerAngLimit, ca_constraintParam);
    MCHECKSTATUS(status, "adding attributeAffects(ia_lowerAngLimit, ca_constraintParam)")

	status = attributeAffects(ia_upperAngLimit, ca_constraintParam);
    MCHECKSTATUS(status, "adding attributeAffects(ia_upperAngLimit, ca_constraintParam)")

	return MS::kSuccess;
}
コード例 #14
0
MStatus VmIslandNode::initialize()
{
    fprintf( stderr, "VmIslandNode::initialize()...\n" );
    
    MStatus status;
    
    //Seed attribute
    {
        MFnNumericAttribute numericAttrFn;
        ia_seed = numericAttrFn.create( "seed", "sD", MFnNumericData::kLong, 0, & status );
        CHECK_MSTATUS( status );
        numericAttrFn.setReadable( true );
        numericAttrFn.setWritable( true );
        numericAttrFn.setStorable( true );
        numericAttrFn.setKeyable( true );
        numericAttrFn.setConnectable( true );
        numericAttrFn.setHidden( false );
        numericAttrFn.setMin( 0 );
        numericAttrFn.setMax( 1000 );
        numericAttrFn.setDefault ( 0 );
        status = addAttribute( ia_seed );
        CHECK_MSTATUS( status );
    }
    
    //Roughness attribute
    {
        MFnNumericAttribute numericAttrFn;
        ia_roughness = numericAttrFn.create( "roughness", "rG", MFnNumericData::kFloat, 0, & status );
        CHECK_MSTATUS( status );
        numericAttrFn.setReadable( true );
        numericAttrFn.setWritable( true );
        numericAttrFn.setStorable( true );
        numericAttrFn.setKeyable( true );
        numericAttrFn.setConnectable( true );
        numericAttrFn.setHidden( false );
        numericAttrFn.setMin( 0 );
        numericAttrFn.setMax( 1 );
        numericAttrFn.setDefault ( 0.75 );
        status = addAttribute( ia_roughness );
        CHECK_MSTATUS( status );
    }
    
    //Plane Height attribute
    {
        MFnNumericAttribute numericAttrFn;
        ia_planeHeight = numericAttrFn.create( "planeHeight", "pH", MFnNumericData::kLong, 0, & status );
        CHECK_MSTATUS( status );
        numericAttrFn.setReadable( true );
        numericAttrFn.setWritable( true );
        numericAttrFn.setStorable( true );
        numericAttrFn.setKeyable( true );
        numericAttrFn.setConnectable( true );
        numericAttrFn.setHidden( false );
        numericAttrFn.setMin( 0 );
        numericAttrFn.setMax( 2000 );
        numericAttrFn.setDefault ( 5 );
        status = addAttribute( ia_planeHeight );
        CHECK_MSTATUS( status );
    }

     //Plane smoothing attribute
    {
        MFnNumericAttribute numericAttrFn;
        ia_smooth = numericAttrFn.create( "smoothingStrength", "sS", MFnNumericData::kLong, 0, & status );
        CHECK_MSTATUS( status );
        numericAttrFn.setReadable( true );
        numericAttrFn.setWritable( true );
        numericAttrFn.setStorable( true );
        numericAttrFn.setKeyable( true );
        numericAttrFn.setConnectable( true );
        numericAttrFn.setHidden( false );
        numericAttrFn.setMin( 0 );
        numericAttrFn.setMax( 6 );
        numericAttrFn.setDefault ( 1 );
        status = addAttribute( ia_smooth );
        CHECK_MSTATUS( status );
    }
    
     //Plane resolution attribute
    {
        MFnNumericAttribute numericAttrFn;
        ia_resolution = numericAttrFn.create( "mayaResolution", "mR", MFnNumericData::kLong, 0, & status );
        CHECK_MSTATUS( status );
        numericAttrFn.setReadable( true );
        numericAttrFn.setWritable( true );
        numericAttrFn.setStorable( true );
        numericAttrFn.setKeyable( true );
        numericAttrFn.setConnectable( true );
        numericAttrFn.setHidden( false );
        numericAttrFn.setMin( 1 );
        numericAttrFn.setMax( 10 );
        numericAttrFn.setDefault ( 1 );
        status = addAttribute( ia_resolution );
        CHECK_MSTATUS( status );
    }

    //Renderman resolution attribute
    {
        MFnNumericAttribute numericAttrFn;
        ia_rmanResolution = numericAttrFn.create( "rendermanResolution", "rR", MFnNumericData::kLong, 0, & status );
        CHECK_MSTATUS( status );
        numericAttrFn.setReadable( true );
        numericAttrFn.setWritable( true );
        numericAttrFn.setStorable( true );
        numericAttrFn.setKeyable( true );
        numericAttrFn.setConnectable( true );
        numericAttrFn.setHidden( false );
        numericAttrFn.setMin( 1 );
        numericAttrFn.setMax( 10 );
        numericAttrFn.setDefault ( 6 );
        status = addAttribute( ia_rmanResolution );
        CHECK_MSTATUS( status );
    }

    //Plane size attribute
    {
        MFnNumericAttribute numericAttrFn;
        ia_planeSize = numericAttrFn.create( "planeSizeScale", "pS", MFnNumericData::kLong, 0, & status );
        CHECK_MSTATUS( status );
        numericAttrFn.setReadable( true );
        numericAttrFn.setWritable( true );
        numericAttrFn.setStorable( true );
        numericAttrFn.setKeyable( true );
        numericAttrFn.setConnectable( true );
        numericAttrFn.setHidden( false );
        numericAttrFn.setMin( 1 );
        numericAttrFn.setMax( 200 );
        numericAttrFn.setDefault ( 20 );
        status = addAttribute( ia_planeSize );
        CHECK_MSTATUS( status );
    }


     //Plane size attribute
    {
        MFnNumericAttribute numericAttrFn;
        ia_gridSize = numericAttrFn.create( "gridSize", "gS", MFnNumericData::kLong, 0, & status );
        CHECK_MSTATUS( status );
        numericAttrFn.setReadable( true );
        numericAttrFn.setWritable( true );
        numericAttrFn.setStorable( true );
        numericAttrFn.setKeyable( true );
        numericAttrFn.setConnectable( true );
        numericAttrFn.setHidden( false );
        numericAttrFn.setMin( 1 );
        numericAttrFn.setMax( 10 );
        numericAttrFn.setDefault ( 1 );
        status = addAttribute( ia_gridSize );
        CHECK_MSTATUS( status );
    }

     //Grass multiplier - Affects how many instances are spawned
    {
        MFnNumericAttribute numericAttrFn;
        ia_grassMultiplier = numericAttrFn.create( "grassInstanceMultiplier", "gM", MFnNumericData::kLong, 0, & status );
        CHECK_MSTATUS( status );
        numericAttrFn.setReadable( true );
        numericAttrFn.setWritable( true );
        numericAttrFn.setStorable( true );
        numericAttrFn.setKeyable( true );
        numericAttrFn.setConnectable( true );
        numericAttrFn.setHidden( false );
        numericAttrFn.setMin( 1 );
        numericAttrFn.setMax( 100 );
        numericAttrFn.setDefault ( 1 );
        status = addAttribute( ia_grassMultiplier );
        CHECK_MSTATUS( status );
    }


        //Grass multiplier - Affects how many instances are spawned
    {
        MFnNumericAttribute numericAttrFn;
        ia_baseWidth = numericAttrFn.create( "grassBaseWidth", "bW", MFnNumericData::kFloat, 0, & status );
        CHECK_MSTATUS( status );
        numericAttrFn.setReadable( true );
        numericAttrFn.setWritable( true );
        numericAttrFn.setStorable( true );
        numericAttrFn.setKeyable( true );
        numericAttrFn.setConnectable( true );
        numericAttrFn.setHidden( false );
        numericAttrFn.setMin( 0.01f );
        numericAttrFn.setMax( 2.0f ); 
        numericAttrFn.setDefault ( 0.6f );
        status = addAttribute( ia_baseWidth );
        CHECK_MSTATUS( status );
    }



    //Grass segment length - Length of segment pieces
    {
        MFnNumericAttribute numericAttrFn;
        ia_grassSegmentLength = numericAttrFn.create( "grassSegmentLength", "gSL", MFnNumericData::kFloat, 0, & status );
        CHECK_MSTATUS( status );
        numericAttrFn.setReadable( true );
        numericAttrFn.setWritable( true );
        numericAttrFn.setStorable( true );
        numericAttrFn.setKeyable( true );
        numericAttrFn.setConnectable( true );
        numericAttrFn.setHidden( false );
        numericAttrFn.setMin( 0.001f );
        numericAttrFn.setMax( 10.0f );
        numericAttrFn.setDefault ( 1.0f );
        status = addAttribute( ia_grassSegmentLength );
        CHECK_MSTATUS( status );
    }

     //Number of segments per piece of grass
    {
        MFnNumericAttribute numericAttrFn;
        ia_grassNumSegments = numericAttrFn.create( "numberOfGrassSegments", "nGS", MFnNumericData::kLong, 0, & status );
        CHECK_MSTATUS( status );
        numericAttrFn.setReadable( true );
        numericAttrFn.setWritable( true );
        numericAttrFn.setStorable( true );
        numericAttrFn.setKeyable( true );
        numericAttrFn.setConnectable( true );
        numericAttrFn.setHidden( false );
        numericAttrFn.setMin( 3 );
        numericAttrFn.setMax( 20 );
        numericAttrFn.setDefault ( 5 );
        status = addAttribute( ia_grassNumSegments );
        CHECK_MSTATUS( status );
    }

    //Initial grass bend direction
    {
        MFnNumericAttribute numericAttrFn;
        ia_windDirection = numericAttrFn.createPoint( "windDirection", "wDir");
        CHECK_MSTATUS( status );
        numericAttrFn.setReadable( true );
        numericAttrFn.setWritable( true );
        numericAttrFn.setStorable( true );
        numericAttrFn.setKeyable( true );
        numericAttrFn.setConnectable( true );
        numericAttrFn.setHidden( false );
        numericAttrFn.setDefault(1.0f, 0.0f, 1.0f);
        status = addAttribute( ia_windDirection );
        CHECK_MSTATUS( status );
    }

    //Grass bend factor
    {
        MFnNumericAttribute numericAttrFn;
        ia_grassBendAmount = numericAttrFn.create( "grassBendFactor", "gBF", MFnNumericData::kFloat, 0, & status );
        CHECK_MSTATUS( status );
        numericAttrFn.setReadable( true );
        numericAttrFn.setWritable( true );
        numericAttrFn.setStorable( true );
        numericAttrFn.setKeyable( true );
        numericAttrFn.setConnectable( true );
        numericAttrFn.setHidden( false );
        numericAttrFn.setMin( 0.0f );
        numericAttrFn.setMax( 1.0f );
        numericAttrFn.setDefault ( 0.0f );
        status = addAttribute( ia_grassBendAmount );
        CHECK_MSTATUS( status );
    }

    //Wind strength
    {
        MFnNumericAttribute numericAttrFn;
        ia_windSpread = numericAttrFn.create( "windSpread", "wS", MFnNumericData::kFloat, 0, & status );
        CHECK_MSTATUS( status );
        numericAttrFn.setReadable( true );
        numericAttrFn.setWritable( true );
        numericAttrFn.setStorable( true );
        numericAttrFn.setKeyable( true );
        numericAttrFn.setConnectable( true );
        numericAttrFn.setHidden( false );
        numericAttrFn.setMin( 0.01f );
        numericAttrFn.setMax( 10.0f );
        numericAttrFn.setDefault ( 5.0f );
        status = addAttribute( ia_windSpread );
        CHECK_MSTATUS( status );
    }



        //Initial grass bend direction
    {
        MFnNumericAttribute numericAttrFn;
        ia_grassBaseColour1 = numericAttrFn.createColor( "grassBaseColour1", "bCol1");
        CHECK_MSTATUS( status );
        numericAttrFn.setReadable( true );
        numericAttrFn.setWritable( true );
        numericAttrFn.setStorable( true );
        numericAttrFn.setKeyable( true );
        numericAttrFn.setConnectable( true );
        numericAttrFn.setHidden( false );
        numericAttrFn.setDefault(0.0f,0.251f,0.167f);
        status = addAttribute( ia_grassBaseColour1 );
        CHECK_MSTATUS( status );
    }

            //Initial grass bend direction
    {
        MFnNumericAttribute numericAttrFn;
        ia_grassTipColour1 = numericAttrFn.createColor( "grassTipColour1", "tCol1");
        CHECK_MSTATUS( status );
        numericAttrFn.setReadable( true );
        numericAttrFn.setWritable( true );
        numericAttrFn.setStorable( true );
        numericAttrFn.setKeyable( true );
        numericAttrFn.setConnectable( true );
        numericAttrFn.setHidden( false );
        numericAttrFn.setDefault(0.395f,0.551f,0.257f);
        status = addAttribute( ia_grassTipColour1 );
        CHECK_MSTATUS( status );
    }

            //Initial grass bend direction
    {
        MFnNumericAttribute numericAttrFn;
        ia_grassBaseColour2 = numericAttrFn.createColor( "grassBaseColour2", "bCol2");
        CHECK_MSTATUS( status );
        numericAttrFn.setReadable( true );
        numericAttrFn.setWritable( true );
        numericAttrFn.setStorable( true );
        numericAttrFn.setKeyable( true );
        numericAttrFn.setConnectable( true );
        numericAttrFn.setHidden( false );
        numericAttrFn.setDefault(0.275f,0.243f,0.043f);
        status = addAttribute( ia_grassBaseColour2 );
        CHECK_MSTATUS( status );
    }

            //Initial grass bend direction
    {
        MFnNumericAttribute numericAttrFn;
        ia_grassTipColour2 = numericAttrFn.createColor( "grassTipColour2", "tCol2");
        CHECK_MSTATUS( status );
        numericAttrFn.setReadable( true );
        numericAttrFn.setWritable( true );
        numericAttrFn.setStorable( true );
        numericAttrFn.setKeyable( true );
        numericAttrFn.setConnectable( true );
        numericAttrFn.setHidden( false );
        numericAttrFn.setDefault(0.611f,0.587f,0.257f);
        status = addAttribute( ia_grassTipColour2 );
        CHECK_MSTATUS( status );
    }





     //Clock attribute. Passes maya frame counter into node
    {
        MFnNumericAttribute numericAttrFn;
        ia_clock = numericAttrFn.create( "clock", "clk", MFnNumericData::kLong, false, & status );
        CHECK_MSTATUS( status );
        numericAttrFn.setReadable( true );
        numericAttrFn.setWritable( true );
        numericAttrFn.setStorable( false );
        numericAttrFn.setKeyable( true );
        numericAttrFn.setConnectable( true );
        numericAttrFn.setHidden( false );
        numericAttrFn.setMin( 0 );
        numericAttrFn.setDefault( 0 );
        status = addAttribute( ia_clock );
        CHECK_MSTATUS( status );
    }

    
    // "drawStyle"
    //
    // How we should draw in Maya.
    //
    // We will use this value in our Maya plug-in, but we
    // will NOT use it in Renderman. Note elsewhere that
    // this value will not be sent to Renderman, nor will
    // it have any effect on RIB generation.
    //
    // We think of this as an input attribute - hence the
    // prefix "ia_" for "input attribute". 
    {
        MFnEnumAttribute enumAttrFn;
        ia_drawStyle = enumAttrFn.create( "drawStyle", "ds", 1, & status );
        CHECK_MSTATUS( status );
        enumAttrFn.setReadable( true );
        enumAttrFn.setWritable( true );
        enumAttrFn.setStorable( true );
        enumAttrFn.setKeyable( true );
        enumAttrFn.setConnectable( true );
        enumAttrFn.setHidden( false );
        enumAttrFn.addField( "Bounds", 0 );
        enumAttrFn.addField( "Sub bounds", 1 );
        enumAttrFn.addField( "Geometry", 2 );
        enumAttrFn.addField( "Terrain slope normals", 3 );
        enumAttrFn.addField( "Point instances", 4 );
        enumAttrFn.addField( "Wind Velocity", 5 );
        enumAttrFn.addField( "All", 6 );
        enumAttrFn.setDefault(3);
        status = addAttribute( ia_drawStyle );
        CHECK_MSTATUS( status );
    }
    
    // "update"
    //
    // A 'dummy' attribute, and a powerful one. Although
    // the value of this attribute is actually meaningless,
    // when we ask for it we trigger an important computation
    // processs.
    //
    // We think of this as an input attribute - hence the
    // prefix "oa_" for "computation attribute". This signifies
    // that we don't really care about it's final value, but
    // that we know it's going to compute a lot of stuff. 
    {
        MFnNumericAttribute numericAttrFn;
        oa_update = numericAttrFn.create( "update", "upd", MFnNumericData::kBoolean, false, & status );
        CHECK_MSTATUS( status );
        numericAttrFn.setReadable( true );
        numericAttrFn.setWritable( true );
        numericAttrFn.setStorable( false );
        numericAttrFn.setKeyable( false );
        numericAttrFn.setConnectable( true );
        numericAttrFn.setHidden( true );
        status = addAttribute( oa_update );
        CHECK_MSTATUS( status );
    }


   
    
    
    // "rib"
    //
    // A string which contains all the attributes, and that
    //  we need to have (and indeed will see again) on the 
    // Renderman side of things.
    //
    // We think of this as an output attribute - hence the
    // prefix "oa_" for "output attribute". The value
    // computed for this attribute (the string) is important,
    // an is used by whatever is asking for it.
    {
        MFnTypedAttribute typedAttrFn;
        oa_rib = typedAttrFn.create( "rib", "rb", MFnData::kString, MObject::kNullObj, & status );
        CHECK_MSTATUS( status );
        typedAttrFn.setReadable( true );
        typedAttrFn.setWritable( true );
        typedAttrFn.setStorable( false );
        typedAttrFn.setKeyable( false );
        typedAttrFn.setConnectable( true );
        typedAttrFn.setHidden( true );
        status = addAttribute( oa_rib );
        CHECK_MSTATUS( status );
    }


    
    // This section tells Maya what attribute effects
    // which attribute. When input attributes change, 
    // make the attributes they effect "dirty". That 
    // means that, when Maya asks for a dirty attribute, 
    // it will need to be computed and "cleaned".
    //
    // Changing an effecting "input" attribute does not
    // trigger a computation of it's effected "output"
    // attribute. It just tells Maya that - if the effected
    // attribute is ever asked for, it will have to call
    // the compute method to calculate it.
    //
    // For complex relationships between attributes,
    // an attributeEffects() call must exist for each
    // relationship. If A effects B, and B effects C,
    // then we will need to make two attributeEffects()
    // calls - one for A effecting B and one for B 
    // effecting C. Maya will not figure out that, if A
    // effects B, and B effets C, then A must effect C.
    //
    // Below we see that most "input" attributes effect
    // both our internal update and the rib generation
    // the same way in each case. But it's not always 
    // exactly the same like this.
    //
    // Notice also that ia_drawStyle does not effect
    // any of the attributes. It's something that's just
    // used in the draw method.
    
    attributeAffects( ia_seed, oa_update );
    attributeAffects( ia_seed, oa_rib );
    
    attributeAffects( ia_roughness, oa_update );
    attributeAffects( ia_roughness, oa_rib );

    attributeAffects( ia_smooth, oa_update );
    attributeAffects( ia_smooth, oa_rib );

    attributeAffects( ia_planeHeight, oa_update );
    attributeAffects( ia_planeHeight, oa_rib );

    attributeAffects( ia_resolution, oa_update );
    attributeAffects( ia_rmanResolution, oa_rib );
    
    attributeAffects( ia_planeSize, oa_update );
    attributeAffects( ia_planeSize, oa_rib );

    attributeAffects( ia_gridSize, oa_update );
    attributeAffects( ia_gridSize, oa_rib );

    attributeAffects( ia_grassMultiplier, oa_update );
    attributeAffects( ia_grassMultiplier, oa_rib );

    attributeAffects( ia_baseWidth, oa_update );
    attributeAffects( ia_baseWidth, oa_rib );

    attributeAffects( ia_grassSegmentLength, oa_update );
    attributeAffects( ia_grassSegmentLength, oa_rib );

    attributeAffects( ia_grassNumSegments, oa_update );
    attributeAffects( ia_grassNumSegments, oa_rib );

    attributeAffects( ia_grassBendAmount, oa_update );
    attributeAffects( ia_grassBendAmount, oa_rib );

    attributeAffects( ia_windDirection, oa_update );
    attributeAffects( ia_windDirection, oa_rib );

    attributeAffects( ia_windSpread, oa_update );
    attributeAffects( ia_windSpread, oa_rib );

    attributeAffects( ia_clock, oa_update );
    attributeAffects( ia_clock, oa_rib );

    attributeAffects( ia_grassBaseColour1, oa_update);
    attributeAffects( ia_grassBaseColour1, oa_rib);

    attributeAffects( ia_grassTipColour1, oa_update);
    attributeAffects( ia_grassTipColour1, oa_rib);

    attributeAffects( ia_grassBaseColour2, oa_update);
    attributeAffects( ia_grassBaseColour2, oa_rib);

    attributeAffects( ia_grassTipColour2, oa_update);
    attributeAffects( ia_grassTipColour2, oa_rib);


    
    
    fprintf( stderr, "VmIslandNode::initialize() done\n" );

    return MStatus::kSuccess;
}
コード例 #15
0
MStatus	MayaToKrayGlobals::initialize()
{
	MayaRenderGlobalsNode::initialize();

	MFnNumericAttribute nAttr;
	MFnTypedAttribute tAttr;
	MFnGenericAttribute gAttr;
	MFnEnumAttribute eAttr;
	MStatus stat = MStatus::kSuccess;

	//  DOF (depth of field) and motion blur will not work in adaptive mode.
	samplingType = eAttr.create( "samplingType", "samplingType", 0, &stat);
	stat = eAttr.addField( "None", 0 );
	stat = eAttr.addField( "Grid", 1 );
	stat = eAttr.addField( "Qasi Random", 2 );
	stat = eAttr.addField( "Random Full Screen AA", 3 );
	CHECK_MSTATUS(addAttribute( samplingType ));

	rotateGrid = nAttr.create("rotateGrid", "rotateGrid",  MFnNumericData::kBoolean, true);
	CHECK_MSTATUS(addAttribute( rotateGrid ));

	gridSize = nAttr.create("gridSize", "gridSize",  MFnNumericData::kInt, 2);
	CHECK_MSTATUS(addAttribute( gridSize ));

	filterRadius = nAttr.create("filterRadius", "filterRadius",  MFnNumericData::kFloat, 0.7);
	CHECK_MSTATUS(addAttribute( filterRadius ));

	aa_edgeAbsolute = nAttr.create("aa_edgeAbsolute", "aa_edgeAbsolute",  MFnNumericData::kFloat, 0.2);
	CHECK_MSTATUS(addAttribute( aa_edgeAbsolute ));

	aa_relative = nAttr.create("aa_relative", "aa_relative",  MFnNumericData::kFloat, 0.2);
	CHECK_MSTATUS(addAttribute( aa_relative ));

	aa_thickness = nAttr.create("aa_thickness", "aa_thickness",  MFnNumericData::kInt, 1);
	CHECK_MSTATUS(addAttribute( aa_thickness ));

	aa_overburn = nAttr.create("aa_overburn", "aa_overburn",  MFnNumericData::kFloat, 1.0);
	CHECK_MSTATUS(addAttribute( aa_overburn ));

	aa_normal = nAttr.create("aa_normal", "aa_normal",  MFnNumericData::kFloat, 0.1);
	CHECK_MSTATUS(addAttribute( aa_normal ));

	aa_z = nAttr.create("aa_z", "aa_z",  MFnNumericData::kFloat, 0.1);
	CHECK_MSTATUS(addAttribute( aa_z ));

	aa_undersample = nAttr.create("aa_undersample", "aa_undersample",  MFnNumericData::kFloat, 0.2);
	CHECK_MSTATUS(addAttribute( aa_undersample ));

	aa_threshold = nAttr.create("aa_threshold", "aa_threshold",  MFnNumericData::kFloat, 0.01);
	CHECK_MSTATUS(addAttribute( aa_threshold ));

	aa_minRays = nAttr.create("aa_minRays", "aa_minRays",  MFnNumericData::kInt, 2);
	CHECK_MSTATUS(addAttribute( aa_minRays ));

	aa_maxRays = nAttr.create("aa_maxRays", "aa_maxRays",  MFnNumericData::kInt, 2);
	CHECK_MSTATUS(addAttribute( aa_maxRays ));

	aa_rays = nAttr.create("aa_rays", "aa_rays",  MFnNumericData::kInt, 2);
	CHECK_MSTATUS(addAttribute( aa_rays ));

	mb_subframes = nAttr.create("mb_subframes", "mb_subframes",  MFnNumericData::kInt, 2);
	CHECK_MSTATUS(addAttribute( mb_subframes ));

	aa_upsample = nAttr.create("aa_upsample", "aa_upsample",  MFnNumericData::kInt, 2);
	CHECK_MSTATUS(addAttribute( aa_upsample ));

	diffuseModel = eAttr.create( "diffuseModel", "diffuseModel", 2, &stat);
	stat = eAttr.addField( "Raytrace", 0 );
	stat = eAttr.addField( "Photon Estimate", 1 );
	stat = eAttr.addField( "Photon Mapping", 2 );
	stat = eAttr.addField( "Path tracing", 3 );
	//stat = eAttr.addField( "Cache irradiance", 3 );
	//stat = eAttr.addField( "Caustics", 5 );
	CHECK_MSTATUS(addAttribute( diffuseModel ));

	doCaustics = nAttr.create("doCaustics", "doCaustics",  MFnNumericData::kBoolean, false);
	CHECK_MSTATUS(addAttribute( doCaustics ));

	diffuseModelPhoton = eAttr.create( "diffuseModelPhoton", "diffuseModelPhoton", 0, &stat);
	stat = eAttr.addField( "Global Filtered", 0 );
	stat = eAttr.addField( "Global Unfiltered", 1 );
	stat = eAttr.addField( "Precomputed Filtered", 2 );
	stat = eAttr.addField( "Precomputed Unfiltered", 3 );
	CHECK_MSTATUS(addAttribute( diffuseModelPhoton ));

	giMode = eAttr.create( "giMode", "giMode", 0, &stat);
	stat = eAttr.addField( "Independent", 0 );
	stat = eAttr.addField( "Time interpolation", 1 );
	stat = eAttr.addField( "Shared for all frames", 2 );
	CHECK_MSTATUS(addAttribute( giMode ));

	pixelOrder = eAttr.create( "pixelOrder", "pixelOrder", 0, &stat);
	stat = eAttr.addField( "Scanline", 0 );
	stat = eAttr.addField( "Scancolumn", 1 );
	stat = eAttr.addField( "Random", 2 );
	stat = eAttr.addField( "Progressive", 3 );
	stat = eAttr.addField( "RenderWorm", 4 );
	stat = eAttr.addField( "Frost", 5 );
	CHECK_MSTATUS(addAttribute( pixelOrder ));

	bitdepth = eAttr.create( "bitdepth", "bitdepth", 0, &stat);
	stat = eAttr.addField( "8bit  Integer", 0 );
	stat = eAttr.addField( "16bit Integer", 1 );
	//stat = eAttr.addField( "32bit Integer", 2 );
	//stat = eAttr.addField( "16bit Float(Half)", 3 );
	//stat = eAttr.addField( "32bit Float", 4 );
	//stat = eAttr.addField( "64bit Double", 5 );
	CHECK_MSTATUS(addAttribute( bitdepth ));

	colorSpace = eAttr.create( "colorSpace", "colorSpace", 0, &stat);
	stat = eAttr.addField( "linear_rgb", 0 );
	stat = eAttr.addField( "srgb", 1 );
	stat = eAttr.addField( "ciexyz", 2 );
	CHECK_MSTATUS(addAttribute( colorSpace ));

	lightingEngine = eAttr.create( "lightingEngine", "lightingEngine", 0, &stat);
	stat = eAttr.addField( "Path tracing", 0 );
	stat = eAttr.addField( "Distributed Raytracing", 1 );
	CHECK_MSTATUS(addAttribute( lightingEngine ));

	clamping = nAttr.create("clamping", "clamping",  MFnNumericData::kBoolean, false);
	CHECK_MSTATUS(addAttribute( clamping ));

	maxError = nAttr.create("maxError", "maxError",  MFnNumericData::kFloat, 0.01);
	CHECK_MSTATUS(addAttribute( maxError ));

	caustics = nAttr.create("caustics", "caustics",  MFnNumericData::kBoolean, false);
	CHECK_MSTATUS(addAttribute( caustics ));

	diffuseDepth = nAttr.create("diffuseDepth", "diffuseDepth",  MFnNumericData::kInt, 4);
	CHECK_MSTATUS(addAttribute( diffuseDepth ));

	glossyDepth = nAttr.create("glossyDepth", "glossyDepth",  MFnNumericData::kInt, 4);
	CHECK_MSTATUS(addAttribute( glossyDepth ));

	// reduced to auto because we do not need the others (I hope) remove the whole attribute in the next release
	assemblyExportType = eAttr.create( "assemblyExportType", "assemblyExportType", 0, &stat);
	stat = eAttr.addField( "Auto", 0 );
	CHECK_MSTATUS(addAttribute( assemblyExportType ));

	assemblyPolyTheshold = nAttr.create("assemblyPolyTheshold", "assemblyPolyTheshold",  MFnNumericData::kInt, 10000);
	CHECK_MSTATUS(addAttribute( assemblyPolyTheshold ));

	environmentType = eAttr.create( "environmentType", "environmentType", 0, &stat);
	stat = eAttr.addField( "Color Fade", 0 );
	stat = eAttr.addField( "Fade", 1 );
	stat = eAttr.addField( "GVolume", 2 );
	stat = eAttr.addField( "Physical Sky", 3 );
	stat = eAttr.addField( "VEffect", 4 );
	stat = eAttr.addField( "Volume", 5 );
	//environment  	colorFade, 	<rgb> color, 	<double> amount;
	//	fade, 	<double> amount;
	//	gVolume, 	<texture> t2, 	<int> max_recurse, 	<double> adaptive_threshold, 	<double> max_distance, 	<double> probe_per_length, 	<double> photon_per_lenght, 	<double> photon_radius;
	//	phySky, 	<sharedObject> s2, 	<int> flags;
	//	vEffect, 	<double> intensity, 	<double> start, 	<double> step1, 	<double> step2, 	<int> n;
	//	volume, 	<texture> t2, 	<int> max_recurse, 	<double> adaptive_threshold, 	<double> max_distance, 	<double> probe_per_length, 	<double> photon_per_lenght, 	<double> photon_radius; 
	CHECK_MSTATUS(addAttribute( environmentType ));

	backgroundType = eAttr.create( "backgroundType", "backgroundType", 0, &stat);
	stat = eAttr.addField( "Constant", 0 );
	stat = eAttr.addField( "Physical Sky", 1 );
	stat = eAttr.addField( "Physical Sky 2", 2 );
	stat = eAttr.addField( "Sky", 3 );
	stat = eAttr.addField( "Sky2", 4 );
	stat = eAttr.addField( "Bitmap", 5 );
	stat = eAttr.addField( "Bitmap2", 6 );
	stat = eAttr.addField( "DirectionsMap", 7 );
	stat = eAttr.addField( "LightMap", 8 );
	stat = eAttr.addField( "SphereMap", 9 );
	CHECK_MSTATUS(addAttribute( backgroundType ));

	environmentColor = nAttr.createColor("environmentColor", "environmentColor");
	nAttr.setDefault(0.6f, 0.7f, 0.9f);
	nAttr.setConnectable(false);
	CHECK_MSTATUS(addAttribute( environmentColor ));

	gradientHorizon = nAttr.createColor("gradientHorizon", "gradientHorizon");
	nAttr.setDefault(0.8f, 0.8f, 0.9f);
	nAttr.setConnectable(false);
	CHECK_MSTATUS(addAttribute( gradientHorizon ));

	gradientZenit = nAttr.createColor("gradientZenit", "gradientZenit");
	nAttr.setDefault(0.2f, 0.3f, 0.6f);
	nAttr.setConnectable(false);
	CHECK_MSTATUS(addAttribute( gradientZenit ));

	environmentMap = nAttr.createColor("environmentMap", "environmentMap");
	nAttr.setDefault(0.6f, 0.7f, 0.9f);
	CHECK_MSTATUS(addAttribute( environmentMap ));

	environmentMap2 = nAttr.createColor("environmentMap2", "environmentMap2");
	nAttr.setDefault(0.6f, 0.7f, 0.9f);
	CHECK_MSTATUS(addAttribute( environmentMap2 ));

	environmentIntensity = nAttr.create("environmentIntensity", "environmentIntensity",  MFnNumericData::kFloat, 1.0f);
	nAttr.setConnectable(false);
	CHECK_MSTATUS(addAttribute( environmentIntensity ));

	zenithDir = nAttr.createPoint("zenithDir", "zenithDir");
	nAttr.setDefault(0.0f, 1.0f, 0.0f);
	CHECK_MSTATUS(addAttribute( zenithDir ));

	orientation = nAttr.createPoint("orientation", "orientation");
	nAttr.setDefault(0.0f, 1.0f, 0.0f);
	CHECK_MSTATUS(addAttribute( orientation ));

	sunDir = nAttr.createPoint("sunDir", "sunDir");
	nAttr.setDefault(0.0f, 1.0f, 0.0f);
	CHECK_MSTATUS(addAttribute( sunDir ));

	groundAlbedo = nAttr.createColor("groundAlbedo", "groundAlbedo");
	nAttr.setDefault(1.0f, 1.0f, 1.0f);
	CHECK_MSTATUS(addAttribute( groundAlbedo ));

	nadir = nAttr.createColor("nadir", "nadir");
	nAttr.setDefault(0.0f, 0.0f, 0.0f);
	CHECK_MSTATUS(addAttribute( nadir ));

	sunIntensity = nAttr.create("sunIntensity", "sunIntensity",  MFnNumericData::kFloat, 1.0f);
	CHECK_MSTATUS(addAttribute( sunIntensity ));

	sunSpotAngle = nAttr.create("sunSpotAngle", "sunSpotAngle",  MFnNumericData::kFloat, 35.0f);
	CHECK_MSTATUS(addAttribute( sunSpotAngle ));

	solidAngle = nAttr.create("solidAngle", "solidAngle",  MFnNumericData::kFloat, 25.0f);
	CHECK_MSTATUS(addAttribute( solidAngle ));

	exposure = nAttr.create("exposure", "exposure",  MFnNumericData::kFloat, 1.0f);
	CHECK_MSTATUS(addAttribute( exposure ));

	turbidity = nAttr.create("turbidity", "turbidity",  MFnNumericData::kFloat, 10.0f);
	CHECK_MSTATUS(addAttribute( turbidity ));

	groundGamma = nAttr.create("groundGamma", "groundGamma",  MFnNumericData::kFloat, 1.0f);
	CHECK_MSTATUS(addAttribute( groundGamma ));

	skyGamma = nAttr.create("skyGamma", "skyGamma",  MFnNumericData::kFloat, 1.0f);
	CHECK_MSTATUS(addAttribute( skyGamma ));


	directLightSamples = nAttr.create("directLightSamples", "directLightSamples",  MFnNumericData::kInt, 0);
	CHECK_MSTATUS(addAttribute( directLightSamples ));

	//image_formats=@	"HDR High Dynamic Range (Radiance)",
	//				"JPG Joint Photographic experts Group",
	//				"PNG Portable Network Graphics",
	//				"PNG Portable Network Graphics +alpha",
	//				"TIF Tagged Image file Format",
	//				"TIF Tagged Image file Format +alpha",
	//				"TGA Truevision Graphics Adapter file",
	//				"TGA Truevision Graphics Adapter file +alpha",
	//				"BMP BitMaP",
	//				"BMP BitMaP +alpha"@;

	//imageFormat = eAttr.create( "imageFormat", "imageFormat", 1, &stat);
	//CHECK_MSTATUS(addAttribute( imageFormat ));


	optimizedTexturePath = tAttr.create("optimizedTexturePath", "optimizedTexturePath",  MFnNumericData::kString);
	tAttr.setUsedAsFilename(true);
	CHECK_MSTATUS(addAttribute( optimizedTexturePath ));

	latlongHoShift = nAttr.create("latlongHoShift", "latlongHoShift",  MFnNumericData::kFloat, .0f);
	CHECK_MSTATUS(addAttribute( latlongHoShift ));

	latlongVeShift = nAttr.create("latlongVeShift", "latlongVeShift",  MFnNumericData::kFloat, .0f);
	CHECK_MSTATUS(addAttribute( latlongVeShift ));

	// photons
	giResolution = nAttr.create("giResolution", "giResolution",  MFnNumericData::kFloat, 1.0f);
	CHECK_MSTATUS(addAttribute( giResolution ));

	giResolutionAuto = nAttr.create("giResolutionAuto", "giResolutionAuto",  MFnNumericData::kBoolean, true);
	CHECK_MSTATUS(addAttribute( giResolutionAuto ));

	previewPhotons = nAttr.create("previewPhotons", "previewPhotons",  MFnNumericData::kBoolean, true);
	CHECK_MSTATUS(addAttribute( previewPhotons ));

	photonMapType = eAttr.create( "photonMapType", "photonMapType", 0, &stat);
	stat = eAttr.addField( "PhotonMap", 0 );
	stat = eAttr.addField( "LightMap", 1 );
	CHECK_MSTATUS(addAttribute( photonMapType ));

	photonCount = nAttr.create("photonCount", "photonCount",  MFnNumericData::kInt, 10000);
	CHECK_MSTATUS(addAttribute( photonCount ));

	photonPower = nAttr.create("photonPower", "photonPower",  MFnNumericData::kFloat, 1.0f);
	CHECK_MSTATUS(addAttribute( photonPower ));

	photonNBlur = nAttr.create("photonNBlur", "photonNBlur",  MFnNumericData::kInt, 400);
	CHECK_MSTATUS(addAttribute( photonNBlur ));

	photonUseAutoPhotons = nAttr.create("photonUseAutoPhotons", "photonUseAutoPhotons",  MFnNumericData::kBoolean, true);
	CHECK_MSTATUS(addAttribute( photonUseAutoPhotons ));

	photonPrecacheDist = nAttr.create("photonPrecacheDist", "photonPrecacheDist",  MFnNumericData::kFloat, 50.0f);
	CHECK_MSTATUS(addAttribute( photonPrecacheDist ));

	photonPrecacheBlur = nAttr.create("photonPrecacheBlur", "photonPrecacheBlur",  MFnNumericData::kFloat, 100.0f);
	CHECK_MSTATUS(addAttribute( photonPrecacheBlur ));

	photonAutoPhotonsLow = nAttr.create("photonAutoPhotonsLow", "photonAutoPhotonsLow",  MFnNumericData::kFloat, 20.0);
	CHECK_MSTATUS(addAttribute( photonAutoPhotonsLow ));

	photonAutoPhotonsHigh = nAttr.create("photonAutoPhotonsHigh", "photonAutoPhotonsHigh",  MFnNumericData::kFloat, 80.0f);
	CHECK_MSTATUS(addAttribute( photonAutoPhotonsHigh ));

	photonAutoPhotonsSteps = nAttr.create("photonAutoPhotonsSteps", "photonAutoPhotonsSteps",  MFnNumericData::kFloat, 4.0f);
	CHECK_MSTATUS(addAttribute( photonAutoPhotonsSteps ));

	// caustics
	causticsAddToLightmap = nAttr.create("causticsAddToLightmap", "causticsAddToLightmap",  MFnNumericData::kBoolean, true);
	CHECK_MSTATUS(addAttribute( causticsAddToLightmap ));

	causticsCount = nAttr.create("causticsCount", "causticsCount",  MFnNumericData::kInt, 50000);
	CHECK_MSTATUS(addAttribute( causticsCount ));

	causticsUseAutoPhotons = nAttr.create("causticsUseAutoPhotons", "causticsUseAutoPhotons",  MFnNumericData::kBoolean, true);
	CHECK_MSTATUS(addAttribute( causticsUseAutoPhotons ));

	causticsAutoPhotonsLow = nAttr.create("causticsAutoPhotonsLow", "causticsAutoPhotonsLow",  MFnNumericData::kFloat, 20.0);
	CHECK_MSTATUS(addAttribute( causticsAutoPhotonsLow ));

	causticsAutoPhotonsHigh = nAttr.create("causticsAutoPhotonsHigh", "causticsAutoPhotonsHigh",  MFnNumericData::kFloat, 80.0f);
	CHECK_MSTATUS(addAttribute( causticsAutoPhotonsHigh ));

	causticsAutoPhotonsSteps = nAttr.create("causticsAutoPhotonsSteps", "causticsAutoPhotonsSteps",  MFnNumericData::kFloat, 4.0f);
	CHECK_MSTATUS(addAttribute( causticsAutoPhotonsSteps ));

	causticsPower = nAttr.create("causticsPower", "causticsPower",  MFnNumericData::kFloat, 1.0f);
	CHECK_MSTATUS(addAttribute( causticsPower ));

	causticsNBlur = nAttr.create("causticsNBlur", "causticsNBlur",  MFnNumericData::kInt, 400);
	CHECK_MSTATUS(addAttribute( causticsNBlur ));

	// FG
	fgThreshold = nAttr.create("fgThreshold", "fgThreshold",  MFnNumericData::kFloat, .0001f);
	CHECK_MSTATUS(addAttribute( fgThreshold ));

	fgMinRays = nAttr.create("fgMinRays", "fgMinRays",  MFnNumericData::kInt, 100);
	CHECK_MSTATUS(addAttribute( fgMinRays ));

	fgMaxRays = nAttr.create("fgMaxRays", "fgMaxRays",  MFnNumericData::kInt, 600);
	CHECK_MSTATUS(addAttribute( fgMaxRays ));

	fgPrerender = nAttr.create("fgPrerender", "fgPrerender",  MFnNumericData::kFloat, 1.0f);
	CHECK_MSTATUS(addAttribute( fgPrerender ));

	fgPasses = nAttr.create("fgPasses", "fgPasses",  MFnNumericData::kInt, 1);
	CHECK_MSTATUS(addAttribute( fgPasses ));

	fgSplotchDetect = nAttr.create("fgSplotchDetect", "fgSplotchDetect",  MFnNumericData::kFloat, .05f);
	CHECK_MSTATUS(addAttribute( fgSplotchDetect ));

	fgSensitivity = nAttr.create("fgSensitivity", "fgSensitivity",  MFnNumericData::kFloat, .05f);
	CHECK_MSTATUS(addAttribute( fgSensitivity ));

	fgReflections = nAttr.create("fgReflections", "fgReflections",  MFnNumericData::kBoolean, false);
	CHECK_MSTATUS(addAttribute( fgReflections ));

	fgRefractions = nAttr.create("fgRefractions", "fgRefractions",  MFnNumericData::kBoolean, false);
	CHECK_MSTATUS(addAttribute( fgRefractions ));

	fgSpatialTolerance = nAttr.create("fgSpatialTolerance", "fgSpatialTolerance",  MFnNumericData::kFloat, .1f);
	CHECK_MSTATUS(addAttribute( fgSpatialTolerance ));

	fgAngularTolerance = nAttr.create("fgAngularTolerance", "fgAngularTolerance",  MFnNumericData::kFloat, 30.0f);
	CHECK_MSTATUS(addAttribute( fgAngularTolerance ));

	fgDistMin = nAttr.create("fgDistMin", "fgDistMin",  MFnNumericData::kFloat, 10.0f);
	CHECK_MSTATUS(addAttribute( fgDistMin ));

	fgDistMax = nAttr.create("fgDistMax", "fgDistMax",  MFnNumericData::kFloat, 3000.00f);
	CHECK_MSTATUS(addAttribute( fgDistMax ));

	fgBrightness = nAttr.create("fgBrightness", "fgBrightness",  MFnNumericData::kFloat, 0.00f);
	CHECK_MSTATUS(addAttribute( fgBrightness ));

	fgPathPasses = nAttr.create("fgPathPasses", "fgPathPasses",  MFnNumericData::kInt, 0);
	CHECK_MSTATUS(addAttribute( fgPathPasses ));

	fgCornerDist = nAttr.create("fgCornerDist", "fgCornerDist",  MFnNumericData::kFloat, 50.00f);
	CHECK_MSTATUS(addAttribute( fgCornerDist ));

	fgShowSamples = nAttr.create("fgShowSamples", "fgShowSamples",  MFnNumericData::kBoolean, false);
	CHECK_MSTATUS(addAttribute( fgShowSamples ));

	fullScreenAA = nAttr.create("fullScreenAA", "fullScreenAA",  MFnNumericData::kBoolean, false);
	CHECK_MSTATUS(addAttribute( fullScreenAA ));

	jpgQuality = nAttr.create("jpgQuality", "jpgQuality",  MFnNumericData::kInt, 75);
	nAttr.setMin(0);
	nAttr.setMax(100);
	CHECK_MSTATUS(addAttribute( jpgQuality ));
	
	qLuminosityModel = eAttr.create( "qLuminosityModel", "qLuminosityModel", 0, &stat);
	stat = eAttr.addField( "Compute as Indirect", 0 );
	stat = eAttr.addField( "Compute as Direct", 1 );
	stat = eAttr.addField( "Automatic", 2 );
	CHECK_MSTATUS(addAttribute( qLuminosityModel ));

	qLevel = nAttr.create("qLevel", "qLevel",  MFnNumericData::kFloat, 1.00f);
	CHECK_MSTATUS(addAttribute( qLevel ));

	qAreaLights = eAttr.create( "qAreaLights", "qAreaLights", 0, &stat);
	stat = eAttr.addField( "Compute Separately (AS)", 0 );
	stat = eAttr.addField( "Compute With Luminosity", 1 );
	CHECK_MSTATUS(addAttribute( qAreaLights ));

	qDoubleSided = nAttr.create("qDoubleSided", "qDoubleSided",  MFnNumericData::kBoolean, true);
	CHECK_MSTATUS(addAttribute( qDoubleSided ));

	qAreaLightVisibility = eAttr.create( "qAreaLightVisibility", "qAreaLightVisibility", 0, &stat);
	stat = eAttr.addField( "Visible (Realistic)", 0 );
	stat = eAttr.addField( "Invisible", 1 );
	CHECK_MSTATUS(addAttribute( qAreaLightVisibility ));

	qSpotlightsToArea = nAttr.create("qSpotlightsToArea", "qSpotlightsToArea",  MFnNumericData::kBoolean, true);
	CHECK_MSTATUS(addAttribute( qSpotlightsToArea ));

	qAreaLightsThreshold = nAttr.create("qAreaLightsThreshold", "qAreaLightsThreshold",  MFnNumericData::kFloat, 1.00f);
	CHECK_MSTATUS(addAttribute( qAreaLightsThreshold ));

	qAMinRecursion = nAttr.create("qAMinRecursion", "qAMinRecursion",  MFnNumericData::kInt, 0);
	CHECK_MSTATUS(addAttribute( qAMinRecursion ));

	qAMaxRecursion = nAttr.create("qAMaxRecursion", "qAMaxRecursion",  MFnNumericData::kInt, 1);
	CHECK_MSTATUS(addAttribute( qAMaxRecursion ));

	qLinearLightsThreshold = nAttr.create("qLinearLightsThreshold", "qLinearLightsThreshold",  MFnNumericData::kFloat, 1.00f);
	CHECK_MSTATUS(addAttribute( qLinearLightsThreshold ));

	qLMinRecursion = nAttr.create("qLMinRecursion", "qLMinRecursion",  MFnNumericData::kInt, 0);
	CHECK_MSTATUS(addAttribute( qLMinRecursion ));

	qLMaxRecursion = nAttr.create("qLMaxRecursion", "qLMaxRecursion",  MFnNumericData::kInt, 1);
	CHECK_MSTATUS(addAttribute( qLMaxRecursion ));

	qLuminosityThreshold = nAttr.create("qLuminosityThreshold", "qLuminosityThreshold",  MFnNumericData::kFloat, 1.00f);
	CHECK_MSTATUS(addAttribute( qLuminosityThreshold ));

	qLumMinRays = nAttr.create("qLumMinRays", "qLumMinRays",  MFnNumericData::kInt, 0);
	CHECK_MSTATUS(addAttribute( qLumMinRays ));

	qLumMaxRays = nAttr.create("qLumMaxRays", "qLumMaxRays",  MFnNumericData::kInt, 1);
	CHECK_MSTATUS(addAttribute( qLumMaxRays ));

	qBlurringThreshold = nAttr.create("qBlurringThreshold", "qBlurringThreshold",  MFnNumericData::kFloat, 1.00f);
	CHECK_MSTATUS(addAttribute( qBlurringThreshold ));

	qBLumMinRays = nAttr.create("qBLumMinRays", "qBLumMinRays",  MFnNumericData::kInt, 0);
	CHECK_MSTATUS(addAttribute( qBLumMinRays ));

	qBLumMaxRays = nAttr.create("qBLumMaxRays", "qBLumMaxRays",  MFnNumericData::kInt, 1);
	CHECK_MSTATUS(addAttribute( qBLumMaxRays ));

	qBAccuracyLimit = nAttr.create("qBAccuracyLimit", "qBAccuracyLimit",  MFnNumericData::kFloat, 1.00f);
	CHECK_MSTATUS(addAttribute( qBAccuracyLimit ));

	qTraceDirectLightReflections = nAttr.create("qTraceDirectLightReflections", "qTraceDirectLightReflections",  MFnNumericData::kBoolean, true);
	CHECK_MSTATUS(addAttribute( qTraceDirectLightReflections ));

	qOctreeDetail = eAttr.create( "qOctreeDetail", "qOctreeDetail", 0, &stat);
	stat = eAttr.addField( "Very Low", 0 );
	stat = eAttr.addField( "Low", 1 );
	stat = eAttr.addField( "Normal", 2 );
	stat = eAttr.addField( "High", 3 );
	CHECK_MSTATUS(addAttribute( qOctreeDetail ));

	camSingleSided = nAttr.create("camSingleSided", "camSingleSided",  MFnNumericData::kBoolean, false);
	CHECK_MSTATUS(addAttribute( camSingleSided ));


	return stat;

}
コード例 #16
0
bool 
DXMAnchor::AddAnchor(MObject& site, const MString& longAnchorName, const MString& shortAnchorName, DXMAnchor* anchor)
{
	DXCC_ASSERT( DXMAnchor::GetAnchor(site, shortAnchorName) == NULL );

	DXCC_ASSERT(anchor != NULL);
	DXCC_ASSERT(anchor->GetSite().isNull());
	DXCC_ASSERT(anchor->GetPoint().length() == 0);

	DXCC_ASSERT(longAnchorName.length() > 0);
	DXCC_ASSERT(shortAnchorName.length() > 0);
	DXCC_ASSERT(!site.isNull());

	MFnDependencyNode depNode(site);
	MString name= depNode.name();
#ifdef DEBUG
	anchor->Name= name.asChar();
#endif

	if( g_DebugBasic )
	{
		DXCC_DPFA_REPORT("%s", name.asChar());
	}

	//this attribute may exist if you had asked for this node to be duplicated or instanced :(
	if( depNode.attribute( shortAnchorName ).isNull() )
	{
		MFnNumericAttribute numeric;
		MObject anchorAttrib= numeric.create(longAnchorName, shortAnchorName, MFnNumericData::kInt, 0);
		numeric.setReadable(false);
		numeric.setWritable(false);
		numeric.setConnectable(false);
		numeric.setStorable(false);
		numeric.setCached(true);
		numeric.setArray(false);
		numeric.setKeyable(false);
		numeric.setHidden(true);
		numeric.setUsedAsColor(false);
		numeric.setIndeterminant(true);
		numeric.setRenderSource(false);
		numeric.setInternal(false);

		DXCC_ASSERT(!anchorAttrib.isNull());
		DXCHECK_MSTATUS( depNode.addAttribute(anchorAttrib) );
	}

	MPlug anchorPlug= depNode.findPlug( shortAnchorName );
	DXCC_ASSERT(!anchorPlug.isNull());

	anchorPlug.setValue( *reinterpret_cast<int*>(&anchor) );

	anchor->AnchorSite= site;
	anchor->AnchorPoint= shortAnchorName;
	
//	anchor->NodeDestroyedCID= MNodeMessage::addNodeDestroyedCallback(site, DXMAnchor::DispatchNodeDestroyed, anchor);
//	anchor->AboutToDeleteCID= MNodeMessage::addNodeAboutToDeleteCallback(site, DXMAnchor::DispatchAboutToDelete, anchor);



	anchor->OnPostAddAnchor(longAnchorName, shortAnchorName);

	return true;
}
コード例 #17
0
MStatus liqVolumeNode::initialize()
{
  MFnTypedAttribute   tAttr;
  MFnNumericAttribute nAttr;
  MFnEnumAttribute    eAttr;
  MStatus status;

  // Create input attributes
  aRmanShader = tAttr.create( MString("rmanShader"), MString("rms"), MFnData::kString, aRmanShader, &status );
  MAKE_INPUT(tAttr);

  aRmanShaderType = tAttr.create( MString("rmanShaderType"), MString("rst"), MFnData::kString, aRmanShaderType, &status );
  MAKE_INPUT(tAttr);

  aRmanShaderLong = tAttr.create( MString("rmanShaderLong"), MString("rml"), MFnData::kString, aRmanShaderLong, &status );
  MAKE_INPUT(tAttr);

  aRmanShaderLif = tAttr.create(  MString("rmanShaderLif"),  MString("lif"), MFnData::kString, aRmanShaderLif, &status );
  MAKE_INPUT(tAttr);

  aRmanParams = tAttr.create(  MString("rmanParams"),  MString("rpr"), MFnData::kStringArray, aRmanParams, &status );
  MAKE_INPUT(tAttr);

  aRmanDetails = tAttr.create(  MString("rmanDetails"),  MString("rdt"), MFnData::kStringArray, aRmanDetails, &status );
  MAKE_INPUT(tAttr);

  aRmanTypes = tAttr.create(  MString("rmanTypes"),  MString("rty"), MFnData::kStringArray, aRmanTypes, &status );
  MAKE_INPUT(tAttr);

  aRmanDefaults = tAttr.create(  MString("rmanDefaults"),  MString("rdf"), MFnData::kStringArray, aRmanDefaults, &status );
  MAKE_INPUT(tAttr);

  aRmanArraySizes = tAttr.create(  MString("rmanArraySizes"),  MString("ras"), MFnData::kIntArray, aRmanArraySizes, &status );
  MAKE_INPUT(tAttr);

  aRmanLifCmds = tAttr.create(  MString("rmanLifCmds"),  MString("rlc"), MFnData::kStringArray, aRmanLifCmds, &status );
  MAKE_INPUT(tAttr);

  aRmanMethods = tAttr.create(  MString("rmanMethods"),  MString("rmt"), MFnData::kStringArray, aRmanMethods, &status );
  MAKE_INPUT(tAttr);

  aRmanIsOutput = tAttr.create(  MString("rmanIsOutput"),  MString("rio"), MFnData::kIntArray, aRmanIsOutput, &status );
  MAKE_INPUT(tAttr);
  
  aPreviewPrimitive = eAttr.create( "previewPrimitive", "pvp", 7, &status );
  eAttr.addField( "Sphere",   0 );
  eAttr.addField( "Cube",     1 );
  eAttr.addField( "Cylinder", 2 );
  eAttr.addField( "Torus",    3 );
  eAttr.addField( "Plane",    4 );
  eAttr.addField( "Teapot",   5 );
  eAttr.addField( "Custom",   6 );
  eAttr.addField( "(globals)",7 );
  MAKE_NONKEYABLE_INPUT(eAttr);
  CHECK_MSTATUS(eAttr.setConnectable(false));

  aPreviewCustomPrimitive = tAttr.create(  MString("previewCustomPrimitive"),  MString("pcp"), MFnData::kString, aPreviewCustomPrimitive, &status );
  MAKE_INPUT(tAttr);

  aPreviewObjectSize = nAttr.create("previewObjectSize", "pos", MFnNumericData::kDouble, 1.0, &status);
  MAKE_NONKEYABLE_INPUT(nAttr);
  CHECK_MSTATUS(nAttr.setConnectable(false));

  aPreviewShadingRate = nAttr.create("previewShadingRate", "psr", MFnNumericData::kDouble, 1.0, &status);
  MAKE_NONKEYABLE_INPUT(nAttr);
  CHECK_MSTATUS(nAttr.setConnectable(false));

  aPreviewBackplane = nAttr.create("previewBackplane", "pbp", MFnNumericData::kBoolean, true, &status);
  MAKE_NONKEYABLE_INPUT(nAttr);
  CHECK_MSTATUS(nAttr.setConnectable(false));

  aShaderSpace = tAttr.create( MString("shaderSpace"), MString("ssp"), MFnData::kString, aShaderSpace, &status );
  MAKE_INPUT(tAttr);

  aOutputInShadow = nAttr.create("outputInShadow", "ois",  MFnNumericData::kBoolean, 0.0, &status);
  MAKE_NONKEYABLE_INPUT(nAttr);

  // refreshPreview must be true to allow refresh
  aRefreshPreview = nAttr.create("refreshPreview", "rfp",  MFnNumericData::kBoolean, 0.0, &status);
  MAKE_NONKEYABLE_INPUT(nAttr);
  CHECK_MSTATUS(nAttr.setHidden(true));

  // Create output attributes
  aOutColor = nAttr.createColor("outColor", "oc");
  MAKE_OUTPUT(nAttr);

  CHECK_MSTATUS(addAttribute(aRmanShader));
  CHECK_MSTATUS(addAttribute(aRmanShaderType));
  CHECK_MSTATUS(addAttribute(aRmanShaderLong));
  CHECK_MSTATUS(addAttribute(aRmanShaderLif));
  CHECK_MSTATUS(addAttribute(aRmanParams));
  CHECK_MSTATUS(addAttribute(aRmanDetails));
  CHECK_MSTATUS(addAttribute(aRmanTypes));
  CHECK_MSTATUS(addAttribute(aRmanDefaults));
  CHECK_MSTATUS(addAttribute(aRmanArraySizes));
  CHECK_MSTATUS(addAttribute(aRmanLifCmds));
  CHECK_MSTATUS(addAttribute(aRmanMethods));
  CHECK_MSTATUS(addAttribute(aRmanIsOutput));

  CHECK_MSTATUS(addAttribute(aPreviewPrimitive));
  CHECK_MSTATUS(addAttribute(aPreviewCustomPrimitive));
  CHECK_MSTATUS(addAttribute(aPreviewObjectSize));
  CHECK_MSTATUS(addAttribute(aPreviewShadingRate));
  CHECK_MSTATUS(addAttribute(aPreviewBackplane));
  CHECK_MSTATUS(addAttribute(aShaderSpace));
  CHECK_MSTATUS(addAttribute(aOutputInShadow));
  CHECK_MSTATUS(addAttribute(aRefreshPreview));

  CHECK_MSTATUS(addAttribute(aOutColor));

  return MS::kSuccess;
}
コード例 #18
0
MStatus sixdofConstraintNode::initialize()
{
    MStatus status;
    MFnMessageAttribute fnMsgAttr;
    MFnNumericAttribute fnNumericAttr;
    MFnMatrixAttribute fnMatrixAttr;

    ia_rigidBodyA = fnMsgAttr.create("inRigidBodyA", "inrbA", &status);
    MCHECKSTATUS(status, "creating inRigidBodyA attribute")
    status = addAttribute(ia_rigidBodyA);
    MCHECKSTATUS(status, "adding inRigidBody attribute")

    ia_rigidBodyB = fnMsgAttr.create("inRigidBodyB", "inrbB", &status);
    MCHECKSTATUS(status, "creating inRigidBodyB attribute")
    status = addAttribute(ia_rigidBodyB);
    MCHECKSTATUS(status, "adding inRigidBodyB attribute")

	ia_damping = fnNumericAttr.create("damping", "dmp", MFnNumericData::kDouble, 1.0, &status);
    MCHECKSTATUS(status, "creating damping attribute")
    fnNumericAttr.setKeyable(true);
    status = addAttribute(ia_damping);
    MCHECKSTATUS(status, "adding damping attribute")

	ia_breakThreshold = fnNumericAttr.create("breakThreshold", "brkThrsh", MFnNumericData::kDouble, 100.0, &status);
    MCHECKSTATUS(status, "creating breakThreshold attribute")
    fnNumericAttr.setKeyable(true);
    status = addAttribute(ia_breakThreshold);
    MCHECKSTATUS(status, "adding breakThreshold attribute")

	ia_disableCollide = fnNumericAttr.create("disableCollide", "dsblColl", MFnNumericData::kBoolean, true, &status);
    MCHECKSTATUS(status, "creating disableCollide attribute")
	fnNumericAttr.setHidden(true);
    fnNumericAttr.setKeyable(true);
    status = addAttribute(ia_disableCollide);
    MCHECKSTATUS(status, "adding disableCollide attribute")

    ia_lowerLinLimit = fnNumericAttr.createPoint("lowerLinLimit", "lllt", &status);
    MCHECKSTATUS(status, "creating lower linear limit attribute")
	status = fnNumericAttr.setDefault((double) 0.0, (double) 0.0, (double) 0.0);
    fnNumericAttr.setKeyable(true);
    status = addAttribute(ia_lowerLinLimit);
    MCHECKSTATUS(status, "adding lower linear limit attribute")

	ia_upperLinLimit = fnNumericAttr.createPoint("upperLinLimit", "ullt", &status);
    MCHECKSTATUS(status, "creating upper linear limit attribute")
	status = fnNumericAttr.setDefault((double) 0.0, (double) 0.0, (double) 0.0);
    fnNumericAttr.setKeyable(true);
    status = addAttribute(ia_upperLinLimit);
    MCHECKSTATUS(status, "adding upper linear limit attribute")

    ia_lowerAngLimit = fnNumericAttr.createPoint("lowerAngLimit", "lalt", &status);
    MCHECKSTATUS(status, "creating lower angular limit attribute")
	status = fnNumericAttr.setDefault((double) 0.0, (double) 0.0, (double) 0.0);
    fnNumericAttr.setKeyable(true);
    status = addAttribute(ia_lowerAngLimit);
    MCHECKSTATUS(status, "adding lower angular limit attribute")

	ia_upperAngLimit = fnNumericAttr.createPoint("upperAngLimit", "ualt", &status);
    MCHECKSTATUS(status, "creating upper angular limit attribute")
	status = fnNumericAttr.setDefault((double) 0.0, (double) 0.0, (double) 0.0);
    fnNumericAttr.setKeyable(true);
    status = addAttribute(ia_upperAngLimit);
    MCHECKSTATUS(status, "adding upper angular limit attribute")

	ca_constraint = fnNumericAttr.create("ca_constraint", "caco", MFnNumericData::kBoolean, 0, &status);
    MCHECKSTATUS(status, "creating ca_constraint attribute")
    fnNumericAttr.setConnectable(false);
    fnNumericAttr.setHidden(true);
    fnNumericAttr.setStorable(false);
    fnNumericAttr.setKeyable(false);
    status = addAttribute(ca_constraint);
    MCHECKSTATUS(status, "adding ca_constraint attribute")


    ca_constraintParam = fnNumericAttr.create("ca_constraintParam", "cacop", MFnNumericData::kBoolean, 0, &status);
    MCHECKSTATUS(status, "creating ca_constraintParam attribute")
    fnNumericAttr.setConnectable(false);
    fnNumericAttr.setHidden(true);
    fnNumericAttr.setStorable(false);
    fnNumericAttr.setKeyable(false);
    status = addAttribute(ca_constraintParam);
    MCHECKSTATUS(status, "adding ca_constraintParam attribute")

	ia_rotationInA = fnNumericAttr.createPoint("rotationInA", "hgRotA", &status);
	status = fnNumericAttr.setDefault((double) 0.0, (double) 0.0, (double) 0.0);
    MCHECKSTATUS(status, "creating rotationInA attribute")
    status = addAttribute(ia_rotationInA);
    MCHECKSTATUS(status, "adding rotationInA attribute")

	ia_rotationInB = fnNumericAttr.createPoint("rotationInB", "hgRotB", &status);
	status = fnNumericAttr.setDefault((double) 0.0, (double) 0.0, (double) 0.0);
    MCHECKSTATUS(status, "creating rotationInB attribute")
    status = addAttribute(ia_rotationInB);
    MCHECKSTATUS(status, "adding rotationInB attribute")

	ia_pivotInA = fnNumericAttr.createPoint("pivotInA", "pivinA", &status);
	status = fnNumericAttr.setDefault((double) 0.0, (double) 0.0, (double) 0.0);
    MCHECKSTATUS(status, "creating pivotInA attribute")
    status = addAttribute(ia_pivotInA);
    MCHECKSTATUS(status, "adding pivotInA attribute")

	ia_pivotInB = fnNumericAttr.createPoint("pivotInB", "pivinB", &status);
	status = fnNumericAttr.setDefault((double) 0.0, (double) 0.0, (double) 0.0);
    MCHECKSTATUS(status, "creating pivotInB attribute")
    status = addAttribute(ia_pivotInB);
    MCHECKSTATUS(status, "adding pivotInB attribute")


    status = attributeAffects(ia_rigidBodyA, ca_constraint);
    MCHECKSTATUS(status, "adding attributeAffects(ia_rigidBodyA, ca_constraint)")

    status = attributeAffects(ia_rigidBodyA, ca_constraintParam);
    MCHECKSTATUS(status, "adding attributeAffects(ia_rigidBodyA, ca_constraintParam)")

    status = attributeAffects(ia_rigidBodyB, ca_constraint);
    MCHECKSTATUS(status, "adding attributeAffects(ia_rigidBodyB, ca_constraint)")

    status = attributeAffects(ia_rigidBodyB, ca_constraintParam);
    MCHECKSTATUS(status, "adding attributeAffects(ia_rigidBodyB, ca_constraintParam)")

	status = attributeAffects(ia_damping, ca_constraintParam);
    MCHECKSTATUS(status, "adding attributeAffects(ia_damping, ca_constraintParam)")

	status = attributeAffects(ia_breakThreshold, ca_constraintParam);
    MCHECKSTATUS(status, "adding attributeAffects(ia_breakThreshold, ca_constraintParam)")

	status = attributeAffects(ia_disableCollide, ca_constraint);
    MCHECKSTATUS(status, "adding attributeAffects(ia_disableCollide, ca_constraint)")

    status = attributeAffects(ia_lowerLinLimit, ca_constraintParam);
    MCHECKSTATUS(status, "adding attributeAffects(ia_lowerLinLimit, ca_constraintParam)")

	status = attributeAffects(ia_upperLinLimit, ca_constraintParam);
    MCHECKSTATUS(status, "adding attributeAffects(ia_upperLinLimit, ca_constraintParam)")

    status = attributeAffects(ia_lowerAngLimit, ca_constraintParam);
    MCHECKSTATUS(status, "adding attributeAffects(ia_lowerAngLimit, ca_constraintParam)")

	status = attributeAffects(ia_upperAngLimit, ca_constraintParam);
    MCHECKSTATUS(status, "adding attributeAffects(ia_upperAngLimit, ca_constraintParam)")

	status = attributeAffects(ia_rotationInA, ca_constraintParam);
    MCHECKSTATUS(status, "adding attributeAffects(ia_rotationInA, ca_constraintParam)")
	status = attributeAffects(ia_rotationInB, ca_constraintParam);
    MCHECKSTATUS(status, "adding attributeAffects(ia_rotationInB, ca_constraintParam)")

	status = attributeAffects(ia_pivotInA, ca_constraintParam);
    MCHECKSTATUS(status, "adding attributeAffects(ia_pivotInA, ca_constraintParam)")
	status = attributeAffects(ia_pivotInB, ca_constraintParam);
    MCHECKSTATUS(status, "adding attributeAffects(ia_pivotInB, ca_constraintParam)")


	return MS::kSuccess;
}
コード例 #19
0
MStatus	MayaToAppleseedGlobals::initialize()
{
	MayaRenderGlobalsNode::initialize();

	MFnNumericAttribute nAttr;
	MFnTypedAttribute tAttr;
	MFnGenericAttribute gAttr;
	MFnEnumAttribute eAttr;
	MFnMessageAttribute mAttr;
	MStatus stat = MStatus::kSuccess;

	sampling_mode = eAttr.create("sampling_mode", "sampling_mode", 0, &stat);
	stat = eAttr.addField("qmc", 0);
	stat = eAttr.addField("rng", 1);
	CHECK_MSTATUS(addAttribute(sampling_mode));

	tile_ordering = eAttr.create("tile_ordering", "tile_ordering", 2, &stat);
	stat = eAttr.addField("linear", 0);
	stat = eAttr.addField("spiral", 1);
	stat = eAttr.addField("hilbert", 2);
	stat = eAttr.addField("random", 3);
	CHECK_MSTATUS(addAttribute(tile_ordering));

	bitdepth = eAttr.create( "bitdepth", "bitdepth", 3, &stat);
	stat = eAttr.addField( "8bit  Integer", 0 );
	stat = eAttr.addField( "16bit Integer", 1 );
	stat = eAttr.addField( "32bit Integer", 2 );
	stat = eAttr.addField( "16bit Float(Half)", 3 );
	stat = eAttr.addField( "32bit Float", 4 );
	stat = eAttr.addField( "64bit Double", 5 );
	CHECK_MSTATUS(addAttribute( bitdepth ));

	pixel_renderer = eAttr.create( "pixel_renderer", "pixel_renderer", 0, &stat);
	stat = eAttr.addField( "adaptive", 0 );
	stat = eAttr.addField( "uniform", 1 );
	CHECK_MSTATUS(addAttribute( pixel_renderer ));

	colorSpace = eAttr.create( "colorSpace", "colorSpace", 0, &stat);
	stat = eAttr.addField( "linear_rgb", 0 );
	stat = eAttr.addField( "srgb", 1 );
	stat = eAttr.addField( "ciexyz", 2 );
	CHECK_MSTATUS(addAttribute( colorSpace ));

	lightingEngine = eAttr.create( "lightingEngine", "lightingEngine", 0, &stat);
	stat = eAttr.addField( "Unidirectional Path tracing", 0 );
	stat = eAttr.addField( "Distributed Raytracing", 1 );
	stat = eAttr.addField( "Stochastic Progressive Photon Mapping", 2 );
	CHECK_MSTATUS(addAttribute( lightingEngine ));

	clamping = nAttr.create("clamping", "clamping",  MFnNumericData::kBoolean, false);
	CHECK_MSTATUS(addAttribute( clamping ));

	maxError = nAttr.create("maxError", "maxError",  MFnNumericData::kFloat, 0.01f);
	CHECK_MSTATUS(addAttribute( maxError ));

	adaptiveQuality = nAttr.create("adaptiveQuality", "adaptiveQuality",  MFnNumericData::kFloat, 3.0f);
	CHECK_MSTATUS(addAttribute( adaptiveQuality ));
	
	enable_caustics = nAttr.create("enable_caustics", "enable_caustics",  MFnNumericData::kBoolean, false);
	CHECK_MSTATUS(addAttribute( enable_caustics ));

	enable_dl = nAttr.create("enable_dl", "enable_ibl",  MFnNumericData::kBoolean, true);
	CHECK_MSTATUS(addAttribute( enable_dl ));

	enable_diagnostics = nAttr.create("enable_diagnostics", "enable_diagnostics",  MFnNumericData::kBoolean, false);
	CHECK_MSTATUS(addAttribute( enable_diagnostics ));

	diffuseDepth = nAttr.create("diffuseDepth", "diffuseDepth",  MFnNumericData::kInt, 4);
	CHECK_MSTATUS(addAttribute( diffuseDepth ));

	texCacheSize = nAttr.create("texCacheSize", "texCacheSize",  MFnNumericData::kInt, 512);
	CHECK_MSTATUS(addAttribute( texCacheSize ));

	frameRendererPasses = nAttr.create("frameRendererPasses", "frameRendererPasses",  MFnNumericData::kInt, 1);
	CHECK_MSTATUS(addAttribute( frameRendererPasses ));

	glossyDepth = nAttr.create("glossyDepth", "glossyDepth",  MFnNumericData::kInt, 4);
	CHECK_MSTATUS(addAttribute( glossyDepth ));

	environmentSamples = nAttr.create("environmentSamples", "environmentSamples",  MFnNumericData::kInt, 1);
	CHECK_MSTATUS(addAttribute( environmentSamples ));

	bsdfSamples = nAttr.create("bsdfSamples", "bsdfSamples",  MFnNumericData::kInt, 1);
	CHECK_MSTATUS(addAttribute( bsdfSamples ));

	next_event_estimation = nAttr.create("next_event_estimation", "next_event_estimation",  MFnNumericData::kBoolean, true);
	CHECK_MSTATUS(addAttribute( next_event_estimation ));

	assemblySBVH = nAttr.create("assemblySBVH", "assemblySBVH",  MFnNumericData::kBoolean, false);
	CHECK_MSTATUS(addAttribute( assemblySBVH ));

	max_path_length = nAttr.create("max_path_length", "max_path_length", MFnNumericData::kFloat, 8.0f);
	CHECK_MSTATUS(addAttribute(max_path_length));

	rr_min_path_length = nAttr.create("rr_min_path_length", "rr_min_path_length",  MFnNumericData::kFloat, 3.0f);
	CHECK_MSTATUS(addAttribute( rr_min_path_length ));

	path_tracing_max_path_length = nAttr.create("path_tracing_max_path_length", "path_tracing_max_path_length", MFnNumericData::kFloat, 0.0f);
	CHECK_MSTATUS(addAttribute(path_tracing_max_path_length));

	path_tracing_rr_min_path_length = nAttr.create("path_tracing_rr_min_path_length", "path_tracing_rr_min_path_length", MFnNumericData::kFloat, 8.0f);
	CHECK_MSTATUS(addAttribute(path_tracing_rr_min_path_length));

	photon_tracing_max_path_length = nAttr.create("photon_tracing_max_path_length", "photon_tracing_max_path_length", MFnNumericData::kFloat, 8.0f);
	CHECK_MSTATUS(addAttribute(photon_tracing_max_path_length));

	photon_tracing_rr_min_path_length = nAttr.create("photon_tracing_rr_min_path_length", "photon_tracing_rr_min_path_length", MFnNumericData::kFloat, 3.0f);
	CHECK_MSTATUS(addAttribute(photon_tracing_rr_min_path_length));

	max_ray_intensity = nAttr.create("max_ray_intensity", "max_ray_intensity",  MFnNumericData::kFloat, 0.0f);
	CHECK_MSTATUS(addAttribute( max_ray_intensity ));

	// reduced to auto because we do not need the others (I hope) remove the whole attribute in the next release
	assemblyExportType = eAttr.create( "assemblyExportType", "assemblyExportType", 0, &stat);
	stat = eAttr.addField( "Auto", 0 );
	CHECK_MSTATUS(addAttribute( assemblyExportType ));

	assemblyPolyTheshold = nAttr.create("assemblyPolyTheshold", "assemblyPolyTheshold",  MFnNumericData::kInt, 10000);
	CHECK_MSTATUS(addAttribute( assemblyPolyTheshold ));

	environmentType = eAttr.create( "environmentType", "environmentType", 0, &stat);
	stat = eAttr.addField("Constant", 0);
	stat = eAttr.addField("ConstantHemisphere", 1);
	stat = eAttr.addField("Gradient", 2);
	stat = eAttr.addField("Latitude Longitude", 3 );
	stat = eAttr.addField("Mirror Ball", 4 );
	stat = eAttr.addField("Physical Sky", 5);
	stat = eAttr.addField("OSL Environment", 6);
	CHECK_MSTATUS(addAttribute(environmentType));

	environmentColor = nAttr.createColor("environmentColor", "environmentColor");
	nAttr.setDefault(0.6f, 0.7f, 0.9f);
	nAttr.setConnectable(false);
	CHECK_MSTATUS(addAttribute( environmentColor ));

	gradientHorizon = nAttr.createColor("gradientHorizon", "gradientHorizon");
	nAttr.setDefault(0.8f, 0.8f, 0.9f);
	nAttr.setConnectable(false);
	CHECK_MSTATUS(addAttribute( gradientHorizon ));

	gradientZenit = nAttr.createColor("gradientZenit", "gradientZenit");
	nAttr.setDefault(0.2f, 0.3f, 0.6f);
	nAttr.setConnectable(false);
	CHECK_MSTATUS(addAttribute( gradientZenit ));

	environmentMap = nAttr.createColor("environmentMap", "environmentMap");
	nAttr.setDefault(0.6f, 0.7f, 0.9f);
	CHECK_MSTATUS(addAttribute( environmentMap ));

	environmentIntensity = nAttr.create("environmentIntensity", "environmentIntensity",  MFnNumericData::kFloat, 1.0f);
	nAttr.setConnectable(false);
	CHECK_MSTATUS(addAttribute( environmentIntensity ));

	directLightSamples = nAttr.create("directLightSamples", "directLightSamples",  MFnNumericData::kFloat, 1.0f);
	CHECK_MSTATUS(addAttribute( directLightSamples ));

	latlongHoShift = nAttr.create("latlongHoShift", "latlongHoShift",  MFnNumericData::kFloat, .0f);
	CHECK_MSTATUS(addAttribute( latlongHoShift ));

	latlongVeShift = nAttr.create("latlongVeShift", "latlongVeShift",  MFnNumericData::kFloat, .0f);
	CHECK_MSTATUS(addAttribute( latlongVeShift ));

	AOVs = mAttr.create("AOVs", "AOVs");
	mAttr.setArray(true);
	mAttr.indexMatters(false);
	CHECK_MSTATUS(addAttribute( AOVs ));

	ground_albedo = nAttr.create("ground_albedo", "ground_albedo",  MFnNumericData::kFloat, .0f);
	CHECK_MSTATUS(addAttribute( ground_albedo ));

	horizon_shift = nAttr.create("horizon_shift", "horizon_shift",  MFnNumericData::kFloat, -0.05f);
	CHECK_MSTATUS(addAttribute( horizon_shift ));

	luminance_multiplier = nAttr.create("luminance_multiplier", "luminance_multiplier",  MFnNumericData::kFloat, 1.0f);
	CHECK_MSTATUS(addAttribute( luminance_multiplier ));

	saturation_multiplier = nAttr.create("saturation_multiplier", "saturation_multiplier",  MFnNumericData::kFloat, 1.0f);
	CHECK_MSTATUS(addAttribute( saturation_multiplier ));

	sun_phi = nAttr.create("sun_phi", "sun_phi",  MFnNumericData::kFloat, .0f);
	CHECK_MSTATUS(addAttribute( sun_phi ));

	sun_theta = nAttr.create("sun_theta", "sun_theta",  MFnNumericData::kFloat, 60.0f);
	CHECK_MSTATUS(addAttribute( sun_theta ));

	turbidity = nAttr.create("turbidity", "turbidity",  MFnNumericData::kFloat, 3.0f);
	CHECK_MSTATUS(addAttribute( turbidity ));

	turbidity_max = nAttr.create("turbidity_max", "turbidity_max",  MFnNumericData::kFloat, 3.0f);
	CHECK_MSTATUS(addAttribute( turbidity_max ));

	turbidity_min = nAttr.create("turbidity_min", "turbidity_min",  MFnNumericData::kFloat, 3.0f);
	CHECK_MSTATUS(addAttribute( turbidity_min ));

	skyModel = eAttr.create( "skyModel", "skyModel", 0, &stat);
	stat = eAttr.addField( "Preetham", 0 );
	stat = eAttr.addField( "Hosek", 1 );
	CHECK_MSTATUS(addAttribute( skyModel ));

	physicalSun = nAttr.create("physicalSun", "physicalSun",  MFnNumericData::kBoolean, false);
	CHECK_MSTATUS(addAttribute( physicalSun ));

	physicalSunConnection = mAttr.create("physicalSunConnection", "physicalSunConnection");
	CHECK_MSTATUS(addAttribute( physicalSunConnection ));

	sunTurbidity = nAttr.create("sunTurbidity", "sunTurbidity",  MFnNumericData::kFloat, 3.0f);
	CHECK_MSTATUS(addAttribute( sunTurbidity ));

	sunExitanceMultiplier = nAttr.create("sunExitanceMultiplier", "sunExitanceMultiplier",  MFnNumericData::kFloat, 1.0f);
	CHECK_MSTATUS(addAttribute( sunExitanceMultiplier ));

	sppmAlpha = nAttr.create("sppmAlpha", "sppmAlpha",  MFnNumericData::kFloat, .8f);
	CHECK_MSTATUS(addAttribute( sppmAlpha ));

	dl_mode = eAttr.create("dl_mode", "dl_mode", 0, &stat);
	stat = eAttr.addField("RT Direct Lighting", 0);
	stat = eAttr.addField("SPPM Direct Lighting", 1);
	stat = eAttr.addField("No Direct Lighting", 2);
	CHECK_MSTATUS(addAttribute(dl_mode));

	env_photons_per_pass = nAttr.create("env_photons_per_pass", "env_photons_per_pass",  MFnNumericData::kInt, 100000);
	CHECK_MSTATUS(addAttribute( env_photons_per_pass ));

	initial_radius = nAttr.create("initial_radius", "initial_radius",  MFnNumericData::kFloat, .5f);
	CHECK_MSTATUS(addAttribute( initial_radius ));

	light_photons_per_pass = nAttr.create("light_photons_per_pass", "light_photons_per_pass",  MFnNumericData::kInt, 100000);
	CHECK_MSTATUS(addAttribute( light_photons_per_pass ));

	max_photons_per_estimate = nAttr.create("max_photons_per_estimate", "max_photons_per_estimate",  MFnNumericData::kInt, 100);
	CHECK_MSTATUS(addAttribute( max_photons_per_estimate ));

	photons_per_pass = nAttr.create("photons_per_pass", "photons_per_pass",  MFnNumericData::kInt, 100000);
	CHECK_MSTATUS(addAttribute( photons_per_pass ));

	photon_type = eAttr.create("photon_type", "photon_type", 1, &stat);
	stat = eAttr.addField("Monochromatic", 0);
	stat = eAttr.addField("Polychromatic", 1);
	CHECK_MSTATUS(addAttribute(photon_type));

	return stat;

}
コード例 #20
0
ファイル: volume_select.cpp プロジェクト: 3doki/Maya_API_RnD
	static MStatus initialize()
	{
		MFnEnumAttribute enumAttrFn;
		MFnNumericAttribute numericAttrFn;
		MFnGenericAttribute genericAttrFn;
		MFnTypedAttribute typeAttrFn;

		// enable node
		aEnable = numericAttrFn.create( "enbale", "e", MFnNumericData::kBoolean, 0, &status );
		numericAttrFn.setDefault(0);
		numericAttrFn.setKeyable(true);
		addAttribute(aEnable);

		aFixPanel = numericAttrFn.create( "fixPanel", "fpn", MFnNumericData::kBoolean, 0, &status);
		numericAttrFn.setDefault(1);
		numericAttrFn.setConnectable(true);
		addAttribute(aFixPanel);

		aKeepSel = numericAttrFn.create( "keepSelection", "ks", MFnNumericData::kBoolean, 0, &status);
		numericAttrFn.setDefault(0);
		addAttribute(aKeepSel);

		// component type
		aComponentType = enumAttrFn.create( "componetType", "ct", 0, &status );
		CHECK_MSTATUS( status );
		enumAttrFn.setDefault(0);
		enumAttrFn.addField( "vertex", 0 );
		enumAttrFn.addField( "edge", 1 );
		enumAttrFn.addField( "face", 2 );
		enumAttrFn.addField( "uv", 3 );
		addAttribute( aComponentType );
		
		// source object
		aSourceObj = genericAttrFn.create( "sourceObject", "so", &status );
		genericAttrFn.addAccept(MFnData::kMesh);
		genericAttrFn.setStorable(false);
		addAttribute( aSourceObj );
		CHECK_MSTATUS( status );

		// volume object
		aVolumeObj = genericAttrFn.create( "volumeObject", "vo", &status );
		genericAttrFn.addAccept(MFnData::kMesh);
		genericAttrFn.setArray(true);
		addAttribute( aVolumeObj );
		CHECK_MSTATUS( status );

				
		aClosedObj = numericAttrFn.create( "closedVolumeObject", "cvo", MFnNumericData::kBoolean, 1, &status );
		numericAttrFn.setDefault(1);
		addAttribute( aClosedObj );


		// ouput attribute
		//
		aOutValue = numericAttrFn.create( "outValue", "ov", MFnNumericData::kInt,  0, &status );
		CHECK_MSTATUS( status );
		numericAttrFn.setReadable(false);
		addAttribute( aOutValue );

		aOutCompList = typeAttrFn.create( "outComponent", "ocp", MFnComponentListData::kComponentList, &status );
		CHECK_MSTATUS( status );
		addAttribute(aOutCompList);

		aOutMesh = typeAttrFn.create( "outMesh", "om", MFnData::kMesh, &status );
		CHECK_MSTATUS( status );
		addAttribute(aOutMesh);


		// Attribute Affects for aOutValue
		attributeAffects( aEnable, aOutValue );
		attributeAffects( aFixPanel, aOutValue );
		attributeAffects( aComponentType, aOutValue );
		attributeAffects( aKeepSel, aOutValue );
		attributeAffects( aClosedObj, aOutValue );
		attributeAffects( aSourceObj, aOutValue );
		attributeAffects( aVolumeObj, aOutValue );

		//Attribute Affects for aOutCompList
		attributeAffects( aEnable, aOutCompList);
		attributeAffects( aFixPanel, aOutCompList );
		attributeAffects( aComponentType, aOutCompList );
		attributeAffects( aKeepSel, aOutCompList );
		attributeAffects( aClosedObj, aOutCompList );
		attributeAffects( aSourceObj, aOutCompList );
		attributeAffects( aVolumeObj, aOutCompList );

		//Attribute Affects for aOutMesh
		attributeAffects( aEnable, aOutMesh);
		attributeAffects( aFixPanel, aOutMesh );
		attributeAffects( aComponentType, aOutMesh );
		attributeAffects( aKeepSel, aOutMesh );
		attributeAffects( aClosedObj, aOutMesh );
		attributeAffects( aSourceObj, aOutMesh );
		attributeAffects( aVolumeObj, aOutMesh );


		return MS::kSuccess;
	}
コード例 #21
0
MStatus buildRotation::initialize()
{
	MFnNumericAttribute nAttr;
	MFnMatrixAttribute  mAttr;
	MFnUnitAttribute    uAttr;
	MFnEnumAttribute    eAttr;
	MStatus				stat;

	// Set up inputs
	//
    upX = nAttr.create( "upX", "ux", MFnNumericData::kDouble );
 	    nAttr.setStorable(false);
    upY = nAttr.create( "upY", "uy", MFnNumericData::kDouble );
 	    nAttr.setStorable(false);
    upZ = nAttr.create( "upZ", "uz", MFnNumericData::kDouble );
 	    nAttr.setStorable(false);
	up = nAttr.create( "up", "u", upX, upY, upZ );
	    nAttr.setDefault( 0.0, 1.0, 0.0 );
 	    nAttr.setStorable(false);

    forwardX = nAttr.create( "forwardX", "fx", MFnNumericData::kDouble, 0.0 );
 	    nAttr.setStorable(false);
    forwardY = nAttr.create( "forwardY", "fy", MFnNumericData::kDouble, 0.0 );
 	    nAttr.setStorable(false);
    forwardZ = nAttr.create( "forwardZ", "fz", MFnNumericData::kDouble, 1.0 );
 	    nAttr.setStorable(false);
	forward = nAttr.create( "forward", "f", forwardX, forwardY, forwardZ );
	    nAttr.setDefault( 0.0, 0.0, 1.0 );
 	    nAttr.setStorable(false);

	rotateOrder = eAttr.create( "rotateOrder", "ro", ROTATE_ORDER_XYZ);
		eAttr.addField("xyz", ROTATE_ORDER_XYZ);
		eAttr.addField("yzx", ROTATE_ORDER_YZX);
		eAttr.addField("zxy", ROTATE_ORDER_ZXY);
		eAttr.addField("xzy", ROTATE_ORDER_XZY);
		eAttr.addField("yxz", ROTATE_ORDER_YXZ);
		eAttr.addField("zyx", ROTATE_ORDER_ZYX);
 	    eAttr.setStorable(false);

	// Set up outputs
	// 
    rotateX = uAttr.create( "rotateX", "rx", MFnUnitAttribute::kAngle, 0.0 );
 	    nAttr.setStorable(false);
    rotateY = uAttr.create( "rotateY", "ry", MFnUnitAttribute::kAngle, 0.0 );
 	    nAttr.setStorable(false);
    rotateZ = uAttr.create( "rotateZ", "rz", MFnUnitAttribute::kAngle, 0.0 );
 	    nAttr.setStorable(false);
	rotate = nAttr.create( "rotate", "r", rotateX, rotateY, rotateZ );
 	    nAttr.setStorable(false);
		
	rotateMatrix = mAttr.create( "rotateMatrix", "rm" );
	    nAttr.setStorable(false);
		nAttr.setConnectable(true);

	stat = addAttribute( up );
		if (!stat) { stat.perror("addAttribute"); return stat;}
	stat = addAttribute( forward );
		if (!stat) { stat.perror("addAttribute"); return stat;}
	stat = addAttribute( rotate );
		if (!stat) { stat.perror("addAttribute"); return stat;}
	stat = addAttribute( rotateOrder );
		if (!stat) { stat.perror("addAttribute"); return stat;}
	stat = addAttribute( rotateMatrix );
		if (!stat) { stat.perror("addAttribute"); return stat;}

	stat = attributeAffects( up, rotate );
		if (!stat) { stat.perror("attributeAffects"); return stat;}
	stat = attributeAffects( up, rotateMatrix );
		if (!stat) { stat.perror("attributeAffects"); return stat;}
	stat = attributeAffects( forward, rotate );
		if (!stat) { stat.perror("attributeAffects"); return stat;}
	stat = attributeAffects( forward, rotateMatrix );
		if (!stat) { stat.perror("attributeAffects"); return stat;}
	stat = attributeAffects( rotateOrder, rotate );
		if (!stat) { stat.perror("attributeAffects"); return stat;}
	stat = attributeAffects( rotateOrder, rotateMatrix );
		if (!stat) { stat.perror("attributeAffects"); return stat;}

	return MS::kSuccess;
}