mirror of
https://github.com/godotengine/godot.git
synced 2024-11-21 19:42:43 +00:00
Port member initialization from constructor to declaration (C++11)
Using `clang-tidy`'s `modernize-use-default-member-init` check and manual review of the changes, and some extra manual changes that `clang-tidy` failed to do. Also went manually through all of `core` to find occurrences that `clang-tidy` couldn't handle, especially all initializations done in a constructor without using initializer lists.
This commit is contained in:
parent
e7c9d81876
commit
1f6f364a56
42
.clang-tidy
Normal file
42
.clang-tidy
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
---
|
||||||
|
Checks: 'clang-diagnostic-*,clang-analyzer-*,-*,modernize-use-default-member-init'
|
||||||
|
WarningsAsErrors: ''
|
||||||
|
HeaderFilterRegex: '.*'
|
||||||
|
AnalyzeTemporaryDtors: false
|
||||||
|
FormatStyle: none
|
||||||
|
CheckOptions:
|
||||||
|
CheckOptions:
|
||||||
|
- key: cert-dcl16-c.NewSuffixes
|
||||||
|
value: 'L;LL;LU;LLU'
|
||||||
|
- key: cert-oop54-cpp.WarnOnlyIfThisHasSuspiciousField
|
||||||
|
value: '0'
|
||||||
|
- key: cppcoreguidelines-explicit-virtual-functions.IgnoreDestructors
|
||||||
|
value: '1'
|
||||||
|
- key: cppcoreguidelines-non-private-member-variables-in-classes.IgnoreClassesWithAllMemberVariablesBeingPublic
|
||||||
|
value: '1'
|
||||||
|
- key: google-readability-braces-around-statements.ShortStatementLines
|
||||||
|
value: '1'
|
||||||
|
- key: google-readability-function-size.StatementThreshold
|
||||||
|
value: '800'
|
||||||
|
- key: google-readability-namespace-comments.ShortNamespaceLines
|
||||||
|
value: '10'
|
||||||
|
- key: google-readability-namespace-comments.SpacesBeforeComments
|
||||||
|
value: '2'
|
||||||
|
- key: modernize-loop-convert.MaxCopySize
|
||||||
|
value: '16'
|
||||||
|
- key: modernize-loop-convert.MinConfidence
|
||||||
|
value: reasonable
|
||||||
|
- key: modernize-loop-convert.NamingStyle
|
||||||
|
value: CamelCase
|
||||||
|
- key: modernize-pass-by-value.IncludeStyle
|
||||||
|
value: llvm
|
||||||
|
- key: modernize-replace-auto-ptr.IncludeStyle
|
||||||
|
value: llvm
|
||||||
|
- key: modernize-use-default-member-init.IgnoreMacros
|
||||||
|
value: '1'
|
||||||
|
- key: modernize-use-default-member-init.UseAssignment
|
||||||
|
value: '1'
|
||||||
|
- key: modernize-use-nullptr.NullMacros
|
||||||
|
value: 'NULL'
|
||||||
|
...
|
||||||
|
|
@ -62,6 +62,8 @@ static const unsigned int MONTH_DAYS_TABLE[2][12] = {
|
|||||||
{ 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }
|
{ 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
////// _ResourceLoader //////
|
||||||
|
|
||||||
_ResourceLoader *_ResourceLoader::singleton = nullptr;
|
_ResourceLoader *_ResourceLoader::singleton = nullptr;
|
||||||
|
|
||||||
Error _ResourceLoader::load_threaded_request(const String &p_path, const String &p_type_hint, bool p_use_sub_threads) {
|
Error _ResourceLoader::load_threaded_request(const String &p_path, const String &p_type_hint, bool p_use_sub_threads) {
|
||||||
@ -150,10 +152,7 @@ void _ResourceLoader::_bind_methods() {
|
|||||||
BIND_ENUM_CONSTANT(THREAD_LOAD_LOADED);
|
BIND_ENUM_CONSTANT(THREAD_LOAD_LOADED);
|
||||||
}
|
}
|
||||||
|
|
||||||
_ResourceLoader::_ResourceLoader() {
|
////// _ResourceSaver //////
|
||||||
|
|
||||||
singleton = this;
|
|
||||||
}
|
|
||||||
|
|
||||||
Error _ResourceSaver::save(const String &p_path, const RES &p_resource, SaverFlags p_flags) {
|
Error _ResourceSaver::save(const String &p_path, const RES &p_resource, SaverFlags p_flags) {
|
||||||
ERR_FAIL_COND_V_MSG(p_resource.is_null(), ERR_INVALID_PARAMETER, "Can't save empty resource to path '" + String(p_path) + "'.");
|
ERR_FAIL_COND_V_MSG(p_resource.is_null(), ERR_INVALID_PARAMETER, "Can't save empty resource to path '" + String(p_path) + "'.");
|
||||||
@ -189,10 +188,7 @@ void _ResourceSaver::_bind_methods() {
|
|||||||
BIND_ENUM_CONSTANT(FLAG_REPLACE_SUBRESOURCE_PATHS);
|
BIND_ENUM_CONSTANT(FLAG_REPLACE_SUBRESOURCE_PATHS);
|
||||||
}
|
}
|
||||||
|
|
||||||
_ResourceSaver::_ResourceSaver() {
|
////// _OS //////
|
||||||
|
|
||||||
singleton = this;
|
|
||||||
}
|
|
||||||
|
|
||||||
PackedStringArray _OS::get_connected_midi_inputs() {
|
PackedStringArray _OS::get_connected_midi_inputs() {
|
||||||
return OS::get_singleton()->get_connected_midi_inputs();
|
return OS::get_singleton()->get_connected_midi_inputs();
|
||||||
@ -319,50 +315,6 @@ bool _OS::has_feature(const String &p_feature) const {
|
|||||||
return OS::get_singleton()->has_feature(p_feature);
|
return OS::get_singleton()->has_feature(p_feature);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
enum Weekday {
|
|
||||||
DAY_SUNDAY,
|
|
||||||
DAY_MONDAY,
|
|
||||||
DAY_TUESDAY,
|
|
||||||
DAY_WEDNESDAY,
|
|
||||||
DAY_THURSDAY,
|
|
||||||
DAY_FRIDAY,
|
|
||||||
DAY_SATURDAY
|
|
||||||
};
|
|
||||||
|
|
||||||
enum Month {
|
|
||||||
MONTH_JANUARY,
|
|
||||||
MONTH_FEBRUARY,
|
|
||||||
MONTH_MARCH,
|
|
||||||
MONTH_APRIL,
|
|
||||||
MONTH_MAY,
|
|
||||||
MONTH_JUNE,
|
|
||||||
MONTH_JULY,
|
|
||||||
MONTH_AUGUST,
|
|
||||||
MONTH_SEPTEMBER,
|
|
||||||
MONTH_OCTOBER,
|
|
||||||
MONTH_NOVEMBER,
|
|
||||||
MONTH_DECEMBER
|
|
||||||
};
|
|
||||||
*/
|
|
||||||
/*
|
|
||||||
struct Date {
|
|
||||||
|
|
||||||
int year;
|
|
||||||
Month month;
|
|
||||||
int day;
|
|
||||||
Weekday weekday;
|
|
||||||
bool dst;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct Time {
|
|
||||||
|
|
||||||
int hour;
|
|
||||||
int min;
|
|
||||||
int sec;
|
|
||||||
};
|
|
||||||
*/
|
|
||||||
|
|
||||||
uint64_t _OS::get_static_memory_usage() const {
|
uint64_t _OS::get_static_memory_usage() const {
|
||||||
|
|
||||||
return OS::get_singleton()->get_static_memory_usage();
|
return OS::get_singleton()->get_static_memory_usage();
|
||||||
@ -783,6 +735,7 @@ Vector<String> _OS::get_granted_permissions() const {
|
|||||||
String _OS::get_unique_id() const {
|
String _OS::get_unique_id() const {
|
||||||
return OS::get_singleton()->get_unique_id();
|
return OS::get_singleton()->get_unique_id();
|
||||||
}
|
}
|
||||||
|
|
||||||
_OS *_OS::singleton = nullptr;
|
_OS *_OS::singleton = nullptr;
|
||||||
|
|
||||||
void _OS::_bind_methods() {
|
void _OS::_bind_methods() {
|
||||||
@ -839,8 +792,6 @@ void _OS::_bind_methods() {
|
|||||||
|
|
||||||
ClassDB::bind_method(D_METHOD("is_debug_build"), &_OS::is_debug_build);
|
ClassDB::bind_method(D_METHOD("is_debug_build"), &_OS::is_debug_build);
|
||||||
|
|
||||||
//ClassDB::bind_method(D_METHOD("get_mouse_button_state"),&_OS::get_mouse_button_state);
|
|
||||||
|
|
||||||
ClassDB::bind_method(D_METHOD("dump_memory_to_file", "file"), &_OS::dump_memory_to_file);
|
ClassDB::bind_method(D_METHOD("dump_memory_to_file", "file"), &_OS::dump_memory_to_file);
|
||||||
ClassDB::bind_method(D_METHOD("dump_resources_to_file", "file"), &_OS::dump_resources_to_file);
|
ClassDB::bind_method(D_METHOD("dump_resources_to_file", "file"), &_OS::dump_resources_to_file);
|
||||||
ClassDB::bind_method(D_METHOD("print_resources_in_use", "short"), &_OS::print_resources_in_use, DEFVAL(false));
|
ClassDB::bind_method(D_METHOD("print_resources_in_use", "short"), &_OS::print_resources_in_use, DEFVAL(false));
|
||||||
@ -914,12 +865,7 @@ void _OS::_bind_methods() {
|
|||||||
BIND_ENUM_CONSTANT(SYSTEM_DIR_RINGTONES);
|
BIND_ENUM_CONSTANT(SYSTEM_DIR_RINGTONES);
|
||||||
}
|
}
|
||||||
|
|
||||||
_OS::_OS() {
|
////// _Geometry //////
|
||||||
|
|
||||||
singleton = this;
|
|
||||||
}
|
|
||||||
|
|
||||||
///////////////////// GEOMETRY
|
|
||||||
|
|
||||||
_Geometry *_Geometry::singleton = nullptr;
|
_Geometry *_Geometry::singleton = nullptr;
|
||||||
|
|
||||||
@ -1296,11 +1242,7 @@ void _Geometry::_bind_methods() {
|
|||||||
BIND_ENUM_CONSTANT(END_ROUND);
|
BIND_ENUM_CONSTANT(END_ROUND);
|
||||||
}
|
}
|
||||||
|
|
||||||
_Geometry::_Geometry() {
|
////// _File //////
|
||||||
singleton = this;
|
|
||||||
}
|
|
||||||
|
|
||||||
///////////////////////// FILE
|
|
||||||
|
|
||||||
Error _File::open_encrypted(const String &p_path, ModeFlags p_mode_flags, const Vector<uint8_t> &p_key) {
|
Error _File::open_encrypted(const String &p_path, ModeFlags p_mode_flags, const Vector<uint8_t> &p_key) {
|
||||||
|
|
||||||
@ -1736,19 +1678,12 @@ void _File::_bind_methods() {
|
|||||||
BIND_ENUM_CONSTANT(COMPRESSION_GZIP);
|
BIND_ENUM_CONSTANT(COMPRESSION_GZIP);
|
||||||
}
|
}
|
||||||
|
|
||||||
_File::_File() {
|
|
||||||
|
|
||||||
f = nullptr;
|
|
||||||
eswap = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
_File::~_File() {
|
_File::~_File() {
|
||||||
|
|
||||||
if (f)
|
if (f)
|
||||||
memdelete(f);
|
memdelete(f);
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////
|
////// _Directory //////
|
||||||
|
|
||||||
Error _Directory::open(const String &p_path) {
|
Error _Directory::open(const String &p_path) {
|
||||||
Error err;
|
Error err;
|
||||||
@ -1929,16 +1864,16 @@ void _Directory::_bind_methods() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_Directory::_Directory() {
|
_Directory::_Directory() {
|
||||||
|
|
||||||
d = DirAccess::create(DirAccess::ACCESS_RESOURCES);
|
d = DirAccess::create(DirAccess::ACCESS_RESOURCES);
|
||||||
}
|
}
|
||||||
|
|
||||||
_Directory::~_Directory() {
|
_Directory::~_Directory() {
|
||||||
|
|
||||||
if (d)
|
if (d)
|
||||||
memdelete(d);
|
memdelete(d);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////// _Marshalls //////
|
||||||
|
|
||||||
_Marshalls *_Marshalls::singleton = nullptr;
|
_Marshalls *_Marshalls::singleton = nullptr;
|
||||||
|
|
||||||
_Marshalls *_Marshalls::get_singleton() {
|
_Marshalls *_Marshalls::get_singleton() {
|
||||||
@ -2046,7 +1981,7 @@ void _Marshalls::_bind_methods() {
|
|||||||
ClassDB::bind_method(D_METHOD("base64_to_utf8", "base64_str"), &_Marshalls::base64_to_utf8);
|
ClassDB::bind_method(D_METHOD("base64_to_utf8", "base64_str"), &_Marshalls::base64_to_utf8);
|
||||||
};
|
};
|
||||||
|
|
||||||
////////////////
|
////// _Semaphore //////
|
||||||
|
|
||||||
void _Semaphore::wait() {
|
void _Semaphore::wait() {
|
||||||
|
|
||||||
@ -2070,7 +2005,7 @@ void _Semaphore::_bind_methods() {
|
|||||||
ClassDB::bind_method(D_METHOD("post"), &_Semaphore::post);
|
ClassDB::bind_method(D_METHOD("post"), &_Semaphore::post);
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////
|
////// _Mutex //////
|
||||||
|
|
||||||
void _Mutex::lock() {
|
void _Mutex::lock() {
|
||||||
|
|
||||||
@ -2094,7 +2029,7 @@ void _Mutex::_bind_methods() {
|
|||||||
ClassDB::bind_method(D_METHOD("unlock"), &_Mutex::unlock);
|
ClassDB::bind_method(D_METHOD("unlock"), &_Mutex::unlock);
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////
|
////// _Thread //////
|
||||||
|
|
||||||
void _Thread::_start_func(void *ud) {
|
void _Thread::_start_func(void *ud) {
|
||||||
|
|
||||||
@ -2204,19 +2139,12 @@ void _Thread::_bind_methods() {
|
|||||||
BIND_ENUM_CONSTANT(PRIORITY_NORMAL);
|
BIND_ENUM_CONSTANT(PRIORITY_NORMAL);
|
||||||
BIND_ENUM_CONSTANT(PRIORITY_HIGH);
|
BIND_ENUM_CONSTANT(PRIORITY_HIGH);
|
||||||
}
|
}
|
||||||
_Thread::_Thread() {
|
|
||||||
|
|
||||||
active = false;
|
|
||||||
thread = nullptr;
|
|
||||||
target_instance = nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
_Thread::~_Thread() {
|
_Thread::~_Thread() {
|
||||||
|
|
||||||
ERR_FAIL_COND_MSG(active, "Reference to a Thread object was lost while the thread is still running...");
|
ERR_FAIL_COND_MSG(active, "Reference to a Thread object was lost while the thread is still running...");
|
||||||
}
|
}
|
||||||
|
|
||||||
/////////////////////////////////////
|
////// _ClassDB //////
|
||||||
|
|
||||||
PackedStringArray _ClassDB::get_class_list() const {
|
PackedStringArray _ClassDB::get_class_list() const {
|
||||||
|
|
||||||
@ -2425,11 +2353,7 @@ void _ClassDB::_bind_methods() {
|
|||||||
ClassDB::bind_method(D_METHOD("is_class_enabled", "class"), &_ClassDB::is_class_enabled);
|
ClassDB::bind_method(D_METHOD("is_class_enabled", "class"), &_ClassDB::is_class_enabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
_ClassDB::_ClassDB() {
|
////// _Engine //////
|
||||||
}
|
|
||||||
_ClassDB::~_ClassDB() {
|
|
||||||
}
|
|
||||||
///////////////////////////////
|
|
||||||
|
|
||||||
void _Engine::set_iterations_per_second(int p_ips) {
|
void _Engine::set_iterations_per_second(int p_ips) {
|
||||||
|
|
||||||
@ -2588,9 +2512,7 @@ void _Engine::_bind_methods() {
|
|||||||
|
|
||||||
_Engine *_Engine::singleton = nullptr;
|
_Engine *_Engine::singleton = nullptr;
|
||||||
|
|
||||||
_Engine::_Engine() {
|
////// _JSON //////
|
||||||
singleton = this;
|
|
||||||
}
|
|
||||||
|
|
||||||
void JSONParseResult::_bind_methods() {
|
void JSONParseResult::_bind_methods() {
|
||||||
ClassDB::bind_method(D_METHOD("get_error"), &JSONParseResult::get_error);
|
ClassDB::bind_method(D_METHOD("get_error"), &JSONParseResult::get_error);
|
||||||
@ -2663,7 +2585,3 @@ Ref<JSONParseResult> _JSON::parse(const String &p_json) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_JSON *_JSON::singleton = nullptr;
|
_JSON *_JSON::singleton = nullptr;
|
||||||
|
|
||||||
_JSON::_JSON() {
|
|
||||||
singleton = this;
|
|
||||||
}
|
|
||||||
|
@ -69,7 +69,7 @@ public:
|
|||||||
bool has_cached(const String &p_path);
|
bool has_cached(const String &p_path);
|
||||||
bool exists(const String &p_path, const String &p_type_hint = "");
|
bool exists(const String &p_path, const String &p_type_hint = "");
|
||||||
|
|
||||||
_ResourceLoader();
|
_ResourceLoader() { singleton = this; }
|
||||||
};
|
};
|
||||||
|
|
||||||
VARIANT_ENUM_CAST(_ResourceLoader::ThreadLoadStatus);
|
VARIANT_ENUM_CAST(_ResourceLoader::ThreadLoadStatus);
|
||||||
@ -98,7 +98,7 @@ public:
|
|||||||
Error save(const String &p_path, const RES &p_resource, SaverFlags p_flags);
|
Error save(const String &p_path, const RES &p_resource, SaverFlags p_flags);
|
||||||
Vector<String> get_recognized_extensions(const RES &p_resource);
|
Vector<String> get_recognized_extensions(const RES &p_resource);
|
||||||
|
|
||||||
_ResourceSaver();
|
_ResourceSaver() { singleton = this; }
|
||||||
};
|
};
|
||||||
|
|
||||||
VARIANT_ENUM_CAST(_ResourceSaver::SaverFlags);
|
VARIANT_ENUM_CAST(_ResourceSaver::SaverFlags);
|
||||||
@ -245,7 +245,7 @@ public:
|
|||||||
|
|
||||||
static _OS *get_singleton() { return singleton; }
|
static _OS *get_singleton() { return singleton; }
|
||||||
|
|
||||||
_OS();
|
_OS() { singleton = this; }
|
||||||
};
|
};
|
||||||
|
|
||||||
VARIANT_ENUM_CAST(_OS::VideoDriver);
|
VARIANT_ENUM_CAST(_OS::VideoDriver);
|
||||||
@ -327,7 +327,7 @@ public:
|
|||||||
|
|
||||||
Dictionary make_atlas(const Vector<Size2> &p_rects);
|
Dictionary make_atlas(const Vector<Size2> &p_rects);
|
||||||
|
|
||||||
_Geometry();
|
_Geometry() { singleton = this; }
|
||||||
};
|
};
|
||||||
|
|
||||||
VARIANT_ENUM_CAST(_Geometry::PolyBooleanOperation);
|
VARIANT_ENUM_CAST(_Geometry::PolyBooleanOperation);
|
||||||
@ -335,10 +335,10 @@ VARIANT_ENUM_CAST(_Geometry::PolyJoinType);
|
|||||||
VARIANT_ENUM_CAST(_Geometry::PolyEndType);
|
VARIANT_ENUM_CAST(_Geometry::PolyEndType);
|
||||||
|
|
||||||
class _File : public Reference {
|
class _File : public Reference {
|
||||||
|
|
||||||
GDCLASS(_File, Reference);
|
GDCLASS(_File, Reference);
|
||||||
FileAccess *f;
|
|
||||||
bool eswap;
|
FileAccess *f = nullptr;
|
||||||
|
bool eswap = false;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
static void _bind_methods();
|
static void _bind_methods();
|
||||||
@ -429,7 +429,7 @@ public:
|
|||||||
|
|
||||||
uint64_t get_modified_time(const String &p_file) const;
|
uint64_t get_modified_time(const String &p_file) const;
|
||||||
|
|
||||||
_File();
|
_File() {}
|
||||||
virtual ~_File();
|
virtual ~_File();
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -538,10 +538,10 @@ class _Thread : public Reference {
|
|||||||
protected:
|
protected:
|
||||||
Variant ret;
|
Variant ret;
|
||||||
Variant userdata;
|
Variant userdata;
|
||||||
volatile bool active;
|
volatile bool active = false;
|
||||||
Object *target_instance;
|
Object *target_instance = nullptr;
|
||||||
StringName target_method;
|
StringName target_method;
|
||||||
Thread *thread;
|
Thread *thread = nullptr;
|
||||||
static void _bind_methods();
|
static void _bind_methods();
|
||||||
static void _start_func(void *ud);
|
static void _start_func(void *ud);
|
||||||
|
|
||||||
@ -559,7 +559,7 @@ public:
|
|||||||
bool is_active() const;
|
bool is_active() const;
|
||||||
Variant wait_to_finish();
|
Variant wait_to_finish();
|
||||||
|
|
||||||
_Thread();
|
_Thread() {}
|
||||||
~_Thread();
|
~_Thread();
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -600,8 +600,8 @@ public:
|
|||||||
|
|
||||||
bool is_class_enabled(StringName p_class) const;
|
bool is_class_enabled(StringName p_class) const;
|
||||||
|
|
||||||
_ClassDB();
|
_ClassDB() {}
|
||||||
~_ClassDB();
|
~_ClassDB() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
class _Engine : public Object {
|
class _Engine : public Object {
|
||||||
@ -649,7 +649,7 @@ public:
|
|||||||
void set_editor_hint(bool p_enabled);
|
void set_editor_hint(bool p_enabled);
|
||||||
bool is_editor_hint() const;
|
bool is_editor_hint() const;
|
||||||
|
|
||||||
_Engine();
|
_Engine() { singleton = this; }
|
||||||
};
|
};
|
||||||
|
|
||||||
class _JSON;
|
class _JSON;
|
||||||
@ -661,7 +661,7 @@ class JSONParseResult : public Reference {
|
|||||||
|
|
||||||
Error error;
|
Error error;
|
||||||
String error_string;
|
String error_string;
|
||||||
int error_line;
|
int error_line = -1;
|
||||||
|
|
||||||
Variant result;
|
Variant result;
|
||||||
|
|
||||||
@ -681,8 +681,7 @@ public:
|
|||||||
void set_result(const Variant &p_result);
|
void set_result(const Variant &p_result);
|
||||||
Variant get_result() const;
|
Variant get_result() const;
|
||||||
|
|
||||||
JSONParseResult() :
|
JSONParseResult() {}
|
||||||
error_line(-1) {}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class _JSON : public Object {
|
class _JSON : public Object {
|
||||||
@ -698,7 +697,7 @@ public:
|
|||||||
String print(const Variant &p_value, const String &p_indent = "", bool p_sort_keys = false);
|
String print(const Variant &p_value, const String &p_indent = "", bool p_sort_keys = false);
|
||||||
Ref<JSONParseResult> parse(const String &p_json);
|
Ref<JSONParseResult> parse(const String &p_json);
|
||||||
|
|
||||||
_JSON();
|
_JSON() { singleton = this; }
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // CORE_BIND_H
|
#endif // CORE_BIND_H
|
||||||
|
@ -29,6 +29,7 @@
|
|||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
|
|
||||||
#include "callable.h"
|
#include "callable.h"
|
||||||
|
|
||||||
#include "core/script_language.h"
|
#include "core/script_language.h"
|
||||||
#include "message_queue.h"
|
#include "message_queue.h"
|
||||||
#include "object.h"
|
#include "object.h"
|
||||||
@ -255,12 +256,7 @@ Callable::~Callable() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Callable::Callable() {
|
|
||||||
object = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
CallableCustom::CallableCustom() {
|
CallableCustom::CallableCustom() {
|
||||||
referenced = false;
|
|
||||||
ref_count.init();
|
ref_count.init();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -349,6 +345,7 @@ Array Signal::get_connections() const {
|
|||||||
}
|
}
|
||||||
return arr;
|
return arr;
|
||||||
}
|
}
|
||||||
|
|
||||||
Signal::Signal(const Object *p_object, const StringName &p_name) {
|
Signal::Signal(const Object *p_object, const StringName &p_name) {
|
||||||
|
|
||||||
ERR_FAIL_COND_MSG(p_object == nullptr, "Object argument to Signal constructor must be non-null");
|
ERR_FAIL_COND_MSG(p_object == nullptr, "Object argument to Signal constructor must be non-null");
|
||||||
@ -356,10 +353,9 @@ Signal::Signal(const Object *p_object, const StringName &p_name) {
|
|||||||
object = p_object->get_instance_id();
|
object = p_object->get_instance_id();
|
||||||
name = p_name;
|
name = p_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
Signal::Signal(ObjectID p_object, const StringName &p_name) {
|
Signal::Signal(ObjectID p_object, const StringName &p_name) {
|
||||||
|
|
||||||
object = p_object;
|
object = p_object;
|
||||||
name = p_name;
|
name = p_name;
|
||||||
}
|
}
|
||||||
Signal::Signal() {
|
|
||||||
}
|
|
||||||
|
@ -49,7 +49,7 @@ class Callable {
|
|||||||
//needs to be max 16 bytes in 64 bits
|
//needs to be max 16 bytes in 64 bits
|
||||||
StringName method;
|
StringName method;
|
||||||
union {
|
union {
|
||||||
uint64_t object;
|
uint64_t object = 0;
|
||||||
CallableCustom *custom;
|
CallableCustom *custom;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -100,14 +100,14 @@ public:
|
|||||||
Callable(ObjectID p_object, const StringName &p_method);
|
Callable(ObjectID p_object, const StringName &p_method);
|
||||||
Callable(CallableCustom *p_custom);
|
Callable(CallableCustom *p_custom);
|
||||||
Callable(const Callable &p_callable);
|
Callable(const Callable &p_callable);
|
||||||
Callable();
|
Callable() {}
|
||||||
~Callable();
|
~Callable();
|
||||||
};
|
};
|
||||||
|
|
||||||
class CallableCustom {
|
class CallableCustom {
|
||||||
friend class Callable;
|
friend class Callable;
|
||||||
SafeRefCount ref_count;
|
SafeRefCount ref_count;
|
||||||
bool referenced;
|
bool referenced = false;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
typedef bool (*CompareEqualFunc)(const CallableCustom *p_a, const CallableCustom *p_b);
|
typedef bool (*CompareEqualFunc)(const CallableCustom *p_a, const CallableCustom *p_b);
|
||||||
@ -156,7 +156,7 @@ public:
|
|||||||
Array get_connections() const;
|
Array get_connections() const;
|
||||||
Signal(const Object *p_object, const StringName &p_name);
|
Signal(const Object *p_object, const StringName &p_name);
|
||||||
Signal(ObjectID p_object, const StringName &p_name);
|
Signal(ObjectID p_object, const StringName &p_name);
|
||||||
Signal();
|
Signal() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // CALLABLE_H
|
#endif // CALLABLE_H
|
||||||
|
@ -258,19 +258,6 @@ HashMap<StringName, ClassDB::ClassInfo> ClassDB::classes;
|
|||||||
HashMap<StringName, StringName> ClassDB::resource_base_extensions;
|
HashMap<StringName, StringName> ClassDB::resource_base_extensions;
|
||||||
HashMap<StringName, StringName> ClassDB::compat_classes;
|
HashMap<StringName, StringName> ClassDB::compat_classes;
|
||||||
|
|
||||||
ClassDB::ClassInfo::ClassInfo() {
|
|
||||||
|
|
||||||
api = API_NONE;
|
|
||||||
class_ptr = nullptr;
|
|
||||||
creation_func = nullptr;
|
|
||||||
inherits_ptr = nullptr;
|
|
||||||
disabled = false;
|
|
||||||
exposed = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
ClassDB::ClassInfo::~ClassInfo() {
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ClassDB::is_parent_class(const StringName &p_class, const StringName &p_inherits) {
|
bool ClassDB::is_parent_class(const StringName &p_class, const StringName &p_inherits) {
|
||||||
|
|
||||||
OBJTYPE_RLOCK;
|
OBJTYPE_RLOCK;
|
||||||
|
@ -114,9 +114,10 @@ public:
|
|||||||
|
|
||||||
struct ClassInfo {
|
struct ClassInfo {
|
||||||
|
|
||||||
APIType api;
|
APIType api = API_NONE;
|
||||||
ClassInfo *inherits_ptr;
|
ClassInfo *inherits_ptr = nullptr;
|
||||||
void *class_ptr;
|
void *class_ptr = nullptr;
|
||||||
|
|
||||||
HashMap<StringName, MethodBind *> method_map;
|
HashMap<StringName, MethodBind *> method_map;
|
||||||
HashMap<StringName, int> constant_map;
|
HashMap<StringName, int> constant_map;
|
||||||
HashMap<StringName, List<StringName>> enum_map;
|
HashMap<StringName, List<StringName>> enum_map;
|
||||||
@ -133,11 +134,12 @@ public:
|
|||||||
|
|
||||||
StringName inherits;
|
StringName inherits;
|
||||||
StringName name;
|
StringName name;
|
||||||
bool disabled;
|
bool disabled = false;
|
||||||
bool exposed;
|
bool exposed = false;
|
||||||
Object *(*creation_func)();
|
Object *(*creation_func)() = nullptr;
|
||||||
ClassInfo();
|
|
||||||
~ClassInfo();
|
ClassInfo() {}
|
||||||
|
~ClassInfo() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
|
12
core/color.h
12
core/color.h
@ -44,7 +44,7 @@ struct Color {
|
|||||||
float b;
|
float b;
|
||||||
float a;
|
float a;
|
||||||
};
|
};
|
||||||
float components[4];
|
float components[4] = { 0, 0, 0, 1.0 };
|
||||||
};
|
};
|
||||||
|
|
||||||
bool operator==(const Color &p_color) const { return (r == p_color.r && g == p_color.g && b == p_color.b && a == p_color.a); }
|
bool operator==(const Color &p_color) const { return (r == p_color.r && g == p_color.g && b == p_color.b && a == p_color.a); }
|
||||||
@ -204,15 +204,7 @@ struct Color {
|
|||||||
_FORCE_INLINE_ bool operator<(const Color &p_color) const; //used in set keys
|
_FORCE_INLINE_ bool operator<(const Color &p_color) const; //used in set keys
|
||||||
operator String() const;
|
operator String() const;
|
||||||
|
|
||||||
/**
|
_FORCE_INLINE_ Color() {}
|
||||||
* No construct parameters, r=0, g=0, b=0. a=1
|
|
||||||
*/
|
|
||||||
_FORCE_INLINE_ Color() {
|
|
||||||
r = 0;
|
|
||||||
g = 0;
|
|
||||||
b = 0;
|
|
||||||
a = 1.0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* RGB / RGBA construct parameters. Alpha is optional, but defaults to 1.0
|
* RGB / RGBA construct parameters. Alpha is optional, but defaults to 1.0
|
||||||
|
@ -100,24 +100,11 @@ tryagain:
|
|||||||
}
|
}
|
||||||
|
|
||||||
CommandQueueMT::CommandQueueMT(bool p_sync) {
|
CommandQueueMT::CommandQueueMT(bool p_sync) {
|
||||||
|
|
||||||
read_ptr = 0;
|
|
||||||
write_ptr = 0;
|
|
||||||
dealloc_ptr = 0;
|
|
||||||
command_mem = (uint8_t *)memalloc(COMMAND_MEM_SIZE);
|
|
||||||
|
|
||||||
for (int i = 0; i < SYNC_SEMAPHORES; i++) {
|
|
||||||
|
|
||||||
sync_sems[i].in_use = false;
|
|
||||||
}
|
|
||||||
if (p_sync)
|
if (p_sync)
|
||||||
sync = memnew(Semaphore);
|
sync = memnew(Semaphore);
|
||||||
else
|
|
||||||
sync = nullptr;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CommandQueueMT::~CommandQueueMT() {
|
CommandQueueMT::~CommandQueueMT() {
|
||||||
|
|
||||||
if (sync)
|
if (sync)
|
||||||
memdelete(sync);
|
memdelete(sync);
|
||||||
memfree(command_mem);
|
memfree(command_mem);
|
||||||
|
@ -301,14 +301,14 @@ class CommandQueueMT {
|
|||||||
struct SyncSemaphore {
|
struct SyncSemaphore {
|
||||||
|
|
||||||
Semaphore sem;
|
Semaphore sem;
|
||||||
bool in_use;
|
bool in_use = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct CommandBase {
|
struct CommandBase {
|
||||||
|
|
||||||
virtual void call() = 0;
|
virtual void call() = 0;
|
||||||
virtual void post(){};
|
virtual void post() {}
|
||||||
virtual ~CommandBase(){};
|
virtual ~CommandBase() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct SyncCommand : public CommandBase {
|
struct SyncCommand : public CommandBase {
|
||||||
@ -339,13 +339,13 @@ class CommandQueueMT {
|
|||||||
SYNC_SEMAPHORES = 8
|
SYNC_SEMAPHORES = 8
|
||||||
};
|
};
|
||||||
|
|
||||||
uint8_t *command_mem;
|
uint8_t *command_mem = (uint8_t *)memalloc(COMMAND_MEM_SIZE);
|
||||||
uint32_t read_ptr;
|
uint32_t read_ptr = 0;
|
||||||
uint32_t write_ptr;
|
uint32_t write_ptr = 0;
|
||||||
uint32_t dealloc_ptr;
|
uint32_t dealloc_ptr = 0;
|
||||||
SyncSemaphore sync_sems[SYNC_SEMAPHORES];
|
SyncSemaphore sync_sems[SYNC_SEMAPHORES];
|
||||||
Mutex mutex;
|
Mutex mutex;
|
||||||
Semaphore *sync;
|
Semaphore *sync = nullptr;
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
T *allocate() {
|
T *allocate() {
|
||||||
|
@ -288,6 +288,3 @@ void PHashTranslation::_bind_methods() {
|
|||||||
|
|
||||||
ClassDB::bind_method(D_METHOD("generate", "from"), &PHashTranslation::generate);
|
ClassDB::bind_method(D_METHOD("generate", "from"), &PHashTranslation::generate);
|
||||||
}
|
}
|
||||||
|
|
||||||
PHashTranslation::PHashTranslation() {
|
|
||||||
}
|
|
||||||
|
@ -86,7 +86,7 @@ public:
|
|||||||
virtual StringName get_message(const StringName &p_src_text) const; //overridable for other implementations
|
virtual StringName get_message(const StringName &p_src_text) const; //overridable for other implementations
|
||||||
void generate(const Ref<Translation> &p_from);
|
void generate(const Ref<Translation> &p_from);
|
||||||
|
|
||||||
PHashTranslation();
|
PHashTranslation() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // COMPRESSED_TRANSLATION_H
|
#endif // COMPRESSED_TRANSLATION_H
|
||||||
|
@ -54,7 +54,7 @@ class CowData {
|
|||||||
friend class VMap;
|
friend class VMap;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
mutable T *_ptr;
|
mutable T *_ptr = nullptr;
|
||||||
|
|
||||||
// internal helpers
|
// internal helpers
|
||||||
|
|
||||||
@ -183,7 +183,7 @@ public:
|
|||||||
|
|
||||||
int find(const T &p_val, int p_from = 0) const;
|
int find(const T &p_val, int p_from = 0) const;
|
||||||
|
|
||||||
_FORCE_INLINE_ CowData();
|
_FORCE_INLINE_ CowData() {}
|
||||||
_FORCE_INLINE_ ~CowData();
|
_FORCE_INLINE_ ~CowData();
|
||||||
_FORCE_INLINE_ CowData(CowData<T> &p_from) { _ref(p_from); };
|
_FORCE_INLINE_ CowData(CowData<T> &p_from) { _ref(p_from); };
|
||||||
};
|
};
|
||||||
@ -366,12 +366,6 @@ void CowData<T>::_ref(const CowData &p_from) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class T>
|
|
||||||
CowData<T>::CowData() {
|
|
||||||
|
|
||||||
_ptr = nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
CowData<T>::~CowData() {
|
CowData<T>::~CowData() {
|
||||||
|
|
||||||
|
@ -94,9 +94,6 @@ Ref<X509Certificate> Crypto::generate_self_signed_certificate(Ref<CryptoKey> p_k
|
|||||||
ERR_FAIL_V_MSG(nullptr, "generate_self_signed_certificate is not available when mbedtls module is disabled.");
|
ERR_FAIL_V_MSG(nullptr, "generate_self_signed_certificate is not available when mbedtls module is disabled.");
|
||||||
}
|
}
|
||||||
|
|
||||||
Crypto::Crypto() {
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Resource loader/saver
|
/// Resource loader/saver
|
||||||
|
|
||||||
RES ResourceFormatLoaderCrypto::load(const String &p_path, const String &p_original_path, Error *r_error, bool p_use_sub_threads, float *r_progress, bool p_no_cache) {
|
RES ResourceFormatLoaderCrypto::load(const String &p_path, const String &p_original_path, Error *r_error, bool p_use_sub_threads, float *r_progress, bool p_no_cache) {
|
||||||
|
@ -31,11 +31,10 @@
|
|||||||
#ifndef CRYPTO_H
|
#ifndef CRYPTO_H
|
||||||
#define CRYPTO_H
|
#define CRYPTO_H
|
||||||
|
|
||||||
#include "core/reference.h"
|
|
||||||
#include "core/resource.h"
|
|
||||||
|
|
||||||
#include "core/io/resource_loader.h"
|
#include "core/io/resource_loader.h"
|
||||||
#include "core/io/resource_saver.h"
|
#include "core/io/resource_saver.h"
|
||||||
|
#include "core/reference.h"
|
||||||
|
#include "core/resource.h"
|
||||||
|
|
||||||
class CryptoKey : public Resource {
|
class CryptoKey : public Resource {
|
||||||
GDCLASS(CryptoKey, Resource);
|
GDCLASS(CryptoKey, Resource);
|
||||||
@ -80,7 +79,7 @@ public:
|
|||||||
virtual Ref<CryptoKey> generate_rsa(int p_bytes);
|
virtual Ref<CryptoKey> generate_rsa(int p_bytes);
|
||||||
virtual Ref<X509Certificate> generate_self_signed_certificate(Ref<CryptoKey> p_key, String p_issuer_name, String p_not_before, String p_not_after);
|
virtual Ref<X509Certificate> generate_self_signed_certificate(Ref<CryptoKey> p_key, String p_issuer_name, String p_not_before, String p_not_after);
|
||||||
|
|
||||||
Crypto();
|
Crypto() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
class ResourceFormatLoaderCrypto : public ResourceFormatLoader {
|
class ResourceFormatLoaderCrypto : public ResourceFormatLoader {
|
||||||
|
@ -128,10 +128,6 @@ void HashingContext::_bind_methods() {
|
|||||||
BIND_ENUM_CONSTANT(HASH_SHA256);
|
BIND_ENUM_CONSTANT(HASH_SHA256);
|
||||||
}
|
}
|
||||||
|
|
||||||
HashingContext::HashingContext() {
|
|
||||||
ctx = nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
HashingContext::~HashingContext() {
|
HashingContext::~HashingContext() {
|
||||||
if (ctx != nullptr)
|
if (ctx != nullptr)
|
||||||
_delete_ctx();
|
_delete_ctx();
|
||||||
|
@ -44,7 +44,7 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void *ctx;
|
void *ctx = nullptr;
|
||||||
HashType type;
|
HashType type;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@ -57,7 +57,7 @@ public:
|
|||||||
Error update(PackedByteArray p_chunk);
|
Error update(PackedByteArray p_chunk);
|
||||||
PackedByteArray finish();
|
PackedByteArray finish();
|
||||||
|
|
||||||
HashingContext();
|
HashingContext() {}
|
||||||
~HashingContext();
|
~HashingContext();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -42,11 +42,8 @@ struct DebuggerMarshalls {
|
|||||||
String format;
|
String format;
|
||||||
String type;
|
String type;
|
||||||
RID id;
|
RID id;
|
||||||
int vram;
|
int vram = 0;
|
||||||
bool operator<(const ResourceInfo &p_img) const { return vram == p_img.vram ? id < p_img.id : vram > p_img.vram; }
|
bool operator<(const ResourceInfo &p_img) const { return vram == p_img.vram ? id < p_img.id : vram > p_img.vram; }
|
||||||
ResourceInfo() {
|
|
||||||
vram = 0;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ResourceUsage {
|
struct ResourceUsage {
|
||||||
@ -119,10 +116,7 @@ struct DebuggerMarshalls {
|
|||||||
struct ScriptStackVariable {
|
struct ScriptStackVariable {
|
||||||
String name;
|
String name;
|
||||||
Variant value;
|
Variant value;
|
||||||
int type;
|
int type = -1;
|
||||||
ScriptStackVariable() {
|
|
||||||
type = -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
Array serialize(int max_size = 1 << 20); // 1 MiB default.
|
Array serialize(int max_size = 1 << 20); // 1 MiB default.
|
||||||
bool deserialize(const Array &p_arr);
|
bool deserialize(const Array &p_arr);
|
||||||
@ -137,27 +131,18 @@ struct DebuggerMarshalls {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct OutputError {
|
struct OutputError {
|
||||||
int hr;
|
int hr = -1;
|
||||||
int min;
|
int min = -1;
|
||||||
int sec;
|
int sec = -1;
|
||||||
int msec;
|
int msec = -1;
|
||||||
String source_file;
|
String source_file;
|
||||||
String source_func;
|
String source_func;
|
||||||
int source_line;
|
int source_line = -1;
|
||||||
String error;
|
String error;
|
||||||
String error_descr;
|
String error_descr;
|
||||||
bool warning;
|
bool warning = false;
|
||||||
Vector<ScriptLanguage::StackInfo> callstack;
|
Vector<ScriptLanguage::StackInfo> callstack;
|
||||||
|
|
||||||
OutputError() {
|
|
||||||
hr = -1;
|
|
||||||
min = -1;
|
|
||||||
sec = -1;
|
|
||||||
msec = -1;
|
|
||||||
source_line = -1;
|
|
||||||
warning = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
Array serialize();
|
Array serialize();
|
||||||
bool deserialize(const Array &p_arr);
|
bool deserialize(const Array &p_arr);
|
||||||
};
|
};
|
||||||
|
@ -217,23 +217,7 @@ Engine *Engine::get_singleton() {
|
|||||||
bool Engine::is_abort_on_gpu_errors_enabled() const {
|
bool Engine::is_abort_on_gpu_errors_enabled() const {
|
||||||
return abort_on_gpu_errors;
|
return abort_on_gpu_errors;
|
||||||
}
|
}
|
||||||
Engine::Engine() {
|
|
||||||
|
|
||||||
|
Engine::Engine() {
|
||||||
singleton = this;
|
singleton = this;
|
||||||
frames_drawn = 0;
|
|
||||||
ips = 60;
|
|
||||||
physics_jitter_fix = 0.5;
|
|
||||||
_physics_interpolation_fraction = 0.0f;
|
|
||||||
_frame_delay = 0;
|
|
||||||
_fps = 1;
|
|
||||||
_target_fps = 0;
|
|
||||||
_time_scale = 1.0;
|
|
||||||
_pixel_snap = false;
|
|
||||||
_physics_frames = 0;
|
|
||||||
_idle_frames = 0;
|
|
||||||
_in_physics = false;
|
|
||||||
_frame_ticks = 0;
|
|
||||||
_frame_step = 0;
|
|
||||||
editor_hint = false;
|
|
||||||
abort_on_gpu_errors = false;
|
|
||||||
}
|
}
|
||||||
|
@ -51,28 +51,28 @@ public:
|
|||||||
private:
|
private:
|
||||||
friend class Main;
|
friend class Main;
|
||||||
|
|
||||||
uint64_t frames_drawn;
|
uint64_t frames_drawn = 0;
|
||||||
uint32_t _frame_delay;
|
uint32_t _frame_delay = 0;
|
||||||
uint64_t _frame_ticks;
|
uint64_t _frame_ticks = 0;
|
||||||
float _frame_step;
|
float _frame_step = 0;
|
||||||
|
|
||||||
int ips;
|
int ips = 60;
|
||||||
float physics_jitter_fix;
|
float physics_jitter_fix = 0.5;
|
||||||
float _fps;
|
float _fps = 1;
|
||||||
int _target_fps;
|
int _target_fps = 0;
|
||||||
float _time_scale;
|
float _time_scale = 1.0;
|
||||||
bool _pixel_snap;
|
bool _pixel_snap = false;
|
||||||
uint64_t _physics_frames;
|
uint64_t _physics_frames = 0;
|
||||||
float _physics_interpolation_fraction;
|
float _physics_interpolation_fraction = 0.0f;
|
||||||
bool abort_on_gpu_errors;
|
bool abort_on_gpu_errors = false;
|
||||||
|
|
||||||
uint64_t _idle_frames;
|
uint64_t _idle_frames = 0;
|
||||||
bool _in_physics;
|
bool _in_physics = false;
|
||||||
|
|
||||||
List<Singleton> singletons;
|
List<Singleton> singletons;
|
||||||
Map<StringName, Object *> singleton_ptrs;
|
Map<StringName, Object *> singleton_ptrs;
|
||||||
|
|
||||||
bool editor_hint;
|
bool editor_hint = false;
|
||||||
|
|
||||||
static Engine *singleton;
|
static Engine *singleton;
|
||||||
|
|
||||||
|
@ -48,16 +48,12 @@ typedef void (*ErrorHandlerFunc)(void *, const char *, const char *, int p_line,
|
|||||||
|
|
||||||
struct ErrorHandlerList {
|
struct ErrorHandlerList {
|
||||||
|
|
||||||
ErrorHandlerFunc errfunc;
|
ErrorHandlerFunc errfunc = nullptr;
|
||||||
void *userdata;
|
void *userdata = nullptr;
|
||||||
|
|
||||||
ErrorHandlerList *next;
|
ErrorHandlerList *next = nullptr;
|
||||||
|
|
||||||
ErrorHandlerList() {
|
ErrorHandlerList() {}
|
||||||
errfunc = 0;
|
|
||||||
next = 0;
|
|
||||||
userdata = 0;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
void add_error_handler(ErrorHandlerList *p_handler);
|
void add_error_handler(ErrorHandlerList *p_handler);
|
||||||
|
@ -94,6 +94,3 @@ void FuncRef::_bind_methods() {
|
|||||||
ClassDB::bind_method(D_METHOD("set_function", "name"), &FuncRef::set_function);
|
ClassDB::bind_method(D_METHOD("set_function", "name"), &FuncRef::set_function);
|
||||||
ClassDB::bind_method(D_METHOD("is_valid"), &FuncRef::is_valid);
|
ClassDB::bind_method(D_METHOD("is_valid"), &FuncRef::is_valid);
|
||||||
}
|
}
|
||||||
|
|
||||||
FuncRef::FuncRef() {
|
|
||||||
}
|
|
||||||
|
@ -48,7 +48,8 @@ public:
|
|||||||
void set_instance(Object *p_obj);
|
void set_instance(Object *p_obj);
|
||||||
void set_function(const StringName &p_func);
|
void set_function(const StringName &p_func);
|
||||||
bool is_valid() const;
|
bool is_valid() const;
|
||||||
FuncRef();
|
|
||||||
|
FuncRef() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // FUNC_REF_H
|
#endif // FUNC_REF_H
|
||||||
|
@ -75,8 +75,8 @@ public:
|
|||||||
friend class HashMap;
|
friend class HashMap;
|
||||||
|
|
||||||
uint32_t hash;
|
uint32_t hash;
|
||||||
Element *next;
|
Element *next = nullptr;
|
||||||
Element() { next = 0; }
|
Element() {}
|
||||||
Pair pair;
|
Pair pair;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -94,9 +94,9 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Element **hash_table;
|
Element **hash_table = nullptr;
|
||||||
uint8_t hash_table_power;
|
uint8_t hash_table_power = 0;
|
||||||
uint32_t elements;
|
uint32_t elements = 0;
|
||||||
|
|
||||||
void make_hash_table() {
|
void make_hash_table() {
|
||||||
|
|
||||||
@ -551,12 +551,6 @@ public:
|
|||||||
copy_from(p_table);
|
copy_from(p_table);
|
||||||
}
|
}
|
||||||
|
|
||||||
HashMap() {
|
|
||||||
hash_table = nullptr;
|
|
||||||
elements = 0;
|
|
||||||
hash_table_power = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void get_key_value_ptr_array(const Pair **p_pairs) const {
|
void get_key_value_ptr_array(const Pair **p_pairs) const {
|
||||||
if (unlikely(!hash_table))
|
if (unlikely(!hash_table))
|
||||||
return;
|
return;
|
||||||
@ -584,17 +578,13 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HashMap() {}
|
||||||
|
|
||||||
HashMap(const HashMap &p_table) {
|
HashMap(const HashMap &p_table) {
|
||||||
|
|
||||||
hash_table = nullptr;
|
|
||||||
elements = 0;
|
|
||||||
hash_table_power = 0;
|
|
||||||
|
|
||||||
copy_from(p_table);
|
copy_from(p_table);
|
||||||
}
|
}
|
||||||
|
|
||||||
~HashMap() {
|
~HashMap() {
|
||||||
|
|
||||||
clear();
|
clear();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -3671,14 +3671,3 @@ Ref<Resource> Image::duplicate(bool p_subresources) const {
|
|||||||
void Image::set_as_black() {
|
void Image::set_as_black() {
|
||||||
zeromem(data.ptrw(), data.size());
|
zeromem(data.ptrw(), data.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
Image::Image() {
|
|
||||||
|
|
||||||
width = 0;
|
|
||||||
height = 0;
|
|
||||||
mipmaps = false;
|
|
||||||
format = FORMAT_L8;
|
|
||||||
}
|
|
||||||
|
|
||||||
Image::~Image() {
|
|
||||||
}
|
|
||||||
|
14
core/image.h
14
core/image.h
@ -33,7 +33,6 @@
|
|||||||
|
|
||||||
#include "core/color.h"
|
#include "core/color.h"
|
||||||
#include "core/math/rect2.h"
|
#include "core/math/rect2.h"
|
||||||
|
|
||||||
#include "core/resource.h"
|
#include "core/resource.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -172,10 +171,11 @@ private:
|
|||||||
create(p_width, p_height, p_use_mipmaps, p_format, p_data);
|
create(p_width, p_height, p_use_mipmaps, p_format, p_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
Format format;
|
Format format = FORMAT_L8;
|
||||||
Vector<uint8_t> data;
|
Vector<uint8_t> data;
|
||||||
int width, height;
|
int width = 0;
|
||||||
bool mipmaps;
|
int height = 0;
|
||||||
|
bool mipmaps = false;
|
||||||
|
|
||||||
void _copy_internals_from(const Image &p_image) {
|
void _copy_internals_from(const Image &p_image) {
|
||||||
format = p_image.format;
|
format = p_image.format;
|
||||||
@ -286,7 +286,7 @@ public:
|
|||||||
/**
|
/**
|
||||||
* create an empty image
|
* create an empty image
|
||||||
*/
|
*/
|
||||||
Image();
|
Image() {}
|
||||||
/**
|
/**
|
||||||
* create an empty image of a specific size and format
|
* create an empty image of a specific size and format
|
||||||
*/
|
*/
|
||||||
@ -296,6 +296,8 @@ public:
|
|||||||
*/
|
*/
|
||||||
Image(int p_width, int p_height, bool p_mipmaps, Format p_format, const Vector<uint8_t> &p_data);
|
Image(int p_width, int p_height, bool p_mipmaps, Format p_format, const Vector<uint8_t> &p_data);
|
||||||
|
|
||||||
|
~Image() {}
|
||||||
|
|
||||||
enum AlphaMode {
|
enum AlphaMode {
|
||||||
ALPHA_NONE,
|
ALPHA_NONE,
|
||||||
ALPHA_BIT,
|
ALPHA_BIT,
|
||||||
@ -386,8 +388,6 @@ public:
|
|||||||
mipmaps = p_image->mipmaps;
|
mipmaps = p_image->mipmaps;
|
||||||
data = p_image->data;
|
data = p_image->data;
|
||||||
}
|
}
|
||||||
|
|
||||||
~Image();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
VARIANT_ENUM_CAST(Image::Format)
|
VARIANT_ENUM_CAST(Image::Format)
|
||||||
|
@ -1433,16 +1433,6 @@ int Input::get_joy_axis_index_from_string(String p_axis) {
|
|||||||
Input::Input() {
|
Input::Input() {
|
||||||
|
|
||||||
singleton = this;
|
singleton = this;
|
||||||
use_accumulated_input = true;
|
|
||||||
mouse_button_mask = 0;
|
|
||||||
mouse_window = 0;
|
|
||||||
emulate_touch_from_mouse = false;
|
|
||||||
emulate_mouse_from_touch = false;
|
|
||||||
mouse_from_touch_index = -1;
|
|
||||||
event_dispatch_function = nullptr;
|
|
||||||
default_shape = CURSOR_ARROW;
|
|
||||||
|
|
||||||
fallback_mapping = -1;
|
|
||||||
|
|
||||||
// Parse default mappings.
|
// Parse default mappings.
|
||||||
{
|
{
|
||||||
|
@ -36,7 +36,6 @@
|
|||||||
#include "core/os/thread_safe.h"
|
#include "core/os/thread_safe.h"
|
||||||
|
|
||||||
class Input : public Object {
|
class Input : public Object {
|
||||||
|
|
||||||
GDCLASS(Input, Object);
|
GDCLASS(Input, Object);
|
||||||
_THREAD_SAFE_CLASS_
|
_THREAD_SAFE_CLASS_
|
||||||
|
|
||||||
@ -100,7 +99,7 @@ public:
|
|||||||
typedef void (*EventDispatchFunc)(const Ref<InputEvent> &p_event);
|
typedef void (*EventDispatchFunc)(const Ref<InputEvent> &p_event);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int mouse_button_mask;
|
int mouse_button_mask = 0;
|
||||||
|
|
||||||
Set<int> keys_pressed;
|
Set<int> keys_pressed;
|
||||||
Set<int> joy_buttons_pressed;
|
Set<int> joy_buttons_pressed;
|
||||||
@ -111,7 +110,7 @@ private:
|
|||||||
Vector3 magnetometer;
|
Vector3 magnetometer;
|
||||||
Vector3 gyroscope;
|
Vector3 gyroscope;
|
||||||
Vector2 mouse_pos;
|
Vector2 mouse_pos;
|
||||||
int64_t mouse_window;
|
int64_t mouse_window = 0;
|
||||||
|
|
||||||
struct Action {
|
struct Action {
|
||||||
uint64_t physics_frame;
|
uint64_t physics_frame;
|
||||||
@ -122,10 +121,11 @@ private:
|
|||||||
|
|
||||||
Map<StringName, Action> action_state;
|
Map<StringName, Action> action_state;
|
||||||
|
|
||||||
bool emulate_touch_from_mouse;
|
bool emulate_touch_from_mouse = false;
|
||||||
bool emulate_mouse_from_touch;
|
bool emulate_mouse_from_touch = false;
|
||||||
|
bool use_accumulated_input = false;
|
||||||
|
|
||||||
int mouse_from_touch_index;
|
int mouse_from_touch_index = -1;
|
||||||
|
|
||||||
struct SpeedTrack {
|
struct SpeedTrack {
|
||||||
|
|
||||||
@ -144,35 +144,21 @@ private:
|
|||||||
struct Joypad {
|
struct Joypad {
|
||||||
StringName name;
|
StringName name;
|
||||||
StringName uid;
|
StringName uid;
|
||||||
bool connected;
|
bool connected = false;
|
||||||
bool last_buttons[JOY_BUTTON_MAX];
|
bool last_buttons[JOY_BUTTON_MAX] = { false };
|
||||||
float last_axis[JOY_AXIS_MAX];
|
float last_axis[JOY_AXIS_MAX] = { 0.0f };
|
||||||
float filter;
|
float filter = 0.01f;
|
||||||
int last_hat;
|
int last_hat = HAT_MASK_CENTER;
|
||||||
int mapping;
|
int mapping = -1;
|
||||||
int hat_current;
|
int hat_current = 0;
|
||||||
|
|
||||||
Joypad() {
|
|
||||||
for (int i = 0; i < JOY_AXIS_MAX; i++) {
|
|
||||||
last_axis[i] = 0.0f;
|
|
||||||
}
|
|
||||||
for (int i = 0; i < JOY_BUTTON_MAX; i++) {
|
|
||||||
last_buttons[i] = false;
|
|
||||||
}
|
|
||||||
connected = false;
|
|
||||||
last_hat = HAT_MASK_CENTER;
|
|
||||||
filter = 0.01f;
|
|
||||||
mapping = -1;
|
|
||||||
hat_current = 0;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
SpeedTrack mouse_speed_track;
|
SpeedTrack mouse_speed_track;
|
||||||
Map<int, SpeedTrack> touch_speed_track;
|
Map<int, SpeedTrack> touch_speed_track;
|
||||||
Map<int, Joypad> joy_names;
|
Map<int, Joypad> joy_names;
|
||||||
int fallback_mapping;
|
int fallback_mapping = -1;
|
||||||
|
|
||||||
CursorShape default_shape;
|
CursorShape default_shape = CURSOR_ARROW;
|
||||||
|
|
||||||
enum JoyType {
|
enum JoyType {
|
||||||
TYPE_BUTTON,
|
TYPE_BUTTON,
|
||||||
@ -243,7 +229,7 @@ private:
|
|||||||
void _parse_input_event_impl(const Ref<InputEvent> &p_event, bool p_is_emulated);
|
void _parse_input_event_impl(const Ref<InputEvent> &p_event, bool p_is_emulated);
|
||||||
|
|
||||||
List<Ref<InputEvent>> accumulated_events;
|
List<Ref<InputEvent>> accumulated_events;
|
||||||
bool use_accumulated_input;
|
|
||||||
friend class DisplayServer;
|
friend class DisplayServer;
|
||||||
|
|
||||||
static void (*set_mouse_mode_func)(MouseMode);
|
static void (*set_mouse_mode_func)(MouseMode);
|
||||||
@ -253,7 +239,7 @@ private:
|
|||||||
static CursorShape (*get_current_cursor_shape_func)();
|
static CursorShape (*get_current_cursor_shape_func)();
|
||||||
static void (*set_custom_mouse_cursor_func)(const RES &, CursorShape, const Vector2 &);
|
static void (*set_custom_mouse_cursor_func)(const RES &, CursorShape, const Vector2 &);
|
||||||
|
|
||||||
EventDispatchFunc event_dispatch_function;
|
EventDispatchFunc event_dispatch_function = nullptr;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
struct VibrationInfo {
|
struct VibrationInfo {
|
||||||
|
@ -132,11 +132,7 @@ void InputEvent::_bind_methods() {
|
|||||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "device"), "set_device", "get_device");
|
ADD_PROPERTY(PropertyInfo(Variant::INT, "device"), "set_device", "get_device");
|
||||||
}
|
}
|
||||||
|
|
||||||
InputEvent::InputEvent() {
|
///////////////////////////////////
|
||||||
|
|
||||||
device = 0;
|
|
||||||
}
|
|
||||||
////////////////
|
|
||||||
|
|
||||||
void InputEventFromWindow::_bind_methods() {
|
void InputEventFromWindow::_bind_methods() {
|
||||||
|
|
||||||
@ -152,11 +148,7 @@ int64_t InputEventFromWindow::get_window_id() const {
|
|||||||
return window_id;
|
return window_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
InputEventFromWindow::InputEventFromWindow() {
|
///////////////////////////////////
|
||||||
window_id = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
//////////////////
|
|
||||||
|
|
||||||
void InputEventWithModifiers::set_shift(bool p_enabled) {
|
void InputEventWithModifiers::set_shift(bool p_enabled) {
|
||||||
|
|
||||||
@ -236,15 +228,7 @@ void InputEventWithModifiers::_bind_methods() {
|
|||||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "command"), "set_command", "get_command");
|
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "command"), "set_command", "get_command");
|
||||||
}
|
}
|
||||||
|
|
||||||
InputEventWithModifiers::InputEventWithModifiers() {
|
///////////////////////////////////
|
||||||
|
|
||||||
alt = false;
|
|
||||||
shift = false;
|
|
||||||
control = false;
|
|
||||||
meta = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
//////////////////////////////////
|
|
||||||
|
|
||||||
void InputEventKey::set_pressed(bool p_pressed) {
|
void InputEventKey::set_pressed(bool p_pressed) {
|
||||||
|
|
||||||
@ -411,16 +395,7 @@ void InputEventKey::_bind_methods() {
|
|||||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "echo"), "set_echo", "is_echo");
|
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "echo"), "set_echo", "is_echo");
|
||||||
}
|
}
|
||||||
|
|
||||||
InputEventKey::InputEventKey() {
|
///////////////////////////////////
|
||||||
|
|
||||||
pressed = false;
|
|
||||||
keycode = 0;
|
|
||||||
physical_keycode = 0;
|
|
||||||
unicode = 0; ///unicode
|
|
||||||
echo = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////
|
|
||||||
|
|
||||||
void InputEventMouse::set_button_mask(int p_mask) {
|
void InputEventMouse::set_button_mask(int p_mask) {
|
||||||
|
|
||||||
@ -465,12 +440,7 @@ void InputEventMouse::_bind_methods() {
|
|||||||
ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "global_position"), "set_global_position", "get_global_position");
|
ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "global_position"), "set_global_position", "get_global_position");
|
||||||
}
|
}
|
||||||
|
|
||||||
InputEventMouse::InputEventMouse() {
|
///////////////////////////////////
|
||||||
|
|
||||||
button_mask = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
///////////////////////////////////////
|
|
||||||
|
|
||||||
void InputEventMouseButton::set_factor(float p_factor) {
|
void InputEventMouseButton::set_factor(float p_factor) {
|
||||||
|
|
||||||
@ -608,15 +578,7 @@ void InputEventMouseButton::_bind_methods() {
|
|||||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "doubleclick"), "set_doubleclick", "is_doubleclick");
|
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "doubleclick"), "set_doubleclick", "is_doubleclick");
|
||||||
}
|
}
|
||||||
|
|
||||||
InputEventMouseButton::InputEventMouseButton() {
|
///////////////////////////////////
|
||||||
|
|
||||||
factor = 1;
|
|
||||||
button_index = 0;
|
|
||||||
pressed = false;
|
|
||||||
doubleclick = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////////
|
|
||||||
|
|
||||||
void InputEventMouseMotion::set_tilt(const Vector2 &p_tilt) {
|
void InputEventMouseMotion::set_tilt(const Vector2 &p_tilt) {
|
||||||
|
|
||||||
@ -773,12 +735,7 @@ void InputEventMouseMotion::_bind_methods() {
|
|||||||
ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "speed"), "set_speed", "get_speed");
|
ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "speed"), "set_speed", "get_speed");
|
||||||
}
|
}
|
||||||
|
|
||||||
InputEventMouseMotion::InputEventMouseMotion() {
|
///////////////////////////////////
|
||||||
|
|
||||||
pressure = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////
|
|
||||||
|
|
||||||
void InputEventJoypadMotion::set_axis(int p_axis) {
|
void InputEventJoypadMotion::set_axis(int p_axis) {
|
||||||
|
|
||||||
@ -849,12 +806,7 @@ void InputEventJoypadMotion::_bind_methods() {
|
|||||||
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "axis_value"), "set_axis_value", "get_axis_value");
|
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "axis_value"), "set_axis_value", "get_axis_value");
|
||||||
}
|
}
|
||||||
|
|
||||||
InputEventJoypadMotion::InputEventJoypadMotion() {
|
///////////////////////////////////
|
||||||
|
|
||||||
axis = 0;
|
|
||||||
axis_value = 0;
|
|
||||||
}
|
|
||||||
/////////////////////////////////
|
|
||||||
|
|
||||||
void InputEventJoypadButton::set_button_index(int p_index) {
|
void InputEventJoypadButton::set_button_index(int p_index) {
|
||||||
|
|
||||||
@ -931,14 +883,7 @@ void InputEventJoypadButton::_bind_methods() {
|
|||||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "pressed"), "set_pressed", "is_pressed");
|
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "pressed"), "set_pressed", "is_pressed");
|
||||||
}
|
}
|
||||||
|
|
||||||
InputEventJoypadButton::InputEventJoypadButton() {
|
///////////////////////////////////
|
||||||
|
|
||||||
button_index = 0;
|
|
||||||
pressure = 0;
|
|
||||||
pressed = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
//////////////////////////////////////////////
|
|
||||||
|
|
||||||
void InputEventScreenTouch::set_index(int p_index) {
|
void InputEventScreenTouch::set_index(int p_index) {
|
||||||
|
|
||||||
@ -1001,13 +946,7 @@ void InputEventScreenTouch::_bind_methods() {
|
|||||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "pressed"), "set_pressed", "is_pressed");
|
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "pressed"), "set_pressed", "is_pressed");
|
||||||
}
|
}
|
||||||
|
|
||||||
InputEventScreenTouch::InputEventScreenTouch() {
|
///////////////////////////////////
|
||||||
|
|
||||||
index = 0;
|
|
||||||
pressed = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/////////////////////////////
|
|
||||||
|
|
||||||
void InputEventScreenDrag::set_index(int p_index) {
|
void InputEventScreenDrag::set_index(int p_index) {
|
||||||
|
|
||||||
@ -1088,11 +1027,7 @@ void InputEventScreenDrag::_bind_methods() {
|
|||||||
ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "speed"), "set_speed", "get_speed");
|
ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "speed"), "set_speed", "get_speed");
|
||||||
}
|
}
|
||||||
|
|
||||||
InputEventScreenDrag::InputEventScreenDrag() {
|
///////////////////////////////////
|
||||||
|
|
||||||
index = 0;
|
|
||||||
}
|
|
||||||
/////////////////////////////
|
|
||||||
|
|
||||||
void InputEventAction::set_action(const StringName &p_action) {
|
void InputEventAction::set_action(const StringName &p_action) {
|
||||||
|
|
||||||
@ -1171,11 +1106,7 @@ void InputEventAction::_bind_methods() {
|
|||||||
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "strength", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_strength", "get_strength");
|
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "strength", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_strength", "get_strength");
|
||||||
}
|
}
|
||||||
|
|
||||||
InputEventAction::InputEventAction() {
|
///////////////////////////////////
|
||||||
pressed = false;
|
|
||||||
strength = 1.0f;
|
|
||||||
}
|
|
||||||
/////////////////////////////
|
|
||||||
|
|
||||||
void InputEventGesture::set_position(const Vector2 &p_pos) {
|
void InputEventGesture::set_position(const Vector2 &p_pos) {
|
||||||
|
|
||||||
@ -1194,7 +1125,8 @@ Vector2 InputEventGesture::get_position() const {
|
|||||||
|
|
||||||
return pos;
|
return pos;
|
||||||
}
|
}
|
||||||
/////////////////////////////
|
|
||||||
|
///////////////////////////////////
|
||||||
|
|
||||||
void InputEventMagnifyGesture::set_factor(real_t p_factor) {
|
void InputEventMagnifyGesture::set_factor(real_t p_factor) {
|
||||||
|
|
||||||
@ -1235,11 +1167,7 @@ void InputEventMagnifyGesture::_bind_methods() {
|
|||||||
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "factor"), "set_factor", "get_factor");
|
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "factor"), "set_factor", "get_factor");
|
||||||
}
|
}
|
||||||
|
|
||||||
InputEventMagnifyGesture::InputEventMagnifyGesture() {
|
///////////////////////////////////
|
||||||
|
|
||||||
factor = 1.0;
|
|
||||||
}
|
|
||||||
/////////////////////////////
|
|
||||||
|
|
||||||
void InputEventPanGesture::set_delta(const Vector2 &p_delta) {
|
void InputEventPanGesture::set_delta(const Vector2 &p_delta) {
|
||||||
|
|
||||||
@ -1279,11 +1207,7 @@ void InputEventPanGesture::_bind_methods() {
|
|||||||
ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "delta"), "set_delta", "get_delta");
|
ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "delta"), "set_delta", "get_delta");
|
||||||
}
|
}
|
||||||
|
|
||||||
InputEventPanGesture::InputEventPanGesture() {
|
///////////////////////////////////
|
||||||
|
|
||||||
delta = Vector2(0, 0);
|
|
||||||
}
|
|
||||||
/////////////////////////////
|
|
||||||
|
|
||||||
void InputEventMIDI::set_channel(const int p_channel) {
|
void InputEventMIDI::set_channel(const int p_channel) {
|
||||||
|
|
||||||
@ -1390,15 +1314,3 @@ void InputEventMIDI::_bind_methods() {
|
|||||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "controller_number"), "set_controller_number", "get_controller_number");
|
ADD_PROPERTY(PropertyInfo(Variant::INT, "controller_number"), "set_controller_number", "get_controller_number");
|
||||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "controller_value"), "set_controller_value", "get_controller_value");
|
ADD_PROPERTY(PropertyInfo(Variant::INT, "controller_value"), "set_controller_value", "get_controller_value");
|
||||||
}
|
}
|
||||||
|
|
||||||
InputEventMIDI::InputEventMIDI() {
|
|
||||||
|
|
||||||
channel = 0;
|
|
||||||
message = 0;
|
|
||||||
pitch = 0;
|
|
||||||
velocity = 0;
|
|
||||||
instrument = 0;
|
|
||||||
pressure = 0;
|
|
||||||
controller_number = 0;
|
|
||||||
controller_value = 0;
|
|
||||||
}
|
|
||||||
|
@ -157,7 +157,7 @@ enum MidiMessageList {
|
|||||||
class InputEvent : public Resource {
|
class InputEvent : public Resource {
|
||||||
GDCLASS(InputEvent, Resource);
|
GDCLASS(InputEvent, Resource);
|
||||||
|
|
||||||
int device;
|
int device = 0;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
static void _bind_methods();
|
static void _bind_methods();
|
||||||
@ -177,7 +177,6 @@ public:
|
|||||||
// To be removed someday, since they do not make sense for all events
|
// To be removed someday, since they do not make sense for all events
|
||||||
virtual bool is_pressed() const;
|
virtual bool is_pressed() const;
|
||||||
virtual bool is_echo() const;
|
virtual bool is_echo() const;
|
||||||
// ...-.
|
|
||||||
|
|
||||||
virtual String as_text() const;
|
virtual String as_text() const;
|
||||||
|
|
||||||
@ -188,14 +187,15 @@ public:
|
|||||||
virtual bool is_action_type() const;
|
virtual bool is_action_type() const;
|
||||||
|
|
||||||
virtual bool accumulate(const Ref<InputEvent> &p_event) { return false; }
|
virtual bool accumulate(const Ref<InputEvent> &p_event) { return false; }
|
||||||
InputEvent();
|
|
||||||
|
InputEvent() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
class InputEventFromWindow : public InputEvent {
|
class InputEventFromWindow : public InputEvent {
|
||||||
|
|
||||||
GDCLASS(InputEventFromWindow, InputEvent);
|
GDCLASS(InputEventFromWindow, InputEvent);
|
||||||
|
|
||||||
int64_t window_id;
|
int64_t window_id = 0;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
static void _bind_methods();
|
static void _bind_methods();
|
||||||
@ -204,28 +204,27 @@ public:
|
|||||||
void set_window_id(int64_t p_id);
|
void set_window_id(int64_t p_id);
|
||||||
int64_t get_window_id() const;
|
int64_t get_window_id() const;
|
||||||
|
|
||||||
InputEventFromWindow();
|
InputEventFromWindow() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
class InputEventWithModifiers : public InputEventFromWindow {
|
class InputEventWithModifiers : public InputEventFromWindow {
|
||||||
GDCLASS(InputEventWithModifiers, InputEventFromWindow);
|
GDCLASS(InputEventWithModifiers, InputEventFromWindow);
|
||||||
|
|
||||||
bool shift;
|
bool shift = false;
|
||||||
bool alt;
|
bool alt = false;
|
||||||
#ifdef APPLE_STYLE_KEYS
|
#ifdef APPLE_STYLE_KEYS
|
||||||
union {
|
union {
|
||||||
bool command;
|
bool command;
|
||||||
bool meta; //< windows/mac key
|
bool meta = false; //< windows/mac key
|
||||||
};
|
};
|
||||||
|
|
||||||
bool control;
|
bool control = false;
|
||||||
#else
|
#else
|
||||||
union {
|
union {
|
||||||
bool command; //< windows/mac key
|
bool command; //< windows/mac key
|
||||||
bool control;
|
bool control = false;
|
||||||
};
|
};
|
||||||
bool meta; //< windows/mac key
|
bool meta = false; //< windows/mac key
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@ -249,20 +248,20 @@ public:
|
|||||||
|
|
||||||
void set_modifiers_from_event(const InputEventWithModifiers *event);
|
void set_modifiers_from_event(const InputEventWithModifiers *event);
|
||||||
|
|
||||||
InputEventWithModifiers();
|
InputEventWithModifiers() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
class InputEventKey : public InputEventWithModifiers {
|
class InputEventKey : public InputEventWithModifiers {
|
||||||
|
|
||||||
GDCLASS(InputEventKey, InputEventWithModifiers);
|
GDCLASS(InputEventKey, InputEventWithModifiers);
|
||||||
|
|
||||||
bool pressed; /// otherwise release
|
bool pressed = false; /// otherwise release
|
||||||
|
|
||||||
uint32_t keycode; ///< check keyboard.h , KeyCode enum, without modifier masks
|
uint32_t keycode = 0; ///< check keyboard.h , KeyCode enum, without modifier masks
|
||||||
uint32_t physical_keycode;
|
uint32_t physical_keycode = 0;
|
||||||
uint32_t unicode; ///unicode
|
uint32_t unicode = 0; ///unicode
|
||||||
|
|
||||||
bool echo; /// true if this is an echo key
|
bool echo = false; /// true if this is an echo key
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
static void _bind_methods();
|
static void _bind_methods();
|
||||||
@ -293,14 +292,14 @@ public:
|
|||||||
|
|
||||||
virtual String as_text() const;
|
virtual String as_text() const;
|
||||||
|
|
||||||
InputEventKey();
|
InputEventKey() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
class InputEventMouse : public InputEventWithModifiers {
|
class InputEventMouse : public InputEventWithModifiers {
|
||||||
|
|
||||||
GDCLASS(InputEventMouse, InputEventWithModifiers);
|
GDCLASS(InputEventMouse, InputEventWithModifiers);
|
||||||
|
|
||||||
int button_mask;
|
int button_mask = 0;
|
||||||
|
|
||||||
Vector2 pos;
|
Vector2 pos;
|
||||||
Vector2 global_pos;
|
Vector2 global_pos;
|
||||||
@ -318,17 +317,17 @@ public:
|
|||||||
void set_global_position(const Vector2 &p_global_pos);
|
void set_global_position(const Vector2 &p_global_pos);
|
||||||
Vector2 get_global_position() const;
|
Vector2 get_global_position() const;
|
||||||
|
|
||||||
InputEventMouse();
|
InputEventMouse() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
class InputEventMouseButton : public InputEventMouse {
|
class InputEventMouseButton : public InputEventMouse {
|
||||||
|
|
||||||
GDCLASS(InputEventMouseButton, InputEventMouse);
|
GDCLASS(InputEventMouseButton, InputEventMouse);
|
||||||
|
|
||||||
float factor;
|
float factor = 1;
|
||||||
int button_index;
|
int button_index = 0;
|
||||||
bool pressed; //otherwise released
|
bool pressed = false; //otherwise released
|
||||||
bool doubleclick; //last even less than doubleclick time
|
bool doubleclick = false; //last even less than doubleclick time
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
static void _bind_methods();
|
static void _bind_methods();
|
||||||
@ -352,7 +351,7 @@ public:
|
|||||||
virtual bool is_action_type() const { return true; }
|
virtual bool is_action_type() const { return true; }
|
||||||
virtual String as_text() const;
|
virtual String as_text() const;
|
||||||
|
|
||||||
InputEventMouseButton();
|
InputEventMouseButton() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
class InputEventMouseMotion : public InputEventMouse {
|
class InputEventMouseMotion : public InputEventMouse {
|
||||||
@ -360,7 +359,7 @@ class InputEventMouseMotion : public InputEventMouse {
|
|||||||
GDCLASS(InputEventMouseMotion, InputEventMouse);
|
GDCLASS(InputEventMouseMotion, InputEventMouse);
|
||||||
|
|
||||||
Vector2 tilt;
|
Vector2 tilt;
|
||||||
float pressure;
|
float pressure = 0;
|
||||||
Vector2 relative;
|
Vector2 relative;
|
||||||
Vector2 speed;
|
Vector2 speed;
|
||||||
|
|
||||||
@ -385,14 +384,14 @@ public:
|
|||||||
|
|
||||||
virtual bool accumulate(const Ref<InputEvent> &p_event);
|
virtual bool accumulate(const Ref<InputEvent> &p_event);
|
||||||
|
|
||||||
InputEventMouseMotion();
|
InputEventMouseMotion() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
class InputEventJoypadMotion : public InputEvent {
|
class InputEventJoypadMotion : public InputEvent {
|
||||||
|
|
||||||
GDCLASS(InputEventJoypadMotion, InputEvent);
|
GDCLASS(InputEventJoypadMotion, InputEvent);
|
||||||
int axis; ///< Joypad axis
|
int axis = 0; ///< Joypad axis
|
||||||
float axis_value; ///< -1 to 1
|
float axis_value = 0; ///< -1 to 1
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
static void _bind_methods();
|
static void _bind_methods();
|
||||||
@ -411,15 +410,15 @@ public:
|
|||||||
virtual bool is_action_type() const { return true; }
|
virtual bool is_action_type() const { return true; }
|
||||||
virtual String as_text() const;
|
virtual String as_text() const;
|
||||||
|
|
||||||
InputEventJoypadMotion();
|
InputEventJoypadMotion() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
class InputEventJoypadButton : public InputEvent {
|
class InputEventJoypadButton : public InputEvent {
|
||||||
GDCLASS(InputEventJoypadButton, InputEvent);
|
GDCLASS(InputEventJoypadButton, InputEvent);
|
||||||
|
|
||||||
int button_index;
|
int button_index = 0;
|
||||||
bool pressed;
|
bool pressed = false;
|
||||||
float pressure; //0 to 1
|
float pressure = 0; //0 to 1
|
||||||
protected:
|
protected:
|
||||||
static void _bind_methods();
|
static void _bind_methods();
|
||||||
|
|
||||||
@ -439,14 +438,14 @@ public:
|
|||||||
virtual bool is_action_type() const { return true; }
|
virtual bool is_action_type() const { return true; }
|
||||||
virtual String as_text() const;
|
virtual String as_text() const;
|
||||||
|
|
||||||
InputEventJoypadButton();
|
InputEventJoypadButton() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
class InputEventScreenTouch : public InputEventFromWindow {
|
class InputEventScreenTouch : public InputEventFromWindow {
|
||||||
GDCLASS(InputEventScreenTouch, InputEventFromWindow);
|
GDCLASS(InputEventScreenTouch, InputEventFromWindow);
|
||||||
int index;
|
int index = 0;
|
||||||
Vector2 pos;
|
Vector2 pos;
|
||||||
bool pressed;
|
bool pressed = false;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
static void _bind_methods();
|
static void _bind_methods();
|
||||||
@ -464,13 +463,13 @@ public:
|
|||||||
virtual Ref<InputEvent> xformed_by(const Transform2D &p_xform, const Vector2 &p_local_ofs = Vector2()) const;
|
virtual Ref<InputEvent> xformed_by(const Transform2D &p_xform, const Vector2 &p_local_ofs = Vector2()) const;
|
||||||
virtual String as_text() const;
|
virtual String as_text() const;
|
||||||
|
|
||||||
InputEventScreenTouch();
|
InputEventScreenTouch() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
class InputEventScreenDrag : public InputEventFromWindow {
|
class InputEventScreenDrag : public InputEventFromWindow {
|
||||||
|
|
||||||
GDCLASS(InputEventScreenDrag, InputEventFromWindow);
|
GDCLASS(InputEventScreenDrag, InputEventFromWindow);
|
||||||
int index;
|
int index = 0;
|
||||||
Vector2 pos;
|
Vector2 pos;
|
||||||
Vector2 relative;
|
Vector2 relative;
|
||||||
Vector2 speed;
|
Vector2 speed;
|
||||||
@ -494,7 +493,7 @@ public:
|
|||||||
virtual Ref<InputEvent> xformed_by(const Transform2D &p_xform, const Vector2 &p_local_ofs = Vector2()) const;
|
virtual Ref<InputEvent> xformed_by(const Transform2D &p_xform, const Vector2 &p_local_ofs = Vector2()) const;
|
||||||
virtual String as_text() const;
|
virtual String as_text() const;
|
||||||
|
|
||||||
InputEventScreenDrag();
|
InputEventScreenDrag() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
class InputEventAction : public InputEvent {
|
class InputEventAction : public InputEvent {
|
||||||
@ -502,8 +501,8 @@ class InputEventAction : public InputEvent {
|
|||||||
GDCLASS(InputEventAction, InputEvent);
|
GDCLASS(InputEventAction, InputEvent);
|
||||||
|
|
||||||
StringName action;
|
StringName action;
|
||||||
bool pressed;
|
bool pressed = false;
|
||||||
float strength;
|
float strength = 1.0f;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
static void _bind_methods();
|
static void _bind_methods();
|
||||||
@ -526,7 +525,7 @@ public:
|
|||||||
virtual bool is_action_type() const { return true; }
|
virtual bool is_action_type() const { return true; }
|
||||||
virtual String as_text() const;
|
virtual String as_text() const;
|
||||||
|
|
||||||
InputEventAction();
|
InputEventAction() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
class InputEventGesture : public InputEventWithModifiers {
|
class InputEventGesture : public InputEventWithModifiers {
|
||||||
@ -546,7 +545,7 @@ public:
|
|||||||
class InputEventMagnifyGesture : public InputEventGesture {
|
class InputEventMagnifyGesture : public InputEventGesture {
|
||||||
|
|
||||||
GDCLASS(InputEventMagnifyGesture, InputEventGesture);
|
GDCLASS(InputEventMagnifyGesture, InputEventGesture);
|
||||||
real_t factor;
|
real_t factor = 1.0;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
static void _bind_methods();
|
static void _bind_methods();
|
||||||
@ -558,7 +557,7 @@ public:
|
|||||||
virtual Ref<InputEvent> xformed_by(const Transform2D &p_xform, const Vector2 &p_local_ofs = Vector2()) const;
|
virtual Ref<InputEvent> xformed_by(const Transform2D &p_xform, const Vector2 &p_local_ofs = Vector2()) const;
|
||||||
virtual String as_text() const;
|
virtual String as_text() const;
|
||||||
|
|
||||||
InputEventMagnifyGesture();
|
InputEventMagnifyGesture() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
class InputEventPanGesture : public InputEventGesture {
|
class InputEventPanGesture : public InputEventGesture {
|
||||||
@ -576,20 +575,20 @@ public:
|
|||||||
virtual Ref<InputEvent> xformed_by(const Transform2D &p_xform, const Vector2 &p_local_ofs = Vector2()) const;
|
virtual Ref<InputEvent> xformed_by(const Transform2D &p_xform, const Vector2 &p_local_ofs = Vector2()) const;
|
||||||
virtual String as_text() const;
|
virtual String as_text() const;
|
||||||
|
|
||||||
InputEventPanGesture();
|
InputEventPanGesture() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
class InputEventMIDI : public InputEvent {
|
class InputEventMIDI : public InputEvent {
|
||||||
GDCLASS(InputEventMIDI, InputEvent);
|
GDCLASS(InputEventMIDI, InputEvent);
|
||||||
|
|
||||||
int channel;
|
int channel = 0;
|
||||||
int message;
|
int message = 0;
|
||||||
int pitch;
|
int pitch = 0;
|
||||||
int velocity;
|
int velocity = 0;
|
||||||
int instrument;
|
int instrument = 0;
|
||||||
int pressure;
|
int pressure = 0;
|
||||||
int controller_number;
|
int controller_number = 0;
|
||||||
int controller_value;
|
int controller_value = 0;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
static void _bind_methods();
|
static void _bind_methods();
|
||||||
@ -621,7 +620,7 @@ public:
|
|||||||
|
|
||||||
virtual String as_text() const;
|
virtual String as_text() const;
|
||||||
|
|
||||||
InputEventMIDI();
|
InputEventMIDI() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // INPUT_EVENT_H
|
#endif // INPUT_EVENT_H
|
||||||
|
@ -53,7 +53,7 @@ public:
|
|||||||
static int get_max_compressed_buffer_size(int p_src_size, Mode p_mode = MODE_ZSTD);
|
static int get_max_compressed_buffer_size(int p_src_size, Mode p_mode = MODE_ZSTD);
|
||||||
static int decompress(uint8_t *p_dst, int p_dst_max_size, const uint8_t *p_src, int p_src_size, Mode p_mode = MODE_ZSTD);
|
static int decompress(uint8_t *p_dst, int p_dst_max_size, const uint8_t *p_src, int p_src_size, Mode p_mode = MODE_ZSTD);
|
||||||
|
|
||||||
Compression();
|
Compression() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // COMPRESSION_H
|
#endif // COMPRESSION_H
|
||||||
|
@ -29,6 +29,7 @@
|
|||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
|
|
||||||
#include "dtls_server.h"
|
#include "dtls_server.h"
|
||||||
|
|
||||||
#include "core/os/file_access.h"
|
#include "core/os/file_access.h"
|
||||||
#include "core/project_settings.h"
|
#include "core/project_settings.h"
|
||||||
|
|
||||||
@ -49,6 +50,3 @@ void DTLSServer::_bind_methods() {
|
|||||||
ClassDB::bind_method(D_METHOD("setup", "key", "certificate", "chain"), &DTLSServer::setup, DEFVAL(Ref<X509Certificate>()));
|
ClassDB::bind_method(D_METHOD("setup", "key", "certificate", "chain"), &DTLSServer::setup, DEFVAL(Ref<X509Certificate>()));
|
||||||
ClassDB::bind_method(D_METHOD("take_connection", "udp_peer"), &DTLSServer::take_connection);
|
ClassDB::bind_method(D_METHOD("take_connection", "udp_peer"), &DTLSServer::take_connection);
|
||||||
}
|
}
|
||||||
|
|
||||||
DTLSServer::DTLSServer() {
|
|
||||||
}
|
|
||||||
|
@ -51,7 +51,7 @@ public:
|
|||||||
virtual void stop() = 0;
|
virtual void stop() = 0;
|
||||||
virtual Ref<PacketPeerDTLS> take_connection(Ref<PacketPeerUDP> p_peer) = 0;
|
virtual Ref<PacketPeerDTLS> take_connection(Ref<PacketPeerUDP> p_peer) = 0;
|
||||||
|
|
||||||
DTLSServer();
|
DTLSServer() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // DTLS_SERVER_H
|
#endif // DTLS_SERVER_H
|
||||||
|
@ -166,11 +166,3 @@ Error FileAccessBuffered::get_error() const {
|
|||||||
|
|
||||||
return last_error;
|
return last_error;
|
||||||
}
|
}
|
||||||
|
|
||||||
FileAccessBuffered::FileAccessBuffered() {
|
|
||||||
|
|
||||||
cache_size = DEFAULT_CACHE_SIZE;
|
|
||||||
}
|
|
||||||
|
|
||||||
FileAccessBuffered::~FileAccessBuffered() {
|
|
||||||
}
|
|
||||||
|
@ -43,7 +43,7 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int cache_size;
|
int cache_size = DEFAULT_CACHE_SIZE;
|
||||||
|
|
||||||
int cache_data_left() const;
|
int cache_data_left() const;
|
||||||
mutable Error last_error;
|
mutable Error last_error;
|
||||||
@ -87,8 +87,8 @@ public:
|
|||||||
|
|
||||||
virtual Error get_error() const;
|
virtual Error get_error() const;
|
||||||
|
|
||||||
FileAccessBuffered();
|
FileAccessBuffered() {}
|
||||||
virtual ~FileAccessBuffered();
|
virtual ~FileAccessBuffered() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -132,12 +132,6 @@ public:
|
|||||||
set_error(OK);
|
set_error(OK);
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
|
||||||
static void make_default() {
|
|
||||||
FileAccess::create_func = FileAccessBufferedFA<T>::create;
|
|
||||||
};
|
|
||||||
*/
|
|
||||||
|
|
||||||
virtual uint64_t _get_modified_time(const String &p_file) {
|
virtual uint64_t _get_modified_time(const String &p_file) {
|
||||||
|
|
||||||
return f._get_modified_time(p_file);
|
return f._get_modified_time(p_file);
|
||||||
@ -151,9 +145,7 @@ public:
|
|||||||
return f._set_unix_permissions(p_file, p_permissions);
|
return f._set_unix_permissions(p_file, p_permissions);
|
||||||
}
|
}
|
||||||
|
|
||||||
FileAccessBufferedFA(){
|
FileAccessBufferedFA() {}
|
||||||
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // FILE_ACCESS_BUFFERED_FA_H
|
#endif // FILE_ACCESS_BUFFERED_FA_H
|
||||||
|
@ -389,25 +389,6 @@ Error FileAccessCompressed::_set_unix_permissions(const String &p_file, uint32_t
|
|||||||
return FAILED;
|
return FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
FileAccessCompressed::FileAccessCompressed() :
|
|
||||||
cmode(Compression::MODE_ZSTD),
|
|
||||||
writing(false),
|
|
||||||
write_ptr(nullptr),
|
|
||||||
write_buffer_size(0),
|
|
||||||
write_max(0),
|
|
||||||
block_size(0),
|
|
||||||
read_eof(false),
|
|
||||||
at_end(false),
|
|
||||||
read_ptr(nullptr),
|
|
||||||
read_block(0),
|
|
||||||
read_block_count(0),
|
|
||||||
read_block_size(0),
|
|
||||||
read_pos(0),
|
|
||||||
read_total(0),
|
|
||||||
magic("GCMP"),
|
|
||||||
f(nullptr) {
|
|
||||||
}
|
|
||||||
|
|
||||||
FileAccessCompressed::~FileAccessCompressed() {
|
FileAccessCompressed::~FileAccessCompressed() {
|
||||||
|
|
||||||
if (f)
|
if (f)
|
||||||
|
@ -36,15 +36,15 @@
|
|||||||
|
|
||||||
class FileAccessCompressed : public FileAccess {
|
class FileAccessCompressed : public FileAccess {
|
||||||
|
|
||||||
Compression::Mode cmode;
|
Compression::Mode cmode = Compression::MODE_ZSTD;
|
||||||
bool writing;
|
bool writing = false;
|
||||||
uint32_t write_pos;
|
uint32_t write_pos = 0;
|
||||||
uint8_t *write_ptr;
|
uint8_t *write_ptr = nullptr;
|
||||||
uint32_t write_buffer_size;
|
uint32_t write_buffer_size = 0;
|
||||||
uint32_t write_max;
|
uint32_t write_max = 0;
|
||||||
uint32_t block_size;
|
uint32_t block_size = 0;
|
||||||
mutable bool read_eof;
|
mutable bool read_eof = false;
|
||||||
mutable bool at_end;
|
mutable bool at_end = false;
|
||||||
|
|
||||||
struct ReadBlock {
|
struct ReadBlock {
|
||||||
int csize;
|
int csize;
|
||||||
@ -52,17 +52,17 @@ class FileAccessCompressed : public FileAccess {
|
|||||||
};
|
};
|
||||||
|
|
||||||
mutable Vector<uint8_t> comp_buffer;
|
mutable Vector<uint8_t> comp_buffer;
|
||||||
uint8_t *read_ptr;
|
uint8_t *read_ptr = nullptr;
|
||||||
mutable int read_block;
|
mutable int read_block = 0;
|
||||||
int read_block_count;
|
int read_block_count = 0;
|
||||||
mutable int read_block_size;
|
mutable int read_block_size = 0;
|
||||||
mutable int read_pos;
|
mutable int read_pos = 0;
|
||||||
Vector<ReadBlock> read_blocks;
|
Vector<ReadBlock> read_blocks;
|
||||||
uint32_t read_total;
|
uint32_t read_total = 0;
|
||||||
|
|
||||||
String magic;
|
String magic = "GCMP";
|
||||||
mutable Vector<uint8_t> buffer;
|
mutable Vector<uint8_t> buffer;
|
||||||
FileAccess *f;
|
FileAccess *f = nullptr;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void configure(const String &p_magic, Compression::Mode p_mode = Compression::MODE_ZSTD, int p_block_size = 4096);
|
void configure(const String &p_magic, Compression::Mode p_mode = Compression::MODE_ZSTD, int p_block_size = 4096);
|
||||||
@ -94,7 +94,7 @@ public:
|
|||||||
virtual uint32_t _get_unix_permissions(const String &p_file);
|
virtual uint32_t _get_unix_permissions(const String &p_file);
|
||||||
virtual Error _set_unix_permissions(const String &p_file, uint32_t p_permissions);
|
virtual Error _set_unix_permissions(const String &p_file, uint32_t p_permissions);
|
||||||
|
|
||||||
FileAccessCompressed();
|
FileAccessCompressed() {}
|
||||||
virtual ~FileAccessCompressed();
|
virtual ~FileAccessCompressed();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -317,15 +317,6 @@ Error FileAccessEncrypted::_set_unix_permissions(const String &p_file, uint32_t
|
|||||||
return ERR_UNAVAILABLE;
|
return ERR_UNAVAILABLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
FileAccessEncrypted::FileAccessEncrypted() {
|
|
||||||
|
|
||||||
file = nullptr;
|
|
||||||
pos = 0;
|
|
||||||
eofed = false;
|
|
||||||
mode = MODE_MAX;
|
|
||||||
writing = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
FileAccessEncrypted::~FileAccessEncrypted() {
|
FileAccessEncrypted::~FileAccessEncrypted() {
|
||||||
|
|
||||||
if (file)
|
if (file)
|
||||||
|
@ -42,15 +42,15 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Mode mode;
|
Mode mode = MODE_MAX;
|
||||||
Vector<uint8_t> key;
|
Vector<uint8_t> key;
|
||||||
bool writing;
|
bool writing = false;
|
||||||
FileAccess *file;
|
FileAccess *file = nullptr;
|
||||||
size_t base;
|
size_t base;
|
||||||
size_t length;
|
size_t length;
|
||||||
Vector<uint8_t> data;
|
Vector<uint8_t> data;
|
||||||
mutable int pos;
|
mutable int pos = 0;
|
||||||
mutable bool eofed;
|
mutable bool eofed = false;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Error open_and_parse(FileAccess *p_base, const Vector<uint8_t> &p_key, Mode p_mode);
|
Error open_and_parse(FileAccess *p_base, const Vector<uint8_t> &p_key, Mode p_mode);
|
||||||
@ -85,7 +85,7 @@ public:
|
|||||||
virtual uint32_t _get_unix_permissions(const String &p_file);
|
virtual uint32_t _get_unix_permissions(const String &p_file);
|
||||||
virtual Error _set_unix_permissions(const String &p_file, uint32_t p_permissions);
|
virtual Error _set_unix_permissions(const String &p_file, uint32_t p_permissions);
|
||||||
|
|
||||||
FileAccessEncrypted();
|
FileAccessEncrypted() {}
|
||||||
~FileAccessEncrypted();
|
~FileAccessEncrypted();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -193,8 +193,3 @@ void FileAccessMemory::store_buffer(const uint8_t *p_src, int p_length) {
|
|||||||
copymem(&data[pos], p_src, write);
|
copymem(&data[pos], p_src, write);
|
||||||
pos += p_length;
|
pos += p_length;
|
||||||
}
|
}
|
||||||
|
|
||||||
FileAccessMemory::FileAccessMemory() {
|
|
||||||
|
|
||||||
data = nullptr;
|
|
||||||
}
|
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
|
|
||||||
class FileAccessMemory : public FileAccess {
|
class FileAccessMemory : public FileAccess {
|
||||||
|
|
||||||
uint8_t *data;
|
uint8_t *data = nullptr;
|
||||||
int length;
|
int length;
|
||||||
mutable int pos;
|
mutable int pos;
|
||||||
|
|
||||||
@ -73,7 +73,7 @@ public:
|
|||||||
virtual uint32_t _get_unix_permissions(const String &p_file) { return 0; }
|
virtual uint32_t _get_unix_permissions(const String &p_file) { return 0; }
|
||||||
virtual Error _set_unix_permissions(const String &p_file, uint32_t p_permissions) { return FAILED; }
|
virtual Error _set_unix_permissions(const String &p_file, uint32_t p_permissions) { return FAILED; }
|
||||||
|
|
||||||
FileAccessMemory();
|
FileAccessMemory() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // FILE_ACCESS_MEMORY_H
|
#endif // FILE_ACCESS_MEMORY_H
|
||||||
|
@ -222,17 +222,11 @@ Error FileAccessNetworkClient::connect(const String &p_host, int p_port, const S
|
|||||||
FileAccessNetworkClient *FileAccessNetworkClient::singleton = nullptr;
|
FileAccessNetworkClient *FileAccessNetworkClient::singleton = nullptr;
|
||||||
|
|
||||||
FileAccessNetworkClient::FileAccessNetworkClient() {
|
FileAccessNetworkClient::FileAccessNetworkClient() {
|
||||||
|
|
||||||
thread = nullptr;
|
|
||||||
quit = false;
|
|
||||||
singleton = this;
|
singleton = this;
|
||||||
last_id = 0;
|
|
||||||
client.instance();
|
client.instance();
|
||||||
lockcount = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
FileAccessNetworkClient::~FileAccessNetworkClient() {
|
FileAccessNetworkClient::~FileAccessNetworkClient() {
|
||||||
|
|
||||||
if (thread) {
|
if (thread) {
|
||||||
quit = true;
|
quit = true;
|
||||||
sem.post();
|
sem.post();
|
||||||
@ -513,9 +507,6 @@ void FileAccessNetwork::configure() {
|
|||||||
|
|
||||||
FileAccessNetwork::FileAccessNetwork() {
|
FileAccessNetwork::FileAccessNetwork() {
|
||||||
|
|
||||||
eof_flag = false;
|
|
||||||
opened = false;
|
|
||||||
pos = 0;
|
|
||||||
FileAccessNetworkClient *nc = FileAccessNetworkClient::singleton;
|
FileAccessNetworkClient *nc = FileAccessNetworkClient::singleton;
|
||||||
nc->lock_mutex();
|
nc->lock_mutex();
|
||||||
id = nc->last_id++;
|
id = nc->last_id++;
|
||||||
@ -523,9 +514,6 @@ FileAccessNetwork::FileAccessNetwork() {
|
|||||||
nc->unlock_mutex();
|
nc->unlock_mutex();
|
||||||
page_size = GLOBAL_GET("network/remote_fs/page_size");
|
page_size = GLOBAL_GET("network/remote_fs/page_size");
|
||||||
read_ahead = GLOBAL_GET("network/remote_fs/page_read_ahead");
|
read_ahead = GLOBAL_GET("network/remote_fs/page_read_ahead");
|
||||||
last_activity_val = 0;
|
|
||||||
waiting_on_page = -1;
|
|
||||||
last_page = -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
FileAccessNetwork::~FileAccessNetwork() {
|
FileAccessNetwork::~FileAccessNetwork() {
|
||||||
|
@ -50,13 +50,14 @@ class FileAccessNetworkClient {
|
|||||||
List<BlockRequest> block_requests;
|
List<BlockRequest> block_requests;
|
||||||
|
|
||||||
Semaphore sem;
|
Semaphore sem;
|
||||||
Thread *thread;
|
Thread *thread = nullptr;
|
||||||
bool quit;
|
bool quit = false;
|
||||||
Mutex mutex;
|
Mutex mutex;
|
||||||
Mutex blockrequest_mutex;
|
Mutex blockrequest_mutex;
|
||||||
Map<int, FileAccessNetwork *> accesses;
|
Map<int, FileAccessNetwork *> accesses;
|
||||||
Ref<StreamPeerTCP> client;
|
Ref<StreamPeerTCP> client;
|
||||||
int last_id;
|
int last_id = 0;
|
||||||
|
int lockcount = 0;
|
||||||
|
|
||||||
Vector<uint8_t> block;
|
Vector<uint8_t> block;
|
||||||
|
|
||||||
@ -67,7 +68,6 @@ class FileAccessNetworkClient {
|
|||||||
void put_64(int64_t p_64);
|
void put_64(int64_t p_64);
|
||||||
int get_32();
|
int get_32();
|
||||||
int64_t get_64();
|
int64_t get_64();
|
||||||
int lockcount;
|
|
||||||
void lock_mutex();
|
void lock_mutex();
|
||||||
void unlock_mutex();
|
void unlock_mutex();
|
||||||
|
|
||||||
@ -88,27 +88,23 @@ class FileAccessNetwork : public FileAccess {
|
|||||||
Semaphore sem;
|
Semaphore sem;
|
||||||
Semaphore page_sem;
|
Semaphore page_sem;
|
||||||
Mutex buffer_mutex;
|
Mutex buffer_mutex;
|
||||||
bool opened;
|
bool opened = false;
|
||||||
size_t total_size;
|
size_t total_size;
|
||||||
mutable size_t pos;
|
mutable size_t pos = 0;
|
||||||
int id;
|
int id;
|
||||||
mutable bool eof_flag;
|
mutable bool eof_flag = false;
|
||||||
mutable int last_page;
|
mutable int last_page = -1;
|
||||||
mutable uint8_t *last_page_buff;
|
mutable uint8_t *last_page_buff = nullptr;
|
||||||
|
|
||||||
int page_size;
|
int page_size;
|
||||||
int read_ahead;
|
int read_ahead;
|
||||||
|
|
||||||
mutable int waiting_on_page;
|
mutable int waiting_on_page = -1;
|
||||||
mutable int last_activity_val;
|
|
||||||
struct Page {
|
struct Page {
|
||||||
int activity;
|
int activity = 0;
|
||||||
bool queued;
|
bool queued = false;
|
||||||
Vector<uint8_t> buffer;
|
Vector<uint8_t> buffer;
|
||||||
Page() {
|
|
||||||
activity = 0;
|
|
||||||
queued = false;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
mutable Vector<Page> pages;
|
mutable Vector<Page> pages;
|
||||||
|
@ -109,8 +109,6 @@ PackedData::PackedData() {
|
|||||||
|
|
||||||
singleton = this;
|
singleton = this;
|
||||||
root = memnew(PackedDir);
|
root = memnew(PackedDir);
|
||||||
root->parent = nullptr;
|
|
||||||
disabled = false;
|
|
||||||
|
|
||||||
add_pack_source(memnew(PackedSourcePCK));
|
add_pack_source(memnew(PackedSourcePCK));
|
||||||
}
|
}
|
||||||
@ -506,10 +504,5 @@ String DirAccessPack::get_filesystem_type() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
DirAccessPack::DirAccessPack() {
|
DirAccessPack::DirAccessPack() {
|
||||||
|
|
||||||
current = PackedData::get_singleton()->root;
|
current = PackedData::get_singleton()->root;
|
||||||
cdir = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
DirAccessPack::~DirAccessPack() {
|
|
||||||
}
|
}
|
||||||
|
@ -61,15 +61,15 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
struct PackedDir {
|
struct PackedDir {
|
||||||
PackedDir *parent;
|
PackedDir *parent = nullptr;
|
||||||
String name;
|
String name;
|
||||||
Map<String, PackedDir *> subdirs;
|
Map<String, PackedDir *> subdirs;
|
||||||
Set<String> files;
|
Set<String> files;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct PathMD5 {
|
struct PathMD5 {
|
||||||
uint64_t a;
|
uint64_t a = 0;
|
||||||
uint64_t b;
|
uint64_t b = 0;
|
||||||
bool operator<(const PathMD5 &p_md5) const {
|
bool operator<(const PathMD5 &p_md5) const {
|
||||||
|
|
||||||
if (p_md5.a == a) {
|
if (p_md5.a == a) {
|
||||||
@ -83,14 +83,12 @@ private:
|
|||||||
return a == p_md5.a && b == p_md5.b;
|
return a == p_md5.a && b == p_md5.b;
|
||||||
};
|
};
|
||||||
|
|
||||||
PathMD5() {
|
PathMD5() {}
|
||||||
a = b = 0;
|
|
||||||
};
|
|
||||||
|
|
||||||
PathMD5(const Vector<uint8_t> p_buf) {
|
PathMD5(const Vector<uint8_t> p_buf) {
|
||||||
a = *((uint64_t *)&p_buf[0]);
|
a = *((uint64_t *)&p_buf[0]);
|
||||||
b = *((uint64_t *)&p_buf[8]);
|
b = *((uint64_t *)&p_buf[8]);
|
||||||
};
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
Map<PathMD5, PackedFile> files;
|
Map<PathMD5, PackedFile> files;
|
||||||
@ -98,10 +96,9 @@ private:
|
|||||||
Vector<PackSource *> sources;
|
Vector<PackSource *> sources;
|
||||||
|
|
||||||
PackedDir *root;
|
PackedDir *root;
|
||||||
//Map<String,PackedDir*> dirs;
|
|
||||||
|
|
||||||
static PackedData *singleton;
|
static PackedData *singleton;
|
||||||
bool disabled;
|
bool disabled = false;
|
||||||
|
|
||||||
void _free_packed_dirs(PackedDir *p_dir);
|
void _free_packed_dirs(PackedDir *p_dir);
|
||||||
|
|
||||||
@ -203,7 +200,7 @@ class DirAccessPack : public DirAccess {
|
|||||||
|
|
||||||
List<String> list_dirs;
|
List<String> list_dirs;
|
||||||
List<String> list_files;
|
List<String> list_files;
|
||||||
bool cdir;
|
bool cdir = false;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual Error list_dir_begin();
|
virtual Error list_dir_begin();
|
||||||
@ -231,7 +228,7 @@ public:
|
|||||||
virtual String get_filesystem_type() const;
|
virtual String get_filesystem_type() const;
|
||||||
|
|
||||||
DirAccessPack();
|
DirAccessPack();
|
||||||
~DirAccessPack();
|
~DirAccessPack() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // FILE_ACCESS_PACK_H
|
#endif // FILE_ACCESS_PACK_H
|
||||||
|
@ -241,9 +241,7 @@ ZipArchive *ZipArchive::get_singleton() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ZipArchive::ZipArchive() {
|
ZipArchive::ZipArchive() {
|
||||||
|
|
||||||
instance = this;
|
instance = this;
|
||||||
//fa_create_func = FileAccess::get_create_func();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ZipArchive::~ZipArchive() {
|
ZipArchive::~ZipArchive() {
|
||||||
@ -369,14 +367,12 @@ bool FileAccessZip::file_exists(const String &p_name) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
FileAccessZip::FileAccessZip(const String &p_path, const PackedData::PackedFile &p_file) :
|
FileAccessZip::FileAccessZip(const String &p_path, const PackedData::PackedFile &p_file) {
|
||||||
zfile(nullptr) {
|
|
||||||
_open(p_path, FileAccess::READ);
|
_open(p_path, FileAccess::READ);
|
||||||
}
|
}
|
||||||
|
|
||||||
FileAccessZip::~FileAccessZip() {
|
FileAccessZip::~FileAccessZip() {
|
||||||
|
|
||||||
close();
|
close();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif // MINIZIP_ENABLED
|
||||||
|
@ -45,18 +45,15 @@ class ZipArchive : public PackSource {
|
|||||||
public:
|
public:
|
||||||
struct File {
|
struct File {
|
||||||
|
|
||||||
int package;
|
int package = -1;
|
||||||
unz_file_pos file_pos;
|
unz_file_pos file_pos;
|
||||||
File() {
|
File() {}
|
||||||
|
|
||||||
package = -1;
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
struct Package {
|
struct Package {
|
||||||
String filename;
|
String filename;
|
||||||
unzFile zfile;
|
unzFile zfile = nullptr;
|
||||||
};
|
};
|
||||||
Vector<Package> packages;
|
Vector<Package> packages;
|
||||||
|
|
||||||
|
@ -729,27 +729,10 @@ int HTTPClient::get_read_chunk_size() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
HTTPClient::HTTPClient() {
|
HTTPClient::HTTPClient() {
|
||||||
|
|
||||||
tcp_connection.instance();
|
tcp_connection.instance();
|
||||||
resolving = IP::RESOLVER_INVALID_ID;
|
|
||||||
status = STATUS_DISCONNECTED;
|
|
||||||
head_request = false;
|
|
||||||
conn_port = -1;
|
|
||||||
body_size = -1;
|
|
||||||
chunked = false;
|
|
||||||
body_left = 0;
|
|
||||||
read_until_eof = false;
|
|
||||||
chunk_left = 0;
|
|
||||||
chunk_trailer_part = false;
|
|
||||||
response_num = 0;
|
|
||||||
ssl = false;
|
|
||||||
blocking = false;
|
|
||||||
handshaking = false;
|
|
||||||
read_chunk_size = 4096;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
HTTPClient::~HTTPClient() {
|
HTTPClient::~HTTPClient() {}
|
||||||
}
|
|
||||||
|
|
||||||
#endif // #ifndef JAVASCRIPT_ENABLED
|
#endif // #ifndef JAVASCRIPT_ENABLED
|
||||||
|
|
||||||
|
@ -158,32 +158,32 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
#ifndef JAVASCRIPT_ENABLED
|
#ifndef JAVASCRIPT_ENABLED
|
||||||
Status status;
|
Status status = STATUS_DISCONNECTED;
|
||||||
IP::ResolverID resolving;
|
IP::ResolverID resolving = IP::RESOLVER_INVALID_ID;
|
||||||
int conn_port;
|
int conn_port = -1;
|
||||||
String conn_host;
|
String conn_host;
|
||||||
bool ssl;
|
bool ssl = false;
|
||||||
bool ssl_verify_host;
|
bool ssl_verify_host = false;
|
||||||
bool blocking;
|
bool blocking = false;
|
||||||
bool handshaking;
|
bool handshaking = false;
|
||||||
bool head_request;
|
bool head_request = false;
|
||||||
|
|
||||||
Vector<uint8_t> response_str;
|
Vector<uint8_t> response_str;
|
||||||
|
|
||||||
bool chunked;
|
bool chunked = false;
|
||||||
Vector<uint8_t> chunk;
|
Vector<uint8_t> chunk;
|
||||||
int chunk_left;
|
int chunk_left = 0;
|
||||||
bool chunk_trailer_part;
|
bool chunk_trailer_part = false;
|
||||||
int body_size;
|
int body_size = -1;
|
||||||
int body_left;
|
int body_left = 0;
|
||||||
bool read_until_eof;
|
bool read_until_eof = false;
|
||||||
|
|
||||||
Ref<StreamPeerTCP> tcp_connection;
|
Ref<StreamPeerTCP> tcp_connection;
|
||||||
Ref<StreamPeer> connection;
|
Ref<StreamPeer> connection;
|
||||||
|
|
||||||
int response_num;
|
int response_num = 0;
|
||||||
Vector<String> response_headers;
|
Vector<String> response_headers;
|
||||||
int read_chunk_size;
|
int read_chunk_size = 4096;
|
||||||
|
|
||||||
Error _get_http_data(uint8_t *p_buffer, int p_bytes, int &r_received);
|
Error _get_http_data(uint8_t *p_buffer, int p_bytes, int &r_received);
|
||||||
|
|
||||||
|
@ -102,8 +102,6 @@ void Logger::logf_error(const char *p_format, ...) {
|
|||||||
va_end(argp);
|
va_end(argp);
|
||||||
}
|
}
|
||||||
|
|
||||||
Logger::~Logger() {}
|
|
||||||
|
|
||||||
void RotatedFileLogger::close_file() {
|
void RotatedFileLogger::close_file() {
|
||||||
if (file) {
|
if (file) {
|
||||||
memdelete(file);
|
memdelete(file);
|
||||||
@ -180,8 +178,7 @@ void RotatedFileLogger::rotate_file() {
|
|||||||
|
|
||||||
RotatedFileLogger::RotatedFileLogger(const String &p_base_path, int p_max_files) :
|
RotatedFileLogger::RotatedFileLogger(const String &p_base_path, int p_max_files) :
|
||||||
base_path(p_base_path.simplify_path()),
|
base_path(p_base_path.simplify_path()),
|
||||||
max_files(p_max_files > 0 ? p_max_files : 1),
|
max_files(p_max_files > 0 ? p_max_files : 1) {
|
||||||
file(nullptr) {
|
|
||||||
rotate_file();
|
rotate_file();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -236,8 +233,6 @@ void StdLogger::logv(const char *p_format, va_list p_list, bool p_err) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
StdLogger::~StdLogger() {}
|
|
||||||
|
|
||||||
CompositeLogger::CompositeLogger(Vector<Logger *> p_loggers) :
|
CompositeLogger::CompositeLogger(Vector<Logger *> p_loggers) :
|
||||||
loggers(p_loggers) {
|
loggers(p_loggers) {
|
||||||
}
|
}
|
||||||
|
@ -55,7 +55,7 @@ public:
|
|||||||
void logf(const char *p_format, ...) _PRINTF_FORMAT_ATTRIBUTE_2_3;
|
void logf(const char *p_format, ...) _PRINTF_FORMAT_ATTRIBUTE_2_3;
|
||||||
void logf_error(const char *p_format, ...) _PRINTF_FORMAT_ATTRIBUTE_2_3;
|
void logf_error(const char *p_format, ...) _PRINTF_FORMAT_ATTRIBUTE_2_3;
|
||||||
|
|
||||||
virtual ~Logger();
|
virtual ~Logger() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -65,7 +65,7 @@ class StdLogger : public Logger {
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
virtual void logv(const char *p_format, va_list p_list, bool p_err) _PRINTF_FORMAT_ATTRIBUTE_2_0;
|
virtual void logv(const char *p_format, va_list p_list, bool p_err) _PRINTF_FORMAT_ATTRIBUTE_2_0;
|
||||||
virtual ~StdLogger();
|
virtual ~StdLogger() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -78,7 +78,7 @@ class RotatedFileLogger : public Logger {
|
|||||||
String base_path;
|
String base_path;
|
||||||
int max_files;
|
int max_files;
|
||||||
|
|
||||||
FileAccess *file;
|
FileAccess *file = nullptr;
|
||||||
|
|
||||||
void rotate_file_without_closing();
|
void rotate_file_without_closing();
|
||||||
void close_file();
|
void close_file();
|
||||||
|
@ -53,9 +53,6 @@ ObjectID EncodedObjectAsID::get_object_id() const {
|
|||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
EncodedObjectAsID::EncodedObjectAsID() {
|
|
||||||
}
|
|
||||||
|
|
||||||
#define _S(a) ((int32_t)a)
|
#define _S(a) ((int32_t)a)
|
||||||
#define ERR_FAIL_ADD_OF(a, b, err) ERR_FAIL_COND_V(_S(b) < 0 || _S(a) < 0 || _S(a) > INT_MAX - _S(b), err)
|
#define ERR_FAIL_ADD_OF(a, b, err) ERR_FAIL_COND_V(_S(b) < 0 || _S(a) < 0 || _S(a) > INT_MAX - _S(b), err)
|
||||||
#define ERR_FAIL_MUL_OF(a, b, err) ERR_FAIL_COND_V(_S(a) < 0 || _S(b) <= 0 || _S(a) > INT_MAX / _S(b), err)
|
#define ERR_FAIL_MUL_OF(a, b, err) ERR_FAIL_COND_V(_S(a) < 0 || _S(b) <= 0 || _S(a) > INT_MAX / _S(b), err)
|
||||||
|
@ -197,7 +197,7 @@ public:
|
|||||||
void set_object_id(ObjectID p_id);
|
void set_object_id(ObjectID p_id);
|
||||||
ObjectID get_object_id() const;
|
ObjectID get_object_id() const;
|
||||||
|
|
||||||
EncodedObjectAsID();
|
EncodedObjectAsID() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int *r_len = nullptr, bool p_allow_objects = false);
|
Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int *r_len = nullptr, bool p_allow_objects = false);
|
||||||
|
@ -33,6 +33,7 @@
|
|||||||
#include "core/debugger/engine_debugger.h"
|
#include "core/debugger/engine_debugger.h"
|
||||||
#include "core/io/marshalls.h"
|
#include "core/io/marshalls.h"
|
||||||
#include "scene/main/node.h"
|
#include "scene/main/node.h"
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
#define NODE_ID_COMPRESSION_SHIFT 3
|
#define NODE_ID_COMPRESSION_SHIFT 3
|
||||||
@ -1261,10 +1262,7 @@ void MultiplayerAPI::_bind_methods() {
|
|||||||
BIND_ENUM_CONSTANT(RPC_MODE_PUPPETSYNC);
|
BIND_ENUM_CONSTANT(RPC_MODE_PUPPETSYNC);
|
||||||
}
|
}
|
||||||
|
|
||||||
MultiplayerAPI::MultiplayerAPI() :
|
MultiplayerAPI::MultiplayerAPI() {
|
||||||
allow_object_decoding(false) {
|
|
||||||
rpc_sender_id = 0;
|
|
||||||
root_node = nullptr;
|
|
||||||
clear();
|
clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -56,14 +56,14 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
Ref<NetworkedMultiplayerPeer> network_peer;
|
Ref<NetworkedMultiplayerPeer> network_peer;
|
||||||
int rpc_sender_id;
|
int rpc_sender_id = 0;
|
||||||
Set<int> connected_peers;
|
Set<int> connected_peers;
|
||||||
HashMap<NodePath, PathSentCache> path_send_cache;
|
HashMap<NodePath, PathSentCache> path_send_cache;
|
||||||
Map<int, PathGetCache> path_get_cache;
|
Map<int, PathGetCache> path_get_cache;
|
||||||
int last_send_cache_id;
|
int last_send_cache_id;
|
||||||
Vector<uint8_t> packet_cache;
|
Vector<uint8_t> packet_cache;
|
||||||
Node *root_node;
|
Node *root_node = nullptr;
|
||||||
bool allow_object_decoding;
|
bool allow_object_decoding = false;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
static void _bind_methods();
|
static void _bind_methods();
|
||||||
|
@ -66,6 +66,3 @@ void NetworkedMultiplayerPeer::_bind_methods() {
|
|||||||
ADD_SIGNAL(MethodInfo("connection_succeeded"));
|
ADD_SIGNAL(MethodInfo("connection_succeeded"));
|
||||||
ADD_SIGNAL(MethodInfo("connection_failed"));
|
ADD_SIGNAL(MethodInfo("connection_failed"));
|
||||||
}
|
}
|
||||||
|
|
||||||
NetworkedMultiplayerPeer::NetworkedMultiplayerPeer() {
|
|
||||||
}
|
|
||||||
|
@ -74,7 +74,7 @@ public:
|
|||||||
|
|
||||||
virtual ConnectionStatus get_connection_status() const = 0;
|
virtual ConnectionStatus get_connection_status() const = 0;
|
||||||
|
|
||||||
NetworkedMultiplayerPeer();
|
NetworkedMultiplayerPeer() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
VARIANT_ENUM_CAST(NetworkedMultiplayerPeer::TransferMode)
|
VARIANT_ENUM_CAST(NetworkedMultiplayerPeer::TransferMode)
|
||||||
|
@ -35,11 +35,6 @@
|
|||||||
|
|
||||||
/* helpers / binders */
|
/* helpers / binders */
|
||||||
|
|
||||||
PacketPeer::PacketPeer() :
|
|
||||||
last_get_error(OK),
|
|
||||||
encode_buffer_max_size(8 * 1024 * 1024) {
|
|
||||||
}
|
|
||||||
|
|
||||||
void PacketPeer::set_encode_buffer_max_size(int p_max_size) {
|
void PacketPeer::set_encode_buffer_max_size(int p_max_size) {
|
||||||
|
|
||||||
ERR_FAIL_COND_MSG(p_max_size < 1024, "Max encode buffer must be at least 1024 bytes");
|
ERR_FAIL_COND_MSG(p_max_size < 1024, "Max encode buffer must be at least 1024 bytes");
|
||||||
|
@ -47,9 +47,9 @@ class PacketPeer : public Reference {
|
|||||||
Vector<uint8_t> _get_packet();
|
Vector<uint8_t> _get_packet();
|
||||||
Error _get_packet_error() const;
|
Error _get_packet_error() const;
|
||||||
|
|
||||||
mutable Error last_get_error;
|
mutable Error last_get_error = OK;
|
||||||
|
|
||||||
int encode_buffer_max_size;
|
int encode_buffer_max_size = 8 * 1024 * 1024;
|
||||||
Vector<uint8_t> encode_buffer;
|
Vector<uint8_t> encode_buffer;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -70,7 +70,7 @@ public:
|
|||||||
void set_encode_buffer_max_size(int p_max_size);
|
void set_encode_buffer_max_size(int p_max_size);
|
||||||
int get_encode_buffer_max_size() const;
|
int get_encode_buffer_max_size() const;
|
||||||
|
|
||||||
PacketPeer();
|
PacketPeer() {}
|
||||||
~PacketPeer() {}
|
~PacketPeer() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -57,6 +57,3 @@ void PacketPeerDTLS::_bind_methods() {
|
|||||||
BIND_ENUM_CONSTANT(STATUS_ERROR);
|
BIND_ENUM_CONSTANT(STATUS_ERROR);
|
||||||
BIND_ENUM_CONSTANT(STATUS_ERROR_HOSTNAME_MISMATCH);
|
BIND_ENUM_CONSTANT(STATUS_ERROR_HOSTNAME_MISMATCH);
|
||||||
}
|
}
|
||||||
|
|
||||||
PacketPeerDTLS::PacketPeerDTLS() {
|
|
||||||
}
|
|
||||||
|
@ -60,7 +60,7 @@ public:
|
|||||||
static PacketPeerDTLS *create();
|
static PacketPeerDTLS *create();
|
||||||
static bool is_available();
|
static bool is_available();
|
||||||
|
|
||||||
PacketPeerDTLS();
|
PacketPeerDTLS() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
VARIANT_ENUM_CAST(PacketPeerDTLS::Status);
|
VARIANT_ENUM_CAST(PacketPeerDTLS::Status);
|
||||||
|
@ -343,12 +343,6 @@ void PacketPeerUDP::_bind_methods() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
PacketPeerUDP::PacketPeerUDP() :
|
PacketPeerUDP::PacketPeerUDP() :
|
||||||
packet_port(0),
|
|
||||||
queue_count(0),
|
|
||||||
peer_port(0),
|
|
||||||
connected(false),
|
|
||||||
blocking(true),
|
|
||||||
broadcast(false),
|
|
||||||
_sock(Ref<NetSocket>(NetSocket::create())) {
|
_sock(Ref<NetSocket>(NetSocket::create())) {
|
||||||
rb.resize(16);
|
rb.resize(16);
|
||||||
}
|
}
|
||||||
|
@ -47,14 +47,14 @@ protected:
|
|||||||
uint8_t recv_buffer[PACKET_BUFFER_SIZE];
|
uint8_t recv_buffer[PACKET_BUFFER_SIZE];
|
||||||
uint8_t packet_buffer[PACKET_BUFFER_SIZE];
|
uint8_t packet_buffer[PACKET_BUFFER_SIZE];
|
||||||
IP_Address packet_ip;
|
IP_Address packet_ip;
|
||||||
int packet_port;
|
int packet_port = 0;
|
||||||
int queue_count;
|
int queue_count = 0;
|
||||||
|
|
||||||
IP_Address peer_addr;
|
IP_Address peer_addr;
|
||||||
int peer_port;
|
int peer_port = 0;
|
||||||
bool connected;
|
bool connected = false;
|
||||||
bool blocking;
|
bool blocking = true;
|
||||||
bool broadcast;
|
bool broadcast = false;
|
||||||
Ref<NetSocket> _sock;
|
Ref<NetSocket> _sock;
|
||||||
|
|
||||||
static void _bind_methods();
|
static void _bind_methods();
|
||||||
|
@ -180,11 +180,6 @@ Error PCKPacker::flush(bool p_verbose) {
|
|||||||
return OK;
|
return OK;
|
||||||
};
|
};
|
||||||
|
|
||||||
PCKPacker::PCKPacker() {
|
|
||||||
|
|
||||||
file = nullptr;
|
|
||||||
};
|
|
||||||
|
|
||||||
PCKPacker::~PCKPacker() {
|
PCKPacker::~PCKPacker() {
|
||||||
if (file != nullptr) {
|
if (file != nullptr) {
|
||||||
memdelete(file);
|
memdelete(file);
|
||||||
|
@ -39,7 +39,7 @@ class PCKPacker : public Reference {
|
|||||||
|
|
||||||
GDCLASS(PCKPacker, Reference);
|
GDCLASS(PCKPacker, Reference);
|
||||||
|
|
||||||
FileAccess *file;
|
FileAccess *file = nullptr;
|
||||||
int alignment;
|
int alignment;
|
||||||
|
|
||||||
static void _bind_methods();
|
static void _bind_methods();
|
||||||
@ -58,7 +58,7 @@ public:
|
|||||||
Error add_file(const String &p_file, const String &p_src);
|
Error add_file(const String &p_file, const String &p_src);
|
||||||
Error flush(bool p_verbose = false);
|
Error flush(bool p_verbose = false);
|
||||||
|
|
||||||
PCKPacker();
|
PCKPacker() {}
|
||||||
~PCKPacker();
|
~PCKPacker();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1024,18 +1024,6 @@ String ResourceLoaderBinary::recognize(FileAccess *p_f) {
|
|||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
ResourceLoaderBinary::ResourceLoaderBinary() :
|
|
||||||
translation_remapped(false),
|
|
||||||
ver_format(0),
|
|
||||||
f(nullptr),
|
|
||||||
importmd_ofs(0),
|
|
||||||
error(OK) {
|
|
||||||
|
|
||||||
use_nocache = false;
|
|
||||||
progress = nullptr;
|
|
||||||
use_sub_threads = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
ResourceLoaderBinary::~ResourceLoaderBinary() {
|
ResourceLoaderBinary::~ResourceLoaderBinary() {
|
||||||
|
|
||||||
if (f)
|
if (f)
|
||||||
@ -2118,6 +2106,5 @@ void ResourceFormatSaverBinary::get_recognized_extensions(const RES &p_resource,
|
|||||||
ResourceFormatSaverBinary *ResourceFormatSaverBinary::singleton = nullptr;
|
ResourceFormatSaverBinary *ResourceFormatSaverBinary::singleton = nullptr;
|
||||||
|
|
||||||
ResourceFormatSaverBinary::ResourceFormatSaverBinary() {
|
ResourceFormatSaverBinary::ResourceFormatSaverBinary() {
|
||||||
|
|
||||||
singleton = this;
|
singleton = this;
|
||||||
}
|
}
|
||||||
|
@ -37,16 +37,16 @@
|
|||||||
|
|
||||||
class ResourceLoaderBinary {
|
class ResourceLoaderBinary {
|
||||||
|
|
||||||
bool translation_remapped;
|
bool translation_remapped = false;
|
||||||
String local_path;
|
String local_path;
|
||||||
String res_path;
|
String res_path;
|
||||||
String type;
|
String type;
|
||||||
Ref<Resource> resource;
|
Ref<Resource> resource;
|
||||||
uint32_t ver_format;
|
uint32_t ver_format = 0;
|
||||||
|
|
||||||
FileAccess *f;
|
FileAccess *f = nullptr;
|
||||||
|
|
||||||
uint64_t importmd_ofs;
|
uint64_t importmd_ofs = 0;
|
||||||
|
|
||||||
Vector<char> str_buf;
|
Vector<char> str_buf;
|
||||||
List<RES> resource_cache;
|
List<RES> resource_cache;
|
||||||
@ -61,8 +61,8 @@ class ResourceLoaderBinary {
|
|||||||
RES cache;
|
RES cache;
|
||||||
};
|
};
|
||||||
|
|
||||||
bool use_sub_threads;
|
bool use_sub_threads = false;
|
||||||
float *progress;
|
float *progress = nullptr;
|
||||||
Vector<ExtResource> external_resources;
|
Vector<ExtResource> external_resources;
|
||||||
|
|
||||||
struct IntResource {
|
struct IntResource {
|
||||||
@ -77,9 +77,9 @@ class ResourceLoaderBinary {
|
|||||||
void _advance_padding(uint32_t p_len);
|
void _advance_padding(uint32_t p_len);
|
||||||
|
|
||||||
Map<String, String> remaps;
|
Map<String, String> remaps;
|
||||||
Error error;
|
Error error = OK;
|
||||||
|
|
||||||
bool use_nocache;
|
bool use_nocache = false;
|
||||||
|
|
||||||
friend class ResourceFormatLoaderBinary;
|
friend class ResourceFormatLoaderBinary;
|
||||||
|
|
||||||
@ -98,7 +98,7 @@ public:
|
|||||||
String recognize(FileAccess *p_f);
|
String recognize(FileAccess *p_f);
|
||||||
void get_dependencies(FileAccess *p_f, List<String> *p_dependencies, bool p_add_types);
|
void get_dependencies(FileAccess *p_f, List<String> *p_dependencies, bool p_add_types);
|
||||||
|
|
||||||
ResourceLoaderBinary();
|
ResourceLoaderBinary() {}
|
||||||
~ResourceLoaderBinary();
|
~ResourceLoaderBinary();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -33,7 +33,6 @@
|
|||||||
#include "core/io/resource_importer.h"
|
#include "core/io/resource_importer.h"
|
||||||
#include "core/os/file_access.h"
|
#include "core/os/file_access.h"
|
||||||
#include "core/os/os.h"
|
#include "core/os/os.h"
|
||||||
#include "core/path_remap.h"
|
|
||||||
#include "core/print_string.h"
|
#include "core/print_string.h"
|
||||||
#include "core/project_settings.h"
|
#include "core/project_settings.h"
|
||||||
#include "core/translation.h"
|
#include "core/translation.h"
|
||||||
|
@ -536,8 +536,3 @@ Ref<StreamPeerBuffer> StreamPeerBuffer::duplicate() const {
|
|||||||
spb->data = data;
|
spb->data = data;
|
||||||
return spb;
|
return spb;
|
||||||
}
|
}
|
||||||
|
|
||||||
StreamPeerBuffer::StreamPeerBuffer() {
|
|
||||||
|
|
||||||
pointer = 0;
|
|
||||||
}
|
|
||||||
|
@ -47,7 +47,7 @@ protected:
|
|||||||
Array _get_data(int p_bytes);
|
Array _get_data(int p_bytes);
|
||||||
Array _get_partial_data(int p_bytes);
|
Array _get_partial_data(int p_bytes);
|
||||||
|
|
||||||
bool big_endian;
|
bool big_endian = false;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual Error put_data(const uint8_t *p_data, int p_bytes) = 0; ///< put a whole chunk of data, blocking until it sent
|
virtual Error put_data(const uint8_t *p_data, int p_bytes) = 0; ///< put a whole chunk of data, blocking until it sent
|
||||||
@ -89,7 +89,7 @@ public:
|
|||||||
String get_utf8_string(int p_bytes = -1);
|
String get_utf8_string(int p_bytes = -1);
|
||||||
Variant get_var(bool p_allow_objects = false);
|
Variant get_var(bool p_allow_objects = false);
|
||||||
|
|
||||||
StreamPeer() { big_endian = false; }
|
StreamPeer() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
class StreamPeerBuffer : public StreamPeer {
|
class StreamPeerBuffer : public StreamPeer {
|
||||||
@ -97,7 +97,7 @@ class StreamPeerBuffer : public StreamPeer {
|
|||||||
GDCLASS(StreamPeerBuffer, StreamPeer);
|
GDCLASS(StreamPeerBuffer, StreamPeer);
|
||||||
|
|
||||||
Vector<uint8_t> data;
|
Vector<uint8_t> data;
|
||||||
int pointer;
|
int pointer = 0;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
static void _bind_methods();
|
static void _bind_methods();
|
||||||
@ -123,7 +123,7 @@ public:
|
|||||||
|
|
||||||
Ref<StreamPeerBuffer> duplicate() const;
|
Ref<StreamPeerBuffer> duplicate() const;
|
||||||
|
|
||||||
StreamPeerBuffer();
|
StreamPeerBuffer() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // STREAM_PEER_H
|
#endif // STREAM_PEER_H
|
||||||
|
@ -73,7 +73,3 @@ void StreamPeerSSL::_bind_methods() {
|
|||||||
BIND_ENUM_CONSTANT(STATUS_ERROR);
|
BIND_ENUM_CONSTANT(STATUS_ERROR);
|
||||||
BIND_ENUM_CONSTANT(STATUS_ERROR_HOSTNAME_MISMATCH);
|
BIND_ENUM_CONSTANT(STATUS_ERROR_HOSTNAME_MISMATCH);
|
||||||
}
|
}
|
||||||
|
|
||||||
StreamPeerSSL::StreamPeerSSL() {
|
|
||||||
blocking_handshake = true;
|
|
||||||
}
|
|
||||||
|
@ -43,7 +43,7 @@ protected:
|
|||||||
|
|
||||||
static bool available;
|
static bool available;
|
||||||
|
|
||||||
bool blocking_handshake;
|
bool blocking_handshake = true;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum Status {
|
enum Status {
|
||||||
@ -68,7 +68,7 @@ public:
|
|||||||
|
|
||||||
static bool is_available();
|
static bool is_available();
|
||||||
|
|
||||||
StreamPeerSSL();
|
StreamPeerSSL() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
VARIANT_ENUM_CAST(StreamPeerSSL::Status);
|
VARIANT_ENUM_CAST(StreamPeerSSL::Status);
|
||||||
|
@ -362,10 +362,7 @@ void StreamPeerTCP::_bind_methods() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
StreamPeerTCP::StreamPeerTCP() :
|
StreamPeerTCP::StreamPeerTCP() :
|
||||||
_sock(Ref<NetSocket>(NetSocket::create())),
|
_sock(Ref<NetSocket>(NetSocket::create())) {
|
||||||
timeout(0),
|
|
||||||
status(STATUS_NONE),
|
|
||||||
peer_port(0) {
|
|
||||||
}
|
}
|
||||||
|
|
||||||
StreamPeerTCP::~StreamPeerTCP() {
|
StreamPeerTCP::~StreamPeerTCP() {
|
||||||
|
@ -52,10 +52,10 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
Ref<NetSocket> _sock;
|
Ref<NetSocket> _sock;
|
||||||
uint64_t timeout;
|
uint64_t timeout = 0;
|
||||||
Status status;
|
Status status = STATUS_NONE;
|
||||||
IP_Address peer_host;
|
IP_Address peer_host;
|
||||||
uint16_t peer_port;
|
uint16_t peer_port = 0;
|
||||||
|
|
||||||
Error _connect(const String &p_address, int p_port);
|
Error _connect(const String &p_address, int p_port);
|
||||||
Error _poll_connection();
|
Error _poll_connection();
|
||||||
|
@ -212,6 +212,3 @@ String TranslationLoaderPO::get_resource_type(const String &p_path) const {
|
|||||||
return "Translation";
|
return "Translation";
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
TranslationLoaderPO::TranslationLoaderPO() {
|
|
||||||
}
|
|
||||||
|
@ -43,7 +43,7 @@ public:
|
|||||||
virtual bool handles_type(const String &p_type) const;
|
virtual bool handles_type(const String &p_type) const;
|
||||||
virtual String get_resource_type(const String &p_path) const;
|
virtual String get_resource_type(const String &p_path) const;
|
||||||
|
|
||||||
TranslationLoaderPO();
|
TranslationLoaderPO() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // TRANSLATION_LOADER_PO_H
|
#endif // TRANSLATION_LOADER_PO_H
|
||||||
|
@ -543,9 +543,6 @@ int XMLParser::get_current_line() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
XMLParser::XMLParser() {
|
XMLParser::XMLParser() {
|
||||||
|
|
||||||
data = nullptr;
|
|
||||||
close();
|
|
||||||
special_characters.push_back("&");
|
special_characters.push_back("&");
|
||||||
special_characters.push_back("<lt;");
|
special_characters.push_back("<lt;");
|
||||||
special_characters.push_back(">gt;");
|
special_characters.push_back(">gt;");
|
||||||
|
@ -66,15 +66,15 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
char *data;
|
char *data = nullptr;
|
||||||
char *P;
|
char *P = nullptr;
|
||||||
uint64_t length;
|
uint64_t length = 0;
|
||||||
void unescape(String &p_str);
|
void unescape(String &p_str);
|
||||||
Vector<String> special_characters;
|
Vector<String> special_characters;
|
||||||
String node_name;
|
String node_name;
|
||||||
bool node_empty;
|
bool node_empty = false;
|
||||||
NodeType node_type;
|
NodeType node_type = NODE_NONE;
|
||||||
uint64_t node_offset;
|
uint64_t node_offset = 0;
|
||||||
|
|
||||||
struct Attribute {
|
struct Attribute {
|
||||||
String name;
|
String name;
|
||||||
|
20
core/list.h
20
core/list.h
@ -54,9 +54,9 @@ public:
|
|||||||
friend class List<T, A>;
|
friend class List<T, A>;
|
||||||
|
|
||||||
T value;
|
T value;
|
||||||
Element *next_ptr;
|
Element *next_ptr = nullptr;
|
||||||
Element *prev_ptr;
|
Element *prev_ptr = nullptr;
|
||||||
_Data *data;
|
_Data *data = nullptr;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
@ -139,11 +139,7 @@ public:
|
|||||||
data->erase(this);
|
data->erase(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
_FORCE_INLINE_ Element() {
|
_FORCE_INLINE_ Element() {}
|
||||||
next_ptr = 0;
|
|
||||||
prev_ptr = 0;
|
|
||||||
data = nullptr;
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -178,7 +174,7 @@ private:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
_Data *_data;
|
_Data *_data = nullptr;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
@ -687,7 +683,6 @@ public:
|
|||||||
*/
|
*/
|
||||||
List(const List &p_list) {
|
List(const List &p_list) {
|
||||||
|
|
||||||
_data = nullptr;
|
|
||||||
const Element *it = p_list.front();
|
const Element *it = p_list.front();
|
||||||
while (it) {
|
while (it) {
|
||||||
|
|
||||||
@ -696,9 +691,8 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
List() {
|
List() {}
|
||||||
_data = nullptr;
|
|
||||||
};
|
|
||||||
~List() {
|
~List() {
|
||||||
clear();
|
clear();
|
||||||
if (_data) {
|
if (_data) {
|
||||||
|
30
core/map.h
30
core/map.h
@ -51,12 +51,12 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
friend class Map<K, V, C, A>;
|
friend class Map<K, V, C, A>;
|
||||||
int color;
|
int color = RED;
|
||||||
Element *right;
|
Element *right = nullptr;
|
||||||
Element *left;
|
Element *left = nullptr;
|
||||||
Element *parent;
|
Element *parent = nullptr;
|
||||||
Element *_next;
|
Element *_next = nullptr;
|
||||||
Element *_prev;
|
Element *_prev = nullptr;
|
||||||
K _key;
|
K _key;
|
||||||
V _value;
|
V _value;
|
||||||
//_Data *data;
|
//_Data *data;
|
||||||
@ -93,22 +93,15 @@ public:
|
|||||||
const V &get() const {
|
const V &get() const {
|
||||||
return _value;
|
return _value;
|
||||||
};
|
};
|
||||||
Element() {
|
Element() {}
|
||||||
color = RED;
|
|
||||||
right = nullptr;
|
|
||||||
left = nullptr;
|
|
||||||
parent = nullptr;
|
|
||||||
_next = nullptr;
|
|
||||||
_prev = nullptr;
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
struct _Data {
|
struct _Data {
|
||||||
|
|
||||||
Element *_root;
|
Element *_root = nullptr;
|
||||||
Element *_nil;
|
Element *_nil;
|
||||||
int size_cache;
|
int size_cache = 0;
|
||||||
|
|
||||||
_FORCE_INLINE_ _Data() {
|
_FORCE_INLINE_ _Data() {
|
||||||
#ifdef GLOBALNIL_DISABLED
|
#ifdef GLOBALNIL_DISABLED
|
||||||
@ -118,8 +111,6 @@ private:
|
|||||||
#else
|
#else
|
||||||
_nil = (Element *)&_GlobalNilClass::_nil;
|
_nil = (Element *)&_GlobalNilClass::_nil;
|
||||||
#endif
|
#endif
|
||||||
_root = nullptr;
|
|
||||||
size_cache = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void _create_root() {
|
void _create_root() {
|
||||||
@ -673,8 +664,7 @@ public:
|
|||||||
_copy_from(p_map);
|
_copy_from(p_map);
|
||||||
}
|
}
|
||||||
|
|
||||||
_FORCE_INLINE_ Map() {
|
_FORCE_INLINE_ Map() {}
|
||||||
}
|
|
||||||
|
|
||||||
~Map() {
|
~Map() {
|
||||||
|
|
||||||
|
@ -585,11 +585,6 @@ void AStar::_bind_methods() {
|
|||||||
BIND_VMETHOD(MethodInfo(Variant::FLOAT, "_compute_cost", PropertyInfo(Variant::INT, "from_id"), PropertyInfo(Variant::INT, "to_id")));
|
BIND_VMETHOD(MethodInfo(Variant::FLOAT, "_compute_cost", PropertyInfo(Variant::INT, "from_id"), PropertyInfo(Variant::INT, "to_id")));
|
||||||
}
|
}
|
||||||
|
|
||||||
AStar::AStar() {
|
|
||||||
last_free_id = 0;
|
|
||||||
pass = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
AStar::~AStar() {
|
AStar::~AStar() {
|
||||||
clear();
|
clear();
|
||||||
}
|
}
|
||||||
@ -910,9 +905,3 @@ void AStar2D::_bind_methods() {
|
|||||||
BIND_VMETHOD(MethodInfo(Variant::FLOAT, "_estimate_cost", PropertyInfo(Variant::INT, "from_id"), PropertyInfo(Variant::INT, "to_id")));
|
BIND_VMETHOD(MethodInfo(Variant::FLOAT, "_estimate_cost", PropertyInfo(Variant::INT, "from_id"), PropertyInfo(Variant::INT, "to_id")));
|
||||||
BIND_VMETHOD(MethodInfo(Variant::FLOAT, "_compute_cost", PropertyInfo(Variant::INT, "from_id"), PropertyInfo(Variant::INT, "to_id")));
|
BIND_VMETHOD(MethodInfo(Variant::FLOAT, "_compute_cost", PropertyInfo(Variant::INT, "from_id"), PropertyInfo(Variant::INT, "to_id")));
|
||||||
}
|
}
|
||||||
|
|
||||||
AStar2D::AStar2D() {
|
|
||||||
}
|
|
||||||
|
|
||||||
AStar2D::~AStar2D() {
|
|
||||||
}
|
|
||||||
|
@ -47,17 +47,15 @@ class AStar : public Reference {
|
|||||||
|
|
||||||
struct Point {
|
struct Point {
|
||||||
|
|
||||||
Point() :
|
Point() {}
|
||||||
neighbours(4u),
|
|
||||||
unlinked_neighbours(4u) {}
|
|
||||||
|
|
||||||
int id;
|
int id;
|
||||||
Vector3 pos;
|
Vector3 pos;
|
||||||
real_t weight_scale;
|
real_t weight_scale;
|
||||||
bool enabled;
|
bool enabled;
|
||||||
|
|
||||||
OAHashMap<int, Point *> neighbours;
|
OAHashMap<int, Point *> neighbours = 4u;
|
||||||
OAHashMap<int, Point *> unlinked_neighbours;
|
OAHashMap<int, Point *> unlinked_neighbours = 4u;
|
||||||
|
|
||||||
// Used for pathfinding.
|
// Used for pathfinding.
|
||||||
Point *prev_point;
|
Point *prev_point;
|
||||||
@ -85,7 +83,7 @@ class AStar : public Reference {
|
|||||||
int32_t u;
|
int32_t u;
|
||||||
int32_t v;
|
int32_t v;
|
||||||
};
|
};
|
||||||
uint64_t key;
|
uint64_t key = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
@ -94,13 +92,11 @@ class AStar : public Reference {
|
|||||||
BACKWARD = 2,
|
BACKWARD = 2,
|
||||||
BIDIRECTIONAL = FORWARD | BACKWARD
|
BIDIRECTIONAL = FORWARD | BACKWARD
|
||||||
};
|
};
|
||||||
unsigned char direction;
|
unsigned char direction = NONE;
|
||||||
|
|
||||||
bool operator<(const Segment &p_s) const { return key < p_s.key; }
|
bool operator<(const Segment &p_s) const { return key < p_s.key; }
|
||||||
Segment() {
|
|
||||||
key = 0;
|
Segment() {}
|
||||||
direction = NONE;
|
|
||||||
}
|
|
||||||
Segment(int p_from, int p_to) {
|
Segment(int p_from, int p_to) {
|
||||||
if (p_from < p_to) {
|
if (p_from < p_to) {
|
||||||
u = p_from;
|
u = p_from;
|
||||||
@ -114,8 +110,8 @@ class AStar : public Reference {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
int last_free_id;
|
int last_free_id = 0;
|
||||||
uint64_t pass;
|
uint64_t pass = 1;
|
||||||
|
|
||||||
OAHashMap<int, Point *> points;
|
OAHashMap<int, Point *> points;
|
||||||
Set<Segment> segments;
|
Set<Segment> segments;
|
||||||
@ -159,7 +155,7 @@ public:
|
|||||||
Vector<Vector3> get_point_path(int p_from_id, int p_to_id);
|
Vector<Vector3> get_point_path(int p_from_id, int p_to_id);
|
||||||
Vector<int> get_id_path(int p_from_id, int p_to_id);
|
Vector<int> get_id_path(int p_from_id, int p_to_id);
|
||||||
|
|
||||||
AStar();
|
AStar() {}
|
||||||
~AStar();
|
~AStar();
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -206,8 +202,8 @@ public:
|
|||||||
Vector<Vector2> get_point_path(int p_from_id, int p_to_id);
|
Vector<Vector2> get_point_path(int p_from_id, int p_to_id);
|
||||||
Vector<int> get_id_path(int p_from_id, int p_to_id);
|
Vector<int> get_id_path(int p_from_id, int p_to_id);
|
||||||
|
|
||||||
AStar2D();
|
AStar2D() {}
|
||||||
~AStar2D();
|
~AStar2D() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // A_STAR_H
|
#endif // A_STAR_H
|
||||||
|
@ -1,31 +0,0 @@
|
|||||||
/*************************************************************************/
|
|
||||||
/* audio_frame.cpp */
|
|
||||||
/*************************************************************************/
|
|
||||||
/* This file is part of: */
|
|
||||||
/* GODOT ENGINE */
|
|
||||||
/* https://godotengine.org */
|
|
||||||
/*************************************************************************/
|
|
||||||
/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */
|
|
||||||
/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */
|
|
||||||
/* */
|
|
||||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
|
||||||
/* a copy of this software and associated documentation files (the */
|
|
||||||
/* "Software"), to deal in the Software without restriction, including */
|
|
||||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
|
||||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
|
||||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
|
||||||
/* the following conditions: */
|
|
||||||
/* */
|
|
||||||
/* The above copyright notice and this permission notice shall be */
|
|
||||||
/* included in all copies or substantial portions of the Software. */
|
|
||||||
/* */
|
|
||||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
|
||||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
|
||||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
|
||||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
|
||||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
|
||||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
|
||||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
|
||||||
/*************************************************************************/
|
|
||||||
|
|
||||||
#include "audio_frame.h"
|
|
@ -36,24 +36,21 @@
|
|||||||
class Delaunay2D {
|
class Delaunay2D {
|
||||||
public:
|
public:
|
||||||
struct Triangle {
|
struct Triangle {
|
||||||
|
|
||||||
int points[3];
|
int points[3];
|
||||||
bool bad;
|
bool bad = false;
|
||||||
Triangle() { bad = false; }
|
Triangle() {}
|
||||||
Triangle(int p_a, int p_b, int p_c) {
|
Triangle(int p_a, int p_b, int p_c) {
|
||||||
points[0] = p_a;
|
points[0] = p_a;
|
||||||
points[1] = p_b;
|
points[1] = p_b;
|
||||||
points[2] = p_c;
|
points[2] = p_c;
|
||||||
bad = false;
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Edge {
|
struct Edge {
|
||||||
int edge[2];
|
int edge[2];
|
||||||
bool bad;
|
bool bad = false;
|
||||||
Edge() { bad = false; }
|
Edge() {}
|
||||||
Edge(int p_a, int p_b) {
|
Edge(int p_a, int p_b) {
|
||||||
bad = false;
|
|
||||||
edge[0] = p_a;
|
edge[0] = p_a;
|
||||||
edge[1] = p_b;
|
edge[1] = p_b;
|
||||||
}
|
}
|
||||||
|
@ -45,12 +45,12 @@ class Delaunay3D {
|
|||||||
|
|
||||||
struct Triangle {
|
struct Triangle {
|
||||||
uint32_t triangle[3];
|
uint32_t triangle[3];
|
||||||
bool bad;
|
bool bad = false;
|
||||||
_FORCE_INLINE_ bool operator==(const Triangle &p_triangle) const {
|
_FORCE_INLINE_ bool operator==(const Triangle &p_triangle) const {
|
||||||
return triangle[0] == p_triangle.triangle[0] && triangle[1] == p_triangle.triangle[1] && triangle[2] == p_triangle.triangle[2];
|
return triangle[0] == p_triangle.triangle[0] && triangle[1] == p_triangle.triangle[1] && triangle[2] == p_triangle.triangle[2];
|
||||||
}
|
}
|
||||||
|
|
||||||
_FORCE_INLINE_ Triangle() { bad = false; }
|
_FORCE_INLINE_ Triangle() {}
|
||||||
_FORCE_INLINE_ Triangle(uint32_t p_a, uint32_t p_b, uint32_t p_c) {
|
_FORCE_INLINE_ Triangle(uint32_t p_a, uint32_t p_b, uint32_t p_c) {
|
||||||
if (p_a > p_b)
|
if (p_a > p_b)
|
||||||
SWAP(p_a, p_b);
|
SWAP(p_a, p_b);
|
||||||
@ -59,7 +59,6 @@ class Delaunay3D {
|
|||||||
if (p_a > p_b)
|
if (p_a > p_b)
|
||||||
SWAP(p_a, p_b);
|
SWAP(p_a, p_b);
|
||||||
|
|
||||||
bad = false;
|
|
||||||
triangle[0] = p_a;
|
triangle[0] = p_a;
|
||||||
triangle[1] = p_b;
|
triangle[1] = p_b;
|
||||||
triangle[2] = p_c;
|
triangle[2] = p_c;
|
||||||
@ -74,9 +73,6 @@ class Delaunay3D {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct FPVal {
|
|
||||||
};
|
|
||||||
|
|
||||||
_FORCE_INLINE_ static void circum_sphere_compute(const Vector3 *p_points, Simplex *p_simplex) {
|
_FORCE_INLINE_ static void circum_sphere_compute(const Vector3 *p_points, Simplex *p_simplex) {
|
||||||
|
|
||||||
// the only part in the algorithm where there may be precision errors is this one, so ensure that
|
// the only part in the algorithm where there may be precision errors is this one, so ensure that
|
||||||
|
@ -1,31 +0,0 @@
|
|||||||
/*************************************************************************/
|
|
||||||
/* disjoint_set.cpp */
|
|
||||||
/*************************************************************************/
|
|
||||||
/* This file is part of: */
|
|
||||||
/* GODOT ENGINE */
|
|
||||||
/* https://godotengine.org */
|
|
||||||
/*************************************************************************/
|
|
||||||
/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */
|
|
||||||
/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */
|
|
||||||
/* */
|
|
||||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
|
||||||
/* a copy of this software and associated documentation files (the */
|
|
||||||
/* "Software"), to deal in the Software without restriction, including */
|
|
||||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
|
||||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
|
||||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
|
||||||
/* the following conditions: */
|
|
||||||
/* */
|
|
||||||
/* The above copyright notice and this permission notice shall be */
|
|
||||||
/* included in all copies or substantial portions of the Software. */
|
|
||||||
/* */
|
|
||||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
|
||||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
|
||||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
|
||||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
|
||||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
|
||||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
|
||||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
|
||||||
/*************************************************************************/
|
|
||||||
|
|
||||||
#include "disjoint_set.h"
|
|
@ -2298,17 +2298,6 @@ void Expression::_bind_methods() {
|
|||||||
ClassDB::bind_method(D_METHOD("get_error_text"), &Expression::get_error_text);
|
ClassDB::bind_method(D_METHOD("get_error_text"), &Expression::get_error_text);
|
||||||
}
|
}
|
||||||
|
|
||||||
Expression::Expression() :
|
|
||||||
output_type(Variant::NIL),
|
|
||||||
sequenced(false),
|
|
||||||
error_set(true),
|
|
||||||
root(nullptr),
|
|
||||||
nodes(nullptr),
|
|
||||||
execution_error(false) {
|
|
||||||
str_ofs = 0;
|
|
||||||
expression_dirty = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
Expression::~Expression() {
|
Expression::~Expression() {
|
||||||
|
|
||||||
if (nodes) {
|
if (nodes) {
|
||||||
|
@ -119,22 +119,20 @@ private:
|
|||||||
|
|
||||||
struct Input {
|
struct Input {
|
||||||
|
|
||||||
Variant::Type type;
|
Variant::Type type = Variant::NIL;
|
||||||
String name;
|
String name;
|
||||||
|
|
||||||
Input() :
|
Input() {}
|
||||||
type(Variant::NIL) {
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
Vector<Input> inputs;
|
Vector<Input> inputs;
|
||||||
Variant::Type output_type;
|
Variant::Type output_type = Variant::NIL;
|
||||||
|
|
||||||
String expression;
|
String expression;
|
||||||
|
|
||||||
bool sequenced;
|
bool sequenced = false;
|
||||||
int str_ofs;
|
int str_ofs = 0;
|
||||||
bool expression_dirty;
|
bool expression_dirty = false;
|
||||||
|
|
||||||
bool _compile_expression();
|
bool _compile_expression();
|
||||||
|
|
||||||
@ -197,7 +195,7 @@ private:
|
|||||||
Error _get_token(Token &r_token);
|
Error _get_token(Token &r_token);
|
||||||
|
|
||||||
String error_str;
|
String error_str;
|
||||||
bool error_set;
|
bool error_set = true;
|
||||||
|
|
||||||
struct ENode {
|
struct ENode {
|
||||||
|
|
||||||
@ -215,11 +213,11 @@ private:
|
|||||||
TYPE_CALL
|
TYPE_CALL
|
||||||
};
|
};
|
||||||
|
|
||||||
ENode *next;
|
ENode *next = nullptr;
|
||||||
|
|
||||||
Type type;
|
Type type;
|
||||||
|
|
||||||
ENode() { next = nullptr; }
|
ENode() {}
|
||||||
virtual ~ENode() {
|
virtual ~ENode() {
|
||||||
if (next) {
|
if (next) {
|
||||||
memdelete(next);
|
memdelete(next);
|
||||||
@ -339,12 +337,12 @@ private:
|
|||||||
return node;
|
return node;
|
||||||
}
|
}
|
||||||
|
|
||||||
ENode *root;
|
ENode *root = nullptr;
|
||||||
ENode *nodes;
|
ENode *nodes = nullptr;
|
||||||
|
|
||||||
Vector<String> input_names;
|
Vector<String> input_names;
|
||||||
|
|
||||||
bool execution_error;
|
bool execution_error = false;
|
||||||
bool _execute(const Array &p_inputs, Object *p_instance, Expression::ENode *p_node, Variant &r_ret, String &r_error_str);
|
bool _execute(const Array &p_inputs, Object *p_instance, Expression::ENode *p_node, Variant &r_ret, String &r_error_str);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@ -356,7 +354,7 @@ public:
|
|||||||
bool has_execute_failed() const;
|
bool has_execute_failed() const;
|
||||||
String get_error_text() const;
|
String get_error_text() const;
|
||||||
|
|
||||||
Expression();
|
Expression() {}
|
||||||
~Expression();
|
~Expression();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -104,25 +104,19 @@ struct _FaceClassify {
|
|||||||
|
|
||||||
struct _Link {
|
struct _Link {
|
||||||
|
|
||||||
int face;
|
int face = -1;
|
||||||
int edge;
|
int edge = -1;
|
||||||
void clear() {
|
void clear() {
|
||||||
face = -1;
|
face = -1;
|
||||||
edge = -1;
|
edge = -1;
|
||||||
}
|
}
|
||||||
_Link() {
|
_Link() {}
|
||||||
face = -1;
|
|
||||||
edge = -1;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
bool valid;
|
bool valid = false;
|
||||||
int group;
|
int group = -1;
|
||||||
_Link links[3];
|
_Link links[3];
|
||||||
Face3 face;
|
Face3 face;
|
||||||
_FaceClassify() {
|
_FaceClassify() {}
|
||||||
group = -1;
|
|
||||||
valid = false;
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static bool _connect_faces(_FaceClassify *p_faces, int len, int p_group) {
|
static bool _connect_faces(_FaceClassify *p_faces, int len, int p_group) {
|
||||||
|
@ -52,7 +52,6 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
enum {
|
enum {
|
||||||
|
|
||||||
NEG = 0,
|
NEG = 0,
|
||||||
POS = 1,
|
POS = 1,
|
||||||
};
|
};
|
||||||
@ -106,49 +105,35 @@ private:
|
|||||||
// cached for FAST plane check
|
// cached for FAST plane check
|
||||||
AABB aabb;
|
AABB aabb;
|
||||||
|
|
||||||
uint64_t last_pass;
|
uint64_t last_pass = 0;
|
||||||
Octant *parent;
|
Octant *parent = nullptr;
|
||||||
Octant *children[8];
|
Octant *children[8] = { nullptr };
|
||||||
|
|
||||||
int children_count; // cache for amount of childrens (fast check for removal)
|
int children_count = 0; // cache for amount of childrens (fast check for removal)
|
||||||
int parent_index; // cache for parent index (fast check for removal)
|
int parent_index = -1; // cache for parent index (fast check for removal)
|
||||||
|
|
||||||
List<Element *, AL> pairable_elements;
|
List<Element *, AL> pairable_elements;
|
||||||
List<Element *, AL> elements;
|
List<Element *, AL> elements;
|
||||||
|
|
||||||
Octant() {
|
Octant() {}
|
||||||
children_count = 0;
|
~Octant() {}
|
||||||
parent_index = -1;
|
|
||||||
last_pass = 0;
|
|
||||||
parent = nullptr;
|
|
||||||
for (int i = 0; i < 8; i++)
|
|
||||||
children[i] = nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
~Octant() {
|
|
||||||
|
|
||||||
/*
|
|
||||||
for (int i=0;i<8;i++)
|
|
||||||
memdelete_notnull(children[i]);
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct PairData;
|
struct PairData;
|
||||||
|
|
||||||
struct Element {
|
struct Element {
|
||||||
|
|
||||||
Octree *octree;
|
Octree *octree = nullptr;
|
||||||
|
|
||||||
T *userdata;
|
T *userdata = nullptr;
|
||||||
int subindex;
|
int subindex = 0;
|
||||||
bool pairable;
|
bool pairable = false;
|
||||||
uint32_t pairable_mask;
|
uint32_t pairable_mask = 0;
|
||||||
uint32_t pairable_type;
|
uint32_t pairable_type = 0;
|
||||||
|
|
||||||
uint64_t last_pass;
|
uint64_t last_pass = 0;
|
||||||
OctreeElementID _id;
|
OctreeElementID _id = 0;
|
||||||
Octant *common_parent;
|
Octant *common_parent = nullptr;
|
||||||
|
|
||||||
AABB aabb;
|
AABB aabb;
|
||||||
AABB container_aabb;
|
AABB container_aabb;
|
||||||
@ -163,17 +148,7 @@ private:
|
|||||||
|
|
||||||
List<OctantOwner, AL> octant_owners;
|
List<OctantOwner, AL> octant_owners;
|
||||||
|
|
||||||
Element() {
|
Element() {}
|
||||||
last_pass = 0;
|
|
||||||
_id = 0;
|
|
||||||
pairable = false;
|
|
||||||
subindex = 0;
|
|
||||||
userdata = 0;
|
|
||||||
octree = 0;
|
|
||||||
pairable_mask = 0;
|
|
||||||
pairable_type = 0;
|
|
||||||
common_parent = nullptr;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct PairData {
|
struct PairData {
|
||||||
|
@ -36,7 +36,7 @@
|
|||||||
class Plane {
|
class Plane {
|
||||||
public:
|
public:
|
||||||
Vector3 normal;
|
Vector3 normal;
|
||||||
real_t d;
|
real_t d = 0;
|
||||||
|
|
||||||
void set_normal(const Vector3 &p_normal);
|
void set_normal(const Vector3 &p_normal);
|
||||||
_FORCE_INLINE_ Vector3 get_normal() const { return normal; }; ///Point is coplanar, CMP_EPSILON for precision
|
_FORCE_INLINE_ Vector3 get_normal() const { return normal; }; ///Point is coplanar, CMP_EPSILON for precision
|
||||||
@ -75,8 +75,7 @@ public:
|
|||||||
_FORCE_INLINE_ bool operator!=(const Plane &p_plane) const;
|
_FORCE_INLINE_ bool operator!=(const Plane &p_plane) const;
|
||||||
operator String() const;
|
operator String() const;
|
||||||
|
|
||||||
_FORCE_INLINE_ Plane() :
|
_FORCE_INLINE_ Plane() {}
|
||||||
d(0) {}
|
|
||||||
_FORCE_INLINE_ Plane(real_t p_a, real_t p_b, real_t p_c, real_t p_d) :
|
_FORCE_INLINE_ Plane(real_t p_a, real_t p_b, real_t p_c, real_t p_d) :
|
||||||
normal(p_a, p_b, p_c),
|
normal(p_a, p_b, p_c),
|
||||||
d(p_d) {}
|
d(p_d) {}
|
||||||
|
@ -40,7 +40,7 @@
|
|||||||
|
|
||||||
class Quat {
|
class Quat {
|
||||||
public:
|
public:
|
||||||
real_t x, y, z, w;
|
real_t x = 0, y = 0, z = 0, w = 1;
|
||||||
|
|
||||||
_FORCE_INLINE_ real_t length_squared() const;
|
_FORCE_INLINE_ real_t length_squared() const;
|
||||||
bool is_equal_approx(const Quat &p_quat) const;
|
bool is_equal_approx(const Quat &p_quat) const;
|
||||||
@ -112,7 +112,9 @@ public:
|
|||||||
z = p_z;
|
z = p_z;
|
||||||
w = p_w;
|
w = p_w;
|
||||||
}
|
}
|
||||||
inline Quat(real_t p_x, real_t p_y, real_t p_z, real_t p_w) :
|
|
||||||
|
_FORCE_INLINE_ Quat() {}
|
||||||
|
_FORCE_INLINE_ Quat(real_t p_x, real_t p_y, real_t p_z, real_t p_w) :
|
||||||
x(p_x),
|
x(p_x),
|
||||||
y(p_y),
|
y(p_y),
|
||||||
z(p_z),
|
z(p_z),
|
||||||
@ -157,13 +159,6 @@ public:
|
|||||||
w = s * 0.5;
|
w = s * 0.5;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
inline Quat() :
|
|
||||||
x(0),
|
|
||||||
y(0),
|
|
||||||
z(0),
|
|
||||||
w(1) {
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
real_t Quat::dot(const Quat &q) const {
|
real_t Quat::dot(const Quat &q) const {
|
||||||
|
@ -75,18 +75,12 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
struct FaceConnect {
|
struct FaceConnect {
|
||||||
List<Face>::Element *left, *right;
|
List<Face>::Element *left, *right = nullptr;
|
||||||
FaceConnect() {
|
FaceConnect() {}
|
||||||
left = nullptr;
|
|
||||||
right = nullptr;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
struct RetFaceConnect {
|
struct RetFaceConnect {
|
||||||
List<Geometry::MeshData::Face>::Element *left, *right;
|
List<Geometry::MeshData::Face>::Element *left, *right = nullptr;
|
||||||
RetFaceConnect() {
|
RetFaceConnect() {}
|
||||||
left = nullptr;
|
|
||||||
right = nullptr;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -30,8 +30,6 @@
|
|||||||
|
|
||||||
#include "random_number_generator.h"
|
#include "random_number_generator.h"
|
||||||
|
|
||||||
RandomNumberGenerator::RandomNumberGenerator() {}
|
|
||||||
|
|
||||||
void RandomNumberGenerator::_bind_methods() {
|
void RandomNumberGenerator::_bind_methods() {
|
||||||
ClassDB::bind_method(D_METHOD("set_seed", "seed"), &RandomNumberGenerator::set_seed);
|
ClassDB::bind_method(D_METHOD("set_seed", "seed"), &RandomNumberGenerator::set_seed);
|
||||||
ClassDB::bind_method(D_METHOD("get_seed"), &RandomNumberGenerator::get_seed);
|
ClassDB::bind_method(D_METHOD("get_seed"), &RandomNumberGenerator::get_seed);
|
||||||
|
@ -65,7 +65,7 @@ public:
|
|||||||
return ret % (to - from + 1) + from;
|
return ret % (to - from + 1) + from;
|
||||||
}
|
}
|
||||||
|
|
||||||
RandomNumberGenerator();
|
RandomNumberGenerator() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // RANDOM_NUMBER_GENERATOR_H
|
#endif // RANDOM_NUMBER_GENERATOR_H
|
||||||
|
@ -393,11 +393,12 @@ struct Rect2i {
|
|||||||
operator String() const { return String(position) + ", " + String(size); }
|
operator String() const { return String(position) + ", " + String(size); }
|
||||||
|
|
||||||
operator Rect2() const { return Rect2(position, size); }
|
operator Rect2() const { return Rect2(position, size); }
|
||||||
|
|
||||||
|
Rect2i() {}
|
||||||
Rect2i(const Rect2 &p_r2) :
|
Rect2i(const Rect2 &p_r2) :
|
||||||
position(p_r2.position),
|
position(p_r2.position),
|
||||||
size(p_r2.size) {
|
size(p_r2.size) {
|
||||||
}
|
}
|
||||||
Rect2i() {}
|
|
||||||
Rect2i(int p_x, int p_y, int p_width, int p_height) :
|
Rect2i(int p_x, int p_y, int p_width, int p_height) :
|
||||||
position(Point2(p_x, p_y)),
|
position(Point2(p_x, p_y)),
|
||||||
size(Size2(p_width, p_height)) {
|
size(Size2(p_width, p_height)) {
|
||||||
|
@ -44,11 +44,11 @@ struct Vector2 {
|
|||||||
};
|
};
|
||||||
|
|
||||||
union {
|
union {
|
||||||
real_t x;
|
real_t x = 0;
|
||||||
real_t width;
|
real_t width;
|
||||||
};
|
};
|
||||||
union {
|
union {
|
||||||
real_t y;
|
real_t y = 0;
|
||||||
real_t height;
|
real_t height;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -142,11 +142,11 @@ struct Vector2 {
|
|||||||
|
|
||||||
operator String() const { return String::num(x) + ", " + String::num(y); }
|
operator String() const { return String::num(x) + ", " + String::num(y); }
|
||||||
|
|
||||||
|
_FORCE_INLINE_ Vector2() {}
|
||||||
_FORCE_INLINE_ Vector2(real_t p_x, real_t p_y) {
|
_FORCE_INLINE_ Vector2(real_t p_x, real_t p_y) {
|
||||||
x = p_x;
|
x = p_x;
|
||||||
y = p_y;
|
y = p_y;
|
||||||
}
|
}
|
||||||
_FORCE_INLINE_ Vector2() { x = y = 0; }
|
|
||||||
};
|
};
|
||||||
|
|
||||||
_FORCE_INLINE_ Vector2 Vector2::plane_project(real_t p_d, const Vector2 &p_vec) const {
|
_FORCE_INLINE_ Vector2 Vector2::plane_project(real_t p_d, const Vector2 &p_vec) const {
|
||||||
@ -260,11 +260,11 @@ struct Vector2i {
|
|||||||
};
|
};
|
||||||
|
|
||||||
union {
|
union {
|
||||||
int x;
|
int x = 0;
|
||||||
int width;
|
int width;
|
||||||
};
|
};
|
||||||
union {
|
union {
|
||||||
int y;
|
int y = 0;
|
||||||
int height;
|
int height;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -307,6 +307,8 @@ struct Vector2i {
|
|||||||
operator String() const { return String::num(x) + ", " + String::num(y); }
|
operator String() const { return String::num(x) + ", " + String::num(y); }
|
||||||
|
|
||||||
operator Vector2() const { return Vector2(x, y); }
|
operator Vector2() const { return Vector2(x, y); }
|
||||||
|
|
||||||
|
inline Vector2i() {}
|
||||||
inline Vector2i(const Vector2 &p_vec2) {
|
inline Vector2i(const Vector2 &p_vec2) {
|
||||||
x = (int)p_vec2.x;
|
x = (int)p_vec2.x;
|
||||||
y = (int)p_vec2.y;
|
y = (int)p_vec2.y;
|
||||||
@ -315,10 +317,6 @@ struct Vector2i {
|
|||||||
x = p_x;
|
x = p_x;
|
||||||
y = p_y;
|
y = p_y;
|
||||||
}
|
}
|
||||||
inline Vector2i() {
|
|
||||||
x = 0;
|
|
||||||
y = 0;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef Vector2i Size2i;
|
typedef Vector2i Size2i;
|
||||||
|
@ -52,7 +52,7 @@ struct Vector3 {
|
|||||||
real_t z;
|
real_t z;
|
||||||
};
|
};
|
||||||
|
|
||||||
real_t coord[3];
|
real_t coord[3] = { 0 };
|
||||||
};
|
};
|
||||||
|
|
||||||
_FORCE_INLINE_ const real_t &operator[](int p_axis) const {
|
_FORCE_INLINE_ const real_t &operator[](int p_axis) const {
|
||||||
@ -152,18 +152,17 @@ struct Vector3 {
|
|||||||
return Vector3i(x, y, z);
|
return Vector3i(x, y, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_FORCE_INLINE_ Vector3() {}
|
||||||
_FORCE_INLINE_ Vector3(const Vector3i &p_ivec) {
|
_FORCE_INLINE_ Vector3(const Vector3i &p_ivec) {
|
||||||
x = p_ivec.x;
|
x = p_ivec.x;
|
||||||
y = p_ivec.y;
|
y = p_ivec.y;
|
||||||
z = p_ivec.z;
|
z = p_ivec.z;
|
||||||
}
|
}
|
||||||
|
|
||||||
_FORCE_INLINE_ Vector3(real_t p_x, real_t p_y, real_t p_z) {
|
_FORCE_INLINE_ Vector3(real_t p_x, real_t p_y, real_t p_z) {
|
||||||
x = p_x;
|
x = p_x;
|
||||||
y = p_y;
|
y = p_y;
|
||||||
z = p_z;
|
z = p_z;
|
||||||
}
|
}
|
||||||
_FORCE_INLINE_ Vector3() { x = y = z = 0; }
|
|
||||||
};
|
};
|
||||||
|
|
||||||
Vector3 Vector3::cross(const Vector3 &p_b) const {
|
Vector3 Vector3::cross(const Vector3 &p_b) const {
|
||||||
|
@ -49,7 +49,7 @@ struct Vector3i {
|
|||||||
int32_t z;
|
int32_t z;
|
||||||
};
|
};
|
||||||
|
|
||||||
int32_t coord[3];
|
int32_t coord[3] = { 0 };
|
||||||
};
|
};
|
||||||
|
|
||||||
_FORCE_INLINE_ const int32_t &operator[](int p_axis) const {
|
_FORCE_INLINE_ const int32_t &operator[](int p_axis) const {
|
||||||
@ -100,12 +100,12 @@ struct Vector3i {
|
|||||||
|
|
||||||
operator String() const;
|
operator String() const;
|
||||||
|
|
||||||
|
_FORCE_INLINE_ Vector3i() {}
|
||||||
_FORCE_INLINE_ Vector3i(int32_t p_x, int32_t p_y, int32_t p_z) {
|
_FORCE_INLINE_ Vector3i(int32_t p_x, int32_t p_y, int32_t p_z) {
|
||||||
x = p_x;
|
x = p_x;
|
||||||
y = p_y;
|
y = p_y;
|
||||||
z = p_z;
|
z = p_z;
|
||||||
}
|
}
|
||||||
_FORCE_INLINE_ Vector3i() { x = y = z = 0; }
|
|
||||||
};
|
};
|
||||||
|
|
||||||
Vector3i Vector3i::abs() const {
|
Vector3i Vector3i::abs() const {
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user