Merge pull request #18 from limbonaut/prerelease-prep

Pre-release prep work
This commit is contained in:
Serhii Snitsaruk 2024-01-17 19:17:42 +01:00 committed by GitHub
commit caa1508fea
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
29 changed files with 158 additions and 79 deletions

View File

@ -162,15 +162,13 @@ jobs:
- name: Setup project structure for GDExtension - name: Setup project structure for GDExtension
shell: bash shell: bash
run: | run: |
python ./limboai/gdextension/update_icons.py bash ./limboai/gdextension/setup_gdextension.sh --copy-all
mkdir -p demo/addons/limboai/bin
mv limboai/icons demo/addons/limboai/
cp limboai/gdextension/SConstruct SConstruct
cp limboai/gdextension/limboai.gdextension demo/addons/limboai/bin
echo "---" echo "---"
ls -l ls -l
echo "---"
ls -l -R ./demo/ ls -l -R ./demo/
- name: Compilation - name: Compilation
shell: bash shell: bash
env: env:
@ -184,7 +182,10 @@ jobs:
run: | run: |
mkdir out mkdir out
mv demo/addons/ out/ mv demo/addons/ out/
cp limboai/{README,LICENSE,LOGO_LICENSE}.md out/addons/limboai/
cp -R limboai/demo/demo out/demo
rm -f out/addons/limboai/bin/*.{exp,lib,pdb} rm -f out/addons/limboai/bin/*.{exp,lib,pdb}
echo "---"
ls -R out/ ls -R out/
- name: Strip lib - name: Strip lib

View File

@ -1,7 +0,0 @@
[gd_resource type="Environment" load_steps=2 format=2]
[sub_resource type="Sky" id=1]
[resource]
background_mode = 2
background_sky = SubResource( 1 )

View File

@ -18,12 +18,14 @@ extends BTAction
@export var tolerance := 50.0 @export var tolerance := 50.0
@warning_ignore("native_method_override") # needed for GDExtension version.
func _generate_name() -> String: func _generate_name() -> String:
return "Arrive pos: %s speed: %s" % [ return "Arrive pos: %s speed: %s" % [
LimboUtility.decorate_var(target_position_var), LimboUtility.decorate_var(target_position_var),
LimboUtility.decorate_var(speed_var), LimboUtility.decorate_var(speed_var),
] ]
@warning_ignore("native_method_override")
func _tick(p_delta: float) -> Status: func _tick(p_delta: float) -> Status:
var target_pos: Vector2 = blackboard.get_var(target_position_var, Vector2.ZERO) var target_pos: Vector2 = blackboard.get_var(target_position_var, Vector2.ZERO)
if target_pos.distance_to(agent.global_position) < tolerance: if target_pos.distance_to(agent.global_position) < tolerance:

View File

@ -1,6 +1,6 @@
[gd_resource type="BehaviorTree" load_steps=10 format=3 uid="uid://cjkqi41oagagd"] [gd_resource type="BehaviorTree" load_steps=10 format=3 uid="uid://cjkqi41oagagd"]
[ext_resource type="Script" path="res://ai/tasks/arrive_pos.gd" id="1_rhs33"] [ext_resource type="Script" path="res://demo/ai/tasks/arrive_pos.gd" id="1_rhs33"]
[sub_resource type="BTAction" id="BTAction_3xal7"] [sub_resource type="BTAction" id="BTAction_3xal7"]
script = ExtResource("1_rhs33") script = ExtResource("1_rhs33")

View File

@ -1,8 +1,8 @@
[gd_scene load_steps=2 format=3 uid="uid://d4bjeyescflm8"] [gd_scene load_steps=2 format=3 uid="uid://d4bjeyescflm8"]
[ext_resource type="BehaviorTree" uid="uid://cvm3gqes75f53" path="res://ai/trees/variables.tres" id="1_tq7fc"] [ext_resource type="BehaviorTree" uid="uid://cvm3gqes75f53" path="res://demo/ai/trees/variables.tres" id="1_cm2sf"]
[node name="Variables Example" type="Node2D"] [node name="Variables Example" type="Node2D"]
[node name="BTPlayer" type="BTPlayer" parent="."] [node name="BTPlayer" type="BTPlayer" parent="."]
behavior_tree = ExtResource("1_tq7fc") behavior_tree = ExtResource("1_cm2sf")

View File

@ -1,8 +1,8 @@
[gd_scene load_steps=4 format=3 uid="uid://p5i7fdku3hqs"] [gd_scene load_steps=4 format=3 uid="uid://p5i7fdku3hqs"]
[ext_resource type="Script" path="res://examples/waypoints/example_waypoints.gd" id="1_d4sso"] [ext_resource type="Script" path="res://demo/examples/waypoints/example_waypoints.gd" id="1_d4sso"]
[ext_resource type="Script" path="res://examples/waypoints/waypoint_marker.gd" id="2_l26sl"] [ext_resource type="Script" path="res://demo/examples/waypoints/waypoint_marker.gd" id="2_l26sl"]
[ext_resource type="PackedScene" uid="uid://c26b8c8dndtop" path="res://examples/waypoints/patrolling_agent.tscn" id="3_t4qgi"] [ext_resource type="PackedScene" uid="uid://c26b8c8dndtop" path="res://demo/examples/waypoints/patrolling_agent.tscn" id="3_t4qgi"]
[node name="ExampleWaypoints" type="Node2D"] [node name="ExampleWaypoints" type="Node2D"]
script = ExtResource("1_d4sso") script = ExtResource("1_d4sso")

View File

@ -1,8 +1,8 @@
[gd_scene load_steps=7 format=3 uid="uid://c26b8c8dndtop"] [gd_scene load_steps=7 format=3 uid="uid://c26b8c8dndtop"]
[ext_resource type="Script" path="res://examples/waypoints/patrolling_agent.gd" id="1_5wwhb"] [ext_resource type="Script" path="res://demo/examples/waypoints/patrolling_agent.gd" id="1_5wwhb"]
[ext_resource type="BehaviorTree" uid="uid://cjkqi41oagagd" path="res://ai/trees/waypoints.tres" id="2_66y4v"] [ext_resource type="BehaviorTree" uid="uid://cjkqi41oagagd" path="res://demo/ai/trees/waypoints.tres" id="2_66y4v"]
[ext_resource type="Texture2D" uid="uid://d0mht3ntak7e5" path="res://icon.png" id="3_j5bxx"] [ext_resource type="Texture2D" uid="uid://d0mht3ntak7e5" path="res://demo/godot.png" id="3_64ge2"]
[sub_resource type="Animation" id="Animation_5id00"] [sub_resource type="Animation" id="Animation_5id00"]
length = 0.001 length = 0.001
@ -51,7 +51,7 @@ _blackboard_data = {
} }
[node name="Sprite2D" type="Sprite2D" parent="."] [node name="Sprite2D" type="Sprite2D" parent="."]
texture = ExtResource("3_j5bxx") texture = ExtResource("3_64ge2")
[node name="AnimationPlayer" type="AnimationPlayer" parent="."] [node name="AnimationPlayer" type="AnimationPlayer" parent="."]
libraries = { libraries = {

View File

Before

Width:  |  Height:  |  Size: 3.2 KiB

After

Width:  |  Height:  |  Size: 3.2 KiB

View File

@ -3,15 +3,15 @@
importer="texture" importer="texture"
type="CompressedTexture2D" type="CompressedTexture2D"
uid="uid://d0mht3ntak7e5" uid="uid://d0mht3ntak7e5"
path="res://.godot/imported/icon.png-487276ed1e3a0c39cad0279d744ee560.ctex" path="res://.godot/imported/godot.png-a8a26b1338954efbba9baa82b9ad4a96.ctex"
metadata={ metadata={
"vram_texture": false "vram_texture": false
} }
[deps] [deps]
source_file="res://icon.png" source_file="res://demo/godot.png"
dest_files=["res://.godot/imported/icon.png-487276ed1e3a0c39cad0279d744ee560.ctex"] dest_files=["res://.godot/imported/godot.png-a8a26b1338954efbba9baa82b9ad4a96.ctex"]
[params] [params]

View File

@ -1,7 +1,7 @@
[gd_scene load_steps=3 format=3 uid="uid://c3d3ed6545cly"] [gd_scene load_steps=3 format=3 uid="uid://c3d3ed6545cly"]
[ext_resource type="Script" path="res://tests/agent_properties/agent_properties.gd" id="1_jh88u"] [ext_resource type="Script" path="res://demo/tests/agent_properties/agent_properties.gd" id="1_jh88u"]
[ext_resource type="BehaviorTree" uid="uid://ddhxf0haxgw" path="res://tests/agent_properties/bt_agent_properties.tres" id="2_txe8k"] [ext_resource type="BehaviorTree" uid="uid://ddhxf0haxgw" path="res://demo/tests/agent_properties/bt_agent_properties.tres" id="2_txe8k"]
[node name="AgentProperties" type="Node2D"] [node name="AgentProperties" type="Node2D"]
script = ExtResource("1_jh88u") script = ExtResource("1_jh88u")

View File

@ -1,6 +1,6 @@
[gd_scene load_steps=2 format=3 uid="uid://dgeb7tg8xb3j4"] [gd_scene load_steps=2 format=3 uid="uid://dgeb7tg8xb3j4"]
[ext_resource type="BehaviorTree" uid="uid://cen725hsk8lyl" path="res://tests/probability_selector/bt_test_probability_selector.tres" id="1_lr7l2"] [ext_resource type="BehaviorTree" uid="uid://cen725hsk8lyl" path="res://demo/tests/probability_selector/bt_test_probability_selector.tres" id="1_lr7l2"]
[node name="test_probability_selector" type="Node2D"] [node name="test_probability_selector" type="Node2D"]

View File

@ -12,9 +12,9 @@ config_version=5
config/name="LimboAI Test" config/name="LimboAI Test"
config/tags=PackedStringArray("demo") config/tags=PackedStringArray("demo")
run/main_scene="res://examples/waypoints/example_waypoints.tscn" run/main_scene="res://demo/examples/waypoints/example_waypoints.tscn"
config/features=PackedStringArray("4.2") config/features=PackedStringArray("4.2")
config/icon="res://icon.png" config/icon="res://demo/godot.png"
[debug] [debug]
@ -24,6 +24,11 @@ gdscript/warnings/native_method_override=1
common/drop_mouse_on_gui_input_disabled=true common/drop_mouse_on_gui_input_disabled=true
[limbo_ai]
behavior_tree/behavior_tree_default_dir="res://demo/ai/trees"
behavior_tree/user_task_dir_1="res://demo/ai/tasks"
[physics] [physics]
common/enable_pause_aware_picking=true common/enable_pause_aware_picking=true

View File

@ -17,11 +17,13 @@
#include "../util/limbo_string_names.h" #include "../util/limbo_string_names.h"
#ifdef LIMBOAI_MODULE #ifdef LIMBOAI_MODULE
#include "editor/editor_scale.h"
#include "scene/gui/button.h" #include "scene/gui/button.h"
#endif // LIMBOAI_MODULE #endif // LIMBOAI_MODULE
#ifdef LIMBOAI_GDEXTENSION #ifdef LIMBOAI_GDEXTENSION
#include <godot_cpp/classes/button.hpp> #include <godot_cpp/classes/button.hpp>
#include <godot_cpp/classes/editor_interface.hpp>
#endif // LIMBOAI_GDEXTENSION #endif // LIMBOAI_GDEXTENSION
void ActionBanner::set_text(const String &p_text) { void ActionBanner::set_text(const String &p_text) {
@ -43,6 +45,12 @@ void ActionBanner::add_action(const String &p_name, const Callable &p_action, bo
hbox->add_child(action_btn); hbox->add_child(action_btn);
} }
void ActionBanner::add_spacer() {
Control *spacer = memnew(Control);
spacer->set_custom_minimum_size(Vector2(8.0 * EDSCALE, 0.0));
hbox->add_child(spacer);
}
void ActionBanner::_execute_action(const Callable &p_action, bool p_auto_close) { void ActionBanner::_execute_action(const Callable &p_action, bool p_auto_close) {
#ifdef LIMBOAI_MODULE #ifdef LIMBOAI_MODULE
Callable::CallError ce; Callable::CallError ce;

View File

@ -50,6 +50,7 @@ public:
String get_text() const; String get_text() const;
void add_action(const String &p_name, const Callable &p_action, bool p_auto_close = false); void add_action(const String &p_name, const Callable &p_action, bool p_auto_close = false);
void add_spacer();
void close(); void close();

View File

@ -272,8 +272,10 @@ void LimboAIEditor::_edit_project_settings() {
ProjectSettingsEditor::get_singleton()->connect(LW_NAME(visibility_changed), callable_mp(this, &LimboAIEditor::_update_banners), CONNECT_ONE_SHOT); ProjectSettingsEditor::get_singleton()->connect(LW_NAME(visibility_changed), callable_mp(this, &LimboAIEditor::_update_banners), CONNECT_ONE_SHOT);
#elif LIMBOAI_GDEXTENSION #elif LIMBOAI_GDEXTENSION
// TODO: Find a way to show project setting in GDExtension. // TODO: Find a way to show project setting in GDExtension.
// TODO: Maybe show a popup dialog instead. String text = "Can't open settings in GDExtension, sorry :(\n"
ERR_PRINT("Can't do in GDExtension. To edit project settings, navigate to \"Project->Project Settings\", enable \"Advanced settings\", and scroll down to the \"LimboAI\" section."); "To edit project settings, navigate to \"Project->Project Settings\",\n"
"enable \"Advanced settings\", and scroll down to the \"LimboAI\" section.";
_popup_info_dialog(text);
#endif #endif
} }
@ -592,12 +594,15 @@ void LimboAIEditor::_probability_popup_closed() {
void LimboAIEditor::_misc_option_selected(int p_id) { void LimboAIEditor::_misc_option_selected(int p_id) {
switch (p_id) { switch (p_id) {
case MISC_INTRODUCTION: {
LimboUtility::get_singleton()->open_doc_introduction();
} break;
case MISC_ONLINE_DOCUMENTATION: { case MISC_ONLINE_DOCUMENTATION: {
LimboUtility::get_singleton()->open_doc_online(); LimboUtility::get_singleton()->open_doc_online();
} break; } break;
case MISC_DOC_INTRODUCTION: {
LimboUtility::get_singleton()->open_doc_introduction();
} break;
case MISC_DOC_CUSTOM_TASKS: {
LimboUtility::get_singleton()->open_doc_custom_tasks();
} break;
case MISC_OPEN_DEBUGGER: { case MISC_OPEN_DEBUGGER: {
ERR_FAIL_COND(LimboDebuggerPlugin::get_singleton() == nullptr); ERR_FAIL_COND(LimboDebuggerPlugin::get_singleton() == nullptr);
if (LimboDebuggerPlugin::get_singleton()->get_session_tab()->get_window_enabled()) { if (LimboDebuggerPlugin::get_singleton()->get_session_tab()->get_window_enabled()) {
@ -882,6 +887,11 @@ void LimboAIEditor::_resave_modified(String _str) {
disk_changed_files.clear(); disk_changed_files.clear();
} }
void LimboAIEditor::_popup_info_dialog(const String &p_text) {
info_dialog->set_text(p_text);
info_dialog->popup_centered();
}
void LimboAIEditor::_rename_task_confirmed() { void LimboAIEditor::_rename_task_confirmed() {
ERR_FAIL_COND(!task_tree->get_selected().is_valid()); ERR_FAIL_COND(!task_tree->get_selected().is_valid());
rename_dialog->hide(); rename_dialog->hide();
@ -944,8 +954,9 @@ void LimboAIEditor::_update_misc_menu() {
misc_menu->clear(); misc_menu->clear();
misc_menu->add_icon_item(theme_cache.introduction_icon, TTR("Introduction"), MISC_INTRODUCTION);
misc_menu->add_icon_item(theme_cache.doc_icon, TTR("Online Documentation"), MISC_ONLINE_DOCUMENTATION); misc_menu->add_icon_item(theme_cache.doc_icon, TTR("Online Documentation"), MISC_ONLINE_DOCUMENTATION);
misc_menu->add_icon_item(theme_cache.introduction_icon, TTR("Introduction"), MISC_DOC_INTRODUCTION);
misc_menu->add_icon_item(theme_cache.introduction_icon, TTR("Creating custom tasks in GDScript"), MISC_DOC_CUSTOM_TASKS);
misc_menu->add_separator(); misc_menu->add_separator();
#ifdef LIMBOAI_MODULE #ifdef LIMBOAI_MODULE
@ -974,6 +985,8 @@ void LimboAIEditor::_update_banners() {
banner->set_text(vformat(TTR("Task folder not found: %s"), task_dir)); banner->set_text(vformat(TTR("Task folder not found: %s"), task_dir));
banner->add_action(TTR("Create"), callable_mp(this, &LimboAIEditor::_create_user_task_dir), true); banner->add_action(TTR("Create"), callable_mp(this, &LimboAIEditor::_create_user_task_dir), true);
banner->add_action(TTR("Edit Path..."), callable_mp(this, &LimboAIEditor::_edit_project_settings)); banner->add_action(TTR("Edit Path..."), callable_mp(this, &LimboAIEditor::_edit_project_settings));
banner->add_spacer();
banner->add_action(TTR("Help..."), callable_mp(LimboUtility::get_singleton(), &LimboUtility::open_doc_custom_tasks));
banner->set_meta(LW_NAME(managed), Variant(true)); banner->set_meta(LW_NAME(managed), Variant(true));
banners->call_deferred(LW_NAME(add_child), banner); banners->call_deferred(LW_NAME(add_child), banner);
} }
@ -992,6 +1005,17 @@ void LimboAIEditor::_update_banners() {
banners->call_deferred(LW_NAME(add_child), banner); banners->call_deferred(LW_NAME(add_child), banner);
} }
} }
#ifdef LIMBOAI_GDEXTENSION
if (!limitations_banner_shown && GLOBAL_GET("debug/gdscript/warnings/native_method_override") == Variant(2)) {
ActionBanner *banner = memnew(ActionBanner);
banner->set_text(vformat(TTR("In Project Settings, \"debug/gdscript/warnings/native_method_override\" is set to \"Error\"")));
banner->add_action(TTR("Instructions..."), callable_mp(LimboUtility::get_singleton(), &LimboUtility::open_doc_gdextension_limitations));
banner->add_action(TTR("Dismiss"), callable_mp(banner, &ActionBanner::close));
banners->call_deferred(LW_NAME(add_child), banner);
limitations_banner_shown = true;
}
#endif // LIMBOAI_GDEXTENSION
} }
void LimboAIEditor::_do_update_theme_item_cache() { void LimboAIEditor::_do_update_theme_item_cache() {
@ -1101,6 +1125,7 @@ void LimboAIEditor::_bind_methods() {
} }
LimboAIEditor::LimboAIEditor() { LimboAIEditor::LimboAIEditor() {
plugin = nullptr;
idx_history = 0; idx_history = 0;
LW_SHORTCUT("limbo_ai/rename_task", TTR("Rename"), LW_KEY(F2)); LW_SHORTCUT("limbo_ai/rename_task", TTR("Rename"), LW_KEY(F2));
@ -1341,6 +1366,9 @@ LimboAIEditor::LimboAIEditor() {
disk_changed->add_button(TTR("Resave"), !DisplayServer::get_singleton()->get_swap_cancel_ok(), "resave"); disk_changed->add_button(TTR("Resave"), !DisplayServer::get_singleton()->get_swap_cancel_ok(), "resave");
} }
info_dialog = memnew(AcceptDialog);
add_child(info_dialog);
BASE_CONTROL()->add_child(disk_changed); BASE_CONTROL()->add_child(disk_changed);
GLOBAL_DEF(PropertyInfo(Variant::STRING, "limbo_ai/behavior_tree/behavior_tree_default_dir", PROPERTY_HINT_DIR), "res://ai/trees"); GLOBAL_DEF(PropertyInfo(Variant::STRING, "limbo_ai/behavior_tree/behavior_tree_default_dir", PROPERTY_HINT_DIR), "res://ai/trees");

View File

@ -28,6 +28,7 @@
#include "editor/gui/editor_spin_slider.h" #include "editor/gui/editor_spin_slider.h"
#include "scene/gui/box_container.h" #include "scene/gui/box_container.h"
#include "scene/gui/control.h" #include "scene/gui/control.h"
#include "scene/gui/dialogs.h"
#include "scene/gui/file_dialog.h" #include "scene/gui/file_dialog.h"
#include "scene/gui/flow_container.h" #include "scene/gui/flow_container.h"
#include "scene/gui/line_edit.h" #include "scene/gui/line_edit.h"
@ -44,6 +45,7 @@
#endif // LIMBOAI_MODULE #endif // LIMBOAI_MODULE
#ifdef LIMBOAI_GDEXTENSION #ifdef LIMBOAI_GDEXTENSION
#include "godot_cpp/classes/accept_dialog.hpp"
#include <godot_cpp/classes/control.hpp> #include <godot_cpp/classes/control.hpp>
#include <godot_cpp/classes/editor_plugin.hpp> #include <godot_cpp/classes/editor_plugin.hpp>
#include <godot_cpp/classes/editor_spin_slider.hpp> #include <godot_cpp/classes/editor_spin_slider.hpp>
@ -83,8 +85,9 @@ private:
}; };
enum MiscMenu { enum MiscMenu {
MISC_INTRODUCTION,
MISC_ONLINE_DOCUMENTATION, MISC_ONLINE_DOCUMENTATION,
MISC_DOC_INTRODUCTION,
MISC_DOC_CUSTOM_TASKS,
MISC_OPEN_DEBUGGER, MISC_OPEN_DEBUGGER,
MISC_PROJECT_SETTINGS, MISC_PROJECT_SETTINGS,
MISC_CREATE_SCRIPT_TEMPLATE, MISC_CREATE_SCRIPT_TEMPLATE,
@ -107,6 +110,10 @@ private:
Ref<Texture2D> behavior_tree_icon; Ref<Texture2D> behavior_tree_icon;
} theme_cache; } theme_cache;
#ifdef LIMBOAI_GDEXTENSION
bool limitations_banner_shown = false;
#endif // LIMBOAI_GDEXTENSION
EditorPlugin *plugin; EditorPlugin *plugin;
Vector<Ref<BehaviorTree>> history; Vector<Ref<BehaviorTree>> history;
int idx_history; int idx_history;
@ -149,6 +156,8 @@ private:
Tree *disk_changed_list; Tree *disk_changed_list;
HashSet<String> disk_changed_files; HashSet<String> disk_changed_files;
AcceptDialog *info_dialog;
void _add_task(const Ref<BTTask> &p_task); void _add_task(const Ref<BTTask> &p_task);
Ref<BTTask> _create_task_by_class_or_path(const String &p_class_or_path) const; Ref<BTTask> _create_task_by_class_or_path(const String &p_class_or_path) const;
void _add_task_by_class_or_path(const String &p_class_or_path); void _add_task_by_class_or_path(const String &p_class_or_path);
@ -171,6 +180,7 @@ private:
void _reload_modified(); void _reload_modified();
void _resave_modified(String _str = ""); void _resave_modified(String _str = "");
void _popup_file_dialog(FileDialog *p_dialog) { p_dialog->popup_centered_clamped(Size2i(700, 500), 0.8f); } void _popup_file_dialog(FileDialog *p_dialog) { p_dialog->popup_centered_clamped(Size2i(700, 500), 0.8f); }
void _popup_info_dialog(const String &p_text);
void _rename_task_confirmed(); void _rename_task_confirmed();
void _on_tree_rmb(const Vector2 &p_menu_pos); void _on_tree_rmb(const Vector2 &p_menu_pos);

View File

@ -24,7 +24,6 @@ android.release.arm64 = "res://addons/limboai/bin/liblimboai.android.template_re
[icons] [icons]
BehaviorTree = "res://addons/limboai/icons/BehaviorTree.svg"
BTAction = "res://addons/limboai/icons/BTAction.svg" BTAction = "res://addons/limboai/icons/BTAction.svg"
BTAlwaysFail = "res://addons/limboai/icons/BTAlwaysFail.svg" BTAlwaysFail = "res://addons/limboai/icons/BTAlwaysFail.svg"
BTAlwaysSucceed = "res://addons/limboai/icons/BTAlwaysSucceed.svg" BTAlwaysSucceed = "res://addons/limboai/icons/BTAlwaysSucceed.svg"
@ -68,12 +67,13 @@ BTSubtree = "res://addons/limboai/icons/BTSubtree.svg"
BTTimeLimit = "res://addons/limboai/icons/BTTimeLimit.svg" BTTimeLimit = "res://addons/limboai/icons/BTTimeLimit.svg"
BTWait = "res://addons/limboai/icons/BTWait.svg" BTWait = "res://addons/limboai/icons/BTWait.svg"
BTWaitTicks = "res://addons/limboai/icons/BTWaitTicks.svg" BTWaitTicks = "res://addons/limboai/icons/BTWaitTicks.svg"
BehaviorTree = "res://addons/limboai/icons/BehaviorTree.svg"
LimboAI = "res://addons/limboai/icons/LimboAI.svg" LimboAI = "res://addons/limboai/icons/LimboAI.svg"
LimboDeselectAll = "res://addons/limboai/icons/LimboDeselectAll.svg" LimboDeselectAll = "res://addons/limboai/icons/LimboDeselectAll.svg"
LimboExtraBlackboard = "res://addons/limboai/icons/LimboExtraBlackboard.svg" LimboExtraBlackboard = "res://addons/limboai/icons/LimboExtraBlackboard.svg"
LimboExtraClock = "res://addons/limboai/icons/LimboExtraClock.svg" LimboExtraClock = "res://addons/limboai/icons/LimboExtraClock.svg"
LimboExtractSubtree = "res://addons/limboai/icons/LimboExtractSubtree.svg"
LimboExtraVariable = "res://addons/limboai/icons/LimboExtraVariable.svg" LimboExtraVariable = "res://addons/limboai/icons/LimboExtraVariable.svg"
LimboExtractSubtree = "res://addons/limboai/icons/LimboExtractSubtree.svg"
LimboHSM = "res://addons/limboai/icons/LimboHSM.svg" LimboHSM = "res://addons/limboai/icons/LimboHSM.svg"
LimboPercent = "res://addons/limboai/icons/LimboPercent.svg" LimboPercent = "res://addons/limboai/icons/LimboPercent.svg"
LimboSelectAll = "res://addons/limboai/icons/LimboSelectAll.svg" LimboSelectAll = "res://addons/limboai/icons/LimboSelectAll.svg"

View File

@ -28,7 +28,7 @@ HIGHLIGHT_COLOR='\033[1;36m' # Light Cyan
NC='\033[0m' # No Color NC='\033[0m' # No Color
ERROR_COLOR="\033[0;31m" # Red ERROR_COLOR="\033[0;31m" # Red
usage() { echo "Usage: $0 [--copy-demo]"; } usage() { echo "Usage: $0 [--copy-demo] [--copy-all] [--trash-old]"; }
msg () { echo -e "$@"; } msg () { echo -e "$@"; }
highlight() { echo -e "${HIGHLIGHT_COLOR}$@${NC}"; } highlight() { echo -e "${HIGHLIGHT_COLOR}$@${NC}"; }
@ -47,6 +47,8 @@ trap exit SIGINT
set -e set -e
copy_demo=0 copy_demo=0
copy_all=0
trash_old=0
# Parsing arguments # Parsing arguments
for i in "$@" for i in "$@"
@ -56,14 +58,43 @@ do
copy_demo=1 copy_demo=1
shift shift
;; ;;
--copy-all)
copy_demo=1
copy_all=1
shift
;;
--trash-old)
trash_old=1
shift
;;
*) *)
usage usage
exit 1
;; ;;
esac esac
done done
highlight Setup started. highlight Setup started.
${PYTHON} limboai/gdextension/update_icons.py --silent
highlight -- Icon declarations updated.
transfer="ln -s"
transfer_word="Linked"
if [ ${copy_all} == 1 ]; then
transfer="cp -R"
transfer_word="Copied"
fi
if [ ${trash_old} == 1 ]; then
if ! command -v trash &> /dev/null; then
error trash command not available. Aborting.
exit 1
fi
trash SConstruct limboai/demo/addons demo || /bin/true
highlight -- Trashed old setup.
fi
if [ ! -d "${PWD}/godot-cpp/" ]; then if [ ! -d "${PWD}/godot-cpp/" ]; then
highlight -- Cloning godot-cpp... highlight -- Cloning godot-cpp...
git clone -b ${GODOT_CPP_VERSION} https://github.com/godotengine/godot-cpp git clone -b ${GODOT_CPP_VERSION} https://github.com/godotengine/godot-cpp
@ -73,15 +104,15 @@ else
fi fi
if [ ! -f "${PWD}/SConstruct" ]; then if [ ! -f "${PWD}/SConstruct" ]; then
ln -s limboai/gdextension/SConstruct SConstruct ${transfer} limboai/gdextension/SConstruct SConstruct
highlight -- Linked SConstruct. highlight -- ${transfer_word} SConstruct.
else else
highlight -- Skipping \"SConstruct\". File already exists! highlight -- Skipping \"SConstruct\". File already exists!
fi fi
if [ ! -e "${PWD}/demo" ]; then if [ ! -e "${PWD}/demo" ]; then
if [ ${copy_demo} == 1 ]; then if [ ${copy_demo} == 1 ]; then
cp -r limboai/demo demo cp -R limboai/demo demo
highlight -- Copied demo. highlight -- Copied demo.
else else
ln -s limboai/demo demo ln -s limboai/demo demo
@ -91,48 +122,31 @@ else
highlight -- Skipping \"demo\". File already exists! highlight -- Skipping \"demo\". File already exists!
fi fi
# if [ -d "${PWD}/demo/" ]; then if [ ! -e "${PWD}/demo/addons/limboai/bin/limboai.gdextension" ]; then
# highlight -- Demo project exists. Archiving... mkdir -p ./demo/addons/limboai/bin/
# backup_version=1 cd ./demo/addons/limboai/bin/
# backup_dir="${PWD}/demo.old${backup_version}" if [ -f "../../../../gdextension/limboai.gdextension" ]; then
# while [ -d "${backup_dir}" ]; do ${transfer} ../../../../gdextension/limboai.gdextension limboai.gdextension
# ((backup_version++)) else
# backup_dir="${PWD}/demo.old${backup_version}" ${transfer} ../../../../limboai/gdextension/limboai.gdextension limboai.gdextension
# done fi
# mv demo/ ${backup_dir}
# highlight -- Demo project archived as \"$(basename ${backup_dir})\".
# fi
# if [ ! -d "${PWD}/demo/" ]; then
# cp -r limboai/demo demo
# highlight -- Copied demo project.
# else
# error Error: \"demo\" directory exists!
# exit 2
# fi
if [ ! -e "${PWD}/limboai/demo/addons/limboai/bin/limboai.gdextension" ]; then
ls -l
mkdir -p ./limboai/demo/addons/limboai/bin/
cd ./limboai/demo/addons/limboai/bin/
ln -s ../../../../gdextension/limboai.gdextension limboai.gdextension || ln -s ../../../../limboai/gdextension/limboai.gdextension limboai.gdextension
ls -l
cd - cd -
highlight -- Linked limboai.gdextension. highlight -- ${transfer_word} limboai.gdextension.
else else
highlight -- Skipping limboai.gdextension. File already exists! highlight -- Skipping limboai.gdextension. File already exists!
fi fi
if [ ! -e "${PWD}/limboai/demo/addons/limboai/icons/" ]; then if [ ! -e "${PWD}/demo/addons/limboai/icons/" ]; then
cd ./limboai/demo/addons/limboai/ cd ./demo/addons/limboai/
ln -s ../../../icons icons || ln -s ../../../limboai/icons icons if [ -d "../../../icons" ]; then
${transfer} ../../../icons icons
else
${transfer} ../../../limboai/icons icons
fi
cd - cd -
highlight -- Linked icons. highlight -- ${transfer_word} icons.
else else
highlight -- Skipping linking icons. File already exists! highlight -- Skipping icons. File already exists!
fi fi
${PYTHON} limboai/gdextension/update_icons.py --silent
highlight -- Icon declarations updated.
highlight Setup complete. highlight Setup complete.

View File

@ -58,9 +58,14 @@ def main():
content += "[icons]\n\n" content += "[icons]\n\n"
icon_files = []
icons_dir = os.path.join(config_dir, "../icons/") icons_dir = os.path.join(config_dir, "../icons/")
for icon_file in glob.glob(icons_dir + "/*.svg"): for icon_file in glob.glob(icons_dir + "/*.svg"):
icon_file = os.path.basename(icon_file) icon_file = os.path.basename(icon_file)
icon_files.append(icon_file)
icon_files.sort()
for icon_file in icon_files:
content += os.path.splitext(icon_file)[0] + " = \"res://addons/limboai/icons/" + icon_file + "\"\n" content += os.path.splitext(icon_file)[0] + " = \"res://addons/limboai/icons/" + icon_file + "\"\n"
f = open(config_path, "w") f = open(config_path, "w")

View File

@ -334,7 +334,7 @@ Ref<Shortcut> LimboUtility::get_shortcut(const String &p_path) const {
} }
void LimboUtility::open_doc_introduction() { void LimboUtility::open_doc_introduction() {
OS::get_singleton()->shell_open(vformat("https://limboai.readthedocs.io/en/%s/classes/class_behaviortree.html", OS::get_singleton()->shell_open(vformat("https://limboai.readthedocs.io/en/%s/getting-started/introduction.html",
LIMBO_DOC_VERSION)); LIMBO_DOC_VERSION));
} }
@ -343,6 +343,16 @@ void LimboUtility::open_doc_online() {
LIMBO_DOC_VERSION)); LIMBO_DOC_VERSION));
} }
void LimboUtility::open_doc_gdextension_limitations() {
OS::get_singleton()->shell_open(vformat("https://limboai.readthedocs.io/en/%s/getting-started/gdextension.html#limitations-of-the-gdextension-version",
LIMBO_DOC_VERSION));
}
void LimboUtility::open_doc_custom_tasks() {
OS::get_singleton()->shell_open(vformat("https://limboai.readthedocs.io/en/%s/getting-started/custom-tasks.html",
LIMBO_DOC_VERSION));
}
void LimboUtility::open_doc_class(const String &p_class_name) { void LimboUtility::open_doc_class(const String &p_class_name) {
if (p_class_name.begins_with("res://")) { if (p_class_name.begins_with("res://")) {
SHOW_DOC(vformat("class_name:\"%s\"", p_class_name)); SHOW_DOC(vformat("class_name:\"%s\"", p_class_name));

View File

@ -95,6 +95,8 @@ public:
void open_doc_introduction(); void open_doc_introduction();
void open_doc_online(); void open_doc_online();
void open_doc_gdextension_limitations();
void open_doc_custom_tasks();
void open_doc_class(const String &p_class_name); void open_doc_class(const String &p_class_name);
#endif // TOOLS_ENABLED #endif // TOOLS_ENABLED