From 2c707d28e7895da61c0a26bd3e3672be8ddaf589 Mon Sep 17 00:00:00 2001 From: wrenge Date: Fri, 27 Jan 2023 15:54:55 +0300 Subject: [PATCH] Bunch of changes --- CHANGELOG.md | 8 ++++++++ README.md | 8 ++++---- src/codegen.inc.php | 2 +- tpl/codegen_ecs_component.twig | 2 +- tpl/macro_ecs.twig | 3 +++ 5 files changed, 17 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 08d7641..cb20043 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/README.md b/README.md index 56132fe..4560f70 100644 --- a/README.md +++ b/README.md @@ -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 \ No newline at end of file diff --git a/src/codegen.inc.php b/src/codegen.inc.php index 58bb66f..44e723c 100644 --- a/src/codegen.inc.php +++ b/src/codegen.inc.php @@ -4,7 +4,7 @@ namespace metagen_cs_ecs; function supported_tokens() { return [ - 'ecs_serializable', + 'serializable', 'ecs_gen_component', 'ecs_gen_authoring', 'ecs_tag', diff --git a/tpl/codegen_ecs_component.twig b/tpl/codegen_ecs_component.twig index 204c50e..41a8519 100644 --- a/tpl/codegen_ecs_component.twig +++ b/tpl/codegen_ecs_component.twig @@ -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') %} diff --git a/tpl/macro_ecs.twig b/tpl/macro_ecs.twig index 8f984cf..9ea7c8c 100644 --- a/tpl/macro_ecs.twig +++ b/tpl/macro_ecs.twig @@ -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 -%} \ No newline at end of file