Skip to content

Commit

Permalink
Merge pull request #398 from howetuft/hotfix
Browse files Browse the repository at this point in the history
Project: check output path for validity
  • Loading branch information
howetuft committed May 7, 2024
2 parents e5d635c + e016976 commit 522063f
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions Render/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,19 @@ def render(self, wait_for_completion=False, skip_meshing=False):
App.Console.PrintError(msg)
return None

# Fetch the rendering parameters
params = self._get_rendering_params()

# Check output consistency
if not os.path.exists(os.path.dirname(params.output)):
msg = translate(
"Render",
"[Render][Project] WARNING - Output image path "
f"'{params.output}' does not seem to be a valid path on "
"your system. This may cause the renderer to fail...\n",
)
App.Console.PrintWarning(msg)

# Set export directories
project_directory = self.fpo.Document.TransientDir
object_directory = os.path.join(project_directory, self.fpo.Name)
Expand Down Expand Up @@ -463,9 +476,6 @@ def render(self, wait_for_completion=False, skip_meshing=False):
instantiated, project_directory
)

# Fetch the rendering parameters
params = self._get_rendering_params()

# Get the renderer command on the generated temp file, with rendering
# params
cmd, img = renderer.render(
Expand Down Expand Up @@ -604,7 +614,7 @@ def _get_rendering_params(self):

try:
output = self.fpo.OutputImage
assert output
assert output # TODO don't use assert here
except (AttributeError, AssertionError):
fname = f"{self.fpo.Name}_output.png"
output = os.path.join(self.fpo.Document.TransientDir, fname)
Expand Down

0 comments on commit 522063f

Please sign in to comment.