Remove unnecessary assignments
Co-authored-by: A Thousand Ships <96648715+AThousandShips@users.noreply.github.com>
This commit is contained in:
parent
aa5b6ed13e
commit
80fb8db31f
|
@ -1347,12 +1347,10 @@ Error Object::connect(const StringName &p_signal, const Callable &p_callable, ui
|
|||
s = &signal_map[p_signal];
|
||||
}
|
||||
|
||||
Callable target = p_callable;
|
||||
|
||||
//compare with the base callable, so binds can be ignored
|
||||
if (s->slot_map.has(*target.get_base_comparator())) {
|
||||
if (s->slot_map.has(*p_callable.get_base_comparator())) {
|
||||
if (p_flags & CONNECT_REFERENCE_COUNTED) {
|
||||
s->slot_map[*target.get_base_comparator()].reference_count++;
|
||||
s->slot_map[*p_callable.get_base_comparator()].reference_count++;
|
||||
return OK;
|
||||
} else {
|
||||
ERR_FAIL_V_MSG(ERR_INVALID_PARAMETER, "Signal '" + p_signal + "' is already connected to given callable '" + p_callable + "' in that object.");
|
||||
|
@ -1364,7 +1362,7 @@ Error Object::connect(const StringName &p_signal, const Callable &p_callable, ui
|
|||
SignalData::Slot slot;
|
||||
|
||||
Connection conn;
|
||||
conn.callable = target;
|
||||
conn.callable = p_callable;
|
||||
conn.signal = ::Signal(this, p_signal);
|
||||
conn.flags = p_flags;
|
||||
slot.conn = conn;
|
||||
|
@ -1376,7 +1374,7 @@ Error Object::connect(const StringName &p_signal, const Callable &p_callable, ui
|
|||
}
|
||||
|
||||
//use callable version as key, so binds can be ignored
|
||||
s->slot_map[*target.get_base_comparator()] = slot;
|
||||
s->slot_map[*p_callable.get_base_comparator()] = slot;
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
@ -1397,9 +1395,7 @@ bool Object::is_connected(const StringName &p_signal, const Callable &p_callable
|
|||
ERR_FAIL_V_MSG(false, "Nonexistent signal: " + p_signal + ".");
|
||||
}
|
||||
|
||||
Callable target = p_callable;
|
||||
|
||||
return s->slot_map.has(*target.get_base_comparator());
|
||||
return s->slot_map.has(*p_callable.get_base_comparator());
|
||||
}
|
||||
|
||||
void Object::disconnect(const StringName &p_signal, const Callable &p_callable) {
|
||||
|
|
|
@ -973,8 +973,7 @@ bool AnimationTrackEditTypeAudio::can_drop_data(const Point2 &p_point, const Var
|
|||
Vector<String> files = drag_data["files"];
|
||||
|
||||
if (files.size() == 1) {
|
||||
String file = files[0];
|
||||
Ref<AudioStream> res = ResourceLoader::load(file);
|
||||
Ref<AudioStream> res = ResourceLoader::load(files[0]);
|
||||
if (res.is_valid()) {
|
||||
return true;
|
||||
}
|
||||
|
@ -995,8 +994,7 @@ void AnimationTrackEditTypeAudio::drop_data(const Point2 &p_point, const Variant
|
|||
Vector<String> files = drag_data["files"];
|
||||
|
||||
if (files.size() == 1) {
|
||||
String file = files[0];
|
||||
stream = ResourceLoader::load(file);
|
||||
stream = ResourceLoader::load(files[0]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -661,8 +661,7 @@ bool EditorResourcePicker::_is_drop_valid(const Dictionary &p_drag_data) const {
|
|||
|
||||
// TODO: Extract the typename of the dropped filepath's resource in a more performant way, without fully loading it.
|
||||
if (files.size() == 1) {
|
||||
String file = files[0];
|
||||
res = ResourceLoader::load(file);
|
||||
res = ResourceLoader::load(files[0]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -727,8 +726,7 @@ void EditorResourcePicker::drop_data_fw(const Point2 &p_point, const Variant &p_
|
|||
Vector<String> files = drag_data["files"];
|
||||
|
||||
if (files.size() == 1) {
|
||||
String file = files[0];
|
||||
dropped_resource = ResourceLoader::load(file);
|
||||
dropped_resource = ResourceLoader::load(files[0]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1326,8 +1326,7 @@ bool SceneTreeEditor::can_drop_data_fw(const Point2 &p_point, const Variant &p_d
|
|||
|
||||
bool scene_drop = true;
|
||||
for (int i = 0; i < files.size(); i++) {
|
||||
String file = files[i];
|
||||
String ftype = EditorFileSystem::get_singleton()->get_file_type(file);
|
||||
String ftype = EditorFileSystem::get_singleton()->get_file_type(files[i]);
|
||||
if (ftype != "PackedScene") {
|
||||
scene_drop = false;
|
||||
break;
|
||||
|
|
|
@ -5613,8 +5613,7 @@ void CanvasItemEditorViewport::_on_change_type_closed() {
|
|||
void CanvasItemEditorViewport::_create_preview(const Vector<String> &files) const {
|
||||
bool add_preview = false;
|
||||
for (int i = 0; i < files.size(); i++) {
|
||||
String path = files[i];
|
||||
Ref<Resource> res = ResourceLoader::load(path);
|
||||
Ref<Resource> res = ResourceLoader::load(files[i]);
|
||||
ERR_FAIL_COND(res.is_null());
|
||||
Ref<Texture2D> texture = Ref<Texture2D>(Object::cast_to<Texture2D>(*res));
|
||||
Ref<PackedScene> scene = Ref<PackedScene>(Object::cast_to<PackedScene>(*res));
|
||||
|
|
|
@ -4154,8 +4154,7 @@ Node *Node3DEditorViewport::_sanitize_preview_node(Node *p_node) const {
|
|||
void Node3DEditorViewport::_create_preview_node(const Vector<String> &files) const {
|
||||
bool add_preview = false;
|
||||
for (int i = 0; i < files.size(); i++) {
|
||||
String path = files[i];
|
||||
Ref<Resource> res = ResourceLoader::load(path);
|
||||
Ref<Resource> res = ResourceLoader::load(files[i]);
|
||||
ERR_CONTINUE(res.is_null());
|
||||
Ref<PackedScene> scene = Ref<PackedScene>(Object::cast_to<PackedScene>(*res));
|
||||
Ref<Mesh> mesh = Ref<Mesh>(Object::cast_to<Mesh>(*res));
|
||||
|
|
|
@ -86,8 +86,7 @@ bool TileSetEditor::_can_drop_data_fw(const Point2 &p_point, const Variant &p_da
|
|||
}
|
||||
|
||||
for (int i = 0; i < files.size(); i++) {
|
||||
String file = files[i];
|
||||
String ftype = EditorFileSystem::get_singleton()->get_file_type(file);
|
||||
String ftype = EditorFileSystem::get_singleton()->get_file_type(files[i]);
|
||||
|
||||
if (!ClassDB::is_parent_class(ftype, "Texture2D")) {
|
||||
return false;
|
||||
|
|
|
@ -479,8 +479,7 @@ bool TileSetScenesCollectionSourceEditor::_can_drop_data_fw(const Point2 &p_poin
|
|||
}
|
||||
|
||||
for (int i = 0; i < files.size(); i++) {
|
||||
String file = files[i];
|
||||
String ftype = EditorFileSystem::get_singleton()->get_file_type(file);
|
||||
String ftype = EditorFileSystem::get_singleton()->get_file_type(files[i]);
|
||||
|
||||
if (!ClassDB::is_parent_class(ftype, "PackedScene")) {
|
||||
return false;
|
||||
|
|
|
@ -4826,16 +4826,14 @@ void VisualShaderEditor::_varying_create() {
|
|||
add_varying_dialog->hide();
|
||||
}
|
||||
|
||||
void VisualShaderEditor::_varying_name_changed(const String &p_text) {
|
||||
String name = p_text;
|
||||
|
||||
if (!name.is_valid_identifier()) {
|
||||
void VisualShaderEditor::_varying_name_changed(const String &p_name) {
|
||||
if (!p_name.is_valid_identifier()) {
|
||||
varying_error_label->show();
|
||||
varying_error_label->set_text(TTR("Invalid name for varying."));
|
||||
add_varying_dialog->get_ok_button()->set_disabled(true);
|
||||
return;
|
||||
}
|
||||
if (visual_shader->has_varying(name)) {
|
||||
if (visual_shader->has_varying(p_name)) {
|
||||
varying_error_label->show();
|
||||
varying_error_label->set_text(TTR("Varying with that name is already exist."));
|
||||
add_varying_dialog->get_ok_button()->set_disabled(true);
|
||||
|
|
|
@ -491,7 +491,7 @@ class VisualShaderEditor : public VBoxContainer {
|
|||
void _member_cancel();
|
||||
|
||||
void _varying_create();
|
||||
void _varying_name_changed(const String &p_text);
|
||||
void _varying_name_changed(const String &p_name);
|
||||
void _varying_deleted();
|
||||
void _varying_selected();
|
||||
void _varying_unselected();
|
||||
|
|
|
@ -1117,8 +1117,7 @@ GDScript *GDScript::find_class(const String &p_qualified_name) {
|
|||
|
||||
// Starts at index 1 because index 0 was handled above.
|
||||
for (int i = 1; result != nullptr && i < class_names.size(); i++) {
|
||||
String current_name = class_names[i];
|
||||
if (HashMap<StringName, Ref<GDScript>>::Iterator E = result->subclasses.find(current_name)) {
|
||||
if (HashMap<StringName, Ref<GDScript>>::Iterator E = result->subclasses.find(class_names[i])) {
|
||||
result = E->value.ptr();
|
||||
} else {
|
||||
// Couldn't find inner class.
|
||||
|
|
|
@ -315,9 +315,8 @@ Dictionary GDScriptTextDocument::resolve(const Dictionary &p_params) {
|
|||
Vector<String> param_symbols = query.split(SYMBOL_SEPERATOR, false);
|
||||
|
||||
if (param_symbols.size() >= 2) {
|
||||
String class_ = param_symbols[0];
|
||||
StringName class_name = class_;
|
||||
String member_name = param_symbols[param_symbols.size() - 1];
|
||||
StringName class_name = param_symbols[0];
|
||||
const String &member_name = param_symbols[param_symbols.size() - 1];
|
||||
String inner_class_name;
|
||||
if (param_symbols.size() >= 3) {
|
||||
inner_class_name = param_symbols[1];
|
||||
|
|
|
@ -893,8 +893,7 @@ Error EditorExportPlatformIOS::_walk_dir_recursive(Ref<DirAccess> &p_da, FileHan
|
|||
p_da->list_dir_end();
|
||||
|
||||
for (int i = 0; i < dirs.size(); ++i) {
|
||||
String dir = dirs[i];
|
||||
p_da->change_dir(dir);
|
||||
p_da->change_dir(dirs[i]);
|
||||
Error err = _walk_dir_recursive(p_da, p_handler, p_userdata);
|
||||
p_da->change_dir("..");
|
||||
if (err) {
|
||||
|
|
|
@ -6331,11 +6331,9 @@ Ref<RichTextEffect> RichTextLabel::_get_custom_effect_by_code(String p_bbcode_id
|
|||
Dictionary RichTextLabel::parse_expressions_for_values(Vector<String> p_expressions) {
|
||||
Dictionary d;
|
||||
for (int i = 0; i < p_expressions.size(); i++) {
|
||||
String expression = p_expressions[i];
|
||||
|
||||
Array a;
|
||||
Vector<String> parts = expression.split("=", true);
|
||||
String key = parts[0];
|
||||
Vector<String> parts = p_expressions[i].split("=", true);
|
||||
const String &key = parts[0];
|
||||
if (parts.size() != 2) {
|
||||
return d;
|
||||
}
|
||||
|
|
|
@ -1664,7 +1664,7 @@ bool TabBar::_set(const StringName &p_name, const Variant &p_value) {
|
|||
} else if (property == "icon") {
|
||||
set_tab_icon(tab_index, p_value);
|
||||
return true;
|
||||
} else if (components[1] == "disabled") {
|
||||
} else if (property == "disabled") {
|
||||
set_tab_disabled(tab_index, p_value);
|
||||
return true;
|
||||
}
|
||||
|
@ -1683,7 +1683,7 @@ bool TabBar::_get(const StringName &p_name, Variant &r_ret) const {
|
|||
} else if (property == "icon") {
|
||||
r_ret = get_tab_icon(tab_index);
|
||||
return true;
|
||||
} else if (components[1] == "disabled") {
|
||||
} else if (property == "disabled") {
|
||||
r_ret = is_tab_disabled(tab_index);
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -5314,8 +5314,7 @@ int TextEdit::get_line_wrap_index_at_column(int p_line, int p_column) const {
|
|||
Vector<String> lines = get_line_wrapped_text(p_line);
|
||||
for (int i = 0; i < lines.size(); i++) {
|
||||
wrap_index = i;
|
||||
String s = lines[wrap_index];
|
||||
col += s.length();
|
||||
col += lines[wrap_index].length();
|
||||
if (col > p_column) {
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -40,12 +40,11 @@ void ResourcePreloader::_set_resources(const Array &p_data) {
|
|||
ERR_FAIL_COND(names.size() != resdata.size());
|
||||
|
||||
for (int i = 0; i < resdata.size(); i++) {
|
||||
String name = names[i];
|
||||
Ref<Resource> resource = resdata[i];
|
||||
ERR_CONTINUE(!resource.is_valid());
|
||||
resources[name] = resource;
|
||||
resources[names[i]] = resource;
|
||||
|
||||
//add_resource(name,resource);
|
||||
//add_resource(names[i],resource);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -973,8 +973,7 @@ Error ResourceLoaderText::rename_dependencies(Ref<FileAccess> p_f, const String
|
|||
}
|
||||
|
||||
if (p_map.has(path)) {
|
||||
String np = p_map[path];
|
||||
path = np;
|
||||
path = p_map[path];
|
||||
}
|
||||
|
||||
if (relative) {
|
||||
|
|
|
@ -1396,14 +1396,12 @@ void RendererCanvasCull::canvas_item_add_triangle_array(RID p_item, const Vector
|
|||
ERR_FAIL_COND(!p_bones.is_empty() && p_bones.size() != vertex_count * 4);
|
||||
ERR_FAIL_COND(!p_weights.is_empty() && p_weights.size() != vertex_count * 4);
|
||||
|
||||
Vector<int> indices = p_indices;
|
||||
|
||||
Item::CommandPolygon *polygon = canvas_item->alloc_command<Item::CommandPolygon>();
|
||||
ERR_FAIL_NULL(polygon);
|
||||
|
||||
polygon->texture = p_texture;
|
||||
|
||||
polygon->polygon.create(indices, p_points, p_colors, p_uvs, p_bones, p_weights);
|
||||
polygon->polygon.create(p_indices, p_points, p_colors, p_uvs, p_bones, p_weights);
|
||||
|
||||
polygon->primitive = RS::PRIMITIVE_TRIANGLES;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue