diff --git a/src/script/node.cpp b/src/script/node.cpp index 39ed25ce..e2e6c1f9 100644 --- a/src/script/node.cpp +++ b/src/script/node.cpp @@ -372,6 +372,9 @@ Vector> OScriptNode::get_eligible_autowire_pins(const Ref& p_pin) { + if (p_pin.is_valid()) + p_pin->reset_default_value(); + emit_signal("pin_connected", p_pin->get_direction(), p_pin->get_pin_index()); } diff --git a/src/script/node_pin.cpp b/src/script/node_pin.cpp index e4782b53..abf5c47a 100644 --- a/src/script/node_pin.cpp +++ b/src/script/node_pin.cpp @@ -294,7 +294,10 @@ void OScriptNodePin::set_type(Variant::Type p_type) _property.type = p_type; if (_set_type_resets_default) - reset_default_value(); + { + _default_value = Variant(); + _generated_default_value = _target_class.is_empty() ? VariantUtils::make_default(_property.type) : Variant(); + } emit_changed(); } @@ -320,7 +323,10 @@ void OScriptNodePin::set_target_class(const StringName& p_target_class) _property.type = Variant::OBJECT; if (_set_type_resets_default) - reset_default_value(); + { + _default_value = Variant(); + _generated_default_value = _target_class.is_empty() ? VariantUtils::make_default(_property.type) : Variant(); + } emit_changed(); } @@ -351,8 +357,7 @@ void OScriptNodePin::set_default_value(const Variant& p_default_value) void OScriptNodePin::reset_default_value() { - _default_value = Variant(); - _generated_default_value = _target_class.is_empty() ? VariantUtils::make_default(_property.type) : Variant(); + set_default_value(_generated_default_value); } Variant OScriptNodePin::get_generated_default_value() const diff --git a/src/script/nodes/functions/call_function.cpp b/src/script/nodes/functions/call_function.cpp index 18b6dabd..332552eb 100644 --- a/src/script/nodes/functions/call_function.cpp +++ b/src/script/nodes/functions/call_function.cpp @@ -332,7 +332,10 @@ void OScriptNodeCallFunction::_create_pins_for_method(const MethodInfo& p_method } if (argument_index >= default_start_index) + { + pin->set_generated_default_value(p_method.default_arguments[default_index]); pin->set_default_value(p_method.default_arguments[default_index++]); + } } argument_index++; }