2023-07-21 09:50:06 +00:00
|
|
|
/**
|
|
|
|
* register_types.cpp
|
|
|
|
* =============================================================================
|
|
|
|
* Copyright 2021-2023 Serhii Snitsaruk
|
|
|
|
*
|
|
|
|
* 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"
|
|
|
|
#include "blackboard/bb_param/bb_float_array.h"
|
|
|
|
#include "blackboard/bb_param/bb_int.h"
|
|
|
|
#include "blackboard/bb_param/bb_int_array.h"
|
|
|
|
#include "blackboard/bb_param/bb_node.h"
|
|
|
|
#include "blackboard/bb_param/bb_param.h"
|
|
|
|
#include "blackboard/bb_param/bb_plane.h"
|
|
|
|
#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"
|
2022-08-31 15:05:25 +00:00
|
|
|
#include "bt/actions/bt_action.h"
|
2022-09-06 11:08:52 +00:00
|
|
|
#include "bt/actions/bt_console_print.h"
|
2022-08-31 15:05:25 +00:00
|
|
|
#include "bt/actions/bt_fail.h"
|
|
|
|
#include "bt/actions/bt_random_wait.h"
|
|
|
|
#include "bt/actions/bt_wait.h"
|
|
|
|
#include "bt/actions/bt_wait_ticks.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"
|
2022-08-28 20:58:30 +00:00
|
|
|
#include "bt/bt_task.h"
|
2022-08-31 15:05:25 +00:00
|
|
|
#include "bt/composites/bt_composite.h"
|
|
|
|
#include "bt/composites/bt_dynamic_selector.h"
|
|
|
|
#include "bt/composites/bt_dynamic_sequence.h"
|
|
|
|
#include "bt/composites/bt_parallel.h"
|
|
|
|
#include "bt/composites/bt_random_selector.h"
|
|
|
|
#include "bt/composites/bt_random_sequence.h"
|
|
|
|
#include "bt/composites/bt_selector.h"
|
|
|
|
#include "bt/composites/bt_sequence.h"
|
|
|
|
#include "bt/conditions/bt_condition.h"
|
|
|
|
#include "bt/decorators/bt_always_fail.h"
|
|
|
|
#include "bt/decorators/bt_always_succeed.h"
|
|
|
|
#include "bt/decorators/bt_cooldown.h"
|
|
|
|
#include "bt/decorators/bt_decorator.h"
|
|
|
|
#include "bt/decorators/bt_delay.h"
|
2022-09-22 11:09:49 +00:00
|
|
|
#include "bt/decorators/bt_for_each.h"
|
2022-08-31 15:05:25 +00:00
|
|
|
#include "bt/decorators/bt_invert.h"
|
2022-09-20 17:15:48 +00:00
|
|
|
#include "bt/decorators/bt_new_scope.h"
|
2022-08-31 15:05:25 +00:00
|
|
|
#include "bt/decorators/bt_probability.h"
|
|
|
|
#include "bt/decorators/bt_repeat.h"
|
|
|
|
#include "bt/decorators/bt_repeat_until_failure.h"
|
|
|
|
#include "bt/decorators/bt_repeat_until_success.h"
|
|
|
|
#include "bt/decorators/bt_run_limit.h"
|
2022-09-20 17:15:48 +00:00
|
|
|
#include "bt/decorators/bt_subtree.h"
|
2022-08-31 15:05:25 +00:00
|
|
|
#include "bt/decorators/bt_time_limit.h"
|
2023-07-20 16:35:36 +00:00
|
|
|
#include "editor/debugger/limbo_debugger.h"
|
|
|
|
#include "hsm/limbo_hsm.h"
|
|
|
|
#include "hsm/limbo_state.h"
|
|
|
|
#include "util/limbo_string_names.h"
|
|
|
|
#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"
|
|
|
|
#endif
|
|
|
|
|
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"
|
|
|
|
|
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) {
|
2023-04-13 07:29:45 +00:00
|
|
|
LimboDebugger::initialize();
|
|
|
|
|
2022-12-16 13:06:46 +00:00
|
|
|
GDREGISTER_CLASS(Blackboard);
|
|
|
|
|
|
|
|
GDREGISTER_CLASS(LimboState);
|
|
|
|
GDREGISTER_CLASS(LimboHSM);
|
|
|
|
|
|
|
|
GDREGISTER_ABSTRACT_CLASS(BTTask);
|
|
|
|
GDREGISTER_CLASS(BehaviorTree);
|
|
|
|
GDREGISTER_CLASS(BTPlayer);
|
|
|
|
GDREGISTER_CLASS(BTState);
|
|
|
|
|
|
|
|
GDREGISTER_CLASS(BTComposite);
|
|
|
|
GDREGISTER_CLASS(BTSequence);
|
|
|
|
GDREGISTER_CLASS(BTSelector);
|
|
|
|
GDREGISTER_CLASS(BTParallel);
|
|
|
|
GDREGISTER_CLASS(BTDynamicSequence);
|
|
|
|
GDREGISTER_CLASS(BTDynamicSelector);
|
|
|
|
GDREGISTER_CLASS(BTRandomSequence);
|
|
|
|
GDREGISTER_CLASS(BTRandomSelector);
|
|
|
|
|
|
|
|
GDREGISTER_CLASS(BTDecorator);
|
|
|
|
GDREGISTER_CLASS(BTInvert);
|
|
|
|
GDREGISTER_CLASS(BTAlwaysFail);
|
|
|
|
GDREGISTER_CLASS(BTAlwaysSucceed);
|
|
|
|
GDREGISTER_CLASS(BTDelay);
|
|
|
|
GDREGISTER_CLASS(BTRepeat);
|
|
|
|
GDREGISTER_CLASS(BTRepeatUntilFailure);
|
|
|
|
GDREGISTER_CLASS(BTRepeatUntilSuccess);
|
|
|
|
GDREGISTER_CLASS(BTRunLimit);
|
|
|
|
GDREGISTER_CLASS(BTTimeLimit);
|
|
|
|
GDREGISTER_CLASS(BTCooldown);
|
|
|
|
GDREGISTER_CLASS(BTProbability);
|
|
|
|
GDREGISTER_CLASS(BTForEach);
|
|
|
|
|
|
|
|
GDREGISTER_CLASS(BTAction);
|
|
|
|
GDREGISTER_CLASS(BTFail);
|
|
|
|
GDREGISTER_CLASS(BTWait);
|
|
|
|
GDREGISTER_CLASS(BTRandomWait);
|
|
|
|
GDREGISTER_CLASS(BTWaitTicks);
|
|
|
|
GDREGISTER_CLASS(BTNewScope);
|
|
|
|
GDREGISTER_CLASS(BTSubtree);
|
|
|
|
GDREGISTER_CLASS(BTConsolePrint);
|
|
|
|
|
|
|
|
GDREGISTER_CLASS(BTCondition);
|
|
|
|
|
|
|
|
GDREGISTER_ABSTRACT_CLASS(BBParam);
|
|
|
|
GDREGISTER_CLASS(BBInt);
|
|
|
|
GDREGISTER_CLASS(BBBool);
|
|
|
|
GDREGISTER_CLASS(BBFloat);
|
|
|
|
GDREGISTER_CLASS(BBString);
|
|
|
|
GDREGISTER_CLASS(BBVector2);
|
2022-12-17 13:22:55 +00:00
|
|
|
GDREGISTER_CLASS(BBVector2i);
|
2022-12-16 13:06:46 +00:00
|
|
|
GDREGISTER_CLASS(BBRect2);
|
2022-12-17 13:22:55 +00:00
|
|
|
GDREGISTER_CLASS(BBRect2i);
|
2022-12-16 13:06:46 +00:00
|
|
|
GDREGISTER_CLASS(BBVector3);
|
2022-12-17 13:22:55 +00:00
|
|
|
GDREGISTER_CLASS(BBVector3i);
|
2022-12-16 13:06:46 +00:00
|
|
|
GDREGISTER_CLASS(BBTransform2D);
|
2022-12-17 13:22:55 +00:00
|
|
|
GDREGISTER_CLASS(BBVector4);
|
|
|
|
GDREGISTER_CLASS(BBVector4i);
|
2022-12-16 13:06:46 +00:00
|
|
|
GDREGISTER_CLASS(BBPlane);
|
2022-12-17 13:22:55 +00:00
|
|
|
GDREGISTER_CLASS(BBQuaternion);
|
2022-12-16 13:06:46 +00:00
|
|
|
GDREGISTER_CLASS(BBAabb);
|
|
|
|
GDREGISTER_CLASS(BBBasis);
|
2022-12-17 13:22:55 +00:00
|
|
|
GDREGISTER_CLASS(BBTransform3D);
|
|
|
|
GDREGISTER_CLASS(BBColor);
|
|
|
|
GDREGISTER_CLASS(BBStringName);
|
2022-12-16 13:06:46 +00:00
|
|
|
GDREGISTER_CLASS(BBColor);
|
|
|
|
GDREGISTER_CLASS(BBNode);
|
|
|
|
GDREGISTER_CLASS(BBDictionary);
|
|
|
|
GDREGISTER_CLASS(BBArray);
|
|
|
|
GDREGISTER_CLASS(BBByteArray);
|
|
|
|
GDREGISTER_CLASS(BBIntArray);
|
2022-12-17 13:22:55 +00:00
|
|
|
GDREGISTER_CLASS(BBFloatArray);
|
2022-12-16 13:06:46 +00:00
|
|
|
GDREGISTER_CLASS(BBColorArray);
|
|
|
|
GDREGISTER_CLASS(BBStringArray);
|
|
|
|
GDREGISTER_CLASS(BBVector2Array);
|
|
|
|
GDREGISTER_CLASS(BBVector3Array);
|
|
|
|
GDREGISTER_CLASS(BBVariant);
|
2022-12-15 07:26:52 +00:00
|
|
|
|
|
|
|
_limbo_utility = memnew(LimboUtility);
|
2022-12-16 13:06:46 +00:00
|
|
|
GDREGISTER_CLASS(LimboUtility);
|
2022-12-15 07:26:52 +00:00
|
|
|
|
2023-04-05 18:05:42 +00:00
|
|
|
Engine::get_singleton()->add_singleton(Engine::Singleton("LimboUtility", LimboUtility::get_singleton()));
|
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) {
|
|
|
|
EditorPlugins::add_by_type<LimboAIEditorPlugin>();
|
2023-07-20 20:15:30 +00:00
|
|
|
} // else if (p_level == MODULE_INITIALIZATION_LEVEL_SCENE) {
|
|
|
|
// GDREGISTER_CLASS(BehaviorTreeView);
|
|
|
|
// }
|
2023-04-27 07:41:59 +00:00
|
|
|
|
2022-09-01 22:20:37 +00:00
|
|
|
#endif
|
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
|
|
|
}
|