Skip to content

Instantly share code, notes, and snippets.

@SEVEZ
SEVEZ / 0_reuse_code.js
Last active August 29, 2015 14:17
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
// Poly Separate
// Copyright (C) 2012 Basenji Games
// Licensed under the MIT license
string $selection[] = `ls -sl`;
sepMat($selection[0]);
global proc sepMat(string $object){
string $shadingGroups[] = getSGsFromShape($object);
string $ParentName = ($object + "_lightMap_Group");
@SEVEZ
SEVEZ / Copy_pivot.py
Created August 29, 2015 11:18
Copy pivot from second object to first object
'''
Align pivots by Serge Scherbakov.
Usage:
1. Select source object(s)
2. Add to selection target object
3. Run script by 'import copyPivot\n copyPivot.copyPivot()
'''
import maya.cmds as cmds
import maya.mel as mel
@SEVEZ
SEVEZ / crease_hard_edges_conv.py
Created August 29, 2015 11:18
Convert between creased and hard edges
''' [Crease To Normal]
Created on 23.07.2012
edgeCreaser - uses edge Crease info to make it hard edge, or use Hard edge info to make edge crease.
@author: Serge Scherbakov
'''
import maya.cmds as cmds
class edgeCreaser():
@staticmethod
def apply(mode = 'c2n'):
@SEVEZ
SEVEZ / check_uv_flips_overlaps.py
Created August 29, 2015 11:18
Maya Python script for selecting overlapped and flipped uv polygons
import math
import maya.api.OpenMaya as om
from pymel.core import *
from pymel.core.datatypes import *
def createBoundingCircle(meshfn):
"""Parameter: meshfn - MFnMesh
Represent a face by a center and radius, i.e.
center = [center1u, center1v, center2u, center2v, ... ]
radius = [radius1, radius2, ... ]
@SEVEZ
SEVEZ / edges_to_curves.py
Created August 29, 2015 11:18
Extract selected edges to curves
from pymel.all import *
sel = ls( selected(), fl=1 )
aCe = []
while len( sel ):
ce = []
for e in sel:
if ce == []: ce.append( e )
else:
@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)
@SEVEZ
SEVEZ / str2var.py
Last active September 7, 2017 17:49
#Util
exec( 'global %s' % 'food' )
vars()['food'] = 0
print( vars()['food'] )
@SEVEZ
SEVEZ / snap_loc_to_geo.py
Created August 29, 2015 11:22
Create locator on surface of any visible mesh object
import maya.cmds as cmds
import pymel.core as pm
import maya.api.OpenMaya as om
import maya.api.OpenMayaUI as omui
class SamsClass():
def __init__(self):
pass
import maya.cmds as cmds
from pymel.core import *
from pymel.core.datatypes import *
import maya.api.OpenMaya as om
import maya.api.OpenMayaUI as omui
class SamsClass():
def __init__(self):
pass