Skip to content

Commit

Permalink
updated Mayaseed to version 0.3.2.
Browse files Browse the repository at this point in the history
  • Loading branch information
dictoon committed Feb 7, 2013
1 parent 2b1a114 commit fda01d8
Show file tree
Hide file tree
Showing 8 changed files with 658 additions and 196 deletions.
26 changes: 22 additions & 4 deletions sandbox/extras/maya/open_me_to_install.ma
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,30 @@ createNode renderLayer -n "defaultRenderLayer";
setAttr ".g" yes;
createNode script -n "install";
setAttr ".b" -type "string" (
"import maya.mel as mel\nimport maya.cmds as cmds\nimport os\nimport sys\n\nuserSetup_file = None\n\n\n\nif ((sys.platform == 'win32') or (sys.platform == 'win64')):\n\n for path in mel.eval('getenv MAYA_SCRIPT_PATH').split(';'):\n if os.path.exists(path):\n for file in os.listdir(path):\n if file == 'userSetup.mel':\n userSetup_file = os.path.join(path, file)\n\n if not userSetup_file:\n userSetup_file = os.path.join('{0}/'.format(mel.eval('getenv MAYA_SCRIPT_PATH').split(';')[2]), 'userSetup.mel')\n file = open(userSetup_file, 'w')\n file.close()\n\nelse:\n\n for path in mel.eval('getenv MAYA_SCRIPT_PATH').split(':'):\n if os.path.exists(path):\n for file in os.listdir(path):\n if file == 'userSetup.mel':\n userSetup_file = os.path.join(path, file)\n\n if not userSetup_file:\n userSetup_file = os.path.join('{0}/'.format(mel.eval('getenv MAYA_SCRIPT_PATH').split(':')[1]), 'userSetup.mel')\n file = open(userSetup_file, 'w')\n"
+ " file.close()\n\n\n\n\n\nprint userSetup_file\nfile = open(userSetup_file, 'r')\nfile_contents = file.read()\nfile.close()\nfile = open(userSetup_file, 'w')\n\ninside_mayaseed_block = False\nfor line in file_contents.split('\\n'):\n if line[:11] == '// mayaseed':\n if inside_mayaseed_block:\n inside_mayaseed_block = False\n else:\n inside_mayaseed_block = True\n if not inside_mayaseed_block:\n if not line[:11] == '// mayaseed':\n file.write(line + '\\n')\n\nif ((sys.platform == 'win32') or (sys.platform == 'win64')):\n\n file.write('\\n')\n file.write('\\n')\n file.write('// mayaseed -------------------------------------------------------------------------------\\n')\n file.write('\\n')\n file.write('$env_script_path = `getenv MAYA_SCRIPT_PATH`;\\n')\n file.write('$env_plugin_path = `getenv MAYA_PLUG_IN_PATH`;\\n')\n file.write('putenv MAYA_SCRIPT_PATH ($env_script_path + \";' + os.path.join('{0}/'.format(os.path.split(cmds.file(query=True, sn=True))[0]), 'scripts') + '\");\\n')\n file.write('$env_script_path = `getenv MAYA_SCRIPT_PATH`;\\n')\n"
+ " file.write('putenv MAYA_SCRIPT_PATH ($env_script_path + \";' + os.path.join('{0}/'.format(os.path.split(cmds.file(query=True, sn=True))[0]), 'graphics') + '\");\\n')\n file.write('putenv MAYA_PLUG_IN_PATH ($env_plugin_path + \";' + os.path.join('{0}/'.format(os.path.split(cmds.file(query=True, sn=True))[0]), 'plugins') + '\");\\n')\n file.write('\\n')\n file.write('// mayaseed -------------------------------------------------------------------------------\\n')\n\n file.close()\n\n\nelse:\n\n file.write('\\n')\n file.write('\\n')\n file.write('// mayaseed -------------------------------------------------------------------------------\\n')\n file.write('\\n')\n file.write('$env_script_path = `getenv MAYA_SCRIPT_PATH`;\\n')\n file.write('$env_plugin_path = `getenv MAYA_PLUG_IN_PATH`;\\n')\n file.write('putenv MAYA_SCRIPT_PATH ($env_script_path + \":' + os.path.join('{0}/'.format(os.path.split(cmds.file(query=True, sn=True))[0]), 'scripts') + '\");\\n')\n file.write('$env_script_path = `getenv MAYA_SCRIPT_PATH`;\\n')\n file.write('putenv MAYA_SCRIPT_PATH ($env_script_path + \":' + os.path.join('{0}/'.format(os.path.split(cmds.file(query=True, sn=True))[0]), 'graphics') + '\");\\n')\n"
+ " file.write('putenv MAYA_PLUG_IN_PATH ($env_plugin_path + \":' + os.path.join('{0}/'.format(os.path.split(cmds.file(query=True, sn=True))[0]), 'plugins') + '\");\\n')\n file.write('\\n')\n file.write('// mayaseed -------------------------------------------------------------------------------\\n')\n\n file.close()\n\ncmds.confirmDialog(title='Mayaseed', message='All done!, to enable mayaseed just restart maya then go into the plugin manager and enable mayaseed.py. enjoy! jt', button='OK')");
"import maya.mel as mel\nimport maya.cmds as cmds\nimport os\nimport sys;\nuser_setup_file = None\nscene_name = cmds.file(sn=True, q=True)\nscene_dir = os.path.split(scene_name)[0]\nsys.path.append(scene_dir)\nimport install_helper\nreload(install_helper)\nsys.path.remove(scene_dir)\nif ((sys.platform == 'win32') or (sys.platform == 'win64')):\n for path in mel.eval('getenv MAYA_SCRIPT_PATH').split(';'):\n if os.path.exists(path):\n for file in os.listdir(path):\n if file == 'userSetup.mel':\n user_setup_file = os.path.join(path, file)\n if not user_setup_file:\n user_setup_file = os.path.join('{0}/'.format(mel.eval('getenv MAYA_SCRIPT_PATH').split(';')[2]), 'user_setup.mel')\n file = open(user_setup_file, 'w')\n file.close()\nelse:\n for path in mel.eval('getenv MAYA_SCRIPT_PATH').split(':'):\n if os.path.exists(path):\n for file in os.listdir(path):\n if file == 'userSetup.mel':\n user_setup_file = os.path.join(path, file)\n"
+ " if not user_setup_file:\n user_setup_file = os.path.join('{0}/'.format(mel.eval('getenv MAYA_SCRIPT_PATH').split(':')[1]), 'user_setup.mel')\n file = open(user_setup_file, 'w')\n file.close()\nprint user_setup_file\n\ninstall_helper.install(user_setup_file, scene_dir)");
setAttr ".st" 1;
setAttr ".stp" 1;

//import maya.mel as mel
//import maya.cmds as cmds
//import os
//import sys
//user_setup_file = None
//scene_name = cmds.file(sn=True, q=True)
//scene_dir = os.path.split(scene_name)[0]
//sys.path.append(scene_dir)
//import install_helper
//reload(install_helper)
//sys.path.remove(scene_dir)
//separator = ';' if sys.platform == 'win32' or sys.platform == 'win64' else ':'
//for path in mel.eval('getenv MAYA_SCRIPT_PATH').split(separator):
// if os.path.exists(path):
// for file in os.listdir(path):
// if file == 'userSetup.mel':
// user_setup_file = os.path.join(path, file)
//install_helper.install(user_setup_file, scene_dir)

createNode script -n "uiConfigurationScriptNode";
setAttr ".b" -type "string" (
"// Maya Mel UI Configuration File.\n//\n// This script is machine generated. Edit at your own risk.\n//\n//\n\nglobal string $gMainPane;\nif (`paneLayout -exists $gMainPane`) {\n\n\tglobal int $gUseScenePanelConfig;\n\tint $useSceneConfig = $gUseScenePanelConfig;\n\tint $menusOkayInPanels = `optionVar -q allowMenusInPanels`;\tint $nVisPanes = `paneLayout -q -nvp $gMainPane`;\n\tint $nPanes = 0;\n\tstring $editorName;\n\tstring $panelName;\n\tstring $itemFilterName;\n\tstring $panelConfig;\n\n\t//\n\t// get current state of the UI\n\t//\n\tsceneUIReplacement -update $gMainPane;\n\n\t$panelName = `sceneUIReplacement -getNextPanel \"modelPanel\" (localizedPanelLabel(\"Top View\")) `;\n\tif (\"\" == $panelName) {\n\t\tif ($useSceneConfig) {\n\t\t\t$panelName = `modelPanel -unParent -l (localizedPanelLabel(\"Top View\")) -mbv $menusOkayInPanels `;\n\t\t\t$editorName = $panelName;\n modelEditor -e \n -camera \"top\" \n -useInteractiveMode 0\n -displayLights \"default\" \n -displayAppearance \"wireframe\" \n"
Expand Down
25 changes: 20 additions & 5 deletions sandbox/extras/maya/plugins/mayaseed.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ def ms_renderSettings_nodeInitializer():
ms_renderSettings.export_all_cameras = export_all_cameras_nAttr.create("export_all_cameras", "export_all_cams", OpenMaya.MFnNumericData.kBoolean)
# export all cameras as thin lens bool attribute
export_all_cameras_as_thin_lens_nAttr = OpenMaya.MFnNumericAttribute()
ms_renderSettings.export_all_cameras_as_thin_lens = export_all_cameras_as_thin_lens_nAttr.create("export_all_cameras_as_thinlens", "export_thinlens", OpenMaya.MFnNumericData.kBoolean)
ms_renderSettings.export_all_cameras_as_thin_lens = export_all_cameras_as_thin_lens_nAttr.create("export_all_cameras_as_thin_lens", "export_thinlens", OpenMaya.MFnNumericData.kBoolean)
# interpret sets as assemblies bool attribute
interpret_sets_as_assemblies_nAttr = OpenMaya.MFnNumericAttribute()
ms_renderSettings.interpret_sets_as_assemblies = interpret_sets_as_assemblies_nAttr.create("interpret_sets_as_assemblies", "sets_as_assemblies", OpenMaya.MFnNumericData.kBoolean)
Expand Down Expand Up @@ -332,10 +332,17 @@ def ms_renderSettings_nodeInitializer():
profile_export_nAttr = OpenMaya.MFnNumericAttribute()
ms_renderSettings.profile_export = profile_export_nAttr.create("profile_export", "profile_export", OpenMaya.MFnNumericData.kBoolean, False)

# verobse output
verbose_output_nAttr = OpenMaya.MFnNumericAttribute()
ms_renderSettings.verbose_output = verbose_output_nAttr.create("verbose_output", "verbose_output", OpenMaya.MFnNumericData.kBoolean, False)
# autodetect alpha
autodetect_alpha_nAttr = OpenMaya.MFnNumericAttribute()
ms_renderSettings.autodetect_alpha = autodetect_alpha_nAttr.create("autodetect_alpha", "autodetect_alpha", OpenMaya.MFnNumericData.kBoolean, False)

# force_linear_texture_interpretation
force_linear_texture_interpretation_nAttr = OpenMaya.MFnNumericAttribute()
ms_renderSettings.force_linear_texture_interpretation = force_linear_texture_interpretation_nAttr.create("force_linear_texture_interpretation", "force_linear_texture_interpretation", OpenMaya.MFnNumericData.kBoolean, False)

# force_linear_color_interpretation
force_linear_color_interpretation_nAttr = OpenMaya.MFnNumericAttribute()
ms_renderSettings.force_linear_color_interpretation = force_linear_color_interpretation_nAttr.create("force_linear_color_interpretation", "force_linear_color_interpretation", OpenMaya.MFnNumericData.kBoolean, False)

# add attributes
ms_renderSettings.addAttribute(ms_renderSettings.export_button)
Expand Down Expand Up @@ -399,7 +406,11 @@ def ms_renderSettings_nodeInitializer():
ms_renderSettings.addAttribute(ms_renderSettings.gtr_sampler)

ms_renderSettings.addAttribute(ms_renderSettings.profile_export)
ms_renderSettings.addAttribute(ms_renderSettings.verbose_output)
ms_renderSettings.addAttribute(ms_renderSettings.autodetect_alpha)

ms_renderSettings.addAttribute(ms_renderSettings.force_linear_texture_interpretation)
ms_renderSettings.addAttribute(ms_renderSettings.force_linear_color_interpretation)


#--------------------------------------------------------------------------------------------------
# ms_environment node.
Expand Down Expand Up @@ -677,6 +688,10 @@ def initializePlugin(obj):
try:
if not cmds.pluginInfo('objExport', query=True, loaded=True):
cmds.loadPlugin('objExport')
if not cmds.pluginInfo('ms_appleseed_material.py', query=True, loaded=True):
cmds.loadPlugin('ms_appleseed_material.py')
if not cmds.pluginInfo('ms_appleseed_shading_node.py', query=True, loaded=True):
cmds.loadPlugin('ms_appleseed_shading_node.py')
except:
print 'objExport plugin could not be loaded, cannot load mayaseed'

Expand Down
Loading

0 comments on commit fda01d8

Please sign in to comment.