diff options
author | Juan Linietsky <reduzio@gmail.com> | 2019-01-27 18:28:41 -0300 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2019-01-27 18:29:17 -0300 |
commit | 0d438c7b18521833be23af37e0d9c1c7a66b669c (patch) | |
tree | df4a6fe54a7489b9fbf7eb6006b4c9b9006dd4c1 | |
parent | 7e99ac22ae9b261d0c73a0526382bc925f6557ab (diff) |
Make CSG Shape work with GIProbe, fixes #20465
-rw-r--r-- | modules/csg/csg_shape.cpp | 14 | ||||
-rw-r--r-- | modules/csg/csg_shape.h | 2 |
2 files changed, 16 insertions, 0 deletions
diff --git a/modules/csg/csg_shape.cpp b/modules/csg/csg_shape.cpp index a13f731c11..f62e6f5c40 100644 --- a/modules/csg/csg_shape.cpp +++ b/modules/csg/csg_shape.cpp @@ -575,6 +575,18 @@ void CSGShape::_validate_property(PropertyInfo &property) const { } } +Array CSGShape::get_meshes() const { + + if (root_mesh.is_valid()) { + Array arr; + arr.resize(2); + arr[0] = Transform(); + arr[1] = root_mesh; + return arr; + } + + return Array(); +} void CSGShape::_bind_methods() { ClassDB::bind_method(D_METHOD("_update_shape"), &CSGShape::_update_shape); @@ -604,6 +616,8 @@ void CSGShape::_bind_methods() { ClassDB::bind_method(D_METHOD("set_calculate_tangents", "enabled"), &CSGShape::set_calculate_tangents); ClassDB::bind_method(D_METHOD("is_calculating_tangents"), &CSGShape::is_calculating_tangents); + ClassDB::bind_method(D_METHOD("get_meshes"), &CSGShape::get_meshes); + ADD_PROPERTY(PropertyInfo(Variant::INT, "operation", PROPERTY_HINT_ENUM, "Union,Intersection,Subtraction"), "set_operation", "get_operation"); ADD_PROPERTY(PropertyInfo(Variant::REAL, "snap", PROPERTY_HINT_RANGE, "0.0001,1,0.001"), "set_snap", "get_snap"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "calculate_tangents"), "set_calculate_tangents", "is_calculating_tangents"); diff --git a/modules/csg/csg_shape.h b/modules/csg/csg_shape.h index df503faf2e..1622fb3a15 100644 --- a/modules/csg/csg_shape.h +++ b/modules/csg/csg_shape.h @@ -116,6 +116,8 @@ protected: virtual void _validate_property(PropertyInfo &property) const; + Array get_meshes() const; + public: void set_operation(Operation p_operation); Operation get_operation() const; |