// =========================================================================== // 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: May 26, 2000 // // Description: // This script is the export skin weight map option box dialog. // // Input Arguments: // None. // // Return Value: // None. // global proc adjustSkinMapSizeSlider(string $whichSlider) { float $ratio; if ( eval("checkBoxGrp -q -v1 exportSkinKeepAspectChkBox") ) { $ratio = eval("artAttrSkinPaintCtx -q -exportaspectratio artAttrSkinContext"); if ( $whichSlider == "xSlider" ) { float $valX = eval("intSliderGrp -q -v exportSkinMapSizeXSlider"); float $newVal = $valX/$ratio; intSliderGrp -e -v $newVal exportSkinMapSizeYSlider; eval("artAttrSkinPaintCtx -e -exportfilesizey " + $newVal + " artAttrSkinContext"); } else { float $valY = eval("intSliderGrp -q -v exportSkinMapSizeYSlider"); float $newVal = $valY*$ratio; intSliderGrp -e -v $newVal exportSkinMapSizeXSlider; eval("artAttrSkinPaintCtx -e -exportfilesizex " + $newVal + " artAttrSkinContext"); } } } global proc setSkinMapAspectRatio() { if ( eval("checkBoxGrp -q -v1 exportSkinKeepAspectChkBox") ) { float $valX = eval("intSliderGrp -q -v exportSkinMapSizeXSlider"); float $valY = eval("intSliderGrp -q -v exportSkinMapSizeYSlider"); // calculate the aspect ratio float $ratio = $valX/$valY; // set the aspect ratio in artisan. eval("artAttrSkinPaintCtx -e -exportaspectratio " + $ratio + " artAttrSkinContext"); } } proc setOptionVars (int $forceFactorySettings) { // exportSkinValue // 1: alpha // 2: luminance // if ( $forceFactorySettings ) { artAttrSkinPaintCtx -e -exportfilemode "luminance" artAttrSkinContext; } // x and y map size // if ( $forceFactorySettings ) { artAttrSkinPaintCtx -e -exportfilesizex 512 artAttrSkinContext; } if ( $forceFactorySettings ) { artAttrSkinPaintCtx -e -exportfilesizey 512 artAttrSkinContext; } // aspect ratio // if ( $forceFactorySettings ) { artAttrSkinPaintCtx -e -exportaspectratio 1 artAttrSkinContext; } // image format // if ( $forceFactorySettings ) { artAttrSkinPaintCtx -e -exportfiletype "IFF" artAttrSkinContext; } } // // Procedure Name: // exportSkinMapSetup // // Description: // Update the state of the option box UI to reflect the option values. // // Input Arguments: // parent - Top level parent layout of the option box UI. // Required so that UI object names can be // successfully resolved. // // forceFactorySettings - Whether the option values should be set to // default values. // // Return Value: // None. // global proc exportSkinMapSetup (string $parent, int $forceFactorySettings) { // Retrieve the option settings. setOptionVars( $forceFactorySettings ); setParent $parent; string $mval = `artAttrSkinPaintCtx -q -exportfilemode artAttrSkinContext`; if ($mval == "luminance") { radioButtonGrp -e -sl 1 exportSkinMapLumin; } else { radioButtonGrp -e -sl 1 exportSkinMapAlpha; } int $val = `artAttrSkinPaintCtx -q -exportfilesizex artAttrSkinContext`; intSliderGrp -e -v $val exportSkinMapSizeXSlider; $val = `artAttrSkinPaintCtx -q -exportfilesizey artAttrSkinContext`; intSliderGrp -e -v $val exportSkinMapSizeYSlider; $val = `artAttrSkinPaintCtx -q -exportaspectratio artAttrSkinContext`; checkBoxGrp -e -v1 $val exportSkinKeepAspectChkBox; string $ftype = `artAttrSkinPaintCtx -query -exportfiletype artAttrSkinContext`; optionMenuGrp -e -v $ftype imageFormatSkinMapMenu; } // // Procedure Name: // exportSkinMapCallback // // Description: // Update the option values with the current state of the option box UI. // // Input Arguments: // parent - Top level parent layout of the option box UI. Required so // that UI object names can be successfully resolved. // // doIt - Whether the command should execute. // // Return Value: // None. // global proc exportSkinMapCallback (string $parent, int $doIt) { setParent $parent; // Set the correct radio button. int $val = `radioButtonGrp -q -sl exportSkinMapLumin`; if ($val == 1) { artAttrSkinPaintCtx -e -exportfilemode "luminance" artAttrSkinContext; } else { artAttrSkinPaintCtx -e -exportfilemode "alpha" artAttrSkinContext; } $val = `intSliderGrp -q -v exportSkinMapSizeXSlider`; artAttrSkinPaintCtx -e -exportfilesizex $val artAttrSkinContext; $val = `intSliderGrp -q -v exportSkinMapSizeYSlider`; artAttrSkinPaintCtx -e -exportfilesizey $val artAttrSkinContext; $val = `checkBoxGrp -q -v1 exportSkinKeepAspectChkBox`; artAttrSkinPaintCtx -e -exportaspectratio $val artAttrSkinContext; string $ftype = `optionMenuGrp -q -v imageFormatSkinMapMenu`; artAttrSkinPaintCtx -e -exportfiletype $ftype artAttrSkinContext; if ($doIt) performExportSkinMap false; } proc string exportSkinMapWidgets( string $parent ) { setParent $parent; string $tabForm = `columnLayout -adj true`; radioButtonGrp -numberOfRadioButtons 1 -label (uiRes("m_performExportSkinMap.kExportValue")) -label1 (uiRes("m_performExportSkinMap.kAlpha")) exportSkinMapAlpha; radioButtonGrp -numberOfRadioButtons 1 -label "" -label1 (uiRes("m_performExportSkinMap.kLuminance")) -shareCollection exportSkinMapAlpha exportSkinMapLumin; intSliderGrp -field true -label (uiRes("m_performExportSkinMap.kMapSizeX")) -min 1 -max 8192 -v 512 -ss 512 -cc ("artAttrSkinPaintCtx -e -exportfilesizex #1 artAttrSkinContext; adjustSkinMapSizeSlider xSlider") exportSkinMapSizeXSlider; intSliderGrp -field true -label (uiRes("m_performExportSkinMap.kMapSizeY")) -min 1 -max 8192 -v 512 -ss 512 -cc ("artAttrSkinPaintCtx -e -exportfilesizey #1 artAttrSkinContext; adjustSkinMapSizeSlider ySlider") exportSkinMapSizeYSlider; checkBoxGrp -label (uiRes("m_performExportSkinMap.kKeepAspectRatio")) -label1 "" -cc1 ("setSkinMapAspectRatio") exportSkinKeepAspectChkBox; optionMenuGrp -label (uiRes("m_performExportSkinMap.kImageFormat")) -cc ("artAttrSkinPaintCtx -e -exportfiletype \"#1\" artAttrSkinContext") -cw 1 90 imageFormatSkinMapMenu; if(`about -mac`){ menuItem -label "TIFF" fileFormatMenuItem0; menuItem -label "SGI" fileFormatMenuItem1; menuItem -label "IFF" fileFormatMenuItem2; menuItem -label "JPEG" fileFormatMenuItem3; menuItem -label "Targa" fileFormatMenuItem4; menuItem -label "WindowsBitmap" fileFormatMenuItem5; menuItem -label "QuickTime Image" fileFormatMenuItem6; menuItem -label "QuickDraw" fileFormatMenuItem7; menuItem -label "Photoshop" fileFormatMenuItem8; menuItem -label "PNG" fileFormatMenuItem9; }else{ menuItem -label "GIF" fileFormatMenuItem0; menuItem -label "SoftImage" fileFormatMenuItem1; menuItem -label "RLA" fileFormatMenuItem2; menuItem -label "TIFF" fileFormatMenuItem3; menuItem -label "SGI" fileFormatMenuItem4; menuItem -label "Alias" fileFormatMenuItem5; menuItem -label "IFF" fileFormatMenuItem6; menuItem -label "JPEG" fileFormatMenuItem7; menuItem -label "EPS" fileFormatMenuItem8; menuItem -label "Quantel" fileFormatMenuItem9; } setParent ..; setParent ..; return $tabForm; } global proc exportSkinMapOptions () { string $commandName = "exportSkinMap"; // Build the option box "methods" // string $callback = ($commandName + "Callback"); string $setup = ($commandName + "Setup"); // Get the option box. // // The value returned is the name of the layout to be used as // the parent for the option box UI. // string $layout = getOptionBox(); setParent $layout; setOptionBoxCommandName("exportSkinMap"); setUITemplate -pushTemplate DefaultTemplate; waitCursor -state 1; tabLayout -scr true -tv false; // To get the scroll bars string $parent = `columnLayout -adjustableColumn 1`; exportSkinMapWidgets $parent; waitCursor -state 0; setUITemplate -popTemplate; // 'Apply' button. // string $applyBtn = getOptionBoxApplyBtn(); button -edit -label (uiRes("m_performExportSkinMap.kExport")) -command ($callback + " " + $parent + " " + 1) $applyBtn; // 'Save' button. // string $saveBtn = getOptionBoxSaveBtn(); button -edit -command ($callback + " " + $parent + " " + 0 + "; hideOptionBox") $saveBtn; // 'Reset' button. // string $resetBtn = getOptionBoxResetBtn(); button -edit -command ($setup + " " + $parent + " " + 1) $resetBtn; // Set the option box title. // setOptionBoxTitle (uiRes("m_performExportSkinMap.kExportSkinWeight")); // Customize the 'Help' menu item text. // setOptionBoxHelpTag( "ExportSkinWeightMaps" ); // Set the current values of the option box. // eval (($setup + " " + $parent + " " + 0)); // Show the option box. // showOptionBox(); } // // Procedure Name: // assembleCmd // // Description: // Construct the command that will apply the option box values. // // Input Arguments: // None. // // Return Value: // None. // proc string assembleCmd() { string $cmd; setOptionVars(false); $cmd = "exportSkinMap 1 { " + // "\"" + $mapMethod + "\"" + " };"; return $cmd; } // // Procedure Name: // performExportSkinMap // // Description: // Post a window with the export character map options or assemble // a string corresponding to the character map command. // // // Input Arguments: // 0 - Execute the command. // 1 - Show the option box dialog. // 2 - Return the command. // // Return Value: // None. // global proc string performExportSkinMap(int $action) { if (! `artAttrSkinPaintCtx -exists artAttrSkinContext`) { // create the context if it does not yet exist so we can // query its settings // string $currCtx = `currentCtx`; artAttrSkinToolScript 4; setToolTo $currCtx; } switch ($action) { // Execute the command. // case 0: // Retrieve the option settings // setOptionVars(false); // Get the command. // $cmd = `assembleCmd`; // Execute the command with the option settings. // if ($cmd != "") evalEcho($cmd); break; // Show the option box. // case 1: exportSkinMapOptions; break; case 2: // Get the command. // $cmd = `assembleCmd`; } return $cmd; }