mirror of
https://github.com/godotengine/godot.git
synced 2026-02-07 11:21:49 +00:00
Merge pull request #115633 from AThousandShips/fix_invalid_event
[Input] Handle invalid `input/` settings correctly
This commit is contained in:
@@ -317,6 +317,11 @@ void InputMap::load_from_project_settings() {
|
||||
String name = pi.name.substr(pi.name.find_char('/') + 1);
|
||||
|
||||
Dictionary action = GLOBAL_GET(pi.name);
|
||||
|
||||
if (!action.has("events")) {
|
||||
continue;
|
||||
}
|
||||
|
||||
float deadzone = action.has("deadzone") ? (float)action["deadzone"] : DEFAULT_DEADZONE;
|
||||
Array events = action["events"];
|
||||
|
||||
|
||||
@@ -613,6 +613,11 @@ void ProjectSettingsEditor::_update_action_map_editor() {
|
||||
String display_name = property_name.substr(String("input/").size() - 1);
|
||||
Dictionary action = GLOBAL_GET(property_name);
|
||||
|
||||
if (!action.has("events")) {
|
||||
WARN_PRINT_ONCE_ED(vformat("Attempted to load invalid input action from setting at \"%s\". The `input/` prefix should only be used for input actions, and cannot be changed in the settings editor. Consider changing the category.", property_name));
|
||||
continue;
|
||||
}
|
||||
|
||||
ActionMapEditor::ActionInfo action_info;
|
||||
action_info.action = action;
|
||||
action_info.editable = true;
|
||||
|
||||
Reference in New Issue
Block a user