PDA

View Full Version : Enter into buttonFieldGrp???


nottoshabi
10-21-2010, 10:49 PM
I'm trying to enter an object into a buttonFieldGrp. After running the command it says it can not find the name of the buttonFieldGrp after I enter it? Why?


if(`window -exists Formula`) deleteUI Formula; if( `windowPref -exists Formula` ) windowPref -r Formula;
window -w 330 -h 200 -t "The name)"
-titleBar 1 -mnb 1 -mxb 1 -mb 1 -tlb 0 -sizeable 1 Formula;

columnLayout -columnAttach "right" 2 -rowSpacing 5 -columnWidth 300;

textFieldButtonGrp -label "A" -text ""
-buttonLabel "<<<"
-buttonCommand ("enterParentA();")
parentA;

global proc enterParentA() {
//Enter objects into windows
string $parA[] = `ls-sl`;
textField -e -tx $parA[0] parentA ;
}

NaughtyNathan
10-22-2010, 07:57 AM
your proc queries a textField named parentA, but you haven't created a textField called that, you've created a textFieldButtonGrp. The Grp commands are actually a kind of rowLayout, so you have a layout called parentA. The names of it's individual children are hidden and largely irrelevant (to the normal scripter) but they can be queried using:

layout -q -ca nameOfGrp;however, in your case you don't need to go this complex, you simply need to change textField into textFieldButtonGrp in your enterParentA proc.

:nathaN

nottoshabi
10-22-2010, 10:45 PM
Thanks Nathan. I can't believe I missed that.
One last question. I'm trying to rename a new node with the name of a selected node plus a suffix. So lets say I have a sphere named A and I want to create a plus and minus node for it. And name it with the name of the sphere plus a suffix of _minAv.


string $parC = `polySphere -r 1 -sx 20 -sy 20 -ax 0 1 0 -cuv 2 -ch 1`;
string $plusMin = `shadingNode -asUtility plusMinusAverage`;
rename $lpusMin $parC + "_minAv";


And that gives me an error. I know is because of the renaming line. But I can not figure out why. I have tried wrapping it in (). In these many ways and all give errors.


rename $plusMin $parC + ("_MinAv");
rename $plusMin $parC (+) ("_MinAv");
rename $plusMin ($parC) (+) ("_MinAv");
rename $plusMin ($parC + "_MinAv");
string $reNam = `rename $plusMin ($parC + "_MinAv")`;


I figured this one will work.
rename $plusMin $parC + ("_MinAv"); Thats what I saw other people write from all the research I did. Only on mine I got the.
// Error: Illegal operation "+" on data of type string[]. //

goleafsgo
10-23-2010, 12:28 AM
The polySphere command returns a string array, with the first item being the transform name and the second the shape name. So the first thing you need to change is to add the [] at the end of your parC variable to make it an array.

Then you need to use it as an array...and put either a [0] or [1] depending on which name you want to use.

e.g.

string $parC[] = `polySphere -r 1 -sx 20 -sy 20 -ax 0 1 0 -cuv 2 -ch 1`;
string $plusMin = `shadingNode -asUtility plusMinusAverage`;
rename $plusMin ($parC[1] + "_minAv");

nottoshabi
10-23-2010, 03:02 AM
Ok great. Now lets say I want to connect the rotate of that sphere in input3D of the plusAndMin.

Do I do this?


connectAttr -f $parC[0].translate sphere1_minAv.input3D[0]

CGTalk Moderation
10-23-2010, 03:02 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.