Repository: godotengine/godot
File: scene/property_utils.cpp (C++)

Code before:
}

Variant PropertyUtils::get_property_default_value(const Object *p_object, const StringName &p_property, bool *r_is_valid, const Vector<SceneState::PackState> *p_states_stack_cache, bool p_update_exports, const Node *p_owner, bool *r_is_class_default) {
	// This function obeys the way property values are set when an object is instantiated,
	// which is the following (the latter wins):
	// 1. Default value from builtin class
	// 2. Default value from script exported variable (from the topmost script)
	// 3. Value overrides from the instantiation/inheritance stack

	if (r_is_class_default) {
		*r_is_class_default = false;
	}
	if (r_is_valid) {
		*r_is_valid = false;
	}

	Ref<Script> topmost_script;

	if (const Node *node = Object::cast_to<Node>(p_object)) {
		// Check inheritance/instantiation ancestors
		const Vector<SceneState::PackState> &states_stack = p_states_stack_cache ? *p_states_stack_cache : PropertyUtils::get_node_states_stack(node, p_owner);
		for (int i = 0; i < states_stack.size(); ++i) {
			const SceneState::PackState &ia = states_stack[i];
			bool found = false;
			Variant value_in_ancestor = ia.state->get_property_value(ia.node, p_property, found);
			if (found) {
				if (r_is_valid) {
					*r_is_valid = true;
				}
				return value_in_ancestor;
			}
			// Save script for later
			bool has_script = false;
			Variant script = ia.state->get_property_value(ia.node, SNAME("script"), has_script);
			if (has_script) {
				Ref<Script> scr = script;
				if (scr.is_valid()) {
					topmost_script = scr;
				}
			}
		}
	}

	// Let's see what default is set by the topmost script having a default, if any
	if (topmost_script.is_null()) {
		topmost_script = p_object->get_script();
	}
	if (topmost_script.is_valid()) {
		// Should be called in the editor only and not at runtime,
		// otherwise it can cause problems because of missing instance state support
		if (p_update_exports && Engine::get_singleton()->is_editor_hint()) {

Review comment (suggestion):
```suggestion
			const Vector<String> &deferred_properties = ia.state->get_node_deferred_nodepath_properties(ia.node);
```

Code after:
}

Variant PropertyUtils::get_property_default_value(const Object *p_object, const StringName &p_property, bool *r_is_valid, const Vector<SceneState::PackState> *p_states_stack_cache, bool p_update_exports, const Node *p_owner, bool *r_is_class_default) {
	// This function obeys the way property values are set when an object is instantiated,
	// which is the following (the latter wins):
	// 1. Default value from builtin class
	// 2. Default value from script exported variable (from the topmost script)
	// 3. Value overrides from the instantiation/inheritance stack

	if (r_is_class_default) {
		*r_is_class_default = false;
	}
	if (r_is_valid) {
		*r_is_valid = false;
	}

	Ref<Script> topmost_script;

	if (const Node *node = Object::cast_to<Node>(p_object)) {
		// Check inheritance/instantiation ancestors
		const Vector<SceneState::PackState> &states_stack = p_states_stack_cache ? *p_states_stack_cache : PropertyUtils::get_node_states_stack(node, p_owner);
		for (int i = 0; i < states_stack.size(); ++i) {
			const SceneState::PackState &ia = states_stack[i];
			bool found = false;
			Variant value_in_ancestor = ia.state->get_property_value(ia.node, p_property, found);
			const Vector<String> &deferred_properties = ia.state->get_node_deferred_nodepath_properties(ia.node);
			if (found) {
				if (r_is_valid) {
					*r_is_valid = true;
				}
				// Replace properties stored as NodePaths with actual Nodes.
				// Otherwise, the property value would be considered as overridden.
				if (deferred_properties.has(p_property)) {
					if (value_in_ancestor.get_type() == Variant::ARRAY) {
						Array paths = value_in_ancestor;

						bool valid = false;
						Array array = node->get(p_property, &valid);
						ERR_CONTINUE(!valid);
						array = array.duplicate();

						array.resize(paths.size());
						for (int j = 0; j < array.size(); j++) {
							array.set(j, node->get_node_or_null(paths[j]));
						}
						value_in_ancestor = array;
					} else {
						value_in_ancestor = node->get_node_or_null(value_in_ancestor);
					}
				}
				return value_in_ancestor;