From bc0c2c7df07d1eaae9b52ddcdf150b1f94cd960f Mon Sep 17 00:00:00 2001 From: Peter Baintner Date: Thu, 25 Jul 2024 08:11:54 +0200 Subject: [PATCH 1/9] bugfixing --- custom_commands.py | 4 ++ renderrob.py | 108 +++++++++++++++++++--------------------- utils_rr/table_utils.py | 5 +- utils_rr/ui_utils.py | 11 ++-- 4 files changed, 63 insertions(+), 65 deletions(-) diff --git a/custom_commands.py b/custom_commands.py index 7da2461..08e439f 100644 --- a/custom_commands.py +++ b/custom_commands.py @@ -1,4 +1,8 @@ """Insert your commands here.""" +import bpy from utils_common import print_utils +# Insert your code below. + + print_utils.print_info("Custom commands executed.") diff --git a/renderrob.py b/renderrob.py index 780f3cf..8d03999 100644 --- a/renderrob.py +++ b/renderrob.py @@ -287,65 +287,58 @@ def _handle_output(self): data = self.process.readAll() output = data.data().decode() color_format = QTextCharFormat() - if '\u001b' in output: - for line in output.splitlines(): - back_color = print_utils.BASH_COLORS - info = back_color["BACK_CYAN"] + " " + back_color["FORE_BLACK"] - warning = back_color["BACK_YELLOW"] + " " + back_color["FORE_BLACK"] - error = back_color["BACK_RED"] + " " + back_color["FORE_WHITE"] - reset = back_color["RESET_ALL"] - if line.startswith(reset): - line = line.replace(reset, '') - color_format.setBackground(QColor(table_utils.COLORS["grey_light"])) - color_format.setForeground(QColor(table_utils.COLORS["grey_light"])) - if line.startswith(info): - line = line.replace(info, '') - color_format.setBackground( - QColor(table_utils.COLORS["blue_grey_lighter"])) - color_format.setForeground(QColor(Qt.black)) - if line.startswith(warning): - line = line.replace(warning, '') - color_format.setBackground(QColor(table_utils.COLORS["yellow"])) - color_format.setForeground(QColor(Qt.black)) - - self.state_saver.table_to_state(self.table) - row_number = state_saver.find_job( - self.state_saver.state.render_jobs, self.active_render_job) - - table_utils.color_row_background(self.table, - row_number, - QColor(table_utils.COLORS["yellow"])) - if line.startswith(error) or "blender.crash.txt" in line: - line = line.replace(error, '') - color_format.setBackground(QColor(table_utils.COLORS["red"])) - color_format.setForeground(QColor(table_utils.COLORS["grey_light"])) - - self.state_saver.table_to_state(self.table) - row_number = state_saver.find_job( - self.state_saver.state.render_jobs, self.active_render_job) - - table_utils.color_row_background(self.table, - row_number, - QColor(table_utils.COLORS["red"])) - - # Only scroll down if user is at bottom. - if self.window.textBrowser.verticalScrollBar().value() > ( - self.window.textBrowser.verticalScrollBar().maximum()) - 1500: - self.window.textBrowser.moveCursor(QTextCursor.End + 1) - self.window.textBrowser.setCurrentCharFormat(color_format) - self.window.textBrowser.insertPlainText(line.replace(reset, "") + "\n") - - if line.endswith(reset): - line = line.replace(reset, '') - color_format.setBackground(QColor(52, 80, 100)) - color_format.setForeground(QColor(table_utils.COLORS["grey_light"])) - else: + back_color = print_utils.BASH_COLORS + info = back_color["BACK_CYAN"] + " " + back_color["FORE_BLACK"] + warning = back_color["BACK_YELLOW"] + " " + back_color["FORE_BLACK"] + error = back_color["BACK_RED"] + " " + back_color["FORE_WHITE"] + reset = back_color["RESET_ALL"] + for line in output.splitlines(): + + if line.startswith(reset): + line = line.replace(reset, '') + color_format.setBackground(QColor(table_utils.COLORS["grey_light"])) + color_format.setForeground(QColor(table_utils.COLORS["grey_light"])) + if line.startswith(info): + line = line.replace(info, '') + color_format.setBackground( + QColor(table_utils.COLORS["blue_grey_lighter"])) + color_format.setForeground(QColor(Qt.black)) + if line.startswith(warning): + line = line.replace(warning, '') + color_format.setBackground(QColor(table_utils.COLORS["yellow"])) + color_format.setForeground(QColor(Qt.black)) + + self.state_saver.table_to_state(self.table) + row_number = state_saver.find_job( + self.state_saver.state.render_jobs, self.active_render_job) + + table_utils.color_row_background(self.table, + row_number, + QColor(table_utils.COLORS["yellow"])) + if line.startswith(error) or "blender.crash.txt" in line or line.startswith("Error:"): + line = line.replace(error, '') + color_format.setBackground(QColor(table_utils.COLORS["red"])) + color_format.setForeground(QColor(table_utils.COLORS["grey_light"])) + + self.state_saver.table_to_state(self.table) + row_number = state_saver.find_job( + self.state_saver.state.render_jobs, self.active_render_job) + + table_utils.color_row_background(self.table, + row_number, + QColor(table_utils.COLORS["red"])) + # Only scroll down if user is at bottom. if self.window.textBrowser.verticalScrollBar().value() > ( - self.window.textBrowser.verticalScrollBar().maximum()) - 1500: + self.window.textBrowser.verticalScrollBar().maximum()) - 1000: self.window.textBrowser.moveCursor(QTextCursor.End) self.window.textBrowser.setCurrentCharFormat(color_format) - self.window.textBrowser.insertPlainText(output) + self.window.textBrowser.insertPlainText(line.replace(reset, "") + "\n") + + if line.endswith(reset): + line = line.replace(reset, '') + color_format.setBackground(QColor(52, 80, 100)) + color_format.setForeground(QColor(table_utils.COLORS["grey_light"])) # Find a more elegant way to do this. if "Blender quit" in output: @@ -689,15 +682,14 @@ def render_job(self, job: state_pb2.render_job) -> None: # pylint: disable=no-m # Check if the file was converted to a relative path. file_path = path_utils.get_abs_blend_path( job.file, self.state_saver.state.settings.blender_files_path) - scene_command = f"-S {job.scene}" if job.scene else "" + scene_command = ["-S", job.scene] if job.scene else [] args = ["-b", file_path, - scene_command, + *scene_command, "-o", snb.frame_path, "-y", "-F", ui_utils.FILE_FORMATS_COMMAND[job.file_format], "--python-expr", inline_python, ] - args = [i for i in args if i] args.extend(render_frame_command.split(" ")) self.process.setArguments(args) # self.process.readyReadStandardOutput.connect(self._handle_output) diff --git a/utils_rr/table_utils.py b/utils_rr/table_utils.py index 20b8981..7fc88f7 100644 --- a/utils_rr/table_utils.py +++ b/utils_rr/table_utils.py @@ -31,7 +31,7 @@ "blue_grey": 0x4f7997, "blue_grey_darker": 0x345064, "grey_light": 0x323639, - "grey_inactive": 0x2d2d2d, + "grey_inactive": 0x2b2b2b, "grey_neutral": 0x222222, "black_light": 0x22282b, "black_dark": 0x242a2d, @@ -295,6 +295,9 @@ def color_row_background(table_widget: QTableWidget, row_index: int, base_color: if column_index in ui_utils.CHECKBOX_COLUMNS: ui_utils.set_checkbox_background_color( table_widget, row_index, column_index, color) + # if column_index in ui_utils.COMBOBOX_COLUMNS: + # ui_utils.set_combobox_background_color( + # table_widget, row_index, column_index, color) # Check if the value in the numbers columns is valid. if item and item.text() and ( diff --git a/utils_rr/ui_utils.py b/utils_rr/ui_utils.py index d81a531..7b1e962 100644 --- a/utils_rr/ui_utils.py +++ b/utils_rr/ui_utils.py @@ -94,13 +94,12 @@ def set_checkbox_values(table: QTableWidget, row: int, values: list[bool]) -> No checkbox_item.blockSignals(False) -def set_combobox_background_color(table: QTableWidget, row: int, color: QColor) -> None: +def set_combobox_background_color(table: QTableWidget, row: int, col: int, color: QColor) -> None: """Set color of comboboxes.""" - for i in COMBOBOX_COLUMNS: - widget = table.cellWidget(row, i) - if widget: - widget.setStyleSheet( - f"QComboBox:drop-down {{background-color: {color.name()};}}") + widget = table.cellWidget(row, col) + if widget: + widget.setStyleSheet( + f"QComboBox:drop-down {{background-color: {color.name()};}}") def set_checkbox_background_color(table: QTableWidget, row: int, col: int, color: QColor) -> None: From dc0100629b960e38da9127b24557302e6a92f3d0 Mon Sep 17 00:00:00 2001 From: Peter Baintner Date: Thu, 25 Jul 2024 08:16:49 +0200 Subject: [PATCH 2/9] .. --- custom_commands.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/custom_commands.py b/custom_commands.py index 08e439f..f025e70 100644 --- a/custom_commands.py +++ b/custom_commands.py @@ -1,5 +1,5 @@ """Insert your commands here.""" -import bpy +import bpy # pylint:disable=import-error, unused-import from utils_common import print_utils # Insert your code below. From 355f358afa46e8147f433fd8d74599903559f7e7 Mon Sep 17 00:00:00 2001 From: Peter Baintner Date: Thu, 1 Aug 2024 16:57:27 +0200 Subject: [PATCH 3/9] Python, really? --- utils_bpy/render_settings_setter.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils_bpy/render_settings_setter.py b/utils_bpy/render_settings_setter.py index 4b06e63..7127591 100644 --- a/utils_bpy/render_settings_setter.py +++ b/utils_bpy/render_settings_setter.py @@ -29,7 +29,7 @@ def __init__(self, scene: str = None, view_layers: List[str] = None) -> None: def set_scene(self, scene_name: str) -> None: """Set the scene to be rendered.""" - if scene_name: + if scene_name or scene_name != "": if scene_name not in bpy.data.scenes.keys(): print_utils.print_warning(f"Scene {scene_name} not found!") else: From b8a2409ef32f6cf053a88951691b81ca20907ead Mon Sep 17 00:00:00 2001 From: Peter Baintner Date: Mon, 28 Oct 2024 22:26:15 +0100 Subject: [PATCH 4/9] Try for mac --- .github/workflows/windows_mac_build.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/windows_mac_build.yaml b/.github/workflows/windows_mac_build.yaml index 935ae62..0dffbe3 100644 --- a/.github/workflows/windows_mac_build.yaml +++ b/.github/workflows/windows_mac_build.yaml @@ -82,13 +82,13 @@ jobs: if: matrix.os == 'windows-latest' run: | .\venv\Scripts\activate - (echo yes) | pyside6-deploy -c .\build\pysidedeploy_win.spec + python build\setup.py build - name: Build Mac OS if: matrix.os == 'macos-latest' run: | pip install imageio - python ${{env.pythonLocation}}/lib/python3.10/site-packages/PySide6/scripts/deploy.py -c build/pysidedeploy_mac.spec --force --verbose --keep-deployment-files + python build\setup.py build - uses: actions/upload-artifact@v4 if: matrix.os == 'windows-latest' From ec97a3f8a8360751c93078f777a365f2936b3969 Mon Sep 17 00:00:00 2001 From: Peter Baintner Date: Mon, 28 Oct 2024 22:27:52 +0100 Subject: [PATCH 5/9] wrong delimiter --- .github/workflows/windows_mac_build.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/windows_mac_build.yaml b/.github/workflows/windows_mac_build.yaml index 0dffbe3..0a07b7a 100644 --- a/.github/workflows/windows_mac_build.yaml +++ b/.github/workflows/windows_mac_build.yaml @@ -88,7 +88,7 @@ jobs: if: matrix.os == 'macos-latest' run: | pip install imageio - python build\setup.py build + python build/setup.py build - uses: actions/upload-artifact@v4 if: matrix.os == 'windows-latest' From 7c2fba35bbdb465101447317e799d93a3fba2d4d Mon Sep 17 00:00:00 2001 From: Peter Baintner Date: Mon, 28 Oct 2024 22:29:57 +0100 Subject: [PATCH 6/9] pip deps --- requirements.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 05858bf..9aadf56 100644 --- a/requirements.txt +++ b/requirements.txt @@ -5,4 +5,5 @@ protobuf PySide6-Essentials PySide6-Addons bpy -nuitka \ No newline at end of file +nuitka +cx-Freeze From 3927b30ff10a1e2bb8c6d6c7a707fb44d47ab4ec Mon Sep 17 00:00:00 2001 From: Peter Baintner Date: Mon, 28 Oct 2024 22:37:30 +0100 Subject: [PATCH 7/9] .. --- .github/workflows/windows_mac_build.yaml | 3 +++ requirements.txt | 1 - 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/windows_mac_build.yaml b/.github/workflows/windows_mac_build.yaml index 0a07b7a..302d04b 100644 --- a/.github/workflows/windows_mac_build.yaml +++ b/.github/workflows/windows_mac_build.yaml @@ -82,13 +82,16 @@ jobs: if: matrix.os == 'windows-latest' run: | .\venv\Scripts\activate + pip install cx_Freeze python build\setup.py build - name: Build Mac OS if: matrix.os == 'macos-latest' run: | pip install imageio + pip install cx-Freeze python build/setup.py build + ls - uses: actions/upload-artifact@v4 if: matrix.os == 'windows-latest' diff --git a/requirements.txt b/requirements.txt index 9aadf56..d8737f1 100644 --- a/requirements.txt +++ b/requirements.txt @@ -6,4 +6,3 @@ PySide6-Essentials PySide6-Addons bpy nuitka -cx-Freeze From 35a2bbfd3c3777af4bddc668744186fa846c7636 Mon Sep 17 00:00:00 2001 From: Peter Baintner Date: Mon, 28 Oct 2024 22:39:39 +0100 Subject: [PATCH 8/9] .. --- .github/workflows/windows_mac_build.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/windows_mac_build.yaml b/.github/workflows/windows_mac_build.yaml index 302d04b..2e904e6 100644 --- a/.github/workflows/windows_mac_build.yaml +++ b/.github/workflows/windows_mac_build.yaml @@ -91,13 +91,14 @@ jobs: pip install imageio pip install cx-Freeze python build/setup.py build - ls + ls build - uses: actions/upload-artifact@v4 if: matrix.os == 'windows-latest' with: name: renderrob_win path: | + build/ icons/ ui/ utils_bpy/ From d0267f5150be5c67f4c1d66d508b22a273d1c28d Mon Sep 17 00:00:00 2001 From: Peter Baintner Date: Mon, 28 Oct 2024 22:42:55 +0100 Subject: [PATCH 9/9] save all build output --- .github/workflows/windows_mac_build.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/windows_mac_build.yaml b/.github/workflows/windows_mac_build.yaml index 2e904e6..9471b0d 100644 --- a/.github/workflows/windows_mac_build.yaml +++ b/.github/workflows/windows_mac_build.yaml @@ -111,6 +111,7 @@ jobs: with: name: renderrob_mac path: | + build/ icons/ ui/ utils_bpy/