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: 

MultiCut right event?

0 REPLIES 0
Reply
Message 1 of 1
Bravlin
2229 Views, 0 Replies

MultiCut right event?

To store and restore selection after d_raster MultiCut use in Maya 2015 i tried to write a tiny Qt eventFilter.
There are several modes in MultiCut tool. We work with CTRL+LMB mode (this mode creates edgeloops).

To store selected components i create sets for verts,edges and faces.
Then MultiCut perform geometry changes.
And after that we restore selected components from sets.

The problem is that i tried different types of QEvent and still can't handle\catch moment after MultiCut tool change geometry to add "restore from sets" block of code.

 

 

# KEY: <filename>.MultiCut.start()
# it's automatically starts Maya MultiCut context

import maya.cmds as mc
from functools import partial
import maya.mel as mel
import maya.OpenMayaUI as apiui
import PySide.QtCore as qtc                                                                                     
import PySide.QtGui as qtg
 
class XSIMultiCut(qtc.QObject):
    q_app = qtg.QApplication.instance()
    blocked = False
 
    def start( self ):
        mel.eval('dR_multiCutTool')
        self.q_app.installEventFilter( self )
        return True 
     
    def eventFilter( self, obj, event ):
        etype = event.type()
        if mc.currentCtx()=='nexMultiCutCtx1' and etype == qtc.QEvent.MouseButtonRelease and not self.blocked: 
            button = event.button()                                                                             
            mods = event.modifiers()
             
            if button == qtc.Qt.LeftButton and mods == qtc.Qt.ControlModifier:
                self.blocked = True
                print "\n\n\t\t\t\t BEFOR SEND \n"   
                self.q_app.sendEvent( obj, event )
                print "\n\n\t\t\t\t AFTER SEND \n"
                self.blocked = False
                return True
        return False   
         
MultiCut = XSIMultiCut()

ScriptEditor Log: http://clip2net.com/s/38w9zFT

Tags (3)
0 REPLIES 0

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

Post to forums  

Autodesk Design & Make Report