Skip to content

Instantly share code, notes, and snippets.

View mikebourbeauart's full-sized avatar
Developing Armada

Mike Bourbeau mikebourbeauart

Developing Armada
View GitHub Profile
@mikebourbeauart
mikebourbeauart / get_geo_from_selection.py
Last active March 27, 2020 20:10
Selects geometry transforms under current selection
"""Selects geometry transforms under a current selection"""
import maya.cmds as mc
# Get all mesh shapes under parent group
sel_shapes = mc.ls(selection=True, dagObjects=1, type='mesh')
# Get parent transforms from shapes (supports duplicate names, remove "path" if you want to raise an error on dup names)
geo_transforms = mc.listRelatives(sel_shapes, parent=True, path=True)
@mikebourbeauart
mikebourbeauart / ex.py
Created February 21, 2018 04:07
Wrapping my head around QFileSystemModel and QTreeView
import sys
from Qt import QtWidgets
from Qt import QtCore
class FoldersWidget(QtWidgets.QWidget):
def __init__(self):
super(FoldersWidget, self).__init__()
@mikebourbeauart
mikebourbeauart / ex.py
Created February 16, 2018 00:54
App won't run...
import os
import sys
from Qt import QtWidgets
from Qt import QtCore
from Qt import QtGui
class FoldersWidget(QtWidgets.QWidget):
from PySide import QtCore, QtGui
from shiboken import wrapInstance
import maya.OpenMayaUI as mui
def maya_main_window():
ptr = mui.MQtUtil.mainWindow()
return wrapInstance( long( ptr ), QtGui.QWidget )
####################################################################
class MyWindow(QtGui.QDialog):
from PySide import QtCore, QtGui
from shiboken import wrapInstance
import maya.OpenMayaUI as mui
mainWin = wrapInstance(long(mui.MQtUtil.mainWindow()), QtGui.QWidget)
action = QtGui.QAction(mainWin)
action.setShortcut(QtGui.QKeySequence(QtCore.Qt.Key_Tab))
action.setShortcutContext(QtCore.Qt.ApplicationShortcut)
@mikebourbeauart
mikebourbeauart / Maya PySide- Multiple widgets to one slot
Last active August 29, 2015 14:23
Sends multiple widgets to one slot by iterating through a list of button label names
# Example formatted by Mike Bourbeau for Maya PySide from here: http://www.blog.pythonlibrary.org/2013/04/10/pyside-connecting-multiple-widgets-to-the-same-slot/
from PySide import QtCore, QtGui
from shiboken import wrapInstance
import maya.OpenMayaUI as mui
def maya_main_window():
ptr = mui.MQtUtil.mainWindow()
return wrapInstance( long( ptr ), QtGui.QWidget )