summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/bind/core_bind.cpp140
-rw-r--r--core/bind/core_bind.h16
-rw-r--r--core/class_db.cpp83
-rw-r--r--core/class_db.h29
-rw-r--r--core/command_queue_mt.cpp2
-rw-r--r--core/command_queue_mt.h63
-rw-r--r--core/engine.cpp1
-rw-r--r--core/engine.h14
-rw-r--r--core/global_constants.cpp1011
-rw-r--r--core/global_constants.h3
-rw-r--r--core/image.cpp118
-rw-r--r--core/io/file_access_buffered.cpp12
-rw-r--r--core/io/file_access_buffered.h2
-rw-r--r--core/io/file_access_compressed.cpp20
-rw-r--r--core/io/file_access_memory.h2
-rw-r--r--core/io/file_access_zip.cpp12
-rw-r--r--core/io/http_client.cpp140
-rw-r--r--core/io/http_client.h1
-rw-r--r--core/io/image_loader.cpp4
-rw-r--r--core/io/image_loader.h4
-rw-r--r--core/io/ip.cpp16
-rw-r--r--core/io/ip_address.h2
-rw-r--r--core/io/json.cpp60
-rw-r--r--core/io/marshalls.cpp256
-rw-r--r--core/io/marshalls.h21
-rw-r--r--core/io/networked_multiplayer_peer.cpp12
-rw-r--r--core/io/packet_peer.cpp36
-rw-r--r--core/io/packet_peer.h7
-rw-r--r--core/io/packet_peer_udp.h2
-rw-r--r--core/io/resource_import.cpp46
-rw-r--r--core/io/resource_import.h1
-rw-r--r--core/io/stream_peer.cpp5
-rw-r--r--core/io/stream_peer_ssl.cpp9
-rw-r--r--core/io/stream_peer_tcp.cpp8
-rw-r--r--core/io/tcp_server.h2
-rw-r--r--core/io/xml_parser.cpp14
-rw-r--r--core/math/geometry.cpp4
-rw-r--r--core/math/math_2d.cpp16
-rw-r--r--core/math/math_2d.h40
-rw-r--r--core/math/math_funcs.h10
-rw-r--r--core/math/matrix3.cpp17
-rw-r--r--core/math/octree.h12
-rw-r--r--core/math/plane.cpp4
-rw-r--r--core/math/plane.h4
-rw-r--r--core/math/rect3.h46
-rw-r--r--core/math/vector3.h22
-rw-r--r--core/method_bind.h27
-rw-r--r--core/method_ptrcall.h57
-rw-r--r--core/object.cpp18
-rw-r--r--core/object.h6
-rw-r--r--core/os/file_access.cpp4
-rw-r--r--core/os/file_access.h2
-rw-r--r--core/os/input.cpp8
-rw-r--r--core/os/input_event.cpp5
-rw-r--r--core/os/input_event.h1
-rw-r--r--core/os/keyboard.h2
-rw-r--r--core/pair.h2
-rw-r--r--core/project_settings.h2
-rw-r--r--core/reference.h7
-rw-r--r--core/register_core_types.cpp7
-rw-r--r--core/resource.h2
-rw-r--r--core/script_debugger_remote.cpp98
-rw-r--r--core/script_debugger_remote.h2
-rw-r--r--core/simple_type.h74
-rw-r--r--core/type_info.h63
-rw-r--r--core/typedefs.h21
-rw-r--r--core/undo_redo.cpp6
-rw-r--r--core/ustring.cpp6
-rw-r--r--core/ustring.h8
-rw-r--r--core/variant_call.cpp4
-rw-r--r--core/variant_construct_string.cpp62
-rw-r--r--core/vector.h12
72 files changed, 1686 insertions, 1169 deletions
diff --git a/core/bind/core_bind.cpp b/core/bind/core_bind.cpp
index 273ef78669..a547ead5a1 100644
--- a/core/bind/core_bind.cpp
+++ b/core/bind/core_bind.cpp
@@ -151,12 +151,12 @@ void _ResourceSaver::_bind_methods() {
ClassDB::bind_method(D_METHOD("save", "path", "resource", "flags"), &_ResourceSaver::save, DEFVAL(0));
ClassDB::bind_method(D_METHOD("get_recognized_extensions", "type"), &_ResourceSaver::get_recognized_extensions);
- BIND_CONSTANT(FLAG_RELATIVE_PATHS);
- BIND_CONSTANT(FLAG_BUNDLE_RESOURCES);
- BIND_CONSTANT(FLAG_CHANGE_PATH);
- BIND_CONSTANT(FLAG_OMIT_EDITOR_PROPERTIES);
- BIND_CONSTANT(FLAG_SAVE_BIG_ENDIAN);
- BIND_CONSTANT(FLAG_COMPRESS);
+ BIND_ENUM_CONSTANT(FLAG_RELATIVE_PATHS);
+ BIND_ENUM_CONSTANT(FLAG_BUNDLE_RESOURCES);
+ BIND_ENUM_CONSTANT(FLAG_CHANGE_PATH);
+ BIND_ENUM_CONSTANT(FLAG_OMIT_EDITOR_PROPERTIES);
+ BIND_ENUM_CONSTANT(FLAG_SAVE_BIG_ENDIAN);
+ BIND_ENUM_CONSTANT(FLAG_COMPRESS);
}
_ResourceSaver::_ResourceSaver() {
@@ -1104,49 +1104,49 @@ void _OS::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_power_seconds_left"), &_OS::get_power_seconds_left);
ClassDB::bind_method(D_METHOD("get_power_percent_left"), &_OS::get_power_percent_left);
- BIND_CONSTANT(DAY_SUNDAY);
- BIND_CONSTANT(DAY_MONDAY);
- BIND_CONSTANT(DAY_TUESDAY);
- BIND_CONSTANT(DAY_WEDNESDAY);
- BIND_CONSTANT(DAY_THURSDAY);
- BIND_CONSTANT(DAY_FRIDAY);
- BIND_CONSTANT(DAY_SATURDAY);
-
- BIND_CONSTANT(MONTH_JANUARY);
- BIND_CONSTANT(MONTH_FEBRUARY);
- BIND_CONSTANT(MONTH_MARCH);
- BIND_CONSTANT(MONTH_APRIL);
- BIND_CONSTANT(MONTH_MAY);
- BIND_CONSTANT(MONTH_JUNE);
- BIND_CONSTANT(MONTH_JULY);
- BIND_CONSTANT(MONTH_AUGUST);
- BIND_CONSTANT(MONTH_SEPTEMBER);
- BIND_CONSTANT(MONTH_OCTOBER);
- BIND_CONSTANT(MONTH_NOVEMBER);
- BIND_CONSTANT(MONTH_DECEMBER);
-
- BIND_CONSTANT(SCREEN_ORIENTATION_LANDSCAPE);
- BIND_CONSTANT(SCREEN_ORIENTATION_PORTRAIT);
- BIND_CONSTANT(SCREEN_ORIENTATION_REVERSE_LANDSCAPE);
- BIND_CONSTANT(SCREEN_ORIENTATION_REVERSE_PORTRAIT);
- BIND_CONSTANT(SCREEN_ORIENTATION_SENSOR_LANDSCAPE);
- BIND_CONSTANT(SCREEN_ORIENTATION_SENSOR_PORTRAIT);
- BIND_CONSTANT(SCREEN_ORIENTATION_SENSOR);
-
- BIND_CONSTANT(SYSTEM_DIR_DESKTOP);
- BIND_CONSTANT(SYSTEM_DIR_DCIM);
- BIND_CONSTANT(SYSTEM_DIR_DOCUMENTS);
- BIND_CONSTANT(SYSTEM_DIR_DOWNLOADS);
- BIND_CONSTANT(SYSTEM_DIR_MOVIES);
- BIND_CONSTANT(SYSTEM_DIR_MUSIC);
- BIND_CONSTANT(SYSTEM_DIR_PICTURES);
- BIND_CONSTANT(SYSTEM_DIR_RINGTONES);
-
- BIND_CONSTANT(POWERSTATE_UNKNOWN);
- BIND_CONSTANT(POWERSTATE_ON_BATTERY);
- BIND_CONSTANT(POWERSTATE_NO_BATTERY);
- BIND_CONSTANT(POWERSTATE_CHARGING);
- BIND_CONSTANT(POWERSTATE_CHARGED);
+ BIND_ENUM_CONSTANT(DAY_SUNDAY);
+ BIND_ENUM_CONSTANT(DAY_MONDAY);
+ BIND_ENUM_CONSTANT(DAY_TUESDAY);
+ BIND_ENUM_CONSTANT(DAY_WEDNESDAY);
+ BIND_ENUM_CONSTANT(DAY_THURSDAY);
+ BIND_ENUM_CONSTANT(DAY_FRIDAY);
+ BIND_ENUM_CONSTANT(DAY_SATURDAY);
+
+ BIND_ENUM_CONSTANT(MONTH_JANUARY);
+ BIND_ENUM_CONSTANT(MONTH_FEBRUARY);
+ BIND_ENUM_CONSTANT(MONTH_MARCH);
+ BIND_ENUM_CONSTANT(MONTH_APRIL);
+ BIND_ENUM_CONSTANT(MONTH_MAY);
+ BIND_ENUM_CONSTANT(MONTH_JUNE);
+ BIND_ENUM_CONSTANT(MONTH_JULY);
+ BIND_ENUM_CONSTANT(MONTH_AUGUST);
+ BIND_ENUM_CONSTANT(MONTH_SEPTEMBER);
+ BIND_ENUM_CONSTANT(MONTH_OCTOBER);
+ BIND_ENUM_CONSTANT(MONTH_NOVEMBER);
+ BIND_ENUM_CONSTANT(MONTH_DECEMBER);
+
+ BIND_ENUM_CONSTANT(SCREEN_ORIENTATION_LANDSCAPE);
+ BIND_ENUM_CONSTANT(SCREEN_ORIENTATION_PORTRAIT);
+ BIND_ENUM_CONSTANT(SCREEN_ORIENTATION_REVERSE_LANDSCAPE);
+ BIND_ENUM_CONSTANT(SCREEN_ORIENTATION_REVERSE_PORTRAIT);
+ BIND_ENUM_CONSTANT(SCREEN_ORIENTATION_SENSOR_LANDSCAPE);
+ BIND_ENUM_CONSTANT(SCREEN_ORIENTATION_SENSOR_PORTRAIT);
+ BIND_ENUM_CONSTANT(SCREEN_ORIENTATION_SENSOR);
+
+ BIND_ENUM_CONSTANT(SYSTEM_DIR_DESKTOP);
+ BIND_ENUM_CONSTANT(SYSTEM_DIR_DCIM);
+ BIND_ENUM_CONSTANT(SYSTEM_DIR_DOCUMENTS);
+ BIND_ENUM_CONSTANT(SYSTEM_DIR_DOWNLOADS);
+ BIND_ENUM_CONSTANT(SYSTEM_DIR_MOVIES);
+ BIND_ENUM_CONSTANT(SYSTEM_DIR_MUSIC);
+ BIND_ENUM_CONSTANT(SYSTEM_DIR_PICTURES);
+ BIND_ENUM_CONSTANT(SYSTEM_DIR_RINGTONES);
+
+ BIND_ENUM_CONSTANT(POWERSTATE_UNKNOWN);
+ BIND_ENUM_CONSTANT(POWERSTATE_ON_BATTERY);
+ BIND_ENUM_CONSTANT(POWERSTATE_NO_BATTERY);
+ BIND_ENUM_CONSTANT(POWERSTATE_CHARGING);
+ BIND_ENUM_CONSTANT(POWERSTATE_CHARGED);
}
_OS::_OS() {
@@ -1772,15 +1772,15 @@ void _File::_bind_methods() {
ClassDB::bind_method(D_METHOD("file_exists", "path"), &_File::file_exists);
ClassDB::bind_method(D_METHOD("get_modified_time", "file"), &_File::get_modified_time);
- BIND_CONSTANT(READ);
- BIND_CONSTANT(WRITE);
- BIND_CONSTANT(READ_WRITE);
- BIND_CONSTANT(WRITE_READ);
+ BIND_ENUM_CONSTANT(READ);
+ BIND_ENUM_CONSTANT(WRITE);
+ BIND_ENUM_CONSTANT(READ_WRITE);
+ BIND_ENUM_CONSTANT(WRITE_READ);
- BIND_CONSTANT(COMPRESSION_FASTLZ);
- BIND_CONSTANT(COMPRESSION_DEFLATE);
- BIND_CONSTANT(COMPRESSION_ZSTD);
- BIND_CONSTANT(COMPRESSION_GZIP);
+ BIND_ENUM_CONSTANT(COMPRESSION_FASTLZ);
+ BIND_ENUM_CONSTANT(COMPRESSION_DEFLATE);
+ BIND_ENUM_CONSTANT(COMPRESSION_ZSTD);
+ BIND_ENUM_CONSTANT(COMPRESSION_GZIP);
}
_File::_File() {
@@ -2285,9 +2285,9 @@ void _Thread::_bind_methods() {
ClassDB::bind_method(D_METHOD("is_active"), &_Thread::is_active);
ClassDB::bind_method(D_METHOD("wait_to_finish"), &_Thread::wait_to_finish);
- BIND_CONSTANT(PRIORITY_LOW);
- BIND_CONSTANT(PRIORITY_NORMAL);
- BIND_CONSTANT(PRIORITY_HIGH);
+ BIND_ENUM_CONSTANT(PRIORITY_LOW);
+ BIND_ENUM_CONSTANT(PRIORITY_NORMAL);
+ BIND_ENUM_CONSTANT(PRIORITY_HIGH);
}
_Thread::_Thread() {
@@ -2534,11 +2534,6 @@ float _Engine::get_frames_per_second() const {
return Engine::get_singleton()->get_frames_per_second();
}
-String _Engine::get_custom_level() const {
-
- return Engine::get_singleton()->get_custom_level();
-}
-
void _Engine::set_time_scale(float p_scale) {
Engine::get_singleton()->set_time_scale(p_scale);
}
@@ -2568,6 +2563,16 @@ bool _Engine::is_in_fixed_frame() const {
return Engine::get_singleton()->is_in_fixed_frame();
}
+void _Engine::set_editor_hint(bool p_enabled) {
+
+ Engine::get_singleton()->set_editor_hint(p_enabled);
+}
+
+bool _Engine::is_editor_hint() const {
+
+ return Engine::get_singleton()->is_editor_hint();
+}
+
void _Engine::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_iterations_per_second", "iterations_per_second"), &_Engine::set_iterations_per_second);
@@ -2578,8 +2583,6 @@ void _Engine::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_time_scale", "time_scale"), &_Engine::set_time_scale);
ClassDB::bind_method(D_METHOD("get_time_scale"), &_Engine::get_time_scale);
- ClassDB::bind_method(D_METHOD("get_custom_level"), &_Engine::get_custom_level);
-
ClassDB::bind_method(D_METHOD("get_frames_drawn"), &_Engine::get_frames_drawn);
ClassDB::bind_method(D_METHOD("get_frames_per_second"), &_Engine::get_frames_per_second);
@@ -2588,6 +2591,9 @@ void _Engine::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_version_info"), &_Engine::get_version_info);
ClassDB::bind_method(D_METHOD("is_in_fixed_frame"), &_Engine::is_in_fixed_frame);
+
+ ClassDB::bind_method(D_METHOD("set_editor_hint", "enabled"), &_Engine::set_editor_hint);
+ ClassDB::bind_method(D_METHOD("is_editor_hint"), &_Engine::is_editor_hint);
}
_Engine *_Engine::singleton = NULL;
diff --git a/core/bind/core_bind.h b/core/bind/core_bind.h
index e18d663d85..41653c8846 100644
--- a/core/bind/core_bind.h
+++ b/core/bind/core_bind.h
@@ -85,6 +85,8 @@ public:
_ResourceSaver();
};
+VARIANT_ENUM_CAST(_ResourceSaver::SaverFlags);
+
class MainLoop;
class _OS : public Object {
@@ -310,6 +312,8 @@ public:
_OS();
};
+VARIANT_ENUM_CAST(_OS::Weekday);
+VARIANT_ENUM_CAST(_OS::Month);
VARIANT_ENUM_CAST(_OS::SystemDir);
VARIANT_ENUM_CAST(_OS::ScreenOrientation);
@@ -447,6 +451,9 @@ public:
virtual ~_File();
};
+VARIANT_ENUM_CAST(_File::ModeFlags);
+VARIANT_ENUM_CAST(_File::CompressionMode);
+
class _Directory : public Reference {
GDCLASS(_Directory, Reference);
@@ -458,7 +465,7 @@ protected:
public:
Error open(const String &p_path);
- Error list_dir_begin(bool p_skip_internal = false, bool p_skip_hidden = false); ///< This starts dir listing
+ Error list_dir_begin(bool p_skip_navigational = false, bool p_skip_hidden = false); ///< This starts dir listing
String get_next();
bool current_is_dir() const;
@@ -578,6 +585,8 @@ public:
~_Thread();
};
+VARIANT_ENUM_CAST(_Thread::Priority);
+
class _ClassDB : public Object {
GDCLASS(_ClassDB, Object)
@@ -639,14 +648,15 @@ public:
void set_time_scale(float p_scale);
float get_time_scale();
- String get_custom_level() const;
-
MainLoop *get_main_loop() const;
Dictionary get_version_info() const;
bool is_in_fixed_frame() const;
+ void set_editor_hint(bool p_enabled);
+ bool is_editor_hint() const;
+
_Engine();
};
diff --git a/core/class_db.cpp b/core/class_db.cpp
index 0503f7c6fc..6cd7586a54 100644
--- a/core/class_db.cpp
+++ b/core/class_db.cpp
@@ -583,7 +583,7 @@ MethodBind *ClassDB::get_method(StringName p_class, StringName p_name) {
return NULL;
}
-void ClassDB::bind_integer_constant(const StringName &p_class, const StringName &p_name, int p_constant) {
+void ClassDB::bind_integer_constant(const StringName &p_class, const StringName &p_enum, const StringName &p_name, int p_constant) {
OBJTYPE_WLOCK;
@@ -600,6 +600,16 @@ void ClassDB::bind_integer_constant(const StringName &p_class, const StringName
type->constant_map[p_name] = p_constant;
#ifdef DEBUG_METHODS_ENABLED
+ List<StringName> *constants_list = type->enum_map.getptr(p_enum);
+
+ if (constants_list) {
+ constants_list->push_back(p_name);
+ } else {
+ List<StringName> new_list;
+ new_list.push_back(p_name);
+ type->enum_map[p_enum] = new_list;
+ }
+
type->constant_order.push_back(p_name);
#endif
}
@@ -655,6 +665,77 @@ int ClassDB::get_integer_constant(const StringName &p_class, const StringName &p
return 0;
}
+#ifdef DEBUG_METHODS_ENABLED
+StringName ClassDB::get_integer_constant_enum(const StringName &p_class, const StringName &p_name, bool p_no_inheritance) {
+
+ OBJTYPE_RLOCK;
+
+ ClassInfo *type = classes.getptr(p_class);
+
+ while (type) {
+
+ const StringName *k = NULL;
+ while ((k = type->enum_map.next(k))) {
+
+ List<StringName> &constants_list = type->enum_map.get(*k);
+ const List<StringName>::Element *found = constants_list.find(p_name);
+ if (found)
+ return found->get();
+ }
+
+ if (p_no_inheritance)
+ break;
+
+ type = type->inherits_ptr;
+ }
+
+ return StringName();
+}
+
+void ClassDB::get_enum_list(const StringName &p_class, List<StringName> *p_enums, bool p_no_inheritance) {
+
+ OBJTYPE_RLOCK;
+
+ ClassInfo *type = classes.getptr(p_class);
+
+ while (type) {
+
+ const StringName *k = NULL;
+ while ((k = type->enum_map.next(k))) {
+ p_enums->push_back(*k);
+ }
+
+ if (p_no_inheritance)
+ break;
+
+ type = type->inherits_ptr;
+ }
+}
+
+void ClassDB::get_enum_constants(const StringName &p_class, const StringName &p_enum, List<StringName> *p_constants, bool p_no_inheritance) {
+
+ OBJTYPE_RLOCK;
+
+ ClassInfo *type = classes.getptr(p_class);
+
+ while (type) {
+
+ const List<StringName> *constants = type->enum_map.getptr(p_enum);
+
+ if (constants) {
+ for (const List<StringName>::Element *E = constants->front(); E; E = E->next()) {
+ p_constants->push_back(E->get());
+ }
+ }
+
+ if (p_no_inheritance)
+ break;
+
+ type = type->inherits_ptr;
+ }
+}
+#endif
+
void ClassDB::add_signal(StringName p_class, const MethodInfo &p_signal) {
OBJTYPE_WLOCK;
diff --git a/core/class_db.h b/core/class_db.h
index f73e082c52..8d9192adcc 100644
--- a/core/class_db.h
+++ b/core/class_db.h
@@ -45,7 +45,7 @@ struct ParamHint {
String hint_text;
Variant default_val;
- ParamHint(const String &p_name = "", PropertyHint p_hint = PROPERTY_HINT_NONE, const String &p_hint_text = "", Variant p_default_val = Variant())
+ ParamHint(const String &p_name = "", PropertyHint p_hint = PROPERTY_HINT_NONE, const String &p_hint_text = "", const Variant &p_default_val = Variant())
: name(p_name),
hint(p_hint),
hint_text(p_hint_text),
@@ -138,6 +138,7 @@ public:
HashMap<StringName, MethodInfo, StringNameHasher> signal_map;
List<PropertyInfo> property_list;
#ifdef DEBUG_METHODS_ENABLED
+ HashMap<StringName, List<StringName> > enum_map;
List<StringName> constant_order;
List<StringName> method_order;
Set<StringName> methods_in_properties;
@@ -488,9 +489,16 @@ public:
static void add_virtual_method(const StringName &p_class, const MethodInfo &p_method, bool p_virtual = true);
static void get_virtual_methods(const StringName &p_class, List<MethodInfo> *p_methods, bool p_no_inheritance = false);
- static void bind_integer_constant(const StringName &p_class, const StringName &p_name, int p_constant);
+ static void bind_integer_constant(const StringName &p_class, const StringName &p_enum, const StringName &p_name, int p_constant);
static void get_integer_constant_list(const StringName &p_class, List<String> *p_constants, bool p_no_inheritance = false);
static int get_integer_constant(const StringName &p_class, const StringName &p_name, bool *p_success = NULL);
+
+#ifdef DEBUG_METHODS_ENABLED
+ static StringName get_integer_constant_enum(const StringName &p_class, const StringName &p_name, bool p_no_inheritance = false);
+ static void get_enum_list(const StringName &p_class, List<StringName> *p_enums, bool p_no_inheritance = false);
+ static void get_enum_constants(const StringName &p_class, const StringName &p_enum, List<StringName> *p_constants, bool p_no_inheritance = false);
+#endif
+
static StringName get_category(const StringName &p_node);
static bool get_setter_and_type_for_property(const StringName &p_class, const StringName &p_prop, StringName &r_class, StringName &r_setter);
@@ -509,8 +517,23 @@ public:
static void cleanup();
};
+#ifdef DEBUG_METHODS_ENABLED
+
+#define BIND_CONSTANT(m_constant) \
+ ClassDB::bind_integer_constant(get_class_static(), StringName(), #m_constant, m_constant);
+
+#define BIND_ENUM_CONSTANT(m_constant) \
+ ClassDB::bind_integer_constant(get_class_static(), __constant_get_enum_name(m_constant, #m_constant), #m_constant, m_constant);
+
+#else
+
#define BIND_CONSTANT(m_constant) \
- ClassDB::bind_integer_constant(get_class_static(), #m_constant, m_constant);
+ ClassDB::bind_integer_constant(get_class_static(), StringName(), #m_constant, m_constant);
+
+#define BIND_ENUM_CONSTANT(m_constant) \
+ ClassDB::bind_integer_constant(get_class_static(), StringName(), #m_constant, m_constant);
+
+#endif
#ifdef TOOLS_ENABLED
diff --git a/core/command_queue_mt.cpp b/core/command_queue_mt.cpp
index 823494ff67..c9edd1d47b 100644
--- a/core/command_queue_mt.cpp
+++ b/core/command_queue_mt.cpp
@@ -55,6 +55,7 @@ CommandQueueMT::SyncSemaphore *CommandQueueMT::_alloc_sync_sem() {
while (true) {
+ lock();
for (int i = 0; i < SYNC_SEMAPHORES; i++) {
if (!sync_sems[i].in_use) {
@@ -63,6 +64,7 @@ CommandQueueMT::SyncSemaphore *CommandQueueMT::_alloc_sync_sem() {
break;
}
}
+ unlock();
if (idx == -1) {
wait_for_flush();
diff --git a/core/command_queue_mt.h b/core/command_queue_mt.h
index 2e0c478108..c3e44f731f 100644
--- a/core/command_queue_mt.h
+++ b/core/command_queue_mt.h
@@ -911,12 +911,14 @@ public:
template <class T, class M, class R>
void push_and_ret(T *p_instance, M p_method, R *r_ret) {
+ SyncSemaphore *ss = _alloc_sync_sem();
+
CommandRet0<T, M, R> *cmd = allocate_and_lock<CommandRet0<T, M, R> >();
cmd->instance = p_instance;
cmd->method = p_method;
cmd->ret = r_ret;
- SyncSemaphore *ss = _alloc_sync_sem();
+
cmd->sync = ss;
unlock();
@@ -928,13 +930,15 @@ public:
template <class T, class M, class P1, class R>
void push_and_ret(T *p_instance, M p_method, P1 p1, R *r_ret) {
+ SyncSemaphore *ss = _alloc_sync_sem();
+
CommandRet1<T, M, P1, R> *cmd = allocate_and_lock<CommandRet1<T, M, P1, R> >();
cmd->instance = p_instance;
cmd->method = p_method;
cmd->p1 = p1;
cmd->ret = r_ret;
- SyncSemaphore *ss = _alloc_sync_sem();
+
cmd->sync = ss;
unlock();
@@ -946,6 +950,8 @@ public:
template <class T, class M, class P1, class P2, class R>
void push_and_ret(T *p_instance, M p_method, P1 p1, P2 p2, R *r_ret) {
+ SyncSemaphore *ss = _alloc_sync_sem();
+
CommandRet2<T, M, P1, P2, R> *cmd = allocate_and_lock<CommandRet2<T, M, P1, P2, R> >();
cmd->instance = p_instance;
@@ -953,7 +959,7 @@ public:
cmd->p1 = p1;
cmd->p2 = p2;
cmd->ret = r_ret;
- SyncSemaphore *ss = _alloc_sync_sem();
+
cmd->sync = ss;
unlock();
@@ -965,6 +971,8 @@ public:
template <class T, class M, class P1, class P2, class P3, class R>
void push_and_ret(T *p_instance, M p_method, P1 p1, P2 p2, P3 p3, R *r_ret) {
+ SyncSemaphore *ss = _alloc_sync_sem();
+
CommandRet3<T, M, P1, P2, P3, R> *cmd = allocate_and_lock<CommandRet3<T, M, P1, P2, P3, R> >();
cmd->instance = p_instance;
@@ -973,7 +981,7 @@ public:
cmd->p2 = p2;
cmd->p3 = p3;
cmd->ret = r_ret;
- SyncSemaphore *ss = _alloc_sync_sem();
+
cmd->sync = ss;
unlock();
@@ -985,6 +993,8 @@ public:
template <class T, class M, class P1, class P2, class P3, class P4, class R>
void push_and_ret(T *p_instance, M p_method, P1 p1, P2 p2, P3 p3, P4 p4, R *r_ret) {
+ SyncSemaphore *ss = _alloc_sync_sem();
+
CommandRet4<T, M, P1, P2, P3, P4, R> *cmd = allocate_and_lock<CommandRet4<T, M, P1, P2, P3, P4, R> >();
cmd->instance = p_instance;
@@ -994,7 +1004,7 @@ public:
cmd->p3 = p3;
cmd->p4 = p4;
cmd->ret = r_ret;
- SyncSemaphore *ss = _alloc_sync_sem();
+
cmd->sync = ss;
unlock();
@@ -1006,6 +1016,8 @@ public:
template <class T, class M, class P1, class P2, class P3, class P4, class P5, class R>
void push_and_ret(T *p_instance, M p_method, P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, R *r_ret) {
+ SyncSemaphore *ss = _alloc_sync_sem();
+
CommandRet5<T, M, P1, P2, P3, P4, P5, R> *cmd = allocate_and_lock<CommandRet5<T, M, P1, P2, P3, P4, P5, R> >();
cmd->instance = p_instance;
@@ -1016,7 +1028,7 @@ public:
cmd->p4 = p4;
cmd->p5 = p5;
cmd->ret = r_ret;
- SyncSemaphore *ss = _alloc_sync_sem();
+
cmd->sync = ss;
unlock();
@@ -1028,6 +1040,8 @@ public:
template <class T, class M, class P1, class P2, class P3, class P4, class P5, class P6, class R>
void push_and_ret(T *p_instance, M p_method, P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, R *r_ret) {
+ SyncSemaphore *ss = _alloc_sync_sem();
+
CommandRet6<T, M, P1, P2, P3, P4, P5, P6, R> *cmd = allocate_and_lock<CommandRet6<T, M, P1, P2, P3, P4, P5, P6, R> >();
cmd->instance = p_instance;
@@ -1039,7 +1053,7 @@ public:
cmd->p5 = p5;
cmd->p6 = p6;
cmd->ret = r_ret;
- SyncSemaphore *ss = _alloc_sync_sem();
+
cmd->sync = ss;
unlock();
@@ -1051,6 +1065,8 @@ public:
template <class T, class M, class P1, class P2, class P3, class P4, class P5, class P6, class P7, class R>
void push_and_ret(T *p_instance, M p_method, P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, R *r_ret) {
+ SyncSemaphore *ss = _alloc_sync_sem();
+
CommandRet7<T, M, P1, P2, P3, P4, P5, P6, P7, R> *cmd = allocate_and_lock<CommandRet7<T, M, P1, P2, P3, P4, P5, P6, P7, R> >();
cmd->instance = p_instance;
@@ -1063,7 +1079,7 @@ public:
cmd->p6 = p6;
cmd->p7 = p7;
cmd->ret = r_ret;
- SyncSemaphore *ss = _alloc_sync_sem();
+
cmd->sync = ss;
unlock();
@@ -1075,6 +1091,8 @@ public:
template <class T, class M, class P1, class P2, class P3, class P4, class P5, class P6, class P7, class P8, class R>
void push_and_ret(T *p_instance, M p_method, P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8, R *r_ret) {
+ SyncSemaphore *ss = _alloc_sync_sem();
+
CommandRet8<T, M, P1, P2, P3, P4, P5, P6, P7, P8, R> *cmd = allocate_and_lock<CommandRet8<T, M, P1, P2, P3, P4, P5, P6, P7, P8, R> >();
cmd->instance = p_instance;
@@ -1088,7 +1106,7 @@ public:
cmd->p7 = p7;
cmd->p8 = p8;
cmd->ret = r_ret;
- SyncSemaphore *ss = _alloc_sync_sem();
+
cmd->sync = ss;
unlock();
@@ -1100,12 +1118,13 @@ public:
template <class T, class M>
void push_and_sync(T *p_instance, M p_method) {
+ SyncSemaphore *ss = _alloc_sync_sem();
+
CommandSync0<T, M> *cmd = allocate_and_lock<CommandSync0<T, M> >();
cmd->instance = p_instance;
cmd->method = p_method;
- SyncSemaphore *ss = _alloc_sync_sem();
cmd->sync = ss;
unlock();
@@ -1117,13 +1136,14 @@ public:
template <class T, class M, class P1>
void push_and_sync(T *p_instance, M p_method, P1 p1) {
+ SyncSemaphore *ss = _alloc_sync_sem();
+
CommandSync1<T, M, P1> *cmd = allocate_and_lock<CommandSync1<T, M, P1> >();
cmd->instance = p_instance;
cmd->method = p_method;
cmd->p1 = p1;
- SyncSemaphore *ss = _alloc_sync_sem();
cmd->sync = ss;
unlock();
@@ -1135,6 +1155,8 @@ public:
template <class T, class M, class P1, class P2>
void push_and_sync(T *p_instance, M p_method, P1 p1, P2 p2) {
+ SyncSemaphore *ss = _alloc_sync_sem();
+
CommandSync2<T, M, P1, P2> *cmd = allocate_and_lock<CommandSync2<T, M, P1, P2> >();
cmd->instance = p_instance;
@@ -1142,7 +1164,6 @@ public:
cmd->p1 = p1;
cmd->p2 = p2;
- SyncSemaphore *ss = _alloc_sync_sem();
cmd->sync = ss;
unlock();
@@ -1154,6 +1175,8 @@ public:
template <class T, class M, class P1, class P2, class P3>
void push_and_sync(T *p_instance, M p_method, P1 p1, P2 p2, P3 p3) {
+ SyncSemaphore *ss = _alloc_sync_sem();
+
CommandSync3<T, M, P1, P2, P3> *cmd = allocate_and_lock<CommandSync3<T, M, P1, P2, P3> >();
cmd->instance = p_instance;
@@ -1162,7 +1185,6 @@ public:
cmd->p2 = p2;
cmd->p3 = p3;
- SyncSemaphore *ss = _alloc_sync_sem();
cmd->sync = ss;
unlock();
@@ -1174,6 +1196,8 @@ public:
template <class T, class M, class P1, class P2, class P3, class P4>
void push_and_sync(T *p_instance, M p_method, P1 p1, P2 p2, P3 p3, P4 p4) {
+ SyncSemaphore *ss = _alloc_sync_sem();
+
CommandSync4<T, M, P1, P2, P3, P4> *cmd = allocate_and_lock<CommandSync4<T, M, P1, P2, P3, P4> >();
cmd->instance = p_instance;
@@ -1183,7 +1207,6 @@ public:
cmd->p3 = p3;
cmd->p4 = p4;
- SyncSemaphore *ss = _alloc_sync_sem();
cmd->sync = ss;
unlock();
@@ -1195,6 +1218,8 @@ public:
template <class T, class M, class P1, class P2, class P3, class P4, class P5>
void push_and_sync(T *p_instance, M p_method, P1 p1, P2 p2, P3 p3, P4 p4, P5 p5) {
+ SyncSemaphore *ss = _alloc_sync_sem();
+
CommandSync5<T, M, P1, P2, P3, P4, P5> *cmd = allocate_and_lock<CommandSync5<T, M, P1, P2, P3, P4, P5> >();
cmd->instance = p_instance;
@@ -1205,7 +1230,6 @@ public:
cmd->p4 = p4;
cmd->p5 = p5;
- SyncSemaphore *ss = _alloc_sync_sem();
cmd->sync = ss;
unlock();
@@ -1217,6 +1241,8 @@ public:
template <class T, class M, class P1, class P2, class P3, class P4, class P5, class P6>
void push_and_sync(T *p_instance, M p_method, P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6) {
+ SyncSemaphore *ss = _alloc_sync_sem();
+
CommandSync6<T, M, P1, P2, P3, P4, P5, P6> *cmd = allocate_and_lock<CommandSync6<T, M, P1, P2, P3, P4, P5, P6> >();
cmd->instance = p_instance;
@@ -1228,7 +1254,6 @@ public:
cmd->p5 = p5;
cmd->p6 = p6;
- SyncSemaphore *ss = _alloc_sync_sem();
cmd->sync = ss;
unlock();
@@ -1240,6 +1265,8 @@ public:
template <class T, class M, class P1, class P2, class P3, class P4, class P5, class P6, class P7>
void push_and_sync(T *p_instance, M p_method, P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7) {
+ SyncSemaphore *ss = _alloc_sync_sem();
+
CommandSync7<T, M, P1, P2, P3, P4, P5, P6, P7> *cmd = allocate_and_lock<CommandSync7<T, M, P1, P2, P3, P4, P5, P6, P7> >();
cmd->instance = p_instance;
@@ -1252,7 +1279,6 @@ public:
cmd->p6 = p6;
cmd->p7 = p7;
- SyncSemaphore *ss = _alloc_sync_sem();
cmd->sync = ss;
unlock();
@@ -1264,6 +1290,8 @@ public:
template <class T, class M, class P1, class P2, class P3, class P4, class P5, class P6, class P7, class P8>
void push_and_sync(T *p_instance, M p_method, P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8) {
+ SyncSemaphore *ss = _alloc_sync_sem();
+
CommandSync8<T, M, P1, P2, P3, P4, P5, P6, P7, P8> *cmd = allocate_and_lock<CommandSync8<T, M, P1, P2, P3, P4, P5, P6, P7, P8> >();
cmd->instance = p_instance;
@@ -1277,7 +1305,6 @@ public:
cmd->p7 = p7;
cmd->p8 = p8;
- SyncSemaphore *ss = _alloc_sync_sem();
cmd->sync = ss;
unlock();
diff --git a/core/engine.cpp b/core/engine.cpp
index c16a2903d3..c8218e47ac 100644
--- a/core/engine.cpp
+++ b/core/engine.cpp
@@ -121,4 +121,5 @@ Engine::Engine() {
_in_fixed = false;
_frame_ticks = 0;
_frame_step = 0;
+ editor_hint = false;
}
diff --git a/core/engine.h b/core/engine.h
index 16dfb77593..c46ae1cb64 100644
--- a/core/engine.h
+++ b/core/engine.h
@@ -39,7 +39,6 @@ class Engine {
friend class Main;
- String _custom_level;
uint64_t frames_drawn;
uint32_t _frame_delay;
uint64_t _frame_ticks;
@@ -51,9 +50,12 @@ class Engine {
float _time_scale;
bool _pixel_snap;
uint64_t _fixed_frames;
+
uint64_t _idle_frames;
bool _in_fixed;
+ bool editor_hint;
+
static Engine *singleton;
public:
@@ -67,8 +69,6 @@ public:
virtual float get_frames_per_second() const { return _fps; }
- String get_custom_level() const { return _custom_level; }
-
uint64_t get_frames_drawn();
uint64_t get_fixed_frames() const { return _fixed_frames; }
@@ -85,6 +85,14 @@ public:
_FORCE_INLINE_ bool get_use_pixel_snap() const { return _pixel_snap; }
+#ifdef TOOLS_ENABLED
+ _FORCE_INLINE_ void set_editor_hint(bool p_enabled) { editor_hint = p_enabled; }
+ _FORCE_INLINE_ bool is_editor_hint() const { return editor_hint; }
+#else
+ _FORCE_INLINE_ void set_editor_hint(bool p_enabled) {}
+ _FORCE_INLINE_ bool is_editor_hint() const { return false; }
+#endif
+
Dictionary get_version_info() const;
Engine();
diff --git a/core/global_constants.cpp b/core/global_constants.cpp
index 9e745ecb98..d296b678b9 100644
--- a/core/global_constants.cpp
+++ b/core/global_constants.cpp
@@ -10,7 +10,7 @@
/* */
/* 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 */
+/* "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 */
@@ -36,504 +36,563 @@
struct _GlobalConstant {
+#ifdef DEBUG_METHODS_ENABLED
+ StringName enum_name;
+#endif
const char *name;
int value;
+
+ _GlobalConstant() {}
+
+#ifdef DEBUG_METHODS_ENABLED
+ _GlobalConstant(const StringName &p_enum_name, const char *p_name, int p_value) {
+ enum_name = p_enum_name;
+ name = p_name;
+ value = p_value;
+ }
+#else
+ _GlobalConstant(const char *p_name, int p_value) {
+ name = p_name;
+ value = p_value;
+ }
+#endif
};
+static Vector<_GlobalConstant> _global_constants;
+
+#ifdef DEBUG_METHODS_ENABLED
+
+#define BIND_GLOBAL_CONSTANT(m_constant) \
+ _global_constants.push_back(_GlobalConstant(StringName(), #m_constant, m_constant));
+
+#define BIND_GLOBAL_ENUM_CONSTANT(m_constant) \
+ _global_constants.push_back(_GlobalConstant(__constant_get_enum_name(m_constant, #m_constant), #m_constant, m_constant));
+
+#define BIND_GLOBAL_ENUM_CONSTANT_CUSTOM(m_custom_name, m_constant) \
+ _global_constants.push_back(_GlobalConstant(__constant_get_enum_name(m_constant, #m_constant), m_custom_name, m_constant));
+
+#else
+
#define BIND_GLOBAL_CONSTANT(m_constant) \
- { #m_constant, m_constant }
+ _global_constants.push_back(_GlobalConstant(#m_constant, m_constant));
+
+#define BIND_GLOBAL_ENUM_CONSTANT(m_constant) \
+ _global_constants.push_back(_GlobalConstant(#m_constant, m_constant));
+
+#define BIND_GLOBAL_ENUM_CONSTANT_CUSTOM(m_custom_name, m_constant) \
+ _global_constants.push_back(_GlobalConstant(m_custom_name, m_constant));
+
+#endif
+
+VARIANT_ENUM_CAST(KeyList);
+VARIANT_ENUM_CAST(KeyModifierMask);
-static _GlobalConstant _global_constants[] = {
+void register_global_constants() {
//{ KEY_BACKSPACE, VK_BACK },// (0x08) // backspace
- BIND_GLOBAL_CONSTANT(MARGIN_LEFT),
- BIND_GLOBAL_CONSTANT(MARGIN_TOP),
- BIND_GLOBAL_CONSTANT(MARGIN_RIGHT),
- BIND_GLOBAL_CONSTANT(MARGIN_BOTTOM),
- BIND_GLOBAL_CONSTANT(VERTICAL),
- BIND_GLOBAL_CONSTANT(HORIZONTAL),
- BIND_GLOBAL_CONSTANT(HALIGN_LEFT),
- BIND_GLOBAL_CONSTANT(HALIGN_CENTER),
- BIND_GLOBAL_CONSTANT(HALIGN_RIGHT),
- BIND_GLOBAL_CONSTANT(VALIGN_TOP),
- BIND_GLOBAL_CONSTANT(VALIGN_CENTER),
- BIND_GLOBAL_CONSTANT(VALIGN_BOTTOM),
+ BIND_GLOBAL_ENUM_CONSTANT(MARGIN_LEFT);
+ BIND_GLOBAL_ENUM_CONSTANT(MARGIN_TOP);
+ BIND_GLOBAL_ENUM_CONSTANT(MARGIN_RIGHT);
+ BIND_GLOBAL_ENUM_CONSTANT(MARGIN_BOTTOM);
+
+ BIND_GLOBAL_ENUM_CONSTANT(VERTICAL);
+ BIND_GLOBAL_ENUM_CONSTANT(HORIZONTAL);
+
+ BIND_GLOBAL_ENUM_CONSTANT(HALIGN_LEFT);
+ BIND_GLOBAL_ENUM_CONSTANT(HALIGN_CENTER);
+ BIND_GLOBAL_ENUM_CONSTANT(HALIGN_RIGHT);
+
+ BIND_GLOBAL_ENUM_CONSTANT(VALIGN_TOP);
+ BIND_GLOBAL_ENUM_CONSTANT(VALIGN_CENTER);
+ BIND_GLOBAL_ENUM_CONSTANT(VALIGN_BOTTOM);
// hueg list of keys
- BIND_GLOBAL_CONSTANT(SPKEY),
-
- BIND_GLOBAL_CONSTANT(KEY_ESCAPE),
- BIND_GLOBAL_CONSTANT(KEY_TAB),
- BIND_GLOBAL_CONSTANT(KEY_BACKTAB),
- BIND_GLOBAL_CONSTANT(KEY_BACKSPACE),
- BIND_GLOBAL_CONSTANT(KEY_ENTER),
- BIND_GLOBAL_CONSTANT(KEY_KP_ENTER),
- BIND_GLOBAL_CONSTANT(KEY_INSERT),
- BIND_GLOBAL_CONSTANT(KEY_DELETE),
- BIND_GLOBAL_CONSTANT(KEY_PAUSE),
- BIND_GLOBAL_CONSTANT(KEY_PRINT),
- BIND_GLOBAL_CONSTANT(KEY_SYSREQ),
- BIND_GLOBAL_CONSTANT(KEY_CLEAR),
- BIND_GLOBAL_CONSTANT(KEY_HOME),
- BIND_GLOBAL_CONSTANT(KEY_END),
- BIND_GLOBAL_CONSTANT(KEY_LEFT),
- BIND_GLOBAL_CONSTANT(KEY_UP),
- BIND_GLOBAL_CONSTANT(KEY_RIGHT),
- BIND_GLOBAL_CONSTANT(KEY_DOWN),
- BIND_GLOBAL_CONSTANT(KEY_PAGEUP),
- BIND_GLOBAL_CONSTANT(KEY_PAGEDOWN),
- BIND_GLOBAL_CONSTANT(KEY_SHIFT),
- BIND_GLOBAL_CONSTANT(KEY_CONTROL),
- BIND_GLOBAL_CONSTANT(KEY_META),
- BIND_GLOBAL_CONSTANT(KEY_ALT),
- BIND_GLOBAL_CONSTANT(KEY_CAPSLOCK),
- BIND_GLOBAL_CONSTANT(KEY_NUMLOCK),
- BIND_GLOBAL_CONSTANT(KEY_SCROLLLOCK),
- BIND_GLOBAL_CONSTANT(KEY_F1),
- BIND_GLOBAL_CONSTANT(KEY_F2),
- BIND_GLOBAL_CONSTANT(KEY_F3),
- BIND_GLOBAL_CONSTANT(KEY_F4),
- BIND_GLOBAL_CONSTANT(KEY_F5),
- BIND_GLOBAL_CONSTANT(KEY_F6),
- BIND_GLOBAL_CONSTANT(KEY_F7),
- BIND_GLOBAL_CONSTANT(KEY_F8),
- BIND_GLOBAL_CONSTANT(KEY_F9),
- BIND_GLOBAL_CONSTANT(KEY_F10),
- BIND_GLOBAL_CONSTANT(KEY_F11),
- BIND_GLOBAL_CONSTANT(KEY_F12),
- BIND_GLOBAL_CONSTANT(KEY_F13),
- BIND_GLOBAL_CONSTANT(KEY_F14),
- BIND_GLOBAL_CONSTANT(KEY_F15),
- BIND_GLOBAL_CONSTANT(KEY_F16),
- BIND_GLOBAL_CONSTANT(KEY_KP_MULTIPLY),
- BIND_GLOBAL_CONSTANT(KEY_KP_DIVIDE),
- BIND_GLOBAL_CONSTANT(KEY_KP_SUBTRACT),
- BIND_GLOBAL_CONSTANT(KEY_KP_PERIOD),
- BIND_GLOBAL_CONSTANT(KEY_KP_ADD),
- BIND_GLOBAL_CONSTANT(KEY_KP_0),
- BIND_GLOBAL_CONSTANT(KEY_KP_1),
- BIND_GLOBAL_CONSTANT(KEY_KP_2),
- BIND_GLOBAL_CONSTANT(KEY_KP_3),
- BIND_GLOBAL_CONSTANT(KEY_KP_4),
- BIND_GLOBAL_CONSTANT(KEY_KP_5),
- BIND_GLOBAL_CONSTANT(KEY_KP_6),
- BIND_GLOBAL_CONSTANT(KEY_KP_7),
- BIND_GLOBAL_CONSTANT(KEY_KP_8),
- BIND_GLOBAL_CONSTANT(KEY_KP_9),
- BIND_GLOBAL_CONSTANT(KEY_SUPER_L),
- BIND_GLOBAL_CONSTANT(KEY_SUPER_R),
- BIND_GLOBAL_CONSTANT(KEY_MENU),
- BIND_GLOBAL_CONSTANT(KEY_HYPER_L),
- BIND_GLOBAL_CONSTANT(KEY_HYPER_R),
- BIND_GLOBAL_CONSTANT(KEY_HELP),
- BIND_GLOBAL_CONSTANT(KEY_DIRECTION_L),
- BIND_GLOBAL_CONSTANT(KEY_DIRECTION_R),
- BIND_GLOBAL_CONSTANT(KEY_BACK),
- BIND_GLOBAL_CONSTANT(KEY_FORWARD),
- BIND_GLOBAL_CONSTANT(KEY_STOP),
- BIND_GLOBAL_CONSTANT(KEY_REFRESH),
- BIND_GLOBAL_CONSTANT(KEY_VOLUMEDOWN),
- BIND_GLOBAL_CONSTANT(KEY_VOLUMEMUTE),
- BIND_GLOBAL_CONSTANT(KEY_VOLUMEUP),
- BIND_GLOBAL_CONSTANT(KEY_BASSBOOST),
- BIND_GLOBAL_CONSTANT(KEY_BASSUP),
- BIND_GLOBAL_CONSTANT(KEY_BASSDOWN),
- BIND_GLOBAL_CONSTANT(KEY_TREBLEUP),
- BIND_GLOBAL_CONSTANT(KEY_TREBLEDOWN),
- BIND_GLOBAL_CONSTANT(KEY_MEDIAPLAY),
- BIND_GLOBAL_CONSTANT(KEY_MEDIASTOP),
- BIND_GLOBAL_CONSTANT(KEY_MEDIAPREVIOUS),
- BIND_GLOBAL_CONSTANT(KEY_MEDIANEXT),
- BIND_GLOBAL_CONSTANT(KEY_MEDIARECORD),
- BIND_GLOBAL_CONSTANT(KEY_HOMEPAGE),
- BIND_GLOBAL_CONSTANT(KEY_FAVORITES),
- BIND_GLOBAL_CONSTANT(KEY_SEARCH),
- BIND_GLOBAL_CONSTANT(KEY_STANDBY),
- BIND_GLOBAL_CONSTANT(KEY_OPENURL),
- BIND_GLOBAL_CONSTANT(KEY_LAUNCHMAIL),
- BIND_GLOBAL_CONSTANT(KEY_LAUNCHMEDIA),
- BIND_GLOBAL_CONSTANT(KEY_LAUNCH0),
- BIND_GLOBAL_CONSTANT(KEY_LAUNCH1),
- BIND_GLOBAL_CONSTANT(KEY_LAUNCH2),
- BIND_GLOBAL_CONSTANT(KEY_LAUNCH3),
- BIND_GLOBAL_CONSTANT(KEY_LAUNCH4),
- BIND_GLOBAL_CONSTANT(KEY_LAUNCH5),
- BIND_GLOBAL_CONSTANT(KEY_LAUNCH6),
- BIND_GLOBAL_CONSTANT(KEY_LAUNCH7),
- BIND_GLOBAL_CONSTANT(KEY_LAUNCH8),
- BIND_GLOBAL_CONSTANT(KEY_LAUNCH9),
- BIND_GLOBAL_CONSTANT(KEY_LAUNCHA),
- BIND_GLOBAL_CONSTANT(KEY_LAUNCHB),
- BIND_GLOBAL_CONSTANT(KEY_LAUNCHC),
- BIND_GLOBAL_CONSTANT(KEY_LAUNCHD),
- BIND_GLOBAL_CONSTANT(KEY_LAUNCHE),
- BIND_GLOBAL_CONSTANT(KEY_LAUNCHF),
-
- BIND_GLOBAL_CONSTANT(KEY_UNKNOWN),
- BIND_GLOBAL_CONSTANT(KEY_SPACE),
- BIND_GLOBAL_CONSTANT(KEY_EXCLAM),
- BIND_GLOBAL_CONSTANT(KEY_QUOTEDBL),
- BIND_GLOBAL_CONSTANT(KEY_NUMBERSIGN),
- BIND_GLOBAL_CONSTANT(KEY_DOLLAR),
- BIND_GLOBAL_CONSTANT(KEY_PERCENT),
- BIND_GLOBAL_CONSTANT(KEY_AMPERSAND),
- BIND_GLOBAL_CONSTANT(KEY_APOSTROPHE),
- BIND_GLOBAL_CONSTANT(KEY_PARENLEFT),
- BIND_GLOBAL_CONSTANT(KEY_PARENRIGHT),
- BIND_GLOBAL_CONSTANT(KEY_ASTERISK),
- BIND_GLOBAL_CONSTANT(KEY_PLUS),
- BIND_GLOBAL_CONSTANT(KEY_COMMA),
- BIND_GLOBAL_CONSTANT(KEY_MINUS),
- BIND_GLOBAL_CONSTANT(KEY_PERIOD),
- BIND_GLOBAL_CONSTANT(KEY_SLASH),
- BIND_GLOBAL_CONSTANT(KEY_0),
- BIND_GLOBAL_CONSTANT(KEY_1),
- BIND_GLOBAL_CONSTANT(KEY_2),
- BIND_GLOBAL_CONSTANT(KEY_3),
- BIND_GLOBAL_CONSTANT(KEY_4),
- BIND_GLOBAL_CONSTANT(KEY_5),
- BIND_GLOBAL_CONSTANT(KEY_6),
- BIND_GLOBAL_CONSTANT(KEY_7),
- BIND_GLOBAL_CONSTANT(KEY_8),
- BIND_GLOBAL_CONSTANT(KEY_9),
- BIND_GLOBAL_CONSTANT(KEY_COLON),
- BIND_GLOBAL_CONSTANT(KEY_SEMICOLON),
- BIND_GLOBAL_CONSTANT(KEY_LESS),
- BIND_GLOBAL_CONSTANT(KEY_EQUAL),
- BIND_GLOBAL_CONSTANT(KEY_GREATER),
- BIND_GLOBAL_CONSTANT(KEY_QUESTION),
- BIND_GLOBAL_CONSTANT(KEY_AT),
- BIND_GLOBAL_CONSTANT(KEY_A),
- BIND_GLOBAL_CONSTANT(KEY_B),
- BIND_GLOBAL_CONSTANT(KEY_C),
- BIND_GLOBAL_CONSTANT(KEY_D),
- BIND_GLOBAL_CONSTANT(KEY_E),
- BIND_GLOBAL_CONSTANT(KEY_F),
- BIND_GLOBAL_CONSTANT(KEY_G),
- BIND_GLOBAL_CONSTANT(KEY_H),
- BIND_GLOBAL_CONSTANT(KEY_I),
- BIND_GLOBAL_CONSTANT(KEY_J),
- BIND_GLOBAL_CONSTANT(KEY_K),
- BIND_GLOBAL_CONSTANT(KEY_L),
- BIND_GLOBAL_CONSTANT(KEY_M),
- BIND_GLOBAL_CONSTANT(KEY_N),
- BIND_GLOBAL_CONSTANT(KEY_O),
- BIND_GLOBAL_CONSTANT(KEY_P),
- BIND_GLOBAL_CONSTANT(KEY_Q),
- BIND_GLOBAL_CONSTANT(KEY_R),
- BIND_GLOBAL_CONSTANT(KEY_S),
- BIND_GLOBAL_CONSTANT(KEY_T),
- BIND_GLOBAL_CONSTANT(KEY_U),
- BIND_GLOBAL_CONSTANT(KEY_V),
- BIND_GLOBAL_CONSTANT(KEY_W),
- BIND_GLOBAL_CONSTANT(KEY_X),
- BIND_GLOBAL_CONSTANT(KEY_Y),
- BIND_GLOBAL_CONSTANT(KEY_Z),
- BIND_GLOBAL_CONSTANT(KEY_BRACKETLEFT),
- BIND_GLOBAL_CONSTANT(KEY_BACKSLASH),
- BIND_GLOBAL_CONSTANT(KEY_BRACKETRIGHT),
- BIND_GLOBAL_CONSTANT(KEY_ASCIICIRCUM),
- BIND_GLOBAL_CONSTANT(KEY_UNDERSCORE),
- BIND_GLOBAL_CONSTANT(KEY_QUOTELEFT),
- BIND_GLOBAL_CONSTANT(KEY_BRACELEFT),
- BIND_GLOBAL_CONSTANT(KEY_BAR),
- BIND_GLOBAL_CONSTANT(KEY_BRACERIGHT),
- BIND_GLOBAL_CONSTANT(KEY_ASCIITILDE),
- BIND_GLOBAL_CONSTANT(KEY_NOBREAKSPACE),
- BIND_GLOBAL_CONSTANT(KEY_EXCLAMDOWN),
- BIND_GLOBAL_CONSTANT(KEY_CENT),
- BIND_GLOBAL_CONSTANT(KEY_STERLING),
- BIND_GLOBAL_CONSTANT(KEY_CURRENCY),
- BIND_GLOBAL_CONSTANT(KEY_YEN),
- BIND_GLOBAL_CONSTANT(KEY_BROKENBAR),
- BIND_GLOBAL_CONSTANT(KEY_SECTION),
- BIND_GLOBAL_CONSTANT(KEY_DIAERESIS),
- BIND_GLOBAL_CONSTANT(KEY_COPYRIGHT),
- BIND_GLOBAL_CONSTANT(KEY_ORDFEMININE),
- BIND_GLOBAL_CONSTANT(KEY_GUILLEMOTLEFT),
- BIND_GLOBAL_CONSTANT(KEY_NOTSIGN),
- BIND_GLOBAL_CONSTANT(KEY_HYPHEN),
- BIND_GLOBAL_CONSTANT(KEY_REGISTERED),
- BIND_GLOBAL_CONSTANT(KEY_MACRON),
- BIND_GLOBAL_CONSTANT(KEY_DEGREE),
- BIND_GLOBAL_CONSTANT(KEY_PLUSMINUS),
- BIND_GLOBAL_CONSTANT(KEY_TWOSUPERIOR),
- BIND_GLOBAL_CONSTANT(KEY_THREESUPERIOR),
- BIND_GLOBAL_CONSTANT(KEY_ACUTE),
- BIND_GLOBAL_CONSTANT(KEY_MU),
- BIND_GLOBAL_CONSTANT(KEY_PARAGRAPH),
- BIND_GLOBAL_CONSTANT(KEY_PERIODCENTERED),
- BIND_GLOBAL_CONSTANT(KEY_CEDILLA),
- BIND_GLOBAL_CONSTANT(KEY_ONESUPERIOR),
- BIND_GLOBAL_CONSTANT(KEY_MASCULINE),
- BIND_GLOBAL_CONSTANT(KEY_GUILLEMOTRIGHT),
- BIND_GLOBAL_CONSTANT(KEY_ONEQUARTER),
- BIND_GLOBAL_CONSTANT(KEY_ONEHALF),
- BIND_GLOBAL_CONSTANT(KEY_THREEQUARTERS),
- BIND_GLOBAL_CONSTANT(KEY_QUESTIONDOWN),
- BIND_GLOBAL_CONSTANT(KEY_AGRAVE),
- BIND_GLOBAL_CONSTANT(KEY_AACUTE),
- BIND_GLOBAL_CONSTANT(KEY_ACIRCUMFLEX),
- BIND_GLOBAL_CONSTANT(KEY_ATILDE),
- BIND_GLOBAL_CONSTANT(KEY_ADIAERESIS),
- BIND_GLOBAL_CONSTANT(KEY_ARING),
- BIND_GLOBAL_CONSTANT(KEY_AE),
- BIND_GLOBAL_CONSTANT(KEY_CCEDILLA),
- BIND_GLOBAL_CONSTANT(KEY_EGRAVE),
- BIND_GLOBAL_CONSTANT(KEY_EACUTE),
- BIND_GLOBAL_CONSTANT(KEY_ECIRCUMFLEX),
- BIND_GLOBAL_CONSTANT(KEY_EDIAERESIS),
- BIND_GLOBAL_CONSTANT(KEY_IGRAVE),
- BIND_GLOBAL_CONSTANT(KEY_IACUTE),
- BIND_GLOBAL_CONSTANT(KEY_ICIRCUMFLEX),
- BIND_GLOBAL_CONSTANT(KEY_IDIAERESIS),
- BIND_GLOBAL_CONSTANT(KEY_ETH),
- BIND_GLOBAL_CONSTANT(KEY_NTILDE),
- BIND_GLOBAL_CONSTANT(KEY_OGRAVE),
- BIND_GLOBAL_CONSTANT(KEY_OACUTE),
- BIND_GLOBAL_CONSTANT(KEY_OCIRCUMFLEX),
- BIND_GLOBAL_CONSTANT(KEY_OTILDE),
- BIND_GLOBAL_CONSTANT(KEY_ODIAERESIS),
- BIND_GLOBAL_CONSTANT(KEY_MULTIPLY),
- BIND_GLOBAL_CONSTANT(KEY_OOBLIQUE),
- BIND_GLOBAL_CONSTANT(KEY_UGRAVE),
- BIND_GLOBAL_CONSTANT(KEY_UACUTE),
- BIND_GLOBAL_CONSTANT(KEY_UCIRCUMFLEX),
- BIND_GLOBAL_CONSTANT(KEY_UDIAERESIS),
- BIND_GLOBAL_CONSTANT(KEY_YACUTE),
- BIND_GLOBAL_CONSTANT(KEY_THORN),
- BIND_GLOBAL_CONSTANT(KEY_SSHARP),
-
- BIND_GLOBAL_CONSTANT(KEY_DIVISION),
- BIND_GLOBAL_CONSTANT(KEY_YDIAERESIS),
-
- BIND_GLOBAL_CONSTANT(KEY_CODE_MASK),
- BIND_GLOBAL_CONSTANT(KEY_MODIFIER_MASK),
-
- BIND_GLOBAL_CONSTANT(KEY_MASK_SHIFT),
- BIND_GLOBAL_CONSTANT(KEY_MASK_ALT),
- BIND_GLOBAL_CONSTANT(KEY_MASK_META),
- BIND_GLOBAL_CONSTANT(KEY_MASK_CTRL),
- BIND_GLOBAL_CONSTANT(KEY_MASK_CMD),
- BIND_GLOBAL_CONSTANT(KEY_MASK_KPAD),
- BIND_GLOBAL_CONSTANT(KEY_MASK_GROUP_SWITCH),
+ BIND_GLOBAL_CONSTANT(SPKEY);
+
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_ESCAPE);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_TAB);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_BACKTAB);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_BACKSPACE);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_ENTER);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_KP_ENTER);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_INSERT);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_DELETE);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_PAUSE);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_PRINT);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_SYSREQ);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_CLEAR);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_HOME);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_END);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_LEFT);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_UP);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_RIGHT);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_DOWN);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_PAGEUP);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_PAGEDOWN);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_SHIFT);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_CONTROL);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_META);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_ALT);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_CAPSLOCK);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_NUMLOCK);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_SCROLLLOCK);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_F1);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_F2);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_F3);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_F4);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_F5);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_F6);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_F7);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_F8);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_F9);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_F10);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_F11);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_F12);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_F13);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_F14);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_F15);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_F16);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_KP_MULTIPLY);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_KP_DIVIDE);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_KP_SUBTRACT);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_KP_PERIOD);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_KP_ADD);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_KP_0);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_KP_1);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_KP_2);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_KP_3);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_KP_4);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_KP_5);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_KP_6);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_KP_7);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_KP_8);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_KP_9);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_SUPER_L);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_SUPER_R);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_MENU);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_HYPER_L);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_HYPER_R);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_HELP);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_DIRECTION_L);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_DIRECTION_R);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_BACK);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_FORWARD);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_STOP);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_REFRESH);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_VOLUMEDOWN);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_VOLUMEMUTE);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_VOLUMEUP);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_BASSBOOST);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_BASSUP);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_BASSDOWN);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_TREBLEUP);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_TREBLEDOWN);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_MEDIAPLAY);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_MEDIASTOP);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_MEDIAPREVIOUS);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_MEDIANEXT);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_MEDIARECORD);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_HOMEPAGE);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_FAVORITES);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_SEARCH);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_STANDBY);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_OPENURL);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_LAUNCHMAIL);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_LAUNCHMEDIA);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_LAUNCH0);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_LAUNCH1);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_LAUNCH2);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_LAUNCH3);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_LAUNCH4);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_LAUNCH5);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_LAUNCH6);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_LAUNCH7);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_LAUNCH8);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_LAUNCH9);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_LAUNCHA);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_LAUNCHB);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_LAUNCHC);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_LAUNCHD);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_LAUNCHE);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_LAUNCHF);
+
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_UNKNOWN);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_SPACE);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_EXCLAM);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_QUOTEDBL);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_NUMBERSIGN);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_DOLLAR);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_PERCENT);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_AMPERSAND);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_APOSTROPHE);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_PARENLEFT);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_PARENRIGHT);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_ASTERISK);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_PLUS);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_COMMA);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_MINUS);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_PERIOD);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_SLASH);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_0);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_1);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_2);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_3);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_4);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_5);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_6);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_7);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_8);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_9);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_COLON);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_SEMICOLON);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_LESS);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_EQUAL);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_GREATER);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_QUESTION);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_AT);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_A);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_B);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_C);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_D);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_E);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_F);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_G);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_H);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_I);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_J);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_K);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_L);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_M);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_N);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_O);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_P);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_Q);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_R);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_S);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_T);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_U);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_V);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_W);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_X);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_Y);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_Z);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_BRACKETLEFT);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_BACKSLASH);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_BRACKETRIGHT);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_ASCIICIRCUM);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_UNDERSCORE);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_QUOTELEFT);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_BRACELEFT);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_BAR);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_BRACERIGHT);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_ASCIITILDE);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_NOBREAKSPACE);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_EXCLAMDOWN);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_CENT);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_STERLING);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_CURRENCY);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_YEN);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_BROKENBAR);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_SECTION);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_DIAERESIS);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_COPYRIGHT);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_ORDFEMININE);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_GUILLEMOTLEFT);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_NOTSIGN);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_HYPHEN);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_REGISTERED);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_MACRON);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_DEGREE);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_PLUSMINUS);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_TWOSUPERIOR);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_THREESUPERIOR);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_ACUTE);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_MU);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_PARAGRAPH);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_PERIODCENTERED);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_CEDILLA);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_ONESUPERIOR);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_MASCULINE);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_GUILLEMOTRIGHT);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_ONEQUARTER);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_ONEHALF);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_THREEQUARTERS);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_QUESTIONDOWN);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_AGRAVE);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_AACUTE);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_ACIRCUMFLEX);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_ATILDE);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_ADIAERESIS);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_ARING);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_AE);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_CCEDILLA);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_EGRAVE);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_EACUTE);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_ECIRCUMFLEX);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_EDIAERESIS);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_IGRAVE);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_IACUTE);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_ICIRCUMFLEX);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_IDIAERESIS);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_ETH);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_NTILDE);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_OGRAVE);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_OACUTE);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_OCIRCUMFLEX);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_OTILDE);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_ODIAERESIS);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_MULTIPLY);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_OOBLIQUE);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_UGRAVE);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_UACUTE);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_UCIRCUMFLEX);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_UDIAERESIS);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_YACUTE);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_THORN);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_SSHARP);
+
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_DIVISION);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_YDIAERESIS);
+
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_CODE_MASK);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_MODIFIER_MASK);
+
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_MASK_SHIFT);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_MASK_ALT);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_MASK_META);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_MASK_CTRL);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_MASK_CMD);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_MASK_KPAD);
+ BIND_GLOBAL_ENUM_CONSTANT(KEY_MASK_GROUP_SWITCH);
// mouse
- BIND_GLOBAL_CONSTANT(BUTTON_LEFT),
- BIND_GLOBAL_CONSTANT(BUTTON_RIGHT),
- BIND_GLOBAL_CONSTANT(BUTTON_MIDDLE),
- BIND_GLOBAL_CONSTANT(BUTTON_WHEEL_UP),
- BIND_GLOBAL_CONSTANT(BUTTON_WHEEL_DOWN),
- BIND_GLOBAL_CONSTANT(BUTTON_WHEEL_LEFT),
- BIND_GLOBAL_CONSTANT(BUTTON_WHEEL_RIGHT),
- BIND_GLOBAL_CONSTANT(BUTTON_MASK_LEFT),
- BIND_GLOBAL_CONSTANT(BUTTON_MASK_RIGHT),
- BIND_GLOBAL_CONSTANT(BUTTON_MASK_MIDDLE),
+ BIND_GLOBAL_CONSTANT(BUTTON_LEFT);
+ BIND_GLOBAL_CONSTANT(BUTTON_RIGHT);
+ BIND_GLOBAL_CONSTANT(BUTTON_MIDDLE);
+ BIND_GLOBAL_CONSTANT(BUTTON_WHEEL_UP);
+ BIND_GLOBAL_CONSTANT(BUTTON_WHEEL_DOWN);
+ BIND_GLOBAL_CONSTANT(BUTTON_WHEEL_LEFT);
+ BIND_GLOBAL_CONSTANT(BUTTON_WHEEL_RIGHT);
+ BIND_GLOBAL_CONSTANT(BUTTON_MASK_LEFT);
+ BIND_GLOBAL_CONSTANT(BUTTON_MASK_RIGHT);
+ BIND_GLOBAL_CONSTANT(BUTTON_MASK_MIDDLE);
//joypads
- BIND_GLOBAL_CONSTANT(JOY_BUTTON_0),
- BIND_GLOBAL_CONSTANT(JOY_BUTTON_1),
- BIND_GLOBAL_CONSTANT(JOY_BUTTON_2),
- BIND_GLOBAL_CONSTANT(JOY_BUTTON_3),
- BIND_GLOBAL_CONSTANT(JOY_BUTTON_4),
- BIND_GLOBAL_CONSTANT(JOY_BUTTON_5),
- BIND_GLOBAL_CONSTANT(JOY_BUTTON_6),
- BIND_GLOBAL_CONSTANT(JOY_BUTTON_7),
- BIND_GLOBAL_CONSTANT(JOY_BUTTON_8),
- BIND_GLOBAL_CONSTANT(JOY_BUTTON_9),
- BIND_GLOBAL_CONSTANT(JOY_BUTTON_10),
- BIND_GLOBAL_CONSTANT(JOY_BUTTON_11),
- BIND_GLOBAL_CONSTANT(JOY_BUTTON_12),
- BIND_GLOBAL_CONSTANT(JOY_BUTTON_13),
- BIND_GLOBAL_CONSTANT(JOY_BUTTON_14),
- BIND_GLOBAL_CONSTANT(JOY_BUTTON_15),
- BIND_GLOBAL_CONSTANT(JOY_BUTTON_MAX),
-
- BIND_GLOBAL_CONSTANT(JOY_SONY_CIRCLE),
- BIND_GLOBAL_CONSTANT(JOY_SONY_X),
- BIND_GLOBAL_CONSTANT(JOY_SONY_SQUARE),
- BIND_GLOBAL_CONSTANT(JOY_SONY_TRIANGLE),
-
- BIND_GLOBAL_CONSTANT(JOY_XBOX_B),
- BIND_GLOBAL_CONSTANT(JOY_XBOX_A),
- BIND_GLOBAL_CONSTANT(JOY_XBOX_X),
- BIND_GLOBAL_CONSTANT(JOY_XBOX_Y),
-
- BIND_GLOBAL_CONSTANT(JOY_DS_A),
- BIND_GLOBAL_CONSTANT(JOY_DS_B),
- BIND_GLOBAL_CONSTANT(JOY_DS_X),
- BIND_GLOBAL_CONSTANT(JOY_DS_Y),
-
- BIND_GLOBAL_CONSTANT(JOY_SELECT),
- BIND_GLOBAL_CONSTANT(JOY_START),
- BIND_GLOBAL_CONSTANT(JOY_DPAD_UP),
- BIND_GLOBAL_CONSTANT(JOY_DPAD_DOWN),
- BIND_GLOBAL_CONSTANT(JOY_DPAD_LEFT),
- BIND_GLOBAL_CONSTANT(JOY_DPAD_RIGHT),
- BIND_GLOBAL_CONSTANT(JOY_L),
- BIND_GLOBAL_CONSTANT(JOY_L2),
- BIND_GLOBAL_CONSTANT(JOY_L3),
- BIND_GLOBAL_CONSTANT(JOY_R),
- BIND_GLOBAL_CONSTANT(JOY_R2),
- BIND_GLOBAL_CONSTANT(JOY_R3),
-
- BIND_GLOBAL_CONSTANT(JOY_AXIS_0),
- BIND_GLOBAL_CONSTANT(JOY_AXIS_1),
- BIND_GLOBAL_CONSTANT(JOY_AXIS_2),
- BIND_GLOBAL_CONSTANT(JOY_AXIS_3),
- BIND_GLOBAL_CONSTANT(JOY_AXIS_4),
- BIND_GLOBAL_CONSTANT(JOY_AXIS_5),
- BIND_GLOBAL_CONSTANT(JOY_AXIS_6),
- BIND_GLOBAL_CONSTANT(JOY_AXIS_7),
- BIND_GLOBAL_CONSTANT(JOY_AXIS_MAX),
-
- BIND_GLOBAL_CONSTANT(JOY_ANALOG_LX),
- BIND_GLOBAL_CONSTANT(JOY_ANALOG_LY),
-
- BIND_GLOBAL_CONSTANT(JOY_ANALOG_RX),
- BIND_GLOBAL_CONSTANT(JOY_ANALOG_RY),
-
- BIND_GLOBAL_CONSTANT(JOY_ANALOG_L2),
- BIND_GLOBAL_CONSTANT(JOY_ANALOG_R2),
+ BIND_GLOBAL_CONSTANT(JOY_BUTTON_0);
+ BIND_GLOBAL_CONSTANT(JOY_BUTTON_1);
+ BIND_GLOBAL_CONSTANT(JOY_BUTTON_2);
+ BIND_GLOBAL_CONSTANT(JOY_BUTTON_3);
+ BIND_GLOBAL_CONSTANT(JOY_BUTTON_4);
+ BIND_GLOBAL_CONSTANT(JOY_BUTTON_5);
+ BIND_GLOBAL_CONSTANT(JOY_BUTTON_6);
+ BIND_GLOBAL_CONSTANT(JOY_BUTTON_7);
+ BIND_GLOBAL_CONSTANT(JOY_BUTTON_8);
+ BIND_GLOBAL_CONSTANT(JOY_BUTTON_9);
+ BIND_GLOBAL_CONSTANT(JOY_BUTTON_10);
+ BIND_GLOBAL_CONSTANT(JOY_BUTTON_11);
+ BIND_GLOBAL_CONSTANT(JOY_BUTTON_12);
+ BIND_GLOBAL_CONSTANT(JOY_BUTTON_13);
+ BIND_GLOBAL_CONSTANT(JOY_BUTTON_14);
+ BIND_GLOBAL_CONSTANT(JOY_BUTTON_15);
+ BIND_GLOBAL_CONSTANT(JOY_BUTTON_MAX);
+
+ BIND_GLOBAL_CONSTANT(JOY_SONY_CIRCLE);
+ BIND_GLOBAL_CONSTANT(JOY_SONY_X);
+ BIND_GLOBAL_CONSTANT(JOY_SONY_SQUARE);
+ BIND_GLOBAL_CONSTANT(JOY_SONY_TRIANGLE);
+
+ BIND_GLOBAL_CONSTANT(JOY_XBOX_B);
+ BIND_GLOBAL_CONSTANT(JOY_XBOX_A);
+ BIND_GLOBAL_CONSTANT(JOY_XBOX_X);
+ BIND_GLOBAL_CONSTANT(JOY_XBOX_Y);
+
+ BIND_GLOBAL_CONSTANT(JOY_DS_A);
+ BIND_GLOBAL_CONSTANT(JOY_DS_B);
+ BIND_GLOBAL_CONSTANT(JOY_DS_X);
+ BIND_GLOBAL_CONSTANT(JOY_DS_Y);
+
+ BIND_GLOBAL_CONSTANT(JOY_SELECT);
+ BIND_GLOBAL_CONSTANT(JOY_START);
+ BIND_GLOBAL_CONSTANT(JOY_DPAD_UP);
+ BIND_GLOBAL_CONSTANT(JOY_DPAD_DOWN);
+ BIND_GLOBAL_CONSTANT(JOY_DPAD_LEFT);
+ BIND_GLOBAL_CONSTANT(JOY_DPAD_RIGHT);
+ BIND_GLOBAL_CONSTANT(JOY_L);
+ BIND_GLOBAL_CONSTANT(JOY_L2);
+ BIND_GLOBAL_CONSTANT(JOY_L3);
+ BIND_GLOBAL_CONSTANT(JOY_R);
+ BIND_GLOBAL_CONSTANT(JOY_R2);
+ BIND_GLOBAL_CONSTANT(JOY_R3);
+
+ BIND_GLOBAL_CONSTANT(JOY_AXIS_0);
+ BIND_GLOBAL_CONSTANT(JOY_AXIS_1);
+ BIND_GLOBAL_CONSTANT(JOY_AXIS_2);
+ BIND_GLOBAL_CONSTANT(JOY_AXIS_3);
+ BIND_GLOBAL_CONSTANT(JOY_AXIS_4);
+ BIND_GLOBAL_CONSTANT(JOY_AXIS_5);
+ BIND_GLOBAL_CONSTANT(JOY_AXIS_6);
+ BIND_GLOBAL_CONSTANT(JOY_AXIS_7);
+ BIND_GLOBAL_CONSTANT(JOY_AXIS_MAX);
+
+ BIND_GLOBAL_CONSTANT(JOY_ANALOG_LX);
+ BIND_GLOBAL_CONSTANT(JOY_ANALOG_LY);
+
+ BIND_GLOBAL_CONSTANT(JOY_ANALOG_RX);
+ BIND_GLOBAL_CONSTANT(JOY_ANALOG_RY);
+
+ BIND_GLOBAL_CONSTANT(JOY_ANALOG_L2);
+ BIND_GLOBAL_CONSTANT(JOY_ANALOG_R2);
// error list
- BIND_GLOBAL_CONSTANT(OK),
- BIND_GLOBAL_CONSTANT(FAILED), ///< Generic fail error
- BIND_GLOBAL_CONSTANT(ERR_UNAVAILABLE), ///< What is requested is unsupported/unavailable
- BIND_GLOBAL_CONSTANT(ERR_UNCONFIGURED), ///< The object being used hasn't been properly set up yet
- BIND_GLOBAL_CONSTANT(ERR_UNAUTHORIZED), ///< Missing credentials for requested resource
- BIND_GLOBAL_CONSTANT(ERR_PARAMETER_RANGE_ERROR), ///< Parameter given out of range
- BIND_GLOBAL_CONSTANT(ERR_OUT_OF_MEMORY), ///< Out of memory
- BIND_GLOBAL_CONSTANT(ERR_FILE_NOT_FOUND),
- BIND_GLOBAL_CONSTANT(ERR_FILE_BAD_DRIVE),
- BIND_GLOBAL_CONSTANT(ERR_FILE_BAD_PATH),
- BIND_GLOBAL_CONSTANT(ERR_FILE_NO_PERMISSION),
- BIND_GLOBAL_CONSTANT(ERR_FILE_ALREADY_IN_USE),
- BIND_GLOBAL_CONSTANT(ERR_FILE_CANT_OPEN),
- BIND_GLOBAL_CONSTANT(ERR_FILE_CANT_WRITE),
- BIND_GLOBAL_CONSTANT(ERR_FILE_CANT_READ),
- BIND_GLOBAL_CONSTANT(ERR_FILE_UNRECOGNIZED),
- BIND_GLOBAL_CONSTANT(ERR_FILE_CORRUPT),
- BIND_GLOBAL_CONSTANT(ERR_FILE_MISSING_DEPENDENCIES),
- BIND_GLOBAL_CONSTANT(ERR_FILE_EOF),
- BIND_GLOBAL_CONSTANT(ERR_CANT_OPEN), ///< Can't open a resource/socket/file
- BIND_GLOBAL_CONSTANT(ERR_CANT_CREATE),
- BIND_GLOBAL_CONSTANT(ERR_PARSE_ERROR),
- BIND_GLOBAL_CONSTANT(ERR_QUERY_FAILED),
- BIND_GLOBAL_CONSTANT(ERR_ALREADY_IN_USE),
- BIND_GLOBAL_CONSTANT(ERR_LOCKED), ///< resource is locked
- BIND_GLOBAL_CONSTANT(ERR_TIMEOUT),
- BIND_GLOBAL_CONSTANT(ERR_CANT_AQUIRE_RESOURCE),
- BIND_GLOBAL_CONSTANT(ERR_INVALID_DATA), ///< Data passed is invalid
- BIND_GLOBAL_CONSTANT(ERR_INVALID_PARAMETER), ///< Parameter passed is invalid
- BIND_GLOBAL_CONSTANT(ERR_ALREADY_EXISTS), ///< When adding ), item already exists
- BIND_GLOBAL_CONSTANT(ERR_DOES_NOT_EXIST), ///< When retrieving/erasing ), it item does not exist
- BIND_GLOBAL_CONSTANT(ERR_DATABASE_CANT_READ), ///< database is full
- BIND_GLOBAL_CONSTANT(ERR_DATABASE_CANT_WRITE), ///< database is full
- BIND_GLOBAL_CONSTANT(ERR_COMPILATION_FAILED),
- BIND_GLOBAL_CONSTANT(ERR_METHOD_NOT_FOUND),
- BIND_GLOBAL_CONSTANT(ERR_LINK_FAILED),
- BIND_GLOBAL_CONSTANT(ERR_SCRIPT_FAILED),
- BIND_GLOBAL_CONSTANT(ERR_CYCLIC_LINK),
- BIND_GLOBAL_CONSTANT(ERR_BUSY),
- BIND_GLOBAL_CONSTANT(ERR_HELP), ///< user requested help!!
- BIND_GLOBAL_CONSTANT(ERR_BUG), ///< a bug in the software certainly happened ), due to a double check failing or unexpected behavior.
- BIND_GLOBAL_CONSTANT(ERR_WTF),
-
- BIND_GLOBAL_CONSTANT(PROPERTY_HINT_NONE),
- BIND_GLOBAL_CONSTANT(PROPERTY_HINT_RANGE),
- BIND_GLOBAL_CONSTANT(PROPERTY_HINT_EXP_RANGE),
- BIND_GLOBAL_CONSTANT(PROPERTY_HINT_ENUM),
- BIND_GLOBAL_CONSTANT(PROPERTY_HINT_EXP_EASING),
- BIND_GLOBAL_CONSTANT(PROPERTY_HINT_LENGTH),
- BIND_GLOBAL_CONSTANT(PROPERTY_HINT_KEY_ACCEL),
- BIND_GLOBAL_CONSTANT(PROPERTY_HINT_FLAGS),
-
- BIND_GLOBAL_CONSTANT(PROPERTY_HINT_LAYERS_2D_RENDER),
- BIND_GLOBAL_CONSTANT(PROPERTY_HINT_LAYERS_2D_PHYSICS),
- BIND_GLOBAL_CONSTANT(PROPERTY_HINT_LAYERS_3D_RENDER),
- BIND_GLOBAL_CONSTANT(PROPERTY_HINT_LAYERS_3D_PHYSICS),
-
- BIND_GLOBAL_CONSTANT(PROPERTY_HINT_FILE),
- BIND_GLOBAL_CONSTANT(PROPERTY_HINT_DIR),
- BIND_GLOBAL_CONSTANT(PROPERTY_HINT_GLOBAL_FILE),
- BIND_GLOBAL_CONSTANT(PROPERTY_HINT_GLOBAL_DIR),
- BIND_GLOBAL_CONSTANT(PROPERTY_HINT_RESOURCE_TYPE),
- BIND_GLOBAL_CONSTANT(PROPERTY_HINT_MULTILINE_TEXT),
- BIND_GLOBAL_CONSTANT(PROPERTY_HINT_COLOR_NO_ALPHA),
- BIND_GLOBAL_CONSTANT(PROPERTY_HINT_IMAGE_COMPRESS_LOSSY),
- BIND_GLOBAL_CONSTANT(PROPERTY_HINT_IMAGE_COMPRESS_LOSSLESS),
-
- BIND_GLOBAL_CONSTANT(PROPERTY_USAGE_STORAGE),
- BIND_GLOBAL_CONSTANT(PROPERTY_USAGE_EDITOR),
- BIND_GLOBAL_CONSTANT(PROPERTY_USAGE_NETWORK),
-
- BIND_GLOBAL_CONSTANT(PROPERTY_USAGE_EDITOR_HELPER),
- BIND_GLOBAL_CONSTANT(PROPERTY_USAGE_CHECKABLE),
- BIND_GLOBAL_CONSTANT(PROPERTY_USAGE_CHECKED),
- BIND_GLOBAL_CONSTANT(PROPERTY_USAGE_INTERNATIONALIZED),
- BIND_GLOBAL_CONSTANT(PROPERTY_USAGE_GROUP),
- BIND_GLOBAL_CONSTANT(PROPERTY_USAGE_CATEGORY),
- BIND_GLOBAL_CONSTANT(PROPERTY_USAGE_STORE_IF_NONZERO),
- BIND_GLOBAL_CONSTANT(PROPERTY_USAGE_STORE_IF_NONONE),
- BIND_GLOBAL_CONSTANT(PROPERTY_USAGE_NO_INSTANCE_STATE),
- BIND_GLOBAL_CONSTANT(PROPERTY_USAGE_RESTART_IF_CHANGED),
- BIND_GLOBAL_CONSTANT(PROPERTY_USAGE_SCRIPT_VARIABLE),
-
- BIND_GLOBAL_CONSTANT(PROPERTY_USAGE_DEFAULT),
- BIND_GLOBAL_CONSTANT(PROPERTY_USAGE_DEFAULT_INTL),
- BIND_GLOBAL_CONSTANT(PROPERTY_USAGE_NOEDITOR),
-
- BIND_GLOBAL_CONSTANT(METHOD_FLAG_NORMAL),
- BIND_GLOBAL_CONSTANT(METHOD_FLAG_EDITOR),
- BIND_GLOBAL_CONSTANT(METHOD_FLAG_NOSCRIPT),
- BIND_GLOBAL_CONSTANT(METHOD_FLAG_CONST),
- BIND_GLOBAL_CONSTANT(METHOD_FLAG_REVERSE),
- BIND_GLOBAL_CONSTANT(METHOD_FLAG_VIRTUAL),
- BIND_GLOBAL_CONSTANT(METHOD_FLAG_FROM_SCRIPT),
- BIND_GLOBAL_CONSTANT(METHOD_FLAGS_DEFAULT),
-
- { "TYPE_NIL", Variant::NIL },
- { "TYPE_BOOL", Variant::BOOL },
- { "TYPE_INT", Variant::INT },
- { "TYPE_REAL", Variant::REAL },
- { "TYPE_STRING", Variant::STRING },
- { "TYPE_VECTOR2", Variant::VECTOR2 }, // 5
- { "TYPE_RECT2", Variant::RECT2 },
- { "TYPE_VECTOR3", Variant::VECTOR3 },
- { "TYPE_TRANSFORM2D", Variant::TRANSFORM2D },
- { "TYPE_PLANE", Variant::PLANE },
- { "TYPE_QUAT", Variant::QUAT }, // 10
- { "TYPE_RECT3", Variant::RECT3 },
- { "TYPE_BASIS", Variant::BASIS },
- { "TYPE_TRANSFORM", Variant::TRANSFORM },
- { "TYPE_COLOR", Variant::COLOR },
- { "TYPE_NODE_PATH", Variant::NODE_PATH }, // 15
- { "TYPE_RID", Variant::_RID },
- { "TYPE_OBJECT", Variant::OBJECT },
- { "TYPE_DICTIONARY", Variant::DICTIONARY }, // 20
- { "TYPE_ARRAY", Variant::ARRAY },
- { "TYPE_RAW_ARRAY", Variant::POOL_BYTE_ARRAY },
- { "TYPE_INT_ARRAY", Variant::POOL_INT_ARRAY },
- { "TYPE_REAL_ARRAY", Variant::POOL_REAL_ARRAY },
- { "TYPE_STRING_ARRAY", Variant::POOL_STRING_ARRAY },
- { "TYPE_VECTOR2_ARRAY", Variant::POOL_VECTOR2_ARRAY }, // 25
- { "TYPE_VECTOR3_ARRAY", Variant::POOL_VECTOR3_ARRAY },
- { "TYPE_COLOR_ARRAY", Variant::POOL_COLOR_ARRAY },
- { "TYPE_MAX", Variant::VARIANT_MAX },
- { NULL, 0 }
+ BIND_GLOBAL_ENUM_CONSTANT(OK);
+ BIND_GLOBAL_ENUM_CONSTANT(FAILED); ///< Generic fail error
+ BIND_GLOBAL_ENUM_CONSTANT(ERR_UNAVAILABLE); ///< What is requested is unsupported/unavailable
+ BIND_GLOBAL_ENUM_CONSTANT(ERR_UNCONFIGURED); ///< The object being used hasn't been properly set up yet
+ BIND_GLOBAL_ENUM_CONSTANT(ERR_UNAUTHORIZED); ///< Missing credentials for requested resource
+ BIND_GLOBAL_ENUM_CONSTANT(ERR_PARAMETER_RANGE_ERROR); ///< Parameter given out of range
+ BIND_GLOBAL_ENUM_CONSTANT(ERR_OUT_OF_MEMORY); ///< Out of memory
+ BIND_GLOBAL_ENUM_CONSTANT(ERR_FILE_NOT_FOUND);
+ BIND_GLOBAL_ENUM_CONSTANT(ERR_FILE_BAD_DRIVE);
+ BIND_GLOBAL_ENUM_CONSTANT(ERR_FILE_BAD_PATH);
+ BIND_GLOBAL_ENUM_CONSTANT(ERR_FILE_NO_PERMISSION);
+ BIND_GLOBAL_ENUM_CONSTANT(ERR_FILE_ALREADY_IN_USE);
+ BIND_GLOBAL_ENUM_CONSTANT(ERR_FILE_CANT_OPEN);
+ BIND_GLOBAL_ENUM_CONSTANT(ERR_FILE_CANT_WRITE);
+ BIND_GLOBAL_ENUM_CONSTANT(ERR_FILE_CANT_READ);
+ BIND_GLOBAL_ENUM_CONSTANT(ERR_FILE_UNRECOGNIZED);
+ BIND_GLOBAL_ENUM_CONSTANT(ERR_FILE_CORRUPT);
+ BIND_GLOBAL_ENUM_CONSTANT(ERR_FILE_MISSING_DEPENDENCIES);
+ BIND_GLOBAL_ENUM_CONSTANT(ERR_FILE_EOF);
+ BIND_GLOBAL_ENUM_CONSTANT(ERR_CANT_OPEN); ///< Can't open a resource/socket/file
+ BIND_GLOBAL_ENUM_CONSTANT(ERR_CANT_CREATE);
+ BIND_GLOBAL_ENUM_CONSTANT(ERR_PARSE_ERROR);
+ BIND_GLOBAL_ENUM_CONSTANT(ERR_QUERY_FAILED);
+ BIND_GLOBAL_ENUM_CONSTANT(ERR_ALREADY_IN_USE);
+ BIND_GLOBAL_ENUM_CONSTANT(ERR_LOCKED); ///< resource is locked
+ BIND_GLOBAL_ENUM_CONSTANT(ERR_TIMEOUT);
+ BIND_GLOBAL_ENUM_CONSTANT(ERR_CANT_AQUIRE_RESOURCE);
+ BIND_GLOBAL_ENUM_CONSTANT(ERR_INVALID_DATA); ///< Data passed is invalid
+ BIND_GLOBAL_ENUM_CONSTANT(ERR_INVALID_PARAMETER); ///< Parameter passed is invalid
+ BIND_GLOBAL_ENUM_CONSTANT(ERR_ALREADY_EXISTS); ///< When adding ), item already exists
+ BIND_GLOBAL_ENUM_CONSTANT(ERR_DOES_NOT_EXIST); ///< When retrieving/erasing ), it item does not exist
+ BIND_GLOBAL_ENUM_CONSTANT(ERR_DATABASE_CANT_READ); ///< database is full
+ BIND_GLOBAL_ENUM_CONSTANT(ERR_DATABASE_CANT_WRITE); ///< database is full
+ BIND_GLOBAL_ENUM_CONSTANT(ERR_COMPILATION_FAILED);
+ BIND_GLOBAL_ENUM_CONSTANT(ERR_METHOD_NOT_FOUND);
+ BIND_GLOBAL_ENUM_CONSTANT(ERR_LINK_FAILED);
+ BIND_GLOBAL_ENUM_CONSTANT(ERR_SCRIPT_FAILED);
+ BIND_GLOBAL_ENUM_CONSTANT(ERR_CYCLIC_LINK);
+ BIND_GLOBAL_ENUM_CONSTANT(ERR_BUSY);
+ BIND_GLOBAL_ENUM_CONSTANT(ERR_HELP); ///< user requested help!!
+ BIND_GLOBAL_ENUM_CONSTANT(ERR_BUG); ///< a bug in the software certainly happened ), due to a double check failing or unexpected behavior.
+ BIND_GLOBAL_ENUM_CONSTANT(ERR_WTF);
+
+ BIND_GLOBAL_ENUM_CONSTANT(PROPERTY_HINT_NONE);
+ BIND_GLOBAL_ENUM_CONSTANT(PROPERTY_HINT_RANGE);
+ BIND_GLOBAL_ENUM_CONSTANT(PROPERTY_HINT_EXP_RANGE);
+ BIND_GLOBAL_ENUM_CONSTANT(PROPERTY_HINT_ENUM);
+ BIND_GLOBAL_ENUM_CONSTANT(PROPERTY_HINT_EXP_EASING);
+ BIND_GLOBAL_ENUM_CONSTANT(PROPERTY_HINT_LENGTH);
+ BIND_GLOBAL_ENUM_CONSTANT(PROPERTY_HINT_KEY_ACCEL);
+ BIND_GLOBAL_ENUM_CONSTANT(PROPERTY_HINT_FLAGS);
+
+ BIND_GLOBAL_ENUM_CONSTANT(PROPERTY_HINT_LAYERS_2D_RENDER);
+ BIND_GLOBAL_ENUM_CONSTANT(PROPERTY_HINT_LAYERS_2D_PHYSICS);
+ BIND_GLOBAL_ENUM_CONSTANT(PROPERTY_HINT_LAYERS_3D_RENDER);
+ BIND_GLOBAL_ENUM_CONSTANT(PROPERTY_HINT_LAYERS_3D_PHYSICS);
+
+ BIND_GLOBAL_ENUM_CONSTANT(PROPERTY_HINT_FILE);
+ BIND_GLOBAL_ENUM_CONSTANT(PROPERTY_HINT_DIR);
+ BIND_GLOBAL_ENUM_CONSTANT(PROPERTY_HINT_GLOBAL_FILE);
+ BIND_GLOBAL_ENUM_CONSTANT(PROPERTY_HINT_GLOBAL_DIR);
+ BIND_GLOBAL_ENUM_CONSTANT(PROPERTY_HINT_RESOURCE_TYPE);
+ BIND_GLOBAL_ENUM_CONSTANT(PROPERTY_HINT_MULTILINE_TEXT);
+ BIND_GLOBAL_ENUM_CONSTANT(PROPERTY_HINT_COLOR_NO_ALPHA);
+ BIND_GLOBAL_ENUM_CONSTANT(PROPERTY_HINT_IMAGE_COMPRESS_LOSSY);
+ BIND_GLOBAL_ENUM_CONSTANT(PROPERTY_HINT_IMAGE_COMPRESS_LOSSLESS);
+
+ BIND_GLOBAL_ENUM_CONSTANT(PROPERTY_USAGE_STORAGE);
+ BIND_GLOBAL_ENUM_CONSTANT(PROPERTY_USAGE_EDITOR);
+ BIND_GLOBAL_ENUM_CONSTANT(PROPERTY_USAGE_NETWORK);
+
+ BIND_GLOBAL_ENUM_CONSTANT(PROPERTY_USAGE_EDITOR_HELPER);
+ BIND_GLOBAL_ENUM_CONSTANT(PROPERTY_USAGE_CHECKABLE);
+ BIND_GLOBAL_ENUM_CONSTANT(PROPERTY_USAGE_CHECKED);
+ BIND_GLOBAL_ENUM_CONSTANT(PROPERTY_USAGE_INTERNATIONALIZED);
+ BIND_GLOBAL_ENUM_CONSTANT(PROPERTY_USAGE_GROUP);
+ BIND_GLOBAL_ENUM_CONSTANT(PROPERTY_USAGE_CATEGORY);
+ BIND_GLOBAL_ENUM_CONSTANT(PROPERTY_USAGE_STORE_IF_NONZERO);
+ BIND_GLOBAL_ENUM_CONSTANT(PROPERTY_USAGE_STORE_IF_NONONE);
+ BIND_GLOBAL_ENUM_CONSTANT(PROPERTY_USAGE_NO_INSTANCE_STATE);
+ BIND_GLOBAL_ENUM_CONSTANT(PROPERTY_USAGE_RESTART_IF_CHANGED);
+ BIND_GLOBAL_ENUM_CONSTANT(PROPERTY_USAGE_SCRIPT_VARIABLE);
+
+ BIND_GLOBAL_ENUM_CONSTANT(PROPERTY_USAGE_DEFAULT);
+ BIND_GLOBAL_ENUM_CONSTANT(PROPERTY_USAGE_DEFAULT_INTL);
+ BIND_GLOBAL_ENUM_CONSTANT(PROPERTY_USAGE_NOEDITOR);
+
+ BIND_GLOBAL_ENUM_CONSTANT(METHOD_FLAG_NORMAL);
+ BIND_GLOBAL_ENUM_CONSTANT(METHOD_FLAG_EDITOR);
+ BIND_GLOBAL_ENUM_CONSTANT(METHOD_FLAG_NOSCRIPT);
+ BIND_GLOBAL_ENUM_CONSTANT(METHOD_FLAG_CONST);
+ BIND_GLOBAL_ENUM_CONSTANT(METHOD_FLAG_REVERSE);
+ BIND_GLOBAL_ENUM_CONSTANT(METHOD_FLAG_VIRTUAL);
+ BIND_GLOBAL_ENUM_CONSTANT(METHOD_FLAG_FROM_SCRIPT);
+ BIND_GLOBAL_ENUM_CONSTANT(METHOD_FLAGS_DEFAULT);
+
+ BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_NIL", Variant::NIL);
+ BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_BOOL", Variant::BOOL);
+ BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_INT", Variant::INT);
+ BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_REAL", Variant::REAL);
+ BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_STRING", Variant::STRING);
+ BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_VECTOR2", Variant::VECTOR2); // 5
+ BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_RECT2", Variant::RECT2);
+ BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_VECTOR3", Variant::VECTOR3);
+ BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_TRANSFORM2D", Variant::TRANSFORM2D);
+ BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_PLANE", Variant::PLANE);
+ BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_QUAT", Variant::QUAT); // 10
+ BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_RECT3", Variant::RECT3);
+ BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_BASIS", Variant::BASIS);
+ BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_TRANSFORM", Variant::TRANSFORM);
+ BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_COLOR", Variant::COLOR);
+ BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_NODE_PATH", Variant::NODE_PATH); // 15
+ BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_RID", Variant::_RID);
+ BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_OBJECT", Variant::OBJECT);
+ BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_DICTIONARY", Variant::DICTIONARY); // 20
+ BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_ARRAY", Variant::ARRAY);
+ BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_RAW_ARRAY", Variant::POOL_BYTE_ARRAY);
+ BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_INT_ARRAY", Variant::POOL_INT_ARRAY);
+ BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_REAL_ARRAY", Variant::POOL_REAL_ARRAY);
+ BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_STRING_ARRAY", Variant::POOL_STRING_ARRAY);
+ BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_VECTOR2_ARRAY", Variant::POOL_VECTOR2_ARRAY); // 25
+ BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_VECTOR3_ARRAY", Variant::POOL_VECTOR3_ARRAY);
+ BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_COLOR_ARRAY", Variant::POOL_COLOR_ARRAY);
+ BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_MAX", Variant::VARIANT_MAX);
+}
-};
+void unregister_global_constants() {
+
+ _global_constants.clear();
+}
int GlobalConstants::get_global_constant_count() {
- int i = 0;
- while (_global_constants[i].name)
- i++;
- return i;
+ return _global_constants.size();
+}
+
+#ifdef DEBUG_METHODS_ENABLED
+StringName GlobalConstants::get_global_constant_enum(int p_idx) {
+
+ return _global_constants[p_idx].enum_name;
+}
+#else
+StringName GlobalConstants::get_global_constant_enum(int p_idx) {
+
+ return StringName();
}
+#endif
const char *GlobalConstants::get_global_constant_name(int p_idx) {
diff --git a/core/global_constants.h b/core/global_constants.h
index f298fc31c7..ad639d0afa 100644
--- a/core/global_constants.h
+++ b/core/global_constants.h
@@ -30,9 +30,12 @@
#ifndef GLOBAL_CONSTANTS_H
#define GLOBAL_CONSTANTS_H
+#include "string_db.h"
+
class GlobalConstants {
public:
static int get_global_constant_count();
+ static StringName get_global_constant_enum(int p_idx);
static const char *get_global_constant_name(int p_idx);
static int get_global_constant_value(int p_idx);
};
diff --git a/core/image.cpp b/core/image.cpp
index 2db9cb1571..91572e44e4 100644
--- a/core/image.cpp
+++ b/core/image.cpp
@@ -676,8 +676,8 @@ void Image::resize_to_po2(bool p_square) {
ERR_FAIL();
}
- int w = nearest_power_of_2(width);
- int h = nearest_power_of_2(height);
+ int w = next_power_of_2(width);
+ int h = next_power_of_2(height);
if (w == width && h == height) {
@@ -1060,7 +1060,7 @@ Error Image::generate_mipmaps() {
PoolVector<uint8_t>::Write wp = data.write();
- if (nearest_power_of_2(width) == uint32_t(width) && nearest_power_of_2(height) == uint32_t(height)) {
+ if (next_power_of_2(width) == uint32_t(width) && next_power_of_2(height) == uint32_t(height)) {
//use fast code for powers of 2
int prev_ofs = 0;
int prev_h = height;
@@ -2275,62 +2275,62 @@ void Image::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::DICTIONARY, "data", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_STORAGE), "_set_data", "_get_data");
- BIND_CONSTANT(FORMAT_L8); //luminance
- BIND_CONSTANT(FORMAT_LA8); //luminance-alpha
- BIND_CONSTANT(FORMAT_R8);
- BIND_CONSTANT(FORMAT_RG8);
- BIND_CONSTANT(FORMAT_RGB8);
- BIND_CONSTANT(FORMAT_RGBA8);
- BIND_CONSTANT(FORMAT_RGBA4444);
- BIND_CONSTANT(FORMAT_RGBA5551);
- BIND_CONSTANT(FORMAT_RF); //float
- BIND_CONSTANT(FORMAT_RGF);
- BIND_CONSTANT(FORMAT_RGBF);
- BIND_CONSTANT(FORMAT_RGBAF);
- BIND_CONSTANT(FORMAT_RH); //half float
- BIND_CONSTANT(FORMAT_RGH);
- BIND_CONSTANT(FORMAT_RGBH);
- BIND_CONSTANT(FORMAT_RGBAH);
- BIND_CONSTANT(FORMAT_RGBE9995);
- BIND_CONSTANT(FORMAT_DXT1); //s3tc bc1
- BIND_CONSTANT(FORMAT_DXT3); //bc2
- BIND_CONSTANT(FORMAT_DXT5); //bc3
- BIND_CONSTANT(FORMAT_RGTC_R);
- BIND_CONSTANT(FORMAT_RGTC_RG);
- BIND_CONSTANT(FORMAT_BPTC_RGBA); //btpc bc6h
- BIND_CONSTANT(FORMAT_BPTC_RGBF); //float /
- BIND_CONSTANT(FORMAT_BPTC_RGBFU); //unsigned float
- BIND_CONSTANT(FORMAT_PVRTC2); //pvrtc
- BIND_CONSTANT(FORMAT_PVRTC2A);
- BIND_CONSTANT(FORMAT_PVRTC4);
- BIND_CONSTANT(FORMAT_PVRTC4A);
- BIND_CONSTANT(FORMAT_ETC); //etc1
- BIND_CONSTANT(FORMAT_ETC2_R11); //etc2
- BIND_CONSTANT(FORMAT_ETC2_R11S); //signed ); NOT srgb.
- BIND_CONSTANT(FORMAT_ETC2_RG11);
- BIND_CONSTANT(FORMAT_ETC2_RG11S);
- BIND_CONSTANT(FORMAT_ETC2_RGB8);
- BIND_CONSTANT(FORMAT_ETC2_RGBA8);
- BIND_CONSTANT(FORMAT_ETC2_RGB8A1);
- BIND_CONSTANT(FORMAT_MAX);
-
- BIND_CONSTANT(INTERPOLATE_NEAREST);
- BIND_CONSTANT(INTERPOLATE_BILINEAR);
- BIND_CONSTANT(INTERPOLATE_CUBIC);
-
- BIND_CONSTANT(ALPHA_NONE);
- BIND_CONSTANT(ALPHA_BIT);
- BIND_CONSTANT(ALPHA_BLEND);
-
- BIND_CONSTANT(COMPRESS_S3TC);
- BIND_CONSTANT(COMPRESS_PVRTC2);
- BIND_CONSTANT(COMPRESS_PVRTC4);
- BIND_CONSTANT(COMPRESS_ETC);
- BIND_CONSTANT(COMPRESS_ETC2);
-
- BIND_CONSTANT(COMPRESS_SOURCE_GENERIC);
- BIND_CONSTANT(COMPRESS_SOURCE_SRGB);
- BIND_CONSTANT(COMPRESS_SOURCE_NORMAL);
+ BIND_ENUM_CONSTANT(FORMAT_L8); //luminance
+ BIND_ENUM_CONSTANT(FORMAT_LA8); //luminance-alpha
+ BIND_ENUM_CONSTANT(FORMAT_R8);
+ BIND_ENUM_CONSTANT(FORMAT_RG8);
+ BIND_ENUM_CONSTANT(FORMAT_RGB8);
+ BIND_ENUM_CONSTANT(FORMAT_RGBA8);
+ BIND_ENUM_CONSTANT(FORMAT_RGBA4444);
+ BIND_ENUM_CONSTANT(FORMAT_RGBA5551);
+ BIND_ENUM_CONSTANT(FORMAT_RF); //float
+ BIND_ENUM_CONSTANT(FORMAT_RGF);
+ BIND_ENUM_CONSTANT(FORMAT_RGBF);
+ BIND_ENUM_CONSTANT(FORMAT_RGBAF);
+ BIND_ENUM_CONSTANT(FORMAT_RH); //half float
+ BIND_ENUM_CONSTANT(FORMAT_RGH);
+ BIND_ENUM_CONSTANT(FORMAT_RGBH);
+ BIND_ENUM_CONSTANT(FORMAT_RGBAH);
+ BIND_ENUM_CONSTANT(FORMAT_RGBE9995);
+ BIND_ENUM_CONSTANT(FORMAT_DXT1); //s3tc bc1
+ BIND_ENUM_CONSTANT(FORMAT_DXT3); //bc2
+ BIND_ENUM_CONSTANT(FORMAT_DXT5); //bc3
+ BIND_ENUM_CONSTANT(FORMAT_RGTC_R);
+ BIND_ENUM_CONSTANT(FORMAT_RGTC_RG);
+ BIND_ENUM_CONSTANT(FORMAT_BPTC_RGBA); //btpc bc6h
+ BIND_ENUM_CONSTANT(FORMAT_BPTC_RGBF); //float /
+ BIND_ENUM_CONSTANT(FORMAT_BPTC_RGBFU); //unsigned float
+ BIND_ENUM_CONSTANT(FORMAT_PVRTC2); //pvrtc
+ BIND_ENUM_CONSTANT(FORMAT_PVRTC2A);
+ BIND_ENUM_CONSTANT(FORMAT_PVRTC4);
+ BIND_ENUM_CONSTANT(FORMAT_PVRTC4A);
+ BIND_ENUM_CONSTANT(FORMAT_ETC); //etc1
+ BIND_ENUM_CONSTANT(FORMAT_ETC2_R11); //etc2
+ BIND_ENUM_CONSTANT(FORMAT_ETC2_R11S); //signed ); NOT srgb.
+ BIND_ENUM_CONSTANT(FORMAT_ETC2_RG11);
+ BIND_ENUM_CONSTANT(FORMAT_ETC2_RG11S);
+ BIND_ENUM_CONSTANT(FORMAT_ETC2_RGB8);
+ BIND_ENUM_CONSTANT(FORMAT_ETC2_RGBA8);
+ BIND_ENUM_CONSTANT(FORMAT_ETC2_RGB8A1);
+ BIND_ENUM_CONSTANT(FORMAT_MAX);
+
+ BIND_ENUM_CONSTANT(INTERPOLATE_NEAREST);
+ BIND_ENUM_CONSTANT(INTERPOLATE_BILINEAR);
+ BIND_ENUM_CONSTANT(INTERPOLATE_CUBIC);
+
+ BIND_ENUM_CONSTANT(ALPHA_NONE);
+ BIND_ENUM_CONSTANT(ALPHA_BIT);
+ BIND_ENUM_CONSTANT(ALPHA_BLEND);
+
+ BIND_ENUM_CONSTANT(COMPRESS_S3TC);
+ BIND_ENUM_CONSTANT(COMPRESS_PVRTC2);
+ BIND_ENUM_CONSTANT(COMPRESS_PVRTC4);
+ BIND_ENUM_CONSTANT(COMPRESS_ETC);
+ BIND_ENUM_CONSTANT(COMPRESS_ETC2);
+
+ BIND_ENUM_CONSTANT(COMPRESS_SOURCE_GENERIC);
+ BIND_ENUM_CONSTANT(COMPRESS_SOURCE_SRGB);
+ BIND_ENUM_CONSTANT(COMPRESS_SOURCE_NORMAL);
}
void Image::set_compress_bc_func(void (*p_compress_func)(Image *, CompressSource)) {
diff --git a/core/io/file_access_buffered.cpp b/core/io/file_access_buffered.cpp
index 81adbbbaf7..126ec7575e 100644
--- a/core/io/file_access_buffered.cpp
+++ b/core/io/file_access_buffered.cpp
@@ -106,11 +106,11 @@ uint8_t FileAccessBuffered::get_8() const {
return byte;
};
-int FileAccessBuffered::get_buffer(uint8_t *p_dest, int p_elements) const {
+int FileAccessBuffered::get_buffer(uint8_t *p_dest, int p_length) const {
ERR_FAIL_COND_V(!file.open, -1);
- if (p_elements > cache_size) {
+ if (p_length > cache_size) {
int total_read = 0;
@@ -122,12 +122,12 @@ int FileAccessBuffered::get_buffer(uint8_t *p_dest, int p_elements) const {
//memcpy(p_dest, read.ptr() + (file.offset - cache.offset), size);
memcpy(p_dest, cache.buffer.ptr() + (file.offset - cache.offset), size);
p_dest += size;
- p_elements -= size;
+ p_length -= size;
file.offset += size;
total_read += size;
};
- int err = read_data_block(file.offset, p_elements, p_dest);
+ int err = read_data_block(file.offset, p_length, p_dest);
if (err >= 0) {
total_read += err;
file.offset += err;
@@ -136,7 +136,7 @@ int FileAccessBuffered::get_buffer(uint8_t *p_dest, int p_elements) const {
return total_read;
};
- int to_read = p_elements;
+ int to_read = p_length;
int total_read = 0;
while (to_read > 0) {
@@ -161,7 +161,7 @@ int FileAccessBuffered::get_buffer(uint8_t *p_dest, int p_elements) const {
to_read -= r;
};
- return p_elements;
+ return p_length;
};
bool FileAccessBuffered::is_open() const {
diff --git a/core/io/file_access_buffered.h b/core/io/file_access_buffered.h
index c5bf120890..0ad2d0e929 100644
--- a/core/io/file_access_buffered.h
+++ b/core/io/file_access_buffered.h
@@ -81,7 +81,7 @@ public:
virtual bool eof_reached() const;
virtual uint8_t get_8() const;
- virtual int get_buffer(uint8_t *p_dst, int p_length) const; ///< get an array of bytes
+ virtual int get_buffer(uint8_t *p_dest, int p_length) const; ///< get an array of bytes
virtual bool is_open() const;
diff --git a/core/io/file_access_compressed.cpp b/core/io/file_access_compressed.cpp
index 4e802579c6..34bce3f04f 100644
--- a/core/io/file_access_compressed.cpp
+++ b/core/io/file_access_compressed.cpp
@@ -43,16 +43,16 @@ void FileAccessCompressed::configure(const String &p_magic, Compression::Mode p_
block_size = p_block_size;
}
-#define WRITE_FIT(m_bytes) \
- { \
- if (write_pos + (m_bytes) > write_max) { \
- write_max = write_pos + (m_bytes); \
- } \
- if (write_max > write_buffer_size) { \
- write_buffer_size = nearest_power_of_2(write_max); \
- buffer.resize(write_buffer_size); \
- write_ptr = buffer.ptr(); \
- } \
+#define WRITE_FIT(m_bytes) \
+ { \
+ if (write_pos + (m_bytes) > write_max) { \
+ write_max = write_pos + (m_bytes); \
+ } \
+ if (write_max > write_buffer_size) { \
+ write_buffer_size = next_power_of_2(write_max); \
+ buffer.resize(write_buffer_size); \
+ write_ptr = buffer.ptr(); \
+ } \
}
Error FileAccessCompressed::open_after_magic(FileAccess *p_base) {
diff --git a/core/io/file_access_memory.h b/core/io/file_access_memory.h
index 8b6abe7e81..ea858c547e 100644
--- a/core/io/file_access_memory.h
+++ b/core/io/file_access_memory.h
@@ -62,7 +62,7 @@ public:
virtual Error get_error() const; ///< get last error
- virtual void store_8(uint8_t p_dest); ///< store a byte
+ virtual void store_8(uint8_t p_byte); ///< store a byte
virtual void store_buffer(const uint8_t *p_src, int p_length); ///< store an array of bytes
virtual bool file_exists(const String &p_name); ///< return true if a file exists
diff --git a/core/io/file_access_zip.cpp b/core/io/file_access_zip.cpp
index a92014000d..d748d5c773 100644
--- a/core/io/file_access_zip.cpp
+++ b/core/io/file_access_zip.cpp
@@ -159,15 +159,15 @@ unzFile ZipArchive::get_file_handle(String p_file) const {
return pkg;
};
-bool ZipArchive::try_open_pack(const String &p_name) {
+bool ZipArchive::try_open_pack(const String &p_path) {
//printf("opening zip pack %ls, %i, %i\n", p_name.c_str(), p_name.extension().nocasecmp_to("zip"), p_name.extension().nocasecmp_to("pcz"));
- if (p_name.get_extension().nocasecmp_to("zip") != 0 && p_name.get_extension().nocasecmp_to("pcz") != 0)
+ if (p_path.get_extension().nocasecmp_to("zip") != 0 && p_path.get_extension().nocasecmp_to("pcz") != 0)
return false;
zlib_filefunc_def io;
- FileAccess *f = FileAccess::open(p_name, FileAccess::READ);
+ FileAccess *f = FileAccess::open(p_path, FileAccess::READ);
if (!f)
return false;
io.opaque = f;
@@ -180,7 +180,7 @@ bool ZipArchive::try_open_pack(const String &p_name) {
io.zclose_file = godot_close;
io.zerror_file = godot_testerror;
- unzFile zfile = unzOpen2(p_name.utf8().get_data(), &io);
+ unzFile zfile = unzOpen2(p_path.utf8().get_data(), &io);
ERR_FAIL_COND_V(!zfile, false);
unz_global_info64 gi;
@@ -188,7 +188,7 @@ bool ZipArchive::try_open_pack(const String &p_name) {
ERR_FAIL_COND_V(err != UNZ_OK, false);
Package pkg;
- pkg.filename = p_name;
+ pkg.filename = p_path;
pkg.zfile = zfile;
packages.push_back(pkg);
int pkg_num = packages.size() - 1;
@@ -209,7 +209,7 @@ bool ZipArchive::try_open_pack(const String &p_name) {
files[fname] = f;
uint8_t md5[16] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
- PackedData::get_singleton()->add_path(p_name, fname, 1, 0, md5, this);
+ PackedData::get_singleton()->add_path(p_path, fname, 1, 0, md5, this);
//printf("packed data add path %ls, %ls\n", p_name.c_str(), fname.c_str());
if ((i + 1) < gi.number_entry) {
diff --git a/core/io/http_client.cpp b/core/io/http_client.cpp
index 4d5b88cfa1..1c35c6edeb 100644
--- a/core/io/http_client.cpp
+++ b/core/io/http_client.cpp
@@ -650,84 +650,84 @@ void HTTPClient::_bind_methods() {
ClassDB::bind_method(D_METHOD("query_string_from_dict", "fields"), &HTTPClient::query_string_from_dict);
- BIND_CONSTANT(METHOD_GET);
- BIND_CONSTANT(METHOD_HEAD);
- BIND_CONSTANT(METHOD_POST);
- BIND_CONSTANT(METHOD_PUT);
- BIND_CONSTANT(METHOD_DELETE);
- BIND_CONSTANT(METHOD_OPTIONS);
- BIND_CONSTANT(METHOD_TRACE);
- BIND_CONSTANT(METHOD_CONNECT);
- BIND_CONSTANT(METHOD_MAX);
-
- BIND_CONSTANT(STATUS_DISCONNECTED);
- BIND_CONSTANT(STATUS_RESOLVING); //resolving hostname (if passed a hostname)
- BIND_CONSTANT(STATUS_CANT_RESOLVE);
- BIND_CONSTANT(STATUS_CONNECTING); //connecting to ip
- BIND_CONSTANT(STATUS_CANT_CONNECT);
- BIND_CONSTANT(STATUS_CONNECTED); //connected ); requests only accepted here
- BIND_CONSTANT(STATUS_REQUESTING); // request in progress
- BIND_CONSTANT(STATUS_BODY); // request resulted in body ); which must be read
- BIND_CONSTANT(STATUS_CONNECTION_ERROR);
- BIND_CONSTANT(STATUS_SSL_HANDSHAKE_ERROR);
-
- BIND_CONSTANT(RESPONSE_CONTINUE);
- BIND_CONSTANT(RESPONSE_SWITCHING_PROTOCOLS);
- BIND_CONSTANT(RESPONSE_PROCESSING);
+ BIND_ENUM_CONSTANT(METHOD_GET);
+ BIND_ENUM_CONSTANT(METHOD_HEAD);
+ BIND_ENUM_CONSTANT(METHOD_POST);
+ BIND_ENUM_CONSTANT(METHOD_PUT);
+ BIND_ENUM_CONSTANT(METHOD_DELETE);
+ BIND_ENUM_CONSTANT(METHOD_OPTIONS);
+ BIND_ENUM_CONSTANT(METHOD_TRACE);
+ BIND_ENUM_CONSTANT(METHOD_CONNECT);
+ BIND_ENUM_CONSTANT(METHOD_MAX);
+
+ BIND_ENUM_CONSTANT(STATUS_DISCONNECTED);
+ BIND_ENUM_CONSTANT(STATUS_RESOLVING); //resolving hostname (if passed a hostname)
+ BIND_ENUM_CONSTANT(STATUS_CANT_RESOLVE);
+ BIND_ENUM_CONSTANT(STATUS_CONNECTING); //connecting to ip
+ BIND_ENUM_CONSTANT(STATUS_CANT_CONNECT);
+ BIND_ENUM_CONSTANT(STATUS_CONNECTED); //connected ); requests only accepted here
+ BIND_ENUM_CONSTANT(STATUS_REQUESTING); // request in progress
+ BIND_ENUM_CONSTANT(STATUS_BODY); // request resulted in body ); which must be read
+ BIND_ENUM_CONSTANT(STATUS_CONNECTION_ERROR);
+ BIND_ENUM_CONSTANT(STATUS_SSL_HANDSHAKE_ERROR);
+
+ BIND_ENUM_CONSTANT(RESPONSE_CONTINUE);
+ BIND_ENUM_CONSTANT(RESPONSE_SWITCHING_PROTOCOLS);
+ BIND_ENUM_CONSTANT(RESPONSE_PROCESSING);
// 2xx successful
- BIND_CONSTANT(RESPONSE_OK);
- BIND_CONSTANT(RESPONSE_CREATED);
- BIND_CONSTANT(RESPONSE_ACCEPTED);
- BIND_CONSTANT(RESPONSE_NON_AUTHORITATIVE_INFORMATION);
- BIND_CONSTANT(RESPONSE_NO_CONTENT);
- BIND_CONSTANT(RESPONSE_RESET_CONTENT);
- BIND_CONSTANT(RESPONSE_PARTIAL_CONTENT);
- BIND_CONSTANT(RESPONSE_MULTI_STATUS);
- BIND_CONSTANT(RESPONSE_IM_USED);
+ BIND_ENUM_CONSTANT(RESPONSE_OK);
+ BIND_ENUM_CONSTANT(RESPONSE_CREATED);
+ BIND_ENUM_CONSTANT(RESPONSE_ACCEPTED);
+ BIND_ENUM_CONSTANT(RESPONSE_NON_AUTHORITATIVE_INFORMATION);
+ BIND_ENUM_CONSTANT(RESPONSE_NO_CONTENT);
+ BIND_ENUM_CONSTANT(RESPONSE_RESET_CONTENT);
+ BIND_ENUM_CONSTANT(RESPONSE_PARTIAL_CONTENT);
+ BIND_ENUM_CONSTANT(RESPONSE_MULTI_STATUS);
+ BIND_ENUM_CONSTANT(RESPONSE_IM_USED);
// 3xx redirection
- BIND_CONSTANT(RESPONSE_MULTIPLE_CHOICES);
- BIND_CONSTANT(RESPONSE_MOVED_PERMANENTLY);
- BIND_CONSTANT(RESPONSE_FOUND);
- BIND_CONSTANT(RESPONSE_SEE_OTHER);
- BIND_CONSTANT(RESPONSE_NOT_MODIFIED);
- BIND_CONSTANT(RESPONSE_USE_PROXY);
- BIND_CONSTANT(RESPONSE_TEMPORARY_REDIRECT);
+ BIND_ENUM_CONSTANT(RESPONSE_MULTIPLE_CHOICES);
+ BIND_ENUM_CONSTANT(RESPONSE_MOVED_PERMANENTLY);
+ BIND_ENUM_CONSTANT(RESPONSE_FOUND);
+ BIND_ENUM_CONSTANT(RESPONSE_SEE_OTHER);
+ BIND_ENUM_CONSTANT(RESPONSE_NOT_MODIFIED);
+ BIND_ENUM_CONSTANT(RESPONSE_USE_PROXY);
+ BIND_ENUM_CONSTANT(RESPONSE_TEMPORARY_REDIRECT);
// 4xx client error
- BIND_CONSTANT(RESPONSE_BAD_REQUEST);
- BIND_CONSTANT(RESPONSE_UNAUTHORIZED);
- BIND_CONSTANT(RESPONSE_PAYMENT_REQUIRED);
- BIND_CONSTANT(RESPONSE_FORBIDDEN);
- BIND_CONSTANT(RESPONSE_NOT_FOUND);
- BIND_CONSTANT(RESPONSE_METHOD_NOT_ALLOWED);
- BIND_CONSTANT(RESPONSE_NOT_ACCEPTABLE);
- BIND_CONSTANT(RESPONSE_PROXY_AUTHENTICATION_REQUIRED);
- BIND_CONSTANT(RESPONSE_REQUEST_TIMEOUT);
- BIND_CONSTANT(RESPONSE_CONFLICT);
- BIND_CONSTANT(RESPONSE_GONE);
- BIND_CONSTANT(RESPONSE_LENGTH_REQUIRED);
- BIND_CONSTANT(RESPONSE_PRECONDITION_FAILED);
- BIND_CONSTANT(RESPONSE_REQUEST_ENTITY_TOO_LARGE);
- BIND_CONSTANT(RESPONSE_REQUEST_URI_TOO_LONG);
- BIND_CONSTANT(RESPONSE_UNSUPPORTED_MEDIA_TYPE);
- BIND_CONSTANT(RESPONSE_REQUESTED_RANGE_NOT_SATISFIABLE);
- BIND_CONSTANT(RESPONSE_EXPECTATION_FAILED);
- BIND_CONSTANT(RESPONSE_UNPROCESSABLE_ENTITY);
- BIND_CONSTANT(RESPONSE_LOCKED);
- BIND_CONSTANT(RESPONSE_FAILED_DEPENDENCY);
- BIND_CONSTANT(RESPONSE_UPGRADE_REQUIRED);
+ BIND_ENUM_CONSTANT(RESPONSE_BAD_REQUEST);
+ BIND_ENUM_CONSTANT(RESPONSE_UNAUTHORIZED);
+ BIND_ENUM_CONSTANT(RESPONSE_PAYMENT_REQUIRED);
+ BIND_ENUM_CONSTANT(RESPONSE_FORBIDDEN);
+ BIND_ENUM_CONSTANT(RESPONSE_NOT_FOUND);
+ BIND_ENUM_CONSTANT(RESPONSE_METHOD_NOT_ALLOWED);
+ BIND_ENUM_CONSTANT(RESPONSE_NOT_ACCEPTABLE);
+ BIND_ENUM_CONSTANT(RESPONSE_PROXY_AUTHENTICATION_REQUIRED);
+ BIND_ENUM_CONSTANT(RESPONSE_REQUEST_TIMEOUT);
+ BIND_ENUM_CONSTANT(RESPONSE_CONFLICT);
+ BIND_ENUM_CONSTANT(RESPONSE_GONE);
+ BIND_ENUM_CONSTANT(RESPONSE_LENGTH_REQUIRED);
+ BIND_ENUM_CONSTANT(RESPONSE_PRECONDITION_FAILED);
+ BIND_ENUM_CONSTANT(RESPONSE_REQUEST_ENTITY_TOO_LARGE);
+ BIND_ENUM_CONSTANT(RESPONSE_REQUEST_URI_TOO_LONG);
+ BIND_ENUM_CONSTANT(RESPONSE_UNSUPPORTED_MEDIA_TYPE);
+ BIND_ENUM_CONSTANT(RESPONSE_REQUESTED_RANGE_NOT_SATISFIABLE);
+ BIND_ENUM_CONSTANT(RESPONSE_EXPECTATION_FAILED);
+ BIND_ENUM_CONSTANT(RESPONSE_UNPROCESSABLE_ENTITY);
+ BIND_ENUM_CONSTANT(RESPONSE_LOCKED);
+ BIND_ENUM_CONSTANT(RESPONSE_FAILED_DEPENDENCY);
+ BIND_ENUM_CONSTANT(RESPONSE_UPGRADE_REQUIRED);
// 5xx server error
- BIND_CONSTANT(RESPONSE_INTERNAL_SERVER_ERROR);
- BIND_CONSTANT(RESPONSE_NOT_IMPLEMENTED);
- BIND_CONSTANT(RESPONSE_BAD_GATEWAY);
- BIND_CONSTANT(RESPONSE_SERVICE_UNAVAILABLE);
- BIND_CONSTANT(RESPONSE_GATEWAY_TIMEOUT);
- BIND_CONSTANT(RESPONSE_HTTP_VERSION_NOT_SUPPORTED);
- BIND_CONSTANT(RESPONSE_INSUFFICIENT_STORAGE);
- BIND_CONSTANT(RESPONSE_NOT_EXTENDED);
+ BIND_ENUM_CONSTANT(RESPONSE_INTERNAL_SERVER_ERROR);
+ BIND_ENUM_CONSTANT(RESPONSE_NOT_IMPLEMENTED);
+ BIND_ENUM_CONSTANT(RESPONSE_BAD_GATEWAY);
+ BIND_ENUM_CONSTANT(RESPONSE_SERVICE_UNAVAILABLE);
+ BIND_ENUM_CONSTANT(RESPONSE_GATEWAY_TIMEOUT);
+ BIND_ENUM_CONSTANT(RESPONSE_HTTP_VERSION_NOT_SUPPORTED);
+ BIND_ENUM_CONSTANT(RESPONSE_INSUFFICIENT_STORAGE);
+ BIND_ENUM_CONSTANT(RESPONSE_NOT_EXTENDED);
}
void HTTPClient::set_read_chunk_size(int p_size) {
diff --git a/core/io/http_client.h b/core/io/http_client.h
index 3cee1e0c6b..cc5f1ed935 100644
--- a/core/io/http_client.h
+++ b/core/io/http_client.h
@@ -197,6 +197,7 @@ public:
~HTTPClient();
};
+VARIANT_ENUM_CAST(HTTPClient::ResponseCode)
VARIANT_ENUM_CAST(HTTPClient::Method);
VARIANT_ENUM_CAST(HTTPClient::Status);
diff --git a/core/io/image_loader.cpp b/core/io/image_loader.cpp
index 23719940be..7b5b4a13ea 100644
--- a/core/io/image_loader.cpp
+++ b/core/io/image_loader.cpp
@@ -43,7 +43,7 @@ bool ImageFormatLoader::recognize(const String &p_extension) const {
return false;
}
-Error ImageLoader::load_image(String p_file, Ref<Image> p_image, FileAccess *p_custom, bool p_force_linear) {
+Error ImageLoader::load_image(String p_file, Ref<Image> p_image, FileAccess *p_custom, bool p_force_linear, float p_scale) {
ERR_FAIL_COND_V(p_image.is_null(), ERR_INVALID_PARAMETER);
FileAccess *f = p_custom;
@@ -62,7 +62,7 @@ Error ImageLoader::load_image(String p_file, Ref<Image> p_image, FileAccess *p_c
if (!loader[i]->recognize(extension))
continue;
- Error err = loader[i]->load_image(p_image, f, p_force_linear);
+ Error err = loader[i]->load_image(p_image, f, p_force_linear, p_scale);
if (err != ERR_FILE_UNRECOGNIZED) {
diff --git a/core/io/image_loader.h b/core/io/image_loader.h
index e528d1423b..f79d9789bf 100644
--- a/core/io/image_loader.h
+++ b/core/io/image_loader.h
@@ -56,7 +56,7 @@ class ImageFormatLoader {
friend class ImageLoader;
protected:
- virtual Error load_image(Ref<Image> p_image, FileAccess *p_fileaccess, bool p_force_linear) = 0;
+ virtual Error load_image(Ref<Image> p_image, FileAccess *p_fileaccess, bool p_force_linear, float p_scale) = 0;
virtual void get_recognized_extensions(List<String> *p_extensions) const = 0;
bool recognize(const String &p_extension) const;
@@ -75,7 +75,7 @@ class ImageLoader {
protected:
public:
- static Error load_image(String p_file, Ref<Image> p_image, FileAccess *p_custom = NULL, bool p_force_linear = false);
+ static Error load_image(String p_file, Ref<Image> p_image, FileAccess *p_custom = NULL, bool p_force_linear = false, float p_scale = 1.0);
static void get_recognized_extensions(List<String> *p_extensions);
static bool recognize(const String &p_extension);
diff --git a/core/io/ip.cpp b/core/io/ip.cpp
index c869bdad9b..0e2b5ed519 100644
--- a/core/io/ip.cpp
+++ b/core/io/ip.cpp
@@ -242,18 +242,18 @@ void IP::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_local_addresses"), &IP::_get_local_addresses);
ClassDB::bind_method(D_METHOD("clear_cache", "hostname"), &IP::clear_cache, DEFVAL(""));
- BIND_CONSTANT(RESOLVER_STATUS_NONE);
- BIND_CONSTANT(RESOLVER_STATUS_WAITING);
- BIND_CONSTANT(RESOLVER_STATUS_DONE);
- BIND_CONSTANT(RESOLVER_STATUS_ERROR);
+ BIND_ENUM_CONSTANT(RESOLVER_STATUS_NONE);
+ BIND_ENUM_CONSTANT(RESOLVER_STATUS_WAITING);
+ BIND_ENUM_CONSTANT(RESOLVER_STATUS_DONE);
+ BIND_ENUM_CONSTANT(RESOLVER_STATUS_ERROR);
BIND_CONSTANT(RESOLVER_MAX_QUERIES);
BIND_CONSTANT(RESOLVER_INVALID_ID);
- BIND_CONSTANT(TYPE_NONE);
- BIND_CONSTANT(TYPE_IPV4);
- BIND_CONSTANT(TYPE_IPV6);
- BIND_CONSTANT(TYPE_ANY);
+ BIND_ENUM_CONSTANT(TYPE_NONE);
+ BIND_ENUM_CONSTANT(TYPE_IPV4);
+ BIND_ENUM_CONSTANT(TYPE_IPV6);
+ BIND_ENUM_CONSTANT(TYPE_ANY);
}
IP *IP::singleton = NULL;
diff --git a/core/io/ip_address.h b/core/io/ip_address.h
index ac58283605..da16622a9b 100644
--- a/core/io/ip_address.h
+++ b/core/io/ip_address.h
@@ -75,7 +75,7 @@ public:
void set_ipv4(const uint8_t *p_ip);
const uint8_t *get_ipv6() const;
- void set_ipv6(const uint8_t *buf);
+ void set_ipv6(const uint8_t *p_buf);
operator String() const;
IP_Address(const String &p_string);
diff --git a/core/io/json.cpp b/core/io/json.cpp
index 10fd60abf7..d537061c5b 100644
--- a/core/io/json.cpp
+++ b/core/io/json.cpp
@@ -94,15 +94,15 @@ String JSON::print(const Variant &p_var) {
return _print_var(p_var);
}
-Error JSON::_get_token(const CharType *p_str, int &idx, int p_len, Token &r_token, int &line, String &r_err_str) {
+Error JSON::_get_token(const CharType *p_str, int &index, int p_len, Token &r_token, int &line, String &r_err_str) {
while (p_len > 0) {
- switch (p_str[idx]) {
+ switch (p_str[index]) {
case '\n': {
line++;
- idx++;
+ index++;
break;
};
case 0: {
@@ -112,54 +112,54 @@ Error JSON::_get_token(const CharType *p_str, int &idx, int p_len, Token &r_toke
case '{': {
r_token.type = TK_CURLY_BRACKET_OPEN;
- idx++;
+ index++;
return OK;
};
case '}': {
r_token.type = TK_CURLY_BRACKET_CLOSE;
- idx++;
+ index++;
return OK;
};
case '[': {
r_token.type = TK_BRACKET_OPEN;
- idx++;
+ index++;
return OK;
};
case ']': {
r_token.type = TK_BRACKET_CLOSE;
- idx++;
+ index++;
return OK;
};
case ':': {
r_token.type = TK_COLON;
- idx++;
+ index++;
return OK;
};
case ',': {
r_token.type = TK_COMMA;
- idx++;
+ index++;
return OK;
};
case '"': {
- idx++;
+ index++;
String str;
while (true) {
- if (p_str[idx] == 0) {
+ if (p_str[index] == 0) {
r_err_str = "Unterminated String";
return ERR_PARSE_ERROR;
- } else if (p_str[idx] == '"') {
- idx++;
+ } else if (p_str[index] == '"') {
+ index++;
break;
- } else if (p_str[idx] == '\\') {
+ } else if (p_str[index] == '\\') {
//escaped characters...
- idx++;
- CharType next = p_str[idx];
+ index++;
+ CharType next = p_str[index];
if (next == 0) {
r_err_str = "Unterminated String";
return ERR_PARSE_ERROR;
@@ -177,7 +177,7 @@ Error JSON::_get_token(const CharType *p_str, int &idx, int p_len, Token &r_toke
//hexnumbarh - oct is deprecated
for (int j = 0; j < 4; j++) {
- CharType c = p_str[idx + j + 1];
+ CharType c = p_str[index + j + 1];
if (c == 0) {
r_err_str = "Unterminated String";
return ERR_PARSE_ERROR;
@@ -204,7 +204,7 @@ Error JSON::_get_token(const CharType *p_str, int &idx, int p_len, Token &r_toke
res <<= 4;
res |= v;
}
- idx += 4; //will add at the end anyway
+ index += 4; //will add at the end anyway
} break;
//case '\"': res='\"'; break;
@@ -220,11 +220,11 @@ Error JSON::_get_token(const CharType *p_str, int &idx, int p_len, Token &r_toke
str += res;
} else {
- if (p_str[idx] == '\n')
+ if (p_str[index] == '\n')
line++;
- str += p_str[idx];
+ str += p_str[index];
}
- idx++;
+ index++;
}
r_token.type = TK_STRING;
@@ -234,28 +234,28 @@ Error JSON::_get_token(const CharType *p_str, int &idx, int p_len, Token &r_toke
} break;
default: {
- if (p_str[idx] <= 32) {
- idx++;
+ if (p_str[index] <= 32) {
+ index++;
break;
}
- if (p_str[idx] == '-' || (p_str[idx] >= '0' && p_str[idx] <= '9')) {
+ if (p_str[index] == '-' || (p_str[index] >= '0' && p_str[index] <= '9')) {
//a number
const CharType *rptr;
- double number = String::to_double(&p_str[idx], &rptr);
- idx += (rptr - &p_str[idx]);
+ double number = String::to_double(&p_str[index], &rptr);
+ index += (rptr - &p_str[index]);
r_token.type = TK_NUMBER;
r_token.value = number;
return OK;
- } else if ((p_str[idx] >= 'A' && p_str[idx] <= 'Z') || (p_str[idx] >= 'a' && p_str[idx] <= 'z')) {
+ } else if ((p_str[index] >= 'A' && p_str[index] <= 'Z') || (p_str[index] >= 'a' && p_str[index] <= 'z')) {
String id;
- while ((p_str[idx] >= 'A' && p_str[idx] <= 'Z') || (p_str[idx] >= 'a' && p_str[idx] <= 'z')) {
+ while ((p_str[index] >= 'A' && p_str[index] <= 'Z') || (p_str[index] >= 'a' && p_str[index] <= 'z')) {
- id += p_str[idx];
- idx++;
+ id += p_str[index];
+ index++;
}
r_token.type = TK_IDENTIFIER;
diff --git a/core/io/marshalls.cpp b/core/io/marshalls.cpp
index 75dfd563dd..e701a89c78 100644
--- a/core/io/marshalls.cpp
+++ b/core/io/marshalls.cpp
@@ -30,12 +30,60 @@
#include "marshalls.h"
#include "os/keyboard.h"
#include "print_string.h"
+#include "reference.h"
#include <stdio.h>
+void EncodedObjectAsID::_bind_methods() {
+ ClassDB::bind_method(D_METHOD("set_object_id", "id"), &EncodedObjectAsID::set_object_id);
+ ClassDB::bind_method(D_METHOD("get_object_id"), &EncodedObjectAsID::get_object_id);
+}
+
+void EncodedObjectAsID::set_object_id(ObjectID p_id) {
+ id = p_id;
+}
+
+ObjectID EncodedObjectAsID::get_object_id() const {
+
+ return id;
+}
+
+EncodedObjectAsID::EncodedObjectAsID() {
+
+ id = 0;
+}
+
#define ENCODE_MASK 0xFF
#define ENCODE_FLAG_64 1 << 16
+#define ENCODE_FLAG_OBJECT_AS_ID 1 << 16
+
+static Error _decode_string(const uint8_t *&buf, int &len, int *r_len, String &r_string) {
+ ERR_FAIL_COND_V(len < 4, ERR_INVALID_DATA);
+
+ uint32_t strlen = decode_uint32(buf);
+ buf += 4;
+ len -= 4;
+ ERR_FAIL_COND_V((int)strlen > len, ERR_FILE_EOF);
-Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int *r_len) {
+ String str;
+ str.parse_utf8((const char *)buf, strlen);
+ r_string = str;
+
+ //handle padding
+ if (strlen % 4) {
+ strlen += 4 - strlen % 4;
+ }
+
+ buf += strlen;
+ len -= strlen;
+
+ if (r_len) {
+ (*r_len) += 4 + strlen;
+ }
+
+ return OK;
+}
+
+Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int *r_len, bool p_allow_objects) {
const uint8_t *buf = p_buffer;
int len = p_len;
@@ -104,22 +152,12 @@ Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int
} break;
case Variant::STRING: {
- ERR_FAIL_COND_V(len < 4, ERR_INVALID_DATA);
- uint32_t strlen = decode_uint32(buf);
- buf += 4;
- len -= 4;
- ERR_FAIL_COND_V((int)strlen > len, ERR_INVALID_DATA);
-
String str;
- str.parse_utf8((const char *)buf, strlen);
+ Error err = _decode_string(buf, len, r_len, str);
+ if (err)
+ return err;
r_variant = str;
- if (r_len) {
- if (strlen % 4)
- (*r_len) += 4 - strlen % 4;
- (*r_len) += 4 + strlen;
- }
-
} break;
// math types
@@ -363,7 +401,77 @@ Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int
} break;
case Variant::OBJECT: {
- r_variant = (Object *)NULL;
+ if (type & ENCODE_FLAG_OBJECT_AS_ID) {
+ //this _is_ allowed
+ ObjectID val = decode_uint64(buf);
+ if (r_len)
+ (*r_len) += 8;
+
+ if (val == 0) {
+ r_variant = (Object *)NULL;
+ } else {
+ Ref<EncodedObjectAsID> obj_as_id;
+ obj_as_id.instance();
+ obj_as_id->set_object_id(val);
+
+ r_variant = obj_as_id;
+ }
+
+ } else {
+ ERR_FAIL_COND_V(!p_allow_objects, ERR_UNAUTHORIZED);
+
+ String str;
+ Error err = _decode_string(buf, len, r_len, str);
+ if (err)
+ return err;
+
+ if (str == String()) {
+ r_variant = (Object *)NULL;
+ } else {
+
+ Object *obj = ClassDB::instance(str);
+
+ ERR_FAIL_COND_V(!obj, ERR_UNAVAILABLE);
+ ERR_FAIL_COND_V(len < 4, ERR_INVALID_DATA);
+
+ int32_t count = decode_uint32(buf);
+ buf += 4;
+ len -= 4;
+ if (r_len) {
+ (*r_len) += 4;
+ }
+
+ for (int i = 0; i < count; i++) {
+
+ str = String();
+ err = _decode_string(buf, len, r_len, str);
+ if (err)
+ return err;
+
+ Variant value;
+ int used;
+ err = decode_variant(value, buf, len, &used, p_allow_objects);
+ if (err)
+ return err;
+
+ buf += used;
+ len -= used;
+ if (r_len) {
+ (*r_len) += used;
+ }
+
+ obj->set(str, value);
+ }
+
+ if (obj->cast_to<Reference>()) {
+ REF ref = REF(obj->cast_to<Reference>());
+ r_variant = ref;
+ } else {
+ r_variant = obj;
+ }
+ }
+ }
+
} break;
case Variant::DICTIONARY: {
@@ -386,7 +494,7 @@ Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int
Variant key, value;
int used;
- Error err = decode_variant(key, buf, len, &used);
+ Error err = decode_variant(key, buf, len, &used, p_allow_objects);
ERR_FAIL_COND_V(err, err);
buf += used;
@@ -395,7 +503,7 @@ Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int
(*r_len) += used;
}
- err = decode_variant(value, buf, len, &used);
+ err = decode_variant(value, buf, len, &used, p_allow_objects);
ERR_FAIL_COND_V(err, err);
buf += used;
@@ -430,7 +538,7 @@ Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int
int used = 0;
Variant v;
- Error err = decode_variant(v, buf, len, &used);
+ Error err = decode_variant(v, buf, len, &used, p_allow_objects);
ERR_FAIL_COND_V(err, err);
buf += used;
len -= used;
@@ -691,7 +799,27 @@ Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int
return OK;
}
-Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len) {
+static void _encode_string(const String &p_string, uint8_t *&buf, int &r_len) {
+
+ CharString utf8 = p_string.utf8();
+
+ if (buf) {
+ encode_uint32(utf8.length(), buf);
+ buf += 4;
+ copymem(buf, utf8.get_data(), utf8.length());
+ buf += utf8.length();
+ }
+
+ r_len += 4 + utf8.length();
+ while (r_len % 4) {
+ r_len++; //pad
+ if (buf) {
+ buf++;
+ }
+ }
+}
+
+Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len, bool p_object_as_id) {
uint8_t *buf = r_buffer;
@@ -715,6 +843,11 @@ Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len) {
flags |= ENCODE_FLAG_64; //always encode real as double
}
} break;
+ case Variant::OBJECT: {
+ if (p_object_as_id) {
+ flags |= ENCODE_FLAG_OBJECT_AS_ID;
+ }
+ } break;
}
if (buf) {
@@ -831,17 +964,7 @@ Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len) {
} break;
case Variant::STRING: {
- CharString utf8 = p_variant.operator String().utf8();
-
- if (buf) {
- encode_uint32(utf8.length(), buf);
- buf += 4;
- copymem(buf, utf8.get_data(), utf8.length());
- }
-
- r_len += 4 + utf8.length();
- while (r_len % 4)
- r_len++; //pad
+ _encode_string(p_variant, buf, r_len);
} break;
// math types
@@ -991,9 +1114,74 @@ Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len) {
ERR_EXPLAIN("Can't marshallize resources");
ERR_FAIL_V(ERR_INVALID_DATA); //no, i'm sorry, no go
} break;*/
- case Variant::_RID:
+ case Variant::_RID: {
+
+ } break;
case Variant::OBJECT: {
+ if (p_object_as_id) {
+
+ if (buf) {
+
+ Object *obj = p_variant;
+ ObjectID id = 0;
+ if (obj && ObjectDB::instance_validate(obj)) {
+ id = obj->get_instance_id();
+ }
+
+ encode_uint64(id, buf);
+ }
+
+ r_len += 8;
+
+ } else {
+ Object *obj = p_variant;
+ if (!obj) {
+ if (buf) {
+ encode_uint32(0, buf);
+ buf += 4;
+ r_len += 4;
+ }
+ } else {
+ _encode_string(obj->get_class(), buf, r_len);
+
+ List<PropertyInfo> props;
+ obj->get_property_list(&props);
+
+ int pc = 0;
+ for (List<PropertyInfo>::Element *E = props.front(); E; E = E->next()) {
+
+ if (!(E->get().usage & PROPERTY_USAGE_STORAGE))
+ continue;
+ pc++;
+ }
+
+ if (buf) {
+ encode_uint32(pc, buf);
+ buf += 4;
+ }
+
+ r_len += 4;
+
+ for (List<PropertyInfo>::Element *E = props.front(); E; E = E->next()) {
+
+ if (!(E->get().usage & PROPERTY_USAGE_STORAGE))
+ continue;
+
+ _encode_string(E->get().name, buf, r_len);
+
+ int len;
+ Error err = encode_variant(obj->get(E->get().name), buf, len, p_object_as_id);
+ if (err)
+ return err;
+ ERR_FAIL_COND_V(len % 4, ERR_BUG);
+ r_len += len;
+ if (buf)
+ buf += len;
+ }
+ }
+ }
+
} break;
case Variant::DICTIONARY: {
@@ -1024,12 +1212,12 @@ Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len) {
r_len++; //pad
*/
int len;
- encode_variant(E->get(), buf, len);
+ encode_variant(E->get(), buf, len, p_object_as_id);
ERR_FAIL_COND_V(len % 4, ERR_BUG);
r_len += len;
if (buf)
buf += len;
- encode_variant(d[E->get()], buf, len);
+ encode_variant(d[E->get()], buf, len, p_object_as_id);
ERR_FAIL_COND_V(len % 4, ERR_BUG);
r_len += len;
if (buf)
@@ -1051,7 +1239,7 @@ Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len) {
for (int i = 0; i < v.size(); i++) {
int len;
- encode_variant(v.get(i), buf, len);
+ encode_variant(v.get(i), buf, len, p_object_as_id);
ERR_FAIL_COND_V(len % 4, ERR_BUG);
r_len += len;
if (buf)
diff --git a/core/io/marshalls.h b/core/io/marshalls.h
index eb2785aa4e..234ae3b183 100644
--- a/core/io/marshalls.h
+++ b/core/io/marshalls.h
@@ -32,8 +32,8 @@
#include "typedefs.h"
+#include "reference.h"
#include "variant.h"
-
/**
* Miscellaneous helpers for marshalling data types, and encoding
* in an endian independent way
@@ -183,7 +183,22 @@ static inline double decode_double(const uint8_t *p_arr) {
return md.d;
}
-Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int *r_len = NULL);
-Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len);
+class EncodedObjectAsID : public Reference {
+ GDCLASS(EncodedObjectAsID, Reference);
+
+ ObjectID id;
+
+protected:
+ static void _bind_methods();
+
+public:
+ void set_object_id(ObjectID p_id);
+ ObjectID get_object_id() const;
+
+ EncodedObjectAsID();
+};
+
+Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int *r_len = NULL, bool p_allow_objects = true);
+Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len, bool p_object_as_id = false);
#endif
diff --git a/core/io/networked_multiplayer_peer.cpp b/core/io/networked_multiplayer_peer.cpp
index 105b8dce44..402526a52c 100644
--- a/core/io/networked_multiplayer_peer.cpp
+++ b/core/io/networked_multiplayer_peer.cpp
@@ -44,13 +44,13 @@ void NetworkedMultiplayerPeer::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_refuse_new_connections", "enable"), &NetworkedMultiplayerPeer::set_refuse_new_connections);
ClassDB::bind_method(D_METHOD("is_refusing_new_connections"), &NetworkedMultiplayerPeer::is_refusing_new_connections);
- BIND_CONSTANT(TRANSFER_MODE_UNRELIABLE);
- BIND_CONSTANT(TRANSFER_MODE_UNRELIABLE_ORDERED);
- BIND_CONSTANT(TRANSFER_MODE_RELIABLE);
+ BIND_ENUM_CONSTANT(TRANSFER_MODE_UNRELIABLE);
+ BIND_ENUM_CONSTANT(TRANSFER_MODE_UNRELIABLE_ORDERED);
+ BIND_ENUM_CONSTANT(TRANSFER_MODE_RELIABLE);
- BIND_CONSTANT(CONNECTION_DISCONNECTED);
- BIND_CONSTANT(CONNECTION_CONNECTING);
- BIND_CONSTANT(CONNECTION_CONNECTED);
+ BIND_ENUM_CONSTANT(CONNECTION_DISCONNECTED);
+ BIND_ENUM_CONSTANT(CONNECTION_CONNECTING);
+ BIND_ENUM_CONSTANT(CONNECTION_CONNECTED);
BIND_CONSTANT(TARGET_PEER_BROADCAST);
BIND_CONSTANT(TARGET_PEER_SERVER);
diff --git a/core/io/packet_peer.cpp b/core/io/packet_peer.cpp
index c028d7d197..ca00b8b480 100644
--- a/core/io/packet_peer.cpp
+++ b/core/io/packet_peer.cpp
@@ -35,9 +35,20 @@
PacketPeer::PacketPeer() {
+ allow_object_decoding = false;
last_get_error = OK;
}
+void PacketPeer::set_allow_object_decoding(bool p_enable) {
+
+ allow_object_decoding = p_enable;
+}
+
+bool PacketPeer::is_object_decoding_allowed() const {
+
+ return allow_object_decoding;
+}
+
Error PacketPeer::get_packet_buffer(PoolVector<uint8_t> &r_buffer) const {
const uint8_t *buffer;
@@ -75,13 +86,13 @@ Error PacketPeer::get_var(Variant &r_variant) const {
if (err)
return err;
- return decode_variant(r_variant, buffer, buffer_size);
+ return decode_variant(r_variant, buffer, buffer_size, NULL, allow_object_decoding);
}
Error PacketPeer::put_var(const Variant &p_packet) {
int len;
- Error err = encode_variant(p_packet, NULL, len); // compute len first
+ Error err = encode_variant(p_packet, NULL, len, !allow_object_decoding); // compute len first
if (err)
return err;
@@ -90,7 +101,7 @@ Error PacketPeer::put_var(const Variant &p_packet) {
uint8_t *buf = (uint8_t *)alloca(len);
ERR_FAIL_COND_V(!buf, ERR_OUT_OF_MEMORY);
- err = encode_variant(p_packet, buf, len);
+ err = encode_variant(p_packet, buf, len, !allow_object_decoding);
ERR_FAIL_COND_V(err, err);
return put_packet(buf, len);
@@ -126,6 +137,9 @@ void PacketPeer::_bind_methods() {
ClassDB::bind_method(D_METHOD("put_packet", "buffer"), &PacketPeer::_put_packet);
ClassDB::bind_method(D_METHOD("get_packet_error"), &PacketPeer::_get_packet_error);
ClassDB::bind_method(D_METHOD("get_available_packet_count"), &PacketPeer::get_available_packet_count);
+
+ ClassDB::bind_method(D_METHOD("set_allow_object_decoding", "enable"), &PacketPeer::set_allow_object_decoding);
+ ClassDB::bind_method(D_METHOD("is_object_decoding_allowed"), &PacketPeer::is_object_decoding_allowed);
};
/***************/
@@ -141,6 +155,8 @@ void PacketPeerStream::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_stream_peer", "peer"), &PacketPeerStream::_set_stream_peer);
ClassDB::bind_method(D_METHOD("set_input_buffer_max_size", "max_size_bytes"), &PacketPeerStream::set_input_buffer_max_size);
ClassDB::bind_method(D_METHOD("set_output_buffer_max_size", "max_size_bytes"), &PacketPeerStream::set_output_buffer_max_size);
+ ClassDB::bind_method(D_METHOD("get_input_buffer_max_size"), &PacketPeerStream::get_input_buffer_max_size);
+ ClassDB::bind_method(D_METHOD("get_output_buffer_max_size"), &PacketPeerStream::get_output_buffer_max_size);
}
Error PacketPeerStream::_poll_buffer() const {
@@ -251,12 +267,22 @@ void PacketPeerStream::set_input_buffer_max_size(int p_max_size) {
ERR_EXPLAIN("Buffer in use, resizing would cause loss of data");
ERR_FAIL_COND(ring_buffer.data_left());
ring_buffer.resize(nearest_shift(p_max_size + 4));
- input_buffer.resize(nearest_power_of_2(p_max_size + 4));
+ input_buffer.resize(next_power_of_2(p_max_size + 4));
+}
+
+int PacketPeerStream::get_input_buffer_max_size() const {
+
+ return input_buffer.size() - 4;
}
void PacketPeerStream::set_output_buffer_max_size(int p_max_size) {
- output_buffer.resize(nearest_power_of_2(p_max_size + 4));
+ output_buffer.resize(next_power_of_2(p_max_size + 4));
+}
+
+int PacketPeerStream::get_output_buffer_max_size() const {
+
+ return output_buffer.size() - 4;
}
PacketPeerStream::PacketPeerStream() {
diff --git a/core/io/packet_peer.h b/core/io/packet_peer.h
index ed6b252d80..597119f7f4 100644
--- a/core/io/packet_peer.h
+++ b/core/io/packet_peer.h
@@ -48,6 +48,8 @@ class PacketPeer : public Reference {
mutable Error last_get_error;
+ bool allow_object_decoding;
+
public:
virtual int get_available_packet_count() const = 0;
virtual Error get_packet(const uint8_t **r_buffer, int &r_buffer_size) const = 0; ///< buffer is GONE after next get_packet
@@ -63,6 +65,9 @@ public:
virtual Error get_var(Variant &r_variant) const;
virtual Error put_var(const Variant &p_packet);
+ void set_allow_object_decoding(bool p_enable);
+ bool is_object_decoding_allowed() const;
+
PacketPeer();
~PacketPeer() {}
};
@@ -93,7 +98,9 @@ public:
void set_stream_peer(const Ref<StreamPeer> &p_peer);
void set_input_buffer_max_size(int p_max_size);
+ int get_input_buffer_max_size() const;
void set_output_buffer_max_size(int p_max_size);
+ int get_output_buffer_max_size() const;
PacketPeerStream();
};
diff --git a/core/io/packet_peer_udp.h b/core/io/packet_peer_udp.h
index a39eb6bcfd..007b810b67 100644
--- a/core/io/packet_peer_udp.h
+++ b/core/io/packet_peer_udp.h
@@ -49,7 +49,7 @@ protected:
public:
void set_blocking_mode(bool p_enable);
- virtual Error listen(int p_port, IP_Address p_bind_address = IP_Address("*"), int p_recv_buffer_size = 65536) = 0;
+ virtual Error listen(int p_port, const IP_Address &p_bind_address = IP_Address("*"), int p_recv_buffer_size = 65536) = 0;
virtual void close() = 0;
virtual Error wait() = 0;
virtual bool is_listening() const = 0;
diff --git a/core/io/resource_import.cpp b/core/io/resource_import.cpp
index 61da4f3350..7033dbe5fb 100644
--- a/core/io/resource_import.cpp
+++ b/core/io/resource_import.cpp
@@ -199,6 +199,52 @@ String ResourceFormatImporter::get_internal_resource_path(const String &p_path)
return pat.path;
}
+void ResourceFormatImporter::get_internal_resource_path_list(const String &p_path, List<String> *r_paths) {
+
+ Error err;
+ FileAccess *f = FileAccess::open(p_path + ".import", FileAccess::READ, &err);
+
+ if (!f)
+ return;
+
+ VariantParser::StreamFile stream;
+ stream.f = f;
+
+ String assign;
+ Variant value;
+ VariantParser::Tag next_tag;
+
+ int lines = 0;
+ String error_text;
+ while (true) {
+
+ assign = Variant();
+ next_tag.fields.clear();
+ next_tag.name = String();
+
+ err = VariantParser::parse_tag_assign_eof(&stream, lines, error_text, next_tag, assign, value, NULL, true);
+ if (err == ERR_FILE_EOF) {
+ memdelete(f);
+ return;
+ } else if (err != OK) {
+ ERR_PRINTS("ResourceFormatImporter::get_internal_resource_path_list - " + p_path + ".import:" + itos(lines) + " error: " + error_text);
+ memdelete(f);
+ return;
+ }
+
+ if (assign != String()) {
+ if (assign.begins_with("path.")) {
+ r_paths->push_back(value);
+ } else if (assign == "path") {
+ r_paths->push_back(value);
+ }
+ } else if (next_tag.name != "remap") {
+ break;
+ }
+ }
+ memdelete(f);
+}
+
String ResourceFormatImporter::get_resource_type(const String &p_path) const {
PathAndType pat;
diff --git a/core/io/resource_import.h b/core/io/resource_import.h
index d3f98cbc07..67fd870178 100644
--- a/core/io/resource_import.h
+++ b/core/io/resource_import.h
@@ -59,6 +59,7 @@ public:
virtual bool can_be_imported(const String &p_path) const;
String get_internal_resource_path(const String &p_path) const;
+ void get_internal_resource_path_list(const String &p_path, List<String> *r_paths);
void add_importer(const Ref<ResourceImporter> &p_importer) { importers.insert(p_importer); }
void remove_importer(const Ref<ResourceImporter> &p_importer) { importers.erase(p_importer); }
diff --git a/core/io/stream_peer.cpp b/core/io/stream_peer.cpp
index fdad7c7bdf..7042700d92 100644
--- a/core/io/stream_peer.cpp
+++ b/core/io/stream_peer.cpp
@@ -210,7 +210,7 @@ void StreamPeer::put_double(double p_val) {
void StreamPeer::put_utf8_string(const String &p_string) {
CharString cs = p_string.utf8();
- put_u32(p_string.length());
+ put_u32(cs.length());
put_data((const uint8_t *)cs.get_data(), cs.length());
}
void StreamPeer::put_var(const Variant &p_variant) {
@@ -459,8 +459,9 @@ Error StreamPeerBuffer::get_partial_data(uint8_t *p_buffer, int p_bytes, int &r_
}
PoolVector<uint8_t>::Read r = data.read();
- copymem(p_buffer, r.ptr(), r_received);
+ copymem(p_buffer, r.ptr() + pointer, r_received);
+ pointer += r_received;
// FIXME: return what? OK or ERR_*
}
diff --git a/core/io/stream_peer_ssl.cpp b/core/io/stream_peer_ssl.cpp
index ef3c264375..24f6473330 100644
--- a/core/io/stream_peer_ssl.cpp
+++ b/core/io/stream_peer_ssl.cpp
@@ -55,10 +55,11 @@ void StreamPeerSSL::_bind_methods() {
ClassDB::bind_method(D_METHOD("connect_to_stream", "stream", "validate_certs", "for_hostname"), &StreamPeerSSL::connect_to_stream, DEFVAL(false), DEFVAL(String()));
ClassDB::bind_method(D_METHOD("get_status"), &StreamPeerSSL::get_status);
ClassDB::bind_method(D_METHOD("disconnect_from_stream"), &StreamPeerSSL::disconnect_from_stream);
- BIND_CONSTANT(STATUS_DISCONNECTED);
- BIND_CONSTANT(STATUS_CONNECTED);
- BIND_CONSTANT(STATUS_ERROR_NO_CERTIFICATE);
- BIND_CONSTANT(STATUS_ERROR_HOSTNAME_MISMATCH);
+
+ BIND_ENUM_CONSTANT(STATUS_DISCONNECTED);
+ BIND_ENUM_CONSTANT(STATUS_CONNECTED);
+ BIND_ENUM_CONSTANT(STATUS_ERROR_NO_CERTIFICATE);
+ BIND_ENUM_CONSTANT(STATUS_ERROR_HOSTNAME_MISMATCH);
}
StreamPeerSSL::StreamPeerSSL() {
diff --git a/core/io/stream_peer_tcp.cpp b/core/io/stream_peer_tcp.cpp
index 5c859ea7c0..ae5603aa31 100644
--- a/core/io/stream_peer_tcp.cpp
+++ b/core/io/stream_peer_tcp.cpp
@@ -55,10 +55,10 @@ void StreamPeerTCP::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_connected_port"), &StreamPeerTCP::get_connected_port);
ClassDB::bind_method(D_METHOD("disconnect_from_host"), &StreamPeerTCP::disconnect_from_host);
- BIND_CONSTANT(STATUS_NONE);
- BIND_CONSTANT(STATUS_CONNECTING);
- BIND_CONSTANT(STATUS_CONNECTED);
- BIND_CONSTANT(STATUS_ERROR);
+ BIND_ENUM_CONSTANT(STATUS_NONE);
+ BIND_ENUM_CONSTANT(STATUS_CONNECTING);
+ BIND_ENUM_CONSTANT(STATUS_CONNECTED);
+ BIND_ENUM_CONSTANT(STATUS_ERROR);
}
Ref<StreamPeerTCP> StreamPeerTCP::create_ref() {
diff --git a/core/io/tcp_server.h b/core/io/tcp_server.h
index 4e7fa7cf3e..b4ff3246ad 100644
--- a/core/io/tcp_server.h
+++ b/core/io/tcp_server.h
@@ -45,7 +45,7 @@ protected:
static void _bind_methods();
public:
- virtual Error listen(uint16_t p_port, const IP_Address p_bind_address = IP_Address("*")) = 0;
+ virtual Error listen(uint16_t p_port, const IP_Address &p_bind_address = IP_Address("*")) = 0;
virtual bool is_connection_available() const = 0;
virtual Ref<StreamPeerTCP> take_connection() = 0;
diff --git a/core/io/xml_parser.cpp b/core/io/xml_parser.cpp
index e5f4433b8f..d8b69b0951 100644
--- a/core/io/xml_parser.cpp
+++ b/core/io/xml_parser.cpp
@@ -373,13 +373,13 @@ void XMLParser::_bind_methods() {
ClassDB::bind_method(D_METHOD("open", "file"), &XMLParser::open);
ClassDB::bind_method(D_METHOD("open_buffer", "buffer"), &XMLParser::open_buffer);
- BIND_CONSTANT(NODE_NONE);
- BIND_CONSTANT(NODE_ELEMENT);
- BIND_CONSTANT(NODE_ELEMENT_END);
- BIND_CONSTANT(NODE_TEXT);
- BIND_CONSTANT(NODE_COMMENT);
- BIND_CONSTANT(NODE_CDATA);
- BIND_CONSTANT(NODE_UNKNOWN);
+ BIND_ENUM_CONSTANT(NODE_NONE);
+ BIND_ENUM_CONSTANT(NODE_ELEMENT);
+ BIND_ENUM_CONSTANT(NODE_ELEMENT_END);
+ BIND_ENUM_CONSTANT(NODE_TEXT);
+ BIND_ENUM_CONSTANT(NODE_COMMENT);
+ BIND_ENUM_CONSTANT(NODE_CDATA);
+ BIND_ENUM_CONSTANT(NODE_UNKNOWN);
};
Error XMLParser::read() {
diff --git a/core/math/geometry.cpp b/core/math/geometry.cpp
index 2bea514d37..9a5811244a 100644
--- a/core/math/geometry.cpp
+++ b/core/math/geometry.cpp
@@ -1076,8 +1076,8 @@ void Geometry::make_atlas(const Vector<Size2i> &p_rects, Vector<Point2i> &r_resu
for (int i = 0; i < results.size(); i++) {
- real_t h = nearest_power_of_2(results[i].max_h);
- real_t w = nearest_power_of_2(results[i].max_w);
+ real_t h = next_power_of_2(results[i].max_h);
+ real_t w = next_power_of_2(results[i].max_w);
real_t aspect = h > w ? h / w : w / h;
if (aspect < best_aspect) {
best = i;
diff --git a/core/math/math_2d.cpp b/core/math/math_2d.cpp
index 52e240ed47..956cfe5258 100644
--- a/core/math/math_2d.cpp
+++ b/core/math/math_2d.cpp
@@ -281,22 +281,22 @@ Vector2 Vector2::cubic_interpolate(const Vector2 &p_b, const Vector2 &p_pre_a, c
}
// slide returns the component of the vector along the given plane, specified by its normal vector.
-Vector2 Vector2::slide(const Vector2 &p_n) const {
+Vector2 Vector2::slide(const Vector2 &p_normal) const {
#ifdef MATH_CHECKS
- ERR_FAIL_COND_V(p_n.is_normalized() == false, Vector2());
+ ERR_FAIL_COND_V(p_normal.is_normalized() == false, Vector2());
#endif
- return *this - p_n * this->dot(p_n);
+ return *this - p_normal * this->dot(p_normal);
}
-Vector2 Vector2::bounce(const Vector2 &p_n) const {
- return -reflect(p_n);
+Vector2 Vector2::bounce(const Vector2 &p_normal) const {
+ return -reflect(p_normal);
}
-Vector2 Vector2::reflect(const Vector2 &p_n) const {
+Vector2 Vector2::reflect(const Vector2 &p_normal) const {
#ifdef MATH_CHECKS
- ERR_FAIL_COND_V(p_n.is_normalized() == false, Vector2());
+ ERR_FAIL_COND_V(p_normal.is_normalized() == false, Vector2());
#endif
- return 2.0 * p_n * this->dot(p_n) - *this;
+ return 2.0 * p_normal * this->dot(p_normal) - *this;
}
bool Rect2::intersects_segment(const Point2 &p_from, const Point2 &p_to, Point2 *r_pos, Point2 *r_normal) const {
diff --git a/core/math/math_2d.h b/core/math/math_2d.h
index b679371e03..6fea6c8adb 100644
--- a/core/math/math_2d.h
+++ b/core/math/math_2d.h
@@ -43,6 +43,14 @@ enum Margin {
MARGIN_BOTTOM
};
+enum Corner {
+
+ CORNER_TOP_LEFT,
+ CORNER_TOP_RIGHT,
+ CORNER_BOTTOM_RIGHT,
+ CORNER_BOTTOM_LEFT
+};
+
enum Orientation {
HORIZONTAL,
@@ -107,9 +115,9 @@ struct Vector2 {
Vector2 cubic_interpolate(const Vector2 &p_b, const Vector2 &p_pre_a, const Vector2 &p_post_b, real_t p_t) const;
Vector2 cubic_interpolate_soft(const Vector2 &p_b, const Vector2 &p_pre_a, const Vector2 &p_post_b, real_t p_t) const;
- Vector2 slide(const Vector2 &p_vec) const;
- Vector2 bounce(const Vector2 &p_vec) const;
- Vector2 reflect(const Vector2 &p_vec) const;
+ Vector2 slide(const Vector2 &p_normal) const;
+ Vector2 bounce(const Vector2 &p_normal) const;
+ Vector2 reflect(const Vector2 &p_normal) const;
Vector2 operator+(const Vector2 &p_v) const;
void operator+=(const Vector2 &p_v);
@@ -621,9 +629,9 @@ struct Transform2D {
void affine_invert();
Transform2D affine_inverse() const;
- void set_rotation(real_t p_phi);
+ void set_rotation(real_t p_rot);
real_t get_rotation() const;
- _FORCE_INLINE_ void set_rotation_and_scale(real_t p_phi, const Size2 &p_scale);
+ _FORCE_INLINE_ void set_rotation_and_scale(real_t p_rot, const Size2 &p_scale);
void rotate(real_t p_phi);
void scale(const Size2 &p_scale);
@@ -660,8 +668,8 @@ struct Transform2D {
_FORCE_INLINE_ Vector2 basis_xform_inv(const Vector2 &p_vec) const;
_FORCE_INLINE_ Vector2 xform(const Vector2 &p_vec) const;
_FORCE_INLINE_ Vector2 xform_inv(const Vector2 &p_vec) const;
- _FORCE_INLINE_ Rect2 xform(const Rect2 &p_vec) const;
- _FORCE_INLINE_ Rect2 xform_inv(const Rect2 &p_vec) const;
+ _FORCE_INLINE_ Rect2 xform(const Rect2 &p_rect) const;
+ _FORCE_INLINE_ Rect2 xform_inv(const Rect2 &p_rect) const;
operator String() const;
@@ -833,25 +841,25 @@ next4:
return true;
}
-Vector2 Transform2D::basis_xform(const Vector2 &v) const {
+Vector2 Transform2D::basis_xform(const Vector2 &p_vec) const {
return Vector2(
- tdotx(v),
- tdoty(v));
+ tdotx(p_vec),
+ tdoty(p_vec));
}
-Vector2 Transform2D::basis_xform_inv(const Vector2 &v) const {
+Vector2 Transform2D::basis_xform_inv(const Vector2 &p_vec) const {
return Vector2(
- elements[0].dot(v),
- elements[1].dot(v));
+ elements[0].dot(p_vec),
+ elements[1].dot(p_vec));
}
-Vector2 Transform2D::xform(const Vector2 &v) const {
+Vector2 Transform2D::xform(const Vector2 &p_vec) const {
return Vector2(
- tdotx(v),
- tdoty(v)) +
+ tdotx(p_vec),
+ tdoty(p_vec)) +
elements[2];
}
Vector2 Transform2D::xform_inv(const Vector2 &p_vec) const {
diff --git a/core/math/math_funcs.h b/core/math/math_funcs.h
index 45509a0808..2ce9a88622 100644
--- a/core/math/math_funcs.h
+++ b/core/math/math_funcs.h
@@ -153,8 +153,14 @@ public:
static _ALWAYS_INLINE_ double rad2deg(double p_y) { return p_y * 180.0 / Math_PI; }
static _ALWAYS_INLINE_ float rad2deg(float p_y) { return p_y * 180.0 / Math_PI; }
- static _ALWAYS_INLINE_ double lerp(double a, double b, double c) { return a + (b - a) * c; }
- static _ALWAYS_INLINE_ float lerp(float a, float b, float c) { return a + (b - a) * c; }
+ static _ALWAYS_INLINE_ double lerp(double p_from, double p_to, double p_weight) { return p_from + (p_to - p_from) * p_weight; }
+ static _ALWAYS_INLINE_ float lerp(float p_from, float p_to, float p_weight) { return p_from + (p_to - p_from) * p_weight; }
+
+ static _ALWAYS_INLINE_ double inverse_lerp(double p_from, double p_to, double p_value) { return (p_value - p_from) / (p_to - p_from); }
+ static _ALWAYS_INLINE_ float inverse_lerp(float p_from, float p_to, float p_value) { return (p_value - p_from) / (p_to - p_from); }
+
+ static _ALWAYS_INLINE_ double range_lerp(double p_value, double p_istart, double p_istop, double p_ostart, double p_ostop) { return Math::lerp(p_ostart, p_ostop, Math::inverse_lerp(p_istart, p_istop, p_value)); }
+ static _ALWAYS_INLINE_ float range_lerp(float p_value, float p_istart, float p_istop, float p_ostart, float p_ostop) { return Math::lerp(p_ostart, p_ostop, Math::inverse_lerp(p_istart, p_istop, p_value)); }
static _ALWAYS_INLINE_ double linear2db(double p_linear) { return Math::log(p_linear) * 8.6858896380650365530225783783321; }
static _ALWAYS_INLINE_ float linear2db(float p_linear) { return Math::log(p_linear) * 8.6858896380650365530225783783321; }
diff --git a/core/math/matrix3.cpp b/core/math/matrix3.cpp
index f2f6ff93cf..ec82bd30d4 100644
--- a/core/math/matrix3.cpp
+++ b/core/math/matrix3.cpp
@@ -365,14 +365,10 @@ Vector3 Basis::get_euler_xyz() const {
if (euler.y < Math_PI * 0.5) {
if (euler.y > -Math_PI * 0.5) {
//if rotation is Y-only, return a proper -pi,pi range like in x or z for the same case.
- if (elements[1][0] == 0.0 && elements[0][1] == 0.0 && elements[0][0] < 0.0) {
+ if (elements[1][0] == 0.0 && elements[0][1] == 0.0 && elements[1][2] == 0 && elements[2][1] == 0 && elements[1][1] == 1) {
euler.x = 0;
+ euler.y = atan2(elements[0][2], elements[0][0]);
euler.z = 0;
-
- if (euler.y > 0.0)
- euler.y = Math_PI - euler.y;
- else
- euler.y = -(Math_PI + euler.y);
} else {
euler.x = Math::atan2(-elements[1][2], elements[2][2]);
euler.z = Math::atan2(-elements[0][1], elements[0][0]);
@@ -436,15 +432,10 @@ Vector3 Basis::get_euler_yxz() const {
if (m12 < 1) {
if (m12 > -1) {
- if (elements[1][0] == 0 && elements[0][1] == 0 && elements[2][2] < 0) { // use pure x rotation
- real_t x = asin(-m12);
+ if (elements[1][0] == 0 && elements[0][1] == 0 && elements[0][2] == 0 && elements[2][0] == 0 && elements[0][0] == 1) { // use pure x rotation
+ euler.x = atan2(-m12, elements[1][1]);
euler.y = 0;
euler.z = 0;
-
- if (x > 0.0)
- euler.x = Math_PI - x;
- else
- euler.x = -(Math_PI + x);
} else {
euler.x = asin(-m12);
euler.y = atan2(elements[0][2], elements[2][2]);
diff --git a/core/math/octree.h b/core/math/octree.h
index 010c1b18f7..2e37056030 100644
--- a/core/math/octree.h
+++ b/core/math/octree.h
@@ -351,7 +351,7 @@ private:
};
void _cull_convex(Octant *p_octant, _CullConvexData *p_cull);
- void _cull_AABB(Octant *p_octant, const Rect3 &p_aabb, T **p_result_array, int *p_result_idx, int p_result_max, int *p_subindex_array, uint32_t p_mask);
+ void _cull_aabb(Octant *p_octant, const Rect3 &p_aabb, T **p_result_array, int *p_result_idx, int p_result_max, int *p_subindex_array, uint32_t p_mask);
void _cull_segment(Octant *p_octant, const Vector3 &p_from, const Vector3 &p_to, T **p_result_array, int *p_result_idx, int p_result_max, int *p_subindex_array, uint32_t p_mask);
void _cull_point(Octant *p_octant, const Vector3 &p_point, T **p_result_array, int *p_result_idx, int p_result_max, int *p_subindex_array, uint32_t p_mask);
@@ -380,7 +380,7 @@ public:
int get_subindex(OctreeElementID p_id) const;
int cull_convex(const Vector<Plane> &p_convex, T **p_result_array, int p_result_max, uint32_t p_mask = 0xFFFFFFFF);
- int cull_AABB(const Rect3 &p_aabb, T **p_result_array, int p_result_max, int *p_subindex_array = NULL, uint32_t p_mask = 0xFFFFFFFF);
+ int cull_aabb(const Rect3 &p_aabb, T **p_result_array, int p_result_max, int *p_subindex_array = NULL, uint32_t p_mask = 0xFFFFFFFF);
int cull_segment(const Vector3 &p_from, const Vector3 &p_to, T **p_result_array, int p_result_max, int *p_subindex_array = NULL, uint32_t p_mask = 0xFFFFFFFF);
int cull_point(const Vector3 &p_point, T **p_result_array, int p_result_max, int *p_subindex_array = NULL, uint32_t p_mask = 0xFFFFFFFF);
@@ -1095,7 +1095,7 @@ void Octree<T, use_pairs, AL>::_cull_convex(Octant *p_octant, _CullConvexData *p
}
template <class T, bool use_pairs, class AL>
-void Octree<T, use_pairs, AL>::_cull_AABB(Octant *p_octant, const Rect3 &p_aabb, T **p_result_array, int *p_result_idx, int p_result_max, int *p_subindex_array, uint32_t p_mask) {
+void Octree<T, use_pairs, AL>::_cull_aabb(Octant *p_octant, const Rect3 &p_aabb, T **p_result_array, int *p_result_idx, int p_result_max, int *p_subindex_array, uint32_t p_mask) {
if (*p_result_idx == p_result_max)
return; //pointless
@@ -1160,7 +1160,7 @@ void Octree<T, use_pairs, AL>::_cull_AABB(Octant *p_octant, const Rect3 &p_aabb,
for (int i = 0; i < 8; i++) {
if (p_octant->children[i] && p_octant->children[i]->aabb.intersects_inclusive(p_aabb)) {
- _cull_AABB(p_octant->children[i], p_aabb, p_result_array, p_result_idx, p_result_max, p_subindex_array, p_mask);
+ _cull_aabb(p_octant->children[i], p_aabb, p_result_array, p_result_idx, p_result_max, p_subindex_array, p_mask);
}
}
}
@@ -1336,14 +1336,14 @@ int Octree<T, use_pairs, AL>::cull_convex(const Vector<Plane> &p_convex, T **p_r
}
template <class T, bool use_pairs, class AL>
-int Octree<T, use_pairs, AL>::cull_AABB(const Rect3 &p_aabb, T **p_result_array, int p_result_max, int *p_subindex_array, uint32_t p_mask) {
+int Octree<T, use_pairs, AL>::cull_aabb(const Rect3 &p_aabb, T **p_result_array, int p_result_max, int *p_subindex_array, uint32_t p_mask) {
if (!root)
return 0;
int result_count = 0;
pass++;
- _cull_AABB(root, p_aabb, p_result_array, &result_count, p_result_max, p_subindex_array, p_mask);
+ _cull_aabb(root, p_aabb, p_result_array, &result_count, p_result_max, p_subindex_array, p_mask);
return result_count;
}
diff --git a/core/math/plane.cpp b/core/math/plane.cpp
index f5e92866c4..17928d07c3 100644
--- a/core/math/plane.cpp
+++ b/core/math/plane.cpp
@@ -103,7 +103,7 @@ bool Plane::intersect_3(const Plane &p_plane1, const Plane &p_plane2, Vector3 *r
return true;
}
-bool Plane::intersects_ray(Vector3 p_from, Vector3 p_dir, Vector3 *p_intersection) const {
+bool Plane::intersects_ray(const Vector3 &p_from, const Vector3 &p_dir, Vector3 *p_intersection) const {
Vector3 segment = p_dir;
real_t den = normal.dot(segment);
@@ -128,7 +128,7 @@ bool Plane::intersects_ray(Vector3 p_from, Vector3 p_dir, Vector3 *p_intersectio
return true;
}
-bool Plane::intersects_segment(Vector3 p_begin, Vector3 p_end, Vector3 *p_intersection) const {
+bool Plane::intersects_segment(const Vector3 &p_begin, const Vector3 &p_end, Vector3 *p_intersection) const {
Vector3 segment = p_begin - p_end;
real_t den = normal.dot(segment);
diff --git a/core/math/plane.h b/core/math/plane.h
index 92ebcd8024..73d584e553 100644
--- a/core/math/plane.h
+++ b/core/math/plane.h
@@ -56,8 +56,8 @@ public:
/* intersections */
bool intersect_3(const Plane &p_plane1, const Plane &p_plane2, Vector3 *r_result = 0) const;
- bool intersects_ray(Vector3 p_from, Vector3 p_dir, Vector3 *p_intersection) const;
- bool intersects_segment(Vector3 p_begin, Vector3 p_end, Vector3 *p_intersection) const;
+ bool intersects_ray(const Vector3 &p_from, const Vector3 &p_dir, Vector3 *p_intersection) const;
+ bool intersects_segment(const Vector3 &p_begin, const Vector3 &p_end, Vector3 *p_intersection) const;
_FORCE_INLINE_ Vector3 project(const Vector3 &p_point) const {
diff --git a/core/math/rect3.h b/core/math/rect3.h
index e5d7462009..4890a19d99 100644
--- a/core/math/rect3.h
+++ b/core/math/rect3.h
@@ -47,12 +47,12 @@ public:
real_t get_area() const; /// get area
_FORCE_INLINE_ bool has_no_area() const {
- return (size.x <= CMP_EPSILON || size.y <= CMP_EPSILON || size.z <= CMP_EPSILON);
+ return (size.x <= 0 || size.y <= 0 || size.z <= 0);
}
_FORCE_INLINE_ bool has_no_surface() const {
- return (size.x <= CMP_EPSILON && size.y <= CMP_EPSILON && size.z <= CMP_EPSILON);
+ return (size.x <= 0 && size.y <= 0 && size.z <= 0);
}
const Vector3 &get_position() const { return position; }
@@ -72,9 +72,9 @@ public:
Rect3 intersection(const Rect3 &p_aabb) const; ///get box where two intersect, empty if no intersection occurs
bool intersects_segment(const Vector3 &p_from, const Vector3 &p_to, Vector3 *r_clip = NULL, Vector3 *r_normal = NULL) const;
bool intersects_ray(const Vector3 &p_from, const Vector3 &p_dir, Vector3 *r_clip = NULL, Vector3 *r_normal = NULL) const;
- _FORCE_INLINE_ bool smits_intersect_ray(const Vector3 &from, const Vector3 &p_dir, real_t t0, real_t t1) const;
+ _FORCE_INLINE_ bool smits_intersect_ray(const Vector3 &p_from, const Vector3 &p_dir, real_t t0, real_t t1) const;
- _FORCE_INLINE_ bool intersects_convex_shape(const Plane *p_plane, int p_plane_count) const;
+ _FORCE_INLINE_ bool intersects_convex_shape(const Plane *p_planes, int p_plane_count) const;
bool intersects_plane(const Plane &p_plane) const;
_FORCE_INLINE_ bool has_point(const Vector3 &p_point) const;
@@ -326,27 +326,27 @@ inline real_t Rect3::get_shortest_axis_size() const {
return max_size;
}
-bool Rect3::smits_intersect_ray(const Vector3 &from, const Vector3 &dir, real_t t0, real_t t1) const {
+bool Rect3::smits_intersect_ray(const Vector3 &p_from, const Vector3 &p_dir, real_t t0, real_t t1) const {
- real_t divx = 1.0 / dir.x;
- real_t divy = 1.0 / dir.y;
- real_t divz = 1.0 / dir.z;
+ real_t divx = 1.0 / p_dir.x;
+ real_t divy = 1.0 / p_dir.y;
+ real_t divz = 1.0 / p_dir.z;
Vector3 upbound = position + size;
real_t tmin, tmax, tymin, tymax, tzmin, tzmax;
- if (dir.x >= 0) {
- tmin = (position.x - from.x) * divx;
- tmax = (upbound.x - from.x) * divx;
+ if (p_dir.x >= 0) {
+ tmin = (position.x - p_from.x) * divx;
+ tmax = (upbound.x - p_from.x) * divx;
} else {
- tmin = (upbound.x - from.x) * divx;
- tmax = (position.x - from.x) * divx;
+ tmin = (upbound.x - p_from.x) * divx;
+ tmax = (position.x - p_from.x) * divx;
}
- if (dir.y >= 0) {
- tymin = (position.y - from.y) * divy;
- tymax = (upbound.y - from.y) * divy;
+ if (p_dir.y >= 0) {
+ tymin = (position.y - p_from.y) * divy;
+ tymax = (upbound.y - p_from.y) * divy;
} else {
- tymin = (upbound.y - from.y) * divy;
- tymax = (position.y - from.y) * divy;
+ tymin = (upbound.y - p_from.y) * divy;
+ tymax = (position.y - p_from.y) * divy;
}
if ((tmin > tymax) || (tymin > tmax))
return false;
@@ -354,12 +354,12 @@ bool Rect3::smits_intersect_ray(const Vector3 &from, const Vector3 &dir, real_t
tmin = tymin;
if (tymax < tmax)
tmax = tymax;
- if (dir.z >= 0) {
- tzmin = (position.z - from.z) * divz;
- tzmax = (upbound.z - from.z) * divz;
+ if (p_dir.z >= 0) {
+ tzmin = (position.z - p_from.z) * divz;
+ tzmax = (upbound.z - p_from.z) * divz;
} else {
- tzmin = (upbound.z - from.z) * divz;
- tzmax = (position.z - from.z) * divz;
+ tzmin = (upbound.z - p_from.z) * divz;
+ tzmax = (position.z - p_from.z) * divz;
}
if ((tmin > tzmax) || (tzmin > tmax))
return false;
diff --git a/core/math/vector3.h b/core/math/vector3.h
index 6a7974681e..c58a86fbdb 100644
--- a/core/math/vector3.h
+++ b/core/math/vector3.h
@@ -108,9 +108,9 @@ struct Vector3 {
_FORCE_INLINE_ real_t angle_to(const Vector3 &p_b) const;
- _FORCE_INLINE_ Vector3 slide(const Vector3 &p_vec) const;
- _FORCE_INLINE_ Vector3 bounce(const Vector3 &p_vec) const;
- _FORCE_INLINE_ Vector3 reflect(const Vector3 &p_vec) const;
+ _FORCE_INLINE_ Vector3 slide(const Vector3 &p_normal) const;
+ _FORCE_INLINE_ Vector3 bounce(const Vector3 &p_normal) const;
+ _FORCE_INLINE_ Vector3 reflect(const Vector3 &p_normal) const;
/* Operators */
@@ -410,22 +410,22 @@ void Vector3::zero() {
}
// slide returns the component of the vector along the given plane, specified by its normal vector.
-Vector3 Vector3::slide(const Vector3 &p_n) const {
+Vector3 Vector3::slide(const Vector3 &p_normal) const {
#ifdef MATH_CHECKS
- ERR_FAIL_COND_V(p_n.is_normalized() == false, Vector3());
+ ERR_FAIL_COND_V(p_normal.is_normalized() == false, Vector3());
#endif
- return *this - p_n * this->dot(p_n);
+ return *this - p_normal * this->dot(p_normal);
}
-Vector3 Vector3::bounce(const Vector3 &p_n) const {
- return -reflect(p_n);
+Vector3 Vector3::bounce(const Vector3 &p_normal) const {
+ return -reflect(p_normal);
}
-Vector3 Vector3::reflect(const Vector3 &p_n) const {
+Vector3 Vector3::reflect(const Vector3 &p_normal) const {
#ifdef MATH_CHECKS
- ERR_FAIL_COND_V(p_n.is_normalized() == false, Vector3());
+ ERR_FAIL_COND_V(p_normal.is_normalized() == false, Vector3());
#endif
- return 2.0 * p_n * this->dot(p_n) - *this;
+ return 2.0 * p_normal * this->dot(p_normal) - *this;
}
#endif
diff --git a/core/method_bind.h b/core/method_bind.h
index 3b4ff96a19..157a67ca20 100644
--- a/core/method_bind.h
+++ b/core/method_bind.h
@@ -124,6 +124,9 @@ struct VariantCaster<const T &> {
#endif
+// Object enum casts must go here
+VARIANT_ENUM_CAST(Object::ConnectFlags);
+
#define CHECK_ARG(m_arg) \
if ((m_arg - 1) < p_arg_count) { \
Variant::Type argtype = get_argument_type(m_arg - 1); \
@@ -148,13 +151,35 @@ struct VariantCaster<const T &> {
VARIANT_ENUM_CAST(Vector3::Axis);
VARIANT_ENUM_CAST(Error);
-VARIANT_ENUM_CAST(wchar_t);
VARIANT_ENUM_CAST(Margin);
+VARIANT_ENUM_CAST(Corner);
VARIANT_ENUM_CAST(Orientation);
VARIANT_ENUM_CAST(HAlign);
+VARIANT_ENUM_CAST(VAlign);
+VARIANT_ENUM_CAST(PropertyHint);
+VARIANT_ENUM_CAST(PropertyUsageFlags);
+VARIANT_ENUM_CAST(MethodFlags);
VARIANT_ENUM_CAST(Variant::Type);
VARIANT_ENUM_CAST(Variant::Operator);
+template <>
+struct VariantCaster<wchar_t> {
+ static _FORCE_INLINE_ wchar_t cast(const Variant &p_variant) {
+ return (wchar_t)p_variant.operator int();
+ }
+};
+#ifdef PTRCALL_ENABLED
+template <>
+struct PtrToArg<wchar_t> {
+ _FORCE_INLINE_ static wchar_t convert(const void *p_ptr) {
+ return wchar_t(*reinterpret_cast<const int *>(p_ptr));
+ }
+ _FORCE_INLINE_ static void encode(wchar_t p_val, const void *p_ptr) {
+ *(int *)p_ptr = p_val;
+ }
+};
+#endif
+
class MethodBind {
int method_id;
diff --git a/core/method_ptrcall.h b/core/method_ptrcall.h
index ead58c23c8..d8755fd98b 100644
--- a/core/method_ptrcall.h
+++ b/core/method_ptrcall.h
@@ -80,6 +80,26 @@ struct PtrToArg {
} \
}
+#define MAKE_PTRARG_BY_REFERENCE(m_type) \
+ template <> \
+ struct PtrToArg<m_type> { \
+ _FORCE_INLINE_ static m_type convert(const void *p_ptr) { \
+ return *reinterpret_cast<const m_type *>(p_ptr); \
+ } \
+ _FORCE_INLINE_ static void encode(const m_type &p_val, void *p_ptr) { \
+ *((m_type *)p_ptr) = p_val; \
+ } \
+ }; \
+ template <> \
+ struct PtrToArg<const m_type &> { \
+ _FORCE_INLINE_ static m_type convert(const void *p_ptr) { \
+ return *reinterpret_cast<const m_type *>(p_ptr); \
+ } \
+ _FORCE_INLINE_ static void encode(const m_type &p_val, void *p_ptr) { \
+ *((m_type *)p_ptr) = p_val; \
+ } \
+ }
+
MAKE_PTRARG(bool);
MAKE_PTRARGCONV(uint8_t, int64_t);
MAKE_PTRARGCONV(int8_t, int64_t);
@@ -95,14 +115,14 @@ MAKE_PTRARG(double);
MAKE_PTRARG(String);
MAKE_PTRARG(Vector2);
MAKE_PTRARG(Rect2);
-MAKE_PTRARG(Vector3);
+MAKE_PTRARG_BY_REFERENCE(Vector3);
MAKE_PTRARG(Transform2D);
-MAKE_PTRARG(Plane);
+MAKE_PTRARG_BY_REFERENCE(Plane);
MAKE_PTRARG(Quat);
-MAKE_PTRARG(Rect3);
-MAKE_PTRARG(Basis);
-MAKE_PTRARG(Transform);
-MAKE_PTRARG(Color);
+MAKE_PTRARG_BY_REFERENCE(Rect3);
+MAKE_PTRARG_BY_REFERENCE(Basis);
+MAKE_PTRARG_BY_REFERENCE(Transform);
+MAKE_PTRARG_BY_REFERENCE(Color);
MAKE_PTRARG(NodePath);
MAKE_PTRARG(RID);
MAKE_PTRARG(Dictionary);
@@ -114,7 +134,7 @@ MAKE_PTRARG(PoolStringArray);
MAKE_PTRARG(PoolVector2Array);
MAKE_PTRARG(PoolVector3Array);
MAKE_PTRARG(PoolColorArray);
-MAKE_PTRARG(Variant);
+MAKE_PTRARG_BY_REFERENCE(Variant);
//this is for Object
@@ -311,8 +331,29 @@ MAKE_DVECARR(Plane);
} \
}
+#define MAKE_STRINGCONV_BY_REFERENCE(m_type) \
+ template <> \
+ struct PtrToArg<m_type> { \
+ _FORCE_INLINE_ static m_type convert(const void *p_ptr) { \
+ m_type s = *reinterpret_cast<const String *>(p_ptr); \
+ return s; \
+ } \
+ _FORCE_INLINE_ static void encode(const m_type &p_vec, void *p_ptr) { \
+ String *arr = reinterpret_cast<String *>(p_ptr); \
+ *arr = p_vec; \
+ } \
+ }; \
+ \
+ template <> \
+ struct PtrToArg<const m_type &> { \
+ _FORCE_INLINE_ static m_type convert(const void *p_ptr) { \
+ m_type s = *reinterpret_cast<const String *>(p_ptr); \
+ return s; \
+ } \
+ }
+
MAKE_STRINGCONV(StringName);
-MAKE_STRINGCONV(IP_Address);
+MAKE_STRINGCONV_BY_REFERENCE(IP_Address);
template <>
struct PtrToArg<PoolVector<Face3> > {
diff --git a/core/object.cpp b/core/object.cpp
index 62b2b5d545..a43a9c85b1 100644
--- a/core/object.cpp
+++ b/core/object.cpp
@@ -1560,7 +1560,7 @@ void Object::initialize_class() {
initialized = true;
}
-StringName Object::XL_MESSAGE(const StringName &p_message) const {
+StringName Object::tr(const StringName &p_message) const {
if (!_can_translate || !TranslationServer::get_singleton())
return p_message;
@@ -1568,11 +1568,6 @@ StringName Object::XL_MESSAGE(const StringName &p_message) const {
return TranslationServer::get_singleton()->translate(p_message);
}
-StringName Object::tr(const StringName &p_message) const {
-
- return XL_MESSAGE(p_message);
-}
-
void Object::_clear_internal_resource_paths(const Variant &p_var) {
switch (p_var.get_type()) {
@@ -1712,11 +1707,10 @@ void Object::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_block_signals", "enable"), &Object::set_block_signals);
ClassDB::bind_method(D_METHOD("is_blocking_signals"), &Object::is_blocking_signals);
- ClassDB::bind_method(D_METHOD("set_message_translation", "enable"), &Object::set_message_translation);
- ClassDB::bind_method(D_METHOD("can_translate_messages"), &Object::can_translate_messages);
ClassDB::bind_method(D_METHOD("property_list_changed_notify"), &Object::property_list_changed_notify);
- ClassDB::bind_method(D_METHOD("XL_MESSAGE", "message"), &Object::XL_MESSAGE);
+ ClassDB::bind_method(D_METHOD("set_message_translation", "enable"), &Object::set_message_translation);
+ ClassDB::bind_method(D_METHOD("can_translate_messages"), &Object::can_translate_messages);
ClassDB::bind_method(D_METHOD("tr", "message"), &Object::tr);
ClassDB::bind_method(D_METHOD("is_queued_for_deletion"), &Object::is_queued_for_deletion);
@@ -1743,9 +1737,9 @@ void Object::_bind_methods() {
BIND_CONSTANT(NOTIFICATION_POSTINITIALIZE);
BIND_CONSTANT(NOTIFICATION_PREDELETE);
- BIND_CONSTANT(CONNECT_DEFERRED);
- BIND_CONSTANT(CONNECT_PERSIST);
- BIND_CONSTANT(CONNECT_ONESHOT);
+ BIND_ENUM_CONSTANT(CONNECT_DEFERRED);
+ BIND_ENUM_CONSTANT(CONNECT_PERSIST);
+ BIND_ENUM_CONSTANT(CONNECT_ONESHOT);
}
void Object::call_deferred(const StringName &p_method, VARIANT_ARG_DECLARE) {
diff --git a/core/object.h b/core/object.h
index 551c3c31b9..8a858b5b00 100644
--- a/core/object.h
+++ b/core/object.h
@@ -83,6 +83,7 @@ enum PropertyHint {
PROPERTY_HINT_PROPERTY_OF_BASE_TYPE, ///< a property of a base type
PROPERTY_HINT_PROPERTY_OF_INSTANCE, ///< a property of an instance
PROPERTY_HINT_PROPERTY_OF_SCRIPT, ///< a property of a script & base
+ PROPERTY_HINT_OBJECT_TOO_BIG, ///< object is too big to send
PROPERTY_HINT_MAX,
};
@@ -443,7 +444,7 @@ private:
mutable StringName _class_name;
mutable const StringName *_class_ptr;
- void _add_user_signal(const String &p_name, const Array &p_pargs = Array());
+ void _add_user_signal(const String &p_name, const Array &p_args = Array());
bool _has_user_signal(const StringName &p_name) const;
Variant _emit_signal(const Variant **p_args, int p_argcount, Variant::CallError &r_error);
Array _get_signal_list() const;
@@ -678,8 +679,7 @@ public:
virtual void get_argument_options(const StringName &p_function, int p_idx, List<String> *r_options) const;
- StringName XL_MESSAGE(const StringName &p_message) const; //translate message (internationalization)
- StringName tr(const StringName &p_message) const; //translate message (alternative)
+ StringName tr(const StringName &p_message) const; // translate message (internationalization)
bool _is_queued_for_deletion; // set to true by SceneTree::queue_delete()
bool is_queued_for_deletion() const;
diff --git a/core/os/file_access.cpp b/core/os/file_access.cpp
index 3bd5ac3f41..9d1fefc925 100644
--- a/core/os/file_access.cpp
+++ b/core/os/file_access.cpp
@@ -475,9 +475,9 @@ void FileAccess::store_buffer(const uint8_t *p_src, int p_length) {
store_8(p_src[i]);
}
-Vector<uint8_t> FileAccess::get_file_as_array(const String &p_file) {
+Vector<uint8_t> FileAccess::get_file_as_array(const String &p_path) {
- FileAccess *f = FileAccess::open(p_file, READ);
+ FileAccess *f = FileAccess::open(p_path, READ);
ERR_FAIL_COND_V(!f, Vector<uint8_t>());
Vector<uint8_t> data;
data.resize(f->get_len());
diff --git a/core/os/file_access.h b/core/os/file_access.h
index 6d3e491167..beed7551fb 100644
--- a/core/os/file_access.h
+++ b/core/os/file_access.h
@@ -129,7 +129,7 @@ public:
virtual void store_real(real_t p_real);
virtual void store_string(const String &p_string);
- virtual void store_line(const String &p_string);
+ virtual void store_line(const String &p_line);
virtual void store_pascal_string(const String &p_string);
virtual String get_pascal_string();
diff --git a/core/os/input.cpp b/core/os/input.cpp
index c7b32b939a..81ca31da25 100644
--- a/core/os/input.cpp
+++ b/core/os/input.cpp
@@ -86,10 +86,10 @@ void Input::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_custom_mouse_cursor", "image", "hotspot"), &Input::set_custom_mouse_cursor, DEFVAL(Vector2()));
ClassDB::bind_method(D_METHOD("parse_input_event", "event"), &Input::parse_input_event);
- BIND_CONSTANT(MOUSE_MODE_VISIBLE);
- BIND_CONSTANT(MOUSE_MODE_HIDDEN);
- BIND_CONSTANT(MOUSE_MODE_CAPTURED);
- BIND_CONSTANT(MOUSE_MODE_CONFINED);
+ BIND_ENUM_CONSTANT(MOUSE_MODE_VISIBLE);
+ BIND_ENUM_CONSTANT(MOUSE_MODE_HIDDEN);
+ BIND_ENUM_CONSTANT(MOUSE_MODE_CAPTURED);
+ BIND_ENUM_CONSTANT(MOUSE_MODE_CONFINED);
ADD_SIGNAL(MethodInfo("joy_connection_changed", PropertyInfo(Variant::INT, "index"), PropertyInfo(Variant::BOOL, "connected")));
}
diff --git a/core/os/input_event.cpp b/core/os/input_event.cpp
index fe0e2c2524..cb38eb67b6 100644
--- a/core/os/input_event.cpp
+++ b/core/os/input_event.cpp
@@ -595,6 +595,11 @@ float InputEventJoypadMotion::get_axis_value() const {
return axis_value;
}
+bool InputEventJoypadMotion::is_pressed() const {
+
+ return Math::abs(axis_value) > 0.5f;
+}
+
bool InputEventJoypadMotion::action_match(const Ref<InputEvent> &p_event) const {
Ref<InputEventJoypadMotion> jm = p_event;
diff --git a/core/os/input_event.h b/core/os/input_event.h
index b120d4b840..d1fd7cc90f 100644
--- a/core/os/input_event.h
+++ b/core/os/input_event.h
@@ -348,6 +348,7 @@ public:
void set_axis_value(float p_value);
float get_axis_value() const;
+ virtual bool is_pressed() const;
virtual bool action_match(const Ref<InputEvent> &p_event) const;
virtual bool is_action_type() const { return true; }
diff --git a/core/os/keyboard.h b/core/os/keyboard.h
index 1ed93e3540..1ef26de183 100644
--- a/core/os/keyboard.h
+++ b/core/os/keyboard.h
@@ -324,7 +324,7 @@ enum KeyModifierMask {
};
String keycode_get_string(uint32_t p_code);
-bool keycode_has_unicode(uint32_t p_unicode);
+bool keycode_has_unicode(uint32_t p_keycode);
int find_keycode(const String &p_code);
int keycode_get_count();
int keycode_get_value_by_index(int p_index);
diff --git a/core/pair.h b/core/pair.h
index d4b1897537..d517339ddf 100644
--- a/core/pair.h
+++ b/core/pair.h
@@ -37,7 +37,7 @@ struct Pair {
S second;
Pair() {}
- Pair(F p_first, S p_second)
+ Pair(F p_first, const S &p_second)
: first(p_first),
second(p_second) {
}
diff --git a/core/project_settings.h b/core/project_settings.h
index c64bb393d1..cee3b3b5f3 100644
--- a/core/project_settings.h
+++ b/core/project_settings.h
@@ -158,7 +158,7 @@ public:
bool is_using_datapack() const;
- void set_registering_order(bool p_registering);
+ void set_registering_order(bool p_enable);
ProjectSettings();
~ProjectSettings();
diff --git a/core/reference.h b/core/reference.h
index 7f48f8323e..69250a4701 100644
--- a/core/reference.h
+++ b/core/reference.h
@@ -374,6 +374,10 @@ struct PtrToArg<const RefPtr &> {
}
};
+#endif // PTRCALL_ENABLED
+
+#ifdef DEBUG_METHODS_ENABLED
+
template <class T>
struct GetTypeInfo<Ref<T> > {
enum { VARIANT_TYPE = Variant::OBJECT };
@@ -392,5 +396,6 @@ struct GetTypeInfo<const Ref<T> &> {
}
};
-#endif
+#endif // DEBUG_METHODS_ENABLED
+
#endif // REFERENCE_H
diff --git a/core/register_core_types.cpp b/core/register_core_types.cpp
index 43f781af55..e5441093ac 100644
--- a/core/register_core_types.cpp
+++ b/core/register_core_types.cpp
@@ -39,6 +39,7 @@
#include "input_map.h"
#include "io/config_file.h"
#include "io/http_client.h"
+#include "io/marshalls.h"
#include "io/packet_peer.h"
#include "io/packet_peer_udp.h"
#include "io/pck_packer.h"
@@ -56,7 +57,6 @@
#include "project_settings.h"
#include "translation.h"
#include "undo_redo.h"
-
static ResourceFormatSaverBinary *resource_saver_binary = NULL;
static ResourceFormatLoaderBinary *resource_loader_binary = NULL;
static ResourceFormatImporter *resource_format_importer = NULL;
@@ -75,6 +75,8 @@ static _Geometry *_geometry = NULL;
extern Mutex *_global_mutex;
+extern void register_global_constants();
+extern void unregister_global_constants();
extern void register_variant_methods();
extern void unregister_variant_methods();
@@ -88,6 +90,7 @@ void register_core_types() {
StringName::setup();
+ register_global_constants();
register_variant_methods();
CoreStringNames::create();
@@ -157,6 +160,7 @@ void register_core_types() {
ClassDB::register_class<PackedDataContainer>();
ClassDB::register_virtual_class<PackedDataContainerRef>();
ClassDB::register_class<AStar>();
+ ClassDB::register_class<EncodedObjectAsID>();
ip = IP::create();
@@ -217,6 +221,7 @@ void unregister_core_types() {
ObjectDB::cleanup();
unregister_variant_methods();
+ unregister_global_constants();
ClassDB::cleanup();
ResourceCache::clear();
diff --git a/core/resource.h b/core/resource.h
index 5a4e45da36..bbf233d53e 100644
--- a/core/resource.h
+++ b/core/resource.h
@@ -107,7 +107,7 @@ public:
int get_subindex() const;
virtual Ref<Resource> duplicate(bool p_subresources = false) const;
- Ref<Resource> duplicate_for_local_scene(Node *p_scene, Map<Ref<Resource>, Ref<Resource> > &remap_cache);
+ Ref<Resource> duplicate_for_local_scene(Node *p_for_scene, Map<Ref<Resource>, Ref<Resource> > &remap_cache);
void set_local_to_scene(bool p_enable);
bool is_local_to_scene() const;
diff --git a/core/script_debugger_remote.cpp b/core/script_debugger_remote.cpp
index 3628f2ecaf..9e4f4380c9 100644
--- a/core/script_debugger_remote.cpp
+++ b/core/script_debugger_remote.cpp
@@ -30,10 +30,10 @@
#include "script_debugger_remote.h"
#include "io/ip.h"
+#include "io/marshalls.h"
#include "os/input.h"
#include "os/os.h"
#include "project_settings.h"
-
void ScriptDebuggerRemote::_send_video_memory() {
List<ResourceUsage> usage;
@@ -120,6 +120,18 @@ static ObjectID safe_get_instance_id(const Variant &p_v) {
}
}
+void ScriptDebuggerRemote::_put_variable(const String &p_name, const Variant &p_variable) {
+
+ packet_peer_stream->put_var(p_name);
+ int len = 0;
+ Error err = encode_variant(p_variable, NULL, len);
+ if (len > packet_peer_stream->get_output_buffer_max_size()) { //limit to max size
+ packet_peer_stream->put_var(Variant());
+ } else {
+ packet_peer_stream->put_var(p_variable);
+ }
+}
+
void ScriptDebuggerRemote::debug(ScriptLanguage *p_script, bool p_can_continue) {
//this function is called when there is a debugger break (bug on script)
@@ -130,8 +142,6 @@ void ScriptDebuggerRemote::debug(ScriptLanguage *p_script, bool p_can_continue)
ERR_FAIL();
}
- OS::get_singleton()->enable_for_stealing_focus(ProjectSettings::get_singleton()->get("editor_pid"));
-
packet_peer_stream->put_var("debug_enter");
packet_peer_stream->put_var(2);
packet_peer_stream->put_var(p_can_continue);
@@ -210,14 +220,7 @@ void ScriptDebuggerRemote::debug(ScriptLanguage *p_script, bool p_can_continue)
while (E) {
- if (F->get().get_type() == Variant::OBJECT) {
- packet_peer_stream->put_var("*" + E->get());
- String pretty_print = F->get().operator String();
- packet_peer_stream->put_var(pretty_print.ascii().get_data());
- } else {
- packet_peer_stream->put_var(E->get());
- packet_peer_stream->put_var(F->get());
- }
+ _put_variable(E->get(), F->get());
E = E->next();
F = F->next();
@@ -231,15 +234,7 @@ void ScriptDebuggerRemote::debug(ScriptLanguage *p_script, bool p_can_continue)
List<Variant>::Element *F = local_vals.front();
while (E) {
-
- if (F->get().get_type() == Variant::OBJECT) {
- packet_peer_stream->put_var("*" + E->get());
- String pretty_print = F->get().operator String();
- packet_peer_stream->put_var(pretty_print.ascii().get_data());
- } else {
- packet_peer_stream->put_var(E->get());
- packet_peer_stream->put_var(F->get());
- }
+ _put_variable(E->get(), F->get());
E = E->next();
F = F->next();
@@ -429,9 +424,9 @@ void ScriptDebuggerRemote::_err_handler(void *ud, const char *p_func, const char
sdr->mutex->unlock();
}
-bool ScriptDebuggerRemote::_parse_live_edit(const Array &cmd) {
+bool ScriptDebuggerRemote::_parse_live_edit(const Array &p_command) {
- String cmdstr = cmd[0];
+ String cmdstr = p_command[0];
if (!live_edit_funcs || !cmdstr.begins_with("live_"))
return false;
@@ -441,7 +436,7 @@ bool ScriptDebuggerRemote::_parse_live_edit(const Array &cmd) {
if (!live_edit_funcs->root_func)
return true;
//print_line("root: "+Variant(cmd).get_construct_string());
- live_edit_funcs->root_func(live_edit_funcs->udata, cmd[1], cmd[2]);
+ live_edit_funcs->root_func(live_edit_funcs->udata, p_command[1], p_command[2]);
} else if (cmdstr == "live_node_path") {
@@ -449,75 +444,75 @@ bool ScriptDebuggerRemote::_parse_live_edit(const Array &cmd) {
return true;
//print_line("path: "+Variant(cmd).get_construct_string());
- live_edit_funcs->node_path_func(live_edit_funcs->udata, cmd[1], cmd[2]);
+ live_edit_funcs->node_path_func(live_edit_funcs->udata, p_command[1], p_command[2]);
} else if (cmdstr == "live_res_path") {
if (!live_edit_funcs->res_path_func)
return true;
- live_edit_funcs->res_path_func(live_edit_funcs->udata, cmd[1], cmd[2]);
+ live_edit_funcs->res_path_func(live_edit_funcs->udata, p_command[1], p_command[2]);
} else if (cmdstr == "live_node_prop_res") {
if (!live_edit_funcs->node_set_res_func)
return true;
- live_edit_funcs->node_set_res_func(live_edit_funcs->udata, cmd[1], cmd[2], cmd[3]);
+ live_edit_funcs->node_set_res_func(live_edit_funcs->udata, p_command[1], p_command[2], p_command[3]);
} else if (cmdstr == "live_node_prop") {
if (!live_edit_funcs->node_set_func)
return true;
- live_edit_funcs->node_set_func(live_edit_funcs->udata, cmd[1], cmd[2], cmd[3]);
+ live_edit_funcs->node_set_func(live_edit_funcs->udata, p_command[1], p_command[2], p_command[3]);
} else if (cmdstr == "live_res_prop_res") {
if (!live_edit_funcs->res_set_res_func)
return true;
- live_edit_funcs->res_set_res_func(live_edit_funcs->udata, cmd[1], cmd[2], cmd[3]);
+ live_edit_funcs->res_set_res_func(live_edit_funcs->udata, p_command[1], p_command[2], p_command[3]);
} else if (cmdstr == "live_res_prop") {
if (!live_edit_funcs->res_set_func)
return true;
- live_edit_funcs->res_set_func(live_edit_funcs->udata, cmd[1], cmd[2], cmd[3]);
+ live_edit_funcs->res_set_func(live_edit_funcs->udata, p_command[1], p_command[2], p_command[3]);
} else if (cmdstr == "live_node_call") {
if (!live_edit_funcs->node_call_func)
return true;
- live_edit_funcs->node_call_func(live_edit_funcs->udata, cmd[1], cmd[2], cmd[3], cmd[4], cmd[5], cmd[6], cmd[7]);
+ live_edit_funcs->node_call_func(live_edit_funcs->udata, p_command[1], p_command[2], p_command[3], p_command[4], p_command[5], p_command[6], p_command[7]);
} else if (cmdstr == "live_res_call") {
if (!live_edit_funcs->res_call_func)
return true;
- live_edit_funcs->res_call_func(live_edit_funcs->udata, cmd[1], cmd[2], cmd[3], cmd[4], cmd[5], cmd[6], cmd[7]);
+ live_edit_funcs->res_call_func(live_edit_funcs->udata, p_command[1], p_command[2], p_command[3], p_command[4], p_command[5], p_command[6], p_command[7]);
} else if (cmdstr == "live_create_node") {
- live_edit_funcs->tree_create_node_func(live_edit_funcs->udata, cmd[1], cmd[2], cmd[3]);
+ live_edit_funcs->tree_create_node_func(live_edit_funcs->udata, p_command[1], p_command[2], p_command[3]);
} else if (cmdstr == "live_instance_node") {
- live_edit_funcs->tree_instance_node_func(live_edit_funcs->udata, cmd[1], cmd[2], cmd[3]);
+ live_edit_funcs->tree_instance_node_func(live_edit_funcs->udata, p_command[1], p_command[2], p_command[3]);
} else if (cmdstr == "live_remove_node") {
- live_edit_funcs->tree_remove_node_func(live_edit_funcs->udata, cmd[1]);
+ live_edit_funcs->tree_remove_node_func(live_edit_funcs->udata, p_command[1]);
} else if (cmdstr == "live_remove_and_keep_node") {
- live_edit_funcs->tree_remove_and_keep_node_func(live_edit_funcs->udata, cmd[1], cmd[2]);
+ live_edit_funcs->tree_remove_and_keep_node_func(live_edit_funcs->udata, p_command[1], p_command[2]);
} else if (cmdstr == "live_restore_node") {
- live_edit_funcs->tree_restore_node_func(live_edit_funcs->udata, cmd[1], cmd[2], cmd[3]);
+ live_edit_funcs->tree_restore_node_func(live_edit_funcs->udata, p_command[1], p_command[2], p_command[3]);
} else if (cmdstr == "live_duplicate_node") {
- live_edit_funcs->tree_duplicate_node_func(live_edit_funcs->udata, cmd[1], cmd[2]);
+ live_edit_funcs->tree_duplicate_node_func(live_edit_funcs->udata, p_command[1], p_command[2]);
} else if (cmdstr == "live_reparent_node") {
- live_edit_funcs->tree_reparent_node_func(live_edit_funcs->udata, cmd[1], cmd[2], cmd[3], cmd[4]);
+ live_edit_funcs->tree_reparent_node_func(live_edit_funcs->udata, p_command[1], p_command[2], p_command[3], p_command[4]);
} else {
@@ -566,30 +561,19 @@ void ScriptDebuggerRemote::_send_object_id(ObjectID p_id) {
}
Variant var = obj->get(E->get().name);
+ packet_peer_stream->put_var(E->get().type);
+ //only send information that can be sent..
- if (E->get().type == Variant::OBJECT || var.get_type() == Variant::OBJECT) {
-
- ObjectID id2;
- Object *obj = var;
- if (obj) {
- id2 = obj->get_instance_id();
- } else {
- id2 = 0;
- }
+ int len = 0; //test how big is this to encode
+ encode_variant(var, NULL, len);
- packet_peer_stream->put_var(Variant::INT); //hint string
- packet_peer_stream->put_var(PROPERTY_HINT_OBJECT_ID); //hint
- packet_peer_stream->put_var(E->get().hint_string); //hint string
- packet_peer_stream->put_var(id2); //value
+ if (len > packet_peer_stream->get_output_buffer_max_size()) { //limit to max size
+ packet_peer_stream->put_var(PROPERTY_HINT_OBJECT_TOO_BIG);
+ packet_peer_stream->put_var("");
+ packet_peer_stream->put_var(Variant());
} else {
- packet_peer_stream->put_var(E->get().type);
packet_peer_stream->put_var(E->get().hint);
packet_peer_stream->put_var(E->get().hint_string);
- //only send information that can be sent..
-
- if (var.get_type() >= Variant::DICTIONARY) {
- var = Array(); //send none for now, may be to big
- }
packet_peer_stream->put_var(var);
}
}
diff --git a/core/script_debugger_remote.h b/core/script_debugger_remote.h
index 924e3774a2..cf75c0eb4a 100644
--- a/core/script_debugger_remote.h
+++ b/core/script_debugger_remote.h
@@ -126,6 +126,8 @@ class ScriptDebuggerRemote : public ScriptDebugger {
Vector<FrameData> profile_frame_data;
+ void _put_variable(const String &p_name, const Variant &p_variable);
+
public:
struct ResourceUsage {
diff --git a/core/simple_type.h b/core/simple_type.h
index 6003bd393f..b4a6dd1fa8 100644
--- a/core/simple_type.h
+++ b/core/simple_type.h
@@ -33,95 +33,21 @@
/* Batch of specializations to obtain the actual simple type */
template <class T>
-struct GetSimpleType {
-
- T type;
-};
-
-template <class T>
struct GetSimpleTypeT {
typedef T type_t;
};
template <class T>
-struct GetSimpleType<T &> {
-
- T type;
-};
-
-template <class T>
struct GetSimpleTypeT<T &> {
typedef T type_t;
};
template <class T>
-struct GetSimpleType<T const> {
-
- T type;
- _FORCE_INLINE_ GetSimpleType() {}
-};
-
-template <class T>
struct GetSimpleTypeT<T const> {
typedef T type_t;
};
-template <class T>
-struct GetSimpleType<const T &> {
-
- T type;
- _FORCE_INLINE_ GetSimpleType() {}
-};
-
-template <class T>
-struct GetSimpleType<T *> {
-
- T *type;
- _FORCE_INLINE_ GetSimpleType() { type = NULL; }
-};
-
-template <class T>
-struct GetSimpleType<const T *> {
-
- T *type;
- _FORCE_INLINE_ GetSimpleType() { type = NULL; }
-};
-
-#define SIMPLE_NUMERIC_TYPE(m_type) \
- template <> \
- struct GetSimpleType<m_type> { \
- m_type type; \
- _FORCE_INLINE_ GetSimpleType() { type = (m_type)0; } \
- }; \
- template <> \
- struct GetSimpleType<m_type const> { \
- m_type type; \
- _FORCE_INLINE_ GetSimpleType() { type = (m_type)0; } \
- }; \
- template <> \
- struct GetSimpleType<m_type &> { \
- m_type type; \
- _FORCE_INLINE_ GetSimpleType() { type = (m_type)0; } \
- }; \
- template <> \
- struct GetSimpleType<const m_type &> { \
- m_type type; \
- _FORCE_INLINE_ GetSimpleType() { type = (m_type)0; } \
- };
-
-SIMPLE_NUMERIC_TYPE(bool);
-SIMPLE_NUMERIC_TYPE(uint8_t);
-SIMPLE_NUMERIC_TYPE(int8_t);
-SIMPLE_NUMERIC_TYPE(uint16_t);
-SIMPLE_NUMERIC_TYPE(int16_t);
-SIMPLE_NUMERIC_TYPE(uint32_t);
-SIMPLE_NUMERIC_TYPE(int32_t);
-SIMPLE_NUMERIC_TYPE(int64_t);
-SIMPLE_NUMERIC_TYPE(uint64_t);
-SIMPLE_NUMERIC_TYPE(float);
-SIMPLE_NUMERIC_TYPE(double);
-
#endif
diff --git a/core/type_info.h b/core/type_info.h
index 10912fd074..0603126996 100644
--- a/core/type_info.h
+++ b/core/type_info.h
@@ -1,6 +1,8 @@
#ifndef GET_TYPE_INFO_H
#define GET_TYPE_INFO_H
+#ifdef DEBUG_METHODS_ENABLED
+
template <bool C, typename T = void>
struct EnableIf {
@@ -40,8 +42,8 @@ struct GetTypeInfo {
enum { VARIANT_TYPE = Variant::NIL };
static inline StringName get_class_name() {
- ERR_PRINT("Fallback type info. Bug!");
- return ""; // Not "Nil", this is an error
+ ERR_PRINT("GetTypeInfo fallback. Bug!");
+ return StringName(); // Not "Nil", this is an error
}
};
@@ -70,6 +72,7 @@ MAKE_TYPE_INFO(uint32_t, Variant::INT)
MAKE_TYPE_INFO(int32_t, Variant::INT)
MAKE_TYPE_INFO(int64_t, Variant::INT)
MAKE_TYPE_INFO(uint64_t, Variant::INT)
+MAKE_TYPE_INFO(wchar_t, Variant::INT)
MAKE_TYPE_INFO(float, Variant::REAL)
MAKE_TYPE_INFO(double, Variant::REAL)
@@ -152,36 +155,6 @@ MAKE_TEMPLATE_TYPE_INFO(Vector, Plane, Variant::ARRAY)
MAKE_TEMPLATE_TYPE_INFO(PoolVector, Plane, Variant::ARRAY)
MAKE_TEMPLATE_TYPE_INFO(PoolVector, Face3, Variant::POOL_VECTOR3_ARRAY)
-#define MAKE_ENUM_TYPE_INFO(m_enum) \
- template <> \
- struct GetTypeInfo<m_enum> { \
- enum { VARIANT_TYPE = Variant::INT }; \
- static inline StringName get_class_name() { \
- return Variant::get_type_name((Variant::Type)VARIANT_TYPE); \
- } \
- }; \
- template <> \
- struct GetTypeInfo<m_enum const> { \
- enum { VARIANT_TYPE = Variant::INT }; \
- static inline StringName get_class_name() { \
- return Variant::get_type_name((Variant::Type)VARIANT_TYPE); \
- } \
- }; \
- template <> \
- struct GetTypeInfo<m_enum &> { \
- enum { VARIANT_TYPE = Variant::INT }; \
- static inline StringName get_class_name() { \
- return Variant::get_type_name((Variant::Type)VARIANT_TYPE); \
- } \
- }; \
- template <> \
- struct GetTypeInfo<const m_enum &> { \
- enum { VARIANT_TYPE = Variant::INT }; \
- static inline StringName get_class_name() { \
- return Variant::get_type_name((Variant::Type)VARIANT_TYPE); \
- } \
- };
-
template <typename T>
struct GetTypeInfo<T *, typename EnableIf<TypeInherits<Object, T>::value>::type> {
enum { VARIANT_TYPE = Variant::OBJECT };
@@ -200,4 +173,30 @@ struct GetTypeInfo<const T *, typename EnableIf<TypeInherits<Object, T>::value>:
}
};
+#define TEMPL_MAKE_ENUM_TYPE_INFO(m_enum, m_impl) \
+ template <> \
+ struct GetTypeInfo<m_impl> { \
+ enum { VARIANT_TYPE = Variant::INT }; \
+ static inline StringName get_class_name() { return "enum." #m_enum; } \
+ };
+
+#define MAKE_ENUM_TYPE_INFO(m_enum) \
+ TEMPL_MAKE_ENUM_TYPE_INFO(m_enum, m_enum) \
+ TEMPL_MAKE_ENUM_TYPE_INFO(m_enum, m_enum const) \
+ TEMPL_MAKE_ENUM_TYPE_INFO(m_enum, m_enum &) \
+ TEMPL_MAKE_ENUM_TYPE_INFO(m_enum, const m_enum &)
+
+template <typename T>
+inline StringName __constant_get_enum_name(T param, const String &p_constant) {
+ if (GetTypeInfo<T>::VARIANT_TYPE == Variant::NIL)
+ ERR_PRINTS("Missing VARIANT_ENUM_CAST for constant's enum: " + p_constant);
+ return GetTypeInfo<T>::get_class_name();
+}
+
+#else
+
+#define MAKE_ENUM_TYPE_INFO(m_enum)
+
+#endif // DEBUG_METHODS_ENABLED
+
#endif // GET_TYPE_INFO_H
diff --git a/core/typedefs.h b/core/typedefs.h
index 40d9ea37b5..34a1a93a3b 100644
--- a/core/typedefs.h
+++ b/core/typedefs.h
@@ -162,9 +162,9 @@ inline void __swap_tmpl(T &x, T &y) {
#define _add_overflow __builtin_add_overflow
#endif
-/** Function to find the nearest (bigger) power of 2 to an integer */
+/** Function to find the next power of 2 to an integer */
-static _FORCE_INLINE_ unsigned int nearest_power_of_2(unsigned int x) {
+static _FORCE_INLINE_ unsigned int next_power_of_2(unsigned int x) {
--x;
x |= x >> 1;
@@ -176,6 +176,23 @@ static _FORCE_INLINE_ unsigned int nearest_power_of_2(unsigned int x) {
return ++x;
}
+static _FORCE_INLINE_ unsigned int previous_power_of_2(unsigned int x) {
+
+ x |= x >> 1;
+ x |= x >> 2;
+ x |= x >> 4;
+ x |= x >> 8;
+ x |= x >> 16;
+ return x - (x >> 1);
+}
+
+static _FORCE_INLINE_ unsigned int closest_power_of_2(unsigned int x) {
+
+ unsigned int nx = next_power_of_2(x);
+ unsigned int px = previous_power_of_2(x);
+ return (nx - x) > (x - px) ? px : nx;
+}
+
// We need this definition inside the function below.
static inline int get_shift_from_power_of_2(unsigned int p_pixel);
diff --git a/core/undo_redo.cpp b/core/undo_redo.cpp
index 19b9f161b7..bb70146396 100644
--- a/core/undo_redo.cpp
+++ b/core/undo_redo.cpp
@@ -504,7 +504,7 @@ void UndoRedo::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_current_action_name"), &UndoRedo::get_current_action_name);
ClassDB::bind_method(D_METHOD("get_version"), &UndoRedo::get_version);
- BIND_CONSTANT(MERGE_DISABLE);
- BIND_CONSTANT(MERGE_ENDS);
- BIND_CONSTANT(MERGE_ALL);
+ BIND_ENUM_CONSTANT(MERGE_DISABLE);
+ BIND_ENUM_CONSTANT(MERGE_ENDS);
+ BIND_ENUM_CONSTANT(MERGE_ALL);
}
diff --git a/core/ustring.cpp b/core/ustring.cpp
index ab4528e495..0521966943 100644
--- a/core/ustring.cpp
+++ b/core/ustring.cpp
@@ -279,16 +279,16 @@ void String::operator=(const CharType *p_str) {
copy_from(p_str);
}
-bool String::operator==(const StrRange &p_range) const {
+bool String::operator==(const StrRange &p_str_range) const {
- int len = p_range.len;
+ int len = p_str_range.len;
if (length() != len)
return false;
if (empty())
return true;
- const CharType *c_str = p_range.c_str;
+ const CharType *c_str = p_str_range.c_str;
const CharType *dst = &operator[](0);
/* Compare char by char */
diff --git a/core/ustring.h b/core/ustring.h
index d00bfa59b5..1c61e12e85 100644
--- a/core/ustring.h
+++ b/core/ustring.h
@@ -78,7 +78,7 @@ public:
//String operator+(CharType p_char) const;
String &operator+=(const String &);
- String &operator+=(CharType p_str);
+ String &operator+=(CharType p_char);
String &operator+=(const char *p_str);
String &operator+=(const CharType *p_str);
@@ -156,7 +156,7 @@ public:
int get_slice_count(String p_splitter) const;
String get_slice(String p_splitter, int p_slice) const;
- String get_slicec(CharType splitter, int p_slice) const;
+ String get_slicec(CharType p_splitter, int p_slice) const;
Vector<String> split(const String &p_splitter, bool p_allow_empty = true) const;
Vector<String> split_spaces() const;
@@ -186,8 +186,8 @@ public:
bool parse_utf8(const char *p_utf8, int p_len = -1); //return true on error
static String utf8(const char *p_utf8, int p_len = -1);
- static uint32_t hash(const CharType *p_str, int p_len); /* hash the string */
- static uint32_t hash(const CharType *p_str); /* hash the string */
+ static uint32_t hash(const CharType *p_cstr, int p_len); /* hash the string */
+ static uint32_t hash(const CharType *p_cstr); /* hash the string */
static uint32_t hash(const char *p_cstr, int p_len); /* hash the string */
static uint32_t hash(const char *p_cstr); /* hash the string */
uint32_t hash() const; /* hash the string */
diff --git a/core/variant_call.cpp b/core/variant_call.cpp
index aabc2546bc..59d31d2586 100644
--- a/core/variant_call.cpp
+++ b/core/variant_call.cpp
@@ -747,6 +747,7 @@ struct _VariantCall {
VCALL_PTR1R(Transform, translated);
VCALL_PTR0R(Transform, orthonormalized);
VCALL_PTR2R(Transform, looking_at);
+ VCALL_PTR2R(Transform, interpolate_with);
static void _call_Transform_xform(Variant &r_ret, Variant &p_self, const Variant **p_args) {
@@ -1691,7 +1692,7 @@ void register_variant_methods() {
ADDFUNC1(TRANSFORM2D, TRANSFORM2D, Transform2D, xform_inv, NIL, "v", varray());
ADDFUNC1(TRANSFORM2D, TRANSFORM2D, Transform2D, basis_xform, NIL, "v", varray());
ADDFUNC1(TRANSFORM2D, TRANSFORM2D, Transform2D, basis_xform_inv, NIL, "v", varray());
- ADDFUNC2(TRANSFORM2D, TRANSFORM2D, Transform2D, interpolate_with, TRANSFORM2D, "m", REAL, "c", varray());
+ ADDFUNC2(TRANSFORM2D, TRANSFORM2D, Transform2D, interpolate_with, TRANSFORM2D, "transform", REAL, "weight", varray());
ADDFUNC0(BASIS, BASIS, Basis, inverse, varray());
ADDFUNC0(BASIS, BASIS, Basis, transposed, varray());
@@ -1718,6 +1719,7 @@ void register_variant_methods() {
ADDFUNC1(TRANSFORM, TRANSFORM, Transform, scaled, VECTOR3, "scale", varray());
ADDFUNC1(TRANSFORM, TRANSFORM, Transform, translated, VECTOR3, "ofs", varray());
ADDFUNC2(TRANSFORM, TRANSFORM, Transform, looking_at, VECTOR3, "target", VECTOR3, "up", varray());
+ ADDFUNC2(TRANSFORM, TRANSFORM, Transform, interpolate_with, TRANSFORM, "transform", REAL, "weight", varray());
ADDFUNC1(TRANSFORM, NIL, Transform, xform, NIL, "v", varray());
ADDFUNC1(TRANSFORM, NIL, Transform, xform_inv, NIL, "v", varray());
diff --git a/core/variant_construct_string.cpp b/core/variant_construct_string.cpp
index 45fe367ce6..fa8a393d08 100644
--- a/core/variant_construct_string.cpp
+++ b/core/variant_construct_string.cpp
@@ -66,7 +66,7 @@ class VariantConstruct {
static Error _get_token(const CharType *p_str, int &index, int p_len, Token &r_token, int &line, String &r_err_str);
static Error _parse_value(Variant &value, Token &token, const CharType *p_str, int &index, int p_len, int &line, String &r_err_str, Variant::ObjectConstruct *p_construct, void *p_ud);
static Error _parse_array(Array &array, const CharType *p_str, int &index, int p_len, int &line, String &r_err_str, Variant::ObjectConstruct *p_construct, void *p_ud);
- static Error _parse_dict(Dictionary &object, const CharType *p_str, int &index, int p_len, int &line, String &r_err_str, Variant::ObjectConstruct *p_construct, void *p_ud);
+ static Error _parse_dict(Dictionary &dict, const CharType *p_str, int &index, int p_len, int &line, String &r_err_str, Variant::ObjectConstruct *p_construct, void *p_ud);
public:
static Error parse(const String &p_string, Variant &r_ret, String &r_err_str, int &r_err_line, Variant::ObjectConstruct *p_construct, void *p_ud);
@@ -85,15 +85,15 @@ const char *VariantConstruct::tk_name[TK_MAX] = {
"EOF",
};
-Error VariantConstruct::_get_token(const CharType *p_str, int &idx, int p_len, Token &r_token, int &line, String &r_err_str) {
+Error VariantConstruct::_get_token(const CharType *p_str, int &index, int p_len, Token &r_token, int &line, String &r_err_str) {
while (true) {
- switch (p_str[idx]) {
+ switch (p_str[index]) {
case '\n': {
line++;
- idx++;
+ index++;
break;
};
case 0: {
@@ -103,54 +103,54 @@ Error VariantConstruct::_get_token(const CharType *p_str, int &idx, int p_len, T
case '{': {
r_token.type = TK_CURLY_BRACKET_OPEN;
- idx++;
+ index++;
return OK;
};
case '}': {
r_token.type = TK_CURLY_BRACKET_CLOSE;
- idx++;
+ index++;
return OK;
};
case '[': {
r_token.type = TK_BRACKET_OPEN;
- idx++;
+ index++;
return OK;
};
case ']': {
r_token.type = TK_BRACKET_CLOSE;
- idx++;
+ index++;
return OK;
};
case ':': {
r_token.type = TK_COLON;
- idx++;
+ index++;
return OK;
};
case ',': {
r_token.type = TK_COMMA;
- idx++;
+ index++;
return OK;
};
case '"': {
- idx++;
+ index++;
String str;
while (true) {
- if (p_str[idx] == 0) {
+ if (p_str[index] == 0) {
r_err_str = "Unterminated String";
return ERR_PARSE_ERROR;
- } else if (p_str[idx] == '"') {
- idx++;
+ } else if (p_str[index] == '"') {
+ index++;
break;
- } else if (p_str[idx] == '\\') {
+ } else if (p_str[index] == '\\') {
//escaped characters...
- idx++;
- CharType next = p_str[idx];
+ index++;
+ CharType next = p_str[index];
if (next == 0) {
r_err_str = "Unterminated String";
return ERR_PARSE_ERROR;
@@ -171,7 +171,7 @@ Error VariantConstruct::_get_token(const CharType *p_str, int &idx, int p_len, T
//hexnumbarh - oct is deprecated
for (int j = 0; j < 4; j++) {
- CharType c = p_str[idx + j + 1];
+ CharType c = p_str[index + j + 1];
if (c == 0) {
r_err_str = "Unterminated String";
return ERR_PARSE_ERROR;
@@ -198,7 +198,7 @@ Error VariantConstruct::_get_token(const CharType *p_str, int &idx, int p_len, T
res <<= 4;
res |= v;
}
- idx += 4; //will add at the end anyway
+ index += 4; //will add at the end anyway
} break;
default: {
@@ -211,11 +211,11 @@ Error VariantConstruct::_get_token(const CharType *p_str, int &idx, int p_len, T
str += res;
} else {
- if (p_str[idx] == '\n')
+ if (p_str[index] == '\n')
line++;
- str += p_str[idx];
+ str += p_str[index];
}
- idx++;
+ index++;
}
r_token.type = TK_STRING;
@@ -225,28 +225,28 @@ Error VariantConstruct::_get_token(const CharType *p_str, int &idx, int p_len, T
} break;
default: {
- if (p_str[idx] <= 32) {
- idx++;
+ if (p_str[index] <= 32) {
+ index++;
break;
}
- if (p_str[idx] == '-' || (p_str[idx] >= '0' && p_str[idx] <= '9')) {
+ if (p_str[index] == '-' || (p_str[index] >= '0' && p_str[index] <= '9')) {
//a number
const CharType *rptr;
- double number = String::to_double(&p_str[idx], &rptr);
- idx += (rptr - &p_str[idx]);
+ double number = String::to_double(&p_str[index], &rptr);
+ index += (rptr - &p_str[index]);
r_token.type = TK_NUMBER;
r_token.value = number;
return OK;
- } else if ((p_str[idx] >= 'A' && p_str[idx] <= 'Z') || (p_str[idx] >= 'a' && p_str[idx] <= 'z')) {
+ } else if ((p_str[index] >= 'A' && p_str[index] <= 'Z') || (p_str[index] >= 'a' && p_str[index] <= 'z')) {
String id;
- while ((p_str[idx] >= 'A' && p_str[idx] <= 'Z') || (p_str[idx] >= 'a' && p_str[idx] <= 'z')) {
+ while ((p_str[index] >= 'A' && p_str[index] <= 'Z') || (p_str[index] >= 'a' && p_str[index] <= 'z')) {
- id += p_str[idx];
- idx++;
+ id += p_str[index];
+ index++;
}
r_token.type = TK_IDENTIFIER;
diff --git a/core/vector.h b/core/vector.h
index 5eed8dce96..966832ac50 100644
--- a/core/vector.h
+++ b/core/vector.h
@@ -71,7 +71,7 @@ class Vector {
_FORCE_INLINE_ size_t _get_alloc_size(size_t p_elements) const {
//return nearest_power_of_2_templated(p_elements*sizeof(T)+sizeof(SafeRefCount)+sizeof(int));
- return nearest_power_of_2(p_elements * sizeof(T));
+ return next_power_of_2(p_elements * sizeof(T));
}
_FORCE_INLINE_ bool _get_alloc_size_checked(size_t p_elements, size_t *out) const {
@@ -79,7 +79,7 @@ class Vector {
size_t o;
size_t p;
if (_mul_overflow(p_elements, sizeof(T), &o)) return false;
- *out = nearest_power_of_2(o);
+ *out = next_power_of_2(o);
if (_add_overflow(o, static_cast<size_t>(32), &p)) return false; //no longer allocated here
return true;
#else
@@ -117,7 +117,7 @@ public:
}
_FORCE_INLINE_ bool empty() const { return _ptr == 0; }
Error resize(int p_size);
- bool push_back(T p_elem);
+ bool push_back(const T &p_elem);
void remove(int p_index);
void erase(const T &p_val) {
@@ -129,7 +129,7 @@ public:
template <class T_val>
int find(const T_val &p_val, int p_from = 0) const;
- void set(int p_index, T p_elem);
+ void set(int p_index, const T &p_elem);
T get(int p_index) const;
inline T &operator[](int p_index) {
@@ -336,7 +336,7 @@ void Vector<T>::invert() {
}
template <class T>
-void Vector<T>::set(int p_index, T p_elem) {
+void Vector<T>::set(int p_index, const T &p_elem) {
operator[](p_index) = p_elem;
}
@@ -348,7 +348,7 @@ T Vector<T>::get(int p_index) const {
}
template <class T>
-bool Vector<T>::push_back(T p_elem) {
+bool Vector<T>::push_back(const T &p_elem) {
Error err = resize(size() + 1);
ERR_FAIL_COND_V(err, true)