summaryrefslogtreecommitdiff
path: root/editor/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'editor/plugins')
-rw-r--r--editor/plugins/animation_library_editor.cpp16
-rw-r--r--editor/plugins/animation_player_editor_plugin.cpp169
-rw-r--r--editor/plugins/animation_player_editor_plugin.h1
-rw-r--r--editor/plugins/gdextension_export_plugin.h22
-rw-r--r--editor/plugins/replication_editor_plugin.cpp263
-rw-r--r--editor/plugins/replication_editor_plugin.h34
-rw-r--r--editor/plugins/resource_preloader_editor_plugin.cpp8
-rw-r--r--editor/plugins/resource_preloader_editor_plugin.h2
-rw-r--r--editor/plugins/skeleton_3d_editor_plugin.cpp6
-rw-r--r--editor/plugins/skeleton_3d_editor_plugin.h2
-rw-r--r--editor/plugins/sprite_frames_editor_plugin.h2
-rw-r--r--editor/plugins/texture_region_editor_plugin.cpp113
-rw-r--r--editor/plugins/texture_region_editor_plugin.h33
-rw-r--r--editor/plugins/theme_editor_plugin.cpp16
-rw-r--r--editor/plugins/theme_editor_plugin.h4
-rw-r--r--editor/plugins/visual_shader_editor_plugin.cpp2
16 files changed, 531 insertions, 162 deletions
diff --git a/editor/plugins/animation_library_editor.cpp b/editor/plugins/animation_library_editor.cpp
index b43a4215b1..ed908e413c 100644
--- a/editor/plugins/animation_library_editor.cpp
+++ b/editor/plugins/animation_library_editor.cpp
@@ -75,12 +75,16 @@ void AnimationLibraryEditor::_add_library_validate(const String &p_name) {
add_library_validate->set_text(error);
add_library_dialog->get_ok_button()->set_disabled(true);
} else {
- add_library_validate->add_theme_color_override("font_color", get_theme_color(SNAME("success_color"), SNAME("Editor")));
- if (p_name == "") {
- add_library_validate->set_text(TTR("Global library will be created."));
+ if (adding_animation) {
+ add_library_validate->set_text(TTR("Animation name is valid."));
} else {
- add_library_validate->set_text(TTR("Library name is valid."));
+ if (p_name == "") {
+ add_library_validate->set_text(TTR("Global library will be created."));
+ } else {
+ add_library_validate->set_text(TTR("Library name is valid."));
+ }
}
+ add_library_validate->add_theme_color_override("font_color", get_theme_color(SNAME("success_color"), SNAME("Editor")));
add_library_dialog->get_ok_button()->set_disabled(false);
}
}
@@ -469,7 +473,7 @@ void AnimationLibraryEditor::_button_pressed(TreeItem *p_item, int p_column, int
int attempt = 1;
while (al->has_animation(name)) {
attempt++;
- name = base_name + " " + itos(attempt);
+ name = base_name + " (" + itos(attempt) + ")";
}
UndoRedo *undo_redo = EditorNode::get_singleton()->get_undo_redo();
@@ -673,7 +677,7 @@ AnimationLibraryEditor::AnimationLibraryEditor() {
tree->set_v_size_flags(Control::SIZE_EXPAND_FILL);
tree->connect("item_edited", callable_mp(this, &AnimationLibraryEditor::_item_renamed));
- tree->connect("button_pressed", callable_mp(this, &AnimationLibraryEditor::_button_pressed));
+ tree->connect("button_clicked", callable_mp(this, &AnimationLibraryEditor::_button_pressed));
file_popup = memnew(PopupMenu);
add_child(file_popup);
diff --git a/editor/plugins/animation_player_editor_plugin.cpp b/editor/plugins/animation_player_editor_plugin.cpp
index 57cf13d298..765d963846 100644
--- a/editor/plugins/animation_player_editor_plugin.cpp
+++ b/editor/plugins/animation_player_editor_plugin.cpp
@@ -303,17 +303,23 @@ void AnimationPlayerEditor::_animation_selected(int p_which) {
}
void AnimationPlayerEditor::_animation_new() {
- name_dialog_op = TOOL_NEW_ANIM;
- name_title->set_text(TTR("New Animation Name:"));
-
int count = 1;
String base = TTR("New Anim");
+ String current_library_name = "";
+ if (animation->has_selectable_items()) {
+ String current_animation_name = animation->get_item_text(animation->get_selected());
+ Ref<Animation> current_animation = player->get_animation(current_animation_name);
+ if (current_animation.is_valid()) {
+ current_library_name = player->find_animation_library(current_animation);
+ }
+ }
+ String attempt_prefix = (current_library_name == "") ? "" : current_library_name + "/";
while (true) {
String attempt = base;
if (count > 1) {
attempt += " (" + itos(count) + ")";
}
- if (player->has_animation(attempt)) {
+ if (player->has_animation(attempt_prefix + attempt)) {
count++;
continue;
}
@@ -321,22 +327,13 @@ void AnimationPlayerEditor::_animation_new() {
break;
}
- List<StringName> libraries;
- player->get_animation_library_list(&libraries);
- library->clear();
- for (const StringName &K : libraries) {
- library->add_item((K == StringName()) ? String(TTR("[Global]")) : String(K));
- library->set_item_metadata(0, String(K));
- }
+ _update_name_dialog_library_dropdown();
- if (libraries.size() > 1) {
- library->show();
- } else {
- library->hide();
- }
-
- name->set_text(base);
+ name_dialog_op = TOOL_NEW_ANIM;
+ name_dialog->set_title(TTR("Create New Animation"));
name_dialog->popup_centered(Size2(300, 90));
+ name_title->set_text(TTR("New Animation Name:"));
+ name->set_text(base);
name->select_all();
name->grab_focus();
}
@@ -348,6 +345,12 @@ void AnimationPlayerEditor::_animation_rename() {
int selected = animation->get_selected();
String selected_name = animation->get_item_text(selected);
+ // Remove library prefix if present.
+ if (selected_name.contains("/")) {
+ selected_name = selected_name.get_slice("/", 1);
+ }
+
+ name_dialog->set_title(TTR("Rename Animation"));
name_title->set_text(TTR("Change Animation Name:"));
name->set_text(selected_name);
name_dialog_op = TOOL_RENAME_ANIM;
@@ -375,6 +378,10 @@ void AnimationPlayerEditor::_animation_remove_confirmed() {
Ref<AnimationLibrary> al = player->get_animation_library(player->find_animation_library(anim));
ERR_FAIL_COND(al.is_null());
+ // For names of form lib_name/anim_name, remove library name prefix.
+ if (current.contains("/")) {
+ current = current.get_slice("/", 1);
+ }
undo_redo->create_action(TTR("Remove Animation"));
if (player->get_autoplay() == current) {
undo_redo->add_do_method(player, "set_autoplay", "");
@@ -438,8 +445,14 @@ void AnimationPlayerEditor::_animation_name_edited() {
return;
}
- if (player->has_animation(new_name)) {
- error_dialog->set_text(TTR("Animation name already exists!"));
+ String test_name_prefix = "";
+ if (library->is_visible() && library->get_selected_id() != -1) {
+ test_name_prefix = library->get_item_metadata(library->get_selected_id());
+ test_name_prefix += (test_name_prefix != "") ? "/" : "";
+ }
+
+ if (player->has_animation(test_name_prefix + new_name)) {
+ error_dialog->set_text(vformat(TTR("Animation '%s' already exists!"), test_name_prefix + new_name));
error_dialog->popup_centered();
return;
}
@@ -452,6 +465,13 @@ void AnimationPlayerEditor::_animation_name_edited() {
Ref<AnimationLibrary> al = player->get_animation_library(player->find_animation_library(anim));
ERR_FAIL_COND(al.is_null());
+ // Extract library prefix if present.
+ String new_library_prefix = "";
+ if (current.contains("/")) {
+ new_library_prefix = current.get_slice("/", 0) + "/";
+ current = current.get_slice("/", 1);
+ }
+
undo_redo->create_action(TTR("Rename Animation"));
undo_redo->add_do_method(al.ptr(), "rename_animation", current, new_name);
undo_redo->add_do_method(anim.ptr(), "set_name", new_name);
@@ -461,19 +481,25 @@ void AnimationPlayerEditor::_animation_name_edited() {
undo_redo->add_undo_method(this, "_animation_player_changed", player);
undo_redo->commit_action();
- _select_anim_by_name(new_name);
+ _select_anim_by_name(new_library_prefix + new_name);
} break;
case TOOL_NEW_ANIM: {
Ref<Animation> new_anim = Ref<Animation>(memnew(Animation));
new_anim->set_name(new_name);
-
+ String library_name;
Ref<AnimationLibrary> al;
if (library->is_visible()) {
- al = player->get_animation_library(library->get_item_metadata(library->get_selected()));
+ library_name = library->get_item_metadata(library->get_selected());
+ // It's possible that [Global] was selected, but doesn't exist yet.
+ if (player->has_animation_library(library_name)) {
+ al = player->get_animation_library(library_name);
+ }
+
} else {
if (player->has_animation_library("")) {
al = player->get_animation_library("");
+ library_name = "";
}
}
@@ -484,6 +510,7 @@ void AnimationPlayerEditor::_animation_name_edited() {
al.instantiate();
lib_added = true;
undo_redo->add_do_method(player, "add_animation_library", "", al);
+ library_name = "";
}
undo_redo->add_do_method(al.ptr(), "add_animation", new_name, new_anim);
@@ -499,7 +526,11 @@ void AnimationPlayerEditor::_animation_name_edited() {
}
undo_redo->commit_action();
- _select_anim_by_name(new_name);
+ if (library_name != "") {
+ library_name = library_name + "/";
+ }
+ _select_anim_by_name(library_name + new_name);
+
} break;
case TOOL_DUPLICATE_ANIM: {
@@ -509,17 +540,44 @@ void AnimationPlayerEditor::_animation_name_edited() {
Ref<Animation> new_anim = _animation_clone(anim);
new_anim->set_name(new_name);
- Ref<AnimationLibrary> library = player->get_animation_library(player->find_animation_library(anim));
+ String library_name;
+ Ref<AnimationLibrary> al;
+ if (library->is_visible()) {
+ library_name = library->get_item_metadata(library->get_selected());
+ // It's possible that [Global] was selected, but doesn't exist yet.
+ if (player->has_animation_library(library_name)) {
+ al = player->get_animation_library(library_name);
+ }
+ } else {
+ if (player->has_animation_library("")) {
+ al = player->get_animation_library("");
+ library_name = "";
+ }
+ }
undo_redo->create_action(TTR("Duplicate Animation"));
- undo_redo->add_do_method(library.ptr(), "add_animation", new_name, new_anim);
- undo_redo->add_undo_method(library.ptr(), "remove_animation", new_name);
- undo_redo->add_do_method(player, "animation_set_next", new_name, player->animation_get_next(current));
+
+ bool lib_added = false;
+ if (al.is_null()) {
+ al.instantiate();
+ lib_added = true;
+ undo_redo->add_do_method(player, "add_animation_library", "", al);
+ library_name = "";
+ }
+
+ undo_redo->add_do_method(al.ptr(), "add_animation", new_name, new_anim);
+ undo_redo->add_undo_method(al.ptr(), "remove_animation", new_name);
undo_redo->add_do_method(this, "_animation_player_changed", player);
undo_redo->add_undo_method(this, "_animation_player_changed", player);
+ if (lib_added) {
+ undo_redo->add_undo_method(player, "remove_animation_library", "");
+ }
undo_redo->commit_action();
- _select_anim_by_name(new_name);
+ if (library_name != "") {
+ library_name = library_name + "/";
+ }
+ _select_anim_by_name(library_name + new_name);
} break;
}
@@ -851,6 +909,47 @@ void AnimationPlayerEditor::_update_animation_list_icons() {
}
}
+void AnimationPlayerEditor::_update_name_dialog_library_dropdown() {
+ StringName current_library_name = StringName();
+ if (animation->has_selectable_items()) {
+ String current_animation_name = animation->get_item_text(animation->get_selected());
+ Ref<Animation> current_animation = player->get_animation(current_animation_name);
+ if (current_animation.is_valid()) {
+ current_library_name = player->find_animation_library(current_animation);
+ }
+ }
+
+ List<StringName> libraries;
+ player->get_animation_library_list(&libraries);
+ library->clear();
+
+ // When [Global] isn't present, but other libraries are, add option of creating [Global].
+ int index_offset = 0;
+ if (!player->has_animation_library(StringName())) {
+ library->add_item(String(TTR("[Global] (create)")));
+ library->set_item_metadata(0, "");
+ index_offset = 1;
+ }
+
+ int current_lib_id = index_offset; // Don't default to [Global] if it doesn't exist yet.
+ for (int i = 0; i < libraries.size(); i++) {
+ StringName library_name = libraries[i];
+ library->add_item((library_name == StringName()) ? String(TTR("[Global]")) : String(library_name));
+ library->set_item_metadata(i + index_offset, String(library_name));
+ // Default to duplicating into same library.
+ if (library_name == current_library_name) {
+ current_lib_id = i + index_offset;
+ }
+ }
+
+ if (library->get_item_count() > 1) {
+ library->select(current_lib_id);
+ library->show();
+ } else {
+ library->hide();
+ }
+}
+
void AnimationPlayerEditor::edit(AnimationPlayer *p_player) {
if (player && pin->is_pressed()) {
return; // Ignore, pinned.
@@ -946,9 +1045,17 @@ void AnimationPlayerEditor::_animation_duplicate() {
new_name = new_name + " (copy)";
}
- name_title->set_text(TTR("New Animation Name:"));
- name->set_text(new_name);
+ if (new_name.contains("/")) {
+ // Discard library prefix.
+ new_name = new_name.get_slice("/", 1);
+ }
+
+ _update_name_dialog_library_dropdown();
+
name_dialog_op = TOOL_DUPLICATE_ANIM;
+ name_dialog->set_title("Duplicate Animation");
+ name_title->set_text(TTR("Duplicated Animation Name:"));
+ name->set_text(new_name);
name_dialog->popup_centered(Size2(300, 90));
name->select_all();
name->grab_focus();
diff --git a/editor/plugins/animation_player_editor_plugin.h b/editor/plugins/animation_player_editor_plugin.h
index 0cc04460ca..3b1de070fa 100644
--- a/editor/plugins/animation_player_editor_plugin.h
+++ b/editor/plugins/animation_player_editor_plugin.h
@@ -188,6 +188,7 @@ class AnimationPlayerEditor : public VBoxContainer {
void _update_animation();
void _update_player();
void _update_animation_list_icons();
+ void _update_name_dialog_library_dropdown();
void _blend_edited();
void _animation_player_changed(Object *p_pl);
diff --git a/editor/plugins/gdextension_export_plugin.h b/editor/plugins/gdextension_export_plugin.h
index c17e02e1fd..b91a17d9e5 100644
--- a/editor/plugins/gdextension_export_plugin.h
+++ b/editor/plugins/gdextension_export_plugin.h
@@ -47,14 +47,9 @@ void GDExtensionExportPlugin::_export_file(const String &p_path, const String &p
config.instantiate();
Error err = config->load(p_path);
+ ERR_FAIL_COND_MSG(err, "Failed to load GDExtension file: " + p_path);
- if (err != OK) {
- return;
- }
-
- if (!config->has_section_key("configuration", "entry_symbol")) {
- return;
- }
+ ERR_FAIL_COND_MSG(!config->has_section_key("configuration", "entry_symbol"), "Failed to export GDExtension file, missing entry symbol: " + p_path);
String entry_symbol = config->get_value("configuration", "entry_symbol");
@@ -62,6 +57,7 @@ void GDExtensionExportPlugin::_export_file(const String &p_path, const String &p
config->get_section_keys("libraries", &libraries);
+ bool could_export = false;
for (const String &E : libraries) {
Vector<String> tags = E.split(".");
bool all_tags_met = true;
@@ -101,13 +97,23 @@ void GDExtensionExportPlugin::_export_file(const String &p_path, const String &p
String linker_flags = "-Wl,-U,_" + entry_symbol;
add_ios_linker_flags(linker_flags);
}
+ could_export = true;
break;
}
}
+ if (!could_export) {
+ Vector<String> tags;
+ for (const String &E : p_features) {
+ tags.append(E);
+ }
+ ERR_FAIL_MSG(vformat("Couldn't export extension: %s. No suitable library found for export flags: %s", p_path, String(", ").join(tags)));
+ }
List<String> dependencies;
+ if (config->has_section("dependencies")) {
+ config->get_section_keys("dependencies", &dependencies);
+ }
- config->get_section_keys("dependencies", &dependencies);
for (const String &E : libraries) {
Vector<String> tags = E.split(".");
bool all_tags_met = true;
diff --git a/editor/plugins/replication_editor_plugin.cpp b/editor/plugins/replication_editor_plugin.cpp
index 2a7b3c7a55..72fe3c5f20 100644
--- a/editor/plugins/replication_editor_plugin.cpp
+++ b/editor/plugins/replication_editor_plugin.cpp
@@ -37,6 +37,129 @@
#include "scene/gui/tree.h"
#include "scene/multiplayer/multiplayer_synchronizer.h"
+void ReplicationEditor::_pick_node_filter_text_changed(const String &p_newtext) {
+ TreeItem *root_item = pick_node->get_scene_tree()->get_scene_tree()->get_root();
+
+ Vector<Node *> select_candidates;
+ Node *to_select = nullptr;
+
+ String filter = pick_node->get_filter_line_edit()->get_text();
+
+ _pick_node_select_recursive(root_item, filter, select_candidates);
+
+ if (!select_candidates.is_empty()) {
+ for (int i = 0; i < select_candidates.size(); ++i) {
+ Node *candidate = select_candidates[i];
+
+ if (((String)candidate->get_name()).to_lower().begins_with(filter.to_lower())) {
+ to_select = candidate;
+ break;
+ }
+ }
+
+ if (!to_select) {
+ to_select = select_candidates[0];
+ }
+ }
+
+ pick_node->get_scene_tree()->set_selected(to_select);
+}
+
+void ReplicationEditor::_pick_node_select_recursive(TreeItem *p_item, const String &p_filter, Vector<Node *> &p_select_candidates) {
+ if (!p_item) {
+ return;
+ }
+
+ NodePath np = p_item->get_metadata(0);
+ Node *node = get_node(np);
+
+ if (!p_filter.is_empty() && ((String)node->get_name()).findn(p_filter) != -1) {
+ p_select_candidates.push_back(node);
+ }
+
+ TreeItem *c = p_item->get_first_child();
+
+ while (c) {
+ _pick_node_select_recursive(c, p_filter, p_select_candidates);
+ c = c->get_next();
+ }
+}
+
+void ReplicationEditor::_pick_node_filter_input(const Ref<InputEvent> &p_ie) {
+ Ref<InputEventKey> k = p_ie;
+
+ if (k.is_valid()) {
+ switch (k->get_keycode()) {
+ case Key::UP:
+ case Key::DOWN:
+ case Key::PAGEUP:
+ case Key::PAGEDOWN: {
+ pick_node->get_scene_tree()->get_scene_tree()->gui_input(k);
+ pick_node->get_filter_line_edit()->accept_event();
+ } break;
+ default:
+ break;
+ }
+ }
+}
+
+void ReplicationEditor::_pick_node_selected(NodePath p_path) {
+ Node *root = current->get_node(current->get_root_path());
+ ERR_FAIL_COND(!root);
+ Node *node = get_node(p_path);
+ ERR_FAIL_COND(!node);
+ NodePath path_to = root->get_path_to(node);
+ adding_node_path = path_to;
+ prop_selector->select_property_from_instance(node);
+}
+
+void ReplicationEditor::_pick_new_property() {
+ if (current == nullptr) {
+ EditorNode::get_singleton()->show_warning(TTR("Select a replicator node in order to pick a property to add to it."));
+ return;
+ }
+ Node *root = current->get_node(current->get_root_path());
+ if (!root) {
+ EditorNode::get_singleton()->show_warning(TTR("Not possible to add a new property to synchronize without a root."));
+ return;
+ }
+ pick_node->popup_scenetree_dialog();
+ pick_node->get_filter_line_edit()->clear();
+ pick_node->get_filter_line_edit()->grab_focus();
+}
+
+void ReplicationEditor::_add_sync_property(String p_path) {
+ config = current->get_replication_config();
+
+ if (config.is_valid() && config->has_property(p_path)) {
+ EditorNode::get_singleton()->show_warning(TTR("Property is already being synchronized."));
+ return;
+ }
+
+ UndoRedo *undo_redo = EditorNode::get_singleton()->get_undo_redo();
+ undo_redo->create_action(TTR("Add property to synchronizer"));
+
+ if (config.is_null()) {
+ config.instantiate();
+ current->set_replication_config(config);
+ undo_redo->add_do_method(current, "set_replication_config", config);
+ undo_redo->add_undo_method(current, "set_replication_config", Ref<SceneReplicationConfig>());
+ _update_config();
+ }
+
+ undo_redo->add_do_method(config.ptr(), "add_property", p_path);
+ undo_redo->add_undo_method(config.ptr(), "remove_property", p_path);
+ undo_redo->add_do_method(this, "_update_config");
+ undo_redo->add_undo_method(this, "_update_config");
+ undo_redo->commit_action();
+}
+
+void ReplicationEditor::_pick_node_property_selected(String p_name) {
+ String adding_prop_path = String(adding_node_path) + ":" + p_name;
+
+ _add_sync_property(adding_prop_path);
+}
+
/// ReplicationEditor
ReplicationEditor::ReplicationEditor() {
set_v_size_flags(SIZE_EXPAND_FILL);
@@ -56,16 +179,44 @@ ReplicationEditor::ReplicationEditor() {
vb->set_v_size_flags(SIZE_EXPAND_FILL);
add_child(vb);
+ pick_node = memnew(SceneTreeDialog);
+ add_child(pick_node);
+ pick_node->register_text_enter(pick_node->get_filter_line_edit());
+ pick_node->set_title(TTR("Pick a node to synchronize:"));
+ pick_node->connect("selected", callable_mp(this, &ReplicationEditor::_pick_node_selected));
+ pick_node->get_filter_line_edit()->connect("text_changed", callable_mp(this, &ReplicationEditor::_pick_node_filter_text_changed));
+ pick_node->get_filter_line_edit()->connect("gui_input", callable_mp(this, &ReplicationEditor::_pick_node_filter_input));
+
+ prop_selector = memnew(PropertySelector);
+ add_child(prop_selector);
+ prop_selector->connect("selected", callable_mp(this, &ReplicationEditor::_pick_node_property_selected));
+
HBoxContainer *hb = memnew(HBoxContainer);
vb->add_child(hb);
+
+ add_pick_button = memnew(Button);
+ add_pick_button->connect("pressed", callable_mp(this, &ReplicationEditor::_pick_new_property));
+ add_pick_button->set_text(TTR("Add property to sync.."));
+ hb->add_child(add_pick_button);
+ VSeparator *vs = memnew(VSeparator);
+ vs->set_custom_minimum_size(Size2(30 * EDSCALE, 0));
+ hb->add_child(vs);
+ hb->add_child(memnew(Label(TTR("Path:"))));
np_line_edit = memnew(LineEdit);
np_line_edit->set_placeholder(":property");
np_line_edit->set_h_size_flags(SIZE_EXPAND_FILL);
hb->add_child(np_line_edit);
- add_button = memnew(Button);
- add_button->connect("pressed", callable_mp(this, &ReplicationEditor::_add_pressed));
- add_button->set_text(TTR("Add"));
- hb->add_child(add_button);
+ add_from_path_button = memnew(Button);
+ add_from_path_button->connect("pressed", callable_mp(this, &ReplicationEditor::_add_pressed));
+ add_from_path_button->set_text(TTR("Add from path"));
+ hb->add_child(add_from_path_button);
+ vs = memnew(VSeparator);
+ vs->set_custom_minimum_size(Size2(30 * EDSCALE, 0));
+ hb->add_child(vs);
+ pin = memnew(Button);
+ pin->set_flat(true);
+ pin->set_toggle_mode(true);
+ hb->add_child(pin);
tree = memnew(Tree);
tree->set_hide_root(true);
@@ -81,23 +232,92 @@ ReplicationEditor::ReplicationEditor() {
tree->set_column_expand(2, false);
tree->set_column_expand(3, false);
tree->create_item();
- tree->connect("button_pressed", callable_mp(this, &ReplicationEditor::_tree_button_pressed));
+ tree->connect("button_clicked", callable_mp(this, &ReplicationEditor::_tree_button_pressed));
tree->connect("item_edited", callable_mp(this, &ReplicationEditor::_tree_item_edited));
tree->set_v_size_flags(SIZE_EXPAND_FILL);
vb->add_child(tree);
+
+ drop_label = memnew(Label);
+ drop_label->set_text(TTR("Add properties using the buttons above or\ndrag them them from the inspector and drop them here."));
+ drop_label->set_horizontal_alignment(HORIZONTAL_ALIGNMENT_CENTER);
+ drop_label->set_vertical_alignment(VERTICAL_ALIGNMENT_CENTER);
+ tree->add_child(drop_label);
+ drop_label->set_anchors_and_offsets_preset(Control::PRESET_WIDE);
+
+ tree->set_drag_forwarding(this);
}
void ReplicationEditor::_bind_methods() {
ClassDB::bind_method(D_METHOD("_update_config"), &ReplicationEditor::_update_config);
ClassDB::bind_method(D_METHOD("_update_checked", "property", "column", "checked"), &ReplicationEditor::_update_checked);
+ ClassDB::bind_method("_can_drop_data_fw", &ReplicationEditor::_can_drop_data_fw);
+ ClassDB::bind_method("_drop_data_fw", &ReplicationEditor::_drop_data_fw);
+
ADD_SIGNAL(MethodInfo("keying_changed"));
}
+bool ReplicationEditor::_can_drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from) const {
+ Dictionary d = p_data;
+ if (!d.has("type")) {
+ return false;
+ }
+ String t = d["type"];
+ if (t != "obj_property") {
+ return false;
+ }
+ Object *obj = d["object"];
+ if (!obj) {
+ return false;
+ }
+ Node *node = Object::cast_to<Node>(obj);
+ if (!node) {
+ return false;
+ }
+
+ return true;
+}
+
+void ReplicationEditor::_drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from) {
+ if (current == nullptr) {
+ EditorNode::get_singleton()->show_warning(TTR("Select a replicator node in order to pick a property to add to it."));
+ return;
+ }
+ Node *root = current->get_node(current->get_root_path());
+ if (!root) {
+ EditorNode::get_singleton()->show_warning(TTR("Not possible to add a new property to synchronize without a root."));
+ return;
+ }
+
+ Dictionary d = p_data;
+ if (!d.has("type")) {
+ return;
+ }
+ String t = d["type"];
+ if (t != "obj_property") {
+ return;
+ }
+ Object *obj = d["object"];
+ if (!obj) {
+ return;
+ }
+ Node *node = Object::cast_to<Node>(obj);
+ if (!node) {
+ return;
+ }
+
+ String path = root->get_path_to(node);
+ path += ":" + String(d["property"]);
+
+ _add_sync_property(path);
+}
+
void ReplicationEditor::_notification(int p_what) {
switch (p_what) {
case NOTIFICATION_ENTER_TREE:
case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: {
add_theme_style_override("panel", EditorNode::get_singleton()->get_gui_base()->get_theme_stylebox(SNAME("panel"), SNAME("Panel")));
+ add_pick_button->set_icon(get_theme_icon(SNAME("Add"), SNAME("EditorIcons")));
+ pin->set_icon(get_theme_icon(SNAME("Pin"), SNAME("EditorIcons")));
} break;
case NOTIFICATION_VISIBILITY_CHANGED: {
@@ -167,7 +387,11 @@ void ReplicationEditor::_tree_item_edited() {
undo_redo->commit_action();
}
-void ReplicationEditor::_tree_button_pressed(Object *p_item, int p_column, int p_id) {
+void ReplicationEditor::_tree_button_pressed(Object *p_item, int p_column, int p_id, MouseButton p_button) {
+ if (p_button != MouseButton::LEFT) {
+ return;
+ }
+
TreeItem *ti = Object::cast_to<TreeItem>(p_item);
if (!ti) {
return;
@@ -236,11 +460,15 @@ void ReplicationEditor::_update_config() {
deleting = NodePath();
tree->clear();
tree->create_item();
+ drop_label->set_visible(true);
if (!config.is_valid()) {
update_keying();
return;
}
TypedArray<NodePath> props = config->get_properties();
+ if (props.size()) {
+ drop_label->set_visible(false);
+ }
for (int i = 0; i < props.size(); i++) {
const NodePath path = props[i];
_add_property(path, config->property_get_spawn(path), config->property_get_sync(path));
@@ -341,7 +569,9 @@ void ReplicationEditor::property_keyed(const String &p_property) {
/// ReplicationEditorPlugin
ReplicationEditorPlugin::ReplicationEditorPlugin() {
repl_editor = memnew(ReplicationEditor);
- EditorNode::get_singleton()->add_bottom_panel_item(TTR("Replication"), repl_editor);
+ button = EditorNode::get_singleton()->add_bottom_panel_item(TTR("Replication"), repl_editor);
+ button->hide();
+ repl_editor->get_pin()->connect("pressed", callable_mp(this, &ReplicationEditorPlugin::_pinned));
}
ReplicationEditorPlugin::~ReplicationEditorPlugin() {
@@ -378,6 +608,17 @@ void ReplicationEditorPlugin::_node_removed(Node *p_node) {
if (repl_editor->is_visible_in_tree()) {
EditorNode::get_singleton()->hide_bottom_panel();
}
+ button->hide();
+ repl_editor->get_pin()->set_pressed(false);
+ }
+}
+
+void ReplicationEditorPlugin::_pinned() {
+ if (!repl_editor->get_pin()->is_pressed()) {
+ if (repl_editor->is_visible_in_tree()) {
+ EditorNode::get_singleton()->hide_bottom_panel();
+ }
+ button->hide();
}
}
@@ -391,6 +632,14 @@ bool ReplicationEditorPlugin::handles(Object *p_object) const {
void ReplicationEditorPlugin::make_visible(bool p_visible) {
if (p_visible) {
+ //editor->hide_animation_player_editors();
+ //editor->animation_panel_make_visible(true);
+ button->show();
EditorNode::get_singleton()->make_bottom_panel_item_visible(repl_editor);
+ } else if (!repl_editor->get_pin()->is_pressed()) {
+ if (repl_editor->is_visible_in_tree()) {
+ EditorNode::get_singleton()->hide_bottom_panel();
+ }
+ button->hide();
}
}
diff --git a/editor/plugins/replication_editor_plugin.h b/editor/plugins/replication_editor_plugin.h
index 08e86d1617..df3d97f884 100644
--- a/editor/plugins/replication_editor_plugin.h
+++ b/editor/plugins/replication_editor_plugin.h
@@ -34,6 +34,10 @@
#include "editor/editor_plugin.h"
#include "scene/resources/scene_replication_config.h"
+#include "editor/editor_spin_slider.h"
+#include "editor/property_editor.h"
+#include "editor/property_selector.h"
+
class ConfirmationDialog;
class MultiplayerSynchronizer;
class Tree;
@@ -46,24 +50,46 @@ private:
AcceptDialog *error_dialog = nullptr;
ConfirmationDialog *delete_dialog = nullptr;
- Button *add_button = nullptr;
+ Button *add_pick_button = nullptr;
+ Button *add_from_path_button = nullptr;
LineEdit *np_line_edit = nullptr;
+ Label *drop_label = nullptr;
+
Ref<SceneReplicationConfig> config;
NodePath deleting;
Tree *tree = nullptr;
bool keying = false;
+ PropertySelector *prop_selector = nullptr;
+ SceneTreeDialog *pick_node = nullptr;
+ NodePath adding_node_path;
+
+ Button *pin = nullptr;
+
Ref<Texture2D> _get_class_icon(const Node *p_node);
void _add_pressed();
void _tree_item_edited();
- void _tree_button_pressed(Object *p_item, int p_column, int p_id);
+ void _tree_button_pressed(Object *p_item, int p_column, int p_id, MouseButton p_button);
void _update_checked(const NodePath &p_prop, int p_column, bool p_checked);
void _update_config();
void _dialog_closed(bool p_confirmed);
void _add_property(const NodePath &p_property, bool p_spawn = true, bool p_sync = true);
+ void _pick_node_filter_text_changed(const String &p_newtext);
+ void _pick_node_select_recursive(TreeItem *p_item, const String &p_filter, Vector<Node *> &p_select_candidates);
+ void _pick_node_filter_input(const Ref<InputEvent> &p_ie);
+ void _pick_node_selected(NodePath p_path);
+
+ void _pick_new_property();
+ void _pick_node_property_selected(String p_name);
+
+ bool _can_drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from) const;
+ void _drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from);
+
+ void _add_sync_property(String p_path);
+
protected:
static void _bind_methods();
@@ -76,6 +102,7 @@ public:
MultiplayerSynchronizer *get_current() const { return current; }
void property_keyed(const String &p_property);
+ Button *get_pin() { return pin; }
ReplicationEditor();
~ReplicationEditor() {}
};
@@ -84,12 +111,15 @@ class ReplicationEditorPlugin : public EditorPlugin {
GDCLASS(ReplicationEditorPlugin, EditorPlugin);
private:
+ Button *button = nullptr;
ReplicationEditor *repl_editor = nullptr;
void _node_removed(Node *p_node);
void _keying_changed();
void _property_keyed(const String &p_keyed, const Variant &p_value, bool p_advance);
+ void _pinned();
+
protected:
void _notification(int p_what);
diff --git a/editor/plugins/resource_preloader_editor_plugin.cpp b/editor/plugins/resource_preloader_editor_plugin.cpp
index 71d31aa1d7..16e874d7e2 100644
--- a/editor/plugins/resource_preloader_editor_plugin.cpp
+++ b/editor/plugins/resource_preloader_editor_plugin.cpp
@@ -213,7 +213,11 @@ void ResourcePreloaderEditor::_update_library() {
//player->add_resource("default",resource);
}
-void ResourcePreloaderEditor::_cell_button_pressed(Object *p_item, int p_column, int p_id) {
+void ResourcePreloaderEditor::_cell_button_pressed(Object *p_item, int p_column, int p_id, MouseButton p_button) {
+ if (p_button != MouseButton::LEFT) {
+ return;
+ }
+
TreeItem *item = Object::cast_to<TreeItem>(p_item);
ERR_FAIL_COND(!item);
@@ -359,7 +363,7 @@ ResourcePreloaderEditor::ResourcePreloaderEditor() {
add_child(file);
tree = memnew(Tree);
- tree->connect("button_pressed", callable_mp(this, &ResourcePreloaderEditor::_cell_button_pressed));
+ tree->connect("button_clicked", callable_mp(this, &ResourcePreloaderEditor::_cell_button_pressed));
tree->set_columns(2);
tree->set_column_expand_ratio(0, 2);
tree->set_column_clip_content(0, true);
diff --git a/editor/plugins/resource_preloader_editor_plugin.h b/editor/plugins/resource_preloader_editor_plugin.h
index 0b799c13c6..96cef3de21 100644
--- a/editor/plugins/resource_preloader_editor_plugin.h
+++ b/editor/plugins/resource_preloader_editor_plugin.h
@@ -63,7 +63,7 @@ class ResourcePreloaderEditor : public PanelContainer {
void _paste_pressed();
void _remove_resource(const String &p_to_remove);
void _update_library();
- void _cell_button_pressed(Object *p_item, int p_column, int p_id);
+ void _cell_button_pressed(Object *p_item, int p_column, int p_id, MouseButton p_button);
void _item_edited();
UndoRedo *undo_redo = nullptr;
diff --git a/editor/plugins/skeleton_3d_editor_plugin.cpp b/editor/plugins/skeleton_3d_editor_plugin.cpp
index 1ebdf466fe..8845fe9eca 100644
--- a/editor/plugins/skeleton_3d_editor_plugin.cpp
+++ b/editor/plugins/skeleton_3d_editor_plugin.cpp
@@ -569,7 +569,7 @@ void Skeleton3DEditor::_joint_tree_selection_changed() {
}
// May be not used with single select mode.
-void Skeleton3DEditor::_joint_tree_rmb_select(const Vector2 &p_pos) {
+void Skeleton3DEditor::_joint_tree_rmb_select(const Vector2 &p_pos, MouseButton p_button) {
}
void Skeleton3DEditor::_update_properties() {
@@ -766,7 +766,7 @@ void Skeleton3DEditor::_notification(int p_what) {
update_joint_tree();
update_editors();
joint_tree->connect("item_selected", callable_mp(this, &Skeleton3DEditor::_joint_tree_selection_changed));
- joint_tree->connect("item_rmb_selected", callable_mp(this, &Skeleton3DEditor::_joint_tree_rmb_select));
+ joint_tree->connect("item_mouse_selected", callable_mp(this, &Skeleton3DEditor::_joint_tree_rmb_select));
#ifdef TOOLS_ENABLED
skeleton->connect("pose_updated", callable_mp(this, &Skeleton3DEditor::_draw_gizmo));
skeleton->connect("pose_updated", callable_mp(this, &Skeleton3DEditor::_update_properties));
@@ -821,7 +821,7 @@ Skeleton3DEditor::Skeleton3DEditor(EditorInspectorPluginSkeleton *e_plugin, Skel
shader_type spatial;
render_mode unshaded, shadows_disabled, depth_draw_always;
-uniform sampler2D texture_albedo : hint_albedo;
+uniform sampler2D texture_albedo : source_color;
uniform float point_size : hint_range(0,128) = 32;
void vertex() {
if (!OUTPUT_IS_SRGB) {
diff --git a/editor/plugins/skeleton_3d_editor_plugin.h b/editor/plugins/skeleton_3d_editor_plugin.h
index f4a82225f2..8f03e7c8db 100644
--- a/editor/plugins/skeleton_3d_editor_plugin.h
+++ b/editor/plugins/skeleton_3d_editor_plugin.h
@@ -181,7 +181,7 @@ class Skeleton3DEditor : public VBoxContainer {
void _draw_handles();
void _joint_tree_selection_changed();
- void _joint_tree_rmb_select(const Vector2 &p_pos);
+ void _joint_tree_rmb_select(const Vector2 &p_pos, MouseButton p_button);
void _update_properties();
void _subgizmo_selection_change();
diff --git a/editor/plugins/sprite_frames_editor_plugin.h b/editor/plugins/sprite_frames_editor_plugin.h
index f7985aba18..3c8c5ef19d 100644
--- a/editor/plugins/sprite_frames_editor_plugin.h
+++ b/editor/plugins/sprite_frames_editor_plugin.h
@@ -50,7 +50,7 @@ class SpriteFramesEditor : public HSplitContainer {
enum {
PARAM_USE_CURRENT, // Used in callbacks to indicate `dominant_param` should be not updated.
- PARAM_FRAME_COUNT, // Keep "Horizontal" & "Vertial" values.
+ PARAM_FRAME_COUNT, // Keep "Horizontal" & "Vertical" values.
PARAM_SIZE, // Keep "Size" values.
};
int dominant_param = PARAM_FRAME_COUNT;
diff --git a/editor/plugins/texture_region_editor_plugin.cpp b/editor/plugins/texture_region_editor_plugin.cpp
index 74c96e19d0..2b24ebaebd 100644
--- a/editor/plugins/texture_region_editor_plugin.cpp
+++ b/editor/plugins/texture_region_editor_plugin.cpp
@@ -37,6 +37,7 @@
#include "editor/editor_scale.h"
#include "scene/gui/check_box.h"
#include "scene/gui/view_panner.h"
+#include "scene/resources/texture.h"
void draw_margin_line(Control *edit_draw, Vector2 from, Vector2 to) {
Vector2 line = (to - from).normalized() * 10;
@@ -228,8 +229,8 @@ void TextureRegionEditor::_region_draw() {
Size2 vmin = vscroll->get_combined_minimum_size();
// Avoid scrollbar overlapping.
- hscroll->set_anchor_and_offset(SIDE_RIGHT, ANCHOR_END, vscroll->is_visible() ? -vmin.width : 0);
- vscroll->set_anchor_and_offset(SIDE_BOTTOM, ANCHOR_END, hscroll->is_visible() ? -hmin.height : 0);
+ hscroll->set_anchor_and_offset(SIDE_RIGHT, Control::ANCHOR_END, vscroll->is_visible() ? -vmin.width : 0);
+ vscroll->set_anchor_and_offset(SIDE_BOTTOM, Control::ANCHOR_END, hscroll->is_visible() ? -hmin.height : 0);
updating_scroll = false;
@@ -817,8 +818,8 @@ void TextureRegionEditor::_notification(int p_what) {
zoom_reset->set_icon(get_theme_icon(SNAME("ZoomReset"), SNAME("EditorIcons")));
zoom_in->set_icon(get_theme_icon(SNAME("ZoomMore"), SNAME("EditorIcons")));
- vscroll->set_anchors_and_offsets_preset(PRESET_RIGHT_WIDE);
- hscroll->set_anchors_and_offsets_preset(PRESET_BOTTOM_WIDE);
+ vscroll->set_anchors_and_offsets_preset(Control::PRESET_RIGHT_WIDE);
+ hscroll->set_anchors_and_offsets_preset(Control::PRESET_BOTTOM_WIDE);
[[fallthrough]];
}
case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: {
@@ -921,6 +922,7 @@ void TextureRegionEditor::edit(Object *p_obj) {
atlas_tex = Ref<AtlasTexture>(nullptr);
}
edit_draw->update();
+ popup_centered_ratio();
}
void TextureRegionEditor::_texture_changed() {
@@ -977,6 +979,9 @@ Vector2 TextureRegionEditor::snap_point(Vector2 p_target) const {
}
TextureRegionEditor::TextureRegionEditor() {
+ get_ok_button()->set_text(TTR("Close"));
+ VBoxContainer *vb = memnew(VBoxContainer);
+ add_child(vb);
node_sprite_2d = nullptr;
node_sprite_3d = nullptr;
node_ninepatch = nullptr;
@@ -992,7 +997,7 @@ TextureRegionEditor::TextureRegionEditor() {
drag = false;
HBoxContainer *hb_tools = memnew(HBoxContainer);
- add_child(hb_tools);
+ vb->add_child(hb_tools);
hb_tools->add_child(memnew(Label(TTR("Snap Mode:"))));
snap_mode_button = memnew(OptionButton);
@@ -1076,12 +1081,12 @@ TextureRegionEditor::TextureRegionEditor() {
panner->set_callbacks(callable_mp(this, &TextureRegionEditor::_scroll_callback), callable_mp(this, &TextureRegionEditor::_pan_callback), callable_mp(this, &TextureRegionEditor::_zoom_callback));
edit_draw = memnew(Panel);
- add_child(edit_draw);
- edit_draw->set_v_size_flags(SIZE_EXPAND_FILL);
+ vb->add_child(edit_draw);
+ edit_draw->set_v_size_flags(Control::SIZE_EXPAND_FILL);
edit_draw->connect("draw", callable_mp(this, &TextureRegionEditor::_region_draw));
edit_draw->connect("gui_input", callable_mp(this, &TextureRegionEditor::_region_input));
edit_draw->connect("focus_exited", callable_mp(panner.ptr(), &ViewPanner::release_pan_key));
- edit_draw->set_focus_mode(FOCUS_CLICK);
+ edit_draw->set_focus_mode(Control::FOCUS_CLICK);
draw_zoom = 1.0;
edit_draw->set_clip_contents(true);
@@ -1119,88 +1124,40 @@ TextureRegionEditor::TextureRegionEditor() {
updating_scroll = false;
autoslice_is_dirty = true;
-}
-void TextureRegionEditorPlugin::edit(Object *p_object) {
- region_editor->edit(p_object);
+ set_title(TTR("Region Editor"));
}
-bool TextureRegionEditorPlugin::handles(Object *p_object) const {
- return p_object->is_class("Sprite2D") || p_object->is_class("Sprite3D") || p_object->is_class("NinePatchRect") || p_object->is_class("StyleBoxTexture") || p_object->is_class("AtlasTexture");
-}
+////////////////////////
-void TextureRegionEditorPlugin::_editor_visiblity_changed() {
- manually_hidden = !region_editor->is_visible_in_tree();
+bool EditorInspectorPluginTextureRegion::can_handle(Object *p_object) {
+ return Object::cast_to<Sprite2D>(p_object) || Object::cast_to<Sprite3D>(p_object) || Object::cast_to<NinePatchRect>(p_object) || Object::cast_to<StyleBoxTexture>(p_object) || Object::cast_to<AtlasTexture>(p_object);
}
-void TextureRegionEditorPlugin::make_visible(bool p_visible) {
- if (p_visible) {
- texture_region_button->show();
- bool is_node_configured = region_editor->is_stylebox() || region_editor->is_atlas_texture() || region_editor->is_ninepatch();
- is_node_configured |= region_editor->get_sprite_2d() && region_editor->get_sprite_2d()->is_region_enabled();
- is_node_configured |= region_editor->get_sprite_3d() && region_editor->get_sprite_3d()->is_region_enabled();
- if ((is_node_configured && !manually_hidden) || texture_region_button->is_pressed()) {
- EditorNode::get_singleton()->make_bottom_panel_item_visible(region_editor);
- }
- } else {
- if (region_editor->is_visible_in_tree()) {
- EditorNode::get_singleton()->hide_bottom_panel();
- manually_hidden = false;
- }
- texture_region_button->hide();
- region_editor->edit(nullptr);
- }
-}
-
-Dictionary TextureRegionEditorPlugin::get_state() const {
- Dictionary state;
- state["snap_offset"] = region_editor->snap_offset;
- state["snap_step"] = region_editor->snap_step;
- state["snap_separation"] = region_editor->snap_separation;
- state["snap_mode"] = region_editor->snap_mode;
- return state;
+void EditorInspectorPluginTextureRegion::_region_edit(Object *p_object) {
+ texture_region_editor->edit(p_object);
}
-void TextureRegionEditorPlugin::set_state(const Dictionary &p_state) {
- Dictionary state = p_state;
- if (state.has("snap_step")) {
- Vector2 s = state["snap_step"];
- region_editor->sb_step_x->set_value(s.x);
- region_editor->sb_step_y->set_value(s.y);
- region_editor->snap_step = s;
- }
-
- if (state.has("snap_offset")) {
- Vector2 ofs = state["snap_offset"];
- region_editor->sb_off_x->set_value(ofs.x);
- region_editor->sb_off_y->set_value(ofs.y);
- region_editor->snap_offset = ofs;
- }
-
- if (state.has("snap_separation")) {
- Vector2 sep = state["snap_separation"];
- region_editor->sb_sep_x->set_value(sep.x);
- region_editor->sb_sep_y->set_value(sep.y);
- region_editor->snap_separation = sep;
- }
-
- if (state.has("snap_mode")) {
- region_editor->_set_snap_mode(state["snap_mode"]);
- region_editor->snap_mode_button->select(state["snap_mode"]);
+bool EditorInspectorPluginTextureRegion::parse_property(Object *p_object, const Variant::Type p_type, const String &p_path, const PropertyHint p_hint, const String &p_hint_text, const uint32_t p_usage, const bool p_wide) {
+ if ((p_type == Variant::RECT2 || p_type == Variant::RECT2I)) {
+ if (((Object::cast_to<Sprite2D>(p_object) || Object::cast_to<Sprite3D>(p_object) || Object::cast_to<NinePatchRect>(p_object) || Object::cast_to<StyleBoxTexture>(p_object)) && p_path == "region_rect") || (Object::cast_to<AtlasTexture>(p_object) && p_path == "region")) {
+ Button *button = memnew(Button);
+ button->set_text(TTR("Edit Region"));
+ button->set_icon(texture_region_editor->get_theme_icon(SNAME("RegionEdit"), SNAME("EditorIcons")));
+ button->connect("pressed", callable_mp(this, &EditorInspectorPluginTextureRegion::_region_edit), varray(p_object));
+ add_property_editor(p_path, button, true);
+ }
}
+ return false; //not exclusive
}
-void TextureRegionEditorPlugin::_bind_methods() {
+EditorInspectorPluginTextureRegion::EditorInspectorPluginTextureRegion() {
+ texture_region_editor = memnew(TextureRegionEditor);
+ EditorNode::get_singleton()->get_gui_base()->add_child(texture_region_editor);
}
TextureRegionEditorPlugin::TextureRegionEditorPlugin() {
- manually_hidden = false;
-
- region_editor = memnew(TextureRegionEditor);
- region_editor->set_custom_minimum_size(Size2(0, 200) * EDSCALE);
- region_editor->hide();
- region_editor->connect("visibility_changed", callable_mp(this, &TextureRegionEditorPlugin::_editor_visiblity_changed));
-
- texture_region_button = EditorNode::get_singleton()->add_bottom_panel_item(TTR("TextureRegion"), region_editor);
- texture_region_button->hide();
+ Ref<EditorInspectorPluginTextureRegion> inspector_plugin;
+ inspector_plugin.instantiate();
+ add_inspector_plugin(inspector_plugin);
}
diff --git a/editor/plugins/texture_region_editor_plugin.h b/editor/plugins/texture_region_editor_plugin.h
index 2c4ab72743..dd92f6e3eb 100644
--- a/editor/plugins/texture_region_editor_plugin.h
+++ b/editor/plugins/texture_region_editor_plugin.h
@@ -41,8 +41,8 @@
class ViewPanner;
-class TextureRegionEditor : public VBoxContainer {
- GDCLASS(TextureRegionEditor, VBoxContainer);
+class TextureRegionEditor : public AcceptDialog {
+ GDCLASS(TextureRegionEditor, AcceptDialog);
enum SnapMode {
SNAP_NONE,
@@ -142,26 +142,27 @@ public:
TextureRegionEditor();
};
-class TextureRegionEditorPlugin : public EditorPlugin {
- GDCLASS(TextureRegionEditorPlugin, EditorPlugin);
+//
- bool manually_hidden;
- Button *texture_region_button = nullptr;
- TextureRegionEditor *region_editor = nullptr;
+class EditorInspectorPluginTextureRegion : public EditorInspectorPlugin {
+ GDCLASS(EditorInspectorPluginTextureRegion, EditorInspectorPlugin);
-protected:
- static void _bind_methods();
+ TextureRegionEditor *texture_region_editor = nullptr;
+
+ void _region_edit(Object *p_object);
- void _editor_visiblity_changed();
+public:
+ 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 uint32_t p_usage, const bool p_wide) override;
+
+ EditorInspectorPluginTextureRegion();
+};
+
+class TextureRegionEditorPlugin : public EditorPlugin {
+ GDCLASS(TextureRegionEditorPlugin, EditorPlugin);
public:
virtual String get_name() const override { return "TextureRegion"; }
- bool has_main_screen() const override { return false; }
- virtual void edit(Object *p_object) override;
- virtual bool handles(Object *p_object) const override;
- virtual void make_visible(bool p_visible) override;
- void set_state(const Dictionary &p_state) override;
- Dictionary get_state() const override;
TextureRegionEditorPlugin();
};
diff --git a/editor/plugins/theme_editor_plugin.cpp b/editor/plugins/theme_editor_plugin.cpp
index 7b2c7d2a82..751751aaaa 100644
--- a/editor/plugins/theme_editor_plugin.cpp
+++ b/editor/plugins/theme_editor_plugin.cpp
@@ -1287,7 +1287,11 @@ void ThemeItemEditorDialog::_edited_type_selected() {
_update_edit_item_tree(selected_type);
}
-void ThemeItemEditorDialog::_edited_type_button_pressed(Object *p_item, int p_column, int p_id) {
+void ThemeItemEditorDialog::_edited_type_button_pressed(Object *p_item, int p_column, int p_id, MouseButton p_button) {
+ if (p_button != MouseButton::LEFT) {
+ return;
+ }
+
TreeItem *item = Object::cast_to<TreeItem>(p_item);
if (!item) {
return;
@@ -1461,7 +1465,11 @@ void ThemeItemEditorDialog::_update_edit_item_tree(String p_item_type) {
}
}
-void ThemeItemEditorDialog::_item_tree_button_pressed(Object *p_item, int p_column, int p_id) {
+void ThemeItemEditorDialog::_item_tree_button_pressed(Object *p_item, int p_column, int p_id, MouseButton p_button) {
+ if (p_button != MouseButton::LEFT) {
+ return;
+ }
+
TreeItem *item = Object::cast_to<TreeItem>(p_item);
if (!item) {
return;
@@ -1909,7 +1917,7 @@ ThemeItemEditorDialog::ThemeItemEditorDialog(ThemeTypeEditor *p_theme_type_edito
edit_type_list->set_v_size_flags(Control::SIZE_EXPAND_FILL);
edit_dialog_side_vb->add_child(edit_type_list);
edit_type_list->connect("item_selected", callable_mp(this, &ThemeItemEditorDialog::_edited_type_selected));
- edit_type_list->connect("button_pressed", callable_mp(this, &ThemeItemEditorDialog::_edited_type_button_pressed));
+ edit_type_list->connect("button_clicked", callable_mp(this, &ThemeItemEditorDialog::_edited_type_button_pressed));
Label *edit_add_type_label = memnew(Label);
edit_add_type_label->set_text(TTR("Add Type:"));
@@ -2011,7 +2019,7 @@ ThemeItemEditorDialog::ThemeItemEditorDialog(ThemeTypeEditor *p_theme_type_edito
edit_items_tree->set_hide_root(true);
edit_items_tree->set_columns(1);
edit_items_vb->add_child(edit_items_tree);
- edit_items_tree->connect("button_pressed", callable_mp(this, &ThemeItemEditorDialog::_item_tree_button_pressed));
+ edit_items_tree->connect("button_clicked", callable_mp(this, &ThemeItemEditorDialog::_item_tree_button_pressed));
edit_items_message = memnew(Label);
edit_items_message->set_anchors_and_offsets_preset(Control::PRESET_WIDE);
diff --git a/editor/plugins/theme_editor_plugin.h b/editor/plugins/theme_editor_plugin.h
index 323cfceb7e..543113a5eb 100644
--- a/editor/plugins/theme_editor_plugin.h
+++ b/editor/plugins/theme_editor_plugin.h
@@ -249,10 +249,10 @@ class ThemeItemEditorDialog : public AcceptDialog {
void _dialog_about_to_show();
void _update_edit_types();
void _edited_type_selected();
- void _edited_type_button_pressed(Object *p_item, int p_column, int p_id);
+ void _edited_type_button_pressed(Object *p_item, int p_column, int p_id, MouseButton p_button);
void _update_edit_item_tree(String p_item_type);
- void _item_tree_button_pressed(Object *p_item, int p_column, int p_id);
+ void _item_tree_button_pressed(Object *p_item, int p_column, int p_id, MouseButton p_button);
void _add_theme_type(const String &p_new_text);
void _add_theme_item(Theme::DataType p_data_type, String p_item_name, String p_item_type);
diff --git a/editor/plugins/visual_shader_editor_plugin.cpp b/editor/plugins/visual_shader_editor_plugin.cpp
index f8797ded66..6e13a31a1f 100644
--- a/editor/plugins/visual_shader_editor_plugin.cpp
+++ b/editor/plugins/visual_shader_editor_plugin.cpp
@@ -5257,6 +5257,8 @@ VisualShaderEditor::VisualShaderEditor() {
add_options.push_back(AddOption("QuarterResColor", "Input", "Sky", "VisualShaderNodeInput", vformat(input_param_for_sky_shader_mode, "quarter_res_color", "QUARTER_RES_COLOR"), { "quarter_res_color" }, VisualShaderNode::PORT_TYPE_VECTOR_4D, TYPE_FLAGS_SKY, Shader::MODE_SKY));
add_options.push_back(AddOption("Radiance", "Input", "Sky", "VisualShaderNodeInput", vformat(input_param_for_sky_shader_mode, "radiance", "RADIANCE"), { "radiance" }, VisualShaderNode::PORT_TYPE_SAMPLER, TYPE_FLAGS_SKY, Shader::MODE_SKY));
add_options.push_back(AddOption("ScreenUV", "Input", "Sky", "VisualShaderNodeInput", vformat(input_param_for_sky_shader_mode, "screen_uv", "SCREEN_UV"), { "screen_uv" }, VisualShaderNode::PORT_TYPE_VECTOR_2D, TYPE_FLAGS_SKY, Shader::MODE_SKY));
+ add_options.push_back(AddOption("FragCoord", "Input", "Sky", "VisualShaderNodeInput", vformat(input_param_for_sky_shader_mode, "fragcoord", "FRAGCOORD"), { "fragcoord" }, VisualShaderNode::PORT_TYPE_VECTOR_4D, TYPE_FLAGS_SKY, Shader::MODE_SKY));
+
add_options.push_back(AddOption("SkyCoords", "Input", "Sky", "VisualShaderNodeInput", vformat(input_param_for_sky_shader_mode, "sky_coords", "SKY_COORDS"), { "sky_coords" }, VisualShaderNode::PORT_TYPE_VECTOR_2D, TYPE_FLAGS_SKY, Shader::MODE_SKY));
add_options.push_back(AddOption("Time", "Input", "Sky", "VisualShaderNodeInput", vformat(input_param_for_sky_shader_mode, "time", "TIME"), { "time" }, VisualShaderNode::PORT_TYPE_SCALAR, TYPE_FLAGS_SKY, Shader::MODE_SKY));