Checkpoint 3: deliver playable samples and complete native authoring workflows
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
"""Recreate the demo's original exit arch with an unmodified Blender 4.5+.
|
||||
Run: blender --background --factory-startup --python create.py -- ENGINE_ROOT
|
||||
"""
|
||||
import pathlib
|
||||
import sys
|
||||
import uuid
|
||||
import bpy
|
||||
|
||||
root = pathlib.Path(sys.argv[sys.argv.index('--') + 1]).resolve()
|
||||
output = pathlib.Path(__file__).resolve().parent
|
||||
sys.path.insert(0, str(root / 'tools'))
|
||||
import blender_addon
|
||||
from blender_addon.bundle import publish_bundle
|
||||
|
||||
blender_addon.register()
|
||||
bpy.ops.object.select_all(action='SELECT')
|
||||
bpy.ops.object.delete(use_global=False)
|
||||
material = bpy.data.materials.new('Weathered stone')
|
||||
material.diffuse_color = (0.22, 0.29, 0.34, 1)
|
||||
material.use_nodes = True
|
||||
shader = material.node_tree.nodes.get('Principled BSDF')
|
||||
shader.inputs['Base Color'].default_value = material.diffuse_color
|
||||
shader.inputs['Metallic'].default_value = 0.08
|
||||
shader.inputs['Roughness'].default_value = 0.8
|
||||
material['faset_id'] = '08046276-106a-4aeb-80f1-d4f02a2ffdc1'
|
||||
namespace = uuid.UUID('73023ab9-8fe6-4d56-b136-c25c51510b72')
|
||||
for name, position, size in [
|
||||
('Left post', (0, -1.3, 1.45), (0.45, 0.35, 2.9)),
|
||||
('Right post', (0, 1.3, 1.45), (0.45, 0.35, 2.9)),
|
||||
('Lintel', (0, 0, 3.0), (0.52, 3.0, 0.35)),
|
||||
]:
|
||||
bpy.ops.mesh.primitive_cube_add(location=position)
|
||||
obj = bpy.context.object
|
||||
obj.name = name
|
||||
obj.dimensions = size
|
||||
bpy.ops.object.transform_apply(location=False, rotation=False, scale=True)
|
||||
obj.data.materials.append(material)
|
||||
obj['faset_id'] = str(uuid.uuid5(namespace, name))
|
||||
obj.data['faset_id'] = str(uuid.uuid5(namespace, name + ' mesh'))
|
||||
bevel = obj.modifiers.new('Small stone bevel', 'BEVEL')
|
||||
bevel.width = 0.06
|
||||
bevel.segments = 1
|
||||
bpy.context.scene['faset_asset_id'] = '5832763b-3ed0-44d6-9088-0b524f196a91'
|
||||
bpy.ops.wm.save_as_mainfile(filepath=str(output / 'source.blend'))
|
||||
raw = output / 'arch.glb'
|
||||
bpy.ops.export_scene.gltf(filepath=str(raw), export_format='GLB', export_extras=True,
|
||||
export_yup=True, export_animations=False, export_materials='EXPORT', use_active_scene=True)
|
||||
publish_bundle(raw, output, bpy.context.scene['faset_asset_id'], bpy.app.version_string, 'source.blend')
|
||||
raw.unlink()
|
||||
print('Faset exit arch recreated')
|
||||
@@ -0,0 +1,69 @@
|
||||
{
|
||||
"asset_id": "5832763b-3ed0-44d6-9088-0b524f196a91",
|
||||
"exporter": {
|
||||
"addon_version": "0.1.0",
|
||||
"blender_version": "4.5.3 LTS"
|
||||
},
|
||||
"files": [
|
||||
{
|
||||
"path": "payload/ee6c748a212905fc9c465cbe95c033e94b80be643624f4f240ad5353761205b3.glb",
|
||||
"sha256": "ee6c748a212905fc9c465cbe95c033e94b80be643624f4f240ad5353761205b3",
|
||||
"size": 5556
|
||||
}
|
||||
],
|
||||
"generation": "7000c0ddc0ef38a87a6bfa1833b757df648aecfbdc3c304036028ba7f530a121",
|
||||
"outputs": [
|
||||
{
|
||||
"kind": "node",
|
||||
"locator": "/nodes/0",
|
||||
"name": "Left post",
|
||||
"source_id": "4fbe8b04-1247-5088-a438-934d4e26c532"
|
||||
},
|
||||
{
|
||||
"kind": "node",
|
||||
"locator": "/nodes/1",
|
||||
"name": "Right post",
|
||||
"source_id": "3f82eddf-7169-590e-9116-77f91d809972"
|
||||
},
|
||||
{
|
||||
"kind": "node",
|
||||
"locator": "/nodes/2",
|
||||
"name": "Lintel",
|
||||
"source_id": "49b46a7c-9ae3-54c1-8e4f-ad4efe627330"
|
||||
},
|
||||
{
|
||||
"kind": "mesh",
|
||||
"locator": "/meshes/0",
|
||||
"name": "Cube.001",
|
||||
"source_id": "b359b954-1c3e-5ae9-a127-ce251b05193e"
|
||||
},
|
||||
{
|
||||
"kind": "mesh",
|
||||
"locator": "/meshes/1",
|
||||
"name": "Cube.002",
|
||||
"source_id": "0a83245a-e502-5fd8-978d-dd65931238a3"
|
||||
},
|
||||
{
|
||||
"kind": "mesh",
|
||||
"locator": "/meshes/2",
|
||||
"name": "Cube.003",
|
||||
"source_id": "6f6587d4-1d8e-56b5-9ec6-afbd6ac51e55"
|
||||
},
|
||||
{
|
||||
"kind": "material",
|
||||
"locator": "/materials/0",
|
||||
"name": "Weathered stone",
|
||||
"source_id": "08046276-106a-4aeb-80f1-d4f02a2ffdc1"
|
||||
}
|
||||
],
|
||||
"recipe": {
|
||||
"export_animations": false,
|
||||
"export_extras": true,
|
||||
"export_yup": true,
|
||||
"profile": "faset-gltf-static-v1"
|
||||
},
|
||||
"schema_version": 1,
|
||||
"source": {
|
||||
"path_hint": "source.blend"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"asset_id": "5832763b-3ed0-44d6-9088-0b524f196a91",
|
||||
"schema_version": 1,
|
||||
"settings": {}
|
||||
}
|
||||
BIN
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user