v18
This commit is contained in:
parent
de433773b7
commit
6e1bc8d944
31 changed files with 53 additions and 22 deletions
|
|
@ -34,9 +34,15 @@ LET_SIZE, LET_DEP = 11.0, 1.0
|
|||
WORD_SIZE, WORD_DEP = 5.0, 0.8
|
||||
TOP = BASE_H
|
||||
|
||||
HERE = os.path.dirname(bpy.data.filepath) or os.path.dirname(os.path.abspath(__file__))
|
||||
def _outdir():
|
||||
d = os.path.dirname(bpy.data.filepath) # gesetzt, wenn .blend gespeichert
|
||||
if d: return d
|
||||
try: return os.path.dirname(os.path.abspath(__file__))
|
||||
except NameError: return os.path.expanduser("~") # Fallback: Benutzerordner
|
||||
HERE = _outdir()
|
||||
STL_OUT = os.path.join(HERE, "raci-board.stl")
|
||||
PNG_OUT = os.path.join(HERE, "raci_preview.png")
|
||||
print("Ausgabe-Ordner:", HERE)
|
||||
|
||||
# ----------------------------- Helfer -----------------------------
|
||||
def clear_scene():
|
||||
|
|
@ -149,27 +155,44 @@ cut_text(base, "INFORMED", DIAL_CX, DIAL_CY-(RING_R+30), 0, WORD_SIZE, WORD_DEP)
|
|||
cut_text(base, "ACCOUNTABLE", DIAL_CX, CARD_CY - CARD_BD/2 - 8, 0, WORD_SIZE, WORD_DEP)
|
||||
|
||||
base.name = "RACI-Board"
|
||||
bpy.ops.object.shade_smooth()
|
||||
# Auto-Smooth: flache Flaechen scharf, gefaste Kanten glatt
|
||||
try:
|
||||
bpy.ops.object.shade_auto_smooth(angle=math.radians(30)) # Blender >= 4.1
|
||||
except Exception:
|
||||
try: bpy.ops.object.shade_flat()
|
||||
except Exception: pass
|
||||
|
||||
# ----------------------------- Material -----------------------------
|
||||
mat = bpy.data.materials.new("BoardBlue"); mat.use_nodes = True
|
||||
bsdf = mat.node_tree.nodes.get("Principled BSDF")
|
||||
bsdf = next((n for n in mat.node_tree.nodes if n.type == 'BSDF_PRINCIPLED'), None)
|
||||
if bsdf:
|
||||
bsdf.inputs["Base Color"].default_value = (0.10, 0.16, 0.30, 1)
|
||||
try: bsdf.inputs["Roughness"].default_value = 0.55
|
||||
bsdf.inputs["Base Color"].default_value = (0.09, 0.15, 0.30, 1) # dunkelblau
|
||||
try: bsdf.inputs["Roughness"].default_value = 0.5
|
||||
except Exception: pass
|
||||
base.data.materials.append(mat)
|
||||
base.data.materials.clear(); base.data.materials.append(mat)
|
||||
|
||||
# ----------------------------- Vorschau-Render (guarded) -----------------------------
|
||||
try:
|
||||
bpy.ops.object.light_add(type='SUN', location=(120, -160, 220))
|
||||
bpy.context.object.data.energy = 3.0
|
||||
bpy.ops.object.camera_add(location=(150, -190, 210))
|
||||
cam = bpy.context.object
|
||||
cam.rotation_euler = (math.radians(58), 0, math.radians(38))
|
||||
bpy.context.scene.camera = cam
|
||||
sc = bpy.context.scene
|
||||
sc.render.resolution_x, sc.render.resolution_y = 1400, 1000
|
||||
# Welt etwas aufhellen
|
||||
try:
|
||||
wn = sc.world.node_tree.nodes
|
||||
bg = next((n for n in wn if n.type == 'BACKGROUND'), None)
|
||||
if bg: bg.inputs[1].default_value = 1.2
|
||||
except Exception: pass
|
||||
# Licht
|
||||
bpy.ops.object.light_add(type='SUN', location=(120, -160, 240))
|
||||
bpy.context.object.data.energy = 3.5
|
||||
bpy.ops.object.light_add(type='AREA', location=(-120, -60, 160))
|
||||
bpy.context.object.data.energy = 4000; bpy.context.object.data.size = 200
|
||||
# Kamera blickt aufs Board-Zentrum (Track-To), rahmt das ganze Board
|
||||
bpy.ops.object.empty_add(location=(0, 0, 4)); tgt = bpy.context.object
|
||||
bpy.ops.object.camera_add(location=(175, -220, 210)); cam = bpy.context.object
|
||||
cam.data.lens = 52
|
||||
con = cam.constraints.new('TRACK_TO'); con.target = tgt
|
||||
con.track_axis = 'TRACK_NEGATIVE_Z'; con.up_axis = 'UP_Y'
|
||||
sc.camera = cam
|
||||
sc.render.resolution_x, sc.render.resolution_y = 1500, 1050
|
||||
sc.render.filepath = PNG_OUT
|
||||
try: sc.render.engine = 'BLENDER_EEVEE_NEXT'
|
||||
except Exception:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue