本文整理汇总了C++中MFnMessageAttribute类的典型用法代码示例。如果您正苦于以下问题:C++ MFnMessageAttribute类的具体用法?C++ MFnMessageAttribute怎么用?C++ MFnMessageAttribute使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了MFnMessageAttribute类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: depMetaDataNodeFn
void lrutils::createFKCtlFromLocation(MVectorArray location, MObject joint, MString prefix, unsigned int num, MString icon, MString color, MObject parent, MObject& fkCtlObj, MObject& fkCtlGroupObj, MString layerName, MObject metaDataNode) {
MStatus status;
MDGModifier dgMod;
//used for holding results from executed commands
MStringArray result;
MFnDependencyNode depMetaDataNodeFn(metaDataNode);
//used for creating metaParent attributes for objects
MFnMessageAttribute mAttr;
MFnTransform jointFn(joint);
//create the control object and set its color
status = MGlobal::executeCommand( "python(\"control = rig101().rig101WCGetByName('" + icon + "')\");" );
status = MGlobal::executeCommand( "python(\"Utils.setControllerColor(control, '" + color + "')\");" );
status = MGlobal::executeCommand( MString("python(\"control.fullPath()\");"), result );
//get the MObject for the controller
status = lrutils::getObjFromName(result[0], fkCtlObj);
MyCheckStatus(status, "lrutils::getObjFromName() failed");
MFnTransform fkCtlFn( fkCtlObj );
lrutils::setLocation(fkCtlObj, location, MFnTransform::MFnTransform(), false, false, true);
//set controller name
MString fkCtlName = prefix + "_FK_"+num+"_CTL";
dgMod.renameNode(fkCtlObj, fkCtlName);
//add the metaParent attribute to the controller
MObject controlAttr = mAttr.create("metaParent", "metaParent");
fkCtlFn.addAttribute(controlAttr);
//connect the controller's metaParent to the MDSpine node
status = dgMod.connect( depMetaDataNodeFn.findPlug("FKControllers"), fkCtlFn.findPlug("metaParent") );
dgMod.doIt();
//create the fk control null
lrutils::makeHomeNull(fkCtlObj, MFnTransform(), fkCtlGroupObj);
lrutils::setLocation(fkCtlGroupObj, location, MFnTransform::MFnTransform(), true, true, false);
MFnTransform fkCtlGroupFn( fkCtlGroupObj );
if(!parent.isNull()) {
MFnTransform parentFn(parent);
MGlobal::executeCommand("parent " + fkCtlGroupFn.fullPathName() + " " + parentFn.fullPathName() + ";");
}
//add the metaParent attribute to the controller group
fkCtlGroupFn.addAttribute(mAttr.create("metaParent", "metaParent"));
//connect the controller group's metaParent to the MDGlobal node
status = dgMod.connect( depMetaDataNodeFn.findPlug("FKControllerGroups"), fkCtlGroupFn.findPlug("metaParent") );
MyCheckStatus(status, "connect failed");
dgMod.doIt();
MGlobal::executeCommand("parentConstraint -mo " + fkCtlFn.fullPathName() + " " + jointFn.fullPathName() + ";",result);
MObject jointParentConstraintObj;
status = lrutils::getObjFromName(result[0], jointParentConstraintObj);
MyCheckStatus(status, "lrutils::getObjFromName() failed");
MFnTransform jointParentConstraintFn(jointParentConstraintObj);
jointParentConstraintFn.addAttribute(mAttr.create("metaParent", "metaParent"));
status = dgMod.connect( depMetaDataNodeFn.findPlug("FKJointParentConstraints"), jointParentConstraintFn.findPlug("metaParent"));
dgMod.doIt();
//set the display layers for the controller and controller group
MGlobal::executeCommand("editDisplayLayerMembers -noRecurse "+ layerName+" "+ fkCtlFn.fullPathName()+";");
MGlobal::executeCommand("editDisplayLayerMembers -noRecurse "+ layerName+" "+ fkCtlGroupFn.fullPathName()+";");
MGlobal::executeCommand("select -cl;");
}
示例2: initialize
MStatus inverseSkinCluster::initialize()
{
MStatus status;
MFnNumericAttribute nAttr;
MFnMatrixAttribute mAttr;
MFnMessageAttribute msgAttr;
MFnTypedAttribute tAttr;
aInMesh = tAttr.create( "inMesh", "inMesh", MFnData::kMesh );
tAttr.setStorable( true );
CHECK_MSTATUS_AND_RETURN_IT( addAttribute( aInMesh ) );
aGeomMatrix = mAttr.create( "geomMatrix", "geomMatrix" );
tAttr.setCached( false );
CHECK_MSTATUS_AND_RETURN_IT( addAttribute( aGeomMatrix ) );
aMatrix = mAttr.create( "matrix", "matrix" );
mAttr.setArray( true );
mAttr.setStorable( true );
mAttr.setUsesArrayDataBuilder( true );
CHECK_MSTATUS_AND_RETURN_IT( addAttribute( aMatrix ) );
aBindPreMatrix = mAttr.create( "bindPreMatrix", "bindPreMatrix" );
mAttr.setArray( true );
mAttr.setStorable( true );
mAttr.setUsesArrayDataBuilder( true );
CHECK_MSTATUS_AND_RETURN_IT( addAttribute( aBindPreMatrix ) );
aUpdateMatrix = nAttr.create( "updateMatrix", "updateMatrix", MFnNumericData::kBoolean, false );
nAttr.setStorable( false );
CHECK_MSTATUS_AND_RETURN_IT( addAttribute( aUpdateMatrix ) );
aTargetSkinCluster = msgAttr.create( "targetSkinCluster", "targetSkinCluster" );
CHECK_MSTATUS_AND_RETURN_IT( addAttribute( aTargetSkinCluster ) );
aUpdateWeightList = nAttr.create( "updateWeightList", "updateWeightList", MFnNumericData::kBoolean, false );
nAttr.setStorable( false );
CHECK_MSTATUS_AND_RETURN_IT( addAttribute( aUpdateWeightList ) );
CHECK_MSTATUS_AND_RETURN_IT( attributeAffects( aInMesh, outputGeom ) );
CHECK_MSTATUS_AND_RETURN_IT( attributeAffects( aGeomMatrix, outputGeom ) );
CHECK_MSTATUS_AND_RETURN_IT( attributeAffects( aMatrix, outputGeom ) );
CHECK_MSTATUS_AND_RETURN_IT( attributeAffects( aBindPreMatrix, outputGeom ) );
CHECK_MSTATUS_AND_RETURN_IT( attributeAffects( aUpdateMatrix, outputGeom ) );
CHECK_MSTATUS_AND_RETURN_IT( attributeAffects( aUpdateWeightList, outputGeom ) );
CHECK_MSTATUS_AND_RETURN_IT( attributeAffects( aTargetSkinCluster, outputGeom ) );
CHECK_MSTATUS_AND_RETURN_IT( attributeAffects( aMatrix, outputGeom ) );
return MS::kSuccess;
}
示例3: jointFn
std::vector<MObject> lrutils::buildSkeletonFromGuide(std::vector<MVectorArray> locations, MString prefix, MPlug metaDataPlug, MObject metaParentJoint, MString layerName) {
MDGModifier dgMod;
MStatus status;
std::vector<MObject> joints;
MFnMessageAttribute mAttr;
MObject parentJoint;
unsigned int jointNum = 0;
for (std::vector<MVectorArray>::iterator it = locations.begin(); it != locations.end(); ++it) {
MVectorArray location = *it;
MObject joint = createJointFromLocation(location, prefix, jointNum, parentJoint);
joints.push_back(joint);
MFnTransform jointFn( joint );
//add metaParent attributes to joint
if(!metaDataPlug.isNull()) {
MObject jointAttr = mAttr.create("metaParent", "metaParent");
jointFn.addAttribute(jointAttr);
//connect the metaparent attribute to the MDSpine node
status = dgMod.connect( metaDataPlug, jointFn.findPlug("metaParent") );
MyCheckStatus(status, "connect failed");
dgMod.doIt();
}
//if layer name is provided, add the joint to that display layer
if(layerName != "") {
MGlobal::executeCommand("editDisplayLayerMembers -noRecurse "+ layerName+" "+ jointFn.name()+";");
}
parentJoint = joint;
jointNum++;
}
//orient the joint chain
MFnTransform topJointFn(joints.at(0));
MGlobal::executeCommand("joint -e -zso -oj \"xyz\" -sao \"yup\" -ch " + topJointFn.fullPathName() + ";");
//if meta parent joint is not null, parent first joint to it
if(!metaParentJoint.isNull()) {
MFnTransform firstJointFn(joints.at(0));
MFnTransform metaParentJointFn(metaParentJoint);
MGlobal::executeCommand("parent " + firstJointFn.fullPathName() + " " + metaParentJointFn.fullPathName() + ";");
//orient the parent joint
MGlobal::executeCommand("joint -e -zso -oj \"xyz\" -sao \"yup\" -ch " + metaParentJointFn.fullPathName() + ";");
}
return joints;
}
示例4: getenv
MStatus MayaRenderGlobalsNode::initialize()
{
MFnNumericAttribute nAttr;
MFnTypedAttribute tAttr;
MFnGenericAttribute gAttr;
MFnEnumAttribute eAttr;
MFnMessageAttribute mAttr;
MStatus stat = MStatus::kSuccess;
filtertype = eAttr.create("filtertype", "filtertype", 0, &stat);
CHECK_MSTATUS(addAttribute( filtertype ));
imageFormat = eAttr.create("imageFormat", "imageFormat", 0, &stat);
CHECK_MSTATUS(addAttribute( imageFormat ));
sceneScale = nAttr.create("sceneScale", "sceneScale", MFnNumericData::kFloat, 1.0f);
CHECK_MSTATUS(addAttribute( sceneScale ));
useSunLightConnection = nAttr.create("useSunLightConnection", "useSunLightConnection", MFnNumericData::kBoolean, false);
CHECK_MSTATUS(addAttribute( useSunLightConnection ));
exportSceneFile = nAttr.create("exportSceneFile", "exportSceneFile", MFnNumericData::kBoolean, false);
CHECK_MSTATUS(addAttribute( exportSceneFile ));
exportSceneFileName = tAttr.create("exportSceneFileName", "exportSceneFileName", MFnNumericData::kString);
tAttr.setUsedAsFilename(true);
CHECK_MSTATUS(addAttribute( exportSceneFileName ));
// sampling adaptive
minSamples = nAttr.create("minSamples", "minSamples", MFnNumericData::kInt, 1);
CHECK_MSTATUS(addAttribute( minSamples ));
maxSamples = nAttr.create("maxSamples", "maxSamples", MFnNumericData::kInt, 16);
CHECK_MSTATUS(addAttribute( maxSamples ));
// sampling raster based
samplesX = nAttr.create("samplesX", "samplesX", MFnNumericData::kInt, 3);
CHECK_MSTATUS(addAttribute( samplesX ));
samplesY = nAttr.create("samplesY", "samplesY", MFnNumericData::kInt, 3);
CHECK_MSTATUS(addAttribute( samplesY ));
doMotionBlur = nAttr.create("doMotionBlur", "doMotionBlur", MFnNumericData::kBoolean, false);
CHECK_MSTATUS(addAttribute( doMotionBlur ));
motionBlurRange = nAttr.create("motionBlurRange", "motionBlurRange", MFnNumericData::kFloat, 0.4);
CHECK_MSTATUS(addAttribute( motionBlurRange ));
motionBlurType = eAttr.create("motionBlurType", "motionBlurType", 0, &stat);
stat = eAttr.addField( "Center", 0 );
stat = eAttr.addField( "FrameStart", 1 );
stat = eAttr.addField( "FrameEnd", 2 );
CHECK_MSTATUS(addAttribute( motionBlurType ));
doDof = nAttr.create("doDof", "doDof", MFnNumericData::kBoolean, false);
CHECK_MSTATUS(addAttribute( doDof ));
xftimesamples = nAttr.create("xftimesamples", "xftimesamples", MFnNumericData::kInt, 2);
CHECK_MSTATUS(addAttribute(xftimesamples));
geotimesamples = nAttr.create("geotimesamples", "geotimesamples", MFnNumericData::kInt, 2);
CHECK_MSTATUS(addAttribute(geotimesamples));
MString numCpu = getenv("NUMBER_OF_PROCESSORS");
int numberOfProcessors = numCpu.asInt();
threads = nAttr.create("threads", "threads", MFnNumericData::kInt, numberOfProcessors);
nAttr.setMin(1);
CHECK_MSTATUS(addAttribute( threads ));
translatorVerbosity = eAttr.create("translatorVerbosity", "translatorVerbosity", 2, &stat);
stat = eAttr.addField( "Info", 0 );
stat = eAttr.addField( "Error", 1 );
stat = eAttr.addField( "Warning", 2 );
stat = eAttr.addField( "Progress", 3 );
stat = eAttr.addField( "Debug", 4 );
stat = eAttr.addField( "None", 5 );
CHECK_MSTATUS(addAttribute( translatorVerbosity ));
rendererVerbosity = nAttr.create("rendererVerbosity", "rendererVerbosity", MFnNumericData::kInt, 2);
CHECK_MSTATUS(addAttribute( rendererVerbosity ));
detectShapeDeform = nAttr.create("detectShapeDeform", "detectShapeDeform", MFnNumericData::kBoolean, true);
CHECK_MSTATUS(addAttribute( detectShapeDeform ));
filtersize = nAttr.create("filtersize", "filtersize", MFnNumericData::kInt, 3);
CHECK_MSTATUS(addAttribute( filtersize ));
tilesize = nAttr.create("tilesize", "tilesize", MFnNumericData::kInt, 64);
CHECK_MSTATUS(addAttribute( tilesize ));
basePath = tAttr.create("basePath", "basePath", MFnNumericData::kString);
CHECK_MSTATUS(addAttribute( basePath ));
imagePath = tAttr.create("imagePath", "imagePath", MFnNumericData::kString);
CHECK_MSTATUS(addAttribute( imagePath ));
imageName = tAttr.create("imageName", "imageName", MFnNumericData::kString);
CHECK_MSTATUS(addAttribute( imageName ));
gamma = nAttr.create("gamma", "gamma", MFnNumericData::kFloat, 1.0f);
CHECK_MSTATUS(addAttribute( gamma ));
//.........这里部分代码省略.........
示例5: initialize
MStatus mtmEnvLight::initialize()
{
MFnTypedAttribute tAttr;
MFnNumericAttribute nAttr;
MFnLightDataAttribute lAttr;
MFnEnumAttribute eAttr;
MFnMessageAttribute mAttr;
MStatus stat;
//aColor = nAttr.createColor( "color", "c" );
//CHECK_MSTATUS ( nAttr.setKeyable(true) );
//CHECK_MSTATUS ( nAttr.setStorable(true) );
//CHECK_MSTATUS ( nAttr.setDefault(0.0f, 0.58824f, 0.644f) );
aLightColor = nAttr.createColor( "lightColor", "lightColor" );
CHECK_MSTATUS ( nAttr.setKeyable(true) );
CHECK_MSTATUS ( nAttr.setStorable(true) );
nAttr.setDefault(0.7f, 0.58824f, 0.344f);
aShadowColor = nAttr.createColor( "shadowColor", "sc" );
CHECK_MSTATUS ( nAttr.setKeyable(true) );
CHECK_MSTATUS ( nAttr.setStorable(true) );
CHECK_MSTATUS ( nAttr.setDefault(0.0f, 0.0f, 0.0f) );
aPosition = nAttr.createPoint( "position", "pos" );
CHECK_MSTATUS ( nAttr.setKeyable(true) );
CHECK_MSTATUS ( nAttr.setStorable(true) );
aInputDirection = nAttr.createPoint( "inputDirection", "id" );
CHECK_MSTATUS ( nAttr.setKeyable(true) );
CHECK_MSTATUS ( nAttr.setStorable(true) );
CHECK_MSTATUS ( nAttr.setDefault(-1.0f, 0.0f, 0.0f) );
aInputAmbient = nAttr.create( "ambientOn", "an", MFnNumericData::kBoolean);
CHECK_MSTATUS ( nAttr.setKeyable(true) );
CHECK_MSTATUS ( nAttr.setStorable(true) );
CHECK_MSTATUS ( nAttr.setHidden(false) );
CHECK_MSTATUS ( nAttr.setDefault(true) );
aInputDiffuse = nAttr.create( "emitDiffuse", "dn", MFnNumericData::kBoolean);
CHECK_MSTATUS ( nAttr.setKeyable(true) );
CHECK_MSTATUS ( nAttr.setStorable(true) );
CHECK_MSTATUS ( nAttr.setHidden(false) );
CHECK_MSTATUS ( nAttr.setDefault(true) );
aInputSpecular = nAttr.create( "emitSpecular", "sn", MFnNumericData::kBoolean);
CHECK_MSTATUS ( nAttr.setKeyable(true) );
CHECK_MSTATUS ( nAttr.setStorable(true) );
CHECK_MSTATUS ( nAttr.setHidden(false) );
CHECK_MSTATUS ( nAttr.setDefault(true) );
aIntensity = nAttr.create( "intensity", "i", MFnNumericData::kFloat);
CHECK_MSTATUS ( nAttr.setKeyable(true) );
CHECK_MSTATUS ( nAttr.setStorable(true) );
CHECK_MSTATUS ( nAttr.setHidden(false) );
CHECK_MSTATUS ( nAttr.setDefault(1.0f) );
samplingquality = nAttr.create( "samplingquality", "samplingquality", MFnNumericData::kFloat, 1.0);
envmap = tAttr.create( "envmap", "envmap", MFnNumericData::kString);
tAttr.setUsedAsFilename(true);
areamap = tAttr.create( "areamap", "areamap", MFnNumericData::kString);
tAttr.setUsedAsFilename(true);
areafullsphere = nAttr.create( "areafullsphere", "areafullsphere", MFnNumericData::kBoolean, true);
envintensity = nAttr.createColor( "envintensity", "envintensity" );
nAttr.setDefault(1.0f, 1.0f, 1.0f);
raybackground = nAttr.create( "raybackground", "raybackground", MFnNumericData::kBoolean, false);
castshadow = nAttr.create( "castshadow", "castshadow", MFnNumericData::kBoolean, true);
envtype = eAttr.create( "envtype", "envtype", 0, &stat);
stat = eAttr.addField( "Direct Lighting", 0 );
stat = eAttr.addField( "Ambient Occlusion", 1 );
stat = eAttr.addField( "Full Irradiance", 2 );
stat = eAttr.addField( "Raytrace Background", 3 );
eAttr.setDefault(0);
doraysamples = nAttr.create( "doraysamples", "doraysamples", MFnNumericData::kBoolean, false);
doadaptive = nAttr.create( "doadaptive", "doadaptive", MFnNumericData::kBoolean, false);
domaxdist = nAttr.create( "domaxdist", "domaxdist", MFnNumericData::kBoolean, false);
maxdist = nAttr.create( "maxdist", "maxdist", MFnNumericData::kFloat, 10.0);
coneangle = nAttr.create( "coneangle", "coneangle", MFnNumericData::kFloat, 45.0);
envtint = nAttr.createColor( "envtint", "envtint" );
nAttr.setDefault(1.0f, 1.0f, 1.0f);
shadowI = nAttr.create( "shadowI", "shadowI", MFnNumericData::kFloat, 1.0);
samples = nAttr.create( "samples", "samples", MFnNumericData::kInt, 32);
MFnStringData fnStringData;
MObject defaultObjectMask;
defaultObjectMask = fnStringData.create( "*" );
objectmask = tAttr.create( "objectmask", "objectmask", MFnNumericData::kString, defaultObjectMask);
usePortalGeometry = nAttr.create( "usePortalGeometry", "usePortalGeometry", MFnNumericData::kBoolean, false);
portalGeometry = mAttr.create( "portalGeometry", "portalGeometry");
mAttr.setConnectable(true);
mAttr.accepts(MFnData::kAny);
// Outputs
aLightDirection = nAttr.createPoint( "lightDirection", "ld" );
CHECK_MSTATUS ( nAttr.setStorable(false) );
CHECK_MSTATUS ( nAttr.setHidden(true) );
CHECK_MSTATUS ( nAttr.setReadable(true) );
CHECK_MSTATUS ( nAttr.setWritable(false) );
CHECK_MSTATUS ( nAttr.setDefault(-1.0f, 0.0f, 0.0f) );
//.........这里部分代码省略.........
示例6: initialize
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)")
//.........这里部分代码省略.........
示例7: initialize
MStatus Layered::initialize()
{
MFnNumericAttribute nAttr;
MFnLightDataAttribute lAttr;
MFnTypedAttribute tAttr;
MFnGenericAttribute gAttr;
MFnEnumAttribute eAttr;
MFnMessageAttribute mAttr;
MStatus status; // Status will be used to hold the MStatus value
// returned by each api function call. It is important
// to check the status returned by a call to aid in
// debugging. Failed API calls can result in subtle
// errors that can be difficult to track down, you may
// wish to use the CHECK_MSTATUS macro for any API
// call where you do not need to provide your own
// error handling.
//
baseShader = nAttr.createColor("baseShader", "baseShader");
CHECK_MSTATUS(addAttribute(baseShader));
layerWeight = nAttr.create("layerWeight", "layerWeight", MFnNumericData::kFloat, 0, &status);
nAttr.setArray(true);
CHECK_MSTATUS(addAttribute(layerWeight));
layerTexture = mAttr.create("layerTexture", "layerTexture");
mAttr.setArray(true);
CHECK_MSTATUS(addAttribute(layerTexture));
layerShader = nAttr.createColor("layerShader", "layerShader");
nAttr.setArray(true);
CHECK_MSTATUS(addAttribute(layerShader));
outColor = nAttr.createColor("outColor", "outColor");
CHECK_MSTATUS(addAttribute(outColor));
//---------------------------- automatically created attributes start ------------------------------------
//---------------------------- automatically created attributes end ------------------------------------
aTranslucenceCoeff = nAttr.create("translucenceCoeff", "tc",
MFnNumericData::kFloat, 0, &status);
CHECK_MSTATUS(status);
CHECK_MSTATUS(nAttr.setKeyable(true));
CHECK_MSTATUS(nAttr.setStorable(true));
CHECK_MSTATUS(nAttr.setDefault(0.0f));
aDiffuseReflectivity = nAttr.create("diffuseReflectivity", "drfl",
MFnNumericData::kFloat, 0, &status);
CHECK_MSTATUS(status);
CHECK_MSTATUS(nAttr.setKeyable(true));
CHECK_MSTATUS(nAttr.setStorable(true));
CHECK_MSTATUS(nAttr.setDefault(0.8f));
aColor = nAttr.createColor("color", "c", &status);
CHECK_MSTATUS(status);
CHECK_MSTATUS(nAttr.setKeyable(true));
CHECK_MSTATUS(nAttr.setStorable(true));
CHECK_MSTATUS(nAttr.setDefault(0.0f, 0.58824f, 0.644f));
aIncandescence = nAttr.createColor("incandescence", "ic", &status);
CHECK_MSTATUS(status);
CHECK_MSTATUS(nAttr.setKeyable(true));
CHECK_MSTATUS(nAttr.setStorable(true));
CHECK_MSTATUS(nAttr.setDefault(0.0f, 0.0f, 0.0f));
aInTransparency = nAttr.createColor("transparency", "it", &status);
CHECK_MSTATUS(status);
CHECK_MSTATUS(nAttr.setKeyable(true));
CHECK_MSTATUS(nAttr.setStorable(true));
CHECK_MSTATUS(nAttr.setDefault(0.0f, 0.0f, 0.0f));
CHECK_MSTATUS(nAttr.setHidden(false));
CHECK_MSTATUS(nAttr.setReadable(true));
CHECK_MSTATUS(nAttr.setWritable(false));
aOutTransparency = nAttr.createColor("outTransparency", "ot", &status);
CHECK_MSTATUS(status);
CHECK_MSTATUS(nAttr.setHidden(false));
CHECK_MSTATUS(nAttr.setReadable(true));
CHECK_MSTATUS(nAttr.setWritable(false));
// 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);
//.........这里部分代码省略.........
示例8: initialize
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));
//.........这里部分代码省略.........
示例9: Float
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));
//.........这里部分代码省略.........
示例10: initialize
MStatus dSolverNode::initialize()
{
MStatus status;
MFnEnumAttribute fnEnumAttr;
MFnMessageAttribute fnMsgAttr;
MFnUnitAttribute fnUnitAttr;
MFnNumericAttribute fnNumericAttr;
//
ssSolverType = fnEnumAttr.create( "ssSolverType", "ssst", 0, &status );
MCHECKSTATUS(status, "creating ssSolverType attribute")
fnEnumAttr.addField( "Bullet Physics", 0 );
fnEnumAttr.addField( "Ageia PhysX", 1 );
fnEnumAttr.addField( "Stanford PhysBAM", 2 );
status = addAttribute(ssSolverType);
MCHECKSTATUS(status, "adding ssSolverType attribute")
//
ia_time = fnUnitAttr.create( "inTime", "it", MFnUnitAttribute::kTime, 0.0, &status );
MCHECKSTATUS(status, "creating ia_time attribute")
fnUnitAttr.setHidden(true);
status = addAttribute(ia_time);
MCHECKSTATUS(status, "adding ia_time attribute")
ia_startTime = fnUnitAttr.create( "startTime", "stm", MFnUnitAttribute::kTime, 1.0, &status );
MCHECKSTATUS(status, "creating ia_startTime attribute")
status = addAttribute(ia_startTime);
MCHECKSTATUS(status, "adding ia_startTime attribute")
oa_rigidBodies = fnMsgAttr.create("rigidBodies", "rbds", &status);
MCHECKSTATUS(status, "creating oa_rigidBodies attribute")
status = addAttribute(oa_rigidBodies);
MCHECKSTATUS(status, "adding oa_rigidBodies attribute")
ia_gravity = fnNumericAttr.createPoint("gravity", "grvt", &status);
MCHECKSTATUS(status, "creating gravity attribute")
fnNumericAttr.setDefault(0.0, -9.81, 0.0);
fnNumericAttr.setKeyable(true);
status = addAttribute(ia_gravity);
MCHECKSTATUS(status, "adding ia_gravity attribute")
ia_substeps = fnNumericAttr.create("substeps", "sbs", MFnNumericData::kInt, 1, &status);
MCHECKSTATUS(status, "creating substeps attribute")
fnNumericAttr.setKeyable(true);
status = addAttribute(ia_substeps);
MCHECKSTATUS(status, "adding ia_substeps attribute")
ia_enabled = fnNumericAttr.create("enabled", "enbl", MFnNumericData::kBoolean, true, &status);
MCHECKSTATUS(status, "creating enabled attribute")
status = addAttribute(ia_enabled);
MCHECKSTATUS(status, "adding ia_enabled attribute")
ia_splitImpulse = fnNumericAttr.create("splitImpulse", "spli", MFnNumericData::kBoolean, false, &status);
MCHECKSTATUS(status, "creating splitImpulse attribute")
status = addAttribute(ia_splitImpulse);
MCHECKSTATUS(status, "adding ia_splitImpulse attribute")
status = attributeAffects(ia_time, oa_rigidBodies);
MCHECKSTATUS(status, "adding attributeAffects(ia_time, oa_rigidBodies)")
status = attributeAffects(ia_enabled, oa_rigidBodies);
MCHECKSTATUS(status, "adding attributeAffects(ia_enabled, oa_rigidBodies)")
return MS::kSuccess;
}
示例11: initialize
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")
//.........这里部分代码省略.........
示例12: initialize
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)")
//.........这里部分代码省略.........
示例13: initialize
MStatus boidsBrain::initialize()
{
MStatus status;
MFnNumericAttribute nAttr;
MFnTypedAttribute tAttr;
MFnEnumAttribute eAttr;
MFnMessageAttribute mAttr;
// MFnUnitAttribute uAttr;
// MString attrOpt;
printf("initializing Boidz Locator node\n");
MGlobal:: displayInfo("initializing Boidz Locator node");
nodeCreateAttrNum(simulationLength, sl, kInt, BDZ_SIMLEN );
nodeCreateAttrNum(framesPerSecond, fps, kInt, BDZ_FPS );
nodeCreateAttrNum(startFrame, stf, kInt, BDZ_STF );
particleSystem = mAttr.create("particleSystem", "ps");
nodeAddAttribute(particleSystem);
nodeCreateAttrNum(boidsNumber, bn, kInt, BDZ_NUM );
nodeCreateAttrTyp(logFilePath, lp);
nodeCreateAttrTyp(logFileName, ln);
// inputSurface = tAttr.create( "inputSurface", "is",MFnData::kNurbsSurface,&stat );
// nodeCreateAttrTyped(logFileName, ln, BDZ_LOGNAME);
logFileType = eAttr.create("logFileType", "lt", BDZ_LOGTYPE);
eAttr.addField("nCache file", 0);
eAttr.addField("log file", 1);
eAttr.addField("XML file", 2);
// eAttr.setStorable(true);
// nodeCreateAttrNum(logFileType, lt, kDouble, BDZ_LOGTYPE);
nodeAddAttribute(logFileType);
nodeCreateRuleAttributes(alignment, a)
nodeCreateRuleAttributes(cohesion, c)
nodeCreateRuleAttributes(separation, s)
nodeCreateRuleAttributes(follow, f)
/*
nodeCreateAttrNum(distance, d, kDouble, BDZ_DIST)
nodeCreateAttrNum(repulsionFactor, rf, kDouble, BDZ_REPULSION)
nodeCreateAttrNum(cohesionFactor, cf, kDouble, BDZ_COHESION)
nodeCreateAttrNum(separationFactor, sf, kDouble, BDZ_SEPARATION)
nodeCreateAttrNum(approachFactor, af, kDouble, BDZ_APPROACH)
*/
locomotionMode = eAttr.create("locomotionMode", "lm", BDZ_LOCMODE);
eAttr.addField("physical", 0);
eAttr.addField("simple", 1);
nodeAddAttribute(locomotionMode);
// nodeCreateAttrNum(locomotionMode, lm, kInt, BDZ_LOCMODE)
nodeCreateAttrNum(maxSpeed, ms, kDouble, BDZ_MAXSPEED)
nodeCreateAttrNum(maxForce, mf, kDouble, BDZ_MAXACCEL)
// nodeCreateAttrNum(mass, mss, kDouble, BDZ_MASS)
// check for error
if( status != MS::kSuccess ) {
status.perror("Unable to attach one or more attributes to the boidsBrain node");
return status;
}
MGlobal:: displayInfo("boidsBrain node attributes applied");
return MS::kSuccess;
}
示例14: initialize
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);
//.........这里部分代码省略.........
示例15: initialize
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);
//.........这里部分代码省略.........