Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/file/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
File 向场景中的参照添加多个代理_File_Reference_Proxy_Maya_Mel - Fatal编程技术网

File 向场景中的参照添加多个代理

File 向场景中的参照添加多个代理,file,reference,proxy,maya,mel,File,Reference,Proxy,Maya,Mel,我只是想知道如何将多个代理添加到Maya场景中的引用文件中 情景: 我们选择包含“_v001”的对象: 我们创建函数为每个引用文件添加代理: global proc proxyAddition() { string $selectionList[] = `ls -sl`; if(size($selectionList)) { string $object = $selectionList[0]; string $currentRN = `re

我只是想知道如何将多个代理添加到Maya场景中的引用文件中

情景: 我们选择包含“_v001”的对象:

我们创建函数为每个引用文件添加代理:

global proc proxyAddition() {

    string $selectionList[] = `ls -sl`;

    if(size($selectionList)) {

        string $object = $selectionList[0];
        string $currentRN = `referenceQuery -rfn $object`;
        string $currentFilePath = `referenceQuery -filename $object`;
        string $currentNamespace = `referenceQuery -namespace $object`;

        if(endsWith($currentRN, "v001RN") == 1) {

            string $newRN = `substitute "v001RN" $currentRN "v002"`;
            string $newFilePath = `substitute "v001" $currentFilePath "v002"`;
            string $newNamespace = `substitute "v001" $currentNamespace "v002"`;
            proxyAdd $currentRN $newFilePath "HD";
            print "Opération effectuée avec succès.";
        }
    } else {
        warning "Aucun objet de type v001 dans la scène.";
    }
}
proxyAddition;
我想要的是在每个引用的文件中找到字符串“v001”,并将其更改为“v002”(用于代理名称、名称空间和文件路径)


谢谢。

我终于成功地完成了:

select -r "*_v001:*";

global proc proxyAddition() {

    string $selectionList[] = `ls -sl -type "mesh"`;

    if(size($selectionList)) {

        for($object in $selectionList) {

            string $currentRN = `referenceQuery -rfn $object`;
            string $currentFilePath = `referenceQuery -filename $object`;
            string $currentNamespace = `referenceQuery -namespace $object`;

            if(endsWith($currentRN, "v001RN") == 1) {

                string $newRN = `substitute "v001RN" $currentRN "v002"`;
                string $newFilePath = `substitute "v001" $currentFilePath "v002"`;
                string $newNamespace = `substitute "v001" $currentNamespace "v002"`;
                proxyAdd $currentRN $newFilePath "HD";
                print "Opération effectuée avec succès.";               
            }
        }
    } else {
        warning "Aucun objet de type v001 dans la scène.";
    }
}
proxyAddition;
脚本选择名称中包含“_v001”的对象,然后对其进行过滤以仅保留网格对象。 之后,我们使用referenceQuery方法存储当前的引用变量。然后,我们将包含“v001”字符串值的变量替换为新变量中的“v002”。此替换方法用于当前引用对象的文件路径、命名空间和引用节点。有了这些新变量,我们可以使用“proxyAdd”添加新的代理

只有在同一文件夹中有引用文件时,此过程才能工作。 如果情况并非如此,请使用替代方法将filepath变量与更多选项结合使用。 您还可以通过自己的值更改“v001”和“v002”,这些值可以区分您的引用文件版本


“HD”参数用于参考文件的proxyTag。

如果上次编辑是解决方案,请将其删除并添加到下面的答案部分。如果可能的话,解释一下,这对社区是有帮助的。稍后接受(适当的)答案。谢谢您的评论!;)
select -r "*_v001:*";

global proc proxyAddition() {

    string $selectionList[] = `ls -sl -type "mesh"`;

    if(size($selectionList)) {

        for($object in $selectionList) {

            string $currentRN = `referenceQuery -rfn $object`;
            string $currentFilePath = `referenceQuery -filename $object`;
            string $currentNamespace = `referenceQuery -namespace $object`;

            if(endsWith($currentRN, "v001RN") == 1) {

                string $newRN = `substitute "v001RN" $currentRN "v002"`;
                string $newFilePath = `substitute "v001" $currentFilePath "v002"`;
                string $newNamespace = `substitute "v001" $currentNamespace "v002"`;
                proxyAdd $currentRN $newFilePath "HD";
                print "Opération effectuée avec succès.";               
            }
        }
    } else {
        warning "Aucun objet de type v001 dans la scène.";
    }
}
proxyAddition;