Untitled

 avatar
unknown
plain_text
a month ago
22 kB
8
Indexable
import bpy
import math

# ─────────────────────────────────────────────
#  PULIZIA SCENA
# ─────────────────────────────────────────────
bpy.ops.object.select_all(action='SELECT')
bpy.ops.object.delete(use_global=False)

# ─────────────────────────────────────────────
#  MATERIALI
# ─────────────────────────────────────────────
def make_mat(name, r, g, b, roughness=0.6, metallic=0.0):
    mat = bpy.data.materials.new(name=name)
    mat.use_nodes = True
    bsdf = mat.node_tree.nodes.get("Principled BSDF")
    bsdf.inputs["Base Color"].default_value = (r, g, b, 1)
    bsdf.inputs["Roughness"].default_value = roughness
    bsdf.inputs["Metallic"].default_value = metallic
    return mat

def apply_mat(obj, mat):
    if obj.data.materials:
        obj.data.materials[0] = mat
    else:
        obj.data.materials.append(mat)

M_STONE      = make_mat("Stone",      0.75, 0.70, 0.62)
M_WOOD       = make_mat("Wood",       0.55, 0.35, 0.20)
M_ROOF_RED   = make_mat("RoofRed",    0.55, 0.15, 0.10)
M_MARBLE     = make_mat("Marble",     0.92, 0.90, 0.88, roughness=0.15)
M_GLASS      = make_mat("Glass",      0.70, 0.88, 0.95, roughness=0.05, metallic=0.1)
M_METAL      = make_mat("Metal",      0.72, 0.74, 0.76, roughness=0.3,  metallic=0.9)
M_GOLD       = make_mat("Gold",       1.00, 0.80, 0.10, roughness=0.15, metallic=1.0)
M_GROUND     = make_mat("Ground",     0.38, 0.52, 0.28)
M_BRICK      = make_mat("Brick",      0.72, 0.42, 0.28)
M_DARK_MET   = make_mat("DarkMetal",  0.15, 0.15, 0.18, roughness=0.2,  metallic=0.9)
M_BLUE_GLASS = make_mat("BlueGlass",  0.20, 0.40, 0.80, roughness=0.05, metallic=0.2)
M_GLOBE_SEA  = make_mat("GlobeSea",   0.10, 0.35, 0.70, roughness=0.1)
M_GLOBE_LAND = make_mat("GlobeLand",  0.20, 0.55, 0.25)
M_WHITE      = make_mat("White",      0.95, 0.95, 0.95, roughness=0.3)
M_SAND       = make_mat("Sand",       0.85, 0.75, 0.55)
M_IVORY      = make_mat("Ivory",      0.95, 0.92, 0.80, roughness=0.4)
M_DARK_STONE = make_mat("DarkStone",  0.30, 0.28, 0.26)
M_COPPER     = make_mat("Copper",     0.72, 0.45, 0.20, roughness=0.4,  metallic=0.8)
M_STAINED    = make_mat("StainedGlass",0.60, 0.20, 0.80, roughness=0.05)

# ─────────────────────────────────────────────
#  HELPER PRIMITIVI
# ─────────────────────────────────────────────
def box(name, x, y, z, sx, sy, sz, mat=None):
    bpy.ops.mesh.primitive_cube_add(location=(x, y, z))
    o = bpy.context.object
    o.name = name
    o.scale = (sx, sy, sz)
    if mat: apply_mat(o, mat)
    return o

def cyl(name, x, y, z, r, depth, mat=None, verts=32):
    bpy.ops.mesh.primitive_cylinder_add(vertices=verts, radius=r, depth=depth, location=(x, y, z))
    o = bpy.context.object
    o.name = name
    if mat: apply_mat(o, mat)
    return o

def cone(name, x, y, z, r1, r2, depth, mat=None):
    bpy.ops.mesh.primitive_cone_add(radius1=r1, radius2=r2, depth=depth, location=(x, y, z))
    o = bpy.context.object
    o.name = name
    if mat: apply_mat(o, mat)
    return o

def sphere(name, x, y, z, r, mat=None):
    bpy.ops.mesh.primitive_uv_sphere_add(radius=r, location=(x, y, z))
    o = bpy.context.object
    o.name = name
    if mat: apply_mat(o, mat)
    return o

def torus(name, x, y, z, major_r, minor_r, mat=None, rx=0, ry=0, rz=0):
    bpy.ops.mesh.primitive_torus_add(major_radius=major_r, minor_radius=minor_r, location=(x, y, z))
    o = bpy.context.object
    o.name = name
    o.rotation_euler = (rx, ry, rz)
    if mat: apply_mat(o, mat)
    return o

# ─────────────────────────────────────────────
#  SUOLO
# ─────────────────────────────────────────────
box("Ground", 0, 0, -0.2, 60, 60, 0.2, M_GROUND)

# ════════════════════════════════════════════
#  LAYOUT ISOLE (come il bozzetto originale)
#  Livello basso  Z=0  →  Museum, Theater, Gallery, Church
#  Livello medio  Z=3  →  Lab, Oxford, Sorbonne, Globe
#  Livello alto   Z=7  →  Burj, Parliament, Italian
# ════════════════════════════════════════════
# Piattaforme
def platform(name, x, y, z):
    box(name, x, y, z, 3.5, 3.5, 0.3, M_STONE)

platform("P_Leopardi",   -20,  0,  0)
platform("P_Museum",     -12,  0,  0)
platform("P_Laboratory",  -4,  0,  0)
platform("P_Globe",        4,  0,  0)
platform("P_Parliament",  12,  0,  0)
platform("P_Burj",        20,  0,  0)
platform("P_Oxford",     -16, -8,  3)
platform("P_Sorbonne",    -8, -8,  3)
platform("P_Theater",      0, -8,  3)
platform("P_Gallery",      8, -8,  3)
platform("P_Church",      16, -8,  3)

# Ponti tra piattaforme
def bridge(x, y, z, sx, sy):
    box(f"Bridge_{x}_{y}", x, y, z, sx, sy, 0.15, M_STONE)

bridge(-16,  0, 0.2,  4, 0.4)
bridge( -8,  0, 0.2,  4, 0.4)
bridge(  0,  0, 0.2,  4, 0.4)
bridge(  8,  0, 0.2,  4, 0.4)
bridge( 16,  0, 0.2,  4, 0.4)

# ════════════════════════════════════════════════════════════
#  1 ─ CASA DI LEOPARDI  centro (-20, 0)
# ════════════════════════════════════════════════════════════
cx, cy = -20, 0
box("Leo_Body",       cx,      cy,  1.8,  2.2, 1.8, 1.8, M_STONE)
box("Leo_Roof_L",     cx-0.6,  cy,  3.9,  1.4, 1.8, 0.12, M_ROOF_RED)
bpy.context.object.rotation_euler = (0, math.radians(28), 0)
box("Leo_Roof_R",     cx+0.6,  cy,  3.9,  1.4, 1.8, 0.12, M_ROOF_RED)
bpy.context.object.rotation_euler = (0, math.radians(-28), 0)
box("Leo_Door",       cx-2.21, cy,  1.0,  0.05, 0.4, 0.9, M_WOOD)
for wy in [-0.7, 0.7]:
    box(f"Leo_Win_{wy}", cx-2.21, cy+wy, 2.1, 0.05, 0.3, 0.4, M_GLASS)
    box(f"Leo_Win2_{wy}",cx+2.21, cy+wy, 2.1, 0.05, 0.3, 0.4, M_GLASS)
cyl("Leo_Col_L",  cx-2.0, cy-1.6, 1.5, 0.1, 3.0, M_STONE, 10)
cyl("Leo_Col_R",  cx-2.0, cy+1.6, 1.5, 0.1, 3.0, M_STONE, 10)
box("Leo_Balcony",cx-2.3, cy,     2.6, 0.05, 0.9, 0.07, M_STONE)

# ════════════════════════════════════════════════════════════
#  2 ─ MUSEO  centro (-12, 0)
# ════════════════════════════════════════════════════════════
cx, cy = -12, 0
for i, w in enumerate([3.2, 2.8, 2.4]):
    box(f"Mu_Step{i}", cx, cy-2.5-i*0.3, 0.15+i*0.1, w, 0.3, 0.1, M_MARBLE)
box("Mu_Body",    cx, cy, 1.8, 2.8, 2.2, 1.8, M_MARBLE)
cone("Mu_Timpano",cx, cy, 3.9, 3.0, 0.1, 1.0, M_MARBLE)
for col_y in [-1.8,-1.0,-0.2, 0.2, 1.0, 1.8]:
    cyl(f"Mu_Col_{col_y}", cx-2.85, col_y, 1.8, 0.15, 3.6, M_MARBLE, 14)
    box(f"Mu_Cap_{col_y}", cx-2.85, col_y, 3.65, 0.22, 0.22, 0.08, M_MARBLE)
box("Mu_Archit",  cx-2.85, cy, 3.75, 0.1, 2.2, 0.1, M_MARBLE)
box("Mu_Sign",    cx-2.9,  cy, 2.6,  0.04,1.4, 0.35, M_GOLD)
for wy in [-1.2, 0, 1.2]:
    box(f"Mu_Win_{wy}", cx+2.81, wy, 2.0, 0.05, 0.5, 0.8, M_GLASS)

# ════════════════════════════════════════════════════════════
#  3 ─ LABORATORIO  centro (-4, 0)
# ════════════════════════════════════════════════════════════
cx, cy = -4, 0
box("Lab_Body",     cx, cy, 2.0, 2.8, 2.4, 2.0, M_BRICK)
box("Lab_Roof",     cx, cy, 4.1, 3.0, 2.6, 0.12, M_DARK_MET)
box("Lab_Tower",    cx+2.0, cy-0.5, 3.0, 0.8, 0.8, 3.0, M_DARK_MET)
cyl("Lab_Chimney",  cx+2.0, cy-0.5, 6.2, 0.28, 1.2, M_DARK_MET, 14)
for wy in [-1.5,-0.5, 0.5, 1.5]:
    box(f"Lab_Win_{wy}", cx-2.81, wy, 2.2, 0.05, 0.5, 1.2, M_BLUE_GLASS)
box("Lab_Door",     cx-2.82, cy, 1.1, 0.05, 0.7, 1.1, M_METAL)
for px,py in [(-0.8,-0.7),(-0.8,0.7),(0.6,-0.7),(0.6,0.7)]:
    box(f"Lab_Solar_{px}{py}", cx+px, py, 4.25, 0.5, 0.3, 0.04, M_BLUE_GLASS)
cyl("Lab_Antenna",  cx-0.8, cy-1.2, 5.5, 0.04, 2.8, M_METAL, 8)

# ════════════════════════════════════════════════════════════
#  4 ─ MAPPAMONDO  centro (4, 0)
# ════════════════════════════════════════════════════════════
cx, cy = 4, 0
cyl("Gl_Base",    cx, cy, 0.4,  0.9,  0.8,  M_DARK_MET, 32)
cyl("Gl_Shaft",   cx, cy, 1.35, 0.18, 1.5,  M_DARK_MET, 16)
cyl("Gl_Collar",  cx, cy, 2.2,  0.4,  0.18, M_DARK_MET, 32)
sphere("Gl_Ocean",cx, cy, 3.8,  1.6,  M_GLOBE_SEA)
for cname,dx,dy,dz,sx,sy,sz in [
    ("Europe",  -0.3, 1.5,  0.7, 0.40,0.05,0.5),
    ("Africa",  -0.3, 1.5, -0.35,0.38,0.05,0.65),
    ("Americas",-1.4, 0.5,  0.2, 0.05,0.5, 0.75),
    ("Asia",     0.5, 1.3,  0.45,0.05,0.6, 0.5),
    ("Australia",0.9, 1.1, -0.65,0.32,0.05,0.3),
    ("Antarctica",0,  0,   -1.6, 0.75,0.75,0.05),
]:
    box(f"Gl_{cname}", cx+dx, cy+dy, 3.8+dz, sx, sy, sz, M_GLOBE_LAND)
torus("Gl_Equator",   cx, cy, 3.8, 1.65, 0.04, M_GOLD)
torus("Gl_Meridian",  cx, cy, 3.8, 1.65, 0.04, M_GOLD, rx=math.radians(90))
cyl("Gl_Axis", cx, cy, 3.8, 0.04, 3.8, M_METAL, 8)
bpy.context.object.rotation_euler = (math.radians(23.5), 0, 0)

# ════════════════════════════════════════════════════════════
#  5 ─ PARLAMENTO ITALIANO  centro (12, 0)
# ════════════════════════════════════════════════════════════
cx, cy = 12, 0
# Corpo principale
box("Parl_Body",      cx, cy,    2.0,  3.2, 2.8, 2.0, M_IVORY)
# Ali laterali
box("Parl_WingL",     cx, cy-2.2, 1.4, 2.4, 0.8, 1.4, M_IVORY)
box("Parl_WingR",     cx, cy+2.2, 1.4, 2.4, 0.8, 1.4, M_IVORY)
# Portico colonnato frontale
for col_y in [-2.0,-1.2,-0.4, 0.4, 1.2, 2.0]:
    cyl(f"Parl_Col_{col_y}", cx-3.25, col_y, 1.8, 0.16, 3.6, M_MARBLE, 14)
box("Parl_Archit",    cx-3.25, cy, 3.7, 0.1, 2.2, 0.1, M_MARBLE)
cone("Parl_Frontone", cx-3.25, cy, 4.2, 2.4, 0.1, 0.9, M_MARBLE)
# Cupola centrale
cyl("Parl_Drum",      cx, cy, 4.2, 1.0, 0.5, M_IVORY, 32)
sphere("Parl_Dome",   cx, cy, 5.0, 1.0, M_IVORY)
cyl("Parl_Lantern",   cx, cy, 6.1, 0.18, 0.6, M_IVORY, 16)
cone("Parl_DomeTip",  cx, cy, 6.55, 0.18, 0.02, 0.5, M_GOLD)
# Bandiera
cyl("Parl_FlagPole",  cx-3.3, cy, 4.6, 0.04, 1.8, M_METAL, 8)
box("Parl_Flag",      cx-3.3, cy+0.5, 5.4, 0.03, 0.6, 0.35, M_ROOF_RED)
# Finestre
for wy in [-1.8,-0.9, 0, 0.9, 1.8]:
    box(f"Parl_Win_{wy}", cx+3.21, wy, 2.2, 0.05, 0.45, 0.75, M_GLASS)

# ════════════════════════════════════════════════════════════
#  6 ─ BURJ KHALIFA  centro (20, 0)
# ════════════════════════════════════════════════════════════
cx, cy = 20, 0
# Base a tre lobi
for angle in [0, 120, 240]:
    rad = math.radians(angle)
    bx = cx + math.cos(rad)*0.6
    by = cy + math.sin(rad)*0.6
    box(f"Burj_Lobe{angle}", bx, by, 1.5, 0.9, 0.9, 3.0, M_SAND)
# Torre centrale a gradoni (si restringe salendo)
levels = [
    (0.75, 0.75, 3.0,  3.0),
    (0.62, 0.62, 2.6,  9.0),
    (0.50, 0.50, 2.0, 14.0),
    (0.38, 0.38, 1.5, 18.5),
    (0.28, 0.28, 1.0, 22.0),
    (0.18, 0.18, 0.8, 25.0),
    (0.10, 0.10, 0.5, 27.5),
]
for i,(sx,sy,sz,zc) in enumerate(levels):
    box(f"Burj_L{i}", cx, cy, zc, sx, sy, sz, M_SAND)
# Vetrate sui lati
for i,zc in enumerate([3,8,13,18,22]):
    for angle in [0,90,180,270]:
        r = math.radians(angle)
        wx = cx + math.cos(r)*0.76
        wy = cy + math.sin(r)*0.76
        b = box(f"Burj_Glass_{i}_{angle}", wx, wy, zc, 0.05, 0.05, 2.0, M_BLUE_GLASS)
        b.rotation_euler = (0, 0, r)
# Antenna
cyl("Burj_Antenna", cx, cy, 31.0, 0.06, 6.0, M_METAL, 8)
cone("Burj_AntTip", cx, cy, 34.2, 0.06, 0.01, 0.4, M_METAL)

# ════════════════════════════════════════════════════════════
#  7 ─ UNIVERSITÀ DI OXFORD  centro (-16, -8)  livello medio
# ════════════════════════════════════════════════════════════
cx, cy = -16, -8
# Corpo principale gotico
box("Ox_Body",    cx, cy, 4.8, 2.6, 2.2, 1.8, M_STONE)
# Due torri angolari
for tx, ty in [(-1.8,-1.4),(-1.8,1.4),(1.8,-1.4),(1.8,1.4)]:
    box(f"Ox_Tower_{tx}{ty}", cx+tx, cy+ty, 5.5, 0.5, 0.5, 2.5, M_STONE)
    cone(f"Ox_Spire_{tx}{ty}", cx+tx, cy+ty, 8.1, 0.5, 0.02, 1.5, M_DARK_STONE)
# Finestre ogivali
for wy in [-1.2, 0, 1.2]:
    box(f"Ox_Win_{wy}", cx-2.61, cy+wy, 5.2, 0.05, 0.3, 0.7, M_GLASS)
    cone(f"Ox_WinTop_{wy}", cx-2.61, cy+wy, 5.9, 0.15, 0.01, 0.3, M_STONE)
# Ingresso arcuato
box("Ox_Door",   cx-2.62, cy, 4.3, 0.05, 0.5, 0.8, M_WOOD)
box("Ox_Arch",   cx-2.62, cy, 5.15,0.05, 0.5, 0.3, M_STONE)
# Quadrangle (cortile)
for side,rx,ry in [("N",2.2,0),("S",-2.2,0),("E",0,2.0),("W",0,-2.0)]:
    box(f"Ox_Court_{side}", cx+rx, cy+ry, 4.2, 0.12 if 'E' in side or 'W' in side else 2.2,
        0.12 if 'N' in side or 'S' in side else 2.0, 0.8, M_STONE)

# ════════════════════════════════════════════════════════════
#  8 ─ UNIVERSITÀ SORBONNE  centro (-8, -8)
# ════════════════════════════════════════════════════════════
cx, cy = -8, -8
box("Sorb_Body",    cx, cy, 4.8, 2.8, 2.2, 1.8, M_IVORY)
# Facciata barocca
for col_y in [-1.4,-0.5, 0.5, 1.4]:
    cyl(f"Sorb_Col_{col_y}", cx-2.85, cy+col_y, 4.8, 0.14, 3.6, M_MARBLE, 12)
box("Sorb_Archit",  cx-2.85, cy, 6.7, 0.1, 2.0, 0.12, M_MARBLE)
# Cupola
cyl("Sorb_Drum",    cx, cy, 6.7, 0.85, 0.5, M_IVORY, 32)
sphere("Sorb_Dome", cx, cy, 7.5, 0.85, M_IVORY)
cyl("Sorb_Lantern", cx, cy, 8.4, 0.15, 0.5, M_IVORY, 16)
cyl("Sorb_Cross_V", cx, cy, 9.0, 0.03, 0.8, M_METAL, 8)
box("Sorb_Cross_H", cx, cy, 9.1, 0.03, 0.4, 0.03, M_METAL)
# Finestre
for wy in [-1.2, 0, 1.2]:
    box(f"Sorb_Win_{wy}", cx+2.81, cy+wy, 5.4, 0.05, 0.4, 0.65, M_GLASS)
box("Sorb_Door",    cx-2.82, cy, 4.4, 0.05, 0.45, 0.75, M_WOOD)

# ════════════════════════════════════════════════════════════
#  9 ─ TEATRO  centro (0, -8)
# ════════════════════════════════════════════════════════════
cx, cy = 0, -8
# Corpo semicircolare + scena
box("Th_Stage",     cx, cy+0.5, 4.5, 2.0, 1.5, 1.5, M_MARBLE)
box("Th_Backstage", cx, cy+1.8, 4.8, 1.5, 0.5, 1.8, M_STONE)
# Gradinate (cavea)
for i in range(4):
    r = 1.8 + i*0.45
    box(f"Th_Tier{i}", cx, cy-r+1.0, 4.1+i*0.25, 2.0, 0.4, 0.25+i*0.1, M_STONE)
# Colonne ingresso
for col_y in [-1.5,-0.5,0.5,1.5]:
    cyl(f"Th_Col_{col_y}", cx-2.05, cy+col_y, 4.8, 0.15, 3.0, M_MARBLE, 12)
box("Th_Archit",    cx-2.05, cy, 6.35, 0.1, 2.0, 0.1, M_MARBLE)
cone("Th_Frontone", cx-2.05, cy, 6.85, 2.2, 0.1, 0.8, M_MARBLE)
# Maschere teatrali (decoro)
box("Th_MaskL",     cx-2.1, cy-0.6, 5.8, 0.04, 0.18, 0.18, M_GOLD)
box("Th_MaskR",     cx-2.1, cy+0.6, 5.8, 0.04, 0.18, 0.18, M_GOLD)

# ════════════════════════════════════════════════════════════
#  10 ─ GALLERIA D'ARTE  centro (8, -8)
# ════════════════════════════════════════════════════════════
cx, cy = 8, -8
box("Gal_Body",     cx, cy, 4.8, 2.8, 2.2, 1.6, M_WHITE)
# Tetto a shed (lucernai inclinati tipici delle gallerie)
for i in range(3):
    box(f"Gal_Shed{i}", cx-0.8+i*0.8, cy, 6.55, 0.4, 2.2, 0.08, M_GLASS)
    bpy.context.object.rotation_euler = (0, math.radians(20), 0)
# Facciata minimalista con lesene
for col_y in [-1.8,-0.9, 0, 0.9, 1.8]:
    box(f"Gal_Pilaster_{col_y}", cx-2.81, cy+col_y, 4.8, 0.08, 0.18, 1.6, M_WHITE)
# Grandi vetrate
for wy in [-1.4, 0, 1.4]:
    box(f"Gal_Win_{wy}", cx-2.82, cy+wy, 5.2, 0.05, 0.5, 1.0, M_GLASS)
box("Gal_Door",     cx-2.83, cy, 4.3, 0.05, 0.55, 0.85, M_GLASS)
# Insegna con cornice dorata
box("Gal_Sign",     cx-2.88, cy, 6.2, 0.03, 1.8, 0.22, M_GOLD)
box("Gal_SignInner",cx-2.9,  cy, 6.2, 0.03, 1.6, 0.15, M_WHITE)
# Scultura fuori
sphere("Gal_Sculpt_Head", cx-3.5, cy, 5.55, 0.22, M_MARBLE)
box("Gal_Sculpt_Neck",    cx-3.5, cy, 5.2,  0.12, 0.12, 0.22, M_MARBLE)
box("Gal_Sculpt_Body",    cx-3.5, cy, 4.75, 0.3,  0.18, 0.5,  M_MARBLE)

# ════════════════════════════════════════════════════════════
#  11 ─ CHIESA  centro (16, -8)
# ════════════════════════════════════════════════════════════
cx, cy = 16, -8
# Navata
box("Ch_Nave",      cx, cy, 5.2, 1.8, 2.4, 2.2, M_STONE)
# Transetto
box("Ch_Transept",  cx, cy, 5.0, 3.0, 0.9, 1.8, M_STONE)
# Abside
box("Ch_Apse",      cx+1.8, cy, 4.8, 0.8, 1.4, 1.8, M_STONE)
# Torre campanile
box("Ch_Bell_Tower",cx-2.5, cy-1.5, 6.5, 0.7, 0.7, 4.5, M_STONE)
cone("Ch_Belfry",   cx-2.5, cy-1.5, 9.0, 0.75,0.02, 1.5, M_ROOF_RED)
# Aperture campanile
for bz in [8.0, 8.5]:
    for angle in [0, 90]:
        r = math.radians(angle)
        bx = cx-2.5 + math.cos(r)*0.72
        by = cy-1.5 + math.sin(r)*0.72
        b = box(f"Ch_BellWin_{bz}_{angle}", bx, by, bz, 0.05, 0.05, 0.3, M_DARK_STONE)
        b.rotation_euler = (0, 0, r)
# Facciata con portale
cone("Ch_FacadeTop", cx-1.81, cy, 7.5, 1.8, 0.1, 0.9, M_STONE)
box("Ch_Portal",     cx-1.82, cy, 4.9, 0.05, 0.6, 1.0, M_WOOD)
box("Ch_Portal_Arch",cx-1.82, cy, 5.95,0.05, 0.6, 0.35, M_STONE)
# Rosone (vetrata)
cyl("Ch_Rose",       cx-1.84, cy, 6.7, 0.4, 0.06, M_STAINED, 24)
# Croce sulla sommità
cyl("Ch_Cross_V",    cx, cy, 7.5, 0.04, 1.0, M_GOLD, 8)
box("Ch_Cross_H",    cx, cy, 7.7, 0.04, 0.5, 0.04, M_GOLD)

# ════════════════════════════════════════════════════════════
#  ILLUMINAZIONE
# ════════════════════════════════════════════════════════════
bpy.ops.object.light_add(type='SUN', location=(10, -20, 25))
sun = bpy.context.object
sun.name = "Sun"
sun.data.energy = 5.0
sun.rotation_euler = (math.radians(50), 0, math.radians(25))

bpy.ops.object.light_add(type='AREA', location=(0, 15, 12))
fill = bpy.context.object
fill.name = "FillLight"
fill.data.energy = 800
fill.data.size = 15

# ════════════════════════════════════════════════════════════
#  CAMERA
# ════════════════════════════════════════════════════════════
bpy.ops.object.camera_add(location=(2, -35, 18))
cam = bpy.context.object
cam.name = "MainCamera"
cam.rotation_euler = (math.radians(62), 0, 0)
bpy.context.scene.camera = cam

# ─────────────────────────────────────────────
print("=" * 55)
print("  Città completata!  Oggetti nella scena:")
for o in sorted(bpy.context.scene.objects, key=lambda x: x.name):
    print(f"    • {o.name}")
print("=" * 55)
Editor is loading...
Leave a Comment