Compare commits

...

4 Commits

Author SHA1 Message Date
Serhii Snitsaruk 2687de300b
Merge 7ab7a9d098 into 00396dce61 2024-05-17 19:55:04 +00:00
Serhii Snitsaruk 7ab7a9d098
BlackboardPlan: Improve inspector update while manually typing in mappings
Fixes property glitches observed while a map variable is typed in.
2024-05-17 21:54:50 +02:00
Serhii Snitsaruk 00396dce61
Merge pull request #107 from limbonaut/steamdeck-support
GHA: Use older toolchain for SteamDeck compatibility
2024-05-16 17:48:33 +02:00
Serhii Snitsaruk 69201fa877
GHA: Use older toolchain for SteamDeck compatibility 2024-05-16 12:08:13 +02:00
4 changed files with 35 additions and 9 deletions

View File

@ -135,7 +135,7 @@ jobs:
- name: Set up Linux buildroot x86_64
if: matrix.opts.platform == 'linux' && matrix.opts.arch == 'x86_64'
run: |
wget https://download.tuxfamily.org/godotengine/toolchains/linux/x86_64-godot-linux-gnu_sdk-buildroot.tar.bz2
wget https://downloads.tuxfamily.org/godotengine/toolchains/linux/2021-02-11/x86_64-godot-linux-gnu_sdk-buildroot.tar.bz2
tar -xjf x86_64-godot-linux-gnu_sdk-buildroot.tar.bz2
mv x86_64-godot-linux-gnu_sdk-buildroot buildroot
cd buildroot
@ -145,7 +145,7 @@ jobs:
- name: Set up Linux buildroot x86_32
if: matrix.opts.platform == 'linux' && matrix.opts.arch == 'x86_32'
run: |
wget https://download.tuxfamily.org/godotengine/toolchains/linux/i686-godot-linux-gnu_sdk-buildroot.tar.bz2
wget https://downloads.tuxfamily.org/godotengine/toolchains/linux/2021-02-11/i686-godot-linux-gnu_sdk-buildroot.tar.bz2
tar -xjf i686-godot-linux-gnu_sdk-buildroot.tar.bz2
mv i686-godot-linux-gnu_sdk-buildroot buildroot
cd buildroot

View File

@ -31,12 +31,21 @@ bool BlackboardPlan::_set(const StringName &p_name, const Variant &p_value) {
if (name_str.begins_with("mapping/")) {
StringName mapped_var_name = name_str.get_slicec('/', 1);
StringName value = p_value;
bool properties_changed = false;
if (value == StringName()) {
parent_scope_mapping.erase(mapped_var_name);
if (parent_scope_mapping.has(mapped_var_name)) {
properties_changed = true;
parent_scope_mapping.erase(mapped_var_name);
}
} else {
if (!parent_scope_mapping.has(mapped_var_name)) {
properties_changed = true;
}
parent_scope_mapping[mapped_var_name] = value;
}
notify_property_list_changed();
if (properties_changed) {
notify_property_list_changed();
}
return true;
}

View File

@ -31,6 +31,8 @@
#include <godot_cpp/classes/h_box_container.hpp>
#endif // LIMBOAI_GDEXTENSION
int EditorPropertyVariableName::last_caret_column = 0;
//***** EditorPropertyVariableName
void EditorPropertyVariableName::_show_variables_popup() {
@ -54,13 +56,18 @@ void EditorPropertyVariableName::_show_variables_popup() {
variables_popup->popup(rect);
}
void EditorPropertyVariableName::_name_changed(const String &p_new_name, bool p_changing) {
emit_changed(get_edited_property(), p_new_name, StringName(), p_changing);
void EditorPropertyVariableName::_name_changed(const String &p_new_name) {
if (updating) {
return;
}
emit_changed(get_edited_property(), p_new_name);
last_caret_column = name_edit->get_caret_column();
_update_status();
}
void EditorPropertyVariableName::_name_submitted() {
_name_changed(name_edit->get_text(), false);
_name_changed(name_edit->get_text());
if (name_edit->has_focus()) {
name_edit->release_focus();
}
@ -131,13 +138,18 @@ void EditorPropertyVariableName::update_property() {
void EditorPropertyVariableName::_update_property() {
#endif // LIMBOAI_GDEXTENSION
String s = get_edited_object()->get(get_edited_property());
updating = true;
if (name_edit->get_text() != s) {
int caret = name_edit->get_caret_column();
if (caret == 0) {
caret = last_caret_column;
}
name_edit->set_text(s);
name_edit->set_caret_column(caret);
}
name_edit->set_editable(!is_read_only());
_update_status();
updating = false;
}
void EditorPropertyVariableName::setup(const Ref<BlackboardPlan> &p_plan, bool p_allow_empty, Variant::Type p_type, PropertyHint p_hint, String p_hint_string, Variant p_default_value) {
@ -153,7 +165,7 @@ void EditorPropertyVariableName::setup(const Ref<BlackboardPlan> &p_plan, bool p
void EditorPropertyVariableName::_notification(int p_what) {
switch (p_what) {
case NOTIFICATION_READY: {
name_edit->connect(LW_NAME(text_changed), callable_mp(this, &EditorPropertyVariableName::_name_changed).bind(true));
name_edit->connect(LW_NAME(text_changed), callable_mp(this, &EditorPropertyVariableName::_name_changed));
name_edit->connect(LW_NAME(text_submitted), callable_mp(this, &EditorPropertyVariableName::_name_submitted).unbind(1));
name_edit->connect(LW_NAME(focus_exited), callable_mp(this, &EditorPropertyVariableName::_name_submitted));
variables_popup->connect(LW_NAME(id_pressed), callable_mp(this, &EditorPropertyVariableName::_variable_selected));

View File

@ -31,6 +31,9 @@ using namespace godot;
class EditorPropertyVariableName : public EditorProperty {
GDCLASS(EditorPropertyVariableName, EditorProperty);
private:
static int last_caret_column;
private:
struct ThemeCache {
Ref<Texture2D> var_add_icon;
@ -50,13 +53,15 @@ private:
String default_hint_string;
Variant default_value;
bool updating = false;
LineEdit *name_edit;
Button *drop_btn;
Button *status_btn;
PopupMenu *variables_popup;
void _show_variables_popup();
void _name_changed(const String &p_new_name, bool p_changing);
void _name_changed(const String &p_new_name);
void _name_submitted();
void _variable_selected(int p_id);
void _update_status();