Skip to content

Commit

Permalink
software: added PLEX tab (with open folder func)
Browse files Browse the repository at this point in the history
maya: merged menu into userSetup, decorator into maya_util
  • Loading branch information
alexanderrichter committed Jul 10, 2017
1 parent cbbb303 commit 7710a39
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 59 deletions.
28 changes: 19 additions & 9 deletions data/project/default/software.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
# author = Alexander Richter <pipeline@richteralexander.com>
#*********************************************************************


#************************
# MAYA
MAYA:
Expand Down Expand Up @@ -43,15 +44,22 @@ MAYA:


MENU:

- Plex:
open_scene_folder: menuItem(p="{}", l='Open Scene Folder', c='import libFileFolder; libFileFolder.open_folder(cmds.file(q=True, sceneName=True))')
open_project_folder: menuItem(p="{}", l='Open Project Folder', c='import libFileFolder;import libData; libFileFolder.open_folder(libData.get_data("project")["path"])')

- break: menuItem(p="{}", d=True)

# - Save: menuItem(p="{}", l='Save', c='from util import arSave; reload(arSave); arSave.main()')
# - Load: menuItem(p="{}", l='Load', c='from util import arSaveAs; reload(arSaveAs); arSaveAs.main(True)')

# - break: menuItem(p="{}", d=True)
# - break: menuItem(p="{}", d=True)

# - Util:
# position_selected: menuItem(p="{}", l='Position Selected', c='import maya_utils; maya_utils.position_selected()')
- Utils:
position_selected: menuItem(p="{}", l='Position to First Selection', c='import maya_utils; maya_utils.position_selected()')

- break: menuItem(p="{}", d=True)
- break: menuItem(p="{}", d=True)

- Report: menuItem(p="{}", l='Report', c='import libFunc; libFunc.get_help("issues")')
- Help: menuItem(p="{}", l='Help', c='import libFunc; libFunc.get_help()')
Expand All @@ -73,7 +81,7 @@ MAYA:
# NUKE
NUKE:
version: &NUKE_VERSION 10.5
version_long: &NUKE_VERSION_LONG !join [*NUKE_VERSION, v2]
version_long: &NUKE_VERSION_LONG !join [*NUKE_VERSION, v1]

start: !join ['start "" Nuke', *NUKE_VERSION ,'.exe --nukex "{}"']

Expand Down Expand Up @@ -102,6 +110,12 @@ NUKE:


MENU:
- Plex:
open_scene_folder: addCommand('Open Scene Folder', 'import libFileFolder; libFileFolder.open_folder(nuke.root().knob("name").value())')
open_project_folder: addCommand('Open Project Folder', 'import libFileFolder;import libData; libFileFolder.open_folder(libData.get_data("project")["path"])')

- break: addSeparator()

# - Save: "addCommand('Save', 'import menu; save()', 'ctrl+alt+s', 'save.ico')"
# - Load: "addCommand('Load', 'import menu; load()', 'ctrl+alt+l', 'load.ico')"

Expand All @@ -114,10 +128,6 @@ NUKE:
- Report: addCommand('Report', 'import libFunc; libFunc.get_help("issues")', 'ctrl+alt+r', 'report.ico')
- Help: addCommand('Help', 'import libFunc; libFunc.get_help()', 'ctrl+alt+h', 'help.ico')

- break: addSeparator()

#- Others:
# Sub: addCommand('Script', '')


#************************
Expand Down
12 changes: 5 additions & 7 deletions lib/classes/software.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,7 @@ def start(self, software='', open_file=''):

def __call__(self):
LOG.info('SOFTWARE: {} {} - {}\n\
ENV: {}'.format(self._software, self._version, self._path,
self._env))
ENV: {}'.format(self._software, self._version, self._path, self._env))


#************************
Expand Down Expand Up @@ -143,12 +142,10 @@ def add_menu(self, menu_node, new_command):
import maya.cmds as cmds
cmd = ('cmds.{}'.format(item)).format(menu_node)
eval(cmd)
elif self._software == 'nuke':
eval('menu_node.{}'.format(item))
else:
LOG.debug('CANT find software: {}'.format(software))
elif self._software == 'nuke': eval('menu_node.{}'.format(item))
else: LOG.debug('CANT find software: {}'.format(software))
except:
LOG.error('DATA Menu couldnt be created', exc_info=True)
LOG.error('SOFTWARE Menu couldnt be created', exc_info=True)


def print_header(self):
Expand Down Expand Up @@ -188,6 +185,7 @@ def print_header(self):

print('') # ********************


def print_checked_header(self, text, content, func):
try:
func
Expand Down
4 changes: 2 additions & 2 deletions lib/libFileFolder.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def create_folder(path):
try:
os.makedirs(path)
except:
LOG.info('CANT create folder: {}'.format(path))
LOG.warning('CANT create folder: {}'.format(path))

# @BRIEF opens folder even if file is given
def open_folder(path):
Expand All @@ -44,7 +44,7 @@ def open_folder(path):
path = os.path.dirname(path)
webbrowser.open(path)
else:
LOG.info('UNVALID path: {}'.format(path))
LOG.warning('UNVALID path: {}'.format(path))
return path


Expand Down
2 changes: 1 addition & 1 deletion software/maya/scripts/maya_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def position_selected():
cam_new.rotate.set(cam_origin.rotate.get())
cam_new.scale.set(cam_origin.scale.get())
else:
LOG.warning("FAIL : Need at least 2 selections")
LOG.warning("FAIL : Need at least 2 selections to set everything on the first selection position.")


#************************
Expand Down
37 changes: 0 additions & 37 deletions software/maya/scripts/menu.py

This file was deleted.

25 changes: 22 additions & 3 deletions software/maya/userSetup.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,30 @@

print "MENU"
try:
cmds.evalDeferred("from scripts import menu\nmenu.load_menu()")
cmds.evalDeferred("load_menu()")
print " ON - menu"
except:
print " OFF - menu"
except: print " OFF - menu"

print " ON - shelf"

print ""




#*************************
# MENU
def load_menu():
delete_menu()

menu = cmds.menu(os.getenv('PROJECT_NAME').replace(' ',''), hm = 1, p = 'MayaWindow',
l = os.getenv('PROJECT_NAME').replace(' ',''), to = 1, )

for menu_item in Tank().data['software']['MAYA']['MENU']:
Tank().software.add_menu(menu, menu_item)


def delete_menu():
if cmds.menu(os.getenv('PROJECT_NAME').replace(' ',''), query = True, exists = True):
cmds.deleteUI(os.getenv('PROJECT_NAME').replace(' ',''), menu = True)

0 comments on commit 7710a39

Please sign in to comment.