示例#1
0
def sliderBld(attrLabel, attr, curParent, minVal=0, maxVal=1, reset=0):
	frm = cmds.formLayout(parent=curParent)
	
	text = cmds.text( label=attrLabel, w=60 )
	field = cmds.floatField( w=60, min=minVal, max=maxVal)
	slider = cmds.floatSlider( w=100, min=minVal, max=maxVal )
	
	# attribute needs to be sent to the function.
	btn1 = cmds.button(label="Key", 
		# command=scriptName + ".key( '" + attr + "')")
		command="%s.key( '%s' )" %(scriptName, attr))

	# attribute and reset value need to sent to the function.
	btn2 = cmds.button(label="Reset",
		# command=scriptName + ".reset( '" + attr + "', " + str(reset) + ")")
		command="%s.reset( '%s', %s )" %(scriptName, attr, reset))

	# attach Form (text control)
	cmds.formLayot( frm, edit=True, attachForm=[[text, "left", 0], [text, "top", 0]] )
	# attachForm and attachControl
	cmds.formLayout( frm, edit=True, attachForm=[field, "top", 0], attachControl=[field, "left", 0, text] )
	cmds.formLayout( frm, edit=True, attachForm=[slider, "top", 0], attachControl=[slider, "left", 0, field] )
	cmds.formLayout( frm, edit=True, attachForm=[btn1, "top", 0], attachControl=[btn1, "left", 0, slider] )
	cmds.formLayout( frm, edit=True, attachForm=[btn2, "top", 0], attachControl=[btn2, "left", 0, btn1] )


	cmds.connectControl( slider, attr )
	cmds.connectControl( field, attr )
	
	cmds.setParent(curParent)
	return row
示例#2
0
def sliderBld(attrLabel, attr, curParent, minVal=0, maxVal=1, reset=0):
    frm = cmds.formLayout(parent=curParent)

    text = cmds.text(label=attrLabel, w=60)
    field = cmds.floatField(w=60, min=minVal, max=maxVal)
    slider = cmds.floatSlider(w=100, min=minVal, max=maxVal)

    # attribute needs to be sent to the function.
    btn1 = cmds.button(
        label="Key",
        # command=scriptName + ".key( '" + attr + "')")
        command="%s.key( '%s' )" % (scriptName, attr),
    )

    # attribute and reset value need to sent to the function.
    btn2 = cmds.button(
        label="Reset",
        # command=scriptName + ".reset( '" + attr + "', " + str(reset) + ")")
        command="%s.reset( '%s', %s )" % (scriptName, attr, reset),
    )

    # attach Form (text control)
    cmds.formLayot(frm, edit=True, attachForm=[[text, "left", 0], [text, "top", 0]])
    # attachForm and attachControl
    cmds.formLayout(frm, edit=True, attachForm=[field, "top", 0], attachControl=[field, "left", 0, text])
    cmds.formLayout(frm, edit=True, attachForm=[slider, "top", 0], attachControl=[slider, "left", 0, field])
    cmds.formLayout(frm, edit=True, attachForm=[btn1, "top", 0], attachControl=[btn1, "left", 0, slider])
    cmds.formLayout(frm, edit=True, attachForm=[btn2, "top", 0], attachControl=[btn2, "left", 0, btn1])

    cmds.connectControl(slider, attr)
    cmds.connectControl(field, attr)

    cmds.setParent(curParent)
    return row
示例#3
0
# 2)
text = cmds.text( label=attrLabel, w=60 )
field = cmds.floatField( w=60, min=minVal, max=maxVal)
slider = cmds.floatSlider( w=100, min=minVal, max=maxVal )
	
# 3)
# 4 Slides "top", "left", "right", & "bottom"
# Normaly set 2.
# 3 Main Flags
# attachForm 
# attachControl
# attachPostion
# [control, side, offset]  or [control, side, offset, otherControl]

# attach Form (text control)
cmds.formLayot( frm, edit=True, attachForm=[[text, "left", 0], [text, "top", 0]] )
# attachForm and attachControl
cmds.formLayout( frm, edit=True, attachForm=[field, "top", 0], attachControl=[field, "left", 0, text] )
cmds.formLayout( frm, edit=True, attachForm=[slider, "top", 0], attachControl=[slider, "left", 0, field] )


def sliderBld(attrLabel, attr, curParent, minVal=0, maxVal=1, reset=0):
	frm = cmds.formLayout(parent=curParent)
	
	text = cmds.text( label=attrLabel, w=60 )
	field = cmds.floatField( w=60, min=minVal, max=maxVal)
	slider = cmds.floatSlider( w=100, min=minVal, max=maxVal )
	
	# attribute needs to be sent to the function.
	btn1 = cmds.button(label="Key", 
		command=scriptName + ".key( '" + attr + "')")