godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
88.79k stars 20.13k forks source link

[Import] Child nodes get reparented when two objects have the same name without the import hint #94031

Open passivestar opened 2 months ago

passivestar commented 2 months ago

Tested versions

v4.3.beta.custom_build [f3af22b10] (master)

System information

Godot v4.3.beta (f3af22b10) - macOS 14.5.0 - Vulkan (Forward+) - integrated Apple M1 Max - Apple M1 Max (10 Threads)

Issue description

https://github.com/godotengine/godot/assets/60579014/aaea9510-b8bb-4261-b2af-babd96fe2a9f

This happens because godot only keeps the hint in the name when there's a conflict (as opposed to always keeping it). This can probably be solved by just always keeping hints in the names

cc @Hilderin

Steps to reproduce

  1. Create a cube in a blend file, call it Cube-col and export
  2. Add some child node to it in Godot with editable children
  3. Create another cube in blender, call it Cube and export
  4. The new cube steals the child of the old cube

Minimal reproduction project (MRP)

Can only be reproduced by following the steps

Hilderin commented 2 months ago

I looked into this issue and I don't see an easy way this fix that. Maybe a solution would be to add an option to keep the suffixes in the node name (ex: -col) but that would lead to another problem where modifying suffixes would lead to lose track of the parent of the added node causing a weird situation where the child lose it's parent. Also, in your example, you added a new cube over the first but if it was added under, all would be correct and I don't see how to distinguish these two situations.

Maybe if you explain me a bit more in which context in a real workflow that could happen a solution could be found.

passivestar commented 2 months ago

Maybe if you explain me a bit more in which context in a real workflow that could happen a solution could be found.

The real-world situation is:

Just to clarify this isn't a huge problem, it can be worked around. It's more of a QOL thing

So the problem is that while blender usually forces objects to have unique names by appending numbers it won't happen when objects' names have hints. Maybe you're right and there's nothing we can do on Godot side. Maybe Blender should have an option to enforce unique names without hints 🤔

Hilderin commented 2 months ago

Thanks for the details. I'll continue to think about it or maybe someone will have a brilliant idea.