-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdebug_glb_bound.gd
More file actions
37 lines (31 loc) · 1.34 KB
/
Copy pathdebug_glb_bound.gd
File metadata and controls
37 lines (31 loc) · 1.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
## Debug: does append_from_scene export unowned (generated) children?
extends SceneTree
func _init() -> void:
call_deferred("_run")
func _run() -> void:
var recipe := SKRecipe.load_from_file("res://synty_assets/characters/Starter_01.sk")
var library := SKPartLibrary.new()
library.scan()
var character := SidekickCharacter.new()
character.name = "SidekickCharacter"
character.recipe_text = recipe.to_text()
character.build_on_load = false
root.add_child(character)
character.rebuild(library)
print("children: %d, meshes: %d" % [
character.get_child_count(),
character.find_children("*", "MeshInstance3D", true, false).size()])
var state := GLTFState.new()
var error := GLTFDocument.new().append_from_scene(character, state)
print("export live node (unowned children): %s nodes=%d meshes=%d" % [error_string(error), state.nodes.size(), state.meshes.size()])
# Same node but with owners assigned.
for child in character.get_children():
_own(child, character)
var state2 := GLTFState.new()
var error2 := GLTFDocument.new().append_from_scene(character, state2)
print("export live node (owned children): %s nodes=%d meshes=%d" % [error_string(error2), state2.nodes.size(), state2.meshes.size()])
quit(0)
func _own(node: Node, owner_node: Node) -> void:
node.owner = owner_node
for child in node.get_children():
_own(child, owner_node)