PDA

View Full Version : // Error: No object matches name: ($linG + //


brucem91
12-01-2011, 05:20 AM
Hello everyone,

I am trying to create a script that for every node selected, it will create a gamma correct node, set the gamma to a preset value. For some reason though I am stuck, and it won't work.

string $sel[] = `ls -sl`;
for($object in $sel)
{
string $linG = "shadingNode gammaCorrect";
setAttr "($linG + ".gammaX")" 0.454;
setAttr "($linG + ".gammaY")" 0.454;
setAttr "($linG + ".gammaZ")" 0.454;
connectAttr -force ($object + ".outColour") ($linG + ".value");
}

Thanks,

Bruce Murray

WesHowe
12-01-2011, 06:26 AM
I know little about your exact task (gamma correction), but the following line (and those like it):

setAttr "($linG + ".gammaX")" 0.454;

should read:
setAttr ($linG + ".gammaX") 0.454;
You cannot nest quotes that way in MEL. Instead of nesting, your line contains "($linG + " and ")" with .gammaX (unquoted) in-between. The first error the parser encountered was "($linG + ", but it would never have digested the rest.

<* Wes *>

brucem91
12-01-2011, 06:44 AM
Yep, its meant to do a .454 gamma correct to each of my file nodes for linear workflow. So I fixed it, and the only problem I have now is how I am creating the node. It's storing the entire creation line as the name of the node and not the node name itself. I can probably get around this by specifically naming the node on creation, and then renaming it at the end. But anyway, at least the other error is now gone, so thanks.

NaughtyNathan
12-01-2011, 10:30 AM
string $linG = "shadingNode gammaCorrect";you are declaring $linG to be the explicit string: "shadingNode gammaCorrect" whereas I'm pretty sure you want to execute the command: shadingNode gammaCorrect and capture it's result (i.e. the name of the created node) into the variable: $linG

you use the backtick ` symbol for this (underneath ESC on a standard US/UK PC keyboard), not the double-quote "
string $linG = `shadingNode gammaCorrect -n "myGammaNode"`;:nathaN

CGTalk Moderation
12-01-2011, 10:30 AM
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.