I am trying to create a small GUI in maya basically what I want it to do is create a image button that will create a tree and edit its attributes.... like move the tree in any direction, change it colour etc...
I have this so far..
Code:
import maya.cmds as cmds import maya.mel as mel cmds.window( title='Tree Maker Version 1.0' ) cmds.columnLayout() cmds.button(label="Create a tree", command="treeGen()") cmds.button(label="Create a second tree", command="treeGen1()") def treeGen(): cmds.circle(nr =(0, 1, 0), c =(0, 0, 0)) cmds.spaceLocator( p=(0, 0, 0) ) cmds.select("nurbsCircle1", r=True) cmds.select("locator1", add=True) cmds.parent() cmds.setAttr( "nurbsCircle1.rotateX", -90) cmds.setAttr( "nurbsCircle1.scaleZ", .1) cmds.setAttr( "nurbsCircle1.scaleX", .1) cmds.setAttr( "nurbsCircle1.scaleY", .1) mel.eval('source "C:/Program Files/Autodesk/Maya2014/brushes/treesMesh/oakAutumn.mel"') cmds.select("nurbsCircle1", r=True) cmds.AttachBrushToCurves() cmds.attrFieldSliderGrp( min=-1.0, max=3.0, at="oakAutumn1.numBranches" ) cmds.attrFieldSliderGrp( min=-10.0, max=10.0, at="oakAutumn1.numTwigClusters" ) cmds.attrFieldSliderGrp( min=-11.0, max=20.0, at="oakAutumn1.numLeafClusters" ) cmds.showWindow()
That code is able to create a tree and edit some of its attributes. How would I be able to click the same button but creates a new tree but at a different position? Also it needs to have a function where it only allows a certain amount of trees so it cant be pressed so many times f How do I add an image to the button or make an image a button?
Any help would be appreciated
Thank you