-Reorganized all properties of project settings (Sorry, Again).
(Lot's of bloat accumulated, so it was time for clean up.) -Made EditorSettings and ProjectSettings search more useful (search in sections too)
This commit is contained in:
parent
f36cd77feb
commit
bbada82f80
|
@ -130,33 +130,8 @@ bool GlobalConfig::_set(const StringName &p_name, const Variant &p_value) {
|
||||||
if (!props[p_name].overrided)
|
if (!props[p_name].overrided)
|
||||||
props[p_name].variant = p_value;
|
props[p_name].variant = p_value;
|
||||||
|
|
||||||
if (props[p_name].order >= NO_ORDER_BASE && registering_order) {
|
|
||||||
props[p_name].order = last_order++;
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
props[p_name] = VariantContainer(p_value, last_order++ + (registering_order ? 0 : NO_ORDER_BASE));
|
props[p_name] = VariantContainer(p_value, last_order++);
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
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<String> 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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -372,8 +347,6 @@ Error GlobalConfig::_load_settings_binary(const String p_path) {
|
||||||
ERR_FAIL_V(ERR_FILE_CORRUPT;)
|
ERR_FAIL_V(ERR_FILE_CORRUPT;)
|
||||||
}
|
}
|
||||||
|
|
||||||
set_registering_order(false);
|
|
||||||
|
|
||||||
uint32_t count = f->get_32();
|
uint32_t count = f->get_32();
|
||||||
|
|
||||||
for (uint32_t i = 0; i < count; i++) {
|
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(key, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
set_registering_order(true);
|
|
||||||
|
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
Error GlobalConfig::_load_settings(const String p_path) {
|
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;
|
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) {
|
void GlobalConfig::clear(const String &p_name) {
|
||||||
|
|
||||||
ERR_FAIL_COND(!props.has(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 _GLOBAL_DEF(const String &p_var, const Variant &p_default) {
|
||||||
|
|
||||||
|
Variant ret;
|
||||||
if (GlobalConfig::get_singleton()->has(p_var)) {
|
if (GlobalConfig::get_singleton()->has(p_var)) {
|
||||||
GlobalConfig::get_singleton()->set_initial_value(p_var, p_default);
|
ret = GlobalConfig::get_singleton()->get(p_var);
|
||||||
return 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);
|
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) {
|
void GlobalConfig::add_singleton(const Singleton &p_singleton) {
|
||||||
|
@ -843,7 +825,8 @@ void GlobalConfig::_bind_methods() {
|
||||||
GlobalConfig::GlobalConfig() {
|
GlobalConfig::GlobalConfig() {
|
||||||
|
|
||||||
singleton = this;
|
singleton = this;
|
||||||
last_order = 0;
|
last_order = NO_BUILTIN_ORDER_BASE;
|
||||||
|
last_builtin_order = 0;
|
||||||
disable_platform_override = false;
|
disable_platform_override = false;
|
||||||
registering_order = true;
|
registering_order = true;
|
||||||
|
|
||||||
|
@ -851,12 +834,12 @@ GlobalConfig::GlobalConfig() {
|
||||||
Ref<InputEventKey> key;
|
Ref<InputEventKey> key;
|
||||||
Ref<InputEventJoypadButton> joyb;
|
Ref<InputEventJoypadButton> joyb;
|
||||||
|
|
||||||
GLOBAL_DEF("application/name", "");
|
GLOBAL_DEF("application/config/name", "");
|
||||||
GLOBAL_DEF("application/main_scene", "");
|
GLOBAL_DEF("application/run/main_scene", "");
|
||||||
custom_prop_info["application/main_scene"] = PropertyInfo(Variant::STRING, "application/main_scene", PROPERTY_HINT_FILE, "tscn,scn,xscn,xml,res");
|
custom_prop_info["application/run/main_scene"] = PropertyInfo(Variant::STRING, "application/run/main_scene", PROPERTY_HINT_FILE, "tscn,scn,res");
|
||||||
GLOBAL_DEF("application/disable_stdout", false);
|
GLOBAL_DEF("application/run/disable_stdout", false);
|
||||||
GLOBAL_DEF("application/disable_stderr", false);
|
GLOBAL_DEF("application/run/disable_stderr", false);
|
||||||
GLOBAL_DEF("application/use_shared_user_dir", true);
|
GLOBAL_DEF("application/config/use_shared_user_dir", true);
|
||||||
|
|
||||||
key.instance();
|
key.instance();
|
||||||
key->set_scancode(KEY_RETURN);
|
key->set_scancode(KEY_RETURN);
|
||||||
|
@ -964,18 +947,19 @@ GlobalConfig::GlobalConfig() {
|
||||||
|
|
||||||
//GLOBAL_DEF("display/handheld/orientation", "landscape");
|
//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["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");
|
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);
|
//assigning here, because using GLOBAL_GET on every block for compressing can be slow
|
||||||
custom_prop_info["compression/zstd/compression_level"] = PropertyInfo(Variant::INT, "compression/zstd/compression_level", PROPERTY_HINT_RANGE, "1,22,1");
|
Compression::zstd_level = GLOBAL_DEF("compression/formats/zstd/compression_level", 3);
|
||||||
GLOBAL_DEF("compression/zlib/compression_level", Z_DEFAULT_COMPRESSION);
|
custom_prop_info["compression/formats/zstd/compression_level"] = PropertyInfo(Variant::INT, "compression/formats/zstd/compression_level", PROPERTY_HINT_RANGE, "1,22,1");
|
||||||
custom_prop_info["compression/zlib/compression_level"] = PropertyInfo(Variant::INT, "compression/zlib/compression_level", PROPERTY_HINT_RANGE, "-1,9,1");
|
Compression::zlib_level = GLOBAL_DEF("compression/formats/zlib/compression_level", Z_DEFAULT_COMPRESSION);
|
||||||
GLOBAL_DEF("compression/gzip/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");
|
||||||
custom_prop_info["compression/gzip/compression_level"] = PropertyInfo(Variant::INT, "compression/gzip/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;
|
using_datapack = false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,7 +56,8 @@ public:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
enum {
|
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 {
|
struct VariantContainer {
|
||||||
|
@ -83,6 +84,7 @@ protected:
|
||||||
|
|
||||||
bool registering_order;
|
bool registering_order;
|
||||||
int last_order;
|
int last_order;
|
||||||
|
int last_builtin_order;
|
||||||
Map<StringName, VariantContainer> props;
|
Map<StringName, VariantContainer> props;
|
||||||
String resource_path;
|
String resource_path;
|
||||||
Map<StringName, PropertyInfo> custom_prop_info;
|
Map<StringName, PropertyInfo> custom_prop_info;
|
||||||
|
@ -130,6 +132,7 @@ public:
|
||||||
void clear(const String &p_name);
|
void clear(const String &p_name);
|
||||||
int get_order(const String &p_name) const;
|
int get_order(const String &p_name) const;
|
||||||
void set_order(const String &p_name, int p_order);
|
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);
|
Error setup(const String &p_path, const String &p_main_pack);
|
||||||
|
|
||||||
|
|
|
@ -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.zalloc = zipio_alloc;
|
||||||
strm.zfree = zipio_free;
|
strm.zfree = zipio_free;
|
||||||
strm.opaque = Z_NULL;
|
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);
|
int err = deflateInit2(&strm, level, Z_DEFLATED, window_bits, 8, Z_DEFAULT_STRATEGY);
|
||||||
if (err != Z_OK)
|
if (err != Z_OK)
|
||||||
return -1;
|
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: {
|
case MODE_ZSTD: {
|
||||||
|
|
||||||
int max_dst_size = get_max_compressed_buffer_size(p_src_size, 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, zstd_level);
|
||||||
return ZSTD_compress(p_dst, max_dst_size, p_src, p_src_size, level);
|
|
||||||
} break;
|
} 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);
|
ERR_FAIL_V(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int Compression::zlib_level = Z_DEFAULT_COMPRESSION;
|
||||||
|
int Compression::gzip_level = Z_DEFAULT_COMPRESSION;
|
||||||
|
int Compression::zstd_level = 3;
|
||||||
|
|
|
@ -33,7 +33,12 @@
|
||||||
#include "typedefs.h"
|
#include "typedefs.h"
|
||||||
|
|
||||||
class Compression {
|
class Compression {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
static int zlib_level;
|
||||||
|
static int gzip_level;
|
||||||
|
static int zstd_level;
|
||||||
|
|
||||||
enum Mode {
|
enum Mode {
|
||||||
MODE_FASTLZ,
|
MODE_FASTLZ,
|
||||||
MODE_DEFLATE,
|
MODE_DEFLATE,
|
||||||
|
|
|
@ -254,7 +254,7 @@ void PacketPeerStream::set_input_buffer_max_size(int p_max_size) {
|
||||||
|
|
||||||
PacketPeerStream::PacketPeerStream() {
|
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);
|
ring_buffer.resize(rbsize);
|
||||||
temp_buffer.resize(1 << rbsize);
|
temp_buffer.resize(1 << rbsize);
|
||||||
|
|
|
@ -382,7 +382,7 @@ MessageQueue::MessageQueue() {
|
||||||
|
|
||||||
buffer_end = 0;
|
buffer_end = 0;
|
||||||
buffer_max_used = 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_size *= 1024;
|
||||||
buffer = memnew_arr(uint8_t, buffer_size);
|
buffer = memnew_arr(uint8_t, buffer_size);
|
||||||
}
|
}
|
||||||
|
|
|
@ -269,7 +269,7 @@ String OS::get_system_dir(SystemDir p_dir) const {
|
||||||
}
|
}
|
||||||
|
|
||||||
String OS::get_safe_application_name() 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<String> invalid_char = String("\\ / : * ? \" < > |").split(" ");
|
Vector<String> invalid_char = String("\\ / : * ? \" < > |").split(" ");
|
||||||
for (int i = 0; i < invalid_char.size(); i++) {
|
for (int i = 0; i < invalid_char.size(); i++) {
|
||||||
an = an.replace(invalid_char[i], "-");
|
an = an.replace(invalid_char[i], "-");
|
||||||
|
|
|
@ -172,7 +172,7 @@ void register_core_types() {
|
||||||
|
|
||||||
void register_core_settings() {
|
void register_core_settings() {
|
||||||
//since in register core types, globals may not e present
|
//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() {
|
void register_core_singletons() {
|
||||||
|
|
|
@ -957,7 +957,7 @@ ScriptDebuggerRemote::ScriptDebuggerRemote() {
|
||||||
poll_every = 0;
|
poll_every = 0;
|
||||||
request_scene_tree = NULL;
|
request_scene_tree = NULL;
|
||||||
live_edit_funcs = 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;
|
char_count = 0;
|
||||||
msec_count = 0;
|
msec_count = 0;
|
||||||
last_msec = 0;
|
last_msec = 0;
|
||||||
|
@ -967,7 +967,7 @@ ScriptDebuggerRemote::ScriptDebuggerRemote() {
|
||||||
eh.userdata = this;
|
eh.userdata = this;
|
||||||
add_error_handler(&eh);
|
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());
|
profile_info_ptrs.resize(profile_info.size());
|
||||||
profiling = false;
|
profiling = false;
|
||||||
max_frame_functions = 16;
|
max_frame_functions = 16;
|
||||||
|
|
|
@ -3941,7 +3941,7 @@ void RasterizerGLES2::begin_frame() {
|
||||||
|
|
||||||
//fragment_lighting=Globals::get_singleton()->get("rasterizer/use_fragment_lighting");
|
//fragment_lighting=Globals::get_singleton()->get("rasterizer/use_fragment_lighting");
|
||||||
#ifdef TOOLS_ENABLED
|
#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")));
|
shadow_filter = ShadowFilterTechnique(int(GlobalConfig::get_singleton()->get("rasterizer/shadow_filter")));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -10386,7 +10386,7 @@ void RasterizerGLES2::init() {
|
||||||
copy_shader.set_conditional(CopyShaderGLES2::USE_8BIT_HDR, !use_fp16_fb);
|
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_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;
|
npo2_textures_available = true;
|
||||||
//fragment_lighting=false;
|
//fragment_lighting=false;
|
||||||
|
|
|
@ -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 *= 1024; //kb
|
||||||
poly_size = MAX(poly_size, (2 + 2 + 4) * 4 * sizeof(float));
|
poly_size = MAX(poly_size, (2 + 2 + 4) * 4 * sizeof(float));
|
||||||
glGenBuffers(1, &data.polygon_buffer);
|
glGenBuffers(1, &data.polygon_buffer);
|
||||||
|
@ -1704,7 +1704,7 @@ void RasterizerCanvasGLES3::initialize() {
|
||||||
|
|
||||||
glGenVertexArrays(1, &data.polygon_buffer_pointer_array);
|
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
|
index_size *= 1024; //kb
|
||||||
glGenBuffers(1, &data.polygon_index_buffer);
|
glGenBuffers(1, &data.polygon_index_buffer);
|
||||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, data.polygon_index_buffer);
|
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, data.polygon_index_buffer);
|
||||||
|
|
|
@ -400,10 +400,8 @@ void RasterizerGLES3::make_current() {
|
||||||
|
|
||||||
void RasterizerGLES3::register_config() {
|
void RasterizerGLES3::register_config() {
|
||||||
|
|
||||||
GLOBAL_DEF("rendering/gles3/render_architecture", 0);
|
GLOBAL_DEF("rendering/quality/filters/use_nearest_mipmap_filter", false);
|
||||||
GlobalConfig::get_singleton()->set_custom_property_info("rendering/gles3/render_architecture", PropertyInfo(Variant::INT, "", PROPERTY_HINT_ENUM, "Desktop,Mobile"));
|
GLOBAL_DEF("rendering/quality/filters/anisotropic_filter_level", 4.0);
|
||||||
GLOBAL_DEF("rendering/quality/use_nearest_mipmap_filter", false);
|
|
||||||
GLOBAL_DEF("rendering/quality/anisotropic_filter_level", 4.0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
RasterizerGLES3::RasterizerGLES3() {
|
RasterizerGLES3::RasterizerGLES3() {
|
||||||
|
|
|
@ -4638,7 +4638,7 @@ void RasterizerSceneGLES3::initialize() {
|
||||||
glBufferData(GL_UNIFORM_BUFFER, sizeof(State::EnvironmentRadianceUBO), &state.env_radiance_ubo, GL_DYNAMIC_DRAW);
|
glBufferData(GL_UNIFORM_BUFFER, sizeof(State::EnvironmentRadianceUBO), &state.env_radiance_ubo, GL_DYNAMIC_DRAW);
|
||||||
glBindBuffer(GL_UNIFORM_BUFFER, 0);
|
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)
|
if (render_list.max_elements > 1000000)
|
||||||
render_list.max_elements = 1000000;
|
render_list.max_elements = 1000000;
|
||||||
if (render_list.max_elements < 1024)
|
if (render_list.max_elements < 1024)
|
||||||
|
@ -4712,7 +4712,7 @@ void RasterizerSceneGLES3::initialize() {
|
||||||
{
|
{
|
||||||
//directional light shadow
|
//directional light shadow
|
||||||
directional_shadow.light_count = 0;
|
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);
|
glGenFramebuffers(1, &directional_shadow.fbo);
|
||||||
glBindFramebuffer(GL_FRAMEBUFFER, directional_shadow.fbo);
|
glBindFramebuffer(GL_FRAMEBUFFER, directional_shadow.fbo);
|
||||||
glGenTextures(1, &directional_shadow.depth);
|
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");
|
state.scene_shader.add_custom_define("#define MAX_SKELETON_BONES " + itos(state.max_skeleton_bones) + "\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
GLOBAL_DEF("rendering/gles3/shadow_filter_mode", 1);
|
GLOBAL_DEF("rendering/quality/shadows/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"));
|
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;
|
shadow_filter_mode = SHADOW_FILTER_NEAREST;
|
||||||
|
|
||||||
{ //reflection cubemaps
|
{ //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);
|
glGenBuffers(1, &state.immediate_buffer);
|
||||||
glBindBuffer(GL_ARRAY_BUFFER, state.immediate_buffer);
|
glBindBuffer(GL_ARRAY_BUFFER, state.immediate_buffer);
|
||||||
|
@ -4871,13 +4871,13 @@ void RasterizerSceneGLES3::initialize() {
|
||||||
state.tonemap_shader.init();
|
state.tonemap_shader.init();
|
||||||
|
|
||||||
{
|
{
|
||||||
GLOBAL_DEF("rendering/ssurf_scattering/quality", 1);
|
GLOBAL_DEF("rendering/quality/subsurface_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"));
|
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/ssurf_scattering/max_size", 1.0);
|
GLOBAL_DEF("rendering/quality/subsurface_scattering/scale", 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"));
|
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/ssurf_scattering/follow_surface", false);
|
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;
|
exposure_shrink_size = 243;
|
||||||
|
@ -4916,12 +4916,12 @@ void RasterizerSceneGLES3::initialize() {
|
||||||
|
|
||||||
void RasterizerSceneGLES3::iteration() {
|
void RasterizerSceneGLES3::iteration() {
|
||||||
|
|
||||||
shadow_filter_mode = ShadowFilterMode(int(GlobalConfig::get_singleton()->get("rendering/gles3/shadow_filter_mode")));
|
shadow_filter_mode = ShadowFilterMode(int(GlobalConfig::get_singleton()->get("rendering/quality/shadows/filter_mode")));
|
||||||
subsurface_scatter_follow_surface = GlobalConfig::get_singleton()->get("rendering/ssurf_scattering/follow_surface");
|
subsurface_scatter_follow_surface = GlobalConfig::get_singleton()->get("rendering/quality/subsurface_scattering/follow_surface");
|
||||||
subsurface_scatter_quality = SubSurfaceScatterQuality(int(GlobalConfig::get_singleton()->get("rendering/ssurf_scattering/quality")));
|
subsurface_scatter_quality = SubSurfaceScatterQuality(int(GlobalConfig::get_singleton()->get("rendering/quality/subsurface_scattering/quality")));
|
||||||
subsurface_scatter_size = GlobalConfig::get_singleton()->get("rendering/ssurf_scattering/max_size");
|
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() {
|
void RasterizerSceneGLES3::finalize() {
|
||||||
|
|
|
@ -6848,8 +6848,8 @@ void RasterizerStorageGLES3::initialize() {
|
||||||
}
|
}
|
||||||
|
|
||||||
config.shrink_textures_x2 = false;
|
config.shrink_textures_x2 = false;
|
||||||
config.use_fast_texture_filter = int(GlobalConfig::get_singleton()->get("rendering/quality/use_nearest_mipmap_filter"));
|
config.use_fast_texture_filter = int(GlobalConfig::get_singleton()->get("rendering/quality/filters/use_nearest_mipmap_filter"));
|
||||||
config.use_anisotropic_filter = config.extensions.has("GL_EXT_texture_filter_anisotropic");
|
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.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");
|
config.etc_supported = config.extensions.has("GL_OES_compressed_ETC1_RGB8_texture");
|
||||||
|
@ -6983,7 +6983,7 @@ void RasterizerStorageGLES3::initialize() {
|
||||||
|
|
||||||
{
|
{
|
||||||
//transform feedback buffers
|
//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++) {
|
for (int i = 0; i < 2; i++) {
|
||||||
|
|
||||||
glGenBuffers(1, &resources.transform_feedback_buffers[i]);
|
glGenBuffers(1, &resources.transform_feedback_buffers[i]);
|
||||||
|
@ -7009,7 +7009,7 @@ void RasterizerStorageGLES3::initialize() {
|
||||||
frame.current_rt = NULL;
|
frame.current_rt = NULL;
|
||||||
config.keep_original_textures = false;
|
config.keep_original_textures = false;
|
||||||
config.generate_wireframes = 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() {
|
void RasterizerStorageGLES3::finalize() {
|
||||||
|
|
|
@ -494,7 +494,7 @@ String OS_Unix::get_data_dir() const {
|
||||||
|
|
||||||
if (has_environment("HOME")) {
|
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)
|
if (use_godot)
|
||||||
return get_environment("HOME") + "/.godot/app_userdata/" + an;
|
return get_environment("HOME") + "/.godot/app_userdata/" + an;
|
||||||
else
|
else
|
||||||
|
|
|
@ -163,7 +163,7 @@ void EditorNode::_update_scene_tabs() {
|
||||||
|
|
||||||
void EditorNode::_update_title() {
|
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 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();
|
String edited = editor_data.get_edited_scene_root() ? editor_data.get_edited_scene_root()->get_filename() : String();
|
||||||
if (!edited.empty())
|
if (!edited.empty())
|
||||||
|
@ -272,7 +272,7 @@ void EditorNode::_notification(int p_what) {
|
||||||
}
|
}
|
||||||
editor_selection->update();
|
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();
|
ResourceImporterTexture::get_singleton()->update_imports();
|
||||||
}
|
}
|
||||||
|
@ -1132,7 +1132,7 @@ void EditorNode::_dialog_action(String p_file) {
|
||||||
} break;
|
} break;
|
||||||
case SETTINGS_PICK_MAIN_SCENE: {
|
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();
|
GlobalConfig::get_singleton()->save();
|
||||||
//would be nice to show the project manager opened with the highlighted field..
|
//would be nice to show the project manager opened with the highlighted field..
|
||||||
_run(false, ""); // automatically run the project
|
_run(false, ""); // automatically run the project
|
||||||
|
@ -1731,7 +1731,7 @@ void EditorNode::_run(bool p_current, const String &p_custom) {
|
||||||
if (run_filename == "") {
|
if (run_filename == "") {
|
||||||
|
|
||||||
//evidently, run the scene
|
//evidently, run the scene
|
||||||
main_scene = GLOBAL_DEF("application/main_scene", "");
|
main_scene = GLOBAL_DEF("application/run/main_scene", "");
|
||||||
if (main_scene == "") {
|
if (main_scene == "") {
|
||||||
|
|
||||||
current_option = -1;
|
current_option = -1;
|
||||||
|
@ -5151,10 +5151,6 @@ EditorNode::EditorNode() {
|
||||||
import_wav.instance();
|
import_wav.instance();
|
||||||
ResourceFormatImporter::get_singleton()->add_importer(import_wav);
|
ResourceFormatImporter::get_singleton()->add_importer(import_wav);
|
||||||
|
|
||||||
Ref<ResourceImporterOBJ> import_obj;
|
|
||||||
import_obj.instance();
|
|
||||||
ResourceFormatImporter::get_singleton()->add_importer(import_obj);
|
|
||||||
|
|
||||||
Ref<ResourceImporterScene> import_scene;
|
Ref<ResourceImporterScene> import_scene;
|
||||||
import_scene.instance();
|
import_scene.instance();
|
||||||
ResourceFormatImporter::get_singleton()->add_importer(import_scene);
|
ResourceFormatImporter::get_singleton()->add_importer(import_scene);
|
||||||
|
@ -5163,6 +5159,10 @@ EditorNode::EditorNode() {
|
||||||
Ref<EditorSceneImporterCollada> import_collada;
|
Ref<EditorSceneImporterCollada> import_collada;
|
||||||
import_collada.instance();
|
import_collada.instance();
|
||||||
import_scene->add_importer(import_collada);
|
import_scene->add_importer(import_collada);
|
||||||
|
|
||||||
|
Ref<EditorOBJImporter> 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_use_folding(true);
|
||||||
property_editor->set_v_size_flags(Control::SIZE_EXPAND_FILL);
|
property_editor->set_v_size_flags(Control::SIZE_EXPAND_FILL);
|
||||||
property_editor->set_use_doc_hints(true);
|
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->set_enable_capitalize_paths(bool(EDITOR_DEF("interface/capitalize_properties", true)));
|
||||||
|
|
||||||
property_editor->hide_top_label();
|
property_editor->hide_top_label();
|
||||||
|
|
|
@ -79,12 +79,12 @@ Error EditorRun::run(const String &p_scene, const String p_custom_args, const Li
|
||||||
|
|
||||||
Size2 desired_size;
|
Size2 desired_size;
|
||||||
|
|
||||||
desired_size.x = GlobalConfig::get_singleton()->get("display/window/width");
|
desired_size.x = GlobalConfig::get_singleton()->get("display/window/size/width");
|
||||||
desired_size.y = GlobalConfig::get_singleton()->get("display/window/height");
|
desired_size.y = GlobalConfig::get_singleton()->get("display/window/size/height");
|
||||||
|
|
||||||
Size2 test_size;
|
Size2 test_size;
|
||||||
test_size.x = GlobalConfig::get_singleton()->get("display/window/test_width");
|
test_size.x = GlobalConfig::get_singleton()->get("display/window/size/test_width");
|
||||||
test_size.y = GlobalConfig::get_singleton()->get("display/window/test_height");
|
test_size.y = GlobalConfig::get_singleton()->get("display/window/size/test_height");
|
||||||
if (test_size.x > 0 && test_size.y > 0) {
|
if (test_size.x > 0 && test_size.y > 0) {
|
||||||
|
|
||||||
desired_size = test_size;
|
desired_size = test_size;
|
||||||
|
|
|
@ -31,82 +31,206 @@
|
||||||
|
|
||||||
#include "io/resource_saver.h"
|
#include "io/resource_saver.h"
|
||||||
#include "os/file_access.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/mesh.h"
|
||||||
#include "scene/resources/surface_tool.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<String> *r_extensions) const {
|
||||||
|
|
||||||
|
r_extensions->push_back("obj");
|
||||||
}
|
}
|
||||||
|
|
||||||
String ResourceImporterOBJ::get_visible_name() const {
|
Error EditorOBJImporter::_parse_material_library(const String &p_path, Map<String, Ref<SpatialMaterial> > &material_map, List<String> *r_missing_deps) {
|
||||||
|
|
||||||
return "OBJ As Mesh";
|
FileAccessRef f = FileAccess::open(p_path, FileAccess::READ);
|
||||||
}
|
|
||||||
void ResourceImporterOBJ::get_recognized_extensions(List<String> *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<StringName, Variant> &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<ImportOption> *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<StringName, Variant> &p_options, List<String> *r_platform_variants, List<String> *r_gen_files) {
|
|
||||||
|
|
||||||
FileAccessRef f = FileAccess::open(p_source_file, FileAccess::READ);
|
|
||||||
ERR_FAIL_COND_V(!f, ERR_CANT_OPEN);
|
ERR_FAIL_COND_V(!f, ERR_CANT_OPEN);
|
||||||
|
|
||||||
Ref<ArrayMesh> mesh = Ref<ArrayMesh>(memnew(ArrayMesh));
|
Ref<SpatialMaterial> 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<String> 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<String> 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<String> 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<String> 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<String> 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> 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> 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> 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> 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<String> *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<ArrayMesh> mesh;
|
||||||
|
mesh.instance();
|
||||||
|
|
||||||
Map<String, Ref<Material> > name_map;
|
Map<String, Ref<Material> > name_map;
|
||||||
|
|
||||||
bool generate_normals = p_options["generate/normals"];
|
bool generate_tangents = p_flags & IMPORT_GENERATE_TANGENT_ARRAYS;
|
||||||
bool generate_tangents = p_options["generate/tangents"];
|
bool flip_faces = false;
|
||||||
bool flip_faces = p_options["force/flip_faces"];
|
//bool flip_faces = p_options["force/flip_faces"];
|
||||||
bool force_smooth = p_options["force/smooth_shading"];
|
//bool force_smooth = p_options["force/smooth_shading"];
|
||||||
bool weld_vertices = p_options["force/weld_vertices"];
|
//bool weld_vertices = p_options["force/weld_vertices"];
|
||||||
float weld_tolerance = p_options["force/weld_tolerance"];
|
//float weld_tolerance = p_options["force/weld_tolerance"];
|
||||||
|
|
||||||
Vector<Vector3> vertices;
|
Vector<Vector3> vertices;
|
||||||
Vector<Vector3> normals;
|
Vector<Vector3> normals;
|
||||||
Vector<Vector2> uvs;
|
Vector<Vector2> uvs;
|
||||||
String name;
|
String name;
|
||||||
|
|
||||||
|
Map<String, Map<String, Ref<SpatialMaterial> > > material_map;
|
||||||
|
|
||||||
Ref<SurfaceTool> surf_tool = memnew(SurfaceTool);
|
Ref<SurfaceTool> surf_tool = memnew(SurfaceTool);
|
||||||
surf_tool->begin(Mesh::PRIMITIVE_TRIANGLES);
|
surf_tool->begin(Mesh::PRIMITIVE_TRIANGLES);
|
||||||
if (force_smooth)
|
|
||||||
surf_tool->add_smooth_group(true);
|
String current_material_library;
|
||||||
int has_index_data = false;
|
String current_material;
|
||||||
|
String current_group;
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
|
|
||||||
|
@ -115,7 +239,7 @@ Error ResourceImporterOBJ::import(const String &p_source_file, const String &p_s
|
||||||
if (l.begins_with("v ")) {
|
if (l.begins_with("v ")) {
|
||||||
//vertex
|
//vertex
|
||||||
Vector<String> v = l.split(" ", false);
|
Vector<String> v = l.split(" ", false);
|
||||||
ERR_FAIL_COND_V(v.size() < 4, ERR_INVALID_DATA);
|
ERR_FAIL_COND_V(v.size() < 4, NULL);
|
||||||
Vector3 vtx;
|
Vector3 vtx;
|
||||||
vtx.x = v[1].to_float();
|
vtx.x = v[1].to_float();
|
||||||
vtx.y = v[2].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 ")) {
|
} else if (l.begins_with("vt ")) {
|
||||||
//uv
|
//uv
|
||||||
Vector<String> v = l.split(" ", false);
|
Vector<String> v = l.split(" ", false);
|
||||||
ERR_FAIL_COND_V(v.size() < 3, ERR_INVALID_DATA);
|
ERR_FAIL_COND_V(v.size() < 3, NULL);
|
||||||
Vector2 uv;
|
Vector2 uv;
|
||||||
uv.x = v[1].to_float();
|
uv.x = v[1].to_float();
|
||||||
uv.y = 1.0 - v[2].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 ")) {
|
} else if (l.begins_with("vn ")) {
|
||||||
//normal
|
//normal
|
||||||
Vector<String> v = l.split(" ", false);
|
Vector<String> v = l.split(" ", false);
|
||||||
ERR_FAIL_COND_V(v.size() < 4, ERR_INVALID_DATA);
|
ERR_FAIL_COND_V(v.size() < 4, NULL);
|
||||||
Vector3 nrm;
|
Vector3 nrm;
|
||||||
nrm.x = v[1].to_float();
|
nrm.x = v[1].to_float();
|
||||||
nrm.y = v[2].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 ")) {
|
} else if (l.begins_with("f ")) {
|
||||||
//vertex
|
//vertex
|
||||||
|
|
||||||
has_index_data = true;
|
|
||||||
Vector<String> v = l.split(" ", false);
|
Vector<String> 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
|
//not very fast, could be sped up
|
||||||
|
|
||||||
Vector<String> face[3];
|
Vector<String> face[3];
|
||||||
face[0] = v[1].split("/");
|
face[0] = v[1].split("/");
|
||||||
face[1] = v[2].split("/");
|
face[1] = v[2].split("/");
|
||||||
ERR_FAIL_COND_V(face[0].size() == 0, ERR_PARSE_ERROR);
|
ERR_FAIL_COND_V(face[0].size() == 0, NULL);
|
||||||
ERR_FAIL_COND_V(face[0].size() != face[1].size(), ERR_PARSE_ERROR);
|
ERR_FAIL_COND_V(face[0].size() != face[1].size(), NULL);
|
||||||
for (int i = 2; i < v.size() - 1; i++) {
|
for (int i = 2; i < v.size() - 1; i++) {
|
||||||
|
|
||||||
face[2] = v[i + 1].split("/");
|
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++) {
|
for (int j = 0; j < 3; j++) {
|
||||||
|
|
||||||
int idx = 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;
|
int norm = face[idx][2].to_int() - 1;
|
||||||
if (norm < 0)
|
if (norm < 0)
|
||||||
norm += normals.size() + 1;
|
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]);
|
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;
|
int uv = face[idx][1].to_int() - 1;
|
||||||
if (uv < 0)
|
if (uv < 0)
|
||||||
uv += uvs.size() + 1;
|
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]);
|
surf_tool->add_uv(uvs[uv]);
|
||||||
}
|
}
|
||||||
|
|
||||||
int vtx = face[idx][0].to_int() - 1;
|
int vtx = face[idx][0].to_int() - 1;
|
||||||
if (vtx < 0)
|
if (vtx < 0)
|
||||||
vtx += vertices.size() + 1;
|
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];
|
Vector3 vertex = vertices[vtx];
|
||||||
if (weld_vertices)
|
//if (weld_vertices)
|
||||||
vertex.snap(Vector3(weld_tolerance, weld_tolerance, weld_tolerance));
|
// vertex.snap(Vector3(weld_tolerance, weld_tolerance, weld_tolerance));
|
||||||
surf_tool->add_vertex(vertex);
|
surf_tool->add_vertex(vertex);
|
||||||
}
|
}
|
||||||
|
|
||||||
face[1] = face[2];
|
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();
|
String what = l.substr(2, l.length()).strip_edges();
|
||||||
if (what == "off")
|
if (what == "off")
|
||||||
surf_tool->add_smooth_group(false);
|
surf_tool->add_smooth_group(false);
|
||||||
else
|
else
|
||||||
surf_tool->add_smooth_group(true);
|
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 (surf_tool->get_vertex_array().size()) {
|
||||||
|
//another group going on, commit it
|
||||||
if (has_index_data) {
|
if (normals.size() == 0) {
|
||||||
//new object/surface
|
|
||||||
if (generate_normals || force_smooth)
|
|
||||||
surf_tool->generate_normals();
|
surf_tool->generate_normals();
|
||||||
if (uvs.size() && (normals.size() || generate_normals) && generate_tangents)
|
}
|
||||||
|
|
||||||
|
if (generate_tangents && uvs.size()) {
|
||||||
surf_tool->generate_tangents();
|
surf_tool->generate_tangents();
|
||||||
|
}
|
||||||
|
|
||||||
surf_tool->index();
|
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);
|
mesh = surf_tool->commit(mesh);
|
||||||
if (name == "")
|
|
||||||
name = vformat(TTR("Surface %d"), mesh->get_surface_count() - 1);
|
if (current_material != String()) {
|
||||||
mesh->surface_set_name(mesh->get_surface_count() - 1, name);
|
mesh->surface_set_name(mesh->get_surface_count() - 1, current_material.get_basename());
|
||||||
name = "";
|
} 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->clear();
|
||||||
surf_tool->begin(Mesh::PRIMITIVE_TRIANGLES);
|
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();
|
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<String, Ref<SpatialMaterial> > 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 scene;
|
||||||
|
|
||||||
return err;
|
|
||||||
}
|
}
|
||||||
|
Ref<Animation> EditorOBJImporter::import_animation(const String &p_path, uint32_t p_flags) {
|
||||||
|
|
||||||
ResourceImporterOBJ::ResourceImporterOBJ() {
|
return Ref<Animation>();
|
||||||
|
}
|
||||||
|
EditorOBJImporter::EditorOBJImporter() {
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,26 +30,21 @@
|
||||||
#ifndef RESOURCEIMPORTEROBJ_H
|
#ifndef RESOURCEIMPORTEROBJ_H
|
||||||
#define 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<String, Ref<SpatialMaterial> > &material_map, List<String> *r_missing_deps);
|
||||||
|
|
||||||
class ResourceImporterOBJ : public ResourceImporter {
|
|
||||||
GDCLASS(ResourceImporterOBJ, ResourceImporter)
|
|
||||||
public:
|
public:
|
||||||
virtual String get_importer_name() const;
|
virtual uint32_t get_import_flags() const;
|
||||||
virtual String get_visible_name() const;
|
virtual void get_extensions(List<String> *r_extensions) const;
|
||||||
virtual void get_recognized_extensions(List<String> *p_extensions) const;
|
virtual Node *import_scene(const String &p_path, uint32_t p_flags, int p_bake_fps, List<String> *r_missing_deps, Error *r_err = NULL);
|
||||||
virtual String get_save_extension() const;
|
virtual Ref<Animation> import_animation(const String &p_path, uint32_t p_flags);
|
||||||
virtual String get_resource_type() const;
|
|
||||||
|
|
||||||
virtual int get_preset_count() const;
|
EditorOBJImporter();
|
||||||
virtual String get_preset_name(int p_idx) const;
|
|
||||||
|
|
||||||
virtual void get_import_options(List<ImportOption> *r_options, int p_preset = 0) const;
|
|
||||||
virtual bool get_option_visibility(const String &p_option, const Map<StringName, Variant> &p_options) const;
|
|
||||||
|
|
||||||
virtual Error import(const String &p_source_file, const String &p_save_path, const Map<StringName, Variant> &p_options, List<String> *r_platform_variants, List<String> *r_gen_files = NULL);
|
|
||||||
|
|
||||||
ResourceImporterOBJ();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // RESOURCEIMPORTEROBJ_H
|
#endif // RESOURCEIMPORTEROBJ_H
|
||||||
|
|
|
@ -418,24 +418,24 @@ Error ResourceImporterTexture::import(const String &p_source_file, const String
|
||||||
if (compress_mode == COMPRESS_VIDEO_RAM) {
|
if (compress_mode == COMPRESS_VIDEO_RAM) {
|
||||||
//must import in all formats
|
//must import in all formats
|
||||||
//Android, GLES 2.x
|
//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);
|
_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");
|
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);
|
_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");
|
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);
|
_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");
|
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);
|
_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");
|
r_platform_variants->push_back("pvrtc");
|
||||||
|
|
|
@ -328,7 +328,6 @@ ImportDock::ImportDock() {
|
||||||
add_child(import_opts);
|
add_child(import_opts);
|
||||||
import_opts->set_v_size_flags(SIZE_EXPAND_FILL);
|
import_opts->set_v_size_flags(SIZE_EXPAND_FILL);
|
||||||
import_opts->hide_top_label();
|
import_opts->hide_top_label();
|
||||||
import_opts->set_hide_script(true);
|
|
||||||
|
|
||||||
hb = memnew(HBoxContainer);
|
hb = memnew(HBoxContainer);
|
||||||
add_child(hb);
|
add_child(hb);
|
||||||
|
|
|
@ -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);
|
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] = {
|
Vector2 screen_endpoints[4] = {
|
||||||
transform.xform(Vector2(0, 0)),
|
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_begin(Point2(0, size.height - hmin.height));
|
||||||
h_scroll->set_end(Point2(size.width - vmin.width, size.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));
|
Rect2 local_rect = Rect2(Point2(), viewport->get_size() - Size2(vmin.width, hmin.height));
|
||||||
|
|
||||||
|
|
|
@ -1717,11 +1717,11 @@ void SpatialEditorViewport::_notification(int p_what) {
|
||||||
|
|
||||||
//update shadow atlas if changed
|
//update shadow atlas if changed
|
||||||
|
|
||||||
int shadowmap_size = GlobalConfig::get_singleton()->get("rendering/shadow_atlas/size");
|
int shadowmap_size = GlobalConfig::get_singleton()->get("rendering/quality/shadow_atlas/size");
|
||||||
int atlas_q0 = GlobalConfig::get_singleton()->get("rendering/shadow_atlas/quadrant_0_subdiv");
|
int atlas_q0 = GlobalConfig::get_singleton()->get("rendering/quality/shadow_atlas/quadrant_0_subdiv");
|
||||||
int atlas_q1 = GlobalConfig::get_singleton()->get("rendering/shadow_atlas/quadrant_1_subdiv");
|
int atlas_q1 = GlobalConfig::get_singleton()->get("rendering/quality/shadow_atlas/quadrant_1_subdiv");
|
||||||
int atlas_q2 = GlobalConfig::get_singleton()->get("rendering/shadow_atlas/quadrant_2_subdiv");
|
int atlas_q2 = GlobalConfig::get_singleton()->get("rendering/quality/shadow_atlas/quadrant_2_subdiv");
|
||||||
int atlas_q3 = GlobalConfig::get_singleton()->get("rendering/shadow_atlas/quadrant_3_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_size(shadowmap_size);
|
||||||
viewport->set_shadow_atlas_quadrant_subdiv(0, Viewport::ShadowAtlasQuadrantSubdiv(atlas_q0));
|
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
|
//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));
|
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);
|
viewport->set_hdr(hdr);
|
||||||
|
|
||||||
bool show_info = view_menu->get_popup()->is_item_checked(view_menu->get_popup()->get_item_index(VIEW_INFORMATION));
|
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) {
|
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();
|
float aspect = ss.aspect();
|
||||||
Size2 s = get_size();
|
Size2 s = get_size();
|
||||||
|
|
||||||
|
|
|
@ -763,7 +763,7 @@ ProjectExportDialog::ProjectExportDialog() {
|
||||||
parameters->set_name(TTR("Options"));
|
parameters->set_name(TTR("Options"));
|
||||||
parameters->hide_top_label();
|
parameters->hide_top_label();
|
||||||
parameters->set_v_size_flags(SIZE_EXPAND_FILL);
|
parameters->set_v_size_flags(SIZE_EXPAND_FILL);
|
||||||
parameters->set_hide_script(true);
|
|
||||||
parameters->connect("property_edited", this, "_update_parameters");
|
parameters->connect("property_edited", this, "_update_parameters");
|
||||||
|
|
||||||
VBoxContainer *resources_vb = memnew(VBoxContainer);
|
VBoxContainer *resources_vb = memnew(VBoxContainer);
|
||||||
|
|
|
@ -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->get_property_editor()->set_undo_redo(EditorNode::get_singleton()->get_undo_redo());
|
||||||
//globals_editor->hide_top_label();
|
//globals_editor->hide_top_label();
|
||||||
globals_editor->set_v_size_flags(Control::SIZE_EXPAND_FILL);
|
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()->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_toggled", this, "_item_checked", varray(), CONNECT_DEFERRED);
|
||||||
globals_editor->get_property_editor()->connect("property_edited", this, "_settings_prop_edited");
|
globals_editor->get_property_editor()->connect("property_edited", this, "_settings_prop_edited");
|
||||||
|
|
|
@ -4331,7 +4331,7 @@ PropertyEditor::PropertyEditor() {
|
||||||
|
|
||||||
_prop_edited = "property_edited";
|
_prop_edited = "property_edited";
|
||||||
|
|
||||||
hide_script = false;
|
hide_script = true;
|
||||||
use_folding = false;
|
use_folding = false;
|
||||||
|
|
||||||
undo_redo = NULL;
|
undo_redo = NULL;
|
||||||
|
@ -4512,6 +4512,7 @@ public:
|
||||||
void SectionedPropertyEditor::_bind_methods() {
|
void SectionedPropertyEditor::_bind_methods() {
|
||||||
|
|
||||||
ClassDB::bind_method("_section_selected", &SectionedPropertyEditor::_section_selected);
|
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);
|
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")
|
if (pi.name.find(":") != -1 || pi.name == "script" || pi.name == "resource_name" || pi.name == "resource_path")
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
if (search_box && search_box->get_text() != String() && pi.name.findn(search_box->get_text()) == -1)
|
||||||
|
continue;
|
||||||
|
|
||||||
int sp = pi.name.find("/");
|
int sp = pi.name.find("/");
|
||||||
if (sp == -1)
|
if (sp == -1)
|
||||||
pi.name = "Global/" + pi.name;
|
pi.name = "Global/" + pi.name;
|
||||||
|
@ -4616,7 +4621,9 @@ void SectionedPropertyEditor::update_category_list() {
|
||||||
Vector<String> sectionarr = pi.name.split("/");
|
Vector<String> sectionarr = pi.name.split("/");
|
||||||
String metasection;
|
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];
|
TreeItem *parent = section_map[metasection];
|
||||||
|
|
||||||
|
@ -4631,6 +4638,12 @@ void SectionedPropertyEditor::update_category_list() {
|
||||||
section_map[metasection] = ms;
|
section_map[metasection] = ms;
|
||||||
ms->set_text(0, sectionarr[i].capitalize());
|
ms->set_text(0, sectionarr[i].capitalize());
|
||||||
ms->set_metadata(0, metasection);
|
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() {
|
PropertyEditor *SectionedPropertyEditor::get_property_editor() {
|
||||||
|
|
||||||
return editor;
|
return editor;
|
||||||
|
@ -4649,6 +4674,8 @@ SectionedPropertyEditor::SectionedPropertyEditor() {
|
||||||
|
|
||||||
obj = -1;
|
obj = -1;
|
||||||
|
|
||||||
|
search_box = NULL;
|
||||||
|
|
||||||
VBoxContainer *left_vb = memnew(VBoxContainer);
|
VBoxContainer *left_vb = memnew(VBoxContainer);
|
||||||
left_vb->set_custom_minimum_size(Size2(160, 0) * EDSCALE);
|
left_vb->set_custom_minimum_size(Size2(160, 0) * EDSCALE);
|
||||||
add_child(left_vb);
|
add_child(left_vb);
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
/* property_editor.h */
|
/* property_editor.h */
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
/* This file is part of: */
|
/* This file is part of: */
|
||||||
|
@ -307,11 +307,15 @@ class SectionedPropertyEditor : public HBoxContainer {
|
||||||
|
|
||||||
Map<String, TreeItem *> section_map;
|
Map<String, TreeItem *> section_map;
|
||||||
PropertyEditor *editor;
|
PropertyEditor *editor;
|
||||||
|
LineEdit *search_box;
|
||||||
|
|
||||||
static void _bind_methods();
|
static void _bind_methods();
|
||||||
void _section_selected();
|
void _section_selected();
|
||||||
|
|
||||||
|
void _search_changed(const String &p_what);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
void register_search_box(LineEdit *p_box);
|
||||||
PropertyEditor *get_property_editor();
|
PropertyEditor *get_property_editor();
|
||||||
void edit(Object *p_object);
|
void edit(Object *p_object);
|
||||||
String get_full_item_path(const String &p_item);
|
String get_full_item_path(const String &p_item);
|
||||||
|
|
|
@ -332,7 +332,7 @@ EditorSettingsDialog::EditorSettingsDialog() {
|
||||||
property_editor = memnew(SectionedPropertyEditor);
|
property_editor = memnew(SectionedPropertyEditor);
|
||||||
//property_editor->hide_top_label();
|
//property_editor->hide_top_label();
|
||||||
property_editor->get_property_editor()->set_use_filter(true);
|
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);
|
property_editor->set_v_size_flags(Control::SIZE_EXPAND_FILL);
|
||||||
vbc->add_child(property_editor);
|
vbc->add_child(property_editor);
|
||||||
property_editor->get_property_editor()->connect("property_edited", this, "_settings_property_edited");
|
property_editor->get_property_editor()->connect("property_edited", this, "_settings_property_edited");
|
||||||
|
|
154
main/main.cpp
154
main/main.cpp
|
@ -578,9 +578,8 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
|
||||||
I = N;
|
I = N;
|
||||||
}
|
}
|
||||||
|
|
||||||
GLOBAL_DEF("memory/multithread/thread_rid_pool_prealloc", 60);
|
GLOBAL_DEF("memory/limits/multithreaded_server/rid_pool_prealloc", 60);
|
||||||
|
GLOBAL_DEF("network/limits/debugger_stdout/max_chars_per_second", 2048);
|
||||||
GLOBAL_DEF("network/debug/max_remote_stdout_chars_per_second", 2048);
|
|
||||||
|
|
||||||
if (debug_mode == "remote") {
|
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;
|
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;
|
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;
|
_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
|
#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)
|
use_custom_res = false; //project manager (run without arguments)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -690,43 +689,43 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
|
||||||
else
|
else
|
||||||
input_map->load_from_globals(); //keys for game
|
input_map->load_from_globals(); //keys for game
|
||||||
|
|
||||||
if (video_driver == "") // specified in project.godot
|
//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)));
|
// 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"))
|
if (!force_res && use_custom_res && globals->has("display/window/size/width"))
|
||||||
video_mode.width = globals->get("display/window/width");
|
video_mode.width = globals->get("display/window/size/width");
|
||||||
if (!force_res && use_custom_res && globals->has("display/window/height"))
|
if (!force_res && use_custom_res && globals->has("display/window/size/height"))
|
||||||
video_mode.height = globals->get("display/window/height");
|
video_mode.height = globals->get("display/window/size/height");
|
||||||
if (!editor && ((globals->has("display/window/allow_hidpi") && !globals->get("display/window/allow_hidpi")) || force_lowdpi)) {
|
if (!editor && ((globals->has("display/window/dpi/allow_hidpi") && !globals->get("display/window/dpi/allow_hidpi")) || force_lowdpi)) {
|
||||||
OS::get_singleton()->_allow_hidpi = false;
|
OS::get_singleton()->_allow_hidpi = false;
|
||||||
}
|
}
|
||||||
if (use_custom_res && globals->has("display/window/fullscreen"))
|
if (use_custom_res && globals->has("display/window/size/fullscreen"))
|
||||||
video_mode.fullscreen = globals->get("display/window/fullscreen");
|
video_mode.fullscreen = globals->get("display/window/size/fullscreen");
|
||||||
if (use_custom_res && globals->has("display/window/resizable"))
|
if (use_custom_res && globals->has("display/window/size/resizable"))
|
||||||
video_mode.resizable = globals->get("display/window/resizable");
|
video_mode.resizable = globals->get("display/window/size/resizable");
|
||||||
if (use_custom_res && globals->has("display/window/borderless"))
|
if (use_custom_res && globals->has("display/window/size/borderless"))
|
||||||
video_mode.borderless_window = globals->get("display/window/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")) {
|
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/test_width");
|
int tw = globals->get("display/window/size/test_width");
|
||||||
int th = globals->get("display/window/test_height");
|
int th = globals->get("display/window/size/test_height");
|
||||||
if (tw > 0 && th > 0) {
|
if (tw > 0 && th > 0) {
|
||||||
video_mode.width = tw;
|
video_mode.width = tw;
|
||||||
video_mode.height = th;
|
video_mode.height = th;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
GLOBAL_DEF("display/window/width", video_mode.width);
|
GLOBAL_DEF("display/window/size/width", video_mode.width);
|
||||||
GLOBAL_DEF("display/window/height", video_mode.height);
|
GLOBAL_DEF("display/window/size/height", video_mode.height);
|
||||||
GLOBAL_DEF("display/window/allow_hidpi", false);
|
GLOBAL_DEF("display/window/dpi/allow_hidpi", false);
|
||||||
GLOBAL_DEF("display/window/fullscreen", video_mode.fullscreen);
|
GLOBAL_DEF("display/window/size/fullscreen", video_mode.fullscreen);
|
||||||
GLOBAL_DEF("display/window/resizable", video_mode.resizable);
|
GLOBAL_DEF("display/window/size/resizable", video_mode.resizable);
|
||||||
GLOBAL_DEF("display/window/borderless", video_mode.borderless_window);
|
GLOBAL_DEF("display/window/size/borderless", video_mode.borderless_window);
|
||||||
use_vsync = GLOBAL_DEF("display/window/use_vsync", use_vsync);
|
use_vsync = GLOBAL_DEF("display/window/vsync/use_vsync", use_vsync);
|
||||||
GLOBAL_DEF("display/window/test_width", 0);
|
GLOBAL_DEF("display/window/size/test_width", 0);
|
||||||
GLOBAL_DEF("display/window/test_height", 0);
|
GLOBAL_DEF("display/window/size/test_height", 0);
|
||||||
Engine::get_singleton()->_pixel_snap = GLOBAL_DEF("rendering/2d/use_pixel_snap", false);
|
Engine::get_singleton()->_pixel_snap = GLOBAL_DEF("rendering/quality/2d/use_pixel_snap", false);
|
||||||
OS::get_singleton()->_keep_screen_on = GLOBAL_DEF("display/energy_saving/keep_screen_on", true);
|
OS::get_singleton()->_keep_screen_on = GLOBAL_DEF("display/window/energy_saving/keep_screen_on", true);
|
||||||
if (rtm == -1) {
|
if (rtm == -1) {
|
||||||
rtm = GLOBAL_DEF("rendering/threads/thread_model", OS::RENDER_THREAD_SAFE);
|
rtm = GLOBAL_DEF("rendering/threads/thread_model", OS::RENDER_THREAD_SAFE);
|
||||||
if (rtm >= 1) //hack for now
|
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) {
|
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;
|
video_driver_idx = 0;
|
||||||
//goto error;
|
//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")
|
if (orientation == "portrait")
|
||||||
OS::get_singleton()->set_screen_orientation(OS::SCREEN_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_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
|
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) {
|
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);
|
Engine::get_singleton()->set_frame_delay(frame_delay);
|
||||||
|
@ -908,13 +907,13 @@ Error Main::setup2() {
|
||||||
|
|
||||||
MAIN_PRINT("Main: Load Remaps");
|
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);
|
VisualServer::get_singleton()->set_default_clear_color(clear);
|
||||||
|
|
||||||
if (show_logo) { //boot logo!
|
if (show_logo) { //boot logo!
|
||||||
String boot_logo_path = GLOBAL_DEF("application/boot_splash", String());
|
String boot_logo_path = GLOBAL_DEF("application/boot_splash/image", String());
|
||||||
bool boot_logo_scale = GLOBAL_DEF("application/boot_splash_fullsize", true);
|
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"));
|
GlobalConfig::get_singleton()->set_custom_property_info("application/boot_splash/image", PropertyInfo(Variant::STRING, "application/boot_splash/image", PROPERTY_HINT_FILE, "*.png"));
|
||||||
|
|
||||||
Ref<Image> boot_logo;
|
Ref<Image> boot_logo;
|
||||||
|
|
||||||
|
@ -930,7 +929,7 @@ Error Main::setup2() {
|
||||||
|
|
||||||
if (boot_logo.is_valid()) {
|
if (boot_logo.is_valid()) {
|
||||||
OS::get_singleton()->_msec_splash = OS::get_singleton()->get_ticks_msec();
|
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);
|
VisualServer::get_singleton()->set_boot_image(boot_logo, boot_bg, boot_logo_scale);
|
||||||
#ifndef TOOLS_ENABLED
|
#ifndef TOOLS_ENABLED
|
||||||
//no tools, so free the boot logo (no longer needed)
|
//no tools, so free the boot logo (no longer needed)
|
||||||
|
@ -955,13 +954,13 @@ Error Main::setup2() {
|
||||||
}
|
}
|
||||||
|
|
||||||
MAIN_PRINT("Main: DCC");
|
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");
|
MAIN_PRINT("Main: END");
|
||||||
|
|
||||||
GLOBAL_DEF("application/icon", String());
|
GLOBAL_DEF("application/config/icon", String());
|
||||||
GlobalConfig::get_singleton()->set_custom_property_info("application/icon", PropertyInfo(Variant::STRING, "application/icon", PROPERTY_HINT_FILE, "*.png,*.webp"));
|
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) {
|
if (!OS::get_singleton()->has_touchscreen_ui_hint() && Input::get_singleton() && !editor) {
|
||||||
//only if no touchscreen ui hint, set emulation
|
//only if no touchscreen ui hint, set emulation
|
||||||
InputDefault *id = Input::get_singleton()->cast_to<InputDefault>();
|
InputDefault *id = Input::get_singleton()->cast_to<InputDefault>();
|
||||||
|
@ -1145,8 +1144,8 @@ bool Main::start() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (script == "" && game_path == "" && String(GLOBAL_DEF("application/main_scene", "")) != "") {
|
if (script == "" && game_path == "" && String(GLOBAL_DEF("application/run/main_scene", "")) != "") {
|
||||||
game_path = GLOBAL_DEF("application/main_scene", "");
|
game_path = GLOBAL_DEF("application/run/main_scene", "");
|
||||||
}
|
}
|
||||||
|
|
||||||
MainLoop *main_loop = NULL;
|
MainLoop *main_loop = NULL;
|
||||||
|
@ -1189,7 +1188,7 @@ bool Main::start() {
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} 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 == "")
|
if (!main_loop && main_loop_type == "")
|
||||||
|
@ -1249,12 +1248,15 @@ bool Main::start() {
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
if (!editor) {
|
if (!editor) {
|
||||||
//standard helpers that can be changed from main config
|
//standard helpers that can be changed from main config
|
||||||
|
|
||||||
String stretch_mode = GLOBAL_DEF("display/stretch/mode", "disabled");
|
String stretch_mode = GLOBAL_DEF("display/window/stretch/mode", "disabled");
|
||||||
String stretch_aspect = GLOBAL_DEF("display/stretch/aspect", "ignore");
|
String stretch_aspect = GLOBAL_DEF("display/window/stretch/aspect", "ignore");
|
||||||
Size2i stretch_size = Size2(GLOBAL_DEF("display/window/width", 0), GLOBAL_DEF("display/window/height", 0));
|
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;
|
SceneTree::StretchMode sml_sm = SceneTree::STRETCH_MODE_DISABLED;
|
||||||
if (stretch_mode == "2d")
|
if (stretch_mode == "2d")
|
||||||
|
@ -1272,17 +1274,17 @@ bool Main::start() {
|
||||||
|
|
||||||
sml->set_screen_stretch(sml_sm, sml_aspect, stretch_size);
|
sml->set_screen_stretch(sml_sm, sml_aspect, stretch_size);
|
||||||
|
|
||||||
sml->set_auto_accept_quit(GLOBAL_DEF("application/auto_accept_quit", true));
|
sml->set_auto_accept_quit(GLOBAL_DEF("application/config/auto_accept_quit", true));
|
||||||
sml->set_quit_on_go_back(GLOBAL_DEF("application/quit_on_go_back", true));
|
sml->set_quit_on_go_back(GLOBAL_DEF("application/config/quit_on_go_back", true));
|
||||||
String appname = GlobalConfig::get_singleton()->get("application/name");
|
String appname = GlobalConfig::get_singleton()->get("application/config/name");
|
||||||
appname = TranslationServer::get_singleton()->translate(appname);
|
appname = TranslationServer::get_singleton()->translate(appname);
|
||||||
OS::get_singleton()->set_window_title(appname);
|
OS::get_singleton()->set_window_title(appname);
|
||||||
|
|
||||||
int shadow_atlas_size = GLOBAL_DEF("rendering/shadow_atlas/size", 2048);
|
int shadow_atlas_size = GLOBAL_GET("rendering/quality/shadow_atlas/size");
|
||||||
int shadow_atlas_q0_subdiv = GLOBAL_DEF("rendering/shadow_atlas/quadrant_0_subdiv", 2);
|
int shadow_atlas_q0_subdiv = GLOBAL_GET("rendering/quality/shadow_atlas/quadrant_0_subdiv");
|
||||||
int shadow_atlas_q1_subdiv = GLOBAL_DEF("rendering/shadow_atlas/quadrant_1_subdiv", 2);
|
int shadow_atlas_q1_subdiv = GLOBAL_GET("rendering/quality/shadow_atlas/quadrant_1_subdiv");
|
||||||
int shadow_atlas_q2_subdiv = GLOBAL_DEF("rendering/shadow_atlas/quadrant_2_subdiv", 3);
|
int shadow_atlas_q2_subdiv = GLOBAL_GET("rendering/quality/shadow_atlas/quadrant_2_subdiv");
|
||||||
int shadow_atlas_q3_subdiv = GLOBAL_DEF("rendering/shadow_atlas/quadrant_3_subdiv", 4);
|
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_size(shadow_atlas_size);
|
||||||
sml->get_root()->set_shadow_atlas_quadrant_subdiv(0, Viewport::ShadowAtlasQuadrantSubdiv(shadow_atlas_q0_subdiv));
|
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));
|
sml->get_root()->set_shadow_atlas_quadrant_subdiv(3, Viewport::ShadowAtlasQuadrantSubdiv(shadow_atlas_q3_subdiv));
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
GLOBAL_DEF("display/stretch/mode", "disabled");
|
GLOBAL_DEF("display/window/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"));
|
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/stretch/aspect", "ignore");
|
GLOBAL_DEF("display/window/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"));
|
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/auto_accept_quit", true));
|
sml->set_auto_accept_quit(GLOBAL_DEF("application/config/auto_accept_quit", true));
|
||||||
sml->set_quit_on_go_back(GLOBAL_DEF("application/quit_on_go_back", true));
|
sml->set_quit_on_go_back(GLOBAL_DEF("application/config/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"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
String local_game_path;
|
String local_game_path;
|
||||||
|
@ -1463,7 +1453,7 @@ bool Main::start() {
|
||||||
//sml->get_root()->add_child(scene);
|
//sml->get_root()->add_child(scene);
|
||||||
sml->add_current_scene(scene);
|
sml->add_current_scene(scene);
|
||||||
|
|
||||||
String iconpath = GLOBAL_DEF("application/icon", "Variant()");
|
String iconpath = GLOBAL_DEF("application/config/icon", "Variant()");
|
||||||
if (iconpath != "") {
|
if (iconpath != "") {
|
||||||
Ref<Image> icon;
|
Ref<Image> icon;
|
||||||
if (icon->load(iconpath) == OK)
|
if (icon->load(iconpath) == OK)
|
||||||
|
@ -1641,7 +1631,7 @@ bool Main::iteration() {
|
||||||
|
|
||||||
if (frame > 1000000) {
|
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));
|
print_line("FPS: " + itos(frames));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1885,7 +1885,7 @@ GDScriptLanguage::GDScriptLanguage() {
|
||||||
script_frame_time = 0;
|
script_frame_time = 0;
|
||||||
|
|
||||||
_debug_call_stack_pos = 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()) {
|
if (ScriptDebugger::get_singleton()) {
|
||||||
//debugging enabled!
|
//debugging enabled!
|
||||||
|
|
||||||
|
|
|
@ -2658,7 +2658,7 @@ VisualScriptLanguage::VisualScriptLanguage() {
|
||||||
_debug_parse_err_node = -1;
|
_debug_parse_err_node = -1;
|
||||||
_debug_parse_err_file = "";
|
_debug_parse_err_file = "";
|
||||||
_debug_call_stack_pos = 0;
|
_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()) {
|
if (ScriptDebugger::get_singleton()) {
|
||||||
//debugging enabled!
|
//debugging enabled!
|
||||||
_debug_max_call_stack = dmcs;
|
_debug_max_call_stack = dmcs;
|
||||||
|
|
|
@ -554,7 +554,7 @@ void EditorExportPlatformAndroid::_fix_resources(Vector<uint8_t>& p_manifest) {
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
String lang = str.substr(str.find_last("-")+1,str.length()).replace("-","_");
|
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)) {
|
if (GlobalConfig::get_singleton()->has(prop)) {
|
||||||
str = GlobalConfig::get_singleton()->get(prop);
|
str = GlobalConfig::get_singleton()->get(prop);
|
||||||
} else {
|
} else {
|
||||||
|
@ -628,7 +628,7 @@ String EditorExportPlatformAndroid::get_project_name() const {
|
||||||
if (this->name!="") {
|
if (this->name!="") {
|
||||||
aname=this->name;
|
aname=this->name;
|
||||||
} else {
|
} 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) {
|
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")) {
|
if (appicon!="" && appicon.ends_with(".png")) {
|
||||||
FileAccess*f = FileAccess::open(appicon,FileAccess::READ);
|
FileAccess*f = FileAccess::open(appicon,FileAccess::READ);
|
||||||
if (f) {
|
if (f) {
|
||||||
|
@ -1763,7 +1763,7 @@ Error EditorExportPlatformAndroid::run(int p_device, int p_flags) {
|
||||||
String EditorExportPlatformAndroid::get_package_name() {
|
String EditorExportPlatformAndroid::get_package_name() {
|
||||||
|
|
||||||
String pname = package;
|
String pname = package;
|
||||||
String basename = GlobalConfig::get_singleton()->get("application/name");
|
String basename = GlobalConfig::get_singleton()->get("application/config/name");
|
||||||
basename=basename.to_lower();
|
basename=basename.to_lower();
|
||||||
|
|
||||||
String name;
|
String name;
|
||||||
|
@ -2208,7 +2208,7 @@ class EditorExportAndroid : public EditorExportPlatform {
|
||||||
if (p_name != "") {
|
if (p_name != "") {
|
||||||
aname = p_name;
|
aname = p_name;
|
||||||
} else {
|
} else {
|
||||||
aname = GlobalConfig::get_singleton()->get("application/name");
|
aname = GlobalConfig::get_singleton()->get("application/config/name");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (aname == "") {
|
if (aname == "") {
|
||||||
|
@ -2221,7 +2221,7 @@ class EditorExportAndroid : public EditorExportPlatform {
|
||||||
String get_package_name(const String &p_package) {
|
String get_package_name(const String &p_package) {
|
||||||
|
|
||||||
String pname = 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();
|
basename = basename.to_lower();
|
||||||
|
|
||||||
String name;
|
String name;
|
||||||
|
@ -2750,7 +2750,7 @@ class EditorExportAndroid : public EditorExportPlatform {
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
String lang = str.substr(str.find_last("-") + 1, str.length()).replace("-", "_");
|
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)) {
|
if (GlobalConfig::get_singleton()->has(prop)) {
|
||||||
str = GlobalConfig::get_singleton()->get(prop);
|
str = GlobalConfig::get_singleton()->get(prop);
|
||||||
} else {
|
} else {
|
||||||
|
@ -3219,7 +3219,7 @@ public:
|
||||||
|
|
||||||
if (!found) {
|
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")) {
|
if (appicon != "" && appicon.ends_with(".png")) {
|
||||||
FileAccess *f = FileAccess::open(appicon, FileAccess::READ);
|
FileAccess *f = FileAccess::open(appicon, FileAccess::READ);
|
||||||
if (f) {
|
if (f) {
|
||||||
|
|
|
@ -273,7 +273,7 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
|
||||||
|
|
||||||
mView = new GodotView(getApplication(),io,use_gl2,use_32_bits, this);
|
mView = new GodotView(getApplication(),io,use_gl2,use_32_bits, this);
|
||||||
layout.addView(mView,new LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.FILL_PARENT));
|
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);
|
edittext.setView(mView);
|
||||||
io.setEdit(edittext);
|
io.setEdit(edittext);
|
||||||
|
|
|
@ -29,11 +29,11 @@
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
#import "app_delegate.h"
|
#import "app_delegate.h"
|
||||||
|
|
||||||
|
#include "audio_driver_iphone.h"
|
||||||
#include "core/global_config.h"
|
#include "core/global_config.h"
|
||||||
#import "gl_view.h"
|
#import "gl_view.h"
|
||||||
#include "main/main.h"
|
#include "main/main.h"
|
||||||
#include "os_iphone.h"
|
#include "os_iphone.h"
|
||||||
#include "audio_driver_iphone.h"
|
|
||||||
|
|
||||||
#ifdef MODULE_FACEBOOKSCORER_IOS_ENABLED
|
#ifdef MODULE_FACEBOOKSCORER_IOS_ENABLED
|
||||||
#include "modules/FacebookScorer_ios/FacebookScorer.h"
|
#include "modules/FacebookScorer_ios/FacebookScorer.h"
|
||||||
|
@ -615,7 +615,7 @@ static int frame_count = 0;
|
||||||
view_controller.view = glView;
|
view_controller.view = glView;
|
||||||
window.rootViewController = view_controller;
|
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 =
|
glView.useCADisplayLink =
|
||||||
bool(GLOBAL_DEF("display.iOS/use_cadisplaylink", true)) ? YES : NO;
|
bool(GLOBAL_DEF("display.iOS/use_cadisplaylink", true)) ? YES : NO;
|
||||||
printf("cadisaplylink: %d", glView.useCADisplayLink);
|
printf("cadisaplylink: %d", glView.useCADisplayLink);
|
||||||
|
@ -673,7 +673,6 @@ static int frame_count = 0;
|
||||||
isAdvertisingTrackingEnabled]];
|
isAdvertisingTrackingEnabled]];
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
- (void)applicationWillTerminate:(UIApplication *)application {
|
- (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
|
// 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();
|
AudioDriverIphone::get_singleton()->start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -345,7 +345,7 @@ Error EditorExportPlatformOSX::export_project(const Ref<EditorExportPreset> &p_p
|
||||||
if (p_preset->get("application/icon") != "")
|
if (p_preset->get("application/icon") != "")
|
||||||
iconpath = p_preset->get("application/icon");
|
iconpath = p_preset->get("application/icon");
|
||||||
else
|
else
|
||||||
iconpath = GlobalConfig::get_singleton()->get("application/icon");
|
iconpath = GlobalConfig::get_singleton()->get("application/config/icon");
|
||||||
print_line("icon? " + iconpath);
|
print_line("icon? " + iconpath);
|
||||||
if (iconpath != "") {
|
if (iconpath != "") {
|
||||||
Ref<Image> icon;
|
Ref<Image> icon;
|
||||||
|
@ -484,8 +484,8 @@ Error EditorExportPlatformOSX::export_project(const Ref<EditorExportPreset> &p_p
|
||||||
String pkg_name;
|
String pkg_name;
|
||||||
if (p_preset->get("application/name") != "")
|
if (p_preset->get("application/name") != "")
|
||||||
pkg_name = p_preset->get("application/name"); // app_name
|
pkg_name = p_preset->get("application/name"); // app_name
|
||||||
else if (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/name"));
|
pkg_name = String(GlobalConfig::get_singleton()->get("application/config/name"));
|
||||||
else
|
else
|
||||||
pkg_name = "Unnamed";
|
pkg_name = "Unnamed";
|
||||||
|
|
||||||
|
@ -539,7 +539,7 @@ Error EditorExportPlatformOSX::export_project(const Ref<EditorExportPreset> &p_p
|
||||||
if (p_preset->get("application/icon") != "")
|
if (p_preset->get("application/icon") != "")
|
||||||
iconpath = p_preset->get("application/icon");
|
iconpath = p_preset->get("application/icon");
|
||||||
else
|
else
|
||||||
iconpath = GlobalConfig::get_singleton()->get("application/icon");
|
iconpath = GlobalConfig::get_singleton()->get("application/config/icon");
|
||||||
print_line("icon? " + iconpath);
|
print_line("icon? " + iconpath);
|
||||||
if (iconpath != "") {
|
if (iconpath != "") {
|
||||||
Ref<Image> icon;
|
Ref<Image> icon;
|
||||||
|
|
|
@ -310,7 +310,7 @@ void OSUWP::initialize(const VideoMode &p_desired, int p_video_driver, int p_aud
|
||||||
if (is_keep_screen_on())
|
if (is_keep_screen_on())
|
||||||
display_request->RequestActive();
|
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) {
|
void OSUWP::set_clipboard(const String &p_text) {
|
||||||
|
|
|
@ -2229,7 +2229,7 @@ String OS_Windows::get_data_dir() const {
|
||||||
|
|
||||||
if (has_environment("APPDATA")) {
|
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)
|
if (!use_godot)
|
||||||
return (OS::get_singleton()->get_environment("APPDATA") + "/" + an).replace("\\", "/");
|
return (OS::get_singleton()->get_environment("APPDATA") + "/" + an).replace("\\", "/");
|
||||||
else
|
else
|
||||||
|
|
|
@ -614,7 +614,7 @@ bool SceneTree::idle(float p_time) {
|
||||||
|
|
||||||
if (is_editor_hint()) {
|
if (is_editor_hint()) {
|
||||||
//simple hack to reload fallback environment if it changed from editor
|
//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
|
env_path = env_path.strip_edges(); //user may have added a space or two
|
||||||
String cpath;
|
String cpath;
|
||||||
Ref<Environment> fallback = get_root()->get_world()->get_fallback_environment();
|
Ref<Environment> fallback = get_root()->get_world()->get_fallback_environment();
|
||||||
|
@ -2317,11 +2317,11 @@ SceneTree::SceneTree() {
|
||||||
debug_collisions_hint = false;
|
debug_collisions_hint = false;
|
||||||
debug_navigation_hint = false;
|
debug_navigation_hint = false;
|
||||||
#endif
|
#endif
|
||||||
debug_collisions_color = GLOBAL_DEF("debug/collision/shape_color", Color(0.0, 0.6, 0.7, 0.5));
|
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/collision/contact_color", Color(1.0, 0.2, 0.1, 0.8));
|
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/navigation/geometry_color", Color(0.1, 1.0, 0.7, 0.4));
|
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/navigation/disabled_geometry_color", Color(1.0, 0.7, 0.1, 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/collision/max_contacts_displayed", 10000);
|
collision_debug_contacts = GLOBAL_DEF("debug/shapes/collision/max_contacts_displayed", 10000);
|
||||||
|
|
||||||
tree_version = 1;
|
tree_version = 1;
|
||||||
fixed_process_time = 1;
|
fixed_process_time = 1;
|
||||||
|
@ -2348,12 +2348,12 @@ SceneTree::SceneTree() {
|
||||||
root->set_as_audio_listener_2d(true);
|
root->set_as_audio_listener_2d(true);
|
||||||
current_scene = NULL;
|
current_scene = NULL;
|
||||||
|
|
||||||
int ref_atlas_size = GLOBAL_DEF("rendering/reflections/atlas_size", 2048);
|
int ref_atlas_size = GLOBAL_DEF("rendering/quality/reflections/atlas_size", 2048);
|
||||||
int ref_atlas_subdiv = GLOBAL_DEF("rendering/reflections/atlas_subdiv", 8);
|
int ref_atlas_subdiv = GLOBAL_DEF("rendering/quality/reflections/atlas_subdiv", 8);
|
||||||
int msaa_mode = GLOBAL_DEF("rendering/quality/msaa", 0);
|
int msaa_mode = GLOBAL_DEF("rendering/quality/filters/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"));
|
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));
|
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);
|
root->set_hdr(hdr);
|
||||||
|
|
||||||
VS::get_singleton()->scenario_set_reflection_atlas_size(root->get_world()->get_scenario(), ref_atlas_size, ref_atlas_subdiv);
|
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();
|
ext_hint += "*." + E->get();
|
||||||
}
|
}
|
||||||
//get path
|
//get path
|
||||||
String env_path = GLOBAL_DEF("rendering/viewport/default_environment", "");
|
String env_path = GLOBAL_DEF("rendering/environment/default_environment", "");
|
||||||
//setup property
|
//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();
|
env_path = env_path.strip_edges();
|
||||||
if (env_path != String()) {
|
if (env_path != String()) {
|
||||||
Ref<Environment> env = ResourceLoader::load(env_path);
|
Ref<Environment> env = ResourceLoader::load(env_path);
|
||||||
|
@ -2380,7 +2380,7 @@ SceneTree::SceneTree() {
|
||||||
} else {
|
} else {
|
||||||
if (is_editor_hint()) {
|
if (is_editor_hint()) {
|
||||||
//file was erased, clear the field.
|
//file was erased, clear the field.
|
||||||
GlobalConfig::get_singleton()->set("rendering/viewport/default_environment", "");
|
GlobalConfig::get_singleton()->set("rendering/environment/default_environment", "");
|
||||||
} else {
|
} else {
|
||||||
//file was erased, notify user.
|
//file was erased, notify user.
|
||||||
ERR_PRINTS(RTR("Default Environment as specified in Project Setings (Rendering -> Viewport -> Default Environment) could not be loaded."));
|
ERR_PRINTS(RTR("Default Environment as specified in Project Setings (Rendering -> Viewport -> Default Environment) could not be loaded."));
|
||||||
|
|
|
@ -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::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");
|
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_KEEP);
|
||||||
BIND_CONSTANT(BG_CLEAR_COLOR);
|
BIND_CONSTANT(BG_CLEAR_COLOR);
|
||||||
BIND_CONSTANT(BG_COLOR);
|
BIND_CONSTANT(BG_COLOR);
|
||||||
|
|
|
@ -812,6 +812,7 @@ void SurfaceTool::clear() {
|
||||||
index_array.clear();
|
index_array.clear();
|
||||||
vertex_array.clear();
|
vertex_array.clear();
|
||||||
smooth_groups.clear();
|
smooth_groups.clear();
|
||||||
|
material.unref();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SurfaceTool::_bind_methods() {
|
void SurfaceTool::_bind_methods() {
|
||||||
|
|
|
@ -161,12 +161,12 @@ Physics2DServerWrapMT::Physics2DServerWrapMT(Physics2DServer *p_contained, bool
|
||||||
step_thread_up = false;
|
step_thread_up = false;
|
||||||
alloc_mutex = Mutex::create();
|
alloc_mutex = Mutex::create();
|
||||||
|
|
||||||
shape_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/multithread/thread_rid_pool_prealloc");
|
area_pool_max_size = GLOBAL_GET("memory/limits/multithreaded_server/rid_pool_prealloc");
|
||||||
body_pool_max_size = GLOBAL_GET("memory/multithread/thread_rid_pool_prealloc");
|
body_pool_max_size = GLOBAL_GET("memory/limits/multithreaded_server/rid_pool_prealloc");
|
||||||
pin_joint_pool_max_size = GLOBAL_GET("memory/multithread/thread_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/multithread/thread_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/multithread/thread_rid_pool_prealloc");
|
damped_spring_joint_pool_max_size = GLOBAL_GET("memory/limits/multithreaded_server/rid_pool_prealloc");
|
||||||
|
|
||||||
if (!p_create_thread) {
|
if (!p_create_thread) {
|
||||||
server_thread = Thread::get_caller_ID();
|
server_thread = Thread::get_caller_ID();
|
||||||
|
|
|
@ -73,8 +73,6 @@ ShaderTypes *shader_types = NULL;
|
||||||
|
|
||||||
void register_server_types() {
|
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("VisualServer", VisualServer::get_singleton()));
|
||||||
GlobalConfig::get_singleton()->add_singleton(GlobalConfig::Singleton("AudioServer", AudioServer::get_singleton()));
|
GlobalConfig::get_singleton()->add_singleton(GlobalConfig::Singleton("AudioServer", AudioServer::get_singleton()));
|
||||||
GlobalConfig::get_singleton()->add_singleton(GlobalConfig::Singleton("PhysicsServer", PhysicsServer::get_singleton()));
|
GlobalConfig::get_singleton()->add_singleton(GlobalConfig::Singleton("PhysicsServer", PhysicsServer::get_singleton()));
|
||||||
|
|
|
@ -265,7 +265,7 @@ void VisualServerViewport::draw_viewports() {
|
||||||
|
|
||||||
//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<ViewportSort>();
|
active_viewports.sort_custom<ViewportSort>();
|
||||||
|
|
||||||
|
|
|
@ -176,7 +176,7 @@ VisualServerWrapMT::VisualServerWrapMT(VisualServer *p_contained, bool p_create_
|
||||||
draw_pending = 0;
|
draw_pending = 0;
|
||||||
draw_thread_up = false;
|
draw_thread_up = false;
|
||||||
alloc_mutex = Mutex::create();
|
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) {
|
if (!p_create_thread) {
|
||||||
server_thread = Thread::get_caller_ID();
|
server_thread = Thread::get_caller_ID();
|
||||||
|
|
|
@ -1567,10 +1567,22 @@ VisualServer::VisualServer() {
|
||||||
|
|
||||||
//ERR_FAIL_COND(singleton);
|
//ERR_FAIL_COND(singleton);
|
||||||
singleton = this;
|
singleton = this;
|
||||||
GLOBAL_DEF("rendering/vram_formats/use_s3tc", true);
|
GLOBAL_DEF("rendering/vram_compression/import_s3tc", true);
|
||||||
GLOBAL_DEF("rendering/vram_formats/use_etc", false);
|
GLOBAL_DEF("rendering/vram_compression/import_etc", false);
|
||||||
GLOBAL_DEF("rendering/vram_formats/use_etc2", true);
|
GLOBAL_DEF("rendering/vram_compression/import_etc2", true);
|
||||||
GLOBAL_DEF("rendering/vram_formats/use_pvrtc", false);
|
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() {
|
VisualServer::~VisualServer() {
|
||||||
|
|
Loading…
Reference in New Issue