// =========================================================================== // 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. // =========================================================================== proc setOptionVars (int $forceFactorySettings) { if ($forceFactorySettings || !`optionVar -exists hwTxBlend`) optionVar -stringValue hwTxBlend "modulate"; if ($forceFactorySettings || !`optionVar -exists hwTxFilter`) optionVar -intValue hwTxFilter 2; if ($forceFactorySettings || !`optionVar -exists hwTxAniso`) optionVar -intValue hwTxAniso 0; } global proc hwTxOptionsSetup (string $parent, int $forceFactorySettings) { setOptionVars($forceFactorySettings); setParent $parent; string $sval; $sval = `optionVar -query hwTxBlend`; if ($sval == "modulate") optionMenuGrp -edit -sl 1 hwTxBlend; else // decal optionMenuGrp -edit -sl 2 hwTxBlend; int $val; $val = `optionVar -query hwTxFilter`; if ($val == 1) optionMenuGrp -edit -sl 1 hwTxFilter; else optionMenuGrp -edit -sl 2 hwTxFilter; $val = `optionVar -query hwTxAniso`; checkBoxGrp -edit -value1 $val hwTxAniso; } global proc hwTxOptionsCallback (string $parent, int $doIt, string $editor) { setParent $parent; int $val = `optionMenuGrp -query -sl hwTxBlend`; if ($val == 1) optionVar -stringValue hwTxBlend "modulate"; else optionVar -stringValue hwTxBlend "decal"; optionVar -intValue hwTxFilter `optionMenuGrp -query -sl hwTxFilter`; optionVar -intValue hwTxAniso `checkBoxGrp -query -value1 hwTxAniso`; if ($doIt) { hwTxOptions 0 $editor; } } proc hwTxOptionsOptions(string $editor) { global string $gHighQualityViewport; string $commandName = "hwTxOptions"; string $callback = ($commandName + "Callback"); string $setup = ($commandName + "Setup"); string $layout = getOptionBox(); setParent $layout; setUITemplate -pushTemplate DefaultTemplate; waitCursor -state 1; string $parent = `columnLayout -adjustableColumn true`; // Texture blend and hq filtering make no sense for the HW renderer, // so disable these. string $renderer = `modelEditor -q -rnm $editor`; int $lowQualityMode = ($renderer != $gHighQualityViewport); optionMenuGrp -label (uiRes("m_hwTxOptions.kTextureBlend")) -enable $lowQualityMode hwTxBlend; menuItem -label (uiRes("m_hwTxOptions.kMultiply")); // Modulate menuItem -label (uiRes("m_hwTxOptions.kOver")); // Decal setParent -menu ..; optionMenuGrp -label (uiRes("m_hwTxOptions.kTextureFilter")) hwTxFilter; menuItem -label (uiRes("m_hwTxOptions.kUnfiltered")); // GL_NEAREST or point menuItem -label (uiRes("m_hwTxOptions.kBilinear")); menuItem -label (uiRes("m_hwTxOptions.kMipMapNearest")); menuItem -label (uiRes("m_hwTxOptions.kMipMapLinear")); menuItem -label (uiRes("m_hwTxOptions.kMipMapBilinear")); menuItem -label (uiRes("m_hwTxOptions.kMipMapTrilinear")); setParent -menu ..; checkBoxGrp -label1 (uiRes("m_hwTxOptions.kHighQualityFiltering")) -enable $lowQualityMode hwTxAniso; setParent $parent; waitCursor -state 0; setUITemplate -popTemplate; string $applyBtn = getOptionBoxApplyBtn(); button -edit -label (uiRes("m_hwTxOptions.kSet")) -command ($callback + " " + $parent + " " + 1 + " \"" + $editor + "\"") $applyBtn; string $saveBtn = getOptionBoxSaveBtn(); button -edit -command ($callback + " " + $parent + " " + 0 + " \"" + $editor + " \"" + "; hideOptionBox") $saveBtn; string $resetBtn = getOptionBoxResetBtn(); button -edit -command ($setup + " " + $parent + " " + 1) $resetBtn; setOptionBoxTitle (uiRes("m_hwTxOptions.kHardwareTextureDisplayOptions")); setOptionBoxHelpTag( "HardwareTextureDisplay" ); eval (($setup + " " + $parent + " " + 0)); showOptionBox(); } global proc string hwTxOptions (int $option, string $editor) { string $cmd=""; switch ($option) { case 1: hwTxOptionsOptions $editor; // Just the option box break; default: setOptionVars(false); string $blend = `optionVar -q hwTxBlend`; int $filter = `optionVar -q hwTxFilter`; int $aniso = `optionVar -q hwTxAniso`; $cmd = "modelEditor -e " + " -td \"" + $blend + "\"" + " -ts " + $filter + " -ta " + $aniso + " " + $editor + ";" ; if ($option == 0) evalEcho $cmd; break; } return $cmd; }