diff options
author | Clay John <claynjohn@gmail.com> | 2022-10-27 09:47:34 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-27 09:47:34 -0700 |
commit | d1cc93af898cb62a4579234936bc1b66cd1852da (patch) | |
tree | 4a48c9bbf95ed849d117e4d03164ea7dcd644092 | |
parent | 682156e1f0b6fba8debba7c88a0a733e95baaac3 (diff) | |
parent | 5ee449efec44a1a1ecbcc7eebdb5d768e1decdcf (diff) |
Merge pull request #67832 from Sauermann/fix-remove-unnecessary-casts
Remove unnecessary casts
-rw-r--r-- | editor/editor_properties_array_dict.cpp | 6 | ||||
-rw-r--r-- | editor/plugins/font_config_plugin.cpp | 4 | ||||
-rw-r--r-- | editor/plugins/node_3d_editor_plugin.cpp | 4 | ||||
-rw-r--r-- | scene/main/viewport.cpp | 4 |
4 files changed, 7 insertions, 11 deletions
diff --git a/editor/editor_properties_array_dict.cpp b/editor/editor_properties_array_dict.cpp index d98ad117d7..7cc42f4d24 100644 --- a/editor/editor_properties_array_dict.cpp +++ b/editor/editor_properties_array_dict.cpp @@ -510,7 +510,7 @@ void EditorPropertyArray::_notification(int p_what) { change_type->add_separator(); change_type->add_icon_item(get_theme_icon(SNAME("Remove"), SNAME("EditorIcons")), TTR("Remove Item"), Variant::VARIANT_MAX); - if (Object::cast_to<Button>(button_add_item)) { + if (button_add_item) { button_add_item->set_icon(get_theme_icon(SNAME("Add"), SNAME("EditorIcons"))); } } break; @@ -1205,7 +1205,7 @@ void EditorPropertyDictionary::_notification(int p_what) { change_type->add_separator(); change_type->add_icon_item(get_theme_icon(SNAME("Remove"), SNAME("EditorIcons")), TTR("Remove Item"), Variant::VARIANT_MAX); - if (Object::cast_to<Button>(button_add_item)) { + if (button_add_item) { button_add_item->set_icon(get_theme_icon(SNAME("Add"), SNAME("EditorIcons"))); } } break; @@ -1431,7 +1431,7 @@ void EditorPropertyLocalizableString::_notification(int p_what) { switch (p_what) { case NOTIFICATION_THEME_CHANGED: case NOTIFICATION_ENTER_TREE: { - if (Object::cast_to<Button>(button_add_item)) { + if (button_add_item) { button_add_item->set_icon(get_theme_icon(SNAME("Add"), SNAME("EditorIcons"))); } } break; diff --git a/editor/plugins/font_config_plugin.cpp b/editor/plugins/font_config_plugin.cpp index ba11479714..58256ae549 100644 --- a/editor/plugins/font_config_plugin.cpp +++ b/editor/plugins/font_config_plugin.cpp @@ -154,7 +154,7 @@ void EditorPropertyFontMetaOverride::_notification(int p_what) { switch (p_what) { case NOTIFICATION_ENTER_TREE: case NOTIFICATION_THEME_CHANGED: { - if (Object::cast_to<Button>(button_add)) { + if (button_add) { button_add->set_icon(get_theme_icon(SNAME("Add"), SNAME("EditorIcons"))); } } break; @@ -549,7 +549,7 @@ void EditorPropertyOTFeatures::_notification(int p_what) { switch (p_what) { case NOTIFICATION_ENTER_TREE: case NOTIFICATION_THEME_CHANGED: { - if (Object::cast_to<Button>(button_add)) { + if (button_add) { button_add->set_icon(get_theme_icon(SNAME("Add"), SNAME("EditorIcons"))); } } break; diff --git a/editor/plugins/node_3d_editor_plugin.cpp b/editor/plugins/node_3d_editor_plugin.cpp index b033b0c00f..3c9d93f13a 100644 --- a/editor/plugins/node_3d_editor_plugin.cpp +++ b/editor/plugins/node_3d_editor_plugin.cpp @@ -3781,7 +3781,7 @@ AABB Node3DEditorViewport::_calculate_spatial_bounds(const Node3D *p_parent, boo if (child) { AABB child_bounds = _calculate_spatial_bounds(child, false); - if (bounds.size == Vector3() && Object::cast_to<Node3D>(p_parent)) { + if (bounds.size == Vector3() && p_parent) { bounds = child_bounds; } else { bounds.merge_with(child_bounds); @@ -3789,7 +3789,7 @@ AABB Node3DEditorViewport::_calculate_spatial_bounds(const Node3D *p_parent, boo } } - if (bounds.size == Vector3() && !Object::cast_to<Node3D>(p_parent)) { + if (bounds.size == Vector3() && !p_parent) { bounds = AABB(Vector3(-0.2, -0.2, -0.2), Vector3(0.4, 0.4, 0.4)); } diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp index a2963eadd5..1de3caaa97 100644 --- a/scene/main/viewport.cpp +++ b/scene/main/viewport.cpp @@ -1403,10 +1403,6 @@ Control *Viewport::gui_find_control(const Point2 &p_global) { } Control *Viewport::_gui_find_control_at_pos(CanvasItem *p_node, const Point2 &p_global, const Transform2D &p_xform, Transform2D &r_inv_xform) { - if (Object::cast_to<Viewport>(p_node)) { - return nullptr; - } - if (!p_node->is_visible()) { return nullptr; // Canvas item hidden, discard. } |