diff options
Diffstat (limited to 'editor/plugins')
| -rw-r--r-- | editor/plugins/node_3d_editor_plugin.cpp | 34 | ||||
| -rw-r--r-- | editor/plugins/node_3d_editor_plugin.h | 2 | ||||
| -rw-r--r-- | editor/plugins/script_text_editor.cpp | 3 | ||||
| -rw-r--r-- | editor/plugins/skeleton_3d_editor_plugin.cpp | 2 | 
4 files changed, 35 insertions, 6 deletions
| diff --git a/editor/plugins/node_3d_editor_plugin.cpp b/editor/plugins/node_3d_editor_plugin.cpp index cbe0133034..3df092bc13 100644 --- a/editor/plugins/node_3d_editor_plugin.cpp +++ b/editor/plugins/node_3d_editor_plugin.cpp @@ -1279,7 +1279,7 @@ void Node3DEditorViewport::_sinput(const Ref<InputEvent> &p_event) {  					clicked = ObjectID();  					clicked_includes_current = false; -					if ((spatial_editor->get_tool_mode() == Node3DEditor::TOOL_MODE_SELECT && b->get_control()) || spatial_editor->get_tool_mode() == Node3DEditor::TOOL_MODE_ROTATE) { +					if ((spatial_editor->get_tool_mode() == Node3DEditor::TOOL_MODE_SELECT && b->get_command()) || spatial_editor->get_tool_mode() == Node3DEditor::TOOL_MODE_ROTATE) {  						/* HANDLE ROTATION */  						if (get_selected_count() == 0) {  							break; //bye @@ -2215,6 +2215,12 @@ void Node3DEditorViewport::scale_cursor_distance(real_t scale) {  		cursor.distance = CLAMP(cursor.distance * scale, min_distance, max_distance);  	} +	if (cursor.distance == max_distance || cursor.distance == min_distance) { +		zoom_failed_attempts_count++; +	} else { +		zoom_failed_attempts_count = 0; +	} +  	zoom_indicator_delay = ZOOM_FREELOOK_INDICATOR_DELAY_S;  	surface->update();  } @@ -2396,6 +2402,7 @@ void Node3DEditorViewport::_notification(int p_what) {  			zoom_indicator_delay -= delta;  			if (zoom_indicator_delay <= 0) {  				surface->update(); +				zoom_limit_label->hide();  			}  		} @@ -2535,6 +2542,8 @@ void Node3DEditorViewport::_notification(int p_what) {  				cpu_time += cpu_time_history[i];  			}  			cpu_time /= FRAME_TIME_HISTORY; +			// Prevent unrealistically low values. +			cpu_time = MAX(0.01, cpu_time);  			gpu_time_history[gpu_time_history_index] = RS::get_singleton()->viewport_get_measured_render_time_gpu(viewport->get_viewport_rid());  			gpu_time_history_index = (gpu_time_history_index + 1) % FRAME_TIME_HISTORY; @@ -2543,16 +2552,19 @@ void Node3DEditorViewport::_notification(int p_what) {  				gpu_time += gpu_time_history[i];  			}  			gpu_time /= FRAME_TIME_HISTORY; +			// Prevent division by zero for the FPS counter (and unrealistically low values). +			// This limits the reported FPS to 100000. +			gpu_time = MAX(0.01, gpu_time);  			// Color labels depending on performance level ("good" = green, "OK" = yellow, "bad" = red).  			// Middle point is at 15 ms. -			cpu_time_label->set_text(vformat(TTR("CPU Time: %s ms"), String::num(cpu_time, 1))); +			cpu_time_label->set_text(vformat(TTR("CPU Time: %s ms"), rtos(cpu_time).pad_decimals(1)));  			cpu_time_label->add_theme_color_override(  					"font_color",  					frame_time_gradient->get_color_at_offset(  							Math::range_lerp(cpu_time, 0, 30, 0, 1))); -			gpu_time_label->set_text(vformat(TTR("GPU Time: %s ms"), String::num(gpu_time, 1))); +			gpu_time_label->set_text(vformat(TTR("GPU Time: %s ms"), rtos(gpu_time).pad_decimals(1)));  			// Middle point is at 15 ms.  			gpu_time_label->add_theme_color_override(  					"font_color", @@ -2770,6 +2782,7 @@ void Node3DEditorViewport::_draw() {  			} else {  				// Show zoom +				zoom_limit_label->set_visible(zoom_failed_attempts_count > 15);  				real_t min_distance = MAX(camera->get_near() * 4, ZOOM_FREELOOK_MIN);  				real_t max_distance = MIN(camera->get_far() / 4, ZOOM_FREELOOK_MAX); @@ -3647,9 +3660,9 @@ Vector3 Node3DEditorViewport::_get_instance_position(const Point2 &p_pos) const  AABB Node3DEditorViewport::_calculate_spatial_bounds(const Node3D *p_parent, bool p_exclude_top_level_transform) {  	AABB bounds; -	const MeshInstance3D *mesh_instance = Object::cast_to<MeshInstance3D>(p_parent); -	if (mesh_instance) { -		bounds = mesh_instance->get_aabb(); +	const VisualInstance3D *visual_instance = Object::cast_to<VisualInstance3D>(p_parent); +	if (visual_instance) { +		bounds = visual_instance->get_aabb();  	}  	for (int i = 0; i < p_parent->get_child_count(); i++) { @@ -4132,6 +4145,15 @@ Node3DEditorViewport::Node3DEditorViewport(Node3DEditor *p_spatial_editor, Edito  	locked_label->set_text(TTR("View Rotation Locked"));  	locked_label->hide(); +	zoom_limit_label = memnew(Label); +	zoom_limit_label->set_anchors_and_offsets_preset(LayoutPreset::PRESET_BOTTOM_LEFT); +	zoom_limit_label->set_offset(Side::SIDE_TOP, -28 * EDSCALE); +	zoom_limit_label->set_text(TTR("To zoom further, change the camera's clipping planes (View -> Settings...)")); +	zoom_limit_label->set_name("ZoomLimitMessageLabel"); +	zoom_limit_label->add_theme_color_override("font_color", Color(1, 1, 1, 1)); +	zoom_limit_label->hide(); +	surface->add_child(zoom_limit_label); +  	frame_time_gradient = memnew(Gradient);  	// The color is set when the theme changes.  	frame_time_gradient->add_point(0.5, Color()); diff --git a/editor/plugins/node_3d_editor_plugin.h b/editor/plugins/node_3d_editor_plugin.h index ff4a941b06..70329f90c7 100644 --- a/editor/plugins/node_3d_editor_plugin.h +++ b/editor/plugins/node_3d_editor_plugin.h @@ -295,6 +295,7 @@ private:  	Label *info_label;  	Label *cinema_label;  	Label *locked_label; +	Label *zoom_limit_label;  	VBoxContainer *top_right_vbox;  	ViewportRotationControl *rotation_control; @@ -418,6 +419,7 @@ private:  	void scale_freelook_speed(real_t scale);  	real_t zoom_indicator_delay; +	int zoom_failed_attempts_count = 0;  	RID move_gizmo_instance[3], move_plane_gizmo_instance[3], rotate_gizmo_instance[4], scale_gizmo_instance[3], scale_plane_gizmo_instance[3]; diff --git a/editor/plugins/script_text_editor.cpp b/editor/plugins/script_text_editor.cpp index 3534809891..c982207224 100644 --- a/editor/plugins/script_text_editor.cpp +++ b/editor/plugins/script_text_editor.cpp @@ -1721,6 +1721,9 @@ void ScriptTextEditor::_enable_code_editor() {  		color_picker->set_raw_mode(true);  	} +	int picker_shape = EDITOR_GET("interface/inspector/default_color_picker_shape"); +	color_picker->set_picker_shape((ColorPicker::PickerShapeType)picker_shape); +  	quick_open = memnew(ScriptEditorQuickOpen);  	quick_open->connect("goto_line", callable_mp(this, &ScriptTextEditor::_goto_line));  	add_child(quick_open); diff --git a/editor/plugins/skeleton_3d_editor_plugin.cpp b/editor/plugins/skeleton_3d_editor_plugin.cpp index ad60984ad1..404ef62eca 100644 --- a/editor/plugins/skeleton_3d_editor_plugin.cpp +++ b/editor/plugins/skeleton_3d_editor_plugin.cpp @@ -515,6 +515,8 @@ void Skeleton3DEditor::_joint_tree_selection_changed() {  		rest_editor->set_target(bone_path + "rest");  		custom_pose_editor->set_target(bone_path + "custom_pose"); +		_update_properties(); +  		pose_editor->set_visible(true);  		rest_editor->set_visible(true);  		custom_pose_editor->set_visible(true); |