Use `Dictionary.get_key_list` where appropriate
This commit is contained in:
parent
76a135926a
commit
ac07977fbd
|
@ -467,17 +467,18 @@ void DependencyRemoveDialog::_find_localization_remaps_of_removed_files(Vector<R
|
||||||
p_removed.push_back(dep);
|
p_removed.push_back(dep);
|
||||||
}
|
}
|
||||||
|
|
||||||
Array remap_keys = remaps.keys();
|
List<Variant> remap_keys;
|
||||||
for (int j = 0; j < remap_keys.size(); j++) {
|
remaps.get_key_list(&remap_keys);
|
||||||
PackedStringArray remapped_files = remaps[remap_keys[j]];
|
for (const Variant &remap_key : remap_keys) {
|
||||||
for (int k = 0; k < remapped_files.size(); k++) {
|
PackedStringArray remapped_files = remaps[remap_key];
|
||||||
int splitter_pos = remapped_files[k].rfind(":");
|
for (int j = 0; j < remapped_files.size(); j++) {
|
||||||
String res_path = remapped_files[k].substr(0, splitter_pos);
|
int splitter_pos = remapped_files[j].rfind(":");
|
||||||
|
String res_path = remapped_files[j].substr(0, splitter_pos);
|
||||||
if (res_path == path) {
|
if (res_path == path) {
|
||||||
String locale_name = remapped_files[k].substr(splitter_pos + 1);
|
String locale_name = remapped_files[j].substr(splitter_pos + 1);
|
||||||
|
|
||||||
RemovedDependency dep;
|
RemovedDependency dep;
|
||||||
dep.file = vformat(TTR("Localization remap for path '%s' and locale '%s'."), remap_keys[j], locale_name);
|
dep.file = vformat(TTR("Localization remap for path '%s' and locale '%s'."), remap_key, locale_name);
|
||||||
dep.file_type = "";
|
dep.file_type = "";
|
||||||
dep.dependency = path;
|
dep.dependency = path;
|
||||||
dep.dependency_folder = files.value;
|
dep.dependency_folder = files.value;
|
||||||
|
|
|
@ -293,9 +293,9 @@ void EditorCommandPalette::register_shortcuts_as_command() {
|
||||||
|
|
||||||
// Load command use history.
|
// Load command use history.
|
||||||
Dictionary command_history = EditorSettings::get_singleton()->get_project_metadata("command_palette", "command_history", Dictionary());
|
Dictionary command_history = EditorSettings::get_singleton()->get_project_metadata("command_palette", "command_history", Dictionary());
|
||||||
Array history_entries = command_history.keys();
|
List<Variant> history_entries;
|
||||||
for (int i = 0; i < history_entries.size(); i++) {
|
command_history.get_key_list(&history_entries);
|
||||||
const String &history_key = history_entries[i];
|
for (const String history_key : history_entries) {
|
||||||
if (commands.has(history_key)) {
|
if (commands.has(history_key)) {
|
||||||
commands[history_key].last_used = command_history[history_key];
|
commands[history_key].last_used = command_history[history_key];
|
||||||
}
|
}
|
||||||
|
|
|
@ -187,9 +187,9 @@ void EditorExportPreset::update_value_overrides() {
|
||||||
|
|
||||||
Dictionary plugin_overrides = export_plugins[i]->_get_export_options_overrides(platform);
|
Dictionary plugin_overrides = export_plugins[i]->_get_export_options_overrides(platform);
|
||||||
if (!plugin_overrides.is_empty()) {
|
if (!plugin_overrides.is_empty()) {
|
||||||
Array keys = plugin_overrides.keys();
|
List<Variant> keys;
|
||||||
for (int x = 0; x < keys.size(); x++) {
|
plugin_overrides.get_key_list(&keys);
|
||||||
StringName key = keys[x];
|
for (const StringName key : keys) {
|
||||||
Variant value = plugin_overrides[key];
|
Variant value = plugin_overrides[key];
|
||||||
if (new_value_overrides.has(key) && new_value_overrides[key] != value) {
|
if (new_value_overrides.has(key) && new_value_overrides[key] != value) {
|
||||||
WARN_PRINT_ED(vformat("Editor export plugin '%s' overrides pre-existing export option override '%s' with new value.", export_plugins[i]->get_name(), key));
|
WARN_PRINT_ED(vformat("Editor export plugin '%s' overrides pre-existing export option override '%s' with new value.", export_plugins[i]->get_name(), key));
|
||||||
|
|
|
@ -2869,9 +2869,10 @@ Node *ResourceImporterScene::pre_import(const String &p_source_file, const HashM
|
||||||
}
|
}
|
||||||
|
|
||||||
Error ResourceImporterScene::_check_resource_save_paths(const Dictionary &p_data) {
|
Error ResourceImporterScene::_check_resource_save_paths(const Dictionary &p_data) {
|
||||||
Array keys = p_data.keys();
|
List<Variant> keys;
|
||||||
for (int i = 0; i < keys.size(); i++) {
|
p_data.get_key_list(&keys);
|
||||||
const Dictionary &settings = p_data[keys[i]];
|
for (const Variant &key : keys) {
|
||||||
|
const Dictionary &settings = p_data[key];
|
||||||
|
|
||||||
if (bool(settings.get("save_to_file/enabled", false)) && settings.has("save_to_file/path")) {
|
if (bool(settings.get("save_to_file/enabled", false)) && settings.has("save_to_file/path")) {
|
||||||
const String &save_path = settings["save_to_file/path"];
|
const String &save_path = settings["save_to_file/path"];
|
||||||
|
|
|
@ -435,9 +435,10 @@ void LocalizationEditor::_filesystem_files_moved(const String &p_old_file, const
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check for the Array elements of the values.
|
// Check for the Array elements of the values.
|
||||||
Array remap_keys = remaps.keys();
|
List<Variant> remap_keys;
|
||||||
for (int i = 0; i < remap_keys.size(); i++) {
|
remaps.get_key_list(&remap_keys);
|
||||||
PackedStringArray remapped_files = remaps[remap_keys[i]];
|
for (const Variant &remap_key : remap_keys) {
|
||||||
|
PackedStringArray remapped_files = remaps[remap_key];
|
||||||
bool remapped_files_updated = false;
|
bool remapped_files_updated = false;
|
||||||
|
|
||||||
for (int j = 0; j < remapped_files.size(); j++) {
|
for (int j = 0; j < remapped_files.size(); j++) {
|
||||||
|
@ -451,12 +452,12 @@ void LocalizationEditor::_filesystem_files_moved(const String &p_old_file, const
|
||||||
remapped_files.remove_at(j + 1);
|
remapped_files.remove_at(j + 1);
|
||||||
remaps_changed = true;
|
remaps_changed = true;
|
||||||
remapped_files_updated = true;
|
remapped_files_updated = true;
|
||||||
print_verbose(vformat("Changed remap value \"%s\" to \"%s\" of key \"%s\" due to a moved file.", res_path + ":" + locale_name, remapped_files[j], remap_keys[i]));
|
print_verbose(vformat("Changed remap value \"%s\" to \"%s\" of key \"%s\" due to a moved file.", res_path + ":" + locale_name, remapped_files[j], remap_key));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (remapped_files_updated) {
|
if (remapped_files_updated) {
|
||||||
remaps[remap_keys[i]] = remapped_files;
|
remaps[remap_key] = remapped_files;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7780,7 +7780,8 @@ void Node3DEditor::_snap_selected_nodes_to_floor() {
|
||||||
PhysicsDirectSpaceState3D *ss = get_tree()->get_root()->get_world_3d()->get_direct_space_state();
|
PhysicsDirectSpaceState3D *ss = get_tree()->get_root()->get_world_3d()->get_direct_space_state();
|
||||||
PhysicsDirectSpaceState3D::RayResult result;
|
PhysicsDirectSpaceState3D::RayResult result;
|
||||||
|
|
||||||
Array keys = snap_data.keys();
|
List<Variant> keys;
|
||||||
|
snap_data.get_key_list(&keys);
|
||||||
|
|
||||||
// The maximum height an object can travel to be snapped
|
// The maximum height an object can travel to be snapped
|
||||||
const float max_snap_height = 500.0;
|
const float max_snap_height = 500.0;
|
||||||
|
@ -7791,8 +7792,8 @@ void Node3DEditor::_snap_selected_nodes_to_floor() {
|
||||||
if (keys.size()) {
|
if (keys.size()) {
|
||||||
// For snapping to be performed, there must be solid geometry under at least one of the selected nodes.
|
// For snapping to be performed, there must be solid geometry under at least one of the selected nodes.
|
||||||
// We need to check this before snapping to register the undo/redo action only if needed.
|
// We need to check this before snapping to register the undo/redo action only if needed.
|
||||||
for (int i = 0; i < keys.size(); i++) {
|
for (const Variant &key : keys) {
|
||||||
Node *node = Object::cast_to<Node>(keys[i]);
|
Node *node = Object::cast_to<Node>(key);
|
||||||
Node3D *sp = Object::cast_to<Node3D>(node);
|
Node3D *sp = Object::cast_to<Node3D>(node);
|
||||||
Dictionary d = snap_data[node];
|
Dictionary d = snap_data[node];
|
||||||
Vector3 from = d["from"];
|
Vector3 from = d["from"];
|
||||||
|
@ -7814,8 +7815,8 @@ void Node3DEditor::_snap_selected_nodes_to_floor() {
|
||||||
undo_redo->create_action(TTR("Snap Nodes to Floor"));
|
undo_redo->create_action(TTR("Snap Nodes to Floor"));
|
||||||
|
|
||||||
// Perform snapping if at least one node can be snapped
|
// Perform snapping if at least one node can be snapped
|
||||||
for (int i = 0; i < keys.size(); i++) {
|
for (const Variant &key : keys) {
|
||||||
Node *node = Object::cast_to<Node>(keys[i]);
|
Node *node = Object::cast_to<Node>(key);
|
||||||
Node3D *sp = Object::cast_to<Node3D>(node);
|
Node3D *sp = Object::cast_to<Node3D>(node);
|
||||||
Dictionary d = snap_data[node];
|
Dictionary d = snap_data[node];
|
||||||
Vector3 from = d["from"];
|
Vector3 from = d["from"];
|
||||||
|
|
|
@ -2128,12 +2128,11 @@ void VisualShaderEditor::_update_nodes() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Array keys = added.keys();
|
List<Variant> keys;
|
||||||
|
added.get_key_list(&keys);
|
||||||
keys.sort();
|
keys.sort();
|
||||||
|
|
||||||
for (int i = 0; i < keys.size(); i++) {
|
for (const Variant &key : keys) {
|
||||||
const Variant &key = keys.get(i);
|
|
||||||
|
|
||||||
const Dictionary &value = (Dictionary)added[key];
|
const Dictionary &value = (Dictionary)added[key];
|
||||||
|
|
||||||
add_custom_type(value["name"], value["type"], value["script"], value["description"], value["return_icon_type"], value["category"], value["highend"]);
|
add_custom_type(value["name"], value["type"], value["script"], value["description"], value["return_icon_type"], value["category"], value["highend"]);
|
||||||
|
|
|
@ -94,9 +94,9 @@ bpy.ops.export_scene.gltf(**opts['gltf_options'])
|
||||||
|
|
||||||
String dict_to_python(const Dictionary &p_dict) {
|
String dict_to_python(const Dictionary &p_dict) {
|
||||||
String entries;
|
String entries;
|
||||||
Array dict_keys = p_dict.keys();
|
List<Variant> dict_keys;
|
||||||
for (int i = 0; i < dict_keys.size(); i++) {
|
p_dict.get_key_list(&dict_keys);
|
||||||
const String key = dict_keys[i];
|
for (const String key : dict_keys) {
|
||||||
String value;
|
String value;
|
||||||
Variant raw_value = p_dict[key];
|
Variant raw_value = p_dict[key];
|
||||||
|
|
||||||
|
@ -127,9 +127,9 @@ String dict_to_python(const Dictionary &p_dict) {
|
||||||
|
|
||||||
String dict_to_xmlrpc(const Dictionary &p_dict) {
|
String dict_to_xmlrpc(const Dictionary &p_dict) {
|
||||||
String members;
|
String members;
|
||||||
Array dict_keys = p_dict.keys();
|
List<Variant> dict_keys;
|
||||||
for (int i = 0; i < dict_keys.size(); i++) {
|
p_dict.get_key_list(&dict_keys);
|
||||||
const String key = dict_keys[i];
|
for (const String key : dict_keys) {
|
||||||
String value;
|
String value;
|
||||||
Variant raw_value = p_dict[key];
|
Variant raw_value = p_dict[key];
|
||||||
|
|
||||||
|
|
|
@ -85,9 +85,10 @@ static Dictionary to_dictionary(const HashMap<K, V> &p_inp) {
|
||||||
template <typename K, typename V>
|
template <typename K, typename V>
|
||||||
static void set_from_dictionary(HashMap<K, V> &r_out, const Dictionary &p_inp) {
|
static void set_from_dictionary(HashMap<K, V> &r_out, const Dictionary &p_inp) {
|
||||||
r_out.clear();
|
r_out.clear();
|
||||||
Array keys = p_inp.keys();
|
List<Variant> keys;
|
||||||
for (int i = 0; i < keys.size(); i++) {
|
p_inp.get_key_list(&keys);
|
||||||
r_out[keys[i]] = p_inp[keys[i]];
|
for (const Variant &key : keys) {
|
||||||
|
r_out[key] = p_inp[key];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} //namespace GLTFTemplateConvert
|
} //namespace GLTFTemplateConvert
|
||||||
|
|
|
@ -145,9 +145,10 @@ Dictionary GLTFSkin::get_joint_i_to_name() {
|
||||||
|
|
||||||
void GLTFSkin::set_joint_i_to_name(Dictionary p_joint_i_to_name) {
|
void GLTFSkin::set_joint_i_to_name(Dictionary p_joint_i_to_name) {
|
||||||
joint_i_to_name = HashMap<int, StringName>();
|
joint_i_to_name = HashMap<int, StringName>();
|
||||||
Array keys = p_joint_i_to_name.keys();
|
List<Variant> keys;
|
||||||
for (int i = 0; i < keys.size(); i++) {
|
p_joint_i_to_name.get_key_list(&keys);
|
||||||
joint_i_to_name[keys[i]] = p_joint_i_to_name[keys[i]];
|
for (const Variant &key : keys) {
|
||||||
|
joint_i_to_name[key] = p_joint_i_to_name[key];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -55,9 +55,9 @@ void OpenXRSelectRuntime::_update_items() {
|
||||||
set_item_metadata(index, "");
|
set_item_metadata(index, "");
|
||||||
index++;
|
index++;
|
||||||
|
|
||||||
Array keys = runtimes.keys();
|
List<Variant> keys;
|
||||||
for (int i = 0; i < keys.size(); i++) {
|
runtimes.get_key_list(&keys);
|
||||||
String key = keys[i];
|
for (const String key : keys) {
|
||||||
String path = runtimes[key];
|
String path = runtimes[key];
|
||||||
String adj_path = path.replace("~", home_folder);
|
String adj_path = path.replace("~", home_folder);
|
||||||
|
|
||||||
|
|
|
@ -76,9 +76,9 @@ HashMap<String, bool *> OpenXRExtensionWrapperExtension::get_requested_extension
|
||||||
|
|
||||||
if (GDVIRTUAL_CALL(_get_requested_extensions, request_extension)) {
|
if (GDVIRTUAL_CALL(_get_requested_extensions, request_extension)) {
|
||||||
HashMap<String, bool *> result;
|
HashMap<String, bool *> result;
|
||||||
Array keys = request_extension.keys();
|
List<Variant> keys;
|
||||||
for (int i = 0; i < keys.size(); i++) {
|
request_extension.get_key_list(&keys);
|
||||||
String key = keys.get(i);
|
for (const String key : keys) {
|
||||||
GDExtensionPtr<bool> value = VariantCaster<GDExtensionPtr<bool>>::cast(request_extension.get(key, GDExtensionPtr<bool>(nullptr)));
|
GDExtensionPtr<bool> value = VariantCaster<GDExtensionPtr<bool>>::cast(request_extension.get(key, GDExtensionPtr<bool>(nullptr)));
|
||||||
result.insert(key, value);
|
result.insert(key, value);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1225,9 +1225,10 @@ void CodeEdit::add_auto_brace_completion_pair(const String &p_open_key, const St
|
||||||
void CodeEdit::set_auto_brace_completion_pairs(const Dictionary &p_auto_brace_completion_pairs) {
|
void CodeEdit::set_auto_brace_completion_pairs(const Dictionary &p_auto_brace_completion_pairs) {
|
||||||
auto_brace_completion_pairs.clear();
|
auto_brace_completion_pairs.clear();
|
||||||
|
|
||||||
Array keys = p_auto_brace_completion_pairs.keys();
|
List<Variant> keys;
|
||||||
for (int i = 0; i < keys.size(); i++) {
|
p_auto_brace_completion_pairs.get_key_list(&keys);
|
||||||
add_auto_brace_completion_pair(keys[i], p_auto_brace_completion_pairs[keys[i]]);
|
for (const Variant &key : keys) {
|
||||||
|
add_auto_brace_completion_pair(key, p_auto_brace_completion_pairs[key]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue