Skip to content

Instantly share code, notes, and snippets.

View peppe-russo's full-sized avatar

Peppe Russo peppe-russo

View GitHub Profile
@peppe-russo
peppe-russo / install.py
Created July 23, 2017 19:31
Create a shelf button for your Maya script
def install():
############
url = 'http://pepperusso.uk/scripts/batchRename/icon.png' # Url of your icon
imageName = 'batchrename.png' # The icon will be saved using this name (include ext) in the icons folder of the current maya version (usually : documents/version/prefs/icons)
name = 'Batch Rename' # Name to use for the shelf button
tooltip = 'Rename multiple objects' # Tooltip to use for the shelf button
# Command of the shelf button.
command = """
@peppe-russo
peppe-russo / checkUpdates.py
Last active August 23, 2017 10:25
Code snippet for checking updates in a script
import urllib
__version__ = "0.9.0"
def checkUpdates():
url = "http://pepperusso.uk/update.txt" # Current version of the script. In the file: First row: 1.0.0
update = urllib.urlopen(url).read()
if update.split("\n")[0] > __version__:
print("\n".join(update.split("\n")[1:])) # Print message from the txt file in the server (Starting from second line)
@peppe-russo
peppe-russo / PySide_baseWindow.py
Last active July 22, 2017 19:02
Base code for a Pyside window in Maya (tested on 2016 and 2017)
from maya import cmds
# Qt
try:
from PySide2 import QtWidgets, QtCore, QtGui
except ImportError:
from PySide import QtCore, QtGui
QtWidgets = QtGui
class MainWindow(QtWidgets.QMainWindow):
def __init__(self):