Problem: Script adding prefix when creating Expression

Problem: Script adding prefix when creating Expression

Anonymous
Not applicable
361 Views
2 Replies
Message 1 of 3

Problem: Script adding prefix when creating Expression

Anonymous
Not applicable
Okay... this is really screwing with my mind... I'm working on a script that will automatically generate an expression to control some objects in my scene. In my script, I can print the variable that I need and get the correct result, but whenever I try to add the variable to an existing string (what will be my expression) by typing $string += ........ it adds a 'tr' prefix to the variable, and I can't see why.

I have:
$TCExpr = (`expression -q -s scriptName`);


If I add in the following line to get:

$TCExpr = (`expression -q -s scriptName`);
$TCExpr += ("\n //float $treadControl = " + $treadControlAttr + ";");


I get this added to the expression:
float $treadControl = tread_ctrl_1.treadControl;

which is correct....

BUT, if I take out the "//" in the above line, like such:
$TCExpr += ("\n float $treadControl = " + $treadControlAttr + ";");


I get this as the result:
float $treadControl = trtread_ctrl_1.treadControl;


So, it adds a "tr" before the name of the object tread_ctrl. I can't figure out for the life of me where its getting that value from. Any help would be appreciated.

*edit...
and now even stranger, if I explicitely state what the control is via:
$TCExpr += ("\n  float $test = tread_ctrl_1.treadControl;");

It still adds the 'tr' prefix.
0 Likes
362 Views
2 Replies
Replies (2)
Message 2 of 3

Anonymous
Not applicable
possible to share your scene?

upon testing this i don't get the tr prefix, so most likely it's coming from something that is in your scene that you are missing.
0 Likes
Message 3 of 3

Anonymous
Not applicable
Hey Lavainia,
I just sent you an email with what I have so far.

I just tested another thing concerning this. I added a print command to the script to pump out what the expression will be prior to creating it. So, in the script editor, it reads correctly when its printed, but the expression that is created is still jacked up. So there's something odd happening in the generation of the actual expression.
0 Likes