// =========================================================================== // Copyright 2018 Autodesk, Inc. All rights reserved. // // Use of this software is subject to the terms of the Autodesk license // agreement provided at the time of installation or download, or which // otherwise accompanies this software in either electronic or hard copy form. // =========================================================================== // // // Creation Date: April 10, 1998 // // Description: // This script adds the default folders to a visor panel // // Input Arguments: // visor editor // // Return Value: // None. // global proc string[] getCharactersLoadedInTrax() // // Return the loaded characters // { string $characters[]; string $panel = `getPanel -underPointer`; if( $panel == "" ) { $panel = `getPanel -withFocus`; } if( $panel != "" ) { string $connItems[]; if ( "scriptedPanel" == `getPanel -typeOf $panel`) { if ( "clipEditorPanel" == `scriptedPanel -q -type $panel`) { string $editor = clipEditorNameFromPanel($panel); string $conn = `clipEditor -query -mainListConnection $editor`; $connItems = `selectionConnection -query -object $conn`; for ($item in $connItems) { if (nodeType($item) == "character") { $characters[size($characters)] = $item; } } } } } return $characters; } // // visor animation folder commands for filtering clip and pose nodes // global proc string[] getLibraryPoses() // // return list of poses not currently attached to any character // { string $library[]; string $poses[] = `pose -q -allPoses`; int $n = 0; int $nposes = size($poses); for ($i=0; $i < $nposes; $i++) { string $characters[] = `clip -q -ch $poses[$i]`; if (size($characters) == 0) $library[$n++] = $poses[$i]; } return $library; } global proc string[] getLibraryClips() // // return list of clips not currently attached to any character // { string $library[]; string $clips[] = `clip -q -allSourceClips`; int $n = 0; int $nclips = size($clips); for ($i=0; $i < $nclips; $i++) { string $characters[] = `clip -q -ch $clips[$i]`; if (size($characters) == 0) $library[$n++] = $clips[$i]; } return $library; } global proc string[] getAllCharacterClips() // // return list of clips attached to any character // { string $library[]; string $clips[] = `clip -q -allSourceClips`; int $n = 0; int $nclips = size($clips); for ($i=0; $i < $nclips; $i++) { string $characters[] = `clip -q -ch $clips[$i]`; if (size($characters) > 0) $library[$n++] = $clips[$i]; } return $library; } global proc string[] getAllCharacterPoses() // // return list of poses attached to any character // { string $library[]; string $poses[] = `pose -q -allPoses`; int $n = 0; int $nposes = size($poses); for ($i=0; $i < $nposes; $i++) { string $characters[] = `clip -q -ch $poses[$i]`; if (size($characters) > 0) $library[$n++] = $poses[$i]; } return $library; } global proc string[] getCharacterClips() // // return list of clips attached to loaded characters in trax // { string $allClips[]; string $characters[] = `currentCharacters`; int $nchars = size($characters); if ($nchars == 0) { $characters = getCharactersLoadedInTrax(); $nchars = size($characters); } if ($nchars == 0) return `getAllCharacterClips`; int $n = 0; for ($i=0; $i < $nchars; $i++) { string $clips[] = `clip -q -n $characters[$i]`; for ($j=0; $j < size($clips); $j++) $allClips[$n++] = $clips[$j]; } return $allClips; } global proc string[] getCharacterPoses() // // return list of poses attached to current character(s) // { string $allPoses[]; string $characters[] = `currentCharacters`; int $nchars = size($characters); if ($nchars == 0) { $characters = getCharactersLoadedInTrax(); $nchars = size($characters); } if ($nchars == 0) return `getAllCharacterPoses`; int $n = 0; for ($i=0; $i < $nchars; $i++) { string $poses[] = `pose -q -n $characters[$i]`; for ($j=0; $j < size($poses); $j++) $allPoses[$n++] = $poses[$j]; } return $allPoses; } global proc addVisorFolders(string $visorEd) { visor -reset $visorEd; int $isHyperShade; if($visorEd == "hyperShadePanel1VisorEd") { $isHyperShade = 1; }else{ $isHyperShade = 0; } // Animation Nodes Folder // visor -addFolder -name "Animation" -openDirectories 1 $visorEd; visor -addFolder -name "Character Clips & Poses" -parent "Animation" -type command -cmd "currentCharacters" $visorEd; visor -addFolder -name "Clips" -parent "Animation/Character Clips & Poses" -type command -cmd "getCharacterClips" $visorEd; visor -addFolder -name "Poses" -parent "Animation/Character Clips & Poses" -type command -cmd "getCharacterPoses" $visorEd; if (`about -mac`) { visor -addFolder -name "Unused Clips & Poses" -parent "Animation" -type command -cmd "currentCharacters" $visorEd; } else { visor -addFolder -name "Unused Clips & Poses" -parent "Animation" $visorEd; } visor -addFolder -name "Clips" -parent "Animation/Unused Clips & Poses" -type command -cmd "getLibraryClips" $visorEd; visor -addFolder -name "Poses" -parent "Animation/Unused Clips & Poses" -type command -cmd "getLibraryPoses" $visorEd; // Rendering Nodes Folder // visor -addFolder -name "Rendering" -openDirectories 1 $visorEd; visor -addFolder -name "Cameras" -parent "Rendering" -type command -cmd "ls -type camera -type imagePlane" $visorEd; visor -addFolder -name "Lights" -parent "Rendering" -type command -cmd "ls -type light" $visorEd; visor -addFolder -name "Materials" -parent "Rendering" -type connectedNodes -openFolder 1 -cmd "ls -type defaultShaderList" $visorEd; visor -addFolder -name "Post Process" -parent "Rendering" -type command -cmd "ls -type opticalFX -type shaderGlow" $visorEd; visor -addFolder -name "Textures" -parent "Rendering" -type connectedNodes -openFolder 1 -cmd "ls -type defaultTextureList" $visorEd; visor -addFolder -name "Utilities" -parent "Rendering" -type connectedNodes -cmd "ls -type defaultRenderUtilityList" $visorEd; /* // The Scene folder and the User Defined folder are disabled until we // decide exactly how they are intended to work. (jdc rendering) // if (`isTrue MayaCreatorExists` && (`licenseCheck -m "edit" -typ "particlePaint"`)) { // Scene Nodes Folder // visor -addFolder -name "Scene" $visorEd; // Scene/Deformers // visor -addFolder -name "Deformers" -parent "Scene" $visorEd; visor -addFolder -name "Blend Shapes" -parent "Scene/Deformers" -type command -cmd "ls -type blendShape" $visorEd; visor -addFolder -name "Clusters" -parent "Scene/Deformers" -type command -cmd "ls -type cluster" $visorEd; visor -addFolder -name "Lattices" -parent "Scene/Deformers" -type command -cmd "ls -type lattice" $visorEd; visor -addFolder -name "Sculpt Objects" -parent "Scene/Deformers" -type command -cmd "ls -type sculpt" $visorEd; visor -addFolder -name "Wires" -parent "Scene/Deformers" -type command -cmd "ls -type wire" $visorEd; // Scene/Dynamics // visor -addFolder -name "Dynamics" -parent "Scene" $visorEd; visor -addFolder -name "Emitters" -parent "Scene/Dynamics" -type command -cmd "ls -type pointEmitter" $visorEd; visor -addFolder -name "Particles" -parent "Scene/Dynamics" -type command -cmd "ls -type particle" $visorEd; visor -addFolder -name "Rigid Bodies" -parent "Scene/Dynamics" -type command -cmd "ls -type rigidBody" $visorEd; visor -addFolder -name "Rigid Constraints" -parent "Scene/Dynamics" -type command -cmd "ls -type rigidConstraint" $visorEd; // Scene/Geometry // visor -addFolder -name "Geometry" -parent "Scene" $visorEd; visor -addFolder -name "NURBS Curves" -parent "Scene/Geometry" -type command -cmd "ls -type nurbsCurve" $visorEd; visor -addFolder -name "NURBS Surface" -parent "Scene/Geometry" -type command -cmd "ls -type nurbsSurface" $visorEd; visor -addFolder -name "Polys" -parent "Scene/Geometry" -type command -cmd "ls -type mesh" $visorEd; visor -addFolder -name "Transforms" -parent "Scene/Geometry" -type command -cmd "ls -type transform" $visorEd; // Scene/IK // visor -addFolder -name "IK" -parent "Scene" $visorEd; visor -addFolder -name "Effectors" -parent "Scene/IK" -type command -cmd "ls -type ikEffector" $visorEd; visor -addFolder -name "Handles" -parent "Scene/IK" -type command -cmd "ls -type ikHandle" $visorEd; visor -addFolder -name "Joints" -parent "Scene/IK" -type command -cmd "ls -type joint" $visorEd; // User Defined Folders // visor -addFolder -name "User Defined" $visorEd; } */ // Create Nodes Folder // string $excludedMaterialTypes[] = `callbacks -executeCallbacks -hook "provideClassificationStrings"`; string $excludedMaterialTypesAsString = ""; for ($materialTypes in $excludedMaterialTypes) { $excludedMaterialTypesAsString = ($excludedMaterialTypesAsString + ":" + $materialTypes); } visor -addFolder -name "Create" -openDirectories 1 $visorEd; visor -addFolder -name "Cameras" -parent "Create" -type defaultNodes -cmd "cameraCreateFolder()" $visorEd; visor -addFolder -name "Lights" -parent "Create" -type defaultNodes -cmd "listNodeTypes light" $visorEd; visor -addFolder -name "Materials" -parent "Create" -openFolder $isHyperShade -type defaultNodes -cmd ("listNodeTypes -ex " + $excludedMaterialTypesAsString + " \"shader/surface\"") $visorEd; visor -addFolder -name "Volume" -parent "Create/Materials" -type defaultNodes -cmd "listNodeTypes \"shader/volume\"" $visorEd; visor -addFolder -name "Post Process" -parent "Create" -type defaultNodes -cmd "postProcessCreateFolder()" $visorEd; visor -addFolder -name "Textures" -parent "Create" -openFolder $isHyperShade -type defaultNodes -cmd "listNodeTypes texture" $visorEd; if (`about -mac`) { visor -addFolder -name "Utilities" -parent "Create" -type defaultNodes -cmd ""$visorEd; } else { visor -addFolder -name "Utilities" -parent "Create"$visorEd; } visor -addFolder -name "Color" -parent "Create/Utilities" -type defaultNodes -cmd "listNodeTypes \"utility/color\"" $visorEd; visor -addFolder -name "General" -parent "Create/Utilities" -type defaultNodes -cmd "listNodeTypes \"utility/general\"" $visorEd; visor -addFolder -name "Particle" -parent "Create/Utilities" -type defaultNodes -cmd "listNodeTypes \"utility/particle\"" $visorEd; visor -addFolder -name "Switch" -parent "Create/Utilities" -type defaultNodes -cmd "listNodeTypes \"utility/switch\"" $visorEd; // Project directory // visor -addFolder -openDirectories 1 -type directoryCommand -cmd "currentProjectParentDir()" -name "Project" $visorEd; if (`isTrue MayaCreatorExists` && (`licenseCheck -m "edit" -typ "particlePaint"`)) { string $runTimeDir = `getenv "MAYA_LOCATION"`; if ($runTimeDir != "") { string $brushDir = ($runTimeDir + "/brushes"); visor -addFolder -name "Brushes" -menu "CreatorShelf" -type shelfItems -cmd $brushDir $visorEd; } } // Custom disk folders // // Get from an optionVar the list of directories for which custom disk // folders are to be created. Create a folder for each. // if (`optionVar -exists visorCustomDiskFolders`) { int $i; string $customFolderNameArray[]; $customFolderNameArray = `optionVar -query visorCustomDiskFolders`; for ($i = 0; $i < size($customFolderNameArray); $i++) { visor -addFolder -type directory -openFolder true -path $customFolderNameArray[$i] -name $customFolderNameArray[$i] $visorEd; } } }