Skip to content

Commit

Permalink
resource: proper add/remove/override children units
Browse files Browse the repository at this point in the history
Part-of: #215
  • Loading branch information
dbartolini committed Dec 30, 2024
1 parent 08347ca commit 8632529
Show file tree
Hide file tree
Showing 6 changed files with 536 additions and 338 deletions.
1 change: 1 addition & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ Changelog
* Lua API: 3D Gui will now place objects on the new XY plane (on the "floor") by default.
* Lua API: added ``SceneGraph.owner()``, ``SceneGraph.first_child()`` and ``SceneGraph.next_sibling()``.
* Data Compiler: .mesh resource can now have shared geometries between nodes.
* Data Compiler: .unit resources have now the ability to add/remove inherited children or to override them by adding, removing or modifying their components.

0.53.0 --- 30 Nov 2024
----------------------
Expand Down
10 changes: 5 additions & 5 deletions src/resource/level_resource.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,12 @@ namespace level_resource_internal
}
}

UnitCompiler uc(opts);
s32 err = 0;
err = uc.compile_units_array(obj["units"], UINT32_MAX);
UnitCompiler uc(default_allocator(), opts);
s32 err = unit_compiler::parse_unit_array_from_json(uc, obj["units"]);
DATA_COMPILER_ENSURE(err == 0, opts);

Buffer unit_blob = uc.blob();
Buffer units_blob = unit_compiler::blob(uc);
DATA_COMPILER_ENSURE(array::size(units_blob) > 0, opts);

// Write
LevelResource lr;
Expand Down Expand Up @@ -121,7 +121,7 @@ namespace level_resource_internal

// Write units
opts.align(16);
opts.write(unit_blob);
opts.write(units_blob);
return 0;
}

Expand Down
2 changes: 1 addition & 1 deletion src/resource/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ struct Platform
#define RESOURCE_VERSION_STATE_MACHINE RESOURCE_VERSION(6)
#define RESOURCE_VERSION_CONFIG RESOURCE_VERSION(1)
#define RESOURCE_VERSION_FONT RESOURCE_VERSION(1)
#define RESOURCE_VERSION_UNIT RESOURCE_VERSION(10)
#define RESOURCE_VERSION_UNIT RESOURCE_VERSION(11)
#define RESOURCE_VERSION_LEVEL (RESOURCE_VERSION_UNIT + 4) //!< Level embeds UnitResource
#define RESOURCE_VERSION_MATERIAL RESOURCE_VERSION(5)
#define RESOURCE_VERSION_MESH RESOURCE_VERSION(6)
Expand Down
Loading

0 comments on commit 8632529

Please sign in to comment.