// =========================================================================== // 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: October, 2009 // // Procedure Name: // performSetTimecode // // Description: // Brings up a window where users can set the timecode information. // // Return Value: // None // global proc setTimecodeSetup (string $parent, int $forceFactorySettings) { setParent $parent; if($forceFactorySettings) { //just zero out everything. intField -e -v 0 productionStartTimeHour; intField -e -v 0 productionStartTimeMinute; intField -e -v 0 productionStartTimeSeconds; floatField -e -v 0.0 productionStartTimeFrame; floatField -e -v 0.0 mayaStartTimeFrame; } else { //query the timecode command for current values. int $hour = `timeCode -q -psh`; int $minute = `timeCode -q -psm`; int $second = `timeCode -q -pss`; float $frame = `timeCode -q -psf`; float $mayaFrame = `timeCode -q -msf`; intField -e -v $hour productionStartTimeHour; intField -e -v $minute productionStartTimeMinute; intField -e -v $second productionStartTimeSeconds; floatField -e -v $frame productionStartTimeFrame; floatField -e -v $mayaFrame mayaStartTimeFrame; } } global proc updateTimecodeData() { int $productionStartHour = `intField -q -v productionStartTimeHour`; int $productionStartMinute = `intField -q -v productionStartTimeMinute`; int $productionStartSecond = `intField -q -v productionStartTimeSeconds`; float $productionStartFrame = `floatField -q -v productionStartTimeFrame`; float $mayaStartFrame = `floatField -q -v mayaStartTimeFrame`; timeCode -psh $productionStartHour -psm $productionStartMinute -pss $productionStartSecond -psf $productionStartFrame -msf $mayaStartFrame; refresh; } global proc setTimecodeCallback (string $parent, int $doIt) { setParent $parent; if($doIt) { updateTimecodeData; } } proc setTimecodeOptions () { string $commandName = "setTimecode"; string $callback = ($commandName + "Callback"); string $setup = ($commandName + "Setup"); string $layout = getOptionBox(); setParent $layout; setUITemplate -pushTemplate DefaultTemplate; waitCursor -state 1; string $parent = `columnLayout -adjustableColumn 1`; setParent $parent; separator -style "none" -h 5; columnLayout -adj true; rowLayout -nc 9 -cw 1 200 -cw 2 40 -cw 3 20 -cw 4 40 -cw 5 20 -cw 6 40 -cw 7 20 -cw 8 50 -cw 9 40 -cat 1 both 0 -cat 2 both 0 -cat 3 both 0 -cat 4 both 0 -cat 5 both 0 -cat 6 both 0 -cat 7 both 0 -cat 8 both 0 -cat 9 both 0 -cal 1 right -cal 3 left -cal 5 left -cal 7 left -cal 8 right ; text -label (uiRes("m_performSetTimecode.kProductionStartTime")); intField -maxValue 23 -minValue -23 productionStartTimeHour; text -label (uiRes("m_performSetTimecode.kProductionStartTimeHour")); intField -minValue 0 -maxValue 59 productionStartTimeMinute; text -label (uiRes("m_performSetTimecode.kProductionStartTimeMinute")); intField -minValue 0 -maxValue 59 productionStartTimeSeconds; text -label (uiRes("m_performSetTimecode.kProductionStartTimeSeconds")); text -label (uiRes("m_performSetTimecode.kProductionStartTimeFrame")); floatField -minValue 0 -maxValue 99 -precision 3 productionStartTimeFrame; setParent .. ; rowLayout -nc 2 -cw 1 200 -cw 2 40 -cat 1 both 0 -cat 2 both 0 -cal 1 right ; text -label (uiRes("m_performSetTimecode.kMayaStartTime")); floatField -precision 3 mayaStartTimeFrame; waitCursor -state 0; setUITemplate -popTemplate; string $applyBtn = getOptionBoxApplyBtn(); button -edit -label (uiRes("m_performSetTimecode.kApplySetTimecode")) -command ($callback + " " + $parent + " " + 1) $applyBtn; string $applyAndCloseBtn = getOptionBoxApplyAndCloseBtn(); button -edit -label (uiRes("m_performSetTimecode.kApplyAndCloseSetTimecode")) $applyAndCloseBtn; string $resetBtn = getOptionBoxResetBtn(); button -edit -command ($setup + " " + $parent + " " + 1) $resetBtn; setOptionBoxTitle((uiRes("m_performSetTimecode.kAnimSetTimecode"))); // Customize the 'Help' menu item text. // ============================================ // setOptionBoxHelpTag("AnimSetTimecode"); // Set the current values of the option box. // ================================================= // eval (($setup + " " + $parent + " " + 0)); // Step 10: Show the option box. // ============================= // showOptionBox(); } global proc performSetTimecode () { setTimecodeOptions; }