diff options
Diffstat (limited to 'scene/3d')
-rw-r--r-- | scene/3d/collision_shape_3d.cpp | 15 | ||||
-rw-r--r-- | scene/3d/navigation_region_3d.cpp | 4 | ||||
-rw-r--r-- | scene/3d/node_3d.cpp | 34 | ||||
-rw-r--r-- | scene/3d/node_3d.h | 8 | ||||
-rw-r--r-- | scene/3d/physics_body_3d.cpp | 4 | ||||
-rw-r--r-- | scene/3d/soft_body_3d.cpp | 2 |
6 files changed, 34 insertions, 33 deletions
diff --git a/scene/3d/collision_shape_3d.cpp b/scene/3d/collision_shape_3d.cpp index 6ff0ce6032..e1c691b89a 100644 --- a/scene/3d/collision_shape_3d.cpp +++ b/scene/3d/collision_shape_3d.cpp @@ -140,15 +140,14 @@ String CollisionShape3D::get_configuration_warning() const { warning += TTR("A shape must be provided for CollisionShape3D to function. Please create a shape resource for it."); } - if (Object::cast_to<RigidBody3D>(get_parent())) { - if (Object::cast_to<ConcavePolygonShape3D>(*shape)) { - if (Object::cast_to<RigidBody3D>(get_parent())->get_mode() != RigidBody3D::MODE_STATIC) { - if (!warning.empty()) { - warning += "\n\n"; - } - warning += TTR("ConcavePolygonShape3D doesn't support RigidBody3D in another mode than static."); - } + if (shape.is_valid() && + Object::cast_to<RigidBody3D>(get_parent()) && + Object::cast_to<ConcavePolygonShape3D>(*shape) && + Object::cast_to<RigidBody3D>(get_parent())->get_mode() != RigidBody3D::MODE_STATIC) { + if (!warning.empty()) { + warning += "\n\n"; } + warning += TTR("ConcavePolygonShape3D doesn't support RigidBody3D in another mode than static."); } return warning; diff --git a/scene/3d/navigation_region_3d.cpp b/scene/3d/navigation_region_3d.cpp index 71bc74f433..3d3467583d 100644 --- a/scene/3d/navigation_region_3d.cpp +++ b/scene/3d/navigation_region_3d.cpp @@ -197,10 +197,12 @@ String NavigationRegion3D::get_configuration_warning() const { } warning += TTR("A NavigationMesh resource must be set or created for this node to work."); } + const Node3D *c = this; while (c) { - if (Object::cast_to<Navigation3D>(c)) + if (Object::cast_to<Navigation3D>(c)) { return warning; + } c = Object::cast_to<Node3D>(c->get_parent()); } diff --git a/scene/3d/node_3d.cpp b/scene/3d/node_3d.cpp index bf1445edf2..35c4b9d08d 100644 --- a/scene/3d/node_3d.cpp +++ b/scene/3d/node_3d.cpp @@ -103,7 +103,7 @@ void Node3D::_propagate_transform_changed(Node3D *p_origin) { data.children_lock++; for (List<Node3D *>::Element *E = data.children.front(); E; E = E->next()) { - if (E->get()->data.toplevel_active) { + if (E->get()->data.top_level_active) { continue; //don't propagate to a toplevel } E->get()->_propagate_transform_changed(p_origin); @@ -136,12 +136,12 @@ void Node3D::_notification(int p_what) { data.C = nullptr; } - if (data.toplevel && !Engine::get_singleton()->is_editor_hint()) { + if (data.top_level && !Engine::get_singleton()->is_editor_hint()) { if (data.parent) { data.local_transform = data.parent->get_global_transform() * get_transform(); data.dirty = DIRTY_VECTORS; //global is always dirty upon entering a scene } - data.toplevel_active = true; + data.top_level_active = true; } data.dirty |= DIRTY_GLOBAL; //global is always dirty upon entering a scene @@ -160,7 +160,7 @@ void Node3D::_notification(int p_what) { } data.parent = nullptr; data.C = nullptr; - data.toplevel_active = false; + data.top_level_active = false; } break; case NOTIFICATION_ENTER_WORLD: { data.inside_world = true; @@ -238,7 +238,7 @@ void Node3D::set_transform(const Transform &p_transform) { void Node3D::set_global_transform(const Transform &p_transform) { Transform xform = - (data.parent && !data.toplevel_active) ? + (data.parent && !data.top_level_active) ? data.parent->get_global_transform().affine_inverse() * p_transform : p_transform; @@ -261,7 +261,7 @@ Transform Node3D::get_global_transform() const { _update_local_transform(); } - if (data.parent && !data.toplevel_active) { + if (data.parent && !data.top_level_active) { data.global_transform = data.parent->get_global_transform() * data.local_transform; } else { data.global_transform = data.local_transform; @@ -462,8 +462,8 @@ bool Node3D::is_scale_disabled() const { return data.disable_scale; } -void Node3D::set_as_toplevel(bool p_enabled) { - if (data.toplevel == p_enabled) { +void Node3D::set_as_top_level(bool p_enabled) { + if (data.top_level == p_enabled) { return; } if (is_inside_tree() && !Engine::get_singleton()->is_editor_hint()) { @@ -473,16 +473,16 @@ void Node3D::set_as_toplevel(bool p_enabled) { set_transform(data.parent->get_global_transform().affine_inverse() * get_global_transform()); } - data.toplevel = p_enabled; - data.toplevel_active = p_enabled; + data.top_level = p_enabled; + data.top_level_active = p_enabled; } else { - data.toplevel = p_enabled; + data.top_level = p_enabled; } } -bool Node3D::is_set_as_toplevel() const { - return data.toplevel; +bool Node3D::is_set_as_top_level() const { + return data.top_level; } Ref<World3D> Node3D::get_world_3d() const { @@ -715,8 +715,8 @@ void Node3D::_bind_methods() { ClassDB::bind_method(D_METHOD("get_global_transform"), &Node3D::get_global_transform); ClassDB::bind_method(D_METHOD("get_parent_spatial"), &Node3D::get_parent_spatial); ClassDB::bind_method(D_METHOD("set_ignore_transform_notification", "enabled"), &Node3D::set_ignore_transform_notification); - ClassDB::bind_method(D_METHOD("set_as_toplevel", "enable"), &Node3D::set_as_toplevel); - ClassDB::bind_method(D_METHOD("is_set_as_toplevel"), &Node3D::is_set_as_toplevel); + ClassDB::bind_method(D_METHOD("set_as_toplevel", "enable"), &Node3D::set_as_top_level); + ClassDB::bind_method(D_METHOD("is_set_as_toplevel"), &Node3D::is_set_as_top_level); ClassDB::bind_method(D_METHOD("set_disable_scale", "disable"), &Node3D::set_disable_scale); ClassDB::bind_method(D_METHOD("is_scale_disabled"), &Node3D::is_scale_disabled); ClassDB::bind_method(D_METHOD("get_world_3d"), &Node3D::get_world_3d); @@ -789,8 +789,8 @@ Node3D::Node3D() : data.children_lock = 0; data.ignore_notification = false; - data.toplevel = false; - data.toplevel_active = false; + data.top_level = false; + data.top_level_active = false; data.scale = Vector3(1, 1, 1); data.viewport = nullptr; data.inside_world = false; diff --git a/scene/3d/node_3d.h b/scene/3d/node_3d.h index 327d4671e9..229e0f2c8c 100644 --- a/scene/3d/node_3d.h +++ b/scene/3d/node_3d.h @@ -71,8 +71,8 @@ class Node3D : public Node { Viewport *viewport; - bool toplevel_active; - bool toplevel; + bool top_level_active; + bool top_level; bool inside_world; int children_lock; @@ -144,8 +144,8 @@ public: virtual Transform get_local_gizmo_transform() const; #endif - void set_as_toplevel(bool p_enabled); - bool is_set_as_toplevel() const; + void set_as_top_level(bool p_enabled); + bool is_set_as_top_level() const; void set_disable_scale(bool p_enabled); bool is_scale_disabled() const; diff --git a/scene/3d/physics_body_3d.cpp b/scene/3d/physics_body_3d.cpp index 9a127c5425..193d016010 100644 --- a/scene/3d/physics_body_3d.cpp +++ b/scene/3d/physics_body_3d.cpp @@ -2606,7 +2606,7 @@ void PhysicalBone3D::_start_physics_simulation() { PhysicsServer3D::get_singleton()->body_set_collision_layer(get_rid(), get_collision_layer()); PhysicsServer3D::get_singleton()->body_set_collision_mask(get_rid(), get_collision_mask()); PhysicsServer3D::get_singleton()->body_set_force_integration_callback(get_rid(), this, "_direct_state_changed"); - set_as_toplevel(true); + set_as_top_level(true); _internal_simulate_physics = true; } @@ -2626,7 +2626,7 @@ void PhysicalBone3D::_stop_physics_simulation() { if (_internal_simulate_physics) { PhysicsServer3D::get_singleton()->body_set_force_integration_callback(get_rid(), nullptr, ""); parent_skeleton->set_bone_global_pose_override(bone_id, Transform(), 0.0, false); - set_as_toplevel(false); + set_as_top_level(false); _internal_simulate_physics = false; } } diff --git a/scene/3d/soft_body_3d.cpp b/scene/3d/soft_body_3d.cpp index d3d7cdc1ce..94e9555a1a 100644 --- a/scene/3d/soft_body_3d.cpp +++ b/scene/3d/soft_body_3d.cpp @@ -282,7 +282,7 @@ void SoftBody3D::_notification(int p_what) { set_notify_transform(false); // Required to be top level with Transform at center of world in order to modify RenderingServer only to support custom Transform - set_as_toplevel(true); + set_as_top_level(true); set_transform(Transform()); set_notify_transform(true); |