From ee0795269d13bc50f07c24f1ab4260fa93844b73 Mon Sep 17 00:00:00 2001 From: Serhii Snitsaruk Date: Mon, 29 Jan 2024 10:16:24 +0100 Subject: [PATCH] Editor: Fix issues with property editors & remove old docs --- .../blackboard_parameters/test_bb_params.gd | 6 +++-- doc/source/classes/class_bbfloat.rst | 23 ------------------- doc/source/classes/class_bbintarray.rst | 23 ------------------- editor/editor_property_bb_param.cpp | 5 ++-- editor/editor_property_variable_name.cpp | 2 ++ editor/limbo_ai_editor_plugin.cpp | 9 +++++--- 6 files changed, 15 insertions(+), 53 deletions(-) delete mode 100644 doc/source/classes/class_bbfloat.rst delete mode 100644 doc/source/classes/class_bbintarray.rst diff --git a/demo/demo/tests/blackboard_parameters/test_bb_params.gd b/demo/demo/tests/blackboard_parameters/test_bb_params.gd index 459fe5b..0d05361 100644 --- a/demo/demo/tests/blackboard_parameters/test_bb_params.gd +++ b/demo/demo/tests/blackboard_parameters/test_bb_params.gd @@ -27,8 +27,10 @@ extends Resource @export var dictionary_param: BBDictionary @export var array_param: BBArray @export var byte_array_param: BBByteArray -@export var int_array_param: BBIntArray -@export var float_array_param: BBFloatArray +@export var int32_array_param: BBInt32Array +@export var int64_array_param: BBInt64Array +@export var float32_array_param: BBFloat32Array +@export var float64_array_param: BBFloat64Array @export var string_array_param: BBStringArray @export var vector2_array_param: BBVector2Array @export var vector3_array_param: BBVector2Array diff --git a/doc/source/classes/class_bbfloat.rst b/doc/source/classes/class_bbfloat.rst deleted file mode 100644 index 078ff0d..0000000 --- a/doc/source/classes/class_bbfloat.rst +++ /dev/null @@ -1,23 +0,0 @@ -:github_url: hide - -.. DO NOT EDIT THIS FILE!!! -.. Generated automatically from Godot engine sources. -.. Generator: https://github.com/godotengine/godot/tree/4.2/doc/tools/make_rst.py. -.. XML source: https://github.com/godotengine/godot/tree/4.2/modules/limboai/doc_classes/BBFloat.xml. - -.. _class_BBFloat: - -BBFloat -======= - -**Inherits:** :ref:`BBParam` - -Float-type parameter for :ref:`BehaviorTree` tasks. See :ref:`BBParam`. - -.. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)` -.. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)` -.. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)` -.. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)` -.. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)` -.. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)` -.. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)` diff --git a/doc/source/classes/class_bbintarray.rst b/doc/source/classes/class_bbintarray.rst deleted file mode 100644 index 6bdc4de..0000000 --- a/doc/source/classes/class_bbintarray.rst +++ /dev/null @@ -1,23 +0,0 @@ -:github_url: hide - -.. DO NOT EDIT THIS FILE!!! -.. Generated automatically from Godot engine sources. -.. Generator: https://github.com/godotengine/godot/tree/4.2/doc/tools/make_rst.py. -.. XML source: https://github.com/godotengine/godot/tree/4.2/modules/limboai/doc_classes/BBIntArray.xml. - -.. _class_BBIntArray: - -BBIntArray -========== - -**Inherits:** :ref:`BBParam` - -IntArray-type parameter for :ref:`BehaviorTree` tasks. See :ref:`BBParam`. - -.. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)` -.. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)` -.. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)` -.. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)` -.. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)` -.. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)` -.. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)` diff --git a/editor/editor_property_bb_param.cpp b/editor/editor_property_bb_param.cpp index 5c2cdbf..19c18c9 100644 --- a/editor/editor_property_bb_param.cpp +++ b/editor/editor_property_bb_param.cpp @@ -280,6 +280,7 @@ void EditorPropertyBBParam::update_property() { variable_editor->show(); mode_button->call_deferred(SNAME("set_mode"), Mode::BIND_VAR, true); type_choice->hide(); + bottom_container->hide(); } else { _create_value_editor(param->get_type()); variable_editor->hide(); @@ -316,8 +317,8 @@ void EditorPropertyBBParam::_notification(int p_what) { // Initialize mode button. mode_button->clear(); mode_button->add_mode(Mode::SPECIFY_VALUE, get_editor_theme_icon(SNAME("LimboSpecifyValue")), TTR("Mode: Specify value.\nClick to switch mode.")); - mode_button->add_mode(Mode::BIND_VAR, get_editor_theme_icon(SNAME("BTSetVar")), TTR("Mode: Bind blackboard variable.\nClick to switch mode.")); - mode_button->set_mode(_get_edited_param()->get_value_source() == BBParam::BLACKBOARD_VAR ? Mode::BIND_VAR : Mode::SPECIFY_VALUE); + mode_button->add_mode(Mode::BIND_VAR, get_editor_theme_icon(SNAME("BTSetVar")), TTR("Mode: Use blackboard variable.\nClick to switch mode.")); + mode_button->set_mode(_get_edited_param()->get_value_source() == BBParam::BLACKBOARD_VAR ? Mode::BIND_VAR : Mode::SPECIFY_VALUE, true); bool is_variant_param = _get_edited_param()->is_class_ptr(BBVariant::get_class_ptr_static()); if (is_variant_param) { diff --git a/editor/editor_property_variable_name.cpp b/editor/editor_property_variable_name.cpp index 13cba3e..8e67a0e 100644 --- a/editor/editor_property_variable_name.cpp +++ b/editor/editor_property_variable_name.cpp @@ -66,6 +66,8 @@ void EditorPropertyVariableName::_variable_selected(int p_id) { } void EditorPropertyVariableName::_update_status() { + status_btn->set_visible(plan.is_valid()); + drop_btn->set_visible(plan.is_valid()); if (plan.is_null()) { return; } diff --git a/editor/limbo_ai_editor_plugin.cpp b/editor/limbo_ai_editor_plugin.cpp index 1c7b64c..e68626f 100644 --- a/editor/limbo_ai_editor_plugin.cpp +++ b/editor/limbo_ai_editor_plugin.cpp @@ -256,10 +256,13 @@ void LimboAIEditor::edit_bt(Ref p_behavior_tree, bool p_force_refr } Ref LimboAIEditor::get_edited_blackboard_plan() { - if (task_tree->get_bt().is_valid()) { - return task_tree->get_bt()->get_blackboard_plan(); + if (task_tree->get_bt().is_null()) { + return nullptr; } - return nullptr; + if (task_tree->get_bt()->get_blackboard_plan().is_null()) { + task_tree->get_bt()->set_blackboard_plan(memnew(BlackboardPlan)); + } + return task_tree->get_bt()->get_blackboard_plan(); } void LimboAIEditor::_mark_as_dirty(bool p_dirty) {