Skip to content

Bugfix/template loader naming collision - #137

Open
YuanQI295 wants to merge 6 commits into
ynput:developfrom
YuanQI295:fix/template-loader-naming-collision
Open

Bugfix/template loader naming collision#137
YuanQI295 wants to merge 6 commits into
ynput:developfrom
YuanQI295:fix/template-loader-naming-collision

Conversation

@YuanQI295

Copy link
Copy Markdown
Contributor

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.

@YuanQI295 YuanQI295 changed the title Fix/template loader naming collision Bugfix/template loader naming collision Jul 15, 2026
@kalisp kalisp self-assigned this Jul 15, 2026
Comment thread client/ayon_harmony/vendor/OpenHarmony Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The submodule shouldn't be committed.

var templatePath = args[0];
var overrideName = args[1] || "";
var parentBackdropName = args[2] || null;
var existingNames = args[3] || [];

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this would be faster, 0 will either be at index 0:

Suggested change
if (usedNumbers.indexOf(0) === -1) {
if (usedNumbers[0] === 0) {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants