Files
Ornament-Generator-RNG/3d model/shop/finish_shop.py
T
2026-11-17 20:19:55 +03:00

20 lines
1.2 KiB
Python

import bpy,math,os
from mathutils import Vector
sc=bpy.context.scene
snow=bpy.data.materials['Soft snow']
for o in sc.objects:
if o.name.startswith(('Red ribbon','Gold ribbon','Ribbon fishtail','Tail gold','Holly leaf','Bow berry')):o.location.y-=.55
for side in (-1,1):
for back in (-1,1):
cu=bpy.data.curves.new('Rounded snow overhang','CURVE');cu.dimensions='3D';cu.bevel_depth=.20;cu.bevel_resolution=5
sp=cu.splines.new('POLY');sp.points.add(80)
for i,p in enumerate(sp.points):
t=i/80;x=side*(.02+5.08*t);y=back*(2.5+.04*math.sin(t*math.tau*4));z=7.0-abs(x)*.45-.06*math.cos(t*math.tau*4)
p.co=(x,y,z,1);p.radius=.8+.2*math.sin(t*math.pi)+.18*math.sin(t*math.tau*4)
o=bpy.data.objects.new('Soft snowy roof lip',cu);sc.collection.objects.link(o);cu.materials.append(snow)
cam=sc.camera;cam.location=(7,-24,8.5);target=Vector((0,0,3.55));cam.rotation_euler=(target-cam.location).to_track_quat('-Z','Y').to_euler()
sc.render.resolution_percentage=100;sc.cycles.samples=48
sc.render.filepath=r'C:\roblox\Ornament Generator RNG\shop\christmas_shop_preview.png'
bpy.ops.wm.save_as_mainfile(filepath=r'C:\roblox\Ornament Generator RNG\shop\christmas_shop.blend')
bpy.ops.render.render(write_still=True)