Example #1
0
 def __init__(self, renderNode=None):
     self.renderGlobalsNodeName = renderNode.name()
     self.renderNode = renderNode
     self.defaultGlobals = pm.SCENE.defaultRenderGlobals
     self.defaultResolution = pm.SCENE.defaultResolution
     self.rendererTabUiDict = {}
     self.imageFormatData = []
     self.cameras = []
     imageFormats = pm.getMelGlobal("string[]", "$gImageFormatData")
     if len(imageFormats) == 0:
         pm.mel.eval("source imageFormats")  # make sure we have the $gImageFormatData global variable
         imageFormats = pm.getMelGlobal("string[]", "$gImageFormatData")
     self.imageFormatData.append(("Custom", 320, 240))
     for line in imageFormats:
         elements = line.split()
         self.imageFormatData.append((elements[0], int(elements[1]), int(elements[2])))
Example #2
0
def togglePlaybackSnap():
    """Toggle playback snapping on and off"""

    gPlayBackSlider = pm.getMelGlobal( 'string', 'gPlayBackSlider' )

    new_value = not bool( pm.timeControl( gPlayBackSlider, q=1, snap=1 ) )
    pm.timeControl( gPlayBackSlider, e=1, snap=new_value )

    print 'Playback Snapping: %s' % ( 'Off', 'On' )[new_value]
Example #3
0
    def _updateButtons( self ):
        applyCloseBtn = pm.mel.getOptionBoxApplyAndCloseBtn()
        applyBtn = pm.mel.getOptionBoxApplyBtn()

        saveMenuItem = pm.getMelGlobal( 'string', 'gOptionBoxEditMenuSaveItem' )
        reseMenuItem = pm.getMelGlobal( 'string', 'gOptionBoxEditMenuResetItem' )

        pm.button( applyCloseBtn, edit=True, label=self._button_label,
                   command=lambda *args: self._onClickApply(True)
                   )
        pm.button( applyBtn, edit=True,
                   command=lambda *args: self._onClickApply()
                   )
        pm.menuItem( saveMenuItem, edit=True,
                     command=lambda * args: ( self._updateOptions() )
                     )
        pm.menuItem( reseMenuItem, edit=True,
                     command=lambda * args: ( self._updateOptions( forceDefaults=True ), self._updateWidgets() )
                    )
Example #4
0
 def __init__(self, renderNode=None):
     print "CREATE OpenMayaCommonGlobals"
     self.renderGlobalsNodeName = renderNode.name()
     self.renderNode = renderNode
     self.defaultGlobals = pm.SCENE.defaultRenderGlobals
     self.defaultResolution = pm.SCENE.defaultResolution
     self.rendererTabUiDict = {}
     self.imageFormatData = []
     imageFormats = pm.getMelGlobal("string[]", "$gImageFormatData")
     if len(imageFormats) == 0:
         pm.mel.eval(
             "source imageFormats"
         )  #make sure we have the $gImageFormatData global variable
         imageFormats = pm.getMelGlobal("string[]", "$gImageFormatData")
     self.imageFormatData.append(("Custom", 320, 240))
     for line in imageFormats:
         elements = line.split()
         self.imageFormatData.append(
             (elements[0], int(elements[1]), int(elements[2])))
Example #5
0
import os
from pymel.core import Path, about, getMelGlobal


DIR_APP = Path( os.environ.get( 'MAYA_APP_DIR' ) )
DIR_VERSION = DIR_APP / about( version=True ).replace(' ','-')

DIR_PREFS = DIR_VERSION / 'prefs'
PREF_POSES = DIR_PREFS / 'poses.bin'

_runtime_suite = getMelGlobal( 'string', 'KINETIFEX_RUNTIME_SUITE' )

if _runtime_suite:
    RUNTIME_SUITE = _runtime_suite
else:
    RUNTIME_SUITE = 'Kinetifex'
Example #6
0
from __future__ import with_statement

import pymel.core as pm
from impress import ui


MAYA_WINDOW = pm.getMelGlobal( 'string', 'gMainWindow' )


def show( reset=False ):
    if pm.about(batch=True):
        print 'menu not available in batch mode.'
        return
    else:
        # -- get things ready for building the menu

        menu_name = "Impress Example"
        pm.setParent( MAYA_WINDOW )

        if pm.menu( menu_name, exists=True ):
            if reset:
                pm.deleteUI( menu_name )
            else:
                main_menu = pm.menu( menu_name, edit=True )
                return main_menu

        if not pm.menu( menu_name, exists=True ):
            main_menu = pm.menu( menu_name, tearOff=True )

        # -- build the menu
import os
import distutils
import pymel.core as pm
from PySide2 import QtWidgets


def onMayaDroppedPythonFile(*args):
    pass

script_dir = pm.internalVar(usd=True)
icon_dir = pm.internalVar(ubd=True)
dl_dir = os.path.dirname(__file__)

distutils.dir_util.copy_tree(os.path.join(dl_dir, 'scripts'), os.path.dirname(script_dir))
distutils.dir_util.copy_tree(os.path.join(dl_dir, 'icons'), os.path.dirname(icon_dir))

shelves = pm.tabLayout(pm.getMelGlobal('string', '$gShelfTopLevel'), query=True, childArray=True)
current = shelves.index(pm.tabLayout(pm.getMelGlobal('string', '$gShelfTopLevel'), query=True, selectTab=True))
itm, accepted = QtWidgets.QInputDialog().getItem(None, 'Shelf Button', 'Which Shelf Do You Wish to Add the Button To?',
                                                 shelves, editable=False, current=current)

if accepted:
    pm.shelfButton(style="iconOnly", parent=itm, image='na_scratch_paper', label='Scratch Paper',
                   command='import na_scratch_paper\nna_scratch_paper.run_maya()')
Example #8
0

from __future__ import with_statement
import pymel.core as pm
from impress.ui import commandMenuItem
import kinetifex as kx

MENU_LABEL = pm.getMelGlobal( 'string', 'KINETIFEX_MENU_TITLE' )
MAYA_WINDOW = pm.getMelGlobal( 'string', 'gMainWindow' )

if MENU_LABEL == '':
    MENU_LABEL = 'Kinetifex'


scene_menu = None


def show( reset=False ):

    global scene_menu

    if pm.about( batch=True ):
        print 'menu not available in batch mode.'
        return
    else:
        # get things ready for building the menu

        menu_name = MENU_LABEL.replace( ' ', '' )

        if pm.menu( menu_name, exists=True ):
            if reset:
Example #9
0
def init_scene(*a):
    scene = project.Scene()


try:
    pm.deleteUI('cfbTools')
except:
    pass
try:
    pm.deleteUI('pipeline')
except:
    pass

scene = project.Scene(delay=True)

g_main = pm.getMelGlobal('string', '$gMainWindow')

pm.setParent(g_main)
mmenu = pm.menu('cfbTools', l='CFB \'15', to=True)

pm.setParent(menu=True)
#pm.menuItem(l="Reload Scripts", c=lambda *args: pm.evalDeferred( "exec('reload(cfb) in globals()')", lp=True )
#pm.menuItem(divider=True)
#pm.menuItem(l="Launch Widget", c=run)

#pm.menuItem(divider=True)

pm.menuItem(l="Open Scene", c=open_ui)
pm.menuItem(l="Save Scene", c=save_ui)
pm.menuItem(l="Rename Scene", c=rename_ui)