glTF import: use literal node names instead of filename-prefixed variant names - #3
Open
NilssonCreative with Copilot wants to merge 7 commits into
Open
glTF import: use literal node names instead of filename-prefixed variant names#3NilssonCreative with Copilot wants to merge 7 commits into
NilssonCreative with Copilot wants to merge 7 commits into
Conversation
… documentation Agent-Logs-Url: https://github.com/NilssonCreative/kaiju/sessions/a011bfcb-340f-4e3f-8618-693b43149107 Co-authored-by: NilssonCreative <9530207+NilssonCreative@users.noreply.github.com>
…des as stage entities Agent-Logs-Url: https://github.com/NilssonCreative/kaiju/sessions/219520b9-7fea-42aa-9d50-244ac8995454 Co-authored-by: NilssonCreative <9530207+NilssonCreative@users.noreply.github.com>
Agent-Logs-Url: https://github.com/NilssonCreative/kaiju/sessions/f16919c6-d422-4065-939f-84fd6ee17c3b Co-authored-by: NilssonCreative <9530207+NilssonCreative@users.noreply.github.com>
…on import Agent-Logs-Url: https://github.com/NilssonCreative/kaiju/sessions/6fb32cac-467f-446a-8bc1-63bcdb8e7a61 Co-authored-by: NilssonCreative <9530207+NilssonCreative@users.noreply.github.com>
Agent-Logs-Url: https://github.com/NilssonCreative/kaiju/sessions/035a5d23-a936-45ec-84f2-1dbae5520827 Co-authored-by: NilssonCreative <9530207+NilssonCreative@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Improve glTF loader for Blender Empties support
glTF import: use literal node names instead of filename-prefixed variant names
Apr 29, 2026
NilssonCreative
marked this pull request as ready for review
April 29, 2026 09:55
Owner
|
@copilot resolve the merge conflicts in this pull request. |
Co-authored-by: NilssonCreative <9530207+NilssonCreative@users.noreply.github.com>
Author
Merge conflicts resolved in commit |
NilssonCreative
approved these changes
Apr 29, 2026
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.
Imported glTF content items were named
{filename}-{nodeName}(e.g.car-WheelHub_FL), cluttering the Content Browser and making it harder to reference assets by their Blender-authored names.Changes
content_database_mesh.go: RemovebaseNameprefix fromImportVariant.Namefor both mesh nodes and empty nodes — variants now use the literal name from the glTF (e.g.WheelHub_FLinstead ofcar-WheelHub_FL). The template file itself retains the filename as its name.The same change applies to the empty-node loop.
nodeVariantsandvariantToContentIdmappings in the scene template builder are unaffected since they key off the variant name consistently.The orange plain-axes gizmo for Empties (
SpawnEmptyGizmo) was already wired up in bothstage_spawner.go(drag-from-browser) andeditor_stage_manager.go(stage load) — the naming fix ensures those paths are reached.Original prompt
Improve glTF loader and importer support for Blender Empties in
NilssonCreative/Kaiju.The goal is to ensure that Blender Empties are imported with their original names (no filename prefixing) and are visually represented in the Kaiju editor as orange plain axes gizmos, matching the Blender experience.
Key tasks:
src/editor/project/project_database/content_database/content_database_mesh.go:baseNameprefix when creatingImportVariantnames for both meshes and empties. Use the literal node/mesh name from the glTF file.nodeVariantsmapping uses these literal names.src/editor/editor_workspace/stage_workspace/stage_spawner.gocorrectly identifies empty variants (wherekm.IsEmptyis true) and callseditor_stage_manager.SpawnEmptyGizmoto provide the visual representation in the viewport.content_database_mesh.go(meshBuildSceneTemplate) uses the new literal naming scheme to correctly link entities to their imported content items.src/editor/editor_stage_manager/empty_gizmo.gois correctly registered and visible when an Empty is spawned or loaded into a stage.The user explicitly requested: 'Importing the gltf should import all content and not use a specific naming scheme.' and 'Make sure that there is some visual representation of the Empties in the editor, like in blender.'
The following is the prior conversation context from the user's chat exploration (may be truncated):
User: I had Copilot add support for blender Empties exported in gltf in a new branch on GitHub.com/NilssonCreative/Kaiju yesterday.
The importing succeeds but i can only see meshes and materials in the editor.
I have no idea how to access the empty-nodes from the editor or code in my project.
Assistant: The support for Blender Empties was added in the
copilot/improve-gltf-loader-empties-supportbranch. Based on the changes, here is how you can access the empty nodes in both the editor and your code.1. In the Editor
The loader now treats Empties as a special type of "Mesh" variant.
AABB) for picking..gltfor.glb, a separate content item is created for each Empty, named{FileName}-{EmptyName}.2. In Code
The
load_result.Resulthas been updated with several helpers to make working with Empties easy.Getting all Empties or a specific one
Handling Nested Hierarchies (World Space)
If your Empties are nested inside other nodes in Blender, their
Positionfield only contains the local transform relative to the parent. To get the actual world-space position (to attach a Kaiju Entity, for example), use the newNodeWorldTransformhelper:Accessing Blender Custom Properties
If you added Custom Properties in Blender's "Object Properties" tab, they are automatically mapped to the
Attributesfield:Summary of Key API Changes:
load_result.Node: Now has anIsEmpty boolflag and aChildren []int32slice.load_result.Result:Empties() []*Node: Returns all nodes marked as empties.NodeWorldTransform(index) (Vec3, Quaternion, Vec3): Computes the inherited transform.stages.EmptyMeshId: A sentinel string ("ed_empty") used to identify empties in the engine's stage format.User: The Empties doesn't show up in Kaiju editor after importing the gltf containing a body mesh and four wheel-hub-empties.
Assistant: The issue likely stems from how the `Import...
This pull request was created from Copilot chat.