本文整理汇总了C++中MFnTypedAttribute::setDisconnectBehavior方法的典型用法代码示例。如果您正苦于以下问题:C++ MFnTypedAttribute::setDisconnectBehavior方法的具体用法?C++ MFnTypedAttribute::setDisconnectBehavior怎么用?C++ MFnTypedAttribute::setDisconnectBehavior使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MFnTypedAttribute
的用法示例。
在下文中一共展示了MFnTypedAttribute::setDisconnectBehavior方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: initialize
MStatus HesMeshNode::initialize()
{
MFnNumericAttribute numAttr;
MStatus stat;
MFnTypedAttribute stringAttr;
input = stringAttr.create( "hesPath", "hsp", MFnData::kString );
stringAttr.setStorable(true);
addAttribute( input );
ameshname = stringAttr.create( "meshName", "mn", MFnData::kString );
stringAttr.setStorable(true);
stringAttr.setArray(true);
stringAttr.setDisconnectBehavior(MFnAttribute::kDelete);
addAttribute( ameshname );
MFnTypedAttribute meshAttr;
outMesh = meshAttr.create( "outMesh", "o", MFnData::kMesh );
meshAttr.setStorable(false);
meshAttr.setWritable(false);
meshAttr.setArray(true);
meshAttr.setDisconnectBehavior(MFnAttribute::kDelete);
addAttribute( outMesh );
attributeAffects( input, outMesh );
return MS::kSuccess;
}
示例2: addAttribute
MStatus
OpenSubdivPtexShader::initialize()
{
MFnTypedAttribute typedAttr;
MFnNumericAttribute numAttr;
MFnEnumAttribute enumAttr;
// level
aLevel = numAttr.create("level", "lv", MFnNumericData::kLong, 3);
numAttr.setInternal(true);
numAttr.setMin(1);
numAttr.setSoftMax(5);
numAttr.setMax(10);
// tessFactor
aTessFactor = numAttr.create("tessFactor", "tessf", MFnNumericData::kLong, 2);
numAttr.setInternal(true);
numAttr.setMin(1);
numAttr.setMax(10);
// scheme
aScheme = enumAttr.create("scheme", "sc", OsdPtexMeshData::kCatmark);
enumAttr.addField("Catmull-Clark", OsdPtexMeshData::kCatmark);
enumAttr.addField("Loop", OsdPtexMeshData::kLoop);
enumAttr.addField("Bilinear", OsdPtexMeshData::kBilinear);
enumAttr.setInternal(true);
// kernel
aKernel = enumAttr.create("kernel", "kn", OsdPtexMeshData::kCPU);
enumAttr.addField("CPU", OsdPtexMeshData::kCPU);
#ifdef OPENSUBDIV_HAS_OPENMP
enumAttr.addField("OpenMP", OsdPtexMeshData::kOPENMP);
#endif
#ifdef OPENSUBDIV_HAS_OPENCL
enumAttr.addField("CL", OsdPtexMeshData::kCL);
#endif
#ifdef OPENSUBDIV_HAS_CUDA
enumAttr.addField("CUDA", OsdPtexMeshData::kCUDA);
#endif
enumAttr.setInternal(true);
// interpolateBoundary
aInterpolateBoundary = enumAttr.create("interpolateBoundary", "ib",
OsdPtexMeshData::kInterpolateBoundaryNone);
enumAttr.addField("None", OsdPtexMeshData::kInterpolateBoundaryNone);
enumAttr.addField("Edge Only", OsdPtexMeshData::kInterpolateBoundaryEdgeOnly);
enumAttr.addField("Edge and Corner", OsdPtexMeshData::kInterpolateBoundaryEdgeAndCorner);
enumAttr.addField("Always Sharp", OsdPtexMeshData::kInterpolateBoundaryAlwaysSharp);
enumAttr.setInternal(true);
// adaptive
aAdaptive = numAttr.create("adaptive", "adp", MFnNumericData::kBoolean, true);
numAttr.setInternal(true);
// wireframe
aWireframe = numAttr.create("wireframe", "wf", MFnNumericData::kBoolean, false);
// material attributes
aDiffuse = numAttr.createColor("diffuse", "d");
numAttr.setDefault(0.6f, 0.6f, 0.7f);
aAmbient = numAttr.createColor("ambient", "a");
numAttr.setDefault(0.1f, 0.1f, 0.1f);
aSpecular = numAttr.createColor("specular", "s");
numAttr.setDefault(0.3f, 0.3f, 0.3f);
// Ptex Texture Attributes
//
// diffuseEnvironmentMapFile;
aDiffuseEnvironmentMapFile = typedAttr.create("diffuseEnvironmentMap", "difenv", MFnData::kString);
typedAttr.setInternal(true);
// don't let maya hold on to string when fileNode is disconnected
typedAttr.setDisconnectBehavior(MFnAttribute::kReset);
// specularEnvironmentMapFile;
aSpecularEnvironmentMapFile = typedAttr.create("specularEnvironmentMap", "specenv", MFnData::kString);
typedAttr.setInternal(true);
// don't let maya hold on to string when fileNode is disconnected
typedAttr.setDisconnectBehavior(MFnAttribute::kReset);
// colorFile;
aColorFile = typedAttr.create("colorFile", "cf", MFnData::kString);
typedAttr.setInternal(true);
// displacementFile;
aDisplacementFile = typedAttr.create("displacementFile", "df", MFnData::kString);
typedAttr.setInternal(true);
// occlusionFile;
aOcclusionFile = typedAttr.create("occlusionFile", "of", MFnData::kString);
typedAttr.setInternal(true);
// enableDisplacement;
aEnableDisplacement = numAttr.create("enableDisplacement", "end", MFnNumericData::kBoolean, 1);
numAttr.setInternal(true);
// enableColor;
aEnableColor = numAttr.create("enableColor", "enc", MFnNumericData::kBoolean, 1);
numAttr.setInternal(true);
// enableOcclusion;
//.........这里部分代码省略.........
示例3: initialize
MStatus geometrySurfaceConstraint::initialize()
{
MFnNumericAttribute nAttr;
MStatus status;
// constraint attributes
{ // Geometry: mesh, readable, not writable, delete on disconnect
MFnTypedAttribute typedAttrNotWritable;
geometrySurfaceConstraint::constraintGeometry =
typedAttrNotWritable.create( "constraintGeometry", "cg", MFnData::kMesh, &status );
if (!status) { status.perror("typedAttrNotWritable.create:cgeom"); return status;}
status = typedAttrNotWritable.setReadable(true);
if (!status) { status.perror("typedAttrNotWritable.setReadable:cgeom"); return status;}
status = typedAttrNotWritable.setWritable(false);
if (!status) { status.perror("typedAttrNotWritable.setWritable:cgeom"); return status;}
status = typedAttrNotWritable.setDisconnectBehavior(MFnAttribute::kDelete);
if (!status) { status.perror("typedAttrNotWritable.setDisconnectBehavior:cgeom"); return status;}
}
// Parent inverse matrix: delete on disconnect
MFnTypedAttribute typedAttr;
geometrySurfaceConstraint::constraintParentInverseMatrix =
typedAttr.create( "constraintPim", "ci", MFnData::kMatrix, &status );
if (!status) { status.perror("typedAttr.create:matrix"); return status;}
status = typedAttr.setDisconnectBehavior(MFnAttribute::kDelete);
if (!status) { status.perror("typedAttr.setDisconnectBehavior:cgeom"); return status;}
// Target geometry: mesh, delete on disconnect
geometrySurfaceConstraint::targetGeometry =
typedAttr.create( "targetGeometry", "tg", MFnData::kMesh, &status );
if (!status) { status.perror("typedAttr.create:tgeom"); return status;}
status = typedAttr.setDisconnectBehavior(MFnAttribute::kDelete);
if (!status) { status.perror("typedAttr.setDisconnectBehavior:cgeom"); return status;}
targetTransform = typedAttr.create( "targetTransform", "ttm", MFnData::kMatrix, &status );
if (!status) { status.perror("typedAttr.create:targetTransform"); return status;}
status = typedAttr.setDisconnectBehavior(MFnAttribute::kDelete);
if (!status) { status.perror("typedAttr.setDisconnectBehavior:targetTransform"); return status;}
// Target weight: double, min 0, default 1.0, keyable, delete on disconnect
MFnNumericAttribute typedAttrKeyable;
geometrySurfaceConstraint::targetWeight
= typedAttrKeyable.create( "weight", "wt", MFnNumericData::kDouble, 1.0, &status );
if (!status) { status.perror("typedAttrKeyable.create:weight"); return status;}
status = typedAttrKeyable.setMin( (double) 0 );
if (!status) { status.perror("typedAttrKeyable.setMin"); return status;}
status = typedAttrKeyable.setKeyable( true );
if (!status) { status.perror("typedAttrKeyable.setKeyable"); return status;}
status = typedAttrKeyable.setDisconnectBehavior(MFnAttribute::kDelete);
if (!status) { status.perror("typedAttrKeyable.setDisconnectBehavior:cgeom"); return status;}
{ // Compound target(geometry,weight): array, delete on disconnect
MFnCompoundAttribute compoundAttr;
geometrySurfaceConstraint::compoundTarget =
compoundAttr.create( "target", "tgt",&status );
if (!status) { status.perror("compoundAttr.create"); return status;}
status = compoundAttr.addChild( geometrySurfaceConstraint::targetTransform );
if (!status) { status.perror("compoundAttr.addChild targetTransform"); return status;}
status = compoundAttr.addChild( geometrySurfaceConstraint::targetGeometry );
if (!status) { status.perror("compoundAttr.addChild"); return status;}
status = compoundAttr.addChild( geometrySurfaceConstraint::targetWeight );
if (!status) { status.perror("compoundAttr.addChild"); return status;}
status = compoundAttr.setArray( true );
if (!status) { status.perror("compoundAttr.setArray"); return status;}
status = compoundAttr.setDisconnectBehavior(MFnAttribute::kDelete);
if (!status) { status.perror("typedAttrKeyable.setDisconnectBehavior:cgeom"); return status;}
}
MFnNumericAttribute numAttr;
constraintTranslateX = numAttr.create( "constraintTranslateX", "ctx", MFnNumericData::kDouble, 0.0, &status );
if(!status) {
MGlobal::displayInfo("failed to create attrib constraintTranslateX");
return status;
}
numAttr.setReadable(true);
numAttr.setWritable(false);
addAttribute(constraintTranslateX);
constraintTranslateY = numAttr.create( "constraintTranslateY", "cty", MFnNumericData::kDouble, 0.0, &status );
if(!status) {
MGlobal::displayInfo("failed to create attrib constraintTranslateY");
return status;
}
numAttr.setReadable(true);
numAttr.setWritable(false);
addAttribute(constraintTranslateY);
constraintTranslateZ = numAttr.create( "constraintTranslateZ", "ctz", MFnNumericData::kDouble, 0.0, &status );
if(!status) {
MGlobal::displayInfo("failed to create attrib constraintTranslateY");
return status;
}
numAttr.setReadable(true);
numAttr.setWritable(false);
addAttribute(constraintTranslateZ);
constraintTargetX = numAttr.create( "constraintTargetX", "ttx", MFnNumericData::kDouble, 0.0, &status );
if(!status) {
MGlobal::displayInfo("failed to create attrib constraintTargetX");
return status;
//.........这里部分代码省略.........
示例4: addAttribute
MStatus
OpenSubdivShader::initialize()
{
MFnTypedAttribute typedAttr;
MFnNumericAttribute numAttr;
MFnEnumAttribute enumAttr;
// Subdivision level
aLevel = numAttr.create("level", "lv", MFnNumericData::kLong, 3);
numAttr.setInternal(true);
numAttr.setMin(1);
numAttr.setSoftMax(5);
numAttr.setMax(10);
addAttribute(aLevel);
// GPU tesselation factor
aTessFactor = numAttr.create("tessFactor", "tessf", MFnNumericData::kLong, 2);
numAttr.setInternal(true);
numAttr.setMin(1);
numAttr.setMax(10);
addAttribute(aTessFactor);
// Subdivision scheme
aScheme = enumAttr.create("scheme", "sc", OsdMeshData::kCatmark);
enumAttr.setInternal(true);
enumAttr.addField("Catmull-Clark", OsdMeshData::kCatmark);
enumAttr.addField("Loop", OsdMeshData::kLoop);
enumAttr.addField("Bilinear", OsdMeshData::kBilinear);
addAttribute(aScheme);
// Computation kernel
aKernel = enumAttr.create("kernel", "kn", OsdMeshData::kCPU);
enumAttr.setInternal(true);
enumAttr.addField("CPU", OsdMeshData::kCPU);
#ifdef OPENSUBDIV_HAS_OPENMP
enumAttr.addField("OpenMP", OsdMeshData::kOPENMP);
#endif
#ifdef OPENSUBDIV_HAS_OPENCL
enumAttr.addField("CL", OsdMeshData::kCL);
#endif
#ifdef OPENSUBDIV_HAS_CUDA
enumAttr.addField("CUDA", OsdMeshData::kCUDA);
#endif
addAttribute(aKernel);
// Boundary interpolation flag
aInterpolateBoundary = enumAttr.create("interpolateBoundary", "ib",
OsdMeshData::kInterpolateBoundaryNone);
enumAttr.addField("None", OsdMeshData::kInterpolateBoundaryNone);
enumAttr.addField("Edge Only", OsdMeshData::kInterpolateBoundaryEdgeOnly);
enumAttr.addField("Edge and Corner", OsdMeshData::kInterpolateBoundaryEdgeAndCorner);
enumAttr.addField("Always Sharp", OsdMeshData::kInterpolateBoundaryAlwaysSharp);
enumAttr.setInternal(true);
addAttribute(aInterpolateBoundary);
// Feature-adaptive toggle
aAdaptive = numAttr.create("adaptive", "adp", MFnNumericData::kBoolean, true);
numAttr.setInternal(true);
addAttribute(aAdaptive);
// Wireframe display toggle
aWireframe = numAttr.create("wireframe", "wf", MFnNumericData::kBoolean, false);
addAttribute(aWireframe);
// Material attributes
aDiffuse = numAttr.createColor("diffuse", "d");
numAttr.setDefault(0.6f, 0.6f, 0.7f);
addAttribute(aDiffuse);
aAmbient = numAttr.createColor("ambient", "a");
numAttr.setDefault(0.1f, 0.1f, 0.1f);
addAttribute(aAmbient);
aSpecular = numAttr.createColor("specular", "s");
numAttr.setDefault(0.3f, 0.3f, 0.3f);
addAttribute(aSpecular);
aShininess = numAttr.create("shininess", "shin", MFnNumericData::kFloat, 50.0f);
numAttr.setMin(0);
numAttr.setSoftMax(128.0f);
addAttribute(aShininess);
// Texture attributes
aDiffuseMapFile = typedAttr.create("diffuseMap", "difmap", MFnData::kString);
typedAttr.setInternal(true);
/* don't let maya hold on to string when fileNode is disconnected */
typedAttr.setDisconnectBehavior(MFnAttribute::kReset);
addAttribute(aDiffuseMapFile);
// UV set (defaults to current UV set)
aUVSet = typedAttr.create("uvSet", "uvs", MFnData::kString);
typedAttr.setInternal(true);
addAttribute(aUVSet);
// Boundary interpolation flag for face-varying data (UVs)
aInterpolateUVBoundary = enumAttr.create("interpolateUVBoundary", "iuvb",
OsdMeshData::kInterpolateBoundaryNone);
enumAttr.addField("None", OsdMeshData::kInterpolateBoundaryNone);
enumAttr.addField("Edge Only", OsdMeshData::kInterpolateBoundaryEdgeOnly);
enumAttr.addField("Edge and Corner", OsdMeshData::kInterpolateBoundaryEdgeAndCorner);
//.........这里部分代码省略.........
示例5: initialize
//.........这里部分代码省略.........
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 );
示例6: initialize
MStatus geometrySurfaceConstraint::initialize()
{
MFnNumericAttribute nAttr;
MStatus status;
// constraint attributes
{ // Geometry: mesh, readable, not writable, delete on disconnect
MFnTypedAttribute typedAttrNotWritable;
geometrySurfaceConstraint::constraintGeometry =
typedAttrNotWritable.create( "constraintGeometry", "cg", MFnData::kMesh, &status );
if (!status) { status.perror("typedAttrNotWritable.create:cgeom"); return status;}
status = typedAttrNotWritable.setReadable(true);
if (!status) { status.perror("typedAttrNotWritable.setReadable:cgeom"); return status;}
status = typedAttrNotWritable.setWritable(false);
if (!status) { status.perror("typedAttrNotWritable.setWritable:cgeom"); return status;}
status = typedAttrNotWritable.setDisconnectBehavior(MFnAttribute::kDelete);
if (!status) { status.perror("typedAttrNotWritable.setDisconnectBehavior:cgeom"); return status;}
}
{ // Parent inverse matrix: delete on disconnect
MFnTypedAttribute typedAttr;
geometrySurfaceConstraint::constraintParentInverseMatrix =
typedAttr.create( "constraintPim", "ci", MFnData::kMatrix, &status );
if (!status) { status.perror("typedAttr.create:matrix"); return status;}
status = typedAttr.setDisconnectBehavior(MFnAttribute::kDelete);
if (!status) { status.perror("typedAttr.setDisconnectBehavior:cgeom"); return status;}
// Target geometry: mesh, delete on disconnect
geometrySurfaceConstraint::targetGeometry =
typedAttr.create( "targetGeometry", "tg", MFnData::kMesh, &status );
if (!status) { status.perror("typedAttr.create:tgeom"); return status;}
status = typedAttr.setDisconnectBehavior(MFnAttribute::kDelete);
if (!status) { status.perror("typedAttr.setDisconnectBehavior:cgeom"); return status;}
}
{ // Target weight: double, min 0, default 1.0, keyable, delete on disconnect
MFnNumericAttribute typedAttrKeyable;
geometrySurfaceConstraint::targetWeight
= typedAttrKeyable.create( "weight", "wt", MFnNumericData::kDouble, 1.0, &status );
if (!status) { status.perror("typedAttrKeyable.create:weight"); return status;}
status = typedAttrKeyable.setMin( (double) 0 );
if (!status) { status.perror("typedAttrKeyable.setMin"); return status;}
status = typedAttrKeyable.setKeyable( true );
if (!status) { status.perror("typedAttrKeyable.setKeyable"); return status;}
status = typedAttrKeyable.setDisconnectBehavior(MFnAttribute::kDelete);
if (!status) { status.perror("typedAttrKeyable.setDisconnectBehavior:cgeom"); return status;}
}
{ // Compound target(geometry,weight): array, delete on disconnect
MFnCompoundAttribute compoundAttr;
geometrySurfaceConstraint::compoundTarget =
compoundAttr.create( "target", "tgt",&status );
if (!status) { status.perror("compoundAttr.create"); return status;}
status = compoundAttr.addChild( geometrySurfaceConstraint::targetGeometry );
if (!status) { status.perror("compoundAttr.addChild"); return status;}
status = compoundAttr.addChild( geometrySurfaceConstraint::targetWeight );
if (!status) { status.perror("compoundAttr.addChild"); return status;}
status = compoundAttr.setArray( true );
if (!status) { status.perror("compoundAttr.setArray"); return status;}
status = compoundAttr.setDisconnectBehavior(MFnAttribute::kDelete);
if (!status) { status.perror("typedAttrKeyable.setDisconnectBehavior:cgeom"); return status;}
}
status = addAttribute( geometrySurfaceConstraint::constraintParentInverseMatrix );
if (!status) { status.perror("addAttribute"); return status;}
status = addAttribute( geometrySurfaceConstraint::constraintGeometry );
if (!status) { status.perror("addAttribute"); return status;}
status = addAttribute( geometrySurfaceConstraint::compoundTarget );
if (!status) { status.perror("addAttribute"); return status;}
status = attributeAffects( compoundTarget, constraintGeometry );
if (!status) { status.perror("attributeAffects"); return status;}
status = attributeAffects( targetGeometry, constraintGeometry );
if (!status) { status.perror("attributeAffects"); return status;}
status = attributeAffects( targetWeight, constraintGeometry );
if (!status) { status.perror("attributeAffects"); return status;}
status = attributeAffects( constraintParentInverseMatrix, constraintGeometry );
if (!status) { status.perror("attributeAffects"); return status;}
return MS::kSuccess;
}