diff options
Diffstat (limited to 'editor/plugins')
| -rw-r--r-- | editor/plugins/bone_map_editor_plugin.cpp | 2 | ||||
| -rw-r--r-- | editor/plugins/canvas_item_editor_plugin.cpp | 3 | ||||
| -rw-r--r-- | editor/plugins/node_3d_editor_plugin.cpp | 3 | ||||
| -rw-r--r-- | editor/plugins/script_editor_plugin.cpp | 6 | ||||
| -rw-r--r-- | editor/plugins/sprite_2d_editor_plugin.cpp | 39 | ||||
| -rw-r--r-- | editor/plugins/tiles/tile_data_editors.cpp | 2 | ||||
| -rw-r--r-- | editor/plugins/tiles/tile_set_editor.cpp | 3 | ||||
| -rw-r--r-- | editor/plugins/tiles/tile_set_scenes_collection_source_editor.cpp | 3 | ||||
| -rw-r--r-- | editor/plugins/visual_shader_editor_plugin.cpp | 8 | ||||
| -rw-r--r-- | editor/plugins/visual_shader_editor_plugin.h | 2 |
10 files changed, 27 insertions, 44 deletions
diff --git a/editor/plugins/bone_map_editor_plugin.cpp b/editor/plugins/bone_map_editor_plugin.cpp index 7d15edef1e..db61c95474 100644 --- a/editor/plugins/bone_map_editor_plugin.cpp +++ b/editor/plugins/bone_map_editor_plugin.cpp @@ -1347,7 +1347,7 @@ void BoneMapEditor::create_editors() { void BoneMapEditor::fetch_objects() { skeleton = nullptr; // Hackey... but it may be the easiest way to get a selected object from "ImporterScene". - SceneImportSettings *si = SceneImportSettings::get_singleton(); + SceneImportSettingsDialog *si = SceneImportSettingsDialog::get_singleton(); if (!si) { return; } diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp index 85846d7bc6..bac2a4909f 100644 --- a/editor/plugins/canvas_item_editor_plugin.cpp +++ b/editor/plugins/canvas_item_editor_plugin.cpp @@ -5613,8 +5613,7 @@ void CanvasItemEditorViewport::_on_change_type_closed() { void CanvasItemEditorViewport::_create_preview(const Vector<String> &files) const { bool add_preview = false; for (int i = 0; i < files.size(); i++) { - String path = files[i]; - Ref<Resource> res = ResourceLoader::load(path); + Ref<Resource> res = ResourceLoader::load(files[i]); ERR_FAIL_COND(res.is_null()); Ref<Texture2D> texture = Ref<Texture2D>(Object::cast_to<Texture2D>(*res)); Ref<PackedScene> scene = Ref<PackedScene>(Object::cast_to<PackedScene>(*res)); diff --git a/editor/plugins/node_3d_editor_plugin.cpp b/editor/plugins/node_3d_editor_plugin.cpp index ad7ef2b6ef..52f17c4a45 100644 --- a/editor/plugins/node_3d_editor_plugin.cpp +++ b/editor/plugins/node_3d_editor_plugin.cpp @@ -4154,8 +4154,7 @@ Node *Node3DEditorViewport::_sanitize_preview_node(Node *p_node) const { void Node3DEditorViewport::_create_preview_node(const Vector<String> &files) const { bool add_preview = false; for (int i = 0; i < files.size(); i++) { - String path = files[i]; - Ref<Resource> res = ResourceLoader::load(path); + Ref<Resource> res = ResourceLoader::load(files[i]); ERR_CONTINUE(res.is_null()); Ref<PackedScene> scene = Ref<PackedScene>(Object::cast_to<PackedScene>(*res)); Ref<Mesh> mesh = Ref<Mesh>(Object::cast_to<Mesh>(*res)); diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp index fa28af9671..e917aab6ad 100644 --- a/editor/plugins/script_editor_plugin.cpp +++ b/editor/plugins/script_editor_plugin.cpp @@ -1427,11 +1427,7 @@ void ScriptEditor::_menu_option(int p_option) { path = path.get_slice("::", 0); // Show the scene instead. } - FileSystemDock *file_system_dock = FileSystemDock::get_singleton(); - file_system_dock->navigate_to_path(path); - // Ensure that the FileSystem dock is visible. - TabContainer *dock_tab_container = (TabContainer *)file_system_dock->get_parent_control(); - dock_tab_container->set_current_tab(dock_tab_container->get_tab_idx_from_control(file_system_dock)); + FileSystemDock::get_singleton()->navigate_to_path(path); } } break; case CLOSE_DOCS: { diff --git a/editor/plugins/sprite_2d_editor_plugin.cpp b/editor/plugins/sprite_2d_editor_plugin.cpp index 56d74bba0a..7c1c6a8f82 100644 --- a/editor/plugins/sprite_2d_editor_plugin.cpp +++ b/editor/plugins/sprite_2d_editor_plugin.cpp @@ -159,9 +159,6 @@ void Sprite2DEditor::_popup_debug_uv_dialog() { if (texture.is_null()) { error_message = TTR("Can't convert an empty sprite to mesh."); } - if (node->get_hframes() > 1 || node->get_vframes() > 1) { - error_message = TTR("Can't convert a sprite using animation frames to mesh."); - } if (!error_message.is_empty()) { err_dialog->set_text(error_message); @@ -185,9 +182,9 @@ void Sprite2DEditor::_update_mesh_data() { image->decompress(); } - // TODO: Add support for Sprite2D's region. - Rect2 rect; - rect.size = image->get_size(); + Rect2 rect = node->is_region_enabled() ? node->get_region_rect() : Rect2(Point2(), image->get_size()); + rect.size /= Vector2(node->get_hframes(), node->get_vframes()); + rect.position += node->get_frame_coords() * rect.size; Ref<BitMap> bm; bm.instantiate(); @@ -224,18 +221,15 @@ void Sprite2DEditor::_update_mesh_data() { for (int i = 0; i < lines[j].size(); i++) { Vector2 vtx = lines[j][i]; - computed_uv.push_back(vtx / img_size); - - vtx -= rect.position; //offset by rect position + computed_uv.push_back((vtx + rect.position) / img_size); - //flip if flipped if (node->is_flipped_h()) { - vtx.x = rect.size.x - vtx.x - 1.0; + vtx.x = rect.size.x - vtx.x; } if (node->is_flipped_v()) { - vtx.y = rect.size.y - vtx.y - 1.0; + vtx.y = rect.size.y - vtx.y; } - + vtx += node->get_offset(); if (node->is_centered()) { vtx -= rect.size / 2.0; } @@ -249,8 +243,8 @@ void Sprite2DEditor::_update_mesh_data() { for (int k = 0; k < 3; k++) { int idx = i + k; int idxn = i + (k + 1) % 3; - uv_lines.push_back(lines[j][poly[idx]]); - uv_lines.push_back(lines[j][poly[idxn]]); + uv_lines.push_back(lines[j][poly[idx]] + rect.position); + uv_lines.push_back(lines[j][poly[idxn]] + rect.position); computed_indices.push_back(poly[idx] + index_ofs); } @@ -273,19 +267,18 @@ void Sprite2DEditor::_update_mesh_data() { for (int i = 0; i < lines[pi].size(); i++) { Vector2 vtx = lines[pi][i]; + ol.write[i] = vtx + rect.position; - ol.write[i] = vtx; - - vtx -= rect.position; //offset by rect position - - //flip if flipped if (node->is_flipped_h()) { - vtx.x = rect.size.x - vtx.x - 1.0; + vtx.x = rect.size.x - vtx.x; } if (node->is_flipped_v()) { - vtx.y = rect.size.y - vtx.y - 1.0; + vtx.y = rect.size.y - vtx.y; + } + // Don't bake offset to Polygon2D which has offset property. + if (selected_menu_item != MENU_OPTION_CONVERT_TO_POLYGON_2D) { + vtx += node->get_offset(); } - if (node->is_centered()) { vtx -= rect.size / 2.0; } diff --git a/editor/plugins/tiles/tile_data_editors.cpp b/editor/plugins/tiles/tile_data_editors.cpp index ad4844fe3e..221833d450 100644 --- a/editor/plugins/tiles/tile_data_editors.cpp +++ b/editor/plugins/tiles/tile_data_editors.cpp @@ -1421,8 +1421,8 @@ void TileDataOcclusionShapeEditor::draw_over_tile(CanvasItem *p_canvas_item, Tra Variant TileDataOcclusionShapeEditor::_get_painted_value() { Ref<OccluderPolygon2D> occluder_polygon; - occluder_polygon.instantiate(); if (polygon_editor->get_polygon_count() >= 1) { + occluder_polygon.instantiate(); occluder_polygon->set_polygon(polygon_editor->get_polygon(0)); } return occluder_polygon; diff --git a/editor/plugins/tiles/tile_set_editor.cpp b/editor/plugins/tiles/tile_set_editor.cpp index 5bde1f754b..ef56e66e85 100644 --- a/editor/plugins/tiles/tile_set_editor.cpp +++ b/editor/plugins/tiles/tile_set_editor.cpp @@ -86,8 +86,7 @@ bool TileSetEditor::_can_drop_data_fw(const Point2 &p_point, const Variant &p_da } for (int i = 0; i < files.size(); i++) { - String file = files[i]; - String ftype = EditorFileSystem::get_singleton()->get_file_type(file); + String ftype = EditorFileSystem::get_singleton()->get_file_type(files[i]); if (!ClassDB::is_parent_class(ftype, "Texture2D")) { return false; diff --git a/editor/plugins/tiles/tile_set_scenes_collection_source_editor.cpp b/editor/plugins/tiles/tile_set_scenes_collection_source_editor.cpp index eaf7a2b50b..1f4c3651e9 100644 --- a/editor/plugins/tiles/tile_set_scenes_collection_source_editor.cpp +++ b/editor/plugins/tiles/tile_set_scenes_collection_source_editor.cpp @@ -479,8 +479,7 @@ bool TileSetScenesCollectionSourceEditor::_can_drop_data_fw(const Point2 &p_poin } for (int i = 0; i < files.size(); i++) { - String file = files[i]; - String ftype = EditorFileSystem::get_singleton()->get_file_type(file); + String ftype = EditorFileSystem::get_singleton()->get_file_type(files[i]); if (!ClassDB::is_parent_class(ftype, "PackedScene")) { return false; diff --git a/editor/plugins/visual_shader_editor_plugin.cpp b/editor/plugins/visual_shader_editor_plugin.cpp index 5cae151531..5c22e454ab 100644 --- a/editor/plugins/visual_shader_editor_plugin.cpp +++ b/editor/plugins/visual_shader_editor_plugin.cpp @@ -4826,16 +4826,14 @@ void VisualShaderEditor::_varying_create() { add_varying_dialog->hide(); } -void VisualShaderEditor::_varying_name_changed(const String &p_text) { - String name = p_text; - - if (!name.is_valid_identifier()) { +void VisualShaderEditor::_varying_name_changed(const String &p_name) { + if (!p_name.is_valid_identifier()) { varying_error_label->show(); varying_error_label->set_text(TTR("Invalid name for varying.")); add_varying_dialog->get_ok_button()->set_disabled(true); return; } - if (visual_shader->has_varying(name)) { + if (visual_shader->has_varying(p_name)) { varying_error_label->show(); varying_error_label->set_text(TTR("Varying with that name is already exist.")); add_varying_dialog->get_ok_button()->set_disabled(true); diff --git a/editor/plugins/visual_shader_editor_plugin.h b/editor/plugins/visual_shader_editor_plugin.h index c4ee654b25..5f1fde3a52 100644 --- a/editor/plugins/visual_shader_editor_plugin.h +++ b/editor/plugins/visual_shader_editor_plugin.h @@ -491,7 +491,7 @@ class VisualShaderEditor : public VBoxContainer { void _member_cancel(); void _varying_create(); - void _varying_name_changed(const String &p_text); + void _varying_name_changed(const String &p_name); void _varying_deleted(); void _varying_selected(); void _varying_unselected(); |
