diff options
28 files changed, 158 insertions, 375 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/core_constants.cpp b/core/core_constants.cpp index 4229436e84..64bfff1c58 100644 --- a/core/core_constants.cpp +++ b/core/core_constants.cpp @@ -409,7 +409,7 @@ void register_global_constants() { BIND_CORE_ENUM_CONSTANT(BUTTON_MASK_XBUTTON2); // Joypad buttons - BIND_CORE_ENUM_CONSTANT(JOY_INVALID_BUTTON); + BIND_CORE_ENUM_CONSTANT(JOY_BUTTON_INVALID); BIND_CORE_ENUM_CONSTANT(JOY_BUTTON_A); BIND_CORE_ENUM_CONSTANT(JOY_BUTTON_B); BIND_CORE_ENUM_CONSTANT(JOY_BUTTON_X); @@ -425,51 +425,18 @@ void register_global_constants() { BIND_CORE_ENUM_CONSTANT(JOY_BUTTON_DPAD_DOWN); BIND_CORE_ENUM_CONSTANT(JOY_BUTTON_DPAD_LEFT); BIND_CORE_ENUM_CONSTANT(JOY_BUTTON_DPAD_RIGHT); - BIND_CORE_ENUM_CONSTANT(JOY_SDL_BUTTONS); - BIND_CORE_ENUM_CONSTANT(JOY_SONY_X); - BIND_CORE_ENUM_CONSTANT(JOY_SONY_CROSS); - BIND_CORE_ENUM_CONSTANT(JOY_SONY_CIRCLE); - BIND_CORE_ENUM_CONSTANT(JOY_SONY_SQUARE); - BIND_CORE_ENUM_CONSTANT(JOY_SONY_TRIANGLE); - BIND_CORE_ENUM_CONSTANT(JOY_SONY_SELECT); - BIND_CORE_ENUM_CONSTANT(JOY_SONY_START); - BIND_CORE_ENUM_CONSTANT(JOY_SONY_PS); - BIND_CORE_ENUM_CONSTANT(JOY_SONY_L1); - BIND_CORE_ENUM_CONSTANT(JOY_SONY_R1); - BIND_CORE_ENUM_CONSTANT(JOY_SONY_L3); - BIND_CORE_ENUM_CONSTANT(JOY_SONY_R3); - BIND_CORE_ENUM_CONSTANT(JOY_XBOX_A); - BIND_CORE_ENUM_CONSTANT(JOY_XBOX_B); - BIND_CORE_ENUM_CONSTANT(JOY_XBOX_X); - BIND_CORE_ENUM_CONSTANT(JOY_XBOX_Y); - BIND_CORE_ENUM_CONSTANT(JOY_XBOX_BACK); - BIND_CORE_ENUM_CONSTANT(JOY_XBOX_START); - BIND_CORE_ENUM_CONSTANT(JOY_XBOX_HOME); - BIND_CORE_ENUM_CONSTANT(JOY_XBOX_LS); - BIND_CORE_ENUM_CONSTANT(JOY_XBOX_RS); - BIND_CORE_ENUM_CONSTANT(JOY_XBOX_LB); - BIND_CORE_ENUM_CONSTANT(JOY_XBOX_RB); + BIND_CORE_ENUM_CONSTANT(JOY_BUTTON_SDL_MAX); BIND_CORE_ENUM_CONSTANT(JOY_BUTTON_MAX); // Joypad axes - BIND_CORE_ENUM_CONSTANT(JOY_INVALID_AXIS); + BIND_CORE_ENUM_CONSTANT(JOY_AXIS_INVALID); BIND_CORE_ENUM_CONSTANT(JOY_AXIS_LEFT_X); BIND_CORE_ENUM_CONSTANT(JOY_AXIS_LEFT_Y); BIND_CORE_ENUM_CONSTANT(JOY_AXIS_RIGHT_X); BIND_CORE_ENUM_CONSTANT(JOY_AXIS_RIGHT_Y); BIND_CORE_ENUM_CONSTANT(JOY_AXIS_TRIGGER_LEFT); BIND_CORE_ENUM_CONSTANT(JOY_AXIS_TRIGGER_RIGHT); - BIND_CORE_ENUM_CONSTANT(JOY_SDL_AXES); - BIND_CORE_ENUM_CONSTANT(JOY_AXIS_0_X); - BIND_CORE_ENUM_CONSTANT(JOY_AXIS_0_Y); - BIND_CORE_ENUM_CONSTANT(JOY_AXIS_1_X); - BIND_CORE_ENUM_CONSTANT(JOY_AXIS_1_Y); - BIND_CORE_ENUM_CONSTANT(JOY_AXIS_2_X); - BIND_CORE_ENUM_CONSTANT(JOY_AXIS_2_Y); - BIND_CORE_ENUM_CONSTANT(JOY_AXIS_3_X); - BIND_CORE_ENUM_CONSTANT(JOY_AXIS_3_Y); - BIND_CORE_ENUM_CONSTANT(JOY_AXIS_4_X); - BIND_CORE_ENUM_CONSTANT(JOY_AXIS_4_Y); + BIND_CORE_ENUM_CONSTANT(JOY_AXIS_SDL_MAX); BIND_CORE_ENUM_CONSTANT(JOY_AXIS_MAX); // midi diff --git a/core/input/input.cpp b/core/input/input.cpp index aa64ac09a7..00a7e63a73 100644 --- a/core/input/input.cpp +++ b/core/input/input.cpp @@ -39,7 +39,7 @@ #include "editor/editor_settings.h" #endif -static const char *_joy_buttons[JOY_SDL_BUTTONS + 1] = { +static const char *_joy_buttons[JOY_BUTTON_SDL_MAX] = { "a", "b", "x", @@ -55,69 +55,15 @@ static const char *_joy_buttons[JOY_SDL_BUTTONS + 1] = { "dpdown", "dpleft", "dpright", - nullptr }; -static const char *_joy_button_names[JOY_BUTTON_MAX] = { - "Face Bottom", - "Face Right", - "Face Left", - "Face Top", - "Select", - "Guide", - "Start", - "Left Stick", - "Right Stick", - "Left Shoulder", - "Right Shoulder", - "D-Pad Up", - "D-Pad Down", - "D-Pad Left", - "D-Pad Right", - "Button 15", - "Button 16", - "Button 17", - "Button 18", - "Button 19", - "Button 20", - "Button 21", - "Button 22", - "Button 23", - "Button 24", - "Button 25", - "Button 26", - "Button 27", - "Button 28", - "Button 29", - "Button 30", - "Button 31", - "Button 32", - "Button 33", - "Button 34", - "Button 35" -}; - -static const char *_joy_axes[JOY_SDL_AXES + 1] = { +static const char *_joy_axes[JOY_AXIS_SDL_MAX] = { "leftx", "lefty", "rightx", "righty", "lefttrigger", "righttrigger", - nullptr -}; - -static const char *_joy_axis_names[JOY_AXIS_MAX] = { - "Left Stick X", - "Left Stick Y", - "Right Stick X", - "Right Stick Y", - "Left Trigger", - "Right Trigger", - "Joystick 3 Stick X", - "Joystick 3 Stick Y", - "Joystick 4 Stick X", - "Joystick 4 Stick Y" }; Input *Input::singleton = nullptr; @@ -162,10 +108,6 @@ void Input::_bind_methods() { ClassDB::bind_method(D_METHOD("get_connected_joypads"), &Input::get_connected_joypads); ClassDB::bind_method(D_METHOD("get_joy_vibration_strength", "device"), &Input::get_joy_vibration_strength); ClassDB::bind_method(D_METHOD("get_joy_vibration_duration", "device"), &Input::get_joy_vibration_duration); - ClassDB::bind_method(D_METHOD("get_joy_button_string", "button_index"), &Input::get_joy_button_string); - ClassDB::bind_method(D_METHOD("get_joy_button_index_from_string", "button"), &Input::get_joy_button_index_from_string); - ClassDB::bind_method(D_METHOD("get_joy_axis_string", "axis_index"), &Input::get_joy_axis_string); - ClassDB::bind_method(D_METHOD("get_joy_axis_index_from_string", "axis"), &Input::get_joy_axis_index_from_string); ClassDB::bind_method(D_METHOD("start_joy_vibration", "device", "weak_magnitude", "strong_magnitude", "duration"), &Input::start_joy_vibration, DEFVAL(0)); ClassDB::bind_method(D_METHOD("stop_joy_vibration", "device"), &Input::stop_joy_vibration); ClassDB::bind_method(D_METHOD("vibrate_handheld", "duration_ms"), &Input::vibrate_handheld, DEFVAL(500)); @@ -1226,21 +1168,21 @@ void Input::_get_mapped_hat_events(const JoyDeviceMapping &mapping, int p_hat, J } JoyButtonList Input::_get_output_button(String output) { - for (int i = 0; _joy_buttons[i]; i++) { + for (int i = 0; i < JOY_BUTTON_SDL_MAX; i++) { if (output == _joy_buttons[i]) { return JoyButtonList(i); } } - return JoyButtonList::JOY_INVALID_BUTTON; + return JoyButtonList::JOY_BUTTON_INVALID; } JoyAxisList Input::_get_output_axis(String output) { - for (int i = 0; _joy_axes[i]; i++) { + for (int i = 0; i < JOY_AXIS_SDL_MAX; i++) { if (output == _joy_axes[i]) { return JoyAxisList(i); } } - return JoyAxisList::JOY_INVALID_AXIS; + return JoyAxisList::JOY_AXIS_INVALID; } void Input::parse_mapping(String p_mapping) { @@ -1300,16 +1242,16 @@ void Input::parse_mapping(String p_mapping) { JoyButtonList output_button = _get_output_button(output); JoyAxisList output_axis = _get_output_axis(output); - ERR_CONTINUE_MSG(output_button == JOY_INVALID_BUTTON && output_axis == JOY_INVALID_AXIS, + ERR_CONTINUE_MSG(output_button == JOY_BUTTON_INVALID && output_axis == JOY_AXIS_INVALID, String(entry[idx] + "\nUnrecognised output string: " + output)); - ERR_CONTINUE_MSG(output_button != JOY_INVALID_BUTTON && output_axis != JOY_INVALID_AXIS, + ERR_CONTINUE_MSG(output_button != JOY_BUTTON_INVALID && output_axis != JOY_AXIS_INVALID, String("BUG: Output string matched both button and axis: " + output)); JoyBinding binding; - if (output_button != JOY_INVALID_BUTTON) { + if (output_button != JOY_BUTTON_INVALID) { binding.outputType = TYPE_BUTTON; binding.output.button = output_button; - } else if (output_axis != JOY_INVALID_AXIS) { + } else if (output_axis != JOY_AXIS_INVALID) { binding.outputType = TYPE_AXIS; binding.output.axis.axis = output_axis; binding.output.axis.range = output_range; @@ -1401,20 +1343,6 @@ Array Input::get_connected_joypads() { return ret; } -String Input::get_joy_button_string(int p_button) { - ERR_FAIL_INDEX_V(p_button, JOY_BUTTON_MAX, "Invalid button"); - return _joy_button_names[p_button]; -} - -int Input::get_joy_button_index_from_string(String p_button) { - for (int i = 0; i < JOY_BUTTON_MAX; i++) { - if (p_button == _joy_button_names[i]) { - return i; - } - } - ERR_FAIL_V(JOY_INVALID_BUTTON); -} - int Input::get_unused_joy_id() { for (int i = 0; i < JOYPADS_MAX; i++) { if (!joy_names.has(i) || !joy_names[i].connected) { @@ -1424,20 +1352,6 @@ int Input::get_unused_joy_id() { return -1; } -String Input::get_joy_axis_string(int p_axis) { - ERR_FAIL_INDEX_V(p_axis, JOY_AXIS_MAX, "Invalid axis"); - return _joy_axis_names[p_axis]; -} - -int Input::get_joy_axis_index_from_string(String p_axis) { - for (int i = 0; i < JOY_AXIS_MAX; i++) { - if (p_axis == _joy_axis_names[i]) { - return i; - } - } - ERR_FAIL_V(JOY_INVALID_AXIS); -} - Input::Input() { singleton = this; diff --git a/core/input/input.h b/core/input/input.h index 46e9d24bf2..1b2df49ac0 100644 --- a/core/input/input.h +++ b/core/input/input.h @@ -330,11 +330,6 @@ public: void add_joy_mapping(String p_mapping, bool p_update_existing = false); void remove_joy_mapping(String p_guid); - String get_joy_button_string(int p_button); - String get_joy_axis_string(int p_axis); - int get_joy_axis_index_from_string(String p_axis); - int get_joy_button_index_from_string(String p_button); - int get_unused_joy_id(); bool is_joy_known(int p_device); 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..0eae3a2bbe 100644 --- a/core/input/input_event.h +++ b/core/input/input_event.h @@ -60,9 +60,7 @@ enum ButtonList { }; enum JoyButtonList { - JOY_INVALID_BUTTON = -1, - - // SDL Buttons + JOY_BUTTON_INVALID = -1, JOY_BUTTON_A = 0, JOY_BUTTON_B = 1, JOY_BUTTON_X = 2, @@ -78,63 +76,20 @@ enum JoyButtonList { JOY_BUTTON_DPAD_DOWN = 12, JOY_BUTTON_DPAD_LEFT = 13, JOY_BUTTON_DPAD_RIGHT = 14, - JOY_SDL_BUTTONS = 15, - - // Sony Buttons - JOY_SONY_X = JOY_BUTTON_A, - JOY_SONY_CROSS = JOY_BUTTON_A, - JOY_SONY_CIRCLE = JOY_BUTTON_B, - JOY_SONY_SQUARE = JOY_BUTTON_X, - JOY_SONY_TRIANGLE = JOY_BUTTON_Y, - JOY_SONY_SELECT = JOY_BUTTON_BACK, - JOY_SONY_START = JOY_BUTTON_START, - JOY_SONY_PS = JOY_BUTTON_GUIDE, - JOY_SONY_L1 = JOY_BUTTON_LEFT_SHOULDER, - JOY_SONY_R1 = JOY_BUTTON_RIGHT_SHOULDER, - JOY_SONY_L3 = JOY_BUTTON_LEFT_STICK, - JOY_SONY_R3 = JOY_BUTTON_RIGHT_STICK, - - // Xbox Buttons - JOY_XBOX_A = JOY_BUTTON_A, - JOY_XBOX_B = JOY_BUTTON_B, - JOY_XBOX_X = JOY_BUTTON_X, - JOY_XBOX_Y = JOY_BUTTON_Y, - JOY_XBOX_BACK = JOY_BUTTON_BACK, - JOY_XBOX_START = JOY_BUTTON_START, - JOY_XBOX_HOME = JOY_BUTTON_GUIDE, - JOY_XBOX_LS = JOY_BUTTON_LEFT_STICK, - JOY_XBOX_RS = JOY_BUTTON_RIGHT_STICK, - JOY_XBOX_LB = JOY_BUTTON_LEFT_SHOULDER, - JOY_XBOX_RB = JOY_BUTTON_RIGHT_SHOULDER, - - JOY_BUTTON_MAX = 36 // Apparently Android supports up to 36 buttons. + JOY_BUTTON_SDL_MAX = 15, + JOY_BUTTON_MAX = 36, // Android supports up to 36 buttons. }; enum JoyAxisList { - JOY_INVALID_AXIS = -1, - - // SDL Axes + JOY_AXIS_INVALID = -1, JOY_AXIS_LEFT_X = 0, JOY_AXIS_LEFT_Y = 1, JOY_AXIS_RIGHT_X = 2, JOY_AXIS_RIGHT_Y = 3, JOY_AXIS_TRIGGER_LEFT = 4, JOY_AXIS_TRIGGER_RIGHT = 5, - JOY_SDL_AXES = 6, - - // Joystick axes. - JOY_AXIS_0_X = 0, - JOY_AXIS_0_Y = 1, - JOY_AXIS_1_X = 2, - JOY_AXIS_1_Y = 3, - JOY_AXIS_2_X = 4, - JOY_AXIS_2_Y = 5, - JOY_AXIS_3_X = 6, - JOY_AXIS_3_Y = 7, - JOY_AXIS_4_X = 8, - JOY_AXIS_4_Y = 9, - - JOY_AXIS_MAX = 10 // OpenVR supports up to 5 Joysticks making a total of 10 axes. + JOY_AXIS_SDL_MAX = 6, + JOY_AXIS_MAX = 10, // OpenVR supports up to 5 Joysticks making a total of 10 axes. }; enum MidiMessageList { @@ -208,6 +163,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 +184,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/@GlobalScope.xml b/doc/classes/@GlobalScope.xml index f6b1bb4d7c..f6b8e0da19 100644 --- a/doc/classes/@GlobalScope.xml +++ b/doc/classes/@GlobalScope.xml @@ -2093,130 +2093,61 @@ <constant name="BUTTON_MASK_XBUTTON2" value="256" enum="ButtonList"> Extra mouse button 2 mask. </constant> - <constant name="JOY_INVALID_BUTTON" value="-1" enum="JoyButtonList"> + <constant name="JOY_BUTTON_INVALID" value="-1" enum="JoyButtonList"> An invalid game controller button. </constant> <constant name="JOY_BUTTON_A" value="0" enum="JoyButtonList"> - Game controller SDL button A. + Game controller SDL button A. Corresponds to the bottom action button: Sony Cross, Xbox A, Nintendo B. </constant> <constant name="JOY_BUTTON_B" value="1" enum="JoyButtonList"> - Game controller SDL button B. + Game controller SDL button B. Corresponds to the right action button: Sony Circle, Xbox B, Nintendo A. </constant> <constant name="JOY_BUTTON_X" value="2" enum="JoyButtonList"> - Game controller SDL button X. + Game controller SDL button X. Corresponds to the left action button: Sony Square, Xbox X, Nintendo Y. </constant> <constant name="JOY_BUTTON_Y" value="3" enum="JoyButtonList"> - Game controller SDL button Y. + Game controller SDL button Y. Corresponds to the top action button: Sony Triangle, Xbox Y, Nintendo X. </constant> <constant name="JOY_BUTTON_BACK" value="4" enum="JoyButtonList"> - Game controller SDL back button. + Game controller SDL back button. Corresponds to the Sony Select, Xbox Back, Nintendo - button. </constant> <constant name="JOY_BUTTON_GUIDE" value="5" enum="JoyButtonList"> - Game controller SDL guide button. + Game controller SDL guide button. Corresponds to the Sony PS, Xbox Home button. </constant> <constant name="JOY_BUTTON_START" value="6" enum="JoyButtonList"> - Game controller SDL start button. + Game controller SDL start button. Corresponds to the Nintendo + button. </constant> <constant name="JOY_BUTTON_LEFT_STICK" value="7" enum="JoyButtonList"> - Game controller SDL left stick button. + Game controller SDL left stick button. Corresponds to the Sony L3, Xbox L/LS button. </constant> <constant name="JOY_BUTTON_RIGHT_STICK" value="8" enum="JoyButtonList"> - Game controller SDL right stick button. + Game controller SDL right stick button. Corresponds to the Sony R3, Xbox R/RS button. </constant> <constant name="JOY_BUTTON_LEFT_SHOULDER" value="9" enum="JoyButtonList"> - Game controller SDL left shoulder button. + Game controller SDL left shoulder button. Corresponds to the Sony L1, Xbox LB button. </constant> <constant name="JOY_BUTTON_RIGHT_SHOULDER" value="10" enum="JoyButtonList"> - Game controller SDL right shoulder button. + Game controller SDL right shoulder button. Corresponds to the Sony R1, Xbox RB button. </constant> <constant name="JOY_BUTTON_DPAD_UP" value="11" enum="JoyButtonList"> - Game controller SDL D-pad up button. + Game controller D-pad up button. </constant> <constant name="JOY_BUTTON_DPAD_DOWN" value="12" enum="JoyButtonList"> - Game controller SDL D-pad down button. + Game controller D-pad down button. </constant> <constant name="JOY_BUTTON_DPAD_LEFT" value="13" enum="JoyButtonList"> - Game controller SDL D-pad left button. + Game controller D-pad left button. </constant> <constant name="JOY_BUTTON_DPAD_RIGHT" value="14" enum="JoyButtonList"> - Game controller SDL D-pad right button. + Game controller D-pad right button. </constant> - <constant name="JOY_SDL_BUTTONS" value="15" enum="JoyButtonList"> + <constant name="JOY_BUTTON_SDL_MAX" value="15" enum="JoyButtonList"> The number of SDL game controller buttons. </constant> - <constant name="JOY_SONY_X" value="0" enum="JoyButtonList"> - Sony DualShock controller X button maps to SDL button A. - </constant> - <constant name="JOY_SONY_CROSS" value="0" enum="JoyButtonList"> - Sony DualShock controller cross button maps to SDL button A. - </constant> - <constant name="JOY_SONY_CIRCLE" value="1" enum="JoyButtonList"> - Sony DualShock controller circle button maps to SDL button B. - </constant> - <constant name="JOY_SONY_SQUARE" value="2" enum="JoyButtonList"> - Sony DualShock controller square button maps to SDL button X. - </constant> - <constant name="JOY_SONY_TRIANGLE" value="3" enum="JoyButtonList"> - Sony DualShock controller triangle button maps to SDL button Y. - </constant> - <constant name="JOY_SONY_SELECT" value="4" enum="JoyButtonList"> - Sony DualShock controller select button maps to SDL back button. - </constant> - <constant name="JOY_SONY_START" value="6" enum="JoyButtonList"> - Sony DualShock controller start button maps to SDL start button. - </constant> - <constant name="JOY_SONY_PS" value="5" enum="JoyButtonList"> - Sony DualShock controller PS button maps to SDL guide button. - </constant> - <constant name="JOY_SONY_L1" value="9" enum="JoyButtonList"> - Sony DualShock controller L1 button maps to SDL left shoulder button. - </constant> - <constant name="JOY_SONY_R1" value="10" enum="JoyButtonList"> - Sony DualShock controller R1 button maps to SDL right shoulder button. - </constant> - <constant name="JOY_SONY_L3" value="7" enum="JoyButtonList"> - Sony DualShock controller L3 button maps to SDL left stick button. - </constant> - <constant name="JOY_SONY_R3" value="8" enum="JoyButtonList"> - Sony DualShock controller R3 button maps to SDL right stick button. - </constant> - <constant name="JOY_XBOX_A" value="0" enum="JoyButtonList"> - Xbox game controller A button maps to SDL button A. - </constant> - <constant name="JOY_XBOX_B" value="1" enum="JoyButtonList"> - Xbox game controller B button maps to SDL button B. - </constant> - <constant name="JOY_XBOX_X" value="2" enum="JoyButtonList"> - Xbox game controller X button maps to SDL button X. - </constant> - <constant name="JOY_XBOX_Y" value="3" enum="JoyButtonList"> - Xbox game controller Y button maps to SDL button Y. - </constant> - <constant name="JOY_XBOX_BACK" value="4" enum="JoyButtonList"> - Xbox game controller back button maps to SDL back button. - </constant> - <constant name="JOY_XBOX_START" value="6" enum="JoyButtonList"> - Xbox game controller start button maps to SDL start button. - </constant> - <constant name="JOY_XBOX_HOME" value="5" enum="JoyButtonList"> - Xbox game controller home button maps to SDL guide button. - </constant> - <constant name="JOY_XBOX_LS" value="7" enum="JoyButtonList"> - Xbox game controller left stick button maps to SDL left stick button. - </constant> - <constant name="JOY_XBOX_RS" value="8" enum="JoyButtonList"> - Xbox game controller right stick button maps to SDL right stick button. - </constant> - <constant name="JOY_XBOX_LB" value="9" enum="JoyButtonList"> - Xbox game controller left bumper button maps to SDL left shoulder button. - </constant> - <constant name="JOY_XBOX_RB" value="10" enum="JoyButtonList"> - Xbox game controller right bumper button maps to SDL right shoulder button. - </constant> <constant name="JOY_BUTTON_MAX" value="36" enum="JoyButtonList"> - The maximum number of game controller buttons. + The maximum number of game controller buttons: Android supports up to 36 buttons. </constant> - <constant name="JOY_INVALID_AXIS" value="-1" enum="JoyAxisList"> + <constant name="JOY_AXIS_INVALID" value="-1" enum="JoyAxisList"> An invalid game controller axis. </constant> <constant name="JOY_AXIS_LEFT_X" value="0" enum="JoyAxisList"> @@ -2237,41 +2168,11 @@ <constant name="JOY_AXIS_TRIGGER_RIGHT" value="5" enum="JoyAxisList"> Game controller right trigger axis. </constant> - <constant name="JOY_SDL_AXES" value="6" enum="JoyAxisList"> + <constant name="JOY_AXIS_SDL_MAX" value="6" enum="JoyAxisList"> The number of SDL game controller axes. </constant> - <constant name="JOY_AXIS_0_X" value="0" enum="JoyAxisList"> - Game controller joystick 0 x-axis. - </constant> - <constant name="JOY_AXIS_0_Y" value="1" enum="JoyAxisList"> - Game controller joystick 0 y-axis. - </constant> - <constant name="JOY_AXIS_1_X" value="2" enum="JoyAxisList"> - Game controller joystick 1 x-axis. - </constant> - <constant name="JOY_AXIS_1_Y" value="3" enum="JoyAxisList"> - Game controller joystick 1 y-axis. - </constant> - <constant name="JOY_AXIS_2_X" value="4" enum="JoyAxisList"> - Game controller joystick 2 x-axis. - </constant> - <constant name="JOY_AXIS_2_Y" value="5" enum="JoyAxisList"> - Game controller joystick 2 y-axis. - </constant> - <constant name="JOY_AXIS_3_X" value="6" enum="JoyAxisList"> - Game controller joystick 3 x-axis. - </constant> - <constant name="JOY_AXIS_3_Y" value="7" enum="JoyAxisList"> - Game controller joystick 3 y-axis. - </constant> - <constant name="JOY_AXIS_4_X" value="8" enum="JoyAxisList"> - Game controller joystick 4 x-axis. - </constant> - <constant name="JOY_AXIS_4_Y" value="9" enum="JoyAxisList"> - Game controller joystick 4 y-axis. - </constant> <constant name="JOY_AXIS_MAX" value="10" enum="JoyAxisList"> - The maximum number of game controller axes. + The maximum number of game controller axes: OpenVR supports up to 5 Joysticks making a total of 10 axes. </constant> <constant name="MIDI_MESSAGE_NOTE_OFF" value="8" enum="MidiMessageList"> MIDI note OFF message. 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/drivers/vulkan/vulkan_context.cpp b/drivers/vulkan/vulkan_context.cpp index f56507532b..ecf9dac61b 100644 --- a/drivers/vulkan/vulkan_context.cpp +++ b/drivers/vulkan/vulkan_context.cpp @@ -302,7 +302,7 @@ Error VulkanContext::_create_physical_device() { /*flags*/ 0, /*pApplicationInfo*/ &app, /*enabledLayerCount*/ enabled_layer_count, - /*ppEnabledLayerNames*/ (const char *const *)instance_validation_layers, + /*ppEnabledLayerNames*/ (const char *const *)enabled_layers, /*enabledExtensionCount*/ enabled_extension_count, /*ppEnabledExtensionNames*/ (const char *const *)extension_names, }; diff --git a/drivers/vulkan/vulkan_context.h b/drivers/vulkan/vulkan_context.h index 26d4b76e86..62b97a7e60 100644 --- a/drivers/vulkan/vulkan_context.h +++ b/drivers/vulkan/vulkan_context.h @@ -120,7 +120,6 @@ class VulkanContext { uint32_t enabled_extension_count = 0; const char *extension_names[MAX_EXTENSIONS]; - const char **instance_validation_layers = nullptr; uint32_t enabled_layer_count = 0; const char *enabled_layers[MAX_LAYERS]; diff --git a/editor/input_map_editor.cpp b/editor/input_map_editor.cpp index c67e16d371..5b6d850096 100644 --- a/editor/input_map_editor.cpp +++ b/editor/input_map_editor.cpp @@ -35,37 +35,37 @@ #include "editor/editor_node.h" #include "editor/editor_scale.h" -static const char *_button_descriptions[JOY_SDL_BUTTONS] = { - TTRC("Face Bottom, DualShock Cross, Xbox A, Nintendo B"), - TTRC("Face Right, DualShock Circle, Xbox B, Nintendo A"), - TTRC("Face Left, DualShock Square, Xbox X, Nintendo Y"), - TTRC("Face Top, DualShock Triangle, Xbox Y, Nintendo X"), - TTRC("DualShock Select, Xbox Back, Nintendo -"), - TTRC("Home, DualShock PS, Guide"), +static const char *_button_descriptions[JOY_BUTTON_SDL_MAX] = { + TTRC("Bottom Action, Sony Cross, Xbox A, Nintendo B"), + TTRC("Right Action, Sony Circle, Xbox B, Nintendo A"), + TTRC("Left Action, Sony Square, Xbox X, Nintendo Y"), + TTRC("Top Action, Sony Triangle, Xbox Y, Nintendo X"), + TTRC("Back, Sony Select, Xbox Back, Nintendo -"), + TTRC("Guide, Sony PS, Xbox Home"), TTRC("Start, Nintendo +"), - TTRC("Left Stick, DualShock L3, Xbox L/LS"), - TTRC("Right Stick, DualShock R3, Xbox R/RS"), - TTRC("Left Shoulder, DualShock L1, Xbox LB"), - TTRC("Right Shoulder, DualShock R1, Xbox RB"), - TTRC("D-Pad Up"), - TTRC("D-Pad Down"), - TTRC("D-Pad Left"), - TTRC("D-Pad Right") + TTRC("Left Stick, Sony L3, Xbox L/LS"), + TTRC("Right Stick, Sony R3, Xbox R/RS"), + TTRC("Left Shoulder, Sony L1, Xbox LB"), + TTRC("Right Shoulder, Sony R1, Xbox RB"), + TTRC("D-pad Up"), + TTRC("D-pad Down"), + TTRC("D-pad Left"), + TTRC("D-pad Right"), }; static const char *_axis_descriptions[JOY_AXIS_MAX * 2] = { - TTRC("Left Stick Left"), - TTRC("Left Stick Right"), - TTRC("Left Stick Up"), - TTRC("Left Stick Down"), - TTRC("Right Stick Left"), - TTRC("Right Stick Right"), - TTRC("Right Stick Up"), - TTRC("Right Stick Down"), + TTRC("Left Stick Left, Joystick 0 Left"), + TTRC("Left Stick Right, Joystick 0 Right"), + TTRC("Left Stick Up, Joystick 0 Up"), + TTRC("Left Stick Down, Joystick 0 Down"), + TTRC("Right Stick Left, Joystick 1 Left"), + TTRC("Right Stick Right, Joystick 1 Right"), + TTRC("Right Stick Up, Joystick 1 Up"), + TTRC("Right Stick Down, Joystick 1 Down"), TTRC("Joystick 2 Left"), - TTRC("Joystick 2 Right, Left Trigger, L2, LT"), + TTRC("Left Trigger, L2, LT, Joystick 2 Right"), TTRC("Joystick 2 Up"), - TTRC("Joystick 2 Down, Right Trigger, R2, RT"), + TTRC("Right Trigger, R2, RT, Joystick 2 Down"), TTRC("Joystick 3 Left"), TTRC("Joystick 3 Right"), TTRC("Joystick 3 Up"), @@ -503,7 +503,7 @@ void InputMapEditor::_add_item(int p_item, Ref<InputEvent> p_exiting_event) { device_index->clear(); for (int i = 0; i < JOY_BUTTON_MAX; i++) { String desc = TTR("Button") + " " + itos(i); - if (i < JOY_SDL_BUTTONS) { + if (i < JOY_BUTTON_SDL_MAX) { desc += " (" + TTR(_button_descriptions[i]) + ")"; } device_index->add_item(desc); @@ -717,7 +717,7 @@ void InputMapEditor::_update_actions() { const int idx = jb->get_button_index(); String str = _get_device_string(jb->get_device()) + ", " + TTR("Button") + " " + itos(idx); - if (idx >= 0 && idx < JOY_SDL_BUTTONS) { + if (idx >= 0 && idx < JOY_BUTTON_SDL_MAX) { str += String() + " (" + TTR(_button_descriptions[jb->get_button_index()]) + ")"; } diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp index fc433b5e63..6acf80a2c1 100644 --- a/editor/plugins/canvas_item_editor_plugin.cpp +++ b/editor/plugins/canvas_item_editor_plugin.cpp @@ -1513,7 +1513,7 @@ bool CanvasItemEditor::_gui_input_rotate(const Ref<InputEvent> &p_event) { // Start rotation if (drag_type == DRAG_NONE) { if (b.is_valid() && b->get_button_index() == BUTTON_LEFT && b->is_pressed()) { - if ((b->get_control() && !b->get_alt() && tool == TOOL_SELECT) || tool == TOOL_ROTATE) { + if ((b->get_command() && !b->get_alt() && tool == TOOL_SELECT) || tool == TOOL_ROTATE) { List<CanvasItem *> selection = _get_edited_canvas_items(); // Remove not movable nodes 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/editor/plugins/tile_set_editor_plugin.cpp b/editor/plugins/tile_set_editor_plugin.cpp index 9c589267fc..714f38bd56 100644 --- a/editor/plugins/tile_set_editor_plugin.cpp +++ b/editor/plugins/tile_set_editor_plugin.cpp @@ -500,6 +500,7 @@ TileSetEditor::TileSetEditor(EditorNode *p_editor) { tools[SHAPE_NEW_RECTANGLE]->set_button_group(tg); tools[SHAPE_NEW_RECTANGLE]->set_tooltip(TTR("Create a new rectangle.")); tools[SHAPE_NEW_RECTANGLE]->connect("pressed", callable_mp(this, &TileSetEditor::_on_tool_clicked), varray(SHAPE_NEW_RECTANGLE)); + tools[SHAPE_NEW_RECTANGLE]->set_shortcut(ED_SHORTCUT("tileset_editor/shape_new_rectangle", TTR("New Rectangle"), KEY_MASK_SHIFT | KEY_R)); tools[SHAPE_NEW_POLYGON] = memnew(Button); toolbar->add_child(tools[SHAPE_NEW_POLYGON]); @@ -508,6 +509,7 @@ TileSetEditor::TileSetEditor(EditorNode *p_editor) { tools[SHAPE_NEW_POLYGON]->set_button_group(tg); tools[SHAPE_NEW_POLYGON]->set_tooltip(TTR("Create a new polygon.")); tools[SHAPE_NEW_POLYGON]->connect("pressed", callable_mp(this, &TileSetEditor::_on_tool_clicked), varray(SHAPE_NEW_POLYGON)); + tools[SHAPE_NEW_POLYGON]->set_shortcut(ED_SHORTCUT("tileset_editor/shape_new_polygon", TTR("New Polygon"), KEY_MASK_SHIFT | KEY_P)); separator_shape_toggle = memnew(VSeparator); toolbar->add_child(separator_shape_toggle); @@ -521,6 +523,7 @@ TileSetEditor::TileSetEditor(EditorNode *p_editor) { tools[SHAPE_DELETE] = memnew(Button); tools[SHAPE_DELETE]->set_flat(true); tools[SHAPE_DELETE]->connect("pressed", callable_mp(this, &TileSetEditor::_on_tool_clicked), varray(SHAPE_DELETE)); + tools[SHAPE_DELETE]->set_shortcut(ED_SHORTCUT("tileset_editor/shape_delete", TTR("Delete Selected Shape"), KEY_MASK_SHIFT | KEY_BACKSPACE)); toolbar->add_child(tools[SHAPE_DELETE]); spin_priority = memnew(SpinBox); diff --git a/editor/project_manager.cpp b/editor/project_manager.cpp index 167cd3ac35..f26d44d75a 100644 --- a/editor/project_manager.cpp +++ b/editor/project_manager.cpp @@ -2105,7 +2105,7 @@ void ProjectManager::_run_project_confirm() { if (selected_main == "") { run_error_diag->set_text(TTR("Can't run project: no main scene defined.\nPlease edit the project and set the main scene in the Project Settings under the \"Application\" category.")); run_error_diag->popup_centered(); - return; + continue; } const String &selected = selected_list[i].project_key; @@ -2115,7 +2115,7 @@ void ProjectManager::_run_project_confirm() { if (!DirAccess::exists(path.plus_file(ProjectSettings::IMPORTED_FILES_PATH.right(6)))) { run_error_diag->set_text(TTR("Can't run project: Assets need to be imported.\nPlease edit the project to trigger the initial import.")); run_error_diag->popup_centered(); - return; + continue; } print_line("Running project: " + path + " (" + selected + ")"); diff --git a/main/main.cpp b/main/main.cpp index 51d2cbfe71..82be327cbb 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -334,8 +334,8 @@ void Main::print_help(const char *p_binary) { OS::get_singleton()->print(" -d, --debug Debug (local stdout debugger).\n"); OS::get_singleton()->print(" -b, --breakpoints Breakpoint list as source::line comma-separated pairs, no spaces (use %%20 instead).\n"); OS::get_singleton()->print(" --profiling Enable profiling in the script debugger.\n"); -#if DEBUG_ENABLED OS::get_singleton()->print(" --vk-layers Enable Vulkan Validation layers for debugging.\n"); +#if DEBUG_ENABLED OS::get_singleton()->print(" --gpu-abort Abort on GPU errors (usually validation layer errors), may help see the problem if your system freezes.\n"); #endif OS::get_singleton()->print(" --remote-debug <uri> Remote debug (<protocol>://<host/IP>[:<port>], e.g. tcp://127.0.0.1:6007).\n"); @@ -698,9 +698,9 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph } else if (I->get() == "-w" || I->get() == "--windowed") { // force windowed window init_windowed = true; -#ifdef DEBUG_ENABLED } else if (I->get() == "--vk-layers") { Engine::singleton->use_validation_layers = true; +#ifdef DEBUG_ENABLED } else if (I->get() == "--gpu-abort") { Engine::singleton->abort_on_gpu_errors = true; #endif @@ -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/platform/javascript/detect.py b/platform/javascript/detect.py index e6e35f6aa9..71189cf697 100644 --- a/platform/javascript/detect.py +++ b/platform/javascript/detect.py @@ -107,7 +107,6 @@ def configure(env): env["CC"] = "emcc" env["CXX"] = "em++" - env["LINK"] = "emcc" env["AR"] = "emar" env["RANLIB"] = "emranlib" diff --git a/platform/linuxbsd/detect.py b/platform/linuxbsd/detect.py index ea101e24dd..a1bc5867c5 100644 --- a/platform/linuxbsd/detect.py +++ b/platform/linuxbsd/detect.py @@ -129,7 +129,6 @@ def configure(env): if "clang++" not in os.path.basename(env["CXX"]): env["CC"] = "clang" env["CXX"] = "clang++" - env["LINK"] = "clang++" env.Append(CPPDEFINES=["TYPED_METHOD_BIND"]) env.extra_suffix = ".llvm" + env.extra_suffix diff --git a/platform/osx/detect.py b/platform/osx/detect.py index 64e1d94f39..ea41479bb0 100644 --- a/platform/osx/detect.py +++ b/platform/osx/detect.py @@ -87,8 +87,8 @@ def configure(env): if env["arch"] == "arm64": print("Building for macOS 10.15+, platform arm64.") - env.Append(CCFLAGS=["-arch", "arm64", "-mmacosx-version-min=10.15", "-target", "arm64-apple-macos10.15"]) - env.Append(LINKFLAGS=["-arch", "arm64", "-mmacosx-version-min=10.15", "-target", "arm64-apple-macos10.15"]) + env.Append(CCFLAGS=["-arch", "arm64", "-mmacosx-version-min=10.15"]) + env.Append(LINKFLAGS=["-arch", "arm64", "-mmacosx-version-min=10.15"]) else: print("Building for macOS 10.12+, platform x86-64.") env.Append(CCFLAGS=["-arch", "x86_64", "-mmacosx-version-min=10.12"]) @@ -99,7 +99,6 @@ def configure(env): mpprefix = os.environ.get("MACPORTS_PREFIX", "/opt/local") mpclangver = env["macports_clang"] env["CC"] = mpprefix + "/libexec/llvm-" + mpclangver + "/bin/clang" - env["LINK"] = mpprefix + "/libexec/llvm-" + mpclangver + "/bin/clang++" env["CXX"] = mpprefix + "/libexec/llvm-" + mpclangver + "/bin/clang++" env["AR"] = mpprefix + "/libexec/llvm-" + mpclangver + "/bin/llvm-ar" env["RANLIB"] = mpprefix + "/libexec/llvm-" + mpclangver + "/bin/llvm-ranlib" @@ -134,12 +133,6 @@ def configure(env): env["AS"] = basecmd + "as" env.Append(CPPDEFINES=["__MACPORTS__"]) # hack to fix libvpx MM256_BROADCASTSI128_SI256 define - if env["CXX"] == "clang++": - # This should now work with clang++, re-enable if there are issues - # env.Append(CPPDEFINES=["TYPED_METHOD_BIND"]) - env["CC"] = "clang" - env["LINK"] = "clang++" - if env["use_ubsan"] or env["use_asan"] or env["use_tsan"]: env.extra_suffix += "s" diff --git a/platform/server/detect.py b/platform/server/detect.py index f9e151f956..a3f60b0710 100644 --- a/platform/server/detect.py +++ b/platform/server/detect.py @@ -94,7 +94,6 @@ def configure(env): if "clang++" not in os.path.basename(env["CXX"]): env["CC"] = "clang" env["CXX"] = "clang++" - env["LINK"] = "clang++" env.Append(CPPDEFINES=["TYPED_METHOD_BIND"]) env.extra_suffix = ".llvm" + env.extra_suffix diff --git a/platform/windows/detect.py b/platform/windows/detect.py index 934314b2f2..e0b2a52014 100644 --- a/platform/windows/detect.py +++ b/platform/windows/detect.py @@ -383,18 +383,17 @@ def configure_mingw(env): if env["use_llvm"]: env["CC"] = mingw_prefix + "clang" - env["AS"] = mingw_prefix + "as" env["CXX"] = mingw_prefix + "clang++" + env["AS"] = mingw_prefix + "as" env["AR"] = mingw_prefix + "ar" env["RANLIB"] = mingw_prefix + "ranlib" - env["LINK"] = mingw_prefix + "clang++" else: env["CC"] = mingw_prefix + "gcc" - env["AS"] = mingw_prefix + "as" env["CXX"] = mingw_prefix + "g++" + env["AS"] = mingw_prefix + "as" env["AR"] = mingw_prefix + "gcc-ar" env["RANLIB"] = mingw_prefix + "gcc-ranlib" - env["LINK"] = mingw_prefix + "g++" + env["x86_libtheora_opt_gcc"] = True if env["use_lto"]: 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)) { |