Compare commits

...

5 Commits

Author SHA1 Message Date
Serhii Snitsaruk 1f6cc8e55c
GHA: Change test build configuration 2024-08-11 12:56:45 +02:00
Serhii Snitsaruk f8ab80defa
Merge pull request #193 from limbonaut/fix-monitor-performance
Fix `monitor_performance` screwing C# exports
2024-08-11 12:43:28 +02:00
Serhii Snitsaruk 314fcfd741
Fix monitor_performance screwing C# exports 2024-08-11 12:37:37 +02:00
Serhii Snitsaruk 6ada9cef2f
Merge pull request #191 from ydeltastar/fix-tab-update
Fix renaming `BehaviorTree` files doesn't update tab names
2024-08-11 11:26:48 +02:00
yds 410efbe0d3 Fix tab names doesn't update when filesystem changes 2024-08-10 11:29:22 -03:00
8 changed files with 44 additions and 40 deletions

View File

@ -125,7 +125,7 @@ jobs:
target: editor target: editor
arch: x86_64 arch: x86_64
dotnet: true dotnet: true
should-build: ${{ !inputs.test-build }} should-build: true
- name: Template .NET (x86_64, release) - name: Template .NET (x86_64, release)
target: template_release target: template_release

View File

@ -112,7 +112,7 @@ jobs:
target: editor target: editor
arch: x86_64 arch: x86_64
dotnet: true dotnet: true
should-build: true should-build: ${{ !inputs.test-build }}
- name: Template .NET (x86_64, release) - name: Template .NET (x86_64, release)
target: template_release target: template_release

View File

@ -157,18 +157,16 @@ void BTPlayer::restart() {
set_active(true); 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; monitor_performance = p_monitor_performance;
#ifdef DEBUG_ENABLED
if (bt_instance.is_valid()) { if (bt_instance.is_valid()) {
bt_instance->set_monitor_performance(monitor_performance); bt_instance->set_monitor_performance(monitor_performance);
} }
#endif
} }
#endif // ! DEBUG_ENABLED
void BTPlayer::_notification(int p_notification) { void BTPlayer::_notification(int p_notification) {
switch (p_notification) { switch (p_notification) {
case NOTIFICATION_PROCESS: { 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("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("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("update", "delta"), &BTPlayer::update);
ClassDB::bind_method(D_METHOD("restart"), &BTPlayer::restart); 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::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", 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::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(IDLE);
BIND_ENUM_CONSTANT(PHYSICS); BIND_ENUM_CONSTANT(PHYSICS);
@ -259,12 +261,6 @@ void BTPlayer::_bind_methods() {
#ifndef DISABLE_DEPRECATED #ifndef DISABLE_DEPRECATED
ADD_SIGNAL(MethodInfo("behavior_tree_finished", PropertyInfo(Variant::INT, "status"))); ADD_SIGNAL(MethodInfo("behavior_tree_finished", PropertyInfo(Variant::INT, "status")));
#endif #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() { BTPlayer::BTPlayer() {

View File

@ -44,6 +44,7 @@ private:
bool active = true; bool active = true;
Ref<Blackboard> blackboard; Ref<Blackboard> blackboard;
Node *scene_root_hint = nullptr; Node *scene_root_hint = nullptr;
bool monitor_performance = false;
Ref<BTInstance> bt_instance; Ref<BTInstance> bt_instance;
@ -74,6 +75,9 @@ public:
Ref<Blackboard> get_blackboard() const { return blackboard; } Ref<Blackboard> get_blackboard() const { return blackboard; }
void set_blackboard(const Ref<Blackboard> &p_blackboard) { blackboard = p_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 update(double p_delta);
void restart(); void restart();
@ -84,16 +88,6 @@ public:
BTPlayer(); BTPlayer();
~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 #endif // BT_PLAYER_H

View File

@ -44,15 +44,15 @@ void BTState::set_scene_root_hint(Node *p_scene_root) {
scene_root_hint = 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; monitor_performance = p_monitor;
#ifdef DEBUG_ENABLED
if (bt_instance.is_valid()) { if (bt_instance.is_valid()) {
bt_instance->set_monitor_performance(monitor_performance); bt_instance->set_monitor_performance(monitor_performance);
} }
#endif
} }
#endif // DEBUG_ENABLED
void BTState::_update_blackboard_plan() { void BTState::_update_blackboard_plan() {
if (get_blackboard_plan().is_null()) { 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("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("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); 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::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, "success_event"), "set_success_event", "get_success_event");
ADD_PROPERTY(PropertyInfo(Variant::STRING_NAME, "failure_event"), "set_failure_event", "get_failure_event"); ADD_PROPERTY(PropertyInfo(Variant::STRING_NAME, "failure_event"), "set_failure_event", "get_failure_event");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "monitor_performance"), "set_monitor_performance", "get_monitor_performance");
#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
} }
BTState::BTState() { BTState::BTState() {

View File

@ -26,6 +26,7 @@ private:
StringName success_event; StringName success_event;
StringName failure_event; StringName failure_event;
Node *scene_root_hint = nullptr; Node *scene_root_hint = nullptr;
bool monitor_performance = false;
protected: protected:
static void _bind_methods(); static void _bind_methods();
@ -51,17 +52,12 @@ public:
void set_failure_event(const StringName &p_failure_event) { failure_event = p_failure_event; } void set_failure_event(const StringName &p_failure_event) { failure_event = p_failure_event; }
StringName get_failure_event() const { return 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); void set_scene_root_hint(Node *p_node);
BTState(); 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 #endif // BT_STATE_H

View File

@ -799,6 +799,11 @@ void LimboAIEditor::_on_visibility_changed() {
task_palette->refresh(); task_palette->refresh();
} }
_update_favorite_tasks(); _update_favorite_tasks();
if (request_update_tabs && history.size() > 0) {
_update_tabs();
request_update_tabs = false;
}
} }
void LimboAIEditor::_on_header_pressed() { void LimboAIEditor::_on_header_pressed() {
@ -914,6 +919,18 @@ void LimboAIEditor::_on_resources_reload(const PackedStringArray &p_resources) {
#endif #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() { 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")); 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)); 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("resources_reload", callable_mp(this, &LimboAIEditor::_on_resources_reload));
EDITOR_FILE_SYSTEM()->connect("filesystem_changed", callable_mp(this, &LimboAIEditor::_on_filesystem_changed));
} break; } break;
case NOTIFICATION_THEME_CHANGED: { case NOTIFICATION_THEME_CHANGED: {

View File

@ -143,6 +143,7 @@ private:
Vector<Ref<BehaviorTree>> history; Vector<Ref<BehaviorTree>> history;
int idx_history; int idx_history;
bool updating_tabs = false; bool updating_tabs = false;
bool request_update_tabs = false;
HashSet<Ref<BehaviorTree>> dirty; HashSet<Ref<BehaviorTree>> dirty;
Ref<BTTask> clipboard_task; Ref<BTTask> clipboard_task;
@ -237,6 +238,7 @@ private:
void _on_history_forward(); void _on_history_forward();
void _on_task_dragged(Ref<BTTask> p_task, Ref<BTTask> p_to_task, int p_type); 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_resources_reload(const PackedStringArray &p_resources);
void _on_filesystem_changed();
void _on_new_script_pressed(); void _on_new_script_pressed();
void _task_type_selected(const String &p_class_or_path); void _task_type_selected(const String &p_class_or_path);
void _copy_version_info(); void _copy_version_info();