diff options
Diffstat (limited to 'editor')
-rw-r--r-- | editor/editor_data.cpp | 2 | ||||
-rw-r--r-- | editor/editor_node.cpp | 25 | ||||
-rw-r--r-- | editor/editor_resource_preview.cpp | 1 | ||||
-rw-r--r-- | editor/multi_node_edit.cpp | 16 | ||||
-rw-r--r-- | editor/multi_node_edit.h | 3 | ||||
-rw-r--r-- | editor/plugins/animation_blend_tree_editor_plugin.cpp | 39 | ||||
-rw-r--r-- | editor/plugins/canvas_item_editor_plugin.cpp | 1 | ||||
-rw-r--r-- | editor/plugins/editor_preview_plugins.cpp | 8 | ||||
-rw-r--r-- | editor/scene_tree_dock.cpp | 7 | ||||
-rw-r--r-- | editor/scene_tree_dock.h | 2 |
10 files changed, 86 insertions, 18 deletions
diff --git a/editor/editor_data.cpp b/editor/editor_data.cpp index 4855d3f69d..1cafd1d1f4 100644 --- a/editor/editor_data.cpp +++ b/editor/editor_data.cpp @@ -820,7 +820,7 @@ void EditorData::save_edited_scene_state(EditorSelection *p_selection, EditorHis ERR_FAIL_INDEX(current_edited_scene, edited_scene.size()); EditedScene &es = edited_scene.write[current_edited_scene]; - es.selection = p_selection->get_selected_node_list(); + es.selection = p_selection->get_full_selected_node_list(); es.history_current = p_history->current; es.history_stored = p_history->history; es.editor_states = get_editor_states(); diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index 178871ccfa..0e373a5deb 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -71,6 +71,7 @@ #include "editor/import/resource_importer_texture.h" #include "editor/import/resource_importer_texture_atlas.h" #include "editor/import/resource_importer_wav.h" +#include "editor/multi_node_edit.h" #include "editor/plugins/animation_blend_space_1d_editor.h" #include "editor/plugins/animation_blend_space_2d_editor.h" #include "editor/plugins/animation_blend_tree_editor_plugin.h" @@ -1742,15 +1743,37 @@ void EditorNode::_edit_current() { } else { + Node *selected_node = NULL; + if (current_obj->is_class("ScriptEditorDebuggerInspectedObject")) { editable_warning = TTR("This is a remote object, so changes to it won't be kept.\nPlease read the documentation relevant to debugging to better understand this workflow."); capitalize = false; disable_folding = true; + } else if (current_obj->is_class("MultiNodeEdit")) { + Node *scene = get_edited_scene(); + if (scene) { + MultiNodeEdit *multi_node_edit = Object::cast_to<MultiNodeEdit>(current_obj); + int node_count = multi_node_edit->get_node_count(); + if (node_count > 0) { + List<Node *> multi_nodes; + for (int node_index = 0; node_index < node_count; ++node_index) { + Node *node = scene->get_node(multi_node_edit->get_node(node_index)); + if (node) { + multi_nodes.push_back(node); + } + } + if (!multi_nodes.empty()) { + // Pick the top-most node + multi_nodes.sort_custom<Node::Comparator>(); + selected_node = multi_nodes.front()->get(); + } + } + } } get_inspector()->edit(current_obj); node_dock->set_node(NULL); - scene_tree_dock->set_selected(NULL); + scene_tree_dock->set_selected(selected_node); inspector_dock->update(NULL); } diff --git a/editor/editor_resource_preview.cpp b/editor/editor_resource_preview.cpp index 55f9347045..e383dadfb0 100644 --- a/editor/editor_resource_preview.cpp +++ b/editor/editor_resource_preview.cpp @@ -207,6 +207,7 @@ void EditorResourcePreview::_generate_preview(Ref<ImageTexture> &r_texture, Ref< f->store_line(itos(has_small_texture)); f->store_line(itos(FileAccess::get_modified_time(p_item.path))); f->store_line(FileAccess::get_md5(p_item.path)); + f->close(); memdelete(f); } } diff --git a/editor/multi_node_edit.cpp b/editor/multi_node_edit.cpp index 85e47594a8..0792d5c95f 100644 --- a/editor/multi_node_edit.cpp +++ b/editor/multi_node_edit.cpp @@ -34,12 +34,10 @@ #include "editor_node.h" bool MultiNodeEdit::_set(const StringName &p_name, const Variant &p_value) { - return _set_impl(p_name, p_value, ""); } bool MultiNodeEdit::_set_impl(const StringName &p_name, const Variant &p_value, const String &p_field) { - Node *es = EditorNode::get_singleton()->get_edited_scene(); if (!es) return false; @@ -88,7 +86,6 @@ bool MultiNodeEdit::_set_impl(const StringName &p_name, const Variant &p_value, } bool MultiNodeEdit::_get(const StringName &p_name, Variant &r_ret) const { - Node *es = EditorNode::get_singleton()->get_edited_scene(); if (!es) return false; @@ -117,7 +114,6 @@ bool MultiNodeEdit::_get(const StringName &p_name, Variant &r_ret) const { } void MultiNodeEdit::_get_property_list(List<PropertyInfo> *p_list) const { - HashMap<String, PLData> usage; Node *es = EditorNode::get_singleton()->get_edited_scene(); @@ -171,17 +167,23 @@ void MultiNodeEdit::_get_property_list(List<PropertyInfo> *p_list) const { } void MultiNodeEdit::clear_nodes() { - nodes.clear(); } void MultiNodeEdit::add_node(const NodePath &p_node) { - nodes.push_back(p_node); } -void MultiNodeEdit::set_property_field(const StringName &p_property, const Variant &p_value, const String &p_field) { +int MultiNodeEdit::get_node_count() const { + return nodes.size(); +} +NodePath MultiNodeEdit::get_node(int p_index) const { + ERR_FAIL_INDEX_V(p_index, nodes.size(), NodePath()); + return nodes[p_index]; +} + +void MultiNodeEdit::set_property_field(const StringName &p_property, const Variant &p_value, const String &p_field) { _set_impl(p_property, p_value, p_field); } diff --git a/editor/multi_node_edit.h b/editor/multi_node_edit.h index b9192b206a..33df4a2ca5 100644 --- a/editor/multi_node_edit.h +++ b/editor/multi_node_edit.h @@ -54,6 +54,9 @@ public: void clear_nodes(); void add_node(const NodePath &p_node); + int get_node_count() const; + NodePath get_node(int p_index) const; + void set_property_field(const StringName &p_property, const Variant &p_value, const String &p_field); MultiNodeEdit(); diff --git a/editor/plugins/animation_blend_tree_editor_plugin.cpp b/editor/plugins/animation_blend_tree_editor_plugin.cpp index 235c204265..e147206ec4 100644 --- a/editor/plugins/animation_blend_tree_editor_plugin.cpp +++ b/editor/plugins/animation_blend_tree_editor_plugin.cpp @@ -534,6 +534,7 @@ bool AnimationNodeBlendTreeEditor::_update_filters(const Ref<AnimationNode> &ano updating = true; Set<String> paths; + HashMap<String, Set<String> > types; { List<StringName> animations; player->get_animation_list(&animations); @@ -542,7 +543,27 @@ bool AnimationNodeBlendTreeEditor::_update_filters(const Ref<AnimationNode> &ano Ref<Animation> anim = player->get_animation(E->get()); for (int i = 0; i < anim->get_track_count(); i++) { - paths.insert(anim->track_get_path(i)); + String track_path = anim->track_get_path(i); + paths.insert(track_path); + + String track_type_name; + Animation::TrackType track_type = anim->track_get_type(i); + switch (track_type) { + case Animation::TrackType::TYPE_ANIMATION: { + track_type_name = TTR("Anim Clips"); + } break; + case Animation::TrackType::TYPE_AUDIO: { + track_type_name = TTR("Audio Clips"); + } break; + case Animation::TrackType::TYPE_METHOD: { + track_type_name = TTR("Functions"); + } break; + default: { + } break; + } + if (!track_type_name.empty()) { + types[track_path].insert(track_type_name); + } } } } @@ -646,10 +667,22 @@ bool AnimationNodeBlendTreeEditor::_update_filters(const Ref<AnimationNode> &ano } } else { if (ti) { - //just a node, likely call or animation track + //just a node, not a property track + String types_text = "["; + if (types.has(path)) { + Set<String>::Element *F = types[path].front(); + types_text += F->get(); + while (F->next()) { + F = F->next(); + types_text += " / " + F->get(); + } + } + types_text += "]"; + ti = filters->create_item(ti); + ti->set_cell_mode(0, TreeItem::CELL_MODE_CHECK); + ti->set_text(0, types_text); ti->set_editable(0, true); ti->set_selectable(0, true); - ti->set_cell_mode(0, TreeItem::CELL_MODE_CHECK); ti->set_checked(0, anode->is_path_filtered(path)); ti->set_metadata(0, path); } diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp index c9dde5d54d..1b263fa4f6 100644 --- a/editor/plugins/canvas_item_editor_plugin.cpp +++ b/editor/plugins/canvas_item_editor_plugin.cpp @@ -5247,6 +5247,7 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) { snap_other_nodes = true; snap_guides = true; snap_rotation = false; + snap_scale = false; snap_relative = false; snap_pixel = false; snap_target[0] = SNAP_TARGET_NONE; diff --git a/editor/plugins/editor_preview_plugins.cpp b/editor/plugins/editor_preview_plugins.cpp index 8acc41a2c7..007ce58bd7 100644 --- a/editor/plugins/editor_preview_plugins.cpp +++ b/editor/plugins/editor_preview_plugins.cpp @@ -103,9 +103,11 @@ Ref<Texture> EditorTexturePreviewPlugin::generate(const RES &p_from, const Size2 img = ltex->to_image(); } else { Ref<Texture> tex = p_from; - img = tex->get_data(); - if (img.is_valid()) { - img = img->duplicate(); + if (tex.is_valid()) { + img = tex->get_data(); + if (img.is_valid()) { + img = img->duplicate(); + } } } diff --git a/editor/scene_tree_dock.cpp b/editor/scene_tree_dock.cpp index 71e93750f0..5c08482aa4 100644 --- a/editor/scene_tree_dock.cpp +++ b/editor/scene_tree_dock.cpp @@ -1038,7 +1038,6 @@ void SceneTreeDock::_node_collapsed(Object *p_obj) { void SceneTreeDock::_notification(int p_what) { switch (p_what) { - case NOTIFICATION_READY: { if (!first_enter) @@ -1099,8 +1098,7 @@ void SceneTreeDock::_notification(int p_what) { button_2d->set_text(TTR("2D Scene")); button_2d->set_icon(get_icon("Node2D", "EditorIcons")); button_2d->connect("pressed", this, "_tool_selected", make_binds(TOOL_CREATE_2D_SCENE, false)); - - Button *button_3d = memnew(Button); + button_3d = memnew(Button); beginner_node_shortcuts->add_child(button_3d); button_3d->set_text(TTR("3D Scene")); button_3d->set_icon(get_icon("Spatial", "EditorIcons")); @@ -2752,12 +2750,15 @@ void SceneTreeDock::_feature_profile_changed() { profile_allow_editing = !profile->is_feature_disabled(EditorFeatureProfile::FEATURE_SCENE_TREE); profile_allow_script_editing = !profile->is_feature_disabled(EditorFeatureProfile::FEATURE_SCRIPT); + bool profile_allow_3d = !profile->is_feature_disabled(EditorFeatureProfile::FEATURE_3D); + button_3d->set_visible(profile_allow_3d); button_add->set_visible(profile_allow_editing); button_instance->set_visible(profile_allow_editing); scene_tree->set_can_rename(profile_allow_editing); } else { + button_3d->set_visible(true); button_add->set_visible(true); button_instance->set_visible(true); scene_tree->set_can_rename(true); diff --git a/editor/scene_tree_dock.h b/editor/scene_tree_dock.h index 4e78b84c53..56fbb86824 100644 --- a/editor/scene_tree_dock.h +++ b/editor/scene_tree_dock.h @@ -112,6 +112,8 @@ class SceneTreeDock : public VBoxContainer { ToolButton *button_create_script; ToolButton *button_clear_script; + Button *button_3d; + HBoxContainer *button_hb; ToolButton *edit_local, *edit_remote; SceneTreeEditor *scene_tree; |