python类text()的实例源码

zbw_randomSelection.py 文件源码 项目:zTools 作者: zethwillie 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def randomSelectionUI(*args):
    if cmds.window("win", exists = True):
        cmds.deleteUI("win")

    widgets["win"] = cmds.window("win", w=280, h=75, t="zbw_randomSelection")

    widgets["mainCLO"] = cmds.columnLayout()
    widgets["text"] = cmds.text("What percent of selection do you want to keep?")
    widgets["keepIFG"] = cmds.intFieldGrp(l=" % to keep:", v1=50, h=40, cw = ([1, 65], [2, 50]), cal = ([1,"left"], [2, "left"]))
    widgets["text2"] = cmds.text("Random: each obj has % chance to be removed")
    widgets["text3"] = cmds.text("Precise: exact num removed, but randomly chosen")
    cmds.separator(h=10)
    widgets["typeRBG"] = cmds.radioButtonGrp(l="Type:", l1 = "Random Remove", l2 = "Precise Remove", nrb = 2, sl = 1, cw = ([1, 30], [2,120], [3, 120], [4, 50]), cal = ([1, "left"], [2,"left"], [3, "left"], [4, "left"]))
    widgets["but"] = cmds.button(l="Reselect", w=280, h=40, bgc = (.6, .8, .6), c = doSel)

    cmds.window(widgets["win"], e=True, w=280, h=75)
    cmds.showWindow(widgets["win"])
convert_color_code.py 文件源码 项目:surume 作者: tm8r 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def _create_ui(self):
        u"""UI???"""
        safe_delete_window(self._WINDOW_NAME)
        win = cmds.window(self._WINDOW_NAME, t="Convert Color Code", mb=True, w=480, h=128)
        cmds.menu(l="Option")
        cmds.menuItem(l="ColorEditor", c=self.get_color_from_editor)
        cmds.columnLayout(adj=True, rs=2)
        self.color_code_field = cmds.textFieldButtonGrp(l="Color code", bl="Convert", bc=self._convert)
        self.decimal_point_field = cmds.intFieldGrp(l="Decimal point", nf=1, v1=2)
        self.result_field = cmds.textFieldGrp(l="Result")

        cmds.setParent("..")

        cmds.columnLayout(adj=True)
        self.color_preview = cmds.text(l="", h=24)
        cmds.setParent("..")
        cmds.showWindow(win)
convert_color_code.py 文件源码 项目:surume 作者: tm8r 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def _convert(self, *args):
        u"""?????????"""
        code = cmds.textFieldButtonGrp(self.color_code_field, q=True, tx=True)
        if len(code) == 7 and code.startswith("#"):
            code = code[1:]
        if len(code) != 6:
            return
        try:
            int(code, 16)
        except ValueError, e:
            print(e)
            return
        decimal_point = cmds.intFieldGrp(self.decimal_point_field, q=True, v1=True)
        r = round(int(code[0:2], 16) / 255, decimal_point)
        g = round(int(code[2:4], 16) / 255, decimal_point)
        b = round(int(code[4:6], 16) / 255, decimal_point)
        bgc = self._COLOR_FORMAT.format(str(r), str(g), str(b))
        cmds.textFieldGrp(self.result_field, e=True, tx=bgc)
        cmds.text(self.color_preview, e=True, bgc=[r, g, b])
zbw_findScript.py 文件源码 项目:zTools 作者: zethwillie 项目源码 文件源码 阅读 35 收藏 0 点赞 0 评论 0
def findScriptUI(*args):

    if cmds.window("findScript", exists = True):
        cmds.deleteUI("findScript")

    widgets["win"] = cmds.window("findScript", t="zbw_findPath", w=300, h=200)
    widgets["mainCLO"] = cmds.columnLayout()

    cmds.separator(h=10)
    widgets["textTx"] = cmds.text(l="Will search your active python paths. \nNo need for suffix (.py or .mel)\nNo wildcards(*). Just string, 3 chars min", al="left")
    cmds.separator(h=20)
    widgets["nameTFG"] = cmds.textFieldGrp(l="search for:", cw = [(1, 75), (2,200)], cal = [(1, "left"),(2, "right")])
    cmds.separator(h=20)
    widgets["searchBut"] = cmds.button(l="Search python paths!", w=300, h=50, bgc=(0,.6, 0), c=searchPaths)
    cmds.separator(h=20)

    widgets["resultTxt"] = cmds.textFieldGrp(l="results:", ed=False, w=300, cw = [(1, 75), (2,200)], bgc = (0,0,0) , cal = [(1, "left"),(2, "right")])

    cmds.showWindow(widgets["win"])
zbw_snap.py 文件源码 项目:zTools 作者: zethwillie 项目源码 文件源码 阅读 28 收藏 0 点赞 0 评论 0
def snapUI():
    """simple snap UI for snapping"""

    if cmds.window("snapWin", exists=True):
        cmds.deleteUI("snapWin", window=True)
        cmds.windowPref("snapWin", remove=True)

    widgets["win"] = cmds.window("snapWin", t="zbw_snap", w=210, h=100, rtf=True)
    widgets["mainCLO"] = cmds.columnLayout(w=210, h=100)
    cmds.text("Select the target object(s),\nthen the object(s) you want to snap", al="center", w=210)
    cmds.separator(h=5, style="single")
    widgets["cbg"] = cmds.checkBoxGrp(l="Options: ", ncb=2, v1=1, v2=1, l1="Translate", l2="Rotate", cal=[(1,"left"),(2,"left"), (3,"left")], cw=[(1,50),(2,75),(3,75)])
    widgets["avgRBG"] = cmds.radioButtonGrp(nrb=2, l1="Snap all to first", l2="Snap last to avg", cal=[(1,"left"),(2,"left"),(3,"left")], cw=[(1,100),(2,100)],sl=1)
    widgets["rpCB"] = cmds.checkBox(l="Use Rotate Pivot To Query Position?", v=1)
    widgets["snapPivCB"] = cmds.checkBox(l="Snap via pivot? (vs. translate value)", v=1)
    cmds.separator(h=5, style="single")
    widgets["snapButton"] = cmds.button(l="Snap obj(s)!", w=210, h=40, bgc=(.6,.8,.6), c=partial(snapIt, False))
    widgets["snapPivButton"] = cmds.button(l="Snap pivot!", w=210, h=20, bgc=(.8,.6,.6), c=partial(snapIt, True))

    cmds.window(widgets["win"], e=True, w=5, h=5)
    cmds.showWindow(widgets["win"])
zbw_messageMapper.py 文件源码 项目:zTools 作者: zethwillie 项目源码 文件源码 阅读 28 收藏 0 点赞 0 评论 0
def zbw_mmAddMObjs(*args):
    """
    adds textFields to the UI for adding target objects for the message attrs
    """
    #delete text confirm dialogue if it exists
    zbw_mmDeleteConfirm()
    #figure out what objects are already parented
    children = cmds.rowColumnLayout("mmRCLayout" , q=True, ca=True)
    #figure out where stuff goes (2 column layout, so divide by 2), 1 based
    if children:
        currentNum = len(children)/2 + 1
        currentTFG = "attr" + str(currentNum)
        currentTFBG = "obj" + str(currentNum)
    #if no objects exist . . .
    else:
        currentTFG = "attr1"
        currentTFBG = "obj1"

    cmds.textFieldGrp(currentTFG, l="addedAttr (ln)", cal=(1, "left"), cw2=(100, 150), p="mmRCLayout")
    cmds.textFieldButtonGrp(currentTFBG, l="messageObj", cal=(1, "left"), cw3=(75,150,50), p="mmRCLayout", bl="get", bc=partial(zbw_mmAddTarget, currentTFBG))


#proc to grab the attrs and create connections
zbw_messageMapper.py 文件源码 项目:zTools 作者: zethwillie 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def zbw_mmChangeConnectAttrUI(base, attr, obj, *args):
    if (cmds.window('zbw_mmChangeAttrUI', exists=True)):
        cmds.deleteUI('zbw_mmChangeAttrUI', window=True)
        cmds.windowPref('zbw_mmChangeAttrUI', remove=True)
    window=cmds.window('zbw_mmChangeAttrUI', widthHeight=(400,80), title='zbw_messageMapper_changeAttrName')
    cmds.columnLayout()
    #show old attr name
    cmds.text("old attribute name: " + attr)
    #asks for the new attr name
    cmds.textFieldGrp("zbw_mmChangeAttrTFG", l="new attr name (just attr name)")
    #button to do it (pass along attr, obj)
    cmds.button("zbw_mmChangeAttrB", l="change attr!", c=partial(zbw_mmChangeConnectAttr, base, attr, obj))
    cmds.showWindow(window)
    #force window to size
    cmds.window('zbw_mmChangeAttrUI', e=True, widthHeight = (400,80))
    pass
zbw_messageMapper.py 文件源码 项目:zTools 作者: zethwillie 项目源码 文件源码 阅读 30 收藏 0 点赞 0 评论 0
def zbw_mmChangeConnectObjUI(base, attr, obj, *args):
    if (cmds.window('zbw_mmChangeObjUI', exists=True)):
        cmds.deleteUI('zbw_mmChangeObjUI', window=True)
        cmds.windowPref('zbw_mmChangeObjUI', remove=True)
    window=cmds.window('zbw_mmChangeObjUI', widthHeight=(400,85), title='zbw_messageMapper_changeObjName')
    cmds.columnLayout()
    #show old attr name
    cmds.text("base attribute name: " + attr)
    cmds.text("old connected obj name: " + obj)
    #asks for the new attr name
    cmds.textFieldButtonGrp("zbw_mmChangeObjTFBG", l="select new obj: ", bl="get", bc=partial(zbw_mmAddTarget, "zbw_mmChangeObjTFBG"))
    #button to do it (pass along attr, obj)
    cmds.button("zbw_mmChangeObjB", l="change obj!", c=partial(zbw_mmChangeConnectObj, base, attr, obj))
    cmds.showWindow(window)
    #force window to size
    cmds.window('zbw_mmChangeObjUI', e=True, widthHeight = (420,85))
zbw_modelSequence.py 文件源码 项目:zTools 作者: zethwillie 项目源码 文件源码 阅读 31 收藏 0 点赞 0 评论 0
def modelSequenceUI(*args):
    if (cmds.window("modSeq", exists=True)):
        cmds.deleteUI("modSeq")

    widgets["win"] = cmds.window("modSeq", w = 300, h = 220, t = "zbw_modelSequence")
    widgets["mainCLO"] = cmds.columnLayout(w = 300,h = 220)

    cmds.separator(h=10)
    cmds.text("Select ONE object to be duplicated \nThis will duplicate it for frames selected and group", al="left")
    cmds.separator(h=20)

    #textFieldGRP - name of objs
    widgets["sufTFG"] = cmds.textFieldGrp(l="Sequence Suffix:", cw = [(1, 100), (2,200)], cal = [(1, "left"),(2, "right")])
    #radioButtonGrp - timeslider or frame range
    widgets["frmRBG"] = cmds.radioButtonGrp(l="Get Frames From:", nrb=2, sl=2, l1="Time Slider", l2="Frame Range", cw = [(1, 120), (2,80), (3,80)], cal = [(1, "left"),(2, "left")], cc=enableFR)
    #textFieldGrp - framerange (enable)
    widgets["frmRngIFG"] = cmds.intFieldGrp(l="Range:", nf=2, en=True, v1=0, v2 = 9, cw = [(1, 120), (2,80), (3,80)], cal = [(1, "left"),(2, "left")])
    #int = by frame step
    widgets["stepIFG"] = cmds.intFieldGrp(l="Step By (frames):", v1 = 1, cw = [(1, 120), (2,80)], cal = [(1, "left"),(2, "right")])

    cmds.separator(h=30)
    widgets["doBut"] = cmds.button(l="Create duplicates of objects!", w= 300, h=40, bgc = (0,.8, 0), c=getValues)


    cmds.showWindow(widgets["win"])
zbw_dupeSwap.py 文件源码 项目:zTools 作者: zethwillie 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def dupeSwapUI():
    """UI for script"""

    if cmds.window("dupeWin", exists=True):
        cmds.deleteUI("dupeWin")

    cmds.window("dupeWin", t="zbw_dupeSwap", w=250, h=100)
    cmds.columnLayout("dupeCLO")
    cmds.text("Select the initial object. then select the", al="center", w=250)
    cmds.text("duplicates and press button", al="center", w=250)
    cmds.separator(h=5, style ="single")
    cmds.radioButtonGrp("inputsRBG", l="inputs:", nrb=3, l1="none", l2="connect", l3="duplicate", cw=[(1, 50), (2,47), (3,63), (4,40)], cal=[(1,"left"), (2,"left"), (3,"left"), (4,"left")], sl=1)
    cmds.separator(h=5, style ="single")

    cmds.button("dupeButton", l="Swap Elements", w=250, h=50, bgc=(.6, .8,.6), c=dupeIt)

    cmds.showWindow("dupeWin")
    cmds.window("dupeWin", e=True, w=250, h=100)
zbw_attributes.py 文件源码 项目:zTools 作者: zethwillie 项目源码 文件源码 阅读 29 收藏 0 点赞 0 评论 0
def connectShapeVis(*args):
    """Connects the attr from the assoc. text field to the shape Visibility of selected objects"""

    sel = cmds.ls(sl=True, type="transform")
    driver = cmds.textFieldButtonGrp(widgets["toShapeVis"], q=True, tx=True)

    if sel:
        if driver:
            for obj in sel:
                shapes = cmds.listRelatives(obj, s=True)
                for shape in shapes:
                    try:
                        cmds.connectAttr(driver, "%s.v" % shape, f=True)
                        cmds.warning("Connected %s to %s" % (driver, shape))
                    except:
                        cmds.warning("Couldn't connect %s to %s. Sorry! Check the Script Editor." % (driver, shape))
    else:
        cmds.warning("You need to select an object to connect the shape.vis!")
ml_stopwatch.py 文件源码 项目:ml_tools 作者: morganloomis 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def ui():
    '''
    User interface for stopwatch
    '''

    with utl.MlUi('ml_stopwatch', 'Stopwatch', width=400, height=175, info='''Press the start button to start recording.
Continue pressing to set marks.
When finished, press the stop button and the report will pop up.''') as win:

        mc.checkBoxGrp('ml_stopwatch_round_checkBox',label='Round to nearest frame', value1=True, annotation='Only whole number frames')

        mc.text('ml_stopwatch_countdown_text', label='Ready...')

        mc.button('ml_stopwatch_main_button', label='Start', height=80)
        _setButtonStart()
        mc.button(label='Stop', command=_stopButton, annotation='Stop the recording.')
ml_utilities.py 文件源码 项目:ml_tools 作者: morganloomis 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def about(self, *args):
        '''
        This pops up a window which shows the revision number of the current script.
        '''

        text='by Morgan Loomis\n\n'
        try:
            __import__(self.module)
            module = sys.modules[self.module]
            text = text+'Revision: '+str(module.__revision__)+'\n'
        except StandardError:
            pass
        try:
            text = text+'ml_utilities Rev: '+str(__revision__)+'\n'
        except StandardError:
            pass

        mc.confirmDialog(title=self.name, message=text, button='Close')
ml_utilities.py 文件源码 项目:ml_tools 作者: morganloomis 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def _populateSelectionField(self, channel, field, *args):

        selectedChannels = None
        if channel:
            selectedChannels = getSelectedChannels()
            if not selectedChannels:
                raise RuntimeError('Please select an attribute in the channelBox.')
            if len(selectedChannels) > 1:
                raise RuntimeError('Please select only one attribute.')

        sel = mc.ls(sl=True)
        if not sel:
            raise RuntimeError('Please select a node.')
        if len(sel) > 1:
            raise RuntimeError('Please select only one node.')

        selection = sel[0]
        if selectedChannels:
            selection = selection+'.'+selectedChannels[0]

        mc.textFieldButtonGrp(field, edit=True, text=selection)
ml_colorControl.py 文件源码 项目:ml_tools 作者: morganloomis 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def colorControlLayout(self, label=''):
        mc.rowLayout( numberOfColumns=4, 
                      columnWidth4=(150, 200, 90, 80), 
                      adjustableColumn=2, 
                      columnAlign=(1, 'right'), 
                      columnAttach=[(1, 'both', 0), 
                                    (2, 'both', 0), 
                                    (3, 'both', 0), 
                                    (4, 'both', 0)] )
        mc.text(label=label)
        colorSlider = mc.colorSliderGrp( label='', adj=2, columnWidth=((1,1),(3,1)))
        mc.button(label='From Selected', 
                  ann='Get the color of the selected object.',
                  command=partial(self.setFromSelected, colorSlider)) 
        mc.button(label='Randomize', 
                  ann='Set a random color.', 
                  command=partial(self.randomizeColors, colorSlider))
        controls = mc.layout(colorSlider, query=True, childArray=True)

        mc.setParent('..')

        return colorSlider
ml_breakdown.py 文件源码 项目:ml_tools 作者: morganloomis 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def quickBreakDownUI():
    winName = 'ml_quickBreakdownWin'
    if mc.window(winName, exists=True):
        mc.deleteUI(winName)

    mc.window(winName, title='ml :: QBD', iconName='Quick Breakdown', width=100, height=500)

    mc.columnLayout(adj=True)

    mc.paneLayout(configuration='vertical2', separatorThickness=1)
    mc.text('<<')
    mc.text('>>')
    mc.setParent('..')

    for v in (10,20,50,80,90,100,110,120,150):
        mc.paneLayout(configuration='vertical2',separatorThickness=1)

        mc.button(label=str(v)+' %', command=partial(weightPrevious,v/100.0))
        mc.button(label=str(v)+' %', command=partial(weightNext,v/100.0))
        mc.setParent('..')

    mc.showWindow(winName)

    mc.window(winName, edit=True, width=100, height=250)
clock.py 文件源码 项目:mTasks 作者: theodox 项目源码 文件源码 阅读 39 收藏 0 点赞 0 评论 0
def update_time():
    '''
    update the clock display.  This will be called once very second by the repeat task.  It
    does need to yield at the end to allow time-slicing, however
    '''
    now = datetime.datetime.now().time()
    time_string = now.strftime("%-I:%M %S %p")

    hours, seconds, ampm = time_string.split()

    hour_style = "font-size:64px; font-family: Impact; color: #8A0F21"
    sec_style = "font-size:18px; font-family:Arial Black; color: #8A0F21"
    am_style = "font-size:24px; font-family:Arial Black; font-weight:900; color: #700D21"

    def set_control (ctl, value, style):
        def make_text(text, style):
            return '<span style="{0}">{1}</span>'.format(style, text)
        cmds.text(ctl, e=True, label = make_text(value, style))

    set_control(hour, hours, hour_style)
    set_control(secs, seconds, sec_style)
    set_control(am, ampm, am_style)
    yield

# set up the update job to repeat every second
tweener.py 文件源码 项目:PythonForMayaSamples 作者: dgovil 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def buildUI(self):
        # To start with we create a layout to hold our UI objects
        # A layout is a UI object that lays out its children, in this case in a column
        column = cmds.columnLayout()

        # Now we create a text label to tell a user how to use our UI
        cmds.text(label="Use this slider to set the tween amount")

        # We want to put our slider and a button side by side. This is not possible in a columnLayout, so we use a row
        row = cmds.rowLayout(numberOfColumns=2)

        # We create a slider, set its minimum, maximum and default value.
        # The changeCommand needs to be given a function to call, so we give it our tween function
        # We need to hold on to our slider's name so we can edit it later, so we hold it in a variable
        self.slider = cmds.floatSlider(min=0, max=100, value=50, step=1, changeCommand=tween)

        # Now we make a button to reset our UI, and it calls our reset method
        cmds.button(label="Reset", command=self.reset)

        # Finally we don't want to add anymore to our row layout but want to add it to our column again
        # So we must change the active parent layout
        cmds.setParent(column)

        # We add a button to close our UI
        cmds.button(label="Close", command=self.close)

    # *args will be a new concept for you
    # It basically means I do not know how many arguments I will get, so please put them all inside this one list (tuple) called args
reusableUI.py 文件源码 项目:PythonForMayaSamples 作者: dgovil 项目源码 文件源码 阅读 28 收藏 0 点赞 0 评论 0
def buildUI(self):
        column = cmds.columnLayout()
        cmds.text(label="Use this slider to set the tween amount")

        cmds.rowLayout(numberOfColumns=2)
        self.slider = cmds.floatSlider(min=0, max=100, value=50, step=1, changeCommand=tweener.tween)
        cmds.button(label="Reset", command=self.reset)

        cmds.setParent(column)
        cmds.button(label="Close", command=self.close)

    # And again, we just need to override the reset method
    # We don't need to define the close, or show methods because it gets those from BaseWindow
reusableUI.py 文件源码 项目:PythonForMayaSamples 作者: dgovil 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def buildUI(self):
        column = cmds.columnLayout()
        cmds.text(label="Use the slider to modify the number of teeth the gear will have")

        cmds.rowLayout(numberOfColumns=4)

        # This label will show the number of teeth we've set
        self.label = cmds.text(label="10")
        # Unlike the tweener, we use an integer slider and we set it to run the modifyGear method as it is dragged
        self.slider = cmds.intSlider(min=5, max=30, value=10, step=1, dragCommand=self.modifyGear)
        cmds.button(label="Make Gear", command=self.makeGear)
        cmds.button(label="Reset", command=self.reset)

        cmds.setParent(column)
        cmds.button(label="Close", command=self.close)
reusableUI.py 文件源码 项目:PythonForMayaSamples 作者: dgovil 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def modifyGear(self, teeth):
        # When the slider is changes, this method will be called.
        # First we will update the label that displays the number of teeth
        # the str() function converts the number into a string
        cmds.text(self.label, edit=True, label=str(teeth))

        # If there is a gear already made, then we will set the slider to edit it
        if self.gear:
            self.gear.changeTeeth(teeth=teeth)
reusableUI.py 文件源码 项目:PythonForMayaSamples 作者: dgovil 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def reset(self, *args):
        # When we reset, we will intentionally say we're done with this gear, move on to the next one
        # So moving the slider now will not adjust an existing gear
        self.gear = None

        # We will reset the slider value
        cmds.intSlider(self.slider, edit=True, value=10)

        # And finally reset the label value
        # the str() function converts the number into a string
        cmds.text(self.label, edit=True, label=str(10))
NinjaRipperMayaImportTools.py 文件源码 项目:NinjaRipperMayaImportTools 作者: T-Maxxx 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def printDebug(text):
    if g_debugMessages is True:
        print(text)
NinjaRipperMayaImportTools.py 文件源码 项目:NinjaRipperMayaImportTools 作者: T-Maxxx 项目源码 文件源码 阅读 30 收藏 0 点赞 0 评论 0
def printMessage(text):
    mel.eval("print \"[NR]: {}\\n\"".format(text))
check_layout.py 文件源码 项目:surume 作者: tm8r 项目源码 文件源码 阅读 30 收藏 0 点赞 0 评论 0
def show_ui(self):
        u"""Window???"""
        if cmds.window(self._WINDOW_NAME, exists=True):
            cmds.deleteUI(self._WINDOW_NAME)

        self.window = cmds.window(self._WINDOW_NAME,
                                  t=self._WINDOW_TITLE,
                                  width=340,
                                  maximizeButton=False, minimizeButton=False)

        form = cmds.formLayout()
        field_group = cmds.columnLayout(adj=True, cal="center", rs=self._MARGIN)
        cmds.text(u"""???????????????????????????????
????????????????????????????""", al="left")
        self.text_scroll = cmds.textScrollList(append=self.get_windows(), ams=False, dcc=self.check_execute)
        self.text_field = cmds.textFieldGrp(l=u"????", ad2=2, cl2=["left", "left"], cw=[1, 60])
        cmds.setParent("..")

        button_group = cmds.columnLayout(adj=True, cal="center")
        cmds.button(l="Check", c=self.check_execute)
        cmds.setParent("..")

        cmds.formLayout(form, e=True,
                        attachForm=[(field_group, "top", self._MARGIN),
                                    (field_group, "left", self._MARGIN),
                                    (field_group, "right", self._MARGIN),
                                    (button_group, "bottom", self._MARGIN),
                                    (button_group, "left", self._MARGIN),
                                    (button_group, "right", self._MARGIN)],
                        attachControl=[(button_group, "top", self._MARGIN, field_group)])
        cmds.setParent("..")

        cmds.showWindow(self.window)
fov_converter.py 文件源码 项目:surume 作者: tm8r 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def _create_ui(self):
        safe_delete_window(self._WINDOW_NAME)

        win = cmds.window(self._WINDOW_NAME)

        form = cmds.formLayout()
        field_group = cmds.columnLayout(adj=True, cal="center", rs=self._MARGIN)
        cmds.text(u"????????focalLength?????Unity?FOV?????????????", al="left")
        self.text_scroll = cmds.textScrollList(append=self._get_cameras(), ams=False, dcc=self._select)
        self.text_field = cmds.textFieldGrp(l=u"FOV", ad2=2, cl2=["left", "left"], cw=[1, 60])
        self.result_field = cmds.textFieldGrp(l=u"Result", ad2=2, cl2=["left", "left"], cw=[1, 60])
        cmds.setParent("..")

        button_group = cmds.columnLayout(adj=True, cal="center")
        cmds.button(l="Apply", c=self._apply)
        cmds.setParent("..")

        cmds.formLayout(form, e=True,
                        attachForm=[(field_group, "top", self._MARGIN),
                                    (field_group, "left", self._MARGIN),
                                    (field_group, "right", self._MARGIN),
                                    (button_group, "bottom", self._MARGIN),
                                    (button_group, "left", self._MARGIN),
                                    (button_group, "right", self._MARGIN)],
                        attachControl=[(button_group, "top", self._MARGIN, field_group)])
        cmds.setParent("..")

        cmds.showWindow(win)
convert_color_code.py 文件源码 项目:surume 作者: tm8r 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def get_color_from_editor(self, *args):
        u"""colorEditor??????"""
        res = cmds.colorEditor()
        if "1" != res.split()[3]:
            return
        result = cmds.colorEditor(query=True, rgb=True)
        decimal_point = cmds.intFieldGrp(self.decimal_point_field, q=True, v1=True)
        r = round(result[0], decimal_point)
        g = round(result[1], decimal_point)
        b = round(result[2], decimal_point)
        bgc = self._COLOR_FORMAT.format(str(r), str(g), str(b))
        cmds.textFieldGrp(self.result_field, e=True, tx=bgc)
        cmds.text(self.color_preview, e=True, bgc=[r, g, b])
zbw_animShift.py 文件源码 项目:zTools 作者: zethwillie 项目源码 文件源码 阅读 28 收藏 0 点赞 0 评论 0
def clearAll(self, *args):
        """clears all the fields"""
        fieldNames = ["origTxFFG", "origTyFFG", "origTzFFG", "origSxFFG", "origSyFFG", "origSzFFG", "origRxFFG", "origRyFFG", "origRzFFG", "modTxFFG", "modTyFFG", "modTzFFG", "modRxFFG", "modRyFFG", "modRzFFG", "modSxFFG", "modSyFFG", "modSzFFG", "difTxFFG", "difTyFFG", "difTzFFG", "difRxFFG", "difRyFFG", "difRzFFG", "difSxFFG", "difSyFFG", "difSzFFG"]
        cmds.textFieldGrp(self.widgets["baseTFG"], e=True, tx="")
        for field in fieldNames:
            cmds.floatFieldGrp(self.widgets[field], e=True, v1=0)
        cmds.floatFieldGrp(self.widgets["baseFrameFFG"], e=True, v1=0)
        cmds.text(self.widgets["doneText"], e=True, l="No Status/All Cleared. Select a base object!", bgc=(.5,.5,.5))

    # def restoreBase(self, *args):
    #   """restores the base obj to the text field"""

    #   cmds.textFieldGrp(self.widgets["baseTFG"], e=True, tx=self.baseObj)
    #   cmds.floatFieldGrp(self.widgets["baseFrameFFG"], e=True, v1=self.frame)
zbw_window.py 文件源码 项目:zTools 作者: zethwillie 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def commonUI(self):
        #########  modify for inheritence ###########
        cmds.text('this is where the common UI elements go')
        cmds.separator(h=100)
        pass
zbw_window.py 文件源码 项目:zTools 作者: zethwillie 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def customUI(self):
        #########  modify for inheritence ###########
        cmds.text("this is where the custom UI elements go")
        cmds.separator(h=200)
        pass


问题


面经


文章

微信
公众号

扫码关注公众号