diff options
Diffstat (limited to 'editor')
-rw-r--r-- | editor/animation_bezier_editor.cpp | 20 | ||||
-rw-r--r-- | editor/animation_track_editor.cpp | 20 | ||||
-rw-r--r-- | editor/doc/doc_data.cpp | 24 | ||||
-rw-r--r-- | editor/editor_path.cpp | 1 | ||||
-rw-r--r-- | editor/find_in_files.cpp | 4 | ||||
-rw-r--r-- | editor/import/resource_importer_scene.cpp | 5 | ||||
-rw-r--r-- | editor/node_dock.cpp | 2 | ||||
-rw-r--r-- | editor/plugin_config_dialog.cpp | 13 | ||||
-rw-r--r-- | editor/plugins/asset_library_editor_plugin.cpp | 2 | ||||
-rw-r--r-- | editor/plugins/canvas_item_editor_plugin.cpp | 14 | ||||
-rw-r--r-- | editor/plugins/sprite_editor_plugin.cpp | 63 | ||||
-rw-r--r-- | editor/plugins/texture_region_editor_plugin.cpp | 4 | ||||
-rw-r--r-- | editor/project_manager.cpp | 4 | ||||
-rw-r--r-- | editor/spatial_editor_gizmos.cpp | 110 | ||||
-rw-r--r-- | editor/spatial_editor_gizmos.h | 13 |
15 files changed, 52 insertions, 247 deletions
diff --git a/editor/animation_bezier_editor.cpp b/editor/animation_bezier_editor.cpp index 2514663b4c..af2760e82b 100644 --- a/editor/animation_bezier_editor.cpp +++ b/editor/animation_bezier_editor.cpp @@ -491,26 +491,6 @@ void AnimationBezierTrackEdit::_notification(int p_what) { } draw_rect(Rect2(bs_from, bs_to - bs_from), bs); } - -#if 0 - // KEYFAMES // - - { - - float scale = timeline->get_zoom_scale(); - int limit_end = get_size().width - timeline->get_buttons_width(); - - for (int i = 0; i < animation->track_get_key_count(track); i++) { - - float offset = animation->track_get_key_time(track, i) - timeline->get_value(); - if (editor->is_key_selected(track, i) && editor->is_moving_selection()) { - offset += editor->get_moving_selection_offset(); - } - offset = offset * scale + limit; - draw_key(i, scale, int(offset), editor->is_key_selected(track, i), limit, limit_end); - } - } -#endif } } diff --git a/editor/animation_track_editor.cpp b/editor/animation_track_editor.cpp index f6d5312fc7..22a5298d5c 100644 --- a/editor/animation_track_editor.cpp +++ b/editor/animation_track_editor.cpp @@ -4838,25 +4838,6 @@ struct _AnimMoveRestore { void AnimationTrackEditor::_clear_key_edit() { if (key_edit) { - -#if 0 - // going back seems like the most comfortable thing to do, but it results - // in weird behaviors and crashes, because going back to animation editor - // triggers the editor setting up again itself - - bool go_back = false; - if (EditorNode::get_singleton()->get_inspector()->get_edited_object() == key_edit) { - EditorNode::get_singleton()->push_item(NULL); - go_back = true; - } - - memdelete(key_edit); - key_edit = NULL; - - if (go_back) { - EditorNode::get_singleton()->get_inspector_dock()->go_back(); - } -#else //if key edit is the object being inspected, remove it first if (EditorNode::get_singleton()->get_inspector()->get_edited_object() == key_edit || EditorNode::get_singleton()->get_inspector()->get_edited_object() == multi_key_edit) { @@ -4871,7 +4852,6 @@ void AnimationTrackEditor::_clear_key_edit() { memdelete(multi_key_edit); multi_key_edit = NULL; } -#endif } } diff --git a/editor/doc/doc_data.cpp b/editor/doc/doc_data.cpp index ea9bf508f1..f9f8761247 100644 --- a/editor/doc/doc_data.cpp +++ b/editor/doc/doc_data.cpp @@ -280,13 +280,27 @@ void DocData::generate(bool p_basic_types) { prop.overridden = inherited; bool default_value_valid = false; - Variant default_value = get_documentation_default_value(name, E->get().name, default_value_valid); + Variant default_value; - if (inherited) { - bool base_default_value_valid = false; - Variant base_default_value = get_documentation_default_value(ClassDB::get_parent_class(name), E->get().name, base_default_value_valid); - if (!default_value_valid || !base_default_value_valid || default_value == base_default_value) + if (name == "ProjectSettings") { + // Special case for project settings, so that settings are not taken from the current project's settings + if (E->get().name == "script" || + ProjectSettings::get_singleton()->get_order(E->get().name) >= ProjectSettings::NO_BUILTIN_ORDER_BASE) { continue; + } + if (E->get().usage & PROPERTY_USAGE_EDITOR) { + default_value = ProjectSettings::get_singleton()->property_get_revert(E->get().name); + default_value_valid = true; + } + } else { + default_value = get_documentation_default_value(name, E->get().name, default_value_valid); + + if (inherited) { + bool base_default_value_valid = false; + Variant base_default_value = get_documentation_default_value(ClassDB::get_parent_class(name), E->get().name, base_default_value_valid); + if (!default_value_valid || !base_default_value_valid || default_value == base_default_value) + continue; + } } if (default_value_valid && default_value.get_type() != Variant::OBJECT) { diff --git a/editor/editor_path.cpp b/editor/editor_path.cpp index d538c7c23d..f0d69f98fb 100644 --- a/editor/editor_path.cpp +++ b/editor/editor_path.cpp @@ -150,6 +150,7 @@ void EditorPath::_bind_methods() { EditorPath::EditorPath(EditorHistory *p_history) { history = p_history; + set_clip_text(true); set_text_align(ALIGN_LEFT); get_popup()->connect("about_to_show", this, "_about_to_show"); get_popup()->connect("id_pressed", this, "_id_pressed"); diff --git a/editor/find_in_files.cpp b/editor/find_in_files.cpp index 86a4a9ef47..4ab90ad3e4 100644 --- a/editor/find_in_files.cpp +++ b/editor/find_in_files.cpp @@ -828,8 +828,8 @@ void FindInFilesPanel::apply_replaces_in_file(String fpath, const Vector<Result> // If there are unsaved changes, the user will be asked on focus, // however that means either losing changes or losing replaces. - FileAccess *f = FileAccess::open(fpath, FileAccess::READ); - ERR_FAIL_COND_MSG(f == NULL, "Cannot open file from path '" + fpath + "'."); + FileAccessRef f = FileAccess::open(fpath, FileAccess::READ); + ERR_FAIL_COND_MSG(!f, "Cannot open file from path '" + fpath + "'."); String buffer; int current_line = 1; diff --git a/editor/import/resource_importer_scene.cpp b/editor/import/resource_importer_scene.cpp index cab317990e..0774d0b5dc 100644 --- a/editor/import/resource_importer_scene.cpp +++ b/editor/import/resource_importer_scene.cpp @@ -32,18 +32,15 @@ #include "core/io/resource_saver.h" #include "editor/editor_node.h" -#include "scene/resources/packed_scene.h" - #include "scene/3d/collision_shape.h" #include "scene/3d/mesh_instance.h" #include "scene/3d/navigation.h" #include "scene/3d/physics_body.h" -#include "scene/3d/portal.h" -#include "scene/3d/room_instance.h" #include "scene/3d/vehicle_body.h" #include "scene/animation/animation_player.h" #include "scene/resources/animation.h" #include "scene/resources/box_shape.h" +#include "scene/resources/packed_scene.h" #include "scene/resources/plane_shape.h" #include "scene/resources/ray_shape.h" #include "scene/resources/resource_format_text.h" diff --git a/editor/node_dock.cpp b/editor/node_dock.cpp index 20b8b3f5cb..c53c5f330b 100644 --- a/editor/node_dock.cpp +++ b/editor/node_dock.cpp @@ -105,6 +105,7 @@ NodeDock::NodeDock() { connections_button->set_toggle_mode(true); connections_button->set_pressed(true); connections_button->set_h_size_flags(SIZE_EXPAND_FILL); + connections_button->set_clip_text(true); mode_hb->add_child(connections_button); connections_button->connect("pressed", this, "show_connections"); @@ -113,6 +114,7 @@ NodeDock::NodeDock() { groups_button->set_toggle_mode(true); groups_button->set_pressed(false); groups_button->set_h_size_flags(SIZE_EXPAND_FILL); + groups_button->set_clip_text(true); mode_hb->add_child(groups_button); groups_button->connect("pressed", this, "show_groups"); diff --git a/editor/plugin_config_dialog.cpp b/editor/plugin_config_dialog.cpp index 28667abe77..07b87633a9 100644 --- a/editor/plugin_config_dialog.cpp +++ b/editor/plugin_config_dialog.cpp @@ -77,16 +77,19 @@ void PluginConfigDialog::_on_confirmed() { if (lang_name == GDScriptLanguage::get_singleton()->get_name()) { // Hard-coded GDScript template to keep usability until we use script templates. - Ref<GDScript> gdscript = memnew(GDScript); + Ref<Script> gdscript = memnew(GDScript); gdscript->set_source_code( "tool\n" "extends EditorPlugin\n" "\n" - "func _enter_tree():\n" - "\tpass\n" "\n" - "func _exit_tree():\n" - "\tpass\n"); + "func _enter_tree()%VOID_RETURN%:\n" + "%TS%pass\n" + "\n" + "\n" + "func _exit_tree()%VOID_RETURN%:\n" + "%TS%pass\n"); + GDScriptLanguage::get_singleton()->make_template("", "", gdscript); String script_path = path.plus_file(script_edit->get_text()); gdscript->set_path(script_path); ResourceSaver::save(script_path, gdscript); diff --git a/editor/plugins/asset_library_editor_plugin.cpp b/editor/plugins/asset_library_editor_plugin.cpp index c1f62e8342..4f73a5eaea 100644 --- a/editor/plugins/asset_library_editor_plugin.cpp +++ b/editor/plugins/asset_library_editor_plugin.cpp @@ -162,7 +162,7 @@ void EditorAssetLibraryItemDescription::set_image(int p_type, int p_index, const Ref<Image> overlay = get_icon("PlayOverlay", "EditorIcons")->get_data(); Ref<Image> thumbnail = p_image->get_data(); thumbnail = thumbnail->duplicate(); - Point2 overlay_pos = Point2((thumbnail->get_width() - overlay->get_width() / 2) / 2, (thumbnail->get_height() - overlay->get_height() / 2) / 2); + Point2 overlay_pos = Point2((thumbnail->get_width() - overlay->get_width()) / 2, (thumbnail->get_height() - overlay->get_height()) / 2); // Overlay and thumbnail need the same format for `blend_rect` to work. thumbnail->convert(Image::FORMAT_RGBA8); diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp index e1fafde6b9..f798714812 100644 --- a/editor/plugins/canvas_item_editor_plugin.cpp +++ b/editor/plugins/canvas_item_editor_plugin.cpp @@ -1750,8 +1750,18 @@ bool CanvasItemEditor::_gui_input_resize(const Ref<InputEvent> &p_event) { Transform2D xform = canvas_item->get_global_transform_with_canvas().affine_inverse(); - Point2 drag_to_snapped_begin = snap_point(xform.affine_inverse().xform(current_begin) + (drag_to - drag_from), SNAP_NODE_ANCHORS | SNAP_NODE_PARENT | SNAP_OTHER_NODES | SNAP_GRID | SNAP_PIXEL, 0, canvas_item); - Point2 drag_to_snapped_end = snap_point(xform.affine_inverse().xform(current_end) + (drag_to - drag_from), SNAP_NODE_ANCHORS | SNAP_NODE_PARENT | SNAP_OTHER_NODES | SNAP_GRID | SNAP_PIXEL, 0, canvas_item); + Point2 drag_to_snapped_begin; + Point2 drag_to_snapped_end; + + // last call decides which snapping lines are drawn + if (drag_type == DRAG_LEFT || drag_type == DRAG_TOP || drag_type == DRAG_TOP_LEFT) { + drag_to_snapped_end = snap_point(xform.affine_inverse().xform(current_end) + (drag_to - drag_from), SNAP_NODE_ANCHORS | SNAP_NODE_PARENT | SNAP_OTHER_NODES | SNAP_GRID | SNAP_PIXEL, 0, canvas_item); + drag_to_snapped_begin = snap_point(xform.affine_inverse().xform(current_begin) + (drag_to - drag_from), SNAP_NODE_ANCHORS | SNAP_NODE_PARENT | SNAP_OTHER_NODES | SNAP_GRID | SNAP_PIXEL, 0, canvas_item); + } else { + drag_to_snapped_begin = snap_point(xform.affine_inverse().xform(current_begin) + (drag_to - drag_from), SNAP_NODE_ANCHORS | SNAP_NODE_PARENT | SNAP_OTHER_NODES | SNAP_GRID | SNAP_PIXEL, 0, canvas_item); + drag_to_snapped_end = snap_point(xform.affine_inverse().xform(current_end) + (drag_to - drag_from), SNAP_NODE_ANCHORS | SNAP_NODE_PARENT | SNAP_OTHER_NODES | SNAP_GRID | SNAP_PIXEL, 0, canvas_item); + } + Point2 drag_begin = xform.xform(drag_to_snapped_begin); Point2 drag_end = xform.xform(drag_to_snapped_end); diff --git a/editor/plugins/sprite_editor_plugin.cpp b/editor/plugins/sprite_editor_plugin.cpp index f5ea88eeae..6757b180a3 100644 --- a/editor/plugins/sprite_editor_plugin.cpp +++ b/editor/plugins/sprite_editor_plugin.cpp @@ -474,69 +474,6 @@ void SpriteEditor::_add_as_sibling_or_child(Node *p_own_node, Node *p_new_node) p_new_node->set_owner(this->get_tree()->get_edited_scene_root()); } -#if 0 -void SpriteEditor::_create_uv_lines() { - - Ref<Mesh> sprite = node->get_sprite(); - ERR_FAIL_COND(!sprite.is_valid()); - - Set<SpriteEditorEdgeSort> edges; - uv_lines.clear(); - for (int i = 0; i < sprite->get_surface_count(); i++) { - if (sprite->surface_get_primitive_type(i) != Mesh::PRIMITIVE_TRIANGLES) - continue; - Array a = sprite->surface_get_arrays(i); - - PoolVector<Vector2> uv = a[p_layer == 0 ? Mesh::ARRAY_TEX_UV : Mesh::ARRAY_TEX_UV2]; - if (uv.size() == 0) { - err_dialog->set_text(TTR("Model has no UV in this layer")); - err_dialog->popup_centered_minsize(); - return; - } - - PoolVector<Vector2>::Read r = uv.read(); - - PoolVector<int> indices = a[Mesh::ARRAY_INDEX]; - PoolVector<int>::Read ri; - - int ic; - bool use_indices; - - if (indices.size()) { - ic = indices.size(); - ri = indices.read(); - use_indices = true; - } else { - ic = uv.size(); - use_indices = false; - } - - for (int j = 0; j < ic; j += 3) { - - for (int k = 0; k < 3; k++) { - - SpriteEditorEdgeSort edge; - if (use_indices) { - edge.a = r[ri[j + k]]; - edge.b = r[ri[j + ((k + 1) % 3)]]; - } else { - edge.a = r[j + k]; - edge.b = r[j + ((k + 1) % 3)]; - } - - if (edges.has(edge)) - continue; - - uv_lines.push_back(edge.a); - uv_lines.push_back(edge.b); - edges.insert(edge); - } - } - } - - debug_uv_dialog->popup_centered_minsize(); -} -#endif void SpriteEditor::_debug_uv_draw() { Ref<Texture> tex = node->get_texture(); diff --git a/editor/plugins/texture_region_editor_plugin.cpp b/editor/plugins/texture_region_editor_plugin.cpp index f9b1e3b43a..ce6bb4b91a 100644 --- a/editor/plugins/texture_region_editor_plugin.cpp +++ b/editor/plugins/texture_region_editor_plugin.cpp @@ -1010,12 +1010,12 @@ TextureRegionEditor::TextureRegionEditor(EditorNode *p_editor) { zoom_hb->add_child(zoom_out); zoom_reset = memnew(ToolButton); - zoom_out->set_tooltip(TTR("Zoom Reset")); + zoom_reset->set_tooltip(TTR("Zoom Reset")); zoom_reset->connect("pressed", this, "_zoom_reset"); zoom_hb->add_child(zoom_reset); zoom_in = memnew(ToolButton); - zoom_out->set_tooltip(TTR("Zoom In")); + zoom_in->set_tooltip(TTR("Zoom In")); zoom_in->connect("pressed", this, "_zoom_in"); zoom_hb->add_child(zoom_in); diff --git a/editor/project_manager.cpp b/editor/project_manager.cpp index 9bbb9bd38c..30e31cb530 100644 --- a/editor/project_manager.cpp +++ b/editor/project_manager.cpp @@ -1313,7 +1313,9 @@ void ProjectList::create_project_item_control(int p_index) { hb->set_is_favorite(item.favorite); TextureRect *tf = memnew(TextureRect); - tf->set_texture(get_icon("DefaultProjectIcon", "EditorIcons")); + // The project icon may not be loaded by the time the control is displayed, + // so use a loading placeholder. + tf->set_texture(get_icon("ProjectIconLoading", "EditorIcons")); if (item.missing) { tf->set_modulate(Color(1, 1, 1, 0.5)); } diff --git a/editor/spatial_editor_gizmos.cpp b/editor/spatial_editor_gizmos.cpp index 89713c2579..c94b0eeab0 100644 --- a/editor/spatial_editor_gizmos.cpp +++ b/editor/spatial_editor_gizmos.cpp @@ -44,11 +44,9 @@ #include "scene/3d/navigation_mesh.h" #include "scene/3d/particles.h" #include "scene/3d/physics_joint.h" -#include "scene/3d/portal.h" #include "scene/3d/position_3d.h" #include "scene/3d/ray_cast.h" #include "scene/3d/reflection_probe.h" -#include "scene/3d/room_instance.h" #include "scene/3d/soft_body.h" #include "scene/3d/spring_arm.h" #include "scene/3d/sprite_3d.h" @@ -885,7 +883,7 @@ void LightSpatialGizmoPlugin::set_handle(EditorSpatialGizmo *p_gizmo, int p_idx, d = Math::stepify(d, SpatialEditor::get_singleton()->get_translate_snap()); } - if (d < 0) + if (d <= 0) // Equal is here for negative zero. d = 0; light->set_param(Light::PARAM_RANGE, d); @@ -1951,112 +1949,6 @@ void PhysicalBoneSpatialGizmoPlugin::redraw(EditorSpatialGizmo *p_gizmo) { p_gizmo->add_lines(points, material); } -// FIXME: Kept as reference for reimplementation in 3.1+ -#if 0 - -void RoomSpatialGizmo::redraw() { - - clear(); - Ref<RoomBounds> roomie = room->get_room(); - if (roomie.is_null()) - return; - PoolVector<Face3> faces = roomie->get_geometry_hint(); - - Vector<Vector3> lines; - int fc = faces.size(); - PoolVector<Face3>::Read r = faces.read(); - - Map<_EdgeKey, Vector3> edge_map; - - for (int i = 0; i < fc; i++) { - - Vector3 fn = r[i].get_plane().normal; - - for (int j = 0; j < 3; j++) { - - _EdgeKey ek; - ek.from = r[i].vertex[j].snapped(Vector3(CMP_EPSILON, CMP_EPSILON, CMP_EPSILON)); - ek.to = r[i].vertex[(j + 1) % 3].snapped(Vector3(CMP_EPSILON, CMP_EPSILON, CMP_EPSILON)); - if (ek.from < ek.to) - SWAP(ek.from, ek.to); - - Map<_EdgeKey, Vector3>::Element *E = edge_map.find(ek); - - if (E) { - - if (E->get().dot(fn) > 0.9) { - - E->get() = Vector3(); - } - - } else { - - edge_map[ek] = fn; - } - } - } - - for (Map<_EdgeKey, Vector3>::Element *E = edge_map.front(); E; E = E->next()) { - - if (E->get() != Vector3()) { - lines.push_back(E->key().from); - lines.push_back(E->key().to); - } - } - - add_lines(lines, EditorSpatialGizmos::singleton->room_material); - add_collision_segments(lines); -} - -RoomSpatialGizmo::RoomSpatialGizmo(Room *p_room) { - - set_spatial_node(p_room); - room = p_room; -} - -///// - -void PortalSpatialGizmo::redraw() { - - clear(); - - Vector<Point2> points = portal->get_shape(); - if (points.size() == 0) { - return; - } - - Vector<Vector3> lines; - - Vector3 center; - for (int i = 0; i < points.size(); i++) { - - Vector3 f; - f.x = points[i].x; - f.y = points[i].y; - Vector3 fn; - fn.x = points[(i + 1) % points.size()].x; - fn.y = points[(i + 1) % points.size()].y; - center += f; - - lines.push_back(f); - lines.push_back(fn); - } - - center /= points.size(); - lines.push_back(center); - lines.push_back(center + Vector3(0, 0, 1)); - - add_lines(lines, EditorSpatialGizmos::singleton->portal_material); - add_collision_segments(lines); -} - -PortalSpatialGizmo::PortalSpatialGizmo(Portal *p_portal) { - - set_spatial_node(p_portal); - portal = p_portal; -} - -#endif ///// RayCastSpatialGizmoPlugin::RayCastSpatialGizmoPlugin() { diff --git a/editor/spatial_editor_gizmos.h b/editor/spatial_editor_gizmos.h index 1d6801a136..81b62981ac 100644 --- a/editor/spatial_editor_gizmos.h +++ b/editor/spatial_editor_gizmos.h @@ -160,19 +160,6 @@ public: PhysicalBoneSpatialGizmoPlugin(); }; -#if 0 -class PortalSpatialGizmo : public EditorSpatialGizmo { - - GDCLASS(PortalSpatialGizmo, EditorSpatialGizmo); - - Portal *portal; - -public: - void redraw(); - PortalSpatialGizmo(Portal *p_portal = NULL); -}; -#endif - class RayCastSpatialGizmoPlugin : public EditorSpatialGizmoPlugin { GDCLASS(RayCastSpatialGizmoPlugin, EditorSpatialGizmoPlugin); |