summaryrefslogtreecommitdiff
path: root/modules/visual_script
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2019-05-28 10:54:49 +0200
committerGitHub <noreply@github.com>2019-05-28 10:54:49 +0200
commite3735a5d5a13a7d9cf3c0c9731594427db149614 (patch)
treee5ff72d7849034756a598b363cacb6467e922383 /modules/visual_script
parent06da7bf6b90f6361d7ae42e5dcfaa49ee2b67040 (diff)
parentb291cfde1b595f236b33f7770ec68042d534051a (diff)
Merge pull request #28606 from bojidar-bg/25889-indexed-set-defaults
Fix default values not being read correctly in VS, take two
Diffstat (limited to 'modules/visual_script')
-rw-r--r--modules/visual_script/visual_script.cpp15
-rw-r--r--modules/visual_script/visual_script.h1
2 files changed, 2 insertions, 14 deletions
diff --git a/modules/visual_script/visual_script.cpp b/modules/visual_script/visual_script.cpp
index 8f311d11f4..85fc867901 100644
--- a/modules/visual_script/visual_script.cpp
+++ b/modules/visual_script/visual_script.cpp
@@ -46,15 +46,7 @@ bool VisualScriptNode::is_breakpoint() const {
return breakpoint;
}
-void VisualScriptNode::_notification(int p_what) {
-
- if (p_what == NOTIFICATION_POSTINITIALIZE) {
- validate_input_default_values();
- }
-}
-
void VisualScriptNode::ports_changed_notify() {
- validate_input_default_values();
emit_signal("ports_changed");
}
@@ -273,11 +265,7 @@ void VisualScript::_node_ports_changed(int p_id) {
Function &func = functions[function];
Ref<VisualScriptNode> vsn = func.nodes[p_id].node;
- if (OS::get_singleton()->get_main_loop() &&
- 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
- }
+ vsn->validate_input_default_values();
//must revalidate all the functions
@@ -353,6 +341,7 @@ void VisualScript::add_node(const StringName &p_func, int p_id, const Ref<Visual
Ref<VisualScriptNode> vsn = p_node;
vsn->connect("ports_changed", this, "_node_ports_changed", varray(p_id));
vsn->scripts_used.insert(this);
+ vsn->validate_input_default_values(); // Validate when fully loaded
func.nodes[p_id] = nd;
}
diff --git a/modules/visual_script/visual_script.h b/modules/visual_script/visual_script.h
index 91748d077b..89f32f54f7 100644
--- a/modules/visual_script/visual_script.h
+++ b/modules/visual_script/visual_script.h
@@ -54,7 +54,6 @@ class VisualScriptNode : public Resource {
void validate_input_default_values();
protected:
- void _notification(int p_what);
void ports_changed_notify();
static void _bind_methods();