From 58f14d0a64e6d3ea074b27d4abea5ce74f462acb Mon Sep 17 00:00:00 2001 From: Insality Date: Tue, 13 May 2025 21:43:05 +0300 Subject: [PATCH] Return hack to keep cloned node_ids consistent --- README.md | 2 +- druid/component.lua | 10 ++++++++++ game.project | 2 +- wiki/changelog.md | 3 +++ 4 files changed, 15 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index f31067f..e1ebd98 100644 --- a/README.md +++ b/README.md @@ -39,7 +39,7 @@ Open your `game.project` file and add the following lines to the dependencies fi **[Druid](https://github.com/Insality/druid/)** ``` -https://github.com/Insality/druid/archive/refs/tags/1.1.2.zip +https://github.com/Insality/druid/archive/refs/tags/1.1.3.zip ``` **[Defold Event](https://github.com/Insality/defold-event)** diff --git a/druid/component.lua b/druid/component.lua index f92a9b0..359af4a 100644 --- a/druid/component.lua +++ b/druid/component.lua @@ -117,7 +117,17 @@ function M:set_nodes(nodes) nodes = gui.clone_tree(nodes) --[[@as table]] end + -- When we use gui.clone_tree in inner template (template inside other template) + -- this nodes have no id. We have table: hash(correct_id) : hash("") or hash("_nodeX" + -- It's wrong and we use this hack to fix this + if nodes then + for id, node in pairs(nodes) do + gui.set_id(node, id) + end + end + self._meta.nodes = nodes + return self end diff --git a/game.project b/game.project index d2ab4ce..8b5dabd 100644 --- a/game.project +++ b/game.project @@ -14,7 +14,7 @@ update_frequency = 60 [project] title = Druid -version = 1.1.2 +version = 1.1.3 publisher = Insality developer = Maksim Tuprikov custom_resources = /example/locales diff --git a/wiki/changelog.md b/wiki/changelog.md index dd36e4c..ba9ca34 100644 --- a/wiki/changelog.md +++ b/wiki/changelog.md @@ -709,3 +709,6 @@ Please support me if you like this project! It will help me keep engaged to upda #### Druid 1.1.2 - [#310] Add data list matrix example (Grid 4 in row) - [Data List] Fix for data list element amounts issue + +#### Druid 1.1.3 +- Fix for node_id of cloned nodes with `gui.clone_tree`