【问题标题】:Maya MEL save listAttr into arrayMaya MEL 将 listAttr 保存到数组中
【发布时间】:2017-08-16 09:45:24
【问题描述】:

干杯, 我正在编写一个工具,它应该获取具有特定前缀的所有属性并将它们保存到一个数组中。

当我单独使用 listAttr 时,它给了我这样的信息: // Result: message caching isHistoricallyInteresting nodeState...

我的问题:我想将带有特定前缀的属性列表保存到数组中

梅尔代码:

string $currentSelection[] = `ls -sl`;
string $currentAttributes[];            
$currentShapeNode = `ls -shapes -dag -sl $currentSelection`;
string $currentAttributes[] = `listAttr -ct "ai*"`;
print $currentAttributes;

$currentAttributeslist 保持为空。我无法弄清楚我做错了什么。

【问题讨论】:

    标签: maya mel


    【解决方案1】:

    您可能对类别和字符串感到困惑。如果您仔细查看文档

    ct -> 只显示属于给定类别的属性。类别字符串可以是正则表达式。

    st -> 仅列出与其他条件匹配并匹配从此标志传递的字符串的属性。字符串可以是正则表达式。

    所以在你的情况下,你可能正在寻找 st

    这行得通

    string $currentSelection[] = `ls -sl`;
    string $currentAttributes[];            
    $currentShapeNode = `ls -shapes -dag -sl $currentSelection`;
    string $currentAttributes[] = `listAttr -st "ai*"`;
    print $currentAttributes;
    

    【讨论】:

      猜你喜欢
      • 2017-04-21
      • 1970-01-01
      • 2014-04-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-05-01
      • 1970-01-01
      • 2021-11-25
      相关资源
      最近更新 更多