Update
This commit is contained in:
commit
2d6a8a867d
1093 files changed
+2424571
No files matched your search
@@ -0,0 +1,53 @@
|
||||
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_furniture.blend'),copy=True)
|
||||
coll=bpy.data.collections.new('Plaza_Benches_And_Lanterns');sc.collection.children.link(coll)
|
||||
def mat(name,c,metal=0,emit=0):
|
||||
m=bpy.data.materials.new(name);m.diffuse_color=(*c,1);m.use_nodes=True
|
||||
p=next(n for n in m.node_tree.nodes if n.type=='BSDF_PRINCIPLED');p.inputs['Base Color'].default_value=(*c,1);p.inputs['Metallic'].default_value=metal;p.inputs['Roughness'].default_value=.45;p.inputs['Emission Color'].default_value=(*c,1);p.inputs['Emission Strength'].default_value=emit
|
||||
return m
|
||||
wood=mat('Bench_Warm_Wood',(.32,.115,.04));iron=mat('Lantern_Dark_Bronze',(.045,.034,.027),.6)
|
||||
red=mat('Festive_Ribbon',(.65,.018,.025));glow=mat('Lantern_Warm_Glass',(1,.6,.15),0,3)
|
||||
snow=bpy.data.materials.get('Snow_Full_Soft')
|
||||
def move(o,parent,material):
|
||||
for c in list(o.users_collection):c.objects.unlink(o)
|
||||
coll.objects.link(o);o.parent=parent
|
||||
if material:o.data.materials.append(material)
|
||||
return o
|
||||
def box(name,pos,size,material,parent):
|
||||
bpy.ops.mesh.primitive_cube_add(size=1,location=pos);o=bpy.context.object;o.name=name;o.dimensions=size
|
||||
bpy.ops.object.transform_apply(location=False,rotation=False,scale=True)
|
||||
bevel=o.modifiers.new('Soft edges','BEVEL');bevel.width=.06;bevel.segments=2
|
||||
return move(o,parent,material)
|
||||
def cone(name,z,r1,r2,depth,material,parent,vertices=8):
|
||||
bpy.ops.mesh.primitive_cone_add(vertices=vertices,radius1=r1,radius2=r2,depth=depth,location=(0,0,z));o=bpy.context.object;o.name=name;return move(o,parent,material)
|
||||
for i in range(10):
|
||||
a=(i+.5)*math.tau/10
|
||||
root=bpy.data.objects.new(('Bench_' if i%2==0 else 'Lamp_')+str(i),None);coll.objects.link(root)
|
||||
if i%2==0:
|
||||
for x in (-2.65,2.65):
|
||||
for y in (-.65,.65):box('Bench_Leg',(x,y,1.2),(.28,.32,1.7),iron,root)
|
||||
box('Back_Support',(x,.78,2.6),(.25,.28,3.0),iron,root)
|
||||
box('Armrest',(x,0,2.65),(.32,1.9,.22),iron,root)
|
||||
for y in (-.65,0,.65):box('Seat_Plank',(0,y,1.95),(6.4,.58,.22),wood,root)
|
||||
for z in (2.65,3.35):box('Back_Plank',(0,.87,z),(6.4,.22,.55),wood,root)
|
||||
if snow:box('Back_Snow',(0,.87,3.69),(6.45,.32,.14),snow,root)
|
||||
else:
|
||||
cone('Lamp_Base',.85,.65,.52,.7,iron,root)
|
||||
cone('Lamp_Post',3.8,.19,.14,5.4,iron,root)
|
||||
cone('Lantern_Foot',6.55,.55,.65,.25,iron,root,4)
|
||||
box('Warm_Lantern',(0,0,7.25),(.9,.9,1.2),glow,root)
|
||||
for x in (-.5,.5):
|
||||
for y in (-.5,.5):box('Lantern_Frame',(x,y,7.25),(.1,.1,1.4),iron,root)
|
||||
cone('Lantern_Roof',8.1,.95,.14,.6,iron,root,4)
|
||||
cone('Lantern_Finial',8.52,.13,0,.3,iron,root)
|
||||
for sign in (-1,1):
|
||||
o=box('Bow_Loop',(sign*.4,-.23,5.2),(.75,.24,.46),red,root);o.rotation_euler.y=sign*.3
|
||||
o=box('Ribbon_Tail',(sign*.23,-.23,4.72),(.24,.2,.7),red,root);o.rotation_euler.y=sign*-.3
|
||||
box('Bow_Knot',(0,-.38,5.2),(.3,.3,.32),red,root)
|
||||
d=bpy.data.lights.new('Warm_Pool','POINT');d.energy=100;d.color=(1,.63,.27);d.shadow_soft_size=1
|
||||
o=bpy.data.objects.new('Warm_Pool',d);coll.objects.link(o);o.parent=root;o.location=(0,0,7.2)
|
||||
root.location=(-math.sin(a)*33,math.cos(a)*33,.25);root.rotation_euler.z=a
|
||||
path=os.path.join(folder,'map_plaza_furniture.blend');bpy.ops.wm.save_as_mainfile(filepath=path)
|
||||
print('Created 5 benches and 5 decorated lamps between plaza exits:',path)
|
||||
Reference in new issue
Block a user