This commit is contained in:
listik committed 2026-11-16 23:50:40 +03:00
commit 2d6a8a867d
1093 files changed
+2424571

No files matched your search

+42
View File
@@ -0,0 +1,42 @@
import bpy,math,os
from mathutils import Vector
sc=bpy.context.scene;folder=os.path.dirname(bpy.data.filepath)
bpy.ops.wm.save_as_mainfile(filepath=os.path.join(folder,'map_before_bench_refinement.blend'),copy=True)
roots=[o for o in sc.objects if o.type=='EMPTY' and o.name.startswith('Bench_')]
coll=bpy.data.collections.new('Refined_Bench_Details');sc.collection.children.link(coll)
iron=bpy.data.materials.get('Lantern_Dark_Bronze');wood=bpy.data.materials.get('Bench_Warm_Wood');snow=bpy.data.materials.get('Snow_Full_Soft')
def box(name,loc,size,mat,parent):
bpy.ops.mesh.primitive_cube_add(size=1,location=loc);o=bpy.context.object;o.name=name;o.dimensions=size
bpy.ops.object.transform_apply(location=False,rotation=False,scale=True)
for c in list(o.users_collection):c.objects.unlink(o)
coll.objects.link(o);o.parent=parent;o.data.materials.append(mat)
b=o.modifiers.new('Rounded timber edges','BEVEL');b.width=.075;b.segments=3
o.modifiers.new('Normals','WEIGHTED_NORMAL')
return o
for root in roots:
for o in list(root.children):o.hide_render=True;o.hide_set(True)
for y in (-.78,-.26,.26,.78):box('Bench_Seat_Timber',(0,y,1.85),(6.6,.46,.28),wood,root)
for z in (2.55,3.3):
o=box('Bench_Back_Timber',(0,.95+(z-2.3)*.17,z),(6.6,.32,.65),wood,root);o.rotation_euler.x=math.radians(-10)
for sign in (-1,1):
x=sign*2.7
# Side frame silhouette: splayed feet and curved armrest.
for y in (-.73,.73):
o=box('Bench_Splayed_Leg',(x,y,1.05),(.37,.42,1.65),iron,root);o.rotation_euler.x=.14 if y>0 else -.14
box('Bench_Side_Beam',(x,0,1.63),(.39,2.05,.3),iron,root)
o=box('Bench_Back_Support',(x,1.02,2.58),(.32,.33,2.05),iron,root);o.rotation_euler.x=-.17
curve=bpy.data.curves.new('CurvedArm','CURVE');curve.dimensions='3D';curve.bevel_depth=.16;curve.bevel_resolution=2
spline=curve.splines.new('BEZIER');spline.bezier_points.add(3)
for p,co in zip(spline.bezier_points,[(x,-.78,1.95),(x,-.75,2.6),(x,.05,2.72),(x,.95,2.65)]):p.co=co;p.handle_left_type='AUTO';p.handle_right_type='AUTO'
o=bpy.data.objects.new('Bench_Curved_Arm',curve);coll.objects.link(o);o.parent=root;curve.materials.append(iron)
# A single soft, irregular snow pillow follows the upper back plank.
bpy.ops.mesh.primitive_uv_sphere_add(segments=40,ring_count=12,radius=1)
o=bpy.context.object;o.name='Bench_Snow_Cap'
for v in o.data.vertices:
x,y,z=v.co;v.co=(x*3.4,y*.36*(1+.13*math.sin(x*10)),z*.24+.045*math.sin(x*11)*(1-z*z))
o.location=(0,1.13,3.68);o.parent=root
for c in list(o.users_collection):c.objects.unlink(o)
coll.objects.link(o);o.data.materials.append(snow)
for p in o.data.polygons:p.use_smooth=True
path=os.path.join(folder,'map_refined_benches.blend');bpy.ops.wm.save_as_mainfile(filepath=path)
print('Rebuilt benches:',len(roots),path)