Commit 366400df by Christopher Gearhart

Bug fixes

parent a05bcfcf
......@@ -73,14 +73,12 @@ class openRenderedAnimationInUI(Operator):
self.renderDumpFolder = getRenderDumpFolder()
image_sequence_filepath = "{dumpFolder}/".format(dumpFolder=self.renderDumpFolder)
for frame in bpy.props.animFrameRange:
try:
image_filename = "{fileName}_{frame}{extension}".format(fileName=getNameOutputFiles(), frame=str(frame).zfill(4), extension=bpy.props.animExtension)
image_filename = "{fileName}_{frame}{extension}".format(fileName=getNameOutputFiles(), frame=str(frame).zfill(4), extension=bpy.props.animExtension)
if os.path.isfile(os.path.join(image_sequence_filepath, image_filename)):
bpy.ops.clip.open(directory=image_sequence_filepath, files=[{"name":image_filename}])
openedFile = image_filename
openedFrame = frame
break
except:
pass
if openedFile:
bpy.ops.clip.reload()
bpy.data.movieclips[openedFile].frame_start = frame
......
......@@ -182,11 +182,6 @@ class sendAnimation(Operator):
self.projectName = bpy.path.display_name_from_filepath(bpy.data.filepath).replace(" ", "_")
scn = context.scene
# for testing purposes only (saves unsaved file as 'unsaved_file.blend')
if self.projectName == "":
self.projectName = "unsaved_file"
bpy.ops.wm.save_mainfile(filepath="{tempLocalDir}{projectName}.blend".format(tempLocalDir=scn.tempLocalDir, projectName=self.projectName))
# ensure no other render processes are running
if getRenderStatus("image") in getRunningStatuses() or getRenderStatus("animation") in getRunningStatuses():
self.report({"WARNING"}, "Render in progress...")
......@@ -195,6 +190,11 @@ class sendAnimation(Operator):
self.report({"WARNING"}, "No servers available. Try refreshing.")
return{"CANCELLED"}
# for testing purposes only (saves unsaved file as 'unsaved_file.blend')
if self.projectName == "":
self.projectName = "unsaved_file"
bpy.ops.wm.save_mainfile(filepath="{tempLocalDir}{projectName}.blend".format(tempLocalDir=scn.tempLocalDir, projectName=self.projectName))
print("\nRunning sendAnimation function...")
# ensure the job won't break the script
......
......@@ -177,6 +177,8 @@ class sendFrame(Operator):
area.spaces.active.image = bpy.data.images[bpy.props.nameAveragedImage]
break
self.report({"INFO"}, "Render completed at {num} samples! View the rendered image in your UV/Image_Editor".format(num=str(self.numSamples)))
elif self.numSamples == 0:
self.report({"INFO"}, "No render preview available (0 samples)")
else:
if bpy.data.images.find(bpy.props.nameAveragedImage) >= 0:
# open preview image in UV/Image_Editor
......@@ -217,11 +219,6 @@ class sendFrame(Operator):
context.area.spaces.active.image = bpy.data.images["Render Result"]
return{"FINISHED"}
# for testing purposes only (saves unsaved file as 'unsaved_file.blend')
if self.projectName == "":
self.projectName = "unsaved_file"
bpy.ops.wm.save_mainfile(filepath="{tempLocalDir}{projectName}.blend".format(tempLocalDir=scn.tempLocalDir, projectName=self.projectName))
# ensure no other render processes are running
if getRenderStatus("image") in getRunningStatuses() or getRenderStatus("animation") in getRunningStatuses():
self.report({"WARNING"}, "Render in progress...")
......@@ -230,6 +227,11 @@ class sendFrame(Operator):
self.report({"WARNING"}, "No servers available. Try refreshing.")
return{"CANCELLED"}
# for testing purposes only (saves unsaved file as 'unsaved_file.blend')
if self.projectName == "":
self.projectName = "unsaved_file"
bpy.ops.wm.save_mainfile(filepath="{tempLocalDir}{projectName}.blend".format(tempLocalDir=scn.tempLocalDir, projectName=self.projectName))
# ensure the job won't break the script
if not jobIsValid("image", self):
return{"CANCELLED"}
......
......@@ -24,10 +24,37 @@ import bpy
import random
from bpy.app.handlers import persistent
randomSeed = random.randint(1, 10000)
scn = bpy.context.scene
""" BEGIN SUPPORT FOR THE LEGOIZER """
@persistent
def handle_legoizer_animation(scene):
groupsToAdjust = {}
for group in bpy.data.groups:
if group.name.startswith("LEGOizer_") and "_bricks_frame_" in group.name:
sourceName = group.name[9:(group.name.index("_bricks_frame_"))]
groupsToAdjust[sourceName].append(group)
for sourceName in groupsToAdjust:
groupsToAdjust[sourceName].sort()
for i,group in enumerate(groupsToAdjust[sourceName]):
frame = int(group.name[(group.name.index("_bricks_frame_") + 14):])
onCurF = frame == scn.frame_current
beforeFirstF = (i == 0 and scn.frame_current < frame)
afterLastF = (i == (len(groupsToAdjust[sourceName]) - 1) and scn.frame_current > frame)
displayOnCurrentF = onCurF or beforeFirstF or afterLastF
brick = group.objects[0]
if brick.hide == displayOnCurF:
brick.hide = not displayOnCurF
brick.hide_render = not displayOnCurF
bpy.app.handlers.render_pre.append(handle_legoizer_animation)
bpy.app.handlers.frame_change_pre.append(handle_legoizer_animation)
handle_legoizer_animation(scn)
""" END SUPPORT FOR THE LEGOIZER """
randomSeed = random.randint(1, 10000)
for scene in bpy.data.scenes:
scene.cycles.seed = randomSeed
scene.cycles.transparent_min_bounces = 0
......@@ -36,22 +63,3 @@ for scene in bpy.data.scenes:
scene.render.use_overwrite = True
if scene.cycles.film_transparent:
scene.render.image_settings.color_mode = 'RGBA'
""" SUPPORT FOR THE LEGOIZER BELOW """
@persistent
def handle_legoizer_animation(scene):
scn = scene
groupsToAdjust = []
for group in bpy.data.groups:
if group.name.startswith("LEGOizer_") and "_bricks_frame_" in group.name:
groupsToAdjust.append(group)
for group in groupsToAdjust:
frame = int(group.name[(group.name.index("_bricks_frame_") + 14):])
onCurF = frame == scn.frame_current
brick = group.objects[0]
if brick.hide == onCurF:
brick.hide = not onCurF
brick.hide_render = not onCurF
bpy.app.handlers.render_pre.append(handle_legoizer_animation)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment