Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2013-01-15 08:14:18 +0400
committerCampbell Barton <ideasman42@gmail.com>2013-01-15 08:14:18 +0400
commit41021075c7cd1893ea431ebb88892fe5c69c5ec7 (patch)
treeb378fddce7603275f792563f33049715b376939c /object_animrenderbake.py
parent81ab88ef9a710d18d7abeba9c0aee93acbf47480 (diff)
don't overwrite the bake panel, instead prepend.
Diffstat (limited to 'object_animrenderbake.py')
-rw-r--r--object_animrenderbake.py73
1 files changed, 16 insertions, 57 deletions
diff --git a/object_animrenderbake.py b/object_animrenderbake.py
index e8dc0c1c..cefd1cb6 100644
--- a/object_animrenderbake.py
+++ b/object_animrenderbake.py
@@ -93,12 +93,12 @@ class OBJECT_OT_animrenderbake(bpy.types.Operator):
return {'CANCELLED'}
# make sure we have an absolute path so that copying works for sure
- absp = bpy.path.abspath(img.filepath, library=img.library)
+ img_filepath_abs = bpy.path.abspath(img.filepath, library=img.library)
- print("Animated baking for frames " + str(start) + " - " + str(end))
+ print("Animated baking for frames (%d - %d)" % (start, end))
for cfra in range(start, end+1):
- print("Baking frame " + str(cfra))
+ print("Baking frame %d" % cfra)
# update scene to new frame and bake to template image
scene.frame_set(cfra)
@@ -108,66 +108,26 @@ class OBJECT_OT_animrenderbake(bpy.types.Operator):
#currently the api doesn't allow img.save_as(), so just save the template image as usual for every frame and copy to a file with frame specific filename
img.save()
- shutil.copyfile(absp, self.framefile(absp, cfra))
+ img_filepath_new = self.framefile(img_filepath_abs, cfra)
+ shutil.copyfile(img_filepath_abs, img_filepath_new)
+ print("Saved %r" % img_filepath_new)
- print("Saved " + self.framefile(absp, cfra))
print("Baking done!")
return{'FINISHED'}
# modified copy of original bake panel draw function
-def draw_animrenderbake(self, context):
+def draw(self, context):
layout = self.layout
- rd = context.scene.render
+ scene = context.scene
row = layout.row()
- row.operator("object.bake_image", icon='RENDER_STILL')
-
- #----------- beginning of modifications ----------------
row.operator("object.anim_bake_image", text="Animated Bake", icon="RENDER_ANIMATION")
- row = layout.row(align=True)
- row.prop(context.scene, "animrenderbake_start")
- row.prop(context.scene, "animrenderbake_end")
- #-------------- end of modifications ---------------------
-
- layout.prop(rd, "bake_type")
-
- multires_bake = False
- if rd.bake_type in ['NORMALS', 'DISPLACEMENT']:
- layout.prop(rd, 'use_bake_multires')
- multires_bake = rd.use_bake_multires
-
- if not multires_bake:
- if rd.bake_type == 'NORMALS':
- layout.prop(rd, "bake_normal_space")
- elif rd.bake_type in {'DISPLACEMENT', 'AO'}:
- layout.prop(rd, "use_bake_normalize")
-
- # col.prop(rd, "bake_aa_mode")
- # col.prop(rd, "use_bake_antialiasing")
-
- layout.separator()
+ rowsub = row.row(align=True)
+ rowsub.prop(scene, "animrenderbake_start")
+ rowsub.prop(scene, "animrenderbake_end")
- split = layout.split()
-
- col = split.column()
- col.prop(rd, "use_bake_clear")
- col.prop(rd, "bake_margin")
- col.prop(rd, "bake_quad_split", text="Split")
-
- col = split.column()
- col.prop(rd, "use_bake_selected_to_active")
- sub = col.column()
- sub.active = rd.use_bake_selected_to_active
- sub.prop(rd, "bake_distance")
- sub.prop(rd, "bake_bias")
- else:
- if rd.bake_type == 'DISPLACEMENT':
- layout.prop(rd, "use_bake_lores_mesh")
-
- layout.prop(rd, "use_bake_clear")
- layout.prop(rd, "bake_margin")
def register():
bpy.utils.register_module(__name__)
@@ -182,19 +142,18 @@ def register():
description="End frame of the animated bake",
default=250)
- # replace original panel draw function with modified one
- panel = bpy.types.RENDER_PT_bake
- panel.old_draw = panel.draw
- panel.draw = draw_animrenderbake
+ bpy.types.RENDER_PT_bake.prepend(draw)
+
def unregister():
bpy.utils.unregister_module(__name__)
# restore original panel draw function
- bpy.types.RENDER_PT_bake.draw = bpy.types.RENDER_PT_bake.old_draw
- del bpy.types.RENDER_PT_bake.old_draw
del bpy.types.Scene.animrenderbake_start
del bpy.types.Scene.animrenderbake_end
+ bpy.types.RENDER_PT_bake.remove(draw)
+
+
if __name__ == "__main__":
register()