Revision: 30775 http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=30775 Author: leifandersen Date: 2010-07-26 23:10:39 +0200 (Mon, 26 Jul 2010)
Log Message: ----------- 1. Fixed a few big bugs in the standard image diff that crept through (pertaining to building single image tests). 2. Started adding operators (and gui) to build the image tests from within blender...still no way to set the good copy of blender though. Modified Paths: -------------- branches/soc-2010-leifandersen/release/scripts/op/tests_render.py branches/soc-2010-leifandersen/release/scripts/ui/space_tests.py branches/soc-2010-leifandersen/tests/render/run.py Modified: branches/soc-2010-leifandersen/release/scripts/op/tests_render.py =================================================================== --- branches/soc-2010-leifandersen/release/scripts/op/tests_render.py 2010-07-26 20:42:50 UTC (rev 30774) +++ branches/soc-2010-leifandersen/release/scripts/op/tests_render.py 2010-07-26 21:10:39 UTC (rev 30775) @@ -92,10 +92,88 @@ wm.add_fileselect(self) return {'RUNNING_MODAL'} +class TESTS_OT_render_build(bpy.types.Operator): + '''''' + bl_idname = "TESTS_OT_render_build" + bl_label = "Animation Render Test" + + filename = StringProperty(name="File Name", description="File name used", maxlen= 1024, default= "") + filepath = StringProperty(name="File Path", description="Filepath used", maxlen= 1024, default= "") + directory = StringProperty(name="File Directory", description="File Directory used", maxlen= 1024, default= "") + + def poll(self, context): + return True + + def execute(self, context): + (directory, filename) = os.path.split(self.properties.filepath) + command = PYTHON_BIN + " " + IMAGEDIFF_PY + " --build-tests --image " + self.properties.filepath + " --blender-bin " + BLENDER_BIN + print(os.system(command)) + tests.render.status = "Run" + return {'FINISHED'} + + def invoke(self, context, event): + wm = context.manager + wm.add_fileselect(self) + return {'RUNNING_MODAL'} + +class TESTS_OT_render_all_build(bpy.types.Operator): + '''''' + bl_idname = "TESTS_OT_render_all_build" + bl_label = "Animation Render Test" + + filename = StringProperty(name="File Name", description="File name used", maxlen= 1024, default= "") + filepath = StringProperty(name="File Path", description="Filepath used", maxlen= 1024, default= "") + directory = StringProperty(name="File Directory", description="File Directory used", maxlen= 1024, default= "") + + def poll(self, context): + return True + + def execute(self, context): + test_passed = True + (directory, filename) = os.path.split(self.properties.filepath) + for file in os.listdir(directory): + if file.find('.blend') != -1: + bpy.ops.tests.render_build(filepath=self.properties.filepath) + if test_passed and tests.render.status == "Not Run": + tests_passed = False + return {'FINISHED'} + + def invoke(self, context,event): + wm = context.manager + wm.add_fileselect(self) + return {'RUNNING_MODAL'} + +class TESTS_OT_anim_build(bpy.types.Operator): + '''''' + bl_idname = "TESTS_OT_anim_build" + bl_label = "Animation Render Test" + + filename = StringProperty(name="File Name", description="File name used", maxlen= 1024, default= "") + filepath = StringProperty(name="File Path", description="Filepath used", maxlen= 1024, default= "") + directory = StringProperty(name="File Directory", description="File Directory used", maxlen= 1024, default= "") + + def poll(self, context): + return True + + def execute(self, context): + (directory, filename) = os.path.split(self.properties.filepath) + command = PYTHON_BIN + " " + IMAGEDIFF_PY + " --build-tests --animation " + self.properties.filepath + " --blender-bin " + BLENDER_BIN + print(os.system(command)) + tests.render.status = "Run" + return {'FINISHED'} + + def invoke(self, context, event): + wm = context.manager + wm.add_fileselect(self) + return {'RUNNING_MODAL'} + classes = [ TESTS_OT_render, TESTS_OT_render_all, TESTS_OT_anim, + TESTS_OT_render_build, + TESTS_OT_render_all_build, + TESTS_OT_anim_build, ] def register(): Modified: branches/soc-2010-leifandersen/release/scripts/ui/space_tests.py =================================================================== --- branches/soc-2010-leifandersen/release/scripts/ui/space_tests.py 2010-07-26 20:42:50 UTC (rev 30774) +++ branches/soc-2010-leifandersen/release/scripts/ui/space_tests.py 2010-07-26 21:10:39 UTC (rev 30775) @@ -42,6 +42,13 @@ row.operator("RENDER_OT_render", text="Render") row = layout.row() row.label(text="Status: " + tests.render.status) + row = layout.row() + row.label(text="Build Tests") + row = layout.row() + row.operator("TESTS_OT_render_build", text="Image") + row.operator("TESTS_OT_render_all_build", text="All Images") + row = layout.row() + row.operator("TESTS_OT_anim_build", text="Animations") classes = [ INFO_MT_tests, Modified: branches/soc-2010-leifandersen/tests/render/run.py =================================================================== --- branches/soc-2010-leifandersen/tests/render/run.py 2010-07-26 20:42:50 UTC (rev 30774) +++ branches/soc-2010-leifandersen/tests/render/run.py 2010-07-26 21:10:39 UTC (rev 30775) @@ -279,17 +279,21 @@ test_path: the path for the output folder of the test when it's rendered''' self.name = os.path.split(blend_path)[1] self.blend_path = blend_path - for imagename in os.listdir(good_path): - if imagename.find('.png') != -1: - self.good_path_arr.append(os.path.join(good_path, imagename)) - self.good_path_arr.sort() - self.mode = 'Image' - for imagename in self.good_path_arr: - (imagepath, blendname) = os.path.split(imagename) - self.test_path_arr.append(os.path.join(test_path, blendname)) - if len(self.good_path_arr) > 0: - self.good_path = self.good_path_arr[0] - self.test_path = test_path + try: + for imagename in os.listdir(good_path): + if imagename.find('.png') != -1: + self.good_path_arr.append(os.path.join(good_path, imagename)) + except OSError: + self.good_path_arr.append(good_path) + finally: + self.good_path_arr.sort() + self.mode = 'Image' + for imagename in self.good_path_arr: + (imagepath, blendname) = os.path.split(imagename) + self.test_path_arr.append(os.path.join(test_path, blendname)) + if len(self.good_path_arr) > 0: + self.good_path = self.good_path_arr[0] + self.test_path = test_path def generate_hash_animation(self, animation): '''Designed mainly for internal use, but can be used for external purposes if needed @@ -794,10 +798,10 @@ (directory, file) = os.path.split(arg) if options.image: case = ImageTestCase() - optional_cases.append((case, arg, os.path.join(directory, 'render', string.replace(file, '.blend', '_0001.png')), os.path.join(directory, 'output', string.replace(file, '.blend', '')))) + optional_cases.append((case, arg, os.path.join(directory, 'render', string.replace(file, '.blend', '_0001.png')), os.path.join(directory, 'output', string.replace(file, '.blend', '')), os.path.join(directory, 'render', string.replace(file, '.blend', '')))) else: case = AnimationTestCase() - optional_cases.append((case, arg, os.path.join(directory, string.replace(file, '.blend', '')), os.path.join(directory, 'output', string.replace(file, '.blend', '')))) + optional_cases.append((case, arg, os.path.join(directory, string.replace(file, '.blend', '')), os.path.join(directory, 'output', string.replace(file, '.blend', '')), os.path.join(directory, string.replace(file, '.blend', '')))) # Get Cases if len(args) == 0: # If there are no optional cases @@ -820,7 +824,7 @@ cases.append(case[0]) else: # If building tests for case in optional_cases: - case[0].setup_image(case[1], '', case[2]) + case[0].setup_image(case[1], '', case[4]) cases.append(case[0]) cases.sort(key=lambda case: case.name) _______________________________________________ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org http://lists.blender.org/mailman/listinfo/bf-blender-cvs