本文整理汇总了C#中Handle.setPositionByMemberIndex方法的典型用法代码示例。如果您正苦于以下问题:C# Handle.setPositionByMemberIndex方法的具体用法?C# Handle.setPositionByMemberIndex怎么用?C# Handle.setPositionByMemberIndex使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Handle
的用法示例。
在下文中一共展示了Handle.setPositionByMemberIndex方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: doIt
//======================================================================
//
// Do the metadata creation. The metadata will be randomly initialized
// based on the channel type and the structure specified. For recognized
// components the number of metadata elements will correspond to the count
// of components in the selected mesh, otherwise a random number of metadata
// elements between 1 and 100 will be created (at consecutive indices).
//
// The previously existing metadata is preserved for later undo.
//
override public void doIt(MArgList args)
{
MArgDatabase argsDb = new MArgDatabase(syntax, args);
checkArgs(ref argsDb);
clearResult();
uint numNodes = fNodes.length;
int i;
for (i = 0; i < numNodes; ++i)
{
// fNodes[i] is the transform not the shape itself
MFnDagNode dagNode = new MFnDagNode(fNodes[i]);
MObject obj = dagNode.child(0);
// obj is the shape, which is where we can add the meta data
MFnDependencyNode node = new MFnDependencyNode(obj);
// Get the current metadata (empty if none yet)
Associations newMetadata = new Associations(node.metadata);
Channel newChannel = newMetadata.channel(fChannelType);
// Check to see if the requested stream name already exists
Stream oldStream = newChannel.dataStream(fStreamName);
if (oldStream != null)
{
string fmt = MStringResource.getString(MetaDataRegisterMStringResources.kCreateMetadataHasStream);
string msg = String.Format(fmt, fStreamName);
MGlobal.displayError( msg );
continue;
}
Stream newStream = new Stream(fStructure, fStreamName);
string strmName = newStream.name;
int indexCount = 0;
MFnMesh mesh = null;
Random rndIndexCount = new Random();
// Treat the channel type initializations different for meshes
if (obj.hasFn(MFn.Type.kMesh))
{
mesh = new MFnMesh(obj);
// Get mesh-specific channel type parameters
if (fChannelType == "face")
{
indexCount = mesh.numPolygons;
}
else if (fChannelType == "edge")
{
indexCount = mesh.numEdges;
}
else if (fChannelType == "vertex")
{
indexCount = mesh.numVertices;
}
else if (fChannelType == "vertexFace")
{
indexCount = mesh.numFaceVertices;
}
else
{
// Set a random number between 1 to 100
indexCount = rndIndexCount.Next(1, 100);
}
}
else
{
// Create generic channel type information
indexCount = rndIndexCount.Next(1, 100);
}
// Fill specified stream ranges with random data
int structureMemberCount = fStructure.memberCount;
uint m,n,d;
Random rnd = new Random();
for (m = 0; m < indexCount; ++m)
{
// Walk each structure member and fill with random data
// tailored to the member data type.
Handle handle = new Handle(fStructure);
for (n = 0; n < structureMemberCount; ++n)
{
handle.setPositionByMemberIndex(n);
switch (handle.dataType)
{
case Member.eDataType.kBoolean:
{
bool[] data = new bool[handle.dataLength];
//.........这里部分代码省略.........