Hi, I am trying to migrate my rhino plugin from 3.x to vray 5. I have been using VRayForRhinoNETInterface > HasRenderFinished() to check for render ended then do some post action.
Just wondering what is the equivalent of that in version 5 since VRayForRhinoNETInterface is not included anymore?
Thanks.
Hello, @sto_sto ,
Please check V-Ray for Rhino
Calling vray.Render() with a timeout value of -1 makes the call synchronous when executed.
Kind regards,
Peter
Great thanks Peter. Exactly what I needed.
I see your McNeel forum thread is no longer available, so allow me to reply here to your question how to close the VFB programatically in case anyone else find this useful.
This can be achieved in C++, using:
HWND hwnd = FindWindow("V-Ray Frame Buffer")
SendMessage(hwnd, WM_CLOSE, 0, 0)
Scripting a solution in Python should look like this:
import ctypes
from ctypes import wintypes
WNDENUMPROC = ctypes.WINFUNCTYPE(wintypes.BOOL,
wintypes.HWND,
wintypes.LPARAM)
cpid = ctypes.windll.kernel32.GetCurrentProcessId()
lppid = ctypes.c_ulong()
def worker(hwnd, lParam):
length = ctypes.windll.user32.GetWindowTextLengthW(hwnd) + 1
buffer = ctypes.create_unicode_buffer(length)
ctypes.windll.user32.GetWindowTextW(hwnd, buffer, length)
title = repr(buffer.value)
if title.startswith("'V-Ray Frame Buffer'"):
ctypes.windll.user32.GetWindowThreadProcessId(hwnd , ctypes.byref(lppid))
if lppid.value == cpid:
ctypes.windll.user32.SendMessageA(hwnd, 0x0010, 0, 0)
return False
return True
cb_worker = WNDENUMPROC(worker)
ctypes.windll.user32.EnumWindows(cb_worker, 0)
Kind regards,
Peter