[Closed] Is there any way to get progressbar text while rendering?
Hi guys,
I’m trying to fetch the V-ray render process percentage number while rendering, I opened it via the script as follow :
render camera:$Camera001 vfb:off outputwidth:width outputheight:height outputFile:fileName progressbar:true cancelled:&cancelled
and the percentage just showed at the bottom of screen, but How could I read it??
Many thanks
you could start a timer before the render start and then simply find pb control among statuspanel child controls to parse the data
(
local g = (dotNetClass "Autodesk.Max.GlobalInterface").Instance
local candidates = for c in windows.getChildrenHWND g.CoreInterface7.StatusPanelHWnd where matchPattern c[5] pattern:"*%" collect c[1]
-- find exact control and parse the data out
)
not sure if it will work for modern qt gui, don’t have vray installed to check
Thank you, SEREJAH, I tried your script but the result did’t cantain that process bar. I print all these c[5] text as follows:
[]
[]
[]
[Add Time Tag]
[]
[]
[]
[]
[[-381.575,-47.5095,118]]
[$Object001.name = “243_WallHoleFrame_section_2”]
[StatusPanelSepWindow]
[StatusPanelTopToolbar]
[]
[1 Object Selected]
[]
[]
[]
[]
[]
[]
[]
[X:]
[]
[]
[-243.593cm]
[]
[]
[Y:]
[]
[]
[541.378cm]
[]
[]
[Z:]
[]
[]
[0.0cm]
[]
[]
[Grid = 10.0cm]
[StatusPanelBottomContainer]
[]
I guess maybe the StatusPanelBottomContainer object has some property that contains the number I want?
By the way, I googled these property names and it’s really hard to find docs that helped, is there any official docs I can refer to?
Here’s a quick dirty test code, see if it works
is_rendering = true
bw = dotNetObject "CSharpUtilities.SynchronizingBackgroundWorker"
fn printpb =
(
-- ideally you need to find this progress bar handle just once on render start and use it until the end
local candidates = for w in windows.getChildrenHWND #max where w[4] == "msctls_progress32" collect w[1]
if candidates.count > 0 do
(
local WM_USER = 1024
local PBM_GETPOS = WM_USER + 8
format ">> %\n" (windows.sendmessage candidates[1] PBM_GETPOS 0 0)
)
)
fn dowork =
(
format "Background worker started\n"
local delay = 0.5 -- half sec
while is_rendering do
(
printpb()
sleep delay
)
format "Background worker completed\n"
)
dotnet.addEventHandler bw "DoWork" dowork
::bw.runWorkerAsync()
render camera:$Camera001 vfb:off width:500 height:500 progressbar:true cancelled:&cancelled
is_rendering = false
upd
actually there’s a way to know whether the render is active
(dotNetClass "Autodesk.Max.GlobalInterface").Instance.CoreInterface7.IsRenderActive
Thanks, your script worked perfectly!!!
I learned that the your script invokes system call to gain direct access to msctls_progress32 (or process bar).
since it takes several steps to finish rendering(start GPU/compile/Build cache/Rendering etc), I want tag these numbers with certain stages, like:
start GPU 40%
compile 10%
Build cache 90%
Rendering 10%
But process bar itself doesn’t have properties like “message” or “text”(the properties start with PBM_ is all about the bar position or its bar color), how could I get the text on the left?
These labels must be separate controls just like any other mxs label, but I couldn’t find any neighboring labels when the progress bar appears. Moreover not a single control in max receives WM_SETTEXT message in the process of rendering so I assume there’re no labels and this text is printed directly onto the pb parent control.
Try asking here: https://forums.autodesk.com/t5/3ds-max-programming/bd-p/area-b35