diff options
Diffstat (limited to 'editor')
-rw-r--r-- | editor/animation_track_editor.cpp | 2 | ||||
-rw-r--r-- | editor/editor_resource_picker.cpp | 1 | ||||
-rw-r--r-- | editor/plugins/node_3d_editor_plugin.cpp | 5 | ||||
-rw-r--r-- | editor/plugins/node_3d_editor_plugin.h | 2 | ||||
-rw-r--r-- | editor/plugins/script_text_editor.cpp | 31 | ||||
-rw-r--r-- | editor/plugins/texture_editor_plugin.cpp | 2 |
6 files changed, 31 insertions, 12 deletions
diff --git a/editor/animation_track_editor.cpp b/editor/animation_track_editor.cpp index 5c4ef35f1c..8a2d23d32d 100644 --- a/editor/animation_track_editor.cpp +++ b/editor/animation_track_editor.cpp @@ -6204,7 +6204,7 @@ void AnimationTrackEditor::_edit_menu_pressed(int p_option) { if (do_bake && !animation->track_is_compressed(i)) { Animation::InterpolationType it = animation->track_get_interpolation_type(i); if (it == Animation::INTERPOLATION_NEAREST) { - continue; // Nearest and Angle interpolation cannot be baked. + continue; // Nearest interpolation cannot be baked. } // Special case for angle interpolation. diff --git a/editor/editor_resource_picker.cpp b/editor/editor_resource_picker.cpp index 01816b7205..5545dc4ee2 100644 --- a/editor/editor_resource_picker.cpp +++ b/editor/editor_resource_picker.cpp @@ -958,6 +958,7 @@ EditorResourcePicker::EditorResourcePicker(bool p_hide_assign_button_controls) { preview_rect->set_offset(SIDE_TOP, 1); preview_rect->set_offset(SIDE_BOTTOM, -1); preview_rect->set_offset(SIDE_RIGHT, -1); + preview_rect->set_texture_filter(TEXTURE_FILTER_NEAREST_WITH_MIPMAPS); assign_button->add_child(preview_rect); } diff --git a/editor/plugins/node_3d_editor_plugin.cpp b/editor/plugins/node_3d_editor_plugin.cpp index 421e8debed..e5d4b262aa 100644 --- a/editor/plugins/node_3d_editor_plugin.cpp +++ b/editor/plugins/node_3d_editor_plugin.cpp @@ -6991,9 +6991,10 @@ void Node3DEditor::_snap_selected_nodes_to_floor() { } } if (!found_valid_shape && vi.size()) { - AABB aabb = (*vi.begin())->get_transformed_aabb(); + VisualInstance3D *begin = *vi.begin(); + AABB aabb = begin->get_global_transform().xform(begin->get_aabb()); for (const VisualInstance3D *I : vi) { - aabb.merge_with(I->get_transformed_aabb()); + aabb.merge_with(I->get_global_transform().xform(I->get_aabb())); } Vector3 size = aabb.size * Vector3(0.5, 0.0, 0.5); from = aabb.position + size; diff --git a/editor/plugins/node_3d_editor_plugin.h b/editor/plugins/node_3d_editor_plugin.h index 6ff0fa3afe..7dbe153efd 100644 --- a/editor/plugins/node_3d_editor_plugin.h +++ b/editor/plugins/node_3d_editor_plugin.h @@ -773,7 +773,7 @@ private: WorldEnvironment *preview_environment = nullptr; bool preview_env_dangling = false; Ref<Environment> environment; - Ref<CameraAttributesPhysical> camera_attributes; + Ref<CameraAttributesPractical> camera_attributes; Ref<ProceduralSkyMaterial> sky_material; bool sun_environ_updating = false; diff --git a/editor/plugins/script_text_editor.cpp b/editor/plugins/script_text_editor.cpp index 8607f98a90..7d7ef9245f 100644 --- a/editor/plugins/script_text_editor.cpp +++ b/editor/plugins/script_text_editor.cpp @@ -1598,9 +1598,24 @@ static Node *_find_script_node(Node *p_edited_scene, Node *p_current_node, const return nullptr; } -void ScriptTextEditor::drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from) { - const String quote_style = EDITOR_GET("text_editor/completion/use_single_quotes") ? "'" : "\""; +static String _quote_drop_data(const String &str) { + // This function prepares a string for being "dropped" into the script editor. + // The string can be a resource path, node path or property name. + + const bool using_single_quotes = EDITOR_GET("text_editor/completion/use_single_quotes"); + + String escaped = str.c_escape(); + + // If string is double quoted, there is no need to escape single quotes. + // We can revert the extra escaping added in c_escape(). + if (!using_single_quotes) { + escaped = escaped.replace("\\'", "\'"); + } + + return escaped.quote(using_single_quotes ? "'" : "\""); +} +void ScriptTextEditor::drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from) { Dictionary d = p_data; CodeEdit *te = code_editor->get_text_editor(); @@ -1638,9 +1653,9 @@ void ScriptTextEditor::drop_data_fw(const Point2 &p_point, const Variant &p_data } if (preload) { - text_to_drop += "preload(" + String(files[i]).c_escape().quote(quote_style) + ")"; + text_to_drop += "preload(" + _quote_drop_data(String(files[i])) + ")"; } else { - text_to_drop += String(files[i]).c_escape().quote(quote_style); + text_to_drop += _quote_drop_data(String(files[i])); } } @@ -1686,7 +1701,7 @@ void ScriptTextEditor::drop_data_fw(const Point2 &p_point, const Variant &p_data } for (const String &segment : path.split("/")) { if (!segment.is_valid_identifier()) { - path = path.c_escape().quote(quote_style); + path = _quote_drop_data(path); break; } } @@ -1721,7 +1736,7 @@ void ScriptTextEditor::drop_data_fw(const Point2 &p_point, const Variant &p_data for (const String &segment : path.split("/")) { if (!segment.is_valid_identifier()) { - path = path.c_escape().quote(quote_style); + path = _quote_drop_data(path); break; } } @@ -1737,7 +1752,9 @@ void ScriptTextEditor::drop_data_fw(const Point2 &p_point, const Variant &p_data if (d.has("type") && String(d["type"]) == "obj_property") { te->remove_secondary_carets(); - const String text_to_drop = String(d["property"]).c_escape().quote(quote_style); + // It is unclear whether properties may contain single or double quotes. + // Assume here that double-quotes may not exist. We are escaping single-quotes if necessary. + const String text_to_drop = _quote_drop_data(String(d["property"])); te->set_caret_line(row); te->set_caret_column(col); diff --git a/editor/plugins/texture_editor_plugin.cpp b/editor/plugins/texture_editor_plugin.cpp index be382759f5..4aed7a92a2 100644 --- a/editor/plugins/texture_editor_plugin.cpp +++ b/editor/plugins/texture_editor_plugin.cpp @@ -29,7 +29,6 @@ /*************************************************************************/ #include "texture_editor_plugin.h" - #include "editor/editor_scale.h" TextureRect *TexturePreview::get_texture_display() { @@ -123,6 +122,7 @@ TexturePreview::TexturePreview(Ref<Texture2D> p_texture, bool p_show_metadata) { add_child(checkerboard); texture_display = memnew(TextureRect); + texture_display->set_texture_filter(TEXTURE_FILTER_NEAREST_WITH_MIPMAPS); texture_display->set_texture(p_texture); texture_display->set_anchors_preset(TextureRect::PRESET_FULL_RECT); texture_display->set_stretch_mode(TextureRect::STRETCH_KEEP_ASPECT_CENTERED); |