diff options
-rw-r--r-- | core/class_db.cpp | 9 | ||||
-rw-r--r-- | core/os/file_access.cpp | 55 | ||||
-rw-r--r-- | drivers/gles3/rasterizer_canvas_gles3.cpp | 2 | ||||
-rw-r--r-- | editor/editor_help.cpp | 255 | ||||
-rw-r--r-- | editor/editor_help.h | 12 | ||||
-rw-r--r-- | editor/editor_themes.cpp | 6 | ||||
-rw-r--r-- | editor/plugins/spatial_editor_plugin.cpp | 63 | ||||
-rw-r--r-- | editor/plugins/spatial_editor_plugin.h | 4 | ||||
-rw-r--r-- | platform/android/detect.py | 2 | ||||
-rw-r--r-- | platform/android/export/export.cpp | 3 | ||||
-rw-r--r-- | scene/3d/baked_lightmap.cpp | 6 | ||||
-rw-r--r-- | scene/3d/voxel_light_baker.cpp | 8 |
12 files changed, 244 insertions, 181 deletions
diff --git a/core/class_db.cpp b/core/class_db.cpp index edd49fe95f..b18e3d2b65 100644 --- a/core/class_db.cpp +++ b/core/class_db.cpp @@ -348,10 +348,11 @@ uint64_t ClassDB::get_api_hash(APIType p_api) { hash = hash_djb2_one_64(mb->get_argument_type(-1), hash); //return for (int i = 0; i < mb->get_argument_count(); i++) { - hash = hash_djb2_one_64(mb->get_argument_info(i).type, hash); - hash = hash_djb2_one_64(mb->get_argument_info(i).name.hash(), hash); - hash = hash_djb2_one_64(mb->get_argument_info(i).hint, hash); - hash = hash_djb2_one_64(mb->get_argument_info(i).hint_string.hash(), hash); + const PropertyInfo info = mb->get_argument_info(i); + hash = hash_djb2_one_64(info.type, hash); + hash = hash_djb2_one_64(info.name.hash(), hash); + hash = hash_djb2_one_64(info.hint, hash); + hash = hash_djb2_one_64(info.hint_string.hash(), hash); } hash = hash_djb2_one_64(mb->get_default_argument_count(), hash); diff --git a/core/os/file_access.cpp b/core/os/file_access.cpp index 7b2062936b..20c1221f2b 100644 --- a/core/os/file_access.cpp +++ b/core/os/file_access.cpp @@ -273,9 +273,62 @@ String FileAccess::get_token() const { return String::utf8(token.get_data()); } +class CharBuffer { + Vector<char> vector; + char stack_buffer[256]; + + char *buffer; + int capacity; + int written; + + bool grow() { + + if (vector.resize(next_power_of_2(1 + written)) != OK) { + + return false; + } + + if (buffer == stack_buffer) { // first chunk? + + for (int i = 0; i < written; i++) { + + vector[i] = stack_buffer[i]; + } + } + + buffer = vector.ptrw(); + capacity = vector.size(); + ERR_FAIL_COND_V(written >= capacity, false); + + return true; + } + +public: + _FORCE_INLINE_ CharBuffer() : + buffer(stack_buffer), + capacity(sizeof(stack_buffer) / sizeof(char)), + written(0) { + } + + _FORCE_INLINE_ void push_back(char c) { + + if (written >= capacity) { + + ERR_FAIL_COND(!grow()); + } + + buffer[written++] = c; + } + + _FORCE_INLINE_ const char *get_data() const { + + return buffer; + } +}; + String FileAccess::get_line() const { - CharString line; + CharBuffer line; CharType c = get_8(); diff --git a/drivers/gles3/rasterizer_canvas_gles3.cpp b/drivers/gles3/rasterizer_canvas_gles3.cpp index 309497c938..5d93c6a982 100644 --- a/drivers/gles3/rasterizer_canvas_gles3.cpp +++ b/drivers/gles3/rasterizer_canvas_gles3.cpp @@ -1545,7 +1545,7 @@ void RasterizerCanvasGLES3::reset_canvas() { glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); //use for reading from screen - if (storage->frame.current_rt) { + if (storage->frame.current_rt && !storage->frame.current_rt->flags[RasterizerStorage::RENDER_TARGET_NO_SAMPLING]) { glActiveTexture(GL_TEXTURE0 + storage->config.max_texture_image_units - 3); glBindTexture(GL_TEXTURE_2D, storage->frame.current_rt->effects.mip_maps[0].color); } diff --git a/editor/editor_help.cpp b/editor/editor_help.cpp index 676b168371..d20b55e268 100644 --- a/editor/editor_help.cpp +++ b/editor/editor_help.cpp @@ -522,6 +522,19 @@ EditorHelpIndex::EditorHelpIndex() { /// ///////////////////////////////// DocData *EditorHelp::doc = NULL; +void EditorHelp::_init_colors() { + + title_color = get_color("accent_color", "Editor"); + text_color = get_color("default_color", "RichTextLabel"); + headline_color = get_color("headline_color", "EditorHelp"); + base_type_color = title_color.linear_interpolate(text_color, 0.5); + comment_color = Color(text_color.r, text_color.g, text_color.b, 0.6); + symbol_color = comment_color; + value_color = Color(text_color.r, text_color.g, text_color.b, 0.4); + qualifier_color = Color(text_color.r, text_color.g, text_color.b, 0.8); + type_color = get_color("accent_color", "Editor").linear_interpolate(text_color, 0.5); +} + void EditorHelp::_unhandled_key_input(const Ref<InputEvent> &p_ev) { if (!is_visible_in_tree()) @@ -654,6 +667,86 @@ void EditorHelp::_add_type(const String &p_type, const String &p_enum) { class_desc->pop(); } +void EditorHelp::_add_method(const DocData::MethodDoc &p_method, bool p_overview) { + + method_line[p_method.name] = class_desc->get_line_count() - 2; //gets overridden if description + + const bool is_vararg = p_method.qualifiers.find("vararg") != -1; + + if (p_overview) { + class_desc->push_cell(); + class_desc->push_align(RichTextLabel::ALIGN_RIGHT); + } + + _add_type(p_method.return_type, p_method.return_enum); + + if (p_overview) { + class_desc->pop(); //align + class_desc->pop(); //cell + class_desc->push_cell(); + } else { + class_desc->add_text(" "); + } + + if (p_overview && p_method.description != "") { + class_desc->push_meta("@method" + p_method.name); + } + + class_desc->push_color(headline_color); + _add_text(p_method.name); + class_desc->pop(); + + if (p_overview && p_method.description != "") { + class_desc->pop(); //meta + } + + class_desc->push_color(symbol_color); + class_desc->add_text(p_method.arguments.size() || is_vararg ? "( " : "("); + class_desc->pop(); + + for (int j = 0; j < p_method.arguments.size(); j++) { + class_desc->push_color(text_color); + if (j > 0) + class_desc->add_text(", "); + _add_type(p_method.arguments[j].type, p_method.arguments[j].enumeration); + class_desc->add_text(" "); + _add_text(p_method.arguments[j].name); + if (p_method.arguments[j].default_value != "") { + + class_desc->push_color(symbol_color); + class_desc->add_text("="); + class_desc->pop(); + _add_text(p_method.arguments[j].default_value); + } + + class_desc->pop(); + } + + if (is_vararg) { + class_desc->push_color(text_color); + if (p_method.arguments.size()) + class_desc->add_text(", "); + class_desc->push_color(symbol_color); + class_desc->add_text("..."); + class_desc->pop(); + class_desc->pop(); + } + + class_desc->push_color(symbol_color); + class_desc->add_text(p_method.arguments.size() || is_vararg ? " )" : ")"); + class_desc->pop(); + if (p_method.qualifiers != "") { + + class_desc->push_color(qualifier_color); + class_desc->add_text(" "); + _add_text(p_method.qualifiers); + class_desc->pop(); + } + + if (p_overview) + class_desc->pop(); //cell +} + Error EditorHelp::_goto_desc(const String &p_class, int p_vscr) { //ERR_FAIL_COND(!doc->class_list.has(p_class)); @@ -679,15 +772,7 @@ Error EditorHelp::_goto_desc(const String &p_class, int p_vscr) { edited_class = p_class; //edited_class->show(); - // Colors - const Color title_color = get_color("accent_color", "Editor"); - const Color text_color = get_color("default_color", "RichTextLabel"); - const Color headline_color = get_color("headline_color", "EditorHelp"); - const Color base_type_color = title_color.linear_interpolate(text_color, 0.5); - const Color comment_color = Color(text_color.r, text_color.g, text_color.b, 0.6); - const Color symbol_color = comment_color; - const Color value_color = Color(text_color.r, text_color.g, text_color.b, 0.4); - const Color qualifier_color = Color(text_color.r, text_color.g, text_color.b, 0.8); + _init_colors(); DocData::ClassDoc cd = doc->class_list[p_class]; //make a copy, so we can sort without worrying @@ -892,78 +977,51 @@ Error EditorHelp::_goto_desc(const String &p_class, int p_vscr) { class_desc->push_table(2); class_desc->set_table_column_expand(1, 1); - for (int i = 0; i < methods.size(); i++) { - - bool is_vararg = methods[i].qualifiers.find("vararg") != -1; - - method_line[methods[i].name] = class_desc->get_line_count() - 2; //gets overridden if description - - class_desc->push_cell(); - class_desc->push_align(RichTextLabel::ALIGN_RIGHT); - class_desc->push_font(doc_code_font); - _add_type(methods[i].return_type, methods[i].return_enum); - //class_desc->add_text(" "); - class_desc->pop(); //align - class_desc->pop(); //font - class_desc->pop(); //cell + bool any_previous = false; + for (int pass = 0; pass < 2; pass++) { + Vector<DocData::MethodDoc> m; - class_desc->push_cell(); - class_desc->push_font(doc_code_font); + for (int i = 0; i < methods.size(); i++) { + const String &q = methods[i].qualifiers; + if ((pass == 0 && q.find("virtual") != -1) || (pass == 1 && q.find("virtual") == -1)) { + m.push_back(methods[i]); + } + } - if (methods[i].description != "") { - method_descr = true; - class_desc->push_meta("@method" + methods[i].name); + if (any_previous && !m.empty()) { + class_desc->push_cell(); + class_desc->pop(); //cell + class_desc->push_cell(); + class_desc->pop(); //cell + any_previous = false; } - class_desc->push_color(headline_color); - _add_text(methods[i].name); - class_desc->pop(); - if (methods[i].description != "") - class_desc->pop(); // pop meta - class_desc->push_color(symbol_color); - class_desc->add_text(methods[i].arguments.size() || is_vararg ? "( " : "("); - class_desc->pop(); - for (int j = 0; j < methods[i].arguments.size(); j++) { - class_desc->push_color(text_color); - if (j > 0) - class_desc->add_text(", "); - _add_type(methods[i].arguments[j].type, methods[i].arguments[j].enumeration); - class_desc->add_text(" "); - _add_text(methods[i].arguments[j].name); - if (methods[i].arguments[j].default_value != "") { - class_desc->push_color(symbol_color); - class_desc->add_text("="); - class_desc->pop(); - _add_text(methods[i].arguments[j].default_value); + String group_prefix; + for (int i = 0; i < m.size(); i++) { + const String new_prefix = m[i].name.substr(0, 3); + bool is_new_group = false; + + if (i < m.size() - 1 && new_prefix == m[i + 1].name.substr(0, 3) && new_prefix != group_prefix) { + is_new_group = i > 0; + group_prefix = new_prefix; + } else if (group_prefix != "" && new_prefix != group_prefix) { + is_new_group = true; + group_prefix = ""; } - class_desc->pop(); - } + if (is_new_group && pass == 1) { + class_desc->push_cell(); + class_desc->pop(); //cell + class_desc->push_cell(); + class_desc->pop(); //cell + } - if (is_vararg) { - class_desc->push_color(text_color); - if (methods[i].arguments.size()) - class_desc->add_text(", "); - class_desc->push_color(symbol_color); - class_desc->add_text("..."); - class_desc->pop(); - class_desc->pop(); + _add_method(m[i], true); } - class_desc->push_color(symbol_color); - class_desc->add_text(methods[i].arguments.size() || is_vararg ? " )" : ")"); - class_desc->pop(); - if (methods[i].qualifiers != "") { - - class_desc->push_color(qualifier_color); - class_desc->add_text(" "); - _add_text(methods[i].qualifiers); - class_desc->pop(); - } - class_desc->pop(); //monofont - //class_desc->add_newline(); - class_desc->pop(); //cell + any_previous = !m.empty(); } + class_desc->pop(); //table class_desc->pop(); class_desc->add_newline(); @@ -1366,60 +1424,7 @@ Error EditorHelp::_goto_desc(const String &p_class, int p_vscr) { for (int i = 0; i < methods.size(); i++) { - bool is_vararg = methods[i].qualifiers.find("vararg") != -1; - - method_line[methods[i].name] = class_desc->get_line_count() - 2; - - class_desc->push_font(doc_code_font); - _add_type(methods[i].return_type, methods[i].return_enum); - - class_desc->add_text(" "); - class_desc->push_color(headline_color); - _add_text(methods[i].name); - class_desc->pop(); - class_desc->push_color(symbol_color); - class_desc->add_text(methods[i].arguments.size() || is_vararg ? "( " : "("); - class_desc->pop(); - for (int j = 0; j < methods[i].arguments.size(); j++) { - class_desc->push_color(text_color); - if (j > 0) - class_desc->add_text(", "); - _add_type(methods[i].arguments[j].type, methods[i].arguments[j].enumeration); - class_desc->add_text(" "); - _add_text(methods[i].arguments[j].name); - if (methods[i].arguments[j].default_value != "") { - - class_desc->push_color(symbol_color); - class_desc->add_text("="); - class_desc->pop(); - _add_text(methods[i].arguments[j].default_value); - } - - class_desc->pop(); - } - - if (is_vararg) { - class_desc->push_color(text_color); - if (methods[i].arguments.size()) - class_desc->add_text(", "); - class_desc->push_color(symbol_color); - class_desc->add_text("..."); - class_desc->pop(); - class_desc->pop(); - } - - class_desc->push_color(symbol_color); - class_desc->add_text(methods[i].arguments.size() || is_vararg ? " )" : ")"); - class_desc->pop(); - if (methods[i].qualifiers != "") { - - class_desc->push_color(qualifier_color); - class_desc->add_text(" "); - _add_text(methods[i].qualifiers); - class_desc->pop(); - } - - class_desc->pop(); + _add_method(methods[i], false); class_desc->add_newline(); class_desc->push_color(text_color); diff --git a/editor/editor_help.h b/editor/editor_help.h index a224c7f8ee..96a3309ca3 100644 --- a/editor/editor_help.h +++ b/editor/editor_help.h @@ -139,6 +139,17 @@ class EditorHelp : public VBoxContainer { String base_path; + Color title_color; + Color text_color; + Color headline_color; + Color base_type_color; + Color type_color; + Color comment_color; + Color symbol_color; + Color value_color; + Color qualifier_color; + + void _init_colors(); void _help_callback(const String &p_topic); void _add_text(const String &p_bbcode); @@ -146,6 +157,7 @@ class EditorHelp : public VBoxContainer { //void _button_pressed(int p_idx); void _add_type(const String &p_type, const String &p_enum = String()); + void _add_method(const DocData::MethodDoc &p_method, bool p_overview = true); void _class_list_select(const String &p_select); void _class_desc_select(const String &p_select); 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/platform/android/export/export.cpp b/platform/android/export/export.cpp index 6ca687d057..d4c079cfc6 100644 --- a/platform/android/export/export.cpp +++ b/platform/android/export/export.cpp @@ -352,10 +352,11 @@ class EditorExportAndroid : public EditorExportPlatform { ea->device_lock->unlock(); } + uint64_t sleep = OS::get_singleton()->get_power_state() == OS::POWERSTATE_ON_BATTERY ? 1000 : 100; uint64_t wait = 3000000; uint64_t time = OS::get_singleton()->get_ticks_usec(); while (OS::get_singleton()->get_ticks_usec() - time < wait) { - OS::get_singleton()->delay_usec(1000); + OS::get_singleton()->delay_usec(1000 * sleep); if (ea->quit_request) break; } 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++) { |