-
Notifications
You must be signed in to change notification settings - Fork 0
/
blender_render.py
58 lines (46 loc) · 1.63 KB
/
blender_render.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
import bpy
bl_info = {"name": "My Render Test Addon", "category": "Render"}
def register():
print("Hello World")
bpy.utils.register_class(ColorItem)
bpy.utils.register_class(UiPanel)
bpy.utils.register_class(ExampleRenderEngine)
bpy.types.Scene.color = bpy.props.PointerProperty(type=ColorItem)
def unregister():
print("Goodbye World")
bpy.utils.unregister_class(ExampleRenderEngine)
bpy.utils.unregister_class(UiPanel)
bpy.utils.unregister_class(ColorItem)
del bpy.types.Scene.color
class ColorItem(bpy.types.PropertyGroup):
color = bpy.props.FloatVectorProperty(
name = "Color Picker",
subtype = "COLOR",
size = 4,
min = 0.0,
max = 1.0,
default = (0.5,0.5,0.5,1.0)
)
class UiPanel(bpy.types.Panel):
bl_label = "Render"
bl_idname = "OBJECT_NAME"
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
bl_context = "render"
def draw(self, context):
layout = self.layout
row = layout.row()
row.label(text="Enter Number", icon='WORLD_DATA')
row = layout.row()
row.prop(context.scene.color, "color")
class ExampleRenderEngine(bpy.types.RenderEngine):
bl_idname = 'TestRenderer'
bl_label = "TestRenderer"
def render(self,scene):
sx = scene.render.resolution_x
sy = scene.render.resolution_y
result = self.begin_result(0, 0, sx, sy)
layer = result.layers[0].passes["Combined"]
rect = [scene.color.color] * sx * sy
layer.rect = rect
self.end_result(result)