Skip to content

Commit

Permalink
Merge pull request OpenShot#3421 from OpenShot/blender-redux
Browse files Browse the repository at this point in the history
Blender: Use self.process consistently, fix project file discovery for Picture Frame
  • Loading branch information
ferdnyc authored May 5, 2020
2 parents 7465dcb + de0ee93 commit 13ec798
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 13 deletions.
8 changes: 4 additions & 4 deletions src/blender/picture_frames_4.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,28 +11,28 @@
<default>TitleFileName</default>
</param>

<param name="project_files1" type="dropdown" title="Picture 1 Path" description="">
<param name="project_files1" type="dropdown" title="Picture 1" description="">
<values>
<value name="" num=""/>
</values>
<default></default>
</param>

<param name="project_files2" type="dropdown" title="Picture 2 Path" description="">
<param name="project_files2" type="dropdown" title="Picture 2" description="">
<values>
<value name="" num=""/>
</values>
<default></default>
</param>

<param name="project_files3" type="dropdown" title="Picture 3 Path" description="">
<param name="project_files3" type="dropdown" title="Picture 3" description="">
<values>
<value name="" num=""/>
</values>
<default></default>
</param>

<param name="project_files4" type="dropdown" title="Picture 4 Path" description="">
<param name="project_files4" type="dropdown" title="Picture 4" description="">
<values>
<value name="" num=""/>
</values>
Expand Down
20 changes: 11 additions & 9 deletions src/windows/views/blender_listview.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,12 @@ def currentChanged(self, selected, deselected):
continue

param["values"][fileName] = "|".join(
file.data["path"], str(file.data["height"]),
str(file.data["width"]), file.data["media_type"],
str(file.data["fps"]["num"] / file.data["fps"]["den"])
(file.data["path"],
str(file.data["height"]),
str(file.data["width"]),
file.data["media_type"],
str(file.data["fps"]["num"] / file.data["fps"]["den"])
)
)

# Add normal values
Expand Down Expand Up @@ -705,7 +708,7 @@ def Render(self, blend_file_path, target_script, preview_mode=False):
log.info("Checking Blender version, command: {}".format(
" ".join([shlex.quote(x) for x in command_get_version])))

proc = subprocess.Popen(
self.process = subprocess.Popen(
command_get_version,
stdout=subprocess.PIPE, stderr=subprocess.STDOUT,
startupinfo=startupinfo,
Expand All @@ -714,7 +717,7 @@ def Render(self, blend_file_path, target_script, preview_mode=False):
# Check the version of Blender
try:
# Give Blender up to 10 seconds to respond
(out, err) = proc.communicate(timeout=10)
(out, err) = self.process.communicate(timeout=10)
except subprocess.TimeoutExpired:
self.blender_error_nodata.emit()
return
Expand All @@ -739,12 +742,11 @@ def Render(self, blend_file_path, target_script, preview_mode=False):
log.info("Blender output:")

# Run real command to render Blender project
proc = subprocess.Popen(
self.process = subprocess.Popen(
command_render, bufsize=512,
stdout=subprocess.PIPE, stderr=subprocess.STDOUT,
startupinfo=startupinfo,
)
self.process = proc
self.is_running = True

except subprocess.SubprocessError:
Expand All @@ -757,8 +759,8 @@ def Render(self, blend_file_path, target_script, preview_mode=False):
log.error("{}".format(ex))
return

while self.is_running and proc.poll() is None:
for outline in iter(proc.stdout.readline, b''):
while self.is_running and self.process.poll() is None:
for outline in iter(self.process.stdout.readline, b''):
line = outline.decode('utf-8').strip()

# Skip blank output
Expand Down

0 comments on commit 13ec798

Please sign in to comment.