// =========================================================================== // 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. // =========================================================================== // // // // // // void displayStyle( string $flag ) // // // Changes the current display style in the active window. // // // string $style Single style type to enable on the window. // -h/-help = Show this help information // -tx/-textured = Use textured display // -ss/-smoothshaded = Use smooth shaded display // -w/-wireframe = Use wireframe display // -wos/-wireframeOnShaded = Use wireframe-on-shaded display // -nowos/-noWireframeOnShaded = Use wireframe-on-shaded display // -db/-doubleBuffer = Use double buffer mode // -sb/-singleBuffer = Use single buffer mode // // // No return value // // // // displayStyle -textured // [ Window switches to textured object display] // // displayStyle -textured // [ No effect - textured display mode is already on] // // displayStyle -wireframe // [ Window switched to wireframe object display] // // // global proc displayStyle ( string $flag ) { if ( `about -batch` ) { // Don't do anything in batch mode return; } string $style = ""; string $bufferMode = ""; int $wireframeOnShaded = 0; int $smoothShadedSelect = 0; int $texturedSelect = 0; if ( ( $flag == "-ss" ) || ( $flag == "-smoothShaded" ) ){ $style = "smoothShaded"; $smoothShadedSelect = 1; $texturedSelect = 0; } else if ( ( $flag == "-tx" ) || ( $flag == "-textured" ) ) { $style = "smoothShaded"; $smoothShadedSelect = 0; $texturedSelect = 1; } else if ( ( $flag == "-w" ) || ( $flag == "-wireframe" ) ) { $style = "wireframe"; $smoothShadedSelect = 0; $texturedSelect = 0; } else if ( ( $flag == "-wos" ) || ( $flag == "-wireframeOnShaded" ) ) { $style = "wireframeOnShaded"; $wireframeOnShaded = 1; } else if ( ( $flag == "-nowos" ) || ( $flag == "-noWireframeOnShaded" ) ) { $style = "wireframeOnShaded"; $wireframeOnShaded = 0; } else if ( ( $flag == "-sb" ) || ( $flag == "-singleBuffer" ) ) { $bufferMode = "single"; } else if ( ( $flag == "-db" ) || ( $flag == "-doubleBuffer" ) ) { $bufferMode = "double"; } else if ( ( $flag == "-h" ) || ( $flag == "-help" ) ) { // Reproduce the usage information here since this is not a // standard command (where this would have been generated // automatically). print (uiRes("m_displayStyle.kDisplayStyleHelp0")); print (uiRes("m_displayStyle.kDisplayStyleHelp1")); print (uiRes("m_displayStyle.kDisplayStyleHelp2")); print (uiRes("m_displayStyle.kDisplayStyleHelp3")); print (uiRes("m_displayStyle.kDisplayStyleHelp4")); print (uiRes("m_displayStyle.kDisplayStyleHelp5")); print (uiRes("m_displayStyle.kDisplayStyleHelp6")); print (uiRes("m_displayStyle.kDisplayStyleHelp7")); print (uiRes("m_displayStyle.kDisplayStyleHelp8")); print (uiRes("m_displayStyle.kDisplayStyleHelp9")); print (uiRes("m_displayStyle.kDisplayStyleHelp10")); print (uiRes("m_displayStyle.kDisplayStyleHelp11")); return; } else { string $errorFmt = (uiRes("m_displayStyle.kDisplayStyleError")); string $errorMsg = `format -s $flag $errorFmt`; error ( $errorMsg ); } string $focusPanel = `getPanel -withFocus`; global string $gViewport2; if ( `getPanel -to $focusPanel` == "modelPanel" ) { if ( $style != "" ) { if($style == "wireframeOnShaded") { modelEditor -edit -wos $wireframeOnShaded $focusPanel; } else { modelEditor -edit -da $style $focusPanel; } if ($texturedSelect) { modelEditor -edit -displayTextures true -displayLights "default" $focusPanel; } else if ($smoothShadedSelect) { modelEditor -edit -displayTextures false $focusPanel; } } else if ( $bufferMode != "" && getViewportRenderer($focusPanel) != $gViewport2 ) { modelEditor -edit -bufferMode $bufferMode $focusPanel; } else { modelEditor -edit $focusPanel; } } }