Skip to content

Instantly share code, notes, and snippets.

View justinfx's full-sized avatar

Justin Israel justinfx

View GitHub Profile
@justinfx
justinfx / maya_qt_error_decorator.py
Created January 12, 2017 20:57
A decorator to wrap Qt slots, in Maya, so that exceptions are reported to Script Editor
"""
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
@justinfx
justinfx / file_model_filters.py
Created November 8, 2016 10:07
Using proxy model to apply custom file extension filtering to a QFileSystemModel
"""
Example of using a proxy model to apply custom
filtering to a QFileSystemModel
RE: https://groups.google.com/d/topic/python_inside_maya/a2QM_KvgfeI/discussion
Justin Israel
justinisrael@gmail.com
"""
from PySide import QtCore, QtGui
@justinfx
justinfx / qlistwidgetitem_click.py
Created September 20, 2016 10:23
Qt Example: Double clicking a QListWidgetItem and toggling the background color
"""
https://groups.google.com/d/topic/python_inside_maya/eZOCjK2jewY/discussion
How to create a QListWidget, and toggle the background color of items
when they are double clicked
"""
from PySide import QtCore, QtGui
class List(QtGui.QDialog):
@justinfx
justinfx / maya_unique_name.py
Last active September 14, 2016 22:15
Example of an approach to generating a unique name for a Maya object, using Maya commands API
"""
Re: https://groups.google.com/d/topic/python_inside_maya/ndjexeQrZs8/discussion
Example of an approach to generating a unique name for a Maya object.
Author: Justin Israel (justinisrael@gmail.com)
"""
def uniqueNamePattern(base="object", padding=1):
"""
@justinfx
justinfx / openimageigo_issue1.go
Created August 23, 2016 10:53
Example of converting OpenImageIO ColorData float32 rgb pixel values into stdlib image; Encode to JPEG
/*
Example of taking an OpenColorIO ColorData and converting
it into a stdlib Image. Then encoding to jpeg format.
Ref: https://github.com/justinfx/opencolorigo/issues/1
Author: Justin Israel (justinisrael@gmail.com)
*/
package main
package main
import (
"bytes"
"fmt"
"image"
"image/gif"
"net/http"
"github.com/gin-gonic/gin"
// Testing reported mem leak at: https://github.com/gographics/imagick/issues/72
package main
import (
"fmt"
"io/ioutil"
"log"
"os"
"runtime"
@justinfx
justinfx / MImage_to_QImage.py
Created January 28, 2016 07:12
Passing pixel pointer from a Maya MImage to Qt's QImage
"""
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
from flask.ext.restful import Resource
from flask import Response
from ctypes import CDLL
gotest = CDLL("gotest.so")
class api2(Resource):
def get(self):
return gotest.GetValWithConcurrency()
@justinfx
justinfx / repeat.py
Created May 25, 2015 10:40
Example of a repeatable command decorate, for Maya (maya.cmds)
"""
Original example reformatted from:
http://blog.3dkris.com/2011/08/python-in-maya-how-to-make-commands.html
python_inside_maya discussion:
https://groups.google.com/d/topic/python_inside_maya/xfuCYBO6aLg/discussion
"""
import maya.cmds as cmds