Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions scripts/scene_library.gd
Original file line number Diff line number Diff line change
Expand Up @@ -1036,6 +1036,7 @@ func _create_thumb(item: Dictionary[StringName, Variant], callback: Callable) ->
return callback.call()

var instance: Node = packed_scene.instantiate()
_disable_node_processing(instance)

_viewport.call_deferred(&"add_child", instance)
await instance.ready
Expand Down Expand Up @@ -1068,6 +1069,12 @@ func _create_thumb(item: Dictionary[StringName, Variant], callback: Callable) ->

callback.call()

func _disable_node_processing(node: Node) -> void:
node.set_process_mode(Node.PROCESS_MODE_DISABLED)

for child in node.get_children():
_disable_node_processing(child)
Comment on lines +1073 to +1076
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the forced assignment of PROCESS_MODE_INHERIT is better, since if it is already assigned, then nothing will happen(c++ code under the hood of the engine).

Also, the get_children method is quite expensive (at least my old tests showed it).

Suggested change
node.set_process_mode(Node.PROCESS_MODE_DISABLED)
for child in node.get_children():
_disable_node_processing(child)
node.set_process_mode(Node.PROCESS_MODE_INHERIT)
for i: int in node.get_child_count(true):
_disable_node_processing(node.get_child(i))


func _thread_process() -> void:
var semaphore := Semaphore.new()

Expand Down