// Copyright 2014 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. //- // ========================================================================== // // ========================================================================== //+ global proc saveHelixUI() { // Read values out of controls // float $helixRadius = `floatSliderGrp -q -v "helixWindow|parameters|radius"`; float $helixPitch = `floatSliderGrp -q -v "helixWindow|parameters|pitch"`; optionVar -fv "helixPitch" $helixPitch -fv "helixRadius" $helixRadius; } global proc helixSave() { saveHelixUI; deleteUI helixWindow;; } global proc helixReset() { floatSliderGrp -e -v 4.0 "helixWindow|parameters|radius"; floatSliderGrp -e -v 0.1 "helixWindow|parameters|pitch"; } global proc helixCommand() { // Read values out of controls // float $helixRadius = `floatSliderGrp -q -v "helixWindow|parameters|radius"`; float $helixPitch = `floatSliderGrp -q -v "helixWindow|parameters|pitch"`; // Save the new current values for next time. saveHelixUI; // Call command (written in API) to create helix // helix -r $helixRadius -p $helixPitch; deleteUI helixWindow; } global proc helixUI() { // // Description: // Brings up a window which allows the user to create a helix // float $helixRadius; float $helixPitch; if ( !`optionVar -exists helixRadius` ) optionVar -fv helixRadius 4.0; if ( !`optionVar -exists helixPitch` ) optionVar -fv helixPitch 0.1; window -t "Helix Generator" -wh 400 110 "helixWindow"; // Create UI Controls // columnLayout -adj true -cal left -cw 400 parameters; floatSliderGrp -cw3 100 100 100 -field true -l "Radius:" -min 1.0 -max 5.0 -v `optionVar -q helixRadius` radius; floatSliderGrp -cw3 100 100 100 -field true -l "Pitch:" -min 0.1 -max 1.0 -v `optionVar -q helixPitch` pitch; rowColumnLayout -nc 4 -cw 1 100 -cw 2 100 -cw 3 100 -cw 4 100 buttons; button -l "Reset" resetButton; button -l "Save" saveButton; button -l "Cancel" cancelButton; button -l "OK" okayButton; setParent ..; setParent ..; // Set Callbacks // button -e -c "helixReset" resetButton; button -e -c "helixSave" saveButton; button -e -c "deleteUI helixWindow" cancelButton; button -e -c "helixCommand" okayButton; showWindow helixWindow; } menu -l "Plugins" -p "MayaWindow" pluginsMenu; menuItem -l "Helix" -c "helixUI" helixMenuItem;