Skip to content

Add an option to check if a node is a direct parent of the current node

Andrii Doroshenko requested to merge github/fork/Xrayez/node-direct-parent into master

This PR adds ability to check whether the given node is an immediate child of a current node, filtering out indirect children.

Shouldn't break the existing API (added simple boolean with default value)

Possible use case:

func _ready():
	get_tree().connect("node_added", self, "_on_node_added")

func _on_node_added(node):
	if is_a_parent_of(node, true):
		# Only care about instanced scenes disregarding their children

Merge request reports