Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bugfixing #83

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions .github/workflows/windows_mac_build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -82,19 +82,23 @@ jobs:
if: matrix.os == 'windows-latest'
run: |
.\venv\Scripts\activate
(echo yes) | pyside6-deploy -c .\build\pysidedeploy_win.spec
pip install cx_Freeze
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
pip install cx-Freeze
python build/setup.py build
ls build

- uses: actions/upload-artifact@v4
if: matrix.os == 'windows-latest'
with:
name: renderrob_win
path: |
build/
icons/
ui/
utils_bpy/
Expand All @@ -107,6 +111,7 @@ jobs:
with:
name: renderrob_mac
path: |
build/
icons/
ui/
utils_bpy/
Expand Down
4 changes: 4 additions & 0 deletions custom_commands.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
"""Insert your commands here."""
import bpy # pylint:disable=import-error, unused-import
from utils_common import print_utils

# Insert your code below.


print_utils.print_info("Custom commands executed.")
108 changes: 50 additions & 58 deletions renderrob.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ protobuf
PySide6-Essentials
PySide6-Addons
bpy
nuitka
nuitka
2 changes: 1 addition & 1 deletion utils_bpy/render_settings_setter.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
5 changes: 4 additions & 1 deletion utils_rr/table_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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 (
Expand Down
11 changes: 5 additions & 6 deletions utils_rr/ui_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down