Leionaaad
01-10-2009, 07:04 PM
I am trying to make some UI, first time doing that.
As an exercise, I wanted to make myself a small window, which creates utility nodes(I am a rigger, this kind of thing will come handy all the time). The problem arises, if I make a textfieldgroup, and I want to get the name from there. If I want to querry the text from the textfield, it says
"$baseName" is an undeclared variable.
I thought is because of the place I declared the variable. I tried to get the full path, to declare it before anything, asign it just after I put the textFieldGroup, nothing does it.
here is the code.
global proc utilWin(){
if(`window -exists "utilWin"`){
deleteUI -window "utilWin" ;
};
//layout
window -title "utility Creator" "utilWin" ;
columnLayout -width 318 -height 200 "mainLay" ;
frameLayout -collapsable false -width 318 -height 200 -borderVisible true -borderStyle "etchedIn" -marginWidth 6 -marginHeight 8 -label "NodeSetup" "nodeLay" ;
columnLayout "nodeSetup";
// fieldGroup
textFieldGrp -label "baseName" -columnWidth 1 64 -columnWidth 2 236 "nameAndLabel" ;
// utility buttons
rowColumnLayout -numberOfColumns 3 "buttons" ;
button -label "multiplyDivide" "mdBtn" ;
button -label "condition" "condBtn" ;
button -label "unitConversion" "ucBtn" ;
button -label "plusMinusAverage" "pmaBtn" ;
button -label "curveInfo" "ciBtn" ;
button -label "reverse" "revBtn" ;
button -label "distBetween" "distBtn" ;
button -label "setRange" "srBtn" ;
button -label "clamp" "cutBtn" ;
button -label "blendTwoAttr" "b2aBtn" ;
button -label "blendColors" "bcBtn" ;
button -label "vectorProduct" "vpBtn" ;
setParent.. ;
setParent.. ;
setParent.. ;
setParent..;
setParent.. ;
string $baseName = `textFieldGrp -q -text "nameAndLabel"` ;
button -edit -command "createNode multiplyDivide -n ($baseName + '_md_utl')" "mdBtn" ;
showWindow "utilWin" ;
window -edit -widthHeight 334 300 "utilWin" ;
}
Feel free to give advice to any other aspect, beside this problem I can't figure out.
Thank you.
As an exercise, I wanted to make myself a small window, which creates utility nodes(I am a rigger, this kind of thing will come handy all the time). The problem arises, if I make a textfieldgroup, and I want to get the name from there. If I want to querry the text from the textfield, it says
"$baseName" is an undeclared variable.
I thought is because of the place I declared the variable. I tried to get the full path, to declare it before anything, asign it just after I put the textFieldGroup, nothing does it.
here is the code.
global proc utilWin(){
if(`window -exists "utilWin"`){
deleteUI -window "utilWin" ;
};
//layout
window -title "utility Creator" "utilWin" ;
columnLayout -width 318 -height 200 "mainLay" ;
frameLayout -collapsable false -width 318 -height 200 -borderVisible true -borderStyle "etchedIn" -marginWidth 6 -marginHeight 8 -label "NodeSetup" "nodeLay" ;
columnLayout "nodeSetup";
// fieldGroup
textFieldGrp -label "baseName" -columnWidth 1 64 -columnWidth 2 236 "nameAndLabel" ;
// utility buttons
rowColumnLayout -numberOfColumns 3 "buttons" ;
button -label "multiplyDivide" "mdBtn" ;
button -label "condition" "condBtn" ;
button -label "unitConversion" "ucBtn" ;
button -label "plusMinusAverage" "pmaBtn" ;
button -label "curveInfo" "ciBtn" ;
button -label "reverse" "revBtn" ;
button -label "distBetween" "distBtn" ;
button -label "setRange" "srBtn" ;
button -label "clamp" "cutBtn" ;
button -label "blendTwoAttr" "b2aBtn" ;
button -label "blendColors" "bcBtn" ;
button -label "vectorProduct" "vpBtn" ;
setParent.. ;
setParent.. ;
setParent.. ;
setParent..;
setParent.. ;
string $baseName = `textFieldGrp -q -text "nameAndLabel"` ;
button -edit -command "createNode multiplyDivide -n ($baseName + '_md_utl')" "mdBtn" ;
showWindow "utilWin" ;
window -edit -widthHeight 334 300 "utilWin" ;
}
Feel free to give advice to any other aspect, beside this problem I can't figure out.
Thank you.
