本文整理汇总了Python中maya.cmds.floatField函数的典型用法代码示例。如果您正苦于以下问题:Python floatField函数的具体用法?Python floatField怎么用?Python floatField使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了floatField函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: arcDoubCurveUI
def arcDoubCurveUI(self,state):
'''
Creates the UI containing options to create an Archimedes spiral that spirals out then in again
Initialises the following variables
self.loops : Number of complete rotations the spiral should have
self.gap : Size of the gaps between successive turnings
self.height : The vertical height of the spiral
self.spiralIn : The direction of the generated curve
'''
if state == 1:
self.tempFrame3 = cmds.rowColumnLayout(numberOfColumns=1,parent=self.curveOptionsFrame)
cmds.frameLayout(label='Spiral',cll=1)
cmds.rowColumnLayout(numberOfColumns=2,cs=[(1,5),(2,5)],cw=[(1,350),(2,118)],cal=[(1,'right'),(2,'left')])
cmds.text(label='Number of Loops')
self.loops = cmds.floatField(minValue=0,width=60,pre=1,v=2)
cmds.text(label='Gap Between Rings')
self.gap = cmds.floatField(minValue=0,width=60,pre=3,v=1)
cmds.text(label='Height')
self.height = cmds.floatField(width=60,pre=3,v=8)
cmds.text(label='Curve Direction')
self.spiralIn = 0
cmds.checkBox(label='Downwards',v=0,cc=self.spiralToggle)
cmds.setParent('..')
cmds.setParent('..')
cmds.button(label='Generate',width=100,c=self.runArcDoubCurve)
cmds.setParent('..')
else:
cmds.deleteUI(self.tempFrame3)
示例2: logCurveUI
def logCurveUI(self,state):
'''
Creates the UI containing options to create a logarithmic spiral
Initialises the following variables
self.loops : Number of complete rotations the spiral should have
self.growth : Growth factor
self.height : The vertical height of the spiral
self.spiralIn : The direction of the generated curve
'''
if state == 1:
self.tempFrame1 = cmds.rowColumnLayout(numberOfColumns=1,parent=self.curveOptionsFrame)
cmds.frameLayout(label='Spiral',cll=1)
cmds.rowColumnLayout(numberOfColumns=2,cs=[(1,5),(2,5)],cw=[(1,350),(2,118)],cal=[(1,'right'),(2,'left')])
cmds.text(label='Number of Loops')
self.loops = cmds.floatField(minValue=0,width=60,pre=1,v=2)
cmds.text(label='Growth Factor')
self.growth = cmds.floatField(minValue=0,width=60,pre=3,v=0.4)
cmds.text(label='Height')
self.height = cmds.floatField(width=60,pre=3)
cmds.text(label='Curve Direction')
self.spiralIn = 1
cmds.checkBox(label='Inwards',v=1,cc=self.spiralToggle)
cmds.setParent('..')
cmds.setParent('..')
cmds.button(label='Generate',width=100,c=self.runLogCurve)
cmds.setParent('..')
else:
cmds.deleteUI(self.tempFrame1)
示例3: runHypCurve
def runHypCurve(self,state):
'''
Executes the code to make a hyperbolic spiral using the variables defined in snowflakeUI.hypCurveUI
'''
curves.hyperbolic(cmds.floatField(self.loops,v=1,q=1),
self.spiralIn,
cmds.floatField(self.height,v=1,q=1))
示例4: loadAttrVal
def loadAttrVal( fld, val, mult ):
'''
Load the value of the selected attr into the floatField
'''
try: # run code, but catch errors
# list first selected item into variable
selItem = cmds.ls( sl=True )
# list first selected attribute into variable
selAttr = cmds.channelBox( 'mainChannelBox', q=True, sma=True )
# query value of selected attr in channelBox
attrVal = cmds.getAttr("%s.%s" %(selItem[0], selAttr[0]) )
# edit the floatField to the attr value, multiplied by 1 or -1
cmds.floatField( '%sFltFld%s' %( fld, val ), e=True, v=attrVal*mult )
except TypeError:
OpenMaya.MGlobal.displayWarning( "Please select an attribute from the channel box." )
except IndexError:
OpenMaya.MGlobal.displayWarning( "Please select an attribute from the channel box." )
示例5: export
def export( *args ):
import sgBExcute_data
import sgBFunction_fileAndPath
WinA_Cmd.write_windowInfo()
path = cmds.textField( WinA_Global.exportPath_txf, q=1, tx=1 )
if not os.path.exists( path ):
try:
sgBFunction_fileAndPath.makeFolder( path )
except:
cmds.error( '"%s" is not exist path' % path )
return None
if not os.path.isdir( path ):
cmds.error( '"%s" is not Directory' % path )
return None
path = cmds.textField( WinA_Global.exportPath_txf, q=1, tx=1 )
startFrame = cmds.floatField( WinA_Global.fld_startFrame, q=1, v=1 )
endFrame = cmds.floatField( WinA_Global.fld_endFrame, q=1, v=1 )
step = cmds.floatField( WinA_Global.fld_step, q=1, v=1 )
exportTargets = sgBFunction_selection.getDeformedObjectsFromGroup( WinA_Cmd.getExportTargets() )
cacheTypeIndex = cmds.optionMenu( WinA_Global.om_cacheType, q=1, sl=1 )-1
pointsSpaceIndex = cmds.optionMenu( WinA_Global.om_pointsSpace, q=1, sl=1 )-1
cacheType = ['mcc', 'mcx']
pointsSpace = ['world', 'local']
if not exportTargets:
cmds.error( 'Target is not exists' )
else:
sgBExcute_data.exportCacheData( exportTargets, startFrame, endFrame, step, path, cacheType[cacheTypeIndex], pointsSpace[pointsSpaceIndex] )
示例6: _showUI
def _showUI(self):
if cmds.window(self.win, exists=True):
cmds.deleteUI(self.win, window=True)
cmds.window(self.win, title=self.win, widthHeight=(400, 220))
cmds.columnLayout('uicl_audioMain',adjustableColumn=True)
cmds.separator(h=15, style='none')
cmds.text(l='Select Audio to Offset')
cmds.separator(h=15, style='in')
cmds.rowColumnLayout(numberOfColumns=3, columnWidth=[(1, 100), (2, 90), (3, 100)])
cmds.button(label='<< Offset',
ann='Nudge selected Audio Backwards',
command=partial(self.offsetSelectedBy,'negative'))
cmds.floatField('AudioOffsetBy', value=10)
cmds.button(label='Offset >>',
ann='Nudge selected Audio Forwards',
command=partial(self.offsetSelectedBy,'positive'))
cmds.setParent('..')
cmds.separator(h=15, style='in')
cmds.rowColumnLayout(numberOfColumns=2, columnWidth=[(1, 200), (2, 90)])
cmds.button(label='Offset Range to Start at:',
ann='offset the selected range of audionodes such that they start at the given frame',
command=self.offsetSelectedTo)
cmds.floatField('AudioOffsetToo', value=10)
cmds.setParent('..')
cmds.separator(h=15, style='in')
cmds.button(label='Ripple selected',
ann="Ripple offset the selected audio nodes so they're timed one after another",
command=self.offsetRipple)
cmds.separator(h=15, style='none')
cmds.iconTextButton(style='iconOnly', bgc=(0.7, 0, 0), image1='Rocket9_buttonStrap2.bmp',
c=lambda *args: (r9Setup.red9ContactInfo()), h=22, w=200)
cmds.showWindow(self.win)
cmds.window(self.win, e=True, widthHeight=(290, 190))
示例7: editHeight
def editHeight( *args ):
if not cmds.checkBox( Window_global.check_linkWh, q=1, v=1 ): return None
aspectRatio = float( Window_global.imgWidth ) / float( Window_global.imgHeight )
height = cmds.floatField( Window_global.floatf_planeHeight, q=1, v=1 )
width = height / aspectRatio
cmds.floatField( Window_global.floatf_planeWidth, e=1, v=width )
示例8: runFlakeGen
def runFlakeGen(self,state):
'''
Executes the code to generate snowflakes and starts the progress window using the variables defined in snowflakeUI.flakeGenUI and starts the progress window
'''
cmds.progressWindow(title='SnowFX',
progress=0,
status='Starting up...')
try:
particles=makeSnowflakes.makeSnowflakes(cmds.intField(self.flakeNumber,v=1,q=1),
cmds.floatField(self.flakeRadius,v=1,q=1),
cmds.intField(self.flakeRadiusVar,v=1,q=1),
cmds.canvas(self.colour1,rgb=1,q=1),
cmds.canvas(self.colour2,rgb=1,q=1),
cmds.floatField(self.transparency,v=1,q=1),
cmds.floatField(self.glow,v=1,q=1))
for i in range(0,len(particles)):
cmds.move(0,0,cmds.floatField(self.flakeRadius,v=1,q=1)*2*i,particles[i])
group = cmds.group(em=1,n='snowFX')
for x in particles:
cmds.parent(x,group)
cmds.progressWindow(ep=1)
except Exception, err:
sys.stderr.write('ERROR: %s\n' % str(err))
cmds.progressWindow(ep=1)
errorPopup('Something went wrong :( \n Check the script editor for detials')
示例9: refreshFloatField
def refreshFloatField(self, *args ):
timeControl = cmds.textScrollList( self._timeControl, q=1, si=1 )
if not timeControl: return None
timeControl = timeControl[-1]
weight = cmds.getAttr( timeControl+'.weight' )
offset = cmds.getAttr( timeControl+'.offset' )
mult = cmds.getAttr( timeControl+'.mult' )
limitAble = cmds.getAttr( timeControl+'.limitAble' )
minTime = cmds.getAttr( timeControl+'.minTime' )
maxTime = cmds.getAttr( timeControl+'.maxTime' )
cmds.floatField( self._weight, e=1, v=weight )
cmds.floatField( self._offset, e=1, v=offset )
cmds.floatField( self._mult, e=1, v=mult )
cmds.checkBox( self._limitAble, e=1, v=limitAble )
cmds.floatField( self._minTime, e=1, v=minTime )
cmds.floatField( self._maxTime, e=1, v=maxTime )
if cmds.checkBox( self._limitAble, q=1, v=1 ):
cmds.rowColumnLayout( self._limitAbleLay, e=1, en=1 )
else:
cmds.rowColumnLayout( self._limitAbleLay, e=1, en=0 )
for popup in self._popupList:
popup.updateCondition()
示例10: export
def export( *args ):
import sgBExcute_data
import sgBFunction_fileAndPath
WinA_Cmd.write_windowInfo()
path = cmds.textField( WinA_Global.exportPath_txf, q=1, tx=1 )
if not os.path.exists( path ):
try:
sgBFunction_fileAndPath.makeFolder( path )
except:
cmds.error( '"%s" is not exist path' % path )
return None
if not os.path.isdir( path ):
cmds.error( '"%s" is not Directory' % path )
return None
path = cmds.textField( WinA_Global.exportPath_txf, q=1, tx=1 )
startFrame = cmds.floatField( WinA_Global.fld_startFrame, q=1, v=1 )
endFrame = cmds.floatField( WinA_Global.fld_endFrame, q=1, v=1 )
step = cmds.floatField( WinA_Global.fld_step, q=1, v=1 )
exportTargets = WinA_Cmd.getExportTargets()
exportByMatrix = cmds.checkBox( WinA_Global.chk_exportByMatrix, q=1, v=1 )
if not exportTargets:
cmds.error( 'Target is not exists' )
else:
sgBExcute_data.exportSgKeyData( exportTargets, startFrame, endFrame, step, path, exportByMatrix )
示例11: show
def show( self ) :
oSrch = 'LFT'
oRep = 'RGT'
oMul = 0
if mc.window( self.win , exists=True ) :
oSrch = mc.textField( '%sSrchTF'%self.ui , q=True , tx=True )
oRep = mc.textField( '%sRepTF'%self.ui , q=True , tx=True )
oMul = mc.floatField( '%sMultFF'%self.ui , q=True , v=True )
mc.deleteUI( self.win )
mc.window( self.win , t='pkWeightPuller' , rtf=True )
mc.columnLayout( '%sMainCL'%self.ui , adj=True )
mc.text( l='Search for' , align='center' )
mc.textField( '%sSrchTF'%self.ui , tx=oSrch )
mc.text( l='Replace with' , align='center' )
mc.textField( '%sRepTF'%self.ui , tx=oRep )
mc.button( '%sSwapBUT'%self.ui , l='Swap' , c=partial( self.swap ) )
mc.floatField( '%sMultFF'%self.ui , minValue=0 , maxValue=1 , v=oMul )
mc.button( '%sBUT'%self.ui , l='Pull' , c=partial( self.pull ) )
mc.showWindow( self.win )
mc.window( self.win , e=True , w=180 )
mc.window( self.win , e=True , h=180 )
示例12: create
def create(self):
form = cmds.formLayout()
text1 = cmds.text( l= self.label1, w=self.width1, h=self.height, al='right' )
text2 = cmds.text( l= self.label2, w=self.width1, h=self.height, al='right' )
text3 = cmds.text( l= self.label3, w=self.width1-10, h=self.height, al='right' )
field1 = cmds.floatField( w=self.width2, h=self.height, step=0.25, pre=2 )
field2 = cmds.floatField( w=self.width2, h=self.height, step=0.25, pre=2 )
field3 = cmds.floatField( w=self.width2, h=self.height, step=0.25, pre=2, v=1 )
cmds.setParent( '..' )
cmds.formLayout( form, e=1,
af=[( text1, 'top', 0 ), ( text1, 'left', 0 ),
( text2, 'top', 0 ),
( text3, 'top', 0 )],
ac=[( field1, 'left', 0, text1 ), ( text2, 'left', 0, field1 ),
( field2, 'left', 0, text2 ), ( text3, 'left', 0, field2 ),
( field3, 'left', 0, text3 )])
WinA_Global.fld_startFrame = field1
WinA_Global.fld_endFrame = field2
WinA_Global.fld_step = field3
self.form = form
return form
示例13: create
def create(self):
if cmds.window( self.winName, ex=1 ):
cmds.deleteUI( self.winName, wnd=1 )
cmds.window( self.winName, title=self.title )
cmds.columnLayout()
cmds.rowColumnLayout( nc=1, cw=(1,305))
cmds.text( l='', h=5 )
cmds.button( l='Create Pattern Base', h=28, c= WinA_Cmd.cmdCreatePatternBase )
cmds.text( l='', h=5 )
cmds.setParent( '..' )
cmds.rowColumnLayout( nc=4, cw=[(1,100), (2,50), (3,100), (4,50)])
cmds.text( l=' Pattern Size : ' )
WinA_Global.ff_patternSize = cmds.floatField( v=0.5, min=0.1 )
cmds.text( l=' Offset Mult : ' )
WinA_Global.ff_offsetMult = cmds.floatField( v=0.64, min=0.25 )
cmds.setParent( '..' )
cmds.rowColumnLayout( nc=1, cw=(1,305))
cmds.text( l='', h=10 )
cmds.button( l='Create Pattern( pattern base, surface )', h=28, c= WinA_Cmd.cmdCreatePattern )
cmds.text( l='', h=2 )
cmds.setParent( '..' )
cmds.rowColumnLayout( nc=1, cw=(1,305))
cmds.button( l='Update Pattern( pattern base )', h=28, c= WinA_Cmd.cmdUpdatePattern )
cmds.text( l='', h=5 )
cmds.setParent( '..' )
cmds.window( self.winName, e=1, wh=[ WinA_Global.width, WinA_Global.height ])
cmds.showWindow( self.winName )
示例14: stabilizer
def stabilizer ():
global _camera_
_point = cmds.ls (selection = True)
if cmds.objExists ('stabilizator_expression') == False and len(_point) > 0:
_camera_ = Camera()
_point = _point[0]
if (cmds.nodeType (_point) == 'mesh' or cmds.nodeType (_point) == 'transform') and _camera_.transform != 'empty':
_expression = r'''
$pos=`python "fmmu.get_normalized_screen_position(\"''' + _point + r'''\")"`;
setAttr "''' + _camera_.shape + r'''.horizontalFilmOffset" $pos[2];
setAttr "''' + _camera_.shape + r'''.verticalFilmOffset" $pos[3];'''
print "=================================="
print _expression
cmds.expression (name = 'stabilizator_expression', string = _expression)
cmds.frameLayout ('adjustCam_frml', edit = True, visible = True)
cmds.symbolButton ('button_stabilizer', edit = True, image = 'ford_matchMoveUtilities__deStabilize.xpm', annotation = 'deStabilizer')
cmds.floatField ('field_overscan', edit = True, value = _camera_.overscan)
else:
if cmds.objExists ('stabilizator_expression') == True:
cmds.delete ('stabilizator_expression')
cmds.symbolButton ('button_stabilizer', edit = True, image = 'ford_matchMoveUtilities__stabilize.xpm', annotation = 'deStabilizer')
cmds.frameLayout ('adjustCam_frml', edit = True, collapse = True, visible = False)
try:
_camera_.reset_camera()
except:
pass
示例15: clip_plane_creator
def clip_plane_creator(*args):
gui = 'clipPlaneCreator'
if cmds.window(gui, q=1, ex=1):
cmds.deleteUI(gui)
cmds.window(gui,t="Clip Plane Creator v1.0")
cmds.columnLayout(adjustableColumn = True)
# Get perspective camera (Not orthographic)
cms = cmds.ls(typ="camera")
cm_list = []
cmt = lambda x:cmds.listRelatives(x, p=True) # get camera's transform node
cm_list = filter(lambda x:not(cmds.getAttr(x+".orthographic")), cms) # if orthographic is true, doesn't append "cm_list var"
cm_list = cmt(cm_list)
cmds.button('cam_list', l = "Camera List", h = 30,bgc=(0.4,0.4,1), c=clip_plane_creator )
cmds.textScrollList('cam_sel',append = cm_list,ams=False , h = 180)
cmds.separator()
cmds.rowColumnLayout(numberOfColumns = 4)
cmds.text("Near Dist:",w = 60)
cmds.floatField('vNear', v = 10,width = 60)
cmds.text("Far Dist:", w= 60)
cmds.floatField('vFar', v = 100, w= 60)
cmds.setParent("..")
cmds.button('bCreatePlane', label = "Create Clip Plane", width = 200, c = c_plane)
cmds.window(gui, e=1, width=240, height = 120)
cmds.showWindow(gui)