Announcements
Due to scheduled maintenance, the Autodesk Community will be inaccessible from 10:00PM PDT on Oct 16th for approximately 1 hour. We appreciate your patience during this time.
Community
Maya Programming
Welcome to Autodesk’s Maya Forums. Share your knowledge, ask questions, and explore popular Maya SDK topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

UI Translate X points on a Lattice Deformer

0 REPLIES 0
Reply
Message 1 of 1
Anonymous
296 Views, 0 Replies

UI Translate X points on a Lattice Deformer

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 "<maya console>", line 8, in <module>
# 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 a pic of how the window looked at first. At first, I used a floatSliderGrp, but later I realised I should better use attrFieldSliderGrp.

 

 

 

0 REPLIES 0

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report