Port BBParam editor to GDExtension (#287)
This commit is contained in:
parent
8e3f37d46a
commit
1a192b6129
|
@ -0,0 +1,28 @@
|
|||
/**
|
||||
* forward_decl.h
|
||||
* =============================================================================
|
||||
* Copyright (c) 2023-present Serhii Snitsaruk and the LimboAI contributors.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style
|
||||
* license that can be found in the LICENSE file or at
|
||||
* https://opensource.org/licenses/MIT.
|
||||
* =============================================================================
|
||||
*/
|
||||
|
||||
#ifndef FORWARD_DECL_H
|
||||
#define FORWARD_DECL_H
|
||||
|
||||
// * It's necessary to enclose Godot forward declarations within the `godot`
|
||||
// * namespace in GDExtension.
|
||||
|
||||
#ifdef LIMBOAI_MODULE
|
||||
#define GODOT_FORWARD_DECLARATIONS()
|
||||
#define ENDOF_FORWARD_DECLARATIONS()
|
||||
#endif // ! LIMBOAI_MODULE
|
||||
|
||||
#ifdef LIMBOAI_GDEXTENSION
|
||||
#define GODOT_FORWARD_DECLARATIONS() namespace godot {
|
||||
#define ENDOF_FORWARD_DECLARATIONS() } //namespace godot
|
||||
#endif // ! LIMBOAI_GDEXTENSION
|
||||
|
||||
#endif // ! FORWARD_DECL_H
|
|
@ -11,37 +11,32 @@
|
|||
|
||||
#ifdef TOOLS_ENABLED
|
||||
|
||||
#ifdef LIMBOAI_MODULE
|
||||
|
||||
#include "editor_property_bb_param.h"
|
||||
|
||||
#include "../blackboard/bb_param/bb_param.h"
|
||||
#include "../blackboard/bb_param/bb_variant.h"
|
||||
#include "../util/limbo_string_names.h"
|
||||
#include "editor_property_variable_name.h"
|
||||
#include "mode_switch_button.h"
|
||||
|
||||
#include "core/error/error_macros.h"
|
||||
#include "core/io/marshalls.h"
|
||||
#include "core/object/class_db.h"
|
||||
#include "core/object/object.h"
|
||||
#include "core/object/ref_counted.h"
|
||||
#include "core/os/memory.h"
|
||||
#include "core/string/print_string.h"
|
||||
#include "core/variant/variant.h"
|
||||
#include "editor/editor_inspector.h"
|
||||
#include "editor/editor_properties.h"
|
||||
#include "editor/editor_properties_array_dict.h"
|
||||
#include "editor/editor_properties_vector.h"
|
||||
#include "editor/editor_settings.h"
|
||||
#include "scene/gui/base_button.h"
|
||||
#include "scene/gui/box_container.h"
|
||||
#include "scene/gui/button.h"
|
||||
#include "scene/gui/line_edit.h"
|
||||
#ifdef LIMBOAI_MODULE
|
||||
#include "editor/editor_interface.h"
|
||||
#include "scene/gui/margin_container.h"
|
||||
#include "scene/gui/menu_button.h"
|
||||
#endif // LIMBOAI_MODULE
|
||||
|
||||
#ifdef LIMBOAI_GDEXTENSION
|
||||
#include <godot_cpp/classes/editor_inspector.hpp>
|
||||
#include <godot_cpp/classes/editor_interface.hpp>
|
||||
#include <godot_cpp/classes/h_box_container.hpp>
|
||||
#include <godot_cpp/classes/margin_container.hpp>
|
||||
#include <godot_cpp/classes/menu_button.hpp>
|
||||
#include <godot_cpp/classes/popup_menu.hpp>
|
||||
#endif // LIMBOAI_GDEXTENSION
|
||||
|
||||
Ref<BBParam> EditorPropertyBBParam::_get_edited_param() {
|
||||
Ref<BBParam> param = get_edited_property_value();
|
||||
Ref<BBParam> param;
|
||||
if (get_edited_object()) {
|
||||
param = get_edited_object()->get(get_edited_property());
|
||||
}
|
||||
if (param.is_null()) {
|
||||
// Create parameter resource if null.
|
||||
param = ClassDB::instantiate(param_type);
|
||||
|
@ -50,159 +45,50 @@ Ref<BBParam> EditorPropertyBBParam::_get_edited_param() {
|
|||
return param;
|
||||
}
|
||||
|
||||
void EditorPropertyBBParam::_create_value_editor(Variant::Type p_type) {
|
||||
void EditorPropertyBBParam::_create_value_editor(Object *p_object, const String &p_property, Variant::Type p_type) {
|
||||
if (value_editor) {
|
||||
if (value_editor->get_meta(SNAME("_param_type")) == Variant(p_type)) {
|
||||
if (value_editor->get_meta(LW_NAME(_param_type)) == Variant(p_type)) {
|
||||
return;
|
||||
}
|
||||
_remove_value_editor();
|
||||
}
|
||||
|
||||
const String hint_text = p_type == Variant::OBJECT ? "Resource" : "";
|
||||
value_editor = EditorInterface::get_singleton()->get_inspector()->instantiate_property_editor(p_object, p_type, p_property, property_hint, hint_text, PROPERTY_USAGE_EDITOR);
|
||||
|
||||
bool is_bottom = false;
|
||||
|
||||
switch (p_type) {
|
||||
case Variant::NIL: {
|
||||
value_editor = memnew(EditorPropertyNil);
|
||||
} break;
|
||||
case Variant::BOOL: {
|
||||
value_editor = memnew(EditorPropertyCheck);
|
||||
} break;
|
||||
case Variant::INT: {
|
||||
EditorPropertyInteger *editor = memnew(EditorPropertyInteger);
|
||||
editor->setup(-100000, 100000, 1, false, true, true);
|
||||
value_editor = editor;
|
||||
} break;
|
||||
case Variant::FLOAT: {
|
||||
EditorPropertyFloat *editor = memnew(EditorPropertyFloat);
|
||||
editor->setup(-100000, 100000, EDITOR_GET("interface/inspector/default_float_step"), true, false, true, true);
|
||||
value_editor = editor;
|
||||
} break;
|
||||
case Variant::STRING: {
|
||||
if (property_hint == PROPERTY_HINT_MULTILINE_TEXT) {
|
||||
value_editor = memnew(EditorPropertyMultilineText);
|
||||
} else {
|
||||
value_editor = memnew(EditorPropertyText);
|
||||
}
|
||||
is_bottom = (property_hint == PROPERTY_HINT_MULTILINE_TEXT);
|
||||
} break;
|
||||
case Variant::VECTOR2: {
|
||||
EditorPropertyVector2 *editor = memnew(EditorPropertyVector2);
|
||||
editor->setup(-100000, 100000, EDITOR_GET("interface/inspector/default_float_step"), true);
|
||||
value_editor = editor;
|
||||
} break;
|
||||
case Variant::VECTOR2I: {
|
||||
EditorPropertyVector2i *editor = memnew(EditorPropertyVector2i);
|
||||
editor->setup(-100000, 100000);
|
||||
value_editor = editor;
|
||||
} break;
|
||||
case Variant::RECT2: {
|
||||
EditorPropertyRect2 *editor = memnew(EditorPropertyRect2);
|
||||
editor->setup(-100000, 100000, EDITOR_GET("interface/inspector/default_float_step"), true);
|
||||
value_editor = editor;
|
||||
is_bottom = true;
|
||||
} break;
|
||||
case Variant::RECT2I: {
|
||||
EditorPropertyRect2i *editor = memnew(EditorPropertyRect2i);
|
||||
editor->setup(-100000, 100000);
|
||||
value_editor = editor;
|
||||
is_bottom = true;
|
||||
} break;
|
||||
case Variant::VECTOR3: {
|
||||
EditorPropertyVector3 *editor = memnew(EditorPropertyVector3);
|
||||
editor->setup(-100000, 100000, EDITOR_GET("interface/inspector/default_float_step"), true);
|
||||
value_editor = editor;
|
||||
is_bottom = true;
|
||||
} break;
|
||||
case Variant::VECTOR3I: {
|
||||
EditorPropertyVector3i *editor = memnew(EditorPropertyVector3i);
|
||||
editor->setup(-100000, 100000);
|
||||
value_editor = editor;
|
||||
is_bottom = true;
|
||||
} break;
|
||||
case Variant::VECTOR4: {
|
||||
EditorPropertyVector4 *editor = memnew(EditorPropertyVector4);
|
||||
editor->setup(-100000, 100000, EDITOR_GET("interface/inspector/default_float_step"), true);
|
||||
value_editor = editor;
|
||||
is_bottom = true;
|
||||
} break;
|
||||
case Variant::VECTOR4I: {
|
||||
EditorPropertyVector4i *editor = memnew(EditorPropertyVector4i);
|
||||
editor->setup(-100000, 100000);
|
||||
value_editor = editor;
|
||||
is_bottom = true;
|
||||
} break;
|
||||
case Variant::TRANSFORM2D: {
|
||||
EditorPropertyTransform2D *editor = memnew(EditorPropertyTransform2D);
|
||||
editor->setup(-100000, 100000, EDITOR_GET("interface/inspector/default_float_step"), true);
|
||||
value_editor = editor;
|
||||
is_bottom = true;
|
||||
} break;
|
||||
case Variant::PLANE: {
|
||||
EditorPropertyPlane *editor = memnew(EditorPropertyPlane);
|
||||
editor->setup(-100000, 100000, EDITOR_GET("interface/inspector/default_float_step"), true);
|
||||
value_editor = editor;
|
||||
is_bottom = true;
|
||||
} break;
|
||||
case Variant::QUATERNION: {
|
||||
EditorPropertyQuaternion *editor = memnew(EditorPropertyQuaternion);
|
||||
editor->setup(-100000, 100000, EDITOR_GET("interface/inspector/default_float_step"), true);
|
||||
value_editor = editor;
|
||||
is_bottom = true;
|
||||
} break;
|
||||
case Variant::AABB: {
|
||||
EditorPropertyAABB *editor = memnew(EditorPropertyAABB);
|
||||
editor->setup(-100000, 100000, EDITOR_GET("interface/inspector/default_float_step"), true);
|
||||
value_editor = editor;
|
||||
is_bottom = true;
|
||||
} break;
|
||||
case Variant::BASIS: {
|
||||
EditorPropertyBasis *editor = memnew(EditorPropertyBasis);
|
||||
editor->setup(-100000, 100000, EDITOR_GET("interface/inspector/default_float_step"), true);
|
||||
value_editor = editor;
|
||||
is_bottom = true;
|
||||
} break;
|
||||
case Variant::TRANSFORM3D: {
|
||||
EditorPropertyTransform3D *editor = memnew(EditorPropertyTransform3D);
|
||||
editor->setup(-100000, 100000, EDITOR_GET("interface/inspector/default_float_step"), true);
|
||||
value_editor = editor;
|
||||
is_bottom = true;
|
||||
} break;
|
||||
case Variant::PROJECTION: {
|
||||
EditorPropertyProjection *editor = memnew(EditorPropertyProjection);
|
||||
editor->setup(-100000, 100000, EDITOR_GET("interface/inspector/default_float_step"), true);
|
||||
value_editor = editor;
|
||||
is_bottom = true;
|
||||
} break;
|
||||
case Variant::COLOR: {
|
||||
value_editor = memnew(EditorPropertyColor);
|
||||
} break;
|
||||
case Variant::STRING:
|
||||
case Variant::STRING_NAME: {
|
||||
EditorPropertyText *editor = memnew(EditorPropertyText);
|
||||
editor->set_string_name(true);
|
||||
value_editor = editor;
|
||||
is_bottom = (property_hint == PROPERTY_HINT_MULTILINE_TEXT);
|
||||
} break;
|
||||
case Variant::NODE_PATH: {
|
||||
value_editor = memnew(EditorPropertyNodePath);
|
||||
} break;
|
||||
// case Variant::RID: {
|
||||
// } break;
|
||||
// case Variant::SIGNAL: {
|
||||
// } break;
|
||||
// case Variant::CALLABLE: {
|
||||
// } break;
|
||||
case Variant::OBJECT: {
|
||||
// Only resources are supported.
|
||||
EditorPropertyResource *editor = memnew(EditorPropertyResource);
|
||||
editor->setup(_get_edited_param().ptr(), SNAME("saved_value"), "Resource");
|
||||
value_editor = editor;
|
||||
is_bottom = true;
|
||||
} break;
|
||||
case Variant::DICTIONARY: {
|
||||
value_editor = memnew(EditorPropertyDictionary);
|
||||
is_bottom = true;
|
||||
} break;
|
||||
|
||||
case Variant::NIL:
|
||||
case Variant::BOOL:
|
||||
case Variant::INT:
|
||||
case Variant::FLOAT:
|
||||
case Variant::VECTOR2:
|
||||
case Variant::VECTOR2I:
|
||||
case Variant::COLOR:
|
||||
case Variant::NODE_PATH: {
|
||||
is_bottom = false;
|
||||
} break;
|
||||
|
||||
case Variant::RECT2:
|
||||
case Variant::RECT2I:
|
||||
case Variant::VECTOR3:
|
||||
case Variant::VECTOR3I:
|
||||
case Variant::VECTOR4:
|
||||
case Variant::VECTOR4I:
|
||||
case Variant::TRANSFORM2D:
|
||||
case Variant::PLANE:
|
||||
case Variant::QUATERNION:
|
||||
case Variant::AABB:
|
||||
case Variant::BASIS:
|
||||
case Variant::TRANSFORM3D:
|
||||
case Variant::PROJECTION:
|
||||
case Variant::OBJECT:
|
||||
case Variant::DICTIONARY:
|
||||
case Variant::ARRAY:
|
||||
case Variant::PACKED_BYTE_ARRAY:
|
||||
case Variant::PACKED_INT32_ARRAY:
|
||||
|
@ -213,23 +99,20 @@ void EditorPropertyBBParam::_create_value_editor(Variant::Type p_type) {
|
|||
case Variant::PACKED_VECTOR2_ARRAY:
|
||||
case Variant::PACKED_VECTOR3_ARRAY:
|
||||
case Variant::PACKED_COLOR_ARRAY: {
|
||||
EditorPropertyArray *editor = memnew(EditorPropertyArray);
|
||||
editor->setup(p_type);
|
||||
value_editor = editor;
|
||||
is_bottom = true;
|
||||
} break;
|
||||
|
||||
default: {
|
||||
ERR_PRINT("Unexpected variant type!");
|
||||
value_editor = memnew(EditorPropertyNil);
|
||||
}
|
||||
}
|
||||
|
||||
value_editor->set_name_split_ratio(0.0);
|
||||
value_editor->set_use_folding(is_using_folding());
|
||||
value_editor->set_selectable(false);
|
||||
value_editor->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
value_editor->set_meta(SNAME("_param_type"), p_type);
|
||||
value_editor->connect(SNAME("property_changed"), callable_mp(this, &EditorPropertyBBParam::_value_edited));
|
||||
value_editor->set_meta(LW_NAME(_param_type), p_type);
|
||||
value_editor->connect(LW_NAME(property_changed), callable_mp(this, &EditorPropertyBBParam::_value_edited));
|
||||
if (is_bottom) {
|
||||
bottom_container->add_child(value_editor);
|
||||
set_bottom_editor(bottom_container);
|
||||
|
@ -272,7 +155,11 @@ void EditorPropertyBBParam::_variable_edited(const String &p_property, Variant p
|
|||
_get_edited_param()->set_variable(p_value);
|
||||
}
|
||||
|
||||
#ifdef LIMBOAI_MODULE
|
||||
void EditorPropertyBBParam::update_property() {
|
||||
#elif LIMBOAI_GDEXTENSION
|
||||
void EditorPropertyBBParam::_update_property() {
|
||||
#endif
|
||||
if (!initialized) {
|
||||
// Initialize UI -- needed after https://github.com/godotengine/godot/commit/db7175458a0532f1efe733f303ad2b55a02a52a5
|
||||
_notification(NOTIFICATION_THEME_CHANGED);
|
||||
|
@ -282,19 +169,20 @@ void EditorPropertyBBParam::update_property() {
|
|||
|
||||
if (param->get_value_source() == BBParam::BLACKBOARD_VAR) {
|
||||
_remove_value_editor();
|
||||
variable_editor->set_object_and_property(param.ptr(), SNAME("variable"));
|
||||
variable_editor->set_object_and_property(param.ptr(), LW_NAME(variable));
|
||||
variable_editor->setup(plan, false, param->get_variable_expected_type());
|
||||
variable_editor->update_property();
|
||||
variable_editor->show();
|
||||
bottom_container->hide();
|
||||
type_choice->set_button_icon(get_editor_theme_icon(SNAME("LimboExtraVariable")));
|
||||
type_choice->set_button_icon(LimboUtility::get_singleton()->get_task_icon(LW_NAME(LimboExtraVariable)));
|
||||
} else {
|
||||
_create_value_editor(param->get_type());
|
||||
// _create_value_editor(param->get_type());
|
||||
_create_value_editor(param.ptr(), LW_NAME(saved_value), param->get_type());
|
||||
variable_editor->hide();
|
||||
value_editor->show();
|
||||
value_editor->set_object_and_property(param.ptr(), SNAME("saved_value"));
|
||||
value_editor->set_object_and_property(param.ptr(), LW_NAME(saved_value));
|
||||
value_editor->update_property();
|
||||
type_choice->set_button_icon(get_editor_theme_icon(Variant::get_type_name(param->get_type())));
|
||||
type_choice->set_button_icon(get_theme_icon(Variant::get_type_name(param->get_type()), LW_NAME(EditorIcons)));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -316,27 +204,27 @@ void EditorPropertyBBParam::_notification(int p_what) {
|
|||
|
||||
{
|
||||
String type = Variant::get_type_name(_get_edited_param()->get_type());
|
||||
type_choice->set_button_icon(get_editor_theme_icon(type));
|
||||
type_choice->set_button_icon(get_theme_icon(type, LW_NAME(EditorIcons)));
|
||||
}
|
||||
|
||||
// Initialize type choice.
|
||||
PopupMenu *type_menu = type_choice->get_popup();
|
||||
type_menu->clear();
|
||||
type_menu->add_icon_item(get_editor_theme_icon(SNAME("LimboExtraVariable")), TTR("Blackboard Variable"), ID_BIND_VAR);
|
||||
type_menu->add_icon_item(LimboUtility::get_singleton()->get_task_icon(LW_NAME(LimboExtraVariable)), TTR("Blackboard Variable"), ID_BIND_VAR);
|
||||
type_menu->add_separator();
|
||||
Ref<BBParam> param = _get_edited_param();
|
||||
bool is_variant_param = param->is_class_ptr(BBVariant::get_class_ptr_static());
|
||||
bool is_variant_param = IS_CLASS(param, BBVariant);
|
||||
if (is_variant_param) {
|
||||
for (int i = 0; i < Variant::VARIANT_MAX; i++) {
|
||||
if (i == Variant::RID || i == Variant::CALLABLE || i == Variant::SIGNAL) {
|
||||
continue;
|
||||
}
|
||||
String type = Variant::get_type_name(Variant::Type(i));
|
||||
type_menu->add_icon_item(get_editor_theme_icon(type), type, i);
|
||||
type_menu->add_icon_item(get_theme_icon(type, LW_NAME(EditorIcons)), type, i);
|
||||
}
|
||||
} else { // Not a variant param.
|
||||
String type = Variant::get_type_name(param->get_type());
|
||||
type_menu->add_icon_item(get_editor_theme_icon(type), type, param->get_type());
|
||||
type_menu->add_icon_item(get_theme_icon(type, LW_NAME(EditorIcons)), type, param->get_type());
|
||||
}
|
||||
|
||||
initialized = true;
|
||||
|
@ -367,18 +255,26 @@ EditorPropertyBBParam::EditorPropertyBBParam() {
|
|||
variable_editor = memnew(EditorPropertyVariableName);
|
||||
editor_hbox->add_child(variable_editor);
|
||||
variable_editor->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
variable_editor->connect(SNAME("property_changed"), callable_mp(this, &EditorPropertyBBParam::_variable_edited));
|
||||
variable_editor->connect(LW_NAME(property_changed), callable_mp(this, &EditorPropertyBBParam::_variable_edited));
|
||||
|
||||
param_type = SNAME("BBString");
|
||||
param_type = LW_NAME(BBString);
|
||||
}
|
||||
|
||||
//***** EditorInspectorPluginBBParam
|
||||
|
||||
#ifdef LIMBOAI_MODULE
|
||||
bool EditorInspectorPluginBBParam::can_handle(Object *p_object) {
|
||||
#elif LIMBOAI_GDEXTENSION
|
||||
bool EditorInspectorPluginBBParam::_can_handle(Object *p_object) const {
|
||||
#endif
|
||||
return true; // Handles everything.
|
||||
}
|
||||
|
||||
#ifdef LIMBOAI_MODULE
|
||||
bool EditorInspectorPluginBBParam::parse_property(Object *p_object, const Variant::Type p_type, const String &p_path, const PropertyHint p_hint, const String &p_hint_text, const BitField<PropertyUsageFlags> p_usage, const bool p_wide) {
|
||||
#elif LIMBOAI_GDEXTENSION
|
||||
bool EditorInspectorPluginBBParam::_parse_property(Object *p_object, const Variant::Type p_type, const String &p_path, const PropertyHint p_hint, const String &p_hint_text, const BitField<PropertyUsageFlags> p_usage, const bool p_wide) {
|
||||
#endif
|
||||
if (p_hint == PROPERTY_HINT_RESOURCE_TYPE && p_hint_text.begins_with("BB")) {
|
||||
// TODO: Add more rigid hint check.
|
||||
EditorPropertyBBParam *editor = memnew(EditorPropertyBBParam());
|
||||
|
@ -389,6 +285,4 @@ bool EditorInspectorPluginBBParam::parse_property(Object *p_object, const Varian
|
|||
return false;
|
||||
}
|
||||
|
||||
#endif // ! LIMBOAI_MODULE
|
||||
|
||||
#endif // ! TOOLS_ENABLED
|
||||
|
|
|
@ -14,19 +14,26 @@
|
|||
#ifndef EDITOR_PROPERTY_BB_PARAM_H
|
||||
#define EDITOR_PROPERTY_BB_PARAM_H
|
||||
|
||||
#include "../compat/forward_decl.h"
|
||||
|
||||
#ifdef LIMBOAI_MODULE
|
||||
|
||||
#include "editor/editor_inspector.h"
|
||||
#endif // ! LIMBOAI_MODULE
|
||||
|
||||
#include "../blackboard/bb_param/bb_param.h"
|
||||
#include "../blackboard/blackboard_plan.h"
|
||||
#include "mode_switch_button.h"
|
||||
|
||||
#include "scene/gui/box_container.h"
|
||||
#include "scene/gui/margin_container.h"
|
||||
#include "scene/gui/menu_button.h"
|
||||
#ifdef LIMBOAI_GDEXTENSION
|
||||
#include <godot_cpp/classes/editor_inspector_plugin.hpp>
|
||||
#include <godot_cpp/classes/editor_property.hpp>
|
||||
using namespace godot;
|
||||
#endif // ! LIMBOAI_GDEXTENSION
|
||||
|
||||
class EditorPropertyVariableName;
|
||||
class BBParam;
|
||||
class BlackboardPlan;
|
||||
GODOT_FORWARD_DECLARATIONS()
|
||||
class MarginContainer;
|
||||
class MenuButton;
|
||||
class HBoxContainer;
|
||||
ENDOF_FORWARD_DECLARATIONS()
|
||||
|
||||
class EditorPropertyBBParam : public EditorProperty {
|
||||
GDCLASS(EditorPropertyBBParam, EditorProperty);
|
||||
|
@ -49,7 +56,7 @@ private:
|
|||
|
||||
Ref<BBParam> _get_edited_param();
|
||||
|
||||
void _create_value_editor(Variant::Type p_type);
|
||||
void _create_value_editor(Object *p_object, const String &p_property, Variant::Type p_type);
|
||||
void _remove_value_editor();
|
||||
|
||||
void _value_edited(const String &p_property, Variant p_value, const String &p_name = "", bool p_changing = false);
|
||||
|
@ -57,10 +64,16 @@ private:
|
|||
void _type_selected(int p_index);
|
||||
|
||||
protected:
|
||||
static void _bind_methods() {}
|
||||
|
||||
void _notification(int p_what);
|
||||
|
||||
public:
|
||||
#ifdef LIMBOAI_MODULE
|
||||
virtual void update_property() override;
|
||||
#elif LIMBOAI_GDEXTENSION
|
||||
virtual void _update_property() override;
|
||||
#endif
|
||||
void setup(PropertyHint p_hint, const String &p_hint_text, const Ref<BlackboardPlan> &p_plan);
|
||||
|
||||
EditorPropertyBBParam();
|
||||
|
@ -72,15 +85,21 @@ class EditorInspectorPluginBBParam : public EditorInspectorPlugin {
|
|||
private:
|
||||
Callable plan_getter;
|
||||
|
||||
protected:
|
||||
static void _bind_methods() {}
|
||||
|
||||
public:
|
||||
#ifdef LIMBOAI_MODULE
|
||||
virtual bool can_handle(Object *p_object) override;
|
||||
virtual bool parse_property(Object *p_object, const Variant::Type p_type, const String &p_path, const PropertyHint p_hint, const String &p_hint_text, const BitField<PropertyUsageFlags> p_usage, const bool p_wide = false) override;
|
||||
#elif LIMBOAI_GDEXTENSION
|
||||
virtual bool _can_handle(Object *p_object) const override;
|
||||
virtual bool _parse_property(Object *p_object, const Variant::Type p_type, const String &p_path, const PropertyHint p_hint, const String &p_hint_text, const BitField<PropertyUsageFlags> p_usage, const bool p_wide = false) override;
|
||||
#endif
|
||||
|
||||
void set_plan_getter(const Callable &p_getter) { plan_getter = p_getter; }
|
||||
};
|
||||
|
||||
#endif // ! LIMBOAI_MODULE
|
||||
|
||||
#endif // ! EDITOR_PROPERTY_BB_PARAM_H
|
||||
|
||||
#endif // ! TOOLS_ENABLED
|
||||
|
|
|
@ -1938,12 +1938,10 @@ void LimboAIEditorPlugin::_notification(int p_notification) {
|
|||
|
||||
EditorInspectorPluginPropertyPath *path_plugin = memnew(EditorInspectorPluginPropertyPath);
|
||||
add_inspector_plugin(path_plugin);
|
||||
#ifdef LIMBOAI_MODULE
|
||||
// ! Only used in the module version.
|
||||
|
||||
EditorInspectorPluginBBParam *param_plugin = memnew(EditorInspectorPluginBBParam);
|
||||
param_plugin->set_plan_getter(Callable(limbo_ai_editor, "get_edited_blackboard_plan"));
|
||||
add_inspector_plugin(param_plugin);
|
||||
#endif // LIMBOAI_MODULE
|
||||
} break;
|
||||
case NOTIFICATION_ENTER_TREE: {
|
||||
// Add BehaviorTree to the list of resources that should open in a new inspector.
|
||||
|
|
|
@ -100,6 +100,7 @@
|
|||
#include "editor/debugger/behavior_tree_data.h"
|
||||
#include "editor/debugger/limbo_debugger.h"
|
||||
#include "editor/debugger/limbo_debugger_plugin.h"
|
||||
#include "editor/editor_property_bb_param.h"
|
||||
#include "editor/mode_switch_button.h"
|
||||
#include "editor/tree_search.h"
|
||||
#include "hsm/limbo_hsm.h"
|
||||
|
@ -268,6 +269,8 @@ void initialize_limboai_module(ModuleInitializationLevel p_level) {
|
|||
GDREGISTER_INTERNAL_CLASS(EditorPropertyPropertyPath);
|
||||
GDREGISTER_INTERNAL_CLASS(EditorPropertyVariableName);
|
||||
GDREGISTER_INTERNAL_CLASS(EditorInspectorPluginVariableName);
|
||||
GDREGISTER_INTERNAL_CLASS(EditorPropertyBBParam);
|
||||
GDREGISTER_INTERNAL_CLASS(EditorInspectorPluginBBParam);
|
||||
GDREGISTER_INTERNAL_CLASS(OwnerPicker);
|
||||
GDREGISTER_INTERNAL_CLASS(LimboAIEditor);
|
||||
GDREGISTER_INTERNAL_CLASS(LimboAIEditorPlugin);
|
||||
|
|
|
@ -28,6 +28,7 @@ LimboStringNames *LimboStringNames::singleton = nullptr;
|
|||
|
||||
LimboStringNames::LimboStringNames() {
|
||||
_generate_name = SN("_generate_name");
|
||||
_param_type = SN("_param_type");
|
||||
_replace_task = SN("_replace_task");
|
||||
_update_task_tree = SN("_update_task_tree");
|
||||
_weight_ = SN("_weight_");
|
||||
|
@ -41,12 +42,14 @@ LimboStringNames::LimboStringNames() {
|
|||
add_child_at_index = SN("add_child_at_index");
|
||||
AnimationFilter = SN("AnimationFilter");
|
||||
BBParam = SN("BBParam");
|
||||
BBString = SN("BBString");
|
||||
behavior_tree_finished = SN("behavior_tree_finished");
|
||||
bold = SN("bold");
|
||||
button_down = SN("button_down");
|
||||
button_up = SN("button_up");
|
||||
call_deferred = SN("call_deferred");
|
||||
changed = SN("changed");
|
||||
class_icon_size = SN("class_icon_size");
|
||||
Clear = SN("Clear");
|
||||
Close = SN("Close");
|
||||
dark_color_2 = SN("dark_color_2");
|
||||
|
@ -83,15 +86,15 @@ LimboStringNames::LimboStringNames() {
|
|||
GuiTabMenuHl = SN("GuiTabMenuHl");
|
||||
GuiTreeArrowDown = SN("GuiTreeArrowDown");
|
||||
GuiTreeArrowRight = SN("GuiTreeArrowRight");
|
||||
h_separation = SN("h_separation");
|
||||
HeaderSmall = SN("HeaderSmall");
|
||||
Help = SN("Help");
|
||||
h_separation = SN("h_separation");
|
||||
icon_max_width = SN("icon_max_width");
|
||||
class_icon_size = SN("class_icon_size");
|
||||
id_pressed = SN("id_pressed");
|
||||
Info = SN("Info");
|
||||
item_collapsed = SN("item_collapsed");
|
||||
item_selected = SN("item_selected");
|
||||
LimboExtraVariable = SN("LimboExtraVariable");
|
||||
LimboVarAdd = SN("LimboVarAdd");
|
||||
LimboVarEmpty = SN("LimboVarEmpty");
|
||||
LimboVarError = SN("LimboVarError");
|
||||
|
@ -116,6 +119,7 @@ LimboStringNames::LimboStringNames() {
|
|||
popup_hide = SN("popup_hide");
|
||||
pressed = SN("pressed");
|
||||
probability_clicked = SN("probability_clicked");
|
||||
property_changed = SN("property_changed");
|
||||
Reload = SN("Reload");
|
||||
Remove = SN("Remove");
|
||||
remove_child = SN("remove_child");
|
||||
|
@ -123,14 +127,15 @@ LimboStringNames::LimboStringNames() {
|
|||
request_open_in_screen = SN("request_open_in_screen");
|
||||
rmb_pressed = SN("rmb_pressed");
|
||||
Save = SN("Save");
|
||||
saved_value = SN("saved_value");
|
||||
Script = SN("Script");
|
||||
ScriptCreate = SN("ScriptCreate");
|
||||
Search = SN("Search");
|
||||
separation = SN("separation");
|
||||
set_custom_name = SN("set_custom_name");
|
||||
set_root_task = SN("set_root_task");
|
||||
set_visible = SN("set_visible");
|
||||
set_v_scroll = SN("set_v_scroll");
|
||||
set_visible = SN("set_visible");
|
||||
setup = SN("setup");
|
||||
started = SN("started");
|
||||
StatusWarning = SN("StatusWarning");
|
||||
|
@ -138,9 +143,9 @@ LimboStringNames::LimboStringNames() {
|
|||
task_activated = SN("task_activated");
|
||||
task_button_pressed = SN("task_button_pressed");
|
||||
task_button_rmb = SN("task_button_rmb");
|
||||
tasks_dragged = SN("tasks_dragged");
|
||||
task_meta = SN("task_meta");
|
||||
task_selected = SN("task_selected");
|
||||
tasks_dragged = SN("tasks_dragged");
|
||||
text_changed = SN("text_changed");
|
||||
text_submitted = SN("text_submitted");
|
||||
timeout = SN("timeout");
|
||||
|
@ -150,6 +155,7 @@ LimboStringNames::LimboStringNames() {
|
|||
TripleBar = SN("TripleBar");
|
||||
update_mode = SN("update_mode");
|
||||
updated = SN("updated");
|
||||
variable = SN("variable");
|
||||
visibility_changed = SN("visibility_changed");
|
||||
window_visibility_changed = SN("window_visibility_changed");
|
||||
|
||||
|
|
|
@ -44,6 +44,7 @@ public:
|
|||
_FORCE_INLINE_ static LimboStringNames *get_singleton() { return singleton; }
|
||||
|
||||
StringName _generate_name;
|
||||
StringName _param_type;
|
||||
StringName _replace_task;
|
||||
StringName _update_task_tree;
|
||||
StringName _weight_;
|
||||
|
@ -57,12 +58,14 @@ public:
|
|||
StringName Add;
|
||||
StringName AnimationFilter;
|
||||
StringName BBParam;
|
||||
StringName BBString;
|
||||
StringName behavior_tree_finished;
|
||||
StringName bold;
|
||||
StringName button_down;
|
||||
StringName button_up;
|
||||
StringName call_deferred;
|
||||
StringName changed;
|
||||
StringName class_icon_size;
|
||||
StringName Clear;
|
||||
StringName Close;
|
||||
StringName dark_color_2;
|
||||
|
@ -88,8 +91,8 @@ public:
|
|||
StringName favorite_tasks_changed;
|
||||
StringName Favorites;
|
||||
StringName FlatButton;
|
||||
StringName Focus;
|
||||
StringName focus_exited;
|
||||
StringName Focus;
|
||||
StringName font_color;
|
||||
StringName font_size;
|
||||
StringName font;
|
||||
|
@ -99,15 +102,15 @@ public:
|
|||
StringName GuiTabMenuHl;
|
||||
StringName GuiTreeArrowDown;
|
||||
StringName GuiTreeArrowRight;
|
||||
StringName h_separation;
|
||||
StringName HeaderSmall;
|
||||
StringName Help;
|
||||
StringName h_separation;
|
||||
StringName icon_max_width;
|
||||
StringName class_icon_size;
|
||||
StringName id_pressed;
|
||||
StringName Info;
|
||||
StringName item_collapsed;
|
||||
StringName item_selected;
|
||||
StringName LimboExtraVariable;
|
||||
StringName LimboVarAdd;
|
||||
StringName LimboVarEmpty;
|
||||
StringName LimboVarError;
|
||||
|
@ -132,6 +135,7 @@ public:
|
|||
StringName popup_hide;
|
||||
StringName pressed;
|
||||
StringName probability_clicked;
|
||||
StringName property_changed;
|
||||
StringName Reload;
|
||||
StringName remove_child;
|
||||
StringName Remove;
|
||||
|
@ -139,14 +143,15 @@ public:
|
|||
StringName request_open_in_screen;
|
||||
StringName rmb_pressed;
|
||||
StringName Save;
|
||||
StringName saved_value;
|
||||
StringName Script;
|
||||
StringName ScriptCreate;
|
||||
StringName Search;
|
||||
StringName separation;
|
||||
StringName set_custom_name;
|
||||
StringName set_root_task;
|
||||
StringName set_visible;
|
||||
StringName set_v_scroll;
|
||||
StringName set_visible;
|
||||
StringName setup;
|
||||
StringName started;
|
||||
StringName StatusWarning;
|
||||
|
@ -154,9 +159,9 @@ public:
|
|||
StringName task_activated;
|
||||
StringName task_button_pressed;
|
||||
StringName task_button_rmb;
|
||||
StringName tasks_dragged;
|
||||
StringName task_meta;
|
||||
StringName task_selected;
|
||||
StringName tasks_dragged;
|
||||
StringName text_changed;
|
||||
StringName text_submitted;
|
||||
StringName timeout;
|
||||
|
@ -166,6 +171,7 @@ public:
|
|||
StringName TripleBar;
|
||||
StringName update_mode;
|
||||
StringName updated;
|
||||
StringName variable;
|
||||
StringName visibility_changed;
|
||||
StringName window_visibility_changed;
|
||||
|
||||
|
|
Loading…
Reference in New Issue