本文整理汇总了Python中maya.cmds.floatFieldGrp函数的典型用法代码示例。如果您正苦于以下问题:Python floatFieldGrp函数的具体用法?Python floatFieldGrp怎么用?Python floatFieldGrp使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了floatFieldGrp函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setPointValue
def setPointValue(FFG, point=''):
"""
Set the value of a floatFieldGrp with the position value of a specifeid point
@param FFG: FloatFieldgrp to set values for
@type FFG: str
@param point: Point to get position from
@type point: str
"""
# Check point
if point and not cmds.objExists(point):
raise Exception('Point object "' + point + '" does not exist!')
# Get object selection
sel = cmds.ls(sl=1)
if not point and not sel:
raise Exception('No point specified for floatFieldGrp values!')
# Get point
if point:
pos = glTools.utils.base.getPosition(point)
else:
pos = glTools.utils.base.getPosition(sel[0])
# Set float field values
cmds.floatFieldGrp(FFG, e=True, v1=pos[0], v2=pos[1], v3=pos[2])
示例2: doOptions
def doOptions(input_suffix, input_numberTwistJoints, input_elbowAimAxis, input_elbowFrontAxis, input_handFrontAxis):
"""Specifies the function called when the apply or create button is clicked"""
try:
# validate selection
selection = utils.dg.validateSelection(type='transform', name='wrist joint objects', min=1)
# validate suffix
suffix = cmds.textFieldGrp(input_suffix, q=True, tx=True)
utils.dg.validateAffix(suffix)
# set up the forearms
numberTwistJoints = cmds.intSliderGrp(input_numberTwistJoints, q=True, v=True)
newSelection = []
# perform setup for each wrist in the selection
for wrist in selection:
elbow = cmds.listRelatives(wrist, p=True, f=True)
elbowShort = cmds.listRelatives(wrist, p=True)
newJoints = doSetup(
elbowShort[0] + suffix,
numberTwistJoints,
wrist,
elbow[0],
cmds.floatFieldGrp(input_elbowAimAxis, q=True, v=True),
cmds.floatFieldGrp(input_elbowFrontAxis, q=True, v=True),
cmds.floatFieldGrp(input_handFrontAxis, q=True, v=True))
newSelection += newJoints
# select the newly created joints for easy editing
cmds.select(newSelection)
except: raise
示例3: extendUI
def extendUI(*args):
"""UI for the script"""
#UI
if cmds.window("curbWin", exists=True):
cmds.deleteUI("curbWin")
cmds.window("curbWin", t="zbw_polyExtender", w=200, h=200)
cmds.columnLayout("colLO")
cmds.frameLayout("topFrame", l="Covert Edge", cll=True, bgc=(.2,.2,.2))
cmds.text("Select poly edge to convert")
cmds.button("convertBut", l="Convert!", w=200, h=30, bgc=(.8, .8,.6), c=convertEdge)
cmds.separator(h=5)
cmds.setParent("colLO")
cmds.frameLayout("midFrame", l="Create Poly", cll=True, bgc=(.2,.2,.2))
cmds.text("Select curve")
cmds.separator(h=5)
cmds.textFieldGrp("name", l="Name", w=200, cw=[(1,30), (2,170)], tx="newPoly")
cmds.checkBox("curbCB", l="Positive Direction", v=True)
# cmds.checkBox("bumpCB", l="Add vertical hump?", v=True)
cmds.floatFieldGrp("curbFFG", l="Curb Width", cal=((1, "left"),(2,"left")), cw=([1,75],[2,50]), v1=10)
cmds.intFieldGrp("UDivIFG", l="Width Subdivisions", cal=((1, "left"),(2,"left")), cw=([1,75],[2,50]), v1=1)
cmds.intFieldGrp("VDivIFG", l="Length Subdivisions", cal=((1, "left"),(2,"left")), cw=([1,75],[2,50]), v1=1)
cmds.checkBox("polyHistory", l="Keep history on final poly?", v=False)
cmds.checkBox("history", l="Keep history objects?", v=True, cc=enableHistory)
cmds.separator(h=5)
cmds.button("curbBut", l="Create Curb", h=40, w=200, bgc=(.6, .8, .6), c=extendPoly)
cmds.showWindow("curbWin")
cmds.window("curbWin", e=True, h=150, w=200)
示例4: import2dTrackUI
def import2dTrackUI():
"""
"""
# Build UI Window
window = 'import2dTrackUI'
if cmds.window(window, q=True, ex=True): cmds.deleteUI(window)
window = cmds.window(window, title='Import 2D Track', wh=[500, 350])
# Build UI Elements
cmds.columnLayout(adjustableColumn=True)
perspCamListTSL = cmds.textScrollList('importTrack_camListTSL', numberOfRows=8, ams=False)
fileTFB = cmds.textFieldButtonGrp('importTrack_fileTFB', label='2D Track File', buttonLabel='Browse')
cmds.textFieldButtonGrp(fileTFB, e=True, bc='glTools.ui.utils.loadFilePath("' + fileTFB + '",fileFilter="*.*")')
cmds.textFieldGrp('importTrack_nameTFG', label="Point Name", text='trackPoint1')
cmds.floatFieldGrp('importTrack_widthFFG', numberOfFields=1, label='Source Pixel Width', value1=2348)
cmds.floatFieldGrp('importTrack_heightFFG', numberOfFields=1, label='Source Pixel Height', value1=1566)
cmds.button(label='Import Track',
c='import glTools.tools.import2dTrack;reload(glTools.tools.import2dTrack);glTools.tools.import2dTrack.import2dTrack()')
cmds.button(label='Close', c='cmds.deleteUI("' + window + '")')
# Build Camera List
camList = cmds.listCameras(p=True)
for cam in camList: cmds.textScrollList(perspCamListTSL, e=True, a=cam)
# Show Window
cmds.showWindow(window)
示例5: attachToCurveFromUI
def attachToCurveFromUI(close=False):
"""
Execute attachToCurve() from UI
"""
# Window
window = 'attachToCurveUI'
if not cmds.window(window, q=True, ex=1): raise UIError('AttachToCurve UI does not exist!!')
# Get UI data
curve = cmds.textFieldGrp('attachToCurveTFB', q=True, text=True)
transform = cmds.textFieldGrp('attachToCurveTransformTFB', q=True, text=True)
prefix = cmds.textFieldGrp('attachToCurvePrefixTFG', q=True, text=True)
closestPoint = cmds.checkBoxGrp('attachToCurveClosestPointCBG', q=True, v1=True)
param = cmds.floatSliderGrp('attachToCurveParamFSG', q=True, v=True)
paramAttr = cmds.textFieldGrp('attachToCurveParamAttrTFG', q=True, text=True)
orient = cmds.checkBoxGrp('attachToCurveOrientCBG', q=True, v1=True)
upVec = (cmds.floatFieldGrp('attachToCurveUpVecFFG', q=True, v1=True),
cmds.floatFieldGrp('attachToCurveUpVecFFG', q=True, v2=True),
cmds.floatFieldGrp('attachToCurveUpVecFFG', q=True, v3=True))
upVecObj = cmds.textFieldButtonGrp('attachToCurveUpVecObjTFG', q=True, text=True)
# Check curve
if not glTools.utils.curve.isCurve(curve):
raise UserInputError('Object "' + curve + '" is not a valid nurbs curve!!')
glTools.utils.attach.attachToCurve(curve=curve, transform=transform, uValue=param, useClosestPoint=closestPoint,
orient=orient, upVector=upVec, worldUpObject=upVecObj, uAttr=paramAttr,
prefix=prefix)
# Cleanup
if close: cmds.deleteUI(window)
示例6: addMirrorMeshCmd
def addMirrorMeshCmd(self, logicalIndex, *args ):
items = cmds.textScrollList( globalInfo.meshInfoInst._selMeshList, q=1, ai=1 )
if not items: return None
nodeName = amCmd.getBlendAndFixedShapeNode( items[0] )
targetName, driverInfo, returnIndex = amCmd.addMirrorTarget( items[0], logicalIndex )
cmds.setParent( self._scrollLay )
cmds.rowColumnLayout( nc=3, cw=[(1,25),(2,self._mainWidthList[0]-30),(3,self._mainWidthList[1]-30) ] )
cmds.button( l="X", c= partial( self.removeBlendMeshInfoElement, nodeName, logicalIndex ) )
meshNameField = cmds.textField( tx=targetName.replace( items[0]+'_', '' ), cc=partial( self.meshNameChangeCmd, nodeName, returnIndex ) )
self._meshNameList.append( meshNameField )
cmds.popupMenu( markingMenu = 1 )
cmds.menuItem( l='Edit Anim Curve', rp='W', c=partial( self.editAnimCurveCmd, nodeName, returnIndex ) )
cmds.menuItem( l='Edit Mesh',rp='N', c=partial( self.editAssigned, returnIndex) )
cmds.menuItem( l='Add Mirror Mesh',rp='E', c=partial( self.addMirrorMeshCmd, returnIndex) )
cmds.menuItem( l='Select Delta Points', rp='S', c=partial( self.selectDeltaPointsCmd, items[0], logicalIndex ) )
widthList = uifnc.setWidthByPerList( [50,50], self._mainWidthList[1] )
cmds.rowColumnLayout( nc=2, cw=[(1,widthList[0]),(2,widthList[1]-30)] )
for element in driverInfo:
engleName, value1, value2, value3= element
cmds.text( l= engleName )
cmds.floatFieldGrp( precision=2, nf=3, cw3=[50,50,50], v1=value1, v2=value2, v3=value3 )
cmds.setParent( '..' )
示例7: getSVFSsetting
def getSVFSsetting():
posX = 0
posY = 0
posZ = 0
if mc.checkBoxGrp("cBG_plus", q=True, value1=True):
posX = 1
elif mc.checkBoxGrp("cBG_minus", q=True, value1=True):
posX = -1
elif mc.checkBox("cB_Extra", q=True, value=True):
posX = mc.floatFieldGrp("fFG_Extra", q=True, value1=True)
if mc.checkBoxGrp("cBG_plus", q=True, value2=True):
posY = 1
elif mc.checkBoxGrp("cBG_minus", q=True, value2=True):
posY = -1
elif mc.checkBox("cB_Extra", q=True, value=True):
posY = mc.floatFieldGrp("fFG_Extra", q=True, value2=True)
if mc.checkBoxGrp("cBG_plus", q=True, value3=True):
posZ = 1
elif mc.checkBoxGrp("cBG_minus", q=True, value3=True):
posZ = -1
elif mc.checkBox("cB_Extra", q=True, value=True):
posZ = mc.floatFieldGrp("fFG_Extra", q=True, value3=True)
kmSelectVtxFromSide(mc.ls(sl=True, fl=True), [posX, posY, posZ])
return
示例8: softDeformerUI
def softDeformerUI():
"""UI for the whole thing"""
if cmds.window("softModWin", exists = True):
cmds.deleteUI("softModWin")
widgets["window"] = cmds.window("softModWin", t="zbw_softDeformer", w=300, h=130)
widgets["tabLO"] = cmds.tabLayout()
widgets["smCLO"] = cmds.columnLayout("SoftModDeformer", w=300)
cmds.separator(h=10)
widgets["smdTFG"] = cmds.textFieldGrp(l="Deformer Name", w=300, cw=[(1,100),(2,190)], cal=[(1,"left"), (2, "left")], tx="softMod_DEF")
widgets["firstVertCBG"] = cmds.checkBoxGrp(l="Use only 1st vert (vs. avg pos)", v1=0, cw=[(1,200)], cal=[(1,"left"), (2,"left")])
widgets["parentCBG"] = cmds.checkBoxGrp(l="Parent Ctrl Under Geo?", v1=0, cw=[(1,200)], cal=[(1,"left"), (2,"left")])
widgets["incrCBG"] = cmds.checkBoxGrp(l="Increment name after creation?", v1=1, cw=[(1,200)], cal=[(1,"left"), (2,"left")])
widgets["checkCBG"] = cmds.checkBoxGrp(l="AutoCheck if there are deformers?", v1=1, cw=[(1,200)], cal=[(1,"left"), (2,"left")])
widgets["scaleFFG"] = cmds.floatFieldGrp(l="Control Scale", v1=1, pre=2, cw=[(1,100),(2,50)], cal=[(1,"left"),(2,"left")])
cmds.separator(h=10, style="single")
widgets["button"] = cmds.button(l="Create Deformer", w=300, h=40, bgc=(.6,.8,.6), c=softModDeformerDo)
#second tab to softselect deformer
cmds.setParent(widgets["tabLO"])
widgets["ssCLO"] = cmds.columnLayout("SoftSelectDeformer", w=300)
widgets["ssdTFG"] = cmds.textFieldGrp(l="Deformer Name", w=300, cw=[(1,100),(2,190)], cal=[(1,"left"), (2, "left")], tx="softSelect_DEF")
widgets["ssCPOMCBG"] = cmds.checkBoxGrp(l="Control to closest point on mesh?", v1=1, cw=[(1,200)], cal=[(1,"left"), (2,"left")])
widgets["ssParentCBG"] = cmds.checkBoxGrp(l="Parent Ctrl Under Geo?", v1=0, cw=[(1,200)], cal=[(1,"left"), (2,"left")])
widgets["ssIncrCBG"] = cmds.checkBoxGrp(l="Increment name after creation?", v1=1, cw=[(1,200)], cal=[(1,"left"), (2,"left")])
widgets["ssCheckCBG"] = cmds.checkBoxGrp(l="AutoCheck if there are deformers?", v1=1, cw=[(1,200)], cal=[(1,"left"), (2,"left")])
widgets["ssScaleFFG"] = cmds.floatFieldGrp(l="Control Scale", v1=1, pre=2, cw=[(1,100),(2,50)], cal=[(1,"left"),(2,"left")])
cmds.separator(h=10, style="single")
widgets["button"] = cmds.button(l="Create Deformer", w=300, h=40, bgc=(.6,.8,.6), c=softSelectDef)
cmds.showWindow(widgets["window"])
示例9: doOptions
def doOptions(input_width, input_divisionsType, input_divisions, input_divisionsPerUnit, input_taper, input_frontTwist, input_lengthTwist, input_upVector, input_uvScale, input_uvScaleType, input_uvPinLocation):
"""This is the function called when the apply or create button is clicked"""
try:
utils.dg.validateSelection(type='transform', min=1)
curves = utils.dg.getFilteredRelatives(cmds.ls(sl=True), 'nurbsCurve', False)
if len(curves) is 0: raise Exception('None of the objects you have selected are NURBS curves.')
# call the command
if cmds.radioButtonGrp(input_divisionsType, q=True, select=True) == 1:
cmds.am_ribbon(
width = cmds.floatSliderGrp(input_width, q=True, v=True),
divisions = cmds.floatSliderGrp(input_divisions, q=True, v=True),
taper = cmds.floatSliderGrp(input_taper, q=True, v=True),
twistBase = cmds.floatSliderGrp(input_frontTwist, q=True, v=True),
twistLength = cmds.floatSliderGrp(input_lengthTwist, q=True, v=True),
upVector = cmds.floatFieldGrp(input_upVector, q=True, v=True),
uvScale = cmds.floatSliderGrp(input_uvScale, q=True, v=True),
uvGroupScale = cmds.radioButtonGrp(input_uvScaleType, q=True, select=True) - 1,
uvPin = cmds.radioButtonGrp(input_uvPinLocation, q=True, select=True) - 1)
else:
cmds.am_ribbon(
width = cmds.floatSliderGrp(input_width, q=True, v=True),
divisionsPerUnit = cmds.floatSliderGrp(input_divisionsPerUnit, q=True, v=True),
taper = cmds.floatSliderGrp(input_taper, q=True, v=True),
twistBase = cmds.floatSliderGrp(input_frontTwist, q=True, v=True),
twistLength = cmds.floatSliderGrp(input_lengthTwist, q=True, v=True),
upVector = cmds.floatFieldGrp(input_upVector, q=True, v=True),
uvScale = cmds.floatSliderGrp(input_uvScale, q=True, v=True),
uvGroupScale = cmds.radioButtonGrp(input_uvScaleType, q=True, select=True) - 1,
uvPin = cmds.radioButtonGrp(input_uvPinLocation, q=True, select=True) - 1)
except: raise
示例10: prefPut
def prefPut(self):
cmds.checkBox(self.c2, e=True, v=self.prefs['BkRmvCon'])
cmds.checkBox(self.c3, e=True, v=self.prefs['BkTmRng'])
cmds.checkBox(self.c4, e=True, v=self.prefs['BkAllFrms'])
cmds.checkBox(self.c7, e=True, v=self.prefs['LocTrns'])
cmds.checkBox(self.c8, e=True, v=self.prefs['LocRot'])
cmds.checkBox(self.c12, e=True, v=self.prefs['LocAllFrms'])
cmds.checkBox(self.c17, e=True, v=self.prefs['PrntRgPosOnly'])
cmds.checkBox(self.c15, e=True, v=self.prefs['AimRgNegAim'])
cmds.radioButtonGrp(self.aimGrp, e=True, select=self.prefs['AimRgAim'])
cmds.checkBox(self.c16, e=True, v=self.prefs['AimRgNegUp'])
cmds.radioButtonGrp(self.upGrp, e=True, select=self.prefs['AimRgUp'])
cmds.checkBox(self.c18, e=True, v=self.prefs['PvtRgNegAim'])
cmds.radioButtonGrp(self.aimPivotGrp, e=True, select=self.prefs['PvtRgAim'])
cmds.checkBox(self.c19, e=True, v=self.prefs['PvtRgNegUp'])
cmds.radioButtonGrp(self.upPivotGrp, e=True, select=self.prefs['PvtRgUp'])
cmds.checkBox(self.c21, e=True, v=self.prefs['PvtRgMstr'])
cmds.radioButtonGrp(self.masterGrp, e=True, select=self.prefs['PvtRgMstrSl'])
cmds.radioButtonGrp(self.masterGrp, e=True, en=self.prefs['PvtRgMstrEnbl'])
cmds.checkBox(self.c22, e=True, v=self.prefs['PvtRgAutoDstnc'])
cmds.floatSliderGrp(self.sl1, e=True, v=self.prefs['PvtRgDstnc'])
cmds.floatSliderGrp(self.sl1, e=True, en=self.prefs['PvtRgDstncEnbl'])
cmds.checkBox(self.c21, e=True, v=self.prefs['LcAllFrms'])
cmds.checkBox(self.c5, e=True, v=self.prefs['PlcCon'])
cmds.radioButtonGrp(self.conGrp, e=True, select=self.prefs['PlcConTo'])
cmds.radioButtonGrp(self.conGrp, e=True, en=self.prefs['PlcConToEnbl'])
cmds.checkBox(self.c13, e=True, v=self.prefs['PlcMtchKys'])
cmds.checkBox(self.c9, e=True, v=self.prefs['ConOffst'])
cmds.checkBox(self.c10, e=True, v=self.prefs['ConTrns'])
cmds.checkBox(self.c11, e=True, v=self.prefs['ConRot'])
cmds.intField(self.actionField1, e=True, v=self.prefs['DstKys'])
cmds.checkBox(self.c14, e=True, v=self.prefs['DstKysDstrct'])
cmds.floatFieldGrp(self.floatGroup1, e=True, v=self.prefs['ObjctSpaceOffst'])
示例11: doOptions
def doOptions(input_referenceObject, input_rotateOrder, input_axis, input_referenceAxis, input_normalizeAxes):
"""This is the function called when the apply or create button is clicked"""
try:
# validate selection
utils.dg.validateSelection(type='transform', exact=1)
# validate reference object
referenceObject = cmds.textFieldGrp(input_referenceObject, q=True, tx=True)
if len(referenceObject) > 0: utils.dg.verifyNode(referenceObject)
# call the command
if len(referenceObject) > 0:
cmds.am_exposeTransform(
ref=referenceObject,
ro=utils.kRotateOrderMapping[cmds.optionMenuGrp(input_rotateOrder, q=True, v=True)],
a=cmds.floatFieldGrp(input_axis, q=True, v=True),
ra=cmds.floatFieldGrp(input_referenceAxis, q=True, v=True),
na=cmds.checkBoxGrp(input_normalizeAxes, q=True, v1=True))
else:
cmds.am_exposeTransform(
ro=utils.kRotateOrderMapping[cmds.optionMenuGrp(input_rotateOrder, q=True, v=True)],
a=cmds.floatFieldGrp(input_axis, q=True, v=True),
ra=cmds.floatFieldGrp(input_referenceAxis, q=True, v=True),
na=cmds.checkBoxGrp(input_normalizeAxes, q=True, v1=True))
except: raise
示例12: doOptions
def doOptions(input_suffix, input_numberTwistJoints, input_pelvis, input_hipAimAxis, input_hipFrontAxis, input_pelvisAimAxis, input_pelvisFrontAxis):
"""Specifies the function called when the apply or create button is clicked"""
try:
# validate selection
selection = utils.dg.validateSelection(type='transform', name='knee joint objects', min=1)
# validate suffix
suffix = cmds.textFieldGrp(input_suffix, q=True, tx=True)
utils.dg.validateAffix(suffix)
# validate pelvis
pelvis = cmds.textFieldGrp(input_pelvis, q=True, tx=True)
utils.dg.verifyNode(pelvis)
# set up the hip
numberTwistJoints = cmds.intSliderGrp(input_numberTwistJoints, q=True, v=True)
newSelection = []
# perform setup for each knee in the selection
for knee in selection:
hip = cmds.listRelatives(knee, p=True, f=True)
hipShort = cmds.listRelatives(knee, p=True)
newJoints = doSetup(
hipShort[0] + suffix,
numberTwistJoints,
knee,
hip[0],
pelvis,
cmds.floatFieldGrp(input_hipAimAxis, q=True, v=True),
cmds.floatFieldGrp(input_hipFrontAxis, q=True, v=True),
cmds.floatFieldGrp(input_pelvisAimAxis, q=True, v=True),
cmds.floatFieldGrp(input_pelvisFrontAxis, q=True, v=True))
newSelection += newJoints
# select the newly created joints for easy editing
cmds.select(newSelection)
except: raise
示例13: manualScale
def manualScale(*args):
"""uses the float field group to manually scale the object by that amount"""
origScale = cmds.floatFieldGrp(widgets["trackerFFG"], q=True, v1=True)
#get value from field
scalePer = cmds.floatFieldGrp(widgets["scaleFFG"] , q=True, v1=True)
scaleVal = scalePer/100
#scaleShapes
sel = cmds.ls(sl=True, type="transform")
if sel:
for obj in sel:
#decide on object type
objShape = cmds.listRelatives(obj, s=True)
shapeType = cmds.objectType(objShape)
cmds.select(cl=True)
if shapeType == "nurbsSurface" or shapeType == "nurbsCurve":
#get the components
cvs = cmds.select((obj + ".cv[*]"))
cmds.scale(scaleVal, scaleVal, scaleVal)
elif shapeType == "mesh":
#get the components
cvs = cmds.select((obj + ".vtx[*]"))
cmds.scale(scaleVal, scaleVal, scaleVal)
else:
cmds.warning("%s isn't a nurbs or poly object, so it was skipped")
#clear and reselect all
if sel:
cmds.select(cl=True)
cmds.select(sel)
newScale = origScale * scaleVal
cmds.floatFieldGrp(widgets["trackerFFG"], e=True, v1=newScale)
示例14: origScale
def origScale(*args):
"""scales the object by the inverse of the currentScale (as measured by the tracker floatfield). So if everything was reset when you started it will
undo all subsequent scaling operations"""
currScale = cmds.floatFieldGrp(widgets["trackerFFG"], q=True, v1=True)
scaleVal = 100/currScale
# print "%s = factor"%factor
# scaleVal = currScale * factor/100
cmds.floatFieldGrp(widgets["trackerFFG"], e=True, v1=scaleVal*currScale)
sel = cmds.ls(sl=True, type="transform")
if sel:
for obj in sel:
#decide on object type
objShape = cmds.listRelatives(obj, s=True)
shapeType = cmds.objectType(objShape)
cmds.select(cl=True)
if shapeType == "nurbsSurface" or shapeType == "nurbsCurve":
#get the components
cvs = cmds.select((obj + ".cv[*]"))
cmds.scale(scaleVal, scaleVal, scaleVal)
elif shapeType == "mesh":
#get the components
cvs = cmds.select((obj + ".vtx[*]"))
cmds.scale(scaleVal, scaleVal, scaleVal)
else:
cmds.warning("%s isn't a nurbs or poly object, so it was skipped")
#clear and reselect all
if sel:
cmds.select(cl=True)
cmds.select(sel)
cmds.floatFieldGrp(widgets["scaleFFG"], e=True, v1=scaleVal*100)
示例15: __init__
def __init__(self) :
#check to see if the window exists:
if cmds.window("Box2DTool", exists = True):
cmds.deleteUI("Box2DTool")
#create the window:
window = cmds.window("Box2DTool", title = 'Box2D Tool', sizeable = False)
#create the main layout:
cmds.columnLayout(columnWidth = 300, adjustableColumn = False, columnAttach = ('both', 10))
#make dockable:
allowedAreas = ['right', 'left']
cmds.dockControl( 'Box2D Tool', area='left', content=window, allowedArea=allowedAreas )
self.dim=cmds.floatFieldGrp('dim', numberOfFields=2, label='Dimension', extraLabel='pixel', value1=5, value2=1 )
self.dim=cmds.floatFieldGrp('friction', numberOfFields=1, label='Friction', value1=0.2 )
self.dim=cmds.floatFieldGrp('restitution', numberOfFields=1, label='restitution', value1=0.0 )
self.dim=cmds.floatFieldGrp('density', numberOfFields=1, label='density', value1=0.0 )
cmds.separator()
self.dim=cmds.floatFieldGrp('rotation', numberOfFields=1, label='rotation', value1=0.0 )
cmds.separator()
cmds.optionMenuGrp( "bodyType",l='Body Type' )
cmds.menuItem(label='b2_staticBody');
cmds.menuItem(label='b2_kinematicBody');
cmds.menuItem(label='b2_dynamicBody');
cmds.button(label = "PlaceBlock", w = 100, h = 25, c = self.placeBlock)
cmds.separator()
cmds.button( label='Export', command=self.export )