diff --git a/blackboard/blackboard_plan.cpp b/blackboard/blackboard_plan.cpp index 2a9723c..e617160 100644 --- a/blackboard/blackboard_plan.cpp +++ b/blackboard/blackboard_plan.cpp @@ -13,6 +13,16 @@ #include "../util/limbo_utility.h" +#ifdef LIMBOAI_MODULE +#include "editor/editor_inspector.h" +#include "editor/editor_interface.h" +#elif LIMBOAI_GDEXTENSION +#include +#include +#include +#include +#endif + bool BlackboardPlan::_set(const StringName &p_name, const Variant &p_value) { String name_str = p_name; @@ -107,9 +117,22 @@ bool BlackboardPlan::_get(const StringName &p_name, Variant &r_ret) const { r_ret = "Mapped to " + LimboUtility::get_singleton()->decorate_var(parent_scope_mapping[p_name]); } else if (has_property_binding(p_name)) { const NodePath &binding = property_bindings[p_name]; - String path_str = (String)binding.get_name(binding.get_name_count() - 1) + - ":" + (String)binding.get_concatenated_subnames(); - r_ret = "Bound to " + path_str; + + Node *edited_node = Object::cast_to(EditorInterface::get_singleton()->get_inspector()->get_edited_object()); + if (!edited_node) { + edited_node = SCENE_TREE()->get_edited_scene_root(); + } + Node *bound_node = edited_node->get_node_or_null(binding); + + String shortened_path; + if (bound_node) { + shortened_path = (String)bound_node->get_name() + + ":" + (String)binding.get_concatenated_subnames(); + } else { + shortened_path = (String)binding.get_name(binding.get_name_count() - 1) + + ":" + (String)binding.get_concatenated_subnames(); + } + r_ret = String::utf8("🔗 ") + shortened_path; } else { r_ret = var_map[p_name].get_value(); } diff --git a/editor/editor_property_property_path.cpp b/editor/editor_property_property_path.cpp index e2e2239..cc31f55 100644 --- a/editor/editor_property_property_path.cpp +++ b/editor/editor_property_property_path.cpp @@ -13,7 +13,6 @@ #include "../util/limbo_compat.h" #include "../util/limbo_string_names.h" -#include "core/variant/variant.h" #ifdef LIMBOAI_MODULE #include "editor/editor_data.h" @@ -135,8 +134,16 @@ void EditorPropertyPropertyPath::_update_property() { if (path.is_empty()) { assign_button->set_text(TTR("Bind...")); } else { - String text = (String)path.get_name(path.get_name_count() - 1) + - ":" + (String)path.get_concatenated_subnames(); + Node *base_node = _get_base_node(get_edited_object(), get_tree()); + ERR_FAIL_NULL(base_node); + Node *selected_node = base_node->get_node_or_null(path); + String text; + if (selected_node) { + text = (String)selected_node->get_name() + + ":" + (String)path.get_concatenated_subnames(); + } else { + text = (String)path; + } assign_button->set_text(text); assign_button->set_tooltip_text(path); } @@ -211,9 +218,9 @@ bool EditorInspectorPluginPropertyPath::_parse_property(Object *p_object, const EditorPropertyPropertyPath *ed = memnew(EditorPropertyPropertyPath); PackedInt32Array valid_types; - Vector type_specifiers = p_hint_text.split(","); + PackedStringArray type_specifiers = p_hint_text.split(","); for (const String &t : type_specifiers) { - if (t.is_numeric()) { + if (t.is_valid_int()) { valid_types.append(t.to_int()); } } diff --git a/editor/editor_property_property_path.h b/editor/editor_property_property_path.h index 2172511..a05ebef 100644 --- a/editor/editor_property_property_path.h +++ b/editor/editor_property_property_path.h @@ -12,7 +12,6 @@ #ifndef EDITOR_PROPERTY_PROPERTY_PATH #define EDITOR_PROPERTY_PROPERTY_PATH -#include "core/variant/variant.h" #ifdef TOOLS_ENABLED #ifdef LIMBOAI_MODULE