summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/config/engine.cpp10
-rw-r--r--core/config/engine.h5
-rw-r--r--core/input/input_event.cpp34
-rw-r--r--core/input/input_event.h6
-rw-r--r--core/input/input_map.cpp4
-rw-r--r--core/input/input_map.h2
-rw-r--r--core/io/resource.cpp8
-rw-r--r--doc/classes/InputEventWithModifiers.xml4
-rw-r--r--doc/classes/SceneTree.xml2
-rw-r--r--editor/plugins/node_3d_editor_plugin.cpp2
-rw-r--r--main/main.cpp2
-rw-r--r--platform/android/export/export.cpp9
-rw-r--r--servers/rendering/rasterizer_rd/rasterizer_scene_rd.cpp4
13 files changed, 76 insertions, 16 deletions
diff --git a/core/config/engine.cpp b/core/config/engine.cpp
index b0037ffb37..8e2ab094b0 100644
--- a/core/config/engine.cpp
+++ b/core/config/engine.cpp
@@ -219,3 +219,13 @@ Engine *Engine::get_singleton() {
Engine::Engine() {
singleton = this;
}
+
+Engine::Singleton::Singleton(const StringName &p_name, Object *p_ptr) :
+ name(p_name),
+ ptr(p_ptr) {
+#ifdef DEBUG_ENABLED
+ if (Object::cast_to<Reference>(p_ptr)) {
+ ERR_PRINT("A class intended to be used as a singleton must *not* inherit from Reference.");
+ }
+#endif
+}
diff --git a/core/config/engine.h b/core/config/engine.h
index 1d3d963b39..0d9aa02f28 100644
--- a/core/config/engine.h
+++ b/core/config/engine.h
@@ -41,10 +41,7 @@ public:
struct Singleton {
StringName name;
Object *ptr;
- Singleton(const StringName &p_name = StringName(), Object *p_ptr = nullptr) :
- name(p_name),
- ptr(p_ptr) {
- }
+ Singleton(const StringName &p_name = StringName(), Object *p_ptr = nullptr);
};
private:
diff --git a/core/input/input_event.cpp b/core/input/input_event.cpp
index 31ce1bb892..41bc5e84b0 100644
--- a/core/input/input_event.cpp
+++ b/core/input/input_event.cpp
@@ -143,6 +143,14 @@ int64_t InputEventFromWindow::get_window_id() const {
///////////////////////////////////
+void InputEventWithModifiers::set_store_command(bool p_enabled) {
+ store_command = p_enabled;
+}
+
+bool InputEventWithModifiers::is_storing_command() const {
+ return store_command;
+}
+
void InputEventWithModifiers::set_shift(bool p_enabled) {
shift = p_enabled;
}
@@ -191,6 +199,9 @@ void InputEventWithModifiers::set_modifiers_from_event(const InputEventWithModif
}
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_alt", "enable"), &InputEventWithModifiers::set_alt);
ClassDB::bind_method(D_METHOD("get_alt"), &InputEventWithModifiers::get_alt);
@@ -206,6 +217,7 @@ void InputEventWithModifiers::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_command", "enable"), &InputEventWithModifiers::set_command);
ClassDB::bind_method(D_METHOD("get_command"), &InputEventWithModifiers::get_command);
+ ADD_PROPERTY(PropertyInfo(Variant::BOOL, "store_command"), "set_store_command", "is_storing_command");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "alt"), "set_alt", "get_alt");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "shift"), "set_shift", "get_shift");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "control"), "set_control", "get_control");
@@ -213,6 +225,28 @@ void InputEventWithModifiers::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "command"), "set_command", "get_command");
}
+void InputEventWithModifiers::_validate_property(PropertyInfo &property) const {
+ if (store_command) {
+ // If we only want to Store "Command".
+#ifdef APPLE_STYLE_KEYS
+ // Don't store "Meta" on Mac.
+ if (property.name == "meta") {
+ property.usage ^= PROPERTY_USAGE_STORAGE;
+ }
+#else
+ // Don't store "Control".
+ if (property.name == "control") {
+ property.usage ^= PROPERTY_USAGE_STORAGE;
+ }
+#endif
+ } else {
+ // We don't want to store command, only control or meta (on mac).
+ if (property.name == "command") {
+ property.usage ^= PROPERTY_USAGE_STORAGE;
+ }
+ }
+}
+
///////////////////////////////////
void InputEventKey::set_pressed(bool p_pressed) {
diff --git a/core/input/input_event.h b/core/input/input_event.h
index dc86bddf8e..52b785c9a1 100644
--- a/core/input/input_event.h
+++ b/core/input/input_event.h
@@ -208,6 +208,8 @@ public:
class InputEventWithModifiers : public InputEventFromWindow {
GDCLASS(InputEventWithModifiers, InputEventFromWindow);
+ bool store_command = true;
+
bool shift = false;
bool alt = false;
#ifdef APPLE_STYLE_KEYS
@@ -227,8 +229,12 @@ class InputEventWithModifiers : public InputEventFromWindow {
protected:
static void _bind_methods();
+ virtual void _validate_property(PropertyInfo &property) const override;
public:
+ void set_store_command(bool p_enabled);
+ bool is_storing_command() const;
+
void set_shift(bool p_enabled);
bool get_shift() const;
diff --git a/core/input/input_map.cpp b/core/input/input_map.cpp
index 9fd5476f51..979809c7af 100644
--- a/core/input/input_map.cpp
+++ b/core/input/input_map.cpp
@@ -51,7 +51,7 @@ void InputMap::_bind_methods() {
ClassDB::bind_method(D_METHOD("action_erase_events", "action"), &InputMap::action_erase_events);
ClassDB::bind_method(D_METHOD("action_get_events", "action"), &InputMap::_action_get_events);
ClassDB::bind_method(D_METHOD("event_is_action", "event", "action"), &InputMap::event_is_action);
- ClassDB::bind_method(D_METHOD("load_from_globals"), &InputMap::load_from_globals);
+ ClassDB::bind_method(D_METHOD("load_from_project_settings"), &InputMap::load_from_project_settings);
}
void InputMap::add_action(const StringName &p_action, float p_deadzone) {
@@ -228,7 +228,7 @@ const Map<StringName, InputMap::Action> &InputMap::get_action_map() const {
return input_map;
}
-void InputMap::load_from_globals() {
+void InputMap::load_from_project_settings() {
input_map.clear();
List<PropertyInfo> pinfo;
diff --git a/core/input/input_map.h b/core/input/input_map.h
index 019a1056fb..948d78ebdd 100644
--- a/core/input/input_map.h
+++ b/core/input/input_map.h
@@ -82,7 +82,7 @@ public:
bool event_get_action_status(const Ref<InputEvent> &p_event, const StringName &p_action, bool *p_pressed = nullptr, float *p_strength = nullptr, float *p_raw_strength = nullptr) const;
const Map<StringName, Action> &get_action_map() const;
- void load_from_globals();
+ void load_from_project_settings();
void load_default();
InputMap();
diff --git a/core/io/resource.cpp b/core/io/resource.cpp
index 08f5021889..58ab9a8cde 100644
--- a/core/io/resource.cpp
+++ b/core/io/resource.cpp
@@ -147,8 +147,8 @@ Ref<Resource> Resource::duplicate_for_local_scene(Node *p_for_scene, Map<Ref<Res
List<PropertyInfo> plist;
get_property_list(&plist);
- Resource *r = Object::cast_to<Resource>(ClassDB::instance(get_class()));
- ERR_FAIL_COND_V(!r, Ref<Resource>());
+ Ref<Resource> r = Object::cast_to<Resource>(ClassDB::instance(get_class()));
+ ERR_FAIL_COND_V(r.is_null(), Ref<Resource>());
r->local_scene = p_for_scene;
@@ -175,9 +175,7 @@ Ref<Resource> Resource::duplicate_for_local_scene(Node *p_for_scene, Map<Ref<Res
r->set(E->get().name, p);
}
- RES res = Ref<Resource>(r);
-
- return res;
+ return r;
}
void Resource::configure_for_local_scene(Node *p_for_scene, Map<Ref<Resource>, Ref<Resource>> &remap_cache) {
diff --git a/doc/classes/InputEventWithModifiers.xml b/doc/classes/InputEventWithModifiers.xml
index 667879a922..dd782209e5 100644
--- a/doc/classes/InputEventWithModifiers.xml
+++ b/doc/classes/InputEventWithModifiers.xml
@@ -27,6 +27,10 @@
<member name="shift" type="bool" setter="set_shift" getter="get_shift" default="false">
State of the [kbd]Shift[/kbd] modifier.
</member>
+ <member name="store_command" type="bool" setter="set_store_command" getter="is_storing_command" default="true">
+ If [code]true[/code], pressing [kbd]Cmd[/kbd] on macOS or [kbd]Ctrl[/kbd] on all other platforms will both be serialized as [member command]. If [code]false[/code], those same keys will be serialized as [member meta] on macOS and [member control] on all other platforms.
+ This aids with cross-platform compatibility when developing e.g. on Windows for macOS, or vice-versa.
+ </member>
</members>
<constants>
</constants>
diff --git a/doc/classes/SceneTree.xml b/doc/classes/SceneTree.xml
index 4ea457047f..a95ce6c663 100644
--- a/doc/classes/SceneTree.xml
+++ b/doc/classes/SceneTree.xml
@@ -181,7 +181,7 @@
<argument index="0" name="exit_code" type="int" default="-1">
</argument>
<description>
- Quits the application. A process [code]exit_code[/code] can optionally be passed as an argument. If this argument is [code]0[/code] or greater, it will override the [member OS.exit_code] defined before quitting the application.
+ Quits the application at the end of the current iteration. A process [code]exit_code[/code] can optionally be passed as an argument. If this argument is [code]0[/code] or greater, it will override the [member OS.exit_code] defined before quitting the application.
</description>
</method>
<method name="reload_current_scene">
diff --git a/editor/plugins/node_3d_editor_plugin.cpp b/editor/plugins/node_3d_editor_plugin.cpp
index 28acb26012..fa7300c930 100644
--- a/editor/plugins/node_3d_editor_plugin.cpp
+++ b/editor/plugins/node_3d_editor_plugin.cpp
@@ -5013,6 +5013,8 @@ void Node3DEditor::_menu_item_pressed(int p_option) {
}
}
}
+ _finish_grid();
+ _init_grid();
view_menu->get_popup()->set_item_checked(view_menu->get_popup()->get_item_index(p_option), grid_enabled);
diff --git a/main/main.cpp b/main/main.cpp
index 09f16e9d75..82be327cbb 100644
--- a/main/main.cpp
+++ b/main/main.cpp
@@ -1143,7 +1143,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
use_custom_res = false;
input_map->load_default(); //keys for editor
} else {
- input_map->load_from_globals(); //keys for game
+ input_map->load_from_project_settings(); //keys for game
}
if (bool(ProjectSettings::get_singleton()->get("application/run/disable_stdout"))) {
diff --git a/platform/android/export/export.cpp b/platform/android/export/export.cpp
index 53b43ae0e8..35a7c54a8f 100644
--- a/platform/android/export/export.cpp
+++ b/platform/android/export/export.cpp
@@ -2269,6 +2269,13 @@ public:
Error _zip_align_project(const String &sdk_path, const String &unaligned_file_path, const String &aligned_file_path) {
// Look for the zipalign tool.
+ String zipalign_command_name;
+#ifdef WINDOWS_ENABLED
+ zipalign_command_name = "zipalign.exe";
+#else
+ zipalign_command_name = "zipalign";
+#endif
+
String zipalign_command;
Error errn;
String build_tools_dir = sdk_path.plus_file("build-tools");
@@ -2283,7 +2290,7 @@ public:
while (!sub_dir.empty()) {
if (!sub_dir.begins_with(".") && da->current_is_dir()) {
// Check if the tool is here.
- String tool_path = build_tools_dir.plus_file(sub_dir).plus_file("zipalign");
+ String tool_path = build_tools_dir.plus_file(sub_dir).plus_file(zipalign_command_name);
if (FileAccess::exists(tool_path)) {
zipalign_command = tool_path;
break;
diff --git a/servers/rendering/rasterizer_rd/rasterizer_scene_rd.cpp b/servers/rendering/rasterizer_rd/rasterizer_scene_rd.cpp
index e1be9b0ef4..da2b00b7a7 100644
--- a/servers/rendering/rasterizer_rd/rasterizer_scene_rd.cpp
+++ b/servers/rendering/rasterizer_rd/rasterizer_scene_rd.cpp
@@ -1471,7 +1471,9 @@ void RasterizerSceneRD::_setup_giprobes(RID p_render_buffers, const Transform &p
}
if (giprobes_changed) {
- RD::get_singleton()->free(rb->gi_uniform_set);
+ if (RD::get_singleton()->uniform_set_is_valid(rb->gi_uniform_set)) {
+ RD::get_singleton()->free(rb->gi_uniform_set);
+ }
rb->gi_uniform_set = RID();
if (rb->volumetric_fog) {
if (RD::get_singleton()->uniform_set_is_valid(rb->volumetric_fog->uniform_set)) {