1

I trying to make a script using Mel that uses setObjectPickMask so tried doing this code

if (ObjectPickMask "Surface" == true)
{
setObjectPickMask "Surface" false;
updateObjectSelectionMasks;
updateComponentSelectionMasks;
dR_selTypeChanged("");
    
}

else if (ObjectPickMask "Surface" == false)
{
setObjectPickMask "Surface" true;
updateObjectSelectionMasks;
updateComponentSelectionMasks;
dR_selTypeChanged("");

}

It didnt work well i never wrote a Mel before. so basically i am trying to do is make a script that makes Mesh Selectable and non Selectable just like the button in the status line but in script form.

Please share your thoughts how can i achieve this and is this possible doing in python?

BlazeZ__
  • 11
  • 2

1 Answers1

0

The following might do what you are after.

The if statement will test the condition when you enable or disable the surface button from the pick menu. enter image description here Here, if will query it and return a true or false.

I see that you have echoed the other statements, so I just put them back in.

Also, with MEL, you always need to use backticks when capturing the return value of a command in a variable or when testing a command's output in a conditional.

Notice the backticks in the test of the if statement.

if (`selectType -query -nurbsSurface` == true)
    {
        setObjectPickMask "Surface" false;
        updateObjectSelectionMasks;
        updateComponentSelectionMasks;
        dR_selTypeChanged("");
    }
else
    {        
        setObjectPickMask "Surface" true;
        updateObjectSelectionMasks;
        updateComponentSelectionMasks;
        dR_selTypeChanged("");    
    }
Vinman75
  • 25
  • 1
  • 7