/********************************************************************** This script is provided as part of the Daz Script Documentation. The contents of this script, and\or any portion thereof, may only be used in accordance with the following license: Creative Commons Attribution 3.0 Unported (CC BY 3.0) - http://creativecommons.org/licenses/by/3.0 To contact Daz 3D or for more information about Daz Script visit the Daz 3D website: - http://www.daz3d.com **********************************************************************/ // Source: /public/software/dazstudio/4/referenceguide/scripting/api_reference/samples/specific_ui/active_viewport_drawstyle/start // Define an anonymous function; // serves as our main loop, // limits the scope of variables (function( sDrawStyle ){ // Get the viewport manager var oViewportMgr = MainWindow.getViewportMgr(); // Declare a working variable var oDrawStyle; // If a DrawStyle was not specified if( sDrawStyle.isEmpty() ){ // Get the number of DrawStyles var nDrawStyles = oViewportMgr.getNumUserDrawStyles(); // Iterate over the DrawStyles for( var i = 0; i < nDrawStyles; i += 1 ){ // Get the 'current' DrawStyle oDrawStyle = oViewportMgr.getUserDrawStyle( i ); // Inform the user print( oDrawStyle.getDescription() ); } // We are done... return; } // Find a DrawStyle by label var oDrawStyle = oViewportMgr.findUserDrawStyle( sDrawStyle ); // If we do not have a DrawStyle with that label if( !oDrawStyle ){ // Inform the user print( sDrawStyle, "could not be found." ); // We are done... return; } // Get the active viewport var oViewport = oViewportMgr.getActiveViewport(); // Get the 3D viewport var o3dViewport = oViewport.get3DViewport(); // Set the DrawStyle o3dViewport.setDrawStyle( oDrawStyle ); // Finalize the function and invoke })( "Texture Shaded" );