Home Coding, Scripting, Shaders

Maya replicate along curve with MASH script

polycounter lvl 2
Offline / Send Message
m00k polycounter lvl 2
Hey guys I'm writing the script in the title but I've run into some issues. The script works once but once other mash networks enter the fray it fails since I don't know how to indicate which one to use. I can't find any decent MASH documentation.

# Curve replicator


#TODO
# alter mash network name
#add support for other curves

import MASH.api as mapi
import maya.cmds as cmds


selection = cmds.ls (selection = True);
shapes = cmds.listRelatives (shapes = True)
succes = 0

cmds.select (cl = True)



#sort selection
if (len(selection) == 2):
for shape in shapes:
if (cmds.objectType(shape, isType = 'bezierCurve')):
obCurve = selection[shapes.index(shape)]
succes = succes+1

elif (cmds.objectType(shape, isType = 'mesh')):
print selection[shapes.index(shape)]
ob = cmds.duplicate(selection[shapes.index(shape)], rr = True)
succes = succes+2

else:
print 'object selected is not bezier or mesh, quiting'

if (succes == 3):
#Create mash network
cmds.select (ob)
mashNetwork = mapi.Network()
mashNetwork.createNetwork(name = 'Replicator')
mashNetwork.addNode('MASH_Curve')
cmds.connectAttr(obCurve + '.worldSpace[0]', 'MASH1_Curve' + '.inCurves[0]', force=1)

#Print stuff
print mashNetwork.waiter
print mashNetwork.distribute
print mashNetwork.instancer

else:
print 'selection incorrect, stopping...'





Sign In or Register to comment.