Skip to content

picker2


=== Author: Assaf Ben Zur ===

mnsPicker UI Class

This is the UI defenition for the dynamic picker UI build.

The picker is essentially defined by the user using scene guides and attributes,

this class handles the dynamic drawing of the picker into an actual live UI.

  • The global width and height attributes of the window is read from the "Picker Layout Base"

  • The picker buttons positions are read and interperted from the rig's 'Picker Layout Guides'

  • The buttons display settings and actions are drawen from each PLG attributes, which can be editted using the PLG Setting tool.



Classes


MnsPicker2 [Class]

Picker UI Class.


Constructor: MnsPicker2(parent(str) ; [default: mnsUIUtils.get_maya_window()])
Inherits from: form_class, base_class
Class Members:
    • puppetPickersDict
    • currentTabWidget
    • bodyQGV
    • faceQGV
    • pickerWidth
    • pickerHeight
    • rigTops
    • rigTop
    • puppetRoot
    • pickerBase
    • namespace
    • tnPath
    • visRelationMapByRigTopKey
    • mayaSelectCallBack
    • newSceneCallback
    • sceneOpenedCallback
Methods:

MnsPicker2 methods


attemptToGetImages [MnsPicker2 class method]

Constructor: attemptToGetImages(self, originPath, bodyBgImage, faceBgImage, tn, **kwargs)
Return: None
Arguments:
  • self
  • originPath
  • bodyBgImage
  • faceBgImage
  • tn
  • **kwargs
Optional Arguments:

connectSignals [MnsPicker2 class method]


Connect all UI Signals.

Constructor: connectSignals(self)
Return: None
Arguments:
  • self
Optional Arguments:

createVisMap [MnsPicker2 class method]

Constructor: createVisMap(self)
Return: None
Arguments:
  • self
Optional Arguments:

createVisRelationMapForRigTop [MnsPicker2 class method]

Constructor: createVisRelationMapForRigTop(self)
Return: None
Arguments:
  • self
Optional Arguments:

deleteCallBacks [MnsPicker2 class method]

Constructor: deleteCallBacks(self)
Return: None
Arguments:
  • self
Optional Arguments:

destroyAction [MnsPicker2 class method]

Constructor: destroyAction(self, dummy = None)
Return: None
Arguments:
  • self
  • dummy(str) ; [default: None]
Optional Arguments:

displayHowToUseGuide [MnsPicker2 class method]

Constructor: displayHowToUseGuide(self)
Return: None
Arguments:
  • self
Optional Arguments:

drawPlgButton [MnsPicker2 class method]


This is the main dynamic button draw method.

Flow:

- Acquire PLG

- calculate local space position

- gather all relevant settings

- draw the button based on the gathered settings and position, and connect it's click signal.

Constructor: drawPlgButton(self, plg, bodyQGV, faceQGV)
Return: None
Arguments:
  • self
  • plg
  • bodyQGV
  • faceQGV
Optional Arguments:

eventFilter [MnsPicker2 class method]


Override event filter to catch the close trigger to delete the callback

Constructor: eventFilter(self, source, event)
Return: None
Arguments:
  • self
  • source
  • event
Optional Arguments:

getControllersInView [MnsPicker2 class method]

Constructor: getControllersInView(self)
Return: None
Arguments:
  • self
Optional Arguments:

getPlgPositionandSize [MnsPicker2 class method]


Maps a PLG scene position to the UI's local layout position.

Since the positions of the PLG within the scene doesn't match the settings of QT,

this method maps the passed in plg position, in relation to the main 'Picker Layout Base',

and returns the new relative position to the UI layout.

This method also retunes the bounding box size of the given plg.

Constructor: getPlgPositionandSize(self, plg)
Return: list, list (plgPosition(x,y), plgSize (width, height))
Arguments:
  • self
  • plg
Optional Arguments:

gridToggleTrigger [MnsPicker2 class method]

Constructor: gridToggleTrigger(self)
Return: None
Arguments:
  • self
Optional Arguments:

initializePuppetPicker [MnsPicker2 class method]


Main method for the global UI draw.

The UI is initialy destroyed, then re-drawen.

Constructor: initializePuppetPicker(self)
Return: None
Arguments:
  • self
Optional Arguments:

initializeUI [MnsPicker2 class method]

Constructor: initializeUI(self)
Return: None
Arguments:
  • self
Optional Arguments:

loadWindow [MnsPicker2 class method]


Show window method.

Constructor: loadWindow(self)
Return: None
Arguments:
  • self
Optional Arguments:

newInstance [MnsPicker2 class method]

Constructor: newInstance(self)
Return: None
Arguments:
  • self
Optional Arguments:

recSetInstanceName [MnsPicker2 class method]

Constructor: recSetInstanceName(self, idx = 0)
Return: None
Arguments:
  • self
  • idx(int) ; [default: 0]
Optional Arguments:

refreshBtnState [MnsPicker2 class method]

Constructor: refreshBtnState(self, dummy = None)
Return: None
Arguments:
  • self
  • dummy(str) ; [default: None]
Optional Arguments:

refreshButtonVisibility [MnsPicker2 class method]

Constructor: refreshButtonVisibility(self)
Return: None
Arguments:
  • self
Optional Arguments:

setBGImages [MnsPicker2 class method]


Sets the bg image for the UI, in case there is one within the rig-top's attributes.

The bg cannot be set to multiple layouts, hence, a 'tab changed' trigger is connected to this method,

in order to toggle between the body and facial background images.

Constructor: setBGImages(self, bodyQGV = None, faceQGV = None)
Return: None
Arguments:
  • self
  • bodyQGV(str) ; [default: None]
  • faceQGV(str) ; [default: None]
Optional Arguments:

setBtnVisStateBasedOnPupetRoot [MnsPicker2 class method]

Constructor: setBtnVisStateBasedOnPupetRoot(self)
Return: None
Arguments:
  • self
Optional Arguments:

setBtnVisStateBasedOnPupetRootAttr [MnsPicker2 class method]

Constructor: setBtnVisStateBasedOnPupetRootAttr(self, visAttr)
Return: None
Arguments:
  • self
  • visAttr
Optional Arguments:

setLocalVarsBasedOnCurrentRigTop [MnsPicker2 class method]

Constructor: setLocalVarsBasedOnCurrentRigTop(self)
Return: None
Arguments:
  • self
Optional Arguments:

setRigTop [MnsPicker2 class method]

Constructor: setRigTop(self)
Return: None
Arguments:
  • self
Optional Arguments:

setThumbnail [MnsPicker2 class method]

Constructor: setThumbnail(self)
Return: None
Arguments:
  • self
Optional Arguments:

setWindowSize [MnsPicker2 class method]

Constructor: setWindowSize(self)
Return: None
Arguments:
  • self
Optional Arguments:

validateVisCtrl [MnsPicker2 class method]

Constructor: validateVisCtrl(self, node)
Return: None
Arguments:
  • self
  • node
Optional Arguments:


MnsPickerGraphicViewWidget [Class]

Constructor: MnsPickerGraphicViewWidget(parent(str) ; [default: mnsUIUtils.get_maya_window()])
Inherits from: QtWidgets.QGraphicsView
Class Members:
    • bgImage
    • graphicsPixmapItem
    • pickerWindowObj
    • sceneWidth
    • sceneHeight
    • mousePosition
    • isPanActive
    • isZoomActive
    • isRubberBandActive
    • topLeftPosition
    • zoomDelta
    • rubberBandGeometry
    • currentContentRect
    • tabWidget
    • tnPath
Methods:

MnsPickerGraphicViewWidget methods


connectSignals [MnsPickerGraphicViewWidget class method]


Connect all UI Signals.

Constructor: connectSignals(self)
Return: None
Arguments:
  • self
Optional Arguments:

determaineSelection [MnsPickerGraphicViewWidget class method]

Constructor: determaineSelection(self)
Return: None
Arguments:
  • self
Optional Arguments:

drawConstantFG [MnsPickerGraphicViewWidget class method]

Constructor: drawConstantFG(self, painter, rect, **kwargs)
Return: None
Arguments:
  • self
  • painter
  • rect
  • **kwargs
Optional Arguments:

drawForeground [MnsPickerGraphicViewWidget class method]

Constructor: drawForeground(self, painter, rect)
Return: None
Arguments:
  • self
  • painter
  • rect
Optional Arguments:

fitContent [MnsPickerGraphicViewWidget class method]

Constructor: fitContent(self, fromSel = False)
Return: None
Arguments:
  • self
  • fromSel(bool) ; [default: False]
Optional Arguments:

getContentBoundingRect [MnsPickerGraphicViewWidget class method]

Constructor: getContentBoundingRect(self, fromSel = False)
Return: None
Arguments:
  • self
  • fromSel(bool) ; [default: False]
Optional Arguments:

getControllersInView [MnsPickerGraphicViewWidget class method]

Constructor: getControllersInView(self)
Return: None
Arguments:
  • self
Optional Arguments:

getSceneCenterPosition [MnsPickerGraphicViewWidget class method]

Constructor: getSceneCenterPosition(self)
Return: None
Arguments:
  • self
Optional Arguments:

getSelectedItems [MnsPickerGraphicViewWidget class method]

Constructor: getSelectedItems(self)
Return: None
Arguments:
  • self
Optional Arguments:

initializeGraphicsView [MnsPickerGraphicViewWidget class method]

Constructor: initializeGraphicsView(self)
Return: None
Arguments:
  • self
Optional Arguments:

keyPressEvent [MnsPickerGraphicViewWidget class method]

Constructor: keyPressEvent(self, event)
Return: None
Arguments:
  • self
  • event
Optional Arguments:

mouseMoveEvent [MnsPickerGraphicViewWidget class method]

Constructor: mouseMoveEvent(self, event)
Return: None
Arguments:
  • self
  • event
Optional Arguments:

mousePressEvent [MnsPickerGraphicViewWidget class method]

Constructor: mousePressEvent(self, event)
Return: None
Arguments:
  • self
  • event
Optional Arguments:

mouseReleaseEvent [MnsPickerGraphicViewWidget class method]

Constructor: mouseReleaseEvent(self, event)
Return: None
Arguments:
  • self
  • event
Optional Arguments:

resizeEvent [MnsPickerGraphicViewWidget class method]

Constructor: resizeEvent(self, event)
Return: None
Arguments:
  • self
  • event
Optional Arguments:

setBGImage [MnsPickerGraphicViewWidget class method]

Constructor: setBGImage(self)
Return: None
Arguments:
  • self
Optional Arguments:

setCurrentStateRect [MnsPickerGraphicViewWidget class method]

Constructor: setCurrentStateRect(self)
Return: None
Arguments:
  • self
Optional Arguments:

wheelEvent [MnsPickerGraphicViewWidget class method]

Constructor: wheelEvent(self, event)
Return: None
Arguments:
  • self
  • event
Optional Arguments:


MnsPickerGraphicsScene [Class]

Constructor: MnsPickerGraphicsScene(parent(str) ; [default: mnsUIUtils.get_maya_window()],**kwargs)
Inherits from: QtWidgets.QGraphicsScene
Class Members:
    • sceneWidth
    • sceneHeight


picker2QPushButton [Class]

A simple QPushButton re-implementation.

This reimplementation is used to control the button's mouse events, used in 'Edit' mode.


Constructor: picker2QPushButton(parent(str) ; [default: None],plgNode(str) ; [default: None],**kwargs)
Inherits from: QtWidgets.QPushButton
Class Members:
    • pickerWin
    • plgNode
    • connectedControls
    • directConnectedCtrl
    • isFacial
    • last
    • plgColor
    • textColor
    • text
    • isBold
    • isItalic
    • isUnderline
    • fontSize
    • positionH
    • positionV
    • scaleH
    • scaleV
Methods:

picker2QPushButton methods


btnDoubleClickedTrigger [picker2QPushButton class method]


The global action trigger for any picker UI button double click trigger.

This method will trigger the "hierarchy selection" and the "action script" for the passed in QPushButton passed in.

Constructor: btnDoubleClickedTrigger(self, clickMode = "select")
Return: None
Arguments:
  • self
  • clickMode(str) ; [default: "select"]
Optional Arguments:

connectSignals [picker2QPushButton class method]

Constructor: connectSignals(self)
Return: None
Arguments:
  • self
Optional Arguments:

filterConnectedControls [picker2QPushButton class method]

Constructor: filterConnectedControls(self)
Return: None
Arguments:
  • self
Optional Arguments:

mouseDoubleClickEvent [picker2QPushButton class method]

Constructor: mouseDoubleClickEvent(self, QMouseEvent)
Return: None
Arguments:
  • self
  • QMouseEvent
Optional Arguments:

pickerButtonClickAction [picker2QPushButton class method]


The global action trigger for any picker UI button click trigger.

This method will trigger the "controls selection" and the "action script" for the passed in QPushButton passed in.

Constructor: pickerButtonClickAction(self)
Return: None
Arguments:
  • self
Optional Arguments:

rightClickedTrigger [picker2QPushButton class method]

Constructor: rightClickedTrigger(self)
Return: None
Arguments:
  • self
Optional Arguments:

setButtonStyle [picker2QPushButton class method]

Constructor: setButtonStyle(self)
Return: None
Arguments:
  • self
Optional Arguments:

setButtonVis [picker2QPushButton class method]

Constructor: setButtonVis(self)
Return: None
Arguments:
  • self
Optional Arguments:

setPositionAndScale [picker2QPushButton class method]

Constructor: setPositionAndScale(self)
Return: None
Arguments:
  • self
Optional Arguments:

updateButtonVis [picker2QPushButton class method]

Constructor: updateButtonVis(self)
Return: None
Arguments:
  • self
Optional Arguments:


Defenitions


closeAllInstances

Constructor: closeAllInstances(idx = 0)
Return: None
Arguments:
  • idx(int) ; [default: 0]
Keyword Arguments:


loadPicker

Load the Def Serach UI from globals, avoid UI duplication.


Constructor: loadPicker()
Return: None
Arguments:
Keyword Arguments: