PDA

View Full Version : Quotation Marks!


hyliandanny
03-08-2007, 09:12 AM
I did a search in the forum for quotation marks, but nothing answered this dilemma...

I have a script which has forced me to use these lines:


float $temp[] = `keyframe -in $i -q -vc ("pCube1.translateX")`;
print $temp[0];
fprint $myNew ($temp[0] + " ");

Now, that's fine and dandy, I suppose, but I want to print out translateX along with translateY, Z, rotateX, Y, Z, scale, etc. If I want to do that, then the code becomes:

float $temp[] = `keyframe -in $i -q -vc ("pCube1.translateX")`;
print $temp[0];
fprint $myNew ($temp[0] + " ");
float $temp2[] = `keyframe -in $i -q -vc ("pCube1.translateY")`;
fprint $myNew ($temp2[0] + " ");
// make $temp3, $temp4, ...

which just feels ridiculous (though I suppose I could make it work). Additionally, I want to write to a single line at a time, which I cannot do if I have to keep making new variables and printing them out one by one (this was using a single variable, so a multi-variable solution, I suppose, wouldn't suffer this problem).

I would think you could just replace the variables within the fprint with `keyframe -in $i -q -vc ("pCube1.whatever")`, but this sets off the quotation marks that designate a string to be the output.

Is there a way around that? Is there some much more efficient way I don't know of?

Robken
03-08-2007, 10:50 AM
`keyframe -in $i -q -vc (\"pCube1.translateX\")`

try that

hibigibees
03-10-2007, 02:32 PM
Hi,
I usually have this tool around...


window myTmpWindow;
columnLayout -adj 1;
textFieldButtonGrp -tx "enter string" -bc "{string $tmp=`textFieldButtonGrp -q -tx myTmpText`;string $etmp=encodeString($tmp);textFieldButtonGrp -e -tx $etmp myTmpText;}" myTmpText;
showWindow myTmpWindow;

so whenever u wanna get stuff encoded.. copy paste and finish it... its faster cause trying to sit and do it for a 1000 char line is time consuming...

sriram

Impus
03-10-2007, 11:16 PM
I don't think anyone really got the question you were asking. But you should probably do it through a loop like this:



string $channelsList[] = {"translateX", "translateY", "translateZ",
"rotateX", "rotateY", "rotateZ",
"scaleX", "scaleY", "scaleZ"};


for($eachChannel in $channelsList)
{
float $temp[] = `keyframe -in $i -q -vc ("pCube1."+$eachChannel)`;
print ($temp[0] + " ");
fprint $myNew ($temp[0] + " ");
}




or if you wanted to get really smart you could just query the translate and rotate parent attributes and iterate through the results:



string $channelsList[] = {"translate", "rotate", "scale"};


for($eachChannel in $channelsList)
{
float $temp[] = `keyframe -in $i -q -vc ("pCube1."+$eachChannel)`;
for($eachSubchannel in $temp)
{
print ($eachSubchannel+ " ");
fprint $myNew ($eachSubchannel+ " ");
}

}

CGTalk Moderation
03-10-2007, 11:16 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.