A small problemo
Hello all ... I'm new here so I will try and tread carefully and hope not to upset anyone!
I was hoping I might be able to pick your brains. I've been doing some simple rigging and wrote some simple scripts to do the FK IK switching. For this I made 4 shelf buttons to do all the switching. Granted I may not be on the right and best track when it comes to technique ... no doubt I will discover new and more exciting ways to go about this, but that's for another day.
It occurred to me I could replace my 4 buttons with a single button, based on what i may have selected. not wanting to use explicit names I was going to add a hidden attribute to the object in question and then select it by it's attribute name
Code:
select -r `ls -o "*.controlObject"`;
this works fine and will select my object.
the trouble comes when I want to test what it is I have selected use it in a variable and then carry out a command
Code:
string $myControl = `ls -o "*.controlObject"`;
string $mySelect[] = `ls -sl`;
if ($mySelect[0] == $myControl)
{
print "By jove you cracked it";
//replace with proc name later
}
else
{
print "nothing here \nBoo!";
//replace with proc name later
}
but this fails to work ... giving me the following error
// Error: Cannot convert data of type string[] to type string. //
If I were to change this line
Code:
string $myControl = `ls -o "*.controlObject"`;
to use an explicit name it works fine
Code:
string $myControl = "leftShoulderControl";
So what I really want to know is what I'm doing wrong?
I really would appreciate any help you can offer. Apologies if this makes no sense!
Tony.
Last edited by misterjackson; 28-09-2011 at 10:45 PM.
Reason: Changed the formating