How do I get the progress information of the rendering?

I now have a separate thread that needs to read the progress information of the rendering in real time, and how can I predict it?

AttachmentSize
rendering.png26.08 KB

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
LilyWitt's picture

You explore some little

You explore some little rumors to get more knowledge of progress then after you will get the vast number of information. People who made you want to bestessays and suggestions to do this that type of projecting.

Encoding's picture

I need to read the current

I need to read the current rendering progress during rendering and save it as a txt document. Is there any way to read the rendering progress information?

jahman's picture

.

I bet there's a better way of doing it. But here's the example how you can achieve it using BackgroundWorker and DialogMonitorOps

gc light:true
try (
	::renderProgressTimer.Stop() 
	dotNet.removeAllEventHandlers ::renderProgressTimer
)catch()
 
global renderingDialogHWND = undefined
global renderProgressTimer = dotnetobject "System.Windows.Forms.Timer"
renderProgressTimer.interval = 2000 -- two seconds
 
fn onTick sender arg = 
(	
	if isKindOf ::renderingDialogHWND IntegerPtr do 
	(
		local data = windows.getHWNDData ::renderingDialogHWND
 
		if data == undefined then
		(
			format "Timer is stopping..\n" 
			sender.Stop()
 
			DialogMonitorOPS.enabled = false
			DialogMonitorOPS.UnRegisterNotification id:#renderProgress
		)
	)
 
)
dotnet.addEventHandler renderProgressTimer "Tick" onTick 
 
 
bw = dotNetObject "CSharpUtilities.SynchronizingBackgroundWorker"
fn dowork =
(
	format "Background worker started\n" 
	local t = timeStamp()
 
	while ::renderProgressTimer.enabled do
	(
		if timeStamp() - t >= ::renderProgressTimer.interval do
		(
			t = timeStamp()
 
			local data = windows.getHWNDData ::renderingDialogHWND
 
			if data != undefined do
			(				
				for c in windows.getChildrenHWND ::renderingDialogHWND where c[4] == "Static" do 
				(
					if MatchPattern c[5] pattern:"Rendering*pass*" do format "!>> %\n" c[5]			
 
				)
			)
		)
	)
 
	format "Background worker completed\n" 
 
)
dotnet.addEventHandler bw "DoWork" dowork
 
 
fn onWindow =
(
	local hwnd = DialogMonitorOPS.GetWindowHandle()
 
	if hwnd != undefined do
	(
		local data = windows.getHWNDData hwnd
 
		if data[4] == "#32770" and data[5] == "Rendering" do
		(
			format "Rendering...\n" 
			if isKindOf ::renderProgressTimer dotNetObject do 
			(
				format "Starting timer\n" 
				::renderingDialogHWND = data[1]
				::renderProgressTimer.start()
 
				::bw.runWorkerAsync()
 
			)
 
		)
 
	)
 
	true
)
 
DialogMonitorOPS.UnRegisterNotification id:#renderProgress
DialogMonitorOPS.RegisterNotification onWindow id:#renderProgress
DialogMonitorOPS.enabled = true
 
clearListener()
Encoding's picture

Thank you very much for your

Thank you very much for your help, this method has solved my problem. When I have other better methods, I will send it here to study together.

TsveTan's picture

^

What is the rendering engine and how did you create this thread?

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.