VRED 2024, cancel sequenz rendering, python plugin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
i have a plugin where the user can arange several variantset and viewports to render everything at once.
I am using vrAEBase class and put the vrMovieExport.createSnapshot in a for loop. (f.e. for each viewpoint)
When the rendering starts, for sure the user can cancel the actual image rendered, via the render dialog which is displayed. (with the progress bar) But i want to be able to break/stop the whole for loop.
I tried to cancel the loop with a Key pressed event, but it is not working, no way to interrupt.
I have this class:
class prova(vrAEBase.vrAEBase):
def __init__(self):
super(prova, self).__init__()
self.addLoop()
self.keyQ = vrKey.vrKey(vrController.Key_W)
self.keyQ.connect(lambda: self.test())
self.counter = 0
def loop(self):
for i in range(1000000):
self.j = i
if self.j == 400:
print(self.j)
vrMovieExport.createSnapshot("C:/Users/AXIGHXP/Projects/test/render_sky/test" + str(self.counter) + ".png",500,500,1,0)
self.counter += 1
def test(self):
print("EXIT")
self.subLoop()
If i comment line 22, so not rendering, i can break the loop.
I guess because when starting the rendering, and the render dialog (with the progress bar) is display, the focus is lost for the key event, and there is no time in between the renderings to get the focus back.
When the user hit the cancel button on the render dialog, a message in the console is displayed.
"Rendering canceled".
Maybe i can grab this message/signal in my code to stop the loop? Would be ok, if the user just cancel one rendering, that all the progress is stoped then.
Best regards
Andreas