Hello, I'm trying to add rigid bodies to meshes imported from a glb file I've exported from Blender 3.
Here's my script at this point.
tool
extends EditorScenePostImport
func post_import(scene):
print(scene.get_children().size())
iterate(scene, scene.get_owner())
print(scene.get_children().size())
return scene
func iterate(node, owner):
if node != null:
for child in node.get_children():
var test = Spatial.new()
test.name = "test_" + child.name
// tried to set the owner of test here to the owner variable
// test.set_owner(owner)
node.add_child(test)
Based on the children size of the scene
these nodes are getting added, however, no matter what I try I cannot get them to show up in the resulting scene. When I tried to re-parent the child
nodes to the test
node and parent that test
node to the top most node
all the meshes disappeared.
For test
's owner, I've tried to set it as the owner
variable/the scene
argument, the child
variable, and owner.get_tree().edited_scene_root
as well as some other strange combinations.
My guess is that this isn't working due to the context that EditorScenePostImport
works within, but at this point I'm just grasping at straws. Does anyone know how I can get these nodes to appear in the final result of the import?