Hey Paul,
many thx for getting back to me about this and for the pointers.
The processEvent() is not enough in this case - the frame won't be advanced...
But with a little digging into Qt/PySide I managed to get something working (see attached).
Currently the scene list is simply hard coded into the script - enough for my use.
Now I'm off to the next issue: Motion Blur
viewtopic.php?f=34&t=82819Cheers!
J.
- Code: Select all
#!/usr/bin/env python
###
# Octane Batch Rendering Script
# IMPORTANT:
# Make sure the "revert" and the "Octane Render Finished - reset the timeline..." dialogs are disabled!!!
# (answer the dialog once with do-not-ask-again...)
###
import modo
import lx
import time
import PySide2
import os
from PySide2.QtGui import *
from PySide2.QtCore import *
from PySide2.QtWidgets import *
from PySide2.QtWidgets import QFileDialog
scenes = [
"E:\\ProjectX\FirstScene.lxo",
"E:\\ProjectX\SecondScene.lxo",
]
def loadAndStartAnimation(sceneFilePath):
global msgBox
lx.eval(f"scene.open \"{sceneFilePath}\" normal")
msgBox.setText(f"Rendering: {os.path.basename(sceneFilePath)}")
lx.eval("octane.command animate")
def cancelBatch():
global continueBatch
continueBatch = False
print("Canceling batch\n")
lx.eval("octane.command cancelAnimation")
def checkAndAdvance():
global msgBox, scenes, continueBatch
print("Checking\n")
rendering = lx.eval("layout.createOrClose cookie:octaneAnimationLayoutCookie layout:octaneAnimationLayout ?")
if rendering == 0:
print("Advancing to next scene\n")
# We do not want to remove the "unsaved" warning from the "close" dialog
# So we remove the warning from the "revert" dialog and use that before doing the close
lx.eval("scene.revert")
lx.eval("scene.close")
if scenes and continueBatch:
nextScene = scenes.pop(0)
loadAndStartAnimation(nextScene)
checkAndAdvance()
else:
print("Done.\n")
msgBox.hide()
else:
QTimer.singleShot(1000, checkAndAdvance)
msgBox = QMessageBox()
msgBox.setIcon(QMessageBox.Information)
msgBox.setText("...")
msgBox.setWindowTitle("Octane Batch Rendering")
msgBox.setStandardButtons(QMessageBox.Cancel)
msgBox.buttonClicked.connect(cancelBatch)
msgBox.show()
continueBatch = True
currentScene = scenes.pop(0)
loadAndStartAnimation(currentScene)
QTimer.singleShot(1000, checkAndAdvance)