Bunch of changes

This commit is contained in:
wrenge 2023-01-27 15:54:55 +03:00
parent d6b9d88e87
commit 2c707d28e7
5 changed files with 17 additions and 6 deletions

View File

@ -5,6 +5,14 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).
## [1.0.4] - 2023-01-27
### Added
- Support for `bhl_native_class` token
### Changed
- `ecs_serializable` now `serializable`
- Fields are not serializaed by default
- `serializable` token now applicable to fields
## [1.0.1] - 2023-01-25
### Fixed
- Wrong type generation

View File

@ -4,9 +4,9 @@ This package is used for code generation of C# meta structs for LeoECS using Twi
ecs.meta
```
struct TestComponent
@bhl_ecs_component @ecs_gen_component @ecs_gen_authoring @ecs_serializable
pos : Vector3
fwd : Vector3
@bhl_ecs_component @ecs_gen_component @ecs_gen_authoring @serializable
pos : Vector3 @serializable
fwd : Vector3 @serializable
width : float
length : float
end
@ -17,5 +17,5 @@ to be added on game object.
# Tags:
@ecs_gen_component - generates C# component
@ecs_gen_authoring - generates authoring monobehaviour to be added on game object
@ecs_serializable - makes component editable in inspector
@serializable - makes component editable in inspector
@ecs_tag - marks component tag

View File

@ -4,7 +4,7 @@ namespace metagen_cs_ecs;
function supported_tokens()
{
return [
'ecs_serializable',
'serializable',
'ecs_gen_component',
'ecs_gen_authoring',
'ecs_tag',

View File

@ -8,7 +8,7 @@ using {{imp}};
namespace {{namespace}}
{
{% endif %}
{% if has_token(obj, 'ecs_serializable') %}
{% if has_token(obj, 'serializable') %}
[System.Serializable]
{% endif %}
{% apply trim('\n:, ', 'right') %}

View File

@ -1,3 +1,6 @@
{%- macro ecs_component_field(obj, field) -%}
{%- if not has_token(field, 'serializable') -%}
[System.NonSerialized]
{%- endif -%}
public {{field.type|ecs_type}} {{field.name}};
{%- endmacro -%}