
用maya mel如何实现如下功能:得到鼠标选择的顶点的坐标? 谢谢! 20
4个回答
展开全部
用 ls -sl 获取所选取点的名称放入一个sting数组中。然后用Xform -q获取坐标。手机无力。就这么思路。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
string $selectObj[] = `filterExpand -ex true -sm 31`;
int $numSelectObj = size($selectObj);
int $i = 0;
for($ele in $selectObj)
{
print("v" + $i + " ");
$pos = `pointPosition -w $ele`; //get world position
string $posStr;
for($co in $pos)
{
$posStr += " " + $co;
}
print($posStr);
print("\n");
$i++;
}
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
global proc sampleContextPress()
{
float $pressPosition[] = `draggerContext -query -anchorPoint sampleContext`;
print ("Press: " + $pressPosition[0] + " " + $pressPosition[1] + " "
+ $pressPosition[2] + "\n");
}
// Procedure called on drag
global proc sampleContextDrag()
{
float $dragPosition[] = `draggerContext -query -dragPoint sampleContext`;
int $button = `draggerContext -query -button sampleContext`;
string $modifier = `draggerContext -query -modifier sampleContext`;
print ("Drag: " + $dragPosition[0] + " " + $dragPosition[1] + " "
+ $dragPosition[2]
+ " Button is " + $button + " Modifier is " + $modifier + "\n");
string $message = ($dragPosition[0] + ", " + $dragPosition[1]);
draggerContext -edit -drawString $message sampleContext;
}
// Create the dragger context
draggerContext
-pressCommand "sampleContextPress"
-dragCommand "sampleContextDrag"
-cursor "hand"
sampleContext;
// Set current tool to use the sample context created.
// Results can be seen by dragging mouse in main window
setToolTo sampleContext;
{
float $pressPosition[] = `draggerContext -query -anchorPoint sampleContext`;
print ("Press: " + $pressPosition[0] + " " + $pressPosition[1] + " "
+ $pressPosition[2] + "\n");
}
// Procedure called on drag
global proc sampleContextDrag()
{
float $dragPosition[] = `draggerContext -query -dragPoint sampleContext`;
int $button = `draggerContext -query -button sampleContext`;
string $modifier = `draggerContext -query -modifier sampleContext`;
print ("Drag: " + $dragPosition[0] + " " + $dragPosition[1] + " "
+ $dragPosition[2]
+ " Button is " + $button + " Modifier is " + $modifier + "\n");
string $message = ($dragPosition[0] + ", " + $dragPosition[1]);
draggerContext -edit -drawString $message sampleContext;
}
// Create the dragger context
draggerContext
-pressCommand "sampleContextPress"
-dragCommand "sampleContextDrag"
-cursor "hand"
sampleContext;
// Set current tool to use the sample context created.
// Results can be seen by dragging mouse in main window
setToolTo sampleContext;
追问
你写得相当好,你能不能实现得到被选择的点的绝对坐标?
谢谢!
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
是不是用鼠标右键选择快捷方式
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询