summaryrefslogtreecommitdiff
path: root/editor
diff options
context:
space:
mode:
Diffstat (limited to 'editor')
-rw-r--r--editor/collada/collada.cpp4
-rw-r--r--editor/editor_data.cpp2
-rw-r--r--editor/editor_node.cpp12
-rw-r--r--editor/groups_editor.cpp437
-rw-r--r--editor/groups_editor.h66
-rw-r--r--editor/plugins/animation_player_editor_plugin.cpp7
-rw-r--r--editor/plugins/asset_library_editor_plugin.cpp14
-rw-r--r--editor/plugins/asset_library_editor_plugin.h1
-rw-r--r--editor/plugins/canvas_item_editor_plugin.cpp107
-rw-r--r--editor/plugins/canvas_item_editor_plugin.h3
-rw-r--r--editor/plugins/navigation_mesh_generator.cpp34
-rw-r--r--editor/plugins/path_editor_plugin.cpp11
-rw-r--r--editor/plugins/sprite_frames_editor_plugin.cpp26
-rw-r--r--editor/plugins/tile_map_editor_plugin.h19
-rw-r--r--editor/plugins/tile_set_editor_plugin.cpp7
-rw-r--r--editor/script_editor_debugger.cpp23
-rw-r--r--editor/spatial_editor_gizmos.cpp4
17 files changed, 644 insertions, 133 deletions
diff --git a/editor/collada/collada.cpp b/editor/collada/collada.cpp
index 4ce57d7f63..734229d014 100644
--- a/editor/collada/collada.cpp
+++ b/editor/collada/collada.cpp
@@ -2266,10 +2266,8 @@ void Collada::_merge_skeletons2(VisualScene *p_vscene) {
}
node = node->parent;
}
- ERR_CONTINUE(!sk);
- if (!sk)
- continue; //bleh
+ ERR_CONTINUE(!sk);
if (!skeleton) {
skeleton = sk;
diff --git a/editor/editor_data.cpp b/editor/editor_data.cpp
index 660eaafe8e..37a35b6ebf 100644
--- a/editor/editor_data.cpp
+++ b/editor/editor_data.cpp
@@ -588,8 +588,6 @@ bool EditorData::check_and_update_scene(int p_idx) {
bool must_reload = _find_updated_instances(edited_scene[p_idx].root, edited_scene[p_idx].root, checked_scenes);
- print_line("MUST RELOAD? " + itos(must_reload));
-
if (must_reload) {
Ref<PackedScene> pscene;
pscene.instance();
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp
index 4bf040c378..f68f8380fd 100644
--- a/editor/editor_node.cpp
+++ b/editor/editor_node.cpp
@@ -469,18 +469,18 @@ void EditorNode::_fs_changed() {
preset.unref();
}
if (preset.is_null()) {
- String err = "Unknown export preset: " + export_defer.preset;
- ERR_PRINTS(err);
+ String errstr = "Unknown export preset: " + export_defer.preset;
+ ERR_PRINTS(errstr);
} else {
Ref<EditorExportPlatform> platform = preset->get_platform();
if (platform.is_null()) {
- String err = "Preset \"" + export_defer.preset + "\" doesn't have a platform.";
- ERR_PRINTS(err);
+ String errstr = "Preset \"" + export_defer.preset + "\" doesn't have a platform.";
+ ERR_PRINTS(errstr);
} else {
// ensures export_project does not loop infinitely, because notifications may
// come during the export
export_defer.preset = "";
- Error err;
+ Error err = OK;
if (!preset->is_runnable() && (export_defer.path.ends_with(".pck") || export_defer.path.ends_with(".zip"))) {
if (export_defer.path.ends_with(".zip")) {
err = platform->export_zip(preset, export_defer.debug, export_defer.path);
@@ -491,7 +491,7 @@ void EditorNode::_fs_changed() {
err = platform->export_project(preset, export_defer.debug, export_defer.path);
}
if (err != OK) {
- ERR_PRINTS(vformat(TTR("Project export failed with error code %d. Missing template?"), (int)err));
+ ERR_PRINTS(vformat(TTR("Project export failed with error code %d."), (int)err));
}
}
}
diff --git a/editor/groups_editor.cpp b/editor/groups_editor.cpp
index bac18be4a9..8443311a54 100644
--- a/editor/groups_editor.cpp
+++ b/editor/groups_editor.cpp
@@ -29,12 +29,426 @@
/*************************************************************************/
#include "groups_editor.h"
-
+#include "editor/scene_tree_editor.h"
#include "editor_node.h"
#include "scene/gui/box_container.h"
#include "scene/gui/label.h"
#include "scene/resources/packed_scene.h"
+void GroupDialog::ok_pressed() {
+}
+
+void GroupDialog::_cancel_pressed() {
+}
+
+void GroupDialog::_group_selected() {
+ nodes_to_add->clear();
+ add_node_root = nodes_to_add->create_item();
+
+ nodes_to_remove->clear();
+ remove_node_root = nodes_to_remove->create_item();
+
+ if (!groups->is_anything_selected()) {
+ return;
+ }
+
+ selected_group = groups->get_selected()->get_text(0);
+ _load_nodes(scene_tree->get_edited_scene_root());
+}
+
+void GroupDialog::_load_nodes(Node *p_current) {
+ String item_name = p_current->get_name();
+ if (p_current != scene_tree->get_edited_scene_root()) {
+ item_name = String(p_current->get_parent()->get_name()) + "/" + String(item_name);
+ }
+
+ bool keep = true;
+ Node *root = scene_tree->get_edited_scene_root();
+ Node *owner = p_current->get_owner();
+ if (owner != root && p_current != root && !owner && !root->is_editable_instance(owner)) {
+ keep = false;
+ }
+
+ TreeItem *node;
+ NodePath path = scene_tree->get_edited_scene_root()->get_path_to(p_current);
+ if (keep && p_current->is_in_group(selected_group)) {
+ if (remove_filter->get_text().is_subsequence_ofi(String(p_current->get_name()))) {
+ node = nodes_to_remove->create_item(remove_node_root);
+ keep = true;
+ } else {
+ keep = false;
+ }
+ } else if (keep && add_filter->get_text().is_subsequence_ofi(String(p_current->get_name()))) {
+ node = nodes_to_add->create_item(add_node_root);
+ keep = true;
+ } else {
+ keep = false;
+ }
+
+ if (keep) {
+ node->set_text(0, item_name);
+ node->set_metadata(0, path);
+ node->set_tooltip(0, path);
+
+ Ref<Texture> icon;
+ if (p_current->has_meta("_editor_icon")) {
+ icon = p_current->get_meta("_editor_icon");
+ } else {
+ icon = get_icon((has_icon(p_current->get_class(), "EditorIcons") ? p_current->get_class() : String("Object")), "EditorIcons");
+ }
+ node->set_icon(0, icon);
+
+ if (!_can_edit(p_current, selected_group)) {
+ node->set_selectable(0, false);
+ node->set_custom_color(0, get_color("disabled_font_color", "Editor"));
+ }
+ }
+
+ for (int i = 0; i < p_current->get_child_count(); i++) {
+ _load_nodes(p_current->get_child(i));
+ }
+}
+
+bool GroupDialog::_can_edit(Node *p_node, String p_group) {
+ Node *n = p_node;
+ bool can_edit = true;
+ while (n) {
+ Ref<SceneState> ss = (n == EditorNode::get_singleton()->get_edited_scene()) ? n->get_scene_inherited_state() : n->get_scene_instance_state();
+ if (ss.is_valid()) {
+ int path = ss->find_node_by_path(n->get_path_to(p_node));
+ if (path != -1) {
+ if (ss->is_node_in_group(path, p_group)) {
+ can_edit = false;
+ }
+ }
+ }
+ n = n->get_owner();
+ }
+ return can_edit;
+}
+
+void GroupDialog::_add_pressed() {
+ TreeItem *selected = nodes_to_add->get_selected();
+
+ if (!selected) {
+ return;
+ }
+
+ while (selected) {
+ Node *node = scene_tree->get_edited_scene_root()->get_node(selected->get_metadata(0));
+ node->add_to_group(selected_group, true);
+
+ selected = nodes_to_add->get_next_selected(selected);
+ }
+
+ _group_selected();
+ EditorNode::get_singleton()->get_scene_tree_dock()->get_tree_editor()->update_tree();
+}
+
+void GroupDialog::_removed_pressed() {
+ TreeItem *selected = nodes_to_remove->get_selected();
+
+ if (!selected) {
+ return;
+ }
+
+ while (selected) {
+ Node *node = scene_tree->get_edited_scene_root()->get_node(selected->get_metadata(0));
+ node->remove_from_group(selected_group);
+
+ selected = nodes_to_add->get_next_selected(selected);
+ }
+
+ _group_selected();
+ EditorNode::get_singleton()->get_scene_tree_dock()->get_tree_editor()->update_tree();
+}
+
+void GroupDialog::_remove_filter_changed(const String &p_filter) {
+ _group_selected();
+}
+
+void GroupDialog::_add_filter_changed(const String &p_filter) {
+ _group_selected();
+}
+
+void GroupDialog::_add_group_pressed() {
+ _add_group(add_group_text->get_text());
+ add_group_text->clear();
+}
+
+void GroupDialog::_group_renamed() {
+ TreeItem *renamed_group = groups->get_edited();
+ if (!renamed_group) {
+ return;
+ }
+
+ String name = renamed_group->get_text(0).strip_edges();
+ for (TreeItem *E = groups_root->get_children(); E; E = E->get_next()) {
+ if (E != renamed_group && E->get_text(0) == name) {
+ renamed_group->set_text(0, selected_group);
+ error->set_text(TTR("Group name already exists."));
+ error->popup_centered();
+ return;
+ }
+ }
+
+ if (name == "") {
+ renamed_group->set_text(0, selected_group);
+ error->set_text(TTR("invalid Group name."));
+ error->popup_centered();
+ return;
+ }
+
+ List<Node *> nodes;
+ scene_tree->get_nodes_in_group(selected_group, &nodes);
+ bool removed_all = true;
+ for (List<Node *>::Element *E = nodes.front(); E; E = E->next()) {
+ Node *node = E->get();
+ if (_can_edit(node, selected_group)) {
+ node->remove_from_group(selected_group);
+ node->add_to_group(name, true);
+ } else {
+ removed_all = false;
+ }
+ }
+
+ if (!removed_all) {
+ _add_group(selected_group);
+ }
+
+ selected_group = renamed_group->get_text(0);
+ _group_selected();
+}
+
+void GroupDialog::_add_group(String p_name) {
+
+ String name = p_name.strip_edges();
+ if (name == "" || groups->search_item_text(name)) {
+ return;
+ }
+
+ TreeItem *new_group = groups->create_item(groups_root);
+ new_group->set_text(0, name);
+ new_group->add_button(0, get_icon("Remove", "EditorIcons"), 0);
+ new_group->set_editable(0, true);
+}
+
+void GroupDialog::_load_groups(Node *p_current) {
+ List<Node::GroupInfo> gi;
+ p_current->get_groups(&gi);
+
+ for (List<Node::GroupInfo>::Element *E = gi.front(); E; E = E->next()) {
+ if (!E->get().persistent) {
+ continue;
+ }
+ _add_group(E->get().name);
+ }
+
+ for (int i = 0; i < p_current->get_child_count(); i++) {
+ _load_groups(p_current->get_child(i));
+ }
+}
+
+void GroupDialog::_delete_group_pressed(Object *p_item, int p_column, int p_id) {
+ TreeItem *ti = Object::cast_to<TreeItem>(p_item);
+ if (!ti)
+ return;
+
+ String name = ti->get_text(0);
+
+ List<Node *> nodes;
+ scene_tree->get_nodes_in_group(name, &nodes);
+ bool removed_all = true;
+ for (List<Node *>::Element *E = nodes.front(); E; E = E->next()) {
+ if (_can_edit(E->get(), name)) {
+ E->get()->remove_from_group(name);
+ } else {
+ removed_all = false;
+ }
+ }
+
+ if (removed_all) {
+ if (selected_group == name) {
+ add_filter->clear();
+ remove_filter->clear();
+ nodes_to_remove->clear();
+ nodes_to_add->clear();
+ groups->deselect_all();
+ selected_group = "";
+ }
+ groups_root->remove_child(ti);
+ }
+ EditorNode::get_singleton()->get_scene_tree_dock()->get_tree_editor()->update_tree();
+}
+
+void GroupDialog::_notification(int p_what) {
+ switch (p_what) {
+ case NOTIFICATION_ENTER_TREE: {
+ add_button->set_icon(get_icon("Forward", "EditorIcons"));
+ remove_button->set_icon(get_icon("Back", "EditorIcons"));
+ } break;
+ }
+}
+
+void GroupDialog::edit() {
+
+ popup_centered(Size2(600, 400));
+
+ groups->clear();
+ groups_root = groups->create_item();
+
+ nodes_to_add->clear();
+ nodes_to_remove->clear();
+
+ add_group_text->clear();
+ add_filter->clear();
+ remove_filter->clear();
+
+ _load_groups(scene_tree->get_edited_scene_root());
+}
+
+void GroupDialog::_bind_methods() {
+ ClassDB::bind_method("_cancel", &GroupDialog::_cancel_pressed);
+
+ ClassDB::bind_method("_add_pressed", &GroupDialog::_add_pressed);
+ ClassDB::bind_method("_removed_pressed", &GroupDialog::_removed_pressed);
+ ClassDB::bind_method("_delete_group_pressed", &GroupDialog::_delete_group_pressed);
+
+ ClassDB::bind_method("_group_selected", &GroupDialog::_group_selected);
+ ClassDB::bind_method("_add_group_pressed", &GroupDialog::_add_group_pressed);
+
+ ClassDB::bind_method("_add_filter_changed", &GroupDialog::_add_filter_changed);
+ ClassDB::bind_method("_remove_filter_changed", &GroupDialog::_remove_filter_changed);
+
+ ClassDB::bind_method("_group_renamed", &GroupDialog::_group_renamed);
+}
+
+GroupDialog::GroupDialog() {
+
+ scene_tree = SceneTree::get_singleton();
+
+ VBoxContainer *vbc = memnew(VBoxContainer);
+ add_child(vbc);
+
+ HBoxContainer *hbc = memnew(HBoxContainer);
+ vbc->add_child(hbc);
+ hbc->set_v_size_flags(SIZE_EXPAND_FILL);
+
+ VBoxContainer *vbc_left = memnew(VBoxContainer);
+ hbc->add_child(vbc_left);
+ vbc_left->set_h_size_flags(SIZE_EXPAND_FILL);
+
+ Label *group_title = memnew(Label);
+ group_title->set_text(TTR("Groups"));
+ vbc_left->add_child(group_title);
+
+ groups = memnew(Tree);
+ vbc_left->add_child(groups);
+ groups->set_hide_root(true);
+ groups->set_v_size_flags(SIZE_EXPAND_FILL);
+ groups->set_select_mode(Tree::SELECT_SINGLE);
+ groups->set_allow_reselect(true);
+ groups->set_allow_rmb_select(true);
+ groups->connect("item_selected", this, "_group_selected");
+ groups->connect("button_pressed", this, "_delete_group_pressed");
+ groups->connect("item_edited", this, "_group_renamed");
+
+ HBoxContainer *chbc = memnew(HBoxContainer);
+ vbc_left->add_child(chbc);
+ chbc->set_h_size_flags(SIZE_EXPAND_FILL);
+
+ add_group_text = memnew(LineEdit);
+ chbc->add_child(add_group_text);
+ add_group_text->set_h_size_flags(SIZE_EXPAND_FILL);
+
+ Button *add_group_button = memnew(Button);
+ add_group_button->set_text("Add");
+ chbc->add_child(add_group_button);
+ add_group_button->connect("pressed", this, "_add_group_pressed");
+
+ VBoxContainer *vbc_add = memnew(VBoxContainer);
+ hbc->add_child(vbc_add);
+ vbc_add->set_h_size_flags(SIZE_EXPAND_FILL);
+
+ Label *out_of_group_title = memnew(Label);
+ out_of_group_title->set_text(TTR("Nodes not in Group"));
+ vbc_add->add_child(out_of_group_title);
+
+ nodes_to_add = memnew(Tree);
+ vbc_add->add_child(nodes_to_add);
+ nodes_to_add->set_hide_root(true);
+ nodes_to_add->set_hide_folding(true);
+ nodes_to_add->set_v_size_flags(SIZE_EXPAND_FILL);
+ nodes_to_add->set_select_mode(Tree::SELECT_MULTI);
+ nodes_to_add->connect("item_selected", this, "_nodes_to_add_selected");
+
+ HBoxContainer *add_filter_hbc = memnew(HBoxContainer);
+ add_filter_hbc->add_constant_override("separate", 0);
+ vbc_add->add_child(add_filter_hbc);
+
+ add_filter = memnew(LineEdit);
+ add_filter->set_h_size_flags(SIZE_EXPAND_FILL);
+ add_filter->set_placeholder(TTR("Filter nodes"));
+ add_filter_hbc->add_child(add_filter);
+ add_filter->connect("text_changed", this, "_add_filter_changed");
+
+ VBoxContainer *vbc_buttons = memnew(VBoxContainer);
+ hbc->add_child(vbc_buttons);
+ vbc_buttons->set_h_size_flags(SIZE_SHRINK_CENTER);
+ vbc_buttons->set_v_size_flags(SIZE_SHRINK_CENTER);
+
+ add_button = memnew(ToolButton);
+ add_button->set_text(TTR("Add"));
+ add_button->connect("pressed", this, "_add_pressed");
+
+ vbc_buttons->add_child(add_button);
+ vbc_buttons->add_spacer();
+ vbc_buttons->add_spacer();
+ vbc_buttons->add_spacer();
+
+ remove_button = memnew(ToolButton);
+ remove_button->set_text(TTR("Remove"));
+ remove_button->connect("pressed", this, "_removed_pressed");
+
+ vbc_buttons->add_child(remove_button);
+
+ VBoxContainer *vbc_remove = memnew(VBoxContainer);
+ hbc->add_child(vbc_remove);
+ vbc_remove->set_h_size_flags(SIZE_EXPAND_FILL);
+
+ Label *in_group_title = memnew(Label);
+ in_group_title->set_text(TTR("Nodes in Group"));
+ vbc_remove->add_child(in_group_title);
+
+ nodes_to_remove = memnew(Tree);
+ vbc_remove->add_child(nodes_to_remove);
+ nodes_to_remove->set_v_size_flags(SIZE_EXPAND_FILL);
+ nodes_to_remove->set_hide_root(true);
+ nodes_to_remove->set_hide_folding(true);
+ nodes_to_remove->set_select_mode(Tree::SELECT_MULTI);
+ nodes_to_remove->connect("item_selected", this, "_node_to_remove_selected");
+
+ HBoxContainer *remove_filter_hbc = memnew(HBoxContainer);
+ remove_filter_hbc->add_constant_override("separate", 0);
+ vbc_remove->add_child(remove_filter_hbc);
+
+ remove_filter = memnew(LineEdit);
+ remove_filter->set_h_size_flags(SIZE_EXPAND_FILL);
+ remove_filter->set_placeholder(TTR("Filter nodes"));
+ remove_filter_hbc->add_child(remove_filter);
+ remove_filter->connect("text_changed", this, "_remove_filter_changed");
+
+ set_title("Group Editor");
+ get_cancel()->hide();
+ set_as_toplevel(true);
+
+ error = memnew(ConfirmationDialog);
+ add_child(error);
+ error->get_ok()->set_text(TTR("Close"));
+}
+
+////////////////////////////////////////////////////////////////////////////////
+
void GroupsEditor::_add_group(const String &p_group) {
if (!node)
@@ -146,11 +560,22 @@ void GroupsEditor::set_current(Node *p_node) {
update_tree();
}
+void GroupsEditor::_show_group_dialog() {
+ group_dialog->edit();
+}
+
+void GroupsEditor::_group_dialog_closed() {
+ update_tree();
+}
+
void GroupsEditor::_bind_methods() {
ClassDB::bind_method("_add_group", &GroupsEditor::_add_group);
ClassDB::bind_method("_remove_group", &GroupsEditor::_remove_group);
ClassDB::bind_method("update_tree", &GroupsEditor::update_tree);
+
+ ClassDB::bind_method("_show_group_dialog", &GroupsEditor::_show_group_dialog);
+ ClassDB::bind_method("_group_dialog_closed", &GroupsEditor::_group_dialog_closed);
}
GroupsEditor::GroupsEditor() {
@@ -159,6 +584,16 @@ GroupsEditor::GroupsEditor() {
VBoxContainer *vbc = this;
+ group_dialog = memnew(GroupDialog);
+ group_dialog->set_as_toplevel(true);
+ add_child(group_dialog);
+ group_dialog->connect("popup_hide", this, "_group_dialog_closed");
+
+ Button *group_dialog_button = memnew(Button);
+ group_dialog_button->set_text(TTR("Manage Groups"));
+ vbc->add_child(group_dialog_button);
+ group_dialog_button->connect("pressed", this, "_show_group_dialog");
+
HBoxContainer *hbc = memnew(HBoxContainer);
vbc->add_child(hbc);
diff --git a/editor/groups_editor.h b/editor/groups_editor.h
index ad3d5cd14f..461cf0f8c2 100644
--- a/editor/groups_editor.h
+++ b/editor/groups_editor.h
@@ -31,9 +31,13 @@
#ifndef GROUPS_EDITOR_H
#define GROUPS_EDITOR_H
+#include "editor/scene_tree_editor.h"
#include "scene/gui/button.h"
#include "scene/gui/dialogs.h"
+#include "scene/gui/item_list.h"
#include "scene/gui/line_edit.h"
+#include "scene/gui/popup.h"
+#include "scene/gui/tool_button.h"
#include "scene/gui/tree.h"
#include "undo_redo.h"
@@ -41,12 +45,71 @@
@author Juan Linietsky <reduzio@gmail.com>
*/
+class GroupDialog : public ConfirmationDialog {
+
+ GDCLASS(GroupDialog, ConfirmationDialog);
+
+ ConfirmationDialog *error;
+
+ SceneTree *scene_tree;
+ TreeItem *groups_root;
+
+ LineEdit *add_group_text;
+
+ Tree *groups;
+
+ Tree *nodes_to_add;
+ TreeItem *add_node_root;
+ LineEdit *add_filter;
+
+ Tree *nodes_to_remove;
+ TreeItem *remove_node_root;
+ LineEdit *remove_filter;
+
+ ToolButton *add_button;
+ ToolButton *remove_button;
+
+ String selected_group;
+
+ void ok_pressed();
+ void _cancel_pressed();
+ void _group_selected();
+
+ void _remove_filter_changed(const String &p_filter);
+ void _add_filter_changed(const String &p_filter);
+
+ void _add_pressed();
+ void _removed_pressed();
+ void _add_group_pressed();
+
+ void _group_renamed();
+
+ void _add_group(String p_name);
+ void _delete_group_pressed(Object *p_item, int p_column, int p_id);
+
+ bool _can_edit(Node *p_node, String p_group);
+
+ void _load_groups(Node *p_current);
+ void _load_nodes(Node *p_current);
+
+protected:
+ void _notification(int p_what);
+ static void _bind_methods();
+
+public:
+ void edit();
+
+ GroupDialog();
+};
+
class GroupsEditor : public VBoxContainer {
GDCLASS(GroupsEditor, VBoxContainer);
Node *node;
+ GroupDialog *group_dialog;
+
LineEdit *group_name;
Button *add;
Tree *tree;
@@ -58,6 +121,9 @@ class GroupsEditor : public VBoxContainer {
void _remove_group(Object *p_item, int p_column, int p_id);
void _close();
+ void _show_group_dialog();
+ void _group_dialog_closed();
+
protected:
static void _bind_methods();
diff --git a/editor/plugins/animation_player_editor_plugin.cpp b/editor/plugins/animation_player_editor_plugin.cpp
index 220003eb73..b387972558 100644
--- a/editor/plugins/animation_player_editor_plugin.cpp
+++ b/editor/plugins/animation_player_editor_plugin.cpp
@@ -459,6 +459,12 @@ void AnimationPlayerEditor::_animation_remove_confirmed() {
Ref<Animation> anim = player->get_animation(current);
undo_redo->create_action(TTR("Remove Animation"));
+ if (player->get_autoplay() == current) {
+ undo_redo->add_do_method(player, "set_autoplay", "");
+ undo_redo->add_undo_method(player, "set_autoplay", current);
+ // Avoid having the autoplay icon linger around if there is only one animation in the player
+ undo_redo->add_do_method(this, "_animation_player_changed", player);
+ }
undo_redo->add_do_method(player, "remove_animation", current);
undo_redo->add_undo_method(player, "add_animation", current, anim);
undo_redo->add_do_method(this, "_animation_player_changed", player);
@@ -822,6 +828,7 @@ void AnimationPlayerEditor::_update_player() {
save_anim->set_disabled(animlist.size() == 0);
tool_anim->set_disabled(player == NULL);
onion_skinning->set_disabled(player == NULL);
+ pin->set_disabled(player == NULL);
int active_idx = -1;
for (List<StringName>::Element *E = animlist.front(); E; E = E->next()) {
diff --git a/editor/plugins/asset_library_editor_plugin.cpp b/editor/plugins/asset_library_editor_plugin.cpp
index 23cdde299c..05833704d1 100644
--- a/editor/plugins/asset_library_editor_plugin.cpp
+++ b/editor/plugins/asset_library_editor_plugin.cpp
@@ -639,7 +639,7 @@ const char *EditorAssetLibrary::support_key[SUPPORT_MAX] = {
void EditorAssetLibrary::_select_author(int p_id) {
- //opemn author window
+ // Open author window
}
void EditorAssetLibrary::_select_category(int p_id) {
@@ -659,16 +659,6 @@ void EditorAssetLibrary::_select_category(int p_id) {
void EditorAssetLibrary::_select_asset(int p_id) {
_api_request("asset/" + itos(p_id), REQUESTING_ASSET);
-
- /*
- if (description) {
- memdelete(description);
- }
-
-
- description = memnew( EditorAssetLibraryItemDescription );
- add_child(description);
- description->popup_centered_minsize();*/
}
void EditorAssetLibrary::_image_update(bool use_cache, bool final, const PoolByteArray &p_data, int p_queue_id) {
@@ -774,7 +764,7 @@ void EditorAssetLibrary::_image_request_completed(int p_status, int p_code, cons
_image_update(p_code == HTTPClient::RESPONSE_NOT_MODIFIED, true, p_data, p_queue_id);
} else {
- WARN_PRINTS("Error getting PNG file for asset id " + itos(image_queue[p_queue_id].asset_id));
+ WARN_PRINTS("Error getting PNG file from URL: " + image_queue[p_queue_id].image_url);
Object *obj = ObjectDB::get_instance(image_queue[p_queue_id].target);
if (obj) {
obj->call("set_image", image_queue[p_queue_id].image_type, image_queue[p_queue_id].image_index, get_icon("ErrorSign", "EditorIcons"));
diff --git a/editor/plugins/asset_library_editor_plugin.h b/editor/plugins/asset_library_editor_plugin.h
index 89b79d7cfb..69a65dd3dc 100644
--- a/editor/plugins/asset_library_editor_plugin.h
+++ b/editor/plugins/asset_library_editor_plugin.h
@@ -241,7 +241,6 @@ class EditorAssetLibrary : public PanelContainer {
bool active;
int queue_id;
- int asset_id;
ImageType image_type;
int image_index;
String image_url;
diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp
index 70afc9a716..974a7765ff 100644
--- a/editor/plugins/canvas_item_editor_plugin.cpp
+++ b/editor/plugins/canvas_item_editor_plugin.cpp
@@ -628,7 +628,7 @@ void CanvasItemEditor::_save_canvas_item_state(List<CanvasItem *> p_canvas_items
if (bone && bone->has_meta("_edit_bone_")) {
// Check if we have an IK chain
List<Node2D *> bone_ik_list;
- bool ik_found;
+ bool ik_found = false;
bone = Object::cast_to<Node2D>(bone->get_parent());
while (bone) {
bone_ik_list.push_back(bone);
@@ -896,7 +896,7 @@ bool CanvasItemEditor::_gui_input_rulers_and_guides(const Ref<InputEvent> &p_eve
bool CanvasItemEditor::_gui_input_zoom_or_pan(const Ref<InputEvent> &p_event) {
Ref<InputEventMouseButton> b = p_event;
if (b.is_valid()) {
- if (b->get_button_index() == BUTTON_WHEEL_DOWN) {
+ if (b->is_pressed() && b->get_button_index() == BUTTON_WHEEL_DOWN) {
// Scroll or pan down
if (bool(EditorSettings::get_singleton()->get("editors/2d/scroll_to_pan"))) {
view_offset.y += int(EditorSettings::get_singleton()->get("editors/2d/pan_speed")) / zoom * b->get_factor();
@@ -908,7 +908,7 @@ bool CanvasItemEditor::_gui_input_zoom_or_pan(const Ref<InputEvent> &p_event) {
return true;
}
- if (b->get_button_index() == BUTTON_WHEEL_UP) {
+ if (b->is_pressed() && b->get_button_index() == BUTTON_WHEEL_UP) {
// Scroll or pan up
if (bool(EditorSettings::get_singleton()->get("editors/2d/scroll_to_pan"))) {
view_offset.y -= int(EditorSettings::get_singleton()->get("editors/2d/pan_speed")) / zoom * b->get_factor();
@@ -920,7 +920,7 @@ bool CanvasItemEditor::_gui_input_zoom_or_pan(const Ref<InputEvent> &p_event) {
return true;
}
- if (b->get_button_index() == BUTTON_WHEEL_LEFT) {
+ if (b->is_pressed() && b->get_button_index() == BUTTON_WHEEL_LEFT) {
// Pan left
if (bool(EditorSettings::get_singleton()->get("editors/2d/scroll_to_pan"))) {
view_offset.x -= int(EditorSettings::get_singleton()->get("editors/2d/pan_speed")) / zoom * b->get_factor();
@@ -930,7 +930,7 @@ bool CanvasItemEditor::_gui_input_zoom_or_pan(const Ref<InputEvent> &p_event) {
}
}
- if (b->get_button_index() == BUTTON_WHEEL_RIGHT) {
+ if (b->is_pressed() && b->get_button_index() == BUTTON_WHEEL_RIGHT) {
// Pan right
if (bool(EditorSettings::get_singleton()->get("editors/2d/scroll_to_pan"))) {
view_offset.x += int(EditorSettings::get_singleton()->get("editors/2d/pan_speed")) / zoom * b->get_factor();
@@ -939,28 +939,57 @@ bool CanvasItemEditor::_gui_input_zoom_or_pan(const Ref<InputEvent> &p_event) {
return true;
}
}
- }
- Ref<InputEventMouseMotion> m = p_event;
- if (m.is_valid()) {
if (drag_type == DRAG_NONE) {
- if (((m->get_button_mask() & BUTTON_MASK_LEFT) && tool == TOOL_PAN) ||
- (m->get_button_mask() & BUTTON_MASK_MIDDLE) ||
- ((m->get_button_mask() & BUTTON_MASK_LEFT) && Input::get_singleton()->is_key_pressed(KEY_SPACE)) ||
- (EditorSettings::get_singleton()->get("editors/2d/simple_spacebar_panning") && Input::get_singleton()->is_key_pressed(KEY_SPACE))) {
+ if (b->is_pressed() &&
+ (b->get_button_index() == BUTTON_MIDDLE ||
+ (b->get_button_index() == BUTTON_LEFT && tool == TOOL_PAN) ||
+ (b->get_button_index() == BUTTON_LEFT && !EditorSettings::get_singleton()->get("editors/2d/simple_spacebar_panning") && Input::get_singleton()->is_key_pressed(KEY_SPACE)))) {
// Pan the viewport
- Point2i relative;
- if (bool(EditorSettings::get_singleton()->get("editors/2d/warped_mouse_panning"))) {
- relative = Input::get_singleton()->warp_mouse_motion(m, viewport->get_global_rect());
- } else {
- relative = m->get_relative();
+ drag_type = DRAG_PAN;
+ }
+ }
+
+ if (drag_type == DRAG_PAN) {
+ if (!b->is_pressed()) {
+ // Stop panning the viewport (for any mouse button press)
+ drag_type = DRAG_NONE;
+ }
+ }
+ }
+
+ Ref<InputEventKey> k = p_event;
+ if (k.is_valid()) {
+ if (k->get_scancode() == KEY_SPACE && EditorSettings::get_singleton()->get("editors/2d/simple_spacebar_panning")) {
+ if (drag_type == DRAG_NONE) {
+ if (k->is_pressed() && !k->is_echo()) {
+ //Pan the viewport
+ drag_type = DRAG_PAN;
}
- view_offset.x -= relative.x / zoom;
- view_offset.y -= relative.y / zoom;
- _update_scrollbars();
- viewport->update();
- return true;
+ } else if (drag_type == DRAG_PAN) {
+ if (!k->is_pressed()) {
+ // Stop panning the viewport (for any mouse button press)
+ drag_type = DRAG_NONE;
+ }
+ }
+ }
+ }
+
+ Ref<InputEventMouseMotion> m = p_event;
+ if (m.is_valid()) {
+ if (drag_type == DRAG_PAN) {
+ // Pan the viewport
+ Point2i relative;
+ if (bool(EditorSettings::get_singleton()->get("editors/2d/warped_mouse_panning"))) {
+ relative = Input::get_singleton()->warp_mouse_motion(m, viewport->get_global_rect());
+ } else {
+ relative = m->get_relative();
}
+ view_offset.x -= relative.x / zoom;
+ view_offset.y -= relative.y / zoom;
+ _update_scrollbars();
+ viewport->update();
+ return true;
}
}
@@ -1903,10 +1932,10 @@ void CanvasItemEditor::_gui_input_viewport(const Ref<InputEvent> &p_event) {
//printf("Rotate\n");
} else if ((accepted = _gui_input_move(p_event))) {
//printf("Move\n");
- } else if ((accepted = _gui_input_select(p_event))) {
- //printf("Selection\n");
} else if ((accepted = _gui_input_zoom_or_pan(p_event))) {
//printf("Zoom or pan\n");
+ } else if ((accepted = _gui_input_select(p_event))) {
+ //printf("Selection\n");
}
if (accepted)
@@ -1919,22 +1948,18 @@ void CanvasItemEditor::_gui_input_viewport(const Ref<InputEvent> &p_event) {
CursorShape c = CURSOR_ARROW;
switch (drag_type) {
case DRAG_NONE:
- if (Input::get_singleton()->is_mouse_button_pressed(BUTTON_MIDDLE) || Input::get_singleton()->is_key_pressed(KEY_SPACE)) {
- c = CURSOR_DRAG;
- } else {
- switch (tool) {
- case TOOL_MOVE:
- c = CURSOR_MOVE;
- break;
- case TOOL_EDIT_PIVOT:
- c = CURSOR_CROSS;
- break;
- case TOOL_PAN:
- c = CURSOR_DRAG;
- break;
- default:
- break;
- }
+ switch (tool) {
+ case TOOL_MOVE:
+ c = CURSOR_MOVE;
+ break;
+ case TOOL_EDIT_PIVOT:
+ c = CURSOR_CROSS;
+ break;
+ case TOOL_PAN:
+ c = CURSOR_DRAG;
+ break;
+ default:
+ break;
}
break;
case DRAG_LEFT:
@@ -1956,6 +1981,8 @@ void CanvasItemEditor::_gui_input_viewport(const Ref<InputEvent> &p_event) {
case DRAG_ALL:
c = CURSOR_MOVE;
break;
+ case DRAG_PAN:
+ c = CURSOR_DRAG;
default:
break;
}
diff --git a/editor/plugins/canvas_item_editor_plugin.h b/editor/plugins/canvas_item_editor_plugin.h
index 5ca8a37610..6a1d313a7e 100644
--- a/editor/plugins/canvas_item_editor_plugin.h
+++ b/editor/plugins/canvas_item_editor_plugin.h
@@ -194,7 +194,8 @@ class CanvasItemEditor : public VBoxContainer {
DRAG_V_GUIDE,
DRAG_H_GUIDE,
DRAG_DOUBLE_GUIDE,
- DRAG_KEY_MOVE
+ DRAG_KEY_MOVE,
+ DRAG_PAN
};
EditorSelection *editor_selection;
diff --git a/editor/plugins/navigation_mesh_generator.cpp b/editor/plugins/navigation_mesh_generator.cpp
index 5d4e5520f4..0537c5c31f 100644
--- a/editor/plugins/navigation_mesh_generator.cpp
+++ b/editor/plugins/navigation_mesh_generator.cpp
@@ -280,26 +280,20 @@ void NavigationMeshGenerator::bake(Ref<NavigationMesh> p_nav_mesh, Node *p_node)
_build_recast_navigation_mesh(p_nav_mesh, &ep, hf, chf, cset, poly_mesh, detail_mesh, vertices, indices);
- if (hf) {
- rcFreeHeightField(hf);
- hf = 0;
- }
- if (chf) {
- rcFreeCompactHeightfield(chf);
- chf = 0;
- }
- if (cset) {
- rcFreeContourSet(cset);
- cset = 0;
- }
- if (poly_mesh) {
- rcFreePolyMesh(poly_mesh);
- poly_mesh = 0;
- }
- if (detail_mesh) {
- rcFreePolyMeshDetail(detail_mesh);
- detail_mesh = 0;
- }
+ rcFreeHeightField(hf);
+ hf = 0;
+
+ rcFreeCompactHeightfield(chf);
+ chf = 0;
+
+ rcFreeContourSet(cset);
+ cset = 0;
+
+ rcFreePolyMesh(poly_mesh);
+ poly_mesh = 0;
+
+ rcFreePolyMeshDetail(detail_mesh);
+ detail_mesh = 0;
}
ep.step(TTR("Done!"), 11);
}
diff --git a/editor/plugins/path_editor_plugin.cpp b/editor/plugins/path_editor_plugin.cpp
index 056219a575..6dde639c54 100644
--- a/editor/plugins/path_editor_plugin.cpp
+++ b/editor/plugins/path_editor_plugin.cpp
@@ -167,18 +167,12 @@ void PathSpatialGizmo::commit_handle(int p_idx, const Variant &p_restore, bool p
Vector3 ofs;
- if (p_cancel) {
-
- return;
- }
-
if (t == 0) {
-
if (p_cancel) {
-
c->set_point_in(p_idx, p_restore);
return;
}
+
ur->create_action(TTR("Set Curve In Position"));
ur->add_do_method(c.ptr(), "set_point_in", idx, c->get_point_in(idx));
ur->add_undo_method(c.ptr(), "set_point_in", idx, p_restore);
@@ -186,10 +180,11 @@ void PathSpatialGizmo::commit_handle(int p_idx, const Variant &p_restore, bool p
} else {
if (p_cancel) {
-
c->set_point_out(idx, p_restore);
+
return;
}
+
ur->create_action(TTR("Set Curve Out Position"));
ur->add_do_method(c.ptr(), "set_point_out", idx, c->get_point_out(idx));
ur->add_undo_method(c.ptr(), "set_point_out", idx, p_restore);
diff --git a/editor/plugins/sprite_frames_editor_plugin.cpp b/editor/plugins/sprite_frames_editor_plugin.cpp
index 71a3c90795..a9afc7a670 100644
--- a/editor/plugins/sprite_frames_editor_plugin.cpp
+++ b/editor/plugins/sprite_frames_editor_plugin.cpp
@@ -45,6 +45,12 @@ void SpriteFramesEditor::_notification(int p_what) {
if (p_what == NOTIFICATION_ENTER_TREE) {
load->set_icon(get_icon("Load", "EditorIcons"));
+ copy->set_icon(get_icon("ActionCopy", "EditorIcons"));
+ paste->set_icon(get_icon("ActionPaste", "EditorIcons"));
+ empty->set_icon(get_icon("InsertBefore", "EditorIcons"));
+ empty2->set_icon(get_icon("InsertAfter", "EditorIcons"));
+ move_up->set_icon(get_icon("MoveLeft", "EditorIcons"));
+ move_down->set_icon(get_icon("MoveRight", "EditorIcons"));
_delete->set_icon(get_icon("Remove", "EditorIcons"));
new_anim->set_icon(get_icon("New", "EditorIcons"));
remove_anim->set_icon(get_icon("Remove", "EditorIcons"));
@@ -736,27 +742,35 @@ SpriteFramesEditor::SpriteFramesEditor() {
hbc->add_child(load);
copy = memnew(Button);
- copy->set_text(TTR("Copy"));
+ copy->set_flat(true);
+ copy->set_tooltip(TTR("Copy"));
hbc->add_child(copy);
paste = memnew(Button);
- paste->set_text(TTR("Paste"));
+ paste->set_flat(true);
+ paste->set_tooltip(TTR("Paste"));
hbc->add_child(paste);
empty = memnew(Button);
- empty->set_text(TTR("Insert Empty (Before)"));
+ empty->set_flat(true);
+ empty->set_tooltip(TTR("Insert Empty (Before)"));
hbc->add_child(empty);
empty2 = memnew(Button);
- empty2->set_text(TTR("Insert Empty (After)"));
+ empty2->set_flat(true);
+ empty2->set_tooltip(TTR("Insert Empty (After)"));
hbc->add_child(empty2);
+ hbc->add_spacer(false);
+
move_up = memnew(Button);
- move_up->set_text(TTR("Move (Before)"));
+ move_up->set_flat(true);
+ move_up->set_tooltip(TTR("Move (Before)"));
hbc->add_child(move_up);
move_down = memnew(Button);
- move_down->set_text(TTR("Move (After)"));
+ move_down->set_flat(true);
+ move_down->set_tooltip(TTR("Move (After)"));
hbc->add_child(move_down);
_delete = memnew(Button);
diff --git a/editor/plugins/tile_map_editor_plugin.h b/editor/plugins/tile_map_editor_plugin.h
index 3257901c88..642870aec0 100644
--- a/editor/plugins/tile_map_editor_plugin.h
+++ b/editor/plugins/tile_map_editor_plugin.h
@@ -125,12 +125,11 @@ class TileMapEditor : public VBoxContainer {
bool yf;
bool tr;
- CellOp() {
- idx = -1;
- xf = false;
- yf = false;
- tr = false;
- }
+ CellOp() :
+ idx(TileMap::INVALID_CELL),
+ xf(false),
+ yf(false),
+ tr(false) {}
};
Map<Point2i, CellOp> paint_undo;
@@ -141,8 +140,12 @@ class TileMapEditor : public VBoxContainer {
bool flip_h;
bool flip_v;
bool transpose;
- int auto_x;
- int auto_y;
+
+ TileData() :
+ cell(TileMap::INVALID_CELL),
+ flip_h(false),
+ flip_v(false),
+ transpose(false) {}
};
List<TileData> copydata;
diff --git a/editor/plugins/tile_set_editor_plugin.cpp b/editor/plugins/tile_set_editor_plugin.cpp
index 41692e805f..385fa24ad8 100644
--- a/editor/plugins/tile_set_editor_plugin.cpp
+++ b/editor/plugins/tile_set_editor_plugin.cpp
@@ -149,6 +149,7 @@ void TileSetEditor::_import_node(Node *p_node, Ref<TileSet> p_library) {
p_library->tile_set_light_occluder(id, occluder);
p_library->tile_set_occluder_offset(id, -phys_offset);
p_library->tile_set_navigation_polygon_offset(id, -phys_offset);
+ p_library->tile_set_z_index(id, mi->get_z_index());
}
}
@@ -805,7 +806,7 @@ void TileSetEditor::_on_workspace_input(const Ref<InputEvent> &p_ie) {
Vector2 coord((int)(mb->get_position().x / (spacing + size.x)), (int)(mb->get_position().y / (spacing + size.y)));
Vector2 pos(coord.x * (spacing + size.x), coord.y * (spacing + size.y));
pos = mb->get_position() - pos;
- uint16_t bit;
+ uint16_t bit = 0;
if (tileset->autotile_get_bitmask_mode(get_current_tile()) == TileSet::BITMASK_2X2) {
if (pos.x < size.x / 2) {
if (pos.y < size.y / 2) {
@@ -868,7 +869,7 @@ void TileSetEditor::_on_workspace_input(const Ref<InputEvent> &p_ie) {
Vector2 coord((int)(mm->get_position().x / (spacing + size.x)), (int)(mm->get_position().y / (spacing + size.y)));
Vector2 pos(coord.x * (spacing + size.x), coord.y * (spacing + size.y));
pos = mm->get_position() - pos;
- uint16_t bit;
+ uint16_t bit = 0;
if (tileset->autotile_get_bitmask_mode(get_current_tile()) == TileSet::BITMASK_2X2) {
if (pos.x < size.x / 2) {
if (pos.y < size.y / 2) {
@@ -1146,7 +1147,7 @@ void TileSetEditor::_on_tool_clicked(int p_tool) {
case EDITMODE_COLLISION: {
if (!edited_collision_shape.is_null()) {
Vector<TileSet::ShapeData> sd = tileset->tile_get_shapes(get_current_tile());
- int index;
+ int index = -1;
for (int i = 0; i < sd.size(); i++) {
if (sd[i].shape == edited_collision_shape) {
index = i;
diff --git a/editor/script_editor_debugger.cpp b/editor/script_editor_debugger.cpp
index e9529eb1c0..50519e2c6e 100644
--- a/editor/script_editor_debugger.cpp
+++ b/editor/script_editor_debugger.cpp
@@ -710,25 +710,6 @@ void ScriptEditorDebugger::_parse_message(const String &p_msg, const Array &p_da
error_list->set_item_metadata(error_list->get_item_count() - 1, stack);
error_count++;
- /*
- int count = p_data[1];
-
- Array cstack;
-
- OutputError oe = errors.front()->get();
-
- packet_peer_stream->put_var(oe.hr);
- packet_peer_stream->put_var(oe.min);
- packet_peer_stream->put_var(oe.sec);
- packet_peer_stream->put_var(oe.msec);
- packet_peer_stream->put_var(oe.source_func);
- packet_peer_stream->put_var(oe.source_file);
- packet_peer_stream->put_var(oe.source_line);
- packet_peer_stream->put_var(oe.error);
- packet_peer_stream->put_var(oe.error_descr);
- packet_peer_stream->put_var(oe.warning);
- packet_peer_stream->put_var(oe.callstack);
- */
} else if (p_msg == "profile_sig") {
//cache a signature
@@ -755,6 +736,7 @@ void ScriptEditorDebugger::_parse_message(const String &p_msg, const Array &p_da
EditorProfiler::Metric::Category::Item item;
item.calls = 1;
item.line = 0;
+
item.name = "Physics Time";
item.total = metric.physics_time;
item.self = item.total;
@@ -792,8 +774,9 @@ void ScriptEditorDebugger::_parse_message(const String &p_msg, const Array &p_da
for (int i = 0; i < values.size(); i += 2) {
EditorProfiler::Metric::Category::Item item;
- item.name = values[i];
item.calls = 1;
+ item.line = 0;
+ item.name = values[i];
item.self = values[i + 1];
item.total = item.self;
item.signature = "categ::" + name + "::" + item.name;
diff --git a/editor/spatial_editor_gizmos.cpp b/editor/spatial_editor_gizmos.cpp
index 8c90d86b9e..a3c4b73ae4 100644
--- a/editor/spatial_editor_gizmos.cpp
+++ b/editor/spatial_editor_gizmos.cpp
@@ -4052,9 +4052,9 @@ SpatialEditorGizmos::SpatialEditorGizmos() {
for (int k = 0; k < 3; k++) {
if (i < 3)
- face_points[j][(i + k) % 3] = v[k] * (i >= 3 ? -1 : 1);
+ face_points[j][(i + k) % 3] = v[k];
else
- face_points[3 - j][(i + k) % 3] = v[k] * (i >= 3 ? -1 : 1);
+ face_points[3 - j][(i + k) % 3] = -v[k];
}
}
//tri 1