Skip to content

Instantly share code, notes, and snippets.

@gregtemp
gregtemp / fractals.py
Created September 26, 2014 20:13
better fractals.py
# STILL NOT QUITE THERE YET
import maya.cmds as cmds
#cube = cmds.polyCube(h=5, w=5, d=5)
#cubeName = cube[0]
#cmds.setAttr(cubeName + '.translateX', 5)
#cmds.setAttr(cubeName + '.translateY', 5)
#cmds.setAttr(cubeName + '.translateZ', 5)
@gregtemp
gregtemp / fracalsMel.py
Created August 23, 2014 01:33
fractals 1 (not working)
# 1. Select the object you want to randomly extrude
# or use the "Make eCube" button to make one.
# 2. Press Check Selection.
# 3. Select the amount of random extrusion loops
# you would like to make and click Random Extrude
# 4. Click Keyframe to key the current frame for all
# vertices
import maya.cmds as cmds
import random
@gregtemp
gregtemp / rex.py
Last active August 29, 2015 14:02
REX - Random Extrusion - Maya Python
# 1. Select the object you want to randomly extrude
# or use the "Make eCube" button to make one.
# 2. Press Check Selection.
# 3. Select the amount of random extrusion loops
# you would like to make and click Random Extrude
# 4. Click Keyframe to key the current frame for all
# vertices
import maya.cmds as cmds
import random
@gregtemp
gregtemp / uimock.py
Created June 16, 2014 18:55
UI Mock up - Maya mel python
import maya.cmds as cmds
class FlckUi():
def __init__(self):
flckUi = 'flckUi'
if cmds.window(flckUi, exists=True):
cmds.deleteUI(flckUi)
@gregtemp
gregtemp / windowStuff.py
Created June 16, 2014 16:51
Learning about windows and stuff - Maya Python Mel
#from here - http://stackoverflow.com/questions/12309634/maya-python-how-to-close-a-custom-ui-window-after-the-user-has-pressed-enter
import maya.utils # you need this line!
class ReUI():
def __init__(self):
renUI = 'renUI'
if cmds.window(renUI, exists = True):
cmds.deleteUI(renUI)
@gregtemp
gregtemp / boids.py
Last active October 13, 2017 09:09
Boids Sim - Maya Python Mel (with comments)
# Boids Simulation
# Basic outline of the functionality of the boid simulation
# This example does not include the user interface and is
# stripped back to it's core functionality for documentation
# purposes.
import maya.cmds as cmds
import random
from maya.OpenMaya import MVector
@gregtemp
gregtemp / lod2.py
Last active August 29, 2015 14:02
Level of detail for Crow Group (test) - Maya Python Pymel
import pymel.core.runtime as pm
import maya.cmds as cmds
# Needs a series of crow models with progressively smaller level of detail
# Check if there is already a LevelOfDetail group (for testing reasons)
lodList = list()
lodList = cmds.ls('lodGroup*')
if len(lodList) > 0:
cmds.select('lodGroup1')
@gregtemp
gregtemp / lod1.py
Created June 13, 2014 20:15
Level of detail demo - maya python pymel
import pymel.core.runtime as pm
import maya.cmds as cmds
lodList = list()
lodList = cmds.ls('lodGroup*')
if len(lodList) > 0:
cmds.select('lodGroup1')
pm.LevelOfDetailUngroup()
else:
print('no group to ungroup')
@gregtemp
gregtemp / help.txt
Last active August 29, 2015 14:02
References for learning Maya, MEL & Python
Pymel documentation
http://download.autodesk.com/us/maya/2011help/PyMel/genindex.html
Level of Detail instancing work around:
http://mayastation.typepad.com/maya-station/2010/05/instance-your-lod-groups.html
@gregtemp
gregtemp / newFlockingAttempt.py
Created June 11, 2014 21:35
newFlockingAttempt python maya mel
import maya.cmds as cmds
import maya.OpenMaya as om
import random
random.seed (1234)
amountOfParticles = 10
dist = 10
ease = 1