Skip to content

Commit

Permalink
Fix: Resetting BBVariant value sets it to NIL
Browse files Browse the repository at this point in the history
  • Loading branch information
limbonaut committed Nov 8, 2023
1 parent 6534645 commit 59b2f4a
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion blackboard/bb_param/bb_param.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include "core/object/class_db.h"
#include "core/object/object.h"
#include "core/variant/variant.h"
#include "core/variant/variant_utility.h"

VARIANT_ENUM_CAST(BBParam::ValueSource);

Expand All @@ -33,7 +34,13 @@ Variant BBParam::get_saved_value() {
}

void BBParam::set_saved_value(Variant p_value) {
saved_value = p_value;
if (p_value.get_type() == get_type()) {
saved_value = p_value;
} else if (p_value.get_type() == Variant::NIL) {
_assign_default_value();
} else {
saved_value = VariantUtilityFunctions::type_convert(p_value, get_type());
}
_update_name();
emit_changed();
}
Expand Down

0 comments on commit 59b2f4a

Please sign in to comment.