Skip to content

Commit

Permalink
python: Move blender plugin under wrappers/ and un-clobber indentation
Browse files Browse the repository at this point in the history
tabs > spaces
  • Loading branch information
vkoskiv committed Dec 7, 2023
1 parent a44043b commit 0d18e1b
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 43 deletions.
43 changes: 0 additions & 43 deletions scripts/blender.py

This file was deleted.

43 changes: 43 additions & 0 deletions wrappers/blender_init.py
Original file line number Diff line number Diff line change
@@ -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()

0 comments on commit 0d18e1b

Please sign in to comment.