On 04/13/12 12:29, wattana wrote:
> [posted to rush.general]
>
> Hi Greg!
>
> Yeah, adding only the layer name will be a perfect solution but with my
> poor perl knowledge I cannot figure how to do it...
>
> I mean... I found the "$in{MayaFlags}" var, but it will add "-rl
> something" to the path and I don't like to mess up with spaces and weird
> characters in any path.
>
> Do you know a way to retrieve the layer name only?
Sure, a little regular expression (regex) to handle that.
Assuming you're specifying render layers with something like:
-rl red_layer,green_layer
..and perhaps Maya Flags: ends up having other flags mixed in, eg:
-bla -bla -rl red_layer,green_layer -bla -bla
..then to focus in on the "red_layer,green_layer" you could use:
my $layernames = $in{MayaFlags};
$layernames =~ s/(^-rl |.* -rl )(\S+).*/$2/;
..and then:
$in{LogDirectory} = "$in{ScenePath}-${layernames}.log";
If you're using spaces in the layer names, that makes it
a bit trickier; you'd have to isolate the quotes and stuff,
which would add a bit of extra logic.
If you need to go there, give me some pathological examples
and I can give you a regex to handle it.
BTW, to figure out the above, I just made a little perl script
and messed around with it until it worked, eg:
--- snip
$s = "-foo -bar -rl aaa,bbb -bla";
$s =~ s/(^-rl |.* -rl )(\S+).*/$2/;
print "S='$s'\n";
--- snip
--
Greg Ercolano, erco@(email surpressed)
Seriss Corporation
Rush Render Queue, http://seriss.com/rush/
Tel: (Tel# suppressed)ext.23
Fax: (Tel# suppressed)
Cel: (Tel# suppressed)
|