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


#1

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?