Fix default values not being read correctly in VS, take two
Fixes #25889.
(cherry picked from commit b291cfde1b
)
This commit is contained in:
parent
3afd8a374d
commit
2b9c754d1d
|
@ -45,15 +45,7 @@ bool VisualScriptNode::is_breakpoint() const {
|
||||||
return breakpoint;
|
return breakpoint;
|
||||||
}
|
}
|
||||||
|
|
||||||
void VisualScriptNode::_notification(int p_what) {
|
|
||||||
|
|
||||||
if (p_what == NOTIFICATION_POSTINITIALIZE) {
|
|
||||||
validate_input_default_values();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void VisualScriptNode::ports_changed_notify() {
|
void VisualScriptNode::ports_changed_notify() {
|
||||||
validate_input_default_values();
|
|
||||||
emit_signal("ports_changed");
|
emit_signal("ports_changed");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -272,11 +264,7 @@ void VisualScript::_node_ports_changed(int p_id) {
|
||||||
Function &func = functions[function];
|
Function &func = functions[function];
|
||||||
Ref<VisualScriptNode> vsn = func.nodes[p_id].node;
|
Ref<VisualScriptNode> vsn = func.nodes[p_id].node;
|
||||||
|
|
||||||
if (OS::get_singleton()->get_main_loop() &&
|
vsn->validate_input_default_values();
|
||||||
Object::cast_to<SceneTree>(OS::get_singleton()->get_main_loop()) &&
|
|
||||||
Engine::get_singleton()->is_editor_hint()) {
|
|
||||||
vsn->validate_input_default_values(); //force validate default values when editing on editor
|
|
||||||
}
|
|
||||||
|
|
||||||
//must revalidate all the functions
|
//must revalidate all the functions
|
||||||
|
|
||||||
|
@ -352,6 +340,7 @@ void VisualScript::add_node(const StringName &p_func, int p_id, const Ref<Visual
|
||||||
Ref<VisualScriptNode> vsn = p_node;
|
Ref<VisualScriptNode> vsn = p_node;
|
||||||
vsn->connect("ports_changed", this, "_node_ports_changed", varray(p_id));
|
vsn->connect("ports_changed", this, "_node_ports_changed", varray(p_id));
|
||||||
vsn->scripts_used.insert(this);
|
vsn->scripts_used.insert(this);
|
||||||
|
vsn->validate_input_default_values(); // Validate when fully loaded
|
||||||
|
|
||||||
func.nodes[p_id] = nd;
|
func.nodes[p_id] = nd;
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,7 +54,6 @@ class VisualScriptNode : public Resource {
|
||||||
void validate_input_default_values();
|
void validate_input_default_values();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void _notification(int p_what);
|
|
||||||
void ports_changed_notify();
|
void ports_changed_notify();
|
||||||
static void _bind_methods();
|
static void _bind_methods();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue