Pour garantir une homogénéité de mes projets unity / maya, j'ai écrit ce petit script .BAT qui génère une arborescence de répertoires pour un projet maya/unity.
Ce bat génère également une arborescence pour les scripts python et mel.
Le projet maya source automatiquement les scripts .mel, Les scripts python sont trouvés automatiquement dans le path de maya, par rapport au projet maya courant.
Pour sourcer ces scripts, un fichier usersetup.py est déjà prêt à être édité.
Si tous les projets maya sont crées les uns à coté des autres, les scripts mel et pythons seront partagés entre les projets.
Exécution du .bat:
1. Entrer le nom du projet
2. L'arborescence se crée à coté du .bat, ainsi que l'arborescence des scripts,
si toute fois elle n'existait pas au préalable.
3. Set project dans maya
Arborescence dans windows.
Détails du .BAT ci dessous:
create_new_project.bat:
@echo off
color 17
echo.
REM ...
REM project definition name
REM ...
set /p project="Enter project name:"
IF %project% == "" set project="default"
IF EXIST %project% GOTO notCreate
MKDIR %project%
cd %project%
REM ...
REM env var definition of keywords
REM ...
set scripts=Scripts
set python=Python
set mel=Mel
set admin=_admin
set art=Art
set assets=Assets
set sources=Sources
set textures=Textures
set materials=Materials
set sounds=Sounds
set sfx=Sfx
set musics=Musics
set icons=Icons
set hud=Hud
set characters=Characters
set props=Props
set scenes=Scenes
set animations=Animations
set animClips=Clips
set controllers=Controllers
set presets=Presets
set temp=_tempFile
REM ...
REM main script maya path definition
REM ...
set scrPyt=../%scripts%/%python%
set scrMel=../%scripts%/%mel%
set scrIco=../%scripts%/%icons%
set scrPst=../%scripts%/%presets%
REM ...
REM art production directories definitions
REM ...
set artText=%art%/%textures%
set artChar=%art%/%characters%
set artProp=%art%/%props%
set artScen=%art%/%scenes%
set artHud=%art%/%hud%
set artAnim=%art%/%animations%
set artClip=%artAnim%/%animClips%
set artSnd=%art%/%sounds%
set artSfx=%artSnd%/%sfx%
set artMus=%artSnd%/%musics%
set artTemp=%art%/%temp%
set artSrcs=%art%/%sources%
REM ...
REM assets directories definitions
REM ...
set assetsMats=%assets%/%materials%
set assetsText=%assets%/%textures%
set assetsChar=%assets%/%characters%
set assetsProp=%assets%/%props%
set assetsHud=%assets%/%hud%
set assetsScen=%assets%/%scenes%
set assetsAnim=%assets%/%animations%
set assetsSnd=%assets%/%sounds%
set assetsSfx=%assetsSnd%/%sfx%
set assetsMus=%assetsSnd%/%musics%
set assetsTemp=%assets%/%temp%
set assetsScri=%assets%/%scripts%
REM ...
REM conversion of maya path to windows path / \
REM ...
set directories=%admin% %scrPyt% %scrMel% %scrIco% %scrPst% %artClip% %assetsMats% %assets% %assetsAnim% %assetsChar% %assetsProp% %assetsScen% %assetsHud% %assetsSfx% %assetsMus% %assetsScri% %art% %artAnim% %artChar% %artProp% %artScen% %artText% %artHud% %artSrcs% %artTemp%
set directories=%Directories:/=\%
REM ...
REM build directories
REM ...
echo.
echo Project paths of: %project%
echo =================
FOR %%A IN (%directories%) DO ECHO %%A
FOR %%A IN (%directories%) DO IF NOT EXIST %%A MKDIR %%A
REM ...
REM write workspace.mel project maya file
REM ...
set workspace=workspace.mel
echo.
echo Create workspace.mel
REM ...
REM write used paths
REM ...
echo //Maya 2015 Project Definition>%workspace%
echo workspace -fr "scripts" "%scrPyt%";>>%workspace%
echo workspace -fr "mel" "%scrMel%";>>%workspace%
echo workspace -fr "templates" "%scrPst%";>>%workspace%
echo ---
echo workspace -fr "scene" "%art%";>>%workspace%
echo workspace -fr "mayaAscii" "%art%";>>%workspace%
echo workspace -fr "mayaBinary" "%art%";>>%workspace%
echo ---
echo workspace -fr "images" "%artText%";>>%workspace%
echo workspace -fr "3dPaintTextures""%artText%";>>%workspace%
echo workspace -fr "sourceImages" "%artText%";>>%workspace%
echo ---
echo workspace -fr "OBJ" "%sources%";>>%workspace%
echo workspace -fr "OBJexport" "%sources%";>>%workspace%
echo workspace -fr "STL_DCE" "%sources%";>>%workspace%
echo ---
echo workspace -fr "animExport" "%artClip%";>>%workspace%
echo workspace -fr "animImport" "%artClip%";>>%workspace%
echo workspace -fr "atomExport" "%artClip%";>>%workspace%
echo workspace -fr "atomImport" "%artClip%";>>%workspace%
echo workspace -fr "clips" "%artClip%";>>%workspace%
echo ---
echo workspace -fr "sound" "%assetsSfx%";>>%workspace%
echo workspace -fr "audio" "%assetsMus%";>>%workspace%
echo ---
echo workspace -fr "FBX" "%assets%";>>%workspace%
echo workspace -fr "FBX export" "%assets%";>>%workspace%
echo workspace -fr "DAE_FBX" "%assets%";>>%workspace%
echo workspace -fr "DAE_FBX export" "%assets%";>>%workspace%
echo ---
echo workspace -fr "diskCache" "%artTemp%";>>%workspace%
echo workspace -fr "autoSave" "%artTemp%";>>%workspace%
echo ---
echo workspace -fr "Asset" "%assets%";>>%workspace%
echo workspace -fr "Asset_Anim" "%assetsAnim%";>>%workspace%
echo workspace -fr "Asset_Char" "%assetsChar%";>>%workspace%
echo workspace -fr "Asset_Prop" "%assetsProp%";>>%workspace%
echo workspace -fr "Asset_Scen" "%assetsScen%";>>%workspace%
echo workspace -fr "Asset_Hud" "%assetsHud%";>>%workspace%
echo workspace -fr "Asset_Sfx" "%assetsSfx%";>>%workspace%
echo workspace -fr "Asset_Mus" "%assetsMus%";>>%workspace%
echo workspace -fr "Asset_Scri" "%assetsScri%";>>%workspace%
echo ---
echo workspace -fr "Art" "%art%";>>%workspace%
echo workspace -fr "Art_Anim" "%artAnim%";>>%workspace%
echo workspace -fr "Art_Char" "%artChar%";>>%workspace%
echo workspace -fr "Art_Prop" "%artProp%";>>%workspace%
echo workspace -fr "Art_Scen" "%artScen%";>>%workspace%
echo workspace -fr "Art_Text" "%artText%";>>%workspace%
echo workspace -fr "Art_Hud" "%artHud%";>>%workspace%
echo workspace -fr "Art_Source" "%artSrcs%";>>%workspace%
echo workspace -fr "Art_Temp" "%artTemp%";>>%workspace%
echo ---
echo workspace -fr "Dev_Icons" "%scrIco%";>>%workspace%
echo workspace -fr "Dev_Mel" "%scrMel%";>>%workspace%
echo workspace -fr "Dev_Python" "%scrPyt%";>>%workspace%
echo workspace -fr "Dev_Presets" "%scrPst%";>>%workspace%
REM ...
REM write unused paths (empty path)
REM ...
echo workspace -fr "Alembic" "";>>%workspace%
echo workspace -fr "Autodesk Packet File" "";>>%workspace%
echo workspace -fr "CATIAV4_DC" "";>>%workspace%
echo workspace -fr "CATIAV5_DC" "";>>%workspace%
echo workspace -fr "CSB_DC" "";>>%workspace%
echo workspace -fr "DWG_DC" "";>>%workspace%
echo workspace -fr "DWG_DCE" "";>>%workspace%
echo workspace -fr "DXF_DC" "";>>%workspace%
echo workspace -fr "DXF_DCE" "";>>%workspace%
echo workspace -fr "GE2" "";>>%workspace%
echo workspace -fr "IGES_DC" "";>>%workspace%
echo workspace -fr "IGES_DCE" "";>>%workspace%
echo workspace -fr "IPT_DC" "";>>%workspace%
echo workspace -fr "IV_DC" "";>>%workspace%
echo workspace -fr "JT_DC" "";>>%workspace%
echo workspace -fr "PTC_DC" "";>>%workspace%
echo workspace -fr "SPF_DC" "";>>%workspace%
echo workspace -fr "SPF_DCE" "";>>%workspace%
echo workspace -fr "STEP_DC" "";>>%workspace%
echo workspace -fr "STL_DC" "";>>%workspace%
echo workspace -fr "SW_DC" "";>>%workspace%
echo workspace -fr "UG_DC" "";>>%workspace%
echo workspace -fr "UG_DCE" "";>>%workspace%
echo workspace -fr "ZPR_DCE" "";>>%workspace%
echo workspace -fr "bifrostCache" "";>>%workspace%
echo workspace -fr "depth" "";>>%workspace%
echo workspace -fr "eps" "";>>%workspace%
echo workspace -fr "fileCache" "";>>%workspace%
echo workspace -fr "fluidCache" "";>>%workspace%
echo workspace -fr "furAttrMap" "";>>%workspace%
echo workspace -fr "furEqualMap" "";>>%workspace%
echo workspace -fr "furFiles" "";>>%workspace%
echo workspace -fr "furImages" "";>>%workspace%
echo workspace -fr "furShadowMap" "";>>%workspace%
echo workspace -fr "illustrator" "";>>%workspace%
echo workspace -fr "iprImages" "";>>%workspace%
echo workspace -fr "move" "";>>%workspace%
echo workspace -fr "movie" "";>>%workspace%
echo workspace -fr "offlineEdit" "";>>%workspace%
echo workspace -fr "particles" "";>>%workspace%
echo workspace -fr "renderData" "";>>%workspace%
echo workspace -fr "rtg" "";>>%workspace%
echo workspace -fr "shaders" "";>>%workspace%
echo workspace -fr "translatorData" "";>>%workspace%
echo workspace -fr "vrml2" "";>>%workspace%
REM ...
REM write script user setups files
REM ...
set pathScrPyt=%scrPyt:/=\%
set pathScrMel=%scrMel:/=\%
set uMel=%pathScrMel%\usersetup.mel
set uPyt=%pathScrPyt%\usersetup.py
IF EXIST %uMel% GOTO done
echo.
echo Write script Env
echo ================
echo.
echo CREATE usersetup.mel
echo // doc generation setup>%uMel%
echo string $doc[]; clear($doc); $doc[0] = "===="; global proc doc() {eval("print (stringArrayRemoveDuplicates(`sort($doc)`))");};>>%uMel%
REM
echo // define scripts folders>>%uMel%
echo string $mel = `workspace -q -rd` + "%scrMel%/";>>%uMel%
echo string $pyt = `workspace -q -rd` + "%scrPyt%/";>>%uMel%
REM
echo // source all mel files, except usersetup.mel>>%uMel%
echo string $mels[] = stringArrayRemove({"usersetup.mel"},`getFileList -folder $mel -filespec "*.mel"`);>>%uMel%
echo for ( $i=0 ; $i^<size($mels) ; $i++) eval("source \"" + $mel + $mels[$i] + "\";");>>%uMel%
REM
echo print "\nProject Scripts MEL is sourced";>>%uMel%
REM
echo // defines env setup for python scripts>>%uMel%
echo python("import sys\nsys.path.append('" + $pyt + "')");>>%uMel%
echo python("import usersetup"+"\n"+"reload(usersetup)"+"\n"+"usersetup.source()");>>%uMel%
REM
echo print "\nAll tools are sourced";>>%uMel%
echo.
echo CREATE usersetup.py
echo def source():>%uPyt%
echo #import yourPythonHereWithoutExt>>%uPyt%
echo #reload(yourPythonHereWithoutExt)>>%uPyt%
echo pass>>%uPyt%
echo print('\nProject Scripts PYTHONS is sourced')>>%uPyt%
REM ...
REM work is finished
REM ...
:done
echo.
echo DONE
goto end
:notCreate
echo.
echo %project% is exists! Nothing is create
:end
echo.
pause
Aucun commentaire:
Enregistrer un commentaire