Bugfix/template loader naming collision - #137
Open
YuanQI295 wants to merge 6 commits into
Open
Conversation
Tilix4
suggested changes
Jul 15, 2026
Contributor
There was a problem hiding this comment.
The submodule shouldn't be committed.
| var templatePath = args[0]; | ||
| var overrideName = args[1] || ""; | ||
| var parentBackdropName = args[2] || null; | ||
| var existingNames = args[3] || []; |
Contributor
There was a problem hiding this comment.
This is strange, existing names better be collected on the JS side. Or the whole function should be refactored in order to deal with correct name on the python side and passed as overrideName.
@kalisp do you have a preference?
Member
There was a problem hiding this comment.
I think we were adding numeric suffixes in JS, weren't we? So probably JS to match.
| // count -1 to match imported nodes which start from _1 | ||
| mainBackdropName = mainBackdropName + "_" + (count - 1); | ||
| var mainBackdropName; | ||
| if (usedNumbers.indexOf(0) === -1) { |
Contributor
There was a problem hiding this comment.
I think this would be faster, 0 will either be at index 0:
Suggested change
| if (usedNumbers.indexOf(0) === -1) { | |
| if (usedNumbers[0] === 0) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changelog Description
Updating or switching multiple containers of the same template could assign a duplicate backdrop name, causing containers to lose track of each other or silently overwrite one another's data.
Additional review information
The name resolution logic now checks which names are actually in use in the scene, correctly filling gaps (e.g. Main, Main_1, Main_3 → next is Main_2) and avoiding collisions.
Testing notes
Loaded multiple same-template containers.
Switch containers to another version or update to last.