diff --git a/core/global_config.cpp b/core/global_config.cpp index d8b88afd076..95f4ec5e220 100644 --- a/core/global_config.cpp +++ b/core/global_config.cpp @@ -130,33 +130,8 @@ bool GlobalConfig::_set(const StringName &p_name, const Variant &p_value) { if (!props[p_name].overrided) props[p_name].variant = p_value; - if (props[p_name].order >= NO_ORDER_BASE && registering_order) { - props[p_name].order = last_order++; - } } else { - props[p_name] = VariantContainer(p_value, last_order++ + (registering_order ? 0 : NO_ORDER_BASE)); - } - } - - if (!disable_platform_override) { - - String s = String(p_name); - int sl = s.find("/"); - int p = s.find("."); - if (p != -1 && sl != -1 && p < sl) { - - Vector ps = s.substr(0, sl).split("."); - String prop = s.substr(sl, s.length() - sl); - for (int i = 1; i < ps.size(); i++) { - - if (ps[i] == OS::get_singleton()->get_name()) { - - String fullprop = ps[0] + prop; - - set(fullprop, p_value); - props[fullprop].overrided = true; - } - } + props[p_name] = VariantContainer(p_value, last_order++); } } @@ -372,8 +347,6 @@ Error GlobalConfig::_load_settings_binary(const String p_path) { ERR_FAIL_V(ERR_FILE_CORRUPT;) } - set_registering_order(false); - uint32_t count = f->get_32(); for (uint32_t i = 0; i < count; i++) { @@ -397,8 +370,6 @@ Error GlobalConfig::_load_settings_binary(const String p_path) { set(key, value); } - set_registering_order(true); - return OK; } Error GlobalConfig::_load_settings(const String p_path) { @@ -468,6 +439,14 @@ void GlobalConfig::set_order(const String &p_name, int p_order) { props[p_name].order = p_order; } +void GlobalConfig::set_builtin_order(const String &p_name) { + + ERR_FAIL_COND(!props.has(p_name)); + if (props[p_name].order >= NO_BUILTIN_ORDER_BASE) { + props[p_name].order = last_builtin_order++; + } +} + void GlobalConfig::clear(const String &p_name) { ERR_FAIL_COND(!props.has(p_name)); @@ -715,13 +694,16 @@ Error GlobalConfig::save_custom(const String &p_path, const CustomMap &p_custom, Variant _GLOBAL_DEF(const String &p_var, const Variant &p_default) { + Variant ret; if (GlobalConfig::get_singleton()->has(p_var)) { - GlobalConfig::get_singleton()->set_initial_value(p_var, p_default); - return GlobalConfig::get_singleton()->get(p_var); + ret = GlobalConfig::get_singleton()->get(p_var); + } else { + GlobalConfig::get_singleton()->set(p_var, p_default); + ret = p_default; } - GlobalConfig::get_singleton()->set(p_var, p_default); GlobalConfig::get_singleton()->set_initial_value(p_var, p_default); - return p_default; + GlobalConfig::get_singleton()->set_builtin_order(p_var); + return ret; } void GlobalConfig::add_singleton(const Singleton &p_singleton) { @@ -843,7 +825,8 @@ void GlobalConfig::_bind_methods() { GlobalConfig::GlobalConfig() { singleton = this; - last_order = 0; + last_order = NO_BUILTIN_ORDER_BASE; + last_builtin_order = 0; disable_platform_override = false; registering_order = true; @@ -851,12 +834,12 @@ GlobalConfig::GlobalConfig() { Ref key; Ref joyb; - GLOBAL_DEF("application/name", ""); - GLOBAL_DEF("application/main_scene", ""); - custom_prop_info["application/main_scene"] = PropertyInfo(Variant::STRING, "application/main_scene", PROPERTY_HINT_FILE, "tscn,scn,xscn,xml,res"); - GLOBAL_DEF("application/disable_stdout", false); - GLOBAL_DEF("application/disable_stderr", false); - GLOBAL_DEF("application/use_shared_user_dir", true); + GLOBAL_DEF("application/config/name", ""); + GLOBAL_DEF("application/run/main_scene", ""); + custom_prop_info["application/run/main_scene"] = PropertyInfo(Variant::STRING, "application/run/main_scene", PROPERTY_HINT_FILE, "tscn,scn,res"); + GLOBAL_DEF("application/run/disable_stdout", false); + GLOBAL_DEF("application/run/disable_stderr", false); + GLOBAL_DEF("application/config/use_shared_user_dir", true); key.instance(); key->set_scancode(KEY_RETURN); @@ -964,18 +947,19 @@ GlobalConfig::GlobalConfig() { //GLOBAL_DEF("display/handheld/orientation", "landscape"); - custom_prop_info["display/handheld/orientation"] = PropertyInfo(Variant::STRING, "display/handheld/orientation", PROPERTY_HINT_ENUM, "landscape,portrait,reverse_landscape,reverse_portrait,sensor_landscape,sensor_portrait,sensor"); + custom_prop_info["display/window/handheld/orientation"] = PropertyInfo(Variant::STRING, "display/window/handheld/orientation", PROPERTY_HINT_ENUM, "landscape,portrait,reverse_landscape,reverse_portrait,sensor_landscape,sensor_portrait,sensor"); custom_prop_info["rendering/threads/thread_model"] = PropertyInfo(Variant::INT, "rendering/threads/thread_model", PROPERTY_HINT_ENUM, "Single-Unsafe,Single-Safe,Multi-Threaded"); custom_prop_info["physics/2d/thread_model"] = PropertyInfo(Variant::INT, "physics/2d/thread_model", PROPERTY_HINT_ENUM, "Single-Unsafe,Single-Safe,Multi-Threaded"); - GLOBAL_DEF("debug/profiler/max_functions", 16384); + GLOBAL_DEF("debug/settings/profiler/max_functions", 16384); - GLOBAL_DEF("compression/zstd/compression_level", 3); - custom_prop_info["compression/zstd/compression_level"] = PropertyInfo(Variant::INT, "compression/zstd/compression_level", PROPERTY_HINT_RANGE, "1,22,1"); - GLOBAL_DEF("compression/zlib/compression_level", Z_DEFAULT_COMPRESSION); - custom_prop_info["compression/zlib/compression_level"] = PropertyInfo(Variant::INT, "compression/zlib/compression_level", PROPERTY_HINT_RANGE, "-1,9,1"); - GLOBAL_DEF("compression/gzip/compression_level", Z_DEFAULT_COMPRESSION); - custom_prop_info["compression/gzip/compression_level"] = PropertyInfo(Variant::INT, "compression/gzip/compression_level", PROPERTY_HINT_RANGE, "-1,9,1"); + //assigning here, because using GLOBAL_GET on every block for compressing can be slow + Compression::zstd_level = GLOBAL_DEF("compression/formats/zstd/compression_level", 3); + custom_prop_info["compression/formats/zstd/compression_level"] = PropertyInfo(Variant::INT, "compression/formats/zstd/compression_level", PROPERTY_HINT_RANGE, "1,22,1"); + Compression::zlib_level = GLOBAL_DEF("compression/formats/zlib/compression_level", Z_DEFAULT_COMPRESSION); + custom_prop_info["compression/formats/zlib/compression_level"] = PropertyInfo(Variant::INT, "compression/formats/zlib/compression_level", PROPERTY_HINT_RANGE, "-1,9,1"); + Compression::gzip_level = GLOBAL_DEF("compression/formats/gzip/compression_level", Z_DEFAULT_COMPRESSION); + custom_prop_info["compression/formats/gzip/compression_level"] = PropertyInfo(Variant::INT, "compression/formats/gzip/compression_level", PROPERTY_HINT_RANGE, "-1,9,1"); using_datapack = false; } diff --git a/core/global_config.h b/core/global_config.h index d0f64dc23ce..30c77bbc27d 100644 --- a/core/global_config.h +++ b/core/global_config.h @@ -56,7 +56,8 @@ public: protected: enum { - NO_ORDER_BASE = 1 << 18 + //properties that are not for built in values begin from this value, so builtin ones are displayed first + NO_BUILTIN_ORDER_BASE = 1 << 16 }; struct VariantContainer { @@ -83,6 +84,7 @@ protected: bool registering_order; int last_order; + int last_builtin_order; Map props; String resource_path; Map custom_prop_info; @@ -130,6 +132,7 @@ public: void clear(const String &p_name); int get_order(const String &p_name) const; void set_order(const String &p_name, int p_order); + void set_builtin_order(const String &p_name); Error setup(const String &p_path, const String &p_main_pack); diff --git a/core/io/compression.cpp b/core/io/compression.cpp index 8c8f0b36552..b0f5448b6cf 100644 --- a/core/io/compression.cpp +++ b/core/io/compression.cpp @@ -61,7 +61,7 @@ int Compression::compress(uint8_t *p_dst, const uint8_t *p_src, int p_src_size, strm.zalloc = zipio_alloc; strm.zfree = zipio_free; strm.opaque = Z_NULL; - int level = p_mode == MODE_DEFLATE ? GLOBAL_GET("compression/zlib/compression_level") : GLOBAL_GET("compression/gzip/compression_level"); + int level = p_mode == MODE_DEFLATE ? zlib_level : gzip_level; int err = deflateInit2(&strm, level, Z_DEFLATED, window_bits, 8, Z_DEFAULT_STRATEGY); if (err != Z_OK) return -1; @@ -80,8 +80,7 @@ int Compression::compress(uint8_t *p_dst, const uint8_t *p_src, int p_src_size, case MODE_ZSTD: { int max_dst_size = get_max_compressed_buffer_size(p_src_size, MODE_ZSTD); - int level = GLOBAL_GET("compression/zstd/compression_level"); - return ZSTD_compress(p_dst, max_dst_size, p_src, p_src_size, level); + return ZSTD_compress(p_dst, max_dst_size, p_src, p_src_size, zstd_level); } break; } @@ -173,3 +172,7 @@ int Compression::decompress(uint8_t *p_dst, int p_dst_max_size, const uint8_t *p ERR_FAIL_V(-1); } + +int Compression::zlib_level = Z_DEFAULT_COMPRESSION; +int Compression::gzip_level = Z_DEFAULT_COMPRESSION; +int Compression::zstd_level = 3; diff --git a/core/io/compression.h b/core/io/compression.h index bc39fc4185c..5eb7806d7b8 100644 --- a/core/io/compression.h +++ b/core/io/compression.h @@ -33,7 +33,12 @@ #include "typedefs.h" class Compression { + public: + static int zlib_level; + static int gzip_level; + static int zstd_level; + enum Mode { MODE_FASTLZ, MODE_DEFLATE, diff --git a/core/io/packet_peer.cpp b/core/io/packet_peer.cpp index ac68d5240cd..93682e6b8ac 100644 --- a/core/io/packet_peer.cpp +++ b/core/io/packet_peer.cpp @@ -254,7 +254,7 @@ void PacketPeerStream::set_input_buffer_max_size(int p_max_size) { PacketPeerStream::PacketPeerStream() { - int rbsize = GLOBAL_GET("network/packets/packet_stream_peer_max_buffer_po2"); + int rbsize = GLOBAL_GET("network/limits/packet_peer_stream/max_buffer_po2"); ring_buffer.resize(rbsize); temp_buffer.resize(1 << rbsize); diff --git a/core/message_queue.cpp b/core/message_queue.cpp index d7d31b6c1e3..1c980a56e35 100644 --- a/core/message_queue.cpp +++ b/core/message_queue.cpp @@ -382,7 +382,7 @@ MessageQueue::MessageQueue() { buffer_end = 0; buffer_max_used = 0; - buffer_size = GLOBAL_DEF("memory/buffers/message_queue_max_size_kb", DEFAULT_QUEUE_SIZE_KB); + buffer_size = GLOBAL_DEF("memory/limits/message_queue/max_size_kb", DEFAULT_QUEUE_SIZE_KB); buffer_size *= 1024; buffer = memnew_arr(uint8_t, buffer_size); } diff --git a/core/os/os.cpp b/core/os/os.cpp index 8bee7258132..48463722cff 100644 --- a/core/os/os.cpp +++ b/core/os/os.cpp @@ -269,7 +269,7 @@ String OS::get_system_dir(SystemDir p_dir) const { } String OS::get_safe_application_name() const { - String an = GlobalConfig::get_singleton()->get("application/name"); + String an = GlobalConfig::get_singleton()->get("application/config/name"); Vector invalid_char = String("\\ / : * ? \" < > |").split(" "); for (int i = 0; i < invalid_char.size(); i++) { an = an.replace(invalid_char[i], "-"); diff --git a/core/register_core_types.cpp b/core/register_core_types.cpp index b089ba91290..d6a521a86f9 100644 --- a/core/register_core_types.cpp +++ b/core/register_core_types.cpp @@ -172,7 +172,7 @@ void register_core_types() { void register_core_settings() { //since in register core types, globals may not e present - GLOBAL_DEF("network/packets/packet_stream_peer_max_buffer_po2", (16)); + GLOBAL_DEF("network/limits/packet_peer_stream/max_buffer_po2", (16)); } void register_core_singletons() { diff --git a/core/script_debugger_remote.cpp b/core/script_debugger_remote.cpp index f230a4bc956..7fc151d83f9 100644 --- a/core/script_debugger_remote.cpp +++ b/core/script_debugger_remote.cpp @@ -957,7 +957,7 @@ ScriptDebuggerRemote::ScriptDebuggerRemote() { poll_every = 0; request_scene_tree = NULL; live_edit_funcs = NULL; - max_cps = GLOBAL_DEF("network/debug/max_remote_stdout_chars_per_second", 2048); + max_cps = GLOBAL_GET("network/limits/debugger_stdout/max_chars_per_second"); char_count = 0; msec_count = 0; last_msec = 0; @@ -967,7 +967,7 @@ ScriptDebuggerRemote::ScriptDebuggerRemote() { eh.userdata = this; add_error_handler(&eh); - profile_info.resize(CLAMP(int(GlobalConfig::get_singleton()->get("debug/profiler/max_functions")), 128, 65535)); + profile_info.resize(CLAMP(int(GlobalConfig::get_singleton()->get("debug/settings/profiler/max_functions")), 128, 65535)); profile_info_ptrs.resize(profile_info.size()); profiling = false; max_frame_functions = 16; diff --git a/drivers/gles2/rasterizer_gles2.cpp b/drivers/gles2/rasterizer_gles2.cpp index 25c0f8925dd..e854abb6a1d 100644 --- a/drivers/gles2/rasterizer_gles2.cpp +++ b/drivers/gles2/rasterizer_gles2.cpp @@ -3941,7 +3941,7 @@ void RasterizerGLES2::begin_frame() { //fragment_lighting=Globals::get_singleton()->get("rasterizer/use_fragment_lighting"); #ifdef TOOLS_ENABLED - canvas_shader.set_conditional(CanvasShaderGLES2::USE_PIXEL_SNAP, GLOBAL_DEF("display/use_2d_pixel_snap", false)); + canvas_shader.set_conditional(CanvasShaderGLES2::USE_PIXEL_SNAP, GLOBAL_DEF("rendering/use_2d_pixel_snap", false)); shadow_filter = ShadowFilterTechnique(int(GlobalConfig::get_singleton()->get("rasterizer/shadow_filter"))); #endif @@ -10386,7 +10386,7 @@ void RasterizerGLES2::init() { copy_shader.set_conditional(CopyShaderGLES2::USE_8BIT_HDR, !use_fp16_fb); canvas_shader.set_conditional(CanvasShaderGLES2::USE_DEPTH_SHADOWS, read_depth_supported); - canvas_shader.set_conditional(CanvasShaderGLES2::USE_PIXEL_SNAP, GLOBAL_DEF("display/use_2d_pixel_snap", false)); + canvas_shader.set_conditional(CanvasShaderGLES2::USE_PIXEL_SNAP, GLOBAL_DEF("rendering/use_2d_pixel_snap", false)); npo2_textures_available = true; //fragment_lighting=false; diff --git a/drivers/gles3/rasterizer_canvas_gles3.cpp b/drivers/gles3/rasterizer_canvas_gles3.cpp index 268d6b44c60..98e55c5a539 100644 --- a/drivers/gles3/rasterizer_canvas_gles3.cpp +++ b/drivers/gles3/rasterizer_canvas_gles3.cpp @@ -1658,7 +1658,7 @@ void RasterizerCanvasGLES3::initialize() { } { - uint32_t poly_size = GLOBAL_DEF("rendering/buffers/canvas_polygon_buffer_size_kb", 128); + uint32_t poly_size = GLOBAL_DEF("rendering/limits/buffers/canvas_polygon_buffer_size_kb", 128); poly_size *= 1024; //kb poly_size = MAX(poly_size, (2 + 2 + 4) * 4 * sizeof(float)); glGenBuffers(1, &data.polygon_buffer); @@ -1704,7 +1704,7 @@ void RasterizerCanvasGLES3::initialize() { glGenVertexArrays(1, &data.polygon_buffer_pointer_array); - uint32_t index_size = GLOBAL_DEF("rendering/buffers/canvas_polygon_index_buffer_size_kb", 128); + uint32_t index_size = GLOBAL_DEF("rendering/limits/buffers/canvas_polygon_index_buffer_size_kb", 128); index_size *= 1024; //kb glGenBuffers(1, &data.polygon_index_buffer); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, data.polygon_index_buffer); diff --git a/drivers/gles3/rasterizer_gles3.cpp b/drivers/gles3/rasterizer_gles3.cpp index 0cfa8a7d6e2..233095dec2c 100644 --- a/drivers/gles3/rasterizer_gles3.cpp +++ b/drivers/gles3/rasterizer_gles3.cpp @@ -400,10 +400,8 @@ void RasterizerGLES3::make_current() { void RasterizerGLES3::register_config() { - GLOBAL_DEF("rendering/gles3/render_architecture", 0); - GlobalConfig::get_singleton()->set_custom_property_info("rendering/gles3/render_architecture", PropertyInfo(Variant::INT, "", PROPERTY_HINT_ENUM, "Desktop,Mobile")); - GLOBAL_DEF("rendering/quality/use_nearest_mipmap_filter", false); - GLOBAL_DEF("rendering/quality/anisotropic_filter_level", 4.0); + GLOBAL_DEF("rendering/quality/filters/use_nearest_mipmap_filter", false); + GLOBAL_DEF("rendering/quality/filters/anisotropic_filter_level", 4.0); } RasterizerGLES3::RasterizerGLES3() { diff --git a/drivers/gles3/rasterizer_scene_gles3.cpp b/drivers/gles3/rasterizer_scene_gles3.cpp index 8dfa91473ac..b7547f53a85 100644 --- a/drivers/gles3/rasterizer_scene_gles3.cpp +++ b/drivers/gles3/rasterizer_scene_gles3.cpp @@ -4638,7 +4638,7 @@ void RasterizerSceneGLES3::initialize() { glBufferData(GL_UNIFORM_BUFFER, sizeof(State::EnvironmentRadianceUBO), &state.env_radiance_ubo, GL_DYNAMIC_DRAW); glBindBuffer(GL_UNIFORM_BUFFER, 0); - render_list.max_elements = GLOBAL_DEF("rendering/gles3/max_renderable_elements", (int)RenderList::DEFAULT_MAX_ELEMENTS); + render_list.max_elements = GLOBAL_DEF("rendering/limits/rendering/max_renderable_elements", (int)RenderList::DEFAULT_MAX_ELEMENTS); if (render_list.max_elements > 1000000) render_list.max_elements = 1000000; if (render_list.max_elements < 1024) @@ -4712,7 +4712,7 @@ void RasterizerSceneGLES3::initialize() { { //directional light shadow directional_shadow.light_count = 0; - directional_shadow.size = nearest_power_of_2(GLOBAL_DEF("rendering/shadows/directional_shadow_size", 4096)); + directional_shadow.size = nearest_power_of_2(GLOBAL_GET("rendering/quality/directional_shadow/size")); glGenFramebuffers(1, &directional_shadow.fbo); glBindFramebuffer(GL_FRAMEBUFFER, directional_shadow.fbo); glGenTextures(1, &directional_shadow.depth); @@ -4779,8 +4779,8 @@ void RasterizerSceneGLES3::initialize() { state.scene_shader.add_custom_define("#define MAX_SKELETON_BONES " + itos(state.max_skeleton_bones) + "\n"); } - GLOBAL_DEF("rendering/gles3/shadow_filter_mode", 1); - GlobalConfig::get_singleton()->set_custom_property_info("rendering/gles3/shadow_filter_mode", PropertyInfo(Variant::INT, "rendering/gles3/shadow_filter_mode", PROPERTY_HINT_ENUM, "Disabled,PCF5,PCF13")); + GLOBAL_DEF("rendering/quality/shadows/filter_mode", 1); + GlobalConfig::get_singleton()->set_custom_property_info("rendering/quality/shadows/filter_mode", PropertyInfo(Variant::INT, "rendering/quality/shadows/filter_mode", PROPERTY_HINT_ENUM, "Disabled,PCF5,PCF13")); shadow_filter_mode = SHADOW_FILTER_NEAREST; { //reflection cubemaps @@ -4844,7 +4844,7 @@ void RasterizerSceneGLES3::initialize() { { - uint32_t immediate_buffer_size = GLOBAL_DEF("rendering/buffers/immediate_buffer_size_kb", 2048); + uint32_t immediate_buffer_size = GLOBAL_DEF("rendering/limits/buffers/immediate_buffer_size_kb", 2048); glGenBuffers(1, &state.immediate_buffer); glBindBuffer(GL_ARRAY_BUFFER, state.immediate_buffer); @@ -4871,13 +4871,13 @@ void RasterizerSceneGLES3::initialize() { state.tonemap_shader.init(); { - GLOBAL_DEF("rendering/ssurf_scattering/quality", 1); - GlobalConfig::get_singleton()->set_custom_property_info("rendering/ssurf_scattering/quality", PropertyInfo(Variant::INT, "rendering/ssurf_scattering/quality", PROPERTY_HINT_ENUM, "Low,Medium,High")); - GLOBAL_DEF("rendering/ssurf_scattering/max_size", 1.0); - GlobalConfig::get_singleton()->set_custom_property_info("rendering/ssurf_scattering/max_size", PropertyInfo(Variant::INT, "rendering/ssurf_scattering/max_size", PROPERTY_HINT_RANGE, "0.01,8,0.01")); - GLOBAL_DEF("rendering/ssurf_scattering/follow_surface", false); + GLOBAL_DEF("rendering/quality/subsurface_scattering/quality", 1); + GlobalConfig::get_singleton()->set_custom_property_info("rendering/quality/subsurface_scattering/quality", PropertyInfo(Variant::INT, "rendering/quality/subsurface_scattering/quality", PROPERTY_HINT_ENUM, "Low,Medium,High")); + GLOBAL_DEF("rendering/quality/subsurface_scattering/scale", 1.0); + GlobalConfig::get_singleton()->set_custom_property_info("rendering/quality/subsurface_scattering/scale", PropertyInfo(Variant::INT, "rendering/quality/subsurface_scattering/scale", PROPERTY_HINT_RANGE, "0.01,8,0.01")); + GLOBAL_DEF("rendering/quality/subsurface_scattering/follow_surface", false); - GLOBAL_DEF("rendering/reflections/high_quality_vct_gi", true); + GLOBAL_DEF("rendering/quality/voxel_cone_tracing/high_quality", true); } exposure_shrink_size = 243; @@ -4916,12 +4916,12 @@ void RasterizerSceneGLES3::initialize() { void RasterizerSceneGLES3::iteration() { - shadow_filter_mode = ShadowFilterMode(int(GlobalConfig::get_singleton()->get("rendering/gles3/shadow_filter_mode"))); - subsurface_scatter_follow_surface = GlobalConfig::get_singleton()->get("rendering/ssurf_scattering/follow_surface"); - subsurface_scatter_quality = SubSurfaceScatterQuality(int(GlobalConfig::get_singleton()->get("rendering/ssurf_scattering/quality"))); - subsurface_scatter_size = GlobalConfig::get_singleton()->get("rendering/ssurf_scattering/max_size"); + shadow_filter_mode = ShadowFilterMode(int(GlobalConfig::get_singleton()->get("rendering/quality/shadows/filter_mode"))); + subsurface_scatter_follow_surface = GlobalConfig::get_singleton()->get("rendering/quality/subsurface_scattering/follow_surface"); + subsurface_scatter_quality = SubSurfaceScatterQuality(int(GlobalConfig::get_singleton()->get("rendering/quality/subsurface_scattering/quality"))); + subsurface_scatter_size = GlobalConfig::get_singleton()->get("rendering/quality/subsurface_scattering/scale"); - state.scene_shader.set_conditional(SceneShaderGLES3::VCT_QUALITY_HIGH, GlobalConfig::get_singleton()->get("rendering/reflections/high_quality_vct_gi")); + state.scene_shader.set_conditional(SceneShaderGLES3::VCT_QUALITY_HIGH, GlobalConfig::get_singleton()->get("rendering/quality/voxel_cone_tracing/high_quality")); } void RasterizerSceneGLES3::finalize() { diff --git a/drivers/gles3/rasterizer_storage_gles3.cpp b/drivers/gles3/rasterizer_storage_gles3.cpp index ab12bcef6d8..981426f4dca 100644 --- a/drivers/gles3/rasterizer_storage_gles3.cpp +++ b/drivers/gles3/rasterizer_storage_gles3.cpp @@ -6848,8 +6848,8 @@ void RasterizerStorageGLES3::initialize() { } config.shrink_textures_x2 = false; - config.use_fast_texture_filter = int(GlobalConfig::get_singleton()->get("rendering/quality/use_nearest_mipmap_filter")); - config.use_anisotropic_filter = config.extensions.has("GL_EXT_texture_filter_anisotropic"); + config.use_fast_texture_filter = int(GlobalConfig::get_singleton()->get("rendering/quality/filters/use_nearest_mipmap_filter")); + config.use_anisotropic_filter = config.extensions.has("rendering/quality/filters/anisotropic_filter_level"); config.s3tc_supported = config.extensions.has("GL_EXT_texture_compression_dxt1") || config.extensions.has("GL_EXT_texture_compression_s3tc") || config.extensions.has("WEBGL_compressed_texture_s3tc"); config.etc_supported = config.extensions.has("GL_OES_compressed_ETC1_RGB8_texture"); @@ -6983,7 +6983,7 @@ void RasterizerStorageGLES3::initialize() { { //transform feedback buffers - uint32_t xf_feedback_size = GLOBAL_DEF("rendering/buffers/blend_shape_max_buffer_size_kb", 4096); + uint32_t xf_feedback_size = GLOBAL_DEF("rendering/limits/buffers/blend_shape_max_buffer_size_kb", 4096); for (int i = 0; i < 2; i++) { glGenBuffers(1, &resources.transform_feedback_buffers[i]); @@ -7009,7 +7009,7 @@ void RasterizerStorageGLES3::initialize() { frame.current_rt = NULL; config.keep_original_textures = false; config.generate_wireframes = false; - config.use_texture_array_environment = GLOBAL_DEF("rendering/quality/texture_array_environments", true); + config.use_texture_array_environment = GLOBAL_DEF("rendering/quality/reflections/texture_array_reflections", true); } void RasterizerStorageGLES3::finalize() { diff --git a/drivers/unix/os_unix.cpp b/drivers/unix/os_unix.cpp index 479d97e5636..2f88296ea49 100644 --- a/drivers/unix/os_unix.cpp +++ b/drivers/unix/os_unix.cpp @@ -494,7 +494,7 @@ String OS_Unix::get_data_dir() const { if (has_environment("HOME")) { - bool use_godot = GlobalConfig::get_singleton()->get("application/use_shared_user_dir"); + bool use_godot = GlobalConfig::get_singleton()->get("application/config/use_shared_user_dir"); if (use_godot) return get_environment("HOME") + "/.godot/app_userdata/" + an; else diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index 497a8ca4525..00609b22d74 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -163,7 +163,7 @@ void EditorNode::_update_scene_tabs() { void EditorNode::_update_title() { - String appname = GlobalConfig::get_singleton()->get("application/name"); + String appname = GlobalConfig::get_singleton()->get("application/config/name"); String title = appname.empty() ? String(VERSION_FULL_NAME) : String(_MKSTR(VERSION_NAME) + String(" - ") + appname); String edited = editor_data.get_edited_scene_root() ? editor_data.get_edited_scene_root()->get_filename() : String(); if (!edited.empty()) @@ -272,7 +272,7 @@ void EditorNode::_notification(int p_what) { } editor_selection->update(); - scene_root->set_size_override(true, Size2(GlobalConfig::get_singleton()->get("display/window/width"), GlobalConfig::get_singleton()->get("display/window/height"))); + scene_root->set_size_override(true, Size2(GlobalConfig::get_singleton()->get("display/window/size/width"), GlobalConfig::get_singleton()->get("display/window/size/height"))); ResourceImporterTexture::get_singleton()->update_imports(); } @@ -1132,7 +1132,7 @@ void EditorNode::_dialog_action(String p_file) { } break; case SETTINGS_PICK_MAIN_SCENE: { - GlobalConfig::get_singleton()->set("application/main_scene", p_file); + GlobalConfig::get_singleton()->set("application/run/main_scene", p_file); GlobalConfig::get_singleton()->save(); //would be nice to show the project manager opened with the highlighted field.. _run(false, ""); // automatically run the project @@ -1731,7 +1731,7 @@ void EditorNode::_run(bool p_current, const String &p_custom) { if (run_filename == "") { //evidently, run the scene - main_scene = GLOBAL_DEF("application/main_scene", ""); + main_scene = GLOBAL_DEF("application/run/main_scene", ""); if (main_scene == "") { current_option = -1; @@ -5151,10 +5151,6 @@ EditorNode::EditorNode() { import_wav.instance(); ResourceFormatImporter::get_singleton()->add_importer(import_wav); - Ref import_obj; - import_obj.instance(); - ResourceFormatImporter::get_singleton()->add_importer(import_obj); - Ref import_scene; import_scene.instance(); ResourceFormatImporter::get_singleton()->add_importer(import_scene); @@ -5163,6 +5159,10 @@ EditorNode::EditorNode() { Ref import_collada; import_collada.instance(); import_scene->add_importer(import_collada); + + Ref import_obj; + import_obj.instance(); + import_scene->add_importer(import_obj); } } @@ -5937,6 +5937,7 @@ EditorNode::EditorNode() { property_editor->set_use_folding(true); property_editor->set_v_size_flags(Control::SIZE_EXPAND_FILL); property_editor->set_use_doc_hints(true); + property_editor->set_hide_script(false); property_editor->set_enable_capitalize_paths(bool(EDITOR_DEF("interface/capitalize_properties", true))); property_editor->hide_top_label(); diff --git a/editor/editor_run.cpp b/editor/editor_run.cpp index a8106b4eec3..8d01484b347 100644 --- a/editor/editor_run.cpp +++ b/editor/editor_run.cpp @@ -79,12 +79,12 @@ Error EditorRun::run(const String &p_scene, const String p_custom_args, const Li Size2 desired_size; - desired_size.x = GlobalConfig::get_singleton()->get("display/window/width"); - desired_size.y = GlobalConfig::get_singleton()->get("display/window/height"); + desired_size.x = GlobalConfig::get_singleton()->get("display/window/size/width"); + desired_size.y = GlobalConfig::get_singleton()->get("display/window/size/height"); Size2 test_size; - test_size.x = GlobalConfig::get_singleton()->get("display/window/test_width"); - test_size.y = GlobalConfig::get_singleton()->get("display/window/test_height"); + test_size.x = GlobalConfig::get_singleton()->get("display/window/size/test_width"); + test_size.y = GlobalConfig::get_singleton()->get("display/window/size/test_height"); if (test_size.x > 0 && test_size.y > 0) { desired_size = test_size; diff --git a/editor/import/resource_importer_obj.cpp b/editor/import/resource_importer_obj.cpp index 4a2f37e319c..9bb598ec921 100644 --- a/editor/import/resource_importer_obj.cpp +++ b/editor/import/resource_importer_obj.cpp @@ -31,82 +31,206 @@ #include "io/resource_saver.h" #include "os/file_access.h" +#include "scene/3d/mesh_instance.h" +#include "scene/3d/spatial.h" #include "scene/resources/mesh.h" #include "scene/resources/surface_tool.h" -String ResourceImporterOBJ::get_importer_name() const { +uint32_t EditorOBJImporter::get_import_flags() const { - return "obj_mesh"; + return IMPORT_SCENE; +} +void EditorOBJImporter::get_extensions(List *r_extensions) const { + + r_extensions->push_back("obj"); } -String ResourceImporterOBJ::get_visible_name() const { +Error EditorOBJImporter::_parse_material_library(const String &p_path, Map > &material_map, List *r_missing_deps) { - return "OBJ As Mesh"; -} -void ResourceImporterOBJ::get_recognized_extensions(List *p_extensions) const { - - p_extensions->push_back("obj"); -} -String ResourceImporterOBJ::get_save_extension() const { - return "mesh"; -} - -String ResourceImporterOBJ::get_resource_type() const { - - return "ArrayMesh"; -} - -bool ResourceImporterOBJ::get_option_visibility(const String &p_option, const Map &p_options) const { - - return true; -} - -int ResourceImporterOBJ::get_preset_count() const { - return 0; -} -String ResourceImporterOBJ::get_preset_name(int p_idx) const { - - return String(); -} - -void ResourceImporterOBJ::get_import_options(List *r_options, int p_preset) const { - - r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "generate/tangents"), true)); - r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "generate/normals"), true)); - //not for nowp - //r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL,"import/materials"))); - //r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL,"import/textures"))); - r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "force/flip_faces"), false)); - r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "force/smooth_shading"), true)); - r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "force/weld_vertices"), true)); - r_options->push_back(ImportOption(PropertyInfo(Variant::REAL, "force/weld_tolerance", PROPERTY_HINT_RANGE, "0.00001,16,0.00001"), 0.0001)); - //r_options->push_back(PropertyInfo(Variant::INT,"compress/bitrate",PROPERTY_HINT_ENUM,"64,96,128,192")); -} - -Error ResourceImporterOBJ::import(const String &p_source_file, const String &p_save_path, const Map &p_options, List *r_platform_variants, List *r_gen_files) { - - FileAccessRef f = FileAccess::open(p_source_file, FileAccess::READ); + FileAccessRef f = FileAccess::open(p_path, FileAccess::READ); ERR_FAIL_COND_V(!f, ERR_CANT_OPEN); - Ref mesh = Ref(memnew(ArrayMesh)); + Ref current; + String current_name; + String base_path = p_path.get_base_dir(); + while (true) { + + String l = f->get_line().strip_edges(); + + if (l.begins_with("newmtl ")) { + //vertex + + current_name = l.replace("newmtl", "").strip_edges(); + current.instance(); + material_map[current_name] = current; + } else if (l.begins_with("Ka ")) { + //uv + print_line("Warning: Ambient light for material '" + current_name + "' is ignored in PBR"); + + } else if (l.begins_with("Kd ")) { + //normal + ERR_FAIL_COND_V(current.is_null(), ERR_FILE_CORRUPT); + Vector v = l.split(" ", false); + ERR_FAIL_COND_V(v.size() < 4, ERR_INVALID_DATA); + Color c = current->get_albedo(); + c.r = v[1].to_float(); + c.g = v[2].to_float(); + c.b = v[3].to_float(); + current->set_albedo(c); + } else if (l.begins_with("Ks ")) { + //normal + ERR_FAIL_COND_V(current.is_null(), ERR_FILE_CORRUPT); + Vector v = l.split(" ", false); + ERR_FAIL_COND_V(v.size() < 4, ERR_INVALID_DATA); + float r = v[1].to_float(); + float g = v[2].to_float(); + float b = v[3].to_float(); + float metalness = MAX(r, MAX(g, b)); + current->set_metallic(metalness); + } else if (l.begins_with("Ns ")) { + //normal + ERR_FAIL_COND_V(current.is_null(), ERR_FILE_CORRUPT); + Vector v = l.split(" ", false); + ERR_FAIL_COND_V(v.size() != 2, ERR_INVALID_DATA); + float s = v[1].to_float(); + current->set_metallic((1000.0 - s) / 1000.0); + } else if (l.begins_with("d ")) { + //normal + ERR_FAIL_COND_V(current.is_null(), ERR_FILE_CORRUPT); + Vector v = l.split(" ", false); + ERR_FAIL_COND_V(v.size() != 2, ERR_INVALID_DATA); + float d = v[1].to_float(); + Color c = current->get_albedo(); + c.a = d; + current->set_albedo(c); + if (c.a < 0.99) { + current->set_feature(SpatialMaterial::FEATURE_TRANSPARENT, true); + } + } else if (l.begins_with("Tr ")) { + //normal + ERR_FAIL_COND_V(current.is_null(), ERR_FILE_CORRUPT); + Vector v = l.split(" ", false); + ERR_FAIL_COND_V(v.size() != 2, ERR_INVALID_DATA); + float d = v[1].to_float(); + Color c = current->get_albedo(); + c.a = 1.0 - d; + current->set_albedo(c); + if (c.a < 0.99) { + current->set_feature(SpatialMaterial::FEATURE_TRANSPARENT, true); + } + + } else if (l.begins_with("map_Ka ")) { + //uv + print_line("Warning: Ambient light texture for material '" + current_name + "' is ignored in PBR"); + + } else if (l.begins_with("map_Kd ")) { + //normal + ERR_FAIL_COND_V(current.is_null(), ERR_FILE_CORRUPT); + + String p = l.replace("map_Kd", "").replace("\\", "/").strip_edges(); + String path = base_path.plus_file(p); + + Ref texture = ResourceLoader::load(path); + + if (texture.is_valid()) { + current->set_texture(SpatialMaterial::TEXTURE_ALBEDO, texture); + } else { + r_missing_deps->push_back(path); + } + + } else if (l.begins_with("map_Ks ")) { + //normal + ERR_FAIL_COND_V(current.is_null(), ERR_FILE_CORRUPT); + + String p = l.replace("map_Ks", "").replace("\\", "/").strip_edges(); + String path = base_path.plus_file(p); + + Ref texture = ResourceLoader::load(path); + + if (texture.is_valid()) { + current->set_texture(SpatialMaterial::TEXTURE_METALLIC, texture); + } else { + r_missing_deps->push_back(path); + } + + } else if (l.begins_with("map_Ns ")) { + //normal + ERR_FAIL_COND_V(current.is_null(), ERR_FILE_CORRUPT); + + String p = l.replace("map_Ns", "").replace("\\", "/").strip_edges(); + String path = base_path.plus_file(p); + + Ref texture = ResourceLoader::load(path); + + if (texture.is_valid()) { + current->set_texture(SpatialMaterial::TEXTURE_ROUGHNESS, texture); + } else { + r_missing_deps->push_back(path); + } + } else if (l.begins_with("map_bump ")) { + //normal + ERR_FAIL_COND_V(current.is_null(), ERR_FILE_CORRUPT); + + String p = l.replace("map_bump", "").replace("\\", "/").strip_edges(); + String path = base_path.plus_file(p); + + Ref texture = ResourceLoader::load(path); + + if (texture.is_valid()) { + current->set_feature(SpatialMaterial::FEATURE_NORMAL_MAPPING, true); + current->set_texture(SpatialMaterial::TEXTURE_NORMAL, texture); + } else { + r_missing_deps->push_back(path); + } + } else if (f->eof_reached()) { + break; + } + } + + return OK; +} + +Node *EditorOBJImporter::import_scene(const String &p_path, uint32_t p_flags, int p_bake_fps, List *r_missing_deps, Error *r_err) { + + FileAccessRef f = FileAccess::open(p_path, FileAccess::READ); + + if (r_err) { + *r_err = ERR_CANT_OPEN; + } + + ERR_FAIL_COND_V(!f, NULL); + + if (r_err) { + *r_err = OK; + } + + Spatial *scene = memnew(Spatial); + + Ref mesh; + mesh.instance(); + Map > name_map; - bool generate_normals = p_options["generate/normals"]; - bool generate_tangents = p_options["generate/tangents"]; - bool flip_faces = p_options["force/flip_faces"]; - bool force_smooth = p_options["force/smooth_shading"]; - bool weld_vertices = p_options["force/weld_vertices"]; - float weld_tolerance = p_options["force/weld_tolerance"]; + bool generate_tangents = p_flags & IMPORT_GENERATE_TANGENT_ARRAYS; + bool flip_faces = false; + //bool flip_faces = p_options["force/flip_faces"]; + //bool force_smooth = p_options["force/smooth_shading"]; + //bool weld_vertices = p_options["force/weld_vertices"]; + //float weld_tolerance = p_options["force/weld_tolerance"]; + Vector vertices; Vector normals; Vector uvs; String name; + Map > > material_map; + Ref surf_tool = memnew(SurfaceTool); surf_tool->begin(Mesh::PRIMITIVE_TRIANGLES); - if (force_smooth) - surf_tool->add_smooth_group(true); - int has_index_data = false; + + String current_material_library; + String current_material; + String current_group; while (true) { @@ -115,7 +239,7 @@ Error ResourceImporterOBJ::import(const String &p_source_file, const String &p_s if (l.begins_with("v ")) { //vertex Vector v = l.split(" ", false); - ERR_FAIL_COND_V(v.size() < 4, ERR_INVALID_DATA); + ERR_FAIL_COND_V(v.size() < 4, NULL); Vector3 vtx; vtx.x = v[1].to_float(); vtx.y = v[2].to_float(); @@ -124,7 +248,7 @@ Error ResourceImporterOBJ::import(const String &p_source_file, const String &p_s } else if (l.begins_with("vt ")) { //uv Vector v = l.split(" ", false); - ERR_FAIL_COND_V(v.size() < 3, ERR_INVALID_DATA); + ERR_FAIL_COND_V(v.size() < 3, NULL); Vector2 uv; uv.x = v[1].to_float(); uv.y = 1.0 - v[2].to_float(); @@ -133,7 +257,7 @@ Error ResourceImporterOBJ::import(const String &p_source_file, const String &p_s } else if (l.begins_with("vn ")) { //normal Vector v = l.split(" ", false); - ERR_FAIL_COND_V(v.size() < 4, ERR_INVALID_DATA); + ERR_FAIL_COND_V(v.size() < 4, NULL); Vector3 nrm; nrm.x = v[1].to_float(); nrm.y = v[2].to_float(); @@ -142,21 +266,20 @@ Error ResourceImporterOBJ::import(const String &p_source_file, const String &p_s } else if (l.begins_with("f ")) { //vertex - has_index_data = true; Vector v = l.split(" ", false); - ERR_FAIL_COND_V(v.size() < 4, ERR_INVALID_DATA); + ERR_FAIL_COND_V(v.size() < 4, NULL); //not very fast, could be sped up Vector face[3]; face[0] = v[1].split("/"); face[1] = v[2].split("/"); - ERR_FAIL_COND_V(face[0].size() == 0, ERR_PARSE_ERROR); - ERR_FAIL_COND_V(face[0].size() != face[1].size(), ERR_PARSE_ERROR); + ERR_FAIL_COND_V(face[0].size() == 0, NULL); + ERR_FAIL_COND_V(face[0].size() != face[1].size(), NULL); for (int i = 2; i < v.size() - 1; i++) { face[2] = v[i + 1].split("/"); - ERR_FAIL_COND_V(face[0].size() != face[2].size(), ERR_PARSE_ERROR); + ERR_FAIL_COND_V(face[0].size() != face[2].size(), NULL); for (int j = 0; j < 3; j++) { int idx = j; @@ -169,7 +292,7 @@ Error ResourceImporterOBJ::import(const String &p_source_file, const String &p_s int norm = face[idx][2].to_int() - 1; if (norm < 0) norm += normals.size() + 1; - ERR_FAIL_INDEX_V(norm, normals.size(), ERR_PARSE_ERROR); + ERR_FAIL_INDEX_V(norm, normals.size(), NULL); surf_tool->add_normal(normals[norm]); } @@ -177,58 +300,105 @@ Error ResourceImporterOBJ::import(const String &p_source_file, const String &p_s int uv = face[idx][1].to_int() - 1; if (uv < 0) uv += uvs.size() + 1; - ERR_FAIL_INDEX_V(uv, uvs.size(), ERR_PARSE_ERROR); + ERR_FAIL_INDEX_V(uv, uvs.size(), NULL); surf_tool->add_uv(uvs[uv]); } int vtx = face[idx][0].to_int() - 1; if (vtx < 0) vtx += vertices.size() + 1; - ERR_FAIL_INDEX_V(vtx, vertices.size(), ERR_PARSE_ERROR); + ERR_FAIL_INDEX_V(vtx, vertices.size(), NULL); Vector3 vertex = vertices[vtx]; - if (weld_vertices) - vertex.snap(Vector3(weld_tolerance, weld_tolerance, weld_tolerance)); + //if (weld_vertices) + // vertex.snap(Vector3(weld_tolerance, weld_tolerance, weld_tolerance)); surf_tool->add_vertex(vertex); } face[1] = face[2]; } - } else if (l.begins_with("s ") && !force_smooth) { //smoothing + } else if (l.begins_with("s ")) { //smoothing String what = l.substr(2, l.length()).strip_edges(); if (what == "off") surf_tool->add_smooth_group(false); else surf_tool->add_smooth_group(true); + } else if (l.begins_with("g ") || l.begins_with("usemtl ") || (l.begins_with("o ") || f->eof_reached())) { //commit group to mesh - } else if (l.begins_with("o ") || f->eof_reached()) { //new surface or done - - if (has_index_data) { - //new object/surface - if (generate_normals || force_smooth) + if (surf_tool->get_vertex_array().size()) { + //another group going on, commit it + if (normals.size() == 0) { surf_tool->generate_normals(); - if (uvs.size() && (normals.size() || generate_normals) && generate_tangents) + } + + if (generate_tangents && uvs.size()) { surf_tool->generate_tangents(); + } surf_tool->index(); + + print_line("current material library " + current_material_library + " has " + itos(material_map.has(current_material_library))); + print_line("current material " + current_material + " has " + itos(material_map.has(current_material_library) && material_map[current_material_library].has(current_material))); + + if (material_map.has(current_material_library) && material_map[current_material_library].has(current_material)) { + surf_tool->set_material(material_map[current_material_library][current_material]); + } + mesh = surf_tool->commit(mesh); - if (name == "") - name = vformat(TTR("Surface %d"), mesh->get_surface_count() - 1); - mesh->surface_set_name(mesh->get_surface_count() - 1, name); - name = ""; + + if (current_material != String()) { + mesh->surface_set_name(mesh->get_surface_count() - 1, current_material.get_basename()); + } else if (current_group != String()) { + mesh->surface_set_name(mesh->get_surface_count() - 1, current_group); + } + + print_line("Added surface :" + mesh->surface_get_name(mesh->get_surface_count() - 1)); surf_tool->clear(); surf_tool->begin(Mesh::PRIMITIVE_TRIANGLES); - if (force_smooth) - surf_tool->add_smooth_group(true); - - has_index_data = false; - - if (f->eof_reached()) - break; } - if (l.begins_with("o ")) //name + if (l.begins_with("o ") || f->eof_reached()) { + + MeshInstance *mi = memnew(MeshInstance); + mi->set_name(name); + mi->set_mesh(mesh); + + scene->add_child(mi); + mi->set_owner(scene); + + mesh.instance(); + current_group = ""; + current_material = ""; + } + + if (f->eof_reached()) { + break; + } + + if (l.begins_with("o ")) { name = l.substr(2, l.length()).strip_edges(); + } + + if (l.begins_with("usemtl ")) { + + current_material = l.replace("usemtl", "").strip_edges(); + } + + if (l.begins_with("g ")) { + + current_group = l.substr(2, l.length()).strip_edges(); + } + + } else if (l.begins_with("mtllib ")) { //parse material + + current_material_library = l.replace("mtllib", "").strip_edges(); + if (!material_map.has(current_material_library)) { + Map > lib; + Error err = _parse_material_library(current_material_library, lib, r_missing_deps); + if (err == OK) { + material_map[current_material_library] = lib; + } + } } } @@ -243,10 +413,11 @@ Error ResourceImporterOBJ::import(const String &p_source_file, const String &p_s } */ - Error err = ResourceSaver::save(p_save_path + ".mesh", mesh); - - return err; + return scene; } +Ref EditorOBJImporter::import_animation(const String &p_path, uint32_t p_flags) { -ResourceImporterOBJ::ResourceImporterOBJ() { + return Ref(); +} +EditorOBJImporter::EditorOBJImporter() { } diff --git a/editor/import/resource_importer_obj.h b/editor/import/resource_importer_obj.h index b7443c71a6c..c8285ce6c9c 100644 --- a/editor/import/resource_importer_obj.h +++ b/editor/import/resource_importer_obj.h @@ -30,26 +30,21 @@ #ifndef RESOURCEIMPORTEROBJ_H #define RESOURCEIMPORTEROBJ_H -#include "io/resource_import.h" +#include "import/resource_importer_scene.h" + +class EditorOBJImporter : public EditorSceneImporter { + + GDCLASS(EditorOBJImporter, EditorSceneImporter); + + Error _parse_material_library(const String &p_path, Map > &material_map, List *r_missing_deps); -class ResourceImporterOBJ : public ResourceImporter { - GDCLASS(ResourceImporterOBJ, ResourceImporter) public: - virtual String get_importer_name() const; - virtual String get_visible_name() const; - virtual void get_recognized_extensions(List *p_extensions) const; - virtual String get_save_extension() const; - virtual String get_resource_type() const; + virtual uint32_t get_import_flags() const; + virtual void get_extensions(List *r_extensions) const; + virtual Node *import_scene(const String &p_path, uint32_t p_flags, int p_bake_fps, List *r_missing_deps, Error *r_err = NULL); + virtual Ref import_animation(const String &p_path, uint32_t p_flags); - virtual int get_preset_count() const; - virtual String get_preset_name(int p_idx) const; - - virtual void get_import_options(List *r_options, int p_preset = 0) const; - virtual bool get_option_visibility(const String &p_option, const Map &p_options) const; - - virtual Error import(const String &p_source_file, const String &p_save_path, const Map &p_options, List *r_platform_variants, List *r_gen_files = NULL); - - ResourceImporterOBJ(); + EditorOBJImporter(); }; #endif // RESOURCEIMPORTEROBJ_H diff --git a/editor/import/resource_importer_texture.cpp b/editor/import/resource_importer_texture.cpp index 3834e52fab2..7e23a422f72 100644 --- a/editor/import/resource_importer_texture.cpp +++ b/editor/import/resource_importer_texture.cpp @@ -418,24 +418,24 @@ Error ResourceImporterTexture::import(const String &p_source_file, const String if (compress_mode == COMPRESS_VIDEO_RAM) { //must import in all formats //Android, GLES 2.x - if (GlobalConfig::get_singleton()->get("rendering/vram_formats/use_s3tc")) { + if (GlobalConfig::get_singleton()->get("rendering/vram_compression/import_s3tc")) { _save_stex(image, p_save_path + ".s3tc.stex", compress_mode, lossy, Image::COMPRESS_S3TC, mipmaps, tex_flags, stream, detect_3d, detect_srgb, force_rgbe, detect_normal, force_normal); r_platform_variants->push_back("s3tc"); } - if (GlobalConfig::get_singleton()->get("rendering/vram_formats/use_etc")) { + if (GlobalConfig::get_singleton()->get("rendering/vram_compression/import_etc")) { _save_stex(image, p_save_path + ".etc.stex", compress_mode, lossy, Image::COMPRESS_ETC, mipmaps, tex_flags, stream, detect_3d, detect_srgb, force_rgbe, detect_normal, force_normal); r_platform_variants->push_back("etc"); } - if (GlobalConfig::get_singleton()->get("rendering/vram_formats/use_etc2")) { + if (GlobalConfig::get_singleton()->get("rendering/vram_compression/import_etc2")) { _save_stex(image, p_save_path + ".etc2.stex", compress_mode, lossy, Image::COMPRESS_ETC2, mipmaps, tex_flags, stream, detect_3d, detect_srgb, force_rgbe, detect_normal, force_normal); r_platform_variants->push_back("etc2"); } - if (GlobalConfig::get_singleton()->get("rendering/vram_formats/use_pvrtc")) { + if (GlobalConfig::get_singleton()->get("rendering/vram_compression/import_pvrtc")) { _save_stex(image, p_save_path + ".pvrtc.stex", compress_mode, lossy, Image::COMPRESS_PVRTC4, mipmaps, tex_flags, stream, detect_3d, detect_srgb, force_rgbe, detect_normal, force_normal); r_platform_variants->push_back("pvrtc"); diff --git a/editor/import_dock.cpp b/editor/import_dock.cpp index 6c7a633477a..24647734ce6 100644 --- a/editor/import_dock.cpp +++ b/editor/import_dock.cpp @@ -328,7 +328,6 @@ ImportDock::ImportDock() { add_child(import_opts); import_opts->set_v_size_flags(SIZE_EXPAND_FILL); import_opts->hide_top_label(); - import_opts->set_hide_script(true); hb = memnew(HBoxContainer); add_child(hb); diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp index b2d3aafd133..b059e634677 100644 --- a/editor/plugins/canvas_item_editor_plugin.cpp +++ b/editor/plugins/canvas_item_editor_plugin.cpp @@ -2007,7 +2007,7 @@ void CanvasItemEditor::_viewport_draw() { VisualServer::get_singleton()->canvas_item_add_line(ci, transform.xform(display_rotate_from), transform.xform(display_rotate_to), rotate_color); } - Size2 screen_size = Size2(GlobalConfig::get_singleton()->get("display/window/width"), GlobalConfig::get_singleton()->get("display/window/height")); + Size2 screen_size = Size2(GlobalConfig::get_singleton()->get("display/window/size/width"), GlobalConfig::get_singleton()->get("display/window/size/height")); Vector2 screen_endpoints[4] = { transform.xform(Vector2(0, 0)), @@ -2323,7 +2323,7 @@ void CanvasItemEditor::_update_scrollbars() { h_scroll->set_begin(Point2(0, size.height - hmin.height)); h_scroll->set_end(Point2(size.width - vmin.width, size.height)); - Size2 screen_rect = Size2(GlobalConfig::get_singleton()->get("display/window/width"), GlobalConfig::get_singleton()->get("display/window/height")); + Size2 screen_rect = Size2(GlobalConfig::get_singleton()->get("display/window/size/width"), GlobalConfig::get_singleton()->get("display/window/size/height")); Rect2 local_rect = Rect2(Point2(), viewport->get_size() - Size2(vmin.width, hmin.height)); diff --git a/editor/plugins/spatial_editor_plugin.cpp b/editor/plugins/spatial_editor_plugin.cpp index d7f4781e89c..58fc32309f5 100644 --- a/editor/plugins/spatial_editor_plugin.cpp +++ b/editor/plugins/spatial_editor_plugin.cpp @@ -1717,11 +1717,11 @@ void SpatialEditorViewport::_notification(int p_what) { //update shadow atlas if changed - int shadowmap_size = GlobalConfig::get_singleton()->get("rendering/shadow_atlas/size"); - int atlas_q0 = GlobalConfig::get_singleton()->get("rendering/shadow_atlas/quadrant_0_subdiv"); - int atlas_q1 = GlobalConfig::get_singleton()->get("rendering/shadow_atlas/quadrant_1_subdiv"); - int atlas_q2 = GlobalConfig::get_singleton()->get("rendering/shadow_atlas/quadrant_2_subdiv"); - int atlas_q3 = GlobalConfig::get_singleton()->get("rendering/shadow_atlas/quadrant_3_subdiv"); + int shadowmap_size = GlobalConfig::get_singleton()->get("rendering/quality/shadow_atlas/size"); + int atlas_q0 = GlobalConfig::get_singleton()->get("rendering/quality/shadow_atlas/quadrant_0_subdiv"); + int atlas_q1 = GlobalConfig::get_singleton()->get("rendering/quality/shadow_atlas/quadrant_1_subdiv"); + int atlas_q2 = GlobalConfig::get_singleton()->get("rendering/quality/shadow_atlas/quadrant_2_subdiv"); + int atlas_q3 = GlobalConfig::get_singleton()->get("rendering/quality/shadow_atlas/quadrant_3_subdiv"); viewport->set_shadow_atlas_size(shadowmap_size); viewport->set_shadow_atlas_quadrant_subdiv(0, Viewport::ShadowAtlasQuadrantSubdiv(atlas_q0)); @@ -1731,10 +1731,10 @@ void SpatialEditorViewport::_notification(int p_what) { //update msaa if changed - int msaa_mode = GlobalConfig::get_singleton()->get("rendering/quality/msaa"); + int msaa_mode = GlobalConfig::get_singleton()->get("rendering/quality/filters/msaa"); viewport->set_msaa(Viewport::MSAA(msaa_mode)); - bool hdr = GlobalConfig::get_singleton()->get("rendering/quality/hdr"); + bool hdr = GlobalConfig::get_singleton()->get("rendering/quality/depth/hdr"); viewport->set_hdr(hdr); bool show_info = view_menu->get_popup()->is_item_checked(view_menu->get_popup()->get_item_index(VIEW_INFORMATION)); @@ -1834,7 +1834,7 @@ void SpatialEditorViewport::_draw() { if (previewing) { - Size2 ss = Size2(GlobalConfig::get_singleton()->get("display/width"), GlobalConfig::get_singleton()->get("display/height")); + Size2 ss = Size2(GlobalConfig::get_singleton()->get("display/window/size/width"), GlobalConfig::get_singleton()->get("display/window/size/height")); float aspect = ss.aspect(); Size2 s = get_size(); diff --git a/editor/project_export.cpp b/editor/project_export.cpp index 355f8ba22ea..ce22ed47319 100644 --- a/editor/project_export.cpp +++ b/editor/project_export.cpp @@ -763,7 +763,7 @@ ProjectExportDialog::ProjectExportDialog() { parameters->set_name(TTR("Options")); parameters->hide_top_label(); parameters->set_v_size_flags(SIZE_EXPAND_FILL); - parameters->set_hide_script(true); + parameters->connect("property_edited", this, "_update_parameters"); VBoxContainer *resources_vb = memnew(VBoxContainer); diff --git a/editor/project_settings.cpp b/editor/project_settings.cpp index 17a35282de2..f72c6555612 100644 --- a/editor/project_settings.cpp +++ b/editor/project_settings.cpp @@ -1411,7 +1411,7 @@ ProjectSettings::ProjectSettings(EditorData *p_data) { globals_editor->get_property_editor()->set_undo_redo(EditorNode::get_singleton()->get_undo_redo()); //globals_editor->hide_top_label(); globals_editor->set_v_size_flags(Control::SIZE_EXPAND_FILL); - globals_editor->get_property_editor()->register_text_enter(search_box); + globals_editor->register_search_box(search_box); globals_editor->get_property_editor()->get_scene_tree()->connect("cell_selected", this, "_item_selected"); globals_editor->get_property_editor()->connect("property_toggled", this, "_item_checked", varray(), CONNECT_DEFERRED); globals_editor->get_property_editor()->connect("property_edited", this, "_settings_prop_edited"); diff --git a/editor/property_editor.cpp b/editor/property_editor.cpp index 8a9fd2cde5b..6fac9eb6521 100644 --- a/editor/property_editor.cpp +++ b/editor/property_editor.cpp @@ -4331,7 +4331,7 @@ PropertyEditor::PropertyEditor() { _prop_edited = "property_edited"; - hide_script = false; + hide_script = true; use_folding = false; undo_redo = NULL; @@ -4512,6 +4512,7 @@ public: void SectionedPropertyEditor::_bind_methods() { ClassDB::bind_method("_section_selected", &SectionedPropertyEditor::_section_selected); + ClassDB::bind_method("_search_changed", &SectionedPropertyEditor::_search_changed); ClassDB::bind_method("update_category_list", &SectionedPropertyEditor::update_category_list); } @@ -4609,6 +4610,10 @@ void SectionedPropertyEditor::update_category_list() { if (pi.name.find(":") != -1 || pi.name == "script" || pi.name == "resource_name" || pi.name == "resource_path") continue; + + if (search_box && search_box->get_text() != String() && pi.name.findn(search_box->get_text()) == -1) + continue; + int sp = pi.name.find("/"); if (sp == -1) pi.name = "Global/" + pi.name; @@ -4616,7 +4621,9 @@ void SectionedPropertyEditor::update_category_list() { Vector sectionarr = pi.name.split("/"); String metasection; - for (int i = 0; i < MIN(2, sectionarr.size() - 1); i++) { + int sc = MIN(2, sectionarr.size() - 1); + + for (int i = 0; i < sc; i++) { TreeItem *parent = section_map[metasection]; @@ -4631,6 +4638,12 @@ void SectionedPropertyEditor::update_category_list() { section_map[metasection] = ms; ms->set_text(0, sectionarr[i].capitalize()); ms->set_metadata(0, metasection); + ms->set_selectable(0, false); + } + + if (i == sc - 1) { + //if it has children, make selectable + section_map[metasection]->set_selectable(0, true); } } } @@ -4640,6 +4653,18 @@ void SectionedPropertyEditor::update_category_list() { } } +void SectionedPropertyEditor::register_search_box(LineEdit *p_box) { + + search_box = p_box; + editor->register_text_enter(p_box); + search_box->connect("text_changed", this, "_search_changed"); +} + +void SectionedPropertyEditor::_search_changed(const String &p_what) { + + update_category_list(); +} + PropertyEditor *SectionedPropertyEditor::get_property_editor() { return editor; @@ -4649,6 +4674,8 @@ SectionedPropertyEditor::SectionedPropertyEditor() { obj = -1; + search_box = NULL; + VBoxContainer *left_vb = memnew(VBoxContainer); left_vb->set_custom_minimum_size(Size2(160, 0) * EDSCALE); add_child(left_vb); diff --git a/editor/property_editor.h b/editor/property_editor.h index 47bd807c3f5..1ae44e473b3 100644 --- a/editor/property_editor.h +++ b/editor/property_editor.h @@ -1,4 +1,4 @@ -/*************************************************************************/ +/*************************************************************************/ /* property_editor.h */ /*************************************************************************/ /* This file is part of: */ @@ -307,11 +307,15 @@ class SectionedPropertyEditor : public HBoxContainer { Map section_map; PropertyEditor *editor; + LineEdit *search_box; static void _bind_methods(); void _section_selected(); + void _search_changed(const String &p_what); + public: + void register_search_box(LineEdit *p_box); PropertyEditor *get_property_editor(); void edit(Object *p_object); String get_full_item_path(const String &p_item); diff --git a/editor/settings_config_dialog.cpp b/editor/settings_config_dialog.cpp index 6f613981b88..6c64f3af42b 100644 --- a/editor/settings_config_dialog.cpp +++ b/editor/settings_config_dialog.cpp @@ -332,7 +332,7 @@ EditorSettingsDialog::EditorSettingsDialog() { property_editor = memnew(SectionedPropertyEditor); //property_editor->hide_top_label(); property_editor->get_property_editor()->set_use_filter(true); - property_editor->get_property_editor()->register_text_enter(search_box); + property_editor->register_search_box(search_box); property_editor->set_v_size_flags(Control::SIZE_EXPAND_FILL); vbc->add_child(property_editor); property_editor->get_property_editor()->connect("property_edited", this, "_settings_property_edited"); diff --git a/main/main.cpp b/main/main.cpp index e292a209825..ece54e7427a 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -578,9 +578,8 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph I = N; } - GLOBAL_DEF("memory/multithread/thread_rid_pool_prealloc", 60); - - GLOBAL_DEF("network/debug/max_remote_stdout_chars_per_second", 2048); + GLOBAL_DEF("memory/limits/multithreaded_server/rid_pool_prealloc", 60); + GLOBAL_DEF("network/limits/debugger_stdout/max_chars_per_second", 2048); if (debug_mode == "remote") { @@ -666,10 +665,10 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph use_custom_res = false; } - if (bool(GlobalConfig::get_singleton()->get("application/disable_stdout"))) { + if (bool(GlobalConfig::get_singleton()->get("application/run/disable_stdout"))) { quiet_stdout = true; } - if (bool(GlobalConfig::get_singleton()->get("application/disable_stderr"))) { + if (bool(GlobalConfig::get_singleton()->get("application/run/disable_stderr"))) { _print_error_enabled = false; }; @@ -680,7 +679,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph #ifdef TOOLS_ENABLED - if (main_args.size() == 0 && (!GlobalConfig::get_singleton()->has("application/main_loop_type")) && (!GlobalConfig::get_singleton()->has("application/main_scene") || String(GlobalConfig::get_singleton()->get("application/main_scene")) == "")) + if (main_args.size() == 0 && (!GlobalConfig::get_singleton()->has("application/run/main_loop_type")) && (!GlobalConfig::get_singleton()->has("application/main_scene") || String(GlobalConfig::get_singleton()->get("application/main_scene")) == "")) use_custom_res = false; //project manager (run without arguments) #endif @@ -690,43 +689,43 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph else input_map->load_from_globals(); //keys for game - if (video_driver == "") // specified in project.godot - video_driver = GLOBAL_DEF("display/driver/name", Variant((const char *)OS::get_singleton()->get_video_driver_name(0))); + //if (video_driver == "") // useless for now, so removing + // video_driver = GLOBAL_DEF("display/driver/name", Variant((const char *)OS::get_singleton()->get_video_driver_name(0))); - if (!force_res && use_custom_res && globals->has("display/window/width")) - video_mode.width = globals->get("display/window/width"); - if (!force_res && use_custom_res && globals->has("display/window/height")) - video_mode.height = globals->get("display/window/height"); - if (!editor && ((globals->has("display/window/allow_hidpi") && !globals->get("display/window/allow_hidpi")) || force_lowdpi)) { + if (!force_res && use_custom_res && globals->has("display/window/size/width")) + video_mode.width = globals->get("display/window/size/width"); + if (!force_res && use_custom_res && globals->has("display/window/size/height")) + video_mode.height = globals->get("display/window/size/height"); + if (!editor && ((globals->has("display/window/dpi/allow_hidpi") && !globals->get("display/window/dpi/allow_hidpi")) || force_lowdpi)) { OS::get_singleton()->_allow_hidpi = false; } - if (use_custom_res && globals->has("display/window/fullscreen")) - video_mode.fullscreen = globals->get("display/window/fullscreen"); - if (use_custom_res && globals->has("display/window/resizable")) - video_mode.resizable = globals->get("display/window/resizable"); - if (use_custom_res && globals->has("display/window/borderless")) - video_mode.borderless_window = globals->get("display/window/borderless"); + if (use_custom_res && globals->has("display/window/size/fullscreen")) + video_mode.fullscreen = globals->get("display/window/size/fullscreen"); + if (use_custom_res && globals->has("display/window/size/resizable")) + video_mode.resizable = globals->get("display/window/size/resizable"); + if (use_custom_res && globals->has("display/window/size/borderless")) + video_mode.borderless_window = globals->get("display/window/size/borderless"); - if (!force_res && use_custom_res && globals->has("display/window/test_width") && globals->has("display/window/test_height")) { - int tw = globals->get("display/window/test_width"); - int th = globals->get("display/window/test_height"); + if (!force_res && use_custom_res && globals->has("display/window/size/test_width") && globals->has("display/window/size/test_height")) { + int tw = globals->get("display/window/size/test_width"); + int th = globals->get("display/window/size/test_height"); if (tw > 0 && th > 0) { video_mode.width = tw; video_mode.height = th; } } - GLOBAL_DEF("display/window/width", video_mode.width); - GLOBAL_DEF("display/window/height", video_mode.height); - GLOBAL_DEF("display/window/allow_hidpi", false); - GLOBAL_DEF("display/window/fullscreen", video_mode.fullscreen); - GLOBAL_DEF("display/window/resizable", video_mode.resizable); - GLOBAL_DEF("display/window/borderless", video_mode.borderless_window); - use_vsync = GLOBAL_DEF("display/window/use_vsync", use_vsync); - GLOBAL_DEF("display/window/test_width", 0); - GLOBAL_DEF("display/window/test_height", 0); - Engine::get_singleton()->_pixel_snap = GLOBAL_DEF("rendering/2d/use_pixel_snap", false); - OS::get_singleton()->_keep_screen_on = GLOBAL_DEF("display/energy_saving/keep_screen_on", true); + GLOBAL_DEF("display/window/size/width", video_mode.width); + GLOBAL_DEF("display/window/size/height", video_mode.height); + GLOBAL_DEF("display/window/dpi/allow_hidpi", false); + GLOBAL_DEF("display/window/size/fullscreen", video_mode.fullscreen); + GLOBAL_DEF("display/window/size/resizable", video_mode.resizable); + GLOBAL_DEF("display/window/size/borderless", video_mode.borderless_window); + use_vsync = GLOBAL_DEF("display/window/vsync/use_vsync", use_vsync); + GLOBAL_DEF("display/window/size/test_width", 0); + GLOBAL_DEF("display/window/size/test_height", 0); + Engine::get_singleton()->_pixel_snap = GLOBAL_DEF("rendering/quality/2d/use_pixel_snap", false); + OS::get_singleton()->_keep_screen_on = GLOBAL_DEF("display/window/energy_saving/keep_screen_on", true); if (rtm == -1) { rtm = GLOBAL_DEF("rendering/threads/thread_model", OS::RENDER_THREAD_SAFE); if (rtm >= 1) //hack for now @@ -757,7 +756,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph if (video_driver_idx < 0) { - OS::get_singleton()->alert("Invalid Video Driver: " + video_driver); + //OS::get_singleton()->alert("Invalid Video Driver: " + video_driver); video_driver_idx = 0; //goto error; } @@ -779,7 +778,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph } { - String orientation = GLOBAL_DEF("display/handheld/orientation", "landscape"); + String orientation = GLOBAL_DEF("display/window/handheld/orientation", "landscape"); if (orientation == "portrait") OS::get_singleton()->set_screen_orientation(OS::SCREEN_PORTRAIT); @@ -798,15 +797,15 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph } Engine::get_singleton()->set_iterations_per_second(GLOBAL_DEF("physics/common/fixed_fps", 60)); - Engine::get_singleton()->set_target_fps(GLOBAL_DEF("debug/fps/force_fps", 0)); + Engine::get_singleton()->set_target_fps(GLOBAL_DEF("debug/settings/fps/force_fps", 0)); - GLOBAL_DEF("debug/stdout/print_fps", OS::get_singleton()->is_stdout_verbose()); + GLOBAL_DEF("debug/settings/stdout/print_fps", OS::get_singleton()->is_stdout_verbose()); if (!OS::get_singleton()->_verbose_stdout) //overrided - OS::get_singleton()->_verbose_stdout = GLOBAL_DEF("debug/stdout/verbose_stdout", false); + OS::get_singleton()->_verbose_stdout = GLOBAL_DEF("debug/settings/stdout/verbose_stdout", false); if (frame_delay == 0) { - frame_delay = GLOBAL_DEF("application/frame_delay_msec", 0); + frame_delay = GLOBAL_DEF("application/run/frame_delay_msec", 0); } Engine::get_singleton()->set_frame_delay(frame_delay); @@ -908,13 +907,13 @@ Error Main::setup2() { MAIN_PRINT("Main: Load Remaps"); - Color clear = GLOBAL_DEF("rendering/viewport/default_clear_color", Color(0.3, 0.3, 0.3)); + Color clear = GLOBAL_DEF("rendering/environment/default_clear_color", Color(0.3, 0.3, 0.3)); VisualServer::get_singleton()->set_default_clear_color(clear); if (show_logo) { //boot logo! - String boot_logo_path = GLOBAL_DEF("application/boot_splash", String()); - bool boot_logo_scale = GLOBAL_DEF("application/boot_splash_fullsize", true); - GlobalConfig::get_singleton()->set_custom_property_info("application/boot_splash", PropertyInfo(Variant::STRING, "application/boot_splash", PROPERTY_HINT_FILE, "*.png")); + String boot_logo_path = GLOBAL_DEF("application/boot_splash/image", String()); + bool boot_logo_scale = GLOBAL_DEF("application/boot_splash/fullsize", true); + GlobalConfig::get_singleton()->set_custom_property_info("application/boot_splash/image", PropertyInfo(Variant::STRING, "application/boot_splash/image", PROPERTY_HINT_FILE, "*.png")); Ref boot_logo; @@ -930,7 +929,7 @@ Error Main::setup2() { if (boot_logo.is_valid()) { OS::get_singleton()->_msec_splash = OS::get_singleton()->get_ticks_msec(); - Color boot_bg = GLOBAL_DEF("application/boot_bg_color", clear); + Color boot_bg = GLOBAL_DEF("application/boot_splash/bg_color", clear); VisualServer::get_singleton()->set_boot_image(boot_logo, boot_bg, boot_logo_scale); #ifndef TOOLS_ENABLED //no tools, so free the boot logo (no longer needed) @@ -955,13 +954,13 @@ Error Main::setup2() { } MAIN_PRINT("Main: DCC"); - VisualServer::get_singleton()->set_default_clear_color(GLOBAL_DEF("rendering/viewport/default_clear_color", Color(0.3, 0.3, 0.3))); + VisualServer::get_singleton()->set_default_clear_color(GLOBAL_DEF("rendering/environment/default_clear_color", Color(0.3, 0.3, 0.3))); MAIN_PRINT("Main: END"); - GLOBAL_DEF("application/icon", String()); - GlobalConfig::get_singleton()->set_custom_property_info("application/icon", PropertyInfo(Variant::STRING, "application/icon", PROPERTY_HINT_FILE, "*.png,*.webp")); + GLOBAL_DEF("application/config/icon", String()); + GlobalConfig::get_singleton()->set_custom_property_info("application/config/icon", PropertyInfo(Variant::STRING, "application/config/icon", PROPERTY_HINT_FILE, "*.png,*.webp")); - if (bool(GLOBAL_DEF("display/handheld/emulate_touchscreen", false))) { + if (bool(GLOBAL_DEF("display/window/handheld/emulate_touchscreen", false))) { if (!OS::get_singleton()->has_touchscreen_ui_hint() && Input::get_singleton() && !editor) { //only if no touchscreen ui hint, set emulation InputDefault *id = Input::get_singleton()->cast_to(); @@ -1145,8 +1144,8 @@ bool Main::start() { } } - if (script == "" && game_path == "" && String(GLOBAL_DEF("application/main_scene", "")) != "") { - game_path = GLOBAL_DEF("application/main_scene", ""); + if (script == "" && game_path == "" && String(GLOBAL_DEF("application/run/main_scene", "")) != "") { + game_path = GLOBAL_DEF("application/run/main_scene", ""); } MainLoop *main_loop = NULL; @@ -1189,7 +1188,7 @@ bool Main::start() { } } else { - main_loop_type = GLOBAL_DEF("application/main_loop_type", ""); + main_loop_type = GLOBAL_DEF("application/run/main_loop_type", ""); } if (!main_loop && main_loop_type == "") @@ -1249,12 +1248,15 @@ bool Main::start() { } #endif + { + } + if (!editor) { //standard helpers that can be changed from main config - String stretch_mode = GLOBAL_DEF("display/stretch/mode", "disabled"); - String stretch_aspect = GLOBAL_DEF("display/stretch/aspect", "ignore"); - Size2i stretch_size = Size2(GLOBAL_DEF("display/window/width", 0), GLOBAL_DEF("display/window/height", 0)); + String stretch_mode = GLOBAL_DEF("display/window/stretch/mode", "disabled"); + String stretch_aspect = GLOBAL_DEF("display/window/stretch/aspect", "ignore"); + Size2i stretch_size = Size2(GLOBAL_DEF("display/window/size/width", 0), GLOBAL_DEF("display/window/size/height", 0)); SceneTree::StretchMode sml_sm = SceneTree::STRETCH_MODE_DISABLED; if (stretch_mode == "2d") @@ -1272,17 +1274,17 @@ bool Main::start() { sml->set_screen_stretch(sml_sm, sml_aspect, stretch_size); - sml->set_auto_accept_quit(GLOBAL_DEF("application/auto_accept_quit", true)); - sml->set_quit_on_go_back(GLOBAL_DEF("application/quit_on_go_back", true)); - String appname = GlobalConfig::get_singleton()->get("application/name"); + sml->set_auto_accept_quit(GLOBAL_DEF("application/config/auto_accept_quit", true)); + sml->set_quit_on_go_back(GLOBAL_DEF("application/config/quit_on_go_back", true)); + String appname = GlobalConfig::get_singleton()->get("application/config/name"); appname = TranslationServer::get_singleton()->translate(appname); OS::get_singleton()->set_window_title(appname); - int shadow_atlas_size = GLOBAL_DEF("rendering/shadow_atlas/size", 2048); - int shadow_atlas_q0_subdiv = GLOBAL_DEF("rendering/shadow_atlas/quadrant_0_subdiv", 2); - int shadow_atlas_q1_subdiv = GLOBAL_DEF("rendering/shadow_atlas/quadrant_1_subdiv", 2); - int shadow_atlas_q2_subdiv = GLOBAL_DEF("rendering/shadow_atlas/quadrant_2_subdiv", 3); - int shadow_atlas_q3_subdiv = GLOBAL_DEF("rendering/shadow_atlas/quadrant_3_subdiv", 4); + int shadow_atlas_size = GLOBAL_GET("rendering/quality/shadow_atlas/size"); + int shadow_atlas_q0_subdiv = GLOBAL_GET("rendering/quality/shadow_atlas/quadrant_0_subdiv"); + int shadow_atlas_q1_subdiv = GLOBAL_GET("rendering/quality/shadow_atlas/quadrant_1_subdiv"); + int shadow_atlas_q2_subdiv = GLOBAL_GET("rendering/quality/shadow_atlas/quadrant_2_subdiv"); + int shadow_atlas_q3_subdiv = GLOBAL_GET("rendering/quality/shadow_atlas/quadrant_3_subdiv"); sml->get_root()->set_shadow_atlas_size(shadow_atlas_size); sml->get_root()->set_shadow_atlas_quadrant_subdiv(0, Viewport::ShadowAtlasQuadrantSubdiv(shadow_atlas_q0_subdiv)); @@ -1291,24 +1293,12 @@ bool Main::start() { sml->get_root()->set_shadow_atlas_quadrant_subdiv(3, Viewport::ShadowAtlasQuadrantSubdiv(shadow_atlas_q3_subdiv)); } else { - GLOBAL_DEF("display/stretch/mode", "disabled"); - GlobalConfig::get_singleton()->set_custom_property_info("display/stretch/mode", PropertyInfo(Variant::STRING, "display/stretch/mode", PROPERTY_HINT_ENUM, "disabled,2d,viewport")); - GLOBAL_DEF("display/stretch/aspect", "ignore"); - GlobalConfig::get_singleton()->set_custom_property_info("display/stretch/aspect", PropertyInfo(Variant::STRING, "display/stretch/aspect", PROPERTY_HINT_ENUM, "ignore,keep,keep_width,keep_height")); - sml->set_auto_accept_quit(GLOBAL_DEF("application/auto_accept_quit", true)); - sml->set_quit_on_go_back(GLOBAL_DEF("application/quit_on_go_back", true)); - - GLOBAL_DEF("rendering/shadow_atlas/size", 2048); - GlobalConfig::get_singleton()->set_custom_property_info("rendering/shadow_atlas/size", PropertyInfo(Variant::INT, "rendering/shadow_atlas/size", PROPERTY_HINT_RANGE, "256,16384")); - - GLOBAL_DEF("rendering/shadow_atlas/quadrant_0_subdiv", 2); - GLOBAL_DEF("rendering/shadow_atlas/quadrant_1_subdiv", 2); - GLOBAL_DEF("rendering/shadow_atlas/quadrant_2_subdiv", 3); - GLOBAL_DEF("rendering/shadow_atlas/quadrant_3_subdiv", 4); - GlobalConfig::get_singleton()->set_custom_property_info("rendering/shadow_atlas/quadrant_0_subdiv", PropertyInfo(Variant::INT, "rendering/shadow_atlas/quadrant_0_subdiv", PROPERTY_HINT_ENUM, "Disabled,1 Shadow,4 Shadows,16 Shadows,64 Shadows,256 Shadows,1024 Shadows")); - GlobalConfig::get_singleton()->set_custom_property_info("rendering/shadow_atlas/quadrant_1_subdiv", PropertyInfo(Variant::INT, "rendering/shadow_atlas/quadrant_1_subdiv", PROPERTY_HINT_ENUM, "Disabled,1 Shadow,4 Shadows,16 Shadows,64 Shadows,256 Shadows,1024 Shadows")); - GlobalConfig::get_singleton()->set_custom_property_info("rendering/shadow_atlas/quadrant_2_subdiv", PropertyInfo(Variant::INT, "rendering/shadow_atlas/quadrant_2_subdiv", PROPERTY_HINT_ENUM, "Disabled,1 Shadow,4 Shadows,16 Shadows,64 Shadows,256 Shadows,1024 Shadows")); - GlobalConfig::get_singleton()->set_custom_property_info("rendering/shadow_atlas/quadrant_3_subdiv", PropertyInfo(Variant::INT, "rendering/shadow_atlas/quadrant_3_subdiv", PROPERTY_HINT_ENUM, "Disabled,1 Shadow,4 Shadows,16 Shadows,64 Shadows,256 Shadows,1024 Shadows")); + GLOBAL_DEF("display/window/stretch/mode", "disabled"); + GlobalConfig::get_singleton()->set_custom_property_info("display/window/stretch/mode", PropertyInfo(Variant::STRING, "display/window/stretch/mode", PROPERTY_HINT_ENUM, "disabled,2d,viewport")); + GLOBAL_DEF("display/window/stretch/aspect", "ignore"); + GlobalConfig::get_singleton()->set_custom_property_info("display/window/stretch/aspect", PropertyInfo(Variant::STRING, "display/window/stretch/aspect", PROPERTY_HINT_ENUM, "ignore,keep,keep_width,keep_height")); + sml->set_auto_accept_quit(GLOBAL_DEF("application/config/auto_accept_quit", true)); + sml->set_quit_on_go_back(GLOBAL_DEF("application/config/quit_on_go_back", true)); } String local_game_path; @@ -1463,7 +1453,7 @@ bool Main::start() { //sml->get_root()->add_child(scene); sml->add_current_scene(scene); - String iconpath = GLOBAL_DEF("application/icon", "Variant()"); + String iconpath = GLOBAL_DEF("application/config/icon", "Variant()"); if (iconpath != "") { Ref icon; if (icon->load(iconpath) == OK) @@ -1641,7 +1631,7 @@ bool Main::iteration() { if (frame > 1000000) { - if (GLOBAL_DEF("debug/stdout/print_fps", OS::get_singleton()->is_stdout_verbose())) { + if (GLOBAL_DEF("debug/settings/stdout/print_fps", OS::get_singleton()->is_stdout_verbose())) { print_line("FPS: " + itos(frames)); }; diff --git a/modules/gdscript/gd_script.cpp b/modules/gdscript/gd_script.cpp index 1dcc442234c..0afb6ac179d 100644 --- a/modules/gdscript/gd_script.cpp +++ b/modules/gdscript/gd_script.cpp @@ -1885,7 +1885,7 @@ GDScriptLanguage::GDScriptLanguage() { script_frame_time = 0; _debug_call_stack_pos = 0; - int dmcs = GLOBAL_DEF("debug/script/max_call_stack", 1024); + int dmcs = GLOBAL_DEF("debug/settings/gdscript/max_call_stack", 1024); if (ScriptDebugger::get_singleton()) { //debugging enabled! diff --git a/modules/visual_script/visual_script.cpp b/modules/visual_script/visual_script.cpp index a922fdf3544..84b4b0cab1b 100644 --- a/modules/visual_script/visual_script.cpp +++ b/modules/visual_script/visual_script.cpp @@ -2658,7 +2658,7 @@ VisualScriptLanguage::VisualScriptLanguage() { _debug_parse_err_node = -1; _debug_parse_err_file = ""; _debug_call_stack_pos = 0; - int dmcs = GLOBAL_DEF("debug/script/max_call_stack", 1024); + int dmcs = GLOBAL_DEF("debug/settings/visual_script/max_call_stack", 1024); if (ScriptDebugger::get_singleton()) { //debugging enabled! _debug_max_call_stack = dmcs; diff --git a/platform/android/export/export.cpp b/platform/android/export/export.cpp index a72e8aa90e2..95f48521f8a 100644 --- a/platform/android/export/export.cpp +++ b/platform/android/export/export.cpp @@ -554,7 +554,7 @@ void EditorExportPlatformAndroid::_fix_resources(Vector& p_manifest) { } else { String lang = str.substr(str.find_last("-")+1,str.length()).replace("-","_"); - String prop = "application/name_"+lang; + String prop = "application/config/name_"+lang; if (GlobalConfig::get_singleton()->has(prop)) { str = GlobalConfig::get_singleton()->get(prop); } else { @@ -628,7 +628,7 @@ String EditorExportPlatformAndroid::get_project_name() const { if (this->name!="") { aname=this->name; } else { - aname = GlobalConfig::get_singleton()->get("application/name"); + aname = GlobalConfig::get_singleton()->get("application/config/name"); } @@ -1144,7 +1144,7 @@ Error EditorExportPlatformAndroid::export_project(const String& p_path, bool p_d if (!found) { - String appicon = GlobalConfig::get_singleton()->get("application/icon"); + String appicon = GlobalConfig::get_singleton()->get("application/config/icon"); if (appicon!="" && appicon.ends_with(".png")) { FileAccess*f = FileAccess::open(appicon,FileAccess::READ); if (f) { @@ -1763,7 +1763,7 @@ Error EditorExportPlatformAndroid::run(int p_device, int p_flags) { String EditorExportPlatformAndroid::get_package_name() { String pname = package; - String basename = GlobalConfig::get_singleton()->get("application/name"); + String basename = GlobalConfig::get_singleton()->get("application/config/name"); basename=basename.to_lower(); String name; @@ -2208,7 +2208,7 @@ class EditorExportAndroid : public EditorExportPlatform { if (p_name != "") { aname = p_name; } else { - aname = GlobalConfig::get_singleton()->get("application/name"); + aname = GlobalConfig::get_singleton()->get("application/config/name"); } if (aname == "") { @@ -2221,7 +2221,7 @@ class EditorExportAndroid : public EditorExportPlatform { String get_package_name(const String &p_package) { String pname = p_package; - String basename = GlobalConfig::get_singleton()->get("application/name"); + String basename = GlobalConfig::get_singleton()->get("application/config/name"); basename = basename.to_lower(); String name; @@ -2750,7 +2750,7 @@ class EditorExportAndroid : public EditorExportPlatform { } else { String lang = str.substr(str.find_last("-") + 1, str.length()).replace("-", "_"); - String prop = "application/name_" + lang; + String prop = "application/config/name_" + lang; if (GlobalConfig::get_singleton()->has(prop)) { str = GlobalConfig::get_singleton()->get(prop); } else { @@ -3219,7 +3219,7 @@ public: if (!found) { - String appicon = GlobalConfig::get_singleton()->get("application/icon"); + String appicon = GlobalConfig::get_singleton()->get("application/config/icon"); if (appicon != "" && appicon.ends_with(".png")) { FileAccess *f = FileAccess::open(appicon, FileAccess::READ); if (f) { diff --git a/platform/android/java/src/org/godotengine/godot/Godot.java b/platform/android/java/src/org/godotengine/godot/Godot.java index 88928089b6e..d620b2b9c43 100644 --- a/platform/android/java/src/org/godotengine/godot/Godot.java +++ b/platform/android/java/src/org/godotengine/godot/Godot.java @@ -273,7 +273,7 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC mView = new GodotView(getApplication(),io,use_gl2,use_32_bits, this); layout.addView(mView,new LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.FILL_PARENT)); - setKeepScreenOn(GodotLib.getGlobal("display/keep_screen_on").equals("True")); + setKeepScreenOn(GodotLib.getGlobal("display/driver/keep_screen_on").equals("True")); edittext.setView(mView); io.setEdit(edittext); diff --git a/platform/iphone/app_delegate.mm b/platform/iphone/app_delegate.mm index 1f81f0f86ef..b6cd43b3a2c 100644 --- a/platform/iphone/app_delegate.mm +++ b/platform/iphone/app_delegate.mm @@ -29,11 +29,11 @@ /*************************************************************************/ #import "app_delegate.h" +#include "audio_driver_iphone.h" #include "core/global_config.h" #import "gl_view.h" #include "main/main.h" #include "os_iphone.h" -#include "audio_driver_iphone.h" #ifdef MODULE_FACEBOOKSCORER_IOS_ENABLED #include "modules/FacebookScorer_ios/FacebookScorer.h" @@ -615,7 +615,7 @@ static int frame_count = 0; view_controller.view = glView; window.rootViewController = view_controller; - _set_keep_screen_on(bool(GLOBAL_DEF("display/keep_screen_on", true)) ? YES : NO); + _set_keep_screen_on(bool(GLOBAL_DEF("display/window/keep_screen_on", true)) ? YES : NO); glView.useCADisplayLink = bool(GLOBAL_DEF("display.iOS/use_cadisplaylink", true)) ? YES : NO; printf("cadisaplylink: %d", glView.useCADisplayLink); @@ -673,7 +673,6 @@ static int frame_count = 0; isAdvertisingTrackingEnabled]]; #endif - }; - (void)applicationWillTerminate:(UIApplication *)application { @@ -737,7 +736,7 @@ static int frame_count = 0; }; // Fixed audio can not resume if it is interrupted cause by an incoming phone call - if(AudioDriverIphone::get_singleton() != NULL) + if (AudioDriverIphone::get_singleton() != NULL) AudioDriverIphone::get_singleton()->start(); } diff --git a/platform/osx/export/export.cpp b/platform/osx/export/export.cpp index c81fb00b368..ca5535f7717 100644 --- a/platform/osx/export/export.cpp +++ b/platform/osx/export/export.cpp @@ -345,7 +345,7 @@ Error EditorExportPlatformOSX::export_project(const Ref &p_p if (p_preset->get("application/icon") != "") iconpath = p_preset->get("application/icon"); else - iconpath = GlobalConfig::get_singleton()->get("application/icon"); + iconpath = GlobalConfig::get_singleton()->get("application/config/icon"); print_line("icon? " + iconpath); if (iconpath != "") { Ref icon; @@ -484,8 +484,8 @@ Error EditorExportPlatformOSX::export_project(const Ref &p_p String pkg_name; if (p_preset->get("application/name") != "") pkg_name = p_preset->get("application/name"); // app_name - else if (String(GlobalConfig::get_singleton()->get("application/name")) != "") - pkg_name = String(GlobalConfig::get_singleton()->get("application/name")); + else if (String(GlobalConfig::get_singleton()->get("application/config/name")) != "") + pkg_name = String(GlobalConfig::get_singleton()->get("application/config/name")); else pkg_name = "Unnamed"; @@ -539,7 +539,7 @@ Error EditorExportPlatformOSX::export_project(const Ref &p_p if (p_preset->get("application/icon") != "") iconpath = p_preset->get("application/icon"); else - iconpath = GlobalConfig::get_singleton()->get("application/icon"); + iconpath = GlobalConfig::get_singleton()->get("application/config/icon"); print_line("icon? " + iconpath); if (iconpath != "") { Ref icon; diff --git a/platform/uwp/os_uwp.cpp b/platform/uwp/os_uwp.cpp index 28aaf9161bb..b9ef778e012 100644 --- a/platform/uwp/os_uwp.cpp +++ b/platform/uwp/os_uwp.cpp @@ -310,7 +310,7 @@ void OSUWP::initialize(const VideoMode &p_desired, int p_video_driver, int p_aud if (is_keep_screen_on()) display_request->RequestActive(); - set_keep_screen_on(GLOBAL_DEF("display/keep_screen_on", true)); + set_keep_screen_on(GLOBAL_DEF("display/window/keep_screen_on", true)); } void OSUWP::set_clipboard(const String &p_text) { diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp index 2daf580c0df..36d6cd85654 100644 --- a/platform/windows/os_windows.cpp +++ b/platform/windows/os_windows.cpp @@ -2229,7 +2229,7 @@ String OS_Windows::get_data_dir() const { if (has_environment("APPDATA")) { - bool use_godot = GlobalConfig::get_singleton()->get("application/use_shared_user_dir"); + bool use_godot = GlobalConfig::get_singleton()->get("application/config/use_shared_user_dir"); if (!use_godot) return (OS::get_singleton()->get_environment("APPDATA") + "/" + an).replace("\\", "/"); else diff --git a/scene/main/scene_tree.cpp b/scene/main/scene_tree.cpp index 1e5735de973..65c7c1a36f8 100644 --- a/scene/main/scene_tree.cpp +++ b/scene/main/scene_tree.cpp @@ -614,7 +614,7 @@ bool SceneTree::idle(float p_time) { if (is_editor_hint()) { //simple hack to reload fallback environment if it changed from editor - String env_path = GlobalConfig::get_singleton()->get("rendering/viewport/default_environment"); + String env_path = GlobalConfig::get_singleton()->get("rendering/environment/default_environment"); env_path = env_path.strip_edges(); //user may have added a space or two String cpath; Ref fallback = get_root()->get_world()->get_fallback_environment(); @@ -2317,11 +2317,11 @@ SceneTree::SceneTree() { debug_collisions_hint = false; debug_navigation_hint = false; #endif - debug_collisions_color = GLOBAL_DEF("debug/collision/shape_color", Color(0.0, 0.6, 0.7, 0.5)); - debug_collision_contact_color = GLOBAL_DEF("debug/collision/contact_color", Color(1.0, 0.2, 0.1, 0.8)); - debug_navigation_color = GLOBAL_DEF("debug/navigation/geometry_color", Color(0.1, 1.0, 0.7, 0.4)); - debug_navigation_disabled_color = GLOBAL_DEF("debug/navigation/disabled_geometry_color", Color(1.0, 0.7, 0.1, 0.4)); - collision_debug_contacts = GLOBAL_DEF("debug/collision/max_contacts_displayed", 10000); + debug_collisions_color = GLOBAL_DEF("debug/shapes/collision/shape_color", Color(0.0, 0.6, 0.7, 0.5)); + debug_collision_contact_color = GLOBAL_DEF("debug/shapes/collision/contact_color", Color(1.0, 0.2, 0.1, 0.8)); + debug_navigation_color = GLOBAL_DEF("debug/shapes/navigation/geometry_color", Color(0.1, 1.0, 0.7, 0.4)); + debug_navigation_disabled_color = GLOBAL_DEF("debug/shapes/navigation/disabled_geometry_color", Color(1.0, 0.7, 0.1, 0.4)); + collision_debug_contacts = GLOBAL_DEF("debug/shapes/collision/max_contacts_displayed", 10000); tree_version = 1; fixed_process_time = 1; @@ -2348,12 +2348,12 @@ SceneTree::SceneTree() { root->set_as_audio_listener_2d(true); current_scene = NULL; - int ref_atlas_size = GLOBAL_DEF("rendering/reflections/atlas_size", 2048); - int ref_atlas_subdiv = GLOBAL_DEF("rendering/reflections/atlas_subdiv", 8); - int msaa_mode = GLOBAL_DEF("rendering/quality/msaa", 0); - GlobalConfig::get_singleton()->set_custom_property_info("rendering/quality/msaa", PropertyInfo(Variant::INT, "rendering/quality/msaa", PROPERTY_HINT_ENUM, "Disabled,2x,4x,8x,16x")); + int ref_atlas_size = GLOBAL_DEF("rendering/quality/reflections/atlas_size", 2048); + int ref_atlas_subdiv = GLOBAL_DEF("rendering/quality/reflections/atlas_subdiv", 8); + int msaa_mode = GLOBAL_DEF("rendering/quality/filters/msaa", 0); + GlobalConfig::get_singleton()->set_custom_property_info("rendering/quality/filters/msaa", PropertyInfo(Variant::INT, "rendering/quality/filters/msaa", PROPERTY_HINT_ENUM, "Disabled,2x,4x,8x,16x")); root->set_msaa(Viewport::MSAA(msaa_mode)); - bool hdr = GLOBAL_DEF("rendering/quality/hdr", true); + bool hdr = GLOBAL_DEF("rendering/quality/depth/hdr", true); root->set_hdr(hdr); VS::get_singleton()->scenario_set_reflection_atlas_size(root->get_world()->get_scenario(), ref_atlas_size, ref_atlas_subdiv); @@ -2369,9 +2369,9 @@ SceneTree::SceneTree() { ext_hint += "*." + E->get(); } //get path - String env_path = GLOBAL_DEF("rendering/viewport/default_environment", ""); + String env_path = GLOBAL_DEF("rendering/environment/default_environment", ""); //setup property - GlobalConfig::get_singleton()->set_custom_property_info("rendering/viewport/default_environment", PropertyInfo(Variant::STRING, "rendering/viewport/default_environment", PROPERTY_HINT_FILE, ext_hint)); + GlobalConfig::get_singleton()->set_custom_property_info("rendering/environment/default_environment", PropertyInfo(Variant::STRING, "rendering/viewport/default_environment", PROPERTY_HINT_FILE, ext_hint)); env_path = env_path.strip_edges(); if (env_path != String()) { Ref env = ResourceLoader::load(env_path); @@ -2380,7 +2380,7 @@ SceneTree::SceneTree() { } else { if (is_editor_hint()) { //file was erased, clear the field. - GlobalConfig::get_singleton()->set("rendering/viewport/default_environment", ""); + GlobalConfig::get_singleton()->set("rendering/environment/default_environment", ""); } else { //file was erased, notify user. ERR_PRINTS(RTR("Default Environment as specified in Project Setings (Rendering -> Viewport -> Default Environment) could not be loaded.")); diff --git a/scene/resources/environment.cpp b/scene/resources/environment.cpp index 33e62e3a00b..125bbd2d64b 100644 --- a/scene/resources/environment.cpp +++ b/scene/resources/environment.cpp @@ -1113,8 +1113,6 @@ void Environment::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::REAL, "adjustment_saturation", PROPERTY_HINT_RANGE, "0.01,8,0.01"), "set_adjustment_saturation", "get_adjustment_saturation"); ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "adjustment_color_correction", PROPERTY_HINT_RESOURCE_TYPE, "Texture"), "set_adjustment_color_correction", "get_adjustment_color_correction"); - GLOBAL_DEF("rendering/sky/irradiance_cube_resolution", 256); - BIND_CONSTANT(BG_KEEP); BIND_CONSTANT(BG_CLEAR_COLOR); BIND_CONSTANT(BG_COLOR); diff --git a/scene/resources/surface_tool.cpp b/scene/resources/surface_tool.cpp index b2822ca0c43..8b747e1b43d 100644 --- a/scene/resources/surface_tool.cpp +++ b/scene/resources/surface_tool.cpp @@ -812,6 +812,7 @@ void SurfaceTool::clear() { index_array.clear(); vertex_array.clear(); smooth_groups.clear(); + material.unref(); } void SurfaceTool::_bind_methods() { diff --git a/servers/physics_2d/physics_2d_server_wrap_mt.cpp b/servers/physics_2d/physics_2d_server_wrap_mt.cpp index d92c033e35b..d39231b1613 100644 --- a/servers/physics_2d/physics_2d_server_wrap_mt.cpp +++ b/servers/physics_2d/physics_2d_server_wrap_mt.cpp @@ -161,12 +161,12 @@ Physics2DServerWrapMT::Physics2DServerWrapMT(Physics2DServer *p_contained, bool step_thread_up = false; alloc_mutex = Mutex::create(); - shape_pool_max_size = GLOBAL_GET("memory/multithread/thread_rid_pool_prealloc"); - area_pool_max_size = GLOBAL_GET("memory/multithread/thread_rid_pool_prealloc"); - body_pool_max_size = GLOBAL_GET("memory/multithread/thread_rid_pool_prealloc"); - pin_joint_pool_max_size = GLOBAL_GET("memory/multithread/thread_rid_pool_prealloc"); - groove_joint_pool_max_size = GLOBAL_GET("memory/multithread/thread_rid_pool_prealloc"); - damped_spring_joint_pool_max_size = GLOBAL_GET("memory/multithread/thread_rid_pool_prealloc"); + shape_pool_max_size = GLOBAL_GET("memory/limits/multithreaded_server/rid_pool_prealloc"); + area_pool_max_size = GLOBAL_GET("memory/limits/multithreaded_server/rid_pool_prealloc"); + body_pool_max_size = GLOBAL_GET("memory/limits/multithreaded_server/rid_pool_prealloc"); + pin_joint_pool_max_size = GLOBAL_GET("memory/limits/multithreaded_server/rid_pool_prealloc"); + groove_joint_pool_max_size = GLOBAL_GET("memory/limits/multithreaded_server/rid_pool_prealloc"); + damped_spring_joint_pool_max_size = GLOBAL_GET("memory/limits/multithreaded_server/rid_pool_prealloc"); if (!p_create_thread) { server_thread = Thread::get_caller_ID(); diff --git a/servers/register_server_types.cpp b/servers/register_server_types.cpp index e97a6baebaf..8ee431cc68a 100644 --- a/servers/register_server_types.cpp +++ b/servers/register_server_types.cpp @@ -73,8 +73,6 @@ ShaderTypes *shader_types = NULL; void register_server_types() { - GLOBAL_DEF("memory/multithread/thread_rid_pool_prealloc", 20); - GlobalConfig::get_singleton()->add_singleton(GlobalConfig::Singleton("VisualServer", VisualServer::get_singleton())); GlobalConfig::get_singleton()->add_singleton(GlobalConfig::Singleton("AudioServer", AudioServer::get_singleton())); GlobalConfig::get_singleton()->add_singleton(GlobalConfig::Singleton("PhysicsServer", PhysicsServer::get_singleton())); diff --git a/servers/visual/visual_server_viewport.cpp b/servers/visual/visual_server_viewport.cpp index 433b6e945e0..4d53181b430 100644 --- a/servers/visual/visual_server_viewport.cpp +++ b/servers/visual/visual_server_viewport.cpp @@ -265,7 +265,7 @@ void VisualServerViewport::draw_viewports() { //draw viewports - clear_color = GLOBAL_GET("rendering/viewport/default_clear_color"); + clear_color = GLOBAL_GET("rendering/environment/default_clear_color"); active_viewports.sort_custom(); diff --git a/servers/visual/visual_server_wrap_mt.cpp b/servers/visual/visual_server_wrap_mt.cpp index fd15633244b..a358e99fb31 100644 --- a/servers/visual/visual_server_wrap_mt.cpp +++ b/servers/visual/visual_server_wrap_mt.cpp @@ -176,7 +176,7 @@ VisualServerWrapMT::VisualServerWrapMT(VisualServer *p_contained, bool p_create_ draw_pending = 0; draw_thread_up = false; alloc_mutex = Mutex::create(); - pool_max_size = GLOBAL_DEF("memory/servers/thread_rid_prealloc_amount", 20); + pool_max_size = GLOBAL_GET("memory/limits/multithreaded_server/rid_pool_prealloc"); if (!p_create_thread) { server_thread = Thread::get_caller_ID(); diff --git a/servers/visual_server.cpp b/servers/visual_server.cpp index c833f4eabdc..1e217649ba3 100644 --- a/servers/visual_server.cpp +++ b/servers/visual_server.cpp @@ -1567,10 +1567,22 @@ VisualServer::VisualServer() { //ERR_FAIL_COND(singleton); singleton = this; - GLOBAL_DEF("rendering/vram_formats/use_s3tc", true); - GLOBAL_DEF("rendering/vram_formats/use_etc", false); - GLOBAL_DEF("rendering/vram_formats/use_etc2", true); - GLOBAL_DEF("rendering/vram_formats/use_pvrtc", false); + GLOBAL_DEF("rendering/vram_compression/import_s3tc", true); + GLOBAL_DEF("rendering/vram_compression/import_etc", false); + GLOBAL_DEF("rendering/vram_compression/import_etc2", true); + GLOBAL_DEF("rendering/vram_compression/import_pvrtc", false); + + GLOBAL_DEF("rendering/quality/directional_shadow/size", 4096); + GLOBAL_DEF("rendering/quality/shadow_atlas/size", 4096); + GlobalConfig::get_singleton()->set_custom_property_info("rendering/shadow_atlas/size", PropertyInfo(Variant::INT, "rendering/shadow_atlas/size", PROPERTY_HINT_RANGE, "256,16384")); + GLOBAL_DEF("rendering/quality/shadow_atlas/quadrant_0_subdiv", 1); + GLOBAL_DEF("rendering/quality/shadow_atlas/quadrant_1_subdiv", 2); + GLOBAL_DEF("rendering/quality/shadow_atlas/quadrant_2_subdiv", 3); + GLOBAL_DEF("rendering/quality/shadow_atlas/quadrant_3_subdiv", 4); + GlobalConfig::get_singleton()->set_custom_property_info("rendering/quality/shadow_atlas/quadrant_0_subdiv", PropertyInfo(Variant::INT, "rendering/quality/shadow_atlas/quadrant_0_subdiv", PROPERTY_HINT_ENUM, "Disabled,1 Shadow,4 Shadows,16 Shadows,64 Shadows,256 Shadows,1024 Shadows")); + GlobalConfig::get_singleton()->set_custom_property_info("rendering/quality/shadow_atlas/quadrant_1_subdiv", PropertyInfo(Variant::INT, "rendering/quality/shadow_atlas/quadrant_1_subdiv", PROPERTY_HINT_ENUM, "Disabled,1 Shadow,4 Shadows,16 Shadows,64 Shadows,256 Shadows,1024 Shadows")); + GlobalConfig::get_singleton()->set_custom_property_info("rendering/quality/shadow_atlas/quadrant_2_subdiv", PropertyInfo(Variant::INT, "rendering/quality/shadow_atlas/quadrant_2_subdiv", PROPERTY_HINT_ENUM, "Disabled,1 Shadow,4 Shadows,16 Shadows,64 Shadows,256 Shadows,1024 Shadows")); + GlobalConfig::get_singleton()->set_custom_property_info("rendering/quality/shadow_atlas/quadrant_3_subdiv", PropertyInfo(Variant::INT, "rendering/quality/shadow_atlas/quadrant_3_subdiv", PROPERTY_HINT_ENUM, "Disabled,1 Shadow,4 Shadows,16 Shadows,64 Shadows,256 Shadows,1024 Shadows")); } VisualServer::~VisualServer() {