Compare commits
5 Commits
85d5af180b
...
1f6cc8e55c
Author | SHA1 | Date |
---|---|---|
Serhii Snitsaruk | 1f6cc8e55c | |
Serhii Snitsaruk | f8ab80defa | |
Serhii Snitsaruk | 314fcfd741 | |
Serhii Snitsaruk | 6ada9cef2f | |
yds | 410efbe0d3 |
|
@ -125,7 +125,7 @@ jobs:
|
|||
target: editor
|
||||
arch: x86_64
|
||||
dotnet: true
|
||||
should-build: ${{ !inputs.test-build }}
|
||||
should-build: true
|
||||
|
||||
- name: Template .NET (x86_64, release)
|
||||
target: template_release
|
||||
|
|
|
@ -112,7 +112,7 @@ jobs:
|
|||
target: editor
|
||||
arch: x86_64
|
||||
dotnet: true
|
||||
should-build: true
|
||||
should-build: ${{ !inputs.test-build }}
|
||||
|
||||
- name: Template .NET (x86_64, release)
|
||||
target: template_release
|
||||
|
|
|
@ -157,18 +157,16 @@ void BTPlayer::restart() {
|
|||
set_active(true);
|
||||
}
|
||||
|
||||
#ifdef DEBUG_ENABLED
|
||||
|
||||
void BTPlayer::_set_monitor_performance(bool p_monitor_performance) {
|
||||
void BTPlayer::set_monitor_performance(bool p_monitor_performance) {
|
||||
monitor_performance = p_monitor_performance;
|
||||
|
||||
#ifdef DEBUG_ENABLED
|
||||
if (bt_instance.is_valid()) {
|
||||
bt_instance->set_monitor_performance(monitor_performance);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif // ! DEBUG_ENABLED
|
||||
|
||||
void BTPlayer::_notification(int p_notification) {
|
||||
switch (p_notification) {
|
||||
case NOTIFICATION_PROCESS: {
|
||||
|
@ -235,6 +233,9 @@ void BTPlayer::_bind_methods() {
|
|||
ClassDB::bind_method(D_METHOD("set_blackboard_plan", "plan"), &BTPlayer::set_blackboard_plan);
|
||||
ClassDB::bind_method(D_METHOD("get_blackboard_plan"), &BTPlayer::get_blackboard_plan);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_monitor_performance", "enable"), &BTPlayer::set_monitor_performance);
|
||||
ClassDB::bind_method(D_METHOD("get_monitor_performance"), &BTPlayer::get_monitor_performance);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("update", "delta"), &BTPlayer::update);
|
||||
ClassDB::bind_method(D_METHOD("restart"), &BTPlayer::restart);
|
||||
|
||||
|
@ -249,6 +250,7 @@ void BTPlayer::_bind_methods() {
|
|||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "active"), "set_active", "get_active");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "blackboard", PROPERTY_HINT_NONE, "Blackboard", 0), "set_blackboard", "get_blackboard");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "blackboard_plan", PROPERTY_HINT_RESOURCE_TYPE, "BlackboardPlan", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_EDITOR_INSTANTIATE_OBJECT | PROPERTY_USAGE_ALWAYS_DUPLICATE), "set_blackboard_plan", "get_blackboard_plan");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "monitor_performance"), "set_monitor_performance", "get_monitor_performance");
|
||||
|
||||
BIND_ENUM_CONSTANT(IDLE);
|
||||
BIND_ENUM_CONSTANT(PHYSICS);
|
||||
|
@ -259,12 +261,6 @@ void BTPlayer::_bind_methods() {
|
|||
#ifndef DISABLE_DEPRECATED
|
||||
ADD_SIGNAL(MethodInfo("behavior_tree_finished", PropertyInfo(Variant::INT, "status")));
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG_ENABLED
|
||||
ClassDB::bind_method(D_METHOD("_set_monitor_performance", "enable"), &BTPlayer::_set_monitor_performance);
|
||||
ClassDB::bind_method(D_METHOD("_get_monitor_performance"), &BTPlayer::_get_monitor_performance);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "monitor_performance"), "_set_monitor_performance", "_get_monitor_performance");
|
||||
#endif // DEBUG_ENABLED
|
||||
}
|
||||
|
||||
BTPlayer::BTPlayer() {
|
||||
|
|
|
@ -44,6 +44,7 @@ private:
|
|||
bool active = true;
|
||||
Ref<Blackboard> blackboard;
|
||||
Node *scene_root_hint = nullptr;
|
||||
bool monitor_performance = false;
|
||||
|
||||
Ref<BTInstance> bt_instance;
|
||||
|
||||
|
@ -74,6 +75,9 @@ public:
|
|||
Ref<Blackboard> get_blackboard() const { return blackboard; }
|
||||
void set_blackboard(const Ref<Blackboard> &p_blackboard) { blackboard = p_blackboard; }
|
||||
|
||||
void set_monitor_performance(bool p_monitor_performance);
|
||||
bool get_monitor_performance() const { return monitor_performance; }
|
||||
|
||||
void update(double p_delta);
|
||||
void restart();
|
||||
|
||||
|
@ -84,16 +88,6 @@ public:
|
|||
|
||||
BTPlayer();
|
||||
~BTPlayer();
|
||||
|
||||
#ifdef DEBUG_ENABLED // Performance monitoring
|
||||
|
||||
private:
|
||||
bool monitor_performance = false;
|
||||
|
||||
void _set_monitor_performance(bool p_monitor_performance);
|
||||
bool _get_monitor_performance() const { return monitor_performance; }
|
||||
|
||||
#endif // * DEBUG_ENABLED
|
||||
};
|
||||
|
||||
#endif // BT_PLAYER_H
|
||||
|
|
|
@ -44,15 +44,15 @@ void BTState::set_scene_root_hint(Node *p_scene_root) {
|
|||
scene_root_hint = p_scene_root;
|
||||
}
|
||||
|
||||
#ifdef DEBUG_ENABLED
|
||||
void BTState::_set_monitor_performance(bool p_monitor) {
|
||||
void BTState::set_monitor_performance(bool p_monitor) {
|
||||
monitor_performance = p_monitor;
|
||||
|
||||
#ifdef DEBUG_ENABLED
|
||||
if (bt_instance.is_valid()) {
|
||||
bt_instance->set_monitor_performance(monitor_performance);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif // DEBUG_ENABLED
|
||||
|
||||
void BTState::_update_blackboard_plan() {
|
||||
if (get_blackboard_plan().is_null()) {
|
||||
|
@ -144,17 +144,15 @@ void BTState::_bind_methods() {
|
|||
ClassDB::bind_method(D_METHOD("set_failure_event", "event"), &BTState::set_failure_event);
|
||||
ClassDB::bind_method(D_METHOD("get_failure_event"), &BTState::get_failure_event);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_monitor_performance", "enable"), &BTState::set_monitor_performance);
|
||||
ClassDB::bind_method(D_METHOD("get_monitor_performance"), &BTState::get_monitor_performance);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_scene_root_hint", "scene_root"), &BTState::set_scene_root_hint);
|
||||
|
||||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "behavior_tree", PROPERTY_HINT_RESOURCE_TYPE, "BehaviorTree"), "set_behavior_tree", "get_behavior_tree");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::STRING_NAME, "success_event"), "set_success_event", "get_success_event");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::STRING_NAME, "failure_event"), "set_failure_event", "get_failure_event");
|
||||
|
||||
#ifdef DEBUG_ENABLED
|
||||
ClassDB::bind_method(D_METHOD("_set_monitor_performance", "enable"), &BTState::_set_monitor_performance);
|
||||
ClassDB::bind_method(D_METHOD("_get_monitor_performance"), &BTState::_get_monitor_performance);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "monitor_performance"), "_set_monitor_performance", "_get_monitor_performance");
|
||||
#endif // DEBUG_ENABLED
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "monitor_performance"), "set_monitor_performance", "get_monitor_performance");
|
||||
}
|
||||
|
||||
BTState::BTState() {
|
||||
|
|
|
@ -26,6 +26,7 @@ private:
|
|||
StringName success_event;
|
||||
StringName failure_event;
|
||||
Node *scene_root_hint = nullptr;
|
||||
bool monitor_performance = false;
|
||||
|
||||
protected:
|
||||
static void _bind_methods();
|
||||
|
@ -51,17 +52,12 @@ public:
|
|||
void set_failure_event(const StringName &p_failure_event) { failure_event = p_failure_event; }
|
||||
StringName get_failure_event() const { return failure_event; }
|
||||
|
||||
void set_monitor_performance(bool p_monitor);
|
||||
bool get_monitor_performance() const { return monitor_performance; }
|
||||
|
||||
void set_scene_root_hint(Node *p_node);
|
||||
|
||||
BTState();
|
||||
|
||||
#ifdef DEBUG_ENABLED
|
||||
private:
|
||||
bool monitor_performance = false;
|
||||
|
||||
void _set_monitor_performance(bool p_monitor);
|
||||
bool _get_monitor_performance() const { return monitor_performance; }
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif // BT_STATE_H
|
||||
|
|
|
@ -799,6 +799,11 @@ void LimboAIEditor::_on_visibility_changed() {
|
|||
task_palette->refresh();
|
||||
}
|
||||
_update_favorite_tasks();
|
||||
|
||||
if (request_update_tabs && history.size() > 0) {
|
||||
_update_tabs();
|
||||
request_update_tabs = false;
|
||||
}
|
||||
}
|
||||
|
||||
void LimboAIEditor::_on_header_pressed() {
|
||||
|
@ -914,6 +919,18 @@ void LimboAIEditor::_on_resources_reload(const PackedStringArray &p_resources) {
|
|||
#endif
|
||||
}
|
||||
|
||||
void LimboAIEditor::_on_filesystem_changed() {
|
||||
if (history.size() == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (is_visible_in_tree()) {
|
||||
_update_tabs();
|
||||
} else {
|
||||
request_update_tabs = true;
|
||||
}
|
||||
}
|
||||
|
||||
void LimboAIEditor::_on_new_script_pressed() {
|
||||
SCRIPT_EDITOR()->open_script_create_dialog("BTAction", String(GLOBAL_GET("limbo_ai/behavior_tree/user_task_dir_1")).path_join("new_task"));
|
||||
}
|
||||
|
@ -1403,6 +1420,7 @@ void LimboAIEditor::_notification(int p_what) {
|
|||
version_btn->connect(LW_NAME(pressed), callable_mp(this, &LimboAIEditor::_copy_version_info));
|
||||
|
||||
EDITOR_FILE_SYSTEM()->connect("resources_reload", callable_mp(this, &LimboAIEditor::_on_resources_reload));
|
||||
EDITOR_FILE_SYSTEM()->connect("filesystem_changed", callable_mp(this, &LimboAIEditor::_on_filesystem_changed));
|
||||
|
||||
} break;
|
||||
case NOTIFICATION_THEME_CHANGED: {
|
||||
|
|
|
@ -143,6 +143,7 @@ private:
|
|||
Vector<Ref<BehaviorTree>> history;
|
||||
int idx_history;
|
||||
bool updating_tabs = false;
|
||||
bool request_update_tabs = false;
|
||||
HashSet<Ref<BehaviorTree>> dirty;
|
||||
Ref<BTTask> clipboard_task;
|
||||
|
||||
|
@ -237,6 +238,7 @@ private:
|
|||
void _on_history_forward();
|
||||
void _on_task_dragged(Ref<BTTask> p_task, Ref<BTTask> p_to_task, int p_type);
|
||||
void _on_resources_reload(const PackedStringArray &p_resources);
|
||||
void _on_filesystem_changed();
|
||||
void _on_new_script_pressed();
|
||||
void _task_type_selected(const String &p_class_or_path);
|
||||
void _copy_version_info();
|
||||
|
|
Loading…
Reference in New Issue