PDA

View Full Version : Adding "textFieldButtonGrp" to "formLayout"


RavenEye
06-07-2007, 03:27 PM
Ok this morning my code was all working without a textFieldButtonGrp but I'm expanding my script to include a textFieldButtonGrp and now I get // Error: Object is not a child: //. Since the only new part of my code was the textFieldButtonGrp, so I'm wondering can you put a textFieldButtonGrp in a form layout or do I have the placement wrong of the textFieldButtonGrp.

global proc aasLightBox()
{
window -title ("aasLightBox - v1.1");
string $form = `formLayout -numberOfDivisions 100`;
string $rLayerName;
string $rLayerCmd = "createRenderLayer -n (`textFieldButtonGrp "+" -q -text $rLayerName`) -number 1 -noRecurse `ls -sl`";
string $butCShadows = `symbolButton -image "S:/Morgue/melScripts/icons/cShadows.bmp" -command "castsShadows"`;
string $butRShadows =`symbolButton -image "S:/Morgue/melScripts/icons/rShadows.bmp" -command "receiveShadows"`;
string $butMBlur = `symbolButton -image "S:/Morgue/melScripts/icons/mBlur.bmp" -command "mBlur"`;
string $butVIReflections = `symbolButton -image "S:/Morgue/melScripts/icons/vIReflections.bmp" -command "visibleInReflections"`;
string $butVIRefractions = `symbolButton -image "S:/Morgue/melScripts/icons/vIRefractions.bmp" -command "visibleInRefractions"`;
string $butPVisibility = `symbolButton -image "S:/Morgue/melScripts/icons/pVisibility.bmp" -command "primaryVisibility"`;
string $butAllOff = `symbolButton -image "S:/Morgue/melScripts/icons/allOff.bmp" -command "allOff"`;
string $butAllOn = `symbolButton -image "S:/Morgue/melScripts/icons/allOn.bmp" -command "allOn"`;

formLayout -edit
// Creates Render Layers
-attachForm $rLayerName "top" 0
-attachForm $rLayerName "left"0

// Cast Shadows Off Button
-attachForm $butCShadows "left" 0
-attachForm $butCShadows "bottom" 0
// Recieve Shadows Off Button
-attachForm $butRShadows "bottom" 0
-attachControl $butRShadows "left" 1 $butCShadows
// Motion Blur Off Button
-attachForm $butMBlur "bottom" 0
-attachControl $butMBlur "left" 1 $butRShadows
// Visible in Reflections Off Button
-attachForm $butVIReflections "bottom" 0
-attachControl $butVIReflections "left" 1 $butMBlur
// Visible in Refractions Off Button
-attachForm $butVIRefractions "bottom" 0
-attachControl $butVIRefractions "left" 1 $butVIReflections
// Primary Visibility Off Button
-attachForm $butPVisibility "bottom" 0
-attachControl $butPVisibility "left" 1 $butVIRefractions
// Turns off all Render Stats Button
-attachForm $butAllOff "bottom" 0
-attachControl $butAllOff "left" 1 $butPVisibility
// Turns on all Render Stats Button
-attachForm $butAllOn "bottom" 0
-attachControl $butAllOn "left" 1 $butAllOff
$form;
$rLayerName = `textFieldButtonGrp -label "Render Layer:" -text "" -buttonLabel "Create" -buttonCommand $rLayerCmd`;

showWindow;

}

RavenEye
06-07-2007, 05:05 PM
Need help with first post or this post.....:(

I tried to do a work around the formLayout and tried doing a frameLayout with the textFieldButtonGrp. I get the window all working and it all looks like the way it should, but I hit a problem. The problem is: // Error: // This what the script editor is giving me. Nothing informing me the problem of the script. So, here is my script: // Creates Render Layers
frameLayout -label "Render Layers" -borderStyle "etchedIn" -font "boldLabelFont" -collapsable 0;
rowLayout;
string $myTextFieldButtonGrp;
string $myButtonCommand = "createRenderLayer -name (`textFieldButtonGrp "+" -q -text $myTextFieldButtonGrp`)";

$myTextFieldButtonGrp = `textFieldButtonGrp
-label "Name"
-text ""
-buttonLabel "Create"
-buttonCommand $myButtonCommand`;
The script is pretty much identical to an example in "Mel Scripting for Animators" page 254.

_stev_
06-07-2007, 05:38 PM
In answer to your first post, it's probably because you're editing your formlayout before you've created the new textFieldButtonGrp. Simply move it above the formlayout -edit, and it should work.

RavenEye
06-07-2007, 06:19 PM
thanks, _stev_. That got it working in the formLayout the way I was intending too, but now it is doing my second question. I'm thinking it has something to do the with the `createRenderLayer` command and how I layed the string out. So, here is the code with the adjustments. Now just need to figure out why the button isn't working.

window -title ("aasLightBox - v1.1");
string $rLayerName;
string $rLayerCmd = "createRenderLayer -n (`textFieldButtonGrp "+" -q -text $rLayerName`) -number 1";
string $form = `formLayout -numberOfDivisions 100`;
string $butCShadows = `symbolButton -image "S:/Morgue/melScripts/icons/cShadows.bmp" -command "castsShadows"`;
string $butRShadows =`symbolButton -image "S:/Morgue/melScripts/icons/rShadows.bmp" -command "receiveShadows"`;
string $butMBlur = `symbolButton -image "S:/Morgue/melScripts/icons/mBlur.bmp" -command "mBlur"`;
string $butVIReflections = `symbolButton -image "S:/Morgue/melScripts/icons/vIReflections.bmp" -command "visibleInReflections"`;
string $butVIRefractions = `symbolButton -image "S:/Morgue/melScripts/icons/vIRefractions.bmp" -command "visibleInRefractions"`;
string $butPVisibility = `symbolButton -image "S:/Morgue/melScripts/icons/pVisibility.bmp" -command "primaryVisibility"`;
string $butAllOff = `symbolButton -image "S:/Morgue/melScripts/icons/allOff.bmp" -command "allOff"`;
string $butAllOn = `symbolButton -image "S:/Morgue/melScripts/icons/allOn.bmp" -command "allOn"`;
$rLayerName = `textFieldButtonGrp -label "Name" -text "" -buttonLabel "Create" -buttonCommand $rLayerCmd`;
formLayout -edit
// Creates Render Layers
-attachForm $rLayerName "top" 0
-attachForm $rLayerName "left"0

_stev_
06-07-2007, 09:03 PM
This is kind of a guess, since I don't have maya here, but I think it is because you are using the variable for your textFieldButtonGrp in the command for itself.

Make the textFieldButtonGrp as you have, but don't assign the button command (leave out the -buttonCommand flag).

Then, after you've made all your UI elements, edit the textFieldButtonGrp, and assign the command, like:

textFieldButtonGrp -e -bc $rLayerCmd $rLayerName;


Again, I'm kindof guessing since I can't test any of this, but give it a try.

Later,
Stev

RavenEye
06-08-2007, 03:46 PM
_stev_, I tried what you suggested and it didn't work. I was able to get it to work when I gave that command its own window, but overall that isn't what I want. It would just give the people I'm writing this for more windows on their desktop cluttering their work area. I've tried the paneLayout command but that didn't work. All it did was pop up the first window in the command but totally ignoring the 2nd part.

// Second UI
global proc renderStats()
{
window -title "Render Stats";
gridLayout -numberOfRowsColumns 1 8 -cellWidthHeight 35 35;
symbolButton -image "S:/Morgue/melScripts/icons/cShadows.bmp" -command "castsShadows";
symbolButton -image "S:/Morgue/melScripts/icons/rShadows.bmp" -command "receiveShadows";
symbolButton -image "S:/Morgue/melScripts/icons/mBlur.bmp" -command "mBlur";
symbolButton -image "S:/Morgue/melScripts/icons/vIReflections.bmp" -command "visibleInReflections";
symbolButton -image "S:/Morgue/melScripts/icons/vIRefractions.bmp" -command "visibleInRefractions";
symbolButton -image "S:/Morgue/melScripts/icons/pVisibility.bmp" -command "primaryVisibility";
symbolButton -image "S:/Morgue/melScripts/icons/allOff.bmp" -command "allOff";
symbolButton -image "S:/Morgue/melScripts/icons/allOn.bmp" -command "allOn";
showWindow;
}

// Third UI
global proc renderLayers()
{
window -title "Render Layers";
frameLayout -label "Render Layers" -borderStyle "etchedIn" -font "boldLabelFont" -collapsable 0;
rowLayout;
string $rLayerName;
string $rLayerCmd = "createRenderLayer -n (`textFieldButtonGrp "+" -q -text $rLayerName`) -number 1";
$rLayerName = `textFieldButtonGrp -label "Name" -text "" -buttonLabel "Create" -buttonCommand $rLayerCmd`;
showWindow;
}


// Main UI
global proc aasLightBox()
{

window -title ("aasLightBox - v1.1");


paneLayout -configuration "horizontal2";
columnLayout;
// Below is the render layers window
renderLayers;
setParent ..;
columnLayout;
// Below is the render stats window
renderStats;

showWindow;

}

CGTalk Moderation
06-08-2007, 03:46 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.