Compare commits

...

3 Commits

Author SHA1 Message Date
wrenge ff393b9793 missing twig commit 2023-02-03 11:33:29 +03:00
wrenge 341882c786 Updated changelog 2023-02-03 11:29:39 +03:00
wrenge 019a69ace9 Added meta manual generation 2023-02-03 11:28:54 +03:00
4 changed files with 37 additions and 12 deletions

View File

@ -5,6 +5,10 @@ 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.5] - 2023-02-03
### Added
- Meta deterministic generation for authoring components
## [1.0.4] - 2023-01-27
### Added
- Support for `bhl_native_class` token

View File

@ -7,7 +7,8 @@
"twig/twig" : "v3.4.3",
"bit/metagen" : "^v2.0.2",
"bit/metagen_cs" : "^v1.0.5",
"bit/taskman_helpers" : "^v1.0.6"
"bit/taskman_helpers" : "^v1.0.6",
"ramsey/uuid" : "^v3"
},
"autoload": {
"files": [

View File

@ -1,6 +1,8 @@
<?php
namespace metagen_cs_ecs;
use Ramsey\Uuid\Uuid;
function supported_tokens()
{
return [
@ -94,6 +96,7 @@ function generate_ecs_components(\mtgMetaInfo $meta)
$unit_name = $unit->object->getName();
$filePath = str_replace(".", "/", $unit_name);
$file = "$gen_root/{$filePath}AuthoringComponent.cs";
$fileMeta = "$gen_root/{$filePath}AuthoringComponent.cs.meta";
$name_components = explode('.', $unit_name);
$class_name = end($name_components);
if($class_name != $unit_name)
@ -105,17 +108,23 @@ function generate_ecs_components(\mtgMetaInfo $meta)
if(empty($namespace))
$namespace = "ecs";
if($unit->object->hasToken('ecs_gen_authoring'))
{
\taskman\ensure_write_if_differs(
$file,
$twig->render('codegen_ecs_authoring.twig', [
'namespace' => $namespace,
'class_name' => $class_name,
'obj' => $unit->object
])
);
}
\taskman\ensure_write_if_differs(
$file,
$twig->render('codegen_ecs_authoring.twig', [
'namespace' => $namespace,
'class_name' => $class_name,
'obj' => $unit->object
])
);
$uuid = Uuid::uuid3(Uuid::NAMESPACE_URL, $file);
$guid = bin2hex($uuid->getBytes());
\taskman\ensure_write_if_differs(
$fileMeta,
$twig->render('codegen_ecs_authoring_meta.twig', [
'guid' => $guid,
])
);
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: {{guid}}
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: