Compare commits

...

28 Commits

Author SHA1 Message Date
Serhii Snitsaruk 1a192b6129
Port BBParam editor to GDExtension (#287) 2025-02-18 12:39:47 +01:00
Serhii Snitsaruk 8e3f37d46a
GHA: Update Godot version used in GDExtension workflow 2025-02-16 14:27:29 +01:00
Serhii Snitsaruk 98778c1645
GHA: Test with `strict_checks=yes` 2025-02-16 13:06:13 +01:00
Serhii Snitsaruk 7ca4c63191
Update demo due to 4.4 changes 2025-02-16 13:01:39 +01:00
Serhii Snitsaruk 8788d8bf12
Bump version to 1.4.0-dev 2025-02-16 12:59:26 +01:00
Serhii Snitsaruk f31d722320
Merge pull request #223 from Rubonnek/support-godot-4.4
Support Godot 4.4
2025-02-16 12:52:15 +01:00
Wilson E. Alvarez bbb4512437
Add guards around PROPERTY_HINT_NO_NODEPATH which is not available in GDExtension 2025-02-15 11:29:36 -05:00
Wilson E. Alvarez 43ec612949
Fix broken conversion: Ref<Script> to const String 2025-02-15 09:48:16 -05:00
Wilson E. Alvarez 998bf212b7
Fix unhandled PROPERTY_HINT_NO_NODEPATH warning
Due to upstream change:

	6f7525c396
2025-02-15 09:48:16 -05:00
Wilson E. Alvarez ec8eb4bf91
Override renamed EditorPlugin::get_name() method
Due to upstream change:

	0ab3dc273e
2025-02-15 09:48:16 -05:00
Wilson E. Alvarez 05cd3e67b0
Refactor EditorHelpBit usage
Due to upstream change:

	4e19ab8afe
2025-02-15 09:48:16 -05:00
Wilson E. Alvarez ed9762e62f
Fix unhandled PROPERTY_HINT_ONESHOT warning
Due to upstream change:

	761a20f7a7
2025-02-15 09:48:16 -05:00
Wilson E. Alvarez ac0b68aa13
Fix forbidden comparisons between Ref and nullptr.
Necessary when compiling with strict_checks=yes.

Due to upstream change:

	df29cc696f
2025-02-15 09:48:16 -05:00
Wilson E. Alvarez c3da26caba
Fix internal Button set_icon calls to set_button_icon
Due to upstream change:

    562c666e3d
2025-02-15 09:48:16 -05:00
Wilson E. Alvarez e9f6a6fea5
Fix unhandled PROPERTY_HINT_TOOL_BUTTON warning
Due to upstream change:

	85dfd89653
2025-02-15 09:48:16 -05:00
Wilson E. Alvarez c3144875df
Fix unhandled PROPERTY_HINT_DICTIONARY_TYPE warning
Due to upstream change:

	9853a69144
2025-02-15 09:48:16 -05:00
Wilson E. Alvarez e37ff39641
Update EditorMainScreen calls after its extraction
Due to upstream change:

	5e1c9d68aa
2025-02-15 09:48:16 -05:00
Serhii Snitsaruk 6292ee4404
chore: Move `update_rst` to `scripts/` dir 2025-02-15 13:40:54 +01:00
Serhii Snitsaruk 77dc9b3b85
GHA: Build editor targets for iOS & web GDExtension libs (#285)
Compile iOS & Web GDExtension libs with editor support.
2025-02-13 11:58:03 +01:00
Serhii Snitsaruk 88701e9f20
GDExtension: Build Android libs with editor features (#284)
Also, fix the macOS Vulkan SDK installation step in CI.

Resolves GH-282.
2025-02-12 12:05:50 +01:00
Serhii Snitsaruk 576df4092a
Bump version to 1.3.1 2025-02-02 21:22:51 +01:00
Serhii Snitsaruk b8f266588a
Fix duplicate UI banners (#279)
During the editor launch, duplicate UI banners may appear in the LimboAI tab. Maybe in some other instances too. This PR fixes this issue.
2025-02-02 21:19:58 +01:00
Serhii Snitsaruk eac7e56f42
Doc: Mention pre-built templates (#280) 2025-02-02 19:45:54 +01:00
namelessvoid 7aebed5897
Update Readme to accomodate new documentation structure
(cherry picked from commit fe87a87759)
2025-01-22 01:18:37 +01:00
Steven Schoen a6613c32f9
Navigate to subtree resource when clicked in editor (#276)
Co-authored-by: Steven Schoen <digisteve5@gmail.com>
2025-01-22 01:05:51 +01:00
Serhii Snitsaruk 76e02a75e5
Fix BTInstance not registered with debugger on BTPlayer.set_bt_instance() (#275) 2025-01-21 23:43:52 +01:00
Serhii Snitsaruk 1b9cf17339
Fix BTPlayer.set_behavior_tree() not populating Blackboard (#274) 2025-01-21 23:35:28 +01:00
Serhii Snitsaruk 0584b0401f
Bump version to 1.4.0-dev 2025-01-21 12:00:35 +01:00
90 changed files with 479 additions and 456 deletions

View File

@ -5,7 +5,7 @@ on:
godot-ref:
description: A tag, branch or commit hash in the Godot repository.
type: string
default: 4.3-stable
default: master
limboai-ref:
description: A tag, branch or commit hash in the LimboAI repository.
type: string
@ -13,7 +13,7 @@ on:
godot-cpp-ref:
description: A tag, branch or commit hash in the godot-cpp repository.
type: string
default: godot-4.3-stable
default: master
jobs:
cache-sha:

View File

@ -44,7 +44,8 @@ env:
SCONSFLAGS: use_mingw=yes dev_build=no
EM_VERSION: 3.1.45
EM_CACHE_FOLDER: "emsdk-cache"
GODOT_VERSION: 4.3-stable
GODOT_VERSION: 4.4-beta3
GODOT_REPO: godotengine/godot-builds
jobs:
gdextension:
@ -108,7 +109,7 @@ jobs:
- name: 🌐 Web (wasm32, debug)
runner: ubuntu-20.04
platform: web
target: template_debug
target: editor
arch: wasm32
should-build: ${{ !inputs.test-build }}
@ -122,7 +123,7 @@ jobs:
- name: 🤖 Android (arm64, debug)
runner: ubuntu-20.04
platform: android
target: template_debug
target: editor
arch: arm64
should-build: ${{ !inputs.test-build }}
@ -136,7 +137,7 @@ jobs:
- name: 🤖 Android (arm32, debug)
runner: ubuntu-20.04
platform: android
target: template_debug
target: editor
arch: arm32
should-build: ${{ !inputs.test-build }}
@ -150,7 +151,7 @@ jobs:
- name: 🤖 Android (x86_64, debug)
runner: ubuntu-20.04
platform: android
target: template_debug
target: editor
arch: x86_64
should-build: ${{ !inputs.test-build }}
@ -164,7 +165,7 @@ jobs:
- name: 🤖 Android (x86_32, debug)
runner: ubuntu-20.04
platform: android
target: template_debug
target: editor
arch: x86_32
should-build: ${{ !inputs.test-build }}
@ -178,7 +179,7 @@ jobs:
- name: 🍏 iOS (arm64, debug)
runner: macos-latest
platform: ios
target: template_debug
target: editor
arch: arm64
should-build: ${{ !inputs.test-build }}
@ -193,7 +194,7 @@ jobs:
- name: 🍏 iOS (simulator, debug)
runner: macos-latest
platform: ios
target: template_debug
target: editor
arch: universal
scons-flags: ios_simulator=yes
should-build: ${{ !inputs.test-build }}
@ -351,7 +352,7 @@ jobs:
echo "Downloading Godot ${GODOT_VERSION}"
mkdir bin
cd bin
wget "https://github.com/godotengine/godot/releases/download/${GODOT_VERSION}/Godot_v${GODOT_VERSION}_linux.x86_64.zip" -O godot.zip
wget "https://github.com/${GODOT_REPO}/releases/download/${GODOT_VERSION}/Godot_v${GODOT_VERSION}_linux.x86_64.zip" -O godot.zip
unzip godot.zip
rm godot.zip
mv Godot_* godot

View File

@ -168,10 +168,12 @@ jobs:
# ! Note: Vulkan SDK changed packaging, so we need to inline these steps for the time being.
#sh misc/scripts/install_vulkan_sdk_macos.sh
curl -L "https://sdk.lunarg.com/sdk/download/latest/mac/config.json" -o /tmp/vulkan-sdk.json
sdk_version=`jq -r '.version' /tmp/vulkan-sdk.json`
curl -L "https://sdk.lunarg.com/sdk/download/latest/mac/vulkan-sdk.zip" -o /tmp/vulkan-sdk.zip
unzip /tmp/vulkan-sdk.zip -d /tmp
/tmp/InstallVulkan.app/Contents/MacOS/InstallVulkan --accept-licenses --default-answer --confirm-command install
rm -Rf /tmp/InstallVulkan.app
/tmp/InstallVulkan-${sdk_version}.app/Contents/MacOS/InstallVulkan-${sdk_version} --accept-licenses --default-answer --confirm-command install
rm -Rf /tmp/InstallVulkan-${sdk_version}.app
rm -f /tmp/vulkan-sdk.zip
- name: Set up scons cache

View File

@ -26,8 +26,8 @@ concurrency:
# Global Settings.
env:
GODOT_REF: "4.3"
GODOT_CPP_REF: "godot-4.3-stable"
GODOT_REF: "master"
GODOT_CPP_REF: "master"
jobs:
unit-tests:
@ -36,7 +36,7 @@ jobs:
# Settings
env:
SCONSFLAGS: platform=linuxbsd target=editor arch=x86_64 production=false dev_build=true tests=true verbose=yes warnings=extra werror=yes
SCONSFLAGS: platform=linuxbsd target=editor arch=x86_64 production=false dev_build=true tests=true verbose=yes warnings=extra werror=yes strict_checks=yes
SCONS_CACHE_LIMIT: 7168
BIN: godot.linuxbsd.editor.dev.x86_64

View File

@ -5,7 +5,7 @@ on:
godot-ref:
description: A tag, branch or commit hash in the Godot repository.
type: string
default: 4.3
default: master
limboai-ref:
description: A tag, branch or commit hash in the LimboAI repository.
type: string
@ -20,7 +20,7 @@ on:
godot-ref:
description: A tag, branch or commit hash in the Godot repository.
type: string
default: 4.3
default: master
limboai-ref:
description: A tag, branch or commit hash in the LimboAI repository.
type: string

View File

@ -16,7 +16,7 @@
**LimboAI** is an open-source C++ plugin for **Godot Engine 4** providing a combination of
**Behavior Trees** and **State Machines**, which can be used together to create complex AI behaviors.
It comes with a behavior tree editor, built-in documentation, visual debugger, extensive demo project with a tutorial, and more!
While it is implemented in C++, it fully supports GDScript for [creating your own tasks](https://limboai.readthedocs.io/en/stable/getting-started/custom-tasks.html) and [states](https://limboai.readthedocs.io/en/stable/getting-started/hsm.html).
While it is implemented in C++, it fully supports GDScript for [creating your own tasks](https://limboai.readthedocs.io/en/stable/behavior-trees/custom-tasks.html) and [states](https://limboai.readthedocs.io/en/stable/hierarchical-state-machines/create-hsm.html).
If you enjoy using LimboAI, please **consider supporting** my efforts with a donation on Ko-fi 😊 Your contribution will help me continue developing and improving it.
@ -24,7 +24,7 @@ If you enjoy using LimboAI, please **consider supporting** my efforts with a don
![Textured screenshot](doc/images/behavior-tree-editor-debugger.png)
Behavior Trees are powerful hierarchical structures used to model and control the behavior of agents in a game (e.g., characters, enemies). They are designed to make it easier to create rich and highly modular behaviors for your games. To learn more about behavior trees, check out [Introduction to Behavior Trees](https://limboai.readthedocs.io/en/stable/getting-started/introduction.html) and our demo project, which includes a tutorial.
Behavior Trees are powerful hierarchical structures used to model and control the behavior of agents in a game (e.g., characters, enemies). They are designed to make it easier to create rich and highly modular behaviors for your games. To learn more about behavior trees, check out [Introduction to Behavior Trees](https://limboai.readthedocs.io/en/stable/behavior-trees/introduction.html) and our demo project, which includes a tutorial.
## Demonstration
@ -50,13 +50,13 @@ Behavior Trees are powerful hierarchical structures used to model and control th
- Execute `BehaviorTree` resources using the `BTPlayer` node.
- Create complex behaviors by combining and nesting tasks in a hierarchy.
- Control execution flow using composite, decorator, and condition tasks.
- [Create custom tasks](https://limboai.readthedocs.io/en/stable/getting-started/custom-tasks.html) by extending core classes: `BTAction`, `BTCondition`, `BTDecorator`, and `BTComposite`.
- [Create custom tasks](https://limboai.readthedocs.io/en/stable/behavior-trees/custom-tasks.html) by extending core classes: `BTAction`, `BTCondition`, `BTDecorator`, and `BTComposite`.
- Built-in class documentation.
- Blackboard system: Share data seamlessly between tasks using the `Blackboard`.
- Blackboard plans: Define variables in the BehaviorTree resource and override their values in the BTPlayer node.
- Plan editor: Manage variables, their data types and property hints.
- Blackboard scopes: Prevent name conflicts and enable advanced techniques like [sharing data between several agents](https://limboai.readthedocs.io/en/stable/getting-started/using-blackboard.html#sharing-data-between-several-agents).
- Blackboard parameters: [Export a BB parameter](https://limboai.readthedocs.io/en/stable/getting-started/using-blackboard.html#task-parameters), for which user can provide a value or bind it to a blackboard variable (can be used in custom tasks).
- Blackboard scopes: Prevent name conflicts and enable advanced techniques like [sharing data between several agents](https://limboai.readthedocs.io/en/stable/behavior-trees/using-blackboard.html#sharing-data-between-several-agents).
- Blackboard parameters: [Export a BB parameter](https://limboai.readthedocs.io/en/stable/behavior-trees/using-blackboard.html#task-parameters), for which user can provide a value or bind it to a blackboard variable (can be used in custom tasks).
- Inspector support for specifying blackboard variables (custom editor for exported `StringName` properties ending with "_var").
- Use the `BTSubtree` task to execute a tree from a different resource file, promoting organization and reusability.
- Visual Debugger: Inspect the execution of any BT in a running scene to identify and troubleshoot issues.
@ -67,24 +67,24 @@ Behavior Trees are powerful hierarchical structures used to model and control th
- Extend the `LimboState` class to implement state logic.
- `LimboHSM` node serves as a state machine that manages `LimboState` instances and transitions.
- `LimboHSM` is a state itself and can be nested within other `LimboHSM` instances.
- [Event-based](https://limboai.readthedocs.io/en/stable/getting-started/hsm.html#events-and-transitions): Transitions are associated with events and are triggered by the state machine when the relevant event is dispatched, allowing for better decoupling of transitions from state logic.
- [Event-based](https://limboai.readthedocs.io/en/stable/hierarchical-state-machines/create-hsm.html#events-and-transitions): Transitions are associated with events and are triggered by the state machine when the relevant event is dispatched, allowing for better decoupling of transitions from state logic.
- Combine state machines with behavior trees using `BTState` for advanced reactive AI.
- Delegation Option: Using the vanilla `LimboState`, [delegate the implementation](https://limboai.readthedocs.io/en/stable/getting-started/hsm.html#single-file-state-machine-setup) to your callback functions, making it perfect for rapid prototyping and game jams.
- Delegation Option: Using the vanilla `LimboState`, [delegate the implementation](https://limboai.readthedocs.io/en/stable/hierarchical-state-machines/create-hsm.html#single-file-state-machine-setup) to your callback functions, making it perfect for rapid prototyping and game jams.
- 🛈 Note: State machine setup and initialization require code; there is no GUI editor.
- **Tested:** Behavior tree tasks and HSM are covered by unit tests.
- **GDExtension:** LimboAI can be [used as extension](https://limboai.readthedocs.io/en/stable/getting-started/gdextension.html). Custom engine builds are not necessary.
- **GDExtension:** LimboAI can be [used as extension](https://limboai.readthedocs.io/en/stable/getting-started/getting-limboai.html#get-gdextension-version). Custom engine builds are not necessary.
- **Demo + Tutorial:** Check out our extensive demo project, which includes an introduction to behavior trees using examples.
## First steps
Follow the [First steps](https://limboai.readthedocs.io/en/stable/index.html#first-steps) guide to learn how to get started with LimboAI and the demo project.
Follow the [Getting started](https://limboai.readthedocs.io/en/stable/getting-started/getting-limboai.html) guide to learn how to get started with LimboAI and the demo project.
## Getting LimboAI
LimboAI can be used as either a C++ module or as a GDExtension shared library. GDExtension version is more convenient to use but somewhat limited in features. Whichever you choose to use, your project will stay compatible with both and you can switch from one to the other any time. See [Using GDExtension](https://limboai.readthedocs.io/en/stable/getting-started/gdextension.html).
LimboAI can be used as either a C++ module or as a GDExtension shared library. GDExtension version is more convenient to use but somewhat limited in features. Whichever you choose to use, your project will stay compatible with both and you can switch from one to the other any time. See [Using GDExtension](https://limboai.readthedocs.io/en/stable/getting-started/getting-limboai.html#get-gdextension-version).
### Precompiled builds
@ -109,15 +109,15 @@ LimboAI can be used as either a C++ module or as a GDExtension shared library. G
## Using the plugin
- Online Documentation: [stable](https://limboai.readthedocs.io/en/stable/index.html), [latest](https://limboai.readthedocs.io/en/latest/index.html)
- [First steps](https://limboai.readthedocs.io/en/stable/index.html#first-steps)
- [Introduction to Behavior Trees](https://limboai.readthedocs.io/en/stable/getting-started/introduction.html)
- [Creating custom tasks in GDScript](https://limboai.readthedocs.io/en/stable/getting-started/custom-tasks.html)
- [Sharing data using Blackboard](https://limboai.readthedocs.io/en/stable/getting-started/using-blackboard.html)
- [Accessing nodes in the scene tree](https://limboai.readthedocs.io/en/stable/getting-started/accessing-nodes.html)
- [State machines](https://limboai.readthedocs.io/en/stable/getting-started/hsm.html)
- [Using GDExtension](https://limboai.readthedocs.io/en/stable/getting-started/gdextension.html)
- [Getting started](https://limboai.readthedocs.io/en/stable/getting-started/getting-limboai.html)
- [Introduction to Behavior Trees](https://limboai.readthedocs.io/en/stable/behavior-trees/introduction.html)
- [Creating custom tasks in GDScript](https://limboai.readthedocs.io/en/stable/behavior-trees/custom-tasks.html)
- [Sharing data using Blackboard](https://limboai.readthedocs.io/en/stable/behavior-trees/using-blackboard.html)
- [Accessing nodes in the scene tree](https://limboai.readthedocs.io/en/stable/behavior-trees/accessing-nodes.html)
- [State machines](https://limboai.readthedocs.io/en/stable/hierarchical-state-machines/create-hsm.html)
- [Using GDExtension](https://limboai.readthedocs.io/en/stable/getting-started/getting-limboai.html#get-gdextension-version)
- [Using LimboAI with C#](https://limboai.readthedocs.io/en/stable/getting-started/c-sharp.html)
- [Class reference](https://limboai.readthedocs.io/en/stable/getting-started/featured-classes.html)
- [Class reference](https://limboai.readthedocs.io/en/stable/classes/featured-classes.html)
## Contributing

View File

@ -13,7 +13,7 @@
Variant BBNode::get_value(Node *p_scene_root, const Ref<Blackboard> &p_blackboard, const Variant &p_default) {
ERR_FAIL_NULL_V_MSG(p_scene_root, Variant(), "BBNode: get_value() failed - scene_root is null.");
ERR_FAIL_NULL_V_MSG(p_blackboard, Variant(), "BBNode: get_value() failed - blackboard is null.");
ERR_FAIL_COND_V_MSG(p_blackboard.is_null(), Variant(), "BBNode: get_value() failed - blackboard is null.");
Variant val;
if (get_value_source() == SAVED_VALUE) {

View File

@ -532,7 +532,7 @@ void BlackboardPlan::populate_blackboard(const Ref<Blackboard> &p_blackboard, bo
if (has_mapping) {
StringName target_var = parent_scope_mapping[p.first];
if (target_var != StringName()) {
ERR_CONTINUE_MSG(p_blackboard->get_parent() == nullptr, vformat("BlackboardPlan: Cannot link variable %s to parent scope because the parent scope is not set.", LimboUtility::get_singleton()->decorate_var(p.first)));
ERR_CONTINUE_MSG(p_blackboard->get_parent().is_null(), vformat("BlackboardPlan: Cannot link variable %s to parent scope because the parent scope is not set.", LimboUtility::get_singleton()->decorate_var(p.first)));
p_blackboard->link_var(p.first, p_blackboard->get_parent(), target_var);
}
} else if (is_bound) {

View File

@ -78,10 +78,10 @@ void BehaviorTree::copy_other(const Ref<BehaviorTree> &p_other) {
}
Ref<BTInstance> BehaviorTree::instantiate(Node *p_agent, const Ref<Blackboard> &p_blackboard, Node *p_instance_owner, Node *p_custom_scene_root) const {
ERR_FAIL_COND_V_MSG(root_task == nullptr, nullptr, "BehaviorTree: Instantiation failed - BT has no valid root task.");
ERR_FAIL_COND_V_MSG(root_task.is_null(), nullptr, "BehaviorTree: Instantiation failed - BT has no valid root task.");
ERR_FAIL_NULL_V_MSG(p_agent, nullptr, "BehaviorTree: Instantiation failed - agent can't be null.");
ERR_FAIL_NULL_V_MSG(p_instance_owner, nullptr, "BehaviorTree: Instantiation failed -- instance owner can't be null.");
ERR_FAIL_NULL_V_MSG(p_blackboard, nullptr, "BehaviorTree: Instantiation failed - blackboard can't be null.");
ERR_FAIL_COND_V_MSG(p_blackboard.is_null(), nullptr, "BehaviorTree: Instantiation failed - blackboard can't be null.");
Node *scene_root = p_custom_scene_root ? p_custom_scene_root : p_instance_owner->get_owner();
ERR_FAIL_NULL_V_MSG(scene_root, nullptr, "BehaviorTree: Instantiation failed - unable to establish scene root. This is likely due to the instance owner not being owned by a scene node and custom_scene_root being null.");
Ref<BTTask> root_copy = root_task->clone();

View File

@ -25,7 +25,7 @@
#endif
Ref<BTInstance> BTInstance::create(Ref<BTTask> p_root_task, String p_source_bt_path, Node *p_owner_node) {
ERR_FAIL_NULL_V(p_root_task, nullptr);
ERR_FAIL_COND_V(p_root_task.is_null(), nullptr);
ERR_FAIL_NULL_V(p_owner_node, nullptr);
Ref<BTInstance> inst;
inst.instantiate();
@ -83,7 +83,7 @@ void BTInstance::register_with_debugger() {
void BTInstance::unregister_with_debugger() {
#ifdef DEBUG_ENABLED
if (LimboDebugger::get_singleton()->is_active()) {
if (LimboDebugger::get_singleton() && LimboDebugger::get_singleton()->is_active()) {
LimboDebugger::get_singleton()->unregister_bt_instance(get_instance_id());
}
#endif
@ -103,7 +103,7 @@ double BTInstance::_get_mean_update_time_msec_and_reset() {
void BTInstance::_add_custom_monitor() {
ERR_FAIL_NULL(get_owner_node());
ERR_FAIL_NULL(root_task);
ERR_FAIL_COND(root_task.is_null());
ERR_FAIL_NULL(root_task->get_agent());
if (monitor_id == StringName()) {
@ -151,5 +151,6 @@ BTInstance::~BTInstance() {
emit_signal(LW_NAME(freed));
#ifdef DEBUG_ENABLED
_remove_custom_monitor();
unregister_with_debugger();
#endif
}

View File

@ -42,7 +42,7 @@
VARIANT_ENUM_CAST(BTPlayer::UpdateMode);
void BTPlayer::_load_tree() {
void BTPlayer::_instantiate_bt() {
bt_instance.unref();
ERR_FAIL_COND_MSG(!behavior_tree.is_valid(), "BTPlayer: Initialization failed - needs a valid behavior tree.");
ERR_FAIL_COND_MSG(!behavior_tree->get_root_task().is_valid(), "BTPlayer: Initialization failed - behavior tree has no valid root task.");
@ -70,6 +70,19 @@ void BTPlayer::_update_blackboard_plan() {
blackboard_plan->set_base_plan(behavior_tree.is_valid() ? behavior_tree->get_blackboard_plan() : nullptr);
}
void BTPlayer::_initialize() {
if (blackboard.is_null()) {
blackboard = Ref<Blackboard>(memnew(Blackboard));
}
if (blackboard_plan.is_valid()) {
// Don't overwrite existing blackboard values as they may be initialized from code.
blackboard_plan->populate_blackboard(blackboard, false, this, _get_scene_root());
}
if (behavior_tree.is_valid()) {
_instantiate_bt();
}
}
void BTPlayer::set_bt_instance(const Ref<BTInstance> &p_bt_instance) {
ERR_FAIL_COND_MSG(p_bt_instance.is_null(), "BTPlayer: Failed to set behavior tree instance - instance is null.");
ERR_FAIL_COND_MSG(!p_bt_instance->is_instance_valid(), "BTPlayer: Failed to set behavior tree instance - instance is not valid.");
@ -78,6 +91,11 @@ void BTPlayer::set_bt_instance(const Ref<BTInstance> &p_bt_instance) {
blackboard = p_bt_instance->get_blackboard();
agent_node = p_bt_instance->get_agent()->get_path();
#ifdef DEBUG_ENABLED
bt_instance->set_monitor_performance(monitor_performance);
bt_instance->register_with_debugger();
#endif // DEBUG_ENABLED
blackboard_plan.unref();
behavior_tree.unref();
}
@ -104,7 +122,8 @@ void BTPlayer::set_behavior_tree(const Ref<BehaviorTree> &p_tree) {
} else {
behavior_tree = p_tree;
if (get_owner() && is_inside_tree()) {
_load_tree();
_update_blackboard_plan();
_initialize();
}
}
}
@ -179,16 +198,7 @@ void BTPlayer::_notification(int p_notification) {
} break;
case NOTIFICATION_READY: {
if (!Engine::get_singleton()->is_editor_hint()) {
if (blackboard.is_null()) {
blackboard = Ref<Blackboard>(memnew(Blackboard));
}
if (blackboard_plan.is_valid()) {
// Don't overwrite existing blackboard values as they may be initialized from code.
blackboard_plan->populate_blackboard(blackboard, false, this, _get_scene_root());
}
if (behavior_tree.is_valid()) {
_load_tree();
}
_initialize();
} else {
_update_blackboard_plan();
}

View File

@ -48,8 +48,9 @@ private:
Ref<BTInstance> bt_instance;
void _load_tree();
void _instantiate_bt();
void _update_blackboard_plan();
void _initialize();
_FORCE_INLINE_ Node *_get_scene_root() const { return scene_root_hint ? scene_root_hint : get_owner(); }
protected:

View File

@ -98,7 +98,7 @@ void BTState::_update(double p_delta) {
// Bail out if a transition happened in the meantime.
return;
}
ERR_FAIL_NULL(bt_instance);
ERR_FAIL_COND(bt_instance.is_null());
BT::Status status = bt_instance->update(p_delta);
if (status == BTTask::SUCCESS) {
get_root()->dispatch(success_event, Variant());

View File

@ -30,7 +30,7 @@ PackedStringArray BTComment::get_configuration_warnings() {
if (get_child_count_excluding_comments() > 0) {
warnings.append("Can only have other comment tasks as children.");
}
if (get_parent() == nullptr) {
if (get_parent().is_null()) {
warnings.append("Can't be the root task.");
}
return warnings;

View File

@ -163,7 +163,7 @@ void BTTask::set_custom_name(const String &p_name) {
void BTTask::initialize(Node *p_agent, const Ref<Blackboard> &p_blackboard, Node *p_scene_root) {
ERR_FAIL_NULL(p_agent);
ERR_FAIL_NULL(p_blackboard);
ERR_FAIL_COND(p_blackboard.is_null());
ERR_FAIL_NULL(p_scene_root);
data.agent = p_agent;
data.blackboard = p_blackboard;

View File

@ -80,7 +80,7 @@ void BTCooldown::_chill() {
timer->set_time_left(duration);
} else {
timer = SCENE_TREE()->create_timer(duration, process_pause);
ERR_FAIL_NULL(timer);
ERR_FAIL_COND(timer.is_null());
timer->connect(LW_NAME(timeout), callable_mp(this, &BTCooldown::_on_timeout), CONNECT_ONE_SHOT);
}
}

View File

@ -32,16 +32,16 @@ void BTNewScope::set_blackboard_plan(const Ref<BlackboardPlan> &p_plan) {
#ifdef TOOLS_ENABLED
void BTNewScope::_set_parent_scope_plan_from_bt() {
ERR_FAIL_NULL(get_blackboard_plan());
ERR_FAIL_COND(get_blackboard_plan().is_null());
Ref<BehaviorTree> bt = get_root()->editor_get_behavior_tree();
ERR_FAIL_NULL(bt);
ERR_FAIL_COND(bt.is_null());
get_blackboard_plan()->set_parent_scope_plan_provider(Callable(bt.ptr(), "get_blackboard_plan"));
}
#endif // TOOLS_ENABLED
void BTNewScope::initialize(Node *p_agent, const Ref<Blackboard> &p_blackboard, Node *p_scene_root) {
ERR_FAIL_COND(p_agent == nullptr);
ERR_FAIL_COND(p_blackboard == nullptr);
ERR_FAIL_COND(p_blackboard.is_null());
Ref<Blackboard> bb;
if (blackboard_plan.is_valid()) {

28
compat/forward_decl.h Normal file
View File

@ -0,0 +1,28 @@
/**
* forward_decl.h
* =============================================================================
* Copyright (c) 2023-present Serhii Snitsaruk and the LimboAI contributors.
*
* 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.
* =============================================================================
*/
#ifndef FORWARD_DECL_H
#define FORWARD_DECL_H
// * It's necessary to enclose Godot forward declarations within the `godot`
// * namespace in GDExtension.
#ifdef LIMBOAI_MODULE
#define GODOT_FORWARD_DECLARATIONS()
#define ENDOF_FORWARD_DECLARATIONS()
#endif // ! LIMBOAI_MODULE
#ifdef LIMBOAI_GDEXTENSION
#define GODOT_FORWARD_DECLARATIONS() namespace godot {
#define ENDOF_FORWARD_DECLARATIONS() } //namespace godot
#endif // ! LIMBOAI_GDEXTENSION
#endif // ! FORWARD_DECL_H

View File

@ -1,14 +1,14 @@
[gd_scene load_steps=36 format=3 uid="uid://ooigbfhfy4wa"]
[ext_resource type="Texture2D" uid="uid://dlo1ine6p5di4" path="res://demo/assets/agent_bobby.png" id="1_1u51b"]
[ext_resource type="Script" path="res://demo/agents/scripts/agent_base.gd" id="1_n8vy2"]
[ext_resource type="Script" uid="uid://68wbhtvlbkqm" path="res://demo/agents/scripts/agent_base.gd" id="1_n8vy2"]
[ext_resource type="Texture2D" uid="uid://dj4oayt5ttvh8" path="res://demo/assets/fx.png" id="2_lv102"]
[ext_resource type="Texture2D" uid="uid://dwhhxj5557qrb" path="res://demo/assets/shadow.png" id="2_vr0jo"]
[ext_resource type="Texture2D" uid="uid://2uyxh7sy8qny" path="res://demo/assets/weapon_ninja_star.png" id="4_1c5xq"]
[ext_resource type="Texture2D" uid="uid://bdusy0qqtw0th" path="res://demo/assets/smoke.png" id="4_mnb6v"]
[ext_resource type="Script" path="res://demo/agents/scripts/health.gd" id="4_qwtrf"]
[ext_resource type="Script" path="res://demo/agents/scripts/hitbox.gd" id="5_taq6b"]
[ext_resource type="Script" path="res://demo/agents/scripts/hurtbox.gd" id="6_jnvxm"]
[ext_resource type="Script" uid="uid://5byn62y1oa76" path="res://demo/agents/scripts/health.gd" id="4_qwtrf"]
[ext_resource type="Script" uid="uid://dntc3c582m5w8" path="res://demo/agents/scripts/hitbox.gd" id="5_taq6b"]
[ext_resource type="Script" uid="uid://dq5h6yydckjc1" path="res://demo/agents/scripts/hurtbox.gd" id="6_jnvxm"]
[sub_resource type="RectangleShape2D" id="RectangleShape2D_2k81i"]
size = Vector2(140, 40)
@ -2334,6 +2334,7 @@ tracks/24/keys = {
[sub_resource type="Animation" id="Animation_msfb2"]
resource_name = "dodge"
length = 0.4
capture_included = true
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
@ -4374,22 +4375,22 @@ tracks/20/keys = {
[sub_resource type="AnimationLibrary" id="AnimationLibrary_ws2ti"]
_data = {
"RESET": SubResource("Animation_nvm4d"),
"attack_1": SubResource("Animation_8wj70"),
"attack_2": SubResource("Animation_s1dey"),
"attack_3": SubResource("Animation_g7a0r"),
"charge": SubResource("Animation_jcwlt"),
"charge_prepare": SubResource("Animation_sva81"),
"dance": SubResource("Animation_5k1rd"),
"death": SubResource("Animation_wei72"),
"dodge": SubResource("Animation_msfb2"),
"hurt": SubResource("Animation_gowr5"),
"idle": SubResource("Animation_gnqgt"),
"spit": SubResource("Animation_uow76"),
"summon": SubResource("Animation_5mxvi"),
"throw": SubResource("Animation_yn0t6"),
"throw_prepare": SubResource("Animation_kb56n"),
"walk": SubResource("Animation_fh06e")
&"RESET": SubResource("Animation_nvm4d"),
&"attack_1": SubResource("Animation_8wj70"),
&"attack_2": SubResource("Animation_s1dey"),
&"attack_3": SubResource("Animation_g7a0r"),
&"charge": SubResource("Animation_jcwlt"),
&"charge_prepare": SubResource("Animation_sva81"),
&"dance": SubResource("Animation_5k1rd"),
&"death": SubResource("Animation_wei72"),
&"dodge": SubResource("Animation_msfb2"),
&"hurt": SubResource("Animation_gowr5"),
&"idle": SubResource("Animation_gnqgt"),
&"spit": SubResource("Animation_uow76"),
&"summon": SubResource("Animation_5mxvi"),
&"throw": SubResource("Animation_yn0t6"),
&"throw_prepare": SubResource("Animation_kb56n"),
&"walk": SubResource("Animation_fh06e")
}
[node name="AgentBase" type="CharacterBody2D"]

View File

@ -0,0 +1 @@
uid://cw0jj6rj3e4dp

View File

@ -1,9 +1,9 @@
[gd_scene load_steps=18 format=3 uid="uid://wdauoepicegb"]
[ext_resource type="Script" path="res://demo/agents/fireball/fireball.gd" id="1_ituf4"]
[ext_resource type="Script" uid="uid://cw0jj6rj3e4dp" path="res://demo/agents/fireball/fireball.gd" id="1_ituf4"]
[ext_resource type="Texture2D" uid="uid://dwhhxj5557qrb" path="res://demo/assets/shadow.png" id="2_6n8mx"]
[ext_resource type="Texture2D" uid="uid://235liwnxn1n5" path="res://demo/assets/fireball.png" id="3_1an0e"]
[ext_resource type="Script" path="res://demo/agents/scripts/hitbox.gd" id="4_rjhgc"]
[ext_resource type="Script" uid="uid://dntc3c582m5w8" path="res://demo/agents/scripts/hitbox.gd" id="4_rjhgc"]
[ext_resource type="Texture2D" uid="uid://bdusy0qqtw0th" path="res://demo/assets/smoke.png" id="5_dcbp6"]
[sub_resource type="Curve" id="Curve_mukra"]
@ -104,8 +104,8 @@ tracks/0/keys = {
[sub_resource type="AnimationLibrary" id="AnimationLibrary_cphpk"]
_data = {
"RESET": SubResource("Animation_wr7y0"),
"default": SubResource("Animation_ey8it")
&"RESET": SubResource("Animation_wr7y0"),
&"default": SubResource("Animation_ey8it")
}
[node name="Fireball" type="Node2D"]

View File

@ -0,0 +1 @@
uid://ea3wq7unbfaw

View File

@ -1,9 +1,9 @@
[gd_scene load_steps=10 format=3 uid="uid://bj5n72nomeaci"]
[ext_resource type="Script" path="res://demo/agents/ninja_star/ninja_star.gd" id="1_pja57"]
[ext_resource type="Script" uid="uid://ea3wq7unbfaw" path="res://demo/agents/ninja_star/ninja_star.gd" id="1_pja57"]
[ext_resource type="Texture2D" uid="uid://2uyxh7sy8qny" path="res://demo/assets/weapon_ninja_star.png" id="1_ptof7"]
[ext_resource type="Texture2D" uid="uid://dwhhxj5557qrb" path="res://demo/assets/shadow.png" id="2_2rj5a"]
[ext_resource type="Script" path="res://demo/agents/scripts/hitbox.gd" id="2_iem02"]
[ext_resource type="Script" uid="uid://dntc3c582m5w8" path="res://demo/agents/scripts/hitbox.gd" id="2_iem02"]
[ext_resource type="Texture2D" uid="uid://bdusy0qqtw0th" path="res://demo/assets/smoke.png" id="5_t37aw"]
[sub_resource type="CircleShape2D" id="CircleShape2D_7uc1b"]

View File

@ -0,0 +1 @@
uid://cgqdrwywolo6a

View File

@ -1,11 +1,11 @@
[gd_scene load_steps=8 format=3 uid="uid://d07ag5dcje13i"]
[ext_resource type="PackedScene" uid="uid://ooigbfhfy4wa" path="res://demo/agents/agent_base.tscn" id="1_mswd4"]
[ext_resource type="Script" path="res://demo/agents/player/player.gd" id="2_24nyi"]
[ext_resource type="Script" path="res://demo/agents/player/states/idle_state.gd" id="3_ekb12"]
[ext_resource type="Script" path="res://demo/agents/player/states/move_state.gd" id="4_paikn"]
[ext_resource type="Script" path="res://demo/agents/player/states/attack_state.gd" id="5_mpgu6"]
[ext_resource type="Script" path="res://demo/agents/player/states/dodge_state.gd" id="6_7o4a6"]
[ext_resource type="Script" uid="uid://cgqdrwywolo6a" path="res://demo/agents/player/player.gd" id="2_24nyi"]
[ext_resource type="Script" uid="uid://cig7kaq6hm5nd" path="res://demo/agents/player/states/idle_state.gd" id="3_ekb12"]
[ext_resource type="Script" uid="uid://bu4henvxerree" path="res://demo/agents/player/states/move_state.gd" id="4_paikn"]
[ext_resource type="Script" uid="uid://csbtng53jffek" path="res://demo/agents/player/states/attack_state.gd" id="5_mpgu6"]
[ext_resource type="Script" uid="uid://di111ridlwuy5" path="res://demo/agents/player/states/dodge_state.gd" id="6_7o4a6"]
[sub_resource type="RectangleShape2D" id="RectangleShape2D_8pofm"]
size = Vector2(150, 50)

View File

@ -0,0 +1 @@
uid://csbtng53jffek

View File

@ -0,0 +1 @@
uid://di111ridlwuy5

View File

@ -0,0 +1 @@
uid://cig7kaq6hm5nd

View File

@ -0,0 +1 @@
uid://bu4henvxerree

View File

@ -0,0 +1 @@
uid://68wbhtvlbkqm

View File

@ -0,0 +1 @@
uid://5byn62y1oa76

View File

@ -0,0 +1 @@
uid://dntc3c582m5w8

View File

@ -0,0 +1 @@
uid://dq5h6yydckjc1

View File

@ -0,0 +1 @@
uid://df82exuqnfdb2

View File

@ -0,0 +1 @@
uid://bi5e8366xi5s5

View File

@ -0,0 +1 @@
uid://dbo0kq2cwb4qv

View File

@ -0,0 +1 @@
uid://ccr43pgd4488l

View File

@ -0,0 +1 @@
uid://b7v2utjmtge0x

View File

@ -0,0 +1 @@
uid://dbhd2dvt77sm4

View File

@ -0,0 +1 @@
uid://b8ljqe213ud7d

View File

@ -0,0 +1 @@
uid://dcjgktglb1slf

View File

@ -0,0 +1 @@
uid://ct71h72pech3b

View File

@ -0,0 +1 @@
uid://bicxffqmm7ek

View File

@ -1,8 +1,8 @@
[gd_resource type="BehaviorTree" load_steps=21 format=3 uid="uid://bpdm5jnegi38"]
[ext_resource type="Script" path="res://demo/ai/tasks/get_first_in_group.gd" id="1_2jpsu"]
[ext_resource type="Script" path="res://demo/ai/tasks/pursue.gd" id="2_h5db5"]
[ext_resource type="Script" path="res://demo/ai/tasks/face_target.gd" id="3_bpmfp"]
[ext_resource type="Script" uid="uid://ccr43pgd4488l" path="res://demo/ai/tasks/get_first_in_group.gd" id="1_2jpsu"]
[ext_resource type="Script" uid="uid://dcjgktglb1slf" path="res://demo/ai/tasks/pursue.gd" id="2_h5db5"]
[ext_resource type="Script" uid="uid://dbo0kq2cwb4qv" path="res://demo/ai/tasks/face_target.gd" id="3_bpmfp"]
[sub_resource type="BlackboardPlan" id="BlackboardPlan_46tbn"]
var/speed/name = &"speed"

View File

@ -1,10 +1,10 @@
[gd_resource type="BehaviorTree" load_steps=28 format=3 uid="uid://ylife72ym5et"]
[ext_resource type="Script" path="res://demo/ai/tasks/get_first_in_group.gd" id="1_657p6"]
[ext_resource type="Script" path="res://demo/ai/tasks/select_flanking_pos.gd" id="2_t3udh"]
[ext_resource type="Script" path="res://demo/ai/tasks/arrive_pos.gd" id="3_u2ra5"]
[ext_resource type="Script" path="res://demo/ai/tasks/face_target.gd" id="4_xwjl7"]
[ext_resource type="Script" path="res://demo/ai/tasks/move_forward.gd" id="5_ucvak"]
[ext_resource type="Script" uid="uid://ccr43pgd4488l" path="res://demo/ai/tasks/get_first_in_group.gd" id="1_657p6"]
[ext_resource type="Script" uid="uid://ct71h72pech3b" path="res://demo/ai/tasks/select_flanking_pos.gd" id="2_t3udh"]
[ext_resource type="Script" uid="uid://df82exuqnfdb2" path="res://demo/ai/tasks/arrive_pos.gd" id="3_u2ra5"]
[ext_resource type="Script" uid="uid://dbo0kq2cwb4qv" path="res://demo/ai/tasks/face_target.gd" id="4_xwjl7"]
[ext_resource type="Script" uid="uid://b8ljqe213ud7d" path="res://demo/ai/tasks/move_forward.gd" id="5_ucvak"]
[sub_resource type="BlackboardPlan" id="BlackboardPlan_qd806"]
var/speed/name = &"speed"

View File

@ -1,10 +1,10 @@
[gd_resource type="BehaviorTree" load_steps=30 format=3 uid="uid://c2bxoo68ywb27"]
[ext_resource type="Script" path="res://demo/ai/tasks/select_random_nearby_pos.gd" id="1_cdtqu"]
[ext_resource type="Script" path="res://demo/ai/tasks/arrive_pos.gd" id="2_31fsn"]
[ext_resource type="Script" path="res://demo/ai/tasks/get_first_in_group.gd" id="3_y1r1a"]
[ext_resource type="Script" path="res://demo/ai/tasks/pursue.gd" id="4_jlgat"]
[ext_resource type="Script" path="res://demo/ai/tasks/face_target.gd" id="5_o4ggh"]
[ext_resource type="Script" uid="uid://bicxffqmm7ek" path="res://demo/ai/tasks/select_random_nearby_pos.gd" id="1_cdtqu"]
[ext_resource type="Script" uid="uid://df82exuqnfdb2" path="res://demo/ai/tasks/arrive_pos.gd" id="2_31fsn"]
[ext_resource type="Script" uid="uid://ccr43pgd4488l" path="res://demo/ai/tasks/get_first_in_group.gd" id="3_y1r1a"]
[ext_resource type="Script" uid="uid://dcjgktglb1slf" path="res://demo/ai/tasks/pursue.gd" id="4_jlgat"]
[ext_resource type="Script" uid="uid://dbo0kq2cwb4qv" path="res://demo/ai/tasks/face_target.gd" id="5_o4ggh"]
[sub_resource type="BlackboardPlan" id="BlackboardPlan_46tbn"]
var/speed/name = &"speed"

View File

@ -1,12 +1,12 @@
[gd_resource type="BehaviorTree" load_steps=44 format=3 uid="uid://qqmjvbeibatn"]
[ext_resource type="Script" path="res://demo/ai/tasks/get_first_in_group.gd" id="1_2883n"]
[ext_resource type="Script" path="res://demo/ai/tasks/select_flanking_pos.gd" id="2_cjso2"]
[ext_resource type="Script" path="res://demo/ai/tasks/pursue.gd" id="2_lpckh"]
[ext_resource type="Script" path="res://demo/ai/tasks/arrive_pos.gd" id="3_treio"]
[ext_resource type="Script" path="res://demo/ai/tasks/face_target.gd" id="4_57x51"]
[ext_resource type="Script" path="res://demo/ai/tasks/in_range.gd" id="5_p5dih"]
[ext_resource type="Script" path="res://demo/ai/tasks/back_away.gd" id="6_fkv0k"]
[ext_resource type="Script" uid="uid://ccr43pgd4488l" path="res://demo/ai/tasks/get_first_in_group.gd" id="1_2883n"]
[ext_resource type="Script" uid="uid://ct71h72pech3b" path="res://demo/ai/tasks/select_flanking_pos.gd" id="2_cjso2"]
[ext_resource type="Script" uid="uid://dcjgktglb1slf" path="res://demo/ai/tasks/pursue.gd" id="2_lpckh"]
[ext_resource type="Script" uid="uid://df82exuqnfdb2" path="res://demo/ai/tasks/arrive_pos.gd" id="3_treio"]
[ext_resource type="Script" uid="uid://dbo0kq2cwb4qv" path="res://demo/ai/tasks/face_target.gd" id="4_57x51"]
[ext_resource type="Script" uid="uid://b7v2utjmtge0x" path="res://demo/ai/tasks/in_range.gd" id="5_p5dih"]
[ext_resource type="Script" uid="uid://bi5e8366xi5s5" path="res://demo/ai/tasks/back_away.gd" id="6_fkv0k"]
[sub_resource type="BlackboardPlan" id="BlackboardPlan_46tbn"]
var/speed/name = &"speed"

View File

@ -1,10 +1,10 @@
[gd_resource type="BehaviorTree" load_steps=41 format=3 uid="uid://cqluon1y1hnn5"]
[ext_resource type="Script" path="res://demo/ai/tasks/get_first_in_group.gd" id="1_4xk1i"]
[ext_resource type="Script" path="res://demo/ai/tasks/is_aligned_with_target.gd" id="2_a8qex"]
[ext_resource type="Script" path="res://demo/ai/tasks/arrive_pos.gd" id="3_q4r2p"]
[ext_resource type="Script" path="res://demo/ai/tasks/select_flanking_pos.gd" id="4_53hao"]
[ext_resource type="Script" path="res://demo/ai/tasks/face_target.gd" id="5_aexyq"]
[ext_resource type="Script" uid="uid://ccr43pgd4488l" path="res://demo/ai/tasks/get_first_in_group.gd" id="1_4xk1i"]
[ext_resource type="Script" uid="uid://dbhd2dvt77sm4" path="res://demo/ai/tasks/is_aligned_with_target.gd" id="2_a8qex"]
[ext_resource type="Script" uid="uid://df82exuqnfdb2" path="res://demo/ai/tasks/arrive_pos.gd" id="3_q4r2p"]
[ext_resource type="Script" uid="uid://ct71h72pech3b" path="res://demo/ai/tasks/select_flanking_pos.gd" id="4_53hao"]
[ext_resource type="Script" uid="uid://dbo0kq2cwb4qv" path="res://demo/ai/tasks/face_target.gd" id="5_aexyq"]
[sub_resource type="BlackboardPlan" id="BlackboardPlan_46tbn"]
var/speed/name = &"speed"

View File

@ -1,10 +1,10 @@
[gd_resource type="BehaviorTree" load_steps=39 format=3 uid="uid://cpncl1db8j12f"]
[ext_resource type="Script" path="res://demo/ai/tasks/get_first_in_group.gd" id="1_sf4l8"]
[ext_resource type="Script" path="res://demo/ai/tasks/select_flanking_pos.gd" id="2_5nwkp"]
[ext_resource type="Script" path="res://demo/ai/tasks/arrive_pos.gd" id="3_3tom2"]
[ext_resource type="Script" path="res://demo/ai/tasks/face_target.gd" id="4_hi228"]
[ext_resource type="Script" path="res://demo/ai/tasks/move_forward.gd" id="5_au5yc"]
[ext_resource type="Script" uid="uid://ccr43pgd4488l" path="res://demo/ai/tasks/get_first_in_group.gd" id="1_sf4l8"]
[ext_resource type="Script" uid="uid://ct71h72pech3b" path="res://demo/ai/tasks/select_flanking_pos.gd" id="2_5nwkp"]
[ext_resource type="Script" uid="uid://df82exuqnfdb2" path="res://demo/ai/tasks/arrive_pos.gd" id="3_3tom2"]
[ext_resource type="Script" uid="uid://dbo0kq2cwb4qv" path="res://demo/ai/tasks/face_target.gd" id="4_hi228"]
[ext_resource type="Script" uid="uid://b8ljqe213ud7d" path="res://demo/ai/tasks/move_forward.gd" id="5_au5yc"]
[sub_resource type="BlackboardPlan" id="BlackboardPlan_46tbn"]
var/speed/name = &"speed"

View File

@ -1,10 +1,10 @@
[gd_resource type="BehaviorTree" load_steps=49 format=3 uid="uid://c2u6sljqkim0n"]
[ext_resource type="Script" path="res://demo/ai/tasks/get_first_in_group.gd" id="1_08fik"]
[ext_resource type="Script" path="res://demo/ai/tasks/select_flanking_pos.gd" id="2_te3yo"]
[ext_resource type="Script" path="res://demo/ai/tasks/arrive_pos.gd" id="3_svwk8"]
[ext_resource type="Script" path="res://demo/ai/tasks/face_target.gd" id="4_mvsyw"]
[ext_resource type="Script" path="res://demo/ai/tasks/pursue.gd" id="5_r1ou0"]
[ext_resource type="Script" uid="uid://ccr43pgd4488l" path="res://demo/ai/tasks/get_first_in_group.gd" id="1_08fik"]
[ext_resource type="Script" uid="uid://ct71h72pech3b" path="res://demo/ai/tasks/select_flanking_pos.gd" id="2_te3yo"]
[ext_resource type="Script" uid="uid://df82exuqnfdb2" path="res://demo/ai/tasks/arrive_pos.gd" id="3_svwk8"]
[ext_resource type="Script" uid="uid://dbo0kq2cwb4qv" path="res://demo/ai/tasks/face_target.gd" id="4_mvsyw"]
[ext_resource type="Script" uid="uid://dcjgktglb1slf" path="res://demo/ai/tasks/pursue.gd" id="5_r1ou0"]
[sub_resource type="BlackboardPlan" id="BlackboardPlan_46tbn"]
var/speed/name = &"speed"

View File

@ -1,11 +1,11 @@
[gd_resource type="BehaviorTree" load_steps=49 format=3 uid="uid://cpcnbi81jqge4"]
[ext_resource type="Script" path="res://demo/ai/tasks/get_first_in_group.gd" id="1_ce4la"]
[ext_resource type="Script" path="res://demo/ai/tasks/in_range.gd" id="2_atyuj"]
[ext_resource type="Script" path="res://demo/ai/tasks/face_target.gd" id="3_3mw7l"]
[ext_resource type="Script" path="res://demo/ai/tasks/back_away.gd" id="4_6dr32"]
[ext_resource type="Script" path="res://demo/ai/tasks/select_flanking_pos.gd" id="5_dho0d"]
[ext_resource type="Script" path="res://demo/ai/tasks/arrive_pos.gd" id="6_0pfsl"]
[ext_resource type="Script" uid="uid://ccr43pgd4488l" path="res://demo/ai/tasks/get_first_in_group.gd" id="1_ce4la"]
[ext_resource type="Script" uid="uid://b7v2utjmtge0x" path="res://demo/ai/tasks/in_range.gd" id="2_atyuj"]
[ext_resource type="Script" uid="uid://dbo0kq2cwb4qv" path="res://demo/ai/tasks/face_target.gd" id="3_3mw7l"]
[ext_resource type="Script" uid="uid://bi5e8366xi5s5" path="res://demo/ai/tasks/back_away.gd" id="4_6dr32"]
[ext_resource type="Script" uid="uid://ct71h72pech3b" path="res://demo/ai/tasks/select_flanking_pos.gd" id="5_dho0d"]
[ext_resource type="Script" uid="uid://df82exuqnfdb2" path="res://demo/ai/tasks/arrive_pos.gd" id="6_0pfsl"]
[sub_resource type="BlackboardPlan" id="BlackboardPlan_8ay3j"]
var/speed/name = &"speed"

View File

@ -1,7 +1,7 @@
[gd_resource type="BehaviorTree" load_steps=35 format=3 uid="uid://cpxk7jnqpwwlc"]
[ext_resource type="Script" path="res://demo/ai/tasks/select_random_nearby_pos.gd" id="1_sgn0p"]
[ext_resource type="Script" path="res://demo/ai/tasks/arrive_pos.gd" id="2_pshl2"]
[ext_resource type="Script" uid="uid://bicxffqmm7ek" path="res://demo/ai/tasks/select_random_nearby_pos.gd" id="1_sgn0p"]
[ext_resource type="Script" uid="uid://df82exuqnfdb2" path="res://demo/ai/tasks/arrive_pos.gd" id="2_pshl2"]
[sub_resource type="BlackboardPlan" id="BlackboardPlan_58oq1"]
var/speed/name = &"speed"

View File

@ -23,6 +23,7 @@ allow_system_fallback=true
force_autohinter=false
hinting=1
subpixel_positioning=1
keep_rounding_remainders=true
oversampling=0.0
Fallbacks=null
fallbacks=[]

View File

@ -23,6 +23,7 @@ allow_system_fallback=true
force_autohinter=false
hinting=1
subpixel_positioning=1
keep_rounding_remainders=true
oversampling=0.0
Fallbacks=null
fallbacks=[]

View File

@ -0,0 +1 @@
uid://mapy7metn1kt

View File

@ -1,10 +1,10 @@
[gd_scene load_steps=11 format=3 uid="uid://c5fhe3tulhlco"]
[ext_resource type="Script" path="res://demo/props/dummy.gd" id="1_kqftw"]
[ext_resource type="Script" uid="uid://mapy7metn1kt" path="res://demo/props/dummy.gd" id="1_kqftw"]
[ext_resource type="Texture2D" uid="uid://cltutcxjx8jnl" path="res://demo/assets/dummy.png" id="1_vdhcl"]
[ext_resource type="Texture2D" uid="uid://dwhhxj5557qrb" path="res://demo/assets/shadow.png" id="2_535g7"]
[ext_resource type="Script" path="res://demo/agents/scripts/hurtbox.gd" id="4_pkfnd"]
[ext_resource type="Script" path="res://demo/agents/scripts/health.gd" id="5_8qcls"]
[ext_resource type="Script" uid="uid://dq5h6yydckjc1" path="res://demo/agents/scripts/hurtbox.gd" id="4_pkfnd"]
[ext_resource type="Script" uid="uid://5byn62y1oa76" path="res://demo/agents/scripts/health.gd" id="5_8qcls"]
[sub_resource type="Animation" id="Animation_1o3gy"]
length = 0.001
@ -345,9 +345,9 @@ tracks/8/keys = {
[sub_resource type="AnimationLibrary" id="AnimationLibrary_blnjx"]
_data = {
"RESET": SubResource("Animation_1o3gy"),
"hurt": SubResource("Animation_3r20x"),
"idle": SubResource("Animation_sf5ej")
&"RESET": SubResource("Animation_1o3gy"),
&"hurt": SubResource("Animation_3r20x"),
&"idle": SubResource("Animation_sf5ej")
}
[sub_resource type="RectangleShape2D" id="RectangleShape2D_pknym"]

View File

@ -0,0 +1 @@
uid://d3cmj6skb7k07

View File

@ -1,11 +1,11 @@
[gd_scene load_steps=12 format=3 uid="uid://bpd1wmw2f7bvg"]
[ext_resource type="Script" path="res://demo/props/gong.gd" id="1_77c1i"]
[ext_resource type="Script" uid="uid://d3cmj6skb7k07" path="res://demo/props/gong.gd" id="1_77c1i"]
[ext_resource type="Texture2D" uid="uid://i476iia1ua8q" path="res://demo/assets/env_gong.png" id="1_kbnv6"]
[ext_resource type="Texture2D" uid="uid://dwhhxj5557qrb" path="res://demo/assets/shadow.png" id="1_vl1mv"]
[ext_resource type="Texture2D" uid="uid://dj4oayt5ttvh8" path="res://demo/assets/fx.png" id="2_dib3m"]
[ext_resource type="Script" path="res://demo/agents/scripts/hurtbox.gd" id="5_xeb5y"]
[ext_resource type="Script" path="res://demo/agents/scripts/health.gd" id="6_6a3q1"]
[ext_resource type="Script" uid="uid://dq5h6yydckjc1" path="res://demo/agents/scripts/hurtbox.gd" id="5_xeb5y"]
[ext_resource type="Script" uid="uid://5byn62y1oa76" path="res://demo/agents/scripts/health.gd" id="6_6a3q1"]
[sub_resource type="Animation" id="Animation_i5ovs"]
length = 0.001
@ -807,8 +807,8 @@ tracks/32/keys = {
[sub_resource type="AnimationLibrary" id="AnimationLibrary_332s2"]
_data = {
"RESET": SubResource("Animation_i5ovs"),
"struck": SubResource("Animation_ie54r")
&"RESET": SubResource("Animation_i5ovs"),
&"struck": SubResource("Animation_ie54r")
}
[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_nixvt"]

View File

@ -2824,8 +2824,8 @@ tracks/116/keys = {
[sub_resource type="AnimationLibrary" id="AnimationLibrary_an3cu"]
_data = {
"RESET": SubResource("Animation_gwtgs"),
"float": SubResource("Animation_75lmk")
&"RESET": SubResource("Animation_gwtgs"),
&"float": SubResource("Animation_75lmk")
}
[node name="Arena" type="Node2D"]

View File

@ -0,0 +1 @@
uid://cb8thyd7vi2nj

View File

@ -0,0 +1 @@
uid://c5p1i8ofpv7qn

View File

@ -0,0 +1 @@
uid://bwhv180m71qs4

View File

@ -1,10 +1,10 @@
[gd_scene load_steps=15 format=3 uid="uid://clyhgbpfpmtw7"]
[ext_resource type="Script" path="res://demo/scenes/game.gd" id="1_qw71e"]
[ext_resource type="Script" uid="uid://bwhv180m71qs4" path="res://demo/scenes/game.gd" id="1_qw71e"]
[ext_resource type="Theme" uid="uid://boqtjf88xcpu4" path="res://demo/assets/ui.theme" id="2_r21q3"]
[ext_resource type="Texture2D" uid="uid://tyu0ua1ju38l" path="res://demo/assets/logo.png" id="3_g0us4"]
[ext_resource type="FontFile" uid="uid://d25vkmce7mhlt" path="res://demo/assets/fonts/knewave_regular.ttf" id="4_w0vii"]
[ext_resource type="Script" path="res://demo/scenes/base/toggle_fullscreen.gd" id="5_m16ov"]
[ext_resource type="Script" uid="uid://c5p1i8ofpv7qn" path="res://demo/scenes/base/toggle_fullscreen.gd" id="5_m16ov"]
[ext_resource type="Texture2D" uid="uid://dlw15foygohrk" path="res://demo/assets/hp_under.png" id="6_622dk"]
[ext_resource type="Texture2D" uid="uid://cls8jtnu413o8" path="res://demo/assets/hp_over.png" id="7_430mt"]
[ext_resource type="Texture2D" uid="uid://hnwi23oef752" path="res://demo/assets/hp_bar.png" id="8_invih"]

View File

@ -0,0 +1 @@
uid://qpj1dk7ugnja

View File

@ -1,16 +1,16 @@
[gd_scene load_steps=16 format=3 uid="uid://b3ae14mc2ty3y"]
[ext_resource type="Script" path="res://demo/scenes/showcase.gd" id="1_l12ql"]
[ext_resource type="Script" uid="uid://qpj1dk7ugnja" path="res://demo/scenes/showcase.gd" id="1_l12ql"]
[ext_resource type="Theme" uid="uid://boqtjf88xcpu4" path="res://demo/assets/ui.theme" id="2_3d7dj"]
[ext_resource type="FontFile" uid="uid://d25vkmce7mhlt" path="res://demo/assets/fonts/knewave_regular.ttf" id="3_7vli5"]
[ext_resource type="FontFile" uid="uid://n231m6uqsq6x" path="res://demo/assets/fonts/junction_bold.otf" id="4_7ubu6"]
[ext_resource type="Texture2D" uid="uid://dc1wu244fnetf" path="res://demo/assets/arrow_left.png" id="5_bvrtp"]
[ext_resource type="Texture2D" uid="uid://tyu0ua1ju38l" path="res://demo/assets/logo.png" id="5_rwygb"]
[ext_resource type="Script" path="res://demo/scenes/base/toggle_fullscreen.gd" id="6_uggpo"]
[ext_resource type="Script" uid="uid://c5p1i8ofpv7qn" path="res://demo/scenes/base/toggle_fullscreen.gd" id="6_uggpo"]
[ext_resource type="Texture2D" uid="uid://bjakugmqbbtw7" path="res://demo/assets/arrow_right.png" id="7_5do2y"]
[ext_resource type="PackedScene" uid="uid://bsig1usigbbuy" path="res://demo/scenes/base/arena.tscn" id="7_42nq6"]
[ext_resource type="PackedScene" uid="uid://c5fhe3tulhlco" path="res://demo/props/dummy.tscn" id="8_apshw"]
[ext_resource type="Script" path="res://demo/scenes/base/code_edit.gd" id="9_txke7"]
[ext_resource type="Script" uid="uid://cb8thyd7vi2nj" path="res://demo/scenes/base/code_edit.gd" id="9_txke7"]
[sub_resource type="LabelSettings" id="LabelSettings_rdr7a"]
font = ExtResource("3_7vli5")

View File

@ -12,7 +12,7 @@ config_version=5
config/name="LimboAI Demo"
run/main_scene="res://demo/scenes/showcase.tscn"
config/features=PackedStringArray("4.3", "Forward Plus")
config/features=PackedStringArray("4.4", "Forward Plus")
config/icon="res://demo/assets/icon.svg"
[display]
@ -34,4 +34,5 @@ window/stretch/mode="canvas_items"
[limbo_ai]
behavior_tree/behavior_tree_default_dir="res://demo/ai/trees"
behavior_tree/user_task_dirs=PackedStringArray("res://demo/ai/tasks")
behavior_tree/user_task_dir_1="res://demo/ai/tasks"

View File

@ -66,5 +66,5 @@ option again to update and tidy up the XML files.
Sphinx RST files for the class documentation are generated from
XML files using the Godot script ``make_rst.py`` and stored in the ``doc/source/classes`` directory.
This process is performed using our own script ``gdextension/update_rst.sh``. RST files
This process is performed using our own script ``scripts/update_rst.sh``. RST files
in ``doc/source/classes`` should not be edited manually.

View File

@ -14,6 +14,10 @@ You can change your decision at any time - both versions are fully compatible.
Get GDExtension version
------------------------
Precompiled builds are available on the official
`LimboAI GitHub <https://github.com/limbonaut/limboai#getting-limboai>`_ page,
and in the Asset Library.
GDExtension is the most convenient way of using the LimboAI plugin, but it comes
with certain limitations:
@ -34,8 +38,7 @@ Get module version
-------------------
Precompiled builds are available on the official
`LimboAI GitHub <https://github.com/limbonaut/limboai#getting-limboai>`_ page,
and in the Asset Library (coming soon!).
`LimboAI GitHub <https://github.com/limbonaut/limboai#getting-limboai>`_ page.
Installation instructions:
@ -44,3 +47,5 @@ Installation instructions:
3. Extract the pre-compiled editor and the demo project files.
4. Launch the pre-compiled editor binary, import and open the demo project.
5. Run the project.
**Important**: To export your game using the module version of LimboAI, make sure to use the pre-compiled export templates included in the same GitHub release build.

View File

@ -46,7 +46,7 @@ LineEdit *BlackboardPlanEditor::_get_name_edit(int p_row_index) const {
}
void BlackboardPlanEditor::_add_var() {
ERR_FAIL_NULL(plan);
ERR_FAIL_COND(plan.is_null());
int suffix = 1;
StringName var_name = default_var_name == StringName() ? "var" : default_var_name;
@ -65,14 +65,14 @@ void BlackboardPlanEditor::_add_var() {
}
void BlackboardPlanEditor::_trash_var(int p_index) {
ERR_FAIL_NULL(plan);
ERR_FAIL_COND(plan.is_null());
StringName var_name = plan->get_var_by_index(p_index).first;
plan->remove_var(var_name);
_refresh();
}
void BlackboardPlanEditor::_rename_var(const StringName &p_new_name, int p_index) {
ERR_FAIL_NULL(plan);
ERR_FAIL_COND(plan.is_null());
LineEdit *name_edit = _get_name_edit(p_index);
ERR_FAIL_NULL(name_edit);
@ -96,7 +96,7 @@ void BlackboardPlanEditor::_rename_var(const StringName &p_new_name, int p_index
}
void BlackboardPlanEditor::_change_var_type(Variant::Type p_new_type, int p_index) {
ERR_FAIL_NULL(plan);
ERR_FAIL_COND(plan.is_null());
BBVariable var = plan->get_var_by_index(p_index).second;
if (var.get_type() == p_new_type) {
@ -115,14 +115,14 @@ void BlackboardPlanEditor::_change_var_type(Variant::Type p_new_type, int p_inde
}
void BlackboardPlanEditor::_change_var_hint(PropertyHint p_new_hint, int p_index) {
ERR_FAIL_NULL(plan);
ERR_FAIL_COND(plan.is_null());
plan->get_var_by_index(p_index).second.set_hint(p_new_hint);
plan->notify_property_list_changed();
_refresh();
}
void BlackboardPlanEditor::_change_var_hint_string(const String &p_new_hint_string, int p_index) {
ERR_FAIL_NULL(plan);
ERR_FAIL_COND(plan.is_null());
plan->get_var_by_index(p_index).second.set_hint_string(p_new_hint_string);
plan->notify_property_list_changed();
}
@ -278,7 +278,7 @@ void BlackboardPlanEditor::_refresh() {
Button *drag_button = memnew(Button);
props_hbox->add_child(drag_button);
drag_button->set_custom_minimum_size(Size2(28.0, 28.0) * EDSCALE);
BUTTON_SET_ICON(drag_button, theme_cache.grab_icon);
drag_button->set_button_icon(theme_cache.grab_icon);
drag_button->connect(LW_NAME(gui_input), callable_mp(this, &BlackboardPlanEditor::_drag_button_gui_input));
drag_button->connect(LW_NAME(button_down), callable_mp(this, &BlackboardPlanEditor::_drag_button_down).bind(row_panel));
drag_button->connect(LW_NAME(button_up), callable_mp(this, &BlackboardPlanEditor::_drag_button_up));
@ -297,7 +297,7 @@ void BlackboardPlanEditor::_refresh() {
type_choice->set_custom_minimum_size(Size2(170, 0.0) * EDSCALE);
type_choice->set_text(Variant::get_type_name(var.get_type()));
type_choice->set_tooltip_text(Variant::get_type_name(var.get_type()));
BUTTON_SET_ICON(type_choice, get_theme_icon(Variant::get_type_name(var.get_type()), LW_NAME(EditorIcons)));
type_choice->set_button_icon(get_theme_icon(Variant::get_type_name(var.get_type()), LW_NAME(EditorIcons)));
type_choice->set_text_overrun_behavior(TextServer::OVERRUN_TRIM_ELLIPSIS);
type_choice->set_flat(true);
type_choice->set_text_alignment(HORIZONTAL_ALIGNMENT_LEFT);
@ -326,7 +326,7 @@ void BlackboardPlanEditor::_refresh() {
Button *trash_button = memnew(Button);
props_hbox->add_child(trash_button);
trash_button->set_custom_minimum_size(Size2(24.0, 0.0) * EDSCALE);
BUTTON_SET_ICON(trash_button, theme_cache.trash_icon);
trash_button->set_button_icon(theme_cache.trash_icon);
trash_button->connect(LW_NAME(pressed), callable_mp(this, &BlackboardPlanEditor::_trash_var).bind(i));
}
}
@ -337,7 +337,7 @@ void BlackboardPlanEditor::_notification(int p_what) {
theme_cache.trash_icon = get_theme_icon(LW_NAME(Remove), LW_NAME(EditorIcons));
theme_cache.grab_icon = get_theme_icon(LW_NAME(TripleBar), LW_NAME(EditorIcons));
BUTTON_SET_ICON(add_var_tool, get_theme_icon(LW_NAME(Add), LW_NAME(EditorIcons)));
add_var_tool->set_button_icon(get_theme_icon(LW_NAME(Add), LW_NAME(EditorIcons)));
type_menu->clear();
for (int i = 0; i < Variant::VARIANT_MAX; i++) {
@ -472,14 +472,14 @@ BlackboardPlanEditor::BlackboardPlanEditor() {
// ***** EditorInspectorPluginBBPlan *****
void EditorInspectorPluginBBPlan::_edit_plan(const Ref<BlackboardPlan> &p_plan) {
ERR_FAIL_NULL(p_plan);
ERR_FAIL_COND(p_plan.is_null());
plan_editor->edit_plan(p_plan);
plan_editor->popup_centered();
}
void EditorInspectorPluginBBPlan::_open_base_plan(const Ref<BlackboardPlan> &p_plan) {
ERR_FAIL_NULL(p_plan);
ERR_FAIL_NULL(p_plan->get_base_plan());
ERR_FAIL_COND(p_plan.is_null());
ERR_FAIL_COND(p_plan->get_base_plan().is_null());
EditorInterface::get_singleton()->call_deferred("edit_resource", p_plan->get_base_plan());
}
@ -501,7 +501,7 @@ void EditorInspectorPluginBBPlan::parse_begin(Object *p_object) {
void EditorInspectorPluginBBPlan::_parse_begin(Object *p_object) {
#endif
Ref<BlackboardPlan> plan = Object::cast_to<BlackboardPlan>(p_object);
ERR_FAIL_NULL(plan);
ERR_FAIL_COND(plan.is_null());
PanelContainer *panel = memnew(PanelContainer);
ADD_STYLEBOX_OVERRIDE(panel, LW_NAME(panel), toolbar_style);
@ -522,7 +522,7 @@ void EditorInspectorPluginBBPlan::_parse_begin(Object *p_object) {
goto_btn->set_text(TTR("Edit Base"));
goto_btn->set_h_size_flags(Control::SIZE_SHRINK_CENTER);
goto_btn->set_custom_minimum_size(Size2(150.0, 0.0) * EDSCALE);
BUTTON_SET_ICON(goto_btn, EditorInterface::get_singleton()->get_editor_theme()->get_icon(LW_NAME(Edit), LW_NAME(EditorIcons)));
goto_btn->set_button_icon(EditorInterface::get_singleton()->get_editor_theme()->get_icon(LW_NAME(Edit), LW_NAME(EditorIcons)));
goto_btn->connect(LW_NAME(pressed), callable_mp(this, &EditorInspectorPluginBBPlan::_open_base_plan).bind(plan));
} else {
Button *edit_btn = memnew(Button);
@ -530,7 +530,7 @@ void EditorInspectorPluginBBPlan::_parse_begin(Object *p_object) {
edit_btn->set_text(TTR("Manage..."));
edit_btn->set_h_size_flags(Control::SIZE_SHRINK_CENTER);
edit_btn->set_custom_minimum_size(Size2(150.0, 0.0) * EDSCALE);
BUTTON_SET_ICON(edit_btn, EditorInterface::get_singleton()->get_editor_theme()->get_icon(LW_NAME(EditAddRemove), LW_NAME(EditorIcons)));
edit_btn->set_button_icon(EditorInterface::get_singleton()->get_editor_theme()->get_icon(LW_NAME(EditAddRemove), LW_NAME(EditorIcons)));
edit_btn->connect(LW_NAME(pressed), callable_mp(this, &EditorInspectorPluginBBPlan::_edit_plan).bind(plan));
}

View File

@ -209,7 +209,7 @@ void LimboDebuggerTab::_notification(int p_what) {
} break;
case NOTIFICATION_THEME_CHANGED: {
alert_icon->set_texture(get_theme_icon(LW_NAME(StatusWarning), LW_NAME(EditorIcons)));
BUTTON_SET_ICON(resource_header, LimboUtility::get_singleton()->get_task_icon("BehaviorTree"));
resource_header->set_button_icon(LimboUtility::get_singleton()->get_task_icon("BehaviorTree"));
} break;
}
}

View File

@ -11,37 +11,32 @@
#ifdef TOOLS_ENABLED
#ifdef LIMBOAI_MODULE
#include "editor_property_bb_param.h"
#include "../blackboard/bb_param/bb_param.h"
#include "../blackboard/bb_param/bb_variant.h"
#include "../util/limbo_string_names.h"
#include "editor_property_variable_name.h"
#include "mode_switch_button.h"
#include "core/error/error_macros.h"
#include "core/io/marshalls.h"
#include "core/object/class_db.h"
#include "core/object/object.h"
#include "core/object/ref_counted.h"
#include "core/os/memory.h"
#include "core/string/print_string.h"
#include "core/variant/variant.h"
#include "editor/editor_inspector.h"
#include "editor/editor_properties.h"
#include "editor/editor_properties_array_dict.h"
#include "editor/editor_properties_vector.h"
#include "editor/editor_settings.h"
#include "scene/gui/base_button.h"
#include "scene/gui/box_container.h"
#include "scene/gui/button.h"
#include "scene/gui/line_edit.h"
#ifdef LIMBOAI_MODULE
#include "editor/editor_interface.h"
#include "scene/gui/margin_container.h"
#include "scene/gui/menu_button.h"
#endif // LIMBOAI_MODULE
#ifdef LIMBOAI_GDEXTENSION
#include <godot_cpp/classes/editor_inspector.hpp>
#include <godot_cpp/classes/editor_interface.hpp>
#include <godot_cpp/classes/h_box_container.hpp>
#include <godot_cpp/classes/margin_container.hpp>
#include <godot_cpp/classes/menu_button.hpp>
#include <godot_cpp/classes/popup_menu.hpp>
#endif // LIMBOAI_GDEXTENSION
Ref<BBParam> EditorPropertyBBParam::_get_edited_param() {
Ref<BBParam> param = get_edited_property_value();
Ref<BBParam> param;
if (get_edited_object()) {
param = get_edited_object()->get(get_edited_property());
}
if (param.is_null()) {
// Create parameter resource if null.
param = ClassDB::instantiate(param_type);
@ -50,159 +45,50 @@ Ref<BBParam> EditorPropertyBBParam::_get_edited_param() {
return param;
}
void EditorPropertyBBParam::_create_value_editor(Variant::Type p_type) {
void EditorPropertyBBParam::_create_value_editor(Object *p_object, const String &p_property, Variant::Type p_type) {
if (value_editor) {
if (value_editor->get_meta(SNAME("_param_type")) == Variant(p_type)) {
if (value_editor->get_meta(LW_NAME(_param_type)) == Variant(p_type)) {
return;
}
_remove_value_editor();
}
const String hint_text = p_type == Variant::OBJECT ? "Resource" : "";
value_editor = EditorInterface::get_singleton()->get_inspector()->instantiate_property_editor(p_object, p_type, p_property, property_hint, hint_text, PROPERTY_USAGE_EDITOR);
bool is_bottom = false;
switch (p_type) {
case Variant::NIL: {
value_editor = memnew(EditorPropertyNil);
} break;
case Variant::BOOL: {
value_editor = memnew(EditorPropertyCheck);
} break;
case Variant::INT: {
EditorPropertyInteger *editor = memnew(EditorPropertyInteger);
editor->setup(-100000, 100000, 1, false, true, true);
value_editor = editor;
} break;
case Variant::FLOAT: {
EditorPropertyFloat *editor = memnew(EditorPropertyFloat);
editor->setup(-100000, 100000, EDITOR_GET("interface/inspector/default_float_step"), true, false, true, true);
value_editor = editor;
} break;
case Variant::STRING: {
if (property_hint == PROPERTY_HINT_MULTILINE_TEXT) {
value_editor = memnew(EditorPropertyMultilineText);
} else {
value_editor = memnew(EditorPropertyText);
}
is_bottom = (property_hint == PROPERTY_HINT_MULTILINE_TEXT);
} break;
case Variant::VECTOR2: {
EditorPropertyVector2 *editor = memnew(EditorPropertyVector2);
editor->setup(-100000, 100000, EDITOR_GET("interface/inspector/default_float_step"), true);
value_editor = editor;
} break;
case Variant::VECTOR2I: {
EditorPropertyVector2i *editor = memnew(EditorPropertyVector2i);
editor->setup(-100000, 100000);
value_editor = editor;
} break;
case Variant::RECT2: {
EditorPropertyRect2 *editor = memnew(EditorPropertyRect2);
editor->setup(-100000, 100000, EDITOR_GET("interface/inspector/default_float_step"), true);
value_editor = editor;
is_bottom = true;
} break;
case Variant::RECT2I: {
EditorPropertyRect2i *editor = memnew(EditorPropertyRect2i);
editor->setup(-100000, 100000);
value_editor = editor;
is_bottom = true;
} break;
case Variant::VECTOR3: {
EditorPropertyVector3 *editor = memnew(EditorPropertyVector3);
editor->setup(-100000, 100000, EDITOR_GET("interface/inspector/default_float_step"), true);
value_editor = editor;
is_bottom = true;
} break;
case Variant::VECTOR3I: {
EditorPropertyVector3i *editor = memnew(EditorPropertyVector3i);
editor->setup(-100000, 100000);
value_editor = editor;
is_bottom = true;
} break;
case Variant::VECTOR4: {
EditorPropertyVector4 *editor = memnew(EditorPropertyVector4);
editor->setup(-100000, 100000, EDITOR_GET("interface/inspector/default_float_step"), true);
value_editor = editor;
is_bottom = true;
} break;
case Variant::VECTOR4I: {
EditorPropertyVector4i *editor = memnew(EditorPropertyVector4i);
editor->setup(-100000, 100000);
value_editor = editor;
is_bottom = true;
} break;
case Variant::TRANSFORM2D: {
EditorPropertyTransform2D *editor = memnew(EditorPropertyTransform2D);
editor->setup(-100000, 100000, EDITOR_GET("interface/inspector/default_float_step"), true);
value_editor = editor;
is_bottom = true;
} break;
case Variant::PLANE: {
EditorPropertyPlane *editor = memnew(EditorPropertyPlane);
editor->setup(-100000, 100000, EDITOR_GET("interface/inspector/default_float_step"), true);
value_editor = editor;
is_bottom = true;
} break;
case Variant::QUATERNION: {
EditorPropertyQuaternion *editor = memnew(EditorPropertyQuaternion);
editor->setup(-100000, 100000, EDITOR_GET("interface/inspector/default_float_step"), true);
value_editor = editor;
is_bottom = true;
} break;
case Variant::AABB: {
EditorPropertyAABB *editor = memnew(EditorPropertyAABB);
editor->setup(-100000, 100000, EDITOR_GET("interface/inspector/default_float_step"), true);
value_editor = editor;
is_bottom = true;
} break;
case Variant::BASIS: {
EditorPropertyBasis *editor = memnew(EditorPropertyBasis);
editor->setup(-100000, 100000, EDITOR_GET("interface/inspector/default_float_step"), true);
value_editor = editor;
is_bottom = true;
} break;
case Variant::TRANSFORM3D: {
EditorPropertyTransform3D *editor = memnew(EditorPropertyTransform3D);
editor->setup(-100000, 100000, EDITOR_GET("interface/inspector/default_float_step"), true);
value_editor = editor;
is_bottom = true;
} break;
case Variant::PROJECTION: {
EditorPropertyProjection *editor = memnew(EditorPropertyProjection);
editor->setup(-100000, 100000, EDITOR_GET("interface/inspector/default_float_step"), true);
value_editor = editor;
is_bottom = true;
} break;
case Variant::COLOR: {
value_editor = memnew(EditorPropertyColor);
} break;
case Variant::STRING:
case Variant::STRING_NAME: {
EditorPropertyText *editor = memnew(EditorPropertyText);
editor->set_string_name(true);
value_editor = editor;
is_bottom = (property_hint == PROPERTY_HINT_MULTILINE_TEXT);
} break;
case Variant::NODE_PATH: {
value_editor = memnew(EditorPropertyNodePath);
} break;
// case Variant::RID: {
// } break;
// case Variant::SIGNAL: {
// } break;
// case Variant::CALLABLE: {
// } break;
case Variant::OBJECT: {
// Only resources are supported.
EditorPropertyResource *editor = memnew(EditorPropertyResource);
editor->setup(_get_edited_param().ptr(), SNAME("saved_value"), "Resource");
value_editor = editor;
is_bottom = true;
} break;
case Variant::DICTIONARY: {
value_editor = memnew(EditorPropertyDictionary);
is_bottom = true;
} break;
case Variant::NIL:
case Variant::BOOL:
case Variant::INT:
case Variant::FLOAT:
case Variant::VECTOR2:
case Variant::VECTOR2I:
case Variant::COLOR:
case Variant::NODE_PATH: {
is_bottom = false;
} break;
case Variant::RECT2:
case Variant::RECT2I:
case Variant::VECTOR3:
case Variant::VECTOR3I:
case Variant::VECTOR4:
case Variant::VECTOR4I:
case Variant::TRANSFORM2D:
case Variant::PLANE:
case Variant::QUATERNION:
case Variant::AABB:
case Variant::BASIS:
case Variant::TRANSFORM3D:
case Variant::PROJECTION:
case Variant::OBJECT:
case Variant::DICTIONARY:
case Variant::ARRAY:
case Variant::PACKED_BYTE_ARRAY:
case Variant::PACKED_INT32_ARRAY:
@ -213,23 +99,20 @@ void EditorPropertyBBParam::_create_value_editor(Variant::Type p_type) {
case Variant::PACKED_VECTOR2_ARRAY:
case Variant::PACKED_VECTOR3_ARRAY:
case Variant::PACKED_COLOR_ARRAY: {
EditorPropertyArray *editor = memnew(EditorPropertyArray);
editor->setup(p_type);
value_editor = editor;
is_bottom = true;
} break;
default: {
ERR_PRINT("Unexpected variant type!");
value_editor = memnew(EditorPropertyNil);
}
}
value_editor->set_name_split_ratio(0.0);
value_editor->set_use_folding(is_using_folding());
value_editor->set_selectable(false);
value_editor->set_h_size_flags(SIZE_EXPAND_FILL);
value_editor->set_meta(SNAME("_param_type"), p_type);
value_editor->connect(SNAME("property_changed"), callable_mp(this, &EditorPropertyBBParam::_value_edited));
value_editor->set_meta(LW_NAME(_param_type), p_type);
value_editor->connect(LW_NAME(property_changed), callable_mp(this, &EditorPropertyBBParam::_value_edited));
if (is_bottom) {
bottom_container->add_child(value_editor);
set_bottom_editor(bottom_container);
@ -272,7 +155,11 @@ void EditorPropertyBBParam::_variable_edited(const String &p_property, Variant p
_get_edited_param()->set_variable(p_value);
}
#ifdef LIMBOAI_MODULE
void EditorPropertyBBParam::update_property() {
#elif LIMBOAI_GDEXTENSION
void EditorPropertyBBParam::_update_property() {
#endif
if (!initialized) {
// Initialize UI -- needed after https://github.com/godotengine/godot/commit/db7175458a0532f1efe733f303ad2b55a02a52a5
_notification(NOTIFICATION_THEME_CHANGED);
@ -282,19 +169,20 @@ void EditorPropertyBBParam::update_property() {
if (param->get_value_source() == BBParam::BLACKBOARD_VAR) {
_remove_value_editor();
variable_editor->set_object_and_property(param.ptr(), SNAME("variable"));
variable_editor->set_object_and_property(param.ptr(), LW_NAME(variable));
variable_editor->setup(plan, false, param->get_variable_expected_type());
variable_editor->update_property();
variable_editor->show();
bottom_container->hide();
type_choice->set_icon(get_editor_theme_icon(SNAME("LimboExtraVariable")));
type_choice->set_button_icon(LimboUtility::get_singleton()->get_task_icon(LW_NAME(LimboExtraVariable)));
} else {
_create_value_editor(param->get_type());
// _create_value_editor(param->get_type());
_create_value_editor(param.ptr(), LW_NAME(saved_value), param->get_type());
variable_editor->hide();
value_editor->show();
value_editor->set_object_and_property(param.ptr(), SNAME("saved_value"));
value_editor->set_object_and_property(param.ptr(), LW_NAME(saved_value));
value_editor->update_property();
type_choice->set_icon(get_editor_theme_icon(Variant::get_type_name(param->get_type())));
type_choice->set_button_icon(get_theme_icon(Variant::get_type_name(param->get_type()), LW_NAME(EditorIcons)));
}
}
@ -316,27 +204,27 @@ void EditorPropertyBBParam::_notification(int p_what) {
{
String type = Variant::get_type_name(_get_edited_param()->get_type());
type_choice->set_icon(get_editor_theme_icon(type));
type_choice->set_button_icon(get_theme_icon(type, LW_NAME(EditorIcons)));
}
// Initialize type choice.
PopupMenu *type_menu = type_choice->get_popup();
type_menu->clear();
type_menu->add_icon_item(get_editor_theme_icon(SNAME("LimboExtraVariable")), TTR("Blackboard Variable"), ID_BIND_VAR);
type_menu->add_icon_item(LimboUtility::get_singleton()->get_task_icon(LW_NAME(LimboExtraVariable)), TTR("Blackboard Variable"), ID_BIND_VAR);
type_menu->add_separator();
Ref<BBParam> param = _get_edited_param();
bool is_variant_param = param->is_class_ptr(BBVariant::get_class_ptr_static());
bool is_variant_param = IS_CLASS(param, BBVariant);
if (is_variant_param) {
for (int i = 0; i < Variant::VARIANT_MAX; i++) {
if (i == Variant::RID || i == Variant::CALLABLE || i == Variant::SIGNAL) {
continue;
}
String type = Variant::get_type_name(Variant::Type(i));
type_menu->add_icon_item(get_editor_theme_icon(type), type, i);
type_menu->add_icon_item(get_theme_icon(type, LW_NAME(EditorIcons)), type, i);
}
} else { // Not a variant param.
String type = Variant::get_type_name(param->get_type());
type_menu->add_icon_item(get_editor_theme_icon(type), type, param->get_type());
type_menu->add_icon_item(get_theme_icon(type, LW_NAME(EditorIcons)), type, param->get_type());
}
initialized = true;
@ -367,18 +255,26 @@ EditorPropertyBBParam::EditorPropertyBBParam() {
variable_editor = memnew(EditorPropertyVariableName);
editor_hbox->add_child(variable_editor);
variable_editor->set_h_size_flags(SIZE_EXPAND_FILL);
variable_editor->connect(SNAME("property_changed"), callable_mp(this, &EditorPropertyBBParam::_variable_edited));
variable_editor->connect(LW_NAME(property_changed), callable_mp(this, &EditorPropertyBBParam::_variable_edited));
param_type = SNAME("BBString");
param_type = LW_NAME(BBString);
}
//***** EditorInspectorPluginBBParam
#ifdef LIMBOAI_MODULE
bool EditorInspectorPluginBBParam::can_handle(Object *p_object) {
#elif LIMBOAI_GDEXTENSION
bool EditorInspectorPluginBBParam::_can_handle(Object *p_object) const {
#endif
return true; // Handles everything.
}
#ifdef LIMBOAI_MODULE
bool EditorInspectorPluginBBParam::parse_property(Object *p_object, const Variant::Type p_type, const String &p_path, const PropertyHint p_hint, const String &p_hint_text, const BitField<PropertyUsageFlags> p_usage, const bool p_wide) {
#elif LIMBOAI_GDEXTENSION
bool EditorInspectorPluginBBParam::_parse_property(Object *p_object, const Variant::Type p_type, const String &p_path, const PropertyHint p_hint, const String &p_hint_text, const BitField<PropertyUsageFlags> p_usage, const bool p_wide) {
#endif
if (p_hint == PROPERTY_HINT_RESOURCE_TYPE && p_hint_text.begins_with("BB")) {
// TODO: Add more rigid hint check.
EditorPropertyBBParam *editor = memnew(EditorPropertyBBParam());
@ -389,6 +285,4 @@ bool EditorInspectorPluginBBParam::parse_property(Object *p_object, const Varian
return false;
}
#endif // ! LIMBOAI_MODULE
#endif // ! TOOLS_ENABLED

View File

@ -14,19 +14,26 @@
#ifndef EDITOR_PROPERTY_BB_PARAM_H
#define EDITOR_PROPERTY_BB_PARAM_H
#include "../compat/forward_decl.h"
#ifdef LIMBOAI_MODULE
#include "editor/editor_inspector.h"
#endif // ! LIMBOAI_MODULE
#include "../blackboard/bb_param/bb_param.h"
#include "../blackboard/blackboard_plan.h"
#include "mode_switch_button.h"
#include "scene/gui/box_container.h"
#include "scene/gui/margin_container.h"
#include "scene/gui/menu_button.h"
#ifdef LIMBOAI_GDEXTENSION
#include <godot_cpp/classes/editor_inspector_plugin.hpp>
#include <godot_cpp/classes/editor_property.hpp>
using namespace godot;
#endif // ! LIMBOAI_GDEXTENSION
class EditorPropertyVariableName;
class BBParam;
class BlackboardPlan;
GODOT_FORWARD_DECLARATIONS()
class MarginContainer;
class MenuButton;
class HBoxContainer;
ENDOF_FORWARD_DECLARATIONS()
class EditorPropertyBBParam : public EditorProperty {
GDCLASS(EditorPropertyBBParam, EditorProperty);
@ -49,7 +56,7 @@ private:
Ref<BBParam> _get_edited_param();
void _create_value_editor(Variant::Type p_type);
void _create_value_editor(Object *p_object, const String &p_property, Variant::Type p_type);
void _remove_value_editor();
void _value_edited(const String &p_property, Variant p_value, const String &p_name = "", bool p_changing = false);
@ -57,10 +64,16 @@ private:
void _type_selected(int p_index);
protected:
static void _bind_methods() {}
void _notification(int p_what);
public:
#ifdef LIMBOAI_MODULE
virtual void update_property() override;
#elif LIMBOAI_GDEXTENSION
virtual void _update_property() override;
#endif
void setup(PropertyHint p_hint, const String &p_hint_text, const Ref<BlackboardPlan> &p_plan);
EditorPropertyBBParam();
@ -72,15 +85,21 @@ class EditorInspectorPluginBBParam : public EditorInspectorPlugin {
private:
Callable plan_getter;
protected:
static void _bind_methods() {}
public:
#ifdef LIMBOAI_MODULE
virtual bool can_handle(Object *p_object) override;
virtual bool parse_property(Object *p_object, const Variant::Type p_type, const String &p_path, const PropertyHint p_hint, const String &p_hint_text, const BitField<PropertyUsageFlags> p_usage, const bool p_wide = false) override;
#elif LIMBOAI_GDEXTENSION
virtual bool _can_handle(Object *p_object) const override;
virtual bool _parse_property(Object *p_object, const Variant::Type p_type, const String &p_path, const PropertyHint p_hint, const String &p_hint_text, const BitField<PropertyUsageFlags> p_usage, const bool p_wide = false) override;
#endif
void set_plan_getter(const Callable &p_getter) { plan_getter = p_getter; }
};
#endif // ! LIMBOAI_MODULE
#endif // ! EDITOR_PROPERTY_BB_PARAM_H
#endif // ! TOOLS_ENABLED

View File

@ -156,7 +156,7 @@ void EditorPropertyPropertyPath::_notification(int p_what) {
switch (p_what) {
case NOTIFICATION_ENTER_TREE:
case NOTIFICATION_THEME_CHANGED: {
BUTTON_SET_ICON(action_menu, get_theme_icon(LW_NAME(GuiTabMenuHl), LW_NAME(EditorIcons)));
action_menu->set_button_icon(get_theme_icon(LW_NAME(GuiTabMenuHl), LW_NAME(EditorIcons)));
action_menu->get_popup()->set_item_icon(ACTION_CLEAR, get_theme_icon(LW_NAME(Clear), LW_NAME(EditorIcons)));
action_menu->get_popup()->set_item_icon(ACTION_COPY, get_theme_icon(LW_NAME(ActionCopy), LW_NAME(EditorIcons)));
action_menu->get_popup()->set_item_icon(ACTION_EDIT, get_theme_icon(LW_NAME(Edit), LW_NAME(EditorIcons)));

View File

@ -36,7 +36,7 @@ int EditorPropertyVariableName::last_caret_column = 0;
//***** EditorPropertyVariableName
void EditorPropertyVariableName::_show_variables_popup() {
ERR_FAIL_NULL(plan);
ERR_FAIL_COND(plan.is_null());
variables_popup->clear();
variables_popup->reset_size();
@ -86,30 +86,30 @@ void EditorPropertyVariableName::_update_status() {
}
String var_name = name_edit->get_text();
if (var_name.is_empty() && allow_empty) {
BUTTON_SET_ICON(status_btn, theme_cache.var_empty_icon);
status_btn->set_button_icon(theme_cache.var_empty_icon);
status_btn->set_tooltip_text(TTR("Variable name not specified.\nClick to open the blackboard plan."));
} else if (plan->has_var(var_name)) {
if (expected_type == Variant::NIL || plan->get_var(var_name).get_type() == Variant::NIL || plan->get_var(var_name).get_type() == expected_type) {
BUTTON_SET_ICON(status_btn, theme_cache.var_exists_icon);
status_btn->set_button_icon(theme_cache.var_exists_icon);
status_btn->set_tooltip_text(TTR("This variable is present in the blackboard plan.\nClick to open the blackboard plan."));
} else {
BUTTON_SET_ICON(status_btn, theme_cache.var_error_icon);
status_btn->set_button_icon(theme_cache.var_error_icon);
status_btn->set_tooltip_text(TTR(vformat(
"The %s variable in the blackboard plan should be of type %s.\nClick to open the blackboard plan.",
LimboUtility::get_singleton()->decorate_var(var_name),
Variant::get_type_name(expected_type))));
}
} else if (name_edit->get_text().begins_with("_")) {
BUTTON_SET_ICON(status_btn, theme_cache.var_private_icon);
status_btn->set_button_icon(theme_cache.var_private_icon);
status_btn->set_tooltip_text(TTR("This variable is private and is not included in the blackboard plan.\nClick to open the blackboard plan."));
} else {
BUTTON_SET_ICON(status_btn, theme_cache.var_not_found_icon);
status_btn->set_button_icon(theme_cache.var_not_found_icon);
status_btn->set_tooltip_text(TTR("No matching variable found in the blackboard plan!\nClick to open the blackboard plan."));
}
}
void EditorPropertyVariableName::_status_pressed() {
ERR_FAIL_NULL(plan);
ERR_FAIL_COND(plan.is_null());
if (!plan->has_var(name_edit->get_text())) {
BlackboardPlanEditor::get_singleton()->set_defaults(name_edit->get_text(),
expected_type == Variant::NIL ? Variant::FLOAT : expected_type,
@ -120,14 +120,14 @@ void EditorPropertyVariableName::_status_pressed() {
}
void EditorPropertyVariableName::_status_mouse_entered() {
ERR_FAIL_NULL(plan);
ERR_FAIL_COND(plan.is_null());
if (!plan->has_var(name_edit->get_text())) {
BUTTON_SET_ICON(status_btn, theme_cache.var_add_icon);
status_btn->set_button_icon(theme_cache.var_add_icon);
}
}
void EditorPropertyVariableName::_status_mouse_exited() {
ERR_FAIL_NULL(plan);
ERR_FAIL_COND(plan.is_null());
_update_status();
}
@ -182,7 +182,7 @@ void EditorPropertyVariableName::_notification(int p_what) {
}
} break;
case NOTIFICATION_THEME_CHANGED: {
BUTTON_SET_ICON(drop_btn, get_theme_icon(LW_NAME(GuiOptionArrow), LW_NAME(EditorIcons)));
drop_btn->set_button_icon(get_theme_icon(LW_NAME(GuiOptionArrow), LW_NAME(EditorIcons)));
theme_cache.var_add_icon = LimboUtility::get_singleton()->get_task_icon(LW_NAME(LimboVarAdd));
theme_cache.var_exists_icon = LimboUtility::get_singleton()->get_task_icon(LW_NAME(LimboVarExists));
theme_cache.var_not_found_icon = LimboUtility::get_singleton()->get_task_icon(LW_NAME(LimboVarNotFound));
@ -262,7 +262,7 @@ bool EditorInspectorPluginVariableName::_parse_property(Object *p_object, const
Variant default_value;
if (is_mapping) {
plan.reference_ptr(Object::cast_to<BlackboardPlan>(p_object));
ERR_FAIL_NULL_V(plan, false);
ERR_FAIL_COND_V(plan.is_null(), false);
String var_name = p_path.trim_prefix("mapping/");
if (plan->has_var(var_name)) {
BBVariable variable = plan->get_var(var_name);
@ -277,7 +277,7 @@ bool EditorInspectorPluginVariableName::_parse_property(Object *p_object, const
plan = parent_plan;
}
}
ERR_FAIL_NULL_V(plan, false);
ERR_FAIL_COND_V(plan.is_null(), false);
} else {
plan = editor_plan_provider.call();
}

View File

@ -200,7 +200,7 @@ void LimboAIEditor::_remove_task(const Ref<BTTask> &p_task) {
ERR_FAIL_COND(p_task.is_null());
ERR_FAIL_COND(task_tree->get_bt().is_null());
EditorUndoRedoManager *undo_redo = _new_undo_redo_action(TTR("Remove BT Task"));
if (p_task->get_parent() == nullptr) {
if (p_task->get_parent().is_null()) {
ERR_FAIL_COND(task_tree->get_bt()->get_root_task() != p_task);
undo_redo->add_do_method(task_tree->get_bt().ptr(), LW_NAME(set_root_task), Variant());
undo_redo->add_undo_method(task_tree->get_bt().ptr(), LW_NAME(set_root_task), task_tree->get_bt()->get_root_task());
@ -745,7 +745,7 @@ void LimboAIEditor::_action_selected(int p_id) {
void LimboAIEditor::_on_probability_edited(double p_value) {
Ref<BTTask> selected = task_tree->get_selected();
ERR_FAIL_COND(selected == nullptr);
ERR_FAIL_COND(selected.is_null());
Ref<BTProbabilitySelector> probability_selector = selected->get_parent();
ERR_FAIL_COND(probability_selector.is_null());
if (percent_mode->is_pressed()) {
@ -893,6 +893,14 @@ void LimboAIEditor::_on_tree_task_activated() {
Ref<Script> scr = selected->get_script();
if (scr.is_valid()) {
EDIT_SCRIPT(scr->get_path());
} else if (IS_CLASS(selected, BTSubtree)) {
Ref<BehaviorTree> subtree = static_cast<Ref<BTSubtree>>(selected)->get_subtree();
if (subtree.is_valid()) {
EDIT_RESOURCE(subtree);
} else {
LimboUtility::get_singleton()->open_doc_class(selected->get_class());
}
EDIT_RESOURCE(subtree);
} else {
LimboUtility::get_singleton()->open_doc_class(selected->get_class());
}
@ -909,6 +917,7 @@ void LimboAIEditor::_on_visibility_changed() {
}
task_palette->refresh();
_update_banners();
}
_update_favorite_tasks();
@ -1243,7 +1252,7 @@ void LimboAIEditor::_tab_menu_option_selected(int p_id) {
} break;
case TAB_JUMP_TO_OWNER: {
Ref<BehaviorTree> bt = history[idx_history];
ERR_FAIL_NULL(bt);
ERR_FAIL_COND(bt.is_null());
String bt_path = bt->get_path();
if (!bt_path.is_empty()) {
owner_picker->pick_and_open_owner_of_resource(bt_path);
@ -1361,7 +1370,7 @@ void LimboAIEditor::_update_favorite_tasks() {
}
btn->set_text(task_name);
btn->set_meta(LW_NAME(task_meta), task_meta);
BUTTON_SET_ICON(btn, LimboUtility::get_singleton()->get_task_icon(task_meta));
btn->set_button_icon(LimboUtility::get_singleton()->get_task_icon(task_meta));
btn->set_tooltip_text(vformat(TTR("Add %s task."), task_name));
btn->set_flat(true);
btn->add_theme_constant_override(LW_NAME(icon_max_width), 16 * EDSCALE); // Force user icons to be of the proper size.
@ -1411,9 +1420,11 @@ void LimboAIEditor::_update_misc_menu() {
}
void LimboAIEditor::_update_banners() {
for (int i = 0; i < banners->get_child_count(); i++) {
for (int i = banners->get_child_count() - 1; i >= 0; i--) {
if (banners->get_child(i)->has_meta(LW_NAME(managed))) {
banners->get_child(i)->queue_free();
Node *banner = banners->get_child(i);
banners->remove_child(banner);
memfree(banner);
}
}
@ -1427,7 +1438,7 @@ void LimboAIEditor::_update_banners() {
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));
banners->call_deferred(LW_NAME(add_child), banner);
banners->add_child(banner);
}
}
@ -1441,7 +1452,7 @@ void LimboAIEditor::_update_banners() {
banner->add_action(TTR("Remove"), callable_mp(this, &LimboAIEditor::_remove_task_from_favorite).bind(task_meta), true);
banner->add_action(TTR("Edit Favorite Tasks..."), callable_mp(this, &LimboAIEditor::_edit_project_settings));
banner->set_meta(LW_NAME(managed), Variant(true));
banners->call_deferred(LW_NAME(add_child), banner);
banners->add_child(banner);
}
}
@ -1451,7 +1462,7 @@ void LimboAIEditor::_update_banners() {
banner->set_text(TTR("Restart required to apply changes to editor layout"));
banner->add_action(TTR("Save & Restart"), callable_mp(this, &LimboAIEditor::_save_and_restart), true);
banner->set_meta(LW_NAME(managed), Variant(true));
banners->call_deferred(LW_NAME(add_child), banner);
banners->add_child(banner);
}
}
@ -1500,7 +1511,6 @@ void LimboAIEditor::_notification(int p_what) {
task_tree->connect("task_activated", callable_mp(this, &LimboAIEditor::_on_tree_task_activated));
task_tree->connect("probability_clicked", callable_mp(this, &LimboAIEditor::_action_selected).bind(ACTION_EDIT_PROBABILITY));
task_tree->connect("visibility_changed", callable_mp(this, &LimboAIEditor::_on_visibility_changed));
task_tree->connect("visibility_changed", callable_mp(this, &LimboAIEditor::_update_banners));
save_btn->connect(LW_NAME(pressed), callable_mp(this, &LimboAIEditor::_on_save_pressed));
misc_btn->connect(LW_NAME(pressed), callable_mp(this, &LimboAIEditor::_update_misc_menu));
misc_btn->get_popup()->connect("id_pressed", callable_mp(this, &LimboAIEditor::_misc_option_selected));
@ -1532,11 +1542,11 @@ void LimboAIEditor::_notification(int p_what) {
ADD_STYLEBOX_OVERRIDE(tab_bar_panel, "panel", get_theme_stylebox("tabbar_background", "TabContainer"));
BUTTON_SET_ICON(new_btn, get_theme_icon(LW_NAME(New), LW_NAME(EditorIcons)));
BUTTON_SET_ICON(load_btn, get_theme_icon(LW_NAME(Load), LW_NAME(EditorIcons)));
BUTTON_SET_ICON(save_btn, get_theme_icon(LW_NAME(Save), LW_NAME(EditorIcons)));
BUTTON_SET_ICON(new_script_btn, get_theme_icon(LW_NAME(ScriptCreate), LW_NAME(EditorIcons)));
BUTTON_SET_ICON(misc_btn, get_theme_icon(LW_NAME(Tools), LW_NAME(EditorIcons)));
new_btn->set_button_icon(get_theme_icon(LW_NAME(New), LW_NAME(EditorIcons)));
load_btn->set_button_icon(get_theme_icon(LW_NAME(Load), LW_NAME(EditorIcons)));
save_btn->set_button_icon(get_theme_icon(LW_NAME(Save), LW_NAME(EditorIcons)));
new_script_btn->set_button_icon(get_theme_icon(LW_NAME(ScriptCreate), LW_NAME(EditorIcons)));
misc_btn->set_button_icon(get_theme_icon(LW_NAME(Tools), LW_NAME(EditorIcons)));
_update_favorite_tasks();
} break;
@ -1928,12 +1938,10 @@ void LimboAIEditorPlugin::_notification(int p_notification) {
EditorInspectorPluginPropertyPath *path_plugin = memnew(EditorInspectorPluginPropertyPath);
add_inspector_plugin(path_plugin);
#ifdef LIMBOAI_MODULE
// ! Only used in the module version.
EditorInspectorPluginBBParam *param_plugin = memnew(EditorInspectorPluginBBParam);
param_plugin->set_plan_getter(Callable(limbo_ai_editor, "get_edited_blackboard_plan"));
add_inspector_plugin(param_plugin);
#endif // LIMBOAI_MODULE
} break;
case NOTIFICATION_ENTER_TREE: {
// Add BehaviorTree to the list of resources that should open in a new inspector.

View File

@ -26,6 +26,7 @@
#include "core/object/class_db.h"
#include "core/object/object.h"
#include "core/templates/hash_set.h"
#include "editor/editor_main_screen.h"
#include "editor/editor_node.h"
#include "editor/editor_undo_redo_manager.h"
#include "editor/gui/editor_spin_slider.h"
@ -42,6 +43,7 @@
#include "scene/gui/popup.h"
#include "scene/gui/popup_menu.h"
#include "scene/gui/split_container.h"
#include "scene/gui/tab_bar.h"
#include "scene/gui/tree.h"
#include "scene/resources/texture.h"
#endif // LIMBOAI_MODULE
@ -295,7 +297,7 @@ public:
#ifdef LIMBOAI_MODULE
bool has_main_screen() const override { return true; }
virtual String get_name() const override { return "LimboAI"; }
virtual String get_plugin_name() const override { return "LimboAI"; }
virtual void make_visible(bool p_visible) override;
virtual void edit(Object *p_object) override;
virtual bool handles(Object *p_object) const override;

View File

@ -44,7 +44,7 @@ private:
_FORCE_INLINE_ void _set_mode_by_index(int p_index) {
current_mode_index = p_index;
BUTTON_SET_ICON(this, modes[current_mode_index].icon);
this->set_button_icon(modes[current_mode_index].icon);
if (!modes[current_mode_index].tooltip.is_empty()) {
set_tooltip_text(modes[current_mode_index].tooltip);
}

View File

@ -68,9 +68,6 @@ Control *TaskButton::_do_make_tooltip() const {
help_symbol = "class|" + task_meta + "|";
}
EditorHelpBit *help_bit = memnew(EditorHelpBit(help_symbol));
help_bit->set_content_height_limits(1, 360 * EDSCALE);
String desc = _module_get_help_description(task_meta);
if (desc.is_empty() && is_resource) {
// ! HACK: Force documentation parsing.
@ -84,14 +81,10 @@ Control *TaskButton::_do_make_tooltip() const {
desc = _module_get_help_description(task_meta);
}
}
if (desc.is_empty() && help_bit->get_description().is_empty()) {
if (desc.is_empty()) {
desc = "[i]" + TTR("No description.") + "[/i]";
}
if (!desc.is_empty()) {
help_bit->set_description(desc);
}
EditorHelpBitTooltip::show_tooltip(help_bit, const_cast<TaskButton *>(this));
EditorHelpBitTooltip::show_tooltip(const_cast<TaskButton *>(this), help_symbol, desc);
#endif // LIMBOAI_MODULE
#ifdef LIMBOAI_GDEXTENSION
@ -184,7 +177,7 @@ void TaskPaletteSection::set_filter(String p_filter_text) {
void TaskPaletteSection::add_task_button(const String &p_name, const Ref<Texture> &icon, const String &p_meta) {
TaskButton *btn = memnew(TaskButton);
btn->set_text(p_name);
BUTTON_SET_ICON(btn, icon);
btn->set_button_icon(icon);
btn->set_tooltip_text("dummy_text"); // Force tooltip to be shown.
btn->set_task_meta(p_meta);
btn->add_theme_constant_override(LW_NAME(icon_max_width), 16 * EDSCALE); // Force user icons to be of the proper size.
@ -195,7 +188,7 @@ void TaskPaletteSection::add_task_button(const String &p_name, const Ref<Texture
void TaskPaletteSection::set_collapsed(bool p_collapsed) {
tasks_container->set_visible(!p_collapsed);
BUTTON_SET_ICON(section_header, (p_collapsed ? theme_cache.arrow_right_icon : theme_cache.arrow_down_icon));
section_header->set_button_icon((p_collapsed ? theme_cache.arrow_right_icon : theme_cache.arrow_down_icon));
}
bool TaskPaletteSection::is_collapsed() const {
@ -214,7 +207,7 @@ void TaskPaletteSection::_notification(int p_what) {
} break;
case NOTIFICATION_THEME_CHANGED: {
_do_update_theme_item_cache();
BUTTON_SET_ICON(section_header, (is_collapsed() ? theme_cache.arrow_right_icon : theme_cache.arrow_down_icon));
section_header->set_button_icon((is_collapsed() ? theme_cache.arrow_right_icon : theme_cache.arrow_down_icon));
section_header->add_theme_font_override(LW_NAME(font), get_theme_font(LW_NAME(bold), LW_NAME(EditorFonts)));
} break;
}
@ -600,13 +593,13 @@ void TaskPalette::_notification(int p_what) {
case NOTIFICATION_THEME_CHANGED: {
_do_update_theme_item_cache();
BUTTON_SET_ICON(tool_filters, get_theme_icon(LW_NAME(AnimationFilter), LW_NAME(EditorIcons)));
BUTTON_SET_ICON(tool_refresh, get_theme_icon(LW_NAME(Reload), LW_NAME(EditorIcons)));
tool_filters->set_button_icon(get_theme_icon(LW_NAME(AnimationFilter), LW_NAME(EditorIcons)));
tool_refresh->set_button_icon(get_theme_icon(LW_NAME(Reload), LW_NAME(EditorIcons)));
filter_edit->set_right_icon(get_theme_icon(LW_NAME(Search), LW_NAME(EditorIcons)));
BUTTON_SET_ICON(select_all, LimboUtility::get_singleton()->get_task_icon("LimboSelectAll"));
BUTTON_SET_ICON(deselect_all, LimboUtility::get_singleton()->get_task_icon("LimboDeselectAll"));
select_all->set_button_icon(LimboUtility::get_singleton()->get_task_icon("LimboSelectAll"));
deselect_all->set_button_icon(LimboUtility::get_singleton()->get_task_icon("LimboDeselectAll"));
category_choice->queue_redraw();

View File

@ -192,7 +192,7 @@ void TaskTree::_on_item_collapsed(Object *p_obj) {
}
Ref<BTTask> task = item->get_metadata(0);
ERR_FAIL_NULL(task);
ERR_FAIL_COND(task.is_null());
task->set_display_collapsed(item->is_collapsed());
}
@ -574,7 +574,7 @@ void TaskTree::_bind_methods() {
// TreeSearch API
void TaskTree::tree_search_show_and_focus() {
ERR_FAIL_NULL(tree_search);
ERR_FAIL_COND(tree_search.is_null());
tree_search_panel->set_visible(true);
tree_search_panel->focus_editor();
}
@ -587,7 +587,7 @@ TreeSearch::SearchInfo TaskTree::tree_search_get_search_info() const {
}
void TaskTree::tree_search_set_search_info(const TreeSearch::SearchInfo &p_search_info) {
ERR_FAIL_NULL(tree_search);
ERR_FAIL_COND(tree_search.is_null());
tree_search_panel->set_search_info(p_search_info);
}

View File

@ -158,7 +158,7 @@ void TreeSearch::_draw_highlight_item(TreeItem *p_tree_item, const Rect2 p_rect,
if (font.is_null()) {
font = p_tree_item->get_tree()->get_theme_font(LW_NAME(font));
}
ERR_FAIL_NULL(font);
ERR_FAIL_COND(font.is_null());
float font_size = p_tree_item->get_custom_font_size(0);
if (font_size == -1) {
font_size = p_tree_item->get_tree()->get_theme_font_size(LW_NAME(font));
@ -176,7 +176,7 @@ void TreeSearch::_draw_highlight_item(TreeItem *p_tree_item, const Rect2 p_rect,
// Stylebox
Ref<StyleBox> stylebox = p_tree_item->get_tree()->get_theme_stylebox(LW_NAME(Focus));
ERR_FAIL_NULL(stylebox);
ERR_FAIL_COND(stylebox.is_null());
// Extract separation
float h_sep = p_tree_item->get_tree()->get_theme_constant(LW_NAME(h_separation));
@ -559,9 +559,9 @@ void TreeSearchPanel::_notification(int p_what) {
break;
}
case NOTIFICATION_THEME_CHANGED: {
BUTTON_SET_ICON(close_button, get_theme_icon(LW_NAME(Close), LW_NAME(EditorIcons)));
BUTTON_SET_ICON(find_prev_button, get_theme_icon("MoveUp", LW_NAME(EditorIcons)));
BUTTON_SET_ICON(find_next_button, get_theme_icon("MoveDown", LW_NAME(EditorIcons)));
close_button->set_button_icon(get_theme_icon(LW_NAME(Close), LW_NAME(EditorIcons)));
find_prev_button->set_button_icon(get_theme_icon("MoveUp", LW_NAME(EditorIcons)));
find_next_button->set_button_icon(get_theme_icon("MoveDown", LW_NAME(EditorIcons)));
label_filter->set_text(TTR("Filter"));
break;
}

View File

@ -17,19 +17,19 @@ linux.debug.arm64 = "res://addons/limboai/bin/liblimboai.linux.editor.arm64.so"
linux.release.arm64 = "res://addons/limboai/bin/liblimboai.linux.template_release.arm64.so"
linux.debug.rv64 = "res://addons/limboai/bin/liblimboai.linux.editor.rv64.so"
linux.release.rv64 = "res://addons/limboai/bin/liblimboai.linux.template_release.rv64.so"
android.debug.arm64 = "res://addons/limboai/bin/liblimboai.android.template_debug.arm64.so"
android.debug.arm64 = "res://addons/limboai/bin/liblimboai.android.editor.arm64.so"
android.release.arm64 = "res://addons/limboai/bin/liblimboai.android.template_release.arm64.so"
android.debug.arm32 = "res://addons/limboai/bin/liblimboai.android.template_debug.arm32.so"
android.debug.arm32 = "res://addons/limboai/bin/liblimboai.android.editor.arm32.so"
android.release.arm32 = "res://addons/limboai/bin/liblimboai.android.template_release.arm32.so"
android.debug.x86_64 = "res://addons/limboai/bin/liblimboai.android.template_debug.x86_64.so"
android.debug.x86_64 = "res://addons/limboai/bin/liblimboai.android.editor.x86_64.so"
android.release.x86_64 = "res://addons/limboai/bin/liblimboai.android.template_release.x86_64.so"
android.debug.x86_32 = "res://addons/limboai/bin/liblimboai.android.template_debug.x86_32.so"
android.debug.x86_32 = "res://addons/limboai/bin/liblimboai.android.editor.x86_32.so"
android.release.x86_32 = "res://addons/limboai/bin/liblimboai.android.template_release.x86_32.so"
ios.debug.arm64 = "res://addons/limboai/bin/liblimboai.ios.editor.arm64.dylib"
ios.release.arm64 = "res://addons/limboai/bin/liblimboai.ios.template_release.arm64.dylib"
ios.debug.arm64 = "res://addons/limboai/bin/liblimboai.ios.template_debug.arm64.dylib"
ios.debug.simulator = "res://addons/limboai/bin/liblimboai.ios.editor.universal.dylib"
ios.release.simulator = "res://addons/limboai/bin/liblimboai.ios.template_release.universal.dylib"
ios.debug.simulator = "res://addons/limboai/bin/liblimboai.ios.template_debug.universal.dylib"
web.debug.wasm32 = "res://addons/limboai/bin/liblimboai.web.template_debug.wasm32.wasm"
web.debug.wasm32 = "res://addons/limboai/bin/liblimboai.web.editor.wasm32.wasm"
web.release.wasm32 = "res://addons/limboai/bin/liblimboai.web.template_release.wasm32.wasm"
[icons]

View File

@ -1,11 +1,11 @@
# Edit the following variables to change version info
major = 1
minor = 3
minor = 4
patch = 0
status = ""
doc_branch = "v1.3.0"
godot_cpp_ref = "godot-4.3-stable"
status = "dev"
doc_branch = "latest"
godot_cpp_ref = "master"
# Code that generates version header

View File

@ -100,6 +100,7 @@
#include "editor/debugger/behavior_tree_data.h"
#include "editor/debugger/limbo_debugger.h"
#include "editor/debugger/limbo_debugger_plugin.h"
#include "editor/editor_property_bb_param.h"
#include "editor/mode_switch_button.h"
#include "editor/tree_search.h"
#include "hsm/limbo_hsm.h"
@ -268,6 +269,8 @@ void initialize_limboai_module(ModuleInitializationLevel p_level) {
GDREGISTER_INTERNAL_CLASS(EditorPropertyPropertyPath);
GDREGISTER_INTERNAL_CLASS(EditorPropertyVariableName);
GDREGISTER_INTERNAL_CLASS(EditorInspectorPluginVariableName);
GDREGISTER_INTERNAL_CLASS(EditorPropertyBBParam);
GDREGISTER_INTERNAL_CLASS(EditorInspectorPluginBBParam);
GDREGISTER_INTERNAL_CLASS(OwnerPicker);
GDREGISTER_INTERNAL_CLASS(LimboAIEditor);
GDREGISTER_INTERNAL_CLASS(LimboAIEditorPlugin);

View File

@ -78,7 +78,7 @@ TEST_CASE("[Modules][LimboAI] BTTask") {
SUBCASE("Test next_sibling()") {
CHECK(child1->next_sibling() == child2);
CHECK(child2->next_sibling() == child3);
CHECK(child3->next_sibling() == nullptr);
CHECK(child3->next_sibling().is_null());
}
SUBCASE("Test remove_child()") {
task->remove_child(child2);
@ -153,7 +153,7 @@ TEST_CASE("[Modules][LimboAI] BTTask") {
CHECK(child3->get_root() == task);
}
SUBCASE("Test get_parent()") {
CHECK(task->get_parent() == nullptr);
CHECK(task->get_parent().is_null());
CHECK(child1->get_parent() == task);
CHECK(child2->get_parent() == task);
CHECK(child2->get_parent() == task);

View File

@ -16,6 +16,7 @@
#ifdef TOOLS_ENABLED
#include "core/io/resource.h"
#include "core/variant/variant.h"
#include "editor/editor_main_screen.h"
#include "editor/editor_node.h"
#include "editor/plugins/script_editor_plugin.h"
#endif // TOOLS_ENABLED
@ -213,7 +214,7 @@ Variant VARIANT_DEFAULT(Variant::Type p_type) {
void SHOW_BUILTIN_DOC(const String &p_topic) {
#ifdef LIMBOAI_MODULE
ScriptEditor::get_singleton()->goto_help(p_topic);
EditorNode::get_singleton()->set_visible_editor(EditorNode::EDITOR_SCRIPT);
EditorNode::get_singleton()->get_editor_main_screen()->select(EditorMainScreen::EDITOR_SCRIPT);
#elif LIMBOAI_GDEXTENSION
TypedArray<ScriptEditorBase> open_editors = EditorInterface::get_singleton()->get_script_editor()->get_open_script_editors();
ERR_FAIL_COND_MSG(open_editors.size() == 0, "Can't open help page. Need at least one script open in the script editor.");

View File

@ -28,7 +28,7 @@
#define EDITOR_FILE_SYSTEM() (EditorFileSystem::get_singleton())
#define EDITOR_SETTINGS() (EditorSettings::get_singleton())
#define BASE_CONTROL() (EditorNode::get_singleton()->get_gui_base())
#define MAIN_SCREEN_CONTROL() (EditorNode::get_singleton()->get_main_screen_control())
#define MAIN_SCREEN_CONTROL() (EditorNode::get_singleton()->get_editor_main_screen())
#define SCENE_TREE() (SceneTree::get_singleton())
#define IS_DEBUGGER_ACTIVE() (EngineDebugger::is_active())
#define FS_DOCK_SELECT_FILE(m_path) FileSystemDock::get_singleton()->select_file(m_path)
@ -37,7 +37,6 @@
#define IS_CLASS(m_obj, m_class) (m_obj->is_class_ptr(m_class::get_class_ptr_static()))
#define RAND_RANGE(m_from, m_to) (Math::random(m_from, m_to))
#define RANDF() (Math::randf())
#define BUTTON_SET_ICON(m_btn, m_icon) m_btn->set_icon(m_icon)
#define RESOURCE_LOAD(m_path, m_hint) ResourceLoader::load(m_path, m_hint)
#define RESOURCE_LOAD_NO_CACHE(m_path, m_hint) ResourceLoader::load(m_path, m_hint, ResourceFormatLoader::CACHE_MODE_IGNORE)
#define RESOURCE_SAVE(m_res, m_path, m_flags) ResourceSaver::save(m_res, m_path, m_flags)
@ -47,7 +46,7 @@
#define GET_PROJECT_SETTINGS_DIR() EditorPaths::get_singleton()->get_project_settings_dir()
#define EDIT_RESOURCE(m_res) EditorNode::get_singleton()->edit_resource(m_res)
#define INSPECTOR_GET_EDITED_OBJECT() (InspectorDock::get_inspector_singleton()->get_edited_object())
#define SET_MAIN_SCREEN_EDITOR(m_name) (EditorNode::get_singleton()->select_editor_by_name(m_name))
#define SET_MAIN_SCREEN_EDITOR(m_name) (EditorNode::get_singleton()->get_editor_main_screen()->select_by_name(m_name))
#define FILE_EXISTS(m_path) FileAccess::exists(m_path)
#define DIR_ACCESS_CREATE() DirAccess::create(DirAccess::ACCESS_RESOURCES)
#define PERFORMANCE_ADD_CUSTOM_MONITOR(m_id, m_callable) (Performance::get_singleton()->add_custom_monitor(m_id, m_callable, Variant()))
@ -96,7 +95,6 @@ using namespace godot;
#define IS_CLASS(m_obj, m_class) (m_obj->is_class(#m_class))
#define RAND_RANGE(m_from, m_to) (UtilityFunctions::randf_range(m_from, m_to))
#define RANDF() (UtilityFunctions::randf())
#define BUTTON_SET_ICON(m_btn, m_icon) m_btn->set_button_icon(m_icon)
#define RESOURCE_LOAD(m_path, m_hint) ResourceLoader::get_singleton()->load(m_path, m_hint)
#define RESOURCE_LOAD_NO_CACHE(m_path, m_hint) ResourceLoader::get_singleton()->load(m_path, m_hint, ResourceLoader::CACHE_MODE_IGNORE)
#define RESOURCE_SAVE(m_res, m_path, m_flags) ResourceSaver::get_singleton()->save(m_res, m_path, m_flags)

View File

@ -28,6 +28,7 @@ LimboStringNames *LimboStringNames::singleton = nullptr;
LimboStringNames::LimboStringNames() {
_generate_name = SN("_generate_name");
_param_type = SN("_param_type");
_replace_task = SN("_replace_task");
_update_task_tree = SN("_update_task_tree");
_weight_ = SN("_weight_");
@ -41,12 +42,14 @@ LimboStringNames::LimboStringNames() {
add_child_at_index = SN("add_child_at_index");
AnimationFilter = SN("AnimationFilter");
BBParam = SN("BBParam");
BBString = SN("BBString");
behavior_tree_finished = SN("behavior_tree_finished");
bold = SN("bold");
button_down = SN("button_down");
button_up = SN("button_up");
call_deferred = SN("call_deferred");
changed = SN("changed");
class_icon_size = SN("class_icon_size");
Clear = SN("Clear");
Close = SN("Close");
dark_color_2 = SN("dark_color_2");
@ -83,15 +86,15 @@ LimboStringNames::LimboStringNames() {
GuiTabMenuHl = SN("GuiTabMenuHl");
GuiTreeArrowDown = SN("GuiTreeArrowDown");
GuiTreeArrowRight = SN("GuiTreeArrowRight");
h_separation = SN("h_separation");
HeaderSmall = SN("HeaderSmall");
Help = SN("Help");
h_separation = SN("h_separation");
icon_max_width = SN("icon_max_width");
class_icon_size = SN("class_icon_size");
id_pressed = SN("id_pressed");
Info = SN("Info");
item_collapsed = SN("item_collapsed");
item_selected = SN("item_selected");
LimboExtraVariable = SN("LimboExtraVariable");
LimboVarAdd = SN("LimboVarAdd");
LimboVarEmpty = SN("LimboVarEmpty");
LimboVarError = SN("LimboVarError");
@ -116,6 +119,7 @@ LimboStringNames::LimboStringNames() {
popup_hide = SN("popup_hide");
pressed = SN("pressed");
probability_clicked = SN("probability_clicked");
property_changed = SN("property_changed");
Reload = SN("Reload");
Remove = SN("Remove");
remove_child = SN("remove_child");
@ -123,14 +127,15 @@ LimboStringNames::LimboStringNames() {
request_open_in_screen = SN("request_open_in_screen");
rmb_pressed = SN("rmb_pressed");
Save = SN("Save");
saved_value = SN("saved_value");
Script = SN("Script");
ScriptCreate = SN("ScriptCreate");
Search = SN("Search");
separation = SN("separation");
set_custom_name = SN("set_custom_name");
set_root_task = SN("set_root_task");
set_visible = SN("set_visible");
set_v_scroll = SN("set_v_scroll");
set_visible = SN("set_visible");
setup = SN("setup");
started = SN("started");
StatusWarning = SN("StatusWarning");
@ -138,9 +143,9 @@ LimboStringNames::LimboStringNames() {
task_activated = SN("task_activated");
task_button_pressed = SN("task_button_pressed");
task_button_rmb = SN("task_button_rmb");
tasks_dragged = SN("tasks_dragged");
task_meta = SN("task_meta");
task_selected = SN("task_selected");
tasks_dragged = SN("tasks_dragged");
text_changed = SN("text_changed");
text_submitted = SN("text_submitted");
timeout = SN("timeout");
@ -150,6 +155,7 @@ LimboStringNames::LimboStringNames() {
TripleBar = SN("TripleBar");
update_mode = SN("update_mode");
updated = SN("updated");
variable = SN("variable");
visibility_changed = SN("visibility_changed");
window_visibility_changed = SN("window_visibility_changed");

View File

@ -44,6 +44,7 @@ public:
_FORCE_INLINE_ static LimboStringNames *get_singleton() { return singleton; }
StringName _generate_name;
StringName _param_type;
StringName _replace_task;
StringName _update_task_tree;
StringName _weight_;
@ -57,12 +58,14 @@ public:
StringName Add;
StringName AnimationFilter;
StringName BBParam;
StringName BBString;
StringName behavior_tree_finished;
StringName bold;
StringName button_down;
StringName button_up;
StringName call_deferred;
StringName changed;
StringName class_icon_size;
StringName Clear;
StringName Close;
StringName dark_color_2;
@ -88,8 +91,8 @@ public:
StringName favorite_tasks_changed;
StringName Favorites;
StringName FlatButton;
StringName Focus;
StringName focus_exited;
StringName Focus;
StringName font_color;
StringName font_size;
StringName font;
@ -99,15 +102,15 @@ public:
StringName GuiTabMenuHl;
StringName GuiTreeArrowDown;
StringName GuiTreeArrowRight;
StringName h_separation;
StringName HeaderSmall;
StringName Help;
StringName h_separation;
StringName icon_max_width;
StringName class_icon_size;
StringName id_pressed;
StringName Info;
StringName item_collapsed;
StringName item_selected;
StringName LimboExtraVariable;
StringName LimboVarAdd;
StringName LimboVarEmpty;
StringName LimboVarError;
@ -132,6 +135,7 @@ public:
StringName popup_hide;
StringName pressed;
StringName probability_clicked;
StringName property_changed;
StringName Reload;
StringName remove_child;
StringName Remove;
@ -139,14 +143,15 @@ public:
StringName request_open_in_screen;
StringName rmb_pressed;
StringName Save;
StringName saved_value;
StringName Script;
StringName ScriptCreate;
StringName Search;
StringName separation;
StringName set_custom_name;
StringName set_root_task;
StringName set_visible;
StringName set_v_scroll;
StringName set_visible;
StringName setup;
StringName started;
StringName StatusWarning;
@ -154,9 +159,9 @@ public:
StringName task_activated;
StringName task_button_pressed;
StringName task_button_rmb;
StringName tasks_dragged;
StringName task_meta;
StringName task_selected;
StringName tasks_dragged;
StringName text_changed;
StringName text_submitted;
StringName timeout;
@ -166,6 +171,7 @@ public:
StringName TripleBar;
StringName update_mode;
StringName updated;
StringName variable;
StringName visibility_changed;
StringName window_visibility_changed;

View File

@ -93,7 +93,7 @@ Ref<Texture2D> LimboUtility::get_task_icon(String p_class_or_script_path) const
}
EditorData &ed = EditorNode::get_editor_data();
Ref<Texture2D> script_icon = ed.get_script_icon(s);
Ref<Texture2D> script_icon = ed.get_script_icon(s->get_path());
if (script_icon.is_valid()) {
return script_icon;
}
@ -395,6 +395,20 @@ String LimboUtility::get_property_hint_text(PropertyHint p_hint) const {
case PROPERTY_HINT_ARRAY_TYPE: {
return "ARRAY_TYPE";
}
case PROPERTY_HINT_DICTIONARY_TYPE: {
return "DICTIONARY_TYPE";
}
case PROPERTY_HINT_TOOL_BUTTON: {
return "TOOL_BUTTON";
}
case PROPERTY_HINT_ONESHOT: {
return "ONESHOT";
}
#ifdef LIMBOAI_MODULE
case PROPERTY_HINT_NO_NODEPATH: {
return "NO_NODEPATH";
}
#endif // ! LIMBOAI_MODULE
case PROPERTY_HINT_LOCALE_ID: {
return "LOCALE_ID";
}