// =========================================================================== // 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. // =========================================================================== // // Return the caption string that should be used to identify an image // in the renderview global proc string renderWindowCaption(string $mode, float $renderTime) { string $result = ""; string $fmt, $msg; // Add the renderer and the mode, onthe first line string $renderer = currentRenderer(); string $renUIName = `renderer -query -rendererUIName $renderer`; $fmt = (uiRes("m_renderWindowCaption.kRenderer")); $msg = `format -s $renUIName -s $mode $fmt`; $result = $result + $msg; // Second line, add the frame number if (`optionVar -query renderViewShowFrameNumber`) { $frame = `currentTime -q`; $fmt = (uiRes("m_renderWindowCaption.kFrame")); $msg = `format -s $frame $fmt`; $result = $result + $msg; } // Add the computation time. Round time up, and format it. if (`optionVar -query renderViewShowRenderTime` && ($renderTime > 0.)) { $renderTime += .99; int $time = $renderTime; int $sec = `fmod $time 60`; $time -= $sec; $time /= 60; int $min = `fmod $time 60`; $time -= $min; $time /= 60; int $hour = `fmod $time 60`; string $timeString = $sec; if ($sec<10) $timeString = "0"+$timeString; if ($min>0) { $timeString = $min+":"+$timeString; if ($min<10) $timeString = " "+$timeString; if ($hour>0) { $timeString = $hour+":"+$timeString; } } else { $timeString = "0:"+$timeString; } $fmt = (uiRes("m_renderWindowCaption.kRenderTime")); $msg = `format -s $timeString $fmt`; $result = $result + $msg; } // Add the camera name if (`optionVar -query renderViewShowCameraName`) { string $cameraRig = getCurrentCameraRig(); if (size($cameraRig)) { $fmt = (uiRes("m_renderWindowCaption.kCameraRigCaption")); $msg = `format -s $cameraRig $fmt`; } else { $fmt = (uiRes("m_renderWindowCaption.kCameraCaption")); $msg = `format -s (getCurrentCamera()) $fmt`; } $result = $result + $msg; } // Add the layer name if (`optionVar -query renderViewShowLayerName`) { $fmt = (uiRes("m_renderWindowCaption.kLayers")); $renderLayers = `listConnections renderLayerManager.renderLayerId`; int $numLayers = size($renderLayers); if ($numLayers>1) { $layer = `editRenderLayerGlobals -q -currentRenderLayer`; $layer = `renderLayerDisplayName $layer`; $msg = `format -s $layer $fmt`; $result = $result + $msg; } } // Add the render target name if (`optionVar -query renderViewShowRenderTargetName`) { string $renderTarget = getRenderViewRenderTarget(); if ($renderTarget == "") { $renderTarget = (uiRes("m_renderWindowCaption.kRenderTargetNone")); } $fmt = (uiRes("m_renderWindowCaption.kRenderTarget")); $msg = `format -s $renderTarget $fmt`; $result = $result + $msg; } // No custom comment at rendering time. // Leave a new empty line in render view permanent caption so // that we can add custom comment to it later. // $result = $result + "\n"; return $result; }