Home Technical Talk

MEL: checkBox question

polycounter lvl 14
Offline / Send Message
fade1 polycounter lvl 14
for a costum tool i need to toogle attributes of objects with checkBoxes. If multiple objects are selected i want my checkBoxes to be greyed out, just like in other applications. anybody got a clue how this works in maya/mel?

Replies

  • sama.van
    Options
    Offline / Send Message
    sama.van polycounter lvl 14
    Did you read the following page ?

    http://download.autodesk.com/us/maya/2009help/index.html
    On the bottom you have the technical doc and you can do a research with "checkbox"
    fade1 wrote:
    just like in other applications
    Maya is Maya then what is another application for you ? do you have any example?

    fade1 wrote:
    anybody got a clue how this works in maya/mel?

    Did you start learning melscript first? I just ask because what you are asking look easy...


    Answering to you question, yes you can toggle attribute of lot of objects at the same time with mel script and about check-box this is usually a dark icon inside the empty space.
    But you can also Disable the check-box and it will turn gray.


    What kind of attribute do you want to change on a multi objects selection?
  • fade1
    Options
    Offline / Send Message
    fade1 polycounter lvl 14
    maybe i did not explain it good enough. i made a picture of my tool below:

    checkBox.jpg

    As written in the picture and i want the mark be greyed out if not all the selected objects have the attribute. unfortunately the checkBox has just a disable state to grey the box. but then you can't click the box anymore.
    i hope this explained it better...
  • sama.van
    Options
    Offline / Send Message
    sama.van polycounter lvl 14
    Oh yeah pretty crap I never done something like that before O_o...

    It doesn't resolve the problem... but if it can help you can use a menu item Like this :


    string  = `window -width 100`;
    columnLayout -adjustableColumn true;
    rowLayout -en 1 ;
          popupMenu;
              menuItem -l "Activate" -c "checkBox -e -en 1 checkBoxTest;" ; 
                     checkBox -label "Left"   -en 0 -v 1 -align "left" -cc ("print "a";") checkBoxTest ;
    	
    showWindow ;
    


    If you right click on the RadioButton, you can activate it....
    But yeah checking the documentation there is not really something for that O_o...

    For the Popup menu I had to attach it to the rowlayout...
    Because when you disable the RadioButton everything seems to be OFF under his hierarchy...


    I will search more I can find a zone for click... it could be the solution.
  • sama.van
    Options
    Offline / Send Message
    sama.van polycounter lvl 14
    Oh I found a better way... this hack but... :D

    You can use the dropCallBack thing.

    And it will activate the RadioButton with a simple Middle mouse button :


    Here is an example of the monster :D :

    //======================================//

    string $window = `window -width 100`;
    columnLayout -adjustableColumn true;
    rowLayout -en 1 -dgc ("TEST");
    checkBox -label "Left" -en 0 -v 1 -align "left" -cc ("print \"a\";") checkBoxTest ;

    showWindow $window;


    global proc string[] TEST (string $dragControl, int $x, int $y, int $mods)
    {
    string $aaa[];
    checkBox -e -en 1 checkBoxTest;
    return $aaa;
    }


    //======================================//
  • fade1
    Options
    Offline / Send Message
    fade1 polycounter lvl 14
    the second idea with -dgc is something i can use. i still think it's a little complicated, as i have to set up rowLayouts for each checkBox(and we have quite some of them... ).
    thanks a lot for your support and if you find another straightforward solution just post it. ;)
  • sama.van
    Options
    Offline / Send Message
    sama.van polycounter lvl 14
    You can easily create an array listing your attributes and to create UI with a Loop.

    This is clean, optimized, fast and will create to you some holidays :D
  • fade1
    Options
    Offline / Send Message
    fade1 polycounter lvl 14
    of course i do build the menues with loops and arrays. ;)
    your solution works already in my script, just gotta fix some logic problems and i'm done. one more time thanks for your input. just sad there is no state or command in mel to get this behaviour automatic.
Sign In or Register to comment.