Mel scripting - master checkbox that toggles children checkbox on and off

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

 
Thread Tools Search this Thread Display Modes
  2 Weeks Ago
Mel scripting - master checkbox that toggles children checkbox on and off

Hi all masters,

I am writing a mel script to toggle on and off objects in the current panel. With me being a noob in mel scripting, i would like to inquiry on a small question.

What I want to achieve-
A master checkbox (None) that toggles all other checkbox to be off/on
While the other checkbox is on/off, its also proc the command of the children checkbox

What I am currently on-
I can make the master checkbox to on and off children checkbox
etc - "None" checkbox is on, all children checkbox is off. "None" checkbox is on, all children checkbox is on.

What problems i am facing-
While the children checkbox is being toggle on and off by the "None" checkbox, its not toggling the procedure of the children's checkbox.
etc -"None" checkbox is on, "NurbsCurves" checkbox is off. "None" checkbox is off, "NurbsCurves" checkbox is on. But on the scene itself, the panel is not updating on the show polygon and off polygon.

Things to take note on-
I am writing on maya 2015(captain obvious)
This is my second script and i am still learning (noobie here)

Here's my code-
checkBox -label "None" -align "center" -v true -changeCommand "checkBox -edit -value (!#1) checkboxNurbsCurves" checkboxNone;
checkBox -label "NurbsCurves" -align "center" -v true -onCommand "OnNurbsCurvesProcedure" -offCommand "offNurbsCurvesProcedure" checkboxNurbsCurves;

proc OnNurbsCurvesProcedure()
{
// find current panel with focus
$result = ` getPanel -wf `;

// Show nurbsCurves in current panel
{
modelEditor -e -nurbsCurves true $result;
}

}

// call the procedure
OnNurbsCurvesProcedure();
// declare a procedure to be called when the checkbox gets unchecked.
proc offNurbsCurvesProcedure()
{
// find current panel with focus
$result = ` getPanel -wf `;

// Hide all objects in current panel
{
modelEditor -e -nurbsCurves false $result;
}

}

// call the procedure
offNurbsCurvesProcedure();

So ultimately, do i need to add a changecommand to my nurbscurve checkbox as well to toggle it on and off?

Last edited by elsonkms1992 : 2 Weeks Ago at 08:12 AM.
 
reply share thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
CGSociety
Society of Digital Artists
www.cgsociety.org

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump
Miscellaneous

All times are GMT. The time now is 10:08 AM.


Powered by vBulletin
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.