diff options
-rw-r--r-- | doc/classes/Viewport.xml | 4 | ||||
-rw-r--r-- | editor/code_editor.cpp | 2 | ||||
-rw-r--r-- | editor/plugins/animation_blend_tree_editor_plugin.cpp | 2 | ||||
-rw-r--r-- | editor/plugins/canvas_item_editor_plugin.cpp | 2 | ||||
-rw-r--r-- | editor/plugins/gpu_particles_2d_editor_plugin.cpp | 22 | ||||
-rw-r--r-- | editor/plugins/gpu_particles_2d_editor_plugin.h | 2 | ||||
-rw-r--r-- | editor/plugins/node_3d_editor_gizmos.cpp | 2 | ||||
-rw-r--r-- | editor/plugins/node_3d_editor_plugin.cpp | 2 | ||||
-rw-r--r-- | scene/2d/camera_2d.cpp | 2 | ||||
-rw-r--r-- | scene/2d/gpu_particles_2d.cpp | 12 | ||||
-rw-r--r-- | scene/2d/gpu_particles_2d.h | 9 | ||||
-rw-r--r-- | scene/debugger/scene_debugger.cpp | 2 | ||||
-rw-r--r-- | scene/main/viewport.cpp | 6 | ||||
-rw-r--r-- | servers/rendering/shader_types.cpp | 2 |
14 files changed, 54 insertions, 17 deletions
diff --git a/doc/classes/Viewport.xml b/doc/classes/Viewport.xml index 0418f29808..4a3f99696d 100644 --- a/doc/classes/Viewport.xml +++ b/doc/classes/Viewport.xml @@ -25,13 +25,13 @@ <method name="find_world_2d" qualifiers="const"> <return type="World2D" /> <description> - Returns the 2D world of the viewport. + Returns the first valid [World2D] for this viewport, searching the [member world_2d] property of itself and any Viewport ancestor. </description> </method> <method name="find_world_3d" qualifiers="const"> <return type="World3D" /> <description> - Returns the 3D world of the viewport, or if none the world of the parent viewport. + Returns the first valid [World3D] for this viewport, searching the [member world_3d] property of itself and any Viewport ancestor. </description> </method> <method name="get_camera_2d" qualifiers="const"> diff --git a/editor/code_editor.cpp b/editor/code_editor.cpp index bfcd2dd4ca..1f01e9d4cf 100644 --- a/editor/code_editor.cpp +++ b/editor/code_editor.cpp @@ -1314,10 +1314,10 @@ void CodeTextEditor::delete_lines() { int count = Math::abs(to_line - from_line) + 1; text_editor->set_caret_line(from_line, false); + text_editor->deselect(); for (int i = 0; i < count; i++) { _delete_line(from_line); } - text_editor->deselect(); } else { _delete_line(text_editor->get_caret_line()); } diff --git a/editor/plugins/animation_blend_tree_editor_plugin.cpp b/editor/plugins/animation_blend_tree_editor_plugin.cpp index 75d2bed1b2..c4a938f91d 100644 --- a/editor/plugins/animation_blend_tree_editor_plugin.cpp +++ b/editor/plugins/animation_blend_tree_editor_plugin.cpp @@ -945,7 +945,7 @@ AnimationNodeBlendTreeEditor::AnimationNodeBlendTreeEditor() { add_node->set_text(TTR("Add Node...")); graph->get_zoom_hbox()->move_child(add_node, 0); add_node->get_popup()->connect("id_pressed", callable_mp(this, &AnimationNodeBlendTreeEditor::_add_node)); - add_node->connect("about_to_popup", callable_mp(this, &AnimationNodeBlendTreeEditor::_update_options_menu)); + add_node->connect("about_to_popup", callable_mp(this, &AnimationNodeBlendTreeEditor::_update_options_menu), varray(false)); add_options.push_back(AddOption("Animation", "AnimationNodeAnimation")); add_options.push_back(AddOption("OneShot", "AnimationNodeOneShot", 2)); diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp index a3378d1550..b6722b9d48 100644 --- a/editor/plugins/canvas_item_editor_plugin.cpp +++ b/editor/plugins/canvas_item_editor_plugin.cpp @@ -2339,7 +2339,7 @@ bool CanvasItemEditor::_gui_input_select(const Ref<InputEvent> &p_event) { if (selection2.size() > 0) { drag_type = DRAG_MOVE; - drag_from = click; + drag_from = drag_start_origin; _save_canvas_item_state(drag_selection); } return true; diff --git a/editor/plugins/gpu_particles_2d_editor_plugin.cpp b/editor/plugins/gpu_particles_2d_editor_plugin.cpp index 44c789b145..4b50f484a4 100644 --- a/editor/plugins/gpu_particles_2d_editor_plugin.cpp +++ b/editor/plugins/gpu_particles_2d_editor_plugin.cpp @@ -57,6 +57,27 @@ void GPUParticles2DEditorPlugin::_file_selected(const String &p_file) { emission_mask->popup_centered(); } +void GPUParticles2DEditorPlugin::_selection_changed() { + List<Node *> selected_nodes = editor->get_editor_selection()->get_selected_node_list(); + + if (selected_particles.is_empty() && selected_nodes.is_empty()) { + return; + } + + for (GPUParticles2D *SP : selected_particles) { + SP->set_show_visibility_rect(false); + } + selected_particles.clear(); + + for (Node *P : selected_nodes) { + GPUParticles2D *selected_particle = Object::cast_to<GPUParticles2D>(P); + if (selected_particle != nullptr) { + selected_particle->set_show_visibility_rect(true); + selected_particles.push_back(selected_particle); + } + } +} + void GPUParticles2DEditorPlugin::_menu_callback(int p_idx) { switch (p_idx) { case MENU_GENERATE_VISIBILITY_RECT: { @@ -334,6 +355,7 @@ void GPUParticles2DEditorPlugin::_notification(int p_what) { menu->get_popup()->connect("id_pressed", callable_mp(this, &GPUParticles2DEditorPlugin::_menu_callback)); menu->set_icon(menu->get_theme_icon(SNAME("GPUParticles2D"), SNAME("EditorIcons"))); file->connect("file_selected", callable_mp(this, &GPUParticles2DEditorPlugin::_file_selected)); + EditorNode::get_singleton()->get_editor_selection()->connect("selection_changed", callable_mp(this, &GPUParticles2DEditorPlugin::_selection_changed)); } } diff --git a/editor/plugins/gpu_particles_2d_editor_plugin.h b/editor/plugins/gpu_particles_2d_editor_plugin.h index 0b2028b745..bdfc021aa7 100644 --- a/editor/plugins/gpu_particles_2d_editor_plugin.h +++ b/editor/plugins/gpu_particles_2d_editor_plugin.h @@ -56,6 +56,7 @@ class GPUParticles2DEditorPlugin : public EditorPlugin { }; GPUParticles2D *particles; + List<GPUParticles2D *> selected_particles; EditorFileDialog *file; EditorNode *editor; @@ -79,6 +80,7 @@ class GPUParticles2DEditorPlugin : public EditorPlugin { void _menu_callback(int p_idx); void _generate_visibility_rect(); void _generate_emission_mask(); + void _selection_changed(); protected: void _notification(int p_what); diff --git a/editor/plugins/node_3d_editor_gizmos.cpp b/editor/plugins/node_3d_editor_gizmos.cpp index 74fbef3caf..154f9bd6b7 100644 --- a/editor/plugins/node_3d_editor_gizmos.cpp +++ b/editor/plugins/node_3d_editor_gizmos.cpp @@ -2579,7 +2579,7 @@ void CPUParticles3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) { GPUParticles3DGizmoPlugin::GPUParticles3DGizmoPlugin() { Color gizmo_color = EDITOR_DEF("editors/3d_gizmos/gizmo_colors/particles", Color(0.8, 0.7, 0.4)); create_material("particles_material", gizmo_color); - gizmo_color.a = 0.1; + gizmo_color.a = MAX((gizmo_color.a - 0.2) * 0.02, 0.0); create_material("particles_solid_material", gizmo_color); create_icon_material("particles_icon", Node3DEditor::get_singleton()->get_theme_icon(SNAME("GizmoGPUParticles3D"), SNAME("EditorIcons"))); create_handle_material("handles"); diff --git a/editor/plugins/node_3d_editor_plugin.cpp b/editor/plugins/node_3d_editor_plugin.cpp index d3b462cda5..0a8cfa3815 100644 --- a/editor/plugins/node_3d_editor_plugin.cpp +++ b/editor/plugins/node_3d_editor_plugin.cpp @@ -1749,7 +1749,7 @@ void Node3DEditorViewport::_sinput(const Ref<InputEvent> &p_event) { } else { const bool movement_threshold_passed = _edit.original_mouse_pos.distance_to(_edit.mouse_pos) > 8 * EDSCALE; if (clicked.is_valid() && movement_threshold_passed) { - _compute_edit(_edit.mouse_pos); + _compute_edit(_edit.original_mouse_pos); clicked = ObjectID(); _edit.mode = TRANSFORM_TRANSLATE; diff --git a/scene/2d/camera_2d.cpp b/scene/2d/camera_2d.cpp index bf5671be19..b6902686fe 100644 --- a/scene/2d/camera_2d.cpp +++ b/scene/2d/camera_2d.cpp @@ -176,7 +176,7 @@ Transform2D Camera2D::get_camera_transform() { Rect2 screen_rect(-screen_offset + ret_camera_pos, screen_size * zoom); - if (!limit_smoothing_enabled) { + if (!smoothing_enabled || !limit_smoothing_enabled) { if (screen_rect.position.x < limit[SIDE_LEFT]) { screen_rect.position.x = limit[SIDE_LEFT]; } diff --git a/scene/2d/gpu_particles_2d.cpp b/scene/2d/gpu_particles_2d.cpp index f1f4d1b769..4384ec8141 100644 --- a/scene/2d/gpu_particles_2d.cpp +++ b/scene/2d/gpu_particles_2d.cpp @@ -170,6 +170,13 @@ void GPUParticles2D::set_trail_section_subdivisions(int p_subdivisions) { update(); } +#ifdef TOOLS_ENABLED +void GPUParticles2D::set_show_visibility_rect(bool p_show_visibility_rect) { + show_visibility_rect = p_show_visibility_rect; + update(); +} +#endif + bool GPUParticles2D::is_trail_enabled() const { return trail_enabled; } @@ -452,7 +459,7 @@ void GPUParticles2D::_notification(int p_what) { RS::get_singleton()->canvas_item_add_particles(get_canvas_item(), particles, texture_rid); #ifdef TOOLS_ENABLED - if (Engine::get_singleton()->is_editor_hint() && (this == get_tree()->get_edited_scene_root() || get_tree()->get_edited_scene_root()->is_ancestor_of(this))) { + if (show_visibility_rect) { draw_rect(visibility_rect, Color(0, 0.7, 0.9, 0.4), false); } #endif @@ -588,6 +595,9 @@ GPUParticles2D::GPUParticles2D() { set_speed_scale(1); set_fixed_fps(30); set_collision_base_size(collision_base_size); +#ifdef TOOLS_ENABLED + show_visibility_rect = false; +#endif } GPUParticles2D::~GPUParticles2D() { diff --git a/scene/2d/gpu_particles_2d.h b/scene/2d/gpu_particles_2d.h index d7eee461b4..a9e66b3051 100644 --- a/scene/2d/gpu_particles_2d.h +++ b/scene/2d/gpu_particles_2d.h @@ -58,7 +58,9 @@ private: bool local_coords; int fixed_fps; bool fractional_delta; - +#ifdef TOOLS_ENABLED + bool show_visibility_rect; +#endif Ref<Material> process_material; DrawOrder draw_order; @@ -81,7 +83,6 @@ protected: static void _bind_methods(); virtual void _validate_property(PropertyInfo &property) const override; void _notification(int p_what); - void _update_collision_size(); public: @@ -102,6 +103,10 @@ public: void set_trail_sections(int p_sections); void set_trail_section_subdivisions(int p_subdivisions); +#ifdef TOOLS_ENABLED + void set_show_visibility_rect(bool p_show_visibility_rect); +#endif + bool is_emitting() const; int get_amount() const; double get_lifetime() const; diff --git a/scene/debugger/scene_debugger.cpp b/scene/debugger/scene_debugger.cpp index 3c8949ddfb..56c04b32e3 100644 --- a/scene/debugger/scene_debugger.cpp +++ b/scene/debugger/scene_debugger.cpp @@ -367,7 +367,7 @@ void SceneDebuggerObject::serialize(Array &r_arr, int p_max_size) { PropertyHint hint = pi.hint; String hint_string = pi.hint_string; - if (!res.is_null()) { + if (!res.is_null() && !res->get_path().is_empty()) { var = res->get_path(); } else { //only send information that can be sent.. int len = 0; //test how big is this to encode diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp index f9e96a0784..621d5f765b 100644 --- a/scene/main/viewport.cpp +++ b/scene/main/viewport.cpp @@ -1707,12 +1707,10 @@ void Viewport::_gui_input_event(Ref<InputEvent> p_event) { if (mm->get_button_mask() == MouseButton::NONE) { // Nothing pressed. - bool can_tooltip = true; - bool is_tooltip_shown = false; if (gui.tooltip_popup) { - if (can_tooltip && gui.tooltip_control) { + if (gui.tooltip_control) { String tooltip = _gui_get_tooltip(over, gui.tooltip_control->get_global_transform().xform_inv(mpos)); if (tooltip.length() == 0) { @@ -1737,7 +1735,7 @@ void Viewport::_gui_input_event(Ref<InputEvent> p_event) { } } - if (can_tooltip && !is_tooltip_shown) { + if (!is_tooltip_shown && over->can_process()) { if (gui.tooltip_timer.is_valid()) { gui.tooltip_timer->release_connections(); gui.tooltip_timer = Ref<SceneTreeTimer>(); diff --git a/servers/rendering/shader_types.cpp b/servers/rendering/shader_types.cpp index eb5c9e66e8..10786555db 100644 --- a/servers/rendering/shader_types.cpp +++ b/servers/rendering/shader_types.cpp @@ -367,7 +367,7 @@ ShaderTypes::ShaderTypes() { shader_modes[RS::SHADER_PARTICLES].functions["process"].built_ins["LIFETIME"] = constt(ShaderLanguage::TYPE_FLOAT); shader_modes[RS::SHADER_PARTICLES].functions["process"].built_ins["DELTA"] = constt(ShaderLanguage::TYPE_FLOAT); shader_modes[RS::SHADER_PARTICLES].functions["process"].built_ins["NUMBER"] = constt(ShaderLanguage::TYPE_UINT); - shader_modes[RS::SHADER_PARTICLES].functions["process"].built_ins["INDEX"] = constt(ShaderLanguage::TYPE_INT); + shader_modes[RS::SHADER_PARTICLES].functions["process"].built_ins["INDEX"] = constt(ShaderLanguage::TYPE_UINT); shader_modes[RS::SHADER_PARTICLES].functions["process"].built_ins["EMISSION_TRANSFORM"] = constt(ShaderLanguage::TYPE_MAT4); shader_modes[RS::SHADER_PARTICLES].functions["process"].built_ins["RANDOM_SEED"] = constt(ShaderLanguage::TYPE_UINT); shader_modes[RS::SHADER_PARTICLES].functions["process"].built_ins["FLAG_EMIT_POSITION"] = constt(ShaderLanguage::TYPE_UINT); |