本文整理汇总了C++中MDagPathArray::clear方法的典型用法代码示例。如果您正苦于以下问题:C++ MDagPathArray::clear方法的具体用法?C++ MDagPathArray::clear怎么用?C++ MDagPathArray::clear使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MDagPathArray
的用法示例。
在下文中一共展示了MDagPathArray::clear方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: undoIt
MStatus skinClusterWeights::undoIt()
{
MStatus status;
for (unsigned i = 0; i < fDagPathArray.length(); i++) {
MDagPath &dagPath = fDagPathArray[i];
MObject skinCluster = findSkinCluster(dagPath);
if (!isSkinClusterIncluded(skinCluster)) {
continue;
}
MFnSkinCluster skinClusterFn(skinCluster, &status);
if (status != MS::kSuccess) {
continue;
}
MObject &component = fComponentArray[i];
if (dagPath.isValid() &&
fInfluenceIndexArrayPtrArray[i].length() > 0 && fWeightsPtrArray[i].length() > 0) {
skinClusterFn.setWeights(dagPath, component, fInfluenceIndexArrayPtrArray[i], fWeightsPtrArray[i]);
}
}
fDagPathArray.clear();
fComponentArray.clear();
delete [] fInfluenceIndexArrayPtrArray;
delete [] fWeightsPtrArray;
fInfluenceIndexArrayPtrArray = NULL;
fWeightsPtrArray = NULL;
return MS::kSuccess;
}
示例2: writeInstances
//
// If a DAG node is instanced (i.e. has multiple parents), this method
// will put it under its remaining parents. It will already have been put
// under its first parent when it was created.
//
void maTranslator::writeInstances(fstream& f)
{
unsigned int numInstancedNodes = fInstanceChildren.length();
unsigned int i;
for (i = 0; i < numInstancedNodes; i++)
{
MFnDagNode nodeFn(fInstanceChildren[i]);
unsigned int numParents = nodeFn.parentCount();
unsigned int p;
for (p = 0; p < numParents; p++)
{
//
// We don't want to issue a 'parent' command for the node's
// existing parent.
//
if (nodeFn.parent(i) != fInstanceParents[i].node())
{
MObject parent = nodeFn.parent(i);
MFnDagNode parentFn(parent);
if (!parentFn.isFromReferencedFile())
{
//
// Get the first path to the parent node.
//
MDagPath parentPath;
MDagPath::getAPathTo(parentFn.object(), parentPath);
writeParent(f, parentPath, fInstanceChildren[i], true);
}
}
}
}
//
// We don't need this any more, so free up the space.
//
fInstanceChildren.clear();
fInstanceParents.clear();
}
示例3: tAttr
MStatus Molecule3Cmd::doIt( const MArgList &args )
{
MStatus stat;
// Initialize options to default values
MFnTypedAttribute tAttr(
/*
radius.setValue( 0.1 );
segs = 6;
ballRodRatio = 2.0;
*/
selMeshes.clear();
// Get the options from the command line
MArgDatabase argData( syntax(), args, &stat );
if( !stat )
return stat;
if( argData.isFlagSet( radiusFlag ) )
argData.getFlagArgument( radiusFlag, 0, radius );
if( argData.isFlagSet( segsFlag ) )
argData.getFlagArgument( segsFlag, 0, segs );
if( argData.isFlagSet( ballRatioFlag ) )
argData.getFlagArgument( ballRatioFlag, 0, ballRodRatio );
// Get a list of currently selected objects
MSelectionList selection;
MGlobal::getActiveSelectionList( selection );
// Iterate over the meshes
MDagPath dagPath;
MItSelectionList iter( selection, MFn::kMesh );
for ( ; !iter.isDone(); iter.next() )
{
iter.getDagPath( dagPath );
selMeshes.append( dagPath );
}
if( selMeshes.length() == 0 )
{
MGlobal::displayWarning( "Select one or more meshes" );
return MS::kFailure;
}
return redoIt();
}
示例4: getRootObjects
// --------------------------------------
void ReferenceManager::getRootObjects(
const MObject& referenceNode,
MDagPathArray& rootPaths,
MObjectArray& subReferences)
{
rootPaths.clear();
subReferences.clear();
MFnDependencyNode referenceNodeFn(referenceNode);
// Get the paths of all the dag nodes included in this reference
MStringArray nodeNames;
MString command = MString("reference -rfn \"") + referenceNodeFn.name() + "\" -q -node -dp;";
MGlobal::executeCommand(command, nodeNames);
uint nodeNameCount = nodeNames.length();
MDagPathArray nodePaths;
for (uint j = 0; j < nodeNameCount; ++j)
{
MObject o = DagHelper::getNode(nodeNames[j]);
MDagPath p = DagHelper::getShortestDagPath(o);
if (p.length() > 0)
{
nodePaths.append(p);
}
else
{
if (o != MObject::kNullObj && o.apiType() == MFn::kReference
&& strstr(nodeNames[j].asChar(), "_UNKNOWN_REF_NODE") == NULL)
{
subReferences.append(o);
}
}
}
// Keep only the root transform for the reference in our path arrays
uint nodePathCount = nodePaths.length();
for (uint j = 0; j < nodePathCount; ++j)
{
const MDagPath& p = nodePaths[j];
if ( !isRootTransform ( nodePaths, p ) ) continue;
rootPaths.append(p);
}
}
示例5: doIt
MStatus listLightLinks::doIt( const MArgList& args )
//
// Description:
// Implements the MEL listLightLinks command. After parsing the
// information stored in Maya's light linker nodes, it examines
// the first item on the selection list. If the item is an object,
// then the command selects all lights that are linked to that object.
// If the item is a light, then it will select all of the objects
// that are linked to that light.
//
// Arguments:
// args - The argument list that was passes to the command from MEL.
// This command takes no arguments.
//
// Return Value:
// MS::kSuccess - command succeeded
// MS::kFailure - command failed (returning this value will cause the
// MEL script that is being run to terminate unless the
// error is caught using a "catch" statement.
//
{
MStatus stat = MS::kSuccess;
clearResult();
// Parse the links on the current scene's light linker node(s).
//
MLightLinks lightLink;
bool parseStatus;
parseStatus = lightLink.parseLinks(MObject::kNullObj);
if( !parseStatus )
{
setResult( "Error parsing light links\n" );
return MS::kFailure;
}
// Get the first object (or component) on the selection list.
//
MSelectionList selectList;
MDagPath dagPath;
MObject component;
MGlobal::getActiveSelectionList( selectList );
selectList.getDagPath( 0, dagPath, component );
dagPath.extendToShape();
// Selection list to store entities linked to the selected light or
// object.
//
MSelectionList newSelection;
newSelection.clear();
// Stores the command result.
//
char resultString[512];
// If the object is a surface, we'll select all the lights linked to it.
// If the object is a light, we'll select all the objects linked to it.
//
if( dagPath.hasFn( MFn::kLight ) )
{
// Select objects linked to this light.
//
MSelectionList objects;
objects.clear();
lightLink.getLinkedObjects( dagPath, objects );
newSelection.merge( objects );
sprintf( resultString, "Selecting objects linked to light %s",
dagPath.fullPathName().asChar() );
}
else
{
// Select lights linked to this object.
//
MDagPathArray lights;
lights.clear();
lightLink.getLinkedLights( dagPath, component, lights );
for( unsigned int j = 0; j < lights.length(); j++ )
{
const MDagPath& path = lights[j];
newSelection.add( path );
}
sprintf( resultString, "Selecting lights linked to object %s",
dagPath.fullPathName().asChar() );
}
// Select the linked entities.
//
MGlobal::setActiveSelectionList( newSelection );
setResult( resultString );
return stat;
}
示例6: writeDagNodes
void maTranslator::writeDagNodes(fstream& f)
{
fParentingRequired.clear();
MItDag dagIter;
dagIter.traverseUnderWorld(true);
MDagPath worldPath;
dagIter.getPath(worldPath);
//
// We step over the world node before starting the loop, because it
// doesn't get written out.
//
for (dagIter.next(); !dagIter.isDone(); dagIter.next())
{
MDagPath path;
dagIter.getPath(path);
//
// If the node has already been written, then all of its descendants
// must have been written, or at least checked, as well, so prune
// this branch of the tree from the iteration.
//
MFnDagNode dagNodeFn(path);
if (dagNodeFn.isFlagSet(fCreateFlag))
{
dagIter.prune();
continue;
}
//
// If this is a default node, it will be written out later, so skip
// it.
//
if (dagNodeFn.isDefaultNode()) continue;
//
// If this node is not writable, and is not a shared node, then mark
// it as having been written, and skip it.
//
if (!dagNodeFn.canBeWritten() && !dagNodeFn.isShared())
{
dagNodeFn.setFlag(fCreateFlag, true);
continue;
}
unsigned int numParents = dagNodeFn.parentCount();
if (dagNodeFn.isFromReferencedFile())
{
//
// We don't issue 'creatNode' commands for nodes from referenced
// files, but if the node has any parents which are not from
// referenced files, other than the world, then make a note that
// we'll need to issue extra 'parent' commands for it later on.
//
unsigned int i;
for (i = 0; i < numParents; i++)
{
MObject altParent = dagNodeFn.parent(i);
MFnDagNode altParentFn(altParent);
if (!altParentFn.isFromReferencedFile()
&& (altParentFn.object() != worldPath.node()))
{
fParentingRequired.append(path);
break;
}
}
}
else
{
//
// Find the node's parent.
//
MDagPath parentPath = worldPath;
if (path.length() > 1)
{
//
// Get the parent's path.
//
parentPath = path;
parentPath.pop();
//
// If the parent is in the underworld, then find the closest
// ancestor which is not.
//
if (parentPath.pathCount() > 1)
{
//
// The first segment of the path contains whatever
// portion of the path exists in the world. So the closest
// worldly ancestor is simply the one at the end of that
//.........这里部分代码省略.........