Fix: BB params convert to "Wrapped..."
This commit is contained in:
parent
966199e8dc
commit
5b475b3273
|
@ -59,17 +59,20 @@ void BBParam::set_variable(const String &p_value) {
|
||||||
|
|
||||||
#ifdef LIMBOAI_MODULE
|
#ifdef LIMBOAI_MODULE
|
||||||
String BBParam::to_string() {
|
String BBParam::to_string() {
|
||||||
|
#else // LIMBOAI_GDEXTENSION
|
||||||
|
String BBParam::_to_string() {
|
||||||
|
#endif // LIMBOAI_MODULE
|
||||||
if (value_source == SAVED_VALUE) {
|
if (value_source == SAVED_VALUE) {
|
||||||
String s = saved_value.stringify();
|
String s = saved_value.stringify();
|
||||||
switch (get_type()) {
|
switch (get_type()) {
|
||||||
case Variant::STRING: {
|
case Variant::STRING: {
|
||||||
s = s.c_escape().quote();
|
s = "\"" + s.c_escape() + "\"";
|
||||||
} break;
|
} break;
|
||||||
case Variant::STRING_NAME: {
|
case Variant::STRING_NAME: {
|
||||||
s = "&" + s.c_escape().quote();
|
s = "&\"" + s.c_escape() + "\"";
|
||||||
} break;
|
} break;
|
||||||
case Variant::NODE_PATH: {
|
case Variant::NODE_PATH: {
|
||||||
s = "^" + s.c_escape().quote();
|
s = "^\"" + s.c_escape() + "\"";
|
||||||
} break;
|
} break;
|
||||||
default: {
|
default: {
|
||||||
} break;
|
} break;
|
||||||
|
@ -79,7 +82,6 @@ String BBParam::to_string() {
|
||||||
return LimboUtility::get_singleton()->decorate_var(variable);
|
return LimboUtility::get_singleton()->decorate_var(variable);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif // LIMBOAI_MODULE
|
|
||||||
|
|
||||||
Variant BBParam::get_value(Object *p_agent, const Ref<Blackboard> &p_blackboard, const Variant &p_default) {
|
Variant BBParam::get_value(Object *p_agent, const Ref<Blackboard> &p_blackboard, const Variant &p_default) {
|
||||||
ERR_FAIL_COND_V(!p_blackboard.is_valid(), p_default);
|
ERR_FAIL_COND_V(!p_blackboard.is_valid(), p_default);
|
||||||
|
@ -109,6 +111,7 @@ void BBParam::_bind_methods() {
|
||||||
ClassDB::bind_method(D_METHOD("get_variable"), &BBParam::get_variable);
|
ClassDB::bind_method(D_METHOD("get_variable"), &BBParam::get_variable);
|
||||||
ClassDB::bind_method(D_METHOD("get_type"), &BBParam::get_type);
|
ClassDB::bind_method(D_METHOD("get_type"), &BBParam::get_type);
|
||||||
ClassDB::bind_method(D_METHOD("get_value", "p_agent", "p_blackboard", "p_default"), &BBParam::get_value, Variant());
|
ClassDB::bind_method(D_METHOD("get_value", "p_agent", "p_blackboard", "p_default"), &BBParam::get_value, Variant());
|
||||||
|
ClassDB::bind_method(D_METHOD("_to_string"), &BBParam::_to_string);
|
||||||
|
|
||||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "value_source", PROPERTY_HINT_ENUM, "Saved Value,Blackboard Var"), "set_value_source", "get_value_source");
|
ADD_PROPERTY(PropertyInfo(Variant::INT, "value_source", PROPERTY_HINT_ENUM, "Saved Value,Blackboard Var"), "set_value_source", "get_value_source");
|
||||||
ADD_PROPERTY(PropertyInfo(Variant::STRING, "variable", PROPERTY_HINT_NONE, "", 0), "set_variable", "get_variable");
|
ADD_PROPERTY(PropertyInfo(Variant::STRING, "variable", PROPERTY_HINT_NONE, "", 0), "set_variable", "get_variable");
|
||||||
|
|
|
@ -79,6 +79,8 @@ public:
|
||||||
|
|
||||||
#ifdef LIMBOAI_MODULE
|
#ifdef LIMBOAI_MODULE
|
||||||
virtual String to_string() override;
|
virtual String to_string() override;
|
||||||
|
#else // LIMBOAI_GDEXTENSION
|
||||||
|
virtual String _to_string();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
virtual Variant get_value(Object *p_agent, const Ref<Blackboard> &p_blackboard, const Variant &p_default = Variant());
|
virtual Variant get_value(Object *p_agent, const Ref<Blackboard> &p_blackboard, const Variant &p_default = Variant());
|
||||||
|
|
Loading…
Reference in New Issue