Skip to content

Instantly share code, notes, and snippets.

View shallowabyss's full-sized avatar

Chris Peterson shallowabyss

View GitHub Profile
@whoiscarlo
whoiscarlo / mayaCmdPort.py
Created September 16, 2015 23:28
Connecting to Maya's Socket
'''
Command port
http://forums.cgsociety.org/archive/index.php?t-966699.html
Creative Crash
'''
import socket
#HOST = '192.168.1.122' # The remote host
HOST = '127.0.0.1' # the local host
PORT = 54321 # The same port as used by the server
ADDR=(HOST,PORT)
@r4inm4ker
r4inm4ker / layerEditorWidget.py
Last active September 17, 2015 14:06
embed layer editor inside pyside / pyqt widget
from PySide import QtCore, QtGui
import shiboken
import maya.OpenMayaUI as omui
from maya.app.general.mayaMixin import MayaQWidgetDockableMixin
import pymel.core as pm
def wrapInstance(ptr, base=None):
"""
Utility to convert a pointer to a Qt class instance (PySide/PyQt compatible)
borrowed from http://nathanhorne.com/?p=485
@r4inm4ker
r4inm4ker / extractBlendShape.py
Last active May 13, 2024 09:27
extract blendshape target from blendshape node
import pymel.core as pm
import re
def parseVtxIdx(idxList):
"""convert vertex index list from strings to indexes.
idxList : [u'vtx[1]', u'vtx[3]', u'vtx[6]', u'vtx[8]', u'vtx[12:13]']
return : [1,3,6,8,12,13]
"""
parseIdxList = []
@SEVEZ
SEVEZ / select_channels_in_cb.py
Created August 29, 2015 11:20
Select channels in channel box for some operations
import maya.mel as mel
import maya.OpenMayaUI as omui
from PySide.QtGui import *
from PySide.QtCore import *
from shiboken import wrapInstance as wrap
qMaya = wrap(long(omui.MQtUtil.mainWindow()), QMainWindow)
# find chennelbox
gChannelBoxName = mel.eval('$temp=$gChannelBoxName')
table = qMaya.findChild(QTableView, gChannelBoxName)
@hmasato
hmasato / MAYA_findFlippedUVs.py
Last active January 26, 2021 01:56
[Maya, python] _findFlippedUVs
# -*- coding: utf-8 -*-
import maya.OpenMaya as om
import maya.cmds as cmds
def _findFlippedUVs(nodesOnly=True):
ret = []
selList = om.MSelectionList()
@narango
narango / UnityExporter.py
Last active September 17, 2015 14:36
Exports the base and low-version assets separately to a valid Unity Project. It exports in FBX export. For use in Autodesk Maya.
__author__ = "Narendra 'aka' NaRango"
'''
Exports assets directly to selected Unity Project
valid Assets = models
USAGE:
1) Execute this script in Maya's Script Editor
2) It should open "Unity Exporter" window
@whoiscarlo
whoiscarlo / changeMayaWindowColor
Last active September 17, 2015 14:15
Change Maya Window Color
'''
Author: Greg Torrn
script: changeMayaWindowColor
'''from maya import cmds
import colorsys
import random
h = round(random.uniform(0.0, 1.0), 2)
s = round(random.uniform(0.0, 1.0), 2)
v = round(random.uniform(0.1, 0.5), 2)
@r4inm4ker
r4inm4ker / selectEnclosedFaces.py
Last active May 11, 2016 19:11
Select enclosed faces by edge loop and one inner vertex in Maya
import maya.cmds as cmds
import re
import maya.OpenMaya as om
def getComponentId(component):
"""get id number from a component (i.e. pCube.vtx[12]) , and return as int (i.e. 12 ) ."""
tokens = re.split('[\[\]]',str(component))
try:
return int(tokens[1])
from maya import cmds
sFile = cmds.file(q=True, sceneName=True)
cmds.file(sFile, open=True, force=True)
@fredrikaverpil
fredrikaverpil / maya_sublime.py
Created March 25, 2014 14:58
Open ports in Maya for Sublime Text #maya
import maya.cmds as cmds
# Close ports if they were already open under another configuration
try:
cmds.commandPort(name=":7001", close=True)
except:
cmds.warning('Could not close port 7001 (maybe it is not opened yet...)')
try:
cmds.commandPort(name=":7002", close=True)
except: