PDA

View Full Version : wildcard in MEL variable not working


cgbeige
08-13-2012, 04:21 PM
I'm trying to have my objects with a particular namespaces added to a variable but using a * doesn't work, so I'm forced to use a select:

for ($n=1 ; $n<$maxFrameCountOBJ ; $n++)
{
currentTime 1;
string $tmpy;
select -r ("frame_" + $n + ":\*");
string $mySelection[] = `ls -sl`;
$tmpy = $mySelection[0];
setAttr ($tmpy + ".visibility") 0;
setKeyframe ($tmpy + ".v");
currentTime $n;
setAttr ($tmpy + ".visibility") 1;
setKeyframe ($tmpy + ".v");
currentTime ($n + 1);
setAttr ($tmpy + ".visibility") 0;
setKeyframe ($tmpy + ".v");
currentTime 1;
}
}

is there some reason that this doesn't expand the * wildcard? I tried it without the escape \:
$tmpy = ("frame_" + $n + ":\*");

mje11even
08-13-2012, 05:06 PM
Variable assignment doesn't do wildcard expansion, only select. If you don't want to use select, though, you can use namespaceInfo to get the nodes that are in the namespace:

namespace -set "frame_1"
string $nodes[] = `namespaceInfo -lod`;

NaughtyNathan
08-13-2012, 05:17 PM
works for me (assuming I understand what you're trying to do)
string $mySelection[] = `ls ("frame_" + $n + ":*")`$mySelection now contains everything under the namespace "frame_#" (# whatever $n is)

cgbeige
08-13-2012, 05:51 PM
thanks - I'll try that last one out.

ShawnFrueh
08-13-2012, 06:11 PM
is there some reason that this doesn't expand the * wildcard? I tried it without the escape \:
$tmpy = ("frame_" + $n + ":\*");

if your trying to has \ as a character you have to do \\ where the first backslash tells the second to show up

try printing out your () to test what is actually saying:

print ("frame_" + $n + ":\*")
\\output frame_#:*

print ("frame_" + $n + ":\\*")
\\output frame_#:\*

CGTalk Moderation
08-13-2012, 06:11 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.