Hello! I'm pretty new to python and I have this problem with a UI Window in order to translate the points of a Lattice Deformer using a Slider. Here is what I've been doing till now. I would really need some help connecting the slider with the selected vertexes. This is in face where I get the error.
#Select vertices to translate on x
all_vertices=cmds.ls(selection=True, flatten=True)
print all_vertices
for vertex in all_vertices:
current_vertexposition = cmds.getAttr('{0}'.format(vertex))
print current_vertexposition
#Make window
if cmds.window("chWin", exists=True):
cmds.deleteUI("chWin")
def close_window(*args):
window.destroy(args[0].LatticeWindow, LatticeWindow=True)
#Var1=range(-2.5, 2.5)
# get Lattice deformer atributes in order to change position of selected vertices
LatticeWindow = cmds.window("LattWindow", title="Make your OWN SeaUrchin", widthHeight=(300,300))
cmds.columnLayout(adj=True)
imagePath=cmds.internalVar(userPrefDir=True)+"icons/seaurchin_maya.jpg"
cmds.image(w=300, h=113, image=imagePath)
cmds.separator(h=10)
cmds.text("Transform Lattice")
cmds.separator(h=10)
cmds.attrFieldSliderGrp( min=-2.50, max=2.50, at='%s.tx' % vertex[0])
cmds.showWindow(LatticeWindow)
# Error: line 1: Could not find attribute named f.tx
# Traceback (most recent call last):
# File "", line 8, in
# RuntimeError: Could not find attribute named f.tx #
In fact I would like the UI window to also have a button to Apply and Close but I just cannot understand what the command of this button should look like.
This is how my seen looked like at first, before i realised i should better use attrFieldSliderGrp. At first i thought a floatSliderGrp is enough to do the trick. Guess I was wrong.