diff options
Diffstat (limited to 'modules/csg/csg_shape.cpp')
-rw-r--r-- | modules/csg/csg_shape.cpp | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/modules/csg/csg_shape.cpp b/modules/csg/csg_shape.cpp index 0656f8224c..7c93fbf081 100644 --- a/modules/csg/csg_shape.cpp +++ b/modules/csg/csg_shape.cpp @@ -150,13 +150,13 @@ float CSGShape3D::get_snap() const { void CSGShape3D::_make_dirty(bool p_parent_removing) { if ((p_parent_removing || is_root_shape()) && !dirty) { - call_deferred(SNAME("_update_shape")); // Must be deferred; otherwise, is_root_shape() will use the previous parent + callable_mp(this, &CSGShape3D::_update_shape).call_deferred(); // Must be deferred; otherwise, is_root_shape() will use the previous parent. } if (!is_root_shape()) { parent_shape->_make_dirty(); } else if (!dirty) { - call_deferred(SNAME("_update_shape")); + callable_mp(this, &CSGShape3D::_update_shape).call_deferred(); } dirty = true; @@ -488,7 +488,9 @@ bool CSGShape3D::_is_debug_collision_shape_visible() { } void CSGShape3D::_update_debug_collision_shape() { - // NOTE: This is called only for the root shape with collision, when root_collision_shape is valid. + if (!use_collision || !is_root_shape() || !root_collision_shape.is_valid() || !_is_debug_collision_shape_visible()) { + return; + } ERR_FAIL_NULL(RenderingServer::get_singleton()); @@ -573,6 +575,11 @@ void CSGShape3D::_notification(int p_what) { // Update this node's parent only if its own visibility has changed, not the visibility of parent nodes parent_shape->_make_dirty(); } + if (is_visible()) { + _update_debug_collision_shape(); + } else { + _clear_debug_collision_shape(); + } last_visible = is_visible(); } break; @@ -793,7 +800,7 @@ CSGBrush *CSGMesh3D::_build_brush() { if (arrays.size() == 0) { _make_dirty(); - ERR_FAIL_COND_V(arrays.size() == 0, memnew(CSGBrush)); + ERR_FAIL_COND_V(arrays.is_empty(), memnew(CSGBrush)); } Vector<Vector3> avertices = arrays[Mesh::ARRAY_VERTEX]; @@ -1819,11 +1826,13 @@ CSGBrush *CSGPolygon3D::_build_brush() { if (path) { path->disconnect("tree_exited", callable_mp(this, &CSGPolygon3D::_path_exited)); path->disconnect("curve_changed", callable_mp(this, &CSGPolygon3D::_path_changed)); + path->set_update_callback(Callable()); } path = current_path; if (path) { path->connect("tree_exited", callable_mp(this, &CSGPolygon3D::_path_exited)); path->connect("curve_changed", callable_mp(this, &CSGPolygon3D::_path_changed)); + path->set_update_callback(callable_mp(this, &CSGPolygon3D::_path_changed)); } } @@ -2219,7 +2228,7 @@ void CSGPolygon3D::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::NODE_PATH, "path_node", PROPERTY_HINT_NODE_PATH_VALID_TYPES, "Path3D"), "set_path_node", "get_path_node"); ADD_PROPERTY(PropertyInfo(Variant::INT, "path_interval_type", PROPERTY_HINT_ENUM, "Distance,Subdivide"), "set_path_interval_type", "get_path_interval_type"); ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "path_interval", PROPERTY_HINT_RANGE, "0.01,1.0,0.01,exp,or_greater"), "set_path_interval", "get_path_interval"); - ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "path_simplify_angle", PROPERTY_HINT_RANGE, "0.0,180.0,0.1,exp"), "set_path_simplify_angle", "get_path_simplify_angle"); + ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "path_simplify_angle", PROPERTY_HINT_RANGE, "0.0,180.0,0.1"), "set_path_simplify_angle", "get_path_simplify_angle"); ADD_PROPERTY(PropertyInfo(Variant::INT, "path_rotation", PROPERTY_HINT_ENUM, "Polygon,Path,PathFollow"), "set_path_rotation", "get_path_rotation"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "path_local"), "set_path_local", "is_path_local"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "path_continuous_u"), "set_path_continuous_u", "is_path_continuous_u"); |