2017-03-29 8 views
1

문자열 배열 매개 변수가있는 명령을 MEL에서 evalEcho으로 전달하는 방법은 무엇입니까? 아래 코드는 작동하지 않지만 (단지 예) $list이 작동하도록 선언되어 있어야합니다. 그러나 이는 createList에서 이루어집니다.Maya MEL 스크립트가 evalEcho에 문자열 배열 매개 변수를 전달하는 명령

global proc string[] returnList(string $list[]) { 
    return $list; 
} 

global proc createList() { 
    string $list[]; 

    $list[0] = "Hello"; 
    $list[1] = "World"; 

    evalEcho "returnList $list"; 
} 

createList(); 

터미널 : 다음 코드는 예상대로 작동 어떤 이유

// Error: Line 11.17: "$list" is an undeclared variable. //

:

이 코드는 예상 한 방식으로 작동하도록되어
global proc string[] returnList(string $list[]) { 
    return $list; 
} 

string $list[]; 

$list[0] = "Hello"; 
$list[1] = "World"; 

evalEcho "returnList $list"; 

답변

0

:

global proc string[] returnList(string $list[]) { 
    return $list; 
} 

global proc createList() { 
    string $list[]; 
    $list = stringToStringArray("Hello, World!", " "); 

    evalEcho("\n" + "//" + " " + $list[0] + " " + $list[1] + " "); 
} 

createList(); 

enter image description here

1

거나 너무 안쪽에 넣어 ....

global proc string[] returnList(string $list[]) { 
    return $list; 
} 

global proc createList() { 
    evalEcho "string $list[]"; 

    evalEcho "$list[0] = \"Hello\""; 
    evalEcho "$list[1] = \"World\""; 

    evalEcho "returnList $list"; 
} 

createList();