Beispiel #1
0
    def __init__(self, attrName, width ):
        
        width = width
        deltaName = cmds.getAttr( attrName+'.deltaName' )
        value = cmds.getAttr( attrName+'.weight' )
        
        nameWidth  = 140
        fieldWidth = 70
        sliderWidth = width - nameWidth - fieldWidth 
        self._row  = cmds.rowColumnLayout( nc=3, cw=[(1,nameWidth),(2,fieldWidth),(3,sliderWidth)], 
                                           co=[(1,'left',8 ), (2,'right',5)], h=30 )
        self._textRow = cmds.rowColumnLayout( nc=1, cw=[(1,nameWidth-15)] )
        self._textRowPopup = cmds.popupMenu( mm=1 )
        self._text = cmds.text( al='left', h=20 )
        cmds.setParent( '..' )
        self._field = cmds.floatField( min=0.0, max=1.0 )
        self._fieldPopup = cmds.popupMenu()
        self._slider = cmds.floatSlider( min=0.0, max=1.0 )
        cmds.setParent( '..' )
        
        cmds.text( self._text, e=1, l=deltaName )
        cmds.floatField( self._field, e=1, v=value )
        cmds.floatSlider( self._slider, e=1, v=value )

        self._dragStart = False
        self._keepValue = 0.0
        self._attrName = attrName
        
        cmds.menuItem( l='Select Anim Curve', rp='W', c= self.selectAnimCurveCmd, p=self._textRowPopup )
        cmds.menuItem( l='Change Name', rp='E', c= self.changeNameMoveCmd, p=self._textRowPopup )
        cmds.menuItem( l='Delete Shape', rp='S', c= self.deleteShapeCmd, p=self._textRowPopup )
        #cmds.menuItem( l='Edit Mesh', rp='N', c=self.editMeshCmd, p=self._textRowPopup )
        
        cmds.menuItem( l='Set Key', c= self.setKeyCmd, p=self._fieldPopup )
        cmds.menuItem( l='Break Connection', c= self.breakConnectionCmd, p=self._fieldPopup )
Beispiel #2
0
def gui():
    if (cmds.window('dk_pipe_gui_001', ex=True)):
        cmds.deleteUI('dk_pipe_gui_001')
    # This clears any window preferences on our GUI
    if (cmds.windowPref('dk_pipe_gui_001', ex=True)):
        cmds.windowPref('dk_pipe_gui_001', r=True)

    cmds.window('dk_pipe_gui_001', t="Build Pipes")
    cmds.columnLayout('MAIN')
    cmds.rowColumnLayout(nc=2)

    cmds.iconTextStaticLabel(st='textOnly', l='No. Pipes')
    cmds.intField('n_pipes_int', w=150, min=1, max=20, v=8)

    cmds.iconTextStaticLabel(st='textOnly', l='Min Pipe Size')
    cmds.floatSlider('min_pipe_size_int', min=1, max=4, value=1, step=1)

    cmds.iconTextStaticLabel(st='textOnly', l='Max Pipe Size')
    cmds.floatSlider('max_pipe_size_int', min=1, max=4, value=1, step=1)

    cmds.iconTextStaticLabel(st='textOnly', l='Art Radius')
    cmds.intField('main_radius_int', value=3)

    cmds.button(w=150, l='Create Pipes', c=handle_input)

    cmds.setParent('MAIN')
    cmds.columnLayout('SECOND')
    cmds.button(w=300, l='Delete History (All)', c=handle_delete_button)

    cmds.showWindow('dk_pipe_gui_001')
Beispiel #3
0
def handle_input(*args):
    n_pipes_int = cmds.intField('n_pipes_int', q=True, v=True)
    min_pipe_size_int = cmds.floatSlider('min_pipe_size_int', q=True, v=True)
    max_pipe_size_int = cmds.floatSlider('max_pipe_size_int', q=True, v=True)
    main_radius = cmds.intField('main_radius_int', q=True, v=True)

    make_art(n_pipes=n_pipes_int, min_piped=min_pipe_size_int, max_piped=max_pipe_size_int,
             main_radius=main_radius)
Beispiel #4
0
    def __init__(s, i18n, char, requestCharEdit, requestClipEdit, sendRunClip):
        s.i18n = i18n
        s.char = char
        s.requestClipEdit = requestClipEdit # We're asking to edit the clip
        s.sendRunClip = sendRunClip # User wants to place the clip
        s.clips = [] # Init clips!
        name = s.char.metadata.get("name", "CLips").title()

        if not char.data: # Does the character contain nothing?
            with warn:
                requestCharEdit(char, s.refresh)

        s.winName = "%sWin" % name
        if cmds.window(s.winName, ex=True):
            cmds.deleteUI(s.winName)
        s.window = cmds.window(s.winName, rtf=True, s=False, t="%s %s" % (name, i18n["clips.title"]))
        cmds.columnLayout(adj=True)
        cmds.rowLayout(nc=2, adj=2) # Open Row
        cmds.iconTextButton(
            ann=i18n["clips.editChar"],
            style="iconOnly",
            font="boldLabelFont",
            image="goToBindPose.png",
            h=50,
            w=50,
            bgc=[0.3,0.3,0.3],
            c=lambda: requestCharEdit(s.char, s.refresh)
        )
        cmds.text(
            l="<h1>%s</h1>" % name,
            hl=True,
            h=50
            )
        cmds.setParent("..") # Close row
        cmds.columnLayout(adj=True) # Open Col
        cmds.button(
            l=i18n["clips.newClip"],
            h=50,
            c=lambda x: warn.run(requestClipEdit, s.char, s.refresh)
            )
        cmds.setParent("..") # Close row
        cmds.floatSlider(
            min=50,
            max=200,
            v=100,
            dc=s.sizeClips,
            h=20
            )
        cmds.separator()
        cmds.frameLayout(l=i18n["clips.moreInfo"], font="tinyBoldLabelFont")
        cmds.scrollLayout(cr=True, bgc=[0.2,0.2,0.2], h=400)
        s.wrapper = cmds.gridLayout(w=400, cwh=[100, 120], cr=True, aec=False)
        cmds.setParent("..") # Close grid
        cmds.setParent("..") # Close Scroll
        cmds.separator()
        cmds.showWindow(s.window)
        cmds.scriptJob(uid=[s.window, s.cleanup], ro=True)
        s.refresh()
def stereoPlayblastUI():
    global txtf
    global interaxialSleder
    global zeroSleder
    global win
    global interFloatField
    global interFloatSlider
    global zeroFloatField
    global zeroFloatSlider
    core = None
    Title = 'StereoPlayblastWin'
    cams = checkCam()
    heightB = len( cams )
    modifyWin = heightB*25
    #m = len( checkCam() )*25   
    if mc.windowPref('StereoPlayblastWin',exists=1):mc.windowPref('StereoPlayblastWin',remove=1)
    if mc.window('StereoPlayblastWin', exists=1):mc.deleteUI('StereoPlayblastWin')
    win = mc.window('StereoPlayblastWin', title = Title, wh=(470,220 + modifyWin))
    mc.scrollLayout( 'scrollLayout' )
    cl1 = mc.columnLayout( cat=( 'left', 3 ), cw=200, rs=5, adj=1  )
    mc.button( l='Creat 3D camera', c="stereoPlayblast.creatStereo();stereoPlayblast.winNewH( len( stereoPlayblast.checkCam() )*25 );stereoPlayblast.stereoPlayblastUI()" )
    mc.rowLayout( 'stereoRow', numberOfColumns=3, adjustableColumn=3 )
    mc.text( l='Interaxial Separation', w=100, al='right' )
    interFloatField = mc.floatField(  w=70, h=20, s=10, value=6.3500, pre=3 )
    interFloatSlider = mc.floatSlider( h=15, minValue=-0.000, maxValue=1000.000)
    #interaxialSleder = mc.floatSliderGrp( label='interaxial Separation', w= 450, cal=[100, 'right'], field=True, minValue=-0.000, maxValue=1000.000, fieldMinValue=0.000, fieldMaxValue=1000.000, ss=1.000, value=6.3500, precision=3 )
    mc.setParent('..')
    mc.rowLayout( 'zeroRow', numberOfColumns=3, adjustableColumn=3 )
    mc.text( l='Zero Parallax', w=100, al='right' )
    zeroFloatField = mc.floatField(  w=70, h=20, value=254.000, precision=3 )
    zeroFloatSlider = mc.floatSlider(  w=200, h=20, min=0, max=100000, step=0.1)
    #zeroSleder = mc.floatSliderGrp(  label='Zero Parallax', w= 450, cal=[100, 'right'], field=True, minValue=-0.000, maxValue=1000.000, fieldMinValue=0.000, fieldMaxValue=1000.000, ss=1.00, value=254.000,precision=3 )
    mc.popupMenu()
    mc.menuItem( l='Set Key', c='mc.sekKeyframe' )
    mc.setParent('..')
    
    mc.frameLayout(l = 'Camera List', borderStyle='etchedIn')
    cl2 = mc.columnLayout()
    updateCamList(cams)
            #mc.frameLayout(l = 'button', borderStyle='etchedIn')
            #cl3 = mc.columnLayout( cat=( 'left', 3 ), cw=200, rs=5, adj=1  )
    mc.setParent('..')
    rl1 = mc.rowLayout( 'camShow', numberOfColumns=4, adjustableColumn=3, p=cl1 )
    mc.button( l='Hide some',w=150, c="stereoPlayblast.activeSome()", p=rl1 )
    mc.button( l='playblast', w=150, c="stereoPlayblast.playBlastUser( '' )", p=rl1 )
    mc.button(l = 'export camera',w=150, c="stereoPlayblast.exportCam()", p=rl1)
    mc.setParent('..')

    txtf = mc.textFieldButtonGrp( label='Path', text='', buttonLabel='Browse', cw3 = (40,295,50), adjustableColumn3 = 2, cl3 = ('left', 'center', 'right'),p=cl1,bc = browse, cc = getPath )
    rl2 = mc.rowLayout( 'cameraShow', numberOfColumns=4, adjustableColumn=3, p=cl1 )
    mc.button( l='path save',w=150, c="stereoPlayblast.saveP()", p=rl2 )
    mc.button( l='left',w=150, c="stereoPlayblast.playBlastUser( 'left' )",p= rl2 )
    mc.button( l='right',w=150, c="stereoPlayblast.playBlastUser( 'right' )", p=rl2 )
    mc.showWindow( 'StereoPlayblastWin' )
    stereoOr()
    loadpreV()
	def queryAngle(self):
		angleVariableX= cmds.floatSlider("angleX",q=True, v=True)
		print angleVariableX
		angleVariableY= cmds.floatSlider("angleY", q=True, v=True)
		print angleVariableY
		angleVariableZ= cmds.floatSlider("angleZ", q=True, v=True)
		print angleVariableZ
		valsAngle = [angleVariableX, angleVariableY, angleVariableZ]
		print valsAngle
		return valsAngle	
Beispiel #7
0
 def fieldDragCmd(self, attr, *args ):
     
     value = cmds.floatField( self._field, q=1, v=1 )
     cmds.floatSlider( self._slider, e=1, v=value )
     
     if not self._dragStart:
         self._dragStart = True
         cmds.undoInfo( swf=0 )
     
     cmds.setAttr( attr, value )
Beispiel #8
0
 def connectAttribute( self, attr ):
     
     cmds.floatSlider( self._slider, e=1, 
                          cc=partial( self.sliderChangeCmd, attr ), 
                          dc=partial( self.sliderDragCmd, attr ) )
     
     cmds.floatField( self._field, e=1, 
                          cc=partial( self.fieldChangeCmd, attr ), 
                          dc=partial( self.fieldDragCmd, attr ) )
     
     self._keepValue = cmds.getAttr( attr )
Beispiel #9
0
 def update(self):
     if not self.data.layerDataAvailable:
         return
     
     currLayer = self.data.getCurrentLayer()
     if currLayer is not None and currLayer>0:
         # looks like python version of command does not supply querying with parameters
         name = mel.eval('ngSkinLayer -id %d -q -name' % currLayer)
         self.controls.layerName.setValue(name)
         opacity = mel.eval('ngSkinLayer -id %d -q -opacity' % currLayer)
         self.controls.layerOpacity.setValue(opacity)
         cmds.floatSlider(self.controls.sliderIntensity,e=True,value=opacity)
def creatStereo():
    global interaxialSleder
    global zeroSleder
    global interFloatField
    global interFloatSlider
    global zeroFloatField
    global zeroFloatSlider
    camL = mc.ls(sl=1)
    camListStereo = mc.ls( type='stereoRigTransform' )
    if camListStereo != []:
        mc.confirmDialog( title='Error',
							message='The scene have being a 3D camera, do not create again!',
							button=['Ok'])
        return 
    if camL == []:
        mc.confirmDialog( title='Missing',
							message='Please select a camera!',
							button=['Ok'])
        return
       
    cam = camL[0]
    camShape = mc.listRelatives(cam,s=1)[0]
    FL = mc.camera(cam,q=1,fl=1)
    NCP = mc.camera(cam,q=1,ncp=1)
    FCP = mc.camera(cam,q=1,fcp=1)
    cam3d = maya.app.stereo.stereoCameraRig.createStereoCameraRig()
    mc.parent(cam3d[0],cam)
    mc.setAttr(cam3d[0]+'.translate',0,0,0,lock=1)
    mc.setAttr(cam3d[0]+'.rotate',0,0,0,lock=1)
    mc.setAttr(cam3d[0]+'.scale',1,1,1,lock=1)
    cam3dShape = mc.listRelatives(cam3d[0],s=1)[0]
    mc.setAttr(cam3dShape+'.focalLength',FL)
    mc.setAttr(cam3dShape+'.nearClipPlane',NCP)
    mc.setAttr(cam3dShape+'.farClipPlane',FCP)
    mc.setAttr( cam3dShape+'.zeroParallaxPlane', 1  )
    mc.setAttr( cam3dShape+'.safeViewingVolume', 1  )
    mc.floatField( interFloatField, e=1, enable=True )
    mc.floatSlider( interFloatSlider, e=1, enable=True )
    mc.floatField( zeroFloatField, e=1, enable=True )
    mc.floatSlider( zeroFloatSlider, e=1, enable=True )
                #mc.floatSliderGrp( interaxialSleder, e=1, enable=True )
                #mc.floatSliderGrp( zeroSleder, e=1, enable=True )
    mc.connectControl( interFloatField, cam3dShape+'.interaxialSeparation' )
    mc.connectControl( interFloatSlider, cam3dShape+'.interaxialSeparation' )
    mc.connectControl( zeroFloatField, cam3dShape+'.zeroParallax' )
    mc.connectControl( zeroFloatSlider, cam3dShape+'.zeroParallax' )
    #mc.floatSliderGrp( interaxialSleder, e=1, enable=True )
    #mc.floatSliderGrp( zeroSleder, e=1, enable=True )
    #mc.connectControl( interaxialSleder, cam3dShape+'.interaxialSeparation' )
    #mc.connectControl( zeroSleder, cam3dShape+'.zeroParallax' )
    for i in cam3d:
        mc.rename(i,cam+'_'+i)
Beispiel #11
0
 def fieldChangeCmd(self, attr, *args ):
     
     value = cmds.floatField( self._field, q=1, v=1 )
     cmds.floatSlider( self._slider, e=1, v=value )
     cmds.setAttr( attr, value )
     
     if self._dragStart:
         self._dragStart = False
         cmds.setAttr( attr, self._keepValue )
         cmds.undoInfo( swf=1 )
         
     cmds.setAttr( attr, value )
     self._keepValue = value
Beispiel #12
0
def changeZeta(amt):
	distributor = amt / 8
	cmds.setAttr("leftShoulder.rotateX",distributor * 2)
	cmds.setAttr("rightShoulder.rotateX",distributor * 2)
	cmds.setAttr("leftElbow.rotateX",distributor * 3)
	cmds.setAttr("rightElbow.rotateX",distributor * 3)
	cmds.setAttr("leftWrist.rotateX",distributor * 2)
	cmds.setAttr("rightWrist.rotateX",distributor * 2)
	cmds.setAttr("leftFinger1.rotateX",distributor * 1)
	cmds.setAttr("rightFinger1.rotateX",distributor * 1)
	
	cmds.floatField(zetaField,e=True,v=amt)
	cmds.floatSlider(zetaSlider,e=True,v=amt)
	return
Beispiel #13
0
 def updateCondition( self, *args ):
     
     namePlug = self._attrName+'.weight'
     self._keepValue = cmds.getAttr( namePlug )
     cmds.floatField( self._field, e=1, v= self._keepValue )
     cmds.floatSlider( self._slider, e=1, v= self._keepValue )
     
     cons = cmds.listConnections( namePlug )
     
     if not cons:
         cmds.floatField( self._field, e=1, bgc=[0.1,0.1,0.1] )
     else:
         if cmds.nodeType( cons[0] ) == 'animCurveTU':
             cmds.floatField( self._field, e=1, bgc=[0.95,0.45,0.45] )
def stereoOr():
    global interaxialSleder
    global zeroSleder
    global interFloatField
    global interFloatSlider
    global zeroFloatField
    global zeroFloatSlider
    camListStereo = mc.ls( type='stereoRigTransform' )
    if camListStereo == []:
            mc.floatField( interFloatField, e=1, enable=False )
            mc.floatSlider( interFloatSlider, e=1, enable=False )
            mc.floatField( zeroFloatField, e=1, enable=False )
            mc.floatSlider( zeroFloatSlider, e=1, enable=False )
            #mc.floatSliderGrp( interaxialSleder, e=1, enable=False )
            #mc.floatSliderGrp( zeroSleder, e=1, enable=False )
    else:
            stereoShape = mc.listRelatives( camListStereo[0],s=1 )[0]
            mc.floatField( interFloatField, e=1, enable=True )
            mc.floatSlider( interFloatSlider, e=1, enable=True )
            mc.floatField( zeroFloatField, e=1, enable=True )
            mc.floatSlider( zeroFloatSlider, e=1, enable=True )
            #mc.floatSliderGrp( interaxialSleder, e=1, enable=True )
            #mc.floatSliderGrp( zeroSleder, e=1, enable=True )
            mc.connectControl( interFloatField, stereoShape+'.interaxialSeparation' )
            mc.connectControl( interFloatSlider, stereoShape+'.interaxialSeparation' )
            mc.connectControl( zeroFloatField, stereoShape+'.zeroParallax' )
            mc.connectControl( zeroFloatSlider, stereoShape+'.zeroParallax' )
 def _UI(self,*args):
     target_nodes = cmds.blendShape(blendshape_node[0],q=True,t=True)
     target_weights = cmds.blendShape(blendshape_node[0],q=True,w=True)
     if len(target_nodes)>0:
         w = 300
         if cmds.window('blendshapeWin',exists=True):cmds.deleteUI('blendshapeWin',window=True)
         cmds.window('blendshapeWin',t='BlendShape Editor',w=w,rtf=1,mxb=0,mnb=0,s=0)
         #cmds.columnLayout("mainColumn",p="blendshapeWin",columnAttach=('both', 2), rowSpacing=10, columnWidth=w)
         cmds.rowColumnLayout('mainRowColumn',p='blendshapeWin',numberOfColumns=3, columnWidth=[(1, 100), (2, 150), (3, 50)] )
         for i,tgt in enumerate(target_nodes):
             cmds.text(p='mainRowColumn',l=tgt)
             cmds.floatSlider("{0}FltSld".format(tgt),p='mainRowColumn',v=target_weights[i],max=1,min=0,cc=self.updateTargetValue)
             cmds.button(p='mainRowColumn',l='Edit')
         cmds.showWindow('blendshapeWin')
Beispiel #16
0
def sliderBld(labelName, attr, currParent, minVal=0, maxVal=1, resetVal=0, cw1=60):
	frm = cmds.formLayout(parent=currParent)
	'''
	slider = cmds.floatSliderGrp( label=labelName, field=True, min=minVal, max=maxVal,
		cw=[[1,cw1],[2,60], [3,70]], co3=[0, 0, 10], cat=[3,"left",0])
	'''
	text = cmds.text( width=cw1, label=labelName, align="center" )
	field = cmds.floatField( min=minVal, max=maxVal, w=60 )
	slider = cmds.floatSlider( min=minVal, max=maxVal, w=100 )
	cmds.connectControl(field, attr)
	cmds.connectControl(slider, attr)
	btn1 = cmds.button( label="Key",
		command=scriptName + ".key('" + attr + "')")
	btn2 = cmds.button( label="Reset",
		command=scriptName + ".reset('" + attr + "', " + str(resetVal) +")" )

	# text position
	cmds.formLayout( frm, e=1, attachForm=[[text, "left", 0],[text, "top", 0]])
	# field position
	cmds.formLayout( frm, e=1, attachForm=[field, "top", 0], attachControl=[field, "left", 0, text])
	# slider position
	cmds.formLayout( frm, e=1, attachForm=[slider, "top", 0], attachControl=[slider, "left", 0, field])
	# buttons position
	cmds.formLayout( frm, e=1, attachForm=[btn1, "top", 0], attachControl=[btn1, "left", 0, slider])
	cmds.formLayout( frm, e=1, attachForm=[btn2, "top", 0], attachControl=[btn2, "left", 0, btn1])
	cmds.setParent( currParent )
	return frm
Beispiel #17
0
 def sliderChanging(self, *args):
     """
     handler for when float slider value is dragged
     """
     self.floatField.setValue(cmds.floatSlider(self.slider, q=True, value=True))
     self.updateModel()
     self.onChanging.emit()
Beispiel #18
0
def floatUI():
  # Check to see if window exists
  if cmds.window("PBQuality", exists=True):
    cmds.deleteUI("PBQuality")

  # Create window
  window = cmds.window("PBQuality", title="DPA Playblast", w=300, h=100, mnb=False, mxb=False, sizeable=False)

  # Create a main layout
  mainLayout = cmds.columnLayout(adj=True)
  blastLayout = cmds.columnLayout("blastLayout", p=mainLayout, w=260, adj=False, rs=5, cat=('left', 5))
  cmds.separator(p=blastLayout)

  cmds.text(label="Enter desired playbast quality:", p=blastLayout)
  qualityField = cmds.floatField("playblastValue", p=blastLayout, w=250, min=50, max=100, pre=0, step=1, v=90, ed=True)
  qualitySlider = cmds.floatSlider("playblastPercentage", p=blastLayout, w=250, min=50, max=100, step=1, v=90, dc=updatePercent)
  cmds.separator(p=blastLayout)

  sequenceOption = cmds.checkBox("sequenceOption", label="From Sequence", value=False)
  reviewOption = cmds.checkBox("reviewOption", label="Auto-bot review submission", value=False)
  cmds.separator(p=blastLayout)

  confirmLayout = cmds.rowColumnLayout("confirmLayout", p=mainLayout, w=250, nc=2, rs=(5, 5), co=[(1, 'left', 5), (2, 'right', 5)], cw=[(1, 125), (2, 125)])
  cancelButton = cmds.button("cancelButton", p=confirmLayout, label="Cancel", c="cmds.deleteUI('PBQuality')", w=80, h=30)
  pbButton = cmds.button("pbButton", p=confirmLayout, label="Playblast", c=handlePB, w=100, h=30)
  cmds.separator(p=confirmLayout)

  cmds.showWindow(window)
Beispiel #19
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
Beispiel #20
0
 def make_slider(self, left, top, parent_form):
     '''
     This just makes the physical slider - it connects nothing. That's done dynamically
     '''
     the_field = cmds.floatSlider(width=80, min=0, max=1, value=0, step=0.05 )
     cmds.formLayout(parent_form,
                     edit=True,
                     attachForm=[(the_field, 'top', top),
                                 (the_field, 'left', left)])
     return the_field
    def create(self):
        form = FormLayout(width=100)

        self.intensityIndicator = cmds.textField(width=Constants.NUMBER_FIELD_WIDTH,editable=False,annotation=self.annotation);
        self.sliderIntensity = cmds.floatSlider(min=0, max=1, step=0.05, value=self.__value,cc=self.sliderChange,annotation=self.annotation )

        form.attachForm(self.intensityIndicator,0,None,0,0)
        form.attachForm(self.sliderIntensity,2,0,None,None)
        form.attachControl(self.sliderIntensity,self.intensityIndicator,None,None,None,0)

        self.updateIntensityDisplay()
        return form
def makeDockable(childWidget, areaName, width, label):
	
	slider = cmds.floatSlider() #some throwaway control, feel free to delete this when you're done.
	dock = cmds.dockControl(l = label, content=slider,  area = areaName, w = width ) #Returns the string path to the dock control. The control is a QDockWidget under the hood.
	dockPt = openMayaUi.MQtUtil.findControl(dock) #Find the pointer to the dock control
	dockWidget = sip.wrapinstance(long(dockPt), QtCore.QObject) #Get that pointer as a Qt widget
	childWidget.setParent(dockWidget)
	dockWidget.setWidget(childWidget) #Set the docked widget to be your custom control.




	
Beispiel #23
0
def changeFrame(frameValue):
	if (frameValue == 1):
		cmds.currentTime(1)
	else:
		cmds.currentTime(frameValue*5-5)
		
	alpha = cmds.getAttr ("leftShoulder.rotateY")
	beta = cmds.getAttr ("leftElbow.rotateY")
	gamma = cmds.getAttr ("leftWrist.rotateY")
	theta = cmds.getAttr ("leftFinger1.rotateY")
	zeta = 2 * cmds.getAttr ("leftShoulder.rotateX") + 3 * cmds.getAttr ("leftElbow.rotateX") + 2 * cmds.getAttr ("leftWrist.rotateX") + 1 * cmds.getAttr ("leftFinger1.rotateX")
		
	cmds.floatField(alphaField,e=True,value=alpha)
	cmds.floatSlider(alphaSlider,e=True,value=alpha)
	cmds.floatField(betaField,e=True,value=beta)
	cmds.floatSlider(betaSlider,e=True,value=beta)
	cmds.floatField(gammaField,e=True,value=gamma)
	cmds.floatSlider(alphaSlider,e=True,value=gamma)
	cmds.floatField(thetaField,e=True,value=theta)
	cmds.floatSlider(thetaSlider,e=True,value=theta)
	cmds.floatField(zetaField,e=True,value=zeta)
	cmds.floatSlider(zetaSlider,e=True,value=zeta)
	return
Beispiel #24
0
 def create(self):
     result =self.mainLayout= cmds.rowLayout(nc=2,adjustableColumn=2)
     step = (self.range[1]-self.range[0])/100.0;
     
     self.floatField = FloatField(self.model,step=step)
     if not self.flexibleRange:
         self.floatField.editUI(minValue=self.range[0],maxValue=self.range[1])
         
     self.floatField.changeCommand.addHandler(self.fieldChanged)
     self.slider = cmds.floatSlider(value=self.floatField.getValue(),
                                    dragCommand=self.sliderChanging,changeCommand=self.sliderChanged,
                                    step=step,
                                    minValue=self.range[0],maxValue=self.range[1]
                                    )
     
     self.__updateSliderValue()
     return result
Beispiel #25
0
    def __updateSliderValue(self):
        value = self.floatField.getValue()
        minValue = cmds.floatSlider(self.slider, q=True, minValue=True)
        maxValue = cmds.floatSlider(self.slider, q=True, maxValue=True)
        if self.flexibleRange:
            # change min/max, if needed
            cmds.floatSlider(self.slider, e=True, minValue=min(value, minValue), maxValue=max(value, maxValue))
        else:
            # change value, if needed
            value = min(maxValue, max(value, minValue))

        cmds.floatSlider(self.slider, e=True, value=self.floatField.getValue())
Beispiel #26
0
    def createUI(self,tab,parent):
        LayerEvents.currentLayerChanged.addHandler(self.update,parent)
        LayerEvents.layerListUpdated.addHandler(self.update,parent)
        MayaEvents.undoRedoExecuted.addHandler(self.update,parent)

        group = tab.createUIGroup(parent, "Layer Properties")
        cmds.setParent(group)
        
        cmds.rowLayout(parent=group,nc=2,adjustableColumn=2,columnWidth2=[Constants.MARGIN_COLUMN2,50], columnAttach2=["both","left"],columnAlign2=["right","left"])
        TextLabel('Layer name:')
        self.controls.layerName = TextEdit()
        self.controls.layerName.changeCommand.addHandler(self.layerNameChanged)

        cmds.rowLayout(parent=group,adjustableColumn=3,nc=3,columnWidth3=[Constants.MARGIN_COLUMN2,50,100], columnAttach3=["both","left","both"],columnAlign3=["right","left","center"])
        TextLabel('Opacity:')
        self.controls.layerOpacity = FloatField(None, minValue=0.0, maxValue=1.0, step=0.1, defaultValue=1.0, annotation="overall intensity of this layer")
        self.controls.layerOpacity.changeCommand.addHandler(self.layerOpacityChanged)
        self.controls.sliderIntensity = cmds.floatSlider(min=0, max=1, step=0.05, value=1.0,cc=self.layerOpacitySliderChanged,dc=self.layerOpacitySliderChanged,annotation='Drag slider to change layer opacity' )
	def __init__(self):
		self.name="growthUI"
		self.title="growth"
		if(cmds.window(self.name, exists=True,query=True)):
			cmds.deleteUI(self.name)
		self.window=cmds.window(self.name, title=self.title)
		self.form= cmds.formLayout()
		self.windowHeight = 300
		self.windowWidth = 100
		cmds.columnLayout(columnAlign="center")
		cmds.text(label="angleX")
		self.fltSliderXangle=cmds.floatSlider("angleX", min=-5, max=5, value=0, step=0.1)
		cmds.text(label="angleY")
		self.fltSliderYangle=cmds.floatSlider("angleY", min=-5, max=5, value=0, step=0.1)
		cmds.text(label="angleZ")
		self.fltSliderZangle=cmds.floatSlider("angleZ", min=-5, max=5, value=0, step=0.1)
		cmds.text(label="scaleX")
		self.fltSliderXscale=cmds.floatSlider("scaleX", min=-5, max=5, value=0, step=0.1)
		cmds.text(label="scaleY")
		self.fltSliderYscale=cmds.floatSlider("scaleY", min=-5, max=5, value=0, step=0.1)
		cmds.text(label="scaleZ")
		self.fltSliderZscale=cmds.floatSlider("scaleZ", min=-5, max=5, value=0, step=0.1)
		self.growth_size_button=cmds.button(label='grow', align="center", height=50, width=100, command=self.process)
		cmds.showWindow(self.window)
Beispiel #28
0
 def layerOpacityChanged(self):
     currLayer = self.data.getCurrentLayer()
     if currLayer is not None:
         value = self.controls.layerOpacity.getValue()
         cmds.ngSkinLayer(e=True,id=currLayer,opacity=value)
         cmds.floatSlider(self.controls.sliderIntensity,e=True,value=value)
Beispiel #29
0
 def reset(self, *args):
     # update slider field
     cmds.floatSlider(self.slider, edit=True, value=0.5)
     # update float field
     cmds.floatField(self.myTextField, edit=True, value=0.5)
Beispiel #30
0
    def reset(self, *args):
        print "Reset UI"
        print args

        cmds.floatSlider(self.slider, edit=1, value=50)
Beispiel #31
0
def getSliderValue(ctrlName):
    value = cmds.floatSlider(ctrlName, q=True, value=True)
    return value
Beispiel #32
0
 def reset(self, *args):
     #whenever edit works, value changes
     cmds.floatSlider(self.slider, edit = True, value = 50)
 def reset_slider_value(self, *args):
     # Not working now because of controlConnection
     cmds.floatSlider(self.blend_sl, v=0, edit=True)
     cmds.refresh()
Beispiel #34
0
	def setMin(self, value):
		cmds.floatField( self.fieldGui, e=1, min=value)
		cmds.floatSlider( self.sliderGui, e=1, min=value)
Beispiel #35
0
	def gui(self):
		'''
		Generates the interface for the AttrGUISingle object.
		'''
				
		btnWidth = 30
		btnSep = 2
		# textWidth = 70
		# fieldWidth
		# if( cmds.about( os=True ) == "mac" ):
			
		self.mainLayout = cmds.rowColumnLayout(parent=self.parent, nc=7, h=20, 
			rat=[[1,"both", btnSep ],[2,"both", btnSep ],[3,"both", btnSep ],[4,"both", btnSep ],[5,"both", btnSep ],[6,"both", btnSep ],[7,"both", btnSep ]],
			cw=[[1,100],[2,70],[3,125],[4, btnWidth ],[5,btnWidth ],[6,btnWidth ],[7,btnWidth ]])
		cmds.text(label=self.text, w=70, al="center")
		self.fieldGui = cmds.floatField( w=100, pre=2 )	
		pop = cmds.popupMenu(parent=self.fieldGui)
		cmds.menuItem(parent=pop, label="0 - 1", c=Callback( self.setMinMax, 0, 1))
		cmds.menuItem(parent=pop, label="0 - 10", c=Callback( self.setMinMax, 0, 10))
		cmds.menuItem(parent=pop, label="-10 - 10", c=Callback( self.setMinMax, -10, 10))		
		cmds.menuItem(parent=pop, label="Set Min/Max")
		cmds.menuItem( divider=1)
		cmds.menuItem(label="Step 1", c=Callback( self.setStep, 1 ))
		cmds.menuItem(label="Step .1", c=Callback( self.setStep, .1 ))
		cmds.menuItem(label="Step .01", c=Callback( self.setStep, .01 ))

		
		self.sliderGui = cmds.floatSlider( w=100, h=20)

		cmds.popupMenu(parent=self.sliderGui)
		cmds.menuItem(label="0 - 1", c=Callback( self.setMinMax, 0, 1))
		cmds.menuItem(label="0 - 10", c=Callback( self.setMinMax, 0, 10))
		cmds.menuItem(label="-10 - 10", c=Callback( self.setMinMax, -10, 10))		
		cmds.menuItem(label="Set Min/Max")
		cmds.menuItem( divider=1)
		cmds.menuItem(label="Step 1", c=Callback( self.setStep, 1 ))
		cmds.menuItem(label="Step .1", c=Callback( self.setStep, .1 ))
		cmds.menuItem(label="Step .01", c=Callback( self.setStep, .01 ))

		
		print("Min Value: " + str(self.attrs.min))
		print("Max Value: " + str(self.attrs.max))
		
		if( self.attrs.min != None ):
			cmds.floatField( self.fieldGui, e=1, min=self.attrs.min )
			cmds.floatSlider( self.sliderGui, e=1, min=self.attrs.min )
		if( self.attrs.max != None ):
			cmds.floatField( self.fieldGui, e=1, max=self.attrs.max )
			cmds.floatSlider( self.sliderGui, e=1, max=self.attrs.max )
			
		cmds.connectControl( self.fieldGui, self.attrNames )
		cmds.connectControl( self.sliderGui, self.attrNames )
		
		cmds.symbolButton(image='MENUICONKEYS.XPM', h=20,
			ann="Keyframe",
			command=Callback(self.key))
		cmds.symbolButton(image='REDRAWPAINTEFFECTS.XPM', h=20,
			ann="Reset to Default",
			command=Callback(self.reset))
		self.symGUI = cmds.symbolCheckBox( image='ONRADIOBTNICON.XPM', h=20,
			oni='ONRADIOBTNICON.XPM',
			ofi='OFFRADIOBTNICON.XPM',
			ann="Set Offset",
			onc=Callback(self.setOffset))
		self.resOffName = cmds.symbolButton(image='AUTOLOAD.XPM', h=20,
			ann="Reset Offset", 
			command=Callback( self.resetOffset ) )
		
		cmds.setParent(self.parent)
Beispiel #36
0
def easyInBetweenChange(value=None, *args):
    """
    slider
    """
    if not UIContainer.undoChunk:
        UIContainer.undoChunk = True
        cmds.undoInfo(openChunk=True)

    if not UIContainer.dragInProgress:
        #pass initial values
        UIContainer.objs = cmds.ls(sl=True)
        if cmds.menuItem(UIContainer.radioMenuItemModeObject,
                         q=True,
                         radioButton=True):
            UIContainer.animCurves = Core.getAnimCurves()
            for curve in UIContainer.animCurves:
                UIContainer.animCurveInfo[curve] = Core.findCloseKeyByFrame(
                    curve, cmds.currentTime(q=True))
            UIContainer.animCurveCalculatedInfo = Core.calculate(
                UIContainer.animCurveInfo)
        elif cmds.menuItem(UIContainer.radioMenuItemModeKeyFrame,
                           q=True,
                           radioButton=True):
            UIContainer.animCurves = Core.getAnimCurves(withFrame=True)
            for curve in UIContainer.animCurves:
                frames = Core.getAllKeyFrames(curve)
                UIContainer.animCurveInfo[curve] = {}
                for frame in frames:
                    UIContainer.animCurveInfo[curve][
                        frame] = Core.findCloseKeyByFrame(curve, frame)
            UIContainer.animCurveCalculatedInfo = Core.calculate(
                UIContainer.animCurveInfo, withFrame=True)

        UIContainer.dragInProgress = True

    if value:
        amount = value
    else:
        amount = cmds.floatSlider(UIContainer.floatSliderEIBAmount,
                                  q=True,
                                  v=True)

    if cmds.menuItem(UIContainer.radioMenuItemModeObject,
                     q=True,
                     radioButton=True):
        Core.runChange(UIContainer.objs, amount,
                       UIContainer.animCurveCalculatedInfo)
    elif cmds.menuItem(UIContainer.radioMenuItemModeKeyFrame,
                       q=True,
                       radioButton=True):
        if amount > 1:
            Core.runChange(UIContainer.objs,
                           1,
                           UIContainer.animCurveCalculatedInfo,
                           withFrame=True)
        elif amount < 0:
            Core.runChange(UIContainer.objs,
                           0,
                           UIContainer.animCurveCalculatedInfo,
                           withFrame=True)
        else:
            Core.runChange(UIContainer.objs,
                           amount,
                           UIContainer.animCurveCalculatedInfo,
                           withFrame=True)
Beispiel #37
0
def build(parent, imagesPath, iconSize=25, height=20, marginSize=5):
    """
    build widget
    @param parent : parent layout in maya
    @imagesPath : str path
    """
    wdth = 266
    cmds.rowLayout(numberOfColumns=2, parent=parent)
    cmds.columnLayout(width=wdth)
    cmds.frameLayout(
        labelVisible=False,
        borderVisible=False,
        width=wdth,
        marginHeight=0,
        marginWidth=0,
        labelIndent=0,
        collapsable=False,
    )
    cmds.rowLayout(numberOfColumns=11,
                   adjustableColumn=1,
                   columnAttach=([2, 'both', 0]))
    cmds.text(label="0.0")
    cmds.separator(height=5, width=36, style='none')
    cmds.text(label="0.5")
    cmds.separator(height=5, width=66, style='none')
    cmds.text(label="1.0")
    cmds.separator(height=5, width=34, style='none')
    cmds.setParent("..")
    cmds.setParent("..")
    UIContainer.floatSliderEIBAmount = cmds.floatSlider(
        min=-0.2,
        max=1.2,
        width=wdth,
        value=0.5,
        step=0.1,
        annotation='Easy Inbetween. Right click to reset the tool.',
        cc=afterDrop,
        dc=easyInBetweenChange)
    cmds.popupMenu()
    cmds.radioMenuItemCollection()
    UIContainer.radioMenuItemModeObject = cmds.menuItem(label='Object Mode',
                                                        radioButton=True,
                                                        c=partial(
                                                            writeEIBMode,
                                                            'object'))
    UIContainer.radioMenuItemModeKeyFrame = cmds.menuItem(
        label='KeyFrame Mode',
        radioButton=False,
        c=partial(writeEIBMode, 'keyframe'))
    cmds.menuItem(divider=True)
    cmds.menuItem(label="Reset", command=afterDrop)

    cmds.frameLayout(
        labelVisible=False,
        borderVisible=False,
        width=wdth,
        marginHeight=0,
        marginWidth=0,
        labelIndent=0,
        collapsable=False,
    )
    cmds.rowLayout(width=wdth,
                   numberOfColumns=30,
                   columnAttach=([2, 'both', 0]))
    for i in range(-2, 13, 1):
        value = i / 10.0
        if i == 0 or i == 5 or i == 10:
            pic = 'dot_big.png'
        else:
            pic = 'dot_small.png'
        cmds.iconTextButton(style='iconOnly',
                            image1=os.path.join(imagesPath, pic),
                            label=str(value),
                            annotation="set inbetween : " + str(value),
                            c=partial(easyInBetweenChange, value=value))
        cmds.separator(height=10, width=1, style='none')
    cmds.setParent("..")
    cmds.setParent("..")
    cmds.setParent("..")
    cmds.setParent("..")

    readEIBMode()
 def mod_radius(self, *args):
     newRadius = cmds.floatSlider(self.radiusSlider, q=True, v=True)
     self.chain.change_chain(length=newRadius)
Beispiel #39
0
 def update_float_slider(self, *args):
     field_intensity = cmds.floatField(self.field, q=True, value=True)
     cmds.floatSlider(self.slider, e=True, value=field_intensity)
Beispiel #40
0
 def makeGear(self, *args):
     teeth = cmds.intSlider(self.slider, query=True, value=True)
     length = cmds.floatSlider(self.LengthSlider, query=True, value=True)
     self.gear = Gear()
     self.gear.createGear(teeth=teeth,length=length)
Beispiel #41
0
 def create(self):
     if cmds.window(self.window, exists=True):
         cmds.deleteUI(self.window, window=True)
     self.window = cmds.window(self.window,
                               title=self.title,
                               widthHeight=self.size)
     cmds.columnLayout(adjustableColumn=True)
     cmds.rowColumnLayout(numberOfColumns=3,
                          columnWidth=[(1, 100), (2, 100), (3, 100)])
     self.min_button = cmds.button(label=self.min_button,
                                   command=self.do_min,
                                   enableBackground=True)
     self.avg_button = cmds.button(label=self.avg_button,
                                   command=self.do_avg,
                                   enableBackground=True)
     self.max_button = cmds.button(label=self.max_button,
                                   command=self.do_max,
                                   enableBackground=True)
     cmds.setParent('..')
     cmds.separator(style='none', height=5)
     cmds.rowColumnLayout(numberOfColumns=2,
                          columnWidth=[
                              (1, 150),
                              (2, 150),
                          ])
     self.first_button = cmds.button(label=self.first_button,
                                     command=self.do_first,
                                     enableBackground=True)
     self.last_button = cmds.button(label=self.last_button,
                                    command=self.do_last,
                                    enableBackground=True)
     cmds.setParent('..')
     cmds.separator(style='none', height=5)
     cmds.rowLayout(
         numberOfColumns=3,
         adjustableColumn=3,
         columnAlign=(1, 'right'),
         columnWidth=[(1, 60), (2, 80), (3, 160)],
         columnOffset3=(0, 5, 0),
         columnAttach3=('both', 'left', 'left'),
     )
     cmds.text(label='Intensity:')
     self.field = cmds.floatField()
     self.slider = cmds.floatSlider()
     cmds.floatField(self.field,
                     e=True,
                     width=80,
                     minValue=0,
                     maxValue=1,
                     step=0.001,
                     value=1,
                     dragCommand=self.do_drag,
                     changeCommand=self.update_float_slider)
     cmds.floatSlider(
         self.slider,
         e=True,
         minValue=0,
         maxValue=1,
         step=0.001,
         value=1,
         dragCommand=self.do_drag,
     )
     cmds.setParent('..')
     cmds.rowLayout(numberOfColumns=1,
                    adjustableColumn=1,
                    columnAlign=(1, 'left'),
                    columnOffset1=25)
     self.all_check = cmds.checkBox(
         label=self.all_check,
         value=True,
     )
     cmds.setParent('..')
     cmds.setParent('..')
     cmds.showWindow()
     self.button_color()
Beispiel #42
0
	def setMax(self, value):
		cmds.floatField( self.fieldGui, e=1, max=value)
		cmds.floatSlider( self.sliderGui, e=1, max=value)	
 def get_slider_val(self, sl):
     return round(cmds.floatSlider(sl, value=True, query=True), 2)
Beispiel #44
0
	def setStep(self, stepValue):
		cmds.floatField( self.fieldGui, e=1, step=stepValue)
		cmds.floatSlider( self.sliderGui, e=1, step=stepValue)			
Beispiel #45
0
def windowUI():

    #If window exists, delete it
    if (cmds.window('TranslatePolyShape', exists=True)):
        cmds.deleteUI('TranslatePolyShape')
    theWin = cmds.window('TranslatePolyShape')
    cmds.columnLayout(adjustableColumn=True,
                      columnAlign='center',
                      rowSpacing=20,
                      height=400)

    #For Translation
    cmds.text('\n', height=2)
    cmds.text('Translate:', font='boldLabelFont')
    cmds.text('X Axis', font='obliqueLabelFont', height=10)
    xSlider = cmds.floatSlider(min=-100.00,
                               max=100.00,
                               value=0.00,
                               step=1,
                               dc='empty')
    cmds.text('Y Axis', font='obliqueLabelFont')
    ySlider = cmds.floatSlider(min=-100.00,
                               max=100.00,
                               value=0.00,
                               step=1,
                               dc='empty')
    cmds.text('Z Axis', font='obliqueLabelFont')
    zSlider = cmds.floatSlider(min=-100.00,
                               max=100.00,
                               value=0.00,
                               step=1,
                               dc='empty')
    cmds.floatSlider(xSlider, e=True, dc=partial(translate, xSlider, x=0.5))
    cmds.floatSlider(ySlider, e=True, dc=partial(translate, ySlider, y=0.5))
    cmds.floatSlider(zSlider, e=True, dc=partial(translate, zSlider, z=0.5))

    #For Rotation
    cmds.text('Rotate:', font='boldLabelFont')
    cmds.text('Rotate X', font='obliqueLabelFont', height=10)
    xRotate = cmds.floatSlider(min=-360.00,
                               max=360.00,
                               value=0.00,
                               step=1,
                               dc='empty')
    cmds.text('Rotate Y', font='obliqueLabelFont', height=10)
    yRotate = cmds.floatSlider(min=-360.00,
                               max=360.00,
                               value=0.00,
                               step=1,
                               dc='empty')
    cmds.text('Rotate Z', font='obliqueLabelFont', height=10)
    zRotate = cmds.floatSlider(min=-360.00,
                               max=360.00,
                               value=0.00,
                               step=1,
                               dc='empty')
    cmds.floatSlider(xRotate, e=True, dc=partial(rotation, xRotate, x=0.5))
    cmds.floatSlider(yRotate, e=True, dc=partial(rotation, yRotate, y=0.5))
    cmds.floatSlider(zRotate, e=True, dc=partial(rotation, zRotate, z=0.5))

    #For Scale
    cmds.text('Scale:', font='boldLabelFont')
    cmds.text('Scale X', font='obliqueLabelFont', height=10)
    xScale = cmds.floatSlider(min=0.10,
                              max=100.00,
                              value=1.00,
                              step=1,
                              dc='empty')
    cmds.text('Scale Y', font='obliqueLabelFont', height=10)
    yScale = cmds.floatSlider(min=0.10,
                              max=100.00,
                              value=1.00,
                              step=1,
                              dc='empty')
    cmds.text('Scale Z', font='obliqueLabelFont', height=10)
    zScale = cmds.floatSlider(min=0.10,
                              max=100.00,
                              value=1.00,
                              step=1,
                              dc='empty')
    cmds.floatSlider(xScale, e=True, dc=partial(scaleShape, xScale, x=0.5))
    cmds.floatSlider(yScale, e=True, dc=partial(scaleShape, yScale, y=0.5))
    cmds.floatSlider(zScale, e=True, dc=partial(scaleShape, zScale, z=0.5))

    #Reset button
    cmds.button(label='Reset All', command='reset()')
    cmds.showWindow()
Beispiel #46
0
def UI():
    #function attributes that will be used for getting final settings from the UI
    UI.targetPrim = 'Cube'
    UI.population = 0
    UI.resolution = 256

    #default radius/size
    UI.targetPrimSize = 2

    #target color
    UI.targetR = 1
    UI.targetG = 1
    UI.targetB = 1

    #target rotation
    UI.targetOrientation = (0, 0, 0)
    UI.randomOrientation = False

    #target in middle/random
    UI.targetMiddle = False
    UI.targetOffsetRange = 1

    UI.lightRot = (0.0, 0.0, 0.0)
    UI.lightIntensity = 0.8

    UI.exportTargetData = True
    UI.exportLightData = False
    UI.exportNoiseData = False

    #if mc.window('UIwindow', exists = True):
    #  mc.deleteUI(uiwindow)
    #  print('deleted previous window')

    uiwindow = mc.window('UIw2255342s32222222ndow',
                         t='Training Scene Generator',
                         widthHeight=(320, 520),
                         mnb=False,
                         mxb=False,
                         sizeable=False)

    #main layout
    mainLayout = mc.columnLayout(w=320, h=520, co=('left', 10))

    #header image
    mc.separator(12)
    imagePath = mc.internalVar(upd=True) + "icons/SG2000Logo.png"
    mc.image(w=320, h=93, image=imagePath)
    mc.separator(h=18)

    #-------------------------------------TARGET PRIM-------------------------------------#
    #dropdown for target object
    targetDropdownMenu = mc.optionMenu('targetDropdownMenu',
                                       w=280,
                                       label='Target Primitive Geometry: ',
                                       cc=partial(updateTargetPrim))

    #RGB sliders
    mc.separator(h=6)
    mc.text("Target Primitive Color RGB")
    mc.separator(h=6)

    mc.rowColumnLayout(numberOfRows=1, rowSpacing=(10, 10))
    mc.text('R:')
    mc.floatSlider('targetRSlider',
                   min=0,
                   max=30,
                   value=0,
                   step=1,
                   cc=setTargetRGB,
                   bgc=(.6, 0.2, 0.2))
    mc.text('G:')
    mc.floatSlider('targetGSlider',
                   min=0,
                   max=30,
                   value=0,
                   step=1,
                   cc=setTargetRGB,
                   bgc=(.2, .6, .2))
    mc.text('B:')
    mc.floatSlider('targetBSlider',
                   min=0,
                   max=30,
                   value=0,
                   step=1,
                   cc=setTargetRGB,
                   bgc=(0.4, 0.4, .8))
    mc.setParent('..')

    #POSITION AND ORIENTATION AND SIZE
    mc.separator(6)
    mc.rowColumnLayout(numberOfRows=1)
    mc.checkBox('in_mid', v=UI.targetMiddle, cc=setTargetMidBool)
    mc.checkBox('rand_rot', cc=setRandomOrientation)

    mc.text('size: ')
    mc.intField('radiusIntField', w=30, v=2, cc=changeRadiusIntField)
    mc.text('offset: ')
    mc.intField('offsetIntField',
                w=30,
                maxValue=10,
                minValue=0,
                v=UI.targetOffsetRange,
                cc=changeOffsetIntField)
    mc.separator(6)
    mc.setParent('..')

    #CREATE OR DELETE PRIM
    mc.rowColumnLayout(numberOfRows=1)
    mc.button(label='CREATE', c=partial(createTargetPrim))
    mc.button(label='DELETE', c=partial(deleteTargetPrim))
    mc.setParent('..')
    #---------------------------------END OF TARGET PRIM---------------------------------#

    #---------------------------------BACKGROUND OBJECTS---------------------------------#
    mc.separator(h=18)
    mc.text('Background Population Density')
    mc.rowColumnLayout(numberOfRows=1)
    mc.separator(h=12)
    mc.text('few')
    mc.intSlider('popSlider',
                 min=0,
                 max=400,
                 value=0,
                 step=1,
                 cc=setPopulation)
    mc.text('many objects in the background')
    mc.setParent('..')

    # mc.text('Background Population Variety')
    # mc.rowColumnLayout( numberOfRows = 1)
    # mc.separator(h=6)
    # mc.text('few')
    # mc.intSlider('popSlider', min=0, max=400, value=0, step=80, cc=setPopulation)
    # mc.text('many types of primitives')
    mc.setParent('..')
    mc.rowColumnLayout(numberOfRows=1)
    mc.separator(h=6)
    mc.button(label='BUILD', c=partial(buildBackground))
    mc.button(label='DELETE', c=partial(deleteBackground))
    mc.setParent('..')

    #-----------------------------END OF BACKGROUND OBJECTS-------------------------------#

    #--------------------------------------LIGHTS-----------------------------------------#
    mc.rowColumnLayout(numberOfRows=1)
    mc.text('light rotation')
    mc.separator(w=120)
    mc.text('light intensity')
    mc.setParent('..')
    mc.rowColumnLayout(numberOfRows=1)
    mc.separator(h=6)
    mc.floatField('lxr', w=40, cc=setLightRot)
    mc.floatField('lyr', w=40, cc=setLightRot)
    mc.floatField('lzr', w=40, cc=setLightRot)
    mc.separator(w=60)
    mc.floatField('lin', w=40, cc=setLightIntensity, v=0.8)
    mc.setParent('..')
    #-----------------------------------END OF LIGHTS-------------------------------------#

    #--------------------------------------OUTPUT-----------------------------------------#
    mc.separator(h=12)
    mc.text('Rendering')
    mc.separator(h=6)

    mc.rowColumnLayout(numberOfRows=1)
    mc.button('change save directory', bgc=(.2, .6, .2), c=changeRenderpath)
    mc.separator(h=6)
    mc.setParent('..')

    mc.rowColumnLayout(numberOfRows=1)
    mc.button(label='CAMERA', c=partial(makeCamera))
    mc.button(label='X', c=partial(deleteCamera), bgc=(.8, .2, .2))
    mc.button(label='RENDER', c=partial(RenderScenes))
    mc.intField('rendercountfield',
                w=40,
                minValue=1,
                maxValue=4000,
                cc=updateRenderCount)
    mc.text('times with these settings')
    mc.setParent('..')

    mc.rowColumnLayout(numberOfRows=1)
    mc.text('Export   : ')
    mc.checkBox('target', v=UI.exportTargetData)
    mc.checkBox('light', v=UI.exportLightData)
    mc.checkBox('noise', v=UI.exportNoiseData)
    mc.setParent('..')

    mc.showWindow(uiwindow)
Beispiel #47
0
 def reset(self, *args):
     # This resets the slider to its default value
     cmds.floatSlider(self.slider, edit=True, value=50)
 def __init__(self):
     self.disorderNum = cmds.floatSlider("disorder", query=True, value=True)
Beispiel #49
0
 def updateValues(self, percentage, obj=None, attrs=None, selection=True):
     cmds.floatSlider(self.slider, edit=True, value=percentage)
     cmds.floatField(self.myTextField, edit=True, value=percentage)
     tween(percentage, obj=obj, attrs=attrs, selection=selection)
 def layerOpacitySliderChanged(self, *args):
     self.controls.layerOpacity.setValue(
         cmds.floatSlider(self.controls.sliderIntensity, q=True,
                          value=True))
     self.layerOpacityChanged()
Beispiel #51
0
'''
Part 1
formLayout
'''
	
	slider = cmds.floatSliderGrp( label=attrLabel, field=True, min=minVal, max=maxVal,
		cw=[[1,60], [2,60], [3,100]])
	cmds.button(label="Key", 
		command=scriptName + ".key( '" + attr + "')")
	cmds.button(label="Reset",
		command=scriptName + ".reset( '" + attr + "', " + str(reset) + ")")
	

	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 Steps to working with formLayout
1) Declair a formLayout.
2) Create GUI controls. (Must be named)
3) Position.

'''

# 1)
frm = cmds.formLayout()

# 2)
text = cmds.text( label=attrLabel, w=60 )
Beispiel #52
0
                cmds.setAttr(Curva + '.overrideColor', Color)

    #Do stuff for the Double Letters
    #print LetrasDobles
    for dl in LetrasDobles:
        dlPapa = cmds.listRelatives(dl, p=True)
        dlAbuelo = cmds.listRelatives(dlPapa, p=True)
        cmds.makeIdentity(dlAbuelo, a=True, t=True, r=True)
        cmds.parent(dl, Shape, r=True, s=True)
        cmds.setAttr(dl + '.overrideEnabled', 1)
        cmds.setAttr(dl + '.overrideColor', Color)

    #Organizing
    cmds.parent(Shape, w=True)
    cmds.rename(Shape, Texto + str('_CV'))
    cmds.delete(Text[0])
    cmds.delete(Texto + str('_CVShape'))
    cmds.move(-0.5, 0, 0, r=True)
    cmds.xform(cp=True)


cmds.window("TextCurve", width=250, title="Text to curves", toolbox=True)
cmds.columnLayout(adjustableColumn=True)
cmds.separator(h=10)
TextField = cmds.textField(editable=True, tx='')
ColoresSlider = cmds.floatSlider(min=-0, max=32, value=16, step=1)
cmds.button(label='Create curve', command=TextToCurve)
cmds.columnLayout()
cmds.separator(h=10)
cmds.showWindow("TextCurve")
Beispiel #53
0
 def layerOpacitySliderChanged(self,*args):
     self.controls.layerOpacity.setValue(cmds.floatSlider(self.controls.sliderIntensity,q=True,value=True))
     self.layerOpacityChanged()
Beispiel #54
0
def TextToCurve(Textisimo):
    #Im deleting one node so if theres one already in the scene i dont want to delete it
    if cmds.objExists('makeTextCurves1'):
        cmds.rename('makeTextCurves1', 'makeTextCurves1LOL')

    #Lets Create some curves
    Texto = '_' + cmds.textField(TextField, text=True, q=True)
    Color = cmds.floatSlider(ColoresSlider, q=True, value=16)

    LetrasDobles = []
    Text = cmds.textCurves(n=Texto, t=Texto, o=True)
    Lista = cmds.listRelatives(Text, ad=True)

    #print Lista
    Shape = Lista[1]
    #print Shape

    cmds.delete('makeTextCurves1')

    for Curva in Lista:
        if cmds.objectType(str(Curva), isType='nurbsCurve'):
            #print Curva
            #Get Parents
            curvaPapa = cmds.listRelatives(Curva, p=True)
            #print 'Curva papa ' + str(curvaPapa)
            curvaAbuelo = cmds.listRelatives(curvaPapa, p=True)
            #print 'curva Abuelo '+(curvaAbuelo[0])

            #letters like e and o have 2 curves instead of 1
            DobleCurva = cmds.listRelatives(curvaAbuelo)

            if len(DobleCurva) == 2:

                #print 'DobleCurva ' + str(DobleCurva)
                LetrasDobles.append(Curva)

            else:

                #parent to first shape
                if not Shape == curvaPapa[0]:
                    cmds.makeIdentity(curvaAbuelo, a=True, t=True, r=True)
                    cmds.parent(Curva, Shape, r=True, s=True)

                #Colores
                cmds.setAttr(Curva + '.overrideEnabled', 1)
                cmds.setAttr(Curva + '.overrideColor', Color)

    #Do stuff for the Double Letters
    #print LetrasDobles
    for dl in LetrasDobles:
        dlPapa = cmds.listRelatives(dl, p=True)
        dlAbuelo = cmds.listRelatives(dlPapa, p=True)
        cmds.makeIdentity(dlAbuelo, a=True, t=True, r=True)
        cmds.parent(dl, Shape, r=True, s=True)
        cmds.setAttr(dl + '.overrideEnabled', 1)
        cmds.setAttr(dl + '.overrideColor', Color)

    #Organizing
    cmds.parent(Shape, w=True)
    cmds.rename(Shape, Texto + str('_CV'))
    cmds.delete(Text[0])
    cmds.delete(Texto + str('_CVShape'))
    cmds.move(-0.5, 0, 0, r=True)
    cmds.xform(cp=True)
Beispiel #55
0
 def getIntensity(self):
     return cmds.floatSlider(self.sliderIntensity, q=True, value=True)
Beispiel #56
0
 def resetLength(self, *args):
     cmds.floatSlider(self.lengthSlider, edit=True, value=0.3)
     cmds.text(self.lengthSliderLabel, edit=True, label="0.3")
     self.gear.changeTeeth(teeth=self.gear.teeth)
 def mod_thickness(self, *args):
     newLinkRadius = cmds.floatSlider(self.thicknessSlider, q=True, v=True)
     self.chain.change_chain(thickness=newLinkRadius)
def resetSlide(attr,controlAttributos,value,slider,*args):
    cmds.floatSlider(slider,e=True,value=value)
    rotLayer(attr,controlAttributos,slider)
 def updateTargetValue(self,*args):
     for i,tgt in enumerate(target_nodes):
         last_value = cmds.blendShape(blendshape_node[0],q=True,w=True)
         cur_value = cmds.floatSlider("{0}FltSld".format(tgt),q=True,v=True)
         if cur_value != last_value:
             cmds.blendShape(blendshape_node[0],e=True,w=(i,cur_value))
Beispiel #60
0
 def reset(self, *args):
     cmds.floatSlider(self.slider, edit=True, value=50)