summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--editor/editor_themes.cpp6
-rw-r--r--editor/plugins/spatial_editor_plugin.cpp63
-rw-r--r--editor/plugins/spatial_editor_plugin.h4
-rw-r--r--platform/android/detect.py2
-rw-r--r--scene/3d/baked_lightmap.cpp6
-rw-r--r--scene/3d/voxel_light_baker.cpp8
6 files changed, 40 insertions, 49 deletions
diff --git a/editor/editor_themes.cpp b/editor/editor_themes.cpp
index 152eda7d91..cc0b292cc4 100644
--- a/editor/editor_themes.cpp
+++ b/editor/editor_themes.cpp
@@ -999,6 +999,12 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
theme->set_icon("bg", "ColorPickerButton", theme->get_icon("GuiMiniCheckerboard", "EditorIcons"));
+ // Information on 3D viewport
+ Ref<StyleBoxFlat> style_info_3d_viewport = style_default->duplicate();
+ style_info_3d_viewport->set_bg_color(style_info_3d_viewport->get_bg_color() * Color(1, 1, 1, 0.5));
+ style_info_3d_viewport->set_border_width_all(0);
+ theme->set_stylebox("Information3dViewport", "EditorStyles", style_info_3d_viewport);
+
// adaptive script theme constants
// for comments and elements with lower relevance
const Color dim_color = Color(font_color.r, font_color.g, font_color.b, 0.5);
diff --git a/editor/plugins/spatial_editor_plugin.cpp b/editor/plugins/spatial_editor_plugin.cpp
index 0f27310264..59da5112ae 100644
--- a/editor/plugins/spatial_editor_plugin.cpp
+++ b/editor/plugins/spatial_editor_plugin.cpp
@@ -2219,15 +2219,9 @@ void SpatialEditorViewport::_notification(int p_what) {
viewport->set_hdr(hdr);
bool show_info = view_menu->get_popup()->is_item_checked(view_menu->get_popup()->get_item_index(VIEW_INFORMATION));
- if (show_info != info->is_visible()) {
- if (show_info)
- info->show();
- else
- info->hide();
- }
+ info_label->set_visible(show_info);
if (show_info) {
-
String text;
text += TTR("Objects Drawn") + ": " + itos(viewport->get_render_info(Viewport::RENDER_INFO_OBJECTS_IN_FRAME)) + "\n";
text += TTR("Material Changes") + ": " + itos(viewport->get_render_info(Viewport::RENDER_INFO_MATERIAL_CHANGES_IN_FRAME)) + "\n";
@@ -2235,38 +2229,19 @@ void SpatialEditorViewport::_notification(int p_what) {
text += TTR("Surface Changes") + ": " + itos(viewport->get_render_info(Viewport::RENDER_INFO_SURFACE_CHANGES_IN_FRAME)) + "\n";
text += TTR("Draw Calls") + ": " + itos(viewport->get_render_info(Viewport::RENDER_INFO_DRAW_CALLS_IN_FRAME)) + "\n";
text += TTR("Vertices") + ": " + itos(viewport->get_render_info(Viewport::RENDER_INFO_VERTICES_IN_FRAME));
-
- if (info_label->get_text() != text || surface->get_size() != prev_size) {
- info_label->set_text(text);
- Size2 ms = info->get_minimum_size();
- info->set_position(surface->get_size() - ms - Vector2(20, 20) * EDSCALE);
- }
+ info_label->set_text(text);
}
// FPS Counter.
bool show_fps = view_menu->get_popup()->is_item_checked(view_menu->get_popup()->get_item_index(VIEW_FPS));
- if (show_fps != fps->is_visible()) {
- if (show_fps)
- fps->show();
- else
- fps->hide();
- }
+ fps_label->set_visible(show_fps);
if (show_fps) {
String text;
const float temp_fps = Engine::get_singleton()->get_frames_per_second();
text += TTR("FPS") + ": " + itos(temp_fps) + " (" + String::num(1000.0f / temp_fps, 2) + " ms)";
-
- if (fps_label->get_text() != text || surface->get_size() != prev_size) {
- fps_label->set_text(text);
- Size2 ms = fps->get_size();
- Size2 size = surface->get_size();
- size.y = ms.y + 20;
- fps->set_position(size - ms - Vector2(20, 0) * EDSCALE);
- }
+ fps_label->set_text(text);
}
-
- prev_size = surface->get_size();
}
if (p_what == NOTIFICATION_ENTER_TREE) {
@@ -2275,8 +2250,8 @@ void SpatialEditorViewport::_notification(int p_what) {
surface->connect("gui_input", this, "_sinput");
surface->connect("mouse_entered", this, "_smouseenter");
surface->connect("mouse_exited", this, "_smouseexit");
- info->add_style_override("panel", get_stylebox("panel", "Panel"));
- fps->add_style_override("panel", get_stylebox("panel", "Panel"));
+ info_label->add_style_override("normal", editor->get_gui_base()->get_stylebox("Information3dViewport", "EditorStyles"));
+ fps_label->add_style_override("normal", editor->get_gui_base()->get_stylebox("Information3dViewport", "EditorStyles"));
preview_camera->set_icon(get_icon("Camera", "EditorIcons"));
_init_gizmo_instance(index);
}
@@ -2773,8 +2748,10 @@ void SpatialEditorViewport::set_can_preview(Camera *p_preview) {
if (!preview_camera->is_pressed()) {
if (p_preview) {
+ fps_label->set_anchor_and_margin(MARGIN_TOP, ANCHOR_BEGIN, 15 * EDSCALE + preview_camera->get_size().height);
preview_camera->show();
} else {
+ fps_label->set_anchor_and_margin(MARGIN_TOP, ANCHOR_BEGIN, 10 * EDSCALE);
preview_camera->hide();
}
}
@@ -3399,20 +3376,24 @@ SpatialEditorViewport::SpatialEditorViewport(SpatialEditor *p_spatial_editor, Ed
preview_node = NULL;
- info = memnew(PanelContainer);
- info->set_self_modulate(Color(1, 1, 1, 0.4));
- surface->add_child(info);
info_label = memnew(Label);
- info->add_child(info_label);
- info->hide();
+ info_label->set_anchor_and_margin(MARGIN_LEFT, ANCHOR_END, -90 * EDSCALE);
+ info_label->set_anchor_and_margin(MARGIN_TOP, ANCHOR_END, -90 * EDSCALE);
+ info_label->set_anchor_and_margin(MARGIN_RIGHT, ANCHOR_END, -10 * EDSCALE);
+ info_label->set_anchor_and_margin(MARGIN_BOTTOM, ANCHOR_END, -10 * EDSCALE);
+ info_label->set_h_grow_direction(GROW_DIRECTION_BEGIN);
+ info_label->set_v_grow_direction(GROW_DIRECTION_BEGIN);
+ surface->add_child(info_label);
+ info_label->hide();
// FPS Counter.
- fps = memnew(PanelContainer);
- fps->set_self_modulate(Color(1, 1, 1, 0.4));
- surface->add_child(fps);
fps_label = memnew(Label);
- fps->add_child(fps_label);
- fps->hide();
+ fps_label->set_anchor_and_margin(MARGIN_LEFT, ANCHOR_END, -90 * EDSCALE);
+ fps_label->set_anchor_and_margin(MARGIN_TOP, ANCHOR_BEGIN, 10 * EDSCALE);
+ fps_label->set_anchor_and_margin(MARGIN_RIGHT, ANCHOR_END, -10 * EDSCALE);
+ fps_label->set_h_grow_direction(GROW_DIRECTION_BEGIN);
+ surface->add_child(fps_label);
+ fps_label->hide();
accept = NULL;
diff --git a/editor/plugins/spatial_editor_plugin.h b/editor/plugins/spatial_editor_plugin.h
index 86b814ab8a..4aa1d9c0c1 100644
--- a/editor/plugins/spatial_editor_plugin.h
+++ b/editor/plugins/spatial_editor_plugin.h
@@ -106,7 +106,6 @@ private:
int index;
String name;
void _menu_option(int p_option);
- Size2 prev_size;
Spatial *preview_node;
AABB *preview_bounds;
@@ -136,10 +135,7 @@ private:
bool freelook_active;
real_t freelook_speed;
- PanelContainer *info;
Label *info_label;
-
- PanelContainer *fps;
Label *fps_label;
struct _RayResult {
diff --git a/platform/android/detect.py b/platform/android/detect.py
index bc67f6e6dc..892b1b6a85 100644
--- a/platform/android/detect.py
+++ b/platform/android/detect.py
@@ -277,7 +277,7 @@ def get_ndk_version(path):
try:
with open(prop_file_path) as prop_file:
for line in prop_file:
- key_value = map(lambda x: string.strip(x), line.split("="))
+ key_value = list(map(lambda x: x.strip(), line.split("=")))
if key_value[0] == "Pkg.Revision":
return key_value[1]
except:
diff --git a/scene/3d/baked_lightmap.cpp b/scene/3d/baked_lightmap.cpp
index 3d9bb73181..99d14e7f74 100644
--- a/scene/3d/baked_lightmap.cpp
+++ b/scene/3d/baked_lightmap.cpp
@@ -702,6 +702,12 @@ void BakedLightmap::_bind_methods() {
BIND_ENUM_CONSTANT(BAKE_QUALITY_HIGH);
BIND_ENUM_CONSTANT(BAKE_MODE_CONE_TRACE);
BIND_ENUM_CONSTANT(BAKE_MODE_RAY_TRACE);
+
+ BIND_ENUM_CONSTANT(BAKE_ERROR_OK);
+ BIND_ENUM_CONSTANT(BAKE_ERROR_NO_SAVE_PATH);
+ BIND_ENUM_CONSTANT(BAKE_ERROR_NO_MESHES);
+ BIND_ENUM_CONSTANT(BAKE_ERROR_CANT_CREATE_IMAGE);
+ BIND_ENUM_CONSTANT(BAKE_ERROR_USER_ABORTED);
}
BakedLightmap::BakedLightmap() {
diff --git a/scene/3d/voxel_light_baker.cpp b/scene/3d/voxel_light_baker.cpp
index 98dc1590d8..c05dfddeca 100644
--- a/scene/3d/voxel_light_baker.cpp
+++ b/scene/3d/voxel_light_baker.cpp
@@ -1781,7 +1781,7 @@ Error VoxelLightBaker::make_lightmap(const Transform &p_xform, Ref<Mesh> &p_mesh
//print_line("bake line " + itos(i) + " / " + itos(height));
#ifdef _OPENMP
-#pragma omp parallel for
+#pragma omp parallel for schedule(dynamic, 1)
#endif
for (int j = 0; j < width; j++) {
@@ -1878,12 +1878,14 @@ Error VoxelLightBaker::make_lightmap(const Transform &p_xform, Ref<Mesh> &p_mesh
LightMap *lightmap_ptr = lightmap.ptrw();
const Cell *cells = bake_cells.ptr();
const Light *light = bake_light.ptr();
-
+#ifdef _OPENMP
+#pragma omp parallel
+#endif
for (int i = 0; i < height; i++) {
//print_line("bake line " + itos(i) + " / " + itos(height));
#ifdef _OPENMP
-#pragma omp parallel for
+#pragma omp parallel for schedule(dynamic, 1)
#endif
for (int j = 0; j < width; j++) {