Skip to content

Commit

Permalink
Open BehaviorTree in the BT editor when its property is clicked in th…
Browse files Browse the repository at this point in the history
…e inspector
  • Loading branch information
limbonaut committed Dec 18, 2023
1 parent e03887c commit 3f61204
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
1 change: 0 additions & 1 deletion bt/behavior_tree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ void BehaviorTree::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_description"), &BehaviorTree::get_description);
ClassDB::bind_method(D_METHOD("set_root_task", "p_value"), &BehaviorTree::set_root_task);
ClassDB::bind_method(D_METHOD("get_root_task"), &BehaviorTree::get_root_task);
// ClassDB::bind_method(D_METHOD("init"), &BehaviorTree::init);
ClassDB::bind_method(D_METHOD("clone"), &BehaviorTree::clone);
ClassDB::bind_method(D_METHOD("instantiate", "p_agent", "p_blackboard"), &BehaviorTree::instantiate);

Expand Down
1 change: 0 additions & 1 deletion bt/behavior_tree.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ class BehaviorTree : public Resource {
}
Ref<BTTask> get_root_task() const { return root_task; }

// void init();
Ref<BehaviorTree> clone() const;
Ref<BTTask> instantiate(Node *p_agent, const Ref<Blackboard> &p_blackboard) const;
};
Expand Down
8 changes: 8 additions & 0 deletions editor/limbo_ai_editor_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1288,6 +1288,14 @@ void LimboAIEditorPlugin::apply_changes() {
}

void LimboAIEditorPlugin::_notification(int p_notification) {
if (p_notification == NOTIFICATION_ENTER_TREE) {
// Add BehaviorTree to the list of resources that should open in a new inspector.
PackedStringArray open_in_new_inspector = EDITOR_GET("interface/inspector/resources_to_open_in_new_inspector");
if (!open_in_new_inspector.has("BehaviorTree")) {
open_in_new_inspector.push_back("BehaviorTree");
EditorSettings::get_singleton()->set_setting("interface/inspector/resources_to_open_in_new_inspector", open_in_new_inspector);
}
}
}

void LimboAIEditorPlugin::make_visible(bool p_visible) {
Expand Down

0 comments on commit 3f61204

Please sign in to comment.