From 0d18e1be9412cfdeb844da2625725d4bb5485ba2 Mon Sep 17 00:00:00 2001 From: Valtteri Koskivuori Date: Thu, 7 Dec 2023 18:41:23 +0200 Subject: [PATCH] python: Move blender plugin under wrappers/ and un-clobber indentation tabs > spaces --- scripts/blender.py | 43 ---------------------------------------- wrappers/blender_init.py | 43 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+), 43 deletions(-) delete mode 100644 scripts/blender.py create mode 100644 wrappers/blender_init.py diff --git a/scripts/blender.py b/scripts/blender.py deleted file mode 100644 index 961e2618..00000000 --- a/scripts/blender.py +++ /dev/null @@ -1,43 +0,0 @@ -import bpy - -class CrayRenderEngine(bpy.types.RenderEngine): - bl_idname = "C-ray" - bl_label = "C-ray path tracing integration" - bl_use_preview = False - - def render(self, scene): - scale = scene.render.resolution_percentage / 100.0 - self.size_x = int(scene.render.resolution_x * scale) - self.size_y = int(scene.render.resolution_y * scale) - self.render_scene(scene) - - def render_scene(self, scene): - pixel_count = self.size_x * self.size_y - blueRect = [[0.0, 0.0, 1.0, 1.0]] * pixel_count - result = self.begin_result(0, 0, self.size_x, self.size_y) - layer = result.layers[0].passes["Combined"] - layer.rect = blueRect - self.end_result(result) - -def register(): - bpy.utils.register_class(CrayRenderEngine) - - from bl_ui import ( - properties_render, - properties_material, - ) - properties_render.RENDER_PT_render.COMPAT_ENGINES.add(CrayRenderEngine.bl_idname) - properties_material.MATERIAL_PT_preview.COMPAT_ENGINES.add(CrayRenderEngine.bl_idname) - -def unregister(): - bpy.utils.unregister_class(CrayRenderEngine) - - from bl_ui import ( - properties_render, - properties_material, - ) - properties_render.RENDER_PT_render.COMPAT_ENGINES.remove(CrayRenderEngine.bl_idname) - properties_material.MATERIAL_PT_preview.COMPAT_ENGINES.remove(CrayRenderEngine.bl_idname) - -if __name__ == "__main__": - register() \ No newline at end of file diff --git a/wrappers/blender_init.py b/wrappers/blender_init.py new file mode 100644 index 00000000..e21ecfc3 --- /dev/null +++ b/wrappers/blender_init.py @@ -0,0 +1,43 @@ +import bpy + +class CrayRenderEngine(bpy.types.RenderEngine): + bl_idname = "C-ray" + bl_label = "C-ray path tracing integration" + bl_use_preview = False + + def render(self, scene): + scale = scene.render.resolution_percentage / 100.0 + self.size_x = int(scene.render.resolution_x * scale) + self.size_y = int(scene.render.resolution_y * scale) + self.render_scene(scene) + + def render_scene(self, scene): + pixel_count = self.size_x * self.size_y + blueRect = [[0.0, 0.0, 1.0, 1.0]] * pixel_count + result = self.begin_result(0, 0, self.size_x, self.size_y) + layer = result.layers[0].passes["Combined"] + layer.rect = blueRect + self.end_result(result) + +def register(): + bpy.utils.register_class(CrayRenderEngine) + + from bl_ui import ( + properties_render, + properties_material, + ) + properties_render.RENDER_PT_render.COMPAT_ENGINES.add(CrayRenderEngine.bl_idname) + properties_material.MATERIAL_PT_preview.COMPAT_ENGINES.add(CrayRenderEngine.bl_idname) + +def unregister(): + bpy.utils.unregister_class(CrayRenderEngine) + + from bl_ui import ( + properties_render, + properties_material, + ) + properties_render.RENDER_PT_render.COMPAT_ENGINES.remove(CrayRenderEngine.bl_idname) + properties_material.MATERIAL_PT_preview.COMPAT_ENGINES.remove(CrayRenderEngine.bl_idname) + +if __name__ == "__main__": + register()