View MImage_to_QImage.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Simplified version of original forum post: | |
http://tech-artists.org/forum/showthread.php?4547-Passing-uchar-pointer-with-PySide-in-Maya | |
""" | |
import ctypes | |
import maya.OpenMaya as om | |
from PySide import QtCore, QtGui | |
# Build a test MImage |
View cix_to_py.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
''' | |
A small script to convert a .cix (codeintel schema) file into | |
a python stub module, for use in auto-completion. | |
https://community.activestate.com/faq/codeintel-cix-schema | |
Requires jinja2 for the output template format | |
''' |
View shells.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def getShellFaces(poly, asString=False): | |
shells = set() | |
faces = set() | |
total = cmds.polyEvaluate(poly, s=True) | |
for f in xrange(cmds.polyEvaluate(poly, f=True)): | |
if len(shells) >= total: | |
break | |
if f in faces: |
View maya_qt_error_decorator.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
A decorator to wrap Qt slots, in Maya, so that exceptions are reported to Script Editor | |
Ref: https://groups.google.com/d/topic/python_inside_maya/xv7DCiocDZA/discussion | |
justinisrael@gmail.com | |
""" | |
#... | |
import sys |
View tree_widget_drag.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
https://groups.google.com/d/msg/python_inside_maya/1EzNG_i9Xes/Au-18UaXAwAJ | |
Capturing the start and end item/index information in a | |
PySide2 QTreeWidget internal drag and drop | |
""" | |
from __future__ import print_function | |
from PySide2 import QtCore, QtGui, QtWidgets |
View maya_script_editor.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
This code can be run from a Maya script editor | |
""" | |
import subprocess | |
import cPickle | |
print 'This value below should be a 1000:' | |
p = subprocess.Popen(["/path/to/multi_test.py", "-po"], stdout=subprocess.PIPE) | |
result = cPickle.load(p.stdout) |
View py3_asyncore_server.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import asyncore | |
import socket | |
import threading | |
class ChatServer(asyncore.dispatcher): | |
def __init__(self, host, port): | |
asyncore.dispatcher.__init__(self) |
View read_qt_process.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from functools import partial | |
from subprocess import Popen, PIPE | |
from PyQt4 import QtCore, QtGui | |
## testProgram.sh | |
""" | |
#!/bin/bash |
View qt_proxy_model.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
""" | |
Refs: | |
"[Maya-Python] Customized display of files/folders in a QTreeView that is using QFileSystemModel." | |
https://groups.google.com/d/topic/python_inside_maya/TaFm2yNToJ8/discussion | |
""" | |
from PySide import QtCore, QtGui |
View mayaVertFaceSelect.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
import maya.cmds as cmds | |
def getSelectedInts(): | |
rx = re.compile(r'\[(\d+)\]$') | |
intList = [] | |
sel = cmds.ls(sl=True) | |
if not sel: | |
return "", [] |