Maya for 3D Printing - Rapid Prototyping
In this course we're going to look at something a little different, creating technically accurate 3D printed parts.
# 1 08-10-2014 , 06:24 PM
Registered User
Join Date: Oct 2014
Posts: 4

Marking menu radiobutton and checkbox issue

In my continuing efforts to customize the Maya UI I've run into a slight issue regarding Maya's custom marking menus in general, and using checkboxes and radiobuttons in particular. The problem is quite simply that when I click a checkbox or a radiobutton, Maya performs the action paired with that button, without ticking or unticking the checkbox or radiobutton. It simply doesn't update visually, which, if you ask me, diminishes the whole point of using such functionality in the first place.

Why is this and what can I do to fix it?

I've provided two examples to better clarify what I mean, thus helping you to help me. In the first one I want to be able to toggle between the Modeling Toolkit's four different different transform options - world, object, local custom. But as this image shows I'm not able to establish a relationship or connection between my marking menu and the Modeling Toolkit display. Any ideas on how I would go about doing that?

user added image

Here's what my code looks like:

Code:
global proc customModelingToolkitMM( string $parentName )
{

  radioMenuItemCollection;
        
    menuItem -label (uiRes("m_customModelingToolkitMM.kLocalLabel")) -radioButton 1 -c "dR_coordSpaceLocal" -radialPosition "NE";
    menuItem -label (uiRes("m_customModelingToolkitMM.kCustomLabel")) -radioButton 1 -c "dR_coordSpaceCustom" -radialPosition "E";
    menuItem -label (uiRes("m_customModelingToolkitMM.kObjectLabel")) -radioButton 1 -c "dR_coordSpaceObject" -radialPosition "NW";
    menuItem -label (uiRes("m_customModelingToolkitMM.kWorldLabel")) -radioButton 1 -c "dR_coordSpaceWorld" -radialPosition "W";

}
In my second example I simply wan't to toggle symmetry, but as the image below shows, with no success so far.

user added image

Here's what that code looks like:

Code:
global proc customModelingToolkitMM( string $parentName )
{

  radioMenuItemCollection;
        
    menuItem -label (uiRes("m_customModelingToolkitMM.kSymmetryLabel")) -checkBox 1 -c "dR_symmetryTGL" -radialPosition "N";

}
What am I doing wrong? Any help is greatly appreciated - Thanks in advance!

// Johan Wendesten

# 2 09-10-2014 , 02:47 AM
Gen's Avatar
Super Moderator
Join Date: Dec 2006
Location: South FL
Posts: 3,522
Hey Johan

Since I prefer marking menus to having even more UI clutter I've also transferred the modeling toolkit as you're doing. the "drInit" mel in your Maya installation>scripts folder reveals the commands and flags you can use to query values(this really should be added to the help files).


In the case of checkboxes in your custom marking menus, my suggestion is to have it query the current value of the tool when the menu is being created.

Example:


Code:
menuItem -label "preview loop/ring" -checkBox `nexOpt -q previewLoopRing`

This way it's always up to date. Similarly for radio buttons, in the below example, the bit in parentheses returns true or false if raycast is the current value of the selection option and this returned true/false will decide if the radio button is selected.

Code:
radioMenuItemCollection;
menuItem -l "paint selection" -radioButton (`nexOpt -q selectOption` == "raycast") -c "dR_selectModeRaycast";


- Genny
__________________
::|| My CG Blog ||::
::|| My Maya FAQ ||::
Posting Rules Forum Rules
You may not post new threads | You may not post replies | You may not post attachments | You may not edit your posts | BB code is On | Smilies are On | [IMG] code is On | HTML code is Off