diff options
475 files changed, 23854 insertions, 5003 deletions
diff --git a/COPYRIGHT.txt b/COPYRIGHT.txt index 2dc58158ef..02cd733c92 100644 --- a/COPYRIGHT.txt +++ b/COPYRIGHT.txt @@ -293,7 +293,7 @@ License: CC0-1.0 Files: ./thirdparty/miniupnpc/ Comment: MiniUPnP Project -Copyright: 2005-2021, Thomas Bernard +Copyright: 2005-2022, Thomas Bernard License: BSD-3-clause Files: ./thirdparty/minizip/ diff --git a/SConstruct b/SConstruct index 6847a7c937..03043ee110 100644 --- a/SConstruct +++ b/SConstruct @@ -544,6 +544,12 @@ if selected_platform in platform_list: env.Append(CCFLAGS=["-g3"]) else: env.Append(CCFLAGS=["-g2"]) + else: + if methods.using_clang(env) and not methods.is_vanilla_clang(env): + # Apple Clang, its linker doesn't like -s. + env.Append(LINKFLAGS=["-Wl,-S", "-Wl,-x", "-Wl,-dead_strip"]) + else: + env.Append(LINKFLAGS=["-s"]) if env["optimize"] == "speed": env.Append(CCFLAGS=["-O3"]) diff --git a/core/config/project_settings.cpp b/core/config/project_settings.cpp index 7aaa9a46b7..d0de39a79d 100644 --- a/core/config/project_settings.cpp +++ b/core/config/project_settings.cpp @@ -1200,6 +1200,7 @@ ProjectSettings::ProjectSettings() { // Initialization of engine variables should be done in the setup() method, // so that the values can be overridden from project.godot or project.binary. + CRASH_COND_MSG(singleton != nullptr, "Instantiating a new ProjectSettings singleton is not supported."); singleton = this; GLOBAL_DEF_BASIC("application/config/name", ""); diff --git a/core/core_bind.cpp b/core/core_bind.cpp index 1fe34cb4fd..9503bd2575 100644 --- a/core/core_bind.cpp +++ b/core/core_bind.cpp @@ -236,8 +236,12 @@ Vector<String> OS::get_system_fonts() const { return ::OS::get_singleton()->get_system_fonts(); } -String OS::get_system_font_path(const String &p_font_name, bool p_bold, bool p_italic) const { - return ::OS::get_singleton()->get_system_font_path(p_font_name, p_bold, p_italic); +String OS::get_system_font_path(const String &p_font_name, int p_weight, int p_stretch, bool p_italic) const { + return ::OS::get_singleton()->get_system_font_path(p_font_name, p_weight, p_stretch, p_italic); +} + +Vector<String> OS::get_system_font_path_for_text(const String &p_font_name, const String &p_text, const String &p_locale, const String &p_script, int p_weight, int p_stretch, bool p_italic) const { + return ::OS::get_singleton()->get_system_font_path_for_text(p_font_name, p_text, p_locale, p_script, p_weight, p_stretch, p_italic); } String OS::get_executable_path() const { @@ -532,7 +536,8 @@ void OS::_bind_methods() { ClassDB::bind_method(D_METHOD("get_processor_name"), &OS::get_processor_name); ClassDB::bind_method(D_METHOD("get_system_fonts"), &OS::get_system_fonts); - ClassDB::bind_method(D_METHOD("get_system_font_path", "font_name", "bold", "italic"), &OS::get_system_font_path, DEFVAL(false), DEFVAL(false)); + ClassDB::bind_method(D_METHOD("get_system_font_path", "font_name", "weight", "stretch", "italic"), &OS::get_system_font_path, DEFVAL(400), DEFVAL(100), DEFVAL(false)); + ClassDB::bind_method(D_METHOD("get_system_font_path_for_text", "font_name", "text", "locale", "script", "weight", "stretch", "italic"), &OS::get_system_font_path_for_text, DEFVAL(String()), DEFVAL(String()), DEFVAL(400), DEFVAL(100), DEFVAL(false)); ClassDB::bind_method(D_METHOD("get_executable_path"), &OS::get_executable_path); ClassDB::bind_method(D_METHOD("read_string_from_stdin", "block"), &OS::read_string_from_stdin, DEFVAL(true)); ClassDB::bind_method(D_METHOD("execute", "path", "arguments", "output", "read_stderr", "open_console"), &OS::execute, DEFVAL(Array()), DEFVAL(false), DEFVAL(false)); diff --git a/core/core_bind.h b/core/core_bind.h index 748ecb4929..c863a8094c 100644 --- a/core/core_bind.h +++ b/core/core_bind.h @@ -170,7 +170,8 @@ public: void crash(const String &p_message); Vector<String> get_system_fonts() const; - String get_system_font_path(const String &p_font_name, bool p_bold = false, bool p_italic = false) const; + String get_system_font_path(const String &p_font_name, int p_weight = 400, int p_stretch = 100, bool p_italic = false) const; + Vector<String> get_system_font_path_for_text(const String &p_font_name, const String &p_text, const String &p_locale = String(), const String &p_script = String(), int p_weight = 400, int p_stretch = 100, bool p_italic = false) const; String get_executable_path() const; String read_string_from_stdin(bool p_block = true); int execute(const String &p_path, const Vector<String> &p_arguments, Array r_output = Array(), bool p_read_stderr = false, bool p_open_console = false); diff --git a/core/core_constants.cpp b/core/core_constants.cpp index 628740ed32..e0772cd43d 100644 --- a/core/core_constants.cpp +++ b/core/core_constants.cpp @@ -637,7 +637,6 @@ void register_global_constants() { BIND_CORE_ENUM_CONSTANT(PROPERTY_USAGE_SCRIPT_VARIABLE); BIND_CORE_ENUM_CONSTANT(PROPERTY_USAGE_STORE_IF_NULL); - BIND_CORE_ENUM_CONSTANT(PROPERTY_USAGE_ANIMATE_AS_TRIGGER); BIND_CORE_ENUM_CONSTANT(PROPERTY_USAGE_UPDATE_ALL_IF_MODIFIED); BIND_CORE_ENUM_CONSTANT(PROPERTY_USAGE_SCRIPT_DEFAULT_VALUE); BIND_CORE_ENUM_CONSTANT(PROPERTY_USAGE_CLASS_IS_ENUM); diff --git a/core/extension/extension_api_dump.cpp b/core/extension/extension_api_dump.cpp index a2c507e350..196bb68b2b 100644 --- a/core/extension/extension_api_dump.cpp +++ b/core/extension/extension_api_dump.cpp @@ -266,7 +266,7 @@ Dictionary NativeExtensionAPIDump::generate_extension_api() { { Variant::VECTOR2I, "x", 0, 0, 0, 0 }, { Variant::VECTOR2I, "y", sizeof(int32_t), sizeof(int32_t), sizeof(int32_t), sizeof(int32_t) }, { Variant::RECT2, "position", 0, 0, 0, 0 }, - { Variant::RECT2, "size", 2 * sizeof(Vector2), 2 * sizeof(float), 2 * sizeof(double), 2 * sizeof(double) }, + { Variant::RECT2, "size", 2 * sizeof(float), 2 * sizeof(float), 2 * sizeof(double), 2 * sizeof(double) }, { Variant::RECT2I, "position", 0, 0, 0, 0 }, { Variant::RECT2I, "size", 2 * sizeof(int32_t), 2 * sizeof(int32_t), 2 * sizeof(int32_t), 2 * sizeof(int32_t) }, { Variant::VECTOR3, "x", 0, 0, 0, 0 }, @@ -871,9 +871,18 @@ Dictionary NativeExtensionAPIDump::generate_extension_api() { Dictionary d2; d2["type"] = get_property_info_type_name(F); d2["name"] = String(property_name); - d2["setter"] = ClassDB::get_property_setter(class_name, F.name); - d2["getter"] = ClassDB::get_property_getter(class_name, F.name); - d2["index"] = ClassDB::get_property_index(class_name, F.name); + StringName setter = ClassDB::get_property_setter(class_name, F.name); + if (!(setter == "")) { + d2["setter"] = setter; + } + StringName getter = ClassDB::get_property_getter(class_name, F.name); + if (!(getter == "")) { + d2["getter"] = getter; + } + int index = ClassDB::get_property_index(class_name, F.name); + if (index != -1) { + d2["index"] = index; + } properties.push_back(d2); } diff --git a/core/extension/gdnative_interface.cpp b/core/extension/gdnative_interface.cpp index 864f2fa86b..78dc6dac0b 100644 --- a/core/extension/gdnative_interface.cpp +++ b/core/extension/gdnative_interface.cpp @@ -61,15 +61,15 @@ static void gdnative_print_script_error(const char *p_description, const char *p _err_print_error(p_function, p_file, p_line, p_description, false, ERR_HANDLER_SCRIPT); } -uint64_t gdnative_get_native_struct_size(const GDNativeStringNamePtr p_name) { +uint64_t gdnative_get_native_struct_size(GDNativeConstStringNamePtr p_name) { const StringName name = *reinterpret_cast<const StringName *>(p_name); return ClassDB::get_native_struct_size(name); } // Variant functions -static void gdnative_variant_new_copy(GDNativeVariantPtr r_dest, const GDNativeVariantPtr p_src) { - memnew_placement(reinterpret_cast<Variant *>(r_dest), Variant(*reinterpret_cast<Variant *>(p_src))); +static void gdnative_variant_new_copy(GDNativeVariantPtr r_dest, GDNativeConstVariantPtr p_src) { + memnew_placement(reinterpret_cast<Variant *>(r_dest), Variant(*reinterpret_cast<const Variant *>(p_src))); } static void gdnative_variant_new_nil(GDNativeVariantPtr r_dest) { memnew_placement(reinterpret_cast<Variant *>(r_dest), Variant); @@ -80,7 +80,7 @@ static void gdnative_variant_destroy(GDNativeVariantPtr p_self) { // variant type -static void gdnative_variant_call(GDNativeVariantPtr p_self, const GDNativeStringNamePtr p_method, const GDNativeVariantPtr *p_args, const GDNativeInt p_argcount, GDNativeVariantPtr r_return, GDNativeCallError *r_error) { +static void gdnative_variant_call(GDNativeVariantPtr p_self, GDNativeConstStringNamePtr p_method, GDNativeConstVariantPtr *p_args, GDNativeInt p_argcount, GDNativeVariantPtr r_return, GDNativeCallError *r_error) { Variant *self = (Variant *)p_self; const StringName method = *reinterpret_cast<const StringName *>(p_method); const Variant **args = (const Variant **)p_args; @@ -96,7 +96,7 @@ static void gdnative_variant_call(GDNativeVariantPtr p_self, const GDNativeStrin } } -static void gdnative_variant_call_static(GDNativeVariantType p_type, const GDNativeStringNamePtr p_method, const GDNativeVariantPtr *p_args, const GDNativeInt p_argcount, GDNativeVariantPtr r_return, GDNativeCallError *r_error) { +static void gdnative_variant_call_static(GDNativeVariantType p_type, GDNativeConstStringNamePtr p_method, GDNativeConstVariantPtr *p_args, GDNativeInt p_argcount, GDNativeVariantPtr r_return, GDNativeCallError *r_error) { Variant::Type type = (Variant::Type)p_type; const StringName method = *reinterpret_cast<const StringName *>(p_method); const Variant **args = (const Variant **)p_args; @@ -112,7 +112,7 @@ static void gdnative_variant_call_static(GDNativeVariantType p_type, const GDNat } } -static void gdnative_variant_evaluate(GDNativeVariantOperator p_op, const GDNativeVariantPtr p_a, const GDNativeVariantPtr p_b, GDNativeVariantPtr r_return, GDNativeBool *r_valid) { +static void gdnative_variant_evaluate(GDNativeVariantOperator p_op, GDNativeConstVariantPtr p_a, GDNativeConstVariantPtr p_b, GDNativeVariantPtr r_return, GDNativeBool *r_valid) { Variant::Operator op = (Variant::Operator)p_op; const Variant *a = (const Variant *)p_a; const Variant *b = (const Variant *)p_b; @@ -122,7 +122,7 @@ static void gdnative_variant_evaluate(GDNativeVariantOperator p_op, const GDNati *r_valid = valid; } -static void gdnative_variant_set(GDNativeVariantPtr p_self, const GDNativeVariantPtr p_key, const GDNativeVariantPtr p_value, GDNativeBool *r_valid) { +static void gdnative_variant_set(GDNativeVariantPtr p_self, GDNativeConstVariantPtr p_key, GDNativeConstVariantPtr p_value, GDNativeBool *r_valid) { Variant *self = (Variant *)p_self; const Variant *key = (const Variant *)p_key; const Variant *value = (const Variant *)p_value; @@ -132,7 +132,7 @@ static void gdnative_variant_set(GDNativeVariantPtr p_self, const GDNativeVarian *r_valid = valid; } -static void gdnative_variant_set_named(GDNativeVariantPtr p_self, const GDNativeStringNamePtr p_key, const GDNativeVariantPtr p_value, GDNativeBool *r_valid) { +static void gdnative_variant_set_named(GDNativeVariantPtr p_self, GDNativeConstStringNamePtr p_key, GDNativeConstVariantPtr p_value, GDNativeBool *r_valid) { Variant *self = (Variant *)p_self; const StringName *key = (const StringName *)p_key; const Variant *value = (const Variant *)p_value; @@ -142,7 +142,7 @@ static void gdnative_variant_set_named(GDNativeVariantPtr p_self, const GDNative *r_valid = valid; } -static void gdnative_variant_set_keyed(GDNativeVariantPtr p_self, const GDNativeVariantPtr p_key, const GDNativeVariantPtr p_value, GDNativeBool *r_valid) { +static void gdnative_variant_set_keyed(GDNativeVariantPtr p_self, GDNativeConstVariantPtr p_key, GDNativeConstVariantPtr p_value, GDNativeBool *r_valid) { Variant *self = (Variant *)p_self; const Variant *key = (const Variant *)p_key; const Variant *value = (const Variant *)p_value; @@ -152,7 +152,7 @@ static void gdnative_variant_set_keyed(GDNativeVariantPtr p_self, const GDNative *r_valid = valid; } -static void gdnative_variant_set_indexed(GDNativeVariantPtr p_self, GDNativeInt p_index, const GDNativeVariantPtr p_value, GDNativeBool *r_valid, GDNativeBool *r_oob) { +static void gdnative_variant_set_indexed(GDNativeVariantPtr p_self, GDNativeInt p_index, GDNativeConstVariantPtr p_value, GDNativeBool *r_valid, GDNativeBool *r_oob) { Variant *self = (Variant *)p_self; const Variant *value = (const Variant *)p_value; @@ -163,7 +163,7 @@ static void gdnative_variant_set_indexed(GDNativeVariantPtr p_self, GDNativeInt *r_oob = oob; } -static void gdnative_variant_get(const GDNativeVariantPtr p_self, const GDNativeVariantPtr p_key, GDNativeVariantPtr r_ret, GDNativeBool *r_valid) { +static void gdnative_variant_get(GDNativeConstVariantPtr p_self, GDNativeConstVariantPtr p_key, GDNativeVariantPtr r_ret, GDNativeBool *r_valid) { const Variant *self = (const Variant *)p_self; const Variant *key = (const Variant *)p_key; @@ -172,7 +172,7 @@ static void gdnative_variant_get(const GDNativeVariantPtr p_self, const GDNative *r_valid = valid; } -static void gdnative_variant_get_named(const GDNativeVariantPtr p_self, const GDNativeStringNamePtr p_key, GDNativeVariantPtr r_ret, GDNativeBool *r_valid) { +static void gdnative_variant_get_named(GDNativeConstVariantPtr p_self, GDNativeConstStringNamePtr p_key, GDNativeVariantPtr r_ret, GDNativeBool *r_valid) { const Variant *self = (const Variant *)p_self; const StringName *key = (const StringName *)p_key; @@ -181,7 +181,7 @@ static void gdnative_variant_get_named(const GDNativeVariantPtr p_self, const GD *r_valid = valid; } -static void gdnative_variant_get_keyed(const GDNativeVariantPtr p_self, const GDNativeVariantPtr p_key, GDNativeVariantPtr r_ret, GDNativeBool *r_valid) { +static void gdnative_variant_get_keyed(GDNativeConstVariantPtr p_self, GDNativeConstVariantPtr p_key, GDNativeVariantPtr r_ret, GDNativeBool *r_valid) { const Variant *self = (const Variant *)p_self; const Variant *key = (const Variant *)p_key; @@ -190,7 +190,7 @@ static void gdnative_variant_get_keyed(const GDNativeVariantPtr p_self, const GD *r_valid = valid; } -static void gdnative_variant_get_indexed(const GDNativeVariantPtr p_self, GDNativeInt p_index, GDNativeVariantPtr r_ret, GDNativeBool *r_valid, GDNativeBool *r_oob) { +static void gdnative_variant_get_indexed(GDNativeConstVariantPtr p_self, GDNativeInt p_index, GDNativeVariantPtr r_ret, GDNativeBool *r_valid, GDNativeBool *r_oob) { const Variant *self = (const Variant *)p_self; bool valid; @@ -201,7 +201,7 @@ static void gdnative_variant_get_indexed(const GDNativeVariantPtr p_self, GDNati } /// Iteration. -static GDNativeBool gdnative_variant_iter_init(const GDNativeVariantPtr p_self, GDNativeVariantPtr r_iter, GDNativeBool *r_valid) { +static GDNativeBool gdnative_variant_iter_init(GDNativeConstVariantPtr p_self, GDNativeVariantPtr r_iter, GDNativeBool *r_valid) { const Variant *self = (const Variant *)p_self; Variant *iter = (Variant *)r_iter; @@ -211,7 +211,7 @@ static GDNativeBool gdnative_variant_iter_init(const GDNativeVariantPtr p_self, return ret; } -static GDNativeBool gdnative_variant_iter_next(const GDNativeVariantPtr p_self, GDNativeVariantPtr r_iter, GDNativeBool *r_valid) { +static GDNativeBool gdnative_variant_iter_next(GDNativeConstVariantPtr p_self, GDNativeVariantPtr r_iter, GDNativeBool *r_valid) { const Variant *self = (const Variant *)p_self; Variant *iter = (Variant *)r_iter; @@ -221,7 +221,7 @@ static GDNativeBool gdnative_variant_iter_next(const GDNativeVariantPtr p_self, return ret; } -static void gdnative_variant_iter_get(const GDNativeVariantPtr p_self, GDNativeVariantPtr r_iter, GDNativeVariantPtr r_ret, GDNativeBool *r_valid) { +static void gdnative_variant_iter_get(GDNativeConstVariantPtr p_self, GDNativeVariantPtr r_iter, GDNativeVariantPtr r_ret, GDNativeBool *r_valid) { const Variant *self = (const Variant *)p_self; Variant *iter = (Variant *)r_iter; @@ -231,53 +231,53 @@ static void gdnative_variant_iter_get(const GDNativeVariantPtr p_self, GDNativeV } /// Variant functions. -static GDNativeInt gdnative_variant_hash(const GDNativeVariantPtr p_self) { +static GDNativeInt gdnative_variant_hash(GDNativeConstVariantPtr p_self) { const Variant *self = (const Variant *)p_self; return self->hash(); } -static GDNativeInt gdnative_variant_recursive_hash(const GDNativeVariantPtr p_self, GDNativeInt p_recursion_count) { +static GDNativeInt gdnative_variant_recursive_hash(GDNativeConstVariantPtr p_self, GDNativeInt p_recursion_count) { const Variant *self = (const Variant *)p_self; return self->recursive_hash(p_recursion_count); } -static GDNativeBool gdnative_variant_hash_compare(const GDNativeVariantPtr p_self, const GDNativeVariantPtr p_other) { +static GDNativeBool gdnative_variant_hash_compare(GDNativeConstVariantPtr p_self, GDNativeConstVariantPtr p_other) { const Variant *self = (const Variant *)p_self; const Variant *other = (const Variant *)p_other; return self->hash_compare(*other); } -static GDNativeBool gdnative_variant_booleanize(const GDNativeVariantPtr p_self) { +static GDNativeBool gdnative_variant_booleanize(GDNativeConstVariantPtr p_self) { const Variant *self = (const Variant *)p_self; return self->booleanize(); } -static void gdnative_variant_duplicate(const GDNativeVariantPtr p_self, GDNativeVariantPtr r_ret, GDNativeBool p_deep) { +static void gdnative_variant_duplicate(GDNativeConstVariantPtr p_self, GDNativeVariantPtr r_ret, GDNativeBool p_deep) { const Variant *self = (const Variant *)p_self; memnew_placement(r_ret, Variant(self->duplicate(p_deep))); } -static void gdnative_variant_stringify(const GDNativeVariantPtr p_self, GDNativeStringPtr r_ret) { +static void gdnative_variant_stringify(GDNativeConstVariantPtr p_self, GDNativeStringPtr r_ret) { const Variant *self = (const Variant *)p_self; memnew_placement(r_ret, String(*self)); } -static GDNativeVariantType gdnative_variant_get_type(const GDNativeVariantPtr p_self) { +static GDNativeVariantType gdnative_variant_get_type(GDNativeConstVariantPtr p_self) { const Variant *self = (const Variant *)p_self; return (GDNativeVariantType)self->get_type(); } -static GDNativeBool gdnative_variant_has_method(const GDNativeVariantPtr p_self, const GDNativeStringNamePtr p_method) { +static GDNativeBool gdnative_variant_has_method(GDNativeConstVariantPtr p_self, GDNativeConstStringNamePtr p_method) { const Variant *self = (const Variant *)p_self; const StringName *method = (const StringName *)p_method; return self->has_method(*method); } -static GDNativeBool gdnative_variant_has_member(GDNativeVariantType p_type, const GDNativeStringNamePtr p_member) { +static GDNativeBool gdnative_variant_has_member(GDNativeVariantType p_type, GDNativeConstStringNamePtr p_member) { return Variant::has_member((Variant::Type)p_type, *((const StringName *)p_member)); } -static GDNativeBool gdnative_variant_has_key(const GDNativeVariantPtr p_self, const GDNativeVariantPtr p_key, GDNativeBool *r_valid) { +static GDNativeBool gdnative_variant_has_key(GDNativeConstVariantPtr p_self, GDNativeConstVariantPtr p_key, GDNativeBool *r_valid) { const Variant *self = (const Variant *)p_self; const Variant *key = (const Variant *)p_key; bool valid; @@ -470,7 +470,7 @@ static GDNativeTypeFromVariantConstructorFunc gdnative_get_type_from_variant_con static GDNativePtrOperatorEvaluator gdnative_variant_get_ptr_operator_evaluator(GDNativeVariantOperator p_operator, GDNativeVariantType p_type_a, GDNativeVariantType p_type_b) { return (GDNativePtrOperatorEvaluator)Variant::get_ptr_operator_evaluator(Variant::Operator(p_operator), Variant::Type(p_type_a), Variant::Type(p_type_b)); } -static GDNativePtrBuiltInMethod gdnative_variant_get_ptr_builtin_method(GDNativeVariantType p_type, const GDNativeStringNamePtr p_method, GDNativeInt p_hash) { +static GDNativePtrBuiltInMethod gdnative_variant_get_ptr_builtin_method(GDNativeVariantType p_type, GDNativeConstStringNamePtr p_method, GDNativeInt p_hash) { const StringName method = *reinterpret_cast<const StringName *>(p_method); uint32_t hash = Variant::get_builtin_method_hash(Variant::Type(p_type), method); if (hash != p_hash) { @@ -486,7 +486,7 @@ static GDNativePtrConstructor gdnative_variant_get_ptr_constructor(GDNativeVaria static GDNativePtrDestructor gdnative_variant_get_ptr_destructor(GDNativeVariantType p_type) { return (GDNativePtrDestructor)Variant::get_ptr_destructor(Variant::Type(p_type)); } -static void gdnative_variant_construct(GDNativeVariantType p_type, GDNativeVariantPtr p_base, const GDNativeVariantPtr *p_args, int32_t p_argument_count, GDNativeCallError *r_error) { +static void gdnative_variant_construct(GDNativeVariantType p_type, GDNativeVariantPtr p_base, GDNativeConstVariantPtr *p_args, int32_t p_argument_count, GDNativeCallError *r_error) { memnew_placement(p_base, Variant); Callable::CallError error; @@ -498,11 +498,11 @@ static void gdnative_variant_construct(GDNativeVariantType p_type, GDNativeVaria r_error->expected = error.expected; } } -static GDNativePtrSetter gdnative_variant_get_ptr_setter(GDNativeVariantType p_type, const GDNativeStringNamePtr p_member) { +static GDNativePtrSetter gdnative_variant_get_ptr_setter(GDNativeVariantType p_type, GDNativeConstStringNamePtr p_member) { const StringName member = *reinterpret_cast<const StringName *>(p_member); return (GDNativePtrSetter)Variant::get_member_ptr_setter(Variant::Type(p_type), member); } -static GDNativePtrGetter gdnative_variant_get_ptr_getter(GDNativeVariantType p_type, const GDNativeStringNamePtr p_member) { +static GDNativePtrGetter gdnative_variant_get_ptr_getter(GDNativeVariantType p_type, GDNativeConstStringNamePtr p_member) { const StringName member = *reinterpret_cast<const StringName *>(p_member); return (GDNativePtrGetter)Variant::get_member_ptr_getter(Variant::Type(p_type), member); } @@ -521,11 +521,11 @@ static GDNativePtrKeyedGetter gdnative_variant_get_ptr_keyed_getter(GDNativeVari static GDNativePtrKeyedChecker gdnative_variant_get_ptr_keyed_checker(GDNativeVariantType p_type) { return (GDNativePtrKeyedChecker)Variant::get_member_ptr_keyed_checker(Variant::Type(p_type)); } -static void gdnative_variant_get_constant_value(GDNativeVariantType p_type, const GDNativeStringNamePtr p_constant, GDNativeVariantPtr r_ret) { +static void gdnative_variant_get_constant_value(GDNativeVariantType p_type, GDNativeConstStringNamePtr p_constant, GDNativeVariantPtr r_ret) { StringName constant = *reinterpret_cast<const StringName *>(p_constant); memnew_placement(r_ret, Variant(Variant::get_constant_value(Variant::Type(p_type), constant))); } -static GDNativePtrUtilityFunction gdnative_variant_get_ptr_utility_function(const GDNativeStringNamePtr p_function, GDNativeInt p_hash) { +static GDNativePtrUtilityFunction gdnative_variant_get_ptr_utility_function(GDNativeConstStringNamePtr p_function, GDNativeInt p_hash) { StringName function = *reinterpret_cast<const StringName *>(p_function); uint32_t hash = Variant::get_utility_function_hash(function); if (hash != p_hash) { @@ -574,31 +574,31 @@ static void gdnative_string_new_with_wide_chars(GDNativeStringPtr r_dest, const } } -static void gdnative_string_new_with_latin1_chars_and_len(GDNativeStringPtr r_dest, const char *p_contents, const GDNativeInt p_size) { +static void gdnative_string_new_with_latin1_chars_and_len(GDNativeStringPtr r_dest, const char *p_contents, GDNativeInt p_size) { String *dest = (String *)r_dest; memnew_placement(dest, String); *dest = String(p_contents, p_size); } -static void gdnative_string_new_with_utf8_chars_and_len(GDNativeStringPtr r_dest, const char *p_contents, const GDNativeInt p_size) { +static void gdnative_string_new_with_utf8_chars_and_len(GDNativeStringPtr r_dest, const char *p_contents, GDNativeInt p_size) { String *dest = (String *)r_dest; memnew_placement(dest, String); dest->parse_utf8(p_contents, p_size); } -static void gdnative_string_new_with_utf16_chars_and_len(GDNativeStringPtr r_dest, const char16_t *p_contents, const GDNativeInt p_size) { +static void gdnative_string_new_with_utf16_chars_and_len(GDNativeStringPtr r_dest, const char16_t *p_contents, GDNativeInt p_size) { String *dest = (String *)r_dest; memnew_placement(dest, String); dest->parse_utf16(p_contents, p_size); } -static void gdnative_string_new_with_utf32_chars_and_len(GDNativeStringPtr r_dest, const char32_t *p_contents, const GDNativeInt p_size) { +static void gdnative_string_new_with_utf32_chars_and_len(GDNativeStringPtr r_dest, const char32_t *p_contents, GDNativeInt p_size) { String *dest = (String *)r_dest; memnew_placement(dest, String); *dest = String((const char32_t *)p_contents, p_size); } -static void gdnative_string_new_with_wide_chars_and_len(GDNativeStringPtr r_dest, const wchar_t *p_contents, const GDNativeInt p_size) { +static void gdnative_string_new_with_wide_chars_and_len(GDNativeStringPtr r_dest, const wchar_t *p_contents, GDNativeInt p_size) { String *dest = (String *)r_dest; if constexpr (sizeof(wchar_t) == 2) { // wchar_t is 16 bit, parse. @@ -611,7 +611,7 @@ static void gdnative_string_new_with_wide_chars_and_len(GDNativeStringPtr r_dest } } -static GDNativeInt gdnative_string_to_latin1_chars(const GDNativeStringPtr p_self, char *r_text, GDNativeInt p_max_write_length) { +static GDNativeInt gdnative_string_to_latin1_chars(GDNativeConstStringPtr p_self, char *r_text, GDNativeInt p_max_write_length) { String *self = (String *)p_self; CharString cs = self->ascii(true); GDNativeInt len = cs.length(); @@ -623,7 +623,7 @@ static GDNativeInt gdnative_string_to_latin1_chars(const GDNativeStringPtr p_sel } return len; } -static GDNativeInt gdnative_string_to_utf8_chars(const GDNativeStringPtr p_self, char *r_text, GDNativeInt p_max_write_length) { +static GDNativeInt gdnative_string_to_utf8_chars(GDNativeConstStringPtr p_self, char *r_text, GDNativeInt p_max_write_length) { String *self = (String *)p_self; CharString cs = self->utf8(); GDNativeInt len = cs.length(); @@ -635,7 +635,7 @@ static GDNativeInt gdnative_string_to_utf8_chars(const GDNativeStringPtr p_self, } return len; } -static GDNativeInt gdnative_string_to_utf16_chars(const GDNativeStringPtr p_self, char16_t *r_text, GDNativeInt p_max_write_length) { +static GDNativeInt gdnative_string_to_utf16_chars(GDNativeConstStringPtr p_self, char16_t *r_text, GDNativeInt p_max_write_length) { String *self = (String *)p_self; Char16String cs = self->utf16(); GDNativeInt len = cs.length(); @@ -647,7 +647,7 @@ static GDNativeInt gdnative_string_to_utf16_chars(const GDNativeStringPtr p_self } return len; } -static GDNativeInt gdnative_string_to_utf32_chars(const GDNativeStringPtr p_self, char32_t *r_text, GDNativeInt p_max_write_length) { +static GDNativeInt gdnative_string_to_utf32_chars(GDNativeConstStringPtr p_self, char32_t *r_text, GDNativeInt p_max_write_length) { String *self = (String *)p_self; GDNativeInt len = self->length(); if (r_text) { @@ -658,7 +658,7 @@ static GDNativeInt gdnative_string_to_utf32_chars(const GDNativeStringPtr p_self } return len; } -static GDNativeInt gdnative_string_to_wide_chars(const GDNativeStringPtr p_self, wchar_t *r_text, GDNativeInt p_max_write_length) { +static GDNativeInt gdnative_string_to_wide_chars(GDNativeConstStringPtr p_self, wchar_t *r_text, GDNativeInt p_max_write_length) { if constexpr (sizeof(wchar_t) == 4) { return gdnative_string_to_utf32_chars(p_self, (char32_t *)r_text, p_max_write_length); } else { @@ -672,7 +672,7 @@ static char32_t *gdnative_string_operator_index(GDNativeStringPtr p_self, GDNati return &self->ptrw()[p_index]; } -static const char32_t *gdnative_string_operator_index_const(const GDNativeStringPtr p_self, GDNativeInt p_index) { +static const char32_t *gdnative_string_operator_index_const(GDNativeConstStringPtr p_self, GDNativeInt p_index) { const String *self = (const String *)p_self; ERR_FAIL_INDEX_V(p_index, self->length() + 1, nullptr); return &self->ptr()[p_index]; @@ -686,7 +686,7 @@ static uint8_t *gdnative_packed_byte_array_operator_index(GDNativeTypePtr p_self return &self->ptrw()[p_index]; } -static const uint8_t *gdnative_packed_byte_array_operator_index_const(const GDNativeTypePtr p_self, GDNativeInt p_index) { +static const uint8_t *gdnative_packed_byte_array_operator_index_const(GDNativeConstTypePtr p_self, GDNativeInt p_index) { const PackedByteArray *self = (const PackedByteArray *)p_self; ERR_FAIL_INDEX_V(p_index, self->size(), nullptr); return &self->ptr()[p_index]; @@ -698,7 +698,7 @@ static GDNativeTypePtr gdnative_packed_color_array_operator_index(GDNativeTypePt return (GDNativeTypePtr)&self->ptrw()[p_index]; } -static GDNativeTypePtr gdnative_packed_color_array_operator_index_const(const GDNativeTypePtr p_self, GDNativeInt p_index) { +static GDNativeTypePtr gdnative_packed_color_array_operator_index_const(GDNativeConstTypePtr p_self, GDNativeInt p_index) { const PackedColorArray *self = (const PackedColorArray *)p_self; ERR_FAIL_INDEX_V(p_index, self->size(), nullptr); return (GDNativeTypePtr)&self->ptr()[p_index]; @@ -710,7 +710,7 @@ static float *gdnative_packed_float32_array_operator_index(GDNativeTypePtr p_sel return &self->ptrw()[p_index]; } -static const float *gdnative_packed_float32_array_operator_index_const(const GDNativeTypePtr p_self, GDNativeInt p_index) { +static const float *gdnative_packed_float32_array_operator_index_const(GDNativeConstTypePtr p_self, GDNativeInt p_index) { const PackedFloat32Array *self = (const PackedFloat32Array *)p_self; ERR_FAIL_INDEX_V(p_index, self->size(), nullptr); return &self->ptr()[p_index]; @@ -722,7 +722,7 @@ static double *gdnative_packed_float64_array_operator_index(GDNativeTypePtr p_se return &self->ptrw()[p_index]; } -static const double *gdnative_packed_float64_array_operator_index_const(const GDNativeTypePtr p_self, GDNativeInt p_index) { +static const double *gdnative_packed_float64_array_operator_index_const(GDNativeConstTypePtr p_self, GDNativeInt p_index) { const PackedFloat64Array *self = (const PackedFloat64Array *)p_self; ERR_FAIL_INDEX_V(p_index, self->size(), nullptr); return &self->ptr()[p_index]; @@ -734,7 +734,7 @@ static int32_t *gdnative_packed_int32_array_operator_index(GDNativeTypePtr p_sel return &self->ptrw()[p_index]; } -static const int32_t *gdnative_packed_int32_array_operator_index_const(const GDNativeTypePtr p_self, GDNativeInt p_index) { +static const int32_t *gdnative_packed_int32_array_operator_index_const(GDNativeConstTypePtr p_self, GDNativeInt p_index) { const PackedInt32Array *self = (const PackedInt32Array *)p_self; ERR_FAIL_INDEX_V(p_index, self->size(), nullptr); return &self->ptr()[p_index]; @@ -746,7 +746,7 @@ static int64_t *gdnative_packed_int64_array_operator_index(GDNativeTypePtr p_sel return &self->ptrw()[p_index]; } -static const int64_t *gdnative_packed_int64_array_operator_index_const(const GDNativeTypePtr p_self, GDNativeInt p_index) { +static const int64_t *gdnative_packed_int64_array_operator_index_const(GDNativeConstTypePtr p_self, GDNativeInt p_index) { const PackedInt64Array *self = (const PackedInt64Array *)p_self; ERR_FAIL_INDEX_V(p_index, self->size(), nullptr); return &self->ptr()[p_index]; @@ -758,7 +758,7 @@ static GDNativeStringPtr gdnative_packed_string_array_operator_index(GDNativeTyp return (GDNativeStringPtr)&self->ptrw()[p_index]; } -static GDNativeStringPtr gdnative_packed_string_array_operator_index_const(const GDNativeTypePtr p_self, GDNativeInt p_index) { +static GDNativeStringPtr gdnative_packed_string_array_operator_index_const(GDNativeConstTypePtr p_self, GDNativeInt p_index) { const PackedStringArray *self = (const PackedStringArray *)p_self; ERR_FAIL_INDEX_V(p_index, self->size(), nullptr); return (GDNativeStringPtr)&self->ptr()[p_index]; @@ -770,7 +770,7 @@ static GDNativeTypePtr gdnative_packed_vector2_array_operator_index(GDNativeType return (GDNativeTypePtr)&self->ptrw()[p_index]; } -static GDNativeTypePtr gdnative_packed_vector2_array_operator_index_const(const GDNativeTypePtr p_self, GDNativeInt p_index) { +static GDNativeTypePtr gdnative_packed_vector2_array_operator_index_const(GDNativeConstTypePtr p_self, GDNativeInt p_index) { const PackedVector2Array *self = (const PackedVector2Array *)p_self; ERR_FAIL_INDEX_V(p_index, self->size(), nullptr); return (GDNativeTypePtr)&self->ptr()[p_index]; @@ -782,7 +782,7 @@ static GDNativeTypePtr gdnative_packed_vector3_array_operator_index(GDNativeType return (GDNativeTypePtr)&self->ptrw()[p_index]; } -static GDNativeTypePtr gdnative_packed_vector3_array_operator_index_const(const GDNativeTypePtr p_self, GDNativeInt p_index) { +static GDNativeTypePtr gdnative_packed_vector3_array_operator_index_const(GDNativeConstTypePtr p_self, GDNativeInt p_index) { const PackedVector3Array *self = (const PackedVector3Array *)p_self; ERR_FAIL_INDEX_V(p_index, self->size(), nullptr); return (GDNativeTypePtr)&self->ptr()[p_index]; @@ -794,7 +794,7 @@ static GDNativeVariantPtr gdnative_array_operator_index(GDNativeTypePtr p_self, return (GDNativeVariantPtr)&self->operator[](p_index); } -static GDNativeVariantPtr gdnative_array_operator_index_const(const GDNativeTypePtr p_self, GDNativeInt p_index) { +static GDNativeVariantPtr gdnative_array_operator_index_const(GDNativeConstTypePtr p_self, GDNativeInt p_index) { const Array *self = (const Array *)p_self; ERR_FAIL_INDEX_V(p_index, self->size(), nullptr); return (GDNativeVariantPtr)&self->operator[](p_index); @@ -802,20 +802,20 @@ static GDNativeVariantPtr gdnative_array_operator_index_const(const GDNativeType /* Dictionary functions */ -static GDNativeVariantPtr gdnative_dictionary_operator_index(GDNativeTypePtr p_self, const GDNativeVariantPtr p_key) { +static GDNativeVariantPtr gdnative_dictionary_operator_index(GDNativeTypePtr p_self, GDNativeConstVariantPtr p_key) { Dictionary *self = (Dictionary *)p_self; return (GDNativeVariantPtr)&self->operator[](*(const Variant *)p_key); } -static GDNativeVariantPtr gdnative_dictionary_operator_index_const(const GDNativeTypePtr p_self, const GDNativeVariantPtr p_key) { +static GDNativeVariantPtr gdnative_dictionary_operator_index_const(GDNativeConstTypePtr p_self, GDNativeConstVariantPtr p_key) { const Dictionary *self = (const Dictionary *)p_self; return (GDNativeVariantPtr)&self->operator[](*(const Variant *)p_key); } /* OBJECT API */ -static void gdnative_object_method_bind_call(const GDNativeMethodBindPtr p_method_bind, GDNativeObjectPtr p_instance, const GDNativeVariantPtr *p_args, GDNativeInt p_arg_count, GDNativeVariantPtr r_return, GDNativeCallError *r_error) { - MethodBind *mb = (MethodBind *)p_method_bind; +static void gdnative_object_method_bind_call(GDNativeMethodBindPtr p_method_bind, GDNativeObjectPtr p_instance, GDNativeConstVariantPtr *p_args, GDNativeInt p_arg_count, GDNativeVariantPtr r_return, GDNativeCallError *r_error) { + const MethodBind *mb = reinterpret_cast<const MethodBind *>(p_method_bind); Object *o = (Object *)p_instance; const Variant **args = (const Variant **)p_args; Callable::CallError error; @@ -830,8 +830,8 @@ static void gdnative_object_method_bind_call(const GDNativeMethodBindPtr p_metho } } -static void gdnative_object_method_bind_ptrcall(const GDNativeMethodBindPtr p_method_bind, GDNativeObjectPtr p_instance, const GDNativeTypePtr *p_args, GDNativeTypePtr p_ret) { - MethodBind *mb = (MethodBind *)p_method_bind; +static void gdnative_object_method_bind_ptrcall(GDNativeMethodBindPtr p_method_bind, GDNativeObjectPtr p_instance, GDNativeConstTypePtr *p_args, GDNativeTypePtr p_ret) { + const MethodBind *mb = reinterpret_cast<const MethodBind *>(p_method_bind); Object *o = (Object *)p_instance; mb->ptrcall(o, (const void **)p_args, p_ret); } @@ -840,7 +840,7 @@ static void gdnative_object_destroy(GDNativeObjectPtr p_o) { memdelete((Object *)p_o); } -static GDNativeObjectPtr gdnative_global_get_singleton(const GDNativeStringNamePtr p_name) { +static GDNativeObjectPtr gdnative_global_get_singleton(GDNativeConstStringNamePtr p_name) { const StringName name = *reinterpret_cast<const StringName *>(p_name); return (GDNativeObjectPtr)Engine::get_singleton()->get_singleton_object(name); } @@ -855,7 +855,7 @@ static void gdnative_object_set_instance_binding(GDNativeObjectPtr p_object, voi o->set_instance_binding(p_token, p_binding, p_callbacks); } -static void gdnative_object_set_instance(GDNativeObjectPtr p_object, const GDNativeStringNamePtr p_classname, GDExtensionClassInstancePtr p_instance) { +static void gdnative_object_set_instance(GDNativeObjectPtr p_object, GDNativeConstStringNamePtr p_classname, GDExtensionClassInstancePtr p_instance) { const StringName classname = *reinterpret_cast<const StringName *>(p_classname); Object *o = (Object *)p_object; ClassDB::set_object_extension_instance(o, classname, p_instance); @@ -865,7 +865,7 @@ static GDNativeObjectPtr gdnative_object_get_instance_from_id(GDObjectInstanceID return (GDNativeObjectPtr)ObjectDB::get_instance(ObjectID(p_instance_id)); } -static GDNativeObjectPtr gdnative_object_cast_to(const GDNativeObjectPtr p_object, void *p_class_tag) { +static GDNativeObjectPtr gdnative_object_cast_to(GDNativeConstObjectPtr p_object, void *p_class_tag) { if (!p_object) { return nullptr; } @@ -874,7 +874,7 @@ static GDNativeObjectPtr gdnative_object_cast_to(const GDNativeObjectPtr p_objec return o->is_class_ptr(p_class_tag) ? (GDNativeObjectPtr)o : (GDNativeObjectPtr) nullptr; } -static GDObjectInstanceID gdnative_object_get_instance_id(const GDNativeObjectPtr p_object) { +static GDObjectInstanceID gdnative_object_get_instance_id(GDNativeConstObjectPtr p_object) { const Object *o = (const Object *)p_object; return (GDObjectInstanceID)o->get_instance_id(); } @@ -886,7 +886,7 @@ static GDNativeScriptInstancePtr gdnative_script_instance_create(const GDNativeE return reinterpret_cast<GDNativeScriptInstancePtr>(script_instance_extension); } -static GDNativeMethodBindPtr gdnative_classdb_get_method_bind(const GDNativeStringNamePtr p_classname, const GDNativeStringNamePtr p_methodname, GDNativeInt p_hash) { +static GDNativeMethodBindPtr gdnative_classdb_get_method_bind(GDNativeConstStringNamePtr p_classname, GDNativeConstStringNamePtr p_methodname, GDNativeInt p_hash) { const StringName classname = *reinterpret_cast<const StringName *>(p_classname); const StringName methodname = *reinterpret_cast<const StringName *>(p_methodname); MethodBind *mb = ClassDB::get_method(classname, methodname); @@ -898,12 +898,12 @@ static GDNativeMethodBindPtr gdnative_classdb_get_method_bind(const GDNativeStri return (GDNativeMethodBindPtr)mb; } -static GDNativeObjectPtr gdnative_classdb_construct_object(const GDNativeStringNamePtr p_classname) { +static GDNativeObjectPtr gdnative_classdb_construct_object(GDNativeConstStringNamePtr p_classname) { const StringName classname = *reinterpret_cast<const StringName *>(p_classname); return (GDNativeObjectPtr)ClassDB::instantiate(classname); } -static void *gdnative_classdb_get_class_tag(const GDNativeStringNamePtr p_classname) { +static void *gdnative_classdb_get_class_tag(GDNativeConstStringNamePtr p_classname) { const StringName classname = *reinterpret_cast<const StringName *>(p_classname); ClassDB::ClassInfo *class_info = ClassDB::classes.getptr(classname); return class_info ? class_info->class_ptr : nullptr; diff --git a/core/extension/gdnative_interface.h b/core/extension/gdnative_interface.h index 50410c4857..486f5be344 100644 --- a/core/extension/gdnative_interface.h +++ b/core/extension/gdnative_interface.h @@ -141,12 +141,16 @@ typedef enum { } GDNativeVariantOperator; typedef void *GDNativeVariantPtr; +typedef const void *GDNativeConstVariantPtr; typedef void *GDNativeStringNamePtr; +typedef const void *GDNativeConstStringNamePtr; typedef void *GDNativeStringPtr; +typedef const void *GDNativeConstStringPtr; typedef void *GDNativeObjectPtr; +typedef const void *GDNativeConstObjectPtr; typedef void *GDNativeTypePtr; -typedef void *GDNativeExtensionPtr; -typedef void *GDNativeMethodBindPtr; +typedef const void *GDNativeConstTypePtr; +typedef const void *GDNativeMethodBindPtr; typedef int64_t GDNativeInt; typedef uint8_t GDNativeBool; typedef uint64_t GDObjectInstanceID; @@ -171,18 +175,18 @@ typedef struct { typedef void (*GDNativeVariantFromTypeConstructorFunc)(GDNativeVariantPtr, GDNativeTypePtr); typedef void (*GDNativeTypeFromVariantConstructorFunc)(GDNativeTypePtr, GDNativeVariantPtr); -typedef void (*GDNativePtrOperatorEvaluator)(const GDNativeTypePtr p_left, const GDNativeTypePtr p_right, GDNativeTypePtr r_result); -typedef void (*GDNativePtrBuiltInMethod)(GDNativeTypePtr p_base, const GDNativeTypePtr *p_args, GDNativeTypePtr r_return, int p_argument_count); -typedef void (*GDNativePtrConstructor)(GDNativeTypePtr p_base, const GDNativeTypePtr *p_args); +typedef void (*GDNativePtrOperatorEvaluator)(GDNativeConstTypePtr p_left, GDNativeConstTypePtr p_right, GDNativeTypePtr r_result); +typedef void (*GDNativePtrBuiltInMethod)(GDNativeTypePtr p_base, GDNativeConstTypePtr *p_args, GDNativeTypePtr r_return, int p_argument_count); +typedef void (*GDNativePtrConstructor)(GDNativeTypePtr p_base, GDNativeConstTypePtr *p_args); typedef void (*GDNativePtrDestructor)(GDNativeTypePtr p_base); -typedef void (*GDNativePtrSetter)(GDNativeTypePtr p_base, const GDNativeTypePtr p_value); -typedef void (*GDNativePtrGetter)(const GDNativeTypePtr p_base, GDNativeTypePtr r_value); -typedef void (*GDNativePtrIndexedSetter)(GDNativeTypePtr p_base, GDNativeInt p_index, const GDNativeTypePtr p_value); -typedef void (*GDNativePtrIndexedGetter)(const GDNativeTypePtr p_base, GDNativeInt p_index, GDNativeTypePtr r_value); -typedef void (*GDNativePtrKeyedSetter)(GDNativeTypePtr p_base, const GDNativeTypePtr p_key, const GDNativeTypePtr p_value); -typedef void (*GDNativePtrKeyedGetter)(const GDNativeTypePtr p_base, const GDNativeTypePtr p_key, GDNativeTypePtr r_value); -typedef uint32_t (*GDNativePtrKeyedChecker)(const GDNativeVariantPtr p_base, const GDNativeVariantPtr p_key); -typedef void (*GDNativePtrUtilityFunction)(GDNativeTypePtr r_return, const GDNativeTypePtr *p_arguments, int p_argument_count); +typedef void (*GDNativePtrSetter)(GDNativeTypePtr p_base, GDNativeConstTypePtr p_value); +typedef void (*GDNativePtrGetter)(GDNativeConstTypePtr p_base, GDNativeTypePtr r_value); +typedef void (*GDNativePtrIndexedSetter)(GDNativeTypePtr p_base, GDNativeInt p_index, GDNativeConstTypePtr p_value); +typedef void (*GDNativePtrIndexedGetter)(GDNativeConstTypePtr p_base, GDNativeInt p_index, GDNativeTypePtr r_value); +typedef void (*GDNativePtrKeyedSetter)(GDNativeTypePtr p_base, GDNativeConstTypePtr p_key, GDNativeConstTypePtr p_value); +typedef void (*GDNativePtrKeyedGetter)(GDNativeConstTypePtr p_base, GDNativeConstTypePtr p_key, GDNativeTypePtr r_value); +typedef uint32_t (*GDNativePtrKeyedChecker)(GDNativeConstVariantPtr p_base, GDNativeConstVariantPtr p_key); +typedef void (*GDNativePtrUtilityFunction)(GDNativeTypePtr r_return, GDNativeConstTypePtr *p_arguments, int p_argument_count); typedef GDNativeObjectPtr (*GDNativeClassConstructor)(); @@ -200,8 +204,8 @@ typedef struct { typedef void *GDExtensionClassInstancePtr; -typedef GDNativeBool (*GDNativeExtensionClassSet)(GDExtensionClassInstancePtr p_instance, const GDNativeStringNamePtr p_name, const GDNativeVariantPtr p_value); -typedef GDNativeBool (*GDNativeExtensionClassGet)(GDExtensionClassInstancePtr p_instance, const GDNativeStringNamePtr p_name, GDNativeVariantPtr r_ret); +typedef GDNativeBool (*GDNativeExtensionClassSet)(GDExtensionClassInstancePtr p_instance, GDNativeConstStringNamePtr p_name, GDNativeConstVariantPtr p_value); +typedef GDNativeBool (*GDNativeExtensionClassGet)(GDExtensionClassInstancePtr p_instance, GDNativeConstStringNamePtr p_name, GDNativeVariantPtr r_ret); typedef uint64_t (*GDNativeExtensionClassGetRID)(GDExtensionClassInstancePtr p_instance); typedef struct { @@ -230,16 +234,16 @@ typedef struct { typedef const GDNativePropertyInfo *(*GDNativeExtensionClassGetPropertyList)(GDExtensionClassInstancePtr p_instance, uint32_t *r_count); typedef void (*GDNativeExtensionClassFreePropertyList)(GDExtensionClassInstancePtr p_instance, const GDNativePropertyInfo *p_list); -typedef GDNativeBool (*GDNativeExtensionClassPropertyCanRevert)(GDExtensionClassInstancePtr p_instance, const GDNativeStringNamePtr p_name); -typedef GDNativeBool (*GDNativeExtensionClassPropertyGetRevert)(GDExtensionClassInstancePtr p_instance, const GDNativeStringNamePtr p_name, GDNativeVariantPtr r_ret); +typedef GDNativeBool (*GDNativeExtensionClassPropertyCanRevert)(GDExtensionClassInstancePtr p_instance, GDNativeConstStringNamePtr p_name); +typedef GDNativeBool (*GDNativeExtensionClassPropertyGetRevert)(GDExtensionClassInstancePtr p_instance, GDNativeConstStringNamePtr p_name, GDNativeVariantPtr r_ret); typedef void (*GDNativeExtensionClassNotification)(GDExtensionClassInstancePtr p_instance, int32_t p_what); typedef void (*GDNativeExtensionClassToString)(GDExtensionClassInstancePtr p_instance, GDNativeBool *r_is_valid, GDNativeStringPtr p_out); typedef void (*GDNativeExtensionClassReference)(GDExtensionClassInstancePtr p_instance); typedef void (*GDNativeExtensionClassUnreference)(GDExtensionClassInstancePtr p_instance); -typedef void (*GDNativeExtensionClassCallVirtual)(GDExtensionClassInstancePtr p_instance, const GDNativeTypePtr *p_args, GDNativeTypePtr r_ret); +typedef void (*GDNativeExtensionClassCallVirtual)(GDExtensionClassInstancePtr p_instance, GDNativeConstTypePtr *p_args, GDNativeTypePtr r_ret); typedef GDNativeObjectPtr (*GDNativeExtensionClassCreateInstance)(void *p_userdata); typedef void (*GDNativeExtensionClassFreeInstance)(void *p_userdata, GDExtensionClassInstancePtr p_instance); -typedef GDNativeExtensionClassCallVirtual (*GDNativeExtensionClassGetVirtual)(void *p_userdata, const GDNativeStringNamePtr p_name); +typedef GDNativeExtensionClassCallVirtual (*GDNativeExtensionClassGetVirtual)(void *p_userdata, GDNativeConstStringNamePtr p_name); typedef struct { GDNativeBool is_virtual; @@ -289,8 +293,8 @@ typedef enum { GDNATIVE_EXTENSION_METHOD_ARGUMENT_METADATA_REAL_IS_DOUBLE } GDNativeExtensionClassMethodArgumentMetadata; -typedef void (*GDNativeExtensionClassMethodCall)(void *method_userdata, GDExtensionClassInstancePtr p_instance, const GDNativeVariantPtr *p_args, const GDNativeInt p_argument_count, GDNativeVariantPtr r_return, GDNativeCallError *r_error); -typedef void (*GDNativeExtensionClassMethodPtrCall)(void *method_userdata, GDExtensionClassInstancePtr p_instance, const GDNativeTypePtr *p_args, GDNativeTypePtr r_ret); +typedef void (*GDNativeExtensionClassMethodCall)(void *method_userdata, GDExtensionClassInstancePtr p_instance, GDNativeConstVariantPtr *p_args, GDNativeInt p_argument_count, GDNativeVariantPtr r_return, GDNativeCallError *r_error); +typedef void (*GDNativeExtensionClassMethodPtrCall)(void *method_userdata, GDExtensionClassInstancePtr p_instance, GDNativeConstTypePtr *p_args, GDNativeTypePtr r_ret); typedef struct { GDNativeStringNamePtr name; @@ -320,25 +324,25 @@ typedef struct { typedef void *GDNativeExtensionScriptInstanceDataPtr; // Pointer to custom ScriptInstance native implementation. -typedef GDNativeBool (*GDNativeExtensionScriptInstanceSet)(GDNativeExtensionScriptInstanceDataPtr p_instance, const GDNativeStringNamePtr p_name, const GDNativeVariantPtr p_value); -typedef GDNativeBool (*GDNativeExtensionScriptInstanceGet)(GDNativeExtensionScriptInstanceDataPtr p_instance, const GDNativeStringNamePtr p_name, GDNativeVariantPtr r_ret); +typedef GDNativeBool (*GDNativeExtensionScriptInstanceSet)(GDNativeExtensionScriptInstanceDataPtr p_instance, GDNativeConstStringNamePtr p_name, GDNativeConstVariantPtr p_value); +typedef GDNativeBool (*GDNativeExtensionScriptInstanceGet)(GDNativeExtensionScriptInstanceDataPtr p_instance, GDNativeConstStringNamePtr p_name, GDNativeVariantPtr r_ret); typedef const GDNativePropertyInfo *(*GDNativeExtensionScriptInstanceGetPropertyList)(GDNativeExtensionScriptInstanceDataPtr p_instance, uint32_t *r_count); typedef void (*GDNativeExtensionScriptInstanceFreePropertyList)(GDNativeExtensionScriptInstanceDataPtr p_instance, const GDNativePropertyInfo *p_list); -typedef GDNativeVariantType (*GDNativeExtensionScriptInstanceGetPropertyType)(GDNativeExtensionScriptInstanceDataPtr p_instance, const GDNativeStringNamePtr p_name, GDNativeBool *r_is_valid); +typedef GDNativeVariantType (*GDNativeExtensionScriptInstanceGetPropertyType)(GDNativeExtensionScriptInstanceDataPtr p_instance, GDNativeConstStringNamePtr p_name, GDNativeBool *r_is_valid); -typedef GDNativeBool (*GDNativeExtensionScriptInstancePropertyCanRevert)(GDNativeExtensionScriptInstanceDataPtr p_instance, const GDNativeStringNamePtr p_name); -typedef GDNativeBool (*GDNativeExtensionScriptInstancePropertyGetRevert)(GDNativeExtensionScriptInstanceDataPtr p_instance, const GDNativeStringNamePtr p_name, GDNativeVariantPtr r_ret); +typedef GDNativeBool (*GDNativeExtensionScriptInstancePropertyCanRevert)(GDNativeExtensionScriptInstanceDataPtr p_instance, GDNativeConstStringNamePtr p_name); +typedef GDNativeBool (*GDNativeExtensionScriptInstancePropertyGetRevert)(GDNativeExtensionScriptInstanceDataPtr p_instance, GDNativeConstStringNamePtr p_name, GDNativeVariantPtr r_ret); typedef GDNativeObjectPtr (*GDNativeExtensionScriptInstanceGetOwner)(GDNativeExtensionScriptInstanceDataPtr p_instance); -typedef void (*GDNativeExtensionScriptInstancePropertyStateAdd)(const GDNativeStringNamePtr p_name, const GDNativeVariantPtr p_value, void *p_userdata); +typedef void (*GDNativeExtensionScriptInstancePropertyStateAdd)(GDNativeConstStringNamePtr p_name, GDNativeConstVariantPtr p_value, void *p_userdata); typedef void (*GDNativeExtensionScriptInstanceGetPropertyState)(GDNativeExtensionScriptInstanceDataPtr p_instance, GDNativeExtensionScriptInstancePropertyStateAdd p_add_func, void *p_userdata); typedef const GDNativeMethodInfo *(*GDNativeExtensionScriptInstanceGetMethodList)(GDNativeExtensionScriptInstanceDataPtr p_instance, uint32_t *r_count); typedef void (*GDNativeExtensionScriptInstanceFreeMethodList)(GDNativeExtensionScriptInstanceDataPtr p_instance, const GDNativeMethodInfo *p_list); -typedef GDNativeBool (*GDNativeExtensionScriptInstanceHasMethod)(GDNativeExtensionScriptInstanceDataPtr p_instance, const GDNativeStringNamePtr p_name); +typedef GDNativeBool (*GDNativeExtensionScriptInstanceHasMethod)(GDNativeExtensionScriptInstanceDataPtr p_instance, GDNativeConstStringNamePtr p_name); -typedef void (*GDNativeExtensionScriptInstanceCall)(GDNativeExtensionScriptInstanceDataPtr p_self, const GDNativeStringNamePtr p_method, const GDNativeVariantPtr *p_args, const GDNativeInt p_argument_count, GDNativeVariantPtr r_return, GDNativeCallError *r_error); +typedef void (*GDNativeExtensionScriptInstanceCall)(GDNativeExtensionScriptInstanceDataPtr p_self, GDNativeConstStringNamePtr p_method, GDNativeConstVariantPtr *p_args, GDNativeInt p_argument_count, GDNativeVariantPtr r_return, GDNativeCallError *r_error); typedef void (*GDNativeExtensionScriptInstanceNotification)(GDNativeExtensionScriptInstanceDataPtr p_instance, int32_t p_what); typedef void (*GDNativeExtensionScriptInstanceToString)(GDNativeExtensionScriptInstanceDataPtr p_instance, GDNativeBool *r_is_valid, GDNativeStringPtr r_out); @@ -413,41 +417,41 @@ typedef struct { void (*print_warning)(const char *p_description, const char *p_function, const char *p_file, int32_t p_line); void (*print_script_error)(const char *p_description, const char *p_function, const char *p_file, int32_t p_line); - uint64_t (*get_native_struct_size)(const GDNativeStringNamePtr p_name); + uint64_t (*get_native_struct_size)(GDNativeConstStringNamePtr p_name); /* GODOT VARIANT */ /* variant general */ - void (*variant_new_copy)(GDNativeVariantPtr r_dest, const GDNativeVariantPtr p_src); + void (*variant_new_copy)(GDNativeVariantPtr r_dest, GDNativeConstVariantPtr p_src); void (*variant_new_nil)(GDNativeVariantPtr r_dest); void (*variant_destroy)(GDNativeVariantPtr p_self); /* variant type */ - void (*variant_call)(GDNativeVariantPtr p_self, const GDNativeStringNamePtr p_method, const GDNativeVariantPtr *p_args, const GDNativeInt p_argument_count, GDNativeVariantPtr r_return, GDNativeCallError *r_error); - void (*variant_call_static)(GDNativeVariantType p_type, const GDNativeStringNamePtr p_method, const GDNativeVariantPtr *p_args, const GDNativeInt p_argument_count, GDNativeVariantPtr r_return, GDNativeCallError *r_error); - void (*variant_evaluate)(GDNativeVariantOperator p_op, const GDNativeVariantPtr p_a, const GDNativeVariantPtr p_b, GDNativeVariantPtr r_return, GDNativeBool *r_valid); - void (*variant_set)(GDNativeVariantPtr p_self, const GDNativeVariantPtr p_key, const GDNativeVariantPtr p_value, GDNativeBool *r_valid); - void (*variant_set_named)(GDNativeVariantPtr p_self, const GDNativeStringNamePtr p_key, const GDNativeVariantPtr p_value, GDNativeBool *r_valid); - void (*variant_set_keyed)(GDNativeVariantPtr p_self, const GDNativeVariantPtr p_key, const GDNativeVariantPtr p_value, GDNativeBool *r_valid); - void (*variant_set_indexed)(GDNativeVariantPtr p_self, GDNativeInt p_index, const GDNativeVariantPtr p_value, GDNativeBool *r_valid, GDNativeBool *r_oob); - void (*variant_get)(const GDNativeVariantPtr p_self, const GDNativeVariantPtr p_key, GDNativeVariantPtr r_ret, GDNativeBool *r_valid); - void (*variant_get_named)(const GDNativeVariantPtr p_self, const GDNativeStringNamePtr p_key, GDNativeVariantPtr r_ret, GDNativeBool *r_valid); - void (*variant_get_keyed)(const GDNativeVariantPtr p_self, const GDNativeVariantPtr p_key, GDNativeVariantPtr r_ret, GDNativeBool *r_valid); - void (*variant_get_indexed)(const GDNativeVariantPtr p_self, GDNativeInt p_index, GDNativeVariantPtr r_ret, GDNativeBool *r_valid, GDNativeBool *r_oob); - GDNativeBool (*variant_iter_init)(const GDNativeVariantPtr p_self, GDNativeVariantPtr r_iter, GDNativeBool *r_valid); - GDNativeBool (*variant_iter_next)(const GDNativeVariantPtr p_self, GDNativeVariantPtr r_iter, GDNativeBool *r_valid); - void (*variant_iter_get)(const GDNativeVariantPtr p_self, GDNativeVariantPtr r_iter, GDNativeVariantPtr r_ret, GDNativeBool *r_valid); - GDNativeInt (*variant_hash)(const GDNativeVariantPtr p_self); - GDNativeInt (*variant_recursive_hash)(const GDNativeVariantPtr p_self, GDNativeInt p_recursion_count); - GDNativeBool (*variant_hash_compare)(const GDNativeVariantPtr p_self, const GDNativeVariantPtr p_other); - GDNativeBool (*variant_booleanize)(const GDNativeVariantPtr p_self); - void (*variant_duplicate)(const GDNativeVariantPtr p_self, GDNativeVariantPtr r_ret, GDNativeBool p_deep); - void (*variant_stringify)(const GDNativeVariantPtr p_self, GDNativeStringPtr r_ret); - - GDNativeVariantType (*variant_get_type)(const GDNativeVariantPtr p_self); - GDNativeBool (*variant_has_method)(const GDNativeVariantPtr p_self, const GDNativeStringNamePtr p_method); - GDNativeBool (*variant_has_member)(GDNativeVariantType p_type, const GDNativeStringNamePtr p_member); - GDNativeBool (*variant_has_key)(const GDNativeVariantPtr p_self, const GDNativeVariantPtr p_key, GDNativeBool *r_valid); + void (*variant_call)(GDNativeVariantPtr p_self, GDNativeConstStringNamePtr p_method, GDNativeConstVariantPtr *p_args, GDNativeInt p_argument_count, GDNativeVariantPtr r_return, GDNativeCallError *r_error); + void (*variant_call_static)(GDNativeVariantType p_type, GDNativeConstStringNamePtr p_method, GDNativeConstVariantPtr *p_args, GDNativeInt p_argument_count, GDNativeVariantPtr r_return, GDNativeCallError *r_error); + void (*variant_evaluate)(GDNativeVariantOperator p_op, GDNativeConstVariantPtr p_a, GDNativeConstVariantPtr p_b, GDNativeVariantPtr r_return, GDNativeBool *r_valid); + void (*variant_set)(GDNativeVariantPtr p_self, GDNativeConstVariantPtr p_key, GDNativeConstVariantPtr p_value, GDNativeBool *r_valid); + void (*variant_set_named)(GDNativeVariantPtr p_self, GDNativeConstStringNamePtr p_key, GDNativeConstVariantPtr p_value, GDNativeBool *r_valid); + void (*variant_set_keyed)(GDNativeVariantPtr p_self, GDNativeConstVariantPtr p_key, GDNativeConstVariantPtr p_value, GDNativeBool *r_valid); + void (*variant_set_indexed)(GDNativeVariantPtr p_self, GDNativeInt p_index, GDNativeConstVariantPtr p_value, GDNativeBool *r_valid, GDNativeBool *r_oob); + void (*variant_get)(GDNativeConstVariantPtr p_self, GDNativeConstVariantPtr p_key, GDNativeVariantPtr r_ret, GDNativeBool *r_valid); + void (*variant_get_named)(GDNativeConstVariantPtr p_self, GDNativeConstStringNamePtr p_key, GDNativeVariantPtr r_ret, GDNativeBool *r_valid); + void (*variant_get_keyed)(GDNativeConstVariantPtr p_self, GDNativeConstVariantPtr p_key, GDNativeVariantPtr r_ret, GDNativeBool *r_valid); + void (*variant_get_indexed)(GDNativeConstVariantPtr p_self, GDNativeInt p_index, GDNativeVariantPtr r_ret, GDNativeBool *r_valid, GDNativeBool *r_oob); + GDNativeBool (*variant_iter_init)(GDNativeConstVariantPtr p_self, GDNativeVariantPtr r_iter, GDNativeBool *r_valid); + GDNativeBool (*variant_iter_next)(GDNativeConstVariantPtr p_self, GDNativeVariantPtr r_iter, GDNativeBool *r_valid); + void (*variant_iter_get)(GDNativeConstVariantPtr p_self, GDNativeVariantPtr r_iter, GDNativeVariantPtr r_ret, GDNativeBool *r_valid); + GDNativeInt (*variant_hash)(GDNativeConstVariantPtr p_self); + GDNativeInt (*variant_recursive_hash)(GDNativeConstVariantPtr p_self, GDNativeInt p_recursion_count); + GDNativeBool (*variant_hash_compare)(GDNativeConstVariantPtr p_self, GDNativeConstVariantPtr p_other); + GDNativeBool (*variant_booleanize)(GDNativeConstVariantPtr p_self); + void (*variant_duplicate)(GDNativeConstVariantPtr p_self, GDNativeVariantPtr r_ret, GDNativeBool p_deep); + void (*variant_stringify)(GDNativeConstVariantPtr p_self, GDNativeStringPtr r_ret); + + GDNativeVariantType (*variant_get_type)(GDNativeConstVariantPtr p_self); + GDNativeBool (*variant_has_method)(GDNativeConstVariantPtr p_self, GDNativeConstStringNamePtr p_method); + GDNativeBool (*variant_has_member)(GDNativeVariantType p_type, GDNativeConstStringNamePtr p_member); + GDNativeBool (*variant_has_key)(GDNativeConstVariantPtr p_self, GDNativeConstVariantPtr p_key, GDNativeBool *r_valid); void (*variant_get_type_name)(GDNativeVariantType p_type, GDNativeStringPtr r_name); GDNativeBool (*variant_can_convert)(GDNativeVariantType p_from, GDNativeVariantType p_to); GDNativeBool (*variant_can_convert_strict)(GDNativeVariantType p_from, GDNativeVariantType p_to); @@ -456,19 +460,19 @@ typedef struct { GDNativeVariantFromTypeConstructorFunc (*get_variant_from_type_constructor)(GDNativeVariantType p_type); GDNativeTypeFromVariantConstructorFunc (*get_variant_to_type_constructor)(GDNativeVariantType p_type); GDNativePtrOperatorEvaluator (*variant_get_ptr_operator_evaluator)(GDNativeVariantOperator p_operator, GDNativeVariantType p_type_a, GDNativeVariantType p_type_b); - GDNativePtrBuiltInMethod (*variant_get_ptr_builtin_method)(GDNativeVariantType p_type, const GDNativeStringNamePtr p_method, GDNativeInt p_hash); + GDNativePtrBuiltInMethod (*variant_get_ptr_builtin_method)(GDNativeVariantType p_type, GDNativeConstStringNamePtr p_method, GDNativeInt p_hash); GDNativePtrConstructor (*variant_get_ptr_constructor)(GDNativeVariantType p_type, int32_t p_constructor); GDNativePtrDestructor (*variant_get_ptr_destructor)(GDNativeVariantType p_type); - void (*variant_construct)(GDNativeVariantType p_type, GDNativeVariantPtr p_base, const GDNativeVariantPtr *p_args, int32_t p_argument_count, GDNativeCallError *r_error); - GDNativePtrSetter (*variant_get_ptr_setter)(GDNativeVariantType p_type, const GDNativeStringNamePtr p_member); - GDNativePtrGetter (*variant_get_ptr_getter)(GDNativeVariantType p_type, const GDNativeStringNamePtr p_member); + void (*variant_construct)(GDNativeVariantType p_type, GDNativeVariantPtr p_base, GDNativeConstVariantPtr *p_args, int32_t p_argument_count, GDNativeCallError *r_error); + GDNativePtrSetter (*variant_get_ptr_setter)(GDNativeVariantType p_type, GDNativeConstStringNamePtr p_member); + GDNativePtrGetter (*variant_get_ptr_getter)(GDNativeVariantType p_type, GDNativeConstStringNamePtr p_member); GDNativePtrIndexedSetter (*variant_get_ptr_indexed_setter)(GDNativeVariantType p_type); GDNativePtrIndexedGetter (*variant_get_ptr_indexed_getter)(GDNativeVariantType p_type); GDNativePtrKeyedSetter (*variant_get_ptr_keyed_setter)(GDNativeVariantType p_type); GDNativePtrKeyedGetter (*variant_get_ptr_keyed_getter)(GDNativeVariantType p_type); GDNativePtrKeyedChecker (*variant_get_ptr_keyed_checker)(GDNativeVariantType p_type); - void (*variant_get_constant_value)(GDNativeVariantType p_type, const GDNativeStringNamePtr p_constant, GDNativeVariantPtr r_ret); - GDNativePtrUtilityFunction (*variant_get_ptr_utility_function)(const GDNativeStringNamePtr p_function, GDNativeInt p_hash); + void (*variant_get_constant_value)(GDNativeVariantType p_type, GDNativeConstStringNamePtr p_constant, GDNativeVariantPtr r_ret); + GDNativePtrUtilityFunction (*variant_get_ptr_utility_function)(GDNativeConstStringNamePtr p_function, GDNativeInt p_hash); /* extra utilities */ void (*string_new_with_latin1_chars)(GDNativeStringPtr r_dest, const char *p_contents); @@ -476,12 +480,11 @@ typedef struct { void (*string_new_with_utf16_chars)(GDNativeStringPtr r_dest, const char16_t *p_contents); void (*string_new_with_utf32_chars)(GDNativeStringPtr r_dest, const char32_t *p_contents); void (*string_new_with_wide_chars)(GDNativeStringPtr r_dest, const wchar_t *p_contents); - void (*string_new_with_latin1_chars_and_len)(GDNativeStringPtr r_dest, const char *p_contents, const GDNativeInt p_size); - void (*string_new_with_utf8_chars_and_len)(GDNativeStringPtr r_dest, const char *p_contents, const GDNativeInt p_size); - void (*string_new_with_utf16_chars_and_len)(GDNativeStringPtr r_dest, const char16_t *p_contents, const GDNativeInt p_size); - void (*string_new_with_utf32_chars_and_len)(GDNativeStringPtr r_dest, const char32_t *p_contents, const GDNativeInt p_size); - void (*string_new_with_wide_chars_and_len)(GDNativeStringPtr r_dest, const wchar_t *p_contents, const GDNativeInt p_size); - + void (*string_new_with_latin1_chars_and_len)(GDNativeStringPtr r_dest, const char *p_contents, GDNativeInt p_size); + void (*string_new_with_utf8_chars_and_len)(GDNativeStringPtr r_dest, const char *p_contents, GDNativeInt p_size); + void (*string_new_with_utf16_chars_and_len)(GDNativeStringPtr r_dest, const char16_t *p_contents, GDNativeInt p_size); + void (*string_new_with_utf32_chars_and_len)(GDNativeStringPtr r_dest, const char32_t *p_contents, GDNativeInt p_size); + void (*string_new_with_wide_chars_and_len)(GDNativeStringPtr r_dest, const wchar_t *p_contents, GDNativeInt p_size); /* Information about the following functions: * - The return value is the resulting encoded string length. * - The length returned is in characters, not in bytes. It also does not include a trailing zero. @@ -490,63 +493,63 @@ typedef struct { * - p_max_write_length argument is in characters, not bytes. It will be ignored if r_text is NULL. * - p_max_write_length argument does not affect the return value, it's only to cap write length. */ - GDNativeInt (*string_to_latin1_chars)(const GDNativeStringPtr p_self, char *r_text, GDNativeInt p_max_write_length); - GDNativeInt (*string_to_utf8_chars)(const GDNativeStringPtr p_self, char *r_text, GDNativeInt p_max_write_length); - GDNativeInt (*string_to_utf16_chars)(const GDNativeStringPtr p_self, char16_t *r_text, GDNativeInt p_max_write_length); - GDNativeInt (*string_to_utf32_chars)(const GDNativeStringPtr p_self, char32_t *r_text, GDNativeInt p_max_write_length); - GDNativeInt (*string_to_wide_chars)(const GDNativeStringPtr p_self, wchar_t *r_text, GDNativeInt p_max_write_length); + GDNativeInt (*string_to_latin1_chars)(GDNativeConstStringPtr p_self, char *r_text, GDNativeInt p_max_write_length); + GDNativeInt (*string_to_utf8_chars)(GDNativeConstStringPtr p_self, char *r_text, GDNativeInt p_max_write_length); + GDNativeInt (*string_to_utf16_chars)(GDNativeConstStringPtr p_self, char16_t *r_text, GDNativeInt p_max_write_length); + GDNativeInt (*string_to_utf32_chars)(GDNativeConstStringPtr p_self, char32_t *r_text, GDNativeInt p_max_write_length); + GDNativeInt (*string_to_wide_chars)(GDNativeConstStringPtr p_self, wchar_t *r_text, GDNativeInt p_max_write_length); char32_t *(*string_operator_index)(GDNativeStringPtr p_self, GDNativeInt p_index); - const char32_t *(*string_operator_index_const)(const GDNativeStringPtr p_self, GDNativeInt p_index); + const char32_t *(*string_operator_index_const)(GDNativeConstStringPtr p_self, GDNativeInt p_index); /* Packed array functions */ uint8_t *(*packed_byte_array_operator_index)(GDNativeTypePtr p_self, GDNativeInt p_index); // p_self should be a PackedByteArray - const uint8_t *(*packed_byte_array_operator_index_const)(const GDNativeTypePtr p_self, GDNativeInt p_index); // p_self should be a PackedByteArray + const uint8_t *(*packed_byte_array_operator_index_const)(GDNativeConstTypePtr p_self, GDNativeInt p_index); // p_self should be a PackedByteArray GDNativeTypePtr (*packed_color_array_operator_index)(GDNativeTypePtr p_self, GDNativeInt p_index); // p_self should be a PackedColorArray, returns Color ptr - GDNativeTypePtr (*packed_color_array_operator_index_const)(const GDNativeTypePtr p_self, GDNativeInt p_index); // p_self should be a PackedColorArray, returns Color ptr + GDNativeTypePtr (*packed_color_array_operator_index_const)(GDNativeConstTypePtr p_self, GDNativeInt p_index); // p_self should be a PackedColorArray, returns Color ptr float *(*packed_float32_array_operator_index)(GDNativeTypePtr p_self, GDNativeInt p_index); // p_self should be a PackedFloat32Array - const float *(*packed_float32_array_operator_index_const)(const GDNativeTypePtr p_self, GDNativeInt p_index); // p_self should be a PackedFloat32Array + const float *(*packed_float32_array_operator_index_const)(GDNativeConstTypePtr p_self, GDNativeInt p_index); // p_self should be a PackedFloat32Array double *(*packed_float64_array_operator_index)(GDNativeTypePtr p_self, GDNativeInt p_index); // p_self should be a PackedFloat64Array - const double *(*packed_float64_array_operator_index_const)(const GDNativeTypePtr p_self, GDNativeInt p_index); // p_self should be a PackedFloat64Array + const double *(*packed_float64_array_operator_index_const)(GDNativeConstTypePtr p_self, GDNativeInt p_index); // p_self should be a PackedFloat64Array int32_t *(*packed_int32_array_operator_index)(GDNativeTypePtr p_self, GDNativeInt p_index); // p_self should be a PackedInt32Array - const int32_t *(*packed_int32_array_operator_index_const)(const GDNativeTypePtr p_self, GDNativeInt p_index); // p_self should be a PackedInt32Array + const int32_t *(*packed_int32_array_operator_index_const)(GDNativeConstTypePtr p_self, GDNativeInt p_index); // p_self should be a PackedInt32Array int64_t *(*packed_int64_array_operator_index)(GDNativeTypePtr p_self, GDNativeInt p_index); // p_self should be a PackedInt32Array - const int64_t *(*packed_int64_array_operator_index_const)(const GDNativeTypePtr p_self, GDNativeInt p_index); // p_self should be a PackedInt32Array + const int64_t *(*packed_int64_array_operator_index_const)(GDNativeConstTypePtr p_self, GDNativeInt p_index); // p_self should be a PackedInt32Array GDNativeStringPtr (*packed_string_array_operator_index)(GDNativeTypePtr p_self, GDNativeInt p_index); // p_self should be a PackedStringArray - GDNativeStringPtr (*packed_string_array_operator_index_const)(const GDNativeTypePtr p_self, GDNativeInt p_index); // p_self should be a PackedStringArray + GDNativeStringPtr (*packed_string_array_operator_index_const)(GDNativeConstTypePtr p_self, GDNativeInt p_index); // p_self should be a PackedStringArray GDNativeTypePtr (*packed_vector2_array_operator_index)(GDNativeTypePtr p_self, GDNativeInt p_index); // p_self should be a PackedVector2Array, returns Vector2 ptr - GDNativeTypePtr (*packed_vector2_array_operator_index_const)(const GDNativeTypePtr p_self, GDNativeInt p_index); // p_self should be a PackedVector2Array, returns Vector2 ptr + GDNativeTypePtr (*packed_vector2_array_operator_index_const)(GDNativeConstTypePtr p_self, GDNativeInt p_index); // p_self should be a PackedVector2Array, returns Vector2 ptr GDNativeTypePtr (*packed_vector3_array_operator_index)(GDNativeTypePtr p_self, GDNativeInt p_index); // p_self should be a PackedVector3Array, returns Vector3 ptr - GDNativeTypePtr (*packed_vector3_array_operator_index_const)(const GDNativeTypePtr p_self, GDNativeInt p_index); // p_self should be a PackedVector3Array, returns Vector3 ptr + GDNativeTypePtr (*packed_vector3_array_operator_index_const)(GDNativeConstTypePtr p_self, GDNativeInt p_index); // p_self should be a PackedVector3Array, returns Vector3 ptr GDNativeVariantPtr (*array_operator_index)(GDNativeTypePtr p_self, GDNativeInt p_index); // p_self should be an Array ptr - GDNativeVariantPtr (*array_operator_index_const)(const GDNativeTypePtr p_self, GDNativeInt p_index); // p_self should be an Array ptr + GDNativeVariantPtr (*array_operator_index_const)(GDNativeConstTypePtr p_self, GDNativeInt p_index); // p_self should be an Array ptr /* Dictionary functions */ - GDNativeVariantPtr (*dictionary_operator_index)(GDNativeTypePtr p_self, const GDNativeVariantPtr p_key); // p_self should be an Dictionary ptr - GDNativeVariantPtr (*dictionary_operator_index_const)(const GDNativeTypePtr p_self, const GDNativeVariantPtr p_key); // p_self should be an Dictionary ptr + GDNativeVariantPtr (*dictionary_operator_index)(GDNativeTypePtr p_self, GDNativeConstVariantPtr p_key); // p_self should be an Dictionary ptr + GDNativeVariantPtr (*dictionary_operator_index_const)(GDNativeConstTypePtr p_self, GDNativeConstVariantPtr p_key); // p_self should be an Dictionary ptr /* OBJECT */ - void (*object_method_bind_call)(const GDNativeMethodBindPtr p_method_bind, GDNativeObjectPtr p_instance, const GDNativeVariantPtr *p_args, GDNativeInt p_arg_count, GDNativeVariantPtr r_ret, GDNativeCallError *r_error); - void (*object_method_bind_ptrcall)(const GDNativeMethodBindPtr p_method_bind, GDNativeObjectPtr p_instance, const GDNativeTypePtr *p_args, GDNativeTypePtr r_ret); + void (*object_method_bind_call)(GDNativeMethodBindPtr p_method_bind, GDNativeObjectPtr p_instance, GDNativeConstVariantPtr *p_args, GDNativeInt p_arg_count, GDNativeVariantPtr r_ret, GDNativeCallError *r_error); + void (*object_method_bind_ptrcall)(GDNativeMethodBindPtr p_method_bind, GDNativeObjectPtr p_instance, GDNativeConstTypePtr *p_args, GDNativeTypePtr r_ret); void (*object_destroy)(GDNativeObjectPtr p_o); - GDNativeObjectPtr (*global_get_singleton)(const GDNativeStringNamePtr p_name); + GDNativeObjectPtr (*global_get_singleton)(GDNativeConstStringNamePtr p_name); void *(*object_get_instance_binding)(GDNativeObjectPtr p_o, void *p_token, const GDNativeInstanceBindingCallbacks *p_callbacks); void (*object_set_instance_binding)(GDNativeObjectPtr p_o, void *p_token, void *p_binding, const GDNativeInstanceBindingCallbacks *p_callbacks); - void (*object_set_instance)(GDNativeObjectPtr p_o, const GDNativeStringNamePtr p_classname, GDExtensionClassInstancePtr p_instance); /* p_classname should be a registered extension class and should extend the p_o object's class. */ + void (*object_set_instance)(GDNativeObjectPtr p_o, GDNativeConstStringNamePtr p_classname, GDExtensionClassInstancePtr p_instance); /* p_classname should be a registered extension class and should extend the p_o object's class. */ - GDNativeObjectPtr (*object_cast_to)(const GDNativeObjectPtr p_object, void *p_class_tag); + GDNativeObjectPtr (*object_cast_to)(GDNativeConstObjectPtr p_object, void *p_class_tag); GDNativeObjectPtr (*object_get_instance_from_id)(GDObjectInstanceID p_instance_id); - GDObjectInstanceID (*object_get_instance_id)(const GDNativeObjectPtr p_object); + GDObjectInstanceID (*object_get_instance_id)(GDNativeConstObjectPtr p_object); /* SCRIPT INSTANCE */ @@ -554,23 +557,23 @@ typedef struct { /* CLASSDB */ - GDNativeObjectPtr (*classdb_construct_object)(const GDNativeStringNamePtr p_classname); /* The passed class must be a built-in godot class, or an already-registered extension class. In both case, object_set_instance should be called to fully initialize the object. */ - GDNativeMethodBindPtr (*classdb_get_method_bind)(const GDNativeStringNamePtr p_classname, const GDNativeStringNamePtr p_methodname, GDNativeInt p_hash); - void *(*classdb_get_class_tag)(const GDNativeStringNamePtr p_classname); + GDNativeObjectPtr (*classdb_construct_object)(GDNativeConstStringNamePtr p_classname); /* The passed class must be a built-in godot class, or an already-registered extension class. In both case, object_set_instance should be called to fully initialize the object. */ + GDNativeMethodBindPtr (*classdb_get_method_bind)(GDNativeConstStringNamePtr p_classname, GDNativeConstStringNamePtr p_methodname, GDNativeInt p_hash); + void *(*classdb_get_class_tag)(GDNativeConstStringNamePtr p_classname); /* CLASSDB EXTENSION */ /* Provided parameters for `classdb_register_extension_*` can be safely freed once the function returns. */ - void (*classdb_register_extension_class)(const GDNativeExtensionClassLibraryPtr p_library, const GDNativeStringNamePtr p_class_name, const GDNativeStringNamePtr p_parent_class_name, const GDNativeExtensionClassCreationInfo *p_extension_funcs); - void (*classdb_register_extension_class_method)(const GDNativeExtensionClassLibraryPtr p_library, const GDNativeStringNamePtr p_class_name, const GDNativeExtensionClassMethodInfo *p_method_info); - void (*classdb_register_extension_class_integer_constant)(const GDNativeExtensionClassLibraryPtr p_library, const GDNativeStringNamePtr p_class_name, const GDNativeStringNamePtr p_enum_name, const GDNativeStringNamePtr p_constant_name, GDNativeInt p_constant_value, GDNativeBool p_is_bitfield); - void (*classdb_register_extension_class_property)(const GDNativeExtensionClassLibraryPtr p_library, const GDNativeStringNamePtr p_class_name, const GDNativePropertyInfo *p_info, const GDNativeStringNamePtr p_setter, const GDNativeStringNamePtr p_getter); - void (*classdb_register_extension_class_property_group)(const GDNativeExtensionClassLibraryPtr p_library, const GDNativeStringNamePtr p_class_name, const GDNativeStringPtr p_group_name, const GDNativeStringPtr p_prefix); - void (*classdb_register_extension_class_property_subgroup)(const GDNativeExtensionClassLibraryPtr p_library, const GDNativeStringNamePtr p_class_name, const GDNativeStringPtr p_subgroup_name, const GDNativeStringPtr p_prefix); - void (*classdb_register_extension_class_signal)(const GDNativeExtensionClassLibraryPtr p_library, const GDNativeStringNamePtr p_class_name, const GDNativeStringNamePtr p_signal_name, const GDNativePropertyInfo *p_argument_info, GDNativeInt p_argument_count); - void (*classdb_unregister_extension_class)(const GDNativeExtensionClassLibraryPtr p_library, const GDNativeStringNamePtr p_class_name); /* Unregistering a parent class before a class that inherits it will result in failure. Inheritors must be unregistered first. */ + void (*classdb_register_extension_class)(GDNativeExtensionClassLibraryPtr p_library, GDNativeConstStringNamePtr p_class_name, GDNativeConstStringNamePtr p_parent_class_name, const GDNativeExtensionClassCreationInfo *p_extension_funcs); + void (*classdb_register_extension_class_method)(GDNativeExtensionClassLibraryPtr p_library, GDNativeConstStringNamePtr p_class_name, const GDNativeExtensionClassMethodInfo *p_method_info); + void (*classdb_register_extension_class_integer_constant)(GDNativeExtensionClassLibraryPtr p_library, GDNativeConstStringNamePtr p_class_name, GDNativeConstStringNamePtr p_enum_name, GDNativeConstStringNamePtr p_constant_name, GDNativeInt p_constant_value, GDNativeBool p_is_bitfield); + void (*classdb_register_extension_class_property)(GDNativeExtensionClassLibraryPtr p_library, GDNativeConstStringNamePtr p_class_name, const GDNativePropertyInfo *p_info, GDNativeConstStringNamePtr p_setter, GDNativeConstStringNamePtr p_getter); + void (*classdb_register_extension_class_property_group)(GDNativeExtensionClassLibraryPtr p_library, GDNativeConstStringNamePtr p_class_name, GDNativeConstStringPtr p_group_name, GDNativeConstStringPtr p_prefix); + void (*classdb_register_extension_class_property_subgroup)(GDNativeExtensionClassLibraryPtr p_library, GDNativeConstStringNamePtr p_class_name, GDNativeConstStringPtr p_subgroup_name, GDNativeConstStringPtr p_prefix); + void (*classdb_register_extension_class_signal)(GDNativeExtensionClassLibraryPtr p_library, GDNativeConstStringNamePtr p_class_name, GDNativeConstStringNamePtr p_signal_name, const GDNativePropertyInfo *p_argument_info, GDNativeInt p_argument_count); + void (*classdb_unregister_extension_class)(GDNativeExtensionClassLibraryPtr p_library, GDNativeConstStringNamePtr p_class_name); /* Unregistering a parent class before a class that inherits it will result in failure. Inheritors must be unregistered first. */ - void (*get_library_path)(const GDNativeExtensionClassLibraryPtr p_library, GDNativeStringPtr r_path); + void (*get_library_path)(GDNativeExtensionClassLibraryPtr p_library, GDNativeStringPtr r_path); } GDNativeInterface; @@ -600,7 +603,7 @@ typedef struct { * It can be used to set up different init levels, which are called during various stages of initialization/shutdown. * The function name must be a unique one specified in the .gdextension config file. */ -typedef GDNativeBool (*GDNativeInitializationFunction)(const GDNativeInterface *p_interface, const GDNativeExtensionClassLibraryPtr p_library, GDNativeInitialization *r_initialization); +typedef GDNativeBool (*GDNativeInitializationFunction)(const GDNativeInterface *p_interface, GDNativeExtensionClassLibraryPtr p_library, GDNativeInitialization *r_initialization); #ifdef __cplusplus } diff --git a/core/extension/native_extension.cpp b/core/extension/native_extension.cpp index 83a2e80793..37967cdb48 100644 --- a/core/extension/native_extension.cpp +++ b/core/extension/native_extension.cpp @@ -76,20 +76,20 @@ public: } #endif - virtual Variant call(Object *p_object, const Variant **p_args, int p_arg_count, Callable::CallError &r_error) override { + virtual Variant call(Object *p_object, const Variant **p_args, int p_arg_count, Callable::CallError &r_error) const override { Variant ret; GDExtensionClassInstancePtr extension_instance = is_static() ? nullptr : p_object->_get_extension_instance(); GDNativeCallError ce{ GDNATIVE_CALL_OK, 0, 0 }; - call_func(method_userdata, extension_instance, (const GDNativeVariantPtr *)p_args, p_arg_count, (GDNativeVariantPtr)&ret, &ce); + call_func(method_userdata, extension_instance, reinterpret_cast<GDNativeConstVariantPtr *>(p_args), p_arg_count, (GDNativeVariantPtr)&ret, &ce); r_error.error = Callable::CallError::Error(ce.error); r_error.argument = ce.argument; r_error.expected = ce.expected; return ret; } - virtual void ptrcall(Object *p_object, const void **p_args, void *r_ret) override { + virtual void ptrcall(Object *p_object, const void **p_args, void *r_ret) const override { ERR_FAIL_COND_MSG(vararg, "Vararg methods don't have ptrcall support. This is most likely an engine bug."); GDExtensionClassInstancePtr extension_instance = p_object->_get_extension_instance(); - ptrcall_func(method_userdata, extension_instance, (const GDNativeTypePtr *)p_args, (GDNativeTypePtr)r_ret); + ptrcall_func(method_userdata, extension_instance, reinterpret_cast<GDNativeConstTypePtr *>(p_args), (GDNativeTypePtr)r_ret); } virtual bool is_vararg() const override { @@ -135,11 +135,11 @@ public: static GDNativeInterface gdnative_interface; -void NativeExtension::_register_extension_class(const GDNativeExtensionClassLibraryPtr p_library, const GDNativeStringNamePtr p_class_name, const GDNativeStringNamePtr p_parent_class_name, const GDNativeExtensionClassCreationInfo *p_extension_funcs) { - NativeExtension *self = static_cast<NativeExtension *>(p_library); +void NativeExtension::_register_extension_class(GDNativeExtensionClassLibraryPtr p_library, GDNativeConstStringNamePtr p_class_name, GDNativeConstStringNamePtr p_parent_class_name, const GDNativeExtensionClassCreationInfo *p_extension_funcs) { + NativeExtension *self = reinterpret_cast<NativeExtension *>(p_library); - StringName class_name = *reinterpret_cast<StringName *>(p_class_name); - StringName parent_class_name = *reinterpret_cast<StringName *>(p_parent_class_name); + StringName class_name = *reinterpret_cast<const StringName *>(p_class_name); + StringName parent_class_name = *reinterpret_cast<const StringName *>(p_parent_class_name); ERR_FAIL_COND_MSG(!String(class_name).is_valid_identifier(), "Attempt to register extension class '" + class_name + "', which is not a valid class identifier."); ERR_FAIL_COND_MSG(ClassDB::class_exists(class_name), "Attempt to register extension class '" + class_name + "', which appears to be already registered."); @@ -190,8 +190,8 @@ void NativeExtension::_register_extension_class(const GDNativeExtensionClassLibr ClassDB::register_extension_class(&extension->native_extension); } -void NativeExtension::_register_extension_class_method(const GDNativeExtensionClassLibraryPtr p_library, const GDNativeStringNamePtr p_class_name, const GDNativeExtensionClassMethodInfo *p_method_info) { - NativeExtension *self = static_cast<NativeExtension *>(p_library); +void NativeExtension::_register_extension_class_method(GDNativeExtensionClassLibraryPtr p_library, GDNativeConstStringNamePtr p_class_name, const GDNativeExtensionClassMethodInfo *p_method_info) { + NativeExtension *self = reinterpret_cast<NativeExtension *>(p_library); StringName class_name = *reinterpret_cast<const StringName *>(p_class_name); StringName method_name = *reinterpret_cast<const StringName *>(p_method_info->name); @@ -204,8 +204,8 @@ void NativeExtension::_register_extension_class_method(const GDNativeExtensionCl ClassDB::bind_method_custom(class_name, method); } -void NativeExtension::_register_extension_class_integer_constant(const GDNativeExtensionClassLibraryPtr p_library, const GDNativeStringNamePtr p_class_name, const GDNativeStringNamePtr p_enum_name, const GDNativeStringNamePtr p_constant_name, GDNativeInt p_constant_value, GDNativeBool p_is_bitfield) { - NativeExtension *self = static_cast<NativeExtension *>(p_library); +void NativeExtension::_register_extension_class_integer_constant(GDNativeExtensionClassLibraryPtr p_library, GDNativeConstStringNamePtr p_class_name, GDNativeConstStringNamePtr p_enum_name, GDNativeConstStringNamePtr p_constant_name, GDNativeInt p_constant_value, GDNativeBool p_is_bitfield) { + NativeExtension *self = reinterpret_cast<NativeExtension *>(p_library); StringName class_name = *reinterpret_cast<const StringName *>(p_class_name); StringName enum_name = *reinterpret_cast<const StringName *>(p_enum_name); @@ -215,8 +215,8 @@ void NativeExtension::_register_extension_class_integer_constant(const GDNativeE ClassDB::bind_integer_constant(class_name, enum_name, constant_name, p_constant_value, p_is_bitfield); } -void NativeExtension::_register_extension_class_property(const GDNativeExtensionClassLibraryPtr p_library, const GDNativeStringNamePtr p_class_name, const GDNativePropertyInfo *p_info, const GDNativeStringNamePtr p_setter, const GDNativeStringNamePtr p_getter) { - NativeExtension *self = static_cast<NativeExtension *>(p_library); +void NativeExtension::_register_extension_class_property(GDNativeExtensionClassLibraryPtr p_library, GDNativeConstStringNamePtr p_class_name, const GDNativePropertyInfo *p_info, GDNativeConstStringNamePtr p_setter, GDNativeConstStringNamePtr p_getter) { + NativeExtension *self = reinterpret_cast<NativeExtension *>(p_library); StringName class_name = *reinterpret_cast<const StringName *>(p_class_name); StringName setter = *reinterpret_cast<const StringName *>(p_setter); @@ -230,8 +230,8 @@ void NativeExtension::_register_extension_class_property(const GDNativeExtension ClassDB::add_property(class_name, pinfo, setter, getter); } -void NativeExtension::_register_extension_class_property_group(const GDNativeExtensionClassLibraryPtr p_library, const GDNativeStringNamePtr p_class_name, const GDNativeStringPtr p_group_name, const GDNativeStringPtr p_prefix) { - NativeExtension *self = static_cast<NativeExtension *>(p_library); +void NativeExtension::_register_extension_class_property_group(GDNativeExtensionClassLibraryPtr p_library, GDNativeConstStringNamePtr p_class_name, GDNativeConstStringPtr p_group_name, GDNativeConstStringPtr p_prefix) { + NativeExtension *self = reinterpret_cast<NativeExtension *>(p_library); StringName class_name = *reinterpret_cast<const StringName *>(p_class_name); String group_name = *reinterpret_cast<const String *>(p_group_name); @@ -241,8 +241,8 @@ void NativeExtension::_register_extension_class_property_group(const GDNativeExt ClassDB::add_property_group(class_name, group_name, prefix); } -void NativeExtension::_register_extension_class_property_subgroup(const GDNativeExtensionClassLibraryPtr p_library, const GDNativeStringNamePtr p_class_name, const GDNativeStringPtr p_subgroup_name, const GDNativeStringPtr p_prefix) { - NativeExtension *self = static_cast<NativeExtension *>(p_library); +void NativeExtension::_register_extension_class_property_subgroup(GDNativeExtensionClassLibraryPtr p_library, GDNativeConstStringNamePtr p_class_name, GDNativeConstStringPtr p_subgroup_name, GDNativeConstStringPtr p_prefix) { + NativeExtension *self = reinterpret_cast<NativeExtension *>(p_library); StringName class_name = *reinterpret_cast<const StringName *>(p_class_name); String subgroup_name = *reinterpret_cast<const String *>(p_subgroup_name); @@ -252,8 +252,8 @@ void NativeExtension::_register_extension_class_property_subgroup(const GDNative ClassDB::add_property_subgroup(class_name, subgroup_name, prefix); } -void NativeExtension::_register_extension_class_signal(const GDNativeExtensionClassLibraryPtr p_library, const GDNativeStringNamePtr p_class_name, const GDNativeStringNamePtr p_signal_name, const GDNativePropertyInfo *p_argument_info, GDNativeInt p_argument_count) { - NativeExtension *self = static_cast<NativeExtension *>(p_library); +void NativeExtension::_register_extension_class_signal(GDNativeExtensionClassLibraryPtr p_library, GDNativeConstStringNamePtr p_class_name, GDNativeConstStringNamePtr p_signal_name, const GDNativePropertyInfo *p_argument_info, GDNativeInt p_argument_count) { + NativeExtension *self = reinterpret_cast<NativeExtension *>(p_library); StringName class_name = *reinterpret_cast<const StringName *>(p_class_name); StringName signal_name = *reinterpret_cast<const StringName *>(p_signal_name); @@ -268,8 +268,8 @@ void NativeExtension::_register_extension_class_signal(const GDNativeExtensionCl ClassDB::add_signal(class_name, s); } -void NativeExtension::_unregister_extension_class(const GDNativeExtensionClassLibraryPtr p_library, const GDNativeStringNamePtr p_class_name) { - NativeExtension *self = static_cast<NativeExtension *>(p_library); +void NativeExtension::_unregister_extension_class(GDNativeExtensionClassLibraryPtr p_library, GDNativeConstStringNamePtr p_class_name) { + NativeExtension *self = reinterpret_cast<NativeExtension *>(p_library); StringName class_name = *reinterpret_cast<const StringName *>(p_class_name); ERR_FAIL_COND_MSG(!self->extension_classes.has(class_name), "Attempt to unregister unexisting extension class '" + class_name + "'."); @@ -283,8 +283,8 @@ void NativeExtension::_unregister_extension_class(const GDNativeExtensionClassLi self->extension_classes.erase(class_name); } -void NativeExtension::_get_library_path(const GDNativeExtensionClassLibraryPtr p_library, GDNativeStringPtr r_path) { - NativeExtension *self = static_cast<NativeExtension *>(p_library); +void NativeExtension::_get_library_path(GDNativeExtensionClassLibraryPtr p_library, GDNativeStringPtr r_path) { + NativeExtension *self = reinterpret_cast<NativeExtension *>(p_library); *(String *)r_path = self->library_path; } diff --git a/core/extension/native_extension.h b/core/extension/native_extension.h index 70f6f9f039..ca6200cd1e 100644 --- a/core/extension/native_extension.h +++ b/core/extension/native_extension.h @@ -47,15 +47,15 @@ class NativeExtension : public Resource { HashMap<StringName, Extension> extension_classes; - static void _register_extension_class(const GDNativeExtensionClassLibraryPtr p_library, const GDNativeStringNamePtr p_class_name, const GDNativeStringNamePtr p_parent_class_name, const GDNativeExtensionClassCreationInfo *p_extension_funcs); - static void _register_extension_class_method(const GDNativeExtensionClassLibraryPtr p_library, const GDNativeStringNamePtr p_class_name, const GDNativeExtensionClassMethodInfo *p_method_info); - static void _register_extension_class_integer_constant(const GDNativeExtensionClassLibraryPtr p_library, const GDNativeStringNamePtr p_class_name, const GDNativeStringNamePtr p_enum_name, const GDNativeStringNamePtr p_constant_name, GDNativeInt p_constant_value, GDNativeBool p_is_bitfield); - static void _register_extension_class_property(const GDNativeExtensionClassLibraryPtr p_library, const GDNativeStringNamePtr p_class_name, const GDNativePropertyInfo *p_info, const GDNativeStringNamePtr p_setter, const GDNativeStringNamePtr p_getter); - static void _register_extension_class_property_group(const GDNativeExtensionClassLibraryPtr p_library, const GDNativeStringNamePtr p_class_name, const GDNativeStringNamePtr p_group_name, const GDNativeStringNamePtr p_prefix); - static void _register_extension_class_property_subgroup(const GDNativeExtensionClassLibraryPtr p_library, const GDNativeStringNamePtr p_class_name, const GDNativeStringNamePtr p_subgroup_name, const GDNativeStringNamePtr p_prefix); - static void _register_extension_class_signal(const GDNativeExtensionClassLibraryPtr p_library, const GDNativeStringNamePtr p_class_name, const GDNativeStringNamePtr p_signal_name, const GDNativePropertyInfo *p_argument_info, GDNativeInt p_argument_count); - static void _unregister_extension_class(const GDNativeExtensionClassLibraryPtr p_library, const GDNativeStringNamePtr p_class_name); - static void _get_library_path(const GDNativeExtensionClassLibraryPtr p_library, GDNativeStringPtr r_path); + static void _register_extension_class(GDNativeExtensionClassLibraryPtr p_library, GDNativeConstStringNamePtr p_class_name, GDNativeConstStringNamePtr p_parent_class_name, const GDNativeExtensionClassCreationInfo *p_extension_funcs); + static void _register_extension_class_method(GDNativeExtensionClassLibraryPtr p_library, GDNativeConstStringNamePtr p_class_name, const GDNativeExtensionClassMethodInfo *p_method_info); + static void _register_extension_class_integer_constant(GDNativeExtensionClassLibraryPtr p_library, GDNativeConstStringNamePtr p_class_name, GDNativeConstStringNamePtr p_enum_name, GDNativeConstStringNamePtr p_constant_name, GDNativeInt p_constant_value, GDNativeBool p_is_bitfield); + static void _register_extension_class_property(GDNativeExtensionClassLibraryPtr p_library, GDNativeConstStringNamePtr p_class_name, const GDNativePropertyInfo *p_info, GDNativeConstStringNamePtr p_setter, GDNativeConstStringNamePtr p_getter); + static void _register_extension_class_property_group(GDNativeExtensionClassLibraryPtr p_library, GDNativeConstStringNamePtr p_class_name, GDNativeConstStringNamePtr p_group_name, GDNativeConstStringNamePtr p_prefix); + static void _register_extension_class_property_subgroup(GDNativeExtensionClassLibraryPtr p_library, GDNativeConstStringNamePtr p_class_name, GDNativeConstStringNamePtr p_subgroup_name, GDNativeConstStringNamePtr p_prefix); + static void _register_extension_class_signal(GDNativeExtensionClassLibraryPtr p_library, GDNativeConstStringNamePtr p_class_name, GDNativeConstStringNamePtr p_signal_name, const GDNativePropertyInfo *p_argument_info, GDNativeInt p_argument_count); + static void _unregister_extension_class(GDNativeExtensionClassLibraryPtr p_library, GDNativeConstStringNamePtr p_class_name); + static void _get_library_path(GDNativeExtensionClassLibraryPtr p_library, GDNativeStringPtr r_path); GDNativeInitialization initialization; int32_t level_initialized = -1; diff --git a/core/io/file_access.cpp b/core/io/file_access.cpp index cb25564342..0ceb300f97 100644 --- a/core/io/file_access.cpp +++ b/core/io/file_access.cpp @@ -690,7 +690,7 @@ void FileAccess::store_var(const Variant &p_var, bool p_full_objects) { _store_buffer(buff); } -Vector<uint8_t> FileAccess::get_file_as_array(const String &p_path, Error *r_error) { +Vector<uint8_t> FileAccess::get_file_as_bytes(const String &p_path, Error *r_error) { Ref<FileAccess> f = FileAccess::open(p_path, READ, r_error); if (f.is_null()) { if (r_error) { // if error requested, do not throw error @@ -706,7 +706,7 @@ Vector<uint8_t> FileAccess::get_file_as_array(const String &p_path, Error *r_err String FileAccess::get_file_as_string(const String &p_path, Error *r_error) { Error err; - Vector<uint8_t> array = get_file_as_array(p_path, &err); + Vector<uint8_t> array = get_file_as_bytes(p_path, &err); if (r_error) { *r_error = err; } @@ -810,6 +810,9 @@ void FileAccess::_bind_methods() { ClassDB::bind_static_method("FileAccess", D_METHOD("open_compressed", "path", "mode_flags", "compression_mode"), &FileAccess::open_compressed, DEFVAL(0)); ClassDB::bind_static_method("FileAccess", D_METHOD("get_open_error"), &FileAccess::get_open_error); + ClassDB::bind_static_method("FileAccess", D_METHOD("get_file_as_bytes", "path"), &FileAccess::_get_file_as_bytes); + ClassDB::bind_static_method("FileAccess", D_METHOD("get_file_as_string", "path"), &FileAccess::_get_file_as_string); + ClassDB::bind_method(D_METHOD("flush"), &FileAccess::flush); ClassDB::bind_method(D_METHOD("get_path"), &FileAccess::get_path); ClassDB::bind_method(D_METHOD("get_path_absolute"), &FileAccess::get_path_absolute); diff --git a/core/io/file_access.h b/core/io/file_access.h index 8ca44306a0..54a0235333 100644 --- a/core/io/file_access.h +++ b/core/io/file_access.h @@ -192,9 +192,12 @@ public: static String get_sha256(const String &p_file); static String get_multiple_md5(const Vector<String> &p_file); - static Vector<uint8_t> get_file_as_array(const String &p_path, Error *r_error = nullptr); + static Vector<uint8_t> get_file_as_bytes(const String &p_path, Error *r_error = nullptr); static String get_file_as_string(const String &p_path, Error *r_error = nullptr); + static PackedByteArray _get_file_as_bytes(const String &p_path) { return get_file_as_bytes(p_path); } + static String _get_file_as_string(const String &p_path) { return get_file_as_string(p_path); }; + template <class T> static void make_default(AccessType p_access) { create_func[p_access] = _create_builtin<T>; diff --git a/core/io/image.cpp b/core/io/image.cpp index 21146dd80c..1b9538794a 100644 --- a/core/io/image.cpp +++ b/core/io/image.cpp @@ -3798,6 +3798,19 @@ void Image::convert_ra_rgba8_to_rg() { } } +void Image::convert_rgba8_to_bgra8() { + ERR_FAIL_COND(format != FORMAT_RGBA8); + ERR_FAIL_COND(!data.size()); + + int s = data.size(); + uint8_t *w = data.ptrw(); + for (int i = 0; i < s; i += 4) { + uint8_t r = w[i]; + w[i] = w[i + 2]; // Swap R to B + w[i + 2] = r; // Swap B to R + } +} + Error Image::_load_from_buffer(const Vector<uint8_t> &p_array, ImageMemLoadFunc p_loader) { int buffer_size = p_array.size(); diff --git a/core/io/image.h b/core/io/image.h index 62df81e7c8..ad5c0b4a04 100644 --- a/core/io/image.h +++ b/core/io/image.h @@ -391,6 +391,7 @@ public: void convert_rg_to_ra_rgba8(); void convert_ra_rgba8_to_rg(); + void convert_rgba8_to_bgra8(); Image(const uint8_t *p_mem_png_jpg, int p_len = -1); Image(const char **p_xpm); diff --git a/core/io/pck_packer.cpp b/core/io/pck_packer.cpp index 0118b4c6af..0556f45b0c 100644 --- a/core/io/pck_packer.cpp +++ b/core/io/pck_packer.cpp @@ -120,7 +120,7 @@ Error PCKPacker::add_file(const String &p_file, const String &p_src, bool p_encr pf.ofs = ofs; pf.size = f->get_length(); - Vector<uint8_t> data = FileAccess::get_file_as_array(p_src); + Vector<uint8_t> data = FileAccess::get_file_as_bytes(p_src); { unsigned char hash[16]; CryptoCore::md5(data.ptr(), data.size(), hash); diff --git a/core/io/resource.cpp b/core/io/resource.cpp index ab30fb1ca3..be75ad7e25 100644 --- a/core/io/resource.cpp +++ b/core/io/resource.cpp @@ -436,7 +436,7 @@ void Resource::_bind_methods() { ADD_GROUP("Resource", "resource_"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "resource_local_to_scene"), "set_local_to_scene", "is_local_to_scene"); ADD_PROPERTY(PropertyInfo(Variant::STRING, "resource_path", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_EDITOR), "set_path", "get_path"); - ADD_PROPERTY(PropertyInfo(Variant::STRING_NAME, "resource_name"), "set_name", "get_name"); + ADD_PROPERTY(PropertyInfo(Variant::STRING, "resource_name"), "set_name", "get_name"); MethodInfo get_rid_bind("_get_rid"); get_rid_bind.return_val.type = Variant::RID; diff --git a/core/object/make_virtuals.py b/core/object/make_virtuals.py index 61bf6d900a..c92ac0961e 100644 --- a/core/object/make_virtuals.py +++ b/core/object/make_virtuals.py @@ -94,7 +94,7 @@ def generate_version(argcount, const=False, returns=False): argtext += ", " callsiargs = "Variant vargs[" + str(argcount) + "]={" callsiargptrs = "\t\tconst Variant *vargptrs[" + str(argcount) + "]={" - callptrargsptr = "\t\tconst GDNativeTypePtr argptrs[" + str(argcount) + "]={" + callptrargsptr = "\t\tGDNativeConstTypePtr argptrs[" + str(argcount) + "]={" callptrargs = "" for i in range(argcount): if i > 0: @@ -121,7 +121,7 @@ def generate_version(argcount, const=False, returns=False): s = s.replace("$CALLSIARGPASS", "(const Variant **)vargptrs," + str(argcount)) callptrargsptr += "};\\\n" s = s.replace("$CALLPTRARGS", callptrargs + callptrargsptr) - s = s.replace("$CALLPTRARGPASS", "(const GDNativeTypePtr*)argptrs") + s = s.replace("$CALLPTRARGPASS", "reinterpret_cast<GDNativeConstTypePtr*>(argptrs)") else: s = s.replace("$CALLSIARGS", "") s = s.replace("$CALLSIARGPASS", "nullptr, 0") diff --git a/core/object/method_bind.h b/core/object/method_bind.h index 598e8a224d..0f1366aefd 100644 --- a/core/object/method_bind.h +++ b/core/object/method_bind.h @@ -110,8 +110,8 @@ public: _FORCE_INLINE_ int get_argument_count() const { return argument_count; }; - virtual Variant call(Object *p_object, const Variant **p_args, int p_arg_count, Callable::CallError &r_error) = 0; - virtual void ptrcall(Object *p_object, const void **p_args, void *r_ret) = 0; + virtual Variant call(Object *p_object, const Variant **p_args, int p_arg_count, Callable::CallError &r_error) const = 0; + virtual void ptrcall(Object *p_object, const void **p_args, void *r_ret) const = 0; StringName get_name() const; void set_name(const StringName &p_name); @@ -158,7 +158,7 @@ public: } #endif - virtual void ptrcall(Object *p_object, const void **p_args, void *r_ret) override { + virtual void ptrcall(Object *p_object, const void **p_args, void *r_ret) const override { ERR_FAIL(); // Can't call. } @@ -210,7 +210,7 @@ class MethodBindVarArgT : public MethodBindVarArgBase<MethodBindVarArgT<T>, T, v friend class MethodBindVarArgBase<MethodBindVarArgT<T>, T, void, false>; public: - virtual Variant call(Object *p_object, const Variant **p_args, int p_arg_count, Callable::CallError &r_error) override { + virtual Variant call(Object *p_object, const Variant **p_args, int p_arg_count, Callable::CallError &r_error) const override { (static_cast<T *>(p_object)->*MethodBindVarArgBase<MethodBindVarArgT<T>, T, void, false>::method)(p_args, p_arg_count, r_error); return {}; } @@ -246,7 +246,7 @@ public: #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wmaybe-uninitialized" #endif - virtual Variant call(Object *p_object, const Variant **p_args, int p_arg_count, Callable::CallError &r_error) override { + virtual Variant call(Object *p_object, const Variant **p_args, int p_arg_count, Callable::CallError &r_error) const override { return (static_cast<T *>(p_object)->*MethodBindVarArgBase<MethodBindVarArgTR<T, R>, T, R, true>::method)(p_args, p_arg_count, r_error); } #if defined(SANITIZERS_ENABLED) && defined(__GNUC__) && !defined(__clang__) @@ -313,7 +313,7 @@ public: } #endif - virtual Variant call(Object *p_object, const Variant **p_args, int p_arg_count, Callable::CallError &r_error) override { + virtual Variant call(Object *p_object, const Variant **p_args, int p_arg_count, Callable::CallError &r_error) const override { #ifdef TYPED_METHOD_BIND call_with_variant_args_dv(static_cast<T *>(p_object), method, p_args, p_arg_count, r_error, get_default_arguments()); #else @@ -322,7 +322,7 @@ public: return Variant(); } - virtual void ptrcall(Object *p_object, const void **p_args, void *r_ret) override { + virtual void ptrcall(Object *p_object, const void **p_args, void *r_ret) const override { #ifdef TYPED_METHOD_BIND call_with_ptr_args<T, P...>(static_cast<T *>(p_object), method, p_args); #else @@ -380,7 +380,7 @@ public: } #endif - virtual Variant call(Object *p_object, const Variant **p_args, int p_arg_count, Callable::CallError &r_error) override { + virtual Variant call(Object *p_object, const Variant **p_args, int p_arg_count, Callable::CallError &r_error) const override { #ifdef TYPED_METHOD_BIND call_with_variant_argsc_dv(static_cast<T *>(p_object), method, p_args, p_arg_count, r_error, get_default_arguments()); #else @@ -389,7 +389,7 @@ public: return Variant(); } - virtual void ptrcall(Object *p_object, const void **p_args, void *r_ret) override { + virtual void ptrcall(Object *p_object, const void **p_args, void *r_ret) const override { #ifdef TYPED_METHOD_BIND call_with_ptr_argsc<T, P...>(static_cast<T *>(p_object), method, p_args); #else @@ -457,7 +457,7 @@ public: } #endif - virtual Variant call(Object *p_object, const Variant **p_args, int p_arg_count, Callable::CallError &r_error) override { + virtual Variant call(Object *p_object, const Variant **p_args, int p_arg_count, Callable::CallError &r_error) const override { Variant ret; #ifdef TYPED_METHOD_BIND call_with_variant_args_ret_dv(static_cast<T *>(p_object), method, p_args, p_arg_count, ret, r_error, get_default_arguments()); @@ -467,7 +467,7 @@ public: return ret; } - virtual void ptrcall(Object *p_object, const void **p_args, void *r_ret) override { + virtual void ptrcall(Object *p_object, const void **p_args, void *r_ret) const override { #ifdef TYPED_METHOD_BIND call_with_ptr_args_ret<T, R, P...>(static_cast<T *>(p_object), method, p_args, r_ret); #else @@ -536,7 +536,7 @@ public: } #endif - virtual Variant call(Object *p_object, const Variant **p_args, int p_arg_count, Callable::CallError &r_error) override { + virtual Variant call(Object *p_object, const Variant **p_args, int p_arg_count, Callable::CallError &r_error) const override { Variant ret; #ifdef TYPED_METHOD_BIND call_with_variant_args_retc_dv(static_cast<T *>(p_object), method, p_args, p_arg_count, ret, r_error, get_default_arguments()); @@ -546,7 +546,7 @@ public: return ret; } - virtual void ptrcall(Object *p_object, const void **p_args, void *r_ret) override { + virtual void ptrcall(Object *p_object, const void **p_args, void *r_ret) const override { #ifdef TYPED_METHOD_BIND call_with_ptr_args_retc<T, R, P...>(static_cast<T *>(p_object), method, p_args, r_ret); #else @@ -604,13 +604,13 @@ public: } #endif - virtual Variant call(Object *p_object, const Variant **p_args, int p_arg_count, Callable::CallError &r_error) override { + virtual Variant call(Object *p_object, const Variant **p_args, int p_arg_count, Callable::CallError &r_error) const override { (void)p_object; // unused call_with_variant_args_static_dv(function, p_args, p_arg_count, r_error, get_default_arguments()); return Variant(); } - virtual void ptrcall(Object *p_object, const void **p_args, void *r_ret) override { + virtual void ptrcall(Object *p_object, const void **p_args, void *r_ret) const override { (void)p_object; (void)r_ret; call_with_ptr_args_static_method(function, p_args); @@ -667,13 +667,13 @@ public: } #endif - virtual Variant call(Object *p_object, const Variant **p_args, int p_arg_count, Callable::CallError &r_error) override { + virtual Variant call(Object *p_object, const Variant **p_args, int p_arg_count, Callable::CallError &r_error) const override { Variant ret; call_with_variant_args_static_ret_dv(function, p_args, p_arg_count, ret, r_error, get_default_arguments()); return ret; } - virtual void ptrcall(Object *p_object, const void **p_args, void *r_ret) override { + virtual void ptrcall(Object *p_object, const void **p_args, void *r_ret) const override { (void)p_object; call_with_ptr_args_static_method_ret(function, p_args, r_ret); } diff --git a/core/object/object.cpp b/core/object/object.cpp index d27e0d7621..105f9560d6 100644 --- a/core/object/object.cpp +++ b/core/object/object.cpp @@ -1473,6 +1473,8 @@ void Object::_bind_methods() { ClassDB::bind_method(D_METHOD("get_indexed", "property_path"), &Object::_get_indexed_bind); ClassDB::bind_method(D_METHOD("get_property_list"), &Object::_get_property_list_bind); ClassDB::bind_method(D_METHOD("get_method_list"), &Object::_get_method_list_bind); + ClassDB::bind_method(D_METHOD("property_can_revert", "property"), &Object::property_can_revert); + ClassDB::bind_method(D_METHOD("property_get_revert", "property"), &Object::property_get_revert); ClassDB::bind_method(D_METHOD("notification", "what", "reversed"), &Object::notification, DEFVAL(false)); ClassDB::bind_method(D_METHOD("to_string"), &Object::to_string); ClassDB::bind_method(D_METHOD("get_instance_id"), &Object::get_instance_id); diff --git a/core/object/object.h b/core/object/object.h index 9416eb7762..3ad8391dd6 100644 --- a/core/object/object.h +++ b/core/object/object.h @@ -113,22 +113,21 @@ enum PropertyUsageFlags { PROPERTY_USAGE_RESTART_IF_CHANGED = 1 << 11, PROPERTY_USAGE_SCRIPT_VARIABLE = 1 << 12, PROPERTY_USAGE_STORE_IF_NULL = 1 << 13, - PROPERTY_USAGE_ANIMATE_AS_TRIGGER = 1 << 14, - PROPERTY_USAGE_UPDATE_ALL_IF_MODIFIED = 1 << 15, - PROPERTY_USAGE_SCRIPT_DEFAULT_VALUE = 1 << 16, - PROPERTY_USAGE_CLASS_IS_ENUM = 1 << 17, - PROPERTY_USAGE_NIL_IS_VARIANT = 1 << 18, - PROPERTY_USAGE_INTERNAL = 1 << 19, - PROPERTY_USAGE_DO_NOT_SHARE_ON_DUPLICATE = 1 << 20, // If the object is duplicated also this property will be duplicated. - PROPERTY_USAGE_HIGH_END_GFX = 1 << 21, - PROPERTY_USAGE_NODE_PATH_FROM_SCENE_ROOT = 1 << 22, - PROPERTY_USAGE_RESOURCE_NOT_PERSISTENT = 1 << 23, - PROPERTY_USAGE_KEYING_INCREMENTS = 1 << 24, // Used in inspector to increment property when keyed in animation player. - PROPERTY_USAGE_DEFERRED_SET_RESOURCE = 1 << 25, // when loading, the resource for this property can be set at the end of loading. - PROPERTY_USAGE_EDITOR_INSTANTIATE_OBJECT = 1 << 26, // For Object properties, instantiate them when creating in editor. - PROPERTY_USAGE_EDITOR_BASIC_SETTING = 1 << 27, //for project or editor settings, show when basic settings are selected. - PROPERTY_USAGE_READ_ONLY = 1 << 28, // Mark a property as read-only in the inspector. - PROPERTY_USAGE_ARRAY = 1 << 29, // Used in the inspector to group properties as elements of an array. + PROPERTY_USAGE_UPDATE_ALL_IF_MODIFIED = 1 << 14, + PROPERTY_USAGE_SCRIPT_DEFAULT_VALUE = 1 << 15, + PROPERTY_USAGE_CLASS_IS_ENUM = 1 << 16, + PROPERTY_USAGE_NIL_IS_VARIANT = 1 << 17, + PROPERTY_USAGE_INTERNAL = 1 << 18, + PROPERTY_USAGE_DO_NOT_SHARE_ON_DUPLICATE = 1 << 19, // If the object is duplicated also this property will be duplicated. + PROPERTY_USAGE_HIGH_END_GFX = 1 << 20, + PROPERTY_USAGE_NODE_PATH_FROM_SCENE_ROOT = 1 << 21, + PROPERTY_USAGE_RESOURCE_NOT_PERSISTENT = 1 << 22, + PROPERTY_USAGE_KEYING_INCREMENTS = 1 << 23, // Used in inspector to increment property when keyed in animation player. + PROPERTY_USAGE_DEFERRED_SET_RESOURCE = 1 << 24, // when loading, the resource for this property can be set at the end of loading. + PROPERTY_USAGE_EDITOR_INSTANTIATE_OBJECT = 1 << 25, // For Object properties, instantiate them when creating in editor. + PROPERTY_USAGE_EDITOR_BASIC_SETTING = 1 << 26, //for project or editor settings, show when basic settings are selected. + PROPERTY_USAGE_READ_ONLY = 1 << 27, // Mark a property as read-only in the inspector. + PROPERTY_USAGE_ARRAY = 1 << 28, // Used in the inspector to group properties as elements of an array. PROPERTY_USAGE_DEFAULT = PROPERTY_USAGE_STORAGE | PROPERTY_USAGE_EDITOR, PROPERTY_USAGE_DEFAULT_INTL = PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_INTERNATIONALIZED, diff --git a/core/object/script_language_extension.h b/core/object/script_language_extension.h index 9a2a176096..5262c41644 100644 --- a/core/object/script_language_extension.h +++ b/core/object/script_language_extension.h @@ -650,13 +650,13 @@ public: virtual bool set(const StringName &p_name, const Variant &p_value) override { if (native_info->set_func) { - return native_info->set_func(instance, (const GDNativeStringNamePtr)&p_name, (const GDNativeVariantPtr)&p_value); + return native_info->set_func(instance, (GDNativeConstStringNamePtr)&p_name, (GDNativeConstVariantPtr)&p_value); } return false; } virtual bool get(const StringName &p_name, Variant &r_ret) const override { if (native_info->get_func) { - return native_info->get_func(instance, (const GDNativeStringNamePtr)&p_name, (GDNativeVariantPtr)&r_ret); + return native_info->get_func(instance, (GDNativeConstStringNamePtr)&p_name, (GDNativeVariantPtr)&r_ret); } return false; } @@ -683,7 +683,7 @@ public: virtual Variant::Type get_property_type(const StringName &p_name, bool *r_is_valid = nullptr) const override { if (native_info->get_property_type_func) { GDNativeBool is_valid = 0; - GDNativeVariantType type = native_info->get_property_type_func(instance, (const GDNativeStringNamePtr)&p_name, &is_valid); + GDNativeVariantType type = native_info->get_property_type_func(instance, (GDNativeConstStringNamePtr)&p_name, &is_valid); if (r_is_valid) { *r_is_valid = is_valid != 0; } @@ -694,13 +694,13 @@ public: virtual bool property_can_revert(const StringName &p_name) const override { if (native_info->property_can_revert_func) { - return native_info->property_can_revert_func(instance, (const GDNativeStringNamePtr)&p_name); + return native_info->property_can_revert_func(instance, (GDNativeConstStringNamePtr)&p_name); } return false; } virtual bool property_get_revert(const StringName &p_name, Variant &r_ret) const override { if (native_info->property_get_revert_func) { - return native_info->property_get_revert_func(instance, (const GDNativeStringNamePtr)&p_name, (GDNativeVariantPtr)&r_ret); + return native_info->property_get_revert_func(instance, (GDNativeConstStringNamePtr)&p_name, (GDNativeVariantPtr)&r_ret); } return false; } @@ -711,7 +711,7 @@ public: } return nullptr; } - static void _add_property_with_state(const GDNativeStringNamePtr p_name, const GDNativeVariantPtr p_value, void *p_userdata) { + static void _add_property_with_state(GDNativeConstStringNamePtr p_name, GDNativeConstVariantPtr p_value, void *p_userdata) { List<Pair<StringName, Variant>> *state = (List<Pair<StringName, Variant>> *)p_userdata; state->push_back(Pair<StringName, Variant>(*(const StringName *)p_name, *(const Variant *)p_value)); } @@ -744,7 +744,7 @@ public: Variant ret; if (native_info->call_func) { GDNativeCallError ce; - native_info->call_func(instance, (const GDNativeStringNamePtr)&p_method, (const GDNativeVariantPtr *)p_args, p_argcount, (GDNativeVariantPtr)&ret, &ce); + native_info->call_func(instance, (GDNativeConstStringNamePtr)&p_method, (GDNativeConstVariantPtr *)p_args, p_argcount, (GDNativeVariantPtr)&ret, &ce); r_error.error = Callable::CallError::Error(ce.error); r_error.argument = ce.argument; r_error.expected = ce.expected; @@ -799,7 +799,7 @@ public: virtual void property_set_fallback(const StringName &p_name, const Variant &p_value, bool *r_valid) override { if (native_info->set_fallback_func) { - bool ret = native_info->set_fallback_func(instance, (const GDNativeStringNamePtr)&p_name, (const GDNativeVariantPtr)&p_value); + bool ret = native_info->set_fallback_func(instance, (GDNativeConstStringNamePtr)&p_name, (GDNativeConstVariantPtr)&p_value); if (r_valid) { *r_valid = ret; } @@ -808,7 +808,7 @@ public: virtual Variant property_get_fallback(const StringName &p_name, bool *r_valid) override { Variant ret; if (native_info->get_fallback_func) { - bool valid = native_info->get_fallback_func(instance, (const GDNativeStringNamePtr)&p_name, (GDNativeVariantPtr)&ret); + bool valid = native_info->get_fallback_func(instance, (GDNativeConstStringNamePtr)&p_name, (GDNativeVariantPtr)&ret); if (r_valid) { *r_valid = valid; } diff --git a/core/object/worker_thread_pool.cpp b/core/object/worker_thread_pool.cpp index 9b3dc6833e..0218a4c8f6 100644 --- a/core/object/worker_thread_pool.cpp +++ b/core/object/worker_thread_pool.cpp @@ -402,7 +402,9 @@ void WorkerThreadPool::wait_for_group_task_completion(GroupID p_group) { } } - groups.erase(p_group); // Threads do not access this, so safe to erase here. + task_mutex.lock(); // This mutex is needed when Physics 2D and/or 3D is selected to run on a separate thread. + groups.erase(p_group); + task_mutex.unlock(); } void WorkerThreadPool::init(int p_thread_count, bool p_use_native_threads_low_priority, float p_low_priority_task_ratio) { diff --git a/core/os/os.h b/core/os/os.h index af7b40f3ec..72a91f318a 100644 --- a/core/os/os.h +++ b/core/os/os.h @@ -150,7 +150,8 @@ public: virtual int get_low_processor_usage_mode_sleep_usec() const; virtual Vector<String> get_system_fonts() const { return Vector<String>(); }; - virtual String get_system_font_path(const String &p_font_name, bool p_bold = false, bool p_italic = false) const { return String(); }; + virtual String get_system_font_path(const String &p_font_name, int p_weight = 400, int p_stretch = 100, bool p_italic = false) const { return String(); }; + virtual Vector<String> get_system_font_path_for_text(const String &p_font_name, const String &p_text, const String &p_locale = String(), const String &p_script = String(), int p_weight = 400, int p_stretch = 100, bool p_italic = false) const { return Vector<String>(); }; virtual String get_executable_path() const; virtual Error execute(const String &p_path, const List<String> &p_arguments, String *r_pipe = nullptr, int *r_exitcode = nullptr, bool read_stderr = false, Mutex *p_pipe_mutex = nullptr, bool p_open_console = false) = 0; virtual Error create_process(const String &p_path, const List<String> &p_arguments, ProcessID *r_child_id = nullptr, bool p_open_console = false) = 0; diff --git a/core/variant/variant_op.h b/core/variant/variant_op.h index ec1ce67445..34858540ec 100644 --- a/core/variant/variant_op.h +++ b/core/variant/variant_op.h @@ -890,10 +890,12 @@ public: static void evaluate(const Variant &p_left, const Variant &p_right, Variant *r_ret, bool &r_valid) { const String &a = *VariantGetInternalPtr<String>::get_ptr(&p_left); *r_ret = do_mod(a, &r_valid); - r_valid = true; } static inline void validated_evaluate(const Variant *left, const Variant *right, Variant *r_ret) { - *VariantGetInternalPtr<String>::get_ptr(r_ret) = do_mod(*VariantGetInternalPtr<String>::get_ptr(left), nullptr); + bool valid = true; + String result = do_mod(*VariantGetInternalPtr<String>::get_ptr(left), &valid); + ERR_FAIL_COND_MSG(!valid, result); + *VariantGetInternalPtr<String>::get_ptr(r_ret) = result; } static void ptr_evaluate(const void *left, const void *right, void *r_ret) { PtrToArg<String>::encode(do_mod(PtrToArg<String>::convert(left), nullptr), r_ret); @@ -913,10 +915,12 @@ public: static void evaluate(const Variant &p_left, const Variant &p_right, Variant *r_ret, bool &r_valid) { const String &a = *VariantGetInternalPtr<String>::get_ptr(&p_left); *r_ret = do_mod(a, *VariantGetInternalPtr<Array>::get_ptr(&p_right), &r_valid); - r_valid = true; } static inline void validated_evaluate(const Variant *left, const Variant *right, Variant *r_ret) { - *VariantGetInternalPtr<String>::get_ptr(r_ret) = do_mod(*VariantGetInternalPtr<String>::get_ptr(left), *VariantGetInternalPtr<Array>::get_ptr(right), nullptr); + bool valid = true; + String result = do_mod(*VariantGetInternalPtr<String>::get_ptr(left), *VariantGetInternalPtr<Array>::get_ptr(right), &valid); + ERR_FAIL_COND_MSG(!valid, result); + *VariantGetInternalPtr<String>::get_ptr(r_ret) = result; } static void ptr_evaluate(const void *left, const void *right, void *r_ret) { PtrToArg<String>::encode(do_mod(PtrToArg<String>::convert(left), PtrToArg<Array>::convert(right), nullptr), r_ret); @@ -939,10 +943,12 @@ public: static void evaluate(const Variant &p_left, const Variant &p_right, Variant *r_ret, bool &r_valid) { const String &a = *VariantGetInternalPtr<String>::get_ptr(&p_left); *r_ret = do_mod(a, p_right.get_validated_object(), &r_valid); - r_valid = true; } static inline void validated_evaluate(const Variant *left, const Variant *right, Variant *r_ret) { - *VariantGetInternalPtr<String>::get_ptr(r_ret) = do_mod(*VariantGetInternalPtr<String>::get_ptr(left), right->get_validated_object(), nullptr); + bool valid = true; + String result = do_mod(*VariantGetInternalPtr<String>::get_ptr(left), right->get_validated_object(), &valid); + ERR_FAIL_COND_MSG(!valid, result); + *VariantGetInternalPtr<String>::get_ptr(r_ret) = result; } static void ptr_evaluate(const void *left, const void *right, void *r_ret) { PtrToArg<String>::encode(do_mod(PtrToArg<String>::convert(left), PtrToArg<Object *>::convert(right), nullptr), r_ret); @@ -965,10 +971,12 @@ public: static void evaluate(const Variant &p_left, const Variant &p_right, Variant *r_ret, bool &r_valid) { const String &a = *VariantGetInternalPtr<String>::get_ptr(&p_left); *r_ret = do_mod(a, *VariantGetInternalPtr<T>::get_ptr(&p_right), &r_valid); - r_valid = true; } static inline void validated_evaluate(const Variant *left, const Variant *right, Variant *r_ret) { - *VariantGetInternalPtr<String>::get_ptr(r_ret) = do_mod(*VariantGetInternalPtr<String>::get_ptr(left), *VariantGetInternalPtr<T>::get_ptr(right), nullptr); + bool valid = true; + String result = do_mod(*VariantGetInternalPtr<String>::get_ptr(left), *VariantGetInternalPtr<T>::get_ptr(right), &valid); + ERR_FAIL_COND_MSG(!valid, result); + *VariantGetInternalPtr<String>::get_ptr(r_ret) = result; } static void ptr_evaluate(const void *left, const void *right, void *r_ret) { PtrToArg<String>::encode(do_mod(PtrToArg<String>::convert(left), PtrToArg<T>::convert(right), nullptr), r_ret); diff --git a/core/variant/variant_parser.cpp b/core/variant/variant_parser.cpp index d2e4d752a4..9f500dbf5e 100644 --- a/core/variant/variant_parser.cpp +++ b/core/variant/variant_parser.cpp @@ -35,37 +35,76 @@ #include "core/os/keyboard.h" #include "core/string/string_buffer.h" -char32_t VariantParser::StreamFile::get_char() { - return f->get_8(); +char32_t VariantParser::Stream::get_char() { + // is within buffer? + if (readahead_pointer < readahead_filled) { + return readahead_buffer[readahead_pointer++]; + } + + // attempt to readahead + readahead_filled = _read_buffer(readahead_buffer, READAHEAD_SIZE); + if (readahead_filled) { + readahead_pointer = 0; + } else { + // EOF + readahead_pointer = 1; + eof = true; + return 0; + } + return get_char(); } bool VariantParser::StreamFile::is_utf8() const { return true; } -bool VariantParser::StreamFile::is_eof() const { - return f->eof_reached(); -} +uint32_t VariantParser::StreamFile::_read_buffer(char32_t *p_buffer, uint32_t p_num_chars) { + // The buffer is assumed to include at least one character (for null terminator) + ERR_FAIL_COND_V(!p_num_chars, 0); -char32_t VariantParser::StreamString::get_char() { - if (pos > s.length()) { - return 0; - } else if (pos == s.length()) { - // You need to try to read again when you have reached the end for EOF to be reported, - // so this works the same as files (like StreamFile does) - pos++; - return 0; - } else { - return s[pos++]; + uint8_t *temp = (uint8_t *)alloca(p_num_chars); + uint64_t num_read = f->get_buffer(temp, p_num_chars); + ERR_FAIL_COND_V(num_read == UINT64_MAX, 0); + + // translate to wchar + for (uint32_t n = 0; n < num_read; n++) { + p_buffer[n] = temp[n]; } + + // could be less than p_num_chars, or zero + return num_read; } bool VariantParser::StreamString::is_utf8() const { return false; } -bool VariantParser::StreamString::is_eof() const { - return pos > s.length(); +uint32_t VariantParser::StreamString::_read_buffer(char32_t *p_buffer, uint32_t p_num_chars) { + // The buffer is assumed to include at least one character (for null terminator) + ERR_FAIL_COND_V(!p_num_chars, 0); + + int available = MAX(s.length() - pos, 0); + if (available >= (int)p_num_chars) { + const char32_t *src = s.ptr(); + src += pos; + memcpy(p_buffer, src, p_num_chars * sizeof(char32_t)); + pos += p_num_chars; + + return p_num_chars; + } + + // going to reach EOF + if (available) { + const char32_t *src = s.ptr(); + src += pos; + memcpy(p_buffer, src, available * sizeof(char32_t)); + pos += available; + } + + // add a zero + p_buffer[available] = 0; + + return available; } ///////////////////////////////////////////////////////////////////////////////////////////////// @@ -1283,7 +1322,7 @@ Error VariantParser::_parse_dictionary(Dictionary &object, Stream *p_stream, int Variant v; err = parse_value(token, v, p_stream, line, r_err_str, p_res_parser); - if (err) { + if (err && err != ERR_FILE_MISSING_DEPENDENCIES) { return err; } object[key] = v; diff --git a/core/variant/variant_parser.h b/core/variant/variant_parser.h index 56b484c8bc..6b1d095ab5 100644 --- a/core/variant/variant_parser.h +++ b/core/variant/variant_parser.h @@ -38,34 +38,50 @@ class VariantParser { public: struct Stream { - virtual char32_t get_char() = 0; - virtual bool is_utf8() const = 0; - virtual bool is_eof() const = 0; + private: + enum { READAHEAD_SIZE = 2048 }; + char32_t readahead_buffer[READAHEAD_SIZE]; + uint32_t readahead_pointer = 0; + uint32_t readahead_filled = 0; + bool eof = false; + + protected: + virtual uint32_t _read_buffer(char32_t *p_buffer, uint32_t p_num_chars) = 0; + public: char32_t saved = 0; + char32_t get_char(); + virtual bool is_utf8() const = 0; + bool is_eof() const { return eof; } + Stream() {} virtual ~Stream() {} }; struct StreamFile : public Stream { + protected: + virtual uint32_t _read_buffer(char32_t *p_buffer, uint32_t p_num_chars) override; + + public: Ref<FileAccess> f; - virtual char32_t get_char() override; virtual bool is_utf8() const override; - virtual bool is_eof() const override; StreamFile() {} }; struct StreamString : public Stream { String s; + + private: int pos = 0; - virtual char32_t get_char() override; - virtual bool is_utf8() const override; - virtual bool is_eof() const override; + protected: + virtual uint32_t _read_buffer(char32_t *p_buffer, uint32_t p_num_chars) override; + public: + virtual bool is_utf8() const override; StreamString() {} }; diff --git a/doc/classes/@GlobalScope.xml b/doc/classes/@GlobalScope.xml index 33afe38446..4a6b85f229 100644 --- a/doc/classes/@GlobalScope.xml +++ b/doc/classes/@GlobalScope.xml @@ -115,7 +115,7 @@ <param index="3" name="end" type="float" /> <param index="4" name="t" type="float" /> <description> - Returns the derivative at the given [param t] on a one-dimensional [url=https://en.wikipedia.org/wiki/B%C3%A9zier_curve]Bezier curve[/url] defined by the given [param control_1], [param control_2], and [param end] points. + Returns the derivative at the given [param t] on a one-dimensional [url=https://en.wikipedia.org/wiki/B%C3%A9zier_curve]Bézier curve[/url] defined by the given [param control_1], [param control_2], and [param end] points. </description> </method> <method name="bezier_interpolate"> @@ -126,7 +126,7 @@ <param index="3" name="end" type="float" /> <param index="4" name="t" type="float" /> <description> - Returns the point at the given [param t] on a one-dimensional [url=https://en.wikipedia.org/wiki/B%C3%A9zier_curve]Bezier curve[/url] defined by the given [param control_1], [param control_2], and [param end] points. + Returns the point at the given [param t] on a one-dimensional [url=https://en.wikipedia.org/wiki/B%C3%A9zier_curve]Bézier curve[/url] defined by the given [param control_1], [param control_2], and [param end] points. </description> </method> <method name="bytes_to_var"> @@ -2877,40 +2877,38 @@ </constant> <constant name="PROPERTY_USAGE_STORE_IF_NULL" value="8192" enum="PropertyUsageFlags"> </constant> - <constant name="PROPERTY_USAGE_ANIMATE_AS_TRIGGER" value="16384" enum="PropertyUsageFlags"> + <constant name="PROPERTY_USAGE_UPDATE_ALL_IF_MODIFIED" value="16384" enum="PropertyUsageFlags"> </constant> - <constant name="PROPERTY_USAGE_UPDATE_ALL_IF_MODIFIED" value="32768" enum="PropertyUsageFlags"> + <constant name="PROPERTY_USAGE_SCRIPT_DEFAULT_VALUE" value="32768" enum="PropertyUsageFlags"> </constant> - <constant name="PROPERTY_USAGE_SCRIPT_DEFAULT_VALUE" value="65536" enum="PropertyUsageFlags"> + <constant name="PROPERTY_USAGE_CLASS_IS_ENUM" value="65536" enum="PropertyUsageFlags"> </constant> - <constant name="PROPERTY_USAGE_CLASS_IS_ENUM" value="131072" enum="PropertyUsageFlags"> + <constant name="PROPERTY_USAGE_NIL_IS_VARIANT" value="131072" enum="PropertyUsageFlags"> </constant> - <constant name="PROPERTY_USAGE_NIL_IS_VARIANT" value="262144" enum="PropertyUsageFlags"> + <constant name="PROPERTY_USAGE_INTERNAL" value="262144" enum="PropertyUsageFlags"> </constant> - <constant name="PROPERTY_USAGE_INTERNAL" value="524288" enum="PropertyUsageFlags"> - </constant> - <constant name="PROPERTY_USAGE_DO_NOT_SHARE_ON_DUPLICATE" value="1048576" enum="PropertyUsageFlags"> + <constant name="PROPERTY_USAGE_DO_NOT_SHARE_ON_DUPLICATE" value="524288" enum="PropertyUsageFlags"> If the property is a [Resource], a new copy of it is always created when calling [method Node.duplicate] or [method Resource.duplicate]. </constant> - <constant name="PROPERTY_USAGE_HIGH_END_GFX" value="2097152" enum="PropertyUsageFlags"> + <constant name="PROPERTY_USAGE_HIGH_END_GFX" value="1048576" enum="PropertyUsageFlags"> The property is only shown in the editor if modern renderers are supported (GLES3 is excluded). </constant> - <constant name="PROPERTY_USAGE_NODE_PATH_FROM_SCENE_ROOT" value="4194304" enum="PropertyUsageFlags"> + <constant name="PROPERTY_USAGE_NODE_PATH_FROM_SCENE_ROOT" value="2097152" enum="PropertyUsageFlags"> </constant> - <constant name="PROPERTY_USAGE_RESOURCE_NOT_PERSISTENT" value="8388608" enum="PropertyUsageFlags"> + <constant name="PROPERTY_USAGE_RESOURCE_NOT_PERSISTENT" value="4194304" enum="PropertyUsageFlags"> </constant> - <constant name="PROPERTY_USAGE_KEYING_INCREMENTS" value="16777216" enum="PropertyUsageFlags"> + <constant name="PROPERTY_USAGE_KEYING_INCREMENTS" value="8388608" enum="PropertyUsageFlags"> </constant> - <constant name="PROPERTY_USAGE_DEFERRED_SET_RESOURCE" value="33554432" enum="PropertyUsageFlags"> + <constant name="PROPERTY_USAGE_DEFERRED_SET_RESOURCE" value="16777216" enum="PropertyUsageFlags"> </constant> - <constant name="PROPERTY_USAGE_EDITOR_INSTANTIATE_OBJECT" value="67108864" enum="PropertyUsageFlags"> + <constant name="PROPERTY_USAGE_EDITOR_INSTANTIATE_OBJECT" value="33554432" enum="PropertyUsageFlags"> </constant> - <constant name="PROPERTY_USAGE_EDITOR_BASIC_SETTING" value="134217728" enum="PropertyUsageFlags"> + <constant name="PROPERTY_USAGE_EDITOR_BASIC_SETTING" value="67108864" enum="PropertyUsageFlags"> </constant> - <constant name="PROPERTY_USAGE_READ_ONLY" value="268435456" enum="PropertyUsageFlags"> + <constant name="PROPERTY_USAGE_READ_ONLY" value="134217728" enum="PropertyUsageFlags"> The property is read-only in the [EditorInspector]. </constant> - <constant name="PROPERTY_USAGE_ARRAY" value="536870912" enum="PropertyUsageFlags"> + <constant name="PROPERTY_USAGE_ARRAY" value="268435456" enum="PropertyUsageFlags"> The property is an array. </constant> <constant name="PROPERTY_USAGE_DEFAULT" value="6" enum="PropertyUsageFlags"> diff --git a/doc/classes/Animation.xml b/doc/classes/Animation.xml index af8d9c416f..d9a1f896f1 100644 --- a/doc/classes/Animation.xml +++ b/doc/classes/Animation.xml @@ -251,15 +251,6 @@ Returns the amount of tracks in the animation. </description> </method> - <method name="method_track_get_key_indices" qualifiers="const"> - <return type="PackedInt32Array" /> - <param index="0" name="track_idx" type="int" /> - <param index="1" name="time_sec" type="float" /> - <param index="2" name="delta" type="float" /> - <description> - Returns all the key indices of a method track, given a position and delta time. - </description> - </method> <method name="method_track_get_name" qualifiers="const"> <return type="StringName" /> <param index="0" name="track_idx" type="int" /> @@ -523,15 +514,6 @@ Swaps the track [param track_idx]'s index position with the track [param with_idx]. </description> </method> - <method name="value_track_get_key_indices" qualifiers="const"> - <return type="PackedInt32Array" /> - <param index="0" name="track_idx" type="int" /> - <param index="1" name="time_sec" type="float" /> - <param index="2" name="delta" type="float" /> - <description> - Returns all the key indices of a value track, given a position and delta time. - </description> - </method> <method name="value_track_get_update_mode" qualifiers="const"> <return type="int" enum="Animation.UpdateMode" /> <param index="0" name="track_idx" type="int" /> @@ -614,15 +596,12 @@ [b]Note:[/b] The result value is always normalized and may not match the key value. </constant> <constant name="UPDATE_CONTINUOUS" value="0" enum="UpdateMode"> - Update between keyframes. + Update between keyframes and hold the value. </constant> <constant name="UPDATE_DISCRETE" value="1" enum="UpdateMode"> - Update at the keyframes and hold the value. - </constant> - <constant name="UPDATE_TRIGGER" value="2" enum="UpdateMode"> Update at the keyframes. </constant> - <constant name="UPDATE_CAPTURE" value="3" enum="UpdateMode"> + <constant name="UPDATE_CAPTURE" value="2" enum="UpdateMode"> Same as linear interpolation, but also interpolates from the current value (i.e. dynamically at runtime) if the first key isn't at 0 seconds. </constant> <constant name="LOOP_NONE" value="0" enum="LoopMode"> @@ -634,5 +613,14 @@ <constant name="LOOP_PINGPONG" value="2" enum="LoopMode"> Repeats playback and reverse playback at both ends of the animation. </constant> + <constant name="LOOPED_FLAG_NONE" value="0" enum="LoopedFlag"> + This flag indicates that the animation proceeds without any looping. + </constant> + <constant name="LOOPED_FLAG_END" value="1" enum="LoopedFlag"> + This flag indicates that the animation has reached the end of the animation and just after loop processed. + </constant> + <constant name="LOOPED_FLAG_START" value="2" enum="LoopedFlag"> + This flag indicates that the animation has reached the start of the animation and just after loop processed. + </constant> </constants> </class> diff --git a/doc/classes/AnimationLibrary.xml b/doc/classes/AnimationLibrary.xml index 769b338063..9be4cda5d6 100644 --- a/doc/classes/AnimationLibrary.xml +++ b/doc/classes/AnimationLibrary.xml @@ -65,6 +65,13 @@ Emitted when an [Animation] is added, under the key [param name]. </description> </signal> + <signal name="animation_changed"> + <param index="0" name="name" type="StringName" /> + <description> + Emitted when there's a change in one of the animations, e.g. tracks are added, moved or have changed paths. [param name] is the key of the animation that was changed. + See also [signal Resource.changed], which this acts as a relay for. + </description> + </signal> <signal name="animation_removed"> <param index="0" name="name" type="StringName" /> <description> diff --git a/doc/classes/AnimationNode.xml b/doc/classes/AnimationNode.xml index b856b5f208..79deb008d2 100644 --- a/doc/classes/AnimationNode.xml +++ b/doc/classes/AnimationNode.xml @@ -53,7 +53,7 @@ <return type="float" /> <param index="0" name="time" type="float" /> <param index="1" name="seek" type="bool" /> - <param index="2" name="seek_root" type="bool" /> + <param index="2" name="is_external_seeking" type="bool" /> <description> When inheriting from [AnimationRootNode], implement this virtual method to run some code when this node is processed. The [param time] parameter is a relative delta, unless [param seek] is [code]true[/code], in which case it is absolute. Here, call the [method blend_input], [method blend_node] or [method blend_animation] functions. You can also use [method get_parameter] and [method set_parameter] to modify local memory. @@ -73,11 +73,12 @@ <param index="1" name="time" type="float" /> <param index="2" name="delta" type="float" /> <param index="3" name="seeked" type="bool" /> - <param index="4" name="seek_root" type="bool" /> + <param index="4" name="is_external_seeking" type="bool" /> <param index="5" name="blend" type="float" /> - <param index="6" name="pingponged" type="int" default="0" /> + <param index="6" name="looped_flag" type="int" enum="Animation.LoopedFlag" default="0" /> <description> Blend an animation by [param blend] amount (name must be valid in the linked [AnimationPlayer]). A [param time] and [param delta] may be passed, as well as whether [param seeked] happened. + A [param looped_flag] is used by internal processing immediately after the loop. See also [enum Animation.LoopedFlag]. </description> </method> <method name="blend_input"> @@ -85,7 +86,7 @@ <param index="0" name="input_index" type="int" /> <param index="1" name="time" type="float" /> <param index="2" name="seek" type="bool" /> - <param index="3" name="seek_root" type="bool" /> + <param index="3" name="is_external_seeking" type="bool" /> <param index="4" name="blend" type="float" /> <param index="5" name="filter" type="int" enum="AnimationNode.FilterAction" default="0" /> <param index="6" name="sync" type="bool" default="true" /> @@ -99,7 +100,7 @@ <param index="1" name="node" type="AnimationNode" /> <param index="2" name="time" type="float" /> <param index="3" name="seek" type="bool" /> - <param index="4" name="seek_root" type="bool" /> + <param index="4" name="is_external_seeking" type="bool" /> <param index="5" name="blend" type="float" /> <param index="6" name="filter" type="int" enum="AnimationNode.FilterAction" default="0" /> <param index="7" name="sync" type="bool" default="true" /> diff --git a/doc/classes/AnimationTree.xml b/doc/classes/AnimationTree.xml index 27797b00b5..21f4b37741 100644 --- a/doc/classes/AnimationTree.xml +++ b/doc/classes/AnimationTree.xml @@ -19,10 +19,66 @@ Manually advance the animations by the specified time (in seconds). </description> </method> - <method name="get_root_motion_transform" qualifiers="const"> - <return type="Transform3D" /> + <method name="get_root_motion_position" qualifiers="const"> + <return type="Vector3" /> <description> - Retrieve the motion of the [member root_motion_track] as a [Transform3D] that can be used elsewhere. If [member root_motion_track] is not a path to a track of type [constant Animation.TYPE_POSITION_3D], [constant Animation.TYPE_SCALE_3D] or [constant Animation.TYPE_ROTATION_3D], returns an identity transformation. See also [member root_motion_track] and [RootMotionView]. + Retrieve the motion of position with the [member root_motion_track] as a [Vector3] that can be used elsewhere. + If [member root_motion_track] is not a path to a track of type [constant Animation.TYPE_POSITION_3D], returns [code]Vector3(0, 0, 0)[/code]. + See also [member root_motion_track] and [RootMotionView]. + The most basic example is applying position to [CharacterBody3D]: + [codeblocks] + [gdscript] + var current_rotation: Quaternion + + func _process(delta): + if Input.is_action_just_pressed("animate"): + current_rotation = get_quaternion() + state_machine.travel("Animate") + var velocity: Vector3 = current_rotation * animation_tree.get_root_motion_position() / delta + set_velocity(velocity) + move_and_slide() + [/gdscript] + [/codeblocks] + </description> + </method> + <method name="get_root_motion_rotation" qualifiers="const"> + <return type="Quaternion" /> + <description> + Retrieve the motion of rotation with the [member root_motion_track] as a [Quaternion] that can be used elsewhere. + If [member root_motion_track] is not a path to a track of type [constant Animation.TYPE_ROTATION_3D], returns [code]Quaternion(0, 0, 0, 1)[/code]. + See also [member root_motion_track] and [RootMotionView]. + The most basic example is applying rotation to [CharacterBody3D]: + [codeblocks] + [gdscript] + func _process(delta): + if Input.is_action_just_pressed("animate"): + state_machine.travel("Animate") + set_quaternion(get_quaternion() * animation_tree.get_root_motion_rotation()) + [/gdscript] + [/codeblocks] + </description> + </method> + <method name="get_root_motion_scale" qualifiers="const"> + <return type="Vector3" /> + <description> + Retrieve the motion of scale with the [member root_motion_track] as a [Vector3] that can be used elsewhere. + If [member root_motion_track] is not a path to a track of type [constant Animation.TYPE_SCALE_3D], returns [code]Vector3(0, 0, 0)[/code]. + See also [member root_motion_track] and [RootMotionView]. + The most basic example is applying scale to [CharacterBody3D]: + [codeblocks] + [gdscript] + var current_scale: Vector3 = Vector3(1, 1, 1) + var scale_accum: Vector3 = Vector3(1, 1, 1) + + func _process(delta): + if Input.is_action_just_pressed("animate"): + current_scale = get_scale() + scale_accum = Vector3(1, 1, 1) + state_machine.travel("Animate") + scale_accum += animation_tree.get_root_motion_scale() + set_scale(current_scale * scale_accum) + [/gdscript] + [/codeblocks] </description> </method> <method name="rename_parameter"> @@ -48,7 +104,7 @@ </member> <member name="root_motion_track" type="NodePath" setter="set_root_motion_track" getter="get_root_motion_track" default="NodePath("")"> The path to the Animation track used for root motion. Paths must be valid scene-tree paths to a node, and must be specified starting from the parent node of the node that will reproduce the animation. To specify a track that controls properties or bones, append its name after the path, separated by [code]":"[/code]. For example, [code]"character/skeleton:ankle"[/code] or [code]"character/mesh:transform/local"[/code]. - If the track has type [constant Animation.TYPE_POSITION_3D], [constant Animation.TYPE_ROTATION_3D] or [constant Animation.TYPE_SCALE_3D] the transformation will be cancelled visually, and the animation will appear to stay in place. See also [method get_root_motion_transform] and [RootMotionView]. + If the track has type [constant Animation.TYPE_POSITION_3D], [constant Animation.TYPE_ROTATION_3D] or [constant Animation.TYPE_SCALE_3D] the transformation will be cancelled visually, and the animation will appear to stay in place. See also [method get_root_motion_position], [method get_root_motion_rotation], [method get_root_motion_scale] and [RootMotionView]. </member> <member name="tree_root" type="AnimationNode" setter="set_tree_root" getter="get_tree_root"> The root animation node of this [AnimationTree]. See [AnimationNode]. diff --git a/doc/classes/BaseMaterial3D.xml b/doc/classes/BaseMaterial3D.xml index fbb31cadcd..8a5048de6b 100644 --- a/doc/classes/BaseMaterial3D.xml +++ b/doc/classes/BaseMaterial3D.xml @@ -319,7 +319,7 @@ Texture that controls the strength of the refraction per-pixel. Multiplied by [member refraction_scale]. </member> <member name="refraction_texture_channel" type="int" setter="set_refraction_texture_channel" getter="get_refraction_texture_channel" enum="BaseMaterial3D.TextureChannel" default="0"> - Specifies the channel of the [member ao_texture] in which the ambient occlusion information is stored. This is useful when you store the information for multiple effects in a single texture. For example if you stored metallic in the red channel, roughness in the blue, and ambient occlusion in the green you could reduce the number of textures you use. + Specifies the channel of the [member refraction_texture] in which the refraction information is stored. This is useful when you store the information for multiple effects in a single texture. For example if you stored refraction in the red channel, roughness in the blue, and ambient occlusion in the green you could reduce the number of textures you use. </member> <member name="rim" type="float" setter="set_rim" getter="get_rim" default="1.0"> Sets the strength of the rim lighting effect. @@ -341,7 +341,7 @@ Texture used to control the roughness per-pixel. Multiplied by [member roughness]. </member> <member name="roughness_texture_channel" type="int" setter="set_roughness_texture_channel" getter="get_roughness_texture_channel" enum="BaseMaterial3D.TextureChannel" default="0"> - Specifies the channel of the [member ao_texture] in which the ambient occlusion information is stored. This is useful when you store the information for multiple effects in a single texture. For example if you stored metallic in the red channel, roughness in the blue, and ambient occlusion in the green you could reduce the number of textures you use. + Specifies the channel of the [member roughness_texture] in which the roughness information is stored. This is useful when you store the information for multiple effects in a single texture. For example if you stored metallic in the red channel, roughness in the blue, and ambient occlusion in the green you could reduce the number of textures you use. </member> <member name="shading_mode" type="int" setter="set_shading_mode" getter="get_shading_mode" enum="BaseMaterial3D.ShadingMode" default="1"> Sets whether the shading takes place per-pixel or per-vertex. Per-vertex lighting is faster, making it the best choice for mobile applications, however it looks considerably worse than per-pixel. diff --git a/doc/classes/CanvasItem.xml b/doc/classes/CanvasItem.xml index 50bbbc71a0..499d53e63c 100644 --- a/doc/classes/CanvasItem.xml +++ b/doc/classes/CanvasItem.xml @@ -510,7 +510,7 @@ <method name="move_to_front"> <return type="void" /> <description> - Moves this node to display on top of its siblings. This has more use in [Control], as [Node2D] can be ordered with [member Node2D.z_index]. + Moves this node to display on top of its siblings. Internally, the node is moved to the bottom of parent's children list. The method has no effect on nodes without a parent. </description> </method> @@ -587,6 +587,17 @@ If [code]true[/code], this [CanvasItem] is drawn. The node is only visible if all of its antecedents are visible as well (in other words, [method is_visible_in_tree] must return [code]true[/code]). [b]Note:[/b] For controls that inherit [Popup], the correct way to make them visible is to call one of the multiple [code]popup*()[/code] functions instead. </member> + <member name="y_sort_enabled" type="bool" setter="set_y_sort_enabled" getter="is_y_sort_enabled" default="false"> + If [code]true[/code], child nodes with the lowest Y position are drawn before those with a higher Y position. If [code]false[/code], Y-sorting is disabled. Y-sorting only affects children that inherit from [CanvasItem]. + You can nest nodes with Y-sorting. Child Y-sorted nodes are sorted in the same space as the parent Y-sort. This feature allows you to organize a scene better or divide it into multiple ones without changing your scene tree. + </member> + <member name="z_as_relative" type="bool" setter="set_z_as_relative" getter="is_z_relative" default="true"> + If [code]true[/code], the node's Z index is relative to its parent's Z index. If this node's Z index is 2 and its parent's effective Z index is 3, then this node's effective Z index will be 2 + 3 = 5. + </member> + <member name="z_index" type="int" setter="set_z_index" getter="get_z_index" default="0"> + Z index. Controls the order in which the nodes render. A node with a higher Z index will display in front of others. Must be between [constant RenderingServer.CANVAS_ITEM_Z_MIN] and [constant RenderingServer.CANVAS_ITEM_Z_MAX] (inclusive). + [b]Note:[/b] Changing the Z index of a [Control] only affects the drawing order, not the order in which input events are handled. This can be useful to implement certain UI animations, e.g. a menu where hovered items are scaled and should overlap others. + </member> </members> <signals> <signal name="draw"> diff --git a/doc/classes/CharFXTransform.xml b/doc/classes/CharFXTransform.xml index c98b194a4d..a6f707383f 100644 --- a/doc/classes/CharFXTransform.xml +++ b/doc/classes/CharFXTransform.xml @@ -46,6 +46,9 @@ <member name="range" type="Vector2i" setter="set_range" getter="get_range" default="Vector2i(0, 0)"> Absolute character range in the string, corresponding to the glyph. Setting this property won't affect drawing. </member> + <member name="relative_index" type="int" setter="set_relative_index" getter="get_relative_index" default="0"> + The character offset of the glyph, relative to the current [RichTextEffect] custom block. Setting this property won't affect drawing. + </member> <member name="visible" type="bool" setter="set_visibility" getter="is_visible" default="true"> If [code]true[/code], the character will be drawn. If [code]false[/code], the character will be hidden. Characters around hidden characters will reflow to take the space of hidden characters. If this is not desired, set their [member color] to [code]Color(1, 1, 1, 0)[/code] instead. </member> diff --git a/doc/classes/Color.xml b/doc/classes/Color.xml index 90fbdcc622..4d78433915 100644 --- a/doc/classes/Color.xml +++ b/doc/classes/Color.xml @@ -1,12 +1,11 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="Color" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> <brief_description> - Color in RGBA format using floats on the range of 0 to 1. + Color built-in type, in RGBA format. </brief_description> <description> - A color represented by red, green, blue, and alpha (RGBA) components. The alpha component is often used for opacity. Values are in floating-point and usually range from 0 to 1. Some properties (such as CanvasItem.modulate) may accept values greater than 1 (overbright or HDR colors). - You can also create a color from standardized color names by using the string constructor or directly using the color constants defined here. The standardized color set is based on the [url=https://en.wikipedia.org/wiki/X11_color_names]X11 color names[/url]. - If you want to supply values in a range of 0 to 255, you should use [method @GDScript.Color8]. + A color represented in RGBA format by red ([member r]), green ([member g]), blue ([member b]), and alpha ([member a]) components. Each component is a 16-bit floating-point value, usually ranging from 0 to 1. Some properties (such as [member CanvasItem.modulate]) may support values greater than 1, for overbright or High Dynamic Range colors. If you want to supply values in a range of 0 to 255, you should use [method @GDScript.Color8]. + Colors can also be created by name from a set of standardized colors, through the [String] constructor, [method from_string], or by directly fetching the color constants documented here. The standardized color set is based on the [url=https://en.wikipedia.org/wiki/X11_color_names]X11 color names[/url], with the addition of [constant TRANSPARENT]. [b]Note:[/b] In a boolean context, a Color will evaluate to [code]false[/code] if it's equal to [code]Color(0, 0, 0, 1)[/code] (opaque black). Otherwise, a Color will always evaluate to [code]true[/code]. [url=https://raw.githubusercontent.com/godotengine/godot-docs/master/img/color_constants.png]Color constants cheatsheet[/url] </description> @@ -19,7 +18,8 @@ <constructor name="Color"> <return type="Color" /> <description> - Constructs a default-initialized [Color] with all components set to [code]0[/code]. + Constructs a default [Color] from opaque black. This is the same as [constant BLACK]. + [b]Note:[/b] in C#, constructs an empty color with all of its components set to [code]0.0[/code] (transparent black). </description> </constructor> <constructor name="Color"> @@ -27,10 +27,10 @@ <param index="0" name="from" type="Color" /> <param index="1" name="alpha" type="float" /> <description> - Constructs a [Color] from an existing color, but with a custom alpha value. + Constructs a [Color] from the existing color, with [member a] set to the given [param alpha] value. [codeblocks] [gdscript] - var red = Color(Color.red, 0.2) # 20% opaque red. + var red = Color(Color.RED, 0.2) # 20% opaque red. [/gdscript] [csharp] var red = new Color(Colors.Red, 0.2f); // 20% opaque red. @@ -49,7 +49,7 @@ <return type="Color" /> <param index="0" name="code" type="String" /> <description> - Constructs a [Color] either from an HTML color code or from a standardized color name. Supported color names are the same as the constants. + Constructs a [Color] either from an HTML color code or from a standardized color name. The supported color names are the same as the constants. </description> </constructor> <constructor name="Color"> @@ -57,7 +57,7 @@ <param index="0" name="code" type="String" /> <param index="1" name="alpha" type="float" /> <description> - Constructs a [Color] either from an HTML color code or from a standardized color name, with [param alpha] on the range of 0 to 1. Supported color names are the same as the constants. + Constructs a [Color] either from an HTML color code or from a standardized color name, with [param alpha] on the range of 0.0 to 1.0. The supported color names are the same as the constants. </description> </constructor> <constructor name="Color"> @@ -66,7 +66,7 @@ <param index="1" name="g" type="float" /> <param index="2" name="b" type="float" /> <description> - Constructs a [Color] from RGB values, typically between 0 and 1. Alpha will be 1. + Constructs a [Color] from RGB values, typically between 0.0 and 1.0. [member a] is set to 1.0. [codeblocks] [gdscript] var color = Color(0.2, 1.0, 0.7) # Similar to `Color8(51, 255, 178, 255)` @@ -84,7 +84,7 @@ <param index="2" name="b" type="float" /> <param index="3" name="a" type="float" /> <description> - Constructs a [Color] from RGBA values, typically between 0 and 1. + Constructs a [Color] from RGBA values, typically between 0.0 and 1.0. [codeblocks] [gdscript] var color = Color(0.2, 1.0, 0.7, 0.8) # Similar to `Color8(51, 255, 178, 204)` @@ -101,7 +101,7 @@ <return type="Color" /> <param index="0" name="over" type="Color" /> <description> - Returns a new color resulting from blending this color over another. If the color is opaque, the result is also opaque. The second color may have a range of alpha values. + Returns a new color resulting from overlaying this color over the given color. In a painting program, you can imagine it as the [param over] color painted over this colour (including alpha). [codeblocks] [gdscript] var bg = Color(0.0, 1.0, 0.0, 0.5) # Green with alpha of 50% @@ -128,7 +128,7 @@ <return type="Color" /> <param index="0" name="amount" type="float" /> <description> - Returns a new color resulting from making this color darker by the specified percentage (ratio from 0 to 1). + Returns a new color resulting from making this color darker by the specified [param amount] (ratio from 0.0 to 1.0). See also [method lightened]. [codeblocks] [gdscript] var green = Color(0.0, 1.0, 0.0) @@ -148,7 +148,7 @@ <param index="2" name="v" type="float" /> <param index="3" name="alpha" type="float" default="1.0" /> <description> - Constructs a color from an [url=https://en.wikipedia.org/wiki/HSL_and_HSV]HSV profile[/url]. [param h] (hue), [param s] (saturation), and [param v] (value) are typically between 0 and 1. + Constructs a color from an [url=https://en.wikipedia.org/wiki/HSL_and_HSV]HSV profile[/url]. The hue ([param h]), saturation ([param s]), and value ([param v]) are typically between 0.0 and 1.0. [codeblocks] [gdscript] var color = Color.from_hsv(0.58, 0.5, 0.79, 0.8) @@ -166,7 +166,7 @@ <param index="2" name="l" type="float" /> <param index="3" name="alpha" type="float" default="1.0" /> <description> - Constructs a color from an [url=https://bottosson.github.io/posts/colorpicker/]OK HSL profile[/url]. [param h] (hue), [param s] (saturation), and [param l] (lightness) are typically between 0 and 1. + Constructs a color from an [url=https://bottosson.github.io/posts/colorpicker/]OK HSL profile[/url]. The hue ([param h]), saturation ([param s]), and lightness ([param l]) are typically between 0.0 and 1.0. [codeblocks] [gdscript] var color = Color.from_ok_hsl(0.58, 0.5, 0.79, 0.8) @@ -189,14 +189,13 @@ <param index="0" name="str" type="String" /> <param index="1" name="default" type="Color" /> <description> - Creates a [Color] from string, which can be either a HTML color code or a named color. Fallbacks to [param default] if the string does not denote any valid color. + Creates a [Color] from the given string, which can be either an HTML color code or a named color (case-insensitive). Returns [param default] if the color cannot be inferred from the string. </description> </method> <method name="get_luminance" qualifiers="const"> <return type="float" /> <description> - Returns the luminance of the color in the [code][0.0, 1.0][/code] range. - This is useful when determining light or dark color. Colors with a luminance smaller than 0.5 can be generally considered dark. + Returns the light intensity of the color, as a value between 0.0 and 1.0 (inclusive). This is useful when determining light or dark color. Colors with a luminance smaller than 0.5 can be generally considered dark. [b]Note:[/b] [method get_luminance] relies on the color being in the linear color space to return an accurate relative luminance value. If the color is in the sRGB color space, use [method srgb_to_linear] to convert it to the linear color space first. </description> </method> @@ -204,9 +203,12 @@ <return type="Color" /> <param index="0" name="hex" type="int" /> <description> - Returns the [Color] associated with the provided integer number, with 8 bits per channel in ARGB order. The integer should be 32-bit. Best used with hexadecimal notation. + Returns the [Color] associated with the provided [param hex] integer in 32-bit ARGB format (8 bits per channel, alpha channel first). + In GDScript and C#, the [int] is best visualized with hexadecimal notation ([code]"0x"[/code] prefix). [codeblock] - modulate = Color.hex(0xffff0000) # red + var red = Color.hex(0xffff0000) + var dark_cyan = Color.hex(0xff008b8b) + var my_color = Color.hex(0xa4bbefd2) [/codeblock] </description> </method> @@ -214,25 +216,27 @@ <return type="Color" /> <param index="0" name="hex" type="int" /> <description> - Same as [method hex], but takes 64-bit integer and the color uses 16 bits per channel. + Returns the [Color] associated with the provided [param hex] integer in 64-bit ARGB format (16 bits per channel, alpha channel first). + In GDScript and C#, the [int] is best visualized with hexadecimal notation ([code]"0x"[/code] prefix). </description> </method> <method name="html" qualifiers="static"> <return type="Color" /> <param index="0" name="rgba" type="String" /> <description> - Returns a new color from [param rgba], an HTML hexadecimal color string. [param rgba] is not case sensitive, and may be prefixed with a '#' character. - [param rgba] must be a valid three-digit or six-digit hexadecimal color string, and may contain an alpha channel value. If [param rgba] does not contain an alpha channel value, an alpha channel value of 1.0 is applied. - If [param rgba] is invalid a Color(0.0, 0.0, 0.0, 1.0) is returned. - [b]Note:[/b] This method is not implemented in C#, but the same functionality is provided in the class constructor. + Returns a new color from [param rgba], an HTML hexadecimal color string. [param rgba] is not case-sensitive, and may be prefixed by a hash sign ([code]#[/code]). + [param rgba] must be a valid three-digit or six-digit hexadecimal color string, and may contain an alpha channel value. If [param rgba] does not contain an alpha channel value, an alpha channel value of 1.0 is applied. If [param rgba] is invalid, returns an empty color. + [b]Note:[/b] In C#, this method is not implemented. The same functionality is provided by the Color constructor. [codeblocks] [gdscript] - var green = Color.html("#00FF00FF") # set green to Color(0.0, 1.0, 0.0, 1.0) - var blue = Color.html("#0000FF") # set blue to Color(0.0, 0.0, 1.0, 1.0) + var blue = Color.html("#0000ff") # blue is Color(0.0, 0.0, 1.0, 1.0) + var green = Color.html("#0F0") # green is Color(0.0, 1.0, 0.0, 1.0) + var col = Color.html("663399cc") # col is Color(0.4, 0.2, 0.6, 0.8) [/gdscript] [csharp] - var green = new Color("#00FF00FF"); // set green to Color(0.0, 1.0, 0.0, 1.0) - var blue = new Color("#0000FF"); // set blue to Color(0.0, 0.0, 1.0, 1.0) + var blue = new Color("#0000ff"); // blue is Color(0.0, 0.0, 1.0, 1.0) + var green = new Color("#0F0"); // green is Color(0.0, 1.0, 0.0, 1.0) + var col = new Color("663399cc"); // col is Color(0.4, 0.2, 0.6, 0.8) [/csharp] [/codeblocks] </description> @@ -241,24 +245,26 @@ <return type="bool" /> <param index="0" name="color" type="String" /> <description> - Returns [code]true[/code] if [param color] is a valid HTML hexadecimal color string. [param color] is not case sensitive, and may be prefixed with a '#' character. - For a string to be valid it must be three-digit or six-digit hexadecimal, and may contain an alpha channel value. + Returns [code]true[/code] if [param color] is a valid HTML hexadecimal color string. The string must be a hexadecimal value (case-insensitive) of either 3, 4, 6 or 8 digits, and may be prefixed by a hash sign ([code]#[/code]). This method is identical to [method String.is_valid_html_color]. [codeblocks] [gdscript] - var result = Color.html_is_valid("#55aaFF") # result is true - result = Color.html_is_valid("#55AAFF20") # result is true - result = Color.html_is_valid("55AAFF") # result is true - result = Color.html_is_valid("#F2C") # result is true - result = Color.html_is_valid("#AABBC) # result is false - result = Color.html_is_valid("#55aaFF5") # result is false + Color.html_is_valid("#55aaFF") # Returns true + Color.html_is_valid("#55AAFF20") # Returns true + Color.html_is_valid("55AAFF") # Returns true + Color.html_is_valid("#F2C") # Returns true + + Color.html_is_valid("#AABBC) # Returns false + Color.html_is_valid("#55aaFF5") # Returns false [/gdscript] [csharp] - var result = Color.HtmlIsValid("#55AAFF"); // result is true - result = Color.HtmlIsValid("#55AAFF20"); // result is true - result = Color.HtmlIsValid("55AAFF); // result is true - result = Color.HtmlIsValid("#F2C"); // result is true - result = Color.HtmlIsValid("#AABBC"); // result is false - result = Color.HtmlIsValid("#55aaFF5"); // result is false + // This method is not available in C#. Use `StringExtensions.IsValidHtmlColor()`, instead. + "#55AAFF".IsValidHtmlColor(); // Returns true + "#55AAFF20".IsValidHtmlColor(); // Returns true + "55AAFF".IsValidHtmlColor(); // Returns true + "#F2C".IsValidHtmlColor(); // Returns true + + "#AABBC".IsValidHtmlColor(); // Returns false + "#55aaFF5".IsValidHtmlColor(); // Returns false [/csharp] [/codeblocks] </description> @@ -266,13 +272,15 @@ <method name="inverted" qualifiers="const"> <return type="Color" /> <description> - Returns the inverted color [code](1 - r, 1 - g, 1 - b, a)[/code]. + Returns the color with its [member r], [member g], and [member b] components inverted ([code](1 - r, 1 - g, 1 - b, a)[/code]). [codeblocks] [gdscript] + var black = Color.WHITE.inverted() var color = Color(0.3, 0.4, 0.9) var inverted_color = color.inverted() # Equivalent to `Color(0.7, 0.6, 0.1)` [/gdscript] [csharp] + var black = Colors.White.Inverted(); var color = new Color(0.3f, 0.4f, 0.9f); Color invertedColor = color.Inverted(); // Equivalent to `new Color(0.7f, 0.6f, 0.1f)` [/csharp] @@ -291,17 +299,23 @@ <param index="0" name="to" type="Color" /> <param index="1" name="weight" type="float" /> <description> - Returns the linear interpolation with another color. The interpolation factor [param weight] is between 0 and 1. + Returns the linear interpolation between this color's components and [param to]'s components. The interpolation factor [param weight] should be between 0.0 and 1.0 (inclusive). See also [method @GlobalScope.lerp]. [codeblocks] [gdscript] - var c1 = Color(1.0, 0.0, 0.0) - var c2 = Color(0.0, 1.0, 0.0) - var lerp_color = c1.lerp(c2, 0.5) # Equivalent to `Color(0.5, 0.5, 0.0)` + var red = Color(1.0, 0.0, 0.0) + var aqua = Color(0.0, 1.0, 0.8) + + red.lerp(aqua, 0.2) # Returns Color(0.8, 0.2, 0.16) + red.lerp(aqua, 0.5) # Returns Color(0.5, 0.5, 0.4) + red.lerp(aqua, 1.0) # Returns Color(0.0, 1.0, 0.8) [/gdscript] [csharp] - var c1 = new Color(1.0f, 0.0f, 0.0f); - var c2 = new Color(0.0f, 1.0f, 0.0f); - Color lerpColor = c1.Lerp(c2, 0.5f); // Equivalent to `new Color(0.5f, 0.5f, 0.0f)` + var red = new Color(1.0f, 0.0f, 0.0f); + var aqua = new Color(0.0f, 1.0f, 0.8f); + + red.Lerp(aqua, 0.2f); // Returns Color(0.8f, 0.2f, 0.16f) + red.Lerp(aqua, 0.5f); // Returns Color(0.5f, 0.5f, 0.4f) + red.Lerp(aqua, 1.0f); // Returns Color(0.0f, 1.0f, 0.8f) [/csharp] [/codeblocks] </description> @@ -310,15 +324,15 @@ <return type="Color" /> <param index="0" name="amount" type="float" /> <description> - Returns a new color resulting from making this color lighter by the specified percentage (ratio from 0 to 1). + Returns a new color resulting from making this color lighter by the specified [param amount], which should be a ratio from 0.0 to 1.0. See also [method darkened]. [codeblocks] [gdscript] var green = Color(0.0, 1.0, 0.0) - var lightgreen = green.lightened(0.2) # 20% lighter than regular green + var light_green = green.lightened(0.2) # 20% lighter than regular green [/gdscript] [csharp] var green = new Color(0.0f, 1.0f, 0.0f); - Color lightgreen = green.Lightened(0.2f); // 20% lighter than regular green + Color lightGreen = green.Lightened(0.2f); // 20% lighter than regular green [/csharp] [/codeblocks] </description> @@ -326,19 +340,19 @@ <method name="linear_to_srgb" qualifiers="const"> <return type="Color" /> <description> - Returns the color converted to the [url=https://en.wikipedia.org/wiki/SRGB]sRGB[/url] color space. This assumes the original color is in the linear color space. See also [method srgb_to_linear] which performs the opposite operation. + Returns the color converted to the [url=https://en.wikipedia.org/wiki/SRGB]sRGB[/url] color space. This method assumes the original color is in the linear color space. See also [method srgb_to_linear] which performs the opposite operation. </description> </method> <method name="srgb_to_linear" qualifiers="const"> <return type="Color" /> <description> - Returns the color converted to the linear color space. This assumes the original color is in the sRGB color space. See also [method linear_to_srgb] which performs the opposite operation. + Returns the color converted to the linear color space. This method assumes the original color already is in the sRGB color space. See also [method linear_to_srgb] which performs the opposite operation. </description> </method> <method name="to_abgr32" qualifiers="const"> <return type="int" /> <description> - Returns the color converted to a 32-bit integer in ABGR format (each byte represents a color channel). ABGR is the reversed version of the default format. + Returns the color converted to a 32-bit integer in ABGR format (each component is 8 bits). ABGR is the reversed version of the default RGBA format. [codeblocks] [gdscript] var color = Color(1, 0.5, 0.2) @@ -354,7 +368,7 @@ <method name="to_abgr64" qualifiers="const"> <return type="int" /> <description> - Returns the color converted to a 64-bit integer in ABGR format (each word represents a color channel). ABGR is the reversed version of the default format. + Returns the color converted to a 64-bit integer in ABGR format (each component is 16 bits). ABGR is the reversed version of the default RGBA format. [codeblocks] [gdscript] var color = Color(1, 0.5, 0.2) @@ -370,7 +384,7 @@ <method name="to_argb32" qualifiers="const"> <return type="int" /> <description> - Returns the color converted to a 32-bit integer in ARGB format (each byte represents a color channel). ARGB is more compatible with DirectX. + Returns the color converted to a 32-bit integer in ARGB format (each component is 8 bits). ARGB is more compatible with DirectX. [codeblocks] [gdscript] var color = Color(1, 0.5, 0.2) @@ -386,7 +400,7 @@ <method name="to_argb64" qualifiers="const"> <return type="int" /> <description> - Returns the color converted to a 64-bit integer in ARGB format (each word represents a color channel). ARGB is more compatible with DirectX. + Returns the color converted to a 64-bit integer in ARGB format (each component is 16 bits). ARGB is more compatible with DirectX. [codeblocks] [gdscript] var color = Color(1, 0.5, 0.2) @@ -403,18 +417,18 @@ <return type="String" /> <param index="0" name="with_alpha" type="bool" default="true" /> <description> - Returns the color converted to an HTML hexadecimal color string in RGBA format (ex: [code]ff34f822[/code]). - Setting [param with_alpha] to [code]false[/code] excludes alpha from the hexadecimal string (and uses RGB instead of RGBA format). + Returns the color converted to an HTML hexadecimal color [String] in RGBA format, without the hash ([code]#[/code]) prefix. + Setting [param with_alpha] to [code]false[/code], excludes alpha from the hexadecimal string, using RGB format instead of RGBA format. [codeblocks] [gdscript] - var color = Color(1, 1, 1, 0.5) - var with_alpha = color.to_html() # Returns "ffffff7f" - var without_alpha = color.to_html(false) # Returns "ffffff" + var white = Color(1, 1, 1, 0.5) + var with_alpha = white.to_html() # Returns "ffffff7f" + var without_alpha = white.to_html(false) # Returns "ffffff" [/gdscript] [csharp] - var color = new Color(1, 1, 1, 0.5f); - String withAlpha = color.ToHtml(); // Returns "ffffff7f" - String withoutAlpha = color.ToHtml(false); // Returns "ffffff" + var white = new Color(1, 1, 1, 0.5f); + string withAlpha = white.ToHtml(); // Returns "ffffff7f" + string withoutAlpha = white.ToHtml(false); // Returns "ffffff" [/csharp] [/codeblocks] </description> @@ -422,7 +436,7 @@ <method name="to_rgba32" qualifiers="const"> <return type="int" /> <description> - Returns the color converted to a 32-bit integer in RGBA format (each byte represents a color channel). RGBA is Godot's default format. + Returns the color converted to a 32-bit integer in RGBA format (each component is 8 bits). RGBA is Godot's default format. [codeblocks] [gdscript] var color = Color(1, 0.5, 0.2) @@ -438,7 +452,7 @@ <method name="to_rgba64" qualifiers="const"> <return type="int" /> <description> - Returns the color converted to a 64-bit integer in RGBA format (each word represents a color channel). RGBA is Godot's default format. + Returns the color converted to a 64-bit integer in RGBA format (each component is 16 bits). RGBA is Godot's default format. [codeblocks] [gdscript] var color = Color(1, 0.5, 0.2) @@ -457,19 +471,19 @@ The color's alpha component, typically on the range of 0 to 1. A value of 0 means that the color is fully transparent. A value of 1 means that the color is fully opaque. </member> <member name="a8" type="int" setter="" getter="" default="255"> - Wrapper for [member a] that uses the range 0 to 255 instead of 0 to 1. + Wrapper for [member a] that uses the range 0 to 255, instead of 0 to 1. </member> <member name="b" type="float" setter="" getter="" default="0.0"> The color's blue component, typically on the range of 0 to 1. </member> <member name="b8" type="int" setter="" getter="" default="0"> - Wrapper for [member b] that uses the range 0 to 255 instead of 0 to 1. + Wrapper for [member b] that uses the range 0 to 255, instead of 0 to 1. </member> <member name="g" type="float" setter="" getter="" default="0.0"> The color's green component, typically on the range of 0 to 1. </member> <member name="g8" type="int" setter="" getter="" default="0"> - Wrapper for [member g] that uses the range 0 to 255 instead of 0 to 1. + Wrapper for [member g] that uses the range 0 to 255, instead of 0 to 1. </member> <member name="h" type="float" setter="" getter="" default="0.0"> The HSV hue of this color, on the range 0 to 1. @@ -478,7 +492,7 @@ The color's red component, typically on the range of 0 to 1. </member> <member name="r8" type="int" setter="" getter="" default="0"> - Wrapper for [member r] that uses the range 0 to 255 instead of 0 to 1. + Wrapper for [member r] that uses the range 0 to 255, instead of 0 to 1. </member> <member name="s" type="float" setter="" getter="" default="0.0"> The HSV saturation of this color, on the range 0 to 1. @@ -510,7 +524,7 @@ Bisque color. </constant> <constant name="BLACK" value="Color(0, 0, 0, 1)"> - Black color. + Black color. In GDScript, this is the default value of any color. </constant> <constant name="BLANCHED_ALMOND" value="Color(1, 0.921569, 0.803922, 1)"> Blanched almond color. @@ -932,7 +946,7 @@ <return type="bool" /> <param index="0" name="right" type="Color" /> <description> - Returns [code]true[/code] if the colors are not equal. + Returns [code]true[/code] if the colors are not exactly equal. [b]Note:[/b] Due to floating-point precision errors, consider using [method is_equal_approx] instead, which is more reliable. </description> </operator> @@ -1004,7 +1018,7 @@ <return type="float" /> <param index="0" name="index" type="int" /> <description> - Access color components using their index. [code]c[0][/code] is equivalent to [code]c.r[/code], [code]c[1][/code] is equivalent to [code]c.g[/code], [code]c[2][/code] is equivalent to [code]c.b[/code], and [code]c[3][/code] is equivalent to [code]c.a[/code]. + Access color components using their index. [code][0][/code] is equivalent to [member r], [code][1][/code] is equivalent to [member g], [code][2][/code] is equivalent to [member b], and [code][3][/code] is equivalent to [member a]. </description> </operator> <operator name="operator unary+"> @@ -1016,7 +1030,7 @@ <operator name="operator unary-"> <return type="Color" /> <description> - Inverts the given color. This is equivalent to [code]Color.WHITE - c[/code] or [code]Color(1 - c.r, 1 - c.g, 1 - c.b, 1 - c.a)[/code]. + Inverts the given color. This is equivalent to [code]Color.WHITE - c[/code] or [code]Color(1 - c.r, 1 - c.g, 1 - c.b, 1 - c.a)[/code]. Unlike with [method inverted], the [member a] component is inverted, too. </description> </operator> </operators> diff --git a/doc/classes/Curve2D.xml b/doc/classes/Curve2D.xml index ccdf085319..b5e75dff68 100644 --- a/doc/classes/Curve2D.xml +++ b/doc/classes/Curve2D.xml @@ -51,7 +51,7 @@ <return type="Vector2" /> <param index="0" name="to_point" type="Vector2" /> <description> - Returns the closest baked point (in curve's local space) to [param to_point]. + Returns the closest point on baked segments (in curve's local space) to [param to_point]. [param to_point] must be in this curve's local space. </description> </method> @@ -94,7 +94,7 @@ </method> <method name="sample_baked" qualifiers="const"> <return type="Vector2" /> - <param index="0" name="offset" type="float" /> + <param index="0" name="offset" type="float" default="0.0" /> <param index="1" name="cubic" type="bool" default="false" /> <description> Returns a point within the curve at position [param offset], where [param offset] is measured as a pixel distance along the curve. @@ -104,13 +104,10 @@ </method> <method name="sample_baked_with_rotation" qualifiers="const"> <return type="Transform2D" /> - <param index="0" name="offset" type="float" /> + <param index="0" name="offset" type="float" default="0.0" /> <param index="1" name="cubic" type="bool" default="false" /> - <param index="2" name="loop" type="bool" default="true" /> - <param index="3" name="lookahead" type="float" default="4.0" /> <description> Similar to [method sample_baked], but returns [Transform2D] that includes a rotation along the curve. Returns empty transform if length of the curve is [code]0[/code]. - Use [param loop] to smooth the tangent at the end of the curve. [param lookahead] defines the distance to a nearby point for calculating the tangent vector. [codeblock] var transform = curve.sample_baked_with_rotation(offset) position = transform.get_origin() @@ -160,6 +157,13 @@ [param tolerance_degrees] controls how many degrees the midpoint of a segment may deviate from the real curve, before the segment has to be subdivided. </description> </method> + <method name="tessellate_even_length" qualifiers="const"> + <return type="PackedVector2Array" /> + <param index="0" name="max_stages" type="int" default="5" /> + <param index="1" name="tolerance_length" type="float" default="20.0" /> + <description> + </description> + </method> </methods> <members> <member name="bake_interval" type="float" setter="set_bake_interval" getter="get_bake_interval" default="5.0"> diff --git a/doc/classes/Curve3D.xml b/doc/classes/Curve3D.xml index 67e4e45e52..cfe2036499 100644 --- a/doc/classes/Curve3D.xml +++ b/doc/classes/Curve3D.xml @@ -64,7 +64,7 @@ <return type="Vector3" /> <param index="0" name="to_point" type="Vector3" /> <description> - Returns the closest baked point (in curve's local space) to [param to_point]. + Returns the closest point on baked segments (in curve's local space) to [param to_point]. [param to_point] must be in this curve's local space. </description> </method> @@ -114,7 +114,7 @@ </method> <method name="sample_baked" qualifiers="const"> <return type="Vector3" /> - <param index="0" name="offset" type="float" /> + <param index="0" name="offset" type="float" default="0.0" /> <param index="1" name="cubic" type="bool" default="false" /> <description> Returns a point within the curve at position [param offset], where [param offset] is measured as a distance in 3D units along the curve. @@ -134,7 +134,7 @@ </method> <method name="sample_baked_with_rotation" qualifiers="const"> <return type="Transform3D" /> - <param index="0" name="offset" type="float" /> + <param index="0" name="offset" type="float" default="0.0" /> <param index="1" name="cubic" type="bool" default="false" /> <param index="2" name="apply_tilt" type="bool" default="false" /> <description> diff --git a/doc/classes/Dictionary.xml b/doc/classes/Dictionary.xml index 9842288d35..92225b816f 100644 --- a/doc/classes/Dictionary.xml +++ b/doc/classes/Dictionary.xml @@ -4,9 +4,8 @@ Dictionary type. </brief_description> <description> - Dictionary type. Associative container, which contains values referenced by unique keys. Dictionaries are composed of pairs of keys (which must be unique) and values. Dictionaries will preserve the insertion order when adding elements. In other programming languages, this data structure is sometimes referred to as a hash map or associative array. + Dictionary type. Associative container, which contains values referenced by unique keys. Dictionaries are composed of pairs of keys (which must be unique) and values. Dictionaries will preserve the insertion order when adding new entries. In other programming languages, this data structure is sometimes referred to as a hash map or associative array. You can define a dictionary by placing a comma-separated list of [code]key: value[/code] pairs in curly braces [code]{}[/code]. - Erasing elements while iterating over them [b]is not supported[/b] and will result in undefined behavior. [b]Note:[/b] Dictionaries are always passed by reference. To get a copy of a dictionary which can be modified independently of the original dictionary, use [method duplicate]. Creating a dictionary: [codeblocks] @@ -40,10 +39,10 @@ }; [/csharp] [/codeblocks] - You can access a dictionary's values by referencing the appropriate key. In the above example, [code]points_dict["White"][/code] will return [code]50[/code]. You can also write [code]points_dict.White[/code], which is equivalent. However, you'll have to use the bracket syntax if the key you're accessing the dictionary with isn't a fixed string (such as a number or variable). + You can access a dictionary's value by referencing its corresponding key. In the above example, [code]points_dict["White"][/code] will return [code]50[/code]. You can also write [code]points_dict.White[/code], which is equivalent. However, you'll have to use the bracket syntax if the key you're accessing the dictionary with isn't a fixed string (such as a number or variable). [codeblocks] [gdscript] - export(String, "White", "Yellow", "Orange") var my_color + @export(String, "White", "Yellow", "Orange") var my_color var points_dict = {"White": 50, "Yellow": 75, "Orange": 100} func _ready(): # We can't use dot syntax here as `my_color` is a variable. @@ -69,7 +68,9 @@ Dictionaries can contain more complex data: [codeblocks] [gdscript] - my_dict = {"First Array": [1, 2, 3, 4]} # Assigns an Array to a String key. + var my_dict = { + "First Array": [1, 2, 3, 4] # Assigns an Array to a String key. + } [/gdscript] [csharp] var myDict = new Godot.Collections.Dictionary @@ -91,7 +92,7 @@ {"Yellow", 75}, {"Orange", 100} }; - pointsDict["blue"] = 150; // Add "Blue" as a key and assign 150 as its value. + pointsDict["Blue"] = 150; // Add "Blue" as a key and assign 150 as its value. [/csharp] [/codeblocks] Finally, dictionaries can contain different types of keys and values in the same dictionary: @@ -118,63 +119,23 @@ }; [/csharp] [/codeblocks] - [b]Note:[/b] Unlike [Array]s, you can't compare dictionaries directly: + The keys of a dictionary can be iterated with the [code]for[/code] keyword: [codeblocks] [gdscript] - var array1 = [1, 2, 3] - var array2 = [1, 2, 3] - - func compare_arrays(): - print(array1 == array2) # Will print true. - - var dict1 = {"a": 1, "b": 2, "c": 3} - var dict2 = {"a": 1, "b": 2, "c": 3} - - func compare_dictionaries(): - print(dict1 == dict2) # Will NOT print true. + var groceries = {"Orange": 20, "Apple": 2, "Banana": 4} + for fruit in groceries: + var amount = groceries[fruit] [/gdscript] [csharp] - // You have to use GD.Hash(). - - public Godot.Collections.Array array1 = new Godot.Collections.Array{1, 2, 3}; - public Godot.Collections.Array array2 = new Godot.Collections.Array{1, 2, 3}; - - public void CompareArrays() + var groceries = new Godot.Collections.Dictionary{{"Orange", 20}, {"Apple", 2}, {"Banana", 4}}; + foreach (var (fruit, amount) in groceries) { - GD.Print(array1 == array2); // Will print FALSE!! - GD.Print(GD.Hash(array1) == GD.Hash(array2)); // Will print true. - } - - public Godot.Collections.Dictionary dict1 = new Godot.Collections.Dictionary{{"a", 1}, {"b", 2}, {"c", 3}}; - public Godot.Collections.Dictionary dict2 = new Godot.Collections.Dictionary{{"a", 1}, {"b", 2}, {"c", 3}}; - - public void CompareDictionaries() - { - GD.Print(dict1 == dict2); // Will NOT print true. + // `fruit` is the key, `amount` is the value. } [/csharp] [/codeblocks] - You need to first calculate the dictionary's hash with [method hash] before you can compare them: - [codeblocks] - [gdscript] - var dict1 = {"a": 1, "b": 2, "c": 3} - var dict2 = {"a": 1, "b": 2, "c": 3} - - func compare_dictionaries(): - print(dict1.hash() == dict2.hash()) # Will print true. - [/gdscript] - [csharp] - // You have to use GD.Hash(). - public Godot.Collections.Dictionary dict1 = new Godot.Collections.Dictionary{{"a", 1}, {"b", 2}, {"c", 3}}; - public Godot.Collections.Dictionary dict2 = new Godot.Collections.Dictionary{{"a", 1}, {"b", 2}, {"c", 3}}; - - public void CompareDictionaries() - { - GD.Print(GD.Hash(dict1) == GD.Hash(dict2)); // Will print true. - } - [/csharp] - [/codeblocks] - [b]Note:[/b] When declaring a dictionary with [code]const[/code], the dictionary itself can still be mutated by defining the values of individual keys. Using [code]const[/code] will only prevent assigning the constant with another value after it was initialized. + [b]Note:[/b] Erasing elements while iterating over dictionaries is [b]not[/b] supported and will result in unpredictable behavior. + [b]Note:[/b] When declaring a dictionary with [code]const[/code], the dictionary becomes read-only. A read-only Dictionary's entries cannot be overriden at run-time. This does [i]not[/i] affect nested [Array] and [Dictionary] values. </description> <tutorials> <link title="GDScript basics: Dictionary">$DOCS_URL/tutorials/scripting/gdscript/gdscript_basics.html#dictionary</link> @@ -192,7 +153,7 @@ <return type="Dictionary" /> <param index="0" name="from" type="Dictionary" /> <description> - Constructs a [Dictionary] as a copy of the given [Dictionary]. + Returns the same array as [param from]. If you need a copy of the array, use [method duplicate]. </description> </constructor> </constructors> @@ -200,30 +161,30 @@ <method name="clear"> <return type="void" /> <description> - Clear the dictionary, removing all key/value pairs. + Clears the dictionary, removing all entries from it. </description> </method> <method name="duplicate" qualifiers="const"> <return type="Dictionary" /> <param index="0" name="deep" type="bool" default="false" /> <description> - Creates a copy of the dictionary, and returns it. The [param deep] parameter causes inner dictionaries and arrays to be copied recursively, but does not apply to objects. + Creates and returns a new copy of the dictionary. If [param deep] is [code]true[/code], inner [Dictionary] and [Array] keys and values are also copied, recursively. </description> </method> <method name="erase"> <return type="bool" /> <param index="0" name="key" type="Variant" /> <description> - Erase a dictionary key/value pair by key. Returns [code]true[/code] if the given key was present in the dictionary, [code]false[/code] otherwise. - [b]Note:[/b] Don't erase elements while iterating over the dictionary. You can iterate over the [method keys] array instead. + Removes the dictionary entry by key, if it exists. Returns [code]true[/code] if the given [param key] existed in the dictionary, otherwise [code]false[/code]. + [b]Note:[/b] Do not erase entries while iterating over the dictionary. You can iterate over the [method keys] array instead. </description> </method> <method name="find_key" qualifiers="const"> <return type="Variant" /> <param index="0" name="value" type="Variant" /> <description> - Returns the first key whose associated value is equal to [param value], or [code]null[/code] if no such value is found. - [b]Note:[/b] [code]null[/code] is also a valid key. If you have it in your [Dictionary], the [method find_key] method can give misleading results. + Finds and returns the first key whose associated value is equal to [param value], or [code]null[/code] if it is not found. + [b]Note:[/b] [code]null[/code] is also a valid key. If inside the dictionary, [method find_key] may give misleading results. </description> </method> <method name="get" qualifiers="const"> @@ -231,72 +192,89 @@ <param index="0" name="key" type="Variant" /> <param index="1" name="default" type="Variant" default="null" /> <description> - Returns the current value for the specified key in the [Dictionary]. If the key does not exist, the method returns the value of the optional default argument, or [code]null[/code] if it is omitted. + Returns the corresponding value for the given [param key] in the dictionary. If the [param key] does not exist, returns [param default], or [code]null[/code] if the parameter is omitted. </description> </method> <method name="has" qualifiers="const"> <return type="bool" /> <param index="0" name="key" type="Variant" /> <description> - Returns [code]true[/code] if the dictionary has a given key. - [b]Note:[/b] This is equivalent to using the [code]in[/code] operator as follows: + Returns [code]true[/code] if the dictionary contains an entry with the given [param key]. [codeblocks] [gdscript] - # Will evaluate to `true`. - if "godot" in {"godot": "engine"}: - pass + var my_dict = { + "Godot" : 4, + 210 : null, + } + + print(my_dict.has("Godot")) # Prints true + print(my_dict.has(210)) # Prints true + print(my_dict.has(4)) # Prints false [/gdscript] [csharp] - // You have to use Contains() here as an alternative to GDScript's `in` operator. - if (new Godot.Collections.Dictionary{{"godot", "engine"}}.Contains("godot")) + var myDict = new Godot.Collections.Dictionary { - // I am executed. - } + { "Godot", 4 }, + { 210, default }, + }; + + GD.Print(myDict.Contains("Godot")); // Prints true + GD.Print(myDict.Contains(210)); // Prints true + GD.Print(myDict.Contains(4)); // Prints false [/csharp] [/codeblocks] - This method (like the [code]in[/code] operator) will evaluate to [code]true[/code] as long as the key exists, even if the associated value is [code]null[/code]. + In GDScript, this is equivalent to the [code]in[/code] operator: + [codeblock] + if "Godot" in {"Godot": 4}: + print("The key is here!") # Will be printed. + [/codeblock] + [b]Note:[/b] This method returns [code]true[/code] as long as the [param key] exists, even if its corresponding value is [code]null[/code]. </description> </method> <method name="has_all" qualifiers="const"> <return type="bool" /> <param index="0" name="keys" type="Array" /> <description> - Returns [code]true[/code] if the dictionary has all the keys in the given array. + Returns [code]true[/code] if the dictionary contains all keys in the given [param keys] array. + [codeblock] + var data = {"width" : 10, "height" : 20} + data.has_all(["height", "width"]) # Returns true + [/codeblock] </description> </method> <method name="hash" qualifiers="const"> <return type="int" /> <description> - Returns a hashed 32-bit integer value representing the dictionary contents. This can be used to compare dictionaries by value: + Returns a hashed 32-bit integer value representing the dictionary contents. [codeblocks] [gdscript] - var dict1 = {0: 10} - var dict2 = {0: 10} - # The line below prints `true`, whereas it would have printed `false` if both variables were compared directly. - print(dict1.hash() == dict2.hash()) + var dict1 = {"A": 10, "B": 2} + var dict2 = {"A": 10, "B": 2} + + print(dict1.hash() == dict2.hash()) # Prints true [/gdscript] [csharp] - var dict1 = new Godot.Collections.Dictionary{{0, 10}}; - var dict2 = new Godot.Collections.Dictionary{{0, 10}}; - // The line below prints `true`, whereas it would have printed `false` if both variables were compared directly. - // Dictionary has no Hash() method. Use GD.Hash() instead. - GD.Print(GD.Hash(dict1) == GD.Hash(dict2)); + var dict1 = new Godot.Collections.Dictionary{{"A", 10}, {"B", 2}}; + var dict2 = new Godot.Collections.Dictionary{{"A", 10}, {"B", 2}}; + + // Godot.Collections.Dictionary has no Hash() method. Use GD.Hash() instead. + GD.Print(GD.Hash(dict1) == GD.Hash(dict2)); // Prints true [/csharp] [/codeblocks] - [b]Note:[/b] Dictionaries with the same keys/values but in a different order will have a different hash. - [b]Note:[/b] Dictionaries with equal content will always produce identical hash values. However, the reverse is not true. Returning identical hash values does [i]not[/i] imply the dictionaries are equal, because different dictionaries can have identical hash values due to hash collisions. + [b]Note:[/b] Dictionaries with the same entries but in a different order will not have the same hash. + [b]Note:[/b] Dictionaries with equal hash values are [i]not[/i] guaranteed to be the same, because of hash collisions. On the countrary, dictionaries with different hash values are guaranteed to be different. </description> </method> <method name="is_empty" qualifiers="const"> <return type="bool" /> <description> - Returns [code]true[/code] if the dictionary is empty. + Returns [code]true[/code] if the dictionary is empty (its size is [code]0[/code]). See also [method size]. </description> </method> <method name="keys" qualifiers="const"> <return type="Array" /> <description> - Returns the list of keys in the [Dictionary]. + Returns the list of keys in the dictionary. </description> </method> <method name="merge"> @@ -304,19 +282,19 @@ <param index="0" name="dictionary" type="Dictionary" /> <param index="1" name="overwrite" type="bool" default="false" /> <description> - Adds elements from [param dictionary] to this [Dictionary]. By default, duplicate keys will not be copied over, unless [param overwrite] is [code]true[/code]. + Adds entries from [param dictionary] to this dictionary. By default, duplicate keys are not copied over, unless [param overwrite] is [code]true[/code]. </description> </method> <method name="size" qualifiers="const"> <return type="int" /> <description> - Returns the number of keys in the dictionary. + Returns the number of entries in the dictionary. Empty dictionaries ([code]{ }[/code]) always return [code]0[/code]. See also [method is_empty]. </description> </method> <method name="values" qualifiers="const"> <return type="Array" /> <description> - Returns the list of values in the [Dictionary]. + Returns the list of values in this dictionary. </description> </method> </methods> @@ -325,21 +303,22 @@ <return type="bool" /> <param index="0" name="right" type="Dictionary" /> <description> - Returns [code]true[/code] if the dictionaries differ, i.e. their key or value lists are different (including the order). + Returns [code]true[/code] if the two dictionaries do not contain the same keys and values. </description> </operator> <operator name="operator =="> <return type="bool" /> <param index="0" name="right" type="Dictionary" /> <description> - Returns [code]true[/code] if both dictionaries have the same contents, i.e. their keys list and value list are equal. + Returns [code]true[/code] if the two dictionaries contain the same keys and values. The order of the entries does not matter. + [b]Note:[/b] In C#, by convention, this operator compares by [b]reference[/b]. If you need to compare by value, iterate over both dictionaries. </description> </operator> <operator name="operator []"> <return type="Variant" /> <param index="0" name="key" type="Variant" /> <description> - Returns a value at the given [param key] or [code]null[/code] and error if the key does not exist. For safe access, use [method get] or [method has]. + Returns the corresponding value for the given [param key] in the dictionary. If the entry does not exist, fails and returns [code]null[/code]. For safe access, use [method get] or [method has]. </description> </operator> </operators> diff --git a/doc/classes/DirectionalLight2D.xml b/doc/classes/DirectionalLight2D.xml index 7a54980c19..f825a9e082 100644 --- a/doc/classes/DirectionalLight2D.xml +++ b/doc/classes/DirectionalLight2D.xml @@ -1,19 +1,20 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="DirectionalLight2D" inherits="Light2D" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> <brief_description> - Directional light from a distance. + Directional 2D light from a distance. </brief_description> <description> A directional light is a type of [Light2D] node that models an infinite number of parallel rays covering the entire scene. It is used for lights with strong intensity that are located far away from the scene (for example: to model sunlight or moonlight). </description> <tutorials> + <link title="2D lights and shadows">$DOCS_URL/tutorials/2d/2d_lights_and_shadows.html</link> </tutorials> <members> <member name="height" type="float" setter="set_height" getter="get_height" default="0.0"> The height of the light. Used with 2D normal mapping. Ranges from 0 (parallel to the plane) to 1 (perpendicular to the plane). </member> <member name="max_distance" type="float" setter="set_max_distance" getter="get_max_distance" default="10000.0"> - Maximum distance this light covers. Increasing this value will make directional shadows visible from further away, at the cost of lower overall shadow detail and performance (due to more objects being included in shadow rendering). + The maximum distance from the camera center objects can be before their shadows are culled (in pixels). Decreasing this value can prevent objects located outside the camera from casting shadows (while also improving performance). [member Camera2D.zoom] is not taken into account by [member max_distance], which means that at higher zoom values, shadows will appear to fade out sooner when zooming onto a given point. </member> </members> </class> diff --git a/doc/classes/DisplayServer.xml b/doc/classes/DisplayServer.xml index 0039301bf6..c59bfbfe4f 100644 --- a/doc/classes/DisplayServer.xml +++ b/doc/classes/DisplayServer.xml @@ -1715,6 +1715,7 @@ <constant name="DISPLAY_HANDLE" value="0" enum="HandleType"> Display handle: - Linux (X11): [code]X11::Display*[/code] for the display. + - Android: [code]EGLDisplay[/code] for the display. </constant> <constant name="WINDOW_HANDLE" value="1" enum="HandleType"> Window handle: diff --git a/doc/classes/EditorSceneFormatImporter.xml b/doc/classes/EditorSceneFormatImporter.xml index 6de9c2c5dc..db93cab14c 100644 --- a/doc/classes/EditorSceneFormatImporter.xml +++ b/doc/classes/EditorSceneFormatImporter.xml @@ -39,7 +39,6 @@ <param index="0" name="path" type="String" /> <param index="1" name="flags" type="int" /> <param index="2" name="options" type="Dictionary" /> - <param index="3" name="bake_fps" type="int" /> <description> </description> </method> diff --git a/doc/classes/EditorSettings.xml b/doc/classes/EditorSettings.xml index 07457387a0..865faa13ae 100644 --- a/doc/classes/EditorSettings.xml +++ b/doc/classes/EditorSettings.xml @@ -592,6 +592,9 @@ <member name="interface/theme/custom_theme" type="String" setter="" getter=""> The custom theme resource to use for the editor. Must be a Godot theme resource in [code].tres[/code] or [code].res[/code] format. </member> + <member name="interface/theme/draw_extra_borders" type="bool" setter="" getter=""> + If [code]true[/code], draws additional borders around interactive UI elements in the editor. This is automatically enabled when using the [b]Black (OLED)[/b] theme preset, as this theme preset uses a fully black background. + </member> <member name="interface/theme/icon_and_font_color" type="int" setter="" getter=""> The icon and font color scheme to use in the editor. - [b]Auto[/b] determines the color scheme to use automatically based on [member interface/theme/base_color]. diff --git a/doc/classes/FileAccess.xml b/doc/classes/FileAccess.xml index e52f897164..be0c8fd6ca 100644 --- a/doc/classes/FileAccess.xml +++ b/doc/classes/FileAccess.xml @@ -153,6 +153,20 @@ Returns the last error that happened when trying to perform operations. Compare with the [code]ERR_FILE_*[/code] constants from [enum Error]. </description> </method> + <method name="get_file_as_bytes" qualifiers="static"> + <return type="PackedByteArray" /> + <param index="0" name="path" type="String" /> + <description> + Returns the whole [param path] file contents as a [PackedByteArray] without any decoding. + </description> + </method> + <method name="get_file_as_string" qualifiers="static"> + <return type="String" /> + <param index="0" name="path" type="String" /> + <description> + Returns the whole [param path] file contents as a [String]. Text is interpreted as being UTF-8 encoded. + </description> + </method> <method name="get_float" qualifiers="const"> <return type="float" /> <description> diff --git a/doc/classes/Font.xml b/doc/classes/Font.xml index 6a42b62bcf..761e75339a 100644 --- a/doc/classes/Font.xml +++ b/doc/classes/Font.xml @@ -161,6 +161,12 @@ Returns font family name. </description> </method> + <method name="get_font_stretch" qualifiers="const"> + <return type="int" /> + <description> + Returns font stretch amount, compared to a normal width. A percentage value between [code]50%[/code] and [code]200%[/code]. + </description> + </method> <method name="get_font_style" qualifiers="const"> <return type="int" enum="TextServer.FontStyle" /> <description> @@ -173,6 +179,12 @@ Returns font style name. </description> </method> + <method name="get_font_weight" qualifiers="const"> + <return type="int" /> + <description> + Returns weight (boldness) of the font. A value in the [code]100...999[/code] range, normal font weight is [code]400[/code], bold font weight is [code]700[/code]. + </description> + </method> <method name="get_height" qualifiers="const"> <return type="float" /> <param index="0" name="font_size" type="int" default="16" /> diff --git a/doc/classes/FontFile.xml b/doc/classes/FontFile.xml index 271f6a13e0..1019c271dc 100644 --- a/doc/classes/FontFile.xml +++ b/doc/classes/FontFile.xml @@ -542,6 +542,9 @@ </method> </methods> <members> + <member name="allow_system_fallback" type="bool" setter="set_allow_system_fallback" getter="is_allow_system_fallback" default="true"> + If set to [code]true[/code], system fonts can be automatically used as fallbacks. + </member> <member name="antialiasing" type="int" setter="set_antialiasing" getter="get_antialiasing" enum="TextServer.FontAntialiasing" default="1"> Font anti-aliasing mode. </member> @@ -557,9 +560,15 @@ <member name="font_name" type="String" setter="set_font_name" getter="get_font_name" default=""""> Font family name. </member> + <member name="font_stretch" type="int" setter="set_font_stretch" getter="get_font_stretch" default="100"> + Font stretch amount, compared to a normal width. A percentage value between [code]50%[/code] and [code]200%[/code]. + </member> <member name="font_style" type="int" setter="set_font_style" getter="get_font_style" enum="TextServer.FontStyle" default="0"> Font style flags, see [enum TextServer.FontStyle]. </member> + <member name="font_weight" type="int" setter="set_font_weight" getter="get_font_weight" default="400"> + Weight (boldness) of the font. A value in the [code]100...999[/code] range, normal font weight is [code]400[/code], bold font weight is [code]700[/code]. + </member> <member name="force_autohinter" type="bool" setter="set_force_autohinter" getter="is_force_autohinter" default="false"> If set to [code]true[/code], auto-hinting is supported and preferred over font built-in hinting. Used by dynamic fonts only. </member> diff --git a/doc/classes/GraphEdit.xml b/doc/classes/GraphEdit.xml index 5050ce7715..ea4e4b53ba 100644 --- a/doc/classes/GraphEdit.xml +++ b/doc/classes/GraphEdit.xml @@ -291,7 +291,7 @@ </description> </signal> <signal name="connection_drag_started"> - <param index="0" name="from_node" type="String" /> + <param index="0" name="from_node" type="StringName" /> <param index="1" name="from_port" type="int" /> <param index="2" name="is_output" type="bool" /> <description> diff --git a/doc/classes/Light2D.xml b/doc/classes/Light2D.xml index 00815758a1..062d532464 100644 --- a/doc/classes/Light2D.xml +++ b/doc/classes/Light2D.xml @@ -4,8 +4,7 @@ Casts light in a 2D environment. </brief_description> <description> - Casts light in a 2D environment. Light is defined by a (usually grayscale) texture, a color, an energy value, a mode (see constants), and various other parameters (range and shadows-related). - [b]Note:[/b] Light2D can also be used as a mask. + Casts light in a 2D environment. A light is defined as a color, an energy value, a mode (see constants), and various other parameters (range and shadows-related). </description> <tutorials> <link title="2D lights and shadows">$DOCS_URL/tutorials/2d/2d_lights_and_shadows.html</link> @@ -14,12 +13,14 @@ <method name="get_height" qualifiers="const"> <return type="float" /> <description> + Returns the light's height, which is used in 2D normal mapping. See [member PointLight2D.height] and [member DirectionalLight2D.height]. </description> </method> <method name="set_height"> <return type="void" /> <param index="0" name="height" type="float" /> <description> + Sets the light's height, which is used in 2D normal mapping. See [member PointLight2D.height] and [member DirectionalLight2D.height]. </description> </method> </methods> @@ -64,7 +65,7 @@ Shadow filter type. See [enum ShadowFilter] for possible values. </member> <member name="shadow_filter_smooth" type="float" setter="set_shadow_smooth" getter="get_shadow_smooth" default="0.0"> - Smoothing value for shadows. + Smoothing value for shadows. Higher values will result in softer shadows, at the cost of visible streaks that can appear in shadow rendering. [member shadow_filter_smooth] only has an effect if [member shadow_filter] is [constant SHADOW_FILTER_PCF5] or [constant SHADOW_FILTER_PCF13]. </member> <member name="shadow_item_cull_mask" type="int" setter="set_item_shadow_cull_mask" getter="get_item_shadow_cull_mask" default="1"> The shadow mask. Used with [LightOccluder2D] to cast shadows. Only occluders with a matching light mask will cast shadows. @@ -72,13 +73,13 @@ </members> <constants> <constant name="SHADOW_FILTER_NONE" value="0" enum="ShadowFilter"> - No filter applies to the shadow map. See [member shadow_filter]. + No filter applies to the shadow map. This provides hard shadow edges and is the fastest to render. See [member shadow_filter]. </constant> <constant name="SHADOW_FILTER_PCF5" value="1" enum="ShadowFilter"> - Percentage closer filtering (5 samples) applies to the shadow map. See [member shadow_filter]. + Percentage closer filtering (5 samples) applies to the shadow map. This is slower compared to hard shadow rendering. See [member shadow_filter]. </constant> <constant name="SHADOW_FILTER_PCF13" value="2" enum="ShadowFilter"> - Percentage closer filtering (13 samples) applies to the shadow map. See [member shadow_filter]. + Percentage closer filtering (13 samples) applies to the shadow map. This is the slowest shadow filtereing mode, and should be used sparingly. See [member shadow_filter]. </constant> <constant name="BLEND_MODE_ADD" value="0" enum="BlendMode"> Adds the value of pixels corresponding to the Light2D to the values of pixels under it. This is the common behavior of a light. diff --git a/doc/classes/Mesh.xml b/doc/classes/Mesh.xml index 640fa9efec..4d3fb7ed5c 100644 --- a/doc/classes/Mesh.xml +++ b/doc/classes/Mesh.xml @@ -97,7 +97,7 @@ </description> </method> <method name="create_convex_shape" qualifiers="const"> - <return type="Shape3D" /> + <return type="ConvexPolygonShape3D" /> <param index="0" name="clean" type="bool" default="true" /> <param index="1" name="simplify" type="bool" default="false" /> <description> @@ -115,7 +115,7 @@ </description> </method> <method name="create_trimesh_shape" qualifiers="const"> - <return type="Shape3D" /> + <return type="ConcavePolygonShape3D" /> <description> Calculate a [ConcavePolygonShape3D] from the mesh. </description> diff --git a/doc/classes/Node.xml b/doc/classes/Node.xml index 0368f29a13..24df5977f9 100644 --- a/doc/classes/Node.xml +++ b/doc/classes/Node.xml @@ -384,8 +384,11 @@ <method name="get_path_to" qualifiers="const"> <return type="NodePath" /> <param index="0" name="node" type="Node" /> + <param index="1" name="use_unique_path" type="bool" default="false" /> <description> Returns the relative [NodePath] from this node to the specified [param node]. Both nodes must be in the same scene or the function will fail. + If [param use_unique_path] is [code]true[/code], returns the shortest path considering unique node. + [b]Note:[/b] If you get a relative path which starts from a unique node, the path may be longer than a normal relative path due to the addition of the unique node's name. </description> </method> <method name="get_physics_process_delta_time" qualifiers="const"> diff --git a/doc/classes/Node2D.xml b/doc/classes/Node2D.xml index 054ab532af..26efe37dce 100644 --- a/doc/classes/Node2D.xml +++ b/doc/classes/Node2D.xml @@ -125,15 +125,5 @@ <member name="transform" type="Transform2D" setter="set_transform" getter="get_transform"> Local [Transform2D]. </member> - <member name="y_sort_enabled" type="bool" setter="set_y_sort_enabled" getter="is_y_sort_enabled" default="false"> - If [code]true[/code], child nodes with the lowest Y position are drawn before those with a higher Y position. If [code]false[/code], Y-sorting is disabled. Y-sorting only affects children that inherit from [CanvasItem]. - You can nest nodes with Y-sorting. Child Y-sorted nodes are sorted in the same space as the parent Y-sort. This feature allows you to organize a scene better or divide it into multiple ones without changing your scene tree. - </member> - <member name="z_as_relative" type="bool" setter="set_z_as_relative" getter="is_z_relative" default="true"> - If [code]true[/code], the node's Z index is relative to its parent's Z index. If this node's Z index is 2 and its parent's effective Z index is 3, then this node's effective Z index will be 2 + 3 = 5. - </member> - <member name="z_index" type="int" setter="set_z_index" getter="get_z_index" default="0"> - Z index. Controls the order in which the nodes render. A node with a higher Z index will display in front of others. Must be between [constant RenderingServer.CANVAS_ITEM_Z_MIN] and [constant RenderingServer.CANVAS_ITEM_Z_MAX] (inclusive). - </member> </members> </class> diff --git a/doc/classes/OS.xml b/doc/classes/OS.xml index ea9b83d2aa..0efc6ab399 100644 --- a/doc/classes/OS.xml +++ b/doc/classes/OS.xml @@ -182,10 +182,12 @@ <method name="get_cmdline_user_args"> <return type="PackedStringArray" /> <description> - Similar to [method get_cmdline_args], but this returns the user arguments (any argument passed after the double dash [code]--[/code] argument). These are left untouched by Godot for the user. + Similar to [method get_cmdline_args], but this returns the user arguments (any argument passed after the double dash [code]--[/code] or double plus [code]++[/code] argument). These are left untouched by Godot for the user. [code]++[/code] can be used in situations where [code]--[/code] is intercepted by another program (such as [code]startx[/code]). For example, in the command line below, [code]--fullscreen[/code] will not be returned in [method get_cmdline_user_args] and [code]--level 1[/code] will only be returned in [method get_cmdline_user_args]: [codeblock] godot --fullscreen -- --level 1 + # Or: + godot --fullscreen ++ --level 1 [/codeblock] </description> </method> @@ -392,18 +394,38 @@ <method name="get_system_font_path" qualifiers="const"> <return type="String" /> <param index="0" name="font_name" type="String" /> - <param index="1" name="bold" type="bool" default="false" /> - <param index="2" name="italic" type="bool" default="false" /> + <param index="1" name="weight" type="int" default="400" /> + <param index="2" name="stretch" type="int" default="100" /> + <param index="3" name="italic" type="bool" default="false" /> <description> - Returns path to the system font file with [param font_name] and style. Return empty string if no matching fonts found. - [b]Note:[/b] This method is implemented on iOS, Linux, macOS and Windows. + Returns path to the system font file with [param font_name] and style. Returns empty string if no matching fonts found. + The following aliases can be used to request default fonts: "sans-serif", "serif", "monospace", "cursive", and "fantasy". + [b]Note:[/b] Returned font might have different style if the requested style is not available. + [b]Note:[/b] This method is implemented on Android, iOS, Linux, macOS and Windows. + </description> + </method> + <method name="get_system_font_path_for_text" qualifiers="const"> + <return type="PackedStringArray" /> + <param index="0" name="font_name" type="String" /> + <param index="1" name="text" type="String" /> + <param index="2" name="locale" type="String" default="""" /> + <param index="3" name="script" type="String" default="""" /> + <param index="4" name="weight" type="int" default="400" /> + <param index="5" name="stretch" type="int" default="100" /> + <param index="6" name="italic" type="bool" default="false" /> + <description> + Returns an array of the system substitute font file paths, which are similar to the font with [param font_name] and style for the specified text, locale and script. Returns empty array if no matching fonts found. + The following aliases can be used to request default fonts: "sans-serif", "serif", "monospace", "cursive", and "fantasy". + [b]Note:[/b] Depending on OS, it's not guaranteed that any of the returned fonts is suitable for rendering specified text. Fonts should be loaded and checked in the order they are returned, and the first suitable one used. + [b]Note:[/b] Returned fonts might have different style if the requested style is not available or belong to a different font family. + [b]Note:[/b] This method is implemented on Android, iOS, Linux, macOS and Windows. </description> </method> <method name="get_system_fonts" qualifiers="const"> <return type="PackedStringArray" /> <description> Returns list of font family names available. - [b]Note:[/b] This method is implemented on iOS, Linux, macOS and Windows. + [b]Note:[/b] This method is implemented on Android, iOS, Linux, macOS and Windows. </description> </method> <method name="get_thread_caller_id" qualifiers="const"> diff --git a/doc/classes/Object.xml b/doc/classes/Object.xml index bf15f96291..5e834b3d91 100644 --- a/doc/classes/Object.xml +++ b/doc/classes/Object.xml @@ -764,6 +764,22 @@ Emits the [signal property_list_changed] signal. This is mainly used to refresh the editor, so that the Inspector and editor plugins are properly updated. </description> </method> + <method name="property_can_revert" qualifiers="const"> + <return type="bool" /> + <param index="0" name="property" type="StringName" /> + <description> + Returns [code]true[/code] if the given [param property] has a custom default value. Use [method property_get_revert] to get the [param property]'s default value. + [b]Note:[/b] This method is used by the Inspector dock to display a revert icon. The object must implement [method _property_can_revert] to customize the default value. If [method _property_can_revert] is not implemented, this method returns [code]false[/code]. + </description> + </method> + <method name="property_get_revert" qualifiers="const"> + <return type="Variant" /> + <param index="0" name="property" type="StringName" /> + <description> + Returns the custom default value of the given [param property]. Use [method property_can_revert] to check if the [param property] has a custom default value. + [b]Note:[/b] This method is used by the Inspector dock to display a revert icon. The object must implement [method _property_get_revert] to customize the default value. If [method _property_get_revert] is not implemented, this method returns [code]null[/code]. + </description> + </method> <method name="remove_meta"> <return type="void" /> <param index="0" name="name" type="StringName" /> diff --git a/doc/classes/PointLight2D.xml b/doc/classes/PointLight2D.xml index 89cabbd428..0c51a78e49 100644 --- a/doc/classes/PointLight2D.xml +++ b/doc/classes/PointLight2D.xml @@ -1,10 +1,13 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="PointLight2D" inherits="Light2D" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> <brief_description> + Positional 2D light source. </brief_description> <description> + Casts light in a 2D environment. This light's shape is defined by a (usually grayscale) texture </description> <tutorials> + <link title="2D lights and shadows">$DOCS_URL/tutorials/2d/2d_lights_and_shadows.html</link> </tutorials> <members> <member name="height" type="float" setter="set_height" getter="get_height" default="0.0"> diff --git a/doc/classes/ProjectSettings.xml b/doc/classes/ProjectSettings.xml index b6f92c2c40..1f0a8d91fa 100644 --- a/doc/classes/ProjectSettings.xml +++ b/doc/classes/ProjectSettings.xml @@ -2266,7 +2266,20 @@ Set the default Variable Rate Shading (VRS) mode for the main viewport. See [member Viewport.vrs_mode] to change this at runtime, and [enum Viewport.VRSMode] for possible values. </member> <member name="rendering/vrs/texture" type="String" setter="" getter="" default=""""> - If [member rendering/vrs/mode] is set to texture, this is the path to default texture loaded as the VRS image. + If [member rendering/vrs/mode] is set to [b]Texture[/b], this is the path to default texture loaded as the VRS image. + The texture [i]must[/i] use a lossless compression format so that colors can be matched precisely. The following VRS densities are mapped to various colors, with brighter colors representing a lower level of shading precision: + [codeblock] + - 1x1 = rgb(0, 0, 0) - #000000 + - 1x2 = rgb(0, 85, 0) - #005500 + - 2x1 = rgb(85, 0, 0) - #550000 + - 2x2 = rgb(85, 85, 0) - #555500 + - 2x4 = rgb(85, 170, 0) - #55aa00 + - 4x2 = rgb(170, 85, 0) - #aa5500 + - 4x4 = rgb(170, 170, 0) - #aaaa00 + - 4x8 = rgb(170, 255, 0) - #aaff00 - Not supported on most hardware + - 8x4 = rgb(255, 170, 0) - #ffaa00 - Not supported on most hardware + - 8x8 = rgb(255, 255, 0) - #ffff00 - Not supported on most hardware + [/codeblock] </member> <member name="threading/worker_pool/low_priority_thread_ratio" type="float" setter="" getter="" default="0.3"> </member> diff --git a/doc/classes/RID.xml b/doc/classes/RID.xml index a6523e4c8b..2d40a7be57 100644 --- a/doc/classes/RID.xml +++ b/doc/classes/RID.xml @@ -4,7 +4,8 @@ Handle for a [Resource]'s unique ID. </brief_description> <description> - The RID type is used to access the unique integer ID of a resource. They are opaque, which means they do not grant access to the associated resource by themselves. They are used by and with the low-level Server classes such as [RenderingServer]. + The RID [Variant] type is used to access a low-level resource by its unique ID. RIDs are opaque, which means they do not grant access to the resource by themselves. They are used by the low-level server classes, such as [DisplayServer], [RenderingServer], [TextServer], etc. + A low-level resource may correspond to a high-level [Resource], such as [Texture] or [Mesh]. </description> <tutorials> </tutorials> @@ -27,13 +28,13 @@ <method name="get_id" qualifiers="const"> <return type="int" /> <description> - Returns the ID of the referenced resource. + Returns the ID of the referenced low-level resource. </description> </method> <method name="is_valid" qualifiers="const"> <return type="bool" /> <description> - Returns [code]true[/code] if [RID] is valid. + Returns [code]true[/code] if the [RID] is not [code]0[/code]. </description> </method> </methods> @@ -42,36 +43,42 @@ <return type="bool" /> <param index="0" name="right" type="RID" /> <description> + Returns [code]true[/code] if the [RID]s are not equal. </description> </operator> <operator name="operator <"> <return type="bool" /> <param index="0" name="right" type="RID" /> <description> + Returns [code]true[/code] if the [RID]'s ID is less than [param right]'s ID. </description> </operator> <operator name="operator <="> <return type="bool" /> <param index="0" name="right" type="RID" /> <description> + Returns [code]true[/code] if the [RID]'s ID is less than or equal to [param right]'s ID. </description> </operator> <operator name="operator =="> <return type="bool" /> <param index="0" name="right" type="RID" /> <description> + Returns [code]true[/code] if both [RID]s are equal, which means they both refer to the same low-level resource. </description> </operator> <operator name="operator >"> <return type="bool" /> <param index="0" name="right" type="RID" /> <description> + Returns [code]true[/code] if the [RID]'s ID is greater than [param right]'s ID. </description> </operator> <operator name="operator >="> <return type="bool" /> <param index="0" name="right" type="RID" /> <description> + Returns [code]true[/code] if the [RID]'s ID is greater than or equal to [param right]'s ID. </description> </operator> </operators> diff --git a/doc/classes/RichTextLabel.xml b/doc/classes/RichTextLabel.xml index cb2481f705..e222894647 100644 --- a/doc/classes/RichTextLabel.xml +++ b/doc/classes/RichTextLabel.xml @@ -399,6 +399,12 @@ Scrolls the window's top line to match first line of the [param paragraph]. </description> </method> + <method name="scroll_to_selection"> + <return type="void" /> + <description> + Scrolls to the beginning of the current selection. + </description> + </method> <method name="select_all"> <return type="void" /> <description> diff --git a/doc/classes/SystemFont.xml b/doc/classes/SystemFont.xml index b47d6ded7d..20bfd0d8ae 100644 --- a/doc/classes/SystemFont.xml +++ b/doc/classes/SystemFont.xml @@ -7,23 +7,32 @@ <description> [SystemFont] loads a font from a system font with the first matching name from [member font_names]. It will attempt to match font style, but it's not guaranteed. - The returned font might be part of a font collection or be a variable font with OpenType "weight" and/or "italic" features set. + The returned font might be part of a font collection or be a variable font with OpenType "weight", "width" and/or "italic" features set. You can create [FontVariation] of the system font for fine control over its features. </description> <tutorials> </tutorials> <members> + <member name="allow_system_fallback" type="bool" setter="set_allow_system_fallback" getter="is_allow_system_fallback" default="true"> + If set to [code]true[/code], system fonts can be automatically used as fallbacks. + </member> <member name="antialiasing" type="int" setter="set_antialiasing" getter="get_antialiasing" enum="TextServer.FontAntialiasing" default="1"> Font anti-aliasing mode. </member> <member name="fallbacks" type="Font[]" setter="set_fallbacks" getter="get_fallbacks" default="[]"> Array of fallback [Font]s. </member> + <member name="font_italic" type="bool" setter="set_font_italic" getter="get_font_italic" default="false"> + If set to [code]true[/code], italic or oblique font is preferred. + </member> <member name="font_names" type="PackedStringArray" setter="set_font_names" getter="get_font_names" default="PackedStringArray()"> Array of font family names to search, first matching font found is used. </member> - <member name="font_style" type="int" setter="set_font_style" getter="get_font_style" enum="TextServer.FontStyle" default="0"> - Font style flags, see [enum TextServer.FontStyle]. + <member name="font_stretch" type="int" setter="set_font_stretch" getter="get_font_stretch" default="100"> + Preferred font stretch amount, compared to a normal width. A percentage value between [code]50%[/code] and [code]200%[/code]. + </member> + <member name="font_weight" type="int" setter="set_font_weight" getter="get_font_weight" default="400"> + Preferred weight (boldness) of the font. A value in the [code]100...999[/code] range, normal font weight is [code]400[/code], bold font weight is [code]700[/code]. </member> <member name="force_autohinter" type="bool" setter="set_force_autohinter" getter="is_force_autohinter" default="false"> If set to [code]true[/code], auto-hinting is supported and preferred over font built-in hinting. diff --git a/doc/classes/TextServer.xml b/doc/classes/TextServer.xml index f4d92ab9b6..b3e55b5cd0 100644 --- a/doc/classes/TextServer.xml +++ b/doc/classes/TextServer.xml @@ -362,6 +362,13 @@ Returns list of the font sizes in the cache. Each size is [code]Vector2i[/code] with font size and outline size. </description> </method> + <method name="font_get_stretch" qualifiers="const"> + <return type="int" /> + <param index="0" name="font_rid" type="RID" /> + <description> + Returns font stretch amount, compared to a normal width. A percentage value between [code]50%[/code] and [code]200%[/code]. + </description> + </method> <method name="font_get_style" qualifiers="const"> <return type="int" enum="TextServer.FontStyle" /> <param index="0" name="font_rid" type="RID" /> @@ -446,6 +453,13 @@ Returns variation coordinates for the specified font cache entry. See [method font_supported_variation_list] for more info. </description> </method> + <method name="font_get_weight" qualifiers="const"> + <return type="int" /> + <param index="0" name="font_rid" type="RID" /> + <description> + Returns weight (boldness) of the font. A value in the [code]100...999[/code] range, normal font weight is [code]400[/code], bold font weight is [code]700[/code]. + </description> + </method> <method name="font_has_char" qualifiers="const"> <return type="bool" /> <param index="0" name="font_rid" type="RID" /> @@ -454,6 +468,13 @@ Returns [code]true[/code] if a Unicode [param char] is available in the font. </description> </method> + <method name="font_is_allow_system_fallback" qualifiers="const"> + <return type="bool" /> + <param index="0" name="font_rid" type="RID" /> + <description> + Returns [code]true[/code] if system fonts can be automatically used as fallbacks. + </description> + </method> <method name="font_is_force_autohinter" qualifiers="const"> <return type="bool" /> <param index="0" name="font_rid" type="RID" /> @@ -556,6 +577,14 @@ Renders the range of characters to the font cache texture. </description> </method> + <method name="font_set_allow_system_fallback"> + <return type="void" /> + <param index="0" name="font_rid" type="RID" /> + <param index="1" name="allow_system_fallback" type="bool" /> + <description> + If set to [code]true[/code], system fonts can be automatically used as fallbacks. + </description> + </method> <method name="font_set_antialiasing"> <return type="void" /> <param index="0" name="font_rid" type="RID" /> @@ -783,12 +812,22 @@ Adds override for [method font_is_script_supported]. </description> </method> + <method name="font_set_stretch"> + <return type="void" /> + <param index="0" name="font_rid" type="RID" /> + <param index="1" name="weight" type="int" /> + <description> + Sets font stretch amount, compared to a normal width. A percentage value between [code]50%[/code] and [code]200%[/code]. + [b]Note:[/b] This value is used for font matching only and will not affect font rendering. Use [method font_set_face_index], [method font_set_variation_coordinates], or [method font_set_transform] instead. + </description> + </method> <method name="font_set_style"> <return type="void" /> <param index="0" name="font_rid" type="RID" /> <param index="1" name="style" type="int" enum="TextServer.FontStyle" /> <description> Sets the font style flags, see [enum FontStyle]. + [b]Note:[/b] This value is used for font matching only and will not affect font rendering. Use [method font_set_face_index], [method font_set_variation_coordinates], [method font_set_embolden], or [method font_set_transform] instead. </description> </method> <method name="font_set_style_name"> @@ -862,6 +901,15 @@ Sets variation coordinates for the specified font cache entry. See [method font_supported_variation_list] for more info. </description> </method> + <method name="font_set_weight"> + <return type="void" /> + <param index="0" name="font_rid" type="RID" /> + <param index="1" name="weight" type="int" /> + <description> + Sets weight (boldness) of the font. A value in the [code]100...999[/code] range, normal font weight is [code]400[/code], bold font weight is [code]700[/code]. + [b]Note:[/b] This value is used for font matching only and will not affect font rendering. Use [method font_set_face_index], [method font_set_variation_coordinates], or [method font_set_embolden] instead. + </description> + </method> <method name="font_supported_feature_list" qualifiers="const"> <return type="Dictionary" /> <param index="0" name="font_rid" type="RID" /> diff --git a/doc/classes/TextServerExtension.xml b/doc/classes/TextServerExtension.xml index 37d2698dd4..4c9817fcd4 100644 --- a/doc/classes/TextServerExtension.xml +++ b/doc/classes/TextServerExtension.xml @@ -9,6 +9,11 @@ <tutorials> </tutorials> <methods> + <method name="_cleanup" qualifiers="virtual"> + <return type="void" /> + <description> + </description> + </method> <method name="_create_font" qualifiers="virtual"> <return type="RID" /> <description> @@ -306,6 +311,12 @@ <description> </description> </method> + <method name="_font_get_stretch" qualifiers="virtual const"> + <return type="int" /> + <param index="0" name="font_rid" type="RID" /> + <description> + </description> + </method> <method name="_font_get_style" qualifiers="virtual const"> <return type="int" enum="TextServer.FontStyle" /> <param index="0" name="font_rid" type="RID" /> @@ -379,6 +390,12 @@ <description> </description> </method> + <method name="_font_get_weight" qualifiers="virtual const"> + <return type="int" /> + <param index="0" name="font_rid" type="RID" /> + <description> + </description> + </method> <method name="_font_has_char" qualifiers="virtual const"> <return type="bool" /> <param index="0" name="font_rid" type="RID" /> @@ -386,6 +403,12 @@ <description> </description> </method> + <method name="_font_is_allow_system_fallback" qualifiers="virtual const"> + <return type="bool" /> + <param index="0" name="font_rid" type="RID" /> + <description> + </description> + </method> <method name="_font_is_force_autohinter" qualifiers="virtual const"> <return type="bool" /> <param index="0" name="font_rid" type="RID" /> @@ -474,6 +497,13 @@ <description> </description> </method> + <method name="_font_set_allow_system_fallback" qualifiers="virtual"> + <return type="void" /> + <param index="0" name="font_rid" type="RID" /> + <param index="1" name="allow_system_fallback" type="bool" /> + <description> + </description> + </method> <method name="_font_set_antialiasing" qualifiers="virtual"> <return type="void" /> <param index="0" name="font_rid" type="RID" /> @@ -680,6 +710,13 @@ <description> </description> </method> + <method name="_font_set_stretch" qualifiers="virtual"> + <return type="void" /> + <param index="0" name="font_rid" type="RID" /> + <param index="1" name="stretch" type="int" /> + <description> + </description> + </method> <method name="_font_set_style" qualifiers="virtual"> <return type="void" /> <param index="0" name="font_rid" type="RID" /> @@ -749,6 +786,13 @@ <description> </description> </method> + <method name="_font_set_weight" qualifiers="virtual"> + <return type="void" /> + <param index="0" name="font_rid" type="RID" /> + <param index="1" name="weight" type="int" /> + <description> + </description> + </method> <method name="_font_supported_feature_list" qualifiers="virtual const"> <return type="Dictionary" /> <param index="0" name="font_rid" type="RID" /> diff --git a/doc/classes/Vector2.xml b/doc/classes/Vector2.xml index 4156030d77..1cd73688ee 100644 --- a/doc/classes/Vector2.xml +++ b/doc/classes/Vector2.xml @@ -93,7 +93,7 @@ <param index="2" name="end" type="Vector2" /> <param index="3" name="t" type="float" /> <description> - Returns the derivative at the given [param t] on the [url=https://en.wikipedia.org/wiki/B%C3%A9zier_curve]Bezier curve[/url] defined by this vector and the given [param control_1], [param control_2], and [param end] points. + Returns the derivative at the given [param t] on the [url=https://en.wikipedia.org/wiki/B%C3%A9zier_curve]Bézier curve[/url] defined by this vector and the given [param control_1], [param control_2], and [param end] points. </description> </method> <method name="bezier_interpolate" qualifiers="const"> @@ -103,7 +103,7 @@ <param index="2" name="end" type="Vector2" /> <param index="3" name="t" type="float" /> <description> - Returns the point at the given [param t] on the [url=https://en.wikipedia.org/wiki/B%C3%A9zier_curve]Bezier curve[/url] defined by this vector and the given [param control_1], [param control_2], and [param end] points. + Returns the point at the given [param t] on the [url=https://en.wikipedia.org/wiki/B%C3%A9zier_curve]Bézier curve[/url] defined by this vector and the given [param control_1], [param control_2], and [param end] points. </description> </method> <method name="bounce" qualifiers="const"> diff --git a/doc/classes/Vector3.xml b/doc/classes/Vector3.xml index 2896408505..1d7eda6bb9 100644 --- a/doc/classes/Vector3.xml +++ b/doc/classes/Vector3.xml @@ -69,7 +69,7 @@ <param index="2" name="end" type="Vector3" /> <param index="3" name="t" type="float" /> <description> - Returns the derivative at the given [param t] on the [url=https://en.wikipedia.org/wiki/B%C3%A9zier_curve]Bezier curve[/url] defined by this vector and the given [param control_1], [param control_2], and [param end] points. + Returns the derivative at the given [param t] on the [url=https://en.wikipedia.org/wiki/B%C3%A9zier_curve]Bézier curve[/url] defined by this vector and the given [param control_1], [param control_2], and [param end] points. </description> </method> <method name="bezier_interpolate" qualifiers="const"> @@ -79,7 +79,7 @@ <param index="2" name="end" type="Vector3" /> <param index="3" name="t" type="float" /> <description> - Returns the point at the given [param t] on the [url=https://en.wikipedia.org/wiki/B%C3%A9zier_curve]Bezier curve[/url] defined by this vector and the given [param control_1], [param control_2], and [param end] points. + Returns the point at the given [param t] on the [url=https://en.wikipedia.org/wiki/B%C3%A9zier_curve]Bézier curve[/url] defined by this vector and the given [param control_1], [param control_2], and [param end] points. </description> </method> <method name="bounce" qualifiers="const"> diff --git a/doc/classes/Viewport.xml b/doc/classes/Viewport.xml index 78013a8f4b..236d34383f 100644 --- a/doc/classes/Viewport.xml +++ b/doc/classes/Viewport.xml @@ -343,6 +343,19 @@ </member> <member name="vrs_texture" type="Texture2D" setter="set_vrs_texture" getter="get_vrs_texture"> Texture to use when [member vrs_mode] is set to [constant Viewport.VRS_TEXTURE]. + The texture [i]must[/i] use a lossless compression format so that colors can be matched precisely. The following VRS densities are mapped to various colors, with brighter colors representing a lower level of shading precision: + [codeblock] + - 1x1 = rgb(0, 0, 0) - #000000 + - 1x2 = rgb(0, 85, 0) - #005500 + - 2x1 = rgb(85, 0, 0) - #550000 + - 2x2 = rgb(85, 85, 0) - #555500 + - 2x4 = rgb(85, 170, 0) - #55aa00 + - 4x2 = rgb(170, 85, 0) - #aa5500 + - 4x4 = rgb(170, 170, 0) - #aaaa00 + - 4x8 = rgb(170, 255, 0) - #aaff00 - Not supported on most hardware + - 8x4 = rgb(255, 170, 0) - #ffaa00 - Not supported on most hardware + - 8x8 = rgb(255, 255, 0) - #ffff00 - Not supported on most hardware + [/codeblock] </member> <member name="world_2d" type="World2D" setter="set_world_2d" getter="get_world_2d"> The custom [World2D] which can be used as 2D environment source. diff --git a/doc/tools/make_rst.py b/doc/tools/make_rst.py index e5a0bbb008..8960c66acc 100755 --- a/doc/tools/make_rst.py +++ b/doc/tools/make_rst.py @@ -240,7 +240,7 @@ class State: enum_def = class_def.enums[enum] else: - enum_def = EnumDef(enum, is_bitfield) + enum_def = EnumDef(enum, TypeName("int", enum), is_bitfield) class_def.enums[enum] = enum_def enum_def.values[constant_name] = constant_def @@ -458,9 +458,10 @@ class ConstantDef(DefinitionBase): class EnumDef(DefinitionBase): - def __init__(self, name: str, bitfield: bool) -> None: + def __init__(self, name: str, type_name: TypeName, bitfield: bool) -> None: super().__init__("enum", name) + self.type_name = type_name self.values: OrderedDict[str, ConstantDef] = OrderedDict() self.is_bitfield = bitfield @@ -754,7 +755,8 @@ def make_rst_class(class_def: ClassDef, state: State, dry_run: bool, output_dir: f.write(f".. _class_{class_name}:\n\n") f.write(make_heading(class_name, "=", False)) - # Inheritance tree + ### INHERITANCE TREE ### + # Ascendants if class_def.inherits: inherits = class_def.inherits.strip() @@ -788,6 +790,8 @@ def make_rst_class(class_def: ClassDef, state: State, dry_run: bool, output_dir: f.write(make_type(child, state)) f.write("\n\n") + ### INTRODUCTION ### + has_description = False # Brief description @@ -800,7 +804,9 @@ def make_rst_class(class_def: ClassDef, state: State, dry_run: bool, output_dir: if class_def.description is not None and class_def.description.strip() != "": has_description = True + f.write(".. rst-class:: classref-introduction-group\n\n") f.write(make_heading("Description", "-")) + f.write(f"{format_text_block(class_def.description.strip(), class_def, state)}\n\n") if not has_description: @@ -814,14 +820,22 @@ def make_rst_class(class_def: ClassDef, state: State, dry_run: bool, output_dir: # Online tutorials if len(class_def.tutorials) > 0: + f.write(".. rst-class:: classref-introduction-group\n\n") f.write(make_heading("Tutorials", "-")) + for url, title in class_def.tutorials: f.write(f"- {make_link(url, title)}\n\n") - # Properties overview + ### REFERENCE TABLES ### + + # Reused container for reference tables. ml: List[Tuple[Optional[str], ...]] = [] + + # Properties reference table if len(class_def.properties) > 0: + f.write(".. rst-class:: classref-reftable-group\n\n") f.write(make_heading("Properties", "-")) + ml = [] for property_def in class_def.properties.values(): type_rst = property_def.type_name.to_rst(state) @@ -833,76 +847,108 @@ def make_rst_class(class_def: ClassDef, state: State, dry_run: bool, output_dir: else: ref = f":ref:`{property_def.name}<class_{class_name}_property_{property_def.name}>`" ml.append((type_rst, ref, default)) + format_table(f, ml, True) - # Constructors, Methods, Operators overview + # Constructors, Methods, Operators reference tables if len(class_def.constructors) > 0: + f.write(".. rst-class:: classref-reftable-group\n\n") f.write(make_heading("Constructors", "-")) + ml = [] for method_list in class_def.constructors.values(): for m in method_list: ml.append(make_method_signature(class_def, m, "constructor", state)) + format_table(f, ml) if len(class_def.methods) > 0: + f.write(".. rst-class:: classref-reftable-group\n\n") f.write(make_heading("Methods", "-")) + ml = [] for method_list in class_def.methods.values(): for m in method_list: ml.append(make_method_signature(class_def, m, "method", state)) + format_table(f, ml) if len(class_def.operators) > 0: + f.write(".. rst-class:: classref-reftable-group\n\n") f.write(make_heading("Operators", "-")) + ml = [] for method_list in class_def.operators.values(): for m in method_list: ml.append(make_method_signature(class_def, m, "operator", state)) + format_table(f, ml) - # Theme properties + # Theme properties reference table if len(class_def.theme_items) > 0: + f.write(".. rst-class:: classref-reftable-group\n\n") f.write(make_heading("Theme Properties", "-")) - pl: List[Tuple[Optional[str], ...]] = [] + + ml = [] for theme_item_def in class_def.theme_items.values(): ref = f":ref:`{theme_item_def.name}<class_{class_name}_theme_{theme_item_def.data_name}_{theme_item_def.name}>`" - pl.append((theme_item_def.type_name.to_rst(state), ref, theme_item_def.default_value)) - format_table(f, pl, True) + ml.append((theme_item_def.type_name.to_rst(state), ref, theme_item_def.default_value)) + + format_table(f, ml, True) - # Signals + ### DETAILED DESCRIPTIONS ### + + # Signal descriptions if len(class_def.signals) > 0: + f.write(make_separator(True)) + f.write(".. rst-class:: classref-descriptions-group\n\n") f.write(make_heading("Signals", "-")) + index = 0 for signal in class_def.signals.values(): if index != 0: - f.write("----\n\n") + f.write(make_separator()) + + # Create signal signature and anchor point. f.write(f".. _class_{class_name}_signal_{signal.name}:\n\n") + f.write(".. rst-class:: classref-signal\n\n") + _, signature = make_method_signature(class_def, signal, "", state) - f.write(f"- {signature}\n\n") + f.write(f"{signature}\n\n") + + # Add signal description, or a call to action if it's missing. if signal.description is not None and signal.description.strip() != "": f.write(f"{format_text_block(signal.description.strip(), signal, state)}\n\n") + else: + f.write(".. container:: contribute\n\n\t") + f.write( + translate( + "There is currently no description for this signal. Please help us by :ref:`contributing one <doc_updating_the_class_reference>`!" + ) + + "\n\n" + ) index += 1 - # Enums + # Enumeration descriptions if len(class_def.enums) > 0: + f.write(make_separator(True)) + f.write(".. rst-class:: classref-descriptions-group\n\n") f.write(make_heading("Enumerations", "-")) + index = 0 for e in class_def.enums.values(): if index != 0: - f.write("----\n\n") + f.write(make_separator()) + + # Create enumeration signature and anchor point. f.write(f".. _enum_{class_name}_{e.name}:\n\n") - # Sphinx seems to divide the bullet list into individual <ul> tags if we weave the labels into it. - # As such I'll put them all above the list. Won't be perfect but better than making the list visually broken. - # As to why I'm not modifying the reference parser to directly link to the _enum label: - # If somebody gets annoyed enough to fix it, all existing references will magically improve. - for value in e.values.values(): - f.write(f".. _class_{class_name}_constant_{value.name}:\n\n") + f.write(".. rst-class:: classref-enumeration\n\n") if e.is_bitfield: f.write(f"flags **{e.name}**:\n\n") @@ -910,45 +956,66 @@ def make_rst_class(class_def: ClassDef, state: State, dry_run: bool, output_dir: f.write(f"enum **{e.name}**:\n\n") for value in e.values.values(): - f.write(f"- **{value.name}** = **{value.value}**") + # Also create signature and anchor point for each enum constant. + + f.write(f".. _class_{class_name}_constant_{value.name}:\n\n") + f.write(".. rst-class:: classref-enumeration-constant\n\n") + + f.write(f"{e.type_name.to_rst(state)} **{value.name}** = ``{value.value}``\n\n") + + # Add enum constant description. + if value.text is not None and value.text.strip() != "": - # If value.text contains a bullet point list, each entry needs additional indentation - f.write(f" --- {indent_bullets(format_text_block(value.text.strip(), value, state))}") + f.write(f"{format_text_block(value.text.strip(), value, state)}") f.write("\n\n") index += 1 - # Constants + # Constant descriptions if len(class_def.constants) > 0: + f.write(make_separator(True)) + f.write(".. rst-class:: classref-descriptions-group\n\n") f.write(make_heading("Constants", "-")) - # Sphinx seems to divide the bullet list into individual <ul> tags if we weave the labels into it. - # As such I'll put them all above the list. Won't be perfect but better than making the list visually broken. + for constant in class_def.constants.values(): + # Create constant signature and anchor point. + f.write(f".. _class_{class_name}_constant_{constant.name}:\n\n") + f.write(".. rst-class:: classref-constant\n\n") + + f.write(f"**{constant.name}** = ``{constant.value}``\n\n") + + # Add enum constant description. - for constant in class_def.constants.values(): - f.write(f"- **{constant.name}** = **{constant.value}**") if constant.text is not None and constant.text.strip() != "": - f.write(f" --- {format_text_block(constant.text.strip(), constant, state)}") + f.write(f"{format_text_block(constant.text.strip(), constant, state)}") f.write("\n\n") - # Annotations + # Annotation descriptions if len(class_def.annotations) > 0: + f.write(make_separator(True)) f.write(make_heading("Annotations", "-")) + index = 0 for method_list in class_def.annotations.values(): # type: ignore for i, m in enumerate(method_list): if index != 0: - f.write("----\n\n") + f.write(make_separator()) + + # Create annotation signature and anchor point. if i == 0: f.write(f".. _class_{class_name}_annotation_{m.name}:\n\n") + f.write(".. rst-class:: classref-annotation\n\n") + _, signature = make_method_signature(class_def, m, "", state) - f.write(f"- {signature}\n\n") + f.write(f"{signature}\n\n") + + # Add annotation description, or a call to action if it's missing. if m.description is not None and m.description.strip() != "": f.write(f"{format_text_block(m.description.strip(), m, state)}\n\n") @@ -965,7 +1032,10 @@ def make_rst_class(class_def: ClassDef, state: State, dry_run: bool, output_dir: # Property descriptions if any(not p.overrides for p in class_def.properties.values()) > 0: + f.write(make_separator(True)) + f.write(".. rst-class:: classref-descriptions-group\n\n") f.write(make_heading("Property Descriptions", "-")) + index = 0 for property_def in class_def.properties.values(): @@ -973,22 +1043,36 @@ def make_rst_class(class_def: ClassDef, state: State, dry_run: bool, output_dir: continue if index != 0: - f.write("----\n\n") + f.write(make_separator()) + + # Create property signature and anchor point. f.write(f".. _class_{class_name}_property_{property_def.name}:\n\n") - f.write(f"- {property_def.type_name.to_rst(state)} **{property_def.name}**\n\n") + f.write(".. rst-class:: classref-property\n\n") - info: List[Tuple[Optional[str], ...]] = [] - # Not using translate() for now as it breaks table formatting. + property_default = "" if property_def.default_value is not None: - info.append(("*Default*", property_def.default_value)) + property_default = f" = {property_def.default_value}" + f.write(f"{property_def.type_name.to_rst(state)} **{property_def.name}**{property_default}\n\n") + + # Create property setter and getter records. + + property_setget = "" + if property_def.setter is not None and not property_def.setter.startswith("_"): - info.append(("*Setter*", f"{property_def.setter}(value)")) + property_setter = make_setter_signature(class_def, property_def, state) + property_setget += f"- {property_setter}\n" + if property_def.getter is not None and not property_def.getter.startswith("_"): - info.append(("*Getter*", f"{property_def.getter}()")) + property_getter = make_getter_signature(class_def, property_def, state) + property_setget += f"- {property_getter}\n" + + if property_setget != "": + f.write(".. rst-class:: classref-property-setget\n\n") + f.write(property_setget) + f.write("\n") - if len(info) > 0: - format_table(f, info) + # Add property description, or a call to action if it's missing. if property_def.text is not None and property_def.text.strip() != "": f.write(f"{format_text_block(property_def.text.strip(), property_def, state)}\n\n") @@ -1005,19 +1089,28 @@ def make_rst_class(class_def: ClassDef, state: State, dry_run: bool, output_dir: # Constructor, Method, Operator descriptions if len(class_def.constructors) > 0: + f.write(make_separator(True)) + f.write(".. rst-class:: classref-descriptions-group\n\n") f.write(make_heading("Constructor Descriptions", "-")) + index = 0 for method_list in class_def.constructors.values(): for i, m in enumerate(method_list): if index != 0: - f.write("----\n\n") + f.write(make_separator()) + + # Create constructor signature and anchor point. if i == 0: f.write(f".. _class_{class_name}_constructor_{m.name}:\n\n") + f.write(".. rst-class:: classref-constructor\n\n") + ret_type, signature = make_method_signature(class_def, m, "", state) - f.write(f"- {ret_type} {signature}\n\n") + f.write(f"{ret_type} {signature}\n\n") + + # Add constructor description, or a call to action if it's missing. if m.description is not None and m.description.strip() != "": f.write(f"{format_text_block(m.description.strip(), m, state)}\n\n") @@ -1033,19 +1126,28 @@ def make_rst_class(class_def: ClassDef, state: State, dry_run: bool, output_dir: index += 1 if len(class_def.methods) > 0: + f.write(make_separator(True)) + f.write(".. rst-class:: classref-descriptions-group\n\n") f.write(make_heading("Method Descriptions", "-")) + index = 0 for method_list in class_def.methods.values(): for i, m in enumerate(method_list): if index != 0: - f.write("----\n\n") + f.write(make_separator()) + + # Create method signature and anchor point. if i == 0: f.write(f".. _class_{class_name}_method_{m.name}:\n\n") + f.write(".. rst-class:: classref-method\n\n") + ret_type, signature = make_method_signature(class_def, m, "", state) - f.write(f"- {ret_type} {signature}\n\n") + f.write(f"{ret_type} {signature}\n\n") + + # Add method description, or a call to action if it's missing. if m.description is not None and m.description.strip() != "": f.write(f"{format_text_block(m.description.strip(), m, state)}\n\n") @@ -1061,20 +1163,31 @@ def make_rst_class(class_def: ClassDef, state: State, dry_run: bool, output_dir: index += 1 if len(class_def.operators) > 0: + f.write(make_separator(True)) + f.write(".. rst-class:: classref-descriptions-group\n\n") f.write(make_heading("Operator Descriptions", "-")) + index = 0 for method_list in class_def.operators.values(): for i, m in enumerate(method_list): if index != 0: - f.write("----\n\n") - out = f".. _class_{class_name}_operator_{sanitize_operator_name(m.name, state)}" + f.write(make_separator()) + + # Create operator signature and anchor point. + + operator_anchor = f".. _class_{class_name}_operator_{sanitize_operator_name(m.name, state)}" for parameter in m.parameters: - out += f"_{parameter.type_name.type_name}" - out += f":\n\n" - f.write(out) + operator_anchor += f"_{parameter.type_name.type_name}" + operator_anchor += f":\n\n" + f.write(operator_anchor) + + f.write(".. rst-class:: classref-operator\n\n") + ret_type, signature = make_method_signature(class_def, m, "", state) - f.write(f"- {ret_type} {signature}\n\n") + f.write(f"{ret_type} {signature}\n\n") + + # Add operator description, or a call to action if it's missing. if m.description is not None and m.description.strip() != "": f.write(f"{format_text_block(m.description.strip(), m, state)}\n\n") @@ -1091,23 +1204,27 @@ def make_rst_class(class_def: ClassDef, state: State, dry_run: bool, output_dir: # Theme property descriptions if len(class_def.theme_items) > 0: + f.write(make_separator(True)) + f.write(".. rst-class:: classref-descriptions-group\n\n") f.write(make_heading("Theme Property Descriptions", "-")) + index = 0 for theme_item_def in class_def.theme_items.values(): if index != 0: - f.write("----\n\n") + f.write(make_separator()) + + # Create theme property signature and anchor point. f.write(f".. _class_{class_name}_theme_{theme_item_def.data_name}_{theme_item_def.name}:\n\n") - f.write(f"- {theme_item_def.type_name.to_rst(state)} **{theme_item_def.name}**\n\n") + f.write(".. rst-class:: classref-themeproperty\n\n") - info = [] + theme_item_default = "" if theme_item_def.default_value is not None: - # Not using translate() for now as it breaks table formatting. - info.append(("*Default*", theme_item_def.default_value)) + theme_item_default = f" = {theme_item_def.default_value}" + f.write(f"{theme_item_def.type_name.to_rst(state)} **{theme_item_def.name}**{theme_item_default}\n\n") - if len(info) > 0: - format_table(f, info) + # Add theme property description, or a call to action if it's missing. if theme_item_def.text is not None and theme_item_def.text.strip() != "": f.write(f"{format_text_block(theme_item_def.text.strip(), theme_item_def, state)}\n\n") @@ -1216,6 +1333,39 @@ def make_method_signature( return ret_type, out +def make_setter_signature(class_def: ClassDef, property_def: PropertyDef, state: State) -> str: + if property_def.setter is None: + return "" + + # If setter is a method available as a method definition, we use that. + if property_def.setter in class_def.methods: + setter = class_def.methods[property_def.setter][0] + # Otherwise we fake it with the information we have available. + else: + setter_params: List[ParameterDef] = [] + setter_params.append(ParameterDef("value", property_def.type_name, None)) + setter = MethodDef(property_def.setter, TypeName("void"), setter_params, None, None) + + ret_type, signature = make_method_signature(class_def, setter, "", state) + return f"{ret_type} {signature}" + + +def make_getter_signature(class_def: ClassDef, property_def: PropertyDef, state: State) -> str: + if property_def.getter is None: + return "" + + # If getter is a method available as a method definition, we use that. + if property_def.getter in class_def.methods: + getter = class_def.methods[property_def.getter][0] + # Otherwise we fake it with the information we have available. + else: + getter_params: List[ParameterDef] = [] + getter = MethodDef(property_def.getter, property_def.type_name, getter_params, None, None) + + ret_type, signature = make_method_signature(class_def, getter, "", state) + return f"{ret_type} {signature}" + + def make_heading(title: str, underline: str, l10n: bool = True) -> str: if l10n: new_title = translate(title) @@ -1247,6 +1397,14 @@ def make_footer() -> str: ) +def make_separator(section_level: bool = False) -> str: + separator_class = "item" + if section_level: + separator_class = "section" + + return f".. rst-class:: classref-{separator_class}-separator\n\n----\n\n" + + def make_link(url: str, title: str) -> str: match = GODOT_DOCS_PATTERN.search(url) if match: @@ -1409,8 +1567,8 @@ def format_text_block( # Tag is a reference to a class. if tag_text in state.classes: if tag_text == state.current_class: - # Don't create a link to the same class, format it as inline code. - tag_text = f"``{tag_text}``" + # Don't create a link to the same class, format it as strong emphasis. + tag_text = f"**{tag_text}**" else: tag_text = make_type(tag_text, state) escape_pre = True @@ -1872,6 +2030,11 @@ def format_table(f: TextIO, data: List[Tuple[Optional[str], ...]], remove_empty_ if len(data) == 0: return + f.write(".. table::\n") + f.write(" :widths: auto\n\n") + + # Calculate the width of each column first, we will use this information + # to properly format RST-style tables. column_sizes = [0] * len(data[0]) for row in data: for i, text in enumerate(row): @@ -1879,14 +2042,21 @@ def format_table(f: TextIO, data: List[Tuple[Optional[str], ...]], remove_empty_ if text_length > column_sizes[i]: column_sizes[i] = text_length + # Each table row is wrapped in two separators, consecutive rows share the same separator. + # All separators, or rather borders, have the same shape and content. We compose it once, + # then reuse it. + sep = "" for size in column_sizes: if size == 0 and remove_empty_columns: continue - sep += "+" + "-" * (size + 2) + sep += "+" + "-" * (size + 2) # Content of each cell is padded by 1 on each side. sep += "+\n" - f.write(sep) + # Draw the first separator. + f.write(f" {sep}") + + # Draw each row and close it with a separator. for row in data: row_text = "|" for i, text in enumerate(row): @@ -1894,8 +2064,10 @@ def format_table(f: TextIO, data: List[Tuple[Optional[str], ...]], remove_empty_ continue row_text += f' {(text or "").ljust(column_sizes[i])} |' row_text += "\n" - f.write(row_text) - f.write(sep) + + f.write(f" {row_text}") + f.write(f" {sep}") + f.write("\n") @@ -1957,24 +2129,5 @@ def sanitize_operator_name(dirty_name: str, state: State) -> str: return clear_name -def indent_bullets(text: str) -> str: - # Take the text and check each line for a bullet point represented by "-". - # Where found, indent the given line by a further "\t". - # Used to properly indent bullet points contained in the description for enum values. - # Ignore the first line - text will be prepended to it so bullet points wouldn't work anyway. - bullet_points = "-" - - lines = text.splitlines(keepends=True) - for line_index, line in enumerate(lines[1:], start=1): - pos = 0 - while pos < len(line) and line[pos] == "\t": - pos += 1 - - if pos < len(line) and line[pos] in bullet_points: - lines[line_index] = f"{line[:pos]}\t{line[pos:]}" - - return "".join(lines) - - if __name__ == "__main__": main() diff --git a/drivers/gles3/rasterizer_canvas_gles3.cpp b/drivers/gles3/rasterizer_canvas_gles3.cpp index 07d56b156c..e5d4077393 100644 --- a/drivers/gles3/rasterizer_canvas_gles3.cpp +++ b/drivers/gles3/rasterizer_canvas_gles3.cpp @@ -106,6 +106,7 @@ void RasterizerCanvasGLES3::_update_transform_to_mat4(const Transform3D &p_trans void RasterizerCanvasGLES3::canvas_render_items(RID p_to_render_target, Item *p_item_list, const Color &p_modulate, Light *p_light_list, Light *p_directional_light_list, const Transform2D &p_canvas_transform, RS::CanvasItemTextureFilter p_default_filter, RS::CanvasItemTextureRepeat p_default_repeat, bool p_snap_2d_vertices_to_pixel, bool &r_sdf_used) { GLES3::TextureStorage *texture_storage = GLES3::TextureStorage::get_singleton(); GLES3::MaterialStorage *material_storage = GLES3::MaterialStorage::get_singleton(); + GLES3::MeshStorage *mesh_storage = GLES3::MeshStorage::get_singleton(); Transform2D canvas_transform_inverse = p_canvas_transform.affine_inverse(); @@ -311,9 +312,14 @@ void RasterizerCanvasGLES3::canvas_render_items(RID p_to_render_target, Item *p_ Size2i ssize = texture_storage->render_target_get_size(p_to_render_target); + // If we've overridden the render target's color texture, then we need + // to invert the Y axis, so 2D texture appear right side up. + // We're probably rendering directly to an XR device. + float y_scale = texture_storage->render_target_get_override_color(p_to_render_target).is_valid() ? -2.0f : 2.0f; + Transform3D screen_transform; screen_transform.translate_local(-(ssize.width / 2.0f), -(ssize.height / 2.0f), 0.0f); - screen_transform.scale(Vector3(2.0f / ssize.width, 2.0f / ssize.height, 1.0f)); + screen_transform.scale(Vector3(2.0f / ssize.width, y_scale / ssize.height, 1.0f)); _update_transform_to_mat4(screen_transform, state_buffer.screen_transform); _update_transform_2d_to_mat4(p_canvas_transform, state_buffer.canvas_transform); @@ -384,6 +390,7 @@ void RasterizerCanvasGLES3::canvas_render_items(RID p_to_render_target, Item *p_ Rect2 back_buffer_rect; bool backbuffer_copy = false; bool backbuffer_gen_mipmaps = false; + bool update_skeletons = false; Item *ci = p_item_list; Item *canvas_group_owner = nullptr; @@ -425,8 +432,27 @@ void RasterizerCanvasGLES3::canvas_render_items(RID p_to_render_target, Item *p_ } } + if (ci->skeleton.is_valid()) { + const Item::Command *c = ci->commands; + + while (c) { + if (c->type == Item::Command::TYPE_MESH) { + const Item::CommandMesh *cm = static_cast<const Item::CommandMesh *>(c); + if (cm->mesh_instance.is_valid()) { + mesh_storage->mesh_instance_check_for_update(cm->mesh_instance); + update_skeletons = true; + } + } + c = c->next; + } + } + if (ci->canvas_group_owner != nullptr) { if (canvas_group_owner == nullptr) { + if (update_skeletons) { + mesh_storage->update_mesh_instances(); + update_skeletons = false; + } // Canvas group begins here, render until before this item _render_items(p_to_render_target, item_count, canvas_transform_inverse, p_light_list, starting_index, false); item_count = 0; @@ -455,6 +481,10 @@ void RasterizerCanvasGLES3::canvas_render_items(RID p_to_render_target, Item *p_ } if (ci == canvas_group_owner) { + if (update_skeletons) { + mesh_storage->update_mesh_instances(); + update_skeletons = false; + } _render_items(p_to_render_target, item_count, canvas_transform_inverse, p_light_list, starting_index, true); item_count = 0; @@ -468,6 +498,10 @@ void RasterizerCanvasGLES3::canvas_render_items(RID p_to_render_target, Item *p_ } if (backbuffer_copy) { + if (update_skeletons) { + mesh_storage->update_mesh_instances(); + update_skeletons = false; + } //render anything pending, including clearing if no items _render_items(p_to_render_target, item_count, canvas_transform_inverse, p_light_list, starting_index, false); @@ -492,6 +526,10 @@ void RasterizerCanvasGLES3::canvas_render_items(RID p_to_render_target, Item *p_ items[item_count++] = ci; if (!ci->next || item_count == MAX_RENDER_ITEMS - 1) { + if (update_skeletons) { + mesh_storage->update_mesh_instances(); + update_skeletons = false; + } _render_items(p_to_render_target, item_count, canvas_transform_inverse, p_light_list, starting_index, false); //then reset item_count = 0; diff --git a/drivers/gles3/rasterizer_scene_gles3.cpp b/drivers/gles3/rasterizer_scene_gles3.cpp index 026ec85e6b..2743801466 100644 --- a/drivers/gles3/rasterizer_scene_gles3.cpp +++ b/drivers/gles3/rasterizer_scene_gles3.cpp @@ -420,6 +420,11 @@ void RasterizerSceneGLES3::_geometry_instance_update(RenderGeometryInstance *p_g } } else if (ginstance->data->base_type == RS::INSTANCE_MESH) { + if (mesh_storage->skeleton_is_valid(ginstance->data->skeleton)) { + if (ginstance->data->dirty_dependencies) { + mesh_storage->skeleton_update_dependency(ginstance->data->skeleton, &ginstance->data->dependency_tracker); + } + } } ginstance->store_transform_cache = store_transform; @@ -1316,6 +1321,7 @@ void RasterizerSceneGLES3::_setup_environment(const RenderDataGLES3 *p_render_da GLES3::MaterialStorage::store_camera(projection.inverse(), scene_state.ubo.inv_projection_matrix); GLES3::MaterialStorage::store_transform(p_render_data->cam_transform, scene_state.ubo.inv_view_matrix); GLES3::MaterialStorage::store_transform(p_render_data->inv_cam_transform, scene_state.ubo.view_matrix); + scene_state.ubo.camera_visible_layers = p_render_data->camera_visible_layers; if (p_render_data->view_count > 1) { for (uint32_t v = 0; v < p_render_data->view_count; v++) { @@ -1700,6 +1706,7 @@ void RasterizerSceneGLES3::render_scene(const Ref<RenderSceneBuffers> &p_render_ render_data.inv_cam_transform = render_data.cam_transform.affine_inverse(); render_data.cam_projection = p_camera_data->main_projection; render_data.cam_orthogonal = p_camera_data->is_orthogonal; + render_data.camera_visible_layers = p_camera_data->visible_layers; render_data.view_count = p_camera_data->view_count; for (uint32_t v = 0; v < p_camera_data->view_count; v++) { diff --git a/drivers/gles3/rasterizer_scene_gles3.h b/drivers/gles3/rasterizer_scene_gles3.h index 6e1f1babf8..cd1f44e679 100644 --- a/drivers/gles3/rasterizer_scene_gles3.h +++ b/drivers/gles3/rasterizer_scene_gles3.h @@ -93,6 +93,7 @@ struct RenderDataGLES3 { Transform3D inv_cam_transform; Projection cam_projection; bool cam_orthogonal = false; + uint32_t camera_visible_layers = 0xFFFFFFFF; // For stereo rendering uint32_t view_count = 1; @@ -333,6 +334,10 @@ private: float fog_light_color[3]; float fog_sun_scatter; + uint32_t camera_visible_layers; + uint32_t pad1; + uint32_t pad2; + uint32_t pad3; }; static_assert(sizeof(UBO) % 16 == 0, "Scene UBO size must be a multiple of 16 bytes"); diff --git a/drivers/gles3/shaders/SCsub b/drivers/gles3/shaders/SCsub index 2686b1aa48..34713e7e29 100644 --- a/drivers/gles3/shaders/SCsub +++ b/drivers/gles3/shaders/SCsub @@ -21,3 +21,4 @@ if "GLES3_GLSL" in env["BUILDERS"]: env.GLES3_GLSL("canvas_sdf.glsl") env.GLES3_GLSL("particles.glsl") env.GLES3_GLSL("particles_copy.glsl") + env.GLES3_GLSL("skeleton.glsl") diff --git a/drivers/gles3/shaders/canvas.glsl b/drivers/gles3/shaders/canvas.glsl index cdae05a516..a61ea1587d 100644 --- a/drivers/gles3/shaders/canvas.glsl +++ b/drivers/gles3/shaders/canvas.glsl @@ -19,9 +19,6 @@ layout(location = 0) in vec2 vertex_attrib; layout(location = 3) in vec4 color_attrib; layout(location = 4) in vec2 uv_attrib; -layout(location = 10) in uvec4 bone_attrib; -layout(location = 11) in vec4 weight_attrib; - #ifdef USE_INSTANCING layout(location = 1) in highp vec4 instance_xform0; @@ -81,8 +78,6 @@ void main() { uv = draw_data[draw_data_instance].uv_c; color = vec4(unpackHalf2x16(draw_data[draw_data_instance].color_c_rg), unpackHalf2x16(draw_data[draw_data_instance].color_c_ba)); } - uvec4 bones = uvec4(0, 0, 0, 0); - vec4 bone_weights = vec4(0.0); #elif defined(USE_ATTRIBUTES) draw_data_instance = gl_InstanceID; @@ -93,9 +88,6 @@ void main() { vec4 color = color_attrib * draw_data[draw_data_instance].modulation; vec2 uv = uv_attrib; - uvec4 bones = bone_attrib; - vec4 bone_weights = weight_attrib; - #ifdef USE_INSTANCING vec4 instance_color = vec4(unpackHalf2x16(instance_color_custom_data.x), unpackHalf2x16(instance_color_custom_data.y)); color *= instance_color; @@ -110,7 +102,6 @@ void main() { vec2 uv = draw_data[draw_data_instance].src_rect.xy + abs(draw_data[draw_data_instance].src_rect.zw) * ((draw_data[draw_data_instance].flags & FLAGS_TRANSPOSE_RECT) != uint(0) ? vertex_base.yx : vertex_base.xy); vec4 color = draw_data[draw_data_instance].modulation; vec2 vertex = draw_data[draw_data_instance].dst_rect.xy + abs(draw_data[draw_data_instance].dst_rect.zw) * mix(vertex_base, vec2(1.0, 1.0) - vertex_base, lessThan(draw_data[draw_data_instance].src_rect.zw, vec2(0.0, 0.0))); - uvec4 bones = uvec4(0, 0, 0, 0); #endif @@ -297,11 +288,9 @@ vec3 light_normal_compute(vec3 light_vec, vec3 normal, vec3 base_color, vec3 lig #endif -#define SHADOW_TEST(m_uv) \ - { \ - highp float sd = SHADOW_DEPTH(m_uv); \ - shadow += step(sd, shadow_uv.z / shadow_uv.w); \ - } +/* clang-format off */ +#define SHADOW_TEST(m_uv) { highp float sd = SHADOW_DEPTH(m_uv); shadow += step(sd, shadow_uv.z / shadow_uv.w); } +/* clang-format on */ //float distance = length(shadow_pos); vec4 light_shadow_compute(uint light_base, vec4 light_color, vec4 shadow_uv @@ -341,7 +330,7 @@ vec4 light_shadow_compute(uint light_base, vec4 light_color, vec4 shadow_uv shadow /= 13.0; } - vec4 shadow_color = unpackUnorm4x8(light_array[light_base].shadow_color); + vec4 shadow_color = godot_unpackUnorm4x8(light_array[light_base].shadow_color); #ifdef LIGHT_CODE_USED shadow_color.rgb *= shadow_modulate; #endif @@ -508,7 +497,7 @@ void main() { if (specular_shininess_used || (using_light && normal_used && bool(draw_data[draw_data_instance].flags & FLAGS_DEFAULT_SPECULAR_MAP_USED))) { specular_shininess = texture(specular_texture, uv); - specular_shininess *= unpackUnorm4x8(draw_data[draw_data_instance].specular_shininess); + specular_shininess *= godot_unpackUnorm4x8(draw_data[draw_data_instance].specular_shininess); specular_shininess_used = true; } else { specular_shininess = vec4(1.0); diff --git a/drivers/gles3/shaders/scene.glsl b/drivers/gles3/shaders/scene.glsl index 04dba602dd..32557d3314 100644 --- a/drivers/gles3/shaders/scene.glsl +++ b/drivers/gles3/shaders/scene.glsl @@ -129,7 +129,7 @@ layout(std140) uniform SceneData { // ubo:2 mediump float ambient_color_sky_mix; bool material_uv2_mode; - float pad2; + float emissive_exposure_normalization; bool use_ambient_light; bool use_ambient_cubemap; bool use_reflection_cubemap; @@ -142,7 +142,7 @@ layout(std140) uniform SceneData { // ubo:2 uint directional_light_count; float z_far; float z_near; - float pad; + float IBL_exposure_normalization; bool fog_enabled; float fog_density; @@ -151,6 +151,10 @@ layout(std140) uniform SceneData { // ubo:2 vec3 fog_light_color; float fog_sun_scatter; + uint camera_visible_layers; + uint pad3; + uint pad4; + uint pad5; } scene_data; @@ -455,7 +459,7 @@ layout(std140) uniform SceneData { // ubo:2 mediump float ambient_color_sky_mix; bool material_uv2_mode; - float pad2; + float emissive_exposure_normalization; bool use_ambient_light; bool use_ambient_cubemap; bool use_reflection_cubemap; @@ -468,7 +472,7 @@ layout(std140) uniform SceneData { // ubo:2 uint directional_light_count; float z_far; float z_near; - float pad; + float IBL_exposure_normalization; bool fog_enabled; float fog_density; @@ -477,6 +481,10 @@ layout(std140) uniform SceneData { // ubo:2 vec3 fog_light_color; float fog_sun_scatter; + uint camera_visible_layers; + uint pad3; + uint pad4; + uint pad5; } scene_data; @@ -1100,7 +1108,7 @@ void main() { ref_vec = mix(ref_vec, normal, roughness * roughness); float horizon = min(1.0 + dot(ref_vec, normal), 1.0); ref_vec = scene_data.radiance_inverse_xform * ref_vec; - specular_light = textureLod(radiance_map, ref_vec, roughness * RADIANCE_MAX_LOD).rgb; + specular_light = textureLod(radiance_map, ref_vec, sqrt(roughness) * RADIANCE_MAX_LOD).rgb; specular_light = srgb_to_linear(specular_light); specular_light *= horizon * horizon; specular_light *= scene_data.ambient_light_color_energy.a; @@ -1162,7 +1170,7 @@ void main() { float a004 = min(r.x * r.x, exp2(-9.28 * ndotv)) * r.x + r.y; vec2 env = vec2(-1.04, 1.04) * a004 + r.zw; - specular_light *= env.x * f0 + env.y * clamp(50.0 * f0.g, 0.0, 1.0); + specular_light *= env.x * f0 + env.y * clamp(50.0 * f0.g, metallic, 1.0); #endif } diff --git a/drivers/gles3/shaders/skeleton.glsl b/drivers/gles3/shaders/skeleton.glsl new file mode 100644 index 0000000000..a1e3c098f4 --- /dev/null +++ b/drivers/gles3/shaders/skeleton.glsl @@ -0,0 +1,269 @@ +/* clang-format off */ +#[modes] + +mode_base_pass = +mode_blend_pass = #define MODE_BLEND_PASS + +#[specializations] + +MODE_2D = true +USE_BLEND_SHAPES = false +USE_SKELETON = false +USE_NORMAL = false +USE_TANGENT = false +FINAL_PASS = false +USE_EIGHT_WEIGHTS = false + +#[vertex] + +#include "stdlib_inc.glsl" + +#ifdef MODE_2D +#define VFORMAT vec2 +#else +#define VFORMAT vec3 +#endif + +#ifdef FINAL_PASS +#define OFORMAT vec2 +#else +#define OFORMAT uvec2 +#endif + +// These come from the source mesh and the output from previous passes. +layout(location = 0) in highp VFORMAT in_vertex; +#ifdef MODE_BLEND_PASS +#ifdef USE_NORMAL +layout(location = 1) in highp uvec2 in_normal; +#endif +#ifdef USE_TANGENT +layout(location = 2) in highp uvec2 in_tangent; +#endif +#else // MODE_BLEND_PASS +#ifdef USE_NORMAL +layout(location = 1) in highp vec2 in_normal; +#endif +#ifdef USE_TANGENT +layout(location = 2) in highp vec2 in_tangent; +#endif +#endif // MODE_BLEND_PASS + +#ifdef USE_SKELETON +#ifdef USE_EIGHT_WEIGHTS +layout(location = 10) in highp uvec4 in_bone_attrib; +layout(location = 11) in highp uvec4 in_bone_attrib2; +layout(location = 12) in mediump vec4 in_weight_attrib; +layout(location = 13) in mediump vec4 in_weight_attrib2; +#else +layout(location = 10) in highp uvec4 in_bone_attrib; +layout(location = 11) in mediump vec4 in_weight_attrib; +#endif + +uniform mediump sampler2D skeleton_texture; // texunit:0 +#endif + +/* clang-format on */ +#ifdef MODE_BLEND_PASS +layout(location = 3) in highp VFORMAT blend_vertex; +#ifdef USE_NORMAL +layout(location = 4) in highp vec2 blend_normal; +#endif +#ifdef USE_TANGENT +layout(location = 5) in highp vec2 blend_tangent; +#endif +#endif // MODE_BLEND_PASS + +out highp VFORMAT out_vertex; //tfb: + +#ifdef USE_NORMAL +flat out highp OFORMAT out_normal; //tfb:USE_NORMAL +#endif +#ifdef USE_TANGENT +flat out highp OFORMAT out_tangent; //tfb:USE_TANGENT +#endif + +#ifdef USE_BLEND_SHAPES +uniform highp float blend_weight; +uniform lowp float blend_shape_count; +#endif + +vec2 signNotZero(vec2 v) { + return mix(vec2(-1.0), vec2(1.0), greaterThanEqual(v.xy, vec2(0.0))); +} + +vec3 oct_to_vec3(vec2 oct) { + oct = oct * 2.0 - 1.0; + vec3 v = vec3(oct.xy, 1.0 - abs(oct.x) - abs(oct.y)); + if (v.z < 0.0) { + v.xy = (1.0 - abs(v.yx)) * signNotZero(v.xy); + } + return normalize(v); +} + +vec2 vec3_to_oct(vec3 e) { + e /= abs(e.x) + abs(e.y) + abs(e.z); + vec2 oct = e.z >= 0.0f ? e.xy : (vec2(1.0f) - abs(e.yx)) * signNotZero(e.xy); + return oct * 0.5f + 0.5f; +} + +vec4 oct_to_tang(vec2 oct_sign_encoded) { + // Binormal sign encoded in y component + vec2 oct = vec2(oct_sign_encoded.x, abs(oct_sign_encoded.y) * 2.0 - 1.0); + return vec4(oct_to_vec3(oct), sign(oct_sign_encoded.y)); +} + +vec2 tang_to_oct(vec4 base) { + vec2 oct = vec3_to_oct(base.xyz); + // Encode binormal sign in y component + oct.y = oct.y * 0.5f + 0.5f; + oct.y = base.w >= 0.0f ? oct.y : 1.0 - oct.y; + return oct; +} + +// Our original input for normals and tangents is 2 16-bit floats. +// Transform Feedback has to write out 32-bits per channel. +// Octahedral compression requires normalized vectors, but we need to store +// non-normalized vectors until the very end. +// Therefore, we will compress our normals into 16 bits using signed-normalized +// fixed point precision. This works well, because we know that each normal +// is no larger than |1| so we can normalize by dividing by the number of blend +// shapes. +uvec2 vec4_to_vec2(vec4 p_vec) { + return uvec2(packSnorm2x16(p_vec.xy), packSnorm2x16(p_vec.zw)); +} + +vec4 vec2_to_vec4(uvec2 p_vec) { + return vec4(unpackSnorm2x16(p_vec.x), unpackSnorm2x16(p_vec.y)); +} + +void main() { +#ifdef MODE_2D + out_vertex = in_vertex; + +#ifdef USE_BLEND_SHAPES +#ifdef MODE_BLEND_PASS + out_vertex = in_vertex + blend_vertex * blend_weight; +#else + out_vertex = in_vertex * blend_weight; +#endif +#ifdef FINAL_PASS + out_vertex = normalize(out_vertex); +#endif +#endif // USE_BLEND_SHAPES + +#ifdef USE_SKELETON + +#define TEX(m) texelFetch(skeleton_texture, ivec2(m % 256u, m / 256u), 0) +#define GET_BONE_MATRIX(a, b, w) mat2x4(TEX(a), TEX(b)) * w + + uvec4 bones = in_bone_attrib * uvec4(2u); + uvec4 bones_a = bones + uvec4(1u); + + highp mat2x4 m = GET_BONE_MATRIX(bones.x, bones_a.x, in_weight_attrib.x); + m += GET_BONE_MATRIX(bones.y, bones_a.y, in_weight_attrib.y); + m += GET_BONE_MATRIX(bones.z, bones_a.z, in_weight_attrib.z); + m += GET_BONE_MATRIX(bones.w, bones_a.w, in_weight_attrib.w); + + mat4 bone_matrix = mat4(m[0], m[1], vec4(0.0, 0.0, 1.0, 0.0), vec4(0.0, 0.0, 0.0, 1.0)); + + //reverse order because its transposed + out_vertex = (vec4(out_vertex, 0.0, 1.0) * bone_matrix).xy; +#endif // USE_SKELETON + +#else // MODE_2D + +#ifdef USE_BLEND_SHAPES +#ifdef MODE_BLEND_PASS + out_vertex = in_vertex + blend_vertex * blend_weight; + +#ifdef USE_NORMAL + vec3 normal = vec2_to_vec4(in_normal).xyz * blend_shape_count; + vec3 normal_blend = oct_to_vec3(blend_normal) * blend_weight; +#ifdef FINAL_PASS + out_normal = vec3_to_oct(normalize(normal + normal_blend)); +#else + out_normal = vec4_to_vec2(vec4(normal + normal_blend, 0.0) / blend_shape_count); +#endif +#endif // USE_NORMAL + +#ifdef USE_TANGENT + vec4 tangent = vec2_to_vec4(in_tangent) * blend_shape_count; + vec4 tangent_blend = oct_to_tang(blend_tangent) * blend_weight; +#ifdef FINAL_PASS + out_tangent = tang_to_oct(vec4(normalize(tangent.xyz + tangent_blend.xyz), tangent.w)); +#else + out_tangent = vec4_to_vec2(vec4((tangent.xyz + tangent_blend.xyz) / blend_shape_count, tangent.w)); +#endif +#endif // USE_TANGENT + +#else // MODE_BLEND_PASS + out_vertex = in_vertex * blend_weight; + +#ifdef USE_NORMAL + vec3 normal = oct_to_vec3(in_normal); + out_normal = vec4_to_vec2(vec4(normal * blend_weight / blend_shape_count, 0.0)); +#endif +#ifdef USE_TANGENT + vec4 tangent = oct_to_tang(in_tangent); + out_tangent = vec4_to_vec2(vec4(tangent.rgb * blend_weight / blend_shape_count, tangent.w)); +#endif +#endif // MODE_BLEND_PASS +#else // USE_BLEND_SHAPES + + // Make attributes available to the skeleton shader if not written by blend shapes. + out_vertex = in_vertex; +#ifdef USE_NORMAL + out_normal = in_normal; +#endif +#ifdef USE_TANGENT + out_tangent = in_tangent; +#endif +#endif // USE_BLEND_SHAPES + +#ifdef USE_SKELETON + +#define TEX(m) texelFetch(skeleton_texture, ivec2(m % 256u, m / 256u), 0) +#define GET_BONE_MATRIX(a, b, c, w) mat4(TEX(a), TEX(b), TEX(c), vec4(0.0, 0.0, 0.0, 1.0)) * w + + uvec4 bones = in_bone_attrib * uvec4(3); + uvec4 bones_a = bones + uvec4(1); + uvec4 bones_b = bones + uvec4(2); + + highp mat4 m; + m = GET_BONE_MATRIX(bones.x, bones_a.x, bones_b.x, in_weight_attrib.x); + m += GET_BONE_MATRIX(bones.y, bones_a.y, bones_b.y, in_weight_attrib.y); + m += GET_BONE_MATRIX(bones.z, bones_a.z, bones_b.z, in_weight_attrib.z); + m += GET_BONE_MATRIX(bones.w, bones_a.w, bones_b.w, in_weight_attrib.w); + +#ifdef USE_EIGHT_WEIGHTS + bones = in_bone_attrib2 * uvec4(3); + bones_a = bones + uvec4(1); + bones_b = bones + uvec4(2); + + m += GET_BONE_MATRIX(bones.x, bones_a.x, bones_b.x, in_weight_attrib2.x); + m += GET_BONE_MATRIX(bones.y, bones_a.y, bones_b.y, in_weight_attrib2.y); + m += GET_BONE_MATRIX(bones.z, bones_a.z, bones_b.z, in_weight_attrib2.z); + m += GET_BONE_MATRIX(bones.w, bones_a.w, bones_b.w, in_weight_attrib2.w); +#endif + + // Reverse order because its transposed. + out_vertex = (vec4(out_vertex, 1.0) * m).xyz; +#ifdef USE_NORMAL + vec3 vertex_normal = oct_to_vec3(out_normal); + out_normal = vec3_to_oct(normalize((vec4(vertex_normal, 0.0) * m).xyz)); +#endif // USE_NORMAL +#ifdef USE_TANGENT + vec4 vertex_tangent = oct_to_tang(out_tangent); + out_tangent = tang_to_oct(vec4(normalize((vec4(vertex_tangent.xyz, 0.0) * m).xyz), vertex_tangent.w)); +#endif // USE_TANGENT +#endif // USE_SKELETON +#endif // MODE_2D +} + +/* clang-format off */ +#[fragment] + +void main() { + +} +/* clang-format on */ diff --git a/drivers/gles3/shaders/stdlib_inc.glsl b/drivers/gles3/shaders/stdlib_inc.glsl index d5051760d7..8d4a24cc1f 100644 --- a/drivers/gles3/shaders/stdlib_inc.glsl +++ b/drivers/gles3/shaders/stdlib_inc.glsl @@ -38,23 +38,33 @@ vec2 unpackSnorm2x16(uint p) { vec2 v = vec2(float(p & uint(0xffff)), float(p >> uint(16))); return clamp((v - 32767.0) * vec2(0.00003051851), vec2(-1.0), vec2(1.0)); } + #endif -uint packUnorm4x8(vec4 v) { +// Compatibility renames. These are exposed with the "godot_" prefix +// to work around an Adreno bug which was exposing these ES310 functions +// in ES300 shaders. Internally, we must use the "godot_" prefix, but user shaders +// will be mapped automatically. +uint godot_packUnorm4x8(vec4 v) { uvec4 uv = uvec4(round(clamp(v, vec4(0.0), vec4(1.0)) * 255.0)); return uv.x | (uv.y << uint(8)) | (uv.z << uint(16)) | (uv.w << uint(24)); } -vec4 unpackUnorm4x8(uint p) { +vec4 godot_unpackUnorm4x8(uint p) { return vec4(float(p & uint(0xff)), float((p >> uint(8)) & uint(0xff)), float((p >> uint(16)) & uint(0xff)), float(p >> uint(24))) * 0.00392156862; // 1.0 / 255.0 } -uint packSnorm4x8(vec4 v) { +uint godot_packSnorm4x8(vec4 v) { uvec4 uv = uvec4(round(clamp(v, vec4(-1.0), vec4(1.0)) * 127.0) + 127.0); return uv.x | uv.y << uint(8) | uv.z << uint(16) | uv.w << uint(24); } -vec4 unpackSnorm4x8(uint p) { +vec4 godot_unpackSnorm4x8(uint p) { vec4 v = vec4(float(p & uint(0xff)), float((p >> uint(8)) & uint(0xff)), float((p >> uint(16)) & uint(0xff)), float(p >> uint(24))); return clamp((v - vec4(127.0)) * vec4(0.00787401574), vec4(-1.0), vec4(1.0)); } + +#define packUnorm4x8 godot_packUnorm4x8 +#define unpackUnorm4x8 godot_unpackUnorm4x8 +#define packSnorm4x8 godot_packSnorm4x8 +#define unpackSnorm4x8 godot_unpackSnorm4x8 diff --git a/drivers/gles3/storage/material_storage.cpp b/drivers/gles3/storage/material_storage.cpp index d413c2b00e..19e841f466 100644 --- a/drivers/gles3/storage/material_storage.cpp +++ b/drivers/gles3/storage/material_storage.cpp @@ -1522,6 +1522,7 @@ MaterialStorage::MaterialStorage() { actions.renames["NODE_POSITION_WORLD"] = "model_matrix[3].xyz"; actions.renames["CAMERA_POSITION_WORLD"] = "scene_data.inv_view_matrix[3].xyz"; actions.renames["CAMERA_DIRECTION_WORLD"] = "scene_data.view_matrix[3].xyz"; + actions.renames["CAMERA_VISIBLE_LAYERS"] = "scene_data.camera_visible_layers"; actions.renames["NODE_POSITION_VIEW"] = "(model_matrix * scene_data.view_matrix)[3].xyz"; actions.renames["VIEW_INDEX"] = "ViewIndex"; diff --git a/drivers/gles3/storage/mesh_storage.cpp b/drivers/gles3/storage/mesh_storage.cpp index a47df42500..285f32f1a5 100644 --- a/drivers/gles3/storage/mesh_storage.cpp +++ b/drivers/gles3/storage/mesh_storage.cpp @@ -44,10 +44,16 @@ MeshStorage *MeshStorage::get_singleton() { MeshStorage::MeshStorage() { singleton = this; + + { + skeleton_shader.shader.initialize(); + skeleton_shader.shader_version = skeleton_shader.shader.version_create(); + } } MeshStorage::~MeshStorage() { singleton = nullptr; + skeleton_shader.shader.version_free(skeleton_shader.shader_version); } /* MESH API */ @@ -88,10 +94,6 @@ void MeshStorage::mesh_set_blend_shape_count(RID p_mesh, int p_blend_shape_count ERR_FAIL_COND(mesh->surface_count > 0); //surfaces already exist mesh->blend_shape_count = p_blend_shape_count; - - if (p_blend_shape_count > 0) { - WARN_PRINT_ONCE("blend shapes not supported by GLES3 renderer yet"); - } } bool MeshStorage::mesh_needs_instance(RID p_mesh, bool p_has_skeleton) { @@ -114,7 +116,6 @@ void MeshStorage::mesh_add_surface(RID p_mesh, const RS::SurfaceData &p_surface) uint32_t attrib_stride = 0; uint32_t skin_stride = 0; - // TODO: I think this should be <=, but it is copied from RendererRD, will have to verify later for (int i = 0; i < RS::ARRAY_WEIGHTS; i++) { if ((p_surface.format & (1 << i))) { switch (i) { @@ -248,8 +249,77 @@ void MeshStorage::mesh_add_surface(RID p_mesh, const RS::SurfaceData &p_surface) s->aabb = p_surface.aabb; s->bone_aabbs = p_surface.bone_aabbs; //only really useful for returning them. - if (mesh->blend_shape_count > 0) { - //s->blend_shape_buffer = RD::get_singleton()->storage_buffer_create(p_surface.blend_shape_data.size(), p_surface.blend_shape_data); + if (p_surface.skin_data.size() || mesh->blend_shape_count > 0) { + // Size must match the size of the vertex array. + int size = p_surface.vertex_data.size(); + int vertex_size = 0; + int stride = 0; + int normal_offset = 0; + int tangent_offset = 0; + if ((p_surface.format & (1 << RS::ARRAY_VERTEX))) { + if (p_surface.format & RS::ARRAY_FLAG_USE_2D_VERTICES) { + vertex_size = 2; + } else { + vertex_size = 3; + } + stride = sizeof(float) * vertex_size; + } + if ((p_surface.format & (1 << RS::ARRAY_NORMAL))) { + normal_offset = stride; + stride += sizeof(uint16_t) * 2; + } + if ((p_surface.format & (1 << RS::ARRAY_TANGENT))) { + tangent_offset = stride; + stride += sizeof(uint16_t) * 2; + } + + if (mesh->blend_shape_count > 0) { + // Blend shapes are passed as one large array, for OpenGL, we need to split each of them into their own buffer + s->blend_shapes = memnew_arr(Mesh::Surface::BlendShape, mesh->blend_shape_count); + + for (uint32_t i = 0; i < mesh->blend_shape_count; i++) { + glGenVertexArrays(1, &s->blend_shapes[i].vertex_array); + glBindVertexArray(s->blend_shapes[i].vertex_array); + glGenBuffers(1, &s->blend_shapes[i].vertex_buffer); + glBindBuffer(GL_ARRAY_BUFFER, s->blend_shapes[i].vertex_buffer); + glBufferData(GL_ARRAY_BUFFER, size, p_surface.blend_shape_data.ptr() + i * size, (s->format & RS::ARRAY_FLAG_USE_DYNAMIC_UPDATE) ? GL_DYNAMIC_DRAW : GL_STATIC_DRAW); + + if ((p_surface.format & (1 << RS::ARRAY_VERTEX))) { + glEnableVertexAttribArray(RS::ARRAY_VERTEX + 3); + glVertexAttribPointer(RS::ARRAY_VERTEX + 3, vertex_size, GL_FLOAT, GL_FALSE, stride, CAST_INT_TO_UCHAR_PTR(0)); + } + if ((p_surface.format & (1 << RS::ARRAY_NORMAL))) { + glEnableVertexAttribArray(RS::ARRAY_NORMAL + 3); + glVertexAttribPointer(RS::ARRAY_NORMAL + 3, 2, GL_UNSIGNED_SHORT, GL_TRUE, stride, CAST_INT_TO_UCHAR_PTR(normal_offset)); + } + if ((p_surface.format & (1 << RS::ARRAY_TANGENT))) { + glEnableVertexAttribArray(RS::ARRAY_TANGENT + 3); + glVertexAttribPointer(RS::ARRAY_TANGENT + 3, 2, GL_UNSIGNED_SHORT, GL_TRUE, stride, CAST_INT_TO_UCHAR_PTR(tangent_offset)); + } + } + glBindVertexArray(0); + glBindBuffer(GL_ARRAY_BUFFER, 0); + } + + // Create a vertex array to use for skeleton/blend shapes. + glGenVertexArrays(1, &s->skeleton_vertex_array); + glBindVertexArray(s->skeleton_vertex_array); + glBindBuffer(GL_ARRAY_BUFFER, s->vertex_buffer); + + if ((p_surface.format & (1 << RS::ARRAY_VERTEX))) { + glEnableVertexAttribArray(RS::ARRAY_VERTEX); + glVertexAttribPointer(RS::ARRAY_VERTEX, vertex_size, GL_FLOAT, GL_FALSE, stride, CAST_INT_TO_UCHAR_PTR(0)); + } + if ((p_surface.format & (1 << RS::ARRAY_NORMAL))) { + glEnableVertexAttribArray(RS::ARRAY_NORMAL); + glVertexAttribPointer(RS::ARRAY_NORMAL, 2, GL_UNSIGNED_SHORT, GL_TRUE, stride, CAST_INT_TO_UCHAR_PTR(normal_offset)); + } + if ((p_surface.format & (1 << RS::ARRAY_TANGENT))) { + glEnableVertexAttribArray(RS::ARRAY_TANGENT); + glVertexAttribPointer(RS::ARRAY_TANGENT, 2, GL_UNSIGNED_SHORT, GL_TRUE, stride, CAST_INT_TO_UCHAR_PTR(tangent_offset)); + } + glBindVertexArray(0); + glBindBuffer(GL_ARRAY_BUFFER, 0); } if (mesh->surface_count == 0) { @@ -412,7 +482,13 @@ RS::SurfaceData MeshStorage::mesh_get_surface(RID p_mesh, int p_surface) const { } sd.bone_aabbs = s.bone_aabbs; - glBindBuffer(GL_ARRAY_BUFFER, 0); + + if (mesh->blend_shape_count) { + sd.blend_shape_data = Vector<uint8_t>(); + for (uint32_t i = 0; i < mesh->blend_shape_count; i++) { + sd.blend_shape_data.append_array(Utilities::buffer_get_data(GL_ARRAY_BUFFER, s.blend_shapes[i].vertex_buffer, s.vertex_buffer_size)); + } + } return sd; } @@ -608,6 +684,24 @@ void MeshStorage::mesh_clear(RID p_mesh) { memdelete_arr(s.lods); } + if (mesh->blend_shape_count) { + for (uint32_t j = 0; j < mesh->blend_shape_count; j++) { + if (s.blend_shapes[j].vertex_buffer != 0) { + glDeleteBuffers(1, &s.blend_shapes[j].vertex_buffer); + s.blend_shapes[j].vertex_buffer = 0; + } + if (s.blend_shapes[j].vertex_array != 0) { + glDeleteVertexArrays(1, &s.blend_shapes[j].vertex_array); + s.blend_shapes[j].vertex_array = 0; + } + } + memdelete_arr(s.blend_shapes); + } + if (s.skeleton_vertex_array != 0) { + glDeleteVertexArrays(1, &s.skeleton_vertex_array); + s.skeleton_vertex_array = 0; + } + memdelete(mesh->surfaces[i]); } if (mesh->surfaces) { @@ -663,15 +757,15 @@ void MeshStorage::_mesh_surface_generate_version_for_input_mask(Mesh::Surface::V case RS::ARRAY_NORMAL: { attribs[i].offset = vertex_stride; attribs[i].size = 2; - attribs[i].type = GL_UNSIGNED_SHORT; - vertex_stride += sizeof(uint16_t) * 2; + attribs[i].type = (mis ? GL_FLOAT : GL_UNSIGNED_SHORT); + vertex_stride += sizeof(uint16_t) * 2 * (mis ? 2 : 1); attribs[i].normalized = GL_TRUE; } break; case RS::ARRAY_TANGENT: { attribs[i].offset = vertex_stride; attribs[i].size = 2; - attribs[i].type = GL_UNSIGNED_SHORT; - vertex_stride += sizeof(uint16_t) * 2; + attribs[i].type = (mis ? GL_FLOAT : GL_UNSIGNED_SHORT); + vertex_stride += sizeof(uint16_t) * 2 * (mis ? 2 : 1); attribs[i].normalized = GL_TRUE; } break; case RS::ARRAY_COLOR: { @@ -716,7 +810,7 @@ void MeshStorage::_mesh_surface_generate_version_for_input_mask(Mesh::Surface::V attribs[i].offset = skin_stride; attribs[i].size = 4; attribs[i].type = GL_UNSIGNED_SHORT; - attributes_stride += 4 * sizeof(uint16_t); + skin_stride += 4 * sizeof(uint16_t); attribs[i].normalized = GL_FALSE; attribs[i].integer = true; } break; @@ -724,7 +818,7 @@ void MeshStorage::_mesh_surface_generate_version_for_input_mask(Mesh::Surface::V attribs[i].offset = skin_stride; attribs[i].size = 4; attribs[i].type = GL_UNSIGNED_SHORT; - attributes_stride += 4 * sizeof(uint16_t); + skin_stride += 4 * sizeof(uint16_t); attribs[i].normalized = GL_TRUE; } break; } @@ -815,7 +909,7 @@ void MeshStorage::mesh_instance_set_blend_shape_weight(RID p_mesh_instance, int ERR_FAIL_COND(!mi); ERR_FAIL_INDEX(p_shape, (int)mi->blend_weights.size()); mi->blend_weights[p_shape] = p_weight; - mi->weights_dirty = true; + mi->dirty = true; } void MeshStorage::_mesh_instance_clear(MeshInstance *mi) { @@ -827,38 +921,65 @@ void MeshStorage::_mesh_instance_clear(MeshInstance *mi) { } memfree(mi->surfaces[i].versions); } + + if (mi->surfaces[i].vertex_buffers[0] != 0) { + glDeleteBuffers(2, mi->surfaces[i].vertex_buffers); + mi->surfaces[i].vertex_buffers[0] = 0; + mi->surfaces[i].vertex_buffers[1] = 0; + } + if (mi->surfaces[i].vertex_buffer != 0) { glDeleteBuffers(1, &mi->surfaces[i].vertex_buffer); mi->surfaces[i].vertex_buffer = 0; } } mi->surfaces.clear(); - - if (mi->blend_weights_buffer != 0) { - glDeleteBuffers(1, &mi->blend_weights_buffer); - mi->blend_weights_buffer = 0; - } mi->blend_weights.clear(); - mi->weights_dirty = false; mi->skeleton_version = 0; } void MeshStorage::_mesh_instance_add_surface(MeshInstance *mi, Mesh *mesh, uint32_t p_surface) { - if (mesh->blend_shape_count > 0 && mi->blend_weights_buffer == 0) { + if (mesh->blend_shape_count > 0) { mi->blend_weights.resize(mesh->blend_shape_count); for (uint32_t i = 0; i < mi->blend_weights.size(); i++) { - mi->blend_weights[i] = 0; + mi->blend_weights[i] = 0.0; } - // Todo allocate buffer for blend_weights and copy data to it - //mi->blend_weights_buffer = RD::get_singleton()->storage_buffer_create(sizeof(float) * mi->blend_weights.size(), mi->blend_weights.to_byte_array()); - - mi->weights_dirty = true; } MeshInstance::Surface s; - if (mesh->blend_shape_count > 0 || (mesh->surfaces[p_surface]->format & RS::ARRAY_FORMAT_BONES)) { - //surface warrants transform - //s.vertex_buffer = RD::get_singleton()->vertex_buffer_create(mesh->surfaces[p_surface]->vertex_buffer_size, Vector<uint8_t>(), true); + if ((mesh->blend_shape_count > 0 || (mesh->surfaces[p_surface]->format & RS::ARRAY_FORMAT_BONES)) && mesh->surfaces[p_surface]->vertex_buffer_size > 0) { + // Cache surface properties + s.format_cache = mesh->surfaces[p_surface]->format; + if ((s.format_cache & (1 << RS::ARRAY_VERTEX))) { + if (s.format_cache & RS::ARRAY_FLAG_USE_2D_VERTICES) { + s.vertex_size_cache = 2; + } else { + s.vertex_size_cache = 3; + } + s.vertex_stride_cache = sizeof(float) * s.vertex_size_cache; + } + if ((s.format_cache & (1 << RS::ARRAY_NORMAL))) { + s.vertex_normal_offset_cache = s.vertex_stride_cache; + s.vertex_stride_cache += sizeof(uint32_t) * 2; + } + if ((s.format_cache & (1 << RS::ARRAY_TANGENT))) { + s.vertex_tangent_offset_cache = s.vertex_stride_cache; + s.vertex_stride_cache += sizeof(uint32_t) * 2; + } + + // Buffer to be used for rendering. Final output of skeleton and blend shapes. + glGenBuffers(1, &s.vertex_buffer); + glBindBuffer(GL_ARRAY_BUFFER, s.vertex_buffer); + glBufferData(GL_ARRAY_BUFFER, s.vertex_stride_cache * mesh->surfaces[p_surface]->vertex_count, nullptr, GL_DYNAMIC_DRAW); + if (mesh->blend_shape_count > 0) { + // Ping-Pong buffers for processing blendshapes. + glGenBuffers(2, s.vertex_buffers); + for (uint32_t i = 0; i < 2; i++) { + glBindBuffer(GL_ARRAY_BUFFER, s.vertex_buffers[i]); + glBufferData(GL_ARRAY_BUFFER, s.vertex_stride_cache * mesh->surfaces[p_surface]->vertex_count, nullptr, GL_DYNAMIC_DRAW); + } + } + glBindBuffer(GL_ARRAY_BUFFER, 0); //unbind } mi->surfaces.push_back(s); @@ -870,11 +991,6 @@ void MeshStorage::mesh_instance_check_for_update(RID p_mesh_instance) { bool needs_update = mi->dirty; - if (mi->weights_dirty && !mi->weight_update_list.in_list()) { - dirty_mesh_instance_weights.add(&mi->weight_update_list); - needs_update = true; - } - if (mi->array_update_list.in_list()) { return; } @@ -891,22 +1007,223 @@ void MeshStorage::mesh_instance_check_for_update(RID p_mesh_instance) { } } -void MeshStorage::update_mesh_instances() { - while (dirty_mesh_instance_weights.first()) { - MeshInstance *mi = dirty_mesh_instance_weights.first()->self(); +void MeshStorage::_blend_shape_bind_mesh_instance_buffer(MeshInstance *p_mi, uint32_t p_surface) { + glBindBuffer(GL_ARRAY_BUFFER, p_mi->surfaces[p_surface].vertex_buffers[0]); - if (mi->blend_weights_buffer != 0) { - //RD::get_singleton()->buffer_update(mi->blend_weights_buffer, 0, mi->blend_weights.size() * sizeof(float), mi->blend_weights.ptr()); - } - dirty_mesh_instance_weights.remove(&mi->weight_update_list); - mi->weights_dirty = false; + if ((p_mi->surfaces[p_surface].format_cache & (1 << RS::ARRAY_VERTEX))) { + glEnableVertexAttribArray(RS::ARRAY_VERTEX); + glVertexAttribPointer(RS::ARRAY_VERTEX, p_mi->surfaces[p_surface].vertex_size_cache, GL_FLOAT, GL_FALSE, p_mi->surfaces[p_surface].vertex_stride_cache, CAST_INT_TO_UCHAR_PTR(0)); + } else { + glDisableVertexAttribArray(RS::ARRAY_VERTEX); } + if ((p_mi->surfaces[p_surface].format_cache & (1 << RS::ARRAY_NORMAL))) { + glEnableVertexAttribArray(RS::ARRAY_NORMAL); + glVertexAttribIPointer(RS::ARRAY_NORMAL, 2, GL_UNSIGNED_INT, p_mi->surfaces[p_surface].vertex_stride_cache, CAST_INT_TO_UCHAR_PTR(p_mi->surfaces[p_surface].vertex_normal_offset_cache)); + } else { + glDisableVertexAttribArray(RS::ARRAY_NORMAL); + } + if ((p_mi->surfaces[p_surface].format_cache & (1 << RS::ARRAY_TANGENT))) { + glEnableVertexAttribArray(RS::ARRAY_TANGENT); + glVertexAttribIPointer(RS::ARRAY_TANGENT, 2, GL_UNSIGNED_INT, p_mi->surfaces[p_surface].vertex_stride_cache, CAST_INT_TO_UCHAR_PTR(p_mi->surfaces[p_surface].vertex_tangent_offset_cache)); + } else { + glDisableVertexAttribArray(RS::ARRAY_TANGENT); + } +} + +void MeshStorage::_compute_skeleton(MeshInstance *p_mi, Skeleton *p_sk, uint32_t p_surface) { + glBindBuffer(GL_ARRAY_BUFFER, 0); + + // Add in the bones and weights. + glBindBuffer(GL_ARRAY_BUFFER, p_mi->mesh->surfaces[p_surface]->skin_buffer); + + bool use_8_weights = p_mi->surfaces[p_surface].format_cache & RS::ARRAY_FLAG_USE_8_BONE_WEIGHTS; + int skin_stride = sizeof(int16_t) * (use_8_weights ? 16 : 8); + glEnableVertexAttribArray(RS::ARRAY_BONES); + glVertexAttribIPointer(RS::ARRAY_BONES, 4, GL_UNSIGNED_SHORT, skin_stride, CAST_INT_TO_UCHAR_PTR(0)); + if (use_8_weights) { + glEnableVertexAttribArray(11); + glVertexAttribIPointer(11, 4, GL_UNSIGNED_SHORT, skin_stride, CAST_INT_TO_UCHAR_PTR(4 * sizeof(uint16_t))); + glEnableVertexAttribArray(12); + glVertexAttribPointer(12, 4, GL_UNSIGNED_SHORT, GL_TRUE, skin_stride, CAST_INT_TO_UCHAR_PTR(8 * sizeof(uint16_t))); + glEnableVertexAttribArray(13); + glVertexAttribPointer(13, 4, GL_UNSIGNED_SHORT, GL_TRUE, skin_stride, CAST_INT_TO_UCHAR_PTR(12 * sizeof(uint16_t))); + } else { + glEnableVertexAttribArray(RS::ARRAY_WEIGHTS); + glVertexAttribPointer(RS::ARRAY_WEIGHTS, 4, GL_UNSIGNED_SHORT, GL_TRUE, skin_stride, CAST_INT_TO_UCHAR_PTR(4 * sizeof(uint16_t))); + } + + glBindBufferBase(GL_TRANSFORM_FEEDBACK_BUFFER, 0, p_mi->surfaces[p_surface].vertex_buffer); + glActiveTexture(GL_TEXTURE0); + glBindTexture(GL_TEXTURE_2D, p_sk->transforms_texture); + + glBeginTransformFeedback(GL_POINTS); + glDrawArrays(GL_POINTS, 0, p_mi->mesh->surfaces[p_surface]->vertex_count); + glEndTransformFeedback(); + + glDisableVertexAttribArray(RS::ARRAY_BONES); + glDisableVertexAttribArray(RS::ARRAY_WEIGHTS); + glDisableVertexAttribArray(RS::ARRAY_BONES + 2); + glDisableVertexAttribArray(RS::ARRAY_WEIGHTS + 2); + glBindVertexArray(0); + glBindBuffer(GL_TRANSFORM_FEEDBACK_BUFFER, 0); +} + +void MeshStorage::update_mesh_instances() { if (dirty_mesh_instance_arrays.first() == nullptr) { return; //nothing to do } + glEnable(GL_RASTERIZER_DISCARD); // Process skeletons and blend shapes using transform feedback - // TODO: Implement when working on skeletons and blend shapes + while (dirty_mesh_instance_arrays.first()) { + MeshInstance *mi = dirty_mesh_instance_arrays.first()->self(); + + Skeleton *sk = skeleton_owner.get_or_null(mi->skeleton); + + // Precompute base weight if using blend shapes. + float base_weight = 1.0; + if (mi->mesh->blend_shape_count && mi->mesh->blend_shape_mode == RS::BLEND_SHAPE_MODE_NORMALIZED) { + for (uint32_t i = 0; i < mi->mesh->blend_shape_count; i++) { + base_weight -= mi->blend_weights[i]; + } + } + + for (uint32_t i = 0; i < mi->surfaces.size(); i++) { + if (mi->surfaces[i].vertex_buffer == 0 || mi->mesh->surfaces[i]->skeleton_vertex_array == 0) { + continue; + } + + bool array_is_2d = mi->surfaces[i].format_cache & RS::ARRAY_FLAG_USE_2D_VERTICES; + bool can_use_skeleton = sk != nullptr && sk->use_2d == array_is_2d && (mi->surfaces[i].format_cache & RS::ARRAY_FORMAT_BONES); + bool use_8_weights = mi->surfaces[i].format_cache & RS::ARRAY_FLAG_USE_8_BONE_WEIGHTS; + + // Always process blend shapes first. + if (mi->mesh->blend_shape_count) { + SkeletonShaderGLES3::ShaderVariant variant = SkeletonShaderGLES3::MODE_BASE_PASS; + uint64_t specialization = 0; + specialization |= array_is_2d ? SkeletonShaderGLES3::MODE_2D : 0; + specialization |= SkeletonShaderGLES3::USE_BLEND_SHAPES; + if (!array_is_2d) { + if ((mi->surfaces[i].format_cache & (1 << RS::ARRAY_NORMAL))) { + specialization |= SkeletonShaderGLES3::USE_NORMAL; + } + if ((mi->surfaces[i].format_cache & (1 << RS::ARRAY_TANGENT))) { + specialization |= SkeletonShaderGLES3::USE_TANGENT; + } + } + + bool success = skeleton_shader.shader.version_bind_shader(skeleton_shader.shader_version, variant, specialization); + if (!success) { + continue; + } + + skeleton_shader.shader.version_set_uniform(SkeletonShaderGLES3::BLEND_WEIGHT, base_weight, skeleton_shader.shader_version, variant, specialization); + skeleton_shader.shader.version_set_uniform(SkeletonShaderGLES3::BLEND_SHAPE_COUNT, float(mi->mesh->blend_shape_count), skeleton_shader.shader_version, variant, specialization); + + glBindBuffer(GL_ARRAY_BUFFER, 0); + glBindVertexArray(mi->mesh->surfaces[i]->skeleton_vertex_array); + glBindBufferBase(GL_TRANSFORM_FEEDBACK_BUFFER, 0, mi->surfaces[i].vertex_buffers[0]); + glBeginTransformFeedback(GL_POINTS); + glDrawArrays(GL_POINTS, 0, mi->mesh->surfaces[i]->vertex_count); + glEndTransformFeedback(); + + variant = SkeletonShaderGLES3::MODE_BLEND_PASS; + success = skeleton_shader.shader.version_bind_shader(skeleton_shader.shader_version, variant, specialization); + if (!success) { + continue; + } + + //Do the last blend shape separately, as it can be combined with the skeleton pass. + for (uint32_t bs = 0; bs < mi->mesh->blend_shape_count - 1; bs++) { + float weight = mi->blend_weights[bs]; + + if (Math::is_zero_approx(weight)) { + //not bother with this one + continue; + } + skeleton_shader.shader.version_set_uniform(SkeletonShaderGLES3::BLEND_WEIGHT, weight, skeleton_shader.shader_version, variant, specialization); + skeleton_shader.shader.version_set_uniform(SkeletonShaderGLES3::BLEND_SHAPE_COUNT, float(mi->mesh->blend_shape_count), skeleton_shader.shader_version, variant, specialization); + + glBindVertexArray(mi->mesh->surfaces[i]->blend_shapes[bs].vertex_array); + _blend_shape_bind_mesh_instance_buffer(mi, i); + glBindBufferBase(GL_TRANSFORM_FEEDBACK_BUFFER, 0, mi->surfaces[i].vertex_buffers[1]); + + glBeginTransformFeedback(GL_POINTS); + glDrawArrays(GL_POINTS, 0, mi->mesh->surfaces[i]->vertex_count); + glEndTransformFeedback(); + + SWAP(mi->surfaces[i].vertex_buffers[0], mi->surfaces[i].vertex_buffers[1]); + } + uint32_t bs = mi->mesh->blend_shape_count - 1; + + float weight = mi->blend_weights[bs]; + + glBindVertexArray(mi->mesh->surfaces[i]->blend_shapes[bs].vertex_array); + _blend_shape_bind_mesh_instance_buffer(mi, i); + + specialization |= can_use_skeleton ? SkeletonShaderGLES3::USE_SKELETON : 0; + specialization |= (can_use_skeleton && use_8_weights) ? SkeletonShaderGLES3::USE_EIGHT_WEIGHTS : 0; + specialization |= SkeletonShaderGLES3::FINAL_PASS; + success = skeleton_shader.shader.version_bind_shader(skeleton_shader.shader_version, variant, specialization); + if (!success) { + continue; + } + + skeleton_shader.shader.version_set_uniform(SkeletonShaderGLES3::BLEND_WEIGHT, weight, skeleton_shader.shader_version, variant, specialization); + skeleton_shader.shader.version_set_uniform(SkeletonShaderGLES3::BLEND_SHAPE_COUNT, float(mi->mesh->blend_shape_count), skeleton_shader.shader_version, variant, specialization); + + if (can_use_skeleton) { + // Do last blendshape in the same pass as the Skeleton. + _compute_skeleton(mi, sk, i); + can_use_skeleton = false; + } else { + // Do last blendshape by itself and prepare vertex data for use by the renderer. + glBindBufferBase(GL_TRANSFORM_FEEDBACK_BUFFER, 0, mi->surfaces[i].vertex_buffer); + + glBeginTransformFeedback(GL_POINTS); + glDrawArrays(GL_POINTS, 0, mi->mesh->surfaces[i]->vertex_count); + glEndTransformFeedback(); + } + + glBindVertexArray(0); + glBindBuffer(GL_TRANSFORM_FEEDBACK_BUFFER, 0); + } + + // This branch should only execute when Skeleton is run by itself. + if (can_use_skeleton) { + SkeletonShaderGLES3::ShaderVariant variant = SkeletonShaderGLES3::MODE_BASE_PASS; + uint64_t specialization = 0; + specialization |= array_is_2d ? SkeletonShaderGLES3::MODE_2D : 0; + specialization |= SkeletonShaderGLES3::USE_SKELETON; + specialization |= SkeletonShaderGLES3::FINAL_PASS; + specialization |= use_8_weights ? SkeletonShaderGLES3::USE_EIGHT_WEIGHTS : 0; + if (!array_is_2d) { + if ((mi->surfaces[i].format_cache & (1 << RS::ARRAY_NORMAL))) { + specialization |= SkeletonShaderGLES3::USE_NORMAL; + } + if ((mi->surfaces[i].format_cache & (1 << RS::ARRAY_TANGENT))) { + specialization |= SkeletonShaderGLES3::USE_TANGENT; + } + } + + bool success = skeleton_shader.shader.version_bind_shader(skeleton_shader.shader_version, variant, specialization); + if (!success) { + continue; + } + + glBindVertexArray(mi->mesh->surfaces[i]->skeleton_vertex_array); + _compute_skeleton(mi, sk, i); + } + } + mi->dirty = false; + if (sk) { + mi->skeleton_version = sk->version; + } + dirty_mesh_instance_arrays.remove(&mi->array_update_list); + } + glDisable(GL_RASTERIZER_DISCARD); + glBindBuffer(GL_ARRAY_BUFFER, 0); + glBindBufferBase(GL_TRANSFORM_FEEDBACK_BUFFER, 0, 0); } /* MULTIMESH API */ @@ -1577,45 +1894,207 @@ void MeshStorage::_update_dirty_multimeshes() { /* SKELETON API */ RID MeshStorage::skeleton_allocate() { - return RID(); + return skeleton_owner.allocate_rid(); } void MeshStorage::skeleton_initialize(RID p_rid) { + skeleton_owner.initialize_rid(p_rid, Skeleton()); } void MeshStorage::skeleton_free(RID p_rid) { + _update_dirty_skeletons(); + skeleton_allocate_data(p_rid, 0); + Skeleton *skeleton = skeleton_owner.get_or_null(p_rid); + skeleton->dependency.deleted_notify(p_rid); + skeleton_owner.free(p_rid); +} + +void MeshStorage::_skeleton_make_dirty(Skeleton *skeleton) { + if (!skeleton->dirty) { + skeleton->dirty = true; + skeleton->dirty_list = skeleton_dirty_list; + skeleton_dirty_list = skeleton; + } } void MeshStorage::skeleton_allocate_data(RID p_skeleton, int p_bones, bool p_2d_skeleton) { + Skeleton *skeleton = skeleton_owner.get_or_null(p_skeleton); + ERR_FAIL_COND(!skeleton); + ERR_FAIL_COND(p_bones < 0); + + if (skeleton->size == p_bones && skeleton->use_2d == p_2d_skeleton) { + return; + } + + skeleton->size = p_bones; + skeleton->use_2d = p_2d_skeleton; + skeleton->height = (p_bones * (p_2d_skeleton ? 2 : 3)) / 256; + if ((p_bones * (p_2d_skeleton ? 2 : 3)) % 256) { + skeleton->height++; + } + + if (skeleton->transforms_texture != 0) { + glDeleteTextures(1, &skeleton->transforms_texture); + skeleton->transforms_texture = 0; + skeleton->data.clear(); + } + + if (skeleton->size) { + skeleton->data.resize(256 * skeleton->height * 4); + glGenTextures(1, &skeleton->transforms_texture); + glBindTexture(GL_TEXTURE_2D, skeleton->transforms_texture); + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA32F, 256, skeleton->height, 0, GL_RGBA, GL_FLOAT, nullptr); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + glBindTexture(GL_TEXTURE_2D, 0); + + memset(skeleton->data.ptrw(), 0, skeleton->data.size() * sizeof(float)); + + _skeleton_make_dirty(skeleton); + } + + skeleton->dependency.changed_notify(Dependency::DEPENDENCY_CHANGED_SKELETON_DATA); } void MeshStorage::skeleton_set_base_transform_2d(RID p_skeleton, const Transform2D &p_base_transform) { + Skeleton *skeleton = skeleton_owner.get_or_null(p_skeleton); + + ERR_FAIL_NULL(skeleton); + ERR_FAIL_COND(!skeleton->use_2d); + + skeleton->base_transform_2d = p_base_transform; } int MeshStorage::skeleton_get_bone_count(RID p_skeleton) const { - return 0; + Skeleton *skeleton = skeleton_owner.get_or_null(p_skeleton); + ERR_FAIL_COND_V(!skeleton, 0); + + return skeleton->size; } void MeshStorage::skeleton_bone_set_transform(RID p_skeleton, int p_bone, const Transform3D &p_transform) { + Skeleton *skeleton = skeleton_owner.get_or_null(p_skeleton); + + ERR_FAIL_COND(!skeleton); + ERR_FAIL_INDEX(p_bone, skeleton->size); + ERR_FAIL_COND(skeleton->use_2d); + + float *dataptr = skeleton->data.ptrw() + p_bone * 12; + + dataptr[0] = p_transform.basis.rows[0][0]; + dataptr[1] = p_transform.basis.rows[0][1]; + dataptr[2] = p_transform.basis.rows[0][2]; + dataptr[3] = p_transform.origin.x; + dataptr[4] = p_transform.basis.rows[1][0]; + dataptr[5] = p_transform.basis.rows[1][1]; + dataptr[6] = p_transform.basis.rows[1][2]; + dataptr[7] = p_transform.origin.y; + dataptr[8] = p_transform.basis.rows[2][0]; + dataptr[9] = p_transform.basis.rows[2][1]; + dataptr[10] = p_transform.basis.rows[2][2]; + dataptr[11] = p_transform.origin.z; + + _skeleton_make_dirty(skeleton); } Transform3D MeshStorage::skeleton_bone_get_transform(RID p_skeleton, int p_bone) const { - return Transform3D(); + Skeleton *skeleton = skeleton_owner.get_or_null(p_skeleton); + + ERR_FAIL_COND_V(!skeleton, Transform3D()); + ERR_FAIL_INDEX_V(p_bone, skeleton->size, Transform3D()); + ERR_FAIL_COND_V(skeleton->use_2d, Transform3D()); + + const float *dataptr = skeleton->data.ptr() + p_bone * 12; + + Transform3D t; + + t.basis.rows[0][0] = dataptr[0]; + t.basis.rows[0][1] = dataptr[1]; + t.basis.rows[0][2] = dataptr[2]; + t.origin.x = dataptr[3]; + t.basis.rows[1][0] = dataptr[4]; + t.basis.rows[1][1] = dataptr[5]; + t.basis.rows[1][2] = dataptr[6]; + t.origin.y = dataptr[7]; + t.basis.rows[2][0] = dataptr[8]; + t.basis.rows[2][1] = dataptr[9]; + t.basis.rows[2][2] = dataptr[10]; + t.origin.z = dataptr[11]; + + return t; } void MeshStorage::skeleton_bone_set_transform_2d(RID p_skeleton, int p_bone, const Transform2D &p_transform) { + Skeleton *skeleton = skeleton_owner.get_or_null(p_skeleton); + + ERR_FAIL_COND(!skeleton); + ERR_FAIL_INDEX(p_bone, skeleton->size); + ERR_FAIL_COND(!skeleton->use_2d); + + float *dataptr = skeleton->data.ptrw() + p_bone * 8; + + dataptr[0] = p_transform.columns[0][0]; + dataptr[1] = p_transform.columns[1][0]; + dataptr[2] = 0; + dataptr[3] = p_transform.columns[2][0]; + dataptr[4] = p_transform.columns[0][1]; + dataptr[5] = p_transform.columns[1][1]; + dataptr[6] = 0; + dataptr[7] = p_transform.columns[2][1]; + + _skeleton_make_dirty(skeleton); } Transform2D MeshStorage::skeleton_bone_get_transform_2d(RID p_skeleton, int p_bone) const { - return Transform2D(); + Skeleton *skeleton = skeleton_owner.get_or_null(p_skeleton); + + ERR_FAIL_COND_V(!skeleton, Transform2D()); + ERR_FAIL_INDEX_V(p_bone, skeleton->size, Transform2D()); + ERR_FAIL_COND_V(!skeleton->use_2d, Transform2D()); + + const float *dataptr = skeleton->data.ptr() + p_bone * 8; + + Transform2D t; + t.columns[0][0] = dataptr[0]; + t.columns[1][0] = dataptr[1]; + t.columns[2][0] = dataptr[3]; + t.columns[0][1] = dataptr[4]; + t.columns[1][1] = dataptr[5]; + t.columns[2][1] = dataptr[7]; + + return t; } -void MeshStorage::skeleton_update_dependency(RID p_base, DependencyTracker *p_instance) { +void MeshStorage::_update_dirty_skeletons() { + while (skeleton_dirty_list) { + Skeleton *skeleton = skeleton_dirty_list; + + if (skeleton->size) { + glBindTexture(GL_TEXTURE_2D, skeleton->transforms_texture); + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA32F, 256, skeleton->height, 0, GL_RGBA, GL_FLOAT, skeleton->data.ptr()); + glBindTexture(GL_TEXTURE_2D, 0); + } + + skeleton_dirty_list = skeleton->dirty_list; + + skeleton->dependency.changed_notify(Dependency::DEPENDENCY_CHANGED_SKELETON_BONES); + + skeleton->version++; + + skeleton->dirty = false; + skeleton->dirty_list = nullptr; + } + + skeleton_dirty_list = nullptr; } -/* OCCLUDER */ +void MeshStorage::skeleton_update_dependency(RID p_skeleton, DependencyTracker *p_instance) { + Skeleton *skeleton = skeleton_owner.get_or_null(p_skeleton); + ERR_FAIL_COND(!skeleton); -void MeshStorage::occluder_set_mesh(RID p_occluder, const PackedVector3Array &p_vertices, const PackedInt32Array &p_indices) { + p_instance->update_dependency(&skeleton->dependency); } #endif // GLES3_ENABLED diff --git a/drivers/gles3/storage/mesh_storage.h b/drivers/gles3/storage/mesh_storage.h index 1aef3cbf78..0f30814928 100644 --- a/drivers/gles3/storage/mesh_storage.h +++ b/drivers/gles3/storage/mesh_storage.h @@ -33,6 +33,7 @@ #ifdef GLES3_ENABLED +#include "../shaders/skeleton.glsl.gen.h" #include "core/templates/local_vector.h" #include "core/templates/rid_owner.h" #include "core/templates/self_list.h" @@ -102,7 +103,13 @@ struct Mesh { Vector<AABB> bone_aabbs; - GLuint blend_shape_buffer = 0; + struct BlendShape { + GLuint vertex_buffer = 0; + GLuint vertex_array = 0; + }; + + BlendShape *blend_shapes = nullptr; + GLuint skeleton_vertex_array = 0; RID material; }; @@ -136,7 +143,14 @@ struct MeshInstance { Mesh *mesh = nullptr; RID skeleton; struct Surface { + GLuint vertex_buffers[2] = { 0, 0 }; + GLuint vertex_arrays[2] = { 0, 0 }; GLuint vertex_buffer = 0; + int vertex_stride_cache = 0; + int vertex_size_cache = 0; + int vertex_normal_offset_cache = 0; + int vertex_tangent_offset_cache = 0; + uint32_t format_cache = 0; Mesh::Surface::Version *versions = nullptr; //allocated on demand uint32_t version_count = 0; @@ -144,7 +158,6 @@ struct MeshInstance { LocalVector<Surface> surfaces; LocalVector<float> blend_weights; - GLuint blend_weights_buffer = 0; List<MeshInstance *>::Element *I = nullptr; //used to erase itself uint64_t skeleton_version = 0; bool dirty = false; @@ -186,13 +199,15 @@ struct MultiMesh { struct Skeleton { bool use_2d = false; int size = 0; + int height = 0; Vector<float> data; - GLuint buffer = 0; bool dirty = false; Skeleton *dirty_list = nullptr; Transform2D base_transform_2d; + GLuint transforms_texture = 0; + uint64_t version = 1; Dependency dependency; @@ -202,6 +217,11 @@ class MeshStorage : public RendererMeshStorage { private: static MeshStorage *singleton; + struct { + SkeletonShaderGLES3 shader; + RID shader_version; + } skeleton_shader; + /* Mesh */ mutable RID_Owner<Mesh, true> mesh_owner; @@ -214,6 +234,7 @@ private: void _mesh_instance_clear(MeshInstance *mi); void _mesh_instance_add_surface(MeshInstance *mi, Mesh *mesh, uint32_t p_surface); + void _blend_shape_bind_mesh_instance_buffer(MeshInstance *p_mi, uint32_t p_surface); SelfList<MeshInstance>::List dirty_mesh_instance_weights; SelfList<MeshInstance>::List dirty_mesh_instance_arrays; @@ -232,9 +253,10 @@ private: mutable RID_Owner<Skeleton, true> skeleton_owner; - Skeleton *skeleton_dirty_list = nullptr; - _FORCE_INLINE_ void _skeleton_make_dirty(Skeleton *skeleton); + void _compute_skeleton(MeshInstance *p_mi, Skeleton *p_sk, uint32_t p_surface); + + Skeleton *skeleton_dirty_list = nullptr; public: static MeshStorage *get_singleton(); @@ -534,9 +556,11 @@ public: virtual void skeleton_update_dependency(RID p_base, DependencyTracker *p_instance) override; - /* OCCLUDER */ + void _update_dirty_skeletons(); - void occluder_set_mesh(RID p_occluder, const PackedVector3Array &p_vertices, const PackedInt32Array &p_indices); + _FORCE_INLINE_ bool skeleton_is_valid(RID p_skeleton) { + return skeleton_owner.get_or_null(p_skeleton) != nullptr; + } }; } // namespace GLES3 diff --git a/drivers/gles3/storage/texture_storage.cpp b/drivers/gles3/storage/texture_storage.cpp index 15743c2d78..99908d197a 100644 --- a/drivers/gles3/storage/texture_storage.cpp +++ b/drivers/gles3/storage/texture_storage.cpp @@ -1694,34 +1694,51 @@ void TextureStorage::_clear_render_target(RenderTarget *rt) { return; } + // Dispose of the cached fbo's and the allocated textures + for (KeyValue<uint32_t, RenderTarget::RTOverridden::FBOCacheEntry> &E : rt->overridden.fbo_cache) { + glDeleteTextures(E.value.allocated_textures.size(), E.value.allocated_textures.ptr()); + // Don't delete the current FBO, we'll do that a couple lines down. + if (E.value.fbo != rt->fbo) { + glDeleteFramebuffers(1, &E.value.fbo); + } + } + rt->overridden.fbo_cache.clear(); + if (rt->fbo) { glDeleteFramebuffers(1, &rt->fbo); rt->fbo = 0; } if (rt->overridden.color.is_null()) { - glDeleteTextures(1, &rt->color); - rt->color = 0; + if (rt->texture.is_valid()) { + Texture *tex = get_texture(rt->texture); + tex->alloc_height = 0; + tex->alloc_width = 0; + tex->width = 0; + tex->height = 0; + tex->active = false; + } + } else { + Texture *tex = get_texture(rt->overridden.color); + tex->is_render_target = false; } - if (rt->overridden.depth.is_null()) { - glDeleteTextures(1, &rt->depth); - rt->depth = 0; + if (rt->overridden.color.is_valid()) { + rt->overridden.color = RID(); + } else if (rt->color) { + glDeleteTextures(1, &rt->color); } + rt->color = 0; - if (rt->texture.is_valid()) { - Texture *tex = get_texture(rt->texture); - tex->alloc_height = 0; - tex->alloc_width = 0; - tex->width = 0; - tex->height = 0; - tex->active = false; + if (rt->overridden.depth.is_valid()) { + rt->overridden.depth = RID(); + } else if (rt->depth) { + glDeleteTextures(1, &rt->depth); } + rt->depth = 0; - if (rt->overridden.color.is_valid()) { - Texture *tex = get_texture(rt->overridden.color); - tex->is_render_target = false; - } + rt->overridden.velocity = RID(); + rt->overridden.is_overridden = false; if (rt->backbuffer_fbo != 0) { glDeleteFramebuffers(1, &rt->backbuffer_fbo); @@ -1732,15 +1749,6 @@ void TextureStorage::_clear_render_target(RenderTarget *rt) { _render_target_clear_sdf(rt); } -void TextureStorage::_clear_render_target_overridden_fbo_cache(RenderTarget *rt) { - // Dispose of the cached fbo's and the allocated textures - for (KeyValue<uint32_t, RenderTarget::RTOverridden::FBOCacheEntry> &E : rt->overridden.fbo_cache) { - glDeleteTextures(E.value.allocated_textures.size(), E.value.allocated_textures.ptr()); - glDeleteFramebuffers(1, &E.value.fbo); - } - rt->overridden.fbo_cache.clear(); -} - RID TextureStorage::render_target_create() { RenderTarget render_target; //render_target.was_used = false; @@ -1759,7 +1767,6 @@ RID TextureStorage::render_target_create() { void TextureStorage::render_target_free(RID p_rid) { RenderTarget *rt = render_target_owner.get_or_null(p_rid); _clear_render_target(rt); - _clear_render_target_overridden_fbo_cache(rt); Texture *t = get_texture(rt->texture); if (t) { @@ -1826,11 +1833,7 @@ void TextureStorage::render_target_set_override(RID p_render_target, RID p_color if (p_color_texture.is_null() && p_depth_texture.is_null()) { _clear_render_target(rt); - rt->overridden.is_overridden = false; - rt->overridden.color = RID(); - rt->overridden.depth = RID(); - rt->size = Size2i(); - _clear_render_target_overridden_fbo_cache(rt); + _update_render_target(rt); return; } @@ -1849,6 +1852,8 @@ void TextureStorage::render_target_set_override(RID p_render_target, RID p_color RBMap<uint32_t, RenderTarget::RTOverridden::FBOCacheEntry>::Element *cache; if ((cache = rt->overridden.fbo_cache.find(hash_key)) != nullptr) { rt->fbo = cache->get().fbo; + rt->color = cache->get().color; + rt->depth = cache->get().depth; rt->size = cache->get().size; rt->texture = p_color_texture; return; @@ -1858,6 +1863,8 @@ void TextureStorage::render_target_set_override(RID p_render_target, RID p_color RenderTarget::RTOverridden::FBOCacheEntry new_entry; new_entry.fbo = rt->fbo; + new_entry.color = rt->color; + new_entry.depth = rt->depth; new_entry.size = rt->size; // Keep track of any textures we had to allocate because they weren't overridden. if (p_color_texture.is_null()) { diff --git a/drivers/gles3/storage/texture_storage.h b/drivers/gles3/storage/texture_storage.h index c465576347..169c50638d 100644 --- a/drivers/gles3/storage/texture_storage.h +++ b/drivers/gles3/storage/texture_storage.h @@ -344,6 +344,8 @@ struct RenderTarget { struct FBOCacheEntry { GLuint fbo; + GLuint color; + GLuint depth; Size2i size; Vector<GLuint> allocated_textures; }; @@ -412,7 +414,6 @@ private: mutable RID_Owner<RenderTarget> render_target_owner; void _clear_render_target(RenderTarget *rt); - void _clear_render_target_overridden_fbo_cache(RenderTarget *rt); void _update_render_target(RenderTarget *rt); void _create_render_target_backbuffer(RenderTarget *rt); void _render_target_allocate_sdf(RenderTarget *rt); diff --git a/drivers/gles3/storage/utilities.cpp b/drivers/gles3/storage/utilities.cpp index 393093c2a7..fe900c7cfb 100644 --- a/drivers/gles3/storage/utilities.cpp +++ b/drivers/gles3/storage/utilities.cpp @@ -281,7 +281,7 @@ String Utilities::get_captured_timestamp_name(uint32_t p_index) const { void Utilities::update_dirty_resources() { MaterialStorage::get_singleton()->_update_global_shader_uniforms(); MaterialStorage::get_singleton()->_update_queued_materials(); - //MeshStorage::get_singleton()->_update_dirty_skeletons(); + MeshStorage::get_singleton()->_update_dirty_skeletons(); MeshStorage::get_singleton()->_update_dirty_multimeshes(); TextureStorage::get_singleton()->update_texture_atlas(); } diff --git a/drivers/unix/os_unix.cpp b/drivers/unix/os_unix.cpp index 161706489f..b02a100784 100644 --- a/drivers/unix/os_unix.cpp +++ b/drivers/unix/os_unix.cpp @@ -565,7 +565,7 @@ String OS_Unix::get_executable_path() const { WARN_PRINT("MAXPATHLEN is too small"); } - String path(resolved_path); + String path = String::utf8(resolved_path); delete[] resolved_path; return path; diff --git a/editor/animation_bezier_editor.cpp b/editor/animation_bezier_editor.cpp index a7a07a41ac..7ffec0835b 100644 --- a/editor/animation_bezier_editor.cpp +++ b/editor/animation_bezier_editor.cpp @@ -32,6 +32,7 @@ #include "editor/editor_node.h" #include "editor/editor_scale.h" +#include "editor/editor_settings.h" #include "editor/editor_undo_redo_manager.h" #include "scene/gui/view_panner.h" #include "scene/resources/text_line.h" diff --git a/editor/animation_track_editor.cpp b/editor/animation_track_editor.cpp index 7aa06e6398..ecc465ef64 100644 --- a/editor/animation_track_editor.cpp +++ b/editor/animation_track_editor.cpp @@ -35,10 +35,13 @@ #include "editor/animation_bezier_editor.h" #include "editor/editor_node.h" #include "editor/editor_scale.h" +#include "editor/editor_settings.h" #include "editor/editor_undo_redo_manager.h" +#include "editor/inspector_dock.h" #include "editor/plugins/animation_player_editor_plugin.h" #include "scene/animation/animation_player.h" #include "scene/animation/tween.h" +#include "scene/gui/grid_container.h" #include "scene/gui/separator.h" #include "scene/gui/view_panner.h" #include "scene/main/window.h" @@ -1751,7 +1754,9 @@ void AnimationTimelineEdit::update_values() { length->set_step(1); length->set_tooltip_text(TTR("Animation length (frames)")); time_icon->set_tooltip_text(TTR("Animation length (frames)")); - track_edit->editor->_update_key_edit(); + if (track_edit) { + track_edit->editor->_update_key_edit(); + } } else { length->set_value(animation->get_length()); length->set_step(0.001); @@ -2129,10 +2134,9 @@ void AnimationTrackEdit::_notification(int p_what) { get_theme_icon(SNAME("InterpLinearAngle"), SNAME("EditorIcons")), get_theme_icon(SNAME("InterpCubicAngle"), SNAME("EditorIcons")), }; - Ref<Texture2D> cont_icon[4] = { + Ref<Texture2D> cont_icon[3] = { get_theme_icon(SNAME("TrackContinuous"), SNAME("EditorIcons")), get_theme_icon(SNAME("TrackDiscrete"), SNAME("EditorIcons")), - get_theme_icon(SNAME("TrackTrigger"), SNAME("EditorIcons")), get_theme_icon(SNAME("TrackCapture"), SNAME("EditorIcons")) }; @@ -2824,7 +2828,6 @@ void AnimationTrackEdit::gui_input(const Ref<InputEvent> &p_event) { menu->clear(); menu->add_icon_item(get_theme_icon(SNAME("TrackContinuous"), SNAME("EditorIcons")), TTR("Continuous"), MENU_CALL_MODE_CONTINUOUS); menu->add_icon_item(get_theme_icon(SNAME("TrackDiscrete"), SNAME("EditorIcons")), TTR("Discrete"), MENU_CALL_MODE_DISCRETE); - menu->add_icon_item(get_theme_icon(SNAME("TrackTrigger"), SNAME("EditorIcons")), TTR("Trigger"), MENU_CALL_MODE_TRIGGER); menu->add_icon_item(get_theme_icon(SNAME("TrackCapture"), SNAME("EditorIcons")), TTR("Capture"), MENU_CALL_MODE_CAPTURE); menu->reset_size(); @@ -3189,7 +3192,6 @@ void AnimationTrackEdit::_menu_selected(int p_index) { switch (p_index) { case MENU_CALL_MODE_CONTINUOUS: case MENU_CALL_MODE_DISCRETE: - case MENU_CALL_MODE_TRIGGER: case MENU_CALL_MODE_CAPTURE: { Animation::UpdateMode update_mode = Animation::UpdateMode(p_index); Ref<EditorUndoRedoManager> &undo_redo = EditorNode::get_undo_redo(); @@ -3849,7 +3851,7 @@ void AnimationTrackEditor::insert_transform_key(Node3D *p_node, const String &p_ } // Let's build a node path. - String path = root->get_path_to(p_node); + String path = root->get_path_to(p_node, true); if (!p_sub.is_empty()) { path += ":" + p_sub; } @@ -3889,7 +3891,7 @@ bool AnimationTrackEditor::has_track(Node3D *p_node, const String &p_sub, const } // Let's build a node path. - String path = root->get_path_to(p_node); + String path = root->get_path_to(p_node, true); if (!p_sub.is_empty()) { path += ":" + p_sub; } @@ -3937,11 +3939,10 @@ void AnimationTrackEditor::_insert_animation_key(NodePath p_path, const Variant void AnimationTrackEditor::insert_node_value_key(Node *p_node, const String &p_property, const Variant &p_value, bool p_only_if_exists) { ERR_FAIL_COND(!root); - // Let's build a node path. + // Let's build a node path. Node *node = p_node; - - String path = root->get_path_to(node); + String path = root->get_path_to(node, true); if (Object::cast_to<AnimationPlayer>(node) && p_property == "current_animation") { if (node == AnimationPlayerEditor::get_singleton()->get_player()) { @@ -4035,14 +4036,13 @@ void AnimationTrackEditor::insert_value_key(const String &p_property, const Vari EditorSelectionHistory *history = EditorNode::get_singleton()->get_editor_selection_history(); ERR_FAIL_COND(!root); - // Let's build a node path. ERR_FAIL_COND(history->get_path_size() == 0); Object *obj = ObjectDB::get_instance(history->get_path_object(0)); ERR_FAIL_COND(!Object::cast_to<Node>(obj)); + // Let's build a node path. Node *node = Object::cast_to<Node>(obj); - - String path = root->get_path_to(node); + String path = root->get_path_to(node, true); if (Object::cast_to<AnimationPlayer>(node) && p_property == "current_animation") { if (node == AnimationPlayerEditor::get_singleton()->get_player()) { @@ -4319,10 +4319,6 @@ AnimationTrackEditor::TrackIndices AnimationTrackEditor::_confirm_insert(InsertD h.type == Variant::TRANSFORM3D) { update_mode = Animation::UPDATE_CONTINUOUS; } - - if (h.usage & PROPERTY_USAGE_ANIMATE_AS_TRIGGER) { - update_mode = Animation::UPDATE_TRIGGER; - } } } @@ -4826,7 +4822,7 @@ void AnimationTrackEditor::_new_track_node_selected(NodePath p_path) { ERR_FAIL_COND(!root); Node *node = get_node(p_path); ERR_FAIL_COND(!node); - NodePath path_to = root->get_path_to(node); + NodePath path_to = root->get_path_to(node, true); if (adding_track_type == Animation::TYPE_BLEND_SHAPE && !node->is_class("MeshInstance3D")) { EditorNode::get_singleton()->show_warning(TTR("Blend Shape tracks only apply to MeshInstance3D nodes.")); @@ -4950,10 +4946,6 @@ void AnimationTrackEditor::_new_track_property_selected(String p_name) { h.type == Variant::TRANSFORM3D) { update_mode = Animation::UPDATE_CONTINUOUS; } - - if (h.usage & PROPERTY_USAGE_ANIMATE_AS_TRIGGER) { - update_mode = Animation::UPDATE_TRIGGER; - } } undo_redo->create_action(TTR("Add Track")); diff --git a/editor/animation_track_editor.h b/editor/animation_track_editor.h index dc0c4abe5f..4b50424f39 100644 --- a/editor/animation_track_editor.h +++ b/editor/animation_track_editor.h @@ -138,7 +138,6 @@ class AnimationTrackEdit : public Control { enum { MENU_CALL_MODE_CONTINUOUS, MENU_CALL_MODE_DISCRETE, - MENU_CALL_MODE_TRIGGER, MENU_CALL_MODE_CAPTURE, MENU_INTERPOLATION_NEAREST, MENU_INTERPOLATION_LINEAR, diff --git a/editor/code_editor.cpp b/editor/code_editor.cpp index e907d5a281..926c01b334 100644 --- a/editor/code_editor.cpp +++ b/editor/code_editor.cpp @@ -33,6 +33,7 @@ #include "core/input/input.h" #include "core/os/keyboard.h" #include "core/string/string_builder.h" +#include "core/templates/pair.h" #include "editor/editor_scale.h" #include "editor/editor_settings.h" #include "editor/plugins/script_editor_plugin.h" @@ -1290,90 +1291,98 @@ void CodeTextEditor::convert_case(CaseStyle p_case) { void CodeTextEditor::move_lines_up() { text_editor->begin_complex_operation(); - Vector<int> carets_to_remove; - Vector<int> caret_edit_order = text_editor->get_caret_index_edit_order(); + + // Lists of carets representing each group + Vector<Vector<int>> caret_groups; + Vector<Pair<int, int>> group_borders; + + // Search for groups of carets and their selections residing on the same lines for (int i = 0; i < caret_edit_order.size(); i++) { int c = caret_edit_order[i]; - int cl = text_editor->get_caret_line(c); - bool swaped_caret = false; - for (int j = i + 1; j < caret_edit_order.size(); j++) { - if (text_editor->has_selection(caret_edit_order[j])) { - if (text_editor->get_selection_from_line() == cl) { - carets_to_remove.push_back(caret_edit_order[j]); - continue; - } + Vector<int> new_group{ c }; + Pair<int, int> group_border; + if (text_editor->has_selection(c)) { + group_border.first = text_editor->get_selection_from_line(c); + group_border.second = text_editor->get_selection_to_line(c); + } else { + group_border.first = text_editor->get_caret_line(c); + group_border.second = text_editor->get_caret_line(c); + } - if (text_editor->get_selection_to_line() == cl) { - if (text_editor->has_selection(c)) { - if (text_editor->get_selection_to_line(c) != cl) { - text_editor->select(cl + 1, 0, text_editor->get_selection_to_line(c), text_editor->get_selection_to_column(c), c); - break; - } - } + for (int j = i; j < caret_edit_order.size() - 1; j++) { + int c_current = caret_edit_order[j]; + int c_next = caret_edit_order[j + 1]; - carets_to_remove.push_back(c); - i = j - 1; - swaped_caret = true; - break; - } + int next_start_pos = text_editor->has_selection(c_next) ? text_editor->get_selection_from_line(c_next) : text_editor->get_caret_line(c_next); + int next_end_pos = text_editor->has_selection(c_next) ? text_editor->get_selection_to_line(c_next) : text_editor->get_caret_line(c_next); + + int current_start_pos = text_editor->has_selection(c_current) ? text_editor->get_selection_from_line(c_current) : text_editor->get_caret_line(c_current); + + i = j; + if (next_end_pos != current_start_pos && next_end_pos + 1 != current_start_pos) { break; } - - if (text_editor->get_caret_line(caret_edit_order[j]) == cl) { - carets_to_remove.push_back(caret_edit_order[j]); - i = j; - continue; + group_border.first = next_start_pos; + new_group.push_back(c_next); + // If the last caret is added to the current group there is no need to process it again + if (j + 1 == caret_edit_order.size() - 1) { + i++; } - break; } + group_borders.push_back(group_border); + caret_groups.push_back(new_group); + } - if (swaped_caret) { + for (int i = group_borders.size() - 1; i >= 0; i--) { + if (group_borders[i].first - 1 < 0) { continue; } - if (text_editor->has_selection(c)) { + // If the group starts overlapping with the upper group don't move it + if (i < group_borders.size() - 1 && group_borders[i].first - 1 <= group_borders[i + 1].second) { + continue; + } + + // We have to remember caret positions and selections prior to line swapping + Vector<Vector<int>> caret_group_parameters; + + for (int j = 0; j < caret_groups[i].size(); j++) { + int c = caret_groups[i][j]; + int cursor_line = text_editor->get_caret_line(c); + int cursor_column = text_editor->get_caret_column(c); + + if (!text_editor->has_selection(c)) { + caret_group_parameters.push_back(Vector<int>{ -1, -1, -1, -1, cursor_line, cursor_column }); + continue; + } int from_line = text_editor->get_selection_from_line(c); int from_col = text_editor->get_selection_from_column(c); int to_line = text_editor->get_selection_to_line(c); int to_column = text_editor->get_selection_to_column(c); - int cursor_line = text_editor->get_caret_line(c); - - for (int j = from_line; j <= to_line; j++) { - int line_id = j; - int next_id = j - 1; + caret_group_parameters.push_back(Vector<int>{ from_line, from_col, to_line, to_column, cursor_line, cursor_column }); + } - if (line_id == 0 || next_id < 0) { - return; - } + for (int line_id = group_borders[i].first; line_id <= group_borders[i].second; line_id++) { + text_editor->unfold_line(line_id); + text_editor->unfold_line(line_id - 1); - text_editor->unfold_line(line_id); - text_editor->unfold_line(next_id); + text_editor->swap_lines(line_id - 1, line_id); + } - text_editor->swap_lines(line_id, next_id); - text_editor->set_caret_line(next_id, c == 0, true, 0, c); - } - int from_line_up = from_line > 0 ? from_line - 1 : from_line; - int to_line_up = to_line > 0 ? to_line - 1 : to_line; - int cursor_line_up = cursor_line > 0 ? cursor_line - 1 : cursor_line; - text_editor->select(from_line_up, from_col, to_line_up, to_column, c); - text_editor->set_caret_line(cursor_line_up, c == 0, true, 0, c); - } else { - int line_id = text_editor->get_caret_line(c); - int next_id = line_id - 1; + for (int j = 0; j < caret_groups[i].size(); j++) { + int c = caret_groups[i][j]; + Vector<int> caret_parameters = caret_group_parameters[j]; + text_editor->set_caret_line(caret_parameters[4] - 1, c == 0, true, 0, c); + text_editor->set_caret_column(caret_parameters[5], c == 0, c); - if (line_id == 0 || next_id < 0) { - return; + if (caret_parameters[0] >= 0) { + text_editor->select(caret_parameters[0] - 1, caret_parameters[1], caret_parameters[2] - 1, caret_parameters[3], c); } - - text_editor->unfold_line(line_id); - text_editor->unfold_line(next_id); - - text_editor->swap_lines(line_id, next_id); - text_editor->set_caret_line(next_id, c == 0, true, 0, c); } } + text_editor->end_complex_operation(); text_editor->merge_overlapping_carets(); text_editor->queue_redraw(); @@ -1382,95 +1391,97 @@ void CodeTextEditor::move_lines_up() { void CodeTextEditor::move_lines_down() { text_editor->begin_complex_operation(); - Vector<int> carets_to_remove; - Vector<int> caret_edit_order = text_editor->get_caret_index_edit_order(); + + // Lists of carets representing each group + Vector<Vector<int>> caret_groups; + Vector<Pair<int, int>> group_borders; + + // Search for groups of carets and their selections residing on the same lines for (int i = 0; i < caret_edit_order.size(); i++) { int c = caret_edit_order[i]; - int cl = text_editor->get_caret_line(c); - bool swaped_caret = false; - for (int j = i + 1; j < caret_edit_order.size(); j++) { - if (text_editor->has_selection(caret_edit_order[j])) { - if (text_editor->get_selection_from_line() == cl) { - carets_to_remove.push_back(caret_edit_order[j]); - continue; - } + Vector<int> new_group{ c }; + Pair<int, int> group_border; + if (text_editor->has_selection(c)) { + group_border.first = text_editor->get_selection_from_line(c); + group_border.second = text_editor->get_selection_to_line(c); + } else { + group_border.first = text_editor->get_caret_line(c); + group_border.second = text_editor->get_caret_line(c); + } - if (text_editor->get_selection_to_line() == cl) { - if (text_editor->has_selection(c)) { - if (text_editor->get_selection_to_line(c) != cl) { - text_editor->select(cl + 1, 0, text_editor->get_selection_to_line(c), text_editor->get_selection_to_column(c), c); - break; - } - } + for (int j = i; j < caret_edit_order.size() - 1; j++) { + int c_current = caret_edit_order[j]; + int c_next = caret_edit_order[j + 1]; - carets_to_remove.push_back(c); - i = j - 1; - swaped_caret = true; - break; + int next_start_pos = text_editor->has_selection(c_next) ? text_editor->get_selection_from_line(c_next) : text_editor->get_caret_line(c_next); + int next_end_pos = text_editor->has_selection(c_next) ? text_editor->get_selection_to_line(c_next) : text_editor->get_caret_line(c_next); + + int current_start_pos = text_editor->has_selection(c_current) ? text_editor->get_selection_from_line(c_current) : text_editor->get_caret_line(c_current); + + i = j; + if (next_end_pos == current_start_pos || next_end_pos + 1 == current_start_pos) { + group_border.first = next_start_pos; + new_group.push_back(c_next); + // If the last caret is added to the current group there is no need to process it again + if (j + 1 == caret_edit_order.size() - 1) { + i++; } + } else { break; } - - if (text_editor->get_caret_line(caret_edit_order[j]) == cl) { - carets_to_remove.push_back(caret_edit_order[j]); - i = j; - continue; - } - break; } + group_borders.push_back(group_border); + caret_groups.push_back(new_group); + } - if (swaped_caret) { + for (int i = 0; i < group_borders.size(); i++) { + if (group_borders[i].second + 1 > text_editor->get_line_count() - 1) { continue; } - if (text_editor->has_selection(c)) { - int from_line = text_editor->get_selection_from_line(c); - int from_col = text_editor->get_selection_from_column(c); - int to_line = text_editor->get_selection_to_line(c); - int to_column = text_editor->get_selection_to_column(c); - int cursor_line = text_editor->get_caret_line(c); - - for (int l = to_line; l >= from_line; l--) { - int line_id = l; - int next_id = l + 1; - - if (line_id == text_editor->get_line_count() - 1 || next_id > text_editor->get_line_count()) { - continue; - } + // If the group starts overlapping with the upper group don't move it + if (i > 0 && group_borders[i].second + 1 >= group_borders[i - 1].first) { + continue; + } - text_editor->unfold_line(line_id); - text_editor->unfold_line(next_id); + // We have to remember caret positions and selections prior to line swapping + Vector<Vector<int>> caret_group_parameters; - text_editor->swap_lines(line_id, next_id); - text_editor->set_caret_line(next_id, c == 0, true, 0, c); - } - int from_line_down = from_line < text_editor->get_line_count() ? from_line + 1 : from_line; - int to_line_down = to_line < text_editor->get_line_count() ? to_line + 1 : to_line; - int cursor_line_down = cursor_line < text_editor->get_line_count() ? cursor_line + 1 : cursor_line; - text_editor->select(from_line_down, from_col, to_line_down, to_column, c); - text_editor->set_caret_line(cursor_line_down, c == 0, true, 0, c); - } else { - int line_id = text_editor->get_caret_line(c); - int next_id = line_id + 1; - - if (line_id == text_editor->get_line_count() - 1 || next_id > text_editor->get_line_count()) { - continue; + for (int j = 0; j < caret_groups[i].size(); j++) { + int c = caret_groups[i][j]; + int cursor_line = text_editor->get_caret_line(c); + int cursor_column = text_editor->get_caret_column(c); + + if (text_editor->has_selection(c)) { + int from_line = text_editor->get_selection_from_line(c); + int from_col = text_editor->get_selection_from_column(c); + int to_line = text_editor->get_selection_to_line(c); + int to_column = text_editor->get_selection_to_column(c); + caret_group_parameters.push_back(Vector<int>{ from_line, from_col, to_line, to_column, cursor_line, cursor_column }); + } else { + caret_group_parameters.push_back(Vector<int>{ -1, -1, -1, -1, cursor_line, cursor_column }); } + } + for (int line_id = group_borders[i].second; line_id >= group_borders[i].first; line_id--) { text_editor->unfold_line(line_id); - text_editor->unfold_line(next_id); + text_editor->unfold_line(line_id + 1); - text_editor->swap_lines(line_id, next_id); - text_editor->set_caret_line(next_id, c == 0, true, 0, c); + text_editor->swap_lines(line_id + 1, line_id); } - } - // Sort and remove backwards to preserve indexes. - carets_to_remove.sort(); - for (int i = carets_to_remove.size() - 1; i >= 0; i--) { - text_editor->remove_caret(carets_to_remove[i]); + for (int j = 0; j < caret_groups[i].size(); j++) { + int c = caret_groups[i][j]; + Vector<int> caret_parameters = caret_group_parameters[j]; + text_editor->set_caret_line(caret_parameters[4] + 1, c == 0, true, 0, c); + text_editor->set_caret_column(caret_parameters[5], c == 0, c); + + if (caret_parameters[0] >= 0) { + text_editor->select(caret_parameters[0] + 1, caret_parameters[1], caret_parameters[2] + 1, caret_parameters[3], c); + } + } } text_editor->merge_overlapping_carets(); @@ -2002,23 +2013,14 @@ void CodeTextEditor::goto_next_bookmark() { return; } - text_editor->remove_secondary_carets(); - int line = text_editor->get_caret_line(); - if (line >= (int)bmarks[bmarks.size() - 1]) { - text_editor->unfold_line(bmarks[0]); - text_editor->set_caret_line(bmarks[0]); - text_editor->center_viewport_to_caret(); - } else { - for (int i = 0; i < bmarks.size(); i++) { - int bmark_line = bmarks[i]; - if (bmark_line > line) { - text_editor->unfold_line(bmark_line); - text_editor->set_caret_line(bmark_line); - text_editor->center_viewport_to_caret(); - return; - } + int current_line = text_editor->get_caret_line(); + int bmark_idx = 0; + if (current_line < (int)bmarks[bmarks.size() - 1]) { + while (bmark_idx < bmarks.size() && bmarks[bmark_idx] <= current_line) { + bmark_idx++; } } + goto_line_centered(bmarks[bmark_idx]); } void CodeTextEditor::goto_prev_bookmark() { @@ -2027,23 +2029,14 @@ void CodeTextEditor::goto_prev_bookmark() { return; } - text_editor->remove_secondary_carets(); - int line = text_editor->get_caret_line(); - if (line <= (int)bmarks[0]) { - text_editor->unfold_line(bmarks[bmarks.size() - 1]); - text_editor->set_caret_line(bmarks[bmarks.size() - 1]); - text_editor->center_viewport_to_caret(); - } else { - for (int i = bmarks.size() - 1; i >= 0; i--) { - int bmark_line = bmarks[i]; - if (bmark_line < line) { - text_editor->unfold_line(bmark_line); - text_editor->set_caret_line(bmark_line); - text_editor->center_viewport_to_caret(); - return; - } + int current_line = text_editor->get_caret_line(); + int bmark_idx = bmarks.size() - 1; + if (current_line > (int)bmarks[0]) { + while (bmark_idx >= 0 && bmarks[bmark_idx] >= current_line) { + bmark_idx--; } } + goto_line_centered(bmarks[bmark_idx]); } void CodeTextEditor::remove_all_bookmarks() { diff --git a/editor/connections_dialog.cpp b/editor/connections_dialog.cpp index ed2044c117..2bd77bf99c 100644 --- a/editor/connections_dialog.cpp +++ b/editor/connections_dialog.cpp @@ -31,6 +31,7 @@ #include "connections_dialog.h" #include "editor/doc_tools.h" +#include "editor/editor_help.h" #include "editor/editor_node.h" #include "editor/editor_scale.h" #include "editor/editor_settings.h" diff --git a/editor/create_dialog.cpp b/editor/create_dialog.cpp index 785476d75b..2adab089e4 100644 --- a/editor/create_dialog.cpp +++ b/editor/create_dialog.cpp @@ -275,7 +275,8 @@ void CreateDialog::_configure_search_option_item(TreeItem *r_item, const String r_item->set_text(0, "\"" + p_type + "\""); } else if (script_type) { r_item->set_metadata(0, p_type); - r_item->set_text(0, p_type + " (" + ScriptServer::get_global_class_path(p_type).get_file() + ")"); + r_item->set_text(0, p_type); + r_item->set_suffix(0, "(" + ScriptServer::get_global_class_path(p_type).get_file() + ")"); } else { r_item->set_metadata(0, custom_type_parents[p_type]); r_item->set_text(0, p_type); diff --git a/editor/debugger/editor_debugger_node.cpp b/editor/debugger/editor_debugger_node.cpp index 1ec94aeae4..610f467faa 100644 --- a/editor/debugger/editor_debugger_node.cpp +++ b/editor/debugger/editor_debugger_node.cpp @@ -35,6 +35,8 @@ #include "editor/debugger/script_editor_debugger.h" #include "editor/editor_log.h" #include "editor/editor_node.h" +#include "editor/editor_settings.h" +#include "editor/inspector_dock.h" #include "editor/plugins/editor_debugger_plugin.h" #include "editor/plugins/script_editor_plugin.h" #include "editor/scene_tree_dock.h" diff --git a/editor/debugger/editor_debugger_tree.cpp b/editor/debugger/editor_debugger_tree.cpp index 4168efda26..8b31781c5e 100644 --- a/editor/debugger/editor_debugger_tree.cpp +++ b/editor/debugger/editor_debugger_tree.cpp @@ -34,6 +34,7 @@ #include "editor/editor_node.h" #include "editor/scene_tree_dock.h" #include "scene/debugger/scene_debugger.h" +#include "scene/gui/texture_rect.h" #include "scene/resources/packed_scene.h" #include "servers/display_server.h" diff --git a/editor/debugger/script_editor_debugger.cpp b/editor/debugger/script_editor_debugger.cpp index d419e16b12..deca638f3b 100644 --- a/editor/debugger/script_editor_debugger.cpp +++ b/editor/debugger/script_editor_debugger.cpp @@ -46,6 +46,7 @@ #include "editor/editor_property_name_processor.h" #include "editor/editor_scale.h" #include "editor/editor_settings.h" +#include "editor/inspector_dock.h" #include "editor/plugins/canvas_item_editor_plugin.h" #include "editor/plugins/editor_debugger_plugin.h" #include "editor/plugins/node_3d_editor_plugin.h" @@ -53,6 +54,7 @@ #include "scene/3d/camera_3d.h" #include "scene/debugger/scene_debugger.h" #include "scene/gui/dialogs.h" +#include "scene/gui/grid_container.h" #include "scene/gui/label.h" #include "scene/gui/line_edit.h" #include "scene/gui/margin_container.h" diff --git a/editor/editor_audio_buses.cpp b/editor/editor_audio_buses.cpp index 24116a8053..a040d918df 100644 --- a/editor/editor_audio_buses.cpp +++ b/editor/editor_audio_buses.cpp @@ -40,6 +40,7 @@ #include "editor/editor_settings.h" #include "editor/editor_undo_redo_manager.h" #include "filesystem_dock.h" +#include "scene/gui/separator.h" #include "scene/resources/font.h" #include "servers/audio_server.h" diff --git a/editor/editor_autoload_settings.cpp b/editor/editor_autoload_settings.cpp index 8cb1dfd24e..41b3d45a1f 100644 --- a/editor/editor_autoload_settings.cpp +++ b/editor/editor_autoload_settings.cpp @@ -541,8 +541,6 @@ void EditorAutoloadSettings::update_autoload() { info.node->queue_free(); info.node = nullptr; } - - ProjectSettings::get_singleton()->remove_autoload(info.name); } // Load new/changed autoloads @@ -567,12 +565,6 @@ void EditorAutoloadSettings::update_autoload() { } } - ProjectSettings::AutoloadInfo prop_info; - prop_info.name = info->name; - prop_info.path = info->path; - prop_info.is_singleton = info->is_singleton; - ProjectSettings::get_singleton()->add_autoload(prop_info); - if (!info->in_editor && !info->is_singleton) { // No reason to keep this node memdelete(info->node); diff --git a/editor/editor_data.cpp b/editor/editor_data.cpp index 48be0c9c00..f15b874c45 100644 --- a/editor/editor_data.cpp +++ b/editor/editor_data.cpp @@ -945,11 +945,11 @@ StringName EditorData::script_class_get_base(const String &p_class) const { Variant EditorData::script_class_instance(const String &p_class) { if (ScriptServer::is_global_class(p_class)) { - Variant obj = ClassDB::instantiate(ScriptServer::get_global_class_native_base(p_class)); - if (obj) { - Ref<Script> script = script_class_load_script(p_class); - if (script.is_valid()) { - ((Object *)obj)->set_script(script); + Ref<Script> script = script_class_load_script(p_class); + if (script.is_valid()) { + Object *obj = ClassDB::instantiate(script->get_instance_base_type()); + if (obj) { + obj->set_script(script); } return obj; } diff --git a/editor/editor_feature_profile.cpp b/editor/editor_feature_profile.cpp index 49fb16a095..7080cdbdd5 100644 --- a/editor/editor_feature_profile.cpp +++ b/editor/editor_feature_profile.cpp @@ -309,7 +309,11 @@ void EditorFeatureProfile::_bind_methods() { BIND_ENUM_CONSTANT(FEATURE_MAX); } -EditorFeatureProfile::EditorFeatureProfile() {} +EditorFeatureProfile::EditorFeatureProfile() { + for (int i = 0; i < FEATURE_MAX; i++) { + features_disabled[i] = false; + } +} ////////////////////////// @@ -746,6 +750,8 @@ void EditorFeatureProfileManager::_update_selected_profile() { class_list->clear(); String profile = _get_selected_profile(); + profile_actions[PROFILE_SET]->set_disabled(profile == current_profile); + if (profile.is_empty()) { //nothing selected, nothing edited property_list->clear(); edited.unref(); diff --git a/editor/editor_file_dialog.cpp b/editor/editor_file_dialog.cpp index ee02916a5f..55c512f77d 100644 --- a/editor/editor_file_dialog.cpp +++ b/editor/editor_file_dialog.cpp @@ -34,7 +34,6 @@ #include "core/io/file_access.h" #include "core/os/keyboard.h" #include "core/os/os.h" -#include "core/string/print_string.h" #include "dependency_editor.h" #include "editor/editor_file_system.h" #include "editor/editor_node.h" @@ -44,6 +43,10 @@ #include "scene/gui/center_container.h" #include "scene/gui/label.h" #include "scene/gui/margin_container.h" +#include "scene/gui/option_button.h" +#include "scene/gui/separator.h" +#include "scene/gui/split_container.h" +#include "scene/gui/texture_rect.h" #include "servers/display_server.h" EditorFileDialog::GetIconFunc EditorFileDialog::get_icon_func = nullptr; diff --git a/editor/editor_file_dialog.h b/editor/editor_file_dialog.h index 2e7302aaf9..40073326a1 100644 --- a/editor/editor_file_dialog.h +++ b/editor/editor_file_dialog.h @@ -32,17 +32,14 @@ #define EDITOR_FILE_DIALOG_H #include "core/io/dir_access.h" -#include "editor/plugins/editor_preview_plugins.h" -#include "scene/gui/box_container.h" #include "scene/gui/dialogs.h" -#include "scene/gui/item_list.h" -#include "scene/gui/line_edit.h" -#include "scene/gui/option_button.h" -#include "scene/gui/separator.h" -#include "scene/gui/split_container.h" -#include "scene/gui/texture_rect.h" class DependencyRemoveDialog; +class HSplitContainer; +class ItemList; +class OptionButton; +class PopupMenu; +class TextureRect; class EditorFileDialog : public ConfirmationDialog { GDCLASS(EditorFileDialog, ConfirmationDialog); diff --git a/editor/editor_file_system.cpp b/editor/editor_file_system.cpp index 90b03ab40d..678ec04b9d 100644 --- a/editor/editor_file_system.cpp +++ b/editor/editor_file_system.cpp @@ -39,6 +39,7 @@ #include "core/object/worker_thread_pool.h" #include "core/os/os.h" #include "core/variant/variant_parser.h" +#include "editor/editor_help.h" #include "editor/editor_node.h" #include "editor/editor_paths.h" #include "editor/editor_resource_preview.h" @@ -619,7 +620,12 @@ bool EditorFileSystem::_update_scan_actions() { if (_test_for_reimport(full_path, false)) { //must reimport reimports.push_back(full_path); - reimports.append_array(_get_dependencies(full_path)); + Vector<String> dependencies = _get_dependencies(full_path); + for (const String &dependency_path : dependencies) { + if (import_extensions.has(dependency_path.get_extension())) { + reimports.push_back(dependency_path); + } + } } else { //must not reimport, all was good //update modified times, to avoid reimport diff --git a/editor/editor_fonts.cpp b/editor/editor_fonts.cpp index e7d4636ad9..cf413133aa 100644 --- a/editor/editor_fonts.cpp +++ b/editor/editor_fonts.cpp @@ -41,7 +41,7 @@ Ref<FontFile> load_external_font(const String &p_path, TextServer::Hinting p_hin Ref<FontFile> font; font.instantiate(); - Vector<uint8_t> data = FileAccess::get_file_as_array(p_path); + Vector<uint8_t> data = FileAccess::get_file_as_bytes(p_path); font->set_data(data); font->set_multichannel_signed_distance_field(p_msdf); diff --git a/editor/editor_help.cpp b/editor/editor_help.cpp index 676e4b0b33..6bd67fbcb9 100644 --- a/editor/editor_help.cpp +++ b/editor/editor_help.cpp @@ -39,6 +39,7 @@ #include "editor/editor_scale.h" #include "editor/editor_settings.h" #include "editor/plugins/script_editor_plugin.h" +#include "scene/gui/line_edit.h" #define CONTRIBUTE_URL vformat("%s/community/contributing/updating_the_class_reference.html", VERSION_DOCS_URL) diff --git a/editor/editor_inspector.cpp b/editor/editor_inspector.cpp index 4822aab7d4..a5397a8e6a 100644 --- a/editor/editor_inspector.cpp +++ b/editor/editor_inspector.cpp @@ -30,9 +30,7 @@ #include "editor_inspector.h" -#include "array_property_edit.h" #include "core/os/keyboard.h" -#include "dictionary_property_edit.h" #include "editor/doc_tools.h" #include "editor/editor_feature_profile.h" #include "editor/editor_node.h" @@ -40,9 +38,11 @@ #include "editor/editor_scale.h" #include "editor/editor_settings.h" #include "editor/editor_undo_redo_manager.h" +#include "editor/inspector_dock.h" #include "editor/plugins/script_editor_plugin.h" #include "multi_node_edit.h" -#include "scene/gui/center_container.h" +#include "scene/gui/spin_box.h" +#include "scene/gui/texture_rect.h" #include "scene/property_utils.h" #include "scene/resources/packed_scene.h" @@ -660,6 +660,7 @@ void EditorProperty::gui_input(const Ref<InputEvent> &p_event) { } if (keying_rect.has_point(mpos)) { + accept_event(); emit_signal(SNAME("property_keyed"), property, use_keying_next()); if (use_keying_next()) { @@ -683,10 +684,12 @@ void EditorProperty::gui_input(const Ref<InputEvent> &p_event) { } } if (delete_rect.has_point(mpos)) { + accept_event(); emit_signal(SNAME("property_deleted"), property); } if (revert_rect.has_point(mpos)) { + accept_event(); bool is_valid_revert = false; Variant revert_value = EditorPropertyRevert::get_property_revert_value(object, property, &is_valid_revert); ERR_FAIL_COND(!is_valid_revert); @@ -695,11 +698,13 @@ void EditorProperty::gui_input(const Ref<InputEvent> &p_event) { } if (check_rect.has_point(mpos)) { + accept_event(); checked = !checked; queue_redraw(); emit_signal(SNAME("property_checked"), property, checked); } } else if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == MouseButton::RIGHT) { + accept_event(); _update_popup(); menu->set_position(get_screen_position() + get_local_mouse_position()); menu->reset_size(); @@ -1482,6 +1487,8 @@ void EditorInspectorSection::gui_input(const Ref<InputEvent> &p_event) { return; } + accept_event(); + bool should_unfold = !object->editor_is_section_unfolded(section); if (should_unfold) { unfold(); @@ -1680,6 +1687,7 @@ void EditorInspectorArray::_panel_gui_input(Ref<InputEvent> p_event, int p_index Ref<InputEventMouseButton> mb = p_event; if (mb.is_valid()) { if (movable && mb->get_button_index() == MouseButton::RIGHT) { + array_elements[p_index].panel->accept_event(); popup_array_index_pressed = begin_array_index + p_index; rmb_popup->set_item_disabled(OPTION_MOVE_UP, popup_array_index_pressed == 0); rmb_popup->set_item_disabled(OPTION_MOVE_DOWN, popup_array_index_pressed == count - 1); diff --git a/editor/editor_inspector.h b/editor/editor_inspector.h index 1b93b19845..41651494ce 100644 --- a/editor/editor_inspector.h +++ b/editor/editor_inspector.h @@ -33,14 +33,17 @@ #include "editor_property_name_processor.h" #include "scene/gui/box_container.h" -#include "scene/gui/button.h" -#include "scene/gui/dialogs.h" -#include "scene/gui/line_edit.h" -#include "scene/gui/option_button.h" -#include "scene/gui/panel_container.h" #include "scene/gui/scroll_container.h" -#include "scene/gui/spin_box.h" -#include "scene/gui/texture_rect.h" + +class AcceptDialog; +class Button; +class ConfirmationDialog; +class LineEdit; +class OptionButton; +class PanelContainer; +class PopupMenu; +class SpinBox; +class TextureRect; class EditorPropertyRevert { public: diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index 2f6481704a..06e1e8b22e 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -37,7 +37,6 @@ #include "core/io/image_loader.h" #include "core/io/resource_loader.h" #include "core/io/resource_saver.h" -#include "core/io/stream_peer_tls.h" #include "core/object/class_db.h" #include "core/object/message_queue.h" #include "core/os/keyboard.h" @@ -47,10 +46,7 @@ #include "core/string/translation.h" #include "core/version.h" #include "main/main.h" -#include "scene/3d/importer_mesh_instance_3d.h" -#include "scene/gui/center_container.h" #include "scene/gui/color_picker.h" -#include "scene/gui/control.h" #include "scene/gui/dialogs.h" #include "scene/gui/file_dialog.h" #include "scene/gui/link_button.h" @@ -61,17 +57,13 @@ #include "scene/gui/split_container.h" #include "scene/gui/tab_bar.h" #include "scene/gui/tab_container.h" -#include "scene/gui/texture_progress_bar.h" #include "scene/main/window.h" #include "scene/resources/packed_scene.h" #include "servers/display_server.h" -#include "servers/navigation_server_2d.h" #include "servers/navigation_server_3d.h" #include "servers/physics_server_2d.h" -#include "servers/rendering/rendering_device.h" #include "editor/audio_stream_preview.h" -#include "editor/debugger/debug_adapter/debug_adapter_server.h" #include "editor/debugger/editor_debugger_node.h" #include "editor/dependency_editor.h" #include "editor/editor_about.h" @@ -90,12 +82,13 @@ #include "editor/editor_plugin.h" #include "editor/editor_properties.h" #include "editor/editor_property_name_processor.h" +#include "editor/editor_quick_open.h" +#include "editor/editor_resource_preview.h" #include "editor/editor_run.h" #include "editor/editor_run_native.h" #include "editor/editor_scale.h" #include "editor/editor_settings.h" #include "editor/editor_settings_dialog.h" -#include "editor/editor_spin_slider.h" #include "editor/editor_themes.h" #include "editor/editor_toaster.h" #include "editor/editor_translation_parser.h" @@ -108,7 +101,6 @@ #include "editor/import/audio_stream_import_settings.h" #include "editor/import/dynamic_font_import_settings.h" #include "editor/import/editor_import_collada.h" -#include "editor/import/editor_import_plugin.h" #include "editor/import/resource_importer_bitmask.h" #include "editor/import/resource_importer_bmfont.h" #include "editor/import/resource_importer_csv_translation.h" @@ -123,6 +115,7 @@ #include "editor/import/resource_importer_wav.h" #include "editor/import/scene_import_settings.h" #include "editor/import_dock.h" +#include "editor/inspector_dock.h" #include "editor/multi_node_edit.h" #include "editor/node_dock.h" #include "editor/plugin_config_dialog.h" @@ -130,6 +123,7 @@ #include "editor/plugins/asset_library_editor_plugin.h" #include "editor/plugins/canvas_item_editor_plugin.h" #include "editor/plugins/debugger_editor_plugin.h" +#include "editor/plugins/editor_preview_plugins.h" #include "editor/plugins/editor_resource_conversion_plugin.h" #include "editor/plugins/gdextension_export_plugin.h" #include "editor/plugins/material_editor_plugin.h" @@ -1200,6 +1194,10 @@ void EditorNode::edit_node(Node *p_node) { push_item(p_node); } +void EditorNode::edit_resource(const Ref<Resource> &p_resource) { + InspectorDock::get_singleton()->edit_resource(p_resource); +} + void EditorNode::save_resource_in_path(const Ref<Resource> &p_resource, const String &p_path) { editor_data.apply_changes_in_editors(); int flg = 0; @@ -2276,7 +2274,9 @@ void EditorNode::_edit_current(bool p_skip_foreign) { } else { Node *selected_node = nullptr; - if (current_obj->is_class("MultiNodeEdit")) { + if (current_obj->is_class("EditorDebuggerRemoteObject")) { + disable_folding = true; + } else if (current_obj->is_class("MultiNodeEdit")) { Node *scene = get_edited_scene(); if (scene) { MultiNodeEdit *multi_node_edit = Object::cast_to<MultiNodeEdit>(current_obj); @@ -3358,7 +3358,9 @@ void EditorNode::add_editor_plugin(EditorPlugin *p_editor, bool p_config_changed void EditorNode::remove_editor_plugin(EditorPlugin *p_editor, bool p_config_changed) { if (p_editor->has_main_screen()) { - for (int i = 0; i < singleton->main_editor_buttons.size(); i++) { + // Remove the main editor button and update the bindings of + // all buttons behind it to point to the correct main window. + for (int i = singleton->main_editor_buttons.size() - 1; i >= 0; i--) { if (p_editor->get_name() == singleton->main_editor_buttons[i]->get_text()) { if (singleton->main_editor_buttons[i]->is_pressed()) { singleton->editor_select(EDITOR_SCRIPT); @@ -3368,6 +3370,9 @@ void EditorNode::remove_editor_plugin(EditorPlugin *p_editor, bool p_config_chan singleton->main_editor_buttons.remove_at(i); break; + } else { + singleton->main_editor_buttons[i]->disconnect("pressed", callable_mp(singleton, &EditorNode::editor_select)); + singleton->main_editor_buttons[i]->connect("pressed", callable_mp(singleton, &EditorNode::editor_select).bind(i - 1)); } } @@ -5879,10 +5884,6 @@ void EditorNode::_feature_profile_changed() { node_tabs->set_tab_hidden(node_tabs->get_tab_idx_from_control(NodeDock::get_singleton()), false); fs_tabs->set_tab_hidden(fs_tabs->get_tab_idx_from_control(FileSystemDock::get_singleton()), false); history_tabs->set_tab_hidden(history_tabs->get_tab_idx_from_control(history_dock), false); - history_dock->set_visible(true); - ImportDock::get_singleton()->set_visible(true); - NodeDock::get_singleton()->set_visible(true); - FileSystemDock::get_singleton()->set_visible(true); main_editor_buttons[EDITOR_3D]->set_visible(true); main_editor_buttons[EDITOR_SCRIPT]->set_visible(true); if (AssetLibraryEditorPlugin::is_available()) { diff --git a/editor/editor_node.h b/editor/editor_node.h index ff0338a794..c430662c7f 100644 --- a/editor/editor_node.h +++ b/editor/editor_node.h @@ -32,12 +32,13 @@ #define EDITOR_NODE_H #include "core/templates/safe_refcount.h" +#include "editor/editor_data.h" #include "editor/editor_folding.h" #include "editor/editor_native_shader_source_visualizer.h" +#include "editor/editor_plugin.h" #include "editor/editor_run.h" #include "editor/editor_title_bar.h" #include "editor/export/editor_export.h" -#include "editor/inspector_dock.h" typedef void (*EditorNodeInitCallback)(); typedef void (*EditorPluginInitializeCallback)(); @@ -46,8 +47,8 @@ typedef bool (*EditorBuildCallback)(); class AcceptDialog; class AudioStreamPreviewGenerator; class BackgroundProgress; -class Button; class CenterContainer; +class CheckBox; class ColorPicker; class ConfirmationDialog; class Control; @@ -59,18 +60,19 @@ class EditorCommandPalette; class EditorExport; class EditorExtensionManager; class EditorFeatureProfileManager; +class EditorFileDialog; class EditorFileServer; class EditorFolding; class EditorInspector; class EditorLayoutsDialog; class EditorLog; -class EditorPlugin; class EditorPluginList; class EditorQuickOpen; class EditorResourcePreview; class EditorResourceConversionPlugin; class EditorRun; class EditorRunNative; +class EditorSelectionHistory; class EditorSettingsDialog; class EditorToaster; class EditorUndoRedoManager; @@ -84,6 +86,7 @@ class LinkButton; class MenuBar; class MenuButton; class NodeDock; +class OptionButton; class OrphanResourcesDialog; class Panel; class PanelContainer; @@ -98,7 +101,9 @@ class ScriptCreateDialog; class SubViewport; class TabBar; class TabContainer; +class TextureRect; class TextureProgressBar; +class Tree; class VSplitContainer; class Window; class EditorBuildProfileManager; @@ -775,7 +780,7 @@ public: bool is_movie_maker_enabled() const; void edit_node(Node *p_node); - void edit_resource(const Ref<Resource> &p_resource) { InspectorDock::get_singleton()->edit_resource(p_resource); }; + void edit_resource(const Ref<Resource> &p_resource); void save_resource_in_path(const Ref<Resource> &p_resource, const String &p_path); void save_resource(const Ref<Resource> &p_resource); diff --git a/editor/editor_plugin.cpp b/editor/editor_plugin.cpp index e11bc3c252..f9c8b722c4 100644 --- a/editor/editor_plugin.cpp +++ b/editor/editor_plugin.cpp @@ -42,6 +42,7 @@ #include "editor/filesystem_dock.h" #include "editor/import/editor_import_plugin.h" #include "editor/import/resource_importer_scene.h" +#include "editor/inspector_dock.h" #include "editor/plugins/canvas_item_editor_plugin.h" #include "editor/plugins/editor_debugger_plugin.h" #include "editor/plugins/node_3d_editor_plugin.h" diff --git a/editor/editor_properties.cpp b/editor/editor_properties.cpp index 8c53f576ac..fb3bf46c05 100644 --- a/editor/editor_properties.cpp +++ b/editor/editor_properties.cpp @@ -32,16 +32,22 @@ #include "core/config/project_settings.h" #include "core/core_string_names.h" +#include "editor/create_dialog.h" #include "editor/editor_file_dialog.h" #include "editor/editor_node.h" #include "editor/editor_properties_array_dict.h" -#include "editor/editor_resource_preview.h" +#include "editor/editor_resource_picker.h" #include "editor/editor_scale.h" -#include "editor/filesystem_dock.h" +#include "editor/editor_settings.h" +#include "editor/inspector_dock.h" +#include "editor/plugins/script_editor_plugin.h" #include "editor/project_settings_editor.h" +#include "editor/property_selector.h" +#include "editor/scene_tree_editor.h" #include "scene/2d/gpu_particles_2d.h" #include "scene/3d/fog_volume.h" #include "scene/3d/gpu_particles_3d.h" +#include "scene/gui/color_picker.h" #include "scene/main/window.h" #include "scene/resources/font.h" #include "scene/resources/mesh.h" diff --git a/editor/editor_properties.h b/editor/editor_properties.h index ad36e01544..f38e33d9e3 100644 --- a/editor/editor_properties.h +++ b/editor/editor_properties.h @@ -31,15 +31,19 @@ #ifndef EDITOR_PROPERTIES_H #define EDITOR_PROPERTIES_H -#include "editor/create_dialog.h" #include "editor/editor_inspector.h" -#include "editor/editor_locale_dialog.h" -#include "editor/editor_resource_picker.h" -#include "editor/editor_spin_slider.h" -#include "editor/property_selector.h" -#include "editor/scene_tree_editor.h" -#include "scene/gui/color_picker.h" -#include "scene/gui/line_edit.h" + +class CheckBox; +class ColorPickerButton; +class CreateDialog; +class EditorFileDialog; +class EditorLocaleDialog; +class EditorResourcePicker; +class EditorSpinSlider; +class PropertySelector; +class SceneTreeDialog; +class TextEdit; +class TextureButton; class EditorPropertyNil : public EditorProperty { GDCLASS(EditorPropertyNil, EditorProperty); diff --git a/editor/editor_properties_array_dict.cpp b/editor/editor_properties_array_dict.cpp index 659221ee0b..edda6c5d7b 100644 --- a/editor/editor_properties_array_dict.cpp +++ b/editor/editor_properties_array_dict.cpp @@ -34,6 +34,7 @@ #include "core/io/marshalls.h" #include "editor/editor_properties.h" #include "editor/editor_scale.h" +#include "editor/editor_settings.h" #include "editor/inspector_dock.h" bool EditorPropertyArrayObject::_set(const StringName &p_name, const Variant &p_value) { @@ -692,6 +693,8 @@ void EditorPropertyArray::_reorder_button_up() { reorder_mouse_y_delta = 0.0f; Input::get_singleton()->set_mouse_mode(Input::MOUSE_MODE_VISIBLE); + + ERR_FAIL_NULL(reorder_selected_button); reorder_selected_button->warp_mouse(reorder_selected_button->get_size() / 2.0f); reorder_selected_element_hbox = nullptr; diff --git a/editor/editor_run.h b/editor/editor_run.h index 4cbc6838e4..935e32ee2a 100644 --- a/editor/editor_run.h +++ b/editor/editor_run.h @@ -32,7 +32,7 @@ #define EDITOR_RUN_H #include "core/os/os.h" -#include "scene/main/node.h" + class EditorRun { public: enum Status { diff --git a/editor/editor_settings.cpp b/editor/editor_settings.cpp index bc186c7a16..c44fe04442 100644 --- a/editor/editor_settings.cpp +++ b/editor/editor_settings.cpp @@ -452,11 +452,12 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) { EDITOR_SETTING(Variant::BOOL, PROPERTY_HINT_NONE, "interface/inspector/show_low_level_opentype_features", false, "") // Theme - EDITOR_SETTING(Variant::STRING, PROPERTY_HINT_ENUM, "interface/theme/preset", "Default", "Default,Breeze Dark,Godot 2,Gray,Light,Solarized (Dark),Solarized (Light),Custom") + EDITOR_SETTING(Variant::STRING, PROPERTY_HINT_ENUM, "interface/theme/preset", "Default", "Default,Breeze Dark,Godot 2,Gray,Light,Solarized (Dark),Solarized (Light),Black (OLED),Custom") EDITOR_SETTING(Variant::INT, PROPERTY_HINT_ENUM, "interface/theme/icon_and_font_color", 0, "Auto,Dark,Light") EDITOR_SETTING(Variant::COLOR, PROPERTY_HINT_NONE, "interface/theme/base_color", Color(0.2, 0.23, 0.31), "") EDITOR_SETTING(Variant::COLOR, PROPERTY_HINT_NONE, "interface/theme/accent_color", Color(0.41, 0.61, 0.91), "") EDITOR_SETTING(Variant::FLOAT, PROPERTY_HINT_RANGE, "interface/theme/contrast", 0.3, "-1,1,0.01") + EDITOR_SETTING(Variant::BOOL, PROPERTY_HINT_NONE, "interface/theme/draw_extra_borders", false, "") EDITOR_SETTING(Variant::FLOAT, PROPERTY_HINT_RANGE, "interface/theme/icon_saturation", 1.0, "0,2,0.01") EDITOR_SETTING(Variant::FLOAT, PROPERTY_HINT_RANGE, "interface/theme/relationship_line_opacity", 0.1, "0.00,1,0.01") EDITOR_SETTING(Variant::INT, PROPERTY_HINT_RANGE, "interface/theme/border_size", 0, "0,2,1") diff --git a/editor/editor_settings_dialog.cpp b/editor/editor_settings_dialog.cpp index b1b54fd717..6c11572d10 100644 --- a/editor/editor_settings_dialog.cpp +++ b/editor/editor_settings_dialog.cpp @@ -61,7 +61,7 @@ void EditorSettingsDialog::_settings_changed() { void EditorSettingsDialog::_settings_property_edited(const String &p_name) { String full_name = inspector->get_full_item_path(p_name); - if (full_name == "interface/theme/accent_color" || full_name == "interface/theme/base_color" || full_name == "interface/theme/contrast") { + if (full_name == "interface/theme/accent_color" || full_name == "interface/theme/base_color" || full_name == "interface/theme/contrast" || full_name == "interface/theme/draw_extra_borders") { EditorSettings::get_singleton()->set_manually("interface/theme/preset", "Custom"); // set preset to Custom } else if (full_name.begins_with("text_editor/theme/highlighting")) { EditorSettings::get_singleton()->set_manually("text_editor/theme/color_theme", "Custom"); diff --git a/editor/editor_themes.cpp b/editor/editor_themes.cpp index df28b2e6ab..96834f4a6c 100644 --- a/editor/editor_themes.cpp +++ b/editor/editor_themes.cpp @@ -393,6 +393,7 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) { Color accent_color = EDITOR_GET("interface/theme/accent_color"); Color base_color = EDITOR_GET("interface/theme/base_color"); float contrast = EDITOR_GET("interface/theme/contrast"); + bool draw_extra_borders = EDITOR_GET("interface/theme/draw_extra_borders"); float icon_saturation = EDITOR_GET("interface/theme/icon_saturation"); float relationship_line_opacity = EDITOR_GET("interface/theme/relationship_line_opacity"); @@ -404,6 +405,7 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) { Color preset_accent_color; Color preset_base_color; float preset_contrast = 0; + bool preset_draw_extra_borders = false; const float default_contrast = 0.3; @@ -440,6 +442,12 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) { preset_base_color = Color(0.89, 0.86, 0.79); // A negative contrast rate looks better for light themes, since it better follows the natural order of UI "elevation". preset_contrast = -0.08; + } else if (preset == "Black (OLED)") { + preset_accent_color = Color(0.45, 0.75, 1.0); + preset_base_color = Color(0, 0, 0); + // The contrast rate value is irrelevant on a fully black theme. + preset_contrast = 0.0; + preset_draw_extra_borders = true; } else { // Default preset_accent_color = Color(0.44, 0.73, 0.98); preset_base_color = Color(0.21, 0.24, 0.29); @@ -450,15 +458,18 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) { accent_color = preset_accent_color; base_color = preset_base_color; contrast = preset_contrast; + draw_extra_borders = preset_draw_extra_borders; EditorSettings::get_singleton()->set_initial_value("interface/theme/accent_color", accent_color); EditorSettings::get_singleton()->set_initial_value("interface/theme/base_color", base_color); EditorSettings::get_singleton()->set_initial_value("interface/theme/contrast", contrast); + EditorSettings::get_singleton()->set_initial_value("interface/theme/draw_extra_borders", draw_extra_borders); } EditorSettings::get_singleton()->set_manually("interface/theme/preset", preset); EditorSettings::get_singleton()->set_manually("interface/theme/accent_color", accent_color); EditorSettings::get_singleton()->set_manually("interface/theme/base_color", base_color); EditorSettings::get_singleton()->set_manually("interface/theme/contrast", contrast); + EditorSettings::get_singleton()->set_manually("interface/theme/draw_extra_borders", draw_extra_borders); // Colors bool dark_theme = EditorSettings::get_singleton()->is_dark_theme(); @@ -477,6 +488,10 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) { const Color dark_color_2 = base_color.lerp(Color(0, 0, 0, 1), contrast * 1.5).clamp(); const Color dark_color_3 = base_color.lerp(Color(0, 0, 0, 1), contrast * 2).clamp(); + // Only used when the Draw Extra Borders editor setting is enabled. + const Color extra_border_color_1 = Color(0.5, 0.5, 0.5); + const Color extra_border_color_2 = dark_theme ? Color(0.3, 0.3, 0.3) : Color(0.7, 0.7, 0.7); + const Color background_color = dark_color_2; // White (dark theme) or black (light theme), will be used to generate the rest of the colors @@ -489,7 +504,7 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) { const Color font_hover_color = mono_color.lerp(base_color, 0.125); const Color font_focus_color = mono_color.lerp(base_color, 0.125); const Color font_hover_pressed_color = font_hover_color.lerp(accent_color, 0.74); - const Color font_disabled_color = Color(mono_color.r, mono_color.g, mono_color.b, 0.3); + const Color font_disabled_color = Color(mono_color.r, mono_color.g, mono_color.b, 0.35); const Color font_readonly_color = Color(mono_color.r, mono_color.g, mono_color.b, 0.65); const Color font_placeholder_color = Color(mono_color.r, mono_color.g, mono_color.b, 0.6); const Color selection_color = accent_color * Color(1, 1, 1, 0.4); @@ -634,10 +649,19 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) { Ref<StyleBoxFlat> style_widget = style_default->duplicate(); style_widget->set_default_margin_individual(widget_default_margin.x, widget_default_margin.y, widget_default_margin.x, widget_default_margin.y); style_widget->set_bg_color(dark_color_1); - style_widget->set_border_color(dark_color_2); + if (draw_extra_borders) { + style_widget->set_border_width_all(Math::round(EDSCALE)); + style_widget->set_border_color(extra_border_color_1); + } else { + style_widget->set_border_color(dark_color_2); + } Ref<StyleBoxFlat> style_widget_disabled = style_widget->duplicate(); - style_widget_disabled->set_border_color(disabled_color); + if (draw_extra_borders) { + style_widget_disabled->set_border_color(extra_border_color_2); + } else { + style_widget_disabled->set_border_color(disabled_color); + } style_widget_disabled->set_bg_color(disabled_bg_color); Ref<StyleBoxFlat> style_widget_focus = style_widget->duplicate(); @@ -650,7 +674,11 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) { Ref<StyleBoxFlat> style_widget_hover = style_widget->duplicate(); style_widget_hover->set_bg_color(mono_color * Color(1, 1, 1, 0.11)); - style_widget_hover->set_border_color(mono_color * Color(1, 1, 1, 0.05)); + if (draw_extra_borders) { + style_widget_hover->set_border_color(extra_border_color_1); + } else { + style_widget_hover->set_border_color(mono_color * Color(1, 1, 1, 0.05)); + } // Style for windows, popups, etc.. Ref<StyleBoxFlat> style_popup = style_default->duplicate(); @@ -991,7 +1019,11 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) { style_popup_menu->set_default_margin_individual(EDSCALE, 2 * EDSCALE, EDSCALE, 2 * EDSCALE); // Always display a border for PopupMenus so they can be distinguished from their background. style_popup_menu->set_border_width_all(EDSCALE); - style_popup_menu->set_border_color(dark_color_2); + if (draw_extra_borders) { + style_popup_menu->set_border_color(extra_border_color_2); + } else { + style_popup_menu->set_border_color(dark_color_2); + } theme->set_stylebox("panel", "PopupMenu", style_popup_menu); Ref<StyleBoxFlat> style_menu_hover = style_widget_hover->duplicate(); @@ -1111,7 +1143,13 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) { Ref<StyleBoxFlat> style_tree_bg = style_default->duplicate(); // Make Trees easier to distinguish from other controls by using a darker background color. style_tree_bg->set_bg_color(dark_color_1.lerp(dark_color_2, 0.5)); - style_tree_bg->set_border_color(dark_color_3); + if (draw_extra_borders) { + style_tree_bg->set_border_width_all(Math::round(EDSCALE)); + style_tree_bg->set_border_color(extra_border_color_2); + } else { + style_tree_bg->set_border_color(dark_color_3); + } + theme->set_stylebox("panel", "Tree", style_tree_bg); // Tree @@ -1207,8 +1245,14 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) { // ItemList Ref<StyleBoxFlat> style_itemlist_bg = style_default->duplicate(); style_itemlist_bg->set_bg_color(dark_color_1); - style_itemlist_bg->set_border_width_all(border_width); - style_itemlist_bg->set_border_color(dark_color_3); + + if (draw_extra_borders) { + style_itemlist_bg->set_border_width_all(Math::round(EDSCALE)); + style_itemlist_bg->set_border_color(extra_border_color_2); + } else { + style_itemlist_bg->set_border_width_all(border_width); + style_itemlist_bg->set_border_color(dark_color_3); + } Ref<StyleBoxFlat> style_itemlist_cursor = style_default->duplicate(); style_itemlist_cursor->set_draw_center(false); @@ -1326,14 +1370,21 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) { // The original style_widget style has an extra 1 pixel offset that makes LineEdits not align with Buttons, // so this compensates for that. style_line_edit->set_default_margin(SIDE_TOP, style_line_edit->get_default_margin(SIDE_TOP) - 1 * EDSCALE); - // Add a bottom line to make LineEdits more visible, especially in sectioned inspectors - // such as the Project Settings. - style_line_edit->set_border_width(SIDE_BOTTOM, Math::round(2 * EDSCALE)); - style_line_edit->set_border_color(dark_color_2); + // Don't round the bottom corner to make the line look sharper. style_tab_selected->set_corner_radius(CORNER_BOTTOM_LEFT, 0); style_tab_selected->set_corner_radius(CORNER_BOTTOM_RIGHT, 0); + if (draw_extra_borders) { + style_line_edit->set_border_width_all(Math::round(EDSCALE)); + style_line_edit->set_border_color(extra_border_color_1); + } else { + // Add a bottom line to make LineEdits more visible, especially in sectioned inspectors + // such as the Project Settings. + style_line_edit->set_border_width(SIDE_BOTTOM, Math::round(2 * EDSCALE)); + style_line_edit->set_border_color(dark_color_2); + } + Ref<StyleBoxFlat> style_line_edit_disabled = style_line_edit->duplicate(); style_line_edit_disabled->set_border_color(disabled_color); style_line_edit_disabled->set_bg_color(disabled_bg_color); diff --git a/editor/export/editor_export_platform.cpp b/editor/export/editor_export_platform.cpp index 7c5c7da2ef..4273a31d62 100644 --- a/editor/export/editor_export_platform.cpp +++ b/editor/export/editor_export_platform.cpp @@ -1034,7 +1034,7 @@ Error EditorExportPlatform::export_project_files(const Ref<EditorExportPreset> & return err; } // Now actual remapped file: - sarr = FileAccess::get_file_as_array(export_path); + sarr = FileAccess::get_file_as_bytes(export_path); err = p_func(p_udata, export_path, sarr, idx, total, enc_in_filters, enc_ex_filters, key); if (err != OK) { return err; @@ -1053,7 +1053,7 @@ Error EditorExportPlatform::export_project_files(const Ref<EditorExportPreset> & if (importer_type == "keep") { //just keep file as-is - Vector<uint8_t> array = FileAccess::get_file_as_array(path); + Vector<uint8_t> array = FileAccess::get_file_as_bytes(path); err = p_func(p_udata, path, array, idx, total, enc_in_filters, enc_ex_filters, key); if (err != OK) { @@ -1086,14 +1086,14 @@ Error EditorExportPlatform::export_project_files(const Ref<EditorExportPreset> & String remap = F; if (remap == "path") { String remapped_path = config->get_value("remap", remap); - Vector<uint8_t> array = FileAccess::get_file_as_array(remapped_path); + Vector<uint8_t> array = FileAccess::get_file_as_bytes(remapped_path); err = p_func(p_udata, remapped_path, array, idx, total, enc_in_filters, enc_ex_filters, key); } else if (remap.begins_with("path.")) { String feature = remap.get_slice(".", 1); if (remap_features.has(feature)) { String remapped_path = config->get_value("remap", remap); - Vector<uint8_t> array = FileAccess::get_file_as_array(remapped_path); + Vector<uint8_t> array = FileAccess::get_file_as_bytes(remapped_path); err = p_func(p_udata, remapped_path, array, idx, total, enc_in_filters, enc_ex_filters, key); } } @@ -1104,7 +1104,7 @@ Error EditorExportPlatform::export_project_files(const Ref<EditorExportPreset> & } //also save the .import file - Vector<uint8_t> array = FileAccess::get_file_as_array(path + ".import"); + Vector<uint8_t> array = FileAccess::get_file_as_bytes(path + ".import"); err = p_func(p_udata, path + ".import", array, idx, total, enc_in_filters, enc_ex_filters, key); if (err != OK) { @@ -1164,7 +1164,7 @@ Error EditorExportPlatform::export_project_files(const Ref<EditorExportPreset> & path_remaps.push_back(export_path); } - Vector<uint8_t> array = FileAccess::get_file_as_array(export_path); + Vector<uint8_t> array = FileAccess::get_file_as_bytes(export_path); err = p_func(p_udata, export_path, array, idx, total, enc_in_filters, enc_ex_filters, key); if (err != OK) { return err; @@ -1244,14 +1244,14 @@ Error EditorExportPlatform::export_project_files(const Ref<EditorExportPreset> & String icon = GLOBAL_GET("application/config/icon"); String splash = GLOBAL_GET("application/boot_splash/image"); if (!icon.is_empty() && FileAccess::exists(icon)) { - Vector<uint8_t> array = FileAccess::get_file_as_array(icon); + Vector<uint8_t> array = FileAccess::get_file_as_bytes(icon); err = p_func(p_udata, icon, array, idx, total, enc_in_filters, enc_ex_filters, key); if (err != OK) { return err; } } if (!splash.is_empty() && FileAccess::exists(splash) && icon != splash) { - Vector<uint8_t> array = FileAccess::get_file_as_array(splash); + Vector<uint8_t> array = FileAccess::get_file_as_bytes(splash); err = p_func(p_udata, splash, array, idx, total, enc_in_filters, enc_ex_filters, key); if (err != OK) { return err; @@ -1259,7 +1259,7 @@ Error EditorExportPlatform::export_project_files(const Ref<EditorExportPreset> & } String resource_cache_file = ResourceUID::get_cache_file(); if (FileAccess::exists(resource_cache_file)) { - Vector<uint8_t> array = FileAccess::get_file_as_array(resource_cache_file); + Vector<uint8_t> array = FileAccess::get_file_as_bytes(resource_cache_file); err = p_func(p_udata, resource_cache_file, array, idx, total, enc_in_filters, enc_ex_filters, key); if (err != OK) { return err; @@ -1268,7 +1268,7 @@ Error EditorExportPlatform::export_project_files(const Ref<EditorExportPreset> & String extension_list_config_file = NativeExtension::get_extension_list_config_file(); if (FileAccess::exists(extension_list_config_file)) { - Vector<uint8_t> array = FileAccess::get_file_as_array(extension_list_config_file); + Vector<uint8_t> array = FileAccess::get_file_as_bytes(extension_list_config_file); err = p_func(p_udata, extension_list_config_file, array, idx, total, enc_in_filters, enc_ex_filters, key); if (err != OK) { return err; @@ -1282,7 +1282,7 @@ Error EditorExportPlatform::export_project_files(const Ref<EditorExportPreset> & // Try using user provided data file. String ts_data = "res://" + TS->get_support_data_filename(); if (FileAccess::exists(ts_data)) { - Vector<uint8_t> array = FileAccess::get_file_as_array(ts_data); + Vector<uint8_t> array = FileAccess::get_file_as_bytes(ts_data); err = p_func(p_udata, ts_data, array, idx, total, enc_in_filters, enc_ex_filters, key); if (err != OK) { return err; @@ -1291,7 +1291,7 @@ Error EditorExportPlatform::export_project_files(const Ref<EditorExportPreset> & // Use default text server data. String icu_data_file = EditorPaths::get_singleton()->get_cache_dir().path_join("tmp_icu_data"); TS->save_support_data(icu_data_file); - Vector<uint8_t> array = FileAccess::get_file_as_array(icu_data_file); + Vector<uint8_t> array = FileAccess::get_file_as_bytes(icu_data_file); err = p_func(p_udata, ts_data, array, idx, total, enc_in_filters, enc_ex_filters, key); DirAccess::remove_file_or_error(icu_data_file); if (err != OK) { @@ -1304,7 +1304,7 @@ Error EditorExportPlatform::export_project_files(const Ref<EditorExportPreset> & String config_file = "project.binary"; String engine_cfb = EditorPaths::get_singleton()->get_cache_dir().path_join("tmp" + config_file); ProjectSettings::get_singleton()->save_custom(engine_cfb, custom_map, custom_list); - Vector<uint8_t> data = FileAccess::get_file_as_array(engine_cfb); + Vector<uint8_t> data = FileAccess::get_file_as_bytes(engine_cfb); DirAccess::remove_file_or_error(engine_cfb); return p_func(p_udata, "res://" + config_file, data, idx, total, enc_in_filters, enc_ex_filters, key); diff --git a/editor/export/editor_export_plugin.cpp b/editor/export/editor_export_plugin.cpp index 78d4f93dfe..f0e841f307 100644 --- a/editor/export/editor_export_plugin.cpp +++ b/editor/export/editor_export_plugin.cpp @@ -148,10 +148,8 @@ bool EditorExportPlugin::_begin_customize_resources(const Ref<EditorExportPlatfo Ref<Resource> EditorExportPlugin::_customize_resource(const Ref<Resource> &p_resource, const String &p_path) { Ref<Resource> ret; - if (GDVIRTUAL_REQUIRED_CALL(_customize_resource, p_resource, p_path, ret)) { - return ret; - } - return Ref<Resource>(); + GDVIRTUAL_REQUIRED_CALL(_customize_resource, p_resource, p_path, ret); + return ret; } bool EditorExportPlugin::_begin_customize_scenes(const Ref<EditorExportPlatform> &p_platform, const Vector<String> &p_features) const { @@ -162,18 +160,14 @@ bool EditorExportPlugin::_begin_customize_scenes(const Ref<EditorExportPlatform> Node *EditorExportPlugin::_customize_scene(Node *p_root, const String &p_path) { Node *ret = nullptr; - if (GDVIRTUAL_REQUIRED_CALL(_customize_scene, p_root, p_path, ret)) { - return ret; - } - return nullptr; + GDVIRTUAL_REQUIRED_CALL(_customize_scene, p_root, p_path, ret); + return ret; } uint64_t EditorExportPlugin::_get_customization_configuration_hash() const { uint64_t ret = 0; - if (GDVIRTUAL_REQUIRED_CALL(_get_customization_configuration_hash, ret)) { - return ret; - } - return 0; + GDVIRTUAL_REQUIRED_CALL(_get_customization_configuration_hash, ret); + return ret; } void EditorExportPlugin::_end_customize_scenes() { @@ -186,10 +180,8 @@ void EditorExportPlugin::_end_customize_resources() { String EditorExportPlugin::_get_name() const { String ret; - if (GDVIRTUAL_REQUIRED_CALL(_get_name, ret)) { - return ret; - } - return ""; + GDVIRTUAL_REQUIRED_CALL(_get_name, ret); + return ret; } void EditorExportPlugin::_export_file(const String &p_path, const String &p_type, const HashSet<String> &p_features) { diff --git a/editor/export/export_template_manager.cpp b/editor/export/export_template_manager.cpp index 9ebf4d795a..84766a5bef 100644 --- a/editor/export/export_template_manager.cpp +++ b/editor/export/export_template_manager.cpp @@ -40,6 +40,7 @@ #include "editor/editor_settings.h" #include "editor/progress_dialog.h" #include "scene/gui/file_dialog.h" +#include "scene/gui/menu_button.h" #include "scene/gui/separator.h" #include "scene/gui/tree.h" #include "scene/main/http_request.h" diff --git a/editor/export/project_export.cpp b/editor/export/project_export.cpp index 6ff3539708..f5c5aafb5d 100644 --- a/editor/export/project_export.cpp +++ b/editor/export/project_export.cpp @@ -37,9 +37,16 @@ #include "editor/editor_node.h" #include "editor/editor_properties.h" #include "editor/editor_scale.h" +#include "editor/editor_settings.h" #include "editor/export/editor_export.h" +#include "scene/gui/check_box.h" #include "scene/gui/check_button.h" +#include "scene/gui/item_list.h" #include "scene/gui/link_button.h" +#include "scene/gui/menu_button.h" +#include "scene/gui/option_button.h" +#include "scene/gui/split_container.h" +#include "scene/gui/texture_rect.h" #include "scene/gui/tree.h" void ProjectExportDialog::_theme_changed() { diff --git a/editor/icons/TrackTrigger.svg b/editor/icons/TrackTrigger.svg deleted file mode 100644 index c403fba59a..0000000000 --- a/editor/icons/TrackTrigger.svg +++ /dev/null @@ -1 +0,0 @@ -<svg height="8" viewBox="0 0 16 8" width="16" xmlns="http://www.w3.org/2000/svg"><path d="m1 1v2h2v4h2v-4h2v-2zm13 0a1 1 0 0 0 -1 1 1 1 0 0 0 1 1 1 1 0 0 0 1-1 1 1 0 0 0 -1-1zm-3 2a1 1 0 0 0 -1 1 1 1 0 0 0 1 1 1 1 0 0 0 1-1 1 1 0 0 0 -1-1zm-3 2a1 1 0 0 0 -1 1 1 1 0 0 0 1 1 1 1 0 0 0 1-1 1 1 0 0 0 -1-1z" fill="#f68f45"/></svg> diff --git a/editor/import/dynamic_font_import_settings.cpp b/editor/import/dynamic_font_import_settings.cpp index 0aa77f6ea0..75d0abbb0c 100644 --- a/editor/import/dynamic_font_import_settings.cpp +++ b/editor/import/dynamic_font_import_settings.cpp @@ -469,6 +469,8 @@ void DynamicFontImportSettings::_main_prop_changed(const String &p_edited_proper font_preview->set_msdf_pixel_range(import_settings_data->get("msdf_pixel_range")); } else if (p_edited_property == "msdf_size") { font_preview->set_msdf_size(import_settings_data->get("msdf_size")); + } else if (p_edited_property == "allow_system_fallback") { + font_preview->set_allow_system_fallback(import_settings_data->get("allow_system_fallback")); } else if (p_edited_property == "force_autohinter") { font_preview->set_force_autohinter(import_settings_data->get("force_autohinter")); } else if (p_edited_property == "hinting") { @@ -936,6 +938,7 @@ void DynamicFontImportSettings::_re_import() { main_settings["multichannel_signed_distance_field"] = import_settings_data->get("multichannel_signed_distance_field"); main_settings["msdf_pixel_range"] = import_settings_data->get("msdf_pixel_range"); main_settings["msdf_size"] = import_settings_data->get("msdf_size"); + main_settings["allow_system_fallback"] = import_settings_data->get("allow_system_fallback"); main_settings["force_autohinter"] = import_settings_data->get("force_autohinter"); main_settings["hinting"] = import_settings_data->get("hinting"); main_settings["subpixel_positioning"] = import_settings_data->get("subpixel_positioning"); @@ -1036,7 +1039,7 @@ void DynamicFontImportSettings::_process_locales() { void DynamicFontImportSettings::open_settings(const String &p_path) { // Load base font data. - Vector<uint8_t> font_data = FileAccess::get_file_as_array(p_path); + Vector<uint8_t> font_data = FileAccess::get_file_as_bytes(p_path); // Load project locale list. locale_tree->clear(); @@ -1202,6 +1205,7 @@ void DynamicFontImportSettings::open_settings(const String &p_path) { font_preview->set_multichannel_signed_distance_field(import_settings_data->get("multichannel_signed_distance_field")); font_preview->set_msdf_pixel_range(import_settings_data->get("msdf_pixel_range")); font_preview->set_msdf_size(import_settings_data->get("msdf_size")); + font_preview->set_allow_system_fallback(import_settings_data->get("allow_system_fallback")); font_preview->set_force_autohinter(import_settings_data->get("force_autohinter")); font_preview->set_hinting((TextServer::Hinting)import_settings_data->get("hinting").operator int()); font_preview->set_subpixel_positioning((TextServer::SubpixelPositioning)import_settings_data->get("subpixel_positioning").operator int()); @@ -1232,6 +1236,7 @@ DynamicFontImportSettings::DynamicFontImportSettings() { options_general.push_back(ResourceImporter::ImportOption(PropertyInfo(Variant::BOOL, "multichannel_signed_distance_field", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_UPDATE_ALL_IF_MODIFIED), true)); options_general.push_back(ResourceImporter::ImportOption(PropertyInfo(Variant::INT, "msdf_pixel_range", PROPERTY_HINT_RANGE, "1,100,1"), 8)); options_general.push_back(ResourceImporter::ImportOption(PropertyInfo(Variant::INT, "msdf_size", PROPERTY_HINT_RANGE, "1,250,1"), 48)); + options_general.push_back(ResourceImporter::ImportOption(PropertyInfo(Variant::BOOL, "allow_system_fallback"), true)); options_general.push_back(ResourceImporter::ImportOption(PropertyInfo(Variant::BOOL, "force_autohinter"), false)); options_general.push_back(ResourceImporter::ImportOption(PropertyInfo(Variant::INT, "hinting", PROPERTY_HINT_ENUM, "None,Light,Normal"), 1)); options_general.push_back(ResourceImporter::ImportOption(PropertyInfo(Variant::INT, "subpixel_positioning", PROPERTY_HINT_ENUM, "Disabled,Auto,One Half of a Pixel,One Quarter of a Pixel"), 1)); diff --git a/editor/import/editor_import_collada.cpp b/editor/import/editor_import_collada.cpp index 6890a46193..c335655d4e 100644 --- a/editor/import/editor_import_collada.cpp +++ b/editor/import/editor_import_collada.cpp @@ -65,7 +65,7 @@ struct ColladaImport { bool force_make_tangents = false; bool apply_mesh_xform_to_vertices = true; bool use_mesh_builtin_materials = false; - float bake_fps = 15; + float bake_fps = 30; HashMap<String, NodeMap> node_map; //map from collada node to engine node HashMap<String, String> node_name_map; //map from collada node to engine node @@ -1760,7 +1760,7 @@ void EditorSceneFormatImporterCollada::get_extensions(List<String> *r_extensions r_extensions->push_back("dae"); } -Node *EditorSceneFormatImporterCollada::import_scene(const String &p_path, uint32_t p_flags, const HashMap<StringName, Variant> &p_options, int p_bake_fps, List<String> *r_missing_deps, Error *r_err) { +Node *EditorSceneFormatImporterCollada::import_scene(const String &p_path, uint32_t p_flags, const HashMap<StringName, Variant> &p_options, List<String> *r_missing_deps, Error *r_err) { if (r_err) { *r_err = OK; } @@ -1771,7 +1771,7 @@ Node *EditorSceneFormatImporterCollada::import_scene(const String &p_path, uint3 } state.use_mesh_builtin_materials = true; - state.bake_fps = p_bake_fps; + state.bake_fps = (float)p_options["animation/fps"]; Error err = state.load(p_path, flags, p_flags & EditorSceneFormatImporter::IMPORT_GENERATE_TANGENT_ARRAYS, false); diff --git a/editor/import/editor_import_collada.h b/editor/import/editor_import_collada.h index a75b0a903f..ec30c91c1b 100644 --- a/editor/import/editor_import_collada.h +++ b/editor/import/editor_import_collada.h @@ -39,7 +39,7 @@ class EditorSceneFormatImporterCollada : public EditorSceneFormatImporter { public: virtual uint32_t get_import_flags() const override; virtual void get_extensions(List<String> *r_extensions) const override; - virtual Node *import_scene(const String &p_path, uint32_t p_flags, const HashMap<StringName, Variant> &p_options, int p_bake_fps, List<String> *r_missing_deps = nullptr, Error *r_err = nullptr) override; + virtual Node *import_scene(const String &p_path, uint32_t p_flags, const HashMap<StringName, Variant> &p_options, List<String> *r_missing_deps = nullptr, Error *r_err = nullptr) override; EditorSceneFormatImporterCollada(); }; diff --git a/editor/import/resource_importer_bmfont.cpp b/editor/import/resource_importer_bmfont.cpp index 4fb1b726bd..357faf0022 100644 --- a/editor/import/resource_importer_bmfont.cpp +++ b/editor/import/resource_importer_bmfont.cpp @@ -76,6 +76,7 @@ Error ResourceImporterBMFont::import(const String &p_source_file, const String & Error err = font->load_bitmap_font(p_source_file); ERR_FAIL_COND_V_MSG(err != OK, err, "Cannot load font to file \"" + p_source_file + "\"."); + font->set_allow_system_fallback(false); font->set_fallbacks(fallbacks); int flg = 0; diff --git a/editor/import/resource_importer_dynamic_font.cpp b/editor/import/resource_importer_dynamic_font.cpp index 44440a92bd..2f1445af48 100644 --- a/editor/import/resource_importer_dynamic_font.cpp +++ b/editor/import/resource_importer_dynamic_font.cpp @@ -114,6 +114,7 @@ void ResourceImporterDynamicFont::get_import_options(const String &p_path, List< r_options->push_back(ImportOption(PropertyInfo(Variant::INT, "msdf_pixel_range", PROPERTY_HINT_RANGE, "1,100,1"), 8)); r_options->push_back(ImportOption(PropertyInfo(Variant::INT, "msdf_size", PROPERTY_HINT_RANGE, "1,250,1"), 48)); + r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "allow_system_fallback"), true)); r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "force_autohinter"), false)); r_options->push_back(ImportOption(PropertyInfo(Variant::INT, "hinting", PROPERTY_HINT_ENUM, "None,Light,Normal"), 1)); r_options->push_back(ImportOption(PropertyInfo(Variant::INT, "subpixel_positioning", PROPERTY_HINT_ENUM, "Disabled,Auto,One Half of a Pixel,One Quarter of a Pixel"), 1)); @@ -150,13 +151,14 @@ Error ResourceImporterDynamicFont::import(const String &p_source_file, const Str Dictionary ot_ov = p_options["opentype_features"]; bool autohinter = p_options["force_autohinter"]; + bool allow_system_fallback = p_options["allow_system_fallback"]; int hinting = p_options["hinting"]; int subpixel_positioning = p_options["subpixel_positioning"]; real_t oversampling = p_options["oversampling"]; Array fallbacks = p_options["fallbacks"]; // Load base font data. - Vector<uint8_t> data = FileAccess::get_file_as_array(p_source_file); + Vector<uint8_t> data = FileAccess::get_file_as_bytes(p_source_file); // Create font. Ref<FontFile> font; @@ -170,6 +172,7 @@ Error ResourceImporterDynamicFont::import(const String &p_source_file, const Str font->set_opentype_feature_overrides(ot_ov); font->set_fixed_size(0); font->set_force_autohinter(autohinter); + font->set_allow_system_fallback(allow_system_fallback); font->set_subpixel_positioning((TextServer::SubpixelPositioning)subpixel_positioning); font->set_hinting((TextServer::Hinting)hinting); font->set_oversampling(oversampling); diff --git a/editor/import/resource_importer_imagefont.cpp b/editor/import/resource_importer_imagefont.cpp index eb4916663e..9c3304d946 100644 --- a/editor/import/resource_importer_imagefont.cpp +++ b/editor/import/resource_importer_imagefont.cpp @@ -121,6 +121,7 @@ Error ResourceImporterImageFont::import(const String &p_source_file, const Strin font->set_fixed_size(chr_height); font->set_subpixel_positioning(TextServer::SUBPIXEL_POSITIONING_DISABLED); font->set_force_autohinter(false); + font->set_allow_system_fallback(false); font->set_hinting(TextServer::HINTING_NONE); font->set_oversampling(1.0f); font->set_fallbacks(fallbacks); diff --git a/editor/import/resource_importer_obj.cpp b/editor/import/resource_importer_obj.cpp index fe70fd58b5..f19b4dbe56 100644 --- a/editor/import/resource_importer_obj.cpp +++ b/editor/import/resource_importer_obj.cpp @@ -422,7 +422,7 @@ static Error _parse_obj(const String &p_path, List<Ref<Mesh>> &r_meshes, bool p_ return OK; } -Node *EditorOBJImporter::import_scene(const String &p_path, uint32_t p_flags, const HashMap<StringName, Variant> &p_options, int p_bake_fps, List<String> *r_missing_deps, Error *r_err) { +Node *EditorOBJImporter::import_scene(const String &p_path, uint32_t p_flags, const HashMap<StringName, Variant> &p_options, List<String> *r_missing_deps, Error *r_err) { List<Ref<Mesh>> meshes; Error err = _parse_obj(p_path, meshes, false, p_flags & IMPORT_GENERATE_TANGENT_ARRAYS, false, Vector3(1, 1, 1), Vector3(0, 0, 0), r_missing_deps); diff --git a/editor/import/resource_importer_obj.h b/editor/import/resource_importer_obj.h index 4dfac90fa1..121d8e6d36 100644 --- a/editor/import/resource_importer_obj.h +++ b/editor/import/resource_importer_obj.h @@ -39,7 +39,7 @@ class EditorOBJImporter : public EditorSceneFormatImporter { public: virtual uint32_t get_import_flags() const override; virtual void get_extensions(List<String> *r_extensions) const override; - virtual Node *import_scene(const String &p_path, uint32_t p_flags, const HashMap<StringName, Variant> &p_options, int p_bake_fps, List<String> *r_missing_deps, Error *r_err = nullptr) override; + virtual Node *import_scene(const String &p_path, uint32_t p_flags, const HashMap<StringName, Variant> &p_options, List<String> *r_missing_deps, Error *r_err = nullptr) override; EditorOBJImporter(); }; diff --git a/editor/import/resource_importer_scene.cpp b/editor/import/resource_importer_scene.cpp index f7a3ce2679..9566c1b23c 100644 --- a/editor/import/resource_importer_scene.cpp +++ b/editor/import/resource_importer_scene.cpp @@ -74,13 +74,13 @@ void EditorSceneFormatImporter::get_extensions(List<String> *r_extensions) const ERR_FAIL(); } -Node *EditorSceneFormatImporter::import_scene(const String &p_path, uint32_t p_flags, const HashMap<StringName, Variant> &p_options, int p_bake_fps, List<String> *r_missing_deps, Error *r_err) { +Node *EditorSceneFormatImporter::import_scene(const String &p_path, uint32_t p_flags, const HashMap<StringName, Variant> &p_options, List<String> *r_missing_deps, Error *r_err) { Dictionary options_dict; for (const KeyValue<StringName, Variant> &elem : p_options) { options_dict[elem.key] = elem.value; } Object *ret = nullptr; - if (GDVIRTUAL_CALL(_import_scene, p_path, p_flags, options_dict, p_bake_fps, ret)) { + if (GDVIRTUAL_CALL(_import_scene, p_path, p_flags, options_dict, ret)) { return Object::cast_to<Node>(ret); } @@ -100,7 +100,7 @@ Variant EditorSceneFormatImporter::get_option_visibility(const String &p_path, b void EditorSceneFormatImporter::_bind_methods() { GDVIRTUAL_BIND(_get_import_flags); GDVIRTUAL_BIND(_get_extensions); - GDVIRTUAL_BIND(_import_scene, "path", "flags", "options", "bake_fps"); + GDVIRTUAL_BIND(_import_scene, "path", "flags", "options"); GDVIRTUAL_BIND(_get_import_options, "path"); GDVIRTUAL_BIND(_get_option_visibility, "path", "for_animation", "option"); @@ -355,7 +355,7 @@ static void _pre_gen_shape_list(Ref<ImporterMesh> &mesh, Vector<Ref<Shape3D>> &r ERR_FAIL_NULL_MSG(mesh, "Cannot generate shape list with null mesh value"); ERR_FAIL_NULL_MSG(mesh->get_mesh(), "Cannot generate shape list with null mesh value"); if (!p_convex) { - Ref<Shape3D> shape = mesh->create_trimesh_shape(); + Ref<ConcavePolygonShape3D> shape = mesh->create_trimesh_shape(); r_shape_list.push_back(shape); } else { Vector<Ref<Shape3D>> cd; @@ -1864,6 +1864,7 @@ void ResourceImporterScene::get_import_options(const String &p_path, List<Import r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "skins/use_named_skins"), true)); r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "animation/import"), true)); r_options->push_back(ImportOption(PropertyInfo(Variant::FLOAT, "animation/fps", PROPERTY_HINT_RANGE, "1,120,1"), 30)); + r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "animation/trimming"), false)); r_options->push_back(ImportOption(PropertyInfo(Variant::STRING, "import_script/path", PROPERTY_HINT_FILE, script_ext_hint), "")); r_options->push_back(ImportOption(PropertyInfo(Variant::DICTIONARY, "_subresources", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NO_EDITOR), Dictionary())); @@ -2281,13 +2282,8 @@ Node *ResourceImporterScene::pre_import(const String &p_source_file, const HashM ERR_FAIL_COND_V(!importer.is_valid(), nullptr); - int bake_fps = 30; - if (p_options.has(SNAME("animation/fps"))) { - bake_fps = p_options[SNAME("animation/fps")]; - } - Error err = OK; - Node *scene = importer->import_scene(p_source_file, EditorSceneFormatImporter::IMPORT_ANIMATION | EditorSceneFormatImporter::IMPORT_GENERATE_TANGENT_ARRAYS, p_options, bake_fps, nullptr, &err); + Node *scene = importer->import_scene(p_source_file, EditorSceneFormatImporter::IMPORT_ANIMATION | EditorSceneFormatImporter::IMPORT_GENERATE_TANGENT_ARRAYS, p_options, nullptr, &err); if (!scene || err != OK) { return nullptr; } @@ -2326,8 +2322,6 @@ Error ResourceImporterScene::import(const String &p_source_file, const String &p ERR_FAIL_COND_V(!importer.is_valid(), ERR_FILE_UNRECOGNIZED); - float fps = p_options["animation/fps"]; - int import_flags = 0; if (animation_importer) { @@ -2350,7 +2344,7 @@ Error ResourceImporterScene::import(const String &p_source_file, const String &p Error err = OK; List<String> missing_deps; // for now, not much will be done with this - Node *scene = importer->import_scene(src_path, import_flags, p_options, fps, &missing_deps, &err); + Node *scene = importer->import_scene(src_path, import_flags, p_options, &missing_deps, &err); if (!scene || err != OK) { return err; } @@ -2398,6 +2392,10 @@ Error ResourceImporterScene::import(const String &p_source_file, const String &p post_importer_plugins.write[i]->pre_process(scene, p_options); } + float fps = 30; + if (p_options.has(SNAME("animation/fps"))) { + fps = (float)p_options[SNAME("animation/fps")]; + } _pre_fix_animations(scene, scene, node_data, animation_data, fps); _post_fix_node(scene, scene, collision_map, occluder_arrays, scanned_meshes, node_data, material_data, animation_data, fps); _post_fix_animations(scene, scene, node_data, animation_data, fps); @@ -2450,7 +2448,7 @@ Error ResourceImporterScene::import(const String &p_source_file, const String &p Vector<Vector<uint8_t>> mesh_lightmap_caches; { - src_lightmap_cache = FileAccess::get_file_as_array(p_source_file + ".unwrap_cache", &err); + src_lightmap_cache = FileAccess::get_file_as_bytes(p_source_file + ".unwrap_cache", &err); if (err != OK) { src_lightmap_cache.clear(); } @@ -2612,7 +2610,7 @@ void EditorSceneFormatImporterESCN::get_extensions(List<String> *r_extensions) c r_extensions->push_back("escn"); } -Node *EditorSceneFormatImporterESCN::import_scene(const String &p_path, uint32_t p_flags, const HashMap<StringName, Variant> &p_options, int p_bake_fps, List<String> *r_missing_deps, Error *r_err) { +Node *EditorSceneFormatImporterESCN::import_scene(const String &p_path, uint32_t p_flags, const HashMap<StringName, Variant> &p_options, List<String> *r_missing_deps, Error *r_err) { Error error; Ref<PackedScene> ps = ResourceFormatLoaderText::singleton->load(p_path, p_path, &error); ERR_FAIL_COND_V_MSG(!ps.is_valid(), nullptr, "Cannot load scene as text resource from path '" + p_path + "'."); diff --git a/editor/import/resource_importer_scene.h b/editor/import/resource_importer_scene.h index 5f64330453..678251372b 100644 --- a/editor/import/resource_importer_scene.h +++ b/editor/import/resource_importer_scene.h @@ -53,12 +53,12 @@ class EditorSceneFormatImporter : public RefCounted { protected: static void _bind_methods(); - Node *import_scene_wrapper(const String &p_path, uint32_t p_flags, Dictionary p_options, int p_bake_fps); - Ref<Animation> import_animation_wrapper(const String &p_path, uint32_t p_flags, Dictionary p_options, int p_bake_fps); + Node *import_scene_wrapper(const String &p_path, uint32_t p_flags, Dictionary p_options); + Ref<Animation> import_animation_wrapper(const String &p_path, uint32_t p_flags, Dictionary p_options); GDVIRTUAL0RC(int, _get_import_flags) GDVIRTUAL0RC(Vector<String>, _get_extensions) - GDVIRTUAL4R(Object *, _import_scene, String, uint32_t, Dictionary, uint32_t) + GDVIRTUAL3R(Object *, _import_scene, String, uint32_t, Dictionary) GDVIRTUAL1(_get_import_options, String) GDVIRTUAL3RC(Variant, _get_option_visibility, String, bool, String) @@ -74,7 +74,7 @@ public: virtual uint32_t get_import_flags() const; virtual void get_extensions(List<String> *r_extensions) const; - virtual Node *import_scene(const String &p_path, uint32_t p_flags, const HashMap<StringName, Variant> &p_options, int p_bake_fps, List<String> *r_missing_deps, Error *r_err = nullptr); + virtual Node *import_scene(const String &p_path, uint32_t p_flags, const HashMap<StringName, Variant> &p_options, List<String> *r_missing_deps, Error *r_err = nullptr); virtual void get_import_options(const String &p_path, List<ResourceImporter::ImportOption> *r_options); virtual Variant get_option_visibility(const String &p_path, bool p_for_animation, const String &p_option, const HashMap<StringName, Variant> &p_options); @@ -310,7 +310,7 @@ class EditorSceneFormatImporterESCN : public EditorSceneFormatImporter { public: virtual uint32_t get_import_flags() const override; virtual void get_extensions(List<String> *r_extensions) const override; - virtual Node *import_scene(const String &p_path, uint32_t p_flags, const HashMap<StringName, Variant> &p_options, int p_bake_fps, List<String> *r_missing_deps, Error *r_err = nullptr) override; + virtual Node *import_scene(const String &p_path, uint32_t p_flags, const HashMap<StringName, Variant> &p_options, List<String> *r_missing_deps, Error *r_err = nullptr) override; }; template <class M> diff --git a/editor/plugins/animation_blend_space_1d_editor.cpp b/editor/plugins/animation_blend_space_1d_editor.cpp index 03c801c42b..e64b80abbd 100644 --- a/editor/plugins/animation_blend_space_1d_editor.cpp +++ b/editor/plugins/animation_blend_space_1d_editor.cpp @@ -37,6 +37,8 @@ #include "editor/editor_settings.h" #include "editor/editor_undo_redo_manager.h" #include "scene/animation/animation_blend_tree.h" +#include "scene/gui/check_box.h" +#include "scene/gui/panel_container.h" StringName AnimationNodeBlendSpace1DEditor::get_blend_position_path() const { StringName path = AnimationTreeEditor::get_singleton()->get_base_path() + "blend_position"; diff --git a/editor/plugins/animation_blend_space_2d_editor.cpp b/editor/plugins/animation_blend_space_2d_editor.cpp index f27fd0cded..4d8e972883 100644 --- a/editor/plugins/animation_blend_space_2d_editor.cpp +++ b/editor/plugins/animation_blend_space_2d_editor.cpp @@ -42,9 +42,12 @@ #include "editor/editor_undo_redo_manager.h" #include "scene/animation/animation_blend_tree.h" #include "scene/animation/animation_player.h" +#include "scene/gui/check_box.h" #include "scene/gui/grid_container.h" #include "scene/gui/menu_button.h" +#include "scene/gui/option_button.h" #include "scene/gui/panel.h" +#include "scene/gui/panel_container.h" #include "scene/main/window.h" bool AnimationNodeBlendSpace2DEditor::can_edit(const Ref<AnimationNode> &p_node) { diff --git a/editor/plugins/animation_blend_tree_editor_plugin.cpp b/editor/plugins/animation_blend_tree_editor_plugin.cpp index 9da6e15e75..0f67663948 100644 --- a/editor/plugins/animation_blend_tree_editor_plugin.cpp +++ b/editor/plugins/animation_blend_tree_editor_plugin.cpp @@ -41,9 +41,11 @@ #include "editor/editor_settings.h" #include "editor/editor_undo_redo_manager.h" #include "scene/animation/animation_player.h" +#include "scene/gui/check_box.h" #include "scene/gui/menu_button.h" #include "scene/gui/panel.h" #include "scene/gui/progress_bar.h" +#include "scene/gui/separator.h" #include "scene/gui/view_panner.h" #include "scene/main/window.h" diff --git a/editor/plugins/animation_library_editor.cpp b/editor/plugins/animation_library_editor.cpp index e377366c0d..10b5271fc8 100644 --- a/editor/plugins/animation_library_editor.cpp +++ b/editor/plugins/animation_library_editor.cpp @@ -32,6 +32,7 @@ #include "editor/editor_file_dialog.h" #include "editor/editor_node.h" #include "editor/editor_scale.h" +#include "editor/editor_settings.h" #include "editor/editor_undo_redo_manager.h" void AnimationLibraryEditor::set_animation_player(Object *p_player) { diff --git a/editor/plugins/animation_player_editor_plugin.cpp b/editor/plugins/animation_player_editor_plugin.cpp index 85739d0d8f..5183a738ae 100644 --- a/editor/plugins/animation_player_editor_plugin.cpp +++ b/editor/plugins/animation_player_editor_plugin.cpp @@ -40,9 +40,11 @@ #include "editor/editor_scale.h" #include "editor/editor_settings.h" #include "editor/editor_undo_redo_manager.h" +#include "editor/inspector_dock.h" #include "editor/plugins/canvas_item_editor_plugin.h" // For onion skinning. #include "editor/plugins/node_3d_editor_plugin.h" // For onion skinning. #include "editor/scene_tree_dock.h" +#include "scene/gui/separator.h" #include "scene/main/window.h" #include "scene/resources/animation.h" #include "scene/scene_string_names.h" @@ -197,6 +199,7 @@ void AnimationPlayerEditor::_play_pressed() { if (current == player->get_assigned_animation()) { player->stop(); //so it won't blend with itself } + ERR_FAIL_COND_EDMSG(!_validate_tracks(player->get_animation(current)), "Animation tracks may have any invalid key, abort playing."); player->play(current); } @@ -209,13 +212,12 @@ void AnimationPlayerEditor::_play_from_pressed() { if (!current.is_empty()) { float time = player->get_current_animation_position(); - if (current == player->get_assigned_animation() && player->is_playing()) { player->stop(); //so it won't blend with itself } - - player->play(current); + ERR_FAIL_COND_EDMSG(!_validate_tracks(player->get_animation(current)), "Animation tracks may have any invalid key, abort playing."); player->seek(time); + player->play(current); } //unstop @@ -235,6 +237,7 @@ void AnimationPlayerEditor::_play_bw_pressed() { if (current == player->get_assigned_animation()) { player->stop(); //so it won't blend with itself } + ERR_FAIL_COND_EDMSG(!_validate_tracks(player->get_animation(current)), "Animation tracks may have any invalid key, abort playing."); player->play(current, -1, -1, true); } @@ -250,9 +253,9 @@ void AnimationPlayerEditor::_play_bw_from_pressed() { if (current == player->get_assigned_animation()) { player->stop(); //so it won't blend with itself } - - player->play(current, -1, -1, true); + ERR_FAIL_COND_EDMSG(!_validate_tracks(player->get_animation(current)), "Animation tracks may have any invalid key, abort playing."); player->seek(time); + player->play(current, -1, -1, true); } //unstop @@ -1562,6 +1565,53 @@ void AnimationPlayerEditor::_pin_pressed() { SceneTreeDock::get_singleton()->get_tree_editor()->update_tree(); } +bool AnimationPlayerEditor::_validate_tracks(const Ref<Animation> p_anim) { + bool is_valid = true; + if (!p_anim.is_valid()) { + return true; // There is a problem outside of the animation track. + } + int len = p_anim->get_track_count(); + for (int i = 0; i < len; i++) { + Animation::TrackType ttype = p_anim->track_get_type(i); + if (ttype == Animation::TYPE_ROTATION_3D) { + int key_len = p_anim->track_get_key_count(i); + for (int j = 0; j < key_len; j++) { + Quaternion q; + p_anim->rotation_track_get_key(i, j, &q); + ERR_BREAK_EDMSG(!q.is_normalized(), "AnimationPlayer: '" + player->get_name() + "', Animation: '" + player->get_current_animation() + "', rotation track: '" + p_anim->track_get_path(i) + "' contains unnormalized Quaternion key."); + } + } else if (ttype == Animation::TYPE_VALUE) { + int key_len = p_anim->track_get_key_count(i); + if (key_len == 0) { + continue; + } + switch (p_anim->track_get_key_value(i, 0).get_type()) { + case Variant::QUATERNION: { + for (int j = 0; j < key_len; j++) { + Quaternion q = Quaternion(p_anim->track_get_key_value(i, j)); + if (!q.is_normalized()) { + is_valid = false; + ERR_BREAK_EDMSG(true, "AnimationPlayer: '" + player->get_name() + "', Animation: '" + player->get_current_animation() + "', value track: '" + p_anim->track_get_path(i) + "' contains unnormalized Quaternion key."); + } + } + } break; + case Variant::TRANSFORM3D: { + for (int j = 0; j < key_len; j++) { + Transform3D t = Transform3D(p_anim->track_get_key_value(i, j)); + if (!t.basis.orthonormalized().is_rotation()) { + is_valid = false; + ERR_BREAK_EDMSG(true, "AnimationPlayer: '" + player->get_name() + "', Animation: '" + player->get_current_animation() + "', value track: '" + p_anim->track_get_path(i) + "' contains corrupted basis (some axes are too close other axis or scaled by zero) Transform3D key."); + } + } + } break; + default: { + } break; + } + } + } + return is_valid; +} + void AnimationPlayerEditor::_bind_methods() { ClassDB::bind_method(D_METHOD("_animation_new"), &AnimationPlayerEditor::_animation_new); ClassDB::bind_method(D_METHOD("_animation_rename"), &AnimationPlayerEditor::_animation_rename); diff --git a/editor/plugins/animation_player_editor_plugin.h b/editor/plugins/animation_player_editor_plugin.h index 6370b00ea8..53d460fc9e 100644 --- a/editor/plugins/animation_player_editor_plugin.h +++ b/editor/plugins/animation_player_editor_plugin.h @@ -212,6 +212,8 @@ class AnimationPlayerEditor : public VBoxContainer { void _start_onion_skinning(); void _stop_onion_skinning(); + bool _validate_tracks(const Ref<Animation> p_anim); + void _pin_pressed(); String _get_current() const; diff --git a/editor/plugins/animation_state_machine_editor.cpp b/editor/plugins/animation_state_machine_editor.cpp index bd34d3808d..ef9477abea 100644 --- a/editor/plugins/animation_state_machine_editor.cpp +++ b/editor/plugins/animation_state_machine_editor.cpp @@ -43,7 +43,10 @@ #include "scene/animation/animation_blend_tree.h" #include "scene/animation/animation_player.h" #include "scene/gui/menu_button.h" +#include "scene/gui/option_button.h" #include "scene/gui/panel.h" +#include "scene/gui/panel_container.h" +#include "scene/gui/separator.h" #include "scene/gui/tree.h" #include "scene/main/viewport.h" #include "scene/main/window.h" diff --git a/editor/plugins/asset_library_editor_plugin.cpp b/editor/plugins/asset_library_editor_plugin.cpp index 72bee901bf..7c3ecd5d4e 100644 --- a/editor/plugins/asset_library_editor_plugin.cpp +++ b/editor/plugins/asset_library_editor_plugin.cpp @@ -41,6 +41,7 @@ #include "editor/editor_scale.h" #include "editor/editor_settings.h" #include "editor/project_settings_editor.h" +#include "scene/gui/menu_button.h" static inline void setup_http_request(HTTPRequest *request) { request->set_use_threads(EDITOR_DEF("asset_library/use_threads", true)); diff --git a/editor/plugins/bit_map_editor_plugin.cpp b/editor/plugins/bit_map_editor_plugin.cpp index 657c5a36b6..8d9b3147a9 100644 --- a/editor/plugins/bit_map_editor_plugin.cpp +++ b/editor/plugins/bit_map_editor_plugin.cpp @@ -31,6 +31,8 @@ #include "bit_map_editor_plugin.h" #include "editor/editor_scale.h" +#include "scene/gui/label.h" +#include "scene/gui/texture_rect.h" void BitMapEditor::setup(const Ref<BitMap> &p_bitmap) { texture_rect->set_texture(ImageTexture::create_from_image(p_bitmap->convert_to_image())); diff --git a/editor/plugins/bone_map_editor_plugin.cpp b/editor/plugins/bone_map_editor_plugin.cpp index 9ceedb18b3..4bf11f0627 100644 --- a/editor/plugins/bone_map_editor_plugin.cpp +++ b/editor/plugins/bone_map_editor_plugin.cpp @@ -31,10 +31,14 @@ #include "bone_map_editor_plugin.h" #include "editor/editor_scale.h" +#include "editor/editor_settings.h" #include "editor/import/post_import_plugin_skeleton_renamer.h" #include "editor/import/post_import_plugin_skeleton_rest_fixer.h" #include "editor/import/post_import_plugin_skeleton_track_organizer.h" #include "editor/import/scene_import_settings.h" +#include "scene/gui/aspect_ratio_container.h" +#include "scene/gui/separator.h" +#include "scene/gui/texture_rect.h" void BoneMapperButton::fetch_textures() { if (selected) { diff --git a/editor/plugins/bone_map_editor_plugin.h b/editor/plugins/bone_map_editor_plugin.h index 16e5403978..e6a35d1120 100644 --- a/editor/plugins/bone_map_editor_plugin.h +++ b/editor/plugins/bone_map_editor_plugin.h @@ -41,11 +41,14 @@ #endif #include "scene/3d/skeleton_3d.h" +#include "scene/gui/box_container.h" #include "scene/gui/color_rect.h" #include "scene/gui/dialogs.h" #include "scene/resources/bone_map.h" #include "scene/resources/texture.h" +class AspectRatioContainer; + class BoneMapperButton : public TextureButton { GDCLASS(BoneMapperButton, TextureButton); diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp index 0fe77ec400..c08c9a83a7 100644 --- a/editor/plugins/canvas_item_editor_plugin.cpp +++ b/editor/plugins/canvas_item_editor_plugin.cpp @@ -32,15 +32,14 @@ #include "core/config/project_settings.h" #include "core/input/input.h" -#include "core/math/geometry_2d.h" #include "core/os/keyboard.h" -#include "core/string/print_string.h" #include "editor/debugger/editor_debugger_node.h" #include "editor/editor_node.h" #include "editor/editor_scale.h" #include "editor/editor_settings.h" #include "editor/editor_toaster.h" #include "editor/editor_undo_redo_manager.h" +#include "editor/editor_zoom_widget.h" #include "editor/plugins/animation_player_editor_plugin.h" #include "editor/plugins/script_editor_plugin.h" #include "editor/scene_tree_dock.h" @@ -55,6 +54,7 @@ #include "scene/gui/grid_container.h" #include "scene/gui/nine_patch_rect.h" #include "scene/gui/separator.h" +#include "scene/gui/split_container.h" #include "scene/gui/subviewport_container.h" #include "scene/gui/view_panner.h" #include "scene/main/canvas_layer.h" @@ -5596,7 +5596,7 @@ void CanvasItemEditorViewport::_create_nodes(Node *parent, Node *child, String & // make visible for certain node type if (Object::cast_to<Control>(child)) { Size2 texture_size = texture->get_size(); - undo_redo->add_do_property(child, "rect_size", texture_size); + undo_redo->add_do_property(child, "size", texture_size); } else if (Object::cast_to<Polygon2D>(child)) { Size2 texture_size = texture->get_size(); Vector<Vector2> list = { @@ -5612,6 +5612,11 @@ void CanvasItemEditorViewport::_create_nodes(Node *parent, Node *child, String & Transform2D xform = canvas_item_editor->get_canvas_transform(); Point2 target_position = xform.affine_inverse().xform(p_point); + // Adjust position for Control and TouchScreenButton + if (Object::cast_to<Control>(child) || Object::cast_to<TouchScreenButton>(child)) { + target_position -= texture->get_size() / 2; + } + // there's nothing to be used as source position so snapping will work as absolute if enabled target_position = canvas_item_editor->snap_point(target_position); undo_redo->add_do_method(child, "set_global_position", target_position); diff --git a/editor/plugins/canvas_item_editor_plugin.h b/editor/plugins/canvas_item_editor_plugin.h index cc98aa8c51..9c7d0fbe6f 100644 --- a/editor/plugins/canvas_item_editor_plugin.h +++ b/editor/plugins/canvas_item_editor_plugin.h @@ -32,22 +32,21 @@ #define CANVAS_ITEM_EDITOR_PLUGIN_H #include "editor/editor_plugin.h" -#include "editor/editor_zoom_widget.h" +#include "scene/gui/base_button.h" #include "scene/gui/box_container.h" -#include "scene/gui/check_box.h" -#include "scene/gui/label.h" -#include "scene/gui/panel_container.h" -#include "scene/gui/spin_box.h" -#include "scene/gui/split_container.h" -#include "scene/gui/texture_rect.h" -#include "scene/main/canvas_item.h" class AcceptDialog; +class CanvasItemEditorViewport; class ConfirmationDialog; class EditorData; -class CanvasItemEditorViewport; +class EditorZoomWidget; +class HScrollBar; +class HSplitContainer; class MenuButton; +class PanelContainer; class ViewPanner; +class VScrollBar; +class VSplitContainer; class CanvasItemEditorSelectedItem : public Object { GDCLASS(CanvasItemEditorSelectedItem, Object); diff --git a/editor/plugins/cpu_particles_2d_editor_plugin.cpp b/editor/plugins/cpu_particles_2d_editor_plugin.cpp index 891a22cc71..36b51e0e0c 100644 --- a/editor/plugins/cpu_particles_2d_editor_plugin.cpp +++ b/editor/plugins/cpu_particles_2d_editor_plugin.cpp @@ -35,7 +35,11 @@ #include "editor/editor_file_dialog.h" #include "editor/editor_node.h" #include "scene/2d/cpu_particles_2d.h" +#include "scene/gui/check_box.h" +#include "scene/gui/menu_button.h" +#include "scene/gui/option_button.h" #include "scene/gui/separator.h" +#include "scene/gui/spin_box.h" #include "scene/resources/particle_process_material.h" void CPUParticles2DEditorPlugin::edit(Object *p_object) { diff --git a/editor/plugins/font_config_plugin.cpp b/editor/plugins/font_config_plugin.cpp index 33992314b0..4370d013be 100644 --- a/editor/plugins/font_config_plugin.cpp +++ b/editor/plugins/font_config_plugin.cpp @@ -31,6 +31,7 @@ #include "font_config_plugin.h" #include "editor/editor_scale.h" +#include "editor/editor_settings.h" #include "editor/import/dynamic_font_import_settings.h" /*************************************************************************/ diff --git a/editor/plugins/gpu_particles_2d_editor_plugin.cpp b/editor/plugins/gpu_particles_2d_editor_plugin.cpp index 87381b3221..0fa3efba9a 100644 --- a/editor/plugins/gpu_particles_2d_editor_plugin.cpp +++ b/editor/plugins/gpu_particles_2d_editor_plugin.cpp @@ -37,6 +37,7 @@ #include "editor/editor_undo_redo_manager.h" #include "editor/scene_tree_dock.h" #include "scene/2d/cpu_particles_2d.h" +#include "scene/gui/menu_button.h" #include "scene/gui/separator.h" #include "scene/resources/particle_process_material.h" diff --git a/editor/plugins/gpu_particles_3d_editor_plugin.cpp b/editor/plugins/gpu_particles_3d_editor_plugin.cpp index db3a46d1f1..b2878244d0 100644 --- a/editor/plugins/gpu_particles_3d_editor_plugin.cpp +++ b/editor/plugins/gpu_particles_3d_editor_plugin.cpp @@ -36,6 +36,8 @@ #include "editor/plugins/node_3d_editor_plugin.h" #include "editor/scene_tree_dock.h" #include "scene/3d/cpu_particles_3d.h" +#include "scene/3d/mesh_instance_3d.h" +#include "scene/gui/menu_button.h" #include "scene/resources/particle_process_material.h" bool GPUParticles3DEditorBase::_generate(Vector<Vector3> &points, Vector<Vector3> &normals) { diff --git a/editor/plugins/material_editor_plugin.h b/editor/plugins/material_editor_plugin.h index 076fd5e537..7d7d41785b 100644 --- a/editor/plugins/material_editor_plugin.h +++ b/editor/plugins/material_editor_plugin.h @@ -41,7 +41,9 @@ #include "scene/resources/material.h" #include "scene/resources/primitive_meshes.h" +class SubViewport; class SubViewportContainer; +class TextureButton; class MaterialEditor : public Control { GDCLASS(MaterialEditor, Control); diff --git a/editor/plugins/mesh_editor_plugin.cpp b/editor/plugins/mesh_editor_plugin.cpp index 57dc92a9ee..79fbf19f89 100644 --- a/editor/plugins/mesh_editor_plugin.cpp +++ b/editor/plugins/mesh_editor_plugin.cpp @@ -32,6 +32,8 @@ #include "core/config/project_settings.h" #include "editor/editor_scale.h" +#include "scene/gui/texture_button.h" +#include "scene/main/viewport.h" void MeshEditor::gui_input(const Ref<InputEvent> &p_event) { ERR_FAIL_COND(p_event.is_null()); diff --git a/editor/plugins/mesh_editor_plugin.h b/editor/plugins/mesh_editor_plugin.h index b8d6562c5c..8eecc909b6 100644 --- a/editor/plugins/mesh_editor_plugin.h +++ b/editor/plugins/mesh_editor_plugin.h @@ -40,6 +40,9 @@ #include "scene/resources/camera_attributes.h" #include "scene/resources/material.h" +class SubViewport; +class TextureButton; + class MeshEditor : public SubViewportContainer { GDCLASS(MeshEditor, SubViewportContainer); diff --git a/editor/plugins/mesh_instance_3d_editor_plugin.cpp b/editor/plugins/mesh_instance_3d_editor_plugin.cpp index 68fbce771a..57e8046f32 100644 --- a/editor/plugins/mesh_instance_3d_editor_plugin.cpp +++ b/editor/plugins/mesh_instance_3d_editor_plugin.cpp @@ -38,6 +38,9 @@ #include "scene/3d/navigation_region_3d.h" #include "scene/3d/physics_body_3d.h" #include "scene/gui/box_container.h" +#include "scene/gui/menu_button.h" +#include "scene/resources/concave_polygon_shape_3d.h" +#include "scene/resources/convex_polygon_shape_3d.h" void MeshInstance3DEditor::_node_removed(Node *p_node) { if (p_node == node) { @@ -66,7 +69,7 @@ void MeshInstance3DEditor::_menu_option(int p_option) { List<Node *> selection = editor_selection->get_selected_node_list(); if (selection.is_empty()) { - Ref<Shape3D> shape = mesh->create_trimesh_shape(); + Ref<ConcavePolygonShape3D> shape = mesh->create_trimesh_shape(); if (shape.is_null()) { err_dialog->set_text(TTR("Couldn't create a Trimesh collision shape.")); err_dialog->popup_centered(); @@ -105,7 +108,7 @@ void MeshInstance3DEditor::_menu_option(int p_option) { continue; } - Ref<Shape3D> shape = m->create_trimesh_shape(); + Ref<ConcavePolygonShape3D> shape = m->create_trimesh_shape(); if (shape.is_null()) { continue; } @@ -137,7 +140,7 @@ void MeshInstance3DEditor::_menu_option(int p_option) { return; } - Ref<Shape3D> shape = mesh->create_trimesh_shape(); + Ref<ConcavePolygonShape3D> shape = mesh->create_trimesh_shape(); if (shape.is_null()) { return; } @@ -171,7 +174,7 @@ void MeshInstance3DEditor::_menu_option(int p_option) { bool simplify = (p_option == MENU_OPTION_CREATE_SIMPLIFIED_CONVEX_COLLISION_SHAPE); - Ref<Shape3D> shape = mesh->create_convex_shape(true, simplify); + Ref<ConvexPolygonShape3D> shape = mesh->create_convex_shape(true, simplify); if (shape.is_null()) { err_dialog->set_text(TTR("Couldn't create a single convex collision shape.")); diff --git a/editor/plugins/mesh_library_editor_plugin.cpp b/editor/plugins/mesh_library_editor_plugin.cpp index 6654b03a0d..4a8e5d9979 100644 --- a/editor/plugins/mesh_library_editor_plugin.cpp +++ b/editor/plugins/mesh_library_editor_plugin.cpp @@ -33,11 +33,13 @@ #include "editor/editor_file_dialog.h" #include "editor/editor_node.h" #include "editor/editor_settings.h" +#include "editor/inspector_dock.h" #include "main/main.h" #include "node_3d_editor_plugin.h" #include "scene/3d/mesh_instance_3d.h" #include "scene/3d/navigation_region_3d.h" #include "scene/3d/physics_body_3d.h" +#include "scene/gui/menu_button.h" #include "scene/main/window.h" #include "scene/resources/packed_scene.h" diff --git a/editor/plugins/multimesh_editor_plugin.cpp b/editor/plugins/multimesh_editor_plugin.cpp index b0e206b020..40fac060cd 100644 --- a/editor/plugins/multimesh_editor_plugin.cpp +++ b/editor/plugins/multimesh_editor_plugin.cpp @@ -35,6 +35,8 @@ #include "node_3d_editor_plugin.h" #include "scene/3d/mesh_instance_3d.h" #include "scene/gui/box_container.h" +#include "scene/gui/menu_button.h" +#include "scene/gui/option_button.h" void MultiMeshEditor::_node_removed(Node *p_node) { if (p_node == node) { diff --git a/editor/plugins/node_3d_editor_plugin.cpp b/editor/plugins/node_3d_editor_plugin.cpp index ca6d65bd57..c97de80a76 100644 --- a/editor/plugins/node_3d_editor_plugin.cpp +++ b/editor/plugins/node_3d_editor_plugin.cpp @@ -36,14 +36,12 @@ #include "core/math/math_funcs.h" #include "core/math/projection.h" #include "core/os/keyboard.h" -#include "core/templates/sort_array.h" #include "editor/debugger/editor_debugger_node.h" #include "editor/editor_node.h" #include "editor/editor_settings.h" #include "editor/editor_undo_redo_manager.h" #include "editor/plugins/animation_player_editor_plugin.h" #include "editor/plugins/node_3d_editor_gizmos.h" -#include "editor/plugins/script_editor_plugin.h" #include "editor/scene_tree_dock.h" #include "scene/3d/camera_3d.h" #include "scene/3d/collision_shape_3d.h" @@ -54,9 +52,12 @@ #include "scene/3d/visual_instance_3d.h" #include "scene/3d/world_environment.h" #include "scene/gui/center_container.h" +#include "scene/gui/color_picker.h" #include "scene/gui/flow_container.h" +#include "scene/gui/split_container.h" #include "scene/gui/subviewport_container.h" #include "scene/resources/packed_scene.h" +#include "scene/resources/sky_material.h" #include "scene/resources/surface_tool.h" constexpr real_t DISTANCE_DEFAULT = 4; @@ -85,6 +86,177 @@ constexpr real_t MAX_Z = 1000000.0; constexpr real_t MIN_FOV = 0.01; constexpr real_t MAX_FOV = 179; +void ViewportNavigationControl::_notification(int p_what) { + switch (p_what) { + case NOTIFICATION_ENTER_TREE: { + if (!is_connected("mouse_exited", callable_mp(this, &ViewportNavigationControl::_on_mouse_exited))) { + connect("mouse_exited", callable_mp(this, &ViewportNavigationControl::_on_mouse_exited)); + } + if (!is_connected("mouse_entered", callable_mp(this, &ViewportNavigationControl::_on_mouse_entered))) { + connect("mouse_entered", callable_mp(this, &ViewportNavigationControl::_on_mouse_entered)); + } + } break; + + case NOTIFICATION_DRAW: { + if (viewport != nullptr) { + _draw(); + _update_navigation(); + } + } break; + } +} + +void ViewportNavigationControl::_draw() { + if (nav_mode == Node3DEditorViewport::NAVIGATION_NONE) { + return; + } + + Vector2 center = get_size() / 2.0; + float radius = get_size().x / 2.0; + + const bool focused = focused_index != -1; + draw_circle(center, radius, Color(0.5, 0.5, 0.5, focused || hovered ? 0.35 : 0.15)); + + const Color c = focused ? Color(0.9, 0.9, 0.9, 0.9) : Color(0.5, 0.5, 0.5, 0.25); + + Vector2 circle_pos = focused ? center.move_toward(focused_pos, radius) : center; + + draw_circle(circle_pos, AXIS_CIRCLE_RADIUS, c); + draw_circle(circle_pos, AXIS_CIRCLE_RADIUS * 0.8, c.darkened(0.4)); +} + +void ViewportNavigationControl::_process_click(int p_index, Vector2 p_position, bool p_pressed) { + hovered = false; + queue_redraw(); + + if (focused_index != -1 && focused_index != p_index) { + return; + } + if (p_pressed) { + if (p_position.distance_to(get_size() / 2.0) < get_size().x / 2.0) { + focused_pos = p_position; + focused_index = p_index; + queue_redraw(); + } + } else { + focused_index = -1; + if (Input::get_singleton()->get_mouse_mode() == Input::MOUSE_MODE_CAPTURED) { + Input::get_singleton()->set_mouse_mode(Input::MOUSE_MODE_VISIBLE); + Input::get_singleton()->warp_mouse(focused_mouse_start); + } + } +} + +void ViewportNavigationControl::_process_drag(int p_index, Vector2 p_position, Vector2 p_relative_position) { + if (focused_index == p_index) { + if (Input::get_singleton()->get_mouse_mode() == Input::MOUSE_MODE_VISIBLE) { + Input::get_singleton()->set_mouse_mode(Input::MOUSE_MODE_CAPTURED); + focused_mouse_start = p_position; + } + focused_pos += p_relative_position; + queue_redraw(); + } +} + +void ViewportNavigationControl::gui_input(const Ref<InputEvent> &p_event) { + // Mouse events + const Ref<InputEventMouseButton> mouse_button = p_event; + if (mouse_button.is_valid() && mouse_button->get_button_index() == MouseButton::LEFT) { + _process_click(100, mouse_button->get_position(), mouse_button->is_pressed()); + } + + const Ref<InputEventMouseMotion> mouse_motion = p_event; + if (mouse_motion.is_valid()) { + _process_drag(100, mouse_motion->get_global_position(), viewport->_get_warped_mouse_motion(mouse_motion)); + } + + // Touch events + const Ref<InputEventScreenTouch> screen_touch = p_event; + if (screen_touch.is_valid()) { + _process_click(screen_touch->get_index(), screen_touch->get_position(), screen_touch->is_pressed()); + } + + const Ref<InputEventScreenDrag> screen_drag = p_event; + if (screen_drag.is_valid()) { + _process_drag(screen_drag->get_index(), screen_drag->get_position(), screen_drag->get_relative()); + } +} + +void ViewportNavigationControl::_update_navigation() { + if (focused_index == -1) { + return; + } + + Vector2 delta = focused_pos - (get_size() / 2.0); + Vector2 delta_normalized = delta.normalized(); + switch (nav_mode) { + case Node3DEditorViewport::NavigationMode::NAVIGATION_MOVE: { + real_t speed_multiplier = MIN(delta.length() / (get_size().x * 100.0), 3.0); + real_t speed = viewport->freelook_speed * speed_multiplier; + + const Node3DEditorViewport::FreelookNavigationScheme navigation_scheme = (Node3DEditorViewport::FreelookNavigationScheme)EditorSettings::get_singleton()->get("editors/3d/freelook/freelook_navigation_scheme").operator int(); + + Vector3 forward; + if (navigation_scheme == Node3DEditorViewport::FreelookNavigationScheme::FREELOOK_FULLY_AXIS_LOCKED) { + // Forward/backward keys will always go straight forward/backward, never moving on the Y axis. + forward = Vector3(0, 0, delta_normalized.y).rotated(Vector3(0, 1, 0), viewport->camera->get_rotation().y); + } else { + // Forward/backward keys will be relative to the camera pitch. + forward = viewport->camera->get_transform().basis.xform(Vector3(0, 0, delta_normalized.y)); + } + + const Vector3 right = viewport->camera->get_transform().basis.xform(Vector3(delta_normalized.x, 0, 0)); + + const Vector3 direction = forward + right; + const Vector3 motion = direction * speed; + viewport->cursor.pos += motion; + viewport->cursor.eye_pos += motion; + } break; + + case Node3DEditorViewport::NavigationMode::NAVIGATION_LOOK: { + real_t speed_multiplier = MIN(delta.length() / (get_size().x * 2.5), 3.0); + real_t speed = viewport->freelook_speed * speed_multiplier; + viewport->_nav_look(nullptr, delta_normalized * speed); + } break; + + case Node3DEditorViewport::NAVIGATION_PAN: { + real_t speed_multiplier = MIN(delta.length() / (get_size().x), 3.0); + real_t speed = viewport->freelook_speed * speed_multiplier; + viewport->_nav_pan(nullptr, -delta_normalized * speed); + } break; + case Node3DEditorViewport::NAVIGATION_ZOOM: { + real_t speed_multiplier = MIN(delta.length() / (get_size().x), 3.0); + real_t speed = viewport->freelook_speed * speed_multiplier; + viewport->_nav_zoom(nullptr, delta_normalized * speed); + } break; + case Node3DEditorViewport::NAVIGATION_ORBIT: { + real_t speed_multiplier = MIN(delta.length() / (get_size().x), 3.0); + real_t speed = viewport->freelook_speed * speed_multiplier; + viewport->_nav_orbit(nullptr, delta_normalized * speed); + } break; + case Node3DEditorViewport::NAVIGATION_NONE: { + } break; + } +} + +void ViewportNavigationControl::_on_mouse_entered() { + hovered = true; + queue_redraw(); +} + +void ViewportNavigationControl::_on_mouse_exited() { + hovered = false; + queue_redraw(); +} + +void ViewportNavigationControl::set_navigation_mode(Node3DEditorViewport::NavigationMode p_nav_mode) { + nav_mode = p_nav_mode; +} + +void ViewportNavigationControl::set_viewport(Node3DEditorViewport *p_viewport) { + viewport = p_viewport; +} + void ViewportRotationControl::_notification(int p_what) { switch (p_what) { case NOTIFICATION_ENTER_TREE: { @@ -119,7 +291,7 @@ void ViewportRotationControl::_draw() { const Vector2i center = get_size() / 2.0; const real_t radius = get_size().x / 2.0; - if (focused_axis > -2 || orbiting) { + if (focused_axis > -2 || orbiting_index != -1) { draw_circle(center, radius, Color(0.5, 0.5, 0.5, 0.25)); } @@ -190,41 +362,63 @@ void ViewportRotationControl::_get_sorted_axis(Vector<Axis2D> &r_axis) { r_axis.sort_custom<Axis2DCompare>(); } +void ViewportRotationControl::_process_click(int p_index, Vector2 p_position, bool p_pressed) { + if (orbiting_index != -1 && orbiting_index != p_index) { + return; + } + if (p_pressed) { + if (p_position.distance_to(get_size() / 2.0) < get_size().x / 2.0) { + orbiting_index = p_index; + } + } else { + if (focused_axis > -1) { + viewport->_menu_option(axis_menu_options[focused_axis]); + _update_focus(); + } + orbiting_index = -1; + if (Input::get_singleton()->get_mouse_mode() == Input::MOUSE_MODE_CAPTURED) { + Input::get_singleton()->set_mouse_mode(Input::MOUSE_MODE_VISIBLE); + Input::get_singleton()->warp_mouse(orbiting_mouse_start); + } + } +} + +void ViewportRotationControl::_process_drag(Ref<InputEventWithModifiers> p_event, int p_index, Vector2 p_position, Vector2 p_relative_position) { + if (orbiting_index == p_index) { + if (Input::get_singleton()->get_mouse_mode() == Input::MOUSE_MODE_VISIBLE) { + Input::get_singleton()->set_mouse_mode(Input::MOUSE_MODE_CAPTURED); + orbiting_mouse_start = p_position; + } + viewport->_nav_orbit(p_event, p_relative_position); + focused_axis = -1; + } else { + _update_focus(); + } +} + void ViewportRotationControl::gui_input(const Ref<InputEvent> &p_event) { ERR_FAIL_COND(p_event.is_null()); + // Mouse events const Ref<InputEventMouseButton> mb = p_event; if (mb.is_valid() && mb->get_button_index() == MouseButton::LEFT) { - Vector2 pos = mb->get_position(); - if (mb->is_pressed()) { - if (pos.distance_to(get_size() / 2.0) < get_size().x / 2.0) { - orbiting = true; - } - } else { - if (focused_axis > -1) { - viewport->_menu_option(axis_menu_options[focused_axis]); - _update_focus(); - } - orbiting = false; - if (Input::get_singleton()->get_mouse_mode() == Input::MOUSE_MODE_CAPTURED) { - Input::get_singleton()->set_mouse_mode(Input::MOUSE_MODE_VISIBLE); - Input::get_singleton()->warp_mouse(orbiting_mouse_start); - } - } + _process_click(100, mb->get_position(), mb->is_pressed()); } const Ref<InputEventMouseMotion> mm = p_event; if (mm.is_valid()) { - if (orbiting) { - if (Input::get_singleton()->get_mouse_mode() == Input::MOUSE_MODE_VISIBLE) { - Input::get_singleton()->set_mouse_mode(Input::MOUSE_MODE_CAPTURED); - orbiting_mouse_start = mm->get_global_position(); - } - viewport->_nav_orbit(mm, viewport->_get_warped_mouse_motion(mm)); - focused_axis = -1; - } else { - _update_focus(); - } + _process_drag(mm, 100, mm->get_global_position(), viewport->_get_warped_mouse_motion(mm)); + } + + // Touch events + const Ref<InputEventScreenTouch> screen_touch = p_event; + if (screen_touch.is_valid()) { + _process_click(screen_touch->get_index(), screen_touch->get_position(), screen_touch->is_pressed()); + } + + const Ref<InputEventScreenDrag> screen_drag = p_event; + if (screen_drag.is_valid()) { + _process_drag(screen_drag, screen_drag->get_index(), screen_drag->get_position(), screen_drag->get_relative()); } } @@ -352,6 +546,8 @@ void Node3DEditorViewport::_update_camera(real_t p_interp_delta) { update_transform_gizmo_view(); rotation_control->queue_redraw(); + position_control->queue_redraw(); + look_control->queue_redraw(); spatial_editor->update_grid(); } } @@ -2090,7 +2286,7 @@ void Node3DEditorViewport::_nav_pan(Ref<InputEventWithModifiers> p_event, const const NavigationScheme nav_scheme = (NavigationScheme)EDITOR_GET("editors/3d/navigation/navigation_scheme").operator int(); real_t pan_speed = 1 / 150.0; - if (nav_scheme == NAVIGATION_MAYA && p_event->is_shift_pressed()) { + if (p_event.is_valid() && nav_scheme == NAVIGATION_MAYA && p_event->is_shift_pressed()) { pan_speed *= 10; } @@ -2114,7 +2310,7 @@ void Node3DEditorViewport::_nav_zoom(Ref<InputEventWithModifiers> p_event, const const NavigationScheme nav_scheme = (NavigationScheme)EDITOR_GET("editors/3d/navigation/navigation_scheme").operator int(); real_t zoom_speed = 1 / 80.0; - if (nav_scheme == NAVIGATION_MAYA && p_event->is_shift_pressed()) { + if (p_event.is_valid() && nav_scheme == NAVIGATION_MAYA && p_event->is_shift_pressed()) { zoom_speed *= 10; } @@ -2447,6 +2643,8 @@ void Node3DEditorViewport::_notification(int p_what) { } call_deferred(SNAME("update_transform_gizmo_view")); rotation_control->set_visible(EDITOR_GET("editors/3d/navigation/show_viewport_rotation_gizmo")); + position_control->set_visible(EDITOR_GET("editors/3d/navigation/show_viewport_navigation_gizmo")); + look_control->set_visible(EDITOR_GET("editors/3d/navigation/show_viewport_navigation_gizmo")); } break; case NOTIFICATION_RESIZED: { @@ -3369,6 +3567,8 @@ void Node3DEditorViewport::_toggle_camera_preview(bool p_activate) { ERR_FAIL_COND(!p_activate && !previewing); rotation_control->set_visible(!p_activate); + position_control->set_visible(!p_activate); + look_control->set_visible(!p_activate); if (!p_activate) { previewing->disconnect("tree_exiting", callable_mp(this, &Node3DEditorViewport::_preview_exited_scene)); @@ -3390,6 +3590,8 @@ void Node3DEditorViewport::_toggle_camera_preview(bool p_activate) { void Node3DEditorViewport::_toggle_cinema_preview(bool p_activate) { previewing_cinema = p_activate; rotation_control->set_visible(!p_activate); + position_control->set_visible(!p_activate); + look_control->set_visible(!p_activate); if (!previewing_cinema) { if (previewing != nullptr) { @@ -4873,6 +5075,14 @@ Node3DEditorViewport::Node3DEditorViewport(Node3DEditor *p_spatial_editor, int p preview_node = nullptr; + bottom_center_vbox = memnew(VBoxContainer); + bottom_center_vbox->set_anchors_preset(LayoutPreset::PRESET_CENTER); + bottom_center_vbox->set_anchor_and_offset(SIDE_TOP, ANCHOR_END, -20 * EDSCALE); + bottom_center_vbox->set_anchor_and_offset(SIDE_BOTTOM, ANCHOR_END, -10 * EDSCALE); + bottom_center_vbox->set_h_grow_direction(GROW_DIRECTION_BOTH); + bottom_center_vbox->set_v_grow_direction(GROW_DIRECTION_BEGIN); + surface->add_child(bottom_center_vbox); + info_label = memnew(Label); info_label->set_anchor_and_offset(SIDE_LEFT, ANCHOR_END, -90 * EDSCALE); info_label->set_anchor_and_offset(SIDE_TOP, ANCHOR_END, -90 * EDSCALE); @@ -4893,23 +5103,18 @@ Node3DEditorViewport::Node3DEditorViewport(Node3DEditor *p_spatial_editor, int p previewing_cinema = false; locked_label = memnew(Label); - locked_label->set_anchor_and_offset(SIDE_TOP, ANCHOR_END, -20 * EDSCALE); - locked_label->set_anchor_and_offset(SIDE_BOTTOM, ANCHOR_END, -10 * EDSCALE); - locked_label->set_h_grow_direction(GROW_DIRECTION_END); - locked_label->set_v_grow_direction(GROW_DIRECTION_BEGIN); locked_label->set_horizontal_alignment(HORIZONTAL_ALIGNMENT_CENTER); - surface->add_child(locked_label); + locked_label->set_h_size_flags(SIZE_SHRINK_CENTER); + bottom_center_vbox->add_child(locked_label); locked_label->set_text(TTR("View Rotation Locked")); locked_label->hide(); zoom_limit_label = memnew(Label); - zoom_limit_label->set_anchors_and_offsets_preset(LayoutPreset::PRESET_BOTTOM_LEFT); - zoom_limit_label->set_offset(Side::SIDE_TOP, -28 * EDSCALE); zoom_limit_label->set_text(TTR("To zoom further, change the camera's clipping planes (View -> Settings...)")); zoom_limit_label->set_name("ZoomLimitMessageLabel"); zoom_limit_label->add_theme_color_override("font_color", Color(1, 1, 1, 1)); zoom_limit_label->hide(); - surface->add_child(zoom_limit_label); + bottom_center_vbox->add_child(zoom_limit_label); preview_material_label = memnew(Label); preview_material_label->set_anchors_and_offsets_preset(LayoutPreset::PRESET_BOTTOM_LEFT); @@ -4940,6 +5145,30 @@ Node3DEditorViewport::Node3DEditorViewport(Node3DEditor *p_spatial_editor, int p // Prevent visible spacing between frame time labels. top_right_vbox->add_theme_constant_override("separation", 0); + const int navigation_control_size = 150; + + position_control = memnew(ViewportNavigationControl); + position_control->set_navigation_mode(Node3DEditorViewport::NAVIGATION_MOVE); + position_control->set_custom_minimum_size(Size2(navigation_control_size, navigation_control_size) * EDSCALE); + position_control->set_h_size_flags(SIZE_SHRINK_END); + position_control->set_anchor_and_offset(SIDE_LEFT, ANCHOR_BEGIN, 0 * EDSCALE); + position_control->set_anchor_and_offset(SIDE_TOP, ANCHOR_END, -navigation_control_size * EDSCALE); + position_control->set_anchor_and_offset(SIDE_RIGHT, ANCHOR_BEGIN, navigation_control_size * EDSCALE); + position_control->set_anchor_and_offset(SIDE_BOTTOM, ANCHOR_END, 0 * EDSCALE); + position_control->set_viewport(this); + surface->add_child(position_control); + + look_control = memnew(ViewportNavigationControl); + look_control->set_navigation_mode(Node3DEditorViewport::NAVIGATION_LOOK); + look_control->set_custom_minimum_size(Size2(navigation_control_size, navigation_control_size) * EDSCALE); + look_control->set_h_size_flags(SIZE_SHRINK_END); + look_control->set_anchor_and_offset(SIDE_LEFT, ANCHOR_END, -navigation_control_size * EDSCALE); + look_control->set_anchor_and_offset(SIDE_TOP, ANCHOR_END, -navigation_control_size * EDSCALE); + look_control->set_anchor_and_offset(SIDE_RIGHT, ANCHOR_END, 0 * EDSCALE); + look_control->set_anchor_and_offset(SIDE_BOTTOM, ANCHOR_END, 0 * EDSCALE); + look_control->set_viewport(this); + surface->add_child(look_control); + rotation_control = memnew(ViewportRotationControl); rotation_control->set_custom_minimum_size(Size2(80, 80) * EDSCALE); rotation_control->set_h_size_flags(SIZE_SHRINK_END); @@ -8190,7 +8419,8 @@ Node3DEditor::Node3DEditor() { EditorSettings::get_singleton()->add_property_hint(PropertyInfo(Variant::INT, "editors/3d/manipulator_gizmo_size", PROPERTY_HINT_RANGE, "16,160,1")); EDITOR_DEF("editors/3d/manipulator_gizmo_opacity", 0.9); EditorSettings::get_singleton()->add_property_hint(PropertyInfo(Variant::FLOAT, "editors/3d/manipulator_gizmo_opacity", PROPERTY_HINT_RANGE, "0,1,0.01")); - EDITOR_DEF("editors/3d/navigation/show_viewport_rotation_gizmo", true); + EDITOR_DEF_RST("editors/3d/navigation/show_viewport_rotation_gizmo", true); + EDITOR_DEF_RST("editors/3d/navigation/show_viewport_navigation_gizmo", DisplayServer::get_singleton()->screen_is_touchscreen()); current_hover_gizmo_handle = -1; current_hover_gizmo_handle_secondary = false; diff --git a/editor/plugins/node_3d_editor_plugin.h b/editor/plugins/node_3d_editor_plugin.h index a8d3bfb70c..ed555d86c3 100644 --- a/editor/plugins/node_3d_editor_plugin.h +++ b/editor/plugins/node_3d_editor_plugin.h @@ -33,32 +33,31 @@ #include "editor/editor_plugin.h" #include "editor/editor_scale.h" -#include "editor/editor_spin_slider.h" #include "editor/plugins/node_3d_editor_gizmos.h" -#include "scene/3d/camera_3d.h" -#include "scene/3d/light_3d.h" -#include "scene/3d/visual_instance_3d.h" -#include "scene/3d/world_environment.h" #include "scene/gui/box_container.h" -#include "scene/gui/color_picker.h" -#include "scene/gui/panel_container.h" +#include "scene/gui/button.h" #include "scene/gui/spin_box.h" -#include "scene/gui/split_container.h" -#include "scene/resources/environment.h" -#include "scene/resources/fog_material.h" -#include "scene/resources/sky_material.h" class AcceptDialog; class CheckBox; +class ColorPickerButton; class ConfirmationDialog; +class DirectionalLight3D; class EditorData; +class EditorSpinSlider; +class HSplitContainer; +class LineEdit; class MenuButton; class Node3DEditor; class Node3DEditorViewport; class OptionButton; +class PanelContainer; +class ProceduralSkyMaterial; +class SubViewport; class SubViewportContainer; -class DirectionalLight3D; +class VSplitContainer; class WorldEnvironment; +class ViewportNavigationControl; class ViewportRotationControl : public Control { GDCLASS(ViewportRotationControl, Control); @@ -79,7 +78,7 @@ class ViewportRotationControl : public Control { Vector<Color> axis_colors; Vector<int> axis_menu_options; Vector2i orbiting_mouse_start; - bool orbiting = false; + int orbiting_index = -1; int focused_axis = -2; const float AXIS_CIRCLE_RADIUS = 8.0f * EDSCALE; @@ -92,6 +91,8 @@ protected: void _get_sorted_axis(Vector<Axis2D> &r_axis); void _update_focus(); void _on_mouse_exited(); + void _process_click(int p_index, Vector2 p_position, bool p_pressed); + void _process_drag(Ref<InputEventWithModifiers> p_event, int p_index, Vector2 p_position, Vector2 p_relative_position); public: void set_viewport(Node3DEditorViewport *p_viewport); @@ -100,6 +101,7 @@ public: class Node3DEditorViewport : public Control { GDCLASS(Node3DEditorViewport, Control); friend class Node3DEditor; + friend class ViewportNavigationControl; friend class ViewportRotationControl; enum { VIEW_TOP, @@ -238,6 +240,9 @@ private: Label *preview_material_label_desc = nullptr; VBoxContainer *top_right_vbox = nullptr; + VBoxContainer *bottom_center_vbox = nullptr; + ViewportNavigationControl *position_control = nullptr; + ViewportNavigationControl *look_control = nullptr; ViewportRotationControl *rotation_control = nullptr; Gradient *frame_time_gradient = nullptr; Label *cpu_time_label = nullptr; @@ -299,7 +304,8 @@ private: NAVIGATION_PAN, NAVIGATION_ZOOM, NAVIGATION_ORBIT, - NAVIGATION_LOOK + NAVIGATION_LOOK, + NAVIGATION_MOVE }; enum TransformMode { TRANSFORM_NONE, @@ -918,4 +924,31 @@ public: ~Node3DEditorPlugin(); }; +class ViewportNavigationControl : public Control { + GDCLASS(ViewportNavigationControl, Control); + + Node3DEditorViewport *viewport = nullptr; + Vector2i focused_mouse_start; + Vector2 focused_pos; + bool hovered = false; + int focused_index = -1; + Node3DEditorViewport::NavigationMode nav_mode = Node3DEditorViewport::NavigationMode::NAVIGATION_NONE; + + const float AXIS_CIRCLE_RADIUS = 30.0f * EDSCALE; + +protected: + void _notification(int p_what); + virtual void gui_input(const Ref<InputEvent> &p_event) override; + void _draw(); + void _on_mouse_entered(); + void _on_mouse_exited(); + void _process_click(int p_index, Vector2 p_position, bool p_pressed); + void _process_drag(int p_index, Vector2 p_position, Vector2 p_relative_position); + void _update_navigation(); + +public: + void set_navigation_mode(Node3DEditorViewport::NavigationMode p_nav_mode); + void set_viewport(Node3DEditorViewport *p_viewport); +}; + #endif // NODE_3D_EDITOR_PLUGIN_H diff --git a/editor/plugins/path_2d_editor_plugin.cpp b/editor/plugins/path_2d_editor_plugin.cpp index 133a7e5327..3204cc8d0f 100644 --- a/editor/plugins/path_2d_editor_plugin.cpp +++ b/editor/plugins/path_2d_editor_plugin.cpp @@ -37,6 +37,7 @@ #include "editor/editor_scale.h" #include "editor/editor_settings.h" #include "editor/editor_undo_redo_manager.h" +#include "scene/gui/menu_button.h" void Path2DEditor::_notification(int p_what) { switch (p_what) { diff --git a/editor/plugins/path_3d_editor_plugin.cpp b/editor/plugins/path_3d_editor_plugin.cpp index d7953bf4e0..5a7b0321b7 100644 --- a/editor/plugins/path_3d_editor_plugin.cpp +++ b/editor/plugins/path_3d_editor_plugin.cpp @@ -37,6 +37,7 @@ #include "editor/editor_settings.h" #include "editor/editor_undo_redo_manager.h" #include "node_3d_editor_plugin.h" +#include "scene/gui/menu_button.h" #include "scene/resources/curve.h" static bool _is_in_handle(int p_id, int p_num_points) { diff --git a/editor/plugins/physical_bone_3d_editor_plugin.cpp b/editor/plugins/physical_bone_3d_editor_plugin.cpp index 9dc89133c4..2b59e4cf08 100644 --- a/editor/plugins/physical_bone_3d_editor_plugin.cpp +++ b/editor/plugins/physical_bone_3d_editor_plugin.cpp @@ -31,6 +31,7 @@ #include "physical_bone_3d_editor_plugin.h" #include "editor/plugins/node_3d_editor_plugin.h" +#include "scene/gui/separator.h" void PhysicalBone3DEditor::_bind_methods() { } diff --git a/editor/plugins/polygon_2d_editor_plugin.cpp b/editor/plugins/polygon_2d_editor_plugin.cpp index 6218c887fb..a19a42f951 100644 --- a/editor/plugins/polygon_2d_editor_plugin.cpp +++ b/editor/plugins/polygon_2d_editor_plugin.cpp @@ -38,10 +38,14 @@ #include "editor/editor_undo_redo_manager.h" #include "editor/plugins/canvas_item_editor_plugin.h" #include "scene/2d/skeleton_2d.h" +#include "scene/gui/check_box.h" #include "scene/gui/menu_button.h" #include "scene/gui/scroll_container.h" #include "scene/gui/separator.h" #include "scene/gui/slider.h" +#include "scene/gui/spin_box.h" +#include "scene/gui/split_container.h" +#include "scene/gui/texture_rect.h" #include "scene/gui/view_panner.h" Node2D *Polygon2DEditor::_get_node() const { diff --git a/editor/plugins/polygon_3d_editor_plugin.cpp b/editor/plugins/polygon_3d_editor_plugin.cpp index 1cd4804b79..dde44d31fa 100644 --- a/editor/plugins/polygon_3d_editor_plugin.cpp +++ b/editor/plugins/polygon_3d_editor_plugin.cpp @@ -41,6 +41,7 @@ #include "editor/editor_undo_redo_manager.h" #include "node_3d_editor_plugin.h" #include "scene/3d/camera_3d.h" +#include "scene/gui/separator.h" void Polygon3DEditor::_notification(int p_what) { switch (p_what) { diff --git a/editor/plugins/root_motion_editor_plugin.cpp b/editor/plugins/root_motion_editor_plugin.cpp index 596b2c0edb..93a64a8f3d 100644 --- a/editor/plugins/root_motion_editor_plugin.cpp +++ b/editor/plugins/root_motion_editor_plugin.cpp @@ -32,6 +32,7 @@ #include "editor/editor_node.h" #include "scene/animation/animation_player.h" #include "scene/animation/animation_tree.h" +#include "scene/gui/tree.h" #include "scene/main/window.h" void EditorPropertyRootMotion::_confirmed() { diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp index 4ff3919e9b..bb5491fcb5 100644 --- a/editor/plugins/script_editor_plugin.cpp +++ b/editor/plugins/script_editor_plugin.cpp @@ -40,6 +40,7 @@ #include "editor/debugger/editor_debugger_node.h" #include "editor/debugger/script_editor_debugger.h" #include "editor/editor_file_dialog.h" +#include "editor/editor_help_search.h" #include "editor/editor_node.h" #include "editor/editor_paths.h" #include "editor/editor_run_script.h" @@ -47,6 +48,7 @@ #include "editor/editor_settings.h" #include "editor/filesystem_dock.h" #include "editor/find_in_files.h" +#include "editor/inspector_dock.h" #include "editor/node_dock.h" #include "editor/plugins/shader_editor_plugin.h" #include "editor/plugins/text_shader_editor.h" diff --git a/editor/plugins/script_editor_plugin.h b/editor/plugins/script_editor_plugin.h index 3f84ded0a2..213fbdc22a 100644 --- a/editor/plugins/script_editor_plugin.h +++ b/editor/plugins/script_editor_plugin.h @@ -31,24 +31,22 @@ #ifndef SCRIPT_EDITOR_PLUGIN_H #define SCRIPT_EDITOR_PLUGIN_H -#include "core/object/script_language.h" -#include "editor/code_editor.h" -#include "editor/editor_help.h" -#include "editor/editor_help_search.h" #include "editor/editor_plugin.h" -#include "editor/script_create_dialog.h" -#include "scene/gui/item_list.h" -#include "scene/gui/line_edit.h" -#include "scene/gui/menu_button.h" -#include "scene/gui/split_container.h" -#include "scene/gui/tab_container.h" -#include "scene/gui/text_edit.h" -#include "scene/gui/tree.h" -#include "scene/main/timer.h" +#include "scene/gui/dialogs.h" +#include "scene/gui/panel_container.h" +#include "scene/resources/syntax_highlighter.h" #include "scene/resources/text_file.h" class EditorFileDialog; +class EditorHelpSearch; +class FindReplaceBar; +class HSplitContainer; +class ItemList; +class MenuButton; +class TabContainer; class TextureRect; +class Tree; +class VSplitContainer; class EditorSyntaxHighlighter : public SyntaxHighlighter { GDCLASS(EditorSyntaxHighlighter, SyntaxHighlighter) diff --git a/editor/plugins/script_text_editor.cpp b/editor/plugins/script_text_editor.cpp index 4e66dc3d7e..747fdfd041 100644 --- a/editor/plugins/script_text_editor.cpp +++ b/editor/plugins/script_text_editor.cpp @@ -38,6 +38,7 @@ #include "editor/editor_node.h" #include "editor/editor_scale.h" #include "editor/editor_settings.h" +#include "scene/gui/split_container.h" void ConnectionInfoDialog::ok_pressed() { } diff --git a/editor/plugins/script_text_editor.h b/editor/plugins/script_text_editor.h index 5fd12674b3..cbc4153e12 100644 --- a/editor/plugins/script_text_editor.h +++ b/editor/plugins/script_text_editor.h @@ -31,10 +31,14 @@ #ifndef SCRIPT_TEXT_EDITOR_H #define SCRIPT_TEXT_EDITOR_H +#include "script_editor_plugin.h" + +#include "editor/code_editor.h" #include "scene/gui/color_picker.h" #include "scene/gui/dialogs.h" #include "scene/gui/tree.h" -#include "script_editor_plugin.h" + +class RichTextLabel; class ConnectionInfoDialog : public AcceptDialog { GDCLASS(ConnectionInfoDialog, AcceptDialog); diff --git a/editor/plugins/shader_editor_plugin.cpp b/editor/plugins/shader_editor_plugin.cpp index 2f80e41dd4..fbc94c70f8 100644 --- a/editor/plugins/shader_editor_plugin.cpp +++ b/editor/plugins/shader_editor_plugin.cpp @@ -34,9 +34,12 @@ #include "editor/editor_scale.h" #include "editor/editor_undo_redo_manager.h" #include "editor/filesystem_dock.h" +#include "editor/inspector_dock.h" #include "editor/plugins/text_shader_editor.h" #include "editor/plugins/visual_shader_editor_plugin.h" #include "editor/shader_create_dialog.h" +#include "scene/gui/item_list.h" +#include "scene/gui/texture_rect.h" void ShaderEditorPlugin::_update_shader_list() { shader_list->clear(); diff --git a/editor/plugins/shader_file_editor_plugin.cpp b/editor/plugins/shader_file_editor_plugin.cpp index dd644cb369..4e33c421ae 100644 --- a/editor/plugins/shader_file_editor_plugin.cpp +++ b/editor/plugins/shader_file_editor_plugin.cpp @@ -37,6 +37,8 @@ #include "editor/editor_node.h" #include "editor/editor_scale.h" #include "editor/editor_settings.h" +#include "scene/gui/item_list.h" +#include "scene/gui/split_container.h" #include "servers/display_server.h" #include "servers/rendering/shader_types.h" diff --git a/editor/plugins/skeleton_2d_editor_plugin.cpp b/editor/plugins/skeleton_2d_editor_plugin.cpp index dbad81d743..5ae21a430d 100644 --- a/editor/plugins/skeleton_2d_editor_plugin.cpp +++ b/editor/plugins/skeleton_2d_editor_plugin.cpp @@ -35,6 +35,7 @@ #include "editor/editor_undo_redo_manager.h" #include "scene/2d/mesh_instance_2d.h" #include "scene/gui/box_container.h" +#include "scene/gui/menu_button.h" #include "thirdparty/misc/clipper.hpp" void Skeleton2DEditor::_node_removed(Node *p_node) { diff --git a/editor/plugins/skeleton_3d_editor_plugin.cpp b/editor/plugins/skeleton_3d_editor_plugin.cpp index 8e80d0d5d8..e8bbfd1b91 100644 --- a/editor/plugins/skeleton_3d_editor_plugin.cpp +++ b/editor/plugins/skeleton_3d_editor_plugin.cpp @@ -34,6 +34,7 @@ #include "editor/editor_node.h" #include "editor/editor_properties.h" #include "editor/editor_scale.h" +#include "editor/editor_settings.h" #include "editor/editor_undo_redo_manager.h" #include "editor/plugins/animation_player_editor_plugin.h" #include "node_3d_editor_plugin.h" @@ -41,6 +42,7 @@ #include "scene/3d/joint_3d.h" #include "scene/3d/mesh_instance_3d.h" #include "scene/3d/physics_body_3d.h" +#include "scene/gui/separator.h" #include "scene/resources/capsule_shape_3d.h" #include "scene/resources/skeleton_profile.h" #include "scene/resources/sphere_shape_3d.h" diff --git a/editor/plugins/skeleton_3d_editor_plugin.h b/editor/plugins/skeleton_3d_editor_plugin.h index 273bdeaac8..8ef61861d0 100644 --- a/editor/plugins/skeleton_3d_editor_plugin.h +++ b/editor/plugins/skeleton_3d_editor_plugin.h @@ -45,6 +45,9 @@ class Joint; class PhysicalBone3D; class Skeleton3DEditorPlugin; class Button; +class Tree; +class TreeItem; +class VSeparator; class BoneTransformEditor : public VBoxContainer { GDCLASS(BoneTransformEditor, VBoxContainer); diff --git a/editor/plugins/sprite_2d_editor_plugin.cpp b/editor/plugins/sprite_2d_editor_plugin.cpp index b78b70cd5c..110ad7cac0 100644 --- a/editor/plugins/sprite_2d_editor_plugin.cpp +++ b/editor/plugins/sprite_2d_editor_plugin.cpp @@ -41,6 +41,7 @@ #include "scene/2d/mesh_instance_2d.h" #include "scene/2d/polygon_2d.h" #include "scene/gui/box_container.h" +#include "scene/gui/menu_button.h" #include "thirdparty/misc/clipper.hpp" void Sprite2DEditor::_node_removed(Node *p_node) { diff --git a/editor/plugins/sprite_frames_editor_plugin.cpp b/editor/plugins/sprite_frames_editor_plugin.cpp index 6924cb58bf..64e899b121 100644 --- a/editor/plugins/sprite_frames_editor_plugin.cpp +++ b/editor/plugins/sprite_frames_editor_plugin.cpp @@ -34,6 +34,7 @@ #include "core/io/resource_loader.h" #include "core/os/keyboard.h" #include "editor/editor_file_dialog.h" +#include "editor/editor_file_system.h" #include "editor/editor_node.h" #include "editor/editor_scale.h" #include "editor/editor_settings.h" @@ -43,6 +44,7 @@ #include "scene/gui/center_container.h" #include "scene/gui/margin_container.h" #include "scene/gui/panel_container.h" +#include "scene/gui/separator.h" static void _draw_shadowed_line(Control *p_control, const Point2 &p_from, const Size2 &p_size, const Size2 &p_shadow_offset, Color p_color, Color p_shadow_color) { p_control->draw_line(p_from, p_from + p_size, p_color); diff --git a/editor/plugins/style_box_editor_plugin.cpp b/editor/plugins/style_box_editor_plugin.cpp index 16a6a48df9..afc54a2b83 100644 --- a/editor/plugins/style_box_editor_plugin.cpp +++ b/editor/plugins/style_box_editor_plugin.cpp @@ -31,6 +31,7 @@ #include "style_box_editor_plugin.h" #include "editor/editor_scale.h" +#include "scene/gui/texture_button.h" bool StyleBoxPreview::grid_preview_enabled = true; diff --git a/editor/plugins/style_box_editor_plugin.h b/editor/plugins/style_box_editor_plugin.h index a072745d8f..d5351d3f34 100644 --- a/editor/plugins/style_box_editor_plugin.h +++ b/editor/plugins/style_box_editor_plugin.h @@ -37,6 +37,8 @@ #include "scene/gui/texture_rect.h" #include "scene/resources/style_box.h" +class TextureButton; + class StyleBoxPreview : public VBoxContainer { GDCLASS(StyleBoxPreview, VBoxContainer); diff --git a/editor/plugins/text_editor.cpp b/editor/plugins/text_editor.cpp index 03cff74bdb..baf5e363f8 100644 --- a/editor/plugins/text_editor.cpp +++ b/editor/plugins/text_editor.cpp @@ -33,6 +33,7 @@ #include "core/os/keyboard.h" #include "editor/editor_node.h" #include "editor/editor_settings.h" +#include "scene/gui/menu_button.h" void TextEditor::add_syntax_highlighter(Ref<EditorSyntaxHighlighter> p_highlighter) { ERR_FAIL_COND(p_highlighter.is_null()); diff --git a/editor/plugins/text_editor.h b/editor/plugins/text_editor.h index 486a0f2c23..9f2132bc0b 100644 --- a/editor/plugins/text_editor.h +++ b/editor/plugins/text_editor.h @@ -33,6 +33,8 @@ #include "script_editor_plugin.h" +#include "editor/code_editor.h" + class TextEditor : public ScriptEditorBase { GDCLASS(TextEditor, ScriptEditorBase); diff --git a/editor/plugins/texture_3d_editor_plugin.cpp b/editor/plugins/texture_3d_editor_plugin.cpp index 4b2f28658a..bdea12c2cb 100644 --- a/editor/plugins/texture_3d_editor_plugin.cpp +++ b/editor/plugins/texture_3d_editor_plugin.cpp @@ -30,6 +30,8 @@ #include "texture_3d_editor_plugin.h" +#include "scene/gui/label.h" + void Texture3DEditor::_texture_rect_draw() { texture_rect->draw_rect(Rect2(Point2(), texture_rect->get_size()), Color(1, 1, 1, 1)); } diff --git a/editor/plugins/texture_editor_plugin.cpp b/editor/plugins/texture_editor_plugin.cpp index 4aed7a92a2..5783912c96 100644 --- a/editor/plugins/texture_editor_plugin.cpp +++ b/editor/plugins/texture_editor_plugin.cpp @@ -30,6 +30,8 @@ #include "texture_editor_plugin.h" #include "editor/editor_scale.h" +#include "scene/gui/label.h" +#include "scene/gui/texture_rect.h" TextureRect *TexturePreview::get_texture_display() { return texture_display; diff --git a/editor/plugins/texture_layered_editor_plugin.cpp b/editor/plugins/texture_layered_editor_plugin.cpp index b0a174c1bc..479e84682b 100644 --- a/editor/plugins/texture_layered_editor_plugin.cpp +++ b/editor/plugins/texture_layered_editor_plugin.cpp @@ -30,6 +30,8 @@ #include "texture_layered_editor_plugin.h" +#include "scene/gui/label.h" + void TextureLayeredEditor::gui_input(const Ref<InputEvent> &p_event) { ERR_FAIL_COND(p_event.is_null()); diff --git a/editor/plugins/texture_region_editor_plugin.cpp b/editor/plugins/texture_region_editor_plugin.cpp index 2e84a4fac9..fdfa3f8d0a 100644 --- a/editor/plugins/texture_region_editor_plugin.cpp +++ b/editor/plugins/texture_region_editor_plugin.cpp @@ -38,7 +38,9 @@ #include "editor/editor_settings.h" #include "editor/editor_undo_redo_manager.h" #include "scene/gui/check_box.h" +#include "scene/gui/option_button.h" #include "scene/gui/separator.h" +#include "scene/gui/spin_box.h" #include "scene/gui/view_panner.h" #include "scene/resources/texture.h" diff --git a/editor/plugins/texture_region_editor_plugin.h b/editor/plugins/texture_region_editor_plugin.h index 310de19cc5..90a5b20e14 100644 --- a/editor/plugins/texture_region_editor_plugin.h +++ b/editor/plugins/texture_region_editor_plugin.h @@ -36,6 +36,7 @@ #include "editor/editor_plugin.h" #include "scene/2d/sprite_2d.h" #include "scene/3d/sprite_3d.h" +#include "scene/gui/dialogs.h" #include "scene/gui/nine_patch_rect.h" #include "scene/resources/style_box.h" #include "scene/resources/texture.h" diff --git a/editor/plugins/theme_editor_plugin.cpp b/editor/plugins/theme_editor_plugin.cpp index 5d02e4e437..135b218768 100644 --- a/editor/plugins/theme_editor_plugin.cpp +++ b/editor/plugins/theme_editor_plugin.cpp @@ -38,6 +38,8 @@ #include "editor/editor_undo_redo_manager.h" #include "editor/progress_dialog.h" #include "scene/gui/color_picker.h" +#include "scene/gui/panel_container.h" +#include "scene/gui/split_container.h" #include "scene/theme/theme_db.h" void ThemeItemImportTree::_update_items_tree() { diff --git a/editor/plugins/theme_editor_preview.cpp b/editor/plugins/theme_editor_preview.cpp index fdd8a80ad3..082b21bbe5 100644 --- a/editor/plugins/theme_editor_preview.cpp +++ b/editor/plugins/theme_editor_preview.cpp @@ -36,9 +36,12 @@ #include "editor/editor_node.h" #include "editor/editor_scale.h" #include "scene/gui/button.h" +#include "scene/gui/check_box.h" #include "scene/gui/check_button.h" #include "scene/gui/color_picker.h" #include "scene/gui/progress_bar.h" +#include "scene/gui/text_edit.h" +#include "scene/gui/tree.h" #include "scene/resources/packed_scene.h" #include "scene/theme/theme_db.h" diff --git a/editor/plugins/tiles/tile_data_editors.cpp b/editor/plugins/tiles/tile_data_editors.cpp index 44b8ff05d1..993f606f2f 100644 --- a/editor/plugins/tiles/tile_data_editors.cpp +++ b/editor/plugins/tiles/tile_data_editors.cpp @@ -38,8 +38,13 @@ #include "editor/editor_node.h" #include "editor/editor_properties.h" #include "editor/editor_scale.h" +#include "editor/editor_settings.h" #include "editor/editor_undo_redo_manager.h" +#include "scene/gui/menu_button.h" +#include "scene/gui/option_button.h" +#include "scene/gui/separator.h" + #ifdef DEBUG_ENABLED #include "servers/navigation_server_3d.h" #endif // DEBUG_ENABLED @@ -851,6 +856,7 @@ GenericTilePolygonEditor::GenericTilePolygonEditor() { void TileDataDefaultEditor::_property_value_changed(StringName p_property, Variant p_value, StringName p_field) { ERR_FAIL_COND(!dummy_object); dummy_object->set(p_property, p_value); + emit_signal(SNAME("needs_redraw")); } Variant TileDataDefaultEditor::_get_painted_value() { diff --git a/editor/plugins/tiles/tile_data_editors.h b/editor/plugins/tiles/tile_data_editors.h index 98d337b4cf..e98e1d6701 100644 --- a/editor/plugins/tiles/tile_data_editors.h +++ b/editor/plugins/tiles/tile_data_editors.h @@ -39,6 +39,9 @@ #include "scene/gui/control.h" #include "scene/gui/label.h" +class MenuButton; +class EditorUndoRedoManager; + class TileDataEditor : public VBoxContainer { GDCLASS(TileDataEditor, VBoxContainer); diff --git a/editor/plugins/tiles/tile_map_editor.cpp b/editor/plugins/tiles/tile_map_editor.cpp index eb7c93872e..e622a0817a 100644 --- a/editor/plugins/tiles/tile_map_editor.cpp +++ b/editor/plugins/tiles/tile_map_editor.cpp @@ -35,6 +35,7 @@ #include "editor/editor_node.h" #include "editor/editor_resource_preview.h" #include "editor/editor_scale.h" +#include "editor/editor_settings.h" #include "editor/editor_undo_redo_manager.h" #include "editor/plugins/canvas_item_editor_plugin.h" diff --git a/editor/plugins/tiles/tile_proxies_manager_dialog.cpp b/editor/plugins/tiles/tile_proxies_manager_dialog.cpp index 50350de97e..7058b28e68 100644 --- a/editor/plugins/tiles/tile_proxies_manager_dialog.cpp +++ b/editor/plugins/tiles/tile_proxies_manager_dialog.cpp @@ -32,7 +32,9 @@ #include "editor/editor_node.h" #include "editor/editor_scale.h" +#include "editor/editor_settings.h" #include "editor/editor_undo_redo_manager.h" +#include "scene/gui/separator.h" void TileProxiesManagerDialog::_right_clicked(int p_item, Vector2 p_local_mouse_pos, Object *p_item_list, MouseButton p_mouse_button_index) { if (p_mouse_button_index != MouseButton::RIGHT) { diff --git a/editor/plugins/tiles/tile_proxies_manager_dialog.h b/editor/plugins/tiles/tile_proxies_manager_dialog.h index d0f1933882..e2363eb809 100644 --- a/editor/plugins/tiles/tile_proxies_manager_dialog.h +++ b/editor/plugins/tiles/tile_proxies_manager_dialog.h @@ -36,6 +36,8 @@ #include "scene/gui/dialogs.h" #include "scene/gui/item_list.h" +class EditorUndoRedoManager; + class TileProxiesManagerDialog : public ConfirmationDialog { GDCLASS(TileProxiesManagerDialog, ConfirmationDialog); diff --git a/editor/plugins/tiles/tile_set_atlas_source_editor.cpp b/editor/plugins/tiles/tile_set_atlas_source_editor.cpp index 8e69abd7ff..7ed84423bc 100644 --- a/editor/plugins/tiles/tile_set_atlas_source_editor.cpp +++ b/editor/plugins/tiles/tile_set_atlas_source_editor.cpp @@ -35,10 +35,10 @@ #include "editor/editor_inspector.h" #include "editor/editor_node.h" #include "editor/editor_scale.h" +#include "editor/editor_settings.h" #include "editor/editor_undo_redo_manager.h" #include "editor/progress_dialog.h" -#include "editor/editor_node.h" #include "scene/gui/box_container.h" #include "scene/gui/button.h" #include "scene/gui/control.h" @@ -152,7 +152,7 @@ bool TileSetAtlasSourceEditor::AtlasTileProxyObject::_set(const StringName &p_na // ID and size related properties. if (tiles.size() == 1) { - const Vector2i &coords = tiles.front()->get().tile; + const Vector2i coords = tiles.front()->get().tile; const int &alternative = tiles.front()->get().alternative; if (alternative == 0) { @@ -543,11 +543,13 @@ void TileSetAtlasSourceEditor::_update_source_inspector() { void TileSetAtlasSourceEditor::_update_fix_selected_and_hovered_tiles() { // Fix selected. - for (RBSet<TileSelection>::Element *E = selection.front(); E; E = E->next()) { + for (RBSet<TileSelection>::Element *E = selection.front(); E;) { + RBSet<TileSelection>::Element *N = E->next(); TileSelection selected = E->get(); if (!tile_set_atlas_source->has_tile(selected.tile) || !tile_set_atlas_source->has_alternative_tile(selected.tile, selected.alternative)) { selection.erase(E); } + E = N; } // Fix hovered. @@ -2343,6 +2345,15 @@ void TileSetAtlasSourceEditor::_notification(int p_what) { tile_set_changed_needs_update = false; } } break; + + case NOTIFICATION_EXIT_TREE: { + for (KeyValue<String, TileDataEditor *> &E : tile_data_editors) { + Control *toolbar = E.value->get_toolbar(); + if (toolbar->get_parent() == tool_settings_tile_data_toolbar_container) { + tool_settings_tile_data_toolbar_container->remove_child(toolbar); + } + } + } break; } } diff --git a/editor/plugins/tiles/tile_set_atlas_source_editor.h b/editor/plugins/tiles/tile_set_atlas_source_editor.h index 8e217e359f..14e120e2a3 100644 --- a/editor/plugins/tiles/tile_set_atlas_source_editor.h +++ b/editor/plugins/tiles/tile_set_atlas_source_editor.h @@ -37,7 +37,10 @@ #include "scene/gui/split_container.h" #include "scene/resources/tile_set.h" +class Popup; class TileSet; +class Tree; +class VSeparator; class TileSetAtlasSourceEditor : public HBoxContainer { GDCLASS(TileSetAtlasSourceEditor, HBoxContainer); diff --git a/editor/plugins/tiles/tile_set_editor.cpp b/editor/plugins/tiles/tile_set_editor.cpp index dccff80512..b24c5059b0 100644 --- a/editor/plugins/tiles/tile_set_editor.cpp +++ b/editor/plugins/tiles/tile_set_editor.cpp @@ -36,6 +36,7 @@ #include "editor/editor_file_system.h" #include "editor/editor_node.h" #include "editor/editor_scale.h" +#include "editor/editor_settings.h" #include "editor/editor_undo_redo_manager.h" #include "scene/gui/box_container.h" diff --git a/editor/plugins/tiles/tile_set_scenes_collection_source_editor.cpp b/editor/plugins/tiles/tile_set_scenes_collection_source_editor.cpp index 3b711a568e..a14aad6652 100644 --- a/editor/plugins/tiles/tile_set_scenes_collection_source_editor.cpp +++ b/editor/plugins/tiles/tile_set_scenes_collection_source_editor.cpp @@ -38,6 +38,7 @@ #include "editor/editor_undo_redo_manager.h" #include "scene/gui/item_list.h" +#include "scene/gui/split_container.h" #include "core/core_string_names.h" diff --git a/editor/plugins/tiles/tiles_editor_plugin.cpp b/editor/plugins/tiles/tiles_editor_plugin.cpp index 4239e2c981..5d93f58f34 100644 --- a/editor/plugins/tiles/tiles_editor_plugin.cpp +++ b/editor/plugins/tiles/tiles_editor_plugin.cpp @@ -30,10 +30,13 @@ #include "tiles_editor_plugin.h" +#include "tile_set_editor.h" + #include "core/os/mutex.h" #include "editor/editor_node.h" #include "editor/editor_scale.h" +#include "editor/editor_settings.h" #include "editor/plugins/canvas_item_editor_plugin.h" #include "scene/2d/tile_map.h" @@ -43,8 +46,6 @@ #include "scene/gui/separator.h" #include "scene/resources/tile_set.h" -#include "tile_set_editor.h" - TilesEditorPlugin *TilesEditorPlugin::singleton = nullptr; void TilesEditorPlugin::_preview_frame_started() { diff --git a/editor/plugins/version_control_editor_plugin.cpp b/editor/plugins/version_control_editor_plugin.cpp index 4fdfaed50e..86aa897c78 100644 --- a/editor/plugins/version_control_editor_plugin.cpp +++ b/editor/plugins/version_control_editor_plugin.cpp @@ -38,6 +38,7 @@ #include "editor/editor_scale.h" #include "editor/editor_settings.h" #include "editor/filesystem_dock.h" +#include "editor/plugins/script_editor_plugin.h" #include "scene/gui/separator.h" #define CHECK_PLUGIN_INITIALIZED() \ diff --git a/editor/plugins/visual_shader_editor_plugin.cpp b/editor/plugins/visual_shader_editor_plugin.cpp index a51396d712..9990d5c06f 100644 --- a/editor/plugins/visual_shader_editor_plugin.cpp +++ b/editor/plugins/visual_shader_editor_plugin.cpp @@ -32,31 +32,31 @@ #include "core/config/project_settings.h" #include "core/core_string_names.h" -#include "core/input/input.h" #include "core/io/resource_loader.h" #include "core/math/math_defs.h" #include "core/os/keyboard.h" -#include "editor/editor_log.h" #include "editor/editor_node.h" #include "editor/editor_properties.h" #include "editor/editor_scale.h" +#include "editor/editor_settings.h" #include "editor/editor_undo_redo_manager.h" +#include "editor/inspector_dock.h" #include "editor/plugins/curve_editor_plugin.h" #include "editor/plugins/shader_editor_plugin.h" -#include "scene/animation/animation_player.h" #include "scene/gui/button.h" +#include "scene/gui/check_box.h" #include "scene/gui/code_edit.h" #include "scene/gui/graph_edit.h" #include "scene/gui/menu_button.h" -#include "scene/gui/panel.h" +#include "scene/gui/option_button.h" #include "scene/gui/popup.h" #include "scene/gui/rich_text_label.h" +#include "scene/gui/separator.h" #include "scene/gui/tree.h" #include "scene/gui/view_panner.h" #include "scene/main/window.h" #include "scene/resources/visual_shader_nodes.h" #include "scene/resources/visual_shader_particle_nodes.h" -#include "scene/resources/visual_shader_sdf_nodes.h" #include "servers/display_server.h" #include "servers/rendering/shader_types.h" @@ -5209,6 +5209,7 @@ VisualShaderEditor::VisualShaderEditor() { add_options.push_back(AddOption("NodePositionWorld", "Input/Vertex", "VisualShaderNodeInput", vformat(input_param_for_vertex_and_fragment_shader_modes, "node_position_world", "NODE_POSITION_WORLD"), { "node_position_world" }, VisualShaderNode::PORT_TYPE_VECTOR_3D, TYPE_FLAGS_VERTEX, Shader::MODE_SPATIAL)); add_options.push_back(AddOption("CameraPositionWorld", "Input/Vertex", "VisualShaderNodeInput", vformat(input_param_for_vertex_and_fragment_shader_modes, "camera_position_world", "CAMERA_POSITION_WORLD"), { "camera_position_world" }, VisualShaderNode::PORT_TYPE_VECTOR_3D, TYPE_FLAGS_VERTEX, Shader::MODE_SPATIAL)); add_options.push_back(AddOption("CameraDirectionWorld", "Input/Vertex", "VisualShaderNodeInput", vformat(input_param_for_vertex_and_fragment_shader_modes, "camera_direction_world", "CAMERA_DIRECTION_WORLD"), { "camera_direction_world" }, VisualShaderNode::PORT_TYPE_VECTOR_3D, TYPE_FLAGS_VERTEX, Shader::MODE_SPATIAL)); + add_options.push_back(AddOption("CameraVisibleLayers", "Input/Vertex", "VisualShaderNodeInput", vformat(input_param_for_vertex_and_fragment_shader_modes, "camera_visible_layers", "CAMERA_VISIBLE_LAYERS"), { "camera_visible_layers" }, VisualShaderNode::PORT_TYPE_SCALAR_INT, TYPE_FLAGS_VERTEX, Shader::MODE_SPATIAL)); add_options.push_back(AddOption("NodePositionView", "Input/Vertex", "VisualShaderNodeInput", vformat(input_param_for_vertex_and_fragment_shader_modes, "node_position_view", "NODE_POSITION_VIEW"), { "node_position_view" }, VisualShaderNode::PORT_TYPE_VECTOR_3D, TYPE_FLAGS_VERTEX, Shader::MODE_SPATIAL)); add_options.push_back(AddOption("Binormal", "Input/Fragment", "VisualShaderNodeInput", vformat(input_param_for_vertex_and_fragment_shader_modes, "binormal", "BINORMAL"), { "binormal" }, VisualShaderNode::PORT_TYPE_VECTOR_3D, TYPE_FLAGS_FRAGMENT, Shader::MODE_SPATIAL)); @@ -5228,6 +5229,7 @@ VisualShaderEditor::VisualShaderEditor() { add_options.push_back(AddOption("NodePositionWorld", "Input/Fragment", "VisualShaderNodeInput", vformat(input_param_for_vertex_and_fragment_shader_modes, "node_position_world", "NODE_POSITION_WORLD"), { "node_position_world" }, VisualShaderNode::PORT_TYPE_VECTOR_3D, TYPE_FLAGS_FRAGMENT, Shader::MODE_SPATIAL)); add_options.push_back(AddOption("CameraPositionWorld", "Input/Fragment", "VisualShaderNodeInput", vformat(input_param_for_vertex_and_fragment_shader_modes, "camera_position_world", "CAMERA_POSITION_WORLD"), { "camera_position_world" }, VisualShaderNode::PORT_TYPE_VECTOR_3D, TYPE_FLAGS_FRAGMENT, Shader::MODE_SPATIAL)); add_options.push_back(AddOption("CameraDirectionWorld", "Input/Fragment", "VisualShaderNodeInput", vformat(input_param_for_vertex_and_fragment_shader_modes, "camera_direction_world", "CAMERA_DIRECTION_WORLD"), { "camera_direction_world" }, VisualShaderNode::PORT_TYPE_VECTOR_3D, TYPE_FLAGS_FRAGMENT, Shader::MODE_SPATIAL)); + add_options.push_back(AddOption("CameraVisibleLayers", "Input/Fragment", "VisualShaderNodeInput", vformat(input_param_for_vertex_and_fragment_shader_modes, "camera_visible_layers", "CAMERA_VISIBLE_LAYERS"), { "camera_visible_layers" }, VisualShaderNode::PORT_TYPE_SCALAR_INT, TYPE_FLAGS_FRAGMENT, Shader::MODE_SPATIAL)); add_options.push_back(AddOption("NodePositionView", "Input/Fragment", "VisualShaderNodeInput", vformat(input_param_for_vertex_and_fragment_shader_modes, "node_position_view", "NODE_POSITION_VIEW"), { "node_position_view" }, VisualShaderNode::PORT_TYPE_VECTOR_3D, TYPE_FLAGS_FRAGMENT, Shader::MODE_SPATIAL)); add_options.push_back(AddOption("Albedo", "Input/Light", "VisualShaderNodeInput", vformat(input_param_for_light_shader_mode, "albedo", "ALBEDO"), { "albedo" }, VisualShaderNode::PORT_TYPE_VECTOR_3D, TYPE_FLAGS_LIGHT, Shader::MODE_SPATIAL)); diff --git a/editor/plugins/visual_shader_editor_plugin.h b/editor/plugins/visual_shader_editor_plugin.h index e9d6257f81..8afad9f668 100644 --- a/editor/plugins/visual_shader_editor_plugin.h +++ b/editor/plugins/visual_shader_editor_plugin.h @@ -34,11 +34,17 @@ #include "editor/editor_plugin.h" #include "editor/editor_properties.h" #include "editor/plugins/editor_resource_conversion_plugin.h" +#include "scene/resources/syntax_highlighter.h" #include "scene/resources/visual_shader.h" +class CodeEdit; class CurveEditor; class GraphEdit; class GraphNode; +class MenuButton; +class PopupPanel; +class RichTextLabel; +class Tree; class VisualShaderEditor; diff --git a/editor/project_manager.cpp b/editor/project_manager.cpp index 02d59921bf..249504b6e8 100644 --- a/editor/project_manager.cpp +++ b/editor/project_manager.cpp @@ -49,6 +49,7 @@ #include "editor/editor_vcs_interface.h" #include "main/main.h" #include "scene/gui/center_container.h" +#include "scene/gui/check_box.h" #include "scene/gui/line_edit.h" #include "scene/gui/margin_container.h" #include "scene/gui/panel_container.h" @@ -435,17 +436,17 @@ private: return; } - ProjectSettings *current = memnew(ProjectSettings); - - int err = current->setup(dir2, ""); + // Load project.godot as ConfigFile to set the new name. + ConfigFile cfg; + String project_godot = dir2.path_join("project.godot"); + Error err = cfg.load(project_godot); if (err != OK) { - set_message(vformat(TTR("Couldn't load project.godot in project path (error %d). It may be missing or corrupted."), err), MESSAGE_ERROR); + set_message(vformat(TTR("Couldn't load project at '%s' (error %d). It may be missing or corrupted."), project_godot, err), MESSAGE_ERROR); } else { - ProjectSettings::CustomMap edited_settings; - edited_settings["application/config/name"] = project_name->get_text().strip_edges(); - - if (current->save_custom(dir2.path_join("project.godot"), edited_settings, Vector<String>(), true) != OK) { - set_message(TTR("Couldn't edit project.godot in project path."), MESSAGE_ERROR); + cfg.set_value("application", "config/name", project_name->get_text().strip_edges()); + err = cfg.save(project_godot); + if (err != OK) { + set_message(vformat(TTR("Couldn't save project at '%s' (error %d)."), project_godot, err), MESSAGE_ERROR); } } @@ -693,18 +694,19 @@ public: default_files_container->hide(); get_ok_button()->set_disabled(false); - ProjectSettings *current = memnew(ProjectSettings); - - int err = current->setup(project_path->get_text(), ""); + // Fetch current name from project.godot to prefill the text input. + ConfigFile cfg; + String project_godot = project_path->get_text().path_join("project.godot"); + Error err = cfg.load(project_godot); if (err != OK) { - set_message(vformat(TTR("Couldn't load project.godot in project path (error %d). It may be missing or corrupted."), err), MESSAGE_ERROR); + set_message(vformat(TTR("Couldn't load project at '%s' (error %d). It may be missing or corrupted."), project_godot, err), MESSAGE_ERROR); status_rect->show(); msg->show(); get_ok_button()->set_disabled(true); - } else if (current->has_setting("application/config/name")) { - String proj = current->get("application/config/name"); - project_name->set_text(proj); - _text_changed(proj); + } else { + String cur_name = cfg.get_value("application", "config/name", ""); + project_name->set_text(cur_name); + _text_changed(cur_name); } project_name->call_deferred(SNAME("grab_focus")); @@ -1251,7 +1253,6 @@ void ProjectList::migrate_config() { if (FileAccess::exists(_config_path)) { return; } - print_line("Migrating legacy project list"); List<PropertyInfo> properties; EditorSettings::get_singleton()->get_property_list(&properties); @@ -1264,6 +1265,8 @@ void ProjectList::migrate_config() { } String path = EDITOR_GET(property_key); + print_line("Migrating legacy project '" + path + "'."); + String favoriteKey = "favorite_projects/" + property_key.get_slice("/", 1); bool favorite = EditorSettings::get_singleton()->has_setting(favoriteKey); add_project(path, favorite); diff --git a/editor/project_manager.h b/editor/project_manager.h index 7c05429dde..de4db2944f 100644 --- a/editor/project_manager.h +++ b/editor/project_manager.h @@ -38,6 +38,7 @@ #include "scene/gui/scroll_container.h" #include "scene/gui/tree.h" +class CheckBox; class ProjectDialog; class ProjectList; diff --git a/editor/register_editor_types.cpp b/editor/register_editor_types.cpp index d3097a694e..f301ff5c6b 100644 --- a/editor/register_editor_types.cpp +++ b/editor/register_editor_types.cpp @@ -30,8 +30,6 @@ #include "register_editor_types.h" -#include "core/extension/native_extension_manager.h" - #include "editor/animation_track_editor.h" #include "editor/debugger/debug_adapter/debug_adapter_server.h" #include "editor/editor_command_palette.h" @@ -43,6 +41,7 @@ #include "editor/editor_resource_picker.h" #include "editor/editor_resource_preview.h" #include "editor/editor_run_script.h" +#include "editor/editor_settings.h" #include "editor/editor_translation_parser.h" #include "editor/editor_undo_redo_manager.h" #include "editor/filesystem_dock.h" diff --git a/editor/rename_dialog.cpp b/editor/rename_dialog.cpp index 74c123d942..40683e2938 100644 --- a/editor/rename_dialog.cpp +++ b/editor/rename_dialog.cpp @@ -42,6 +42,7 @@ #include "modules/regex/regex.h" #include "plugins/script_editor_plugin.h" #include "scene/gui/control.h" +#include "scene/gui/grid_container.h" #include "scene/gui/label.h" #include "scene/gui/separator.h" #include "scene/gui/tab_container.h" diff --git a/editor/reparent_dialog.cpp b/editor/reparent_dialog.cpp index 75098b25b1..37712d4197 100644 --- a/editor/reparent_dialog.cpp +++ b/editor/reparent_dialog.cpp @@ -33,6 +33,7 @@ #include "core/string/print_string.h" #include "scene/gui/box_container.h" #include "scene/gui/label.h" +#include "scene/gui/tree.h" void ReparentDialog::_notification(int p_what) { switch (p_what) { diff --git a/editor/scene_tree_dock.cpp b/editor/scene_tree_dock.cpp index 9c3ef4cecc..96688a3614 100644 --- a/editor/scene_tree_dock.cpp +++ b/editor/scene_tree_dock.cpp @@ -41,14 +41,17 @@ #include "editor/editor_file_dialog.h" #include "editor/editor_node.h" #include "editor/editor_paths.h" +#include "editor/editor_quick_open.h" #include "editor/editor_scale.h" #include "editor/editor_settings.h" #include "editor/editor_undo_redo_manager.h" +#include "editor/inspector_dock.h" #include "editor/multi_node_edit.h" #include "editor/plugins/animation_player_editor_plugin.h" #include "editor/plugins/canvas_item_editor_plugin.h" #include "editor/plugins/node_3d_editor_plugin.h" #include "editor/plugins/script_editor_plugin.h" +#include "editor/reparent_dialog.h" #include "editor/shader_create_dialog.h" #include "scene/main/window.h" #include "scene/property_utils.h" @@ -1153,11 +1156,13 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) { if (TOOL_CREATE_FAVORITE == p_tool) { String name = selected_favorite_root.get_slicec(' ', 0); if (ScriptServer::is_global_class(name)) { - new_node = Object::cast_to<Node>(ClassDB::instantiate(ScriptServer::get_global_class_native_base(name))); Ref<Script> scr = ResourceLoader::load(ScriptServer::get_global_class_path(name), "Script"); - if (new_node && scr.is_valid()) { - new_node->set_script(scr); - new_node->set_name(name); + if (scr.is_valid()) { + new_node = Object::cast_to<Node>(ClassDB::instantiate(scr->get_instance_base_type())); + if (new_node) { + new_node->set_script(scr); + new_node->set_name(name); + } } } else { new_node = Object::cast_to<Node>(ClassDB::instantiate(selected_favorite_root)); @@ -2448,9 +2453,12 @@ void SceneTreeDock::_new_scene_from(String p_file) { Node *copy = base->duplicate_from_editor(duplimap); if (copy) { + // Handle Unique Nodes. for (int i = 0; i < copy->get_child_count(false); i++) { _set_node_owner_recursive(copy->get_child(i, false), copy); } + // Root node cannot ever be unique name in its own Scene! + copy->set_unique_name_in_owner(false); Ref<PackedScene> sdata = memnew(PackedScene); Error err = sdata->pack(copy); diff --git a/editor/scene_tree_dock.h b/editor/scene_tree_dock.h index 6ec9d31ca8..ac368e1aab 100644 --- a/editor/scene_tree_dock.h +++ b/editor/scene_tree_dock.h @@ -31,21 +31,17 @@ #ifndef SCENE_TREE_DOCK_H #define SCENE_TREE_DOCK_H -#include "editor/create_dialog.h" +#include "scene_tree_editor.h" + #include "editor/editor_data.h" -#include "editor/editor_quick_open.h" -#include "editor/groups_editor.h" -#include "editor/reparent_dialog.h" #include "editor/script_create_dialog.h" -#include "scene/animation/animation_player.h" #include "scene/gui/box_container.h" -#include "scene/gui/button.h" -#include "scene/gui/control.h" -#include "scene/gui/label.h" -#include "scene/gui/popup_menu.h" -#include "scene/gui/tree.h" -#include "scene_tree_editor.h" +#include "scene/resources/animation.h" +class EditorQuickOpen; +class MenuButton; +class ReparentDialog; +class ShaderCreateDialog; class TextureRect; #include "modules/modules_enabled.gen.h" // For regex. @@ -53,8 +49,6 @@ class TextureRect; class RenameDialog; #endif // MODULE_REGEX_ENABLED -class ShaderCreateDialog; - class SceneTreeDock : public VBoxContainer { GDCLASS(SceneTreeDock, VBoxContainer); diff --git a/editor/scene_tree_editor.cpp b/editor/scene_tree_editor.cpp index 46d3502a24..092ef30678 100644 --- a/editor/scene_tree_editor.cpp +++ b/editor/scene_tree_editor.cpp @@ -32,10 +32,10 @@ #include "core/config/project_settings.h" #include "core/object/message_queue.h" -#include "core/string/print_string.h" #include "editor/editor_file_system.h" #include "editor/editor_node.h" #include "editor/editor_scale.h" +#include "editor/editor_settings.h" #include "editor/editor_undo_redo_manager.h" #include "editor/node_dock.h" #include "editor/plugins/animation_player_editor_plugin.h" diff --git a/editor/scene_tree_editor.h b/editor/scene_tree_editor.h index 33ef5dbcb3..c1afcf0f45 100644 --- a/editor/scene_tree_editor.h +++ b/editor/scene_tree_editor.h @@ -32,8 +32,6 @@ #define SCENE_TREE_EDITOR_H #include "editor/editor_data.h" -#include "editor/editor_settings.h" -#include "scene/gui/button.h" #include "scene/gui/dialogs.h" #include "scene/gui/tree.h" diff --git a/editor/script_create_dialog.cpp b/editor/script_create_dialog.cpp index 4a3b0e979f..52f4ae553f 100644 --- a/editor/script_create_dialog.cpp +++ b/editor/script_create_dialog.cpp @@ -107,7 +107,15 @@ static Vector<String> _get_hierarchy(String p_class_name) { void ScriptCreateDialog::_notification(int p_what) { switch (p_what) { - case NOTIFICATION_ENTER_TREE: { + case NOTIFICATION_ENTER_TREE: + case NOTIFICATION_THEME_CHANGED: { + for (int i = 0; i < ScriptServer::get_language_count(); i++) { + Ref<Texture2D> language_icon = get_theme_icon(ScriptServer::get_language(i)->get_type(), SNAME("EditorIcons")); + if (language_icon.is_valid()) { + language_menu->set_item_icon(i, language_icon); + } + } + String last_language = EditorSettings::get_singleton()->get_project_metadata("script_setup", "last_selected_language", ""); if (!last_language.is_empty()) { for (int i = 0; i < language_menu->get_item_count(); i++) { @@ -120,15 +128,9 @@ void ScriptCreateDialog::_notification(int p_what) { } else { language_menu->select(default_language); } - - [[fallthrough]]; - } - case NOTIFICATION_THEME_CHANGED: { - for (int i = 0; i < ScriptServer::get_language_count(); i++) { - Ref<Texture2D> language_icon = get_theme_icon(ScriptServer::get_language(i)->get_type(), SNAME("EditorIcons")); - if (language_icon.is_valid()) { - language_menu->set_item_icon(i, language_icon); - } + if (EditorSettings::get_singleton()->has_meta("script_setup_use_script_templates")) { + is_using_templates = bool(EditorSettings::get_singleton()->get_meta("script_setup_use_script_templates")); + use_templates->set_pressed(is_using_templates); } path_button->set_icon(get_theme_icon(SNAME("Folder"), SNAME("EditorIcons"))); @@ -331,7 +333,12 @@ void ScriptCreateDialog::_template_changed(int p_template) { EditorSettings::get_singleton()->set_project_metadata("script_setup", "templates_dictionary", dic_templates_project); } else { // Save template info to editor dictionary (not a project template). - templates_dictionary[parent_name->get_text()] = sinfo.get_hash(); + Dictionary dic_templates; + if (EditorSettings::get_singleton()->has_meta("script_setup_templates_dictionary")) { + dic_templates = (Dictionary)EditorSettings::get_singleton()->get_meta("script_setup_templates_dictionary"); + } + dic_templates[parent_name->get_text()] = sinfo.get_hash(); + EditorSettings::get_singleton()->set_meta("script_setup_templates_dictionary", dic_templates); // Remove template from project dictionary as we last used an editor level template. Dictionary dic_templates_project = EditorSettings::get_singleton()->get_project_metadata("script_setup", "templates_dictionary", Dictionary()); if (dic_templates_project.has(parent_name->get_text())) { @@ -480,6 +487,7 @@ void ScriptCreateDialog::_built_in_pressed() { void ScriptCreateDialog::_use_template_pressed() { is_using_templates = use_templates->is_pressed(); + EditorSettings::get_singleton()->set_meta("script_setup_use_script_templates", is_using_templates); _update_dialog(); } @@ -597,6 +605,10 @@ void ScriptCreateDialog::_update_template_menu() { if (is_language_using_templates) { // Get the latest templates used for each type of node from project settings then global settings. Dictionary last_local_templates = EditorSettings::get_singleton()->get_project_metadata("script_setup", "templates_dictionary", Dictionary()); + Dictionary last_global_templates; + if (EditorSettings::get_singleton()->has_meta("script_setup_templates_dictionary")) { + last_global_templates = (Dictionary)EditorSettings::get_singleton()->get_meta("script_setup_templates_dictionary"); + } String inherits_base_type = parent_name->get_text(); // If it inherits from a script, get its parent class first. @@ -651,7 +663,7 @@ void ScriptCreateDialog::_update_template_menu() { // Check for last used template for this node in project settings then in global settings. if (last_local_templates.has(parent_name->get_text()) && t.get_hash() == String(last_local_templates[parent_name->get_text()])) { last_used_template = id; - } else if (last_used_template == -1 && templates_dictionary.has(parent_name->get_text()) && t.get_hash() == String(templates_dictionary[parent_name->get_text()])) { + } else if (last_used_template == -1 && last_global_templates.has(parent_name->get_text()) && t.get_hash() == String(last_global_templates[parent_name->get_text()])) { last_used_template = id; } t.id = id; diff --git a/editor/script_create_dialog.h b/editor/script_create_dialog.h index fb1a49a1ca..25428508da 100644 --- a/editor/script_create_dialog.h +++ b/editor/script_create_dialog.h @@ -83,7 +83,6 @@ class ScriptCreateDialog : public ConfirmationDialog { int current_language; int default_language; bool re_check_path = false; - Dictionary templates_dictionary; Control *path_controls[2]; Control *name_controls[2]; diff --git a/editor/shader_globals_editor.cpp b/editor/shader_globals_editor.cpp index 22a1d49422..b778262fed 100644 --- a/editor/shader_globals_editor.cpp +++ b/editor/shader_globals_editor.cpp @@ -69,28 +69,12 @@ static const char *global_var_type_names[RS::GLOBAL_VAR_TYPE_MAX] = { class ShaderGlobalsEditorInterface : public Object { GDCLASS(ShaderGlobalsEditorInterface, Object) - void _var_changed() { - emit_signal(SNAME("var_changed")); - } - -protected: - static void _bind_methods() { - ClassDB::bind_method("_var_changed", &ShaderGlobalsEditorInterface::_var_changed); - ADD_SIGNAL(MethodInfo("var_changed")); - } - - bool _set(const StringName &p_name, const Variant &p_value) { - Variant existing = RS::get_singleton()->global_shader_parameter_get(p_name); - - if (existing.get_type() == Variant::NIL) { - return false; - } - + void _set_var(const StringName &p_name, const Variant &p_value, const Variant &p_prev_value) { Ref<EditorUndoRedoManager> &undo_redo = EditorNode::get_undo_redo(); undo_redo->create_action(TTR("Set Shader Global Variable")); undo_redo->add_do_method(RS::get_singleton(), "global_shader_parameter_set", p_name, p_value); - undo_redo->add_undo_method(RS::get_singleton(), "global_shader_parameter_set", p_name, existing); + undo_redo->add_undo_method(RS::get_singleton(), "global_shader_parameter_set", p_name, p_prev_value); RS::GlobalShaderParameterType type = RS::get_singleton()->global_shader_parameter_get_type(p_name); Dictionary gv; gv["type"] = global_var_type_names[type]; @@ -111,8 +95,29 @@ protected: undo_redo->add_do_method(this, "_var_changed"); undo_redo->add_undo_method(this, "_var_changed"); block_update = true; - undo_redo->commit_action(false); + undo_redo->commit_action(); block_update = false; + } + + void _var_changed() { + emit_signal(SNAME("var_changed")); + } + +protected: + static void _bind_methods() { + ClassDB::bind_method("_set_var", &ShaderGlobalsEditorInterface::_set_var); + ClassDB::bind_method("_var_changed", &ShaderGlobalsEditorInterface::_var_changed); + ADD_SIGNAL(MethodInfo("var_changed")); + } + + bool _set(const StringName &p_name, const Variant &p_value) { + Variant existing = RS::get_singleton()->global_shader_parameter_get(p_name); + + if (existing.get_type() == Variant::NIL) { + return false; + } + + call_deferred("_set_var", p_name, p_value, existing); return true; } diff --git a/main/main.cpp b/main/main.cpp index 460c73ceee..c2e2238482 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -311,29 +311,29 @@ void Main::print_help(const char *p_binary) { OS::get_singleton()->print("\n"); OS::get_singleton()->print("General options:\n"); - OS::get_singleton()->print(" -h, --help Display this help message.\n"); - OS::get_singleton()->print(" --version Display the version string.\n"); - OS::get_singleton()->print(" -v, --verbose Use verbose stdout mode.\n"); - OS::get_singleton()->print(" -q, --quiet Quiet mode, silences stdout messages. Errors are still displayed.\n"); + OS::get_singleton()->print(" -h, --help Display this help message.\n"); + OS::get_singleton()->print(" --version Display the version string.\n"); + OS::get_singleton()->print(" -v, --verbose Use verbose stdout mode.\n"); + OS::get_singleton()->print(" -q, --quiet Quiet mode, silences stdout messages. Errors are still displayed.\n"); OS::get_singleton()->print("\n"); OS::get_singleton()->print("Run options:\n"); - OS::get_singleton()->print(" -- Separator for user-provided arguments. Following arguments are not used by the engine, but can be read from `OS.get_cmdline_user_args()`.\n"); + OS::get_singleton()->print(" --, ++ Separator for user-provided arguments. Following arguments are not used by the engine, but can be read from `OS.get_cmdline_user_args()`.\n"); #ifdef TOOLS_ENABLED - OS::get_singleton()->print(" -e, --editor Start the editor instead of running the scene.\n"); - OS::get_singleton()->print(" -p, --project-manager Start the project manager, even if a project is auto-detected.\n"); - OS::get_singleton()->print(" --debug-server <uri> Start the editor debug server (<protocol>://<host/IP>[:<port>], e.g. tcp://127.0.0.1:6007)\n"); + OS::get_singleton()->print(" -e, --editor Start the editor instead of running the scene.\n"); + OS::get_singleton()->print(" -p, --project-manager Start the project manager, even if a project is auto-detected.\n"); + OS::get_singleton()->print(" --debug-server <uri> Start the editor debug server (<protocol>://<host/IP>[:<port>], e.g. tcp://127.0.0.1:6007)\n"); #endif - OS::get_singleton()->print(" --quit Quit after the first iteration.\n"); - OS::get_singleton()->print(" -l, --language <locale> Use a specific locale (<locale> being a two-letter code).\n"); - OS::get_singleton()->print(" --path <directory> Path to a project (<directory> must contain a 'project.godot' file).\n"); - OS::get_singleton()->print(" -u, --upwards Scan folders upwards for project.godot file.\n"); - OS::get_singleton()->print(" --main-pack <file> Path to a pack (.pck) file to load.\n"); - OS::get_singleton()->print(" --render-thread <mode> Render thread mode ('unsafe', 'safe', 'separate').\n"); - OS::get_singleton()->print(" --remote-fs <address> Remote filesystem (<host/IP>[:<port>] address).\n"); - OS::get_singleton()->print(" --remote-fs-password <password> Password for remote filesystem.\n"); - - OS::get_singleton()->print(" --audio-driver <driver> Audio driver ["); + OS::get_singleton()->print(" --quit Quit after the first iteration.\n"); + OS::get_singleton()->print(" -l, --language <locale> Use a specific locale (<locale> being a two-letter code).\n"); + OS::get_singleton()->print(" --path <directory> Path to a project (<directory> must contain a 'project.godot' file).\n"); + OS::get_singleton()->print(" -u, --upwards Scan folders upwards for project.godot file.\n"); + OS::get_singleton()->print(" --main-pack <file> Path to a pack (.pck) file to load.\n"); + OS::get_singleton()->print(" --render-thread <mode> Render thread mode ['unsafe', 'safe', 'separate'].\n"); + OS::get_singleton()->print(" --remote-fs <address> Remote filesystem (<host/IP>[:<port>] address).\n"); + OS::get_singleton()->print(" --remote-fs-password <password> Password for remote filesystem.\n"); + + OS::get_singleton()->print(" --audio-driver <driver> Audio driver ["); for (int i = 0; i < AudioDriverManager::get_driver_count(); i++) { if (i > 0) { OS::get_singleton()->print(", "); @@ -342,7 +342,7 @@ void Main::print_help(const char *p_binary) { } OS::get_singleton()->print("].\n"); - OS::get_singleton()->print(" --display-driver <driver> Display driver (and rendering driver) ["); + OS::get_singleton()->print(" --display-driver <driver> Display driver (and rendering driver) ["); for (int i = 0; i < DisplayServer::get_create_function_count(); i++) { if (i > 0) { OS::get_singleton()->print(", "); @@ -359,72 +359,76 @@ void Main::print_help(const char *p_binary) { } OS::get_singleton()->print("].\n"); - OS::get_singleton()->print(" --rendering-method <renderer> Renderer name. Requires driver support.\n"); - OS::get_singleton()->print(" --rendering-driver <driver> Rendering driver (depends on display driver).\n"); - OS::get_singleton()->print(" --gpu-index <device_index> Use a specific GPU (run with --verbose to get available device list).\n"); - OS::get_singleton()->print(" --text-driver <driver> Text driver (Fonts, BiDi, shaping)\n"); - OS::get_singleton()->print(" --tablet-driver <driver> Pen tablet input driver.\n"); - OS::get_singleton()->print(" --headless Enable headless mode (--display-driver headless --audio-driver Dummy). Useful for servers and with --script.\n"); - OS::get_singleton()->print(" --write-movie <file> Run the engine in a way that a movie is written (by default .avi MJPEG). Fixed FPS is forced when enabled, but can be used to change movie FPS. Disabling vsync can speed up movie writing but makes interaction more difficult.\n"); - OS::get_singleton()->print(" --disable-vsync Force disabling of vsync. Run the engine in a way that a movie is written (by default .avi MJPEG). Fixed FPS is forced when enabled, but can be used to change movie FPS.\n"); + OS::get_singleton()->print(" --rendering-method <renderer> Renderer name. Requires driver support.\n"); + OS::get_singleton()->print(" --rendering-driver <driver> Rendering driver (depends on display driver).\n"); + OS::get_singleton()->print(" --gpu-index <device_index> Use a specific GPU (run with --verbose to get available device list).\n"); + OS::get_singleton()->print(" --text-driver <driver> Text driver (Fonts, BiDi, shaping).\n"); + OS::get_singleton()->print(" --tablet-driver <driver> Pen tablet input driver.\n"); + OS::get_singleton()->print(" --headless Enable headless mode (--display-driver headless --audio-driver Dummy). Useful for servers and with --script.\n"); + OS::get_singleton()->print(" --write-movie <file> Writes a video to the specified path (usually with .avi or .png extension).\n"); + OS::get_singleton()->print(" --fixed-fps is forced when enabled, but it can be used to change movie FPS.\n"); + OS::get_singleton()->print(" --disable-vsync can speed up movie writing but makes interaction more difficult.\n"); OS::get_singleton()->print("\n"); OS::get_singleton()->print("Display options:\n"); - OS::get_singleton()->print(" -f, --fullscreen Request fullscreen mode.\n"); - OS::get_singleton()->print(" -m, --maximized Request a maximized window.\n"); - OS::get_singleton()->print(" -w, --windowed Request windowed mode.\n"); - OS::get_singleton()->print(" -t, --always-on-top Request an always-on-top window.\n"); - OS::get_singleton()->print(" --resolution <W>x<H> Request window resolution.\n"); - OS::get_singleton()->print(" --position <X>,<Y> Request window position.\n"); - OS::get_singleton()->print(" --single-window Use a single window (no separate subwindows).\n"); - OS::get_singleton()->print(" --xr-mode <mode> Select XR mode (default/off/on).\n"); + OS::get_singleton()->print(" -f, --fullscreen Request fullscreen mode.\n"); + OS::get_singleton()->print(" -m, --maximized Request a maximized window.\n"); + OS::get_singleton()->print(" -w, --windowed Request windowed mode.\n"); + OS::get_singleton()->print(" -t, --always-on-top Request an always-on-top window.\n"); + OS::get_singleton()->print(" --resolution <W>x<H> Request window resolution.\n"); + OS::get_singleton()->print(" --position <X>,<Y> Request window position.\n"); + OS::get_singleton()->print(" --single-window Use a single window (no separate subwindows).\n"); + OS::get_singleton()->print(" --xr-mode <mode> Select XR (Extended Reality) mode ['default', 'off', 'on'].\n"); OS::get_singleton()->print("\n"); OS::get_singleton()->print("Debug options:\n"); - OS::get_singleton()->print(" -d, --debug Debug (local stdout debugger).\n"); - OS::get_singleton()->print(" -b, --breakpoints Breakpoint list as source::line comma-separated pairs, no spaces (use %%20 instead).\n"); - OS::get_singleton()->print(" --profiling Enable profiling in the script debugger.\n"); - OS::get_singleton()->print(" --gpu-profile Show a GPU profile of the tasks that took the most time during frame rendering.\n"); - OS::get_singleton()->print(" --gpu-validation Enable graphics API validation layers for debugging.\n"); + OS::get_singleton()->print(" -d, --debug Debug (local stdout debugger).\n"); + OS::get_singleton()->print(" -b, --breakpoints Breakpoint list as source::line comma-separated pairs, no spaces (use %%20 instead).\n"); + OS::get_singleton()->print(" --profiling Enable profiling in the script debugger.\n"); + OS::get_singleton()->print(" --gpu-profile Show a GPU profile of the tasks that took the most time during frame rendering.\n"); + OS::get_singleton()->print(" --gpu-validation Enable graphics API validation layers for debugging.\n"); #if DEBUG_ENABLED - OS::get_singleton()->print(" --gpu-abort Abort on graphics API usage errors (usually validation layer errors). May help see the problem if your system freezes.\n"); + OS::get_singleton()->print(" --gpu-abort Abort on graphics API usage errors (usually validation layer errors). May help see the problem if your system freezes.\n"); #endif - OS::get_singleton()->print(" --remote-debug <uri> Remote debug (<protocol>://<host/IP>[:<port>], e.g. tcp://127.0.0.1:6007).\n"); + OS::get_singleton()->print(" --remote-debug <uri> Remote debug (<protocol>://<host/IP>[:<port>], e.g. tcp://127.0.0.1:6007).\n"); #if defined(DEBUG_ENABLED) - OS::get_singleton()->print(" --debug-collisions Show collision shapes when running the scene.\n"); - OS::get_singleton()->print(" --debug-paths Show path lines when running the scene.\n"); - OS::get_singleton()->print(" --debug-navigation Show navigation polygons when running the scene.\n"); - OS::get_singleton()->print(" --debug-stringnames Print all StringName allocations to stdout when the engine quits.\n"); + OS::get_singleton()->print(" --debug-collisions Show collision shapes when running the scene.\n"); + OS::get_singleton()->print(" --debug-paths Show path lines when running the scene.\n"); + OS::get_singleton()->print(" --debug-navigation Show navigation polygons when running the scene.\n"); + OS::get_singleton()->print(" --debug-stringnames Print all StringName allocations to stdout when the engine quits.\n"); #endif - OS::get_singleton()->print(" --frame-delay <ms> Simulate high CPU load (delay each frame by <ms> milliseconds).\n"); - OS::get_singleton()->print(" --time-scale <scale> Force time scale (higher values are faster, 1.0 is normal speed).\n"); - OS::get_singleton()->print(" --disable-render-loop Disable render loop so rendering only occurs when called explicitly from script.\n"); - OS::get_singleton()->print(" --disable-crash-handler Disable crash handler when supported by the platform code.\n"); - OS::get_singleton()->print(" --fixed-fps <fps> Force a fixed number of frames per second. This setting disables real-time synchronization.\n"); - OS::get_singleton()->print(" --print-fps Print the frames per second to the stdout.\n"); + OS::get_singleton()->print(" --frame-delay <ms> Simulate high CPU load (delay each frame by <ms> milliseconds).\n"); + OS::get_singleton()->print(" --time-scale <scale> Force time scale (higher values are faster, 1.0 is normal speed).\n"); + OS::get_singleton()->print(" --disable-vsync Forces disabling of vertical synchronization, even if enabled in the project settings. Does not override driver-level V-Sync enforcement.\n"); + OS::get_singleton()->print(" --disable-render-loop Disable render loop so rendering only occurs when called explicitly from script.\n"); + OS::get_singleton()->print(" --disable-crash-handler Disable crash handler when supported by the platform code.\n"); + OS::get_singleton()->print(" --fixed-fps <fps> Force a fixed number of frames per second. This setting disables real-time synchronization.\n"); + OS::get_singleton()->print(" --print-fps Print the frames per second to the stdout.\n"); OS::get_singleton()->print("\n"); OS::get_singleton()->print("Standalone tools:\n"); - OS::get_singleton()->print(" -s, --script <script> Run a script.\n"); - OS::get_singleton()->print(" --check-only Only parse for errors and quit (use with --script).\n"); + OS::get_singleton()->print(" -s, --script <script> Run a script.\n"); + OS::get_singleton()->print(" --check-only Only parse for errors and quit (use with --script).\n"); #ifdef TOOLS_ENABLED - OS::get_singleton()->print(" --export-release <preset> <path> Export the project in release mode using the given preset and output path. The preset name should match one defined in export_presets.cfg.\n"); - OS::get_singleton()->print(" <path> should be absolute or relative to the project directory, and include the filename for the binary (e.g. 'builds/game.exe').\n"); - OS::get_singleton()->print(" The target directory must exist.\n"); - OS::get_singleton()->print(" --export-debug <preset> <path> Export the project in debug mode using the given preset and output path. The preset name should match one defined in export_presets.cfg.\n"); - OS::get_singleton()->print(" --export-pack <preset> <path> Export the project data only using the given preset and output path. The <path> extension determines whether it will be in PCK or ZIP format.\n"); - OS::get_singleton()->print(" --convert-3to4 [<max_file_kb>] [<max_line_size>] Converts project from Godot 3.x to Godot 4.x.\n"); - OS::get_singleton()->print(" --validate-conversion-3to4 [<max_file_kb>] [<max_line_size>] Shows what elements will be renamed when converting project from Godot 3.x to Godot 4.x.\n"); - OS::get_singleton()->print(" --doctool [<path>] Dump the engine API reference to the given <path> (defaults to current dir) in XML format, merging if existing files are found.\n"); - OS::get_singleton()->print(" --no-docbase Disallow dumping the base types (used with --doctool).\n"); - OS::get_singleton()->print(" --build-solutions Build the scripting solutions (e.g. for C# projects). Implies --editor and requires a valid project to edit.\n"); - OS::get_singleton()->print(" --dump-gdextension-interface Generate GDExtension header file 'gdnative_interface.h' in the current folder. This file is the base file required to implement a GDExtension.\n"); - OS::get_singleton()->print(" --dump-extension-api Generate JSON dump of the Godot API for GDExtension bindings named 'extension_api.json' in the current folder.\n"); - OS::get_singleton()->print(" --startup-benchmark Benchmark the startup time and print it to console.\n"); - OS::get_singleton()->print(" --startup-benchmark-file <path> Benchmark the startup time and save it to a given file in JSON format.\n"); + OS::get_singleton()->print(" --export-release <preset> <path> Export the project in release mode using the given preset and output path. The preset name should match one defined in export_presets.cfg.\n"); + OS::get_singleton()->print(" <path> should be absolute or relative to the project directory, and include the filename for the binary (e.g. 'builds/game.exe').\n"); + OS::get_singleton()->print(" The target directory must exist.\n"); + OS::get_singleton()->print(" --export-debug <preset> <path> Export the project in debug mode using the given preset and output path. See --export-release description for other considerations.\n"); + OS::get_singleton()->print(" --export-pack <preset> <path> Export the project data only using the given preset and output path. The <path> extension determines whether it will be in PCK or ZIP format.\n"); + OS::get_singleton()->print(" --convert-3to4 [<max_file_kb>] [<max_line_size>]\n"); + OS::get_singleton()->print(" Converts project from Godot 3.x to Godot 4.x.\n"); + OS::get_singleton()->print(" --validate-conversion-3to4 [<max_file_kb>] [<max_line_size>]\n"); + OS::get_singleton()->print(" Shows what elements will be renamed when converting project from Godot 3.x to Godot 4.x.\n"); + OS::get_singleton()->print(" --doctool [<path>] Dump the engine API reference to the given <path> (defaults to current dir) in XML format, merging if existing files are found.\n"); + OS::get_singleton()->print(" --no-docbase Disallow dumping the base types (used with --doctool).\n"); + OS::get_singleton()->print(" --build-solutions Build the scripting solutions (e.g. for C# projects). Implies --editor and requires a valid project to edit.\n"); + OS::get_singleton()->print(" --dump-gdextension-interface Generate GDExtension header file 'gdnative_interface.h' in the current folder. This file is the base file required to implement a GDExtension.\n"); + OS::get_singleton()->print(" --dump-extension-api Generate JSON dump of the Godot API for GDExtension bindings named 'extension_api.json' in the current folder.\n"); + OS::get_singleton()->print(" --startup-benchmark Benchmark the startup time and print it to console.\n"); + OS::get_singleton()->print(" --startup-benchmark-file <path> Benchmark the startup time and save it to a given file in JSON format.\n"); #ifdef TESTS_ENABLED - OS::get_singleton()->print(" --test [--help] Run unit tests. Use --test --help for more information.\n"); + OS::get_singleton()->print(" --test [--help] Run unit tests. Use --test --help for more information.\n"); #endif #endif OS::get_singleton()->print("\n"); @@ -533,6 +537,10 @@ Error Main::test_setup() { void Main::test_cleanup() { ERR_FAIL_COND(!_start_success); + for (int i = 0; i < TextServerManager::get_singleton()->get_interface_count(); i++) { + TextServerManager::get_singleton()->get_interface(i)->cleanup(); + } + EngineDebugger::deinitialize(); ResourceLoader::remove_custom_loaders(); @@ -1288,7 +1296,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph goto error; } - } else if (I->get() == "--") { + } else if (I->get() == "--" || I->get() == "++") { adding_user_args = true; } else { main_args.push_back(I->get()); @@ -1540,6 +1548,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph if (rendering_driver.is_empty() && rendering_method.is_empty() && project_manager) { rendering_driver = "opengl3"; rendering_method = "gl_compatibility"; + default_renderer_mobile = "gl_compatibility"; } #endif if (renderer_hints.is_empty()) { @@ -2660,7 +2669,11 @@ bool Main::start() { if (!editor && !ClassDB::class_exists(main_loop_type) && ScriptServer::is_global_class(main_loop_type)) { String script_path = ScriptServer::get_global_class_path(main_loop_type); Ref<Script> script_res = ResourceLoader::load(script_path); - StringName script_base = ScriptServer::get_global_class_native_base(main_loop_type); + if (script_res.is_null()) { + OS::get_singleton()->alert("Error: Could not load MainLoop script type: " + main_loop_type); + ERR_FAIL_V_MSG(false, vformat("Could not load global class %s.", main_loop_type)); + } + StringName script_base = script_res->get_instance_base_type(); Object *obj = ClassDB::instantiate(script_base); MainLoop *script_loop = Object::cast_to<MainLoop>(obj); if (!script_loop) { @@ -3295,6 +3308,10 @@ void Main::cleanup(bool p_force) { ERR_FAIL_COND(!_start_success); } + for (int i = 0; i < TextServerManager::get_singleton()->get_interface_count(); i++) { + TextServerManager::get_singleton()->get_interface(i)->cleanup(); + } + if (movie_writer) { movie_writer->end(); } diff --git a/misc/dist/html/full-size.html b/misc/dist/html/full-size.html index 6ae3e5cc73..6710cb1533 100644 --- a/misc/dist/html/full-size.html +++ b/misc/dist/html/full-size.html @@ -215,7 +215,7 @@ const engine = new Engine(GODOT_CONFIG); const missing = Engine.getMissingFeatures(); if (missing.length !== 0) { - const missingMsg = 'Warning!\nThe following features required to run Godot projects on the Web are missing:\n'; + const missingMsg = 'Error\nThe following features required to run Godot projects on the Web are missing:\n'; displayFailureNotice(missingMsg + missing.join('\n')); } else { setStatusMode('indeterminate'); diff --git a/misc/dist/icon_console.svg b/misc/dist/icon_console.svg new file mode 100644 index 0000000000..d486482f3b --- /dev/null +++ b/misc/dist/icon_console.svg @@ -0,0 +1,120 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<svg + width="1024" + height="1024" + id="svg3030" + version="1.1" + inkscape:version="1.2.1 (9c6d41e410, 2022-07-14)" + sodipodi:docname="icon_console.svg" + inkscape:export-filename="/home/akien/Projects/godot/godot.git/icon.png" + inkscape:export-xdpi="24" + inkscape:export-ydpi="24" + xml:space="preserve" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns="http://www.w3.org/2000/svg" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:dc="http://purl.org/dc/elements/1.1/"><defs + id="defs3032" /><sodipodi:namedview + id="base" + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1.0" + inkscape:pageopacity="0.0" + inkscape:pageshadow="2" + inkscape:zoom="0.28259086" + inkscape:cx="955.44491" + inkscape:cy="1380.0871" + inkscape:document-units="px" + inkscape:current-layer="layer1" + showgrid="false" + inkscape:window-width="3840" + inkscape:window-height="2054" + inkscape:window-x="-11" + inkscape:window-y="594" + inkscape:window-maximized="1" + inkscape:document-rotation="0" + inkscape:showpageshadow="0" + inkscape:pagecheckerboard="0" + inkscape:deskcolor="#d1d1d1" /><metadata + id="metadata3035"><rdf:RDF><cc:Work + rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /></cc:Work></rdf:RDF></metadata><g + inkscape:label="Layer 1" + inkscape:groupmode="layer" + id="layer1" + transform="translate(0,-98.519719)"><g + inkscape:label="Layer 1" + id="layer1-6" + transform="translate(1.7750003e-7,-2.4372979)"><g + id="g78-0" + transform="matrix(4.162611,0,0,-4.162611,919.24059,771.67186)" + style="stroke-width:0.320312"><path + d="m 0,0 c 0,0 -0.325,1.994 -0.515,1.976 l -36.182,-3.491 c -2.879,-0.278 -5.115,-2.574 -5.317,-5.459 l -0.994,-14.247 -27.992,-1.997 -1.904,12.912 c -0.424,2.872 -2.932,5.037 -5.835,5.037 h -38.188 c -2.902,0 -5.41,-2.165 -5.834,-5.037 l -1.905,-12.912 -27.992,1.997 -0.994,14.247 c -0.202,2.886 -2.438,5.182 -5.317,5.46 l -36.2,3.49 c -0.187,0.018 -0.324,-1.978 -0.511,-1.978 l -0.049,-7.83 30.658,-4.944 1.004,-14.374 c 0.203,-2.91 2.551,-5.263 5.463,-5.472 l 38.551,-2.75 c 0.146,-0.01 0.29,-0.016 0.434,-0.016 2.897,0 5.401,2.166 5.825,5.038 l 1.959,13.286 h 28.005 l 1.959,-13.286 c 0.423,-2.871 2.93,-5.037 5.831,-5.037 0.142,0 0.284,0.005 0.423,0.015 l 38.556,2.75 c 2.911,0.209 5.26,2.562 5.463,5.472 l 1.003,14.374 30.645,4.966 z" + style="fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.320312" + id="path80-3" + inkscape:connector-curvature="0" /></g><g + id="g82-3-2" + transform="matrix(4.162611,0,0,-4.162611,104.69892,525.90697)" + style="stroke-width:0.320312"><path + d="m 0,0 v -47.514 -6.035 -5.492 c 0.108,-0.001 0.216,-0.005 0.323,-0.015 l 36.196,-3.49 c 1.896,-0.183 3.382,-1.709 3.514,-3.609 l 1.116,-15.978 31.574,-2.253 2.175,14.747 c 0.282,1.912 1.922,3.329 3.856,3.329 h 38.188 c 1.933,0 3.573,-1.417 3.855,-3.329 l 2.175,-14.747 31.575,2.253 1.115,15.978 c 0.133,1.9 1.618,3.425 3.514,3.609 l 36.182,3.49 c 0.107,0.01 0.214,0.014 0.322,0.015 v 4.711 l 0.015,0.005 V 0 c 5.09692,6.4164715 9.92323,13.494208 13.621,19.449 -5.651,9.62 -12.575,18.217 -19.976,26.182 -6.864,-3.455 -13.531,-7.369 -19.828,-11.534 -3.151,3.132 -6.7,5.694 -10.186,8.372 -3.425,2.751 -7.285,4.768 -10.946,7.118 1.09,8.117 1.629,16.108 1.846,24.448 -9.446,4.754 -19.519,7.906 -29.708,10.17 -4.068,-6.837 -7.788,-14.241 -11.028,-21.479 -3.842,0.642 -7.702,0.88 -11.567,0.926 v 0.006 c -0.027,0 -0.052,-0.006 -0.075,-0.006 -0.024,0 -0.049,0.006 -0.073,0.006 V 63.652 C 93.903,63.606 90.046,63.368 86.203,62.726 82.965,69.964 79.247,77.368 75.173,84.205 64.989,81.941 54.915,78.789 45.47,74.035 45.686,65.695 46.225,57.704 47.318,49.587 43.65,47.237 39.795,45.22 36.369,42.469 32.888,39.791 29.333,37.229 26.181,34.097 19.884,38.262 13.219,42.176 6.353,45.631 -1.048,37.666 -7.968,29.069 -13.621,19.449 -9.1783421,12.475308 -4.4130298,5.4661124 0,0 Z" + style="fill:#478cbf;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.320312" + id="path84-6-6" + inkscape:connector-curvature="0" + sodipodi:nodetypes="cccccccccsssscccccccccccccccccccsccccccccccc" /></g><g + id="g86-7-9" + transform="matrix(4.162611,0,0,-4.162611,784.07144,817.24284)" + style="stroke-width:0.320312"><path + d="m 0,0 -1.121,-16.063 c -0.135,-1.936 -1.675,-3.477 -3.611,-3.616 l -38.555,-2.751 c -0.094,-0.007 -0.188,-0.01 -0.281,-0.01 -1.916,0 -3.569,1.406 -3.852,3.33 l -2.211,14.994 H -81.09 l -2.211,-14.994 c -0.297,-2.018 -2.101,-3.469 -4.133,-3.32 l -38.555,2.751 c -1.936,0.139 -3.476,1.68 -3.611,3.616 L -130.721,0 -163.268,3.138 c 0.015,-3.498 0.06,-7.33 0.06,-8.093 0,-34.374 43.605,-50.896 97.781,-51.086 h 0.066 0.067 c 54.176,0.19 97.766,16.712 97.766,51.086 0,0.777 0.047,4.593 0.063,8.093 z" + style="fill:#478cbf;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.320312" + id="path88-5-4" + inkscape:connector-curvature="0" /></g><g + id="g90-3-1" + transform="matrix(4.162611,0,0,-4.162611,389.21484,625.67104)" + style="stroke-width:0.320312"><path + d="m 0,0 c 0,-12.052 -9.765,-21.815 -21.813,-21.815 -12.042,0 -21.81,9.763 -21.81,21.815 0,12.044 9.768,21.802 21.81,21.802 C -9.765,21.802 0,12.044 0,0" + style="fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.320312" + id="path92-5-3" + inkscape:connector-curvature="0" /></g><g + id="g94-6-7" + transform="matrix(4.162611,0,0,-4.162611,367.36686,631.05679)" + style="stroke-width:0.320312"><path + d="m 0,0 c 0,-7.994 -6.479,-14.473 -14.479,-14.473 -7.996,0 -14.479,6.479 -14.479,14.473 0,7.994 6.483,14.479 14.479,14.479 C -6.479,14.479 0,7.994 0,0" + style="fill:#414042;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.320312" + id="path96-2-8" + inkscape:connector-curvature="0" /></g><g + id="g98-9-8" + transform="matrix(4.162611,0,0,-4.162611,511.99336,724.73954)" + style="stroke-width:0.320312"><path + d="m 0,0 c -3.878,0 -7.021,2.858 -7.021,6.381 v 20.081 c 0,3.52 3.143,6.381 7.021,6.381 3.878,0 7.028,-2.861 7.028,-6.381 V 6.381 C 7.028,2.858 3.878,0 0,0" + style="fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.320312" + id="path100-1-3" + inkscape:connector-curvature="0" /></g><g + id="g102-2-8" + transform="matrix(4.162611,0,0,-4.162611,634.78706,625.67104)" + style="stroke-width:0.320312"><path + d="m 0,0 c 0,-12.052 9.765,-21.815 21.815,-21.815 12.041,0 21.808,9.763 21.808,21.815 0,12.044 -9.767,21.802 -21.808,21.802 C 9.765,21.802 0,12.044 0,0" + style="fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.320312" + id="path104-7-1" + inkscape:connector-curvature="0" /></g><g + id="g106-0-5" + transform="matrix(4.162611,0,0,-4.162611,656.64056,631.05679)" + style="stroke-width:0.320312"><path + d="m 0,0 c 0,-7.994 6.477,-14.473 14.471,-14.473 8.002,0 14.479,6.479 14.479,14.473 0,7.994 -6.477,14.479 -14.479,14.479 C 6.477,14.479 0,7.994 0,0" + style="fill:#414042;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.320312" + id="path108-9-3" + inkscape:connector-curvature="0" /></g></g><path + id="path581" + style="fill:#414042;fill-opacity:1;stroke-width:20;stroke:#ffffff;stroke-opacity:1;stroke-dasharray:none" + d="m 559.63672,752.49433 c -9.61602,0 -17.48438,7.86834 -17.48438,17.48437 v 295.125 c 0,9.6161 7.86836,17.4844 17.48438,17.4844 h 384.64062 c 9.61603,0 17.48438,-7.8683 17.48438,-17.4844 v -295.125 c 0,-9.61603 -7.86835,-17.48437 -17.48438,-17.48437 z" + sodipodi:nodetypes="sccssccss" /><path + id="path10" + style="fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:10.7638" + d="m 604.19435,828.87215 -19.37462,19.37464 c -5.38188,4.3055 -5.38188,11.84096 0,17.22283 l 66.73589,66.73469 -66.73589,66.73589 c -5.38188,5.3819 -5.38188,12.9161 0,17.2216 l 19.37462,19.3747 c 5.38188,5.3818 12.91613,5.3818 17.22163,0 l 75.33586,-75.33592 19.38547,-19.38425 c 5.46258,-5.17192 5.07049,-13.02396 0,-17.22284 l -19.37462,-19.37462 -75.34671,-75.34672 c -4.96088,-4.18442 -12.91229,-4.15049 -17.22163,0 z" + sodipodi:nodetypes="ccccscsccccccc" /><path + d="M 917.91967,991.872 H 760.9701 c -5.88562,0 -9.80935,3.9237 -9.80935,9.8093 v 29.4281 c 0,5.8856 3.92373,9.8093 9.80935,9.8093 h 156.94957 c 5.88561,0 9.80934,-3.9237 9.80934,-9.8093 v -29.4281 c 0,-5.8856 -3.92373,-9.8093 -9.80934,-9.8093 z" + fill="url(#paint5_linear)" + id="path25" + style="fill:#ffffff;fill-opacity:1;stroke-width:9.80938" /></g></svg> diff --git a/misc/dist/shell/_godot.zsh-completion b/misc/dist/shell/_godot.zsh-completion index 9b4ef52f3f..7b3e01d277 100644 --- a/misc/dist/shell/_godot.zsh-completion +++ b/misc/dist/shell/_godot.zsh-completion @@ -50,14 +50,15 @@ _arguments \ '--text-driver[set the text driver]:text driver name' \ '--tablet-driver[set the pen tablet input driver]:tablet driver name' \ '--headless[enable headless mode (--display-driver headless --audio-driver Dummy), useful for servers and with --script]' \ + '--write-movie[writes a video to the specified path (usually with .avi or .png extension)]:path to output video file' \ '(-f --fullscreen)'{-f,--fullscreen}'[request fullscreen mode]' \ '(-m --maximized)'{-m,--maximized}'[request a maximized window]' \ '(-w --windowed)'{-w,--windowed}'[request windowed mode]' \ '(-t --always-on-top)'{-t,--always-on-top}'[request an always-on-top window]' \ '--resolution[request window resolution]:resolution in WxH format' \ '--position[request window position]:position in X,Y format' \ - '--headless[enable headless mode (--display-driver headless --audio-driver Dummy). Useful for servers and with --script]' \ '--single-window[use a single window (no separate subwindows)]' \ + '--xr-mode[select Extended Reality (XR) mode]:Extended Reality (XR) mode:(default off on)' \ '(-d --debug)'{-d,--debug}'[debug (local stdout debugger)]' \ '(-b --breakpoints)'{-b,--breakpoints}'[specify the breakpoint list as source::line comma-separated pairs, no spaces (use %20 instead)]:breakpoint list' \ '--profiling[enable profiling in the script debugger]' \ @@ -70,6 +71,7 @@ _arguments \ '--debug-stringnames[print all StringName allocations to stdout when the engine quits]' \ '--frame-delay[simulate high CPU load (delay each frame by the given number of milliseconds)]:number of milliseconds' \ '--time-scale[force time scale (higher values are faster, 1.0 is normal speed)]:time scale' \ + '--disable-vsync[disable vertical synchronization even if enabled in the project settings]' \ '--disable-render-loop[disable render loop so rendering only occurs when called explicitly from script]' \ '--disable-crash-handler[disable crash handler when supported by the platform code]' \ '--fixed-fps[force a fixed number of frames per second (this setting disables real-time synchronization)]:frames per second' \ @@ -86,4 +88,6 @@ _arguments \ '--build-solutions[build the scripting solutions (e.g. for C# projects)]' \ '--dump-gdextension-interface[generate GDExtension header file 'gdnative_interface.h' in the current folder. This file is the base file required to implement a GDExtension.]' \ '--dump-extension-api[generate JSON dump of the Godot API for GDExtension bindings named "extension_api.json" in the current folder]' \ + '--startup-benchmark[benchmark the startup time and print it to console]' \ + '--startup-benchmark-file[benchmark the startup time and save it to a given file in JSON format]:path to output JSON file' \ '--test[run all unit tests; run with "--test --help" for more information]' diff --git a/misc/dist/shell/godot.bash-completion b/misc/dist/shell/godot.bash-completion index 02dcc94033..73107c0cf3 100644 --- a/misc/dist/shell/godot.bash-completion +++ b/misc/dist/shell/godot.bash-completion @@ -53,6 +53,7 @@ _complete_godot_options() { --text-driver --tablet-driver --headless +--write-movie --fullscreen --maximized --windowed @@ -60,6 +61,7 @@ _complete_godot_options() { --resolution --position --single-window +--xr-mode --debug --breakpoints --profiling @@ -72,6 +74,7 @@ _complete_godot_options() { --debug-stringnames --frame-delay --time-scale +--disable-vsync --disable-render-loop --disable-crash-handler --fixed-fps @@ -88,6 +91,8 @@ _complete_godot_options() { --build-solutions --dump-gdextension-interface --dump-extension-api +--startup-benchmark +--startup-benchmark-file --test " -- "$1")) } @@ -121,6 +126,10 @@ _complete_godot_bash() { local IFS=$' \n\t' # shellcheck disable=SC2207 COMPREPLY=($(compgen -W "vulkan opengl3 dummy" -- "$cur")) + elif [[ $prev == "--xr-mode" ]]; then + local IFS=$' \n\t' + # shellcheck disable=SC2207 + COMPREPLY=($(compgen -W "default off on" -- "$cur")) elif [[ $prev == "--path" || $prev == "--doctool" ]]; then local IFS=$'\n\t' # shellcheck disable=SC2207 diff --git a/misc/dist/shell/godot.fish b/misc/dist/shell/godot.fish index 4f7803124b..c6edf75112 100644 --- a/misc/dist/shell/godot.fish +++ b/misc/dist/shell/godot.fish @@ -66,6 +66,7 @@ complete -c godot -l gpu-index -d "Use a specific GPU (run with --verbose to get complete -c godot -l text-driver -d "Set the text driver" -x complete -c godot -l tablet-driver -d "Set the pen tablet input driver" -x complete -c godot -l headless -d "Enable headless mode (--display-driver headless --audio-driver Dummy). Useful for servers and with --script" +complete -c godot -l write-movie -d "Writes a video to the specified path (usually with .avi or .png extension). --fixed-fps is forced when enabled" -x # Display options: complete -c godot -s f -l fullscreen -d "Request fullscreen mode" @@ -74,8 +75,8 @@ complete -c godot -s w -l windowed -d "Request windowed mode" complete -c godot -s t -l always-on-top -d "Request an always-on-top window" complete -c godot -l resolution -d "Request window resolution" -x complete -c godot -l position -d "Request window position" -x -complete -c godot -l headless -d "Enable headless mode (--display-driver headless --audio-driver Dummy). Useful for servers and with --script" complete -c godot -l single-window -d "Use a single window (no separate subwindows)" +complete -c godot -l xr-mode -d "Select Extended Reality (XR) mode" -a "default off on" # Debug options: complete -c godot -s d -l debug -d "Debug (local stdout debugger)" @@ -108,4 +109,6 @@ complete -c godot -l no-docbase -d "Disallow dumping the base types (used with - complete -c godot -l build-solutions -d "Build the scripting solutions (e.g. for C# projects)" complete -c godot -l dump-gdextension-interface -d "Generate GDExtension header file 'gdnative_interface.h' in the current folder. This file is the base file required to implement a GDExtension" complete -c godot -l dump-extension-api -d "Generate JSON dump of the Godot API for GDExtension bindings named 'extension_api.json' in the current folder" +complete -c godot -l startup-benchmark -d "Benchmark the startup time and print it to console" +complete -c godot -l startup-benchmark-file -d "Benchmark the startup time and save it to a given file in JSON format" -x complete -c godot -l test -d "Run all unit tests; run with '--test --help' for more information" -x diff --git a/modules/etcpak/image_compress_etcpak.cpp b/modules/etcpak/image_compress_etcpak.cpp index 3d66b27556..e467ed60ee 100644 --- a/modules/etcpak/image_compress_etcpak.cpp +++ b/modules/etcpak/image_compress_etcpak.cpp @@ -111,13 +111,16 @@ void _compress_etcpak(EtcpakType p_compresstype, Image *r_img, float p_lossy_qua Image::Format target_format = Image::FORMAT_RGBA8; if (p_compresstype == EtcpakType::ETCPAK_TYPE_ETC1) { target_format = Image::FORMAT_ETC; + r_img->convert_rgba8_to_bgra8(); // It's badly documented but ETCPAK seems to be expected BGRA8 for ETC. } else if (p_compresstype == EtcpakType::ETCPAK_TYPE_ETC2) { target_format = Image::FORMAT_ETC2_RGB8; + r_img->convert_rgba8_to_bgra8(); // It's badly documented but ETCPAK seems to be expected BGRA8 for ETC. } else if (p_compresstype == EtcpakType::ETCPAK_TYPE_ETC2_RA_AS_RG) { target_format = Image::FORMAT_ETC2_RA_AS_RG; r_img->convert_rg_to_ra_rgba8(); } else if (p_compresstype == EtcpakType::ETCPAK_TYPE_ETC2_ALPHA) { target_format = Image::FORMAT_ETC2_RGBA8; + r_img->convert_rgba8_to_bgra8(); // It's badly documented but ETCPAK seems to be expected BGRA8 for ETC. } else if (p_compresstype == EtcpakType::ETCPAK_TYPE_DXT1) { target_format = Image::FORMAT_DXT1; } else if (p_compresstype == EtcpakType::ETCPAK_TYPE_DXT5_RA_AS_RG) { diff --git a/modules/gdscript/doc_classes/@GDScript.xml b/modules/gdscript/doc_classes/@GDScript.xml index c8eda53a2d..4981750b7d 100644 --- a/modules/gdscript/doc_classes/@GDScript.xml +++ b/modules/gdscript/doc_classes/@GDScript.xml @@ -547,7 +547,7 @@ <return type="void" /> <param index="0" name="icon_path" type="String" /> <description> - Add a custom icon to the current script. After loading an icon at [param icon_path], the icon is displayed in the Scene dock for every node that the script is attached to. For named classes, the icon is also displayed in various editor dialogs. + Add a custom icon to the current script. The script must be registered as a global class using the [code]class_name[/code] keyword for this to have a visible effect. The icon specified at [param icon_path] is displayed in the Scene dock for every node of that class, as well as in various editor dialogs. [codeblock] @icon("res://path/to/class/icon.svg") [/codeblock] diff --git a/modules/gdscript/gdscript_analyzer.cpp b/modules/gdscript/gdscript_analyzer.cpp index a6840b54b8..663d72038d 100644 --- a/modules/gdscript/gdscript_analyzer.cpp +++ b/modules/gdscript/gdscript_analyzer.cpp @@ -196,8 +196,11 @@ Error GDScriptAnalyzer::check_class_member_name_conflict(const GDScriptParser::C while (current_data_type && current_data_type->kind == GDScriptParser::DataType::Kind::CLASS) { GDScriptParser::ClassNode *current_class_node = current_data_type->class_type; if (has_member_name_conflict_in_script_class(p_member_name, current_class_node, p_member_node)) { - push_error(vformat(R"(The member "%s" already exists in parent class %s.)", p_member_name, current_class_node->identifier->name), - p_member_node); + String parent_class_name = current_class_node->fqcn; + if (current_class_node->identifier != nullptr) { + parent_class_name = current_class_node->identifier->name; + } + push_error(vformat(R"(The member "%s" already exists in parent class %s.)", p_member_name, parent_class_name), p_member_node); return ERR_PARSE_ERROR; } current_data_type = ¤t_class_node->base_type; @@ -494,8 +497,8 @@ GDScriptParser::DataType GDScriptAnalyzer::resolve_datatype(GDScriptParser::Type result = ref->get_parser()->head->get_datatype(); } else { result.kind = GDScriptParser::DataType::SCRIPT; - result.native_type = ScriptServer::get_global_class_native_base(first); result.script_type = ResourceLoader::load(path, "Script"); + result.native_type = result.script_type->get_instance_base_type(); result.script_path = path; result.is_constant = true; result.is_meta_type = false; @@ -1162,6 +1165,8 @@ void GDScriptAnalyzer::resolve_function_signature(GDScriptParser::FunctionNode * if (p_function->parameters[i]->default_value->is_constant) { p_function->default_arg_values.push_back(p_function->parameters[i]->default_value->reduced_value); + } else { + p_function->default_arg_values.push_back(Variant()); // Prevent shift. } } #endif // TOOLS_ENABLED @@ -1214,11 +1219,7 @@ void GDScriptAnalyzer::resolve_function_signature(GDScriptParser::FunctionNode * if (!valid) { // Compute parent signature as a string to show in the error message. - String parent_signature = parent_return_type.is_hard_type() ? parent_return_type.to_string() : "Variant"; - if (parent_signature == "null") { - parent_signature = "void"; - } - parent_signature += " " + p_function->identifier->name.operator String() + "("; + String parent_signature = p_function->identifier->name.operator String() + "("; int j = 0; for (const GDScriptParser::DataType &par_type : parameters_types) { if (j > 0) { @@ -1235,7 +1236,15 @@ void GDScriptAnalyzer::resolve_function_signature(GDScriptParser::FunctionNode * j++; } - parent_signature += ")"; + parent_signature += ") -> "; + + const String return_type = parent_return_type.is_hard_type() ? parent_return_type.to_string() : "Variant"; + if (return_type == "null") { + parent_signature += "void"; + } else { + parent_signature += return_type; + } + push_error(vformat(R"(The function signature doesn't match the parent. Parent signature is "%s".)", parent_signature), p_function); } } @@ -2733,21 +2742,13 @@ GDScriptParser::DataType GDScriptAnalyzer::make_global_class_meta_type(const Str return type; } - type.type_source = GDScriptParser::DataType::ANNOTATED_EXPLICIT; - type.kind = GDScriptParser::DataType::CLASS; - type.builtin_type = Variant::OBJECT; - type.native_type = ScriptServer::get_global_class_native_base(p_class_name); - type.class_type = ref->get_parser()->head; - type.script_path = ref->get_parser()->script_path; - type.is_constant = true; - type.is_meta_type = true; - return type; + return ref->get_parser()->head->get_datatype(); } else { type.type_source = GDScriptParser::DataType::ANNOTATED_EXPLICIT; type.kind = GDScriptParser::DataType::SCRIPT; type.builtin_type = Variant::OBJECT; - type.native_type = ScriptServer::get_global_class_native_base(p_class_name); type.script_type = ResourceLoader::load(path, "Script"); + type.native_type = type.script_type->get_instance_base_type(); type.script_path = path; type.is_constant = true; type.is_meta_type = true; diff --git a/modules/gdscript/gdscript_cache.cpp b/modules/gdscript/gdscript_cache.cpp index 2e7263b652..021504f242 100644 --- a/modules/gdscript/gdscript_cache.cpp +++ b/modules/gdscript/gdscript_cache.cpp @@ -260,7 +260,7 @@ Ref<GDScript> GDScriptCache::get_full_script(const String &p_path, Error &r_erro Ref<GDScript> script; r_error = OK; if (singleton->full_gdscript_cache.has(p_path)) { - script = Ref<GDScript>(singleton->full_gdscript_cache[p_path]); + script = singleton->full_gdscript_cache[p_path]; if (!p_update_from_disk) { return script; } @@ -360,7 +360,6 @@ Ref<PackedScene> GDScriptCache::get_packed_scene(const String &p_path, Error &r_ singleton->packed_scene_cache[p_path] = scene; singleton->packed_scene_dependencies[p_path].insert(p_owner); - scene->recreate_state(); scene->reload_from_file(); return scene; } diff --git a/modules/gdscript/gdscript_compiler.cpp b/modules/gdscript/gdscript_compiler.cpp index f0ceb42f89..24241b712b 100644 --- a/modules/gdscript/gdscript_compiler.cpp +++ b/modules/gdscript/gdscript_compiler.cpp @@ -1875,6 +1875,7 @@ Error GDScriptCompiler::_parse_block(CodeGen &codegen, const GDScriptParser::Sui GDScriptCodeGenerator::Address local = codegen.locals[lv->identifier->name]; GDScriptDataType local_type = _gdtype_from_datatype(lv->get_datatype(), codegen.script); + bool initialized = false; if (lv->initializer != nullptr) { // For typed arrays we need to make sure this is already initialized correctly so typed assignment work. if (local_type.has_type && local_type.builtin_type == Variant::ARRAY) { @@ -1896,15 +1897,23 @@ Error GDScriptCompiler::_parse_block(CodeGen &codegen, const GDScriptParser::Sui if (src_address.mode == GDScriptCodeGenerator::Address::TEMPORARY) { codegen.generator->pop_temporary(); } + initialized = true; } else if (local_type.has_type) { // Initialize with default for type. if (local_type.has_container_element_type()) { codegen.generator->write_construct_typed_array(local, local_type.get_container_element_type(), Vector<GDScriptCodeGenerator::Address>()); + initialized = true; } else if (local_type.kind == GDScriptDataType::BUILTIN) { codegen.generator->write_construct(local, local_type.builtin_type, Vector<GDScriptCodeGenerator::Address>()); + initialized = true; } // The `else` branch is for objects, in such case we leave it as `null`. } + + // Assigns a null for the unassigned variables in loops. + if (!initialized && p_block->is_loop) { + codegen.generator->write_construct(local, Variant::NIL, Vector<GDScriptCodeGenerator::Address>()); + } } break; case GDScriptParser::Node::CONSTANT: { // Local constants. @@ -2284,7 +2293,7 @@ Error GDScriptCompiler::_populate_class_members(GDScript *p_script, const GDScri _set_error(vformat(R"(Could not find class "%s" in "%s".)", base->fully_qualified_name, base->path), nullptr); return ERR_COMPILATION_FAILED; } - ERR_FAIL_COND_V(!base->is_valid(), ERR_BUG); + ERR_FAIL_COND_V(!base->is_valid() && !base->reloading, ERR_BUG); } p_script->base = base; diff --git a/modules/gdscript/gdscript_editor.cpp b/modules/gdscript/gdscript_editor.cpp index 7628bffd22..c02ee99a86 100644 --- a/modules/gdscript/gdscript_editor.cpp +++ b/modules/gdscript/gdscript_editor.cpp @@ -3265,15 +3265,6 @@ static Error _lookup_symbol_from_base(const GDScriptParser::DataType &p_base, co } } - // Need special checks for assert and preload as they are technically - // keywords, so are not registered in GDScriptUtilityFunctions. - if (GDScriptUtilityFunctions::function_exists(p_symbol) || "assert" == p_symbol || "preload" == p_symbol) { - r_result.type = ScriptLanguage::LOOKUP_RESULT_CLASS_METHOD; - r_result.class_name = "@GDScript"; - r_result.class_member = p_symbol; - return OK; - } - if ("PI" == p_symbol || "TAU" == p_symbol || "INF" == p_symbol || "NAN" == p_symbol) { r_result.type = ScriptLanguage::LOOKUP_RESULT_CLASS_CONSTANT; r_result.class_name = "@GDScript"; @@ -3283,11 +3274,24 @@ static Error _lookup_symbol_from_base(const GDScriptParser::DataType &p_base, co GDScriptParser parser; parser.parse(p_code, p_path, true); - GDScriptAnalyzer analyzer(&parser); - analyzer.analyze(); GDScriptParser::CompletionContext context = parser.get_completion_context(); + // Allows class functions with the names like built-ins to be handled properly. + if (context.type != GDScriptParser::COMPLETION_ATTRIBUTE) { + // Need special checks for assert and preload as they are technically + // keywords, so are not registered in GDScriptUtilityFunctions. + if (GDScriptUtilityFunctions::function_exists(p_symbol) || "assert" == p_symbol || "preload" == p_symbol) { + r_result.type = ScriptLanguage::LOOKUP_RESULT_CLASS_METHOD; + r_result.class_name = "@GDScript"; + r_result.class_member = p_symbol; + return OK; + } + } + + GDScriptAnalyzer analyzer(&parser); + analyzer.analyze(); + if (context.current_class && context.current_class->extends.size() > 0) { bool success = false; ClassDB::get_integer_constant(context.current_class->extends[0], p_symbol, &success); diff --git a/modules/gdscript/gdscript_parser.cpp b/modules/gdscript/gdscript_parser.cpp index 7074520a34..f2aafe9f0c 100644 --- a/modules/gdscript/gdscript_parser.cpp +++ b/modules/gdscript/gdscript_parser.cpp @@ -1835,9 +1835,9 @@ GDScriptParser::ForNode *GDScriptParser::parse_for() { } suite->add_local(SuiteNode::Local(n_for->variable, current_function)); } - suite->parent_for = n_for; n_for->loop = parse_suite(R"("for" block)", suite); + n_for->loop->is_loop = true; complete_extents(n_for); // Reset break/continue state. @@ -2169,6 +2169,7 @@ GDScriptParser::WhileNode *GDScriptParser::parse_while() { is_continue_match = false; n_while->loop = parse_suite(R"("while" block)"); + n_while->loop->is_loop = true; complete_extents(n_while); // Reset break/continue state. @@ -3785,15 +3786,14 @@ bool GDScriptParser::export_annotations(const AnnotationNode *p_annotation, Node } break; case GDScriptParser::DataType::CLASS: - // Can assume type is a global GDScript class. if (ClassDB::is_parent_class(export_type.native_type, SNAME("Resource"))) { variable->export_info.type = Variant::OBJECT; variable->export_info.hint = PROPERTY_HINT_RESOURCE_TYPE; - variable->export_info.hint_string = export_type.class_type->identifier->name; + variable->export_info.hint_string = export_type.to_string(); } else if (ClassDB::is_parent_class(export_type.native_type, SNAME("Node"))) { variable->export_info.type = Variant::OBJECT; variable->export_info.hint = PROPERTY_HINT_NODE_TYPE; - variable->export_info.hint_string = export_type.class_type->identifier->name; + variable->export_info.hint_string = export_type.to_string(); } else { push_error(R"(Export type can only be built-in, a resource, a node or an enum.)", variable); return false; @@ -3802,16 +3802,19 @@ bool GDScriptParser::export_annotations(const AnnotationNode *p_annotation, Node break; case GDScriptParser::DataType::SCRIPT: { StringName class_name; - if (export_type.script_type != nullptr && export_type.script_type.is_valid()) { + StringName native_base; + if (export_type.script_type.is_valid()) { class_name = export_type.script_type->get_language()->get_global_class_name(export_type.script_type->get_path()); + native_base = export_type.script_type->get_instance_base_type(); } if (class_name == StringName()) { Ref<Script> script = ResourceLoader::load(export_type.script_path, SNAME("Script")); if (script.is_valid()) { class_name = script->get_language()->get_global_class_name(export_type.script_path); + native_base = script->get_instance_base_type(); } } - if (class_name != StringName() && ClassDB::is_parent_class(ScriptServer::get_global_class_native_base(class_name), SNAME("Resource"))) { + if (class_name != StringName() && native_base != StringName() && ClassDB::is_parent_class(native_base, SNAME("Resource"))) { variable->export_info.type = Variant::OBJECT; variable->export_info.hint = PROPERTY_HINT_RESOURCE_TYPE; variable->export_info.hint_string = class_name; diff --git a/modules/gdscript/gdscript_parser.h b/modules/gdscript/gdscript_parser.h index f9a1c5a697..d092a2a5e9 100644 --- a/modules/gdscript/gdscript_parser.h +++ b/modules/gdscript/gdscript_parser.h @@ -1055,12 +1055,12 @@ public: HashMap<StringName, int> locals_indices; FunctionNode *parent_function = nullptr; - ForNode *parent_for = nullptr; IfNode *parent_if = nullptr; bool has_return = false; bool has_continue = false; bool has_unreachable_code = false; // Just so warnings aren't given more than once per block. + bool is_loop = false; bool has_local(const StringName &p_name) const; const Local &get_local(const StringName &p_name) const; diff --git a/modules/gdscript/language_server/gdscript_language_protocol.cpp b/modules/gdscript/language_server/gdscript_language_protocol.cpp index 39f4c976a4..551973140d 100644 --- a/modules/gdscript/language_server/gdscript_language_protocol.cpp +++ b/modules/gdscript/language_server/gdscript_language_protocol.cpp @@ -32,6 +32,7 @@ #include "core/config/project_settings.h" #include "editor/doc_tools.h" +#include "editor/editor_help.h" #include "editor/editor_log.h" #include "editor/editor_node.h" #include "editor/editor_settings.h" diff --git a/modules/gdscript/tests/scripts/analyzer/errors/function_dont_match_parent_signature_parameter_count_less.out b/modules/gdscript/tests/scripts/analyzer/errors/function_dont_match_parent_signature_parameter_count_less.out index 3baeb17066..4ccd2da381 100644 --- a/modules/gdscript/tests/scripts/analyzer/errors/function_dont_match_parent_signature_parameter_count_less.out +++ b/modules/gdscript/tests/scripts/analyzer/errors/function_dont_match_parent_signature_parameter_count_less.out @@ -1,2 +1,2 @@ GDTEST_ANALYZER_ERROR -The function signature doesn't match the parent. Parent signature is "int my_function(int)". +The function signature doesn't match the parent. Parent signature is "my_function(int) -> int". diff --git a/modules/gdscript/tests/scripts/analyzer/errors/function_dont_match_parent_signature_parameter_count_more.out b/modules/gdscript/tests/scripts/analyzer/errors/function_dont_match_parent_signature_parameter_count_more.out index 3baeb17066..4ccd2da381 100644 --- a/modules/gdscript/tests/scripts/analyzer/errors/function_dont_match_parent_signature_parameter_count_more.out +++ b/modules/gdscript/tests/scripts/analyzer/errors/function_dont_match_parent_signature_parameter_count_more.out @@ -1,2 +1,2 @@ GDTEST_ANALYZER_ERROR -The function signature doesn't match the parent. Parent signature is "int my_function(int)". +The function signature doesn't match the parent. Parent signature is "my_function(int) -> int". diff --git a/modules/gdscript/tests/scripts/analyzer/errors/function_dont_match_parent_signature_parameter_default_values.out b/modules/gdscript/tests/scripts/analyzer/errors/function_dont_match_parent_signature_parameter_default_values.out index 665c229339..c70a1df10d 100644 --- a/modules/gdscript/tests/scripts/analyzer/errors/function_dont_match_parent_signature_parameter_default_values.out +++ b/modules/gdscript/tests/scripts/analyzer/errors/function_dont_match_parent_signature_parameter_default_values.out @@ -1,2 +1,2 @@ GDTEST_ANALYZER_ERROR -The function signature doesn't match the parent. Parent signature is "int my_function(int = default)". +The function signature doesn't match the parent. Parent signature is "my_function(int = default) -> int". diff --git a/modules/gdscript/tests/scripts/analyzer/errors/function_dont_match_parent_signature_parameter_type.out b/modules/gdscript/tests/scripts/analyzer/errors/function_dont_match_parent_signature_parameter_type.out index 3baeb17066..4ccd2da381 100644 --- a/modules/gdscript/tests/scripts/analyzer/errors/function_dont_match_parent_signature_parameter_type.out +++ b/modules/gdscript/tests/scripts/analyzer/errors/function_dont_match_parent_signature_parameter_type.out @@ -1,2 +1,2 @@ GDTEST_ANALYZER_ERROR -The function signature doesn't match the parent. Parent signature is "int my_function(int)". +The function signature doesn't match the parent. Parent signature is "my_function(int) -> int". diff --git a/modules/gdscript/tests/scripts/analyzer/errors/function_dont_match_parent_signature_return_type.out b/modules/gdscript/tests/scripts/analyzer/errors/function_dont_match_parent_signature_return_type.out index 5b22739a93..61004ff627 100644 --- a/modules/gdscript/tests/scripts/analyzer/errors/function_dont_match_parent_signature_return_type.out +++ b/modules/gdscript/tests/scripts/analyzer/errors/function_dont_match_parent_signature_return_type.out @@ -1,2 +1,2 @@ GDTEST_ANALYZER_ERROR -The function signature doesn't match the parent. Parent signature is "int my_function()". +The function signature doesn't match the parent. Parent signature is "my_function() -> int". diff --git a/modules/gltf/doc_classes/GLTFDocument.xml b/modules/gltf/doc_classes/GLTFDocument.xml index 588015de62..f313f4b28f 100644 --- a/modules/gltf/doc_classes/GLTFDocument.xml +++ b/modules/gltf/doc_classes/GLTFDocument.xml @@ -14,7 +14,6 @@ <param index="1" name="base_path" type="String" /> <param index="2" name="state" type="GLTFState" /> <param index="3" name="flags" type="int" default="0" /> - <param index="4" name="bake_fps" type="int" default="30" /> <description> Takes a [PackedByteArray] defining a gLTF and returns a [GLTFState] object through the [param state] parameter. [b]Note:[/b] The [param base_path] tells [method append_from_buffer] where to find dependencies and can be empty. @@ -25,8 +24,7 @@ <param index="0" name="path" type="String" /> <param index="1" name="state" type="GLTFState" /> <param index="2" name="flags" type="int" default="0" /> - <param index="3" name="bake_fps" type="int" default="30" /> - <param index="4" name="base_path" type="String" default="""" /> + <param index="3" name="base_path" type="String" default="""" /> <description> Takes a path to a gLTF file and returns a [GLTFState] object through the [param state] parameter. [b]Note:[/b] The [param base_path] tells [method append_from_file] where to find dependencies and can be empty. @@ -37,7 +35,6 @@ <param index="0" name="node" type="Node" /> <param index="1" name="state" type="GLTFState" /> <param index="2" name="flags" type="int" default="0" /> - <param index="3" name="bake_fps" type="int" default="30" /> <description> Takes a Godot Engine scene node and returns a [GLTFState] object through the [param state] parameter. </description> @@ -52,7 +49,8 @@ <method name="generate_scene"> <return type="Node" /> <param index="0" name="state" type="GLTFState" /> - <param index="1" name="bake_fps" type="int" default="30" /> + <param index="1" name="bake_fps" type="float" default="30" /> + <param index="2" name="trimming" type="bool" default="false" /> <description> Takes a [GLTFState] object through the [param state] parameter and returns a Godot Engine scene node. </description> diff --git a/modules/gltf/editor/editor_scene_exporter_gltf_plugin.cpp b/modules/gltf/editor/editor_scene_exporter_gltf_plugin.cpp index 95db1c0965..0c0b134bd1 100644 --- a/modules/gltf/editor/editor_scene_exporter_gltf_plugin.cpp +++ b/modules/gltf/editor/editor_scene_exporter_gltf_plugin.cpp @@ -85,7 +85,7 @@ void SceneExporterGLTFPlugin::_gltf2_dialog_action(String p_file) { state.instantiate(); int32_t flags = 0; flags |= EditorSceneFormatImporter::IMPORT_USE_NAMED_SKIN_BINDS; - Error err = doc->append_from_scene(root, state, flags, 30.0f); + Error err = doc->append_from_scene(root, state, flags); if (err != OK) { ERR_PRINT(vformat("glTF2 save scene error %s.", itos(err))); } diff --git a/modules/gltf/editor/editor_scene_importer_blend.cpp b/modules/gltf/editor/editor_scene_importer_blend.cpp index 20c9508474..7007ea5d13 100644 --- a/modules/gltf/editor/editor_scene_importer_blend.cpp +++ b/modules/gltf/editor/editor_scene_importer_blend.cpp @@ -41,6 +41,7 @@ #include "editor/editor_scale.h" #include "editor/editor_settings.h" #include "main/main.h" +#include "scene/gui/line_edit.h" #include "scene/main/node.h" #include "scene/resources/animation.h" @@ -58,7 +59,7 @@ void EditorSceneFormatImporterBlend::get_extensions(List<String> *r_extensions) } Node *EditorSceneFormatImporterBlend::import_scene(const String &p_path, uint32_t p_flags, - const HashMap<StringName, Variant> &p_options, int p_bake_fps, + const HashMap<StringName, Variant> &p_options, List<String> *r_missing_deps, Error *r_err) { // Get global paths for source and sink. @@ -227,14 +228,14 @@ Node *EditorSceneFormatImporterBlend::import_scene(const String &p_path, uint32_ if (p_options.has(SNAME("blender/materials/unpack_enabled")) && p_options[SNAME("blender/materials/unpack_enabled")]) { base_dir = sink.get_base_dir(); } - Error err = gltf->append_from_file(sink.get_basename() + ".gltf", state, p_flags, p_bake_fps, base_dir); + Error err = gltf->append_from_file(sink.get_basename() + ".gltf", state, p_flags, base_dir); if (err != OK) { if (r_err) { *r_err = FAILED; } return nullptr; } - return gltf->generate_scene(state, p_bake_fps); + return gltf->generate_scene(state, (float)p_options["animation/fps"], (bool)p_options["animation/trimming"]); } Variant EditorSceneFormatImporterBlend::get_option_visibility(const String &p_path, bool p_for_animation, const String &p_option, diff --git a/modules/gltf/editor/editor_scene_importer_blend.h b/modules/gltf/editor/editor_scene_importer_blend.h index a1485ff82e..fe687f19fc 100644 --- a/modules/gltf/editor/editor_scene_importer_blend.h +++ b/modules/gltf/editor/editor_scene_importer_blend.h @@ -66,7 +66,7 @@ public: virtual uint32_t get_import_flags() const override; virtual void get_extensions(List<String> *r_extensions) const override; virtual Node *import_scene(const String &p_path, uint32_t p_flags, - const HashMap<StringName, Variant> &p_options, int p_bake_fps, + const HashMap<StringName, Variant> &p_options, List<String> *r_missing_deps, Error *r_err = nullptr) override; virtual void get_import_options(const String &p_path, List<ResourceImporter::ImportOption> *r_options) override; diff --git a/modules/gltf/editor/editor_scene_importer_fbx.cpp b/modules/gltf/editor/editor_scene_importer_fbx.cpp index 017a44cccf..14f2117413 100644 --- a/modules/gltf/editor/editor_scene_importer_fbx.cpp +++ b/modules/gltf/editor/editor_scene_importer_fbx.cpp @@ -49,7 +49,7 @@ void EditorSceneFormatImporterFBX::get_extensions(List<String> *r_extensions) co } Node *EditorSceneFormatImporterFBX::import_scene(const String &p_path, uint32_t p_flags, - const HashMap<StringName, Variant> &p_options, int p_bake_fps, + const HashMap<StringName, Variant> &p_options, List<String> *r_missing_deps, Error *r_err) { // Get global paths for source and sink. @@ -95,14 +95,14 @@ Node *EditorSceneFormatImporterFBX::import_scene(const String &p_path, uint32_t Ref<GLTFState> state; state.instantiate(); print_verbose(vformat("glTF path: %s", sink)); - Error err = gltf->append_from_file(sink, state, p_flags, p_bake_fps); + Error err = gltf->append_from_file(sink, state, p_flags); if (err != OK) { if (r_err) { *r_err = FAILED; } return nullptr; } - return gltf->generate_scene(state, p_bake_fps); + return gltf->generate_scene(state, (float)p_options["animation/fps"], (bool)p_options["animation/trimming"]); } Variant EditorSceneFormatImporterFBX::get_option_visibility(const String &p_path, bool p_for_animation, diff --git a/modules/gltf/editor/editor_scene_importer_fbx.h b/modules/gltf/editor/editor_scene_importer_fbx.h index b0039b1c8f..6bf9f3e033 100644 --- a/modules/gltf/editor/editor_scene_importer_fbx.h +++ b/modules/gltf/editor/editor_scene_importer_fbx.h @@ -45,7 +45,7 @@ public: virtual uint32_t get_import_flags() const override; virtual void get_extensions(List<String> *r_extensions) const override; virtual Node *import_scene(const String &p_path, uint32_t p_flags, - const HashMap<StringName, Variant> &p_options, int p_bake_fps, + const HashMap<StringName, Variant> &p_options, List<String> *r_missing_deps, Error *r_err = nullptr) override; virtual void get_import_options(const String &p_path, List<ResourceImporter::ImportOption> *r_options) override; diff --git a/modules/gltf/editor/editor_scene_importer_gltf.cpp b/modules/gltf/editor/editor_scene_importer_gltf.cpp index 161808aade..3cf49a3046 100644 --- a/modules/gltf/editor/editor_scene_importer_gltf.cpp +++ b/modules/gltf/editor/editor_scene_importer_gltf.cpp @@ -47,13 +47,13 @@ void EditorSceneFormatImporterGLTF::get_extensions(List<String> *r_extensions) c } Node *EditorSceneFormatImporterGLTF::import_scene(const String &p_path, uint32_t p_flags, - const HashMap<StringName, Variant> &p_options, int p_bake_fps, + const HashMap<StringName, Variant> &p_options, List<String> *r_missing_deps, Error *r_err) { Ref<GLTFDocument> doc; doc.instantiate(); Ref<GLTFState> state; state.instantiate(); - Error err = doc->append_from_file(p_path, state, p_flags, p_bake_fps); + Error err = doc->append_from_file(p_path, state, p_flags); if (err != OK) { if (r_err) { *r_err = err; @@ -63,7 +63,7 @@ Node *EditorSceneFormatImporterGLTF::import_scene(const String &p_path, uint32_t if (p_options.has("animation/import")) { state->set_create_animations(bool(p_options["animation/import"])); } - return doc->generate_scene(state, p_bake_fps); + return doc->generate_scene(state, (float)p_options["animation/fps"], (bool)p_options["animation/trimming"]); } #endif // TOOLS_ENABLED diff --git a/modules/gltf/editor/editor_scene_importer_gltf.h b/modules/gltf/editor/editor_scene_importer_gltf.h index edca038532..c0582b26c1 100644 --- a/modules/gltf/editor/editor_scene_importer_gltf.h +++ b/modules/gltf/editor/editor_scene_importer_gltf.h @@ -45,7 +45,7 @@ public: virtual uint32_t get_import_flags() const override; virtual void get_extensions(List<String> *r_extensions) const override; virtual Node *import_scene(const String &p_path, uint32_t p_flags, - const HashMap<StringName, Variant> &p_options, int p_bake_fps, + const HashMap<StringName, Variant> &p_options, List<String> *r_missing_deps, Error *r_err = nullptr) override; }; diff --git a/modules/gltf/gltf_document.cpp b/modules/gltf/gltf_document.cpp index eb8f7e5ebc..a3685daf0e 100644 --- a/modules/gltf/gltf_document.cpp +++ b/modules/gltf/gltf_document.cpp @@ -796,7 +796,7 @@ Error GLTFDocument::_parse_buffers(Ref<GLTFState> state, const String &p_base_pa ERR_FAIL_COND_V(p_base_path.is_empty(), ERR_INVALID_PARAMETER); uri = uri.uri_decode(); uri = p_base_path.path_join(uri).replace("\\", "/"); // Fix for Windows. - buffer_data = FileAccess::get_file_as_array(uri); + buffer_data = FileAccess::get_file_as_bytes(uri); ERR_FAIL_COND_V_MSG(buffer.size() == 0, ERR_PARSE_ERROR, "glTF: Couldn't load binary file as an array: " + uri); } @@ -3139,7 +3139,7 @@ Error GLTFDocument::_parse_images(Ref<GLTFState> state, const String &p_base_pat // Fallback to loading as byte array. // This enables us to support the spec's requirement that we honor mimetype // regardless of file URI. - data = FileAccess::get_file_as_array(uri); + data = FileAccess::get_file_as_bytes(uri); if (data.size() == 0) { WARN_PRINT(vformat("glTF: Image index '%d' couldn't be loaded as a buffer of MIME type '%s' from URI: %s. Skipping it.", i, mimetype, uri)); state->images.push_back(Ref<Texture2D>()); // Placeholder to keep count. @@ -5860,7 +5860,7 @@ T GLTFDocument::_interpolate_track(const Vector<real_t> &p_times, const Vector<T ERR_FAIL_V(p_values[0]); } -void GLTFDocument::_import_animation(Ref<GLTFState> state, AnimationPlayer *ap, const GLTFAnimationIndex index, const int bake_fps) { +void GLTFDocument::_import_animation(Ref<GLTFState> state, AnimationPlayer *ap, const GLTFAnimationIndex index, const float bake_fps, const bool trimming) { Ref<GLTFAnimation> anim = state->animations[index]; String anim_name = anim->get_name(); @@ -5877,7 +5877,8 @@ void GLTFDocument::_import_animation(Ref<GLTFState> state, AnimationPlayer *ap, animation->set_loop_mode(Animation::LOOP_LINEAR); } - float length = 0.0; + double anim_start = trimming ? INFINITY : 0.0; + double anim_end = 0.0; for (const KeyValue<int, GLTFAnimation::Track> &track_i : anim->get_tracks()) { const GLTFAnimation::Track &track = track_i.value; @@ -5907,19 +5908,40 @@ void GLTFDocument::_import_animation(Ref<GLTFState> state, AnimationPlayer *ap, transform_node_path = node_path; } - for (int i = 0; i < track.rotation_track.times.size(); i++) { - length = MAX(length, track.rotation_track.times[i]); - } - for (int i = 0; i < track.position_track.times.size(); i++) { - length = MAX(length, track.position_track.times[i]); - } - for (int i = 0; i < track.scale_track.times.size(); i++) { - length = MAX(length, track.scale_track.times[i]); - } - - for (int i = 0; i < track.weight_tracks.size(); i++) { - for (int j = 0; j < track.weight_tracks[i].times.size(); j++) { - length = MAX(length, track.weight_tracks[i].times[j]); + if (trimming) { + for (int i = 0; i < track.rotation_track.times.size(); i++) { + anim_start = MIN(anim_start, track.rotation_track.times[i]); + anim_end = MAX(anim_end, track.rotation_track.times[i]); + } + for (int i = 0; i < track.position_track.times.size(); i++) { + anim_start = MIN(anim_start, track.position_track.times[i]); + anim_end = MAX(anim_end, track.position_track.times[i]); + } + for (int i = 0; i < track.scale_track.times.size(); i++) { + anim_start = MIN(anim_start, track.scale_track.times[i]); + anim_end = MAX(anim_end, track.scale_track.times[i]); + } + for (int i = 0; i < track.weight_tracks.size(); i++) { + for (int j = 0; j < track.weight_tracks[i].times.size(); j++) { + anim_start = MIN(anim_start, track.weight_tracks[i].times[j]); + anim_end = MAX(anim_end, track.weight_tracks[i].times[j]); + } + } + } else { + // If you don't use trimming and the first key time is not at 0.0, fake keys will be inserted. + for (int i = 0; i < track.rotation_track.times.size(); i++) { + anim_end = MAX(anim_end, track.rotation_track.times[i]); + } + for (int i = 0; i < track.position_track.times.size(); i++) { + anim_end = MAX(anim_end, track.position_track.times[i]); + } + for (int i = 0; i < track.scale_track.times.size(); i++) { + anim_end = MAX(anim_end, track.scale_track.times[i]); + } + for (int i = 0; i < track.weight_tracks.size(); i++) { + for (int j = 0; j < track.weight_tracks[i].times.size(); j++) { + anim_end = MAX(anim_end, track.weight_tracks[i].times[j]); + } } } @@ -5988,10 +6010,8 @@ void GLTFDocument::_import_animation(Ref<GLTFState> state, AnimationPlayer *ap, } } - //first determine animation length - const double increment = 1.0 / bake_fps; - double time = 0.0; + double time = anim_start; Vector3 base_pos; Quaternion base_rot; @@ -6017,26 +6037,26 @@ void GLTFDocument::_import_animation(Ref<GLTFState> state, AnimationPlayer *ap, if (position_idx >= 0) { pos = _interpolate_track<Vector3>(track.position_track.times, track.position_track.values, time, track.position_track.interpolation); - animation->position_track_insert_key(position_idx, time, pos); + animation->position_track_insert_key(position_idx, time - anim_start, pos); } if (rotation_idx >= 0) { rot = _interpolate_track<Quaternion>(track.rotation_track.times, track.rotation_track.values, time, track.rotation_track.interpolation); - animation->rotation_track_insert_key(rotation_idx, time, rot); + animation->rotation_track_insert_key(rotation_idx, time - anim_start, rot); } if (scale_idx >= 0) { scale = _interpolate_track<Vector3>(track.scale_track.times, track.scale_track.values, time, track.scale_track.interpolation); - animation->scale_track_insert_key(scale_idx, time, scale); + animation->scale_track_insert_key(scale_idx, time - anim_start, scale); } if (last) { break; } time += increment; - if (time >= length) { + if (time >= anim_end) { last = true; - time = length; + time = anim_end; } } } @@ -6071,21 +6091,21 @@ void GLTFDocument::_import_animation(Ref<GLTFState> state, AnimationPlayer *ap, bool last = false; while (true) { real_t blend = _interpolate_track<real_t>(track.weight_tracks[i].times, track.weight_tracks[i].values, time, gltf_interp); - animation->blend_shape_track_insert_key(track_idx, time, blend); + animation->blend_shape_track_insert_key(track_idx, time - anim_start, blend); if (last) { break; } time += increment; - if (time >= length) { + if (time >= anim_end) { last = true; - time = length; + time = anim_end; } } } } } - animation->set_length(length); + animation->set_length(anim_end - anim_start); Ref<AnimationLibrary> library; if (!ap->has_animation_library("")) { @@ -6585,7 +6605,7 @@ void GLTFDocument::_convert_animation(Ref<GLTFState> state, AnimationPlayer *ap, } } -Error GLTFDocument::_parse(Ref<GLTFState> state, String p_path, Ref<FileAccess> f, int p_bake_fps) { +Error GLTFDocument::_parse(Ref<GLTFState> state, String p_path, Ref<FileAccess> f) { Error err; if (f.is_null()) { return FAILED; @@ -6636,7 +6656,7 @@ Error GLTFDocument::_parse(Ref<GLTFState> state, String p_path, Ref<FileAccess> } } - err = _parse_gltf_state(state, p_path, p_bake_fps); + err = _parse_gltf_state(state, p_path); ERR_FAIL_COND_V(err != OK, err); return OK; @@ -6754,14 +6774,14 @@ Error GLTFDocument::_serialize_file(Ref<GLTFState> state, const String p_path) { } void GLTFDocument::_bind_methods() { - ClassDB::bind_method(D_METHOD("append_from_file", "path", "state", "flags", "bake_fps", "base_path"), - &GLTFDocument::append_from_file, DEFVAL(0), DEFVAL(30), DEFVAL(String())); - ClassDB::bind_method(D_METHOD("append_from_buffer", "bytes", "base_path", "state", "flags", "bake_fps"), - &GLTFDocument::append_from_buffer, DEFVAL(0), DEFVAL(30)); - ClassDB::bind_method(D_METHOD("append_from_scene", "node", "state", "flags", "bake_fps"), - &GLTFDocument::append_from_scene, DEFVAL(0), DEFVAL(30)); - ClassDB::bind_method(D_METHOD("generate_scene", "state", "bake_fps"), - &GLTFDocument::generate_scene, DEFVAL(30)); + ClassDB::bind_method(D_METHOD("append_from_file", "path", "state", "flags", "base_path"), + &GLTFDocument::append_from_file, DEFVAL(0), DEFVAL(String())); + ClassDB::bind_method(D_METHOD("append_from_buffer", "bytes", "base_path", "state", "flags"), + &GLTFDocument::append_from_buffer, DEFVAL(0)); + ClassDB::bind_method(D_METHOD("append_from_scene", "node", "state", "flags"), + &GLTFDocument::append_from_scene, DEFVAL(0)); + ClassDB::bind_method(D_METHOD("generate_scene", "state", "bake_fps", "trimming"), + &GLTFDocument::generate_scene, DEFVAL(30), DEFVAL(false)); ClassDB::bind_method(D_METHOD("generate_buffer", "state"), &GLTFDocument::generate_buffer); ClassDB::bind_method(D_METHOD("write_to_filesystem", "state", "path"), @@ -6870,7 +6890,7 @@ Error GLTFDocument::write_to_filesystem(Ref<GLTFState> state, const String &p_pa return OK; } -Node *GLTFDocument::generate_scene(Ref<GLTFState> state, int32_t p_bake_fps) { +Node *GLTFDocument::generate_scene(Ref<GLTFState> state, float p_bake_fps, bool p_trimming) { ERR_FAIL_NULL_V(state, nullptr); ERR_FAIL_INDEX_V(0, state->root_nodes.size(), nullptr); Error err = OK; @@ -6884,7 +6904,7 @@ Node *GLTFDocument::generate_scene(Ref<GLTFState> state, int32_t p_bake_fps) { root->add_child(ap, true); ap->set_owner(root); for (int i = 0; i < state->animations.size(); i++) { - _import_animation(state, ap, i, p_bake_fps); + _import_animation(state, ap, i, p_bake_fps, p_trimming); } } for (KeyValue<GLTFNodeIndex, Node *> E : state->scene_nodes) { @@ -6910,7 +6930,7 @@ Node *GLTFDocument::generate_scene(Ref<GLTFState> state, int32_t p_bake_fps) { return root; } -Error GLTFDocument::append_from_scene(Node *p_node, Ref<GLTFState> state, uint32_t p_flags, int32_t p_bake_fps) { +Error GLTFDocument::append_from_scene(Node *p_node, Ref<GLTFState> state, uint32_t p_flags) { ERR_FAIL_COND_V(state.is_null(), FAILED); state->use_named_skin_binds = p_flags & GLTF_IMPORT_USE_NAMED_SKIN_BINDS; state->discard_meshes_and_materials = p_flags & GLTF_IMPORT_DISCARD_MESHES_AND_MATERIALS; @@ -6930,7 +6950,7 @@ Error GLTFDocument::append_from_scene(Node *p_node, Ref<GLTFState> state, uint32 return OK; } -Error GLTFDocument::append_from_buffer(PackedByteArray p_bytes, String p_base_path, Ref<GLTFState> state, uint32_t p_flags, int32_t p_bake_fps) { +Error GLTFDocument::append_from_buffer(PackedByteArray p_bytes, String p_base_path, Ref<GLTFState> state, uint32_t p_flags) { ERR_FAIL_COND_V(state.is_null(), FAILED); // TODO Add missing texture and missing .bin file paths to r_missing_deps 2021-09-10 fire Error err = FAILED; @@ -6941,7 +6961,7 @@ Error GLTFDocument::append_from_buffer(PackedByteArray p_bytes, String p_base_pa file_access.instantiate(); file_access->open_custom(p_bytes.ptr(), p_bytes.size()); state->base_path = p_base_path.get_base_dir(); - err = _parse(state, state->base_path, file_access, p_bake_fps); + err = _parse(state, state->base_path, file_access); ERR_FAIL_COND_V(err != OK, err); for (Ref<GLTFDocumentExtension> ext : document_extensions) { ERR_CONTINUE(ext.is_null()); @@ -6951,7 +6971,7 @@ Error GLTFDocument::append_from_buffer(PackedByteArray p_bytes, String p_base_pa return OK; } -Error GLTFDocument::_parse_gltf_state(Ref<GLTFState> state, const String &p_search_path, float p_bake_fps) { +Error GLTFDocument::_parse_gltf_state(Ref<GLTFState> state, const String &p_search_path) { Error err; /* PARSE EXTENSIONS */ @@ -7047,7 +7067,7 @@ Error GLTFDocument::_parse_gltf_state(Ref<GLTFState> state, const String &p_sear return OK; } -Error GLTFDocument::append_from_file(String p_path, Ref<GLTFState> r_state, uint32_t p_flags, int32_t p_bake_fps, String p_base_path) { +Error GLTFDocument::append_from_file(String p_path, Ref<GLTFState> r_state, uint32_t p_flags, String p_base_path) { // TODO Add missing texture and missing .bin file paths to r_missing_deps 2021-09-10 fire if (r_state == Ref<GLTFState>()) { r_state.instantiate(); @@ -7064,7 +7084,7 @@ Error GLTFDocument::append_from_file(String p_path, Ref<GLTFState> r_state, uint base_path = p_path.get_base_dir(); } r_state->base_path = base_path; - err = _parse(r_state, base_path, f, p_bake_fps); + err = _parse(r_state, base_path, f); ERR_FAIL_COND_V(err != OK, err); for (Ref<GLTFDocumentExtension> ext : document_extensions) { ERR_CONTINUE(ext.is_null()); diff --git a/modules/gltf/gltf_document.h b/modules/gltf/gltf_document.h index 5a0e4ff498..6eb38354a2 100644 --- a/modules/gltf/gltf_document.h +++ b/modules/gltf/gltf_document.h @@ -292,17 +292,17 @@ private: static float get_max_component(const Color &p_color); public: - Error append_from_file(String p_path, Ref<GLTFState> r_state, uint32_t p_flags = 0, int32_t p_bake_fps = 30, String p_base_path = String()); - Error append_from_buffer(PackedByteArray p_bytes, String p_base_path, Ref<GLTFState> r_state, uint32_t p_flags = 0, int32_t p_bake_fps = 30); - Error append_from_scene(Node *p_node, Ref<GLTFState> r_state, uint32_t p_flags = 0, int32_t p_bake_fps = 30); + Error append_from_file(String p_path, Ref<GLTFState> r_state, uint32_t p_flags = 0, String p_base_path = String()); + Error append_from_buffer(PackedByteArray p_bytes, String p_base_path, Ref<GLTFState> r_state, uint32_t p_flags = 0); + Error append_from_scene(Node *p_node, Ref<GLTFState> r_state, uint32_t p_flags = 0); public: - Node *generate_scene(Ref<GLTFState> state, int32_t p_bake_fps = 30.0f); + Node *generate_scene(Ref<GLTFState> state, float p_bake_fps = 30.0f, bool p_trimming = false); PackedByteArray generate_buffer(Ref<GLTFState> state); Error write_to_filesystem(Ref<GLTFState> state, const String &p_path); public: - Error _parse_gltf_state(Ref<GLTFState> state, const String &p_search_path, float p_bake_fps); + Error _parse_gltf_state(Ref<GLTFState> state, const String &p_search_path); Error _parse_gltf_extensions(Ref<GLTFState> state); void _process_mesh_instances(Ref<GLTFState> state, Node *scene_root); void _generate_scene_node(Ref<GLTFState> state, Node *scene_parent, @@ -310,7 +310,7 @@ public: const GLTFNodeIndex node_index); void _generate_skeleton_bone_node(Ref<GLTFState> state, Node *scene_parent, Node3D *scene_root, const GLTFNodeIndex node_index); void _import_animation(Ref<GLTFState> state, AnimationPlayer *ap, - const GLTFAnimationIndex index, const int bake_fps); + const GLTFAnimationIndex index, const float bake_fps, const bool trimming); void _convert_mesh_instances(Ref<GLTFState> state); GLTFCameraIndex _convert_camera(Ref<GLTFState> state, Camera3D *p_camera); void _convert_light_to_gltf(Light3D *light, Ref<GLTFState> state, Ref<GLTFNode> gltf_node); @@ -368,7 +368,7 @@ public: void _convert_animation(Ref<GLTFState> state, AnimationPlayer *ap, String p_animation_track_name); Error _serialize(Ref<GLTFState> state, const String &p_path); - Error _parse(Ref<GLTFState> state, String p_path, Ref<FileAccess> f, int p_bake_fps); + Error _parse(Ref<GLTFState> state, String p_path, Ref<FileAccess> f); }; #endif // GLTF_DOCUMENT_H diff --git a/modules/gridmap/editor/grid_map_editor_plugin.cpp b/modules/gridmap/editor/grid_map_editor_plugin.cpp index c8aedc8b92..89ef9ddd90 100644 --- a/modules/gridmap/editor/grid_map_editor_plugin.cpp +++ b/modules/gridmap/editor/grid_map_editor_plugin.cpp @@ -40,6 +40,8 @@ #include "editor/editor_undo_redo_manager.h" #include "editor/plugins/node_3d_editor_plugin.h" #include "scene/3d/camera_3d.h" +#include "scene/gui/menu_button.h" +#include "scene/gui/separator.h" #include "scene/main/window.h" void GridMapEditor::_node_removed(Node *p_node) { diff --git a/modules/mono/csharp_script.cpp b/modules/mono/csharp_script.cpp index a4bffc1e3c..137fd61a25 100644 --- a/modules/mono/csharp_script.cpp +++ b/modules/mono/csharp_script.cpp @@ -46,6 +46,7 @@ #include "editor/editor_internal_calls.h" #include "editor/editor_node.h" #include "editor/editor_settings.h" +#include "editor/inspector_dock.h" #include "editor/node_dock.h" #include "editor/script_templates/templates.gen.h" #endif @@ -390,10 +391,10 @@ bool CSharpLanguage::supports_builtin_mode() const { #ifdef TOOLS_ENABLED static String variant_type_to_managed_name(const String &p_var_type_name) { if (p_var_type_name.is_empty()) { - return "object"; + return "Variant"; } - if (!ClassDB::class_exists(p_var_type_name)) { + if (ClassDB::class_exists(p_var_type_name)) { return p_var_type_name; } @@ -401,12 +402,12 @@ static String variant_type_to_managed_name(const String &p_var_type_name) { return "Godot.Object"; } + if (p_var_type_name == Variant::get_type_name(Variant::INT)) { + return "long"; + } + if (p_var_type_name == Variant::get_type_name(Variant::FLOAT)) { -#ifdef REAL_T_IS_DOUBLE return "double"; -#else - return "float"; -#endif } if (p_var_type_name == Variant::get_type_name(Variant::STRING)) { @@ -484,7 +485,7 @@ static String variant_type_to_managed_name(const String &p_var_type_name) { } } - return "object"; + return "Variant"; } String CSharpLanguage::make_function(const String &, const String &p_name, const PackedStringArray &p_args) const { diff --git a/modules/mono/editor/Godot.NET.Sdk/Godot.NET.Sdk/Sdk/Sdk.props b/modules/mono/editor/Godot.NET.Sdk/Godot.NET.Sdk/Sdk/Sdk.props index 0459257106..0d0889c491 100644 --- a/modules/mono/editor/Godot.NET.Sdk/Godot.NET.Sdk/Sdk/Sdk.props +++ b/modules/mono/editor/Godot.NET.Sdk/Godot.NET.Sdk/Sdk/Sdk.props @@ -12,8 +12,7 @@ <Configurations>Debug;ExportDebug;ExportRelease</Configurations> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> - <GodotProjectDir Condition=" '$(SolutionDir)' != '' ">$(SolutionDir)</GodotProjectDir> - <GodotProjectDir Condition=" '$(SolutionDir)' == '' ">$(MSBuildProjectDirectory)</GodotProjectDir> + <GodotProjectDir Condition=" '$(GodotProjectDir)' == '' ">$(MSBuildProjectDirectory)</GodotProjectDir> <GodotProjectDir>$([MSBuild]::EnsureTrailingSlash('$(GodotProjectDir)'))</GodotProjectDir> <!-- Custom output paths for Godot projects. In brief, 'bin\' and 'obj\' are moved to '$(GodotProjectDir)\.godot\mono\temp\'. --> diff --git a/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators.Sample/ExportedProperties.cs b/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators.Sample/ExportedProperties.cs index 3020cfbc50..eb83833b40 100644 --- a/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators.Sample/ExportedProperties.cs +++ b/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators.Sample/ExportedProperties.cs @@ -12,6 +12,95 @@ namespace Godot.SourceGenerators.Sample [SuppressMessage("ReSharper", "InconsistentNaming")] public partial class ExportedProperties : Godot.Object { + // Do not generate default value + private String _notGenerate_Property_String = new string("not generate"); + [Export] + public String NotGenerate_Complex_Lamda_Property + { + get => _notGenerate_Property_String + Convert.ToInt32("1"); + set => _notGenerate_Property_String = value; + } + + [Export] + public String NotGenerate_Lamda_NoField_Property + { + get => new string("not generate"); + set => _notGenerate_Property_String = value; + } + + [Export] + public String NotGenerate_Complex_Return_Property + { + get + { + return _notGenerate_Property_String + Convert.ToInt32("1"); + } + set + { + _notGenerate_Property_String = value; + } + } + + private int _notGenerate_Property_Int = 1; + [Export] + public string NotGenerate_Returns_Property + { + get + { + if (_notGenerate_Property_Int == 1) + { + return "a"; + } + else + { + return "b"; + } + } + set + { + _notGenerate_Property_Int = value == "a" ? 1 : 2; + } + } + + // Full Property + private String _fullProperty_String = "FullProperty_String"; + [Export] + public String FullProperty_String + { + get + { + return _fullProperty_String; + } + set + { + _fullProperty_String = value; + } + } + + private String _fullProperty_String_Complex = new string("FullProperty_String_Complex") + Convert.ToInt32("1"); + [Export] + public String FullProperty_String_Complex + { + get + { + return _fullProperty_String_Complex; + } + set + { + _fullProperty_String_Complex = value; + } + } + + // Lamda Property + private String _lamdaProperty_String = "LamdaProperty_String"; + [Export] + public String LamdaProperty_String + { + get => _lamdaProperty_String; + set => _lamdaProperty_String = value; + } + + // Auto Property [Export] private Boolean property_Boolean { get; set; } = true; [Export] private Char property_Char { get; set; } = 'f'; [Export] private SByte property_SByte { get; set; } = 10; diff --git a/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/ExtensionMethods.cs b/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/ExtensionMethods.cs index 7008fb638f..d67e57edc2 100644 --- a/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/ExtensionMethods.cs +++ b/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/ExtensionMethods.cs @@ -268,8 +268,9 @@ namespace Godot.SourceGenerators if (parameters.Length > paramTypes.Length) return null; // Ignore incompatible method - return new GodotMethodData(method, paramTypes, parameters - .Select(p => p.Type).ToImmutableArray(), retType, retSymbol); + return new GodotMethodData(method, paramTypes, + parameters.Select(p => p.Type).ToImmutableArray(), + retType != null ? (retType.Value, retSymbol) : null); } public static IEnumerable<GodotMethodData> WhereHasGodotCompatibleSignature( @@ -330,10 +331,10 @@ namespace Godot.SourceGenerators public static string Path(this Location location) => location.SourceTree?.GetLineSpan(location.SourceSpan).Path - ?? location.GetLineSpan().Path; + ?? location.GetLineSpan().Path; public static int StartLine(this Location location) => location.SourceTree?.GetLineSpan(location.SourceSpan).StartLinePosition.Line - ?? location.GetLineSpan().StartLinePosition.Line; + ?? location.GetLineSpan().StartLinePosition.Line; } } diff --git a/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/GodotMemberData.cs b/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/GodotMemberData.cs index abd8079922..0760ea11bb 100644 --- a/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/GodotMemberData.cs +++ b/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/GodotMemberData.cs @@ -6,20 +6,18 @@ namespace Godot.SourceGenerators public readonly struct GodotMethodData { public GodotMethodData(IMethodSymbol method, ImmutableArray<MarshalType> paramTypes, - ImmutableArray<ITypeSymbol> paramTypeSymbols, MarshalType? retType, ITypeSymbol? retSymbol) + ImmutableArray<ITypeSymbol> paramTypeSymbols, (MarshalType MarshalType, ITypeSymbol TypeSymbol)? retType) { Method = method; ParamTypes = paramTypes; ParamTypeSymbols = paramTypeSymbols; RetType = retType; - RetSymbol = retSymbol; } public IMethodSymbol Method { get; } public ImmutableArray<MarshalType> ParamTypes { get; } public ImmutableArray<ITypeSymbol> ParamTypeSymbols { get; } - public MarshalType? RetType { get; } - public ITypeSymbol? RetSymbol { get; } + public (MarshalType MarshalType, ITypeSymbol TypeSymbol)? RetType { get; } } public readonly struct GodotSignalDelegateData diff --git a/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/MarshalUtils.cs b/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/MarshalUtils.cs index 4fdd40f638..5b3f677f87 100644 --- a/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/MarshalUtils.cs +++ b/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/MarshalUtils.cs @@ -304,240 +304,33 @@ namespace Godot.SourceGenerators { return marshalType switch { - MarshalType.Boolean => - source.Append(VariantUtils, ".ConvertToBool(", inputExpr, ")"), - MarshalType.Char => - source.Append("(char)", VariantUtils, ".ConvertToUInt16(", inputExpr, ")"), - MarshalType.SByte => - source.Append(VariantUtils, ".ConvertToInt8(", inputExpr, ")"), - MarshalType.Int16 => - source.Append(VariantUtils, ".ConvertToInt16(", inputExpr, ")"), - MarshalType.Int32 => - source.Append(VariantUtils, ".ConvertToInt32(", inputExpr, ")"), - MarshalType.Int64 => - source.Append(VariantUtils, ".ConvertToInt64(", inputExpr, ")"), - MarshalType.Byte => - source.Append(VariantUtils, ".ConvertToUInt8(", inputExpr, ")"), - MarshalType.UInt16 => - source.Append(VariantUtils, ".ConvertToUInt16(", inputExpr, ")"), - MarshalType.UInt32 => - source.Append(VariantUtils, ".ConvertToUInt32(", inputExpr, ")"), - MarshalType.UInt64 => - source.Append(VariantUtils, ".ConvertToUInt64(", inputExpr, ")"), - MarshalType.Single => - source.Append(VariantUtils, ".ConvertToFloat32(", inputExpr, ")"), - MarshalType.Double => - source.Append(VariantUtils, ".ConvertToFloat64(", inputExpr, ")"), - MarshalType.String => - source.Append(VariantUtils, ".ConvertToStringObject(", inputExpr, ")"), - MarshalType.Vector2 => - source.Append(VariantUtils, ".ConvertToVector2(", inputExpr, ")"), - MarshalType.Vector2i => - source.Append(VariantUtils, ".ConvertToVector2i(", inputExpr, ")"), - MarshalType.Rect2 => - source.Append(VariantUtils, ".ConvertToRect2(", inputExpr, ")"), - MarshalType.Rect2i => - source.Append(VariantUtils, ".ConvertToRect2i(", inputExpr, ")"), - MarshalType.Transform2D => - source.Append(VariantUtils, ".ConvertToTransform2D(", inputExpr, ")"), - MarshalType.Vector3 => - source.Append(VariantUtils, ".ConvertToVector3(", inputExpr, ")"), - MarshalType.Vector3i => - source.Append(VariantUtils, ".ConvertToVector3i(", inputExpr, ")"), - MarshalType.Basis => - source.Append(VariantUtils, ".ConvertToBasis(", inputExpr, ")"), - MarshalType.Quaternion => - source.Append(VariantUtils, ".ConvertToQuaternion(", inputExpr, ")"), - MarshalType.Transform3D => - source.Append(VariantUtils, ".ConvertToTransform3D(", inputExpr, ")"), - MarshalType.Vector4 => - source.Append(VariantUtils, ".ConvertToVector4(", inputExpr, ")"), - MarshalType.Vector4i => - source.Append(VariantUtils, ".ConvertToVector4i(", inputExpr, ")"), - MarshalType.Projection => - source.Append(VariantUtils, ".ConvertToProjection(", inputExpr, ")"), - MarshalType.AABB => - source.Append(VariantUtils, ".ConvertToAABB(", inputExpr, ")"), - MarshalType.Color => - source.Append(VariantUtils, ".ConvertToColor(", inputExpr, ")"), - MarshalType.Plane => - source.Append(VariantUtils, ".ConvertToPlane(", inputExpr, ")"), - MarshalType.Callable => - source.Append(VariantUtils, ".ConvertToCallableManaged(", inputExpr, ")"), - MarshalType.SignalInfo => - source.Append(VariantUtils, ".ConvertToSignalInfo(", inputExpr, ")"), - MarshalType.Enum => - source.Append("(", typeSymbol.FullQualifiedNameIncludeGlobal(), - ")", VariantUtils, ".ConvertToInt32(", inputExpr, ")"), - MarshalType.ByteArray => - source.Append(VariantUtils, ".ConvertAsPackedByteArrayToSystemArray(", inputExpr, ")"), - MarshalType.Int32Array => - source.Append(VariantUtils, ".ConvertAsPackedInt32ArrayToSystemArray(", inputExpr, ")"), - MarshalType.Int64Array => - source.Append(VariantUtils, ".ConvertAsPackedInt64ArrayToSystemArray(", inputExpr, ")"), - MarshalType.Float32Array => - source.Append(VariantUtils, ".ConvertAsPackedFloat32ArrayToSystemArray(", inputExpr, ")"), - MarshalType.Float64Array => - source.Append(VariantUtils, ".ConvertAsPackedFloat64ArrayToSystemArray(", inputExpr, ")"), - MarshalType.StringArray => - source.Append(VariantUtils, ".ConvertAsPackedStringArrayToSystemArray(", inputExpr, ")"), - MarshalType.Vector2Array => - source.Append(VariantUtils, ".ConvertAsPackedVector2ArrayToSystemArray(", inputExpr, ")"), - MarshalType.Vector3Array => - source.Append(VariantUtils, ".ConvertAsPackedVector3ArrayToSystemArray(", inputExpr, ")"), - MarshalType.ColorArray => - source.Append(VariantUtils, ".ConvertAsPackedColorArrayToSystemArray(", inputExpr, ")"), - MarshalType.GodotObjectOrDerivedArray => - source.Append(VariantUtils, ".ConvertToSystemArrayOfGodotObject<", - ((IArrayTypeSymbol)typeSymbol).ElementType.FullQualifiedNameIncludeGlobal(), ">(", inputExpr, ")"), - MarshalType.SystemArrayOfStringName => - source.Append(VariantUtils, ".ConvertToSystemArrayOfStringName(", inputExpr, ")"), - MarshalType.SystemArrayOfNodePath => - source.Append(VariantUtils, ".ConvertToSystemArrayOfNodePath(", inputExpr, ")"), - MarshalType.SystemArrayOfRID => - source.Append(VariantUtils, ".ConvertToSystemArrayOfRID(", inputExpr, ")"), - MarshalType.Variant => - source.Append("global::Godot.Variant.CreateCopyingBorrowed(", inputExpr, ")"), - MarshalType.GodotObjectOrDerived => - source.Append("(", typeSymbol.FullQualifiedNameIncludeGlobal(), - ")", VariantUtils, ".ConvertToGodotObject(", inputExpr, ")"), - MarshalType.StringName => - source.Append(VariantUtils, ".ConvertToStringNameObject(", inputExpr, ")"), - MarshalType.NodePath => - source.Append(VariantUtils, ".ConvertToNodePathObject(", inputExpr, ")"), - MarshalType.RID => - source.Append(VariantUtils, ".ConvertToRID(", inputExpr, ")"), - MarshalType.GodotDictionary => - source.Append(VariantUtils, ".ConvertToDictionaryObject(", inputExpr, ")"), - MarshalType.GodotArray => - source.Append(VariantUtils, ".ConvertToArrayObject(", inputExpr, ")"), + // For generic Godot collections, VariantUtils.ConvertTo<T> is slower, so we need this special case MarshalType.GodotGenericDictionary => source.Append(VariantUtils, ".ConvertToDictionaryObject<", ((INamedTypeSymbol)typeSymbol).TypeArguments[0].FullQualifiedNameIncludeGlobal(), ", ", - ((INamedTypeSymbol)typeSymbol).TypeArguments[1].FullQualifiedNameIncludeGlobal(), ">(", inputExpr, ")"), + ((INamedTypeSymbol)typeSymbol).TypeArguments[1].FullQualifiedNameIncludeGlobal(), ">(", + inputExpr, ")"), MarshalType.GodotGenericArray => source.Append(VariantUtils, ".ConvertToArrayObject<", - ((INamedTypeSymbol)typeSymbol).TypeArguments[0].FullQualifiedNameIncludeGlobal(), ">(", inputExpr, ")"), - _ => throw new ArgumentOutOfRangeException(nameof(marshalType), marshalType, - "Received unexpected marshal type") + ((INamedTypeSymbol)typeSymbol).TypeArguments[0].FullQualifiedNameIncludeGlobal(), ">(", + inputExpr, ")"), + _ => source.Append(VariantUtils, ".ConvertTo<", + typeSymbol.FullQualifiedNameIncludeGlobal(), ">(", inputExpr, ")"), }; } - public static StringBuilder AppendManagedToNativeVariantExpr( - this StringBuilder source, string inputExpr, MarshalType marshalType) + public static StringBuilder AppendManagedToNativeVariantExpr(this StringBuilder source, + string inputExpr, ITypeSymbol typeSymbol, MarshalType marshalType) { return marshalType switch { - MarshalType.Boolean => - source.Append(VariantUtils, ".CreateFromBool(", inputExpr, ")"), - MarshalType.Char => - source.Append(VariantUtils, ".CreateFromInt((ushort)", inputExpr, ")"), - MarshalType.SByte => - source.Append(VariantUtils, ".CreateFromInt(", inputExpr, ")"), - MarshalType.Int16 => - source.Append(VariantUtils, ".CreateFromInt(", inputExpr, ")"), - MarshalType.Int32 => - source.Append(VariantUtils, ".CreateFromInt(", inputExpr, ")"), - MarshalType.Int64 => - source.Append(VariantUtils, ".CreateFromInt(", inputExpr, ")"), - MarshalType.Byte => - source.Append(VariantUtils, ".CreateFromInt(", inputExpr, ")"), - MarshalType.UInt16 => - source.Append(VariantUtils, ".CreateFromInt(", inputExpr, ")"), - MarshalType.UInt32 => - source.Append(VariantUtils, ".CreateFromInt(", inputExpr, ")"), - MarshalType.UInt64 => - source.Append(VariantUtils, ".CreateFromInt(", inputExpr, ")"), - MarshalType.Single => - source.Append(VariantUtils, ".CreateFromFloat(", inputExpr, ")"), - MarshalType.Double => - source.Append(VariantUtils, ".CreateFromFloat(", inputExpr, ")"), - MarshalType.String => - source.Append(VariantUtils, ".CreateFromString(", inputExpr, ")"), - MarshalType.Vector2 => - source.Append(VariantUtils, ".CreateFromVector2(", inputExpr, ")"), - MarshalType.Vector2i => - source.Append(VariantUtils, ".CreateFromVector2i(", inputExpr, ")"), - MarshalType.Rect2 => - source.Append(VariantUtils, ".CreateFromRect2(", inputExpr, ")"), - MarshalType.Rect2i => - source.Append(VariantUtils, ".CreateFromRect2i(", inputExpr, ")"), - MarshalType.Transform2D => - source.Append(VariantUtils, ".CreateFromTransform2D(", inputExpr, ")"), - MarshalType.Vector3 => - source.Append(VariantUtils, ".CreateFromVector3(", inputExpr, ")"), - MarshalType.Vector3i => - source.Append(VariantUtils, ".CreateFromVector3i(", inputExpr, ")"), - MarshalType.Basis => - source.Append(VariantUtils, ".CreateFromBasis(", inputExpr, ")"), - MarshalType.Quaternion => - source.Append(VariantUtils, ".CreateFromQuaternion(", inputExpr, ")"), - MarshalType.Transform3D => - source.Append(VariantUtils, ".CreateFromTransform3D(", inputExpr, ")"), - MarshalType.Vector4 => - source.Append(VariantUtils, ".CreateFromVector4(", inputExpr, ")"), - MarshalType.Vector4i => - source.Append(VariantUtils, ".CreateFromVector4i(", inputExpr, ")"), - MarshalType.Projection => - source.Append(VariantUtils, ".CreateFromProjection(", inputExpr, ")"), - MarshalType.AABB => - source.Append(VariantUtils, ".CreateFromAABB(", inputExpr, ")"), - MarshalType.Color => - source.Append(VariantUtils, ".CreateFromColor(", inputExpr, ")"), - MarshalType.Plane => - source.Append(VariantUtils, ".CreateFromPlane(", inputExpr, ")"), - MarshalType.Callable => - source.Append(VariantUtils, ".CreateFromCallable(", inputExpr, ")"), - MarshalType.SignalInfo => - source.Append(VariantUtils, ".CreateFromSignalInfo(", inputExpr, ")"), - MarshalType.Enum => - source.Append(VariantUtils, ".CreateFromInt((int)", inputExpr, ")"), - MarshalType.ByteArray => - source.Append(VariantUtils, ".CreateFromPackedByteArray(", inputExpr, ")"), - MarshalType.Int32Array => - source.Append(VariantUtils, ".CreateFromPackedInt32Array(", inputExpr, ")"), - MarshalType.Int64Array => - source.Append(VariantUtils, ".CreateFromPackedInt64Array(", inputExpr, ")"), - MarshalType.Float32Array => - source.Append(VariantUtils, ".CreateFromPackedFloat32Array(", inputExpr, ")"), - MarshalType.Float64Array => - source.Append(VariantUtils, ".CreateFromPackedFloat64Array(", inputExpr, ")"), - MarshalType.StringArray => - source.Append(VariantUtils, ".CreateFromPackedStringArray(", inputExpr, ")"), - MarshalType.Vector2Array => - source.Append(VariantUtils, ".CreateFromPackedVector2Array(", inputExpr, ")"), - MarshalType.Vector3Array => - source.Append(VariantUtils, ".CreateFromPackedVector3Array(", inputExpr, ")"), - MarshalType.ColorArray => - source.Append(VariantUtils, ".CreateFromPackedColorArray(", inputExpr, ")"), - MarshalType.GodotObjectOrDerivedArray => - source.Append(VariantUtils, ".CreateFromSystemArrayOfGodotObject(", inputExpr, ")"), - MarshalType.SystemArrayOfStringName => - source.Append(VariantUtils, ".CreateFromSystemArrayOfStringName(", inputExpr, ")"), - MarshalType.SystemArrayOfNodePath => - source.Append(VariantUtils, ".CreateFromSystemArrayOfNodePath(", inputExpr, ")"), - MarshalType.SystemArrayOfRID => - source.Append(VariantUtils, ".CreateFromSystemArrayOfRID(", inputExpr, ")"), - MarshalType.Variant => - source.Append(inputExpr, ".CopyNativeVariant()"), - MarshalType.GodotObjectOrDerived => - source.Append(VariantUtils, ".CreateFromGodotObject(", inputExpr, ")"), - MarshalType.StringName => - source.Append(VariantUtils, ".CreateFromStringName(", inputExpr, ")"), - MarshalType.NodePath => - source.Append(VariantUtils, ".CreateFromNodePath(", inputExpr, ")"), - MarshalType.RID => - source.Append(VariantUtils, ".CreateFromRID(", inputExpr, ")"), - MarshalType.GodotDictionary => - source.Append(VariantUtils, ".CreateFromDictionary(", inputExpr, ")"), - MarshalType.GodotArray => - source.Append(VariantUtils, ".CreateFromArray(", inputExpr, ")"), + // For generic Godot collections, VariantUtils.CreateFrom<T> is slower, so we need this special case MarshalType.GodotGenericDictionary => source.Append(VariantUtils, ".CreateFromDictionary(", inputExpr, ")"), MarshalType.GodotGenericArray => source.Append(VariantUtils, ".CreateFromArray(", inputExpr, ")"), - _ => throw new ArgumentOutOfRangeException(nameof(marshalType), marshalType, - "Received unexpected marshal type") + _ => source.Append(VariantUtils, ".CreateFrom<", + typeSymbol.FullQualifiedNameIncludeGlobal(), ">(", inputExpr, ")"), }; } @@ -546,137 +339,30 @@ namespace Godot.SourceGenerators { return marshalType switch { - MarshalType.Boolean => source.Append(inputExpr, ".AsBool()"), - MarshalType.Char => source.Append(inputExpr, ".AsChar()"), - MarshalType.SByte => source.Append(inputExpr, ".AsSByte()"), - MarshalType.Int16 => source.Append(inputExpr, ".AsInt16()"), - MarshalType.Int32 => source.Append(inputExpr, ".AsInt32()"), - MarshalType.Int64 => source.Append(inputExpr, ".AsInt64()"), - MarshalType.Byte => source.Append(inputExpr, ".AsByte()"), - MarshalType.UInt16 => source.Append(inputExpr, ".AsUInt16()"), - MarshalType.UInt32 => source.Append(inputExpr, ".AsUInt32()"), - MarshalType.UInt64 => source.Append(inputExpr, ".AsUInt64()"), - MarshalType.Single => source.Append(inputExpr, ".AsSingle()"), - MarshalType.Double => source.Append(inputExpr, ".AsDouble()"), - MarshalType.String => source.Append(inputExpr, ".AsString()"), - MarshalType.Vector2 => source.Append(inputExpr, ".AsVector2()"), - MarshalType.Vector2i => source.Append(inputExpr, ".AsVector2i()"), - MarshalType.Rect2 => source.Append(inputExpr, ".AsRect2()"), - MarshalType.Rect2i => source.Append(inputExpr, ".AsRect2i()"), - MarshalType.Transform2D => source.Append(inputExpr, ".AsTransform2D()"), - MarshalType.Vector3 => source.Append(inputExpr, ".AsVector3()"), - MarshalType.Vector3i => source.Append(inputExpr, ".AsVector3i()"), - MarshalType.Basis => source.Append(inputExpr, ".AsBasis()"), - MarshalType.Quaternion => source.Append(inputExpr, ".AsQuaternion()"), - MarshalType.Transform3D => source.Append(inputExpr, ".AsTransform3D()"), - MarshalType.Vector4 => source.Append(inputExpr, ".AsVector4()"), - MarshalType.Vector4i => source.Append(inputExpr, ".AsVector4i()"), - MarshalType.Projection => source.Append(inputExpr, ".AsProjection()"), - MarshalType.AABB => source.Append(inputExpr, ".AsAABB()"), - MarshalType.Color => source.Append(inputExpr, ".AsColor()"), - MarshalType.Plane => source.Append(inputExpr, ".AsPlane()"), - MarshalType.Callable => source.Append(inputExpr, ".AsCallable()"), - MarshalType.SignalInfo => source.Append(inputExpr, ".AsSignalInfo()"), - MarshalType.Enum => - source.Append("(", typeSymbol.FullQualifiedNameIncludeGlobal(), ")", inputExpr, ".AsInt64()"), - MarshalType.ByteArray => source.Append(inputExpr, ".AsByteArray()"), - MarshalType.Int32Array => source.Append(inputExpr, ".AsInt32Array()"), - MarshalType.Int64Array => source.Append(inputExpr, ".AsInt64Array()"), - MarshalType.Float32Array => source.Append(inputExpr, ".AsFloat32Array()"), - MarshalType.Float64Array => source.Append(inputExpr, ".AsFloat64Array()"), - MarshalType.StringArray => source.Append(inputExpr, ".AsStringArray()"), - MarshalType.Vector2Array => source.Append(inputExpr, ".AsVector2Array()"), - MarshalType.Vector3Array => source.Append(inputExpr, ".AsVector3Array()"), - MarshalType.ColorArray => source.Append(inputExpr, ".AsColorArray()"), - MarshalType.GodotObjectOrDerivedArray => source.Append(inputExpr, ".AsGodotObjectArray<", - ((IArrayTypeSymbol)typeSymbol).ElementType.FullQualifiedNameIncludeGlobal(), ">()"), - MarshalType.SystemArrayOfStringName => source.Append(inputExpr, ".AsSystemArrayOfStringName()"), - MarshalType.SystemArrayOfNodePath => source.Append(inputExpr, ".AsSystemArrayOfNodePath()"), - MarshalType.SystemArrayOfRID => source.Append(inputExpr, ".AsSystemArrayOfRID()"), - MarshalType.Variant => source.Append(inputExpr), - MarshalType.GodotObjectOrDerived => source.Append("(", - typeSymbol.FullQualifiedNameIncludeGlobal(), ")", inputExpr, ".AsGodotObject()"), - MarshalType.StringName => source.Append(inputExpr, ".AsStringName()"), - MarshalType.NodePath => source.Append(inputExpr, ".AsNodePath()"), - MarshalType.RID => source.Append(inputExpr, ".AsRID()"), - MarshalType.GodotDictionary => source.Append(inputExpr, ".AsGodotDictionary()"), - MarshalType.GodotArray => source.Append(inputExpr, ".AsGodotArray()"), - MarshalType.GodotGenericDictionary => source.Append(inputExpr, ".AsGodotDictionary<", - ((INamedTypeSymbol)typeSymbol).TypeArguments[0].FullQualifiedNameIncludeGlobal(), ", ", - ((INamedTypeSymbol)typeSymbol).TypeArguments[1].FullQualifiedNameIncludeGlobal(), ">()"), - MarshalType.GodotGenericArray => source.Append(inputExpr, ".AsGodotArray<", - ((INamedTypeSymbol)typeSymbol).TypeArguments[0].FullQualifiedNameIncludeGlobal(), ">()"), - _ => throw new ArgumentOutOfRangeException(nameof(marshalType), marshalType, - "Received unexpected marshal type") + // For generic Godot collections, Variant.As<T> is slower, so we need this special case + MarshalType.GodotGenericDictionary => + source.Append(inputExpr, ".AsGodotDictionary<", + ((INamedTypeSymbol)typeSymbol).TypeArguments[0].FullQualifiedNameIncludeGlobal(), ", ", + ((INamedTypeSymbol)typeSymbol).TypeArguments[1].FullQualifiedNameIncludeGlobal(), ">()"), + MarshalType.GodotGenericArray => + source.Append(inputExpr, ".AsGodotArray<", + ((INamedTypeSymbol)typeSymbol).TypeArguments[0].FullQualifiedNameIncludeGlobal(), ">()"), + _ => source.Append(inputExpr, ".As<", + typeSymbol.FullQualifiedNameIncludeGlobal(), ">()") }; } public static StringBuilder AppendManagedToVariantExpr(this StringBuilder source, - string inputExpr, MarshalType marshalType) + string inputExpr, ITypeSymbol typeSymbol, MarshalType marshalType) { - switch (marshalType) + return marshalType switch { - case MarshalType.Boolean: - case MarshalType.Char: - case MarshalType.SByte: - case MarshalType.Int16: - case MarshalType.Int32: - case MarshalType.Int64: - case MarshalType.Byte: - case MarshalType.UInt16: - case MarshalType.UInt32: - case MarshalType.UInt64: - case MarshalType.Single: - case MarshalType.Double: - case MarshalType.String: - case MarshalType.Vector2: - case MarshalType.Vector2i: - case MarshalType.Rect2: - case MarshalType.Rect2i: - case MarshalType.Transform2D: - case MarshalType.Vector3: - case MarshalType.Vector3i: - case MarshalType.Basis: - case MarshalType.Quaternion: - case MarshalType.Transform3D: - case MarshalType.Vector4: - case MarshalType.Vector4i: - case MarshalType.Projection: - case MarshalType.AABB: - case MarshalType.Color: - case MarshalType.Plane: - case MarshalType.Callable: - case MarshalType.SignalInfo: - case MarshalType.ByteArray: - case MarshalType.Int32Array: - case MarshalType.Int64Array: - case MarshalType.Float32Array: - case MarshalType.Float64Array: - case MarshalType.StringArray: - case MarshalType.Vector2Array: - case MarshalType.Vector3Array: - case MarshalType.ColorArray: - case MarshalType.GodotObjectOrDerivedArray: - case MarshalType.SystemArrayOfStringName: - case MarshalType.SystemArrayOfNodePath: - case MarshalType.SystemArrayOfRID: - case MarshalType.GodotObjectOrDerived: - case MarshalType.StringName: - case MarshalType.NodePath: - case MarshalType.RID: - case MarshalType.GodotDictionary: - case MarshalType.GodotArray: - case MarshalType.GodotGenericDictionary: - case MarshalType.GodotGenericArray: - return source.Append("Variant.CreateFrom(", inputExpr, ")"); - case MarshalType.Enum: - return source.Append("Variant.CreateFrom((long)", inputExpr, ")"); - case MarshalType.Variant: - return source.Append(inputExpr); - default: - throw new ArgumentOutOfRangeException(nameof(marshalType), marshalType, - "Received unexpected marshal type"); - } + // For generic Godot collections, Variant.From<T> is slower, so we need this special case + MarshalType.GodotGenericDictionary or MarshalType.GodotGenericArray => + source.Append("global::Godot.Variant.CreateFrom(", inputExpr, ")"), + _ => source.Append("global::Godot.Variant.From<", + typeSymbol.FullQualifiedNameIncludeGlobal(), ">(", inputExpr, ")") + }; } } } diff --git a/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/ScriptMethodsGenerator.cs b/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/ScriptMethodsGenerator.cs index 2f51018293..f79909589e 100644 --- a/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/ScriptMethodsGenerator.cs +++ b/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/ScriptMethodsGenerator.cs @@ -135,7 +135,8 @@ namespace Godot.SourceGenerators source.Append("#pragma warning disable CS0109 // Disable warning about redundant 'new' keyword\n"); - source.Append($" public new class MethodName : {symbol.BaseType.FullQualifiedNameIncludeGlobal()}.MethodName {{\n"); + source.Append( + $" public new class MethodName : {symbol.BaseType.FullQualifiedNameIncludeGlobal()}.MethodName {{\n"); // Generate cached StringNames for methods and properties, for fast lookup @@ -297,7 +298,7 @@ namespace Godot.SourceGenerators if (method.RetType != null) { - returnVal = DeterminePropertyInfo(method.RetType.Value, name: string.Empty); + returnVal = DeterminePropertyInfo(method.RetType.Value.MarshalType, name: string.Empty); } else { @@ -391,7 +392,8 @@ namespace Godot.SourceGenerators { source.Append(" ret = "); - source.AppendManagedToNativeVariantExpr("callRet", method.RetType.Value); + source.AppendManagedToNativeVariantExpr("callRet", + method.RetType.Value.TypeSymbol, method.RetType.Value.MarshalType); source.Append(";\n"); source.Append(" return true;\n"); diff --git a/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/ScriptPropertiesGenerator.cs b/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/ScriptPropertiesGenerator.cs index 5dd079bb17..6c4206a575 100644 --- a/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/ScriptPropertiesGenerator.cs +++ b/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/ScriptPropertiesGenerator.cs @@ -124,7 +124,8 @@ namespace Godot.SourceGenerators source.Append("#pragma warning disable CS0109 // Disable warning about redundant 'new' keyword\n"); - source.Append($" public new class PropertyName : {symbol.BaseType.FullQualifiedNameIncludeGlobal()}.PropertyName {{\n"); + source.Append( + $" public new class PropertyName : {symbol.BaseType.FullQualifiedNameIncludeGlobal()}.PropertyName {{\n"); // Generate cached StringNames for methods and properties, for fast lookup @@ -199,14 +200,14 @@ namespace Godot.SourceGenerators foreach (var property in godotClassProperties) { GeneratePropertyGetter(property.PropertySymbol.Name, - property.Type, source, isFirstEntry); + property.PropertySymbol.Type, property.Type, source, isFirstEntry); isFirstEntry = false; } foreach (var field in godotClassFields) { GeneratePropertyGetter(field.FieldSymbol.Name, - field.Type, source, isFirstEntry); + field.FieldSymbol.Type, field.Type, source, isFirstEntry); isFirstEntry = false; } @@ -292,7 +293,7 @@ namespace Godot.SourceGenerators source.Append("if (name == PropertyName.") .Append(propertyMemberName) .Append(") {\n") - .Append(" ") + .Append(" this.") .Append(propertyMemberName) .Append(" = ") .AppendNativeVariantToManagedExpr("value", propertyTypeSymbol, propertyMarshalType) @@ -303,6 +304,7 @@ namespace Godot.SourceGenerators private static void GeneratePropertyGetter( string propertyMemberName, + ITypeSymbol propertyTypeSymbol, MarshalType propertyMarshalType, StringBuilder source, bool isFirstEntry @@ -317,7 +319,8 @@ namespace Godot.SourceGenerators .Append(propertyMemberName) .Append(") {\n") .Append(" value = ") - .AppendManagedToNativeVariantExpr(propertyMemberName, propertyMarshalType) + .AppendManagedToNativeVariantExpr("this." + propertyMemberName, + propertyTypeSymbol, propertyMarshalType) .Append(";\n") .Append(" return true;\n") .Append(" }\n"); @@ -376,7 +379,8 @@ namespace Godot.SourceGenerators if (propertyUsage != PropertyUsageFlags.Category && attr.ConstructorArguments.Length > 1) hintString = attr.ConstructorArguments[1].Value?.ToString(); - yield return new PropertyInfo(VariantType.Nil, name, PropertyHint.None, hintString, propertyUsage.Value, true); + yield return new PropertyInfo(VariantType.Nil, name, PropertyHint.None, hintString, + propertyUsage.Value, true); } } } diff --git a/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/ScriptPropertyDefValGenerator.cs b/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/ScriptPropertyDefValGenerator.cs index 3d0055759e..aa9dd9583e 100644 --- a/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/ScriptPropertyDefValGenerator.cs +++ b/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/ScriptPropertyDefValGenerator.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; using Microsoft.CodeAnalysis; +using Microsoft.CodeAnalysis.CSharp; using Microsoft.CodeAnalysis.CSharp.Syntax; using Microsoft.CodeAnalysis.Text; @@ -77,10 +78,6 @@ namespace Godot.SourceGenerators var source = new StringBuilder(); - source.Append("using Godot;\n"); - source.Append("using Godot.NativeInterop;\n"); - source.Append("\n"); - if (hasNamespace) { source.Append("namespace "); @@ -163,19 +160,70 @@ namespace Godot.SourceGenerators continue; } - // TODO: Detect default value from simple property getters (currently we only detect from initializers) - - EqualsValueClauseSyntax? initializer = property.DeclaringSyntaxReferences - .Select(r => r.GetSyntax() as PropertyDeclarationSyntax) - .Select(s => s?.Initializer ?? null) - .FirstOrDefault(); + var propertyDeclarationSyntax = property.DeclaringSyntaxReferences + .Select(r => r.GetSyntax() as PropertyDeclarationSyntax).FirstOrDefault(); // Fully qualify the value to avoid issues with namespaces. string? value = null; - if (initializer != null) + if (propertyDeclarationSyntax != null) { - var sm = context.Compilation.GetSemanticModel(initializer.SyntaxTree); - value = initializer.Value.FullQualifiedSyntax(sm); + if (propertyDeclarationSyntax.Initializer != null) + { + var sm = context.Compilation.GetSemanticModel(propertyDeclarationSyntax.Initializer.SyntaxTree); + value = propertyDeclarationSyntax.Initializer.Value.FullQualifiedSyntax(sm); + } + else + { + var propertyGet = propertyDeclarationSyntax.AccessorList?.Accessors + .Where(a => a.Keyword.IsKind(SyntaxKind.GetKeyword)).FirstOrDefault(); + if (propertyGet != null) + { + if (propertyGet.ExpressionBody != null) + { + if (propertyGet.ExpressionBody.Expression is IdentifierNameSyntax identifierNameSyntax) + { + var sm = context.Compilation.GetSemanticModel(identifierNameSyntax.SyntaxTree); + var fieldSymbol = sm.GetSymbolInfo(identifierNameSyntax).Symbol as IFieldSymbol; + EqualsValueClauseSyntax? initializer = fieldSymbol?.DeclaringSyntaxReferences + .Select(r => r.GetSyntax()) + .OfType<VariableDeclaratorSyntax>() + .Select(s => s.Initializer) + .FirstOrDefault(i => i != null); + + if (initializer != null) + { + sm = context.Compilation.GetSemanticModel(initializer.SyntaxTree); + value = initializer.Value.FullQualifiedSyntax(sm); + } + } + } + else + { + var returns = propertyGet.DescendantNodes().OfType<ReturnStatementSyntax>(); + if (returns.Count() == 1) + { + // Generate only single return + var returnStatementSyntax = returns.Single(); + if (returnStatementSyntax.Expression is IdentifierNameSyntax identifierNameSyntax) + { + var sm = context.Compilation.GetSemanticModel(identifierNameSyntax.SyntaxTree); + var fieldSymbol = sm.GetSymbolInfo(identifierNameSyntax).Symbol as IFieldSymbol; + EqualsValueClauseSyntax? initializer = fieldSymbol?.DeclaringSyntaxReferences + .Select(r => r.GetSyntax()) + .OfType<VariableDeclaratorSyntax>() + .Select(s => s.Initializer) + .FirstOrDefault(i => i != null); + + if (initializer != null) + { + sm = context.Compilation.GetSemanticModel(initializer.SyntaxTree); + value = initializer.Value.FullQualifiedSyntax(sm); + } + } + } + } + } + } } exportedMembers.Add(new ExportedPropertyMetadata( @@ -231,7 +279,8 @@ namespace Godot.SourceGenerators { source.Append("#pragma warning disable CS0109 // Disable warning about redundant 'new' keyword\n"); - string dictionaryType = "System.Collections.Generic.Dictionary<StringName, object>"; + string dictionaryType = + "global::System.Collections.Generic.Dictionary<global::Godot.StringName, global::Godot.Variant>"; source.Append("#if TOOLS\n"); source.Append(" internal new static "); @@ -258,7 +307,8 @@ namespace Godot.SourceGenerators source.Append(" values.Add(PropertyName."); source.Append(exportedMember.Name); source.Append(", "); - source.Append(defaultValueLocalName); + source.AppendManagedToVariantExpr(defaultValueLocalName, + exportedMember.TypeSymbol, exportedMember.Type); source.Append(");\n"); } diff --git a/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/ScriptSerializationGenerator.cs b/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/ScriptSerializationGenerator.cs index ed877cbd17..821f3af75f 100644 --- a/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/ScriptSerializationGenerator.cs +++ b/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/ScriptSerializationGenerator.cs @@ -162,7 +162,8 @@ namespace Godot.SourceGenerators source.Append(" info.AddProperty(PropertyName.") .Append(propertyName) .Append(", ") - .AppendManagedToVariantExpr(string.Concat("this.", propertyName), property.Type) + .AppendManagedToVariantExpr(string.Concat("this.", propertyName), + property.PropertySymbol.Type, property.Type) .Append(");\n"); } @@ -175,7 +176,8 @@ namespace Godot.SourceGenerators source.Append(" info.AddProperty(PropertyName.") .Append(fieldName) .Append(", ") - .AppendManagedToVariantExpr(string.Concat("this.", fieldName), field.Type) + .AppendManagedToVariantExpr(string.Concat("this.", fieldName), + field.FieldSymbol.Type, field.Type) .Append(");\n"); } diff --git a/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/ScriptSignalsGenerator.cs b/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/ScriptSignalsGenerator.cs index 119cc9d4f0..ba6c10aa31 100644 --- a/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/ScriptSignalsGenerator.cs +++ b/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/ScriptSignalsGenerator.cs @@ -176,7 +176,8 @@ namespace Godot.SourceGenerators source.Append("#pragma warning disable CS0109 // Disable warning about redundant 'new' keyword\n"); - source.Append($" public new class SignalName : {symbol.BaseType.FullQualifiedNameIncludeGlobal()}.SignalName {{\n"); + source.Append( + $" public new class SignalName : {symbol.BaseType.FullQualifiedNameIncludeGlobal()}.SignalName {{\n"); // Generate cached StringNames for methods and properties, for fast lookup @@ -236,7 +237,8 @@ namespace Godot.SourceGenerators .Append(signalName) .Append(";\n"); - source.Append($" /// <inheritdoc cref=\"{signalDelegate.DelegateSymbol.FullQualifiedNameIncludeGlobal()}\"/>\n"); + source.Append( + $" /// <inheritdoc cref=\"{signalDelegate.DelegateSymbol.FullQualifiedNameIncludeGlobal()}\"/>\n"); source.Append(" public event ") .Append(signalDelegate.DelegateSymbol.FullQualifiedNameIncludeGlobal()) @@ -351,7 +353,7 @@ namespace Godot.SourceGenerators if (invokeMethodData.RetType != null) { - returnVal = DeterminePropertyInfo(invokeMethodData.RetType.Value, name: string.Empty); + returnVal = DeterminePropertyInfo(invokeMethodData.RetType.Value.MarshalType, name: string.Empty); } else { diff --git a/modules/mono/editor/GodotTools/GodotTools/GodotSharpEditor.cs b/modules/mono/editor/GodotTools/GodotTools/GodotSharpEditor.cs index 89364d1c02..de10c04e31 100644 --- a/modules/mono/editor/GodotTools/GodotTools/GodotSharpEditor.cs +++ b/modules/mono/editor/GodotTools/GodotTools/GodotSharpEditor.cs @@ -57,24 +57,22 @@ namespace GodotTools { pr.Step("Generating C# project...".TTR()); - string resourceDir = ProjectSettings.GlobalizePath("res://"); - - string path = resourceDir; + string csprojDir = Path.GetDirectoryName(GodotSharpDirs.ProjectCsProjPath); + string slnDir = Path.GetDirectoryName(GodotSharpDirs.ProjectSlnPath); string name = GodotSharpDirs.ProjectAssemblyName; - - string guid = CsProjOperations.GenerateGameProject(path, name); + string guid = CsProjOperations.GenerateGameProject(csprojDir, name); if (guid.Length > 0) { var solution = new DotNetSolution(name) { - DirectoryPath = path + DirectoryPath = slnDir }; var projectInfo = new DotNetSolution.ProjectInfo { Guid = guid, - PathRelativeToSolution = name + ".csproj", + PathRelativeToSolution = Path.GetRelativePath(slnDir, GodotSharpDirs.ProjectCsProjPath), Configs = new List<string> { "Debug", "ExportDebug", "ExportRelease" } }; @@ -375,6 +373,8 @@ namespace GodotTools { base._EnablePlugin(); + ProjectSettingsChanged += GodotSharpDirs.DetermineProjectLocation; + if (Instance != null) throw new InvalidOperationException(); Instance = this; @@ -455,7 +455,7 @@ namespace GodotTools _menuPopup.IdPressed += _MenuOptionPressed; // External editor settings - EditorDef("mono/editor/external_editor", ExternalEditorId.None); + EditorDef("mono/editor/external_editor", Variant.From(ExternalEditorId.None)); string settingsHintStr = "Disabled"; diff --git a/modules/mono/editor/GodotTools/GodotTools/Internals/Globals.cs b/modules/mono/editor/GodotTools/GodotTools/Internals/Globals.cs index acb7cc3ab0..45ae7eb86b 100644 --- a/modules/mono/editor/GodotTools/GodotTools/Internals/Globals.cs +++ b/modules/mono/editor/GodotTools/GodotTools/Internals/Globals.cs @@ -1,3 +1,4 @@ +using Godot; using Godot.NativeInterop; using System.Diagnostics.CodeAnalysis; using System.Runtime.CompilerServices; @@ -8,30 +9,31 @@ namespace GodotTools.Internals { public static float EditorScale => Internal.godot_icall_Globals_EditorScale(); - public static unsafe object GlobalDef(string setting, object defaultValue, bool restartIfChanged = false) + // ReSharper disable once UnusedMethodReturnValue.Global + public static Variant GlobalDef(string setting, Variant defaultValue, bool restartIfChanged = false) { using godot_string settingIn = Marshaling.ConvertStringToNative(setting); - using godot_variant defaultValueIn = Marshaling.ConvertManagedObjectToVariant(defaultValue); - Internal.godot_icall_Globals_GlobalDef(settingIn, defaultValueIn, restartIfChanged, out godot_variant result); - using (result) - return Marshaling.ConvertVariantToManagedObject(result); + using godot_variant defaultValueIn = defaultValue.CopyNativeVariant(); + Internal.godot_icall_Globals_GlobalDef(settingIn, defaultValueIn, restartIfChanged, + out godot_variant result); + return Variant.CreateTakingOwnershipOfDisposableValue(result); } - public static unsafe object EditorDef(string setting, object defaultValue, bool restartIfChanged = false) + // ReSharper disable once UnusedMethodReturnValue.Global + public static Variant EditorDef(string setting, Variant defaultValue, bool restartIfChanged = false) { using godot_string settingIn = Marshaling.ConvertStringToNative(setting); - using godot_variant defaultValueIn = Marshaling.ConvertManagedObjectToVariant(defaultValue); - Internal.godot_icall_Globals_EditorDef(settingIn, defaultValueIn, restartIfChanged, out godot_variant result); - using (result) - return Marshaling.ConvertVariantToManagedObject(result); + using godot_variant defaultValueIn = defaultValue.CopyNativeVariant(); + Internal.godot_icall_Globals_EditorDef(settingIn, defaultValueIn, restartIfChanged, + out godot_variant result); + return Variant.CreateTakingOwnershipOfDisposableValue(result); } - public static object EditorShortcut(string setting) + public static Variant EditorShortcut(string setting) { using godot_string settingIn = Marshaling.ConvertStringToNative(setting); Internal.godot_icall_Globals_EditorShortcut(settingIn, out godot_variant result); - using (result) - return Marshaling.ConvertVariantToManagedObject(result); + return Variant.CreateTakingOwnershipOfDisposableValue(result); } [SuppressMessage("ReSharper", "InconsistentNaming")] diff --git a/modules/mono/editor/GodotTools/GodotTools/Internals/GodotSharpDirs.cs b/modules/mono/editor/GodotTools/GodotTools/Internals/GodotSharpDirs.cs index 14285cc0f1..4e892be55c 100644 --- a/modules/mono/editor/GodotTools/GodotTools/Internals/GodotSharpDirs.cs +++ b/modules/mono/editor/GodotTools/GodotTools/Internals/GodotSharpDirs.cs @@ -52,10 +52,9 @@ namespace GodotTools.Internals { GlobalDef("dotnet/project/assembly_name", ""); GlobalDef("dotnet/project/solution_directory", ""); - GlobalDef("dotnet/project/c#_project_directory", ""); } - private static void DetermineProjectLocation() + public static void DetermineProjectLocation() { static string DetermineProjectName() { @@ -76,10 +75,11 @@ namespace GodotTools.Internals string slnParentDir = (string)ProjectSettings.GetSetting("dotnet/project/solution_directory"); if (string.IsNullOrEmpty(slnParentDir)) slnParentDir = "res://"; + else if (!slnParentDir.StartsWith("res://")) + slnParentDir = "res://" + slnParentDir; - string csprojParentDir = (string)ProjectSettings.GetSetting("dotnet/project/c#_project_directory"); - if (string.IsNullOrEmpty(csprojParentDir)) - csprojParentDir = "res://"; + // The csproj should be in the same folder as project.godot. + string csprojParentDir = "res://"; _projectSlnPath = Path.Combine(ProjectSettings.GlobalizePath(slnParentDir), string.Concat(_projectAssemblyName, ".sln")); diff --git a/modules/mono/editor/bindings_generator.cpp b/modules/mono/editor/bindings_generator.cpp index 9185506776..9f0bc3fbe3 100644 --- a/modules/mono/editor/bindings_generator.cpp +++ b/modules/mono/editor/bindings_generator.cpp @@ -2837,9 +2837,6 @@ bool BindingsGenerator::_populate_object_type_interfaces() { itype.is_ref_counted = ClassDB::is_parent_class(type_cname, name_cache.type_RefCounted); itype.memory_own = itype.is_ref_counted; - itype.cs_variant_to_managed = "(%1)VariantUtils.ConvertToGodotObject(%0)"; - itype.cs_managed_to_variant = "VariantUtils.CreateFromGodotObject(%0)"; - itype.c_out = "%5return "; itype.c_out += C_METHOD_UNMANAGED_GET_MANAGED; itype.c_out += itype.is_ref_counted ? "(%1.Reference);\n" : "(%1);\n"; @@ -3218,8 +3215,6 @@ bool BindingsGenerator::_populate_object_type_interfaces() { enum_itype.cname = StringName(enum_itype.name); enum_itype.proxy_name = itype.proxy_name + "." + enum_proxy_name; TypeInterface::postsetup_enum_type(enum_itype); - enum_itype.cs_variant_to_managed = "(%1)VariantUtils.ConvertToInt32(%0)"; - enum_itype.cs_managed_to_variant = "VariantUtils.CreateFromInt((int)%0)"; enum_types.insert(enum_itype.cname, enum_itype); } @@ -3448,16 +3443,14 @@ void BindingsGenerator::_populate_builtin_type_interfaces() { TypeInterface itype; -#define INSERT_STRUCT_TYPE(m_type) \ - { \ - itype = TypeInterface::create_value_type(String(#m_type)); \ - itype.c_type_in = #m_type "*"; \ - itype.c_type_out = itype.cs_type; \ - itype.cs_in_expr = "&%0"; \ - itype.cs_in_expr_is_unsafe = true; \ - itype.cs_variant_to_managed = "VariantUtils.ConvertTo%2(%0)"; \ - itype.cs_managed_to_variant = "VariantUtils.CreateFrom%2(%0)"; \ - builtin_types.insert(itype.cname, itype); \ +#define INSERT_STRUCT_TYPE(m_type) \ + { \ + itype = TypeInterface::create_value_type(String(#m_type)); \ + itype.c_type_in = #m_type "*"; \ + itype.c_type_out = itype.cs_type; \ + itype.cs_in_expr = "&%0"; \ + itype.cs_in_expr_is_unsafe = true; \ + builtin_types.insert(itype.cname, itype); \ } INSERT_STRUCT_TYPE(Vector2) @@ -3488,8 +3481,6 @@ void BindingsGenerator::_populate_builtin_type_interfaces() { itype.c_type_out = itype.c_type; itype.c_arg_in = "&%s"; itype.c_in_vararg = "%5using godot_variant %1_in = VariantUtils.CreateFromBool(%1);\n"; - itype.cs_variant_to_managed = "VariantUtils.ConvertToBool(%0)"; - itype.cs_managed_to_variant = "VariantUtils.CreateFromBool(%0)"; builtin_types.insert(itype.cname, itype); // Integer types @@ -3510,8 +3501,6 @@ void BindingsGenerator::_populate_builtin_type_interfaces() { itype.c_type_in = itype.name; \ itype.c_type_out = itype.name; \ itype.c_in_vararg = "%5using godot_variant %1_in = VariantUtils.CreateFromInt(%1);\n"; \ - itype.cs_variant_to_managed = "VariantUtils.ConvertTo" m_int_struct_name "(%0)"; \ - itype.cs_managed_to_variant = "VariantUtils.CreateFromInt(%0)"; \ builtin_types.insert(itype.cname, itype); \ } @@ -3547,8 +3536,6 @@ void BindingsGenerator::_populate_builtin_type_interfaces() { itype.c_type_in = itype.proxy_name; itype.c_type_out = itype.proxy_name; itype.c_in_vararg = "%5using godot_variant %1_in = VariantUtils.CreateFromFloat(%1);\n"; - itype.cs_variant_to_managed = "VariantUtils.ConvertToFloat32(%0)"; - itype.cs_managed_to_variant = "VariantUtils.CreateFromFloat(%0)"; builtin_types.insert(itype.cname, itype); // double @@ -3562,8 +3549,6 @@ void BindingsGenerator::_populate_builtin_type_interfaces() { itype.c_type_in = itype.proxy_name; itype.c_type_out = itype.proxy_name; itype.c_in_vararg = "%5using godot_variant %1_in = VariantUtils.CreateFromFloat(%1);\n"; - itype.cs_variant_to_managed = "VariantUtils.ConvertToFloat64(%0)"; - itype.cs_managed_to_variant = "VariantUtils.CreateFromFloat(%0)"; builtin_types.insert(itype.cname, itype); } @@ -3581,8 +3566,6 @@ void BindingsGenerator::_populate_builtin_type_interfaces() { itype.c_type_out = itype.cs_type; itype.c_type_is_disposable_struct = true; itype.c_in_vararg = "%5using godot_variant %1_in = VariantUtils.CreateFromString(%1);\n"; - itype.cs_variant_to_managed = "VariantUtils.ConvertToStringObject(%0)"; - itype.cs_managed_to_variant = "VariantUtils.CreateFromString(%0)"; builtin_types.insert(itype.cname, itype); // StringName @@ -3601,8 +3584,6 @@ void BindingsGenerator::_populate_builtin_type_interfaces() { itype.c_in_vararg = "%5using godot_variant %1_in = VariantUtils.CreateFromStringName(%1);\n"; itype.c_type_is_disposable_struct = false; // [c_out] takes ownership itype.c_ret_needs_default_initialization = true; - itype.cs_variant_to_managed = "VariantUtils.ConvertToStringNameObject(%0)"; - itype.cs_managed_to_variant = "VariantUtils.CreateFromStringName(%0)"; builtin_types.insert(itype.cname, itype); // NodePath @@ -3620,8 +3601,6 @@ void BindingsGenerator::_populate_builtin_type_interfaces() { itype.c_type_out = itype.cs_type; itype.c_type_is_disposable_struct = false; // [c_out] takes ownership itype.c_ret_needs_default_initialization = true; - itype.cs_variant_to_managed = "VariantUtils.ConvertToNodePathObject(%0)"; - itype.cs_managed_to_variant = "VariantUtils.CreateFromNodePath(%0)"; builtin_types.insert(itype.cname, itype); // RID @@ -3634,8 +3613,6 @@ void BindingsGenerator::_populate_builtin_type_interfaces() { itype.c_type = itype.cs_type; itype.c_type_in = itype.c_type; itype.c_type_out = itype.c_type; - itype.cs_variant_to_managed = "VariantUtils.ConvertToRID(%0)"; - itype.cs_managed_to_variant = "VariantUtils.CreateFromRID(%0)"; builtin_types.insert(itype.cname, itype); // Variant @@ -3652,8 +3629,6 @@ void BindingsGenerator::_populate_builtin_type_interfaces() { itype.c_type_out = itype.cs_type; itype.c_type_is_disposable_struct = false; // [c_out] takes ownership itype.c_ret_needs_default_initialization = true; - itype.cs_variant_to_managed = "Variant.CreateCopyingBorrowed(%0)"; - itype.cs_managed_to_variant = "%0.CopyNativeVariant()"; builtin_types.insert(itype.cname, itype); // Callable @@ -3666,8 +3641,6 @@ void BindingsGenerator::_populate_builtin_type_interfaces() { itype.c_type_in = "in " + itype.cs_type; itype.c_type_out = itype.cs_type; itype.c_type_is_disposable_struct = true; - itype.cs_variant_to_managed = "VariantUtils.ConvertToCallableManaged(%0)"; - itype.cs_managed_to_variant = "VariantUtils.CreateFromCallable(%0)"; builtin_types.insert(itype.cname, itype); // Signal @@ -3684,8 +3657,6 @@ void BindingsGenerator::_populate_builtin_type_interfaces() { itype.c_type_in = "in " + itype.cs_type; itype.c_type_out = itype.cs_type; itype.c_type_is_disposable_struct = true; - itype.cs_variant_to_managed = "VariantUtils.ConvertToSignalInfo(%0)"; - itype.cs_managed_to_variant = "VariantUtils.CreateFromSignalInfo(%0)"; builtin_types.insert(itype.cname, itype); // VarArg (fictitious type to represent variable arguments) @@ -3715,8 +3686,6 @@ void BindingsGenerator::_populate_builtin_type_interfaces() { itype.c_type_in = itype.proxy_name; \ itype.c_type_out = itype.proxy_name; \ itype.c_type_is_disposable_struct = true; \ - itype.cs_variant_to_managed = "VariantUtils.ConvertAs%2ToSystemArray(%0)"; \ - itype.cs_managed_to_variant = "VariantUtils.CreateFrom%2(%0)"; \ builtin_types.insert(itype.name, itype); \ } @@ -3752,8 +3721,6 @@ void BindingsGenerator::_populate_builtin_type_interfaces() { itype.c_type_out = itype.cs_type; itype.c_type_is_disposable_struct = false; // [c_out] takes ownership itype.c_ret_needs_default_initialization = true; - itype.cs_variant_to_managed = "VariantUtils.ConvertToArrayObject(%0)"; - itype.cs_managed_to_variant = "VariantUtils.CreateFromArray(%0)"; builtin_types.insert(itype.cname, itype); // Array_@generic @@ -3761,6 +3728,9 @@ void BindingsGenerator::_populate_builtin_type_interfaces() { itype.name = "Array_@generic"; itype.cname = itype.name; itype.cs_out = "%5return new %2(%0(%1));"; + // For generic Godot collections, Variant.From<T>/As<T> is slower, so we need this special case + itype.cs_variant_to_managed = "VariantUtils.ConvertToArrayObject(%0)"; + itype.cs_managed_to_variant = "VariantUtils.CreateFromArray(%0)"; builtin_types.insert(itype.cname, itype); // Dictionary @@ -3778,8 +3748,6 @@ void BindingsGenerator::_populate_builtin_type_interfaces() { itype.c_type_out = itype.cs_type; itype.c_type_is_disposable_struct = false; // [c_out] takes ownership itype.c_ret_needs_default_initialization = true; - itype.cs_variant_to_managed = "VariantUtils.ConvertToDictionaryObject(%0)"; - itype.cs_managed_to_variant = "VariantUtils.CreateFromDictionary(%0)"; builtin_types.insert(itype.cname, itype); // Dictionary_@generic @@ -3787,6 +3755,9 @@ void BindingsGenerator::_populate_builtin_type_interfaces() { itype.name = "Dictionary_@generic"; itype.cname = itype.name; itype.cs_out = "%5return new %2(%0(%1));"; + // For generic Godot collections, Variant.From<T>/As<T> is slower, so we need this special case + itype.cs_variant_to_managed = "VariantUtils.ConvertToDictionaryObject(%0)"; + itype.cs_managed_to_variant = "VariantUtils.CreateFromDictionary(%0)"; builtin_types.insert(itype.cname, itype); // void (fictitious type to represent the return type of methods that do not return anything) @@ -3852,8 +3823,6 @@ void BindingsGenerator::_populate_global_constants() { enum_itype.cname = ienum.cname; enum_itype.proxy_name = enum_itype.name; TypeInterface::postsetup_enum_type(enum_itype); - enum_itype.cs_variant_to_managed = "(%1)VariantUtils.ConvertToInt32(%0)"; - enum_itype.cs_managed_to_variant = "VariantUtils.CreateFromInt((int)%0)"; enum_types.insert(enum_itype.cname, enum_itype); int prefix_length = _determine_enum_prefix(ienum); @@ -3886,8 +3855,6 @@ void BindingsGenerator::_populate_global_constants() { enum_itype.cname = enum_cname; enum_itype.proxy_name = enum_itype.name; TypeInterface::postsetup_enum_type(enum_itype); - enum_itype.cs_variant_to_managed = "(%1)VariantUtils.ConvertToInt32(%0)"; - enum_itype.cs_managed_to_variant = "VariantUtils.CreateFromInt((int)%0)"; enum_types.insert(enum_itype.cname, enum_itype); } } diff --git a/modules/mono/editor/bindings_generator.h b/modules/mono/editor/bindings_generator.h index a479c44368..6d172f4fb8 100644 --- a/modules/mono/editor/bindings_generator.h +++ b/modules/mono/editor/bindings_generator.h @@ -209,7 +209,7 @@ class BindingsGenerator { String name; StringName cname; - int type_parameter_count; + int type_parameter_count = 0; /** * Identifier name of the base class. @@ -514,7 +514,12 @@ class BindingsGenerator { static void postsetup_enum_type(TypeInterface &r_enum_itype); - TypeInterface() {} + TypeInterface() { + static String default_cs_variant_to_managed = "VariantUtils.ConvertTo<%1>(%0)"; + static String default_cs_managed_to_variant = "VariantUtils.CreateFrom<%1>(%0)"; + cs_variant_to_managed = default_cs_variant_to_managed; + cs_managed_to_variant = default_cs_managed_to_variant; + } }; struct InternalCall { diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Array.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Array.cs index e3b7ac297d..130776499b 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Array.cs +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Array.cs @@ -418,8 +418,8 @@ namespace Godot.Collections { for (int i = 0; i < count; i++) { - object obj = Marshaling.ConvertVariantToManagedObject(NativeValue.DangerousSelfRef.Elements[i]); - array.SetValue(obj, index); + object boxedVariant = Variant.CreateCopyingBorrowed(NativeValue.DangerousSelfRef.Elements[i]); + array.SetValue(boxedVariant, index); index++; } } @@ -474,6 +474,11 @@ namespace Godot.Collections } } + internal interface IGenericGodotArray + { + public Array UnderlyingArray { get; } + } + /// <summary> /// Typed wrapper around Godot's Array class, an array of Variant /// typed elements allocated in the engine in C++. Useful when @@ -487,7 +492,8 @@ namespace Godot.Collections IList<T>, IReadOnlyList<T>, ICollection<T>, - IEnumerable<T> + IEnumerable<T>, + IGenericGodotArray { private static godot_variant ToVariantFunc(in Array<T> godotArray) => VariantUtils.CreateFromArray(godotArray); @@ -503,6 +509,8 @@ namespace Godot.Collections private readonly Array _underlyingArray; + Array IGenericGodotArray.UnderlyingArray => _underlyingArray; + internal ref godot_array.movable NativeValue { [MethodImpl(MethodImplOptions.AggressiveInlining)] diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Bridge/ScriptManagerBridge.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Bridge/ScriptManagerBridge.cs index d6fad391b6..e6a8054ae2 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Bridge/ScriptManagerBridge.cs +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Bridge/ScriptManagerBridge.cs @@ -159,7 +159,7 @@ namespace Godot.Bridge for (int i = 0; i < paramCount; i++) { - invokeParams[i] = Marshaling.ConvertVariantToManagedObjectOfType( + invokeParams[i] = DelegateUtils.RuntimeTypeConversionHelper.ConvertToObjectOfType( *args[i], parameters[i].ParameterType); } @@ -832,7 +832,8 @@ namespace Godot.Bridge } else { - interopProperties = ((godotsharp_property_info*)NativeMemory.Alloc((nuint)length, (nuint)sizeof(godotsharp_property_info)))!; + interopProperties = ((godotsharp_property_info*)NativeMemory.Alloc( + (nuint)length, (nuint)sizeof(godotsharp_property_info)))!; } try @@ -858,8 +859,8 @@ namespace Godot.Bridge addPropInfoFunc(scriptPtr, ¤tClassName, interopProperties, length); - // We're borrowing the StringName's without making an owning copy, so the - // managed collection needs to be kept alive until `addPropInfoFunc` returns. + // We're borrowing the native value of the StringName entries. + // The dictionary needs to be kept alive until `addPropInfoFunc` returns. GC.KeepAlive(properties); } finally @@ -884,12 +885,7 @@ namespace Godot.Bridge { // Careful with padding... public godot_string_name Name; // Not owned - public godot_variant Value; - - public void Dispose() - { - Value.Dispose(); - } + public godot_variant Value; // Not owned } [UnmanagedCallersOnly] @@ -928,10 +924,35 @@ namespace Godot.Bridge if (getGodotPropertyDefaultValuesMethod == null) return; - var defaultValues = (Dictionary<StringName, object>?) - getGodotPropertyDefaultValuesMethod.Invoke(null, null); + var defaultValuesObj = getGodotPropertyDefaultValuesMethod.Invoke(null, null); + + if (defaultValuesObj == null) + return; + + Dictionary<StringName, Variant> defaultValues; + + if (defaultValuesObj is Dictionary<StringName, object> defaultValuesLegacy) + { + // We have to support this for some time, otherwise this could cause data loss for projects + // built with previous releases. Ideally, we should remove this before Godot 4.0 stable. + + if (defaultValuesLegacy.Count <= 0) + return; - if (defaultValues == null || defaultValues.Count <= 0) + defaultValues = new(); + + foreach (var pair in defaultValuesLegacy) + { + defaultValues[pair.Key] = Variant.CreateTakingOwnershipOfDisposableValue( + DelegateUtils.RuntimeTypeConversionHelper.ConvertToVariant(pair.Value)); + } + } + else + { + defaultValues = (Dictionary<StringName, Variant>)defaultValuesObj; + } + + if (defaultValues.Count <= 0) return; int length = defaultValues.Count; @@ -952,7 +973,8 @@ namespace Godot.Bridge } else { - interopDefaultValues = ((godotsharp_property_def_val_pair*)NativeMemory.Alloc((nuint)length, (nuint)sizeof(godotsharp_property_def_val_pair)))!; + interopDefaultValues = ((godotsharp_property_def_val_pair*)NativeMemory.Alloc( + (nuint)length, (nuint)sizeof(godotsharp_property_def_val_pair)))!; } try @@ -963,7 +985,7 @@ namespace Godot.Bridge godotsharp_property_def_val_pair interopProperty = new() { Name = (godot_string_name)defaultValuePair.Key.NativeValue, // Not owned - Value = Marshaling.ConvertManagedObjectToVariant(defaultValuePair.Value) + Value = (godot_variant)defaultValuePair.Value.NativeVar // Not owned }; interopDefaultValues[i] = interopProperty; @@ -973,15 +995,12 @@ namespace Godot.Bridge addDefValFunc(scriptPtr, interopDefaultValues, length); - // We're borrowing the StringName's without making an owning copy, so the - // managed collection needs to be kept alive until `addDefValFunc` returns. + // We're borrowing the native value of the StringName and Variant entries. + // The dictionary needs to be kept alive until `addDefValFunc` returns. GC.KeepAlive(defaultValues); } finally { - for (int i = 0; i < length; i++) - interopDefaultValues[i].Dispose(); - if (!useStack) NativeMemory.Free(interopDefaultValues); } diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/DelegateUtils.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/DelegateUtils.cs index d19e0c08f2..a3cfecfaa6 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/Core/DelegateUtils.cs +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/DelegateUtils.cs @@ -186,7 +186,7 @@ namespace Godot writer.Write(field.Name); var fieldValue = field.GetValue(target); - using var fieldValueVariant = Marshaling.ConvertManagedObjectToVariant(fieldValue); + using var fieldValueVariant = RuntimeTypeConversionHelper.ConvertToVariant(fieldValue); byte[] valueBuffer = VarToBytes(fieldValueVariant); writer.Write(valueBuffer.Length); writer.Write(valueBuffer); @@ -443,7 +443,14 @@ namespace Godot FieldInfo? fieldInfo = targetType.GetField(name, BindingFlags.Instance | BindingFlags.Public); - fieldInfo?.SetValue(recreatedTarget, GD.BytesToVar(valueBuffer)); + + if (fieldInfo != null) + { + var variantValue = GD.BytesToVar(valueBuffer); + object? managedValue = RuntimeTypeConversionHelper.ConvertToObjectOfType( + (godot_variant)variantValue.NativeVar, fieldInfo.FieldType); + fieldInfo.SetValue(recreatedTarget, managedValue); + } } @delegate = Delegate.CreateDelegate(delegateType, recreatedTarget, methodInfo, @@ -537,5 +544,269 @@ namespace Godot return type; } + + internal static class RuntimeTypeConversionHelper + { + [SuppressMessage("ReSharper", "RedundantNameQualifier")] + public static godot_variant ConvertToVariant(object? obj) + { + if (obj == null) + return default; + + switch (obj) + { + case bool @bool: + return VariantUtils.CreateFrom(@bool); + case char @char: + return VariantUtils.CreateFrom(@char); + case sbyte int8: + return VariantUtils.CreateFrom(int8); + case short int16: + return VariantUtils.CreateFrom(int16); + case int int32: + return VariantUtils.CreateFrom(int32); + case long int64: + return VariantUtils.CreateFrom(int64); + case byte uint8: + return VariantUtils.CreateFrom(uint8); + case ushort uint16: + return VariantUtils.CreateFrom(uint16); + case uint uint32: + return VariantUtils.CreateFrom(uint32); + case ulong uint64: + return VariantUtils.CreateFrom(uint64); + case float @float: + return VariantUtils.CreateFrom(@float); + case double @double: + return VariantUtils.CreateFrom(@double); + case Vector2 vector2: + return VariantUtils.CreateFrom(vector2); + case Vector2i vector2I: + return VariantUtils.CreateFrom(vector2I); + case Rect2 rect2: + return VariantUtils.CreateFrom(rect2); + case Rect2i rect2I: + return VariantUtils.CreateFrom(rect2I); + case Transform2D transform2D: + return VariantUtils.CreateFrom(transform2D); + case Vector3 vector3: + return VariantUtils.CreateFrom(vector3); + case Vector3i vector3I: + return VariantUtils.CreateFrom(vector3I); + case Vector4 vector4: + return VariantUtils.CreateFrom(vector4); + case Vector4i vector4I: + return VariantUtils.CreateFrom(vector4I); + case Basis basis: + return VariantUtils.CreateFrom(basis); + case Quaternion quaternion: + return VariantUtils.CreateFrom(quaternion); + case Transform3D transform3d: + return VariantUtils.CreateFrom(transform3d); + case Projection projection: + return VariantUtils.CreateFrom(projection); + case AABB aabb: + return VariantUtils.CreateFrom(aabb); + case Color color: + return VariantUtils.CreateFrom(color); + case Plane plane: + return VariantUtils.CreateFrom(plane); + case Callable callable: + return VariantUtils.CreateFrom(callable); + case SignalInfo signalInfo: + return VariantUtils.CreateFrom(signalInfo); + case string @string: + return VariantUtils.CreateFrom(@string); + case byte[] byteArray: + return VariantUtils.CreateFrom(byteArray); + case int[] int32Array: + return VariantUtils.CreateFrom(int32Array); + case long[] int64Array: + return VariantUtils.CreateFrom(int64Array); + case float[] floatArray: + return VariantUtils.CreateFrom(floatArray); + case double[] doubleArray: + return VariantUtils.CreateFrom(doubleArray); + case string[] stringArray: + return VariantUtils.CreateFrom(stringArray); + case Vector2[] vector2Array: + return VariantUtils.CreateFrom(vector2Array); + case Vector3[] vector3Array: + return VariantUtils.CreateFrom(vector3Array); + case Color[] colorArray: + return VariantUtils.CreateFrom(colorArray); + case StringName[] stringNameArray: + return VariantUtils.CreateFrom(stringNameArray); + case NodePath[] nodePathArray: + return VariantUtils.CreateFrom(nodePathArray); + case RID[] ridArray: + return VariantUtils.CreateFrom(ridArray); + case Godot.Object[] godotObjectArray: + return VariantUtils.CreateFrom(godotObjectArray); + case StringName stringName: + return VariantUtils.CreateFrom(stringName); + case NodePath nodePath: + return VariantUtils.CreateFrom(nodePath); + case RID rid: + return VariantUtils.CreateFrom(rid); + case Collections.Dictionary godotDictionary: + return VariantUtils.CreateFrom(godotDictionary); + case Collections.Array godotArray: + return VariantUtils.CreateFrom(godotArray); + case Variant variant: + return VariantUtils.CreateFrom(variant); + case Godot.Object godotObject: + return VariantUtils.CreateFrom(godotObject); + case Enum @enum: + return VariantUtils.CreateFrom(Convert.ToInt64(@enum)); + case Collections.IGenericGodotDictionary godotDictionary: + return VariantUtils.CreateFrom(godotDictionary.UnderlyingDictionary); + case Collections.IGenericGodotArray godotArray: + return VariantUtils.CreateFrom(godotArray.UnderlyingArray); + } + + GD.PushError("Attempted to convert an unmarshallable managed type to Variant. Name: '" + + obj.GetType().FullName + "."); + return new godot_variant(); + } + + private delegate object? ConvertToSystemObjectFunc(in godot_variant managed); + + [SuppressMessage("ReSharper", "RedundantNameQualifier")] + // ReSharper disable once RedundantNameQualifier + private static readonly System.Collections.Generic.Dictionary<Type, ConvertToSystemObjectFunc> + ToSystemObjectFuncByType = new() + { + [typeof(bool)] = (in godot_variant variant) => VariantUtils.ConvertTo<bool>(variant), + [typeof(char)] = (in godot_variant variant) => VariantUtils.ConvertTo<char>(variant), + [typeof(sbyte)] = (in godot_variant variant) => VariantUtils.ConvertTo<sbyte>(variant), + [typeof(short)] = (in godot_variant variant) => VariantUtils.ConvertTo<short>(variant), + [typeof(int)] = (in godot_variant variant) => VariantUtils.ConvertTo<int>(variant), + [typeof(long)] = (in godot_variant variant) => VariantUtils.ConvertTo<long>(variant), + [typeof(byte)] = (in godot_variant variant) => VariantUtils.ConvertTo<byte>(variant), + [typeof(ushort)] = (in godot_variant variant) => VariantUtils.ConvertTo<ushort>(variant), + [typeof(uint)] = (in godot_variant variant) => VariantUtils.ConvertTo<uint>(variant), + [typeof(ulong)] = (in godot_variant variant) => VariantUtils.ConvertTo<ulong>(variant), + [typeof(float)] = (in godot_variant variant) => VariantUtils.ConvertTo<float>(variant), + [typeof(double)] = (in godot_variant variant) => VariantUtils.ConvertTo<double>(variant), + [typeof(Vector2)] = (in godot_variant variant) => VariantUtils.ConvertTo<Vector2>(variant), + [typeof(Vector2i)] = (in godot_variant variant) => VariantUtils.ConvertTo<Vector2i>(variant), + [typeof(Rect2)] = (in godot_variant variant) => VariantUtils.ConvertTo<Rect2>(variant), + [typeof(Rect2i)] = (in godot_variant variant) => VariantUtils.ConvertTo<Rect2i>(variant), + [typeof(Transform2D)] = (in godot_variant variant) => VariantUtils.ConvertTo<Transform2D>(variant), + [typeof(Vector3)] = (in godot_variant variant) => VariantUtils.ConvertTo<Vector3>(variant), + [typeof(Vector3i)] = (in godot_variant variant) => VariantUtils.ConvertTo<Vector3i>(variant), + [typeof(Basis)] = (in godot_variant variant) => VariantUtils.ConvertTo<Basis>(variant), + [typeof(Quaternion)] = (in godot_variant variant) => VariantUtils.ConvertTo<Quaternion>(variant), + [typeof(Transform3D)] = (in godot_variant variant) => VariantUtils.ConvertTo<Transform3D>(variant), + [typeof(Vector4)] = (in godot_variant variant) => VariantUtils.ConvertTo<Vector4>(variant), + [typeof(Vector4i)] = (in godot_variant variant) => VariantUtils.ConvertTo<Vector4i>(variant), + [typeof(AABB)] = (in godot_variant variant) => VariantUtils.ConvertTo<AABB>(variant), + [typeof(Color)] = (in godot_variant variant) => VariantUtils.ConvertTo<Color>(variant), + [typeof(Plane)] = (in godot_variant variant) => VariantUtils.ConvertTo<Plane>(variant), + [typeof(Callable)] = (in godot_variant variant) => VariantUtils.ConvertTo<Callable>(variant), + [typeof(SignalInfo)] = (in godot_variant variant) => VariantUtils.ConvertTo<SignalInfo>(variant), + [typeof(string)] = (in godot_variant variant) => VariantUtils.ConvertTo<string>(variant), + [typeof(byte[])] = (in godot_variant variant) => VariantUtils.ConvertTo<byte[]>(variant), + [typeof(int[])] = (in godot_variant variant) => VariantUtils.ConvertTo<int[]>(variant), + [typeof(long[])] = (in godot_variant variant) => VariantUtils.ConvertTo<long[]>(variant), + [typeof(float[])] = (in godot_variant variant) => VariantUtils.ConvertTo<float[]>(variant), + [typeof(double[])] = (in godot_variant variant) => VariantUtils.ConvertTo<double[]>(variant), + [typeof(string[])] = (in godot_variant variant) => VariantUtils.ConvertTo<string[]>(variant), + [typeof(Vector2[])] = (in godot_variant variant) => VariantUtils.ConvertTo<Vector2[]>(variant), + [typeof(Vector3[])] = (in godot_variant variant) => VariantUtils.ConvertTo<Vector3[]>(variant), + [typeof(Color[])] = (in godot_variant variant) => VariantUtils.ConvertTo<Color[]>(variant), + [typeof(StringName[])] = + (in godot_variant variant) => VariantUtils.ConvertTo<StringName[]>(variant), + [typeof(NodePath[])] = (in godot_variant variant) => VariantUtils.ConvertTo<NodePath[]>(variant), + [typeof(RID[])] = (in godot_variant variant) => VariantUtils.ConvertTo<RID[]>(variant), + [typeof(StringName)] = (in godot_variant variant) => VariantUtils.ConvertTo<StringName>(variant), + [typeof(NodePath)] = (in godot_variant variant) => VariantUtils.ConvertTo<NodePath>(variant), + [typeof(RID)] = (in godot_variant variant) => VariantUtils.ConvertTo<RID>(variant), + [typeof(Godot.Collections.Dictionary)] = (in godot_variant variant) => + VariantUtils.ConvertTo<Godot.Collections.Dictionary>(variant), + [typeof(Godot.Collections.Array)] = + (in godot_variant variant) => VariantUtils.ConvertTo<Godot.Collections.Array>(variant), + [typeof(Variant)] = (in godot_variant variant) => VariantUtils.ConvertTo<Variant>(variant), + }; + + [SuppressMessage("ReSharper", "RedundantNameQualifier")] + public static object? ConvertToObjectOfType(in godot_variant variant, Type type) + { + if (ToSystemObjectFuncByType.TryGetValue(type, out var func)) + return func(variant); + + if (typeof(Godot.Object).IsAssignableFrom(type)) + return Convert.ChangeType(VariantUtils.ConvertTo<Godot.Object>(variant), type); + + if (type.IsEnum) + { + var enumUnderlyingType = type.GetEnumUnderlyingType(); + + switch (Type.GetTypeCode(enumUnderlyingType)) + { + case TypeCode.SByte: + return Enum.ToObject(type, VariantUtils.ConvertToInt8(variant)); + case TypeCode.Int16: + return Enum.ToObject(type, VariantUtils.ConvertToInt16(variant)); + case TypeCode.Int32: + return Enum.ToObject(type, VariantUtils.ConvertToInt32(variant)); + case TypeCode.Int64: + return Enum.ToObject(type, VariantUtils.ConvertToInt64(variant)); + case TypeCode.Byte: + return Enum.ToObject(type, VariantUtils.ConvertToUInt8(variant)); + case TypeCode.UInt16: + return Enum.ToObject(type, VariantUtils.ConvertToUInt16(variant)); + case TypeCode.UInt32: + return Enum.ToObject(type, VariantUtils.ConvertToUInt32(variant)); + case TypeCode.UInt64: + return Enum.ToObject(type, VariantUtils.ConvertToUInt64(variant)); + default: + { + GD.PushError( + "Attempted to convert Variant to enum value of unsupported underlying type. Name: " + + type.FullName + " : " + enumUnderlyingType.FullName + "."); + return null; + } + } + } + + if (type.IsGenericType) + { + var genericTypeDef = type.GetGenericTypeDefinition(); + + if (genericTypeDef == typeof(Godot.Collections.Dictionary<,>)) + { + var ctor = type.GetConstructor(BindingFlags.Default, + new[] { typeof(Godot.Collections.Dictionary) }); + + if (ctor == null) + throw new InvalidOperationException("Dictionary constructor not found"); + + return ctor.Invoke(new object?[] + { + VariantUtils.ConvertTo<Godot.Collections.Dictionary>(variant) + }); + } + + if (genericTypeDef == typeof(Godot.Collections.Array<>)) + { + var ctor = type.GetConstructor(BindingFlags.Default, + new[] { typeof(Godot.Collections.Array) }); + + if (ctor == null) + throw new InvalidOperationException("Array constructor not found"); + + return ctor.Invoke(new object?[] + { + VariantUtils.ConvertTo<Godot.Collections.Array>(variant) + }); + } + } + + GD.PushError($"Attempted to convert Variant to unsupported type. Name: {type.FullName}."); + return null; + } + } } } diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Dictionary.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Dictionary.cs index f14790a218..cf25e1f0ae 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Dictionary.cs +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Dictionary.cs @@ -344,6 +344,11 @@ namespace Godot.Collections } } + internal interface IGenericGodotDictionary + { + public Dictionary UnderlyingDictionary { get; } + } + /// <summary> /// Typed wrapper around Godot's Dictionary class, a dictionary of Variant /// typed elements allocated in the engine in C++. Useful when @@ -354,7 +359,8 @@ namespace Godot.Collections /// <typeparam name="TValue">The type of the dictionary's values.</typeparam> public class Dictionary<[MustBeVariant] TKey, [MustBeVariant] TValue> : IDictionary<TKey, TValue>, - IReadOnlyDictionary<TKey, TValue> + IReadOnlyDictionary<TKey, TValue>, + IGenericGodotDictionary { private static godot_variant ToVariantFunc(in Dictionary<TKey, TValue> godotDictionary) => VariantUtils.CreateFromDictionary(godotDictionary); @@ -370,6 +376,8 @@ namespace Godot.Collections private readonly Dictionary _underlyingDict; + Dictionary IGenericGodotDictionary.UnderlyingDictionary => _underlyingDict; + internal ref godot_dictionary.movable NativeValue { [MethodImpl(MethodImplOptions.AggressiveInlining)] diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/NativeInterop/Marshaling.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/NativeInterop/Marshaling.cs index 649661ee06..6176093bc1 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/Core/NativeInterop/Marshaling.cs +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/NativeInterop/Marshaling.cs @@ -1,5 +1,7 @@ using System; using System.Runtime.InteropServices; +using Godot.Collections; +using Array = System.Array; // ReSharper disable InconsistentNaming @@ -148,6 +150,15 @@ namespace Godot.NativeInterop { if (typeof(Godot.Object).IsAssignableFrom(type)) return Variant.Type.Object; + + // We use `IsAssignableFrom` with our helper interfaces to detect generic Godot collections + // because `GetGenericTypeDefinition` is not supported in NativeAOT reflection-free mode. + + if (typeof(IGenericGodotDictionary).IsAssignableFrom(type)) + return Variant.Type.Dictionary; + + if (typeof(IGenericGodotArray).IsAssignableFrom(type)) + return Variant.Type.Array; } else if (type == typeof(Variant)) { @@ -183,508 +194,6 @@ namespace Godot.NativeInterop return Variant.Type.Nil; } - /* TODO: Reflection and type checking each time is slow. This will be replaced with source generators. */ - public static godot_variant ConvertManagedObjectToVariant(object? p_obj) - { - if (p_obj == null) - return new godot_variant(); - - switch (p_obj) - { - case bool @bool: - return VariantUtils.CreateFromBool(@bool); - case char @char: - return VariantUtils.CreateFromInt(@char); - case sbyte @int8: - return VariantUtils.CreateFromInt(@int8); - case short @int16: - return VariantUtils.CreateFromInt(@int16); - case int @int32: - return VariantUtils.CreateFromInt(@int32); - case long @int64: - return VariantUtils.CreateFromInt(@int64); - case byte @uint8: - return VariantUtils.CreateFromInt(@uint8); - case ushort @uint16: - return VariantUtils.CreateFromInt(@uint16); - case uint @uint32: - return VariantUtils.CreateFromInt(@uint32); - case ulong @uint64: - return VariantUtils.CreateFromInt(@uint64); - case float @float: - return VariantUtils.CreateFromFloat(@float); - case double @double: - return VariantUtils.CreateFromFloat(@double); - case Vector2 @vector2: - return VariantUtils.CreateFromVector2(@vector2); - case Vector2i @vector2i: - return VariantUtils.CreateFromVector2i(@vector2i); - case Rect2 @rect2: - return VariantUtils.CreateFromRect2(@rect2); - case Rect2i @rect2i: - return VariantUtils.CreateFromRect2i(@rect2i); - case Transform2D @transform2D: - return VariantUtils.CreateFromTransform2D(@transform2D); - case Vector3 @vector3: - return VariantUtils.CreateFromVector3(@vector3); - case Vector3i @vector3i: - return VariantUtils.CreateFromVector3i(@vector3i); - case Vector4 @vector4: - return VariantUtils.CreateFromVector4(@vector4); - case Vector4i @vector4i: - return VariantUtils.CreateFromVector4i(@vector4i); - case Basis @basis: - return VariantUtils.CreateFromBasis(@basis); - case Quaternion @quaternion: - return VariantUtils.CreateFromQuaternion(@quaternion); - case Transform3D @transform3d: - return VariantUtils.CreateFromTransform3D(@transform3d); - case Projection @projection: - return VariantUtils.CreateFromProjection(@projection); - case AABB @aabb: - return VariantUtils.CreateFromAABB(@aabb); - case Color @color: - return VariantUtils.CreateFromColor(@color); - case Plane @plane: - return VariantUtils.CreateFromPlane(@plane); - case Callable @callable: - return VariantUtils.CreateFromCallable(@callable); - case SignalInfo @signalInfo: - return VariantUtils.CreateFromSignalInfo(@signalInfo); - case Enum @enum: - return VariantUtils.CreateFromInt(Convert.ToInt64(@enum)); - case string @string: - return VariantUtils.CreateFromString(@string); - case byte[] byteArray: - return VariantUtils.CreateFromPackedByteArray(byteArray); - case int[] int32Array: - return VariantUtils.CreateFromPackedInt32Array(int32Array); - case long[] int64Array: - return VariantUtils.CreateFromPackedInt64Array(int64Array); - case float[] floatArray: - return VariantUtils.CreateFromPackedFloat32Array(floatArray); - case double[] doubleArray: - return VariantUtils.CreateFromPackedFloat64Array(doubleArray); - case string[] stringArray: - return VariantUtils.CreateFromPackedStringArray(stringArray); - case Vector2[] vector2Array: - return VariantUtils.CreateFromPackedVector2Array(vector2Array); - case Vector3[] vector3Array: - return VariantUtils.CreateFromPackedVector3Array(vector3Array); - case Color[] colorArray: - return VariantUtils.CreateFromPackedColorArray(colorArray); - case StringName[] stringNameArray: - return VariantUtils.CreateFromSystemArrayOfStringName(stringNameArray); - case NodePath[] nodePathArray: - return VariantUtils.CreateFromSystemArrayOfNodePath(nodePathArray); - case RID[] ridArray: - return VariantUtils.CreateFromSystemArrayOfRID(ridArray); - case Godot.Object[] godotObjectArray: - return VariantUtils.CreateFromSystemArrayOfGodotObject(godotObjectArray); - case Godot.Object godotObject: - return VariantUtils.CreateFromGodotObject(godotObject); - case StringName stringName: - return VariantUtils.CreateFromStringName(stringName); - case NodePath nodePath: - return VariantUtils.CreateFromNodePath(nodePath); - case RID rid: - return VariantUtils.CreateFromRID(rid); - case Collections.Dictionary godotDictionary: - return VariantUtils.CreateFromDictionary(godotDictionary); - case Collections.Array godotArray: - return VariantUtils.CreateFromArray(godotArray); - case Variant variant: - return NativeFuncs.godotsharp_variant_new_copy((godot_variant)variant.NativeVar); - } - - GD.PushError("Attempted to convert an unmarshallable managed type to Variant. Name: '" + - p_obj.GetType().FullName + "."); - return new godot_variant(); - } - - public static object? ConvertVariantToManagedObjectOfType(in godot_variant p_var, Type type) - { - // This function is only needed to set the value of properties. Fields have their own implementation, set_value_from_variant. - switch (Type.GetTypeCode(type)) - { - case TypeCode.Boolean: - return VariantUtils.ConvertToBool(p_var); - case TypeCode.Char: - return VariantUtils.ConvertToChar(p_var); - case TypeCode.SByte: - return VariantUtils.ConvertToInt8(p_var); - case TypeCode.Int16: - return VariantUtils.ConvertToInt16(p_var); - case TypeCode.Int32: - return VariantUtils.ConvertToInt32(p_var); - case TypeCode.Int64: - return VariantUtils.ConvertToInt64(p_var); - case TypeCode.Byte: - return VariantUtils.ConvertToUInt8(p_var); - case TypeCode.UInt16: - return VariantUtils.ConvertToUInt16(p_var); - case TypeCode.UInt32: - return VariantUtils.ConvertToUInt32(p_var); - case TypeCode.UInt64: - return VariantUtils.ConvertToUInt64(p_var); - case TypeCode.Single: - return VariantUtils.ConvertToFloat32(p_var); - case TypeCode.Double: - return VariantUtils.ConvertToFloat64(p_var); - case TypeCode.String: - return VariantUtils.ConvertToStringObject(p_var); - default: - { - if (type == typeof(Vector2)) - return VariantUtils.ConvertToVector2(p_var); - - if (type == typeof(Vector2i)) - return VariantUtils.ConvertToVector2i(p_var); - - if (type == typeof(Rect2)) - return VariantUtils.ConvertToRect2(p_var); - - if (type == typeof(Rect2i)) - return VariantUtils.ConvertToRect2i(p_var); - - if (type == typeof(Transform2D)) - return VariantUtils.ConvertToTransform2D(p_var); - - if (type == typeof(Vector3)) - return VariantUtils.ConvertToVector3(p_var); - - if (type == typeof(Vector3i)) - return VariantUtils.ConvertToVector3i(p_var); - - if (type == typeof(Vector4)) - return VariantUtils.ConvertToVector4(p_var); - - if (type == typeof(Vector4i)) - return VariantUtils.ConvertToVector4i(p_var); - - if (type == typeof(Basis)) - return VariantUtils.ConvertToBasis(p_var); - - if (type == typeof(Quaternion)) - return VariantUtils.ConvertToQuaternion(p_var); - - if (type == typeof(Transform3D)) - return VariantUtils.ConvertToTransform3D(p_var); - - if (type == typeof(Projection)) - return VariantUtils.ConvertToProjection(p_var); - - if (type == typeof(AABB)) - return VariantUtils.ConvertToAABB(p_var); - - if (type == typeof(Color)) - return VariantUtils.ConvertToColor(p_var); - - if (type == typeof(Plane)) - return VariantUtils.ConvertToPlane(p_var); - - if (type == typeof(Callable)) - return VariantUtils.ConvertToCallableManaged(p_var); - - if (type == typeof(SignalInfo)) - return VariantUtils.ConvertToSignalInfo(p_var); - - if (type.IsEnum) - { - var enumUnderlyingType = type.GetEnumUnderlyingType(); - switch (Type.GetTypeCode(enumUnderlyingType)) - { - case TypeCode.SByte: - return VariantUtils.ConvertToInt8(p_var); - case TypeCode.Int16: - return VariantUtils.ConvertToInt16(p_var); - case TypeCode.Int32: - return VariantUtils.ConvertToInt32(p_var); - case TypeCode.Int64: - return VariantUtils.ConvertToInt64(p_var); - case TypeCode.Byte: - return VariantUtils.ConvertToUInt8(p_var); - case TypeCode.UInt16: - return VariantUtils.ConvertToUInt16(p_var); - case TypeCode.UInt32: - return VariantUtils.ConvertToUInt32(p_var); - case TypeCode.UInt64: - return VariantUtils.ConvertToUInt64(p_var); - default: - { - GD.PushError( - "Attempted to convert Variant to enum value of unsupported underlying type. Name: " + - type.FullName + " : " + enumUnderlyingType.FullName + "."); - return null; - } - } - } - - if (type.IsArray || type.IsSZArray) - { - return ConvertVariantToSystemArrayOfType(p_var, type); - } - else if (type.IsGenericType) - { - if (typeof(Godot.Object).IsAssignableFrom(type)) - { - var godotObject = VariantUtils.ConvertToGodotObject(p_var); - - if (!type.IsInstanceOfType(godotObject)) - { - GD.PushError("Invalid cast when marshaling Godot.Object type." + - $" `{godotObject.GetType()}` is not assignable to `{type.FullName}`."); - return null; - } - - return godotObject; - } - - return null; - } - else if (type == typeof(Variant)) - { - return Variant.CreateCopyingBorrowed(p_var); - } - - if (ConvertVariantToManagedObjectOfClass(p_var, type, out object? res)) - return res; - - break; - } - } - - GD.PushError("Attempted to convert Variant to unsupported type. Name: " + - type.FullName + "."); - return null; - } - - private static object? ConvertVariantToSystemArrayOfType(in godot_variant p_var, Type type) - { - if (type == typeof(byte[])) - return VariantUtils.ConvertAsPackedByteArrayToSystemArray(p_var); - - if (type == typeof(int[])) - return VariantUtils.ConvertAsPackedInt32ArrayToSystemArray(p_var); - - if (type == typeof(long[])) - return VariantUtils.ConvertAsPackedInt64ArrayToSystemArray(p_var); - - if (type == typeof(float[])) - return VariantUtils.ConvertAsPackedFloat32ArrayToSystemArray(p_var); - - if (type == typeof(double[])) - return VariantUtils.ConvertAsPackedFloat64ArrayToSystemArray(p_var); - - if (type == typeof(string[])) - return VariantUtils.ConvertAsPackedStringArrayToSystemArray(p_var); - - if (type == typeof(Vector2[])) - return VariantUtils.ConvertAsPackedVector2ArrayToSystemArray(p_var); - - if (type == typeof(Vector3[])) - return VariantUtils.ConvertAsPackedVector3ArrayToSystemArray(p_var); - - if (type == typeof(Color[])) - return VariantUtils.ConvertAsPackedColorArrayToSystemArray(p_var); - - if (type == typeof(StringName[])) - return VariantUtils.ConvertToSystemArrayOfStringName(p_var); - - if (type == typeof(NodePath[])) - return VariantUtils.ConvertToSystemArrayOfNodePath(p_var); - - if (type == typeof(RID[])) - return VariantUtils.ConvertToSystemArrayOfRID(p_var); - - if (typeof(Godot.Object[]).IsAssignableFrom(type)) - return VariantUtils.ConvertToSystemArrayOfGodotObject(p_var, type); - - GD.PushError("Attempted to convert Variant to array of unsupported element type. Name: " + - type.GetElementType()!.FullName + "."); - return null; - } - - private static bool ConvertVariantToManagedObjectOfClass(in godot_variant p_var, Type type, - out object? res) - { - if (typeof(Godot.Object).IsAssignableFrom(type)) - { - if (p_var.Type == Variant.Type.Nil) - { - res = null; - return true; - } - - if (p_var.Type != Variant.Type.Object) - { - GD.PushError("Invalid cast when marshaling Godot.Object type." + - $" Variant type is `{p_var.Type}`; expected `{p_var.Object}`."); - res = null; - return true; - } - - var godotObjectPtr = VariantUtils.ConvertToGodotObjectPtr(p_var); - - if (godotObjectPtr == IntPtr.Zero) - { - res = null; - return true; - } - - var godotObject = InteropUtils.UnmanagedGetManaged(godotObjectPtr); - - if (!type.IsInstanceOfType(godotObject)) - { - GD.PushError("Invalid cast when marshaling Godot.Object type." + - $" `{godotObject.GetType()}` is not assignable to `{type.FullName}`."); - res = null; - return false; - } - - res = godotObject; - return true; - } - - if (typeof(StringName) == type) - { - res = VariantUtils.ConvertToStringNameObject(p_var); - return true; - } - - if (typeof(NodePath) == type) - { - res = VariantUtils.ConvertToNodePathObject(p_var); - return true; - } - - if (typeof(RID) == type) - { - res = VariantUtils.ConvertToRID(p_var); - return true; - } - - if (typeof(Collections.Dictionary) == type) - { - res = VariantUtils.ConvertToDictionaryObject(p_var); - return true; - } - - if (typeof(Collections.Array) == type) - { - res = VariantUtils.ConvertToArrayObject(p_var); - return true; - } - - res = null; - return false; - } - - public static unsafe object? ConvertVariantToManagedObject(in godot_variant p_var) - { - switch (p_var.Type) - { - case Variant.Type.Bool: - return p_var.Bool.ToBool(); - case Variant.Type.Int: - return p_var.Int; - case Variant.Type.Float: - { -#if REAL_T_IS_DOUBLE - return p_var.Float; -#else - return (float)p_var.Float; -#endif - } - case Variant.Type.String: - return ConvertStringToManaged(p_var.String); - case Variant.Type.Vector2: - return p_var.Vector2; - case Variant.Type.Vector2i: - return p_var.Vector2i; - case Variant.Type.Rect2: - return p_var.Rect2; - case Variant.Type.Rect2i: - return p_var.Rect2i; - case Variant.Type.Vector3: - return p_var.Vector3; - case Variant.Type.Vector3i: - return p_var.Vector3i; - case Variant.Type.Transform2d: - return *p_var.Transform2D; - case Variant.Type.Vector4: - return p_var.Vector4; - case Variant.Type.Vector4i: - return p_var.Vector4i; - case Variant.Type.Plane: - return p_var.Plane; - case Variant.Type.Quaternion: - return p_var.Quaternion; - case Variant.Type.Aabb: - return *p_var.AABB; - case Variant.Type.Basis: - return *p_var.Basis; - case Variant.Type.Transform3d: - return *p_var.Transform3D; - case Variant.Type.Projection: - return *p_var.Projection; - case Variant.Type.Color: - return p_var.Color; - case Variant.Type.StringName: - { - // The Variant owns the value, so we need to make a copy - return StringName.CreateTakingOwnershipOfDisposableValue( - NativeFuncs.godotsharp_string_name_new_copy(p_var.StringName)); - } - case Variant.Type.NodePath: - { - // The Variant owns the value, so we need to make a copy - return NodePath.CreateTakingOwnershipOfDisposableValue( - NativeFuncs.godotsharp_node_path_new_copy(p_var.NodePath)); - } - case Variant.Type.Rid: - return p_var.RID; - case Variant.Type.Object: - return InteropUtils.UnmanagedGetManaged(p_var.Object); - case Variant.Type.Callable: - return ConvertCallableToManaged(p_var.Callable); - case Variant.Type.Signal: - return ConvertSignalToManaged(p_var.Signal); - case Variant.Type.Dictionary: - { - // The Variant owns the value, so we need to make a copy - return Collections.Dictionary.CreateTakingOwnershipOfDisposableValue( - NativeFuncs.godotsharp_dictionary_new_copy(p_var.Dictionary)); - } - case Variant.Type.Array: - { - // The Variant owns the value, so we need to make a copy - return Collections.Array.CreateTakingOwnershipOfDisposableValue( - NativeFuncs.godotsharp_array_new_copy(p_var.Array)); - } - case Variant.Type.PackedByteArray: - return VariantUtils.ConvertAsPackedByteArrayToSystemArray(p_var); - case Variant.Type.PackedInt32Array: - return VariantUtils.ConvertAsPackedInt32ArrayToSystemArray(p_var); - case Variant.Type.PackedInt64Array: - return VariantUtils.ConvertAsPackedInt64ArrayToSystemArray(p_var); - case Variant.Type.PackedFloat32Array: - return VariantUtils.ConvertAsPackedFloat32ArrayToSystemArray(p_var); - case Variant.Type.PackedFloat64Array: - return VariantUtils.ConvertAsPackedFloat64ArrayToSystemArray(p_var); - case Variant.Type.PackedStringArray: - return VariantUtils.ConvertAsPackedStringArrayToSystemArray(p_var); - case Variant.Type.PackedVector2Array: - return VariantUtils.ConvertAsPackedVector2ArrayToSystemArray(p_var); - case Variant.Type.PackedVector3Array: - return VariantUtils.ConvertAsPackedVector3ArrayToSystemArray(p_var); - case Variant.Type.PackedColorArray: - return VariantUtils.ConvertAsPackedColorArrayToSystemArray(p_var); - default: - return null; - } - } - // String public static unsafe godot_string ConvertStringToNative(string? p_mono_string) diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/NativeInterop/NativeFuncs.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/NativeInterop/NativeFuncs.cs index b30b6a0752..c7deb6423b 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/Core/NativeInterop/NativeFuncs.cs +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/NativeInterop/NativeFuncs.cs @@ -414,21 +414,6 @@ namespace Godot.NativeInterop // StringExtensions - public static partial void godotsharp_string_md5_buffer(in godot_string p_self, - out godot_packed_byte_array r_md5_buffer); - - public static partial void godotsharp_string_md5_text(in godot_string p_self, out godot_string r_md5_text); - - public static partial int godotsharp_string_rfind(in godot_string p_self, in godot_string p_what, int p_from); - - public static partial int godotsharp_string_rfindn(in godot_string p_self, in godot_string p_what, int p_from); - - public static partial void godotsharp_string_sha256_buffer(in godot_string p_self, - out godot_packed_byte_array r_sha256_buffer); - - public static partial void godotsharp_string_sha256_text(in godot_string p_self, - out godot_string r_sha256_text); - public static partial void godotsharp_string_simplify_path(in godot_string p_self, out godot_string r_simplified_path); diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/NativeInterop/VariantUtils.generic.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/NativeInterop/VariantUtils.generic.cs index 694da6db77..80ef2a1ea1 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/Core/NativeInterop/VariantUtils.generic.cs +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/NativeInterop/VariantUtils.generic.cs @@ -4,6 +4,8 @@ using System.Runtime.CompilerServices; namespace Godot.NativeInterop; +#nullable enable + public partial class VariantUtils { private static Exception UnsupportedType<T>() => new InvalidOperationException( diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/StringExtensions.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/StringExtensions.cs index f511233fcc..d4329d78c1 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/Core/StringExtensions.cs +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/StringExtensions.cs @@ -1,7 +1,9 @@ using System; using System.Collections.Generic; using System.Globalization; +using System.IO; using System.Security; +using System.Security.Cryptography; using System.Text; using System.Text.RegularExpressions; using Godot.NativeInterop; @@ -67,30 +69,13 @@ namespace Godot } /// <summary> - /// If the string is a path to a file, return the path to the file without the extension. - /// </summary> - /// <seealso cref="GetExtension(string)"/> - /// <seealso cref="GetBaseDir(string)"/> - /// <seealso cref="GetFile(string)"/> - /// <param name="instance">The path to a file.</param> - /// <returns>The path to the file without the extension.</returns> - public static string GetBaseName(this string instance) - { - int index = instance.LastIndexOf('.'); - - if (index > 0) - return instance.Substring(0, index); - - return instance; - } - - /// <summary> /// Returns <see langword="true"/> if the strings begins /// with the given string <paramref name="text"/>. /// </summary> /// <param name="instance">The string to check.</param> /// <param name="text">The beginning string.</param> /// <returns>If the string begins with the given string.</returns> + [Obsolete("Use string.StartsWith instead.")] public static bool BeginsWith(this string instance, string text) { return instance.StartsWith(text); @@ -144,15 +129,15 @@ namespace Godot } /// <summary> - /// Returns the amount of substrings <paramref name="what"/> in the string. + /// Returns the number of occurrences of substring <paramref name="what"/> in the string. /// </summary> /// <param name="instance">The string where the substring will be searched.</param> /// <param name="what">The substring that will be counted.</param> - /// <param name="caseSensitive">If the search is case sensitive.</param> /// <param name="from">Index to start searching from.</param> /// <param name="to">Index to stop searching at.</param> - /// <returns>Amount of substrings in the string.</returns> - public static int Count(this string instance, string what, bool caseSensitive = true, int from = 0, int to = 0) + /// <param name="caseSensitive">If the search is case sensitive.</param> + /// <returns>Number of occurrences of the substring in the string.</returns> + public static int Count(this string instance, string what, int from = 0, int to = 0, bool caseSensitive = true) { if (what.Length == 0) { @@ -211,6 +196,82 @@ namespace Godot } /// <summary> + /// Returns the number of occurrences of substring <paramref name="what"/> (ignoring case) + /// between <paramref name="from"/> and <paramref name="to"/> positions. If <paramref name="from"/> + /// and <paramref name="to"/> equals 0 the whole string will be used. If only <paramref name="to"/> + /// equals 0 the remained substring will be used. + /// </summary> + /// <param name="instance">The string where the substring will be searched.</param> + /// <param name="what">The substring that will be counted.</param> + /// <param name="from">Index to start searching from.</param> + /// <param name="to">Index to stop searching at.</param> + /// <returns>Number of occurrences of the substring in the string.</returns> + public static int CountN(this string instance, string what, int from = 0, int to = 0) + { + return instance.Count(what, from, to, caseSensitive: false); + } + + /// <summary> + /// Returns a copy of the string with indentation (leading tabs and spaces) removed. + /// See also <see cref="Indent"/> to add indentation. + /// </summary> + /// <param name="instance">The string to remove the indentation from.</param> + /// <returns>The string with the indentation removed.</returns> + public static string Dedent(this string instance) + { + var sb = new StringBuilder(); + string indent = ""; + bool hasIndent = false; + bool hasText = false; + int lineStart = 0; + int indentStop = -1; + + for (int i = 0; i < instance.Length; i++) + { + char c = instance[i]; + if (c == '\n') + { + if (hasText) + { + sb.Append(instance.Substring(indentStop, i - indentStop)); + } + sb.Append('\n'); + hasText = false; + lineStart = i + 1; + indentStop = -1; + } + else if (!hasText) + { + if (c > 32) + { + hasText = true; + if (!hasIndent) + { + hasIndent = true; + indent = instance.Substring(lineStart, i - lineStart); + indentStop = i; + } + } + if (hasIndent && indentStop < 0) + { + int j = i - lineStart; + if (j >= indent.Length || c != indent[j]) + { + indentStop = i; + } + } + } + } + + if (hasText) + { + sb.Append(instance.Substring(indentStop, instance.Length - indentStop)); + } + + return sb.ToString(); + } + + /// <summary> /// Returns a copy of the string with special characters escaped using the C language standard. /// </summary> /// <param name="instance">The string to escape.</param> @@ -443,29 +504,6 @@ namespace Godot } /// <summary> - /// Returns <see langword="true"/> if the strings ends - /// with the given string <paramref name="text"/>. - /// </summary> - /// <param name="instance">The string to check.</param> - /// <param name="text">The ending string.</param> - /// <returns>If the string ends with the given string.</returns> - public static bool EndsWith(this string instance, string text) - { - return instance.EndsWith(text); - } - - /// <summary> - /// Erase <paramref name="chars"/> characters from the string starting from <paramref name="pos"/>. - /// </summary> - /// <param name="instance">The string to modify.</param> - /// <param name="pos">Starting position from which to erase.</param> - /// <param name="chars">Amount of characters to erase.</param> - public static void Erase(this StringBuilder instance, int pos, int chars) - { - instance.Remove(pos, chars); - } - - /// <summary> /// Returns the extension without the leading period character (<c>.</c>) /// if the string is a valid file name or path. If the string does not contain /// an extension, returns an empty string instead. @@ -489,7 +527,7 @@ namespace Godot /// <returns>The extension of the file or an empty string.</returns> public static string GetExtension(this string instance) { - int pos = instance.FindLast("."); + int pos = instance.RFind("."); if (pos < 0) return instance; @@ -498,12 +536,16 @@ namespace Godot } /// <summary> - /// Find the first occurrence of a substring. Optionally, the search starting position can be passed. + /// Returns the index of the first occurrence of the specified string in this instance, + /// or <c>-1</c>. Optionally, the starting search index can be specified, continuing + /// to the end of the string. + /// Note: If you just want to know whether a string contains a substring, use the + /// <see cref="string.Contains(string)"/> method. /// </summary> /// <seealso cref="Find(string, char, int, bool)"/> - /// <seealso cref="FindLast(string, string, bool)"/> - /// <seealso cref="FindLast(string, string, int, bool)"/> /// <seealso cref="FindN(string, string, int)"/> + /// <seealso cref="RFind(string, string, int, bool)"/> + /// <seealso cref="RFindN(string, string, int)"/> /// <param name="instance">The string that will be searched.</param> /// <param name="what">The substring to find.</param> /// <param name="from">The search starting position.</param> @@ -519,9 +561,9 @@ namespace Godot /// Find the first occurrence of a char. Optionally, the search starting position can be passed. /// </summary> /// <seealso cref="Find(string, string, int, bool)"/> - /// <seealso cref="FindLast(string, string, bool)"/> - /// <seealso cref="FindLast(string, string, int, bool)"/> /// <seealso cref="FindN(string, string, int)"/> + /// <seealso cref="RFind(string, string, int, bool)"/> + /// <seealso cref="RFindN(string, string, int)"/> /// <param name="instance">The string that will be searched.</param> /// <param name="what">The substring to find.</param> /// <param name="from">The search starting position.</param> @@ -529,50 +571,21 @@ namespace Godot /// <returns>The first instance of the char, or -1 if not found.</returns> public static int Find(this string instance, char what, int from = 0, bool caseSensitive = true) { - // TODO: Could be more efficient if we get a char version of `IndexOf`. - // See https://github.com/dotnet/runtime/issues/44116 - return instance.IndexOf(what.ToString(), from, - caseSensitive ? StringComparison.Ordinal : StringComparison.OrdinalIgnoreCase); - } + if (caseSensitive) + return instance.IndexOf(what, from); - /// <summary>Find the last occurrence of a substring.</summary> - /// <seealso cref="Find(string, string, int, bool)"/> - /// <seealso cref="Find(string, char, int, bool)"/> - /// <seealso cref="FindLast(string, string, int, bool)"/> - /// <seealso cref="FindN(string, string, int)"/> - /// <param name="instance">The string that will be searched.</param> - /// <param name="what">The substring to find.</param> - /// <param name="caseSensitive">If <see langword="true"/>, the search is case sensitive.</param> - /// <returns>The starting position of the substring, or -1 if not found.</returns> - public static int FindLast(this string instance, string what, bool caseSensitive = true) - { - return instance.FindLast(what, instance.Length - 1, caseSensitive); - } - - /// <summary>Find the last occurrence of a substring specifying the search starting position.</summary> - /// <seealso cref="Find(string, string, int, bool)"/> - /// <seealso cref="Find(string, char, int, bool)"/> - /// <seealso cref="FindLast(string, string, bool)"/> - /// <seealso cref="FindN(string, string, int)"/> - /// <param name="instance">The string that will be searched.</param> - /// <param name="what">The substring to find.</param> - /// <param name="from">The search starting position.</param> - /// <param name="caseSensitive">If <see langword="true"/>, the search is case sensitive.</param> - /// <returns>The starting position of the substring, or -1 if not found.</returns> - public static int FindLast(this string instance, string what, int from, bool caseSensitive = true) - { - return instance.LastIndexOf(what, from, - caseSensitive ? StringComparison.Ordinal : StringComparison.OrdinalIgnoreCase); + return CultureInfo.InvariantCulture.CompareInfo.IndexOf(instance, what, from, CompareOptions.OrdinalIgnoreCase); } /// <summary> - /// Find the first occurrence of a substring but search as case-insensitive. - /// Optionally, the search starting position can be passed. + /// Returns the index of the first case-insensitive occurrence of the specified string in this instance, + /// or <c>-1</c>. Optionally, the starting search index can be specified, continuing + /// to the end of the string. /// </summary> /// <seealso cref="Find(string, string, int, bool)"/> /// <seealso cref="Find(string, char, int, bool)"/> - /// <seealso cref="FindLast(string, string, bool)"/> - /// <seealso cref="FindLast(string, string, int, bool)"/> + /// <seealso cref="RFind(string, string, int, bool)"/> + /// <seealso cref="RFindN(string, string, int)"/> /// <param name="instance">The string that will be searched.</param> /// <param name="what">The substring to find.</param> /// <param name="from">The search starting position.</param> @@ -616,7 +629,7 @@ namespace Godot } } - int sep = Mathf.Max(rs.FindLast("/"), rs.FindLast("\\")); + int sep = Mathf.Max(rs.RFind("/"), rs.RFind("\\")); if (sep == -1) return directory; @@ -625,6 +638,24 @@ namespace Godot } /// <summary> + /// If the string is a path to a file, return the path to the file without the extension. + /// </summary> + /// <seealso cref="GetExtension(string)"/> + /// <seealso cref="GetBaseDir(string)"/> + /// <seealso cref="GetFile(string)"/> + /// <param name="instance">The path to a file.</param> + /// <returns>The path to the file without the extension.</returns> + public static string GetBaseName(this string instance) + { + int index = instance.RFind("."); + + if (index > 0) + return instance.Substring(0, index); + + return instance; + } + + /// <summary> /// If the string is a path to a file, return the file and ignore the base directory. /// </summary> /// <seealso cref="GetBaseName(string)"/> @@ -634,7 +665,7 @@ namespace Godot /// <returns>The file name.</returns> public static string GetFile(this string instance) { - int sep = Mathf.Max(instance.FindLast("/"), instance.FindLast("\\")); + int sep = Mathf.Max(instance.RFind("/"), instance.RFind("\\")); if (sep == -1) return instance; @@ -643,8 +674,8 @@ namespace Godot } /// <summary> - /// Converts the given byte array of ASCII encoded text to a string. - /// Faster alternative to <see cref="GetStringFromUTF8"/> if the + /// Converts ASCII encoded array to string. + /// Fast alternative to <see cref="GetStringFromUTF8"/> if the /// content is ASCII-only. Unlike the UTF-8 function this function /// maps every byte to a character in the array. Multibyte sequences /// will not be interpreted correctly. For parsing user input always @@ -658,13 +689,35 @@ namespace Godot } /// <summary> - /// Converts the given byte array of UTF-8 encoded text to a string. + /// Converts UTF-16 encoded array to string using the little endian byte order. + /// </summary> + /// <param name="bytes">A byte array of UTF-16 characters.</param> + /// <returns>A string created from the bytes.</returns> + public static string GetStringFromUTF16(this byte[] bytes) + { + return Encoding.Unicode.GetString(bytes); + } + + /// <summary> + /// Converts UTF-32 encoded array to string using the little endian byte order. + /// </summary> + /// <param name="bytes">A byte array of UTF-32 characters.</param> + /// <returns>A string created from the bytes.</returns> + public static string GetStringFromUTF32(this byte[] bytes) + { + return Encoding.UTF32.GetString(bytes); + } + + /// <summary> + /// Converts UTF-8 encoded array to string. /// Slower than <see cref="GetStringFromASCII"/> but supports UTF-8 /// encoded data. Use this function if you are unsure about the /// source of the data. For user input this function /// should always be preferred. /// </summary> - /// <param name="bytes">A byte array of UTF-8 characters (a character may take up multiple bytes).</param> + /// <param name="bytes"> + /// A byte array of UTF-8 characters (a character may take up multiple bytes). + /// </param> /// <returns>A string created from the bytes.</returns> public static string GetStringFromUTF8(this byte[] bytes) { @@ -766,18 +819,44 @@ namespace Godot } /// <summary> - /// Inserts a substring at a given position. + /// Returns a copy of the string with lines indented with <paramref name="prefix"/>. + /// For example, the string can be indented with two tabs using <c>"\t\t"</c>, + /// or four spaces using <c>" "</c>. The prefix can be any string so it can + /// also be used to comment out strings with e.g. <c>"// </c>. + /// See also <see cref="Dedent"/> to remove indentation. + /// Note: Empty lines are kept empty. /// </summary> - /// <param name="instance">The string to modify.</param> - /// <param name="pos">Position at which to insert the substring.</param> - /// <param name="what">Substring to insert.</param> - /// <returns> - /// The string with <paramref name="what"/> inserted at the given - /// position <paramref name="pos"/>. - /// </returns> - public static string Insert(this string instance, int pos, string what) + /// <param name="instance">The string to add indentation to.</param> + /// <param name="prefix">The string to use as indentation.</param> + /// <returns>The string with indentation added.</returns> + public static string Indent(this string instance, string prefix) { - return instance.Insert(pos, what); + var sb = new StringBuilder(); + int lineStart = 0; + + for (int i = 0; i < instance.Length; i++) + { + char c = instance[i]; + if (c == '\n') + { + if (i == lineStart) + { + sb.Append(c); // Leave empty lines empty. + } + else + { + sb.Append(prefix); + sb.Append(instance.Substring(lineStart, i - lineStart + 1)); + } + lineStart = i + 1; + } + } + if (lineStart != instance.Length) + { + sb.Append(prefix); + sb.Append(instance.Substring(lineStart)); + } + return sb.ToString(); } /// <summary> @@ -873,19 +952,94 @@ namespace Godot return instance.IsSubsequenceOf(text, caseSensitive: false); } + private static readonly char[] _invalidFileNameCharacters = { ':', '/', '\\', '?', '*', '"', '|', '%', '<', '>' }; + + /// <summary> + /// Returns <see langword="true"/> if this string is free from characters that + /// aren't allowed in file names. + /// </summary> + /// <param name="instance">The string to check.</param> + /// <returns>If the string contains a valid file name.</returns> + public static bool IsValidFileName(this string instance) + { + var stripped = instance.Trim(); + if (instance != stripped) + return false; + + if (string.IsNullOrEmpty(stripped)) + return false; + + return instance.IndexOfAny(_invalidFileNameCharacters) == -1; + } + /// <summary> - /// Check whether the string contains a valid <see langword="float"/>. + /// Returns <see langword="true"/> if this string contains a valid <see langword="float"/>. + /// This is inclusive of integers, and also supports exponents. /// </summary> + /// <example> + /// <code> + /// GD.Print("1.7".IsValidFloat()) // Prints "True" + /// GD.Print("24".IsValidFloat()) // Prints "True" + /// GD.Print("7e3".IsValidFloat()) // Prints "True" + /// GD.Print("Hello".IsValidFloat()) // Prints "False" + /// </code> + /// </example> /// <param name="instance">The string to check.</param> /// <returns>If the string contains a valid floating point number.</returns> public static bool IsValidFloat(this string instance) { - float f; - return float.TryParse(instance, out f); + return float.TryParse(instance, out _); + } + + /// <summary> + /// Returns <see langword="true"/> if this string contains a valid hexadecimal number. + /// If <paramref name="withPrefix"/> is <see langword="true"/>, then a validity of the + /// hexadecimal number is determined by <c>0x</c> prefix, for instance: <c>0xDEADC0DE</c>. + /// </summary> + /// <param name="instance">The string to check.</param> + /// <param name="withPrefix">If the string must contain the <c>0x</c> prefix to be valid.</param> + /// <returns>If the string contains a valid hexadecimal number.</returns> + public static bool IsValidHexNumber(this string instance, bool withPrefix = false) + { + if (string.IsNullOrEmpty(instance)) + return false; + + int from = 0; + if (instance.Length != 1 && instance[0] == '+' || instance[0] == '-') + { + from++; + } + + if (withPrefix) + { + if (instance.Length < 3) + return false; + if (instance[from] != '0' || instance[from + 1] != 'x') + return false; + from += 2; + } + + for (int i = from; i < instance.Length; i++) + { + char c = instance[i]; + if (IsHexDigit(c)) + continue; + + return false; + } + + return true; + + static bool IsHexDigit(char c) + { + return char.IsDigit(c) || (c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F'); + } } /// <summary> - /// Check whether the string contains a valid color in HTML notation. + /// Returns <see langword="true"/> if this string contains a valid color in hexadecimal + /// HTML notation. Other HTML notations such as named colors or <c>hsl()</c> aren't + /// considered valid by this method and will return <see langword="false"/>. /// </summary> /// <param name="instance">The string to check.</param> /// <returns>If the string contains a valid HTML color.</returns> @@ -895,10 +1049,17 @@ namespace Godot } /// <summary> - /// Check whether the string is a valid identifier. As is common in - /// programming languages, a valid identifier may contain only letters, - /// digits and underscores (_) and the first character may not be a digit. + /// Returns <see langword="true"/> if this string is a valid identifier. + /// A valid identifier may contain only letters, digits and underscores (<c>_</c>) + /// and the first character may not be a digit. /// </summary> + /// <example> + /// <code> + /// GD.Print("good_ident_1".IsValidIdentifier()) // Prints "True" + /// GD.Print("1st_bad_ident".IsValidIdentifier()) // Prints "False" + /// GD.Print("bad_ident_#2".IsValidIdentifier()) // Prints "False" + /// </code> + /// </example> /// <param name="instance">The string to check.</param> /// <returns>If the string contains a valid identifier.</returns> public static bool IsValidIdentifier(this string instance) @@ -926,38 +1087,73 @@ namespace Godot } /// <summary> - /// Check whether the string contains a valid integer. + /// Returns <see langword="true"/> if this string contains a valid <see langword="int"/>. /// </summary> + /// <example> + /// <code> + /// GD.Print("7".IsValidInt()) // Prints "True" + /// GD.Print("14.6".IsValidInt()) // Prints "False" + /// GD.Print("L".IsValidInt()) // Prints "False" + /// GD.Print("+3".IsValidInt()) // Prints "True" + /// GD.Print("-12".IsValidInt()) // Prints "True" + /// </code> + /// </example> /// <param name="instance">The string to check.</param> /// <returns>If the string contains a valid integer.</returns> - public static bool IsValidInteger(this string instance) + public static bool IsValidInt(this string instance) { - int f; - return int.TryParse(instance, out f); + return int.TryParse(instance, out _); } /// <summary> - /// Check whether the string contains a valid IP address. + /// Returns <see langword="true"/> if this string contains only a well-formatted + /// IPv4 or IPv6 address. This method considers reserved IP addresses such as + /// <c>0.0.0.0</c> as valid. /// </summary> /// <param name="instance">The string to check.</param> /// <returns>If the string contains a valid IP address.</returns> public static bool IsValidIPAddress(this string instance) { - // TODO: Support IPv6 addresses - string[] ip = instance.Split("."); + if (instance.Contains(':')) + { + string[] ip = instance.Split(':'); - if (ip.Length != 4) - return false; + for (int i = 0; i < ip.Length; i++) + { + string n = ip[i]; + if (n.Length == 0) + continue; + + if (n.IsValidHexNumber(withPrefix: false)) + { + long nint = n.HexToInt(); + if (nint < 0 || nint > 0xffff) + return false; - for (int i = 0; i < ip.Length; i++) + continue; + } + + if (!n.IsValidIPAddress()) + return false; + } + } + else { - string n = ip[i]; - if (!n.IsValidInteger()) - return false; + string[] ip = instance.Split('.'); - int val = n.ToInt(); - if (val < 0 || val > 255) + if (ip.Length != 4) return false; + + for (int i = 0; i < ip.Length; i++) + { + string n = ip[i]; + if (!n.IsValidInt()) + return false; + + int val = n.ToInt(); + if (val < 0 || val > 255) + return false; + } } return true; @@ -1003,41 +1199,20 @@ namespace Godot } /// <summary> - /// Returns the length of the string in characters. - /// </summary> - /// <param name="instance">The string to check.</param> - /// <returns>The length of the string.</returns> - public static int Length(this string instance) - { - return instance.Length; - } - - /// <summary> /// Returns a copy of the string with characters removed from the left. + /// The <paramref name="chars"/> argument is a string specifying the set of characters + /// to be removed. + /// Note: The <paramref name="chars"/> is not a prefix. See <see cref="TrimPrefix"/> + /// method that will remove a single prefix string rather than a set of characters. /// </summary> /// <seealso cref="RStrip(string, string)"/> /// <param name="instance">The string to remove characters from.</param> /// <param name="chars">The characters to be removed.</param> /// <returns>A copy of the string with characters removed from the left.</returns> + [Obsolete("Use string.TrimStart instead.")] public static string LStrip(this string instance, string chars) { - int len = instance.Length; - int beg; - - for (beg = 0; beg < len; beg++) - { - if (chars.Find(instance[beg]) == -1) - { - break; - } - } - - if (beg == 0) - { - return instance; - } - - return instance.Substr(beg, len - beg); + return instance.TrimStart(chars.ToCharArray()); } /// <summary> @@ -1117,10 +1292,9 @@ namespace Godot /// <returns>The MD5 hash of the string.</returns> public static byte[] MD5Buffer(this string instance) { - using godot_string instanceStr = Marshaling.ConvertStringToNative(instance); - NativeFuncs.godotsharp_string_md5_buffer(instanceStr, out var md5Buffer); - using (md5Buffer) - return Marshaling.ConvertNativePackedByteArrayToSystemArray(md5Buffer); +#pragma warning disable CA5351 // Do Not Use Broken Cryptographic Algorithms + return MD5.HashData(Encoding.UTF8.GetBytes(instance)); +#pragma warning restore CA5351 } /// <summary> @@ -1131,10 +1305,7 @@ namespace Godot /// <returns>The MD5 hash of the string.</returns> public static string MD5Text(this string instance) { - using godot_string instanceStr = Marshaling.ConvertStringToNative(instance); - NativeFuncs.godotsharp_string_md5_text(instanceStr, out var md5Text); - using (md5Text) - return Marshaling.ConvertStringToManaged(md5Text); + return instance.MD5Buffer().HexEncode(); } /// <summary> @@ -1151,17 +1322,6 @@ namespace Godot } /// <summary> - /// Returns the character code at position <paramref name="at"/>. - /// </summary> - /// <param name="instance">The string to check.</param> - /// <param name="at">The position int the string for the character to check.</param> - /// <returns>The character code.</returns> - public static int OrdAt(this string instance, int at) - { - return instance[at]; - } - - /// <summary> /// Format a number to have an exact number of <paramref name="digits"/> /// after the decimal point. /// </summary> @@ -1282,34 +1442,47 @@ namespace Godot } /// <summary> - /// Perform a search for a substring, but start from the end of the string instead of the beginning. + /// Returns the index of the last occurrence of the specified string in this instance, + /// or <c>-1</c>. Optionally, the starting search index can be specified, continuing to + /// the beginning of the string. /// </summary> + /// <seealso cref="Find(string, string, int, bool)"/> + /// <seealso cref="Find(string, char, int, bool)"/> + /// <seealso cref="FindN(string, string, int)"/> /// <seealso cref="RFindN(string, string, int)"/> /// <param name="instance">The string that will be searched.</param> /// <param name="what">The substring to search in the string.</param> /// <param name="from">The position at which to start searching.</param> + /// <param name="caseSensitive">If <see langword="true"/>, the search is case sensitive.</param> /// <returns>The position at which the substring was found, or -1 if not found.</returns> - public static int RFind(this string instance, string what, int from = -1) + public static int RFind(this string instance, string what, int from = -1, bool caseSensitive = true) { - using godot_string instanceStr = Marshaling.ConvertStringToNative(instance); - using godot_string whatStr = Marshaling.ConvertStringToNative(instance); - return NativeFuncs.godotsharp_string_rfind(instanceStr, whatStr, from); + if (from == -1) + from = instance.Length - 1; + + return instance.LastIndexOf(what, from, + caseSensitive ? StringComparison.Ordinal : StringComparison.OrdinalIgnoreCase); } /// <summary> - /// Perform a search for a substring, but start from the end of the string instead of the beginning. - /// Also search case-insensitive. + /// Returns the index of the last case-insensitive occurrence of the specified string in this instance, + /// or <c>-1</c>. Optionally, the starting search index can be specified, continuing to + /// the beginning of the string. /// </summary> - /// <seealso cref="RFind(string, string, int)"/> + /// <seealso cref="Find(string, string, int, bool)"/> + /// <seealso cref="Find(string, char, int, bool)"/> + /// <seealso cref="FindN(string, string, int)"/> + /// <seealso cref="RFind(string, string, int, bool)"/> /// <param name="instance">The string that will be searched.</param> /// <param name="what">The substring to search in the string.</param> /// <param name="from">The position at which to start searching.</param> /// <returns>The position at which the substring was found, or -1 if not found.</returns> public static int RFindN(this string instance, string what, int from = -1) { - using godot_string instanceStr = Marshaling.ConvertStringToNative(instance); - using godot_string whatStr = Marshaling.ConvertStringToNative(instance); - return NativeFuncs.godotsharp_string_rfindn(instanceStr, whatStr, from); + if (from == -1) + from = instance.Length - 1; + + return instance.LastIndexOf(what, from, StringComparison.OrdinalIgnoreCase); } /// <summary> @@ -1332,30 +1505,43 @@ namespace Godot /// <summary> /// Returns a copy of the string with characters removed from the right. + /// The <paramref name="chars"/> argument is a string specifying the set of characters + /// to be removed. + /// Note: The <paramref name="chars"/> is not a suffix. See <see cref="TrimSuffix"/> + /// method that will remove a single suffix string rather than a set of characters. /// </summary> /// <seealso cref="LStrip(string, string)"/> /// <param name="instance">The string to remove characters from.</param> /// <param name="chars">The characters to be removed.</param> /// <returns>A copy of the string with characters removed from the right.</returns> + [Obsolete("Use string.TrimEnd instead.")] public static string RStrip(this string instance, string chars) { - int len = instance.Length; - int end; - - for (end = len - 1; end >= 0; end--) - { - if (chars.Find(instance[end]) == -1) - { - break; - } - } + return instance.TrimEnd(chars.ToCharArray()); + } - if (end == len - 1) - { - return instance; - } + /// <summary> + /// Returns the SHA-1 hash of the string as an array of bytes. + /// </summary> + /// <seealso cref="SHA1Text(string)"/> + /// <param name="instance">The string to hash.</param> + /// <returns>The SHA-1 hash of the string.</returns> + public static byte[] SHA1Buffer(this string instance) + { +#pragma warning disable CA5350 // Do Not Use Weak Cryptographic Algorithms + return SHA1.HashData(Encoding.UTF8.GetBytes(instance)); +#pragma warning restore CA5350 + } - return instance.Substr(0, end + 1); + /// <summary> + /// Returns the SHA-1 hash of the string as a string. + /// </summary> + /// <seealso cref="SHA1Buffer(string)"/> + /// <param name="instance">The string to hash.</param> + /// <returns>The SHA-1 hash of the string.</returns> + public static string SHA1Text(this string instance) + { + return instance.SHA1Buffer().HexEncode(); } /// <summary> @@ -1366,10 +1552,7 @@ namespace Godot /// <returns>The SHA-256 hash of the string.</returns> public static byte[] SHA256Buffer(this string instance) { - using godot_string instanceStr = Marshaling.ConvertStringToNative(instance); - NativeFuncs.godotsharp_string_sha256_buffer(instanceStr, out var sha256Buffer); - using (sha256Buffer) - return Marshaling.ConvertNativePackedByteArrayToSystemArray(sha256Buffer); + return SHA256.HashData(Encoding.UTF8.GetBytes(instance)); } /// <summary> @@ -1380,10 +1563,7 @@ namespace Godot /// <returns>The SHA-256 hash of the string.</returns> public static string SHA256Text(this string instance) { - using godot_string instanceStr = Marshaling.ConvertStringToNative(instance); - NativeFuncs.godotsharp_string_sha256_text(instanceStr, out var sha256Text); - using (sha256Text) - return Marshaling.ConvertStringToManaged(sha256Text); + return instance.SHA256Buffer().HexEncode(); } /// <summary> @@ -1455,7 +1635,7 @@ namespace Godot /// <returns>The array of strings split from the string.</returns> public static string[] Split(this string instance, string divisor, bool allowEmpty = true) { - return instance.Split(new[] { divisor }, + return instance.Split(divisor, allowEmpty ? StringSplitOptions.None : StringSplitOptions.RemoveEmptyEntries); } @@ -1503,8 +1683,10 @@ namespace Godot }; /// <summary> - /// Returns a copy of the string stripped of any non-printable character at the beginning and the end. - /// The optional arguments are used to toggle stripping on the left and right edges respectively. + /// Returns a copy of the string stripped of any non-printable character + /// (including tabulations, spaces and line breaks) at the beginning and the end. + /// The optional arguments are used to toggle stripping on the left and right + /// edges respectively. /// </summary> /// <param name="instance">The string to strip.</param> /// <param name="left">If the left side should be stripped.</param> @@ -1522,6 +1704,30 @@ namespace Godot return instance.TrimEnd(_nonPrintable); } + + /// <summary> + /// Returns a copy of the string stripped of any escape character. + /// These include all non-printable control characters of the first page + /// of the ASCII table (< 32), such as tabulation (<c>\t</c>) and + /// newline (<c>\n</c> and <c>\r</c>) characters, but not spaces. + /// </summary> + /// <param name="instance">The string to strip.</param> + /// <returns>The string stripped of any escape characters.</returns> + public static string StripEscapes(this string instance) + { + var sb = new StringBuilder(); + for (int i = 0; i < instance.Length; i++) + { + // Escape characters on first page of the ASCII table, before 32 (Space). + if (instance[i] < 32) + continue; + + sb.Append(instance[i]); + } + + return sb.ToString(); + } + /// <summary> /// Returns part of the string from the position <paramref name="from"/>, with length <paramref name="len"/>. /// </summary> @@ -1539,13 +1745,15 @@ namespace Godot /// <summary> /// Converts the String (which is a character array) to PackedByteArray (which is an array of bytes). - /// The conversion is speeded up in comparison to <see cref="ToUTF8(string)"/> with the assumption - /// that all the characters the String contains are only ASCII characters. + /// The conversion is faster compared to <see cref="ToUTF8Buffer(string)"/>, + /// as this method assumes that all the characters in the String are ASCII characters. /// </summary> - /// <seealso cref="ToUTF8(string)"/> + /// <seealso cref="ToUTF8Buffer(string)"/> + /// <seealso cref="ToUTF16Buffer(string)"/> + /// <seealso cref="ToUTF32Buffer(string)"/> /// <param name="instance">The string to convert.</param> /// <returns>The string as ASCII encoded bytes.</returns> - public static byte[] ToAscii(this string instance) + public static byte[] ToASCIIBuffer(this string instance) { return Encoding.ASCII.GetBytes(instance); } @@ -1573,41 +1781,76 @@ namespace Godot } /// <summary> - /// Returns the string converted to lowercase. + /// Converts the string (which is an array of characters) to an UTF-16 encoded array of bytes. /// </summary> - /// <seealso cref="ToUpper(string)"/> + /// <seealso cref="ToASCIIBuffer(string)"/> + /// <seealso cref="ToUTF32Buffer(string)"/> + /// <seealso cref="ToUTF8Buffer(string)"/> /// <param name="instance">The string to convert.</param> - /// <returns>The string converted to lowercase.</returns> - public static string ToLower(this string instance) + /// <returns>The string as UTF-16 encoded bytes.</returns> + public static byte[] ToUTF16Buffer(this string instance) { - return instance.ToLower(); + return Encoding.Unicode.GetBytes(instance); } /// <summary> - /// Returns the string converted to uppercase. + /// Converts the string (which is an array of characters) to an UTF-32 encoded array of bytes. /// </summary> - /// <seealso cref="ToLower(string)"/> + /// <seealso cref="ToASCIIBuffer(string)"/> + /// <seealso cref="ToUTF16Buffer(string)"/> + /// <seealso cref="ToUTF8Buffer(string)"/> /// <param name="instance">The string to convert.</param> - /// <returns>The string converted to uppercase.</returns> - public static string ToUpper(this string instance) + /// <returns>The string as UTF-32 encoded bytes.</returns> + public static byte[] ToUTF32Buffer(this string instance) { - return instance.ToUpper(); + return Encoding.UTF32.GetBytes(instance); } /// <summary> - /// Converts the String (which is an array of characters) to PackedByteArray (which is an array of bytes). - /// The conversion is a bit slower than <see cref="ToAscii(string)"/>, but supports all UTF-8 characters. - /// Therefore, you should prefer this function over <see cref="ToAscii(string)"/>. + /// Converts the string (which is an array of characters) to an UTF-8 encoded array of bytes. + /// The conversion is a bit slower than <see cref="ToASCIIBuffer(string)"/>, + /// but supports all UTF-8 characters. Therefore, you should prefer this function + /// over <see cref="ToASCIIBuffer(string)"/>. /// </summary> - /// <seealso cref="ToAscii(string)"/> + /// <seealso cref="ToASCIIBuffer(string)"/> + /// <seealso cref="ToUTF16Buffer(string)"/> + /// <seealso cref="ToUTF32Buffer(string)"/> /// <param name="instance">The string to convert.</param> /// <returns>The string as UTF-8 encoded bytes.</returns> - public static byte[] ToUTF8(this string instance) + public static byte[] ToUTF8Buffer(this string instance) { return Encoding.UTF8.GetBytes(instance); } /// <summary> + /// Removes a given string from the start if it starts with it or leaves the string unchanged. + /// </summary> + /// <param name="instance">The string to remove the prefix from.</param> + /// <param name="prefix">The string to remove from the start.</param> + /// <returns>A copy of the string with the prefix string removed from the start.</returns> + public static string TrimPrefix(this string instance, string prefix) + { + if (instance.StartsWith(prefix)) + return instance.Substring(prefix.Length); + + return instance; + } + + /// <summary> + /// Removes a given string from the end if it ends with it or leaves the string unchanged. + /// </summary> + /// <param name="instance">The string to remove the suffix from.</param> + /// <param name="suffix">The string to remove from the end.</param> + /// <returns>A copy of the string with the suffix string removed from the end.</returns> + public static string TrimSuffix(this string instance, string suffix) + { + if (instance.EndsWith(suffix)) + return instance.Substring(0, instance.Length - suffix.Length); + + return instance; + } + + /// <summary> /// Decodes a string in URL encoded format. This is meant to /// decode parameters in a URL when receiving an HTTP request. /// This mostly wraps around <see cref="Uri.UnescapeDataString"/>, @@ -1634,6 +1877,25 @@ namespace Godot return Uri.EscapeDataString(instance); } + private const string _uniqueNodePrefix = "%"; + private static readonly string[] _invalidNodeNameCharacters = { ".", ":", "@", "/", "\"", _uniqueNodePrefix }; + + /// <summary> + /// Removes any characters from the string that are prohibited in + /// <see cref="Node"/> names (<c>.</c> <c>:</c> <c>@</c> <c>/</c> <c>"</c>). + /// </summary> + /// <param name="instance">The string to sanitize.</param> + /// <returns>The string sanitized as a valid node name.</returns> + public static string ValidateNodeName(this string instance) + { + string name = instance.Replace(_invalidNodeNameCharacters[0], ""); + for (int i = 1; i < _invalidNodeNameCharacters.Length; i++) + { + name = name.Replace(_invalidNodeNameCharacters[i], ""); + } + return name; + } + /// <summary> /// Returns a copy of the string with special characters escaped using the XML standard. /// </summary> diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Variant.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Variant.cs index 237a4da364..49a363cef2 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Variant.cs +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Variant.cs @@ -109,16 +109,50 @@ public partial struct Variant : IDisposable public override string ToString() => AsString(); - public object? Obj - { - get + public object? Obj => + _obj ??= NativeVar.DangerousSelfRef.Type switch { - if (_obj == null) - _obj = Marshaling.ConvertVariantToManagedObject((godot_variant)NativeVar); - - return _obj; - } - } + Type.Bool => AsBool(), + Type.Int => AsInt64(), + Type.Float => AsDouble(), + Type.String => AsString(), + Type.Vector2 => AsVector2(), + Type.Vector2i => AsVector2i(), + Type.Rect2 => AsRect2(), + Type.Rect2i => AsRect2i(), + Type.Vector3 => AsVector3(), + Type.Vector3i => AsVector3i(), + Type.Transform2d => AsTransform2D(), + Type.Vector4 => AsVector4(), + Type.Vector4i => AsVector4i(), + Type.Plane => AsPlane(), + Type.Quaternion => AsQuaternion(), + Type.Aabb => AsAABB(), + Type.Basis => AsBasis(), + Type.Transform3d => AsTransform3D(), + Type.Projection => AsProjection(), + Type.Color => AsColor(), + Type.StringName => AsStringName(), + Type.NodePath => AsNodePath(), + Type.Rid => AsRID(), + Type.Object => AsGodotObject(), + Type.Callable => AsCallable(), + Type.Signal => AsSignalInfo(), + Type.Dictionary => AsGodotDictionary(), + Type.Array => AsGodotArray(), + Type.PackedByteArray => AsByteArray(), + Type.PackedInt32Array => AsInt32Array(), + Type.PackedInt64Array => AsInt64Array(), + Type.PackedFloat32Array => AsFloat32Array(), + Type.PackedFloat64Array => AsFloat64Array(), + Type.PackedStringArray => AsStringArray(), + Type.PackedVector2Array => AsVector2Array(), + Type.PackedVector3Array => AsVector3Array(), + Type.PackedColorArray => AsColorArray(), + Type.Nil => null, + Type.Max or _ => + throw new InvalidOperationException($"Invalid Variant type: {NativeVar.DangerousSelfRef.Type}"), + }; [MethodImpl(MethodImplOptions.AggressiveInlining)] public static Variant From<[MustBeVariant] T>(in T from) => diff --git a/modules/mono/glue/runtime_interop.cpp b/modules/mono/glue/runtime_interop.cpp index e20a88076a..338e5a0147 100644 --- a/modules/mono/glue/runtime_interop.cpp +++ b/modules/mono/glue/runtime_interop.cpp @@ -1067,30 +1067,6 @@ void godotsharp_dictionary_to_string(const Dictionary *p_self, String *r_str) { *r_str = Variant(*p_self).operator String(); } -void godotsharp_string_md5_buffer(const String *p_self, PackedByteArray *r_md5_buffer) { - memnew_placement(r_md5_buffer, PackedByteArray(p_self->md5_buffer())); -} - -void godotsharp_string_md5_text(const String *p_self, String *r_md5_text) { - memnew_placement(r_md5_text, String(p_self->md5_text())); -} - -int32_t godotsharp_string_rfind(const String *p_self, const String *p_what, int32_t p_from) { - return p_self->rfind(*p_what, p_from); -} - -int32_t godotsharp_string_rfindn(const String *p_self, const String *p_what, int32_t p_from) { - return p_self->rfindn(*p_what, p_from); -} - -void godotsharp_string_sha256_buffer(const String *p_self, PackedByteArray *r_sha256_buffer) { - memnew_placement(r_sha256_buffer, PackedByteArray(p_self->sha256_buffer())); -} - -void godotsharp_string_sha256_text(const String *p_self, String *r_sha256_text) { - memnew_placement(r_sha256_text, String(p_self->sha256_text())); -} - void godotsharp_string_simplify_path(const String *p_self, String *r_simplified_path) { memnew_placement(r_simplified_path, String(p_self->simplify_path())); } @@ -1473,12 +1449,6 @@ static const void *unmanaged_callbacks[]{ (void *)godotsharp_dictionary_duplicate, (void *)godotsharp_dictionary_remove_key, (void *)godotsharp_dictionary_to_string, - (void *)godotsharp_string_md5_buffer, - (void *)godotsharp_string_md5_text, - (void *)godotsharp_string_rfind, - (void *)godotsharp_string_rfindn, - (void *)godotsharp_string_sha256_buffer, - (void *)godotsharp_string_sha256_text, (void *)godotsharp_string_simplify_path, (void *)godotsharp_string_to_camel_case, (void *)godotsharp_string_to_pascal_case, diff --git a/modules/noise/editor/noise_editor_plugin.cpp b/modules/noise/editor/noise_editor_plugin.cpp index 47f5f8f819..a8e376e142 100644 --- a/modules/noise/editor/noise_editor_plugin.cpp +++ b/modules/noise/editor/noise_editor_plugin.cpp @@ -34,6 +34,7 @@ #include "editor/editor_inspector.h" #include "editor/editor_scale.h" +#include "scene/gui/button.h" #include "scene/gui/texture_rect.h" #include "modules/noise/noise.h" diff --git a/modules/openxr/config.py b/modules/openxr/config.py index 279168cc59..e503f12739 100644 --- a/modules/openxr/config.py +++ b/modules/openxr/config.py @@ -1,6 +1,6 @@ def can_build(env, platform): if platform in ("linuxbsd", "windows", "android"): - return env["openxr"] + return env["openxr"] and not env["disable_3d"] else: # not supported on these platforms return False diff --git a/modules/openxr/extensions/openxr_android_extension.cpp b/modules/openxr/extensions/openxr_android_extension.cpp index ea539f2053..753fc5fa89 100644 --- a/modules/openxr/extensions/openxr_android_extension.cpp +++ b/modules/openxr/extensions/openxr_android_extension.cpp @@ -47,11 +47,15 @@ OpenXRAndroidExtension *OpenXRAndroidExtension::get_singleton() { OpenXRAndroidExtension::OpenXRAndroidExtension(OpenXRAPI *p_openxr_api) : OpenXRExtensionWrapper(p_openxr_api) { singleton = this; - request_extensions[XR_KHR_LOADER_INIT_ANDROID_EXTENSION_NAME] = nullptr; // must be available + request_extensions[XR_KHR_LOADER_INIT_ANDROID_EXTENSION_NAME] = &loader_init_extension_available; request_extensions[XR_KHR_ANDROID_CREATE_INSTANCE_EXTENSION_NAME] = &create_instance_extension_available; } void OpenXRAndroidExtension::on_before_instance_created() { + if (!loader_init_extension_available) { + print_line("OpenXR: XR_KHR_loader_init_android is not reported as available - trying to initialize anyway..."); + } + EXT_INIT_XR_FUNC(xrInitializeLoaderKHR); JNIEnv *env = get_jni_env(); diff --git a/modules/openxr/extensions/openxr_android_extension.h b/modules/openxr/extensions/openxr_android_extension.h index ca6011559a..087b634756 100644 --- a/modules/openxr/extensions/openxr_android_extension.h +++ b/modules/openxr/extensions/openxr_android_extension.h @@ -48,6 +48,7 @@ public: private: static OpenXRAndroidExtension *singleton; + bool loader_init_extension_available = false; bool create_instance_extension_available = false; // Initialize the loader diff --git a/modules/openxr/extensions/openxr_opengl_extension.cpp b/modules/openxr/extensions/openxr_opengl_extension.cpp index 569030cc11..3b7c130149 100644 --- a/modules/openxr/extensions/openxr_opengl_extension.cpp +++ b/modules/openxr/extensions/openxr_opengl_extension.cpp @@ -136,9 +136,9 @@ void *OpenXROpenGLExtension::set_session_create_and_get_next_pointer(void *p_nex graphics_binding_gl.type = XR_TYPE_GRAPHICS_BINDING_OPENGL_ES_ANDROID_KHR; graphics_binding_gl.next = p_next_pointer; - graphics_binding_gl.display = eglGetCurrentDisplay(); + graphics_binding_gl.display = (void *)display_server->window_get_native_handle(DisplayServer::DISPLAY_HANDLE); graphics_binding_gl.config = (EGLConfig)0; // https://github.com/KhronosGroup/OpenXR-SDK-Source/blob/master/src/tests/hello_xr/graphicsplugin_opengles.cpp#L122 - graphics_binding_gl.context = eglGetCurrentContext(); + graphics_binding_gl.context = (void *)display_server->window_get_native_handle(DisplayServer::OPENGL_CONTEXT); #else graphics_binding_gl.type = XR_TYPE_GRAPHICS_BINDING_OPENGL_XLIB_KHR; graphics_binding_gl.next = p_next_pointer; diff --git a/modules/openxr/openxr_api.cpp b/modules/openxr/openxr_api.cpp index d6580ebfa6..59d3865acd 100644 --- a/modules/openxr/openxr_api.cpp +++ b/modules/openxr/openxr_api.cpp @@ -51,7 +51,7 @@ #define XR_USE_GRAPHICS_API_VULKAN #endif #ifdef GLES3_ENABLED -#ifdef ANDROID +#ifdef ANDROID_ENABLED #define XR_USE_GRAPHICS_API_OPENGL_ES #include <EGL/egl.h> #include <EGL/eglext.h> @@ -59,7 +59,7 @@ #include <GLES3/gl3ext.h> #else #define XR_USE_GRAPHICS_API_OPENGL -#endif // ANDROID +#endif // ANDROID_ENABLED #ifdef X11_ENABLED #include OPENGL_INCLUDE_H #define GL_GLEXT_PROTOTYPES 1 diff --git a/modules/raycast/SCsub b/modules/raycast/SCsub index 20b05816e1..51d75d45b0 100644 --- a/modules/raycast/SCsub +++ b/modules/raycast/SCsub @@ -67,7 +67,7 @@ if env["builtin_embree"]: env_raycast.AppendUnique(CPPDEFINES=["NDEBUG"]) # No assert() even in debug builds. if not env.msvc: - if env["arch"] == "x86_64": + if env["arch"] in ["x86_64", "x86_32"]: env_raycast.Append(CPPFLAGS=["-msse2", "-mxsave"]) if env["platform"] == "windows": @@ -87,10 +87,13 @@ if env["builtin_embree"]: env_thirdparty.disable_warnings() env_thirdparty.add_source_files(thirdparty_obj, thirdparty_sources) - if env["arch"] == "arm64" or env.msvc: + if env["arch"] != "x86_64" or env.msvc: # Embree needs those, it will automatically use SSE2NEON in ARM env_thirdparty.Append(CPPDEFINES=["__SSE2__", "__SSE__"]) + if env["platform"] == "web": + env_thirdparty.Append(CPPFLAGS=["-msimd128"]) + if not env.msvc: env_thirdparty.Append( CPPFLAGS=[ diff --git a/modules/raycast/config.py b/modules/raycast/config.py index 833ad50018..f4243f01c5 100644 --- a/modules/raycast/config.py +++ b/modules/raycast/config.py @@ -1,9 +1,13 @@ def can_build(env, platform): - # Depends on Embree library, which only supports x86_64 and arm64. - if platform == "windows": - return env["arch"] == "x86_64" # TODO build for Windows on ARM - - return env["arch"] in ["x86_64", "arm64"] + # Supported architectures depend on the Embree library. + # No ARM32 support planned. + if env["arch"] == "arm32": + return False + # x86_32 only seems supported on Windows for now. + if env["arch"] == "x86_32" and platform != "windows": + return False + # The rest works, even wasm32! + return True def configure(env): diff --git a/modules/text_server_adv/text_server_adv.cpp b/modules/text_server_adv/text_server_adv.cpp index cf2d8c9986..27fab88956 100644 --- a/modules/text_server_adv/text_server_adv.cpp +++ b/modules/text_server_adv/text_server_adv.cpp @@ -34,6 +34,7 @@ // Headers for building as GDExtension plug-in. #include <godot_cpp/classes/file_access.hpp> +#include <godot_cpp/classes/os.hpp> #include <godot_cpp/classes/project_settings.hpp> #include <godot_cpp/classes/rendering_server.hpp> #include <godot_cpp/classes/translation_server.hpp> @@ -1437,11 +1438,13 @@ _FORCE_INLINE_ bool TextServerAdvanced::_ensure_cache_for_size(FontAdvanced *p_f if (fd->face->style_name != nullptr) { p_font_data->style_name = String::utf8((const char *)fd->face->style_name); } + p_font_data->weight = _font_get_weight_by_name(p_font_data->style_name.to_lower()); + p_font_data->stretch = _font_get_stretch_by_name(p_font_data->style_name.to_lower()); p_font_data->style_flags = 0; - if (fd->face->style_flags & FT_STYLE_FLAG_BOLD) { + if ((fd->face->style_flags & FT_STYLE_FLAG_BOLD) || p_font_data->weight >= 700) { p_font_data->style_flags.set_flag(FONT_BOLD); } - if (fd->face->style_flags & FT_STYLE_FLAG_ITALIC) { + if ((fd->face->style_flags & FT_STYLE_FLAG_ITALIC) || _is_ital_style(p_font_data->style_name.to_lower())) { p_font_data->style_flags.set_flag(FONT_ITALIC); } if (fd->face->face_flags & FT_FACE_FLAG_FIXED_WIDTH) { @@ -1967,6 +1970,46 @@ String TextServerAdvanced::_font_get_style_name(const RID &p_font_rid) const { return fd->style_name; } +void TextServerAdvanced::_font_set_weight(const RID &p_font_rid, int64_t p_weight) { + FontAdvanced *fd = font_owner.get_or_null(p_font_rid); + ERR_FAIL_COND(!fd); + + MutexLock lock(fd->mutex); + Vector2i size = _get_size(fd, 16); + ERR_FAIL_COND(!_ensure_cache_for_size(fd, size)); + fd->weight = CLAMP(p_weight, 100, 999); +} + +int64_t TextServerAdvanced::_font_get_weight(const RID &p_font_rid) const { + FontAdvanced *fd = font_owner.get_or_null(p_font_rid); + ERR_FAIL_COND_V(!fd, 400); + + MutexLock lock(fd->mutex); + Vector2i size = _get_size(fd, 16); + ERR_FAIL_COND_V(!_ensure_cache_for_size(fd, size), 400); + return fd->weight; +} + +void TextServerAdvanced::_font_set_stretch(const RID &p_font_rid, int64_t p_stretch) { + FontAdvanced *fd = font_owner.get_or_null(p_font_rid); + ERR_FAIL_COND(!fd); + + MutexLock lock(fd->mutex); + Vector2i size = _get_size(fd, 16); + ERR_FAIL_COND(!_ensure_cache_for_size(fd, size)); + fd->stretch = CLAMP(p_stretch, 50, 200); +} + +int64_t TextServerAdvanced::_font_get_stretch(const RID &p_font_rid) const { + FontAdvanced *fd = font_owner.get_or_null(p_font_rid); + ERR_FAIL_COND_V(!fd, 100); + + MutexLock lock(fd->mutex); + Vector2i size = _get_size(fd, 16); + ERR_FAIL_COND_V(!_ensure_cache_for_size(fd, size), 100); + return fd->stretch; +} + void TextServerAdvanced::_font_set_name(const RID &p_font_rid, const String &p_name) { FontAdvanced *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND(!fd); @@ -2103,6 +2146,25 @@ int64_t TextServerAdvanced::_font_get_fixed_size(const RID &p_font_rid) const { return fd->fixed_size; } +void TextServerAdvanced::_font_set_allow_system_fallback(const RID &p_font_rid, bool p_allow_system_fallback) { + FontAdvanced *fd = font_owner.get_or_null(p_font_rid); + ERR_FAIL_COND(!fd); + + MutexLock lock(fd->mutex); + if (fd->allow_system_fallback != p_allow_system_fallback) { + _font_clear_cache(fd); + fd->allow_system_fallback = p_allow_system_fallback; + } +} + +bool TextServerAdvanced::_font_is_allow_system_fallback(const RID &p_font_rid) const { + FontAdvanced *fd = font_owner.get_or_null(p_font_rid); + ERR_FAIL_COND_V(!fd, false); + + MutexLock lock(fd->mutex); + return fd->allow_system_fallback; +} + void TextServerAdvanced::_font_set_force_autohinter(const RID &p_font_rid, bool p_force_autohinter) { FontAdvanced *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND(!fd); @@ -4632,12 +4694,11 @@ bool TextServerAdvanced::_shaped_text_update_breaks(const RID &p_shaped) { sd->breaks[pos] = true; } else if ((ubrk_getRuleStatus(bi) >= UBRK_LINE_SOFT) && (ubrk_getRuleStatus(bi) < UBRK_LINE_SOFT_LIMIT)) { sd->breaks[pos] = false; - - int pos_p = pos - 1 - sd->start; - char32_t c = sd->text[pos_p]; - if (pos - sd->start != sd->end && !is_whitespace(c) && (c != 0xfffc)) { - sd->break_inserts++; - } + } + int pos_p = pos - 1 - sd->start; + char32_t c = sd->text[pos_p]; + if (pos - sd->start != sd->end && !is_whitespace(c) && (c != 0xfffc)) { + sd->break_inserts++; } } } @@ -5066,10 +5127,177 @@ _FORCE_INLINE_ void TextServerAdvanced::_add_featuers(const Dictionary &p_source } } -void TextServerAdvanced::_shape_run(ShapedTextDataAdvanced *p_sd, int64_t p_start, int64_t p_end, hb_script_t p_script, hb_direction_t p_direction, TypedArray<RID> p_fonts, int64_t p_span, int64_t p_fb_index) { +void TextServerAdvanced::_shape_run(ShapedTextDataAdvanced *p_sd, int64_t p_start, int64_t p_end, hb_script_t p_script, hb_direction_t p_direction, TypedArray<RID> p_fonts, int64_t p_span, int64_t p_fb_index, int64_t p_prev_start, int64_t p_prev_end) { + RID f; int fs = p_sd->spans[p_span].font_size; - if (p_fb_index >= p_fonts.size()) { - // Add fallback glyphs. + + if (p_fb_index >= 0 && p_fb_index < p_fonts.size()) { + // Try font from list. + f = p_fonts[p_fb_index]; + } else if (OS::get_singleton()->has_feature("system_fonts") && p_fonts.size() > 0 && ((p_fb_index == p_fonts.size()) || (p_fb_index > p_fonts.size() && p_start != p_prev_start))) { + // Try system fallback. + RID fdef = p_fonts[0]; + if (_font_is_allow_system_fallback(fdef)) { + String text = p_sd->text.substr(p_start, 1); + String font_name = _font_get_name(fdef); + BitField<FontStyle> font_style = _font_get_style(fdef); + int font_weight = _font_get_weight(fdef); + int font_stretch = _font_get_stretch(fdef); + Dictionary dvar = _font_get_variation_coordinates(fdef); + static int64_t wgth_tag = _name_to_tag("weight"); + static int64_t wdth_tag = _name_to_tag("width"); + static int64_t ital_tag = _name_to_tag("italic"); + if (dvar.has(wgth_tag)) { + font_weight = dvar[wgth_tag].operator int(); + } + if (dvar.has(wdth_tag)) { + font_stretch = dvar[wdth_tag].operator int(); + } + if (dvar.has(ital_tag) && dvar[ital_tag].operator int() == 1) { + font_style.set_flag(TextServer::FONT_ITALIC); + } + + char scr_buffer[5] = { 0, 0, 0, 0, 0 }; + hb_tag_to_string(hb_script_to_iso15924_tag(p_script), scr_buffer); + String script_code = String(scr_buffer); + String locale = (p_sd->spans[p_span].language.is_empty()) ? TranslationServer::get_singleton()->get_tool_locale() : p_sd->spans[p_span].language; + + PackedStringArray fallback_font_name = OS::get_singleton()->get_system_font_path_for_text(font_name, text, locale, script_code, font_weight, font_stretch, font_style & TextServer::FONT_ITALIC); +#ifdef GDEXTENSION + for (int fb = 0; fb < fallback_font_name.size(); fb++) { + const String &E = fallback_font_name[fb]; +#else + for (const String &E : fallback_font_name) { +#endif + SystemFontKey key = SystemFontKey(E, font_style & TextServer::FONT_ITALIC, font_weight, font_stretch, fdef, this); + if (system_fonts.has(key)) { + const SystemFontCache &sysf_cache = system_fonts[key]; + int best_score = 0; + int best_match = -1; + for (int face_idx = 0; face_idx < sysf_cache.var.size(); face_idx++) { + const SystemFontCacheRec &F = sysf_cache.var[face_idx]; + if (unlikely(!_font_has_char(F.rid, text[0]))) { + continue; + } + BitField<FontStyle> style = _font_get_style(F.rid); + int weight = _font_get_weight(F.rid); + int stretch = _font_get_stretch(F.rid); + int score = (20 - Math::abs(weight - font_weight) / 50); + score += (20 - Math::abs(stretch - font_stretch) / 10); + if (bool(style & TextServer::FONT_ITALIC) == bool(font_style & TextServer::FONT_ITALIC)) { + score += 30; + } + if (score >= best_score) { + best_score = score; + best_match = face_idx; + } + if (best_score == 70) { + break; + } + } + if (best_match != -1) { + f = sysf_cache.var[best_match].rid; + } + } + if (!f.is_valid()) { + if (system_fonts.has(key)) { + const SystemFontCache &sysf_cache = system_fonts[key]; + if (sysf_cache.max_var == sysf_cache.var.size()) { + // All subfonts already tested, skip. + continue; + } + } + + if (!system_font_data.has(E)) { + system_font_data[E] = FileAccess::get_file_as_bytes(E); + } + + const PackedByteArray &font_data = system_font_data[E]; + + SystemFontCacheRec sysf; + sysf.rid = _create_font(); + _font_set_data_ptr(sysf.rid, font_data.ptr(), font_data.size()); + + Dictionary var = dvar; + // Select matching style from collection. + int best_score = 0; + int best_match = -1; + for (int face_idx = 0; face_idx < _font_get_face_count(sysf.rid); face_idx++) { + _font_set_face_index(sysf.rid, face_idx); + if (unlikely(!_font_has_char(sysf.rid, text[0]))) { + continue; + } + BitField<FontStyle> style = _font_get_style(sysf.rid); + int weight = _font_get_weight(sysf.rid); + int stretch = _font_get_stretch(sysf.rid); + int score = (20 - Math::abs(weight - font_weight) / 50); + score += (20 - Math::abs(stretch - font_stretch) / 10); + if (bool(style & TextServer::FONT_ITALIC) == bool(font_style & TextServer::FONT_ITALIC)) { + score += 30; + } + if (score >= best_score) { + best_score = score; + best_match = face_idx; + } + if (best_score == 70) { + break; + } + } + if (best_match == -1) { + _free_rid(sysf.rid); + continue; + } else { + _font_set_face_index(sysf.rid, best_match); + } + sysf.index = best_match; + + // If it's a variable font, apply weight, stretch and italic coordinates to match requested style. + if (best_score != 70) { + Dictionary ftr = _font_supported_variation_list(sysf.rid); + if (ftr.has(wdth_tag)) { + var[wdth_tag] = font_stretch; + _font_set_stretch(sysf.rid, font_stretch); + } + if (ftr.has(wgth_tag)) { + var[wgth_tag] = font_weight; + _font_set_weight(sysf.rid, font_weight); + } + if ((font_style & TextServer::FONT_ITALIC) && ftr.has(ital_tag)) { + var[ital_tag] = 1; + _font_set_style(sysf.rid, _font_get_style(sysf.rid) | TextServer::FONT_ITALIC); + } + } + + _font_set_antialiasing(sysf.rid, key.antialiasing); + _font_set_generate_mipmaps(sysf.rid, key.mipmaps); + _font_set_multichannel_signed_distance_field(sysf.rid, key.msdf); + _font_set_msdf_pixel_range(sysf.rid, key.msdf_range); + _font_set_msdf_size(sysf.rid, key.msdf_source_size); + _font_set_fixed_size(sysf.rid, key.fixed_size); + _font_set_force_autohinter(sysf.rid, key.force_autohinter); + _font_set_hinting(sysf.rid, key.hinting); + _font_set_subpixel_positioning(sysf.rid, key.subpixel_positioning); + _font_set_variation_coordinates(sysf.rid, var); + _font_set_oversampling(sysf.rid, key.oversampling); + _font_set_embolden(sysf.rid, key.embolden); + _font_set_transform(sysf.rid, key.transform); + + if (system_fonts.has(key)) { + system_fonts[key].var.push_back(sysf); + } else { + SystemFontCache &sysf_cache = system_fonts[key]; + sysf_cache.max_var = _font_get_face_count(sysf.rid); + sysf_cache.var.push_back(sysf); + } + f = sysf.rid; + } + break; + } + } + } + + if (!f.is_valid()) { + // No valid font, use fallback hex code boxes. for (int i = p_start; i < p_end; i++) { if (p_sd->preserve_invalid || (p_sd->preserve_control && is_control(p_sd->text[i]))) { Glyph gl; @@ -5100,7 +5328,6 @@ void TextServerAdvanced::_shape_run(ShapedTextDataAdvanced *p_sd, int64_t p_star return; } - RID f = p_fonts[p_fb_index]; FontAdvanced *fd = font_owner.get_or_null(f); ERR_FAIL_COND(!fd); MutexLock lock(fd->mutex); @@ -5195,7 +5422,7 @@ void TextServerAdvanced::_shape_run(ShapedTextDataAdvanced *p_sd, int64_t p_star gl.end = end; gl.count = 0; - gl.font_rid = p_fonts[p_fb_index]; + gl.font_rid = f; gl.font_size = fs; if (glyph_info[i].mask & HB_GLYPH_FLAG_UNSAFE_TO_BREAK) { @@ -5262,7 +5489,7 @@ void TextServerAdvanced::_shape_run(ShapedTextDataAdvanced *p_sd, int64_t p_star for (unsigned int i = 0; i < glyph_count; i++) { if ((w[i].flags & GRAPHEME_IS_VALID) == GRAPHEME_IS_VALID) { if (failed_subrun_start != p_end + 1) { - _shape_run(p_sd, failed_subrun_start, failed_subrun_end, p_script, p_direction, p_fonts, p_span, p_fb_index + 1); + _shape_run(p_sd, failed_subrun_start, failed_subrun_end, p_script, p_direction, p_fonts, p_span, p_fb_index + 1, p_start, p_end); failed_subrun_start = p_end + 1; failed_subrun_end = p_start; } @@ -5292,7 +5519,7 @@ void TextServerAdvanced::_shape_run(ShapedTextDataAdvanced *p_sd, int64_t p_star } memfree(w); if (failed_subrun_start != p_end + 1) { - _shape_run(p_sd, failed_subrun_start, failed_subrun_end, p_script, p_direction, p_fonts, p_span, p_fb_index + 1); + _shape_run(p_sd, failed_subrun_start, failed_subrun_end, p_script, p_direction, p_fonts, p_span, p_fb_index + 1, p_start, p_end); } p_sd->ascent = MAX(p_sd->ascent, _font_get_ascent(f, fs)); p_sd->descent = MAX(p_sd->descent, _font_get_descent(f, fs)); @@ -5464,7 +5691,7 @@ bool TextServerAdvanced::_shaped_text_shape(const RID &p_shaped) { } fonts.append_array(fonts_scr_only); fonts.append_array(fonts_no_match); - _shape_run(sd, MAX(sd->spans[k].start - sd->start, script_run_start), MIN(sd->spans[k].end - sd->start, script_run_end), sd->script_iter->script_ranges[j].script, bidi_run_direction, fonts, k, 0); + _shape_run(sd, MAX(sd->spans[k].start - sd->start, script_run_start), MIN(sd->spans[k].end - sd->start, script_run_end), sd->script_iter->script_ranges[j].script, bidi_run_direction, fonts, k, 0, 0, 0); } } } @@ -5961,7 +6188,11 @@ String TextServerAdvanced::_strip_diacritics(const String &p_string) const { String result; for (int i = 0; i < normalized_string.length(); i++) { if (u_getCombiningClass(normalized_string[i]) == 0) { +#ifdef GDEXTENSION + result = result + String::chr(normalized_string[i]); +#else result = result + normalized_string[i]; +#endif } } return result; @@ -6243,6 +6474,17 @@ TextServerAdvanced::TextServerAdvanced() { _bmp_create_font_funcs(); } +void TextServerAdvanced::_cleanup() { + for (const KeyValue<SystemFontKey, SystemFontCache> &E : system_fonts) { + const Vector<SystemFontCacheRec> &sysf_cache = E.value.var; + for (const SystemFontCacheRec &F : sysf_cache) { + _free_rid(F.rid); + } + } + system_fonts.clear(); + system_font_data.clear(); +} + TextServerAdvanced::~TextServerAdvanced() { _bmp_free_font_funcs(); #ifdef MODULE_FREETYPE_ENABLED diff --git a/modules/text_server_adv/text_server_adv.h b/modules/text_server_adv/text_server_adv.h index 10fe3c2316..5e6d2cc2c0 100644 --- a/modules/text_server_adv/text_server_adv.h +++ b/modules/text_server_adv/text_server_adv.h @@ -300,6 +300,7 @@ class TextServerAdvanced : public TextServerExtension { int msdf_range = 14; int msdf_source_size = 48; int fixed_size = 0; + bool allow_system_fallback = true; bool force_autohinter = false; TextServer::Hinting hinting = TextServer::HINTING_LIGHT; TextServer::SubpixelPositioning subpixel_positioning = TextServer::SUBPIXEL_POSITIONING_AUTO; @@ -311,6 +312,8 @@ class TextServerAdvanced : public TextServerExtension { BitField<TextServer::FontStyle> style_flags = 0; String font_name; String style_name; + int weight = 400; + int stretch = 100; HashMap<Vector2i, FontForSizeAdvanced *, VariantHasher, VariantComparator> cache; @@ -372,6 +375,57 @@ class TextServerAdvanced : public TextServerExtension { _FORCE_INLINE_ double _get_extra_advance(RID p_font_rid, int p_font_size) const; _FORCE_INLINE_ Variant::Type _get_tag_type(int64_t p_tag) const; _FORCE_INLINE_ bool _get_tag_hidden(int64_t p_tag) const; + _FORCE_INLINE_ int _font_get_weight_by_name(const String &p_sty_name) const { + String sty_name = p_sty_name.replace(" ", "").replace("-", ""); + if (sty_name.find("thin") >= 0 || sty_name.find("hairline") >= 0) { + return 100; + } else if (sty_name.find("extralight") >= 0 || sty_name.find("ultralight") >= 0) { + return 200; + } else if (sty_name.find("light") >= 0) { + return 300; + } else if (sty_name.find("semilight") >= 0) { + return 350; + } else if (sty_name.find("regular") >= 0) { + return 400; + } else if (sty_name.find("medium") >= 0) { + return 500; + } else if (sty_name.find("semibold") >= 0 || sty_name.find("demibold") >= 0) { + return 600; + } else if (sty_name.find("bold") >= 0) { + return 700; + } else if (sty_name.find("extrabold") >= 0 || sty_name.find("ultrabold") >= 0) { + return 800; + } else if (sty_name.find("black") >= 0 || sty_name.find("heavy") >= 0) { + return 900; + } else if (sty_name.find("extrablack") >= 0 || sty_name.find("ultrablack") >= 0) { + return 950; + } + return 400; + } + _FORCE_INLINE_ int _font_get_stretch_by_name(const String &p_sty_name) const { + String sty_name = p_sty_name.replace(" ", "").replace("-", ""); + if (sty_name.find("ultracondensed") >= 0) { + return 50; + } else if (sty_name.find("extracondensed") >= 0) { + return 63; + } else if (sty_name.find("condensed") >= 0) { + return 75; + } else if (sty_name.find("semicondensed") >= 0) { + return 87; + } else if (sty_name.find("semiexpanded") >= 0) { + return 113; + } else if (sty_name.find("expanded") >= 0) { + return 125; + } else if (sty_name.find("extraexpanded") >= 0) { + return 150; + } else if (sty_name.find("ultraexpanded") >= 0) { + return 200; + } + return 100; + } + _FORCE_INLINE_ bool _is_ital_style(const String &p_sty_name) const { + return (p_sty_name.find("italic") >= 0) || (p_sty_name.find("oblique") >= 0); + } // Shaped text cache data. struct TrimData { @@ -474,12 +528,87 @@ class TextServerAdvanced : public TextServerExtension { mutable RID_PtrOwner<FontAdvanced> font_owner; mutable RID_PtrOwner<ShapedTextDataAdvanced> shaped_owner; + struct SystemFontKey { + String font_name; + TextServer::FontAntialiasing antialiasing = TextServer::FONT_ANTIALIASING_GRAY; + bool italic = false; + bool mipmaps = false; + bool msdf = false; + bool force_autohinter = false; + int weight = 400; + int stretch = 100; + int msdf_range = 14; + int msdf_source_size = 48; + int fixed_size = 0; + TextServer::Hinting hinting = TextServer::HINTING_LIGHT; + TextServer::SubpixelPositioning subpixel_positioning = TextServer::SUBPIXEL_POSITIONING_AUTO; + Dictionary variation_coordinates; + double oversampling = 0.0; + double embolden = 0.0; + Transform2D transform; + + bool operator==(const SystemFontKey &p_b) const { + return (font_name == p_b.font_name) && (antialiasing == p_b.antialiasing) && (italic == p_b.italic) && (mipmaps == p_b.mipmaps) && (msdf == p_b.msdf) && (force_autohinter == p_b.force_autohinter) && (weight == p_b.weight) && (stretch == p_b.stretch) && (msdf_range == p_b.msdf_range) && (msdf_source_size == p_b.msdf_source_size) && (fixed_size == p_b.fixed_size) && (hinting == p_b.hinting) && (subpixel_positioning == p_b.subpixel_positioning) && (variation_coordinates == p_b.variation_coordinates) && (oversampling == p_b.oversampling) && (embolden == p_b.embolden) && (transform == p_b.transform); + } + + SystemFontKey(const String &p_font_name, bool p_italic, int p_weight, int p_stretch, RID p_font, const TextServerAdvanced *p_fb) { + font_name = p_font_name; + italic = p_italic; + weight = p_weight; + stretch = p_stretch; + antialiasing = p_fb->_font_get_antialiasing(p_font); + mipmaps = p_fb->_font_get_generate_mipmaps(p_font); + msdf = p_fb->_font_is_multichannel_signed_distance_field(p_font); + msdf_range = p_fb->_font_get_msdf_pixel_range(p_font); + msdf_source_size = p_fb->_font_get_msdf_size(p_font); + fixed_size = p_fb->_font_get_fixed_size(p_font); + force_autohinter = p_fb->_font_is_force_autohinter(p_font); + hinting = p_fb->_font_get_hinting(p_font); + subpixel_positioning = p_fb->_font_get_subpixel_positioning(p_font); + variation_coordinates = p_fb->_font_get_variation_coordinates(p_font); + oversampling = p_fb->_font_get_oversampling(p_font); + embolden = p_fb->_font_get_embolden(p_font); + transform = p_fb->_font_get_transform(p_font); + } + }; + + struct SystemFontCacheRec { + RID rid; + int index = 0; + }; + + struct SystemFontCache { + Vector<SystemFontCacheRec> var; + int max_var = 0; + }; + + struct SystemFontKeyHasher { + _FORCE_INLINE_ static uint32_t hash(const SystemFontKey &p_a) { + uint32_t hash = p_a.font_name.hash(); + hash = hash_murmur3_one_32(p_a.variation_coordinates.hash(), hash); + hash = hash_murmur3_one_32(p_a.weight, hash); + hash = hash_murmur3_one_32(p_a.stretch, hash); + hash = hash_murmur3_one_32(p_a.msdf_range, hash); + hash = hash_murmur3_one_32(p_a.msdf_source_size, hash); + hash = hash_murmur3_one_32(p_a.fixed_size, hash); + hash = hash_murmur3_one_double(p_a.oversampling, hash); + hash = hash_murmur3_one_double(p_a.embolden, hash); + hash = hash_murmur3_one_real(p_a.transform[0].x, hash); + hash = hash_murmur3_one_real(p_a.transform[0].y, hash); + hash = hash_murmur3_one_real(p_a.transform[1].x, hash); + hash = hash_murmur3_one_real(p_a.transform[1].y, hash); + return hash_fmix32(hash_murmur3_one_32(((int)p_a.mipmaps) | ((int)p_a.msdf << 1) | ((int)p_a.italic << 2) | ((int)p_a.force_autohinter << 3) | ((int)p_a.hinting << 4) | ((int)p_a.subpixel_positioning << 8) | ((int)p_a.antialiasing << 12), hash)); + } + }; + mutable HashMap<SystemFontKey, SystemFontCache, SystemFontKeyHasher> system_fonts; + mutable HashMap<String, PackedByteArray> system_font_data; + void _realign(ShapedTextDataAdvanced *p_sd) const; int64_t _convert_pos(const String &p_utf32, const Char16String &p_utf16, int64_t p_pos) const; int64_t _convert_pos(const ShapedTextDataAdvanced *p_sd, int64_t p_pos) const; int64_t _convert_pos_inv(const ShapedTextDataAdvanced *p_sd, int64_t p_pos) const; bool _shape_substr(ShapedTextDataAdvanced *p_new_sd, const ShapedTextDataAdvanced *p_sd, int64_t p_start, int64_t p_length) const; - void _shape_run(ShapedTextDataAdvanced *p_sd, int64_t p_start, int64_t p_end, hb_script_t p_script, hb_direction_t p_direction, TypedArray<RID> p_fonts, int64_t p_span, int64_t p_fb_index); + void _shape_run(ShapedTextDataAdvanced *p_sd, int64_t p_start, int64_t p_end, hb_script_t p_script, hb_direction_t p_direction, TypedArray<RID> p_fonts, int64_t p_span, int64_t p_fb_index, int64_t p_prev_start, int64_t p_prev_end); Glyph _shape_single_glyph(ShapedTextDataAdvanced *p_sd, char32_t p_char, hb_script_t p_script, hb_direction_t p_direction, const RID &p_font, int64_t p_font_size); _FORCE_INLINE_ void _add_featuers(const Dictionary &p_source, Vector<hb_feature_t> &r_ftrs); @@ -568,6 +697,12 @@ public: MODBIND2(font_set_style_name, const RID &, const String &); MODBIND1RC(String, font_get_style_name, const RID &); + MODBIND2(font_set_weight, const RID &, int64_t); + MODBIND1RC(int64_t, font_get_weight, const RID &); + + MODBIND2(font_set_stretch, const RID &, int64_t); + MODBIND1RC(int64_t, font_get_stretch, const RID &); + MODBIND2(font_set_name, const RID &, const String &); MODBIND1RC(String, font_get_name, const RID &); @@ -589,6 +724,9 @@ public: MODBIND2(font_set_fixed_size, const RID &, int64_t); MODBIND1RC(int64_t, font_get_fixed_size, const RID &); + MODBIND2(font_set_allow_system_fallback, const RID &, bool); + MODBIND1RC(bool, font_is_allow_system_fallback, const RID &); + MODBIND2(font_set_force_autohinter, const RID &, bool); MODBIND1RC(bool, font_is_force_autohinter, const RID &); @@ -787,6 +925,8 @@ public: MODBIND2RC(String, string_to_upper, const String &, const String &); MODBIND2RC(String, string_to_lower, const String &, const String &); + MODBIND0(cleanup); + TextServerAdvanced(); ~TextServerAdvanced(); }; diff --git a/modules/text_server_fb/text_server_fb.cpp b/modules/text_server_fb/text_server_fb.cpp index aaef9c9a3d..9133c277bb 100644 --- a/modules/text_server_fb/text_server_fb.cpp +++ b/modules/text_server_fb/text_server_fb.cpp @@ -34,6 +34,7 @@ // Headers for building as GDExtension plug-in. #include <godot_cpp/classes/file_access.hpp> +#include <godot_cpp/classes/os.hpp> #include <godot_cpp/classes/project_settings.hpp> #include <godot_cpp/classes/rendering_server.hpp> #include <godot_cpp/classes/translation_server.hpp> @@ -49,6 +50,7 @@ using namespace godot; #include "core/config/project_settings.h" #include "core/error/error_macros.h" #include "core/string/print_string.h" +#include "core/string/translation.h" #include "core/string/ucaps.h" #include "modules/modules_enabled.gen.h" // For freetype, msdfgen, svg. @@ -852,11 +854,13 @@ _FORCE_INLINE_ bool TextServerFallback::_ensure_cache_for_size(FontFallback *p_f if (fd->face->style_name != nullptr) { p_font_data->style_name = String::utf8((const char *)fd->face->style_name); } + p_font_data->weight = _font_get_weight_by_name(p_font_data->style_name.to_lower()); + p_font_data->stretch = _font_get_stretch_by_name(p_font_data->style_name.to_lower()); p_font_data->style_flags = 0; - if (fd->face->style_flags & FT_STYLE_FLAG_BOLD) { + if ((fd->face->style_flags & FT_STYLE_FLAG_BOLD) || p_font_data->weight >= 700) { p_font_data->style_flags.set_flag(FONT_BOLD); } - if (fd->face->style_flags & FT_STYLE_FLAG_ITALIC) { + if ((fd->face->style_flags & FT_STYLE_FLAG_ITALIC) || _is_ital_style(p_font_data->style_name.to_lower())) { p_font_data->style_flags.set_flag(FONT_ITALIC); } if (fd->face->face_flags & FT_FACE_FLAG_FIXED_WIDTH) { @@ -1061,6 +1065,46 @@ String TextServerFallback::_font_get_style_name(const RID &p_font_rid) const { return fd->style_name; } +void TextServerFallback::_font_set_weight(const RID &p_font_rid, int64_t p_weight) { + FontFallback *fd = font_owner.get_or_null(p_font_rid); + ERR_FAIL_COND(!fd); + + MutexLock lock(fd->mutex); + Vector2i size = _get_size(fd, 16); + ERR_FAIL_COND(!_ensure_cache_for_size(fd, size)); + fd->weight = CLAMP(p_weight, 100, 999); +} + +int64_t TextServerFallback::_font_get_weight(const RID &p_font_rid) const { + FontFallback *fd = font_owner.get_or_null(p_font_rid); + ERR_FAIL_COND_V(!fd, 400); + + MutexLock lock(fd->mutex); + Vector2i size = _get_size(fd, 16); + ERR_FAIL_COND_V(!_ensure_cache_for_size(fd, size), 400); + return fd->weight; +} + +void TextServerFallback::_font_set_stretch(const RID &p_font_rid, int64_t p_stretch) { + FontFallback *fd = font_owner.get_or_null(p_font_rid); + ERR_FAIL_COND(!fd); + + MutexLock lock(fd->mutex); + Vector2i size = _get_size(fd, 16); + ERR_FAIL_COND(!_ensure_cache_for_size(fd, size)); + fd->stretch = CLAMP(p_stretch, 50, 200); +} + +int64_t TextServerFallback::_font_get_stretch(const RID &p_font_rid) const { + FontFallback *fd = font_owner.get_or_null(p_font_rid); + ERR_FAIL_COND_V(!fd, 100); + + MutexLock lock(fd->mutex); + Vector2i size = _get_size(fd, 16); + ERR_FAIL_COND_V(!_ensure_cache_for_size(fd, size), 100); + return fd->stretch; +} + void TextServerFallback::_font_set_name(const RID &p_font_rid, const String &p_name) { FontFallback *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND(!fd); @@ -1197,6 +1241,25 @@ int64_t TextServerFallback::_font_get_fixed_size(const RID &p_font_rid) const { return fd->fixed_size; } +void TextServerFallback::_font_set_allow_system_fallback(const RID &p_font_rid, bool p_allow_system_fallback) { + FontFallback *fd = font_owner.get_or_null(p_font_rid); + ERR_FAIL_COND(!fd); + + MutexLock lock(fd->mutex); + if (fd->allow_system_fallback != p_allow_system_fallback) { + _font_clear_cache(fd); + fd->allow_system_fallback = p_allow_system_fallback; + } +} + +bool TextServerFallback::_font_is_allow_system_fallback(const RID &p_font_rid) const { + FontFallback *fd = font_owner.get_or_null(p_font_rid); + ERR_FAIL_COND_V(!fd, false); + + MutexLock lock(fd->mutex); + return fd->allow_system_fallback; +} + void TextServerFallback::_font_set_force_autohinter(const RID &p_font_rid, bool p_force_autohinter) { FontFallback *fd = font_owner.get_or_null(p_font_rid); ERR_FAIL_COND(!fd); @@ -3603,6 +3666,7 @@ bool TextServerFallback::_shaped_text_shape(const RID &p_shaped) { sd->glyphs.push_back(gl); } else { // Text span. + RID prev_font; for (int j = span.start; j < span.end; j++) { Glyph gl; gl.start = j; @@ -3623,6 +3687,170 @@ bool TextServerFallback::_shaped_text_shape(const RID &p_shaped) { break; } } + if (!gl.font_rid.is_valid() && prev_font.is_valid()) { + if (_font_has_char(prev_font, gl.index)) { + gl.font_rid = prev_font; + } + } + if (!gl.font_rid.is_valid() && OS::get_singleton()->has_feature("system_fonts") && span.fonts.size() > 0) { + // Try system fallback. + RID fdef = span.fonts[0]; + if (_font_is_allow_system_fallback(fdef)) { + String text = sd->text.substr(j, 1); + String font_name = _font_get_name(fdef); + BitField<FontStyle> font_style = _font_get_style(fdef); + int font_weight = _font_get_weight(fdef); + int font_stretch = _font_get_stretch(fdef); + Dictionary dvar = _font_get_variation_coordinates(fdef); + static int64_t wgth_tag = _name_to_tag("weight"); + static int64_t wdth_tag = _name_to_tag("width"); + static int64_t ital_tag = _name_to_tag("italic"); + if (dvar.has(wgth_tag)) { + font_weight = dvar[wgth_tag].operator int(); + } + if (dvar.has(wdth_tag)) { + font_stretch = dvar[wdth_tag].operator int(); + } + if (dvar.has(ital_tag) && dvar[ital_tag].operator int() == 1) { + font_style.set_flag(TextServer::FONT_ITALIC); + } + + String locale = (span.language.is_empty()) ? TranslationServer::get_singleton()->get_tool_locale() : span.language; + + PackedStringArray fallback_font_name = OS::get_singleton()->get_system_font_path_for_text(font_name, text, locale, String(), font_weight, font_stretch, font_style & TextServer::FONT_ITALIC); +#ifdef GDEXTENSION + for (int fb = 0; fb < fallback_font_name.size(); fb++) { + const String &E = fallback_font_name[fb]; +#else + for (const String &E : fallback_font_name) { +#endif + SystemFontKey key = SystemFontKey(E, font_style & TextServer::FONT_ITALIC, font_weight, font_stretch, fdef, this); + if (system_fonts.has(key)) { + const SystemFontCache &sysf_cache = system_fonts[key]; + int best_score = 0; + int best_match = -1; + for (int face_idx = 0; face_idx < sysf_cache.var.size(); face_idx++) { + const SystemFontCacheRec &F = sysf_cache.var[face_idx]; + if (unlikely(!_font_has_char(F.rid, text[0]))) { + continue; + } + BitField<FontStyle> style = _font_get_style(F.rid); + int weight = _font_get_weight(F.rid); + int stretch = _font_get_stretch(F.rid); + int score = (20 - Math::abs(weight - font_weight) / 50); + score += (20 - Math::abs(stretch - font_stretch) / 10); + if (bool(style & TextServer::FONT_ITALIC) == bool(font_style & TextServer::FONT_ITALIC)) { + score += 30; + } + if (score >= best_score) { + best_score = score; + best_match = face_idx; + } + if (best_score == 70) { + break; + } + } + if (best_match != -1) { + gl.font_rid = sysf_cache.var[best_match].rid; + } + } + if (!gl.font_rid.is_valid()) { + if (system_fonts.has(key)) { + const SystemFontCache &sysf_cache = system_fonts[key]; + if (sysf_cache.max_var == sysf_cache.var.size()) { + // All subfonts already tested, skip. + continue; + } + } + + if (!system_font_data.has(E)) { + system_font_data[E] = FileAccess::get_file_as_bytes(E); + } + + const PackedByteArray &font_data = system_font_data[E]; + + SystemFontCacheRec sysf; + sysf.rid = _create_font(); + _font_set_data_ptr(sysf.rid, font_data.ptr(), font_data.size()); + + Dictionary var = dvar; + // Select matching style from collection. + int best_score = 0; + int best_match = -1; + for (int face_idx = 0; face_idx < _font_get_face_count(sysf.rid); face_idx++) { + _font_set_face_index(sysf.rid, face_idx); + if (unlikely(!_font_has_char(sysf.rid, text[0]))) { + continue; + } + BitField<FontStyle> style = _font_get_style(sysf.rid); + int weight = _font_get_weight(sysf.rid); + int stretch = _font_get_stretch(sysf.rid); + int score = (20 - Math::abs(weight - font_weight) / 50); + score += (20 - Math::abs(stretch - font_stretch) / 10); + if (bool(style & TextServer::FONT_ITALIC) == bool(font_style & TextServer::FONT_ITALIC)) { + score += 30; + } + if (score >= best_score) { + best_score = score; + best_match = face_idx; + } + if (best_score == 70) { + break; + } + } + if (best_match == -1) { + _free_rid(sysf.rid); + continue; + } else { + _font_set_face_index(sysf.rid, best_match); + } + sysf.index = best_match; + + // If it's a variable font, apply weight, stretch and italic coordinates to match requested style. + if (best_score != 70) { + Dictionary ftr = _font_supported_variation_list(sysf.rid); + if (ftr.has(wdth_tag)) { + var[wdth_tag] = font_stretch; + _font_set_stretch(sysf.rid, font_stretch); + } + if (ftr.has(wgth_tag)) { + var[wgth_tag] = font_weight; + _font_set_weight(sysf.rid, font_weight); + } + if ((font_style & TextServer::FONT_ITALIC) && ftr.has(ital_tag)) { + var[ital_tag] = 1; + _font_set_style(sysf.rid, _font_get_style(sysf.rid) | TextServer::FONT_ITALIC); + } + } + + _font_set_antialiasing(sysf.rid, key.antialiasing); + _font_set_generate_mipmaps(sysf.rid, key.mipmaps); + _font_set_multichannel_signed_distance_field(sysf.rid, key.msdf); + _font_set_msdf_pixel_range(sysf.rid, key.msdf_range); + _font_set_msdf_size(sysf.rid, key.msdf_source_size); + _font_set_fixed_size(sysf.rid, key.fixed_size); + _font_set_force_autohinter(sysf.rid, key.force_autohinter); + _font_set_hinting(sysf.rid, key.hinting); + _font_set_subpixel_positioning(sysf.rid, key.subpixel_positioning); + _font_set_variation_coordinates(sysf.rid, var); + _font_set_oversampling(sysf.rid, key.oversampling); + _font_set_embolden(sysf.rid, key.embolden); + _font_set_transform(sysf.rid, key.transform); + + if (system_fonts.has(key)) { + system_fonts[key].var.push_back(sysf); + } else { + SystemFontCache &sysf_cache = system_fonts[key]; + sysf_cache.max_var = _font_get_face_count(sysf.rid); + sysf_cache.var.push_back(sysf); + } + gl.font_rid = sysf.rid; + } + break; + } + } + } + prev_font = gl.font_rid; double scale = _font_get_scale(gl.font_rid, gl.font_size); if (gl.font_rid.is_valid()) { @@ -3893,6 +4121,17 @@ TextServerFallback::TextServerFallback() { _insert_feature_sets(); }; +void TextServerFallback::_cleanup() { + for (const KeyValue<SystemFontKey, SystemFontCache> &E : system_fonts) { + const Vector<SystemFontCacheRec> &sysf_cache = E.value.var; + for (const SystemFontCacheRec &F : sysf_cache) { + _free_rid(F.rid); + } + } + system_fonts.clear(); + system_font_data.clear(); +} + TextServerFallback::~TextServerFallback() { #ifdef MODULE_FREETYPE_ENABLED if (ft_library != nullptr) { diff --git a/modules/text_server_fb/text_server_fb.h b/modules/text_server_fb/text_server_fb.h index 7e0bc99618..f8a05f9433 100644 --- a/modules/text_server_fb/text_server_fb.h +++ b/modules/text_server_fb/text_server_fb.h @@ -256,6 +256,7 @@ class TextServerFallback : public TextServerExtension { int msdf_source_size = 48; int fixed_size = 0; bool force_autohinter = false; + bool allow_system_fallback = true; TextServer::Hinting hinting = TextServer::HINTING_LIGHT; TextServer::SubpixelPositioning subpixel_positioning = TextServer::SUBPIXEL_POSITIONING_AUTO; Dictionary variation_coordinates; @@ -266,6 +267,8 @@ class TextServerFallback : public TextServerExtension { BitField<TextServer::FontStyle> style_flags = 0; String font_name; String style_name; + int weight = 400; + int stretch = 100; HashMap<Vector2i, FontForSizeFallback *, VariantHasher, VariantComparator> cache; @@ -322,6 +325,58 @@ class TextServerFallback : public TextServerExtension { } } + _FORCE_INLINE_ int _font_get_weight_by_name(const String &p_sty_name) const { + String sty_name = p_sty_name.replace(" ", "").replace("-", ""); + if (sty_name.find("thin") >= 0 || sty_name.find("hairline") >= 0) { + return 100; + } else if (sty_name.find("extralight") >= 0 || sty_name.find("ultralight") >= 0) { + return 200; + } else if (sty_name.find("light") >= 0) { + return 300; + } else if (sty_name.find("semilight") >= 0) { + return 350; + } else if (sty_name.find("regular") >= 0) { + return 400; + } else if (sty_name.find("medium") >= 0) { + return 500; + } else if (sty_name.find("semibold") >= 0 || sty_name.find("demibold") >= 0) { + return 600; + } else if (sty_name.find("bold") >= 0) { + return 700; + } else if (sty_name.find("extrabold") >= 0 || sty_name.find("ultrabold") >= 0) { + return 800; + } else if (sty_name.find("black") >= 0 || sty_name.find("heavy") >= 0) { + return 900; + } else if (sty_name.find("extrablack") >= 0 || sty_name.find("ultrablack") >= 0) { + return 950; + } + return 400; + } + _FORCE_INLINE_ int _font_get_stretch_by_name(const String &p_sty_name) const { + String sty_name = p_sty_name.replace(" ", "").replace("-", ""); + if (sty_name.find("ultracondensed") >= 0) { + return 50; + } else if (sty_name.find("extracondensed") >= 0) { + return 63; + } else if (sty_name.find("condensed") >= 0) { + return 75; + } else if (sty_name.find("semicondensed") >= 0) { + return 87; + } else if (sty_name.find("semiexpanded") >= 0) { + return 113; + } else if (sty_name.find("expanded") >= 0) { + return 125; + } else if (sty_name.find("extraexpanded") >= 0) { + return 150; + } else if (sty_name.find("ultraexpanded") >= 0) { + return 200; + } + return 100; + } + _FORCE_INLINE_ bool _is_ital_style(const String &p_sty_name) const { + return (p_sty_name.find("italic") >= 0) || (p_sty_name.find("oblique") >= 0); + } + // Shaped text cache data. struct TrimData { int trim_pos = -1; @@ -398,6 +453,81 @@ class TextServerFallback : public TextServerExtension { mutable RID_PtrOwner<FontFallback> font_owner; mutable RID_PtrOwner<ShapedTextDataFallback> shaped_owner; + struct SystemFontKey { + String font_name; + TextServer::FontAntialiasing antialiasing = TextServer::FONT_ANTIALIASING_GRAY; + bool italic = false; + bool mipmaps = false; + bool msdf = false; + bool force_autohinter = false; + int weight = 400; + int stretch = 100; + int msdf_range = 14; + int msdf_source_size = 48; + int fixed_size = 0; + TextServer::Hinting hinting = TextServer::HINTING_LIGHT; + TextServer::SubpixelPositioning subpixel_positioning = TextServer::SUBPIXEL_POSITIONING_AUTO; + Dictionary variation_coordinates; + double oversampling = 0.0; + double embolden = 0.0; + Transform2D transform; + + bool operator==(const SystemFontKey &p_b) const { + return (font_name == p_b.font_name) && (antialiasing == p_b.antialiasing) && (italic == p_b.italic) && (mipmaps == p_b.mipmaps) && (msdf == p_b.msdf) && (force_autohinter == p_b.force_autohinter) && (weight == p_b.weight) && (stretch == p_b.stretch) && (msdf_range == p_b.msdf_range) && (msdf_source_size == p_b.msdf_source_size) && (fixed_size == p_b.fixed_size) && (hinting == p_b.hinting) && (subpixel_positioning == p_b.subpixel_positioning) && (variation_coordinates == p_b.variation_coordinates) && (oversampling == p_b.oversampling) && (embolden == p_b.embolden) && (transform == p_b.transform); + } + + SystemFontKey(const String &p_font_name, bool p_italic, int p_weight, int p_stretch, RID p_font, const TextServerFallback *p_fb) { + font_name = p_font_name; + italic = p_italic; + weight = p_weight; + stretch = p_stretch; + antialiasing = p_fb->_font_get_antialiasing(p_font); + mipmaps = p_fb->_font_get_generate_mipmaps(p_font); + msdf = p_fb->_font_is_multichannel_signed_distance_field(p_font); + msdf_range = p_fb->_font_get_msdf_pixel_range(p_font); + msdf_source_size = p_fb->_font_get_msdf_size(p_font); + fixed_size = p_fb->_font_get_fixed_size(p_font); + force_autohinter = p_fb->_font_is_force_autohinter(p_font); + hinting = p_fb->_font_get_hinting(p_font); + subpixel_positioning = p_fb->_font_get_subpixel_positioning(p_font); + variation_coordinates = p_fb->_font_get_variation_coordinates(p_font); + oversampling = p_fb->_font_get_oversampling(p_font); + embolden = p_fb->_font_get_embolden(p_font); + transform = p_fb->_font_get_transform(p_font); + } + }; + + struct SystemFontCacheRec { + RID rid; + int index = 0; + }; + + struct SystemFontCache { + Vector<SystemFontCacheRec> var; + int max_var = 0; + }; + + struct SystemFontKeyHasher { + _FORCE_INLINE_ static uint32_t hash(const SystemFontKey &p_a) { + uint32_t hash = p_a.font_name.hash(); + hash = hash_murmur3_one_32(p_a.variation_coordinates.hash(), hash); + hash = hash_murmur3_one_32(p_a.weight, hash); + hash = hash_murmur3_one_32(p_a.stretch, hash); + hash = hash_murmur3_one_32(p_a.msdf_range, hash); + hash = hash_murmur3_one_32(p_a.msdf_source_size, hash); + hash = hash_murmur3_one_32(p_a.fixed_size, hash); + hash = hash_murmur3_one_double(p_a.oversampling, hash); + hash = hash_murmur3_one_double(p_a.embolden, hash); + hash = hash_murmur3_one_real(p_a.transform[0].x, hash); + hash = hash_murmur3_one_real(p_a.transform[0].y, hash); + hash = hash_murmur3_one_real(p_a.transform[1].x, hash); + hash = hash_murmur3_one_real(p_a.transform[1].y, hash); + return hash_fmix32(hash_murmur3_one_32(((int)p_a.mipmaps) | ((int)p_a.msdf << 1) | ((int)p_a.italic << 2) | ((int)p_a.force_autohinter << 3) | ((int)p_a.hinting << 4) | ((int)p_a.subpixel_positioning << 8) | ((int)p_a.antialiasing << 12), hash)); + } + }; + mutable HashMap<SystemFontKey, SystemFontCache, SystemFontKeyHasher> system_fonts; + mutable HashMap<String, PackedByteArray> system_font_data; + void _realign(ShapedTextDataFallback *p_sd) const; protected: @@ -442,6 +572,12 @@ public: MODBIND2(font_set_style_name, const RID &, const String &); MODBIND1RC(String, font_get_style_name, const RID &); + MODBIND2(font_set_weight, const RID &, int64_t); + MODBIND1RC(int64_t, font_get_weight, const RID &); + + MODBIND2(font_set_stretch, const RID &, int64_t); + MODBIND1RC(int64_t, font_get_stretch, const RID &); + MODBIND2(font_set_name, const RID &, const String &); MODBIND1RC(String, font_get_name, const RID &); @@ -463,6 +599,9 @@ public: MODBIND2(font_set_fixed_size, const RID &, int64_t); MODBIND1RC(int64_t, font_get_fixed_size, const RID &); + MODBIND2(font_set_allow_system_fallback, const RID &, bool); + MODBIND1RC(bool, font_is_allow_system_fallback, const RID &); + MODBIND2(font_set_force_autohinter, const RID &, bool); MODBIND1RC(bool, font_is_force_autohinter, const RID &); @@ -651,6 +790,8 @@ public: MODBIND2RC(String, string_to_upper, const String &, const String &); MODBIND2RC(String, string_to_lower, const String &, const String &); + MODBIND0(cleanup); + TextServerFallback(); ~TextServerFallback(); }; diff --git a/modules/webxr/doc_classes/WebXRInterface.xml b/modules/webxr/doc_classes/WebXRInterface.xml index 49dd9f7318..f5964eb4d1 100644 --- a/modules/webxr/doc_classes/WebXRInterface.xml +++ b/modules/webxr/doc_classes/WebXRInterface.xml @@ -1,13 +1,13 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="WebXRInterface" inherits="XRInterface" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd"> <brief_description> - AR/VR interface using WebXR. + XR interface using WebXR. </brief_description> <description> WebXR is an open standard that allows creating VR and AR applications that run in the web browser. As such, this interface is only available when running in Web exports. WebXR supports a wide range of devices, from the very capable (like Valve Index, HTC Vive, Oculus Rift and Quest) down to the much less capable (like Google Cardboard, Oculus Go, GearVR, or plain smartphones). - Since WebXR is based on JavaScript, it makes extensive use of callbacks, which means that [WebXRInterface] is forced to use signals, where other AR/VR interfaces would instead use functions that return a result immediately. This makes [WebXRInterface] quite a bit more complicated to initialize than other AR/VR interfaces. + Since WebXR is based on JavaScript, it makes extensive use of callbacks, which means that [WebXRInterface] is forced to use signals, where other XR interfaces would instead use functions that return a result immediately. This makes [WebXRInterface] quite a bit more complicated to initialize than other XR interfaces. Here's the minimum code required to start an immersive VR session: [codeblock] extends Node3D @@ -69,7 +69,7 @@ func _webxr_session_started(): $Button.visible = false # This tells Godot to start rendering to the headset. - get_viewport().xr = true + get_viewport().use_xr = true # This will be the reference space type you ultimately got, out of the # types that you requested above. This is useful if you want the game to # work a little differently in 'bounded-floor' versus 'local-floor'. @@ -79,28 +79,35 @@ $Button.visible = true # If the user exits immersive mode, then we tell Godot to render to the web # page again. - get_viewport().xr = false + get_viewport().use_xr = false func _webxr_session_failed(message): OS.alert("Failed to initialize: " + message) [/codeblock] - There are several ways to handle "controller" input: - - Using [XRController3D] nodes and their [signal XRController3D.button_pressed] and [signal XRController3D.button_released] signals. This is how controllers are typically handled in AR/VR apps in Godot, however, this will only work with advanced VR controllers like the Oculus Touch or Index controllers, for example. The buttons codes are defined by [url=https://immersive-web.github.io/webxr-gamepads-module/#xr-standard-gamepad-mapping]Section 3.3 of the WebXR Gamepads Module[/url]. - - Using [method Node._unhandled_input] and [InputEventJoypadButton] or [InputEventJoypadMotion]. This works the same as normal joypads, except the [member InputEvent.device] starts at 100, so the left controller is 100 and the right controller is 101, and the button codes are also defined by [url=https://immersive-web.github.io/webxr-gamepads-module/#xr-standard-gamepad-mapping]Section 3.3 of the WebXR Gamepads Module[/url]. - - Using the [signal select], [signal squeeze] and related signals. This method will work for both advanced VR controllers, and non-traditional "controllers" like a tap on the screen, a spoken voice command or a button press on the device itself. - You can use one or all of these methods to allow your game or app to support a wider or narrower set of devices and input methods, or to allow more advanced interactions with more advanced devices. + There are a couple ways to handle "controller" input: + - Using [XRController3D] nodes and their [signal XRController3D.button_pressed] and [signal XRController3D.button_released] signals. This is how controllers are typically handled in XR apps in Godot, however, this will only work with advanced VR controllers like the Oculus Touch or Index controllers, for example. + - Using the [signal select], [signal squeeze] and related signals. This method will work for both advanced VR controllers, and non-traditional input sources like a tap on the screen, a spoken voice command or a button press on the device itself. + You can use both methods to allow your game or app to support a wider or narrower set of devices and input methods, or to allow more advanced interactions with more advanced devices. </description> <tutorials> <link title="How to make a VR game for WebXR with Godot">https://www.snopekgames.com/blog/2020/how-make-vr-game-webxr-godot</link> </tutorials> <methods> - <method name="get_controller" qualifiers="const"> + <method name="get_input_source_target_ray_mode" qualifiers="const"> + <return type="int" enum="WebXRInterface.TargetRayMode" /> + <param index="0" name="input_source_id" type="int" /> + <description> + Returns the target ray mode for the given [code]input_source_id[/code]. + This can help interpret the input coming from that input source. See [url=https://developer.mozilla.org/en-US/docs/Web/API/XRInputSource/targetRayMode]XRInputSource.targetRayMode[/url] for more information. + </description> + </method> + <method name="get_input_source_tracker" qualifiers="const"> <return type="XRPositionalTracker" /> - <param index="0" name="controller_id" type="int" /> + <param index="0" name="input_source_id" type="int" /> <description> - Gets an [XRPositionalTracker] for the given [code]controller_id[/code]. - In the context of WebXR, a "controller" can be an advanced VR controller like the Oculus Touch or Index controllers, or even a tap on the screen, a spoken voice command or a button press on the device itself. When a non-traditional controller is used, interpret the position and orientation of the [XRPositionalTracker] as a ray pointing at the object the user wishes to interact with. - Use this method to get information about the controller that triggered one of these signals: + Gets an [XRPositionalTracker] for the given [code]input_source_id[/code]. + In the context of WebXR, an input source can be an advanced VR controller like the Oculus Touch or Index controllers, or even a tap on the screen, a spoken voice command or a button press on the device itself. When a non-traditional input source is used, interpret the position and orientation of the [XRPositionalTracker] as a ray pointing at the object the user wishes to interact with. + Use this method to get information about the input source that triggered one of these signals: - [signal selectstart] - [signal select] - [signal selectend] @@ -109,6 +116,13 @@ - [signal squeezestart] </description> </method> + <method name="is_input_source_active" qualifiers="const"> + <return type="bool" /> + <param index="0" name="input_source_id" type="int" /> + <description> + Returns [code]true[/code] if there is an active input source with the given [code]input_source_id[/code]. + </description> + </method> <method name="is_session_supported"> <return type="void" /> <param index="0" name="session_mode" type="String" /> @@ -120,11 +134,6 @@ </method> </methods> <members> - <member name="bounds_geometry" type="PackedVector3Array" setter="" getter="get_bounds_geometry"> - The vertices of a polygon which defines the boundaries of the user's play area. - This will only be available if [member reference_space_type] is [code]"bounded-floor"[/code] and only on certain browsers and devices that support it. - The [signal reference_space_reset] signal may indicate when this changes. - </member> <member name="optional_features" type="String" setter="set_optional_features" getter="get_optional_features"> A comma-seperated list of optional features used by [method XRInterface.initialize] when setting up the WebXR session. If a user's browser or device doesn't support one of the given features, initialization will continue, but you won't be able to use the requested feature. @@ -137,7 +146,7 @@ </member> <member name="requested_reference_space_types" type="String" setter="set_requested_reference_space_types" getter="get_requested_reference_space_types"> A comma-seperated list of reference space types used by [method XRInterface.initialize] when setting up the WebXR session. - The reference space types are requested in order, and the first on supported by the users device or browser will be used. The [member reference_space_type] property contains the reference space type that was ultimately used. + The reference space types are requested in order, and the first one supported by the users device or browser will be used. The [member reference_space_type] property contains the reference space type that was ultimately selected. This doesn't have any effect on the interface when already initialized. Possible values come from [url=https://developer.mozilla.org/en-US/docs/Web/API/XRReferenceSpaceType]WebXR's XRReferenceSpaceType[/url]. If you want to use a particular reference space type, it must be listed in either [member required_features] or [member optional_features]. </member> @@ -161,35 +170,35 @@ <signal name="reference_space_reset"> <description> Emitted to indicate that the reference space has been reset or reconfigured. - When (or whether) this is emitted depends on the user's browser or device, but may include when the user has changed the dimensions of their play space (which you may be able to access via [member bounds_geometry]) or pressed/held a button to recenter their position. + When (or whether) this is emitted depends on the user's browser or device, but may include when the user has changed the dimensions of their play space (which you may be able to access via [method XRInterface.get_play_area]) or pressed/held a button to recenter their position. See [url=https://developer.mozilla.org/en-US/docs/Web/API/XRReferenceSpace/reset_event]WebXR's XRReferenceSpace reset event[/url] for more information. </description> </signal> <signal name="select"> - <param index="0" name="controller_id" type="int" /> + <param index="0" name="input_source_id" type="int" /> <description> - Emitted after one of the "controllers" has finished its "primary action". - Use [method get_controller] to get more information about the controller. + Emitted after one of the input sources has finished its "primary action". + Use [method get_input_source_tracker] and [method get_input_source_target_ray_mode] to get more information about the input source. </description> </signal> <signal name="selectend"> - <param index="0" name="controller_id" type="int" /> + <param index="0" name="input_source_id" type="int" /> <description> - Emitted when one of the "controllers" has finished its "primary action". - Use [method get_controller] to get more information about the controller. + Emitted when one of the input sources has finished its "primary action". + Use [method get_input_source_tracker] and [method get_input_source_target_ray_mode] to get more information about the input source. </description> </signal> <signal name="selectstart"> - <param index="0" name="controller_id" type="int" /> + <param index="0" name="input_source_id" type="int" /> <description> - Emitted when one of the "controllers" has started its "primary action". - Use [method get_controller] to get more information about the controller. + Emitted when one of the input source has started its "primary action". + Use [method get_input_source_tracker] and [method get_input_source_target_ray_mode] to get more information about the input source. </description> </signal> <signal name="session_ended"> <description> Emitted when the user ends the WebXR session (which can be done using UI from the browser or device). - At this point, you should do [code]get_viewport().xr = false[/code] to instruct Godot to resume rendering to the screen. + At this point, you should do [code]get_viewport().use_xr = false[/code] to instruct Godot to resume rendering to the screen. </description> </signal> <signal name="session_failed"> @@ -202,7 +211,7 @@ <signal name="session_started"> <description> Emitted by [method XRInterface.initialize] if the session is successfully started. - At this point, it's safe to do [code]get_viewport().xr = true[/code] to instruct Godot to start rendering to the AR/VR device. + At this point, it's safe to do [code]get_viewport().use_xr = true[/code] to instruct Godot to start rendering to the XR device. </description> </signal> <signal name="session_supported"> @@ -213,24 +222,24 @@ </description> </signal> <signal name="squeeze"> - <param index="0" name="controller_id" type="int" /> + <param index="0" name="input_source_id" type="int" /> <description> - Emitted after one of the "controllers" has finished its "primary squeeze action". - Use [method get_controller] to get more information about the controller. + Emitted after one of the input sources has finished its "primary squeeze action". + Use [method get_input_source_tracker] and [method get_input_source_target_ray_mode] to get more information about the input source. </description> </signal> <signal name="squeezeend"> - <param index="0" name="controller_id" type="int" /> + <param index="0" name="input_source_id" type="int" /> <description> - Emitted when one of the "controllers" has finished its "primary squeeze action". - Use [method get_controller] to get more information about the controller. + Emitted when one of the input sources has finished its "primary squeeze action". + Use [method get_input_source_tracker] and [method get_input_source_target_ray_mode] to get more information about the input source. </description> </signal> <signal name="squeezestart"> - <param index="0" name="controller_id" type="int" /> + <param index="0" name="input_source_id" type="int" /> <description> - Emitted when one of the "controllers" has started its "primary squeeze action". - Use [method get_controller] to get more information about the controller. + Emitted when one of the input sources has started its "primary squeeze action". + Use [method get_input_source_tracker] and [method get_input_source_target_ray_mode] to get more information about the input source. </description> </signal> <signal name="visibility_state_changed"> @@ -239,4 +248,18 @@ </description> </signal> </signals> + <constants> + <constant name="TARGET_RAY_MODE_UNKNOWN" value="0" enum="TargetRayMode"> + We don't know the the target ray mode. + </constant> + <constant name="TARGET_RAY_MODE_GAZE" value="1" enum="TargetRayMode"> + Target ray originates at the viewer's eyes and points in the direction they are looking. + </constant> + <constant name="TARGET_RAY_MODE_TRACKED_POINTER" value="2" enum="TargetRayMode"> + Target ray from a handheld pointer, most likely a VR touch controller. + </constant> + <constant name="TARGET_RAY_MODE_SCREEN" value="3" enum="TargetRayMode"> + Target ray from touch screen, mouse or other tactile input device. + </constant> + </constants> </class> diff --git a/modules/webxr/godot_webxr.h b/modules/webxr/godot_webxr.h index d8d5bd99cc..e31a1d307e 100644 --- a/modules/webxr/godot_webxr.h +++ b/modules/webxr/godot_webxr.h @@ -37,12 +37,18 @@ extern "C" { #include "stddef.h" +enum WebXRInputEvent { + WEBXR_INPUT_EVENT_SELECTSTART, + WEBXR_INPUT_EVENT_SELECTEND, + WEBXR_INPUT_EVENT_SQUEEZESTART, + WEBXR_INPUT_EVENT_SQUEEZEEND, +}; + typedef void (*GodotWebXRSupportedCallback)(char *p_session_mode, int p_supported); typedef void (*GodotWebXRStartedCallback)(char *p_reference_space_type); typedef void (*GodotWebXREndedCallback)(); typedef void (*GodotWebXRFailedCallback)(char *p_message); -typedef void (*GodotWebXRControllerCallback)(); -typedef void (*GodotWebXRInputEventCallback)(char *p_signal_name, int p_controller_id); +typedef void (*GodotWebXRInputEventCallback)(int p_event_type, int p_input_source_id); typedef void (*GodotWebXRSimpleEventCallback)(char *p_signal_name); extern int godot_webxr_is_supported(); @@ -56,26 +62,33 @@ extern void godot_webxr_initialize( GodotWebXRStartedCallback p_on_session_started, GodotWebXREndedCallback p_on_session_ended, GodotWebXRFailedCallback p_on_session_failed, - GodotWebXRControllerCallback p_on_controller_changed, GodotWebXRInputEventCallback p_on_input_event, GodotWebXRSimpleEventCallback p_on_simple_event); extern void godot_webxr_uninitialize(); extern int godot_webxr_get_view_count(); -extern int *godot_webxr_get_render_target_size(); -extern float *godot_webxr_get_transform_for_eye(int p_eye); -extern float *godot_webxr_get_projection_for_eye(int p_eye); -extern void godot_webxr_commit(unsigned int p_texture); +extern bool godot_webxr_get_render_target_size(int *r_size); +extern bool godot_webxr_get_transform_for_view(int p_view, float *r_transform); +extern bool godot_webxr_get_projection_for_view(int p_view, float *r_transform); +extern unsigned int godot_webxr_get_color_texture(); +extern unsigned int godot_webxr_get_depth_texture(); +extern unsigned int godot_webxr_get_velocity_texture(); -extern void godot_webxr_sample_controller_data(); -extern int godot_webxr_get_controller_count(); -extern int godot_webxr_is_controller_connected(int p_controller); -extern float *godot_webxr_get_controller_transform(int p_controller); -extern int *godot_webxr_get_controller_buttons(int p_controller); -extern int *godot_webxr_get_controller_axes(int p_controller); +extern bool godot_webxr_update_input_source( + int p_input_source_id, + float *r_target_pose, + int *r_target_ray_mode, + int *r_touch_index, + int *r_has_grip_pose, + float *r_grip_pose, + int *r_has_standard_mapping, + int *r_button_count, + float *r_buttons, + int *r_axes_count, + float *r_axes); extern char *godot_webxr_get_visibility_state(); -extern int *godot_webxr_get_bounds_geometry(); +extern int godot_webxr_get_bounds_geometry(float **r_points); #ifdef __cplusplus } diff --git a/modules/webxr/native/library_godot_webxr.js b/modules/webxr/native/library_godot_webxr.js index 714768347c..eaf251d48f 100644 --- a/modules/webxr/native/library_godot_webxr.js +++ b/modules/webxr/native/library_godot_webxr.js @@ -33,9 +33,14 @@ const GodotWebXR = { gl: null, session: null, + gl_binding: null, + layer: null, space: null, frame: null, pose: null, + view_count: 1, + input_sources: new Array(16), + touches: new Array(5), // Monkey-patch the requestAnimationFrame() used by Emscripten for the main // loop, so that we can swap it out for XRSession.requestAnimationFrame() @@ -76,34 +81,128 @@ const GodotWebXR = { }, 0); }, - // Holds the controllers list between function calls. - controllers: [], + getLayer: () => { + const new_view_count = (GodotWebXR.pose) ? GodotWebXR.pose.views.length : 1; + let layer = GodotWebXR.layer; - // Updates controllers array, where the left hand (or sole tracker) is - // the first element, and the right hand is the second element, and any - // others placed at the 3rd position and up. - sampleControllers: () => { - if (!GodotWebXR.session || !GodotWebXR.frame) { - return; + // If the view count hasn't changed since creating this layer, then + // we can simply return it. + if (layer && GodotWebXR.view_count === new_view_count) { + return layer; } - let other_index = 2; - const controllers = []; - GodotWebXR.session.inputSources.forEach((input_source) => { - if (input_source.targetRayMode === 'tracked-pointer') { - if (input_source.handedness === 'right') { - controllers[1] = input_source; - } else if (input_source.handedness === 'left' || !controllers[0]) { - controllers[0] = input_source; + if (!GodotWebXR.session || !GodotWebXR.gl_binding) { + return null; + } + + const gl = GodotWebXR.gl; + + layer = GodotWebXR.gl_binding.createProjectionLayer({ + textureType: new_view_count > 1 ? 'texture-array' : 'texture', + colorFormat: gl.RGBA8, + depthFormat: gl.DEPTH_COMPONENT24, + }); + GodotWebXR.session.updateRenderState({ layers: [layer] }); + + GodotWebXR.layer = layer; + GodotWebXR.view_count = new_view_count; + return layer; + }, + + getSubImage: () => { + if (!GodotWebXR.pose) { + return null; + } + const layer = GodotWebXR.getLayer(); + if (layer === null) { + return null; + } + + // Because we always use "texture-array" for multiview and "texture" + // when there is only 1 view, it should be safe to only grab the + // subimage for the first view. + return GodotWebXR.gl_binding.getViewSubImage(layer, GodotWebXR.pose.views[0]); + }, + + getTextureId: (texture) => { + if (texture.name !== undefined) { + return texture.name; + } + + const id = GL.getNewId(GL.textures); + texture.name = id; + GL.textures[id] = texture; + + return id; + }, + + addInputSource: (input_source) => { + let name = -1; + if (input_source.targetRayMode === 'tracked-pointer' && input_source.handedness === 'left') { + name = 0; + } else if (input_source.targetRayMode === 'tracked-pointer' && input_source.handedness === 'right') { + name = 1; + } else { + for (let i = 2; i < 16; i++) { + if (!GodotWebXR.input_sources[i]) { + name = i; + break; } - } else { - controllers[other_index++] = input_source; } - }); - GodotWebXR.controllers = controllers; + } + if (name >= 0) { + GodotWebXR.input_sources[name] = input_source; + input_source.name = name; + + // Find a free touch index for screen sources. + if (input_source.targetRayMode === 'screen') { + let touch_index = -1; + for (let i = 0; i < 5; i++) { + if (!GodotWebXR.touches[i]) { + touch_index = i; + break; + } + } + if (touch_index >= 0) { + GodotWebXR.touches[touch_index] = input_source; + input_source.touch_index = touch_index; + } + } + } + return name; }, - getControllerId: (input_source) => GodotWebXR.controllers.indexOf(input_source), + removeInputSource: (input_source) => { + if (input_source.name !== undefined) { + const name = input_source.name; + if (name >= 0 && name < 16) { + GodotWebXR.input_sources[name] = null; + } + + if (input_source.touch_index !== undefined) { + const touch_index = input_source.touch_index; + if (touch_index >= 0 && touch_index < 5) { + GodotWebXR.touches[touch_index] = null; + } + } + return name; + } + return -1; + }, + + getInputSourceId: (input_source) => { + if (input_source !== undefined) { + return input_source.name; + } + return -1; + }, + + getTouchIndex: (input_source) => { + if (input_source.touch_index !== undefined) { + return input_source.touch_index; + } + return -1; + }, }, godot_webxr_is_supported__proxy: 'sync', @@ -132,8 +231,8 @@ const GodotWebXR = { godot_webxr_initialize__deps: ['emscripten_webgl_get_current_context'], godot_webxr_initialize__proxy: 'sync', - godot_webxr_initialize__sig: 'viiiiiiiiii', - godot_webxr_initialize: function (p_session_mode, p_required_features, p_optional_features, p_requested_reference_spaces, p_on_session_started, p_on_session_ended, p_on_session_failed, p_on_controller_changed, p_on_input_event, p_on_simple_event) { + godot_webxr_initialize__sig: 'viiiiiiiii', + godot_webxr_initialize: function (p_session_mode, p_required_features, p_optional_features, p_requested_reference_spaces, p_on_session_started, p_on_session_ended, p_on_session_failed, p_on_input_event, p_on_simple_event) { GodotWebXR.monkeyPatchRequestAnimationFrame(true); const session_mode = GodotRuntime.parseString(p_session_mode); @@ -143,7 +242,6 @@ const GodotWebXR = { const onstarted = GodotRuntime.get_func(p_on_session_started); const onended = GodotRuntime.get_func(p_on_session_ended); const onfailed = GodotRuntime.get_func(p_on_session_failed); - const oncontroller = GodotRuntime.get_func(p_on_controller_changed); const oninputevent = GodotRuntime.get_func(p_on_input_event); const onsimpleevent = GodotRuntime.get_func(p_on_simple_event); @@ -163,24 +261,18 @@ const GodotWebXR = { }); session.addEventListener('inputsourceschange', function (evt) { - let controller_changed = false; - [evt.added, evt.removed].forEach((lst) => { - lst.forEach((input_source) => { - if (input_source.targetRayMode === 'tracked-pointer') { - controller_changed = true; - } - }); - }); - if (controller_changed) { - oncontroller(); - } + evt.added.forEach(GodotWebXR.addInputSource); + evt.removed.forEach(GodotWebXR.removeInputSource); }); - ['selectstart', 'select', 'selectend', 'squeezestart', 'squeeze', 'squeezeend'].forEach((input_event) => { + ['selectstart', 'selectend', 'squeezestart', 'squeezeend'].forEach((input_event, index) => { session.addEventListener(input_event, function (evt) { - const c_str = GodotRuntime.allocString(input_event); - oninputevent(c_str, GodotWebXR.getControllerId(evt.inputSource)); - GodotRuntime.free(c_str); + // Since this happens in-between normal frames, we need to + // grab the frame from the event in order to get poses for + // the input sources. + GodotWebXR.frame = evt.frame; + oninputevent(index, GodotWebXR.getInputSourceId(evt.inputSource)); + GodotWebXR.frame = null; }); }); @@ -195,9 +287,10 @@ const GodotWebXR = { GodotWebXR.gl = gl; gl.makeXRCompatible().then(function () { - session.updateRenderState({ - baseLayer: new XRWebGLLayer(session, gl), - }); + GodotWebXR.gl_binding = new XRWebGLBinding(session, gl); // eslint-disable-line no-undef + + // This will trigger the layer to get created. + GodotWebXR.getLayer(); function onReferenceSpaceSuccess(reference_space, reference_space_type) { GodotWebXR.space = reference_space; @@ -266,9 +359,14 @@ const GodotWebXR = { } GodotWebXR.session = null; + GodotWebXR.gl_binding = null; + GodotWebXR.layer = null; GodotWebXR.space = null; GodotWebXR.frame = null; GodotWebXR.pose = null; + GodotWebXR.view_count = 1; + GodotWebXR.input_sources = new Array(16); + GodotWebXR.touches = new Array(5); // Disable the monkey-patched window.requestAnimationFrame() and // pause/restart the main loop to activate it on all platforms. @@ -280,215 +378,186 @@ const GodotWebXR = { godot_webxr_get_view_count__sig: 'i', godot_webxr_get_view_count: function () { if (!GodotWebXR.session || !GodotWebXR.pose) { - return 0; + return 1; } - return GodotWebXR.pose.views.length; + const view_count = GodotWebXR.pose.views.length; + return view_count > 0 ? view_count : 1; }, godot_webxr_get_render_target_size__proxy: 'sync', - godot_webxr_get_render_target_size__sig: 'i', - godot_webxr_get_render_target_size: function () { - if (!GodotWebXR.session || !GodotWebXR.pose) { - return 0; + godot_webxr_get_render_target_size__sig: 'ii', + godot_webxr_get_render_target_size: function (r_size) { + const subimage = GodotWebXR.getSubImage(); + if (subimage === null) { + return false; } - const glLayer = GodotWebXR.session.renderState.baseLayer; - const view = GodotWebXR.pose.views[0]; - const viewport = glLayer.getViewport(view); + GodotRuntime.setHeapValue(r_size + 0, subimage.viewport.width, 'i32'); + GodotRuntime.setHeapValue(r_size + 4, subimage.viewport.height, 'i32'); - const buf = GodotRuntime.malloc(2 * 4); - GodotRuntime.setHeapValue(buf + 0, viewport.width, 'i32'); - GodotRuntime.setHeapValue(buf + 4, viewport.height, 'i32'); - return buf; + return true; }, - godot_webxr_get_transform_for_eye__proxy: 'sync', - godot_webxr_get_transform_for_eye__sig: 'ii', - godot_webxr_get_transform_for_eye: function (p_eye) { + godot_webxr_get_transform_for_view__proxy: 'sync', + godot_webxr_get_transform_for_view__sig: 'iii', + godot_webxr_get_transform_for_view: function (p_view, r_transform) { if (!GodotWebXR.session || !GodotWebXR.pose) { - return 0; + return false; } const views = GodotWebXR.pose.views; let matrix; - if (p_eye === 0) { - matrix = GodotWebXR.pose.transform.matrix; + if (p_view >= 0) { + matrix = views[p_view].transform.matrix; } else { - matrix = views[p_eye - 1].transform.matrix; - } - const buf = GodotRuntime.malloc(16 * 4); - for (let i = 0; i < 16; i++) { - GodotRuntime.setHeapValue(buf + (i * 4), matrix[i], 'float'); - } - return buf; - }, - - godot_webxr_get_projection_for_eye__proxy: 'sync', - godot_webxr_get_projection_for_eye__sig: 'ii', - godot_webxr_get_projection_for_eye: function (p_eye) { - if (!GodotWebXR.session || !GodotWebXR.pose) { - return 0; + // For -1 (or any other negative value) return the HMD transform. + matrix = GodotWebXR.pose.transform.matrix; } - const view_index = (p_eye === 2 /* ARVRInterface::EYE_RIGHT */) ? 1 : 0; - const matrix = GodotWebXR.pose.views[view_index].projectionMatrix; - const buf = GodotRuntime.malloc(16 * 4); for (let i = 0; i < 16; i++) { - GodotRuntime.setHeapValue(buf + (i * 4), matrix[i], 'float'); + GodotRuntime.setHeapValue(r_transform + (i * 4), matrix[i], 'float'); } - return buf; + + return true; }, - godot_webxr_commit__proxy: 'sync', - godot_webxr_commit__sig: 'vi', - godot_webxr_commit: function (p_texture) { + godot_webxr_get_projection_for_view__proxy: 'sync', + godot_webxr_get_projection_for_view__sig: 'iii', + godot_webxr_get_projection_for_view: function (p_view, r_transform) { if (!GodotWebXR.session || !GodotWebXR.pose) { - return; + return false; } - const glLayer = GodotWebXR.session.renderState.baseLayer; - const views = GodotWebXR.pose.views; - const gl = GodotWebXR.gl; - - const texture = GL.textures[p_texture]; - - const orig_framebuffer = gl.getParameter(gl.FRAMEBUFFER_BINDING); - const orig_read_framebuffer = gl.getParameter(gl.READ_FRAMEBUFFER_BINDING); - const orig_read_buffer = gl.getParameter(gl.READ_BUFFER); - const orig_draw_framebuffer = gl.getParameter(gl.DRAW_FRAMEBUFFER_BINDING); - - // Copy from Godot render target into framebuffer from WebXR. - gl.bindFramebuffer(gl.FRAMEBUFFER, null); - for (let i = 0; i < views.length; i++) { - const viewport = glLayer.getViewport(views[i]); - - const read_fbo = gl.createFramebuffer(); - gl.bindFramebuffer(gl.READ_FRAMEBUFFER, read_fbo); - if (views.length > 1) { - gl.framebufferTextureLayer(gl.READ_FRAMEBUFFER, gl.COLOR_ATTACHMENT0, texture, 0, i); - } else { - gl.framebufferTexture2D(gl.READ_FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, texture, 0); - } - gl.readBuffer(gl.COLOR_ATTACHMENT0); - gl.bindFramebuffer(gl.DRAW_FRAMEBUFFER, glLayer.framebuffer); - - // Flip Y upside down on destination. - gl.blitFramebuffer(0, 0, viewport.width, viewport.height, - viewport.x, viewport.y + viewport.height, viewport.x + viewport.width, viewport.y, - gl.COLOR_BUFFER_BIT, gl.NEAREST); - - gl.bindFramebuffer(gl.READ_FRAMEBUFFER, null); - gl.deleteFramebuffer(read_fbo); + const matrix = GodotWebXR.pose.views[p_view].projectionMatrix; + for (let i = 0; i < 16; i++) { + GodotRuntime.setHeapValue(r_transform + (i * 4), matrix[i], 'float'); } - // Restore state. - gl.bindFramebuffer(gl.FRAMEBUFFER, orig_framebuffer); - gl.bindFramebuffer(gl.READ_FRAMEBUFFER, orig_read_framebuffer); - gl.readBuffer(orig_read_buffer); - gl.bindFramebuffer(gl.DRAW_FRAMEBUFFER, orig_draw_framebuffer); + return true; }, - godot_webxr_sample_controller_data__proxy: 'sync', - godot_webxr_sample_controller_data__sig: 'v', - godot_webxr_sample_controller_data: function () { - GodotWebXR.sampleControllers(); + godot_webxr_get_color_texture__proxy: 'sync', + godot_webxr_get_color_texture__sig: 'i', + godot_webxr_get_color_texture: function () { + const subimage = GodotWebXR.getSubImage(); + if (subimage === null) { + return 0; + } + return GodotWebXR.getTextureId(subimage.colorTexture); }, - godot_webxr_get_controller_count__proxy: 'sync', - godot_webxr_get_controller_count__sig: 'i', - godot_webxr_get_controller_count: function () { - if (!GodotWebXR.session || !GodotWebXR.frame) { + godot_webxr_get_depth_texture__proxy: 'sync', + godot_webxr_get_depth_texture__sig: 'i', + godot_webxr_get_depth_texture: function () { + const subimage = GodotWebXR.getSubImage(); + if (subimage === null) { return 0; } - return GodotWebXR.controllers.length; + if (!subimage.depthStencilTexture) { + return 0; + } + return GodotWebXR.getTextureId(subimage.depthStencilTexture); }, - godot_webxr_is_controller_connected__proxy: 'sync', - godot_webxr_is_controller_connected__sig: 'ii', - godot_webxr_is_controller_connected: function (p_controller) { - if (!GodotWebXR.session || !GodotWebXR.frame) { - return false; + godot_webxr_get_velocity_texture__proxy: 'sync', + godot_webxr_get_velocity_texture__sig: 'i', + godot_webxr_get_velocity_texture: function () { + const subimage = GodotWebXR.getSubImage(); + if (subimage === null) { + return 0; + } + if (!subimage.motionVectorTexture) { + return 0; } - return !!GodotWebXR.controllers[p_controller]; + return GodotWebXR.getTextureId(subimage.motionVectorTexture); }, - godot_webxr_get_controller_transform__proxy: 'sync', - godot_webxr_get_controller_transform__sig: 'ii', - godot_webxr_get_controller_transform: function (p_controller) { + godot_webxr_update_input_source__proxy: 'sync', + godot_webxr_update_input_source__sig: 'iiiiiiiiiiii', + godot_webxr_update_input_source: function (p_input_source_id, r_target_pose, r_target_ray_mode, r_touch_index, r_has_grip_pose, r_grip_pose, r_has_standard_mapping, r_button_count, r_buttons, r_axes_count, r_axes) { if (!GodotWebXR.session || !GodotWebXR.frame) { return 0; } - const controller = GodotWebXR.controllers[p_controller]; - if (!controller) { - return 0; + if (p_input_source_id < 0 || p_input_source_id >= GodotWebXR.input_sources.length || !GodotWebXR.input_sources[p_input_source_id]) { + return false; } + const input_source = GodotWebXR.input_sources[p_input_source_id]; const frame = GodotWebXR.frame; const space = GodotWebXR.space; - const pose = frame.getPose(controller.targetRaySpace, space); - if (!pose) { + // Target pose. + const target_pose = frame.getPose(input_source.targetRaySpace, space); + if (!target_pose) { // This can mean that the controller lost tracking. - return 0; + return false; } - const matrix = pose.transform.matrix; - - const buf = GodotRuntime.malloc(16 * 4); + const target_pose_matrix = target_pose.transform.matrix; for (let i = 0; i < 16; i++) { - GodotRuntime.setHeapValue(buf + (i * 4), matrix[i], 'float'); + GodotRuntime.setHeapValue(r_target_pose + (i * 4), target_pose_matrix[i], 'float'); } - return buf; - }, - godot_webxr_get_controller_buttons__proxy: 'sync', - godot_webxr_get_controller_buttons__sig: 'ii', - godot_webxr_get_controller_buttons: function (p_controller) { - if (GodotWebXR.controllers.length === 0) { - return 0; - } + // Target ray mode. + let target_ray_mode = 0; + switch (input_source.targetRayMode) { + case 'gaze': + target_ray_mode = 1; + break; - const controller = GodotWebXR.controllers[p_controller]; - if (!controller || !controller.gamepad) { - return 0; - } - - const button_count = controller.gamepad.buttons.length; + case 'tracked-pointer': + target_ray_mode = 2; + break; - const buf = GodotRuntime.malloc((button_count + 1) * 4); - GodotRuntime.setHeapValue(buf, button_count, 'i32'); - for (let i = 0; i < button_count; i++) { - GodotRuntime.setHeapValue(buf + 4 + (i * 4), controller.gamepad.buttons[i].value, 'float'); - } - return buf; - }, + case 'screen': + target_ray_mode = 3; + break; - godot_webxr_get_controller_axes__proxy: 'sync', - godot_webxr_get_controller_axes__sig: 'ii', - godot_webxr_get_controller_axes: function (p_controller) { - if (GodotWebXR.controllers.length === 0) { - return 0; + default: } - - const controller = GodotWebXR.controllers[p_controller]; - if (!controller || !controller.gamepad) { - return 0; + GodotRuntime.setHeapValue(r_target_ray_mode, target_ray_mode, 'i32'); + + // Touch index. + GodotRuntime.setHeapValue(r_touch_index, GodotWebXR.getTouchIndex(input_source), 'i32'); + + // Grip pose. + let has_grip_pose = false; + if (input_source.gripSpace) { + const grip_pose = frame.getPose(input_source.gripSpace, space); + if (grip_pose) { + const grip_pose_matrix = grip_pose.transform.matrix; + for (let i = 0; i < 16; i++) { + GodotRuntime.setHeapValue(r_grip_pose + (i * 4), grip_pose_matrix[i], 'float'); + } + has_grip_pose = true; + } } + GodotRuntime.setHeapValue(r_has_grip_pose, has_grip_pose ? 1 : 0, 'i32'); + + // Gamepad data (mapping, buttons and axes). + let has_standard_mapping = false; + let button_count = 0; + let axes_count = 0; + if (input_source.gamepad) { + if (input_source.gamepad.mapping === 'xr-standard') { + has_standard_mapping = true; + } - const axes_count = controller.gamepad.axes.length; + button_count = Math.min(input_source.gamepad.buttons.length, 10); + for (let i = 0; i < button_count; i++) { + GodotRuntime.setHeapValue(r_buttons + (i * 4), input_source.gamepad.buttons[i].value, 'float'); + } - const buf = GodotRuntime.malloc((axes_count + 1) * 4); - GodotRuntime.setHeapValue(buf, axes_count, 'i32'); - for (let i = 0; i < axes_count; i++) { - let value = controller.gamepad.axes[i]; - if (i === 1 || i === 3) { - // Invert the Y-axis on thumbsticks and trackpads, in order to - // match OpenXR and other XR platform SDKs. - value *= -1.0; + axes_count = Math.min(input_source.gamepad.axes.length, 10); + for (let i = 0; i < axes_count; i++) { + GodotRuntime.setHeapValue(r_axes + (i * 4), input_source.gamepad.axes[i], 'float'); } - GodotRuntime.setHeapValue(buf + 4 + (i * 4), value, 'float'); } - return buf; + GodotRuntime.setHeapValue(r_has_standard_mapping, has_standard_mapping ? 1 : 0, 'i32'); + GodotRuntime.setHeapValue(r_button_count, button_count, 'i32'); + GodotRuntime.setHeapValue(r_axes_count, axes_count, 'i32'); + + return true; }, godot_webxr_get_visibility_state__proxy: 'sync', @@ -502,8 +571,8 @@ const GodotWebXR = { }, godot_webxr_get_bounds_geometry__proxy: 'sync', - godot_webxr_get_bounds_geometry__sig: 'i', - godot_webxr_get_bounds_geometry: function () { + godot_webxr_get_bounds_geometry__sig: 'ii', + godot_webxr_get_bounds_geometry: function (r_points) { if (!GodotWebXR.space || !GodotWebXR.space.boundsGeometry) { return 0; } @@ -513,7 +582,7 @@ const GodotWebXR = { return 0; } - const buf = GodotRuntime.malloc(((point_count * 3) + 1) * 4); + const buf = GodotRuntime.malloc(point_count * 3 * 4); GodotRuntime.setHeapValue(buf, point_count, 'i32'); for (let i = 0; i < point_count; i++) { const point = GodotWebXR.space.boundsGeometry[i]; @@ -521,8 +590,9 @@ const GodotWebXR = { GodotRuntime.setHeapValue(buf + ((i * 3) + 2) * 4, point.y, 'float'); GodotRuntime.setHeapValue(buf + ((i * 3) + 3) * 4, point.z, 'float'); } + GodotRuntime.setHeapValue(r_points, buf, 'i32'); - return buf; + return point_count; }, }; diff --git a/modules/webxr/native/webxr.externs.js b/modules/webxr/native/webxr.externs.js index 9ea105aa93..4b88820b19 100644 --- a/modules/webxr/native/webxr.externs.js +++ b/modules/webxr/native/webxr.externs.js @@ -1,3 +1,7 @@ +/* + * WebXR Device API + */ + /** * @type {XR} */ @@ -497,3 +501,681 @@ XRPose.prototype.transform; * @type {boolean} */ XRPose.prototype.emulatedPosition; + +/* + * WebXR Layers API Level 1 + */ + +/** + * @constructor XRLayer + */ +function XRLayer() {} + +/** + * @constructor XRLayerEventInit + */ +function XRLayerEventInit() {} + +/** + * @type {XRLayer} + */ +XRLayerEventInit.prototype.layer; + +/** + * @constructor XRLayerEvent + * + * @param {string} type + * @param {XRLayerEventInit} init + */ +function XRLayerEvent(type, init) {}; + +/** + * @type {XRLayer} + */ +XRLayerEvent.prototype.layer; + +/** + * @constructor XRCompositionLayer + * @extends {XRLayer} + */ +function XRCompositionLayer() {}; + +/** + * @type {string} + */ +XRCompositionLayer.prototype.layout; + +/** + * @type {boolean} + */ +XRCompositionLayer.prototype.blendTextureAberrationCorrection; + +/** + * @type {?boolean} + */ +XRCompositionLayer.prototype.chromaticAberrationCorrection; + +/** + * @type {boolean} + */ +XRCompositionLayer.prototype.forceMonoPresentation; + +/** + * @type {number} + */ +XRCompositionLayer.prototype.opacity; + +/** + * @type {number} + */ +XRCompositionLayer.prototype.mipLevels; + +/** + * @type {boolean} + */ +XRCompositionLayer.prototype.needsRedraw; + +/** + * @return {void} + */ +XRCompositionLayer.prototype.destroy = function () {}; + +/** + * @constructor XRProjectionLayer + * @extends {XRCompositionLayer} + */ +function XRProjectionLayer() {} + +/** + * @type {number} + */ +XRProjectionLayer.prototype.textureWidth; + +/** + * @type {number} + */ +XRProjectionLayer.prototype.textureHeight; + +/** + * @type {number} + */ +XRProjectionLayer.prototype.textureArrayLength; + +/** + * @type {boolean} + */ +XRProjectionLayer.prototype.ignoreDepthValues; + +/** + * @type {?number} + */ +XRProjectionLayer.prototype.fixedFoveation; + +/** + * @type {XRRigidTransform} + */ +XRProjectionLayer.prototype.deltaPose; + +/** + * @constructor XRQuadLayer + * @extends {XRCompositionLayer} + */ +function XRQuadLayer() {} + +/** + * @type {XRSpace} + */ +XRQuadLayer.prototype.space; + +/** + * @type {XRRigidTransform} + */ +XRQuadLayer.prototype.transform; + +/** + * @type {number} + */ +XRQuadLayer.prototype.width; + +/** + * @type {number} + */ +XRQuadLayer.prototype.height; + +/** + * @type {?function (XRLayerEvent)} + */ +XRQuadLayer.prototype.onredraw; + +/** + * @constructor XRCylinderLayer + * @extends {XRCompositionLayer} + */ +function XRCylinderLayer() {} + +/** + * @type {XRSpace} + */ +XRCylinderLayer.prototype.space; + +/** + * @type {XRRigidTransform} + */ +XRCylinderLayer.prototype.transform; + +/** + * @type {number} + */ +XRCylinderLayer.prototype.radius; + +/** + * @type {number} + */ +XRCylinderLayer.prototype.centralAngle; + +/** + * @type {number} + */ +XRCylinderLayer.prototype.aspectRatio; + +/** + * @type {?function (XRLayerEvent)} + */ +XRCylinderLayer.prototype.onredraw; + +/** + * @constructor XREquirectLayer + * @extends {XRCompositionLayer} + */ +function XREquirectLayer() {} + +/** + * @type {XRSpace} + */ +XREquirectLayer.prototype.space; + +/** + * @type {XRRigidTransform} + */ +XREquirectLayer.prototype.transform; + +/** + * @type {number} + */ +XREquirectLayer.prototype.radius; + +/** + * @type {number} + */ +XREquirectLayer.prototype.centralHorizontalAngle; + +/** + * @type {number} + */ +XREquirectLayer.prototype.upperVerticalAngle; + +/** + * @type {number} + */ +XREquirectLayer.prototype.lowerVerticalAngle; + +/** + * @type {?function (XRLayerEvent)} + */ +XREquirectLayer.prototype.onredraw; + +/** + * @constructor XRCubeLayer + * @extends {XRCompositionLayer} + */ +function XRCubeLayer() {} + +/** + * @type {XRSpace} + */ +XRCubeLayer.prototype.space; + +/** + * @type {DOMPointReadOnly} + */ +XRCubeLayer.prototype.orientation; + +/** + * @type {?function (XRLayerEvent)} + */ +XRCubeLayer.prototype.onredraw; + +/** + * @constructor XRSubImage + */ +function XRSubImage() {} + +/** + * @type {XRViewport} + */ +XRSubImage.prototype.viewport; + +/** + * @constructor XRWebGLSubImage + * @extends {XRSubImage} + */ +function XRWebGLSubImage () {} + +/** + * @type {WebGLTexture} + */ +XRWebGLSubImage.prototype.colorTexture; + +/** + * @type {?WebGLTexture} + */ +XRWebGLSubImage.prototype.depthStencilTexture; + +/** + * @type {?WebGLTexture} + */ +XRWebGLSubImage.prototype.motionVectorTexture; + +/** + * @type {?number} + */ +XRWebGLSubImage.prototype.imageIndex; + +/** + * @type {number} + */ +XRWebGLSubImage.prototype.colorTextureWidth; + +/** + * @type {number} + */ +XRWebGLSubImage.prototype.colorTextureHeight; + +/** + * @type {?number} + */ +XRWebGLSubImage.prototype.depthStencilTextureWidth; + +/** + * @type {?number} + */ +XRWebGLSubImage.prototype.depthStencilTextureHeight; + +/** + * @type {?number} + */ + +XRWebGLSubImage.prototype.motionVectorTextureWidth; + +/** + * @type {?number} + */ +XRWebGLSubImage.prototype.motionVectorTextureHeight; + +/** + * @constructor XRProjectionLayerInit + */ +function XRProjectionLayerInit() {} + +/** + * @type {string} + */ +XRProjectionLayerInit.prototype.textureType; + +/** + * @type {number} + */ +XRProjectionLayerInit.prototype.colorFormat; + +/** + * @type {number} + */ +XRProjectionLayerInit.prototype.depthFormat; + +/** + * @type {number} + */ +XRProjectionLayerInit.prototype.scaleFactor; + +/** + * @constructor XRLayerInit + */ +function XRLayerInit() {} + +/** + * @type {XRSpace} + */ +XRLayerInit.prototype.space; + +/** + * @type {number} + */ +XRLayerInit.prototype.colorFormat; + +/** + * @type {number} + */ +XRLayerInit.prototype.depthFormat; + +/** + * @type {number} + */ +XRLayerInit.prototype.mipLevels; + +/** + * @type {number} + */ +XRLayerInit.prototype.viewPixelWidth; + +/** + * @type {number} + */ +XRLayerInit.prototype.viewPixelHeight; + +/** + * @type {string} + */ +XRLayerInit.prototype.layout; + +/** + * @type {boolean} + */ +XRLayerInit.prototype.isStatic; + +/** + * @constructor XRQuadLayerInit + * @extends {XRLayerInit} + */ +function XRQuadLayerInit() {} + +/** + * @type {string} + */ +XRQuadLayerInit.prototype.textureType; + +/** + * @type {?XRRigidTransform} + */ +XRQuadLayerInit.prototype.transform; + +/** + * @type {number} + */ +XRQuadLayerInit.prototype.width; + +/** + * @type {number} + */ +XRQuadLayerInit.prototype.height; + +/** + * @constructor XRCylinderLayerInit + * @extends {XRLayerInit} + */ +function XRCylinderLayerInit() {} + +/** + * @type {string} + */ +XRCylinderLayerInit.prototype.textureType; + +/** + * @type {?XRRigidTransform} + */ +XRCylinderLayerInit.prototype.transform; + +/** + * @type {number} + */ +XRCylinderLayerInit.prototype.radius; + +/** + * @type {number} + */ +XRCylinderLayerInit.prototype.centralAngle; + +/** + * @type {number} + */ +XRCylinderLayerInit.prototype.aspectRatio; + +/** + * @constructor XREquirectLayerInit + * @extends {XRLayerInit} + */ +function XREquirectLayerInit() {} + +/** + * @type {string} + */ +XREquirectLayerInit.prototype.textureType; + +/** + * @type {?XRRigidTransform} + */ +XREquirectLayerInit.prototype.transform; + +/** + * @type {number} + */ +XREquirectLayerInit.prototype.radius; + +/** + * @type {number} + */ +XREquirectLayerInit.prototype.centralHorizontalAngle; + +/** + * @type {number} + */ +XREquirectLayerInit.prototype.upperVerticalAngle; + +/** + * @type {number} + */ +XREquirectLayerInit.prototype.lowerVerticalAngle; + +/** + * @constructor XRCubeLayerInit + * @extends {XRLayerInit} + */ +function XRCubeLayerInit() {} + +/** + * @type {DOMPointReadOnly} + */ +XRCubeLayerInit.prototype.orientation; + +/** + * @constructor XRWebGLBinding + * + * @param {XRSession} session + * @param {WebGLRenderContext|WebGL2RenderingContext} context + */ +function XRWebGLBinding(session, context) {} + +/** + * @type {number} + */ +XRWebGLBinding.prototype.nativeProjectionScaleFactor; + +/** + * @type {number} + */ +XRWebGLBinding.prototype.usesDepthValues; + +/** + * @param {XRProjectionLayerInit} init + * @return {XRProjectionLayer} + */ +XRWebGLBinding.prototype.createProjectionLayer = function (init) {}; + +/** + * @param {XRQuadLayerInit} init + * @return {XRQuadLayer} + */ +XRWebGLBinding.prototype.createQuadLayer = function (init) {}; + +/** + * @param {XRCylinderLayerInit} init + * @return {XRCylinderLayer} + */ +XRWebGLBinding.prototype.createCylinderLayer = function (init) {}; + +/** + * @param {XREquirectLayerInit} init + * @return {XREquirectLayer} + */ +XRWebGLBinding.prototype.createEquirectLayer = function (init) {}; + +/** + * @param {XRCubeLayerInit} init + * @return {XRCubeLayer} + */ +XRWebGLBinding.prototype.createCubeLayer = function (init) {}; + +/** + * @param {XRCompositionLayer} layer + * @param {XRFrame} frame + * @param {string} eye + * @return {XRWebGLSubImage} + */ +XRWebGLBinding.prototype.getSubImage = function (layer, frame, eye) {}; + +/** + * @param {XRProjectionLayer} layer + * @param {XRView} view + * @return {XRWebGLSubImage} + */ +XRWebGLBinding.prototype.getViewSubImage = function (layer, view) {}; + +/** + * @constructor XRMediaLayerInit + */ +function XRMediaLayerInit() {} + +/** + * @type {XRSpace} + */ +XRMediaLayerInit.prototype.space; + +/** + * @type {string} + */ +XRMediaLayerInit.prototype.layout; + +/** + * @type {boolean} + */ +XRMediaLayerInit.prototype.invertStereo; + +/** + * @constructor XRMediaQuadLayerInit + * @extends {XRMediaLayerInit} + */ +function XRMediaQuadLayerInit() {} + +/** + * @type {XRRigidTransform} + */ +XRMediaQuadLayerInit.prototype.transform; + +/** + * @type {number} + */ +XRMediaQuadLayerInit.prototype.width; + +/** + * @type {number} + */ +XRMediaQuadLayerInit.prototype.height; + +/** + * @constructor XRMediaCylinderLayerInit + * @extends {XRMediaLayerInit} + */ +function XRMediaCylinderLayerInit() {} + +/** + * @type {XRRigidTransform} + */ +XRMediaCylinderLayerInit.prototype.transform; + +/** + * @type {number} + */ +XRMediaCylinderLayerInit.prototype.radius; + +/** + * @type {number} + */ +XRMediaCylinderLayerInit.prototype.centralAngle; + +/** + * @type {?number} + */ +XRMediaCylinderLayerInit.prototype.aspectRatio; + +/** + * @constructor XRMediaEquirectLayerInit + * @extends {XRMediaLayerInit} + */ +function XRMediaEquirectLayerInit() {} + +/** + * @type {XRRigidTransform} + */ +XRMediaEquirectLayerInit.prototype.transform; + +/** + * @type {number} + */ +XRMediaEquirectLayerInit.prototype.radius; + +/** + * @type {number} + */ +XRMediaEquirectLayerInit.prototype.centralHorizontalAngle; + +/** + * @type {number} + */ +XRMediaEquirectLayerInit.prototype.upperVerticalAngle; + +/** + * @type {number} + */ +XRMediaEquirectLayerInit.prototype.lowerVerticalAngle; + +/** + * @constructor XRMediaBinding + * + * @param {XRSession} session + */ +function XRMediaBinding(session) {} + +/** + * @param {HTMLVideoElement} video + * @param {XRMediaQuadLayerInit} init + * @return {XRQuadLayer} + */ +XRMediaBinding.prototype.createQuadLayer = function(video, init) {}; + +/** + * @param {HTMLVideoElement} video + * @param {XRMediaCylinderLayerInit} init + * @return {XRCylinderLayer} + */ +XRMediaBinding.prototype.createCylinderLayer = function(video, init) {}; + +/** + * @param {HTMLVideoElement} video + * @param {XRMediaEquirectLayerInit} init + * @return {XREquirectLayer} + */ +XRMediaBinding.prototype.createEquirectLayer = function(video, init) {}; + +/** + * @type {Array<XRLayer>} + */ +XRRenderState.prototype.layers; diff --git a/modules/webxr/webxr_interface.cpp b/modules/webxr/webxr_interface.cpp index b0ad53523a..c0580df172 100644 --- a/modules/webxr/webxr_interface.cpp +++ b/modules/webxr/webxr_interface.cpp @@ -42,9 +42,10 @@ void WebXRInterface::_bind_methods() { ClassDB::bind_method(D_METHOD("get_reference_space_type"), &WebXRInterface::get_reference_space_type); ClassDB::bind_method(D_METHOD("set_requested_reference_space_types", "requested_reference_space_types"), &WebXRInterface::set_requested_reference_space_types); ClassDB::bind_method(D_METHOD("get_requested_reference_space_types"), &WebXRInterface::get_requested_reference_space_types); - ClassDB::bind_method(D_METHOD("get_controller", "controller_id"), &WebXRInterface::get_controller); + ClassDB::bind_method(D_METHOD("is_input_source_active", "input_source_id"), &WebXRInterface::is_input_source_active); + ClassDB::bind_method(D_METHOD("get_input_source_tracker", "input_source_id"), &WebXRInterface::get_input_source_tracker); + ClassDB::bind_method(D_METHOD("get_input_source_target_ray_mode", "input_source_id"), &WebXRInterface::get_input_source_target_ray_mode); ClassDB::bind_method(D_METHOD("get_visibility_state"), &WebXRInterface::get_visibility_state); - ClassDB::bind_method(D_METHOD("get_bounds_geometry"), &WebXRInterface::get_bounds_geometry); ADD_PROPERTY(PropertyInfo(Variant::STRING, "session_mode", PROPERTY_HINT_NONE), "set_session_mode", "get_session_mode"); ADD_PROPERTY(PropertyInfo(Variant::STRING, "required_features", PROPERTY_HINT_NONE), "set_required_features", "get_required_features"); @@ -52,20 +53,24 @@ void WebXRInterface::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::STRING, "requested_reference_space_types", PROPERTY_HINT_NONE), "set_requested_reference_space_types", "get_requested_reference_space_types"); ADD_PROPERTY(PropertyInfo(Variant::STRING, "reference_space_type", PROPERTY_HINT_NONE), "", "get_reference_space_type"); ADD_PROPERTY(PropertyInfo(Variant::STRING, "visibility_state", PROPERTY_HINT_NONE), "", "get_visibility_state"); - ADD_PROPERTY(PropertyInfo(Variant::PACKED_VECTOR3_ARRAY, "bounds_geometry", PROPERTY_HINT_NONE), "", "get_bounds_geometry"); ADD_SIGNAL(MethodInfo("session_supported", PropertyInfo(Variant::STRING, "session_mode"), PropertyInfo(Variant::BOOL, "supported"))); ADD_SIGNAL(MethodInfo("session_started")); ADD_SIGNAL(MethodInfo("session_ended")); ADD_SIGNAL(MethodInfo("session_failed", PropertyInfo(Variant::STRING, "message"))); - ADD_SIGNAL(MethodInfo("selectstart", PropertyInfo(Variant::INT, "controller_id"))); - ADD_SIGNAL(MethodInfo("select", PropertyInfo(Variant::INT, "controller_id"))); - ADD_SIGNAL(MethodInfo("selectend", PropertyInfo(Variant::INT, "controller_id"))); - ADD_SIGNAL(MethodInfo("squeezestart", PropertyInfo(Variant::INT, "controller_id"))); - ADD_SIGNAL(MethodInfo("squeeze", PropertyInfo(Variant::INT, "controller_id"))); - ADD_SIGNAL(MethodInfo("squeezeend", PropertyInfo(Variant::INT, "controller_id"))); + ADD_SIGNAL(MethodInfo("selectstart", PropertyInfo(Variant::INT, "input_source_id"))); + ADD_SIGNAL(MethodInfo("select", PropertyInfo(Variant::INT, "input_source_id"))); + ADD_SIGNAL(MethodInfo("selectend", PropertyInfo(Variant::INT, "input_source_id"))); + ADD_SIGNAL(MethodInfo("squeezestart", PropertyInfo(Variant::INT, "input_source_id"))); + ADD_SIGNAL(MethodInfo("squeeze", PropertyInfo(Variant::INT, "input_source_id"))); + ADD_SIGNAL(MethodInfo("squeezeend", PropertyInfo(Variant::INT, "input_source_id"))); ADD_SIGNAL(MethodInfo("visibility_state_changed")); ADD_SIGNAL(MethodInfo("reference_space_reset")); + + BIND_ENUM_CONSTANT(TARGET_RAY_MODE_UNKNOWN); + BIND_ENUM_CONSTANT(TARGET_RAY_MODE_GAZE); + BIND_ENUM_CONSTANT(TARGET_RAY_MODE_TRACKED_POINTER); + BIND_ENUM_CONSTANT(TARGET_RAY_MODE_SCREEN); } diff --git a/modules/webxr/webxr_interface.h b/modules/webxr/webxr_interface.h index 801643bfa6..1afeb5bab0 100644 --- a/modules/webxr/webxr_interface.h +++ b/modules/webxr/webxr_interface.h @@ -45,6 +45,13 @@ protected: static void _bind_methods(); public: + enum TargetRayMode { + TARGET_RAY_MODE_UNKNOWN, + TARGET_RAY_MODE_GAZE, + TARGET_RAY_MODE_TRACKED_POINTER, + TARGET_RAY_MODE_SCREEN, + }; + virtual void is_session_supported(const String &p_session_mode) = 0; virtual void set_session_mode(String p_session_mode) = 0; virtual String get_session_mode() const = 0; @@ -55,9 +62,12 @@ public: virtual void set_requested_reference_space_types(String p_requested_reference_space_types) = 0; virtual String get_requested_reference_space_types() const = 0; virtual String get_reference_space_type() const = 0; - virtual Ref<XRPositionalTracker> get_controller(int p_controller_id) const = 0; + virtual bool is_input_source_active(int p_input_source_id) const = 0; + virtual Ref<XRPositionalTracker> get_input_source_tracker(int p_input_source_id) const = 0; + virtual TargetRayMode get_input_source_target_ray_mode(int p_input_source_id) const = 0; virtual String get_visibility_state() const = 0; - virtual PackedVector3Array get_bounds_geometry() const = 0; }; +VARIANT_ENUM_CAST(WebXRInterface::TargetRayMode); + #endif // WEBXR_INTERFACE_H diff --git a/modules/webxr/webxr_interface_js.cpp b/modules/webxr/webxr_interface_js.cpp index f6ed9f027e..265f6626a7 100644 --- a/modules/webxr/webxr_interface_js.cpp +++ b/modules/webxr/webxr_interface_js.cpp @@ -37,6 +37,8 @@ #include "drivers/gles3/storage/texture_storage.h" #include "emscripten.h" #include "godot_webxr.h" +#include "scene/main/scene_tree.h" +#include "scene/main/window.h" #include "servers/rendering/renderer_compositor.h" #include "servers/rendering/rendering_server_globals.h" @@ -89,25 +91,14 @@ void _emwebxr_on_session_failed(char *p_message) { interface->emit_signal(SNAME("session_failed"), message); } -void _emwebxr_on_controller_changed() { +extern "C" EMSCRIPTEN_KEEPALIVE void _emwebxr_on_input_event(int p_event_type, int p_input_source_id) { XRServer *xr_server = XRServer::get_singleton(); ERR_FAIL_NULL(xr_server); Ref<XRInterface> interface = xr_server->find_interface("WebXR"); ERR_FAIL_COND(interface.is_null()); - static_cast<WebXRInterfaceJS *>(interface.ptr())->_on_controller_changed(); -} - -extern "C" EMSCRIPTEN_KEEPALIVE void _emwebxr_on_input_event(char *p_signal_name, int p_input_source) { - XRServer *xr_server = XRServer::get_singleton(); - ERR_FAIL_NULL(xr_server); - - Ref<XRInterface> interface = xr_server->find_interface("WebXR"); - ERR_FAIL_COND(interface.is_null()); - - StringName signal_name = StringName(p_signal_name); - interface->emit_signal(signal_name, p_input_source + 1); + ((WebXRInterfaceJS *)interface.ptr())->_on_input_event(p_event_type, p_input_source_id); } extern "C" EMSCRIPTEN_KEEPALIVE void _emwebxr_on_simple_event(char *p_signal_name) { @@ -165,16 +156,22 @@ String WebXRInterfaceJS::get_reference_space_type() const { return reference_space_type; } -Ref<XRPositionalTracker> WebXRInterfaceJS::get_controller(int p_controller_id) const { - XRServer *xr_server = XRServer::get_singleton(); - ERR_FAIL_NULL_V(xr_server, Ref<XRPositionalTracker>()); +bool WebXRInterfaceJS::is_input_source_active(int p_input_source_id) const { + ERR_FAIL_INDEX_V(p_input_source_id, input_source_count, false); + return input_sources[p_input_source_id].active; +} - // TODO support more then two controllers - if (p_controller_id >= 0 && p_controller_id < 2) { - return controllers[p_controller_id]; - }; +Ref<XRPositionalTracker> WebXRInterfaceJS::get_input_source_tracker(int p_input_source_id) const { + ERR_FAIL_INDEX_V(p_input_source_id, input_source_count, Ref<XRPositionalTracker>()); + return input_sources[p_input_source_id].tracker; +} - return Ref<XRPositionalTracker>(); +WebXRInterface::TargetRayMode WebXRInterfaceJS::get_input_source_target_ray_mode(int p_input_source_id) const { + ERR_FAIL_INDEX_V(p_input_source_id, input_source_count, WebXRInterface::TARGET_RAY_MODE_UNKNOWN); + if (!input_sources[p_input_source_id].active) { + return WebXRInterface::TARGET_RAY_MODE_UNKNOWN; + } + return input_sources[p_input_source_id].target_ray_mode; } String WebXRInterfaceJS::get_visibility_state() const { @@ -188,17 +185,18 @@ String WebXRInterfaceJS::get_visibility_state() const { return String(); } -PackedVector3Array WebXRInterfaceJS::get_bounds_geometry() const { +PackedVector3Array WebXRInterfaceJS::get_play_area() const { PackedVector3Array ret; - int *js_bounds = godot_webxr_get_bounds_geometry(); - if (js_bounds) { - ret.resize(js_bounds[0]); - for (int i = 0; i < js_bounds[0]; i++) { - float *js_vector3 = ((float *)js_bounds) + (i * 3) + 1; + float *points; + int point_count = godot_webxr_get_bounds_geometry(&points); + if (point_count > 0) { + ret.resize(point_count); + for (int i = 0; i < point_count; i++) { + float *js_vector3 = points + (i * 3); ret.set(i, Vector3(js_vector3[0], js_vector3[1], js_vector3[2])); } - free(js_bounds); + free(points); } return ret; @@ -209,7 +207,7 @@ StringName WebXRInterfaceJS::get_name() const { }; uint32_t WebXRInterfaceJS::get_capabilities() const { - return XRInterface::XR_STEREO | XRInterface::XR_MONO; + return XRInterface::XR_STEREO | XRInterface::XR_MONO | XRInterface::XR_VR | XRInterface::XR_AR; }; uint32_t WebXRInterfaceJS::get_view_count() { @@ -261,7 +259,6 @@ bool WebXRInterfaceJS::initialize() { &_emwebxr_on_session_started, &_emwebxr_on_session_ended, &_emwebxr_on_session_failed, - &_emwebxr_on_controller_changed, &_emwebxr_on_input_event, &_emwebxr_on_simple_event); }; @@ -287,6 +284,18 @@ void WebXRInterfaceJS::uninitialize() { godot_webxr_uninitialize(); + GLES3::TextureStorage *texture_storage = dynamic_cast<GLES3::TextureStorage *>(RSG::texture_storage); + if (texture_storage != nullptr) { + for (KeyValue<unsigned int, RID> &E : texture_cache) { + // Forcibly mark as not part of a render target so we can free it. + GLES3::Texture *texture = texture_storage->get_texture(E.value); + texture->is_render_target = false; + + texture_storage->texture_free(E.value); + } + } + + texture_cache.clear(); reference_space_type = ""; initialized = false; }; @@ -316,27 +325,26 @@ Size2 WebXRInterfaceJS::get_render_target_size() { return render_targetsize; } - int *js_size = godot_webxr_get_render_target_size(); - if (!initialized || js_size == nullptr) { - // As a temporary default (until WebXR is fully initialized), use half the window size. - Size2 temp = DisplayServer::get_singleton()->window_get_size(); - temp.width /= 2.0; - return temp; - } + int js_size[2]; + bool has_size = godot_webxr_get_render_target_size(js_size); - render_targetsize.width = js_size[0]; - render_targetsize.height = js_size[1]; + if (!initialized || !has_size) { + // As a temporary default (until WebXR is fully initialized), use the + // window size. + return DisplayServer::get_singleton()->window_get_size(); + } - free(js_size); + render_targetsize.width = (float)js_size[0]; + render_targetsize.height = (float)js_size[1]; return render_targetsize; }; Transform3D WebXRInterfaceJS::get_camera_transform() { - Transform3D transform_for_eye; + Transform3D camera_transform; XRServer *xr_server = XRServer::get_singleton(); - ERR_FAIL_NULL_V(xr_server, transform_for_eye); + ERR_FAIL_NULL_V(xr_server, camera_transform); if (initialized) { float world_scale = xr_server->get_world_scale(); @@ -345,181 +353,382 @@ Transform3D WebXRInterfaceJS::get_camera_transform() { Transform3D _head_transform = head_transform; _head_transform.origin *= world_scale; - transform_for_eye = (xr_server->get_reference_frame()) * _head_transform; + camera_transform = (xr_server->get_reference_frame()) * _head_transform; } - return transform_for_eye; + return camera_transform; }; Transform3D WebXRInterfaceJS::get_transform_for_view(uint32_t p_view, const Transform3D &p_cam_transform) { - Transform3D transform_for_eye; - XRServer *xr_server = XRServer::get_singleton(); - ERR_FAIL_NULL_V(xr_server, transform_for_eye); + ERR_FAIL_NULL_V(xr_server, p_cam_transform); + ERR_FAIL_COND_V(!initialized, p_cam_transform); - float *js_matrix = godot_webxr_get_transform_for_eye(p_view + 1); - if (!initialized || js_matrix == nullptr) { - transform_for_eye = p_cam_transform; - return transform_for_eye; + float js_matrix[16]; + bool has_transform = godot_webxr_get_transform_for_view(p_view, js_matrix); + if (!has_transform) { + return p_cam_transform; } - transform_for_eye = _js_matrix_to_transform(js_matrix); - free(js_matrix); + Transform3D transform_for_view = _js_matrix_to_transform(js_matrix); float world_scale = xr_server->get_world_scale(); // Scale only the center point of our eye transform, so we don't scale the // distance between the eyes. Transform3D _head_transform = head_transform; - transform_for_eye.origin -= _head_transform.origin; + transform_for_view.origin -= _head_transform.origin; _head_transform.origin *= world_scale; - transform_for_eye.origin += _head_transform.origin; + transform_for_view.origin += _head_transform.origin; - return p_cam_transform * xr_server->get_reference_frame() * transform_for_eye; + return p_cam_transform * xr_server->get_reference_frame() * transform_for_view; }; Projection WebXRInterfaceJS::get_projection_for_view(uint32_t p_view, double p_aspect, double p_z_near, double p_z_far) { - Projection eye; + Projection view; + + ERR_FAIL_COND_V(!initialized, view); - float *js_matrix = godot_webxr_get_projection_for_eye(p_view + 1); - if (!initialized || js_matrix == nullptr) { - return eye; + float js_matrix[16]; + bool has_projection = godot_webxr_get_projection_for_view(p_view, js_matrix); + if (!has_projection) { + return view; } int k = 0; for (int i = 0; i < 4; i++) { for (int j = 0; j < 4; j++) { - eye.columns[i][j] = js_matrix[k++]; + view.columns[i][j] = js_matrix[k++]; } } - free(js_matrix); - // Copied from godot_oculus_mobile's ovr_mobile_session.cpp - eye.columns[2][2] = -(p_z_far + p_z_near) / (p_z_far - p_z_near); - eye.columns[3][2] = -(2.0f * p_z_far * p_z_near) / (p_z_far - p_z_near); + view.columns[2][2] = -(p_z_far + p_z_near) / (p_z_far - p_z_near); + view.columns[3][2] = -(2.0f * p_z_far * p_z_near) / (p_z_far - p_z_near); - return eye; + return view; +} + +bool WebXRInterfaceJS::pre_draw_viewport(RID p_render_target) { + GLES3::TextureStorage *texture_storage = dynamic_cast<GLES3::TextureStorage *>(RSG::texture_storage); + if (texture_storage == nullptr) { + return false; + } + + GLES3::RenderTarget *rt = texture_storage->get_render_target(p_render_target); + if (rt == nullptr) { + return false; + } + + // Cache the resources so we don't have to get them from JS twice. + color_texture = _get_color_texture(); + depth_texture = _get_depth_texture(); + + // Per the WebXR spec, it returns "opaque textures" to us, which may be the + // same WebGLTexture object (which would be the same GLuint in C++) but + // represent a different underlying resource (probably the next texture in + // the XR device's swap chain). In order to render to this texture, we need + // to re-attach it to the FBO, otherwise we get an "incomplete FBO" error. + // + // See: https://immersive-web.github.io/layers/#xropaquetextures + // + // This is why we're doing this sort of silly check: if the color and depth + // textures are the same this frame as last frame, we need to attach them + // again, despite the fact that the GLuint for them hasn't changed. + if (rt->overridden.is_overridden && rt->overridden.color == color_texture && rt->overridden.depth == depth_texture) { + GLES3::Config *config = GLES3::Config::get_singleton(); + bool use_multiview = rt->view_count > 1 && config->multiview_supported; + + glBindFramebuffer(GL_FRAMEBUFFER, rt->fbo); + if (use_multiview) { + glFramebufferTextureMultiviewOVR(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, rt->color, 0, 0, rt->view_count); + glFramebufferTextureMultiviewOVR(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, rt->depth, 0, 0, rt->view_count); + } else { + glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, rt->color, 0); + glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, rt->depth, 0); + } + glBindFramebuffer(GL_FRAMEBUFFER, texture_storage->system_fbo); + } + + return true; } Vector<BlitToScreen> WebXRInterfaceJS::post_draw_viewport(RID p_render_target, const Rect2 &p_screen_rect) { Vector<BlitToScreen> blit_to_screen; - if (!initialized) { - return blit_to_screen; + // We don't need to do anything here. + + return blit_to_screen; +}; + +RID WebXRInterfaceJS::_get_color_texture() { + unsigned int texture_id = godot_webxr_get_color_texture(); + if (texture_id == 0) { + return RID(); + } + + return _get_texture(texture_id); +} + +RID WebXRInterfaceJS::_get_depth_texture() { + unsigned int texture_id = godot_webxr_get_depth_texture(); + if (texture_id == 0) { + return RID(); + } + + return _get_texture(texture_id); +} + +RID WebXRInterfaceJS::_get_texture(unsigned int p_texture_id) { + RBMap<unsigned int, RID>::Element *cache = texture_cache.find(p_texture_id); + if (cache != nullptr) { + return cache->get(); } GLES3::TextureStorage *texture_storage = dynamic_cast<GLES3::TextureStorage *>(RSG::texture_storage); - if (!texture_storage) { - return blit_to_screen; + if (texture_storage == nullptr) { + return RID(); } - GLES3::RenderTarget *rt = texture_storage->get_render_target(p_render_target); + uint32_t view_count = godot_webxr_get_view_count(); + Size2 texture_size = get_render_target_size(); - godot_webxr_commit(rt->color); + RID texture = texture_storage->texture_create_external( + view_count == 1 ? GLES3::Texture::TYPE_2D : GLES3::Texture::TYPE_LAYERED, + Image::FORMAT_RGBA8, + p_texture_id, + (int)texture_size.width, + (int)texture_size.height, + 1, + view_count); - return blit_to_screen; -}; + texture_cache.insert(p_texture_id, texture); + + return texture; +} + +RID WebXRInterfaceJS::get_color_texture() { + return color_texture; +} + +RID WebXRInterfaceJS::get_depth_texture() { + return depth_texture; +} + +RID WebXRInterfaceJS::get_velocity_texture() { + unsigned int texture_id = godot_webxr_get_velocity_texture(); + if (texture_id == 0) { + return RID(); + } + + return _get_texture(texture_id); +} void WebXRInterfaceJS::process() { if (initialized) { // Get the "head" position. - float *js_matrix = godot_webxr_get_transform_for_eye(0); - if (js_matrix != nullptr) { + float js_matrix[16]; + if (godot_webxr_get_transform_for_view(-1, js_matrix)) { head_transform = _js_matrix_to_transform(js_matrix); - free(js_matrix); } if (head_tracker.is_valid()) { head_tracker->set_pose("default", head_transform, Vector3(), Vector3()); } - godot_webxr_sample_controller_data(); - int controller_count = godot_webxr_get_controller_count(); - for (int i = 0; i < controller_count; i++) { - _update_tracker(i); + // Update all input sources. + for (int i = 0; i < input_source_count; i++) { + _update_input_source(i); } }; }; -void WebXRInterfaceJS::_update_tracker(int p_controller_id) { +void WebXRInterfaceJS::_update_input_source(int p_input_source_id) { XRServer *xr_server = XRServer::get_singleton(); ERR_FAIL_NULL(xr_server); - // need to support more then two controllers... - if (p_controller_id < 0 || p_controller_id > 1) { + InputSource &input_source = input_sources[p_input_source_id]; + + float target_pose[16]; + int tmp_target_ray_mode; + int touch_index; + int has_grip_pose; + float grip_pose[16]; + int has_standard_mapping; + int button_count; + float buttons[10]; + int axes_count; + float axes[10]; + + input_source.active = godot_webxr_update_input_source( + p_input_source_id, + target_pose, + &tmp_target_ray_mode, + &touch_index, + &has_grip_pose, + grip_pose, + &has_standard_mapping, + &button_count, + buttons, + &axes_count, + axes); + + if (!input_source.active) { + if (input_source.tracker.is_valid()) { + xr_server->remove_tracker(input_source.tracker); + input_source.tracker.unref(); + } return; } - Ref<XRPositionalTracker> tracker = controllers[p_controller_id]; - if (godot_webxr_is_controller_connected(p_controller_id)) { - if (tracker.is_null()) { - tracker.instantiate(); - tracker->set_tracker_type(XRServer::TRACKER_CONTROLLER); - // Controller id's 0 and 1 are always the left and right hands. - if (p_controller_id < 2) { - tracker->set_tracker_name(p_controller_id == 0 ? "left_hand" : "right_hand"); - tracker->set_tracker_desc(p_controller_id == 0 ? "Left hand controller" : "Right hand controller"); - tracker->set_tracker_hand(p_controller_id == 0 ? XRPositionalTracker::TRACKER_HAND_LEFT : XRPositionalTracker::TRACKER_HAND_RIGHT); - } else { - char name[1024]; - sprintf(name, "tracker_%i", p_controller_id); - tracker->set_tracker_name(name); - tracker->set_tracker_desc(name); - } - xr_server->add_tracker(tracker); + input_source.target_ray_mode = (WebXRInterface::TargetRayMode)tmp_target_ray_mode; + input_source.touch_index = touch_index; + + Ref<XRPositionalTracker> &tracker = input_source.tracker; + + if (tracker.is_null()) { + tracker.instantiate(); + + StringName tracker_name; + if (input_source.target_ray_mode == WebXRInterface::TargetRayMode::TARGET_RAY_MODE_SCREEN) { + tracker_name = touch_names[touch_index]; + } else { + tracker_name = tracker_names[p_input_source_id]; } - float *tracker_matrix = godot_webxr_get_controller_transform(p_controller_id); - if (tracker_matrix) { - // Note, poses should NOT have world scale and our reference frame applied! - Transform3D transform = _js_matrix_to_transform(tracker_matrix); - tracker->set_pose("default", transform, Vector3(), Vector3()); - free(tracker_matrix); + // Input source id's 0 and 1 are always the left and right hands. + if (p_input_source_id < 2) { + tracker->set_tracker_type(XRServer::TRACKER_CONTROLLER); + tracker->set_tracker_name(tracker_name); + tracker->set_tracker_desc(p_input_source_id == 0 ? "Left hand controller" : "Right hand controller"); + tracker->set_tracker_hand(p_input_source_id == 0 ? XRPositionalTracker::TRACKER_HAND_LEFT : XRPositionalTracker::TRACKER_HAND_RIGHT); + } else { + tracker->set_tracker_name(tracker_name); + tracker->set_tracker_desc(tracker_name); } + xr_server->add_tracker(tracker); + } - // TODO implement additional poses such as "aim" and "grip" + Transform3D aim_transform = _js_matrix_to_transform(target_pose); + tracker->set_pose(SNAME("default"), aim_transform, Vector3(), Vector3()); + tracker->set_pose(SNAME("aim"), aim_transform, Vector3(), Vector3()); + if (has_grip_pose) { + tracker->set_pose(SNAME("grip"), _js_matrix_to_transform(grip_pose), Vector3(), Vector3()); + } - int *buttons = godot_webxr_get_controller_buttons(p_controller_id); - if (buttons) { - // TODO buttons should be named properly, this is just a temporary fix - for (int i = 0; i < buttons[0]; i++) { - char name[1024]; - sprintf(name, "button_%i", i); + for (int i = 0; i < button_count; i++) { + StringName button_name = has_standard_mapping ? standard_button_names[i] : unknown_button_names[i]; + StringName button_pressure_name = has_standard_mapping ? standard_button_pressure_names[i] : unknown_button_pressure_names[i]; + float value = buttons[i]; + bool state = value > 0.0; + tracker->set_input(button_name, state); + tracker->set_input(button_pressure_name, value); + } - float value = *((float *)buttons + (i + 1)); - bool state = value > 0.0; - tracker->set_input(name, state); - } - free(buttons); + for (int i = 0; i < axes_count; i++) { + StringName axis_name = has_standard_mapping ? standard_axis_names[i] : unknown_axis_names[i]; + float value = axes[i]; + if (has_standard_mapping && (i == 1 || i == 3)) { + // Invert the Y-axis on thumbsticks and trackpads, in order to + // match OpenXR and other XR platform SDKs. + value = -value; } + tracker->set_input(axis_name, value); + } - int *axes = godot_webxr_get_controller_axes(p_controller_id); - if (axes) { - // TODO again just a temporary fix, split these between proper float and vector2 inputs - for (int i = 0; i < axes[0]; i++) { - char name[1024]; - sprintf(name, "axis_%i", i); + // Also create Vector2's for the thumbstick and trackpad when we have the + // standard mapping. + if (has_standard_mapping) { + if (axes_count >= 2) { + tracker->set_input(standard_vector_names[0], Vector2(axes[0], -axes[1])); + } + if (axes_count >= 4) { + tracker->set_input(standard_vector_names[1], Vector2(axes[2], -axes[3])); + } + } - float value = *((float *)axes + (i + 1)); - tracker->set_input(name, value); + if (input_source.target_ray_mode == WebXRInterface::TARGET_RAY_MODE_SCREEN) { + if (touch_index < 5 && axes_count >= 2) { + Vector2 joy_vector = Vector2(axes[0], axes[1]); + Vector2 position = _get_screen_position_from_joy_vector(joy_vector); + + if (touches[touch_index].is_touching) { + Vector2 delta = position - touches[touch_index].position; + + // If position has changed by at least 1 pixel, generate a drag event. + if (abs(delta.x) >= 1.0 || abs(delta.y) >= 1.0) { + Ref<InputEventScreenDrag> event; + event.instantiate(); + event->set_index(touch_index); + event->set_position(position); + event->set_relative(delta); + Input::get_singleton()->parse_input_event(event); + } } - free(axes); + + touches[touch_index].position = position; } - } else if (tracker.is_valid()) { - xr_server->remove_tracker(tracker); - controllers[p_controller_id].unref(); } } -void WebXRInterfaceJS::_on_controller_changed() { - // Register "virtual" gamepads with Godot for the ones we get from WebXR. - godot_webxr_sample_controller_data(); - for (int i = 0; i < 2; i++) { - bool controller_connected = godot_webxr_is_controller_connected(i); - if (controllers_state[i] != controller_connected) { - // Input::get_singleton()->joy_connection_changed(i + 100, controller_connected, i == 0 ? "Left" : "Right", ""); - controllers_state[i] = controller_connected; +void WebXRInterfaceJS::_on_input_event(int p_event_type, int p_input_source_id) { + // Get the latest data for this input source. For transient input sources, + // we may not have any data at all yet! + _update_input_source(p_input_source_id); + + if (p_event_type == WEBXR_INPUT_EVENT_SELECTSTART || p_event_type == WEBXR_INPUT_EVENT_SELECTEND) { + const InputSource &input_source = input_sources[p_input_source_id]; + if (input_source.target_ray_mode == WebXRInterface::TARGET_RAY_MODE_SCREEN) { + int touch_index = input_source.touch_index; + if (touch_index >= 0 && touch_index < 5) { + touches[touch_index].is_touching = (p_event_type == WEBXR_INPUT_EVENT_SELECTSTART); + + Ref<InputEventScreenTouch> event; + event.instantiate(); + event->set_index(touch_index); + event->set_position(touches[touch_index].position); + event->set_pressed(p_event_type == WEBXR_INPUT_EVENT_SELECTSTART); + + Input::get_singleton()->parse_input_event(event); + } } } + + switch (p_event_type) { + case WEBXR_INPUT_EVENT_SELECTSTART: + emit_signal("selectstart", p_input_source_id); + break; + + case WEBXR_INPUT_EVENT_SELECTEND: + emit_signal("selectend", p_input_source_id); + // Emit the 'select' event on our own (rather than intercepting the + // one from JavaScript) so that we don't have to needlessly call + // _update_input_source() a second time. + emit_signal("select", p_input_source_id); + break; + + case WEBXR_INPUT_EVENT_SQUEEZESTART: + emit_signal("squeezestart", p_input_source_id); + break; + + case WEBXR_INPUT_EVENT_SQUEEZEEND: + emit_signal("squeezeend", p_input_source_id); + // Again, we emit the 'squeeze' event on our own to avoid extra work. + emit_signal("squeeze", p_input_source_id); + break; + } +} + +Vector2 WebXRInterfaceJS::_get_screen_position_from_joy_vector(const Vector2 &p_joy_vector) { + SceneTree *scene_tree = Object::cast_to<SceneTree>(OS::get_singleton()->get_main_loop()); + if (!scene_tree) { + return Vector2(); + } + + Window *viewport = scene_tree->get_root(); + + Vector2 position_percentage((p_joy_vector.x + 1.0f) / 2.0f, ((p_joy_vector.y) + 1.0f) / 2.0f); + Vector2 position = (Size2)viewport->get_size() * position_percentage; + + return position; } WebXRInterfaceJS::WebXRInterfaceJS() { diff --git a/modules/webxr/webxr_interface_js.h b/modules/webxr/webxr_interface_js.h index 319adc2ac9..6b484a8872 100644 --- a/modules/webxr/webxr_interface_js.h +++ b/modules/webxr/webxr_interface_js.h @@ -39,6 +39,10 @@ The WebXR interface is a VR/AR interface that can be used on the web. */ +namespace GLES3 { +class TextureStorage; +} + class WebXRInterfaceJS : public WebXRInterface { GDCLASS(WebXRInterfaceJS, WebXRInterface); @@ -53,13 +57,32 @@ private: String requested_reference_space_types; String reference_space_type; - // TODO maybe turn into a vector to support more then 2 controllers... - bool controllers_state[2]; - Ref<XRPositionalTracker> controllers[2]; Size2 render_targetsize; - + RBMap<unsigned int, RID> texture_cache; + struct Touch { + bool is_touching = false; + Vector2 position; + } touches[5]; + + static constexpr uint8_t input_source_count = 16; + + struct InputSource { + Ref<XRPositionalTracker> tracker; + bool active = false; + TargetRayMode target_ray_mode; + int touch_index = -1; + } input_sources[input_source_count]; + + RID color_texture; + RID depth_texture; + + RID _get_color_texture(); + RID _get_depth_texture(); + RID _get_texture(unsigned int p_texture_id); Transform3D _js_matrix_to_transform(float *p_js_matrix); - void _update_tracker(int p_controller_id); + void _update_input_source(int p_input_source_id); + + Vector2 _get_screen_position_from_joy_vector(const Vector2 &p_joy_vector); public: virtual void is_session_supported(const String &p_session_mode) override; @@ -73,9 +96,11 @@ public: virtual String get_requested_reference_space_types() const override; void _set_reference_space_type(String p_reference_space_type); virtual String get_reference_space_type() const override; - virtual Ref<XRPositionalTracker> get_controller(int p_controller_id) const override; + virtual bool is_input_source_active(int p_input_source_id) const override; + virtual Ref<XRPositionalTracker> get_input_source_tracker(int p_input_source_id) const override; + virtual TargetRayMode get_input_source_target_ray_mode(int p_input_source_id) const override; virtual String get_visibility_state() const override; - virtual PackedVector3Array get_bounds_geometry() const override; + virtual PackedVector3Array get_play_area() const override; virtual StringName get_name() const override; virtual uint32_t get_capabilities() const override; @@ -89,14 +114,129 @@ public: virtual Transform3D get_camera_transform() override; virtual Transform3D get_transform_for_view(uint32_t p_view, const Transform3D &p_cam_transform) override; virtual Projection get_projection_for_view(uint32_t p_view, double p_aspect, double p_z_near, double p_z_far) override; + virtual bool pre_draw_viewport(RID p_render_target) override; virtual Vector<BlitToScreen> post_draw_viewport(RID p_render_target, const Rect2 &p_screen_rect) override; + virtual RID get_color_texture() override; + virtual RID get_depth_texture() override; + virtual RID get_velocity_texture() override; virtual void process() override; - void _on_controller_changed(); + void _on_input_event(int p_event_type, int p_input_source_id); WebXRInterfaceJS(); ~WebXRInterfaceJS(); + +private: + StringName tracker_names[16] = { + StringName("left_hand"), + StringName("right_hand"), + StringName("tracker_2"), + StringName("tracker_3"), + StringName("tracker_4"), + StringName("tracker_5"), + StringName("tracker_6"), + StringName("tracker_7"), + StringName("tracker_8"), + StringName("tracker_9"), + StringName("tracker_10"), + StringName("tracker_11"), + StringName("tracker_12"), + StringName("tracker_13"), + StringName("tracker_14"), + StringName("tracker_15"), + }; + + StringName touch_names[5] = { + StringName("touch_0"), + StringName("touch_1"), + StringName("touch_2"), + StringName("touch_3"), + StringName("touch_4"), + }; + + StringName standard_axis_names[10] = { + StringName("touchpad_x"), + StringName("touchpad_y"), + StringName("thumbstick_x"), + StringName("thumbstick_y"), + StringName("axis_4"), + StringName("axis_5"), + StringName("axis_6"), + StringName("axis_7"), + StringName("axis_8"), + StringName("axis_9"), + }; + + StringName standard_vector_names[2] = { + StringName("touchpad"), + StringName("thumbstick"), + }; + + StringName standard_button_names[10] = { + StringName("trigger_click"), + StringName("grip_click"), + StringName("touchpad_click"), + StringName("thumbstick_click"), + StringName("ax_button"), + StringName("by_button"), + StringName("button_6"), + StringName("button_7"), + StringName("button_8"), + StringName("button_9"), + }; + + StringName standard_button_pressure_names[10] = { + StringName("trigger"), + StringName("grip"), + StringName("touchpad_click_pressure"), + StringName("thumbstick_click_pressure"), + StringName("ax_button_pressure"), + StringName("by_button_pressure"), + StringName("button_pressure_6"), + StringName("button_pressure_7"), + StringName("button_pressure_8"), + StringName("button_pressure_9"), + }; + + StringName unknown_button_names[10] = { + StringName("button_0"), + StringName("button_1"), + StringName("button_2"), + StringName("button_3"), + StringName("button_4"), + StringName("button_5"), + StringName("button_6"), + StringName("button_7"), + StringName("button_8"), + StringName("button_9"), + }; + + StringName unknown_axis_names[10] = { + StringName("axis_0"), + StringName("axis_1"), + StringName("axis_2"), + StringName("axis_3"), + StringName("axis_4"), + StringName("axis_5"), + StringName("axis_6"), + StringName("axis_7"), + StringName("axis_8"), + StringName("axis_9"), + }; + + StringName unknown_button_pressure_names[10] = { + StringName("button_pressure_0"), + StringName("button_pressure_1"), + StringName("button_pressure_2"), + StringName("button_pressure_3"), + StringName("button_pressure_4"), + StringName("button_pressure_5"), + StringName("button_pressure_6"), + StringName("button_pressure_7"), + StringName("button_pressure_8"), + StringName("button_pressure_9"), + }; }; #endif // WEB_ENABLED diff --git a/platform/android/detect.py b/platform/android/detect.py index 57a8d34d0e..ec36a40941 100644 --- a/platform/android/detect.py +++ b/platform/android/detect.py @@ -24,7 +24,11 @@ def can_build(): def get_opts(): return [ ("ANDROID_SDK_ROOT", "Path to the Android SDK", get_env_android_sdk_root()), - ("ndk_platform", 'Target platform (android-<api>, e.g. "android-24")', "android-24"), + ( + "ndk_platform", + 'Target platform (android-<api>, e.g. "android-' + str(get_min_target_api()) + '")', + "android-" + str(get_min_target_api()), + ), ] @@ -46,6 +50,11 @@ def get_ndk_version(): return "23.2.8568313" +# This is kept in sync with the value in 'platform/android/java/app/config.gradle'. +def get_min_target_api(): + return 21 + + def get_flags(): return [ ("arch", "arm64"), # Default for convenience. @@ -87,18 +96,18 @@ def configure(env: "Environment"): ) sys.exit() + if get_min_sdk_version(env["ndk_platform"]) < get_min_target_api(): + print( + "WARNING: minimum supported Android target api is %d. Forcing target api %d." + % (get_min_target_api(), get_min_target_api()) + ) + env["ndk_platform"] = "android-" + str(get_min_target_api()) + install_ndk_if_needed(env) ndk_root = env["ANDROID_NDK_ROOT"] # Architecture - if get_min_sdk_version(env["ndk_platform"]) < 21 and env["arch"] in ["x86_64", "arm64"]: - print( - 'WARNING: arch="%s" is not supported with "ndk_platform" lower than "android-21". Forcing platform 21.' - % env["arch"] - ) - env["ndk_platform"] = "android-21" - if env["arch"] == "arm32": target_triple = "armv7a-linux-androideabi" elif env["arch"] == "arm64": @@ -161,7 +170,6 @@ def configure(env: "Environment"): "-fpic -ffunction-sections -funwind-tables -fstack-protector-strong -fvisibility=hidden -fno-strict-aliasing".split() ) ) - env.Append(CPPDEFINES=["GLES_ENABLED"]) if get_min_sdk_version(env["ndk_platform"]) >= 24: env.Append(CPPDEFINES=[("_FILE_OFFSET_BITS", 64)]) @@ -184,9 +192,13 @@ def configure(env: "Environment"): env.Prepend(CPPPATH=["#platform/android"]) env.Append(CPPDEFINES=["ANDROID_ENABLED", "UNIX_ENABLED"]) - env.Append(LIBS=["OpenSLES", "EGL", "GLESv2", "android", "log", "z", "dl"]) + env.Append(LIBS=["OpenSLES", "EGL", "android", "log", "z", "dl"]) if env["vulkan"]: env.Append(CPPDEFINES=["VULKAN_ENABLED"]) if not env["use_volk"]: env.Append(LIBS=["vulkan"]) + + if env["opengl3"]: + env.Append(CPPDEFINES=["GLES3_ENABLED"]) + env.Append(LIBS=["GLESv3"]) diff --git a/platform/android/display_server_android.cpp b/platform/android/display_server_android.cpp index 967f5c7dae..937b929d62 100644 --- a/platform/android/display_server_android.cpp +++ b/platform/android/display_server_android.cpp @@ -41,6 +41,10 @@ #include "platform/android/vulkan/vulkan_context_android.h" #include "servers/rendering/renderer_rd/renderer_compositor_rd.h" #endif +#ifdef GLES3_ENABLED +#include "drivers/gles3/rasterizer_gles3.h" +#include <EGL/egl.h> +#endif DisplayServerAndroid *DisplayServerAndroid::get_singleton() { return static_cast<DisplayServerAndroid *>(DisplayServer::get_singleton()); @@ -312,9 +316,6 @@ DisplayServer::WindowID DisplayServerAndroid::get_window_at_screen_position(cons int64_t DisplayServerAndroid::window_get_native_handle(HandleType p_handle_type, WindowID p_window) const { ERR_FAIL_COND_V(p_window != MAIN_WINDOW_ID, 0); switch (p_handle_type) { - case DISPLAY_HANDLE: { - return 0; // Not supported. - } case WINDOW_HANDLE: { return reinterpret_cast<int64_t>(static_cast<OS_Android *>(OS::get_singleton())->get_godot_java()->get_activity()); } @@ -322,8 +323,17 @@ int64_t DisplayServerAndroid::window_get_native_handle(HandleType p_handle_type, return 0; // Not supported. } #ifdef GLES3_ENABLED + case DISPLAY_HANDLE: { + if (rendering_driver == "opengl3") { + return reinterpret_cast<int64_t>(eglGetCurrentDisplay()); + } + return 0; + } case OPENGL_CONTEXT: { - return eglGetCurrentContext(); + if (rendering_driver == "opengl3") { + return reinterpret_cast<int64_t>(eglGetCurrentContext()); + } + return 0; } #endif default: { @@ -449,6 +459,14 @@ DisplayServer *DisplayServerAndroid::create_func(const String &p_rendering_drive DisplayServer *ds = memnew(DisplayServerAndroid(p_rendering_driver, p_mode, p_vsync_mode, p_flags, p_position, p_resolution, r_error)); if (r_error != OK) { OS::get_singleton()->alert("Your video card driver does not support any of the supported Vulkan versions.", "Unable to initialize Video driver"); + if (p_rendering_driver == "vulkan") { + OS::get_singleton()->alert("Your video card driver does not support the selected Vulkan version.\n" + "Please try exporting your game using the gl_compatibility renderer.", + "Unable to initialize Video driver"); + } else { + OS::get_singleton()->alert("Your video card driver does not support OpenGL ES 3.0.", + "Unable to initialize Video driver"); + } } return ds; } @@ -493,28 +511,11 @@ void DisplayServerAndroid::notify_surface_changed(int p_width, int p_height) { DisplayServerAndroid::DisplayServerAndroid(const String &p_rendering_driver, DisplayServer::WindowMode p_mode, DisplayServer::VSyncMode p_vsync_mode, uint32_t p_flags, const Vector2i *p_position, const Vector2i &p_resolution, Error &r_error) { rendering_driver = p_rendering_driver; - // TODO: rendering_driver is broken, change when different drivers are supported again - rendering_driver = "vulkan"; - keep_screen_on = GLOBAL_GET("display/window/energy_saving/keep_screen_on"); #if defined(GLES3_ENABLED) if (rendering_driver == "opengl3") { - bool gl_initialization_error = false; - - if (RasterizerGLES3::is_viable() == OK) { - RasterizerGLES3::register_config(); - RasterizerGLES3::make_current(); - } else { - gl_initialization_error = true; - } - - if (gl_initialization_error) { - OS::get_singleton()->alert("Your device does not support any of the supported OpenGL versions.\n" - "Please try updating your Android version.", - "Unable to initialize video driver"); - return; - } + RasterizerGLES3::make_current(); } #endif @@ -619,11 +620,11 @@ MouseButton DisplayServerAndroid::mouse_get_button_state() const { return (MouseButton)Input::get_singleton()->get_mouse_button_mask(); } -void DisplayServerAndroid::cursor_set_shape(DisplayServer::CursorShape p_shape) { +void DisplayServerAndroid::_cursor_set_shape_helper(CursorShape p_shape, bool force) { if (!OS_Android::get_singleton()->get_godot_java()->get_godot_view()->can_update_pointer_icon()) { return; } - if (cursor_shape == p_shape) { + if (cursor_shape == p_shape && !force) { return; } @@ -634,10 +635,23 @@ void DisplayServerAndroid::cursor_set_shape(DisplayServer::CursorShape p_shape) } } +void DisplayServerAndroid::cursor_set_shape(DisplayServer::CursorShape p_shape) { + _cursor_set_shape_helper(p_shape); +} + DisplayServer::CursorShape DisplayServerAndroid::cursor_get_shape() const { return cursor_shape; } +void DisplayServerAndroid::cursor_set_custom_image(const Ref<Resource> &p_cursor, CursorShape p_shape, const Vector2 &p_hotspot) { + String cursor_path = p_cursor.is_valid() ? p_cursor->get_path() : ""; + if (!cursor_path.is_empty()) { + cursor_path = ProjectSettings::get_singleton()->globalize_path(cursor_path); + } + OS_Android::get_singleton()->get_godot_java()->get_godot_view()->configure_pointer_icon(android_cursors[cursor_shape], cursor_path, p_hotspot); + _cursor_set_shape_helper(p_shape, true); +} + void DisplayServerAndroid::window_set_vsync_mode(DisplayServer::VSyncMode p_vsync_mode, WindowID p_window) { #if defined(VULKAN_ENABLED) context_vulkan->set_vsync_mode(p_window, p_vsync_mode); @@ -651,3 +665,23 @@ DisplayServer::VSyncMode DisplayServerAndroid::window_get_vsync_mode(WindowID p_ return DisplayServer::VSYNC_ENABLED; #endif } + +void DisplayServerAndroid::reset_swap_buffers_flag() { + swap_buffers_flag = false; +} + +bool DisplayServerAndroid::should_swap_buffers() const { + return swap_buffers_flag; +} + +void DisplayServerAndroid::swap_buffers() { + swap_buffers_flag = true; +} + +void DisplayServerAndroid::set_native_icon(const String &p_filename) { + // NOT SUPPORTED +} + +void DisplayServerAndroid::set_icon(const Ref<Image> &p_icon) { + // NOT SUPPORTED +} diff --git a/platform/android/display_server_android.h b/platform/android/display_server_android.h index a6bc88e048..c7f4d8046f 100644 --- a/platform/android/display_server_android.h +++ b/platform/android/display_server_android.h @@ -66,6 +66,7 @@ class DisplayServerAndroid : public DisplayServer { MouseMode mouse_mode = MouseMode::MOUSE_MODE_VISIBLE; bool keep_screen_on; + bool swap_buffers_flag; CursorShape cursor_shape = CursorShape::CURSOR_ARROW; @@ -188,8 +189,10 @@ public: void process_magnetometer(const Vector3 &p_magnetometer); void process_gyroscope(const Vector3 &p_gyroscope); + void _cursor_set_shape_helper(CursorShape p_shape, bool force = false); virtual void cursor_set_shape(CursorShape p_shape) override; virtual CursorShape cursor_get_shape() const override; + virtual void cursor_set_custom_image(const Ref<Resource> &p_cursor, CursorShape p_shape = CURSOR_ARROW, const Vector2 &p_hotspot = Vector2()) override; virtual void mouse_set_mode(MouseMode p_mode) override; virtual MouseMode mouse_get_mode() const override; @@ -204,6 +207,13 @@ public: virtual Point2i mouse_get_position() const override; virtual MouseButton mouse_get_button_state() const override; + void reset_swap_buffers_flag(); + bool should_swap_buffers() const; + virtual void swap_buffers() override; + + virtual void set_native_icon(const String &p_filename) override; + virtual void set_icon(const Ref<Image> &p_icon) override; + DisplayServerAndroid(const String &p_rendering_driver, WindowMode p_mode, DisplayServer::VSyncMode p_vsync_mode, uint32_t p_flags, const Vector2i *p_position, const Vector2i &p_resolution, Error &r_error); ~DisplayServerAndroid(); }; diff --git a/platform/android/export/export_plugin.cpp b/platform/android/export/export_plugin.cpp index c3fba625c6..795a542ed5 100644 --- a/platform/android/export/export_plugin.cpp +++ b/platform/android/export/export_plugin.cpp @@ -245,7 +245,7 @@ static const int EXPORT_FORMAT_AAB = 1; static const char *APK_ASSETS_DIRECTORY = "res://android/build/assets"; static const char *AAB_ASSETS_DIRECTORY = "res://android/build/assetPacks/installTime/src/main/assets"; -static const int DEFAULT_MIN_SDK_VERSION = 19; // Should match the value in 'platform/android/java/app/config.gradle#minSdk' +static const int DEFAULT_MIN_SDK_VERSION = 21; // Should match the value in 'platform/android/java/app/config.gradle#minSdk' static const int DEFAULT_TARGET_SDK_VERSION = 32; // Should match the value in 'platform/android/java/app/config.gradle#targetSdk' #ifndef ANDROID_ENABLED @@ -703,7 +703,7 @@ Error EditorExportPlatformAndroid::save_apk_so(void *p_userdata, const SharedObj exported = true; String abi = abis[abi_index].abi; String dst_path = String("lib").path_join(abi).path_join(p_so.path.get_file()); - Vector<uint8_t> array = FileAccess::get_file_as_array(p_so.path); + Vector<uint8_t> array = FileAccess::get_file_as_bytes(p_so.path); Error store_err = store_in_apk(ed, dst_path, array); ERR_FAIL_COND_V_MSG(store_err, store_err, "Cannot store in apk file '" + dst_path + "'."); } @@ -748,7 +748,7 @@ Error EditorExportPlatformAndroid::copy_gradle_so(void *p_userdata, const Shared String abi = abis[abi_index].abi; String filename = p_so.path.get_file(); String dst_path = base.path_join(type).path_join(abi).path_join(filename); - Vector<uint8_t> data = FileAccess::get_file_as_array(p_so.path); + Vector<uint8_t> data = FileAccess::get_file_as_bytes(p_so.path); print_verbose("Copying .so file from " + p_so.path + " to " + dst_path); Error err = store_file_at_path(dst_path, data); ERR_FAIL_COND_V_MSG(err, err, "Failed to copy .so file from " + p_so.path + " to " + dst_path); diff --git a/platform/android/java/app/AndroidManifest.xml b/platform/android/java/app/AndroidManifest.xml index 2d4c4763a2..1db135826a 100644 --- a/platform/android/java/app/AndroidManifest.xml +++ b/platform/android/java/app/AndroidManifest.xml @@ -13,7 +13,7 @@ android:xlargeScreens="true" /> <uses-feature - android:glEsVersion="0x00020000" + android:glEsVersion="0x00030000" android:required="true" /> <application diff --git a/platform/android/java/app/config.gradle b/platform/android/java/app/config.gradle index e1d9dc4cde..f1b4bfd534 100644 --- a/platform/android/java/app/config.gradle +++ b/platform/android/java/app/config.gradle @@ -1,14 +1,17 @@ ext.versions = [ androidGradlePlugin: '7.2.1', compileSdk : 32, - minSdk : 19, // Also update 'platform/android/export/export_plugin.cpp#DEFAULT_MIN_SDK_VERSION' - targetSdk : 32, // Also update 'platform/android/export/export_plugin.cpp#DEFAULT_TARGET_SDK_VERSION' + // Also update 'platform/android/export/export_plugin.cpp#DEFAULT_MIN_SDK_VERSION' + minSdk : 21, + // Also update 'platform/android/export/export_plugin.cpp#DEFAULT_TARGET_SDK_VERSION' + targetSdk : 32, buildTools : '32.0.0', kotlinVersion : '1.7.0', fragmentVersion : '1.3.6', nexusPublishVersion: '1.1.0', javaVersion : 11, - ndkVersion : '23.2.8568313' // Also update 'platform/android/detect.py#get_ndk_version()' when this is updated. + // Also update 'platform/android/detect.py#get_ndk_version()' when this is updated. + ndkVersion : '23.2.8568313' ] diff --git a/platform/android/java/editor/src/main/AndroidManifest.xml b/platform/android/java/editor/src/main/AndroidManifest.xml index 6aa5f06f31..f3ddaafd0e 100644 --- a/platform/android/java/editor/src/main/AndroidManifest.xml +++ b/platform/android/java/editor/src/main/AndroidManifest.xml @@ -11,7 +11,7 @@ android:xlargeScreens="true" /> <uses-feature - android:glEsVersion="0x00020000" + android:glEsVersion="0x00030000" android:required="true" /> <uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" diff --git a/platform/android/java/lib/src/org/godotengine/godot/Godot.java b/platform/android/java/lib/src/org/godotengine/godot/Godot.java index a002a37ab9..3487e5019c 100644 --- a/platform/android/java/lib/src/org/godotengine/godot/Godot.java +++ b/platform/android/java/lib/src/org/godotengine/godot/Godot.java @@ -175,6 +175,7 @@ public class Godot extends Fragment implements SensorEventListener, IDownloaderC public GodotIO io; public GodotNetUtils netUtils; public GodotTTS tts; + DirectoryAccessHandler directoryAccessHandler; public interface ResultCallback { void callback(int requestCode, int resultCode, Intent data); @@ -488,7 +489,7 @@ public class Godot extends Fragment implements SensorEventListener, IDownloaderC netUtils = new GodotNetUtils(activity); tts = new GodotTTS(activity); Context context = getContext(); - DirectoryAccessHandler directoryAccessHandler = new DirectoryAccessHandler(context); + directoryAccessHandler = new DirectoryAccessHandler(context); FileAccessHandler fileAccessHandler = new FileAccessHandler(context); mSensorManager = (SensorManager)activity.getSystemService(Context.SENSOR_SERVICE); mAccelerometer = mSensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER); diff --git a/platform/android/java/lib/src/org/godotengine/godot/GodotGLRenderView.java b/platform/android/java/lib/src/org/godotengine/godot/GodotGLRenderView.java index 3dfc37f6b0..f8d937521b 100644 --- a/platform/android/java/lib/src/org/godotengine/godot/GodotGLRenderView.java +++ b/platform/android/java/lib/src/org/godotengine/godot/GodotGLRenderView.java @@ -43,8 +43,13 @@ import org.godotengine.godot.xr.regular.RegularFallbackConfigChooser; import android.annotation.SuppressLint; import android.content.Context; +import android.content.res.AssetManager; +import android.graphics.Bitmap; +import android.graphics.BitmapFactory; import android.graphics.PixelFormat; import android.os.Build; +import android.text.TextUtils; +import android.util.SparseArray; import android.view.KeyEvent; import android.view.MotionEvent; import android.view.PointerIcon; @@ -52,6 +57,8 @@ import android.view.SurfaceView; import androidx.annotation.Keep; +import java.io.InputStream; + /** * A simple GLSurfaceView sub-class that demonstrate how to perform * OpenGL ES 2.0 rendering into a GL Surface. Note the following important @@ -61,7 +68,7 @@ import androidx.annotation.Keep; * See ContextFactory class definition below. * * - The class must use a custom EGLConfigChooser to be able to select - * an EGLConfig that supports 2.0. This is done by providing a config + * an EGLConfig that supports 3.0. This is done by providing a config * specification to eglChooseConfig() that has the attribute * EGL10.ELG_RENDERABLE_TYPE containing the EGL_OPENGL_ES2_BIT flag * set. See ConfigChooser class definition below. @@ -74,6 +81,7 @@ public class GodotGLRenderView extends GLSurfaceView implements GodotRenderView private final Godot godot; private final GodotInputHandler inputHandler; private final GodotRenderer godotRenderer; + private final SparseArray<PointerIcon> customPointerIcons = new SparseArray<>(); public GodotGLRenderView(Context context, Godot godot, XRMode xrMode, boolean p_use_debug_opengl) { super(context); @@ -169,12 +177,49 @@ public class GodotGLRenderView extends GLSurfaceView implements GodotRenderView } /** + * Used to configure the PointerIcon for the given type. + * + * Called from JNI + */ + @Keep + @Override + public void configurePointerIcon(int pointerType, String imagePath, float hotSpotX, float hotSpotY) { + if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.N) { + try { + Bitmap bitmap = null; + if (!TextUtils.isEmpty(imagePath)) { + if (godot.directoryAccessHandler.filesystemFileExists(imagePath)) { + // Try to load the bitmap from the file system + bitmap = BitmapFactory.decodeFile(imagePath); + } else if (godot.directoryAccessHandler.assetsFileExists(imagePath)) { + // Try to load the bitmap from the assets directory + AssetManager am = getContext().getAssets(); + InputStream imageInputStream = am.open(imagePath); + bitmap = BitmapFactory.decodeStream(imageInputStream); + } + } + + PointerIcon customPointerIcon = PointerIcon.create(bitmap, hotSpotX, hotSpotY); + customPointerIcons.put(pointerType, customPointerIcon); + } catch (Exception e) { + // Reset the custom pointer icon + customPointerIcons.delete(pointerType); + } + } + } + + /** * called from JNI to change pointer icon */ @Keep + @Override public void setPointerIcon(int pointerType) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { - setPointerIcon(PointerIcon.getSystemIcon(getContext(), pointerType)); + PointerIcon pointerIcon = customPointerIcons.get(pointerType); + if (pointerIcon == null) { + pointerIcon = PointerIcon.getSystemIcon(getContext(), pointerType); + } + setPointerIcon(pointerIcon); } } diff --git a/platform/android/java/lib/src/org/godotengine/godot/GodotRenderView.java b/platform/android/java/lib/src/org/godotengine/godot/GodotRenderView.java index cb63fd885f..ab74ba037d 100644 --- a/platform/android/java/lib/src/org/godotengine/godot/GodotRenderView.java +++ b/platform/android/java/lib/src/org/godotengine/godot/GodotRenderView.java @@ -48,5 +48,7 @@ public interface GodotRenderView { GodotInputHandler getInputHandler(); + void configurePointerIcon(int pointerType, String imagePath, float hotSpotX, float hotSpotY); + void setPointerIcon(int pointerType); } diff --git a/platform/android/java/lib/src/org/godotengine/godot/GodotVulkanRenderView.java b/platform/android/java/lib/src/org/godotengine/godot/GodotVulkanRenderView.java index 0becf00d93..56bc7f9e76 100644 --- a/platform/android/java/lib/src/org/godotengine/godot/GodotVulkanRenderView.java +++ b/platform/android/java/lib/src/org/godotengine/godot/GodotVulkanRenderView.java @@ -36,7 +36,12 @@ import org.godotengine.godot.vulkan.VkSurfaceView; import android.annotation.SuppressLint; import android.content.Context; +import android.content.res.AssetManager; +import android.graphics.Bitmap; +import android.graphics.BitmapFactory; import android.os.Build; +import android.text.TextUtils; +import android.util.SparseArray; import android.view.KeyEvent; import android.view.MotionEvent; import android.view.PointerIcon; @@ -44,10 +49,13 @@ import android.view.SurfaceView; import androidx.annotation.Keep; +import java.io.InputStream; + public class GodotVulkanRenderView extends VkSurfaceView implements GodotRenderView { private final Godot godot; private final GodotInputHandler mInputHandler; private final VkRenderer mRenderer; + private final SparseArray<PointerIcon> customPointerIcons = new SparseArray<>(); public GodotVulkanRenderView(Context context, Godot godot) { super(context); @@ -143,12 +151,49 @@ public class GodotVulkanRenderView extends VkSurfaceView implements GodotRenderV } /** + * Used to configure the PointerIcon for the given type. + * + * Called from JNI + */ + @Keep + @Override + public void configurePointerIcon(int pointerType, String imagePath, float hotSpotX, float hotSpotY) { + if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.N) { + try { + Bitmap bitmap = null; + if (!TextUtils.isEmpty(imagePath)) { + if (godot.directoryAccessHandler.filesystemFileExists(imagePath)) { + // Try to load the bitmap from the file system + bitmap = BitmapFactory.decodeFile(imagePath); + } else if (godot.directoryAccessHandler.assetsFileExists(imagePath)) { + // Try to load the bitmap from the assets directory + AssetManager am = getContext().getAssets(); + InputStream imageInputStream = am.open(imagePath); + bitmap = BitmapFactory.decodeStream(imageInputStream); + } + } + + PointerIcon customPointerIcon = PointerIcon.create(bitmap, hotSpotX, hotSpotY); + customPointerIcons.put(pointerType, customPointerIcon); + } catch (Exception e) { + // Reset the custom pointer icon + customPointerIcons.delete(pointerType); + } + } + } + + /** * called from JNI to change pointer icon */ @Keep + @Override public void setPointerIcon(int pointerType) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { - setPointerIcon(PointerIcon.getSystemIcon(getContext(), pointerType)); + PointerIcon pointerIcon = customPointerIcons.get(pointerType); + if (pointerIcon == null) { + pointerIcon = PointerIcon.getSystemIcon(getContext(), pointerType); + } + setPointerIcon(pointerIcon); } } diff --git a/platform/android/java/lib/src/org/godotengine/godot/io/StorageScope.kt b/platform/android/java/lib/src/org/godotengine/godot/io/StorageScope.kt index c9282dd247..1a3576a6a9 100644 --- a/platform/android/java/lib/src/org/godotengine/godot/io/StorageScope.kt +++ b/platform/android/java/lib/src/org/godotengine/godot/io/StorageScope.kt @@ -90,6 +90,11 @@ internal enum class StorageScope { return APP } + var rootDir: String? = System.getenv("ANDROID_ROOT") + if (rootDir != null && canonicalPathFile.startsWith(rootDir)) { + return APP + } + if (sharedDir != null && canonicalPathFile.startsWith(sharedDir)) { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.R) { // Before R, apps had access to shared storage so long as they have the right diff --git a/platform/android/java/lib/src/org/godotengine/godot/io/directory/DirectoryAccessHandler.kt b/platform/android/java/lib/src/org/godotengine/godot/io/directory/DirectoryAccessHandler.kt index fedcf4843f..6bc317415f 100644 --- a/platform/android/java/lib/src/org/godotengine/godot/io/directory/DirectoryAccessHandler.kt +++ b/platform/android/java/lib/src/org/godotengine/godot/io/directory/DirectoryAccessHandler.kt @@ -79,6 +79,9 @@ class DirectoryAccessHandler(context: Context) { private val assetsDirAccess = AssetsDirectoryAccess(context) private val fileSystemDirAccess = FilesystemDirectoryAccess(context) + fun assetsFileExists(assetsPath: String) = assetsDirAccess.fileExists(assetsPath) + fun filesystemFileExists(path: String) = fileSystemDirAccess.fileExists(path) + private fun hasDirId(accessType: AccessType, dirId: Int): Boolean { return when (accessType) { ACCESS_RESOURCES -> assetsDirAccess.hasDirId(dirId) diff --git a/platform/android/java/lib/src/org/godotengine/godot/xr/regular/RegularConfigChooser.java b/platform/android/java/lib/src/org/godotengine/godot/xr/regular/RegularConfigChooser.java index 445238b1c2..9834fdfb88 100644 --- a/platform/android/java/lib/src/org/godotengine/godot/xr/regular/RegularConfigChooser.java +++ b/platform/android/java/lib/src/org/godotengine/godot/xr/regular/RegularConfigChooser.java @@ -45,20 +45,18 @@ public class RegularConfigChooser implements GLSurfaceView.EGLConfigChooser { private int[] mValue = new int[1]; - // FIXME: Add support for Vulkan. - - /* This EGL config specification is used to specify 2.0 rendering. + /* This EGL config specification is used to specify 3.0 rendering. * We use a minimum size of 4 bits for red/green/blue, but will * perform actual matching in chooseConfig() below. */ private static int EGL_OPENGL_ES2_BIT = 4; - private static int[] s_configAttribs2 = { + private static int[] s_configAttribs = { EGL10.EGL_RED_SIZE, 4, EGL10.EGL_GREEN_SIZE, 4, EGL10.EGL_BLUE_SIZE, 4, - // EGL10.EGL_DEPTH_SIZE, 16, + // EGL10.EGL_DEPTH_SIZE, 16, // EGL10.EGL_STENCIL_SIZE, EGL10.EGL_DONT_CARE, - EGL10.EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT, + EGL10.EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT, //apparently there is no EGL_OPENGL_ES3_BIT EGL10.EGL_NONE }; @@ -75,7 +73,7 @@ public class RegularConfigChooser implements GLSurfaceView.EGLConfigChooser { /* Get the number of minimally matching EGL configurations */ int[] num_config = new int[1]; - egl.eglChooseConfig(display, s_configAttribs2, null, 0, num_config); + egl.eglChooseConfig(display, s_configAttribs, null, 0, num_config); int numConfigs = num_config[0]; @@ -86,7 +84,7 @@ public class RegularConfigChooser implements GLSurfaceView.EGLConfigChooser { /* Allocate then read the array of minimally matching EGL configs */ EGLConfig[] configs = new EGLConfig[numConfigs]; - egl.eglChooseConfig(display, s_configAttribs2, configs, numConfigs, num_config); + egl.eglChooseConfig(display, s_configAttribs, configs, numConfigs, num_config); if (GLUtils.DEBUG) { GLUtils.printConfigs(egl, display, configs); diff --git a/platform/android/java/lib/src/org/godotengine/godot/xr/regular/RegularContextFactory.java b/platform/android/java/lib/src/org/godotengine/godot/xr/regular/RegularContextFactory.java index 5d62723170..8fb86bf6d0 100644 --- a/platform/android/java/lib/src/org/godotengine/godot/xr/regular/RegularContextFactory.java +++ b/platform/android/java/lib/src/org/godotengine/godot/xr/regular/RegularContextFactory.java @@ -52,17 +52,16 @@ public class RegularContextFactory implements GLSurfaceView.EGLContextFactory { private static int EGL_CONTEXT_CLIENT_VERSION = 0x3098; public EGLContext createContext(EGL10 egl, EGLDisplay display, EGLConfig eglConfig) { - // FIXME: Add support for Vulkan. - Log.w(TAG, "creating OpenGL ES 2.0 context :"); + Log.w(TAG, "creating OpenGL ES 3.0 context :"); GLUtils.checkEglError(TAG, "Before eglCreateContext", egl); EGLContext context; if (GLUtils.use_debug_opengl) { - int[] attrib_list2 = { EGL_CONTEXT_CLIENT_VERSION, 2, _EGL_CONTEXT_FLAGS_KHR, _EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR, EGL10.EGL_NONE }; - context = egl.eglCreateContext(display, eglConfig, EGL10.EGL_NO_CONTEXT, attrib_list2); + int[] attrib_list = { EGL_CONTEXT_CLIENT_VERSION, 3, _EGL_CONTEXT_FLAGS_KHR, _EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR, EGL10.EGL_NONE }; + context = egl.eglCreateContext(display, eglConfig, EGL10.EGL_NO_CONTEXT, attrib_list); } else { - int[] attrib_list2 = { EGL_CONTEXT_CLIENT_VERSION, 2, EGL10.EGL_NONE }; - context = egl.eglCreateContext(display, eglConfig, EGL10.EGL_NO_CONTEXT, attrib_list2); + int[] attrib_list = { EGL_CONTEXT_CLIENT_VERSION, 3, EGL10.EGL_NONE }; + context = egl.eglCreateContext(display, eglConfig, EGL10.EGL_NO_CONTEXT, attrib_list); } GLUtils.checkEglError(TAG, "After eglCreateContext", egl); return context; diff --git a/platform/android/java/nativeSrcsConfigs/CMakeLists.txt b/platform/android/java/nativeSrcsConfigs/CMakeLists.txt index 711f7cd502..e1534c7685 100644 --- a/platform/android/java/nativeSrcsConfigs/CMakeLists.txt +++ b/platform/android/java/nativeSrcsConfigs/CMakeLists.txt @@ -17,4 +17,4 @@ target_include_directories(${PROJECT_NAME} SYSTEM PUBLIC ${GODOT_ROOT_DIR}) -add_definitions(-DUNIX_ENABLED -DVULKAN_ENABLED -DANDROID_ENABLED) +add_definitions(-DUNIX_ENABLED -DVULKAN_ENABLED -DANDROID_ENABLED -DGLES3_ENABLED -DTOOLS_ENABLED) diff --git a/platform/android/java_godot_view_wrapper.cpp b/platform/android/java_godot_view_wrapper.cpp index 378a467772..23cfc5f2e6 100644 --- a/platform/android/java_godot_view_wrapper.cpp +++ b/platform/android/java_godot_view_wrapper.cpp @@ -42,6 +42,7 @@ GodotJavaViewWrapper::GodotJavaViewWrapper(jobject godot_view) { int android_device_api_level = android_get_device_api_level(); if (android_device_api_level >= __ANDROID_API_N__) { + _configure_pointer_icon = env->GetMethodID(_cls, "configurePointerIcon", "(ILjava/lang/String;FF)V"); _set_pointer_icon = env->GetMethodID(_cls, "setPointerIcon", "(I)V"); } if (android_device_api_level >= __ANDROID_API_O__) { @@ -51,7 +52,7 @@ GodotJavaViewWrapper::GodotJavaViewWrapper(jobject godot_view) { } bool GodotJavaViewWrapper::can_update_pointer_icon() const { - return _set_pointer_icon != nullptr; + return _configure_pointer_icon != nullptr && _set_pointer_icon != nullptr; } bool GodotJavaViewWrapper::can_capture_pointer() const { @@ -76,6 +77,16 @@ void GodotJavaViewWrapper::release_pointer_capture() { } } +void GodotJavaViewWrapper::configure_pointer_icon(int pointer_type, const String &image_path, const Vector2 &p_hotspot) { + if (_configure_pointer_icon != nullptr) { + JNIEnv *env = get_jni_env(); + ERR_FAIL_NULL(env); + + jstring jImagePath = env->NewStringUTF(image_path.utf8().get_data()); + env->CallVoidMethod(_godot_view, _configure_pointer_icon, pointer_type, jImagePath, p_hotspot.x, p_hotspot.y); + } +} + void GodotJavaViewWrapper::set_pointer_icon(int pointer_type) { if (_set_pointer_icon != nullptr) { JNIEnv *env = get_jni_env(); diff --git a/platform/android/java_godot_view_wrapper.h b/platform/android/java_godot_view_wrapper.h index b398c73cac..b58a6607ce 100644 --- a/platform/android/java_godot_view_wrapper.h +++ b/platform/android/java_godot_view_wrapper.h @@ -31,6 +31,7 @@ #ifndef JAVA_GODOT_VIEW_WRAPPER_H #define JAVA_GODOT_VIEW_WRAPPER_H +#include "core/math/vector2.h" #include <android/log.h> #include <jni.h> @@ -45,6 +46,8 @@ private: jmethodID _request_pointer_capture = 0; jmethodID _release_pointer_capture = 0; + + jmethodID _configure_pointer_icon = 0; jmethodID _set_pointer_icon = 0; public: @@ -55,6 +58,8 @@ public: void request_pointer_capture(); void release_pointer_capture(); + + void configure_pointer_icon(int pointer_type, const String &image_path, const Vector2 &p_hotspot); void set_pointer_icon(int pointer_type); ~GodotJavaViewWrapper(); diff --git a/platform/android/os_android.cpp b/platform/android/os_android.cpp index 97fa90b1d2..317a63f21f 100644 --- a/platform/android/os_android.cpp +++ b/platform/android/os_android.cpp @@ -268,12 +268,16 @@ bool OS_Android::main_loop_iterate(bool *r_should_swap_buffers) { if (!main_loop) { return false; } + DisplayServerAndroid::get_singleton()->reset_swap_buffers_flag(); DisplayServerAndroid::get_singleton()->process_events(); uint64_t current_frames_drawn = Engine::get_singleton()->get_frames_drawn(); bool exit = Main::iteration(); if (r_should_swap_buffers) { - *r_should_swap_buffers = !is_in_low_processor_usage_mode() || RenderingServer::get_singleton()->has_changed() || current_frames_drawn != Engine::get_singleton()->get_frames_drawn(); + *r_should_swap_buffers = !is_in_low_processor_usage_mode() || + DisplayServerAndroid::get_singleton()->should_swap_buffers() || + RenderingServer::get_singleton()->has_changed() || + current_frames_drawn != Engine::get_singleton()->get_frames_drawn(); } return exit; @@ -333,6 +337,229 @@ String OS_Android::get_data_path() const { return get_user_data_dir(); } +void OS_Android::_load_system_font_config() { + font_aliases.clear(); + fonts.clear(); + font_names.clear(); + + Ref<XMLParser> parser; + parser.instantiate(); + + Error err = parser->open(String(getenv("ANDROID_ROOT")).path_join("/etc/fonts.xml")); + if (err == OK) { + bool in_font_node = false; + String fb, fn; + FontInfo fi; + + while (parser->read() == OK) { + if (parser->get_node_type() == XMLParser::NODE_ELEMENT) { + in_font_node = false; + if (parser->get_node_name() == "familyset") { + int ver = parser->has_attribute("version") ? parser->get_attribute_value("version").to_int() : 0; + if (ver < 21) { + ERR_PRINT(vformat("Unsupported font config version %s", ver)); + break; + } + } else if (parser->get_node_name() == "alias") { + String name = parser->has_attribute("name") ? parser->get_attribute_value("name").strip_edges() : String(); + String to = parser->has_attribute("to") ? parser->get_attribute_value("to").strip_edges() : String(); + if (!name.is_empty() && !to.is_empty()) { + font_aliases[name] = to; + } + } else if (parser->get_node_name() == "family") { + fn = parser->has_attribute("name") ? parser->get_attribute_value("name").strip_edges() : String(); + String lang_code = parser->has_attribute("lang") ? parser->get_attribute_value("lang").strip_edges() : String(); + Vector<String> lang_codes = lang_code.split(","); + for (int i = 0; i < lang_codes.size(); i++) { + Vector<String> lang_code_elements = lang_codes[i].split("-"); + if (lang_code_elements.size() >= 1 && lang_code_elements[0] != "und") { + // Add missing script codes. + if (lang_code_elements[0] == "ko") { + fi.script.insert("Hani"); + fi.script.insert("Hang"); + } + if (lang_code_elements[0] == "ja") { + fi.script.insert("Hani"); + fi.script.insert("Kana"); + fi.script.insert("Hira"); + } + if (!lang_code_elements[0].is_empty()) { + fi.lang.insert(lang_code_elements[0]); + } + } + if (lang_code_elements.size() >= 2) { + // Add common codes for variants and remove variants not supported by HarfBuzz/ICU. + if (lang_code_elements[1] == "Aran") { + fi.script.insert("Arab"); + } + if (lang_code_elements[1] == "Cyrs") { + fi.script.insert("Cyrl"); + } + if (lang_code_elements[1] == "Hanb") { + fi.script.insert("Hani"); + fi.script.insert("Bopo"); + } + if (lang_code_elements[1] == "Hans" || lang_code_elements[1] == "Hant") { + fi.script.insert("Hani"); + } + if (lang_code_elements[1] == "Syrj" || lang_code_elements[1] == "Syre" || lang_code_elements[1] == "Syrn") { + fi.script.insert("Syrc"); + } + if (!lang_code_elements[1].is_empty() && lang_code_elements[1] != "Zsym" && lang_code_elements[1] != "Zsye" && lang_code_elements[1] != "Zmth") { + fi.script.insert(lang_code_elements[1]); + } + } + } + } else if (parser->get_node_name() == "font") { + in_font_node = true; + fb = parser->has_attribute("fallbackFor") ? parser->get_attribute_value("fallbackFor").strip_edges() : String(); + fi.weight = parser->has_attribute("weight") ? parser->get_attribute_value("weight").to_int() : 400; + fi.italic = parser->has_attribute("style") && parser->get_attribute_value("style").strip_edges() == "italic"; + } + } + if (parser->get_node_type() == XMLParser::NODE_TEXT) { + if (in_font_node) { + fi.filename = parser->get_node_data().strip_edges(); + fi.font_name = fn; + if (!fb.is_empty() && fn.is_empty()) { + fi.font_name = fb; + fi.priority = 2; + } + if (fi.font_name.is_empty()) { + fi.font_name = "sans-serif"; + fi.priority = 5; + } + if (fi.font_name.ends_with("-condensed")) { + fi.stretch = 75; + fi.font_name = fi.font_name.trim_suffix("-condensed"); + } + fonts.push_back(fi); + font_names.insert(fi.font_name); + } + } + if (parser->get_node_type() == XMLParser::NODE_ELEMENT_END) { + in_font_node = false; + if (parser->get_node_name() == "font") { + fb = String(); + fi.font_name = String(); + fi.priority = 0; + fi.weight = 400; + fi.stretch = 100; + fi.italic = false; + } else if (parser->get_node_name() == "family") { + fi = FontInfo(); + fn = String(); + } + } + } + parser->close(); + } else { + ERR_PRINT("Unable to load font config"); + } + + font_config_loaded = true; +} + +Vector<String> OS_Android::get_system_fonts() const { + if (!font_config_loaded) { + const_cast<OS_Android *>(this)->_load_system_font_config(); + } + Vector<String> ret; + for (const String &E : font_names) { + ret.push_back(E); + } + return ret; +} + +Vector<String> OS_Android::get_system_font_path_for_text(const String &p_font_name, const String &p_text, const String &p_locale, const String &p_script, int p_weight, int p_stretch, bool p_italic) const { + if (!font_config_loaded) { + const_cast<OS_Android *>(this)->_load_system_font_config(); + } + String font_name = p_font_name.to_lower(); + if (font_aliases.has(font_name)) { + font_name = font_aliases[font_name]; + } + String root = String(getenv("ANDROID_ROOT")).path_join("fonts"); + String lang_prefix = p_locale.split("_")[0]; + Vector<String> ret; + int best_score = 0; + for (const List<FontInfo>::Element *E = fonts.front(); E; E = E->next()) { + int score = 0; + if (!E->get().script.is_empty() && !p_script.is_empty() && !E->get().script.has(p_script)) { + continue; + } + float sim = E->get().font_name.similarity(font_name); + if (sim > 0.0) { + score += (60 * sim + 5 - E->get().priority); + } + if (E->get().lang.has(p_locale)) { + score += 120; + } else if (E->get().lang.has(lang_prefix)) { + score += 115; + } + if (E->get().script.has(p_script)) { + score += 240; + } + score += (20 - Math::abs(E->get().weight - p_weight) / 50); + score += (20 - Math::abs(E->get().stretch - p_stretch) / 10); + if (E->get().italic == p_italic) { + score += 30; + } + if (score > best_score) { + best_score = score; + if (ret.find(root.path_join(E->get().filename)) < 0) { + ret.insert(0, root.path_join(E->get().filename)); + } + } else if (score == best_score || E->get().script.is_empty()) { + if (ret.find(root.path_join(E->get().filename)) < 0) { + ret.push_back(root.path_join(E->get().filename)); + } + } + if (score >= 490) { + break; // Perfect match. + } + } + + return ret; +} + +String OS_Android::get_system_font_path(const String &p_font_name, int p_weight, int p_stretch, bool p_italic) const { + if (!font_config_loaded) { + const_cast<OS_Android *>(this)->_load_system_font_config(); + } + String font_name = p_font_name.to_lower(); + if (font_aliases.has(font_name)) { + font_name = font_aliases[font_name]; + } + String root = String(getenv("ANDROID_ROOT")).path_join("fonts"); + + int best_score = 0; + const List<FontInfo>::Element *best_match = nullptr; + + for (const List<FontInfo>::Element *E = fonts.front(); E; E = E->next()) { + int score = 0; + if (E->get().font_name == font_name) { + score += (65 - E->get().priority); + } + score += (20 - Math::abs(E->get().weight - p_weight) / 50); + score += (20 - Math::abs(E->get().stretch - p_stretch) / 10); + if (E->get().italic == p_italic) { + score += 30; + } + if (score >= 60 && score > best_score) { + best_score = score; + best_match = E; + } + if (score >= 140) { + break; // Perfect match. + } + } + if (best_match) { + return root.path_join(best_match->get().filename); + } + return String(); +} + String OS_Android::get_executable_path() const { // Since unix process creation is restricted on Android, we bypass // OS_Unix::get_executable_path() so we can return ANDROID_EXEC_PATH. @@ -445,6 +672,9 @@ String OS_Android::get_config_path() const { } bool OS_Android::_check_internal_feature_support(const String &p_feature) { + if (p_feature == "system_fonts") { + return true; + } if (p_feature == "mobile") { return true; } @@ -474,7 +704,6 @@ OS_Android::OS_Android(GodotJavaWrapper *p_godot_java, GodotIOJavaWrapper *p_god #if defined(GLES3_ENABLED) gl_extensions = nullptr; - use_gl2 = false; #endif #if defined(VULKAN_ENABLED) diff --git a/platform/android/os_android.h b/platform/android/os_android.h index d6546a3507..9034615fc4 100644 --- a/platform/android/os_android.h +++ b/platform/android/os_android.h @@ -62,9 +62,26 @@ private: MainLoop *main_loop = nullptr; + struct FontInfo { + String font_name; + HashSet<String> lang; + HashSet<String> script; + int weight = 400; + int stretch = 100; + bool italic = false; + int priority = 0; + String filename; + }; + + HashMap<String, String> font_aliases; + List<FontInfo> fonts; + HashSet<String> font_names; + bool font_config_loaded = false; + GodotJavaWrapper *godot_java = nullptr; GodotIOJavaWrapper *godot_io_java = nullptr; + void _load_system_font_config(); String get_system_property(const char *key) const; public: @@ -114,6 +131,10 @@ public: ANativeWindow *get_native_window() const; virtual Error shell_open(String p_uri) override; + + virtual Vector<String> get_system_fonts() const override; + virtual String get_system_font_path(const String &p_font_name, int p_weight = 400, int p_stretch = 100, bool p_italic = false) const override; + virtual Vector<String> get_system_font_path_for_text(const String &p_font_name, const String &p_text, const String &p_locale = String(), const String &p_script = String(), int p_weight = 400, int p_stretch = 100, bool p_italic = false) const override; virtual String get_executable_path() const override; virtual String get_user_data_dir() const override; virtual String get_data_path() const override; diff --git a/platform/ios/app_delegate.mm b/platform/ios/app_delegate.mm index fb183d52d4..3ebd530585 100644 --- a/platform/ios/app_delegate.mm +++ b/platform/ios/app_delegate.mm @@ -45,7 +45,7 @@ extern int gargc; extern char **gargv; -extern int ios_main(int, char **, String, String); +extern int ios_main(int, char **); extern void ios_finish(); @implementation AppDelegate @@ -66,12 +66,7 @@ static ViewController *mainViewController = nil; // Create a full-screen window self.window = [[UIWindow alloc] initWithFrame:windowBounds]; - NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); - NSString *documentsDirectory = [paths objectAtIndex:0]; - paths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES); - NSString *cacheDirectory = [paths objectAtIndex:0]; - - int err = ios_main(gargc, gargv, String::utf8([documentsDirectory UTF8String]), String::utf8([cacheDirectory UTF8String])); + int err = ios_main(gargc, gargv); if (err != 0) { // bail, things did not go very well for us, should probably output a message on screen with our error code... diff --git a/platform/ios/godot_ios.mm b/platform/ios/godot_ios.mm index 5f3e786b8a..abe7c59ce2 100644 --- a/platform/ios/godot_ios.mm +++ b/platform/ios/godot_ios.mm @@ -38,10 +38,6 @@ static OS_IOS *os = nullptr; -int add_path(int, char **); -int add_cmdline(int, char **); -int ios_main(int, char **, String); - int add_path(int p_argc, char **p_args) { NSString *str = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"godot_path"]; if (!str) { @@ -74,7 +70,7 @@ int add_cmdline(int p_argc, char **p_args) { return p_argc; } -int ios_main(int argc, char **argv, String data_dir, String cache_dir) { +int ios_main(int argc, char **argv) { size_t len = strlen(argv[0]); while (len--) { @@ -95,7 +91,7 @@ int ios_main(int argc, char **argv, String data_dir, String cache_dir) { char cwd[512]; getcwd(cwd, sizeof(cwd)); printf("cwd %s\n", cwd); - os = new OS_IOS(data_dir, cache_dir); + os = new OS_IOS(); // We must override main when testing is enabled TEST_MAIN_OVERRIDE diff --git a/platform/ios/os_ios.h b/platform/ios/os_ios.h index 400040875f..186efd14a8 100644 --- a/platform/ios/os_ios.h +++ b/platform/ios/os_ios.h @@ -71,17 +71,18 @@ private: virtual void finalize() override; - String user_data_dir; - String cache_dir; - bool is_focused = false; + CGFloat _weight_to_ct(int p_weight) const; + CGFloat _stretch_to_ct(int p_stretch) const; + String _get_default_fontname(const String &p_font_name) const; + void deinitialize_modules(); public: static OS_IOS *get_singleton(); - OS_IOS(String p_data_dir, String p_cache_dir); + OS_IOS(); ~OS_IOS(); void initialize_modules(); @@ -93,7 +94,8 @@ public: virtual void alert(const String &p_alert, const String &p_title = "ALERT!") override; virtual Vector<String> get_system_fonts() const override; - virtual String get_system_font_path(const String &p_font_name, bool p_bold = false, bool p_italic = false) const override; + virtual Vector<String> get_system_font_path_for_text(const String &p_font_name, const String &p_text, const String &p_locale = String(), const String &p_script = String(), int p_weight = 400, int p_stretch = 100, bool p_italic = false) const override; + virtual String get_system_font_path(const String &p_font_name, int p_weight = 400, int p_stretch = 100, bool p_italic = false) const override; virtual Error open_dynamic_library(const String p_path, void *&p_library_handle, bool p_also_set_library_path = false, String *r_resolved_path = nullptr) override; virtual Error close_dynamic_library(void *p_library_handle) override; @@ -106,7 +108,6 @@ public: virtual Error shell_open(String p_uri) override; - void set_user_data_dir(String p_dir); virtual String get_user_data_dir() const override; virtual String get_cache_path() const override; diff --git a/platform/ios/os_ios.mm b/platform/ios/os_ios.mm index b6b94d2f5e..9617627b6f 100644 --- a/platform/ios/os_ios.mm +++ b/platform/ios/os_ios.mm @@ -90,7 +90,7 @@ OS_IOS *OS_IOS::get_singleton() { return (OS_IOS *)OS::get_singleton(); } -OS_IOS::OS_IOS(String p_data_dir, String p_cache_dir) { +OS_IOS::OS_IOS() { for (int i = 0; i < ios_init_callbacks_count; ++i) { ios_init_callbacks[i](); } @@ -101,11 +101,6 @@ OS_IOS::OS_IOS(String p_data_dir, String p_cache_dir) { main_loop = nullptr; - // can't call set_data_dir from here, since it requires DirAccess - // which is initialized in initialize_core - user_data_dir = p_data_dir; - cache_dir = p_cache_dir; - Vector<Logger *> loggers; loggers.push_back(memnew(SyslogLogger)); #ifdef DEBUG_ENABLED @@ -130,8 +125,6 @@ void OS_IOS::alert(const String &p_alert, const String &p_title) { void OS_IOS::initialize_core() { OS_Unix::initialize_core(); - - set_user_data_dir(user_data_dir); } void OS_IOS::initialize() { @@ -273,18 +266,26 @@ Error OS_IOS::shell_open(String p_uri) { return OK; } -void OS_IOS::set_user_data_dir(String p_dir) { - Ref<DirAccess> da = DirAccess::open(p_dir); - user_data_dir = da->get_current_dir(); - printf("setting data dir to %s from %s\n", user_data_dir.utf8().get_data(), p_dir.utf8().get_data()); -} - String OS_IOS::get_user_data_dir() const { - return user_data_dir; + static String ret; + if (ret.is_empty()) { + NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); + if (paths && [paths count] >= 1) { + ret.parse_utf8([[paths firstObject] UTF8String]); + } + } + return ret; } String OS_IOS::get_cache_path() const { - return cache_dir; + static String ret; + if (ret.is_empty()) { + NSArray *paths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES); + if (paths && [paths count] >= 1) { + ret.parse_utf8([[paths firstObject] UTF8String]); + } + } + return ret; } String OS_IOS::get_locale() const { @@ -333,9 +334,7 @@ Vector<String> OS_IOS::get_system_fonts() const { return ret; } -String OS_IOS::get_system_font_path(const String &p_font_name, bool p_bold, bool p_italic) const { - String ret; - +String OS_IOS::_get_default_fontname(const String &p_font_name) const { String font_name = p_font_name; if (font_name.to_lower() == "sans-serif") { font_name = "Helvetica"; @@ -348,21 +347,153 @@ String OS_IOS::get_system_font_path(const String &p_font_name, bool p_bold, bool } else if (font_name.to_lower() == "cursive") { font_name = "Apple Chancery"; }; + return font_name; +} + +CGFloat OS_IOS::_weight_to_ct(int p_weight) const { + if (p_weight < 150) { + return -0.80; + } else if (p_weight < 250) { + return -0.60; + } else if (p_weight < 350) { + return -0.40; + } else if (p_weight < 450) { + return 0.0; + } else if (p_weight < 550) { + return 0.23; + } else if (p_weight < 650) { + return 0.30; + } else if (p_weight < 750) { + return 0.40; + } else if (p_weight < 850) { + return 0.56; + } else if (p_weight < 925) { + return 0.62; + } else { + return 1.00; + } +} + +CGFloat OS_IOS::_stretch_to_ct(int p_stretch) const { + if (p_stretch < 56) { + return -0.5; + } else if (p_stretch < 69) { + return -0.37; + } else if (p_stretch < 81) { + return -0.25; + } else if (p_stretch < 93) { + return -0.13; + } else if (p_stretch < 106) { + return 0.0; + } else if (p_stretch < 137) { + return 0.13; + } else if (p_stretch < 144) { + return 0.25; + } else if (p_stretch < 162) { + return 0.37; + } else { + return 0.5; + } +} + +Vector<String> OS_IOS::get_system_font_path_for_text(const String &p_font_name, const String &p_text, const String &p_locale, const String &p_script, int p_weight, int p_stretch, bool p_italic) const { + Vector<String> ret; + String font_name = _get_default_fontname(p_font_name); + + CFStringRef name = CFStringCreateWithCString(kCFAllocatorDefault, font_name.utf8().get_data(), kCFStringEncodingUTF8); + CTFontSymbolicTraits traits = 0; + if (p_weight >= 700) { + traits |= kCTFontBoldTrait; + } + if (p_italic) { + traits |= kCTFontItalicTrait; + } + if (p_stretch < 100) { + traits |= kCTFontCondensedTrait; + } else if (p_stretch > 100) { + traits |= kCTFontExpandedTrait; + } + + CFNumberRef sym_traits = CFNumberCreate(kCFAllocatorDefault, kCFNumberSInt32Type, &traits); + CFMutableDictionaryRef traits_dict = CFDictionaryCreateMutable(kCFAllocatorDefault, 0, nullptr, nullptr); + CFDictionaryAddValue(traits_dict, kCTFontSymbolicTrait, sym_traits); + + CGFloat weight = _weight_to_ct(p_weight); + CFNumberRef font_weight = CFNumberCreate(kCFAllocatorDefault, kCFNumberCGFloatType, &weight); + CFDictionaryAddValue(traits_dict, kCTFontWeightTrait, font_weight); + + CGFloat stretch = _stretch_to_ct(p_stretch); + CFNumberRef font_stretch = CFNumberCreate(kCFAllocatorDefault, kCFNumberCGFloatType, &stretch); + CFDictionaryAddValue(traits_dict, kCTFontWidthTrait, font_stretch); + + CFMutableDictionaryRef attributes = CFDictionaryCreateMutable(kCFAllocatorDefault, 0, nullptr, nullptr); + CFDictionaryAddValue(attributes, kCTFontFamilyNameAttribute, name); + CFDictionaryAddValue(attributes, kCTFontTraitsAttribute, traits_dict); + + CTFontDescriptorRef font = CTFontDescriptorCreateWithAttributes(attributes); + if (font) { + CTFontRef family = CTFontCreateWithFontDescriptor(font, 0, nullptr); + CFStringRef string = CFStringCreateWithCString(kCFAllocatorDefault, p_text.utf8().get_data(), kCFStringEncodingUTF8); + CFRange range = CFRangeMake(0, CFStringGetLength(string)); + CTFontRef fallback_family = CTFontCreateForString(family, string, range); + if (fallback_family) { + CTFontDescriptorRef fallback_font = CTFontCopyFontDescriptor(fallback_family); + if (fallback_font) { + CFURLRef url = (CFURLRef)CTFontDescriptorCopyAttribute(fallback_font, kCTFontURLAttribute); + if (url) { + NSString *font_path = [NSString stringWithString:[(__bridge NSURL *)url path]]; + ret.push_back(String::utf8([font_path UTF8String])); + CFRelease(url); + } + CFRelease(fallback_font); + } + CFRelease(fallback_family); + } + CFRelease(string); + CFRelease(font); + } + + CFRelease(attributes); + CFRelease(traits_dict); + CFRelease(sym_traits); + CFRelease(font_stretch); + CFRelease(font_weight); + CFRelease(name); + + return ret; +} + +String OS_IOS::get_system_font_path(const String &p_font_name, int p_weight, int p_stretch, bool p_italic) const { + String ret; + String font_name = _get_default_fontname(p_font_name); CFStringRef name = CFStringCreateWithCString(kCFAllocatorDefault, font_name.utf8().get_data(), kCFStringEncodingUTF8); CTFontSymbolicTraits traits = 0; - if (p_bold) { + if (p_weight >= 700) { traits |= kCTFontBoldTrait; } if (p_italic) { traits |= kCTFontItalicTrait; } + if (p_stretch < 100) { + traits |= kCTFontCondensedTrait; + } else if (p_stretch > 100) { + traits |= kCTFontExpandedTrait; + } CFNumberRef sym_traits = CFNumberCreate(kCFAllocatorDefault, kCFNumberSInt32Type, &traits); CFMutableDictionaryRef traits_dict = CFDictionaryCreateMutable(kCFAllocatorDefault, 0, nullptr, nullptr); CFDictionaryAddValue(traits_dict, kCTFontSymbolicTrait, sym_traits); + CGFloat weight = _weight_to_ct(p_weight); + CFNumberRef font_weight = CFNumberCreate(kCFAllocatorDefault, kCFNumberCGFloatType, &weight); + CFDictionaryAddValue(traits_dict, kCTFontWeightTrait, font_weight); + + CGFloat stretch = _stretch_to_ct(p_stretch); + CFNumberRef font_stretch = CFNumberCreate(kCFAllocatorDefault, kCFNumberCGFloatType, &stretch); + CFDictionaryAddValue(traits_dict, kCTFontWidthTrait, font_stretch); + CFMutableDictionaryRef attributes = CFDictionaryCreateMutable(kCFAllocatorDefault, 0, nullptr, nullptr); CFDictionaryAddValue(attributes, kCTFontFamilyNameAttribute, name); CFDictionaryAddValue(attributes, kCTFontTraitsAttribute, traits_dict); @@ -381,6 +512,8 @@ String OS_IOS::get_system_font_path(const String &p_font_name, bool p_bold, bool CFRelease(attributes); CFRelease(traits_dict); CFRelease(sym_traits); + CFRelease(font_stretch); + CFRelease(font_weight); CFRelease(name); return ret; diff --git a/platform/linuxbsd/detect.py b/platform/linuxbsd/detect.py index 004bcb8674..844b15e9fb 100644 --- a/platform/linuxbsd/detect.py +++ b/platform/linuxbsd/detect.py @@ -184,13 +184,14 @@ def configure(env: "Environment"): ## Dependencies if env["x11"]: - env.ParseConfig("pkg-config x11 --cflags --libs") - env.ParseConfig("pkg-config xcursor --cflags --libs") - env.ParseConfig("pkg-config xinerama --cflags --libs") - env.ParseConfig("pkg-config xext --cflags --libs") - env.ParseConfig("pkg-config xrandr --cflags --libs") - env.ParseConfig("pkg-config xrender --cflags --libs") - env.ParseConfig("pkg-config xi --cflags --libs") + # Only cflags, we dlopen the libraries. + env.ParseConfig("pkg-config x11 --cflags") + env.ParseConfig("pkg-config xcursor --cflags") + env.ParseConfig("pkg-config xinerama --cflags") + env.ParseConfig("pkg-config xext --cflags") + env.ParseConfig("pkg-config xrandr --cflags") + env.ParseConfig("pkg-config xrender --cflags") + env.ParseConfig("pkg-config xi --cflags") if env["touch"]: env.Append(CPPDEFINES=["TOUCH_ENABLED"]) diff --git a/platform/linuxbsd/fontconfig-so_wrap.c b/platform/linuxbsd/fontconfig-so_wrap.c index 1a915faf98..a428cf1fb4 100644 --- a/platform/linuxbsd/fontconfig-so_wrap.c +++ b/platform/linuxbsd/fontconfig-so_wrap.c @@ -1,7 +1,7 @@ // This file is generated. Do not edit! // see https://github.com/hpvb/dynload-wrapper for details -// generated by ./generate-wrapper.py 0.3 on 2022-07-29 05:40:07 -// flags: ./generate-wrapper.py --include /usr/include/fontconfig/fontconfig.h --sys-include <fontconfig/fontconfig.h> --soname libfontconfig.so --init-name fontconfig --output-header fontconfig-so_wrap.h --output-implementation fontconfig-so_wrap.c --omit-prefix FcCharSet +// generated by ./generate-wrapper.py 0.3 on 2022-11-22 10:28:00 +// flags: ./generate-wrapper.py --include /usr/include/fontconfig/fontconfig.h --sys-include <fontconfig/fontconfig.h> --soname libfontconfig.so --init-name fontconfig --output-header fontconfig-so_wrap.h --output-implementation fontconfig-so_wrap.c --omit-prefix FcCharSetFirst --omit-prefix FcCharSetNext // #include <stdint.h> @@ -18,6 +18,8 @@ #define FcDirCacheValid FcDirCacheValid_dylibloader_orig_fontconfig #define FcDirCacheClean FcDirCacheClean_dylibloader_orig_fontconfig #define FcCacheCreateTagFile FcCacheCreateTagFile_dylibloader_orig_fontconfig +#define FcDirCacheCreateUUID FcDirCacheCreateUUID_dylibloader_orig_fontconfig +#define FcDirCacheDeleteUUID FcDirCacheDeleteUUID_dylibloader_orig_fontconfig #define FcConfigHome FcConfigHome_dylibloader_orig_fontconfig #define FcConfigEnableHome FcConfigEnableHome_dylibloader_orig_fontconfig #define FcConfigFilename FcConfigFilename_dylibloader_orig_fontconfig @@ -44,6 +46,26 @@ #define FcConfigSubstitute FcConfigSubstitute_dylibloader_orig_fontconfig #define FcConfigGetSysRoot FcConfigGetSysRoot_dylibloader_orig_fontconfig #define FcConfigSetSysRoot FcConfigSetSysRoot_dylibloader_orig_fontconfig +#define FcConfigFileInfoIterInit FcConfigFileInfoIterInit_dylibloader_orig_fontconfig +#define FcConfigFileInfoIterNext FcConfigFileInfoIterNext_dylibloader_orig_fontconfig +#define FcConfigFileInfoIterGet FcConfigFileInfoIterGet_dylibloader_orig_fontconfig +#define FcCharSetCreate FcCharSetCreate_dylibloader_orig_fontconfig +#define FcCharSetNew FcCharSetNew_dylibloader_orig_fontconfig +#define FcCharSetDestroy FcCharSetDestroy_dylibloader_orig_fontconfig +#define FcCharSetAddChar FcCharSetAddChar_dylibloader_orig_fontconfig +#define FcCharSetDelChar FcCharSetDelChar_dylibloader_orig_fontconfig +#define FcCharSetCopy FcCharSetCopy_dylibloader_orig_fontconfig +#define FcCharSetEqual FcCharSetEqual_dylibloader_orig_fontconfig +#define FcCharSetIntersect FcCharSetIntersect_dylibloader_orig_fontconfig +#define FcCharSetUnion FcCharSetUnion_dylibloader_orig_fontconfig +#define FcCharSetSubtract FcCharSetSubtract_dylibloader_orig_fontconfig +#define FcCharSetMerge FcCharSetMerge_dylibloader_orig_fontconfig +#define FcCharSetHasChar FcCharSetHasChar_dylibloader_orig_fontconfig +#define FcCharSetCount FcCharSetCount_dylibloader_orig_fontconfig +#define FcCharSetIntersectCount FcCharSetIntersectCount_dylibloader_orig_fontconfig +#define FcCharSetSubtractCount FcCharSetSubtractCount_dylibloader_orig_fontconfig +#define FcCharSetIsSubset FcCharSetIsSubset_dylibloader_orig_fontconfig +#define FcCharSetCoverage FcCharSetCoverage_dylibloader_orig_fontconfig #define FcValuePrint FcValuePrint_dylibloader_orig_fontconfig #define FcPatternPrint FcPatternPrint_dylibloader_orig_fontconfig #define FcFontSetPrint FcFontSetPrint_dylibloader_orig_fontconfig @@ -59,6 +81,7 @@ #define FcDirCacheLoadFile FcDirCacheLoadFile_dylibloader_orig_fontconfig #define FcDirCacheUnload FcDirCacheUnload_dylibloader_orig_fontconfig #define FcFreeTypeQuery FcFreeTypeQuery_dylibloader_orig_fontconfig +#define FcFreeTypeQueryAll FcFreeTypeQueryAll_dylibloader_orig_fontconfig #define FcFontSetCreate FcFontSetCreate_dylibloader_orig_fontconfig #define FcFontSetDestroy FcFontSetDestroy_dylibloader_orig_fontconfig #define FcFontSetAdd FcFontSetAdd_dylibloader_orig_fontconfig @@ -129,6 +152,7 @@ #define FcValueEqual FcValueEqual_dylibloader_orig_fontconfig #define FcValueSave FcValueSave_dylibloader_orig_fontconfig #define FcPatternDestroy FcPatternDestroy_dylibloader_orig_fontconfig +#define FcPatternObjectCount FcPatternObjectCount_dylibloader_orig_fontconfig #define FcPatternEqual FcPatternEqual_dylibloader_orig_fontconfig #define FcPatternEqualSubset FcPatternEqualSubset_dylibloader_orig_fontconfig #define FcPatternHash FcPatternHash_dylibloader_orig_fontconfig @@ -162,8 +186,18 @@ #define FcRangeDestroy FcRangeDestroy_dylibloader_orig_fontconfig #define FcRangeCopy FcRangeCopy_dylibloader_orig_fontconfig #define FcRangeGetDouble FcRangeGetDouble_dylibloader_orig_fontconfig +#define FcPatternIterStart FcPatternIterStart_dylibloader_orig_fontconfig +#define FcPatternIterNext FcPatternIterNext_dylibloader_orig_fontconfig +#define FcPatternIterEqual FcPatternIterEqual_dylibloader_orig_fontconfig +#define FcPatternFindIter FcPatternFindIter_dylibloader_orig_fontconfig +#define FcPatternIterIsValid FcPatternIterIsValid_dylibloader_orig_fontconfig +#define FcPatternIterGetObject FcPatternIterGetObject_dylibloader_orig_fontconfig +#define FcPatternIterValueCount FcPatternIterValueCount_dylibloader_orig_fontconfig +#define FcPatternIterGetValue FcPatternIterGetValue_dylibloader_orig_fontconfig #define FcWeightFromOpenType FcWeightFromOpenType_dylibloader_orig_fontconfig +#define FcWeightFromOpenTypeDouble FcWeightFromOpenTypeDouble_dylibloader_orig_fontconfig #define FcWeightToOpenType FcWeightToOpenType_dylibloader_orig_fontconfig +#define FcWeightToOpenTypeDouble FcWeightToOpenTypeDouble_dylibloader_orig_fontconfig #define FcStrCopy FcStrCopy_dylibloader_orig_fontconfig #define FcStrCopyFilename FcStrCopyFilename_dylibloader_orig_fontconfig #define FcStrPlus FcStrPlus_dylibloader_orig_fontconfig @@ -207,6 +241,8 @@ #undef FcDirCacheValid #undef FcDirCacheClean #undef FcCacheCreateTagFile +#undef FcDirCacheCreateUUID +#undef FcDirCacheDeleteUUID #undef FcConfigHome #undef FcConfigEnableHome #undef FcConfigFilename @@ -233,6 +269,26 @@ #undef FcConfigSubstitute #undef FcConfigGetSysRoot #undef FcConfigSetSysRoot +#undef FcConfigFileInfoIterInit +#undef FcConfigFileInfoIterNext +#undef FcConfigFileInfoIterGet +#undef FcCharSetCreate +#undef FcCharSetNew +#undef FcCharSetDestroy +#undef FcCharSetAddChar +#undef FcCharSetDelChar +#undef FcCharSetCopy +#undef FcCharSetEqual +#undef FcCharSetIntersect +#undef FcCharSetUnion +#undef FcCharSetSubtract +#undef FcCharSetMerge +#undef FcCharSetHasChar +#undef FcCharSetCount +#undef FcCharSetIntersectCount +#undef FcCharSetSubtractCount +#undef FcCharSetIsSubset +#undef FcCharSetCoverage #undef FcValuePrint #undef FcPatternPrint #undef FcFontSetPrint @@ -248,6 +304,7 @@ #undef FcDirCacheLoadFile #undef FcDirCacheUnload #undef FcFreeTypeQuery +#undef FcFreeTypeQueryAll #undef FcFontSetCreate #undef FcFontSetDestroy #undef FcFontSetAdd @@ -318,6 +375,7 @@ #undef FcValueEqual #undef FcValueSave #undef FcPatternDestroy +#undef FcPatternObjectCount #undef FcPatternEqual #undef FcPatternEqualSubset #undef FcPatternHash @@ -351,8 +409,18 @@ #undef FcRangeDestroy #undef FcRangeCopy #undef FcRangeGetDouble +#undef FcPatternIterStart +#undef FcPatternIterNext +#undef FcPatternIterEqual +#undef FcPatternFindIter +#undef FcPatternIterIsValid +#undef FcPatternIterGetObject +#undef FcPatternIterValueCount +#undef FcPatternIterGetValue #undef FcWeightFromOpenType +#undef FcWeightFromOpenTypeDouble #undef FcWeightToOpenType +#undef FcWeightToOpenTypeDouble #undef FcStrCopy #undef FcStrCopyFilename #undef FcStrPlus @@ -397,6 +465,8 @@ FcBool (*FcDirCacheUnlink_dylibloader_wrapper_fontconfig)(const FcChar8*, FcConf FcBool (*FcDirCacheValid_dylibloader_wrapper_fontconfig)(const FcChar8*); FcBool (*FcDirCacheClean_dylibloader_wrapper_fontconfig)(const FcChar8*, FcBool); void (*FcCacheCreateTagFile_dylibloader_wrapper_fontconfig)(const FcConfig*); +FcBool (*FcDirCacheCreateUUID_dylibloader_wrapper_fontconfig)( FcChar8*, FcBool, FcConfig*); +FcBool (*FcDirCacheDeleteUUID_dylibloader_wrapper_fontconfig)(const FcChar8*, FcConfig*); FcChar8* (*FcConfigHome_dylibloader_wrapper_fontconfig)( void); FcBool (*FcConfigEnableHome_dylibloader_wrapper_fontconfig)( FcBool); FcChar8* (*FcConfigFilename_dylibloader_wrapper_fontconfig)(const FcChar8*); @@ -423,6 +493,26 @@ FcBool (*FcConfigSubstituteWithPat_dylibloader_wrapper_fontconfig)( FcConfig*, F FcBool (*FcConfigSubstitute_dylibloader_wrapper_fontconfig)( FcConfig*, FcPattern*, FcMatchKind); const FcChar8* (*FcConfigGetSysRoot_dylibloader_wrapper_fontconfig)(const FcConfig*); void (*FcConfigSetSysRoot_dylibloader_wrapper_fontconfig)( FcConfig*,const FcChar8*); +void (*FcConfigFileInfoIterInit_dylibloader_wrapper_fontconfig)( FcConfig*, FcConfigFileInfoIter*); +FcBool (*FcConfigFileInfoIterNext_dylibloader_wrapper_fontconfig)( FcConfig*, FcConfigFileInfoIter*); +FcBool (*FcConfigFileInfoIterGet_dylibloader_wrapper_fontconfig)( FcConfig*, FcConfigFileInfoIter*, FcChar8**, FcChar8**, FcBool*); +FcCharSet* (*FcCharSetCreate_dylibloader_wrapper_fontconfig)( void); +FcCharSet* (*FcCharSetNew_dylibloader_wrapper_fontconfig)( void); +void (*FcCharSetDestroy_dylibloader_wrapper_fontconfig)( FcCharSet*); +FcBool (*FcCharSetAddChar_dylibloader_wrapper_fontconfig)( FcCharSet*, FcChar32); +FcBool (*FcCharSetDelChar_dylibloader_wrapper_fontconfig)( FcCharSet*, FcChar32); +FcCharSet* (*FcCharSetCopy_dylibloader_wrapper_fontconfig)( FcCharSet*); +FcBool (*FcCharSetEqual_dylibloader_wrapper_fontconfig)(const FcCharSet*,const FcCharSet*); +FcCharSet* (*FcCharSetIntersect_dylibloader_wrapper_fontconfig)(const FcCharSet*,const FcCharSet*); +FcCharSet* (*FcCharSetUnion_dylibloader_wrapper_fontconfig)(const FcCharSet*,const FcCharSet*); +FcCharSet* (*FcCharSetSubtract_dylibloader_wrapper_fontconfig)(const FcCharSet*,const FcCharSet*); +FcBool (*FcCharSetMerge_dylibloader_wrapper_fontconfig)( FcCharSet*,const FcCharSet*, FcBool*); +FcBool (*FcCharSetHasChar_dylibloader_wrapper_fontconfig)(const FcCharSet*, FcChar32); +FcChar32 (*FcCharSetCount_dylibloader_wrapper_fontconfig)(const FcCharSet*); +FcChar32 (*FcCharSetIntersectCount_dylibloader_wrapper_fontconfig)(const FcCharSet*,const FcCharSet*); +FcChar32 (*FcCharSetSubtractCount_dylibloader_wrapper_fontconfig)(const FcCharSet*,const FcCharSet*); +FcBool (*FcCharSetIsSubset_dylibloader_wrapper_fontconfig)(const FcCharSet*,const FcCharSet*); +FcChar32 (*FcCharSetCoverage_dylibloader_wrapper_fontconfig)(const FcCharSet*, FcChar32, FcChar32*); void (*FcValuePrint_dylibloader_wrapper_fontconfig)(const FcValue); void (*FcPatternPrint_dylibloader_wrapper_fontconfig)(const FcPattern*); void (*FcFontSetPrint_dylibloader_wrapper_fontconfig)(const FcFontSet*); @@ -437,7 +527,8 @@ FcCache* (*FcDirCacheRescan_dylibloader_wrapper_fontconfig)(const FcChar8*, FcCo FcCache* (*FcDirCacheRead_dylibloader_wrapper_fontconfig)(const FcChar8*, FcBool, FcConfig*); FcCache* (*FcDirCacheLoadFile_dylibloader_wrapper_fontconfig)(const FcChar8*,struct stat*); void (*FcDirCacheUnload_dylibloader_wrapper_fontconfig)( FcCache*); -FcPattern* (*FcFreeTypeQuery_dylibloader_wrapper_fontconfig)(const FcChar8*, int, FcBlanks*, int*); +FcPattern* (*FcFreeTypeQuery_dylibloader_wrapper_fontconfig)(const FcChar8*, unsigned int, FcBlanks*, int*); +unsigned int (*FcFreeTypeQueryAll_dylibloader_wrapper_fontconfig)(const FcChar8*, unsigned int, FcBlanks*, int*, FcFontSet*); FcFontSet* (*FcFontSetCreate_dylibloader_wrapper_fontconfig)( void); void (*FcFontSetDestroy_dylibloader_wrapper_fontconfig)( FcFontSet*); FcBool (*FcFontSetAdd_dylibloader_wrapper_fontconfig)( FcFontSet*, FcPattern*); @@ -508,6 +599,7 @@ void (*FcValueDestroy_dylibloader_wrapper_fontconfig)( FcValue); FcBool (*FcValueEqual_dylibloader_wrapper_fontconfig)( FcValue, FcValue); FcValue (*FcValueSave_dylibloader_wrapper_fontconfig)( FcValue); void (*FcPatternDestroy_dylibloader_wrapper_fontconfig)( FcPattern*); +int (*FcPatternObjectCount_dylibloader_wrapper_fontconfig)(const FcPattern*); FcBool (*FcPatternEqual_dylibloader_wrapper_fontconfig)(const FcPattern*,const FcPattern*); FcBool (*FcPatternEqualSubset_dylibloader_wrapper_fontconfig)(const FcPattern*,const FcPattern*,const FcObjectSet*); FcChar32 (*FcPatternHash_dylibloader_wrapper_fontconfig)(const FcPattern*); @@ -541,8 +633,18 @@ FcRange* (*FcRangeCreateInteger_dylibloader_wrapper_fontconfig)( FcChar32, FcCha void (*FcRangeDestroy_dylibloader_wrapper_fontconfig)( FcRange*); FcRange* (*FcRangeCopy_dylibloader_wrapper_fontconfig)(const FcRange*); FcBool (*FcRangeGetDouble_dylibloader_wrapper_fontconfig)(const FcRange*, double*, double*); +void (*FcPatternIterStart_dylibloader_wrapper_fontconfig)(const FcPattern*, FcPatternIter*); +FcBool (*FcPatternIterNext_dylibloader_wrapper_fontconfig)(const FcPattern*, FcPatternIter*); +FcBool (*FcPatternIterEqual_dylibloader_wrapper_fontconfig)(const FcPattern*, FcPatternIter*,const FcPattern*, FcPatternIter*); +FcBool (*FcPatternFindIter_dylibloader_wrapper_fontconfig)(const FcPattern*, FcPatternIter*,const char*); +FcBool (*FcPatternIterIsValid_dylibloader_wrapper_fontconfig)(const FcPattern*, FcPatternIter*); +const char* (*FcPatternIterGetObject_dylibloader_wrapper_fontconfig)(const FcPattern*, FcPatternIter*); +int (*FcPatternIterValueCount_dylibloader_wrapper_fontconfig)(const FcPattern*, FcPatternIter*); +FcResult (*FcPatternIterGetValue_dylibloader_wrapper_fontconfig)(const FcPattern*, FcPatternIter*, int, FcValue*, FcValueBinding*); int (*FcWeightFromOpenType_dylibloader_wrapper_fontconfig)( int); +double (*FcWeightFromOpenTypeDouble_dylibloader_wrapper_fontconfig)( double); int (*FcWeightToOpenType_dylibloader_wrapper_fontconfig)( int); +double (*FcWeightToOpenTypeDouble_dylibloader_wrapper_fontconfig)( double); FcChar8* (*FcStrCopy_dylibloader_wrapper_fontconfig)(const FcChar8*); FcChar8* (*FcStrCopyFilename_dylibloader_wrapper_fontconfig)(const FcChar8*); FcChar8* (*FcStrPlus_dylibloader_wrapper_fontconfig)(const FcChar8*,const FcChar8*); @@ -687,6 +789,22 @@ int initialize_fontconfig(int verbose) { fprintf(stderr, "%s\n", error); } } +// FcDirCacheCreateUUID + *(void **) (&FcDirCacheCreateUUID_dylibloader_wrapper_fontconfig) = dlsym(handle, "FcDirCacheCreateUUID"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// FcDirCacheDeleteUUID + *(void **) (&FcDirCacheDeleteUUID_dylibloader_wrapper_fontconfig) = dlsym(handle, "FcDirCacheDeleteUUID"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } // FcConfigHome *(void **) (&FcConfigHome_dylibloader_wrapper_fontconfig) = dlsym(handle, "FcConfigHome"); if (verbose) { @@ -895,6 +1013,166 @@ int initialize_fontconfig(int verbose) { fprintf(stderr, "%s\n", error); } } +// FcConfigFileInfoIterInit + *(void **) (&FcConfigFileInfoIterInit_dylibloader_wrapper_fontconfig) = dlsym(handle, "FcConfigFileInfoIterInit"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// FcConfigFileInfoIterNext + *(void **) (&FcConfigFileInfoIterNext_dylibloader_wrapper_fontconfig) = dlsym(handle, "FcConfigFileInfoIterNext"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// FcConfigFileInfoIterGet + *(void **) (&FcConfigFileInfoIterGet_dylibloader_wrapper_fontconfig) = dlsym(handle, "FcConfigFileInfoIterGet"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// FcCharSetCreate + *(void **) (&FcCharSetCreate_dylibloader_wrapper_fontconfig) = dlsym(handle, "FcCharSetCreate"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// FcCharSetNew + *(void **) (&FcCharSetNew_dylibloader_wrapper_fontconfig) = dlsym(handle, "FcCharSetNew"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// FcCharSetDestroy + *(void **) (&FcCharSetDestroy_dylibloader_wrapper_fontconfig) = dlsym(handle, "FcCharSetDestroy"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// FcCharSetAddChar + *(void **) (&FcCharSetAddChar_dylibloader_wrapper_fontconfig) = dlsym(handle, "FcCharSetAddChar"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// FcCharSetDelChar + *(void **) (&FcCharSetDelChar_dylibloader_wrapper_fontconfig) = dlsym(handle, "FcCharSetDelChar"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// FcCharSetCopy + *(void **) (&FcCharSetCopy_dylibloader_wrapper_fontconfig) = dlsym(handle, "FcCharSetCopy"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// FcCharSetEqual + *(void **) (&FcCharSetEqual_dylibloader_wrapper_fontconfig) = dlsym(handle, "FcCharSetEqual"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// FcCharSetIntersect + *(void **) (&FcCharSetIntersect_dylibloader_wrapper_fontconfig) = dlsym(handle, "FcCharSetIntersect"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// FcCharSetUnion + *(void **) (&FcCharSetUnion_dylibloader_wrapper_fontconfig) = dlsym(handle, "FcCharSetUnion"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// FcCharSetSubtract + *(void **) (&FcCharSetSubtract_dylibloader_wrapper_fontconfig) = dlsym(handle, "FcCharSetSubtract"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// FcCharSetMerge + *(void **) (&FcCharSetMerge_dylibloader_wrapper_fontconfig) = dlsym(handle, "FcCharSetMerge"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// FcCharSetHasChar + *(void **) (&FcCharSetHasChar_dylibloader_wrapper_fontconfig) = dlsym(handle, "FcCharSetHasChar"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// FcCharSetCount + *(void **) (&FcCharSetCount_dylibloader_wrapper_fontconfig) = dlsym(handle, "FcCharSetCount"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// FcCharSetIntersectCount + *(void **) (&FcCharSetIntersectCount_dylibloader_wrapper_fontconfig) = dlsym(handle, "FcCharSetIntersectCount"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// FcCharSetSubtractCount + *(void **) (&FcCharSetSubtractCount_dylibloader_wrapper_fontconfig) = dlsym(handle, "FcCharSetSubtractCount"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// FcCharSetIsSubset + *(void **) (&FcCharSetIsSubset_dylibloader_wrapper_fontconfig) = dlsym(handle, "FcCharSetIsSubset"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// FcCharSetCoverage + *(void **) (&FcCharSetCoverage_dylibloader_wrapper_fontconfig) = dlsym(handle, "FcCharSetCoverage"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } // FcValuePrint *(void **) (&FcValuePrint_dylibloader_wrapper_fontconfig) = dlsym(handle, "FcValuePrint"); if (verbose) { @@ -1015,6 +1293,14 @@ int initialize_fontconfig(int verbose) { fprintf(stderr, "%s\n", error); } } +// FcFreeTypeQueryAll + *(void **) (&FcFreeTypeQueryAll_dylibloader_wrapper_fontconfig) = dlsym(handle, "FcFreeTypeQueryAll"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } // FcFontSetCreate *(void **) (&FcFontSetCreate_dylibloader_wrapper_fontconfig) = dlsym(handle, "FcFontSetCreate"); if (verbose) { @@ -1575,6 +1861,14 @@ int initialize_fontconfig(int verbose) { fprintf(stderr, "%s\n", error); } } +// FcPatternObjectCount + *(void **) (&FcPatternObjectCount_dylibloader_wrapper_fontconfig) = dlsym(handle, "FcPatternObjectCount"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } // FcPatternEqual *(void **) (&FcPatternEqual_dylibloader_wrapper_fontconfig) = dlsym(handle, "FcPatternEqual"); if (verbose) { @@ -1839,6 +2133,70 @@ int initialize_fontconfig(int verbose) { fprintf(stderr, "%s\n", error); } } +// FcPatternIterStart + *(void **) (&FcPatternIterStart_dylibloader_wrapper_fontconfig) = dlsym(handle, "FcPatternIterStart"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// FcPatternIterNext + *(void **) (&FcPatternIterNext_dylibloader_wrapper_fontconfig) = dlsym(handle, "FcPatternIterNext"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// FcPatternIterEqual + *(void **) (&FcPatternIterEqual_dylibloader_wrapper_fontconfig) = dlsym(handle, "FcPatternIterEqual"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// FcPatternFindIter + *(void **) (&FcPatternFindIter_dylibloader_wrapper_fontconfig) = dlsym(handle, "FcPatternFindIter"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// FcPatternIterIsValid + *(void **) (&FcPatternIterIsValid_dylibloader_wrapper_fontconfig) = dlsym(handle, "FcPatternIterIsValid"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// FcPatternIterGetObject + *(void **) (&FcPatternIterGetObject_dylibloader_wrapper_fontconfig) = dlsym(handle, "FcPatternIterGetObject"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// FcPatternIterValueCount + *(void **) (&FcPatternIterValueCount_dylibloader_wrapper_fontconfig) = dlsym(handle, "FcPatternIterValueCount"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// FcPatternIterGetValue + *(void **) (&FcPatternIterGetValue_dylibloader_wrapper_fontconfig) = dlsym(handle, "FcPatternIterGetValue"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } // FcWeightFromOpenType *(void **) (&FcWeightFromOpenType_dylibloader_wrapper_fontconfig) = dlsym(handle, "FcWeightFromOpenType"); if (verbose) { @@ -1847,6 +2205,14 @@ int initialize_fontconfig(int verbose) { fprintf(stderr, "%s\n", error); } } +// FcWeightFromOpenTypeDouble + *(void **) (&FcWeightFromOpenTypeDouble_dylibloader_wrapper_fontconfig) = dlsym(handle, "FcWeightFromOpenTypeDouble"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } // FcWeightToOpenType *(void **) (&FcWeightToOpenType_dylibloader_wrapper_fontconfig) = dlsym(handle, "FcWeightToOpenType"); if (verbose) { @@ -1855,6 +2221,14 @@ int initialize_fontconfig(int verbose) { fprintf(stderr, "%s\n", error); } } +// FcWeightToOpenTypeDouble + *(void **) (&FcWeightToOpenTypeDouble_dylibloader_wrapper_fontconfig) = dlsym(handle, "FcWeightToOpenTypeDouble"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } // FcStrCopy *(void **) (&FcStrCopy_dylibloader_wrapper_fontconfig) = dlsym(handle, "FcStrCopy"); if (verbose) { diff --git a/platform/linuxbsd/fontconfig-so_wrap.h b/platform/linuxbsd/fontconfig-so_wrap.h index f0794cce8b..0c8259deb7 100644 --- a/platform/linuxbsd/fontconfig-so_wrap.h +++ b/platform/linuxbsd/fontconfig-so_wrap.h @@ -2,8 +2,8 @@ #define DYLIBLOAD_WRAPPER_FONTCONFIG // This file is generated. Do not edit! // see https://github.com/hpvb/dynload-wrapper for details -// generated by ./generate-wrapper.py 0.3 on 2022-07-29 05:40:07 -// flags: ./generate-wrapper.py --include /usr/include/fontconfig/fontconfig.h --sys-include <fontconfig/fontconfig.h> --soname libfontconfig.so --init-name fontconfig --output-header fontconfig-so_wrap.h --output-implementation fontconfig-so_wrap.c --omit-prefix FcCharSet +// generated by ./generate-wrapper.py 0.3 on 2022-11-22 10:28:00 +// flags: ./generate-wrapper.py --include /usr/include/fontconfig/fontconfig.h --sys-include <fontconfig/fontconfig.h> --soname libfontconfig.so --init-name fontconfig --output-header fontconfig-so_wrap.h --output-implementation fontconfig-so_wrap.c --omit-prefix FcCharSetFirst --omit-prefix FcCharSetNext // #include <stdint.h> @@ -20,6 +20,8 @@ #define FcDirCacheValid FcDirCacheValid_dylibloader_orig_fontconfig #define FcDirCacheClean FcDirCacheClean_dylibloader_orig_fontconfig #define FcCacheCreateTagFile FcCacheCreateTagFile_dylibloader_orig_fontconfig +#define FcDirCacheCreateUUID FcDirCacheCreateUUID_dylibloader_orig_fontconfig +#define FcDirCacheDeleteUUID FcDirCacheDeleteUUID_dylibloader_orig_fontconfig #define FcConfigHome FcConfigHome_dylibloader_orig_fontconfig #define FcConfigEnableHome FcConfigEnableHome_dylibloader_orig_fontconfig #define FcConfigFilename FcConfigFilename_dylibloader_orig_fontconfig @@ -46,6 +48,26 @@ #define FcConfigSubstitute FcConfigSubstitute_dylibloader_orig_fontconfig #define FcConfigGetSysRoot FcConfigGetSysRoot_dylibloader_orig_fontconfig #define FcConfigSetSysRoot FcConfigSetSysRoot_dylibloader_orig_fontconfig +#define FcConfigFileInfoIterInit FcConfigFileInfoIterInit_dylibloader_orig_fontconfig +#define FcConfigFileInfoIterNext FcConfigFileInfoIterNext_dylibloader_orig_fontconfig +#define FcConfigFileInfoIterGet FcConfigFileInfoIterGet_dylibloader_orig_fontconfig +#define FcCharSetCreate FcCharSetCreate_dylibloader_orig_fontconfig +#define FcCharSetNew FcCharSetNew_dylibloader_orig_fontconfig +#define FcCharSetDestroy FcCharSetDestroy_dylibloader_orig_fontconfig +#define FcCharSetAddChar FcCharSetAddChar_dylibloader_orig_fontconfig +#define FcCharSetDelChar FcCharSetDelChar_dylibloader_orig_fontconfig +#define FcCharSetCopy FcCharSetCopy_dylibloader_orig_fontconfig +#define FcCharSetEqual FcCharSetEqual_dylibloader_orig_fontconfig +#define FcCharSetIntersect FcCharSetIntersect_dylibloader_orig_fontconfig +#define FcCharSetUnion FcCharSetUnion_dylibloader_orig_fontconfig +#define FcCharSetSubtract FcCharSetSubtract_dylibloader_orig_fontconfig +#define FcCharSetMerge FcCharSetMerge_dylibloader_orig_fontconfig +#define FcCharSetHasChar FcCharSetHasChar_dylibloader_orig_fontconfig +#define FcCharSetCount FcCharSetCount_dylibloader_orig_fontconfig +#define FcCharSetIntersectCount FcCharSetIntersectCount_dylibloader_orig_fontconfig +#define FcCharSetSubtractCount FcCharSetSubtractCount_dylibloader_orig_fontconfig +#define FcCharSetIsSubset FcCharSetIsSubset_dylibloader_orig_fontconfig +#define FcCharSetCoverage FcCharSetCoverage_dylibloader_orig_fontconfig #define FcValuePrint FcValuePrint_dylibloader_orig_fontconfig #define FcPatternPrint FcPatternPrint_dylibloader_orig_fontconfig #define FcFontSetPrint FcFontSetPrint_dylibloader_orig_fontconfig @@ -61,6 +83,7 @@ #define FcDirCacheLoadFile FcDirCacheLoadFile_dylibloader_orig_fontconfig #define FcDirCacheUnload FcDirCacheUnload_dylibloader_orig_fontconfig #define FcFreeTypeQuery FcFreeTypeQuery_dylibloader_orig_fontconfig +#define FcFreeTypeQueryAll FcFreeTypeQueryAll_dylibloader_orig_fontconfig #define FcFontSetCreate FcFontSetCreate_dylibloader_orig_fontconfig #define FcFontSetDestroy FcFontSetDestroy_dylibloader_orig_fontconfig #define FcFontSetAdd FcFontSetAdd_dylibloader_orig_fontconfig @@ -131,6 +154,7 @@ #define FcValueEqual FcValueEqual_dylibloader_orig_fontconfig #define FcValueSave FcValueSave_dylibloader_orig_fontconfig #define FcPatternDestroy FcPatternDestroy_dylibloader_orig_fontconfig +#define FcPatternObjectCount FcPatternObjectCount_dylibloader_orig_fontconfig #define FcPatternEqual FcPatternEqual_dylibloader_orig_fontconfig #define FcPatternEqualSubset FcPatternEqualSubset_dylibloader_orig_fontconfig #define FcPatternHash FcPatternHash_dylibloader_orig_fontconfig @@ -164,8 +188,18 @@ #define FcRangeDestroy FcRangeDestroy_dylibloader_orig_fontconfig #define FcRangeCopy FcRangeCopy_dylibloader_orig_fontconfig #define FcRangeGetDouble FcRangeGetDouble_dylibloader_orig_fontconfig +#define FcPatternIterStart FcPatternIterStart_dylibloader_orig_fontconfig +#define FcPatternIterNext FcPatternIterNext_dylibloader_orig_fontconfig +#define FcPatternIterEqual FcPatternIterEqual_dylibloader_orig_fontconfig +#define FcPatternFindIter FcPatternFindIter_dylibloader_orig_fontconfig +#define FcPatternIterIsValid FcPatternIterIsValid_dylibloader_orig_fontconfig +#define FcPatternIterGetObject FcPatternIterGetObject_dylibloader_orig_fontconfig +#define FcPatternIterValueCount FcPatternIterValueCount_dylibloader_orig_fontconfig +#define FcPatternIterGetValue FcPatternIterGetValue_dylibloader_orig_fontconfig #define FcWeightFromOpenType FcWeightFromOpenType_dylibloader_orig_fontconfig +#define FcWeightFromOpenTypeDouble FcWeightFromOpenTypeDouble_dylibloader_orig_fontconfig #define FcWeightToOpenType FcWeightToOpenType_dylibloader_orig_fontconfig +#define FcWeightToOpenTypeDouble FcWeightToOpenTypeDouble_dylibloader_orig_fontconfig #define FcStrCopy FcStrCopy_dylibloader_orig_fontconfig #define FcStrCopyFilename FcStrCopyFilename_dylibloader_orig_fontconfig #define FcStrPlus FcStrPlus_dylibloader_orig_fontconfig @@ -209,6 +243,8 @@ #undef FcDirCacheValid #undef FcDirCacheClean #undef FcCacheCreateTagFile +#undef FcDirCacheCreateUUID +#undef FcDirCacheDeleteUUID #undef FcConfigHome #undef FcConfigEnableHome #undef FcConfigFilename @@ -235,6 +271,26 @@ #undef FcConfigSubstitute #undef FcConfigGetSysRoot #undef FcConfigSetSysRoot +#undef FcConfigFileInfoIterInit +#undef FcConfigFileInfoIterNext +#undef FcConfigFileInfoIterGet +#undef FcCharSetCreate +#undef FcCharSetNew +#undef FcCharSetDestroy +#undef FcCharSetAddChar +#undef FcCharSetDelChar +#undef FcCharSetCopy +#undef FcCharSetEqual +#undef FcCharSetIntersect +#undef FcCharSetUnion +#undef FcCharSetSubtract +#undef FcCharSetMerge +#undef FcCharSetHasChar +#undef FcCharSetCount +#undef FcCharSetIntersectCount +#undef FcCharSetSubtractCount +#undef FcCharSetIsSubset +#undef FcCharSetCoverage #undef FcValuePrint #undef FcPatternPrint #undef FcFontSetPrint @@ -250,6 +306,7 @@ #undef FcDirCacheLoadFile #undef FcDirCacheUnload #undef FcFreeTypeQuery +#undef FcFreeTypeQueryAll #undef FcFontSetCreate #undef FcFontSetDestroy #undef FcFontSetAdd @@ -320,6 +377,7 @@ #undef FcValueEqual #undef FcValueSave #undef FcPatternDestroy +#undef FcPatternObjectCount #undef FcPatternEqual #undef FcPatternEqualSubset #undef FcPatternHash @@ -353,8 +411,18 @@ #undef FcRangeDestroy #undef FcRangeCopy #undef FcRangeGetDouble +#undef FcPatternIterStart +#undef FcPatternIterNext +#undef FcPatternIterEqual +#undef FcPatternFindIter +#undef FcPatternIterIsValid +#undef FcPatternIterGetObject +#undef FcPatternIterValueCount +#undef FcPatternIterGetValue #undef FcWeightFromOpenType +#undef FcWeightFromOpenTypeDouble #undef FcWeightToOpenType +#undef FcWeightToOpenTypeDouble #undef FcStrCopy #undef FcStrCopyFilename #undef FcStrPlus @@ -400,6 +468,8 @@ extern "C" { #define FcDirCacheValid FcDirCacheValid_dylibloader_wrapper_fontconfig #define FcDirCacheClean FcDirCacheClean_dylibloader_wrapper_fontconfig #define FcCacheCreateTagFile FcCacheCreateTagFile_dylibloader_wrapper_fontconfig +#define FcDirCacheCreateUUID FcDirCacheCreateUUID_dylibloader_wrapper_fontconfig +#define FcDirCacheDeleteUUID FcDirCacheDeleteUUID_dylibloader_wrapper_fontconfig #define FcConfigHome FcConfigHome_dylibloader_wrapper_fontconfig #define FcConfigEnableHome FcConfigEnableHome_dylibloader_wrapper_fontconfig #define FcConfigFilename FcConfigFilename_dylibloader_wrapper_fontconfig @@ -426,6 +496,26 @@ extern "C" { #define FcConfigSubstitute FcConfigSubstitute_dylibloader_wrapper_fontconfig #define FcConfigGetSysRoot FcConfigGetSysRoot_dylibloader_wrapper_fontconfig #define FcConfigSetSysRoot FcConfigSetSysRoot_dylibloader_wrapper_fontconfig +#define FcConfigFileInfoIterInit FcConfigFileInfoIterInit_dylibloader_wrapper_fontconfig +#define FcConfigFileInfoIterNext FcConfigFileInfoIterNext_dylibloader_wrapper_fontconfig +#define FcConfigFileInfoIterGet FcConfigFileInfoIterGet_dylibloader_wrapper_fontconfig +#define FcCharSetCreate FcCharSetCreate_dylibloader_wrapper_fontconfig +#define FcCharSetNew FcCharSetNew_dylibloader_wrapper_fontconfig +#define FcCharSetDestroy FcCharSetDestroy_dylibloader_wrapper_fontconfig +#define FcCharSetAddChar FcCharSetAddChar_dylibloader_wrapper_fontconfig +#define FcCharSetDelChar FcCharSetDelChar_dylibloader_wrapper_fontconfig +#define FcCharSetCopy FcCharSetCopy_dylibloader_wrapper_fontconfig +#define FcCharSetEqual FcCharSetEqual_dylibloader_wrapper_fontconfig +#define FcCharSetIntersect FcCharSetIntersect_dylibloader_wrapper_fontconfig +#define FcCharSetUnion FcCharSetUnion_dylibloader_wrapper_fontconfig +#define FcCharSetSubtract FcCharSetSubtract_dylibloader_wrapper_fontconfig +#define FcCharSetMerge FcCharSetMerge_dylibloader_wrapper_fontconfig +#define FcCharSetHasChar FcCharSetHasChar_dylibloader_wrapper_fontconfig +#define FcCharSetCount FcCharSetCount_dylibloader_wrapper_fontconfig +#define FcCharSetIntersectCount FcCharSetIntersectCount_dylibloader_wrapper_fontconfig +#define FcCharSetSubtractCount FcCharSetSubtractCount_dylibloader_wrapper_fontconfig +#define FcCharSetIsSubset FcCharSetIsSubset_dylibloader_wrapper_fontconfig +#define FcCharSetCoverage FcCharSetCoverage_dylibloader_wrapper_fontconfig #define FcValuePrint FcValuePrint_dylibloader_wrapper_fontconfig #define FcPatternPrint FcPatternPrint_dylibloader_wrapper_fontconfig #define FcFontSetPrint FcFontSetPrint_dylibloader_wrapper_fontconfig @@ -441,6 +531,7 @@ extern "C" { #define FcDirCacheLoadFile FcDirCacheLoadFile_dylibloader_wrapper_fontconfig #define FcDirCacheUnload FcDirCacheUnload_dylibloader_wrapper_fontconfig #define FcFreeTypeQuery FcFreeTypeQuery_dylibloader_wrapper_fontconfig +#define FcFreeTypeQueryAll FcFreeTypeQueryAll_dylibloader_wrapper_fontconfig #define FcFontSetCreate FcFontSetCreate_dylibloader_wrapper_fontconfig #define FcFontSetDestroy FcFontSetDestroy_dylibloader_wrapper_fontconfig #define FcFontSetAdd FcFontSetAdd_dylibloader_wrapper_fontconfig @@ -511,6 +602,7 @@ extern "C" { #define FcValueEqual FcValueEqual_dylibloader_wrapper_fontconfig #define FcValueSave FcValueSave_dylibloader_wrapper_fontconfig #define FcPatternDestroy FcPatternDestroy_dylibloader_wrapper_fontconfig +#define FcPatternObjectCount FcPatternObjectCount_dylibloader_wrapper_fontconfig #define FcPatternEqual FcPatternEqual_dylibloader_wrapper_fontconfig #define FcPatternEqualSubset FcPatternEqualSubset_dylibloader_wrapper_fontconfig #define FcPatternHash FcPatternHash_dylibloader_wrapper_fontconfig @@ -544,8 +636,18 @@ extern "C" { #define FcRangeDestroy FcRangeDestroy_dylibloader_wrapper_fontconfig #define FcRangeCopy FcRangeCopy_dylibloader_wrapper_fontconfig #define FcRangeGetDouble FcRangeGetDouble_dylibloader_wrapper_fontconfig +#define FcPatternIterStart FcPatternIterStart_dylibloader_wrapper_fontconfig +#define FcPatternIterNext FcPatternIterNext_dylibloader_wrapper_fontconfig +#define FcPatternIterEqual FcPatternIterEqual_dylibloader_wrapper_fontconfig +#define FcPatternFindIter FcPatternFindIter_dylibloader_wrapper_fontconfig +#define FcPatternIterIsValid FcPatternIterIsValid_dylibloader_wrapper_fontconfig +#define FcPatternIterGetObject FcPatternIterGetObject_dylibloader_wrapper_fontconfig +#define FcPatternIterValueCount FcPatternIterValueCount_dylibloader_wrapper_fontconfig +#define FcPatternIterGetValue FcPatternIterGetValue_dylibloader_wrapper_fontconfig #define FcWeightFromOpenType FcWeightFromOpenType_dylibloader_wrapper_fontconfig +#define FcWeightFromOpenTypeDouble FcWeightFromOpenTypeDouble_dylibloader_wrapper_fontconfig #define FcWeightToOpenType FcWeightToOpenType_dylibloader_wrapper_fontconfig +#define FcWeightToOpenTypeDouble FcWeightToOpenTypeDouble_dylibloader_wrapper_fontconfig #define FcStrCopy FcStrCopy_dylibloader_wrapper_fontconfig #define FcStrCopyFilename FcStrCopyFilename_dylibloader_wrapper_fontconfig #define FcStrPlus FcStrPlus_dylibloader_wrapper_fontconfig @@ -588,6 +690,8 @@ extern FcBool (*FcDirCacheUnlink_dylibloader_wrapper_fontconfig)(const FcChar8*, extern FcBool (*FcDirCacheValid_dylibloader_wrapper_fontconfig)(const FcChar8*); extern FcBool (*FcDirCacheClean_dylibloader_wrapper_fontconfig)(const FcChar8*, FcBool); extern void (*FcCacheCreateTagFile_dylibloader_wrapper_fontconfig)(const FcConfig*); +extern FcBool (*FcDirCacheCreateUUID_dylibloader_wrapper_fontconfig)( FcChar8*, FcBool, FcConfig*); +extern FcBool (*FcDirCacheDeleteUUID_dylibloader_wrapper_fontconfig)(const FcChar8*, FcConfig*); extern FcChar8* (*FcConfigHome_dylibloader_wrapper_fontconfig)( void); extern FcBool (*FcConfigEnableHome_dylibloader_wrapper_fontconfig)( FcBool); extern FcChar8* (*FcConfigFilename_dylibloader_wrapper_fontconfig)(const FcChar8*); @@ -614,6 +718,26 @@ extern FcBool (*FcConfigSubstituteWithPat_dylibloader_wrapper_fontconfig)( FcCon extern FcBool (*FcConfigSubstitute_dylibloader_wrapper_fontconfig)( FcConfig*, FcPattern*, FcMatchKind); extern const FcChar8* (*FcConfigGetSysRoot_dylibloader_wrapper_fontconfig)(const FcConfig*); extern void (*FcConfigSetSysRoot_dylibloader_wrapper_fontconfig)( FcConfig*,const FcChar8*); +extern void (*FcConfigFileInfoIterInit_dylibloader_wrapper_fontconfig)( FcConfig*, FcConfigFileInfoIter*); +extern FcBool (*FcConfigFileInfoIterNext_dylibloader_wrapper_fontconfig)( FcConfig*, FcConfigFileInfoIter*); +extern FcBool (*FcConfigFileInfoIterGet_dylibloader_wrapper_fontconfig)( FcConfig*, FcConfigFileInfoIter*, FcChar8**, FcChar8**, FcBool*); +extern FcCharSet* (*FcCharSetCreate_dylibloader_wrapper_fontconfig)( void); +extern FcCharSet* (*FcCharSetNew_dylibloader_wrapper_fontconfig)( void); +extern void (*FcCharSetDestroy_dylibloader_wrapper_fontconfig)( FcCharSet*); +extern FcBool (*FcCharSetAddChar_dylibloader_wrapper_fontconfig)( FcCharSet*, FcChar32); +extern FcBool (*FcCharSetDelChar_dylibloader_wrapper_fontconfig)( FcCharSet*, FcChar32); +extern FcCharSet* (*FcCharSetCopy_dylibloader_wrapper_fontconfig)( FcCharSet*); +extern FcBool (*FcCharSetEqual_dylibloader_wrapper_fontconfig)(const FcCharSet*,const FcCharSet*); +extern FcCharSet* (*FcCharSetIntersect_dylibloader_wrapper_fontconfig)(const FcCharSet*,const FcCharSet*); +extern FcCharSet* (*FcCharSetUnion_dylibloader_wrapper_fontconfig)(const FcCharSet*,const FcCharSet*); +extern FcCharSet* (*FcCharSetSubtract_dylibloader_wrapper_fontconfig)(const FcCharSet*,const FcCharSet*); +extern FcBool (*FcCharSetMerge_dylibloader_wrapper_fontconfig)( FcCharSet*,const FcCharSet*, FcBool*); +extern FcBool (*FcCharSetHasChar_dylibloader_wrapper_fontconfig)(const FcCharSet*, FcChar32); +extern FcChar32 (*FcCharSetCount_dylibloader_wrapper_fontconfig)(const FcCharSet*); +extern FcChar32 (*FcCharSetIntersectCount_dylibloader_wrapper_fontconfig)(const FcCharSet*,const FcCharSet*); +extern FcChar32 (*FcCharSetSubtractCount_dylibloader_wrapper_fontconfig)(const FcCharSet*,const FcCharSet*); +extern FcBool (*FcCharSetIsSubset_dylibloader_wrapper_fontconfig)(const FcCharSet*,const FcCharSet*); +extern FcChar32 (*FcCharSetCoverage_dylibloader_wrapper_fontconfig)(const FcCharSet*, FcChar32, FcChar32*); extern void (*FcValuePrint_dylibloader_wrapper_fontconfig)(const FcValue); extern void (*FcPatternPrint_dylibloader_wrapper_fontconfig)(const FcPattern*); extern void (*FcFontSetPrint_dylibloader_wrapper_fontconfig)(const FcFontSet*); @@ -628,7 +752,8 @@ extern FcCache* (*FcDirCacheRescan_dylibloader_wrapper_fontconfig)(const FcChar8 extern FcCache* (*FcDirCacheRead_dylibloader_wrapper_fontconfig)(const FcChar8*, FcBool, FcConfig*); extern FcCache* (*FcDirCacheLoadFile_dylibloader_wrapper_fontconfig)(const FcChar8*,struct stat*); extern void (*FcDirCacheUnload_dylibloader_wrapper_fontconfig)( FcCache*); -extern FcPattern* (*FcFreeTypeQuery_dylibloader_wrapper_fontconfig)(const FcChar8*, int, FcBlanks*, int*); +extern FcPattern* (*FcFreeTypeQuery_dylibloader_wrapper_fontconfig)(const FcChar8*, unsigned int, FcBlanks*, int*); +extern unsigned int (*FcFreeTypeQueryAll_dylibloader_wrapper_fontconfig)(const FcChar8*, unsigned int, FcBlanks*, int*, FcFontSet*); extern FcFontSet* (*FcFontSetCreate_dylibloader_wrapper_fontconfig)( void); extern void (*FcFontSetDestroy_dylibloader_wrapper_fontconfig)( FcFontSet*); extern FcBool (*FcFontSetAdd_dylibloader_wrapper_fontconfig)( FcFontSet*, FcPattern*); @@ -699,6 +824,7 @@ extern void (*FcValueDestroy_dylibloader_wrapper_fontconfig)( FcValue); extern FcBool (*FcValueEqual_dylibloader_wrapper_fontconfig)( FcValue, FcValue); extern FcValue (*FcValueSave_dylibloader_wrapper_fontconfig)( FcValue); extern void (*FcPatternDestroy_dylibloader_wrapper_fontconfig)( FcPattern*); +extern int (*FcPatternObjectCount_dylibloader_wrapper_fontconfig)(const FcPattern*); extern FcBool (*FcPatternEqual_dylibloader_wrapper_fontconfig)(const FcPattern*,const FcPattern*); extern FcBool (*FcPatternEqualSubset_dylibloader_wrapper_fontconfig)(const FcPattern*,const FcPattern*,const FcObjectSet*); extern FcChar32 (*FcPatternHash_dylibloader_wrapper_fontconfig)(const FcPattern*); @@ -732,8 +858,18 @@ extern FcRange* (*FcRangeCreateInteger_dylibloader_wrapper_fontconfig)( FcChar32 extern void (*FcRangeDestroy_dylibloader_wrapper_fontconfig)( FcRange*); extern FcRange* (*FcRangeCopy_dylibloader_wrapper_fontconfig)(const FcRange*); extern FcBool (*FcRangeGetDouble_dylibloader_wrapper_fontconfig)(const FcRange*, double*, double*); +extern void (*FcPatternIterStart_dylibloader_wrapper_fontconfig)(const FcPattern*, FcPatternIter*); +extern FcBool (*FcPatternIterNext_dylibloader_wrapper_fontconfig)(const FcPattern*, FcPatternIter*); +extern FcBool (*FcPatternIterEqual_dylibloader_wrapper_fontconfig)(const FcPattern*, FcPatternIter*,const FcPattern*, FcPatternIter*); +extern FcBool (*FcPatternFindIter_dylibloader_wrapper_fontconfig)(const FcPattern*, FcPatternIter*,const char*); +extern FcBool (*FcPatternIterIsValid_dylibloader_wrapper_fontconfig)(const FcPattern*, FcPatternIter*); +extern const char* (*FcPatternIterGetObject_dylibloader_wrapper_fontconfig)(const FcPattern*, FcPatternIter*); +extern int (*FcPatternIterValueCount_dylibloader_wrapper_fontconfig)(const FcPattern*, FcPatternIter*); +extern FcResult (*FcPatternIterGetValue_dylibloader_wrapper_fontconfig)(const FcPattern*, FcPatternIter*, int, FcValue*, FcValueBinding*); extern int (*FcWeightFromOpenType_dylibloader_wrapper_fontconfig)( int); +extern double (*FcWeightFromOpenTypeDouble_dylibloader_wrapper_fontconfig)( double); extern int (*FcWeightToOpenType_dylibloader_wrapper_fontconfig)( int); +extern double (*FcWeightToOpenTypeDouble_dylibloader_wrapper_fontconfig)( double); extern FcChar8* (*FcStrCopy_dylibloader_wrapper_fontconfig)(const FcChar8*); extern FcChar8* (*FcStrCopyFilename_dylibloader_wrapper_fontconfig)(const FcChar8*); extern FcChar8* (*FcStrPlus_dylibloader_wrapper_fontconfig)(const FcChar8*,const FcChar8*); diff --git a/platform/linuxbsd/joypad_linux.cpp b/platform/linuxbsd/joypad_linux.cpp index bc018e366b..4eaf6965c9 100644 --- a/platform/linuxbsd/joypad_linux.cpp +++ b/platform/linuxbsd/joypad_linux.cpp @@ -218,8 +218,8 @@ void JoypadLinux::monitor_joypads() { } } closedir(input_directory); + usleep(1000000); // 1s } - usleep(1000000); // 1s } void JoypadLinux::close_joypads() { diff --git a/platform/linuxbsd/os_linuxbsd.cpp b/platform/linuxbsd/os_linuxbsd.cpp index e14e4fb52d..d5a75edeea 100644 --- a/platform/linuxbsd/os_linuxbsd.cpp +++ b/platform/linuxbsd/os_linuxbsd.cpp @@ -56,10 +56,6 @@ #include <sys/utsname.h> #include <unistd.h> -#ifdef FONTCONFIG_ENABLED -#include "fontconfig-so_wrap.h" -#endif - void OS_LinuxBSD::alert(const String &p_alert, const String &p_title) { const char *message_programs[] = { "zenity", "kdialog", "Xdialog", "xmessage" }; @@ -585,15 +581,9 @@ Vector<String> OS_LinuxBSD::get_system_fonts() const { if (!font_config_initialized) { ERR_FAIL_V_MSG(Vector<String>(), "Unable to load fontconfig, system font support is disabled."); } + HashSet<String> font_names; Vector<String> ret; - - FcConfig *config = FcInitLoadConfigAndFonts(); - ERR_FAIL_COND_V(!config, ret); - - FcObjectSet *object_set = FcObjectSetBuild(FC_FAMILY, nullptr); - ERR_FAIL_COND_V(!object_set, ret); - static const char *allowed_formats[] = { "TrueType", "CFF" }; for (size_t i = 0; i < sizeof(allowed_formats) / sizeof(const char *); i++) { FcPattern *pattern = FcPatternCreate(); @@ -616,8 +606,6 @@ Vector<String> OS_LinuxBSD::get_system_fonts() const { } FcPatternDestroy(pattern); } - FcObjectSetDestroy(object_set); - FcConfigDestroy(config); for (const String &E : font_names) { ret.push_back(E); @@ -628,27 +616,122 @@ Vector<String> OS_LinuxBSD::get_system_fonts() const { #endif } -String OS_LinuxBSD::get_system_font_path(const String &p_font_name, bool p_bold, bool p_italic) const { +#ifdef FONTCONFIG_ENABLED +int OS_LinuxBSD::_weight_to_fc(int p_weight) const { + if (p_weight < 150) { + return FC_WEIGHT_THIN; + } else if (p_weight < 250) { + return FC_WEIGHT_EXTRALIGHT; + } else if (p_weight < 325) { + return FC_WEIGHT_LIGHT; + } else if (p_weight < 375) { + return FC_WEIGHT_DEMILIGHT; + } else if (p_weight < 390) { + return FC_WEIGHT_BOOK; + } else if (p_weight < 450) { + return FC_WEIGHT_REGULAR; + } else if (p_weight < 550) { + return FC_WEIGHT_MEDIUM; + } else if (p_weight < 650) { + return FC_WEIGHT_DEMIBOLD; + } else if (p_weight < 750) { + return FC_WEIGHT_BOLD; + } else if (p_weight < 850) { + return FC_WEIGHT_EXTRABOLD; + } else if (p_weight < 925) { + return FC_WEIGHT_BLACK; + } else { + return FC_WEIGHT_EXTRABLACK; + } +} + +int OS_LinuxBSD::_stretch_to_fc(int p_stretch) const { + if (p_stretch < 56) { + return FC_WIDTH_ULTRACONDENSED; + } else if (p_stretch < 69) { + return FC_WIDTH_EXTRACONDENSED; + } else if (p_stretch < 81) { + return FC_WIDTH_CONDENSED; + } else if (p_stretch < 93) { + return FC_WIDTH_SEMICONDENSED; + } else if (p_stretch < 106) { + return FC_WIDTH_NORMAL; + } else if (p_stretch < 137) { + return FC_WIDTH_SEMIEXPANDED; + } else if (p_stretch < 144) { + return FC_WIDTH_EXPANDED; + } else if (p_stretch < 162) { + return FC_WIDTH_EXTRAEXPANDED; + } else { + return FC_WIDTH_ULTRAEXPANDED; + } +} +#endif // FONTCONFIG_ENABLED + +Vector<String> OS_LinuxBSD::get_system_font_path_for_text(const String &p_font_name, const String &p_text, const String &p_locale, const String &p_script, int p_weight, int p_stretch, bool p_italic) const { #ifdef FONTCONFIG_ENABLED if (!font_config_initialized) { - ERR_FAIL_V_MSG(String(), "Unable to load fontconfig, system font support is disabled."); + ERR_FAIL_V_MSG(Vector<String>(), "Unable to load fontconfig, system font support is disabled."); } - bool allow_substitutes = (p_font_name.to_lower() == "sans-serif") || (p_font_name.to_lower() == "serif") || (p_font_name.to_lower() == "monospace") || (p_font_name.to_lower() == "cursive") || (p_font_name.to_lower() == "fantasy"); + Vector<String> ret; + FcPattern *pattern = FcPatternCreate(); + if (pattern) { + FcPatternAddString(pattern, FC_FAMILY, reinterpret_cast<const FcChar8 *>(p_font_name.utf8().get_data())); + FcPatternAddInteger(pattern, FC_WEIGHT, _weight_to_fc(p_weight)); + FcPatternAddInteger(pattern, FC_WIDTH, _stretch_to_fc(p_stretch)); + FcPatternAddInteger(pattern, FC_SLANT, p_italic ? FC_SLANT_ITALIC : FC_SLANT_ROMAN); - String ret; + FcCharSet *char_set = FcCharSetCreate(); + for (int i = 0; i < p_text.size(); i++) { + FcCharSetAddChar(char_set, p_text[i]); + } + FcPatternAddCharSet(pattern, FC_CHARSET, char_set); - FcConfig *config = FcInitLoadConfigAndFonts(); - ERR_FAIL_COND_V(!config, ret); + FcLangSet *lang_set = FcLangSetCreate(); + FcLangSetAdd(lang_set, reinterpret_cast<const FcChar8 *>(p_locale.utf8().get_data())); + FcPatternAddLangSet(pattern, FC_LANG, lang_set); - FcObjectSet *object_set = FcObjectSetBuild(FC_FAMILY, FC_FILE, nullptr); - ERR_FAIL_COND_V(!object_set, ret); + FcConfigSubstitute(0, pattern, FcMatchPattern); + FcDefaultSubstitute(pattern); + FcResult result; + FcPattern *match = FcFontMatch(0, pattern, &result); + if (match) { + char *file_name = nullptr; + if (FcPatternGetString(match, FC_FILE, 0, reinterpret_cast<FcChar8 **>(&file_name)) == FcResultMatch) { + if (file_name) { + ret.push_back(String::utf8(file_name)); + } + } + FcPatternDestroy(match); + } + FcPatternDestroy(pattern); + FcCharSetDestroy(char_set); + FcLangSetDestroy(lang_set); + } + + return ret; +#else + ERR_FAIL_V_MSG(Vector<String>(), "Godot was compiled without fontconfig, system font support is disabled."); +#endif +} + +String OS_LinuxBSD::get_system_font_path(const String &p_font_name, int p_weight, int p_stretch, bool p_italic) const { +#ifdef FONTCONFIG_ENABLED + if (!font_config_initialized) { + ERR_FAIL_V_MSG(String(), "Unable to load fontconfig, system font support is disabled."); + } + + String ret; FcPattern *pattern = FcPatternCreate(); if (pattern) { + bool allow_substitutes = (p_font_name.to_lower() == "sans-serif") || (p_font_name.to_lower() == "serif") || (p_font_name.to_lower() == "monospace") || (p_font_name.to_lower() == "cursive") || (p_font_name.to_lower() == "fantasy"); + FcPatternAddBool(pattern, FC_SCALABLE, FcTrue); FcPatternAddString(pattern, FC_FAMILY, reinterpret_cast<const FcChar8 *>(p_font_name.utf8().get_data())); - FcPatternAddInteger(pattern, FC_WEIGHT, p_bold ? FC_WEIGHT_BOLD : FC_WEIGHT_NORMAL); + FcPatternAddInteger(pattern, FC_WEIGHT, _weight_to_fc(p_weight)); + FcPatternAddInteger(pattern, FC_WIDTH, _stretch_to_fc(p_stretch)); FcPatternAddInteger(pattern, FC_SLANT, p_italic ? FC_SLANT_ITALIC : FC_SLANT_ROMAN); FcConfigSubstitute(0, pattern, FcMatchPattern); @@ -663,8 +746,6 @@ String OS_LinuxBSD::get_system_font_path(const String &p_font_name, bool p_bold, if (family_name && String::utf8(family_name).to_lower() != p_font_name.to_lower()) { FcPatternDestroy(match); FcPatternDestroy(pattern); - FcObjectSetDestroy(object_set); - FcConfigDestroy(config); return String(); } @@ -681,8 +762,6 @@ String OS_LinuxBSD::get_system_font_path(const String &p_font_name, bool p_bold, } FcPatternDestroy(pattern); } - FcObjectSetDestroy(object_set); - FcConfigDestroy(config); return ret; #else @@ -1008,5 +1087,26 @@ OS_LinuxBSD::OS_LinuxBSD() { int dylibloader_verbose = 0; #endif font_config_initialized = (initialize_fontconfig(dylibloader_verbose) == 0); + if (font_config_initialized) { + config = FcInitLoadConfigAndFonts(); + if (!config) { + font_config_initialized = false; + } + object_set = FcObjectSetBuild(FC_FAMILY, FC_FILE, nullptr); + if (!object_set) { + font_config_initialized = false; + } + } +#endif // FONTCONFIG_ENABLED +} + +OS_LinuxBSD::~OS_LinuxBSD() { +#ifdef FONTCONFIG_ENABLED + if (object_set) { + FcObjectSetDestroy(object_set); + } + if (config) { + FcConfigDestroy(config); + } #endif // FONTCONFIG_ENABLED } diff --git a/platform/linuxbsd/os_linuxbsd.h b/platform/linuxbsd/os_linuxbsd.h index aa7af92aa1..bf469af568 100644 --- a/platform/linuxbsd/os_linuxbsd.h +++ b/platform/linuxbsd/os_linuxbsd.h @@ -40,11 +40,20 @@ #include "joypad_linux.h" #include "servers/audio_server.h" +#ifdef FONTCONFIG_ENABLED +#include "fontconfig-so_wrap.h" +#endif + class OS_LinuxBSD : public OS_Unix { virtual void delete_main_loop() override; #ifdef FONTCONFIG_ENABLED bool font_config_initialized = false; + FcConfig *config = nullptr; + FcObjectSet *object_set = nullptr; + + int _weight_to_fc(int p_weight) const; + int _stretch_to_fc(int p_stretch) const; #endif #ifdef JOYDEV_ENABLED @@ -94,7 +103,8 @@ public: virtual uint64_t get_embedded_pck_offset() const override; virtual Vector<String> get_system_fonts() const override; - virtual String get_system_font_path(const String &p_font_name, bool p_bold = false, bool p_italic = false) const override; + virtual String get_system_font_path(const String &p_font_name, int p_weight = 400, int p_stretch = 100, bool p_italic = false) const override; + virtual Vector<String> get_system_font_path_for_text(const String &p_font_name, const String &p_text, const String &p_locale = String(), const String &p_script = String(), int p_weight = 400, int p_stretch = 100, bool p_italic = false) const override; virtual String get_config_path() const override; virtual String get_data_path() const override; @@ -119,6 +129,7 @@ public: virtual Error move_to_trash(const String &p_path) override; OS_LinuxBSD(); + ~OS_LinuxBSD(); }; #endif // OS_LINUXBSD_H diff --git a/platform/linuxbsd/x11/SCsub b/platform/linuxbsd/x11/SCsub index 30c6080355..8b2e2aabe4 100644 --- a/platform/linuxbsd/x11/SCsub +++ b/platform/linuxbsd/x11/SCsub @@ -5,12 +5,20 @@ Import("env") source_files = [ "display_server_x11.cpp", "key_mapping_x11.cpp", + "dynwrappers/xlib-so_wrap.c", + "dynwrappers/xcursor-so_wrap.c", + "dynwrappers/xinerama-so_wrap.c", + "dynwrappers/xinput2-so_wrap.c", + "dynwrappers/xrandr-so_wrap.c", + "dynwrappers/xrender-so_wrap.c", + "dynwrappers/xext-so_wrap.c", ] if env["vulkan"]: source_files.append("vulkan_context_x11.cpp") if env["opengl3"]: + env.Append(CPPDEFINES=["GLAD_GLX_NO_X11"]) source_files.append(["gl_manager_x11.cpp", "detect_prime_x11.cpp", "#thirdparty/glad/glx.c"]) objects = [] diff --git a/platform/linuxbsd/x11/detect_prime_x11.cpp b/platform/linuxbsd/x11/detect_prime_x11.cpp index ed046432d8..0f756d10e2 100644 --- a/platform/linuxbsd/x11/detect_prime_x11.cpp +++ b/platform/linuxbsd/x11/detect_prime_x11.cpp @@ -41,8 +41,7 @@ #include "thirdparty/glad/glad/gl.h" #include "thirdparty/glad/glad/glx.h" -#include <X11/Xlib.h> -#include <X11/Xutil.h> +#include "dynwrappers/xlib-so_wrap.h" #include <cstring> @@ -89,6 +88,10 @@ void create_context() { None }; + if (gladLoaderLoadGLX(x11_display, XScreenNumberOfScreen(XDefaultScreenOfDisplay(x11_display))) == 0) { + print_verbose("Unable to load GLX, GPU detection skipped."); + quick_exit(1); + } int fbcount; GLXFBConfig fbconfig = nullptr; XVisualInfo *vi = nullptr; @@ -189,11 +192,6 @@ int detect_prime() { setenv("DRI_PRIME", "1", 1); } - if (gladLoaderLoadGLX(NULL, 0) == 0) { - print_verbose("Unable to load GLX, GPU detection skipped."); - quick_exit(1); - } - create_context(); PFNGLGETSTRINGPROC glGetString = (PFNGLGETSTRINGPROC)glXGetProcAddressARB((GLubyte *)"glGetString"); diff --git a/platform/linuxbsd/x11/display_server_x11.cpp b/platform/linuxbsd/x11/display_server_x11.cpp index cf50748ac8..a5e3e60775 100644 --- a/platform/linuxbsd/x11/display_server_x11.cpp +++ b/platform/linuxbsd/x11/display_server_x11.cpp @@ -58,11 +58,6 @@ #include <sys/types.h> #include <unistd.h> -#include <X11/Xatom.h> -#include <X11/Xutil.h> -#include <X11/extensions/Xinerama.h> -#include <X11/extensions/shape.h> - // ICCCM #define WM_NormalState 1L // window normal state #define WM_IconicState 3L // window minimized @@ -4710,6 +4705,46 @@ DisplayServerX11::WindowID DisplayServerX11::_create_window(WindowMode p_mode, V } DisplayServerX11::DisplayServerX11(const String &p_rendering_driver, WindowMode p_mode, VSyncMode p_vsync_mode, uint32_t p_flags, const Vector2i *p_position, const Vector2i &p_resolution, Error &r_error) { +#ifdef DEBUG_ENABLED + int dylibloader_verbose = 1; +#else + int dylibloader_verbose = 0; +#endif + if (initialize_xlib(dylibloader_verbose) != 0) { + r_error = ERR_UNAVAILABLE; + ERR_FAIL_MSG("Can't load Xlib dynamically."); + } + + if (initialize_xcursor(dylibloader_verbose) != 0) { + r_error = ERR_UNAVAILABLE; + ERR_FAIL_MSG("Can't load XCursor dynamically."); + } + + if (initialize_xext(dylibloader_verbose) != 0) { + r_error = ERR_UNAVAILABLE; + ERR_FAIL_MSG("Can't load Xext dynamically."); + } + + if (initialize_xinerama(dylibloader_verbose) != 0) { + r_error = ERR_UNAVAILABLE; + ERR_FAIL_MSG("Can't load Xinerama dynamically."); + } + + if (initialize_xrandr(dylibloader_verbose) != 0) { + r_error = ERR_UNAVAILABLE; + ERR_FAIL_MSG("Can't load Xrandr dynamically."); + } + + if (initialize_xrender(dylibloader_verbose) != 0) { + r_error = ERR_UNAVAILABLE; + ERR_FAIL_MSG("Can't load Xrender dynamically."); + } + + if (initialize_xinput2(dylibloader_verbose) != 0) { + r_error = ERR_UNAVAILABLE; + ERR_FAIL_MSG("Can't load Xinput2 dynamically."); + } + Input::get_singleton()->set_event_dispatch_function(_dispatch_input_events); r_error = OK; @@ -4910,7 +4945,7 @@ DisplayServerX11::DisplayServerX11(const String &p_rendering_driver, WindowMode gl_manager = memnew(GLManager_X11(p_resolution, opengl_api_type)); - if (gl_manager->initialize() != OK) { + if (gl_manager->initialize(x11_display) != OK) { memdelete(gl_manager); gl_manager = nullptr; r_error = ERR_UNAVAILABLE; diff --git a/platform/linuxbsd/x11/display_server_x11.h b/platform/linuxbsd/x11/display_server_x11.h index 4be8c3a534..c88a6b466a 100644 --- a/platform/linuxbsd/x11/display_server_x11.h +++ b/platform/linuxbsd/x11/display_server_x11.h @@ -64,12 +64,20 @@ #include "../freedesktop_screensaver.h" #endif -#include <X11/Xcursor/Xcursor.h> +#include <X11/Xatom.h> #include <X11/Xlib.h> -#include <X11/extensions/XInput2.h> -#include <X11/extensions/Xrandr.h> +#include <X11/Xutil.h> #include <X11/keysym.h> +#include "dynwrappers/xlib-so_wrap.h" + +#include "dynwrappers/xcursor-so_wrap.h" +#include "dynwrappers/xext-so_wrap.h" +#include "dynwrappers/xinerama-so_wrap.h" +#include "dynwrappers/xinput2-so_wrap.h" +#include "dynwrappers/xrandr-so_wrap.h" +#include "dynwrappers/xrender-so_wrap.h" + typedef struct _xrr_monitor_info { Atom name; Bool primary = false; diff --git a/platform/linuxbsd/x11/dynwrappers/xcursor-so_wrap.c b/platform/linuxbsd/x11/dynwrappers/xcursor-so_wrap.c new file mode 100644 index 0000000000..d689ff1aa8 --- /dev/null +++ b/platform/linuxbsd/x11/dynwrappers/xcursor-so_wrap.c @@ -0,0 +1,676 @@ +// This file is generated. Do not edit! +// see https://github.com/hpvb/dynload-wrapper for details +// generated by ./generate-wrapper.py 0.3 on 2022-12-02 12:48:06 +// flags: ./generate-wrapper.py --include /usr/include/X11/Xcursor/Xcursor.h --sys-include <X11/Xcursor/Xcursor.h> --soname libXcursor.so.1 --init-name xcursor --output-header xcursor-so_wrap.h --output-implementation xcursor-so_wrap.c +// +// NOTE: Generated from Xcursor 1.2.0. +// This has been handpatched to workaround some issues with the generator that +// will be eventually fixed. In this case, non-existant symbols inherited from +// libX11, but absent in libXcursor.so.1, were removed. +#include <stdint.h> + +#define XcursorImageCreate XcursorImageCreate_dylibloader_orig_xcursor +#define XcursorImageDestroy XcursorImageDestroy_dylibloader_orig_xcursor +#define XcursorImagesCreate XcursorImagesCreate_dylibloader_orig_xcursor +#define XcursorImagesDestroy XcursorImagesDestroy_dylibloader_orig_xcursor +#define XcursorImagesSetName XcursorImagesSetName_dylibloader_orig_xcursor +#define XcursorCursorsCreate XcursorCursorsCreate_dylibloader_orig_xcursor +#define XcursorCursorsDestroy XcursorCursorsDestroy_dylibloader_orig_xcursor +#define XcursorAnimateCreate XcursorAnimateCreate_dylibloader_orig_xcursor +#define XcursorAnimateDestroy XcursorAnimateDestroy_dylibloader_orig_xcursor +#define XcursorAnimateNext XcursorAnimateNext_dylibloader_orig_xcursor +#define XcursorCommentCreate XcursorCommentCreate_dylibloader_orig_xcursor +#define XcursorCommentDestroy XcursorCommentDestroy_dylibloader_orig_xcursor +#define XcursorCommentsCreate XcursorCommentsCreate_dylibloader_orig_xcursor +#define XcursorCommentsDestroy XcursorCommentsDestroy_dylibloader_orig_xcursor +#define XcursorXcFileLoadImage XcursorXcFileLoadImage_dylibloader_orig_xcursor +#define XcursorXcFileLoadImages XcursorXcFileLoadImages_dylibloader_orig_xcursor +#define XcursorXcFileLoadAllImages XcursorXcFileLoadAllImages_dylibloader_orig_xcursor +#define XcursorXcFileLoad XcursorXcFileLoad_dylibloader_orig_xcursor +#define XcursorXcFileSave XcursorXcFileSave_dylibloader_orig_xcursor +#define XcursorFileLoadImage XcursorFileLoadImage_dylibloader_orig_xcursor +#define XcursorFileLoadImages XcursorFileLoadImages_dylibloader_orig_xcursor +#define XcursorFileLoadAllImages XcursorFileLoadAllImages_dylibloader_orig_xcursor +#define XcursorFileLoad XcursorFileLoad_dylibloader_orig_xcursor +#define XcursorFileSaveImages XcursorFileSaveImages_dylibloader_orig_xcursor +#define XcursorFileSave XcursorFileSave_dylibloader_orig_xcursor +#define XcursorFilenameLoadImage XcursorFilenameLoadImage_dylibloader_orig_xcursor +#define XcursorFilenameLoadImages XcursorFilenameLoadImages_dylibloader_orig_xcursor +#define XcursorFilenameLoadAllImages XcursorFilenameLoadAllImages_dylibloader_orig_xcursor +#define XcursorFilenameLoad XcursorFilenameLoad_dylibloader_orig_xcursor +#define XcursorFilenameSaveImages XcursorFilenameSaveImages_dylibloader_orig_xcursor +#define XcursorFilenameSave XcursorFilenameSave_dylibloader_orig_xcursor +#define XcursorLibraryLoadImage XcursorLibraryLoadImage_dylibloader_orig_xcursor +#define XcursorLibraryLoadImages XcursorLibraryLoadImages_dylibloader_orig_xcursor +#define XcursorLibraryPath XcursorLibraryPath_dylibloader_orig_xcursor +#define XcursorLibraryShape XcursorLibraryShape_dylibloader_orig_xcursor +#define XcursorImageLoadCursor XcursorImageLoadCursor_dylibloader_orig_xcursor +#define XcursorImagesLoadCursors XcursorImagesLoadCursors_dylibloader_orig_xcursor +#define XcursorImagesLoadCursor XcursorImagesLoadCursor_dylibloader_orig_xcursor +#define XcursorFilenameLoadCursor XcursorFilenameLoadCursor_dylibloader_orig_xcursor +#define XcursorFilenameLoadCursors XcursorFilenameLoadCursors_dylibloader_orig_xcursor +#define XcursorLibraryLoadCursor XcursorLibraryLoadCursor_dylibloader_orig_xcursor +#define XcursorLibraryLoadCursors XcursorLibraryLoadCursors_dylibloader_orig_xcursor +#define XcursorShapeLoadImage XcursorShapeLoadImage_dylibloader_orig_xcursor +#define XcursorShapeLoadImages XcursorShapeLoadImages_dylibloader_orig_xcursor +#define XcursorShapeLoadCursor XcursorShapeLoadCursor_dylibloader_orig_xcursor +#define XcursorShapeLoadCursors XcursorShapeLoadCursors_dylibloader_orig_xcursor +#define XcursorTryShapeCursor XcursorTryShapeCursor_dylibloader_orig_xcursor +#define XcursorNoticeCreateBitmap XcursorNoticeCreateBitmap_dylibloader_orig_xcursor +#define XcursorNoticePutBitmap XcursorNoticePutBitmap_dylibloader_orig_xcursor +#define XcursorTryShapeBitmapCursor XcursorTryShapeBitmapCursor_dylibloader_orig_xcursor +#define XcursorImageHash XcursorImageHash_dylibloader_orig_xcursor +#define XcursorSupportsARGB XcursorSupportsARGB_dylibloader_orig_xcursor +#define XcursorSupportsAnim XcursorSupportsAnim_dylibloader_orig_xcursor +#define XcursorSetDefaultSize XcursorSetDefaultSize_dylibloader_orig_xcursor +#define XcursorGetDefaultSize XcursorGetDefaultSize_dylibloader_orig_xcursor +#define XcursorSetTheme XcursorSetTheme_dylibloader_orig_xcursor +#define XcursorGetTheme XcursorGetTheme_dylibloader_orig_xcursor +#define XcursorGetThemeCore XcursorGetThemeCore_dylibloader_orig_xcursor +#define XcursorSetThemeCore XcursorSetThemeCore_dylibloader_orig_xcursor +#include <X11/Xcursor/Xcursor.h> +#undef XcursorImageCreate +#undef XcursorImageDestroy +#undef XcursorImagesCreate +#undef XcursorImagesDestroy +#undef XcursorImagesSetName +#undef XcursorCursorsCreate +#undef XcursorCursorsDestroy +#undef XcursorAnimateCreate +#undef XcursorAnimateDestroy +#undef XcursorAnimateNext +#undef XcursorCommentCreate +#undef XcursorCommentDestroy +#undef XcursorCommentsCreate +#undef XcursorCommentsDestroy +#undef XcursorXcFileLoadImage +#undef XcursorXcFileLoadImages +#undef XcursorXcFileLoadAllImages +#undef XcursorXcFileLoad +#undef XcursorXcFileSave +#undef XcursorFileLoadImage +#undef XcursorFileLoadImages +#undef XcursorFileLoadAllImages +#undef XcursorFileLoad +#undef XcursorFileSaveImages +#undef XcursorFileSave +#undef XcursorFilenameLoadImage +#undef XcursorFilenameLoadImages +#undef XcursorFilenameLoadAllImages +#undef XcursorFilenameLoad +#undef XcursorFilenameSaveImages +#undef XcursorFilenameSave +#undef XcursorLibraryLoadImage +#undef XcursorLibraryLoadImages +#undef XcursorLibraryPath +#undef XcursorLibraryShape +#undef XcursorImageLoadCursor +#undef XcursorImagesLoadCursors +#undef XcursorImagesLoadCursor +#undef XcursorFilenameLoadCursor +#undef XcursorFilenameLoadCursors +#undef XcursorLibraryLoadCursor +#undef XcursorLibraryLoadCursors +#undef XcursorShapeLoadImage +#undef XcursorShapeLoadImages +#undef XcursorShapeLoadCursor +#undef XcursorShapeLoadCursors +#undef XcursorTryShapeCursor +#undef XcursorNoticeCreateBitmap +#undef XcursorNoticePutBitmap +#undef XcursorTryShapeBitmapCursor +#undef XcursorImageHash +#undef XcursorSupportsARGB +#undef XcursorSupportsAnim +#undef XcursorSetDefaultSize +#undef XcursorGetDefaultSize +#undef XcursorSetTheme +#undef XcursorGetTheme +#undef XcursorGetThemeCore +#undef XcursorSetThemeCore +#include <dlfcn.h> +#include <stdio.h> +XcursorImage* (*XcursorImageCreate_dylibloader_wrapper_xcursor)( int, int); +void (*XcursorImageDestroy_dylibloader_wrapper_xcursor)( XcursorImage*); +XcursorImages* (*XcursorImagesCreate_dylibloader_wrapper_xcursor)( int); +void (*XcursorImagesDestroy_dylibloader_wrapper_xcursor)( XcursorImages*); +void (*XcursorImagesSetName_dylibloader_wrapper_xcursor)( XcursorImages*,const char*); +XcursorCursors* (*XcursorCursorsCreate_dylibloader_wrapper_xcursor)( Display*, int); +void (*XcursorCursorsDestroy_dylibloader_wrapper_xcursor)( XcursorCursors*); +XcursorAnimate* (*XcursorAnimateCreate_dylibloader_wrapper_xcursor)( XcursorCursors*); +void (*XcursorAnimateDestroy_dylibloader_wrapper_xcursor)( XcursorAnimate*); +Cursor (*XcursorAnimateNext_dylibloader_wrapper_xcursor)( XcursorAnimate*); +XcursorComment* (*XcursorCommentCreate_dylibloader_wrapper_xcursor)( XcursorUInt, int); +void (*XcursorCommentDestroy_dylibloader_wrapper_xcursor)( XcursorComment*); +XcursorComments* (*XcursorCommentsCreate_dylibloader_wrapper_xcursor)( int); +void (*XcursorCommentsDestroy_dylibloader_wrapper_xcursor)( XcursorComments*); +XcursorImage* (*XcursorXcFileLoadImage_dylibloader_wrapper_xcursor)( XcursorFile*, int); +XcursorImages* (*XcursorXcFileLoadImages_dylibloader_wrapper_xcursor)( XcursorFile*, int); +XcursorImages* (*XcursorXcFileLoadAllImages_dylibloader_wrapper_xcursor)( XcursorFile*); +XcursorBool (*XcursorXcFileLoad_dylibloader_wrapper_xcursor)( XcursorFile*, XcursorComments**, XcursorImages**); +XcursorBool (*XcursorXcFileSave_dylibloader_wrapper_xcursor)( XcursorFile*,const XcursorComments*,const XcursorImages*); +XcursorImage* (*XcursorFileLoadImage_dylibloader_wrapper_xcursor)( FILE*, int); +XcursorImages* (*XcursorFileLoadImages_dylibloader_wrapper_xcursor)( FILE*, int); +XcursorImages* (*XcursorFileLoadAllImages_dylibloader_wrapper_xcursor)( FILE*); +XcursorBool (*XcursorFileLoad_dylibloader_wrapper_xcursor)( FILE*, XcursorComments**, XcursorImages**); +XcursorBool (*XcursorFileSaveImages_dylibloader_wrapper_xcursor)( FILE*,const XcursorImages*); +XcursorBool (*XcursorFileSave_dylibloader_wrapper_xcursor)( FILE*,const XcursorComments*,const XcursorImages*); +XcursorImage* (*XcursorFilenameLoadImage_dylibloader_wrapper_xcursor)(const char*, int); +XcursorImages* (*XcursorFilenameLoadImages_dylibloader_wrapper_xcursor)(const char*, int); +XcursorImages* (*XcursorFilenameLoadAllImages_dylibloader_wrapper_xcursor)(const char*); +XcursorBool (*XcursorFilenameLoad_dylibloader_wrapper_xcursor)(const char*, XcursorComments**, XcursorImages**); +XcursorBool (*XcursorFilenameSaveImages_dylibloader_wrapper_xcursor)(const char*,const XcursorImages*); +XcursorBool (*XcursorFilenameSave_dylibloader_wrapper_xcursor)(const char*,const XcursorComments*,const XcursorImages*); +XcursorImage* (*XcursorLibraryLoadImage_dylibloader_wrapper_xcursor)(const char*,const char*, int); +XcursorImages* (*XcursorLibraryLoadImages_dylibloader_wrapper_xcursor)(const char*,const char*, int); +const char* (*XcursorLibraryPath_dylibloader_wrapper_xcursor)( void); +int (*XcursorLibraryShape_dylibloader_wrapper_xcursor)(const char*); +Cursor (*XcursorImageLoadCursor_dylibloader_wrapper_xcursor)( Display*,const XcursorImage*); +XcursorCursors* (*XcursorImagesLoadCursors_dylibloader_wrapper_xcursor)( Display*,const XcursorImages*); +Cursor (*XcursorImagesLoadCursor_dylibloader_wrapper_xcursor)( Display*,const XcursorImages*); +Cursor (*XcursorFilenameLoadCursor_dylibloader_wrapper_xcursor)( Display*,const char*); +XcursorCursors* (*XcursorFilenameLoadCursors_dylibloader_wrapper_xcursor)( Display*,const char*); +Cursor (*XcursorLibraryLoadCursor_dylibloader_wrapper_xcursor)( Display*,const char*); +XcursorCursors* (*XcursorLibraryLoadCursors_dylibloader_wrapper_xcursor)( Display*,const char*); +XcursorImage* (*XcursorShapeLoadImage_dylibloader_wrapper_xcursor)( unsigned int,const char*, int); +XcursorImages* (*XcursorShapeLoadImages_dylibloader_wrapper_xcursor)( unsigned int,const char*, int); +Cursor (*XcursorShapeLoadCursor_dylibloader_wrapper_xcursor)( Display*, unsigned int); +XcursorCursors* (*XcursorShapeLoadCursors_dylibloader_wrapper_xcursor)( Display*, unsigned int); +Cursor (*XcursorTryShapeCursor_dylibloader_wrapper_xcursor)( Display*, Font, Font, unsigned int, unsigned int,const XColor*,const XColor*); +void (*XcursorNoticeCreateBitmap_dylibloader_wrapper_xcursor)( Display*, Pixmap, unsigned int, unsigned int); +void (*XcursorNoticePutBitmap_dylibloader_wrapper_xcursor)( Display*, Drawable, XImage*); +Cursor (*XcursorTryShapeBitmapCursor_dylibloader_wrapper_xcursor)( Display*, Pixmap, Pixmap, XColor*, XColor*, unsigned int, unsigned int); +void (*XcursorImageHash_dylibloader_wrapper_xcursor)( XImage*, unsigned char [16]); +XcursorBool (*XcursorSupportsARGB_dylibloader_wrapper_xcursor)( Display*); +XcursorBool (*XcursorSupportsAnim_dylibloader_wrapper_xcursor)( Display*); +XcursorBool (*XcursorSetDefaultSize_dylibloader_wrapper_xcursor)( Display*, int); +int (*XcursorGetDefaultSize_dylibloader_wrapper_xcursor)( Display*); +XcursorBool (*XcursorSetTheme_dylibloader_wrapper_xcursor)( Display*,const char*); +char* (*XcursorGetTheme_dylibloader_wrapper_xcursor)( Display*); +XcursorBool (*XcursorGetThemeCore_dylibloader_wrapper_xcursor)( Display*); +XcursorBool (*XcursorSetThemeCore_dylibloader_wrapper_xcursor)( Display*, XcursorBool); +int initialize_xcursor(int verbose) { + void *handle; + char *error; + handle = dlopen("libXcursor.so.1", RTLD_LAZY); + if (!handle) { + if (verbose) { + fprintf(stderr, "%s\n", dlerror()); + } + return(1); + } + dlerror(); +// XcursorImageCreate + *(void **) (&XcursorImageCreate_dylibloader_wrapper_xcursor) = dlsym(handle, "XcursorImageCreate"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XcursorImageDestroy + *(void **) (&XcursorImageDestroy_dylibloader_wrapper_xcursor) = dlsym(handle, "XcursorImageDestroy"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XcursorImagesCreate + *(void **) (&XcursorImagesCreate_dylibloader_wrapper_xcursor) = dlsym(handle, "XcursorImagesCreate"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XcursorImagesDestroy + *(void **) (&XcursorImagesDestroy_dylibloader_wrapper_xcursor) = dlsym(handle, "XcursorImagesDestroy"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XcursorImagesSetName + *(void **) (&XcursorImagesSetName_dylibloader_wrapper_xcursor) = dlsym(handle, "XcursorImagesSetName"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XcursorCursorsCreate + *(void **) (&XcursorCursorsCreate_dylibloader_wrapper_xcursor) = dlsym(handle, "XcursorCursorsCreate"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XcursorCursorsDestroy + *(void **) (&XcursorCursorsDestroy_dylibloader_wrapper_xcursor) = dlsym(handle, "XcursorCursorsDestroy"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XcursorAnimateCreate + *(void **) (&XcursorAnimateCreate_dylibloader_wrapper_xcursor) = dlsym(handle, "XcursorAnimateCreate"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XcursorAnimateDestroy + *(void **) (&XcursorAnimateDestroy_dylibloader_wrapper_xcursor) = dlsym(handle, "XcursorAnimateDestroy"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XcursorAnimateNext + *(void **) (&XcursorAnimateNext_dylibloader_wrapper_xcursor) = dlsym(handle, "XcursorAnimateNext"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XcursorCommentCreate + *(void **) (&XcursorCommentCreate_dylibloader_wrapper_xcursor) = dlsym(handle, "XcursorCommentCreate"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XcursorCommentDestroy + *(void **) (&XcursorCommentDestroy_dylibloader_wrapper_xcursor) = dlsym(handle, "XcursorCommentDestroy"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XcursorCommentsCreate + *(void **) (&XcursorCommentsCreate_dylibloader_wrapper_xcursor) = dlsym(handle, "XcursorCommentsCreate"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XcursorCommentsDestroy + *(void **) (&XcursorCommentsDestroy_dylibloader_wrapper_xcursor) = dlsym(handle, "XcursorCommentsDestroy"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XcursorXcFileLoadImage + *(void **) (&XcursorXcFileLoadImage_dylibloader_wrapper_xcursor) = dlsym(handle, "XcursorXcFileLoadImage"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XcursorXcFileLoadImages + *(void **) (&XcursorXcFileLoadImages_dylibloader_wrapper_xcursor) = dlsym(handle, "XcursorXcFileLoadImages"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XcursorXcFileLoadAllImages + *(void **) (&XcursorXcFileLoadAllImages_dylibloader_wrapper_xcursor) = dlsym(handle, "XcursorXcFileLoadAllImages"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XcursorXcFileLoad + *(void **) (&XcursorXcFileLoad_dylibloader_wrapper_xcursor) = dlsym(handle, "XcursorXcFileLoad"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XcursorXcFileSave + *(void **) (&XcursorXcFileSave_dylibloader_wrapper_xcursor) = dlsym(handle, "XcursorXcFileSave"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XcursorFileLoadImage + *(void **) (&XcursorFileLoadImage_dylibloader_wrapper_xcursor) = dlsym(handle, "XcursorFileLoadImage"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XcursorFileLoadImages + *(void **) (&XcursorFileLoadImages_dylibloader_wrapper_xcursor) = dlsym(handle, "XcursorFileLoadImages"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XcursorFileLoadAllImages + *(void **) (&XcursorFileLoadAllImages_dylibloader_wrapper_xcursor) = dlsym(handle, "XcursorFileLoadAllImages"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XcursorFileLoad + *(void **) (&XcursorFileLoad_dylibloader_wrapper_xcursor) = dlsym(handle, "XcursorFileLoad"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XcursorFileSaveImages + *(void **) (&XcursorFileSaveImages_dylibloader_wrapper_xcursor) = dlsym(handle, "XcursorFileSaveImages"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XcursorFileSave + *(void **) (&XcursorFileSave_dylibloader_wrapper_xcursor) = dlsym(handle, "XcursorFileSave"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XcursorFilenameLoadImage + *(void **) (&XcursorFilenameLoadImage_dylibloader_wrapper_xcursor) = dlsym(handle, "XcursorFilenameLoadImage"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XcursorFilenameLoadImages + *(void **) (&XcursorFilenameLoadImages_dylibloader_wrapper_xcursor) = dlsym(handle, "XcursorFilenameLoadImages"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XcursorFilenameLoadAllImages + *(void **) (&XcursorFilenameLoadAllImages_dylibloader_wrapper_xcursor) = dlsym(handle, "XcursorFilenameLoadAllImages"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XcursorFilenameLoad + *(void **) (&XcursorFilenameLoad_dylibloader_wrapper_xcursor) = dlsym(handle, "XcursorFilenameLoad"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XcursorFilenameSaveImages + *(void **) (&XcursorFilenameSaveImages_dylibloader_wrapper_xcursor) = dlsym(handle, "XcursorFilenameSaveImages"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XcursorFilenameSave + *(void **) (&XcursorFilenameSave_dylibloader_wrapper_xcursor) = dlsym(handle, "XcursorFilenameSave"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XcursorLibraryLoadImage + *(void **) (&XcursorLibraryLoadImage_dylibloader_wrapper_xcursor) = dlsym(handle, "XcursorLibraryLoadImage"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XcursorLibraryLoadImages + *(void **) (&XcursorLibraryLoadImages_dylibloader_wrapper_xcursor) = dlsym(handle, "XcursorLibraryLoadImages"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XcursorLibraryPath + *(void **) (&XcursorLibraryPath_dylibloader_wrapper_xcursor) = dlsym(handle, "XcursorLibraryPath"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XcursorLibraryShape + *(void **) (&XcursorLibraryShape_dylibloader_wrapper_xcursor) = dlsym(handle, "XcursorLibraryShape"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XcursorImageLoadCursor + *(void **) (&XcursorImageLoadCursor_dylibloader_wrapper_xcursor) = dlsym(handle, "XcursorImageLoadCursor"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XcursorImagesLoadCursors + *(void **) (&XcursorImagesLoadCursors_dylibloader_wrapper_xcursor) = dlsym(handle, "XcursorImagesLoadCursors"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XcursorImagesLoadCursor + *(void **) (&XcursorImagesLoadCursor_dylibloader_wrapper_xcursor) = dlsym(handle, "XcursorImagesLoadCursor"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XcursorFilenameLoadCursor + *(void **) (&XcursorFilenameLoadCursor_dylibloader_wrapper_xcursor) = dlsym(handle, "XcursorFilenameLoadCursor"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XcursorFilenameLoadCursors + *(void **) (&XcursorFilenameLoadCursors_dylibloader_wrapper_xcursor) = dlsym(handle, "XcursorFilenameLoadCursors"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XcursorLibraryLoadCursor + *(void **) (&XcursorLibraryLoadCursor_dylibloader_wrapper_xcursor) = dlsym(handle, "XcursorLibraryLoadCursor"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XcursorLibraryLoadCursors + *(void **) (&XcursorLibraryLoadCursors_dylibloader_wrapper_xcursor) = dlsym(handle, "XcursorLibraryLoadCursors"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XcursorShapeLoadImage + *(void **) (&XcursorShapeLoadImage_dylibloader_wrapper_xcursor) = dlsym(handle, "XcursorShapeLoadImage"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XcursorShapeLoadImages + *(void **) (&XcursorShapeLoadImages_dylibloader_wrapper_xcursor) = dlsym(handle, "XcursorShapeLoadImages"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XcursorShapeLoadCursor + *(void **) (&XcursorShapeLoadCursor_dylibloader_wrapper_xcursor) = dlsym(handle, "XcursorShapeLoadCursor"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XcursorShapeLoadCursors + *(void **) (&XcursorShapeLoadCursors_dylibloader_wrapper_xcursor) = dlsym(handle, "XcursorShapeLoadCursors"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XcursorTryShapeCursor + *(void **) (&XcursorTryShapeCursor_dylibloader_wrapper_xcursor) = dlsym(handle, "XcursorTryShapeCursor"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XcursorNoticeCreateBitmap + *(void **) (&XcursorNoticeCreateBitmap_dylibloader_wrapper_xcursor) = dlsym(handle, "XcursorNoticeCreateBitmap"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XcursorNoticePutBitmap + *(void **) (&XcursorNoticePutBitmap_dylibloader_wrapper_xcursor) = dlsym(handle, "XcursorNoticePutBitmap"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XcursorTryShapeBitmapCursor + *(void **) (&XcursorTryShapeBitmapCursor_dylibloader_wrapper_xcursor) = dlsym(handle, "XcursorTryShapeBitmapCursor"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XcursorImageHash + *(void **) (&XcursorImageHash_dylibloader_wrapper_xcursor) = dlsym(handle, "XcursorImageHash"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XcursorSupportsARGB + *(void **) (&XcursorSupportsARGB_dylibloader_wrapper_xcursor) = dlsym(handle, "XcursorSupportsARGB"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XcursorSupportsAnim + *(void **) (&XcursorSupportsAnim_dylibloader_wrapper_xcursor) = dlsym(handle, "XcursorSupportsAnim"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XcursorSetDefaultSize + *(void **) (&XcursorSetDefaultSize_dylibloader_wrapper_xcursor) = dlsym(handle, "XcursorSetDefaultSize"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XcursorGetDefaultSize + *(void **) (&XcursorGetDefaultSize_dylibloader_wrapper_xcursor) = dlsym(handle, "XcursorGetDefaultSize"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XcursorSetTheme + *(void **) (&XcursorSetTheme_dylibloader_wrapper_xcursor) = dlsym(handle, "XcursorSetTheme"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XcursorGetTheme + *(void **) (&XcursorGetTheme_dylibloader_wrapper_xcursor) = dlsym(handle, "XcursorGetTheme"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XcursorGetThemeCore + *(void **) (&XcursorGetThemeCore_dylibloader_wrapper_xcursor) = dlsym(handle, "XcursorGetThemeCore"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XcursorSetThemeCore + *(void **) (&XcursorSetThemeCore_dylibloader_wrapper_xcursor) = dlsym(handle, "XcursorSetThemeCore"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +return 0; +} diff --git a/platform/linuxbsd/x11/dynwrappers/xcursor-so_wrap.h b/platform/linuxbsd/x11/dynwrappers/xcursor-so_wrap.h new file mode 100644 index 0000000000..43bbcf62c5 --- /dev/null +++ b/platform/linuxbsd/x11/dynwrappers/xcursor-so_wrap.h @@ -0,0 +1,258 @@ +#ifndef DYLIBLOAD_WRAPPER_XCURSOR +#define DYLIBLOAD_WRAPPER_XCURSOR +// This file is generated. Do not edit! +// see https://github.com/hpvb/dynload-wrapper for details +// generated by ./generate-wrapper.py 0.3 on 2022-12-02 12:48:06 +// flags: ./generate-wrapper.py --include /usr/include/X11/Xcursor/Xcursor.h --sys-include <X11/Xcursor/Xcursor.h> --soname libXcursor.so.1 --init-name xcursor --output-header xcursor-so_wrap.h --output-implementation xcursor-so_wrap.c +// +// NOTE: Generated from Xcursor 1.2.0. +// This has been handpatched to workaround some issues with the generator that +// will be eventually fixed. In this case, non-existant symbols inherited from +// libX11, but absent in libXcursor.so.1, were removed. +#include <stdint.h> + +#define XcursorImageCreate XcursorImageCreate_dylibloader_orig_xcursor +#define XcursorImageDestroy XcursorImageDestroy_dylibloader_orig_xcursor +#define XcursorImagesCreate XcursorImagesCreate_dylibloader_orig_xcursor +#define XcursorImagesDestroy XcursorImagesDestroy_dylibloader_orig_xcursor +#define XcursorImagesSetName XcursorImagesSetName_dylibloader_orig_xcursor +#define XcursorCursorsCreate XcursorCursorsCreate_dylibloader_orig_xcursor +#define XcursorCursorsDestroy XcursorCursorsDestroy_dylibloader_orig_xcursor +#define XcursorAnimateCreate XcursorAnimateCreate_dylibloader_orig_xcursor +#define XcursorAnimateDestroy XcursorAnimateDestroy_dylibloader_orig_xcursor +#define XcursorAnimateNext XcursorAnimateNext_dylibloader_orig_xcursor +#define XcursorCommentCreate XcursorCommentCreate_dylibloader_orig_xcursor +#define XcursorCommentDestroy XcursorCommentDestroy_dylibloader_orig_xcursor +#define XcursorCommentsCreate XcursorCommentsCreate_dylibloader_orig_xcursor +#define XcursorCommentsDestroy XcursorCommentsDestroy_dylibloader_orig_xcursor +#define XcursorXcFileLoadImage XcursorXcFileLoadImage_dylibloader_orig_xcursor +#define XcursorXcFileLoadImages XcursorXcFileLoadImages_dylibloader_orig_xcursor +#define XcursorXcFileLoadAllImages XcursorXcFileLoadAllImages_dylibloader_orig_xcursor +#define XcursorXcFileLoad XcursorXcFileLoad_dylibloader_orig_xcursor +#define XcursorXcFileSave XcursorXcFileSave_dylibloader_orig_xcursor +#define XcursorFileLoadImage XcursorFileLoadImage_dylibloader_orig_xcursor +#define XcursorFileLoadImages XcursorFileLoadImages_dylibloader_orig_xcursor +#define XcursorFileLoadAllImages XcursorFileLoadAllImages_dylibloader_orig_xcursor +#define XcursorFileLoad XcursorFileLoad_dylibloader_orig_xcursor +#define XcursorFileSaveImages XcursorFileSaveImages_dylibloader_orig_xcursor +#define XcursorFileSave XcursorFileSave_dylibloader_orig_xcursor +#define XcursorFilenameLoadImage XcursorFilenameLoadImage_dylibloader_orig_xcursor +#define XcursorFilenameLoadImages XcursorFilenameLoadImages_dylibloader_orig_xcursor +#define XcursorFilenameLoadAllImages XcursorFilenameLoadAllImages_dylibloader_orig_xcursor +#define XcursorFilenameLoad XcursorFilenameLoad_dylibloader_orig_xcursor +#define XcursorFilenameSaveImages XcursorFilenameSaveImages_dylibloader_orig_xcursor +#define XcursorFilenameSave XcursorFilenameSave_dylibloader_orig_xcursor +#define XcursorLibraryLoadImage XcursorLibraryLoadImage_dylibloader_orig_xcursor +#define XcursorLibraryLoadImages XcursorLibraryLoadImages_dylibloader_orig_xcursor +#define XcursorLibraryPath XcursorLibraryPath_dylibloader_orig_xcursor +#define XcursorLibraryShape XcursorLibraryShape_dylibloader_orig_xcursor +#define XcursorImageLoadCursor XcursorImageLoadCursor_dylibloader_orig_xcursor +#define XcursorImagesLoadCursors XcursorImagesLoadCursors_dylibloader_orig_xcursor +#define XcursorImagesLoadCursor XcursorImagesLoadCursor_dylibloader_orig_xcursor +#define XcursorFilenameLoadCursor XcursorFilenameLoadCursor_dylibloader_orig_xcursor +#define XcursorFilenameLoadCursors XcursorFilenameLoadCursors_dylibloader_orig_xcursor +#define XcursorLibraryLoadCursor XcursorLibraryLoadCursor_dylibloader_orig_xcursor +#define XcursorLibraryLoadCursors XcursorLibraryLoadCursors_dylibloader_orig_xcursor +#define XcursorShapeLoadImage XcursorShapeLoadImage_dylibloader_orig_xcursor +#define XcursorShapeLoadImages XcursorShapeLoadImages_dylibloader_orig_xcursor +#define XcursorShapeLoadCursor XcursorShapeLoadCursor_dylibloader_orig_xcursor +#define XcursorShapeLoadCursors XcursorShapeLoadCursors_dylibloader_orig_xcursor +#define XcursorTryShapeCursor XcursorTryShapeCursor_dylibloader_orig_xcursor +#define XcursorNoticeCreateBitmap XcursorNoticeCreateBitmap_dylibloader_orig_xcursor +#define XcursorNoticePutBitmap XcursorNoticePutBitmap_dylibloader_orig_xcursor +#define XcursorTryShapeBitmapCursor XcursorTryShapeBitmapCursor_dylibloader_orig_xcursor +#define XcursorImageHash XcursorImageHash_dylibloader_orig_xcursor +#define XcursorSupportsARGB XcursorSupportsARGB_dylibloader_orig_xcursor +#define XcursorSupportsAnim XcursorSupportsAnim_dylibloader_orig_xcursor +#define XcursorSetDefaultSize XcursorSetDefaultSize_dylibloader_orig_xcursor +#define XcursorGetDefaultSize XcursorGetDefaultSize_dylibloader_orig_xcursor +#define XcursorSetTheme XcursorSetTheme_dylibloader_orig_xcursor +#define XcursorGetTheme XcursorGetTheme_dylibloader_orig_xcursor +#define XcursorGetThemeCore XcursorGetThemeCore_dylibloader_orig_xcursor +#define XcursorSetThemeCore XcursorSetThemeCore_dylibloader_orig_xcursor +#include <X11/Xcursor/Xcursor.h> +#undef XcursorImageCreate +#undef XcursorImageDestroy +#undef XcursorImagesCreate +#undef XcursorImagesDestroy +#undef XcursorImagesSetName +#undef XcursorCursorsCreate +#undef XcursorCursorsDestroy +#undef XcursorAnimateCreate +#undef XcursorAnimateDestroy +#undef XcursorAnimateNext +#undef XcursorCommentCreate +#undef XcursorCommentDestroy +#undef XcursorCommentsCreate +#undef XcursorCommentsDestroy +#undef XcursorXcFileLoadImage +#undef XcursorXcFileLoadImages +#undef XcursorXcFileLoadAllImages +#undef XcursorXcFileLoad +#undef XcursorXcFileSave +#undef XcursorFileLoadImage +#undef XcursorFileLoadImages +#undef XcursorFileLoadAllImages +#undef XcursorFileLoad +#undef XcursorFileSaveImages +#undef XcursorFileSave +#undef XcursorFilenameLoadImage +#undef XcursorFilenameLoadImages +#undef XcursorFilenameLoadAllImages +#undef XcursorFilenameLoad +#undef XcursorFilenameSaveImages +#undef XcursorFilenameSave +#undef XcursorLibraryLoadImage +#undef XcursorLibraryLoadImages +#undef XcursorLibraryPath +#undef XcursorLibraryShape +#undef XcursorImageLoadCursor +#undef XcursorImagesLoadCursors +#undef XcursorImagesLoadCursor +#undef XcursorFilenameLoadCursor +#undef XcursorFilenameLoadCursors +#undef XcursorLibraryLoadCursor +#undef XcursorLibraryLoadCursors +#undef XcursorShapeLoadImage +#undef XcursorShapeLoadImages +#undef XcursorShapeLoadCursor +#undef XcursorShapeLoadCursors +#undef XcursorTryShapeCursor +#undef XcursorNoticeCreateBitmap +#undef XcursorNoticePutBitmap +#undef XcursorTryShapeBitmapCursor +#undef XcursorImageHash +#undef XcursorSupportsARGB +#undef XcursorSupportsAnim +#undef XcursorSetDefaultSize +#undef XcursorGetDefaultSize +#undef XcursorSetTheme +#undef XcursorGetTheme +#undef XcursorGetThemeCore +#undef XcursorSetThemeCore +#ifdef __cplusplus +extern "C" { +#endif +#define XcursorImageCreate XcursorImageCreate_dylibloader_wrapper_xcursor +#define XcursorImageDestroy XcursorImageDestroy_dylibloader_wrapper_xcursor +#define XcursorImagesCreate XcursorImagesCreate_dylibloader_wrapper_xcursor +#define XcursorImagesDestroy XcursorImagesDestroy_dylibloader_wrapper_xcursor +#define XcursorImagesSetName XcursorImagesSetName_dylibloader_wrapper_xcursor +#define XcursorCursorsCreate XcursorCursorsCreate_dylibloader_wrapper_xcursor +#define XcursorCursorsDestroy XcursorCursorsDestroy_dylibloader_wrapper_xcursor +#define XcursorAnimateCreate XcursorAnimateCreate_dylibloader_wrapper_xcursor +#define XcursorAnimateDestroy XcursorAnimateDestroy_dylibloader_wrapper_xcursor +#define XcursorAnimateNext XcursorAnimateNext_dylibloader_wrapper_xcursor +#define XcursorCommentCreate XcursorCommentCreate_dylibloader_wrapper_xcursor +#define XcursorCommentDestroy XcursorCommentDestroy_dylibloader_wrapper_xcursor +#define XcursorCommentsCreate XcursorCommentsCreate_dylibloader_wrapper_xcursor +#define XcursorCommentsDestroy XcursorCommentsDestroy_dylibloader_wrapper_xcursor +#define XcursorXcFileLoadImage XcursorXcFileLoadImage_dylibloader_wrapper_xcursor +#define XcursorXcFileLoadImages XcursorXcFileLoadImages_dylibloader_wrapper_xcursor +#define XcursorXcFileLoadAllImages XcursorXcFileLoadAllImages_dylibloader_wrapper_xcursor +#define XcursorXcFileLoad XcursorXcFileLoad_dylibloader_wrapper_xcursor +#define XcursorXcFileSave XcursorXcFileSave_dylibloader_wrapper_xcursor +#define XcursorFileLoadImage XcursorFileLoadImage_dylibloader_wrapper_xcursor +#define XcursorFileLoadImages XcursorFileLoadImages_dylibloader_wrapper_xcursor +#define XcursorFileLoadAllImages XcursorFileLoadAllImages_dylibloader_wrapper_xcursor +#define XcursorFileLoad XcursorFileLoad_dylibloader_wrapper_xcursor +#define XcursorFileSaveImages XcursorFileSaveImages_dylibloader_wrapper_xcursor +#define XcursorFileSave XcursorFileSave_dylibloader_wrapper_xcursor +#define XcursorFilenameLoadImage XcursorFilenameLoadImage_dylibloader_wrapper_xcursor +#define XcursorFilenameLoadImages XcursorFilenameLoadImages_dylibloader_wrapper_xcursor +#define XcursorFilenameLoadAllImages XcursorFilenameLoadAllImages_dylibloader_wrapper_xcursor +#define XcursorFilenameLoad XcursorFilenameLoad_dylibloader_wrapper_xcursor +#define XcursorFilenameSaveImages XcursorFilenameSaveImages_dylibloader_wrapper_xcursor +#define XcursorFilenameSave XcursorFilenameSave_dylibloader_wrapper_xcursor +#define XcursorLibraryLoadImage XcursorLibraryLoadImage_dylibloader_wrapper_xcursor +#define XcursorLibraryLoadImages XcursorLibraryLoadImages_dylibloader_wrapper_xcursor +#define XcursorLibraryPath XcursorLibraryPath_dylibloader_wrapper_xcursor +#define XcursorLibraryShape XcursorLibraryShape_dylibloader_wrapper_xcursor +#define XcursorImageLoadCursor XcursorImageLoadCursor_dylibloader_wrapper_xcursor +#define XcursorImagesLoadCursors XcursorImagesLoadCursors_dylibloader_wrapper_xcursor +#define XcursorImagesLoadCursor XcursorImagesLoadCursor_dylibloader_wrapper_xcursor +#define XcursorFilenameLoadCursor XcursorFilenameLoadCursor_dylibloader_wrapper_xcursor +#define XcursorFilenameLoadCursors XcursorFilenameLoadCursors_dylibloader_wrapper_xcursor +#define XcursorLibraryLoadCursor XcursorLibraryLoadCursor_dylibloader_wrapper_xcursor +#define XcursorLibraryLoadCursors XcursorLibraryLoadCursors_dylibloader_wrapper_xcursor +#define XcursorShapeLoadImage XcursorShapeLoadImage_dylibloader_wrapper_xcursor +#define XcursorShapeLoadImages XcursorShapeLoadImages_dylibloader_wrapper_xcursor +#define XcursorShapeLoadCursor XcursorShapeLoadCursor_dylibloader_wrapper_xcursor +#define XcursorShapeLoadCursors XcursorShapeLoadCursors_dylibloader_wrapper_xcursor +#define XcursorTryShapeCursor XcursorTryShapeCursor_dylibloader_wrapper_xcursor +#define XcursorNoticeCreateBitmap XcursorNoticeCreateBitmap_dylibloader_wrapper_xcursor +#define XcursorNoticePutBitmap XcursorNoticePutBitmap_dylibloader_wrapper_xcursor +#define XcursorTryShapeBitmapCursor XcursorTryShapeBitmapCursor_dylibloader_wrapper_xcursor +#define XcursorImageHash XcursorImageHash_dylibloader_wrapper_xcursor +#define XcursorSupportsARGB XcursorSupportsARGB_dylibloader_wrapper_xcursor +#define XcursorSupportsAnim XcursorSupportsAnim_dylibloader_wrapper_xcursor +#define XcursorSetDefaultSize XcursorSetDefaultSize_dylibloader_wrapper_xcursor +#define XcursorGetDefaultSize XcursorGetDefaultSize_dylibloader_wrapper_xcursor +#define XcursorSetTheme XcursorSetTheme_dylibloader_wrapper_xcursor +#define XcursorGetTheme XcursorGetTheme_dylibloader_wrapper_xcursor +#define XcursorGetThemeCore XcursorGetThemeCore_dylibloader_wrapper_xcursor +#define XcursorSetThemeCore XcursorSetThemeCore_dylibloader_wrapper_xcursor +extern XcursorImage* (*XcursorImageCreate_dylibloader_wrapper_xcursor)( int, int); +extern void (*XcursorImageDestroy_dylibloader_wrapper_xcursor)( XcursorImage*); +extern XcursorImages* (*XcursorImagesCreate_dylibloader_wrapper_xcursor)( int); +extern void (*XcursorImagesDestroy_dylibloader_wrapper_xcursor)( XcursorImages*); +extern void (*XcursorImagesSetName_dylibloader_wrapper_xcursor)( XcursorImages*,const char*); +extern XcursorCursors* (*XcursorCursorsCreate_dylibloader_wrapper_xcursor)( Display*, int); +extern void (*XcursorCursorsDestroy_dylibloader_wrapper_xcursor)( XcursorCursors*); +extern XcursorAnimate* (*XcursorAnimateCreate_dylibloader_wrapper_xcursor)( XcursorCursors*); +extern void (*XcursorAnimateDestroy_dylibloader_wrapper_xcursor)( XcursorAnimate*); +extern Cursor (*XcursorAnimateNext_dylibloader_wrapper_xcursor)( XcursorAnimate*); +extern XcursorComment* (*XcursorCommentCreate_dylibloader_wrapper_xcursor)( XcursorUInt, int); +extern void (*XcursorCommentDestroy_dylibloader_wrapper_xcursor)( XcursorComment*); +extern XcursorComments* (*XcursorCommentsCreate_dylibloader_wrapper_xcursor)( int); +extern void (*XcursorCommentsDestroy_dylibloader_wrapper_xcursor)( XcursorComments*); +extern XcursorImage* (*XcursorXcFileLoadImage_dylibloader_wrapper_xcursor)( XcursorFile*, int); +extern XcursorImages* (*XcursorXcFileLoadImages_dylibloader_wrapper_xcursor)( XcursorFile*, int); +extern XcursorImages* (*XcursorXcFileLoadAllImages_dylibloader_wrapper_xcursor)( XcursorFile*); +extern XcursorBool (*XcursorXcFileLoad_dylibloader_wrapper_xcursor)( XcursorFile*, XcursorComments**, XcursorImages**); +extern XcursorBool (*XcursorXcFileSave_dylibloader_wrapper_xcursor)( XcursorFile*,const XcursorComments*,const XcursorImages*); +extern XcursorImage* (*XcursorFileLoadImage_dylibloader_wrapper_xcursor)( FILE*, int); +extern XcursorImages* (*XcursorFileLoadImages_dylibloader_wrapper_xcursor)( FILE*, int); +extern XcursorImages* (*XcursorFileLoadAllImages_dylibloader_wrapper_xcursor)( FILE*); +extern XcursorBool (*XcursorFileLoad_dylibloader_wrapper_xcursor)( FILE*, XcursorComments**, XcursorImages**); +extern XcursorBool (*XcursorFileSaveImages_dylibloader_wrapper_xcursor)( FILE*,const XcursorImages*); +extern XcursorBool (*XcursorFileSave_dylibloader_wrapper_xcursor)( FILE*,const XcursorComments*,const XcursorImages*); +extern XcursorImage* (*XcursorFilenameLoadImage_dylibloader_wrapper_xcursor)(const char*, int); +extern XcursorImages* (*XcursorFilenameLoadImages_dylibloader_wrapper_xcursor)(const char*, int); +extern XcursorImages* (*XcursorFilenameLoadAllImages_dylibloader_wrapper_xcursor)(const char*); +extern XcursorBool (*XcursorFilenameLoad_dylibloader_wrapper_xcursor)(const char*, XcursorComments**, XcursorImages**); +extern XcursorBool (*XcursorFilenameSaveImages_dylibloader_wrapper_xcursor)(const char*,const XcursorImages*); +extern XcursorBool (*XcursorFilenameSave_dylibloader_wrapper_xcursor)(const char*,const XcursorComments*,const XcursorImages*); +extern XcursorImage* (*XcursorLibraryLoadImage_dylibloader_wrapper_xcursor)(const char*,const char*, int); +extern XcursorImages* (*XcursorLibraryLoadImages_dylibloader_wrapper_xcursor)(const char*,const char*, int); +extern const char* (*XcursorLibraryPath_dylibloader_wrapper_xcursor)( void); +extern int (*XcursorLibraryShape_dylibloader_wrapper_xcursor)(const char*); +extern Cursor (*XcursorImageLoadCursor_dylibloader_wrapper_xcursor)( Display*,const XcursorImage*); +extern XcursorCursors* (*XcursorImagesLoadCursors_dylibloader_wrapper_xcursor)( Display*,const XcursorImages*); +extern Cursor (*XcursorImagesLoadCursor_dylibloader_wrapper_xcursor)( Display*,const XcursorImages*); +extern Cursor (*XcursorFilenameLoadCursor_dylibloader_wrapper_xcursor)( Display*,const char*); +extern XcursorCursors* (*XcursorFilenameLoadCursors_dylibloader_wrapper_xcursor)( Display*,const char*); +extern Cursor (*XcursorLibraryLoadCursor_dylibloader_wrapper_xcursor)( Display*,const char*); +extern XcursorCursors* (*XcursorLibraryLoadCursors_dylibloader_wrapper_xcursor)( Display*,const char*); +extern XcursorImage* (*XcursorShapeLoadImage_dylibloader_wrapper_xcursor)( unsigned int,const char*, int); +extern XcursorImages* (*XcursorShapeLoadImages_dylibloader_wrapper_xcursor)( unsigned int,const char*, int); +extern Cursor (*XcursorShapeLoadCursor_dylibloader_wrapper_xcursor)( Display*, unsigned int); +extern XcursorCursors* (*XcursorShapeLoadCursors_dylibloader_wrapper_xcursor)( Display*, unsigned int); +extern Cursor (*XcursorTryShapeCursor_dylibloader_wrapper_xcursor)( Display*, Font, Font, unsigned int, unsigned int,const XColor*,const XColor*); +extern void (*XcursorNoticeCreateBitmap_dylibloader_wrapper_xcursor)( Display*, Pixmap, unsigned int, unsigned int); +extern void (*XcursorNoticePutBitmap_dylibloader_wrapper_xcursor)( Display*, Drawable, XImage*); +extern Cursor (*XcursorTryShapeBitmapCursor_dylibloader_wrapper_xcursor)( Display*, Pixmap, Pixmap, XColor*, XColor*, unsigned int, unsigned int); +extern void (*XcursorImageHash_dylibloader_wrapper_xcursor)( XImage*, unsigned char [16]); +extern XcursorBool (*XcursorSupportsARGB_dylibloader_wrapper_xcursor)( Display*); +extern XcursorBool (*XcursorSupportsAnim_dylibloader_wrapper_xcursor)( Display*); +extern XcursorBool (*XcursorSetDefaultSize_dylibloader_wrapper_xcursor)( Display*, int); +extern int (*XcursorGetDefaultSize_dylibloader_wrapper_xcursor)( Display*); +extern XcursorBool (*XcursorSetTheme_dylibloader_wrapper_xcursor)( Display*,const char*); +extern char* (*XcursorGetTheme_dylibloader_wrapper_xcursor)( Display*); +extern XcursorBool (*XcursorGetThemeCore_dylibloader_wrapper_xcursor)( Display*); +extern XcursorBool (*XcursorSetThemeCore_dylibloader_wrapper_xcursor)( Display*, XcursorBool); +int initialize_xcursor(int verbose); +#ifdef __cplusplus +} +#endif +#endif diff --git a/platform/linuxbsd/x11/dynwrappers/xext-so_wrap.c b/platform/linuxbsd/x11/dynwrappers/xext-so_wrap.c new file mode 100644 index 0000000000..711dd3fa5e --- /dev/null +++ b/platform/linuxbsd/x11/dynwrappers/xext-so_wrap.c @@ -0,0 +1,154 @@ +// This file is generated. Do not edit! +// see https://github.com/hpvb/dynload-wrapper for details +// generated by ./generate-wrapper.py 0.3 on 2022-12-02 12:51:55 +// flags: ./generate-wrapper.py --include /usr/include/X11/extensions/Xext.h --sys-include <X11/extensions/Xext.h> --include /usr/include/X11/extensions/shape.h --sys-include <X11/extensions/shape.h> --soname libXext.so.6 --init-name xext --output-header xext-so_wrap.h --output-implementation xext-so_wrap.c +// +// NOTE: Generated from Xext 1.3.5. +// This has been handpatched to workaround some issues with the generator that +// will be eventually fixed. In this case, non-existant symbols inherited from +// libX11, but absent in libXext.so.6, were removed and an include needed for +// proper parsing was added (this had also to be temporarily added to the +// original header, as dynload-wrapper would complain otherwsise) +#include <stdint.h> + +// HANDPATCH: Needed for a successful compilation. +#include <X11/Xlib.h> + +#define XShapeQueryExtension XShapeQueryExtension_dylibloader_orig_xext +#define XShapeQueryVersion XShapeQueryVersion_dylibloader_orig_xext +#define XShapeCombineRegion XShapeCombineRegion_dylibloader_orig_xext +#define XShapeCombineRectangles XShapeCombineRectangles_dylibloader_orig_xext +#define XShapeCombineMask XShapeCombineMask_dylibloader_orig_xext +#define XShapeCombineShape XShapeCombineShape_dylibloader_orig_xext +#define XShapeOffsetShape XShapeOffsetShape_dylibloader_orig_xext +#define XShapeQueryExtents XShapeQueryExtents_dylibloader_orig_xext +#define XShapeSelectInput XShapeSelectInput_dylibloader_orig_xext +#define XShapeInputSelected XShapeInputSelected_dylibloader_orig_xext +#define XShapeGetRectangles XShapeGetRectangles_dylibloader_orig_xext +#include <X11/extensions/Xext.h> +#include <X11/extensions/shape.h> +#undef XShapeQueryExtension +#undef XShapeQueryVersion +#undef XShapeCombineRegion +#undef XShapeCombineRectangles +#undef XShapeCombineMask +#undef XShapeCombineShape +#undef XShapeOffsetShape +#undef XShapeQueryExtents +#undef XShapeSelectInput +#undef XShapeInputSelected +#undef XShapeGetRectangles +#include <dlfcn.h> +#include <stdio.h> +int (*XShapeQueryExtension_dylibloader_wrapper_xext)( Display*, int*, int*); +int (*XShapeQueryVersion_dylibloader_wrapper_xext)( Display*, int*, int*); +void (*XShapeCombineRegion_dylibloader_wrapper_xext)( Display*, Window, int, int, int, Region, int); +void (*XShapeCombineRectangles_dylibloader_wrapper_xext)( Display*, Window, int, int, int, XRectangle*, int, int, int); +void (*XShapeCombineMask_dylibloader_wrapper_xext)( Display*, Window, int, int, int, Pixmap, int); +void (*XShapeCombineShape_dylibloader_wrapper_xext)( Display*, Window, int, int, int, Window, int, int); +void (*XShapeOffsetShape_dylibloader_wrapper_xext)( Display*, Window, int, int, int); +int (*XShapeQueryExtents_dylibloader_wrapper_xext)( Display*, Window, int*, int*, int*, unsigned int*, unsigned int*, int*, int*, int*, unsigned int*, unsigned int*); +void (*XShapeSelectInput_dylibloader_wrapper_xext)( Display*, Window, unsigned long); +unsigned long (*XShapeInputSelected_dylibloader_wrapper_xext)( Display*, Window); +XRectangle* (*XShapeGetRectangles_dylibloader_wrapper_xext)( Display*, Window, int, int*, int*); +int initialize_xext(int verbose) { + void *handle; + char *error; + handle = dlopen("libXext.so.6", RTLD_LAZY); + if (!handle) { + if (verbose) { + fprintf(stderr, "%s\n", dlerror()); + } + return(1); + } + dlerror(); +// XShapeQueryExtension + *(void **) (&XShapeQueryExtension_dylibloader_wrapper_xext) = dlsym(handle, "XShapeQueryExtension"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XShapeQueryVersion + *(void **) (&XShapeQueryVersion_dylibloader_wrapper_xext) = dlsym(handle, "XShapeQueryVersion"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XShapeCombineRegion + *(void **) (&XShapeCombineRegion_dylibloader_wrapper_xext) = dlsym(handle, "XShapeCombineRegion"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XShapeCombineRectangles + *(void **) (&XShapeCombineRectangles_dylibloader_wrapper_xext) = dlsym(handle, "XShapeCombineRectangles"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XShapeCombineMask + *(void **) (&XShapeCombineMask_dylibloader_wrapper_xext) = dlsym(handle, "XShapeCombineMask"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XShapeCombineShape + *(void **) (&XShapeCombineShape_dylibloader_wrapper_xext) = dlsym(handle, "XShapeCombineShape"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XShapeOffsetShape + *(void **) (&XShapeOffsetShape_dylibloader_wrapper_xext) = dlsym(handle, "XShapeOffsetShape"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XShapeQueryExtents + *(void **) (&XShapeQueryExtents_dylibloader_wrapper_xext) = dlsym(handle, "XShapeQueryExtents"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XShapeSelectInput + *(void **) (&XShapeSelectInput_dylibloader_wrapper_xext) = dlsym(handle, "XShapeSelectInput"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XShapeInputSelected + *(void **) (&XShapeInputSelected_dylibloader_wrapper_xext) = dlsym(handle, "XShapeInputSelected"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XShapeGetRectangles + *(void **) (&XShapeGetRectangles_dylibloader_wrapper_xext) = dlsym(handle, "XShapeGetRectangles"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +return 0; +} diff --git a/platform/linuxbsd/x11/dynwrappers/xext-so_wrap.h b/platform/linuxbsd/x11/dynwrappers/xext-so_wrap.h new file mode 100644 index 0000000000..991d07b405 --- /dev/null +++ b/platform/linuxbsd/x11/dynwrappers/xext-so_wrap.h @@ -0,0 +1,72 @@ +#ifndef DYLIBLOAD_WRAPPER_XEXT +#define DYLIBLOAD_WRAPPER_XEXT +// This file is generated. Do not edit! +// see https://github.com/hpvb/dynload-wrapper for details +// generated by ./generate-wrapper.py 0.3 on 2022-12-02 12:51:55 +// flags: ./generate-wrapper.py --include /usr/include/X11/extensions/Xext.h --sys-include <X11/extensions/Xext.h> --include /usr/include/X11/extensions/shape.h --sys-include <X11/extensions/shape.h> --soname libXext.so.6 --init-name xext --output-header xext-so_wrap.h --output-implementation xext-so_wrap.c +// +// NOTE: Generated from Xext 1.3.5. +// This has been handpatched to workaround some issues with the generator that +// will be eventually fixed. In this case, non-existant symbols inherited from +// libX11, but absent in libXext.so.6, were removed and an include needed for +// proper parsing was added (this had also to be temporarily added to the +// original header, as dynload-wrapper would complain otherwsise) +#include <stdint.h> + +// HANDPATCH: Needed for a successful compilation. +#include <X11/Xlib.h> + +#define XShapeQueryExtension XShapeQueryExtension_dylibloader_orig_xext +#define XShapeQueryVersion XShapeQueryVersion_dylibloader_orig_xext +#define XShapeCombineRegion XShapeCombineRegion_dylibloader_orig_xext +#define XShapeCombineRectangles XShapeCombineRectangles_dylibloader_orig_xext +#define XShapeCombineMask XShapeCombineMask_dylibloader_orig_xext +#define XShapeCombineShape XShapeCombineShape_dylibloader_orig_xext +#define XShapeOffsetShape XShapeOffsetShape_dylibloader_orig_xext +#define XShapeQueryExtents XShapeQueryExtents_dylibloader_orig_xext +#define XShapeSelectInput XShapeSelectInput_dylibloader_orig_xext +#define XShapeInputSelected XShapeInputSelected_dylibloader_orig_xext +#define XShapeGetRectangles XShapeGetRectangles_dylibloader_orig_xext +#include <X11/extensions/Xext.h> +#include <X11/extensions/shape.h> +#undef XShapeQueryExtension +#undef XShapeQueryVersion +#undef XShapeCombineRegion +#undef XShapeCombineRectangles +#undef XShapeCombineMask +#undef XShapeCombineShape +#undef XShapeOffsetShape +#undef XShapeQueryExtents +#undef XShapeSelectInput +#undef XShapeInputSelected +#undef XShapeGetRectangles +#ifdef __cplusplus +extern "C" { +#endif +#define XShapeQueryExtension XShapeQueryExtension_dylibloader_wrapper_xext +#define XShapeQueryVersion XShapeQueryVersion_dylibloader_wrapper_xext +#define XShapeCombineRegion XShapeCombineRegion_dylibloader_wrapper_xext +#define XShapeCombineRectangles XShapeCombineRectangles_dylibloader_wrapper_xext +#define XShapeCombineMask XShapeCombineMask_dylibloader_wrapper_xext +#define XShapeCombineShape XShapeCombineShape_dylibloader_wrapper_xext +#define XShapeOffsetShape XShapeOffsetShape_dylibloader_wrapper_xext +#define XShapeQueryExtents XShapeQueryExtents_dylibloader_wrapper_xext +#define XShapeSelectInput XShapeSelectInput_dylibloader_wrapper_xext +#define XShapeInputSelected XShapeInputSelected_dylibloader_wrapper_xext +#define XShapeGetRectangles XShapeGetRectangles_dylibloader_wrapper_xext +extern int (*XShapeQueryExtension_dylibloader_wrapper_xext)( Display*, int*, int*); +extern int (*XShapeQueryVersion_dylibloader_wrapper_xext)( Display*, int*, int*); +extern void (*XShapeCombineRegion_dylibloader_wrapper_xext)( Display*, Window, int, int, int, Region, int); +extern void (*XShapeCombineRectangles_dylibloader_wrapper_xext)( Display*, Window, int, int, int, XRectangle*, int, int, int); +extern void (*XShapeCombineMask_dylibloader_wrapper_xext)( Display*, Window, int, int, int, Pixmap, int); +extern void (*XShapeCombineShape_dylibloader_wrapper_xext)( Display*, Window, int, int, int, Window, int, int); +extern void (*XShapeOffsetShape_dylibloader_wrapper_xext)( Display*, Window, int, int, int); +extern int (*XShapeQueryExtents_dylibloader_wrapper_xext)( Display*, Window, int*, int*, int*, unsigned int*, unsigned int*, int*, int*, int*, unsigned int*, unsigned int*); +extern void (*XShapeSelectInput_dylibloader_wrapper_xext)( Display*, Window, unsigned long); +extern unsigned long (*XShapeInputSelected_dylibloader_wrapper_xext)( Display*, Window); +extern XRectangle* (*XShapeGetRectangles_dylibloader_wrapper_xext)( Display*, Window, int, int*, int*); +int initialize_xext(int verbose); +#ifdef __cplusplus +} +#endif +#endif diff --git a/platform/linuxbsd/x11/dynwrappers/xinerama-so_wrap.c b/platform/linuxbsd/x11/dynwrappers/xinerama-so_wrap.c new file mode 100644 index 0000000000..42af983345 --- /dev/null +++ b/platform/linuxbsd/x11/dynwrappers/xinerama-so_wrap.c @@ -0,0 +1,71 @@ +// This file is generated. Do not edit! +// see https://github.com/hpvb/dynload-wrapper for details +// generated by ./generate-wrapper.py 0.3 on 2022-12-02 12:53:11 +// flags: ./generate-wrapper.py --include /usr/include/X11/extensions/Xinerama.h --sys-include <X11/extensions/Xinerama.h> --soname libXinerama.so.1 --init-name xinerama --output-header xinerama-so_wrap.h --output-implementation xinerama-so_wrap.c +// +// NOTE: Generated from Xinerama 1.1.4. +// This has been handpatched to workaround some issues with the generator that +// will be eventually fixed. In this case, non-existant symbols inherited from +// libX11, but absent in libXinerama.so.1, were removed. +#include <stdint.h> + +#define XineramaQueryExtension XineramaQueryExtension_dylibloader_orig_xinerama +#define XineramaQueryVersion XineramaQueryVersion_dylibloader_orig_xinerama +#define XineramaIsActive XineramaIsActive_dylibloader_orig_xinerama +#define XineramaQueryScreens XineramaQueryScreens_dylibloader_orig_xinerama +#include <X11/extensions/Xinerama.h> +#undef XineramaQueryExtension +#undef XineramaQueryVersion +#undef XineramaIsActive +#undef XineramaQueryScreens +#include <dlfcn.h> +#include <stdio.h> +int (*XineramaQueryExtension_dylibloader_wrapper_xinerama)( Display*, int*, int*); +int (*XineramaQueryVersion_dylibloader_wrapper_xinerama)( Display*, int*, int*); +int (*XineramaIsActive_dylibloader_wrapper_xinerama)( Display*); +XineramaScreenInfo* (*XineramaQueryScreens_dylibloader_wrapper_xinerama)( Display*, int*); +int initialize_xinerama(int verbose) { + void *handle; + char *error; + handle = dlopen("libXinerama.so.1", RTLD_LAZY); + if (!handle) { + if (verbose) { + fprintf(stderr, "%s\n", dlerror()); + } + return(1); + } + dlerror(); +// XineramaQueryExtension + *(void **) (&XineramaQueryExtension_dylibloader_wrapper_xinerama) = dlsym(handle, "XineramaQueryExtension"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XineramaQueryVersion + *(void **) (&XineramaQueryVersion_dylibloader_wrapper_xinerama) = dlsym(handle, "XineramaQueryVersion"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XineramaIsActive + *(void **) (&XineramaIsActive_dylibloader_wrapper_xinerama) = dlsym(handle, "XineramaIsActive"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XineramaQueryScreens + *(void **) (&XineramaQueryScreens_dylibloader_wrapper_xinerama) = dlsym(handle, "XineramaQueryScreens"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +return 0; +} diff --git a/platform/linuxbsd/x11/dynwrappers/xinerama-so_wrap.h b/platform/linuxbsd/x11/dynwrappers/xinerama-so_wrap.h new file mode 100644 index 0000000000..891d9f21fd --- /dev/null +++ b/platform/linuxbsd/x11/dynwrappers/xinerama-so_wrap.h @@ -0,0 +1,38 @@ +#ifndef DYLIBLOAD_WRAPPER_XINERAMA +#define DYLIBLOAD_WRAPPER_XINERAMA +// This file is generated. Do not edit! +// see https://github.com/hpvb/dynload-wrapper for details +// generated by ./generate-wrapper.py 0.3 on 2022-12-02 12:53:11 +// flags: ./generate-wrapper.py --include /usr/include/X11/extensions/Xinerama.h --sys-include <X11/extensions/Xinerama.h> --soname libXinerama.so.1 --init-name xinerama --output-header xinerama-so_wrap.h --output-implementation xinerama-so_wrap.c +// +// NOTE: Generated from Xinerama 1.1.4. +// This has been handpatched to workaround some issues with the generator that +// will be eventually fixed. In this case, non-existant symbols inherited from +// libX11, but absent in libXinerama.so.1, were removed. +#include <stdint.h> + +#define XineramaQueryExtension XineramaQueryExtension_dylibloader_orig_xinerama +#define XineramaQueryVersion XineramaQueryVersion_dylibloader_orig_xinerama +#define XineramaIsActive XineramaIsActive_dylibloader_orig_xinerama +#define XineramaQueryScreens XineramaQueryScreens_dylibloader_orig_xinerama +#include <X11/extensions/Xinerama.h> +#undef XineramaQueryExtension +#undef XineramaQueryVersion +#undef XineramaIsActive +#undef XineramaQueryScreens +#ifdef __cplusplus +extern "C" { +#endif +#define XineramaQueryExtension XineramaQueryExtension_dylibloader_wrapper_xinerama +#define XineramaQueryVersion XineramaQueryVersion_dylibloader_wrapper_xinerama +#define XineramaIsActive XineramaIsActive_dylibloader_wrapper_xinerama +#define XineramaQueryScreens XineramaQueryScreens_dylibloader_wrapper_xinerama +extern int (*XineramaQueryExtension_dylibloader_wrapper_xinerama)( Display*, int*, int*); +extern int (*XineramaQueryVersion_dylibloader_wrapper_xinerama)( Display*, int*, int*); +extern int (*XineramaIsActive_dylibloader_wrapper_xinerama)( Display*); +extern XineramaScreenInfo* (*XineramaQueryScreens_dylibloader_wrapper_xinerama)( Display*, int*); +int initialize_xinerama(int verbose); +#ifdef __cplusplus +} +#endif +#endif diff --git a/platform/linuxbsd/x11/dynwrappers/xinput2-so_wrap.c b/platform/linuxbsd/x11/dynwrappers/xinput2-so_wrap.c new file mode 100644 index 0000000000..5e1f0999fc --- /dev/null +++ b/platform/linuxbsd/x11/dynwrappers/xinput2-so_wrap.c @@ -0,0 +1,401 @@ +// This file is generated. Do not edit! +// see https://github.com/hpvb/dynload-wrapper for details +// generated by ./generate-wrapper.py 0.3 on 2022-12-02 12:54:10 +// flags: ./generate-wrapper.py --include /usr/include/X11/extensions/XInput2.h --sys-include <X11/extensions/XInput2.h> --soname libXi.so.6 --init-name xinput2 --output-header xinput2-so_wrap.h --output-implementation xinput2-so_wrap.c +// +// NOTE: Generated from Xi 1.7.10. +// This has been handpatched to workaround some issues with the generator that +// will be eventually fixed. In this case, non-existant symbols inherited from +// libX11, liXext and libXfixes, but absent in libXi.so.6, were removed. +#include <stdint.h> + +#define XIQueryPointer XIQueryPointer_dylibloader_orig_xinput2 +#define XIWarpPointer XIWarpPointer_dylibloader_orig_xinput2 +#define XIDefineCursor XIDefineCursor_dylibloader_orig_xinput2 +#define XIUndefineCursor XIUndefineCursor_dylibloader_orig_xinput2 +#define XIChangeHierarchy XIChangeHierarchy_dylibloader_orig_xinput2 +#define XISetClientPointer XISetClientPointer_dylibloader_orig_xinput2 +#define XIGetClientPointer XIGetClientPointer_dylibloader_orig_xinput2 +#define XISelectEvents XISelectEvents_dylibloader_orig_xinput2 +#define XIGetSelectedEvents XIGetSelectedEvents_dylibloader_orig_xinput2 +#define XIQueryVersion XIQueryVersion_dylibloader_orig_xinput2 +#define XIQueryDevice XIQueryDevice_dylibloader_orig_xinput2 +#define XISetFocus XISetFocus_dylibloader_orig_xinput2 +#define XIGetFocus XIGetFocus_dylibloader_orig_xinput2 +#define XIGrabDevice XIGrabDevice_dylibloader_orig_xinput2 +#define XIUngrabDevice XIUngrabDevice_dylibloader_orig_xinput2 +#define XIAllowEvents XIAllowEvents_dylibloader_orig_xinput2 +#define XIAllowTouchEvents XIAllowTouchEvents_dylibloader_orig_xinput2 +#define XIGrabButton XIGrabButton_dylibloader_orig_xinput2 +#define XIGrabKeycode XIGrabKeycode_dylibloader_orig_xinput2 +#define XIGrabEnter XIGrabEnter_dylibloader_orig_xinput2 +#define XIGrabFocusIn XIGrabFocusIn_dylibloader_orig_xinput2 +#define XIGrabTouchBegin XIGrabTouchBegin_dylibloader_orig_xinput2 +#define XIUngrabButton XIUngrabButton_dylibloader_orig_xinput2 +#define XIUngrabKeycode XIUngrabKeycode_dylibloader_orig_xinput2 +#define XIUngrabEnter XIUngrabEnter_dylibloader_orig_xinput2 +#define XIUngrabFocusIn XIUngrabFocusIn_dylibloader_orig_xinput2 +#define XIUngrabTouchBegin XIUngrabTouchBegin_dylibloader_orig_xinput2 +#define XIListProperties XIListProperties_dylibloader_orig_xinput2 +#define XIChangeProperty XIChangeProperty_dylibloader_orig_xinput2 +#define XIDeleteProperty XIDeleteProperty_dylibloader_orig_xinput2 +#define XIGetProperty XIGetProperty_dylibloader_orig_xinput2 +#define XIBarrierReleasePointers XIBarrierReleasePointers_dylibloader_orig_xinput2 +#define XIBarrierReleasePointer XIBarrierReleasePointer_dylibloader_orig_xinput2 +#define XIFreeDeviceInfo XIFreeDeviceInfo_dylibloader_orig_xinput2 +#include <X11/extensions/XInput2.h> +#undef XIQueryPointer +#undef XIWarpPointer +#undef XIDefineCursor +#undef XIUndefineCursor +#undef XIChangeHierarchy +#undef XISetClientPointer +#undef XIGetClientPointer +#undef XISelectEvents +#undef XIGetSelectedEvents +#undef XIQueryVersion +#undef XIQueryDevice +#undef XISetFocus +#undef XIGetFocus +#undef XIGrabDevice +#undef XIUngrabDevice +#undef XIAllowEvents +#undef XIAllowTouchEvents +#undef XIGrabButton +#undef XIGrabKeycode +#undef XIGrabEnter +#undef XIGrabFocusIn +#undef XIGrabTouchBegin +#undef XIUngrabButton +#undef XIUngrabKeycode +#undef XIUngrabEnter +#undef XIUngrabFocusIn +#undef XIUngrabTouchBegin +#undef XIListProperties +#undef XIChangeProperty +#undef XIDeleteProperty +#undef XIGetProperty +#undef XIBarrierReleasePointers +#undef XIBarrierReleasePointer +#undef XIFreeDeviceInfo +#include <dlfcn.h> +#include <stdio.h> +int (*XIQueryPointer_dylibloader_wrapper_xinput2)( Display*, int, Window, Window*, Window*, double*, double*, double*, double*, XIButtonState*, XIModifierState*, XIGroupState*); +int (*XIWarpPointer_dylibloader_wrapper_xinput2)( Display*, int, Window, Window, double, double, unsigned int, unsigned int, double, double); +int (*XIDefineCursor_dylibloader_wrapper_xinput2)( Display*, int, Window, Cursor); +int (*XIUndefineCursor_dylibloader_wrapper_xinput2)( Display*, int, Window); +int (*XIChangeHierarchy_dylibloader_wrapper_xinput2)( Display*, XIAnyHierarchyChangeInfo*, int); +int (*XISetClientPointer_dylibloader_wrapper_xinput2)( Display*, Window, int); +int (*XIGetClientPointer_dylibloader_wrapper_xinput2)( Display*, Window, int*); +int (*XISelectEvents_dylibloader_wrapper_xinput2)( Display*, Window, XIEventMask*, int); +XIEventMask* (*XIGetSelectedEvents_dylibloader_wrapper_xinput2)( Display*, Window, int*); +int (*XIQueryVersion_dylibloader_wrapper_xinput2)( Display*, int*, int*); +XIDeviceInfo* (*XIQueryDevice_dylibloader_wrapper_xinput2)( Display*, int, int*); +int (*XISetFocus_dylibloader_wrapper_xinput2)( Display*, int, Window, Time); +int (*XIGetFocus_dylibloader_wrapper_xinput2)( Display*, int, Window*); +int (*XIGrabDevice_dylibloader_wrapper_xinput2)( Display*, int, Window, Time, Cursor, int, int, int, XIEventMask*); +int (*XIUngrabDevice_dylibloader_wrapper_xinput2)( Display*, int, Time); +int (*XIAllowEvents_dylibloader_wrapper_xinput2)( Display*, int, int, Time); +int (*XIAllowTouchEvents_dylibloader_wrapper_xinput2)( Display*, int, unsigned int, Window, int); +int (*XIGrabButton_dylibloader_wrapper_xinput2)( Display*, int, int, Window, Cursor, int, int, int, XIEventMask*, int, XIGrabModifiers*); +int (*XIGrabKeycode_dylibloader_wrapper_xinput2)( Display*, int, int, Window, int, int, int, XIEventMask*, int, XIGrabModifiers*); +int (*XIGrabEnter_dylibloader_wrapper_xinput2)( Display*, int, Window, Cursor, int, int, int, XIEventMask*, int, XIGrabModifiers*); +int (*XIGrabFocusIn_dylibloader_wrapper_xinput2)( Display*, int, Window, int, int, int, XIEventMask*, int, XIGrabModifiers*); +int (*XIGrabTouchBegin_dylibloader_wrapper_xinput2)( Display*, int, Window, int, XIEventMask*, int, XIGrabModifiers*); +int (*XIUngrabButton_dylibloader_wrapper_xinput2)( Display*, int, int, Window, int, XIGrabModifiers*); +int (*XIUngrabKeycode_dylibloader_wrapper_xinput2)( Display*, int, int, Window, int, XIGrabModifiers*); +int (*XIUngrabEnter_dylibloader_wrapper_xinput2)( Display*, int, Window, int, XIGrabModifiers*); +int (*XIUngrabFocusIn_dylibloader_wrapper_xinput2)( Display*, int, Window, int, XIGrabModifiers*); +int (*XIUngrabTouchBegin_dylibloader_wrapper_xinput2)( Display*, int, Window, int, XIGrabModifiers*); +Atom* (*XIListProperties_dylibloader_wrapper_xinput2)( Display*, int, int*); +void (*XIChangeProperty_dylibloader_wrapper_xinput2)( Display*, int, Atom, Atom, int, int, unsigned char*, int); +void (*XIDeleteProperty_dylibloader_wrapper_xinput2)( Display*, int, Atom); +int (*XIGetProperty_dylibloader_wrapper_xinput2)( Display*, int, Atom, long, long, int, Atom, Atom*, int*, unsigned long*, unsigned long*, unsigned char**); +void (*XIBarrierReleasePointers_dylibloader_wrapper_xinput2)( Display*, XIBarrierReleasePointerInfo*, int); +void (*XIBarrierReleasePointer_dylibloader_wrapper_xinput2)( Display*, int, PointerBarrier, BarrierEventID); +void (*XIFreeDeviceInfo_dylibloader_wrapper_xinput2)( XIDeviceInfo*); +int initialize_xinput2(int verbose) { + void *handle; + char *error; + handle = dlopen("libXi.so.6", RTLD_LAZY); + if (!handle) { + if (verbose) { + fprintf(stderr, "%s\n", dlerror()); + } + return(1); + } + dlerror(); +// XIQueryPointer + *(void **) (&XIQueryPointer_dylibloader_wrapper_xinput2) = dlsym(handle, "XIQueryPointer"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XIWarpPointer + *(void **) (&XIWarpPointer_dylibloader_wrapper_xinput2) = dlsym(handle, "XIWarpPointer"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XIDefineCursor + *(void **) (&XIDefineCursor_dylibloader_wrapper_xinput2) = dlsym(handle, "XIDefineCursor"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XIUndefineCursor + *(void **) (&XIUndefineCursor_dylibloader_wrapper_xinput2) = dlsym(handle, "XIUndefineCursor"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XIChangeHierarchy + *(void **) (&XIChangeHierarchy_dylibloader_wrapper_xinput2) = dlsym(handle, "XIChangeHierarchy"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XISetClientPointer + *(void **) (&XISetClientPointer_dylibloader_wrapper_xinput2) = dlsym(handle, "XISetClientPointer"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XIGetClientPointer + *(void **) (&XIGetClientPointer_dylibloader_wrapper_xinput2) = dlsym(handle, "XIGetClientPointer"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XISelectEvents + *(void **) (&XISelectEvents_dylibloader_wrapper_xinput2) = dlsym(handle, "XISelectEvents"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XIGetSelectedEvents + *(void **) (&XIGetSelectedEvents_dylibloader_wrapper_xinput2) = dlsym(handle, "XIGetSelectedEvents"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XIQueryVersion + *(void **) (&XIQueryVersion_dylibloader_wrapper_xinput2) = dlsym(handle, "XIQueryVersion"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XIQueryDevice + *(void **) (&XIQueryDevice_dylibloader_wrapper_xinput2) = dlsym(handle, "XIQueryDevice"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XISetFocus + *(void **) (&XISetFocus_dylibloader_wrapper_xinput2) = dlsym(handle, "XISetFocus"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XIGetFocus + *(void **) (&XIGetFocus_dylibloader_wrapper_xinput2) = dlsym(handle, "XIGetFocus"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XIGrabDevice + *(void **) (&XIGrabDevice_dylibloader_wrapper_xinput2) = dlsym(handle, "XIGrabDevice"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XIUngrabDevice + *(void **) (&XIUngrabDevice_dylibloader_wrapper_xinput2) = dlsym(handle, "XIUngrabDevice"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XIAllowEvents + *(void **) (&XIAllowEvents_dylibloader_wrapper_xinput2) = dlsym(handle, "XIAllowEvents"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XIAllowTouchEvents + *(void **) (&XIAllowTouchEvents_dylibloader_wrapper_xinput2) = dlsym(handle, "XIAllowTouchEvents"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XIGrabButton + *(void **) (&XIGrabButton_dylibloader_wrapper_xinput2) = dlsym(handle, "XIGrabButton"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XIGrabKeycode + *(void **) (&XIGrabKeycode_dylibloader_wrapper_xinput2) = dlsym(handle, "XIGrabKeycode"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XIGrabEnter + *(void **) (&XIGrabEnter_dylibloader_wrapper_xinput2) = dlsym(handle, "XIGrabEnter"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XIGrabFocusIn + *(void **) (&XIGrabFocusIn_dylibloader_wrapper_xinput2) = dlsym(handle, "XIGrabFocusIn"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XIGrabTouchBegin + *(void **) (&XIGrabTouchBegin_dylibloader_wrapper_xinput2) = dlsym(handle, "XIGrabTouchBegin"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XIUngrabButton + *(void **) (&XIUngrabButton_dylibloader_wrapper_xinput2) = dlsym(handle, "XIUngrabButton"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XIUngrabKeycode + *(void **) (&XIUngrabKeycode_dylibloader_wrapper_xinput2) = dlsym(handle, "XIUngrabKeycode"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XIUngrabEnter + *(void **) (&XIUngrabEnter_dylibloader_wrapper_xinput2) = dlsym(handle, "XIUngrabEnter"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XIUngrabFocusIn + *(void **) (&XIUngrabFocusIn_dylibloader_wrapper_xinput2) = dlsym(handle, "XIUngrabFocusIn"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XIUngrabTouchBegin + *(void **) (&XIUngrabTouchBegin_dylibloader_wrapper_xinput2) = dlsym(handle, "XIUngrabTouchBegin"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XIListProperties + *(void **) (&XIListProperties_dylibloader_wrapper_xinput2) = dlsym(handle, "XIListProperties"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XIChangeProperty + *(void **) (&XIChangeProperty_dylibloader_wrapper_xinput2) = dlsym(handle, "XIChangeProperty"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XIDeleteProperty + *(void **) (&XIDeleteProperty_dylibloader_wrapper_xinput2) = dlsym(handle, "XIDeleteProperty"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XIGetProperty + *(void **) (&XIGetProperty_dylibloader_wrapper_xinput2) = dlsym(handle, "XIGetProperty"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XIBarrierReleasePointers + *(void **) (&XIBarrierReleasePointers_dylibloader_wrapper_xinput2) = dlsym(handle, "XIBarrierReleasePointers"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XIBarrierReleasePointer + *(void **) (&XIBarrierReleasePointer_dylibloader_wrapper_xinput2) = dlsym(handle, "XIBarrierReleasePointer"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XIFreeDeviceInfo + *(void **) (&XIFreeDeviceInfo_dylibloader_wrapper_xinput2) = dlsym(handle, "XIFreeDeviceInfo"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +return 0; +} diff --git a/platform/linuxbsd/x11/dynwrappers/xinput2-so_wrap.h b/platform/linuxbsd/x11/dynwrappers/xinput2-so_wrap.h new file mode 100644 index 0000000000..95740cee58 --- /dev/null +++ b/platform/linuxbsd/x11/dynwrappers/xinput2-so_wrap.h @@ -0,0 +1,158 @@ +#ifndef DYLIBLOAD_WRAPPER_XINPUT2 +#define DYLIBLOAD_WRAPPER_XINPUT2 +// This file is generated. Do not edit! +// see https://github.com/hpvb/dynload-wrapper for details +// generated by ./generate-wrapper.py 0.3 on 2022-12-02 12:54:10 +// flags: ./generate-wrapper.py --include /usr/include/X11/extensions/XInput2.h --sys-include <X11/extensions/XInput2.h> --soname libXi.so.6 --init-name xinput2 --output-header xinput2-so_wrap.h --output-implementation xinput2-so_wrap.c +// +// NOTE: Generated from Xi 1.7.10. +// This has been handpatched to workaround some issues with the generator that +// will be eventually fixed. In this case, non-existant symbols inherited from +// libX11, liXext and libXfixes, but absent in libXi.so.6, were removed. +#include <stdint.h> + +#define XIQueryPointer XIQueryPointer_dylibloader_orig_xinput2 +#define XIWarpPointer XIWarpPointer_dylibloader_orig_xinput2 +#define XIDefineCursor XIDefineCursor_dylibloader_orig_xinput2 +#define XIUndefineCursor XIUndefineCursor_dylibloader_orig_xinput2 +#define XIChangeHierarchy XIChangeHierarchy_dylibloader_orig_xinput2 +#define XISetClientPointer XISetClientPointer_dylibloader_orig_xinput2 +#define XIGetClientPointer XIGetClientPointer_dylibloader_orig_xinput2 +#define XISelectEvents XISelectEvents_dylibloader_orig_xinput2 +#define XIGetSelectedEvents XIGetSelectedEvents_dylibloader_orig_xinput2 +#define XIQueryVersion XIQueryVersion_dylibloader_orig_xinput2 +#define XIQueryDevice XIQueryDevice_dylibloader_orig_xinput2 +#define XISetFocus XISetFocus_dylibloader_orig_xinput2 +#define XIGetFocus XIGetFocus_dylibloader_orig_xinput2 +#define XIGrabDevice XIGrabDevice_dylibloader_orig_xinput2 +#define XIUngrabDevice XIUngrabDevice_dylibloader_orig_xinput2 +#define XIAllowEvents XIAllowEvents_dylibloader_orig_xinput2 +#define XIAllowTouchEvents XIAllowTouchEvents_dylibloader_orig_xinput2 +#define XIGrabButton XIGrabButton_dylibloader_orig_xinput2 +#define XIGrabKeycode XIGrabKeycode_dylibloader_orig_xinput2 +#define XIGrabEnter XIGrabEnter_dylibloader_orig_xinput2 +#define XIGrabFocusIn XIGrabFocusIn_dylibloader_orig_xinput2 +#define XIGrabTouchBegin XIGrabTouchBegin_dylibloader_orig_xinput2 +#define XIUngrabButton XIUngrabButton_dylibloader_orig_xinput2 +#define XIUngrabKeycode XIUngrabKeycode_dylibloader_orig_xinput2 +#define XIUngrabEnter XIUngrabEnter_dylibloader_orig_xinput2 +#define XIUngrabFocusIn XIUngrabFocusIn_dylibloader_orig_xinput2 +#define XIUngrabTouchBegin XIUngrabTouchBegin_dylibloader_orig_xinput2 +#define XIListProperties XIListProperties_dylibloader_orig_xinput2 +#define XIChangeProperty XIChangeProperty_dylibloader_orig_xinput2 +#define XIDeleteProperty XIDeleteProperty_dylibloader_orig_xinput2 +#define XIGetProperty XIGetProperty_dylibloader_orig_xinput2 +#define XIBarrierReleasePointers XIBarrierReleasePointers_dylibloader_orig_xinput2 +#define XIBarrierReleasePointer XIBarrierReleasePointer_dylibloader_orig_xinput2 +#define XIFreeDeviceInfo XIFreeDeviceInfo_dylibloader_orig_xinput2 +#include <X11/extensions/XInput2.h> +#undef XIQueryPointer +#undef XIWarpPointer +#undef XIDefineCursor +#undef XIUndefineCursor +#undef XIChangeHierarchy +#undef XISetClientPointer +#undef XIGetClientPointer +#undef XISelectEvents +#undef XIGetSelectedEvents +#undef XIQueryVersion +#undef XIQueryDevice +#undef XISetFocus +#undef XIGetFocus +#undef XIGrabDevice +#undef XIUngrabDevice +#undef XIAllowEvents +#undef XIAllowTouchEvents +#undef XIGrabButton +#undef XIGrabKeycode +#undef XIGrabEnter +#undef XIGrabFocusIn +#undef XIGrabTouchBegin +#undef XIUngrabButton +#undef XIUngrabKeycode +#undef XIUngrabEnter +#undef XIUngrabFocusIn +#undef XIUngrabTouchBegin +#undef XIListProperties +#undef XIChangeProperty +#undef XIDeleteProperty +#undef XIGetProperty +#undef XIBarrierReleasePointers +#undef XIBarrierReleasePointer +#undef XIFreeDeviceInfo +#ifdef __cplusplus +extern "C" { +#endif +#define XIQueryPointer XIQueryPointer_dylibloader_wrapper_xinput2 +#define XIWarpPointer XIWarpPointer_dylibloader_wrapper_xinput2 +#define XIDefineCursor XIDefineCursor_dylibloader_wrapper_xinput2 +#define XIUndefineCursor XIUndefineCursor_dylibloader_wrapper_xinput2 +#define XIChangeHierarchy XIChangeHierarchy_dylibloader_wrapper_xinput2 +#define XISetClientPointer XISetClientPointer_dylibloader_wrapper_xinput2 +#define XIGetClientPointer XIGetClientPointer_dylibloader_wrapper_xinput2 +#define XISelectEvents XISelectEvents_dylibloader_wrapper_xinput2 +#define XIGetSelectedEvents XIGetSelectedEvents_dylibloader_wrapper_xinput2 +#define XIQueryVersion XIQueryVersion_dylibloader_wrapper_xinput2 +#define XIQueryDevice XIQueryDevice_dylibloader_wrapper_xinput2 +#define XISetFocus XISetFocus_dylibloader_wrapper_xinput2 +#define XIGetFocus XIGetFocus_dylibloader_wrapper_xinput2 +#define XIGrabDevice XIGrabDevice_dylibloader_wrapper_xinput2 +#define XIUngrabDevice XIUngrabDevice_dylibloader_wrapper_xinput2 +#define XIAllowEvents XIAllowEvents_dylibloader_wrapper_xinput2 +#define XIAllowTouchEvents XIAllowTouchEvents_dylibloader_wrapper_xinput2 +#define XIGrabButton XIGrabButton_dylibloader_wrapper_xinput2 +#define XIGrabKeycode XIGrabKeycode_dylibloader_wrapper_xinput2 +#define XIGrabEnter XIGrabEnter_dylibloader_wrapper_xinput2 +#define XIGrabFocusIn XIGrabFocusIn_dylibloader_wrapper_xinput2 +#define XIGrabTouchBegin XIGrabTouchBegin_dylibloader_wrapper_xinput2 +#define XIUngrabButton XIUngrabButton_dylibloader_wrapper_xinput2 +#define XIUngrabKeycode XIUngrabKeycode_dylibloader_wrapper_xinput2 +#define XIUngrabEnter XIUngrabEnter_dylibloader_wrapper_xinput2 +#define XIUngrabFocusIn XIUngrabFocusIn_dylibloader_wrapper_xinput2 +#define XIUngrabTouchBegin XIUngrabTouchBegin_dylibloader_wrapper_xinput2 +#define XIListProperties XIListProperties_dylibloader_wrapper_xinput2 +#define XIChangeProperty XIChangeProperty_dylibloader_wrapper_xinput2 +#define XIDeleteProperty XIDeleteProperty_dylibloader_wrapper_xinput2 +#define XIGetProperty XIGetProperty_dylibloader_wrapper_xinput2 +#define XIBarrierReleasePointers XIBarrierReleasePointers_dylibloader_wrapper_xinput2 +#define XIBarrierReleasePointer XIBarrierReleasePointer_dylibloader_wrapper_xinput2 +#define XIFreeDeviceInfo XIFreeDeviceInfo_dylibloader_wrapper_xinput2 +extern int (*XIQueryPointer_dylibloader_wrapper_xinput2)( Display*, int, Window, Window*, Window*, double*, double*, double*, double*, XIButtonState*, XIModifierState*, XIGroupState*); +extern int (*XIWarpPointer_dylibloader_wrapper_xinput2)( Display*, int, Window, Window, double, double, unsigned int, unsigned int, double, double); +extern int (*XIDefineCursor_dylibloader_wrapper_xinput2)( Display*, int, Window, Cursor); +extern int (*XIUndefineCursor_dylibloader_wrapper_xinput2)( Display*, int, Window); +extern int (*XIChangeHierarchy_dylibloader_wrapper_xinput2)( Display*, XIAnyHierarchyChangeInfo*, int); +extern int (*XISetClientPointer_dylibloader_wrapper_xinput2)( Display*, Window, int); +extern int (*XIGetClientPointer_dylibloader_wrapper_xinput2)( Display*, Window, int*); +extern int (*XISelectEvents_dylibloader_wrapper_xinput2)( Display*, Window, XIEventMask*, int); +extern XIEventMask* (*XIGetSelectedEvents_dylibloader_wrapper_xinput2)( Display*, Window, int*); +extern int (*XIQueryVersion_dylibloader_wrapper_xinput2)( Display*, int*, int*); +extern XIDeviceInfo* (*XIQueryDevice_dylibloader_wrapper_xinput2)( Display*, int, int*); +extern int (*XISetFocus_dylibloader_wrapper_xinput2)( Display*, int, Window, Time); +extern int (*XIGetFocus_dylibloader_wrapper_xinput2)( Display*, int, Window*); +extern int (*XIGrabDevice_dylibloader_wrapper_xinput2)( Display*, int, Window, Time, Cursor, int, int, int, XIEventMask*); +extern int (*XIUngrabDevice_dylibloader_wrapper_xinput2)( Display*, int, Time); +extern int (*XIAllowEvents_dylibloader_wrapper_xinput2)( Display*, int, int, Time); +extern int (*XIAllowTouchEvents_dylibloader_wrapper_xinput2)( Display*, int, unsigned int, Window, int); +extern int (*XIGrabButton_dylibloader_wrapper_xinput2)( Display*, int, int, Window, Cursor, int, int, int, XIEventMask*, int, XIGrabModifiers*); +extern int (*XIGrabKeycode_dylibloader_wrapper_xinput2)( Display*, int, int, Window, int, int, int, XIEventMask*, int, XIGrabModifiers*); +extern int (*XIGrabEnter_dylibloader_wrapper_xinput2)( Display*, int, Window, Cursor, int, int, int, XIEventMask*, int, XIGrabModifiers*); +extern int (*XIGrabFocusIn_dylibloader_wrapper_xinput2)( Display*, int, Window, int, int, int, XIEventMask*, int, XIGrabModifiers*); +extern int (*XIGrabTouchBegin_dylibloader_wrapper_xinput2)( Display*, int, Window, int, XIEventMask*, int, XIGrabModifiers*); +extern int (*XIUngrabButton_dylibloader_wrapper_xinput2)( Display*, int, int, Window, int, XIGrabModifiers*); +extern int (*XIUngrabKeycode_dylibloader_wrapper_xinput2)( Display*, int, int, Window, int, XIGrabModifiers*); +extern int (*XIUngrabEnter_dylibloader_wrapper_xinput2)( Display*, int, Window, int, XIGrabModifiers*); +extern int (*XIUngrabFocusIn_dylibloader_wrapper_xinput2)( Display*, int, Window, int, XIGrabModifiers*); +extern int (*XIUngrabTouchBegin_dylibloader_wrapper_xinput2)( Display*, int, Window, int, XIGrabModifiers*); +extern Atom* (*XIListProperties_dylibloader_wrapper_xinput2)( Display*, int, int*); +extern void (*XIChangeProperty_dylibloader_wrapper_xinput2)( Display*, int, Atom, Atom, int, int, unsigned char*, int); +extern void (*XIDeleteProperty_dylibloader_wrapper_xinput2)( Display*, int, Atom); +extern int (*XIGetProperty_dylibloader_wrapper_xinput2)( Display*, int, Atom, long, long, int, Atom, Atom*, int*, unsigned long*, unsigned long*, unsigned char**); +extern void (*XIBarrierReleasePointers_dylibloader_wrapper_xinput2)( Display*, XIBarrierReleasePointerInfo*, int); +extern void (*XIBarrierReleasePointer_dylibloader_wrapper_xinput2)( Display*, int, PointerBarrier, BarrierEventID); +extern void (*XIFreeDeviceInfo_dylibloader_wrapper_xinput2)( XIDeviceInfo*); +int initialize_xinput2(int verbose); +#ifdef __cplusplus +} +#endif +#endif diff --git a/platform/linuxbsd/x11/dynwrappers/xlib-so_wrap.c b/platform/linuxbsd/x11/dynwrappers/xlib-so_wrap.c new file mode 100644 index 0000000000..12097a2987 --- /dev/null +++ b/platform/linuxbsd/x11/dynwrappers/xlib-so_wrap.c @@ -0,0 +1,6664 @@ +// This file is generated. Do not edit! +// see https://github.com/hpvb/dynload-wrapper for details +// generated by ./generate-wrapper.py 0.3 on 2022-12-02 12:54:53 +// flags: ./generate-wrapper.py --include /usr/include/X11/Xlib.h --include /usr/include/X11/Xutil.h --include /usr/include/X11/XKBlib.h --sys-include <X11/Xlib.h> --sys-include <X11/Xutil.h> --sys-include <X11/XKBlib.h> --soname libX11.so.6 --init-name xlib --omit-prefix XkbGetDeviceIndicatorState --omit-prefix XkbAddSymInterpret --output-header xlib-so_wrap.h --output-implementation xlib-so_wrap.c +// +// NOTE: Generated from Xlib 1.6.9. +// This has been handpatched to workaround some issues with the generator that +// will be eventually fixed. In this case, the type of the third argument of +// XIfEvent, XPeekIfEvent and XCheckIfEvent had to be fixed as it wasn't parsed +// fully (it's a Bool function pointer, but it was just being parsed as an int +// pointer). +#include <stdint.h> + +#define _Xmblen _Xmblen_dylibloader_orig_xlib +#define XLoadQueryFont XLoadQueryFont_dylibloader_orig_xlib +#define XQueryFont XQueryFont_dylibloader_orig_xlib +#define XGetMotionEvents XGetMotionEvents_dylibloader_orig_xlib +#define XDeleteModifiermapEntry XDeleteModifiermapEntry_dylibloader_orig_xlib +#define XGetModifierMapping XGetModifierMapping_dylibloader_orig_xlib +#define XInsertModifiermapEntry XInsertModifiermapEntry_dylibloader_orig_xlib +#define XNewModifiermap XNewModifiermap_dylibloader_orig_xlib +#define XCreateImage XCreateImage_dylibloader_orig_xlib +#define XInitImage XInitImage_dylibloader_orig_xlib +#define XGetImage XGetImage_dylibloader_orig_xlib +#define XGetSubImage XGetSubImage_dylibloader_orig_xlib +#define XOpenDisplay XOpenDisplay_dylibloader_orig_xlib +#define XrmInitialize XrmInitialize_dylibloader_orig_xlib +#define XFetchBytes XFetchBytes_dylibloader_orig_xlib +#define XFetchBuffer XFetchBuffer_dylibloader_orig_xlib +#define XGetAtomName XGetAtomName_dylibloader_orig_xlib +#define XGetAtomNames XGetAtomNames_dylibloader_orig_xlib +#define XGetDefault XGetDefault_dylibloader_orig_xlib +#define XDisplayName XDisplayName_dylibloader_orig_xlib +#define XKeysymToString XKeysymToString_dylibloader_orig_xlib +#define XSynchronize XSynchronize_dylibloader_orig_xlib +#define XSetAfterFunction XSetAfterFunction_dylibloader_orig_xlib +#define XInternAtom XInternAtom_dylibloader_orig_xlib +#define XInternAtoms XInternAtoms_dylibloader_orig_xlib +#define XCopyColormapAndFree XCopyColormapAndFree_dylibloader_orig_xlib +#define XCreateColormap XCreateColormap_dylibloader_orig_xlib +#define XCreatePixmapCursor XCreatePixmapCursor_dylibloader_orig_xlib +#define XCreateGlyphCursor XCreateGlyphCursor_dylibloader_orig_xlib +#define XCreateFontCursor XCreateFontCursor_dylibloader_orig_xlib +#define XLoadFont XLoadFont_dylibloader_orig_xlib +#define XCreateGC XCreateGC_dylibloader_orig_xlib +#define XGContextFromGC XGContextFromGC_dylibloader_orig_xlib +#define XFlushGC XFlushGC_dylibloader_orig_xlib +#define XCreatePixmap XCreatePixmap_dylibloader_orig_xlib +#define XCreateBitmapFromData XCreateBitmapFromData_dylibloader_orig_xlib +#define XCreatePixmapFromBitmapData XCreatePixmapFromBitmapData_dylibloader_orig_xlib +#define XCreateSimpleWindow XCreateSimpleWindow_dylibloader_orig_xlib +#define XGetSelectionOwner XGetSelectionOwner_dylibloader_orig_xlib +#define XCreateWindow XCreateWindow_dylibloader_orig_xlib +#define XListInstalledColormaps XListInstalledColormaps_dylibloader_orig_xlib +#define XListFonts XListFonts_dylibloader_orig_xlib +#define XListFontsWithInfo XListFontsWithInfo_dylibloader_orig_xlib +#define XGetFontPath XGetFontPath_dylibloader_orig_xlib +#define XListExtensions XListExtensions_dylibloader_orig_xlib +#define XListProperties XListProperties_dylibloader_orig_xlib +#define XListHosts XListHosts_dylibloader_orig_xlib +#define XKeycodeToKeysym XKeycodeToKeysym_dylibloader_orig_xlib +#define XLookupKeysym XLookupKeysym_dylibloader_orig_xlib +#define XGetKeyboardMapping XGetKeyboardMapping_dylibloader_orig_xlib +#define XStringToKeysym XStringToKeysym_dylibloader_orig_xlib +#define XMaxRequestSize XMaxRequestSize_dylibloader_orig_xlib +#define XExtendedMaxRequestSize XExtendedMaxRequestSize_dylibloader_orig_xlib +#define XResourceManagerString XResourceManagerString_dylibloader_orig_xlib +#define XScreenResourceString XScreenResourceString_dylibloader_orig_xlib +#define XDisplayMotionBufferSize XDisplayMotionBufferSize_dylibloader_orig_xlib +#define XVisualIDFromVisual XVisualIDFromVisual_dylibloader_orig_xlib +#define XInitThreads XInitThreads_dylibloader_orig_xlib +#define XLockDisplay XLockDisplay_dylibloader_orig_xlib +#define XUnlockDisplay XUnlockDisplay_dylibloader_orig_xlib +#define XInitExtension XInitExtension_dylibloader_orig_xlib +#define XAddExtension XAddExtension_dylibloader_orig_xlib +#define XFindOnExtensionList XFindOnExtensionList_dylibloader_orig_xlib +#define XEHeadOfExtensionList XEHeadOfExtensionList_dylibloader_orig_xlib +#define XRootWindow XRootWindow_dylibloader_orig_xlib +#define XDefaultRootWindow XDefaultRootWindow_dylibloader_orig_xlib +#define XRootWindowOfScreen XRootWindowOfScreen_dylibloader_orig_xlib +#define XDefaultVisual XDefaultVisual_dylibloader_orig_xlib +#define XDefaultVisualOfScreen XDefaultVisualOfScreen_dylibloader_orig_xlib +#define XDefaultGC XDefaultGC_dylibloader_orig_xlib +#define XDefaultGCOfScreen XDefaultGCOfScreen_dylibloader_orig_xlib +#define XBlackPixel XBlackPixel_dylibloader_orig_xlib +#define XWhitePixel XWhitePixel_dylibloader_orig_xlib +#define XAllPlanes XAllPlanes_dylibloader_orig_xlib +#define XBlackPixelOfScreen XBlackPixelOfScreen_dylibloader_orig_xlib +#define XWhitePixelOfScreen XWhitePixelOfScreen_dylibloader_orig_xlib +#define XNextRequest XNextRequest_dylibloader_orig_xlib +#define XLastKnownRequestProcessed XLastKnownRequestProcessed_dylibloader_orig_xlib +#define XServerVendor XServerVendor_dylibloader_orig_xlib +#define XDisplayString XDisplayString_dylibloader_orig_xlib +#define XDefaultColormap XDefaultColormap_dylibloader_orig_xlib +#define XDefaultColormapOfScreen XDefaultColormapOfScreen_dylibloader_orig_xlib +#define XDisplayOfScreen XDisplayOfScreen_dylibloader_orig_xlib +#define XScreenOfDisplay XScreenOfDisplay_dylibloader_orig_xlib +#define XDefaultScreenOfDisplay XDefaultScreenOfDisplay_dylibloader_orig_xlib +#define XEventMaskOfScreen XEventMaskOfScreen_dylibloader_orig_xlib +#define XScreenNumberOfScreen XScreenNumberOfScreen_dylibloader_orig_xlib +#define XSetErrorHandler XSetErrorHandler_dylibloader_orig_xlib +#define XSetIOErrorHandler XSetIOErrorHandler_dylibloader_orig_xlib +#define XListPixmapFormats XListPixmapFormats_dylibloader_orig_xlib +#define XListDepths XListDepths_dylibloader_orig_xlib +#define XReconfigureWMWindow XReconfigureWMWindow_dylibloader_orig_xlib +#define XGetWMProtocols XGetWMProtocols_dylibloader_orig_xlib +#define XSetWMProtocols XSetWMProtocols_dylibloader_orig_xlib +#define XIconifyWindow XIconifyWindow_dylibloader_orig_xlib +#define XWithdrawWindow XWithdrawWindow_dylibloader_orig_xlib +#define XGetCommand XGetCommand_dylibloader_orig_xlib +#define XGetWMColormapWindows XGetWMColormapWindows_dylibloader_orig_xlib +#define XSetWMColormapWindows XSetWMColormapWindows_dylibloader_orig_xlib +#define XFreeStringList XFreeStringList_dylibloader_orig_xlib +#define XSetTransientForHint XSetTransientForHint_dylibloader_orig_xlib +#define XActivateScreenSaver XActivateScreenSaver_dylibloader_orig_xlib +#define XAddHost XAddHost_dylibloader_orig_xlib +#define XAddHosts XAddHosts_dylibloader_orig_xlib +#define XAddToExtensionList XAddToExtensionList_dylibloader_orig_xlib +#define XAddToSaveSet XAddToSaveSet_dylibloader_orig_xlib +#define XAllocColor XAllocColor_dylibloader_orig_xlib +#define XAllocColorCells XAllocColorCells_dylibloader_orig_xlib +#define XAllocColorPlanes XAllocColorPlanes_dylibloader_orig_xlib +#define XAllocNamedColor XAllocNamedColor_dylibloader_orig_xlib +#define XAllowEvents XAllowEvents_dylibloader_orig_xlib +#define XAutoRepeatOff XAutoRepeatOff_dylibloader_orig_xlib +#define XAutoRepeatOn XAutoRepeatOn_dylibloader_orig_xlib +#define XBell XBell_dylibloader_orig_xlib +#define XBitmapBitOrder XBitmapBitOrder_dylibloader_orig_xlib +#define XBitmapPad XBitmapPad_dylibloader_orig_xlib +#define XBitmapUnit XBitmapUnit_dylibloader_orig_xlib +#define XCellsOfScreen XCellsOfScreen_dylibloader_orig_xlib +#define XChangeActivePointerGrab XChangeActivePointerGrab_dylibloader_orig_xlib +#define XChangeGC XChangeGC_dylibloader_orig_xlib +#define XChangeKeyboardControl XChangeKeyboardControl_dylibloader_orig_xlib +#define XChangeKeyboardMapping XChangeKeyboardMapping_dylibloader_orig_xlib +#define XChangePointerControl XChangePointerControl_dylibloader_orig_xlib +#define XChangeProperty XChangeProperty_dylibloader_orig_xlib +#define XChangeSaveSet XChangeSaveSet_dylibloader_orig_xlib +#define XChangeWindowAttributes XChangeWindowAttributes_dylibloader_orig_xlib +#define XCheckIfEvent XCheckIfEvent_dylibloader_orig_xlib +#define XCheckMaskEvent XCheckMaskEvent_dylibloader_orig_xlib +#define XCheckTypedEvent XCheckTypedEvent_dylibloader_orig_xlib +#define XCheckTypedWindowEvent XCheckTypedWindowEvent_dylibloader_orig_xlib +#define XCheckWindowEvent XCheckWindowEvent_dylibloader_orig_xlib +#define XCirculateSubwindows XCirculateSubwindows_dylibloader_orig_xlib +#define XCirculateSubwindowsDown XCirculateSubwindowsDown_dylibloader_orig_xlib +#define XCirculateSubwindowsUp XCirculateSubwindowsUp_dylibloader_orig_xlib +#define XClearArea XClearArea_dylibloader_orig_xlib +#define XClearWindow XClearWindow_dylibloader_orig_xlib +#define XCloseDisplay XCloseDisplay_dylibloader_orig_xlib +#define XConfigureWindow XConfigureWindow_dylibloader_orig_xlib +#define XConnectionNumber XConnectionNumber_dylibloader_orig_xlib +#define XConvertSelection XConvertSelection_dylibloader_orig_xlib +#define XCopyArea XCopyArea_dylibloader_orig_xlib +#define XCopyGC XCopyGC_dylibloader_orig_xlib +#define XCopyPlane XCopyPlane_dylibloader_orig_xlib +#define XDefaultDepth XDefaultDepth_dylibloader_orig_xlib +#define XDefaultDepthOfScreen XDefaultDepthOfScreen_dylibloader_orig_xlib +#define XDefaultScreen XDefaultScreen_dylibloader_orig_xlib +#define XDefineCursor XDefineCursor_dylibloader_orig_xlib +#define XDeleteProperty XDeleteProperty_dylibloader_orig_xlib +#define XDestroyWindow XDestroyWindow_dylibloader_orig_xlib +#define XDestroySubwindows XDestroySubwindows_dylibloader_orig_xlib +#define XDoesBackingStore XDoesBackingStore_dylibloader_orig_xlib +#define XDoesSaveUnders XDoesSaveUnders_dylibloader_orig_xlib +#define XDisableAccessControl XDisableAccessControl_dylibloader_orig_xlib +#define XDisplayCells XDisplayCells_dylibloader_orig_xlib +#define XDisplayHeight XDisplayHeight_dylibloader_orig_xlib +#define XDisplayHeightMM XDisplayHeightMM_dylibloader_orig_xlib +#define XDisplayKeycodes XDisplayKeycodes_dylibloader_orig_xlib +#define XDisplayPlanes XDisplayPlanes_dylibloader_orig_xlib +#define XDisplayWidth XDisplayWidth_dylibloader_orig_xlib +#define XDisplayWidthMM XDisplayWidthMM_dylibloader_orig_xlib +#define XDrawArc XDrawArc_dylibloader_orig_xlib +#define XDrawArcs XDrawArcs_dylibloader_orig_xlib +#define XDrawImageString XDrawImageString_dylibloader_orig_xlib +#define XDrawImageString16 XDrawImageString16_dylibloader_orig_xlib +#define XDrawLine XDrawLine_dylibloader_orig_xlib +#define XDrawLines XDrawLines_dylibloader_orig_xlib +#define XDrawPoint XDrawPoint_dylibloader_orig_xlib +#define XDrawPoints XDrawPoints_dylibloader_orig_xlib +#define XDrawRectangle XDrawRectangle_dylibloader_orig_xlib +#define XDrawRectangles XDrawRectangles_dylibloader_orig_xlib +#define XDrawSegments XDrawSegments_dylibloader_orig_xlib +#define XDrawString XDrawString_dylibloader_orig_xlib +#define XDrawString16 XDrawString16_dylibloader_orig_xlib +#define XDrawText XDrawText_dylibloader_orig_xlib +#define XDrawText16 XDrawText16_dylibloader_orig_xlib +#define XEnableAccessControl XEnableAccessControl_dylibloader_orig_xlib +#define XEventsQueued XEventsQueued_dylibloader_orig_xlib +#define XFetchName XFetchName_dylibloader_orig_xlib +#define XFillArc XFillArc_dylibloader_orig_xlib +#define XFillArcs XFillArcs_dylibloader_orig_xlib +#define XFillPolygon XFillPolygon_dylibloader_orig_xlib +#define XFillRectangle XFillRectangle_dylibloader_orig_xlib +#define XFillRectangles XFillRectangles_dylibloader_orig_xlib +#define XFlush XFlush_dylibloader_orig_xlib +#define XForceScreenSaver XForceScreenSaver_dylibloader_orig_xlib +#define XFree XFree_dylibloader_orig_xlib +#define XFreeColormap XFreeColormap_dylibloader_orig_xlib +#define XFreeColors XFreeColors_dylibloader_orig_xlib +#define XFreeCursor XFreeCursor_dylibloader_orig_xlib +#define XFreeExtensionList XFreeExtensionList_dylibloader_orig_xlib +#define XFreeFont XFreeFont_dylibloader_orig_xlib +#define XFreeFontInfo XFreeFontInfo_dylibloader_orig_xlib +#define XFreeFontNames XFreeFontNames_dylibloader_orig_xlib +#define XFreeFontPath XFreeFontPath_dylibloader_orig_xlib +#define XFreeGC XFreeGC_dylibloader_orig_xlib +#define XFreeModifiermap XFreeModifiermap_dylibloader_orig_xlib +#define XFreePixmap XFreePixmap_dylibloader_orig_xlib +#define XGeometry XGeometry_dylibloader_orig_xlib +#define XGetErrorDatabaseText XGetErrorDatabaseText_dylibloader_orig_xlib +#define XGetErrorText XGetErrorText_dylibloader_orig_xlib +#define XGetFontProperty XGetFontProperty_dylibloader_orig_xlib +#define XGetGCValues XGetGCValues_dylibloader_orig_xlib +#define XGetGeometry XGetGeometry_dylibloader_orig_xlib +#define XGetIconName XGetIconName_dylibloader_orig_xlib +#define XGetInputFocus XGetInputFocus_dylibloader_orig_xlib +#define XGetKeyboardControl XGetKeyboardControl_dylibloader_orig_xlib +#define XGetPointerControl XGetPointerControl_dylibloader_orig_xlib +#define XGetPointerMapping XGetPointerMapping_dylibloader_orig_xlib +#define XGetScreenSaver XGetScreenSaver_dylibloader_orig_xlib +#define XGetTransientForHint XGetTransientForHint_dylibloader_orig_xlib +#define XGetWindowProperty XGetWindowProperty_dylibloader_orig_xlib +#define XGetWindowAttributes XGetWindowAttributes_dylibloader_orig_xlib +#define XGrabButton XGrabButton_dylibloader_orig_xlib +#define XGrabKey XGrabKey_dylibloader_orig_xlib +#define XGrabKeyboard XGrabKeyboard_dylibloader_orig_xlib +#define XGrabPointer XGrabPointer_dylibloader_orig_xlib +#define XGrabServer XGrabServer_dylibloader_orig_xlib +#define XHeightMMOfScreen XHeightMMOfScreen_dylibloader_orig_xlib +#define XHeightOfScreen XHeightOfScreen_dylibloader_orig_xlib +#define XIfEvent XIfEvent_dylibloader_orig_xlib +#define XImageByteOrder XImageByteOrder_dylibloader_orig_xlib +#define XInstallColormap XInstallColormap_dylibloader_orig_xlib +#define XKeysymToKeycode XKeysymToKeycode_dylibloader_orig_xlib +#define XKillClient XKillClient_dylibloader_orig_xlib +#define XLookupColor XLookupColor_dylibloader_orig_xlib +#define XLowerWindow XLowerWindow_dylibloader_orig_xlib +#define XMapRaised XMapRaised_dylibloader_orig_xlib +#define XMapSubwindows XMapSubwindows_dylibloader_orig_xlib +#define XMapWindow XMapWindow_dylibloader_orig_xlib +#define XMaskEvent XMaskEvent_dylibloader_orig_xlib +#define XMaxCmapsOfScreen XMaxCmapsOfScreen_dylibloader_orig_xlib +#define XMinCmapsOfScreen XMinCmapsOfScreen_dylibloader_orig_xlib +#define XMoveResizeWindow XMoveResizeWindow_dylibloader_orig_xlib +#define XMoveWindow XMoveWindow_dylibloader_orig_xlib +#define XNextEvent XNextEvent_dylibloader_orig_xlib +#define XNoOp XNoOp_dylibloader_orig_xlib +#define XParseColor XParseColor_dylibloader_orig_xlib +#define XParseGeometry XParseGeometry_dylibloader_orig_xlib +#define XPeekEvent XPeekEvent_dylibloader_orig_xlib +#define XPeekIfEvent XPeekIfEvent_dylibloader_orig_xlib +#define XPending XPending_dylibloader_orig_xlib +#define XPlanesOfScreen XPlanesOfScreen_dylibloader_orig_xlib +#define XProtocolRevision XProtocolRevision_dylibloader_orig_xlib +#define XProtocolVersion XProtocolVersion_dylibloader_orig_xlib +#define XPutBackEvent XPutBackEvent_dylibloader_orig_xlib +#define XPutImage XPutImage_dylibloader_orig_xlib +#define XQLength XQLength_dylibloader_orig_xlib +#define XQueryBestCursor XQueryBestCursor_dylibloader_orig_xlib +#define XQueryBestSize XQueryBestSize_dylibloader_orig_xlib +#define XQueryBestStipple XQueryBestStipple_dylibloader_orig_xlib +#define XQueryBestTile XQueryBestTile_dylibloader_orig_xlib +#define XQueryColor XQueryColor_dylibloader_orig_xlib +#define XQueryColors XQueryColors_dylibloader_orig_xlib +#define XQueryExtension XQueryExtension_dylibloader_orig_xlib +#define XQueryKeymap XQueryKeymap_dylibloader_orig_xlib +#define XQueryPointer XQueryPointer_dylibloader_orig_xlib +#define XQueryTextExtents XQueryTextExtents_dylibloader_orig_xlib +#define XQueryTextExtents16 XQueryTextExtents16_dylibloader_orig_xlib +#define XQueryTree XQueryTree_dylibloader_orig_xlib +#define XRaiseWindow XRaiseWindow_dylibloader_orig_xlib +#define XReadBitmapFile XReadBitmapFile_dylibloader_orig_xlib +#define XReadBitmapFileData XReadBitmapFileData_dylibloader_orig_xlib +#define XRebindKeysym XRebindKeysym_dylibloader_orig_xlib +#define XRecolorCursor XRecolorCursor_dylibloader_orig_xlib +#define XRefreshKeyboardMapping XRefreshKeyboardMapping_dylibloader_orig_xlib +#define XRemoveFromSaveSet XRemoveFromSaveSet_dylibloader_orig_xlib +#define XRemoveHost XRemoveHost_dylibloader_orig_xlib +#define XRemoveHosts XRemoveHosts_dylibloader_orig_xlib +#define XReparentWindow XReparentWindow_dylibloader_orig_xlib +#define XResetScreenSaver XResetScreenSaver_dylibloader_orig_xlib +#define XResizeWindow XResizeWindow_dylibloader_orig_xlib +#define XRestackWindows XRestackWindows_dylibloader_orig_xlib +#define XRotateBuffers XRotateBuffers_dylibloader_orig_xlib +#define XRotateWindowProperties XRotateWindowProperties_dylibloader_orig_xlib +#define XScreenCount XScreenCount_dylibloader_orig_xlib +#define XSelectInput XSelectInput_dylibloader_orig_xlib +#define XSendEvent XSendEvent_dylibloader_orig_xlib +#define XSetAccessControl XSetAccessControl_dylibloader_orig_xlib +#define XSetArcMode XSetArcMode_dylibloader_orig_xlib +#define XSetBackground XSetBackground_dylibloader_orig_xlib +#define XSetClipMask XSetClipMask_dylibloader_orig_xlib +#define XSetClipOrigin XSetClipOrigin_dylibloader_orig_xlib +#define XSetClipRectangles XSetClipRectangles_dylibloader_orig_xlib +#define XSetCloseDownMode XSetCloseDownMode_dylibloader_orig_xlib +#define XSetCommand XSetCommand_dylibloader_orig_xlib +#define XSetDashes XSetDashes_dylibloader_orig_xlib +#define XSetFillRule XSetFillRule_dylibloader_orig_xlib +#define XSetFillStyle XSetFillStyle_dylibloader_orig_xlib +#define XSetFont XSetFont_dylibloader_orig_xlib +#define XSetFontPath XSetFontPath_dylibloader_orig_xlib +#define XSetForeground XSetForeground_dylibloader_orig_xlib +#define XSetFunction XSetFunction_dylibloader_orig_xlib +#define XSetGraphicsExposures XSetGraphicsExposures_dylibloader_orig_xlib +#define XSetIconName XSetIconName_dylibloader_orig_xlib +#define XSetInputFocus XSetInputFocus_dylibloader_orig_xlib +#define XSetLineAttributes XSetLineAttributes_dylibloader_orig_xlib +#define XSetModifierMapping XSetModifierMapping_dylibloader_orig_xlib +#define XSetPlaneMask XSetPlaneMask_dylibloader_orig_xlib +#define XSetPointerMapping XSetPointerMapping_dylibloader_orig_xlib +#define XSetScreenSaver XSetScreenSaver_dylibloader_orig_xlib +#define XSetSelectionOwner XSetSelectionOwner_dylibloader_orig_xlib +#define XSetState XSetState_dylibloader_orig_xlib +#define XSetStipple XSetStipple_dylibloader_orig_xlib +#define XSetSubwindowMode XSetSubwindowMode_dylibloader_orig_xlib +#define XSetTSOrigin XSetTSOrigin_dylibloader_orig_xlib +#define XSetTile XSetTile_dylibloader_orig_xlib +#define XSetWindowBackground XSetWindowBackground_dylibloader_orig_xlib +#define XSetWindowBackgroundPixmap XSetWindowBackgroundPixmap_dylibloader_orig_xlib +#define XSetWindowBorder XSetWindowBorder_dylibloader_orig_xlib +#define XSetWindowBorderPixmap XSetWindowBorderPixmap_dylibloader_orig_xlib +#define XSetWindowBorderWidth XSetWindowBorderWidth_dylibloader_orig_xlib +#define XSetWindowColormap XSetWindowColormap_dylibloader_orig_xlib +#define XStoreBuffer XStoreBuffer_dylibloader_orig_xlib +#define XStoreBytes XStoreBytes_dylibloader_orig_xlib +#define XStoreColor XStoreColor_dylibloader_orig_xlib +#define XStoreColors XStoreColors_dylibloader_orig_xlib +#define XStoreName XStoreName_dylibloader_orig_xlib +#define XStoreNamedColor XStoreNamedColor_dylibloader_orig_xlib +#define XSync XSync_dylibloader_orig_xlib +#define XTextExtents XTextExtents_dylibloader_orig_xlib +#define XTextExtents16 XTextExtents16_dylibloader_orig_xlib +#define XTextWidth XTextWidth_dylibloader_orig_xlib +#define XTextWidth16 XTextWidth16_dylibloader_orig_xlib +#define XTranslateCoordinates XTranslateCoordinates_dylibloader_orig_xlib +#define XUndefineCursor XUndefineCursor_dylibloader_orig_xlib +#define XUngrabButton XUngrabButton_dylibloader_orig_xlib +#define XUngrabKey XUngrabKey_dylibloader_orig_xlib +#define XUngrabKeyboard XUngrabKeyboard_dylibloader_orig_xlib +#define XUngrabPointer XUngrabPointer_dylibloader_orig_xlib +#define XUngrabServer XUngrabServer_dylibloader_orig_xlib +#define XUninstallColormap XUninstallColormap_dylibloader_orig_xlib +#define XUnloadFont XUnloadFont_dylibloader_orig_xlib +#define XUnmapSubwindows XUnmapSubwindows_dylibloader_orig_xlib +#define XUnmapWindow XUnmapWindow_dylibloader_orig_xlib +#define XVendorRelease XVendorRelease_dylibloader_orig_xlib +#define XWarpPointer XWarpPointer_dylibloader_orig_xlib +#define XWidthMMOfScreen XWidthMMOfScreen_dylibloader_orig_xlib +#define XWidthOfScreen XWidthOfScreen_dylibloader_orig_xlib +#define XWindowEvent XWindowEvent_dylibloader_orig_xlib +#define XWriteBitmapFile XWriteBitmapFile_dylibloader_orig_xlib +#define XSupportsLocale XSupportsLocale_dylibloader_orig_xlib +#define XSetLocaleModifiers XSetLocaleModifiers_dylibloader_orig_xlib +#define XOpenOM XOpenOM_dylibloader_orig_xlib +#define XCloseOM XCloseOM_dylibloader_orig_xlib +#define XSetOMValues XSetOMValues_dylibloader_orig_xlib +#define XGetOMValues XGetOMValues_dylibloader_orig_xlib +#define XDisplayOfOM XDisplayOfOM_dylibloader_orig_xlib +#define XLocaleOfOM XLocaleOfOM_dylibloader_orig_xlib +#define XCreateOC XCreateOC_dylibloader_orig_xlib +#define XDestroyOC XDestroyOC_dylibloader_orig_xlib +#define XOMOfOC XOMOfOC_dylibloader_orig_xlib +#define XSetOCValues XSetOCValues_dylibloader_orig_xlib +#define XGetOCValues XGetOCValues_dylibloader_orig_xlib +#define XCreateFontSet XCreateFontSet_dylibloader_orig_xlib +#define XFreeFontSet XFreeFontSet_dylibloader_orig_xlib +#define XFontsOfFontSet XFontsOfFontSet_dylibloader_orig_xlib +#define XBaseFontNameListOfFontSet XBaseFontNameListOfFontSet_dylibloader_orig_xlib +#define XLocaleOfFontSet XLocaleOfFontSet_dylibloader_orig_xlib +#define XContextDependentDrawing XContextDependentDrawing_dylibloader_orig_xlib +#define XDirectionalDependentDrawing XDirectionalDependentDrawing_dylibloader_orig_xlib +#define XContextualDrawing XContextualDrawing_dylibloader_orig_xlib +#define XExtentsOfFontSet XExtentsOfFontSet_dylibloader_orig_xlib +#define XmbTextEscapement XmbTextEscapement_dylibloader_orig_xlib +#define XwcTextEscapement XwcTextEscapement_dylibloader_orig_xlib +#define Xutf8TextEscapement Xutf8TextEscapement_dylibloader_orig_xlib +#define XmbTextExtents XmbTextExtents_dylibloader_orig_xlib +#define XwcTextExtents XwcTextExtents_dylibloader_orig_xlib +#define Xutf8TextExtents Xutf8TextExtents_dylibloader_orig_xlib +#define XmbTextPerCharExtents XmbTextPerCharExtents_dylibloader_orig_xlib +#define XwcTextPerCharExtents XwcTextPerCharExtents_dylibloader_orig_xlib +#define Xutf8TextPerCharExtents Xutf8TextPerCharExtents_dylibloader_orig_xlib +#define XmbDrawText XmbDrawText_dylibloader_orig_xlib +#define XwcDrawText XwcDrawText_dylibloader_orig_xlib +#define Xutf8DrawText Xutf8DrawText_dylibloader_orig_xlib +#define XmbDrawString XmbDrawString_dylibloader_orig_xlib +#define XwcDrawString XwcDrawString_dylibloader_orig_xlib +#define Xutf8DrawString Xutf8DrawString_dylibloader_orig_xlib +#define XmbDrawImageString XmbDrawImageString_dylibloader_orig_xlib +#define XwcDrawImageString XwcDrawImageString_dylibloader_orig_xlib +#define Xutf8DrawImageString Xutf8DrawImageString_dylibloader_orig_xlib +#define XOpenIM XOpenIM_dylibloader_orig_xlib +#define XCloseIM XCloseIM_dylibloader_orig_xlib +#define XGetIMValues XGetIMValues_dylibloader_orig_xlib +#define XSetIMValues XSetIMValues_dylibloader_orig_xlib +#define XDisplayOfIM XDisplayOfIM_dylibloader_orig_xlib +#define XLocaleOfIM XLocaleOfIM_dylibloader_orig_xlib +#define XCreateIC XCreateIC_dylibloader_orig_xlib +#define XDestroyIC XDestroyIC_dylibloader_orig_xlib +#define XSetICFocus XSetICFocus_dylibloader_orig_xlib +#define XUnsetICFocus XUnsetICFocus_dylibloader_orig_xlib +#define XwcResetIC XwcResetIC_dylibloader_orig_xlib +#define XmbResetIC XmbResetIC_dylibloader_orig_xlib +#define Xutf8ResetIC Xutf8ResetIC_dylibloader_orig_xlib +#define XSetICValues XSetICValues_dylibloader_orig_xlib +#define XGetICValues XGetICValues_dylibloader_orig_xlib +#define XIMOfIC XIMOfIC_dylibloader_orig_xlib +#define XFilterEvent XFilterEvent_dylibloader_orig_xlib +#define XmbLookupString XmbLookupString_dylibloader_orig_xlib +#define XwcLookupString XwcLookupString_dylibloader_orig_xlib +#define Xutf8LookupString Xutf8LookupString_dylibloader_orig_xlib +#define XVaCreateNestedList XVaCreateNestedList_dylibloader_orig_xlib +#define XRegisterIMInstantiateCallback XRegisterIMInstantiateCallback_dylibloader_orig_xlib +#define XUnregisterIMInstantiateCallback XUnregisterIMInstantiateCallback_dylibloader_orig_xlib +#define XInternalConnectionNumbers XInternalConnectionNumbers_dylibloader_orig_xlib +#define XProcessInternalConnection XProcessInternalConnection_dylibloader_orig_xlib +#define XAddConnectionWatch XAddConnectionWatch_dylibloader_orig_xlib +#define XRemoveConnectionWatch XRemoveConnectionWatch_dylibloader_orig_xlib +#define XSetAuthorization XSetAuthorization_dylibloader_orig_xlib +#define _Xmbtowc _Xmbtowc_dylibloader_orig_xlib +#define _Xwctomb _Xwctomb_dylibloader_orig_xlib +#define XGetEventData XGetEventData_dylibloader_orig_xlib +#define XFreeEventData XFreeEventData_dylibloader_orig_xlib +#define XAllocClassHint XAllocClassHint_dylibloader_orig_xlib +#define XAllocIconSize XAllocIconSize_dylibloader_orig_xlib +#define XAllocSizeHints XAllocSizeHints_dylibloader_orig_xlib +#define XAllocStandardColormap XAllocStandardColormap_dylibloader_orig_xlib +#define XAllocWMHints XAllocWMHints_dylibloader_orig_xlib +#define XClipBox XClipBox_dylibloader_orig_xlib +#define XCreateRegion XCreateRegion_dylibloader_orig_xlib +#define XDefaultString XDefaultString_dylibloader_orig_xlib +#define XDeleteContext XDeleteContext_dylibloader_orig_xlib +#define XDestroyRegion XDestroyRegion_dylibloader_orig_xlib +#define XEmptyRegion XEmptyRegion_dylibloader_orig_xlib +#define XEqualRegion XEqualRegion_dylibloader_orig_xlib +#define XFindContext XFindContext_dylibloader_orig_xlib +#define XGetClassHint XGetClassHint_dylibloader_orig_xlib +#define XGetIconSizes XGetIconSizes_dylibloader_orig_xlib +#define XGetNormalHints XGetNormalHints_dylibloader_orig_xlib +#define XGetRGBColormaps XGetRGBColormaps_dylibloader_orig_xlib +#define XGetSizeHints XGetSizeHints_dylibloader_orig_xlib +#define XGetStandardColormap XGetStandardColormap_dylibloader_orig_xlib +#define XGetTextProperty XGetTextProperty_dylibloader_orig_xlib +#define XGetVisualInfo XGetVisualInfo_dylibloader_orig_xlib +#define XGetWMClientMachine XGetWMClientMachine_dylibloader_orig_xlib +#define XGetWMHints XGetWMHints_dylibloader_orig_xlib +#define XGetWMIconName XGetWMIconName_dylibloader_orig_xlib +#define XGetWMName XGetWMName_dylibloader_orig_xlib +#define XGetWMNormalHints XGetWMNormalHints_dylibloader_orig_xlib +#define XGetWMSizeHints XGetWMSizeHints_dylibloader_orig_xlib +#define XGetZoomHints XGetZoomHints_dylibloader_orig_xlib +#define XIntersectRegion XIntersectRegion_dylibloader_orig_xlib +#define XConvertCase XConvertCase_dylibloader_orig_xlib +#define XLookupString XLookupString_dylibloader_orig_xlib +#define XMatchVisualInfo XMatchVisualInfo_dylibloader_orig_xlib +#define XOffsetRegion XOffsetRegion_dylibloader_orig_xlib +#define XPointInRegion XPointInRegion_dylibloader_orig_xlib +#define XPolygonRegion XPolygonRegion_dylibloader_orig_xlib +#define XRectInRegion XRectInRegion_dylibloader_orig_xlib +#define XSaveContext XSaveContext_dylibloader_orig_xlib +#define XSetClassHint XSetClassHint_dylibloader_orig_xlib +#define XSetIconSizes XSetIconSizes_dylibloader_orig_xlib +#define XSetNormalHints XSetNormalHints_dylibloader_orig_xlib +#define XSetRGBColormaps XSetRGBColormaps_dylibloader_orig_xlib +#define XSetSizeHints XSetSizeHints_dylibloader_orig_xlib +#define XSetStandardProperties XSetStandardProperties_dylibloader_orig_xlib +#define XSetTextProperty XSetTextProperty_dylibloader_orig_xlib +#define XSetWMClientMachine XSetWMClientMachine_dylibloader_orig_xlib +#define XSetWMHints XSetWMHints_dylibloader_orig_xlib +#define XSetWMIconName XSetWMIconName_dylibloader_orig_xlib +#define XSetWMName XSetWMName_dylibloader_orig_xlib +#define XSetWMNormalHints XSetWMNormalHints_dylibloader_orig_xlib +#define XSetWMProperties XSetWMProperties_dylibloader_orig_xlib +#define XmbSetWMProperties XmbSetWMProperties_dylibloader_orig_xlib +#define Xutf8SetWMProperties Xutf8SetWMProperties_dylibloader_orig_xlib +#define XSetWMSizeHints XSetWMSizeHints_dylibloader_orig_xlib +#define XSetRegion XSetRegion_dylibloader_orig_xlib +#define XSetStandardColormap XSetStandardColormap_dylibloader_orig_xlib +#define XSetZoomHints XSetZoomHints_dylibloader_orig_xlib +#define XShrinkRegion XShrinkRegion_dylibloader_orig_xlib +#define XStringListToTextProperty XStringListToTextProperty_dylibloader_orig_xlib +#define XSubtractRegion XSubtractRegion_dylibloader_orig_xlib +#define XmbTextListToTextProperty XmbTextListToTextProperty_dylibloader_orig_xlib +#define XwcTextListToTextProperty XwcTextListToTextProperty_dylibloader_orig_xlib +#define Xutf8TextListToTextProperty Xutf8TextListToTextProperty_dylibloader_orig_xlib +#define XwcFreeStringList XwcFreeStringList_dylibloader_orig_xlib +#define XTextPropertyToStringList XTextPropertyToStringList_dylibloader_orig_xlib +#define XmbTextPropertyToTextList XmbTextPropertyToTextList_dylibloader_orig_xlib +#define XwcTextPropertyToTextList XwcTextPropertyToTextList_dylibloader_orig_xlib +#define Xutf8TextPropertyToTextList Xutf8TextPropertyToTextList_dylibloader_orig_xlib +#define XUnionRectWithRegion XUnionRectWithRegion_dylibloader_orig_xlib +#define XUnionRegion XUnionRegion_dylibloader_orig_xlib +#define XWMGeometry XWMGeometry_dylibloader_orig_xlib +#define XXorRegion XXorRegion_dylibloader_orig_xlib +#define XkbIgnoreExtension XkbIgnoreExtension_dylibloader_orig_xlib +#define XkbOpenDisplay XkbOpenDisplay_dylibloader_orig_xlib +#define XkbQueryExtension XkbQueryExtension_dylibloader_orig_xlib +#define XkbUseExtension XkbUseExtension_dylibloader_orig_xlib +#define XkbLibraryVersion XkbLibraryVersion_dylibloader_orig_xlib +#define XkbSetXlibControls XkbSetXlibControls_dylibloader_orig_xlib +#define XkbGetXlibControls XkbGetXlibControls_dylibloader_orig_xlib +#define XkbXlibControlsImplemented XkbXlibControlsImplemented_dylibloader_orig_xlib +#define XkbSetAtomFuncs XkbSetAtomFuncs_dylibloader_orig_xlib +#define XkbKeycodeToKeysym XkbKeycodeToKeysym_dylibloader_orig_xlib +#define XkbKeysymToModifiers XkbKeysymToModifiers_dylibloader_orig_xlib +#define XkbLookupKeySym XkbLookupKeySym_dylibloader_orig_xlib +#define XkbLookupKeyBinding XkbLookupKeyBinding_dylibloader_orig_xlib +#define XkbTranslateKeyCode XkbTranslateKeyCode_dylibloader_orig_xlib +#define XkbTranslateKeySym XkbTranslateKeySym_dylibloader_orig_xlib +#define XkbSetAutoRepeatRate XkbSetAutoRepeatRate_dylibloader_orig_xlib +#define XkbGetAutoRepeatRate XkbGetAutoRepeatRate_dylibloader_orig_xlib +#define XkbChangeEnabledControls XkbChangeEnabledControls_dylibloader_orig_xlib +#define XkbDeviceBell XkbDeviceBell_dylibloader_orig_xlib +#define XkbForceDeviceBell XkbForceDeviceBell_dylibloader_orig_xlib +#define XkbDeviceBellEvent XkbDeviceBellEvent_dylibloader_orig_xlib +#define XkbBell XkbBell_dylibloader_orig_xlib +#define XkbForceBell XkbForceBell_dylibloader_orig_xlib +#define XkbBellEvent XkbBellEvent_dylibloader_orig_xlib +#define XkbSelectEvents XkbSelectEvents_dylibloader_orig_xlib +#define XkbSelectEventDetails XkbSelectEventDetails_dylibloader_orig_xlib +#define XkbNoteMapChanges XkbNoteMapChanges_dylibloader_orig_xlib +#define XkbNoteNameChanges XkbNoteNameChanges_dylibloader_orig_xlib +#define XkbGetIndicatorState XkbGetIndicatorState_dylibloader_orig_xlib +#define XkbGetIndicatorMap XkbGetIndicatorMap_dylibloader_orig_xlib +#define XkbSetIndicatorMap XkbSetIndicatorMap_dylibloader_orig_xlib +#define XkbGetNamedIndicator XkbGetNamedIndicator_dylibloader_orig_xlib +#define XkbGetNamedDeviceIndicator XkbGetNamedDeviceIndicator_dylibloader_orig_xlib +#define XkbSetNamedIndicator XkbSetNamedIndicator_dylibloader_orig_xlib +#define XkbSetNamedDeviceIndicator XkbSetNamedDeviceIndicator_dylibloader_orig_xlib +#define XkbLockModifiers XkbLockModifiers_dylibloader_orig_xlib +#define XkbLatchModifiers XkbLatchModifiers_dylibloader_orig_xlib +#define XkbLockGroup XkbLockGroup_dylibloader_orig_xlib +#define XkbLatchGroup XkbLatchGroup_dylibloader_orig_xlib +#define XkbSetServerInternalMods XkbSetServerInternalMods_dylibloader_orig_xlib +#define XkbSetIgnoreLockMods XkbSetIgnoreLockMods_dylibloader_orig_xlib +#define XkbVirtualModsToReal XkbVirtualModsToReal_dylibloader_orig_xlib +#define XkbComputeEffectiveMap XkbComputeEffectiveMap_dylibloader_orig_xlib +#define XkbInitCanonicalKeyTypes XkbInitCanonicalKeyTypes_dylibloader_orig_xlib +#define XkbAllocKeyboard XkbAllocKeyboard_dylibloader_orig_xlib +#define XkbFreeKeyboard XkbFreeKeyboard_dylibloader_orig_xlib +#define XkbAllocClientMap XkbAllocClientMap_dylibloader_orig_xlib +#define XkbAllocServerMap XkbAllocServerMap_dylibloader_orig_xlib +#define XkbFreeClientMap XkbFreeClientMap_dylibloader_orig_xlib +#define XkbFreeServerMap XkbFreeServerMap_dylibloader_orig_xlib +#define XkbAddKeyType XkbAddKeyType_dylibloader_orig_xlib +#define XkbAllocIndicatorMaps XkbAllocIndicatorMaps_dylibloader_orig_xlib +#define XkbFreeIndicatorMaps XkbFreeIndicatorMaps_dylibloader_orig_xlib +#define XkbGetMap XkbGetMap_dylibloader_orig_xlib +#define XkbGetUpdatedMap XkbGetUpdatedMap_dylibloader_orig_xlib +#define XkbGetMapChanges XkbGetMapChanges_dylibloader_orig_xlib +#define XkbRefreshKeyboardMapping XkbRefreshKeyboardMapping_dylibloader_orig_xlib +#define XkbGetKeyTypes XkbGetKeyTypes_dylibloader_orig_xlib +#define XkbGetKeySyms XkbGetKeySyms_dylibloader_orig_xlib +#define XkbGetKeyActions XkbGetKeyActions_dylibloader_orig_xlib +#define XkbGetKeyBehaviors XkbGetKeyBehaviors_dylibloader_orig_xlib +#define XkbGetVirtualMods XkbGetVirtualMods_dylibloader_orig_xlib +#define XkbGetKeyExplicitComponents XkbGetKeyExplicitComponents_dylibloader_orig_xlib +#define XkbGetKeyModifierMap XkbGetKeyModifierMap_dylibloader_orig_xlib +#define XkbGetKeyVirtualModMap XkbGetKeyVirtualModMap_dylibloader_orig_xlib +#define XkbAllocControls XkbAllocControls_dylibloader_orig_xlib +#define XkbFreeControls XkbFreeControls_dylibloader_orig_xlib +#define XkbGetControls XkbGetControls_dylibloader_orig_xlib +#define XkbSetControls XkbSetControls_dylibloader_orig_xlib +#define XkbNoteControlsChanges XkbNoteControlsChanges_dylibloader_orig_xlib +#define XkbAllocCompatMap XkbAllocCompatMap_dylibloader_orig_xlib +#define XkbFreeCompatMap XkbFreeCompatMap_dylibloader_orig_xlib +#define XkbGetCompatMap XkbGetCompatMap_dylibloader_orig_xlib +#define XkbSetCompatMap XkbSetCompatMap_dylibloader_orig_xlib +#define XkbAllocNames XkbAllocNames_dylibloader_orig_xlib +#define XkbGetNames XkbGetNames_dylibloader_orig_xlib +#define XkbSetNames XkbSetNames_dylibloader_orig_xlib +#define XkbChangeNames XkbChangeNames_dylibloader_orig_xlib +#define XkbFreeNames XkbFreeNames_dylibloader_orig_xlib +#define XkbGetState XkbGetState_dylibloader_orig_xlib +#define XkbSetMap XkbSetMap_dylibloader_orig_xlib +#define XkbChangeMap XkbChangeMap_dylibloader_orig_xlib +#define XkbSetDetectableAutoRepeat XkbSetDetectableAutoRepeat_dylibloader_orig_xlib +#define XkbGetDetectableAutoRepeat XkbGetDetectableAutoRepeat_dylibloader_orig_xlib +#define XkbSetAutoResetControls XkbSetAutoResetControls_dylibloader_orig_xlib +#define XkbGetAutoResetControls XkbGetAutoResetControls_dylibloader_orig_xlib +#define XkbSetPerClientControls XkbSetPerClientControls_dylibloader_orig_xlib +#define XkbGetPerClientControls XkbGetPerClientControls_dylibloader_orig_xlib +#define XkbCopyKeyType XkbCopyKeyType_dylibloader_orig_xlib +#define XkbCopyKeyTypes XkbCopyKeyTypes_dylibloader_orig_xlib +#define XkbResizeKeyType XkbResizeKeyType_dylibloader_orig_xlib +#define XkbResizeKeySyms XkbResizeKeySyms_dylibloader_orig_xlib +#define XkbResizeKeyActions XkbResizeKeyActions_dylibloader_orig_xlib +#define XkbChangeTypesOfKey XkbChangeTypesOfKey_dylibloader_orig_xlib +#define XkbChangeKeycodeRange XkbChangeKeycodeRange_dylibloader_orig_xlib +#define XkbListComponents XkbListComponents_dylibloader_orig_xlib +#define XkbFreeComponentList XkbFreeComponentList_dylibloader_orig_xlib +#define XkbGetKeyboard XkbGetKeyboard_dylibloader_orig_xlib +#define XkbGetKeyboardByName XkbGetKeyboardByName_dylibloader_orig_xlib +#define XkbKeyTypesForCoreSymbols XkbKeyTypesForCoreSymbols_dylibloader_orig_xlib +#define XkbApplyCompatMapToKey XkbApplyCompatMapToKey_dylibloader_orig_xlib +#define XkbUpdateMapFromCore XkbUpdateMapFromCore_dylibloader_orig_xlib +#define XkbAddDeviceLedInfo XkbAddDeviceLedInfo_dylibloader_orig_xlib +#define XkbResizeDeviceButtonActions XkbResizeDeviceButtonActions_dylibloader_orig_xlib +#define XkbAllocDeviceInfo XkbAllocDeviceInfo_dylibloader_orig_xlib +#define XkbFreeDeviceInfo XkbFreeDeviceInfo_dylibloader_orig_xlib +#define XkbNoteDeviceChanges XkbNoteDeviceChanges_dylibloader_orig_xlib +#define XkbGetDeviceInfo XkbGetDeviceInfo_dylibloader_orig_xlib +#define XkbGetDeviceInfoChanges XkbGetDeviceInfoChanges_dylibloader_orig_xlib +#define XkbGetDeviceButtonActions XkbGetDeviceButtonActions_dylibloader_orig_xlib +#define XkbGetDeviceLedInfo XkbGetDeviceLedInfo_dylibloader_orig_xlib +#define XkbSetDeviceInfo XkbSetDeviceInfo_dylibloader_orig_xlib +#define XkbChangeDeviceInfo XkbChangeDeviceInfo_dylibloader_orig_xlib +#define XkbSetDeviceLedInfo XkbSetDeviceLedInfo_dylibloader_orig_xlib +#define XkbSetDeviceButtonActions XkbSetDeviceButtonActions_dylibloader_orig_xlib +#define XkbToControl XkbToControl_dylibloader_orig_xlib +#define XkbSetDebuggingFlags XkbSetDebuggingFlags_dylibloader_orig_xlib +#define XkbApplyVirtualModChanges XkbApplyVirtualModChanges_dylibloader_orig_xlib +#define XkbUpdateActionVirtualMods XkbUpdateActionVirtualMods_dylibloader_orig_xlib +#define XkbUpdateKeyTypeVirtualMods XkbUpdateKeyTypeVirtualMods_dylibloader_orig_xlib +#include <X11/Xlib.h> +#include <X11/Xutil.h> +#include <X11/XKBlib.h> +#undef _Xmblen +#undef XLoadQueryFont +#undef XQueryFont +#undef XGetMotionEvents +#undef XDeleteModifiermapEntry +#undef XGetModifierMapping +#undef XInsertModifiermapEntry +#undef XNewModifiermap +#undef XCreateImage +#undef XInitImage +#undef XGetImage +#undef XGetSubImage +#undef XOpenDisplay +#undef XrmInitialize +#undef XFetchBytes +#undef XFetchBuffer +#undef XGetAtomName +#undef XGetAtomNames +#undef XGetDefault +#undef XDisplayName +#undef XKeysymToString +#undef XSynchronize +#undef XSetAfterFunction +#undef XInternAtom +#undef XInternAtoms +#undef XCopyColormapAndFree +#undef XCreateColormap +#undef XCreatePixmapCursor +#undef XCreateGlyphCursor +#undef XCreateFontCursor +#undef XLoadFont +#undef XCreateGC +#undef XGContextFromGC +#undef XFlushGC +#undef XCreatePixmap +#undef XCreateBitmapFromData +#undef XCreatePixmapFromBitmapData +#undef XCreateSimpleWindow +#undef XGetSelectionOwner +#undef XCreateWindow +#undef XListInstalledColormaps +#undef XListFonts +#undef XListFontsWithInfo +#undef XGetFontPath +#undef XListExtensions +#undef XListProperties +#undef XListHosts +#undef XKeycodeToKeysym +#undef XLookupKeysym +#undef XGetKeyboardMapping +#undef XStringToKeysym +#undef XMaxRequestSize +#undef XExtendedMaxRequestSize +#undef XResourceManagerString +#undef XScreenResourceString +#undef XDisplayMotionBufferSize +#undef XVisualIDFromVisual +#undef XInitThreads +#undef XLockDisplay +#undef XUnlockDisplay +#undef XInitExtension +#undef XAddExtension +#undef XFindOnExtensionList +#undef XEHeadOfExtensionList +#undef XRootWindow +#undef XDefaultRootWindow +#undef XRootWindowOfScreen +#undef XDefaultVisual +#undef XDefaultVisualOfScreen +#undef XDefaultGC +#undef XDefaultGCOfScreen +#undef XBlackPixel +#undef XWhitePixel +#undef XAllPlanes +#undef XBlackPixelOfScreen +#undef XWhitePixelOfScreen +#undef XNextRequest +#undef XLastKnownRequestProcessed +#undef XServerVendor +#undef XDisplayString +#undef XDefaultColormap +#undef XDefaultColormapOfScreen +#undef XDisplayOfScreen +#undef XScreenOfDisplay +#undef XDefaultScreenOfDisplay +#undef XEventMaskOfScreen +#undef XScreenNumberOfScreen +#undef XSetErrorHandler +#undef XSetIOErrorHandler +#undef XListPixmapFormats +#undef XListDepths +#undef XReconfigureWMWindow +#undef XGetWMProtocols +#undef XSetWMProtocols +#undef XIconifyWindow +#undef XWithdrawWindow +#undef XGetCommand +#undef XGetWMColormapWindows +#undef XSetWMColormapWindows +#undef XFreeStringList +#undef XSetTransientForHint +#undef XActivateScreenSaver +#undef XAddHost +#undef XAddHosts +#undef XAddToExtensionList +#undef XAddToSaveSet +#undef XAllocColor +#undef XAllocColorCells +#undef XAllocColorPlanes +#undef XAllocNamedColor +#undef XAllowEvents +#undef XAutoRepeatOff +#undef XAutoRepeatOn +#undef XBell +#undef XBitmapBitOrder +#undef XBitmapPad +#undef XBitmapUnit +#undef XCellsOfScreen +#undef XChangeActivePointerGrab +#undef XChangeGC +#undef XChangeKeyboardControl +#undef XChangeKeyboardMapping +#undef XChangePointerControl +#undef XChangeProperty +#undef XChangeSaveSet +#undef XChangeWindowAttributes +#undef XCheckIfEvent +#undef XCheckMaskEvent +#undef XCheckTypedEvent +#undef XCheckTypedWindowEvent +#undef XCheckWindowEvent +#undef XCirculateSubwindows +#undef XCirculateSubwindowsDown +#undef XCirculateSubwindowsUp +#undef XClearArea +#undef XClearWindow +#undef XCloseDisplay +#undef XConfigureWindow +#undef XConnectionNumber +#undef XConvertSelection +#undef XCopyArea +#undef XCopyGC +#undef XCopyPlane +#undef XDefaultDepth +#undef XDefaultDepthOfScreen +#undef XDefaultScreen +#undef XDefineCursor +#undef XDeleteProperty +#undef XDestroyWindow +#undef XDestroySubwindows +#undef XDoesBackingStore +#undef XDoesSaveUnders +#undef XDisableAccessControl +#undef XDisplayCells +#undef XDisplayHeight +#undef XDisplayHeightMM +#undef XDisplayKeycodes +#undef XDisplayPlanes +#undef XDisplayWidth +#undef XDisplayWidthMM +#undef XDrawArc +#undef XDrawArcs +#undef XDrawImageString +#undef XDrawImageString16 +#undef XDrawLine +#undef XDrawLines +#undef XDrawPoint +#undef XDrawPoints +#undef XDrawRectangle +#undef XDrawRectangles +#undef XDrawSegments +#undef XDrawString +#undef XDrawString16 +#undef XDrawText +#undef XDrawText16 +#undef XEnableAccessControl +#undef XEventsQueued +#undef XFetchName +#undef XFillArc +#undef XFillArcs +#undef XFillPolygon +#undef XFillRectangle +#undef XFillRectangles +#undef XFlush +#undef XForceScreenSaver +#undef XFree +#undef XFreeColormap +#undef XFreeColors +#undef XFreeCursor +#undef XFreeExtensionList +#undef XFreeFont +#undef XFreeFontInfo +#undef XFreeFontNames +#undef XFreeFontPath +#undef XFreeGC +#undef XFreeModifiermap +#undef XFreePixmap +#undef XGeometry +#undef XGetErrorDatabaseText +#undef XGetErrorText +#undef XGetFontProperty +#undef XGetGCValues +#undef XGetGeometry +#undef XGetIconName +#undef XGetInputFocus +#undef XGetKeyboardControl +#undef XGetPointerControl +#undef XGetPointerMapping +#undef XGetScreenSaver +#undef XGetTransientForHint +#undef XGetWindowProperty +#undef XGetWindowAttributes +#undef XGrabButton +#undef XGrabKey +#undef XGrabKeyboard +#undef XGrabPointer +#undef XGrabServer +#undef XHeightMMOfScreen +#undef XHeightOfScreen +#undef XIfEvent +#undef XImageByteOrder +#undef XInstallColormap +#undef XKeysymToKeycode +#undef XKillClient +#undef XLookupColor +#undef XLowerWindow +#undef XMapRaised +#undef XMapSubwindows +#undef XMapWindow +#undef XMaskEvent +#undef XMaxCmapsOfScreen +#undef XMinCmapsOfScreen +#undef XMoveResizeWindow +#undef XMoveWindow +#undef XNextEvent +#undef XNoOp +#undef XParseColor +#undef XParseGeometry +#undef XPeekEvent +#undef XPeekIfEvent +#undef XPending +#undef XPlanesOfScreen +#undef XProtocolRevision +#undef XProtocolVersion +#undef XPutBackEvent +#undef XPutImage +#undef XQLength +#undef XQueryBestCursor +#undef XQueryBestSize +#undef XQueryBestStipple +#undef XQueryBestTile +#undef XQueryColor +#undef XQueryColors +#undef XQueryExtension +#undef XQueryKeymap +#undef XQueryPointer +#undef XQueryTextExtents +#undef XQueryTextExtents16 +#undef XQueryTree +#undef XRaiseWindow +#undef XReadBitmapFile +#undef XReadBitmapFileData +#undef XRebindKeysym +#undef XRecolorCursor +#undef XRefreshKeyboardMapping +#undef XRemoveFromSaveSet +#undef XRemoveHost +#undef XRemoveHosts +#undef XReparentWindow +#undef XResetScreenSaver +#undef XResizeWindow +#undef XRestackWindows +#undef XRotateBuffers +#undef XRotateWindowProperties +#undef XScreenCount +#undef XSelectInput +#undef XSendEvent +#undef XSetAccessControl +#undef XSetArcMode +#undef XSetBackground +#undef XSetClipMask +#undef XSetClipOrigin +#undef XSetClipRectangles +#undef XSetCloseDownMode +#undef XSetCommand +#undef XSetDashes +#undef XSetFillRule +#undef XSetFillStyle +#undef XSetFont +#undef XSetFontPath +#undef XSetForeground +#undef XSetFunction +#undef XSetGraphicsExposures +#undef XSetIconName +#undef XSetInputFocus +#undef XSetLineAttributes +#undef XSetModifierMapping +#undef XSetPlaneMask +#undef XSetPointerMapping +#undef XSetScreenSaver +#undef XSetSelectionOwner +#undef XSetState +#undef XSetStipple +#undef XSetSubwindowMode +#undef XSetTSOrigin +#undef XSetTile +#undef XSetWindowBackground +#undef XSetWindowBackgroundPixmap +#undef XSetWindowBorder +#undef XSetWindowBorderPixmap +#undef XSetWindowBorderWidth +#undef XSetWindowColormap +#undef XStoreBuffer +#undef XStoreBytes +#undef XStoreColor +#undef XStoreColors +#undef XStoreName +#undef XStoreNamedColor +#undef XSync +#undef XTextExtents +#undef XTextExtents16 +#undef XTextWidth +#undef XTextWidth16 +#undef XTranslateCoordinates +#undef XUndefineCursor +#undef XUngrabButton +#undef XUngrabKey +#undef XUngrabKeyboard +#undef XUngrabPointer +#undef XUngrabServer +#undef XUninstallColormap +#undef XUnloadFont +#undef XUnmapSubwindows +#undef XUnmapWindow +#undef XVendorRelease +#undef XWarpPointer +#undef XWidthMMOfScreen +#undef XWidthOfScreen +#undef XWindowEvent +#undef XWriteBitmapFile +#undef XSupportsLocale +#undef XSetLocaleModifiers +#undef XOpenOM +#undef XCloseOM +#undef XSetOMValues +#undef XGetOMValues +#undef XDisplayOfOM +#undef XLocaleOfOM +#undef XCreateOC +#undef XDestroyOC +#undef XOMOfOC +#undef XSetOCValues +#undef XGetOCValues +#undef XCreateFontSet +#undef XFreeFontSet +#undef XFontsOfFontSet +#undef XBaseFontNameListOfFontSet +#undef XLocaleOfFontSet +#undef XContextDependentDrawing +#undef XDirectionalDependentDrawing +#undef XContextualDrawing +#undef XExtentsOfFontSet +#undef XmbTextEscapement +#undef XwcTextEscapement +#undef Xutf8TextEscapement +#undef XmbTextExtents +#undef XwcTextExtents +#undef Xutf8TextExtents +#undef XmbTextPerCharExtents +#undef XwcTextPerCharExtents +#undef Xutf8TextPerCharExtents +#undef XmbDrawText +#undef XwcDrawText +#undef Xutf8DrawText +#undef XmbDrawString +#undef XwcDrawString +#undef Xutf8DrawString +#undef XmbDrawImageString +#undef XwcDrawImageString +#undef Xutf8DrawImageString +#undef XOpenIM +#undef XCloseIM +#undef XGetIMValues +#undef XSetIMValues +#undef XDisplayOfIM +#undef XLocaleOfIM +#undef XCreateIC +#undef XDestroyIC +#undef XSetICFocus +#undef XUnsetICFocus +#undef XwcResetIC +#undef XmbResetIC +#undef Xutf8ResetIC +#undef XSetICValues +#undef XGetICValues +#undef XIMOfIC +#undef XFilterEvent +#undef XmbLookupString +#undef XwcLookupString +#undef Xutf8LookupString +#undef XVaCreateNestedList +#undef XRegisterIMInstantiateCallback +#undef XUnregisterIMInstantiateCallback +#undef XInternalConnectionNumbers +#undef XProcessInternalConnection +#undef XAddConnectionWatch +#undef XRemoveConnectionWatch +#undef XSetAuthorization +#undef _Xmbtowc +#undef _Xwctomb +#undef XGetEventData +#undef XFreeEventData +#undef XAllocClassHint +#undef XAllocIconSize +#undef XAllocSizeHints +#undef XAllocStandardColormap +#undef XAllocWMHints +#undef XClipBox +#undef XCreateRegion +#undef XDefaultString +#undef XDeleteContext +#undef XDestroyRegion +#undef XEmptyRegion +#undef XEqualRegion +#undef XFindContext +#undef XGetClassHint +#undef XGetIconSizes +#undef XGetNormalHints +#undef XGetRGBColormaps +#undef XGetSizeHints +#undef XGetStandardColormap +#undef XGetTextProperty +#undef XGetVisualInfo +#undef XGetWMClientMachine +#undef XGetWMHints +#undef XGetWMIconName +#undef XGetWMName +#undef XGetWMNormalHints +#undef XGetWMSizeHints +#undef XGetZoomHints +#undef XIntersectRegion +#undef XConvertCase +#undef XLookupString +#undef XMatchVisualInfo +#undef XOffsetRegion +#undef XPointInRegion +#undef XPolygonRegion +#undef XRectInRegion +#undef XSaveContext +#undef XSetClassHint +#undef XSetIconSizes +#undef XSetNormalHints +#undef XSetRGBColormaps +#undef XSetSizeHints +#undef XSetStandardProperties +#undef XSetTextProperty +#undef XSetWMClientMachine +#undef XSetWMHints +#undef XSetWMIconName +#undef XSetWMName +#undef XSetWMNormalHints +#undef XSetWMProperties +#undef XmbSetWMProperties +#undef Xutf8SetWMProperties +#undef XSetWMSizeHints +#undef XSetRegion +#undef XSetStandardColormap +#undef XSetZoomHints +#undef XShrinkRegion +#undef XStringListToTextProperty +#undef XSubtractRegion +#undef XmbTextListToTextProperty +#undef XwcTextListToTextProperty +#undef Xutf8TextListToTextProperty +#undef XwcFreeStringList +#undef XTextPropertyToStringList +#undef XmbTextPropertyToTextList +#undef XwcTextPropertyToTextList +#undef Xutf8TextPropertyToTextList +#undef XUnionRectWithRegion +#undef XUnionRegion +#undef XWMGeometry +#undef XXorRegion +#undef XkbIgnoreExtension +#undef XkbOpenDisplay +#undef XkbQueryExtension +#undef XkbUseExtension +#undef XkbLibraryVersion +#undef XkbSetXlibControls +#undef XkbGetXlibControls +#undef XkbXlibControlsImplemented +#undef XkbSetAtomFuncs +#undef XkbKeycodeToKeysym +#undef XkbKeysymToModifiers +#undef XkbLookupKeySym +#undef XkbLookupKeyBinding +#undef XkbTranslateKeyCode +#undef XkbTranslateKeySym +#undef XkbSetAutoRepeatRate +#undef XkbGetAutoRepeatRate +#undef XkbChangeEnabledControls +#undef XkbDeviceBell +#undef XkbForceDeviceBell +#undef XkbDeviceBellEvent +#undef XkbBell +#undef XkbForceBell +#undef XkbBellEvent +#undef XkbSelectEvents +#undef XkbSelectEventDetails +#undef XkbNoteMapChanges +#undef XkbNoteNameChanges +#undef XkbGetIndicatorState +#undef XkbGetIndicatorMap +#undef XkbSetIndicatorMap +#undef XkbGetNamedIndicator +#undef XkbGetNamedDeviceIndicator +#undef XkbSetNamedIndicator +#undef XkbSetNamedDeviceIndicator +#undef XkbLockModifiers +#undef XkbLatchModifiers +#undef XkbLockGroup +#undef XkbLatchGroup +#undef XkbSetServerInternalMods +#undef XkbSetIgnoreLockMods +#undef XkbVirtualModsToReal +#undef XkbComputeEffectiveMap +#undef XkbInitCanonicalKeyTypes +#undef XkbAllocKeyboard +#undef XkbFreeKeyboard +#undef XkbAllocClientMap +#undef XkbAllocServerMap +#undef XkbFreeClientMap +#undef XkbFreeServerMap +#undef XkbAddKeyType +#undef XkbAllocIndicatorMaps +#undef XkbFreeIndicatorMaps +#undef XkbGetMap +#undef XkbGetUpdatedMap +#undef XkbGetMapChanges +#undef XkbRefreshKeyboardMapping +#undef XkbGetKeyTypes +#undef XkbGetKeySyms +#undef XkbGetKeyActions +#undef XkbGetKeyBehaviors +#undef XkbGetVirtualMods +#undef XkbGetKeyExplicitComponents +#undef XkbGetKeyModifierMap +#undef XkbGetKeyVirtualModMap +#undef XkbAllocControls +#undef XkbFreeControls +#undef XkbGetControls +#undef XkbSetControls +#undef XkbNoteControlsChanges +#undef XkbAllocCompatMap +#undef XkbFreeCompatMap +#undef XkbGetCompatMap +#undef XkbSetCompatMap +#undef XkbAllocNames +#undef XkbGetNames +#undef XkbSetNames +#undef XkbChangeNames +#undef XkbFreeNames +#undef XkbGetState +#undef XkbSetMap +#undef XkbChangeMap +#undef XkbSetDetectableAutoRepeat +#undef XkbGetDetectableAutoRepeat +#undef XkbSetAutoResetControls +#undef XkbGetAutoResetControls +#undef XkbSetPerClientControls +#undef XkbGetPerClientControls +#undef XkbCopyKeyType +#undef XkbCopyKeyTypes +#undef XkbResizeKeyType +#undef XkbResizeKeySyms +#undef XkbResizeKeyActions +#undef XkbChangeTypesOfKey +#undef XkbChangeKeycodeRange +#undef XkbListComponents +#undef XkbFreeComponentList +#undef XkbGetKeyboard +#undef XkbGetKeyboardByName +#undef XkbKeyTypesForCoreSymbols +#undef XkbApplyCompatMapToKey +#undef XkbUpdateMapFromCore +#undef XkbAddDeviceLedInfo +#undef XkbResizeDeviceButtonActions +#undef XkbAllocDeviceInfo +#undef XkbFreeDeviceInfo +#undef XkbNoteDeviceChanges +#undef XkbGetDeviceInfo +#undef XkbGetDeviceInfoChanges +#undef XkbGetDeviceButtonActions +#undef XkbGetDeviceLedInfo +#undef XkbSetDeviceInfo +#undef XkbChangeDeviceInfo +#undef XkbSetDeviceLedInfo +#undef XkbSetDeviceButtonActions +#undef XkbToControl +#undef XkbSetDebuggingFlags +#undef XkbApplyVirtualModChanges +#undef XkbUpdateActionVirtualMods +#undef XkbUpdateKeyTypeVirtualMods +#include <dlfcn.h> +#include <stdio.h> +int (*_Xmblen_dylibloader_wrapper_xlib)( char*, int); +XFontStruct* (*XLoadQueryFont_dylibloader_wrapper_xlib)( Display*,const char*); +XFontStruct* (*XQueryFont_dylibloader_wrapper_xlib)( Display*, XID); +XTimeCoord* (*XGetMotionEvents_dylibloader_wrapper_xlib)( Display*, Window, Time, Time, int*); +XModifierKeymap* (*XDeleteModifiermapEntry_dylibloader_wrapper_xlib)( XModifierKeymap*, KeyCode, int); +XModifierKeymap* (*XGetModifierMapping_dylibloader_wrapper_xlib)( Display*); +XModifierKeymap* (*XInsertModifiermapEntry_dylibloader_wrapper_xlib)( XModifierKeymap*, KeyCode, int); +XModifierKeymap* (*XNewModifiermap_dylibloader_wrapper_xlib)( int); +XImage* (*XCreateImage_dylibloader_wrapper_xlib)( Display*, Visual*, unsigned int, int, int, char*, unsigned int, unsigned int, int, int); +int (*XInitImage_dylibloader_wrapper_xlib)( XImage*); +XImage* (*XGetImage_dylibloader_wrapper_xlib)( Display*, Drawable, int, int, unsigned int, unsigned int, unsigned long, int); +XImage* (*XGetSubImage_dylibloader_wrapper_xlib)( Display*, Drawable, int, int, unsigned int, unsigned int, unsigned long, int, XImage*, int, int); +Display* (*XOpenDisplay_dylibloader_wrapper_xlib)(const char*); +void (*XrmInitialize_dylibloader_wrapper_xlib)( void); +char* (*XFetchBytes_dylibloader_wrapper_xlib)( Display*, int*); +char* (*XFetchBuffer_dylibloader_wrapper_xlib)( Display*, int*, int); +char* (*XGetAtomName_dylibloader_wrapper_xlib)( Display*, Atom); +int (*XGetAtomNames_dylibloader_wrapper_xlib)( Display*, Atom*, int, char**); +char* (*XGetDefault_dylibloader_wrapper_xlib)( Display*,const char*,const char*); +char* (*XDisplayName_dylibloader_wrapper_xlib)(const char*); +char* (*XKeysymToString_dylibloader_wrapper_xlib)( KeySym); +int* (*XSynchronize_dylibloader_wrapper_xlib)( Display*, int); +int* (*XSetAfterFunction_dylibloader_wrapper_xlib)( Display*, int*); +Atom (*XInternAtom_dylibloader_wrapper_xlib)( Display*,const char*, int); +int (*XInternAtoms_dylibloader_wrapper_xlib)( Display*, char**, int, int, Atom*); +Colormap (*XCopyColormapAndFree_dylibloader_wrapper_xlib)( Display*, Colormap); +Colormap (*XCreateColormap_dylibloader_wrapper_xlib)( Display*, Window, Visual*, int); +Cursor (*XCreatePixmapCursor_dylibloader_wrapper_xlib)( Display*, Pixmap, Pixmap, XColor*, XColor*, unsigned int, unsigned int); +Cursor (*XCreateGlyphCursor_dylibloader_wrapper_xlib)( Display*, Font, Font, unsigned int, unsigned int,const XColor*,const XColor*); +Cursor (*XCreateFontCursor_dylibloader_wrapper_xlib)( Display*, unsigned int); +Font (*XLoadFont_dylibloader_wrapper_xlib)( Display*,const char*); +GC (*XCreateGC_dylibloader_wrapper_xlib)( Display*, Drawable, unsigned long, XGCValues*); +GContext (*XGContextFromGC_dylibloader_wrapper_xlib)( GC); +void (*XFlushGC_dylibloader_wrapper_xlib)( Display*, GC); +Pixmap (*XCreatePixmap_dylibloader_wrapper_xlib)( Display*, Drawable, unsigned int, unsigned int, unsigned int); +Pixmap (*XCreateBitmapFromData_dylibloader_wrapper_xlib)( Display*, Drawable,const char*, unsigned int, unsigned int); +Pixmap (*XCreatePixmapFromBitmapData_dylibloader_wrapper_xlib)( Display*, Drawable, char*, unsigned int, unsigned int, unsigned long, unsigned long, unsigned int); +Window (*XCreateSimpleWindow_dylibloader_wrapper_xlib)( Display*, Window, int, int, unsigned int, unsigned int, unsigned int, unsigned long, unsigned long); +Window (*XGetSelectionOwner_dylibloader_wrapper_xlib)( Display*, Atom); +Window (*XCreateWindow_dylibloader_wrapper_xlib)( Display*, Window, int, int, unsigned int, unsigned int, unsigned int, int, unsigned int, Visual*, unsigned long, XSetWindowAttributes*); +Colormap* (*XListInstalledColormaps_dylibloader_wrapper_xlib)( Display*, Window, int*); +char** (*XListFonts_dylibloader_wrapper_xlib)( Display*,const char*, int, int*); +char** (*XListFontsWithInfo_dylibloader_wrapper_xlib)( Display*,const char*, int, int*, XFontStruct**); +char** (*XGetFontPath_dylibloader_wrapper_xlib)( Display*, int*); +char** (*XListExtensions_dylibloader_wrapper_xlib)( Display*, int*); +Atom* (*XListProperties_dylibloader_wrapper_xlib)( Display*, Window, int*); +XHostAddress* (*XListHosts_dylibloader_wrapper_xlib)( Display*, int*, int*); +KeySym (*XKeycodeToKeysym_dylibloader_wrapper_xlib)( Display*, KeyCode, int); +KeySym (*XLookupKeysym_dylibloader_wrapper_xlib)( XKeyEvent*, int); +KeySym* (*XGetKeyboardMapping_dylibloader_wrapper_xlib)( Display*, KeyCode, int, int*); +KeySym (*XStringToKeysym_dylibloader_wrapper_xlib)(const char*); +long (*XMaxRequestSize_dylibloader_wrapper_xlib)( Display*); +long (*XExtendedMaxRequestSize_dylibloader_wrapper_xlib)( Display*); +char* (*XResourceManagerString_dylibloader_wrapper_xlib)( Display*); +char* (*XScreenResourceString_dylibloader_wrapper_xlib)( Screen*); +unsigned long (*XDisplayMotionBufferSize_dylibloader_wrapper_xlib)( Display*); +VisualID (*XVisualIDFromVisual_dylibloader_wrapper_xlib)( Visual*); +int (*XInitThreads_dylibloader_wrapper_xlib)( void); +void (*XLockDisplay_dylibloader_wrapper_xlib)( Display*); +void (*XUnlockDisplay_dylibloader_wrapper_xlib)( Display*); +XExtCodes* (*XInitExtension_dylibloader_wrapper_xlib)( Display*,const char*); +XExtCodes* (*XAddExtension_dylibloader_wrapper_xlib)( Display*); +XExtData* (*XFindOnExtensionList_dylibloader_wrapper_xlib)( XExtData**, int); +XExtData** (*XEHeadOfExtensionList_dylibloader_wrapper_xlib)( XEDataObject); +Window (*XRootWindow_dylibloader_wrapper_xlib)( Display*, int); +Window (*XDefaultRootWindow_dylibloader_wrapper_xlib)( Display*); +Window (*XRootWindowOfScreen_dylibloader_wrapper_xlib)( Screen*); +Visual* (*XDefaultVisual_dylibloader_wrapper_xlib)( Display*, int); +Visual* (*XDefaultVisualOfScreen_dylibloader_wrapper_xlib)( Screen*); +GC (*XDefaultGC_dylibloader_wrapper_xlib)( Display*, int); +GC (*XDefaultGCOfScreen_dylibloader_wrapper_xlib)( Screen*); +unsigned long (*XBlackPixel_dylibloader_wrapper_xlib)( Display*, int); +unsigned long (*XWhitePixel_dylibloader_wrapper_xlib)( Display*, int); +unsigned long (*XAllPlanes_dylibloader_wrapper_xlib)( void); +unsigned long (*XBlackPixelOfScreen_dylibloader_wrapper_xlib)( Screen*); +unsigned long (*XWhitePixelOfScreen_dylibloader_wrapper_xlib)( Screen*); +unsigned long (*XNextRequest_dylibloader_wrapper_xlib)( Display*); +unsigned long (*XLastKnownRequestProcessed_dylibloader_wrapper_xlib)( Display*); +char* (*XServerVendor_dylibloader_wrapper_xlib)( Display*); +char* (*XDisplayString_dylibloader_wrapper_xlib)( Display*); +Colormap (*XDefaultColormap_dylibloader_wrapper_xlib)( Display*, int); +Colormap (*XDefaultColormapOfScreen_dylibloader_wrapper_xlib)( Screen*); +Display* (*XDisplayOfScreen_dylibloader_wrapper_xlib)( Screen*); +Screen* (*XScreenOfDisplay_dylibloader_wrapper_xlib)( Display*, int); +Screen* (*XDefaultScreenOfDisplay_dylibloader_wrapper_xlib)( Display*); +long (*XEventMaskOfScreen_dylibloader_wrapper_xlib)( Screen*); +int (*XScreenNumberOfScreen_dylibloader_wrapper_xlib)( Screen*); +XErrorHandler (*XSetErrorHandler_dylibloader_wrapper_xlib)( XErrorHandler); +XIOErrorHandler (*XSetIOErrorHandler_dylibloader_wrapper_xlib)( XIOErrorHandler); +XPixmapFormatValues* (*XListPixmapFormats_dylibloader_wrapper_xlib)( Display*, int*); +int* (*XListDepths_dylibloader_wrapper_xlib)( Display*, int, int*); +int (*XReconfigureWMWindow_dylibloader_wrapper_xlib)( Display*, Window, int, unsigned int, XWindowChanges*); +int (*XGetWMProtocols_dylibloader_wrapper_xlib)( Display*, Window, Atom**, int*); +int (*XSetWMProtocols_dylibloader_wrapper_xlib)( Display*, Window, Atom*, int); +int (*XIconifyWindow_dylibloader_wrapper_xlib)( Display*, Window, int); +int (*XWithdrawWindow_dylibloader_wrapper_xlib)( Display*, Window, int); +int (*XGetCommand_dylibloader_wrapper_xlib)( Display*, Window, char***, int*); +int (*XGetWMColormapWindows_dylibloader_wrapper_xlib)( Display*, Window, Window**, int*); +int (*XSetWMColormapWindows_dylibloader_wrapper_xlib)( Display*, Window, Window*, int); +void (*XFreeStringList_dylibloader_wrapper_xlib)( char**); +int (*XSetTransientForHint_dylibloader_wrapper_xlib)( Display*, Window, Window); +int (*XActivateScreenSaver_dylibloader_wrapper_xlib)( Display*); +int (*XAddHost_dylibloader_wrapper_xlib)( Display*, XHostAddress*); +int (*XAddHosts_dylibloader_wrapper_xlib)( Display*, XHostAddress*, int); +int (*XAddToExtensionList_dylibloader_wrapper_xlib)(struct _XExtData**, XExtData*); +int (*XAddToSaveSet_dylibloader_wrapper_xlib)( Display*, Window); +int (*XAllocColor_dylibloader_wrapper_xlib)( Display*, Colormap, XColor*); +int (*XAllocColorCells_dylibloader_wrapper_xlib)( Display*, Colormap, int, unsigned long*, unsigned int, unsigned long*, unsigned int); +int (*XAllocColorPlanes_dylibloader_wrapper_xlib)( Display*, Colormap, int, unsigned long*, int, int, int, int, unsigned long*, unsigned long*, unsigned long*); +int (*XAllocNamedColor_dylibloader_wrapper_xlib)( Display*, Colormap,const char*, XColor*, XColor*); +int (*XAllowEvents_dylibloader_wrapper_xlib)( Display*, int, Time); +int (*XAutoRepeatOff_dylibloader_wrapper_xlib)( Display*); +int (*XAutoRepeatOn_dylibloader_wrapper_xlib)( Display*); +int (*XBell_dylibloader_wrapper_xlib)( Display*, int); +int (*XBitmapBitOrder_dylibloader_wrapper_xlib)( Display*); +int (*XBitmapPad_dylibloader_wrapper_xlib)( Display*); +int (*XBitmapUnit_dylibloader_wrapper_xlib)( Display*); +int (*XCellsOfScreen_dylibloader_wrapper_xlib)( Screen*); +int (*XChangeActivePointerGrab_dylibloader_wrapper_xlib)( Display*, unsigned int, Cursor, Time); +int (*XChangeGC_dylibloader_wrapper_xlib)( Display*, GC, unsigned long, XGCValues*); +int (*XChangeKeyboardControl_dylibloader_wrapper_xlib)( Display*, unsigned long, XKeyboardControl*); +int (*XChangeKeyboardMapping_dylibloader_wrapper_xlib)( Display*, int, int, KeySym*, int); +int (*XChangePointerControl_dylibloader_wrapper_xlib)( Display*, int, int, int, int, int); +int (*XChangeProperty_dylibloader_wrapper_xlib)( Display*, Window, Atom, Atom, int, int,const unsigned char*, int); +int (*XChangeSaveSet_dylibloader_wrapper_xlib)( Display*, Window, int); +int (*XChangeWindowAttributes_dylibloader_wrapper_xlib)( Display*, Window, unsigned long, XSetWindowAttributes*); +int (*XCheckIfEvent_dylibloader_wrapper_xlib)( Display*, XEvent*, Bool (*) (Display*, XEvent*, XPointer), XPointer); +int (*XCheckMaskEvent_dylibloader_wrapper_xlib)( Display*, long, XEvent*); +int (*XCheckTypedEvent_dylibloader_wrapper_xlib)( Display*, int, XEvent*); +int (*XCheckTypedWindowEvent_dylibloader_wrapper_xlib)( Display*, Window, int, XEvent*); +int (*XCheckWindowEvent_dylibloader_wrapper_xlib)( Display*, Window, long, XEvent*); +int (*XCirculateSubwindows_dylibloader_wrapper_xlib)( Display*, Window, int); +int (*XCirculateSubwindowsDown_dylibloader_wrapper_xlib)( Display*, Window); +int (*XCirculateSubwindowsUp_dylibloader_wrapper_xlib)( Display*, Window); +int (*XClearArea_dylibloader_wrapper_xlib)( Display*, Window, int, int, unsigned int, unsigned int, int); +int (*XClearWindow_dylibloader_wrapper_xlib)( Display*, Window); +int (*XCloseDisplay_dylibloader_wrapper_xlib)( Display*); +int (*XConfigureWindow_dylibloader_wrapper_xlib)( Display*, Window, unsigned int, XWindowChanges*); +int (*XConnectionNumber_dylibloader_wrapper_xlib)( Display*); +int (*XConvertSelection_dylibloader_wrapper_xlib)( Display*, Atom, Atom, Atom, Window, Time); +int (*XCopyArea_dylibloader_wrapper_xlib)( Display*, Drawable, Drawable, GC, int, int, unsigned int, unsigned int, int, int); +int (*XCopyGC_dylibloader_wrapper_xlib)( Display*, GC, unsigned long, GC); +int (*XCopyPlane_dylibloader_wrapper_xlib)( Display*, Drawable, Drawable, GC, int, int, unsigned int, unsigned int, int, int, unsigned long); +int (*XDefaultDepth_dylibloader_wrapper_xlib)( Display*, int); +int (*XDefaultDepthOfScreen_dylibloader_wrapper_xlib)( Screen*); +int (*XDefaultScreen_dylibloader_wrapper_xlib)( Display*); +int (*XDefineCursor_dylibloader_wrapper_xlib)( Display*, Window, Cursor); +int (*XDeleteProperty_dylibloader_wrapper_xlib)( Display*, Window, Atom); +int (*XDestroyWindow_dylibloader_wrapper_xlib)( Display*, Window); +int (*XDestroySubwindows_dylibloader_wrapper_xlib)( Display*, Window); +int (*XDoesBackingStore_dylibloader_wrapper_xlib)( Screen*); +int (*XDoesSaveUnders_dylibloader_wrapper_xlib)( Screen*); +int (*XDisableAccessControl_dylibloader_wrapper_xlib)( Display*); +int (*XDisplayCells_dylibloader_wrapper_xlib)( Display*, int); +int (*XDisplayHeight_dylibloader_wrapper_xlib)( Display*, int); +int (*XDisplayHeightMM_dylibloader_wrapper_xlib)( Display*, int); +int (*XDisplayKeycodes_dylibloader_wrapper_xlib)( Display*, int*, int*); +int (*XDisplayPlanes_dylibloader_wrapper_xlib)( Display*, int); +int (*XDisplayWidth_dylibloader_wrapper_xlib)( Display*, int); +int (*XDisplayWidthMM_dylibloader_wrapper_xlib)( Display*, int); +int (*XDrawArc_dylibloader_wrapper_xlib)( Display*, Drawable, GC, int, int, unsigned int, unsigned int, int, int); +int (*XDrawArcs_dylibloader_wrapper_xlib)( Display*, Drawable, GC, XArc*, int); +int (*XDrawImageString_dylibloader_wrapper_xlib)( Display*, Drawable, GC, int, int,const char*, int); +int (*XDrawImageString16_dylibloader_wrapper_xlib)( Display*, Drawable, GC, int, int,const XChar2b*, int); +int (*XDrawLine_dylibloader_wrapper_xlib)( Display*, Drawable, GC, int, int, int, int); +int (*XDrawLines_dylibloader_wrapper_xlib)( Display*, Drawable, GC, XPoint*, int, int); +int (*XDrawPoint_dylibloader_wrapper_xlib)( Display*, Drawable, GC, int, int); +int (*XDrawPoints_dylibloader_wrapper_xlib)( Display*, Drawable, GC, XPoint*, int, int); +int (*XDrawRectangle_dylibloader_wrapper_xlib)( Display*, Drawable, GC, int, int, unsigned int, unsigned int); +int (*XDrawRectangles_dylibloader_wrapper_xlib)( Display*, Drawable, GC, XRectangle*, int); +int (*XDrawSegments_dylibloader_wrapper_xlib)( Display*, Drawable, GC, XSegment*, int); +int (*XDrawString_dylibloader_wrapper_xlib)( Display*, Drawable, GC, int, int,const char*, int); +int (*XDrawString16_dylibloader_wrapper_xlib)( Display*, Drawable, GC, int, int,const XChar2b*, int); +int (*XDrawText_dylibloader_wrapper_xlib)( Display*, Drawable, GC, int, int, XTextItem*, int); +int (*XDrawText16_dylibloader_wrapper_xlib)( Display*, Drawable, GC, int, int, XTextItem16*, int); +int (*XEnableAccessControl_dylibloader_wrapper_xlib)( Display*); +int (*XEventsQueued_dylibloader_wrapper_xlib)( Display*, int); +int (*XFetchName_dylibloader_wrapper_xlib)( Display*, Window, char**); +int (*XFillArc_dylibloader_wrapper_xlib)( Display*, Drawable, GC, int, int, unsigned int, unsigned int, int, int); +int (*XFillArcs_dylibloader_wrapper_xlib)( Display*, Drawable, GC, XArc*, int); +int (*XFillPolygon_dylibloader_wrapper_xlib)( Display*, Drawable, GC, XPoint*, int, int, int); +int (*XFillRectangle_dylibloader_wrapper_xlib)( Display*, Drawable, GC, int, int, unsigned int, unsigned int); +int (*XFillRectangles_dylibloader_wrapper_xlib)( Display*, Drawable, GC, XRectangle*, int); +int (*XFlush_dylibloader_wrapper_xlib)( Display*); +int (*XForceScreenSaver_dylibloader_wrapper_xlib)( Display*, int); +int (*XFree_dylibloader_wrapper_xlib)( void*); +int (*XFreeColormap_dylibloader_wrapper_xlib)( Display*, Colormap); +int (*XFreeColors_dylibloader_wrapper_xlib)( Display*, Colormap, unsigned long*, int, unsigned long); +int (*XFreeCursor_dylibloader_wrapper_xlib)( Display*, Cursor); +int (*XFreeExtensionList_dylibloader_wrapper_xlib)( char**); +int (*XFreeFont_dylibloader_wrapper_xlib)( Display*, XFontStruct*); +int (*XFreeFontInfo_dylibloader_wrapper_xlib)( char**, XFontStruct*, int); +int (*XFreeFontNames_dylibloader_wrapper_xlib)( char**); +int (*XFreeFontPath_dylibloader_wrapper_xlib)( char**); +int (*XFreeGC_dylibloader_wrapper_xlib)( Display*, GC); +int (*XFreeModifiermap_dylibloader_wrapper_xlib)( XModifierKeymap*); +int (*XFreePixmap_dylibloader_wrapper_xlib)( Display*, Pixmap); +int (*XGeometry_dylibloader_wrapper_xlib)( Display*, int,const char*,const char*, unsigned int, unsigned int, unsigned int, int, int, int*, int*, int*, int*); +int (*XGetErrorDatabaseText_dylibloader_wrapper_xlib)( Display*,const char*,const char*,const char*, char*, int); +int (*XGetErrorText_dylibloader_wrapper_xlib)( Display*, int, char*, int); +int (*XGetFontProperty_dylibloader_wrapper_xlib)( XFontStruct*, Atom, unsigned long*); +int (*XGetGCValues_dylibloader_wrapper_xlib)( Display*, GC, unsigned long, XGCValues*); +int (*XGetGeometry_dylibloader_wrapper_xlib)( Display*, Drawable, Window*, int*, int*, unsigned int*, unsigned int*, unsigned int*, unsigned int*); +int (*XGetIconName_dylibloader_wrapper_xlib)( Display*, Window, char**); +int (*XGetInputFocus_dylibloader_wrapper_xlib)( Display*, Window*, int*); +int (*XGetKeyboardControl_dylibloader_wrapper_xlib)( Display*, XKeyboardState*); +int (*XGetPointerControl_dylibloader_wrapper_xlib)( Display*, int*, int*, int*); +int (*XGetPointerMapping_dylibloader_wrapper_xlib)( Display*, unsigned char*, int); +int (*XGetScreenSaver_dylibloader_wrapper_xlib)( Display*, int*, int*, int*, int*); +int (*XGetTransientForHint_dylibloader_wrapper_xlib)( Display*, Window, Window*); +int (*XGetWindowProperty_dylibloader_wrapper_xlib)( Display*, Window, Atom, long, long, int, Atom, Atom*, int*, unsigned long*, unsigned long*, unsigned char**); +int (*XGetWindowAttributes_dylibloader_wrapper_xlib)( Display*, Window, XWindowAttributes*); +int (*XGrabButton_dylibloader_wrapper_xlib)( Display*, unsigned int, unsigned int, Window, int, unsigned int, int, int, Window, Cursor); +int (*XGrabKey_dylibloader_wrapper_xlib)( Display*, int, unsigned int, Window, int, int, int); +int (*XGrabKeyboard_dylibloader_wrapper_xlib)( Display*, Window, int, int, int, Time); +int (*XGrabPointer_dylibloader_wrapper_xlib)( Display*, Window, int, unsigned int, int, int, Window, Cursor, Time); +int (*XGrabServer_dylibloader_wrapper_xlib)( Display*); +int (*XHeightMMOfScreen_dylibloader_wrapper_xlib)( Screen*); +int (*XHeightOfScreen_dylibloader_wrapper_xlib)( Screen*); +int (*XIfEvent_dylibloader_wrapper_xlib)( Display*, XEvent*, Bool (*) (Display*, XEvent*, XPointer), XPointer); +int (*XImageByteOrder_dylibloader_wrapper_xlib)( Display*); +int (*XInstallColormap_dylibloader_wrapper_xlib)( Display*, Colormap); +KeyCode (*XKeysymToKeycode_dylibloader_wrapper_xlib)( Display*, KeySym); +int (*XKillClient_dylibloader_wrapper_xlib)( Display*, XID); +int (*XLookupColor_dylibloader_wrapper_xlib)( Display*, Colormap,const char*, XColor*, XColor*); +int (*XLowerWindow_dylibloader_wrapper_xlib)( Display*, Window); +int (*XMapRaised_dylibloader_wrapper_xlib)( Display*, Window); +int (*XMapSubwindows_dylibloader_wrapper_xlib)( Display*, Window); +int (*XMapWindow_dylibloader_wrapper_xlib)( Display*, Window); +int (*XMaskEvent_dylibloader_wrapper_xlib)( Display*, long, XEvent*); +int (*XMaxCmapsOfScreen_dylibloader_wrapper_xlib)( Screen*); +int (*XMinCmapsOfScreen_dylibloader_wrapper_xlib)( Screen*); +int (*XMoveResizeWindow_dylibloader_wrapper_xlib)( Display*, Window, int, int, unsigned int, unsigned int); +int (*XMoveWindow_dylibloader_wrapper_xlib)( Display*, Window, int, int); +int (*XNextEvent_dylibloader_wrapper_xlib)( Display*, XEvent*); +int (*XNoOp_dylibloader_wrapper_xlib)( Display*); +int (*XParseColor_dylibloader_wrapper_xlib)( Display*, Colormap,const char*, XColor*); +int (*XParseGeometry_dylibloader_wrapper_xlib)(const char*, int*, int*, unsigned int*, unsigned int*); +int (*XPeekEvent_dylibloader_wrapper_xlib)( Display*, XEvent*); +int (*XPeekIfEvent_dylibloader_wrapper_xlib)( Display*, XEvent*, Bool (*) (Display*, XEvent*, XPointer), XPointer); +int (*XPending_dylibloader_wrapper_xlib)( Display*); +int (*XPlanesOfScreen_dylibloader_wrapper_xlib)( Screen*); +int (*XProtocolRevision_dylibloader_wrapper_xlib)( Display*); +int (*XProtocolVersion_dylibloader_wrapper_xlib)( Display*); +int (*XPutBackEvent_dylibloader_wrapper_xlib)( Display*, XEvent*); +int (*XPutImage_dylibloader_wrapper_xlib)( Display*, Drawable, GC, XImage*, int, int, int, int, unsigned int, unsigned int); +int (*XQLength_dylibloader_wrapper_xlib)( Display*); +int (*XQueryBestCursor_dylibloader_wrapper_xlib)( Display*, Drawable, unsigned int, unsigned int, unsigned int*, unsigned int*); +int (*XQueryBestSize_dylibloader_wrapper_xlib)( Display*, int, Drawable, unsigned int, unsigned int, unsigned int*, unsigned int*); +int (*XQueryBestStipple_dylibloader_wrapper_xlib)( Display*, Drawable, unsigned int, unsigned int, unsigned int*, unsigned int*); +int (*XQueryBestTile_dylibloader_wrapper_xlib)( Display*, Drawable, unsigned int, unsigned int, unsigned int*, unsigned int*); +int (*XQueryColor_dylibloader_wrapper_xlib)( Display*, Colormap, XColor*); +int (*XQueryColors_dylibloader_wrapper_xlib)( Display*, Colormap, XColor*, int); +int (*XQueryExtension_dylibloader_wrapper_xlib)( Display*,const char*, int*, int*, int*); +int (*XQueryKeymap_dylibloader_wrapper_xlib)( Display*, char [32]); +int (*XQueryPointer_dylibloader_wrapper_xlib)( Display*, Window, Window*, Window*, int*, int*, int*, int*, unsigned int*); +int (*XQueryTextExtents_dylibloader_wrapper_xlib)( Display*, XID,const char*, int, int*, int*, int*, XCharStruct*); +int (*XQueryTextExtents16_dylibloader_wrapper_xlib)( Display*, XID,const XChar2b*, int, int*, int*, int*, XCharStruct*); +int (*XQueryTree_dylibloader_wrapper_xlib)( Display*, Window, Window*, Window*, Window**, unsigned int*); +int (*XRaiseWindow_dylibloader_wrapper_xlib)( Display*, Window); +int (*XReadBitmapFile_dylibloader_wrapper_xlib)( Display*, Drawable,const char*, unsigned int*, unsigned int*, Pixmap*, int*, int*); +int (*XReadBitmapFileData_dylibloader_wrapper_xlib)(const char*, unsigned int*, unsigned int*, unsigned char**, int*, int*); +int (*XRebindKeysym_dylibloader_wrapper_xlib)( Display*, KeySym, KeySym*, int,const unsigned char*, int); +int (*XRecolorCursor_dylibloader_wrapper_xlib)( Display*, Cursor, XColor*, XColor*); +int (*XRefreshKeyboardMapping_dylibloader_wrapper_xlib)( XMappingEvent*); +int (*XRemoveFromSaveSet_dylibloader_wrapper_xlib)( Display*, Window); +int (*XRemoveHost_dylibloader_wrapper_xlib)( Display*, XHostAddress*); +int (*XRemoveHosts_dylibloader_wrapper_xlib)( Display*, XHostAddress*, int); +int (*XReparentWindow_dylibloader_wrapper_xlib)( Display*, Window, Window, int, int); +int (*XResetScreenSaver_dylibloader_wrapper_xlib)( Display*); +int (*XResizeWindow_dylibloader_wrapper_xlib)( Display*, Window, unsigned int, unsigned int); +int (*XRestackWindows_dylibloader_wrapper_xlib)( Display*, Window*, int); +int (*XRotateBuffers_dylibloader_wrapper_xlib)( Display*, int); +int (*XRotateWindowProperties_dylibloader_wrapper_xlib)( Display*, Window, Atom*, int, int); +int (*XScreenCount_dylibloader_wrapper_xlib)( Display*); +int (*XSelectInput_dylibloader_wrapper_xlib)( Display*, Window, long); +int (*XSendEvent_dylibloader_wrapper_xlib)( Display*, Window, int, long, XEvent*); +int (*XSetAccessControl_dylibloader_wrapper_xlib)( Display*, int); +int (*XSetArcMode_dylibloader_wrapper_xlib)( Display*, GC, int); +int (*XSetBackground_dylibloader_wrapper_xlib)( Display*, GC, unsigned long); +int (*XSetClipMask_dylibloader_wrapper_xlib)( Display*, GC, Pixmap); +int (*XSetClipOrigin_dylibloader_wrapper_xlib)( Display*, GC, int, int); +int (*XSetClipRectangles_dylibloader_wrapper_xlib)( Display*, GC, int, int, XRectangle*, int, int); +int (*XSetCloseDownMode_dylibloader_wrapper_xlib)( Display*, int); +int (*XSetCommand_dylibloader_wrapper_xlib)( Display*, Window, char**, int); +int (*XSetDashes_dylibloader_wrapper_xlib)( Display*, GC, int,const char*, int); +int (*XSetFillRule_dylibloader_wrapper_xlib)( Display*, GC, int); +int (*XSetFillStyle_dylibloader_wrapper_xlib)( Display*, GC, int); +int (*XSetFont_dylibloader_wrapper_xlib)( Display*, GC, Font); +int (*XSetFontPath_dylibloader_wrapper_xlib)( Display*, char**, int); +int (*XSetForeground_dylibloader_wrapper_xlib)( Display*, GC, unsigned long); +int (*XSetFunction_dylibloader_wrapper_xlib)( Display*, GC, int); +int (*XSetGraphicsExposures_dylibloader_wrapper_xlib)( Display*, GC, int); +int (*XSetIconName_dylibloader_wrapper_xlib)( Display*, Window,const char*); +int (*XSetInputFocus_dylibloader_wrapper_xlib)( Display*, Window, int, Time); +int (*XSetLineAttributes_dylibloader_wrapper_xlib)( Display*, GC, unsigned int, int, int, int); +int (*XSetModifierMapping_dylibloader_wrapper_xlib)( Display*, XModifierKeymap*); +int (*XSetPlaneMask_dylibloader_wrapper_xlib)( Display*, GC, unsigned long); +int (*XSetPointerMapping_dylibloader_wrapper_xlib)( Display*,const unsigned char*, int); +int (*XSetScreenSaver_dylibloader_wrapper_xlib)( Display*, int, int, int, int); +int (*XSetSelectionOwner_dylibloader_wrapper_xlib)( Display*, Atom, Window, Time); +int (*XSetState_dylibloader_wrapper_xlib)( Display*, GC, unsigned long, unsigned long, int, unsigned long); +int (*XSetStipple_dylibloader_wrapper_xlib)( Display*, GC, Pixmap); +int (*XSetSubwindowMode_dylibloader_wrapper_xlib)( Display*, GC, int); +int (*XSetTSOrigin_dylibloader_wrapper_xlib)( Display*, GC, int, int); +int (*XSetTile_dylibloader_wrapper_xlib)( Display*, GC, Pixmap); +int (*XSetWindowBackground_dylibloader_wrapper_xlib)( Display*, Window, unsigned long); +int (*XSetWindowBackgroundPixmap_dylibloader_wrapper_xlib)( Display*, Window, Pixmap); +int (*XSetWindowBorder_dylibloader_wrapper_xlib)( Display*, Window, unsigned long); +int (*XSetWindowBorderPixmap_dylibloader_wrapper_xlib)( Display*, Window, Pixmap); +int (*XSetWindowBorderWidth_dylibloader_wrapper_xlib)( Display*, Window, unsigned int); +int (*XSetWindowColormap_dylibloader_wrapper_xlib)( Display*, Window, Colormap); +int (*XStoreBuffer_dylibloader_wrapper_xlib)( Display*,const char*, int, int); +int (*XStoreBytes_dylibloader_wrapper_xlib)( Display*,const char*, int); +int (*XStoreColor_dylibloader_wrapper_xlib)( Display*, Colormap, XColor*); +int (*XStoreColors_dylibloader_wrapper_xlib)( Display*, Colormap, XColor*, int); +int (*XStoreName_dylibloader_wrapper_xlib)( Display*, Window,const char*); +int (*XStoreNamedColor_dylibloader_wrapper_xlib)( Display*, Colormap,const char*, unsigned long, int); +int (*XSync_dylibloader_wrapper_xlib)( Display*, int); +int (*XTextExtents_dylibloader_wrapper_xlib)( XFontStruct*,const char*, int, int*, int*, int*, XCharStruct*); +int (*XTextExtents16_dylibloader_wrapper_xlib)( XFontStruct*,const XChar2b*, int, int*, int*, int*, XCharStruct*); +int (*XTextWidth_dylibloader_wrapper_xlib)( XFontStruct*,const char*, int); +int (*XTextWidth16_dylibloader_wrapper_xlib)( XFontStruct*,const XChar2b*, int); +int (*XTranslateCoordinates_dylibloader_wrapper_xlib)( Display*, Window, Window, int, int, int*, int*, Window*); +int (*XUndefineCursor_dylibloader_wrapper_xlib)( Display*, Window); +int (*XUngrabButton_dylibloader_wrapper_xlib)( Display*, unsigned int, unsigned int, Window); +int (*XUngrabKey_dylibloader_wrapper_xlib)( Display*, int, unsigned int, Window); +int (*XUngrabKeyboard_dylibloader_wrapper_xlib)( Display*, Time); +int (*XUngrabPointer_dylibloader_wrapper_xlib)( Display*, Time); +int (*XUngrabServer_dylibloader_wrapper_xlib)( Display*); +int (*XUninstallColormap_dylibloader_wrapper_xlib)( Display*, Colormap); +int (*XUnloadFont_dylibloader_wrapper_xlib)( Display*, Font); +int (*XUnmapSubwindows_dylibloader_wrapper_xlib)( Display*, Window); +int (*XUnmapWindow_dylibloader_wrapper_xlib)( Display*, Window); +int (*XVendorRelease_dylibloader_wrapper_xlib)( Display*); +int (*XWarpPointer_dylibloader_wrapper_xlib)( Display*, Window, Window, int, int, unsigned int, unsigned int, int, int); +int (*XWidthMMOfScreen_dylibloader_wrapper_xlib)( Screen*); +int (*XWidthOfScreen_dylibloader_wrapper_xlib)( Screen*); +int (*XWindowEvent_dylibloader_wrapper_xlib)( Display*, Window, long, XEvent*); +int (*XWriteBitmapFile_dylibloader_wrapper_xlib)( Display*,const char*, Pixmap, unsigned int, unsigned int, int, int); +int (*XSupportsLocale_dylibloader_wrapper_xlib)( void); +char* (*XSetLocaleModifiers_dylibloader_wrapper_xlib)(const char*); +XOM (*XOpenOM_dylibloader_wrapper_xlib)( Display*,struct _XrmHashBucketRec*,const char*,const char*); +int (*XCloseOM_dylibloader_wrapper_xlib)( XOM); +char* (*XSetOMValues_dylibloader_wrapper_xlib)( XOM,...); +char* (*XGetOMValues_dylibloader_wrapper_xlib)( XOM,...); +Display* (*XDisplayOfOM_dylibloader_wrapper_xlib)( XOM); +char* (*XLocaleOfOM_dylibloader_wrapper_xlib)( XOM); +XOC (*XCreateOC_dylibloader_wrapper_xlib)( XOM,...); +void (*XDestroyOC_dylibloader_wrapper_xlib)( XOC); +XOM (*XOMOfOC_dylibloader_wrapper_xlib)( XOC); +char* (*XSetOCValues_dylibloader_wrapper_xlib)( XOC,...); +char* (*XGetOCValues_dylibloader_wrapper_xlib)( XOC,...); +XFontSet (*XCreateFontSet_dylibloader_wrapper_xlib)( Display*,const char*, char***, int*, char**); +void (*XFreeFontSet_dylibloader_wrapper_xlib)( Display*, XFontSet); +int (*XFontsOfFontSet_dylibloader_wrapper_xlib)( XFontSet, XFontStruct***, char***); +char* (*XBaseFontNameListOfFontSet_dylibloader_wrapper_xlib)( XFontSet); +char* (*XLocaleOfFontSet_dylibloader_wrapper_xlib)( XFontSet); +int (*XContextDependentDrawing_dylibloader_wrapper_xlib)( XFontSet); +int (*XDirectionalDependentDrawing_dylibloader_wrapper_xlib)( XFontSet); +int (*XContextualDrawing_dylibloader_wrapper_xlib)( XFontSet); +XFontSetExtents* (*XExtentsOfFontSet_dylibloader_wrapper_xlib)( XFontSet); +int (*XmbTextEscapement_dylibloader_wrapper_xlib)( XFontSet,const char*, int); +int (*XwcTextEscapement_dylibloader_wrapper_xlib)( XFontSet,const wchar_t*, int); +int (*Xutf8TextEscapement_dylibloader_wrapper_xlib)( XFontSet,const char*, int); +int (*XmbTextExtents_dylibloader_wrapper_xlib)( XFontSet,const char*, int, XRectangle*, XRectangle*); +int (*XwcTextExtents_dylibloader_wrapper_xlib)( XFontSet,const wchar_t*, int, XRectangle*, XRectangle*); +int (*Xutf8TextExtents_dylibloader_wrapper_xlib)( XFontSet,const char*, int, XRectangle*, XRectangle*); +int (*XmbTextPerCharExtents_dylibloader_wrapper_xlib)( XFontSet,const char*, int, XRectangle*, XRectangle*, int, int*, XRectangle*, XRectangle*); +int (*XwcTextPerCharExtents_dylibloader_wrapper_xlib)( XFontSet,const wchar_t*, int, XRectangle*, XRectangle*, int, int*, XRectangle*, XRectangle*); +int (*Xutf8TextPerCharExtents_dylibloader_wrapper_xlib)( XFontSet,const char*, int, XRectangle*, XRectangle*, int, int*, XRectangle*, XRectangle*); +void (*XmbDrawText_dylibloader_wrapper_xlib)( Display*, Drawable, GC, int, int, XmbTextItem*, int); +void (*XwcDrawText_dylibloader_wrapper_xlib)( Display*, Drawable, GC, int, int, XwcTextItem*, int); +void (*Xutf8DrawText_dylibloader_wrapper_xlib)( Display*, Drawable, GC, int, int, XmbTextItem*, int); +void (*XmbDrawString_dylibloader_wrapper_xlib)( Display*, Drawable, XFontSet, GC, int, int,const char*, int); +void (*XwcDrawString_dylibloader_wrapper_xlib)( Display*, Drawable, XFontSet, GC, int, int,const wchar_t*, int); +void (*Xutf8DrawString_dylibloader_wrapper_xlib)( Display*, Drawable, XFontSet, GC, int, int,const char*, int); +void (*XmbDrawImageString_dylibloader_wrapper_xlib)( Display*, Drawable, XFontSet, GC, int, int,const char*, int); +void (*XwcDrawImageString_dylibloader_wrapper_xlib)( Display*, Drawable, XFontSet, GC, int, int,const wchar_t*, int); +void (*Xutf8DrawImageString_dylibloader_wrapper_xlib)( Display*, Drawable, XFontSet, GC, int, int,const char*, int); +XIM (*XOpenIM_dylibloader_wrapper_xlib)( Display*,struct _XrmHashBucketRec*, char*, char*); +int (*XCloseIM_dylibloader_wrapper_xlib)( XIM); +char* (*XGetIMValues_dylibloader_wrapper_xlib)( XIM,...); +char* (*XSetIMValues_dylibloader_wrapper_xlib)( XIM,...); +Display* (*XDisplayOfIM_dylibloader_wrapper_xlib)( XIM); +char* (*XLocaleOfIM_dylibloader_wrapper_xlib)( XIM); +XIC (*XCreateIC_dylibloader_wrapper_xlib)( XIM,...); +void (*XDestroyIC_dylibloader_wrapper_xlib)( XIC); +void (*XSetICFocus_dylibloader_wrapper_xlib)( XIC); +void (*XUnsetICFocus_dylibloader_wrapper_xlib)( XIC); +wchar_t* (*XwcResetIC_dylibloader_wrapper_xlib)( XIC); +char* (*XmbResetIC_dylibloader_wrapper_xlib)( XIC); +char* (*Xutf8ResetIC_dylibloader_wrapper_xlib)( XIC); +char* (*XSetICValues_dylibloader_wrapper_xlib)( XIC,...); +char* (*XGetICValues_dylibloader_wrapper_xlib)( XIC,...); +XIM (*XIMOfIC_dylibloader_wrapper_xlib)( XIC); +int (*XFilterEvent_dylibloader_wrapper_xlib)( XEvent*, Window); +int (*XmbLookupString_dylibloader_wrapper_xlib)( XIC, XKeyPressedEvent*, char*, int, KeySym*, int*); +int (*XwcLookupString_dylibloader_wrapper_xlib)( XIC, XKeyPressedEvent*, wchar_t*, int, KeySym*, int*); +int (*Xutf8LookupString_dylibloader_wrapper_xlib)( XIC, XKeyPressedEvent*, char*, int, KeySym*, int*); +XVaNestedList (*XVaCreateNestedList_dylibloader_wrapper_xlib)( int,...); +int (*XRegisterIMInstantiateCallback_dylibloader_wrapper_xlib)( Display*,struct _XrmHashBucketRec*, char*, char*, XIDProc, XPointer); +int (*XUnregisterIMInstantiateCallback_dylibloader_wrapper_xlib)( Display*,struct _XrmHashBucketRec*, char*, char*, XIDProc, XPointer); +int (*XInternalConnectionNumbers_dylibloader_wrapper_xlib)( Display*, int**, int*); +void (*XProcessInternalConnection_dylibloader_wrapper_xlib)( Display*, int); +int (*XAddConnectionWatch_dylibloader_wrapper_xlib)( Display*, XConnectionWatchProc, XPointer); +void (*XRemoveConnectionWatch_dylibloader_wrapper_xlib)( Display*, XConnectionWatchProc, XPointer); +void (*XSetAuthorization_dylibloader_wrapper_xlib)( char*, int, char*, int); +int (*_Xmbtowc_dylibloader_wrapper_xlib)( wchar_t*, char*, int); +int (*_Xwctomb_dylibloader_wrapper_xlib)( char*, wchar_t); +int (*XGetEventData_dylibloader_wrapper_xlib)( Display*, XGenericEventCookie*); +void (*XFreeEventData_dylibloader_wrapper_xlib)( Display*, XGenericEventCookie*); +XClassHint* (*XAllocClassHint_dylibloader_wrapper_xlib)( void); +XIconSize* (*XAllocIconSize_dylibloader_wrapper_xlib)( void); +XSizeHints* (*XAllocSizeHints_dylibloader_wrapper_xlib)( void); +XStandardColormap* (*XAllocStandardColormap_dylibloader_wrapper_xlib)( void); +XWMHints* (*XAllocWMHints_dylibloader_wrapper_xlib)( void); +int (*XClipBox_dylibloader_wrapper_xlib)( Region, XRectangle*); +Region (*XCreateRegion_dylibloader_wrapper_xlib)( void); +const char* (*XDefaultString_dylibloader_wrapper_xlib)( void); +int (*XDeleteContext_dylibloader_wrapper_xlib)( Display*, XID, XContext); +int (*XDestroyRegion_dylibloader_wrapper_xlib)( Region); +int (*XEmptyRegion_dylibloader_wrapper_xlib)( Region); +int (*XEqualRegion_dylibloader_wrapper_xlib)( Region, Region); +int (*XFindContext_dylibloader_wrapper_xlib)( Display*, XID, XContext, XPointer*); +int (*XGetClassHint_dylibloader_wrapper_xlib)( Display*, Window, XClassHint*); +int (*XGetIconSizes_dylibloader_wrapper_xlib)( Display*, Window, XIconSize**, int*); +int (*XGetNormalHints_dylibloader_wrapper_xlib)( Display*, Window, XSizeHints*); +int (*XGetRGBColormaps_dylibloader_wrapper_xlib)( Display*, Window, XStandardColormap**, int*, Atom); +int (*XGetSizeHints_dylibloader_wrapper_xlib)( Display*, Window, XSizeHints*, Atom); +int (*XGetStandardColormap_dylibloader_wrapper_xlib)( Display*, Window, XStandardColormap*, Atom); +int (*XGetTextProperty_dylibloader_wrapper_xlib)( Display*, Window, XTextProperty*, Atom); +XVisualInfo* (*XGetVisualInfo_dylibloader_wrapper_xlib)( Display*, long, XVisualInfo*, int*); +int (*XGetWMClientMachine_dylibloader_wrapper_xlib)( Display*, Window, XTextProperty*); +XWMHints* (*XGetWMHints_dylibloader_wrapper_xlib)( Display*, Window); +int (*XGetWMIconName_dylibloader_wrapper_xlib)( Display*, Window, XTextProperty*); +int (*XGetWMName_dylibloader_wrapper_xlib)( Display*, Window, XTextProperty*); +int (*XGetWMNormalHints_dylibloader_wrapper_xlib)( Display*, Window, XSizeHints*, long*); +int (*XGetWMSizeHints_dylibloader_wrapper_xlib)( Display*, Window, XSizeHints*, long*, Atom); +int (*XGetZoomHints_dylibloader_wrapper_xlib)( Display*, Window, XSizeHints*); +int (*XIntersectRegion_dylibloader_wrapper_xlib)( Region, Region, Region); +void (*XConvertCase_dylibloader_wrapper_xlib)( KeySym, KeySym*, KeySym*); +int (*XLookupString_dylibloader_wrapper_xlib)( XKeyEvent*, char*, int, KeySym*, XComposeStatus*); +int (*XMatchVisualInfo_dylibloader_wrapper_xlib)( Display*, int, int, int, XVisualInfo*); +int (*XOffsetRegion_dylibloader_wrapper_xlib)( Region, int, int); +int (*XPointInRegion_dylibloader_wrapper_xlib)( Region, int, int); +Region (*XPolygonRegion_dylibloader_wrapper_xlib)( XPoint*, int, int); +int (*XRectInRegion_dylibloader_wrapper_xlib)( Region, int, int, unsigned int, unsigned int); +int (*XSaveContext_dylibloader_wrapper_xlib)( Display*, XID, XContext,const char*); +int (*XSetClassHint_dylibloader_wrapper_xlib)( Display*, Window, XClassHint*); +int (*XSetIconSizes_dylibloader_wrapper_xlib)( Display*, Window, XIconSize*, int); +int (*XSetNormalHints_dylibloader_wrapper_xlib)( Display*, Window, XSizeHints*); +void (*XSetRGBColormaps_dylibloader_wrapper_xlib)( Display*, Window, XStandardColormap*, int, Atom); +int (*XSetSizeHints_dylibloader_wrapper_xlib)( Display*, Window, XSizeHints*, Atom); +int (*XSetStandardProperties_dylibloader_wrapper_xlib)( Display*, Window,const char*,const char*, Pixmap, char**, int, XSizeHints*); +void (*XSetTextProperty_dylibloader_wrapper_xlib)( Display*, Window, XTextProperty*, Atom); +void (*XSetWMClientMachine_dylibloader_wrapper_xlib)( Display*, Window, XTextProperty*); +int (*XSetWMHints_dylibloader_wrapper_xlib)( Display*, Window, XWMHints*); +void (*XSetWMIconName_dylibloader_wrapper_xlib)( Display*, Window, XTextProperty*); +void (*XSetWMName_dylibloader_wrapper_xlib)( Display*, Window, XTextProperty*); +void (*XSetWMNormalHints_dylibloader_wrapper_xlib)( Display*, Window, XSizeHints*); +void (*XSetWMProperties_dylibloader_wrapper_xlib)( Display*, Window, XTextProperty*, XTextProperty*, char**, int, XSizeHints*, XWMHints*, XClassHint*); +void (*XmbSetWMProperties_dylibloader_wrapper_xlib)( Display*, Window,const char*,const char*, char**, int, XSizeHints*, XWMHints*, XClassHint*); +void (*Xutf8SetWMProperties_dylibloader_wrapper_xlib)( Display*, Window,const char*,const char*, char**, int, XSizeHints*, XWMHints*, XClassHint*); +void (*XSetWMSizeHints_dylibloader_wrapper_xlib)( Display*, Window, XSizeHints*, Atom); +int (*XSetRegion_dylibloader_wrapper_xlib)( Display*, GC, Region); +void (*XSetStandardColormap_dylibloader_wrapper_xlib)( Display*, Window, XStandardColormap*, Atom); +int (*XSetZoomHints_dylibloader_wrapper_xlib)( Display*, Window, XSizeHints*); +int (*XShrinkRegion_dylibloader_wrapper_xlib)( Region, int, int); +int (*XStringListToTextProperty_dylibloader_wrapper_xlib)( char**, int, XTextProperty*); +int (*XSubtractRegion_dylibloader_wrapper_xlib)( Region, Region, Region); +int (*XmbTextListToTextProperty_dylibloader_wrapper_xlib)( Display*, char**, int, XICCEncodingStyle, XTextProperty*); +int (*XwcTextListToTextProperty_dylibloader_wrapper_xlib)( Display*, wchar_t**, int, XICCEncodingStyle, XTextProperty*); +int (*Xutf8TextListToTextProperty_dylibloader_wrapper_xlib)( Display*, char**, int, XICCEncodingStyle, XTextProperty*); +void (*XwcFreeStringList_dylibloader_wrapper_xlib)( wchar_t**); +int (*XTextPropertyToStringList_dylibloader_wrapper_xlib)( XTextProperty*, char***, int*); +int (*XmbTextPropertyToTextList_dylibloader_wrapper_xlib)( Display*,const XTextProperty*, char***, int*); +int (*XwcTextPropertyToTextList_dylibloader_wrapper_xlib)( Display*,const XTextProperty*, wchar_t***, int*); +int (*Xutf8TextPropertyToTextList_dylibloader_wrapper_xlib)( Display*,const XTextProperty*, char***, int*); +int (*XUnionRectWithRegion_dylibloader_wrapper_xlib)( XRectangle*, Region, Region); +int (*XUnionRegion_dylibloader_wrapper_xlib)( Region, Region, Region); +int (*XWMGeometry_dylibloader_wrapper_xlib)( Display*, int,const char*,const char*, unsigned int, XSizeHints*, int*, int*, int*, int*, int*); +int (*XXorRegion_dylibloader_wrapper_xlib)( Region, Region, Region); +int (*XkbIgnoreExtension_dylibloader_wrapper_xlib)( int); +Display* (*XkbOpenDisplay_dylibloader_wrapper_xlib)( char*, int*, int*, int*, int*, int*); +int (*XkbQueryExtension_dylibloader_wrapper_xlib)( Display*, int*, int*, int*, int*, int*); +int (*XkbUseExtension_dylibloader_wrapper_xlib)( Display*, int*, int*); +int (*XkbLibraryVersion_dylibloader_wrapper_xlib)( int*, int*); +unsigned int (*XkbSetXlibControls_dylibloader_wrapper_xlib)( Display*, unsigned int, unsigned int); +unsigned int (*XkbGetXlibControls_dylibloader_wrapper_xlib)( Display*); +unsigned int (*XkbXlibControlsImplemented_dylibloader_wrapper_xlib)( void); +void (*XkbSetAtomFuncs_dylibloader_wrapper_xlib)( XkbInternAtomFunc, XkbGetAtomNameFunc); +KeySym (*XkbKeycodeToKeysym_dylibloader_wrapper_xlib)( Display*, KeyCode, int, int); +unsigned int (*XkbKeysymToModifiers_dylibloader_wrapper_xlib)( Display*, KeySym); +int (*XkbLookupKeySym_dylibloader_wrapper_xlib)( Display*, KeyCode, unsigned int, unsigned int*, KeySym*); +int (*XkbLookupKeyBinding_dylibloader_wrapper_xlib)( Display*, KeySym, unsigned int, char*, int, int*); +int (*XkbTranslateKeyCode_dylibloader_wrapper_xlib)( XkbDescPtr, KeyCode, unsigned int, unsigned int*, KeySym*); +int (*XkbTranslateKeySym_dylibloader_wrapper_xlib)( Display*, KeySym*, unsigned int, char*, int, int*); +int (*XkbSetAutoRepeatRate_dylibloader_wrapper_xlib)( Display*, unsigned int, unsigned int, unsigned int); +int (*XkbGetAutoRepeatRate_dylibloader_wrapper_xlib)( Display*, unsigned int, unsigned int*, unsigned int*); +int (*XkbChangeEnabledControls_dylibloader_wrapper_xlib)( Display*, unsigned int, unsigned int, unsigned int); +int (*XkbDeviceBell_dylibloader_wrapper_xlib)( Display*, Window, int, int, int, int, Atom); +int (*XkbForceDeviceBell_dylibloader_wrapper_xlib)( Display*, int, int, int, int); +int (*XkbDeviceBellEvent_dylibloader_wrapper_xlib)( Display*, Window, int, int, int, int, Atom); +int (*XkbBell_dylibloader_wrapper_xlib)( Display*, Window, int, Atom); +int (*XkbForceBell_dylibloader_wrapper_xlib)( Display*, int); +int (*XkbBellEvent_dylibloader_wrapper_xlib)( Display*, Window, int, Atom); +int (*XkbSelectEvents_dylibloader_wrapper_xlib)( Display*, unsigned int, unsigned int, unsigned int); +int (*XkbSelectEventDetails_dylibloader_wrapper_xlib)( Display*, unsigned int, unsigned int, unsigned long, unsigned long); +void (*XkbNoteMapChanges_dylibloader_wrapper_xlib)( XkbMapChangesPtr, XkbMapNotifyEvent*, unsigned int); +void (*XkbNoteNameChanges_dylibloader_wrapper_xlib)( XkbNameChangesPtr, XkbNamesNotifyEvent*, unsigned int); +int (*XkbGetIndicatorState_dylibloader_wrapper_xlib)( Display*, unsigned int, unsigned int*); +int (*XkbGetIndicatorMap_dylibloader_wrapper_xlib)( Display*, unsigned long, XkbDescPtr); +int (*XkbSetIndicatorMap_dylibloader_wrapper_xlib)( Display*, unsigned long, XkbDescPtr); +int (*XkbGetNamedIndicator_dylibloader_wrapper_xlib)( Display*, Atom, int*, int*, XkbIndicatorMapPtr, int*); +int (*XkbGetNamedDeviceIndicator_dylibloader_wrapper_xlib)( Display*, unsigned int, unsigned int, unsigned int, Atom, int*, int*, XkbIndicatorMapPtr, int*); +int (*XkbSetNamedIndicator_dylibloader_wrapper_xlib)( Display*, Atom, int, int, int, XkbIndicatorMapPtr); +int (*XkbSetNamedDeviceIndicator_dylibloader_wrapper_xlib)( Display*, unsigned int, unsigned int, unsigned int, Atom, int, int, int, XkbIndicatorMapPtr); +int (*XkbLockModifiers_dylibloader_wrapper_xlib)( Display*, unsigned int, unsigned int, unsigned int); +int (*XkbLatchModifiers_dylibloader_wrapper_xlib)( Display*, unsigned int, unsigned int, unsigned int); +int (*XkbLockGroup_dylibloader_wrapper_xlib)( Display*, unsigned int, unsigned int); +int (*XkbLatchGroup_dylibloader_wrapper_xlib)( Display*, unsigned int, unsigned int); +int (*XkbSetServerInternalMods_dylibloader_wrapper_xlib)( Display*, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int); +int (*XkbSetIgnoreLockMods_dylibloader_wrapper_xlib)( Display*, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int); +int (*XkbVirtualModsToReal_dylibloader_wrapper_xlib)( XkbDescPtr, unsigned int, unsigned int*); +int (*XkbComputeEffectiveMap_dylibloader_wrapper_xlib)( XkbDescPtr, XkbKeyTypePtr, unsigned char*); +int (*XkbInitCanonicalKeyTypes_dylibloader_wrapper_xlib)( XkbDescPtr, unsigned int, int); +XkbDescPtr (*XkbAllocKeyboard_dylibloader_wrapper_xlib)( void); +void (*XkbFreeKeyboard_dylibloader_wrapper_xlib)( XkbDescPtr, unsigned int, int); +int (*XkbAllocClientMap_dylibloader_wrapper_xlib)( XkbDescPtr, unsigned int, unsigned int); +int (*XkbAllocServerMap_dylibloader_wrapper_xlib)( XkbDescPtr, unsigned int, unsigned int); +void (*XkbFreeClientMap_dylibloader_wrapper_xlib)( XkbDescPtr, unsigned int, int); +void (*XkbFreeServerMap_dylibloader_wrapper_xlib)( XkbDescPtr, unsigned int, int); +XkbKeyTypePtr (*XkbAddKeyType_dylibloader_wrapper_xlib)( XkbDescPtr, Atom, int, int, int); +int (*XkbAllocIndicatorMaps_dylibloader_wrapper_xlib)( XkbDescPtr); +void (*XkbFreeIndicatorMaps_dylibloader_wrapper_xlib)( XkbDescPtr); +XkbDescPtr (*XkbGetMap_dylibloader_wrapper_xlib)( Display*, unsigned int, unsigned int); +int (*XkbGetUpdatedMap_dylibloader_wrapper_xlib)( Display*, unsigned int, XkbDescPtr); +int (*XkbGetMapChanges_dylibloader_wrapper_xlib)( Display*, XkbDescPtr, XkbMapChangesPtr); +int (*XkbRefreshKeyboardMapping_dylibloader_wrapper_xlib)( XkbMapNotifyEvent*); +int (*XkbGetKeyTypes_dylibloader_wrapper_xlib)( Display*, unsigned int, unsigned int, XkbDescPtr); +int (*XkbGetKeySyms_dylibloader_wrapper_xlib)( Display*, unsigned int, unsigned int, XkbDescPtr); +int (*XkbGetKeyActions_dylibloader_wrapper_xlib)( Display*, unsigned int, unsigned int, XkbDescPtr); +int (*XkbGetKeyBehaviors_dylibloader_wrapper_xlib)( Display*, unsigned int, unsigned int, XkbDescPtr); +int (*XkbGetVirtualMods_dylibloader_wrapper_xlib)( Display*, unsigned int, XkbDescPtr); +int (*XkbGetKeyExplicitComponents_dylibloader_wrapper_xlib)( Display*, unsigned int, unsigned int, XkbDescPtr); +int (*XkbGetKeyModifierMap_dylibloader_wrapper_xlib)( Display*, unsigned int, unsigned int, XkbDescPtr); +int (*XkbGetKeyVirtualModMap_dylibloader_wrapper_xlib)( Display*, unsigned int, unsigned int, XkbDescPtr); +int (*XkbAllocControls_dylibloader_wrapper_xlib)( XkbDescPtr, unsigned int); +void (*XkbFreeControls_dylibloader_wrapper_xlib)( XkbDescPtr, unsigned int, int); +int (*XkbGetControls_dylibloader_wrapper_xlib)( Display*, unsigned long, XkbDescPtr); +int (*XkbSetControls_dylibloader_wrapper_xlib)( Display*, unsigned long, XkbDescPtr); +void (*XkbNoteControlsChanges_dylibloader_wrapper_xlib)( XkbControlsChangesPtr, XkbControlsNotifyEvent*, unsigned int); +int (*XkbAllocCompatMap_dylibloader_wrapper_xlib)( XkbDescPtr, unsigned int, unsigned int); +void (*XkbFreeCompatMap_dylibloader_wrapper_xlib)( XkbDescPtr, unsigned int, int); +int (*XkbGetCompatMap_dylibloader_wrapper_xlib)( Display*, unsigned int, XkbDescPtr); +int (*XkbSetCompatMap_dylibloader_wrapper_xlib)( Display*, unsigned int, XkbDescPtr, int); +int (*XkbAllocNames_dylibloader_wrapper_xlib)( XkbDescPtr, unsigned int, int, int); +int (*XkbGetNames_dylibloader_wrapper_xlib)( Display*, unsigned int, XkbDescPtr); +int (*XkbSetNames_dylibloader_wrapper_xlib)( Display*, unsigned int, unsigned int, unsigned int, XkbDescPtr); +int (*XkbChangeNames_dylibloader_wrapper_xlib)( Display*, XkbDescPtr, XkbNameChangesPtr); +void (*XkbFreeNames_dylibloader_wrapper_xlib)( XkbDescPtr, unsigned int, int); +int (*XkbGetState_dylibloader_wrapper_xlib)( Display*, unsigned int, XkbStatePtr); +int (*XkbSetMap_dylibloader_wrapper_xlib)( Display*, unsigned int, XkbDescPtr); +int (*XkbChangeMap_dylibloader_wrapper_xlib)( Display*, XkbDescPtr, XkbMapChangesPtr); +int (*XkbSetDetectableAutoRepeat_dylibloader_wrapper_xlib)( Display*, int, int*); +int (*XkbGetDetectableAutoRepeat_dylibloader_wrapper_xlib)( Display*, int*); +int (*XkbSetAutoResetControls_dylibloader_wrapper_xlib)( Display*, unsigned int, unsigned int*, unsigned int*); +int (*XkbGetAutoResetControls_dylibloader_wrapper_xlib)( Display*, unsigned int*, unsigned int*); +int (*XkbSetPerClientControls_dylibloader_wrapper_xlib)( Display*, unsigned int, unsigned int*); +int (*XkbGetPerClientControls_dylibloader_wrapper_xlib)( Display*, unsigned int*); +int (*XkbCopyKeyType_dylibloader_wrapper_xlib)( XkbKeyTypePtr, XkbKeyTypePtr); +int (*XkbCopyKeyTypes_dylibloader_wrapper_xlib)( XkbKeyTypePtr, XkbKeyTypePtr, int); +int (*XkbResizeKeyType_dylibloader_wrapper_xlib)( XkbDescPtr, int, int, int, int); +KeySym* (*XkbResizeKeySyms_dylibloader_wrapper_xlib)( XkbDescPtr, int, int); +XkbAction* (*XkbResizeKeyActions_dylibloader_wrapper_xlib)( XkbDescPtr, int, int); +int (*XkbChangeTypesOfKey_dylibloader_wrapper_xlib)( XkbDescPtr, int, int, unsigned int, int*, XkbMapChangesPtr); +int (*XkbChangeKeycodeRange_dylibloader_wrapper_xlib)( XkbDescPtr, int, int, XkbChangesPtr); +XkbComponentListPtr (*XkbListComponents_dylibloader_wrapper_xlib)( Display*, unsigned int, XkbComponentNamesPtr, int*); +void (*XkbFreeComponentList_dylibloader_wrapper_xlib)( XkbComponentListPtr); +XkbDescPtr (*XkbGetKeyboard_dylibloader_wrapper_xlib)( Display*, unsigned int, unsigned int); +XkbDescPtr (*XkbGetKeyboardByName_dylibloader_wrapper_xlib)( Display*, unsigned int, XkbComponentNamesPtr, unsigned int, unsigned int, int); +int (*XkbKeyTypesForCoreSymbols_dylibloader_wrapper_xlib)( XkbDescPtr, int, KeySym*, unsigned int, int*, KeySym*); +int (*XkbApplyCompatMapToKey_dylibloader_wrapper_xlib)( XkbDescPtr, KeyCode, XkbChangesPtr); +int (*XkbUpdateMapFromCore_dylibloader_wrapper_xlib)( XkbDescPtr, KeyCode, int, int, KeySym*, XkbChangesPtr); +XkbDeviceLedInfoPtr (*XkbAddDeviceLedInfo_dylibloader_wrapper_xlib)( XkbDeviceInfoPtr, unsigned int, unsigned int); +int (*XkbResizeDeviceButtonActions_dylibloader_wrapper_xlib)( XkbDeviceInfoPtr, unsigned int); +XkbDeviceInfoPtr (*XkbAllocDeviceInfo_dylibloader_wrapper_xlib)( unsigned int, unsigned int, unsigned int); +void (*XkbFreeDeviceInfo_dylibloader_wrapper_xlib)( XkbDeviceInfoPtr, unsigned int, int); +void (*XkbNoteDeviceChanges_dylibloader_wrapper_xlib)( XkbDeviceChangesPtr, XkbExtensionDeviceNotifyEvent*, unsigned int); +XkbDeviceInfoPtr (*XkbGetDeviceInfo_dylibloader_wrapper_xlib)( Display*, unsigned int, unsigned int, unsigned int, unsigned int); +int (*XkbGetDeviceInfoChanges_dylibloader_wrapper_xlib)( Display*, XkbDeviceInfoPtr, XkbDeviceChangesPtr); +int (*XkbGetDeviceButtonActions_dylibloader_wrapper_xlib)( Display*, XkbDeviceInfoPtr, int, unsigned int, unsigned int); +int (*XkbGetDeviceLedInfo_dylibloader_wrapper_xlib)( Display*, XkbDeviceInfoPtr, unsigned int, unsigned int, unsigned int); +int (*XkbSetDeviceInfo_dylibloader_wrapper_xlib)( Display*, unsigned int, XkbDeviceInfoPtr); +int (*XkbChangeDeviceInfo_dylibloader_wrapper_xlib)( Display*, XkbDeviceInfoPtr, XkbDeviceChangesPtr); +int (*XkbSetDeviceLedInfo_dylibloader_wrapper_xlib)( Display*, XkbDeviceInfoPtr, unsigned int, unsigned int, unsigned int); +int (*XkbSetDeviceButtonActions_dylibloader_wrapper_xlib)( Display*, XkbDeviceInfoPtr, unsigned int, unsigned int); +char (*XkbToControl_dylibloader_wrapper_xlib)( char); +int (*XkbSetDebuggingFlags_dylibloader_wrapper_xlib)( Display*, unsigned int, unsigned int, char*, unsigned int, unsigned int, unsigned int*, unsigned int*); +int (*XkbApplyVirtualModChanges_dylibloader_wrapper_xlib)( XkbDescPtr, unsigned int, XkbChangesPtr); +int (*XkbUpdateActionVirtualMods_dylibloader_wrapper_xlib)( XkbDescPtr, XkbAction*, unsigned int); +void (*XkbUpdateKeyTypeVirtualMods_dylibloader_wrapper_xlib)( XkbDescPtr, XkbKeyTypePtr, unsigned int, XkbChangesPtr); +int initialize_xlib(int verbose) { + void *handle; + char *error; + handle = dlopen("libX11.so.6", RTLD_LAZY); + if (!handle) { + if (verbose) { + fprintf(stderr, "%s\n", dlerror()); + } + return(1); + } + dlerror(); +// _Xmblen + *(void **) (&_Xmblen_dylibloader_wrapper_xlib) = dlsym(handle, "_Xmblen"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XLoadQueryFont + *(void **) (&XLoadQueryFont_dylibloader_wrapper_xlib) = dlsym(handle, "XLoadQueryFont"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XQueryFont + *(void **) (&XQueryFont_dylibloader_wrapper_xlib) = dlsym(handle, "XQueryFont"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XGetMotionEvents + *(void **) (&XGetMotionEvents_dylibloader_wrapper_xlib) = dlsym(handle, "XGetMotionEvents"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XDeleteModifiermapEntry + *(void **) (&XDeleteModifiermapEntry_dylibloader_wrapper_xlib) = dlsym(handle, "XDeleteModifiermapEntry"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XGetModifierMapping + *(void **) (&XGetModifierMapping_dylibloader_wrapper_xlib) = dlsym(handle, "XGetModifierMapping"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XInsertModifiermapEntry + *(void **) (&XInsertModifiermapEntry_dylibloader_wrapper_xlib) = dlsym(handle, "XInsertModifiermapEntry"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XNewModifiermap + *(void **) (&XNewModifiermap_dylibloader_wrapper_xlib) = dlsym(handle, "XNewModifiermap"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XCreateImage + *(void **) (&XCreateImage_dylibloader_wrapper_xlib) = dlsym(handle, "XCreateImage"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XInitImage + *(void **) (&XInitImage_dylibloader_wrapper_xlib) = dlsym(handle, "XInitImage"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XGetImage + *(void **) (&XGetImage_dylibloader_wrapper_xlib) = dlsym(handle, "XGetImage"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XGetSubImage + *(void **) (&XGetSubImage_dylibloader_wrapper_xlib) = dlsym(handle, "XGetSubImage"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XOpenDisplay + *(void **) (&XOpenDisplay_dylibloader_wrapper_xlib) = dlsym(handle, "XOpenDisplay"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XrmInitialize + *(void **) (&XrmInitialize_dylibloader_wrapper_xlib) = dlsym(handle, "XrmInitialize"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XFetchBytes + *(void **) (&XFetchBytes_dylibloader_wrapper_xlib) = dlsym(handle, "XFetchBytes"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XFetchBuffer + *(void **) (&XFetchBuffer_dylibloader_wrapper_xlib) = dlsym(handle, "XFetchBuffer"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XGetAtomName + *(void **) (&XGetAtomName_dylibloader_wrapper_xlib) = dlsym(handle, "XGetAtomName"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XGetAtomNames + *(void **) (&XGetAtomNames_dylibloader_wrapper_xlib) = dlsym(handle, "XGetAtomNames"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XGetDefault + *(void **) (&XGetDefault_dylibloader_wrapper_xlib) = dlsym(handle, "XGetDefault"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XDisplayName + *(void **) (&XDisplayName_dylibloader_wrapper_xlib) = dlsym(handle, "XDisplayName"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XKeysymToString + *(void **) (&XKeysymToString_dylibloader_wrapper_xlib) = dlsym(handle, "XKeysymToString"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XSynchronize + *(void **) (&XSynchronize_dylibloader_wrapper_xlib) = dlsym(handle, "XSynchronize"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XSetAfterFunction + *(void **) (&XSetAfterFunction_dylibloader_wrapper_xlib) = dlsym(handle, "XSetAfterFunction"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XInternAtom + *(void **) (&XInternAtom_dylibloader_wrapper_xlib) = dlsym(handle, "XInternAtom"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XInternAtoms + *(void **) (&XInternAtoms_dylibloader_wrapper_xlib) = dlsym(handle, "XInternAtoms"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XCopyColormapAndFree + *(void **) (&XCopyColormapAndFree_dylibloader_wrapper_xlib) = dlsym(handle, "XCopyColormapAndFree"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XCreateColormap + *(void **) (&XCreateColormap_dylibloader_wrapper_xlib) = dlsym(handle, "XCreateColormap"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XCreatePixmapCursor + *(void **) (&XCreatePixmapCursor_dylibloader_wrapper_xlib) = dlsym(handle, "XCreatePixmapCursor"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XCreateGlyphCursor + *(void **) (&XCreateGlyphCursor_dylibloader_wrapper_xlib) = dlsym(handle, "XCreateGlyphCursor"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XCreateFontCursor + *(void **) (&XCreateFontCursor_dylibloader_wrapper_xlib) = dlsym(handle, "XCreateFontCursor"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XLoadFont + *(void **) (&XLoadFont_dylibloader_wrapper_xlib) = dlsym(handle, "XLoadFont"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XCreateGC + *(void **) (&XCreateGC_dylibloader_wrapper_xlib) = dlsym(handle, "XCreateGC"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XGContextFromGC + *(void **) (&XGContextFromGC_dylibloader_wrapper_xlib) = dlsym(handle, "XGContextFromGC"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XFlushGC + *(void **) (&XFlushGC_dylibloader_wrapper_xlib) = dlsym(handle, "XFlushGC"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XCreatePixmap + *(void **) (&XCreatePixmap_dylibloader_wrapper_xlib) = dlsym(handle, "XCreatePixmap"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XCreateBitmapFromData + *(void **) (&XCreateBitmapFromData_dylibloader_wrapper_xlib) = dlsym(handle, "XCreateBitmapFromData"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XCreatePixmapFromBitmapData + *(void **) (&XCreatePixmapFromBitmapData_dylibloader_wrapper_xlib) = dlsym(handle, "XCreatePixmapFromBitmapData"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XCreateSimpleWindow + *(void **) (&XCreateSimpleWindow_dylibloader_wrapper_xlib) = dlsym(handle, "XCreateSimpleWindow"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XGetSelectionOwner + *(void **) (&XGetSelectionOwner_dylibloader_wrapper_xlib) = dlsym(handle, "XGetSelectionOwner"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XCreateWindow + *(void **) (&XCreateWindow_dylibloader_wrapper_xlib) = dlsym(handle, "XCreateWindow"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XListInstalledColormaps + *(void **) (&XListInstalledColormaps_dylibloader_wrapper_xlib) = dlsym(handle, "XListInstalledColormaps"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XListFonts + *(void **) (&XListFonts_dylibloader_wrapper_xlib) = dlsym(handle, "XListFonts"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XListFontsWithInfo + *(void **) (&XListFontsWithInfo_dylibloader_wrapper_xlib) = dlsym(handle, "XListFontsWithInfo"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XGetFontPath + *(void **) (&XGetFontPath_dylibloader_wrapper_xlib) = dlsym(handle, "XGetFontPath"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XListExtensions + *(void **) (&XListExtensions_dylibloader_wrapper_xlib) = dlsym(handle, "XListExtensions"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XListProperties + *(void **) (&XListProperties_dylibloader_wrapper_xlib) = dlsym(handle, "XListProperties"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XListHosts + *(void **) (&XListHosts_dylibloader_wrapper_xlib) = dlsym(handle, "XListHosts"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XKeycodeToKeysym + *(void **) (&XKeycodeToKeysym_dylibloader_wrapper_xlib) = dlsym(handle, "XKeycodeToKeysym"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XLookupKeysym + *(void **) (&XLookupKeysym_dylibloader_wrapper_xlib) = dlsym(handle, "XLookupKeysym"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XGetKeyboardMapping + *(void **) (&XGetKeyboardMapping_dylibloader_wrapper_xlib) = dlsym(handle, "XGetKeyboardMapping"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XStringToKeysym + *(void **) (&XStringToKeysym_dylibloader_wrapper_xlib) = dlsym(handle, "XStringToKeysym"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XMaxRequestSize + *(void **) (&XMaxRequestSize_dylibloader_wrapper_xlib) = dlsym(handle, "XMaxRequestSize"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XExtendedMaxRequestSize + *(void **) (&XExtendedMaxRequestSize_dylibloader_wrapper_xlib) = dlsym(handle, "XExtendedMaxRequestSize"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XResourceManagerString + *(void **) (&XResourceManagerString_dylibloader_wrapper_xlib) = dlsym(handle, "XResourceManagerString"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XScreenResourceString + *(void **) (&XScreenResourceString_dylibloader_wrapper_xlib) = dlsym(handle, "XScreenResourceString"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XDisplayMotionBufferSize + *(void **) (&XDisplayMotionBufferSize_dylibloader_wrapper_xlib) = dlsym(handle, "XDisplayMotionBufferSize"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XVisualIDFromVisual + *(void **) (&XVisualIDFromVisual_dylibloader_wrapper_xlib) = dlsym(handle, "XVisualIDFromVisual"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XInitThreads + *(void **) (&XInitThreads_dylibloader_wrapper_xlib) = dlsym(handle, "XInitThreads"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XLockDisplay + *(void **) (&XLockDisplay_dylibloader_wrapper_xlib) = dlsym(handle, "XLockDisplay"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XUnlockDisplay + *(void **) (&XUnlockDisplay_dylibloader_wrapper_xlib) = dlsym(handle, "XUnlockDisplay"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XInitExtension + *(void **) (&XInitExtension_dylibloader_wrapper_xlib) = dlsym(handle, "XInitExtension"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XAddExtension + *(void **) (&XAddExtension_dylibloader_wrapper_xlib) = dlsym(handle, "XAddExtension"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XFindOnExtensionList + *(void **) (&XFindOnExtensionList_dylibloader_wrapper_xlib) = dlsym(handle, "XFindOnExtensionList"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XEHeadOfExtensionList + *(void **) (&XEHeadOfExtensionList_dylibloader_wrapper_xlib) = dlsym(handle, "XEHeadOfExtensionList"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XRootWindow + *(void **) (&XRootWindow_dylibloader_wrapper_xlib) = dlsym(handle, "XRootWindow"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XDefaultRootWindow + *(void **) (&XDefaultRootWindow_dylibloader_wrapper_xlib) = dlsym(handle, "XDefaultRootWindow"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XRootWindowOfScreen + *(void **) (&XRootWindowOfScreen_dylibloader_wrapper_xlib) = dlsym(handle, "XRootWindowOfScreen"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XDefaultVisual + *(void **) (&XDefaultVisual_dylibloader_wrapper_xlib) = dlsym(handle, "XDefaultVisual"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XDefaultVisualOfScreen + *(void **) (&XDefaultVisualOfScreen_dylibloader_wrapper_xlib) = dlsym(handle, "XDefaultVisualOfScreen"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XDefaultGC + *(void **) (&XDefaultGC_dylibloader_wrapper_xlib) = dlsym(handle, "XDefaultGC"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XDefaultGCOfScreen + *(void **) (&XDefaultGCOfScreen_dylibloader_wrapper_xlib) = dlsym(handle, "XDefaultGCOfScreen"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XBlackPixel + *(void **) (&XBlackPixel_dylibloader_wrapper_xlib) = dlsym(handle, "XBlackPixel"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XWhitePixel + *(void **) (&XWhitePixel_dylibloader_wrapper_xlib) = dlsym(handle, "XWhitePixel"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XAllPlanes + *(void **) (&XAllPlanes_dylibloader_wrapper_xlib) = dlsym(handle, "XAllPlanes"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XBlackPixelOfScreen + *(void **) (&XBlackPixelOfScreen_dylibloader_wrapper_xlib) = dlsym(handle, "XBlackPixelOfScreen"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XWhitePixelOfScreen + *(void **) (&XWhitePixelOfScreen_dylibloader_wrapper_xlib) = dlsym(handle, "XWhitePixelOfScreen"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XNextRequest + *(void **) (&XNextRequest_dylibloader_wrapper_xlib) = dlsym(handle, "XNextRequest"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XLastKnownRequestProcessed + *(void **) (&XLastKnownRequestProcessed_dylibloader_wrapper_xlib) = dlsym(handle, "XLastKnownRequestProcessed"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XServerVendor + *(void **) (&XServerVendor_dylibloader_wrapper_xlib) = dlsym(handle, "XServerVendor"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XDisplayString + *(void **) (&XDisplayString_dylibloader_wrapper_xlib) = dlsym(handle, "XDisplayString"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XDefaultColormap + *(void **) (&XDefaultColormap_dylibloader_wrapper_xlib) = dlsym(handle, "XDefaultColormap"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XDefaultColormapOfScreen + *(void **) (&XDefaultColormapOfScreen_dylibloader_wrapper_xlib) = dlsym(handle, "XDefaultColormapOfScreen"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XDisplayOfScreen + *(void **) (&XDisplayOfScreen_dylibloader_wrapper_xlib) = dlsym(handle, "XDisplayOfScreen"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XScreenOfDisplay + *(void **) (&XScreenOfDisplay_dylibloader_wrapper_xlib) = dlsym(handle, "XScreenOfDisplay"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XDefaultScreenOfDisplay + *(void **) (&XDefaultScreenOfDisplay_dylibloader_wrapper_xlib) = dlsym(handle, "XDefaultScreenOfDisplay"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XEventMaskOfScreen + *(void **) (&XEventMaskOfScreen_dylibloader_wrapper_xlib) = dlsym(handle, "XEventMaskOfScreen"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XScreenNumberOfScreen + *(void **) (&XScreenNumberOfScreen_dylibloader_wrapper_xlib) = dlsym(handle, "XScreenNumberOfScreen"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XSetErrorHandler + *(void **) (&XSetErrorHandler_dylibloader_wrapper_xlib) = dlsym(handle, "XSetErrorHandler"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XSetIOErrorHandler + *(void **) (&XSetIOErrorHandler_dylibloader_wrapper_xlib) = dlsym(handle, "XSetIOErrorHandler"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XListPixmapFormats + *(void **) (&XListPixmapFormats_dylibloader_wrapper_xlib) = dlsym(handle, "XListPixmapFormats"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XListDepths + *(void **) (&XListDepths_dylibloader_wrapper_xlib) = dlsym(handle, "XListDepths"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XReconfigureWMWindow + *(void **) (&XReconfigureWMWindow_dylibloader_wrapper_xlib) = dlsym(handle, "XReconfigureWMWindow"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XGetWMProtocols + *(void **) (&XGetWMProtocols_dylibloader_wrapper_xlib) = dlsym(handle, "XGetWMProtocols"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XSetWMProtocols + *(void **) (&XSetWMProtocols_dylibloader_wrapper_xlib) = dlsym(handle, "XSetWMProtocols"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XIconifyWindow + *(void **) (&XIconifyWindow_dylibloader_wrapper_xlib) = dlsym(handle, "XIconifyWindow"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XWithdrawWindow + *(void **) (&XWithdrawWindow_dylibloader_wrapper_xlib) = dlsym(handle, "XWithdrawWindow"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XGetCommand + *(void **) (&XGetCommand_dylibloader_wrapper_xlib) = dlsym(handle, "XGetCommand"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XGetWMColormapWindows + *(void **) (&XGetWMColormapWindows_dylibloader_wrapper_xlib) = dlsym(handle, "XGetWMColormapWindows"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XSetWMColormapWindows + *(void **) (&XSetWMColormapWindows_dylibloader_wrapper_xlib) = dlsym(handle, "XSetWMColormapWindows"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XFreeStringList + *(void **) (&XFreeStringList_dylibloader_wrapper_xlib) = dlsym(handle, "XFreeStringList"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XSetTransientForHint + *(void **) (&XSetTransientForHint_dylibloader_wrapper_xlib) = dlsym(handle, "XSetTransientForHint"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XActivateScreenSaver + *(void **) (&XActivateScreenSaver_dylibloader_wrapper_xlib) = dlsym(handle, "XActivateScreenSaver"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XAddHost + *(void **) (&XAddHost_dylibloader_wrapper_xlib) = dlsym(handle, "XAddHost"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XAddHosts + *(void **) (&XAddHosts_dylibloader_wrapper_xlib) = dlsym(handle, "XAddHosts"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XAddToExtensionList + *(void **) (&XAddToExtensionList_dylibloader_wrapper_xlib) = dlsym(handle, "XAddToExtensionList"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XAddToSaveSet + *(void **) (&XAddToSaveSet_dylibloader_wrapper_xlib) = dlsym(handle, "XAddToSaveSet"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XAllocColor + *(void **) (&XAllocColor_dylibloader_wrapper_xlib) = dlsym(handle, "XAllocColor"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XAllocColorCells + *(void **) (&XAllocColorCells_dylibloader_wrapper_xlib) = dlsym(handle, "XAllocColorCells"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XAllocColorPlanes + *(void **) (&XAllocColorPlanes_dylibloader_wrapper_xlib) = dlsym(handle, "XAllocColorPlanes"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XAllocNamedColor + *(void **) (&XAllocNamedColor_dylibloader_wrapper_xlib) = dlsym(handle, "XAllocNamedColor"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XAllowEvents + *(void **) (&XAllowEvents_dylibloader_wrapper_xlib) = dlsym(handle, "XAllowEvents"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XAutoRepeatOff + *(void **) (&XAutoRepeatOff_dylibloader_wrapper_xlib) = dlsym(handle, "XAutoRepeatOff"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XAutoRepeatOn + *(void **) (&XAutoRepeatOn_dylibloader_wrapper_xlib) = dlsym(handle, "XAutoRepeatOn"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XBell + *(void **) (&XBell_dylibloader_wrapper_xlib) = dlsym(handle, "XBell"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XBitmapBitOrder + *(void **) (&XBitmapBitOrder_dylibloader_wrapper_xlib) = dlsym(handle, "XBitmapBitOrder"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XBitmapPad + *(void **) (&XBitmapPad_dylibloader_wrapper_xlib) = dlsym(handle, "XBitmapPad"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XBitmapUnit + *(void **) (&XBitmapUnit_dylibloader_wrapper_xlib) = dlsym(handle, "XBitmapUnit"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XCellsOfScreen + *(void **) (&XCellsOfScreen_dylibloader_wrapper_xlib) = dlsym(handle, "XCellsOfScreen"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XChangeActivePointerGrab + *(void **) (&XChangeActivePointerGrab_dylibloader_wrapper_xlib) = dlsym(handle, "XChangeActivePointerGrab"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XChangeGC + *(void **) (&XChangeGC_dylibloader_wrapper_xlib) = dlsym(handle, "XChangeGC"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XChangeKeyboardControl + *(void **) (&XChangeKeyboardControl_dylibloader_wrapper_xlib) = dlsym(handle, "XChangeKeyboardControl"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XChangeKeyboardMapping + *(void **) (&XChangeKeyboardMapping_dylibloader_wrapper_xlib) = dlsym(handle, "XChangeKeyboardMapping"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XChangePointerControl + *(void **) (&XChangePointerControl_dylibloader_wrapper_xlib) = dlsym(handle, "XChangePointerControl"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XChangeProperty + *(void **) (&XChangeProperty_dylibloader_wrapper_xlib) = dlsym(handle, "XChangeProperty"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XChangeSaveSet + *(void **) (&XChangeSaveSet_dylibloader_wrapper_xlib) = dlsym(handle, "XChangeSaveSet"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XChangeWindowAttributes + *(void **) (&XChangeWindowAttributes_dylibloader_wrapper_xlib) = dlsym(handle, "XChangeWindowAttributes"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XCheckIfEvent + *(void **) (&XCheckIfEvent_dylibloader_wrapper_xlib) = dlsym(handle, "XCheckIfEvent"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XCheckMaskEvent + *(void **) (&XCheckMaskEvent_dylibloader_wrapper_xlib) = dlsym(handle, "XCheckMaskEvent"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XCheckTypedEvent + *(void **) (&XCheckTypedEvent_dylibloader_wrapper_xlib) = dlsym(handle, "XCheckTypedEvent"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XCheckTypedWindowEvent + *(void **) (&XCheckTypedWindowEvent_dylibloader_wrapper_xlib) = dlsym(handle, "XCheckTypedWindowEvent"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XCheckWindowEvent + *(void **) (&XCheckWindowEvent_dylibloader_wrapper_xlib) = dlsym(handle, "XCheckWindowEvent"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XCirculateSubwindows + *(void **) (&XCirculateSubwindows_dylibloader_wrapper_xlib) = dlsym(handle, "XCirculateSubwindows"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XCirculateSubwindowsDown + *(void **) (&XCirculateSubwindowsDown_dylibloader_wrapper_xlib) = dlsym(handle, "XCirculateSubwindowsDown"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XCirculateSubwindowsUp + *(void **) (&XCirculateSubwindowsUp_dylibloader_wrapper_xlib) = dlsym(handle, "XCirculateSubwindowsUp"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XClearArea + *(void **) (&XClearArea_dylibloader_wrapper_xlib) = dlsym(handle, "XClearArea"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XClearWindow + *(void **) (&XClearWindow_dylibloader_wrapper_xlib) = dlsym(handle, "XClearWindow"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XCloseDisplay + *(void **) (&XCloseDisplay_dylibloader_wrapper_xlib) = dlsym(handle, "XCloseDisplay"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XConfigureWindow + *(void **) (&XConfigureWindow_dylibloader_wrapper_xlib) = dlsym(handle, "XConfigureWindow"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XConnectionNumber + *(void **) (&XConnectionNumber_dylibloader_wrapper_xlib) = dlsym(handle, "XConnectionNumber"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XConvertSelection + *(void **) (&XConvertSelection_dylibloader_wrapper_xlib) = dlsym(handle, "XConvertSelection"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XCopyArea + *(void **) (&XCopyArea_dylibloader_wrapper_xlib) = dlsym(handle, "XCopyArea"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XCopyGC + *(void **) (&XCopyGC_dylibloader_wrapper_xlib) = dlsym(handle, "XCopyGC"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XCopyPlane + *(void **) (&XCopyPlane_dylibloader_wrapper_xlib) = dlsym(handle, "XCopyPlane"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XDefaultDepth + *(void **) (&XDefaultDepth_dylibloader_wrapper_xlib) = dlsym(handle, "XDefaultDepth"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XDefaultDepthOfScreen + *(void **) (&XDefaultDepthOfScreen_dylibloader_wrapper_xlib) = dlsym(handle, "XDefaultDepthOfScreen"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XDefaultScreen + *(void **) (&XDefaultScreen_dylibloader_wrapper_xlib) = dlsym(handle, "XDefaultScreen"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XDefineCursor + *(void **) (&XDefineCursor_dylibloader_wrapper_xlib) = dlsym(handle, "XDefineCursor"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XDeleteProperty + *(void **) (&XDeleteProperty_dylibloader_wrapper_xlib) = dlsym(handle, "XDeleteProperty"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XDestroyWindow + *(void **) (&XDestroyWindow_dylibloader_wrapper_xlib) = dlsym(handle, "XDestroyWindow"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XDestroySubwindows + *(void **) (&XDestroySubwindows_dylibloader_wrapper_xlib) = dlsym(handle, "XDestroySubwindows"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XDoesBackingStore + *(void **) (&XDoesBackingStore_dylibloader_wrapper_xlib) = dlsym(handle, "XDoesBackingStore"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XDoesSaveUnders + *(void **) (&XDoesSaveUnders_dylibloader_wrapper_xlib) = dlsym(handle, "XDoesSaveUnders"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XDisableAccessControl + *(void **) (&XDisableAccessControl_dylibloader_wrapper_xlib) = dlsym(handle, "XDisableAccessControl"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XDisplayCells + *(void **) (&XDisplayCells_dylibloader_wrapper_xlib) = dlsym(handle, "XDisplayCells"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XDisplayHeight + *(void **) (&XDisplayHeight_dylibloader_wrapper_xlib) = dlsym(handle, "XDisplayHeight"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XDisplayHeightMM + *(void **) (&XDisplayHeightMM_dylibloader_wrapper_xlib) = dlsym(handle, "XDisplayHeightMM"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XDisplayKeycodes + *(void **) (&XDisplayKeycodes_dylibloader_wrapper_xlib) = dlsym(handle, "XDisplayKeycodes"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XDisplayPlanes + *(void **) (&XDisplayPlanes_dylibloader_wrapper_xlib) = dlsym(handle, "XDisplayPlanes"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XDisplayWidth + *(void **) (&XDisplayWidth_dylibloader_wrapper_xlib) = dlsym(handle, "XDisplayWidth"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XDisplayWidthMM + *(void **) (&XDisplayWidthMM_dylibloader_wrapper_xlib) = dlsym(handle, "XDisplayWidthMM"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XDrawArc + *(void **) (&XDrawArc_dylibloader_wrapper_xlib) = dlsym(handle, "XDrawArc"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XDrawArcs + *(void **) (&XDrawArcs_dylibloader_wrapper_xlib) = dlsym(handle, "XDrawArcs"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XDrawImageString + *(void **) (&XDrawImageString_dylibloader_wrapper_xlib) = dlsym(handle, "XDrawImageString"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XDrawImageString16 + *(void **) (&XDrawImageString16_dylibloader_wrapper_xlib) = dlsym(handle, "XDrawImageString16"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XDrawLine + *(void **) (&XDrawLine_dylibloader_wrapper_xlib) = dlsym(handle, "XDrawLine"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XDrawLines + *(void **) (&XDrawLines_dylibloader_wrapper_xlib) = dlsym(handle, "XDrawLines"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XDrawPoint + *(void **) (&XDrawPoint_dylibloader_wrapper_xlib) = dlsym(handle, "XDrawPoint"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XDrawPoints + *(void **) (&XDrawPoints_dylibloader_wrapper_xlib) = dlsym(handle, "XDrawPoints"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XDrawRectangle + *(void **) (&XDrawRectangle_dylibloader_wrapper_xlib) = dlsym(handle, "XDrawRectangle"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XDrawRectangles + *(void **) (&XDrawRectangles_dylibloader_wrapper_xlib) = dlsym(handle, "XDrawRectangles"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XDrawSegments + *(void **) (&XDrawSegments_dylibloader_wrapper_xlib) = dlsym(handle, "XDrawSegments"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XDrawString + *(void **) (&XDrawString_dylibloader_wrapper_xlib) = dlsym(handle, "XDrawString"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XDrawString16 + *(void **) (&XDrawString16_dylibloader_wrapper_xlib) = dlsym(handle, "XDrawString16"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XDrawText + *(void **) (&XDrawText_dylibloader_wrapper_xlib) = dlsym(handle, "XDrawText"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XDrawText16 + *(void **) (&XDrawText16_dylibloader_wrapper_xlib) = dlsym(handle, "XDrawText16"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XEnableAccessControl + *(void **) (&XEnableAccessControl_dylibloader_wrapper_xlib) = dlsym(handle, "XEnableAccessControl"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XEventsQueued + *(void **) (&XEventsQueued_dylibloader_wrapper_xlib) = dlsym(handle, "XEventsQueued"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XFetchName + *(void **) (&XFetchName_dylibloader_wrapper_xlib) = dlsym(handle, "XFetchName"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XFillArc + *(void **) (&XFillArc_dylibloader_wrapper_xlib) = dlsym(handle, "XFillArc"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XFillArcs + *(void **) (&XFillArcs_dylibloader_wrapper_xlib) = dlsym(handle, "XFillArcs"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XFillPolygon + *(void **) (&XFillPolygon_dylibloader_wrapper_xlib) = dlsym(handle, "XFillPolygon"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XFillRectangle + *(void **) (&XFillRectangle_dylibloader_wrapper_xlib) = dlsym(handle, "XFillRectangle"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XFillRectangles + *(void **) (&XFillRectangles_dylibloader_wrapper_xlib) = dlsym(handle, "XFillRectangles"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XFlush + *(void **) (&XFlush_dylibloader_wrapper_xlib) = dlsym(handle, "XFlush"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XForceScreenSaver + *(void **) (&XForceScreenSaver_dylibloader_wrapper_xlib) = dlsym(handle, "XForceScreenSaver"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XFree + *(void **) (&XFree_dylibloader_wrapper_xlib) = dlsym(handle, "XFree"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XFreeColormap + *(void **) (&XFreeColormap_dylibloader_wrapper_xlib) = dlsym(handle, "XFreeColormap"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XFreeColors + *(void **) (&XFreeColors_dylibloader_wrapper_xlib) = dlsym(handle, "XFreeColors"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XFreeCursor + *(void **) (&XFreeCursor_dylibloader_wrapper_xlib) = dlsym(handle, "XFreeCursor"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XFreeExtensionList + *(void **) (&XFreeExtensionList_dylibloader_wrapper_xlib) = dlsym(handle, "XFreeExtensionList"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XFreeFont + *(void **) (&XFreeFont_dylibloader_wrapper_xlib) = dlsym(handle, "XFreeFont"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XFreeFontInfo + *(void **) (&XFreeFontInfo_dylibloader_wrapper_xlib) = dlsym(handle, "XFreeFontInfo"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XFreeFontNames + *(void **) (&XFreeFontNames_dylibloader_wrapper_xlib) = dlsym(handle, "XFreeFontNames"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XFreeFontPath + *(void **) (&XFreeFontPath_dylibloader_wrapper_xlib) = dlsym(handle, "XFreeFontPath"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XFreeGC + *(void **) (&XFreeGC_dylibloader_wrapper_xlib) = dlsym(handle, "XFreeGC"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XFreeModifiermap + *(void **) (&XFreeModifiermap_dylibloader_wrapper_xlib) = dlsym(handle, "XFreeModifiermap"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XFreePixmap + *(void **) (&XFreePixmap_dylibloader_wrapper_xlib) = dlsym(handle, "XFreePixmap"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XGeometry + *(void **) (&XGeometry_dylibloader_wrapper_xlib) = dlsym(handle, "XGeometry"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XGetErrorDatabaseText + *(void **) (&XGetErrorDatabaseText_dylibloader_wrapper_xlib) = dlsym(handle, "XGetErrorDatabaseText"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XGetErrorText + *(void **) (&XGetErrorText_dylibloader_wrapper_xlib) = dlsym(handle, "XGetErrorText"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XGetFontProperty + *(void **) (&XGetFontProperty_dylibloader_wrapper_xlib) = dlsym(handle, "XGetFontProperty"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XGetGCValues + *(void **) (&XGetGCValues_dylibloader_wrapper_xlib) = dlsym(handle, "XGetGCValues"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XGetGeometry + *(void **) (&XGetGeometry_dylibloader_wrapper_xlib) = dlsym(handle, "XGetGeometry"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XGetIconName + *(void **) (&XGetIconName_dylibloader_wrapper_xlib) = dlsym(handle, "XGetIconName"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XGetInputFocus + *(void **) (&XGetInputFocus_dylibloader_wrapper_xlib) = dlsym(handle, "XGetInputFocus"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XGetKeyboardControl + *(void **) (&XGetKeyboardControl_dylibloader_wrapper_xlib) = dlsym(handle, "XGetKeyboardControl"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XGetPointerControl + *(void **) (&XGetPointerControl_dylibloader_wrapper_xlib) = dlsym(handle, "XGetPointerControl"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XGetPointerMapping + *(void **) (&XGetPointerMapping_dylibloader_wrapper_xlib) = dlsym(handle, "XGetPointerMapping"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XGetScreenSaver + *(void **) (&XGetScreenSaver_dylibloader_wrapper_xlib) = dlsym(handle, "XGetScreenSaver"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XGetTransientForHint + *(void **) (&XGetTransientForHint_dylibloader_wrapper_xlib) = dlsym(handle, "XGetTransientForHint"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XGetWindowProperty + *(void **) (&XGetWindowProperty_dylibloader_wrapper_xlib) = dlsym(handle, "XGetWindowProperty"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XGetWindowAttributes + *(void **) (&XGetWindowAttributes_dylibloader_wrapper_xlib) = dlsym(handle, "XGetWindowAttributes"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XGrabButton + *(void **) (&XGrabButton_dylibloader_wrapper_xlib) = dlsym(handle, "XGrabButton"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XGrabKey + *(void **) (&XGrabKey_dylibloader_wrapper_xlib) = dlsym(handle, "XGrabKey"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XGrabKeyboard + *(void **) (&XGrabKeyboard_dylibloader_wrapper_xlib) = dlsym(handle, "XGrabKeyboard"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XGrabPointer + *(void **) (&XGrabPointer_dylibloader_wrapper_xlib) = dlsym(handle, "XGrabPointer"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XGrabServer + *(void **) (&XGrabServer_dylibloader_wrapper_xlib) = dlsym(handle, "XGrabServer"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XHeightMMOfScreen + *(void **) (&XHeightMMOfScreen_dylibloader_wrapper_xlib) = dlsym(handle, "XHeightMMOfScreen"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XHeightOfScreen + *(void **) (&XHeightOfScreen_dylibloader_wrapper_xlib) = dlsym(handle, "XHeightOfScreen"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XIfEvent + *(void **) (&XIfEvent_dylibloader_wrapper_xlib) = dlsym(handle, "XIfEvent"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XImageByteOrder + *(void **) (&XImageByteOrder_dylibloader_wrapper_xlib) = dlsym(handle, "XImageByteOrder"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XInstallColormap + *(void **) (&XInstallColormap_dylibloader_wrapper_xlib) = dlsym(handle, "XInstallColormap"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XKeysymToKeycode + *(void **) (&XKeysymToKeycode_dylibloader_wrapper_xlib) = dlsym(handle, "XKeysymToKeycode"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XKillClient + *(void **) (&XKillClient_dylibloader_wrapper_xlib) = dlsym(handle, "XKillClient"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XLookupColor + *(void **) (&XLookupColor_dylibloader_wrapper_xlib) = dlsym(handle, "XLookupColor"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XLowerWindow + *(void **) (&XLowerWindow_dylibloader_wrapper_xlib) = dlsym(handle, "XLowerWindow"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XMapRaised + *(void **) (&XMapRaised_dylibloader_wrapper_xlib) = dlsym(handle, "XMapRaised"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XMapSubwindows + *(void **) (&XMapSubwindows_dylibloader_wrapper_xlib) = dlsym(handle, "XMapSubwindows"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XMapWindow + *(void **) (&XMapWindow_dylibloader_wrapper_xlib) = dlsym(handle, "XMapWindow"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XMaskEvent + *(void **) (&XMaskEvent_dylibloader_wrapper_xlib) = dlsym(handle, "XMaskEvent"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XMaxCmapsOfScreen + *(void **) (&XMaxCmapsOfScreen_dylibloader_wrapper_xlib) = dlsym(handle, "XMaxCmapsOfScreen"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XMinCmapsOfScreen + *(void **) (&XMinCmapsOfScreen_dylibloader_wrapper_xlib) = dlsym(handle, "XMinCmapsOfScreen"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XMoveResizeWindow + *(void **) (&XMoveResizeWindow_dylibloader_wrapper_xlib) = dlsym(handle, "XMoveResizeWindow"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XMoveWindow + *(void **) (&XMoveWindow_dylibloader_wrapper_xlib) = dlsym(handle, "XMoveWindow"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XNextEvent + *(void **) (&XNextEvent_dylibloader_wrapper_xlib) = dlsym(handle, "XNextEvent"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XNoOp + *(void **) (&XNoOp_dylibloader_wrapper_xlib) = dlsym(handle, "XNoOp"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XParseColor + *(void **) (&XParseColor_dylibloader_wrapper_xlib) = dlsym(handle, "XParseColor"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XParseGeometry + *(void **) (&XParseGeometry_dylibloader_wrapper_xlib) = dlsym(handle, "XParseGeometry"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XPeekEvent + *(void **) (&XPeekEvent_dylibloader_wrapper_xlib) = dlsym(handle, "XPeekEvent"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XPeekIfEvent + *(void **) (&XPeekIfEvent_dylibloader_wrapper_xlib) = dlsym(handle, "XPeekIfEvent"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XPending + *(void **) (&XPending_dylibloader_wrapper_xlib) = dlsym(handle, "XPending"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XPlanesOfScreen + *(void **) (&XPlanesOfScreen_dylibloader_wrapper_xlib) = dlsym(handle, "XPlanesOfScreen"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XProtocolRevision + *(void **) (&XProtocolRevision_dylibloader_wrapper_xlib) = dlsym(handle, "XProtocolRevision"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XProtocolVersion + *(void **) (&XProtocolVersion_dylibloader_wrapper_xlib) = dlsym(handle, "XProtocolVersion"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XPutBackEvent + *(void **) (&XPutBackEvent_dylibloader_wrapper_xlib) = dlsym(handle, "XPutBackEvent"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XPutImage + *(void **) (&XPutImage_dylibloader_wrapper_xlib) = dlsym(handle, "XPutImage"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XQLength + *(void **) (&XQLength_dylibloader_wrapper_xlib) = dlsym(handle, "XQLength"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XQueryBestCursor + *(void **) (&XQueryBestCursor_dylibloader_wrapper_xlib) = dlsym(handle, "XQueryBestCursor"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XQueryBestSize + *(void **) (&XQueryBestSize_dylibloader_wrapper_xlib) = dlsym(handle, "XQueryBestSize"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XQueryBestStipple + *(void **) (&XQueryBestStipple_dylibloader_wrapper_xlib) = dlsym(handle, "XQueryBestStipple"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XQueryBestTile + *(void **) (&XQueryBestTile_dylibloader_wrapper_xlib) = dlsym(handle, "XQueryBestTile"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XQueryColor + *(void **) (&XQueryColor_dylibloader_wrapper_xlib) = dlsym(handle, "XQueryColor"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XQueryColors + *(void **) (&XQueryColors_dylibloader_wrapper_xlib) = dlsym(handle, "XQueryColors"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XQueryExtension + *(void **) (&XQueryExtension_dylibloader_wrapper_xlib) = dlsym(handle, "XQueryExtension"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XQueryKeymap + *(void **) (&XQueryKeymap_dylibloader_wrapper_xlib) = dlsym(handle, "XQueryKeymap"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XQueryPointer + *(void **) (&XQueryPointer_dylibloader_wrapper_xlib) = dlsym(handle, "XQueryPointer"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XQueryTextExtents + *(void **) (&XQueryTextExtents_dylibloader_wrapper_xlib) = dlsym(handle, "XQueryTextExtents"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XQueryTextExtents16 + *(void **) (&XQueryTextExtents16_dylibloader_wrapper_xlib) = dlsym(handle, "XQueryTextExtents16"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XQueryTree + *(void **) (&XQueryTree_dylibloader_wrapper_xlib) = dlsym(handle, "XQueryTree"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XRaiseWindow + *(void **) (&XRaiseWindow_dylibloader_wrapper_xlib) = dlsym(handle, "XRaiseWindow"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XReadBitmapFile + *(void **) (&XReadBitmapFile_dylibloader_wrapper_xlib) = dlsym(handle, "XReadBitmapFile"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XReadBitmapFileData + *(void **) (&XReadBitmapFileData_dylibloader_wrapper_xlib) = dlsym(handle, "XReadBitmapFileData"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XRebindKeysym + *(void **) (&XRebindKeysym_dylibloader_wrapper_xlib) = dlsym(handle, "XRebindKeysym"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XRecolorCursor + *(void **) (&XRecolorCursor_dylibloader_wrapper_xlib) = dlsym(handle, "XRecolorCursor"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XRefreshKeyboardMapping + *(void **) (&XRefreshKeyboardMapping_dylibloader_wrapper_xlib) = dlsym(handle, "XRefreshKeyboardMapping"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XRemoveFromSaveSet + *(void **) (&XRemoveFromSaveSet_dylibloader_wrapper_xlib) = dlsym(handle, "XRemoveFromSaveSet"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XRemoveHost + *(void **) (&XRemoveHost_dylibloader_wrapper_xlib) = dlsym(handle, "XRemoveHost"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XRemoveHosts + *(void **) (&XRemoveHosts_dylibloader_wrapper_xlib) = dlsym(handle, "XRemoveHosts"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XReparentWindow + *(void **) (&XReparentWindow_dylibloader_wrapper_xlib) = dlsym(handle, "XReparentWindow"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XResetScreenSaver + *(void **) (&XResetScreenSaver_dylibloader_wrapper_xlib) = dlsym(handle, "XResetScreenSaver"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XResizeWindow + *(void **) (&XResizeWindow_dylibloader_wrapper_xlib) = dlsym(handle, "XResizeWindow"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XRestackWindows + *(void **) (&XRestackWindows_dylibloader_wrapper_xlib) = dlsym(handle, "XRestackWindows"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XRotateBuffers + *(void **) (&XRotateBuffers_dylibloader_wrapper_xlib) = dlsym(handle, "XRotateBuffers"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XRotateWindowProperties + *(void **) (&XRotateWindowProperties_dylibloader_wrapper_xlib) = dlsym(handle, "XRotateWindowProperties"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XScreenCount + *(void **) (&XScreenCount_dylibloader_wrapper_xlib) = dlsym(handle, "XScreenCount"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XSelectInput + *(void **) (&XSelectInput_dylibloader_wrapper_xlib) = dlsym(handle, "XSelectInput"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XSendEvent + *(void **) (&XSendEvent_dylibloader_wrapper_xlib) = dlsym(handle, "XSendEvent"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XSetAccessControl + *(void **) (&XSetAccessControl_dylibloader_wrapper_xlib) = dlsym(handle, "XSetAccessControl"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XSetArcMode + *(void **) (&XSetArcMode_dylibloader_wrapper_xlib) = dlsym(handle, "XSetArcMode"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XSetBackground + *(void **) (&XSetBackground_dylibloader_wrapper_xlib) = dlsym(handle, "XSetBackground"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XSetClipMask + *(void **) (&XSetClipMask_dylibloader_wrapper_xlib) = dlsym(handle, "XSetClipMask"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XSetClipOrigin + *(void **) (&XSetClipOrigin_dylibloader_wrapper_xlib) = dlsym(handle, "XSetClipOrigin"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XSetClipRectangles + *(void **) (&XSetClipRectangles_dylibloader_wrapper_xlib) = dlsym(handle, "XSetClipRectangles"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XSetCloseDownMode + *(void **) (&XSetCloseDownMode_dylibloader_wrapper_xlib) = dlsym(handle, "XSetCloseDownMode"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XSetCommand + *(void **) (&XSetCommand_dylibloader_wrapper_xlib) = dlsym(handle, "XSetCommand"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XSetDashes + *(void **) (&XSetDashes_dylibloader_wrapper_xlib) = dlsym(handle, "XSetDashes"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XSetFillRule + *(void **) (&XSetFillRule_dylibloader_wrapper_xlib) = dlsym(handle, "XSetFillRule"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XSetFillStyle + *(void **) (&XSetFillStyle_dylibloader_wrapper_xlib) = dlsym(handle, "XSetFillStyle"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XSetFont + *(void **) (&XSetFont_dylibloader_wrapper_xlib) = dlsym(handle, "XSetFont"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XSetFontPath + *(void **) (&XSetFontPath_dylibloader_wrapper_xlib) = dlsym(handle, "XSetFontPath"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XSetForeground + *(void **) (&XSetForeground_dylibloader_wrapper_xlib) = dlsym(handle, "XSetForeground"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XSetFunction + *(void **) (&XSetFunction_dylibloader_wrapper_xlib) = dlsym(handle, "XSetFunction"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XSetGraphicsExposures + *(void **) (&XSetGraphicsExposures_dylibloader_wrapper_xlib) = dlsym(handle, "XSetGraphicsExposures"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XSetIconName + *(void **) (&XSetIconName_dylibloader_wrapper_xlib) = dlsym(handle, "XSetIconName"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XSetInputFocus + *(void **) (&XSetInputFocus_dylibloader_wrapper_xlib) = dlsym(handle, "XSetInputFocus"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XSetLineAttributes + *(void **) (&XSetLineAttributes_dylibloader_wrapper_xlib) = dlsym(handle, "XSetLineAttributes"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XSetModifierMapping + *(void **) (&XSetModifierMapping_dylibloader_wrapper_xlib) = dlsym(handle, "XSetModifierMapping"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XSetPlaneMask + *(void **) (&XSetPlaneMask_dylibloader_wrapper_xlib) = dlsym(handle, "XSetPlaneMask"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XSetPointerMapping + *(void **) (&XSetPointerMapping_dylibloader_wrapper_xlib) = dlsym(handle, "XSetPointerMapping"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XSetScreenSaver + *(void **) (&XSetScreenSaver_dylibloader_wrapper_xlib) = dlsym(handle, "XSetScreenSaver"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XSetSelectionOwner + *(void **) (&XSetSelectionOwner_dylibloader_wrapper_xlib) = dlsym(handle, "XSetSelectionOwner"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XSetState + *(void **) (&XSetState_dylibloader_wrapper_xlib) = dlsym(handle, "XSetState"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XSetStipple + *(void **) (&XSetStipple_dylibloader_wrapper_xlib) = dlsym(handle, "XSetStipple"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XSetSubwindowMode + *(void **) (&XSetSubwindowMode_dylibloader_wrapper_xlib) = dlsym(handle, "XSetSubwindowMode"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XSetTSOrigin + *(void **) (&XSetTSOrigin_dylibloader_wrapper_xlib) = dlsym(handle, "XSetTSOrigin"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XSetTile + *(void **) (&XSetTile_dylibloader_wrapper_xlib) = dlsym(handle, "XSetTile"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XSetWindowBackground + *(void **) (&XSetWindowBackground_dylibloader_wrapper_xlib) = dlsym(handle, "XSetWindowBackground"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XSetWindowBackgroundPixmap + *(void **) (&XSetWindowBackgroundPixmap_dylibloader_wrapper_xlib) = dlsym(handle, "XSetWindowBackgroundPixmap"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XSetWindowBorder + *(void **) (&XSetWindowBorder_dylibloader_wrapper_xlib) = dlsym(handle, "XSetWindowBorder"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XSetWindowBorderPixmap + *(void **) (&XSetWindowBorderPixmap_dylibloader_wrapper_xlib) = dlsym(handle, "XSetWindowBorderPixmap"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XSetWindowBorderWidth + *(void **) (&XSetWindowBorderWidth_dylibloader_wrapper_xlib) = dlsym(handle, "XSetWindowBorderWidth"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XSetWindowColormap + *(void **) (&XSetWindowColormap_dylibloader_wrapper_xlib) = dlsym(handle, "XSetWindowColormap"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XStoreBuffer + *(void **) (&XStoreBuffer_dylibloader_wrapper_xlib) = dlsym(handle, "XStoreBuffer"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XStoreBytes + *(void **) (&XStoreBytes_dylibloader_wrapper_xlib) = dlsym(handle, "XStoreBytes"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XStoreColor + *(void **) (&XStoreColor_dylibloader_wrapper_xlib) = dlsym(handle, "XStoreColor"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XStoreColors + *(void **) (&XStoreColors_dylibloader_wrapper_xlib) = dlsym(handle, "XStoreColors"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XStoreName + *(void **) (&XStoreName_dylibloader_wrapper_xlib) = dlsym(handle, "XStoreName"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XStoreNamedColor + *(void **) (&XStoreNamedColor_dylibloader_wrapper_xlib) = dlsym(handle, "XStoreNamedColor"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XSync + *(void **) (&XSync_dylibloader_wrapper_xlib) = dlsym(handle, "XSync"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XTextExtents + *(void **) (&XTextExtents_dylibloader_wrapper_xlib) = dlsym(handle, "XTextExtents"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XTextExtents16 + *(void **) (&XTextExtents16_dylibloader_wrapper_xlib) = dlsym(handle, "XTextExtents16"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XTextWidth + *(void **) (&XTextWidth_dylibloader_wrapper_xlib) = dlsym(handle, "XTextWidth"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XTextWidth16 + *(void **) (&XTextWidth16_dylibloader_wrapper_xlib) = dlsym(handle, "XTextWidth16"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XTranslateCoordinates + *(void **) (&XTranslateCoordinates_dylibloader_wrapper_xlib) = dlsym(handle, "XTranslateCoordinates"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XUndefineCursor + *(void **) (&XUndefineCursor_dylibloader_wrapper_xlib) = dlsym(handle, "XUndefineCursor"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XUngrabButton + *(void **) (&XUngrabButton_dylibloader_wrapper_xlib) = dlsym(handle, "XUngrabButton"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XUngrabKey + *(void **) (&XUngrabKey_dylibloader_wrapper_xlib) = dlsym(handle, "XUngrabKey"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XUngrabKeyboard + *(void **) (&XUngrabKeyboard_dylibloader_wrapper_xlib) = dlsym(handle, "XUngrabKeyboard"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XUngrabPointer + *(void **) (&XUngrabPointer_dylibloader_wrapper_xlib) = dlsym(handle, "XUngrabPointer"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XUngrabServer + *(void **) (&XUngrabServer_dylibloader_wrapper_xlib) = dlsym(handle, "XUngrabServer"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XUninstallColormap + *(void **) (&XUninstallColormap_dylibloader_wrapper_xlib) = dlsym(handle, "XUninstallColormap"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XUnloadFont + *(void **) (&XUnloadFont_dylibloader_wrapper_xlib) = dlsym(handle, "XUnloadFont"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XUnmapSubwindows + *(void **) (&XUnmapSubwindows_dylibloader_wrapper_xlib) = dlsym(handle, "XUnmapSubwindows"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XUnmapWindow + *(void **) (&XUnmapWindow_dylibloader_wrapper_xlib) = dlsym(handle, "XUnmapWindow"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XVendorRelease + *(void **) (&XVendorRelease_dylibloader_wrapper_xlib) = dlsym(handle, "XVendorRelease"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XWarpPointer + *(void **) (&XWarpPointer_dylibloader_wrapper_xlib) = dlsym(handle, "XWarpPointer"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XWidthMMOfScreen + *(void **) (&XWidthMMOfScreen_dylibloader_wrapper_xlib) = dlsym(handle, "XWidthMMOfScreen"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XWidthOfScreen + *(void **) (&XWidthOfScreen_dylibloader_wrapper_xlib) = dlsym(handle, "XWidthOfScreen"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XWindowEvent + *(void **) (&XWindowEvent_dylibloader_wrapper_xlib) = dlsym(handle, "XWindowEvent"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XWriteBitmapFile + *(void **) (&XWriteBitmapFile_dylibloader_wrapper_xlib) = dlsym(handle, "XWriteBitmapFile"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XSupportsLocale + *(void **) (&XSupportsLocale_dylibloader_wrapper_xlib) = dlsym(handle, "XSupportsLocale"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XSetLocaleModifiers + *(void **) (&XSetLocaleModifiers_dylibloader_wrapper_xlib) = dlsym(handle, "XSetLocaleModifiers"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XOpenOM + *(void **) (&XOpenOM_dylibloader_wrapper_xlib) = dlsym(handle, "XOpenOM"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XCloseOM + *(void **) (&XCloseOM_dylibloader_wrapper_xlib) = dlsym(handle, "XCloseOM"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XSetOMValues + *(void **) (&XSetOMValues_dylibloader_wrapper_xlib) = dlsym(handle, "XSetOMValues"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XGetOMValues + *(void **) (&XGetOMValues_dylibloader_wrapper_xlib) = dlsym(handle, "XGetOMValues"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XDisplayOfOM + *(void **) (&XDisplayOfOM_dylibloader_wrapper_xlib) = dlsym(handle, "XDisplayOfOM"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XLocaleOfOM + *(void **) (&XLocaleOfOM_dylibloader_wrapper_xlib) = dlsym(handle, "XLocaleOfOM"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XCreateOC + *(void **) (&XCreateOC_dylibloader_wrapper_xlib) = dlsym(handle, "XCreateOC"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XDestroyOC + *(void **) (&XDestroyOC_dylibloader_wrapper_xlib) = dlsym(handle, "XDestroyOC"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XOMOfOC + *(void **) (&XOMOfOC_dylibloader_wrapper_xlib) = dlsym(handle, "XOMOfOC"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XSetOCValues + *(void **) (&XSetOCValues_dylibloader_wrapper_xlib) = dlsym(handle, "XSetOCValues"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XGetOCValues + *(void **) (&XGetOCValues_dylibloader_wrapper_xlib) = dlsym(handle, "XGetOCValues"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XCreateFontSet + *(void **) (&XCreateFontSet_dylibloader_wrapper_xlib) = dlsym(handle, "XCreateFontSet"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XFreeFontSet + *(void **) (&XFreeFontSet_dylibloader_wrapper_xlib) = dlsym(handle, "XFreeFontSet"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XFontsOfFontSet + *(void **) (&XFontsOfFontSet_dylibloader_wrapper_xlib) = dlsym(handle, "XFontsOfFontSet"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XBaseFontNameListOfFontSet + *(void **) (&XBaseFontNameListOfFontSet_dylibloader_wrapper_xlib) = dlsym(handle, "XBaseFontNameListOfFontSet"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XLocaleOfFontSet + *(void **) (&XLocaleOfFontSet_dylibloader_wrapper_xlib) = dlsym(handle, "XLocaleOfFontSet"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XContextDependentDrawing + *(void **) (&XContextDependentDrawing_dylibloader_wrapper_xlib) = dlsym(handle, "XContextDependentDrawing"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XDirectionalDependentDrawing + *(void **) (&XDirectionalDependentDrawing_dylibloader_wrapper_xlib) = dlsym(handle, "XDirectionalDependentDrawing"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XContextualDrawing + *(void **) (&XContextualDrawing_dylibloader_wrapper_xlib) = dlsym(handle, "XContextualDrawing"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XExtentsOfFontSet + *(void **) (&XExtentsOfFontSet_dylibloader_wrapper_xlib) = dlsym(handle, "XExtentsOfFontSet"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XmbTextEscapement + *(void **) (&XmbTextEscapement_dylibloader_wrapper_xlib) = dlsym(handle, "XmbTextEscapement"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XwcTextEscapement + *(void **) (&XwcTextEscapement_dylibloader_wrapper_xlib) = dlsym(handle, "XwcTextEscapement"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// Xutf8TextEscapement + *(void **) (&Xutf8TextEscapement_dylibloader_wrapper_xlib) = dlsym(handle, "Xutf8TextEscapement"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XmbTextExtents + *(void **) (&XmbTextExtents_dylibloader_wrapper_xlib) = dlsym(handle, "XmbTextExtents"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XwcTextExtents + *(void **) (&XwcTextExtents_dylibloader_wrapper_xlib) = dlsym(handle, "XwcTextExtents"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// Xutf8TextExtents + *(void **) (&Xutf8TextExtents_dylibloader_wrapper_xlib) = dlsym(handle, "Xutf8TextExtents"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XmbTextPerCharExtents + *(void **) (&XmbTextPerCharExtents_dylibloader_wrapper_xlib) = dlsym(handle, "XmbTextPerCharExtents"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XwcTextPerCharExtents + *(void **) (&XwcTextPerCharExtents_dylibloader_wrapper_xlib) = dlsym(handle, "XwcTextPerCharExtents"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// Xutf8TextPerCharExtents + *(void **) (&Xutf8TextPerCharExtents_dylibloader_wrapper_xlib) = dlsym(handle, "Xutf8TextPerCharExtents"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XmbDrawText + *(void **) (&XmbDrawText_dylibloader_wrapper_xlib) = dlsym(handle, "XmbDrawText"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XwcDrawText + *(void **) (&XwcDrawText_dylibloader_wrapper_xlib) = dlsym(handle, "XwcDrawText"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// Xutf8DrawText + *(void **) (&Xutf8DrawText_dylibloader_wrapper_xlib) = dlsym(handle, "Xutf8DrawText"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XmbDrawString + *(void **) (&XmbDrawString_dylibloader_wrapper_xlib) = dlsym(handle, "XmbDrawString"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XwcDrawString + *(void **) (&XwcDrawString_dylibloader_wrapper_xlib) = dlsym(handle, "XwcDrawString"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// Xutf8DrawString + *(void **) (&Xutf8DrawString_dylibloader_wrapper_xlib) = dlsym(handle, "Xutf8DrawString"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XmbDrawImageString + *(void **) (&XmbDrawImageString_dylibloader_wrapper_xlib) = dlsym(handle, "XmbDrawImageString"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XwcDrawImageString + *(void **) (&XwcDrawImageString_dylibloader_wrapper_xlib) = dlsym(handle, "XwcDrawImageString"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// Xutf8DrawImageString + *(void **) (&Xutf8DrawImageString_dylibloader_wrapper_xlib) = dlsym(handle, "Xutf8DrawImageString"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XOpenIM + *(void **) (&XOpenIM_dylibloader_wrapper_xlib) = dlsym(handle, "XOpenIM"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XCloseIM + *(void **) (&XCloseIM_dylibloader_wrapper_xlib) = dlsym(handle, "XCloseIM"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XGetIMValues + *(void **) (&XGetIMValues_dylibloader_wrapper_xlib) = dlsym(handle, "XGetIMValues"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XSetIMValues + *(void **) (&XSetIMValues_dylibloader_wrapper_xlib) = dlsym(handle, "XSetIMValues"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XDisplayOfIM + *(void **) (&XDisplayOfIM_dylibloader_wrapper_xlib) = dlsym(handle, "XDisplayOfIM"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XLocaleOfIM + *(void **) (&XLocaleOfIM_dylibloader_wrapper_xlib) = dlsym(handle, "XLocaleOfIM"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XCreateIC + *(void **) (&XCreateIC_dylibloader_wrapper_xlib) = dlsym(handle, "XCreateIC"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XDestroyIC + *(void **) (&XDestroyIC_dylibloader_wrapper_xlib) = dlsym(handle, "XDestroyIC"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XSetICFocus + *(void **) (&XSetICFocus_dylibloader_wrapper_xlib) = dlsym(handle, "XSetICFocus"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XUnsetICFocus + *(void **) (&XUnsetICFocus_dylibloader_wrapper_xlib) = dlsym(handle, "XUnsetICFocus"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XwcResetIC + *(void **) (&XwcResetIC_dylibloader_wrapper_xlib) = dlsym(handle, "XwcResetIC"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XmbResetIC + *(void **) (&XmbResetIC_dylibloader_wrapper_xlib) = dlsym(handle, "XmbResetIC"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// Xutf8ResetIC + *(void **) (&Xutf8ResetIC_dylibloader_wrapper_xlib) = dlsym(handle, "Xutf8ResetIC"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XSetICValues + *(void **) (&XSetICValues_dylibloader_wrapper_xlib) = dlsym(handle, "XSetICValues"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XGetICValues + *(void **) (&XGetICValues_dylibloader_wrapper_xlib) = dlsym(handle, "XGetICValues"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XIMOfIC + *(void **) (&XIMOfIC_dylibloader_wrapper_xlib) = dlsym(handle, "XIMOfIC"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XFilterEvent + *(void **) (&XFilterEvent_dylibloader_wrapper_xlib) = dlsym(handle, "XFilterEvent"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XmbLookupString + *(void **) (&XmbLookupString_dylibloader_wrapper_xlib) = dlsym(handle, "XmbLookupString"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XwcLookupString + *(void **) (&XwcLookupString_dylibloader_wrapper_xlib) = dlsym(handle, "XwcLookupString"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// Xutf8LookupString + *(void **) (&Xutf8LookupString_dylibloader_wrapper_xlib) = dlsym(handle, "Xutf8LookupString"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XVaCreateNestedList + *(void **) (&XVaCreateNestedList_dylibloader_wrapper_xlib) = dlsym(handle, "XVaCreateNestedList"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XRegisterIMInstantiateCallback + *(void **) (&XRegisterIMInstantiateCallback_dylibloader_wrapper_xlib) = dlsym(handle, "XRegisterIMInstantiateCallback"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XUnregisterIMInstantiateCallback + *(void **) (&XUnregisterIMInstantiateCallback_dylibloader_wrapper_xlib) = dlsym(handle, "XUnregisterIMInstantiateCallback"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XInternalConnectionNumbers + *(void **) (&XInternalConnectionNumbers_dylibloader_wrapper_xlib) = dlsym(handle, "XInternalConnectionNumbers"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XProcessInternalConnection + *(void **) (&XProcessInternalConnection_dylibloader_wrapper_xlib) = dlsym(handle, "XProcessInternalConnection"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XAddConnectionWatch + *(void **) (&XAddConnectionWatch_dylibloader_wrapper_xlib) = dlsym(handle, "XAddConnectionWatch"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XRemoveConnectionWatch + *(void **) (&XRemoveConnectionWatch_dylibloader_wrapper_xlib) = dlsym(handle, "XRemoveConnectionWatch"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XSetAuthorization + *(void **) (&XSetAuthorization_dylibloader_wrapper_xlib) = dlsym(handle, "XSetAuthorization"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// _Xmbtowc + *(void **) (&_Xmbtowc_dylibloader_wrapper_xlib) = dlsym(handle, "_Xmbtowc"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// _Xwctomb + *(void **) (&_Xwctomb_dylibloader_wrapper_xlib) = dlsym(handle, "_Xwctomb"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XGetEventData + *(void **) (&XGetEventData_dylibloader_wrapper_xlib) = dlsym(handle, "XGetEventData"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XFreeEventData + *(void **) (&XFreeEventData_dylibloader_wrapper_xlib) = dlsym(handle, "XFreeEventData"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XAllocClassHint + *(void **) (&XAllocClassHint_dylibloader_wrapper_xlib) = dlsym(handle, "XAllocClassHint"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XAllocIconSize + *(void **) (&XAllocIconSize_dylibloader_wrapper_xlib) = dlsym(handle, "XAllocIconSize"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XAllocSizeHints + *(void **) (&XAllocSizeHints_dylibloader_wrapper_xlib) = dlsym(handle, "XAllocSizeHints"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XAllocStandardColormap + *(void **) (&XAllocStandardColormap_dylibloader_wrapper_xlib) = dlsym(handle, "XAllocStandardColormap"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XAllocWMHints + *(void **) (&XAllocWMHints_dylibloader_wrapper_xlib) = dlsym(handle, "XAllocWMHints"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XClipBox + *(void **) (&XClipBox_dylibloader_wrapper_xlib) = dlsym(handle, "XClipBox"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XCreateRegion + *(void **) (&XCreateRegion_dylibloader_wrapper_xlib) = dlsym(handle, "XCreateRegion"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XDefaultString + *(void **) (&XDefaultString_dylibloader_wrapper_xlib) = dlsym(handle, "XDefaultString"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XDeleteContext + *(void **) (&XDeleteContext_dylibloader_wrapper_xlib) = dlsym(handle, "XDeleteContext"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XDestroyRegion + *(void **) (&XDestroyRegion_dylibloader_wrapper_xlib) = dlsym(handle, "XDestroyRegion"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XEmptyRegion + *(void **) (&XEmptyRegion_dylibloader_wrapper_xlib) = dlsym(handle, "XEmptyRegion"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XEqualRegion + *(void **) (&XEqualRegion_dylibloader_wrapper_xlib) = dlsym(handle, "XEqualRegion"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XFindContext + *(void **) (&XFindContext_dylibloader_wrapper_xlib) = dlsym(handle, "XFindContext"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XGetClassHint + *(void **) (&XGetClassHint_dylibloader_wrapper_xlib) = dlsym(handle, "XGetClassHint"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XGetIconSizes + *(void **) (&XGetIconSizes_dylibloader_wrapper_xlib) = dlsym(handle, "XGetIconSizes"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XGetNormalHints + *(void **) (&XGetNormalHints_dylibloader_wrapper_xlib) = dlsym(handle, "XGetNormalHints"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XGetRGBColormaps + *(void **) (&XGetRGBColormaps_dylibloader_wrapper_xlib) = dlsym(handle, "XGetRGBColormaps"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XGetSizeHints + *(void **) (&XGetSizeHints_dylibloader_wrapper_xlib) = dlsym(handle, "XGetSizeHints"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XGetStandardColormap + *(void **) (&XGetStandardColormap_dylibloader_wrapper_xlib) = dlsym(handle, "XGetStandardColormap"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XGetTextProperty + *(void **) (&XGetTextProperty_dylibloader_wrapper_xlib) = dlsym(handle, "XGetTextProperty"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XGetVisualInfo + *(void **) (&XGetVisualInfo_dylibloader_wrapper_xlib) = dlsym(handle, "XGetVisualInfo"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XGetWMClientMachine + *(void **) (&XGetWMClientMachine_dylibloader_wrapper_xlib) = dlsym(handle, "XGetWMClientMachine"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XGetWMHints + *(void **) (&XGetWMHints_dylibloader_wrapper_xlib) = dlsym(handle, "XGetWMHints"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XGetWMIconName + *(void **) (&XGetWMIconName_dylibloader_wrapper_xlib) = dlsym(handle, "XGetWMIconName"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XGetWMName + *(void **) (&XGetWMName_dylibloader_wrapper_xlib) = dlsym(handle, "XGetWMName"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XGetWMNormalHints + *(void **) (&XGetWMNormalHints_dylibloader_wrapper_xlib) = dlsym(handle, "XGetWMNormalHints"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XGetWMSizeHints + *(void **) (&XGetWMSizeHints_dylibloader_wrapper_xlib) = dlsym(handle, "XGetWMSizeHints"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XGetZoomHints + *(void **) (&XGetZoomHints_dylibloader_wrapper_xlib) = dlsym(handle, "XGetZoomHints"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XIntersectRegion + *(void **) (&XIntersectRegion_dylibloader_wrapper_xlib) = dlsym(handle, "XIntersectRegion"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XConvertCase + *(void **) (&XConvertCase_dylibloader_wrapper_xlib) = dlsym(handle, "XConvertCase"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XLookupString + *(void **) (&XLookupString_dylibloader_wrapper_xlib) = dlsym(handle, "XLookupString"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XMatchVisualInfo + *(void **) (&XMatchVisualInfo_dylibloader_wrapper_xlib) = dlsym(handle, "XMatchVisualInfo"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XOffsetRegion + *(void **) (&XOffsetRegion_dylibloader_wrapper_xlib) = dlsym(handle, "XOffsetRegion"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XPointInRegion + *(void **) (&XPointInRegion_dylibloader_wrapper_xlib) = dlsym(handle, "XPointInRegion"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XPolygonRegion + *(void **) (&XPolygonRegion_dylibloader_wrapper_xlib) = dlsym(handle, "XPolygonRegion"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XRectInRegion + *(void **) (&XRectInRegion_dylibloader_wrapper_xlib) = dlsym(handle, "XRectInRegion"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XSaveContext + *(void **) (&XSaveContext_dylibloader_wrapper_xlib) = dlsym(handle, "XSaveContext"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XSetClassHint + *(void **) (&XSetClassHint_dylibloader_wrapper_xlib) = dlsym(handle, "XSetClassHint"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XSetIconSizes + *(void **) (&XSetIconSizes_dylibloader_wrapper_xlib) = dlsym(handle, "XSetIconSizes"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XSetNormalHints + *(void **) (&XSetNormalHints_dylibloader_wrapper_xlib) = dlsym(handle, "XSetNormalHints"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XSetRGBColormaps + *(void **) (&XSetRGBColormaps_dylibloader_wrapper_xlib) = dlsym(handle, "XSetRGBColormaps"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XSetSizeHints + *(void **) (&XSetSizeHints_dylibloader_wrapper_xlib) = dlsym(handle, "XSetSizeHints"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XSetStandardProperties + *(void **) (&XSetStandardProperties_dylibloader_wrapper_xlib) = dlsym(handle, "XSetStandardProperties"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XSetTextProperty + *(void **) (&XSetTextProperty_dylibloader_wrapper_xlib) = dlsym(handle, "XSetTextProperty"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XSetWMClientMachine + *(void **) (&XSetWMClientMachine_dylibloader_wrapper_xlib) = dlsym(handle, "XSetWMClientMachine"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XSetWMHints + *(void **) (&XSetWMHints_dylibloader_wrapper_xlib) = dlsym(handle, "XSetWMHints"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XSetWMIconName + *(void **) (&XSetWMIconName_dylibloader_wrapper_xlib) = dlsym(handle, "XSetWMIconName"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XSetWMName + *(void **) (&XSetWMName_dylibloader_wrapper_xlib) = dlsym(handle, "XSetWMName"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XSetWMNormalHints + *(void **) (&XSetWMNormalHints_dylibloader_wrapper_xlib) = dlsym(handle, "XSetWMNormalHints"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XSetWMProperties + *(void **) (&XSetWMProperties_dylibloader_wrapper_xlib) = dlsym(handle, "XSetWMProperties"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XmbSetWMProperties + *(void **) (&XmbSetWMProperties_dylibloader_wrapper_xlib) = dlsym(handle, "XmbSetWMProperties"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// Xutf8SetWMProperties + *(void **) (&Xutf8SetWMProperties_dylibloader_wrapper_xlib) = dlsym(handle, "Xutf8SetWMProperties"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XSetWMSizeHints + *(void **) (&XSetWMSizeHints_dylibloader_wrapper_xlib) = dlsym(handle, "XSetWMSizeHints"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XSetRegion + *(void **) (&XSetRegion_dylibloader_wrapper_xlib) = dlsym(handle, "XSetRegion"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XSetStandardColormap + *(void **) (&XSetStandardColormap_dylibloader_wrapper_xlib) = dlsym(handle, "XSetStandardColormap"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XSetZoomHints + *(void **) (&XSetZoomHints_dylibloader_wrapper_xlib) = dlsym(handle, "XSetZoomHints"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XShrinkRegion + *(void **) (&XShrinkRegion_dylibloader_wrapper_xlib) = dlsym(handle, "XShrinkRegion"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XStringListToTextProperty + *(void **) (&XStringListToTextProperty_dylibloader_wrapper_xlib) = dlsym(handle, "XStringListToTextProperty"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XSubtractRegion + *(void **) (&XSubtractRegion_dylibloader_wrapper_xlib) = dlsym(handle, "XSubtractRegion"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XmbTextListToTextProperty + *(void **) (&XmbTextListToTextProperty_dylibloader_wrapper_xlib) = dlsym(handle, "XmbTextListToTextProperty"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XwcTextListToTextProperty + *(void **) (&XwcTextListToTextProperty_dylibloader_wrapper_xlib) = dlsym(handle, "XwcTextListToTextProperty"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// Xutf8TextListToTextProperty + *(void **) (&Xutf8TextListToTextProperty_dylibloader_wrapper_xlib) = dlsym(handle, "Xutf8TextListToTextProperty"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XwcFreeStringList + *(void **) (&XwcFreeStringList_dylibloader_wrapper_xlib) = dlsym(handle, "XwcFreeStringList"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XTextPropertyToStringList + *(void **) (&XTextPropertyToStringList_dylibloader_wrapper_xlib) = dlsym(handle, "XTextPropertyToStringList"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XmbTextPropertyToTextList + *(void **) (&XmbTextPropertyToTextList_dylibloader_wrapper_xlib) = dlsym(handle, "XmbTextPropertyToTextList"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XwcTextPropertyToTextList + *(void **) (&XwcTextPropertyToTextList_dylibloader_wrapper_xlib) = dlsym(handle, "XwcTextPropertyToTextList"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// Xutf8TextPropertyToTextList + *(void **) (&Xutf8TextPropertyToTextList_dylibloader_wrapper_xlib) = dlsym(handle, "Xutf8TextPropertyToTextList"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XUnionRectWithRegion + *(void **) (&XUnionRectWithRegion_dylibloader_wrapper_xlib) = dlsym(handle, "XUnionRectWithRegion"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XUnionRegion + *(void **) (&XUnionRegion_dylibloader_wrapper_xlib) = dlsym(handle, "XUnionRegion"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XWMGeometry + *(void **) (&XWMGeometry_dylibloader_wrapper_xlib) = dlsym(handle, "XWMGeometry"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XXorRegion + *(void **) (&XXorRegion_dylibloader_wrapper_xlib) = dlsym(handle, "XXorRegion"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XkbIgnoreExtension + *(void **) (&XkbIgnoreExtension_dylibloader_wrapper_xlib) = dlsym(handle, "XkbIgnoreExtension"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XkbOpenDisplay + *(void **) (&XkbOpenDisplay_dylibloader_wrapper_xlib) = dlsym(handle, "XkbOpenDisplay"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XkbQueryExtension + *(void **) (&XkbQueryExtension_dylibloader_wrapper_xlib) = dlsym(handle, "XkbQueryExtension"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XkbUseExtension + *(void **) (&XkbUseExtension_dylibloader_wrapper_xlib) = dlsym(handle, "XkbUseExtension"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XkbLibraryVersion + *(void **) (&XkbLibraryVersion_dylibloader_wrapper_xlib) = dlsym(handle, "XkbLibraryVersion"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XkbSetXlibControls + *(void **) (&XkbSetXlibControls_dylibloader_wrapper_xlib) = dlsym(handle, "XkbSetXlibControls"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XkbGetXlibControls + *(void **) (&XkbGetXlibControls_dylibloader_wrapper_xlib) = dlsym(handle, "XkbGetXlibControls"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XkbXlibControlsImplemented + *(void **) (&XkbXlibControlsImplemented_dylibloader_wrapper_xlib) = dlsym(handle, "XkbXlibControlsImplemented"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XkbSetAtomFuncs + *(void **) (&XkbSetAtomFuncs_dylibloader_wrapper_xlib) = dlsym(handle, "XkbSetAtomFuncs"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XkbKeycodeToKeysym + *(void **) (&XkbKeycodeToKeysym_dylibloader_wrapper_xlib) = dlsym(handle, "XkbKeycodeToKeysym"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XkbKeysymToModifiers + *(void **) (&XkbKeysymToModifiers_dylibloader_wrapper_xlib) = dlsym(handle, "XkbKeysymToModifiers"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XkbLookupKeySym + *(void **) (&XkbLookupKeySym_dylibloader_wrapper_xlib) = dlsym(handle, "XkbLookupKeySym"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XkbLookupKeyBinding + *(void **) (&XkbLookupKeyBinding_dylibloader_wrapper_xlib) = dlsym(handle, "XkbLookupKeyBinding"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XkbTranslateKeyCode + *(void **) (&XkbTranslateKeyCode_dylibloader_wrapper_xlib) = dlsym(handle, "XkbTranslateKeyCode"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XkbTranslateKeySym + *(void **) (&XkbTranslateKeySym_dylibloader_wrapper_xlib) = dlsym(handle, "XkbTranslateKeySym"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XkbSetAutoRepeatRate + *(void **) (&XkbSetAutoRepeatRate_dylibloader_wrapper_xlib) = dlsym(handle, "XkbSetAutoRepeatRate"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XkbGetAutoRepeatRate + *(void **) (&XkbGetAutoRepeatRate_dylibloader_wrapper_xlib) = dlsym(handle, "XkbGetAutoRepeatRate"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XkbChangeEnabledControls + *(void **) (&XkbChangeEnabledControls_dylibloader_wrapper_xlib) = dlsym(handle, "XkbChangeEnabledControls"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XkbDeviceBell + *(void **) (&XkbDeviceBell_dylibloader_wrapper_xlib) = dlsym(handle, "XkbDeviceBell"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XkbForceDeviceBell + *(void **) (&XkbForceDeviceBell_dylibloader_wrapper_xlib) = dlsym(handle, "XkbForceDeviceBell"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XkbDeviceBellEvent + *(void **) (&XkbDeviceBellEvent_dylibloader_wrapper_xlib) = dlsym(handle, "XkbDeviceBellEvent"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XkbBell + *(void **) (&XkbBell_dylibloader_wrapper_xlib) = dlsym(handle, "XkbBell"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XkbForceBell + *(void **) (&XkbForceBell_dylibloader_wrapper_xlib) = dlsym(handle, "XkbForceBell"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XkbBellEvent + *(void **) (&XkbBellEvent_dylibloader_wrapper_xlib) = dlsym(handle, "XkbBellEvent"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XkbSelectEvents + *(void **) (&XkbSelectEvents_dylibloader_wrapper_xlib) = dlsym(handle, "XkbSelectEvents"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XkbSelectEventDetails + *(void **) (&XkbSelectEventDetails_dylibloader_wrapper_xlib) = dlsym(handle, "XkbSelectEventDetails"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XkbNoteMapChanges + *(void **) (&XkbNoteMapChanges_dylibloader_wrapper_xlib) = dlsym(handle, "XkbNoteMapChanges"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XkbNoteNameChanges + *(void **) (&XkbNoteNameChanges_dylibloader_wrapper_xlib) = dlsym(handle, "XkbNoteNameChanges"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XkbGetIndicatorState + *(void **) (&XkbGetIndicatorState_dylibloader_wrapper_xlib) = dlsym(handle, "XkbGetIndicatorState"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XkbGetIndicatorMap + *(void **) (&XkbGetIndicatorMap_dylibloader_wrapper_xlib) = dlsym(handle, "XkbGetIndicatorMap"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XkbSetIndicatorMap + *(void **) (&XkbSetIndicatorMap_dylibloader_wrapper_xlib) = dlsym(handle, "XkbSetIndicatorMap"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XkbGetNamedIndicator + *(void **) (&XkbGetNamedIndicator_dylibloader_wrapper_xlib) = dlsym(handle, "XkbGetNamedIndicator"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XkbGetNamedDeviceIndicator + *(void **) (&XkbGetNamedDeviceIndicator_dylibloader_wrapper_xlib) = dlsym(handle, "XkbGetNamedDeviceIndicator"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XkbSetNamedIndicator + *(void **) (&XkbSetNamedIndicator_dylibloader_wrapper_xlib) = dlsym(handle, "XkbSetNamedIndicator"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XkbSetNamedDeviceIndicator + *(void **) (&XkbSetNamedDeviceIndicator_dylibloader_wrapper_xlib) = dlsym(handle, "XkbSetNamedDeviceIndicator"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XkbLockModifiers + *(void **) (&XkbLockModifiers_dylibloader_wrapper_xlib) = dlsym(handle, "XkbLockModifiers"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XkbLatchModifiers + *(void **) (&XkbLatchModifiers_dylibloader_wrapper_xlib) = dlsym(handle, "XkbLatchModifiers"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XkbLockGroup + *(void **) (&XkbLockGroup_dylibloader_wrapper_xlib) = dlsym(handle, "XkbLockGroup"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XkbLatchGroup + *(void **) (&XkbLatchGroup_dylibloader_wrapper_xlib) = dlsym(handle, "XkbLatchGroup"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XkbSetServerInternalMods + *(void **) (&XkbSetServerInternalMods_dylibloader_wrapper_xlib) = dlsym(handle, "XkbSetServerInternalMods"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XkbSetIgnoreLockMods + *(void **) (&XkbSetIgnoreLockMods_dylibloader_wrapper_xlib) = dlsym(handle, "XkbSetIgnoreLockMods"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XkbVirtualModsToReal + *(void **) (&XkbVirtualModsToReal_dylibloader_wrapper_xlib) = dlsym(handle, "XkbVirtualModsToReal"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XkbComputeEffectiveMap + *(void **) (&XkbComputeEffectiveMap_dylibloader_wrapper_xlib) = dlsym(handle, "XkbComputeEffectiveMap"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XkbInitCanonicalKeyTypes + *(void **) (&XkbInitCanonicalKeyTypes_dylibloader_wrapper_xlib) = dlsym(handle, "XkbInitCanonicalKeyTypes"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XkbAllocKeyboard + *(void **) (&XkbAllocKeyboard_dylibloader_wrapper_xlib) = dlsym(handle, "XkbAllocKeyboard"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XkbFreeKeyboard + *(void **) (&XkbFreeKeyboard_dylibloader_wrapper_xlib) = dlsym(handle, "XkbFreeKeyboard"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XkbAllocClientMap + *(void **) (&XkbAllocClientMap_dylibloader_wrapper_xlib) = dlsym(handle, "XkbAllocClientMap"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XkbAllocServerMap + *(void **) (&XkbAllocServerMap_dylibloader_wrapper_xlib) = dlsym(handle, "XkbAllocServerMap"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XkbFreeClientMap + *(void **) (&XkbFreeClientMap_dylibloader_wrapper_xlib) = dlsym(handle, "XkbFreeClientMap"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XkbFreeServerMap + *(void **) (&XkbFreeServerMap_dylibloader_wrapper_xlib) = dlsym(handle, "XkbFreeServerMap"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XkbAddKeyType + *(void **) (&XkbAddKeyType_dylibloader_wrapper_xlib) = dlsym(handle, "XkbAddKeyType"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XkbAllocIndicatorMaps + *(void **) (&XkbAllocIndicatorMaps_dylibloader_wrapper_xlib) = dlsym(handle, "XkbAllocIndicatorMaps"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XkbFreeIndicatorMaps + *(void **) (&XkbFreeIndicatorMaps_dylibloader_wrapper_xlib) = dlsym(handle, "XkbFreeIndicatorMaps"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XkbGetMap + *(void **) (&XkbGetMap_dylibloader_wrapper_xlib) = dlsym(handle, "XkbGetMap"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XkbGetUpdatedMap + *(void **) (&XkbGetUpdatedMap_dylibloader_wrapper_xlib) = dlsym(handle, "XkbGetUpdatedMap"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XkbGetMapChanges + *(void **) (&XkbGetMapChanges_dylibloader_wrapper_xlib) = dlsym(handle, "XkbGetMapChanges"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XkbRefreshKeyboardMapping + *(void **) (&XkbRefreshKeyboardMapping_dylibloader_wrapper_xlib) = dlsym(handle, "XkbRefreshKeyboardMapping"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XkbGetKeyTypes + *(void **) (&XkbGetKeyTypes_dylibloader_wrapper_xlib) = dlsym(handle, "XkbGetKeyTypes"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XkbGetKeySyms + *(void **) (&XkbGetKeySyms_dylibloader_wrapper_xlib) = dlsym(handle, "XkbGetKeySyms"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XkbGetKeyActions + *(void **) (&XkbGetKeyActions_dylibloader_wrapper_xlib) = dlsym(handle, "XkbGetKeyActions"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XkbGetKeyBehaviors + *(void **) (&XkbGetKeyBehaviors_dylibloader_wrapper_xlib) = dlsym(handle, "XkbGetKeyBehaviors"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XkbGetVirtualMods + *(void **) (&XkbGetVirtualMods_dylibloader_wrapper_xlib) = dlsym(handle, "XkbGetVirtualMods"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XkbGetKeyExplicitComponents + *(void **) (&XkbGetKeyExplicitComponents_dylibloader_wrapper_xlib) = dlsym(handle, "XkbGetKeyExplicitComponents"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XkbGetKeyModifierMap + *(void **) (&XkbGetKeyModifierMap_dylibloader_wrapper_xlib) = dlsym(handle, "XkbGetKeyModifierMap"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XkbGetKeyVirtualModMap + *(void **) (&XkbGetKeyVirtualModMap_dylibloader_wrapper_xlib) = dlsym(handle, "XkbGetKeyVirtualModMap"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XkbAllocControls + *(void **) (&XkbAllocControls_dylibloader_wrapper_xlib) = dlsym(handle, "XkbAllocControls"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XkbFreeControls + *(void **) (&XkbFreeControls_dylibloader_wrapper_xlib) = dlsym(handle, "XkbFreeControls"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XkbGetControls + *(void **) (&XkbGetControls_dylibloader_wrapper_xlib) = dlsym(handle, "XkbGetControls"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XkbSetControls + *(void **) (&XkbSetControls_dylibloader_wrapper_xlib) = dlsym(handle, "XkbSetControls"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XkbNoteControlsChanges + *(void **) (&XkbNoteControlsChanges_dylibloader_wrapper_xlib) = dlsym(handle, "XkbNoteControlsChanges"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XkbAllocCompatMap + *(void **) (&XkbAllocCompatMap_dylibloader_wrapper_xlib) = dlsym(handle, "XkbAllocCompatMap"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XkbFreeCompatMap + *(void **) (&XkbFreeCompatMap_dylibloader_wrapper_xlib) = dlsym(handle, "XkbFreeCompatMap"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XkbGetCompatMap + *(void **) (&XkbGetCompatMap_dylibloader_wrapper_xlib) = dlsym(handle, "XkbGetCompatMap"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XkbSetCompatMap + *(void **) (&XkbSetCompatMap_dylibloader_wrapper_xlib) = dlsym(handle, "XkbSetCompatMap"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XkbAllocNames + *(void **) (&XkbAllocNames_dylibloader_wrapper_xlib) = dlsym(handle, "XkbAllocNames"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XkbGetNames + *(void **) (&XkbGetNames_dylibloader_wrapper_xlib) = dlsym(handle, "XkbGetNames"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XkbSetNames + *(void **) (&XkbSetNames_dylibloader_wrapper_xlib) = dlsym(handle, "XkbSetNames"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XkbChangeNames + *(void **) (&XkbChangeNames_dylibloader_wrapper_xlib) = dlsym(handle, "XkbChangeNames"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XkbFreeNames + *(void **) (&XkbFreeNames_dylibloader_wrapper_xlib) = dlsym(handle, "XkbFreeNames"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XkbGetState + *(void **) (&XkbGetState_dylibloader_wrapper_xlib) = dlsym(handle, "XkbGetState"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XkbSetMap + *(void **) (&XkbSetMap_dylibloader_wrapper_xlib) = dlsym(handle, "XkbSetMap"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XkbChangeMap + *(void **) (&XkbChangeMap_dylibloader_wrapper_xlib) = dlsym(handle, "XkbChangeMap"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XkbSetDetectableAutoRepeat + *(void **) (&XkbSetDetectableAutoRepeat_dylibloader_wrapper_xlib) = dlsym(handle, "XkbSetDetectableAutoRepeat"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XkbGetDetectableAutoRepeat + *(void **) (&XkbGetDetectableAutoRepeat_dylibloader_wrapper_xlib) = dlsym(handle, "XkbGetDetectableAutoRepeat"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XkbSetAutoResetControls + *(void **) (&XkbSetAutoResetControls_dylibloader_wrapper_xlib) = dlsym(handle, "XkbSetAutoResetControls"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XkbGetAutoResetControls + *(void **) (&XkbGetAutoResetControls_dylibloader_wrapper_xlib) = dlsym(handle, "XkbGetAutoResetControls"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XkbSetPerClientControls + *(void **) (&XkbSetPerClientControls_dylibloader_wrapper_xlib) = dlsym(handle, "XkbSetPerClientControls"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XkbGetPerClientControls + *(void **) (&XkbGetPerClientControls_dylibloader_wrapper_xlib) = dlsym(handle, "XkbGetPerClientControls"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XkbCopyKeyType + *(void **) (&XkbCopyKeyType_dylibloader_wrapper_xlib) = dlsym(handle, "XkbCopyKeyType"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XkbCopyKeyTypes + *(void **) (&XkbCopyKeyTypes_dylibloader_wrapper_xlib) = dlsym(handle, "XkbCopyKeyTypes"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XkbResizeKeyType + *(void **) (&XkbResizeKeyType_dylibloader_wrapper_xlib) = dlsym(handle, "XkbResizeKeyType"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XkbResizeKeySyms + *(void **) (&XkbResizeKeySyms_dylibloader_wrapper_xlib) = dlsym(handle, "XkbResizeKeySyms"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XkbResizeKeyActions + *(void **) (&XkbResizeKeyActions_dylibloader_wrapper_xlib) = dlsym(handle, "XkbResizeKeyActions"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XkbChangeTypesOfKey + *(void **) (&XkbChangeTypesOfKey_dylibloader_wrapper_xlib) = dlsym(handle, "XkbChangeTypesOfKey"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XkbChangeKeycodeRange + *(void **) (&XkbChangeKeycodeRange_dylibloader_wrapper_xlib) = dlsym(handle, "XkbChangeKeycodeRange"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XkbListComponents + *(void **) (&XkbListComponents_dylibloader_wrapper_xlib) = dlsym(handle, "XkbListComponents"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XkbFreeComponentList + *(void **) (&XkbFreeComponentList_dylibloader_wrapper_xlib) = dlsym(handle, "XkbFreeComponentList"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XkbGetKeyboard + *(void **) (&XkbGetKeyboard_dylibloader_wrapper_xlib) = dlsym(handle, "XkbGetKeyboard"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XkbGetKeyboardByName + *(void **) (&XkbGetKeyboardByName_dylibloader_wrapper_xlib) = dlsym(handle, "XkbGetKeyboardByName"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XkbKeyTypesForCoreSymbols + *(void **) (&XkbKeyTypesForCoreSymbols_dylibloader_wrapper_xlib) = dlsym(handle, "XkbKeyTypesForCoreSymbols"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XkbApplyCompatMapToKey + *(void **) (&XkbApplyCompatMapToKey_dylibloader_wrapper_xlib) = dlsym(handle, "XkbApplyCompatMapToKey"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XkbUpdateMapFromCore + *(void **) (&XkbUpdateMapFromCore_dylibloader_wrapper_xlib) = dlsym(handle, "XkbUpdateMapFromCore"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XkbAddDeviceLedInfo + *(void **) (&XkbAddDeviceLedInfo_dylibloader_wrapper_xlib) = dlsym(handle, "XkbAddDeviceLedInfo"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XkbResizeDeviceButtonActions + *(void **) (&XkbResizeDeviceButtonActions_dylibloader_wrapper_xlib) = dlsym(handle, "XkbResizeDeviceButtonActions"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XkbAllocDeviceInfo + *(void **) (&XkbAllocDeviceInfo_dylibloader_wrapper_xlib) = dlsym(handle, "XkbAllocDeviceInfo"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XkbFreeDeviceInfo + *(void **) (&XkbFreeDeviceInfo_dylibloader_wrapper_xlib) = dlsym(handle, "XkbFreeDeviceInfo"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XkbNoteDeviceChanges + *(void **) (&XkbNoteDeviceChanges_dylibloader_wrapper_xlib) = dlsym(handle, "XkbNoteDeviceChanges"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XkbGetDeviceInfo + *(void **) (&XkbGetDeviceInfo_dylibloader_wrapper_xlib) = dlsym(handle, "XkbGetDeviceInfo"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XkbGetDeviceInfoChanges + *(void **) (&XkbGetDeviceInfoChanges_dylibloader_wrapper_xlib) = dlsym(handle, "XkbGetDeviceInfoChanges"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XkbGetDeviceButtonActions + *(void **) (&XkbGetDeviceButtonActions_dylibloader_wrapper_xlib) = dlsym(handle, "XkbGetDeviceButtonActions"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XkbGetDeviceLedInfo + *(void **) (&XkbGetDeviceLedInfo_dylibloader_wrapper_xlib) = dlsym(handle, "XkbGetDeviceLedInfo"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XkbSetDeviceInfo + *(void **) (&XkbSetDeviceInfo_dylibloader_wrapper_xlib) = dlsym(handle, "XkbSetDeviceInfo"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XkbChangeDeviceInfo + *(void **) (&XkbChangeDeviceInfo_dylibloader_wrapper_xlib) = dlsym(handle, "XkbChangeDeviceInfo"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XkbSetDeviceLedInfo + *(void **) (&XkbSetDeviceLedInfo_dylibloader_wrapper_xlib) = dlsym(handle, "XkbSetDeviceLedInfo"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XkbSetDeviceButtonActions + *(void **) (&XkbSetDeviceButtonActions_dylibloader_wrapper_xlib) = dlsym(handle, "XkbSetDeviceButtonActions"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XkbToControl + *(void **) (&XkbToControl_dylibloader_wrapper_xlib) = dlsym(handle, "XkbToControl"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XkbSetDebuggingFlags + *(void **) (&XkbSetDebuggingFlags_dylibloader_wrapper_xlib) = dlsym(handle, "XkbSetDebuggingFlags"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XkbApplyVirtualModChanges + *(void **) (&XkbApplyVirtualModChanges_dylibloader_wrapper_xlib) = dlsym(handle, "XkbApplyVirtualModChanges"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XkbUpdateActionVirtualMods + *(void **) (&XkbUpdateActionVirtualMods_dylibloader_wrapper_xlib) = dlsym(handle, "XkbUpdateActionVirtualMods"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XkbUpdateKeyTypeVirtualMods + *(void **) (&XkbUpdateKeyTypeVirtualMods_dylibloader_wrapper_xlib) = dlsym(handle, "XkbUpdateKeyTypeVirtualMods"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +return 0; +} diff --git a/platform/linuxbsd/x11/dynwrappers/xlib-so_wrap.h b/platform/linuxbsd/x11/dynwrappers/xlib-so_wrap.h new file mode 100644 index 0000000000..47464078e3 --- /dev/null +++ b/platform/linuxbsd/x11/dynwrappers/xlib-so_wrap.h @@ -0,0 +1,2439 @@ +#ifndef DYLIBLOAD_WRAPPER_XLIB +#define DYLIBLOAD_WRAPPER_XLIB +// This file is generated. Do not edit! +// see https://github.com/hpvb/dynload-wrapper for details +// generated by ./generate-wrapper.py 0.3 on 2022-12-02 12:54:53 +// flags: ./generate-wrapper.py --include /usr/include/X11/Xlib.h --include /usr/include/X11/Xutil.h --include /usr/include/X11/XKBlib.h --sys-include <X11/Xlib.h> --sys-include <X11/Xutil.h> --sys-include <X11/XKBlib.h> --soname libX11.so.6 --init-name xlib --omit-prefix XkbGetDeviceIndicatorState --omit-prefix XkbAddSymInterpret --output-header xlib-so_wrap.h --output-implementation xlib-so_wrap.c +// +// NOTE: Generated from Xlib 1.6.9. +// This has been handpatched to workaround some issues with the generator that +// will be eventually fixed. In this case, the type of the third argument of +// XIfEvent, XPeekIfEvent and XCheckIfEvent had to be fixed as it wasn't parsed +// fully (it's a Bool function pointer, but it was just being parsed as an int +// pointer). + +#include <stdint.h> + +#define _Xmblen _Xmblen_dylibloader_orig_xlib +#define XLoadQueryFont XLoadQueryFont_dylibloader_orig_xlib +#define XQueryFont XQueryFont_dylibloader_orig_xlib +#define XGetMotionEvents XGetMotionEvents_dylibloader_orig_xlib +#define XDeleteModifiermapEntry XDeleteModifiermapEntry_dylibloader_orig_xlib +#define XGetModifierMapping XGetModifierMapping_dylibloader_orig_xlib +#define XInsertModifiermapEntry XInsertModifiermapEntry_dylibloader_orig_xlib +#define XNewModifiermap XNewModifiermap_dylibloader_orig_xlib +#define XCreateImage XCreateImage_dylibloader_orig_xlib +#define XInitImage XInitImage_dylibloader_orig_xlib +#define XGetImage XGetImage_dylibloader_orig_xlib +#define XGetSubImage XGetSubImage_dylibloader_orig_xlib +#define XOpenDisplay XOpenDisplay_dylibloader_orig_xlib +#define XrmInitialize XrmInitialize_dylibloader_orig_xlib +#define XFetchBytes XFetchBytes_dylibloader_orig_xlib +#define XFetchBuffer XFetchBuffer_dylibloader_orig_xlib +#define XGetAtomName XGetAtomName_dylibloader_orig_xlib +#define XGetAtomNames XGetAtomNames_dylibloader_orig_xlib +#define XGetDefault XGetDefault_dylibloader_orig_xlib +#define XDisplayName XDisplayName_dylibloader_orig_xlib +#define XKeysymToString XKeysymToString_dylibloader_orig_xlib +#define XSynchronize XSynchronize_dylibloader_orig_xlib +#define XSetAfterFunction XSetAfterFunction_dylibloader_orig_xlib +#define XInternAtom XInternAtom_dylibloader_orig_xlib +#define XInternAtoms XInternAtoms_dylibloader_orig_xlib +#define XCopyColormapAndFree XCopyColormapAndFree_dylibloader_orig_xlib +#define XCreateColormap XCreateColormap_dylibloader_orig_xlib +#define XCreatePixmapCursor XCreatePixmapCursor_dylibloader_orig_xlib +#define XCreateGlyphCursor XCreateGlyphCursor_dylibloader_orig_xlib +#define XCreateFontCursor XCreateFontCursor_dylibloader_orig_xlib +#define XLoadFont XLoadFont_dylibloader_orig_xlib +#define XCreateGC XCreateGC_dylibloader_orig_xlib +#define XGContextFromGC XGContextFromGC_dylibloader_orig_xlib +#define XFlushGC XFlushGC_dylibloader_orig_xlib +#define XCreatePixmap XCreatePixmap_dylibloader_orig_xlib +#define XCreateBitmapFromData XCreateBitmapFromData_dylibloader_orig_xlib +#define XCreatePixmapFromBitmapData XCreatePixmapFromBitmapData_dylibloader_orig_xlib +#define XCreateSimpleWindow XCreateSimpleWindow_dylibloader_orig_xlib +#define XGetSelectionOwner XGetSelectionOwner_dylibloader_orig_xlib +#define XCreateWindow XCreateWindow_dylibloader_orig_xlib +#define XListInstalledColormaps XListInstalledColormaps_dylibloader_orig_xlib +#define XListFonts XListFonts_dylibloader_orig_xlib +#define XListFontsWithInfo XListFontsWithInfo_dylibloader_orig_xlib +#define XGetFontPath XGetFontPath_dylibloader_orig_xlib +#define XListExtensions XListExtensions_dylibloader_orig_xlib +#define XListProperties XListProperties_dylibloader_orig_xlib +#define XListHosts XListHosts_dylibloader_orig_xlib +#define XKeycodeToKeysym XKeycodeToKeysym_dylibloader_orig_xlib +#define XLookupKeysym XLookupKeysym_dylibloader_orig_xlib +#define XGetKeyboardMapping XGetKeyboardMapping_dylibloader_orig_xlib +#define XStringToKeysym XStringToKeysym_dylibloader_orig_xlib +#define XMaxRequestSize XMaxRequestSize_dylibloader_orig_xlib +#define XExtendedMaxRequestSize XExtendedMaxRequestSize_dylibloader_orig_xlib +#define XResourceManagerString XResourceManagerString_dylibloader_orig_xlib +#define XScreenResourceString XScreenResourceString_dylibloader_orig_xlib +#define XDisplayMotionBufferSize XDisplayMotionBufferSize_dylibloader_orig_xlib +#define XVisualIDFromVisual XVisualIDFromVisual_dylibloader_orig_xlib +#define XInitThreads XInitThreads_dylibloader_orig_xlib +#define XLockDisplay XLockDisplay_dylibloader_orig_xlib +#define XUnlockDisplay XUnlockDisplay_dylibloader_orig_xlib +#define XInitExtension XInitExtension_dylibloader_orig_xlib +#define XAddExtension XAddExtension_dylibloader_orig_xlib +#define XFindOnExtensionList XFindOnExtensionList_dylibloader_orig_xlib +#define XEHeadOfExtensionList XEHeadOfExtensionList_dylibloader_orig_xlib +#define XRootWindow XRootWindow_dylibloader_orig_xlib +#define XDefaultRootWindow XDefaultRootWindow_dylibloader_orig_xlib +#define XRootWindowOfScreen XRootWindowOfScreen_dylibloader_orig_xlib +#define XDefaultVisual XDefaultVisual_dylibloader_orig_xlib +#define XDefaultVisualOfScreen XDefaultVisualOfScreen_dylibloader_orig_xlib +#define XDefaultGC XDefaultGC_dylibloader_orig_xlib +#define XDefaultGCOfScreen XDefaultGCOfScreen_dylibloader_orig_xlib +#define XBlackPixel XBlackPixel_dylibloader_orig_xlib +#define XWhitePixel XWhitePixel_dylibloader_orig_xlib +#define XAllPlanes XAllPlanes_dylibloader_orig_xlib +#define XBlackPixelOfScreen XBlackPixelOfScreen_dylibloader_orig_xlib +#define XWhitePixelOfScreen XWhitePixelOfScreen_dylibloader_orig_xlib +#define XNextRequest XNextRequest_dylibloader_orig_xlib +#define XLastKnownRequestProcessed XLastKnownRequestProcessed_dylibloader_orig_xlib +#define XServerVendor XServerVendor_dylibloader_orig_xlib +#define XDisplayString XDisplayString_dylibloader_orig_xlib +#define XDefaultColormap XDefaultColormap_dylibloader_orig_xlib +#define XDefaultColormapOfScreen XDefaultColormapOfScreen_dylibloader_orig_xlib +#define XDisplayOfScreen XDisplayOfScreen_dylibloader_orig_xlib +#define XScreenOfDisplay XScreenOfDisplay_dylibloader_orig_xlib +#define XDefaultScreenOfDisplay XDefaultScreenOfDisplay_dylibloader_orig_xlib +#define XEventMaskOfScreen XEventMaskOfScreen_dylibloader_orig_xlib +#define XScreenNumberOfScreen XScreenNumberOfScreen_dylibloader_orig_xlib +#define XSetErrorHandler XSetErrorHandler_dylibloader_orig_xlib +#define XSetIOErrorHandler XSetIOErrorHandler_dylibloader_orig_xlib +#define XListPixmapFormats XListPixmapFormats_dylibloader_orig_xlib +#define XListDepths XListDepths_dylibloader_orig_xlib +#define XReconfigureWMWindow XReconfigureWMWindow_dylibloader_orig_xlib +#define XGetWMProtocols XGetWMProtocols_dylibloader_orig_xlib +#define XSetWMProtocols XSetWMProtocols_dylibloader_orig_xlib +#define XIconifyWindow XIconifyWindow_dylibloader_orig_xlib +#define XWithdrawWindow XWithdrawWindow_dylibloader_orig_xlib +#define XGetCommand XGetCommand_dylibloader_orig_xlib +#define XGetWMColormapWindows XGetWMColormapWindows_dylibloader_orig_xlib +#define XSetWMColormapWindows XSetWMColormapWindows_dylibloader_orig_xlib +#define XFreeStringList XFreeStringList_dylibloader_orig_xlib +#define XSetTransientForHint XSetTransientForHint_dylibloader_orig_xlib +#define XActivateScreenSaver XActivateScreenSaver_dylibloader_orig_xlib +#define XAddHost XAddHost_dylibloader_orig_xlib +#define XAddHosts XAddHosts_dylibloader_orig_xlib +#define XAddToExtensionList XAddToExtensionList_dylibloader_orig_xlib +#define XAddToSaveSet XAddToSaveSet_dylibloader_orig_xlib +#define XAllocColor XAllocColor_dylibloader_orig_xlib +#define XAllocColorCells XAllocColorCells_dylibloader_orig_xlib +#define XAllocColorPlanes XAllocColorPlanes_dylibloader_orig_xlib +#define XAllocNamedColor XAllocNamedColor_dylibloader_orig_xlib +#define XAllowEvents XAllowEvents_dylibloader_orig_xlib +#define XAutoRepeatOff XAutoRepeatOff_dylibloader_orig_xlib +#define XAutoRepeatOn XAutoRepeatOn_dylibloader_orig_xlib +#define XBell XBell_dylibloader_orig_xlib +#define XBitmapBitOrder XBitmapBitOrder_dylibloader_orig_xlib +#define XBitmapPad XBitmapPad_dylibloader_orig_xlib +#define XBitmapUnit XBitmapUnit_dylibloader_orig_xlib +#define XCellsOfScreen XCellsOfScreen_dylibloader_orig_xlib +#define XChangeActivePointerGrab XChangeActivePointerGrab_dylibloader_orig_xlib +#define XChangeGC XChangeGC_dylibloader_orig_xlib +#define XChangeKeyboardControl XChangeKeyboardControl_dylibloader_orig_xlib +#define XChangeKeyboardMapping XChangeKeyboardMapping_dylibloader_orig_xlib +#define XChangePointerControl XChangePointerControl_dylibloader_orig_xlib +#define XChangeProperty XChangeProperty_dylibloader_orig_xlib +#define XChangeSaveSet XChangeSaveSet_dylibloader_orig_xlib +#define XChangeWindowAttributes XChangeWindowAttributes_dylibloader_orig_xlib +#define XCheckIfEvent XCheckIfEvent_dylibloader_orig_xlib +#define XCheckMaskEvent XCheckMaskEvent_dylibloader_orig_xlib +#define XCheckTypedEvent XCheckTypedEvent_dylibloader_orig_xlib +#define XCheckTypedWindowEvent XCheckTypedWindowEvent_dylibloader_orig_xlib +#define XCheckWindowEvent XCheckWindowEvent_dylibloader_orig_xlib +#define XCirculateSubwindows XCirculateSubwindows_dylibloader_orig_xlib +#define XCirculateSubwindowsDown XCirculateSubwindowsDown_dylibloader_orig_xlib +#define XCirculateSubwindowsUp XCirculateSubwindowsUp_dylibloader_orig_xlib +#define XClearArea XClearArea_dylibloader_orig_xlib +#define XClearWindow XClearWindow_dylibloader_orig_xlib +#define XCloseDisplay XCloseDisplay_dylibloader_orig_xlib +#define XConfigureWindow XConfigureWindow_dylibloader_orig_xlib +#define XConnectionNumber XConnectionNumber_dylibloader_orig_xlib +#define XConvertSelection XConvertSelection_dylibloader_orig_xlib +#define XCopyArea XCopyArea_dylibloader_orig_xlib +#define XCopyGC XCopyGC_dylibloader_orig_xlib +#define XCopyPlane XCopyPlane_dylibloader_orig_xlib +#define XDefaultDepth XDefaultDepth_dylibloader_orig_xlib +#define XDefaultDepthOfScreen XDefaultDepthOfScreen_dylibloader_orig_xlib +#define XDefaultScreen XDefaultScreen_dylibloader_orig_xlib +#define XDefineCursor XDefineCursor_dylibloader_orig_xlib +#define XDeleteProperty XDeleteProperty_dylibloader_orig_xlib +#define XDestroyWindow XDestroyWindow_dylibloader_orig_xlib +#define XDestroySubwindows XDestroySubwindows_dylibloader_orig_xlib +#define XDoesBackingStore XDoesBackingStore_dylibloader_orig_xlib +#define XDoesSaveUnders XDoesSaveUnders_dylibloader_orig_xlib +#define XDisableAccessControl XDisableAccessControl_dylibloader_orig_xlib +#define XDisplayCells XDisplayCells_dylibloader_orig_xlib +#define XDisplayHeight XDisplayHeight_dylibloader_orig_xlib +#define XDisplayHeightMM XDisplayHeightMM_dylibloader_orig_xlib +#define XDisplayKeycodes XDisplayKeycodes_dylibloader_orig_xlib +#define XDisplayPlanes XDisplayPlanes_dylibloader_orig_xlib +#define XDisplayWidth XDisplayWidth_dylibloader_orig_xlib +#define XDisplayWidthMM XDisplayWidthMM_dylibloader_orig_xlib +#define XDrawArc XDrawArc_dylibloader_orig_xlib +#define XDrawArcs XDrawArcs_dylibloader_orig_xlib +#define XDrawImageString XDrawImageString_dylibloader_orig_xlib +#define XDrawImageString16 XDrawImageString16_dylibloader_orig_xlib +#define XDrawLine XDrawLine_dylibloader_orig_xlib +#define XDrawLines XDrawLines_dylibloader_orig_xlib +#define XDrawPoint XDrawPoint_dylibloader_orig_xlib +#define XDrawPoints XDrawPoints_dylibloader_orig_xlib +#define XDrawRectangle XDrawRectangle_dylibloader_orig_xlib +#define XDrawRectangles XDrawRectangles_dylibloader_orig_xlib +#define XDrawSegments XDrawSegments_dylibloader_orig_xlib +#define XDrawString XDrawString_dylibloader_orig_xlib +#define XDrawString16 XDrawString16_dylibloader_orig_xlib +#define XDrawText XDrawText_dylibloader_orig_xlib +#define XDrawText16 XDrawText16_dylibloader_orig_xlib +#define XEnableAccessControl XEnableAccessControl_dylibloader_orig_xlib +#define XEventsQueued XEventsQueued_dylibloader_orig_xlib +#define XFetchName XFetchName_dylibloader_orig_xlib +#define XFillArc XFillArc_dylibloader_orig_xlib +#define XFillArcs XFillArcs_dylibloader_orig_xlib +#define XFillPolygon XFillPolygon_dylibloader_orig_xlib +#define XFillRectangle XFillRectangle_dylibloader_orig_xlib +#define XFillRectangles XFillRectangles_dylibloader_orig_xlib +#define XFlush XFlush_dylibloader_orig_xlib +#define XForceScreenSaver XForceScreenSaver_dylibloader_orig_xlib +#define XFree XFree_dylibloader_orig_xlib +#define XFreeColormap XFreeColormap_dylibloader_orig_xlib +#define XFreeColors XFreeColors_dylibloader_orig_xlib +#define XFreeCursor XFreeCursor_dylibloader_orig_xlib +#define XFreeExtensionList XFreeExtensionList_dylibloader_orig_xlib +#define XFreeFont XFreeFont_dylibloader_orig_xlib +#define XFreeFontInfo XFreeFontInfo_dylibloader_orig_xlib +#define XFreeFontNames XFreeFontNames_dylibloader_orig_xlib +#define XFreeFontPath XFreeFontPath_dylibloader_orig_xlib +#define XFreeGC XFreeGC_dylibloader_orig_xlib +#define XFreeModifiermap XFreeModifiermap_dylibloader_orig_xlib +#define XFreePixmap XFreePixmap_dylibloader_orig_xlib +#define XGeometry XGeometry_dylibloader_orig_xlib +#define XGetErrorDatabaseText XGetErrorDatabaseText_dylibloader_orig_xlib +#define XGetErrorText XGetErrorText_dylibloader_orig_xlib +#define XGetFontProperty XGetFontProperty_dylibloader_orig_xlib +#define XGetGCValues XGetGCValues_dylibloader_orig_xlib +#define XGetGeometry XGetGeometry_dylibloader_orig_xlib +#define XGetIconName XGetIconName_dylibloader_orig_xlib +#define XGetInputFocus XGetInputFocus_dylibloader_orig_xlib +#define XGetKeyboardControl XGetKeyboardControl_dylibloader_orig_xlib +#define XGetPointerControl XGetPointerControl_dylibloader_orig_xlib +#define XGetPointerMapping XGetPointerMapping_dylibloader_orig_xlib +#define XGetScreenSaver XGetScreenSaver_dylibloader_orig_xlib +#define XGetTransientForHint XGetTransientForHint_dylibloader_orig_xlib +#define XGetWindowProperty XGetWindowProperty_dylibloader_orig_xlib +#define XGetWindowAttributes XGetWindowAttributes_dylibloader_orig_xlib +#define XGrabButton XGrabButton_dylibloader_orig_xlib +#define XGrabKey XGrabKey_dylibloader_orig_xlib +#define XGrabKeyboard XGrabKeyboard_dylibloader_orig_xlib +#define XGrabPointer XGrabPointer_dylibloader_orig_xlib +#define XGrabServer XGrabServer_dylibloader_orig_xlib +#define XHeightMMOfScreen XHeightMMOfScreen_dylibloader_orig_xlib +#define XHeightOfScreen XHeightOfScreen_dylibloader_orig_xlib +#define XIfEvent XIfEvent_dylibloader_orig_xlib +#define XImageByteOrder XImageByteOrder_dylibloader_orig_xlib +#define XInstallColormap XInstallColormap_dylibloader_orig_xlib +#define XKeysymToKeycode XKeysymToKeycode_dylibloader_orig_xlib +#define XKillClient XKillClient_dylibloader_orig_xlib +#define XLookupColor XLookupColor_dylibloader_orig_xlib +#define XLowerWindow XLowerWindow_dylibloader_orig_xlib +#define XMapRaised XMapRaised_dylibloader_orig_xlib +#define XMapSubwindows XMapSubwindows_dylibloader_orig_xlib +#define XMapWindow XMapWindow_dylibloader_orig_xlib +#define XMaskEvent XMaskEvent_dylibloader_orig_xlib +#define XMaxCmapsOfScreen XMaxCmapsOfScreen_dylibloader_orig_xlib +#define XMinCmapsOfScreen XMinCmapsOfScreen_dylibloader_orig_xlib +#define XMoveResizeWindow XMoveResizeWindow_dylibloader_orig_xlib +#define XMoveWindow XMoveWindow_dylibloader_orig_xlib +#define XNextEvent XNextEvent_dylibloader_orig_xlib +#define XNoOp XNoOp_dylibloader_orig_xlib +#define XParseColor XParseColor_dylibloader_orig_xlib +#define XParseGeometry XParseGeometry_dylibloader_orig_xlib +#define XPeekEvent XPeekEvent_dylibloader_orig_xlib +#define XPeekIfEvent XPeekIfEvent_dylibloader_orig_xlib +#define XPending XPending_dylibloader_orig_xlib +#define XPlanesOfScreen XPlanesOfScreen_dylibloader_orig_xlib +#define XProtocolRevision XProtocolRevision_dylibloader_orig_xlib +#define XProtocolVersion XProtocolVersion_dylibloader_orig_xlib +#define XPutBackEvent XPutBackEvent_dylibloader_orig_xlib +#define XPutImage XPutImage_dylibloader_orig_xlib +#define XQLength XQLength_dylibloader_orig_xlib +#define XQueryBestCursor XQueryBestCursor_dylibloader_orig_xlib +#define XQueryBestSize XQueryBestSize_dylibloader_orig_xlib +#define XQueryBestStipple XQueryBestStipple_dylibloader_orig_xlib +#define XQueryBestTile XQueryBestTile_dylibloader_orig_xlib +#define XQueryColor XQueryColor_dylibloader_orig_xlib +#define XQueryColors XQueryColors_dylibloader_orig_xlib +#define XQueryExtension XQueryExtension_dylibloader_orig_xlib +#define XQueryKeymap XQueryKeymap_dylibloader_orig_xlib +#define XQueryPointer XQueryPointer_dylibloader_orig_xlib +#define XQueryTextExtents XQueryTextExtents_dylibloader_orig_xlib +#define XQueryTextExtents16 XQueryTextExtents16_dylibloader_orig_xlib +#define XQueryTree XQueryTree_dylibloader_orig_xlib +#define XRaiseWindow XRaiseWindow_dylibloader_orig_xlib +#define XReadBitmapFile XReadBitmapFile_dylibloader_orig_xlib +#define XReadBitmapFileData XReadBitmapFileData_dylibloader_orig_xlib +#define XRebindKeysym XRebindKeysym_dylibloader_orig_xlib +#define XRecolorCursor XRecolorCursor_dylibloader_orig_xlib +#define XRefreshKeyboardMapping XRefreshKeyboardMapping_dylibloader_orig_xlib +#define XRemoveFromSaveSet XRemoveFromSaveSet_dylibloader_orig_xlib +#define XRemoveHost XRemoveHost_dylibloader_orig_xlib +#define XRemoveHosts XRemoveHosts_dylibloader_orig_xlib +#define XReparentWindow XReparentWindow_dylibloader_orig_xlib +#define XResetScreenSaver XResetScreenSaver_dylibloader_orig_xlib +#define XResizeWindow XResizeWindow_dylibloader_orig_xlib +#define XRestackWindows XRestackWindows_dylibloader_orig_xlib +#define XRotateBuffers XRotateBuffers_dylibloader_orig_xlib +#define XRotateWindowProperties XRotateWindowProperties_dylibloader_orig_xlib +#define XScreenCount XScreenCount_dylibloader_orig_xlib +#define XSelectInput XSelectInput_dylibloader_orig_xlib +#define XSendEvent XSendEvent_dylibloader_orig_xlib +#define XSetAccessControl XSetAccessControl_dylibloader_orig_xlib +#define XSetArcMode XSetArcMode_dylibloader_orig_xlib +#define XSetBackground XSetBackground_dylibloader_orig_xlib +#define XSetClipMask XSetClipMask_dylibloader_orig_xlib +#define XSetClipOrigin XSetClipOrigin_dylibloader_orig_xlib +#define XSetClipRectangles XSetClipRectangles_dylibloader_orig_xlib +#define XSetCloseDownMode XSetCloseDownMode_dylibloader_orig_xlib +#define XSetCommand XSetCommand_dylibloader_orig_xlib +#define XSetDashes XSetDashes_dylibloader_orig_xlib +#define XSetFillRule XSetFillRule_dylibloader_orig_xlib +#define XSetFillStyle XSetFillStyle_dylibloader_orig_xlib +#define XSetFont XSetFont_dylibloader_orig_xlib +#define XSetFontPath XSetFontPath_dylibloader_orig_xlib +#define XSetForeground XSetForeground_dylibloader_orig_xlib +#define XSetFunction XSetFunction_dylibloader_orig_xlib +#define XSetGraphicsExposures XSetGraphicsExposures_dylibloader_orig_xlib +#define XSetIconName XSetIconName_dylibloader_orig_xlib +#define XSetInputFocus XSetInputFocus_dylibloader_orig_xlib +#define XSetLineAttributes XSetLineAttributes_dylibloader_orig_xlib +#define XSetModifierMapping XSetModifierMapping_dylibloader_orig_xlib +#define XSetPlaneMask XSetPlaneMask_dylibloader_orig_xlib +#define XSetPointerMapping XSetPointerMapping_dylibloader_orig_xlib +#define XSetScreenSaver XSetScreenSaver_dylibloader_orig_xlib +#define XSetSelectionOwner XSetSelectionOwner_dylibloader_orig_xlib +#define XSetState XSetState_dylibloader_orig_xlib +#define XSetStipple XSetStipple_dylibloader_orig_xlib +#define XSetSubwindowMode XSetSubwindowMode_dylibloader_orig_xlib +#define XSetTSOrigin XSetTSOrigin_dylibloader_orig_xlib +#define XSetTile XSetTile_dylibloader_orig_xlib +#define XSetWindowBackground XSetWindowBackground_dylibloader_orig_xlib +#define XSetWindowBackgroundPixmap XSetWindowBackgroundPixmap_dylibloader_orig_xlib +#define XSetWindowBorder XSetWindowBorder_dylibloader_orig_xlib +#define XSetWindowBorderPixmap XSetWindowBorderPixmap_dylibloader_orig_xlib +#define XSetWindowBorderWidth XSetWindowBorderWidth_dylibloader_orig_xlib +#define XSetWindowColormap XSetWindowColormap_dylibloader_orig_xlib +#define XStoreBuffer XStoreBuffer_dylibloader_orig_xlib +#define XStoreBytes XStoreBytes_dylibloader_orig_xlib +#define XStoreColor XStoreColor_dylibloader_orig_xlib +#define XStoreColors XStoreColors_dylibloader_orig_xlib +#define XStoreName XStoreName_dylibloader_orig_xlib +#define XStoreNamedColor XStoreNamedColor_dylibloader_orig_xlib +#define XSync XSync_dylibloader_orig_xlib +#define XTextExtents XTextExtents_dylibloader_orig_xlib +#define XTextExtents16 XTextExtents16_dylibloader_orig_xlib +#define XTextWidth XTextWidth_dylibloader_orig_xlib +#define XTextWidth16 XTextWidth16_dylibloader_orig_xlib +#define XTranslateCoordinates XTranslateCoordinates_dylibloader_orig_xlib +#define XUndefineCursor XUndefineCursor_dylibloader_orig_xlib +#define XUngrabButton XUngrabButton_dylibloader_orig_xlib +#define XUngrabKey XUngrabKey_dylibloader_orig_xlib +#define XUngrabKeyboard XUngrabKeyboard_dylibloader_orig_xlib +#define XUngrabPointer XUngrabPointer_dylibloader_orig_xlib +#define XUngrabServer XUngrabServer_dylibloader_orig_xlib +#define XUninstallColormap XUninstallColormap_dylibloader_orig_xlib +#define XUnloadFont XUnloadFont_dylibloader_orig_xlib +#define XUnmapSubwindows XUnmapSubwindows_dylibloader_orig_xlib +#define XUnmapWindow XUnmapWindow_dylibloader_orig_xlib +#define XVendorRelease XVendorRelease_dylibloader_orig_xlib +#define XWarpPointer XWarpPointer_dylibloader_orig_xlib +#define XWidthMMOfScreen XWidthMMOfScreen_dylibloader_orig_xlib +#define XWidthOfScreen XWidthOfScreen_dylibloader_orig_xlib +#define XWindowEvent XWindowEvent_dylibloader_orig_xlib +#define XWriteBitmapFile XWriteBitmapFile_dylibloader_orig_xlib +#define XSupportsLocale XSupportsLocale_dylibloader_orig_xlib +#define XSetLocaleModifiers XSetLocaleModifiers_dylibloader_orig_xlib +#define XOpenOM XOpenOM_dylibloader_orig_xlib +#define XCloseOM XCloseOM_dylibloader_orig_xlib +#define XSetOMValues XSetOMValues_dylibloader_orig_xlib +#define XGetOMValues XGetOMValues_dylibloader_orig_xlib +#define XDisplayOfOM XDisplayOfOM_dylibloader_orig_xlib +#define XLocaleOfOM XLocaleOfOM_dylibloader_orig_xlib +#define XCreateOC XCreateOC_dylibloader_orig_xlib +#define XDestroyOC XDestroyOC_dylibloader_orig_xlib +#define XOMOfOC XOMOfOC_dylibloader_orig_xlib +#define XSetOCValues XSetOCValues_dylibloader_orig_xlib +#define XGetOCValues XGetOCValues_dylibloader_orig_xlib +#define XCreateFontSet XCreateFontSet_dylibloader_orig_xlib +#define XFreeFontSet XFreeFontSet_dylibloader_orig_xlib +#define XFontsOfFontSet XFontsOfFontSet_dylibloader_orig_xlib +#define XBaseFontNameListOfFontSet XBaseFontNameListOfFontSet_dylibloader_orig_xlib +#define XLocaleOfFontSet XLocaleOfFontSet_dylibloader_orig_xlib +#define XContextDependentDrawing XContextDependentDrawing_dylibloader_orig_xlib +#define XDirectionalDependentDrawing XDirectionalDependentDrawing_dylibloader_orig_xlib +#define XContextualDrawing XContextualDrawing_dylibloader_orig_xlib +#define XExtentsOfFontSet XExtentsOfFontSet_dylibloader_orig_xlib +#define XmbTextEscapement XmbTextEscapement_dylibloader_orig_xlib +#define XwcTextEscapement XwcTextEscapement_dylibloader_orig_xlib +#define Xutf8TextEscapement Xutf8TextEscapement_dylibloader_orig_xlib +#define XmbTextExtents XmbTextExtents_dylibloader_orig_xlib +#define XwcTextExtents XwcTextExtents_dylibloader_orig_xlib +#define Xutf8TextExtents Xutf8TextExtents_dylibloader_orig_xlib +#define XmbTextPerCharExtents XmbTextPerCharExtents_dylibloader_orig_xlib +#define XwcTextPerCharExtents XwcTextPerCharExtents_dylibloader_orig_xlib +#define Xutf8TextPerCharExtents Xutf8TextPerCharExtents_dylibloader_orig_xlib +#define XmbDrawText XmbDrawText_dylibloader_orig_xlib +#define XwcDrawText XwcDrawText_dylibloader_orig_xlib +#define Xutf8DrawText Xutf8DrawText_dylibloader_orig_xlib +#define XmbDrawString XmbDrawString_dylibloader_orig_xlib +#define XwcDrawString XwcDrawString_dylibloader_orig_xlib +#define Xutf8DrawString Xutf8DrawString_dylibloader_orig_xlib +#define XmbDrawImageString XmbDrawImageString_dylibloader_orig_xlib +#define XwcDrawImageString XwcDrawImageString_dylibloader_orig_xlib +#define Xutf8DrawImageString Xutf8DrawImageString_dylibloader_orig_xlib +#define XOpenIM XOpenIM_dylibloader_orig_xlib +#define XCloseIM XCloseIM_dylibloader_orig_xlib +#define XGetIMValues XGetIMValues_dylibloader_orig_xlib +#define XSetIMValues XSetIMValues_dylibloader_orig_xlib +#define XDisplayOfIM XDisplayOfIM_dylibloader_orig_xlib +#define XLocaleOfIM XLocaleOfIM_dylibloader_orig_xlib +#define XCreateIC XCreateIC_dylibloader_orig_xlib +#define XDestroyIC XDestroyIC_dylibloader_orig_xlib +#define XSetICFocus XSetICFocus_dylibloader_orig_xlib +#define XUnsetICFocus XUnsetICFocus_dylibloader_orig_xlib +#define XwcResetIC XwcResetIC_dylibloader_orig_xlib +#define XmbResetIC XmbResetIC_dylibloader_orig_xlib +#define Xutf8ResetIC Xutf8ResetIC_dylibloader_orig_xlib +#define XSetICValues XSetICValues_dylibloader_orig_xlib +#define XGetICValues XGetICValues_dylibloader_orig_xlib +#define XIMOfIC XIMOfIC_dylibloader_orig_xlib +#define XFilterEvent XFilterEvent_dylibloader_orig_xlib +#define XmbLookupString XmbLookupString_dylibloader_orig_xlib +#define XwcLookupString XwcLookupString_dylibloader_orig_xlib +#define Xutf8LookupString Xutf8LookupString_dylibloader_orig_xlib +#define XVaCreateNestedList XVaCreateNestedList_dylibloader_orig_xlib +#define XRegisterIMInstantiateCallback XRegisterIMInstantiateCallback_dylibloader_orig_xlib +#define XUnregisterIMInstantiateCallback XUnregisterIMInstantiateCallback_dylibloader_orig_xlib +#define XInternalConnectionNumbers XInternalConnectionNumbers_dylibloader_orig_xlib +#define XProcessInternalConnection XProcessInternalConnection_dylibloader_orig_xlib +#define XAddConnectionWatch XAddConnectionWatch_dylibloader_orig_xlib +#define XRemoveConnectionWatch XRemoveConnectionWatch_dylibloader_orig_xlib +#define XSetAuthorization XSetAuthorization_dylibloader_orig_xlib +#define _Xmbtowc _Xmbtowc_dylibloader_orig_xlib +#define _Xwctomb _Xwctomb_dylibloader_orig_xlib +#define XGetEventData XGetEventData_dylibloader_orig_xlib +#define XFreeEventData XFreeEventData_dylibloader_orig_xlib +#define XAllocClassHint XAllocClassHint_dylibloader_orig_xlib +#define XAllocIconSize XAllocIconSize_dylibloader_orig_xlib +#define XAllocSizeHints XAllocSizeHints_dylibloader_orig_xlib +#define XAllocStandardColormap XAllocStandardColormap_dylibloader_orig_xlib +#define XAllocWMHints XAllocWMHints_dylibloader_orig_xlib +#define XClipBox XClipBox_dylibloader_orig_xlib +#define XCreateRegion XCreateRegion_dylibloader_orig_xlib +#define XDefaultString XDefaultString_dylibloader_orig_xlib +#define XDeleteContext XDeleteContext_dylibloader_orig_xlib +#define XDestroyRegion XDestroyRegion_dylibloader_orig_xlib +#define XEmptyRegion XEmptyRegion_dylibloader_orig_xlib +#define XEqualRegion XEqualRegion_dylibloader_orig_xlib +#define XFindContext XFindContext_dylibloader_orig_xlib +#define XGetClassHint XGetClassHint_dylibloader_orig_xlib +#define XGetIconSizes XGetIconSizes_dylibloader_orig_xlib +#define XGetNormalHints XGetNormalHints_dylibloader_orig_xlib +#define XGetRGBColormaps XGetRGBColormaps_dylibloader_orig_xlib +#define XGetSizeHints XGetSizeHints_dylibloader_orig_xlib +#define XGetStandardColormap XGetStandardColormap_dylibloader_orig_xlib +#define XGetTextProperty XGetTextProperty_dylibloader_orig_xlib +#define XGetVisualInfo XGetVisualInfo_dylibloader_orig_xlib +#define XGetWMClientMachine XGetWMClientMachine_dylibloader_orig_xlib +#define XGetWMHints XGetWMHints_dylibloader_orig_xlib +#define XGetWMIconName XGetWMIconName_dylibloader_orig_xlib +#define XGetWMName XGetWMName_dylibloader_orig_xlib +#define XGetWMNormalHints XGetWMNormalHints_dylibloader_orig_xlib +#define XGetWMSizeHints XGetWMSizeHints_dylibloader_orig_xlib +#define XGetZoomHints XGetZoomHints_dylibloader_orig_xlib +#define XIntersectRegion XIntersectRegion_dylibloader_orig_xlib +#define XConvertCase XConvertCase_dylibloader_orig_xlib +#define XLookupString XLookupString_dylibloader_orig_xlib +#define XMatchVisualInfo XMatchVisualInfo_dylibloader_orig_xlib +#define XOffsetRegion XOffsetRegion_dylibloader_orig_xlib +#define XPointInRegion XPointInRegion_dylibloader_orig_xlib +#define XPolygonRegion XPolygonRegion_dylibloader_orig_xlib +#define XRectInRegion XRectInRegion_dylibloader_orig_xlib +#define XSaveContext XSaveContext_dylibloader_orig_xlib +#define XSetClassHint XSetClassHint_dylibloader_orig_xlib +#define XSetIconSizes XSetIconSizes_dylibloader_orig_xlib +#define XSetNormalHints XSetNormalHints_dylibloader_orig_xlib +#define XSetRGBColormaps XSetRGBColormaps_dylibloader_orig_xlib +#define XSetSizeHints XSetSizeHints_dylibloader_orig_xlib +#define XSetStandardProperties XSetStandardProperties_dylibloader_orig_xlib +#define XSetTextProperty XSetTextProperty_dylibloader_orig_xlib +#define XSetWMClientMachine XSetWMClientMachine_dylibloader_orig_xlib +#define XSetWMHints XSetWMHints_dylibloader_orig_xlib +#define XSetWMIconName XSetWMIconName_dylibloader_orig_xlib +#define XSetWMName XSetWMName_dylibloader_orig_xlib +#define XSetWMNormalHints XSetWMNormalHints_dylibloader_orig_xlib +#define XSetWMProperties XSetWMProperties_dylibloader_orig_xlib +#define XmbSetWMProperties XmbSetWMProperties_dylibloader_orig_xlib +#define Xutf8SetWMProperties Xutf8SetWMProperties_dylibloader_orig_xlib +#define XSetWMSizeHints XSetWMSizeHints_dylibloader_orig_xlib +#define XSetRegion XSetRegion_dylibloader_orig_xlib +#define XSetStandardColormap XSetStandardColormap_dylibloader_orig_xlib +#define XSetZoomHints XSetZoomHints_dylibloader_orig_xlib +#define XShrinkRegion XShrinkRegion_dylibloader_orig_xlib +#define XStringListToTextProperty XStringListToTextProperty_dylibloader_orig_xlib +#define XSubtractRegion XSubtractRegion_dylibloader_orig_xlib +#define XmbTextListToTextProperty XmbTextListToTextProperty_dylibloader_orig_xlib +#define XwcTextListToTextProperty XwcTextListToTextProperty_dylibloader_orig_xlib +#define Xutf8TextListToTextProperty Xutf8TextListToTextProperty_dylibloader_orig_xlib +#define XwcFreeStringList XwcFreeStringList_dylibloader_orig_xlib +#define XTextPropertyToStringList XTextPropertyToStringList_dylibloader_orig_xlib +#define XmbTextPropertyToTextList XmbTextPropertyToTextList_dylibloader_orig_xlib +#define XwcTextPropertyToTextList XwcTextPropertyToTextList_dylibloader_orig_xlib +#define Xutf8TextPropertyToTextList Xutf8TextPropertyToTextList_dylibloader_orig_xlib +#define XUnionRectWithRegion XUnionRectWithRegion_dylibloader_orig_xlib +#define XUnionRegion XUnionRegion_dylibloader_orig_xlib +#define XWMGeometry XWMGeometry_dylibloader_orig_xlib +#define XXorRegion XXorRegion_dylibloader_orig_xlib +#define XkbIgnoreExtension XkbIgnoreExtension_dylibloader_orig_xlib +#define XkbOpenDisplay XkbOpenDisplay_dylibloader_orig_xlib +#define XkbQueryExtension XkbQueryExtension_dylibloader_orig_xlib +#define XkbUseExtension XkbUseExtension_dylibloader_orig_xlib +#define XkbLibraryVersion XkbLibraryVersion_dylibloader_orig_xlib +#define XkbSetXlibControls XkbSetXlibControls_dylibloader_orig_xlib +#define XkbGetXlibControls XkbGetXlibControls_dylibloader_orig_xlib +#define XkbXlibControlsImplemented XkbXlibControlsImplemented_dylibloader_orig_xlib +#define XkbSetAtomFuncs XkbSetAtomFuncs_dylibloader_orig_xlib +#define XkbKeycodeToKeysym XkbKeycodeToKeysym_dylibloader_orig_xlib +#define XkbKeysymToModifiers XkbKeysymToModifiers_dylibloader_orig_xlib +#define XkbLookupKeySym XkbLookupKeySym_dylibloader_orig_xlib +#define XkbLookupKeyBinding XkbLookupKeyBinding_dylibloader_orig_xlib +#define XkbTranslateKeyCode XkbTranslateKeyCode_dylibloader_orig_xlib +#define XkbTranslateKeySym XkbTranslateKeySym_dylibloader_orig_xlib +#define XkbSetAutoRepeatRate XkbSetAutoRepeatRate_dylibloader_orig_xlib +#define XkbGetAutoRepeatRate XkbGetAutoRepeatRate_dylibloader_orig_xlib +#define XkbChangeEnabledControls XkbChangeEnabledControls_dylibloader_orig_xlib +#define XkbDeviceBell XkbDeviceBell_dylibloader_orig_xlib +#define XkbForceDeviceBell XkbForceDeviceBell_dylibloader_orig_xlib +#define XkbDeviceBellEvent XkbDeviceBellEvent_dylibloader_orig_xlib +#define XkbBell XkbBell_dylibloader_orig_xlib +#define XkbForceBell XkbForceBell_dylibloader_orig_xlib +#define XkbBellEvent XkbBellEvent_dylibloader_orig_xlib +#define XkbSelectEvents XkbSelectEvents_dylibloader_orig_xlib +#define XkbSelectEventDetails XkbSelectEventDetails_dylibloader_orig_xlib +#define XkbNoteMapChanges XkbNoteMapChanges_dylibloader_orig_xlib +#define XkbNoteNameChanges XkbNoteNameChanges_dylibloader_orig_xlib +#define XkbGetIndicatorState XkbGetIndicatorState_dylibloader_orig_xlib +#define XkbGetIndicatorMap XkbGetIndicatorMap_dylibloader_orig_xlib +#define XkbSetIndicatorMap XkbSetIndicatorMap_dylibloader_orig_xlib +#define XkbGetNamedIndicator XkbGetNamedIndicator_dylibloader_orig_xlib +#define XkbGetNamedDeviceIndicator XkbGetNamedDeviceIndicator_dylibloader_orig_xlib +#define XkbSetNamedIndicator XkbSetNamedIndicator_dylibloader_orig_xlib +#define XkbSetNamedDeviceIndicator XkbSetNamedDeviceIndicator_dylibloader_orig_xlib +#define XkbLockModifiers XkbLockModifiers_dylibloader_orig_xlib +#define XkbLatchModifiers XkbLatchModifiers_dylibloader_orig_xlib +#define XkbLockGroup XkbLockGroup_dylibloader_orig_xlib +#define XkbLatchGroup XkbLatchGroup_dylibloader_orig_xlib +#define XkbSetServerInternalMods XkbSetServerInternalMods_dylibloader_orig_xlib +#define XkbSetIgnoreLockMods XkbSetIgnoreLockMods_dylibloader_orig_xlib +#define XkbVirtualModsToReal XkbVirtualModsToReal_dylibloader_orig_xlib +#define XkbComputeEffectiveMap XkbComputeEffectiveMap_dylibloader_orig_xlib +#define XkbInitCanonicalKeyTypes XkbInitCanonicalKeyTypes_dylibloader_orig_xlib +#define XkbAllocKeyboard XkbAllocKeyboard_dylibloader_orig_xlib +#define XkbFreeKeyboard XkbFreeKeyboard_dylibloader_orig_xlib +#define XkbAllocClientMap XkbAllocClientMap_dylibloader_orig_xlib +#define XkbAllocServerMap XkbAllocServerMap_dylibloader_orig_xlib +#define XkbFreeClientMap XkbFreeClientMap_dylibloader_orig_xlib +#define XkbFreeServerMap XkbFreeServerMap_dylibloader_orig_xlib +#define XkbAddKeyType XkbAddKeyType_dylibloader_orig_xlib +#define XkbAllocIndicatorMaps XkbAllocIndicatorMaps_dylibloader_orig_xlib +#define XkbFreeIndicatorMaps XkbFreeIndicatorMaps_dylibloader_orig_xlib +#define XkbGetMap XkbGetMap_dylibloader_orig_xlib +#define XkbGetUpdatedMap XkbGetUpdatedMap_dylibloader_orig_xlib +#define XkbGetMapChanges XkbGetMapChanges_dylibloader_orig_xlib +#define XkbRefreshKeyboardMapping XkbRefreshKeyboardMapping_dylibloader_orig_xlib +#define XkbGetKeyTypes XkbGetKeyTypes_dylibloader_orig_xlib +#define XkbGetKeySyms XkbGetKeySyms_dylibloader_orig_xlib +#define XkbGetKeyActions XkbGetKeyActions_dylibloader_orig_xlib +#define XkbGetKeyBehaviors XkbGetKeyBehaviors_dylibloader_orig_xlib +#define XkbGetVirtualMods XkbGetVirtualMods_dylibloader_orig_xlib +#define XkbGetKeyExplicitComponents XkbGetKeyExplicitComponents_dylibloader_orig_xlib +#define XkbGetKeyModifierMap XkbGetKeyModifierMap_dylibloader_orig_xlib +#define XkbGetKeyVirtualModMap XkbGetKeyVirtualModMap_dylibloader_orig_xlib +#define XkbAllocControls XkbAllocControls_dylibloader_orig_xlib +#define XkbFreeControls XkbFreeControls_dylibloader_orig_xlib +#define XkbGetControls XkbGetControls_dylibloader_orig_xlib +#define XkbSetControls XkbSetControls_dylibloader_orig_xlib +#define XkbNoteControlsChanges XkbNoteControlsChanges_dylibloader_orig_xlib +#define XkbAllocCompatMap XkbAllocCompatMap_dylibloader_orig_xlib +#define XkbFreeCompatMap XkbFreeCompatMap_dylibloader_orig_xlib +#define XkbGetCompatMap XkbGetCompatMap_dylibloader_orig_xlib +#define XkbSetCompatMap XkbSetCompatMap_dylibloader_orig_xlib +#define XkbAllocNames XkbAllocNames_dylibloader_orig_xlib +#define XkbGetNames XkbGetNames_dylibloader_orig_xlib +#define XkbSetNames XkbSetNames_dylibloader_orig_xlib +#define XkbChangeNames XkbChangeNames_dylibloader_orig_xlib +#define XkbFreeNames XkbFreeNames_dylibloader_orig_xlib +#define XkbGetState XkbGetState_dylibloader_orig_xlib +#define XkbSetMap XkbSetMap_dylibloader_orig_xlib +#define XkbChangeMap XkbChangeMap_dylibloader_orig_xlib +#define XkbSetDetectableAutoRepeat XkbSetDetectableAutoRepeat_dylibloader_orig_xlib +#define XkbGetDetectableAutoRepeat XkbGetDetectableAutoRepeat_dylibloader_orig_xlib +#define XkbSetAutoResetControls XkbSetAutoResetControls_dylibloader_orig_xlib +#define XkbGetAutoResetControls XkbGetAutoResetControls_dylibloader_orig_xlib +#define XkbSetPerClientControls XkbSetPerClientControls_dylibloader_orig_xlib +#define XkbGetPerClientControls XkbGetPerClientControls_dylibloader_orig_xlib +#define XkbCopyKeyType XkbCopyKeyType_dylibloader_orig_xlib +#define XkbCopyKeyTypes XkbCopyKeyTypes_dylibloader_orig_xlib +#define XkbResizeKeyType XkbResizeKeyType_dylibloader_orig_xlib +#define XkbResizeKeySyms XkbResizeKeySyms_dylibloader_orig_xlib +#define XkbResizeKeyActions XkbResizeKeyActions_dylibloader_orig_xlib +#define XkbChangeTypesOfKey XkbChangeTypesOfKey_dylibloader_orig_xlib +#define XkbChangeKeycodeRange XkbChangeKeycodeRange_dylibloader_orig_xlib +#define XkbListComponents XkbListComponents_dylibloader_orig_xlib +#define XkbFreeComponentList XkbFreeComponentList_dylibloader_orig_xlib +#define XkbGetKeyboard XkbGetKeyboard_dylibloader_orig_xlib +#define XkbGetKeyboardByName XkbGetKeyboardByName_dylibloader_orig_xlib +#define XkbKeyTypesForCoreSymbols XkbKeyTypesForCoreSymbols_dylibloader_orig_xlib +#define XkbApplyCompatMapToKey XkbApplyCompatMapToKey_dylibloader_orig_xlib +#define XkbUpdateMapFromCore XkbUpdateMapFromCore_dylibloader_orig_xlib +#define XkbAddDeviceLedInfo XkbAddDeviceLedInfo_dylibloader_orig_xlib +#define XkbResizeDeviceButtonActions XkbResizeDeviceButtonActions_dylibloader_orig_xlib +#define XkbAllocDeviceInfo XkbAllocDeviceInfo_dylibloader_orig_xlib +#define XkbFreeDeviceInfo XkbFreeDeviceInfo_dylibloader_orig_xlib +#define XkbNoteDeviceChanges XkbNoteDeviceChanges_dylibloader_orig_xlib +#define XkbGetDeviceInfo XkbGetDeviceInfo_dylibloader_orig_xlib +#define XkbGetDeviceInfoChanges XkbGetDeviceInfoChanges_dylibloader_orig_xlib +#define XkbGetDeviceButtonActions XkbGetDeviceButtonActions_dylibloader_orig_xlib +#define XkbGetDeviceLedInfo XkbGetDeviceLedInfo_dylibloader_orig_xlib +#define XkbSetDeviceInfo XkbSetDeviceInfo_dylibloader_orig_xlib +#define XkbChangeDeviceInfo XkbChangeDeviceInfo_dylibloader_orig_xlib +#define XkbSetDeviceLedInfo XkbSetDeviceLedInfo_dylibloader_orig_xlib +#define XkbSetDeviceButtonActions XkbSetDeviceButtonActions_dylibloader_orig_xlib +#define XkbToControl XkbToControl_dylibloader_orig_xlib +#define XkbSetDebuggingFlags XkbSetDebuggingFlags_dylibloader_orig_xlib +#define XkbApplyVirtualModChanges XkbApplyVirtualModChanges_dylibloader_orig_xlib +#define XkbUpdateActionVirtualMods XkbUpdateActionVirtualMods_dylibloader_orig_xlib +#define XkbUpdateKeyTypeVirtualMods XkbUpdateKeyTypeVirtualMods_dylibloader_orig_xlib +#include <X11/Xlib.h> +#include <X11/Xutil.h> +#include <X11/XKBlib.h> +#undef _Xmblen +#undef XLoadQueryFont +#undef XQueryFont +#undef XGetMotionEvents +#undef XDeleteModifiermapEntry +#undef XGetModifierMapping +#undef XInsertModifiermapEntry +#undef XNewModifiermap +#undef XCreateImage +#undef XInitImage +#undef XGetImage +#undef XGetSubImage +#undef XOpenDisplay +#undef XrmInitialize +#undef XFetchBytes +#undef XFetchBuffer +#undef XGetAtomName +#undef XGetAtomNames +#undef XGetDefault +#undef XDisplayName +#undef XKeysymToString +#undef XSynchronize +#undef XSetAfterFunction +#undef XInternAtom +#undef XInternAtoms +#undef XCopyColormapAndFree +#undef XCreateColormap +#undef XCreatePixmapCursor +#undef XCreateGlyphCursor +#undef XCreateFontCursor +#undef XLoadFont +#undef XCreateGC +#undef XGContextFromGC +#undef XFlushGC +#undef XCreatePixmap +#undef XCreateBitmapFromData +#undef XCreatePixmapFromBitmapData +#undef XCreateSimpleWindow +#undef XGetSelectionOwner +#undef XCreateWindow +#undef XListInstalledColormaps +#undef XListFonts +#undef XListFontsWithInfo +#undef XGetFontPath +#undef XListExtensions +#undef XListProperties +#undef XListHosts +#undef XKeycodeToKeysym +#undef XLookupKeysym +#undef XGetKeyboardMapping +#undef XStringToKeysym +#undef XMaxRequestSize +#undef XExtendedMaxRequestSize +#undef XResourceManagerString +#undef XScreenResourceString +#undef XDisplayMotionBufferSize +#undef XVisualIDFromVisual +#undef XInitThreads +#undef XLockDisplay +#undef XUnlockDisplay +#undef XInitExtension +#undef XAddExtension +#undef XFindOnExtensionList +#undef XEHeadOfExtensionList +#undef XRootWindow +#undef XDefaultRootWindow +#undef XRootWindowOfScreen +#undef XDefaultVisual +#undef XDefaultVisualOfScreen +#undef XDefaultGC +#undef XDefaultGCOfScreen +#undef XBlackPixel +#undef XWhitePixel +#undef XAllPlanes +#undef XBlackPixelOfScreen +#undef XWhitePixelOfScreen +#undef XNextRequest +#undef XLastKnownRequestProcessed +#undef XServerVendor +#undef XDisplayString +#undef XDefaultColormap +#undef XDefaultColormapOfScreen +#undef XDisplayOfScreen +#undef XScreenOfDisplay +#undef XDefaultScreenOfDisplay +#undef XEventMaskOfScreen +#undef XScreenNumberOfScreen +#undef XSetErrorHandler +#undef XSetIOErrorHandler +#undef XListPixmapFormats +#undef XListDepths +#undef XReconfigureWMWindow +#undef XGetWMProtocols +#undef XSetWMProtocols +#undef XIconifyWindow +#undef XWithdrawWindow +#undef XGetCommand +#undef XGetWMColormapWindows +#undef XSetWMColormapWindows +#undef XFreeStringList +#undef XSetTransientForHint +#undef XActivateScreenSaver +#undef XAddHost +#undef XAddHosts +#undef XAddToExtensionList +#undef XAddToSaveSet +#undef XAllocColor +#undef XAllocColorCells +#undef XAllocColorPlanes +#undef XAllocNamedColor +#undef XAllowEvents +#undef XAutoRepeatOff +#undef XAutoRepeatOn +#undef XBell +#undef XBitmapBitOrder +#undef XBitmapPad +#undef XBitmapUnit +#undef XCellsOfScreen +#undef XChangeActivePointerGrab +#undef XChangeGC +#undef XChangeKeyboardControl +#undef XChangeKeyboardMapping +#undef XChangePointerControl +#undef XChangeProperty +#undef XChangeSaveSet +#undef XChangeWindowAttributes +#undef XCheckIfEvent +#undef XCheckMaskEvent +#undef XCheckTypedEvent +#undef XCheckTypedWindowEvent +#undef XCheckWindowEvent +#undef XCirculateSubwindows +#undef XCirculateSubwindowsDown +#undef XCirculateSubwindowsUp +#undef XClearArea +#undef XClearWindow +#undef XCloseDisplay +#undef XConfigureWindow +#undef XConnectionNumber +#undef XConvertSelection +#undef XCopyArea +#undef XCopyGC +#undef XCopyPlane +#undef XDefaultDepth +#undef XDefaultDepthOfScreen +#undef XDefaultScreen +#undef XDefineCursor +#undef XDeleteProperty +#undef XDestroyWindow +#undef XDestroySubwindows +#undef XDoesBackingStore +#undef XDoesSaveUnders +#undef XDisableAccessControl +#undef XDisplayCells +#undef XDisplayHeight +#undef XDisplayHeightMM +#undef XDisplayKeycodes +#undef XDisplayPlanes +#undef XDisplayWidth +#undef XDisplayWidthMM +#undef XDrawArc +#undef XDrawArcs +#undef XDrawImageString +#undef XDrawImageString16 +#undef XDrawLine +#undef XDrawLines +#undef XDrawPoint +#undef XDrawPoints +#undef XDrawRectangle +#undef XDrawRectangles +#undef XDrawSegments +#undef XDrawString +#undef XDrawString16 +#undef XDrawText +#undef XDrawText16 +#undef XEnableAccessControl +#undef XEventsQueued +#undef XFetchName +#undef XFillArc +#undef XFillArcs +#undef XFillPolygon +#undef XFillRectangle +#undef XFillRectangles +#undef XFlush +#undef XForceScreenSaver +#undef XFree +#undef XFreeColormap +#undef XFreeColors +#undef XFreeCursor +#undef XFreeExtensionList +#undef XFreeFont +#undef XFreeFontInfo +#undef XFreeFontNames +#undef XFreeFontPath +#undef XFreeGC +#undef XFreeModifiermap +#undef XFreePixmap +#undef XGeometry +#undef XGetErrorDatabaseText +#undef XGetErrorText +#undef XGetFontProperty +#undef XGetGCValues +#undef XGetGeometry +#undef XGetIconName +#undef XGetInputFocus +#undef XGetKeyboardControl +#undef XGetPointerControl +#undef XGetPointerMapping +#undef XGetScreenSaver +#undef XGetTransientForHint +#undef XGetWindowProperty +#undef XGetWindowAttributes +#undef XGrabButton +#undef XGrabKey +#undef XGrabKeyboard +#undef XGrabPointer +#undef XGrabServer +#undef XHeightMMOfScreen +#undef XHeightOfScreen +#undef XIfEvent +#undef XImageByteOrder +#undef XInstallColormap +#undef XKeysymToKeycode +#undef XKillClient +#undef XLookupColor +#undef XLowerWindow +#undef XMapRaised +#undef XMapSubwindows +#undef XMapWindow +#undef XMaskEvent +#undef XMaxCmapsOfScreen +#undef XMinCmapsOfScreen +#undef XMoveResizeWindow +#undef XMoveWindow +#undef XNextEvent +#undef XNoOp +#undef XParseColor +#undef XParseGeometry +#undef XPeekEvent +#undef XPeekIfEvent +#undef XPending +#undef XPlanesOfScreen +#undef XProtocolRevision +#undef XProtocolVersion +#undef XPutBackEvent +#undef XPutImage +#undef XQLength +#undef XQueryBestCursor +#undef XQueryBestSize +#undef XQueryBestStipple +#undef XQueryBestTile +#undef XQueryColor +#undef XQueryColors +#undef XQueryExtension +#undef XQueryKeymap +#undef XQueryPointer +#undef XQueryTextExtents +#undef XQueryTextExtents16 +#undef XQueryTree +#undef XRaiseWindow +#undef XReadBitmapFile +#undef XReadBitmapFileData +#undef XRebindKeysym +#undef XRecolorCursor +#undef XRefreshKeyboardMapping +#undef XRemoveFromSaveSet +#undef XRemoveHost +#undef XRemoveHosts +#undef XReparentWindow +#undef XResetScreenSaver +#undef XResizeWindow +#undef XRestackWindows +#undef XRotateBuffers +#undef XRotateWindowProperties +#undef XScreenCount +#undef XSelectInput +#undef XSendEvent +#undef XSetAccessControl +#undef XSetArcMode +#undef XSetBackground +#undef XSetClipMask +#undef XSetClipOrigin +#undef XSetClipRectangles +#undef XSetCloseDownMode +#undef XSetCommand +#undef XSetDashes +#undef XSetFillRule +#undef XSetFillStyle +#undef XSetFont +#undef XSetFontPath +#undef XSetForeground +#undef XSetFunction +#undef XSetGraphicsExposures +#undef XSetIconName +#undef XSetInputFocus +#undef XSetLineAttributes +#undef XSetModifierMapping +#undef XSetPlaneMask +#undef XSetPointerMapping +#undef XSetScreenSaver +#undef XSetSelectionOwner +#undef XSetState +#undef XSetStipple +#undef XSetSubwindowMode +#undef XSetTSOrigin +#undef XSetTile +#undef XSetWindowBackground +#undef XSetWindowBackgroundPixmap +#undef XSetWindowBorder +#undef XSetWindowBorderPixmap +#undef XSetWindowBorderWidth +#undef XSetWindowColormap +#undef XStoreBuffer +#undef XStoreBytes +#undef XStoreColor +#undef XStoreColors +#undef XStoreName +#undef XStoreNamedColor +#undef XSync +#undef XTextExtents +#undef XTextExtents16 +#undef XTextWidth +#undef XTextWidth16 +#undef XTranslateCoordinates +#undef XUndefineCursor +#undef XUngrabButton +#undef XUngrabKey +#undef XUngrabKeyboard +#undef XUngrabPointer +#undef XUngrabServer +#undef XUninstallColormap +#undef XUnloadFont +#undef XUnmapSubwindows +#undef XUnmapWindow +#undef XVendorRelease +#undef XWarpPointer +#undef XWidthMMOfScreen +#undef XWidthOfScreen +#undef XWindowEvent +#undef XWriteBitmapFile +#undef XSupportsLocale +#undef XSetLocaleModifiers +#undef XOpenOM +#undef XCloseOM +#undef XSetOMValues +#undef XGetOMValues +#undef XDisplayOfOM +#undef XLocaleOfOM +#undef XCreateOC +#undef XDestroyOC +#undef XOMOfOC +#undef XSetOCValues +#undef XGetOCValues +#undef XCreateFontSet +#undef XFreeFontSet +#undef XFontsOfFontSet +#undef XBaseFontNameListOfFontSet +#undef XLocaleOfFontSet +#undef XContextDependentDrawing +#undef XDirectionalDependentDrawing +#undef XContextualDrawing +#undef XExtentsOfFontSet +#undef XmbTextEscapement +#undef XwcTextEscapement +#undef Xutf8TextEscapement +#undef XmbTextExtents +#undef XwcTextExtents +#undef Xutf8TextExtents +#undef XmbTextPerCharExtents +#undef XwcTextPerCharExtents +#undef Xutf8TextPerCharExtents +#undef XmbDrawText +#undef XwcDrawText +#undef Xutf8DrawText +#undef XmbDrawString +#undef XwcDrawString +#undef Xutf8DrawString +#undef XmbDrawImageString +#undef XwcDrawImageString +#undef Xutf8DrawImageString +#undef XOpenIM +#undef XCloseIM +#undef XGetIMValues +#undef XSetIMValues +#undef XDisplayOfIM +#undef XLocaleOfIM +#undef XCreateIC +#undef XDestroyIC +#undef XSetICFocus +#undef XUnsetICFocus +#undef XwcResetIC +#undef XmbResetIC +#undef Xutf8ResetIC +#undef XSetICValues +#undef XGetICValues +#undef XIMOfIC +#undef XFilterEvent +#undef XmbLookupString +#undef XwcLookupString +#undef Xutf8LookupString +#undef XVaCreateNestedList +#undef XRegisterIMInstantiateCallback +#undef XUnregisterIMInstantiateCallback +#undef XInternalConnectionNumbers +#undef XProcessInternalConnection +#undef XAddConnectionWatch +#undef XRemoveConnectionWatch +#undef XSetAuthorization +#undef _Xmbtowc +#undef _Xwctomb +#undef XGetEventData +#undef XFreeEventData +#undef XAllocClassHint +#undef XAllocIconSize +#undef XAllocSizeHints +#undef XAllocStandardColormap +#undef XAllocWMHints +#undef XClipBox +#undef XCreateRegion +#undef XDefaultString +#undef XDeleteContext +#undef XDestroyRegion +#undef XEmptyRegion +#undef XEqualRegion +#undef XFindContext +#undef XGetClassHint +#undef XGetIconSizes +#undef XGetNormalHints +#undef XGetRGBColormaps +#undef XGetSizeHints +#undef XGetStandardColormap +#undef XGetTextProperty +#undef XGetVisualInfo +#undef XGetWMClientMachine +#undef XGetWMHints +#undef XGetWMIconName +#undef XGetWMName +#undef XGetWMNormalHints +#undef XGetWMSizeHints +#undef XGetZoomHints +#undef XIntersectRegion +#undef XConvertCase +#undef XLookupString +#undef XMatchVisualInfo +#undef XOffsetRegion +#undef XPointInRegion +#undef XPolygonRegion +#undef XRectInRegion +#undef XSaveContext +#undef XSetClassHint +#undef XSetIconSizes +#undef XSetNormalHints +#undef XSetRGBColormaps +#undef XSetSizeHints +#undef XSetStandardProperties +#undef XSetTextProperty +#undef XSetWMClientMachine +#undef XSetWMHints +#undef XSetWMIconName +#undef XSetWMName +#undef XSetWMNormalHints +#undef XSetWMProperties +#undef XmbSetWMProperties +#undef Xutf8SetWMProperties +#undef XSetWMSizeHints +#undef XSetRegion +#undef XSetStandardColormap +#undef XSetZoomHints +#undef XShrinkRegion +#undef XStringListToTextProperty +#undef XSubtractRegion +#undef XmbTextListToTextProperty +#undef XwcTextListToTextProperty +#undef Xutf8TextListToTextProperty +#undef XwcFreeStringList +#undef XTextPropertyToStringList +#undef XmbTextPropertyToTextList +#undef XwcTextPropertyToTextList +#undef Xutf8TextPropertyToTextList +#undef XUnionRectWithRegion +#undef XUnionRegion +#undef XWMGeometry +#undef XXorRegion +#undef XkbIgnoreExtension +#undef XkbOpenDisplay +#undef XkbQueryExtension +#undef XkbUseExtension +#undef XkbLibraryVersion +#undef XkbSetXlibControls +#undef XkbGetXlibControls +#undef XkbXlibControlsImplemented +#undef XkbSetAtomFuncs +#undef XkbKeycodeToKeysym +#undef XkbKeysymToModifiers +#undef XkbLookupKeySym +#undef XkbLookupKeyBinding +#undef XkbTranslateKeyCode +#undef XkbTranslateKeySym +#undef XkbSetAutoRepeatRate +#undef XkbGetAutoRepeatRate +#undef XkbChangeEnabledControls +#undef XkbDeviceBell +#undef XkbForceDeviceBell +#undef XkbDeviceBellEvent +#undef XkbBell +#undef XkbForceBell +#undef XkbBellEvent +#undef XkbSelectEvents +#undef XkbSelectEventDetails +#undef XkbNoteMapChanges +#undef XkbNoteNameChanges +#undef XkbGetIndicatorState +#undef XkbGetIndicatorMap +#undef XkbSetIndicatorMap +#undef XkbGetNamedIndicator +#undef XkbGetNamedDeviceIndicator +#undef XkbSetNamedIndicator +#undef XkbSetNamedDeviceIndicator +#undef XkbLockModifiers +#undef XkbLatchModifiers +#undef XkbLockGroup +#undef XkbLatchGroup +#undef XkbSetServerInternalMods +#undef XkbSetIgnoreLockMods +#undef XkbVirtualModsToReal +#undef XkbComputeEffectiveMap +#undef XkbInitCanonicalKeyTypes +#undef XkbAllocKeyboard +#undef XkbFreeKeyboard +#undef XkbAllocClientMap +#undef XkbAllocServerMap +#undef XkbFreeClientMap +#undef XkbFreeServerMap +#undef XkbAddKeyType +#undef XkbAllocIndicatorMaps +#undef XkbFreeIndicatorMaps +#undef XkbGetMap +#undef XkbGetUpdatedMap +#undef XkbGetMapChanges +#undef XkbRefreshKeyboardMapping +#undef XkbGetKeyTypes +#undef XkbGetKeySyms +#undef XkbGetKeyActions +#undef XkbGetKeyBehaviors +#undef XkbGetVirtualMods +#undef XkbGetKeyExplicitComponents +#undef XkbGetKeyModifierMap +#undef XkbGetKeyVirtualModMap +#undef XkbAllocControls +#undef XkbFreeControls +#undef XkbGetControls +#undef XkbSetControls +#undef XkbNoteControlsChanges +#undef XkbAllocCompatMap +#undef XkbFreeCompatMap +#undef XkbGetCompatMap +#undef XkbSetCompatMap +#undef XkbAllocNames +#undef XkbGetNames +#undef XkbSetNames +#undef XkbChangeNames +#undef XkbFreeNames +#undef XkbGetState +#undef XkbSetMap +#undef XkbChangeMap +#undef XkbSetDetectableAutoRepeat +#undef XkbGetDetectableAutoRepeat +#undef XkbSetAutoResetControls +#undef XkbGetAutoResetControls +#undef XkbSetPerClientControls +#undef XkbGetPerClientControls +#undef XkbCopyKeyType +#undef XkbCopyKeyTypes +#undef XkbResizeKeyType +#undef XkbResizeKeySyms +#undef XkbResizeKeyActions +#undef XkbChangeTypesOfKey +#undef XkbChangeKeycodeRange +#undef XkbListComponents +#undef XkbFreeComponentList +#undef XkbGetKeyboard +#undef XkbGetKeyboardByName +#undef XkbKeyTypesForCoreSymbols +#undef XkbApplyCompatMapToKey +#undef XkbUpdateMapFromCore +#undef XkbAddDeviceLedInfo +#undef XkbResizeDeviceButtonActions +#undef XkbAllocDeviceInfo +#undef XkbFreeDeviceInfo +#undef XkbNoteDeviceChanges +#undef XkbGetDeviceInfo +#undef XkbGetDeviceInfoChanges +#undef XkbGetDeviceButtonActions +#undef XkbGetDeviceLedInfo +#undef XkbSetDeviceInfo +#undef XkbChangeDeviceInfo +#undef XkbSetDeviceLedInfo +#undef XkbSetDeviceButtonActions +#undef XkbToControl +#undef XkbSetDebuggingFlags +#undef XkbApplyVirtualModChanges +#undef XkbUpdateActionVirtualMods +#undef XkbUpdateKeyTypeVirtualMods +#ifdef __cplusplus +extern "C" { +#endif +#define _Xmblen _Xmblen_dylibloader_wrapper_xlib +#define XLoadQueryFont XLoadQueryFont_dylibloader_wrapper_xlib +#define XQueryFont XQueryFont_dylibloader_wrapper_xlib +#define XGetMotionEvents XGetMotionEvents_dylibloader_wrapper_xlib +#define XDeleteModifiermapEntry XDeleteModifiermapEntry_dylibloader_wrapper_xlib +#define XGetModifierMapping XGetModifierMapping_dylibloader_wrapper_xlib +#define XInsertModifiermapEntry XInsertModifiermapEntry_dylibloader_wrapper_xlib +#define XNewModifiermap XNewModifiermap_dylibloader_wrapper_xlib +#define XCreateImage XCreateImage_dylibloader_wrapper_xlib +#define XInitImage XInitImage_dylibloader_wrapper_xlib +#define XGetImage XGetImage_dylibloader_wrapper_xlib +#define XGetSubImage XGetSubImage_dylibloader_wrapper_xlib +#define XOpenDisplay XOpenDisplay_dylibloader_wrapper_xlib +#define XrmInitialize XrmInitialize_dylibloader_wrapper_xlib +#define XFetchBytes XFetchBytes_dylibloader_wrapper_xlib +#define XFetchBuffer XFetchBuffer_dylibloader_wrapper_xlib +#define XGetAtomName XGetAtomName_dylibloader_wrapper_xlib +#define XGetAtomNames XGetAtomNames_dylibloader_wrapper_xlib +#define XGetDefault XGetDefault_dylibloader_wrapper_xlib +#define XDisplayName XDisplayName_dylibloader_wrapper_xlib +#define XKeysymToString XKeysymToString_dylibloader_wrapper_xlib +#define XSynchronize XSynchronize_dylibloader_wrapper_xlib +#define XSetAfterFunction XSetAfterFunction_dylibloader_wrapper_xlib +#define XInternAtom XInternAtom_dylibloader_wrapper_xlib +#define XInternAtoms XInternAtoms_dylibloader_wrapper_xlib +#define XCopyColormapAndFree XCopyColormapAndFree_dylibloader_wrapper_xlib +#define XCreateColormap XCreateColormap_dylibloader_wrapper_xlib +#define XCreatePixmapCursor XCreatePixmapCursor_dylibloader_wrapper_xlib +#define XCreateGlyphCursor XCreateGlyphCursor_dylibloader_wrapper_xlib +#define XCreateFontCursor XCreateFontCursor_dylibloader_wrapper_xlib +#define XLoadFont XLoadFont_dylibloader_wrapper_xlib +#define XCreateGC XCreateGC_dylibloader_wrapper_xlib +#define XGContextFromGC XGContextFromGC_dylibloader_wrapper_xlib +#define XFlushGC XFlushGC_dylibloader_wrapper_xlib +#define XCreatePixmap XCreatePixmap_dylibloader_wrapper_xlib +#define XCreateBitmapFromData XCreateBitmapFromData_dylibloader_wrapper_xlib +#define XCreatePixmapFromBitmapData XCreatePixmapFromBitmapData_dylibloader_wrapper_xlib +#define XCreateSimpleWindow XCreateSimpleWindow_dylibloader_wrapper_xlib +#define XGetSelectionOwner XGetSelectionOwner_dylibloader_wrapper_xlib +#define XCreateWindow XCreateWindow_dylibloader_wrapper_xlib +#define XListInstalledColormaps XListInstalledColormaps_dylibloader_wrapper_xlib +#define XListFonts XListFonts_dylibloader_wrapper_xlib +#define XListFontsWithInfo XListFontsWithInfo_dylibloader_wrapper_xlib +#define XGetFontPath XGetFontPath_dylibloader_wrapper_xlib +#define XListExtensions XListExtensions_dylibloader_wrapper_xlib +#define XListProperties XListProperties_dylibloader_wrapper_xlib +#define XListHosts XListHosts_dylibloader_wrapper_xlib +#define XKeycodeToKeysym XKeycodeToKeysym_dylibloader_wrapper_xlib +#define XLookupKeysym XLookupKeysym_dylibloader_wrapper_xlib +#define XGetKeyboardMapping XGetKeyboardMapping_dylibloader_wrapper_xlib +#define XStringToKeysym XStringToKeysym_dylibloader_wrapper_xlib +#define XMaxRequestSize XMaxRequestSize_dylibloader_wrapper_xlib +#define XExtendedMaxRequestSize XExtendedMaxRequestSize_dylibloader_wrapper_xlib +#define XResourceManagerString XResourceManagerString_dylibloader_wrapper_xlib +#define XScreenResourceString XScreenResourceString_dylibloader_wrapper_xlib +#define XDisplayMotionBufferSize XDisplayMotionBufferSize_dylibloader_wrapper_xlib +#define XVisualIDFromVisual XVisualIDFromVisual_dylibloader_wrapper_xlib +#define XInitThreads XInitThreads_dylibloader_wrapper_xlib +#define XLockDisplay XLockDisplay_dylibloader_wrapper_xlib +#define XUnlockDisplay XUnlockDisplay_dylibloader_wrapper_xlib +#define XInitExtension XInitExtension_dylibloader_wrapper_xlib +#define XAddExtension XAddExtension_dylibloader_wrapper_xlib +#define XFindOnExtensionList XFindOnExtensionList_dylibloader_wrapper_xlib +#define XEHeadOfExtensionList XEHeadOfExtensionList_dylibloader_wrapper_xlib +#define XRootWindow XRootWindow_dylibloader_wrapper_xlib +#define XDefaultRootWindow XDefaultRootWindow_dylibloader_wrapper_xlib +#define XRootWindowOfScreen XRootWindowOfScreen_dylibloader_wrapper_xlib +#define XDefaultVisual XDefaultVisual_dylibloader_wrapper_xlib +#define XDefaultVisualOfScreen XDefaultVisualOfScreen_dylibloader_wrapper_xlib +#define XDefaultGC XDefaultGC_dylibloader_wrapper_xlib +#define XDefaultGCOfScreen XDefaultGCOfScreen_dylibloader_wrapper_xlib +#define XBlackPixel XBlackPixel_dylibloader_wrapper_xlib +#define XWhitePixel XWhitePixel_dylibloader_wrapper_xlib +#define XAllPlanes XAllPlanes_dylibloader_wrapper_xlib +#define XBlackPixelOfScreen XBlackPixelOfScreen_dylibloader_wrapper_xlib +#define XWhitePixelOfScreen XWhitePixelOfScreen_dylibloader_wrapper_xlib +#define XNextRequest XNextRequest_dylibloader_wrapper_xlib +#define XLastKnownRequestProcessed XLastKnownRequestProcessed_dylibloader_wrapper_xlib +#define XServerVendor XServerVendor_dylibloader_wrapper_xlib +#define XDisplayString XDisplayString_dylibloader_wrapper_xlib +#define XDefaultColormap XDefaultColormap_dylibloader_wrapper_xlib +#define XDefaultColormapOfScreen XDefaultColormapOfScreen_dylibloader_wrapper_xlib +#define XDisplayOfScreen XDisplayOfScreen_dylibloader_wrapper_xlib +#define XScreenOfDisplay XScreenOfDisplay_dylibloader_wrapper_xlib +#define XDefaultScreenOfDisplay XDefaultScreenOfDisplay_dylibloader_wrapper_xlib +#define XEventMaskOfScreen XEventMaskOfScreen_dylibloader_wrapper_xlib +#define XScreenNumberOfScreen XScreenNumberOfScreen_dylibloader_wrapper_xlib +#define XSetErrorHandler XSetErrorHandler_dylibloader_wrapper_xlib +#define XSetIOErrorHandler XSetIOErrorHandler_dylibloader_wrapper_xlib +#define XListPixmapFormats XListPixmapFormats_dylibloader_wrapper_xlib +#define XListDepths XListDepths_dylibloader_wrapper_xlib +#define XReconfigureWMWindow XReconfigureWMWindow_dylibloader_wrapper_xlib +#define XGetWMProtocols XGetWMProtocols_dylibloader_wrapper_xlib +#define XSetWMProtocols XSetWMProtocols_dylibloader_wrapper_xlib +#define XIconifyWindow XIconifyWindow_dylibloader_wrapper_xlib +#define XWithdrawWindow XWithdrawWindow_dylibloader_wrapper_xlib +#define XGetCommand XGetCommand_dylibloader_wrapper_xlib +#define XGetWMColormapWindows XGetWMColormapWindows_dylibloader_wrapper_xlib +#define XSetWMColormapWindows XSetWMColormapWindows_dylibloader_wrapper_xlib +#define XFreeStringList XFreeStringList_dylibloader_wrapper_xlib +#define XSetTransientForHint XSetTransientForHint_dylibloader_wrapper_xlib +#define XActivateScreenSaver XActivateScreenSaver_dylibloader_wrapper_xlib +#define XAddHost XAddHost_dylibloader_wrapper_xlib +#define XAddHosts XAddHosts_dylibloader_wrapper_xlib +#define XAddToExtensionList XAddToExtensionList_dylibloader_wrapper_xlib +#define XAddToSaveSet XAddToSaveSet_dylibloader_wrapper_xlib +#define XAllocColor XAllocColor_dylibloader_wrapper_xlib +#define XAllocColorCells XAllocColorCells_dylibloader_wrapper_xlib +#define XAllocColorPlanes XAllocColorPlanes_dylibloader_wrapper_xlib +#define XAllocNamedColor XAllocNamedColor_dylibloader_wrapper_xlib +#define XAllowEvents XAllowEvents_dylibloader_wrapper_xlib +#define XAutoRepeatOff XAutoRepeatOff_dylibloader_wrapper_xlib +#define XAutoRepeatOn XAutoRepeatOn_dylibloader_wrapper_xlib +#define XBell XBell_dylibloader_wrapper_xlib +#define XBitmapBitOrder XBitmapBitOrder_dylibloader_wrapper_xlib +#define XBitmapPad XBitmapPad_dylibloader_wrapper_xlib +#define XBitmapUnit XBitmapUnit_dylibloader_wrapper_xlib +#define XCellsOfScreen XCellsOfScreen_dylibloader_wrapper_xlib +#define XChangeActivePointerGrab XChangeActivePointerGrab_dylibloader_wrapper_xlib +#define XChangeGC XChangeGC_dylibloader_wrapper_xlib +#define XChangeKeyboardControl XChangeKeyboardControl_dylibloader_wrapper_xlib +#define XChangeKeyboardMapping XChangeKeyboardMapping_dylibloader_wrapper_xlib +#define XChangePointerControl XChangePointerControl_dylibloader_wrapper_xlib +#define XChangeProperty XChangeProperty_dylibloader_wrapper_xlib +#define XChangeSaveSet XChangeSaveSet_dylibloader_wrapper_xlib +#define XChangeWindowAttributes XChangeWindowAttributes_dylibloader_wrapper_xlib +#define XCheckIfEvent XCheckIfEvent_dylibloader_wrapper_xlib +#define XCheckMaskEvent XCheckMaskEvent_dylibloader_wrapper_xlib +#define XCheckTypedEvent XCheckTypedEvent_dylibloader_wrapper_xlib +#define XCheckTypedWindowEvent XCheckTypedWindowEvent_dylibloader_wrapper_xlib +#define XCheckWindowEvent XCheckWindowEvent_dylibloader_wrapper_xlib +#define XCirculateSubwindows XCirculateSubwindows_dylibloader_wrapper_xlib +#define XCirculateSubwindowsDown XCirculateSubwindowsDown_dylibloader_wrapper_xlib +#define XCirculateSubwindowsUp XCirculateSubwindowsUp_dylibloader_wrapper_xlib +#define XClearArea XClearArea_dylibloader_wrapper_xlib +#define XClearWindow XClearWindow_dylibloader_wrapper_xlib +#define XCloseDisplay XCloseDisplay_dylibloader_wrapper_xlib +#define XConfigureWindow XConfigureWindow_dylibloader_wrapper_xlib +#define XConnectionNumber XConnectionNumber_dylibloader_wrapper_xlib +#define XConvertSelection XConvertSelection_dylibloader_wrapper_xlib +#define XCopyArea XCopyArea_dylibloader_wrapper_xlib +#define XCopyGC XCopyGC_dylibloader_wrapper_xlib +#define XCopyPlane XCopyPlane_dylibloader_wrapper_xlib +#define XDefaultDepth XDefaultDepth_dylibloader_wrapper_xlib +#define XDefaultDepthOfScreen XDefaultDepthOfScreen_dylibloader_wrapper_xlib +#define XDefaultScreen XDefaultScreen_dylibloader_wrapper_xlib +#define XDefineCursor XDefineCursor_dylibloader_wrapper_xlib +#define XDeleteProperty XDeleteProperty_dylibloader_wrapper_xlib +#define XDestroyWindow XDestroyWindow_dylibloader_wrapper_xlib +#define XDestroySubwindows XDestroySubwindows_dylibloader_wrapper_xlib +#define XDoesBackingStore XDoesBackingStore_dylibloader_wrapper_xlib +#define XDoesSaveUnders XDoesSaveUnders_dylibloader_wrapper_xlib +#define XDisableAccessControl XDisableAccessControl_dylibloader_wrapper_xlib +#define XDisplayCells XDisplayCells_dylibloader_wrapper_xlib +#define XDisplayHeight XDisplayHeight_dylibloader_wrapper_xlib +#define XDisplayHeightMM XDisplayHeightMM_dylibloader_wrapper_xlib +#define XDisplayKeycodes XDisplayKeycodes_dylibloader_wrapper_xlib +#define XDisplayPlanes XDisplayPlanes_dylibloader_wrapper_xlib +#define XDisplayWidth XDisplayWidth_dylibloader_wrapper_xlib +#define XDisplayWidthMM XDisplayWidthMM_dylibloader_wrapper_xlib +#define XDrawArc XDrawArc_dylibloader_wrapper_xlib +#define XDrawArcs XDrawArcs_dylibloader_wrapper_xlib +#define XDrawImageString XDrawImageString_dylibloader_wrapper_xlib +#define XDrawImageString16 XDrawImageString16_dylibloader_wrapper_xlib +#define XDrawLine XDrawLine_dylibloader_wrapper_xlib +#define XDrawLines XDrawLines_dylibloader_wrapper_xlib +#define XDrawPoint XDrawPoint_dylibloader_wrapper_xlib +#define XDrawPoints XDrawPoints_dylibloader_wrapper_xlib +#define XDrawRectangle XDrawRectangle_dylibloader_wrapper_xlib +#define XDrawRectangles XDrawRectangles_dylibloader_wrapper_xlib +#define XDrawSegments XDrawSegments_dylibloader_wrapper_xlib +#define XDrawString XDrawString_dylibloader_wrapper_xlib +#define XDrawString16 XDrawString16_dylibloader_wrapper_xlib +#define XDrawText XDrawText_dylibloader_wrapper_xlib +#define XDrawText16 XDrawText16_dylibloader_wrapper_xlib +#define XEnableAccessControl XEnableAccessControl_dylibloader_wrapper_xlib +#define XEventsQueued XEventsQueued_dylibloader_wrapper_xlib +#define XFetchName XFetchName_dylibloader_wrapper_xlib +#define XFillArc XFillArc_dylibloader_wrapper_xlib +#define XFillArcs XFillArcs_dylibloader_wrapper_xlib +#define XFillPolygon XFillPolygon_dylibloader_wrapper_xlib +#define XFillRectangle XFillRectangle_dylibloader_wrapper_xlib +#define XFillRectangles XFillRectangles_dylibloader_wrapper_xlib +#define XFlush XFlush_dylibloader_wrapper_xlib +#define XForceScreenSaver XForceScreenSaver_dylibloader_wrapper_xlib +#define XFree XFree_dylibloader_wrapper_xlib +#define XFreeColormap XFreeColormap_dylibloader_wrapper_xlib +#define XFreeColors XFreeColors_dylibloader_wrapper_xlib +#define XFreeCursor XFreeCursor_dylibloader_wrapper_xlib +#define XFreeExtensionList XFreeExtensionList_dylibloader_wrapper_xlib +#define XFreeFont XFreeFont_dylibloader_wrapper_xlib +#define XFreeFontInfo XFreeFontInfo_dylibloader_wrapper_xlib +#define XFreeFontNames XFreeFontNames_dylibloader_wrapper_xlib +#define XFreeFontPath XFreeFontPath_dylibloader_wrapper_xlib +#define XFreeGC XFreeGC_dylibloader_wrapper_xlib +#define XFreeModifiermap XFreeModifiermap_dylibloader_wrapper_xlib +#define XFreePixmap XFreePixmap_dylibloader_wrapper_xlib +#define XGeometry XGeometry_dylibloader_wrapper_xlib +#define XGetErrorDatabaseText XGetErrorDatabaseText_dylibloader_wrapper_xlib +#define XGetErrorText XGetErrorText_dylibloader_wrapper_xlib +#define XGetFontProperty XGetFontProperty_dylibloader_wrapper_xlib +#define XGetGCValues XGetGCValues_dylibloader_wrapper_xlib +#define XGetGeometry XGetGeometry_dylibloader_wrapper_xlib +#define XGetIconName XGetIconName_dylibloader_wrapper_xlib +#define XGetInputFocus XGetInputFocus_dylibloader_wrapper_xlib +#define XGetKeyboardControl XGetKeyboardControl_dylibloader_wrapper_xlib +#define XGetPointerControl XGetPointerControl_dylibloader_wrapper_xlib +#define XGetPointerMapping XGetPointerMapping_dylibloader_wrapper_xlib +#define XGetScreenSaver XGetScreenSaver_dylibloader_wrapper_xlib +#define XGetTransientForHint XGetTransientForHint_dylibloader_wrapper_xlib +#define XGetWindowProperty XGetWindowProperty_dylibloader_wrapper_xlib +#define XGetWindowAttributes XGetWindowAttributes_dylibloader_wrapper_xlib +#define XGrabButton XGrabButton_dylibloader_wrapper_xlib +#define XGrabKey XGrabKey_dylibloader_wrapper_xlib +#define XGrabKeyboard XGrabKeyboard_dylibloader_wrapper_xlib +#define XGrabPointer XGrabPointer_dylibloader_wrapper_xlib +#define XGrabServer XGrabServer_dylibloader_wrapper_xlib +#define XHeightMMOfScreen XHeightMMOfScreen_dylibloader_wrapper_xlib +#define XHeightOfScreen XHeightOfScreen_dylibloader_wrapper_xlib +#define XIfEvent XIfEvent_dylibloader_wrapper_xlib +#define XImageByteOrder XImageByteOrder_dylibloader_wrapper_xlib +#define XInstallColormap XInstallColormap_dylibloader_wrapper_xlib +#define XKeysymToKeycode XKeysymToKeycode_dylibloader_wrapper_xlib +#define XKillClient XKillClient_dylibloader_wrapper_xlib +#define XLookupColor XLookupColor_dylibloader_wrapper_xlib +#define XLowerWindow XLowerWindow_dylibloader_wrapper_xlib +#define XMapRaised XMapRaised_dylibloader_wrapper_xlib +#define XMapSubwindows XMapSubwindows_dylibloader_wrapper_xlib +#define XMapWindow XMapWindow_dylibloader_wrapper_xlib +#define XMaskEvent XMaskEvent_dylibloader_wrapper_xlib +#define XMaxCmapsOfScreen XMaxCmapsOfScreen_dylibloader_wrapper_xlib +#define XMinCmapsOfScreen XMinCmapsOfScreen_dylibloader_wrapper_xlib +#define XMoveResizeWindow XMoveResizeWindow_dylibloader_wrapper_xlib +#define XMoveWindow XMoveWindow_dylibloader_wrapper_xlib +#define XNextEvent XNextEvent_dylibloader_wrapper_xlib +#define XNoOp XNoOp_dylibloader_wrapper_xlib +#define XParseColor XParseColor_dylibloader_wrapper_xlib +#define XParseGeometry XParseGeometry_dylibloader_wrapper_xlib +#define XPeekEvent XPeekEvent_dylibloader_wrapper_xlib +#define XPeekIfEvent XPeekIfEvent_dylibloader_wrapper_xlib +#define XPending XPending_dylibloader_wrapper_xlib +#define XPlanesOfScreen XPlanesOfScreen_dylibloader_wrapper_xlib +#define XProtocolRevision XProtocolRevision_dylibloader_wrapper_xlib +#define XProtocolVersion XProtocolVersion_dylibloader_wrapper_xlib +#define XPutBackEvent XPutBackEvent_dylibloader_wrapper_xlib +#define XPutImage XPutImage_dylibloader_wrapper_xlib +#define XQLength XQLength_dylibloader_wrapper_xlib +#define XQueryBestCursor XQueryBestCursor_dylibloader_wrapper_xlib +#define XQueryBestSize XQueryBestSize_dylibloader_wrapper_xlib +#define XQueryBestStipple XQueryBestStipple_dylibloader_wrapper_xlib +#define XQueryBestTile XQueryBestTile_dylibloader_wrapper_xlib +#define XQueryColor XQueryColor_dylibloader_wrapper_xlib +#define XQueryColors XQueryColors_dylibloader_wrapper_xlib +#define XQueryExtension XQueryExtension_dylibloader_wrapper_xlib +#define XQueryKeymap XQueryKeymap_dylibloader_wrapper_xlib +#define XQueryPointer XQueryPointer_dylibloader_wrapper_xlib +#define XQueryTextExtents XQueryTextExtents_dylibloader_wrapper_xlib +#define XQueryTextExtents16 XQueryTextExtents16_dylibloader_wrapper_xlib +#define XQueryTree XQueryTree_dylibloader_wrapper_xlib +#define XRaiseWindow XRaiseWindow_dylibloader_wrapper_xlib +#define XReadBitmapFile XReadBitmapFile_dylibloader_wrapper_xlib +#define XReadBitmapFileData XReadBitmapFileData_dylibloader_wrapper_xlib +#define XRebindKeysym XRebindKeysym_dylibloader_wrapper_xlib +#define XRecolorCursor XRecolorCursor_dylibloader_wrapper_xlib +#define XRefreshKeyboardMapping XRefreshKeyboardMapping_dylibloader_wrapper_xlib +#define XRemoveFromSaveSet XRemoveFromSaveSet_dylibloader_wrapper_xlib +#define XRemoveHost XRemoveHost_dylibloader_wrapper_xlib +#define XRemoveHosts XRemoveHosts_dylibloader_wrapper_xlib +#define XReparentWindow XReparentWindow_dylibloader_wrapper_xlib +#define XResetScreenSaver XResetScreenSaver_dylibloader_wrapper_xlib +#define XResizeWindow XResizeWindow_dylibloader_wrapper_xlib +#define XRestackWindows XRestackWindows_dylibloader_wrapper_xlib +#define XRotateBuffers XRotateBuffers_dylibloader_wrapper_xlib +#define XRotateWindowProperties XRotateWindowProperties_dylibloader_wrapper_xlib +#define XScreenCount XScreenCount_dylibloader_wrapper_xlib +#define XSelectInput XSelectInput_dylibloader_wrapper_xlib +#define XSendEvent XSendEvent_dylibloader_wrapper_xlib +#define XSetAccessControl XSetAccessControl_dylibloader_wrapper_xlib +#define XSetArcMode XSetArcMode_dylibloader_wrapper_xlib +#define XSetBackground XSetBackground_dylibloader_wrapper_xlib +#define XSetClipMask XSetClipMask_dylibloader_wrapper_xlib +#define XSetClipOrigin XSetClipOrigin_dylibloader_wrapper_xlib +#define XSetClipRectangles XSetClipRectangles_dylibloader_wrapper_xlib +#define XSetCloseDownMode XSetCloseDownMode_dylibloader_wrapper_xlib +#define XSetCommand XSetCommand_dylibloader_wrapper_xlib +#define XSetDashes XSetDashes_dylibloader_wrapper_xlib +#define XSetFillRule XSetFillRule_dylibloader_wrapper_xlib +#define XSetFillStyle XSetFillStyle_dylibloader_wrapper_xlib +#define XSetFont XSetFont_dylibloader_wrapper_xlib +#define XSetFontPath XSetFontPath_dylibloader_wrapper_xlib +#define XSetForeground XSetForeground_dylibloader_wrapper_xlib +#define XSetFunction XSetFunction_dylibloader_wrapper_xlib +#define XSetGraphicsExposures XSetGraphicsExposures_dylibloader_wrapper_xlib +#define XSetIconName XSetIconName_dylibloader_wrapper_xlib +#define XSetInputFocus XSetInputFocus_dylibloader_wrapper_xlib +#define XSetLineAttributes XSetLineAttributes_dylibloader_wrapper_xlib +#define XSetModifierMapping XSetModifierMapping_dylibloader_wrapper_xlib +#define XSetPlaneMask XSetPlaneMask_dylibloader_wrapper_xlib +#define XSetPointerMapping XSetPointerMapping_dylibloader_wrapper_xlib +#define XSetScreenSaver XSetScreenSaver_dylibloader_wrapper_xlib +#define XSetSelectionOwner XSetSelectionOwner_dylibloader_wrapper_xlib +#define XSetState XSetState_dylibloader_wrapper_xlib +#define XSetStipple XSetStipple_dylibloader_wrapper_xlib +#define XSetSubwindowMode XSetSubwindowMode_dylibloader_wrapper_xlib +#define XSetTSOrigin XSetTSOrigin_dylibloader_wrapper_xlib +#define XSetTile XSetTile_dylibloader_wrapper_xlib +#define XSetWindowBackground XSetWindowBackground_dylibloader_wrapper_xlib +#define XSetWindowBackgroundPixmap XSetWindowBackgroundPixmap_dylibloader_wrapper_xlib +#define XSetWindowBorder XSetWindowBorder_dylibloader_wrapper_xlib +#define XSetWindowBorderPixmap XSetWindowBorderPixmap_dylibloader_wrapper_xlib +#define XSetWindowBorderWidth XSetWindowBorderWidth_dylibloader_wrapper_xlib +#define XSetWindowColormap XSetWindowColormap_dylibloader_wrapper_xlib +#define XStoreBuffer XStoreBuffer_dylibloader_wrapper_xlib +#define XStoreBytes XStoreBytes_dylibloader_wrapper_xlib +#define XStoreColor XStoreColor_dylibloader_wrapper_xlib +#define XStoreColors XStoreColors_dylibloader_wrapper_xlib +#define XStoreName XStoreName_dylibloader_wrapper_xlib +#define XStoreNamedColor XStoreNamedColor_dylibloader_wrapper_xlib +#define XSync XSync_dylibloader_wrapper_xlib +#define XTextExtents XTextExtents_dylibloader_wrapper_xlib +#define XTextExtents16 XTextExtents16_dylibloader_wrapper_xlib +#define XTextWidth XTextWidth_dylibloader_wrapper_xlib +#define XTextWidth16 XTextWidth16_dylibloader_wrapper_xlib +#define XTranslateCoordinates XTranslateCoordinates_dylibloader_wrapper_xlib +#define XUndefineCursor XUndefineCursor_dylibloader_wrapper_xlib +#define XUngrabButton XUngrabButton_dylibloader_wrapper_xlib +#define XUngrabKey XUngrabKey_dylibloader_wrapper_xlib +#define XUngrabKeyboard XUngrabKeyboard_dylibloader_wrapper_xlib +#define XUngrabPointer XUngrabPointer_dylibloader_wrapper_xlib +#define XUngrabServer XUngrabServer_dylibloader_wrapper_xlib +#define XUninstallColormap XUninstallColormap_dylibloader_wrapper_xlib +#define XUnloadFont XUnloadFont_dylibloader_wrapper_xlib +#define XUnmapSubwindows XUnmapSubwindows_dylibloader_wrapper_xlib +#define XUnmapWindow XUnmapWindow_dylibloader_wrapper_xlib +#define XVendorRelease XVendorRelease_dylibloader_wrapper_xlib +#define XWarpPointer XWarpPointer_dylibloader_wrapper_xlib +#define XWidthMMOfScreen XWidthMMOfScreen_dylibloader_wrapper_xlib +#define XWidthOfScreen XWidthOfScreen_dylibloader_wrapper_xlib +#define XWindowEvent XWindowEvent_dylibloader_wrapper_xlib +#define XWriteBitmapFile XWriteBitmapFile_dylibloader_wrapper_xlib +#define XSupportsLocale XSupportsLocale_dylibloader_wrapper_xlib +#define XSetLocaleModifiers XSetLocaleModifiers_dylibloader_wrapper_xlib +#define XOpenOM XOpenOM_dylibloader_wrapper_xlib +#define XCloseOM XCloseOM_dylibloader_wrapper_xlib +#define XSetOMValues XSetOMValues_dylibloader_wrapper_xlib +#define XGetOMValues XGetOMValues_dylibloader_wrapper_xlib +#define XDisplayOfOM XDisplayOfOM_dylibloader_wrapper_xlib +#define XLocaleOfOM XLocaleOfOM_dylibloader_wrapper_xlib +#define XCreateOC XCreateOC_dylibloader_wrapper_xlib +#define XDestroyOC XDestroyOC_dylibloader_wrapper_xlib +#define XOMOfOC XOMOfOC_dylibloader_wrapper_xlib +#define XSetOCValues XSetOCValues_dylibloader_wrapper_xlib +#define XGetOCValues XGetOCValues_dylibloader_wrapper_xlib +#define XCreateFontSet XCreateFontSet_dylibloader_wrapper_xlib +#define XFreeFontSet XFreeFontSet_dylibloader_wrapper_xlib +#define XFontsOfFontSet XFontsOfFontSet_dylibloader_wrapper_xlib +#define XBaseFontNameListOfFontSet XBaseFontNameListOfFontSet_dylibloader_wrapper_xlib +#define XLocaleOfFontSet XLocaleOfFontSet_dylibloader_wrapper_xlib +#define XContextDependentDrawing XContextDependentDrawing_dylibloader_wrapper_xlib +#define XDirectionalDependentDrawing XDirectionalDependentDrawing_dylibloader_wrapper_xlib +#define XContextualDrawing XContextualDrawing_dylibloader_wrapper_xlib +#define XExtentsOfFontSet XExtentsOfFontSet_dylibloader_wrapper_xlib +#define XmbTextEscapement XmbTextEscapement_dylibloader_wrapper_xlib +#define XwcTextEscapement XwcTextEscapement_dylibloader_wrapper_xlib +#define Xutf8TextEscapement Xutf8TextEscapement_dylibloader_wrapper_xlib +#define XmbTextExtents XmbTextExtents_dylibloader_wrapper_xlib +#define XwcTextExtents XwcTextExtents_dylibloader_wrapper_xlib +#define Xutf8TextExtents Xutf8TextExtents_dylibloader_wrapper_xlib +#define XmbTextPerCharExtents XmbTextPerCharExtents_dylibloader_wrapper_xlib +#define XwcTextPerCharExtents XwcTextPerCharExtents_dylibloader_wrapper_xlib +#define Xutf8TextPerCharExtents Xutf8TextPerCharExtents_dylibloader_wrapper_xlib +#define XmbDrawText XmbDrawText_dylibloader_wrapper_xlib +#define XwcDrawText XwcDrawText_dylibloader_wrapper_xlib +#define Xutf8DrawText Xutf8DrawText_dylibloader_wrapper_xlib +#define XmbDrawString XmbDrawString_dylibloader_wrapper_xlib +#define XwcDrawString XwcDrawString_dylibloader_wrapper_xlib +#define Xutf8DrawString Xutf8DrawString_dylibloader_wrapper_xlib +#define XmbDrawImageString XmbDrawImageString_dylibloader_wrapper_xlib +#define XwcDrawImageString XwcDrawImageString_dylibloader_wrapper_xlib +#define Xutf8DrawImageString Xutf8DrawImageString_dylibloader_wrapper_xlib +#define XOpenIM XOpenIM_dylibloader_wrapper_xlib +#define XCloseIM XCloseIM_dylibloader_wrapper_xlib +#define XGetIMValues XGetIMValues_dylibloader_wrapper_xlib +#define XSetIMValues XSetIMValues_dylibloader_wrapper_xlib +#define XDisplayOfIM XDisplayOfIM_dylibloader_wrapper_xlib +#define XLocaleOfIM XLocaleOfIM_dylibloader_wrapper_xlib +#define XCreateIC XCreateIC_dylibloader_wrapper_xlib +#define XDestroyIC XDestroyIC_dylibloader_wrapper_xlib +#define XSetICFocus XSetICFocus_dylibloader_wrapper_xlib +#define XUnsetICFocus XUnsetICFocus_dylibloader_wrapper_xlib +#define XwcResetIC XwcResetIC_dylibloader_wrapper_xlib +#define XmbResetIC XmbResetIC_dylibloader_wrapper_xlib +#define Xutf8ResetIC Xutf8ResetIC_dylibloader_wrapper_xlib +#define XSetICValues XSetICValues_dylibloader_wrapper_xlib +#define XGetICValues XGetICValues_dylibloader_wrapper_xlib +#define XIMOfIC XIMOfIC_dylibloader_wrapper_xlib +#define XFilterEvent XFilterEvent_dylibloader_wrapper_xlib +#define XmbLookupString XmbLookupString_dylibloader_wrapper_xlib +#define XwcLookupString XwcLookupString_dylibloader_wrapper_xlib +#define Xutf8LookupString Xutf8LookupString_dylibloader_wrapper_xlib +#define XVaCreateNestedList XVaCreateNestedList_dylibloader_wrapper_xlib +#define XRegisterIMInstantiateCallback XRegisterIMInstantiateCallback_dylibloader_wrapper_xlib +#define XUnregisterIMInstantiateCallback XUnregisterIMInstantiateCallback_dylibloader_wrapper_xlib +#define XInternalConnectionNumbers XInternalConnectionNumbers_dylibloader_wrapper_xlib +#define XProcessInternalConnection XProcessInternalConnection_dylibloader_wrapper_xlib +#define XAddConnectionWatch XAddConnectionWatch_dylibloader_wrapper_xlib +#define XRemoveConnectionWatch XRemoveConnectionWatch_dylibloader_wrapper_xlib +#define XSetAuthorization XSetAuthorization_dylibloader_wrapper_xlib +#define _Xmbtowc _Xmbtowc_dylibloader_wrapper_xlib +#define _Xwctomb _Xwctomb_dylibloader_wrapper_xlib +#define XGetEventData XGetEventData_dylibloader_wrapper_xlib +#define XFreeEventData XFreeEventData_dylibloader_wrapper_xlib +#define XAllocClassHint XAllocClassHint_dylibloader_wrapper_xlib +#define XAllocIconSize XAllocIconSize_dylibloader_wrapper_xlib +#define XAllocSizeHints XAllocSizeHints_dylibloader_wrapper_xlib +#define XAllocStandardColormap XAllocStandardColormap_dylibloader_wrapper_xlib +#define XAllocWMHints XAllocWMHints_dylibloader_wrapper_xlib +#define XClipBox XClipBox_dylibloader_wrapper_xlib +#define XCreateRegion XCreateRegion_dylibloader_wrapper_xlib +#define XDefaultString XDefaultString_dylibloader_wrapper_xlib +#define XDeleteContext XDeleteContext_dylibloader_wrapper_xlib +#define XDestroyRegion XDestroyRegion_dylibloader_wrapper_xlib +#define XEmptyRegion XEmptyRegion_dylibloader_wrapper_xlib +#define XEqualRegion XEqualRegion_dylibloader_wrapper_xlib +#define XFindContext XFindContext_dylibloader_wrapper_xlib +#define XGetClassHint XGetClassHint_dylibloader_wrapper_xlib +#define XGetIconSizes XGetIconSizes_dylibloader_wrapper_xlib +#define XGetNormalHints XGetNormalHints_dylibloader_wrapper_xlib +#define XGetRGBColormaps XGetRGBColormaps_dylibloader_wrapper_xlib +#define XGetSizeHints XGetSizeHints_dylibloader_wrapper_xlib +#define XGetStandardColormap XGetStandardColormap_dylibloader_wrapper_xlib +#define XGetTextProperty XGetTextProperty_dylibloader_wrapper_xlib +#define XGetVisualInfo XGetVisualInfo_dylibloader_wrapper_xlib +#define XGetWMClientMachine XGetWMClientMachine_dylibloader_wrapper_xlib +#define XGetWMHints XGetWMHints_dylibloader_wrapper_xlib +#define XGetWMIconName XGetWMIconName_dylibloader_wrapper_xlib +#define XGetWMName XGetWMName_dylibloader_wrapper_xlib +#define XGetWMNormalHints XGetWMNormalHints_dylibloader_wrapper_xlib +#define XGetWMSizeHints XGetWMSizeHints_dylibloader_wrapper_xlib +#define XGetZoomHints XGetZoomHints_dylibloader_wrapper_xlib +#define XIntersectRegion XIntersectRegion_dylibloader_wrapper_xlib +#define XConvertCase XConvertCase_dylibloader_wrapper_xlib +#define XLookupString XLookupString_dylibloader_wrapper_xlib +#define XMatchVisualInfo XMatchVisualInfo_dylibloader_wrapper_xlib +#define XOffsetRegion XOffsetRegion_dylibloader_wrapper_xlib +#define XPointInRegion XPointInRegion_dylibloader_wrapper_xlib +#define XPolygonRegion XPolygonRegion_dylibloader_wrapper_xlib +#define XRectInRegion XRectInRegion_dylibloader_wrapper_xlib +#define XSaveContext XSaveContext_dylibloader_wrapper_xlib +#define XSetClassHint XSetClassHint_dylibloader_wrapper_xlib +#define XSetIconSizes XSetIconSizes_dylibloader_wrapper_xlib +#define XSetNormalHints XSetNormalHints_dylibloader_wrapper_xlib +#define XSetRGBColormaps XSetRGBColormaps_dylibloader_wrapper_xlib +#define XSetSizeHints XSetSizeHints_dylibloader_wrapper_xlib +#define XSetStandardProperties XSetStandardProperties_dylibloader_wrapper_xlib +#define XSetTextProperty XSetTextProperty_dylibloader_wrapper_xlib +#define XSetWMClientMachine XSetWMClientMachine_dylibloader_wrapper_xlib +#define XSetWMHints XSetWMHints_dylibloader_wrapper_xlib +#define XSetWMIconName XSetWMIconName_dylibloader_wrapper_xlib +#define XSetWMName XSetWMName_dylibloader_wrapper_xlib +#define XSetWMNormalHints XSetWMNormalHints_dylibloader_wrapper_xlib +#define XSetWMProperties XSetWMProperties_dylibloader_wrapper_xlib +#define XmbSetWMProperties XmbSetWMProperties_dylibloader_wrapper_xlib +#define Xutf8SetWMProperties Xutf8SetWMProperties_dylibloader_wrapper_xlib +#define XSetWMSizeHints XSetWMSizeHints_dylibloader_wrapper_xlib +#define XSetRegion XSetRegion_dylibloader_wrapper_xlib +#define XSetStandardColormap XSetStandardColormap_dylibloader_wrapper_xlib +#define XSetZoomHints XSetZoomHints_dylibloader_wrapper_xlib +#define XShrinkRegion XShrinkRegion_dylibloader_wrapper_xlib +#define XStringListToTextProperty XStringListToTextProperty_dylibloader_wrapper_xlib +#define XSubtractRegion XSubtractRegion_dylibloader_wrapper_xlib +#define XmbTextListToTextProperty XmbTextListToTextProperty_dylibloader_wrapper_xlib +#define XwcTextListToTextProperty XwcTextListToTextProperty_dylibloader_wrapper_xlib +#define Xutf8TextListToTextProperty Xutf8TextListToTextProperty_dylibloader_wrapper_xlib +#define XwcFreeStringList XwcFreeStringList_dylibloader_wrapper_xlib +#define XTextPropertyToStringList XTextPropertyToStringList_dylibloader_wrapper_xlib +#define XmbTextPropertyToTextList XmbTextPropertyToTextList_dylibloader_wrapper_xlib +#define XwcTextPropertyToTextList XwcTextPropertyToTextList_dylibloader_wrapper_xlib +#define Xutf8TextPropertyToTextList Xutf8TextPropertyToTextList_dylibloader_wrapper_xlib +#define XUnionRectWithRegion XUnionRectWithRegion_dylibloader_wrapper_xlib +#define XUnionRegion XUnionRegion_dylibloader_wrapper_xlib +#define XWMGeometry XWMGeometry_dylibloader_wrapper_xlib +#define XXorRegion XXorRegion_dylibloader_wrapper_xlib +#define XkbIgnoreExtension XkbIgnoreExtension_dylibloader_wrapper_xlib +#define XkbOpenDisplay XkbOpenDisplay_dylibloader_wrapper_xlib +#define XkbQueryExtension XkbQueryExtension_dylibloader_wrapper_xlib +#define XkbUseExtension XkbUseExtension_dylibloader_wrapper_xlib +#define XkbLibraryVersion XkbLibraryVersion_dylibloader_wrapper_xlib +#define XkbSetXlibControls XkbSetXlibControls_dylibloader_wrapper_xlib +#define XkbGetXlibControls XkbGetXlibControls_dylibloader_wrapper_xlib +#define XkbXlibControlsImplemented XkbXlibControlsImplemented_dylibloader_wrapper_xlib +#define XkbSetAtomFuncs XkbSetAtomFuncs_dylibloader_wrapper_xlib +#define XkbKeycodeToKeysym XkbKeycodeToKeysym_dylibloader_wrapper_xlib +#define XkbKeysymToModifiers XkbKeysymToModifiers_dylibloader_wrapper_xlib +#define XkbLookupKeySym XkbLookupKeySym_dylibloader_wrapper_xlib +#define XkbLookupKeyBinding XkbLookupKeyBinding_dylibloader_wrapper_xlib +#define XkbTranslateKeyCode XkbTranslateKeyCode_dylibloader_wrapper_xlib +#define XkbTranslateKeySym XkbTranslateKeySym_dylibloader_wrapper_xlib +#define XkbSetAutoRepeatRate XkbSetAutoRepeatRate_dylibloader_wrapper_xlib +#define XkbGetAutoRepeatRate XkbGetAutoRepeatRate_dylibloader_wrapper_xlib +#define XkbChangeEnabledControls XkbChangeEnabledControls_dylibloader_wrapper_xlib +#define XkbDeviceBell XkbDeviceBell_dylibloader_wrapper_xlib +#define XkbForceDeviceBell XkbForceDeviceBell_dylibloader_wrapper_xlib +#define XkbDeviceBellEvent XkbDeviceBellEvent_dylibloader_wrapper_xlib +#define XkbBell XkbBell_dylibloader_wrapper_xlib +#define XkbForceBell XkbForceBell_dylibloader_wrapper_xlib +#define XkbBellEvent XkbBellEvent_dylibloader_wrapper_xlib +#define XkbSelectEvents XkbSelectEvents_dylibloader_wrapper_xlib +#define XkbSelectEventDetails XkbSelectEventDetails_dylibloader_wrapper_xlib +#define XkbNoteMapChanges XkbNoteMapChanges_dylibloader_wrapper_xlib +#define XkbNoteNameChanges XkbNoteNameChanges_dylibloader_wrapper_xlib +#define XkbGetIndicatorState XkbGetIndicatorState_dylibloader_wrapper_xlib +#define XkbGetIndicatorMap XkbGetIndicatorMap_dylibloader_wrapper_xlib +#define XkbSetIndicatorMap XkbSetIndicatorMap_dylibloader_wrapper_xlib +#define XkbGetNamedIndicator XkbGetNamedIndicator_dylibloader_wrapper_xlib +#define XkbGetNamedDeviceIndicator XkbGetNamedDeviceIndicator_dylibloader_wrapper_xlib +#define XkbSetNamedIndicator XkbSetNamedIndicator_dylibloader_wrapper_xlib +#define XkbSetNamedDeviceIndicator XkbSetNamedDeviceIndicator_dylibloader_wrapper_xlib +#define XkbLockModifiers XkbLockModifiers_dylibloader_wrapper_xlib +#define XkbLatchModifiers XkbLatchModifiers_dylibloader_wrapper_xlib +#define XkbLockGroup XkbLockGroup_dylibloader_wrapper_xlib +#define XkbLatchGroup XkbLatchGroup_dylibloader_wrapper_xlib +#define XkbSetServerInternalMods XkbSetServerInternalMods_dylibloader_wrapper_xlib +#define XkbSetIgnoreLockMods XkbSetIgnoreLockMods_dylibloader_wrapper_xlib +#define XkbVirtualModsToReal XkbVirtualModsToReal_dylibloader_wrapper_xlib +#define XkbComputeEffectiveMap XkbComputeEffectiveMap_dylibloader_wrapper_xlib +#define XkbInitCanonicalKeyTypes XkbInitCanonicalKeyTypes_dylibloader_wrapper_xlib +#define XkbAllocKeyboard XkbAllocKeyboard_dylibloader_wrapper_xlib +#define XkbFreeKeyboard XkbFreeKeyboard_dylibloader_wrapper_xlib +#define XkbAllocClientMap XkbAllocClientMap_dylibloader_wrapper_xlib +#define XkbAllocServerMap XkbAllocServerMap_dylibloader_wrapper_xlib +#define XkbFreeClientMap XkbFreeClientMap_dylibloader_wrapper_xlib +#define XkbFreeServerMap XkbFreeServerMap_dylibloader_wrapper_xlib +#define XkbAddKeyType XkbAddKeyType_dylibloader_wrapper_xlib +#define XkbAllocIndicatorMaps XkbAllocIndicatorMaps_dylibloader_wrapper_xlib +#define XkbFreeIndicatorMaps XkbFreeIndicatorMaps_dylibloader_wrapper_xlib +#define XkbGetMap XkbGetMap_dylibloader_wrapper_xlib +#define XkbGetUpdatedMap XkbGetUpdatedMap_dylibloader_wrapper_xlib +#define XkbGetMapChanges XkbGetMapChanges_dylibloader_wrapper_xlib +#define XkbRefreshKeyboardMapping XkbRefreshKeyboardMapping_dylibloader_wrapper_xlib +#define XkbGetKeyTypes XkbGetKeyTypes_dylibloader_wrapper_xlib +#define XkbGetKeySyms XkbGetKeySyms_dylibloader_wrapper_xlib +#define XkbGetKeyActions XkbGetKeyActions_dylibloader_wrapper_xlib +#define XkbGetKeyBehaviors XkbGetKeyBehaviors_dylibloader_wrapper_xlib +#define XkbGetVirtualMods XkbGetVirtualMods_dylibloader_wrapper_xlib +#define XkbGetKeyExplicitComponents XkbGetKeyExplicitComponents_dylibloader_wrapper_xlib +#define XkbGetKeyModifierMap XkbGetKeyModifierMap_dylibloader_wrapper_xlib +#define XkbGetKeyVirtualModMap XkbGetKeyVirtualModMap_dylibloader_wrapper_xlib +#define XkbAllocControls XkbAllocControls_dylibloader_wrapper_xlib +#define XkbFreeControls XkbFreeControls_dylibloader_wrapper_xlib +#define XkbGetControls XkbGetControls_dylibloader_wrapper_xlib +#define XkbSetControls XkbSetControls_dylibloader_wrapper_xlib +#define XkbNoteControlsChanges XkbNoteControlsChanges_dylibloader_wrapper_xlib +#define XkbAllocCompatMap XkbAllocCompatMap_dylibloader_wrapper_xlib +#define XkbFreeCompatMap XkbFreeCompatMap_dylibloader_wrapper_xlib +#define XkbGetCompatMap XkbGetCompatMap_dylibloader_wrapper_xlib +#define XkbSetCompatMap XkbSetCompatMap_dylibloader_wrapper_xlib +#define XkbAllocNames XkbAllocNames_dylibloader_wrapper_xlib +#define XkbGetNames XkbGetNames_dylibloader_wrapper_xlib +#define XkbSetNames XkbSetNames_dylibloader_wrapper_xlib +#define XkbChangeNames XkbChangeNames_dylibloader_wrapper_xlib +#define XkbFreeNames XkbFreeNames_dylibloader_wrapper_xlib +#define XkbGetState XkbGetState_dylibloader_wrapper_xlib +#define XkbSetMap XkbSetMap_dylibloader_wrapper_xlib +#define XkbChangeMap XkbChangeMap_dylibloader_wrapper_xlib +#define XkbSetDetectableAutoRepeat XkbSetDetectableAutoRepeat_dylibloader_wrapper_xlib +#define XkbGetDetectableAutoRepeat XkbGetDetectableAutoRepeat_dylibloader_wrapper_xlib +#define XkbSetAutoResetControls XkbSetAutoResetControls_dylibloader_wrapper_xlib +#define XkbGetAutoResetControls XkbGetAutoResetControls_dylibloader_wrapper_xlib +#define XkbSetPerClientControls XkbSetPerClientControls_dylibloader_wrapper_xlib +#define XkbGetPerClientControls XkbGetPerClientControls_dylibloader_wrapper_xlib +#define XkbCopyKeyType XkbCopyKeyType_dylibloader_wrapper_xlib +#define XkbCopyKeyTypes XkbCopyKeyTypes_dylibloader_wrapper_xlib +#define XkbResizeKeyType XkbResizeKeyType_dylibloader_wrapper_xlib +#define XkbResizeKeySyms XkbResizeKeySyms_dylibloader_wrapper_xlib +#define XkbResizeKeyActions XkbResizeKeyActions_dylibloader_wrapper_xlib +#define XkbChangeTypesOfKey XkbChangeTypesOfKey_dylibloader_wrapper_xlib +#define XkbChangeKeycodeRange XkbChangeKeycodeRange_dylibloader_wrapper_xlib +#define XkbListComponents XkbListComponents_dylibloader_wrapper_xlib +#define XkbFreeComponentList XkbFreeComponentList_dylibloader_wrapper_xlib +#define XkbGetKeyboard XkbGetKeyboard_dylibloader_wrapper_xlib +#define XkbGetKeyboardByName XkbGetKeyboardByName_dylibloader_wrapper_xlib +#define XkbKeyTypesForCoreSymbols XkbKeyTypesForCoreSymbols_dylibloader_wrapper_xlib +#define XkbApplyCompatMapToKey XkbApplyCompatMapToKey_dylibloader_wrapper_xlib +#define XkbUpdateMapFromCore XkbUpdateMapFromCore_dylibloader_wrapper_xlib +#define XkbAddDeviceLedInfo XkbAddDeviceLedInfo_dylibloader_wrapper_xlib +#define XkbResizeDeviceButtonActions XkbResizeDeviceButtonActions_dylibloader_wrapper_xlib +#define XkbAllocDeviceInfo XkbAllocDeviceInfo_dylibloader_wrapper_xlib +#define XkbFreeDeviceInfo XkbFreeDeviceInfo_dylibloader_wrapper_xlib +#define XkbNoteDeviceChanges XkbNoteDeviceChanges_dylibloader_wrapper_xlib +#define XkbGetDeviceInfo XkbGetDeviceInfo_dylibloader_wrapper_xlib +#define XkbGetDeviceInfoChanges XkbGetDeviceInfoChanges_dylibloader_wrapper_xlib +#define XkbGetDeviceButtonActions XkbGetDeviceButtonActions_dylibloader_wrapper_xlib +#define XkbGetDeviceLedInfo XkbGetDeviceLedInfo_dylibloader_wrapper_xlib +#define XkbSetDeviceInfo XkbSetDeviceInfo_dylibloader_wrapper_xlib +#define XkbChangeDeviceInfo XkbChangeDeviceInfo_dylibloader_wrapper_xlib +#define XkbSetDeviceLedInfo XkbSetDeviceLedInfo_dylibloader_wrapper_xlib +#define XkbSetDeviceButtonActions XkbSetDeviceButtonActions_dylibloader_wrapper_xlib +#define XkbToControl XkbToControl_dylibloader_wrapper_xlib +#define XkbSetDebuggingFlags XkbSetDebuggingFlags_dylibloader_wrapper_xlib +#define XkbApplyVirtualModChanges XkbApplyVirtualModChanges_dylibloader_wrapper_xlib +#define XkbUpdateActionVirtualMods XkbUpdateActionVirtualMods_dylibloader_wrapper_xlib +#define XkbUpdateKeyTypeVirtualMods XkbUpdateKeyTypeVirtualMods_dylibloader_wrapper_xlib +extern int (*_Xmblen_dylibloader_wrapper_xlib)( char*, int); +extern XFontStruct* (*XLoadQueryFont_dylibloader_wrapper_xlib)( Display*,const char*); +extern XFontStruct* (*XQueryFont_dylibloader_wrapper_xlib)( Display*, XID); +extern XTimeCoord* (*XGetMotionEvents_dylibloader_wrapper_xlib)( Display*, Window, Time, Time, int*); +extern XModifierKeymap* (*XDeleteModifiermapEntry_dylibloader_wrapper_xlib)( XModifierKeymap*, KeyCode, int); +extern XModifierKeymap* (*XGetModifierMapping_dylibloader_wrapper_xlib)( Display*); +extern XModifierKeymap* (*XInsertModifiermapEntry_dylibloader_wrapper_xlib)( XModifierKeymap*, KeyCode, int); +extern XModifierKeymap* (*XNewModifiermap_dylibloader_wrapper_xlib)( int); +extern XImage* (*XCreateImage_dylibloader_wrapper_xlib)( Display*, Visual*, unsigned int, int, int, char*, unsigned int, unsigned int, int, int); +extern int (*XInitImage_dylibloader_wrapper_xlib)( XImage*); +extern XImage* (*XGetImage_dylibloader_wrapper_xlib)( Display*, Drawable, int, int, unsigned int, unsigned int, unsigned long, int); +extern XImage* (*XGetSubImage_dylibloader_wrapper_xlib)( Display*, Drawable, int, int, unsigned int, unsigned int, unsigned long, int, XImage*, int, int); +extern Display* (*XOpenDisplay_dylibloader_wrapper_xlib)(const char*); +extern void (*XrmInitialize_dylibloader_wrapper_xlib)( void); +extern char* (*XFetchBytes_dylibloader_wrapper_xlib)( Display*, int*); +extern char* (*XFetchBuffer_dylibloader_wrapper_xlib)( Display*, int*, int); +extern char* (*XGetAtomName_dylibloader_wrapper_xlib)( Display*, Atom); +extern int (*XGetAtomNames_dylibloader_wrapper_xlib)( Display*, Atom*, int, char**); +extern char* (*XGetDefault_dylibloader_wrapper_xlib)( Display*,const char*,const char*); +extern char* (*XDisplayName_dylibloader_wrapper_xlib)(const char*); +extern char* (*XKeysymToString_dylibloader_wrapper_xlib)( KeySym); +extern int* (*XSynchronize_dylibloader_wrapper_xlib)( Display*, int); +extern int* (*XSetAfterFunction_dylibloader_wrapper_xlib)( Display*, int*); +extern Atom (*XInternAtom_dylibloader_wrapper_xlib)( Display*,const char*, int); +extern int (*XInternAtoms_dylibloader_wrapper_xlib)( Display*, char**, int, int, Atom*); +extern Colormap (*XCopyColormapAndFree_dylibloader_wrapper_xlib)( Display*, Colormap); +extern Colormap (*XCreateColormap_dylibloader_wrapper_xlib)( Display*, Window, Visual*, int); +extern Cursor (*XCreatePixmapCursor_dylibloader_wrapper_xlib)( Display*, Pixmap, Pixmap, XColor*, XColor*, unsigned int, unsigned int); +extern Cursor (*XCreateGlyphCursor_dylibloader_wrapper_xlib)( Display*, Font, Font, unsigned int, unsigned int,const XColor*,const XColor*); +extern Cursor (*XCreateFontCursor_dylibloader_wrapper_xlib)( Display*, unsigned int); +extern Font (*XLoadFont_dylibloader_wrapper_xlib)( Display*,const char*); +extern GC (*XCreateGC_dylibloader_wrapper_xlib)( Display*, Drawable, unsigned long, XGCValues*); +extern GContext (*XGContextFromGC_dylibloader_wrapper_xlib)( GC); +extern void (*XFlushGC_dylibloader_wrapper_xlib)( Display*, GC); +extern Pixmap (*XCreatePixmap_dylibloader_wrapper_xlib)( Display*, Drawable, unsigned int, unsigned int, unsigned int); +extern Pixmap (*XCreateBitmapFromData_dylibloader_wrapper_xlib)( Display*, Drawable,const char*, unsigned int, unsigned int); +extern Pixmap (*XCreatePixmapFromBitmapData_dylibloader_wrapper_xlib)( Display*, Drawable, char*, unsigned int, unsigned int, unsigned long, unsigned long, unsigned int); +extern Window (*XCreateSimpleWindow_dylibloader_wrapper_xlib)( Display*, Window, int, int, unsigned int, unsigned int, unsigned int, unsigned long, unsigned long); +extern Window (*XGetSelectionOwner_dylibloader_wrapper_xlib)( Display*, Atom); +extern Window (*XCreateWindow_dylibloader_wrapper_xlib)( Display*, Window, int, int, unsigned int, unsigned int, unsigned int, int, unsigned int, Visual*, unsigned long, XSetWindowAttributes*); +extern Colormap* (*XListInstalledColormaps_dylibloader_wrapper_xlib)( Display*, Window, int*); +extern char** (*XListFonts_dylibloader_wrapper_xlib)( Display*,const char*, int, int*); +extern char** (*XListFontsWithInfo_dylibloader_wrapper_xlib)( Display*,const char*, int, int*, XFontStruct**); +extern char** (*XGetFontPath_dylibloader_wrapper_xlib)( Display*, int*); +extern char** (*XListExtensions_dylibloader_wrapper_xlib)( Display*, int*); +extern Atom* (*XListProperties_dylibloader_wrapper_xlib)( Display*, Window, int*); +extern XHostAddress* (*XListHosts_dylibloader_wrapper_xlib)( Display*, int*, int*); +extern KeySym (*XKeycodeToKeysym_dylibloader_wrapper_xlib)( Display*, KeyCode, int); +extern KeySym (*XLookupKeysym_dylibloader_wrapper_xlib)( XKeyEvent*, int); +extern KeySym* (*XGetKeyboardMapping_dylibloader_wrapper_xlib)( Display*, KeyCode, int, int*); +extern KeySym (*XStringToKeysym_dylibloader_wrapper_xlib)(const char*); +extern long (*XMaxRequestSize_dylibloader_wrapper_xlib)( Display*); +extern long (*XExtendedMaxRequestSize_dylibloader_wrapper_xlib)( Display*); +extern char* (*XResourceManagerString_dylibloader_wrapper_xlib)( Display*); +extern char* (*XScreenResourceString_dylibloader_wrapper_xlib)( Screen*); +extern unsigned long (*XDisplayMotionBufferSize_dylibloader_wrapper_xlib)( Display*); +extern VisualID (*XVisualIDFromVisual_dylibloader_wrapper_xlib)( Visual*); +extern int (*XInitThreads_dylibloader_wrapper_xlib)( void); +extern void (*XLockDisplay_dylibloader_wrapper_xlib)( Display*); +extern void (*XUnlockDisplay_dylibloader_wrapper_xlib)( Display*); +extern XExtCodes* (*XInitExtension_dylibloader_wrapper_xlib)( Display*,const char*); +extern XExtCodes* (*XAddExtension_dylibloader_wrapper_xlib)( Display*); +extern XExtData* (*XFindOnExtensionList_dylibloader_wrapper_xlib)( XExtData**, int); +extern XExtData** (*XEHeadOfExtensionList_dylibloader_wrapper_xlib)( XEDataObject); +extern Window (*XRootWindow_dylibloader_wrapper_xlib)( Display*, int); +extern Window (*XDefaultRootWindow_dylibloader_wrapper_xlib)( Display*); +extern Window (*XRootWindowOfScreen_dylibloader_wrapper_xlib)( Screen*); +extern Visual* (*XDefaultVisual_dylibloader_wrapper_xlib)( Display*, int); +extern Visual* (*XDefaultVisualOfScreen_dylibloader_wrapper_xlib)( Screen*); +extern GC (*XDefaultGC_dylibloader_wrapper_xlib)( Display*, int); +extern GC (*XDefaultGCOfScreen_dylibloader_wrapper_xlib)( Screen*); +extern unsigned long (*XBlackPixel_dylibloader_wrapper_xlib)( Display*, int); +extern unsigned long (*XWhitePixel_dylibloader_wrapper_xlib)( Display*, int); +extern unsigned long (*XAllPlanes_dylibloader_wrapper_xlib)( void); +extern unsigned long (*XBlackPixelOfScreen_dylibloader_wrapper_xlib)( Screen*); +extern unsigned long (*XWhitePixelOfScreen_dylibloader_wrapper_xlib)( Screen*); +extern unsigned long (*XNextRequest_dylibloader_wrapper_xlib)( Display*); +extern unsigned long (*XLastKnownRequestProcessed_dylibloader_wrapper_xlib)( Display*); +extern char* (*XServerVendor_dylibloader_wrapper_xlib)( Display*); +extern char* (*XDisplayString_dylibloader_wrapper_xlib)( Display*); +extern Colormap (*XDefaultColormap_dylibloader_wrapper_xlib)( Display*, int); +extern Colormap (*XDefaultColormapOfScreen_dylibloader_wrapper_xlib)( Screen*); +extern Display* (*XDisplayOfScreen_dylibloader_wrapper_xlib)( Screen*); +extern Screen* (*XScreenOfDisplay_dylibloader_wrapper_xlib)( Display*, int); +extern Screen* (*XDefaultScreenOfDisplay_dylibloader_wrapper_xlib)( Display*); +extern long (*XEventMaskOfScreen_dylibloader_wrapper_xlib)( Screen*); +extern int (*XScreenNumberOfScreen_dylibloader_wrapper_xlib)( Screen*); +extern XErrorHandler (*XSetErrorHandler_dylibloader_wrapper_xlib)( XErrorHandler); +extern XIOErrorHandler (*XSetIOErrorHandler_dylibloader_wrapper_xlib)( XIOErrorHandler); +extern XPixmapFormatValues* (*XListPixmapFormats_dylibloader_wrapper_xlib)( Display*, int*); +extern int* (*XListDepths_dylibloader_wrapper_xlib)( Display*, int, int*); +extern int (*XReconfigureWMWindow_dylibloader_wrapper_xlib)( Display*, Window, int, unsigned int, XWindowChanges*); +extern int (*XGetWMProtocols_dylibloader_wrapper_xlib)( Display*, Window, Atom**, int*); +extern int (*XSetWMProtocols_dylibloader_wrapper_xlib)( Display*, Window, Atom*, int); +extern int (*XIconifyWindow_dylibloader_wrapper_xlib)( Display*, Window, int); +extern int (*XWithdrawWindow_dylibloader_wrapper_xlib)( Display*, Window, int); +extern int (*XGetCommand_dylibloader_wrapper_xlib)( Display*, Window, char***, int*); +extern int (*XGetWMColormapWindows_dylibloader_wrapper_xlib)( Display*, Window, Window**, int*); +extern int (*XSetWMColormapWindows_dylibloader_wrapper_xlib)( Display*, Window, Window*, int); +extern void (*XFreeStringList_dylibloader_wrapper_xlib)( char**); +extern int (*XSetTransientForHint_dylibloader_wrapper_xlib)( Display*, Window, Window); +extern int (*XActivateScreenSaver_dylibloader_wrapper_xlib)( Display*); +extern int (*XAddHost_dylibloader_wrapper_xlib)( Display*, XHostAddress*); +extern int (*XAddHosts_dylibloader_wrapper_xlib)( Display*, XHostAddress*, int); +extern int (*XAddToExtensionList_dylibloader_wrapper_xlib)(struct _XExtData**, XExtData*); +extern int (*XAddToSaveSet_dylibloader_wrapper_xlib)( Display*, Window); +extern int (*XAllocColor_dylibloader_wrapper_xlib)( Display*, Colormap, XColor*); +extern int (*XAllocColorCells_dylibloader_wrapper_xlib)( Display*, Colormap, int, unsigned long*, unsigned int, unsigned long*, unsigned int); +extern int (*XAllocColorPlanes_dylibloader_wrapper_xlib)( Display*, Colormap, int, unsigned long*, int, int, int, int, unsigned long*, unsigned long*, unsigned long*); +extern int (*XAllocNamedColor_dylibloader_wrapper_xlib)( Display*, Colormap,const char*, XColor*, XColor*); +extern int (*XAllowEvents_dylibloader_wrapper_xlib)( Display*, int, Time); +extern int (*XAutoRepeatOff_dylibloader_wrapper_xlib)( Display*); +extern int (*XAutoRepeatOn_dylibloader_wrapper_xlib)( Display*); +extern int (*XBell_dylibloader_wrapper_xlib)( Display*, int); +extern int (*XBitmapBitOrder_dylibloader_wrapper_xlib)( Display*); +extern int (*XBitmapPad_dylibloader_wrapper_xlib)( Display*); +extern int (*XBitmapUnit_dylibloader_wrapper_xlib)( Display*); +extern int (*XCellsOfScreen_dylibloader_wrapper_xlib)( Screen*); +extern int (*XChangeActivePointerGrab_dylibloader_wrapper_xlib)( Display*, unsigned int, Cursor, Time); +extern int (*XChangeGC_dylibloader_wrapper_xlib)( Display*, GC, unsigned long, XGCValues*); +extern int (*XChangeKeyboardControl_dylibloader_wrapper_xlib)( Display*, unsigned long, XKeyboardControl*); +extern int (*XChangeKeyboardMapping_dylibloader_wrapper_xlib)( Display*, int, int, KeySym*, int); +extern int (*XChangePointerControl_dylibloader_wrapper_xlib)( Display*, int, int, int, int, int); +extern int (*XChangeProperty_dylibloader_wrapper_xlib)( Display*, Window, Atom, Atom, int, int,const unsigned char*, int); +extern int (*XChangeSaveSet_dylibloader_wrapper_xlib)( Display*, Window, int); +extern int (*XChangeWindowAttributes_dylibloader_wrapper_xlib)( Display*, Window, unsigned long, XSetWindowAttributes*); +extern int (*XCheckIfEvent_dylibloader_wrapper_xlib)( Display*, XEvent*, Bool (*) (Display*, XEvent*, XPointer), XPointer); +extern int (*XCheckMaskEvent_dylibloader_wrapper_xlib)( Display*, long, XEvent*); +extern int (*XCheckTypedEvent_dylibloader_wrapper_xlib)( Display*, int, XEvent*); +extern int (*XCheckTypedWindowEvent_dylibloader_wrapper_xlib)( Display*, Window, int, XEvent*); +extern int (*XCheckWindowEvent_dylibloader_wrapper_xlib)( Display*, Window, long, XEvent*); +extern int (*XCirculateSubwindows_dylibloader_wrapper_xlib)( Display*, Window, int); +extern int (*XCirculateSubwindowsDown_dylibloader_wrapper_xlib)( Display*, Window); +extern int (*XCirculateSubwindowsUp_dylibloader_wrapper_xlib)( Display*, Window); +extern int (*XClearArea_dylibloader_wrapper_xlib)( Display*, Window, int, int, unsigned int, unsigned int, int); +extern int (*XClearWindow_dylibloader_wrapper_xlib)( Display*, Window); +extern int (*XCloseDisplay_dylibloader_wrapper_xlib)( Display*); +extern int (*XConfigureWindow_dylibloader_wrapper_xlib)( Display*, Window, unsigned int, XWindowChanges*); +extern int (*XConnectionNumber_dylibloader_wrapper_xlib)( Display*); +extern int (*XConvertSelection_dylibloader_wrapper_xlib)( Display*, Atom, Atom, Atom, Window, Time); +extern int (*XCopyArea_dylibloader_wrapper_xlib)( Display*, Drawable, Drawable, GC, int, int, unsigned int, unsigned int, int, int); +extern int (*XCopyGC_dylibloader_wrapper_xlib)( Display*, GC, unsigned long, GC); +extern int (*XCopyPlane_dylibloader_wrapper_xlib)( Display*, Drawable, Drawable, GC, int, int, unsigned int, unsigned int, int, int, unsigned long); +extern int (*XDefaultDepth_dylibloader_wrapper_xlib)( Display*, int); +extern int (*XDefaultDepthOfScreen_dylibloader_wrapper_xlib)( Screen*); +extern int (*XDefaultScreen_dylibloader_wrapper_xlib)( Display*); +extern int (*XDefineCursor_dylibloader_wrapper_xlib)( Display*, Window, Cursor); +extern int (*XDeleteProperty_dylibloader_wrapper_xlib)( Display*, Window, Atom); +extern int (*XDestroyWindow_dylibloader_wrapper_xlib)( Display*, Window); +extern int (*XDestroySubwindows_dylibloader_wrapper_xlib)( Display*, Window); +extern int (*XDoesBackingStore_dylibloader_wrapper_xlib)( Screen*); +extern int (*XDoesSaveUnders_dylibloader_wrapper_xlib)( Screen*); +extern int (*XDisableAccessControl_dylibloader_wrapper_xlib)( Display*); +extern int (*XDisplayCells_dylibloader_wrapper_xlib)( Display*, int); +extern int (*XDisplayHeight_dylibloader_wrapper_xlib)( Display*, int); +extern int (*XDisplayHeightMM_dylibloader_wrapper_xlib)( Display*, int); +extern int (*XDisplayKeycodes_dylibloader_wrapper_xlib)( Display*, int*, int*); +extern int (*XDisplayPlanes_dylibloader_wrapper_xlib)( Display*, int); +extern int (*XDisplayWidth_dylibloader_wrapper_xlib)( Display*, int); +extern int (*XDisplayWidthMM_dylibloader_wrapper_xlib)( Display*, int); +extern int (*XDrawArc_dylibloader_wrapper_xlib)( Display*, Drawable, GC, int, int, unsigned int, unsigned int, int, int); +extern int (*XDrawArcs_dylibloader_wrapper_xlib)( Display*, Drawable, GC, XArc*, int); +extern int (*XDrawImageString_dylibloader_wrapper_xlib)( Display*, Drawable, GC, int, int,const char*, int); +extern int (*XDrawImageString16_dylibloader_wrapper_xlib)( Display*, Drawable, GC, int, int,const XChar2b*, int); +extern int (*XDrawLine_dylibloader_wrapper_xlib)( Display*, Drawable, GC, int, int, int, int); +extern int (*XDrawLines_dylibloader_wrapper_xlib)( Display*, Drawable, GC, XPoint*, int, int); +extern int (*XDrawPoint_dylibloader_wrapper_xlib)( Display*, Drawable, GC, int, int); +extern int (*XDrawPoints_dylibloader_wrapper_xlib)( Display*, Drawable, GC, XPoint*, int, int); +extern int (*XDrawRectangle_dylibloader_wrapper_xlib)( Display*, Drawable, GC, int, int, unsigned int, unsigned int); +extern int (*XDrawRectangles_dylibloader_wrapper_xlib)( Display*, Drawable, GC, XRectangle*, int); +extern int (*XDrawSegments_dylibloader_wrapper_xlib)( Display*, Drawable, GC, XSegment*, int); +extern int (*XDrawString_dylibloader_wrapper_xlib)( Display*, Drawable, GC, int, int,const char*, int); +extern int (*XDrawString16_dylibloader_wrapper_xlib)( Display*, Drawable, GC, int, int,const XChar2b*, int); +extern int (*XDrawText_dylibloader_wrapper_xlib)( Display*, Drawable, GC, int, int, XTextItem*, int); +extern int (*XDrawText16_dylibloader_wrapper_xlib)( Display*, Drawable, GC, int, int, XTextItem16*, int); +extern int (*XEnableAccessControl_dylibloader_wrapper_xlib)( Display*); +extern int (*XEventsQueued_dylibloader_wrapper_xlib)( Display*, int); +extern int (*XFetchName_dylibloader_wrapper_xlib)( Display*, Window, char**); +extern int (*XFillArc_dylibloader_wrapper_xlib)( Display*, Drawable, GC, int, int, unsigned int, unsigned int, int, int); +extern int (*XFillArcs_dylibloader_wrapper_xlib)( Display*, Drawable, GC, XArc*, int); +extern int (*XFillPolygon_dylibloader_wrapper_xlib)( Display*, Drawable, GC, XPoint*, int, int, int); +extern int (*XFillRectangle_dylibloader_wrapper_xlib)( Display*, Drawable, GC, int, int, unsigned int, unsigned int); +extern int (*XFillRectangles_dylibloader_wrapper_xlib)( Display*, Drawable, GC, XRectangle*, int); +extern int (*XFlush_dylibloader_wrapper_xlib)( Display*); +extern int (*XForceScreenSaver_dylibloader_wrapper_xlib)( Display*, int); +extern int (*XFree_dylibloader_wrapper_xlib)( void*); +extern int (*XFreeColormap_dylibloader_wrapper_xlib)( Display*, Colormap); +extern int (*XFreeColors_dylibloader_wrapper_xlib)( Display*, Colormap, unsigned long*, int, unsigned long); +extern int (*XFreeCursor_dylibloader_wrapper_xlib)( Display*, Cursor); +extern int (*XFreeExtensionList_dylibloader_wrapper_xlib)( char**); +extern int (*XFreeFont_dylibloader_wrapper_xlib)( Display*, XFontStruct*); +extern int (*XFreeFontInfo_dylibloader_wrapper_xlib)( char**, XFontStruct*, int); +extern int (*XFreeFontNames_dylibloader_wrapper_xlib)( char**); +extern int (*XFreeFontPath_dylibloader_wrapper_xlib)( char**); +extern int (*XFreeGC_dylibloader_wrapper_xlib)( Display*, GC); +extern int (*XFreeModifiermap_dylibloader_wrapper_xlib)( XModifierKeymap*); +extern int (*XFreePixmap_dylibloader_wrapper_xlib)( Display*, Pixmap); +extern int (*XGeometry_dylibloader_wrapper_xlib)( Display*, int,const char*,const char*, unsigned int, unsigned int, unsigned int, int, int, int*, int*, int*, int*); +extern int (*XGetErrorDatabaseText_dylibloader_wrapper_xlib)( Display*,const char*,const char*,const char*, char*, int); +extern int (*XGetErrorText_dylibloader_wrapper_xlib)( Display*, int, char*, int); +extern int (*XGetFontProperty_dylibloader_wrapper_xlib)( XFontStruct*, Atom, unsigned long*); +extern int (*XGetGCValues_dylibloader_wrapper_xlib)( Display*, GC, unsigned long, XGCValues*); +extern int (*XGetGeometry_dylibloader_wrapper_xlib)( Display*, Drawable, Window*, int*, int*, unsigned int*, unsigned int*, unsigned int*, unsigned int*); +extern int (*XGetIconName_dylibloader_wrapper_xlib)( Display*, Window, char**); +extern int (*XGetInputFocus_dylibloader_wrapper_xlib)( Display*, Window*, int*); +extern int (*XGetKeyboardControl_dylibloader_wrapper_xlib)( Display*, XKeyboardState*); +extern int (*XGetPointerControl_dylibloader_wrapper_xlib)( Display*, int*, int*, int*); +extern int (*XGetPointerMapping_dylibloader_wrapper_xlib)( Display*, unsigned char*, int); +extern int (*XGetScreenSaver_dylibloader_wrapper_xlib)( Display*, int*, int*, int*, int*); +extern int (*XGetTransientForHint_dylibloader_wrapper_xlib)( Display*, Window, Window*); +extern int (*XGetWindowProperty_dylibloader_wrapper_xlib)( Display*, Window, Atom, long, long, int, Atom, Atom*, int*, unsigned long*, unsigned long*, unsigned char**); +extern int (*XGetWindowAttributes_dylibloader_wrapper_xlib)( Display*, Window, XWindowAttributes*); +extern int (*XGrabButton_dylibloader_wrapper_xlib)( Display*, unsigned int, unsigned int, Window, int, unsigned int, int, int, Window, Cursor); +extern int (*XGrabKey_dylibloader_wrapper_xlib)( Display*, int, unsigned int, Window, int, int, int); +extern int (*XGrabKeyboard_dylibloader_wrapper_xlib)( Display*, Window, int, int, int, Time); +extern int (*XGrabPointer_dylibloader_wrapper_xlib)( Display*, Window, int, unsigned int, int, int, Window, Cursor, Time); +extern int (*XGrabServer_dylibloader_wrapper_xlib)( Display*); +extern int (*XHeightMMOfScreen_dylibloader_wrapper_xlib)( Screen*); +extern int (*XHeightOfScreen_dylibloader_wrapper_xlib)( Screen*); +extern int (*XIfEvent_dylibloader_wrapper_xlib)( Display*, XEvent*, Bool (*) (Display*, XEvent*, XPointer), XPointer); +extern int (*XImageByteOrder_dylibloader_wrapper_xlib)( Display*); +extern int (*XInstallColormap_dylibloader_wrapper_xlib)( Display*, Colormap); +extern KeyCode (*XKeysymToKeycode_dylibloader_wrapper_xlib)( Display*, KeySym); +extern int (*XKillClient_dylibloader_wrapper_xlib)( Display*, XID); +extern int (*XLookupColor_dylibloader_wrapper_xlib)( Display*, Colormap,const char*, XColor*, XColor*); +extern int (*XLowerWindow_dylibloader_wrapper_xlib)( Display*, Window); +extern int (*XMapRaised_dylibloader_wrapper_xlib)( Display*, Window); +extern int (*XMapSubwindows_dylibloader_wrapper_xlib)( Display*, Window); +extern int (*XMapWindow_dylibloader_wrapper_xlib)( Display*, Window); +extern int (*XMaskEvent_dylibloader_wrapper_xlib)( Display*, long, XEvent*); +extern int (*XMaxCmapsOfScreen_dylibloader_wrapper_xlib)( Screen*); +extern int (*XMinCmapsOfScreen_dylibloader_wrapper_xlib)( Screen*); +extern int (*XMoveResizeWindow_dylibloader_wrapper_xlib)( Display*, Window, int, int, unsigned int, unsigned int); +extern int (*XMoveWindow_dylibloader_wrapper_xlib)( Display*, Window, int, int); +extern int (*XNextEvent_dylibloader_wrapper_xlib)( Display*, XEvent*); +extern int (*XNoOp_dylibloader_wrapper_xlib)( Display*); +extern int (*XParseColor_dylibloader_wrapper_xlib)( Display*, Colormap,const char*, XColor*); +extern int (*XParseGeometry_dylibloader_wrapper_xlib)(const char*, int*, int*, unsigned int*, unsigned int*); +extern int (*XPeekEvent_dylibloader_wrapper_xlib)( Display*, XEvent*); +extern int (*XPeekIfEvent_dylibloader_wrapper_xlib)( Display*, XEvent*, Bool (*) (Display*, XEvent*, XPointer), XPointer); +extern int (*XPending_dylibloader_wrapper_xlib)( Display*); +extern int (*XPlanesOfScreen_dylibloader_wrapper_xlib)( Screen*); +extern int (*XProtocolRevision_dylibloader_wrapper_xlib)( Display*); +extern int (*XProtocolVersion_dylibloader_wrapper_xlib)( Display*); +extern int (*XPutBackEvent_dylibloader_wrapper_xlib)( Display*, XEvent*); +extern int (*XPutImage_dylibloader_wrapper_xlib)( Display*, Drawable, GC, XImage*, int, int, int, int, unsigned int, unsigned int); +extern int (*XQLength_dylibloader_wrapper_xlib)( Display*); +extern int (*XQueryBestCursor_dylibloader_wrapper_xlib)( Display*, Drawable, unsigned int, unsigned int, unsigned int*, unsigned int*); +extern int (*XQueryBestSize_dylibloader_wrapper_xlib)( Display*, int, Drawable, unsigned int, unsigned int, unsigned int*, unsigned int*); +extern int (*XQueryBestStipple_dylibloader_wrapper_xlib)( Display*, Drawable, unsigned int, unsigned int, unsigned int*, unsigned int*); +extern int (*XQueryBestTile_dylibloader_wrapper_xlib)( Display*, Drawable, unsigned int, unsigned int, unsigned int*, unsigned int*); +extern int (*XQueryColor_dylibloader_wrapper_xlib)( Display*, Colormap, XColor*); +extern int (*XQueryColors_dylibloader_wrapper_xlib)( Display*, Colormap, XColor*, int); +extern int (*XQueryExtension_dylibloader_wrapper_xlib)( Display*,const char*, int*, int*, int*); +extern int (*XQueryKeymap_dylibloader_wrapper_xlib)( Display*, char [32]); +extern int (*XQueryPointer_dylibloader_wrapper_xlib)( Display*, Window, Window*, Window*, int*, int*, int*, int*, unsigned int*); +extern int (*XQueryTextExtents_dylibloader_wrapper_xlib)( Display*, XID,const char*, int, int*, int*, int*, XCharStruct*); +extern int (*XQueryTextExtents16_dylibloader_wrapper_xlib)( Display*, XID,const XChar2b*, int, int*, int*, int*, XCharStruct*); +extern int (*XQueryTree_dylibloader_wrapper_xlib)( Display*, Window, Window*, Window*, Window**, unsigned int*); +extern int (*XRaiseWindow_dylibloader_wrapper_xlib)( Display*, Window); +extern int (*XReadBitmapFile_dylibloader_wrapper_xlib)( Display*, Drawable,const char*, unsigned int*, unsigned int*, Pixmap*, int*, int*); +extern int (*XReadBitmapFileData_dylibloader_wrapper_xlib)(const char*, unsigned int*, unsigned int*, unsigned char**, int*, int*); +extern int (*XRebindKeysym_dylibloader_wrapper_xlib)( Display*, KeySym, KeySym*, int,const unsigned char*, int); +extern int (*XRecolorCursor_dylibloader_wrapper_xlib)( Display*, Cursor, XColor*, XColor*); +extern int (*XRefreshKeyboardMapping_dylibloader_wrapper_xlib)( XMappingEvent*); +extern int (*XRemoveFromSaveSet_dylibloader_wrapper_xlib)( Display*, Window); +extern int (*XRemoveHost_dylibloader_wrapper_xlib)( Display*, XHostAddress*); +extern int (*XRemoveHosts_dylibloader_wrapper_xlib)( Display*, XHostAddress*, int); +extern int (*XReparentWindow_dylibloader_wrapper_xlib)( Display*, Window, Window, int, int); +extern int (*XResetScreenSaver_dylibloader_wrapper_xlib)( Display*); +extern int (*XResizeWindow_dylibloader_wrapper_xlib)( Display*, Window, unsigned int, unsigned int); +extern int (*XRestackWindows_dylibloader_wrapper_xlib)( Display*, Window*, int); +extern int (*XRotateBuffers_dylibloader_wrapper_xlib)( Display*, int); +extern int (*XRotateWindowProperties_dylibloader_wrapper_xlib)( Display*, Window, Atom*, int, int); +extern int (*XScreenCount_dylibloader_wrapper_xlib)( Display*); +extern int (*XSelectInput_dylibloader_wrapper_xlib)( Display*, Window, long); +extern int (*XSendEvent_dylibloader_wrapper_xlib)( Display*, Window, int, long, XEvent*); +extern int (*XSetAccessControl_dylibloader_wrapper_xlib)( Display*, int); +extern int (*XSetArcMode_dylibloader_wrapper_xlib)( Display*, GC, int); +extern int (*XSetBackground_dylibloader_wrapper_xlib)( Display*, GC, unsigned long); +extern int (*XSetClipMask_dylibloader_wrapper_xlib)( Display*, GC, Pixmap); +extern int (*XSetClipOrigin_dylibloader_wrapper_xlib)( Display*, GC, int, int); +extern int (*XSetClipRectangles_dylibloader_wrapper_xlib)( Display*, GC, int, int, XRectangle*, int, int); +extern int (*XSetCloseDownMode_dylibloader_wrapper_xlib)( Display*, int); +extern int (*XSetCommand_dylibloader_wrapper_xlib)( Display*, Window, char**, int); +extern int (*XSetDashes_dylibloader_wrapper_xlib)( Display*, GC, int,const char*, int); +extern int (*XSetFillRule_dylibloader_wrapper_xlib)( Display*, GC, int); +extern int (*XSetFillStyle_dylibloader_wrapper_xlib)( Display*, GC, int); +extern int (*XSetFont_dylibloader_wrapper_xlib)( Display*, GC, Font); +extern int (*XSetFontPath_dylibloader_wrapper_xlib)( Display*, char**, int); +extern int (*XSetForeground_dylibloader_wrapper_xlib)( Display*, GC, unsigned long); +extern int (*XSetFunction_dylibloader_wrapper_xlib)( Display*, GC, int); +extern int (*XSetGraphicsExposures_dylibloader_wrapper_xlib)( Display*, GC, int); +extern int (*XSetIconName_dylibloader_wrapper_xlib)( Display*, Window,const char*); +extern int (*XSetInputFocus_dylibloader_wrapper_xlib)( Display*, Window, int, Time); +extern int (*XSetLineAttributes_dylibloader_wrapper_xlib)( Display*, GC, unsigned int, int, int, int); +extern int (*XSetModifierMapping_dylibloader_wrapper_xlib)( Display*, XModifierKeymap*); +extern int (*XSetPlaneMask_dylibloader_wrapper_xlib)( Display*, GC, unsigned long); +extern int (*XSetPointerMapping_dylibloader_wrapper_xlib)( Display*,const unsigned char*, int); +extern int (*XSetScreenSaver_dylibloader_wrapper_xlib)( Display*, int, int, int, int); +extern int (*XSetSelectionOwner_dylibloader_wrapper_xlib)( Display*, Atom, Window, Time); +extern int (*XSetState_dylibloader_wrapper_xlib)( Display*, GC, unsigned long, unsigned long, int, unsigned long); +extern int (*XSetStipple_dylibloader_wrapper_xlib)( Display*, GC, Pixmap); +extern int (*XSetSubwindowMode_dylibloader_wrapper_xlib)( Display*, GC, int); +extern int (*XSetTSOrigin_dylibloader_wrapper_xlib)( Display*, GC, int, int); +extern int (*XSetTile_dylibloader_wrapper_xlib)( Display*, GC, Pixmap); +extern int (*XSetWindowBackground_dylibloader_wrapper_xlib)( Display*, Window, unsigned long); +extern int (*XSetWindowBackgroundPixmap_dylibloader_wrapper_xlib)( Display*, Window, Pixmap); +extern int (*XSetWindowBorder_dylibloader_wrapper_xlib)( Display*, Window, unsigned long); +extern int (*XSetWindowBorderPixmap_dylibloader_wrapper_xlib)( Display*, Window, Pixmap); +extern int (*XSetWindowBorderWidth_dylibloader_wrapper_xlib)( Display*, Window, unsigned int); +extern int (*XSetWindowColormap_dylibloader_wrapper_xlib)( Display*, Window, Colormap); +extern int (*XStoreBuffer_dylibloader_wrapper_xlib)( Display*,const char*, int, int); +extern int (*XStoreBytes_dylibloader_wrapper_xlib)( Display*,const char*, int); +extern int (*XStoreColor_dylibloader_wrapper_xlib)( Display*, Colormap, XColor*); +extern int (*XStoreColors_dylibloader_wrapper_xlib)( Display*, Colormap, XColor*, int); +extern int (*XStoreName_dylibloader_wrapper_xlib)( Display*, Window,const char*); +extern int (*XStoreNamedColor_dylibloader_wrapper_xlib)( Display*, Colormap,const char*, unsigned long, int); +extern int (*XSync_dylibloader_wrapper_xlib)( Display*, int); +extern int (*XTextExtents_dylibloader_wrapper_xlib)( XFontStruct*,const char*, int, int*, int*, int*, XCharStruct*); +extern int (*XTextExtents16_dylibloader_wrapper_xlib)( XFontStruct*,const XChar2b*, int, int*, int*, int*, XCharStruct*); +extern int (*XTextWidth_dylibloader_wrapper_xlib)( XFontStruct*,const char*, int); +extern int (*XTextWidth16_dylibloader_wrapper_xlib)( XFontStruct*,const XChar2b*, int); +extern int (*XTranslateCoordinates_dylibloader_wrapper_xlib)( Display*, Window, Window, int, int, int*, int*, Window*); +extern int (*XUndefineCursor_dylibloader_wrapper_xlib)( Display*, Window); +extern int (*XUngrabButton_dylibloader_wrapper_xlib)( Display*, unsigned int, unsigned int, Window); +extern int (*XUngrabKey_dylibloader_wrapper_xlib)( Display*, int, unsigned int, Window); +extern int (*XUngrabKeyboard_dylibloader_wrapper_xlib)( Display*, Time); +extern int (*XUngrabPointer_dylibloader_wrapper_xlib)( Display*, Time); +extern int (*XUngrabServer_dylibloader_wrapper_xlib)( Display*); +extern int (*XUninstallColormap_dylibloader_wrapper_xlib)( Display*, Colormap); +extern int (*XUnloadFont_dylibloader_wrapper_xlib)( Display*, Font); +extern int (*XUnmapSubwindows_dylibloader_wrapper_xlib)( Display*, Window); +extern int (*XUnmapWindow_dylibloader_wrapper_xlib)( Display*, Window); +extern int (*XVendorRelease_dylibloader_wrapper_xlib)( Display*); +extern int (*XWarpPointer_dylibloader_wrapper_xlib)( Display*, Window, Window, int, int, unsigned int, unsigned int, int, int); +extern int (*XWidthMMOfScreen_dylibloader_wrapper_xlib)( Screen*); +extern int (*XWidthOfScreen_dylibloader_wrapper_xlib)( Screen*); +extern int (*XWindowEvent_dylibloader_wrapper_xlib)( Display*, Window, long, XEvent*); +extern int (*XWriteBitmapFile_dylibloader_wrapper_xlib)( Display*,const char*, Pixmap, unsigned int, unsigned int, int, int); +extern int (*XSupportsLocale_dylibloader_wrapper_xlib)( void); +extern char* (*XSetLocaleModifiers_dylibloader_wrapper_xlib)(const char*); +extern XOM (*XOpenOM_dylibloader_wrapper_xlib)( Display*,struct _XrmHashBucketRec*,const char*,const char*); +extern int (*XCloseOM_dylibloader_wrapper_xlib)( XOM); +extern char* (*XSetOMValues_dylibloader_wrapper_xlib)( XOM,...); +extern char* (*XGetOMValues_dylibloader_wrapper_xlib)( XOM,...); +extern Display* (*XDisplayOfOM_dylibloader_wrapper_xlib)( XOM); +extern char* (*XLocaleOfOM_dylibloader_wrapper_xlib)( XOM); +extern XOC (*XCreateOC_dylibloader_wrapper_xlib)( XOM,...); +extern void (*XDestroyOC_dylibloader_wrapper_xlib)( XOC); +extern XOM (*XOMOfOC_dylibloader_wrapper_xlib)( XOC); +extern char* (*XSetOCValues_dylibloader_wrapper_xlib)( XOC,...); +extern char* (*XGetOCValues_dylibloader_wrapper_xlib)( XOC,...); +extern XFontSet (*XCreateFontSet_dylibloader_wrapper_xlib)( Display*,const char*, char***, int*, char**); +extern void (*XFreeFontSet_dylibloader_wrapper_xlib)( Display*, XFontSet); +extern int (*XFontsOfFontSet_dylibloader_wrapper_xlib)( XFontSet, XFontStruct***, char***); +extern char* (*XBaseFontNameListOfFontSet_dylibloader_wrapper_xlib)( XFontSet); +extern char* (*XLocaleOfFontSet_dylibloader_wrapper_xlib)( XFontSet); +extern int (*XContextDependentDrawing_dylibloader_wrapper_xlib)( XFontSet); +extern int (*XDirectionalDependentDrawing_dylibloader_wrapper_xlib)( XFontSet); +extern int (*XContextualDrawing_dylibloader_wrapper_xlib)( XFontSet); +extern XFontSetExtents* (*XExtentsOfFontSet_dylibloader_wrapper_xlib)( XFontSet); +extern int (*XmbTextEscapement_dylibloader_wrapper_xlib)( XFontSet,const char*, int); +extern int (*XwcTextEscapement_dylibloader_wrapper_xlib)( XFontSet,const wchar_t*, int); +extern int (*Xutf8TextEscapement_dylibloader_wrapper_xlib)( XFontSet,const char*, int); +extern int (*XmbTextExtents_dylibloader_wrapper_xlib)( XFontSet,const char*, int, XRectangle*, XRectangle*); +extern int (*XwcTextExtents_dylibloader_wrapper_xlib)( XFontSet,const wchar_t*, int, XRectangle*, XRectangle*); +extern int (*Xutf8TextExtents_dylibloader_wrapper_xlib)( XFontSet,const char*, int, XRectangle*, XRectangle*); +extern int (*XmbTextPerCharExtents_dylibloader_wrapper_xlib)( XFontSet,const char*, int, XRectangle*, XRectangle*, int, int*, XRectangle*, XRectangle*); +extern int (*XwcTextPerCharExtents_dylibloader_wrapper_xlib)( XFontSet,const wchar_t*, int, XRectangle*, XRectangle*, int, int*, XRectangle*, XRectangle*); +extern int (*Xutf8TextPerCharExtents_dylibloader_wrapper_xlib)( XFontSet,const char*, int, XRectangle*, XRectangle*, int, int*, XRectangle*, XRectangle*); +extern void (*XmbDrawText_dylibloader_wrapper_xlib)( Display*, Drawable, GC, int, int, XmbTextItem*, int); +extern void (*XwcDrawText_dylibloader_wrapper_xlib)( Display*, Drawable, GC, int, int, XwcTextItem*, int); +extern void (*Xutf8DrawText_dylibloader_wrapper_xlib)( Display*, Drawable, GC, int, int, XmbTextItem*, int); +extern void (*XmbDrawString_dylibloader_wrapper_xlib)( Display*, Drawable, XFontSet, GC, int, int,const char*, int); +extern void (*XwcDrawString_dylibloader_wrapper_xlib)( Display*, Drawable, XFontSet, GC, int, int,const wchar_t*, int); +extern void (*Xutf8DrawString_dylibloader_wrapper_xlib)( Display*, Drawable, XFontSet, GC, int, int,const char*, int); +extern void (*XmbDrawImageString_dylibloader_wrapper_xlib)( Display*, Drawable, XFontSet, GC, int, int,const char*, int); +extern void (*XwcDrawImageString_dylibloader_wrapper_xlib)( Display*, Drawable, XFontSet, GC, int, int,const wchar_t*, int); +extern void (*Xutf8DrawImageString_dylibloader_wrapper_xlib)( Display*, Drawable, XFontSet, GC, int, int,const char*, int); +extern XIM (*XOpenIM_dylibloader_wrapper_xlib)( Display*,struct _XrmHashBucketRec*, char*, char*); +extern int (*XCloseIM_dylibloader_wrapper_xlib)( XIM); +extern char* (*XGetIMValues_dylibloader_wrapper_xlib)( XIM,...); +extern char* (*XSetIMValues_dylibloader_wrapper_xlib)( XIM,...); +extern Display* (*XDisplayOfIM_dylibloader_wrapper_xlib)( XIM); +extern char* (*XLocaleOfIM_dylibloader_wrapper_xlib)( XIM); +extern XIC (*XCreateIC_dylibloader_wrapper_xlib)( XIM,...); +extern void (*XDestroyIC_dylibloader_wrapper_xlib)( XIC); +extern void (*XSetICFocus_dylibloader_wrapper_xlib)( XIC); +extern void (*XUnsetICFocus_dylibloader_wrapper_xlib)( XIC); +extern wchar_t* (*XwcResetIC_dylibloader_wrapper_xlib)( XIC); +extern char* (*XmbResetIC_dylibloader_wrapper_xlib)( XIC); +extern char* (*Xutf8ResetIC_dylibloader_wrapper_xlib)( XIC); +extern char* (*XSetICValues_dylibloader_wrapper_xlib)( XIC,...); +extern char* (*XGetICValues_dylibloader_wrapper_xlib)( XIC,...); +extern XIM (*XIMOfIC_dylibloader_wrapper_xlib)( XIC); +extern int (*XFilterEvent_dylibloader_wrapper_xlib)( XEvent*, Window); +extern int (*XmbLookupString_dylibloader_wrapper_xlib)( XIC, XKeyPressedEvent*, char*, int, KeySym*, int*); +extern int (*XwcLookupString_dylibloader_wrapper_xlib)( XIC, XKeyPressedEvent*, wchar_t*, int, KeySym*, int*); +extern int (*Xutf8LookupString_dylibloader_wrapper_xlib)( XIC, XKeyPressedEvent*, char*, int, KeySym*, int*); +extern XVaNestedList (*XVaCreateNestedList_dylibloader_wrapper_xlib)( int,...); +extern int (*XRegisterIMInstantiateCallback_dylibloader_wrapper_xlib)( Display*,struct _XrmHashBucketRec*, char*, char*, XIDProc, XPointer); +extern int (*XUnregisterIMInstantiateCallback_dylibloader_wrapper_xlib)( Display*,struct _XrmHashBucketRec*, char*, char*, XIDProc, XPointer); +extern int (*XInternalConnectionNumbers_dylibloader_wrapper_xlib)( Display*, int**, int*); +extern void (*XProcessInternalConnection_dylibloader_wrapper_xlib)( Display*, int); +extern int (*XAddConnectionWatch_dylibloader_wrapper_xlib)( Display*, XConnectionWatchProc, XPointer); +extern void (*XRemoveConnectionWatch_dylibloader_wrapper_xlib)( Display*, XConnectionWatchProc, XPointer); +extern void (*XSetAuthorization_dylibloader_wrapper_xlib)( char*, int, char*, int); +extern int (*_Xmbtowc_dylibloader_wrapper_xlib)( wchar_t*, char*, int); +extern int (*_Xwctomb_dylibloader_wrapper_xlib)( char*, wchar_t); +extern int (*XGetEventData_dylibloader_wrapper_xlib)( Display*, XGenericEventCookie*); +extern void (*XFreeEventData_dylibloader_wrapper_xlib)( Display*, XGenericEventCookie*); +extern XClassHint* (*XAllocClassHint_dylibloader_wrapper_xlib)( void); +extern XIconSize* (*XAllocIconSize_dylibloader_wrapper_xlib)( void); +extern XSizeHints* (*XAllocSizeHints_dylibloader_wrapper_xlib)( void); +extern XStandardColormap* (*XAllocStandardColormap_dylibloader_wrapper_xlib)( void); +extern XWMHints* (*XAllocWMHints_dylibloader_wrapper_xlib)( void); +extern int (*XClipBox_dylibloader_wrapper_xlib)( Region, XRectangle*); +extern Region (*XCreateRegion_dylibloader_wrapper_xlib)( void); +extern const char* (*XDefaultString_dylibloader_wrapper_xlib)( void); +extern int (*XDeleteContext_dylibloader_wrapper_xlib)( Display*, XID, XContext); +extern int (*XDestroyRegion_dylibloader_wrapper_xlib)( Region); +extern int (*XEmptyRegion_dylibloader_wrapper_xlib)( Region); +extern int (*XEqualRegion_dylibloader_wrapper_xlib)( Region, Region); +extern int (*XFindContext_dylibloader_wrapper_xlib)( Display*, XID, XContext, XPointer*); +extern int (*XGetClassHint_dylibloader_wrapper_xlib)( Display*, Window, XClassHint*); +extern int (*XGetIconSizes_dylibloader_wrapper_xlib)( Display*, Window, XIconSize**, int*); +extern int (*XGetNormalHints_dylibloader_wrapper_xlib)( Display*, Window, XSizeHints*); +extern int (*XGetRGBColormaps_dylibloader_wrapper_xlib)( Display*, Window, XStandardColormap**, int*, Atom); +extern int (*XGetSizeHints_dylibloader_wrapper_xlib)( Display*, Window, XSizeHints*, Atom); +extern int (*XGetStandardColormap_dylibloader_wrapper_xlib)( Display*, Window, XStandardColormap*, Atom); +extern int (*XGetTextProperty_dylibloader_wrapper_xlib)( Display*, Window, XTextProperty*, Atom); +extern XVisualInfo* (*XGetVisualInfo_dylibloader_wrapper_xlib)( Display*, long, XVisualInfo*, int*); +extern int (*XGetWMClientMachine_dylibloader_wrapper_xlib)( Display*, Window, XTextProperty*); +extern XWMHints* (*XGetWMHints_dylibloader_wrapper_xlib)( Display*, Window); +extern int (*XGetWMIconName_dylibloader_wrapper_xlib)( Display*, Window, XTextProperty*); +extern int (*XGetWMName_dylibloader_wrapper_xlib)( Display*, Window, XTextProperty*); +extern int (*XGetWMNormalHints_dylibloader_wrapper_xlib)( Display*, Window, XSizeHints*, long*); +extern int (*XGetWMSizeHints_dylibloader_wrapper_xlib)( Display*, Window, XSizeHints*, long*, Atom); +extern int (*XGetZoomHints_dylibloader_wrapper_xlib)( Display*, Window, XSizeHints*); +extern int (*XIntersectRegion_dylibloader_wrapper_xlib)( Region, Region, Region); +extern void (*XConvertCase_dylibloader_wrapper_xlib)( KeySym, KeySym*, KeySym*); +extern int (*XLookupString_dylibloader_wrapper_xlib)( XKeyEvent*, char*, int, KeySym*, XComposeStatus*); +extern int (*XMatchVisualInfo_dylibloader_wrapper_xlib)( Display*, int, int, int, XVisualInfo*); +extern int (*XOffsetRegion_dylibloader_wrapper_xlib)( Region, int, int); +extern int (*XPointInRegion_dylibloader_wrapper_xlib)( Region, int, int); +extern Region (*XPolygonRegion_dylibloader_wrapper_xlib)( XPoint*, int, int); +extern int (*XRectInRegion_dylibloader_wrapper_xlib)( Region, int, int, unsigned int, unsigned int); +extern int (*XSaveContext_dylibloader_wrapper_xlib)( Display*, XID, XContext,const char*); +extern int (*XSetClassHint_dylibloader_wrapper_xlib)( Display*, Window, XClassHint*); +extern int (*XSetIconSizes_dylibloader_wrapper_xlib)( Display*, Window, XIconSize*, int); +extern int (*XSetNormalHints_dylibloader_wrapper_xlib)( Display*, Window, XSizeHints*); +extern void (*XSetRGBColormaps_dylibloader_wrapper_xlib)( Display*, Window, XStandardColormap*, int, Atom); +extern int (*XSetSizeHints_dylibloader_wrapper_xlib)( Display*, Window, XSizeHints*, Atom); +extern int (*XSetStandardProperties_dylibloader_wrapper_xlib)( Display*, Window,const char*,const char*, Pixmap, char**, int, XSizeHints*); +extern void (*XSetTextProperty_dylibloader_wrapper_xlib)( Display*, Window, XTextProperty*, Atom); +extern void (*XSetWMClientMachine_dylibloader_wrapper_xlib)( Display*, Window, XTextProperty*); +extern int (*XSetWMHints_dylibloader_wrapper_xlib)( Display*, Window, XWMHints*); +extern void (*XSetWMIconName_dylibloader_wrapper_xlib)( Display*, Window, XTextProperty*); +extern void (*XSetWMName_dylibloader_wrapper_xlib)( Display*, Window, XTextProperty*); +extern void (*XSetWMNormalHints_dylibloader_wrapper_xlib)( Display*, Window, XSizeHints*); +extern void (*XSetWMProperties_dylibloader_wrapper_xlib)( Display*, Window, XTextProperty*, XTextProperty*, char**, int, XSizeHints*, XWMHints*, XClassHint*); +extern void (*XmbSetWMProperties_dylibloader_wrapper_xlib)( Display*, Window,const char*,const char*, char**, int, XSizeHints*, XWMHints*, XClassHint*); +extern void (*Xutf8SetWMProperties_dylibloader_wrapper_xlib)( Display*, Window,const char*,const char*, char**, int, XSizeHints*, XWMHints*, XClassHint*); +extern void (*XSetWMSizeHints_dylibloader_wrapper_xlib)( Display*, Window, XSizeHints*, Atom); +extern int (*XSetRegion_dylibloader_wrapper_xlib)( Display*, GC, Region); +extern void (*XSetStandardColormap_dylibloader_wrapper_xlib)( Display*, Window, XStandardColormap*, Atom); +extern int (*XSetZoomHints_dylibloader_wrapper_xlib)( Display*, Window, XSizeHints*); +extern int (*XShrinkRegion_dylibloader_wrapper_xlib)( Region, int, int); +extern int (*XStringListToTextProperty_dylibloader_wrapper_xlib)( char**, int, XTextProperty*); +extern int (*XSubtractRegion_dylibloader_wrapper_xlib)( Region, Region, Region); +extern int (*XmbTextListToTextProperty_dylibloader_wrapper_xlib)( Display*, char**, int, XICCEncodingStyle, XTextProperty*); +extern int (*XwcTextListToTextProperty_dylibloader_wrapper_xlib)( Display*, wchar_t**, int, XICCEncodingStyle, XTextProperty*); +extern int (*Xutf8TextListToTextProperty_dylibloader_wrapper_xlib)( Display*, char**, int, XICCEncodingStyle, XTextProperty*); +extern void (*XwcFreeStringList_dylibloader_wrapper_xlib)( wchar_t**); +extern int (*XTextPropertyToStringList_dylibloader_wrapper_xlib)( XTextProperty*, char***, int*); +extern int (*XmbTextPropertyToTextList_dylibloader_wrapper_xlib)( Display*,const XTextProperty*, char***, int*); +extern int (*XwcTextPropertyToTextList_dylibloader_wrapper_xlib)( Display*,const XTextProperty*, wchar_t***, int*); +extern int (*Xutf8TextPropertyToTextList_dylibloader_wrapper_xlib)( Display*,const XTextProperty*, char***, int*); +extern int (*XUnionRectWithRegion_dylibloader_wrapper_xlib)( XRectangle*, Region, Region); +extern int (*XUnionRegion_dylibloader_wrapper_xlib)( Region, Region, Region); +extern int (*XWMGeometry_dylibloader_wrapper_xlib)( Display*, int,const char*,const char*, unsigned int, XSizeHints*, int*, int*, int*, int*, int*); +extern int (*XXorRegion_dylibloader_wrapper_xlib)( Region, Region, Region); +extern int (*XkbIgnoreExtension_dylibloader_wrapper_xlib)( int); +extern Display* (*XkbOpenDisplay_dylibloader_wrapper_xlib)( char*, int*, int*, int*, int*, int*); +extern int (*XkbQueryExtension_dylibloader_wrapper_xlib)( Display*, int*, int*, int*, int*, int*); +extern int (*XkbUseExtension_dylibloader_wrapper_xlib)( Display*, int*, int*); +extern int (*XkbLibraryVersion_dylibloader_wrapper_xlib)( int*, int*); +extern unsigned int (*XkbSetXlibControls_dylibloader_wrapper_xlib)( Display*, unsigned int, unsigned int); +extern unsigned int (*XkbGetXlibControls_dylibloader_wrapper_xlib)( Display*); +extern unsigned int (*XkbXlibControlsImplemented_dylibloader_wrapper_xlib)( void); +extern void (*XkbSetAtomFuncs_dylibloader_wrapper_xlib)( XkbInternAtomFunc, XkbGetAtomNameFunc); +extern KeySym (*XkbKeycodeToKeysym_dylibloader_wrapper_xlib)( Display*, KeyCode, int, int); +extern unsigned int (*XkbKeysymToModifiers_dylibloader_wrapper_xlib)( Display*, KeySym); +extern int (*XkbLookupKeySym_dylibloader_wrapper_xlib)( Display*, KeyCode, unsigned int, unsigned int*, KeySym*); +extern int (*XkbLookupKeyBinding_dylibloader_wrapper_xlib)( Display*, KeySym, unsigned int, char*, int, int*); +extern int (*XkbTranslateKeyCode_dylibloader_wrapper_xlib)( XkbDescPtr, KeyCode, unsigned int, unsigned int*, KeySym*); +extern int (*XkbTranslateKeySym_dylibloader_wrapper_xlib)( Display*, KeySym*, unsigned int, char*, int, int*); +extern int (*XkbSetAutoRepeatRate_dylibloader_wrapper_xlib)( Display*, unsigned int, unsigned int, unsigned int); +extern int (*XkbGetAutoRepeatRate_dylibloader_wrapper_xlib)( Display*, unsigned int, unsigned int*, unsigned int*); +extern int (*XkbChangeEnabledControls_dylibloader_wrapper_xlib)( Display*, unsigned int, unsigned int, unsigned int); +extern int (*XkbDeviceBell_dylibloader_wrapper_xlib)( Display*, Window, int, int, int, int, Atom); +extern int (*XkbForceDeviceBell_dylibloader_wrapper_xlib)( Display*, int, int, int, int); +extern int (*XkbDeviceBellEvent_dylibloader_wrapper_xlib)( Display*, Window, int, int, int, int, Atom); +extern int (*XkbBell_dylibloader_wrapper_xlib)( Display*, Window, int, Atom); +extern int (*XkbForceBell_dylibloader_wrapper_xlib)( Display*, int); +extern int (*XkbBellEvent_dylibloader_wrapper_xlib)( Display*, Window, int, Atom); +extern int (*XkbSelectEvents_dylibloader_wrapper_xlib)( Display*, unsigned int, unsigned int, unsigned int); +extern int (*XkbSelectEventDetails_dylibloader_wrapper_xlib)( Display*, unsigned int, unsigned int, unsigned long, unsigned long); +extern void (*XkbNoteMapChanges_dylibloader_wrapper_xlib)( XkbMapChangesPtr, XkbMapNotifyEvent*, unsigned int); +extern void (*XkbNoteNameChanges_dylibloader_wrapper_xlib)( XkbNameChangesPtr, XkbNamesNotifyEvent*, unsigned int); +extern int (*XkbGetIndicatorState_dylibloader_wrapper_xlib)( Display*, unsigned int, unsigned int*); +extern int (*XkbGetIndicatorMap_dylibloader_wrapper_xlib)( Display*, unsigned long, XkbDescPtr); +extern int (*XkbSetIndicatorMap_dylibloader_wrapper_xlib)( Display*, unsigned long, XkbDescPtr); +extern int (*XkbGetNamedIndicator_dylibloader_wrapper_xlib)( Display*, Atom, int*, int*, XkbIndicatorMapPtr, int*); +extern int (*XkbGetNamedDeviceIndicator_dylibloader_wrapper_xlib)( Display*, unsigned int, unsigned int, unsigned int, Atom, int*, int*, XkbIndicatorMapPtr, int*); +extern int (*XkbSetNamedIndicator_dylibloader_wrapper_xlib)( Display*, Atom, int, int, int, XkbIndicatorMapPtr); +extern int (*XkbSetNamedDeviceIndicator_dylibloader_wrapper_xlib)( Display*, unsigned int, unsigned int, unsigned int, Atom, int, int, int, XkbIndicatorMapPtr); +extern int (*XkbLockModifiers_dylibloader_wrapper_xlib)( Display*, unsigned int, unsigned int, unsigned int); +extern int (*XkbLatchModifiers_dylibloader_wrapper_xlib)( Display*, unsigned int, unsigned int, unsigned int); +extern int (*XkbLockGroup_dylibloader_wrapper_xlib)( Display*, unsigned int, unsigned int); +extern int (*XkbLatchGroup_dylibloader_wrapper_xlib)( Display*, unsigned int, unsigned int); +extern int (*XkbSetServerInternalMods_dylibloader_wrapper_xlib)( Display*, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int); +extern int (*XkbSetIgnoreLockMods_dylibloader_wrapper_xlib)( Display*, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int); +extern int (*XkbVirtualModsToReal_dylibloader_wrapper_xlib)( XkbDescPtr, unsigned int, unsigned int*); +extern int (*XkbComputeEffectiveMap_dylibloader_wrapper_xlib)( XkbDescPtr, XkbKeyTypePtr, unsigned char*); +extern int (*XkbInitCanonicalKeyTypes_dylibloader_wrapper_xlib)( XkbDescPtr, unsigned int, int); +extern XkbDescPtr (*XkbAllocKeyboard_dylibloader_wrapper_xlib)( void); +extern void (*XkbFreeKeyboard_dylibloader_wrapper_xlib)( XkbDescPtr, unsigned int, int); +extern int (*XkbAllocClientMap_dylibloader_wrapper_xlib)( XkbDescPtr, unsigned int, unsigned int); +extern int (*XkbAllocServerMap_dylibloader_wrapper_xlib)( XkbDescPtr, unsigned int, unsigned int); +extern void (*XkbFreeClientMap_dylibloader_wrapper_xlib)( XkbDescPtr, unsigned int, int); +extern void (*XkbFreeServerMap_dylibloader_wrapper_xlib)( XkbDescPtr, unsigned int, int); +extern XkbKeyTypePtr (*XkbAddKeyType_dylibloader_wrapper_xlib)( XkbDescPtr, Atom, int, int, int); +extern int (*XkbAllocIndicatorMaps_dylibloader_wrapper_xlib)( XkbDescPtr); +extern void (*XkbFreeIndicatorMaps_dylibloader_wrapper_xlib)( XkbDescPtr); +extern XkbDescPtr (*XkbGetMap_dylibloader_wrapper_xlib)( Display*, unsigned int, unsigned int); +extern int (*XkbGetUpdatedMap_dylibloader_wrapper_xlib)( Display*, unsigned int, XkbDescPtr); +extern int (*XkbGetMapChanges_dylibloader_wrapper_xlib)( Display*, XkbDescPtr, XkbMapChangesPtr); +extern int (*XkbRefreshKeyboardMapping_dylibloader_wrapper_xlib)( XkbMapNotifyEvent*); +extern int (*XkbGetKeyTypes_dylibloader_wrapper_xlib)( Display*, unsigned int, unsigned int, XkbDescPtr); +extern int (*XkbGetKeySyms_dylibloader_wrapper_xlib)( Display*, unsigned int, unsigned int, XkbDescPtr); +extern int (*XkbGetKeyActions_dylibloader_wrapper_xlib)( Display*, unsigned int, unsigned int, XkbDescPtr); +extern int (*XkbGetKeyBehaviors_dylibloader_wrapper_xlib)( Display*, unsigned int, unsigned int, XkbDescPtr); +extern int (*XkbGetVirtualMods_dylibloader_wrapper_xlib)( Display*, unsigned int, XkbDescPtr); +extern int (*XkbGetKeyExplicitComponents_dylibloader_wrapper_xlib)( Display*, unsigned int, unsigned int, XkbDescPtr); +extern int (*XkbGetKeyModifierMap_dylibloader_wrapper_xlib)( Display*, unsigned int, unsigned int, XkbDescPtr); +extern int (*XkbGetKeyVirtualModMap_dylibloader_wrapper_xlib)( Display*, unsigned int, unsigned int, XkbDescPtr); +extern int (*XkbAllocControls_dylibloader_wrapper_xlib)( XkbDescPtr, unsigned int); +extern void (*XkbFreeControls_dylibloader_wrapper_xlib)( XkbDescPtr, unsigned int, int); +extern int (*XkbGetControls_dylibloader_wrapper_xlib)( Display*, unsigned long, XkbDescPtr); +extern int (*XkbSetControls_dylibloader_wrapper_xlib)( Display*, unsigned long, XkbDescPtr); +extern void (*XkbNoteControlsChanges_dylibloader_wrapper_xlib)( XkbControlsChangesPtr, XkbControlsNotifyEvent*, unsigned int); +extern int (*XkbAllocCompatMap_dylibloader_wrapper_xlib)( XkbDescPtr, unsigned int, unsigned int); +extern void (*XkbFreeCompatMap_dylibloader_wrapper_xlib)( XkbDescPtr, unsigned int, int); +extern int (*XkbGetCompatMap_dylibloader_wrapper_xlib)( Display*, unsigned int, XkbDescPtr); +extern int (*XkbSetCompatMap_dylibloader_wrapper_xlib)( Display*, unsigned int, XkbDescPtr, int); +extern int (*XkbAllocNames_dylibloader_wrapper_xlib)( XkbDescPtr, unsigned int, int, int); +extern int (*XkbGetNames_dylibloader_wrapper_xlib)( Display*, unsigned int, XkbDescPtr); +extern int (*XkbSetNames_dylibloader_wrapper_xlib)( Display*, unsigned int, unsigned int, unsigned int, XkbDescPtr); +extern int (*XkbChangeNames_dylibloader_wrapper_xlib)( Display*, XkbDescPtr, XkbNameChangesPtr); +extern void (*XkbFreeNames_dylibloader_wrapper_xlib)( XkbDescPtr, unsigned int, int); +extern int (*XkbGetState_dylibloader_wrapper_xlib)( Display*, unsigned int, XkbStatePtr); +extern int (*XkbSetMap_dylibloader_wrapper_xlib)( Display*, unsigned int, XkbDescPtr); +extern int (*XkbChangeMap_dylibloader_wrapper_xlib)( Display*, XkbDescPtr, XkbMapChangesPtr); +extern int (*XkbSetDetectableAutoRepeat_dylibloader_wrapper_xlib)( Display*, int, int*); +extern int (*XkbGetDetectableAutoRepeat_dylibloader_wrapper_xlib)( Display*, int*); +extern int (*XkbSetAutoResetControls_dylibloader_wrapper_xlib)( Display*, unsigned int, unsigned int*, unsigned int*); +extern int (*XkbGetAutoResetControls_dylibloader_wrapper_xlib)( Display*, unsigned int*, unsigned int*); +extern int (*XkbSetPerClientControls_dylibloader_wrapper_xlib)( Display*, unsigned int, unsigned int*); +extern int (*XkbGetPerClientControls_dylibloader_wrapper_xlib)( Display*, unsigned int*); +extern int (*XkbCopyKeyType_dylibloader_wrapper_xlib)( XkbKeyTypePtr, XkbKeyTypePtr); +extern int (*XkbCopyKeyTypes_dylibloader_wrapper_xlib)( XkbKeyTypePtr, XkbKeyTypePtr, int); +extern int (*XkbResizeKeyType_dylibloader_wrapper_xlib)( XkbDescPtr, int, int, int, int); +extern KeySym* (*XkbResizeKeySyms_dylibloader_wrapper_xlib)( XkbDescPtr, int, int); +extern XkbAction* (*XkbResizeKeyActions_dylibloader_wrapper_xlib)( XkbDescPtr, int, int); +extern int (*XkbChangeTypesOfKey_dylibloader_wrapper_xlib)( XkbDescPtr, int, int, unsigned int, int*, XkbMapChangesPtr); +extern int (*XkbChangeKeycodeRange_dylibloader_wrapper_xlib)( XkbDescPtr, int, int, XkbChangesPtr); +extern XkbComponentListPtr (*XkbListComponents_dylibloader_wrapper_xlib)( Display*, unsigned int, XkbComponentNamesPtr, int*); +extern void (*XkbFreeComponentList_dylibloader_wrapper_xlib)( XkbComponentListPtr); +extern XkbDescPtr (*XkbGetKeyboard_dylibloader_wrapper_xlib)( Display*, unsigned int, unsigned int); +extern XkbDescPtr (*XkbGetKeyboardByName_dylibloader_wrapper_xlib)( Display*, unsigned int, XkbComponentNamesPtr, unsigned int, unsigned int, int); +extern int (*XkbKeyTypesForCoreSymbols_dylibloader_wrapper_xlib)( XkbDescPtr, int, KeySym*, unsigned int, int*, KeySym*); +extern int (*XkbApplyCompatMapToKey_dylibloader_wrapper_xlib)( XkbDescPtr, KeyCode, XkbChangesPtr); +extern int (*XkbUpdateMapFromCore_dylibloader_wrapper_xlib)( XkbDescPtr, KeyCode, int, int, KeySym*, XkbChangesPtr); +extern XkbDeviceLedInfoPtr (*XkbAddDeviceLedInfo_dylibloader_wrapper_xlib)( XkbDeviceInfoPtr, unsigned int, unsigned int); +extern int (*XkbResizeDeviceButtonActions_dylibloader_wrapper_xlib)( XkbDeviceInfoPtr, unsigned int); +extern XkbDeviceInfoPtr (*XkbAllocDeviceInfo_dylibloader_wrapper_xlib)( unsigned int, unsigned int, unsigned int); +extern void (*XkbFreeDeviceInfo_dylibloader_wrapper_xlib)( XkbDeviceInfoPtr, unsigned int, int); +extern void (*XkbNoteDeviceChanges_dylibloader_wrapper_xlib)( XkbDeviceChangesPtr, XkbExtensionDeviceNotifyEvent*, unsigned int); +extern XkbDeviceInfoPtr (*XkbGetDeviceInfo_dylibloader_wrapper_xlib)( Display*, unsigned int, unsigned int, unsigned int, unsigned int); +extern int (*XkbGetDeviceInfoChanges_dylibloader_wrapper_xlib)( Display*, XkbDeviceInfoPtr, XkbDeviceChangesPtr); +extern int (*XkbGetDeviceButtonActions_dylibloader_wrapper_xlib)( Display*, XkbDeviceInfoPtr, int, unsigned int, unsigned int); +extern int (*XkbGetDeviceLedInfo_dylibloader_wrapper_xlib)( Display*, XkbDeviceInfoPtr, unsigned int, unsigned int, unsigned int); +extern int (*XkbSetDeviceInfo_dylibloader_wrapper_xlib)( Display*, unsigned int, XkbDeviceInfoPtr); +extern int (*XkbChangeDeviceInfo_dylibloader_wrapper_xlib)( Display*, XkbDeviceInfoPtr, XkbDeviceChangesPtr); +extern int (*XkbSetDeviceLedInfo_dylibloader_wrapper_xlib)( Display*, XkbDeviceInfoPtr, unsigned int, unsigned int, unsigned int); +extern int (*XkbSetDeviceButtonActions_dylibloader_wrapper_xlib)( Display*, XkbDeviceInfoPtr, unsigned int, unsigned int); +extern char (*XkbToControl_dylibloader_wrapper_xlib)( char); +extern int (*XkbSetDebuggingFlags_dylibloader_wrapper_xlib)( Display*, unsigned int, unsigned int, char*, unsigned int, unsigned int, unsigned int*, unsigned int*); +extern int (*XkbApplyVirtualModChanges_dylibloader_wrapper_xlib)( XkbDescPtr, unsigned int, XkbChangesPtr); +extern int (*XkbUpdateActionVirtualMods_dylibloader_wrapper_xlib)( XkbDescPtr, XkbAction*, unsigned int); +extern void (*XkbUpdateKeyTypeVirtualMods_dylibloader_wrapper_xlib)( XkbDescPtr, XkbKeyTypePtr, unsigned int, XkbChangesPtr); +int initialize_xlib(int verbose); +#ifdef __cplusplus +} +#endif +#endif diff --git a/platform/linuxbsd/x11/dynwrappers/xrandr-so_wrap.c b/platform/linuxbsd/x11/dynwrappers/xrandr-so_wrap.c new file mode 100644 index 0000000000..eb0f9abf15 --- /dev/null +++ b/platform/linuxbsd/x11/dynwrappers/xrandr-so_wrap.c @@ -0,0 +1,797 @@ +// This file is generated. Do not edit! +// see https://github.com/hpvb/dynload-wrapper for details +// generated by ./generate-wrapper.py 0.3 on 2022-12-02 12:55:12 +// flags: ./generate-wrapper.py --include /usr/include/X11/extensions/Xrandr.h --sys-include <X11/extensions/Xrandr.h> --soname libXrandr.so.2 --init-name xrandr --output-header xrandr-so_wrap.h --output-implementation xrandr-so_wrap.c +// +// NOTE: Generated from Xrandr 1.5.2. +// This has been handpatched to workaround some issues with the generator that +// will be eventually fixed. In this case, non-existant symbols inherited from +// libX11 and libXrender, but absent in libXrandr.so.2, were removed. +#include <stdint.h> + +#define XRRQueryExtension XRRQueryExtension_dylibloader_orig_xrandr +#define XRRQueryVersion XRRQueryVersion_dylibloader_orig_xrandr +#define XRRGetScreenInfo XRRGetScreenInfo_dylibloader_orig_xrandr +#define XRRFreeScreenConfigInfo XRRFreeScreenConfigInfo_dylibloader_orig_xrandr +#define XRRSetScreenConfig XRRSetScreenConfig_dylibloader_orig_xrandr +#define XRRSetScreenConfigAndRate XRRSetScreenConfigAndRate_dylibloader_orig_xrandr +#define XRRConfigRotations XRRConfigRotations_dylibloader_orig_xrandr +#define XRRConfigTimes XRRConfigTimes_dylibloader_orig_xrandr +#define XRRConfigSizes XRRConfigSizes_dylibloader_orig_xrandr +#define XRRConfigRates XRRConfigRates_dylibloader_orig_xrandr +#define XRRConfigCurrentConfiguration XRRConfigCurrentConfiguration_dylibloader_orig_xrandr +#define XRRConfigCurrentRate XRRConfigCurrentRate_dylibloader_orig_xrandr +#define XRRRootToScreen XRRRootToScreen_dylibloader_orig_xrandr +#define XRRSelectInput XRRSelectInput_dylibloader_orig_xrandr +#define XRRRotations XRRRotations_dylibloader_orig_xrandr +#define XRRSizes XRRSizes_dylibloader_orig_xrandr +#define XRRRates XRRRates_dylibloader_orig_xrandr +#define XRRTimes XRRTimes_dylibloader_orig_xrandr +#define XRRGetScreenSizeRange XRRGetScreenSizeRange_dylibloader_orig_xrandr +#define XRRSetScreenSize XRRSetScreenSize_dylibloader_orig_xrandr +#define XRRGetScreenResources XRRGetScreenResources_dylibloader_orig_xrandr +#define XRRFreeScreenResources XRRFreeScreenResources_dylibloader_orig_xrandr +#define XRRGetOutputInfo XRRGetOutputInfo_dylibloader_orig_xrandr +#define XRRFreeOutputInfo XRRFreeOutputInfo_dylibloader_orig_xrandr +#define XRRListOutputProperties XRRListOutputProperties_dylibloader_orig_xrandr +#define XRRQueryOutputProperty XRRQueryOutputProperty_dylibloader_orig_xrandr +#define XRRConfigureOutputProperty XRRConfigureOutputProperty_dylibloader_orig_xrandr +#define XRRChangeOutputProperty XRRChangeOutputProperty_dylibloader_orig_xrandr +#define XRRDeleteOutputProperty XRRDeleteOutputProperty_dylibloader_orig_xrandr +#define XRRGetOutputProperty XRRGetOutputProperty_dylibloader_orig_xrandr +#define XRRAllocModeInfo XRRAllocModeInfo_dylibloader_orig_xrandr +#define XRRCreateMode XRRCreateMode_dylibloader_orig_xrandr +#define XRRDestroyMode XRRDestroyMode_dylibloader_orig_xrandr +#define XRRAddOutputMode XRRAddOutputMode_dylibloader_orig_xrandr +#define XRRDeleteOutputMode XRRDeleteOutputMode_dylibloader_orig_xrandr +#define XRRFreeModeInfo XRRFreeModeInfo_dylibloader_orig_xrandr +#define XRRGetCrtcInfo XRRGetCrtcInfo_dylibloader_orig_xrandr +#define XRRFreeCrtcInfo XRRFreeCrtcInfo_dylibloader_orig_xrandr +#define XRRSetCrtcConfig XRRSetCrtcConfig_dylibloader_orig_xrandr +#define XRRGetCrtcGammaSize XRRGetCrtcGammaSize_dylibloader_orig_xrandr +#define XRRGetCrtcGamma XRRGetCrtcGamma_dylibloader_orig_xrandr +#define XRRAllocGamma XRRAllocGamma_dylibloader_orig_xrandr +#define XRRSetCrtcGamma XRRSetCrtcGamma_dylibloader_orig_xrandr +#define XRRFreeGamma XRRFreeGamma_dylibloader_orig_xrandr +#define XRRGetScreenResourcesCurrent XRRGetScreenResourcesCurrent_dylibloader_orig_xrandr +#define XRRSetCrtcTransform XRRSetCrtcTransform_dylibloader_orig_xrandr +#define XRRGetCrtcTransform XRRGetCrtcTransform_dylibloader_orig_xrandr +#define XRRUpdateConfiguration XRRUpdateConfiguration_dylibloader_orig_xrandr +#define XRRGetPanning XRRGetPanning_dylibloader_orig_xrandr +#define XRRFreePanning XRRFreePanning_dylibloader_orig_xrandr +#define XRRSetPanning XRRSetPanning_dylibloader_orig_xrandr +#define XRRSetOutputPrimary XRRSetOutputPrimary_dylibloader_orig_xrandr +#define XRRGetOutputPrimary XRRGetOutputPrimary_dylibloader_orig_xrandr +#define XRRGetProviderResources XRRGetProviderResources_dylibloader_orig_xrandr +#define XRRFreeProviderResources XRRFreeProviderResources_dylibloader_orig_xrandr +#define XRRGetProviderInfo XRRGetProviderInfo_dylibloader_orig_xrandr +#define XRRFreeProviderInfo XRRFreeProviderInfo_dylibloader_orig_xrandr +#define XRRSetProviderOutputSource XRRSetProviderOutputSource_dylibloader_orig_xrandr +#define XRRSetProviderOffloadSink XRRSetProviderOffloadSink_dylibloader_orig_xrandr +#define XRRListProviderProperties XRRListProviderProperties_dylibloader_orig_xrandr +#define XRRQueryProviderProperty XRRQueryProviderProperty_dylibloader_orig_xrandr +#define XRRConfigureProviderProperty XRRConfigureProviderProperty_dylibloader_orig_xrandr +#define XRRChangeProviderProperty XRRChangeProviderProperty_dylibloader_orig_xrandr +#define XRRDeleteProviderProperty XRRDeleteProviderProperty_dylibloader_orig_xrandr +#define XRRGetProviderProperty XRRGetProviderProperty_dylibloader_orig_xrandr +#define XRRAllocateMonitor XRRAllocateMonitor_dylibloader_orig_xrandr +#define XRRGetMonitors XRRGetMonitors_dylibloader_orig_xrandr +#define XRRSetMonitor XRRSetMonitor_dylibloader_orig_xrandr +#define XRRDeleteMonitor XRRDeleteMonitor_dylibloader_orig_xrandr +#define XRRFreeMonitors XRRFreeMonitors_dylibloader_orig_xrandr +#include <X11/extensions/Xrandr.h> +#undef XRRQueryExtension +#undef XRRQueryVersion +#undef XRRGetScreenInfo +#undef XRRFreeScreenConfigInfo +#undef XRRSetScreenConfig +#undef XRRSetScreenConfigAndRate +#undef XRRConfigRotations +#undef XRRConfigTimes +#undef XRRConfigSizes +#undef XRRConfigRates +#undef XRRConfigCurrentConfiguration +#undef XRRConfigCurrentRate +#undef XRRRootToScreen +#undef XRRSelectInput +#undef XRRRotations +#undef XRRSizes +#undef XRRRates +#undef XRRTimes +#undef XRRGetScreenSizeRange +#undef XRRSetScreenSize +#undef XRRGetScreenResources +#undef XRRFreeScreenResources +#undef XRRGetOutputInfo +#undef XRRFreeOutputInfo +#undef XRRListOutputProperties +#undef XRRQueryOutputProperty +#undef XRRConfigureOutputProperty +#undef XRRChangeOutputProperty +#undef XRRDeleteOutputProperty +#undef XRRGetOutputProperty +#undef XRRAllocModeInfo +#undef XRRCreateMode +#undef XRRDestroyMode +#undef XRRAddOutputMode +#undef XRRDeleteOutputMode +#undef XRRFreeModeInfo +#undef XRRGetCrtcInfo +#undef XRRFreeCrtcInfo +#undef XRRSetCrtcConfig +#undef XRRGetCrtcGammaSize +#undef XRRGetCrtcGamma +#undef XRRAllocGamma +#undef XRRSetCrtcGamma +#undef XRRFreeGamma +#undef XRRGetScreenResourcesCurrent +#undef XRRSetCrtcTransform +#undef XRRGetCrtcTransform +#undef XRRUpdateConfiguration +#undef XRRGetPanning +#undef XRRFreePanning +#undef XRRSetPanning +#undef XRRSetOutputPrimary +#undef XRRGetOutputPrimary +#undef XRRGetProviderResources +#undef XRRFreeProviderResources +#undef XRRGetProviderInfo +#undef XRRFreeProviderInfo +#undef XRRSetProviderOutputSource +#undef XRRSetProviderOffloadSink +#undef XRRListProviderProperties +#undef XRRQueryProviderProperty +#undef XRRConfigureProviderProperty +#undef XRRChangeProviderProperty +#undef XRRDeleteProviderProperty +#undef XRRGetProviderProperty +#undef XRRAllocateMonitor +#undef XRRGetMonitors +#undef XRRSetMonitor +#undef XRRDeleteMonitor +#undef XRRFreeMonitors +#include <dlfcn.h> +#include <stdio.h> +int (*XRRQueryExtension_dylibloader_wrapper_xrandr)( Display*, int*, int*); +int (*XRRQueryVersion_dylibloader_wrapper_xrandr)( Display*, int*, int*); +XRRScreenConfiguration* (*XRRGetScreenInfo_dylibloader_wrapper_xrandr)( Display*, Window); +void (*XRRFreeScreenConfigInfo_dylibloader_wrapper_xrandr)( XRRScreenConfiguration*); +int (*XRRSetScreenConfig_dylibloader_wrapper_xrandr)( Display*, XRRScreenConfiguration*, Drawable, int, Rotation, Time); +int (*XRRSetScreenConfigAndRate_dylibloader_wrapper_xrandr)( Display*, XRRScreenConfiguration*, Drawable, int, Rotation, short, Time); +Rotation (*XRRConfigRotations_dylibloader_wrapper_xrandr)( XRRScreenConfiguration*, Rotation*); +Time (*XRRConfigTimes_dylibloader_wrapper_xrandr)( XRRScreenConfiguration*, Time*); +XRRScreenSize* (*XRRConfigSizes_dylibloader_wrapper_xrandr)( XRRScreenConfiguration*, int*); +short* (*XRRConfigRates_dylibloader_wrapper_xrandr)( XRRScreenConfiguration*, int, int*); +SizeID (*XRRConfigCurrentConfiguration_dylibloader_wrapper_xrandr)( XRRScreenConfiguration*, Rotation*); +short (*XRRConfigCurrentRate_dylibloader_wrapper_xrandr)( XRRScreenConfiguration*); +int (*XRRRootToScreen_dylibloader_wrapper_xrandr)( Display*, Window); +void (*XRRSelectInput_dylibloader_wrapper_xrandr)( Display*, Window, int); +Rotation (*XRRRotations_dylibloader_wrapper_xrandr)( Display*, int, Rotation*); +XRRScreenSize* (*XRRSizes_dylibloader_wrapper_xrandr)( Display*, int, int*); +short* (*XRRRates_dylibloader_wrapper_xrandr)( Display*, int, int, int*); +Time (*XRRTimes_dylibloader_wrapper_xrandr)( Display*, int, Time*); +int (*XRRGetScreenSizeRange_dylibloader_wrapper_xrandr)( Display*, Window, int*, int*, int*, int*); +void (*XRRSetScreenSize_dylibloader_wrapper_xrandr)( Display*, Window, int, int, int, int); +XRRScreenResources* (*XRRGetScreenResources_dylibloader_wrapper_xrandr)( Display*, Window); +void (*XRRFreeScreenResources_dylibloader_wrapper_xrandr)( XRRScreenResources*); +XRROutputInfo* (*XRRGetOutputInfo_dylibloader_wrapper_xrandr)( Display*, XRRScreenResources*, RROutput); +void (*XRRFreeOutputInfo_dylibloader_wrapper_xrandr)( XRROutputInfo*); +Atom* (*XRRListOutputProperties_dylibloader_wrapper_xrandr)( Display*, RROutput, int*); +XRRPropertyInfo* (*XRRQueryOutputProperty_dylibloader_wrapper_xrandr)( Display*, RROutput, Atom); +void (*XRRConfigureOutputProperty_dylibloader_wrapper_xrandr)( Display*, RROutput, Atom, int, int, int, long*); +void (*XRRChangeOutputProperty_dylibloader_wrapper_xrandr)( Display*, RROutput, Atom, Atom, int, int,const unsigned char*, int); +void (*XRRDeleteOutputProperty_dylibloader_wrapper_xrandr)( Display*, RROutput, Atom); +int (*XRRGetOutputProperty_dylibloader_wrapper_xrandr)( Display*, RROutput, Atom, long, long, int, int, Atom, Atom*, int*, unsigned long*, unsigned long*, unsigned char**); +XRRModeInfo* (*XRRAllocModeInfo_dylibloader_wrapper_xrandr)(const char*, int); +RRMode (*XRRCreateMode_dylibloader_wrapper_xrandr)( Display*, Window, XRRModeInfo*); +void (*XRRDestroyMode_dylibloader_wrapper_xrandr)( Display*, RRMode); +void (*XRRAddOutputMode_dylibloader_wrapper_xrandr)( Display*, RROutput, RRMode); +void (*XRRDeleteOutputMode_dylibloader_wrapper_xrandr)( Display*, RROutput, RRMode); +void (*XRRFreeModeInfo_dylibloader_wrapper_xrandr)( XRRModeInfo*); +XRRCrtcInfo* (*XRRGetCrtcInfo_dylibloader_wrapper_xrandr)( Display*, XRRScreenResources*, RRCrtc); +void (*XRRFreeCrtcInfo_dylibloader_wrapper_xrandr)( XRRCrtcInfo*); +int (*XRRSetCrtcConfig_dylibloader_wrapper_xrandr)( Display*, XRRScreenResources*, RRCrtc, Time, int, int, RRMode, Rotation, RROutput*, int); +int (*XRRGetCrtcGammaSize_dylibloader_wrapper_xrandr)( Display*, RRCrtc); +XRRCrtcGamma* (*XRRGetCrtcGamma_dylibloader_wrapper_xrandr)( Display*, RRCrtc); +XRRCrtcGamma* (*XRRAllocGamma_dylibloader_wrapper_xrandr)( int); +void (*XRRSetCrtcGamma_dylibloader_wrapper_xrandr)( Display*, RRCrtc, XRRCrtcGamma*); +void (*XRRFreeGamma_dylibloader_wrapper_xrandr)( XRRCrtcGamma*); +XRRScreenResources* (*XRRGetScreenResourcesCurrent_dylibloader_wrapper_xrandr)( Display*, Window); +void (*XRRSetCrtcTransform_dylibloader_wrapper_xrandr)( Display*, RRCrtc, XTransform*,const char*, XFixed*, int); +int (*XRRGetCrtcTransform_dylibloader_wrapper_xrandr)( Display*, RRCrtc, XRRCrtcTransformAttributes**); +int (*XRRUpdateConfiguration_dylibloader_wrapper_xrandr)( XEvent*); +XRRPanning* (*XRRGetPanning_dylibloader_wrapper_xrandr)( Display*, XRRScreenResources*, RRCrtc); +void (*XRRFreePanning_dylibloader_wrapper_xrandr)( XRRPanning*); +int (*XRRSetPanning_dylibloader_wrapper_xrandr)( Display*, XRRScreenResources*, RRCrtc, XRRPanning*); +void (*XRRSetOutputPrimary_dylibloader_wrapper_xrandr)( Display*, Window, RROutput); +RROutput (*XRRGetOutputPrimary_dylibloader_wrapper_xrandr)( Display*, Window); +XRRProviderResources* (*XRRGetProviderResources_dylibloader_wrapper_xrandr)( Display*, Window); +void (*XRRFreeProviderResources_dylibloader_wrapper_xrandr)( XRRProviderResources*); +XRRProviderInfo* (*XRRGetProviderInfo_dylibloader_wrapper_xrandr)( Display*, XRRScreenResources*, RRProvider); +void (*XRRFreeProviderInfo_dylibloader_wrapper_xrandr)( XRRProviderInfo*); +int (*XRRSetProviderOutputSource_dylibloader_wrapper_xrandr)( Display*, XID, XID); +int (*XRRSetProviderOffloadSink_dylibloader_wrapper_xrandr)( Display*, XID, XID); +Atom* (*XRRListProviderProperties_dylibloader_wrapper_xrandr)( Display*, RRProvider, int*); +XRRPropertyInfo* (*XRRQueryProviderProperty_dylibloader_wrapper_xrandr)( Display*, RRProvider, Atom); +void (*XRRConfigureProviderProperty_dylibloader_wrapper_xrandr)( Display*, RRProvider, Atom, int, int, int, long*); +void (*XRRChangeProviderProperty_dylibloader_wrapper_xrandr)( Display*, RRProvider, Atom, Atom, int, int,const unsigned char*, int); +void (*XRRDeleteProviderProperty_dylibloader_wrapper_xrandr)( Display*, RRProvider, Atom); +int (*XRRGetProviderProperty_dylibloader_wrapper_xrandr)( Display*, RRProvider, Atom, long, long, int, int, Atom, Atom*, int*, unsigned long*, unsigned long*, unsigned char**); +XRRMonitorInfo* (*XRRAllocateMonitor_dylibloader_wrapper_xrandr)( Display*, int); +XRRMonitorInfo* (*XRRGetMonitors_dylibloader_wrapper_xrandr)( Display*, Window, int, int*); +void (*XRRSetMonitor_dylibloader_wrapper_xrandr)( Display*, Window, XRRMonitorInfo*); +void (*XRRDeleteMonitor_dylibloader_wrapper_xrandr)( Display*, Window, Atom); +void (*XRRFreeMonitors_dylibloader_wrapper_xrandr)( XRRMonitorInfo*); +int initialize_xrandr(int verbose) { + void *handle; + char *error; + handle = dlopen("libXrandr.so.2", RTLD_LAZY); + if (!handle) { + if (verbose) { + fprintf(stderr, "%s\n", dlerror()); + } + return(1); + } + dlerror(); +// XRRQueryExtension + *(void **) (&XRRQueryExtension_dylibloader_wrapper_xrandr) = dlsym(handle, "XRRQueryExtension"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XRRQueryVersion + *(void **) (&XRRQueryVersion_dylibloader_wrapper_xrandr) = dlsym(handle, "XRRQueryVersion"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XRRGetScreenInfo + *(void **) (&XRRGetScreenInfo_dylibloader_wrapper_xrandr) = dlsym(handle, "XRRGetScreenInfo"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XRRFreeScreenConfigInfo + *(void **) (&XRRFreeScreenConfigInfo_dylibloader_wrapper_xrandr) = dlsym(handle, "XRRFreeScreenConfigInfo"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XRRSetScreenConfig + *(void **) (&XRRSetScreenConfig_dylibloader_wrapper_xrandr) = dlsym(handle, "XRRSetScreenConfig"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XRRSetScreenConfigAndRate + *(void **) (&XRRSetScreenConfigAndRate_dylibloader_wrapper_xrandr) = dlsym(handle, "XRRSetScreenConfigAndRate"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XRRConfigRotations + *(void **) (&XRRConfigRotations_dylibloader_wrapper_xrandr) = dlsym(handle, "XRRConfigRotations"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XRRConfigTimes + *(void **) (&XRRConfigTimes_dylibloader_wrapper_xrandr) = dlsym(handle, "XRRConfigTimes"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XRRConfigSizes + *(void **) (&XRRConfigSizes_dylibloader_wrapper_xrandr) = dlsym(handle, "XRRConfigSizes"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XRRConfigRates + *(void **) (&XRRConfigRates_dylibloader_wrapper_xrandr) = dlsym(handle, "XRRConfigRates"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XRRConfigCurrentConfiguration + *(void **) (&XRRConfigCurrentConfiguration_dylibloader_wrapper_xrandr) = dlsym(handle, "XRRConfigCurrentConfiguration"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XRRConfigCurrentRate + *(void **) (&XRRConfigCurrentRate_dylibloader_wrapper_xrandr) = dlsym(handle, "XRRConfigCurrentRate"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XRRRootToScreen + *(void **) (&XRRRootToScreen_dylibloader_wrapper_xrandr) = dlsym(handle, "XRRRootToScreen"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XRRSelectInput + *(void **) (&XRRSelectInput_dylibloader_wrapper_xrandr) = dlsym(handle, "XRRSelectInput"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XRRRotations + *(void **) (&XRRRotations_dylibloader_wrapper_xrandr) = dlsym(handle, "XRRRotations"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XRRSizes + *(void **) (&XRRSizes_dylibloader_wrapper_xrandr) = dlsym(handle, "XRRSizes"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XRRRates + *(void **) (&XRRRates_dylibloader_wrapper_xrandr) = dlsym(handle, "XRRRates"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XRRTimes + *(void **) (&XRRTimes_dylibloader_wrapper_xrandr) = dlsym(handle, "XRRTimes"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XRRGetScreenSizeRange + *(void **) (&XRRGetScreenSizeRange_dylibloader_wrapper_xrandr) = dlsym(handle, "XRRGetScreenSizeRange"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XRRSetScreenSize + *(void **) (&XRRSetScreenSize_dylibloader_wrapper_xrandr) = dlsym(handle, "XRRSetScreenSize"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XRRGetScreenResources + *(void **) (&XRRGetScreenResources_dylibloader_wrapper_xrandr) = dlsym(handle, "XRRGetScreenResources"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XRRFreeScreenResources + *(void **) (&XRRFreeScreenResources_dylibloader_wrapper_xrandr) = dlsym(handle, "XRRFreeScreenResources"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XRRGetOutputInfo + *(void **) (&XRRGetOutputInfo_dylibloader_wrapper_xrandr) = dlsym(handle, "XRRGetOutputInfo"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XRRFreeOutputInfo + *(void **) (&XRRFreeOutputInfo_dylibloader_wrapper_xrandr) = dlsym(handle, "XRRFreeOutputInfo"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XRRListOutputProperties + *(void **) (&XRRListOutputProperties_dylibloader_wrapper_xrandr) = dlsym(handle, "XRRListOutputProperties"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XRRQueryOutputProperty + *(void **) (&XRRQueryOutputProperty_dylibloader_wrapper_xrandr) = dlsym(handle, "XRRQueryOutputProperty"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XRRConfigureOutputProperty + *(void **) (&XRRConfigureOutputProperty_dylibloader_wrapper_xrandr) = dlsym(handle, "XRRConfigureOutputProperty"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XRRChangeOutputProperty + *(void **) (&XRRChangeOutputProperty_dylibloader_wrapper_xrandr) = dlsym(handle, "XRRChangeOutputProperty"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XRRDeleteOutputProperty + *(void **) (&XRRDeleteOutputProperty_dylibloader_wrapper_xrandr) = dlsym(handle, "XRRDeleteOutputProperty"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XRRGetOutputProperty + *(void **) (&XRRGetOutputProperty_dylibloader_wrapper_xrandr) = dlsym(handle, "XRRGetOutputProperty"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XRRAllocModeInfo + *(void **) (&XRRAllocModeInfo_dylibloader_wrapper_xrandr) = dlsym(handle, "XRRAllocModeInfo"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XRRCreateMode + *(void **) (&XRRCreateMode_dylibloader_wrapper_xrandr) = dlsym(handle, "XRRCreateMode"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XRRDestroyMode + *(void **) (&XRRDestroyMode_dylibloader_wrapper_xrandr) = dlsym(handle, "XRRDestroyMode"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XRRAddOutputMode + *(void **) (&XRRAddOutputMode_dylibloader_wrapper_xrandr) = dlsym(handle, "XRRAddOutputMode"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XRRDeleteOutputMode + *(void **) (&XRRDeleteOutputMode_dylibloader_wrapper_xrandr) = dlsym(handle, "XRRDeleteOutputMode"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XRRFreeModeInfo + *(void **) (&XRRFreeModeInfo_dylibloader_wrapper_xrandr) = dlsym(handle, "XRRFreeModeInfo"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XRRGetCrtcInfo + *(void **) (&XRRGetCrtcInfo_dylibloader_wrapper_xrandr) = dlsym(handle, "XRRGetCrtcInfo"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XRRFreeCrtcInfo + *(void **) (&XRRFreeCrtcInfo_dylibloader_wrapper_xrandr) = dlsym(handle, "XRRFreeCrtcInfo"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XRRSetCrtcConfig + *(void **) (&XRRSetCrtcConfig_dylibloader_wrapper_xrandr) = dlsym(handle, "XRRSetCrtcConfig"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XRRGetCrtcGammaSize + *(void **) (&XRRGetCrtcGammaSize_dylibloader_wrapper_xrandr) = dlsym(handle, "XRRGetCrtcGammaSize"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XRRGetCrtcGamma + *(void **) (&XRRGetCrtcGamma_dylibloader_wrapper_xrandr) = dlsym(handle, "XRRGetCrtcGamma"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XRRAllocGamma + *(void **) (&XRRAllocGamma_dylibloader_wrapper_xrandr) = dlsym(handle, "XRRAllocGamma"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XRRSetCrtcGamma + *(void **) (&XRRSetCrtcGamma_dylibloader_wrapper_xrandr) = dlsym(handle, "XRRSetCrtcGamma"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XRRFreeGamma + *(void **) (&XRRFreeGamma_dylibloader_wrapper_xrandr) = dlsym(handle, "XRRFreeGamma"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XRRGetScreenResourcesCurrent + *(void **) (&XRRGetScreenResourcesCurrent_dylibloader_wrapper_xrandr) = dlsym(handle, "XRRGetScreenResourcesCurrent"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XRRSetCrtcTransform + *(void **) (&XRRSetCrtcTransform_dylibloader_wrapper_xrandr) = dlsym(handle, "XRRSetCrtcTransform"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XRRGetCrtcTransform + *(void **) (&XRRGetCrtcTransform_dylibloader_wrapper_xrandr) = dlsym(handle, "XRRGetCrtcTransform"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XRRUpdateConfiguration + *(void **) (&XRRUpdateConfiguration_dylibloader_wrapper_xrandr) = dlsym(handle, "XRRUpdateConfiguration"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XRRGetPanning + *(void **) (&XRRGetPanning_dylibloader_wrapper_xrandr) = dlsym(handle, "XRRGetPanning"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XRRFreePanning + *(void **) (&XRRFreePanning_dylibloader_wrapper_xrandr) = dlsym(handle, "XRRFreePanning"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XRRSetPanning + *(void **) (&XRRSetPanning_dylibloader_wrapper_xrandr) = dlsym(handle, "XRRSetPanning"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XRRSetOutputPrimary + *(void **) (&XRRSetOutputPrimary_dylibloader_wrapper_xrandr) = dlsym(handle, "XRRSetOutputPrimary"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XRRGetOutputPrimary + *(void **) (&XRRGetOutputPrimary_dylibloader_wrapper_xrandr) = dlsym(handle, "XRRGetOutputPrimary"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XRRGetProviderResources + *(void **) (&XRRGetProviderResources_dylibloader_wrapper_xrandr) = dlsym(handle, "XRRGetProviderResources"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XRRFreeProviderResources + *(void **) (&XRRFreeProviderResources_dylibloader_wrapper_xrandr) = dlsym(handle, "XRRFreeProviderResources"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XRRGetProviderInfo + *(void **) (&XRRGetProviderInfo_dylibloader_wrapper_xrandr) = dlsym(handle, "XRRGetProviderInfo"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XRRFreeProviderInfo + *(void **) (&XRRFreeProviderInfo_dylibloader_wrapper_xrandr) = dlsym(handle, "XRRFreeProviderInfo"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XRRSetProviderOutputSource + *(void **) (&XRRSetProviderOutputSource_dylibloader_wrapper_xrandr) = dlsym(handle, "XRRSetProviderOutputSource"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XRRSetProviderOffloadSink + *(void **) (&XRRSetProviderOffloadSink_dylibloader_wrapper_xrandr) = dlsym(handle, "XRRSetProviderOffloadSink"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XRRListProviderProperties + *(void **) (&XRRListProviderProperties_dylibloader_wrapper_xrandr) = dlsym(handle, "XRRListProviderProperties"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XRRQueryProviderProperty + *(void **) (&XRRQueryProviderProperty_dylibloader_wrapper_xrandr) = dlsym(handle, "XRRQueryProviderProperty"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XRRConfigureProviderProperty + *(void **) (&XRRConfigureProviderProperty_dylibloader_wrapper_xrandr) = dlsym(handle, "XRRConfigureProviderProperty"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XRRChangeProviderProperty + *(void **) (&XRRChangeProviderProperty_dylibloader_wrapper_xrandr) = dlsym(handle, "XRRChangeProviderProperty"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XRRDeleteProviderProperty + *(void **) (&XRRDeleteProviderProperty_dylibloader_wrapper_xrandr) = dlsym(handle, "XRRDeleteProviderProperty"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XRRGetProviderProperty + *(void **) (&XRRGetProviderProperty_dylibloader_wrapper_xrandr) = dlsym(handle, "XRRGetProviderProperty"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XRRAllocateMonitor + *(void **) (&XRRAllocateMonitor_dylibloader_wrapper_xrandr) = dlsym(handle, "XRRAllocateMonitor"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XRRGetMonitors + *(void **) (&XRRGetMonitors_dylibloader_wrapper_xrandr) = dlsym(handle, "XRRGetMonitors"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XRRSetMonitor + *(void **) (&XRRSetMonitor_dylibloader_wrapper_xrandr) = dlsym(handle, "XRRSetMonitor"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XRRDeleteMonitor + *(void **) (&XRRDeleteMonitor_dylibloader_wrapper_xrandr) = dlsym(handle, "XRRDeleteMonitor"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XRRFreeMonitors + *(void **) (&XRRFreeMonitors_dylibloader_wrapper_xrandr) = dlsym(handle, "XRRFreeMonitors"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +return 0; +} diff --git a/platform/linuxbsd/x11/dynwrappers/xrandr-so_wrap.h b/platform/linuxbsd/x11/dynwrappers/xrandr-so_wrap.h new file mode 100644 index 0000000000..f1ca9f94a5 --- /dev/null +++ b/platform/linuxbsd/x11/dynwrappers/xrandr-so_wrap.h @@ -0,0 +1,302 @@ +#ifndef DYLIBLOAD_WRAPPER_XRANDR +#define DYLIBLOAD_WRAPPER_XRANDR +// This file is generated. Do not edit! +// see https://github.com/hpvb/dynload-wrapper for details +// generated by ./generate-wrapper.py 0.3 on 2022-12-02 12:55:12 +// flags: ./generate-wrapper.py --include /usr/include/X11/extensions/Xrandr.h --sys-include <X11/extensions/Xrandr.h> --soname libXrandr.so.2 --init-name xrandr --output-header xrandr-so_wrap.h --output-implementation xrandr-so_wrap.c +// +// NOTE: Generated from Xrandr 1.5.2. +// This has been handpatched to workaround some issues with the generator that +// will be eventually fixed. In this case, non-existant symbols inherited from +// libX11 and libXrender, but absent in libXrandr.so.2, were removed. +#include <stdint.h> + +#define XRRQueryExtension XRRQueryExtension_dylibloader_orig_xrandr +#define XRRQueryVersion XRRQueryVersion_dylibloader_orig_xrandr +#define XRRGetScreenInfo XRRGetScreenInfo_dylibloader_orig_xrandr +#define XRRFreeScreenConfigInfo XRRFreeScreenConfigInfo_dylibloader_orig_xrandr +#define XRRSetScreenConfig XRRSetScreenConfig_dylibloader_orig_xrandr +#define XRRSetScreenConfigAndRate XRRSetScreenConfigAndRate_dylibloader_orig_xrandr +#define XRRConfigRotations XRRConfigRotations_dylibloader_orig_xrandr +#define XRRConfigTimes XRRConfigTimes_dylibloader_orig_xrandr +#define XRRConfigSizes XRRConfigSizes_dylibloader_orig_xrandr +#define XRRConfigRates XRRConfigRates_dylibloader_orig_xrandr +#define XRRConfigCurrentConfiguration XRRConfigCurrentConfiguration_dylibloader_orig_xrandr +#define XRRConfigCurrentRate XRRConfigCurrentRate_dylibloader_orig_xrandr +#define XRRRootToScreen XRRRootToScreen_dylibloader_orig_xrandr +#define XRRSelectInput XRRSelectInput_dylibloader_orig_xrandr +#define XRRRotations XRRRotations_dylibloader_orig_xrandr +#define XRRSizes XRRSizes_dylibloader_orig_xrandr +#define XRRRates XRRRates_dylibloader_orig_xrandr +#define XRRTimes XRRTimes_dylibloader_orig_xrandr +#define XRRGetScreenSizeRange XRRGetScreenSizeRange_dylibloader_orig_xrandr +#define XRRSetScreenSize XRRSetScreenSize_dylibloader_orig_xrandr +#define XRRGetScreenResources XRRGetScreenResources_dylibloader_orig_xrandr +#define XRRFreeScreenResources XRRFreeScreenResources_dylibloader_orig_xrandr +#define XRRGetOutputInfo XRRGetOutputInfo_dylibloader_orig_xrandr +#define XRRFreeOutputInfo XRRFreeOutputInfo_dylibloader_orig_xrandr +#define XRRListOutputProperties XRRListOutputProperties_dylibloader_orig_xrandr +#define XRRQueryOutputProperty XRRQueryOutputProperty_dylibloader_orig_xrandr +#define XRRConfigureOutputProperty XRRConfigureOutputProperty_dylibloader_orig_xrandr +#define XRRChangeOutputProperty XRRChangeOutputProperty_dylibloader_orig_xrandr +#define XRRDeleteOutputProperty XRRDeleteOutputProperty_dylibloader_orig_xrandr +#define XRRGetOutputProperty XRRGetOutputProperty_dylibloader_orig_xrandr +#define XRRAllocModeInfo XRRAllocModeInfo_dylibloader_orig_xrandr +#define XRRCreateMode XRRCreateMode_dylibloader_orig_xrandr +#define XRRDestroyMode XRRDestroyMode_dylibloader_orig_xrandr +#define XRRAddOutputMode XRRAddOutputMode_dylibloader_orig_xrandr +#define XRRDeleteOutputMode XRRDeleteOutputMode_dylibloader_orig_xrandr +#define XRRFreeModeInfo XRRFreeModeInfo_dylibloader_orig_xrandr +#define XRRGetCrtcInfo XRRGetCrtcInfo_dylibloader_orig_xrandr +#define XRRFreeCrtcInfo XRRFreeCrtcInfo_dylibloader_orig_xrandr +#define XRRSetCrtcConfig XRRSetCrtcConfig_dylibloader_orig_xrandr +#define XRRGetCrtcGammaSize XRRGetCrtcGammaSize_dylibloader_orig_xrandr +#define XRRGetCrtcGamma XRRGetCrtcGamma_dylibloader_orig_xrandr +#define XRRAllocGamma XRRAllocGamma_dylibloader_orig_xrandr +#define XRRSetCrtcGamma XRRSetCrtcGamma_dylibloader_orig_xrandr +#define XRRFreeGamma XRRFreeGamma_dylibloader_orig_xrandr +#define XRRGetScreenResourcesCurrent XRRGetScreenResourcesCurrent_dylibloader_orig_xrandr +#define XRRSetCrtcTransform XRRSetCrtcTransform_dylibloader_orig_xrandr +#define XRRGetCrtcTransform XRRGetCrtcTransform_dylibloader_orig_xrandr +#define XRRUpdateConfiguration XRRUpdateConfiguration_dylibloader_orig_xrandr +#define XRRGetPanning XRRGetPanning_dylibloader_orig_xrandr +#define XRRFreePanning XRRFreePanning_dylibloader_orig_xrandr +#define XRRSetPanning XRRSetPanning_dylibloader_orig_xrandr +#define XRRSetOutputPrimary XRRSetOutputPrimary_dylibloader_orig_xrandr +#define XRRGetOutputPrimary XRRGetOutputPrimary_dylibloader_orig_xrandr +#define XRRGetProviderResources XRRGetProviderResources_dylibloader_orig_xrandr +#define XRRFreeProviderResources XRRFreeProviderResources_dylibloader_orig_xrandr +#define XRRGetProviderInfo XRRGetProviderInfo_dylibloader_orig_xrandr +#define XRRFreeProviderInfo XRRFreeProviderInfo_dylibloader_orig_xrandr +#define XRRSetProviderOutputSource XRRSetProviderOutputSource_dylibloader_orig_xrandr +#define XRRSetProviderOffloadSink XRRSetProviderOffloadSink_dylibloader_orig_xrandr +#define XRRListProviderProperties XRRListProviderProperties_dylibloader_orig_xrandr +#define XRRQueryProviderProperty XRRQueryProviderProperty_dylibloader_orig_xrandr +#define XRRConfigureProviderProperty XRRConfigureProviderProperty_dylibloader_orig_xrandr +#define XRRChangeProviderProperty XRRChangeProviderProperty_dylibloader_orig_xrandr +#define XRRDeleteProviderProperty XRRDeleteProviderProperty_dylibloader_orig_xrandr +#define XRRGetProviderProperty XRRGetProviderProperty_dylibloader_orig_xrandr +#define XRRAllocateMonitor XRRAllocateMonitor_dylibloader_orig_xrandr +#define XRRGetMonitors XRRGetMonitors_dylibloader_orig_xrandr +#define XRRSetMonitor XRRSetMonitor_dylibloader_orig_xrandr +#define XRRDeleteMonitor XRRDeleteMonitor_dylibloader_orig_xrandr +#define XRRFreeMonitors XRRFreeMonitors_dylibloader_orig_xrandr +#include <X11/extensions/Xrandr.h> +#undef XRRQueryExtension +#undef XRRQueryVersion +#undef XRRGetScreenInfo +#undef XRRFreeScreenConfigInfo +#undef XRRSetScreenConfig +#undef XRRSetScreenConfigAndRate +#undef XRRConfigRotations +#undef XRRConfigTimes +#undef XRRConfigSizes +#undef XRRConfigRates +#undef XRRConfigCurrentConfiguration +#undef XRRConfigCurrentRate +#undef XRRRootToScreen +#undef XRRSelectInput +#undef XRRRotations +#undef XRRSizes +#undef XRRRates +#undef XRRTimes +#undef XRRGetScreenSizeRange +#undef XRRSetScreenSize +#undef XRRGetScreenResources +#undef XRRFreeScreenResources +#undef XRRGetOutputInfo +#undef XRRFreeOutputInfo +#undef XRRListOutputProperties +#undef XRRQueryOutputProperty +#undef XRRConfigureOutputProperty +#undef XRRChangeOutputProperty +#undef XRRDeleteOutputProperty +#undef XRRGetOutputProperty +#undef XRRAllocModeInfo +#undef XRRCreateMode +#undef XRRDestroyMode +#undef XRRAddOutputMode +#undef XRRDeleteOutputMode +#undef XRRFreeModeInfo +#undef XRRGetCrtcInfo +#undef XRRFreeCrtcInfo +#undef XRRSetCrtcConfig +#undef XRRGetCrtcGammaSize +#undef XRRGetCrtcGamma +#undef XRRAllocGamma +#undef XRRSetCrtcGamma +#undef XRRFreeGamma +#undef XRRGetScreenResourcesCurrent +#undef XRRSetCrtcTransform +#undef XRRGetCrtcTransform +#undef XRRUpdateConfiguration +#undef XRRGetPanning +#undef XRRFreePanning +#undef XRRSetPanning +#undef XRRSetOutputPrimary +#undef XRRGetOutputPrimary +#undef XRRGetProviderResources +#undef XRRFreeProviderResources +#undef XRRGetProviderInfo +#undef XRRFreeProviderInfo +#undef XRRSetProviderOutputSource +#undef XRRSetProviderOffloadSink +#undef XRRListProviderProperties +#undef XRRQueryProviderProperty +#undef XRRConfigureProviderProperty +#undef XRRChangeProviderProperty +#undef XRRDeleteProviderProperty +#undef XRRGetProviderProperty +#undef XRRAllocateMonitor +#undef XRRGetMonitors +#undef XRRSetMonitor +#undef XRRDeleteMonitor +#undef XRRFreeMonitors +#ifdef __cplusplus +extern "C" { +#endif +#define XRRQueryExtension XRRQueryExtension_dylibloader_wrapper_xrandr +#define XRRQueryVersion XRRQueryVersion_dylibloader_wrapper_xrandr +#define XRRGetScreenInfo XRRGetScreenInfo_dylibloader_wrapper_xrandr +#define XRRFreeScreenConfigInfo XRRFreeScreenConfigInfo_dylibloader_wrapper_xrandr +#define XRRSetScreenConfig XRRSetScreenConfig_dylibloader_wrapper_xrandr +#define XRRSetScreenConfigAndRate XRRSetScreenConfigAndRate_dylibloader_wrapper_xrandr +#define XRRConfigRotations XRRConfigRotations_dylibloader_wrapper_xrandr +#define XRRConfigTimes XRRConfigTimes_dylibloader_wrapper_xrandr +#define XRRConfigSizes XRRConfigSizes_dylibloader_wrapper_xrandr +#define XRRConfigRates XRRConfigRates_dylibloader_wrapper_xrandr +#define XRRConfigCurrentConfiguration XRRConfigCurrentConfiguration_dylibloader_wrapper_xrandr +#define XRRConfigCurrentRate XRRConfigCurrentRate_dylibloader_wrapper_xrandr +#define XRRRootToScreen XRRRootToScreen_dylibloader_wrapper_xrandr +#define XRRSelectInput XRRSelectInput_dylibloader_wrapper_xrandr +#define XRRRotations XRRRotations_dylibloader_wrapper_xrandr +#define XRRSizes XRRSizes_dylibloader_wrapper_xrandr +#define XRRRates XRRRates_dylibloader_wrapper_xrandr +#define XRRTimes XRRTimes_dylibloader_wrapper_xrandr +#define XRRGetScreenSizeRange XRRGetScreenSizeRange_dylibloader_wrapper_xrandr +#define XRRSetScreenSize XRRSetScreenSize_dylibloader_wrapper_xrandr +#define XRRGetScreenResources XRRGetScreenResources_dylibloader_wrapper_xrandr +#define XRRFreeScreenResources XRRFreeScreenResources_dylibloader_wrapper_xrandr +#define XRRGetOutputInfo XRRGetOutputInfo_dylibloader_wrapper_xrandr +#define XRRFreeOutputInfo XRRFreeOutputInfo_dylibloader_wrapper_xrandr +#define XRRListOutputProperties XRRListOutputProperties_dylibloader_wrapper_xrandr +#define XRRQueryOutputProperty XRRQueryOutputProperty_dylibloader_wrapper_xrandr +#define XRRConfigureOutputProperty XRRConfigureOutputProperty_dylibloader_wrapper_xrandr +#define XRRChangeOutputProperty XRRChangeOutputProperty_dylibloader_wrapper_xrandr +#define XRRDeleteOutputProperty XRRDeleteOutputProperty_dylibloader_wrapper_xrandr +#define XRRGetOutputProperty XRRGetOutputProperty_dylibloader_wrapper_xrandr +#define XRRAllocModeInfo XRRAllocModeInfo_dylibloader_wrapper_xrandr +#define XRRCreateMode XRRCreateMode_dylibloader_wrapper_xrandr +#define XRRDestroyMode XRRDestroyMode_dylibloader_wrapper_xrandr +#define XRRAddOutputMode XRRAddOutputMode_dylibloader_wrapper_xrandr +#define XRRDeleteOutputMode XRRDeleteOutputMode_dylibloader_wrapper_xrandr +#define XRRFreeModeInfo XRRFreeModeInfo_dylibloader_wrapper_xrandr +#define XRRGetCrtcInfo XRRGetCrtcInfo_dylibloader_wrapper_xrandr +#define XRRFreeCrtcInfo XRRFreeCrtcInfo_dylibloader_wrapper_xrandr +#define XRRSetCrtcConfig XRRSetCrtcConfig_dylibloader_wrapper_xrandr +#define XRRGetCrtcGammaSize XRRGetCrtcGammaSize_dylibloader_wrapper_xrandr +#define XRRGetCrtcGamma XRRGetCrtcGamma_dylibloader_wrapper_xrandr +#define XRRAllocGamma XRRAllocGamma_dylibloader_wrapper_xrandr +#define XRRSetCrtcGamma XRRSetCrtcGamma_dylibloader_wrapper_xrandr +#define XRRFreeGamma XRRFreeGamma_dylibloader_wrapper_xrandr +#define XRRGetScreenResourcesCurrent XRRGetScreenResourcesCurrent_dylibloader_wrapper_xrandr +#define XRRSetCrtcTransform XRRSetCrtcTransform_dylibloader_wrapper_xrandr +#define XRRGetCrtcTransform XRRGetCrtcTransform_dylibloader_wrapper_xrandr +#define XRRUpdateConfiguration XRRUpdateConfiguration_dylibloader_wrapper_xrandr +#define XRRGetPanning XRRGetPanning_dylibloader_wrapper_xrandr +#define XRRFreePanning XRRFreePanning_dylibloader_wrapper_xrandr +#define XRRSetPanning XRRSetPanning_dylibloader_wrapper_xrandr +#define XRRSetOutputPrimary XRRSetOutputPrimary_dylibloader_wrapper_xrandr +#define XRRGetOutputPrimary XRRGetOutputPrimary_dylibloader_wrapper_xrandr +#define XRRGetProviderResources XRRGetProviderResources_dylibloader_wrapper_xrandr +#define XRRFreeProviderResources XRRFreeProviderResources_dylibloader_wrapper_xrandr +#define XRRGetProviderInfo XRRGetProviderInfo_dylibloader_wrapper_xrandr +#define XRRFreeProviderInfo XRRFreeProviderInfo_dylibloader_wrapper_xrandr +#define XRRSetProviderOutputSource XRRSetProviderOutputSource_dylibloader_wrapper_xrandr +#define XRRSetProviderOffloadSink XRRSetProviderOffloadSink_dylibloader_wrapper_xrandr +#define XRRListProviderProperties XRRListProviderProperties_dylibloader_wrapper_xrandr +#define XRRQueryProviderProperty XRRQueryProviderProperty_dylibloader_wrapper_xrandr +#define XRRConfigureProviderProperty XRRConfigureProviderProperty_dylibloader_wrapper_xrandr +#define XRRChangeProviderProperty XRRChangeProviderProperty_dylibloader_wrapper_xrandr +#define XRRDeleteProviderProperty XRRDeleteProviderProperty_dylibloader_wrapper_xrandr +#define XRRGetProviderProperty XRRGetProviderProperty_dylibloader_wrapper_xrandr +#define XRRAllocateMonitor XRRAllocateMonitor_dylibloader_wrapper_xrandr +#define XRRGetMonitors XRRGetMonitors_dylibloader_wrapper_xrandr +#define XRRSetMonitor XRRSetMonitor_dylibloader_wrapper_xrandr +#define XRRDeleteMonitor XRRDeleteMonitor_dylibloader_wrapper_xrandr +#define XRRFreeMonitors XRRFreeMonitors_dylibloader_wrapper_xrandr +extern int (*XRRQueryExtension_dylibloader_wrapper_xrandr)( Display*, int*, int*); +extern int (*XRRQueryVersion_dylibloader_wrapper_xrandr)( Display*, int*, int*); +extern XRRScreenConfiguration* (*XRRGetScreenInfo_dylibloader_wrapper_xrandr)( Display*, Window); +extern void (*XRRFreeScreenConfigInfo_dylibloader_wrapper_xrandr)( XRRScreenConfiguration*); +extern int (*XRRSetScreenConfig_dylibloader_wrapper_xrandr)( Display*, XRRScreenConfiguration*, Drawable, int, Rotation, Time); +extern int (*XRRSetScreenConfigAndRate_dylibloader_wrapper_xrandr)( Display*, XRRScreenConfiguration*, Drawable, int, Rotation, short, Time); +extern Rotation (*XRRConfigRotations_dylibloader_wrapper_xrandr)( XRRScreenConfiguration*, Rotation*); +extern Time (*XRRConfigTimes_dylibloader_wrapper_xrandr)( XRRScreenConfiguration*, Time*); +extern XRRScreenSize* (*XRRConfigSizes_dylibloader_wrapper_xrandr)( XRRScreenConfiguration*, int*); +extern short* (*XRRConfigRates_dylibloader_wrapper_xrandr)( XRRScreenConfiguration*, int, int*); +extern SizeID (*XRRConfigCurrentConfiguration_dylibloader_wrapper_xrandr)( XRRScreenConfiguration*, Rotation*); +extern short (*XRRConfigCurrentRate_dylibloader_wrapper_xrandr)( XRRScreenConfiguration*); +extern int (*XRRRootToScreen_dylibloader_wrapper_xrandr)( Display*, Window); +extern void (*XRRSelectInput_dylibloader_wrapper_xrandr)( Display*, Window, int); +extern Rotation (*XRRRotations_dylibloader_wrapper_xrandr)( Display*, int, Rotation*); +extern XRRScreenSize* (*XRRSizes_dylibloader_wrapper_xrandr)( Display*, int, int*); +extern short* (*XRRRates_dylibloader_wrapper_xrandr)( Display*, int, int, int*); +extern Time (*XRRTimes_dylibloader_wrapper_xrandr)( Display*, int, Time*); +extern int (*XRRGetScreenSizeRange_dylibloader_wrapper_xrandr)( Display*, Window, int*, int*, int*, int*); +extern void (*XRRSetScreenSize_dylibloader_wrapper_xrandr)( Display*, Window, int, int, int, int); +extern XRRScreenResources* (*XRRGetScreenResources_dylibloader_wrapper_xrandr)( Display*, Window); +extern void (*XRRFreeScreenResources_dylibloader_wrapper_xrandr)( XRRScreenResources*); +extern XRROutputInfo* (*XRRGetOutputInfo_dylibloader_wrapper_xrandr)( Display*, XRRScreenResources*, RROutput); +extern void (*XRRFreeOutputInfo_dylibloader_wrapper_xrandr)( XRROutputInfo*); +extern Atom* (*XRRListOutputProperties_dylibloader_wrapper_xrandr)( Display*, RROutput, int*); +extern XRRPropertyInfo* (*XRRQueryOutputProperty_dylibloader_wrapper_xrandr)( Display*, RROutput, Atom); +extern void (*XRRConfigureOutputProperty_dylibloader_wrapper_xrandr)( Display*, RROutput, Atom, int, int, int, long*); +extern void (*XRRChangeOutputProperty_dylibloader_wrapper_xrandr)( Display*, RROutput, Atom, Atom, int, int,const unsigned char*, int); +extern void (*XRRDeleteOutputProperty_dylibloader_wrapper_xrandr)( Display*, RROutput, Atom); +extern int (*XRRGetOutputProperty_dylibloader_wrapper_xrandr)( Display*, RROutput, Atom, long, long, int, int, Atom, Atom*, int*, unsigned long*, unsigned long*, unsigned char**); +extern XRRModeInfo* (*XRRAllocModeInfo_dylibloader_wrapper_xrandr)(const char*, int); +extern RRMode (*XRRCreateMode_dylibloader_wrapper_xrandr)( Display*, Window, XRRModeInfo*); +extern void (*XRRDestroyMode_dylibloader_wrapper_xrandr)( Display*, RRMode); +extern void (*XRRAddOutputMode_dylibloader_wrapper_xrandr)( Display*, RROutput, RRMode); +extern void (*XRRDeleteOutputMode_dylibloader_wrapper_xrandr)( Display*, RROutput, RRMode); +extern void (*XRRFreeModeInfo_dylibloader_wrapper_xrandr)( XRRModeInfo*); +extern XRRCrtcInfo* (*XRRGetCrtcInfo_dylibloader_wrapper_xrandr)( Display*, XRRScreenResources*, RRCrtc); +extern void (*XRRFreeCrtcInfo_dylibloader_wrapper_xrandr)( XRRCrtcInfo*); +extern int (*XRRSetCrtcConfig_dylibloader_wrapper_xrandr)( Display*, XRRScreenResources*, RRCrtc, Time, int, int, RRMode, Rotation, RROutput*, int); +extern int (*XRRGetCrtcGammaSize_dylibloader_wrapper_xrandr)( Display*, RRCrtc); +extern XRRCrtcGamma* (*XRRGetCrtcGamma_dylibloader_wrapper_xrandr)( Display*, RRCrtc); +extern XRRCrtcGamma* (*XRRAllocGamma_dylibloader_wrapper_xrandr)( int); +extern void (*XRRSetCrtcGamma_dylibloader_wrapper_xrandr)( Display*, RRCrtc, XRRCrtcGamma*); +extern void (*XRRFreeGamma_dylibloader_wrapper_xrandr)( XRRCrtcGamma*); +extern XRRScreenResources* (*XRRGetScreenResourcesCurrent_dylibloader_wrapper_xrandr)( Display*, Window); +extern void (*XRRSetCrtcTransform_dylibloader_wrapper_xrandr)( Display*, RRCrtc, XTransform*,const char*, XFixed*, int); +extern int (*XRRGetCrtcTransform_dylibloader_wrapper_xrandr)( Display*, RRCrtc, XRRCrtcTransformAttributes**); +extern int (*XRRUpdateConfiguration_dylibloader_wrapper_xrandr)( XEvent*); +extern XRRPanning* (*XRRGetPanning_dylibloader_wrapper_xrandr)( Display*, XRRScreenResources*, RRCrtc); +extern void (*XRRFreePanning_dylibloader_wrapper_xrandr)( XRRPanning*); +extern int (*XRRSetPanning_dylibloader_wrapper_xrandr)( Display*, XRRScreenResources*, RRCrtc, XRRPanning*); +extern void (*XRRSetOutputPrimary_dylibloader_wrapper_xrandr)( Display*, Window, RROutput); +extern RROutput (*XRRGetOutputPrimary_dylibloader_wrapper_xrandr)( Display*, Window); +extern XRRProviderResources* (*XRRGetProviderResources_dylibloader_wrapper_xrandr)( Display*, Window); +extern void (*XRRFreeProviderResources_dylibloader_wrapper_xrandr)( XRRProviderResources*); +extern XRRProviderInfo* (*XRRGetProviderInfo_dylibloader_wrapper_xrandr)( Display*, XRRScreenResources*, RRProvider); +extern void (*XRRFreeProviderInfo_dylibloader_wrapper_xrandr)( XRRProviderInfo*); +extern int (*XRRSetProviderOutputSource_dylibloader_wrapper_xrandr)( Display*, XID, XID); +extern int (*XRRSetProviderOffloadSink_dylibloader_wrapper_xrandr)( Display*, XID, XID); +extern Atom* (*XRRListProviderProperties_dylibloader_wrapper_xrandr)( Display*, RRProvider, int*); +extern XRRPropertyInfo* (*XRRQueryProviderProperty_dylibloader_wrapper_xrandr)( Display*, RRProvider, Atom); +extern void (*XRRConfigureProviderProperty_dylibloader_wrapper_xrandr)( Display*, RRProvider, Atom, int, int, int, long*); +extern void (*XRRChangeProviderProperty_dylibloader_wrapper_xrandr)( Display*, RRProvider, Atom, Atom, int, int,const unsigned char*, int); +extern void (*XRRDeleteProviderProperty_dylibloader_wrapper_xrandr)( Display*, RRProvider, Atom); +extern int (*XRRGetProviderProperty_dylibloader_wrapper_xrandr)( Display*, RRProvider, Atom, long, long, int, int, Atom, Atom*, int*, unsigned long*, unsigned long*, unsigned char**); +extern XRRMonitorInfo* (*XRRAllocateMonitor_dylibloader_wrapper_xrandr)( Display*, int); +extern XRRMonitorInfo* (*XRRGetMonitors_dylibloader_wrapper_xrandr)( Display*, Window, int, int*); +extern void (*XRRSetMonitor_dylibloader_wrapper_xrandr)( Display*, Window, XRRMonitorInfo*); +extern void (*XRRDeleteMonitor_dylibloader_wrapper_xrandr)( Display*, Window, Atom); +extern void (*XRRFreeMonitors_dylibloader_wrapper_xrandr)( XRRMonitorInfo*); +int initialize_xrandr(int verbose); +#ifdef __cplusplus +} +#endif +#endif diff --git a/platform/linuxbsd/x11/dynwrappers/xrender-so_wrap.c b/platform/linuxbsd/x11/dynwrappers/xrender-so_wrap.c new file mode 100644 index 0000000000..b63a1eca8d --- /dev/null +++ b/platform/linuxbsd/x11/dynwrappers/xrender-so_wrap.c @@ -0,0 +1,511 @@ +// This file is generated. Do not edit! +// see https://github.com/hpvb/dynload-wrapper for details +// generated by ./generate-wrapper.py 0.3 on 2022-12-02 12:55:28 +// flags: ./generate-wrapper.py --include /usr/include/X11/extensions/Xrender.h --sys-include <X11/extensions/Xrender.h> --soname libXrender.so.1 --init-name xrender --output-header xrender-so_wrap.h --output-implementation xrender-so_wrap.c +// +// NOTE: Generated from Xrender 0.9.10. +// This has been handpatched to workaround some issues with the generator that +// will be eventually fixed. In this case, non-existant symbols inherited from +// libX11, but absent in libXrender.so.1, were removed. +#include <stdint.h> + +#define XRenderQueryExtension XRenderQueryExtension_dylibloader_orig_xrender +#define XRenderQueryVersion XRenderQueryVersion_dylibloader_orig_xrender +#define XRenderQueryFormats XRenderQueryFormats_dylibloader_orig_xrender +#define XRenderQuerySubpixelOrder XRenderQuerySubpixelOrder_dylibloader_orig_xrender +#define XRenderSetSubpixelOrder XRenderSetSubpixelOrder_dylibloader_orig_xrender +#define XRenderFindVisualFormat XRenderFindVisualFormat_dylibloader_orig_xrender +#define XRenderFindFormat XRenderFindFormat_dylibloader_orig_xrender +#define XRenderFindStandardFormat XRenderFindStandardFormat_dylibloader_orig_xrender +#define XRenderQueryPictIndexValues XRenderQueryPictIndexValues_dylibloader_orig_xrender +#define XRenderCreatePicture XRenderCreatePicture_dylibloader_orig_xrender +#define XRenderChangePicture XRenderChangePicture_dylibloader_orig_xrender +#define XRenderSetPictureClipRectangles XRenderSetPictureClipRectangles_dylibloader_orig_xrender +#define XRenderSetPictureClipRegion XRenderSetPictureClipRegion_dylibloader_orig_xrender +#define XRenderSetPictureTransform XRenderSetPictureTransform_dylibloader_orig_xrender +#define XRenderFreePicture XRenderFreePicture_dylibloader_orig_xrender +#define XRenderComposite XRenderComposite_dylibloader_orig_xrender +#define XRenderCreateGlyphSet XRenderCreateGlyphSet_dylibloader_orig_xrender +#define XRenderReferenceGlyphSet XRenderReferenceGlyphSet_dylibloader_orig_xrender +#define XRenderFreeGlyphSet XRenderFreeGlyphSet_dylibloader_orig_xrender +#define XRenderAddGlyphs XRenderAddGlyphs_dylibloader_orig_xrender +#define XRenderFreeGlyphs XRenderFreeGlyphs_dylibloader_orig_xrender +#define XRenderCompositeString8 XRenderCompositeString8_dylibloader_orig_xrender +#define XRenderCompositeString16 XRenderCompositeString16_dylibloader_orig_xrender +#define XRenderCompositeString32 XRenderCompositeString32_dylibloader_orig_xrender +#define XRenderCompositeText8 XRenderCompositeText8_dylibloader_orig_xrender +#define XRenderCompositeText16 XRenderCompositeText16_dylibloader_orig_xrender +#define XRenderCompositeText32 XRenderCompositeText32_dylibloader_orig_xrender +#define XRenderFillRectangle XRenderFillRectangle_dylibloader_orig_xrender +#define XRenderFillRectangles XRenderFillRectangles_dylibloader_orig_xrender +#define XRenderCompositeTrapezoids XRenderCompositeTrapezoids_dylibloader_orig_xrender +#define XRenderCompositeTriangles XRenderCompositeTriangles_dylibloader_orig_xrender +#define XRenderCompositeTriStrip XRenderCompositeTriStrip_dylibloader_orig_xrender +#define XRenderCompositeTriFan XRenderCompositeTriFan_dylibloader_orig_xrender +#define XRenderCompositeDoublePoly XRenderCompositeDoublePoly_dylibloader_orig_xrender +#define XRenderParseColor XRenderParseColor_dylibloader_orig_xrender +#define XRenderCreateCursor XRenderCreateCursor_dylibloader_orig_xrender +#define XRenderQueryFilters XRenderQueryFilters_dylibloader_orig_xrender +#define XRenderSetPictureFilter XRenderSetPictureFilter_dylibloader_orig_xrender +#define XRenderCreateAnimCursor XRenderCreateAnimCursor_dylibloader_orig_xrender +#define XRenderAddTraps XRenderAddTraps_dylibloader_orig_xrender +#define XRenderCreateSolidFill XRenderCreateSolidFill_dylibloader_orig_xrender +#define XRenderCreateLinearGradient XRenderCreateLinearGradient_dylibloader_orig_xrender +#define XRenderCreateRadialGradient XRenderCreateRadialGradient_dylibloader_orig_xrender +#define XRenderCreateConicalGradient XRenderCreateConicalGradient_dylibloader_orig_xrender +#include <X11/extensions/Xrender.h> +#undef XRenderQueryExtension +#undef XRenderQueryVersion +#undef XRenderQueryFormats +#undef XRenderQuerySubpixelOrder +#undef XRenderSetSubpixelOrder +#undef XRenderFindVisualFormat +#undef XRenderFindFormat +#undef XRenderFindStandardFormat +#undef XRenderQueryPictIndexValues +#undef XRenderCreatePicture +#undef XRenderChangePicture +#undef XRenderSetPictureClipRectangles +#undef XRenderSetPictureClipRegion +#undef XRenderSetPictureTransform +#undef XRenderFreePicture +#undef XRenderComposite +#undef XRenderCreateGlyphSet +#undef XRenderReferenceGlyphSet +#undef XRenderFreeGlyphSet +#undef XRenderAddGlyphs +#undef XRenderFreeGlyphs +#undef XRenderCompositeString8 +#undef XRenderCompositeString16 +#undef XRenderCompositeString32 +#undef XRenderCompositeText8 +#undef XRenderCompositeText16 +#undef XRenderCompositeText32 +#undef XRenderFillRectangle +#undef XRenderFillRectangles +#undef XRenderCompositeTrapezoids +#undef XRenderCompositeTriangles +#undef XRenderCompositeTriStrip +#undef XRenderCompositeTriFan +#undef XRenderCompositeDoublePoly +#undef XRenderParseColor +#undef XRenderCreateCursor +#undef XRenderQueryFilters +#undef XRenderSetPictureFilter +#undef XRenderCreateAnimCursor +#undef XRenderAddTraps +#undef XRenderCreateSolidFill +#undef XRenderCreateLinearGradient +#undef XRenderCreateRadialGradient +#undef XRenderCreateConicalGradient +#include <dlfcn.h> +#include <stdio.h> +int (*XRenderQueryExtension_dylibloader_wrapper_xrender)( Display*, int*, int*); +int (*XRenderQueryVersion_dylibloader_wrapper_xrender)( Display*, int*, int*); +int (*XRenderQueryFormats_dylibloader_wrapper_xrender)( Display*); +int (*XRenderQuerySubpixelOrder_dylibloader_wrapper_xrender)( Display*, int); +int (*XRenderSetSubpixelOrder_dylibloader_wrapper_xrender)( Display*, int, int); +XRenderPictFormat* (*XRenderFindVisualFormat_dylibloader_wrapper_xrender)( Display*,const Visual*); +XRenderPictFormat* (*XRenderFindFormat_dylibloader_wrapper_xrender)( Display*, unsigned long,const XRenderPictFormat*, int); +XRenderPictFormat* (*XRenderFindStandardFormat_dylibloader_wrapper_xrender)( Display*, int); +XIndexValue* (*XRenderQueryPictIndexValues_dylibloader_wrapper_xrender)( Display*,const XRenderPictFormat*, int*); +Picture (*XRenderCreatePicture_dylibloader_wrapper_xrender)( Display*, Drawable,const XRenderPictFormat*, unsigned long,const XRenderPictureAttributes*); +void (*XRenderChangePicture_dylibloader_wrapper_xrender)( Display*, Picture, unsigned long,const XRenderPictureAttributes*); +void (*XRenderSetPictureClipRectangles_dylibloader_wrapper_xrender)( Display*, Picture, int, int,const XRectangle*, int); +void (*XRenderSetPictureClipRegion_dylibloader_wrapper_xrender)( Display*, Picture, Region); +void (*XRenderSetPictureTransform_dylibloader_wrapper_xrender)( Display*, Picture, XTransform*); +void (*XRenderFreePicture_dylibloader_wrapper_xrender)( Display*, Picture); +void (*XRenderComposite_dylibloader_wrapper_xrender)( Display*, int, Picture, Picture, Picture, int, int, int, int, int, int, unsigned int, unsigned int); +GlyphSet (*XRenderCreateGlyphSet_dylibloader_wrapper_xrender)( Display*,const XRenderPictFormat*); +GlyphSet (*XRenderReferenceGlyphSet_dylibloader_wrapper_xrender)( Display*, GlyphSet); +void (*XRenderFreeGlyphSet_dylibloader_wrapper_xrender)( Display*, GlyphSet); +void (*XRenderAddGlyphs_dylibloader_wrapper_xrender)( Display*, GlyphSet,const Glyph*,const XGlyphInfo*, int,const char*, int); +void (*XRenderFreeGlyphs_dylibloader_wrapper_xrender)( Display*, GlyphSet,const Glyph*, int); +void (*XRenderCompositeString8_dylibloader_wrapper_xrender)( Display*, int, Picture, Picture,const XRenderPictFormat*, GlyphSet, int, int, int, int,const char*, int); +void (*XRenderCompositeString16_dylibloader_wrapper_xrender)( Display*, int, Picture, Picture,const XRenderPictFormat*, GlyphSet, int, int, int, int,const unsigned short*, int); +void (*XRenderCompositeString32_dylibloader_wrapper_xrender)( Display*, int, Picture, Picture,const XRenderPictFormat*, GlyphSet, int, int, int, int,const unsigned int*, int); +void (*XRenderCompositeText8_dylibloader_wrapper_xrender)( Display*, int, Picture, Picture,const XRenderPictFormat*, int, int, int, int,const XGlyphElt8*, int); +void (*XRenderCompositeText16_dylibloader_wrapper_xrender)( Display*, int, Picture, Picture,const XRenderPictFormat*, int, int, int, int,const XGlyphElt16*, int); +void (*XRenderCompositeText32_dylibloader_wrapper_xrender)( Display*, int, Picture, Picture,const XRenderPictFormat*, int, int, int, int,const XGlyphElt32*, int); +void (*XRenderFillRectangle_dylibloader_wrapper_xrender)( Display*, int, Picture,const XRenderColor*, int, int, unsigned int, unsigned int); +void (*XRenderFillRectangles_dylibloader_wrapper_xrender)( Display*, int, Picture,const XRenderColor*,const XRectangle*, int); +void (*XRenderCompositeTrapezoids_dylibloader_wrapper_xrender)( Display*, int, Picture, Picture,const XRenderPictFormat*, int, int,const XTrapezoid*, int); +void (*XRenderCompositeTriangles_dylibloader_wrapper_xrender)( Display*, int, Picture, Picture,const XRenderPictFormat*, int, int,const XTriangle*, int); +void (*XRenderCompositeTriStrip_dylibloader_wrapper_xrender)( Display*, int, Picture, Picture,const XRenderPictFormat*, int, int,const XPointFixed*, int); +void (*XRenderCompositeTriFan_dylibloader_wrapper_xrender)( Display*, int, Picture, Picture,const XRenderPictFormat*, int, int,const XPointFixed*, int); +void (*XRenderCompositeDoublePoly_dylibloader_wrapper_xrender)( Display*, int, Picture, Picture,const XRenderPictFormat*, int, int, int, int,const XPointDouble*, int, int); +int (*XRenderParseColor_dylibloader_wrapper_xrender)( Display*, char*, XRenderColor*); +Cursor (*XRenderCreateCursor_dylibloader_wrapper_xrender)( Display*, Picture, unsigned int, unsigned int); +XFilters* (*XRenderQueryFilters_dylibloader_wrapper_xrender)( Display*, Drawable); +void (*XRenderSetPictureFilter_dylibloader_wrapper_xrender)( Display*, Picture,const char*, XFixed*, int); +Cursor (*XRenderCreateAnimCursor_dylibloader_wrapper_xrender)( Display*, int, XAnimCursor*); +void (*XRenderAddTraps_dylibloader_wrapper_xrender)( Display*, Picture, int, int,const XTrap*, int); +Picture (*XRenderCreateSolidFill_dylibloader_wrapper_xrender)( Display*,const XRenderColor*); +Picture (*XRenderCreateLinearGradient_dylibloader_wrapper_xrender)( Display*,const XLinearGradient*,const XFixed*,const XRenderColor*, int); +Picture (*XRenderCreateRadialGradient_dylibloader_wrapper_xrender)( Display*,const XRadialGradient*,const XFixed*,const XRenderColor*, int); +Picture (*XRenderCreateConicalGradient_dylibloader_wrapper_xrender)( Display*,const XConicalGradient*,const XFixed*,const XRenderColor*, int); +int initialize_xrender(int verbose) { + void *handle; + char *error; + handle = dlopen("libXrender.so.1", RTLD_LAZY); + if (!handle) { + if (verbose) { + fprintf(stderr, "%s\n", dlerror()); + } + return(1); + } + dlerror(); +// XRenderQueryExtension + *(void **) (&XRenderQueryExtension_dylibloader_wrapper_xrender) = dlsym(handle, "XRenderQueryExtension"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XRenderQueryVersion + *(void **) (&XRenderQueryVersion_dylibloader_wrapper_xrender) = dlsym(handle, "XRenderQueryVersion"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XRenderQueryFormats + *(void **) (&XRenderQueryFormats_dylibloader_wrapper_xrender) = dlsym(handle, "XRenderQueryFormats"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XRenderQuerySubpixelOrder + *(void **) (&XRenderQuerySubpixelOrder_dylibloader_wrapper_xrender) = dlsym(handle, "XRenderQuerySubpixelOrder"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XRenderSetSubpixelOrder + *(void **) (&XRenderSetSubpixelOrder_dylibloader_wrapper_xrender) = dlsym(handle, "XRenderSetSubpixelOrder"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XRenderFindVisualFormat + *(void **) (&XRenderFindVisualFormat_dylibloader_wrapper_xrender) = dlsym(handle, "XRenderFindVisualFormat"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XRenderFindFormat + *(void **) (&XRenderFindFormat_dylibloader_wrapper_xrender) = dlsym(handle, "XRenderFindFormat"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XRenderFindStandardFormat + *(void **) (&XRenderFindStandardFormat_dylibloader_wrapper_xrender) = dlsym(handle, "XRenderFindStandardFormat"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XRenderQueryPictIndexValues + *(void **) (&XRenderQueryPictIndexValues_dylibloader_wrapper_xrender) = dlsym(handle, "XRenderQueryPictIndexValues"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XRenderCreatePicture + *(void **) (&XRenderCreatePicture_dylibloader_wrapper_xrender) = dlsym(handle, "XRenderCreatePicture"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XRenderChangePicture + *(void **) (&XRenderChangePicture_dylibloader_wrapper_xrender) = dlsym(handle, "XRenderChangePicture"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XRenderSetPictureClipRectangles + *(void **) (&XRenderSetPictureClipRectangles_dylibloader_wrapper_xrender) = dlsym(handle, "XRenderSetPictureClipRectangles"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XRenderSetPictureClipRegion + *(void **) (&XRenderSetPictureClipRegion_dylibloader_wrapper_xrender) = dlsym(handle, "XRenderSetPictureClipRegion"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XRenderSetPictureTransform + *(void **) (&XRenderSetPictureTransform_dylibloader_wrapper_xrender) = dlsym(handle, "XRenderSetPictureTransform"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XRenderFreePicture + *(void **) (&XRenderFreePicture_dylibloader_wrapper_xrender) = dlsym(handle, "XRenderFreePicture"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XRenderComposite + *(void **) (&XRenderComposite_dylibloader_wrapper_xrender) = dlsym(handle, "XRenderComposite"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XRenderCreateGlyphSet + *(void **) (&XRenderCreateGlyphSet_dylibloader_wrapper_xrender) = dlsym(handle, "XRenderCreateGlyphSet"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XRenderReferenceGlyphSet + *(void **) (&XRenderReferenceGlyphSet_dylibloader_wrapper_xrender) = dlsym(handle, "XRenderReferenceGlyphSet"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XRenderFreeGlyphSet + *(void **) (&XRenderFreeGlyphSet_dylibloader_wrapper_xrender) = dlsym(handle, "XRenderFreeGlyphSet"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XRenderAddGlyphs + *(void **) (&XRenderAddGlyphs_dylibloader_wrapper_xrender) = dlsym(handle, "XRenderAddGlyphs"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XRenderFreeGlyphs + *(void **) (&XRenderFreeGlyphs_dylibloader_wrapper_xrender) = dlsym(handle, "XRenderFreeGlyphs"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XRenderCompositeString8 + *(void **) (&XRenderCompositeString8_dylibloader_wrapper_xrender) = dlsym(handle, "XRenderCompositeString8"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XRenderCompositeString16 + *(void **) (&XRenderCompositeString16_dylibloader_wrapper_xrender) = dlsym(handle, "XRenderCompositeString16"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XRenderCompositeString32 + *(void **) (&XRenderCompositeString32_dylibloader_wrapper_xrender) = dlsym(handle, "XRenderCompositeString32"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XRenderCompositeText8 + *(void **) (&XRenderCompositeText8_dylibloader_wrapper_xrender) = dlsym(handle, "XRenderCompositeText8"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XRenderCompositeText16 + *(void **) (&XRenderCompositeText16_dylibloader_wrapper_xrender) = dlsym(handle, "XRenderCompositeText16"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XRenderCompositeText32 + *(void **) (&XRenderCompositeText32_dylibloader_wrapper_xrender) = dlsym(handle, "XRenderCompositeText32"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XRenderFillRectangle + *(void **) (&XRenderFillRectangle_dylibloader_wrapper_xrender) = dlsym(handle, "XRenderFillRectangle"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XRenderFillRectangles + *(void **) (&XRenderFillRectangles_dylibloader_wrapper_xrender) = dlsym(handle, "XRenderFillRectangles"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XRenderCompositeTrapezoids + *(void **) (&XRenderCompositeTrapezoids_dylibloader_wrapper_xrender) = dlsym(handle, "XRenderCompositeTrapezoids"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XRenderCompositeTriangles + *(void **) (&XRenderCompositeTriangles_dylibloader_wrapper_xrender) = dlsym(handle, "XRenderCompositeTriangles"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XRenderCompositeTriStrip + *(void **) (&XRenderCompositeTriStrip_dylibloader_wrapper_xrender) = dlsym(handle, "XRenderCompositeTriStrip"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XRenderCompositeTriFan + *(void **) (&XRenderCompositeTriFan_dylibloader_wrapper_xrender) = dlsym(handle, "XRenderCompositeTriFan"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XRenderCompositeDoublePoly + *(void **) (&XRenderCompositeDoublePoly_dylibloader_wrapper_xrender) = dlsym(handle, "XRenderCompositeDoublePoly"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XRenderParseColor + *(void **) (&XRenderParseColor_dylibloader_wrapper_xrender) = dlsym(handle, "XRenderParseColor"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XRenderCreateCursor + *(void **) (&XRenderCreateCursor_dylibloader_wrapper_xrender) = dlsym(handle, "XRenderCreateCursor"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XRenderQueryFilters + *(void **) (&XRenderQueryFilters_dylibloader_wrapper_xrender) = dlsym(handle, "XRenderQueryFilters"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XRenderSetPictureFilter + *(void **) (&XRenderSetPictureFilter_dylibloader_wrapper_xrender) = dlsym(handle, "XRenderSetPictureFilter"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XRenderCreateAnimCursor + *(void **) (&XRenderCreateAnimCursor_dylibloader_wrapper_xrender) = dlsym(handle, "XRenderCreateAnimCursor"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XRenderAddTraps + *(void **) (&XRenderAddTraps_dylibloader_wrapper_xrender) = dlsym(handle, "XRenderAddTraps"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XRenderCreateSolidFill + *(void **) (&XRenderCreateSolidFill_dylibloader_wrapper_xrender) = dlsym(handle, "XRenderCreateSolidFill"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XRenderCreateLinearGradient + *(void **) (&XRenderCreateLinearGradient_dylibloader_wrapper_xrender) = dlsym(handle, "XRenderCreateLinearGradient"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XRenderCreateRadialGradient + *(void **) (&XRenderCreateRadialGradient_dylibloader_wrapper_xrender) = dlsym(handle, "XRenderCreateRadialGradient"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XRenderCreateConicalGradient + *(void **) (&XRenderCreateConicalGradient_dylibloader_wrapper_xrender) = dlsym(handle, "XRenderCreateConicalGradient"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +return 0; +} diff --git a/platform/linuxbsd/x11/dynwrappers/xrender-so_wrap.h b/platform/linuxbsd/x11/dynwrappers/xrender-so_wrap.h new file mode 100644 index 0000000000..d3862ed459 --- /dev/null +++ b/platform/linuxbsd/x11/dynwrappers/xrender-so_wrap.h @@ -0,0 +1,198 @@ +#ifndef DYLIBLOAD_WRAPPER_XRENDER +#define DYLIBLOAD_WRAPPER_XRENDER +// This file is generated. Do not edit! +// see https://github.com/hpvb/dynload-wrapper for details +// generated by ./generate-wrapper.py 0.3 on 2022-12-02 12:55:28 +// flags: ./generate-wrapper.py --include /usr/include/X11/extensions/Xrender.h --sys-include <X11/extensions/Xrender.h> --soname libXrender.so.1 --init-name xrender --output-header xrender-so_wrap.h --output-implementation xrender-so_wrap.c +// +// NOTE: Generated from Xrender 0.9.10. +// This has been handpatched to workaround some issues with the generator that +// will be eventually fixed. In this case, non-existant symbols inherited from +// libX11, but absent in libXrender.so.1, were removed. +#include <stdint.h> + +#define XRenderQueryExtension XRenderQueryExtension_dylibloader_orig_xrender +#define XRenderQueryVersion XRenderQueryVersion_dylibloader_orig_xrender +#define XRenderQueryFormats XRenderQueryFormats_dylibloader_orig_xrender +#define XRenderQuerySubpixelOrder XRenderQuerySubpixelOrder_dylibloader_orig_xrender +#define XRenderSetSubpixelOrder XRenderSetSubpixelOrder_dylibloader_orig_xrender +#define XRenderFindVisualFormat XRenderFindVisualFormat_dylibloader_orig_xrender +#define XRenderFindFormat XRenderFindFormat_dylibloader_orig_xrender +#define XRenderFindStandardFormat XRenderFindStandardFormat_dylibloader_orig_xrender +#define XRenderQueryPictIndexValues XRenderQueryPictIndexValues_dylibloader_orig_xrender +#define XRenderCreatePicture XRenderCreatePicture_dylibloader_orig_xrender +#define XRenderChangePicture XRenderChangePicture_dylibloader_orig_xrender +#define XRenderSetPictureClipRectangles XRenderSetPictureClipRectangles_dylibloader_orig_xrender +#define XRenderSetPictureClipRegion XRenderSetPictureClipRegion_dylibloader_orig_xrender +#define XRenderSetPictureTransform XRenderSetPictureTransform_dylibloader_orig_xrender +#define XRenderFreePicture XRenderFreePicture_dylibloader_orig_xrender +#define XRenderComposite XRenderComposite_dylibloader_orig_xrender +#define XRenderCreateGlyphSet XRenderCreateGlyphSet_dylibloader_orig_xrender +#define XRenderReferenceGlyphSet XRenderReferenceGlyphSet_dylibloader_orig_xrender +#define XRenderFreeGlyphSet XRenderFreeGlyphSet_dylibloader_orig_xrender +#define XRenderAddGlyphs XRenderAddGlyphs_dylibloader_orig_xrender +#define XRenderFreeGlyphs XRenderFreeGlyphs_dylibloader_orig_xrender +#define XRenderCompositeString8 XRenderCompositeString8_dylibloader_orig_xrender +#define XRenderCompositeString16 XRenderCompositeString16_dylibloader_orig_xrender +#define XRenderCompositeString32 XRenderCompositeString32_dylibloader_orig_xrender +#define XRenderCompositeText8 XRenderCompositeText8_dylibloader_orig_xrender +#define XRenderCompositeText16 XRenderCompositeText16_dylibloader_orig_xrender +#define XRenderCompositeText32 XRenderCompositeText32_dylibloader_orig_xrender +#define XRenderFillRectangle XRenderFillRectangle_dylibloader_orig_xrender +#define XRenderFillRectangles XRenderFillRectangles_dylibloader_orig_xrender +#define XRenderCompositeTrapezoids XRenderCompositeTrapezoids_dylibloader_orig_xrender +#define XRenderCompositeTriangles XRenderCompositeTriangles_dylibloader_orig_xrender +#define XRenderCompositeTriStrip XRenderCompositeTriStrip_dylibloader_orig_xrender +#define XRenderCompositeTriFan XRenderCompositeTriFan_dylibloader_orig_xrender +#define XRenderCompositeDoublePoly XRenderCompositeDoublePoly_dylibloader_orig_xrender +#define XRenderParseColor XRenderParseColor_dylibloader_orig_xrender +#define XRenderCreateCursor XRenderCreateCursor_dylibloader_orig_xrender +#define XRenderQueryFilters XRenderQueryFilters_dylibloader_orig_xrender +#define XRenderSetPictureFilter XRenderSetPictureFilter_dylibloader_orig_xrender +#define XRenderCreateAnimCursor XRenderCreateAnimCursor_dylibloader_orig_xrender +#define XRenderAddTraps XRenderAddTraps_dylibloader_orig_xrender +#define XRenderCreateSolidFill XRenderCreateSolidFill_dylibloader_orig_xrender +#define XRenderCreateLinearGradient XRenderCreateLinearGradient_dylibloader_orig_xrender +#define XRenderCreateRadialGradient XRenderCreateRadialGradient_dylibloader_orig_xrender +#define XRenderCreateConicalGradient XRenderCreateConicalGradient_dylibloader_orig_xrender +#include <X11/extensions/Xrender.h> +#undef XRenderQueryExtension +#undef XRenderQueryVersion +#undef XRenderQueryFormats +#undef XRenderQuerySubpixelOrder +#undef XRenderSetSubpixelOrder +#undef XRenderFindVisualFormat +#undef XRenderFindFormat +#undef XRenderFindStandardFormat +#undef XRenderQueryPictIndexValues +#undef XRenderCreatePicture +#undef XRenderChangePicture +#undef XRenderSetPictureClipRectangles +#undef XRenderSetPictureClipRegion +#undef XRenderSetPictureTransform +#undef XRenderFreePicture +#undef XRenderComposite +#undef XRenderCreateGlyphSet +#undef XRenderReferenceGlyphSet +#undef XRenderFreeGlyphSet +#undef XRenderAddGlyphs +#undef XRenderFreeGlyphs +#undef XRenderCompositeString8 +#undef XRenderCompositeString16 +#undef XRenderCompositeString32 +#undef XRenderCompositeText8 +#undef XRenderCompositeText16 +#undef XRenderCompositeText32 +#undef XRenderFillRectangle +#undef XRenderFillRectangles +#undef XRenderCompositeTrapezoids +#undef XRenderCompositeTriangles +#undef XRenderCompositeTriStrip +#undef XRenderCompositeTriFan +#undef XRenderCompositeDoublePoly +#undef XRenderParseColor +#undef XRenderCreateCursor +#undef XRenderQueryFilters +#undef XRenderSetPictureFilter +#undef XRenderCreateAnimCursor +#undef XRenderAddTraps +#undef XRenderCreateSolidFill +#undef XRenderCreateLinearGradient +#undef XRenderCreateRadialGradient +#undef XRenderCreateConicalGradient +#ifdef __cplusplus +extern "C" { +#endif +#define XRenderQueryExtension XRenderQueryExtension_dylibloader_wrapper_xrender +#define XRenderQueryVersion XRenderQueryVersion_dylibloader_wrapper_xrender +#define XRenderQueryFormats XRenderQueryFormats_dylibloader_wrapper_xrender +#define XRenderQuerySubpixelOrder XRenderQuerySubpixelOrder_dylibloader_wrapper_xrender +#define XRenderSetSubpixelOrder XRenderSetSubpixelOrder_dylibloader_wrapper_xrender +#define XRenderFindVisualFormat XRenderFindVisualFormat_dylibloader_wrapper_xrender +#define XRenderFindFormat XRenderFindFormat_dylibloader_wrapper_xrender +#define XRenderFindStandardFormat XRenderFindStandardFormat_dylibloader_wrapper_xrender +#define XRenderQueryPictIndexValues XRenderQueryPictIndexValues_dylibloader_wrapper_xrender +#define XRenderCreatePicture XRenderCreatePicture_dylibloader_wrapper_xrender +#define XRenderChangePicture XRenderChangePicture_dylibloader_wrapper_xrender +#define XRenderSetPictureClipRectangles XRenderSetPictureClipRectangles_dylibloader_wrapper_xrender +#define XRenderSetPictureClipRegion XRenderSetPictureClipRegion_dylibloader_wrapper_xrender +#define XRenderSetPictureTransform XRenderSetPictureTransform_dylibloader_wrapper_xrender +#define XRenderFreePicture XRenderFreePicture_dylibloader_wrapper_xrender +#define XRenderComposite XRenderComposite_dylibloader_wrapper_xrender +#define XRenderCreateGlyphSet XRenderCreateGlyphSet_dylibloader_wrapper_xrender +#define XRenderReferenceGlyphSet XRenderReferenceGlyphSet_dylibloader_wrapper_xrender +#define XRenderFreeGlyphSet XRenderFreeGlyphSet_dylibloader_wrapper_xrender +#define XRenderAddGlyphs XRenderAddGlyphs_dylibloader_wrapper_xrender +#define XRenderFreeGlyphs XRenderFreeGlyphs_dylibloader_wrapper_xrender +#define XRenderCompositeString8 XRenderCompositeString8_dylibloader_wrapper_xrender +#define XRenderCompositeString16 XRenderCompositeString16_dylibloader_wrapper_xrender +#define XRenderCompositeString32 XRenderCompositeString32_dylibloader_wrapper_xrender +#define XRenderCompositeText8 XRenderCompositeText8_dylibloader_wrapper_xrender +#define XRenderCompositeText16 XRenderCompositeText16_dylibloader_wrapper_xrender +#define XRenderCompositeText32 XRenderCompositeText32_dylibloader_wrapper_xrender +#define XRenderFillRectangle XRenderFillRectangle_dylibloader_wrapper_xrender +#define XRenderFillRectangles XRenderFillRectangles_dylibloader_wrapper_xrender +#define XRenderCompositeTrapezoids XRenderCompositeTrapezoids_dylibloader_wrapper_xrender +#define XRenderCompositeTriangles XRenderCompositeTriangles_dylibloader_wrapper_xrender +#define XRenderCompositeTriStrip XRenderCompositeTriStrip_dylibloader_wrapper_xrender +#define XRenderCompositeTriFan XRenderCompositeTriFan_dylibloader_wrapper_xrender +#define XRenderCompositeDoublePoly XRenderCompositeDoublePoly_dylibloader_wrapper_xrender +#define XRenderParseColor XRenderParseColor_dylibloader_wrapper_xrender +#define XRenderCreateCursor XRenderCreateCursor_dylibloader_wrapper_xrender +#define XRenderQueryFilters XRenderQueryFilters_dylibloader_wrapper_xrender +#define XRenderSetPictureFilter XRenderSetPictureFilter_dylibloader_wrapper_xrender +#define XRenderCreateAnimCursor XRenderCreateAnimCursor_dylibloader_wrapper_xrender +#define XRenderAddTraps XRenderAddTraps_dylibloader_wrapper_xrender +#define XRenderCreateSolidFill XRenderCreateSolidFill_dylibloader_wrapper_xrender +#define XRenderCreateLinearGradient XRenderCreateLinearGradient_dylibloader_wrapper_xrender +#define XRenderCreateRadialGradient XRenderCreateRadialGradient_dylibloader_wrapper_xrender +#define XRenderCreateConicalGradient XRenderCreateConicalGradient_dylibloader_wrapper_xrender +extern int (*XRenderQueryExtension_dylibloader_wrapper_xrender)( Display*, int*, int*); +extern int (*XRenderQueryVersion_dylibloader_wrapper_xrender)( Display*, int*, int*); +extern int (*XRenderQueryFormats_dylibloader_wrapper_xrender)( Display*); +extern int (*XRenderQuerySubpixelOrder_dylibloader_wrapper_xrender)( Display*, int); +extern int (*XRenderSetSubpixelOrder_dylibloader_wrapper_xrender)( Display*, int, int); +extern XRenderPictFormat* (*XRenderFindVisualFormat_dylibloader_wrapper_xrender)( Display*,const Visual*); +extern XRenderPictFormat* (*XRenderFindFormat_dylibloader_wrapper_xrender)( Display*, unsigned long,const XRenderPictFormat*, int); +extern XRenderPictFormat* (*XRenderFindStandardFormat_dylibloader_wrapper_xrender)( Display*, int); +extern XIndexValue* (*XRenderQueryPictIndexValues_dylibloader_wrapper_xrender)( Display*,const XRenderPictFormat*, int*); +extern Picture (*XRenderCreatePicture_dylibloader_wrapper_xrender)( Display*, Drawable,const XRenderPictFormat*, unsigned long,const XRenderPictureAttributes*); +extern void (*XRenderChangePicture_dylibloader_wrapper_xrender)( Display*, Picture, unsigned long,const XRenderPictureAttributes*); +extern void (*XRenderSetPictureClipRectangles_dylibloader_wrapper_xrender)( Display*, Picture, int, int,const XRectangle*, int); +extern void (*XRenderSetPictureClipRegion_dylibloader_wrapper_xrender)( Display*, Picture, Region); +extern void (*XRenderSetPictureTransform_dylibloader_wrapper_xrender)( Display*, Picture, XTransform*); +extern void (*XRenderFreePicture_dylibloader_wrapper_xrender)( Display*, Picture); +extern void (*XRenderComposite_dylibloader_wrapper_xrender)( Display*, int, Picture, Picture, Picture, int, int, int, int, int, int, unsigned int, unsigned int); +extern GlyphSet (*XRenderCreateGlyphSet_dylibloader_wrapper_xrender)( Display*,const XRenderPictFormat*); +extern GlyphSet (*XRenderReferenceGlyphSet_dylibloader_wrapper_xrender)( Display*, GlyphSet); +extern void (*XRenderFreeGlyphSet_dylibloader_wrapper_xrender)( Display*, GlyphSet); +extern void (*XRenderAddGlyphs_dylibloader_wrapper_xrender)( Display*, GlyphSet,const Glyph*,const XGlyphInfo*, int,const char*, int); +extern void (*XRenderFreeGlyphs_dylibloader_wrapper_xrender)( Display*, GlyphSet,const Glyph*, int); +extern void (*XRenderCompositeString8_dylibloader_wrapper_xrender)( Display*, int, Picture, Picture,const XRenderPictFormat*, GlyphSet, int, int, int, int,const char*, int); +extern void (*XRenderCompositeString16_dylibloader_wrapper_xrender)( Display*, int, Picture, Picture,const XRenderPictFormat*, GlyphSet, int, int, int, int,const unsigned short*, int); +extern void (*XRenderCompositeString32_dylibloader_wrapper_xrender)( Display*, int, Picture, Picture,const XRenderPictFormat*, GlyphSet, int, int, int, int,const unsigned int*, int); +extern void (*XRenderCompositeText8_dylibloader_wrapper_xrender)( Display*, int, Picture, Picture,const XRenderPictFormat*, int, int, int, int,const XGlyphElt8*, int); +extern void (*XRenderCompositeText16_dylibloader_wrapper_xrender)( Display*, int, Picture, Picture,const XRenderPictFormat*, int, int, int, int,const XGlyphElt16*, int); +extern void (*XRenderCompositeText32_dylibloader_wrapper_xrender)( Display*, int, Picture, Picture,const XRenderPictFormat*, int, int, int, int,const XGlyphElt32*, int); +extern void (*XRenderFillRectangle_dylibloader_wrapper_xrender)( Display*, int, Picture,const XRenderColor*, int, int, unsigned int, unsigned int); +extern void (*XRenderFillRectangles_dylibloader_wrapper_xrender)( Display*, int, Picture,const XRenderColor*,const XRectangle*, int); +extern void (*XRenderCompositeTrapezoids_dylibloader_wrapper_xrender)( Display*, int, Picture, Picture,const XRenderPictFormat*, int, int,const XTrapezoid*, int); +extern void (*XRenderCompositeTriangles_dylibloader_wrapper_xrender)( Display*, int, Picture, Picture,const XRenderPictFormat*, int, int,const XTriangle*, int); +extern void (*XRenderCompositeTriStrip_dylibloader_wrapper_xrender)( Display*, int, Picture, Picture,const XRenderPictFormat*, int, int,const XPointFixed*, int); +extern void (*XRenderCompositeTriFan_dylibloader_wrapper_xrender)( Display*, int, Picture, Picture,const XRenderPictFormat*, int, int,const XPointFixed*, int); +extern void (*XRenderCompositeDoublePoly_dylibloader_wrapper_xrender)( Display*, int, Picture, Picture,const XRenderPictFormat*, int, int, int, int,const XPointDouble*, int, int); +extern int (*XRenderParseColor_dylibloader_wrapper_xrender)( Display*, char*, XRenderColor*); +extern Cursor (*XRenderCreateCursor_dylibloader_wrapper_xrender)( Display*, Picture, unsigned int, unsigned int); +extern XFilters* (*XRenderQueryFilters_dylibloader_wrapper_xrender)( Display*, Drawable); +extern void (*XRenderSetPictureFilter_dylibloader_wrapper_xrender)( Display*, Picture,const char*, XFixed*, int); +extern Cursor (*XRenderCreateAnimCursor_dylibloader_wrapper_xrender)( Display*, int, XAnimCursor*); +extern void (*XRenderAddTraps_dylibloader_wrapper_xrender)( Display*, Picture, int, int,const XTrap*, int); +extern Picture (*XRenderCreateSolidFill_dylibloader_wrapper_xrender)( Display*,const XRenderColor*); +extern Picture (*XRenderCreateLinearGradient_dylibloader_wrapper_xrender)( Display*,const XLinearGradient*,const XFixed*,const XRenderColor*, int); +extern Picture (*XRenderCreateRadialGradient_dylibloader_wrapper_xrender)( Display*,const XRadialGradient*,const XFixed*,const XRenderColor*, int); +extern Picture (*XRenderCreateConicalGradient_dylibloader_wrapper_xrender)( Display*,const XConicalGradient*,const XFixed*,const XRenderColor*, int); +int initialize_xrender(int verbose); +#ifdef __cplusplus +} +#endif +#endif diff --git a/platform/linuxbsd/x11/gl_manager_x11.cpp b/platform/linuxbsd/x11/gl_manager_x11.cpp index bcefcf9695..12846f148d 100644 --- a/platform/linuxbsd/x11/gl_manager_x11.cpp +++ b/platform/linuxbsd/x11/gl_manager_x11.cpp @@ -321,8 +321,8 @@ void GLManager_X11::swap_buffers() { glXSwapBuffers(_x_windisp.x11_display, _x_windisp.x11_window); } -Error GLManager_X11::initialize() { - if (!gladLoaderLoadGLX(nullptr, 0)) { +Error GLManager_X11::initialize(Display *p_display) { + if (!gladLoaderLoadGLX(p_display, XScreenNumberOfScreen(XDefaultScreenOfDisplay(p_display)))) { return ERR_CANT_CREATE; } diff --git a/platform/linuxbsd/x11/gl_manager_x11.h b/platform/linuxbsd/x11/gl_manager_x11.h index 1594c82801..3ab37b54ac 100644 --- a/platform/linuxbsd/x11/gl_manager_x11.h +++ b/platform/linuxbsd/x11/gl_manager_x11.h @@ -37,9 +37,10 @@ #include "core/os/os.h" #include "core/templates/local_vector.h" +#include "dynwrappers/xext-so_wrap.h" +#include "dynwrappers/xlib-so_wrap.h" +#include "dynwrappers/xrender-so_wrap.h" #include "servers/display_server.h" -#include <X11/Xlib.h> -#include <X11/extensions/Xrender.h> struct GLManager_X11_Private; @@ -111,7 +112,7 @@ public: void window_make_current(DisplayServer::WindowID p_window_id); - Error initialize(); + Error initialize(Display *p_display); void set_use_vsync(bool p_use); bool is_using_vsync() const; diff --git a/platform/macos/display_server_macos.mm b/platform/macos/display_server_macos.mm index 3aff5b8b7e..ad6143e16e 100644 --- a/platform/macos/display_server_macos.mm +++ b/platform/macos/display_server_macos.mm @@ -2348,9 +2348,6 @@ void DisplayServerMacOS::reparent_check(WindowID p_window) { if (parent_screen == screen) { if (![[wd_parent.window_object childWindows] containsObject:wd.window_object]) { - if (wd.exclusive) { - ERR_FAIL_COND_MSG([[wd_parent.window_object childWindows] count] > 0, "Transient parent has another exclusive child."); - } [wd.window_object setCollectionBehavior:NSWindowCollectionBehaviorFullScreenAuxiliary]; [wd_parent.window_object addChildWindow:wd.window_object ordered:NSWindowAbove]; } @@ -2369,9 +2366,6 @@ void DisplayServerMacOS::reparent_check(WindowID p_window) { if (child_screen == screen) { if (![[wd.window_object childWindows] containsObject:wd_child.window_object]) { - if (wd_child.exclusive) { - ERR_FAIL_COND_MSG([[wd.window_object childWindows] count] > 0, "Transient parent has another exclusive child."); - } if (wd_child.fullscreen) { [wd_child.window_object toggleFullScreen:nil]; } @@ -2426,7 +2420,7 @@ void DisplayServerMacOS::window_set_position(const Point2i &p_position, WindowID ERR_FAIL_COND(!windows.has(p_window)); WindowData &wd = windows[p_window]; - if ([wd.window_object isZoomed]) { + if (NSEqualRects([wd.window_object frame], [[wd.window_object screen] visibleFrame])) { return; } @@ -2549,7 +2543,7 @@ void DisplayServerMacOS::window_set_size(const Size2i p_size, WindowID p_window) ERR_FAIL_COND(!windows.has(p_window)); WindowData &wd = windows[p_window]; - if ([wd.window_object isZoomed]) { + if (NSEqualRects([wd.window_object frame], [[wd.window_object screen] visibleFrame])) { return; } @@ -2631,7 +2625,7 @@ void DisplayServerMacOS::window_set_mode(WindowMode p_mode, WindowID p_window) { wd.exclusive_fullscreen = false; } break; case WINDOW_MODE_MAXIMIZED: { - if ([wd.window_object isZoomed]) { + if (NSEqualRects([wd.window_object frame], [[wd.window_object screen] visibleFrame])) { [wd.window_object zoom:nil]; } } break; @@ -2664,7 +2658,7 @@ void DisplayServerMacOS::window_set_mode(WindowMode p_mode, WindowID p_window) { } } break; case WINDOW_MODE_MAXIMIZED: { - if (![wd.window_object isZoomed]) { + if (!NSEqualRects([wd.window_object frame], [[wd.window_object screen] visibleFrame])) { [wd.window_object zoom:nil]; } } break; @@ -2684,7 +2678,7 @@ DisplayServer::WindowMode DisplayServerMacOS::window_get_mode(WindowID p_window) return WINDOW_MODE_FULLSCREEN; } } - if ([wd.window_object isZoomed] && !wd.resize_disabled) { + if (NSEqualRects([wd.window_object frame], [[wd.window_object screen] visibleFrame])) { return WINDOW_MODE_MAXIMIZED; } if ([wd.window_object respondsToSelector:@selector(isMiniaturized)]) { @@ -2794,8 +2788,10 @@ void DisplayServerMacOS::window_set_flag(WindowFlags p_flag, bool p_enabled, Win } if (p_enabled) { [wd.window_object setStyleMask:[wd.window_object styleMask] & ~NSWindowStyleMaskResizable]; + [[wd.window_object standardWindowButton:NSWindowZoomButton] setEnabled:NO]; } else { [wd.window_object setStyleMask:[wd.window_object styleMask] | NSWindowStyleMaskResizable]; + [[wd.window_object standardWindowButton:NSWindowZoomButton] setEnabled:YES]; } } break; case WINDOW_FLAG_EXTEND_TO_TITLE: { diff --git a/platform/macos/export/export_plugin.cpp b/platform/macos/export/export_plugin.cpp index 5860a4f0ae..5e71d10a3f 100644 --- a/platform/macos/export/export_plugin.cpp +++ b/platform/macos/export/export_plugin.cpp @@ -1834,8 +1834,8 @@ bool EditorExportPlatformMacOS::has_valid_project_configuration(const Ref<Editor if (p_preset->get("notarization/apple_id_name") != "") { if (p_preset->get("notarization/apple_id_password") == "") { err += TTR("Notarization: Apple ID password not specified.") + "\n"; + valid = false; } - valid = false; } if (p_preset->get("notarization/api_uuid") != "") { if (p_preset->get("notarization/api_key") == "") { diff --git a/platform/macos/export/plist.cpp b/platform/macos/export/plist.cpp index cad014e65b..82ecd41d9c 100644 --- a/platform/macos/export/plist.cpp +++ b/platform/macos/export/plist.cpp @@ -353,7 +353,7 @@ bool PList::load_file(const String &p_filename) { } else { // Load text plist. Error err; - Vector<uint8_t> array = FileAccess::get_file_as_array(p_filename, &err); + Vector<uint8_t> array = FileAccess::get_file_as_bytes(p_filename, &err); ERR_FAIL_COND_V(err != OK, false); String ret; diff --git a/platform/macos/os_macos.h b/platform/macos/os_macos.h index 46e7c17ebe..b2734e57cc 100644 --- a/platform/macos/os_macos.h +++ b/platform/macos/os_macos.h @@ -57,6 +57,10 @@ class OS_MacOS : public OS_Unix { List<String> launch_service_args; + CGFloat _weight_to_ct(int p_weight) const; + CGFloat _stretch_to_ct(int p_stretch) const; + String _get_default_fontname(const String &p_font_name) const; + static _FORCE_INLINE_ String get_framework_executable(const String &p_path); static void pre_wait_observer_cb(CFRunLoopObserverRef p_observer, CFRunLoopActivity p_activiy, void *p_context); @@ -98,7 +102,8 @@ public: virtual String get_locale() const override; virtual Vector<String> get_system_fonts() const override; - virtual String get_system_font_path(const String &p_font_name, bool p_bold = false, bool p_italic = false) const override; + virtual String get_system_font_path(const String &p_font_name, int p_weight = 400, int p_stretch = 100, bool p_italic = false) const override; + virtual Vector<String> get_system_font_path_for_text(const String &p_font_name, const String &p_text, const String &p_locale = String(), const String &p_script = String(), int p_weight = 400, int p_stretch = 100, bool p_italic = false) const override; virtual String get_executable_path() const override; virtual Error create_process(const String &p_path, const List<String> &p_arguments, ProcessID *r_child_id = nullptr, bool p_open_console = false) override; virtual Error create_instance(const List<String> &p_arguments, ProcessID *r_child_id = nullptr) override; diff --git a/platform/macos/os_macos.mm b/platform/macos/os_macos.mm index e620b058d3..ebba96ceb1 100644 --- a/platform/macos/os_macos.mm +++ b/platform/macos/os_macos.mm @@ -336,9 +336,7 @@ Vector<String> OS_MacOS::get_system_fonts() const { return ret; } -String OS_MacOS::get_system_font_path(const String &p_font_name, bool p_bold, bool p_italic) const { - String ret; - +String OS_MacOS::_get_default_fontname(const String &p_font_name) const { String font_name = p_font_name; if (font_name.to_lower() == "sans-serif") { font_name = "Helvetica"; @@ -351,21 +349,153 @@ String OS_MacOS::get_system_font_path(const String &p_font_name, bool p_bold, bo } else if (font_name.to_lower() == "cursive") { font_name = "Apple Chancery"; }; + return font_name; +} + +CGFloat OS_MacOS::_weight_to_ct(int p_weight) const { + if (p_weight < 150) { + return -0.80; + } else if (p_weight < 250) { + return -0.60; + } else if (p_weight < 350) { + return -0.40; + } else if (p_weight < 450) { + return 0.0; + } else if (p_weight < 550) { + return 0.23; + } else if (p_weight < 650) { + return 0.30; + } else if (p_weight < 750) { + return 0.40; + } else if (p_weight < 850) { + return 0.56; + } else if (p_weight < 925) { + return 0.62; + } else { + return 1.00; + } +} + +CGFloat OS_MacOS::_stretch_to_ct(int p_stretch) const { + if (p_stretch < 56) { + return -0.5; + } else if (p_stretch < 69) { + return -0.37; + } else if (p_stretch < 81) { + return -0.25; + } else if (p_stretch < 93) { + return -0.13; + } else if (p_stretch < 106) { + return 0.0; + } else if (p_stretch < 137) { + return 0.13; + } else if (p_stretch < 144) { + return 0.25; + } else if (p_stretch < 162) { + return 0.37; + } else { + return 0.5; + } +} + +Vector<String> OS_MacOS::get_system_font_path_for_text(const String &p_font_name, const String &p_text, const String &p_locale, const String &p_script, int p_weight, int p_stretch, bool p_italic) const { + Vector<String> ret; + String font_name = _get_default_fontname(p_font_name); + + CFStringRef name = CFStringCreateWithCString(kCFAllocatorDefault, font_name.utf8().get_data(), kCFStringEncodingUTF8); + CTFontSymbolicTraits traits = 0; + if (p_weight >= 700) { + traits |= kCTFontBoldTrait; + } + if (p_italic) { + traits |= kCTFontItalicTrait; + } + if (p_stretch < 100) { + traits |= kCTFontCondensedTrait; + } else if (p_stretch > 100) { + traits |= kCTFontExpandedTrait; + } + + CFNumberRef sym_traits = CFNumberCreate(kCFAllocatorDefault, kCFNumberSInt32Type, &traits); + CFMutableDictionaryRef traits_dict = CFDictionaryCreateMutable(kCFAllocatorDefault, 0, nullptr, nullptr); + CFDictionaryAddValue(traits_dict, kCTFontSymbolicTrait, sym_traits); + + CGFloat weight = _weight_to_ct(p_weight); + CFNumberRef font_weight = CFNumberCreate(kCFAllocatorDefault, kCFNumberCGFloatType, &weight); + CFDictionaryAddValue(traits_dict, kCTFontWeightTrait, font_weight); + + CGFloat stretch = _stretch_to_ct(p_stretch); + CFNumberRef font_stretch = CFNumberCreate(kCFAllocatorDefault, kCFNumberCGFloatType, &stretch); + CFDictionaryAddValue(traits_dict, kCTFontWidthTrait, font_stretch); + + CFMutableDictionaryRef attributes = CFDictionaryCreateMutable(kCFAllocatorDefault, 0, nullptr, nullptr); + CFDictionaryAddValue(attributes, kCTFontFamilyNameAttribute, name); + CFDictionaryAddValue(attributes, kCTFontTraitsAttribute, traits_dict); + + CTFontDescriptorRef font = CTFontDescriptorCreateWithAttributes(attributes); + if (font) { + CTFontRef family = CTFontCreateWithFontDescriptor(font, 0, nullptr); + CFStringRef string = CFStringCreateWithCString(kCFAllocatorDefault, p_text.utf8().get_data(), kCFStringEncodingUTF8); + CFRange range = CFRangeMake(0, CFStringGetLength(string)); + CTFontRef fallback_family = CTFontCreateForString(family, string, range); + if (fallback_family) { + CTFontDescriptorRef fallback_font = CTFontCopyFontDescriptor(fallback_family); + if (fallback_font) { + CFURLRef url = (CFURLRef)CTFontDescriptorCopyAttribute(fallback_font, kCTFontURLAttribute); + if (url) { + NSString *font_path = [NSString stringWithString:[(__bridge NSURL *)url path]]; + ret.push_back(String::utf8([font_path UTF8String])); + CFRelease(url); + } + CFRelease(fallback_font); + } + CFRelease(fallback_family); + } + CFRelease(string); + CFRelease(font); + } + + CFRelease(attributes); + CFRelease(traits_dict); + CFRelease(sym_traits); + CFRelease(font_stretch); + CFRelease(font_weight); + CFRelease(name); + + return ret; +} + +String OS_MacOS::get_system_font_path(const String &p_font_name, int p_weight, int p_stretch, bool p_italic) const { + String ret; + String font_name = _get_default_fontname(p_font_name); CFStringRef name = CFStringCreateWithCString(kCFAllocatorDefault, font_name.utf8().get_data(), kCFStringEncodingUTF8); CTFontSymbolicTraits traits = 0; - if (p_bold) { + if (p_weight > 700) { traits |= kCTFontBoldTrait; } if (p_italic) { traits |= kCTFontItalicTrait; } + if (p_stretch < 100) { + traits |= kCTFontCondensedTrait; + } else if (p_stretch > 100) { + traits |= kCTFontExpandedTrait; + } CFNumberRef sym_traits = CFNumberCreate(kCFAllocatorDefault, kCFNumberSInt32Type, &traits); CFMutableDictionaryRef traits_dict = CFDictionaryCreateMutable(kCFAllocatorDefault, 0, nullptr, nullptr); CFDictionaryAddValue(traits_dict, kCTFontSymbolicTrait, sym_traits); + CGFloat weight = _weight_to_ct(p_weight); + CFNumberRef font_weight = CFNumberCreate(kCFAllocatorDefault, kCFNumberCGFloatType, &weight); + CFDictionaryAddValue(traits_dict, kCTFontWeightTrait, font_weight); + + CGFloat stretch = _stretch_to_ct(p_stretch); + CFNumberRef font_stretch = CFNumberCreate(kCFAllocatorDefault, kCFNumberCGFloatType, &stretch); + CFDictionaryAddValue(traits_dict, kCTFontWidthTrait, font_stretch); + CFMutableDictionaryRef attributes = CFDictionaryCreateMutable(kCFAllocatorDefault, 0, nullptr, nullptr); CFDictionaryAddValue(attributes, kCTFontFamilyNameAttribute, name); CFDictionaryAddValue(attributes, kCTFontTraitsAttribute, traits_dict); @@ -384,6 +514,8 @@ String OS_MacOS::get_system_font_path(const String &p_font_name, bool p_bold, bo CFRelease(attributes); CFRelease(traits_dict); CFRelease(sym_traits); + CFRelease(font_stretch); + CFRelease(font_weight); CFRelease(name); return ret; diff --git a/platform/web/SCsub b/platform/web/SCsub index 077024507a..e44e59bfb9 100644 --- a/platform/web/SCsub +++ b/platform/web/SCsub @@ -38,15 +38,20 @@ sys_env.AddJSLibraries( "js/libs/library_godot_webgl2.js", ] ) +sys_env.AddJSExterns( + [ + "js/libs/library_godot_webgl2.externs.js", + ] +) if env["javascript_eval"]: sys_env.AddJSLibraries(["js/libs/library_godot_javascript_singleton.js"]) for lib in sys_env["JS_LIBS"]: sys_env.Append(LINKFLAGS=["--js-library", lib.abspath]) -for js in env["JS_PRE"]: +for js in sys_env["JS_PRE"]: sys_env.Append(LINKFLAGS=["--pre-js", js.abspath]) -for ext in env["JS_EXTERNS"]: +for ext in sys_env["JS_EXTERNS"]: sys_env["ENV"]["EMCC_CLOSURE_ARGS"] += " --externs " + ext.abspath build = [] diff --git a/platform/web/js/engine/features.js b/platform/web/js/engine/features.js index f91a4eff81..b7c6c9d445 100644 --- a/platform/web/js/engine/features.js +++ b/platform/web/js/engine/features.js @@ -76,19 +76,19 @@ const Features = { // eslint-disable-line no-unused-vars getMissingFeatures: function () { const missing = []; if (!Features.isWebGLAvailable(2)) { - missing.push('WebGL2'); + missing.push('WebGL2 - Check web browser configuration and hardware support'); } if (!Features.isFetchAvailable()) { - missing.push('Fetch'); + missing.push('Fetch - Check web browser version'); } if (!Features.isSecureContext()) { - missing.push('Secure Context'); + missing.push('Secure Context - Check web server configuration (use HTTPS)'); } if (!Features.isCrossOriginIsolated()) { - missing.push('Cross Origin Isolation'); + missing.push('Cross Origin Isolation - Check web server configuration (send correct headers)'); } if (!Features.isSharedArrayBufferAvailable()) { - missing.push('SharedArrayBuffer'); + missing.push('SharedArrayBuffer - Check web server configuration (send correct headers)'); } // Audio is normally optional since we have a dummy fallback. return missing; diff --git a/platform/web/js/libs/library_godot_webgl2.externs.js b/platform/web/js/libs/library_godot_webgl2.externs.js new file mode 100644 index 0000000000..18d8d0815a --- /dev/null +++ b/platform/web/js/libs/library_godot_webgl2.externs.js @@ -0,0 +1,36 @@ + +/** + * @constructor OVR_multiview2 + */ +function OVR_multiview2() {} + +/** + * @type {number} + */ +OVR_multiview2.prototype.FRAMEBUFFER_ATTACHMENT_TEXTURE_NUM_VIEWS_OVR; + +/** + * @type {number} + */ +OVR_multiview2.prototype.FRAMEBUFFER_ATTACHMENT_TEXTURE_BASE_VIEW_INDEX_OVR; + +/** + * @type {number} + */ +OVR_multiview2.prototype.MAX_VIEWS_OVR; + +/** + * @type {number} + */ +OVR_multiview2.prototype.FRAMEBUFFER_INCOMPLETE_VIEW_TARGETS_OVR; + +/** + * @param {number} target + * @param {number} attachment + * @param {WebGLTexture} texture + * @param {number} level + * @param {number} baseViewIndex + * @param {number} numViews + * @return {void} + */ +OVR_multiview2.prototype.framebufferTextureMultiviewOVR = function(target, attachment, texture, level, baseViewIndex, numViews) {}; diff --git a/platform/web/js/libs/library_godot_webgl2.js b/platform/web/js/libs/library_godot_webgl2.js index 365f712be7..ba990b3ee0 100644 --- a/platform/web/js/libs/library_godot_webgl2.js +++ b/platform/web/js/libs/library_godot_webgl2.js @@ -37,14 +37,15 @@ const GodotWebGL2 = { godot_webgl2_glFramebufferTextureMultiviewOVR: function (target, attachment, texture, level, base_view_index, num_views) { const context = GL.currentContext; if (typeof context.multiviewExt === 'undefined') { - const ext = context.GLctx.getExtension('OVR_multiview2'); + const /** OVR_multiview2 */ ext = context.GLctx.getExtension('OVR_multiview2'); if (!ext) { console.error('Trying to call glFramebufferTextureMultiviewOVR() without the OVR_multiview2 extension'); return; } context.multiviewExt = ext; } - context.multiviewExt.framebufferTextureMultiviewOVR(target, attachment, GL.textures[texture], level, base_view_index, num_views); + const /** OVR_multiview2 */ ext = context.multiviewExt; + ext.framebufferTextureMultiviewOVR(target, attachment, GL.textures[texture], level, base_view_index, num_views); }, }; diff --git a/platform/windows/crash_handler_windows.cpp b/platform/windows/crash_handler_windows.cpp index b501ee78db..7ba66750cf 100644 --- a/platform/windows/crash_handler_windows.cpp +++ b/platform/windows/crash_handler_windows.cpp @@ -157,7 +157,7 @@ DWORD CrashHandlerException(EXCEPTION_POINTERS *ep) { return EXCEPTION_CONTINUE_SEARCH; } - SymSetOptions(SymGetOptions() | SYMOPT_LOAD_LINES | SYMOPT_UNDNAME); + SymSetOptions(SymGetOptions() | SYMOPT_LOAD_LINES | SYMOPT_UNDNAME | SYMOPT_EXACT_SYMBOLS); EnumProcessModules(process, &module_handles[0], module_handles.size() * sizeof(HMODULE), &cbNeeded); module_handles.resize(cbNeeded / sizeof(HMODULE)); EnumProcessModules(process, &module_handles[0], module_handles.size() * sizeof(HMODULE), &cbNeeded); diff --git a/platform/windows/detect.py b/platform/windows/detect.py index 705e83dace..1b55574b19 100644 --- a/platform/windows/detect.py +++ b/platform/windows/detect.py @@ -188,6 +188,7 @@ def get_opts(): BoolVariable("use_llvm", "Use the LLVM compiler", False), BoolVariable("use_static_cpp", "Link MinGW/MSVC C++ runtime libraries statically", True), BoolVariable("use_asan", "Use address sanitizer (ASAN)", False), + BoolVariable("debug_crt", "Compile with MSVC's debug CRT (/MDd)", False), ] @@ -339,10 +340,14 @@ def configure_msvc(env, vcvars_msvc_config): ## Compile/link flags - if env["use_static_cpp"]: - env.AppendUnique(CCFLAGS=["/MT"]) + if env["debug_crt"]: + # Always use dynamic runtime, static debug CRT breaks thread_local. + env.AppendUnique(CCFLAGS=["/MDd"]) else: - env.AppendUnique(CCFLAGS=["/MD"]) + if env["use_static_cpp"]: + env.AppendUnique(CCFLAGS=["/MT"]) + else: + env.AppendUnique(CCFLAGS=["/MD"]) if env["arch"] == "x86_32": env["x86_libtheora_opt_vc"] = True diff --git a/platform/windows/display_server_windows.cpp b/platform/windows/display_server_windows.cpp index 0b878feb7f..c704a26b7a 100644 --- a/platform/windows/display_server_windows.cpp +++ b/platform/windows/display_server_windows.cpp @@ -2910,11 +2910,10 @@ LRESULT DisplayServerWindows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA old_x = mm->get_position().x; old_y = mm->get_position().y; - if (!windows[receiving_window_id].window_has_focus) { - // In case of unfocused Popups, adjust event position. - Point2i pos = mm->get_position() - window_get_position(receiving_window_id) + window_get_position(window_id); - mm->set_position(pos); - mm->set_global_position(pos); + if (receiving_window_id != window_id) { + // Adjust event position relative to window distance when event is sent to a different window. + mm->set_position(mm->get_position() - window_get_position(receiving_window_id) + window_get_position(window_id)); + mm->set_global_position(mm->get_position()); } Input::get_singleton()->parse_input_event(mm); @@ -3919,6 +3918,8 @@ DisplayServerWindows::DisplayServerWindows(const String &p_rendering_driver, Win WindowID main_window = _create_window(p_mode, p_vsync_mode, 0, Rect2i(window_position, p_resolution)); ERR_FAIL_COND_MSG(main_window == INVALID_WINDOW_ID, "Failed to create main window."); + joypad = new JoypadWindows(&windows[MAIN_WINDOW_ID].hWnd); + for (int i = 0; i < WINDOW_FLAG_MAX; i++) { if (p_flags & (1 << i)) { window_set_flag(WindowFlags(i), true, main_window); @@ -3958,8 +3959,6 @@ DisplayServerWindows::DisplayServerWindows(const String &p_rendering_driver, Win _update_real_mouse_position(MAIN_WINDOW_ID); - joypad = new JoypadWindows(&windows[MAIN_WINDOW_ID].hWnd); - r_error = OK; static_cast<OS_Windows *>(OS::get_singleton())->set_main_window(windows[MAIN_WINDOW_ID].hWnd); diff --git a/platform/windows/godot.ico b/platform/windows/godot.ico Binary files differindex 25830ffdc6..f0bb68225d 100644 --- a/platform/windows/godot.ico +++ b/platform/windows/godot.ico diff --git a/platform/windows/godot_console.ico b/platform/windows/godot_console.ico Binary files differnew file mode 100644 index 0000000000..1d27e3d6ae --- /dev/null +++ b/platform/windows/godot_console.ico diff --git a/platform/windows/godot_res_wrap.rc b/platform/windows/godot_res_wrap.rc index 9877ff6075..9dd29afe51 100644 --- a/platform/windows/godot_res_wrap.rc +++ b/platform/windows/godot_res_wrap.rc @@ -4,7 +4,7 @@ #define _MKSTR(m_x) _STR(m_x) #endif -GODOT_ICON ICON platform/windows/godot.ico +GODOT_ICON ICON platform/windows/godot_console.ico 1 VERSIONINFO FILEVERSION VERSION_MAJOR,VERSION_MINOR,VERSION_PATCH,0 diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp index d8548eb545..e957a25e87 100644 --- a/platform/windows/os_windows.cpp +++ b/platform/windows/os_windows.cpp @@ -43,12 +43,12 @@ #include "platform/windows/display_server_windows.h" #include "servers/audio_server.h" #include "servers/rendering/rendering_server_default.h" +#include "servers/text_server.h" #include "windows_terminal_logger.h" #include <avrt.h> #include <bcrypt.h> #include <direct.h> -#include <dwrite.h> #include <knownfolders.h> #include <process.h> #include <regstr.h> @@ -189,6 +189,27 @@ void OS_Windows::initialize() { IPUnix::make_default(); main_loop = nullptr; + + CoInitialize(nullptr); + HRESULT hr = DWriteCreateFactory(DWRITE_FACTORY_TYPE_SHARED, __uuidof(IDWriteFactory), reinterpret_cast<IUnknown **>(&dwrite_factory)); + if (SUCCEEDED(hr)) { + hr = dwrite_factory->GetSystemFontCollection(&font_collection, false); + if (SUCCEEDED(hr)) { + dwrite_init = true; + hr = dwrite_factory->QueryInterface(&dwrite_factory2); + if (SUCCEEDED(hr)) { + hr = dwrite_factory2->GetSystemFontFallback(&system_font_fallback); + if (SUCCEEDED(hr)) { + dwrite2_init = true; + } + } + } + } + if (!dwrite_init) { + print_verbose("Unable to load IDWriteFactory, system font support is disabled."); + } else if (!dwrite2_init) { + print_verbose("Unable to load IDWriteFactory2, automatic system font fallback is disabled."); + } } void OS_Windows::delete_main_loop() { @@ -203,6 +224,22 @@ void OS_Windows::set_main_loop(MainLoop *p_main_loop) { } void OS_Windows::finalize() { + if (dwrite_factory2) { + dwrite_factory2->Release(); + dwrite_factory2 = nullptr; + } + if (font_collection) { + font_collection->Release(); + font_collection = nullptr; + } + if (system_font_fallback) { + system_font_fallback->Release(); + system_font_fallback = nullptr; + } + if (dwrite_factory) { + dwrite_factory->Release(); + dwrite_factory = nullptr; + } #ifdef WINMIDI_ENABLED driver_midi.close(); #endif @@ -726,21 +763,17 @@ Error OS_Windows::set_cwd(const String &p_cwd) { } Vector<String> OS_Windows::get_system_fonts() const { + if (!dwrite_init) { + return Vector<String>(); + } + Vector<String> ret; HashSet<String> font_names; - ComAutoreleaseRef<IDWriteFactory> dwrite_factory; - HRESULT hr = DWriteCreateFactory(DWRITE_FACTORY_TYPE_SHARED, __uuidof(IDWriteFactory), reinterpret_cast<IUnknown **>(&dwrite_factory.reference)); - ERR_FAIL_COND_V(FAILED(hr) || dwrite_factory.is_null(), ret); - - ComAutoreleaseRef<IDWriteFontCollection> font_collection; - hr = dwrite_factory->GetSystemFontCollection(&font_collection.reference, false); - ERR_FAIL_COND_V(FAILED(hr) || font_collection.is_null(), ret); - UINT32 family_count = font_collection->GetFontFamilyCount(); for (UINT32 i = 0; i < family_count; i++) { ComAutoreleaseRef<IDWriteFontFamily> family; - hr = font_collection->GetFontFamily(i, &family.reference); + HRESULT hr = font_collection->GetFontFamily(i, &family.reference); ERR_CONTINUE(FAILED(hr) || family.is_null()); ComAutoreleaseRef<IDWriteLocalizedStrings> family_names; @@ -771,7 +804,98 @@ Vector<String> OS_Windows::get_system_fonts() const { return ret; } -String OS_Windows::get_system_font_path(const String &p_font_name, bool p_bold, bool p_italic) const { +#if defined(__GNUC__) && !defined(__clang__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wnon-virtual-dtor" +#endif + +class FallbackTextAnalysisSource : public IDWriteTextAnalysisSource { + LONG _cRef = 1; + + bool rtl = false; + Char16String string; + Char16String locale; + IDWriteNumberSubstitution *n_sub = nullptr; + +public: + HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, VOID **ppvInterface) { + if (IID_IUnknown == riid) { + AddRef(); + *ppvInterface = (IUnknown *)this; + } else if (__uuidof(IMMNotificationClient) == riid) { + AddRef(); + *ppvInterface = (IMMNotificationClient *)this; + } else { + *ppvInterface = nullptr; + return E_NOINTERFACE; + } + return S_OK; + } + + ULONG STDMETHODCALLTYPE AddRef() { + return InterlockedIncrement(&_cRef); + } + + ULONG STDMETHODCALLTYPE Release() { + ULONG ulRef = InterlockedDecrement(&_cRef); + if (0 == ulRef) { + delete this; + } + return ulRef; + } + + HRESULT STDMETHODCALLTYPE GetTextAtPosition(UINT32 p_text_position, WCHAR const **r_text_string, UINT32 *r_text_length) override { + if (p_text_position >= (UINT32)string.length()) { + *r_text_string = nullptr; + *r_text_length = 0; + return S_OK; + } + *r_text_string = reinterpret_cast<const wchar_t *>(string.get_data()) + p_text_position; + *r_text_length = string.length() - p_text_position; + return S_OK; + } + + HRESULT STDMETHODCALLTYPE GetTextBeforePosition(UINT32 p_text_position, WCHAR const **r_text_string, UINT32 *r_text_length) override { + if (p_text_position < 1 || p_text_position >= (UINT32)string.length()) { + *r_text_string = nullptr; + *r_text_length = 0; + return S_OK; + } + *r_text_string = reinterpret_cast<const wchar_t *>(string.get_data()); + *r_text_length = p_text_position; + return S_OK; + } + + DWRITE_READING_DIRECTION STDMETHODCALLTYPE GetParagraphReadingDirection() override { + return (rtl) ? DWRITE_READING_DIRECTION_RIGHT_TO_LEFT : DWRITE_READING_DIRECTION_LEFT_TO_RIGHT; + } + + HRESULT STDMETHODCALLTYPE GetLocaleName(UINT32 p_text_position, UINT32 *r_text_length, WCHAR const **r_locale_name) override { + *r_locale_name = reinterpret_cast<const wchar_t *>(locale.get_data()); + return S_OK; + } + + HRESULT STDMETHODCALLTYPE GetNumberSubstitution(UINT32 p_text_position, UINT32 *r_text_length, IDWriteNumberSubstitution **r_number_substitution) override { + *r_number_substitution = n_sub; + return S_OK; + } + + FallbackTextAnalysisSource(const Char16String &p_text, const Char16String &p_locale, bool p_rtl, IDWriteNumberSubstitution *p_nsub) { + _cRef = 1; + string = p_text; + locale = p_locale; + n_sub = p_nsub; + rtl = p_rtl; + }; + + virtual ~FallbackTextAnalysisSource() {} +}; + +#if defined(__GNUC__) && !defined(__clang__) +#pragma GCC diagnostic pop +#endif + +String OS_Windows::_get_default_fontname(const String &p_font_name) const { String font_name = p_font_name; if (font_name.to_lower() == "sans-serif") { font_name = "Arial"; @@ -784,18 +908,157 @@ String OS_Windows::get_system_font_path(const String &p_font_name, bool p_bold, } else if (font_name.to_lower() == "fantasy") { font_name = "Gabriola"; } + return font_name; +} + +DWRITE_FONT_WEIGHT OS_Windows::_weight_to_dw(int p_weight) const { + if (p_weight < 150) { + return DWRITE_FONT_WEIGHT_THIN; + } else if (p_weight < 250) { + return DWRITE_FONT_WEIGHT_EXTRA_LIGHT; + } else if (p_weight < 325) { + return DWRITE_FONT_WEIGHT_LIGHT; + } else if (p_weight < 375) { + return DWRITE_FONT_WEIGHT_SEMI_LIGHT; + } else if (p_weight < 450) { + return DWRITE_FONT_WEIGHT_NORMAL; + } else if (p_weight < 550) { + return DWRITE_FONT_WEIGHT_MEDIUM; + } else if (p_weight < 650) { + return DWRITE_FONT_WEIGHT_DEMI_BOLD; + } else if (p_weight < 750) { + return DWRITE_FONT_WEIGHT_BOLD; + } else if (p_weight < 850) { + return DWRITE_FONT_WEIGHT_EXTRA_BOLD; + } else if (p_weight < 925) { + return DWRITE_FONT_WEIGHT_BLACK; + } else { + return DWRITE_FONT_WEIGHT_EXTRA_BLACK; + } +} + +DWRITE_FONT_STRETCH OS_Windows::_stretch_to_dw(int p_stretch) const { + if (p_stretch < 56) { + return DWRITE_FONT_STRETCH_ULTRA_CONDENSED; + } else if (p_stretch < 69) { + return DWRITE_FONT_STRETCH_EXTRA_CONDENSED; + } else if (p_stretch < 81) { + return DWRITE_FONT_STRETCH_CONDENSED; + } else if (p_stretch < 93) { + return DWRITE_FONT_STRETCH_SEMI_CONDENSED; + } else if (p_stretch < 106) { + return DWRITE_FONT_STRETCH_NORMAL; + } else if (p_stretch < 137) { + return DWRITE_FONT_STRETCH_SEMI_EXPANDED; + } else if (p_stretch < 144) { + return DWRITE_FONT_STRETCH_EXPANDED; + } else if (p_stretch < 162) { + return DWRITE_FONT_STRETCH_EXTRA_EXPANDED; + } else { + return DWRITE_FONT_STRETCH_ULTRA_EXPANDED; + } +} + +Vector<String> OS_Windows::get_system_font_path_for_text(const String &p_font_name, const String &p_text, const String &p_locale, const String &p_script, int p_weight, int p_stretch, bool p_italic) const { + if (!dwrite2_init) { + return Vector<String>(); + } + + String font_name = _get_default_fontname(p_font_name); + + bool rtl = TS->is_locale_right_to_left(p_locale); + Char16String text = p_text.utf16(); + Char16String locale = p_locale.utf16(); + + ComAutoreleaseRef<IDWriteNumberSubstitution> number_substitution; + HRESULT hr = dwrite_factory->CreateNumberSubstitution(DWRITE_NUMBER_SUBSTITUTION_METHOD_NONE, reinterpret_cast<const wchar_t *>(locale.get_data()), true, &number_substitution.reference); + ERR_FAIL_COND_V(FAILED(hr) || number_substitution.is_null(), Vector<String>()); + + FallbackTextAnalysisSource fs = FallbackTextAnalysisSource(text, locale, rtl, number_substitution.reference); + UINT32 mapped_length = 0; + FLOAT scale = 0.0; + ComAutoreleaseRef<IDWriteFont> dwrite_font; + hr = system_font_fallback->MapCharacters( + &fs, + 0, + (UINT32)text.length(), + font_collection, + reinterpret_cast<const wchar_t *>(font_name.utf16().get_data()), + _weight_to_dw(p_weight), + p_italic ? DWRITE_FONT_STYLE_ITALIC : DWRITE_FONT_STYLE_NORMAL, + _stretch_to_dw(p_stretch), + &mapped_length, + &dwrite_font.reference, + &scale); + + if (FAILED(hr) || dwrite_font.is_null()) { + return Vector<String>(); + } + + ComAutoreleaseRef<IDWriteFontFace> dwrite_face; + hr = dwrite_font->CreateFontFace(&dwrite_face.reference); + if (FAILED(hr) || dwrite_face.is_null()) { + return Vector<String>(); + } + + UINT32 number_of_files = 0; + hr = dwrite_face->GetFiles(&number_of_files, nullptr); + if (FAILED(hr)) { + return Vector<String>(); + } + Vector<ComAutoreleaseRef<IDWriteFontFile>> files; + files.resize(number_of_files); + hr = dwrite_face->GetFiles(&number_of_files, (IDWriteFontFile **)files.ptrw()); + if (FAILED(hr)) { + return Vector<String>(); + } + + Vector<String> ret; + for (UINT32 i = 0; i < number_of_files; i++) { + void const *reference_key = nullptr; + UINT32 reference_key_size = 0; + ComAutoreleaseRef<IDWriteLocalFontFileLoader> loader; + + hr = files.write[i]->GetLoader((IDWriteFontFileLoader **)&loader.reference); + if (FAILED(hr) || loader.is_null()) { + continue; + } + hr = files.write[i]->GetReferenceKey(&reference_key, &reference_key_size); + if (FAILED(hr)) { + continue; + } + + WCHAR file_path[MAX_PATH]; + hr = loader->GetFilePathFromKey(reference_key, reference_key_size, &file_path[0], MAX_PATH); + if (FAILED(hr)) { + continue; + } + String fpath = String::utf16((const char16_t *)&file_path[0]); + + WIN32_FIND_DATAW d; + HANDLE fnd = FindFirstFileW((LPCWSTR)&file_path[0], &d); + if (fnd != INVALID_HANDLE_VALUE) { + String fname = String::utf16((const char16_t *)d.cFileName); + if (!fname.is_empty()) { + fpath = fpath.get_base_dir().path_join(fname); + } + FindClose(fnd); + } + ret.push_back(fpath); + } + return ret; +} - ComAutoreleaseRef<IDWriteFactory> dwrite_factory; - HRESULT hr = DWriteCreateFactory(DWRITE_FACTORY_TYPE_SHARED, __uuidof(IDWriteFactory), reinterpret_cast<IUnknown **>(&dwrite_factory.reference)); - ERR_FAIL_COND_V(FAILED(hr) || dwrite_factory.is_null(), String()); +String OS_Windows::get_system_font_path(const String &p_font_name, int p_weight, int p_stretch, bool p_italic) const { + if (!dwrite_init) { + return String(); + } - ComAutoreleaseRef<IDWriteFontCollection> font_collection; - hr = dwrite_factory->GetSystemFontCollection(&font_collection.reference, false); - ERR_FAIL_COND_V(FAILED(hr) || font_collection.is_null(), String()); + String font_name = _get_default_fontname(p_font_name); UINT32 index = 0; BOOL exists = false; - font_collection->FindFamilyName((const WCHAR *)font_name.utf16().get_data(), &index, &exists); + HRESULT hr = font_collection->FindFamilyName((const WCHAR *)font_name.utf16().get_data(), &index, &exists); if (FAILED(hr)) { return String(); } @@ -807,7 +1070,7 @@ String OS_Windows::get_system_font_path(const String &p_font_name, bool p_bold, } ComAutoreleaseRef<IDWriteFont> dwrite_font; - hr = family->GetFirstMatchingFont(p_bold ? DWRITE_FONT_WEIGHT_BOLD : DWRITE_FONT_WEIGHT_NORMAL, DWRITE_FONT_STRETCH_NORMAL, p_italic ? DWRITE_FONT_STYLE_ITALIC : DWRITE_FONT_STYLE_NORMAL, &dwrite_font.reference); + hr = family->GetFirstMatchingFont(_weight_to_dw(p_weight), _stretch_to_dw(p_stretch), p_italic ? DWRITE_FONT_STYLE_ITALIC : DWRITE_FONT_STYLE_NORMAL, &dwrite_font.reference); if (FAILED(hr) || dwrite_font.is_null()) { return String(); } @@ -1192,7 +1455,7 @@ String OS_Windows::get_unique_id() const { bool OS_Windows::_check_internal_feature_support(const String &p_feature) { if (p_feature == "system_fonts") { - return true; + return dwrite_init; } if (p_feature == "pc") { return true; diff --git a/platform/windows/os_windows.h b/platform/windows/os_windows.h index 6f89be699a..1db2b5880d 100644 --- a/platform/windows/os_windows.h +++ b/platform/windows/os_windows.h @@ -55,6 +55,8 @@ #include <stdio.h> #define WIN32_LEAN_AND_MEAN +#include <dwrite.h> +#include <dwrite_2.h> #include <windows.h> #include <windowsx.h> @@ -79,6 +81,9 @@ public: _FORCE_INLINE_ bool is_valid() const { return reference != nullptr; } _FORCE_INLINE_ bool is_null() const { return reference == nullptr; } ComAutoreleaseRef() {} + ComAutoreleaseRef(T *p_ref) { + reference = p_ref; + } ~ComAutoreleaseRef() { if (reference != nullptr) { reference->Release(); @@ -114,6 +119,18 @@ class OS_Windows : public OS { HWND main_window; + IDWriteFactory *dwrite_factory = nullptr; + IDWriteFactory2 *dwrite_factory2 = nullptr; + IDWriteFontCollection *font_collection = nullptr; + IDWriteFontFallback *system_font_fallback = nullptr; + + bool dwrite_init = false; + bool dwrite2_init = false; + + String _get_default_fontname(const String &p_font_name) const; + DWRITE_FONT_WEIGHT _weight_to_dw(int p_weight) const; + DWRITE_FONT_STRETCH _stretch_to_dw(int p_stretch) const; + // functions used by main to initialize/deinitialize the OS protected: virtual void initialize() override; @@ -172,7 +189,8 @@ public: virtual bool set_environment(const String &p_var, const String &p_value) const override; virtual Vector<String> get_system_fonts() const override; - virtual String get_system_font_path(const String &p_font_name, bool p_bold = false, bool p_italic = false) const override; + virtual String get_system_font_path(const String &p_font_name, int p_weight = 400, int p_stretch = 100, bool p_italic = false) const override; + virtual Vector<String> get_system_font_path_for_text(const String &p_font_name, const String &p_text, const String &p_locale = String(), const String &p_script = String(), int p_weight = 400, int p_stretch = 100, bool p_italic = false) const override; virtual String get_executable_path() const override; diff --git a/scene/2d/navigation_region_2d.cpp b/scene/2d/navigation_region_2d.cpp index 6e8ecb13b1..13d371042b 100644 --- a/scene/2d/navigation_region_2d.cpp +++ b/scene/2d/navigation_region_2d.cpp @@ -296,7 +296,9 @@ void NavigationPolygon::make_polygons_from_outlines() { TPPLPartition tpart; if (tpart.ConvexPartition_HM(&in_poly, &out_poly) == 0) { //failed! - ERR_PRINT("NavigationPolygon: Convex partition failed!"); + ERR_PRINT("NavigationPolygon: Convex partition failed! Failed to convert outlines to a valid NavigationMesh." + "\nNavigationPolygon outlines can not overlap vertices or edges inside same outline or with other outlines or have any intersections." + "\nAdd the outmost and largest outline first. To add holes inside this outline add the smaller outlines with opposite winding order."); return; } diff --git a/scene/2d/node_2d.cpp b/scene/2d/node_2d.cpp index 2518069b78..4788a1b813 100644 --- a/scene/2d/node_2d.cpp +++ b/scene/2d/node_2d.cpp @@ -30,6 +30,8 @@ #include "node_2d.h" +#include "scene/main/viewport.h" + #ifdef TOOLS_ENABLED Dictionary Node2D::_edit_get_state() const { Dictionary state; @@ -326,29 +328,6 @@ void Node2D::set_global_transform(const Transform2D &p_transform) { } } -void Node2D::set_z_index(int p_z) { - ERR_FAIL_COND(p_z < RS::CANVAS_ITEM_Z_MIN); - ERR_FAIL_COND(p_z > RS::CANVAS_ITEM_Z_MAX); - z_index = p_z; - RS::get_singleton()->canvas_item_set_z_index(get_canvas_item(), z_index); -} - -void Node2D::set_z_as_relative(bool p_enabled) { - if (z_relative == p_enabled) { - return; - } - z_relative = p_enabled; - RS::get_singleton()->canvas_item_set_z_as_relative_to_parent(get_canvas_item(), p_enabled); -} - -bool Node2D::is_z_relative() const { - return z_relative; -} - -int Node2D::get_z_index() const { - return z_index; -} - Transform2D Node2D::get_relative_transform_to_parent(const Node *p_parent) const { if (p_parent == this) { return Transform2D(); @@ -380,13 +359,14 @@ Point2 Node2D::to_global(Point2 p_local) const { return get_global_transform().xform(p_local); } -void Node2D::set_y_sort_enabled(bool p_enabled) { - y_sort_enabled = p_enabled; - RS::get_singleton()->canvas_item_set_sort_children_by_y(get_canvas_item(), y_sort_enabled); -} - -bool Node2D::is_y_sort_enabled() const { - return y_sort_enabled; +void Node2D::_notification(int p_notification) { + switch (p_notification) { + case NOTIFICATION_MOVED_IN_PARENT: { + if (get_viewport()) { + get_viewport()->gui_set_root_order_dirty(); + } + } break; + } } void Node2D::_bind_methods() { @@ -425,15 +405,6 @@ void Node2D::_bind_methods() { ClassDB::bind_method(D_METHOD("to_local", "global_point"), &Node2D::to_local); ClassDB::bind_method(D_METHOD("to_global", "local_point"), &Node2D::to_global); - ClassDB::bind_method(D_METHOD("set_z_index", "z_index"), &Node2D::set_z_index); - ClassDB::bind_method(D_METHOD("get_z_index"), &Node2D::get_z_index); - - ClassDB::bind_method(D_METHOD("set_z_as_relative", "enable"), &Node2D::set_z_as_relative); - ClassDB::bind_method(D_METHOD("is_z_relative"), &Node2D::is_z_relative); - - ClassDB::bind_method(D_METHOD("set_y_sort_enabled", "enabled"), &Node2D::set_y_sort_enabled); - ClassDB::bind_method(D_METHOD("is_y_sort_enabled"), &Node2D::is_y_sort_enabled); - ClassDB::bind_method(D_METHOD("get_relative_transform_to_parent", "parent"), &Node2D::get_relative_transform_to_parent); ADD_GROUP("Transform", ""); @@ -448,9 +419,4 @@ void Node2D::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "global_scale", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NONE), "set_global_scale", "get_global_scale"); ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "global_skew", PROPERTY_HINT_NONE, "radians", PROPERTY_USAGE_NONE), "set_global_skew", "get_global_skew"); ADD_PROPERTY(PropertyInfo(Variant::TRANSFORM2D, "global_transform", PROPERTY_HINT_NONE, "suffix:px", PROPERTY_USAGE_NONE), "set_global_transform", "get_global_transform"); - - ADD_GROUP("Ordering", ""); - ADD_PROPERTY(PropertyInfo(Variant::INT, "z_index", PROPERTY_HINT_RANGE, itos(RS::CANVAS_ITEM_Z_MIN) + "," + itos(RS::CANVAS_ITEM_Z_MAX) + ",1"), "set_z_index", "get_z_index"); - ADD_PROPERTY(PropertyInfo(Variant::BOOL, "z_as_relative"), "set_z_as_relative", "is_z_relative"); - ADD_PROPERTY(PropertyInfo(Variant::BOOL, "y_sort_enabled"), "set_y_sort_enabled", "is_y_sort_enabled"); } diff --git a/scene/2d/node_2d.h b/scene/2d/node_2d.h index 0d8a31e6bb..76707dc422 100644 --- a/scene/2d/node_2d.h +++ b/scene/2d/node_2d.h @@ -40,9 +40,6 @@ class Node2D : public CanvasItem { real_t rotation = 0.0; Size2 scale = Vector2(1, 1); real_t skew = 0.0; - int z_index = 0; - bool z_relative = true; - bool y_sort_enabled = false; Transform2D transform; @@ -53,6 +50,7 @@ class Node2D : public CanvasItem { void _update_xform_values(); protected: + void _notification(int p_notification); static void _bind_methods(); public: @@ -102,21 +100,12 @@ public: void set_global_skew(const real_t p_radians); void set_global_scale(const Size2 &p_scale); - void set_z_index(int p_z); - int get_z_index() const; - void look_at(const Vector2 &p_pos); real_t get_angle_to(const Vector2 &p_pos) const; Point2 to_local(Point2 p_global) const; Point2 to_global(Point2 p_local) const; - void set_z_as_relative(bool p_enabled); - bool is_z_relative() const; - - virtual void set_y_sort_enabled(bool p_enabled); - virtual bool is_y_sort_enabled() const; - Transform2D get_relative_transform_to_parent(const Node *p_parent) const; Transform2D get_transform() const override; diff --git a/scene/2d/path_2d.cpp b/scene/2d/path_2d.cpp index b5945a4562..b68a8fb031 100644 --- a/scene/2d/path_2d.cpp +++ b/scene/2d/path_2d.cpp @@ -177,7 +177,7 @@ void PathFollow2D::_update_transform() { } if (rotates) { - Transform2D xform = c->sample_baked_with_rotation(progress, cubic, loop, lookahead); + Transform2D xform = c->sample_baked_with_rotation(progress, cubic); xform.translate_local(v_offset, h_offset); set_rotation(xform[1].angle()); set_position(xform[2]); diff --git a/scene/3d/collision_object_3d.cpp b/scene/3d/collision_object_3d.cpp index ca23fe03a2..66546092f2 100644 --- a/scene/3d/collision_object_3d.cpp +++ b/scene/3d/collision_object_3d.cpp @@ -30,6 +30,7 @@ #include "collision_object_3d.h" +#include "scene/resources/shape_3d.h" #include "scene/scene_string_names.h" void CollisionObject3D::_notification(int p_what) { diff --git a/scene/3d/gpu_particles_collision_3d.cpp b/scene/3d/gpu_particles_collision_3d.cpp index 2c5df48b75..476820b1c4 100644 --- a/scene/3d/gpu_particles_collision_3d.cpp +++ b/scene/3d/gpu_particles_collision_3d.cpp @@ -347,7 +347,9 @@ void GPUParticlesCollisionSDF3D::_compute_sdf(ComputeSDFParams *params) { WorkerThreadPool::GroupID group_task = WorkerThreadPool::get_singleton()->add_template_group_task(this, &GPUParticlesCollisionSDF3D::_compute_sdf_z, params, params->size.z); while (!WorkerThreadPool::get_singleton()->is_group_task_completed(group_task)) { OS::get_singleton()->delay_usec(10000); - bake_step_function(WorkerThreadPool::get_singleton()->get_group_processed_element_count(group_task) * 100 / params->size.z, "Baking SDF"); + if (bake_step_function) { + bake_step_function(WorkerThreadPool::get_singleton()->get_group_processed_element_count(group_task) * 100 / params->size.z, "Baking SDF"); + } } WorkerThreadPool::get_singleton()->wait_for_group_task_completion(group_task); } diff --git a/scene/3d/mesh_instance_3d.cpp b/scene/3d/mesh_instance_3d.cpp index d4f60503c2..88b1c340d8 100644 --- a/scene/3d/mesh_instance_3d.cpp +++ b/scene/3d/mesh_instance_3d.cpp @@ -33,6 +33,8 @@ #include "collision_shape_3d.h" #include "core/core_string_names.h" #include "physics_body_3d.h" +#include "scene/resources/concave_polygon_shape_3d.h" +#include "scene/resources/convex_polygon_shape_3d.h" bool MeshInstance3D::_set(const StringName &p_name, const Variant &p_value) { //this is not _too_ bad performance wise, really. it only arrives here if the property was not set anywhere else. @@ -224,7 +226,7 @@ Node *MeshInstance3D::create_trimesh_collision_node() { return nullptr; } - Ref<Shape3D> shape = mesh->create_trimesh_shape(); + Ref<ConcavePolygonShape3D> shape = mesh->create_trimesh_shape(); if (shape.is_null()) { return nullptr; } @@ -254,7 +256,7 @@ Node *MeshInstance3D::create_convex_collision_node(bool p_clean, bool p_simplify return nullptr; } - Ref<Shape3D> shape = mesh->create_convex_shape(p_clean, p_simplify); + Ref<ConvexPolygonShape3D> shape = mesh->create_convex_shape(p_clean, p_simplify); if (shape.is_null()) { return nullptr; } @@ -320,6 +322,11 @@ void MeshInstance3D::_notification(int p_what) { case NOTIFICATION_ENTER_TREE: { _resolve_skeleton_path(); } break; + case NOTIFICATION_TRANSLATION_CHANGED: { + if (mesh.is_valid()) { + mesh->notification(NOTIFICATION_TRANSLATION_CHANGED); + } + } break; } } diff --git a/scene/3d/spring_arm_3d.cpp b/scene/3d/spring_arm_3d.cpp index f855fce318..6d8ce06524 100644 --- a/scene/3d/spring_arm_3d.cpp +++ b/scene/3d/spring_arm_3d.cpp @@ -31,6 +31,7 @@ #include "spring_arm_3d.h" #include "scene/3d/camera_3d.h" +#include "scene/resources/shape_3d.h" void SpringArm3D::_notification(int p_what) { switch (p_what) { diff --git a/scene/3d/xr_nodes.cpp b/scene/3d/xr_nodes.cpp index ca7d1dfc1d..05fc73306c 100644 --- a/scene/3d/xr_nodes.cpp +++ b/scene/3d/xr_nodes.cpp @@ -627,7 +627,9 @@ void XROrigin3D::set_world_scale(real_t p_world_scale) { xr_server->set_world_scale(p_world_scale); } -void XROrigin3D::set_current(bool p_enabled) { +void XROrigin3D::_set_current(bool p_enabled, bool p_update_others) { + // We run this logic even if current already equals p_enabled as we may have set this previously before we entered our tree. + // This is then called a second time on NOTIFICATION_ENTER_TREE where we actually process activating this origin node. current = p_enabled; if (!is_inside_tree() || Engine::get_singleton()->is_editor_hint()) { @@ -638,30 +640,38 @@ void XROrigin3D::set_current(bool p_enabled) { set_notify_local_transform(current); set_notify_transform(current); + // update XRServer with our current position if (current) { - for (int i = 0; i < origin_nodes.size(); i++) { - if (origin_nodes[i] != this) { - origin_nodes[i]->set_current(false); - } - } - - // update XRServer with our current position XRServer *xr_server = XRServer::get_singleton(); ERR_FAIL_NULL(xr_server); xr_server->set_world_origin(get_global_transform()); - } else { - bool found = false; - // We no longer have a current origin so find the first one we can make current - for (int i = 0; !found && i < origin_nodes.size(); i++) { - if (origin_nodes[i] != this) { - origin_nodes[i]->set_current(true); - found = true; + } + + // Check if we need to update our other origin nodes accordingly + if (p_update_others) { + if (current) { + for (int i = 0; i < origin_nodes.size(); i++) { + if (origin_nodes[i] != this && origin_nodes[i]->current) { + origin_nodes[i]->_set_current(false, false); + } + } + } else { + // We no longer have a current origin so find the first one we can make current + for (int i = 0; i < origin_nodes.size(); i++) { + if (origin_nodes[i] != this) { + origin_nodes[i]->_set_current(true, false); + return; // we are done. + } } } } } +void XROrigin3D::set_current(bool p_enabled) { + _set_current(p_enabled, true); +} + bool XROrigin3D::is_current() const { if (Engine::get_singleton()->is_editor_hint()) { // return as is diff --git a/scene/3d/xr_nodes.h b/scene/3d/xr_nodes.h index 990fb61983..ec8e151a08 100644 --- a/scene/3d/xr_nodes.h +++ b/scene/3d/xr_nodes.h @@ -183,6 +183,8 @@ private: bool current = false; static Vector<XROrigin3D *> origin_nodes; // all origin nodes in tree + void _set_current(bool p_enabled, bool p_update_others); + protected: void _notification(int p_what); static void _bind_methods(); diff --git a/scene/animation/animation_blend_space_1d.cpp b/scene/animation/animation_blend_space_1d.cpp index 3153572517..4b325ee464 100644 --- a/scene/animation/animation_blend_space_1d.cpp +++ b/scene/animation/animation_blend_space_1d.cpp @@ -230,14 +230,14 @@ void AnimationNodeBlendSpace1D::_add_blend_point(int p_index, const Ref<Animatio } } -double AnimationNodeBlendSpace1D::process(double p_time, bool p_seek, bool p_seek_root) { +double AnimationNodeBlendSpace1D::process(double p_time, bool p_seek, bool p_is_external_seeking) { if (blend_points_used == 0) { return 0.0; } if (blend_points_used == 1) { // only one point available, just play that animation - return blend_node(blend_points[0].name, blend_points[0].node, p_time, p_seek, p_seek_root, 1.0, FILTER_IGNORE, true); + return blend_node(blend_points[0].name, blend_points[0].node, p_time, p_seek, p_is_external_seeking, 1.0, FILTER_IGNORE, true); } double blend_pos = get_parameter(blend_position); @@ -307,10 +307,10 @@ double AnimationNodeBlendSpace1D::process(double p_time, bool p_seek, bool p_see for (int i = 0; i < blend_points_used; i++) { if (i == point_lower || i == point_higher) { - double remaining = blend_node(blend_points[i].name, blend_points[i].node, p_time, p_seek, p_seek_root, weights[i], FILTER_IGNORE, true); + double remaining = blend_node(blend_points[i].name, blend_points[i].node, p_time, p_seek, p_is_external_seeking, weights[i], FILTER_IGNORE, true); max_time_remaining = MAX(max_time_remaining, remaining); } else if (sync) { - blend_node(blend_points[i].name, blend_points[i].node, p_time, p_seek, p_seek_root, 0, FILTER_IGNORE, true); + blend_node(blend_points[i].name, blend_points[i].node, p_time, p_seek, p_is_external_seeking, 0, FILTER_IGNORE, true); } } diff --git a/scene/animation/animation_blend_space_1d.h b/scene/animation/animation_blend_space_1d.h index 1876ccebc7..30cfe52c8e 100644 --- a/scene/animation/animation_blend_space_1d.h +++ b/scene/animation/animation_blend_space_1d.h @@ -98,7 +98,7 @@ public: void set_use_sync(bool p_sync); bool is_using_sync() const; - double process(double p_time, bool p_seek, bool p_seek_root) override; + double process(double p_time, bool p_seek, bool p_is_external_seeking) override; String get_caption() const override; Ref<AnimationNode> get_child_by_name(const StringName &p_name) override; diff --git a/scene/animation/animation_blend_space_2d.cpp b/scene/animation/animation_blend_space_2d.cpp index b376f668ad..4e20429ac9 100644 --- a/scene/animation/animation_blend_space_2d.cpp +++ b/scene/animation/animation_blend_space_2d.cpp @@ -432,7 +432,7 @@ void AnimationNodeBlendSpace2D::_blend_triangle(const Vector2 &p_pos, const Vect r_weights[2] = w; } -double AnimationNodeBlendSpace2D::process(double p_time, bool p_seek, bool p_seek_root) { +double AnimationNodeBlendSpace2D::process(double p_time, bool p_seek, bool p_is_external_seeking) { _update_triangles(); Vector2 blend_pos = get_parameter(blend_position); @@ -502,7 +502,7 @@ double AnimationNodeBlendSpace2D::process(double p_time, bool p_seek, bool p_see for (int j = 0; j < 3; j++) { if (i == triangle_points[j]) { //blend with the given weight - double t = blend_node(blend_points[i].name, blend_points[i].node, p_time, p_seek, p_seek_root, blend_weights[j], FILTER_IGNORE, true); + double t = blend_node(blend_points[i].name, blend_points[i].node, p_time, p_seek, p_is_external_seeking, blend_weights[j], FILTER_IGNORE, true); if (first || t < mind) { mind = t; first = false; @@ -513,7 +513,7 @@ double AnimationNodeBlendSpace2D::process(double p_time, bool p_seek, bool p_see } if (sync && !found) { - blend_node(blend_points[i].name, blend_points[i].node, p_time, p_seek, p_seek_root, 0, FILTER_IGNORE, true); + blend_node(blend_points[i].name, blend_points[i].node, p_time, p_seek, p_is_external_seeking, 0, FILTER_IGNORE, true); } } } else { @@ -538,22 +538,22 @@ double AnimationNodeBlendSpace2D::process(double p_time, bool p_seek, bool p_see na_n->set_backward(na_c->is_backward()); } //see how much animation remains - from = cur_length_internal - blend_node(blend_points[cur_closest].name, blend_points[cur_closest].node, p_time, false, p_seek_root, 0.0, FILTER_IGNORE, true); + from = cur_length_internal - blend_node(blend_points[cur_closest].name, blend_points[cur_closest].node, p_time, false, p_is_external_seeking, 0.0, FILTER_IGNORE, true); } - mind = blend_node(blend_points[new_closest].name, blend_points[new_closest].node, from, true, p_seek_root, 1.0, FILTER_IGNORE, true); + mind = blend_node(blend_points[new_closest].name, blend_points[new_closest].node, from, true, p_is_external_seeking, 1.0, FILTER_IGNORE, true); cur_length_internal = from + mind; cur_closest = new_closest; } else { - mind = blend_node(blend_points[cur_closest].name, blend_points[cur_closest].node, p_time, p_seek, p_seek_root, 1.0, FILTER_IGNORE, true); + mind = blend_node(blend_points[cur_closest].name, blend_points[cur_closest].node, p_time, p_seek, p_is_external_seeking, 1.0, FILTER_IGNORE, true); } if (sync) { for (int i = 0; i < blend_points_used; i++) { if (i != cur_closest) { - blend_node(blend_points[i].name, blend_points[i].node, p_time, p_seek, p_seek_root, 0, FILTER_IGNORE, true); + blend_node(blend_points[i].name, blend_points[i].node, p_time, p_seek, p_is_external_seeking, 0, FILTER_IGNORE, true); } } } diff --git a/scene/animation/animation_blend_space_2d.h b/scene/animation/animation_blend_space_2d.h index 250189f202..41854f73a4 100644 --- a/scene/animation/animation_blend_space_2d.h +++ b/scene/animation/animation_blend_space_2d.h @@ -128,7 +128,7 @@ public: void set_y_label(const String &p_label); String get_y_label() const; - virtual double process(double p_time, bool p_seek, bool p_seek_root) override; + virtual double process(double p_time, bool p_seek, bool p_is_external_seeking) override; virtual String get_caption() const override; Vector2 get_closest_point(const Vector2 &p_point); diff --git a/scene/animation/animation_blend_tree.cpp b/scene/animation/animation_blend_tree.cpp index 846c102e3f..6200062f60 100644 --- a/scene/animation/animation_blend_tree.cpp +++ b/scene/animation/animation_blend_tree.cpp @@ -64,7 +64,7 @@ void AnimationNodeAnimation::_validate_property(PropertyInfo &p_property) const } } -double AnimationNodeAnimation::process(double p_time, bool p_seek, bool p_seek_root) { +double AnimationNodeAnimation::process(double p_time, bool p_seek, bool p_is_external_seeking) { AnimationPlayer *ap = state->player; ERR_FAIL_COND_V(!ap, 0); @@ -87,40 +87,43 @@ double AnimationNodeAnimation::process(double p_time, bool p_seek, bool p_seek_r double anim_size = (double)anim->get_length(); double step = 0.0; double prev_time = cur_time; - int pingponged = 0; - bool current_backward = signbit(p_time); + Animation::LoopedFlag looped_flag = Animation::LOOPED_FLAG_NONE; + bool node_backward = play_mode == PLAY_MODE_BACKWARD; if (p_seek) { step = p_time - cur_time; cur_time = p_time; } else { p_time *= backward ? -1.0 : 1.0; - if (!(cur_time == anim_size && !current_backward) && !(cur_time == 0 && current_backward)) { - cur_time = cur_time + p_time; - step = p_time; - } + cur_time = cur_time + p_time; + step = p_time; } if (anim->get_loop_mode() == Animation::LOOP_PINGPONG) { if (!Math::is_zero_approx(anim_size)) { - if ((int)Math::floor(abs(cur_time - prev_time) / anim_size) % 2 == 0) { - if (prev_time >= 0 && cur_time < 0) { - backward = !backward; - pingponged = -1; - } - if (prev_time <= anim_size && cur_time > anim_size) { - backward = !backward; - pingponged = 1; - } + if (prev_time >= 0 && cur_time < 0) { + backward = !backward; + looped_flag = node_backward ? Animation::LOOPED_FLAG_END : Animation::LOOPED_FLAG_START; + } + if (prev_time <= anim_size && cur_time > anim_size) { + backward = !backward; + looped_flag = node_backward ? Animation::LOOPED_FLAG_START : Animation::LOOPED_FLAG_END; } cur_time = Math::pingpong(cur_time, anim_size); } - } else { - if (anim->get_loop_mode() == Animation::LOOP_LINEAR) { - if (!Math::is_zero_approx(anim_size)) { - cur_time = Math::fposmod(cur_time, anim_size); + } else if (anim->get_loop_mode() == Animation::LOOP_LINEAR) { + if (!Math::is_zero_approx(anim_size)) { + if (prev_time >= 0 && cur_time < 0) { + looped_flag = node_backward ? Animation::LOOPED_FLAG_END : Animation::LOOPED_FLAG_START; + } + if (prev_time <= anim_size && cur_time > anim_size) { + looped_flag = node_backward ? Animation::LOOPED_FLAG_START : Animation::LOOPED_FLAG_END; } - } else if (cur_time < 0) { + cur_time = Math::fposmod(cur_time, anim_size); + } + backward = false; + } else { + if (cur_time < 0) { step += cur_time; cur_time = 0; } else if (cur_time > anim_size) { @@ -128,12 +131,25 @@ double AnimationNodeAnimation::process(double p_time, bool p_seek, bool p_seek_r cur_time = anim_size; } backward = false; + + // If ended, don't progress animation. So set delta to 0. + if (p_time > 0) { + if (play_mode == PLAY_MODE_FORWARD) { + if (prev_time >= anim_size) { + step = 0; + } + } else { + if (prev_time <= 0) { + step = 0; + } + } + } } if (play_mode == PLAY_MODE_FORWARD) { - blend_animation(animation, cur_time, step, p_seek, p_seek_root, 1.0, pingponged); + blend_animation(animation, cur_time, step, p_seek, p_is_external_seeking, 1.0, looped_flag); } else { - blend_animation(animation, anim_size - cur_time, -step, p_seek, p_seek_root, 1.0, pingponged); + blend_animation(animation, anim_size - cur_time, -step, p_seek, p_is_external_seeking, 1.0, looped_flag); } set_parameter(time, cur_time); @@ -273,7 +289,7 @@ bool AnimationNodeOneShot::has_filter() const { return true; } -double AnimationNodeOneShot::process(double p_time, bool p_seek, bool p_seek_root) { +double AnimationNodeOneShot::process(double p_time, bool p_seek, bool p_is_external_seeking) { bool cur_active = get_parameter(active); bool cur_prev_active = get_parameter(prev_active); double cur_time = get_parameter(time); @@ -295,9 +311,7 @@ double AnimationNodeOneShot::process(double p_time, bool p_seek, bool p_seek_roo set_parameter(time_to_restart, cur_time_to_restart); } - if (!cur_active) { - return blend_input(0, p_time, p_seek, p_seek_root, 1.0, FILTER_IGNORE, sync); - } + return blend_input(0, p_time, p_seek, p_is_external_seeking, 1.0, FILTER_IGNORE, sync); } bool os_seek = p_seek; @@ -333,12 +347,11 @@ double AnimationNodeOneShot::process(double p_time, bool p_seek, bool p_seek_roo double main_rem; if (mix == MIX_MODE_ADD) { - main_rem = blend_input(0, p_time, p_seek, p_seek_root, 1.0, FILTER_IGNORE, sync); + main_rem = blend_input(0, p_time, p_seek, p_is_external_seeking, 1.0, FILTER_IGNORE, sync); } else { - main_rem = blend_input(0, p_time, p_seek, p_seek_root, 1.0 - blend, FILTER_BLEND, sync); + main_rem = blend_input(0, p_time, p_seek, p_is_external_seeking, 1.0 - blend, FILTER_BLEND, sync); // Unlike below, processing this edge is a corner case. } - - double os_rem = blend_input(1, os_seek ? cur_time : p_time, os_seek, p_seek_root, blend, FILTER_PASS, true); + double os_rem = blend_input(1, os_seek ? cur_time : p_time, os_seek, p_is_external_seeking, MAX(CMP_EPSILON, blend), FILTER_PASS, true); // Blend values must be more than CMP_EPSILON to process discrete keys in edge. if (do_start) { cur_remaining = os_rem; @@ -420,10 +433,10 @@ bool AnimationNodeAdd2::has_filter() const { return true; } -double AnimationNodeAdd2::process(double p_time, bool p_seek, bool p_seek_root) { +double AnimationNodeAdd2::process(double p_time, bool p_seek, bool p_is_external_seeking) { double amount = get_parameter(add_amount); - double rem0 = blend_input(0, p_time, p_seek, p_seek_root, 1.0, FILTER_IGNORE, sync); - blend_input(1, p_time, p_seek, p_seek_root, amount, FILTER_PASS, sync); + double rem0 = blend_input(0, p_time, p_seek, p_is_external_seeking, 1.0, FILTER_IGNORE, sync); + blend_input(1, p_time, p_seek, p_is_external_seeking, amount, FILTER_PASS, sync); return rem0; } @@ -454,11 +467,11 @@ bool AnimationNodeAdd3::has_filter() const { return true; } -double AnimationNodeAdd3::process(double p_time, bool p_seek, bool p_seek_root) { +double AnimationNodeAdd3::process(double p_time, bool p_seek, bool p_is_external_seeking) { double amount = get_parameter(add_amount); - blend_input(0, p_time, p_seek, p_seek_root, MAX(0, -amount), FILTER_PASS, sync); - double rem0 = blend_input(1, p_time, p_seek, p_seek_root, 1.0, FILTER_IGNORE, sync); - blend_input(2, p_time, p_seek, p_seek_root, MAX(0, amount), FILTER_PASS, sync); + blend_input(0, p_time, p_seek, p_is_external_seeking, MAX(0, -amount), FILTER_PASS, sync); + double rem0 = blend_input(1, p_time, p_seek, p_is_external_seeking, 1.0, FILTER_IGNORE, sync); + blend_input(2, p_time, p_seek, p_is_external_seeking, MAX(0, amount), FILTER_PASS, sync); return rem0; } @@ -486,11 +499,11 @@ String AnimationNodeBlend2::get_caption() const { return "Blend2"; } -double AnimationNodeBlend2::process(double p_time, bool p_seek, bool p_seek_root) { +double AnimationNodeBlend2::process(double p_time, bool p_seek, bool p_is_external_seeking) { double amount = get_parameter(blend_amount); - double rem0 = blend_input(0, p_time, p_seek, p_seek_root, 1.0 - amount, FILTER_BLEND, sync); - double rem1 = blend_input(1, p_time, p_seek, p_seek_root, amount, FILTER_PASS, sync); + double rem0 = blend_input(0, p_time, p_seek, p_is_external_seeking, 1.0 - amount, FILTER_BLEND, sync); + double rem1 = blend_input(1, p_time, p_seek, p_is_external_seeking, amount, FILTER_PASS, sync); return amount > 0.5 ? rem1 : rem0; //hacky but good enough } @@ -521,11 +534,11 @@ String AnimationNodeBlend3::get_caption() const { return "Blend3"; } -double AnimationNodeBlend3::process(double p_time, bool p_seek, bool p_seek_root) { +double AnimationNodeBlend3::process(double p_time, bool p_seek, bool p_is_external_seeking) { double amount = get_parameter(blend_amount); - double rem0 = blend_input(0, p_time, p_seek, p_seek_root, MAX(0, -amount), FILTER_IGNORE, sync); - double rem1 = blend_input(1, p_time, p_seek, p_seek_root, 1.0 - ABS(amount), FILTER_IGNORE, sync); - double rem2 = blend_input(2, p_time, p_seek, p_seek_root, MAX(0, amount), FILTER_IGNORE, sync); + double rem0 = blend_input(0, p_time, p_seek, p_is_external_seeking, MAX(0, -amount), FILTER_IGNORE, sync); + double rem1 = blend_input(1, p_time, p_seek, p_is_external_seeking, 1.0 - ABS(amount), FILTER_IGNORE, sync); + double rem2 = blend_input(2, p_time, p_seek, p_is_external_seeking, MAX(0, amount), FILTER_IGNORE, sync); return amount > 0.5 ? rem2 : (amount < -0.5 ? rem0 : rem1); //hacky but good enough } @@ -553,12 +566,12 @@ String AnimationNodeTimeScale::get_caption() const { return "TimeScale"; } -double AnimationNodeTimeScale::process(double p_time, bool p_seek, bool p_seek_root) { +double AnimationNodeTimeScale::process(double p_time, bool p_seek, bool p_is_external_seeking) { double cur_scale = get_parameter(scale); if (p_seek) { - return blend_input(0, p_time, true, p_seek_root, 1.0, FILTER_IGNORE, true); + return blend_input(0, p_time, true, p_is_external_seeking, 1.0, FILTER_IGNORE, true); } else { - return blend_input(0, p_time * cur_scale, false, p_seek_root, 1.0, FILTER_IGNORE, true); + return blend_input(0, p_time * cur_scale, false, p_is_external_seeking, 1.0, FILTER_IGNORE, true); } } @@ -583,16 +596,16 @@ String AnimationNodeTimeSeek::get_caption() const { return "Seek"; } -double AnimationNodeTimeSeek::process(double p_time, bool p_seek, bool p_seek_root) { +double AnimationNodeTimeSeek::process(double p_time, bool p_seek, bool p_is_external_seeking) { double cur_seek_pos = get_parameter(seek_pos); if (p_seek) { - return blend_input(0, p_time, true, p_seek_root, 1.0, FILTER_IGNORE, true); + return blend_input(0, p_time, true, p_is_external_seeking, 1.0, FILTER_IGNORE, true); } else if (cur_seek_pos >= 0) { double ret = blend_input(0, cur_seek_pos, true, true, 1.0, FILTER_IGNORE, true); set_parameter(seek_pos, -1.0); //reset return ret; } else { - return blend_input(0, p_time, false, p_seek_root, 1.0, FILTER_IGNORE, true); + return blend_input(0, p_time, false, p_is_external_seeking, 1.0, FILTER_IGNORE, true); } } @@ -700,7 +713,7 @@ bool AnimationNodeTransition::is_from_start() const { return from_start; } -double AnimationNodeTransition::process(double p_time, bool p_seek, bool p_seek_root) { +double AnimationNodeTransition::process(double p_time, bool p_seek, bool p_is_external_seeking) { int cur_current = get_parameter(current); int cur_prev = get_parameter(prev); int cur_prev_current = get_parameter(prev_current); @@ -729,14 +742,14 @@ double AnimationNodeTransition::process(double p_time, bool p_seek, bool p_seek_ if (sync) { for (int i = 0; i < enabled_inputs; i++) { if (i != cur_current && i != cur_prev) { - blend_input(i, p_time, p_seek, p_seek_root, 0, FILTER_IGNORE, true); + blend_input(i, p_time, p_seek, p_is_external_seeking, 0, FILTER_IGNORE, true); } } } if (cur_prev < 0) { // process current animation, check for transition - rem = blend_input(cur_current, p_time, p_seek, p_seek_root, 1.0, FILTER_IGNORE, true); + rem = blend_input(cur_current, p_time, p_seek, p_is_external_seeking, 1.0, FILTER_IGNORE, true); if (p_seek) { cur_time = p_time; @@ -755,18 +768,18 @@ double AnimationNodeTransition::process(double p_time, bool p_seek, bool p_seek_ blend = xfade_curve->sample(blend); } + // Blend values must be more than CMP_EPSILON to process discrete keys in edge. if (from_start && !p_seek && switched) { //just switched, seek to start of current - - rem = blend_input(cur_current, 0, true, p_seek_root, 1.0 - blend, FILTER_IGNORE, true); + rem = blend_input(cur_current, 0, true, p_is_external_seeking, MAX(CMP_EPSILON, 1.0 - blend), FILTER_IGNORE, true); } else { - rem = blend_input(cur_current, p_time, p_seek, p_seek_root, 1.0 - blend, FILTER_IGNORE, true); + rem = blend_input(cur_current, p_time, p_seek, p_is_external_seeking, MAX(CMP_EPSILON, 1.0 - blend), FILTER_IGNORE, true); } if (p_seek) { - blend_input(cur_prev, p_time, true, p_seek_root, blend, FILTER_IGNORE, true); + blend_input(cur_prev, p_time, true, p_is_external_seeking, MAX(CMP_EPSILON, blend), FILTER_IGNORE, true); cur_time = p_time; } else { - blend_input(cur_prev, p_time, false, p_seek_root, blend, FILTER_IGNORE, true); + blend_input(cur_prev, p_time, false, p_is_external_seeking, MAX(CMP_EPSILON, blend), FILTER_IGNORE, true); cur_time += p_time; cur_prev_xfading -= p_time; if (cur_prev_xfading < 0) { @@ -835,8 +848,8 @@ String AnimationNodeOutput::get_caption() const { return "Output"; } -double AnimationNodeOutput::process(double p_time, bool p_seek, bool p_seek_root) { - return blend_input(0, p_time, p_seek, p_seek_root, 1.0, FILTER_IGNORE, true); +double AnimationNodeOutput::process(double p_time, bool p_seek, bool p_is_external_seeking) { + return blend_input(0, p_time, p_seek, p_is_external_seeking, 1.0, FILTER_IGNORE, true); } AnimationNodeOutput::AnimationNodeOutput() { @@ -1048,9 +1061,9 @@ String AnimationNodeBlendTree::get_caption() const { return "BlendTree"; } -double AnimationNodeBlendTree::process(double p_time, bool p_seek, bool p_seek_root) { +double AnimationNodeBlendTree::process(double p_time, bool p_seek, bool p_is_external_seeking) { Ref<AnimationNodeOutput> output = nodes[SceneStringNames::get_singleton()->output].node; - return _blend_node("output", nodes[SceneStringNames::get_singleton()->output].connections, this, output, p_time, p_seek, p_seek_root, 1.0, FILTER_IGNORE, true); + return _blend_node("output", nodes[SceneStringNames::get_singleton()->output].connections, this, output, p_time, p_seek, p_is_external_seeking, 1.0, FILTER_IGNORE, true); } void AnimationNodeBlendTree::get_node_list(List<StringName> *r_list) { diff --git a/scene/animation/animation_blend_tree.h b/scene/animation/animation_blend_tree.h index 1c31718259..52bf67b8f5 100644 --- a/scene/animation/animation_blend_tree.h +++ b/scene/animation/animation_blend_tree.h @@ -53,7 +53,7 @@ public: static Vector<String> (*get_editable_animation_list)(); virtual String get_caption() const override; - virtual double process(double p_time, bool p_seek, bool p_seek_root) override; + virtual double process(double p_time, bool p_seek, bool p_is_external_seeking) override; void set_animation(const StringName &p_name); StringName get_animation() const; @@ -72,7 +72,7 @@ protected: private: PlayMode play_mode = PLAY_MODE_FORWARD; - bool backward = false; + bool backward = false; // Only used by pingpong animation. }; VARIANT_ENUM_CAST(AnimationNodeAnimation::PlayMode) @@ -148,7 +148,7 @@ public: MixMode get_mix_mode() const; virtual bool has_filter() const override; - virtual double process(double p_time, bool p_seek, bool p_seek_root) override; + virtual double process(double p_time, bool p_seek, bool p_is_external_seeking) override; AnimationNodeOneShot(); }; @@ -170,7 +170,7 @@ public: virtual String get_caption() const override; virtual bool has_filter() const override; - virtual double process(double p_time, bool p_seek, bool p_seek_root) override; + virtual double process(double p_time, bool p_seek, bool p_is_external_seeking) override; AnimationNodeAdd2(); }; @@ -190,7 +190,7 @@ public: virtual String get_caption() const override; virtual bool has_filter() const override; - virtual double process(double p_time, bool p_seek, bool p_seek_root) override; + virtual double process(double p_time, bool p_seek, bool p_is_external_seeking) override; AnimationNodeAdd3(); }; @@ -208,7 +208,7 @@ public: virtual Variant get_parameter_default_value(const StringName &p_parameter) const override; virtual String get_caption() const override; - virtual double process(double p_time, bool p_seek, bool p_seek_root) override; + virtual double process(double p_time, bool p_seek, bool p_is_external_seeking) override; virtual bool has_filter() const override; AnimationNodeBlend2(); @@ -228,7 +228,7 @@ public: virtual String get_caption() const override; - double process(double p_time, bool p_seek, bool p_seek_root) override; + double process(double p_time, bool p_seek, bool p_is_external_seeking) override; AnimationNodeBlend3(); }; @@ -246,7 +246,7 @@ public: virtual String get_caption() const override; - double process(double p_time, bool p_seek, bool p_seek_root) override; + double process(double p_time, bool p_seek, bool p_is_external_seeking) override; AnimationNodeTimeScale(); }; @@ -265,7 +265,7 @@ public: virtual String get_caption() const override; - double process(double p_time, bool p_seek, bool p_seek_root) override; + double process(double p_time, bool p_seek, bool p_is_external_seeking) override; AnimationNodeTimeSeek(); }; @@ -331,7 +331,7 @@ public: void set_from_start(bool p_from_start); bool is_from_start() const; - double process(double p_time, bool p_seek, bool p_seek_root) override; + double process(double p_time, bool p_seek, bool p_is_external_seeking) override; AnimationNodeTransition(); }; @@ -341,7 +341,7 @@ class AnimationNodeOutput : public AnimationNode { public: virtual String get_caption() const override; - virtual double process(double p_time, bool p_seek, bool p_seek_root) override; + virtual double process(double p_time, bool p_seek, bool p_is_external_seeking) override; AnimationNodeOutput(); }; @@ -410,7 +410,7 @@ public: void get_node_connections(List<NodeConnection> *r_connections) const; virtual String get_caption() const override; - virtual double process(double p_time, bool p_seek, bool p_seek_root) override; + virtual double process(double p_time, bool p_seek, bool p_is_external_seeking) override; void get_node_list(List<StringName> *r_list); diff --git a/scene/animation/animation_node_state_machine.cpp b/scene/animation/animation_node_state_machine.cpp index 8291df8036..d3746c1144 100644 --- a/scene/animation/animation_node_state_machine.cpp +++ b/scene/animation/animation_node_state_machine.cpp @@ -332,11 +332,11 @@ bool AnimationNodeStateMachinePlayback::_travel(AnimationNodeStateMachine *p_sta return true; } -double AnimationNodeStateMachinePlayback::process(AnimationNodeStateMachine *p_state_machine, double p_time, bool p_seek, bool p_seek_root) { +double AnimationNodeStateMachinePlayback::process(AnimationNodeStateMachine *p_state_machine, double p_time, bool p_seek, bool p_is_external_seeking) { if (p_time == -1) { Ref<AnimationNodeStateMachine> anodesm = p_state_machine->states[current].node; if (anodesm.is_valid()) { - p_state_machine->blend_node(current, p_state_machine->states[current].node, -1, p_seek, p_seek_root, 0, AnimationNode::FILTER_IGNORE, true); + p_state_machine->blend_node(current, p_state_machine->states[current].node, -1, p_seek, p_is_external_seeking, 0, AnimationNode::FILTER_IGNORE, true); } playing = false; return 0; @@ -405,7 +405,7 @@ double AnimationNodeStateMachinePlayback::process(AnimationNodeStateMachine *p_s current = p_state_machine->start_node; } - len_current = p_state_machine->blend_node(current, p_state_machine->states[current].node, 0, true, p_seek_root, 1.0, AnimationNode::FILTER_IGNORE, true); + len_current = p_state_machine->blend_node(current, p_state_machine->states[current].node, 0, true, p_is_external_seeking, 1.0, AnimationNode::FILTER_IGNORE, true); pos_current = 0; } @@ -433,10 +433,10 @@ double AnimationNodeStateMachinePlayback::process(AnimationNodeStateMachine *p_s if (current_curve.is_valid()) { fade_blend = current_curve->sample(fade_blend); } - float rem = p_state_machine->blend_node(current, p_state_machine->states[current].node, p_time, p_seek, p_seek_root, fade_blend, AnimationNode::FILTER_IGNORE, true); + float rem = p_state_machine->blend_node(current, p_state_machine->states[current].node, p_time, p_seek, p_is_external_seeking, MAX(CMP_EPSILON, fade_blend), AnimationNode::FILTER_IGNORE, true); // Blend values must be more than CMP_EPSILON to process discrete keys in edge. if (fading_from != StringName()) { - p_state_machine->blend_node(fading_from, p_state_machine->states[fading_from].node, p_time, p_seek, p_seek_root, 1.0 - fade_blend, AnimationNode::FILTER_IGNORE, true); + p_state_machine->blend_node(fading_from, p_state_machine->states[fading_from].node, p_time, p_seek, p_is_external_seeking, MAX(CMP_EPSILON, 1.0 - fade_blend), AnimationNode::FILTER_IGNORE, true); // Blend values must be more than CMP_EPSILON to process discrete keys in edge. } //guess playback position @@ -593,19 +593,17 @@ double AnimationNodeStateMachinePlayback::process(AnimationNodeStateMachine *p_s { // if the current node is a state machine, update the "playing" variable to false by passing -1 in p_time Ref<AnimationNodeStateMachine> anodesm = p_state_machine->states[current].node; if (anodesm.is_valid()) { - p_state_machine->blend_node(current, p_state_machine->states[current].node, -1, p_seek, p_seek_root, 0, AnimationNode::FILTER_IGNORE, true); + p_state_machine->blend_node(current, p_state_machine->states[current].node, -1, p_seek, p_is_external_seeking, 0, AnimationNode::FILTER_IGNORE, true); } } current = next; + len_current = p_state_machine->blend_node(current, p_state_machine->states[current].node, 0, true, p_is_external_seeking, CMP_EPSILON, AnimationNode::FILTER_IGNORE, true); // Process next node's first key in here. if (switch_mode == AnimationNodeStateMachineTransition::SWITCH_MODE_SYNC) { - len_current = p_state_machine->blend_node(current, p_state_machine->states[current].node, 0, true, p_seek_root, 0, AnimationNode::FILTER_IGNORE, true); pos_current = MIN(pos_current, len_current); - p_state_machine->blend_node(current, p_state_machine->states[current].node, pos_current, true, p_seek_root, 0, AnimationNode::FILTER_IGNORE, true); - + p_state_machine->blend_node(current, p_state_machine->states[current].node, pos_current, true, p_is_external_seeking, 0, AnimationNode::FILTER_IGNORE, true); } else { - len_current = p_state_machine->blend_node(current, p_state_machine->states[current].node, 0, true, p_seek_root, 0, AnimationNode::FILTER_IGNORE, true); pos_current = 0; } @@ -1133,11 +1131,11 @@ Vector2 AnimationNodeStateMachine::get_graph_offset() const { return graph_offset; } -double AnimationNodeStateMachine::process(double p_time, bool p_seek, bool p_seek_root) { +double AnimationNodeStateMachine::process(double p_time, bool p_seek, bool p_is_external_seeking) { Ref<AnimationNodeStateMachinePlayback> playback_new = get_parameter(playback); ERR_FAIL_COND_V(playback_new.is_null(), 0.0); - return playback_new->process(this, p_time, p_seek, p_seek_root); + return playback_new->process(this, p_time, p_seek, p_is_external_seeking); } String AnimationNodeStateMachine::get_caption() const { diff --git a/scene/animation/animation_node_state_machine.h b/scene/animation/animation_node_state_machine.h index cdb4c7528a..0dfe5a3a43 100644 --- a/scene/animation/animation_node_state_machine.h +++ b/scene/animation/animation_node_state_machine.h @@ -133,7 +133,7 @@ class AnimationNodeStateMachinePlayback : public Resource { bool _travel(AnimationNodeStateMachine *p_state_machine, const StringName &p_travel); - double process(AnimationNodeStateMachine *p_state_machine, double p_time, bool p_seek, bool p_seek_root); + double process(AnimationNodeStateMachine *p_state_machine, double p_time, bool p_seek, bool p_is_external_seeking); bool _check_advance_condition(const Ref<AnimationNodeStateMachine> p_state_machine, const Ref<AnimationNodeStateMachineTransition> p_transition) const; @@ -239,7 +239,7 @@ public: void set_graph_offset(const Vector2 &p_offset); Vector2 get_graph_offset() const; - virtual double process(double p_time, bool p_seek, bool p_seek_root) override; + virtual double process(double p_time, bool p_seek, bool p_is_external_seeking) override; virtual String get_caption() const override; virtual Ref<AnimationNode> get_child_by_name(const StringName &p_name) override; diff --git a/scene/animation/animation_player.cpp b/scene/animation/animation_player.cpp index 85bc4e9814..f7baa7facc 100644 --- a/scene/animation/animation_player.cpp +++ b/scene/animation/animation_player.cpp @@ -468,7 +468,7 @@ Variant AnimationPlayer::_post_process_key_value(const Ref<Animation> &p_anim, i return p_value; } -void AnimationPlayer::_animation_process_animation(AnimationData *p_anim, double p_time, double p_delta, float p_interp, bool p_is_current, bool p_seeked, bool p_started, int p_pingponged) { +void AnimationPlayer::_animation_process_animation(AnimationData *p_anim, double p_prev_time, double p_time, double p_delta, float p_interp, bool p_is_current, bool p_seeked, bool p_started, Animation::LoopedFlag p_looped_flag) { _ensure_node_caches(p_anim); ERR_FAIL_COND(p_anim->node_cache.size() != p_anim->animation->get_track_count()); @@ -664,7 +664,7 @@ void AnimationPlayer::_animation_process_animation(AnimationData *p_anim, double } } - if (update_mode == Animation::UPDATE_CONTINUOUS || update_mode == Animation::UPDATE_CAPTURE || (p_delta == 0 && update_mode == Animation::UPDATE_DISCRETE)) { //delta == 0 means seek + if (update_mode == Animation::UPDATE_CONTINUOUS || update_mode == Animation::UPDATE_CAPTURE) { Variant value = a->value_track_interpolate(i, p_time); if (value == Variant()) { @@ -681,9 +681,23 @@ void AnimationPlayer::_animation_process_animation(AnimationData *p_anim, double pa->value_accum = Animation::interpolate_variant(pa->value_accum, value, p_interp); } - } else if (p_is_current && p_delta != 0) { + } else { List<int> indices; - a->value_track_get_key_indices(i, p_time, p_delta, &indices, p_pingponged); + + if (p_seeked) { + int found_key = a->track_find_key(i, p_time); + if (found_key >= 0) { + indices.push_back(found_key); + } + } else { + if (p_started) { + int first_key = a->track_find_key(i, p_prev_time, true); + if (first_key >= 0) { + indices.push_back(first_key); + } + } + a->track_get_key_indices_in_range(i, p_time, p_delta, &indices, p_looped_flag); + } for (int &F : indices) { Variant value = a->track_get_key_value(i, F); @@ -734,16 +748,26 @@ void AnimationPlayer::_animation_process_animation(AnimationData *p_anim, double if (!nc->node) { continue; } - if (p_delta == 0) { - continue; - } if (!p_is_current) { break; } List<int> indices; - a->method_track_get_key_indices(i, p_time, p_delta, &indices, p_pingponged); + if (p_seeked) { + int found_key = a->track_find_key(i, p_time); + if (found_key >= 0) { + indices.push_back(found_key); + } + } else { + if (p_started) { + int first_key = a->track_find_key(i, p_prev_time, true); + if (first_key >= 0) { + indices.push_back(first_key); + } + } + a->track_get_key_indices_in_range(i, p_time, p_delta, &indices, p_looped_flag); + } for (int &E : indices) { StringName method = a->method_track_get_name(i, E); @@ -787,9 +811,6 @@ void AnimationPlayer::_animation_process_animation(AnimationData *p_anim, double if (!nc->node) { continue; } - if (p_delta == 0) { - continue; - } if (p_seeked) { //find whatever should be playing @@ -833,7 +854,13 @@ void AnimationPlayer::_animation_process_animation(AnimationData *p_anim, double } else { //find stuff to play List<int> to_play; - a->track_get_key_indices_in_range(i, p_time, p_delta, &to_play, p_pingponged); + if (p_started) { + int first_key = a->track_find_key(i, p_prev_time, true); + if (first_key >= 0) { + to_play.push_back(first_key); + } + } + a->track_get_key_indices_in_range(i, p_time, p_delta, &to_play, p_looped_flag); if (to_play.size()) { int idx = to_play.back()->get(); @@ -893,7 +920,7 @@ void AnimationPlayer::_animation_process_animation(AnimationData *p_anim, double continue; } - if (p_delta == 0 || p_seeked) { + if (p_seeked) { //seek int idx = a->track_find_key(i, p_time); if (idx < 0) { @@ -928,7 +955,7 @@ void AnimationPlayer::_animation_process_animation(AnimationData *p_anim, double break; } - if (player->is_playing() || p_seeked) { + if (player->is_playing()) { player->play(anim_name); player->seek(at_anim_pos); nc->animation_playing = true; @@ -940,7 +967,13 @@ void AnimationPlayer::_animation_process_animation(AnimationData *p_anim, double } else { //find stuff to play List<int> to_play; - a->track_get_key_indices_in_range(i, p_time, p_delta, &to_play, p_pingponged); + if (p_started) { + int first_key = a->track_find_key(i, p_prev_time, true); + if (first_key >= 0) { + to_play.push_back(first_key); + } + } + a->track_get_key_indices_in_range(i, p_time, p_delta, &to_play, p_looped_flag); if (to_play.size()) { int idx = to_play.back()->get(); @@ -970,7 +1003,7 @@ void AnimationPlayer::_animation_process_data(PlaybackData &cd, double p_delta, double next_pos = cd.pos + delta; real_t len = cd.from->animation->get_length(); - int pingponged = 0; + Animation::LoopedFlag looped_flag = Animation::LOOPED_FLAG_NONE; switch (cd.from->animation->get_loop_mode()) { case Animation::LOOP_NONE: { @@ -999,44 +1032,33 @@ void AnimationPlayer::_animation_process_data(PlaybackData &cd, double p_delta, } break; case Animation::LOOP_LINEAR: { - double looped_next_pos = Math::fposmod(next_pos, (double)len); - if (looped_next_pos == 0 && next_pos != 0) { - // Loop multiples of the length to it, rather than 0 - // so state at time=length is previewable in the editor - next_pos = len; - } else { - next_pos = looped_next_pos; + if (next_pos < 0 && cd.pos >= 0) { + looped_flag = Animation::LOOPED_FLAG_START; } + if (next_pos > len && cd.pos <= len) { + looped_flag = Animation::LOOPED_FLAG_END; + } + next_pos = Math::fposmod(next_pos, (double)len); } break; case Animation::LOOP_PINGPONG: { - if ((int)Math::floor(abs(next_pos - cd.pos) / len) % 2 == 0) { - if (next_pos < 0 && cd.pos >= 0) { - cd.speed_scale *= -1.0; - pingponged = -1; - } - if (next_pos > len && cd.pos <= len) { - cd.speed_scale *= -1.0; - pingponged = 1; - } + if (next_pos < 0 && cd.pos >= 0) { + cd.speed_scale *= -1.0; + looped_flag = Animation::LOOPED_FLAG_START; } - double looped_next_pos = Math::pingpong(next_pos, (double)len); - if (looped_next_pos == 0 && next_pos != 0) { - // Loop multiples of the length to it, rather than 0 - // so state at time=length is previewable in the editor - next_pos = len; - } else { - next_pos = looped_next_pos; + if (next_pos > len && cd.pos <= len) { + cd.speed_scale *= -1.0; + looped_flag = Animation::LOOPED_FLAG_END; } + next_pos = Math::pingpong(next_pos, (double)len); } break; default: break; } + _animation_process_animation(cd.from, cd.pos, next_pos, delta, p_blend, &cd == &playback.current, p_seeked, p_started, looped_flag); cd.pos = next_pos; - - _animation_process_animation(cd.from, cd.pos, delta, p_blend, &cd == &playback.current, p_seeked, p_started, pingponged); } void AnimationPlayer::_animation_process2(double p_delta, bool p_started) { @@ -1044,7 +1066,7 @@ void AnimationPlayer::_animation_process2(double p_delta, bool p_started) { accum_pass++; - _animation_process_data(c.current, p_delta, 1.0f, c.seeked && p_delta != 0, p_started); + _animation_process_data(c.current, p_delta, 1.0f, c.seeked, p_started); if (p_delta != 0) { c.seeked = false; } @@ -1274,23 +1296,6 @@ void AnimationPlayer::_animation_set_cache_update() { } void AnimationPlayer::_animation_added(const StringName &p_name, const StringName &p_library) { - { - int at_pos = -1; - - for (uint32_t i = 0; i < animation_libraries.size(); i++) { - if (animation_libraries[i].name == p_library) { - at_pos = i; - break; - } - } - - ERR_FAIL_COND(at_pos == -1); - - ERR_FAIL_COND(!animation_libraries[at_pos].library->animations.has(p_name)); - - _ref_anim(animation_libraries[at_pos].library->animations[p_name]); - } - _animation_set_cache_update(); } @@ -1301,11 +1306,6 @@ void AnimationPlayer::_animation_removed(const StringName &p_name, const StringN return; // No need to update because not the one from the library being used. } - AnimationData animation_data = animation_set[name]; - if (animation_data.animation_library == p_library) { - _unref_anim(animation_data.animation); - } - _animation_set_cache_update(); // Erase blends if needed @@ -1401,10 +1401,7 @@ Error AnimationPlayer::add_animation_library(const StringName &p_name, const Ref ald.library->connect(SNAME("animation_added"), callable_mp(this, &AnimationPlayer::_animation_added).bind(p_name)); ald.library->connect(SNAME("animation_removed"), callable_mp(this, &AnimationPlayer::_animation_removed).bind(p_name)); ald.library->connect(SNAME("animation_renamed"), callable_mp(this, &AnimationPlayer::_animation_renamed).bind(p_name)); - - for (const KeyValue<StringName, Ref<Animation>> &K : ald.library->animations) { - _ref_anim(K.value); - } + ald.library->connect(SNAME("animation_changed"), callable_mp(this, &AnimationPlayer::_animation_changed)); _animation_set_cache_update(); @@ -1428,27 +1425,16 @@ void AnimationPlayer::remove_animation_library(const StringName &p_name) { animation_libraries[at_pos].library->disconnect(SNAME("animation_added"), callable_mp(this, &AnimationPlayer::_animation_added)); animation_libraries[at_pos].library->disconnect(SNAME("animation_removed"), callable_mp(this, &AnimationPlayer::_animation_removed)); animation_libraries[at_pos].library->disconnect(SNAME("animation_renamed"), callable_mp(this, &AnimationPlayer::_animation_renamed)); + animation_libraries[at_pos].library->disconnect(SNAME("animation_changed"), callable_mp(this, &AnimationPlayer::_animation_changed)); stop(); - for (const KeyValue<StringName, Ref<Animation>> &K : animation_libraries[at_pos].library->animations) { - _unref_anim(K.value); - } - animation_libraries.remove_at(at_pos); _animation_set_cache_update(); notify_property_list_changed(); } -void AnimationPlayer::_ref_anim(const Ref<Animation> &p_anim) { - Ref<Animation>(p_anim)->connect("changed", callable_mp(this, &AnimationPlayer::_animation_changed), CONNECT_REFERENCE_COUNTED); -} - -void AnimationPlayer::_unref_anim(const Ref<Animation> &p_anim) { - Ref<Animation>(p_anim)->disconnect("changed", callable_mp(this, &AnimationPlayer::_animation_changed)); -} - void AnimationPlayer::rename_animation_library(const StringName &p_name, const StringName &p_new_name) { if (p_name == p_new_name) { return; @@ -1799,9 +1785,8 @@ double AnimationPlayer::get_current_animation_length() const { return playback.current.from->animation->get_length(); } -void AnimationPlayer::_animation_changed() { +void AnimationPlayer::_animation_changed(const StringName &p_name) { clear_caches(); - emit_signal(SNAME("caches_cleared")); if (is_playing()) { playback.seeked = true; //need to restart stuff, like audio } @@ -1840,6 +1825,8 @@ void AnimationPlayer::clear_caches() { cache_update_size = 0; cache_update_prop_size = 0; cache_update_bezier_size = 0; + + emit_signal(SNAME("caches_cleared")); } void AnimationPlayer::set_active(bool p_active) { @@ -2158,7 +2145,7 @@ void AnimationPlayer::_bind_methods() { ClassDB::bind_method(D_METHOD("advance", "delta"), &AnimationPlayer::advance); ADD_PROPERTY(PropertyInfo(Variant::NODE_PATH, "root_node"), "set_root", "get_root"); - ADD_PROPERTY(PropertyInfo(Variant::STRING_NAME, "current_animation", PROPERTY_HINT_ENUM, "", PROPERTY_USAGE_EDITOR | PROPERTY_USAGE_ANIMATE_AS_TRIGGER), "set_current_animation", "get_current_animation"); + ADD_PROPERTY(PropertyInfo(Variant::STRING_NAME, "current_animation", PROPERTY_HINT_ENUM, "", PROPERTY_USAGE_EDITOR), "set_current_animation", "get_current_animation"); ADD_PROPERTY(PropertyInfo(Variant::STRING_NAME, "assigned_animation", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NONE), "set_assigned_animation", "get_assigned_animation"); ADD_PROPERTY(PropertyInfo(Variant::STRING_NAME, "autoplay", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NO_EDITOR), "set_autoplay", "get_autoplay"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "reset_on_save", PROPERTY_HINT_NONE, ""), "set_reset_on_save_enabled", "is_reset_on_save_enabled"); diff --git a/scene/animation/animation_player.h b/scene/animation/animation_player.h index 4f32927d25..0b95ee4e9e 100644 --- a/scene/animation/animation_player.h +++ b/scene/animation/animation_player.h @@ -268,7 +268,7 @@ private: NodePath root; - void _animation_process_animation(AnimationData *p_anim, double p_time, double p_delta, float p_interp, bool p_is_current = true, bool p_seeked = false, bool p_started = false, int p_pingponged = 0); + void _animation_process_animation(AnimationData *p_anim, double p_prev_time, double p_time, double p_delta, float p_interp, bool p_is_current = true, bool p_seeked = false, bool p_started = false, Animation::LoopedFlag p_looped_flag = Animation::LOOPED_FLAG_NONE); void _ensure_node_caches(AnimationData *p_anim, Node *p_root_override = nullptr); void _animation_process_data(PlaybackData &cd, double p_delta, float p_blend, bool p_seeked, bool p_started); @@ -291,9 +291,7 @@ private: return ret; } - void _animation_changed(); - void _ref_anim(const Ref<Animation> &p_anim); - void _unref_anim(const Ref<Animation> &p_anim); + void _animation_changed(const StringName &p_name); void _set_process(bool p_process, bool p_force = false); diff --git a/scene/animation/animation_tree.cpp b/scene/animation/animation_tree.cpp index 99d450fa5b..bd9b918900 100644 --- a/scene/animation/animation_tree.cpp +++ b/scene/animation/animation_tree.cpp @@ -86,7 +86,7 @@ void AnimationNode::get_child_nodes(List<ChildNode> *r_child_nodes) { } } -void AnimationNode::blend_animation(const StringName &p_animation, double p_time, double p_delta, bool p_seeked, bool p_seek_root, real_t p_blend, int p_pingponged) { +void AnimationNode::blend_animation(const StringName &p_animation, double p_time, double p_delta, bool p_seeked, bool p_is_external_seeking, real_t p_blend, Animation::LoopedFlag p_looped_flag) { ERR_FAIL_COND(!state); ERR_FAIL_COND(!state->player->has_animation(p_animation)); @@ -112,19 +112,19 @@ void AnimationNode::blend_animation(const StringName &p_animation, double p_time anim_state.time = p_time; anim_state.animation = animation; anim_state.seeked = p_seeked; - anim_state.pingponged = p_pingponged; - anim_state.seek_root = p_seek_root; + anim_state.looped_flag = p_looped_flag; + anim_state.is_external_seeking = p_is_external_seeking; state->animation_states.push_back(anim_state); } -double AnimationNode::_pre_process(const StringName &p_base_path, AnimationNode *p_parent, State *p_state, double p_time, bool p_seek, bool p_seek_root, const Vector<StringName> &p_connections) { +double AnimationNode::_pre_process(const StringName &p_base_path, AnimationNode *p_parent, State *p_state, double p_time, bool p_seek, bool p_is_external_seeking, const Vector<StringName> &p_connections) { base_path = p_base_path; parent = p_parent; connections = p_connections; state = p_state; - double t = process(p_time, p_seek, p_seek_root); + double t = process(p_time, p_seek, p_is_external_seeking); state = nullptr; parent = nullptr; @@ -148,7 +148,7 @@ void AnimationNode::make_invalid(const String &p_reason) { state->invalid_reasons += String::utf8("• ") + p_reason; } -double AnimationNode::blend_input(int p_input, double p_time, bool p_seek, bool p_seek_root, real_t p_blend, FilterAction p_filter, bool p_sync) { +double AnimationNode::blend_input(int p_input, double p_time, bool p_seek, bool p_is_external_seeking, real_t p_blend, FilterAction p_filter, bool p_sync) { ERR_FAIL_INDEX_V(p_input, inputs.size(), 0); ERR_FAIL_COND_V(!state, 0); @@ -167,7 +167,7 @@ double AnimationNode::blend_input(int p_input, double p_time, bool p_seek, bool //inputs.write[p_input].last_pass = state->last_pass; real_t activity = 0.0; - double ret = _blend_node(node_name, blend_tree->get_node_connection_array(node_name), nullptr, node, p_time, p_seek, p_seek_root, p_blend, p_filter, p_sync, &activity); + double ret = _blend_node(node_name, blend_tree->get_node_connection_array(node_name), nullptr, node, p_time, p_seek, p_is_external_seeking, p_blend, p_filter, p_sync, &activity); Vector<AnimationTree::Activity> *activity_ptr = state->tree->input_activity_map.getptr(base_path); @@ -178,11 +178,11 @@ double AnimationNode::blend_input(int p_input, double p_time, bool p_seek, bool return ret; } -double AnimationNode::blend_node(const StringName &p_sub_path, Ref<AnimationNode> p_node, double p_time, bool p_seek, bool p_seek_root, real_t p_blend, FilterAction p_filter, bool p_sync) { - return _blend_node(p_sub_path, Vector<StringName>(), this, p_node, p_time, p_seek, p_seek_root, p_blend, p_filter, p_sync); +double AnimationNode::blend_node(const StringName &p_sub_path, Ref<AnimationNode> p_node, double p_time, bool p_seek, bool p_is_external_seeking, real_t p_blend, FilterAction p_filter, bool p_sync) { + return _blend_node(p_sub_path, Vector<StringName>(), this, p_node, p_time, p_seek, p_is_external_seeking, p_blend, p_filter, p_sync); } -double AnimationNode::_blend_node(const StringName &p_subpath, const Vector<StringName> &p_connections, AnimationNode *p_new_parent, Ref<AnimationNode> p_node, double p_time, bool p_seek, bool p_seek_root, real_t p_blend, FilterAction p_filter, bool p_sync, real_t *r_max) { +double AnimationNode::_blend_node(const StringName &p_subpath, const Vector<StringName> &p_connections, AnimationNode *p_new_parent, Ref<AnimationNode> p_node, double p_time, bool p_seek, bool p_is_external_seeking, real_t p_blend, FilterAction p_filter, bool p_sync, real_t *r_max) { ERR_FAIL_COND_V(!p_node.is_valid(), 0); ERR_FAIL_COND_V(!state, 0); @@ -292,9 +292,9 @@ double AnimationNode::_blend_node(const StringName &p_subpath, const Vector<Stri // This process, which depends on p_sync is needed to process sync correctly in the case of // that a synced AnimationNodeSync exists under the un-synced AnimationNodeSync. if (!p_seek && !p_sync && !any_valid) { - return p_node->_pre_process(new_path, new_parent, state, 0, p_seek, p_seek_root, p_connections); + return p_node->_pre_process(new_path, new_parent, state, 0, p_seek, p_is_external_seeking, p_connections); } - return p_node->_pre_process(new_path, new_parent, state, p_time, p_seek, p_seek_root, p_connections); + return p_node->_pre_process(new_path, new_parent, state, p_time, p_seek, p_is_external_seeking, p_connections); } int AnimationNode::get_input_count() const { @@ -335,9 +335,9 @@ void AnimationNode::remove_input(int p_index) { emit_changed(); } -double AnimationNode::process(double p_time, bool p_seek, bool p_seek_root) { +double AnimationNode::process(double p_time, bool p_seek, bool p_is_external_seeking) { double ret = 0; - GDVIRTUAL_CALL(_process, p_time, p_seek, p_seek_root, ret); + GDVIRTUAL_CALL(_process, p_time, p_seek, p_is_external_seeking, ret); return ret; } @@ -413,9 +413,9 @@ void AnimationNode::_bind_methods() { ClassDB::bind_method(D_METHOD("_set_filters", "filters"), &AnimationNode::_set_filters); ClassDB::bind_method(D_METHOD("_get_filters"), &AnimationNode::_get_filters); - ClassDB::bind_method(D_METHOD("blend_animation", "animation", "time", "delta", "seeked", "seek_root", "blend", "pingponged"), &AnimationNode::blend_animation, DEFVAL(0)); - ClassDB::bind_method(D_METHOD("blend_node", "name", "node", "time", "seek", "seek_root", "blend", "filter", "sync"), &AnimationNode::blend_node, DEFVAL(FILTER_IGNORE), DEFVAL(true)); - ClassDB::bind_method(D_METHOD("blend_input", "input_index", "time", "seek", "seek_root", "blend", "filter", "sync"), &AnimationNode::blend_input, DEFVAL(FILTER_IGNORE), DEFVAL(true)); + ClassDB::bind_method(D_METHOD("blend_animation", "animation", "time", "delta", "seeked", "is_external_seeking", "blend", "looped_flag"), &AnimationNode::blend_animation, DEFVAL(Animation::LOOPED_FLAG_NONE)); + ClassDB::bind_method(D_METHOD("blend_node", "name", "node", "time", "seek", "is_external_seeking", "blend", "filter", "sync"), &AnimationNode::blend_node, DEFVAL(FILTER_IGNORE), DEFVAL(true)); + ClassDB::bind_method(D_METHOD("blend_input", "input_index", "time", "seek", "is_external_seeking", "blend", "filter", "sync"), &AnimationNode::blend_input, DEFVAL(FILTER_IGNORE), DEFVAL(true)); ClassDB::bind_method(D_METHOD("set_parameter", "name", "value"), &AnimationNode::set_parameter); ClassDB::bind_method(D_METHOD("get_parameter", "name"), &AnimationNode::get_parameter); @@ -427,7 +427,7 @@ void AnimationNode::_bind_methods() { GDVIRTUAL_BIND(_get_parameter_list); GDVIRTUAL_BIND(_get_child_by_name, "name"); GDVIRTUAL_BIND(_get_parameter_default_value, "parameter"); - GDVIRTUAL_BIND(_process, "time", "seek", "seek_root"); + GDVIRTUAL_BIND(_process, "time", "seek", "is_external_seeking"); GDVIRTUAL_BIND(_get_caption); GDVIRTUAL_BIND(_has_filter); @@ -586,7 +586,7 @@ bool AnimationTree::_update_caches(AnimationPlayer *player) { track_value->object = child; } - track_value->is_discrete = anim->value_track_get_update_mode(i) == Animation::UPDATE_DISCRETE || anim->value_track_get_update_mode(i) == Animation::UPDATE_TRIGGER; + track_value->is_discrete = anim->value_track_get_update_mode(i) == Animation::UPDATE_DISCRETE; track_value->is_using_angle = anim->track_get_interpolation_type(i) == Animation::INTERPOLATION_LINEAR_ANGLE || anim->track_get_interpolation_type(i) == Animation::INTERPOLATION_CUBIC_ANGLE; track_value->subpath = leftover_path; @@ -800,9 +800,18 @@ bool AnimationTree::_update_caches(AnimationPlayer *player) { } } else if (track_cache_type == Animation::TYPE_VALUE) { // If it has at least one angle interpolation, it also uses angle interpolation for blending. - TrackCacheValue *track_value = memnew(TrackCacheValue); - track_value->is_discrete |= anim->value_track_get_update_mode(i) == Animation::UPDATE_DISCRETE || anim->value_track_get_update_mode(i) == Animation::UPDATE_TRIGGER; + TrackCacheValue *track_value = static_cast<TrackCacheValue *>(track); + bool was_discrete = track_value->is_discrete; + bool was_using_angle = track_value->is_using_angle; + track_value->is_discrete |= anim->value_track_get_update_mode(i) == Animation::UPDATE_DISCRETE; track_value->is_using_angle |= anim->track_get_interpolation_type(i) == Animation::INTERPOLATION_LINEAR_ANGLE || anim->track_get_interpolation_type(i) == Animation::INTERPOLATION_CUBIC_ANGLE; + + if (was_discrete != track_value->is_discrete) { + ERR_PRINT_ED("Value track: " + String(path) + " with different update modes are blended. Blending prioritizes Discrete mode, so other update mode tracks will not be blended."); + } + if (was_using_angle != track_value->is_using_angle) { + WARN_PRINT_ED("Value track: " + String(path) + " with different interpolation types for rotation are blended. Blending prioritizes angle interpolation, so the blending result uses the shortest path referenced to the initial (RESET animation) value."); + } } track->setup_pass = setup_pass; @@ -850,7 +859,6 @@ void AnimationTree::_clear_caches() { memdelete(K.value); } playing_caches.clear(); - track_cache.clear(); cache_valid = false; } @@ -874,7 +882,9 @@ void AnimationTree::_process_graph(double p_delta) { _update_properties(); //if properties need updating, update them //check all tracks, see if they need modification - root_motion_transform = Transform3D(); + root_motion_position = Vector3(0, 0, 0); + root_motion_rotation = Quaternion(0, 0, 0, 1); + root_motion_scale = Vector3(0, 0, 0); if (!root.is_valid()) { ERR_PRINT("AnimationTree: root AnimationNode is not set, disabling playback."); @@ -973,7 +983,7 @@ void AnimationTree::_process_graph(double p_delta) { if (track->root_motion) { t->loc = Vector3(0, 0, 0); t->rot = Quaternion(0, 0, 0, 1); - t->scale = Vector3(0, 0, 0); + t->scale = Vector3(1, 1, 1); } else { t->loc = t->init_loc; t->rot = t->init_rot; @@ -1008,10 +1018,11 @@ void AnimationTree::_process_graph(double p_delta) { double delta = as.delta; real_t weight = as.blend; bool seeked = as.seeked; - int pingponged = as.pingponged; + Animation::LoopedFlag looped_flag = as.looped_flag; + bool is_external_seeking = as.is_external_seeking; #ifndef _3D_DISABLED bool backward = signbit(delta); // This flag is required only for the root motion since it calculates the difference between the previous and current frames. - bool calc_root = !seeked || as.seek_root; + bool calc_root = !seeked || is_external_seeking; #endif // _3D_DISABLED for (int i = 0; i < a->get_track_count(); i++) { @@ -1370,7 +1381,7 @@ void AnimationTree::_process_graph(double p_delta) { } } else { if (seeked) { - int idx = a->track_find_key(i, time); + int idx = a->track_find_key(i, time, !is_external_seeking); if (idx < 0) { continue; } @@ -1379,7 +1390,7 @@ void AnimationTree::_process_graph(double p_delta) { t->object->set_indexed(t->subpath, value); } else { List<int> indices; - a->value_track_get_key_indices(i, time, delta, &indices, pingponged); + a->track_get_key_indices_in_range(i, time, delta, &indices, looped_flag); for (int &F : indices) { Variant value = a->track_get_key_value(i, F); value = _post_process_key_value(a, i, value, t->object); @@ -1393,7 +1404,7 @@ void AnimationTree::_process_graph(double p_delta) { TrackCacheMethod *t = static_cast<TrackCacheMethod *>(track); if (seeked) { - int idx = a->track_find_key(i, time); + int idx = a->track_find_key(i, time, !is_external_seeking); if (idx < 0) { continue; } @@ -1404,7 +1415,7 @@ void AnimationTree::_process_graph(double p_delta) { } } else { List<int> indices; - a->method_track_get_key_indices(i, time, delta, &indices, pingponged); + a->track_get_key_indices_in_range(i, time, delta, &indices, looped_flag); for (int &F : indices) { StringName method = a->method_track_get_name(i, F); Vector<Variant> params = a->method_track_get_params(i, F); @@ -1427,7 +1438,7 @@ void AnimationTree::_process_graph(double p_delta) { if (seeked) { //find whatever should be playing - int idx = a->track_find_key(i, time); + int idx = a->track_find_key(i, time, !is_external_seeking); if (idx < 0) { continue; } @@ -1467,7 +1478,7 @@ void AnimationTree::_process_graph(double p_delta) { } else { //find stuff to play List<int> to_play; - a->track_get_key_indices_in_range(i, time, delta, &to_play, pingponged); + a->track_get_key_indices_in_range(i, time, delta, &to_play, looped_flag); if (to_play.size()) { int idx = to_play.back()->get(); @@ -1540,7 +1551,7 @@ void AnimationTree::_process_graph(double p_delta) { if (seeked) { //seek - int idx = a->track_find_key(i, time); + int idx = a->track_find_key(i, time, !is_external_seeking); if (idx < 0) { continue; } @@ -1582,7 +1593,7 @@ void AnimationTree::_process_graph(double p_delta) { } else { //find stuff to play List<int> to_play; - a->track_get_key_indices_in_range(i, time, delta, &to_play, pingponged); + a->track_get_key_indices_in_range(i, time, delta, &to_play, looped_flag); if (to_play.size()) { int idx = to_play.back()->get(); @@ -1618,11 +1629,9 @@ void AnimationTree::_process_graph(double p_delta) { TrackCacheTransform *t = static_cast<TrackCacheTransform *>(track); if (t->root_motion) { - Transform3D xform; - xform.origin = t->loc; - xform.basis.set_quaternion_scale(t->rot, Vector3(1, 1, 1) + t->scale); - - root_motion_transform = xform; + root_motion_position = t->loc; + root_motion_rotation = t->rot; + root_motion_scale = t->scale - Vector3(1, 1, 1); } else if (t->skeleton && t->bone_idx >= 0) { if (t->loc_used) { @@ -1661,7 +1670,7 @@ void AnimationTree::_process_graph(double p_delta) { TrackCacheValue *t = static_cast<TrackCacheValue *>(track); if (t->is_discrete) { - break; // Don't overwrite the value set by UPDATE_DISCRETE or UPDATE_TRIGGER. + break; // Don't overwrite the value set by UPDATE_DISCRETE. } if (t->init_value.get_type() == Variant::BOOL) { @@ -1835,8 +1844,16 @@ NodePath AnimationTree::get_root_motion_track() const { return root_motion_track; } -Transform3D AnimationTree::get_root_motion_transform() const { - return root_motion_transform; +Vector3 AnimationTree::get_root_motion_position() const { + return root_motion_position; +} + +Quaternion AnimationTree::get_root_motion_rotation() const { + return root_motion_rotation; +} + +Vector3 AnimationTree::get_root_motion_scale() const { + return root_motion_scale; } void AnimationTree::_tree_changed() { @@ -1994,7 +2011,9 @@ void AnimationTree::_bind_methods() { ClassDB::bind_method(D_METHOD("set_root_motion_track", "path"), &AnimationTree::set_root_motion_track); ClassDB::bind_method(D_METHOD("get_root_motion_track"), &AnimationTree::get_root_motion_track); - ClassDB::bind_method(D_METHOD("get_root_motion_transform"), &AnimationTree::get_root_motion_transform); + ClassDB::bind_method(D_METHOD("get_root_motion_position"), &AnimationTree::get_root_motion_position); + ClassDB::bind_method(D_METHOD("get_root_motion_rotation"), &AnimationTree::get_root_motion_rotation); + ClassDB::bind_method(D_METHOD("get_root_motion_scale"), &AnimationTree::get_root_motion_scale); ClassDB::bind_method(D_METHOD("_update_properties"), &AnimationTree::_update_properties); diff --git a/scene/animation/animation_tree.h b/scene/animation/animation_tree.h index 84d0a8190a..be0dc1af4e 100644 --- a/scene/animation/animation_tree.h +++ b/scene/animation/animation_tree.h @@ -68,8 +68,8 @@ public: const Vector<real_t> *track_blends = nullptr; real_t blend = 0.0; bool seeked = false; - bool seek_root = false; - int pingponged = 0; + bool is_external_seeking = false; + Animation::LoopedFlag looped_flag = Animation::LOOPED_FLAG_NONE; }; struct State { @@ -86,7 +86,7 @@ public: Vector<real_t> blends; State *state = nullptr; - double _pre_process(const StringName &p_base_path, AnimationNode *p_parent, State *p_state, double p_time, bool p_seek, bool p_seek_root, const Vector<StringName> &p_connections); + double _pre_process(const StringName &p_base_path, AnimationNode *p_parent, State *p_state, double p_time, bool p_seek, bool p_is_external_seeking, const Vector<StringName> &p_connections); //all this is temporary StringName base_path; @@ -99,12 +99,12 @@ public: Array _get_filters() const; void _set_filters(const Array &p_filters); friend class AnimationNodeBlendTree; - double _blend_node(const StringName &p_subpath, const Vector<StringName> &p_connections, AnimationNode *p_new_parent, Ref<AnimationNode> p_node, double p_time, bool p_seek, bool p_seek_root, real_t p_blend, FilterAction p_filter = FILTER_IGNORE, bool p_sync = true, real_t *r_max = nullptr); + double _blend_node(const StringName &p_subpath, const Vector<StringName> &p_connections, AnimationNode *p_new_parent, Ref<AnimationNode> p_node, double p_time, bool p_seek, bool p_is_external_seeking, real_t p_blend, FilterAction p_filter = FILTER_IGNORE, bool p_sync = true, real_t *r_max = nullptr); protected: - void blend_animation(const StringName &p_animation, double p_time, double p_delta, bool p_seeked, bool p_seek_root, real_t p_blend, int p_pingponged = 0); - double blend_node(const StringName &p_sub_path, Ref<AnimationNode> p_node, double p_time, bool p_seek, bool p_seek_root, real_t p_blend, FilterAction p_filter = FILTER_IGNORE, bool p_sync = true); - double blend_input(int p_input, double p_time, bool p_seek, bool p_seek_root, real_t p_blend, FilterAction p_filter = FILTER_IGNORE, bool p_sync = true); + void blend_animation(const StringName &p_animation, double p_time, double p_delta, bool p_seeked, bool p_is_external_seeking, real_t p_blend, Animation::LoopedFlag p_looped_flag = Animation::LOOPED_FLAG_NONE); + double blend_node(const StringName &p_sub_path, Ref<AnimationNode> p_node, double p_time, bool p_seek, bool p_is_external_seeking, real_t p_blend, FilterAction p_filter = FILTER_IGNORE, bool p_sync = true); + double blend_input(int p_input, double p_time, bool p_seek, bool p_is_external_seeking, real_t p_blend, FilterAction p_filter = FILTER_IGNORE, bool p_sync = true); void make_invalid(const String &p_reason); AnimationTree *get_animation_tree() const; @@ -135,7 +135,7 @@ public: virtual void get_child_nodes(List<ChildNode> *r_child_nodes); - virtual double process(double p_time, bool p_seek, bool p_seek_root); + virtual double process(double p_time, bool p_seek, bool p_is_external_seeking); virtual String get_caption() const; int get_input_count() const; @@ -294,7 +294,9 @@ private: bool started = true; NodePath root_motion_track; - Transform3D root_motion_transform; + Vector3 root_motion_position = Vector3(0, 0, 0); + Quaternion root_motion_rotation = Quaternion(0, 0, 0, 1); + Vector3 root_motion_scale = Vector3(0, 0, 0); friend class AnimationNode; bool properties_dirty = true; @@ -350,7 +352,9 @@ public: void set_root_motion_track(const NodePath &p_track); NodePath get_root_motion_track() const; - Transform3D get_root_motion_transform() const; + Vector3 get_root_motion_position() const; + Quaternion get_root_motion_rotation() const; + Vector3 get_root_motion_scale() const; real_t get_connection_activity(const StringName &p_path, int p_connection) const; void advance(double p_time); diff --git a/scene/animation/root_motion_view.cpp b/scene/animation/root_motion_view.cpp index 47f08219a9..a6ccb4a576 100644 --- a/scene/animation/root_motion_view.cpp +++ b/scene/animation/root_motion_view.cpp @@ -103,7 +103,8 @@ void RootMotionView::_notification(int p_what) { set_physics_process_internal(false); } - transform = tree->get_root_motion_transform(); + transform.origin = tree->get_root_motion_position(); + transform.basis = tree->get_root_motion_rotation(); // Scale is meaningless. } } @@ -113,9 +114,8 @@ void RootMotionView::_notification(int p_what) { first = false; - transform.orthonormalize(); //don't want scale, too imprecise - - accumulated = accumulated * transform; + accumulated.origin += transform.origin; + accumulated.basis *= transform.basis; accumulated.origin.x = Math::fposmod(accumulated.origin.x, cell_size); if (zero_y) { accumulated.origin.y = 0; diff --git a/scene/debugger/scene_debugger.cpp b/scene/debugger/scene_debugger.cpp index 599a759b08..35ba49563c 100644 --- a/scene/debugger/scene_debugger.cpp +++ b/scene/debugger/scene_debugger.cpp @@ -220,9 +220,31 @@ void SceneDebugger::_save_node(ObjectID id, const String &p_path) { Node *node = Object::cast_to<Node>(ObjectDB::get_instance(id)); ERR_FAIL_COND(!node); + HashMap<const Node *, Node *> duplimap; + Node *copy = node->duplicate_from_editor(duplimap); + + // Handle Unique Nodes. + for (int i = 0; i < copy->get_child_count(false); i++) { + _set_node_owner_recursive(copy->get_child(i, false), copy); + } + // Root node cannot ever be unique name in its own Scene! + copy->set_unique_name_in_owner(false); + Ref<PackedScene> ps = memnew(PackedScene); - ps->pack(node); + ps->pack(copy); ResourceSaver::save(ps, p_path); + + memdelete(copy); +} + +void SceneDebugger::_set_node_owner_recursive(Node *p_node, Node *p_owner) { + if (!p_node->get_owner()) { + p_node->set_owner(p_owner); + } + + for (int i = 0; i < p_node->get_child_count(false); i++) { + _set_node_owner_recursive(p_node->get_child(i, false), p_owner); + } } void SceneDebugger::_send_object_id(ObjectID p_id, int p_max_size) { diff --git a/scene/debugger/scene_debugger.h b/scene/debugger/scene_debugger.h index 0428bfcc2e..34891ef0fd 100644 --- a/scene/debugger/scene_debugger.h +++ b/scene/debugger/scene_debugger.h @@ -56,6 +56,7 @@ public: #ifdef DEBUG_ENABLED private: static void _save_node(ObjectID id, const String &p_path); + static void _set_node_owner_recursive(Node *p_node, Node *p_owner); static void _set_object_property(ObjectID p_id, const String &p_property, const Variant &p_value); static void _send_object_id(ObjectID p_id, int p_max_size = 1 << 20); diff --git a/scene/gui/code_edit.cpp b/scene/gui/code_edit.cpp index 9e0dc049e5..f46daef127 100644 --- a/scene/gui/code_edit.cpp +++ b/scene/gui/code_edit.cpp @@ -378,12 +378,13 @@ void CodeEdit::gui_input(const Ref<InputEvent> &p_gui_input) { } if (symbol_lookup_on_click_enabled) { - if (mm->is_command_or_control_pressed() && mm->get_button_mask() == MouseButton::NONE && !is_dragging_cursor()) { + if (mm->is_command_or_control_pressed() && mm->get_button_mask() == MouseButton::NONE) { + symbol_lookup_pos = get_line_column_at_pos(mpos); symbol_lookup_new_word = get_word_at_pos(mpos); if (symbol_lookup_new_word != symbol_lookup_word) { emit_signal(SNAME("symbol_validate"), symbol_lookup_new_word); } - } else { + } else if (!mm->is_command_or_control_pressed() || (mm->get_button_mask() != MouseButton::NONE && symbol_lookup_pos != get_line_column_at_pos(mpos))) { set_symbol_lookup_word_as_valid(false); } } diff --git a/scene/gui/code_edit.h b/scene/gui/code_edit.h index cbbc13480e..e409c7c82b 100644 --- a/scene/gui/code_edit.h +++ b/scene/gui/code_edit.h @@ -236,6 +236,7 @@ private: String symbol_lookup_new_word = ""; String symbol_lookup_word = ""; + Point2i symbol_lookup_pos; /* Visual */ Ref<StyleBox> style_normal; diff --git a/scene/gui/control.cpp b/scene/gui/control.cpp index 4e76f72921..e90a6a69ab 100644 --- a/scene/gui/control.cpp +++ b/scene/gui/control.cpp @@ -220,6 +220,10 @@ PackedStringArray Control::get_configuration_warnings() const { warnings.push_back(RTR("The Hint Tooltip won't be displayed as the control's Mouse Filter is set to \"Ignore\". To solve this, set the Mouse Filter to \"Stop\" or \"Pass\".")); } + if (get_z_index() != 0) { + warnings.push_back(RTR("Changing the Z index of a control only affects the drawing order, not the input event handling order.")); + } + return warnings; } @@ -481,10 +485,10 @@ void Control::_validate_property(PropertyInfo &p_property) const { } } else if (Object::cast_to<Container>(parent_node)) { // If the parent is a container, display only container-related properties. - if (p_property.name.begins_with("anchor_") || p_property.name.begins_with("offset_") || p_property.name.begins_with("grow_") || p_property.name == "anchors_preset" || - p_property.name == "position" || p_property.name == "rotation" || p_property.name == "scale" || p_property.name == "size" || p_property.name == "pivot_offset") { - p_property.usage ^= PROPERTY_USAGE_EDITOR; - + if (p_property.name.begins_with("anchor_") || p_property.name.begins_with("offset_") || p_property.name.begins_with("grow_") || p_property.name == "anchors_preset") { + p_property.usage ^= PROPERTY_USAGE_DEFAULT; + } else if (p_property.name == "position" || p_property.name == "rotation" || p_property.name == "scale" || p_property.name == "size" || p_property.name == "pivot_offset") { + p_property.usage = PROPERTY_USAGE_EDITOR | PROPERTY_USAGE_READ_ONLY; } else if (p_property.name == "layout_mode") { // Set the layout mode to be disabled with the proper value. p_property.hint_string = "Position,Anchors,Container,Uncontrolled"; @@ -2935,7 +2939,7 @@ void Control::_notification(int p_notification) { queue_redraw(); if (data.RI) { - get_viewport()->_gui_set_root_order_dirty(); + get_viewport()->gui_set_root_order_dirty(); } } break; diff --git a/scene/gui/graph_edit.cpp b/scene/gui/graph_edit.cpp index 40792dd43f..1c4c8c2574 100644 --- a/scene/gui/graph_edit.cpp +++ b/scene/gui/graph_edit.cpp @@ -623,7 +623,7 @@ void GraphEdit::_top_layer_input(const Ref<InputEvent> &p_ev) { //check disconnect for (const Connection &E : connections) { if (E.from == gn->get_name() && E.from_port == j) { - Node *to = get_node(String(E.to)); + Node *to = get_node(NodePath(E.to)); if (Object::cast_to<GraphNode>(to)) { connecting_from = E.to; connecting_index = E.to_port; @@ -637,7 +637,7 @@ void GraphEdit::_top_layer_input(const Ref<InputEvent> &p_ev) { just_disconnected = true; emit_signal(SNAME("disconnection_request"), E.from, E.from_port, E.to, E.to_port); - to = get_node(String(connecting_from)); //maybe it was erased + to = get_node(NodePath(connecting_from)); // Maybe it was erased. if (Object::cast_to<GraphNode>(to)) { connecting = true; emit_signal(SNAME("connection_drag_started"), connecting_from, connecting_index, false); @@ -673,10 +673,10 @@ void GraphEdit::_top_layer_input(const Ref<InputEvent> &p_ev) { if (is_in_input_hotzone(gn, j, click_pos, port_size)) { if (right_disconnects || valid_right_disconnect_types.has(gn->get_connection_input_type(j))) { - //check disconnect + // Check disconnect. for (const Connection &E : connections) { if (E.to == gn->get_name() && E.to_port == j) { - Node *fr = get_node(String(E.from)); + Node *fr = get_node(NodePath(E.from)); if (Object::cast_to<GraphNode>(fr)) { connecting_from = E.from; connecting_index = E.from_port; @@ -689,7 +689,7 @@ void GraphEdit::_top_layer_input(const Ref<InputEvent> &p_ev) { if (connecting_type >= 0) { emit_signal(SNAME("disconnection_request"), E.from, E.from_port, E.to, E.to_port); - fr = get_node(String(connecting_from)); //maybe it was erased + fr = get_node(NodePath(connecting_from)); // Maybe it was erased. if (Object::cast_to<GraphNode>(fr)) { connecting = true; emit_signal(SNAME("connection_drag_started"), connecting_from, connecting_index, true); @@ -780,26 +780,16 @@ void GraphEdit::_top_layer_input(const Ref<InputEvent> &p_ev) { if (mb.is_valid() && mb->get_button_index() == MouseButton::LEFT && !mb->is_pressed()) { if (connecting_valid) { if (connecting && connecting_target) { - String from = connecting_from; - int from_port = connecting_index; - String to = connecting_target_to; - int to_port = connecting_target_index; - - if (!connecting_out) { - SWAP(from, to); - SWAP(from_port, to_port); + if (connecting_out) { + emit_signal(SNAME("connection_request"), connecting_from, connecting_index, connecting_target_to, connecting_target_index); + } else { + emit_signal(SNAME("connection_request"), connecting_target_to, connecting_target_index, connecting_from, connecting_index); } - emit_signal(SNAME("connection_request"), from, from_port, to, to_port); - } else if (!just_disconnected) { - String from = connecting_from; - int from_port = connecting_index; - Vector2 ofs = mb->get_position(); - - if (!connecting_out) { - emit_signal(SNAME("connection_from_empty"), from, from_port, ofs); + if (connecting_out) { + emit_signal(SNAME("connection_to_empty"), connecting_from, connecting_index, mb->get_position()); } else { - emit_signal(SNAME("connection_to_empty"), from, from_port, ofs); + emit_signal(SNAME("connection_from_empty"), connecting_from, connecting_index, mb->get_position()); } } } @@ -935,17 +925,12 @@ void GraphEdit::_draw_connection_line(CanvasItem *p_where, const Vector2 &p_from void GraphEdit::_connections_layer_draw() { Color activity_color = get_theme_color(SNAME("activity")); - //draw connections + // Draw connections. List<List<Connection>::Element *> to_erase; for (List<Connection>::Element *E = connections.front(); E; E = E->next()) { - NodePath fromnp(E->get().from); - - Node *from = get_node(fromnp); - if (!from) { - to_erase.push_back(E); - continue; - } + const Connection &c = E->get(); + Node *from = get_node(NodePath(c.from)); GraphNode *gfrom = Object::cast_to<GraphNode>(from); if (!gfrom) { @@ -953,13 +938,7 @@ void GraphEdit::_connections_layer_draw() { continue; } - NodePath tonp(E->get().to); - Node *to = get_node(tonp); - if (!to) { - to_erase.push_back(E); - continue; - } - + Node *to = get_node(NodePath(c.to)); GraphNode *gto = Object::cast_to<GraphNode>(to); if (!gto) { @@ -967,21 +946,20 @@ void GraphEdit::_connections_layer_draw() { continue; } - Vector2 frompos = gfrom->get_connection_output_position(E->get().from_port) + gfrom->get_position_offset() * zoom; - Color color = gfrom->get_connection_output_color(E->get().from_port); - Vector2 topos = gto->get_connection_input_position(E->get().to_port) + gto->get_position_offset() * zoom; - Color tocolor = gto->get_connection_input_color(E->get().to_port); + Vector2 frompos = gfrom->get_connection_output_position(c.from_port) + gfrom->get_position_offset() * zoom; + Color color = gfrom->get_connection_output_color(c.from_port); + Vector2 topos = gto->get_connection_input_position(c.to_port) + gto->get_position_offset() * zoom; + Color tocolor = gto->get_connection_input_color(c.to_port); - if (E->get().activity > 0) { - color = color.lerp(activity_color, E->get().activity); - tocolor = tocolor.lerp(activity_color, E->get().activity); + if (c.activity > 0) { + color = color.lerp(activity_color, c.activity); + tocolor = tocolor.lerp(activity_color, c.activity); } _draw_connection_line(connections_layer, frompos, topos, color, tocolor, lines_thickness, zoom); } - while (to_erase.size()) { - connections.erase(to_erase.front()->get()); - to_erase.pop_front(); + for (List<Connection>::Element *&E : to_erase) { + connections.erase(E); } } @@ -989,7 +967,7 @@ void GraphEdit::_top_layer_draw() { _update_scroll(); if (connecting) { - Node *fromn = get_node(connecting_from); + Node *fromn = get_node(NodePath(connecting_from)); ERR_FAIL_COND(!fromn); GraphNode *from = Object::cast_to<GraphNode>(fromn); ERR_FAIL_COND(!from); @@ -1087,22 +1065,13 @@ void GraphEdit::_minimap_draw() { // Draw node connections. Color activity_color = get_theme_color(SNAME("activity")); for (const Connection &E : connections) { - NodePath fromnp(E.from); - - Node *from = get_node(fromnp); - if (!from) { - continue; - } + Node *from = get_node(NodePath(E.from)); GraphNode *gfrom = Object::cast_to<GraphNode>(from); if (!gfrom) { continue; } - NodePath tonp(E.to); - Node *to = get_node(tonp); - if (!to) { - continue; - } + Node *to = get_node(NodePath(E.to)); GraphNode *gto = Object::cast_to<GraphNode>(to); if (!gto) { continue; @@ -2428,7 +2397,7 @@ void GraphEdit::_bind_methods() { ADD_SIGNAL(MethodInfo("begin_node_move")); ADD_SIGNAL(MethodInfo("end_node_move")); ADD_SIGNAL(MethodInfo("scroll_offset_changed", PropertyInfo(Variant::VECTOR2, "offset"))); - ADD_SIGNAL(MethodInfo("connection_drag_started", PropertyInfo(Variant::STRING, "from_node"), PropertyInfo(Variant::INT, "from_port"), PropertyInfo(Variant::BOOL, "is_output"))); + ADD_SIGNAL(MethodInfo("connection_drag_started", PropertyInfo(Variant::STRING_NAME, "from_node"), PropertyInfo(Variant::INT, "from_port"), PropertyInfo(Variant::BOOL, "is_output"))); ADD_SIGNAL(MethodInfo("connection_drag_ended")); BIND_ENUM_CONSTANT(SCROLL_ZOOMS); diff --git a/scene/gui/graph_edit.h b/scene/gui/graph_edit.h index 101087bdbd..eda7ddd824 100644 --- a/scene/gui/graph_edit.h +++ b/scene/gui/graph_edit.h @@ -136,14 +136,14 @@ private: bool arrange_nodes_button_hidden = false; bool connecting = false; - String connecting_from; + StringName connecting_from; bool connecting_out = false; int connecting_index = 0; int connecting_type = 0; Color connecting_color; bool connecting_target = false; Vector2 connecting_to; - String connecting_target_to; + StringName connecting_target_to; int connecting_target_index = 0; bool just_disconnected = false; bool connecting_valid = false; diff --git a/scene/gui/graph_node.cpp b/scene/gui/graph_node.cpp index 5df4c066e4..83c789f3d5 100644 --- a/scene/gui/graph_node.cpp +++ b/scene/gui/graph_node.cpp @@ -366,38 +366,46 @@ void GraphNode::_notification(int p_what) { close_rect = Rect2(); } - for (const KeyValue<int, Slot> &E : slot_info) { - if (E.key < 0 || E.key >= cache_y.size()) { - continue; - } - if (!slot_info.has(E.key)) { - continue; - } - const Slot &s = slot_info[E.key]; - // Left port. - if (s.enable_left) { - Ref<Texture2D> p = port; - if (s.custom_slot_left.is_valid()) { - p = s.custom_slot_left; + if (get_child_count() > 0) { + for (const KeyValue<int, Slot> &E : slot_info) { + if (E.key < 0 || E.key >= cache_y.size()) { + continue; } - p->draw(get_canvas_item(), icofs + Point2(edgeofs, cache_y[E.key]), s.color_left); - } - // Right port. - if (s.enable_right) { - Ref<Texture2D> p = port; - if (s.custom_slot_right.is_valid()) { - p = s.custom_slot_right; + if (!slot_info.has(E.key)) { + continue; + } + const Slot &s = slot_info[E.key]; + // Left port. + if (s.enable_left) { + Ref<Texture2D> p = port; + if (s.custom_slot_left.is_valid()) { + p = s.custom_slot_left; + } + p->draw(get_canvas_item(), icofs + Point2(edgeofs, cache_y[E.key]), s.color_left); + } + // Right port. + if (s.enable_right) { + Ref<Texture2D> p = port; + if (s.custom_slot_right.is_valid()) { + p = s.custom_slot_right; + } + p->draw(get_canvas_item(), icofs + Point2(get_size().x - edgeofs, cache_y[E.key]), s.color_right); } - p->draw(get_canvas_item(), icofs + Point2(get_size().x - edgeofs, cache_y[E.key]), s.color_right); - } - // Draw slot stylebox. - if (s.draw_stylebox) { - Control *c = Object::cast_to<Control>(get_child(E.key)); - Rect2 c_rect = c->get_rect(); - c_rect.position.x = sb->get_margin(SIDE_LEFT); - c_rect.size.width = w; - draw_style_box(sb_slot, c_rect); + // Draw slot stylebox. + if (s.draw_stylebox) { + Control *c = Object::cast_to<Control>(get_child(E.key)); + if (!c || !c->is_visible_in_tree()) { + continue; + } + if (c->is_set_as_top_level()) { + continue; + } + Rect2 c_rect = c->get_rect(); + c_rect.position.x = sb->get_margin(SIDE_LEFT); + c_rect.size.width = w; + draw_style_box(sb_slot, c_rect); + } } } diff --git a/scene/gui/line_edit.cpp b/scene/gui/line_edit.cpp index 8a77c39487..bd39ee3bb3 100644 --- a/scene/gui/line_edit.cpp +++ b/scene/gui/line_edit.cpp @@ -768,18 +768,18 @@ void LineEdit::_notification(int p_what) { case NOTIFICATION_WM_WINDOW_FOCUS_IN: { window_has_focus = true; - draw_caret = true; + _validate_caret_can_draw(); queue_redraw(); } break; case NOTIFICATION_WM_WINDOW_FOCUS_OUT: { window_has_focus = false; - draw_caret = false; + _validate_caret_can_draw(); queue_redraw(); } break; case NOTIFICATION_INTERNAL_PROCESS: { - if (caret_blinking) { + if (caret_blink_enabled && caret_can_draw) { caret_blink_timer += get_process_delta_time(); if (caret_blink_timer >= caret_blink_interval) { @@ -790,10 +790,6 @@ void LineEdit::_notification(int p_what) { } break; case NOTIFICATION_DRAW: { - if ((!has_focus() && !(menu && menu->has_focus()) && !caret_force_displayed) || !window_has_focus) { - draw_caret = false; - } - int width, height; bool rtl = is_layout_rtl(); @@ -806,7 +802,6 @@ void LineEdit::_notification(int p_what) { Ref<StyleBox> style = theme_cache.normal; if (!is_editable()) { style = theme_cache.read_only; - draw_caret = false; } Ref<Font> font = theme_cache.font; @@ -953,7 +948,7 @@ void LineEdit::_notification(int p_what) { // Draw carets. ofs.x = x_ofs + scroll_offset; - if (draw_caret || drag_caret_force_displayed) { + if ((caret_can_draw && draw_caret) || drag_caret_force_displayed) { // Prevent carets from disappearing at theme scales below 1.0 (if the caret width is 1). const int caret_width = theme_cache.caret_width * MAX(1, theme_cache.base_scale); @@ -1063,16 +1058,7 @@ void LineEdit::_notification(int p_what) { } break; case NOTIFICATION_FOCUS_ENTER: { - if (!caret_force_displayed) { - if (caret_blink_enabled) { - if (!caret_blinking) { - caret_blinking = true; - caret_blink_timer = 0.0; - } - } else { - draw_caret = true; - } - } + _validate_caret_can_draw(); if (select_all_on_focus) { if (Input::get_singleton()->is_mouse_button_pressed(MouseButton::LEFT)) { @@ -1093,9 +1079,7 @@ void LineEdit::_notification(int p_what) { } break; case NOTIFICATION_FOCUS_EXIT: { - if (caret_blink_enabled && !caret_force_displayed) { - caret_blinking = false; - } + _validate_caret_can_draw(); if (get_viewport()->get_window_id() != DisplayServer::INVALID_WINDOW_ID && DisplayServer::get_singleton()->has_feature(DisplayServer::FEATURE_IME)) { DisplayServer::get_singleton()->window_set_ime_position(Point2(), get_viewport()->get_window_id()); @@ -1401,21 +1385,18 @@ bool LineEdit::is_caret_blink_enabled() const { } void LineEdit::set_caret_blink_enabled(const bool p_enabled) { + if (caret_blink_enabled == p_enabled) { + return; + } + caret_blink_enabled = p_enabled; set_process_internal(p_enabled); - if (has_focus() || caret_force_displayed) { - if (p_enabled) { - if (!caret_blinking) { - caret_blinking = true; - caret_blink_timer = 0.0; - } - } else { - caret_blinking = false; - } + draw_caret = !caret_blink_enabled; + if (caret_blink_enabled) { + caret_blink_timer = 0.0; } - - draw_caret = true; + queue_redraw(); notify_property_list_changed(); } @@ -1425,8 +1406,13 @@ bool LineEdit::is_caret_force_displayed() const { } void LineEdit::set_caret_force_displayed(const bool p_enabled) { + if (caret_force_displayed == p_enabled) { + return; + } + caret_force_displayed = p_enabled; - set_caret_blink_enabled(caret_blink_enabled); + _validate_caret_can_draw(); + queue_redraw(); } @@ -1442,7 +1428,7 @@ void LineEdit::set_caret_blink_interval(const float p_interval) { void LineEdit::_reset_caret_blink_timer() { if (caret_blink_enabled) { draw_caret = true; - if (has_focus()) { + if (caret_can_draw) { caret_blink_timer = 0.0; queue_redraw(); } @@ -1451,11 +1437,19 @@ void LineEdit::_reset_caret_blink_timer() { void LineEdit::_toggle_draw_caret() { draw_caret = !draw_caret; - if (is_visible_in_tree() && ((has_focus() && window_has_focus) || caret_force_displayed)) { + if (is_visible_in_tree() && caret_can_draw) { queue_redraw(); } } +void LineEdit::_validate_caret_can_draw() { + if (caret_blink_enabled) { + draw_caret = true; + caret_blink_timer = 0.0; + } + caret_can_draw = editable && (window_has_focus || (menu && menu->has_focus())) && (has_focus() || caret_force_displayed); +} + void LineEdit::delete_char() { if ((text.length() <= 0) || (caret_column == 0)) { return; @@ -1846,6 +1840,7 @@ void LineEdit::set_editable(bool p_editable) { } editable = p_editable; + _validate_caret_can_draw(); update_minimum_size(); queue_redraw(); @@ -2523,6 +2518,8 @@ void LineEdit::_ensure_menu() { menu->add_child(menu_ctl, false, INTERNAL_MODE_FRONT); menu->connect("id_pressed", callable_mp(this, &LineEdit::menu_option)); + menu->connect(SNAME("focus_entered"), callable_mp(this, &LineEdit::_validate_caret_can_draw)); + menu->connect(SNAME("focus_exited"), callable_mp(this, &LineEdit::_validate_caret_can_draw)); menu_dir->connect("id_pressed", callable_mp(this, &LineEdit::menu_option)); menu_ctl->connect("id_pressed", callable_mp(this, &LineEdit::menu_option)); } diff --git a/scene/gui/line_edit.h b/scene/gui/line_edit.h index e0a079b623..79db9dce21 100644 --- a/scene/gui/line_edit.h +++ b/scene/gui/line_edit.h @@ -172,7 +172,7 @@ private: bool draw_caret = true; float caret_blink_interval = 0.65; double caret_blink_timer = 0.0; - bool caret_blinking = false; + bool caret_can_draw = false; bool pending_select_all_on_focus = false; bool select_all_on_focus = false; @@ -225,6 +225,7 @@ private: void _reset_caret_blink_timer(); void _toggle_draw_caret(); + void _validate_caret_can_draw(); void clear_internal(); diff --git a/scene/gui/range.cpp b/scene/gui/range.cpp index 27002fad38..00c81c8616 100644 --- a/scene/gui/range.cpp +++ b/scene/gui/range.cpp @@ -64,11 +64,6 @@ void Range::_changed_notify(const char *p_what) { queue_redraw(); } -void Range::_validate_values() { - shared->max = MAX(shared->max, shared->min); - shared->page = CLAMP(shared->page, 0, shared->max - shared->min); -} - void Range::Shared::emit_changed(const char *p_what) { for (Range *E : owners) { Range *r = E; @@ -90,7 +85,7 @@ void Range::set_value(double p_val) { void Range::set_value_no_signal(double p_val) { if (shared->step > 0) { - p_val = Math::round(p_val / shared->step) * shared->step; + p_val = Math::round((p_val - shared->min) / shared->step) * shared->step + shared->min; } if (_rounded_values) { @@ -118,8 +113,9 @@ void Range::set_min(double p_min) { } shared->min = p_min; + shared->max = MAX(shared->max, shared->min); + shared->page = CLAMP(shared->page, 0, shared->max - shared->min); set_value(shared->val); - _validate_values(); shared->emit_changed("min"); @@ -127,13 +123,14 @@ void Range::set_min(double p_min) { } void Range::set_max(double p_max) { - if (shared->max == p_max) { + double max_validated = MAX(p_max, shared->min); + if (shared->max == max_validated) { return; } - shared->max = p_max; + shared->max = max_validated; + shared->page = CLAMP(shared->page, 0, shared->max - shared->min); set_value(shared->val); - _validate_values(); shared->emit_changed("max"); } @@ -148,13 +145,13 @@ void Range::set_step(double p_step) { } void Range::set_page(double p_page) { - if (shared->page == p_page) { + double page_validated = CLAMP(p_page, 0, shared->max - shared->min); + if (shared->page == page_validated) { return; } - shared->page = p_page; + shared->page = page_validated; set_value(shared->val); - _validate_values(); shared->emit_changed("page"); } diff --git a/scene/gui/range.h b/scene/gui/range.h index f804155dec..5267216f12 100644 --- a/scene/gui/range.h +++ b/scene/gui/range.h @@ -59,7 +59,6 @@ class Range : public Control { void _value_changed_notify(); void _changed_notify(const char *p_what = ""); - void _validate_values(); protected: virtual void _value_changed(double p_value); diff --git a/scene/gui/rich_text_effect.cpp b/scene/gui/rich_text_effect.cpp index 0dece1c287..20d82095a1 100644 --- a/scene/gui/rich_text_effect.cpp +++ b/scene/gui/rich_text_effect.cpp @@ -88,6 +88,9 @@ void CharFXTransform::_bind_methods() { ClassDB::bind_method(D_METHOD("get_glyph_index"), &CharFXTransform::get_glyph_index); ClassDB::bind_method(D_METHOD("set_glyph_index", "glyph_index"), &CharFXTransform::set_glyph_index); + ClassDB::bind_method(D_METHOD("get_relative_index"), &CharFXTransform::get_relative_index); + ClassDB::bind_method(D_METHOD("set_relative_index", "relative_index"), &CharFXTransform::set_relative_index); + ClassDB::bind_method(D_METHOD("get_glyph_count"), &CharFXTransform::get_glyph_count); ClassDB::bind_method(D_METHOD("set_glyph_count", "glyph_count"), &CharFXTransform::set_glyph_count); @@ -107,5 +110,6 @@ void CharFXTransform::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::INT, "glyph_index"), "set_glyph_index", "get_glyph_index"); ADD_PROPERTY(PropertyInfo(Variant::INT, "glyph_count"), "set_glyph_count", "get_glyph_count"); ADD_PROPERTY(PropertyInfo(Variant::INT, "glyph_flags"), "set_glyph_flags", "get_glyph_flags"); + ADD_PROPERTY(PropertyInfo(Variant::INT, "relative_index"), "set_relative_index", "get_relative_index"); ADD_PROPERTY(PropertyInfo(Variant::RID, "font"), "set_font", "get_font"); } diff --git a/scene/gui/rich_text_effect.h b/scene/gui/rich_text_effect.h index 4532a812ee..66b8a21760 100644 --- a/scene/gui/rich_text_effect.h +++ b/scene/gui/rich_text_effect.h @@ -52,6 +52,7 @@ public: uint32_t glyph_index = 0; uint16_t glyph_flags = 0; uint8_t glyph_count = 0; + int32_t relative_index = 0; RID font; CharFXTransform(); @@ -84,6 +85,9 @@ public: uint8_t get_glyph_count() const { return glyph_count; }; void set_glyph_count(uint8_t p_glyph_count) { glyph_count = p_glyph_count; }; + int32_t get_relative_index() const { return relative_index; }; + void set_relative_index(int32_t p_relative_index) { relative_index = p_relative_index; }; + RID get_font() const { return font; }; void set_font(RID p_font) { font = p_font; }; diff --git a/scene/gui/rich_text_label.cpp b/scene/gui/rich_text_label.cpp index 642a94b23e..60d107cce6 100644 --- a/scene/gui/rich_text_label.cpp +++ b/scene/gui/rich_text_label.cpp @@ -890,7 +890,7 @@ int RichTextLabel::_draw_line(ItemFrame *p_frame, int p_line, const Vector2 &p_o Color odd_row_bg = theme_cache.table_odd_row_bg; Color even_row_bg = theme_cache.table_even_row_bg; Color border = theme_cache.table_border; - int hseparation = theme_cache.table_h_separation; + int h_separation = theme_cache.table_h_separation; int col_count = table->columns.size(); int row_count = table->rows.size(); @@ -908,11 +908,11 @@ int RichTextLabel::_draw_line(ItemFrame *p_frame, int p_line, const Vector2 &p_o coff.x = rect.size.width - table->columns[col].width - coff.x; } if (row % 2 == 0) { - draw_rect(Rect2(p_ofs + rect.position + off + coff - frame->padding.position, Size2(table->columns[col].width + hseparation + frame->padding.position.x + frame->padding.size.x, table->rows[row])), (frame->odd_row_bg != Color(0, 0, 0, 0) ? frame->odd_row_bg : odd_row_bg), true); + draw_rect(Rect2(p_ofs + rect.position + off + coff - frame->padding.position, Size2(table->columns[col].width + h_separation + frame->padding.position.x + frame->padding.size.x, table->rows[row])), (frame->odd_row_bg != Color(0, 0, 0, 0) ? frame->odd_row_bg : odd_row_bg), true); } else { - draw_rect(Rect2(p_ofs + rect.position + off + coff - frame->padding.position, Size2(table->columns[col].width + hseparation + frame->padding.position.x + frame->padding.size.x, table->rows[row])), (frame->even_row_bg != Color(0, 0, 0, 0) ? frame->even_row_bg : even_row_bg), true); + draw_rect(Rect2(p_ofs + rect.position + off + coff - frame->padding.position, Size2(table->columns[col].width + h_separation + frame->padding.position.x + frame->padding.size.x, table->rows[row])), (frame->even_row_bg != Color(0, 0, 0, 0) ? frame->even_row_bg : even_row_bg), true); } - draw_rect(Rect2(p_ofs + rect.position + off + coff - frame->padding.position, Size2(table->columns[col].width + hseparation + frame->padding.position.x + frame->padding.size.x, table->rows[row])), (frame->border != Color(0, 0, 0, 0) ? frame->border : border), false); + draw_rect(Rect2(p_ofs + rect.position + off + coff - frame->padding.position, Size2(table->columns[col].width + h_separation + frame->padding.position.x + frame->padding.size.x, table->rows[row])), (frame->border != Color(0, 0, 0, 0) ? frame->border : border), false); } for (int j = 0; j < (int)frame->lines.size(); j++) { @@ -1005,6 +1005,7 @@ int RichTextLabel::_draw_line(ItemFrame *p_frame, int p_line, const Vector2 &p_o if (!custom_effect.is_null()) { charfx->elapsed_time = item_custom->elapsed_time; charfx->range = Vector2i(l.char_offset + glyphs[i].start, l.char_offset + glyphs[i].end); + charfx->relative_index = l.char_offset + glyphs[i].start - item_fx->char_ofs; charfx->visibility = txt_visible; charfx->outline = true; charfx->font = frid; @@ -1222,6 +1223,7 @@ int RichTextLabel::_draw_line(ItemFrame *p_frame, int p_line, const Vector2 &p_o if (!custom_effect.is_null()) { charfx->elapsed_time = item_custom->elapsed_time; charfx->range = Vector2i(l.char_offset + glyphs[i].start, l.char_offset + glyphs[i].end); + charfx->relative_index = l.char_offset + glyphs[i].start - item_fx->char_ofs; charfx->visibility = txt_visible; charfx->outline = false; charfx->font = frid; @@ -4526,6 +4528,30 @@ void RichTextLabel::append_text(const String &p_bbcode) { } } +void RichTextLabel::scroll_to_selection() { + if (selection.active && selection.from_frame && selection.from_line >= 0 && selection.from_line < (int)selection.from_frame->lines.size()) { + // Selected frame paragraph offset. + float line_offset = selection.from_frame->lines[selection.from_line].offset.y; + + // Add wrapped line offset. + for (int i = 0; i < selection.from_frame->lines[selection.from_line].text_buf->get_line_count(); i++) { + Vector2i range = selection.from_frame->lines[selection.from_line].text_buf->get_line_range(i); + if (range.x <= selection.from_char && range.y >= selection.from_char) { + break; + } + line_offset += selection.from_frame->lines[selection.from_line].text_buf->get_line_size(i).y + theme_cache.line_separation; + } + + // Add nested frame (e.g. table cell) offset. + ItemFrame *it = selection.from_frame; + while (it->parent_frame != nullptr) { + line_offset += it->parent_frame->lines[it->line].offset.y; + it = it->parent_frame; + } + vscroll->set_value(line_offset); + } +} + void RichTextLabel::scroll_to_paragraph(int p_paragraph) { _validate_line_caches(); @@ -4770,7 +4796,7 @@ bool RichTextLabel::search(const String &p_string, bool p_from_selection, bool p char_idx = p_search_previous ? selection.from_char - 1 : selection.to_char; if (!(p_search_previous && char_idx < 0) && _search_line(selection.from_frame, selection.from_line, p_string, char_idx, p_search_previous)) { - scroll_to_line(selection.from_frame->line + selection.from_line); + scroll_to_selection(); queue_redraw(); return true; } @@ -4795,7 +4821,7 @@ bool RichTextLabel::search(const String &p_string, bool p_from_selection, bool p // Search for next element if (_search_table(parent_table, parent_element, p_string, p_search_previous)) { - scroll_to_line(selection.from_frame->line + selection.from_line); + scroll_to_selection(); queue_redraw(); return true; } @@ -4819,7 +4845,7 @@ bool RichTextLabel::search(const String &p_string, bool p_from_selection, bool p } if (_search_line(main, current_line, p_string, char_idx, p_search_previous)) { - scroll_to_line(current_line); + scroll_to_selection(); queue_redraw(); return true; } @@ -5307,6 +5333,7 @@ void RichTextLabel::_bind_methods() { ClassDB::bind_method(D_METHOD("scroll_to_line", "line"), &RichTextLabel::scroll_to_line); ClassDB::bind_method(D_METHOD("scroll_to_paragraph", "paragraph"), &RichTextLabel::scroll_to_paragraph); + ClassDB::bind_method(D_METHOD("scroll_to_selection"), &RichTextLabel::scroll_to_selection); ClassDB::bind_method(D_METHOD("set_tab_size", "spaces"), &RichTextLabel::set_tab_size); ClassDB::bind_method(D_METHOD("get_tab_size"), &RichTextLabel::get_tab_size); diff --git a/scene/gui/rich_text_label.h b/scene/gui/rich_text_label.h index d30baaa8d3..b00cc3d055 100644 --- a/scene/gui/rich_text_label.h +++ b/scene/gui/rich_text_label.h @@ -657,6 +657,8 @@ public: int get_content_height() const; int get_content_width() const; + void scroll_to_selection(); + VScrollBar *get_v_scroll_bar() { return vscroll; } virtual CursorShape get_cursor_shape(const Point2 &p_pos) const override; diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp index cce9fa4f34..e7d704a281 100644 --- a/scene/gui/text_edit.cpp +++ b/scene/gui/text_edit.cpp @@ -7038,8 +7038,8 @@ void TextEdit::_update_selection_mode_word() { if ((col <= carets[caret_idx].selection.selected_word_origin && line == get_selection_line(caret_idx)) || line < get_selection_line(caret_idx)) { carets.write[caret_idx].selection.selecting_column = carets[caret_idx].selection.selected_word_end; select(line, beg, get_selection_line(caret_idx), carets[caret_idx].selection.selected_word_end, caret_idx); - set_caret_line(get_selection_from_line(caret_idx), false, true, 0, caret_idx); - set_caret_column(get_selection_from_column(caret_idx), true, caret_idx); + set_caret_line(line, false, true, 0, caret_idx); + set_caret_column(beg, true, caret_idx); } else { carets.write[caret_idx].selection.selecting_column = carets[caret_idx].selection.selected_word_beg; select(get_selection_line(caret_idx), carets[caret_idx].selection.selected_word_beg, line, end, caret_idx); diff --git a/scene/gui/tree.cpp b/scene/gui/tree.cpp index 2da76883b4..c0990211aa 100644 --- a/scene/gui/tree.cpp +++ b/scene/gui/tree.cpp @@ -1018,7 +1018,7 @@ void TreeItem::set_as_cursor(int p_column) { if (tree->select_mode != Tree::SELECT_MULTI) { return; } - if (tree->selected_col == p_column) { + if (tree->selected_item == this && tree->selected_col == p_column) { return; } tree->selected_item = this; @@ -1337,14 +1337,14 @@ Size2 TreeItem::get_minimum_size(int p_column) { // Icon. if (cell.mode == CELL_MODE_CHECK) { - size.width += parent_tree->theme_cache.checked->get_width() + parent_tree->theme_cache.hseparation; + size.width += parent_tree->theme_cache.checked->get_width() + parent_tree->theme_cache.h_separation; } if (cell.icon.is_valid()) { Size2i icon_size = cell.get_icon_size(); if (cell.icon_max_w > 0 && icon_size.width > cell.icon_max_w) { icon_size.width = cell.icon_max_w; } - size.width += icon_size.width + parent_tree->theme_cache.hseparation; + size.width += icon_size.width + parent_tree->theme_cache.h_separation; size.height = MAX(size.height, icon_size.height); } @@ -1624,8 +1624,8 @@ void Tree::_update_theme_item_cache() { theme_cache.font_color = get_theme_color(SNAME("font_color")); theme_cache.font_selected_color = get_theme_color(SNAME("font_selected_color")); theme_cache.drop_position_color = get_theme_color(SNAME("drop_position_color")); - theme_cache.hseparation = get_theme_constant(SNAME("h_separation")); - theme_cache.vseparation = get_theme_constant(SNAME("v_separation")); + theme_cache.h_separation = get_theme_constant(SNAME("h_separation")); + theme_cache.v_separation = get_theme_constant(SNAME("v_separation")); theme_cache.item_margin = get_theme_constant(SNAME("item_margin")); theme_cache.button_margin = get_theme_constant(SNAME("button_margin")); @@ -1710,7 +1710,7 @@ int Tree::compute_item_height(TreeItem *p_item) const { height = item_min_height; } - height += theme_cache.vseparation; + height += theme_cache.v_separation; return height; } @@ -1720,7 +1720,7 @@ int Tree::get_item_height(TreeItem *p_item) const { return 0; } int height = compute_item_height(p_item); - height += theme_cache.vseparation; + height += theme_cache.v_separation; if (!p_item->collapsed) { /* if not collapsed, check the children */ @@ -1749,7 +1749,7 @@ void Tree::draw_item_rect(TreeItem::Cell &p_cell, const Rect2i &p_rect, const Co if (p_cell.icon_max_w > 0 && bmsize.width > p_cell.icon_max_w) { bmsize.width = p_cell.icon_max_w; } - w += bmsize.width + theme_cache.hseparation; + w += bmsize.width + theme_cache.h_separation; if (rect.size.width > 0 && (w + ts.width) > rect.size.width) { ts.width = rect.size.width - w; } @@ -1783,8 +1783,8 @@ void Tree::draw_item_rect(TreeItem::Cell &p_cell, const Rect2i &p_rect, const Co p_cell.text_buf->draw_outline(ci, draw_pos, p_ol_size, p_ol_color); } p_cell.text_buf->draw(ci, draw_pos, p_color); - rect.position.x += ts.width + theme_cache.hseparation; - rect.size.x -= ts.width + theme_cache.hseparation; + rect.position.x += ts.width + theme_cache.h_separation; + rect.size.x -= ts.width + theme_cache.h_separation; } if (!p_cell.icon.is_null()) { @@ -1796,8 +1796,8 @@ void Tree::draw_item_rect(TreeItem::Cell &p_cell, const Rect2i &p_rect, const Co } p_cell.draw_icon(ci, rect.position + Size2i(0, Math::floor((real_t)(rect.size.y - bmsize.y) / 2)), bmsize, p_icon_color); - rect.position.x += bmsize.x + theme_cache.hseparation; - rect.size.x -= bmsize.x + theme_cache.hseparation; + rect.position.x += bmsize.x + theme_cache.h_separation; + rect.size.x -= bmsize.x + theme_cache.h_separation; } if (!rtl) { @@ -1911,7 +1911,7 @@ int Tree::draw_item(const Point2i &p_pos, const Point2 &p_draw_ofs, const Size2 bool rtl = cache.rtl; /* Calculate height of the label part */ - label_h += theme_cache.vseparation; + label_h += theme_cache.v_separation; /* Draw label, if height fits */ @@ -1922,7 +1922,7 @@ int Tree::draw_item(const Point2i &p_pos, const Point2 &p_draw_ofs, const Size2 ERR_FAIL_COND_V(theme_cache.font.is_null(), -1); - int ofs = p_pos.x + ((p_item->disable_folding || hide_folding) ? theme_cache.hseparation : theme_cache.item_margin); + int ofs = p_pos.x + ((p_item->disable_folding || hide_folding) ? theme_cache.h_separation : theme_cache.item_margin); int skip2 = 0; for (int i = 0; i < columns.size(); i++) { if (skip2) { @@ -1940,8 +1940,8 @@ int Tree::draw_item(const Point2i &p_pos, const Point2 &p_draw_ofs, const Size2 continue; } } else { - ofs += theme_cache.hseparation; - w -= theme_cache.hseparation; + ofs += theme_cache.h_separation; + w -= theme_cache.h_separation; } if (p_item->cells[i].expand_right) { @@ -1998,8 +1998,8 @@ int Tree::draw_item(const Point2i &p_pos, const Point2 &p_draw_ofs, const Size2 Rect2i item_rect = Rect2i(Point2i(ofs, p_pos.y) - theme_cache.offset + p_draw_ofs, Size2i(w, label_h)); Rect2i cell_rect = item_rect; if (i != 0) { - cell_rect.position.x -= theme_cache.hseparation; - cell_rect.size.x += theme_cache.hseparation; + cell_rect.position.x -= theme_cache.h_separation; + cell_rect.size.x += theme_cache.h_separation; } if (theme_cache.draw_guides) { @@ -2051,8 +2051,8 @@ int Tree::draw_item(const Point2i &p_pos, const Point2 &p_draw_ofs, const Size2 r.position.x = p_draw_ofs.x; r.size.x = w + ofs; } else { - r.position.x -= theme_cache.hseparation; - r.size.x += theme_cache.hseparation; + r.position.x -= theme_cache.h_separation; + r.size.x += theme_cache.h_separation; } if (rtl) { r.position.x = get_size().width - r.position.x - r.size.x; @@ -2136,7 +2136,7 @@ int Tree::draw_item(const Point2i &p_pos, const Point2 &p_draw_ofs, const Size2 unchecked->draw(ci, check_ofs); } - int check_w = checked->get_width() + theme_cache.hseparation; + int check_w = checked->get_width() + theme_cache.h_separation; text_pos.x += check_w; @@ -2328,7 +2328,7 @@ int Tree::draw_item(const Point2i &p_pos, const Point2 &p_draw_ofs, const Size2 // Draw relationship lines. if (theme_cache.draw_relationship_lines > 0 && (!hide_root || c->parent != root) && c->is_visible()) { - int root_ofs = children_pos.x + ((p_item->disable_folding || hide_folding) ? theme_cache.hseparation : theme_cache.item_margin); + int root_ofs = children_pos.x + ((p_item->disable_folding || hide_folding) ? theme_cache.h_separation : theme_cache.item_margin); int parent_ofs = p_pos.x + theme_cache.item_margin; Point2i root_pos = Point2i(root_ofs, children_pos.y + label_h / 2) - theme_cache.offset + p_draw_ofs; @@ -2615,7 +2615,7 @@ int Tree::propagate_mouse_event(const Point2i &p_pos, int x_ofs, int y_ofs, int return 0; } - int item_h = compute_item_height(p_item) + theme_cache.vseparation; + int item_h = compute_item_height(p_item) + theme_cache.v_separation; bool skip = (p_item == root && hide_root); @@ -2649,7 +2649,7 @@ int Tree::propagate_mouse_event(const Point2i &p_pos, int x_ofs, int y_ofs, int if (p_item->cells[i].expand_right) { int plus = 1; while (i + plus < columns.size() && !p_item->cells[i + plus].editable && p_item->cells[i + plus].mode == TreeItem::CELL_MODE_STRING && p_item->cells[i + plus].text.is_empty() && p_item->cells[i + plus].icon.is_null()) { - col_width += theme_cache.hseparation; + col_width += theme_cache.h_separation; col_width += get_column_width(i + plus); plus++; } @@ -2669,16 +2669,16 @@ int Tree::propagate_mouse_event(const Point2i &p_pos, int x_ofs, int y_ofs, int if (col == -1) { return -1; } else if (col == 0) { - int margin = x_ofs + theme_cache.item_margin; //-theme_cache.hseparation; + int margin = x_ofs + theme_cache.item_margin; //-theme_cache.h_separation; //int lm = theme_cache.panel_style->get_margin(SIDE_LEFT); col_width -= margin; limit_w -= margin; col_ofs += margin; x -= margin; } else { - col_width -= theme_cache.hseparation; - limit_w -= theme_cache.hseparation; - x -= theme_cache.hseparation; + col_width -= theme_cache.h_separation; + limit_w -= theme_cache.h_separation; + x -= theme_cache.h_separation; } if (!p_item->disable_folding && !hide_folding && !p_item->cells[col].editable && !p_item->cells[col].selectable && p_item->get_first_child()) { @@ -4426,7 +4426,7 @@ int Tree::get_column_minimum_width(int p_column) const { if (p_column == 0) { item_size.width += theme_cache.item_margin * depth; } else { - item_size.width += theme_cache.hseparation; + item_size.width += theme_cache.h_separation; } // Check if the item is wider. @@ -4522,7 +4522,7 @@ int Tree::get_item_offset(TreeItem *p_item) const { ofs += compute_item_height(it); if (it != root || !hide_root) { - ofs += theme_cache.vseparation; + ofs += theme_cache.v_separation; } if (it->first_child && !it->collapsed) { @@ -4561,7 +4561,7 @@ void Tree::ensure_cursor_is_visible() { const int tbh = _get_title_button_height(); y_offset -= tbh; - const int cell_h = compute_item_height(selected_item) + theme_cache.vseparation; + const int cell_h = compute_item_height(selected_item) + theme_cache.v_separation; int screen_h = area_size.height - tbh; if (h_scroll->is_visible()) { screen_h -= h_scroll->get_combined_minimum_size().height; @@ -4727,7 +4727,7 @@ void Tree::scroll_to_item(TreeItem *p_item, bool p_center_on_item) { const int tbh = _get_title_button_height(); y_offset -= tbh; - const int cell_h = compute_item_height(p_item) + theme_cache.vseparation; + const int cell_h = compute_item_height(p_item) + theme_cache.v_separation; int screen_h = area_size.height - tbh; if (h_scroll->is_visible()) { screen_h -= h_scroll->get_combined_minimum_size().height; @@ -4855,7 +4855,7 @@ TreeItem *Tree::_find_item_at_pos(TreeItem *p_item, const Point2 &p_pos, int &r_ Point2 pos = p_pos; if ((root != p_item || !hide_root) && p_item->is_visible()) { - h = compute_item_height(p_item) + theme_cache.vseparation; + h = compute_item_height(p_item) + theme_cache.v_separation; if (pos.y < h) { if (drop_mode_flags == DROP_MODE_ON_ITEM) { section = 0; diff --git a/scene/gui/tree.h b/scene/gui/tree.h index 77a62e1d6a..cdd90fe4c7 100644 --- a/scene/gui/tree.h +++ b/scene/gui/tree.h @@ -531,8 +531,8 @@ private: float base_scale = 1.0; - int hseparation = 0; - int vseparation = 0; + int h_separation = 0; + int v_separation = 0; int item_margin = 0; int button_margin = 0; Point2 offset; diff --git a/scene/main/canvas_item.cpp b/scene/main/canvas_item.cpp index 7bcd4721fc..2563fa5914 100644 --- a/scene/main/canvas_item.cpp +++ b/scene/main/canvas_item.cpp @@ -450,6 +450,39 @@ void CanvasItem::item_rect_changed(bool p_size_changed) { emit_signal(SceneStringNames::get_singleton()->item_rect_changed); } +void CanvasItem::set_z_index(int p_z) { + ERR_FAIL_COND(p_z < RS::CANVAS_ITEM_Z_MIN); + ERR_FAIL_COND(p_z > RS::CANVAS_ITEM_Z_MAX); + z_index = p_z; + RS::get_singleton()->canvas_item_set_z_index(canvas_item, z_index); + update_configuration_warnings(); +} + +void CanvasItem::set_z_as_relative(bool p_enabled) { + if (z_relative == p_enabled) { + return; + } + z_relative = p_enabled; + RS::get_singleton()->canvas_item_set_z_as_relative_to_parent(canvas_item, p_enabled); +} + +bool CanvasItem::is_z_relative() const { + return z_relative; +} + +int CanvasItem::get_z_index() const { + return z_index; +} + +void CanvasItem::set_y_sort_enabled(bool p_enabled) { + y_sort_enabled = p_enabled; + RS::get_singleton()->canvas_item_set_sort_children_by_y(canvas_item, y_sort_enabled); +} + +bool CanvasItem::is_y_sort_enabled() const { + return y_sort_enabled; +} + void CanvasItem::draw_dashed_line(const Point2 &p_from, const Point2 &p_to, const Color &p_color, real_t p_width, real_t p_dash) { ERR_FAIL_COND_MSG(!drawing, "Drawing is only allowed inside NOTIFICATION_DRAW, _draw() function or 'draw' signal."); @@ -913,9 +946,19 @@ void CanvasItem::_bind_methods() { ClassDB::bind_method(D_METHOD("set_modulate", "modulate"), &CanvasItem::set_modulate); ClassDB::bind_method(D_METHOD("get_modulate"), &CanvasItem::get_modulate); + ClassDB::bind_method(D_METHOD("set_self_modulate", "self_modulate"), &CanvasItem::set_self_modulate); ClassDB::bind_method(D_METHOD("get_self_modulate"), &CanvasItem::get_self_modulate); + ClassDB::bind_method(D_METHOD("set_z_index", "z_index"), &Node2D::set_z_index); + ClassDB::bind_method(D_METHOD("get_z_index"), &Node2D::get_z_index); + + ClassDB::bind_method(D_METHOD("set_z_as_relative", "enable"), &Node2D::set_z_as_relative); + ClassDB::bind_method(D_METHOD("is_z_relative"), &Node2D::is_z_relative); + + ClassDB::bind_method(D_METHOD("set_y_sort_enabled", "enabled"), &Node2D::set_y_sort_enabled); + ClassDB::bind_method(D_METHOD("is_y_sort_enabled"), &Node2D::is_y_sort_enabled); + ClassDB::bind_method(D_METHOD("set_draw_behind_parent", "enable"), &CanvasItem::set_draw_behind_parent); ClassDB::bind_method(D_METHOD("is_draw_behind_parent_enabled"), &CanvasItem::is_draw_behind_parent_enabled); @@ -1005,6 +1048,11 @@ void CanvasItem::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::INT, "light_mask", PROPERTY_HINT_LAYERS_2D_RENDER), "set_light_mask", "get_light_mask"); ADD_PROPERTY(PropertyInfo(Variant::INT, "visibility_layer", PROPERTY_HINT_LAYERS_2D_RENDER), "set_visibility_layer", "get_visibility_layer"); + ADD_GROUP("Ordering", ""); + ADD_PROPERTY(PropertyInfo(Variant::INT, "z_index", PROPERTY_HINT_RANGE, itos(RS::CANVAS_ITEM_Z_MIN) + "," + itos(RS::CANVAS_ITEM_Z_MAX) + ",1"), "set_z_index", "get_z_index"); + ADD_PROPERTY(PropertyInfo(Variant::BOOL, "z_as_relative"), "set_z_as_relative", "is_z_relative"); + ADD_PROPERTY(PropertyInfo(Variant::BOOL, "y_sort_enabled"), "set_y_sort_enabled", "is_y_sort_enabled"); + ADD_GROUP("Texture", "texture_"); ADD_PROPERTY(PropertyInfo(Variant::INT, "texture_filter", PROPERTY_HINT_ENUM, "Inherit,Nearest,Linear,Nearest Mipmap,Linear Mipmap,Nearest Mipmap Anisotropic,Linear Mipmap Anisotropic"), "set_texture_filter", "get_texture_filter"); ADD_PROPERTY(PropertyInfo(Variant::INT, "texture_repeat", PROPERTY_HINT_ENUM, "Inherit,Disabled,Enabled,Mirror"), "set_texture_repeat", "get_texture_repeat"); diff --git a/scene/main/canvas_item.h b/scene/main/canvas_item.h index 4e78a175dc..4ace982825 100644 --- a/scene/main/canvas_item.h +++ b/scene/main/canvas_item.h @@ -91,6 +91,10 @@ private: int light_mask = 1; uint32_t visibility_layer = 1; + int z_index = 0; + bool z_relative = true; + bool y_sort_enabled = false; + Window *window = nullptr; bool visible = true; bool parent_visible_in_tree = false; @@ -230,6 +234,17 @@ public: void set_visibility_layer_bit(uint32_t p_visibility_layer, bool p_enable); bool get_visibility_layer_bit(uint32_t p_visibility_layer) const; + /* ORDERING */ + + void set_z_index(int p_z); + int get_z_index() const; + + void set_z_as_relative(bool p_enabled); + bool is_z_relative() const; + + virtual void set_y_sort_enabled(bool p_enabled); + virtual bool is_y_sort_enabled() const; + /* DRAWING API */ void draw_dashed_line(const Point2 &p_from, const Point2 &p_to, const Color &p_color, real_t p_width = 1.0, real_t p_dash = 2.0); diff --git a/scene/main/canvas_layer.cpp b/scene/main/canvas_layer.cpp index be5788739b..5fde18721a 100644 --- a/scene/main/canvas_layer.cpp +++ b/scene/main/canvas_layer.cpp @@ -38,7 +38,7 @@ void CanvasLayer::set_layer(int p_xform) { layer = p_xform; if (viewport.is_valid()) { RenderingServer::get_singleton()->viewport_set_canvas_stacking(viewport, canvas, layer, get_index()); - vp->_gui_set_root_order_dirty(); + vp->gui_set_root_order_dirty(); } } diff --git a/scene/main/node.cpp b/scene/main/node.cpp index 90b996e06b..680c4cd7e4 100644 --- a/scene/main/node.cpp +++ b/scene/main/node.cpp @@ -1660,7 +1660,7 @@ Node *Node::find_common_parent_with(const Node *p_node) const { return const_cast<Node *>(common_parent); } -NodePath Node::get_path_to(const Node *p_node) const { +NodePath Node::get_path_to(const Node *p_node, bool p_use_unique_path) const { ERR_FAIL_NULL_V(p_node, NodePath()); if (this == p_node) { @@ -1690,20 +1690,58 @@ NodePath Node::get_path_to(const Node *p_node) const { visited.clear(); Vector<StringName> path; + StringName up = String(".."); - n = p_node; + if (p_use_unique_path) { + n = p_node; - while (n != common_parent) { - path.push_back(n->get_name()); - n = n->data.parent; - } + bool is_detected = false; + while (n != common_parent) { + if (n->is_unique_name_in_owner() && n->get_owner() == get_owner()) { + path.push_back(UNIQUE_NODE_PREFIX + String(n->get_name())); + is_detected = true; + break; + } + path.push_back(n->get_name()); + n = n->data.parent; + } - n = this; - StringName up = String(".."); + if (!is_detected) { + n = this; - while (n != common_parent) { - path.push_back(up); - n = n->data.parent; + String detected_name; + int up_count = 0; + while (n != common_parent) { + if (n->is_unique_name_in_owner() && n->get_owner() == get_owner()) { + detected_name = n->get_name(); + up_count = 0; + } + up_count++; + n = n->data.parent; + } + + for (int i = 0; i < up_count; i++) { + path.push_back(up); + } + + if (!detected_name.is_empty()) { + path.push_back(UNIQUE_NODE_PREFIX + detected_name); + } + } + } else { + n = p_node; + + while (n != common_parent) { + path.push_back(n->get_name()); + n = n->data.parent; + } + + n = this; + + while (n != common_parent) { + path.push_back(up); + n = n->data.parent; + } } path.reverse(); @@ -2765,7 +2803,7 @@ void Node::_bind_methods() { ClassDB::bind_method(D_METHOD("is_ancestor_of", "node"), &Node::is_ancestor_of); ClassDB::bind_method(D_METHOD("is_greater_than", "node"), &Node::is_greater_than); ClassDB::bind_method(D_METHOD("get_path"), &Node::get_path); - ClassDB::bind_method(D_METHOD("get_path_to", "node"), &Node::get_path_to); + ClassDB::bind_method(D_METHOD("get_path_to", "node", "use_unique_path"), &Node::get_path_to, DEFVAL(false)); ClassDB::bind_method(D_METHOD("add_to_group", "group", "persistent"), &Node::add_to_group, DEFVAL(false)); ClassDB::bind_method(D_METHOD("remove_from_group", "group"), &Node::remove_from_group); ClassDB::bind_method(D_METHOD("is_in_group", "group"), &Node::is_in_group); diff --git a/scene/main/node.h b/scene/main/node.h index e07fb003d4..574f5063e8 100644 --- a/scene/main/node.h +++ b/scene/main/node.h @@ -331,7 +331,7 @@ public: bool is_greater_than(const Node *p_node) const; NodePath get_path() const; - NodePath get_path_to(const Node *p_node) const; + NodePath get_path_to(const Node *p_node, bool p_use_unique_path = false) const; Node *find_common_parent_with(const Node *p_node) const; void add_to_group(const StringName &p_identifier, bool p_persistent = false); diff --git a/scene/main/scene_tree.cpp b/scene/main/scene_tree.cpp index 81a4e3073b..ceb5b76ff2 100644 --- a/scene/main/scene_tree.cpp +++ b/scene/main/scene_tree.cpp @@ -123,9 +123,6 @@ void SceneTree::tree_changed() { void SceneTree::node_added(Node *p_node) { emit_signal(node_added_name, p_node); - if (call_lock > 0) { - call_skip.erase(p_node->get_instance_id()); - } } void SceneTree::node_removed(Node *p_node) { @@ -134,7 +131,7 @@ void SceneTree::node_removed(Node *p_node) { } emit_signal(node_removed_name, p_node); if (call_lock > 0) { - call_skip.insert(p_node->get_instance_id()); + call_skip.insert(p_node); } } @@ -264,7 +261,7 @@ void SceneTree::call_group_flagsp(uint32_t p_call_flags, const StringName &p_gro if (p_call_flags & GROUP_CALL_REVERSE) { for (int i = gr_node_count - 1; i >= 0; i--) { - if (call_lock && call_skip.has(gr_nodes[i]->get_instance_id())) { + if (call_lock && call_skip.has(gr_nodes[i])) { continue; } @@ -278,7 +275,7 @@ void SceneTree::call_group_flagsp(uint32_t p_call_flags, const StringName &p_gro } else { for (int i = 0; i < gr_node_count; i++) { - if (call_lock && call_skip.has(gr_nodes[i]->get_instance_id())) { + if (call_lock && call_skip.has(gr_nodes[i])) { continue; } @@ -317,7 +314,7 @@ void SceneTree::notify_group_flags(uint32_t p_call_flags, const StringName &p_gr if (p_call_flags & GROUP_CALL_REVERSE) { for (int i = gr_node_count - 1; i >= 0; i--) { - if (call_lock && call_skip.has(gr_nodes[i]->get_instance_id())) { + if (call_lock && call_skip.has(gr_nodes[i])) { continue; } @@ -330,7 +327,7 @@ void SceneTree::notify_group_flags(uint32_t p_call_flags, const StringName &p_gr } else { for (int i = 0; i < gr_node_count; i++) { - if (call_lock && call_skip.has(gr_nodes[i]->get_instance_id())) { + if (call_lock && call_skip.has(gr_nodes[i])) { continue; } @@ -368,7 +365,7 @@ void SceneTree::set_group_flags(uint32_t p_call_flags, const StringName &p_group if (p_call_flags & GROUP_CALL_REVERSE) { for (int i = gr_node_count - 1; i >= 0; i--) { - if (call_lock && call_skip.has(gr_nodes[i]->get_instance_id())) { + if (call_lock && call_skip.has(gr_nodes[i])) { continue; } @@ -381,7 +378,7 @@ void SceneTree::set_group_flags(uint32_t p_call_flags, const StringName &p_group } else { for (int i = 0; i < gr_node_count; i++) { - if (call_lock && call_skip.has(gr_nodes[i]->get_instance_id())) { + if (call_lock && call_skip.has(gr_nodes[i])) { continue; } @@ -857,7 +854,7 @@ void SceneTree::_notify_group_pause(const StringName &p_group, int p_notificatio for (int i = 0; i < gr_node_count; i++) { Node *n = gr_nodes[i]; - if (call_lock && call_skip.has(n->get_instance_id())) { + if (call_lock && call_skip.has(n)) { continue; } @@ -907,7 +904,7 @@ void SceneTree::_call_input_pause(const StringName &p_group, CallInputType p_cal } Node *n = gr_nodes[i]; - if (call_lock && call_skip.has(n->get_instance_id())) { + if (call_lock && call_skip.has(n)) { continue; } @@ -1450,7 +1447,7 @@ SceneTree::SceneTree() { ProjectSettings::get_singleton()->set_custom_property_info("rendering/vrs/texture", PropertyInfo(Variant::STRING, "rendering/vrs/texture", - PROPERTY_HINT_FILE, "*.png")); + PROPERTY_HINT_FILE, "*.bmp,*.png,*.tga,*.webp")); if (vrs_mode == 1 && !vrs_texture_path.is_empty()) { Ref<Image> vrs_image; vrs_image.instantiate(); diff --git a/scene/main/scene_tree.h b/scene/main/scene_tree.h index d4fcb288ae..a460e40597 100644 --- a/scene/main/scene_tree.h +++ b/scene/main/scene_tree.h @@ -135,7 +135,7 @@ private: // Safety for when a node is deleted while a group is being called. int call_lock = 0; - HashSet<ObjectID> call_skip; // Skip erased nodes. Store ID instead of pointer to avoid false positives when node is freed and a new node is allocated at the pointed address. + HashSet<Node *> call_skip; // Skip erased nodes. List<ObjectID> delete_queue; diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp index f58bf868ad..fdbcb20d30 100644 --- a/scene/main/viewport.cpp +++ b/scene/main/viewport.cpp @@ -1880,9 +1880,11 @@ void Viewport::_gui_input_event(Ref<InputEvent> p_event) { Ref<InputEventScreenTouch> touch_event = p_event; if (touch_event.is_valid()) { Size2 pos = touch_event->get_position(); + const int touch_index = touch_event->get_index(); if (touch_event->is_pressed()) { Control *over = gui_find_control(pos); if (over) { + gui.touch_focus[touch_index] = over->get_instance_id(); bool stopped = false; if (over->can_process()) { touch_event = touch_event->xformed_by(Transform2D()); // Make a copy. @@ -1899,17 +1901,25 @@ void Viewport::_gui_input_event(Ref<InputEvent> p_event) { } return; } - } else if (touch_event->get_index() == 0 && gui.last_mouse_focus) { + } else { bool stopped = false; - if (gui.last_mouse_focus->can_process()) { + ObjectID control_id = gui.touch_focus[touch_index]; + Control *over = control_id.is_valid() ? Object::cast_to<Control>(ObjectDB::get_instance(control_id)) : nullptr; + if (over && over->can_process()) { touch_event = touch_event->xformed_by(Transform2D()); // Make a copy. - touch_event->set_position(gui.focus_inv_xform.xform(pos)); + if (over == gui.last_mouse_focus) { + pos = gui.focus_inv_xform.xform(pos); + } else { + pos = over->get_global_transform_with_canvas().affine_inverse().xform(pos); + } + touch_event->set_position(pos); - stopped = _gui_call_input(gui.last_mouse_focus, touch_event); + stopped = _gui_call_input(over, touch_event); } if (stopped) { set_input_as_handled(); } + gui.touch_focus.erase(touch_index); return; } } @@ -1944,7 +1954,9 @@ void Viewport::_gui_input_event(Ref<InputEvent> p_event) { Ref<InputEventScreenDrag> drag_event = p_event; if (drag_event.is_valid()) { - Control *over = gui.mouse_focus; + const int drag_event_index = drag_event->get_index(); + ObjectID control_id = gui.touch_focus[drag_event_index]; + Control *over = control_id.is_valid() ? Object::cast_to<Control>(ObjectDB::get_instance(control_id)) : nullptr; if (!over) { over = gui_find_control(drag_event->get_position()); } @@ -2097,7 +2109,7 @@ List<Control *>::Element *Viewport::_gui_add_root_control(Control *p_control) { return gui.roots.push_back(p_control); } -void Viewport::_gui_set_root_order_dirty() { +void Viewport::gui_set_root_order_dirty() { gui.roots_order_dirty = true; } diff --git a/scene/main/viewport.h b/scene/main/viewport.h index dc69ec24d8..bc8cd54603 100644 --- a/scene/main/viewport.h +++ b/scene/main/viewport.h @@ -354,6 +354,7 @@ private: bool forced_mouse_focus = false; //used for menu buttons bool mouse_in_viewport = true; bool key_event_accepted = false; + HashMap<int, ObjectID> touch_focus; Control *mouse_focus = nullptr; Control *last_mouse_focus = nullptr; Control *mouse_click_grabber = nullptr; @@ -456,8 +457,6 @@ private: void _update_canvas_items(Node *p_node); - void _gui_set_root_order_dirty(); - friend class Window; void _sub_window_update_order(); @@ -514,6 +513,8 @@ public: Transform2D get_final_transform() const; + void gui_set_root_order_dirty(); + void set_transparent_background(bool p_enable); bool has_transparent_background() const; diff --git a/scene/resources/animation.cpp b/scene/resources/animation.cpp index da73a479ce..077a53464e 100644 --- a/scene/resources/animation.cpp +++ b/scene/resources/animation.cpp @@ -2705,111 +2705,11 @@ Variant Animation::value_track_interpolate(int p_track, double p_time) const { return Variant(); } -void Animation::_value_track_get_key_indices_in_range(const ValueTrack *vt, double from_time, double to_time, List<int> *p_indices) const { - if (from_time != length && to_time == length) { - to_time = length + CMP_EPSILON; //include a little more if at the end - } - int to = _find(vt->values, to_time); - - if (to >= 0 && from_time == to_time && vt->values[to].time == from_time) { - //find exact (0 delta), return if found - p_indices->push_back(to); - return; - } - // can't really send the events == time, will be sent in the next frame. - // if event>=len then it will probably never be requested by the anim player. - - if (to >= 0 && vt->values[to].time >= to_time) { - to--; - } - - if (to < 0) { - return; // not bother - } - - int from = _find(vt->values, from_time); - - // position in the right first event.+ - if (from < 0 || vt->values[from].time < from_time) { - from++; - } - - int max = vt->values.size(); - - for (int i = from; i <= to; i++) { - ERR_CONTINUE(i < 0 || i >= max); // shouldn't happen - p_indices->push_back(i); - } -} - -void Animation::value_track_get_key_indices(int p_track, double p_time, double p_delta, List<int> *p_indices, int p_pingponged) const { - ERR_FAIL_INDEX(p_track, tracks.size()); - Track *t = tracks[p_track]; - ERR_FAIL_COND(t->type != TYPE_VALUE); - - ValueTrack *vt = static_cast<ValueTrack *>(t); - - double from_time = p_time - p_delta; - double to_time = p_time; - - if (from_time > to_time) { - SWAP(from_time, to_time); - } - - switch (loop_mode) { - case LOOP_NONE: { - if (from_time < 0) { - from_time = 0; - } - if (from_time > length) { - from_time = length; - } - - if (to_time < 0) { - to_time = 0; - } - if (to_time > length) { - to_time = length; - } - } break; - case LOOP_LINEAR: { - from_time = Math::fposmod(from_time, length); - to_time = Math::fposmod(to_time, length); - - if (from_time > to_time) { - // handle loop by splitting - _value_track_get_key_indices_in_range(vt, from_time, length, p_indices); - _value_track_get_key_indices_in_range(vt, 0, to_time, p_indices); - return; - } - } break; - case LOOP_PINGPONG: { - from_time = Math::pingpong(from_time, length); - to_time = Math::pingpong(to_time, length); - - if (p_pingponged == -1) { - // handle loop by splitting - _value_track_get_key_indices_in_range(vt, 0, from_time, p_indices); - _value_track_get_key_indices_in_range(vt, 0, to_time, p_indices); - return; - } - if (p_pingponged == 1) { - // handle loop by splitting - _value_track_get_key_indices_in_range(vt, from_time, length, p_indices); - _value_track_get_key_indices_in_range(vt, to_time, length, p_indices); - return; - } - } break; - } - - _value_track_get_key_indices_in_range(vt, from_time, to_time, p_indices); -} - void Animation::value_track_set_update_mode(int p_track, UpdateMode p_mode) { ERR_FAIL_INDEX(p_track, tracks.size()); Track *t = tracks[p_track]; ERR_FAIL_COND(t->type != TYPE_VALUE); - ERR_FAIL_INDEX((int)p_mode, 4); + ERR_FAIL_INDEX((int)p_mode, 3); ValueTrack *vt = static_cast<ValueTrack *>(t); vt->update_mode = p_mode; @@ -2826,47 +2726,74 @@ Animation::UpdateMode Animation::value_track_get_update_mode(int p_track) const } template <class T> -void Animation::_track_get_key_indices_in_range(const Vector<T> &p_array, double from_time, double to_time, List<int> *p_indices) const { - if (from_time != length && to_time == length) { - to_time = length + CMP_EPSILON; //include a little more if at the end +void Animation::_track_get_key_indices_in_range(const Vector<T> &p_array, double from_time, double to_time, List<int> *p_indices, bool p_is_backward) const { + int len = p_array.size(); + if (len == 0) { + return; } - int to = _find(p_array, to_time); - - // can't really send the events == time, will be sent in the next frame. - // if event>=len then it will probably never be requested by the anim player. + int from = 0; + int to = len - 1; - if (to >= 0 && p_array[to].time >= to_time) { - to--; + if (!p_is_backward) { + while (p_array[from].time < from_time || Math::is_equal_approx(p_array[from].time, from_time)) { + from++; + if (to < from) { + return; + } + } + while (p_array[to].time > to_time && !Math::is_equal_approx(p_array[to].time, to_time)) { + to--; + if (to < from) { + return; + } + } + } else { + while (p_array[from].time < from_time && !Math::is_equal_approx(p_array[from].time, from_time)) { + from++; + if (to < from) { + return; + } + } + while (p_array[to].time > to_time || Math::is_equal_approx(p_array[to].time, to_time)) { + to--; + if (to < from) { + return; + } + } } - if (to < 0) { - return; // not bother + if (from == to) { + p_indices->push_back(from); + return; } - int from = _find(p_array, from_time); - - // position in the right first event.+ - if (from < 0 || p_array[from].time < from_time) { - from++; + if (!p_is_backward) { + for (int i = from; i <= to; i++) { + p_indices->push_back(i); + } + } else { + for (int i = to; i >= to; i--) { + p_indices->push_back(i); + } } +} - int max = p_array.size(); +void Animation::track_get_key_indices_in_range(int p_track, double p_time, double p_delta, List<int> *p_indices, Animation::LoopedFlag p_looped_flag) const { + ERR_FAIL_INDEX(p_track, tracks.size()); - for (int i = from; i <= to; i++) { - ERR_CONTINUE(i < 0 || i >= max); // shouldn't happen - p_indices->push_back(i); + if (p_delta == 0) { + return; // Prevent to get key continuously. } -} -void Animation::track_get_key_indices_in_range(int p_track, double p_time, double p_delta, List<int> *p_indices, int p_pingponged) const { - ERR_FAIL_INDEX(p_track, tracks.size()); const Track *t = tracks[p_track]; double from_time = p_time - p_delta; double to_time = p_time; + bool is_backward = false; if (from_time > to_time) { + is_backward = true; SWAP(from_time, to_time); } @@ -2895,7 +2822,10 @@ void Animation::track_get_key_indices_in_range(int p_track, double p_time, doubl } if (from_time > to_time) { - // handle loop by splitting + // Handle loop by splitting. + double anim_end = length + CMP_EPSILON; + double anim_start = -CMP_EPSILON; + switch (t->type) { case TYPE_POSITION_3D: { const PositionTrack *tt = static_cast<const PositionTrack *>(t); @@ -2903,8 +2833,13 @@ void Animation::track_get_key_indices_in_range(int p_track, double p_time, doubl _get_compressed_key_indices_in_range<3>(tt->compressed_track, from_time, length, p_indices); _get_compressed_key_indices_in_range<3>(tt->compressed_track, 0, to_time, p_indices); } else { - _track_get_key_indices_in_range(tt->positions, from_time, length, p_indices); - _track_get_key_indices_in_range(tt->positions, 0, to_time, p_indices); + if (!is_backward) { + _track_get_key_indices_in_range(tt->positions, from_time, anim_end, p_indices, is_backward); + _track_get_key_indices_in_range(tt->positions, anim_start, to_time, p_indices, is_backward); + } else { + _track_get_key_indices_in_range(tt->positions, anim_start, to_time, p_indices, is_backward); + _track_get_key_indices_in_range(tt->positions, from_time, anim_end, p_indices, is_backward); + } } } break; case TYPE_ROTATION_3D: { @@ -2913,8 +2848,13 @@ void Animation::track_get_key_indices_in_range(int p_track, double p_time, doubl _get_compressed_key_indices_in_range<3>(rt->compressed_track, from_time, length, p_indices); _get_compressed_key_indices_in_range<3>(rt->compressed_track, 0, to_time, p_indices); } else { - _track_get_key_indices_in_range(rt->rotations, from_time, length, p_indices); - _track_get_key_indices_in_range(rt->rotations, 0, to_time, p_indices); + if (!is_backward) { + _track_get_key_indices_in_range(rt->rotations, from_time, anim_end, p_indices, is_backward); + _track_get_key_indices_in_range(rt->rotations, anim_start, to_time, p_indices, is_backward); + } else { + _track_get_key_indices_in_range(rt->rotations, anim_start, to_time, p_indices, is_backward); + _track_get_key_indices_in_range(rt->rotations, from_time, anim_end, p_indices, is_backward); + } } } break; case TYPE_SCALE_3D: { @@ -2923,8 +2863,13 @@ void Animation::track_get_key_indices_in_range(int p_track, double p_time, doubl _get_compressed_key_indices_in_range<3>(st->compressed_track, from_time, length, p_indices); _get_compressed_key_indices_in_range<3>(st->compressed_track, 0, to_time, p_indices); } else { - _track_get_key_indices_in_range(st->scales, from_time, length, p_indices); - _track_get_key_indices_in_range(st->scales, 0, to_time, p_indices); + if (!is_backward) { + _track_get_key_indices_in_range(st->scales, from_time, anim_end, p_indices, is_backward); + _track_get_key_indices_in_range(st->scales, anim_start, to_time, p_indices, is_backward); + } else { + _track_get_key_indices_in_range(st->scales, anim_start, to_time, p_indices, is_backward); + _track_get_key_indices_in_range(st->scales, from_time, anim_end, p_indices, is_backward); + } } } break; case TYPE_BLEND_SHAPE: { @@ -2933,38 +2878,83 @@ void Animation::track_get_key_indices_in_range(int p_track, double p_time, doubl _get_compressed_key_indices_in_range<1>(bst->compressed_track, from_time, length, p_indices); _get_compressed_key_indices_in_range<1>(bst->compressed_track, 0, to_time, p_indices); } else { - _track_get_key_indices_in_range(bst->blend_shapes, from_time, length, p_indices); - _track_get_key_indices_in_range(bst->blend_shapes, 0, to_time, p_indices); + if (!is_backward) { + _track_get_key_indices_in_range(bst->blend_shapes, from_time, anim_end, p_indices, is_backward); + _track_get_key_indices_in_range(bst->blend_shapes, anim_start, to_time, p_indices, is_backward); + } else { + _track_get_key_indices_in_range(bst->blend_shapes, anim_start, to_time, p_indices, is_backward); + _track_get_key_indices_in_range(bst->blend_shapes, from_time, anim_end, p_indices, is_backward); + } } } break; case TYPE_VALUE: { const ValueTrack *vt = static_cast<const ValueTrack *>(t); - _track_get_key_indices_in_range(vt->values, from_time, length, p_indices); - _track_get_key_indices_in_range(vt->values, 0, to_time, p_indices); + if (!is_backward) { + _track_get_key_indices_in_range(vt->values, from_time, anim_end, p_indices, is_backward); + _track_get_key_indices_in_range(vt->values, anim_start, to_time, p_indices, is_backward); + } else { + _track_get_key_indices_in_range(vt->values, anim_start, to_time, p_indices, is_backward); + _track_get_key_indices_in_range(vt->values, from_time, anim_end, p_indices, is_backward); + } } break; case TYPE_METHOD: { const MethodTrack *mt = static_cast<const MethodTrack *>(t); - _track_get_key_indices_in_range(mt->methods, from_time, length, p_indices); - _track_get_key_indices_in_range(mt->methods, 0, to_time, p_indices); + if (!is_backward) { + _track_get_key_indices_in_range(mt->methods, from_time, anim_end, p_indices, is_backward); + _track_get_key_indices_in_range(mt->methods, anim_start, to_time, p_indices, is_backward); + } else { + _track_get_key_indices_in_range(mt->methods, anim_start, to_time, p_indices, is_backward); + _track_get_key_indices_in_range(mt->methods, from_time, anim_end, p_indices, is_backward); + } } break; case TYPE_BEZIER: { const BezierTrack *bz = static_cast<const BezierTrack *>(t); - _track_get_key_indices_in_range(bz->values, from_time, length, p_indices); - _track_get_key_indices_in_range(bz->values, 0, to_time, p_indices); + if (!is_backward) { + _track_get_key_indices_in_range(bz->values, from_time, anim_end, p_indices, is_backward); + _track_get_key_indices_in_range(bz->values, anim_start, to_time, p_indices, is_backward); + } else { + _track_get_key_indices_in_range(bz->values, anim_start, to_time, p_indices, is_backward); + _track_get_key_indices_in_range(bz->values, from_time, anim_end, p_indices, is_backward); + } } break; case TYPE_AUDIO: { const AudioTrack *ad = static_cast<const AudioTrack *>(t); - _track_get_key_indices_in_range(ad->values, from_time, length, p_indices); - _track_get_key_indices_in_range(ad->values, 0, to_time, p_indices); + if (!is_backward) { + _track_get_key_indices_in_range(ad->values, from_time, anim_end, p_indices, is_backward); + _track_get_key_indices_in_range(ad->values, anim_start, to_time, p_indices, is_backward); + } else { + _track_get_key_indices_in_range(ad->values, anim_start, to_time, p_indices, is_backward); + _track_get_key_indices_in_range(ad->values, from_time, anim_end, p_indices, is_backward); + } } break; case TYPE_ANIMATION: { const AnimationTrack *an = static_cast<const AnimationTrack *>(t); - _track_get_key_indices_in_range(an->values, from_time, length, p_indices); - _track_get_key_indices_in_range(an->values, 0, to_time, p_indices); + if (!is_backward) { + _track_get_key_indices_in_range(an->values, from_time, anim_end, p_indices, is_backward); + _track_get_key_indices_in_range(an->values, anim_start, to_time, p_indices, is_backward); + } else { + _track_get_key_indices_in_range(an->values, anim_start, to_time, p_indices, is_backward); + _track_get_key_indices_in_range(an->values, from_time, anim_end, p_indices, is_backward); + } } break; } return; } + + // Not from_time > to_time but most recent of looping... + if (p_looped_flag != Animation::LOOPED_FLAG_NONE) { + if (!is_backward && Math::is_equal_approx(from_time, 0)) { + int edge = track_find_key(p_track, 0, true); + if (edge >= 0) { + p_indices->push_back(edge); + } + } else if (is_backward && Math::is_equal_approx(to_time, length)) { + int edge = track_find_key(p_track, length, true); + if (edge >= 0) { + p_indices->push_back(edge); + } + } + } } break; case LOOP_PINGPONG: { if (from_time > length || from_time < 0) { @@ -2974,160 +2964,164 @@ void Animation::track_get_key_indices_in_range(int p_track, double p_time, doubl to_time = Math::pingpong(to_time, length); } - if ((int)Math::floor(abs(p_delta) / length) % 2 == 0) { - if (p_pingponged == -1) { - // handle loop by splitting - switch (t->type) { - case TYPE_POSITION_3D: { - const PositionTrack *tt = static_cast<const PositionTrack *>(t); - if (tt->compressed_track >= 0) { - _get_compressed_key_indices_in_range<3>(tt->compressed_track, 0, from_time, p_indices); - _get_compressed_key_indices_in_range<3>(tt->compressed_track, 0, to_time, p_indices); - } else { - _track_get_key_indices_in_range(tt->positions, 0, from_time, p_indices); - _track_get_key_indices_in_range(tt->positions, 0, to_time, p_indices); - } - } break; - case TYPE_ROTATION_3D: { - const RotationTrack *rt = static_cast<const RotationTrack *>(t); - if (rt->compressed_track >= 0) { - _get_compressed_key_indices_in_range<3>(rt->compressed_track, 0, from_time, p_indices); - _get_compressed_key_indices_in_range<3>(rt->compressed_track, 0, to_time, p_indices); - } else { - _track_get_key_indices_in_range(rt->rotations, 0, from_time, p_indices); - _track_get_key_indices_in_range(rt->rotations, 0, to_time, p_indices); - } - } break; - case TYPE_SCALE_3D: { - const ScaleTrack *st = static_cast<const ScaleTrack *>(t); - if (st->compressed_track >= 0) { - _get_compressed_key_indices_in_range<3>(st->compressed_track, 0, from_time, p_indices); - _get_compressed_key_indices_in_range<3>(st->compressed_track, 0, to_time, p_indices); - } else { - _track_get_key_indices_in_range(st->scales, 0, from_time, p_indices); - _track_get_key_indices_in_range(st->scales, 0, to_time, p_indices); - } - } break; - case TYPE_BLEND_SHAPE: { - const BlendShapeTrack *bst = static_cast<const BlendShapeTrack *>(t); - if (bst->compressed_track >= 0) { - _get_compressed_key_indices_in_range<1>(bst->compressed_track, 0, from_time, p_indices); - _get_compressed_key_indices_in_range<1>(bst->compressed_track, 0, to_time, p_indices); - } else { - _track_get_key_indices_in_range(bst->blend_shapes, 0, from_time, p_indices); - _track_get_key_indices_in_range(bst->blend_shapes, 0, to_time, p_indices); - } - } break; - case TYPE_VALUE: { - const ValueTrack *vt = static_cast<const ValueTrack *>(t); - _track_get_key_indices_in_range(vt->values, 0, from_time, p_indices); - _track_get_key_indices_in_range(vt->values, 0, to_time, p_indices); - } break; - case TYPE_METHOD: { - const MethodTrack *mt = static_cast<const MethodTrack *>(t); - _track_get_key_indices_in_range(mt->methods, 0, from_time, p_indices); - _track_get_key_indices_in_range(mt->methods, 0, to_time, p_indices); - } break; - case TYPE_BEZIER: { - const BezierTrack *bz = static_cast<const BezierTrack *>(t); - _track_get_key_indices_in_range(bz->values, 0, from_time, p_indices); - _track_get_key_indices_in_range(bz->values, 0, to_time, p_indices); - } break; - case TYPE_AUDIO: { - const AudioTrack *ad = static_cast<const AudioTrack *>(t); - _track_get_key_indices_in_range(ad->values, 0, from_time, p_indices); - _track_get_key_indices_in_range(ad->values, 0, to_time, p_indices); - } break; - case TYPE_ANIMATION: { - const AnimationTrack *an = static_cast<const AnimationTrack *>(t); - _track_get_key_indices_in_range(an->values, 0, from_time, p_indices); - _track_get_key_indices_in_range(an->values, 0, to_time, p_indices); - } break; - } - return; + if (p_looped_flag == Animation::LOOPED_FLAG_START) { + // Handle loop by splitting. + switch (t->type) { + case TYPE_POSITION_3D: { + const PositionTrack *tt = static_cast<const PositionTrack *>(t); + if (tt->compressed_track >= 0) { + _get_compressed_key_indices_in_range<3>(tt->compressed_track, 0, from_time, p_indices); + _get_compressed_key_indices_in_range<3>(tt->compressed_track, CMP_EPSILON, to_time, p_indices); + } else { + _track_get_key_indices_in_range(tt->positions, 0, from_time, p_indices, true); + _track_get_key_indices_in_range(tt->positions, 0, to_time, p_indices, false); + } + } break; + case TYPE_ROTATION_3D: { + const RotationTrack *rt = static_cast<const RotationTrack *>(t); + if (rt->compressed_track >= 0) { + _get_compressed_key_indices_in_range<3>(rt->compressed_track, 0, from_time, p_indices); + _get_compressed_key_indices_in_range<3>(rt->compressed_track, CMP_EPSILON, to_time, p_indices); + } else { + _track_get_key_indices_in_range(rt->rotations, 0, from_time, p_indices, true); + _track_get_key_indices_in_range(rt->rotations, 0, to_time, p_indices, false); + } + } break; + case TYPE_SCALE_3D: { + const ScaleTrack *st = static_cast<const ScaleTrack *>(t); + if (st->compressed_track >= 0) { + _get_compressed_key_indices_in_range<3>(st->compressed_track, 0, from_time, p_indices); + _get_compressed_key_indices_in_range<3>(st->compressed_track, 0, to_time, p_indices); + } else { + _track_get_key_indices_in_range(st->scales, 0, from_time, p_indices, true); + _track_get_key_indices_in_range(st->scales, 0, to_time, p_indices, false); + } + } break; + case TYPE_BLEND_SHAPE: { + const BlendShapeTrack *bst = static_cast<const BlendShapeTrack *>(t); + if (bst->compressed_track >= 0) { + _get_compressed_key_indices_in_range<1>(bst->compressed_track, 0, from_time, p_indices); + _get_compressed_key_indices_in_range<1>(bst->compressed_track, 0, to_time, p_indices); + } else { + _track_get_key_indices_in_range(bst->blend_shapes, 0, from_time, p_indices, true); + _track_get_key_indices_in_range(bst->blend_shapes, 0, to_time, p_indices, false); + } + } break; + case TYPE_VALUE: { + const ValueTrack *vt = static_cast<const ValueTrack *>(t); + _track_get_key_indices_in_range(vt->values, 0, from_time, p_indices, true); + _track_get_key_indices_in_range(vt->values, 0, to_time, p_indices, false); + } break; + case TYPE_METHOD: { + const MethodTrack *mt = static_cast<const MethodTrack *>(t); + _track_get_key_indices_in_range(mt->methods, 0, from_time, p_indices, true); + _track_get_key_indices_in_range(mt->methods, 0, to_time, p_indices, false); + } break; + case TYPE_BEZIER: { + const BezierTrack *bz = static_cast<const BezierTrack *>(t); + _track_get_key_indices_in_range(bz->values, 0, from_time, p_indices, true); + _track_get_key_indices_in_range(bz->values, 0, to_time, p_indices, false); + } break; + case TYPE_AUDIO: { + const AudioTrack *ad = static_cast<const AudioTrack *>(t); + _track_get_key_indices_in_range(ad->values, 0, from_time, p_indices, true); + _track_get_key_indices_in_range(ad->values, 0, to_time, p_indices, false); + } break; + case TYPE_ANIMATION: { + const AnimationTrack *an = static_cast<const AnimationTrack *>(t); + _track_get_key_indices_in_range(an->values, 0, from_time, p_indices, true); + _track_get_key_indices_in_range(an->values, 0, to_time, p_indices, false); + } break; } - if (p_pingponged == 1) { - // handle loop by splitting - switch (t->type) { - case TYPE_POSITION_3D: { - const PositionTrack *tt = static_cast<const PositionTrack *>(t); - if (tt->compressed_track >= 0) { - _get_compressed_key_indices_in_range<3>(tt->compressed_track, from_time, length, p_indices); - _get_compressed_key_indices_in_range<3>(tt->compressed_track, to_time, length, p_indices); - } else { - _track_get_key_indices_in_range(tt->positions, from_time, length, p_indices); - _track_get_key_indices_in_range(tt->positions, to_time, length, p_indices); - } - } break; - case TYPE_ROTATION_3D: { - const RotationTrack *rt = static_cast<const RotationTrack *>(t); - if (rt->compressed_track >= 0) { - _get_compressed_key_indices_in_range<3>(rt->compressed_track, from_time, length, p_indices); - _get_compressed_key_indices_in_range<3>(rt->compressed_track, to_time, length, p_indices); - } else { - _track_get_key_indices_in_range(rt->rotations, from_time, length, p_indices); - _track_get_key_indices_in_range(rt->rotations, to_time, length, p_indices); - } - } break; - case TYPE_SCALE_3D: { - const ScaleTrack *st = static_cast<const ScaleTrack *>(t); - if (st->compressed_track >= 0) { - _get_compressed_key_indices_in_range<3>(st->compressed_track, from_time, length, p_indices); - _get_compressed_key_indices_in_range<3>(st->compressed_track, to_time, length, p_indices); - } else { - _track_get_key_indices_in_range(st->scales, from_time, length, p_indices); - _track_get_key_indices_in_range(st->scales, to_time, length, p_indices); - } - } break; - case TYPE_BLEND_SHAPE: { - const BlendShapeTrack *bst = static_cast<const BlendShapeTrack *>(t); - if (bst->compressed_track >= 0) { - _get_compressed_key_indices_in_range<1>(bst->compressed_track, from_time, length, p_indices); - _get_compressed_key_indices_in_range<1>(bst->compressed_track, to_time, length, p_indices); - } else { - _track_get_key_indices_in_range(bst->blend_shapes, from_time, length, p_indices); - _track_get_key_indices_in_range(bst->blend_shapes, to_time, length, p_indices); - } - } break; - case TYPE_VALUE: { - const ValueTrack *vt = static_cast<const ValueTrack *>(t); - _track_get_key_indices_in_range(vt->values, from_time, length, p_indices); - _track_get_key_indices_in_range(vt->values, to_time, length, p_indices); - } break; - case TYPE_METHOD: { - const MethodTrack *mt = static_cast<const MethodTrack *>(t); - _track_get_key_indices_in_range(mt->methods, from_time, length, p_indices); - _track_get_key_indices_in_range(mt->methods, to_time, length, p_indices); - } break; - case TYPE_BEZIER: { - const BezierTrack *bz = static_cast<const BezierTrack *>(t); - _track_get_key_indices_in_range(bz->values, from_time, length, p_indices); - _track_get_key_indices_in_range(bz->values, to_time, length, p_indices); - } break; - case TYPE_AUDIO: { - const AudioTrack *ad = static_cast<const AudioTrack *>(t); - _track_get_key_indices_in_range(ad->values, from_time, length, p_indices); - _track_get_key_indices_in_range(ad->values, to_time, length, p_indices); - } break; - case TYPE_ANIMATION: { - const AnimationTrack *an = static_cast<const AnimationTrack *>(t); - _track_get_key_indices_in_range(an->values, from_time, length, p_indices); - _track_get_key_indices_in_range(an->values, to_time, length, p_indices); - } break; - } - return; + return; + } + if (p_looped_flag == Animation::LOOPED_FLAG_END) { + // Handle loop by splitting. + switch (t->type) { + case TYPE_POSITION_3D: { + const PositionTrack *tt = static_cast<const PositionTrack *>(t); + if (tt->compressed_track >= 0) { + _get_compressed_key_indices_in_range<3>(tt->compressed_track, from_time, length, p_indices); + _get_compressed_key_indices_in_range<3>(tt->compressed_track, to_time, length, p_indices); + } else { + _track_get_key_indices_in_range(tt->positions, from_time, length, p_indices, false); + _track_get_key_indices_in_range(tt->positions, to_time, length, p_indices, true); + } + } break; + case TYPE_ROTATION_3D: { + const RotationTrack *rt = static_cast<const RotationTrack *>(t); + if (rt->compressed_track >= 0) { + _get_compressed_key_indices_in_range<3>(rt->compressed_track, from_time, length, p_indices); + _get_compressed_key_indices_in_range<3>(rt->compressed_track, to_time, length, p_indices); + } else { + _track_get_key_indices_in_range(rt->rotations, from_time, length, p_indices, false); + _track_get_key_indices_in_range(rt->rotations, to_time, length, p_indices, true); + } + } break; + case TYPE_SCALE_3D: { + const ScaleTrack *st = static_cast<const ScaleTrack *>(t); + if (st->compressed_track >= 0) { + _get_compressed_key_indices_in_range<3>(st->compressed_track, from_time, length, p_indices); + _get_compressed_key_indices_in_range<3>(st->compressed_track, to_time, length, p_indices); + } else { + _track_get_key_indices_in_range(st->scales, from_time, length, p_indices, false); + _track_get_key_indices_in_range(st->scales, to_time, length, p_indices, true); + } + } break; + case TYPE_BLEND_SHAPE: { + const BlendShapeTrack *bst = static_cast<const BlendShapeTrack *>(t); + if (bst->compressed_track >= 0) { + _get_compressed_key_indices_in_range<1>(bst->compressed_track, from_time, length, p_indices); + _get_compressed_key_indices_in_range<1>(bst->compressed_track, to_time, length - CMP_EPSILON, p_indices); + } else { + _track_get_key_indices_in_range(bst->blend_shapes, from_time, length, p_indices, false); + _track_get_key_indices_in_range(bst->blend_shapes, to_time, length, p_indices, true); + } + } break; + case TYPE_VALUE: { + const ValueTrack *vt = static_cast<const ValueTrack *>(t); + _track_get_key_indices_in_range(vt->values, from_time, length, p_indices, false); + _track_get_key_indices_in_range(vt->values, to_time, length, p_indices, true); + } break; + case TYPE_METHOD: { + const MethodTrack *mt = static_cast<const MethodTrack *>(t); + _track_get_key_indices_in_range(mt->methods, from_time, length, p_indices, false); + _track_get_key_indices_in_range(mt->methods, to_time, length, p_indices, true); + } break; + case TYPE_BEZIER: { + const BezierTrack *bz = static_cast<const BezierTrack *>(t); + _track_get_key_indices_in_range(bz->values, from_time, length, p_indices, false); + _track_get_key_indices_in_range(bz->values, to_time, length, p_indices, true); + } break; + case TYPE_AUDIO: { + const AudioTrack *ad = static_cast<const AudioTrack *>(t); + _track_get_key_indices_in_range(ad->values, from_time, length, p_indices, false); + _track_get_key_indices_in_range(ad->values, to_time, length, p_indices, true); + } break; + case TYPE_ANIMATION: { + const AnimationTrack *an = static_cast<const AnimationTrack *>(t); + _track_get_key_indices_in_range(an->values, from_time, length, p_indices, false); + _track_get_key_indices_in_range(an->values, to_time, length, p_indices, true); + } break; } + return; + } + + // The edge will be pingponged in the next frame and processed there, so let's ignore it now... + if (!is_backward && Math::is_equal_approx(to_time, length)) { + to_time = length - CMP_EPSILON; + } else if (is_backward && Math::is_equal_approx(from_time, 0)) { + from_time = CMP_EPSILON; } } break; } - switch (t->type) { case TYPE_POSITION_3D: { const PositionTrack *tt = static_cast<const PositionTrack *>(t); if (tt->compressed_track >= 0) { _get_compressed_key_indices_in_range<3>(tt->compressed_track, from_time, to_time - from_time, p_indices); } else { - _track_get_key_indices_in_range(tt->positions, from_time, to_time, p_indices); + _track_get_key_indices_in_range(tt->positions, from_time, to_time, p_indices, is_backward); } } break; case TYPE_ROTATION_3D: { @@ -3135,7 +3129,7 @@ void Animation::track_get_key_indices_in_range(int p_track, double p_time, doubl if (rt->compressed_track >= 0) { _get_compressed_key_indices_in_range<3>(rt->compressed_track, from_time, to_time - from_time, p_indices); } else { - _track_get_key_indices_in_range(rt->rotations, from_time, to_time, p_indices); + _track_get_key_indices_in_range(rt->rotations, from_time, to_time, p_indices, is_backward); } } break; case TYPE_SCALE_3D: { @@ -3143,7 +3137,7 @@ void Animation::track_get_key_indices_in_range(int p_track, double p_time, doubl if (st->compressed_track >= 0) { _get_compressed_key_indices_in_range<3>(st->compressed_track, from_time, to_time - from_time, p_indices); } else { - _track_get_key_indices_in_range(st->scales, from_time, to_time, p_indices); + _track_get_key_indices_in_range(st->scales, from_time, to_time, p_indices, is_backward); } } break; case TYPE_BLEND_SHAPE: { @@ -3151,134 +3145,30 @@ void Animation::track_get_key_indices_in_range(int p_track, double p_time, doubl if (bst->compressed_track >= 0) { _get_compressed_key_indices_in_range<1>(bst->compressed_track, from_time, to_time - from_time, p_indices); } else { - _track_get_key_indices_in_range(bst->blend_shapes, from_time, to_time, p_indices); + _track_get_key_indices_in_range(bst->blend_shapes, from_time, to_time, p_indices, is_backward); } } break; case TYPE_VALUE: { const ValueTrack *vt = static_cast<const ValueTrack *>(t); - _track_get_key_indices_in_range(vt->values, from_time, to_time, p_indices); + _track_get_key_indices_in_range(vt->values, from_time, to_time, p_indices, is_backward); } break; case TYPE_METHOD: { const MethodTrack *mt = static_cast<const MethodTrack *>(t); - _track_get_key_indices_in_range(mt->methods, from_time, to_time, p_indices); + _track_get_key_indices_in_range(mt->methods, from_time, to_time, p_indices, is_backward); } break; case TYPE_BEZIER: { const BezierTrack *bz = static_cast<const BezierTrack *>(t); - _track_get_key_indices_in_range(bz->values, from_time, to_time, p_indices); + _track_get_key_indices_in_range(bz->values, from_time, to_time, p_indices, is_backward); } break; case TYPE_AUDIO: { const AudioTrack *ad = static_cast<const AudioTrack *>(t); - _track_get_key_indices_in_range(ad->values, from_time, to_time, p_indices); + _track_get_key_indices_in_range(ad->values, from_time, to_time, p_indices, is_backward); } break; case TYPE_ANIMATION: { const AnimationTrack *an = static_cast<const AnimationTrack *>(t); - _track_get_key_indices_in_range(an->values, from_time, to_time, p_indices); - } break; - } -} - -void Animation::_method_track_get_key_indices_in_range(const MethodTrack *mt, double from_time, double to_time, List<int> *p_indices) const { - if (from_time != length && to_time == length) { - to_time = length + CMP_EPSILON; //include a little more if at the end - } - - int to = _find(mt->methods, to_time); - - // can't really send the events == time, will be sent in the next frame. - // if event>=len then it will probably never be requested by the anim player. - - if (to >= 0 && mt->methods[to].time >= to_time) { - to--; - } - - if (to < 0) { - return; // not bother - } - - int from = _find(mt->methods, from_time); - - // position in the right first event.+ - if (from < 0 || mt->methods[from].time < from_time) { - from++; - } - - int max = mt->methods.size(); - - for (int i = from; i <= to; i++) { - ERR_CONTINUE(i < 0 || i >= max); // shouldn't happen - p_indices->push_back(i); - } -} - -void Animation::method_track_get_key_indices(int p_track, double p_time, double p_delta, List<int> *p_indices, int p_pingponged) const { - ERR_FAIL_INDEX(p_track, tracks.size()); - Track *t = tracks[p_track]; - ERR_FAIL_COND(t->type != TYPE_METHOD); - - MethodTrack *mt = static_cast<MethodTrack *>(t); - - double from_time = p_time - p_delta; - double to_time = p_time; - - if (from_time > to_time) { - SWAP(from_time, to_time); - } - - switch (loop_mode) { - case LOOP_NONE: { - if (from_time < 0) { - from_time = 0; - } - if (from_time > length) { - from_time = length; - } - - if (to_time < 0) { - to_time = 0; - } - if (to_time > length) { - to_time = length; - } - } break; - case LOOP_LINEAR: { - if (from_time > length || from_time < 0) { - from_time = Math::fposmod(from_time, length); - } - if (to_time > length || to_time < 0) { - to_time = Math::fposmod(to_time, length); - } - - if (from_time > to_time) { - // handle loop by splitting - _method_track_get_key_indices_in_range(mt, from_time, length, p_indices); - _method_track_get_key_indices_in_range(mt, 0, to_time, p_indices); - return; - } + _track_get_key_indices_in_range(an->values, from_time, to_time, p_indices, is_backward); } break; - case LOOP_PINGPONG: { - if (from_time > length || from_time < 0) { - from_time = Math::pingpong(from_time, length); - } - if (to_time > length || to_time < 0) { - to_time = Math::pingpong(to_time, length); - } - - if (p_pingponged == -1) { - _method_track_get_key_indices_in_range(mt, 0, from_time, p_indices); - _method_track_get_key_indices_in_range(mt, 0, to_time, p_indices); - return; - } - if (p_pingponged == 1) { - _method_track_get_key_indices_in_range(mt, from_time, length, p_indices); - _method_track_get_key_indices_in_range(mt, to_time, length, p_indices); - return; - } - } break; - default: - break; } - - _method_track_get_key_indices_in_range(mt, from_time, to_time, p_indices); } Vector<Variant> Animation::method_track_get_params(int p_track, int p_key_idx) const { @@ -3941,10 +3831,8 @@ void Animation::_bind_methods() { ClassDB::bind_method(D_METHOD("value_track_set_update_mode", "track_idx", "mode"), &Animation::value_track_set_update_mode); ClassDB::bind_method(D_METHOD("value_track_get_update_mode", "track_idx"), &Animation::value_track_get_update_mode); - ClassDB::bind_method(D_METHOD("value_track_get_key_indices", "track_idx", "time_sec", "delta"), &Animation::_value_track_get_key_indices); ClassDB::bind_method(D_METHOD("value_track_interpolate", "track_idx", "time_sec"), &Animation::value_track_interpolate); - ClassDB::bind_method(D_METHOD("method_track_get_key_indices", "track_idx", "time_sec", "delta"), &Animation::_method_track_get_key_indices); ClassDB::bind_method(D_METHOD("method_track_get_name", "track_idx", "key_idx"), &Animation::method_track_get_name); ClassDB::bind_method(D_METHOD("method_track_get_params", "track_idx", "key_idx"), &Animation::method_track_get_params); @@ -4008,12 +3896,15 @@ void Animation::_bind_methods() { BIND_ENUM_CONSTANT(UPDATE_CONTINUOUS); BIND_ENUM_CONSTANT(UPDATE_DISCRETE); - BIND_ENUM_CONSTANT(UPDATE_TRIGGER); BIND_ENUM_CONSTANT(UPDATE_CAPTURE); BIND_ENUM_CONSTANT(LOOP_NONE); BIND_ENUM_CONSTANT(LOOP_LINEAR); BIND_ENUM_CONSTANT(LOOP_PINGPONG); + + BIND_ENUM_CONSTANT(LOOPED_FLAG_NONE); + BIND_ENUM_CONSTANT(LOOPED_FLAG_END); + BIND_ENUM_CONSTANT(LOOPED_FLAG_START); } void Animation::clear() { @@ -5997,7 +5888,8 @@ Variant Animation::interpolate_variant(const Variant &a, const Variant &b, float } } -Animation::Animation() {} +Animation::Animation() { +} Animation::~Animation() { for (int i = 0; i < tracks.size(); i++) { diff --git a/scene/resources/animation.h b/scene/resources/animation.h index 49c8fa4c22..0ac1279063 100644 --- a/scene/resources/animation.h +++ b/scene/resources/animation.h @@ -64,7 +64,6 @@ public: enum UpdateMode { UPDATE_CONTINUOUS, UPDATE_DISCRETE, - UPDATE_TRIGGER, UPDATE_CAPTURE, }; @@ -74,6 +73,12 @@ public: LOOP_PINGPONG, }; + enum LoopedFlag { + LOOPED_FLAG_NONE, + LOOPED_FLAG_END, + LOOPED_FLAG_START, + }; + #ifdef TOOLS_ENABLED enum HandleMode { HANDLE_MODE_FREE, @@ -250,15 +255,11 @@ private: _FORCE_INLINE_ T _interpolate(const Vector<TKey<T>> &p_keys, double p_time, InterpolationType p_interp, bool p_loop_wrap, bool *p_ok, bool p_backward = false) const; template <class T> - _FORCE_INLINE_ void _track_get_key_indices_in_range(const Vector<T> &p_array, double from_time, double to_time, List<int> *p_indices) const; - - _FORCE_INLINE_ void _value_track_get_key_indices_in_range(const ValueTrack *vt, double from_time, double to_time, List<int> *p_indices) const; - _FORCE_INLINE_ void _method_track_get_key_indices_in_range(const MethodTrack *mt, double from_time, double to_time, List<int> *p_indices) const; + _FORCE_INLINE_ void _track_get_key_indices_in_range(const Vector<T> &p_array, double from_time, double to_time, List<int> *p_indices, bool p_is_backward) const; double length = 1.0; real_t step = 0.1; LoopMode loop_mode = LOOP_NONE; - int pingponged = 0; /* Animation compression page format (version 1): * @@ -345,27 +346,6 @@ private: // bind helpers private: - Vector<int> _value_track_get_key_indices(int p_track, double p_time, double p_delta) const { - List<int> idxs; - value_track_get_key_indices(p_track, p_time, p_delta, &idxs); - Vector<int> idxr; - - for (int &E : idxs) { - idxr.push_back(E); - } - return idxr; - } - Vector<int> _method_track_get_key_indices(int p_track, double p_time, double p_delta) const { - List<int> idxs; - method_track_get_key_indices(p_track, p_time, p_delta, &idxs); - Vector<int> idxr; - - for (int &E : idxs) { - idxr.push_back(E); - } - return idxr; - } - bool _float_track_optimize_key(const TKey<float> t0, const TKey<float> t1, const TKey<float> t2, real_t p_allowed_velocity_err, real_t p_allowed_precision_error); bool _vector2_track_optimize_key(const TKey<Vector2> t0, const TKey<Vector2> t1, const TKey<Vector2> t2, real_t p_alowed_velocity_err, real_t p_allowed_angular_error, real_t p_allowed_precision_error); bool _vector3_track_optimize_key(const TKey<Vector3> t0, const TKey<Vector3> t1, const TKey<Vector3> t2, real_t p_alowed_velocity_err, real_t p_allowed_angular_error, real_t p_allowed_precision_error); @@ -470,17 +450,15 @@ public: bool track_get_interpolation_loop_wrap(int p_track) const; Variant value_track_interpolate(int p_track, double p_time) const; - void value_track_get_key_indices(int p_track, double p_time, double p_delta, List<int> *p_indices, int p_pingponged = 0) const; void value_track_set_update_mode(int p_track, UpdateMode p_mode); UpdateMode value_track_get_update_mode(int p_track) const; - void method_track_get_key_indices(int p_track, double p_time, double p_delta, List<int> *p_indices, int p_pingponged = 0) const; Vector<Variant> method_track_get_params(int p_track, int p_key_idx) const; StringName method_track_get_name(int p_track, int p_key_idx) const; void copy_track(int p_track, Ref<Animation> p_to_animation); - void track_get_key_indices_in_range(int p_track, double p_time, double p_delta, List<int> *p_indices, int p_pingponged = 0) const; + void track_get_key_indices_in_range(int p_track, double p_time, double p_delta, List<int> *p_indices, Animation::LoopedFlag p_looped_flag = Animation::LOOPED_FLAG_NONE) const; void set_length(real_t p_length); real_t get_length() const; @@ -510,6 +488,7 @@ VARIANT_ENUM_CAST(Animation::TrackType); VARIANT_ENUM_CAST(Animation::InterpolationType); VARIANT_ENUM_CAST(Animation::UpdateMode); VARIANT_ENUM_CAST(Animation::LoopMode); +VARIANT_ENUM_CAST(Animation::LoopedFlag); #ifdef TOOLS_ENABLED VARIANT_ENUM_CAST(Animation::HandleMode); VARIANT_ENUM_CAST(Animation::HandleSetMode); diff --git a/scene/resources/animation_library.cpp b/scene/resources/animation_library.cpp index 427d418551..b37bfbae62 100644 --- a/scene/resources/animation_library.cpp +++ b/scene/resources/animation_library.cpp @@ -52,11 +52,13 @@ Error AnimationLibrary::add_animation(const StringName &p_name, const Ref<Animat ERR_FAIL_COND_V(p_animation.is_null(), ERR_INVALID_PARAMETER); if (animations.has(p_name)) { + animations.get(p_name)->disconnect(SNAME("changed"), callable_mp(this, &AnimationLibrary::_animation_changed)); animations.erase(p_name); emit_signal(SNAME("animation_removed"), p_name); } animations.insert(p_name, p_animation); + animations.get(p_name)->connect(SNAME("changed"), callable_mp(this, &AnimationLibrary::_animation_changed).bind(p_name)); emit_signal(SNAME("animation_added"), p_name); notify_property_list_changed(); return OK; @@ -65,6 +67,7 @@ Error AnimationLibrary::add_animation(const StringName &p_name, const Ref<Animat void AnimationLibrary::remove_animation(const StringName &p_name) { ERR_FAIL_COND_MSG(!animations.has(p_name), vformat("Animation not found: %s.", p_name)); + animations.get(p_name)->disconnect(SNAME("changed"), callable_mp(this, &AnimationLibrary::_animation_changed)); animations.erase(p_name); emit_signal(SNAME("animation_removed"), p_name); notify_property_list_changed(); @@ -75,6 +78,8 @@ void AnimationLibrary::rename_animation(const StringName &p_name, const StringNa ERR_FAIL_COND_MSG(!is_valid_animation_name(p_new_name), "Invalid animation name: '" + String(p_new_name) + "'."); ERR_FAIL_COND_MSG(animations.has(p_new_name), vformat("Animation name \"%s\" already exists in library.", p_new_name)); + animations.get(p_name)->disconnect(SNAME("changed"), callable_mp(this, &AnimationLibrary::_animation_changed)); + animations.get(p_name)->connect(SNAME("changed"), callable_mp(this, &AnimationLibrary::_animation_changed).bind(p_new_name)); animations.insert(p_new_name, animations[p_name]); animations.erase(p_name); emit_signal(SNAME("animation_renamed"), p_name, p_new_name); @@ -100,6 +105,10 @@ TypedArray<StringName> AnimationLibrary::_get_animation_list() const { return ret; } +void AnimationLibrary::_animation_changed(const StringName &p_name) { + emit_signal(SNAME("animation_changed"), p_name); +} + void AnimationLibrary::get_animation_list(List<StringName> *p_animations) const { List<StringName> anims; @@ -115,6 +124,9 @@ void AnimationLibrary::get_animation_list(List<StringName> *p_animations) const } void AnimationLibrary::_set_data(const Dictionary &p_data) { + for (KeyValue<StringName, Ref<Animation>> &K : animations) { + K.value->disconnect(SNAME("changed"), callable_mp(this, &AnimationLibrary::_animation_changed)); + } animations.clear(); List<Variant> keys; p_data.get_key_list(&keys); @@ -146,6 +158,7 @@ void AnimationLibrary::_bind_methods() { ADD_SIGNAL(MethodInfo("animation_added", PropertyInfo(Variant::STRING_NAME, "name"))); ADD_SIGNAL(MethodInfo("animation_removed", PropertyInfo(Variant::STRING_NAME, "name"))); ADD_SIGNAL(MethodInfo("animation_renamed", PropertyInfo(Variant::STRING_NAME, "name"), PropertyInfo(Variant::STRING_NAME, "to_name"))); + ADD_SIGNAL(MethodInfo("animation_changed", PropertyInfo(Variant::STRING_NAME, "name"))); } AnimationLibrary::AnimationLibrary() { } diff --git a/scene/resources/animation_library.h b/scene/resources/animation_library.h index d63807b6d7..54bd641b6d 100644 --- a/scene/resources/animation_library.h +++ b/scene/resources/animation_library.h @@ -42,6 +42,8 @@ class AnimationLibrary : public Resource { TypedArray<StringName> _get_animation_list() const; + void _animation_changed(const StringName &p_name); + friend class AnimationPlayer; //for faster access HashMap<StringName, Ref<Animation>> animations; diff --git a/scene/resources/curve.cpp b/scene/resources/curve.cpp index 9289c5da4a..fa7a1f3dbf 100644 --- a/scene/resources/curve.cpp +++ b/scene/resources/curve.cpp @@ -341,7 +341,7 @@ real_t Curve::sample_local_nocheck(int p_index, real_t p_local_offset) const { const Point a = _points[p_index]; const Point b = _points[p_index + 1]; - /* Cubic bezier + /* Cubic bézier * * ac-----bc * / \ @@ -774,6 +774,22 @@ void Curve2D::_bake_segment2d(RBMap<real_t, Vector2> &r_bake, real_t p_begin, re } } +void Curve2D::_bake_segment2d_even_length(RBMap<real_t, Vector2> &r_bake, real_t p_begin, real_t p_end, const Vector2 &p_a, const Vector2 &p_out, const Vector2 &p_b, const Vector2 &p_in, int p_depth, int p_max_depth, real_t p_length) const { + Vector2 beg = p_a.bezier_interpolate(p_a + p_out, p_b + p_in, p_b, p_begin); + Vector2 end = p_a.bezier_interpolate(p_a + p_out, p_b + p_in, p_b, p_end); + + real_t length = beg.distance_to(end); + + if (length > p_length && p_depth < p_max_depth) { + real_t mp = (p_begin + p_end) * 0.5; + Vector2 mid = p_a.bezier_interpolate(p_a + p_out, p_b + p_in, p_b, mp); + r_bake[mp] = mid; + + _bake_segment2d_even_length(r_bake, p_begin, mp, p_a, p_out, p_b, p_in, p_depth + 1, p_max_depth, p_length); + _bake_segment2d_even_length(r_bake, mp, p_end, p_a, p_out, p_b, p_in, p_depth + 1, p_max_depth, p_length); + } +} + void Curve2D::_bake() const { if (!baked_cache_dirty) { return; @@ -785,94 +801,62 @@ void Curve2D::_bake() const { if (points.size() == 0) { baked_point_cache.clear(); baked_dist_cache.clear(); + baked_forward_vector_cache.clear(); return; } if (points.size() == 1) { baked_point_cache.resize(1); baked_point_cache.set(0, points[0].position); - baked_dist_cache.resize(1); baked_dist_cache.set(0, 0.0); + baked_forward_vector_cache.resize(1); + baked_forward_vector_cache.set(0, Vector2(0.0, 0.1)); + return; } - Vector2 position = points[0].position; - real_t dist = 0.0; - - List<Vector2> pointlist; - List<real_t> distlist; - - // Start always from origin. - pointlist.push_back(position); - distlist.push_back(0.0); - - for (int i = 0; i < points.size() - 1; i++) { - real_t step = 0.1; // at least 10 substeps ought to be enough? - real_t p = 0.0; - - while (p < 1.0) { - real_t np = p + step; - if (np > 1.0) { - np = 1.0; - } - - Vector2 npp = points[i].position.bezier_interpolate(points[i].position + points[i].out, points[i + 1].position + points[i + 1].in, points[i + 1].position, np); - real_t d = position.distance_to(npp); - - if (d > bake_interval) { - // OK! between P and NP there _has_ to be Something, let's go searching! - - int iterations = 10; //lots of detail! - - real_t low = p; - real_t hi = np; - real_t mid = low + (hi - low) * 0.5; - - for (int j = 0; j < iterations; j++) { - npp = points[i].position.bezier_interpolate(points[i].position + points[i].out, points[i + 1].position + points[i + 1].in, points[i + 1].position, mid); - d = position.distance_to(npp); - - if (bake_interval < d) { - hi = mid; - } else { - low = mid; - } - mid = low + (hi - low) * 0.5; - } - - position = npp; - p = mid; - dist += d; + // Tesselate curve to (almost) even length segments + { + Vector<RBMap<real_t, Vector2>> midpoints = _tessellate_even_length(10, bake_interval); - pointlist.push_back(position); - distlist.push_back(dist); - } else { - p = np; - } + int pc = 1; + for (int i = 0; i < points.size() - 1; i++) { + pc++; + pc += midpoints[i].size(); } - Vector2 npp = points[i + 1].position; - real_t d = position.distance_to(npp); - - position = npp; - dist += d; + baked_point_cache.resize(pc); + baked_dist_cache.resize(pc); + baked_forward_vector_cache.resize(pc); - pointlist.push_back(position); - distlist.push_back(dist); - } + Vector2 *bpw = baked_point_cache.ptrw(); + Vector2 *bfw = baked_forward_vector_cache.ptrw(); - baked_max_ofs = dist; + // Collect positions and sample tilts and tangents for each baked points. + bpw[0] = points[0].position; + bfw[0] = points[0].position.bezier_derivative(points[0].position + points[0].out, points[1].position + points[1].in, points[1].position, 0.0).normalized(); + int pidx = 0; - baked_point_cache.resize(pointlist.size()); - baked_dist_cache.resize(distlist.size()); + for (int i = 0; i < points.size() - 1; i++) { + for (const KeyValue<real_t, Vector2> &E : midpoints[i]) { + pidx++; + bpw[pidx] = E.value; + bfw[pidx] = points[i].position.bezier_derivative(points[i].position + points[i].out, points[i + 1].position + points[i + 1].in, points[i + 1].position, E.key).normalized(); + } - Vector2 *w = baked_point_cache.ptrw(); - real_t *wd = baked_dist_cache.ptrw(); + pidx++; + bpw[pidx] = points[i + 1].position; + bfw[pidx] = points[i].position.bezier_derivative(points[i].position + points[i].out, points[i + 1].position + points[i + 1].in, points[i + 1].position, 1.0).normalized(); + } - for (int i = 0; i < pointlist.size(); i++) { - w[i] = pointlist[i]; - wd[i] = distlist[i]; + // Recalculate the baked distances. + real_t *bdw = baked_dist_cache.ptrw(); + bdw[0] = 0.0; + for (int i = 0; i < pc - 1; i++) { + bdw[i + 1] = bdw[i] + bpw[i].distance_to(bpw[i + 1]); + } + baked_max_ofs = bdw[pc - 1]; } } @@ -884,27 +868,15 @@ real_t Curve2D::get_baked_length() const { return baked_max_ofs; } -Vector2 Curve2D::sample_baked(real_t p_offset, bool p_cubic) const { - if (baked_cache_dirty) { - _bake(); - } +Curve2D::Interval Curve2D::_find_interval(real_t p_offset) const { + Interval interval = { + -1, + 0.0 + }; + ERR_FAIL_COND_V_MSG(baked_cache_dirty, interval, "Backed cache is dirty"); - // Validate: Curve may not have baked points. int pc = baked_point_cache.size(); - ERR_FAIL_COND_V_MSG(pc == 0, Vector2(), "No points in Curve2D."); - - if (pc == 1) { - return baked_point_cache.get(0); - } - - const Vector2 *r = baked_point_cache.ptr(); - - if (p_offset < 0) { - return r[0]; - } - if (p_offset >= baked_max_ofs) { - return r[pc - 1]; - } + ERR_FAIL_COND_V_MSG(pc < 2, interval, "Less than two points in cache"); int start = 0; int end = pc; @@ -924,9 +896,27 @@ Vector2 Curve2D::sample_baked(real_t p_offset, bool p_cubic) const { real_t offset_end = baked_dist_cache[idx + 1]; real_t idx_interval = offset_end - offset_begin; - ERR_FAIL_COND_V_MSG(p_offset < offset_begin || p_offset > offset_end, Vector2(), "Couldn't find baked segment."); + ERR_FAIL_COND_V_MSG(p_offset < offset_begin || p_offset > offset_end, interval, "Offset out of range."); + + interval.idx = idx; + if (idx_interval < FLT_EPSILON) { + interval.frac = 0.5; // For a very short interval, 0.5 is a reasonable choice. + ERR_FAIL_V_MSG(interval, "Zero length interval."); + } + + interval.frac = (p_offset - offset_begin) / idx_interval; + return interval; +} - real_t frac = (p_offset - offset_begin) / idx_interval; +Vector2 Curve2D::_sample_baked(Interval p_interval, bool p_cubic) const { + // Assuming p_interval is valid. + ERR_FAIL_INDEX_V_MSG(p_interval.idx, baked_point_cache.size(), Vector2(), "Invalid interval"); + + int idx = p_interval.idx; + real_t frac = p_interval.frac; + + const Vector2 *r = baked_point_cache.ptr(); + int pc = baked_point_cache.size(); if (p_cubic) { Vector2 pre = idx > 0 ? r[idx - 1] : r[idx]; @@ -937,44 +927,70 @@ Vector2 Curve2D::sample_baked(real_t p_offset, bool p_cubic) const { } } -Transform2D Curve2D::sample_baked_with_rotation(real_t p_offset, bool p_cubic, bool p_loop, real_t p_lookahead) const { - real_t path_length = get_baked_length(); // Ensure baked. - ERR_FAIL_COND_V_MSG(path_length == 0, Transform2D(), "Length of Curve2D is 0."); +Transform2D Curve2D::_sample_posture(Interval p_interval) const { + // Assuming that p_interval is valid. + ERR_FAIL_INDEX_V_MSG(p_interval.idx, baked_point_cache.size(), Transform2D(), "Invalid interval"); - Vector2 pos = sample_baked(p_offset, p_cubic); + int idx = p_interval.idx; + real_t frac = p_interval.frac; - real_t ahead = p_offset + p_lookahead; + Vector2 forward_begin = baked_forward_vector_cache[idx]; + Vector2 forward_end = baked_forward_vector_cache[idx + 1]; - if (p_loop && ahead >= path_length) { - // If our lookahead will loop, we need to check if the path is closed. - int point_count = get_point_count(); - if (point_count > 0) { - Vector2 start_point = get_point_position(0); - Vector2 end_point = get_point_position(point_count - 1); - if (start_point == end_point) { - // Since the path is closed we want to 'smooth off' - // the corner at the start/end. - // So we wrap the lookahead back round. - ahead = Math::fmod(ahead, path_length); - } - } + // Build frames at both ends of the interval, then interpolate. + const Vector2 forward = forward_begin.slerp(forward_end, frac).normalized(); + const Vector2 side = Vector2(-forward.y, forward.x); + + return Transform2D(forward, side, Vector2(0.0, 0.0)); +} + +Vector2 Curve2D::sample_baked(real_t p_offset, bool p_cubic) const { + if (baked_cache_dirty) { + _bake(); } - Vector2 ahead_pos = sample_baked(ahead, p_cubic); + // Validate: Curve may not have baked points. + int pc = baked_point_cache.size(); + ERR_FAIL_COND_V_MSG(pc == 0, Vector2(), "No points in Curve2D."); - Vector2 tangent_to_curve; - if (ahead_pos == pos) { - // This will happen at the end of non-looping or non-closed paths. - // We'll try a look behind instead, in order to get a meaningful angle. - tangent_to_curve = - (pos - sample_baked(p_offset - p_lookahead, p_cubic)).normalized(); - } else { - tangent_to_curve = (ahead_pos - pos).normalized(); + if (pc == 1) { + return baked_point_cache[0]; + } + + p_offset = CLAMP(p_offset, 0.0, get_baked_length()); // PathFollower implement wrapping logic. + + Curve2D::Interval interval = _find_interval(p_offset); + return _sample_baked(interval, p_cubic); +} + +Transform2D Curve2D::sample_baked_with_rotation(real_t p_offset, bool p_cubic) const { + if (baked_cache_dirty) { + _bake(); } - Vector2 normal_of_curve = -tangent_to_curve.orthogonal(); + // Validate: Curve may not have baked points. + const int point_count = baked_point_cache.size(); + ERR_FAIL_COND_V_MSG(point_count == 0, Transform2D(), "No points in Curve3D."); + + if (point_count == 1) { + Transform2D t; + t.set_origin(baked_point_cache.get(0)); + ERR_FAIL_V_MSG(t, "Only 1 point in Curve2D."); + } + + p_offset = CLAMP(p_offset, 0.0, get_baked_length()); // PathFollower implement wrapping logic. + + // 0. Find interval for all sampling steps. + Curve2D::Interval interval = _find_interval(p_offset); + + // 1. Sample position. + Vector2 pos = _sample_baked(interval, p_cubic); + + // 2. Sample rotation frame. + Transform2D frame = _sample_posture(interval); + frame.set_origin(pos); - return Transform2D(normal_of_curve, tangent_to_curve, pos); + return frame; } PackedVector2Array Curve2D::get_baked_points() const { @@ -1147,6 +1163,50 @@ PackedVector2Array Curve2D::tessellate(int p_max_stages, real_t p_tolerance) con return tess; } +Vector<RBMap<real_t, Vector2>> Curve2D::_tessellate_even_length(int p_max_stages, real_t p_length) const { + Vector<RBMap<real_t, Vector2>> midpoints; + ERR_FAIL_COND_V_MSG(points.size() < 2, midpoints, "Curve must have at least 2 control point"); + + midpoints.resize(points.size() - 1); + + for (int i = 0; i < points.size() - 1; i++) { + _bake_segment2d_even_length(midpoints.write[i], 0, 1, points[i].position, points[i].out, points[i + 1].position, points[i + 1].in, 0, p_max_stages, p_length); + } + return midpoints; +} + +PackedVector2Array Curve2D::tessellate_even_length(int p_max_stages, real_t p_length) const { + PackedVector2Array tess; + + Vector<RBMap<real_t, Vector2>> midpoints = _tessellate_even_length(p_max_stages, p_length); + if (midpoints.size() == 0) { + return tess; + } + + int pc = 1; + for (int i = 0; i < points.size() - 1; i++) { + pc++; + pc += midpoints[i].size(); + } + + tess.resize(pc); + Vector2 *bpw = tess.ptrw(); + bpw[0] = points[0].position; + int pidx = 0; + + for (int i = 0; i < points.size() - 1; i++) { + for (const KeyValue<real_t, Vector2> &E : midpoints[i]) { + pidx++; + bpw[pidx] = E.value; + } + + pidx++; + bpw[pidx] = points[i + 1].position; + } + + return tess; +} + bool Curve2D::_set(const StringName &p_name, const Variant &p_value) { Vector<String> components = String(p_name).split("/", true, 2); if (components.size() >= 2 && components[0].begins_with("point_") && components[0].trim_prefix("point_").is_valid_int()) { @@ -1224,12 +1284,13 @@ void Curve2D::_bind_methods() { ClassDB::bind_method(D_METHOD("get_bake_interval"), &Curve2D::get_bake_interval); ClassDB::bind_method(D_METHOD("get_baked_length"), &Curve2D::get_baked_length); - ClassDB::bind_method(D_METHOD("sample_baked", "offset", "cubic"), &Curve2D::sample_baked, DEFVAL(false)); - ClassDB::bind_method(D_METHOD("sample_baked_with_rotation", "offset", "cubic", "loop", "lookahead"), &Curve2D::sample_baked_with_rotation, DEFVAL(false), DEFVAL(true), DEFVAL(4.0)); + ClassDB::bind_method(D_METHOD("sample_baked", "offset", "cubic"), &Curve2D::sample_baked, DEFVAL(0.0), DEFVAL(false)); + ClassDB::bind_method(D_METHOD("sample_baked_with_rotation", "offset", "cubic"), &Curve2D::sample_baked_with_rotation, DEFVAL(0.0), DEFVAL(false)); ClassDB::bind_method(D_METHOD("get_baked_points"), &Curve2D::get_baked_points); ClassDB::bind_method(D_METHOD("get_closest_point", "to_point"), &Curve2D::get_closest_point); ClassDB::bind_method(D_METHOD("get_closest_offset", "to_point"), &Curve2D::get_closest_offset); ClassDB::bind_method(D_METHOD("tessellate", "max_stages", "tolerance_degrees"), &Curve2D::tessellate, DEFVAL(5), DEFVAL(4)); + ClassDB::bind_method(D_METHOD("tessellate_even_length", "max_stages", "tolerance_length"), &Curve2D::tessellate_even_length, DEFVAL(5), DEFVAL(20.0)); ClassDB::bind_method(D_METHOD("_get_data"), &Curve2D::_get_data); ClassDB::bind_method(D_METHOD("_set_data", "data"), &Curve2D::_set_data); @@ -1407,15 +1468,15 @@ void Curve3D::_bake_segment3d_even_length(RBMap<real_t, Vector3> &r_bake, real_t Vector3 beg = p_a.bezier_interpolate(p_a + p_out, p_b + p_in, p_b, p_begin); Vector3 end = p_a.bezier_interpolate(p_a + p_out, p_b + p_in, p_b, p_end); - size_t length = beg.distance_to(end); + real_t length = beg.distance_to(end); if (length > p_length && p_depth < p_max_depth) { real_t mp = (p_begin + p_end) * 0.5; Vector3 mid = p_a.bezier_interpolate(p_a + p_out, p_b + p_in, p_b, mp); r_bake[mp] = mid; - _bake_segment3d(r_bake, p_begin, mp, p_a, p_out, p_b, p_in, p_depth + 1, p_max_depth, p_length); - _bake_segment3d(r_bake, mp, p_end, p_a, p_out, p_b, p_in, p_depth + 1, p_max_depth, p_length); + _bake_segment3d_even_length(r_bake, p_begin, mp, p_a, p_out, p_b, p_in, p_depth + 1, p_max_depth, p_length); + _bake_segment3d_even_length(r_bake, mp, p_end, p_a, p_out, p_b, p_in, p_depth + 1, p_max_depth, p_length); } } @@ -1839,10 +1900,11 @@ Vector3 Curve3D::get_closest_point(const Vector3 &p_to_point) const { real_t nearest_dist = -1.0f; for (int i = 0; i < pc - 1; i++) { + const real_t interval = baked_dist_cache[i + 1] - baked_dist_cache[i]; Vector3 origin = r[i]; - Vector3 direction = (r[i + 1] - origin) / bake_interval; + Vector3 direction = (r[i + 1] - origin) / interval; - real_t d = CLAMP((p_to_point - origin).dot(direction), 0.0f, bake_interval); + real_t d = CLAMP((p_to_point - origin).dot(direction), 0.0f, interval); Vector3 proj = origin + direction * d; real_t dist = proj.distance_squared_to(p_to_point); @@ -1875,13 +1937,16 @@ real_t Curve3D::get_closest_offset(const Vector3 &p_to_point) const { real_t nearest = 0.0f; real_t nearest_dist = -1.0f; - real_t offset = 0.0f; + real_t offset; for (int i = 0; i < pc - 1; i++) { + offset = baked_dist_cache[i]; + + const real_t interval = baked_dist_cache[i + 1] - baked_dist_cache[i]; Vector3 origin = r[i]; - Vector3 direction = (r[i + 1] - origin) / bake_interval; + Vector3 direction = (r[i + 1] - origin) / interval; - real_t d = CLAMP((p_to_point - origin).dot(direction), 0.0f, bake_interval); + real_t d = CLAMP((p_to_point - origin).dot(direction), 0.0f, interval); Vector3 proj = origin + direction * d; real_t dist = proj.distance_squared_to(p_to_point); @@ -1890,8 +1955,6 @@ real_t Curve3D::get_closest_offset(const Vector3 &p_to_point) const { nearest = offset + d; nearest_dist = dist; } - - offset += bake_interval; } return nearest; @@ -2131,8 +2194,8 @@ void Curve3D::_bind_methods() { ClassDB::bind_method(D_METHOD("is_up_vector_enabled"), &Curve3D::is_up_vector_enabled); ClassDB::bind_method(D_METHOD("get_baked_length"), &Curve3D::get_baked_length); - ClassDB::bind_method(D_METHOD("sample_baked", "offset", "cubic"), &Curve3D::sample_baked, DEFVAL(false)); - ClassDB::bind_method(D_METHOD("sample_baked_with_rotation", "offset", "cubic", "apply_tilt"), &Curve3D::sample_baked_with_rotation, DEFVAL(false), DEFVAL(false)); + ClassDB::bind_method(D_METHOD("sample_baked", "offset", "cubic"), &Curve3D::sample_baked, DEFVAL(0.0), DEFVAL(false)); + ClassDB::bind_method(D_METHOD("sample_baked_with_rotation", "offset", "cubic", "apply_tilt"), &Curve3D::sample_baked_with_rotation, DEFVAL(0.0), DEFVAL(false), DEFVAL(false)); ClassDB::bind_method(D_METHOD("sample_baked_up_vector", "offset", "apply_tilt"), &Curve3D::sample_baked_up_vector, DEFVAL(false)); ClassDB::bind_method(D_METHOD("get_baked_points"), &Curve3D::get_baked_points); ClassDB::bind_method(D_METHOD("get_baked_tilts"), &Curve3D::get_baked_tilts); diff --git a/scene/resources/curve.h b/scene/resources/curve.h index 88c3cf3ae6..ea3ceabb14 100644 --- a/scene/resources/curve.h +++ b/scene/resources/curve.h @@ -172,6 +172,7 @@ class Curve2D : public Resource { mutable bool baked_cache_dirty = false; mutable PackedVector2Array baked_point_cache; + mutable PackedVector2Array baked_forward_vector_cache; mutable Vector<real_t> baked_dist_cache; mutable real_t baked_max_ofs = 0.0; @@ -181,7 +182,16 @@ class Curve2D : public Resource { real_t bake_interval = 5.0; + struct Interval { + int idx; + real_t frac; + }; + Interval _find_interval(real_t p_offset) const; + Vector2 _sample_baked(Interval p_interval, bool p_cubic) const; + Transform2D _sample_posture(Interval p_interval) const; + void _bake_segment2d(RBMap<real_t, Vector2> &r_bake, real_t p_begin, real_t p_end, const Vector2 &p_a, const Vector2 &p_out, const Vector2 &p_b, const Vector2 &p_in, int p_depth, int p_max_depth, real_t p_tol) const; + void _bake_segment2d_even_length(RBMap<real_t, Vector2> &r_bake, real_t p_begin, real_t p_end, const Vector2 &p_a, const Vector2 &p_out, const Vector2 &p_b, const Vector2 &p_in, int p_depth, int p_max_depth, real_t p_length) const; Dictionary _get_data() const; void _set_data(const Dictionary &p_data); @@ -192,6 +202,8 @@ class Curve2D : public Resource { void _add_point(const Vector2 &p_position, const Vector2 &p_in = Vector2(), const Vector2 &p_out = Vector2(), int p_atpos = -1); void _remove_point(int p_index); + Vector<RBMap<real_t, Vector2>> _tessellate_even_length(int p_max_stages = 5, real_t p_length = 0.2) const; + protected: static void _bind_methods(); @@ -216,12 +228,13 @@ public: real_t get_baked_length() const; Vector2 sample_baked(real_t p_offset, bool p_cubic = false) const; - Transform2D sample_baked_with_rotation(real_t p_offset, bool p_cubic = false, bool p_loop = true, real_t p_lookahead = 4.0) const; + Transform2D sample_baked_with_rotation(real_t p_offset, bool p_cubic = false) const; PackedVector2Array get_baked_points() const; //useful for going through Vector2 get_closest_point(const Vector2 &p_to_point) const; real_t get_closest_offset(const Vector2 &p_to_point) const; PackedVector2Array tessellate(int p_max_stages = 5, real_t p_tolerance = 4) const; //useful for display + PackedVector2Array tessellate_even_length(int p_max_stages = 5, real_t p_length = 20.0) const; // Useful for baking. Curve2D(); }; diff --git a/scene/resources/font.cpp b/scene/resources/font.cpp index af51d6539e..584a7e7eac 100644 --- a/scene/resources/font.cpp +++ b/scene/resources/font.cpp @@ -63,6 +63,8 @@ void Font::_bind_methods() { ClassDB::bind_method(D_METHOD("get_font_name"), &Font::get_font_name); ClassDB::bind_method(D_METHOD("get_font_style_name"), &Font::get_font_style_name); ClassDB::bind_method(D_METHOD("get_font_style"), &Font::get_font_style); + ClassDB::bind_method(D_METHOD("get_font_weight"), &Font::get_font_weight); + ClassDB::bind_method(D_METHOD("get_font_stretch"), &Font::get_font_stretch); ClassDB::bind_method(D_METHOD("get_spacing", "spacing"), &Font::get_spacing); ClassDB::bind_method(D_METHOD("get_opentype_features"), &Font::get_opentype_features); @@ -249,6 +251,14 @@ BitField<TextServer::FontStyle> Font::get_font_style() const { return TS->font_get_style(_get_rid()); } +int Font::get_font_weight() const { + return TS->font_get_weight(_get_rid()); +} + +int Font::get_font_stretch() const { + return TS->font_get_stretch(_get_rid()); +} + Dictionary Font::get_opentype_features() const { return Dictionary(); } @@ -590,6 +600,7 @@ _FORCE_INLINE_ void FontFile::_ensure_rid(int p_cache_index) const { TS->font_set_msdf_size(cache[p_cache_index], msdf_size); TS->font_set_fixed_size(cache[p_cache_index], fixed_size); TS->font_set_force_autohinter(cache[p_cache_index], force_autohinter); + TS->font_set_allow_system_fallback(cache[p_cache_index], allow_system_fallback); TS->font_set_hinting(cache[p_cache_index], hinting); TS->font_set_subpixel_positioning(cache[p_cache_index], subpixel_positioning); TS->font_set_oversampling(cache[p_cache_index], oversampling); @@ -881,6 +892,8 @@ void FontFile::_bind_methods() { ClassDB::bind_method(D_METHOD("set_font_name", "name"), &FontFile::set_font_name); ClassDB::bind_method(D_METHOD("set_font_style_name", "name"), &FontFile::set_font_style_name); ClassDB::bind_method(D_METHOD("set_font_style", "style"), &FontFile::set_font_style); + ClassDB::bind_method(D_METHOD("set_font_weight", "weight"), &FontFile::set_font_weight); + ClassDB::bind_method(D_METHOD("set_font_stretch", "stretch"), &FontFile::set_font_stretch); ClassDB::bind_method(D_METHOD("set_antialiasing", "antialiasing"), &FontFile::set_antialiasing); ClassDB::bind_method(D_METHOD("get_antialiasing"), &FontFile::get_antialiasing); @@ -900,6 +913,9 @@ void FontFile::_bind_methods() { ClassDB::bind_method(D_METHOD("set_fixed_size", "fixed_size"), &FontFile::set_fixed_size); ClassDB::bind_method(D_METHOD("get_fixed_size"), &FontFile::get_fixed_size); + ClassDB::bind_method(D_METHOD("set_allow_system_fallback", "allow_system_fallback"), &FontFile::set_allow_system_fallback); + ClassDB::bind_method(D_METHOD("is_allow_system_fallback"), &FontFile::is_allow_system_fallback); + ClassDB::bind_method(D_METHOD("set_force_autohinter", "force_autohinter"), &FontFile::set_force_autohinter); ClassDB::bind_method(D_METHOD("is_force_autohinter"), &FontFile::is_force_autohinter); @@ -1007,10 +1023,14 @@ void FontFile::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::STRING, "font_name", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_STORAGE), "set_font_name", "get_font_name"); ADD_PROPERTY(PropertyInfo(Variant::STRING, "style_name", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_STORAGE), "set_font_style_name", "get_font_style_name"); ADD_PROPERTY(PropertyInfo(Variant::INT, "font_style", PROPERTY_HINT_FLAGS, "Bold,Italic,Fixed Size", PROPERTY_USAGE_STORAGE), "set_font_style", "get_font_style"); + ADD_PROPERTY(PropertyInfo(Variant::INT, "font_weight", PROPERTY_HINT_RANGE, "100,999,25", PROPERTY_USAGE_STORAGE), "set_font_weight", "get_font_weight"); + ADD_PROPERTY(PropertyInfo(Variant::INT, "font_stretch", PROPERTY_HINT_RANGE, "50,200,25", PROPERTY_USAGE_STORAGE), "set_font_stretch", "get_font_stretch"); + ADD_PROPERTY(PropertyInfo(Variant::INT, "subpixel_positioning", PROPERTY_HINT_ENUM, "Disabled,Auto,One Half of a Pixel,One Quarter of a Pixel", PROPERTY_USAGE_STORAGE), "set_subpixel_positioning", "get_subpixel_positioning"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "multichannel_signed_distance_field", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_STORAGE), "set_multichannel_signed_distance_field", "is_multichannel_signed_distance_field"); ADD_PROPERTY(PropertyInfo(Variant::INT, "msdf_pixel_range", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_STORAGE), "set_msdf_pixel_range", "get_msdf_pixel_range"); ADD_PROPERTY(PropertyInfo(Variant::INT, "msdf_size", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_STORAGE), "set_msdf_size", "get_msdf_size"); + ADD_PROPERTY(PropertyInfo(Variant::BOOL, "allow_system_fallback", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_STORAGE), "set_allow_system_fallback", "is_allow_system_fallback"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "force_autohinter", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_STORAGE), "set_force_autohinter", "is_force_autohinter"); ADD_PROPERTY(PropertyInfo(Variant::INT, "hinting", PROPERTY_HINT_ENUM, "None,Light,Normal", PROPERTY_USAGE_STORAGE), "set_hinting", "get_hinting"); ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "oversampling", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_STORAGE), "set_oversampling", "get_oversampling"); @@ -1329,6 +1349,7 @@ void FontFile::reset_state() { mipmaps = false; msdf = false; force_autohinter = false; + allow_system_fallback = true; hinting = TextServer::HINTING_LIGHT; subpixel_positioning = TextServer::SUBPIXEL_POSITIONING_DISABLED; msdf_pixel_range = 14; @@ -1361,6 +1382,7 @@ Error FontFile::load_bitmap_font(const String &p_path) { mipmaps = false; msdf = false; force_autohinter = false; + allow_system_fallback = true; hinting = TextServer::HINTING_NONE; oversampling = 1.0f; @@ -1937,6 +1959,9 @@ Error FontFile::load_bitmap_font(const String &p_path) { set_font_name(font_name); set_font_style(st_flags); + if (st_flags & TextServer::FONT_BOLD) { + set_font_weight(700); + } set_cache_ascent(0, base_size, ascent); set_cache_descent(0, base_size, height - ascent); @@ -1946,7 +1971,7 @@ Error FontFile::load_bitmap_font(const String &p_path) { Error FontFile::load_dynamic_font(const String &p_path) { reset_state(); - Vector<uint8_t> font_data = FileAccess::get_file_as_array(p_path); + Vector<uint8_t> font_data = FileAccess::get_file_as_bytes(p_path); set_data(font_data); return OK; @@ -2000,6 +2025,16 @@ void FontFile::set_font_style(BitField<TextServer::FontStyle> p_style) { TS->font_set_style(cache[0], p_style); } +void FontFile::set_font_weight(int p_weight) { + _ensure_rid(0); + TS->font_set_weight(cache[0], p_weight); +} + +void FontFile::set_font_stretch(int p_stretch) { + _ensure_rid(0); + TS->font_set_stretch(cache[0], p_stretch); +} + void FontFile::set_antialiasing(TextServer::FontAntialiasing p_antialiasing) { if (antialiasing != p_antialiasing) { antialiasing = p_antialiasing; @@ -2090,6 +2125,21 @@ int FontFile::get_fixed_size() const { return fixed_size; } +void FontFile::set_allow_system_fallback(bool p_allow_system_fallback) { + if (allow_system_fallback != p_allow_system_fallback) { + allow_system_fallback = p_allow_system_fallback; + for (int i = 0; i < cache.size(); i++) { + _ensure_rid(i); + TS->font_set_allow_system_fallback(cache[i], allow_system_fallback); + } + emit_changed(); + } +} + +bool FontFile::is_allow_system_fallback() const { + return allow_system_fallback; +} + void FontFile::set_force_autohinter(bool p_force_autohinter) { if (force_autohinter != p_force_autohinter) { force_autohinter = p_force_autohinter; @@ -2839,6 +2889,9 @@ void SystemFont::_bind_methods() { ClassDB::bind_method(D_METHOD("set_generate_mipmaps", "generate_mipmaps"), &SystemFont::set_generate_mipmaps); ClassDB::bind_method(D_METHOD("get_generate_mipmaps"), &SystemFont::get_generate_mipmaps); + ClassDB::bind_method(D_METHOD("set_allow_system_fallback", "allow_system_fallback"), &SystemFont::set_allow_system_fallback); + ClassDB::bind_method(D_METHOD("is_allow_system_fallback"), &SystemFont::is_allow_system_fallback); + ClassDB::bind_method(D_METHOD("set_force_autohinter", "force_autohinter"), &SystemFont::set_force_autohinter); ClassDB::bind_method(D_METHOD("is_force_autohinter"), &SystemFont::is_force_autohinter); @@ -2857,12 +2910,18 @@ void SystemFont::_bind_methods() { ClassDB::bind_method(D_METHOD("get_font_names"), &SystemFont::get_font_names); ClassDB::bind_method(D_METHOD("set_font_names", "names"), &SystemFont::set_font_names); - ClassDB::bind_method(D_METHOD("set_font_style", "style"), &SystemFont::set_font_style); + ClassDB::bind_method(D_METHOD("get_font_italic"), &SystemFont::get_font_italic); + ClassDB::bind_method(D_METHOD("set_font_italic", "italic"), &SystemFont::set_font_italic); + ClassDB::bind_method(D_METHOD("set_font_weight", "weight"), &SystemFont::set_font_weight); + ClassDB::bind_method(D_METHOD("set_font_stretch", "stretch"), &SystemFont::set_font_stretch); ADD_PROPERTY(PropertyInfo(Variant::PACKED_STRING_ARRAY, "font_names"), "set_font_names", "get_font_names"); - ADD_PROPERTY(PropertyInfo(Variant::INT, "font_style", PROPERTY_HINT_FLAGS, "Bold,Italic"), "set_font_style", "get_font_style"); + ADD_PROPERTY(PropertyInfo(Variant::BOOL, "font_italic"), "set_font_italic", "get_font_italic"); + ADD_PROPERTY(PropertyInfo(Variant::INT, "font_weight", PROPERTY_HINT_RANGE, "100,999,25"), "set_font_weight", "get_font_weight"); + ADD_PROPERTY(PropertyInfo(Variant::INT, "font_stretch", PROPERTY_HINT_RANGE, "50,200,25"), "set_font_stretch", "get_font_stretch"); ADD_PROPERTY(PropertyInfo(Variant::INT, "antialiasing", PROPERTY_HINT_ENUM, "None,Grayscale,LCD Subpixel", PROPERTY_USAGE_STORAGE), "set_antialiasing", "get_antialiasing"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "generate_mipmaps"), "set_generate_mipmaps", "get_generate_mipmaps"); + ADD_PROPERTY(PropertyInfo(Variant::BOOL, "allow_system_fallback"), "set_allow_system_fallback", "is_allow_system_fallback"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "force_autohinter"), "set_force_autohinter", "is_force_autohinter"); ADD_PROPERTY(PropertyInfo(Variant::INT, "hinting", PROPERTY_HINT_ENUM, "None,Light,Normal"), "set_hinting", "get_hinting"); ADD_PROPERTY(PropertyInfo(Variant::INT, "subpixel_positioning", PROPERTY_HINT_ENUM, "Disabled,Auto,One Half of a Pixel,One Quarter of a Pixel"), "set_subpixel_positioning", "get_subpixel_positioning"); @@ -2899,13 +2958,14 @@ void SystemFont::_update_base_font() { face_indeces.clear(); ftr_weight = 0; + ftr_stretch = 0; ftr_italic = 0; for (const String &E : names) { if (E.is_empty()) { continue; } - String path = OS::get_singleton()->get_system_font_path(E, style & TextServer::FONT_BOLD, style & TextServer::FONT_ITALIC); + String path = OS::get_singleton()->get_system_font_path(E, weight, stretch, italic); if (path.is_empty()) { continue; } @@ -2917,9 +2977,22 @@ void SystemFont::_update_base_font() { } // If it's a font collection check all faces to match requested style. + int best_score = 0; for (int i = 0; i < file->get_face_count(); i++) { file->set_face_index(0, i); - if (((file->get_font_style() & TextServer::FONT_BOLD) == (style & TextServer::FONT_BOLD)) && ((file->get_font_style() & TextServer::FONT_ITALIC) == (style & TextServer::FONT_ITALIC))) { + BitField<TextServer::FontStyle> style = file->get_font_style(); + int font_weight = file->get_font_weight(); + int font_stretch = file->get_font_stretch(); + int score = (20 - Math::abs(font_weight - weight) / 50); + score += (20 - Math::abs(font_stretch - stretch) / 10); + if (bool(style & TextServer::FONT_ITALIC) == italic) { + score += 30; + } + if (score > best_score) { + face_indeces.clear(); + } + if (score >= best_score) { + best_score = score; face_indeces.push_back(i); } } @@ -2928,19 +3001,25 @@ void SystemFont::_update_base_font() { } file->set_face_index(0, face_indeces[0]); - // If it's a variable font, apply weight and italic coordinates to match requested style. - Dictionary ftr = file->get_supported_variation_list(); - if ((style & TextServer::FONT_BOLD) && ftr.has(TS->name_to_tag("weight"))) { - ftr_weight = 700; - } - if ((style & TextServer::FONT_ITALIC) && ftr.has(TS->name_to_tag("italic"))) { - ftr_italic = 1; + // If it's a variable font, apply weight, stretch and italic coordinates to match requested style. + if (best_score != 50) { + Dictionary ftr = file->get_supported_variation_list(); + if (ftr.has(TS->name_to_tag("width"))) { + ftr_stretch = stretch; + } + if (ftr.has(TS->name_to_tag("weight"))) { + ftr_weight = weight; + } + if (italic && ftr.has(TS->name_to_tag("italic"))) { + ftr_italic = 1; + } } // Apply font rendering settings. file->set_antialiasing(antialiasing); file->set_generate_mipmaps(mipmaps); file->set_force_autohinter(force_autohinter); + file->set_allow_system_fallback(allow_system_fallback); file->set_hinting(hinting); file->set_subpixel_positioning(subpixel_positioning); file->set_multichannel_signed_distance_field(msdf); @@ -2973,11 +3052,15 @@ void SystemFont::reset_state() { names.clear(); face_indeces.clear(); ftr_weight = 0; + ftr_stretch = 0; ftr_italic = 0; - style = 0; + italic = false; + weight = 400; + stretch = 100; antialiasing = TextServer::FONT_ANTIALIASING_GRAY; mipmaps = false; force_autohinter = false; + allow_system_fallback = true; hinting = TextServer::HINTING_LIGHT; subpixel_positioning = TextServer::SUBPIXEL_POSITIONING_DISABLED; oversampling = 0.f; @@ -3069,6 +3152,20 @@ bool SystemFont::get_generate_mipmaps() const { return mipmaps; } +void SystemFont::set_allow_system_fallback(bool p_allow_system_fallback) { + if (allow_system_fallback != p_allow_system_fallback) { + allow_system_fallback = p_allow_system_fallback; + if (base_font.is_valid()) { + base_font->set_allow_system_fallback(allow_system_fallback); + } + emit_changed(); + } +} + +bool SystemFont::is_allow_system_fallback() const { + return allow_system_fallback; +} + void SystemFont::set_force_autohinter(bool p_force_autohinter) { if (force_autohinter != p_force_autohinter) { force_autohinter = p_force_autohinter; @@ -3150,15 +3247,37 @@ PackedStringArray SystemFont::get_font_names() const { return names; } -void SystemFont::set_font_style(BitField<TextServer::FontStyle> p_style) { - if (style != p_style) { - style = p_style; +void SystemFont::set_font_italic(bool p_italic) { + if (italic != p_italic) { + italic = p_italic; _update_base_font(); } } -BitField<TextServer::FontStyle> SystemFont::get_font_style() const { - return style; +bool SystemFont::get_font_italic() const { + return italic; +} + +void SystemFont::set_font_weight(int p_weight) { + if (weight != p_weight) { + weight = CLAMP(p_weight, 100, 999); + _update_base_font(); + } +} + +int SystemFont::get_font_weight() const { + return weight; +} + +void SystemFont::set_font_stretch(int p_stretch) { + if (stretch != p_stretch) { + stretch = CLAMP(p_stretch, 50, 200); + _update_base_font(); + } +} + +int SystemFont::get_font_stretch() const { + return stretch; } int SystemFont::get_spacing(TextServer::SpacingType p_spacing) const { @@ -3176,6 +3295,9 @@ RID SystemFont::find_variation(const Dictionary &p_variation_coordinates, int p_ if (ftr_weight > 0 && !var.has(TS->name_to_tag("weight"))) { var[TS->name_to_tag("weight")] = ftr_weight; } + if (ftr_stretch > 0 && !var.has(TS->name_to_tag("width"))) { + var[TS->name_to_tag("width")] = ftr_stretch; + } if (ftr_italic > 0 && !var.has(TS->name_to_tag("italic"))) { var[TS->name_to_tag("italic")] = ftr_italic; } @@ -3198,6 +3320,9 @@ RID SystemFont::_get_rid() const { if (ftr_weight > 0) { var[TS->name_to_tag("weight")] = ftr_weight; } + if (ftr_stretch > 0) { + var[TS->name_to_tag("width")] = ftr_stretch; + } if (ftr_italic > 0) { var[TS->name_to_tag("italic")] = ftr_italic; } diff --git a/scene/resources/font.h b/scene/resources/font.h index 5cf596b41d..e9f7507652 100644 --- a/scene/resources/font.h +++ b/scene/resources/font.h @@ -92,6 +92,8 @@ public: virtual String get_font_name() const; virtual String get_font_style_name() const; virtual BitField<TextServer::FontStyle> get_font_style() const; + virtual int get_font_weight() const; + virtual int get_font_stretch() const; virtual int get_spacing(TextServer::SpacingType p_spacing) const { return 0; }; virtual Dictionary get_opentype_features() const; @@ -148,6 +150,7 @@ class FontFile : public Font { int msdf_size = 48; int fixed_size = 0; bool force_autohinter = false; + bool allow_system_fallback = true; TextServer::Hinting hinting = TextServer::HINTING_LIGHT; TextServer::SubpixelPositioning subpixel_positioning = TextServer::SUBPIXEL_POSITIONING_AUTO; real_t oversampling = 0.f; @@ -191,6 +194,8 @@ public: virtual void set_font_name(const String &p_name); virtual void set_font_style_name(const String &p_name); virtual void set_font_style(BitField<TextServer::FontStyle> p_style); + virtual void set_font_weight(int p_weight); + virtual void set_font_stretch(int p_stretch); virtual void set_antialiasing(TextServer::FontAntialiasing p_antialiasing); virtual TextServer::FontAntialiasing get_antialiasing() const; @@ -210,6 +215,9 @@ public: virtual void set_fixed_size(int p_fixed_size); virtual int get_fixed_size() const; + virtual void set_allow_system_fallback(bool p_allow_system_fallback); + virtual bool is_allow_system_fallback() const; + virtual void set_force_autohinter(bool p_force_autohinter); virtual bool is_force_autohinter() const; @@ -389,18 +397,22 @@ class SystemFont : public Font { GDCLASS(SystemFont, Font); PackedStringArray names; - BitField<TextServer::FontStyle> style = 0; + bool italic = false; + int weight = 400; + int stretch = 100; mutable Ref<Font> theme_font; Ref<FontFile> base_font; Vector<int> face_indeces; int ftr_weight = 0; + int ftr_stretch = 0; int ftr_italic = 0; TextServer::FontAntialiasing antialiasing = TextServer::FONT_ANTIALIASING_GRAY; bool mipmaps = false; bool force_autohinter = false; + bool allow_system_fallback = true; TextServer::Hinting hinting = TextServer::HINTING_LIGHT; TextServer::SubpixelPositioning subpixel_positioning = TextServer::SUBPIXEL_POSITIONING_AUTO; real_t oversampling = 0.f; @@ -423,6 +435,9 @@ public: virtual void set_generate_mipmaps(bool p_generate_mipmaps); virtual bool get_generate_mipmaps() const; + virtual void set_allow_system_fallback(bool p_allow_system_fallback); + virtual bool is_allow_system_fallback() const; + virtual void set_force_autohinter(bool p_force_autohinter); virtual bool is_force_autohinter() const; @@ -441,8 +456,14 @@ public: virtual void set_font_names(const PackedStringArray &p_names); virtual PackedStringArray get_font_names() const; - virtual void set_font_style(BitField<TextServer::FontStyle> p_style); - virtual BitField<TextServer::FontStyle> get_font_style() const override; + virtual void set_font_italic(bool p_italic); + virtual bool get_font_italic() const; + + virtual void set_font_weight(int p_weight); + virtual int get_font_weight() const override; + + virtual void set_font_stretch(int p_stretch); + virtual int get_font_stretch() const override; virtual int get_spacing(TextServer::SpacingType p_spacing) const override; diff --git a/scene/resources/importer_mesh.cpp b/scene/resources/importer_mesh.cpp index cec5569345..d1278f9340 100644 --- a/scene/resources/importer_mesh.cpp +++ b/scene/resources/importer_mesh.cpp @@ -971,10 +971,10 @@ Vector<Ref<Shape3D>> ImporterMesh::convex_decompose(const Mesh::ConvexDecomposit return ret; } -Ref<Shape3D> ImporterMesh::create_trimesh_shape() const { +Ref<ConcavePolygonShape3D> ImporterMesh::create_trimesh_shape() const { Vector<Face3> faces = get_faces(); if (faces.size() == 0) { - return Ref<Shape3D>(); + return Ref<ConcavePolygonShape3D>(); } Vector<Vector3> face_points; diff --git a/scene/resources/importer_mesh.h b/scene/resources/importer_mesh.h index 088a77edd1..bbd6498fcf 100644 --- a/scene/resources/importer_mesh.h +++ b/scene/resources/importer_mesh.h @@ -119,7 +119,7 @@ public: Vector<Face3> get_faces() const; Vector<Ref<Shape3D>> convex_decompose(const Mesh::ConvexDecompositionSettings &p_settings) const; - Ref<Shape3D> create_trimesh_shape() const; + Ref<ConcavePolygonShape3D> create_trimesh_shape() const; Ref<NavigationMesh> create_navigation_mesh(); Error lightmap_unwrap_cached(const Transform3D &p_base_transform, float p_texel_size, const Vector<uint8_t> &p_src_cache, Vector<uint8_t> &r_dst_cache); diff --git a/scene/resources/material.cpp b/scene/resources/material.cpp index 10d193f950..e457b2d377 100644 --- a/scene/resources/material.cpp +++ b/scene/resources/material.cpp @@ -92,18 +92,13 @@ void Material::inspect_native_shader_code() { RID Material::get_shader_rid() const { RID ret; - if (GDVIRTUAL_REQUIRED_CALL(_get_shader_rid, ret)) { - return ret; - } - return RID(); + GDVIRTUAL_REQUIRED_CALL(_get_shader_rid, ret); + return ret; } Shader::Mode Material::get_shader_mode() const { - Shader::Mode ret; - if (GDVIRTUAL_REQUIRED_CALL(_get_shader_mode, ret)) { - return ret; - } - - return Shader::MODE_MAX; + Shader::Mode ret = Shader::MODE_MAX; + GDVIRTUAL_REQUIRED_CALL(_get_shader_mode, ret); + return ret; } bool Material::_can_do_next_pass() const { diff --git a/scene/resources/mesh.cpp b/scene/resources/mesh.cpp index d1e300e057..a5e7602c8b 100644 --- a/scene/resources/mesh.cpp +++ b/scene/resources/mesh.cpp @@ -40,119 +40,83 @@ Mesh::ConvexDecompositionFunc Mesh::convex_decomposition_function = nullptr; int Mesh::get_surface_count() const { - int ret; - if (GDVIRTUAL_REQUIRED_CALL(_get_surface_count, ret)) { - return ret; - } - return 0; + int ret = 0; + GDVIRTUAL_REQUIRED_CALL(_get_surface_count, ret); + return ret; } int Mesh::surface_get_array_len(int p_idx) const { - int ret; - if (GDVIRTUAL_REQUIRED_CALL(_surface_get_array_len, p_idx, ret)) { - return ret; - } - return 0; + int ret = 0; + GDVIRTUAL_REQUIRED_CALL(_surface_get_array_len, p_idx, ret); + return ret; } int Mesh::surface_get_array_index_len(int p_idx) const { - int ret; - if (GDVIRTUAL_REQUIRED_CALL(_surface_get_array_index_len, p_idx, ret)) { - return ret; - } - return 0; + int ret = 0; + GDVIRTUAL_REQUIRED_CALL(_surface_get_array_index_len, p_idx, ret); + return ret; } Array Mesh::surface_get_arrays(int p_surface) const { Array ret; - if (GDVIRTUAL_REQUIRED_CALL(_surface_get_arrays, p_surface, ret)) { - return ret; - } - return Array(); + GDVIRTUAL_REQUIRED_CALL(_surface_get_arrays, p_surface, ret); + return ret; } TypedArray<Array> Mesh::surface_get_blend_shape_arrays(int p_surface) const { TypedArray<Array> ret; - if (GDVIRTUAL_REQUIRED_CALL(_surface_get_blend_shape_arrays, p_surface, ret)) { - return ret; - } - - return TypedArray<Array>(); + GDVIRTUAL_REQUIRED_CALL(_surface_get_blend_shape_arrays, p_surface, ret); + return ret; } Dictionary Mesh::surface_get_lods(int p_surface) const { Dictionary ret; - if (GDVIRTUAL_REQUIRED_CALL(_surface_get_lods, p_surface, ret)) { - return ret; - } - - return Dictionary(); + GDVIRTUAL_REQUIRED_CALL(_surface_get_lods, p_surface, ret); + return ret; } uint32_t Mesh::surface_get_format(int p_idx) const { - uint32_t ret; - if (GDVIRTUAL_REQUIRED_CALL(_surface_get_format, p_idx, ret)) { - return ret; - } - - return 0; + uint32_t ret = 0; + GDVIRTUAL_REQUIRED_CALL(_surface_get_format, p_idx, ret); + return ret; } Mesh::PrimitiveType Mesh::surface_get_primitive_type(int p_idx) const { - uint32_t ret; - if (GDVIRTUAL_REQUIRED_CALL(_surface_get_primitive_type, p_idx, ret)) { - return (Mesh::PrimitiveType)ret; - } - - return PRIMITIVE_MAX; + uint32_t ret = PRIMITIVE_MAX; + GDVIRTUAL_REQUIRED_CALL(_surface_get_primitive_type, p_idx, ret); + return (Mesh::PrimitiveType)ret; } void Mesh::surface_set_material(int p_idx, const Ref<Material> &p_material) { - if (GDVIRTUAL_REQUIRED_CALL(_surface_set_material, p_idx, p_material)) { - return; - } + GDVIRTUAL_REQUIRED_CALL(_surface_set_material, p_idx, p_material); } Ref<Material> Mesh::surface_get_material(int p_idx) const { Ref<Material> ret; - if (GDVIRTUAL_REQUIRED_CALL(_surface_get_material, p_idx, ret)) { - return ret; - } - - return Ref<Material>(); + GDVIRTUAL_REQUIRED_CALL(_surface_get_material, p_idx, ret); + return ret; } int Mesh::get_blend_shape_count() const { - int ret; - if (GDVIRTUAL_REQUIRED_CALL(_get_blend_shape_count, ret)) { - return ret; - } - - return 0; + int ret = 0; + GDVIRTUAL_REQUIRED_CALL(_get_blend_shape_count, ret); + return ret; } StringName Mesh::get_blend_shape_name(int p_index) const { StringName ret; - if (GDVIRTUAL_REQUIRED_CALL(_get_blend_shape_name, p_index, ret)) { - return ret; - } - - return StringName(); + GDVIRTUAL_REQUIRED_CALL(_get_blend_shape_name, p_index, ret); + return ret; } void Mesh::set_blend_shape_name(int p_index, const StringName &p_name) { - if (GDVIRTUAL_REQUIRED_CALL(_set_blend_shape_name, p_index, p_name)) { - return; - } + GDVIRTUAL_REQUIRED_CALL(_set_blend_shape_name, p_index, p_name); } AABB Mesh::get_aabb() const { AABB ret; - if (GDVIRTUAL_REQUIRED_CALL(_get_aabb, ret)) { - return ret; - } - - return AABB(); + GDVIRTUAL_REQUIRED_CALL(_get_aabb, ret); + return ret; } Ref<TriangleMesh> Mesh::generate_triangle_mesh() const { @@ -388,7 +352,7 @@ Vector<Face3> Mesh::get_surface_faces(int p_surface) const { return Vector<Face3>(); } -Ref<Shape3D> Mesh::create_convex_shape(bool p_clean, bool p_simplify) const { +Ref<ConvexPolygonShape3D> Mesh::create_convex_shape(bool p_clean, bool p_simplify) const { if (p_simplify) { ConvexDecompositionSettings settings; settings.max_convex_hulls = 1; @@ -425,10 +389,10 @@ Ref<Shape3D> Mesh::create_convex_shape(bool p_clean, bool p_simplify) const { return shape; } -Ref<Shape3D> Mesh::create_trimesh_shape() const { +Ref<ConcavePolygonShape3D> Mesh::create_trimesh_shape() const { Vector<Face3> faces = get_faces(); if (faces.size() == 0) { - return Ref<Shape3D>(); + return Ref<ConcavePolygonShape3D>(); } Vector<Vector3> face_points; diff --git a/scene/resources/mesh.h b/scene/resources/mesh.h index 5ed4164117..6f995280e8 100644 --- a/scene/resources/mesh.h +++ b/scene/resources/mesh.h @@ -35,9 +35,12 @@ #include "core/math/face3.h" #include "core/math/triangle_mesh.h" #include "scene/resources/material.h" -#include "scene/resources/shape_3d.h" #include "servers/rendering_server.h" +class ConcavePolygonShape3D; +class ConvexPolygonShape3D; +class Shape3D; + class Mesh : public Resource { GDCLASS(Mesh, Resource); @@ -211,8 +214,8 @@ public: static ConvexDecompositionFunc convex_decomposition_function; Vector<Ref<Shape3D>> convex_decompose(const ConvexDecompositionSettings &p_settings) const; - Ref<Shape3D> create_convex_shape(bool p_clean = true, bool p_simplify = false) const; - Ref<Shape3D> create_trimesh_shape() const; + Ref<ConvexPolygonShape3D> create_convex_shape(bool p_clean = true, bool p_simplify = false) const; + Ref<ConcavePolygonShape3D> create_trimesh_shape() const; virtual int get_builtin_bind_pose_count() const; virtual Transform3D get_builtin_bind_pose(int p_index) const; diff --git a/scene/resources/packed_scene.cpp b/scene/resources/packed_scene.cpp index f46faa1013..f4b7f3d0b2 100644 --- a/scene/resources/packed_scene.cpp +++ b/scene/resources/packed_scene.cpp @@ -1005,6 +1005,37 @@ void SceneState::clear() { base_scene_idx = -1; } +Error SceneState::copy_from(const Ref<SceneState> &p_scene_state) { + ERR_FAIL_COND_V(p_scene_state.is_null(), ERR_INVALID_PARAMETER); + + clear(); + + for (const StringName &E : p_scene_state->names) { + names.append(E); + } + for (const Variant &E : p_scene_state->variants) { + variants.append(E); + } + for (const SceneState::NodeData &E : p_scene_state->nodes) { + nodes.append(E); + } + for (const SceneState::ConnectionData &E : p_scene_state->connections) { + connections.append(E); + } + for (KeyValue<NodePath, int> &E : p_scene_state->node_path_cache) { + node_path_cache.insert(E.key, E.value); + } + for (const NodePath &E : p_scene_state->node_paths) { + node_paths.append(E); + } + for (const NodePath &E : p_scene_state->editable_instances) { + editable_instances.append(E); + } + base_scene_idx = p_scene_state->base_scene_idx; + + return OK; +} + Ref<SceneState> SceneState::get_base_scene_state() const { if (base_scene_idx >= 0) { Ref<PackedScene> ps = variants[base_scene_idx]; @@ -1737,6 +1768,28 @@ void PackedScene::clear() { state->clear(); } +void PackedScene::reload_from_file() { + String path = get_path(); + if (!path.is_resource_file()) { + return; + } + + Ref<PackedScene> s = ResourceLoader::load(ResourceLoader::path_remap(path), get_class(), ResourceFormatLoader::CACHE_MODE_IGNORE); + if (!s.is_valid()) { + return; + } + + // Backup the loaded_state + Ref<SceneState> loaded_state = s->get_state(); + // This assigns a new state to s->state + // We do this because of the next step + s->recreate_state(); + // This has a side-effect to clear s->state + copy_from(s); + // Then, we copy the backed-up loaded_state to state + state->copy_from(loaded_state); +} + bool PackedScene::can_instantiate() const { return state->can_instantiate(); } diff --git a/scene/resources/packed_scene.h b/scene/resources/packed_scene.h index a30ec54d85..ad1f50cd39 100644 --- a/scene/resources/packed_scene.h +++ b/scene/resources/packed_scene.h @@ -143,6 +143,7 @@ public: String get_path() const; void clear(); + Error copy_from(const Ref<SceneState> &p_scene_state); bool can_instantiate() const; Node *instantiate(GenEditState p_edit_state) const; @@ -235,6 +236,8 @@ public: void recreate_state(); void replace_state(Ref<SceneState> p_by); + virtual void reload_from_file() override; + virtual void set_path(const String &p_path, bool p_take_over = false) override; #ifdef TOOLS_ENABLED virtual void set_last_modified_time(uint64_t p_time) override { diff --git a/scene/resources/resource_format_text.cpp b/scene/resources/resource_format_text.cpp index 8b2b7e118c..36e4a8ea37 100644 --- a/scene/resources/resource_format_text.cpp +++ b/scene/resources/resource_format_text.cpp @@ -144,6 +144,7 @@ Error ResourceLoaderText::_parse_ext_resource(VariantParser::Stream *p_stream, R } String id = token.value; + Error err = OK; if (!ignore_resource_parsing) { if (!ext_resources.has(id)) { @@ -163,7 +164,7 @@ Error ResourceLoaderText::_parse_ext_resource(VariantParser::Stream *p_stream, R error = ERR_FILE_MISSING_DEPENDENCIES; error_text = "[ext_resource] referenced nonexistent resource at: " + path; _printerr(); - return error; + err = error; } else { ResourceLoader::notify_dependency_error(local_path, path, type); } @@ -175,7 +176,7 @@ Error ResourceLoaderText::_parse_ext_resource(VariantParser::Stream *p_stream, R error = ERR_FILE_MISSING_DEPENDENCIES; error_text = "[ext_resource] referenced non-loaded resource at: " + path; _printerr(); - return error; + err = error; } } else { r_res = Ref<Resource>(); @@ -187,7 +188,7 @@ Error ResourceLoaderText::_parse_ext_resource(VariantParser::Stream *p_stream, R return ERR_PARSE_ERROR; } - return OK; + return err; } Ref<PackedScene> ResourceLoaderText::_parse_node_tag(VariantParser::ResourceParser &parser) { @@ -1355,7 +1356,7 @@ Error ResourceLoaderText::save_as_binary(const String &p_path) { wf->seek_end(); - Vector<uint8_t> data = FileAccess::get_file_as_array(temp_file); + Vector<uint8_t> data = FileAccess::get_file_as_bytes(temp_file); wf->store_buffer(data.ptr(), data.size()); { Ref<DirAccess> dar = DirAccess::open(temp_file.get_base_dir()); diff --git a/scene/resources/shader.cpp b/scene/resources/shader.cpp index 3a671edeea..48ec084b02 100644 --- a/scene/resources/shader.cpp +++ b/scene/resources/shader.cpp @@ -221,7 +221,7 @@ Ref<Resource> ResourceFormatLoaderShader::load(const String &p_path, const Strin Ref<Shader> shader; shader.instantiate(); - Vector<uint8_t> buffer = FileAccess::get_file_as_array(p_path); + Vector<uint8_t> buffer = FileAccess::get_file_as_bytes(p_path); String str; str.parse_utf8((const char *)buffer.ptr(), buffer.size()); diff --git a/scene/resources/shader_include.cpp b/scene/resources/shader_include.cpp index fe628dd323..a680e66a50 100644 --- a/scene/resources/shader_include.cpp +++ b/scene/resources/shader_include.cpp @@ -81,7 +81,7 @@ Ref<Resource> ResourceFormatLoaderShaderInclude::load(const String &p_path, cons Ref<ShaderInclude> shader_inc; shader_inc.instantiate(); - Vector<uint8_t> buffer = FileAccess::get_file_as_array(p_path); + Vector<uint8_t> buffer = FileAccess::get_file_as_bytes(p_path); String str; str.parse_utf8((const char *)buffer.ptr(), buffer.size()); diff --git a/scene/resources/style_box.cpp b/scene/resources/style_box.cpp index f379f88bed..ea341152e6 100644 --- a/scene/resources/style_box.cpp +++ b/scene/resources/style_box.cpp @@ -35,11 +35,9 @@ #include <limits.h> float StyleBox::get_style_margin(Side p_side) const { - float ret; - if (GDVIRTUAL_REQUIRED_CALL(_get_style_margin, p_side, ret)) { - return ret; - } - return 0; + float ret = 0; + GDVIRTUAL_REQUIRED_CALL(_get_style_margin, p_side, ret); + return ret; } bool StyleBox::test_mask(const Point2 &p_point, const Rect2 &p_rect) const { @@ -49,9 +47,7 @@ bool StyleBox::test_mask(const Point2 &p_point, const Rect2 &p_rect) const { } void StyleBox::draw(RID p_canvas_item, const Rect2 &p_rect) const { - if (GDVIRTUAL_REQUIRED_CALL(_draw, p_canvas_item, p_rect)) { - return; - } + GDVIRTUAL_REQUIRED_CALL(_draw, p_canvas_item, p_rect); } void StyleBox::set_default_margin(Side p_side, float p_value) { diff --git a/scene/resources/texture.cpp b/scene/resources/texture.cpp index b5754caa6a..2106619a6b 100644 --- a/scene/resources/texture.cpp +++ b/scene/resources/texture.cpp @@ -40,19 +40,15 @@ #include "servers/camera/camera_feed.h" int Texture2D::get_width() const { - int ret; - if (GDVIRTUAL_REQUIRED_CALL(_get_width, ret)) { - return ret; - } - return 0; + int ret = 0; + GDVIRTUAL_REQUIRED_CALL(_get_width, ret); + return ret; } int Texture2D::get_height() const { - int ret; - if (GDVIRTUAL_REQUIRED_CALL(_get_height, ret)) { - return ret; - } - return 0; + int ret = 0; + GDVIRTUAL_REQUIRED_CALL(_get_height, ret); + return ret; } Size2 Texture2D::get_size() const { @@ -1092,57 +1088,44 @@ TypedArray<Image> Texture3D::_get_datai() const { } Image::Format Texture3D::get_format() const { - Image::Format ret; - if (GDVIRTUAL_REQUIRED_CALL(_get_format, ret)) { - return ret; - } - return Image::FORMAT_MAX; + Image::Format ret = Image::FORMAT_MAX; + GDVIRTUAL_REQUIRED_CALL(_get_format, ret); + return ret; } int Texture3D::get_width() const { - int ret; - if (GDVIRTUAL_REQUIRED_CALL(_get_width, ret)) { - return ret; - } - return 0; + int ret = 0; + GDVIRTUAL_REQUIRED_CALL(_get_width, ret); + return ret; } int Texture3D::get_height() const { - int ret; - if (GDVIRTUAL_REQUIRED_CALL(_get_height, ret)) { - return ret; - } - return 0; + int ret = 0; + GDVIRTUAL_REQUIRED_CALL(_get_height, ret); + return ret; } int Texture3D::get_depth() const { - int ret; - if (GDVIRTUAL_REQUIRED_CALL(_get_depth, ret)) { - return ret; - } - - return 0; + int ret = 0; + GDVIRTUAL_REQUIRED_CALL(_get_depth, ret); + return ret; } bool Texture3D::has_mipmaps() const { - bool ret; - if (GDVIRTUAL_REQUIRED_CALL(_has_mipmaps, ret)) { - return ret; - } - return false; + bool ret = false; + GDVIRTUAL_REQUIRED_CALL(_has_mipmaps, ret); + return ret; } Vector<Ref<Image>> Texture3D::get_data() const { TypedArray<Image> ret; - if (GDVIRTUAL_REQUIRED_CALL(_get_data, ret)) { - Vector<Ref<Image>> data; - data.resize(ret.size()); - for (int i = 0; i < data.size(); i++) { - data.write[i] = ret[i]; - } - return data; + GDVIRTUAL_REQUIRED_CALL(_get_data, ret); + Vector<Ref<Image>> data; + data.resize(ret.size()); + for (int i = 0; i < data.size(); i++) { + data.write[i] = ret[i]; } - return Vector<Ref<Image>>(); + return data; } void Texture3D::_bind_methods() { ClassDB::bind_method(D_METHOD("get_format"), &Texture3D::get_format); @@ -2859,60 +2842,45 @@ AnimatedTexture::~AnimatedTexture() { /////////////////////////////// Image::Format TextureLayered::get_format() const { - Image::Format ret; - if (GDVIRTUAL_REQUIRED_CALL(_get_format, ret)) { - return ret; - } - return Image::FORMAT_MAX; + Image::Format ret = Image::FORMAT_MAX; + GDVIRTUAL_REQUIRED_CALL(_get_format, ret); + return ret; } TextureLayered::LayeredType TextureLayered::get_layered_type() const { - uint32_t ret; - if (GDVIRTUAL_REQUIRED_CALL(_get_layered_type, ret)) { - return (LayeredType)ret; - } - return LAYERED_TYPE_2D_ARRAY; + uint32_t ret = LAYERED_TYPE_2D_ARRAY; + GDVIRTUAL_REQUIRED_CALL(_get_layered_type, ret); + return (LayeredType)ret; } int TextureLayered::get_width() const { - int ret; - if (GDVIRTUAL_REQUIRED_CALL(_get_width, ret)) { - return ret; - } - return 0; + int ret = 0; + GDVIRTUAL_REQUIRED_CALL(_get_width, ret); + return ret; } int TextureLayered::get_height() const { - int ret; - if (GDVIRTUAL_REQUIRED_CALL(_get_height, ret)) { - return ret; - } - return 0; + int ret = 0; + GDVIRTUAL_REQUIRED_CALL(_get_height, ret); + return ret; } int TextureLayered::get_layers() const { - int ret; - if (GDVIRTUAL_REQUIRED_CALL(_get_layers, ret)) { - return ret; - } - - return 0; + int ret = 0; + GDVIRTUAL_REQUIRED_CALL(_get_layers, ret); + return ret; } bool TextureLayered::has_mipmaps() const { - bool ret; - if (GDVIRTUAL_REQUIRED_CALL(_has_mipmaps, ret)) { - return ret; - } - return false; + bool ret = false; + GDVIRTUAL_REQUIRED_CALL(_has_mipmaps, ret); + return ret; } Ref<Image> TextureLayered::get_layer_data(int p_layer) const { Ref<Image> ret; - if (GDVIRTUAL_REQUIRED_CALL(_get_layer_data, p_layer, ret)) { - return ret; - } - return Ref<Image>(); + GDVIRTUAL_REQUIRED_CALL(_get_layer_data, p_layer, ret); + return ret; } void TextureLayered::_bind_methods() { diff --git a/scene/resources/visual_shader.cpp b/scene/resources/visual_shader.cpp index b30ca3e721..461dccfbdd 100644 --- a/scene/resources/visual_shader.cpp +++ b/scene/resources/visual_shader.cpp @@ -2658,6 +2658,7 @@ const VisualShaderNodeInput::Port VisualShaderNodeInput::ports[] = { { Shader::MODE_SPATIAL, VisualShader::TYPE_VERTEX, VisualShaderNode::PORT_TYPE_VECTOR_3D, "node_position_world", "NODE_POSITION_WORLD" }, { Shader::MODE_SPATIAL, VisualShader::TYPE_VERTEX, VisualShaderNode::PORT_TYPE_VECTOR_3D, "camera_position_world", "CAMERA_POSITION_WORLD" }, { Shader::MODE_SPATIAL, VisualShader::TYPE_VERTEX, VisualShaderNode::PORT_TYPE_VECTOR_3D, "camera_direction_world", "CAMERA_DIRECTION_WORLD" }, + { Shader::MODE_SPATIAL, VisualShader::TYPE_VERTEX, VisualShaderNode::PORT_TYPE_SCALAR_INT, "camera_visible_layers", "CAMERA_VISIBLE_LAYERS" }, { Shader::MODE_SPATIAL, VisualShader::TYPE_VERTEX, VisualShaderNode::PORT_TYPE_VECTOR_3D, "node_position_view", "NODE_POSITION_VIEW" }, // Node3D, Fragment @@ -2690,6 +2691,7 @@ const VisualShaderNodeInput::Port VisualShaderNodeInput::ports[] = { { Shader::MODE_SPATIAL, VisualShader::TYPE_FRAGMENT, VisualShaderNode::PORT_TYPE_VECTOR_3D, "node_position_world", "NODE_POSITION_WORLD" }, { Shader::MODE_SPATIAL, VisualShader::TYPE_FRAGMENT, VisualShaderNode::PORT_TYPE_VECTOR_3D, "camera_position_world", "CAMERA_POSITION_WORLD" }, { Shader::MODE_SPATIAL, VisualShader::TYPE_FRAGMENT, VisualShaderNode::PORT_TYPE_VECTOR_3D, "camera_direction_world", "CAMERA_DIRECTION_WORLD" }, + { Shader::MODE_SPATIAL, VisualShader::TYPE_FRAGMENT, VisualShaderNode::PORT_TYPE_SCALAR_INT, "camera_visible_layers", "CAMERA_VISIBLE_LAYERS" }, { Shader::MODE_SPATIAL, VisualShader::TYPE_FRAGMENT, VisualShaderNode::PORT_TYPE_VECTOR_3D, "node_position_view", "NODE_POSITION_VIEW" }, // Node3D, Light diff --git a/scene/theme/theme_db.cpp b/scene/theme/theme_db.cpp index 1025d40b05..0268a685fe 100644 --- a/scene/theme/theme_db.cpp +++ b/scene/theme/theme_db.cpp @@ -49,7 +49,7 @@ void ThemeDB::initialize_theme() { ProjectSettings::get_singleton()->set_custom_property_info("gui/theme/custom", PropertyInfo(Variant::STRING, "gui/theme/custom", PROPERTY_HINT_FILE, "*.tres,*.res,*.theme", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED)); String font_path = GLOBAL_DEF_RST("gui/theme/custom_font", ""); - ProjectSettings::get_singleton()->set_custom_property_info("gui/theme/custom_font", PropertyInfo(Variant::STRING, "gui/theme/custom_font", PROPERTY_HINT_FILE, "*.tres,*.res", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED)); + ProjectSettings::get_singleton()->set_custom_property_info("gui/theme/custom_font", PropertyInfo(Variant::STRING, "gui/theme/custom_font", PROPERTY_HINT_FILE, "*.tres,*.res,*.otf,*.ttf,*.woff,*.woff2,*.fnt,*.font,*.pfb,*.pfm", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED)); TextServer::FontAntialiasing font_antialiasing = (TextServer::FontAntialiasing)(int)GLOBAL_DEF_RST("gui/theme/default_font_antialiasing", 1); ProjectSettings::get_singleton()->set_custom_property_info("gui/theme/default_font_antialiasing", PropertyInfo(Variant::INT, "gui/theme/default_font_antialiasing", PROPERTY_HINT_ENUM, "None,Grayscale,LCD Subpixel", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED)); diff --git a/servers/audio/audio_effect.cpp b/servers/audio/audio_effect.cpp index ef0e3197e1..870a77806b 100644 --- a/servers/audio/audio_effect.cpp +++ b/servers/audio/audio_effect.cpp @@ -31,9 +31,7 @@ #include "audio_effect.h" void AudioEffectInstance::process(const AudioFrame *p_src_frames, AudioFrame *p_dst_frames, int p_frame_count) { - if (GDVIRTUAL_REQUIRED_CALL(_process, p_src_frames, p_dst_frames, p_frame_count)) { - return; - } + GDVIRTUAL_REQUIRED_CALL(_process, p_src_frames, p_dst_frames, p_frame_count); } bool AudioEffectInstance::process_silence() const { bool ret = false; @@ -50,10 +48,8 @@ void AudioEffectInstance::_bind_methods() { Ref<AudioEffectInstance> AudioEffect::instantiate() { Ref<AudioEffectInstance> ret; - if (GDVIRTUAL_REQUIRED_CALL(_instantiate, ret)) { - return ret; - } - return Ref<AudioEffectInstance>(); + GDVIRTUAL_REQUIRED_CALL(_instantiate, ret); + return ret; } void AudioEffect::_bind_methods() { GDVIRTUAL_BIND(_instantiate); diff --git a/servers/audio/audio_stream.cpp b/servers/audio/audio_stream.cpp index 33d4c816f2..4b68515e18 100644 --- a/servers/audio/audio_stream.cpp +++ b/servers/audio/audio_stream.cpp @@ -71,12 +71,9 @@ void AudioStreamPlayback::seek(double p_time) { } int AudioStreamPlayback::mix(AudioFrame *p_buffer, float p_rate_scale, int p_frames) { - int ret; - if (GDVIRTUAL_REQUIRED_CALL(_mix, p_buffer, p_rate_scale, p_frames, ret)) { - return ret; - } - - return 0; + int ret = 0; + GDVIRTUAL_REQUIRED_CALL(_mix, p_buffer, p_rate_scale, p_frames, ret); + return ret; } void AudioStreamPlayback::tag_used_streams() { @@ -107,20 +104,14 @@ void AudioStreamPlaybackResampled::begin_resample() { } int AudioStreamPlaybackResampled::_mix_internal(AudioFrame *p_buffer, int p_frames) { - int ret; - if (GDVIRTUAL_REQUIRED_CALL(_mix_resampled, p_buffer, p_frames, ret)) { - return ret; - } - - return 0; + int ret = 0; + GDVIRTUAL_REQUIRED_CALL(_mix_resampled, p_buffer, p_frames, ret); + return ret; } float AudioStreamPlaybackResampled::get_stream_sampling_rate() { - float ret; - if (GDVIRTUAL_REQUIRED_CALL(_get_stream_sampling_rate, ret)) { - return ret; - } - - return 0; + float ret = 0; + GDVIRTUAL_REQUIRED_CALL(_get_stream_sampling_rate, ret); + return ret; } void AudioStreamPlaybackResampled::_bind_methods() { diff --git a/servers/movie_writer/movie_writer.cpp b/servers/movie_writer/movie_writer.cpp index 0edce4ced6..419943f2d2 100644 --- a/servers/movie_writer/movie_writer.cpp +++ b/servers/movie_writer/movie_writer.cpp @@ -52,34 +52,26 @@ MovieWriter *MovieWriter::find_writer_for_file(const String &p_file) { } uint32_t MovieWriter::get_audio_mix_rate() const { - uint32_t ret = 0; - if (GDVIRTUAL_REQUIRED_CALL(_get_audio_mix_rate, ret)) { - return ret; - } - return 48000; + uint32_t ret = 48000; + GDVIRTUAL_REQUIRED_CALL(_get_audio_mix_rate, ret); + return ret; } AudioServer::SpeakerMode MovieWriter::get_audio_speaker_mode() const { AudioServer::SpeakerMode ret = AudioServer::SPEAKER_MODE_STEREO; - if (GDVIRTUAL_REQUIRED_CALL(_get_audio_speaker_mode, ret)) { - return ret; - } - return AudioServer::SPEAKER_MODE_STEREO; + GDVIRTUAL_REQUIRED_CALL(_get_audio_speaker_mode, ret); + return ret; } Error MovieWriter::write_begin(const Size2i &p_movie_size, uint32_t p_fps, const String &p_base_path) { - Error ret = OK; - if (GDVIRTUAL_REQUIRED_CALL(_write_begin, p_movie_size, p_fps, p_base_path, ret)) { - return ret; - } - return ERR_UNCONFIGURED; + Error ret = ERR_UNCONFIGURED; + GDVIRTUAL_REQUIRED_CALL(_write_begin, p_movie_size, p_fps, p_base_path, ret); + return ret; } Error MovieWriter::write_frame(const Ref<Image> &p_image, const int32_t *p_audio_data) { - Error ret = OK; - if (GDVIRTUAL_REQUIRED_CALL(_write_frame, p_image, p_audio_data, ret)) { - return ret; - } - return ERR_UNCONFIGURED; + Error ret = ERR_UNCONFIGURED; + GDVIRTUAL_REQUIRED_CALL(_write_frame, p_image, p_audio_data, ret); + return ret; } void MovieWriter::write_end() { @@ -88,18 +80,15 @@ void MovieWriter::write_end() { bool MovieWriter::handles_file(const String &p_path) const { bool ret = false; - if (GDVIRTUAL_REQUIRED_CALL(_handles_file, p_path, ret)) { - return ret; - } - return false; + GDVIRTUAL_REQUIRED_CALL(_handles_file, p_path, ret); + return ret; } void MovieWriter::get_supported_extensions(List<String> *r_extensions) const { Vector<String> exts; - if (GDVIRTUAL_REQUIRED_CALL(_get_supported_extensions, exts)) { - for (int i = 0; i < exts.size(); i++) { - r_extensions->push_back(exts[i]); - } + GDVIRTUAL_REQUIRED_CALL(_get_supported_extensions, exts); + for (int i = 0; i < exts.size(); i++) { + r_extensions->push_back(exts[i]); } } diff --git a/servers/rendering/renderer_canvas_cull.cpp b/servers/rendering/renderer_canvas_cull.cpp index 16d382a5f3..075a21b818 100644 --- a/servers/rendering/renderer_canvas_cull.cpp +++ b/servers/rendering/renderer_canvas_cull.cpp @@ -275,12 +275,12 @@ void RendererCanvasCull::_cull_canvas_item(Item *p_canvas_item, const Transform2 if (ci->clip) { if (p_canvas_clip != nullptr) { ci->final_clip_rect = p_canvas_clip->final_clip_rect.intersection(global_rect); - if (ci->final_clip_rect == Rect2()) { - // Clip rects do not intersect, so don't draw this item. - return; - } } else { - ci->final_clip_rect = global_rect; + ci->final_clip_rect = p_clip_rect.intersection(global_rect); + } + if (ci->final_clip_rect.size.width < 0.5 || ci->final_clip_rect.size.height < 0.5) { + // The clip rect area is 0, so don't draw the item. + return; } ci->final_clip_rect.position = ci->final_clip_rect.position.round(); ci->final_clip_rect.size = ci->final_clip_rect.size.round(); diff --git a/servers/rendering/renderer_rd/effects/copy_effects.cpp b/servers/rendering/renderer_rd/effects/copy_effects.cpp index a05db8c563..f94abd66d7 100644 --- a/servers/rendering/renderer_rd/effects/copy_effects.cpp +++ b/servers/rendering/renderer_rd/effects/copy_effects.cpp @@ -1153,7 +1153,8 @@ void CopyEffects::cubemap_roughness(RID p_source_rd_texture, RID p_dest_texture, memset(&roughness.push_constant, 0, sizeof(CubemapRoughnessPushConstant)); roughness.push_constant.face_id = p_face_id > 9 ? 0 : p_face_id; - roughness.push_constant.roughness = p_roughness * p_roughness; // Shader expects roughness, not perceptual roughness, so multiply before passing in. + // Remap to perceptual-roughness^2 to create more detail in lower mips and match the mapping of cubemap_filter. + roughness.push_constant.roughness = p_roughness * p_roughness; roughness.push_constant.sample_count = p_sample_count; roughness.push_constant.use_direct_write = p_roughness == 0.0; roughness.push_constant.face_size = p_size; diff --git a/servers/rendering/renderer_rd/forward_clustered/scene_shader_forward_clustered.cpp b/servers/rendering/renderer_rd/forward_clustered/scene_shader_forward_clustered.cpp index 6c8ce5265e..b5d4098e65 100644 --- a/servers/rendering/renderer_rd/forward_clustered/scene_shader_forward_clustered.cpp +++ b/servers/rendering/renderer_rd/forward_clustered/scene_shader_forward_clustered.cpp @@ -709,6 +709,7 @@ void SceneShaderForwardClustered::init(const String p_defines) { actions.renames["NODE_POSITION_WORLD"] = "read_model_matrix[3].xyz"; actions.renames["CAMERA_POSITION_WORLD"] = "scene_data.inv_view_matrix[3].xyz"; actions.renames["CAMERA_DIRECTION_WORLD"] = "scene_data.view_matrix[3].xyz"; + actions.renames["CAMERA_VISIBLE_LAYERS"] = "scene_data.camera_visible_layers"; actions.renames["NODE_POSITION_VIEW"] = "(read_model_matrix * scene_data.view_matrix)[3].xyz"; actions.renames["VIEW_INDEX"] = "ViewIndex"; diff --git a/servers/rendering/renderer_rd/forward_mobile/scene_shader_forward_mobile.cpp b/servers/rendering/renderer_rd/forward_mobile/scene_shader_forward_mobile.cpp index ee82fa7c7d..2d80cffdad 100644 --- a/servers/rendering/renderer_rd/forward_mobile/scene_shader_forward_mobile.cpp +++ b/servers/rendering/renderer_rd/forward_mobile/scene_shader_forward_mobile.cpp @@ -609,6 +609,7 @@ void SceneShaderForwardMobile::init(const String p_defines) { actions.renames["NODE_POSITION_WORLD"] = "read_model_matrix[3].xyz"; actions.renames["CAMERA_POSITION_WORLD"] = "scene_data.inv_view_matrix[3].xyz"; actions.renames["CAMERA_DIRECTION_WORLD"] = "scene_data.view_matrix[3].xyz"; + actions.renames["CAMERA_VISIBLE_LAYERS"] = "scene_data.camera_visible_layers"; actions.renames["NODE_POSITION_VIEW"] = "(read_model_matrix * scene_data.view_matrix)[3].xyz"; actions.renames["VIEW_INDEX"] = "ViewIndex"; diff --git a/servers/rendering/renderer_rd/renderer_scene_render_rd.cpp b/servers/rendering/renderer_rd/renderer_scene_render_rd.cpp index 75fe84f46b..0f4dda3f11 100644 --- a/servers/rendering/renderer_rd/renderer_scene_render_rd.cpp +++ b/servers/rendering/renderer_rd/renderer_scene_render_rd.cpp @@ -1078,6 +1078,7 @@ void RendererSceneRenderRD::render_scene(const Ref<RenderSceneBuffers> &p_render scene_data.cam_transform = p_camera_data->main_transform; scene_data.cam_projection = p_camera_data->main_projection; scene_data.cam_orthogonal = p_camera_data->is_orthogonal; + scene_data.camera_visible_layers = p_camera_data->visible_layers; scene_data.taa_jitter = p_camera_data->taa_jitter; scene_data.view_count = p_camera_data->view_count; diff --git a/servers/rendering/renderer_rd/shaders/effects/cubemap_roughness_inc.glsl b/servers/rendering/renderer_rd/shaders/effects/cubemap_roughness_inc.glsl index 1bee428a6f..c0597fe3f3 100644 --- a/servers/rendering/renderer_rd/shaders/effects/cubemap_roughness_inc.glsl +++ b/servers/rendering/renderer_rd/shaders/effects/cubemap_roughness_inc.glsl @@ -70,17 +70,6 @@ float DistributionGGX(float NdotH, float roughness4) { return roughness4 / denom; } -// https://graphicrants.blogspot.com.au/2013/08/specular-brdf-reference.html -float GGX(float NdotV, float a) { - float k = a / 2.0; - return NdotV / (NdotV * (1.0 - k) + k); -} - -// https://graphicrants.blogspot.com.au/2013/08/specular-brdf-reference.html -float G_Smith(float a, float nDotV, float nDotL) { - return GGX(nDotL, a * a) * GGX(nDotV, a * a); -} - float radicalInverse_VdC(uint bits) { bits = (bits << 16u) | (bits >> 16u); bits = ((bits & 0x55555555u) << 1u) | ((bits & 0xAAAAAAAAu) >> 1u); diff --git a/servers/rendering/renderer_rd/shaders/forward_clustered/scene_forward_clustered.glsl b/servers/rendering/renderer_rd/shaders/forward_clustered/scene_forward_clustered.glsl index 896f51ca01..be53a7ae49 100644 --- a/servers/rendering/renderer_rd/shaders/forward_clustered/scene_forward_clustered.glsl +++ b/servers/rendering/renderer_rd/shaders/forward_clustered/scene_forward_clustered.glsl @@ -1084,12 +1084,13 @@ void fragment_shader(in SceneData scene_data) { #ifdef USE_RADIANCE_CUBEMAP_ARRAY float lod, blend; - blend = modf(roughness * MAX_ROUGHNESS_LOD, lod); + + blend = modf(sqrt(roughness) * MAX_ROUGHNESS_LOD, lod); specular_light = texture(samplerCubeArray(radiance_cubemap, material_samplers[SAMPLER_LINEAR_WITH_MIPMAPS_CLAMP]), vec4(ref_vec, lod)).rgb; specular_light = mix(specular_light, texture(samplerCubeArray(radiance_cubemap, material_samplers[SAMPLER_LINEAR_WITH_MIPMAPS_CLAMP]), vec4(ref_vec, lod + 1)).rgb, blend); #else - specular_light = textureLod(samplerCube(radiance_cubemap, material_samplers[SAMPLER_LINEAR_WITH_MIPMAPS_CLAMP]), ref_vec, roughness * MAX_ROUGHNESS_LOD).rgb; + specular_light = textureLod(samplerCube(radiance_cubemap, material_samplers[SAMPLER_LINEAR_WITH_MIPMAPS_CLAMP]), ref_vec, sqrt(roughness) * MAX_ROUGHNESS_LOD).rgb; #endif //USE_RADIANCE_CUBEMAP_ARRAY specular_light *= scene_data.IBL_exposure_normalization; @@ -1137,7 +1138,7 @@ void fragment_shader(in SceneData scene_data) { ref_vec = mix(ref_vec, n, clearcoat_roughness * clearcoat_roughness); float horizon = min(1.0 + dot(ref_vec, normal), 1.0); ref_vec = scene_data.radiance_inverse_xform * ref_vec; - float roughness_lod = mix(0.001, 0.1, clearcoat_roughness) * MAX_ROUGHNESS_LOD; + float roughness_lod = mix(0.001, 0.1, sqrt(clearcoat_roughness)) * MAX_ROUGHNESS_LOD; #ifdef USE_RADIANCE_CUBEMAP_ARRAY float lod, blend; @@ -1484,7 +1485,7 @@ void fragment_shader(in SceneData scene_data) { float a004 = min(r.x * r.x, exp2(-9.28 * ndotv)) * r.x + r.y; vec2 env = vec2(-1.04, 1.04) * a004 + r.zw; - specular_light *= env.x * f0 + env.y * clamp(50.0 * f0.g, 0.0, 1.0); + specular_light *= env.x * f0 + env.y * clamp(50.0 * f0.g, metallic, 1.0); #endif } diff --git a/servers/rendering/renderer_rd/shaders/forward_mobile/scene_forward_mobile.glsl b/servers/rendering/renderer_rd/shaders/forward_mobile/scene_forward_mobile.glsl index d50749306e..b45c68db5a 100644 --- a/servers/rendering/renderer_rd/shaders/forward_mobile/scene_forward_mobile.glsl +++ b/servers/rendering/renderer_rd/shaders/forward_mobile/scene_forward_mobile.glsl @@ -987,12 +987,12 @@ void main() { #ifdef USE_RADIANCE_CUBEMAP_ARRAY float lod, blend; - blend = modf(roughness * MAX_ROUGHNESS_LOD, lod); + blend = modf(sqrt(roughness) * MAX_ROUGHNESS_LOD, lod); specular_light = texture(samplerCubeArray(radiance_cubemap, material_samplers[SAMPLER_LINEAR_WITH_MIPMAPS_CLAMP]), vec4(ref_vec, lod)).rgb; specular_light = mix(specular_light, texture(samplerCubeArray(radiance_cubemap, material_samplers[SAMPLER_LINEAR_WITH_MIPMAPS_CLAMP]), vec4(ref_vec, lod + 1)).rgb, blend); #else // USE_RADIANCE_CUBEMAP_ARRAY - specular_light = textureLod(samplerCube(radiance_cubemap, material_samplers[SAMPLER_LINEAR_WITH_MIPMAPS_CLAMP]), ref_vec, roughness * MAX_ROUGHNESS_LOD).rgb; + specular_light = textureLod(samplerCube(radiance_cubemap, material_samplers[SAMPLER_LINEAR_WITH_MIPMAPS_CLAMP]), ref_vec, sqrt(roughness) * MAX_ROUGHNESS_LOD).rgb; #endif //USE_RADIANCE_CUBEMAP_ARRAY specular_light *= sc_luminance_multiplier; @@ -1042,7 +1042,7 @@ void main() { float horizon = min(1.0 + dot(ref_vec, normal), 1.0); ref_vec = scene_data.radiance_inverse_xform * ref_vec; - float roughness_lod = mix(0.001, 0.1, clearcoat_roughness) * MAX_ROUGHNESS_LOD; + float roughness_lod = mix(0.001, 0.1, sqrt(clearcoat_roughness)) * MAX_ROUGHNESS_LOD; #ifdef USE_RADIANCE_CUBEMAP_ARRAY float lod, blend; @@ -1205,7 +1205,7 @@ void main() { float a004 = min(r.x * r.x, exp2(-9.28 * ndotv)) * r.x + r.y; vec2 env = vec2(-1.04, 1.04) * a004 + r.zw; - specular_light *= env.x * f0 + env.y; + specular_light *= env.x * f0 + env.y * clamp(50.0 * f0.g, metallic, 1.0); #endif } diff --git a/servers/rendering/renderer_rd/shaders/scene_data_inc.glsl b/servers/rendering/renderer_rd/shaders/scene_data_inc.glsl index 048257e9ef..b57ee18521 100644 --- a/servers/rendering/renderer_rd/shaders/scene_data_inc.glsl +++ b/servers/rendering/renderer_rd/shaders/scene_data_inc.glsl @@ -63,7 +63,7 @@ struct SceneData { float IBL_exposure_normalization; bool pancake_shadows; - uint pad1; + uint camera_visible_layers; uint pad2; uint pad3; }; diff --git a/servers/rendering/renderer_rd/shaders/scene_forward_lights_inc.glsl b/servers/rendering/renderer_rd/shaders/scene_forward_lights_inc.glsl index 2fba1351f7..ba31b9c6dd 100644 --- a/servers/rendering/renderer_rd/shaders/scene_forward_lights_inc.glsl +++ b/servers/rendering/renderer_rd/shaders/scene_forward_lights_inc.glsl @@ -202,7 +202,7 @@ void light_compute(vec3 N, vec3 L, vec3 V, float A, vec3 light_color, float atte float cLdotH5 = SchlickFresnel(cLdotH); // Calculate Fresnel using specular occlusion term from Filament: // https://google.github.io/filament/Filament.html#lighting/occlusion/specularocclusion - float f90 = clamp(dot(f0, vec3(50.0 * 0.33)), 0.0, 1.0); + float f90 = clamp(dot(f0, vec3(50.0 * 0.33)), metallic, 1.0); vec3 F = f0 + (f90 - f0) * cLdotH5; vec3 specular_brdf_NL = cNdotL * D * F * G; diff --git a/servers/rendering/renderer_rd/storage_rd/mesh_storage.h b/servers/rendering/renderer_rd/storage_rd/mesh_storage.h index 4765475804..27c82213e4 100644 --- a/servers/rendering/renderer_rd/storage_rd/mesh_storage.h +++ b/servers/rendering/renderer_rd/storage_rd/mesh_storage.h @@ -665,7 +665,6 @@ public: virtual void skeleton_allocate_data(RID p_skeleton, int p_bones, bool p_2d_skeleton = false) override; virtual void skeleton_set_base_transform_2d(RID p_skeleton, const Transform2D &p_base_transform) override; - void skeleton_set_world_transform(RID p_skeleton, bool p_enable, const Transform3D &p_world_transform); virtual int skeleton_get_bone_count(RID p_skeleton) const override; virtual void skeleton_bone_set_transform(RID p_skeleton, int p_bone, const Transform3D &p_transform) override; virtual Transform3D skeleton_bone_get_transform(RID p_skeleton, int p_bone) const override; diff --git a/servers/rendering/renderer_rd/storage_rd/render_scene_data_rd.cpp b/servers/rendering/renderer_rd/storage_rd/render_scene_data_rd.cpp index 7dd790d1da..9b3d5a2d29 100644 --- a/servers/rendering/renderer_rd/storage_rd/render_scene_data_rd.cpp +++ b/servers/rendering/renderer_rd/storage_rd/render_scene_data_rd.cpp @@ -88,6 +88,7 @@ void RenderSceneDataRD::update_ubo(RID p_uniform_buffer, RS::ViewportDebugDraw p RendererRD::MaterialStorage::store_soft_shadow_kernel(render_scene_render->directional_soft_shadow_kernel_get(), ubo.directional_soft_shadow_kernel); RendererRD::MaterialStorage::store_soft_shadow_kernel(render_scene_render->penumbra_shadow_kernel_get(), ubo.penumbra_shadow_kernel); RendererRD::MaterialStorage::store_soft_shadow_kernel(render_scene_render->soft_shadow_kernel_get(), ubo.soft_shadow_kernel); + ubo.camera_visible_layers = camera_visible_layers; ubo.viewport_size[0] = p_screen_size.x; ubo.viewport_size[1] = p_screen_size.y; diff --git a/servers/rendering/renderer_rd/storage_rd/render_scene_data_rd.h b/servers/rendering/renderer_rd/storage_rd/render_scene_data_rd.h index 9c031acc1e..5ea4991e8e 100644 --- a/servers/rendering/renderer_rd/storage_rd/render_scene_data_rd.h +++ b/servers/rendering/renderer_rd/storage_rd/render_scene_data_rd.h @@ -45,6 +45,7 @@ public: Transform3D cam_transform; Projection cam_projection; Vector2 taa_jitter; + uint32_t camera_visible_layers; bool cam_orthogonal = false; // For stereo rendering @@ -142,7 +143,7 @@ private: float IBL_exposure_normalization; // Adjusts for baked exposure. uint32_t pancake_shadows; - uint32_t pad1; + uint32_t camera_visible_layers; uint32_t pad2; uint32_t pad3; }; diff --git a/servers/rendering/renderer_scene_cull.cpp b/servers/rendering/renderer_scene_cull.cpp index 4ee355ee9f..cfc25fc577 100644 --- a/servers/rendering/renderer_scene_cull.cpp +++ b/servers/rendering/renderer_scene_cull.cpp @@ -2512,7 +2512,7 @@ void RendererSceneCull::render_camera(const Ref<RenderSceneBuffers> &p_render_bu } break; } - camera_data.set_camera(transform, projection, is_orthogonal, vaspect, jitter); + camera_data.set_camera(transform, projection, is_orthogonal, vaspect, jitter, camera->visible_layers); } else { // Setup our camera for our XR interface. // We can support multiple views here each with their own camera @@ -2520,7 +2520,7 @@ void RendererSceneCull::render_camera(const Ref<RenderSceneBuffers> &p_render_bu Projection projections[RendererSceneRender::MAX_RENDER_VIEWS]; uint32_t view_count = p_xr_interface->get_view_count(); - ERR_FAIL_COND_MSG(view_count > RendererSceneRender::MAX_RENDER_VIEWS, "Requested view count is not supported"); + ERR_FAIL_COND_MSG(view_count == 0 || view_count > RendererSceneRender::MAX_RENDER_VIEWS, "Requested view count is not supported"); float aspect = p_viewport_size.width / (float)p_viewport_size.height; @@ -2534,7 +2534,7 @@ void RendererSceneCull::render_camera(const Ref<RenderSceneBuffers> &p_render_bu } if (view_count == 1) { - camera_data.set_camera(transforms[0], projections[0], false, camera->vaspect, jitter); + camera_data.set_camera(transforms[0], projections[0], false, camera->vaspect, jitter, camera->visible_layers); } else if (view_count == 2) { camera_data.set_multiview_camera(view_count, transforms, projections, false, camera->vaspect); } else { diff --git a/servers/rendering/renderer_scene_render.cpp b/servers/rendering/renderer_scene_render.cpp index f085168df3..3c069f6e2e 100644 --- a/servers/rendering/renderer_scene_render.cpp +++ b/servers/rendering/renderer_scene_render.cpp @@ -33,7 +33,7 @@ ///////////////////////////////////////////////////////////////////////////// // CameraData -void RendererSceneRender::CameraData::set_camera(const Transform3D p_transform, const Projection p_projection, bool p_is_orthogonal, bool p_vaspect, const Vector2 &p_taa_jitter) { +void RendererSceneRender::CameraData::set_camera(const Transform3D p_transform, const Projection p_projection, bool p_is_orthogonal, bool p_vaspect, const Vector2 &p_taa_jitter, const uint32_t p_visible_layers) { view_count = 1; is_orthogonal = p_is_orthogonal; vaspect = p_vaspect; @@ -41,6 +41,7 @@ void RendererSceneRender::CameraData::set_camera(const Transform3D p_transform, main_transform = p_transform; main_projection = p_projection; + visible_layers = p_visible_layers; view_offset[0] = Transform3D(); view_projection[0] = p_projection; taa_jitter = p_taa_jitter; @@ -49,6 +50,7 @@ void RendererSceneRender::CameraData::set_camera(const Transform3D p_transform, void RendererSceneRender::CameraData::set_multiview_camera(uint32_t p_view_count, const Transform3D *p_transforms, const Projection *p_projections, bool p_is_orthogonal, bool p_vaspect) { ERR_FAIL_COND_MSG(p_view_count != 2, "Incorrect view count for stereoscopic view"); + visible_layers = 0xFFFFFFFF; view_count = p_view_count; is_orthogonal = p_is_orthogonal; vaspect = p_vaspect; diff --git a/servers/rendering/renderer_scene_render.h b/servers/rendering/renderer_scene_render.h index a8df897077..2c2d5a5a9e 100644 --- a/servers/rendering/renderer_scene_render.h +++ b/servers/rendering/renderer_scene_render.h @@ -268,6 +268,7 @@ public: // flags uint32_t view_count; bool is_orthogonal; + uint32_t visible_layers; bool vaspect; // Main/center projection @@ -278,7 +279,7 @@ public: Projection view_projection[RendererSceneRender::MAX_RENDER_VIEWS]; Vector2 taa_jitter; - void set_camera(const Transform3D p_transform, const Projection p_projection, bool p_is_orthogonal, bool p_vaspect, const Vector2 &p_taa_jitter = Vector2()); + void set_camera(const Transform3D p_transform, const Projection p_projection, bool p_is_orthogonal, bool p_vaspect, const Vector2 &p_taa_jitter = Vector2(), uint32_t p_visible_layers = 0xFFFFFFFF); void set_multiview_camera(uint32_t p_view_count, const Transform3D *p_transforms, const Projection *p_projections, bool p_is_orthogonal, bool p_vaspect); }; diff --git a/servers/rendering/shader_types.cpp b/servers/rendering/shader_types.cpp index 5e1da7c15d..86dd6a8b7e 100644 --- a/servers/rendering/shader_types.cpp +++ b/servers/rendering/shader_types.cpp @@ -100,6 +100,7 @@ ShaderTypes::ShaderTypes() { shader_modes[RS::SHADER_SPATIAL].functions["vertex"].built_ins["NODE_POSITION_WORLD"] = ShaderLanguage::TYPE_VEC3; shader_modes[RS::SHADER_SPATIAL].functions["vertex"].built_ins["CAMERA_POSITION_WORLD"] = ShaderLanguage::TYPE_VEC3; shader_modes[RS::SHADER_SPATIAL].functions["vertex"].built_ins["CAMERA_DIRECTION_WORLD"] = ShaderLanguage::TYPE_VEC3; + shader_modes[RS::SHADER_SPATIAL].functions["vertex"].built_ins["CAMERA_VISIBLE_LAYERS"] = ShaderLanguage::TYPE_UINT; shader_modes[RS::SHADER_SPATIAL].functions["vertex"].built_ins["NODE_POSITION_VIEW"] = ShaderLanguage::TYPE_VEC3; shader_modes[RS::SHADER_SPATIAL].functions["vertex"].built_ins["VIEW_INDEX"] = constt(ShaderLanguage::TYPE_INT); @@ -147,6 +148,7 @@ ShaderTypes::ShaderTypes() { shader_modes[RS::SHADER_SPATIAL].functions["fragment"].built_ins["NODE_POSITION_WORLD"] = ShaderLanguage::TYPE_VEC3; shader_modes[RS::SHADER_SPATIAL].functions["fragment"].built_ins["CAMERA_POSITION_WORLD"] = ShaderLanguage::TYPE_VEC3; shader_modes[RS::SHADER_SPATIAL].functions["fragment"].built_ins["CAMERA_DIRECTION_WORLD"] = ShaderLanguage::TYPE_VEC3; + shader_modes[RS::SHADER_SPATIAL].functions["fragment"].built_ins["CAMERA_VISIBLE_LAYERS"] = ShaderLanguage::TYPE_UINT; shader_modes[RS::SHADER_SPATIAL].functions["fragment"].built_ins["NODE_POSITION_VIEW"] = ShaderLanguage::TYPE_VEC3; shader_modes[RS::SHADER_SPATIAL].functions["fragment"].built_ins["VIEW_INDEX"] = constt(ShaderLanguage::TYPE_INT); diff --git a/servers/text/text_server_extension.cpp b/servers/text/text_server_extension.cpp index dd4cb5accb..64e8b1b5f7 100644 --- a/servers/text/text_server_extension.cpp +++ b/servers/text/text_server_extension.cpp @@ -69,6 +69,12 @@ void TextServerExtension::_bind_methods() { GDVIRTUAL_BIND(_font_set_style_name, "font_rid", "name_style"); GDVIRTUAL_BIND(_font_get_style_name, "font_rid"); + GDVIRTUAL_BIND(_font_set_weight, "font_rid", "weight"); + GDVIRTUAL_BIND(_font_get_weight, "font_rid"); + + GDVIRTUAL_BIND(_font_set_stretch, "font_rid", "stretch"); + GDVIRTUAL_BIND(_font_get_stretch, "font_rid"); + GDVIRTUAL_BIND(_font_set_antialiasing, "font_rid", "antialiasing"); GDVIRTUAL_BIND(_font_get_antialiasing, "font_rid"); @@ -87,6 +93,9 @@ void TextServerExtension::_bind_methods() { GDVIRTUAL_BIND(_font_set_fixed_size, "font_rid", "fixed_size"); GDVIRTUAL_BIND(_font_get_fixed_size, "font_rid"); + GDVIRTUAL_BIND(_font_set_allow_system_fallback, "font_rid", "allow_system_fallback"); + GDVIRTUAL_BIND(_font_is_allow_system_fallback, "font_rid"); + GDVIRTUAL_BIND(_font_set_force_autohinter, "font_rid", "force_autohinter"); GDVIRTUAL_BIND(_font_is_force_autohinter, "font_rid"); @@ -308,6 +317,8 @@ void TextServerExtension::_bind_methods() { GDVIRTUAL_BIND(_string_to_lower, "string", "language"); GDVIRTUAL_BIND(_parse_structured_text, "parser_type", "args", "text"); + + GDVIRTUAL_BIND(_cleanup); } bool TextServerExtension::has_feature(Feature p_feature) const { @@ -434,6 +445,26 @@ String TextServerExtension::font_get_style_name(const RID &p_font_rid) const { return ret; } +void TextServerExtension::font_set_weight(const RID &p_font_rid, int64_t p_weight) { + GDVIRTUAL_CALL(_font_set_weight, p_font_rid, p_weight); +} + +int64_t TextServerExtension::font_get_weight(const RID &p_font_rid) const { + int64_t ret = 400; + GDVIRTUAL_CALL(_font_get_weight, p_font_rid, ret); + return ret; +} + +void TextServerExtension::font_set_stretch(const RID &p_font_rid, int64_t p_stretch) { + GDVIRTUAL_CALL(_font_set_stretch, p_font_rid, p_stretch); +} + +int64_t TextServerExtension::font_get_stretch(const RID &p_font_rid) const { + int64_t ret = 100; + GDVIRTUAL_CALL(_font_get_stretch, p_font_rid, ret); + return ret; +} + void TextServerExtension::font_set_name(const RID &p_font_rid, const String &p_name) { GDVIRTUAL_CALL(_font_set_name, p_font_rid, p_name); } @@ -504,6 +535,16 @@ int64_t TextServerExtension::font_get_fixed_size(const RID &p_font_rid) const { return ret; } +void TextServerExtension::font_set_allow_system_fallback(const RID &p_font_rid, bool p_allow_system_fallback) { + GDVIRTUAL_CALL(_font_set_allow_system_fallback, p_font_rid, p_allow_system_fallback); +} + +bool TextServerExtension::font_is_allow_system_fallback(const RID &p_font_rid) const { + bool ret = false; + GDVIRTUAL_CALL(_font_is_allow_system_fallback, p_font_rid, ret); + return ret; +} + void TextServerExtension::font_set_force_autohinter(const RID &p_font_rid, bool p_force_autohinter) { GDVIRTUAL_CALL(_font_set_force_autohinter, p_font_rid, p_force_autohinter); } @@ -1360,6 +1401,10 @@ bool TextServerExtension::spoof_check(const String &p_string) const { return TextServer::spoof_check(p_string); } +void TextServerExtension::cleanup() { + GDVIRTUAL_CALL(_cleanup); +} + TextServerExtension::TextServerExtension() { //NOP } diff --git a/servers/text/text_server_extension.h b/servers/text/text_server_extension.h index 992b708045..46ed43e9c8 100644 --- a/servers/text/text_server_extension.h +++ b/servers/text/text_server_extension.h @@ -109,6 +109,16 @@ public: GDVIRTUAL2(_font_set_style_name, RID, const String &); GDVIRTUAL1RC(String, _font_get_style_name, RID); + virtual void font_set_weight(const RID &p_font_rid, int64_t p_weight) override; + virtual int64_t font_get_weight(const RID &p_font_rid) const override; + GDVIRTUAL2(_font_set_weight, RID, int); + GDVIRTUAL1RC(int64_t, _font_get_weight, RID); + + virtual void font_set_stretch(const RID &p_font_rid, int64_t p_stretch) override; + virtual int64_t font_get_stretch(const RID &p_font_rid) const override; + GDVIRTUAL2(_font_set_stretch, RID, int); + GDVIRTUAL1RC(int64_t, _font_get_stretch, RID); + virtual void font_set_antialiasing(const RID &p_font_rid, TextServer::FontAntialiasing p_antialiasing) override; virtual TextServer::FontAntialiasing font_get_antialiasing(const RID &p_font_rid) const override; GDVIRTUAL2(_font_set_antialiasing, RID, TextServer::FontAntialiasing); @@ -154,6 +164,11 @@ public: GDVIRTUAL2(_font_set_transform, RID, Transform2D); GDVIRTUAL1RC(Transform2D, _font_get_transform, RID); + virtual void font_set_allow_system_fallback(const RID &p_font_rid, bool p_allow_system_fallback) override; + virtual bool font_is_allow_system_fallback(const RID &p_font_rid) const override; + GDVIRTUAL2(_font_set_allow_system_fallback, RID, bool); + GDVIRTUAL1RC(bool, _font_is_allow_system_fallback, RID); + virtual void font_set_force_autohinter(const RID &p_font_rid, bool p_force_autohinter) override; virtual bool font_is_force_autohinter(const RID &p_font_rid) const override; GDVIRTUAL2(_font_set_force_autohinter, RID, bool); @@ -514,6 +529,9 @@ public: GDVIRTUAL2RC(int64_t, _is_confusable, const String &, const PackedStringArray &); GDVIRTUAL1RC(bool, _spoof_check, const String &); + virtual void cleanup() override; + GDVIRTUAL0(_cleanup); + TextServerExtension(); ~TextServerExtension(); }; diff --git a/servers/text_server.cpp b/servers/text_server.cpp index dfeb5cb70c..1b9cd28cfb 100644 --- a/servers/text_server.cpp +++ b/servers/text_server.cpp @@ -223,6 +223,12 @@ void TextServer::_bind_methods() { ClassDB::bind_method(D_METHOD("font_set_style_name", "font_rid", "name"), &TextServer::font_set_style_name); ClassDB::bind_method(D_METHOD("font_get_style_name", "font_rid"), &TextServer::font_get_style_name); + ClassDB::bind_method(D_METHOD("font_set_weight", "font_rid", "weight"), &TextServer::font_set_weight); + ClassDB::bind_method(D_METHOD("font_get_weight", "font_rid"), &TextServer::font_get_weight); + + ClassDB::bind_method(D_METHOD("font_set_stretch", "font_rid", "weight"), &TextServer::font_set_stretch); + ClassDB::bind_method(D_METHOD("font_get_stretch", "font_rid"), &TextServer::font_get_stretch); + ClassDB::bind_method(D_METHOD("font_set_antialiasing", "font_rid", "antialiasing"), &TextServer::font_set_antialiasing); ClassDB::bind_method(D_METHOD("font_get_antialiasing", "font_rid"), &TextServer::font_get_antialiasing); @@ -241,6 +247,9 @@ void TextServer::_bind_methods() { ClassDB::bind_method(D_METHOD("font_set_fixed_size", "font_rid", "fixed_size"), &TextServer::font_set_fixed_size); ClassDB::bind_method(D_METHOD("font_get_fixed_size", "font_rid"), &TextServer::font_get_fixed_size); + ClassDB::bind_method(D_METHOD("font_set_allow_system_fallback", "font_rid", "allow_system_fallback"), &TextServer::font_set_allow_system_fallback); + ClassDB::bind_method(D_METHOD("font_is_allow_system_fallback", "font_rid"), &TextServer::font_is_allow_system_fallback); + ClassDB::bind_method(D_METHOD("font_set_force_autohinter", "font_rid", "force_autohinter"), &TextServer::font_set_force_autohinter); ClassDB::bind_method(D_METHOD("font_is_force_autohinter", "font_rid"), &TextServer::font_is_force_autohinter); diff --git a/servers/text_server.h b/servers/text_server.h index a4e6080fd0..5da38a627a 100644 --- a/servers/text_server.h +++ b/servers/text_server.h @@ -250,6 +250,12 @@ public: virtual void font_set_style_name(const RID &p_font_rid, const String &p_name) = 0; virtual String font_get_style_name(const RID &p_font_rid) const = 0; + virtual void font_set_weight(const RID &p_font_rid, int64_t p_weight) = 0; + virtual int64_t font_get_weight(const RID &p_font_rid) const = 0; + + virtual void font_set_stretch(const RID &p_font_rid, int64_t p_stretch) = 0; + virtual int64_t font_get_stretch(const RID &p_font_rid) const = 0; + virtual void font_set_antialiasing(const RID &p_font_rid, FontAntialiasing p_antialiasing) = 0; virtual FontAntialiasing font_get_antialiasing(const RID &p_font_rid) const = 0; @@ -268,6 +274,9 @@ public: virtual void font_set_fixed_size(const RID &p_font_rid, int64_t p_fixed_size) = 0; virtual int64_t font_get_fixed_size(const RID &p_font_rid) const = 0; + virtual void font_set_allow_system_fallback(const RID &p_font_rid, bool p_allow_system_fallback) = 0; + virtual bool font_is_allow_system_fallback(const RID &p_font_rid) const = 0; + virtual void font_set_force_autohinter(const RID &p_font_rid, bool p_force_autohinter) = 0; virtual bool font_is_force_autohinter(const RID &p_font_rid) const = 0; @@ -498,6 +507,8 @@ public: TypedArray<Vector2i> parse_structured_text(StructuredTextParser p_parser_type, const Array &p_args, const String &p_text) const; + virtual void cleanup() {} + TextServer(); ~TextServer(); }; diff --git a/tests/scene/test_curve.h b/tests/scene/test_curve.h index 36ec0c0a4d..4afd5b293f 100644 --- a/tests/scene/test_curve.h +++ b/tests/scene/test_curve.h @@ -31,6 +31,7 @@ #ifndef TEST_CURVE_H #define TEST_CURVE_H +#include "core/math/math_funcs.h" #include "scene/resources/curve.h" #include "tests/test_macros.h" @@ -229,7 +230,7 @@ TEST_CASE("[Curve2D] Linear sampling should return exact value") { for (int i = 0; i < len; i++) { Vector2 pos = curve->sample_baked(i); - CHECK_MESSAGE(pos.x == i, "sample_baked should return exact value"); + CHECK_MESSAGE(Math::is_equal_approx(pos.x, i), "sample_baked should return exact value"); } } @@ -245,7 +246,7 @@ TEST_CASE("[Curve3D] Linear sampling should return exact value") { for (int i = 0; i < len; i++) { Vector3 pos = curve->sample_baked(i); - CHECK_MESSAGE(pos.x == i, "sample_baked should return exact value"); + CHECK_MESSAGE(Math::is_equal_approx(pos.x, i), "sample_baked should return exact value"); } } diff --git a/tests/servers/test_text_server.h b/tests/servers/test_text_server.h index 9ebd0f34b4..297f7d2068 100644 --- a/tests/servers/test_text_server.h +++ b/tests/servers/test_text_server.h @@ -68,8 +68,10 @@ TEST_SUITE("[TextServer]") { RID font1 = ts->create_font(); ts->font_set_data_ptr(font1, _font_NotoSans_Regular, _font_NotoSans_Regular_size); + ts->font_set_allow_system_fallback(font1, false); RID font2 = ts->create_font(); ts->font_set_data_ptr(font2, _font_NotoSansThaiUI_Regular, _font_NotoSansThaiUI_Regular_size); + ts->font_set_allow_system_fallback(font2, false); Array font; font.push_back(font1); diff --git a/thirdparty/README.md b/thirdparty/README.md index ad290880e6..937d149747 100644 --- a/thirdparty/README.md +++ b/thirdparty/README.md @@ -44,7 +44,7 @@ Files extracted from upstream source: ## certs - Upstream: Mozilla, via https://github.com/bagder/ca-bundle -- Version: git (7f33e7eb8472dbcf31fdcf50cd216c89a282825d, 2022) +- Version: git (b2f7415648411b6fd7c298c6c92d6552f0165f60, 2022) - License: MPL 2.0 @@ -398,7 +398,7 @@ to solve some MSVC warnings. See the patches in the `patches` directory. ## miniupnpc - Upstream: https://github.com/miniupnp/miniupnp -- Version: 2.2.3 (2df8120326ed4246e049a7a6de707539604cd514, 2021) +- Version: 2.2.4 (7d1d8bc3868b08ad003bad235eee57562b95b76d, 2022) - License: BSD-3-Clause Files extracted from upstream source: @@ -591,7 +591,7 @@ in 10.40, it can be found in the `patches` folder. ## recastnavigation - Upstream: https://github.com/recastnavigation/recastnavigation -- Version: git (5a870d427e47abd4a8e4ce58a95582ec049434d5, 2022) +- Version: git (4fef0446609b23d6ac180ed822817571525528a1, 2022) - License: zlib Files extracted from upstream source: @@ -668,7 +668,7 @@ instead of `miniz.h` as an external dependency. ## thorvg - Upstream: https://github.com/Samsung/thorvg -- Version: 0.8.2 (496796f1e5e85bd5fbba36dae987edb1b3945592, 2022) +- Version: 0.8.3 (a0fcf51f80a75f63a066df085f60cdaf715188b6, 2022) - License: MIT Files extracted from upstream source: diff --git a/thirdparty/certs/ca-certificates.crt b/thirdparty/certs/ca-certificates.crt index 036f630d5b..5ed6adf574 100644 --- a/thirdparty/certs/ca-certificates.crt +++ b/thirdparty/certs/ca-certificates.crt @@ -1,7 +1,7 @@ ## ## Bundle of CA Root Certificates ## -## Certificate data from Mozilla as of: Tue Jul 19 14:20:01 2022 GMT +## Certificate data from Mozilla as of: Fri Oct 21 16:14:43 2022 GMT ## ## This is a bundle of X.509 certificates of public Certificate Authorities ## (CA). These were automatically extracted from Mozilla's root certificates @@ -14,7 +14,7 @@ ## Just configure this file as the SSLCACertificateFile. ## ## Conversion done with mk-ca-bundle.pl version 1.29. -## SHA256: 9bf3799611fb58197f61d45e71ce3dc19f30e7dd73731915872ce5108a7bb066 +## SHA256: 3ff8bd209b5f2e739b9f2b96eacb694a774114685b02978257824f37ff528f71 ## @@ -3458,3 +3458,49 @@ zPUwHQYDVR0OBBYEFP+CMXI++cRmbK04ntGwUYilkMz1MA4GA1UdDwEB/wQEAwIBBjAKBggqhkjO PQQDAwNpADBmAjEA5gVYaWHlLcoNy/EZCL3W/VGSGn5jVASQkZo1kTmZ+gepZpO6yGjUij/67W4W Aie3AjEA3VoXK3YdZUKWpqxdinlW2Iob35reX8dQj7FbcQwm32pAAOwzkSFxvmjkI6TZraE3 -----END CERTIFICATE----- + +Security Communication RootCA3 +============================== +-----BEGIN CERTIFICATE----- +MIIFfzCCA2egAwIBAgIJAOF8N0D9G/5nMA0GCSqGSIb3DQEBDAUAMF0xCzAJBgNVBAYTAkpQMSUw +IwYDVQQKExxTRUNPTSBUcnVzdCBTeXN0ZW1zIENPLixMVEQuMScwJQYDVQQDEx5TZWN1cml0eSBD +b21tdW5pY2F0aW9uIFJvb3RDQTMwHhcNMTYwNjE2MDYxNzE2WhcNMzgwMTE4MDYxNzE2WjBdMQsw +CQYDVQQGEwJKUDElMCMGA1UEChMcU0VDT00gVHJ1c3QgU3lzdGVtcyBDTy4sTFRELjEnMCUGA1UE +AxMeU2VjdXJpdHkgQ29tbXVuaWNhdGlvbiBSb290Q0EzMIICIjANBgkqhkiG9w0BAQEFAAOCAg8A +MIICCgKCAgEA48lySfcw3gl8qUCBWNO0Ot26YQ+TUG5pPDXC7ltzkBtnTCHsXzW7OT4rCmDvu20r +hvtxosis5FaU+cmvsXLUIKx00rgVrVH+hXShuRD+BYD5UpOzQD11EKzAlrenfna84xtSGc4RHwsE +NPXY9Wk8d/Nk9A2qhd7gCVAEF5aEt8iKvE1y/By7z/MGTfmfZPd+pmaGNXHIEYBMwXFAWB6+oHP2 +/D5Q4eAvJj1+XCO1eXDe+uDRpdYMQXF79+qMHIjH7Iv10S9VlkZ8WjtYO/u62C21Jdp6Ts9EriGm +npjKIG58u4iFW/vAEGK78vknR+/RiTlDxN/e4UG/VHMgly1s2vPUB6PmudhvrvyMGS7TZ2crldtY +XLVqAvO4g160a75BflcJdURQVc1aEWEhCmHCqYj9E7wtiS/NYeCVvsq1e+F7NGcLH7YMx3weGVPK +p7FKFSBWFHA9K4IsD50VHUeAR/94mQ4xr28+j+2GaR57GIgUssL8gjMunEst+3A7caoreyYn8xrC +3PsXuKHqy6C0rtOUfnrQq8PsOC0RLoi/1D+tEjtCrI8Cbn3M0V9hvqG8OmpI6iZVIhZdXw3/JzOf +GAN0iltSIEdrRU0id4xVJ/CvHozJgyJUt5rQT9nO/NkuHJYosQLTA70lUhw0Zk8jq/R3gpYd0Vcw +CBEF/VfR2ccCAwEAAaNCMEAwHQYDVR0OBBYEFGQUfPxYchamCik0FW8qy7z8r6irMA4GA1UdDwEB +/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MA0GCSqGSIb3DQEBDAUAA4ICAQDcAiMI4u8hOscNtybS +YpOnpSNyByCCYN8Y11StaSWSntkUz5m5UoHPrmyKO1o5yGwBQ8IibQLwYs1OY0PAFNr0Y/Dq9HHu +Tofjcan0yVflLl8cebsjqodEV+m9NU1Bu0soo5iyG9kLFwfl9+qd9XbXv8S2gVj/yP9kaWJ5rW4O +H3/uHWnlt3Jxs/6lATWUVCvAUm2PVcTJ0rjLyjQIUYWg9by0F1jqClx6vWPGOi//lkkZhOpn2ASx +YfQAW0q3nHE3GYV5v4GwxxMOdnE+OoAGrgYWp421wsTL/0ClXI2lyTrtcoHKXJg80jQDdwj98ClZ +XSEIx2C/pHF7uNkegr4Jr2VvKKu/S7XuPghHJ6APbw+LP6yVGPO5DtxnVW5inkYO0QR4ynKudtml ++LLfiAlhi+8kTtFZP1rUPcmTPCtk9YENFpb3ksP+MW/oKjJ0DvRMmEoYDjBU1cXrvMUVnuiZIesn +KwkK2/HmcBhWuwzkvvnoEKQTkrgc4NtnHVMDpCKn3F2SEDzq//wbEBrD2NCcnWXL0CsnMQMeNuE9 +dnUM/0Umud1RvCPHX9jYhxBAEg09ODfnRDwYwFMJZI//1ZqmfHAuc1Uh6N//g7kdPjIe1qZ9LPFm +6Vwdp6POXiUyK+OVrCoHzrQoeIY8LaadTdJ0MN1kURXbg4NR16/9M51NZg== +-----END CERTIFICATE----- + +Security Communication ECC RootCA1 +================================== +-----BEGIN CERTIFICATE----- +MIICODCCAb6gAwIBAgIJANZdm7N4gS7rMAoGCCqGSM49BAMDMGExCzAJBgNVBAYTAkpQMSUwIwYD +VQQKExxTRUNPTSBUcnVzdCBTeXN0ZW1zIENPLixMVEQuMSswKQYDVQQDEyJTZWN1cml0eSBDb21t +dW5pY2F0aW9uIEVDQyBSb290Q0ExMB4XDTE2MDYxNjA1MTUyOFoXDTM4MDExODA1MTUyOFowYTEL +MAkGA1UEBhMCSlAxJTAjBgNVBAoTHFNFQ09NIFRydXN0IFN5c3RlbXMgQ08uLExURC4xKzApBgNV +BAMTIlNlY3VyaXR5IENvbW11bmljYXRpb24gRUNDIFJvb3RDQTEwdjAQBgcqhkjOPQIBBgUrgQQA +IgNiAASkpW9gAwPDvTH00xecK4R1rOX9PVdu12O/5gSJko6BnOPpR27KkBLIE+CnnfdldB9sELLo +5OnvbYUymUSxXv3MdhDYW72ixvnWQuRXdtyQwjWpS4g8EkdtXP9JTxpKULGjQjBAMB0GA1UdDgQW +BBSGHOf+LaVKiwj+KBH6vqNm+GBZLzAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAK +BggqhkjOPQQDAwNoADBlAjAVXUI9/Lbu9zuxNuie9sRGKEkz0FhDKmMpzE2xtHqiuQ04pV1IKv3L +snNdo4gIxwwCMQDAqy0Obe0YottT6SXbVQjgUMzfRGEWgqtJsLKB7HOHeLRMsmIbEvoWTSVLY70e +N9k= +-----END CERTIFICATE----- diff --git a/thirdparty/miniupnpc/LICENSE b/thirdparty/miniupnpc/LICENSE index fe9118c07e..67ff3bb627 100644 --- a/thirdparty/miniupnpc/LICENSE +++ b/thirdparty/miniupnpc/LICENSE @@ -1,26 +1,29 @@ -MiniUPnP Project -Copyright (c) 2005-2020, Thomas BERNARD +BSD 3-Clause License + +Copyright (c) 2005-2022, Thomas BERNARD All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - * The name of the author may not be used to endorse or promote products - derived from this software without specific prior written permission. +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +3. Neither the name of the copyright holder nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/thirdparty/miniupnpc/include/miniupnpc.h b/thirdparty/miniupnpc/include/miniupnpc.h index a10bd950a8..75fb8b702d 100644 --- a/thirdparty/miniupnpc/include/miniupnpc.h +++ b/thirdparty/miniupnpc/include/miniupnpc.h @@ -1,9 +1,9 @@ -/* $Id: miniupnpc.h,v 1.59 2021/09/28 21:39:17 nanard Exp $ */ +/* $Id: miniupnpc.h,v 1.61 2022/10/21 21:15:02 nanard Exp $ */ /* vim: tabstop=4 shiftwidth=4 noexpandtab * Project: miniupnp - * http://miniupnp.free.fr/ + * http://miniupnp.free.fr/ or https://miniupnp.tuxfamily.org/ * Author: Thomas Bernard - * Copyright (c) 2005-2021 Thomas Bernard + * Copyright (c) 2005-2022 Thomas Bernard * This software is subjects to the conditions detailed * in the LICENCE file provided within this distribution */ #ifndef MINIUPNPC_H_INCLUDED @@ -20,7 +20,7 @@ #define UPNPDISCOVER_MEMORY_ERROR (-102) /* versions : */ -#define MINIUPNPC_VERSION "2.2.3" +#define MINIUPNPC_VERSION "2.2.4" #define MINIUPNPC_API_VERSION 17 /* Source port: diff --git a/thirdparty/miniupnpc/src/miniupnpcstrings.h b/thirdparty/miniupnpc/src/miniupnpcstrings.h index eefbc8dbdd..25abc1016e 100644 --- a/thirdparty/miniupnpc/src/miniupnpcstrings.h +++ b/thirdparty/miniupnpc/src/miniupnpcstrings.h @@ -4,7 +4,7 @@ #include "core/version.h" #define OS_STRING VERSION_NAME "/1.0" -#define MINIUPNPC_VERSION_STRING "2.2.3" +#define MINIUPNPC_VERSION_STRING "2.2.4" #if 0 /* according to "UPnP Device Architecture 1.0" */ diff --git a/thirdparty/miniupnpc/src/minixml.c b/thirdparty/miniupnpc/src/minixml.c index ed2d3c759c..935ec443e7 100644 --- a/thirdparty/miniupnpc/src/minixml.c +++ b/thirdparty/miniupnpc/src/minixml.c @@ -1,4 +1,4 @@ -/* $Id: minixml.c,v 1.10 2012/03/05 19:42:47 nanard Exp $ */ +/* $Id: minixml.c,v 1.12 2017/12/12 11:17:40 nanard Exp $ */ /* vim: tabstop=4 shiftwidth=4 noexpandtab * minixml.c : the minimum size a xml parser can be ! */ /* Project : miniupnp diff --git a/thirdparty/recastnavigation/Recast/Include/Recast.h b/thirdparty/recastnavigation/Recast/Include/Recast.h index 4d557389b5..246376bbee 100644 --- a/thirdparty/recastnavigation/Recast/Include/Recast.h +++ b/thirdparty/recastnavigation/Recast/Include/Recast.h @@ -22,13 +22,16 @@ /// The value of PI used by Recast. static const float RC_PI = 3.14159265f; +/// Used to ignore unused function parameters and silence any compiler warnings. +template<class T> void rcIgnoreUnused(const T&) { } + /// Recast log categories. /// @see rcContext enum rcLogCategory { RC_LOG_PROGRESS = 1, ///< A progress log entry. RC_LOG_WARNING, ///< A warning log entry. - RC_LOG_ERROR, ///< An error log entry. + RC_LOG_ERROR ///< An error log entry. }; /// Recast performance timer categories. @@ -101,7 +104,6 @@ enum rcTimerLabel class rcContext { public: - /// Contructor. /// @param[in] state TRUE if the logging and performance timers should be enabled. [Default: true] inline rcContext(bool state = true) : m_logEnabled(state), m_timerEnabled(state) {} @@ -140,31 +142,30 @@ public: inline int getAccumulatedTime(const rcTimerLabel label) const { return m_timerEnabled ? doGetAccumulatedTime(label) : -1; } protected: - /// Clears all log entries. - virtual void doResetLog() {} + virtual void doResetLog(); /// Logs a message. /// @param[in] category The category of the message. /// @param[in] msg The formatted message. /// @param[in] len The length of the formatted message. - virtual void doLog(const rcLogCategory /*category*/, const char* /*msg*/, const int /*len*/) {} + virtual void doLog(const rcLogCategory category, const char* msg, const int len) { rcIgnoreUnused(category); rcIgnoreUnused(msg); rcIgnoreUnused(len); } /// Clears all timers. (Resets all to unused.) virtual void doResetTimers() {} /// Starts the specified performance timer. /// @param[in] label The category of timer. - virtual void doStartTimer(const rcTimerLabel /*label*/) {} + virtual void doStartTimer(const rcTimerLabel label) { rcIgnoreUnused(label); } /// Stops the specified performance timer. /// @param[in] label The category of the timer. - virtual void doStopTimer(const rcTimerLabel /*label*/) {} + virtual void doStopTimer(const rcTimerLabel label) { rcIgnoreUnused(label); } /// Returns the total accumulated time of the specified performance timer. /// @param[in] label The category of the timer. /// @return The accumulated time of the timer, or -1 if timers are disabled or the timer has never been started. - virtual int doGetAccumulatedTime(const rcTimerLabel /*label*/) const { return -1; } + virtual int doGetAccumulatedTime(const rcTimerLabel label) const { rcIgnoreUnused(label); return -1; } /// True if logging is enabled. bool m_logEnabled; @@ -564,7 +565,7 @@ static const int RC_AREA_BORDER = 0x20000; enum rcBuildContoursFlags { RC_CONTOUR_TESS_WALL_EDGES = 0x01, ///< Tessellate solid (impassable) edges during contour simplification. - RC_CONTOUR_TESS_AREA_EDGES = 0x02, ///< Tessellate edges between areas during contour simplification. + RC_CONTOUR_TESS_AREA_EDGES = 0x02 ///< Tessellate edges between areas during contour simplification. }; /// Applied to the region id field of contour vertices in order to extract the region id. @@ -595,11 +596,6 @@ static const int RC_NOT_CONNECTED = 0x3f; /// @name General helper functions /// @{ -/// Used to ignore a function parameter. VS complains about unused parameters -/// and this silences the warning. -/// @param [in] _ Unused parameter -template<class T> void rcIgnoreUnused(const T&) { } - /// Swaps the values of the two parameters. /// @param[in,out] a Value A /// @param[in,out] b Value B @@ -996,6 +992,7 @@ void rcMarkConvexPolyArea(rcContext* ctx, const float* verts, const int nverts, /// @ingroup recast /// @param[in] verts The vertices of the polygon [Form: (x, y, z) * @p nverts] /// @param[in] nverts The number of vertices in the polygon. +/// @param[in] offset How much to offset the polygon by. [Units: wu] /// @param[out] outVerts The offset vertices (should hold up to 2 * @p nverts) [Form: (x, y, z) * return value] /// @param[in] maxOutVerts The max number of vertices that can be stored to @p outVerts. /// @returns Number of vertices in the offset polygon or 0 if too few vertices in @p outVerts. diff --git a/thirdparty/recastnavigation/Recast/Include/RecastAlloc.h b/thirdparty/recastnavigation/Recast/Include/RecastAlloc.h index 071278d659..8b166d736d 100644 --- a/thirdparty/recastnavigation/Recast/Include/RecastAlloc.h +++ b/thirdparty/recastnavigation/Recast/Include/RecastAlloc.h @@ -112,7 +112,7 @@ class rcVectorBase { typedef rcSizeType size_type; typedef T value_type; - rcVectorBase() : m_size(0), m_cap(0), m_data(0) {}; + rcVectorBase() : m_size(0), m_cap(0), m_data(0) {} rcVectorBase(const rcVectorBase<T, H>& other) : m_size(0), m_cap(0), m_data(0) { assign(other.begin(), other.end()); } explicit rcVectorBase(rcSizeType count) : m_size(0), m_cap(0), m_data(0) { resize(count); } rcVectorBase(rcSizeType count, const T& value) : m_size(0), m_cap(0), m_data(0) { resize(count, value); } @@ -142,8 +142,8 @@ class rcVectorBase { const T& front() const { rcAssert(m_size); return m_data[0]; } T& front() { rcAssert(m_size); return m_data[0]; } - const T& back() const { rcAssert(m_size); return m_data[m_size - 1]; }; - T& back() { rcAssert(m_size); return m_data[m_size - 1]; }; + const T& back() const { rcAssert(m_size); return m_data[m_size - 1]; } + T& back() { rcAssert(m_size); return m_data[m_size - 1]; } const T* data() const { return m_data; } T* data() { return m_data; } diff --git a/thirdparty/recastnavigation/Recast/Source/Recast.cpp b/thirdparty/recastnavigation/Recast/Source/Recast.cpp index 1b71710cdc..4cf145c981 100644 --- a/thirdparty/recastnavigation/Recast/Source/Recast.cpp +++ b/thirdparty/recastnavigation/Recast/Source/Recast.cpp @@ -94,6 +94,11 @@ void rcContext::log(const rcLogCategory category, const char* format, ...) doLog(category, msg, len); } +void rcContext::doResetLog() +{ + // Defined out of line to fix the weak v-tables warning +} + rcHeightfield* rcAllocHeightfield() { return rcNew<rcHeightfield>(RC_ALLOC_PERM); diff --git a/thirdparty/recastnavigation/Recast/Source/RecastMesh.cpp b/thirdparty/recastnavigation/Recast/Source/RecastMesh.cpp index e99eaebb79..ea09ee1de0 100644 --- a/thirdparty/recastnavigation/Recast/Source/RecastMesh.cpp +++ b/thirdparty/recastnavigation/Recast/Source/RecastMesh.cpp @@ -566,7 +566,6 @@ static bool canRemoveVertex(rcContext* ctx, rcPolyMesh& mesh, const unsigned sho const int nvp = mesh.nvp; // Count number of polygons to remove. - int numRemovedVerts = 0; int numTouchedVerts = 0; int numRemainingEdges = 0; for (int i = 0; i < mesh.npolys; ++i) @@ -586,7 +585,6 @@ static bool canRemoveVertex(rcContext* ctx, rcPolyMesh& mesh, const unsigned sho } if (numRemoved) { - numRemovedVerts += numRemoved; numRemainingEdges += numVerts-(numRemoved+1); } } diff --git a/thirdparty/recastnavigation/Recast/Source/RecastMeshDetail.cpp b/thirdparty/recastnavigation/Recast/Source/RecastMeshDetail.cpp index 1999200c1a..40bfc9b4bc 100644 --- a/thirdparty/recastnavigation/Recast/Source/RecastMeshDetail.cpp +++ b/thirdparty/recastnavigation/Recast/Source/RecastMeshDetail.cpp @@ -284,7 +284,7 @@ static unsigned short getHeight(const float fx, const float fy, const float fz, enum EdgeValues { EV_UNDEF = -1, - EV_HULL = -2, + EV_HULL = -2 }; static int findEdge(const int* edges, int nedges, int s, int t) diff --git a/thirdparty/recastnavigation/Recast/Source/RecastRasterization.cpp b/thirdparty/recastnavigation/Recast/Source/RecastRasterization.cpp index a4cef74909..673550e79e 100644 --- a/thirdparty/recastnavigation/Recast/Source/RecastRasterization.cpp +++ b/thirdparty/recastnavigation/Recast/Source/RecastRasterization.cpp @@ -264,7 +264,8 @@ static bool rasterizeTri(const float* v0, const float* v1, const float* v2, // Calculate the footprint of the triangle on the grid's y-axis int y0 = (int)((tmin[2] - bmin[2])*ics); int y1 = (int)((tmax[2] - bmin[2])*ics); - y0 = rcClamp(y0, 0, h-1); + // use -1 rather than 0 to cut the polygon properly at the start of the tile + y0 = rcClamp(y0, -1, h-1); y1 = rcClamp(y1, 0, h-1); // Clip the triangle into all grid cells it touches. @@ -283,7 +284,7 @@ static bool rasterizeTri(const float* v0, const float* v1, const float* v2, dividePoly(in, nvIn, inrow, &nvrow, p1, &nvIn, cz+cs, 2); rcSwap(in, p1); if (nvrow < 3) continue; - + if (y < 0) continue; // find the horizontal bounds in the row float minX = inrow[0], maxX = inrow[0]; for (int i=1; i<nvrow; ++i) @@ -293,7 +294,10 @@ static bool rasterizeTri(const float* v0, const float* v1, const float* v2, } int x0 = (int)((minX - bmin[0])*ics); int x1 = (int)((maxX - bmin[0])*ics); - x0 = rcClamp(x0, 0, w-1); + if (x1 < 0 || x0 >= w) { + continue; + } + x0 = rcClamp(x0, -1, w-1); x1 = rcClamp(x1, 0, w-1); int nv, nv2 = nvrow; @@ -305,7 +309,7 @@ static bool rasterizeTri(const float* v0, const float* v1, const float* v2, dividePoly(inrow, nv2, p1, &nv, p2, &nv2, cx+cs, 0); rcSwap(inrow, p2); if (nv < 3) continue; - + if (x < 0) continue; // Calculate min and max of the span. float smin = p1[1], smax = p1[1]; for (int i = 1; i < nv; ++i) diff --git a/thirdparty/thorvg/inc/config.h b/thirdparty/thorvg/inc/config.h index 68935c583b..eda302aec0 100644 --- a/thirdparty/thorvg/inc/config.h +++ b/thirdparty/thorvg/inc/config.h @@ -13,5 +13,5 @@ #define THORVG_JPG_LOADER_SUPPORT 1 -#define THORVG_VERSION_STRING "0.8.2" +#define THORVG_VERSION_STRING "0.8.3" #endif diff --git a/thirdparty/thorvg/inc/thorvg.h b/thirdparty/thorvg/inc/thorvg.h index b08356d9d5..7e8988a65e 100644 --- a/thirdparty/thorvg/inc/thorvg.h +++ b/thirdparty/thorvg/inc/thorvg.h @@ -18,7 +18,7 @@ #include <string> #ifdef TVG_BUILD - #if defined(_MSC_VER) && !defined(__clang__) + #if defined(_WIN32) && !defined(__clang__) #define TVG_EXPORT __declspec(dllexport) #define TVG_DEPRECATED __declspec(deprecated) #else @@ -74,7 +74,7 @@ class Accessor; /** * @brief Enumeration specifying the result from the APIs. */ -enum class TVG_EXPORT Result +enum class Result { Success = 0, ///< The value returned in case of a correct request execution. InvalidArguments, ///< The value returned in the event of a problem with the arguments given to the API - e.g. empty paths or null pointers. @@ -91,7 +91,7 @@ enum class TVG_EXPORT Result * Not to be confused with the path commands from the svg path element (like M, L, Q, H and many others). * TVG interprets all of them and translates to the ones from the PathCommand values. */ -enum class TVG_EXPORT PathCommand +enum class PathCommand { Close = 0, ///< Ends the current sub-path and connects it with its initial point. This command doesn't expect any points. MoveTo, ///< Sets a new initial point of the sub-path and a new current point. This command expects 1 point: the starting position. @@ -102,7 +102,7 @@ enum class TVG_EXPORT PathCommand /** * @brief Enumeration determining the ending type of a stroke in the open sub-paths. */ -enum class TVG_EXPORT StrokeCap +enum class StrokeCap { Square = 0, ///< The stroke is extended in both end-points of a sub-path by a rectangle, with the width equal to the stroke width and the length equal to the half of the stroke width. For zero length sub-paths the square is rendered with the size of the stroke width. Round, ///< The stroke is extended in both end-points of a sub-path by a half circle, with a radius equal to the half of a stroke width. For zero length sub-paths a full circle is rendered. @@ -112,7 +112,7 @@ enum class TVG_EXPORT StrokeCap /** * @brief Enumeration determining the style used at the corners of joined stroked path segments. */ -enum class TVG_EXPORT StrokeJoin +enum class StrokeJoin { Bevel = 0, ///< The outer corner of the joined path segments is bevelled at the join point. The triangular region of the corner is enclosed by a straight line between the outer corners of each stroke. Round, ///< The outer corner of the joined path segments is rounded. The circular region is centered at the join point. @@ -122,7 +122,7 @@ enum class TVG_EXPORT StrokeJoin /** * @brief Enumeration specifying how to fill the area outside the gradient bounds. */ -enum class TVG_EXPORT FillSpread +enum class FillSpread { Pad = 0, ///< The remaining area is filled with the closest stop color. Reflect, ///< The gradient pattern is reflected outside the gradient area until the expected region is filled. @@ -132,7 +132,7 @@ enum class TVG_EXPORT FillSpread /** * @brief Enumeration specifying the algorithm used to establish which parts of the shape are treated as the inside of the shape. */ -enum class TVG_EXPORT FillRule +enum class FillRule { Winding = 0, ///< A line from the point to a location outside the shape is drawn. The intersections of the line with the path segment of the shape are counted. Starting from zero, if the path segment of the shape crosses the line clockwise, one is added, otherwise one is subtracted. If the resulting sum is non zero, the point is inside the shape. EvenOdd ///< A line from the point to a location outside the shape is drawn and its intersections with the path segments of the shape are counted. If the number of intersections is an odd number, the point is inside the shape. @@ -141,7 +141,7 @@ enum class TVG_EXPORT FillRule /** * @brief Enumeration indicating the method used in the composition of two objects - the target and the source. */ -enum class TVG_EXPORT CompositeMethod +enum class CompositeMethod { None = 0, ///< No composition is applied. ClipPath, ///< The intersection of the source and the target is determined and only the resulting pixels from the source are rendered. @@ -153,7 +153,7 @@ enum class TVG_EXPORT CompositeMethod /** * @brief Enumeration specifying the engine type used for the graphics backend. For multiple backends bitwise operation is allowed. */ -enum class TVG_EXPORT CanvasEngine +enum class CanvasEngine { Sw = (1 << 1), ///< CPU rasterizer. Gl = (1 << 2) ///< OpenGL rasterizer. diff --git a/thirdparty/thorvg/src/lib/sw_engine/tvgSwRaster.cpp b/thirdparty/thorvg/src/lib/sw_engine/tvgSwRaster.cpp index bf1c10a0c3..ffd74bdd47 100644 --- a/thirdparty/thorvg/src/lib/sw_engine/tvgSwRaster.cpp +++ b/thirdparty/thorvg/src/lib/sw_engine/tvgSwRaster.cpp @@ -22,10 +22,10 @@ #ifdef _WIN32 #include <malloc.h> -#elif __FreeBSD__ - #include<stdlib.h> -#else +#elif defined(__linux__) #include <alloca.h> +#else + #include <stdlib.h> #endif #include "tvgMath.h" diff --git a/thirdparty/thorvg/src/lib/sw_engine/tvgSwRasterTexmapInternal.h b/thirdparty/thorvg/src/lib/sw_engine/tvgSwRasterTexmapInternal.h index f31ea1eb97..50536299b1 100644 --- a/thirdparty/thorvg/src/lib/sw_engine/tvgSwRasterTexmapInternal.h +++ b/thirdparty/thorvg/src/lib/sw_engine/tvgSwRasterTexmapInternal.h @@ -30,7 +30,7 @@ int32_t dw = surface->stride; int32_t x1, x2, x, y, ar, ab, iru, irv, px, ay; int32_t vv = 0, uu = 0; - int32_t minx, maxx; + int32_t minx = INT32_MAX, maxx = INT32_MIN; float dx, u, v, iptr; uint32_t* buf; SwSpan* span = nullptr; //used only when rle based. diff --git a/thirdparty/thorvg/src/lib/tvgLoadModule.h b/thirdparty/thorvg/src/lib/tvgLoadModule.h index bfcc165f31..004983152b 100644 --- a/thirdparty/thorvg/src/lib/tvgLoadModule.h +++ b/thirdparty/thorvg/src/lib/tvgLoadModule.h @@ -36,7 +36,6 @@ public: float vw = 0; float vh = 0; float w = 0, h = 0; //default image size - bool preserveAspect = true; //keep aspect ratio by default. virtual ~LoadModule() {} diff --git a/thirdparty/thorvg/src/loaders/jpg/tvgJpgLoader.cpp b/thirdparty/thorvg/src/loaders/jpg/tvgJpgLoader.cpp index ffdef3004c..d11dfc1e7c 100644 --- a/thirdparty/thorvg/src/loaders/jpg/tvgJpgLoader.cpp +++ b/thirdparty/thorvg/src/loaders/jpg/tvgJpgLoader.cpp @@ -118,9 +118,9 @@ unique_ptr<Surface> JpgLoader::bitmap() auto surface = static_cast<Surface*>(malloc(sizeof(Surface))); surface->buffer = (uint32_t*)(image); - surface->stride = w; - surface->w = w; - surface->h = h; + surface->stride = static_cast<uint32_t>(w); + surface->w = static_cast<uint32_t>(w); + surface->h = static_cast<uint32_t>(h); surface->cs = SwCanvas::ARGB8888; return unique_ptr<Surface>(surface); diff --git a/thirdparty/thorvg/src/loaders/jpg/tvgJpgd.cpp b/thirdparty/thorvg/src/loaders/jpg/tvgJpgd.cpp index dacd45ed03..56b40acf0b 100644 --- a/thirdparty/thorvg/src/loaders/jpg/tvgJpgd.cpp +++ b/thirdparty/thorvg/src/loaders/jpg/tvgJpgd.cpp @@ -808,7 +808,7 @@ inline int jpeg_decoder::huff_decode(huff_tables *pH, int& extra_bits) // Tables and macro used to fully decode the DPCM differences. static const int s_extend_test[16] = { 0, 0x0001, 0x0002, 0x0004, 0x0008, 0x0010, 0x0020, 0x0040, 0x0080, 0x0100, 0x0200, 0x0400, 0x0800, 0x1000, 0x2000, 0x4000 }; -static const unsigned int s_extend_offset[16] = { 0, ((-1u)<<1) + 1, ((-1u)<<2) + 1, ((-1u)<<3) + 1, ((-1u)<<4) + 1, ((-1u)<<5) + 1, ((-1u)<<6) + 1, ((-1u)<<7) + 1, ((-1u)<<8) + 1, ((-1u)<<9) + 1, ((-1u)<<10) + 1, ((-1u)<<11) + 1, ((-1u)<<12) + 1, ((-1u)<<13) + 1, ((-1u)<<14) + 1, ((-1u)<<15) + 1 }; +static const unsigned int s_extend_offset[16] = { 0, ((~0u)<<1) + 1, ((~0u)<<2) + 1, ((~0u)<<3) + 1, ((~0u)<<4) + 1, ((~0u)<<5) + 1, ((~0u)<<6) + 1, ((~0u)<<7) + 1, ((~0u)<<8) + 1, ((~0u)<<9) + 1, ((~0u)<<10) + 1, ((~0u)<<11) + 1, ((~0u)<<12) + 1, ((~0u)<<13) + 1, ((~0u)<<14) + 1, ((~0u)<<15) + 1 }; // The logical AND's in this macro are to shut up static code analysis (aren't really necessary - couldn't find another way to do this) #define JPGD_HUFF_EXTEND(x, s) (((x) < s_extend_test[s & 15]) ? ((x) + s_extend_offset[s & 15]) : (x)) diff --git a/thirdparty/thorvg/src/loaders/raw/tvgRawLoader.cpp b/thirdparty/thorvg/src/loaders/raw/tvgRawLoader.cpp index 2da399d8c3..889f130ce9 100644 --- a/thirdparty/thorvg/src/loaders/raw/tvgRawLoader.cpp +++ b/thirdparty/thorvg/src/loaders/raw/tvgRawLoader.cpp @@ -78,9 +78,9 @@ unique_ptr<Surface> RawLoader::bitmap() auto surface = static_cast<Surface*>(malloc(sizeof(Surface))); surface->buffer = (uint32_t*)(content); - surface->stride = w; - surface->w = w; - surface->h = h; + surface->stride = (uint32_t)w; + surface->w = (uint32_t)w; + surface->h = (uint32_t)h; surface->cs = SwCanvas::ARGB8888; return unique_ptr<Surface>(surface); diff --git a/thirdparty/thorvg/src/loaders/svg/tvgSvgCssStyle.cpp b/thirdparty/thorvg/src/loaders/svg/tvgSvgCssStyle.cpp index 8f46b62ce9..478ba5d3d1 100644 --- a/thirdparty/thorvg/src/loaders/svg/tvgSvgCssStyle.cpp +++ b/thirdparty/thorvg/src/loaders/svg/tvgSvgCssStyle.cpp @@ -42,7 +42,10 @@ static void _copyStyle(SvgStyleProperty* to, const SvgStyleProperty* from) to->fill.paint.color = from->fill.paint.color; to->fill.paint.none = from->fill.paint.none; to->fill.paint.curColor = from->fill.paint.curColor; - if (from->fill.paint.url) to->fill.paint.url = strdup(from->fill.paint.url); + if (from->fill.paint.url) { + if (to->fill.paint.url) free(to->fill.paint.url); + to->fill.paint.url = strdup(from->fill.paint.url); + } to->fill.flags = (SvgFillFlags)((int)to->fill.flags | (int)SvgFillFlags::Paint); to->flags = (SvgStyleFlags)((int)to->flags | (int)SvgStyleFlags::Fill); } @@ -61,7 +64,10 @@ static void _copyStyle(SvgStyleProperty* to, const SvgStyleProperty* from) to->stroke.paint.color = from->stroke.paint.color; to->stroke.paint.none = from->stroke.paint.none; to->stroke.paint.curColor = from->stroke.paint.curColor; - if (from->stroke.paint.url) to->stroke.paint.url = strdup(from->stroke.paint.url); + if (from->stroke.paint.url) { + if (to->stroke.paint.url) free(to->stroke.paint.url); + to->stroke.paint.url = strdup(from->stroke.paint.url); + } to->stroke.flags = (SvgStrokeFlags)((int)to->stroke.flags | (int)SvgStrokeFlags::Paint); to->flags = (SvgStyleFlags)((int)to->flags | (int)SvgStyleFlags::Stroke); } @@ -122,8 +128,14 @@ void cssCopyStyleAttr(SvgNode* to, const SvgNode* from) //Copy style attribute _copyStyle(to->style, from->style); - if (from->style->clipPath.url) to->style->clipPath.url = strdup(from->style->clipPath.url); - if (from->style->mask.url) to->style->mask.url = strdup(from->style->mask.url); + if (from->style->clipPath.url) { + if (to->style->clipPath.url) free(to->style->clipPath.url); + to->style->clipPath.url = strdup(from->style->clipPath.url); + } + if (from->style->mask.url) { + if (to->style->mask.url) free(to->style->mask.url); + to->style->mask.url = strdup(from->style->mask.url); + } } diff --git a/thirdparty/thorvg/src/loaders/svg/tvgSvgLoader.cpp b/thirdparty/thorvg/src/loaders/svg/tvgSvgLoader.cpp index 42bfd4de70..737fd96455 100644 --- a/thirdparty/thorvg/src/loaders/svg/tvgSvgLoader.cpp +++ b/thirdparty/thorvg/src/loaders/svg/tvgSvgLoader.cpp @@ -115,9 +115,54 @@ static bool _parseNumber(const char** content, float* number) if ((*content) == end) return false; //Skip comma if any *content = _skipComma(end); + return true; } + +static constexpr struct +{ + AspectRatioAlign align; + const char* tag; +} alignTags[] = { + { AspectRatioAlign::XMinYMin, "xMinYMin" }, + { AspectRatioAlign::XMidYMin, "xMidYMin" }, + { AspectRatioAlign::XMaxYMin, "xMaxYMin" }, + { AspectRatioAlign::XMinYMid, "xMinYMid" }, + { AspectRatioAlign::XMidYMid, "xMidYMid" }, + { AspectRatioAlign::XMaxYMid, "xMaxYMid" }, + { AspectRatioAlign::XMinYMax, "xMinYMax" }, + { AspectRatioAlign::XMidYMax, "xMidYMax" }, + { AspectRatioAlign::XMaxYMax, "xMaxYMax" }, +}; + + +static bool _parseAspectRatio(const char** content, AspectRatioAlign* align, AspectRatioMeetOrSlice* meetOrSlice) +{ + if (!strcmp(*content, "none")) { + *align = AspectRatioAlign::None; + return true; + } + + for (unsigned int i = 0; i < sizeof(alignTags) / sizeof(alignTags[0]); i++) { + if (!strncmp(*content, alignTags[i].tag, 8)) { + *align = alignTags[i].align; + *content += 8; + *content = _skipSpace(*content, nullptr); + break; + } + } + + if (!strcmp(*content, "meet")) { + *meetOrSlice = AspectRatioMeetOrSlice::Meet; + } else if (!strcmp(*content, "slice")) { + *meetOrSlice = AspectRatioMeetOrSlice::Slice; + } + + return true; +} + + /** * According to https://www.w3.org/TR/SVG/coords.html#Units */ @@ -554,6 +599,7 @@ static void _toColor(const char* str, uint8_t* r, uint8_t* g, uint8_t* b, char** } } } else if (ref && len >= 3 && !strncmp(str, "url", 3)) { + if (*ref) free(*ref); *ref = _idFromUrl((const char*)(str + 3)); } else { //Handle named color @@ -802,7 +848,7 @@ static bool _attrParseSvgNode(void* data, const char* key, const char* value) } loader->svgParse->global.x = (int)doc->vx; } else if (!strcmp(key, "preserveAspectRatio")) { - if (!strcmp(value, "none")) doc->preserveAspect = false; + _parseAspectRatio(&value, &doc->align, &doc->meetOrSlice); } else if (!strcmp(key, "style")) { return simpleXmlParseW3CAttribute(value, strlen(value), _parseStyleAttr, loader); #ifdef THORVG_LOG_ENABLED @@ -1156,7 +1202,7 @@ static bool _attrParseSymbolNode(void* data, const char* key, const char* value) symbol->h = _toFloat(loader->svgParse, value, SvgParserLengthType::Vertical); symbol->hasHeight = true; } else if (!strcmp(key, "preserveAspectRatio")) { - if (!strcmp(value, "none")) symbol->preserveAspect = false; + _parseAspectRatio(&value, &symbol->align, &symbol->meetOrSlice); } else if (!strcmp(key, "overflow")) { if (!strcmp(value, "visible")) symbol->overflowVisible = true; } else { @@ -1248,7 +1294,8 @@ static SvgNode* _createSvgNode(SvgLoaderData* loader, SvgNode* parent, const cha loader->svgParse->global.w = 0; loader->svgParse->global.h = 0; - doc->preserveAspect = true; + doc->align = AspectRatioAlign::XMidYMid; + doc->meetOrSlice = AspectRatioMeetOrSlice::Meet; func(buf, bufLength, _attrParseSvgNode, loader); if (loader->svgParse->global.w == 0) { @@ -1309,7 +1356,8 @@ static SvgNode* _createSymbolNode(SvgLoaderData* loader, SvgNode* parent, const if (!loader->svgParse->node) return nullptr; loader->svgParse->node->display = false; - loader->svgParse->node->node.symbol.preserveAspect = true; + loader->svgParse->node->node.symbol.align = AspectRatioAlign::XMidYMid; + loader->svgParse->node->node.symbol.meetOrSlice = AspectRatioMeetOrSlice::Meet; loader->svgParse->node->node.symbol.overflowVisible = false; loader->svgParse->node->node.symbol.hasViewBox = false; @@ -1331,6 +1379,7 @@ static bool _attrParsePathNode(void* data, const char* key, const char* value) SvgPathNode* path = &(node->node.path); if (!strcmp(key, "d")) { + if (path->path) free(path->path); //Temporary: need to copy path->path = _copyId(value); } else if (!strcmp(key, "style")) { @@ -1801,19 +1850,10 @@ static SvgNode* _getDefsNode(SvgNode* node) } -static SvgNode* _findChildById(const SvgNode* node, const char* id) +static SvgNode* _findNodeById(SvgNode *node, const char* id) { if (!node) return nullptr; - auto child = node->child.data; - for (uint32_t i = 0; i < node->child.count; ++i, ++child) { - if (((*child)->id) && !strcmp((*child)->id, id)) return (*child); - } - return nullptr; -} - -static SvgNode* _findNodeById(SvgNode *node, const char* id) -{ SvgNode* result = nullptr; if (node->id && !strcmp(node->id, id)) return node; @@ -1827,6 +1867,7 @@ static SvgNode* _findNodeById(SvgNode *node, const char* id) return result; } + static void _cloneGradStops(Array<Fill::ColorStop>& dst, const Array<Fill::ColorStop>& src) { for (uint32_t i = 0; i < src.count; ++i) { @@ -1889,7 +1930,10 @@ static void _styleInherit(SvgStyleProperty* child, const SvgStyleProperty* paren child->fill.paint.color = parent->fill.paint.color; child->fill.paint.none = parent->fill.paint.none; child->fill.paint.curColor = parent->fill.paint.curColor; - if (parent->fill.paint.url) child->fill.paint.url = _copyId(parent->fill.paint.url); + if (parent->fill.paint.url) { + if (child->fill.paint.url) free(child->fill.paint.url); + child->fill.paint.url = _copyId(parent->fill.paint.url); + } } if (!((int)child->fill.flags & (int)SvgFillFlags::Opacity)) { child->fill.opacity = parent->fill.opacity; @@ -1902,7 +1946,12 @@ static void _styleInherit(SvgStyleProperty* child, const SvgStyleProperty* paren child->stroke.paint.color = parent->stroke.paint.color; child->stroke.paint.none = parent->stroke.paint.none; child->stroke.paint.curColor = parent->stroke.paint.curColor; - child->stroke.paint.url = parent->stroke.paint.url ? _copyId(parent->stroke.paint.url) : nullptr; + if (parent->stroke.paint.url) { + if (child->stroke.paint.url) free(child->stroke.paint.url); + child->stroke.paint.url = _copyId(parent->stroke.paint.url); + } else { + child->stroke.paint.url = nullptr; + } } if (!((int)child->stroke.flags & (int)SvgStrokeFlags::Opacity)) { child->stroke.opacity = parent->stroke.opacity; @@ -1942,7 +1991,10 @@ static void _styleCopy(SvgStyleProperty* to, const SvgStyleProperty* from) to->fill.paint.color = from->fill.paint.color; to->fill.paint.none = from->fill.paint.none; to->fill.paint.curColor = from->fill.paint.curColor; - if (from->fill.paint.url) to->fill.paint.url = _copyId(from->fill.paint.url); + if (from->fill.paint.url) { + if (to->fill.paint.url) free(to->fill.paint.url); + to->fill.paint.url = _copyId(from->fill.paint.url); + } } if (((int)from->fill.flags & (int)SvgFillFlags::Opacity)) { to->fill.opacity = from->fill.opacity; @@ -1956,7 +2008,12 @@ static void _styleCopy(SvgStyleProperty* to, const SvgStyleProperty* from) to->stroke.paint.color = from->stroke.paint.color; to->stroke.paint.none = from->stroke.paint.none; to->stroke.paint.curColor = from->stroke.paint.curColor; - to->stroke.paint.url = from->stroke.paint.url ? _copyId(from->stroke.paint.url) : nullptr; + if (from->stroke.paint.url) { + if (to->stroke.paint.url) free(to->stroke.paint.url); + to->stroke.paint.url = _copyId(from->stroke.paint.url); + } else { + to->stroke.paint.url = nullptr; + } } if (((int)from->stroke.flags & (int)SvgStrokeFlags::Opacity)) { to->stroke.opacity = from->stroke.opacity; @@ -1992,10 +2049,14 @@ static void _copyAttr(SvgNode* to, const SvgNode* from) //Copy style attribute _styleCopy(to->style, from->style); to->style->flags = (SvgStyleFlags)((int)to->style->flags | (int)from->style->flags); - if (from->style->fill.paint.url) to->style->fill.paint.url = strdup(from->style->fill.paint.url); - if (from->style->stroke.paint.url) to->style->stroke.paint.url = strdup(from->style->stroke.paint.url); - if (from->style->clipPath.url) to->style->clipPath.url = strdup(from->style->clipPath.url); - if (from->style->mask.url) to->style->mask.url = strdup(from->style->mask.url); + if (from->style->clipPath.url) { + if (to->style->clipPath.url) free(to->style->clipPath.url); + to->style->clipPath.url = strdup(from->style->clipPath.url); + } + if (from->style->mask.url) { + if (to->style->mask.url) free(to->style->mask.url); + to->style->mask.url = strdup(from->style->mask.url); + } //Copy node attribute switch (from->type) { @@ -2031,7 +2092,10 @@ static void _copyAttr(SvgNode* to, const SvgNode* from) break; } case SvgNodeType::Path: { - if (from->node.path.path) to->node.path.path = strdup(from->node.path.path); + if (from->node.path.path) { + if (to->node.path.path) free(to->node.path.path); + to->node.path.path = strdup(from->node.path.path); + } break; } case SvgNodeType::Polygon: { @@ -2053,7 +2117,10 @@ static void _copyAttr(SvgNode* to, const SvgNode* from) to->node.image.y = from->node.image.y; to->node.image.w = from->node.image.w; to->node.image.h = from->node.image.h; - if (from->node.image.href) to->node.image.href = strdup(from->node.image.href); + if (from->node.image.href) { + if (to->node.image.href) free(to->node.image.href); + to->node.image.href = strdup(from->node.image.href); + } break; } default: { @@ -2093,8 +2160,8 @@ static void _clonePostponedNodes(Array<SvgNodeIdPair>* cloneNodes, SvgNode* doc) for (uint32_t i = 0; i < cloneNodes->count; ++i) { auto nodeIdPair = cloneNodes->data[i]; auto defs = _getDefsNode(nodeIdPair.node); - auto nodeFrom = _findChildById(defs, nodeIdPair.id); - if (!nodeFrom) nodeFrom = _findChildById(doc, nodeIdPair.id); + auto nodeFrom = _findNodeById(defs, nodeIdPair.id); + if (!nodeFrom) nodeFrom = _findNodeById(doc, nodeIdPair.id); _cloneNode(nodeFrom, nodeIdPair.node, 0); if (nodeFrom && nodeFrom->type == SvgNodeType::Symbol && nodeIdPair.node->type == SvgNodeType::Use) { nodeIdPair.node->node.use.symbol = nodeFrom; @@ -2141,7 +2208,7 @@ static bool _attrParseUseNode(void* data, const char* key, const char* value) if (!strcmp(key, "href") || !strcmp(key, "xlink:href")) { id = _idFromHref(value); defs = _getDefsNode(node); - nodeFrom = _findChildById(defs, id); + nodeFrom = _findNodeById(defs, id); if (nodeFrom) { _cloneNode(nodeFrom, node, 0); if (nodeFrom->type == SvgNodeType::Symbol) use->symbol = nodeFrom; @@ -2695,10 +2762,14 @@ static void _svgLoaderParserXmlOpen(SvgLoaderData* loader, const char* content, if (loader->stack.count > 0) parent = loader->stack.data[loader->stack.count - 1]; else parent = loader->doc; if (!strcmp(tagName, "style")) { - node = method(loader, nullptr, attrs, attrsLength, simpleXmlParseAttributes); - loader->cssStyle = node; - loader->doc->node.doc.style = node; - loader->style = true; + // TODO: For now only the first style node is saved. After the css id selector + // is introduced this if condition shouldin't be necessary any more + if (!loader->cssStyle) { + node = method(loader, nullptr, attrs, attrsLength, simpleXmlParseAttributes); + loader->cssStyle = node; + loader->doc->node.doc.style = node; + loader->style = true; + } } else { node = method(loader, parent, attrs, attrsLength, simpleXmlParseAttributes); } @@ -3127,7 +3198,7 @@ void SvgLoader::run(unsigned tid) _updateStyle(loaderData.doc, nullptr); } - root = svgSceneBuild(loaderData.doc, vx, vy, vw, vh, w, h, preserveAspect, svgPath); + root = svgSceneBuild(loaderData.doc, vx, vy, vw, vh, w, h, align, meetOrSlice, svgPath); } @@ -3160,7 +3231,8 @@ bool SvgLoader::header() if (vh < FLT_EPSILON) vh = h; } - preserveAspect = loaderData.doc->node.doc.preserveAspect; + align = loaderData.doc->node.doc.align; + meetOrSlice = loaderData.doc->node.doc.meetOrSlice; } else { TVGLOG("SVG", "No SVG File. There is no <svg/>"); return false; @@ -3215,31 +3287,9 @@ bool SvgLoader::resize(Paint* paint, float w, float h) auto sx = w / this->w; auto sy = h / this->h; + Matrix m = {sx, 0, 0, 0, sy, 0, 0, 0, 1}; + paint->transform(m); - if (preserveAspect) { - //Scale - auto scale = sx < sy ? sx : sy; - paint->scale(scale); - //Align - auto tx = 0.0f; - auto ty = 0.0f; - auto tw = this->w * scale; - auto th = this->h * scale; - if (tw > th) ty -= (h - th) * 0.5f; - else tx -= (w - tw) * 0.5f; - paint->translate(-tx, -ty); - } else { - //Align - auto tx = 0.0f; - auto ty = 0.0f; - auto tw = this->w * sx; - auto th = this->h * sy; - if (tw > th) ty -= (h - th) * 0.5f; - else tx -= (w - tw) * 0.5f; - - Matrix m = {sx, 0, -tx, 0, sy, -ty, 0, 0, 1}; - paint->transform(m); - } return true; } diff --git a/thirdparty/thorvg/src/loaders/svg/tvgSvgLoader.h b/thirdparty/thorvg/src/loaders/svg/tvgSvgLoader.h index 093fb671b3..f224d1a4ac 100644 --- a/thirdparty/thorvg/src/loaders/svg/tvgSvgLoader.h +++ b/thirdparty/thorvg/src/loaders/svg/tvgSvgLoader.h @@ -50,6 +50,9 @@ public: unique_ptr<Paint> paint() override; private: + AspectRatioAlign align = AspectRatioAlign::XMidYMid; + AspectRatioMeetOrSlice meetOrSlice = AspectRatioMeetOrSlice::Meet; + bool header(); void clear(); void run(unsigned tid) override; diff --git a/thirdparty/thorvg/src/loaders/svg/tvgSvgLoaderCommon.h b/thirdparty/thorvg/src/loaders/svg/tvgSvgLoaderCommon.h index dc9ed558c3..c657c0e21a 100644 --- a/thirdparty/thorvg/src/loaders/svg/tvgSvgLoaderCommon.h +++ b/thirdparty/thorvg/src/loaders/svg/tvgSvgLoaderCommon.h @@ -145,6 +145,26 @@ enum class SvgParserLengthType Other }; +enum class AspectRatioAlign +{ + None, + XMinYMin, + XMidYMin, + XMaxYMin, + XMinYMid, + XMidYMid, + XMaxYMid, + XMinYMax, + XMidYMax, + XMaxYMax +}; + +enum class AspectRatioMeetOrSlice +{ + Meet, + Slice +}; + struct SvgDocNode { float w; @@ -155,7 +175,8 @@ struct SvgDocNode float vh; SvgNode* defs; SvgNode* style; - bool preserveAspect; + AspectRatioAlign align; + AspectRatioMeetOrSlice meetOrSlice; }; struct SvgGNode @@ -171,7 +192,8 @@ struct SvgSymbolNode { float w, h; float vx, vy, vw, vh; - bool preserveAspect; + AspectRatioAlign align; + AspectRatioMeetOrSlice meetOrSlice; bool overflowVisible; bool hasViewBox; bool hasWidth; diff --git a/thirdparty/thorvg/src/loaders/svg/tvgSvgSceneBuilder.cpp b/thirdparty/thorvg/src/loaders/svg/tvgSvgSceneBuilder.cpp index a3f34fd46b..4cb4ffdaeb 100644 --- a/thirdparty/thorvg/src/loaders/svg/tvgSvgSceneBuilder.cpp +++ b/thirdparty/thorvg/src/loaders/svg/tvgSvgSceneBuilder.cpp @@ -49,9 +49,9 @@ */ +#include "tvgMath.h" /* to include math.h before cstring */ #include <cstring> #include <string> -#include "tvgMath.h" #include "tvgSvgLoaderCommon.h" #include "tvgSvgSceneBuilder.h" #include "tvgSvgPath.h" @@ -68,7 +68,7 @@ struct Box static bool _appendShape(SvgNode* node, Shape* shape, const Box& vBox, const string& svgPath); -static unique_ptr<Scene> _sceneBuildHelper(const SvgNode* node, const Box& vBox, const string& svgPath, bool mask, bool* isMaskWhite = nullptr); +static unique_ptr<Scene> _sceneBuildHelper(const SvgNode* node, const Box& vBox, const string& svgPath, bool mask, int depth, bool* isMaskWhite = nullptr); static inline bool _isGroupType(SvgNodeType type) @@ -282,7 +282,7 @@ static void _applyComposition(Paint* paint, const SvgNode* node, const Box& vBox node->style->mask.applying = true; bool isMaskWhite = true; - auto comp = _sceneBuildHelper(compNode, vBox, svgPath, true, &isMaskWhite); + auto comp = _sceneBuildHelper(compNode, vBox, svgPath, true, 0, &isMaskWhite); if (comp) { if (node->transform) comp->transform(*node->transform); @@ -560,10 +560,84 @@ static unique_ptr<Picture> _imageBuildHelper(SvgNode* node, const Box& vBox, con } -static unique_ptr<Scene> _useBuildHelper(const SvgNode* node, const Box& vBox, const string& svgPath, bool* isMaskWhite) +static Matrix _calculateAspectRatioMatrix(AspectRatioAlign align, AspectRatioMeetOrSlice meetOrSlice, float width, float height, const Box& box) +{ + auto sx = width / box.w; + auto sy = height / box.h; + auto tvx = box.x * sx; + auto tvy = box.y * sy; + + if (align == AspectRatioAlign::None) + return {sx, 0, -tvx, 0, sy, -tvy, 0, 0, 1}; + + //Scale + if (meetOrSlice == AspectRatioMeetOrSlice::Meet) { + if (sx < sy) sy = sx; + else sx = sy; + } else { + if (sx < sy) sx = sy; + else sy = sx; + } + + //Align + tvx = box.x * sx; + tvy = box.y * sy; + auto tvw = box.w * sx; + auto tvh = box.h * sy; + + switch (align) { + case AspectRatioAlign::XMinYMin: { + break; + } + case AspectRatioAlign::XMidYMin: { + tvx -= (width - tvw) * 0.5f; + break; + } + case AspectRatioAlign::XMaxYMin: { + tvx -= width - tvw; + break; + } + case AspectRatioAlign::XMinYMid: { + tvy -= (height - tvh) * 0.5f; + break; + } + case AspectRatioAlign::XMidYMid: { + tvx -= (width - tvw) * 0.5f; + tvy -= (height - tvh) * 0.5f; + break; + } + case AspectRatioAlign::XMaxYMid: { + tvx -= width - tvw; + tvy -= (height - tvh) * 0.5f; + break; + } + case AspectRatioAlign::XMinYMax: { + tvy -= height - tvh; + break; + } + case AspectRatioAlign::XMidYMax: { + tvx -= (width - tvw) * 0.5f; + tvy -= height - tvh; + break; + } + case AspectRatioAlign::XMaxYMax: { + tvx -= width - tvw; + tvy -= height - tvh; + break; + } + default: { + break; + } + } + + return {sx, 0, -tvx, 0, sy, -tvy, 0, 0, 1}; +} + + +static unique_ptr<Scene> _useBuildHelper(const SvgNode* node, const Box& vBox, const string& svgPath, int depth, bool* isMaskWhite) { unique_ptr<Scene> finalScene; - auto scene = _sceneBuildHelper(node, vBox, svgPath, false, isMaskWhite); + auto scene = _sceneBuildHelper(node, vBox, svgPath, false, depth + 1, isMaskWhite); // mUseTransform = mUseTransform * mTranslate Matrix mUseTransform = {1, 0, 0, 0, 1, 0, 0, 0, 1}; @@ -585,20 +659,8 @@ static unique_ptr<Scene> _useBuildHelper(const SvgNode* node, const Box& vBox, c Matrix mViewBox = {1, 0, 0, 0, 1, 0, 0, 0, 1}; if ((!mathEqual(width, vw) || !mathEqual(height, vh)) && vw > 0 && vh > 0) { - auto sx = width / vw; - auto sy = height / vh; - if (symbol.preserveAspect) { - if (sx < sy) sy = sx; - else sx = sy; - } - - auto tvx = symbol.vx * sx; - auto tvy = symbol.vy * sy; - auto tvw = vw * sx; - auto tvh = vh * sy; - tvy -= (symbol.h - tvh) * 0.5f; - tvx -= (symbol.w - tvw) * 0.5f; - mViewBox = {sx, 0, -tvx, 0, sy, -tvy, 0, 0, 1}; + Box box = {symbol.vx, symbol.vy, vw, vh}; + mViewBox = _calculateAspectRatioMatrix(symbol.align, symbol.meetOrSlice, width, height, box); } else if (!mathZero(symbol.vx) || !mathZero(symbol.vy)) { mViewBox = {1, 0, -symbol.vx, 0, 1, -symbol.vy, 0, 0, 1}; } @@ -642,8 +704,15 @@ static unique_ptr<Scene> _useBuildHelper(const SvgNode* node, const Box& vBox, c } -static unique_ptr<Scene> _sceneBuildHelper(const SvgNode* node, const Box& vBox, const string& svgPath, bool mask, bool* isMaskWhite) +static unique_ptr<Scene> _sceneBuildHelper(const SvgNode* node, const Box& vBox, const string& svgPath, bool mask, int depth, bool* isMaskWhite) { + /* Exception handling: Prevent invalid SVG data input. + The size is the arbitrary value, we need an experimental size. */ + if (depth > 2192) { + TVGERR("SVG", "Infinite recursive call - stopped after %d calls! Svg file may be incorrectly formatted.", depth); + return nullptr; + } + if (_isGroupType(node->type) || mask) { auto scene = Scene::gen(); // For a Symbol node, the viewBox transformation has to be applied first - see _useBuildHelper() @@ -654,12 +723,15 @@ static unique_ptr<Scene> _sceneBuildHelper(const SvgNode* node, const Box& vBox, for (uint32_t i = 0; i < node->child.count; ++i, ++child) { if (_isGroupType((*child)->type)) { if ((*child)->type == SvgNodeType::Use) - scene->push(_useBuildHelper(*child, vBox, svgPath, isMaskWhite)); + scene->push(_useBuildHelper(*child, vBox, svgPath, depth + 1, isMaskWhite)); else - scene->push(_sceneBuildHelper(*child, vBox, svgPath, false, isMaskWhite)); + scene->push(_sceneBuildHelper(*child, vBox, svgPath, false, depth + 1, isMaskWhite)); } else if ((*child)->type == SvgNodeType::Image) { auto image = _imageBuildHelper(*child, vBox, svgPath); - if (image) scene->push(move(image)); + if (image) { + scene->push(move(image)); + if (isMaskWhite) *isMaskWhite = false; + } } else if ((*child)->type != SvgNodeType::Mask) { auto shape = _shapeBuildHelper(*child, vBox, svgPath); if (shape) { @@ -688,36 +760,18 @@ static unique_ptr<Scene> _sceneBuildHelper(const SvgNode* node, const Box& vBox, /* External Class Implementation */ /************************************************************************/ -unique_ptr<Scene> svgSceneBuild(SvgNode* node, float vx, float vy, float vw, float vh, float w, float h, bool preserveAspect, const string& svgPath) +unique_ptr<Scene> svgSceneBuild(SvgNode* node, float vx, float vy, float vw, float vh, float w, float h, AspectRatioAlign align, AspectRatioMeetOrSlice meetOrSlice, const string& svgPath) { + //TODO: aspect ratio is valid only if viewBox was set + if (!node || (node->type != SvgNodeType::Doc)) return nullptr; Box vBox = {vx, vy, vw, vh}; - auto docNode = _sceneBuildHelper(node, vBox, svgPath, false); + auto docNode = _sceneBuildHelper(node, vBox, svgPath, false, 0); if (!mathEqual(w, vw) || !mathEqual(h, vh)) { - auto sx = w / vw; - auto sy = h / vh; - - if (preserveAspect) { - //Scale - auto scale = sx < sy ? sx : sy; - docNode->scale(scale); - //Align - auto tvx = vx * scale; - auto tvy = vy * scale; - auto tvw = vw * scale; - auto tvh = vh * scale; - tvx -= (w - tvw) * 0.5f; - tvy -= (h - tvh) * 0.5f; - docNode->translate(-tvx, -tvy); - } else { - //Align - auto tvx = vx * sx; - auto tvy = vy * sy; - Matrix m = {sx, 0, -tvx, 0, sy, -tvy, 0, 0, 1}; - docNode->transform(m); - } + Matrix m = _calculateAspectRatioMatrix(align, meetOrSlice, w, h, vBox); + docNode->transform(m); } else if (!mathZero(vx) || !mathZero(vy)) { docNode->translate(-vx, -vy); } diff --git a/thirdparty/thorvg/src/loaders/svg/tvgSvgSceneBuilder.h b/thirdparty/thorvg/src/loaders/svg/tvgSvgSceneBuilder.h index cecbbf02a8..311f3c80e6 100644 --- a/thirdparty/thorvg/src/loaders/svg/tvgSvgSceneBuilder.h +++ b/thirdparty/thorvg/src/loaders/svg/tvgSvgSceneBuilder.h @@ -25,6 +25,6 @@ #include "tvgCommon.h" -unique_ptr<Scene> svgSceneBuild(SvgNode* node, float vx, float vy, float vw, float vh, float w, float h, bool preserveAspect, const string& svgPath); +unique_ptr<Scene> svgSceneBuild(SvgNode* node, float vx, float vy, float vw, float vh, float w, float h, AspectRatioAlign align, AspectRatioMeetOrSlice meetOrSlice, const string& svgPath); #endif //_TVG_SVG_SCENE_BUILDER_H_ diff --git a/thirdparty/thorvg/src/loaders/svg/tvgXmlParser.cpp b/thirdparty/thorvg/src/loaders/svg/tvgXmlParser.cpp index c373da2dd5..231badd27d 100644 --- a/thirdparty/thorvg/src/loaders/svg/tvgXmlParser.cpp +++ b/thirdparty/thorvg/src/loaders/svg/tvgXmlParser.cpp @@ -26,10 +26,10 @@ #ifdef _WIN32 #include <malloc.h> -#elif __FreeBSD__ - #include<stdlib.h> -#else +#elif defined(__linux__) #include <alloca.h> +#else + #include <stdlib.h> #endif #include "tvgXmlParser.h" diff --git a/thirdparty/thorvg/src/loaders/tvg/tvgTvgBinInterpreter.cpp b/thirdparty/thorvg/src/loaders/tvg/tvgTvgBinInterpreter.cpp index 62a75ecd3d..01a39b6e17 100644 --- a/thirdparty/thorvg/src/loaders/tvg/tvgTvgBinInterpreter.cpp +++ b/thirdparty/thorvg/src/loaders/tvg/tvgTvgBinInterpreter.cpp @@ -23,10 +23,10 @@ #ifdef _WIN32 #include <malloc.h> -#elif __FreeBSD__ - #include<stdlib.h> -#else +#elif defined(__linux__) #include <alloca.h> +#else + #include <stdlib.h> #endif #include "tvgTvgCommon.h" diff --git a/thirdparty/thorvg/src/savers/tvg/tvgTvgSaver.cpp b/thirdparty/thorvg/src/savers/tvg/tvgTvgSaver.cpp index adf85836c3..57a21dcce1 100644 --- a/thirdparty/thorvg/src/savers/tvg/tvgTvgSaver.cpp +++ b/thirdparty/thorvg/src/savers/tvg/tvgTvgSaver.cpp @@ -28,10 +28,10 @@ #ifdef _WIN32 #include <malloc.h> -#elif __FreeBSD__ - #include<stdlib.h> -#else +#elif defined(__linux__) #include <alloca.h> +#else + #include <stdlib.h> #endif static FILE* _fopen(const char* filename, const char* mode) diff --git a/thirdparty/thorvg/update-thorvg.sh b/thirdparty/thorvg/update-thorvg.sh index f2fd2a80e4..8cccc947ce 100755 --- a/thirdparty/thorvg/update-thorvg.sh +++ b/thirdparty/thorvg/update-thorvg.sh @@ -1,4 +1,4 @@ -VERSION=0.8.2 +VERSION=0.8.3 rm -rf AUTHORS inc LICENSE src *.zip curl -L -O https://github.com/Samsung/thorvg/archive/v$VERSION.zip bsdtar --strip-components=1 -xvf *.zip @@ -26,3 +26,6 @@ cat << EOF > inc/config.h #define THORVG_VERSION_STRING "$VERSION" #endif EOF +for source in $(find ./ -type f \( -iname \*.h -o -iname \*.cpp \)); do + sed -i -e '$a\' $source +done |