// =========================================================================== // 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: 1/27/97 // // // Description: // This creates a window with a slider for the stroke quality command // under the "Display" menu on the main menubar. // global int $somethingSelectedJob = 0; global int $selectionChangedJob = 0; global int $strokeQualityScriptJob = 0; global proc strokeKillScriptJobs() { global int $somethingSelectedJob; global int $selectionChangedJob; scriptJob -kill $somethingSelectedJob; scriptJob -kill $selectionChangedJob; $somethingSelectedJob = 0; $selectionChangedJob = 0; } global proc strokeQualityReset() { setStrokeQuality 0.0; floatSliderGrp -e -v 0.0 strokeQualitywidget; } global proc strokeQualityUpdate() { global int $somethingSelectedJob; global int $selectionChangedJob; string $strokes[] = `getStrokes 2`; int $numStrokes = size( $strokes ); // The script job *should* have been killed if the window was closed, but just to be sure, let's check. int $windowExists = `window -ex strokeQualityWnd`; if ($numStrokes != 0 && $windowExists) { string $stroke = $strokes[ $numStrokes - 1 ]; int $display = `getAttr ($stroke + ".displayPercent")`; floatSliderGrp -e -v $display strokeQualitywidget; setStrokeQuality ($display); } } global proc strokeSomethingSelected() { strokeQualityUpdate( ); } global proc strokeSelectionChanged() { strokeQualityUpdate( ); } global proc strokeQualityWin() { global int $somethingSelectedJob; global int $selectionChangedJob; global int $strokeQualityScriptJob; float $strokeQualityVal1; $strokeQualityVal1 = 0; if ( `window -ex strokeQualityWnd` ) { showWindow strokeQualityWnd; } else { window -rtf 1 -title (uiRes("m_strokeQualityWin.kStrokeDisplayQuality")) -iconName (uiRes("m_strokeQualityWin.kStrokeQuality")) -menuBar 1 strokeQualityWnd; setParent strokeQualityWnd; formLayout strokeQualityform; rowLayout -nc 2 -cw 1 60 -cw 2 300 strokeQualityrow1; setParent strokeQualityform; columnLayout strokeQualitycol; floatSliderGrp -field 1 -min 0.0 -max 100.0 -pre 1 -v $strokeQualityVal1 -dc "setStrokeQuality #1" -cc "setStrokeQuality #1" strokeQualitywidget; formLayout -e -af strokeQualitycol top 3 -af strokeQualitycol left 3 -af strokeQualitycol right 3 -af strokeQualitycol bottom 3 strokeQualityform; $somethingSelectedJob = `scriptJob -conditionTrue "SomethingSelected" "strokeSomethingSelected"`; $selectionChangedJob = `scriptJob -event "SelectionChanged" "strokeSelectionChanged"`; $strokeQualityScriptJob = `scriptJob -runOnce true -uiDeleted strokeQualityWnd strokeKillScriptJobs`; // Call the something selected method so that the slider is updated to the correct value. strokeSomethingSelected(); } showWindow strokeQualityWnd; }