Well then there’s something i’m missing, because it doesn’t work for me.
I’m on godot 4.4.1 and on blender 4.4.0.
I run this
func _post_import(scene:Node)->Node:
# Get the root node's name for processing.
var root_node: String = scene.name
print(scene.get_meta_list())
# Get the scipt
if get_source_file().contains("gltf"):
var gltf: GLTFDocument = GLTFDocument.new()
var gltf_state: GLTFState = GLTFState.new()
gltf.append_from_file(get_source_file(),gltf_state)
if gltf_state.copyright.contains("uid") or gltf_state.copyright.contains("res"):
scene.set_script(load(gltf_state.copyright))
# Call initialisation function to process each node in the scene.
initialisation(scene)
return scene
## Recursively processes each node in the scene to apply changes based on 'extras' data.[br]
func initialisation(node:Node)->void:
print("node")
print(node.get_meta_list())
if node == null:
return
for child in node.get_children():
initialisation(child)
This get me the “extras” of the object without any problem but for the collection i get nothing.
To avoid this problem because i wanted to attach scripts to the imported gltf i had to use the copyright section as a container for a script path.