Use get_slicec instead of get_slice for single character splitters

This commit is contained in:
A Thousand Ships
2024-11-16 17:16:07 +01:00
parent b5bdb88062
commit 466590d0ec
58 changed files with 210 additions and 210 deletions

View File

@@ -52,9 +52,9 @@ bool EditorPropertyArrayObject::_set(const StringName &p_name, const Variant &p_
int index;
if (name.begins_with("metadata/")) {
index = name.get_slice("/", 2).to_int();
index = name.get_slicec('/', 2).to_int();
} else {
index = name.get_slice("/", 1).to_int();
index = name.get_slicec('/', 1).to_int();
}
array.set(index, p_value);
@@ -70,9 +70,9 @@ bool EditorPropertyArrayObject::_get(const StringName &p_name, Variant &r_ret) c
int index;
if (name.begins_with("metadata/")) {
index = name.get_slice("/", 2).to_int();
index = name.get_slicec('/', 2).to_int();
} else {
index = name.get_slice("/", 1).to_int();
index = name.get_slicec('/', 1).to_int();
}
bool valid;
@@ -263,7 +263,7 @@ void EditorPropertyArray::_property_changed(const String &p_property, Variant p_
p_value = Variant(); // `EditorResourcePicker` resets to `Ref<Resource>()`. See GH-82716.
}
int index = p_property.get_slice("/", 1).to_int();
int index = p_property.get_slicec('/', 1).to_int();
Variant array = object->get_array().duplicate();
array.set(index, p_value);
@@ -1456,7 +1456,7 @@ EditorPropertyDictionary::EditorPropertyDictionary() {
void EditorPropertyLocalizableString::_property_changed(const String &p_property, const Variant &p_value, const String &p_name, bool p_changing) {
if (p_property.begins_with("indices")) {
int index = p_property.get_slice("/", 1).to_int();
int index = p_property.get_slicec('/', 1).to_int();
Dictionary dict = object->get_dict().duplicate();
Variant key = dict.get_key_at_index(index);