// =========================================================================== // 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. // =========================================================================== // // Method: animPerf() // // Description: // Runs a fps test against // the current scene // // Flags: // None. // // Returns: // frames per second // proc float _animPerf() { float $startFrame = `playbackOptions -query -ast`; float $endFrame = `playbackOptions -query -aet`; // change the frame to $endFrame to start. We need to be sure that we are not on startFrame before we run the script. // if we ARE on startFrame, then the first refresh won't have to do any evaluation and we'll get a bad result. currentTime $startFrame; playbackOptions -ast $startFrame -aet $endFrame -loop "once" -min $startFrame -max $endFrame -ps 0 -mps 0; float $startTime = `timerX`; play -w; float $totalTime = `timerX -startTime $startTime`; playbackOptions -loop "continuous"; // We don't include the time changing to $startFrame because we may already be on that frame. float $frameCount = $endFrame - $startFrame; float $fps = $frameCount/$totalTime; print ("Total time: " + $totalTime + "\n"); print ("Frame Rate: " + $fps + "\n"); return $fps; } // Switches to vp2 global proc float animPerf() { print "Displaying in VP2 shaded mode\n"; DisplayShaded; ActivateViewport20; return _animPerf(); } // Uses current viewport global proc float animPerfcv() { print "Displaying in current viewport + shaded mode\n"; DisplayShaded; return _animPerf(); }