João Machete

Modeling via keyframes

by on Aug.01, 2010, under Research and Development

With this script you can generate a model based in key frames. Try to animate a simple cube and then run the script, this will bake all the animation and then create a simple boolean Union based in each mesh….very simple I know, but then you can play with dynamic objects, and bake the dynamics into keyframes and then create some kind of geometry based in forces…..Image you have a bunch of particles, then you instance some geometry to each particle, bake the simulation to key frames and run the script….This have some bugs but you have the idea…

import maya.cmds as cm
import maya.mel as mel

def modelingAnimation(step, startFrame, endFrame):

selection = cm.ls(sl=True);
if (step < 1):
print 'the step argument must be at least higher than 1';

listObjects=list(); # empty list

for object in selection:
for n in range(startFrame,endFrame,step):
cm.currentTime(n,edit=True);

listObjects.append(cm.duplicate(object));

indexObject=0;
inc=0;
max=len(listObjects);
imageNum=1;

mel.eval('playButtonStart');

while inc<=listObjects:
nameBollean = ("bolleanOp"+str(imageNum));
cm.select(clear=True);
cm.select(listObjects[indexObject], add=False);
cm.select(listObjects[indexObject+1], add=True);
cm.polyBoolOp( listObjects[indexObject], listObjects[indexObject+1], op=1, n=nameBollean)
cm.delete(nameBollean, constructionHistory=True);
listObjects[indexObject:indexObject+2]=[nameBollean];
imageNum+=1;
inc+=1;
:,
No comments for this entry yet...

Leave a Reply

 

Spam protection by WP Captcha-Free

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!