import MASH.api as mapi reload(mapi) import maya.cmds as cmds #new file cmds.file(force=True, new=True) #move the camera cmds.setAttr('persp.translateX', 133.600) cmds.setAttr('persp.translateY', 97.700) cmds.setAttr('persp.translateZ', 133.600) #create a poly cube ptorus = cmds.polyTorus(r=80, sr=6, sh=15, sx=100) pcube = cmds.polyCube(w=0.1, h=2, d=0.1) #create a new MASH network mashNetwork = mapi.Network() mashNetwork.createNetwork("CurlNoiseNetwork") shape = cmds.listRelatives(ptorus[0], s=True)[0] mashNetwork.meshDistribute(shape, 1) cmds.setAttr(mashNetwork.distribute + '.floodMesh', 1) cmds.setAttr(mashNetwork.distribute + '.pointCount', 20) #add a World node node = mashNetwork.addNode("MASH_World") #set some attributes on the world node using the .name of the node instance cmds.setAttr( node.name+".clusterMode", 7) cmds.setAttr( node.name+".sparsity", 0.5) cmds.setKeyframe( node.name, attribute='ecosystemAge', t=['0sec'], v=0.0 ) cmds.setKeyframe( node.name, attribute='ecosystemAge', t=['5sec'], v=120.0 ) cmds.setAttr( node.name+".ignoreSlope", 1) node.addGroundPlane(ptorus[0]) jsonString = '[{"Slope": 0.6, "colorBar": [255, 255, 255], "Id Min": 0, "Name": "Default Genotype", "Seed Count": 4, "Resiliance": 0.2, "Age": 100, "Soil Quality": 0.5, "Id": 0, "Temperature": 0.5, "Rate": 0.12, "Id Max": 0, "Id Color": [0.0, 0.0, 0.0], "Moisture": 0.5, "Variance": 0.2, "Seed Age": 10, "Size": 1.0}]' # cmds.setAttr(node.name + '.genotypeJSON', jsonString, type='string') cmds.hide(ptorus[0]) cmds.flushIdleQueue() #playblast cmds.playbackOptions( animationEndTime='5sec') cmds.playblast(format="qt", viewer=True, p=100 )