-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added maya scripts (shelf, maya_utils, menu, settings)
combined decorator with maya_utils updated arDesktop with libFileFolder func changed readme
- Loading branch information
Alexander Richter
committed
Jul 9, 2017
1 parent
9d540dd
commit cbbb303
Showing
10 changed files
with
473 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
#********************************************************************* | ||
# content = maya utils | ||
# version = 0.6.0 | ||
# date = 2017-07-10 | ||
# | ||
# license = MIT | ||
# copyright = Copyright 2017 Animationsinstitut | ||
# author = Alexander Richter <[email protected]> | ||
#********************************************************************* | ||
# This source file has been developed within the scope of the | ||
# Technical Director course at Filmakademie Baden-Wuerttemberg. | ||
# http://td.animationsinstitut.de | ||
#********************************************************************* | ||
|
||
from pymel.core import * | ||
from functools import wraps | ||
import maya.mel as mel | ||
|
||
import libLog | ||
|
||
TITLE = os.path.splitext(os.path.basename(__file__))[0] | ||
LOG = libLog.init(script=TITLE) | ||
|
||
def position_selected(): | ||
selectedObj = ls( selection=True ) | ||
|
||
if len(selectedObj) > 1: | ||
origin = selectedObj[0] | ||
selectedObj.pop(0) | ||
|
||
for sObj in selectedObj: | ||
cam_new = general.PyNode(sObj) | ||
cam_origin = general.PyNode(origin) | ||
|
||
cam_new.translate.set(cam_origin.translate.get()) | ||
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") | ||
|
||
|
||
#************************ | ||
# Decorators | ||
def viewport_off(func): | ||
|
||
@wraps(func) | ||
def viewport(*args, **kwargs): | ||
|
||
try: | ||
# viewport OFF | ||
mel.eval("paneLayout -e -manage false $gMainPane") | ||
return func(*args, **kwargs) | ||
except Exception: | ||
LOG.error("FAIL : Viewport off", exc_info=True) | ||
raise | ||
|
||
finally: | ||
# viewport ON | ||
mel.eval("paneLayout -e -manage true $gMainPane") | ||
|
||
return viewport |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#********************************************************************* | ||
# content = maya menu | ||
# version = 0.6.0 | ||
# date = 2017-07-10 | ||
# | ||
# license = MIT | ||
# copyright = Copyright 2017 Animationsinstitut | ||
# author = Alexander Richter <[email protected]> | ||
#********************************************************************* | ||
# This source file has been developed within the scope of the | ||
# Technical Director course at Filmakademie Baden-Wuerttemberg. | ||
# http://td.animationsinstitut.de | ||
#********************************************************************* | ||
|
||
import os | ||
|
||
import maya.cmds as cmds | ||
|
||
from tank import Tank | ||
|
||
|
||
#************************* | ||
# 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) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
#********************************************************************* | ||
# content = maya settings | ||
# version = 0.0.1 | ||
# date = 2017-01-01 | ||
# | ||
# license = MIT | ||
# copyright = Copyright 2017 Animationsinstitut | ||
# author = Alexander Richter <[email protected]> | ||
#********************************************************************* | ||
# This source file has been developed within the scope of the | ||
# Technical Director course at Filmakademie Baden-Wuerttemberg. | ||
# http://td.animationsinstitut.de | ||
#********************************************************************* | ||
|
||
|
||
import maya.mel as mel | ||
import maya.cmds as cmds | ||
import maya.OpenMaya as api | ||
|
||
import libLog | ||
from tank import Tank | ||
|
||
import libLog | ||
TITLE = os.path.splitext(os.path.basename(__file__))[0] | ||
LOG = libLog.init(script=TITLE) | ||
|
||
all_data = Tank().data | ||
project_data = all_data['project'] | ||
software_data = all_data['software'] | ||
|
||
|
||
#************************* | ||
# SETTINGS | ||
|
||
# TIME | ||
try: | ||
fps = software_data['SETTINGS']['FPS'][project_data['fps']] | ||
cmds.currentUnit(time=fps) | ||
cmds.optionVar(sv = ("workingUnitTime", fps)) | ||
cmds.optionVar(sv = ("workingUnitTimeDefault", fps)) | ||
except: LOG.error('FAILED load fps.', exc_info=True) | ||
|
||
# UNIT | ||
try: cmds.currentUnit(linear=software_data['SETTINGS']['unit']) | ||
except: LOG.error('FAILED load unit.', exc_info=True) | ||
|
||
# RENDERER | ||
try: | ||
renderer = software_data['renderer'] | ||
cmds.optionVar(sv = ("preferredRenderer", software_data['renderer'])) | ||
cmds.optionVar(sv = ("preferredRendererHold", software_data['renderer'])) | ||
except: LOG.error('FAILED load renderer.', exc_info=True) | ||
|
||
|
||
# shortcut - SAVE | ||
# cmd = 'python "from scripts import save;save.start()"' | ||
# cmds.nameCommand( 'save', annotation="Save", sourceType="mel" ,c=cmd) | ||
# cmds.hotkey( k='s', alt=True, name='save' ) | ||
|
||
# FIX renderLayer | ||
# def fixRenderLayer(*args): | ||
# mel.eval("fixRenderLayerOutAdjustmentErrors;") | ||
# api.MSceneMessage.addCallback(api.MSceneMessage.kAfterOpen, fixRenderLayer) | ||
|
||
|
||
# LINEAR WORKFLOW | ||
# cmds.setAttr ("defaultArnoldRenderOptions.textureMaxMemoryMB", 10024) | ||
# cmds.setAttr ("defaultArnoldRenderOptions.display_gamma", 1) | ||
# cmds.setAttr ("defaultArnoldRenderOptions.light_gamma", 1) | ||
# cmds.setAttr ("defaultArnoldRenderOptions.shader_gamma", 1) | ||
# cmds.setAttr ("defaultArnoldRenderOptions.texture_gamma", 1) |
Empty file.
Oops, something went wrong.