ok... So let's say i have a Rig.
I need to find a specific parent within that rig.
Let's say "L_Arm" has a Parent from "Locator1" with the name "L_Arm_ParentConstraint1"
How do i find and delete that constraint without deleting any other constraints that are within the rig.
I tried to combine names like
$selRig = `ls -sl`; (L_Arm)
select $selRig+"_parentConstraint1"; which i hoped would result in (L_Arm_parentConstraint1)
but apparently you cant use + to add names onto strings.
Maybe this would be easier if the parent had a specific name.
Instead of L_Arm_ParentConstraint1 ... DelThisParentConstraint1.
so...
How do i find and delete that specific parent using MEL?
Can i attach a name to a string and use the select command to achieve this?
Can i create a parent with a specific name?
I know you can create a locator with
spaceLocator -name "NameHere";
Solved! Go to Solution.
ok... So let's say i have a Rig.
I need to find a specific parent within that rig.
Let's say "L_Arm" has a Parent from "Locator1" with the name "L_Arm_ParentConstraint1"
How do i find and delete that constraint without deleting any other constraints that are within the rig.
I tried to combine names like
$selRig = `ls -sl`; (L_Arm)
select $selRig+"_parentConstraint1"; which i hoped would result in (L_Arm_parentConstraint1)
but apparently you cant use + to add names onto strings.
Maybe this would be easier if the parent had a specific name.
Instead of L_Arm_ParentConstraint1 ... DelThisParentConstraint1.
so...
How do i find and delete that specific parent using MEL?
Can i attach a name to a string and use the select command to achieve this?
Can i create a parent with a specific name?
I know you can create a locator with
spaceLocator -name "NameHere";
Solved! Go to Solution.
Solved by mcw0. Go to Solution.
Firstly, you're not actually talking about a parent. You're talking about a parentConstraint. So let's get the terminology correct. Any script that is hardcoding names is not a good idea. You should use node types to find the parentConstraint. Also, the "ls" command returns an array. So that prevents you from appending a string.
string $sel[] = `ls -sl`;
string $newName = ($sel[0]+"_appendString");
To find a parentConstraint, you can use "listConnections".
string $results[] = `listConnections -s 1 -d 0 -type "parentConstraint" "selectedNode"`;
*** Replace "selectedNode" with your node ***
Firstly, you're not actually talking about a parent. You're talking about a parentConstraint. So let's get the terminology correct. Any script that is hardcoding names is not a good idea. You should use node types to find the parentConstraint. Also, the "ls" command returns an array. So that prevents you from appending a string.
string $sel[] = `ls -sl`;
string $newName = ($sel[0]+"_appendString");
To find a parentConstraint, you can use "listConnections".
string $results[] = `listConnections -s 1 -d 0 -type "parentConstraint" "selectedNode"`;
*** Replace "selectedNode" with your node ***
so all i had to do was use an array [x]... i feel dumb.
Well thanks.
now i have a different issue tho. The Controls for the char have a Prefix. The parentConstraint doesn't.
select -r ($selection[0] +"_parentConstraint1");
Gives me an error "no object matches name "somePrefix:L_hand_parentConstraint1""
need something like this.
select -r (stringRemovePrefix (PREFIX_HERE, $selection[0]) +"_parentConstraint1");
any ideas?
so all i had to do was use an array [x]... i feel dumb.
Well thanks.
now i have a different issue tho. The Controls for the char have a Prefix. The parentConstraint doesn't.
select -r ($selection[0] +"_parentConstraint1");
Gives me an error "no object matches name "somePrefix:L_hand_parentConstraint1""
need something like this.
select -r (stringRemovePrefix (PREFIX_HERE, $selection[0]) +"_parentConstraint1");
any ideas?
Yes. As I stated before, hardcoding names in a script is not good practice. You can never be assured of a naming convention. So use my suggestion of listConnections and specifying a type.
Yes. As I stated before, hardcoding names in a script is not good practice. You can never be assured of a naming convention. So use my suggestion of listConnections and specifying a type.
im unfamiliar with that method.
Hardcoded names should not be an issue since it's my own custom project. The names are consistent throughout.
im unfamiliar with that method.
Hardcoded names should not be an issue since it's my own custom project. The names are consistent throughout.
Select a node that has a parentConstraint on it.
string $sel[] = `ls -sl`;
string $parentConstraint[] = `listConnections -s 1 -d 0 -type "parentConstraint" $sel[0]`;
select -r $parentConstraint[0];
Select a node that has a parentConstraint on it.
string $sel[] = `ls -sl`;
string $parentConstraint[] = `listConnections -s 1 -d 0 -type "parentConstraint" $sel[0]`;
select -r $parentConstraint[0];
Can't find what you're looking for? Ask the community or share your knowledge.