summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/core_constants.cpp2
-rw-r--r--core/doc_data.h8
-rw-r--r--core/input/input_event.cpp90
-rw-r--r--core/input/input_event.h25
-rw-r--r--core/input/input_map.cpp62
-rw-r--r--core/io/http_client.cpp4
-rw-r--r--core/io/http_client.h4
-rw-r--r--core/io/http_client_tcp.cpp56
-rw-r--r--core/io/http_client_tcp.h6
-rw-r--r--core/io/image_loader.h1
-rw-r--r--core/io/resource.cpp15
-rw-r--r--core/io/resource_importer.cpp9
-rw-r--r--core/io/xml_parser.cpp2
-rw-r--r--core/math/a_star_grid_2d.cpp12
-rw-r--r--core/os/keyboard.cpp16
-rw-r--r--core/os/keyboard.h17
-rw-r--r--core/os/os.h10
-rw-r--r--core/os/time.cpp55
-rw-r--r--core/register_core_types.cpp4
19 files changed, 210 insertions, 188 deletions
diff --git a/core/core_constants.cpp b/core/core_constants.cpp
index c4d83d4765..2f8b28363b 100644
--- a/core/core_constants.cpp
+++ b/core/core_constants.cpp
@@ -433,11 +433,11 @@ void register_global_constants() {
BIND_CORE_ENUM_CLASS_CONSTANT_CUSTOM(KeyModifierMask, KEY_CODE_MASK, CODE_MASK);
BIND_CORE_ENUM_CLASS_CONSTANT_CUSTOM(KeyModifierMask, KEY_MODIFIER_MASK, MODIFIER_MASK);
+ BIND_CORE_ENUM_CLASS_CONSTANT(KeyModifierMask, KEY_MASK, CMD_OR_CTRL);
BIND_CORE_ENUM_CLASS_CONSTANT(KeyModifierMask, KEY_MASK, SHIFT);
BIND_CORE_ENUM_CLASS_CONSTANT(KeyModifierMask, KEY_MASK, ALT);
BIND_CORE_ENUM_CLASS_CONSTANT(KeyModifierMask, KEY_MASK, META);
BIND_CORE_ENUM_CLASS_CONSTANT(KeyModifierMask, KEY_MASK, CTRL);
- BIND_CORE_ENUM_CLASS_CONSTANT_NO_VAL(KeyModifierMask, KEY_MASK, CMD);
BIND_CORE_ENUM_CLASS_CONSTANT(KeyModifierMask, KEY_MASK, KPAD);
BIND_CORE_ENUM_CLASS_CONSTANT(KeyModifierMask, KEY_MASK, GROUP_SWITCH);
diff --git a/core/doc_data.h b/core/doc_data.h
index 1d8d2483e0..3b7bf149b4 100644
--- a/core/doc_data.h
+++ b/core/doc_data.h
@@ -66,6 +66,8 @@ public:
String return_enum;
String qualifiers;
String description;
+ bool is_deprecated = false;
+ bool is_experimental = false;
Vector<ArgumentDoc> arguments;
Vector<int> errors_returned;
bool operator<(const MethodDoc &p_method) const {
@@ -105,6 +107,8 @@ public:
String enumeration;
bool is_bitfield = false;
String description;
+ bool is_deprecated = false;
+ bool is_experimental = false;
bool operator<(const ConstantDoc &p_const) const {
return name < p_const.name;
}
@@ -126,6 +130,8 @@ public:
String default_value;
bool overridden = false;
String overrides;
+ bool is_deprecated = false;
+ bool is_experimental = false;
bool operator<(const PropertyDoc &p_prop) const {
return name < p_prop.name;
}
@@ -167,6 +173,8 @@ public:
Vector<PropertyDoc> properties;
Vector<MethodDoc> annotations;
Vector<ThemeItemDoc> theme_properties;
+ bool is_deprecated = false;
+ bool is_experimental = false;
bool is_script_doc = false;
String script_path;
bool operator<(const ClassDoc &p_class) const {
diff --git a/core/input/input_event.cpp b/core/input/input_event.cpp
index 3f02d80c26..596b704732 100644
--- a/core/input/input_event.cpp
+++ b/core/input/input_event.cpp
@@ -142,13 +142,33 @@ int64_t InputEventFromWindow::get_window_id() const {
///////////////////////////////////
-void InputEventWithModifiers::set_store_command(bool p_enabled) {
- store_command = p_enabled;
+void InputEventWithModifiers::set_command_or_control_autoremap(bool p_enabled) {
+ command_or_control_autoremap = p_enabled;
+ if (command_or_control_autoremap) {
+#ifdef MACOS_ENABLED
+ ctrl_pressed = false;
+ meta_pressed = true;
+#else
+ ctrl_pressed = true;
+ meta_pressed = false;
+#endif
+ } else {
+ ctrl_pressed = false;
+ meta_pressed = false;
+ }
emit_changed();
}
-bool InputEventWithModifiers::is_storing_command() const {
- return store_command;
+bool InputEventWithModifiers::is_command_or_control_autoremap() const {
+ return command_or_control_autoremap;
+}
+
+bool InputEventWithModifiers::is_command_or_control_pressed() const {
+#ifdef MACOS_ENABLED
+ return meta_pressed;
+#else
+ return ctrl_pressed;
+#endif
}
void InputEventWithModifiers::set_shift_pressed(bool p_enabled) {
@@ -170,6 +190,7 @@ bool InputEventWithModifiers::is_alt_pressed() const {
}
void InputEventWithModifiers::set_ctrl_pressed(bool p_enabled) {
+ ERR_FAIL_COND_MSG(command_or_control_autoremap, "Command/Control autoremaping is enabled, cannot set Control directly!");
ctrl_pressed = p_enabled;
emit_changed();
}
@@ -179,6 +200,7 @@ bool InputEventWithModifiers::is_ctrl_pressed() const {
}
void InputEventWithModifiers::set_meta_pressed(bool p_enabled) {
+ ERR_FAIL_COND_MSG(command_or_control_autoremap, "Command/Control autoremaping is enabled, cannot set Meta directly!");
meta_pressed = p_enabled;
emit_changed();
}
@@ -187,15 +209,6 @@ bool InputEventWithModifiers::is_meta_pressed() const {
return meta_pressed;
}
-void InputEventWithModifiers::set_command_pressed(bool p_enabled) {
- command_pressed = p_enabled;
- emit_changed();
-}
-
-bool InputEventWithModifiers::is_command_pressed() const {
- return command_pressed;
-}
-
void InputEventWithModifiers::set_modifiers_from_event(const InputEventWithModifiers *event) {
set_alt_pressed(event->is_alt_pressed());
set_shift_pressed(event->is_shift_pressed());
@@ -217,6 +230,13 @@ Key InputEventWithModifiers::get_modifiers_mask() const {
if (is_meta_pressed()) {
mask |= KeyModifierMask::META;
}
+ if (is_command_or_control_autoremap()) {
+#ifdef MACOS_ENABLED
+ mask |= KeyModifierMask::META;
+#else
+ mask |= KeyModifierMask::CTRL;
+#endif
+ }
return mask;
}
@@ -248,8 +268,10 @@ String InputEventWithModifiers::to_string() {
}
void InputEventWithModifiers::_bind_methods() {
- ClassDB::bind_method(D_METHOD("set_store_command", "enable"), &InputEventWithModifiers::set_store_command);
- ClassDB::bind_method(D_METHOD("is_storing_command"), &InputEventWithModifiers::is_storing_command);
+ ClassDB::bind_method(D_METHOD("set_command_or_control_autoremap", "enable"), &InputEventWithModifiers::set_command_or_control_autoremap);
+ ClassDB::bind_method(D_METHOD("is_command_or_control_autoremap"), &InputEventWithModifiers::is_command_or_control_autoremap);
+
+ ClassDB::bind_method(D_METHOD("is_command_or_control_pressed"), &InputEventWithModifiers::is_command_or_control_pressed);
ClassDB::bind_method(D_METHOD("set_alt_pressed", "pressed"), &InputEventWithModifiers::set_alt_pressed);
ClassDB::bind_method(D_METHOD("is_alt_pressed"), &InputEventWithModifiers::is_alt_pressed);
@@ -263,34 +285,24 @@ void InputEventWithModifiers::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_meta_pressed", "pressed"), &InputEventWithModifiers::set_meta_pressed);
ClassDB::bind_method(D_METHOD("is_meta_pressed"), &InputEventWithModifiers::is_meta_pressed);
- ClassDB::bind_method(D_METHOD("set_command_pressed", "pressed"), &InputEventWithModifiers::set_command_pressed);
- ClassDB::bind_method(D_METHOD("is_command_pressed"), &InputEventWithModifiers::is_command_pressed);
-
- ADD_PROPERTY(PropertyInfo(Variant::BOOL, "store_command"), "set_store_command", "is_storing_command");
+ ADD_PROPERTY(PropertyInfo(Variant::BOOL, "command_or_control_autoremap"), "set_command_or_control_autoremap", "is_command_or_control_autoremap");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "alt_pressed"), "set_alt_pressed", "is_alt_pressed");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "shift_pressed"), "set_shift_pressed", "is_shift_pressed");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "ctrl_pressed"), "set_ctrl_pressed", "is_ctrl_pressed");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "meta_pressed"), "set_meta_pressed", "is_meta_pressed");
- ADD_PROPERTY(PropertyInfo(Variant::BOOL, "command_pressed"), "set_command_pressed", "is_command_pressed");
}
void InputEventWithModifiers::_validate_property(PropertyInfo &p_property) const {
- if (store_command) {
- // If we only want to Store "Command".
-#ifdef APPLE_STYLE_KEYS
- // Don't store "Meta" on Mac.
+ if (command_or_control_autoremap) {
+ // Cannot be used with Meta/Command or Control!
if (p_property.name == "meta_pressed") {
p_property.usage ^= PROPERTY_USAGE_STORAGE;
}
-#else
- // Don't store "Ctrl".
if (p_property.name == "ctrl_pressed") {
p_property.usage ^= PROPERTY_USAGE_STORAGE;
}
-#endif
} else {
- // We don't want to store command, only ctrl or meta (on mac).
- if (p_property.name == "command_pressed") {
+ if (p_property.name == "command_or_control_autoremap") {
p_property.usage ^= PROPERTY_USAGE_STORAGE;
}
}
@@ -399,14 +411,18 @@ Ref<InputEventKey> InputEventKey::create_reference(Key p_keycode) {
if ((p_keycode & KeyModifierMask::ALT) != Key::NONE) {
ie->set_alt_pressed(true);
}
- if ((p_keycode & KeyModifierMask::CTRL) != Key::NONE) {
- ie->set_ctrl_pressed(true);
- }
- if ((p_keycode & KeyModifierMask::CMD) != Key::NONE) {
- ie->set_command_pressed(true);
- }
- if ((p_keycode & KeyModifierMask::META) != Key::NONE) {
- ie->set_meta_pressed(true);
+ if ((p_keycode & KeyModifierMask::CMD_OR_CTRL) != Key::NONE) {
+ ie->set_command_or_control_autoremap(true);
+ if ((p_keycode & KeyModifierMask::CTRL) != Key::NONE || (p_keycode & KeyModifierMask::META) != Key::NONE) {
+ WARN_PRINT("Invalid Key Modifiers: Command or Control autoremapping is enabled, Meta and Control values are ignored!");
+ }
+ } else {
+ if ((p_keycode & KeyModifierMask::CTRL) != Key::NONE) {
+ ie->set_ctrl_pressed(true);
+ }
+ if ((p_keycode & KeyModifierMask::META) != Key::NONE) {
+ ie->set_meta_pressed(true);
+ }
}
return ie;
diff --git a/core/input/input_event.h b/core/input/input_event.h
index 6cfc031c8a..bc3ec3e7ac 100644
--- a/core/input/input_event.h
+++ b/core/input/input_event.h
@@ -107,32 +107,22 @@ public:
class InputEventWithModifiers : public InputEventFromWindow {
GDCLASS(InputEventWithModifiers, InputEventFromWindow);
- bool store_command = true;
+ bool command_or_control_autoremap = false;
bool shift_pressed = false;
bool alt_pressed = false;
-#ifdef APPLE_STYLE_KEYS
- union {
- bool command_pressed;
- bool meta_pressed = false; //< windows/mac key
- };
-
+ bool meta_pressed = false; // "Command" on macOS, "Meta/Win" key on other platforms.
bool ctrl_pressed = false;
-#else
- union {
- bool command_pressed; //< windows/mac key
- bool ctrl_pressed = false;
- };
- bool meta_pressed = false; //< windows/mac key
-#endif
protected:
static void _bind_methods();
void _validate_property(PropertyInfo &p_property) const;
public:
- void set_store_command(bool p_enabled);
- bool is_storing_command() const;
+ void set_command_or_control_autoremap(bool p_enabled);
+ bool is_command_or_control_autoremap() const;
+
+ bool is_command_or_control_pressed() const;
void set_shift_pressed(bool p_pressed);
bool is_shift_pressed() const;
@@ -146,9 +136,6 @@ public:
void set_meta_pressed(bool p_pressed);
bool is_meta_pressed() const;
- void set_command_pressed(bool p_pressed);
- bool is_command_pressed() const;
-
void set_modifiers_from_event(const InputEventWithModifiers *event);
Key get_modifiers_mask() const;
diff --git a/core/input/input_map.cpp b/core/input/input_map.cpp
index 702e257fb4..ce76d11b6e 100644
--- a/core/input/input_map.cpp
+++ b/core/input/input_map.cpp
@@ -429,27 +429,27 @@ const HashMap<String, List<Ref<InputEvent>>> &InputMap::get_builtins() {
// ///// UI basic Shortcuts /////
inputs = List<Ref<InputEvent>>();
- inputs.push_back(InputEventKey::create_reference(Key::X | KeyModifierMask::CMD));
+ inputs.push_back(InputEventKey::create_reference(Key::X | KeyModifierMask::CMD_OR_CTRL));
inputs.push_back(InputEventKey::create_reference(Key::KEY_DELETE | KeyModifierMask::SHIFT));
default_builtin_cache.insert("ui_cut", inputs);
inputs = List<Ref<InputEvent>>();
- inputs.push_back(InputEventKey::create_reference(Key::C | KeyModifierMask::CMD));
- inputs.push_back(InputEventKey::create_reference(Key::INSERT | KeyModifierMask::CMD));
+ inputs.push_back(InputEventKey::create_reference(Key::C | KeyModifierMask::CMD_OR_CTRL));
+ inputs.push_back(InputEventKey::create_reference(Key::INSERT | KeyModifierMask::CMD_OR_CTRL));
default_builtin_cache.insert("ui_copy", inputs);
inputs = List<Ref<InputEvent>>();
- inputs.push_back(InputEventKey::create_reference(Key::V | KeyModifierMask::CMD));
+ inputs.push_back(InputEventKey::create_reference(Key::V | KeyModifierMask::CMD_OR_CTRL));
inputs.push_back(InputEventKey::create_reference(Key::INSERT | KeyModifierMask::SHIFT));
default_builtin_cache.insert("ui_paste", inputs);
inputs = List<Ref<InputEvent>>();
- inputs.push_back(InputEventKey::create_reference(Key::Z | KeyModifierMask::CMD));
+ inputs.push_back(InputEventKey::create_reference(Key::Z | KeyModifierMask::CMD_OR_CTRL));
default_builtin_cache.insert("ui_undo", inputs);
inputs = List<Ref<InputEvent>>();
- inputs.push_back(InputEventKey::create_reference(Key::Z | KeyModifierMask::CMD | KeyModifierMask::SHIFT));
- inputs.push_back(InputEventKey::create_reference(Key::Y | KeyModifierMask::CMD));
+ inputs.push_back(InputEventKey::create_reference(Key::Z | KeyModifierMask::CMD_OR_CTRL | KeyModifierMask::SHIFT));
+ inputs.push_back(InputEventKey::create_reference(Key::Y | KeyModifierMask::CMD_OR_CTRL));
default_builtin_cache.insert("ui_redo", inputs);
// ///// UI Text Input Shortcuts /////
@@ -474,13 +474,13 @@ const HashMap<String, List<Ref<InputEvent>>> &InputMap::get_builtins() {
inputs = List<Ref<InputEvent>>();
- inputs.push_back(InputEventKey::create_reference(Key::ENTER | KeyModifierMask::CMD));
- inputs.push_back(InputEventKey::create_reference(Key::KP_ENTER | KeyModifierMask::CMD));
+ inputs.push_back(InputEventKey::create_reference(Key::ENTER | KeyModifierMask::CMD_OR_CTRL));
+ inputs.push_back(InputEventKey::create_reference(Key::KP_ENTER | KeyModifierMask::CMD_OR_CTRL));
default_builtin_cache.insert("ui_text_newline_blank", inputs);
inputs = List<Ref<InputEvent>>();
- inputs.push_back(InputEventKey::create_reference(Key::ENTER | KeyModifierMask::SHIFT | KeyModifierMask::CMD));
- inputs.push_back(InputEventKey::create_reference(Key::KP_ENTER | KeyModifierMask::SHIFT | KeyModifierMask::CMD));
+ inputs.push_back(InputEventKey::create_reference(Key::ENTER | KeyModifierMask::SHIFT | KeyModifierMask::CMD_OR_CTRL));
+ inputs.push_back(InputEventKey::create_reference(Key::KP_ENTER | KeyModifierMask::SHIFT | KeyModifierMask::CMD_OR_CTRL));
default_builtin_cache.insert("ui_text_newline_above", inputs);
// Indentation
@@ -499,7 +499,7 @@ const HashMap<String, List<Ref<InputEvent>>> &InputMap::get_builtins() {
default_builtin_cache.insert("ui_text_backspace", inputs);
inputs = List<Ref<InputEvent>>();
- inputs.push_back(InputEventKey::create_reference(Key::BACKSPACE | KeyModifierMask::CMD));
+ inputs.push_back(InputEventKey::create_reference(Key::BACKSPACE | KeyModifierMask::CMD_OR_CTRL));
default_builtin_cache.insert("ui_text_backspace_word", inputs);
inputs = List<Ref<InputEvent>>();
@@ -510,7 +510,7 @@ const HashMap<String, List<Ref<InputEvent>>> &InputMap::get_builtins() {
default_builtin_cache.insert("ui_text_backspace_all_to_left", inputs);
inputs = List<Ref<InputEvent>>();
- inputs.push_back(InputEventKey::create_reference(Key::BACKSPACE | KeyModifierMask::CMD));
+ inputs.push_back(InputEventKey::create_reference(Key::BACKSPACE | KeyModifierMask::CMD_OR_CTRL));
default_builtin_cache.insert("ui_text_backspace_all_to_left.macos", inputs);
inputs = List<Ref<InputEvent>>();
@@ -518,7 +518,7 @@ const HashMap<String, List<Ref<InputEvent>>> &InputMap::get_builtins() {
default_builtin_cache.insert("ui_text_delete", inputs);
inputs = List<Ref<InputEvent>>();
- inputs.push_back(InputEventKey::create_reference(Key::KEY_DELETE | KeyModifierMask::CMD));
+ inputs.push_back(InputEventKey::create_reference(Key::KEY_DELETE | KeyModifierMask::CMD_OR_CTRL));
default_builtin_cache.insert("ui_text_delete_word", inputs);
inputs = List<Ref<InputEvent>>();
@@ -529,7 +529,7 @@ const HashMap<String, List<Ref<InputEvent>>> &InputMap::get_builtins() {
default_builtin_cache.insert("ui_text_delete_all_to_right", inputs);
inputs = List<Ref<InputEvent>>();
- inputs.push_back(InputEventKey::create_reference(Key::KEY_DELETE | KeyModifierMask::CMD));
+ inputs.push_back(InputEventKey::create_reference(Key::KEY_DELETE | KeyModifierMask::CMD_OR_CTRL));
default_builtin_cache.insert("ui_text_delete_all_to_right.macos", inputs);
// Text Caret Movement Left/Right
@@ -539,7 +539,7 @@ const HashMap<String, List<Ref<InputEvent>>> &InputMap::get_builtins() {
default_builtin_cache.insert("ui_text_caret_left", inputs);
inputs = List<Ref<InputEvent>>();
- inputs.push_back(InputEventKey::create_reference(Key::LEFT | KeyModifierMask::CMD));
+ inputs.push_back(InputEventKey::create_reference(Key::LEFT | KeyModifierMask::CMD_OR_CTRL));
default_builtin_cache.insert("ui_text_caret_word_left", inputs);
inputs = List<Ref<InputEvent>>();
@@ -551,7 +551,7 @@ const HashMap<String, List<Ref<InputEvent>>> &InputMap::get_builtins() {
default_builtin_cache.insert("ui_text_caret_right", inputs);
inputs = List<Ref<InputEvent>>();
- inputs.push_back(InputEventKey::create_reference(Key::RIGHT | KeyModifierMask::CMD));
+ inputs.push_back(InputEventKey::create_reference(Key::RIGHT | KeyModifierMask::CMD_OR_CTRL));
default_builtin_cache.insert("ui_text_caret_word_right", inputs);
inputs = List<Ref<InputEvent>>();
@@ -576,7 +576,7 @@ const HashMap<String, List<Ref<InputEvent>>> &InputMap::get_builtins() {
inputs = List<Ref<InputEvent>>();
inputs.push_back(InputEventKey::create_reference(Key::A | KeyModifierMask::CTRL));
- inputs.push_back(InputEventKey::create_reference(Key::LEFT | KeyModifierMask::CMD));
+ inputs.push_back(InputEventKey::create_reference(Key::LEFT | KeyModifierMask::CMD_OR_CTRL));
default_builtin_cache.insert("ui_text_caret_line_start.macos", inputs);
inputs = List<Ref<InputEvent>>();
@@ -585,7 +585,7 @@ const HashMap<String, List<Ref<InputEvent>>> &InputMap::get_builtins() {
inputs = List<Ref<InputEvent>>();
inputs.push_back(InputEventKey::create_reference(Key::E | KeyModifierMask::CTRL));
- inputs.push_back(InputEventKey::create_reference(Key::RIGHT | KeyModifierMask::CMD));
+ inputs.push_back(InputEventKey::create_reference(Key::RIGHT | KeyModifierMask::CMD_OR_CTRL));
default_builtin_cache.insert("ui_text_caret_line_end.macos", inputs);
// Text Caret Movement Page Up/Down
@@ -601,47 +601,47 @@ const HashMap<String, List<Ref<InputEvent>>> &InputMap::get_builtins() {
// Text Caret Movement Document Start/End
inputs = List<Ref<InputEvent>>();
- inputs.push_back(InputEventKey::create_reference(Key::HOME | KeyModifierMask::CMD));
+ inputs.push_back(InputEventKey::create_reference(Key::HOME | KeyModifierMask::CMD_OR_CTRL));
default_builtin_cache.insert("ui_text_caret_document_start", inputs);
inputs = List<Ref<InputEvent>>();
- inputs.push_back(InputEventKey::create_reference(Key::UP | KeyModifierMask::CMD));
+ inputs.push_back(InputEventKey::create_reference(Key::UP | KeyModifierMask::CMD_OR_CTRL));
default_builtin_cache.insert("ui_text_caret_document_start.macos", inputs);
inputs = List<Ref<InputEvent>>();
- inputs.push_back(InputEventKey::create_reference(Key::END | KeyModifierMask::CMD));
+ inputs.push_back(InputEventKey::create_reference(Key::END | KeyModifierMask::CMD_OR_CTRL));
default_builtin_cache.insert("ui_text_caret_document_end", inputs);
inputs = List<Ref<InputEvent>>();
- inputs.push_back(InputEventKey::create_reference(Key::DOWN | KeyModifierMask::CMD));
+ inputs.push_back(InputEventKey::create_reference(Key::DOWN | KeyModifierMask::CMD_OR_CTRL));
default_builtin_cache.insert("ui_text_caret_document_end.macos", inputs);
// Text Scrolling
inputs = List<Ref<InputEvent>>();
- inputs.push_back(InputEventKey::create_reference(Key::UP | KeyModifierMask::CMD));
+ inputs.push_back(InputEventKey::create_reference(Key::UP | KeyModifierMask::CMD_OR_CTRL));
default_builtin_cache.insert("ui_text_scroll_up", inputs);
inputs = List<Ref<InputEvent>>();
- inputs.push_back(InputEventKey::create_reference(Key::UP | KeyModifierMask::CMD | KeyModifierMask::ALT));
+ inputs.push_back(InputEventKey::create_reference(Key::UP | KeyModifierMask::CMD_OR_CTRL | KeyModifierMask::ALT));
default_builtin_cache.insert("ui_text_scroll_up.macos", inputs);
inputs = List<Ref<InputEvent>>();
- inputs.push_back(InputEventKey::create_reference(Key::DOWN | KeyModifierMask::CMD));
+ inputs.push_back(InputEventKey::create_reference(Key::DOWN | KeyModifierMask::CMD_OR_CTRL));
default_builtin_cache.insert("ui_text_scroll_down", inputs);
inputs = List<Ref<InputEvent>>();
- inputs.push_back(InputEventKey::create_reference(Key::DOWN | KeyModifierMask::CMD | KeyModifierMask::ALT));
+ inputs.push_back(InputEventKey::create_reference(Key::DOWN | KeyModifierMask::CMD_OR_CTRL | KeyModifierMask::ALT));
default_builtin_cache.insert("ui_text_scroll_down.macos", inputs);
// Text Misc
inputs = List<Ref<InputEvent>>();
- inputs.push_back(InputEventKey::create_reference(Key::A | KeyModifierMask::CMD));
+ inputs.push_back(InputEventKey::create_reference(Key::A | KeyModifierMask::CMD_OR_CTRL));
default_builtin_cache.insert("ui_text_select_all", inputs);
inputs = List<Ref<InputEvent>>();
- inputs.push_back(InputEventKey::create_reference(Key::D | KeyModifierMask::CMD));
+ inputs.push_back(InputEventKey::create_reference(Key::D | KeyModifierMask::CMD_OR_CTRL));
default_builtin_cache.insert("ui_text_select_word_under_caret", inputs);
inputs = List<Ref<InputEvent>>();
@@ -660,7 +660,7 @@ const HashMap<String, List<Ref<InputEvent>>> &InputMap::get_builtins() {
// ///// UI Graph Shortcuts /////
inputs = List<Ref<InputEvent>>();
- inputs.push_back(InputEventKey::create_reference(Key::D | KeyModifierMask::CMD));
+ inputs.push_back(InputEventKey::create_reference(Key::D | KeyModifierMask::CMD_OR_CTRL));
default_builtin_cache.insert("ui_graph_duplicate", inputs);
inputs = List<Ref<InputEvent>>();
@@ -681,7 +681,7 @@ const HashMap<String, List<Ref<InputEvent>>> &InputMap::get_builtins() {
default_builtin_cache.insert("ui_filedialog_show_hidden", inputs);
inputs = List<Ref<InputEvent>>();
- inputs.push_back(InputEventKey::create_reference(Key::QUOTELEFT | KeyModifierMask::CMD));
+ inputs.push_back(InputEventKey::create_reference(Key::QUOTELEFT | KeyModifierMask::CMD_OR_CTRL));
default_builtin_cache.insert("ui_swap_input_direction", inputs);
return default_builtin_cache;
diff --git a/core/io/http_client.cpp b/core/io/http_client.cpp
index 52b1120b2a..93a310e83b 100644
--- a/core/io/http_client.cpp
+++ b/core/io/http_client.cpp
@@ -138,7 +138,7 @@ PackedStringArray HTTPClient::_get_response_headers() {
}
void HTTPClient::_bind_methods() {
- ClassDB::bind_method(D_METHOD("connect_to_host", "host", "port", "use_ssl", "verify_host"), &HTTPClient::connect_to_host, DEFVAL(-1), DEFVAL(false), DEFVAL(true));
+ ClassDB::bind_method(D_METHOD("connect_to_host", "host", "port", "use_tls", "verify_host"), &HTTPClient::connect_to_host, DEFVAL(-1), DEFVAL(false), DEFVAL(true));
ClassDB::bind_method(D_METHOD("set_connection", "connection"), &HTTPClient::set_connection);
ClassDB::bind_method(D_METHOD("get_connection"), &HTTPClient::get_connection);
ClassDB::bind_method(D_METHOD("request_raw", "method", "url", "headers", "body"), &HTTPClient::_request_raw);
@@ -190,7 +190,7 @@ void HTTPClient::_bind_methods() {
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(STATUS_TLS_HANDSHAKE_ERROR);
BIND_ENUM_CONSTANT(RESPONSE_CONTINUE);
BIND_ENUM_CONSTANT(RESPONSE_SWITCHING_PROTOCOLS);
diff --git a/core/io/http_client.h b/core/io/http_client.h
index de6045f647..0524b010f4 100644
--- a/core/io/http_client.h
+++ b/core/io/http_client.h
@@ -138,7 +138,7 @@ public:
STATUS_REQUESTING, // Request in progress
STATUS_BODY, // Request resulted in body, which must be read
STATUS_CONNECTION_ERROR,
- STATUS_SSL_HANDSHAKE_ERROR,
+ STATUS_TLS_HANDSHAKE_ERROR,
};
@@ -168,7 +168,7 @@ public:
Error verify_headers(const Vector<String> &p_headers);
virtual Error request(Method p_method, const String &p_url, const Vector<String> &p_headers, const uint8_t *p_body, int p_body_size) = 0;
- virtual Error connect_to_host(const String &p_host, int p_port = -1, bool p_ssl = false, bool p_verify_host = true) = 0;
+ virtual Error connect_to_host(const String &p_host, int p_port = -1, bool p_tls = false, bool p_verify_host = true) = 0;
virtual void set_connection(const Ref<StreamPeer> &p_connection) = 0;
virtual Ref<StreamPeer> get_connection() const = 0;
diff --git a/core/io/http_client_tcp.cpp b/core/io/http_client_tcp.cpp
index 7afab9ea09..5c1d00a330 100644
--- a/core/io/http_client_tcp.cpp
+++ b/core/io/http_client_tcp.cpp
@@ -39,7 +39,7 @@ HTTPClient *HTTPClientTCP::_create_func() {
return memnew(HTTPClientTCP);
}
-Error HTTPClientTCP::connect_to_host(const String &p_host, int p_port, bool p_ssl, bool p_verify_host) {
+Error HTTPClientTCP::connect_to_host(const String &p_host, int p_port, bool p_tls, bool p_verify_host) {
close();
conn_port = p_port;
@@ -47,21 +47,21 @@ Error HTTPClientTCP::connect_to_host(const String &p_host, int p_port, bool p_ss
ip_candidates.clear();
- ssl = p_ssl;
- ssl_verify_host = p_verify_host;
+ tls = p_tls;
+ tls_verify_host = p_verify_host;
String host_lower = conn_host.to_lower();
if (host_lower.begins_with("http://")) {
conn_host = conn_host.substr(7, conn_host.length() - 7);
} else if (host_lower.begins_with("https://")) {
- ssl = true;
+ tls = true;
conn_host = conn_host.substr(8, conn_host.length() - 8);
}
ERR_FAIL_COND_V(conn_host.length() < HOST_MIN_LEN, ERR_INVALID_PARAMETER);
if (conn_port < 0) {
- if (ssl) {
+ if (tls) {
conn_port = PORT_HTTPS;
} else {
conn_port = PORT_HTTP;
@@ -70,11 +70,11 @@ Error HTTPClientTCP::connect_to_host(const String &p_host, int p_port, bool p_ss
connection = tcp_connection;
- if (ssl && https_proxy_port != -1) {
+ if (tls && https_proxy_port != -1) {
proxy_client.instantiate(); // Needs proxy negotiation.
server_host = https_proxy_host;
server_port = https_proxy_port;
- } else if (!ssl && http_proxy_port != -1) {
+ } else if (!tls && http_proxy_port != -1) {
server_host = http_proxy_host;
server_port = http_proxy_port;
} else {
@@ -107,7 +107,7 @@ Error HTTPClientTCP::connect_to_host(const String &p_host, int p_port, bool p_ss
void HTTPClientTCP::set_connection(const Ref<StreamPeer> &p_connection) {
ERR_FAIL_COND_MSG(p_connection.is_null(), "Connection is not a reference to a valid StreamPeer object.");
- if (ssl) {
+ if (tls) {
ERR_FAIL_NULL_MSG(Object::cast_to<StreamPeerTLS>(p_connection.ptr()),
"Connection is not a reference to a valid StreamPeerTLS object.");
}
@@ -156,7 +156,7 @@ Error HTTPClientTCP::request(Method p_method, const String &p_url, const Vector<
}
String uri = p_url;
- if (!ssl && http_proxy_port != -1) {
+ if (!tls && http_proxy_port != -1) {
uri = vformat("http://%s:%d%s", conn_host, conn_port, p_url);
}
@@ -181,7 +181,7 @@ Error HTTPClientTCP::request(Method p_method, const String &p_url, const Vector<
}
}
if (add_host) {
- if ((ssl && conn_port == PORT_HTTPS) || (!ssl && conn_port == PORT_HTTP)) {
+ if ((tls && conn_port == PORT_HTTPS) || (!tls && conn_port == PORT_HTTP)) {
// Don't append the standard ports.
request += "Host: " + conn_host + "\r\n";
} else {
@@ -316,7 +316,7 @@ Error HTTPClientTCP::poll() {
return OK;
} break;
case StreamPeerTCP::STATUS_CONNECTED: {
- if (ssl && proxy_client.is_valid()) {
+ if (tls && proxy_client.is_valid()) {
Error err = proxy_client->poll();
if (err == ERR_UNCONFIGURED) {
proxy_client->set_connection(tcp_connection);
@@ -357,42 +357,42 @@ Error HTTPClientTCP::poll() {
return ERR_CANT_CONNECT;
} break;
}
- } else if (ssl) {
- Ref<StreamPeerTLS> ssl;
+ } else if (tls) {
+ Ref<StreamPeerTLS> tls;
if (!handshaking) {
// Connect the StreamPeerTLS and start handshaking.
- ssl = Ref<StreamPeerTLS>(StreamPeerTLS::create());
- ssl->set_blocking_handshake_enabled(false);
- Error err = ssl->connect_to_stream(tcp_connection, ssl_verify_host, conn_host);
+ tls = Ref<StreamPeerTLS>(StreamPeerTLS::create());
+ tls->set_blocking_handshake_enabled(false);
+ Error err = tls->connect_to_stream(tcp_connection, tls_verify_host, conn_host);
if (err != OK) {
close();
- status = STATUS_SSL_HANDSHAKE_ERROR;
+ status = STATUS_TLS_HANDSHAKE_ERROR;
return ERR_CANT_CONNECT;
}
- connection = ssl;
+ connection = tls;
handshaking = true;
} else {
- // We are already handshaking, which means we can use your already active SSL connection.
- ssl = static_cast<Ref<StreamPeerTLS>>(connection);
- if (ssl.is_null()) {
+ // We are already handshaking, which means we can use your already active TLS connection.
+ tls = static_cast<Ref<StreamPeerTLS>>(connection);
+ if (tls.is_null()) {
close();
- status = STATUS_SSL_HANDSHAKE_ERROR;
+ status = STATUS_TLS_HANDSHAKE_ERROR;
return ERR_CANT_CONNECT;
}
- ssl->poll(); // Try to finish the handshake.
+ tls->poll(); // Try to finish the handshake.
}
- if (ssl->get_status() == StreamPeerTLS::STATUS_CONNECTED) {
+ if (tls->get_status() == StreamPeerTLS::STATUS_CONNECTED) {
// Handshake has been successful.
handshaking = false;
ip_candidates.clear();
status = STATUS_CONNECTED;
return OK;
- } else if (ssl->get_status() != StreamPeerTLS::STATUS_HANDSHAKING) {
+ } else if (tls->get_status() != StreamPeerTLS::STATUS_HANDSHAKING) {
// Handshake has failed.
close();
- status = STATUS_SSL_HANDSHAKE_ERROR;
+ status = STATUS_TLS_HANDSHAKE_ERROR;
return ERR_CANT_CONNECT;
}
// ... we will need to poll more for handshake to finish.
@@ -421,7 +421,7 @@ Error HTTPClientTCP::poll() {
case STATUS_BODY:
case STATUS_CONNECTED: {
// Check if we are still connected.
- if (ssl) {
+ if (tls) {
Ref<StreamPeerTLS> tmp = connection;
tmp->poll();
if (tmp->get_status() != StreamPeerTLS::STATUS_CONNECTED) {
@@ -548,7 +548,7 @@ Error HTTPClientTCP::poll() {
return ERR_UNCONFIGURED;
} break;
case STATUS_CONNECTION_ERROR:
- case STATUS_SSL_HANDSHAKE_ERROR: {
+ case STATUS_TLS_HANDSHAKE_ERROR: {
return ERR_CONNECTION_ERROR;
} break;
case STATUS_CANT_CONNECT: {
diff --git a/core/io/http_client_tcp.h b/core/io/http_client_tcp.h
index c10e0b1eca..744c15f7ab 100644
--- a/core/io/http_client_tcp.h
+++ b/core/io/http_client_tcp.h
@@ -46,8 +46,8 @@ private:
String http_proxy_host;
int https_proxy_port = -1; // Proxy server for https requests.
String https_proxy_host;
- bool ssl = false;
- bool ssl_verify_host = false;
+ bool tls = false;
+ bool tls_verify_host = false;
bool blocking = false;
bool handshaking = false;
bool head_request = false;
@@ -79,7 +79,7 @@ public:
Error request(Method p_method, const String &p_url, const Vector<String> &p_headers, const uint8_t *p_body, int p_body_size) override;
- Error connect_to_host(const String &p_host, int p_port = -1, bool p_ssl = false, bool p_verify_host = true) override;
+ Error connect_to_host(const String &p_host, int p_port = -1, bool p_tls = false, bool p_verify_host = true) override;
void set_connection(const Ref<StreamPeer> &p_connection) override;
Ref<StreamPeer> get_connection() const override;
void close() override;
diff --git a/core/io/image_loader.h b/core/io/image_loader.h
index cb64d2310e..bf78005e40 100644
--- a/core/io/image_loader.h
+++ b/core/io/image_loader.h
@@ -52,6 +52,7 @@ public:
enum LoaderFlags {
FLAG_NONE = 0,
FLAG_FORCE_LINEAR = 1,
+ FLAG_CONVERT_COLORS = 2,
};
virtual ~ImageFormatLoader() {}
diff --git a/core/io/resource.cpp b/core/io/resource.cpp
index d117f86f39..553698f8a6 100644
--- a/core/io/resource.cpp
+++ b/core/io/resource.cpp
@@ -93,15 +93,14 @@ String Resource::get_path() const {
String Resource::generate_scene_unique_id() {
// Generate a unique enough hash, but still user-readable.
// If it's not unique it does not matter because the saver will try again.
- OS::Date date = OS::get_singleton()->get_date();
- OS::Time time = OS::get_singleton()->get_time();
+ OS::DateTime dt = OS::get_singleton()->get_datetime();
uint32_t hash = hash_murmur3_one_32(OS::get_singleton()->get_ticks_usec());
- hash = hash_murmur3_one_32(date.year, hash);
- hash = hash_murmur3_one_32(date.month, hash);
- hash = hash_murmur3_one_32(date.day, hash);
- hash = hash_murmur3_one_32(time.hour, hash);
- hash = hash_murmur3_one_32(time.minute, hash);
- hash = hash_murmur3_one_32(time.second, hash);
+ hash = hash_murmur3_one_32(dt.year, hash);
+ hash = hash_murmur3_one_32(dt.month, hash);
+ hash = hash_murmur3_one_32(dt.day, hash);
+ hash = hash_murmur3_one_32(dt.hour, hash);
+ hash = hash_murmur3_one_32(dt.minute, hash);
+ hash = hash_murmur3_one_32(dt.second, hash);
hash = hash_murmur3_one_32(Math::rand(), hash);
static constexpr uint32_t characters = 5;
diff --git a/core/io/resource_importer.cpp b/core/io/resource_importer.cpp
index aa7f96a047..d923522317 100644
--- a/core/io/resource_importer.cpp
+++ b/core/io/resource_importer.cpp
@@ -108,6 +108,15 @@ Error ResourceFormatImporter::_get_path_and_type(const String &p_path, PathAndTy
}
}
+#ifdef TOOLS_ENABLED
+ if (r_path_and_type.metadata && !r_path_and_type.path.is_empty()) {
+ Dictionary metadata = r_path_and_type.metadata;
+ if (metadata.has("has_editor_variant")) {
+ r_path_and_type.path = r_path_and_type.path.get_basename() + ".editor." + r_path_and_type.path.get_extension();
+ }
+ }
+#endif
+
if (r_path_and_type.path.is_empty() || r_path_and_type.type.is_empty()) {
return ERR_FILE_CORRUPT;
}
diff --git a/core/io/xml_parser.cpp b/core/io/xml_parser.cpp
index 154b55f5e7..abae48fdd8 100644
--- a/core/io/xml_parser.cpp
+++ b/core/io/xml_parser.cpp
@@ -137,7 +137,7 @@ bool XMLParser::_parse_cdata() {
next_char();
}
- if (cDataEnd) {
+ if (!cDataEnd) {
cDataEnd = P;
}
node_name = String::utf8(cDataBegin, (int)(cDataEnd - cDataBegin));
diff --git a/core/math/a_star_grid_2d.cpp b/core/math/a_star_grid_2d.cpp
index 23d7e379ee..ad67cfa852 100644
--- a/core/math/a_star_grid_2d.cpp
+++ b/core/math/a_star_grid_2d.cpp
@@ -30,16 +30,16 @@
#include "a_star_grid_2d.h"
-static real_t heuristic_manhattan(const Vector2i &p_from, const Vector2i &p_to) {
+static real_t heuristic_euclidian(const Vector2i &p_from, const Vector2i &p_to) {
real_t dx = (real_t)ABS(p_to.x - p_from.x);
real_t dy = (real_t)ABS(p_to.y - p_from.y);
- return dx + dy;
+ return (real_t)Math::sqrt(dx * dx + dy * dy);
}
-static real_t heuristic_euclidian(const Vector2i &p_from, const Vector2i &p_to) {
+static real_t heuristic_manhattan(const Vector2i &p_from, const Vector2i &p_to) {
real_t dx = (real_t)ABS(p_to.x - p_from.x);
real_t dy = (real_t)ABS(p_to.y - p_from.y);
- return (real_t)Math::sqrt(dx * dx + dy * dy);
+ return dx + dy;
}
static real_t heuristic_octile(const Vector2i &p_from, const Vector2i &p_to) {
@@ -55,7 +55,7 @@ static real_t heuristic_chebyshev(const Vector2i &p_from, const Vector2i &p_to)
return MAX(dx, dy);
}
-static real_t (*heuristics[AStarGrid2D::HEURISTIC_MAX])(const Vector2i &, const Vector2i &) = { heuristic_manhattan, heuristic_euclidian, heuristic_octile, heuristic_chebyshev };
+static real_t (*heuristics[AStarGrid2D::HEURISTIC_MAX])(const Vector2i &, const Vector2i &) = { heuristic_euclidian, heuristic_manhattan, heuristic_octile, heuristic_chebyshev };
void AStarGrid2D::set_size(const Size2i &p_size) {
ERR_FAIL_COND(p_size.x < 0 || p_size.y < 0);
@@ -572,7 +572,7 @@ void AStarGrid2D::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "cell_size"), "set_cell_size", "get_cell_size");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "jumping_enabled"), "set_jumping_enabled", "is_jumping_enabled");
- ADD_PROPERTY(PropertyInfo(Variant::INT, "default_heuristic", PROPERTY_HINT_ENUM, "Manhattan,Euclidean,Octile,Chebyshev,Max"), "set_default_heuristic", "get_default_heuristic");
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "default_heuristic", PROPERTY_HINT_ENUM, "Euclidean,Manhattan,Octile,Chebyshev,Max"), "set_default_heuristic", "get_default_heuristic");
ADD_PROPERTY(PropertyInfo(Variant::INT, "diagonal_mode", PROPERTY_HINT_ENUM, "Never,Always,At Least One Walkable,Only If No Obstacles,Max"), "set_diagonal_mode", "get_diagonal_mode");
BIND_ENUM_CONSTANT(HEURISTIC_EUCLIDEAN);
diff --git a/core/os/keyboard.cpp b/core/os/keyboard.cpp
index a592791d06..f3be495c8e 100644
--- a/core/os/keyboard.cpp
+++ b/core/os/keyboard.cpp
@@ -61,12 +61,16 @@ static const _KeyCodeText _keycodes[] = {
{Key::PAGEDOWN ,"PageDown"},
{Key::SHIFT ,"Shift"},
{Key::CTRL ,"Ctrl"},
-#ifdef MACOS_ENABLED
+#if defined(MACOS_ENABLED)
{Key::META ,"Command"},
+ {Key::ALT ,"Option"},
+#elif defined(WINDOWS_ENABLED)
+ {Key::META ,"Windows"},
+ {Key::ALT ,"Alt"},
#else
{Key::META ,"Meta"},
-#endif
{Key::ALT ,"Alt"},
+#endif
{Key::CAPSLOCK ,"CapsLock"},
{Key::NUMLOCK ,"NumLock"},
{Key::SCROLLLOCK ,"ScrollLock"},
@@ -437,6 +441,14 @@ String keycode_get_string(Key p_code) {
codestr += find_keycode_name(Key::ALT);
codestr += "+";
}
+ if ((p_code & KeyModifierMask::CMD_OR_CTRL) != Key::NONE) {
+#ifdef MACOS_ENABLED
+ codestr += find_keycode_name(Key::META);
+#else
+ codestr += find_keycode_name(Key::CTRL);
+#endif
+ codestr += "+";
+ }
if ((p_code & KeyModifierMask::CTRL) != Key::NONE) {
codestr += find_keycode_name(Key::CTRL);
codestr += "+";
diff --git a/core/os/keyboard.h b/core/os/keyboard.h
index 29418049cb..e5d9b24e85 100644
--- a/core/os/keyboard.h
+++ b/core/os/keyboard.h
@@ -36,11 +36,11 @@
enum class Key {
NONE = 0,
// Special key: The strategy here is similar to the one used by toolkits,
- // which consists in leaving the 24 bits unicode range for printable
- // characters, and use the upper 8 bits for special keys and modifiers.
+ // which consists in leaving the 21 bits unicode range for printable
+ // characters, and use the upper 11 bits for special keys and modifiers.
// This way everything (char/keycode) can fit nicely in one 32-bit
// integer (the enum's underlying type is `int` by default).
- SPECIAL = (1 << 24),
+ SPECIAL = (1 << 22),
/* CURSOR/FUNCTION/BROWSER/MULTIMEDIA/MISC KEYS */
ESCAPE = SPECIAL | 0x01,
TAB = SPECIAL | 0x02,
@@ -312,17 +312,14 @@ enum class Key {
};
enum class KeyModifierMask {
- CODE_MASK = ((1 << 25) - 1), ///< Apply this mask to any keycode to remove modifiers.
- MODIFIER_MASK = (0x7F << 24), ///< Apply this mask to isolate modifiers.
+ CODE_MASK = ((1 << 23) - 1), ///< Apply this mask to any keycode to remove modifiers.
+ MODIFIER_MASK = (0x7F << 22), ///< Apply this mask to isolate modifiers.
+ //RESERVED = (1 << 23),
+ CMD_OR_CTRL = (1 << 24),
SHIFT = (1 << 25),
ALT = (1 << 26),
META = (1 << 27),
CTRL = (1 << 28),
-#ifdef APPLE_STYLE_KEYS
- CMD = META,
-#else
- CMD = CTRL,
-#endif
KPAD = (1 << 29),
GROUP_SWITCH = (1 << 30)
};
diff --git a/core/os/os.h b/core/os/os.h
index 0e8a2d0398..363697ea30 100644
--- a/core/os/os.h
+++ b/core/os/os.h
@@ -202,18 +202,15 @@ public:
MONTH_DECEMBER,
};
- struct Date {
+ struct DateTime {
int64_t year;
Month month;
uint8_t day;
Weekday weekday;
- bool dst;
- };
-
- struct Time {
uint8_t hour;
uint8_t minute;
uint8_t second;
+ bool dst;
};
struct TimeZoneInfo {
@@ -221,8 +218,7 @@ public:
String name;
};
- virtual Date get_date(bool p_utc = false) const = 0;
- virtual Time get_time(bool p_utc = false) const = 0;
+ virtual DateTime get_datetime(bool utc = false) const = 0;
virtual TimeZoneInfo get_time_zone_info() const = 0;
virtual double get_unix_time() const;
diff --git a/core/os/time.cpp b/core/os/time.cpp
index a30e2a906b..a3c2c99b4c 100644
--- a/core/os/time.cpp
+++ b/core/os/time.cpp
@@ -324,63 +324,60 @@ String Time::get_offset_string_from_offset_minutes(int64_t p_offset_minutes) con
}
Dictionary Time::get_datetime_dict_from_system(bool p_utc) const {
- OS::Date date = OS::get_singleton()->get_date(p_utc);
- OS::Time time = OS::get_singleton()->get_time(p_utc);
+ OS::DateTime dt = OS::get_singleton()->get_datetime(p_utc);
Dictionary datetime;
- datetime[YEAR_KEY] = date.year;
- datetime[MONTH_KEY] = (uint8_t)date.month;
- datetime[DAY_KEY] = date.day;
- datetime[WEEKDAY_KEY] = (uint8_t)date.weekday;
- datetime[DST_KEY] = date.dst;
- datetime[HOUR_KEY] = time.hour;
- datetime[MINUTE_KEY] = time.minute;
- datetime[SECOND_KEY] = time.second;
+ datetime[YEAR_KEY] = dt.year;
+ datetime[MONTH_KEY] = (uint8_t)dt.month;
+ datetime[DAY_KEY] = dt.day;
+ datetime[WEEKDAY_KEY] = (uint8_t)dt.weekday;
+ datetime[HOUR_KEY] = dt.hour;
+ datetime[MINUTE_KEY] = dt.minute;
+ datetime[SECOND_KEY] = dt.second;
+ datetime[DST_KEY] = dt.dst;
return datetime;
}
Dictionary Time::get_date_dict_from_system(bool p_utc) const {
- OS::Date date = OS::get_singleton()->get_date(p_utc);
+ OS::DateTime dt = OS::get_singleton()->get_datetime(p_utc);
Dictionary date_dictionary;
- date_dictionary[YEAR_KEY] = date.year;
- date_dictionary[MONTH_KEY] = (uint8_t)date.month;
- date_dictionary[DAY_KEY] = date.day;
- date_dictionary[WEEKDAY_KEY] = (uint8_t)date.weekday;
- date_dictionary[DST_KEY] = date.dst;
+ date_dictionary[YEAR_KEY] = dt.year;
+ date_dictionary[MONTH_KEY] = (uint8_t)dt.month;
+ date_dictionary[DAY_KEY] = dt.day;
+ date_dictionary[WEEKDAY_KEY] = (uint8_t)dt.weekday;
return date_dictionary;
}
Dictionary Time::get_time_dict_from_system(bool p_utc) const {
- OS::Time time = OS::get_singleton()->get_time(p_utc);
+ OS::DateTime dt = OS::get_singleton()->get_datetime(p_utc);
Dictionary time_dictionary;
- time_dictionary[HOUR_KEY] = time.hour;
- time_dictionary[MINUTE_KEY] = time.minute;
- time_dictionary[SECOND_KEY] = time.second;
+ time_dictionary[HOUR_KEY] = dt.hour;
+ time_dictionary[MINUTE_KEY] = dt.minute;
+ time_dictionary[SECOND_KEY] = dt.second;
return time_dictionary;
}
String Time::get_datetime_string_from_system(bool p_utc, bool p_use_space) const {
- OS::Date date = OS::get_singleton()->get_date(p_utc);
- OS::Time time = OS::get_singleton()->get_time(p_utc);
+ OS::DateTime dt = OS::get_singleton()->get_datetime(p_utc);
// vformat only supports up to 6 arguments, so we need to split this up into 2 parts.
- String timestamp = vformat("%04d-%02d-%02d", date.year, (uint8_t)date.month, date.day);
+ String timestamp = vformat("%04d-%02d-%02d", dt.year, (uint8_t)dt.month, dt.day);
if (p_use_space) {
- timestamp = vformat("%s %02d:%02d:%02d", timestamp, time.hour, time.minute, time.second);
+ timestamp = vformat("%s %02d:%02d:%02d", timestamp, dt.hour, dt.minute, dt.second);
} else {
- timestamp = vformat("%sT%02d:%02d:%02d", timestamp, time.hour, time.minute, time.second);
+ timestamp = vformat("%sT%02d:%02d:%02d", timestamp, dt.hour, dt.minute, dt.second);
}
return timestamp;
}
String Time::get_date_string_from_system(bool p_utc) const {
- OS::Date date = OS::get_singleton()->get_date(p_utc);
+ OS::DateTime dt = OS::get_singleton()->get_datetime(p_utc);
// Android is picky about the types passed to make Variant, so we need a cast.
- return vformat("%04d-%02d-%02d", date.year, (uint8_t)date.month, date.day);
+ return vformat("%04d-%02d-%02d", dt.year, (uint8_t)dt.month, dt.day);
}
String Time::get_time_string_from_system(bool p_utc) const {
- OS::Time time = OS::get_singleton()->get_time(p_utc);
- return vformat("%02d:%02d:%02d", time.hour, time.minute, time.second);
+ OS::DateTime dt = OS::get_singleton()->get_datetime(p_utc);
+ return vformat("%02d:%02d:%02d", dt.hour, dt.minute, dt.second);
}
Dictionary Time::get_time_zone_from_system() const {
diff --git a/core/register_core_types.cpp b/core/register_core_types.cpp
index 1b3f11ffab..6650d9be23 100644
--- a/core/register_core_types.cpp
+++ b/core/register_core_types.cpp
@@ -284,8 +284,8 @@ void register_core_settings() {
ProjectSettings::get_singleton()->set_custom_property_info("network/limits/tcp/connect_timeout_seconds", PropertyInfo(Variant::INT, "network/limits/tcp/connect_timeout_seconds", PROPERTY_HINT_RANGE, "1,1800,1"));
GLOBAL_DEF_RST("network/limits/packet_peer_stream/max_buffer_po2", (16));
ProjectSettings::get_singleton()->set_custom_property_info("network/limits/packet_peer_stream/max_buffer_po2", PropertyInfo(Variant::INT, "network/limits/packet_peer_stream/max_buffer_po2", PROPERTY_HINT_RANGE, "0,64,1,or_greater"));
- GLOBAL_DEF("network/ssl/certificate_bundle_override", "");
- ProjectSettings::get_singleton()->set_custom_property_info("network/ssl/certificate_bundle_override", PropertyInfo(Variant::STRING, "network/ssl/certificate_bundle_override", PROPERTY_HINT_FILE, "*.crt"));
+ GLOBAL_DEF("network/tls/certificate_bundle_override", "");
+ ProjectSettings::get_singleton()->set_custom_property_info("network/tls/certificate_bundle_override", PropertyInfo(Variant::STRING, "network/tls/certificate_bundle_override", PROPERTY_HINT_FILE, "*.crt"));
int worker_threads = GLOBAL_DEF("threading/worker_pool/max_threads", -1);
bool low_priority_use_system_threads = GLOBAL_DEF("threading/worker_pool/use_system_threads_for_low_priority_tasks", true);