Remove unnecessary casts
button_add_item and button_add are both Button p_parent is a Node3D CanvasItem can never be cast to Viewport
This commit is contained in:
parent
040f49ed6e
commit
5ee449efec
4 changed files with 7 additions and 11 deletions
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
|
||||
|
|
|
@ -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.
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue