Community
Maya Programming
Welcome to Autodesk’s Maya Forums. Share your knowledge, ask questions, and explore popular Maya SDK topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Python Select Mode Script

2 REPLIES 2
Reply
Message 1 of 3
ProjectJuizoi
1066 Views, 2 Replies

Python Select Mode Script

Hello Everyone,

I'm making a script in python which should wait for the users command, and this command is switching to any component selection from object selection, so essentially, if the script is running, I'd like it to print "great" if I ever switch to Face, Edge or Vertex Selection. Is there any possible way of doing this?

2 REPLIES 2
Message 2 of 3
rkovach
in reply to: ProjectJuizoi

Maya provides some callbacks that let you run code when certain actions occur. one of the more common one is where the selection changes.

 

however, i am not aware of a callback that fires when the component type changes...

 

to get started, look at the "scriptJob" command.

Message 3 of 3
rflannery
in reply to: ProjectJuizoi

You might have to use some combination of the events "SelectTypeChanged", "SelectModeChanged", and "SelectPreferenceChanged".  I get different results depending on whether I switch modes using the right-click context menu vs. using the tool buttons at the top of the screen:

  • Right-clicking: Switching to one of the component modes (edge, vertex, face, etc.) fires the event "SelectTypeChanged".  Switching back to object mode fires the event "SelectPreferenceChanged".
  • Tool buttons: Clicking the icon for "Select by Object Type" or "Select by Component Type" fores the "SelectModeChanged" event.  Toggling one of the type buttons, like "point components" or "line components" fires the event "SelectTypeChanged".

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report