-
Notifications
You must be signed in to change notification settings - Fork 3
/
test.py
35 lines (30 loc) · 1.07 KB
/
test.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
import bpy
import sys
import os
# This script runs under Blender's python environment. Add the current
# directly to the path so we can import our own modules
dir_path = os.path.dirname(os.path.realpath(__file__))
print(f"Prepending {dir_path} to Python path...")
sys.path.insert(0, dir_path)
from lib.renderer.renderer import Renderer
from lib.renderer.render_options import RenderOptions, Quality, LightingStyle, Look, Material
from lib.colors import RebrickableColors
color = RebrickableColors.MediumAzure.value
renderer = Renderer(ldraw_path="./ldraw")
options = RenderOptions(
image_filename = "renders/test.png",
bounding_box_filename = "renders/test.txt",
blender_filename = "renders/test.blend",
quality = Quality.HIGH,
lighting_style = LightingStyle.DEFAULT,
part_color = color.best_hex,
material = Material.TRANSPARENT if color.is_transparent else Material.PLASTIC,
light_angle = 160,
part_rotation=(0, 0, 270),
camera_height=45,
zoom=0.1,
look=Look.NORMAL,
width=244,
height=244,
)
renderer.render_part("3002", options)