Skip to content

Instantly share code, notes, and snippets.

@gregtemp
gregtemp / randomParticleVelocity.py
Last active August 29, 2015 14:02
Random particle velocity in Maya-- (the right way) && (only on creation)
# random particle velocity -- (the right way)
import maya.cmds as cmds
import random
random.seed(1234)
# setup
amountOfParticles = 50
@gregtemp
gregtemp / randomParticle.py
Created June 5, 2014 21:23
Random particle velocity -- with individual particle access (at long last) + (some extra stuff)
# random particle velocity -- with individual particle access (at long last)
import maya.cmds as cmds
import random
random.seed(1234)
amountOfParticles = 500
r = 10
@gregtemp
gregtemp / keyRotation.py
Created June 5, 2014 18:04
Key full rotation of selected objects - in Maya
#keyRotation.py
import maya.cmds as cmds
def keyFullRotation (pObjectName, pStartTime, pEndTime, pTargetAttribute) :
cmds.cutKey(pObjectName, time=(pStartTime, pEndTime), attribute=pTargetAttribute)
cmds.setKeyframe(pObjectName, time=pStartTime, attribute=pTargetAttribute, value = 0)
cmds.setKeyframe(pObjectName, time=pEndTime, attribute=pTargetAttribute, value=360)
cmds.selectKey(pObjectName, time=(pStartTime, pEndTime), attribute=pTargetAttribute, keyframe=True)
@gregtemp
gregtemp / aimAtFirst.py
Created June 5, 2014 17:29
Aim a list of objects at the first object - in Maya
#aimAtFirst.py
import maya.cmds as cmds
selectionList = cmds.ls(orderedSelection = True)
if len( selectionList ) >= 2 :
print ( 'Selected Items: %s' %(selectionList))
targetName = selectionList[0]
selectionList.remove (targetName)
@gregtemp
gregtemp / randomInstances.py
Created June 5, 2014 16:25
Random instances of first selected object in Maya
# randomInstances.py
import maya.cmds as cmds
import random
#get the same list of "random" numbers each time
random.seed (1234)
@gregtemp
gregtemp / randomCubes.py
Created June 5, 2014 16:19
Random cubes in Maya
# randomCubes.py
import maya.cmds as cmds
import random
#get the same list of "random" numbers each time
random.seed (1234)
@gregtemp
gregtemp / gettingStartedMaya.py
Last active August 29, 2015 14:02
Getting started in python in maya
import maya.cmds as cmds
cubeList = cmds.ls( 'myCube*' )
if len(cubeList) > 1:
cmds.delete(cubeList)
result = cmds.polyCube (w=1, h=1, d=1, name='myCube#')
#print ('result:' + str(result))
// First auto generated objects script
int $xlimit = 10;
int $zlimit = 10;
int $boidAmount = 50;
string $name;
for ($i = 0; $i < $boidAmount; $i++) {
@gregtemp
gregtemp / c4workspace.m
Last active December 25, 2015 17:29
current proj
//
// C4WorkSpace.m
// TumblrGetPostsTest1
//
// Created by Gregory Debicki on 2013-10-16.
//
#import "C4Workspace.h"
#import "TMAPIClient.h"
@gregtemp
gregtemp / gist:7012626
Created October 16, 2013 18:38
crazy tumblr shit
(
{
"blog_name" = alonglistofthings;
"can_reply" = 0;
caption = "";
date = "2013-10-11 03:20:20 GMT";
followed = 0;
format = html;
highlighted = (
);