diff options
Diffstat (limited to 'editor/plugins')
25 files changed, 197 insertions, 65 deletions
diff --git a/editor/plugins/animation_player_editor_plugin.cpp b/editor/plugins/animation_player_editor_plugin.cpp index 19f423cd41..688f99cde7 100644 --- a/editor/plugins/animation_player_editor_plugin.cpp +++ b/editor/plugins/animation_player_editor_plugin.cpp @@ -903,7 +903,7 @@ void AnimationPlayerEditor::set_state(const Dictionary &p_state) { player->connect(SNAME("animation_list_changed"), callable_mp(this, &AnimationPlayerEditor::_animation_libraries_updated), CONNECT_DEFERRED); } if (!player->is_connected(SNAME("current_animation_changed"), callable_mp(this, &AnimationPlayerEditor::_current_animation_changed))) { - player->connect(SNAME("current_animation_changed"), callable_mp(this, &AnimationPlayerEditor::_current_animation_changed), CONNECT_DEFERRED); + player->connect(SNAME("current_animation_changed"), callable_mp(this, &AnimationPlayerEditor::_current_animation_changed)); } } diff --git a/editor/plugins/camera_3d_editor_plugin.cpp b/editor/plugins/camera_3d_editor_plugin.cpp index 7bdeb151ea..71a3d4fad6 100644 --- a/editor/plugins/camera_3d_editor_plugin.cpp +++ b/editor/plugins/camera_3d_editor_plugin.cpp @@ -32,8 +32,11 @@ #include "camera_3d_editor_plugin.h" +#include "core/config/project_settings.h" #include "editor/editor_node.h" #include "node_3d_editor_plugin.h" +#include "scene/gui/texture_rect.h" +#include "scene/main/viewport.h" void Camera3DEditor::_node_removed(Node *p_node) { if (p_node == node) { @@ -78,9 +81,35 @@ Camera3DEditor::Camera3DEditor() { preview->connect(SceneStringName(pressed), callable_mp(this, &Camera3DEditor::_pressed)); } +void Camera3DPreview::_update_sub_viewport_size() { + sub_viewport->set_size(Node3DEditor::get_camera_viewport_size(camera)); +} + +Camera3DPreview::Camera3DPreview(Camera3D *p_camera) : + TexturePreview(nullptr, false), camera(p_camera), sub_viewport(memnew(SubViewport)) { + RenderingServer::get_singleton()->viewport_attach_camera(sub_viewport->get_viewport_rid(), camera->get_camera()); + add_child(sub_viewport); + + TextureRect *display = get_texture_display(); + display->set_texture(sub_viewport->get_texture()); + sub_viewport->connect("size_changed", callable_mp((CanvasItem *)display, &CanvasItem::queue_redraw)); + + ProjectSettings::get_singleton()->connect("settings_changed", callable_mp(this, &Camera3DPreview::_update_sub_viewport_size)); + _update_sub_viewport_size(); +} + +bool EditorInspectorPluginCamera3DPreview::can_handle(Object *p_object) { + return Object::cast_to<Camera3D>(p_object) != nullptr; +} + +void EditorInspectorPluginCamera3DPreview::parse_begin(Object *p_object) { + Camera3D *camera = Object::cast_to<Camera3D>(p_object); + Camera3DPreview *preview = memnew(Camera3DPreview(camera)); + add_custom_control(preview); +} + void Camera3DEditorPlugin::edit(Object *p_object) { Node3DEditor::get_singleton()->set_can_preview(Object::cast_to<Camera3D>(p_object)); - //camera_editor->edit(Object::cast_to<Node>(p_object)); } bool Camera3DEditorPlugin::handles(Object *p_object) const { @@ -88,27 +117,15 @@ bool Camera3DEditorPlugin::handles(Object *p_object) const { } void Camera3DEditorPlugin::make_visible(bool p_visible) { - if (p_visible) { - //Node3DEditor::get_singleton()->set_can_preview(Object::cast_to<Camera3D>(p_object)); - } else { + if (!p_visible) { Node3DEditor::get_singleton()->set_can_preview(nullptr); } } Camera3DEditorPlugin::Camera3DEditorPlugin() { - /* camera_editor = memnew( CameraEditor ); - EditorNode::get_singleton()->get_main_screen_control()->add_child(camera_editor); - - camera_editor->set_anchor(SIDE_LEFT,Control::ANCHOR_END); - camera_editor->set_anchor(SIDE_RIGHT,Control::ANCHOR_END); - camera_editor->set_offset(SIDE_LEFT,60); - camera_editor->set_offset(SIDE_RIGHT,0); - camera_editor->set_offset(SIDE_TOP,0); - camera_editor->set_offset(SIDE_BOTTOM,10); - - - camera_editor->hide(); -*/ + Ref<EditorInspectorPluginCamera3DPreview> plugin; + plugin.instantiate(); + add_inspector_plugin(plugin); } Camera3DEditorPlugin::~Camera3DEditorPlugin() { diff --git a/editor/plugins/camera_3d_editor_plugin.h b/editor/plugins/camera_3d_editor_plugin.h index b3ec6927da..d361bf5a88 100644 --- a/editor/plugins/camera_3d_editor_plugin.h +++ b/editor/plugins/camera_3d_editor_plugin.h @@ -34,7 +34,10 @@ #define CAMERA_3D_EDITOR_PLUGIN_H #include "editor/plugins/editor_plugin.h" -#include "scene/3d/camera_3d.h" +#include "editor/plugins/texture_editor_plugin.h" + +class Camera3D; +class SubViewport; class Camera3DEditor : public Control { GDCLASS(Camera3DEditor, Control); @@ -53,11 +56,29 @@ public: Camera3DEditor(); }; +class Camera3DPreview : public TexturePreview { + GDCLASS(Camera3DPreview, TexturePreview); + + Camera3D *camera = nullptr; + SubViewport *sub_viewport = nullptr; + + void _update_sub_viewport_size(); + +public: + Camera3DPreview(Camera3D *p_camera); +}; + +class EditorInspectorPluginCamera3DPreview : public EditorInspectorPluginTexture { + GDCLASS(EditorInspectorPluginCamera3DPreview, EditorInspectorPluginTexture); + +public: + virtual bool can_handle(Object *p_object) override; + virtual void parse_begin(Object *p_object) override; +}; + class Camera3DEditorPlugin : public EditorPlugin { GDCLASS(Camera3DEditorPlugin, EditorPlugin); - //CameraEditor *camera_editor; - public: virtual String get_name() const override { return "Camera3D"; } bool has_main_screen() const override { return false; } diff --git a/editor/plugins/gizmos/camera_3d_gizmo_plugin.cpp b/editor/plugins/gizmos/camera_3d_gizmo_plugin.cpp index 13fc56921d..8e16fc68d8 100644 --- a/editor/plugins/gizmos/camera_3d_gizmo_plugin.cpp +++ b/editor/plugins/gizmos/camera_3d_gizmo_plugin.cpp @@ -48,24 +48,6 @@ Camera3DGizmoPlugin::Camera3DGizmoPlugin() { create_handle_material("handles"); } -Size2i Camera3DGizmoPlugin::_get_viewport_size(Camera3D *p_camera) { - Viewport *viewport = p_camera->get_viewport(); - - Window *window = Object::cast_to<Window>(viewport); - if (window) { - return window->get_size(); - } - - SubViewport *sub_viewport = Object::cast_to<SubViewport>(viewport); - ERR_FAIL_NULL_V(sub_viewport, Size2i()); - - if (sub_viewport == EditorNode::get_singleton()->get_scene_root()) { - return Size2(GLOBAL_GET("display/window/size/viewport_width"), GLOBAL_GET("display/window/size/viewport_height")); - } - - return sub_viewport->get_size(); -} - bool Camera3DGizmoPlugin::has_gizmo(Node3D *p_spatial) { return Object::cast_to<Camera3D>(p_spatial) != nullptr; } @@ -168,7 +150,7 @@ void Camera3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) { Ref<Material> material = get_material("camera_material", p_gizmo); Ref<Material> icon = get_material("camera_icon", p_gizmo); - const Size2i viewport_size = _get_viewport_size(camera); + const Size2i viewport_size = Node3DEditor::get_camera_viewport_size(camera); const real_t viewport_aspect = viewport_size.x > 0 && viewport_size.y > 0 ? viewport_size.aspect() : 1.0; const Size2 size_factor = viewport_aspect > 1.0 ? Size2(1.0, 1.0 / viewport_aspect) : Size2(viewport_aspect, 1.0); diff --git a/editor/plugins/gizmos/camera_3d_gizmo_plugin.h b/editor/plugins/gizmos/camera_3d_gizmo_plugin.h index 63e573907b..9a591d4d06 100644 --- a/editor/plugins/gizmos/camera_3d_gizmo_plugin.h +++ b/editor/plugins/gizmos/camera_3d_gizmo_plugin.h @@ -39,7 +39,6 @@ class Camera3DGizmoPlugin : public EditorNode3DGizmoPlugin { GDCLASS(Camera3DGizmoPlugin, EditorNode3DGizmoPlugin); private: - static Size2i _get_viewport_size(Camera3D *p_camera); static float _find_closest_angle_to_half_pi_arc(const Vector3 &p_from, const Vector3 &p_to, float p_arc_radius, const Transform3D &p_arc_xform); public: diff --git a/editor/plugins/gizmos/collision_shape_3d_gizmo_plugin.cpp b/editor/plugins/gizmos/collision_shape_3d_gizmo_plugin.cpp index 2c852c718b..bfe31d7811 100644 --- a/editor/plugins/gizmos/collision_shape_3d_gizmo_plugin.cpp +++ b/editor/plugins/gizmos/collision_shape_3d_gizmo_plugin.cpp @@ -51,17 +51,47 @@ CollisionShape3DGizmoPlugin::CollisionShape3DGizmoPlugin() { helper.instantiate(); - const Color gizmo_color = SceneTree::get_singleton()->get_debug_collisions_color(); - create_material("shape_material", gizmo_color); - const float gizmo_value = gizmo_color.get_v(); - const Color gizmo_color_disabled = Color(gizmo_value, gizmo_value, gizmo_value, 0.65); - create_material("shape_material_disabled", gizmo_color_disabled); + + create_collision_material("shape_material", 2.0); + create_collision_material("shape_material_arraymesh", 0.0625); + + create_collision_material("shape_material_disabled", 0.0625); + create_collision_material("shape_material_arraymesh_disabled", 0.015625); + create_handle_material("handles"); } CollisionShape3DGizmoPlugin::~CollisionShape3DGizmoPlugin() { } +void CollisionShape3DGizmoPlugin::create_collision_material(const String &p_name, float p_alpha) { + Vector<Ref<StandardMaterial3D>> mats; + + const Color collision_color(1.0, 1.0, 1.0, p_alpha); + + for (int i = 0; i < 4; i++) { + bool instantiated = i < 2; + + Ref<StandardMaterial3D> material = memnew(StandardMaterial3D); + + Color color = collision_color; + color.a *= instantiated ? 0.25 : 1.0; + + material->set_albedo(color); + material->set_shading_mode(StandardMaterial3D::SHADING_MODE_UNSHADED); + material->set_transparency(StandardMaterial3D::TRANSPARENCY_ALPHA); + material->set_render_priority(StandardMaterial3D::RENDER_PRIORITY_MIN + 1); + material->set_cull_mode(StandardMaterial3D::CULL_BACK); + material->set_flag(StandardMaterial3D::FLAG_DISABLE_FOG, true); + material->set_flag(StandardMaterial3D::FLAG_ALBEDO_FROM_VERTEX_COLOR, true); + material->set_flag(StandardMaterial3D::FLAG_SRGB_VERTEX_COLOR, true); + + mats.push_back(material); + } + + materials[p_name] = mats; +} + bool CollisionShape3DGizmoPlugin::has_gizmo(Node3D *p_spatial) { return Object::cast_to<CollisionShape3D>(p_spatial) != nullptr; } @@ -313,9 +343,20 @@ void CollisionShape3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) { return; } - const Ref<Material> material = + const Ref<StandardMaterial3D> material = get_material(!cs->is_disabled() ? "shape_material" : "shape_material_disabled", p_gizmo); - Ref<Material> handles_material = get_material("handles"); + const Ref<StandardMaterial3D> material_arraymesh = + get_material(!cs->is_disabled() ? "shape_material_arraymesh" : "shape_material_arraymesh_disabled", p_gizmo); + const Ref<Material> handles_material = get_material("handles"); + + const Color collision_color = cs->is_disabled() ? Color(1.0, 1.0, 1.0, 0.75) : cs->get_debug_color(); + + if (cs->get_debug_fill_enabled()) { + Ref<ArrayMesh> array_mesh = s->get_debug_arraymesh_faces(collision_color); + if (array_mesh.is_valid()) { + p_gizmo->add_mesh(array_mesh, material_arraymesh); + } + } if (Object::cast_to<SphereShape3D>(*s)) { Ref<SphereShape3D> sp = s; @@ -353,7 +394,7 @@ void CollisionShape3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) { collision_segments.push_back(Vector3(b.x, b.y, 0)); } - p_gizmo->add_lines(points, material); + p_gizmo->add_lines(points, material, false, collision_color); p_gizmo->add_collision_segments(collision_segments); Vector<Vector3> handles; handles.push_back(Vector3(r, 0, 0)); @@ -376,7 +417,7 @@ void CollisionShape3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) { const Vector<Vector3> handles = helper->box_get_handles(bs->get_size()); - p_gizmo->add_lines(lines, material); + p_gizmo->add_lines(lines, material, false, collision_color); p_gizmo->add_collision_segments(lines); p_gizmo->add_handles(handles, handles_material); } @@ -414,7 +455,7 @@ void CollisionShape3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) { points.push_back(Vector3(b.y, b.x, 0) + dud); } - p_gizmo->add_lines(points, material); + p_gizmo->add_lines(points, material, false, collision_color); Vector<Vector3> collision_segments; @@ -478,7 +519,7 @@ void CollisionShape3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) { } } - p_gizmo->add_lines(points, material); + p_gizmo->add_lines(points, material, false, collision_color); Vector<Vector3> collision_segments; @@ -533,7 +574,7 @@ void CollisionShape3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) { p.normal * p.d + p.normal * 3 }; - p_gizmo->add_lines(points, material); + p_gizmo->add_lines(points, material, false, collision_color); p_gizmo->add_collision_segments(points); } @@ -551,7 +592,7 @@ void CollisionShape3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) { lines.write[i * 2 + 0] = md.vertices[md.edges[i].vertex_a]; lines.write[i * 2 + 1] = md.vertices[md.edges[i].vertex_b]; } - p_gizmo->add_lines(lines, material); + p_gizmo->add_lines(lines, material, false, collision_color); p_gizmo->add_collision_segments(lines); } } @@ -560,7 +601,7 @@ void CollisionShape3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) { if (Object::cast_to<ConcavePolygonShape3D>(*s)) { Ref<ConcavePolygonShape3D> cs2 = s; Ref<ArrayMesh> mesh = cs2->get_debug_mesh(); - p_gizmo->add_mesh(mesh, material); + p_gizmo->add_lines(cs2->get_debug_mesh_lines(), material, false, collision_color); p_gizmo->add_collision_segments(cs2->get_debug_mesh_lines()); } @@ -571,7 +612,7 @@ void CollisionShape3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) { Vector3(), Vector3(0, 0, rs->get_length()) }; - p_gizmo->add_lines(points, material); + p_gizmo->add_lines(points, material, false, collision_color); p_gizmo->add_collision_segments(points); Vector<Vector3> handles; handles.push_back(Vector3(0, 0, rs->get_length())); @@ -581,7 +622,7 @@ void CollisionShape3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) { if (Object::cast_to<HeightMapShape3D>(*s)) { Ref<HeightMapShape3D> hms = s; - Ref<ArrayMesh> mesh = hms->get_debug_mesh(); - p_gizmo->add_mesh(mesh, material); + Vector<Vector3> lines = hms->get_debug_mesh_lines(); + p_gizmo->add_lines(lines, material, false, collision_color); } } diff --git a/editor/plugins/gizmos/collision_shape_3d_gizmo_plugin.h b/editor/plugins/gizmos/collision_shape_3d_gizmo_plugin.h index 0b6cd9164a..46af8f14fe 100644 --- a/editor/plugins/gizmos/collision_shape_3d_gizmo_plugin.h +++ b/editor/plugins/gizmos/collision_shape_3d_gizmo_plugin.h @@ -40,6 +40,8 @@ class Gizmo3DHelper; class CollisionShape3DGizmoPlugin : public EditorNode3DGizmoPlugin { GDCLASS(CollisionShape3DGizmoPlugin, EditorNode3DGizmoPlugin); + void create_collision_material(const String &p_name, float p_alpha); + Ref<Gizmo3DHelper> helper; public: diff --git a/editor/plugins/mesh_library_editor_plugin.cpp b/editor/plugins/mesh_library_editor_plugin.cpp index c12775dd3d..318faee719 100644 --- a/editor/plugins/mesh_library_editor_plugin.cpp +++ b/editor/plugins/mesh_library_editor_plugin.cpp @@ -158,6 +158,25 @@ void MeshLibraryEditor::_import_scene_parse_node(Ref<MeshLibrary> p_library, Has } p_library->set_item_mesh(item_id, item_mesh); + GeometryInstance3D::ShadowCastingSetting gi3d_cast_shadows_setting = mesh_instance_node->get_cast_shadows_setting(); + switch (gi3d_cast_shadows_setting) { + case GeometryInstance3D::ShadowCastingSetting::SHADOW_CASTING_SETTING_OFF: { + p_library->set_item_mesh_cast_shadow(item_id, RS::ShadowCastingSetting::SHADOW_CASTING_SETTING_OFF); + } break; + case GeometryInstance3D::ShadowCastingSetting::SHADOW_CASTING_SETTING_ON: { + p_library->set_item_mesh_cast_shadow(item_id, RS::ShadowCastingSetting::SHADOW_CASTING_SETTING_ON); + } break; + case GeometryInstance3D::ShadowCastingSetting::SHADOW_CASTING_SETTING_DOUBLE_SIDED: { + p_library->set_item_mesh_cast_shadow(item_id, RS::ShadowCastingSetting::SHADOW_CASTING_SETTING_DOUBLE_SIDED); + } break; + case GeometryInstance3D::ShadowCastingSetting::SHADOW_CASTING_SETTING_SHADOWS_ONLY: { + p_library->set_item_mesh_cast_shadow(item_id, RS::ShadowCastingSetting::SHADOW_CASTING_SETTING_SHADOWS_ONLY); + } break; + default: { + p_library->set_item_mesh_cast_shadow(item_id, RS::ShadowCastingSetting::SHADOW_CASTING_SETTING_ON); + } break; + } + Transform3D item_mesh_transform; if (p_apply_xforms) { item_mesh_transform = mesh_instance_node->get_transform(); diff --git a/editor/plugins/node_3d_editor_gizmos.cpp b/editor/plugins/node_3d_editor_gizmos.cpp index 56de4d9835..783c922ab7 100644 --- a/editor/plugins/node_3d_editor_gizmos.cpp +++ b/editor/plugins/node_3d_editor_gizmos.cpp @@ -294,14 +294,11 @@ void EditorNode3DGizmo::add_vertices(const Vector<Vector3> &p_vertices, const Re Vector<Color> color; color.resize(p_vertices.size()); + const Color vertex_color = (is_selected() ? Color(1, 1, 1, 0.8) : Color(1, 1, 1, 0.2)) * p_modulate; { Color *w = color.ptrw(); for (int i = 0; i < p_vertices.size(); i++) { - if (is_selected()) { - w[i] = Color(1, 1, 1, 0.8) * p_modulate; - } else { - w[i] = Color(1, 1, 1, 0.2) * p_modulate; - } + w[i] = vertex_color; } } diff --git a/editor/plugins/node_3d_editor_plugin.cpp b/editor/plugins/node_3d_editor_plugin.cpp index 785bcb70ed..056800ad30 100644 --- a/editor/plugins/node_3d_editor_plugin.cpp +++ b/editor/plugins/node_3d_editor_plugin.cpp @@ -94,6 +94,7 @@ #include "scene/gui/center_container.h" #include "scene/gui/color_picker.h" #include "scene/gui/flow_container.h" +#include "scene/gui/separator.h" #include "scene/gui/split_container.h" #include "scene/gui/subviewport_container.h" #include "scene/resources/3d/sky_material.h" @@ -8824,7 +8825,12 @@ Node3DEditor::Node3DEditor() { ED_SHORTCUT("spatial_editor/focus_origin", TTR("Focus Origin"), Key::O); ED_SHORTCUT("spatial_editor/focus_selection", TTR("Focus Selection"), Key::F); ED_SHORTCUT_ARRAY("spatial_editor/align_transform_with_view", TTR("Align Transform with View"), - { int32_t(KeyModifierMask::ALT | KeyModifierMask::CMD_OR_CTRL | Key::KP_0), int32_t(KeyModifierMask::ALT | KeyModifierMask::CMD_OR_CTRL | Key::M) }); + { int32_t(KeyModifierMask::ALT | KeyModifierMask::CTRL | Key::KP_0), + int32_t(KeyModifierMask::ALT | KeyModifierMask::CTRL | Key::M), + int32_t(KeyModifierMask::ALT | KeyModifierMask::CTRL | Key::G) }); + ED_SHORTCUT_OVERRIDE_ARRAY("spatial_editor/align_transform_with_view", "macos", + { int32_t(KeyModifierMask::ALT | KeyModifierMask::META | Key::KP_0), + int32_t(KeyModifierMask::ALT | KeyModifierMask::META | Key::G) }); ED_SHORTCUT("spatial_editor/align_rotation_with_view", TTR("Align Rotation with View"), KeyModifierMask::ALT + KeyModifierMask::CMD_OR_CTRL + Key::F); ED_SHORTCUT("spatial_editor/freelook_toggle", TTR("Toggle Freelook"), KeyModifierMask::SHIFT + Key::F); ED_SHORTCUT("spatial_editor/decrease_fov", TTR("Decrease Field of View"), KeyModifierMask::CMD_OR_CTRL + Key::EQUAL); // Usually direct access key for `KEY_PLUS`. @@ -9313,6 +9319,24 @@ void Node3DEditorPlugin::set_state(const Dictionary &p_state) { spatial_editor->set_state(p_state); } +Size2i Node3DEditor::get_camera_viewport_size(Camera3D *p_camera) { + Viewport *viewport = p_camera->get_viewport(); + + Window *window = Object::cast_to<Window>(viewport); + if (window) { + return window->get_size(); + } + + SubViewport *sub_viewport = Object::cast_to<SubViewport>(viewport); + ERR_FAIL_NULL_V(sub_viewport, Size2i()); + + if (sub_viewport == EditorNode::get_singleton()->get_scene_root()) { + return Size2(GLOBAL_GET("display/window/size/viewport_width"), GLOBAL_GET("display/window/size/viewport_height")); + } + + return sub_viewport->get_size(); +} + Vector3 Node3DEditor::snap_point(Vector3 p_target, Vector3 p_start) const { if (is_snap_enabled()) { real_t snap = get_translate_snap(); diff --git a/editor/plugins/node_3d_editor_plugin.h b/editor/plugins/node_3d_editor_plugin.h index fe5537785a..5d029a1fca 100644 --- a/editor/plugins/node_3d_editor_plugin.h +++ b/editor/plugins/node_3d_editor_plugin.h @@ -883,6 +883,8 @@ protected: public: static Node3DEditor *get_singleton() { return singleton; } + static Size2i get_camera_viewport_size(Camera3D *p_camera); + Vector3 snap_point(Vector3 p_target, Vector3 p_start = Vector3(0, 0, 0)) const; float get_znear() const { return settings_znear->get_value(); } diff --git a/editor/plugins/plugin_config_dialog.cpp b/editor/plugins/plugin_config_dialog.cpp index 78986cf6ca..f5104dcb9a 100644 --- a/editor/plugins/plugin_config_dialog.cpp +++ b/editor/plugins/plugin_config_dialog.cpp @@ -307,7 +307,7 @@ PluginConfigDialog::PluginConfigDialog() { grid->add_child(script_name_label); script_edit = memnew(LineEdit); - script_edit->set_tooltip_text(TTR("Optional. The path to the script (relative to the add-on folder). If left empty, will default to \"plugin.gd\".")); + script_edit->set_tooltip_text(TTR("Optional. The name of the script file. If left empty, will default to the subfolder name.")); script_edit->set_placeholder("\"plugin.gd\" -> res://addons/my_plugin/plugin.gd"); script_edit->set_h_size_flags(Control::SIZE_EXPAND_FILL); grid->add_child(script_edit); diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp index d2098de99a..562a98c44a 100644 --- a/editor/plugins/script_editor_plugin.cpp +++ b/editor/plugins/script_editor_plugin.cpp @@ -66,6 +66,8 @@ #include "editor/themes/editor_scale.h" #include "editor/themes/editor_theme_manager.h" #include "editor/window_wrapper.h" +#include "scene/gui/separator.h" +#include "scene/gui/texture_rect.h" #include "scene/main/node.h" #include "scene/main/window.h" #include "script_text_editor.h" @@ -4156,6 +4158,7 @@ ScriptEditor::ScriptEditor(WindowWrapper *p_wrapper) { scripts_vbox->add_child(script_list); script_list->set_custom_minimum_size(Size2(100, 60) * EDSCALE); //need to give a bit of limit to avoid it from disappearing script_list->set_v_size_flags(SIZE_EXPAND_FILL); + script_list->set_theme_type_variation("ItemListSecondary"); script_split->set_split_offset(200 * EDSCALE); _sort_list_on_update = true; script_list->connect("item_clicked", callable_mp(this, &ScriptEditor::_script_list_clicked), CONNECT_DEFERRED); @@ -4199,6 +4202,7 @@ ScriptEditor::ScriptEditor(WindowWrapper *p_wrapper) { members_overview = memnew(ItemList); members_overview->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED); + members_overview->set_theme_type_variation("ItemListSecondary"); overview_vbox->add_child(members_overview); members_overview->set_allow_reselect(true); @@ -4208,6 +4212,7 @@ ScriptEditor::ScriptEditor(WindowWrapper *p_wrapper) { help_overview = memnew(ItemList); help_overview->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED); + help_overview->set_theme_type_variation("ItemListSecondary"); overview_vbox->add_child(help_overview); help_overview->set_allow_reselect(true); help_overview->set_custom_minimum_size(Size2(0, 60) * EDSCALE); //need to give a bit of limit to avoid it from disappearing diff --git a/editor/plugins/script_text_editor.cpp b/editor/plugins/script_text_editor.cpp index 92a0fbbebb..0314782f0e 100644 --- a/editor/plugins/script_text_editor.cpp +++ b/editor/plugins/script_text_editor.cpp @@ -42,6 +42,7 @@ #include "editor/editor_string_names.h" #include "editor/gui/editor_toaster.h" #include "editor/themes/editor_scale.h" +#include "scene/gui/menu_button.h" #include "scene/gui/rich_text_label.h" #include "scene/gui/split_container.h" diff --git a/editor/plugins/shader_editor_plugin.cpp b/editor/plugins/shader_editor_plugin.cpp index 2f9276bb46..a4d6cff418 100644 --- a/editor/plugins/shader_editor_plugin.cpp +++ b/editor/plugins/shader_editor_plugin.cpp @@ -823,6 +823,7 @@ ShaderEditorPlugin::ShaderEditorPlugin() { shader_list = memnew(ItemList); shader_list->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED); shader_list->set_v_size_flags(Control::SIZE_EXPAND_FILL); + shader_list->set_theme_type_variation("ItemListSecondary"); left_panel->add_child(shader_list); shader_list->connect(SceneStringName(item_selected), callable_mp(this, &ShaderEditorPlugin::_shader_selected)); shader_list->connect("item_clicked", callable_mp(this, &ShaderEditorPlugin::_shader_list_clicked)); diff --git a/editor/plugins/shader_file_editor_plugin.cpp b/editor/plugins/shader_file_editor_plugin.cpp index 4d3d2dd84a..c994ced973 100644 --- a/editor/plugins/shader_file_editor_plugin.cpp +++ b/editor/plugins/shader_file_editor_plugin.cpp @@ -259,6 +259,7 @@ ShaderFileEditor::ShaderFileEditor() { versions->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED); versions->connect(SceneStringName(item_selected), callable_mp(this, &ShaderFileEditor::_version_selected)); versions->set_custom_minimum_size(Size2i(200 * EDSCALE, 0)); + versions->set_theme_type_variation("TreeSecondary"); main_hs->add_child(versions); VBoxContainer *main_vb = memnew(VBoxContainer); diff --git a/editor/plugins/skeleton_3d_editor_plugin.cpp b/editor/plugins/skeleton_3d_editor_plugin.cpp index c4546394f3..2dae5809d2 100644 --- a/editor/plugins/skeleton_3d_editor_plugin.cpp +++ b/editor/plugins/skeleton_3d_editor_plugin.cpp @@ -1105,6 +1105,7 @@ void Skeleton3DEditor::create_editors() { joint_tree->set_v_size_flags(SIZE_EXPAND_FILL); joint_tree->set_h_size_flags(SIZE_EXPAND_FILL); joint_tree->set_allow_rmb_select(true); + joint_tree->set_theme_type_variation("TreeSecondary"); SET_DRAG_FORWARDING_GCD(joint_tree, Skeleton3DEditor); s_con->add_child(joint_tree); diff --git a/editor/plugins/sprite_frames_editor_plugin.cpp b/editor/plugins/sprite_frames_editor_plugin.cpp index b8f3ba764c..16dc13eafe 100644 --- a/editor/plugins/sprite_frames_editor_plugin.cpp +++ b/editor/plugins/sprite_frames_editor_plugin.cpp @@ -1958,6 +1958,7 @@ SpriteFramesEditor::SpriteFramesEditor() { // HACK: The cell_selected signal is emitted before the FPS spinbox loses focus and applies the change. animations->connect("cell_selected", callable_mp(this, &SpriteFramesEditor::_animation_selected), CONNECT_DEFERRED); animations->connect("item_edited", callable_mp(this, &SpriteFramesEditor::_animation_name_edited)); + animations->set_theme_type_variation("TreeSecondary"); animations->set_allow_reselect(true); add_anim->set_shortcut_context(animations); diff --git a/editor/plugins/theme_editor_plugin.cpp b/editor/plugins/theme_editor_plugin.cpp index dd2401b907..2fc20178a6 100644 --- a/editor/plugins/theme_editor_plugin.cpp +++ b/editor/plugins/theme_editor_plugin.cpp @@ -50,6 +50,8 @@ #include "scene/gui/option_button.h" #include "scene/gui/panel_container.h" #include "scene/gui/scroll_container.h" +#include "scene/gui/separator.h" +#include "scene/gui/spin_box.h" #include "scene/gui/split_container.h" #include "scene/gui/tab_bar.h" #include "scene/gui/tab_container.h" @@ -940,6 +942,7 @@ ThemeItemImportTree::ThemeItemImportTree() { import_items_tree->set_column_custom_minimum_width(IMPORT_ITEM_DATA, 80 * EDSCALE); import_items_tree->set_column_clip_content(1, true); import_items_tree->set_column_clip_content(2, true); + import_items_tree->set_theme_type_variation("TreeSecondary"); ScrollContainer *import_bulk_sc = memnew(ScrollContainer); import_bulk_sc->set_custom_minimum_size(Size2(260.0, 0.0) * EDSCALE); @@ -1939,6 +1942,7 @@ ThemeItemEditorDialog::ThemeItemEditorDialog(ThemeTypeEditor *p_theme_type_edito edit_dialog_side_vb->add_child(edit_type_list); edit_type_list->connect(SceneStringName(item_selected), callable_mp(this, &ThemeItemEditorDialog::_edited_type_selected)); edit_type_list->connect("button_clicked", callable_mp(this, &ThemeItemEditorDialog::_edited_type_button_pressed)); + edit_type_list->set_theme_type_variation("TreeSecondary"); Label *edit_add_type_label = memnew(Label); edit_add_type_label->set_text(TTR("Add Type:")); diff --git a/editor/plugins/theme_editor_preview.cpp b/editor/plugins/theme_editor_preview.cpp index d0590dae18..820a6dc3d5 100644 --- a/editor/plugins/theme_editor_preview.cpp +++ b/editor/plugins/theme_editor_preview.cpp @@ -43,9 +43,15 @@ #include "scene/gui/check_button.h" #include "scene/gui/color_picker.h" #include "scene/gui/color_rect.h" +#include "scene/gui/label.h" #include "scene/gui/margin_container.h" +#include "scene/gui/menu_button.h" +#include "scene/gui/option_button.h" +#include "scene/gui/panel.h" #include "scene/gui/progress_bar.h" #include "scene/gui/scroll_container.h" +#include "scene/gui/separator.h" +#include "scene/gui/spin_box.h" #include "scene/gui/tab_container.h" #include "scene/gui/text_edit.h" #include "scene/gui/tree.h" diff --git a/editor/plugins/tiles/atlas_merging_dialog.cpp b/editor/plugins/tiles/atlas_merging_dialog.cpp index 7f6806347a..046a1d108f 100644 --- a/editor/plugins/tiles/atlas_merging_dialog.cpp +++ b/editor/plugins/tiles/atlas_merging_dialog.cpp @@ -320,6 +320,7 @@ AtlasMergingDialog::AtlasMergingDialog() { atlas_merging_atlases_list->set_texture_filter(CanvasItem::TEXTURE_FILTER_NEAREST_WITH_MIPMAPS); atlas_merging_atlases_list->set_custom_minimum_size(Size2(100, 200)); atlas_merging_atlases_list->set_select_mode(ItemList::SELECT_MULTI); + atlas_merging_atlases_list->set_theme_type_variation("ItemListSecondary"); atlas_merging_atlases_list->connect("multi_selected", callable_mp(this, &AtlasMergingDialog::_update_texture).unbind(2)); atlas_merging_h_split_container->add_child(atlas_merging_atlases_list); diff --git a/editor/plugins/tiles/tile_map_layer_editor.cpp b/editor/plugins/tiles/tile_map_layer_editor.cpp index 43800d63c8..8fdebe1325 100644 --- a/editor/plugins/tiles/tile_map_layer_editor.cpp +++ b/editor/plugins/tiles/tile_map_layer_editor.cpp @@ -2417,6 +2417,7 @@ TileMapLayerEditorTilesPlugin::TileMapLayerEditorTilesPlugin() { sources_list->set_stretch_ratio(0.25); sources_list->set_custom_minimum_size(Size2(70, 0) * EDSCALE); sources_list->set_texture_filter(CanvasItem::TEXTURE_FILTER_NEAREST); + sources_list->set_theme_type_variation("ItemListSecondary"); sources_list->connect(SceneStringName(item_selected), callable_mp(this, &TileMapLayerEditorTilesPlugin::_update_source_display).unbind(1)); sources_list->connect(SceneStringName(item_selected), callable_mp(TilesEditorUtils::get_singleton(), &TilesEditorUtils::set_sources_lists_current)); sources_list->connect("item_activated", callable_mp(TilesEditorUtils::get_singleton(), &TilesEditorUtils::display_tile_set_editor_panel).unbind(1)); @@ -3533,6 +3534,7 @@ TileMapLayerEditorTerrainsPlugin::TileMapLayerEditorTerrainsPlugin() { terrains_tree->set_custom_minimum_size(Size2(70, 0) * EDSCALE); terrains_tree->set_texture_filter(CanvasItem::TEXTURE_FILTER_NEAREST); terrains_tree->set_hide_root(true); + terrains_tree->set_theme_type_variation("ItemListSecondary"); terrains_tree->connect(SceneStringName(item_selected), callable_mp(this, &TileMapLayerEditorTerrainsPlugin::_update_tiles_list)); tilemap_tab_terrains->add_child(terrains_tree); diff --git a/editor/plugins/tiles/tile_set_editor.cpp b/editor/plugins/tiles/tile_set_editor.cpp index 72ee8047c2..d66fcbd54c 100644 --- a/editor/plugins/tiles/tile_set_editor.cpp +++ b/editor/plugins/tiles/tile_set_editor.cpp @@ -863,6 +863,7 @@ TileSetEditor::TileSetEditor() { sources_list->set_fixed_icon_size(Size2(60, 60) * EDSCALE); sources_list->set_h_size_flags(SIZE_EXPAND_FILL); sources_list->set_v_size_flags(SIZE_EXPAND_FILL); + sources_list->set_theme_type_variation("ItemListSecondary"); sources_list->connect(SceneStringName(item_selected), callable_mp(this, &TileSetEditor::_source_selected)); sources_list->connect(SceneStringName(item_selected), callable_mp(TilesEditorUtils::get_singleton(), &TilesEditorUtils::set_sources_lists_current)); sources_list->connect(SceneStringName(visibility_changed), callable_mp(TilesEditorUtils::get_singleton(), &TilesEditorUtils::synchronize_sources_list).bind(sources_list, source_sort_button)); @@ -948,6 +949,7 @@ TileSetEditor::TileSetEditor() { patterns_item_list->set_max_text_lines(2); patterns_item_list->set_fixed_icon_size(Size2(thumbnail_size, thumbnail_size)); patterns_item_list->set_v_size_flags(Control::SIZE_EXPAND_FILL); + patterns_item_list->set_theme_type_variation("ItemListSecondary"); patterns_item_list->connect(SceneStringName(gui_input), callable_mp(this, &TileSetEditor::_patterns_item_list_gui_input)); main_vb->add_child(patterns_item_list); patterns_item_list->hide(); diff --git a/editor/plugins/version_control_editor_plugin.cpp b/editor/plugins/version_control_editor_plugin.cpp index dcf66cab9b..7d1bc5fcd6 100644 --- a/editor/plugins/version_control_editor_plugin.cpp +++ b/editor/plugins/version_control_editor_plugin.cpp @@ -1296,6 +1296,7 @@ VersionControlEditorPlugin::VersionControlEditorPlugin() { commit_list->set_columns(2); // Commit msg, author commit_list->set_column_custom_minimum_width(0, 40); commit_list->set_column_custom_minimum_width(1, 20); + commit_list->set_theme_type_variation("TreeSecondary"); commit_list->connect(SceneStringName(item_selected), callable_mp(this, &VersionControlEditorPlugin::_load_diff).bind(commit_list)); version_commit_dock->add_child(commit_list); diff --git a/editor/plugins/visual_shader_editor_plugin.cpp b/editor/plugins/visual_shader_editor_plugin.cpp index f7595769e7..67dc9aadda 100644 --- a/editor/plugins/visual_shader_editor_plugin.cpp +++ b/editor/plugins/visual_shader_editor_plugin.cpp @@ -61,6 +61,7 @@ #include "scene/gui/rich_text_label.h" #include "scene/gui/separator.h" #include "scene/gui/split_container.h" +#include "scene/gui/texture_rect.h" #include "scene/gui/tree.h" #include "scene/gui/view_panner.h" #include "scene/main/window.h" @@ -6678,6 +6679,7 @@ VisualShaderEditor::VisualShaderEditor() { parameters->set_h_size_flags(SIZE_EXPAND_FILL); parameters->set_v_size_flags(SIZE_EXPAND_FILL); parameters->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED); + parameters->set_theme_type_variation("TreeSecondary"); parameters->connect(SceneStringName(item_selected), callable_mp(this, &VisualShaderEditor::_param_selected)); parameters->connect("nothing_selected", callable_mp(this, &VisualShaderEditor::_param_unselected)); sc->add_child(parameters); |