feat: initialize sunrise with 100-player shared rooms
This commit is contained in:
@@ -0,0 +1,57 @@
|
||||
"""Non-destructive Blender color studies; not exported into the game."""
|
||||
import bpy, math
|
||||
from mathutils import Vector
|
||||
base=bpy.data.scenes['Red Sheep - concept matched.003']
|
||||
ROOT='D:/project/sunrise/assets/characters/'
|
||||
|
||||
def linear(hex):
|
||||
values=[int(hex[i:i+2],16)/255 for i in (0,2,4)]
|
||||
return tuple(v/12.92 if v<.04045 else ((v+.055)/1.055)**2.4 for v in values)+(1,)
|
||||
|
||||
for label,palette in [
|
||||
('pink',{'Red':'E8B4BA','Cream':'FFF0DC','Ink':'554344','Gold':'E7BB74'}),
|
||||
('ivory-scarf',{'Red':'F5EDDD','Cream':'E9D5BB','Ink':'493D39','Gold':'BE6264'})
|
||||
]:
|
||||
s=base.copy(); s.name='Sheep study - '+label
|
||||
mapping={}; materials={}
|
||||
for old in list(s.objects):
|
||||
new=old.copy()
|
||||
if old.type=='MESH':
|
||||
new.data=old.data.copy()
|
||||
for i,mat in enumerate(old.data.materials):
|
||||
if mat not in materials:
|
||||
copy=mat.copy(); materials[mat]=copy
|
||||
key=next((k for k in palette if 'SheepV2_'+k in mat.name),'Ink')
|
||||
color=linear(palette[key]); copy.diffuse_color=color
|
||||
for node in copy.node_tree.nodes:
|
||||
if node.type=='EMISSION': node.inputs['Color'].default_value=color
|
||||
new.data.materials[i]=materials[mat]
|
||||
s.collection.objects.link(new); s.collection.objects.unlink(old); mapping[old]=new
|
||||
for old,new in mapping.items():
|
||||
if old.parent: new.parent=mapping[old.parent]
|
||||
s.camera=mapping[base.camera]
|
||||
s.camera.location=(3,-7,2.8)
|
||||
s.camera.rotation_euler=(Vector((0,0,1.5))-s.camera.location).to_track_quat('-Z','Y').to_euler()
|
||||
if label=='ivory-scarf':
|
||||
bpy.context.window.scene=s
|
||||
body=next(o for o in s.objects if o.type=='EMPTY' and o.name.startswith('Body'))
|
||||
for o in s.objects:
|
||||
if o.name.startswith('BodyDetails'): o.hide_render=True; o.hide_viewport=True
|
||||
red=next(m for original,m in materials.items() if 'SheepV2_Gold' in original.name)
|
||||
# Rounded collar with two hanging scarf ends, following the chest.
|
||||
bpy.ops.mesh.primitive_torus_add(major_segments=64,minor_segments=12,location=(0,0,1.64),major_radius=.43,minor_radius=.10)
|
||||
collar=bpy.context.object; collar.name='Scarf collar'; collar.scale.y=.78
|
||||
collar.data.materials.append(red); collar.parent=body
|
||||
for p in collar.data.polygons: p.use_smooth=True
|
||||
for name,loc,scale,angle in [('Scarf long end',(.28,-.385,1.34),(.115,.06,.31),-.16),('Scarf short end',(.45,-.29,1.43),(.10,.07,.22),.30)]:
|
||||
bpy.ops.mesh.primitive_cube_add(size=2,location=loc)
|
||||
o=bpy.context.object; o.name=name; o.scale=scale
|
||||
bpy.ops.object.transform_apply(location=False,rotation=False,scale=True)
|
||||
bevel=o.modifiers.new('Rounded cloth edge','BEVEL'); bevel.width=.055; bevel.segments=5
|
||||
bpy.context.view_layer.objects.active=o; bpy.ops.object.modifier_apply(modifier=bevel.name)
|
||||
o.rotation_euler.y=angle; o.parent=body; o.data.materials.append(red)
|
||||
for p in o.data.polygons: p.use_smooth=True
|
||||
s.render.filepath=ROOT+'sheep-'+label+'.png'
|
||||
bpy.ops.render.render(write_still=True,scene=s.name)
|
||||
bpy.data.libraries.write(ROOT+'sheep-'+label+'-study.blend',{s})
|
||||
print(label,s.render.filepath)
|
||||
Reference in New Issue
Block a user