Commits

Julian Mann committed 18654e8

added some python package support

Comments (0)

Files changed (11)

lib/flak/thor/generate.rb

        create_maya_script_tree  if opts[:maya_scripts]
        create_nuke_script_tree if opts[:nuke_scripts]
        create_shell_script_tree  if opts[:shell_scripts]
+       create_python_tree  if opts[:python_package]
        create_maya_plugin_files if opts[:maya_plugin_target]
        create_app_files if opts[:maya_app_target] || opts[:standalone_target] 
        create_delight_tools_tree if opts[:delight_target]
       def create_shell_script_tree
         empty_directory("#{name}/shell/script") 
       end
+
+            #desc "create_shell_script_tree [name]", "Makes tool files needed for shell script development"
+      def create_python_tree
+          template("__init__.py.tt", "python_package/#{name}/__init__.py")
+      end
     end
 
 

lib/flak/thor/target_file.rb

       h['source_files'] = []
       h['source_files'] << "src/*.cpp" if c_compile
       h['shell_script_copy_files'] = ["shell/script/*"]  if options[:shell_scripts]
+
+      h['python_package_copy_files'] = ["python_package/#{name}/*"] if options[:python_package]
+      h['python_package_destination'] = "python/#{name}/" if options[:python_package]
+
       YAML::dump(h)
     end
 
 
       h['env']["NUKE_PATH"] = "$env.NUKE_PATH:$software_location/nuke/scripts" if options[:nuke]
 
+      h['env']["PYTHONPATH"] = "$env.PYTHONPATH:$software_location/python" if options[:python]
+
       if options[:delight]
         h['env']["DL_SHADERS_PATH"] = "$env.DL_SHADERS_PATH:$software_location/delight/shader" 
         h['env']["DL_PROCEDURALS_PATH"] = "$env.DL_PROCEDURALS_PATH:$software_location/delight/procedural" 

lib/flak/thor/templates/INSTALL.BAT.tt

 echo ---------------------------------------------
 <% end -%>
 
+<% if project_options[:python] -%>
+echo --------------------PYTHONPATH---------
+echo If the same module
+echo appears more than once, you should remove duplicates
+echo or older versions from the environment using the 
+echo environment variable control panel.
+echo ---------------------------------------------
+IF "%PYTHONPATH%" == "" GOTO :NO_PYTHONPATH
+:YES_PYTHONPATH
+SET buff="%PYTHONPATH%;%MODULE_LOCATION%\python"
+GOTO :END_PYTHONPATH
+:NO_PYTHONPATH
+SET buff="%MODULE_LOCATION%\python"
+:END_PYTHONPATH
+setx PYTHONPATH %buff%
+setlocal EnableDelayedExpansion
+set LF=^
+
+
+echo %buff:;=!LF!%
+endlocal
+<% end -%>
+
+
+
+
 
 
 echo --------------------PATH---------------------

lib/flak/thor/templates/__init__.py.tt

+import pymel.core as pm
+import pymel.mayautils as pmu
+import maya.mel as mm
+
+def setup(moduleName):
+  moduleMenu = mm.eval("module.menuName \""+ moduleName +"\";")
+
+  pm.setParent(moduleMenu, menu=True )
+
+  # pm.menuItem(label='<%= name.upcase %> Menu', command = '<%= name %>.window.build()')
+  # pm.menuItem(label='Create another menu item', command = 'command')
+  # mm.eval("module.subMenu \""+moduleMenu+"\" \"Foo|Bar\";")
+  # pm.menuItem(label='Create a deep menu item', command = 'command')
+  # pm.menuItem(label='Create another deep menu item', command = 'command')
+
+  pm.setParent(moduleMenu, menu=True )

lib/flak/thor/templates/config/cpp.yml.tt

     compiler:               'gcc'
     linker:                 'g++'
     archiver:               '/usr/bin/ar rv'
-    target_extension: 		''
+    target_extension:       ''
     dso_options:
     -                       '-shared'
     include_paths:
     compiler:              '/usr/bin/gcc'
     linker:                 '/usr/bin/g++'
     archiver:              '/usr/bin/libtool  -static -arch_only i386'
-    target_extension: 		''
+    target_extension:       ''
     dso_options:
     -                       '-bundle'
     include_paths:
     object_flag:            '/Fo'
     outputfile_flag:        '/OUT:'
     object_extension:       'obj'
-    target_extension: 		''
+    target_extension:       ''
     linker_options:
     -                       '/OPT:NOREF'
     -                       '/INCREMENTAL:NO'
         -                   '/Z7'
     configuration_release:
         compiler_options:
-        -                   '/O2'
+        -                   '/O2'

lib/flak/thor/templates/config/delight.yml.tt

 
 os_linux64:
     delight_location:    '/software/3delight'
-    
 os_darwin64:
     delight_location:    '/Applications/Graphics/3Delight'
-    
 os_win64:
     delight_location:    'C:/Program Files/3Delight'

lib/flak/thor/templates/config/environment.yml.tt

 # You can have any number of configurations with names you choose. 
 # Set the name here and then set up configuration specific blocks in  
 # any yaml config files.
-configuration:              "debug"
+configuration: "${FLAK_CONFIG}"
 
 # The name of your product of course.
 product_name:               "<%= name %>"
     configuration_release: 
         tools_directory: "/software/package"
 os_linux64:   
-    platform_id: "linux64_centos5"
+    platform_id: "${PLATFORM_ID}"
     configuration_debug: 
         tools_directory: "${HOME}/tools"
     configuration_release: 
-        tools_directory: "/software/package"
+        tools_directory: "${RMWTOOLS}"
 os_win64:
     platform_id: "win64"
     configuration_debug: 
         tools_directory: "/cygdrive/c/cygwin/${HOME}/tools"
     configuration_release: 
-        tools_directory: "/software/package"
+        tools_directory: "${RMWTOOLS}"

lib/flak/thor/templates/config/maya.yml.tt

-maya_version: 2012
+maya_version: ${MAYA_VERSION}
 
 dg_convert_cmd: 'convert  -resize 32x32'
 
 maya_precompiled_plugin_destination:  'maya/plug-ins'
 
 os_linux64:
-    maya_location: '/software/package/linux64/maya/2012'
+    maya_location: "/software/package/${PLATFORM_ID}/maya/${MAYA_VERSION}"
 
 os_darwin64:
-    maya_location: '/Applications/Autodesk/maya2012'
+    maya_location: "/Applications/Autodesk/maya${MAYA_VERSION}"
 
 os_win64:
-    maya_location: 'C:/Program Files/Autodesk/Maya2012'
+    maya_location: "C:/Program Files/Autodesk/Maya${MAYA_VERSION}"
 

lib/flak/thor/templates/config/maya_app.yml.tt

     - '-ftemplate-depth-25'
     - '-Wno-multichar' 
     - '-Wno-comment'   
-    - '-Wno-reorder'    	  
+    - '-Wno-reorder'          
     - '-Wno-sign-compare' 
     - '-Wall' 
     libs:
     compiler_options:
     - '/DNT_APP'
     - '/D_CONSOLE'
-    - '/D_BOOL'
+    - '/D_BOOL'
+    

lib/flak/thor/templates/env.sh.tt

 	else export MAYA_MODULE_PATH=${<%= path %>}/maya/modules ;
 fi
 <% end -%>
+
+<% if project_options[:python] -%>
+# append <%= path %>  python resource paths
+if [[ -n $PYTHONPATH ]] ;
+  then export PYTHONPATH=${<%= path %>}/python:${PYTHONPATH} ;
+  else export PYTHONPATH=${<%= path %>}/python ;
+fi
+<% end -%>

lib/flak/thor/wizard.rb

       
       opts[:nuke] = asker.yes?("Will this project contain nuke tools? (y/n)")
       
+      opts[:python] = asker.yes?("Will this project contain a python package? (y/n)")
+      
       opts
     end
 
       opts[:maya_scripts] = false
       opts[:nuke_scripts] = false
       opts[:shell_scripts] = false
+      opts[:python] = false
 
       finished_target = false
       
       
       opts[:shell_scripts] = asker.yes?("Will this tool also contain shell scripts? (y/n)") 
 
+      opts[:python_package] = asker.yes?("Will this tool also contain a python package? (y/n)") 
+
       opts
     end