Hey guys, I'm trying to make a staircase script where the number of stairs increases/decreases based on an a slider.
The problem is that when I try to increase the number of stairs, if I move the slider too quickly, areas of the stairs will be skipped. (specifically the issue is within the ELSE: statement) Everything else works correctly.
import maya.cmds as cmds
stairNum = []
def stair():
cmds.window ()
cmds.columnLayout()
cmds.intSliderGrp(l = 'Stairs', dc = numStairs, f= True, minValue = 1, value = 1)
cmds.showWindow()
def numStairs(num):
if num < len(stairNum):
for number in stairNum[num:]:
cmds.delete (number)
# cmds.delete (number[1])
del stairNum[num:]
else:
for number in range(len(stairNum),num):
print num
stairNum.append(cmds.polyCube(d=2.0,h=1,w=8.0,n='stair'+str(num)))
cmds.move(0,num,num/-0.5)
stair()
Some of my friends have suggested that I set it up to delete all stairs when I move the slider and remake them, but I'm not sure how to do this. Any help is greatly appreciated. Thansk