示例#1
0
def __pumpQt():
    import maya.utils as utils
    import time
    global app
    while 1:
        time.sleep(0.01)
        utils.executeDeferred(app.processEvents)
示例#2
0
 def checkin(s):
     """ Record activity state """
     try:
         activity.Monitor.checkin(s)
     except Exception as err:
         utils.executeDeferred(traceback.print_exc)
         raise err
示例#3
0
def send_to_arduino(interval):
    from maya import cmds
    import maya.utils as utils
    import serial

    global ARDUINO_SERIAL_ADRESS
    ser = serial.Serial(ARDUINO_SERIAL_ADRESS, 9600, timeout=1)

    def read_and_send():

        global tracked

        angle = cmds.getAttr(tracked + ".ry")
        if (0 <= angle <= 180):
            ser.write(str(round(angle, 3)))
        else:
            print "Servo angle must be an integer between 0 and 180.\n"

    while True:
        time.sleep(interval)
        utils.executeDeferred(read_and_send)
        # always use executeDeferred or evalDeferredInMainThreadWithResult\
        # if you're running a thread in Maya!
        # Read the serial value
        global stop_threads

        if stop_threads:
            break
示例#4
0
def pumpQt():
	global app
	def processor():
		app.processEvents()

	while 1:
		time.sleep(0.01)
		utils.executeDeferred( processor )
示例#5
0
def closeNextDialogWithResult(result):
    '''
    close next modal dialog with given result
    '''
    if Utils.getMayaVersion()>=Utils.MAYA2011:
        mUtils.executeDeferred(lambda:BaseDialog.currentDialog.closeDialogWithResult(result))
    else:
        Utils.displayError("hurray for maya 2009, close dialog manually with result "+result)
示例#6
0
 def loop(s):
     try:
         while s.playing:
             s.sem.acquire()
             utils.executeDeferred(cmds.scriptJob, ro=True, e=("idle", s.update))
             time.sleep(s.fps)
     except Exception as err:
         utils.executeDeferred(print, "Loop error:", err)
示例#7
0
 def execute(self):
     from maya import utils as mu
     from ngSkinTools.ui.mainwindow import MainWindow
     
     BaseToolWindow.closeAllWindows()
     
     deleteCustomOptions()
     
     mu.executeDeferred(MainWindow.open)
示例#8
0
def pumpQt():
    global app

    def processor():
        app.processEvents()

    while 1:
        time.sleep(0.01)
        utils.executeDeferred(processor)
示例#9
0
    def execute(self):
        from maya import utils as mu
        from ngSkinTools.ui.mainwindow import MainWindow

        BaseToolWindow.closeAllWindows()

        deleteCustomOptions()

        mu.executeDeferred(MainWindow.open)
示例#10
0
 def _close_parent_window(self):
     """helper routine closing the parent window if there is one"""
     p = self.parent()
     if isinstance(p, ui.Window):
         # If its not deferred, it will crash maya for some reason, maybe
         # something related to garbage collection.
         mutil.executeDeferred(self.parent().delete)
     elif isinstance(p, ui.FormLayout) and p.startswith("layoutDialog"):
         cmds.layoutDialog(dismiss="close")
def refreshWindow(*args):
	layout_name = pm.rowColumnLayout(lights_layout, q=True, fpn=True)
	utils.executeDeferred("import pymel.core as pm;pm.deleteUI('{0}')".format(layout_name))
	lights_area()

	ibl_list = pm.ls(type='mentalrayIblShape')
	if ibl_list != []:
		ibl_btn.setImage1(get_icon_path('deleteIBL_icon.png'))
	else:
		ibl_btn.setImage1(get_icon_path('IBL_icon.png'))
示例#12
0
文件: line_edit.py 项目: utsdab/usr
    def _animateText(self):
        stop_animating = True
        for key, value in self._text_glow.items():
            if value > 0:
                stop_animating = False
                self._text_glow[key] = value - 1

        if stop_animating:
            self._anim_timer.stop()

        utils.executeDeferred(self.update)
示例#13
0
 def idle_loop(s):
     """ Loop and watch idle states """
     while s._active:
         if not s.idle:
             s.checkin()
         s.idle = False
         s.sem.acquire()  # Throttle our requests
         utils.executeDeferred(s.idle_job)
         time.sleep(
             0.3
         )  # Further throttle our checks. Doesn't catch everything, but catches enough to be reliable.
示例#14
0
    def _removeTrackingPoints(self):
        self._track = False
        for index, value in enumerate(self._tracking_points):
            if value > 0:
                self._tracking_points[index] -= 1
                self._track = True

        if self._track is False:
            self._anim_follow_timer.stop()

        utils.executeDeferred(self.update)
示例#15
0
def closeNextDialogWithResult(result):
    '''
    close next modal dialog with given result
    '''
    if Utils.getMayaVersion() >= Utils.MAYA2011:
        mUtils.executeDeferred(
            lambda: BaseDialog.currentDialog.closeDialogWithResult(result))
    else:
        Utils.displayError(
            "hurray for maya 2009, close dialog manually with result " +
            result)
示例#16
0
 def run(self):
     while _running:
         time.sleep(0.05)
         color = pm.dt.Color()
         hue = time.time() * self.speed % 1 * 360
         color.set('HSV', hue, 1, 0.3)
         executeDeferred(pm.mel.displayRGBColor, 'backgroundBottom',
                         color.r, color.g, color.b)
         color.set('HSV', hue, 0.3, 1)
         executeDeferred(pm.mel.displayRGBColor, 'backgroundTop', color.r,
                         color.g, color.b)
示例#17
0
    def _animateText(self):
        stop_animating = True
        for key, value in self._text_glow.items():
            if value > 0:
                stop_animating = False
                self._text_glow[key] = value - 1

        if stop_animating:
            self._anim_timer.stop()

        utils.executeDeferred(self.update)
示例#18
0
    def _confirm_button_pressed(self, *args):
        if not self.stack.base_items:
            raise ValueError("Please add at least one item to the stack and retry")
        # END handle empty refs

        # create refs
        self._create_references(self.stack.base_items)

        # finally let base take care of the rest
        # NOTE: Needs to be deferred, crashes otherwis
        mutil.executeDeferred(super(FileReferenceFinder, self)._confirm_button_pressed)
示例#19
0
    def _removeTrackingPoints(self):
        self._track = False
        for index, value in enumerate(self._tracking_points):
            if value > 0:
                self._tracking_points[index] -= 1
                self._track = True

        if self._track is False:
            self._anim_follow_timer.stop()

        utils.executeDeferred(self.update)
示例#20
0
def setup_flottitools():
    make_flottitools_shelf()
    usersetup_path = get_maya_usersetup_path()
    usersetup_lines = get_usersetup_lines()
    inject_flottisetup_to_maya_usersetup(usersetup_path, usersetup_lines)

    if FLOTTI_DIR not in sys.path:
        sys.path.append(r'D:/git_repos')
    remove_menu()
    import maya.utils as mayautils
    mayautils.executeDeferred(
        'import flottitools; flottitools.load_flotti_tools()')
示例#21
0
 def execute(self):
     from maya import utils as mu
     from ngSkinTools.ui.mainwindow import MainWindow
     
     BaseToolWindow.closeAllWindows()
     
     variablePrefix = "ngSkinTools"
     for varName in cmds.optionVar(list=True):
         if varName.startswith(variablePrefix):
             cmds.optionVar(remove=varName)
     
     mu.executeDeferred(MainWindow.open)
示例#22
0
    def execute(self):
        from maya import utils as mu
        from ngSkinTools.ui.mainwindow import MainWindow

        BaseToolWindow.closeAllWindows()

        variablePrefix = "ngSkinTools"
        for varName in cmds.optionVar(list=True):
            if varName.startswith(variablePrefix):
                cmds.optionVar(remove=varName)

        mu.executeDeferred(MainWindow.open)
示例#23
0
文件: __init__.py 项目: 3dzayn/pype
    def safe_deferred(fn):
        """Execute deferred the function in a try-except"""
        def _fn():
            """safely call in deferred callback"""
            try:
                fn()
            except Exception as exc:
                print(exc)

        try:
            utils.executeDeferred(_fn)
        except Exception as exc:
            print(exc)
示例#24
0
 def threaded_upload():
     current_webhook = gt_mtod_vfs_announcement.get(
         'current_webhook')
     try:
         validity = get_discord_webhook_validity(
             current_webhook)
         if validity[0]:
             utils.executeDeferred(disable_buttons)
             response = discord_post_message(
                 gt_mtod_vfs_announcement.get(
                     'discord_username'),
                 upload_message, current_webhook)
             utils.executeDeferred(enable_buttons)
             utils.executeDeferred(
                 parse_sending_response, response)
             utils.executeDeferred(
                 response_inview_feedback,
                 '"' + validity[1] + '" announcement',
                 response,
                 display_inview=True)
         else:
             update_text_status(error=True)
             cmds.warning(webhook_error_message)
     except:
         update_text_status(error=True)
         cmds.warning(webhook_error_message)
示例#25
0
    def _animateGlow(self):
        if self._hover:
            if self._glow_index >= 10:
                self._glow_index = 10
                self._anim_timer.stop()
            else:
                self._glow_index += 1

        else:
            if self._glow_index <= 0:
                self._glow_index = 0
                self._anim_timer.stop()
            else:
                self._glow_index -= 1

        utils.executeDeferred(self.update)
示例#26
0
    def _animateGlow(self):
        if self._hover:
            if self._glow_index >= 10:
                self._glow_index = 10
                self._anim_timer.stop()
            else:
                self._glow_index += 1

        else:
            if self._glow_index <= 0:
                self._glow_index = 0
                self._anim_timer.stop()
            else:
                self._glow_index -= 1

        utils.executeDeferred(self.update)
示例#27
0
 def threaded_upload():
     try:
         discord_post_message(
             get_username(), upload_message,
             gt_mtod_vfs_announcement.get(
                 'discord_webhook'))
         utils.executeDeferred(
             response_inview_feedback,
             operation_name,
             response,
             display_inview=gt_mtod_vfs_announcement.
             get('feedback_visibility'))
         utils.executeDeferred(clear_attached_message,
                               response)
     except Exception as e:
         print(e)
示例#28
0
    def _animate_glow(self):
        if self._hover:
            if self._glow_index >= 10:
                self._glow_index = 10
                self._anim_timer.stop()
            else:
                self._glow_index += 1

        else:
            if self._glow_index <= 0:
                self._glow_index = 0
                self._anim_timer.stop()
            else:
                self._glow_index -= 1

        if tp.Dcc.get_name() == tp.Dccs.Maya:
            import maya.utils as utils
            utils.executeDeferred(self.update)
示例#29
0
def add_my_python_tools():
    '''Add my python tools.'''
    system = os.name
    if system == 'nt':
        home_dir = os.environ['USERPROFILE']
    elif system == 'posix':
        home_dir = os.environ['HOME']
    else:
        print 'Unknown OS: {}. Cannot get home directory environment variable.'.format(
            system)
        return

    mytools_python = os.path.join(home_dir, 'myTools', 'python')
    add_to_sys_path(mytools_python)

    # Add my tools menu later.
    print 'Adding my tools menu (execute deferred)'
    from maya_tools import menu_tools
    utils.executeDeferred(menu_tools.create_my_menu)
    def _animateGlow(self):
        print " ANIMATE GLOW METHOD "

        if self.hover:
            if self._glow_index >= 10:
                self._glow_index = 10
                self._anim_timer.stop()

            else:
                self._glow_index += 1

        else:
            if self._glow_index <= 0:
                self._glow_index = 0
                self._anim_timer.stop()

            else:
                self._glow_index -= 1
        print self._glow_index
        utils.executeDeferred(self.update)
示例#31
0
 def createTx(self):
     if not self.txManager.selectedFiles:
         return
         
     ctrlPath = '|'.join([self.txManager.window, 'groupBox_2', 'pushButton_7']);
     utils.executeDeferred(cmds.button,ctrlPath, edit=True, enable=True);
         
     for texture in self.txManager.selectedFiles:
         if not texture:
             continue;
         # stopCreation has been called   
         if not self.txManager.process:
             break;
         # Process all the files that match the <udim> tag    
         if 'udim' in os.path.basename(texture):
             udims = getUdims(texture)
             for udim in udims:
                 # stopCreation has been called   
                 if not self.txManager.process:
                     break;
                 if self.makeTx(udim) is 0:
                     self.filesCreated += 1
                 else:
                     self.createdErrors += 1
                     
                     
                 utils.executeDeferred(updateProgressMessage, self.txManager.window, self.filesCreated, self.txManager.filesToCreate, self.createdErrors) 
                     
         else:
             if self.makeTx(texture) is 0:
                 self.filesCreated += 1
             else:
                 self.createdErrors += 1
                 
         utils.executeDeferred(updateProgressMessage, self.txManager.window, self.filesCreated, self.txManager.filesToCreate, self.createdErrors)
     
     ctrlPath = '|'.join([self.txManager.window, 'groupBox_2', 'pushButton_7']);
     utils.executeDeferred(cmds.button, ctrlPath, edit=True, enable=False);
     self.txManager.process = True
     utils.executeDeferred(self.txManager.updateList)
    def _animateGlow(self):
        if self.hover:
            if self._glow_index >= 10:
                self._glow_index = 10
                while self._glow_index > 8:
                    self._glow_index -= 0.25
                    #print self._glow_index
                    if self._glow_index == 8:
                        self._anim_timer.stop()

            else:
                self._glow_index += 1

        else:
            if self._glow_index <= 0:
                self._glow_index = 0
                self._anim_timer.stop()

            else:
                self._glow_index -= 1

        utils.executeDeferred(self.update)
示例#33
0
    def run(s, img, nt, root, version, anim):
        """ Version! """
        s.archive = os.path.join(root, version.group(0))
        with zipfile.ZipFile(s.archive, "r") as z:
            try:
                s.index = json.loads(z.read("index.json"))

                seq_images = [img_tag(a, HEIGHT-30, z.read(a)) for a in s.index.get("thumb_seq", [])]
                if seq_images:
                    seq = itertools.cycle(seq_images)
                    anim.anims[img] = seq

                created = datetime.datetime.strptime(s.index["time"], "%Y%m%d%H%M%S")
                desc = "created: {}\nnote: {}".format(created.strftime("%I:%M%p %a %d/%m/%Y"), s.index["note"])
                if tcmds.text(img, q=True, ex=True):
                    tcmds.text(img, e=True, l=img_tag(s.index.get("thumb", ""), HEIGHT-30, z.read(s.index["thumb"])), ann=desc)
                    tcmds.text(nt, e=True, l="{}...".format(s.index["note"][:17]) if len(s.index["note"]) > 20 else s.index["note"])
                    tcmds.popupMenu(p=img)
                    tcmds.menuItem(i="fileNew.png", l="Load this version. (temporary)", c=s.load)
                    tcmds.menuItem(i="reverseOrder.png", l="Revert back to this version.", c=s.revert)
            except KeyError as err:
                # No index file...
                utils.executeDeferred(print, "Missing index:", s.archive, err)
 def deleteSnapShot( self, *args ): 
     print "Deleting snapshot"
     import threading
     import maya.utils as utils
     
     cmds.undoInfo(openChunk = True)
     
     try:
         RenderLayerManagerFile.RenderLayerManagerClass.ShowModel(Visibility = False)
         
         SnapShotClass.UpdateImagePlane("CMForegroundPlane", "persp")
         
         #Call the destroy function from the snapshot class to remove the class objects
         SnapShotClass.SnapShots.pop( self.CurrentIndex ).destroy()
             
         #Update all names 
         for i in range( self.CurrentIndex, len( SnapShotClass.SnapShots )):
             SnapShotClass.SnapShots[i].UpdateIndex( i )
         
         #Check to see if there is a signature image in the current list
         SignatureFound = False
         for i in SnapShotClass.SnapShots:
             if cmds.getAttr(i.Camera +'.CMSignature'):
                 SignatureFound = True
                 SnapShotClass.UpdateImagePlane("CMForegroundPlane", i.Camera)
         
         #If not make the first image the signature
         if not SignatureFound and cmds.objExists("shot_0"):    
             cmds.setAttr('shot_0.CMSignature', True)
             SnapShotClass.UpdateImagePlane("CMForegroundPlane", "shot_0")
             #Adjust render layer adjustments
             RenderLayerManagerFile.RenderLayerManagerClass.assignSnapShots("shot_0")
         
         
         
         #Wait for the function to complete otherwise a memory error will crash maya
         threading.Thread(target=utils.executeDeferred(SnapShotClass.RecreateUI)).start()
         
         RenderLayerManagerFile.RenderLayerManagerClass.ShowModel(Visibility = True)
     except:
         raise
     
     finally:
         cmds.undoInfo(closeChunk = True)
     print "Snapshot deleted"
 def deleteTurntable( self, *args ): 
     
     import threading
     import maya.utils as utils
     
     cmds.undoInfo(openChunk = True)
     
     #Call the destroy function from the turntable class to remove the class objects
     TurntableClass.Turntables.pop( self.CurrentIndex ).destroy()
         
     #Update all names 
     for i in range( self.CurrentIndex, len( TurntableClass.Turntables )):
         TurntableClass.Turntables[i].Update( i )
     
     #Wait for the function to complete otherwise a memory error will crash maya
     threading.Thread(utils.executeDeferred(TurntableClass.RecreateUI)).start()
     
     cmds.undoInfo(closeChunk = True)
示例#36
0
 def emitDeffered(self, *args):
     import maya.utils as mu
     mu.executeDeferred(self.emit, *args)
示例#37
0
import maya.utils as utils
import re as re

version = sys.version
version26 = '2.6'
version27 = '2.7'
version26 = re.compile(version26)
version27 = re.compile(version27)
version26Check = re.findall(version26,version)
version27Check = re.findall(version27,version)

if version26Check != []:
	import auxilium_UI_python2_6 as auxilium_UI_python2_6
if version27Check != []:
	import auxilium_UI_python2_7 as auxilium_UI_python2_7

def create_auxilium_shelf():

	evalMel.eval('if (`shelfLayout -exists AuxiliumShelf `) deleteUI AuxiliumShelf;')
	evalMel.eval('global string $gShelfTopLevel;')
	evalMel.eval('global string $scriptsShelf;')
	evalMel.eval('$scriptsShelf = `shelfLayout -p $gShelfTopLevel AuxiliumShelf`;')
	if version26Check != []:
		evalMel.eval('shelfButton -parent $scriptsShelf -enableCommandRepeat 1 -enable 1 -width 32 -height 32 -manage 1 -visible 1 -preventOverride 0 -annotation "Auxilium: Maya Lighting and Rendering Tool" -enableBackground 0 -align "center" -label "Auxilium" -labelOffset 0 -font "plainLabelFont" -overlayLabelColor 0.8 0.8 0.8 -overlayLabelBackColor 0 0 0 0.25 -image "a_icon.png" -image1 "a_icon.png" -style "iconOnly" -marginWidth 1 -marginHeight 1 -sourceType "python" -command ("auxilium_UI_python2_6.Auxilium()") -commandRepeatable 1;') 
	if version27Check != []:
		evalMel.eval('shelfButton -parent $scriptsShelf -enableCommandRepeat 1 -enable 1 -width 32 -height 32 -manage 1 -visible 1 -preventOverride 0 -annotation "Auxilium: Maya Lighting and Rendering Tool" -enableBackground 0 -align "center" -label "Auxilium" -labelOffset 0 -font "plainLabelFont" -overlayLabelColor 0.8 0.8 0.8 -overlayLabelBackColor 0 0 0 0.25 -image "a_icon.png" -image1 "a_icon.png" -style "iconOnly" -marginWidth 1 -marginHeight 1 -sourceType "python" -command ("auxilium_UI_python2_7.Auxilium()") -commandRepeatable 1;') 		

utils.executeDeferred( create_auxilium_shelf )


示例#38
0
# !/usr/bin/python
# -*- coding: utf-8 -*-

import sys
import shutil
import maya.utils as mutils

sys.path.append(r'D:\pipeline\tools\maya\baseUI')


def import_mainMenu():
    import mainMenu


mutils.executeDeferred(import_mainMenu)
shutil.copyfile(r'D:\pipeline\tools\maya\baseUI\userSetup.py',
                r'C:\Users\Ding\Documents\maya\2017\scripts\userSetup.py')
示例#39
0
 def write(s, *t):
     t = "".join(t)
     if len(t.rstrip()):
         utils.executeDeferred(lambda: s.oldOut.write("%s\n" % t))
示例#40
0
def runInNextModalDialog(dialogExecutable):
    if Utils.getMayaVersion()>=Utils.MAYA2011:
        mUtils.executeDeferred(lambda:dialogExecutable(BaseDialog.currentDialog))
    else:
        BaseDialog.stuffToRunInNextModalDialogHack.append(dialogExecutable)
示例#41
0
    pm.optionVar (fv=("gridSpacing",100))

    mc.displayColor('gridAxis', 2, dormant=True)
    mc.displayColor('gridHighlight', 1, dormant=True)
    mc.displayColor('grid', 3, dormant=True)

    #setting the units
    pm.optionVar (sv=("workingUnitLinear", "cm"))
    pm.optionVar (sv=("workingUnitLinearDefault", "cm"))


def onClose():
    if 'FTRACK_TASKID' in os.environ.keys():
        session = ftrack_api.Session(
            server_url=os.environ['FTRACK_SERVER'],
            api_user=os.environ['FTRACK_API_USER'],
            api_key=os.environ['FTRACK_API_KEY']
        )
        task = session.query('Task where id is %s' % os.environ['FTRACK_TASKID'])
        user = session.query('User where username is %s' % os.environ['FTRACK_API_USER']).one()
        user.stop_timer()


def addQuitAppCallback():
    mc.scriptJob(e=["quitApplication", "onClose()"])


if maya.OpenMaya.MGlobal.mayaState() == 0:
    mc.evalDeferred("loadAndInit()")
    executeDeferred("addQuitAppCallback()")
示例#42
0
文件: viewport.py 项目: jonike/mvp
def deferred_close(view):
    panel = view.panel
    wait(0.1)
    utils.executeDeferred(cmds.deleteUI, panel, panel=True)
示例#43
0
文件: dialog.py 项目: adamcobabe/mrv
	def end( self ):
		"""Close the progress window"""
		# damn, has to be deferred to actually work
		super( ProgressWindow, self ).end( )
		mutils.executeDeferred( cmds.progressWindow, ep=1 )
示例#44
0
# Automatically add the menu items for the smooth weights tool upon Maya
# startup.
#
# ----------------------------------------------------------------------

from maya import cmds, mel, utils


def addMenuItems():
    if not cmds.about(batch=True):
        mel.eval(
            "source brSmoothWeightsCreateMenuItems; brSmoothWeightsAddMenuCommand;"
        )


utils.executeDeferred(addMenuItems)

# ----------------------------------------------------------------------
# MIT License
#
# Copyright (c) 2021 Ingo Clemens, brave rabbit
# brSmoothWeights and brTransferWeights are under the terms of the MIT
# License
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to
# permit persons to whom the Software is furnished to do so, subject to
# the following conditions:
示例#45
0
 def set(s, k, v):
     s.data[k] = v
     s.info["TODO_SETTINGS"] = json.dumps(s.data)
     if s.update:
         utils.executeDeferred(s.update)
 def __deleteRenderViewHideDockControl(*args):
     # If it's made visible we hide it and delete it.
     # We use executeDeferred because otherwise we'll get a fatal error. :)
     if mc.dockControl(UI_OBJ, q=1, visible=True):
         mc.dockControl(UI_OBJ, e=1, visible=False)
         mutils.executeDeferred(lambda: mc.deleteUI(UI_OBJ))
	def run(self):
		time.sleep(self.runTime)
		utils.executeDeferred(mel.eval, prepMelCommand(self.command))
示例#48
0
 def run(self):
     time.sleep(self.runTime)
     utils.executeDeferred(mel.eval, self.command)
示例#49
0
 def deferred(*args, **kwargs):
     executeDeferred(fn, *args, **kwargs)
示例#50
0
    toolsMenu = cmds.menuItem(p=fxpipeMenu, subMenu = 1, l="Tools")
    vrayMenu = cmds.menuItem(p=toolsMenu, subMenu = 1, to =1, l='VRay')
    mayaMenu = cmds.menuItem(p=toolsMenu, subMenu = 1, to = 1, l='Maya')
    # Tools Menu
    cmds.menuItem(p=mayaMenu, l='Remove Namespaces', c='from removeNamespaces import removeNamespaces;removeNamespaces()')
    cmds.menuItem(p=mayaMenu, l='Create Divider', c='from createDividerGroup import createDividerGroup;createDividerGroup()')
    cmds.menuItem(p=mayaMenu, l='Create BBox from Selected', c='import mayaUtils;mayaUtils.createBBoxFromSelected()')
    
    # VRay Menu
    # please note that even though we have imported vrayUtils, we need to do it again in the commands as it loses context.
    cmds.menuItem(p=vrayMenu, l='Set up basic render settings', c='import vrayUtils;vrayUtils.createBaseRenderSettings()')
    cmds.menuItem(p=vrayMenu, l='Add VRST output',c='import vrayUtils; vrayUtils.addDeepRenderOption()')
    cmds.menuItem(p=vrayMenu, l='Add Gamma to file nodes', c='import vrayUtils;vrayUtils.vrayAddGamma()')
    cmds.menuItem(p=vrayMenu, l='Add tech render passes', c='import vrayUtils;vrayUtils.createTechPasses()')
    cmds.menuItem(p=vrayMenu, l='Add Light Select Render Element', c='import vrayUtils;vrayUtils.createLightSelect()')
    cmds.menuItem(p=vrayMenu, l='Add Subdivision to selected objects', c='import vrayUtils;vrayUtils.addSubdivision()')
    cmds.menuItem(p=vrayMenu, l='Disable Subdivision on selected objects', c='import vrayUtils;vrayUtils.remSubdivision()')  
    cmds.menuItem(p=vrayMenu, l='Enable Subdivision on selected objects', c='import vrayUtils;vrayUtils.enableSubdivision()') 
    cmds.menuItem(p=vrayMenu, l='Add Object ID to Selected Objects', c='import vrayUtils;vrayUtils.addObjectID()') 
    cmds.menuItem(p=vrayMenu, l='Create Material Selects from Selected Shaders', c='import vrayUtils;vrayUtils.createMaterialSelect()')
    cmds.menuItem(p=vrayMenu, l='Convert files to tiled EXRs', c='import vrayUtils;vrayUtils.vrayConvertToTiledEXR()')
    
    if fxpipe.job != '':
        mayaJobPath = (os.path.join(fxpipe.jobPath, fxpipe.job, fxpipe.jobPathMaya))
        sys.path.append(mayaJobPath)
    
       
    

utils.executeDeferred('setupMayaPipe()') # wait until maya is ready to do the real work here...
示例#51
0
sys.path.append("D:\GraduatioProject\widget")
import _ui
reload(_ui)
win = _ui.PublishWidget()
win.show()
'''


def main_ui():
    #cmds.evalDeferred()
    cmds.menu('my_tool',
              label=u"Maya Pipeline",
              parent="MayaWindow",
              tearOff=True)
    cmds.menuItem("open", label=u"Open", parent='my_tool', c=openWin)
    cmds.menuItem("submite",
                  label=u"Submite File",
                  parent="my_tool",
                  c=saveWin)
    cmds.menuItem("publish",
                  label=u"Publish File",
                  parent="my_tool",
                  c=publishWin)
    cmds.setParent('..', menu=True)
    cmds.menuItem(divider=True, dividerLabel='Rough Render')
    cmds.menuItem("Play Blast", label=u"Play Blast", parent="my_tool")
    cmds.menuItem("Check and Fix", label=u"Check and Fix", parent="my_tool")


utils.executeDeferred(main_ui)
示例#52
0
 def go():
     while s.playing:
         s.limit.acquire()
         utils.executeDeferred(s.tick)
         time.sleep(1)
	def run(self):
		while(self.doRun):
			time.sleep(1.0/self.runTime)
			utils.executeDeferred(mel.eval, prepMelCommand(self.command)) #executeInMainThreadWithResult
示例#54
0
def runInNextModalDialog(dialogExecutable):
    if Utils.getMayaVersion() >= Utils.MAYA2011:
        mUtils.executeDeferred(
            lambda: dialogExecutable(BaseDialog.currentDialog))
    else:
        BaseDialog.stuffToRunInNextModalDialogHack.append(dialogExecutable)
示例#55
0
 def setGlowValue(self, value):
     self._glow_index = min(max(value/10, 0), 10)
     utils.executeDeferred(self.update)
示例#56
0
文件: ctx.py 项目: bob-white/mGui
 def exit(self, *args, **kwargs):
     utils.executeDeferred(self.reset_select_mask)
     if self.repeat:
         lazy_reset = lambda: cmds.setToolTo(self.context_name)
         utils.executeDeferred(lazy_reset)
示例#57
0
import maya.cmds as cmds
import maya.OpenMaya as openMaya


import maya.utils as utils
utils.executeDeferred ('import pythonScripts; pythonScripts.pythonScripts()')
# Copyright (C) 1997-2006 Autodesk, Inc., and/or its licensors.
# All rights reserved.
#
# The coded instructions, statements, computer programs, and/or related
# material (collectively the "Data") in these files contain unpublished
# information proprietary to Autodesk, Inc. ("Autodesk") and/or its licensors,
# which is protected by U.S. and Canadian federal copyright law and by
# international treaties.
#
# The Data is provided for use exclusively by You. You have the right to use,
# modify, and incorporate this Data into other products for purposes authorized 
# by the Autodesk software license agreement, without fee.
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND. AUTODESK
# DOES NOT MAKE AND HEREBY DISCLAIMS ANY EXPRESS OR IMPLIED WARRANTIES
# INCLUDING, BUT NOT LIMITED TO, THE WARRANTIES OF NON-INFRINGEMENT,
# MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, OR ARISING FROM A COURSE 
# OF DEALING, USAGE, OR TRADE PRACTICE. IN NO EVENT WILL AUTODESK AND/OR ITS
# LICENSORS BE LIABLE FOR ANY LOST REVENUES, DATA, OR PROFITS, OR SPECIAL,
# DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES, EVEN IF AUTODESK AND/OR ITS
# LICENSORS HAS BEEN ADVISED OF THE POSSIBILITY OR PROBABILITY OF SUCH DAMAGES.

示例#58
0
文件: viewport.py 项目: mkolar/mvp
def deferred_close(view):
    panel = view.panel
    wait(0.1)
    utils.executeDeferred(cmds.deleteUI, panel, panel=True)
示例#59
0
文件: events.py 项目: leandropim/Tapp
 def emitDeffered(self,*args):
     import maya.utils as mu
     mu.executeDeferred(self.emit,*args)