2023-07-21 09:50:06 +00:00
|
|
|
/**
|
|
|
|
* register_types.cpp
|
|
|
|
* =============================================================================
|
2024-01-19 16:05:01 +00:00
|
|
|
* Copyright 2021-2024 Serhii Snitsaruk
|
2023-07-21 09:50:06 +00:00
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
* =============================================================================
|
|
|
|
*/
|
2022-08-28 10:54:34 +00:00
|
|
|
|
|
|
|
#include "register_types.h"
|
|
|
|
|
2023-07-20 16:35:36 +00:00
|
|
|
#include "blackboard/bb_param/bb_aabb.h"
|
|
|
|
#include "blackboard/bb_param/bb_array.h"
|
|
|
|
#include "blackboard/bb_param/bb_basis.h"
|
|
|
|
#include "blackboard/bb_param/bb_bool.h"
|
|
|
|
#include "blackboard/bb_param/bb_byte_array.h"
|
|
|
|
#include "blackboard/bb_param/bb_color.h"
|
|
|
|
#include "blackboard/bb_param/bb_color_array.h"
|
|
|
|
#include "blackboard/bb_param/bb_dictionary.h"
|
|
|
|
#include "blackboard/bb_param/bb_float.h"
|
2024-01-19 16:05:01 +00:00
|
|
|
#include "blackboard/bb_param/bb_float32_array.h"
|
|
|
|
#include "blackboard/bb_param/bb_float64_array.h"
|
2023-07-20 16:35:36 +00:00
|
|
|
#include "blackboard/bb_param/bb_int.h"
|
2024-01-19 16:05:01 +00:00
|
|
|
#include "blackboard/bb_param/bb_int32_array.h"
|
|
|
|
#include "blackboard/bb_param/bb_int64_array.h"
|
2023-07-20 16:35:36 +00:00
|
|
|
#include "blackboard/bb_param/bb_node.h"
|
|
|
|
#include "blackboard/bb_param/bb_param.h"
|
|
|
|
#include "blackboard/bb_param/bb_plane.h"
|
2024-01-19 16:05:01 +00:00
|
|
|
#include "blackboard/bb_param/bb_projection.h"
|
2023-07-20 16:35:36 +00:00
|
|
|
#include "blackboard/bb_param/bb_quaternion.h"
|
|
|
|
#include "blackboard/bb_param/bb_rect2.h"
|
|
|
|
#include "blackboard/bb_param/bb_rect2i.h"
|
|
|
|
#include "blackboard/bb_param/bb_string.h"
|
|
|
|
#include "blackboard/bb_param/bb_string_array.h"
|
|
|
|
#include "blackboard/bb_param/bb_string_name.h"
|
|
|
|
#include "blackboard/bb_param/bb_transform2d.h"
|
|
|
|
#include "blackboard/bb_param/bb_transform3d.h"
|
|
|
|
#include "blackboard/bb_param/bb_variant.h"
|
|
|
|
#include "blackboard/bb_param/bb_vector2.h"
|
|
|
|
#include "blackboard/bb_param/bb_vector2_array.h"
|
|
|
|
#include "blackboard/bb_param/bb_vector2i.h"
|
|
|
|
#include "blackboard/bb_param/bb_vector3.h"
|
|
|
|
#include "blackboard/bb_param/bb_vector3_array.h"
|
|
|
|
#include "blackboard/bb_param/bb_vector3i.h"
|
|
|
|
#include "blackboard/bb_param/bb_vector4.h"
|
|
|
|
#include "blackboard/bb_param/bb_vector4i.h"
|
|
|
|
#include "blackboard/blackboard.h"
|
2024-01-23 19:02:23 +00:00
|
|
|
#include "blackboard/blackboard_plan.h"
|
2022-08-30 16:48:49 +00:00
|
|
|
#include "bt/behavior_tree.h"
|
|
|
|
#include "bt/bt_player.h"
|
2022-10-19 18:54:21 +00:00
|
|
|
#include "bt/bt_state.h"
|
2023-08-28 11:22:23 +00:00
|
|
|
#include "bt/tasks/blackboard/bt_check_trigger.h"
|
|
|
|
#include "bt/tasks/blackboard/bt_check_var.h"
|
|
|
|
#include "bt/tasks/blackboard/bt_set_var.h"
|
2023-08-15 15:49:13 +00:00
|
|
|
#include "bt/tasks/bt_action.h"
|
2023-08-18 19:38:28 +00:00
|
|
|
#include "bt/tasks/bt_comment.h"
|
2023-08-15 15:49:13 +00:00
|
|
|
#include "bt/tasks/bt_composite.h"
|
|
|
|
#include "bt/tasks/bt_condition.h"
|
|
|
|
#include "bt/tasks/bt_decorator.h"
|
|
|
|
#include "bt/tasks/bt_task.h"
|
|
|
|
#include "bt/tasks/composites/bt_dynamic_selector.h"
|
|
|
|
#include "bt/tasks/composites/bt_dynamic_sequence.h"
|
|
|
|
#include "bt/tasks/composites/bt_parallel.h"
|
2023-09-23 18:29:17 +00:00
|
|
|
#include "bt/tasks/composites/bt_probability_selector.h"
|
2023-08-15 15:49:13 +00:00
|
|
|
#include "bt/tasks/composites/bt_random_selector.h"
|
|
|
|
#include "bt/tasks/composites/bt_random_sequence.h"
|
|
|
|
#include "bt/tasks/composites/bt_selector.h"
|
|
|
|
#include "bt/tasks/composites/bt_sequence.h"
|
|
|
|
#include "bt/tasks/decorators/bt_always_fail.h"
|
|
|
|
#include "bt/tasks/decorators/bt_always_succeed.h"
|
|
|
|
#include "bt/tasks/decorators/bt_cooldown.h"
|
|
|
|
#include "bt/tasks/decorators/bt_delay.h"
|
|
|
|
#include "bt/tasks/decorators/bt_for_each.h"
|
|
|
|
#include "bt/tasks/decorators/bt_invert.h"
|
|
|
|
#include "bt/tasks/decorators/bt_new_scope.h"
|
|
|
|
#include "bt/tasks/decorators/bt_probability.h"
|
|
|
|
#include "bt/tasks/decorators/bt_repeat.h"
|
|
|
|
#include "bt/tasks/decorators/bt_repeat_until_failure.h"
|
|
|
|
#include "bt/tasks/decorators/bt_repeat_until_success.h"
|
|
|
|
#include "bt/tasks/decorators/bt_run_limit.h"
|
|
|
|
#include "bt/tasks/decorators/bt_subtree.h"
|
|
|
|
#include "bt/tasks/decorators/bt_time_limit.h"
|
2023-08-28 11:22:23 +00:00
|
|
|
#include "bt/tasks/scene/bt_await_animation.h"
|
|
|
|
#include "bt/tasks/scene/bt_check_agent_property.h"
|
|
|
|
#include "bt/tasks/scene/bt_pause_animation.h"
|
|
|
|
#include "bt/tasks/scene/bt_play_animation.h"
|
|
|
|
#include "bt/tasks/scene/bt_set_agent_property.h"
|
|
|
|
#include "bt/tasks/scene/bt_stop_animation.h"
|
2023-09-20 08:40:16 +00:00
|
|
|
#include "bt/tasks/utility/bt_call_method.h"
|
2023-08-28 11:22:23 +00:00
|
|
|
#include "bt/tasks/utility/bt_console_print.h"
|
|
|
|
#include "bt/tasks/utility/bt_fail.h"
|
|
|
|
#include "bt/tasks/utility/bt_random_wait.h"
|
|
|
|
#include "bt/tasks/utility/bt_wait.h"
|
|
|
|
#include "bt/tasks/utility/bt_wait_ticks.h"
|
2024-01-09 12:34:24 +00:00
|
|
|
#include "editor/action_banner.h"
|
2024-01-25 16:59:38 +00:00
|
|
|
#include "editor/blackboard_plan_editor.h"
|
2024-01-09 12:34:24 +00:00
|
|
|
#include "editor/debugger/behavior_tree_data.h"
|
2023-07-20 16:35:36 +00:00
|
|
|
#include "editor/debugger/limbo_debugger.h"
|
2024-01-09 20:47:22 +00:00
|
|
|
#include "editor/debugger/limbo_debugger_plugin.h"
|
2024-01-09 12:34:24 +00:00
|
|
|
#include "editor/mode_switch_button.h"
|
2023-07-20 16:35:36 +00:00
|
|
|
#include "hsm/limbo_hsm.h"
|
|
|
|
#include "hsm/limbo_state.h"
|
|
|
|
#include "util/limbo_string_names.h"
|
2023-08-25 15:32:46 +00:00
|
|
|
#include "util/limbo_task_db.h"
|
2023-07-20 16:35:36 +00:00
|
|
|
#include "util/limbo_utility.h"
|
2022-08-28 10:54:34 +00:00
|
|
|
|
2022-09-01 22:20:37 +00:00
|
|
|
#ifdef TOOLS_ENABLED
|
2023-08-01 19:19:10 +00:00
|
|
|
#include "editor/debugger/behavior_tree_view.h"
|
2022-09-01 22:20:37 +00:00
|
|
|
#include "editor/limbo_ai_editor_plugin.h"
|
2024-01-13 16:10:42 +00:00
|
|
|
#endif // TOOLS_ENABLED
|
2024-01-09 12:34:24 +00:00
|
|
|
|
|
|
|
#ifdef LIMBOAI_MODULE
|
2023-07-20 16:35:36 +00:00
|
|
|
#include "core/object/class_db.h"
|
|
|
|
#include "core/os/memory.h"
|
|
|
|
#include "core/string/print_string.h"
|
2024-01-13 16:10:42 +00:00
|
|
|
#endif // LIMBOAI_MODULE
|
2024-01-09 12:34:24 +00:00
|
|
|
|
|
|
|
#ifdef LIMBOAI_GDEXTENSION
|
|
|
|
#include <godot_cpp/classes/engine.hpp>
|
|
|
|
#include <godot_cpp/core/class_db.hpp>
|
|
|
|
#include <godot_cpp/core/memory.hpp>
|
|
|
|
using namespace godot;
|
2024-01-13 16:10:42 +00:00
|
|
|
#endif // LIMBOAI_GDEXTENSION
|
2024-01-09 12:34:24 +00:00
|
|
|
|
2022-09-21 21:56:04 +00:00
|
|
|
static LimboUtility *_limbo_utility = nullptr;
|
|
|
|
|
2022-12-15 07:26:52 +00:00
|
|
|
void initialize_limboai_module(ModuleInitializationLevel p_level) {
|
|
|
|
if (p_level == MODULE_INITIALIZATION_LEVEL_SCENE) {
|
2024-01-09 12:34:24 +00:00
|
|
|
#ifdef LIMBOAI_GDEXTENSION
|
|
|
|
GDREGISTER_CLASS(LimboDebugger);
|
|
|
|
#endif
|
2023-04-13 07:29:45 +00:00
|
|
|
LimboDebugger::initialize();
|
|
|
|
|
2023-08-10 11:04:53 +00:00
|
|
|
GDREGISTER_CLASS(LimboUtility);
|
2022-12-16 13:06:46 +00:00
|
|
|
GDREGISTER_CLASS(Blackboard);
|
2024-01-23 19:02:23 +00:00
|
|
|
GDREGISTER_CLASS(BlackboardPlan);
|
2022-12-16 13:06:46 +00:00
|
|
|
|
|
|
|
GDREGISTER_CLASS(LimboState);
|
|
|
|
GDREGISTER_CLASS(LimboHSM);
|
|
|
|
|
2023-09-19 11:43:26 +00:00
|
|
|
GDREGISTER_ABSTRACT_CLASS(BT);
|
2022-12-16 13:06:46 +00:00
|
|
|
GDREGISTER_ABSTRACT_CLASS(BTTask);
|
|
|
|
GDREGISTER_CLASS(BehaviorTree);
|
|
|
|
GDREGISTER_CLASS(BTPlayer);
|
|
|
|
GDREGISTER_CLASS(BTState);
|
|
|
|
|
2023-08-25 15:32:46 +00:00
|
|
|
LIMBO_REGISTER_TASK(BTComment);
|
2023-08-18 19:38:28 +00:00
|
|
|
|
2022-12-16 13:06:46 +00:00
|
|
|
GDREGISTER_CLASS(BTComposite);
|
2023-08-25 15:32:46 +00:00
|
|
|
LIMBO_REGISTER_TASK(BTSequence);
|
|
|
|
LIMBO_REGISTER_TASK(BTSelector);
|
|
|
|
LIMBO_REGISTER_TASK(BTParallel);
|
|
|
|
LIMBO_REGISTER_TASK(BTDynamicSequence);
|
|
|
|
LIMBO_REGISTER_TASK(BTDynamicSelector);
|
2023-09-23 18:29:17 +00:00
|
|
|
LIMBO_REGISTER_TASK(BTProbabilitySelector);
|
2023-08-25 15:32:46 +00:00
|
|
|
LIMBO_REGISTER_TASK(BTRandomSequence);
|
|
|
|
LIMBO_REGISTER_TASK(BTRandomSelector);
|
2022-12-16 13:06:46 +00:00
|
|
|
|
|
|
|
GDREGISTER_CLASS(BTDecorator);
|
2023-08-25 15:32:46 +00:00
|
|
|
LIMBO_REGISTER_TASK(BTInvert);
|
|
|
|
LIMBO_REGISTER_TASK(BTAlwaysFail);
|
|
|
|
LIMBO_REGISTER_TASK(BTAlwaysSucceed);
|
|
|
|
LIMBO_REGISTER_TASK(BTDelay);
|
|
|
|
LIMBO_REGISTER_TASK(BTRepeat);
|
|
|
|
LIMBO_REGISTER_TASK(BTRepeatUntilFailure);
|
|
|
|
LIMBO_REGISTER_TASK(BTRepeatUntilSuccess);
|
|
|
|
LIMBO_REGISTER_TASK(BTRunLimit);
|
|
|
|
LIMBO_REGISTER_TASK(BTTimeLimit);
|
|
|
|
LIMBO_REGISTER_TASK(BTCooldown);
|
|
|
|
LIMBO_REGISTER_TASK(BTProbability);
|
|
|
|
LIMBO_REGISTER_TASK(BTForEach);
|
2024-01-09 12:34:24 +00:00
|
|
|
LIMBO_REGISTER_TASK(BTNewScope);
|
|
|
|
LIMBO_REGISTER_TASK(BTSubtree);
|
2022-12-16 13:06:46 +00:00
|
|
|
|
|
|
|
GDREGISTER_CLASS(BTAction);
|
2024-01-09 12:34:24 +00:00
|
|
|
GDREGISTER_CLASS(BTCondition);
|
2023-08-25 15:32:46 +00:00
|
|
|
LIMBO_REGISTER_TASK(BTAwaitAnimation);
|
|
|
|
LIMBO_REGISTER_TASK(BTCallMethod);
|
|
|
|
LIMBO_REGISTER_TASK(BTConsolePrint);
|
|
|
|
LIMBO_REGISTER_TASK(BTFail);
|
|
|
|
LIMBO_REGISTER_TASK(BTPauseAnimation);
|
|
|
|
LIMBO_REGISTER_TASK(BTPlayAnimation);
|
|
|
|
LIMBO_REGISTER_TASK(BTRandomWait);
|
|
|
|
LIMBO_REGISTER_TASK(BTSetAgentProperty);
|
|
|
|
LIMBO_REGISTER_TASK(BTSetVar);
|
|
|
|
LIMBO_REGISTER_TASK(BTStopAnimation);
|
|
|
|
LIMBO_REGISTER_TASK(BTWait);
|
|
|
|
LIMBO_REGISTER_TASK(BTWaitTicks);
|
|
|
|
LIMBO_REGISTER_TASK(BTCheckAgentProperty);
|
|
|
|
LIMBO_REGISTER_TASK(BTCheckTrigger);
|
|
|
|
LIMBO_REGISTER_TASK(BTCheckVar);
|
2022-12-16 13:06:46 +00:00
|
|
|
|
|
|
|
GDREGISTER_ABSTRACT_CLASS(BBParam);
|
2024-01-09 12:34:24 +00:00
|
|
|
GDREGISTER_CLASS(BBAabb);
|
|
|
|
GDREGISTER_CLASS(BBArray);
|
|
|
|
GDREGISTER_CLASS(BBBasis);
|
2022-12-16 13:06:46 +00:00
|
|
|
GDREGISTER_CLASS(BBBool);
|
2024-01-09 12:34:24 +00:00
|
|
|
GDREGISTER_CLASS(BBByteArray);
|
|
|
|
GDREGISTER_CLASS(BBColor);
|
|
|
|
GDREGISTER_CLASS(BBColorArray);
|
|
|
|
GDREGISTER_CLASS(BBDictionary);
|
2022-12-16 13:06:46 +00:00
|
|
|
GDREGISTER_CLASS(BBFloat);
|
2024-01-19 16:05:01 +00:00
|
|
|
GDREGISTER_CLASS(BBFloat32Array);
|
|
|
|
GDREGISTER_CLASS(BBFloat64Array);
|
2024-01-09 12:34:24 +00:00
|
|
|
GDREGISTER_CLASS(BBInt);
|
2024-01-19 16:05:01 +00:00
|
|
|
GDREGISTER_CLASS(BBInt32Array);
|
|
|
|
GDREGISTER_CLASS(BBInt64Array);
|
2024-01-09 12:34:24 +00:00
|
|
|
GDREGISTER_CLASS(BBNode);
|
|
|
|
GDREGISTER_CLASS(BBPlane);
|
2024-01-19 16:05:01 +00:00
|
|
|
GDREGISTER_CLASS(BBProjection);
|
2024-01-09 12:34:24 +00:00
|
|
|
GDREGISTER_CLASS(BBQuaternion);
|
|
|
|
GDREGISTER_CLASS(BBRect2);
|
|
|
|
GDREGISTER_CLASS(BBRect2i);
|
2022-12-16 13:06:46 +00:00
|
|
|
GDREGISTER_CLASS(BBString);
|
2024-01-09 12:34:24 +00:00
|
|
|
GDREGISTER_CLASS(BBStringArray);
|
|
|
|
GDREGISTER_CLASS(BBStringName);
|
|
|
|
GDREGISTER_CLASS(BBTransform2D);
|
|
|
|
GDREGISTER_CLASS(BBTransform3D);
|
|
|
|
GDREGISTER_CLASS(BBVariant);
|
2022-12-16 13:06:46 +00:00
|
|
|
GDREGISTER_CLASS(BBVector2);
|
2024-01-09 12:34:24 +00:00
|
|
|
GDREGISTER_CLASS(BBVector2Array);
|
2022-12-17 13:22:55 +00:00
|
|
|
GDREGISTER_CLASS(BBVector2i);
|
2022-12-16 13:06:46 +00:00
|
|
|
GDREGISTER_CLASS(BBVector3);
|
2024-01-09 12:34:24 +00:00
|
|
|
GDREGISTER_CLASS(BBVector3Array);
|
2022-12-17 13:22:55 +00:00
|
|
|
GDREGISTER_CLASS(BBVector3i);
|
|
|
|
GDREGISTER_CLASS(BBVector4);
|
|
|
|
GDREGISTER_CLASS(BBVector4i);
|
2022-12-15 07:26:52 +00:00
|
|
|
|
|
|
|
_limbo_utility = memnew(LimboUtility);
|
|
|
|
|
2024-01-09 12:34:24 +00:00
|
|
|
#ifdef LIMBOAI_MODULE
|
2023-04-05 18:05:42 +00:00
|
|
|
Engine::get_singleton()->add_singleton(Engine::Singleton("LimboUtility", LimboUtility::get_singleton()));
|
2024-01-13 16:10:42 +00:00
|
|
|
#elif LIMBOAI_GDEXTENSION
|
2024-01-09 20:47:22 +00:00
|
|
|
Engine::get_singleton()->register_singleton("LimboUtility", LimboUtility::get_singleton());
|
2024-01-09 12:34:24 +00:00
|
|
|
#endif
|
2024-01-09 20:47:22 +00:00
|
|
|
|
2022-12-15 07:26:52 +00:00
|
|
|
LimboStringNames::create();
|
|
|
|
}
|
2022-09-21 21:56:04 +00:00
|
|
|
|
2022-09-01 22:20:37 +00:00
|
|
|
#ifdef TOOLS_ENABLED
|
2022-12-15 07:26:52 +00:00
|
|
|
if (p_level == MODULE_INITIALIZATION_LEVEL_EDITOR) {
|
2024-01-09 12:34:24 +00:00
|
|
|
#ifdef LIMBOAI_GDEXTENSION
|
|
|
|
GDREGISTER_CLASS(TaskTree);
|
|
|
|
GDREGISTER_CLASS(TaskButton);
|
|
|
|
GDREGISTER_CLASS(TaskPaletteSection);
|
|
|
|
GDREGISTER_CLASS(TaskPalette);
|
|
|
|
GDREGISTER_CLASS(ActionBanner);
|
|
|
|
GDREGISTER_CLASS(ModeSwitchButton);
|
2024-01-09 20:47:22 +00:00
|
|
|
GDREGISTER_CLASS(CompatShortcutBin);
|
|
|
|
GDREGISTER_CLASS(CompatScreenSelect);
|
|
|
|
GDREGISTER_CLASS(CompatWindowWrapper);
|
|
|
|
GDREGISTER_CLASS(BehaviorTreeView);
|
|
|
|
GDREGISTER_CLASS(LimboDebuggerTab);
|
|
|
|
GDREGISTER_CLASS(LimboDebuggerPlugin);
|
2024-01-25 16:59:38 +00:00
|
|
|
GDREGISTER_CLASS(BlackboardPlanEditor);
|
|
|
|
GDREGISTER_CLASS(EditorInspectorPluginBBPlan);
|
2024-01-09 12:34:24 +00:00
|
|
|
GDREGISTER_CLASS(LimboAIEditor);
|
|
|
|
GDREGISTER_CLASS(LimboAIEditorPlugin);
|
2024-01-13 16:10:42 +00:00
|
|
|
#endif // LIMBOAI_GDEXTENSION
|
2022-12-15 07:26:52 +00:00
|
|
|
EditorPlugins::add_by_type<LimboAIEditorPlugin>();
|
2024-01-09 12:34:24 +00:00
|
|
|
}
|
2023-04-27 07:41:59 +00:00
|
|
|
|
2024-01-09 12:34:24 +00:00
|
|
|
#endif // ! TOOLS_ENABLED
|
2022-08-28 10:54:34 +00:00
|
|
|
}
|
|
|
|
|
2022-12-15 07:26:52 +00:00
|
|
|
void uninitialize_limboai_module(ModuleInitializationLevel p_level) {
|
|
|
|
if (p_level == MODULE_INITIALIZATION_LEVEL_SCENE) {
|
2023-04-13 07:29:45 +00:00
|
|
|
LimboDebugger::deinitialize();
|
2022-12-15 07:26:52 +00:00
|
|
|
LimboStringNames::free();
|
|
|
|
memdelete(_limbo_utility);
|
|
|
|
}
|
2022-08-28 10:54:34 +00:00
|
|
|
}
|
2024-01-09 12:34:24 +00:00
|
|
|
|
|
|
|
#ifdef LIMBOAI_GDEXTENSION
|
|
|
|
extern "C" {
|
|
|
|
// Initialization.
|
|
|
|
GDExtensionBool GDE_EXPORT limboai_init(GDExtensionInterfaceGetProcAddress p_get_proc_address, const GDExtensionClassLibraryPtr p_library, GDExtensionInitialization *r_initialization) {
|
|
|
|
godot::GDExtensionBinding::InitObject init_obj(p_get_proc_address, p_library, r_initialization);
|
|
|
|
|
|
|
|
init_obj.register_initializer(initialize_limboai_module);
|
|
|
|
init_obj.register_terminator(uninitialize_limboai_module);
|
|
|
|
init_obj.set_minimum_library_initialization_level(MODULE_INITIALIZATION_LEVEL_SCENE);
|
|
|
|
|
|
|
|
return init_obj.init();
|
|
|
|
}
|
|
|
|
}
|
2024-01-13 16:10:42 +00:00
|
|
|
#endif // LIMBOAI_GDEXTENSION
|