永发信息网

maya2008有没有旋转边的工具,也就是spinEdge,怎么找不到?急救!

答案:2  悬赏:40  手机版
解决时间 2021-01-28 04:00
正在做作业,遇到难点,各位高手帮一下。

或者功能相似的工具也可以,谢啦!
最佳答案
以下是这个插件的源码,复制到记事本里再另存为OMT_to_spinEdge.mel(文件类型选择*.*),使用时直接用鼠标拖到MAYA界面中,选则一条边或2个相临的面后,在命令行或脚本编辑器(Window--General Editors--Script Editor)中输入OMT_to_spinEdge,按小键盘上的Enter执行:

///////////////////////////////////////////////////////////////////////////////////
/// SCRIPT START ///
///////////////////////////////////////////////////////////////////////////////////

// ========================
// Errors
// ========================
//
// Because errors can be invoked at more than one place within the code, they are sorted
// out to the top, to make certain all errors of similar type are presented in the same way.

// This error is if the user has selected the wrong number or type of arguments
proc bad_sel_err()
{
error "You must select exactly 2 faces or 1 edge to use spinEdge";
}

// An edge which doesn't have exactly two faces has been selected
proc border_edge_err()
{
error "Selected Edge must have exactly two faces (possible non-manifold or border edge)";
}

// Faces are non-adjacent, or adjacent at more than one edge
proc adj_err()
{
error "Faces must be adjacent with exactly one edge to use spinEdge";
}

// Non-manifold geometry present at the location of spin
proc non_manifold_err()
{
error "There are non-manifold properties to this selection inhibiting spinEdge";
}

// ========================
// Utilities
// ========================
//
// Often called functions that make life just a bit less complex. Some of these might be useful
// general utility functions, or could be enhanced as such

// This expands a list of faces, edges and/or vertices, so that each element has its own entry
// in the list. Ie, it removes the ":" syntax Maya often (annoyingly) uses for its poly functions
proc expandObjList(string $objs[], string $exp_objs[])
{
string $exp_objs[] = `filterExpand -ex true -sm 34 -sm 31 -sm 32 $objs`;
}

// Given a selection, returns the index of the selection. Ie, "obj.vtx[243]" returns
// 243 as a string.
proc string convert2Index(string $Obj)
{
string $Index[];

tokenize($Obj, "[]", $Index);

return $Index[1];
}

// Given an edge and a vertex, determines if that vertex is at the beginning (0% along) or
// the end (100% along) the length of the edge, and returns that value (0 or 1)
//
// Note that it assumes that the vertex is, in fact, on that edge. Behavior if not
// should be considered undefined.
proc float edgeDistance(string $edge, string $vtx)
{
string $vtxID = convert2Index($vtx);

string $EdgeInfo[] = `polyInfo -ev $edge`;

string $eVtxIDs[];

tokenize($EdgeInfo[0], " ", $eVtxIDs);

if ($vtxID == $eVtxIDs[2]) return 0;
else return 1;

}

// Given a selection, returns the type of the selection. Ie, "obj.vtx[243]" returns
// "vtx"
proc string getType (string $whatisthis)
{
string $thisis[];
tokenize($whatisthis, ".[", $thisis);
return $thisis[1];
}

// Finds the first occurance of an item within an array and returns its index.
proc int findFirstIn(string $item, string $array[])

{
int $i = 0;
for ($i = 0; $i < size($array); ++$i)
{
if ($array[$i] == $item)
return $i;
}

return -1;
}

// Returns a (non-filtered) list of the edges shared between a group of faces.
// Removes the border edges shared by only one face. There should be an easier way to do
// this, but I haven't found it. Perhaps using sets?
proc string[] getSharedEdges(string $faces[])
{
// Get the internal edges in preparation for finding shared edges, which includes border edges
// Get the border edges too

string $internalEdges[];

expandObjList(`polyListComponentConversion -te -in $faces`, $internalEdges);

// The internal edges may include edges which are boundaries. These must be ignored

string $sharedEdges[];
int $sharedEdgeCount = 0;

int $i = 0;
for($i = 0; $i < size($internalEdges); ++$i)
{
string $edgeFaces[];

expandObjList(`polyListComponentConversion -tf $internalEdges[$i]`, $edgeFaces);

if(size($edgeFaces) != 1)
{
$sharedEdges[$sharedEdgeCount] = $internalEdges[$i];
++$sharedEdgeCount;
}
}

return $sharedEdges;
}

// ========================
// Check Routines
// ========================
//
// These routines do a basic check of the selection to verify that it's valid

// Checks the faces selected, verifies that there are two of them, that they're both faces
proc checkFaces(string $Selection[])
{
// If we've got faces, we must make sure there are two and that they are adjacent

if (size($Selection) != 2)
{
bad_sel_err();
}

// Verify that the other selction is also a face

$SelectionType = getType($Selection[1]);

if ($SelectionType != "f")
{
bad_sel_err();
}
}

// Checks that there is one edge selected and that it not a border edge or a non-manifold edge
proc checkEdge(string $Selection[])
{
// Verify that there's only 1 edge selected
if (size($Selection) != 1)
{
bad_sel_err();
}

// Check that there's two faces. Otherwise non-manifold geometry
string $Faces[];

expandObjList(`polyListComponentConversion -tf $Selection[0]`, $Faces);

if (size($Faces) == 1)
{
border_edge_err();
}

if (size($Faces) != 2)
{
non_manifold_err();
}
}

// ========================
// Main Procedure
// ========================

global proc OMT_to_spinEdge()
{
// Primary values to be determined, the edge which is being spun and the faces which surround it
// Either might be what's selected.

string $SpinEdge;
string $SpinFaces[2];

// Determine if we have faces or an edge selected, and find the other one

string $Selection[] = `ls -sl -fl`;

string $SelectionType = getType($Selection[0]);

if ($SelectionType == "f")
{
checkFaces($Selection);

// Get the shared edges

string $sharedEdges[] = getSharedEdges($Selection);

// Test to make sure there's only one shared edge.

if(size($sharedEdges) != 1)
{
adj_err();
}

// Verify that the shared edge has exactly two faces connected
string $Faces[];

expandObjList(`polyListComponentConversion -tf $sharedEdges[0]`, $Faces);

if (size($Faces) != 2)
{
non_manifold_err();
}

$SpinEdge = $sharedEdges[0];
$SpinFaces = $Selection;
}
else
{
// Otherwise, we hopefully are looking at an edge.

if($SelectionType == "e")
{
checkEdge($Selection);

$SpinEdge = $Selection[0];

expandObjList(`polyListComponentConversion -tf $Selection[0]`, $SpinFaces);

// Make sure the faces only have the single edge shared
string $sharedEdges[] = getSharedEdges($SpinFaces);

// If there's too many shared edges, we've got a problem.

if(size($sharedEdges) != 1)
{
adj_err();
}
}
else
{
bad_sel_err();
}
}

// We've got our faces and our edge. Get a few other critical data items

string $EdgeVtxs[];

expandObjList(`polyListComponentConversion -tv $SpinEdge`, $EdgeVtxs);

string $FaceVtxs[];

expandObjList(`polyListComponentConversion -tv $SpinFaces`, $FaceVtxs);

string $Object[];

tokenize($SpinEdge, ".", $Object);

// Delete the spin edge. We'll recreate it between two new vertices

polyDelEdge $SpinEdge;

// Get the resulting big face

string $BigFace[] = `polyListComponentConversion -tf -in $FaceVtxs`;

// Get the face vertices in order

string $OrderedFaceVtxs[];

string $FaceInfo[] = `polyInfo -fv $BigFace`;

tokenize($FaceInfo[0], " ", $OrderedFaceVtxs);

/// Get the number of vertices we have. Note that there is some garbage (from polyInfo) in
// the OrderedFaceVtxs.
int $bfVtxCount = size($OrderedFaceVtxs) - 3;

// Find the index of the new edge vertices in the ordered vertices

// Get current vertex indices
int $spinVtx0Index = findFirstIn(convert2Index($EdgeVtxs[0]),$OrderedFaceVtxs);
int $spinVtx1Index = findFirstIn(convert2Index($EdgeVtxs[1]),$OrderedFaceVtxs);

// Get next vertex indices
int $eVtx0Index = ($spinVtx0Index - 1) % $bfVtxCount + 2;
int $eVtx1Index = ($spinVtx1Index - 1) % $bfVtxCount + 2;

// Get the next vertices themselves
string $eVtx0 = $Object[0] + ".vtx[" + $OrderedFaceVtxs[$eVtx0Index] +"]";
string $eVtx1 = $Object[0] + ".vtx[" + $OrderedFaceVtxs[$eVtx1Index] +"]";

// Get the edges upon which we'll rotate

string $EdgeA[] = `polyListComponentConversion -fv -te -in $EdgeVtxs[0] $eVtx0`;
string $EdgeB[] = `polyListComponentConversion -fv -te -in $EdgeVtxs[1] $eVtx1`;

// Determine if our vertices are at the beginning or end of the chosen edges
float $EdgeADist = edgeDistance($EdgeA[0], $eVtx0);
float $EdgeBDist = edgeDistance($EdgeB[0], $eVtx1);

// polySpit takes *indices*, not edges (inconsistent with other poly tools)
int $EdgeAIndex = `convert2Index $EdgeA[0]`;
int $EdgeBIndex = `convert2Index $EdgeB[0]`;

polySplit -ep $EdgeAIndex $EdgeADist -ep $EdgeBIndex $EdgeBDist $Object[0];

// Reselect the items that we 'started' with.
if($SelectionType == "f")
{
select `polyListComponentConversion -tf -in $FaceVtxs`;
}
else
{
select `polyListComponentConversion -te -in $eVtx0 $eVtx1`;
}

}
全部回答
这个错误就是你点插件它没有找到这些命令,一般情况下,你需要在脚本编辑器里source script一下这个mel,然后才能运行这个命令。另外一个原因就是不支持版本,如果你的maya没有升级则这个可以排除。
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
辉腾和桑塔纳哪个好
周氏物流地址好找么,我有些事要过去
逞妙的意思是什么啊?知道的请说下!
东风雪铁龙地址在哪,我要去那里办事
三星,GT- 19500怎么解锁,急…
家里如何腌制咸肉?
江铃汽车地址在什么地方,我要处理点事
智小谋大的意思是什么啊?知道的请说下!
周氏物流(建设路21号附近周氏物流)地址在什么
好朋友搞笑头像六人
鲁尔区传统的工业部门大多属于A. 资金密集型
铁路用的轨距尺怎么用?我不会看水平。
尔雅大学生创业导论 创业机会的来源主要是(
国际文化交流中心将组织一次由各国学生参加的
显卡驱动是什么意思?
推荐资讯
爱人走了我想他快点回来,句子
狗狗吃驱虫药一天能洗澡不
剪吧烫染造型地址有知道的么?有点事想过去
成语什么里一困
筹攒的意思是什么啊?知道的请说下!
如图表示某工业产品产、销、研的关联图,读图
《童年》每一章的好词佳句.主要内容?
西荆的意思是什么啊?知道的请说下!
卫生间洗脸台,池子掉了??
湖南省农村信用社(215乡道中国邮政储蓄银行北
傥阆的意思是什么啊?知道的请说下!
加勒比独占没有家的女孩2
正方形一边上任一点到这个正方形两条对角线的
阴历怎么看 ?