summaryrefslogtreecommitdiff
path: root/editor
diff options
context:
space:
mode:
Diffstat (limited to 'editor')
-rw-r--r--editor/editor_log.cpp64
-rw-r--r--editor/editor_log.h2
-rw-r--r--editor/node_3d_editor_gizmos.cpp4
-rw-r--r--editor/plugins/node_3d_editor_plugin.cpp2
-rw-r--r--editor/plugins/path_2d_editor_plugin.cpp2
5 files changed, 42 insertions, 32 deletions
diff --git a/editor/editor_log.cpp b/editor/editor_log.cpp
index 6de7f6c425..2cb73664f5 100644
--- a/editor/editor_log.cpp
+++ b/editor/editor_log.cpp
@@ -57,35 +57,43 @@ void EditorLog::_error_handler(void *p_self, const char *p_func, const char *p_f
}
}
+void EditorLog::_update_theme() {
+ Ref<Font> normal_font = get_theme_font(SNAME("output_source"), SNAME("EditorFonts"));
+ if (normal_font.is_valid()) {
+ log->add_theme_font_override("normal_font", normal_font);
+ }
+
+ log->add_theme_font_size_override("normal_font_size", get_theme_font_size(SNAME("output_source_size"), SNAME("EditorFonts")));
+ log->add_theme_color_override("selection_color", get_theme_color(SNAME("accent_color"), SNAME("Editor")) * Color(1, 1, 1, 0.4));
+
+ Ref<Font> bold_font = get_theme_font(SNAME("bold"), SNAME("EditorFonts"));
+ if (bold_font.is_valid()) {
+ log->add_theme_font_override("bold_font", bold_font);
+ }
+
+ type_filter_map[MSG_TYPE_STD]->toggle_button->set_icon(get_theme_icon(SNAME("Popup"), SNAME("EditorIcons")));
+ type_filter_map[MSG_TYPE_ERROR]->toggle_button->set_icon(get_theme_icon(SNAME("StatusError"), SNAME("EditorIcons")));
+ type_filter_map[MSG_TYPE_WARNING]->toggle_button->set_icon(get_theme_icon(SNAME("StatusWarning"), SNAME("EditorIcons")));
+ type_filter_map[MSG_TYPE_EDITOR]->toggle_button->set_icon(get_theme_icon(SNAME("Edit"), SNAME("EditorIcons")));
+
+ clear_button->set_icon(get_theme_icon(SNAME("Clear"), SNAME("EditorIcons")));
+ copy_button->set_icon(get_theme_icon(SNAME("ActionCopy"), SNAME("EditorIcons")));
+ collapse_button->set_icon(get_theme_icon(SNAME("CombineLines"), SNAME("EditorIcons")));
+ show_search_button->set_icon(get_theme_icon(SNAME("Search"), SNAME("EditorIcons")));
+}
+
void EditorLog::_notification(int p_what) {
- if (p_what == NOTIFICATION_ENTER_TREE) {
- //button->set_icon(get_icon("Console","EditorIcons"));
- log->add_theme_font_override("normal_font", get_theme_font(SNAME("output_source"), SNAME("EditorFonts")));
- log->add_theme_font_size_override("normal_font_size", get_theme_font_size(SNAME("output_source_size"), SNAME("EditorFonts")));
- log->add_theme_color_override("selection_color", get_theme_color(SNAME("accent_color"), SNAME("Editor")) * Color(1, 1, 1, 0.4));
- log->add_theme_font_override("bold_font", get_theme_font(SNAME("bold"), SNAME("EditorFonts")));
-
- type_filter_map[MSG_TYPE_STD]->toggle_button->set_icon(get_theme_icon(SNAME("Popup"), SNAME("EditorIcons")));
- type_filter_map[MSG_TYPE_ERROR]->toggle_button->set_icon(get_theme_icon(SNAME("StatusError"), SNAME("EditorIcons")));
- type_filter_map[MSG_TYPE_WARNING]->toggle_button->set_icon(get_theme_icon(SNAME("StatusWarning"), SNAME("EditorIcons")));
- type_filter_map[MSG_TYPE_EDITOR]->toggle_button->set_icon(get_theme_icon(SNAME("Edit"), SNAME("EditorIcons")));
-
- clear_button->set_icon(get_theme_icon(SNAME("Clear"), SNAME("EditorIcons")));
- copy_button->set_icon(get_theme_icon(SNAME("ActionCopy"), SNAME("EditorIcons")));
- collapse_button->set_icon(get_theme_icon(SNAME("CombineLines"), SNAME("EditorIcons")));
- show_search_button->set_icon(get_theme_icon(SNAME("Search"), SNAME("EditorIcons")));
-
- _load_state();
-
- } else if (p_what == NOTIFICATION_THEME_CHANGED) {
- Ref<Font> df_output_code = get_theme_font(SNAME("output_source"), SNAME("EditorFonts"));
- if (df_output_code.is_valid()) {
- if (log != nullptr) {
- log->add_theme_font_override("normal_font", get_theme_font(SNAME("output_source"), SNAME("EditorFonts")));
- log->add_theme_font_size_override("normal_font_size", get_theme_font_size(SNAME("output_source_size"), SNAME("EditorFonts")));
- log->add_theme_color_override("selection_color", get_theme_color(SNAME("accent_color"), SNAME("Editor")) * Color(1, 1, 1, 0.4));
- }
- }
+ switch (p_what) {
+ case NOTIFICATION_ENTER_TREE: {
+ _update_theme();
+ _load_state();
+ } break;
+ case NOTIFICATION_THEME_CHANGED: {
+ _update_theme();
+ _rebuild_log();
+ } break;
+ default:
+ break;
}
}
diff --git a/editor/editor_log.h b/editor/editor_log.h
index 3b6476634a..6cbf4bedee 100644
--- a/editor/editor_log.h
+++ b/editor/editor_log.h
@@ -163,6 +163,8 @@ private:
void _save_state();
void _load_state();
+ void _update_theme();
+
protected:
static void _bind_methods();
void _notification(int p_what);
diff --git a/editor/node_3d_editor_gizmos.cpp b/editor/node_3d_editor_gizmos.cpp
index 2e85e19732..74fb38b66b 100644
--- a/editor/node_3d_editor_gizmos.cpp
+++ b/editor/node_3d_editor_gizmos.cpp
@@ -562,7 +562,7 @@ bool EditorNode3DGizmo::intersect_ray(Camera3D *p_camera, const Point2 &p_point,
if (selectable_icon_size > 0.0f) {
Transform3D t = spatial_node->get_global_transform();
Vector3 camera_position = p_camera->get_camera_transform().origin;
- if (camera_position.distance_squared_to(t.origin) > 0.01) {
+ if (!camera_position.is_equal_approx(t.origin)) {
t.set_look_at(t.origin, camera_position);
}
@@ -578,7 +578,7 @@ bool EditorNode3DGizmo::intersect_ray(Camera3D *p_camera, const Point2 &p_point,
Transform3D orig_camera_transform = p_camera->get_camera_transform();
- if (orig_camera_transform.origin.distance_squared_to(t.origin) > 0.01 &&
+ if (!orig_camera_transform.origin.is_equal_approx(t.origin) &&
ABS(orig_camera_transform.basis.get_axis(Vector3::AXIS_Z).dot(Vector3(0, 1, 0))) < 0.99) {
p_camera->look_at(t.origin);
}
diff --git a/editor/plugins/node_3d_editor_plugin.cpp b/editor/plugins/node_3d_editor_plugin.cpp
index a0884a81cd..7290a39463 100644
--- a/editor/plugins/node_3d_editor_plugin.cpp
+++ b/editor/plugins/node_3d_editor_plugin.cpp
@@ -3338,7 +3338,7 @@ void Node3DEditorViewport::update_transform_gizmo_view() {
Transform3D camera_xform = camera->get_transform();
- if (xform.origin.distance_squared_to(camera_xform.origin) < 0.01) {
+ if (xform.origin.is_equal_approx(camera_xform.origin)) {
for (int i = 0; i < 3; i++) {
RenderingServer::get_singleton()->instance_set_visible(move_gizmo_instance[i], false);
RenderingServer::get_singleton()->instance_set_visible(move_plane_gizmo_instance[i], false);
diff --git a/editor/plugins/path_2d_editor_plugin.cpp b/editor/plugins/path_2d_editor_plugin.cpp
index 8861fee7a6..8866e8c53e 100644
--- a/editor/plugins/path_2d_editor_plugin.cpp
+++ b/editor/plugins/path_2d_editor_plugin.cpp
@@ -481,7 +481,7 @@ void Path2DEditor::_mode_selected(int p_mode) {
Vector2 begin = node->get_curve()->get_point_position(0);
Vector2 end = node->get_curve()->get_point_position(node->get_curve()->get_point_count() - 1);
- if (begin.distance_to(end) < CMP_EPSILON) {
+ if (begin.is_equal_approx(end)) {
return;
}