// =========================================================================== // 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. // =========================================================================== // Code adapted from the CgFX plugin by NVidia // // This script is run automatically when the GLSLShader plug-in is loaded. { // Set default definitions for tool buttons in GLSLShader attribute editor. // [0]: for each of the 2 tool buttons, the assigned tool name (tab separated) // [1..N]: any number of tool definitions consisting of tab-separated // tool name, icon, description, and MEL command string string $s = "AEGLSLShader_toolSymbolButtons"; if ( !`about -batch` && !`optionVar -exists $s` ) { string $reloadTool = getPluginResource( "glslShader", "kReloadTool"); string $reloadIcon = "refresh.png"; string $reloadAnnotation = getPluginResource( "glslShader", "kReloadAnnotation"); string $reloadCommand = "GLSLShader -r ;"; string $editTool = getPluginResource( "glslShader", "kEditTool"); string $editIcon = "fileTextureEdit.png"; string $editAnnotation; string $editCommand; if ( `about -nt` ) { $editAnnotation = getPluginResource( "glslShader", "kEditAnnotationWIN"); $editCommand = "system \"load \";"; } else if ( `about -macOS` ) { $editAnnotation = getPluginResource( "glslShader", "kEditAnnotationMAC"); $editCommand = "open -a TextEdit ;"; } else { $editAnnotation = getPluginResource( "glslShader", "kEditAnnotationLNX"); $editCommand = getPluginResource( "glslShader", "kEditCommandLNX"); } string $tools = $reloadTool + "\t" + $editTool; string $reloadArgs = $reloadTool + "\t" + $reloadIcon + "\t" + $reloadAnnotation + "\t" + $reloadCommand; string $editArgs = $editTool + "\t" + $editIcon + "\t" + $editAnnotation + "\t" + $editCommand; optionVar -sva $s ($tools) -sva $s ($reloadArgs) -sva $s ($editArgs) ; } }