From 0d438c7b18521833be23af37e0d9c1c7a66b669c Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Sun, 27 Jan 2019 18:28:41 -0300 Subject: [PATCH] Make CSG Shape work with GIProbe, fixes #20465 --- modules/csg/csg_shape.cpp | 14 ++++++++++++++ modules/csg/csg_shape.h | 2 ++ 2 files changed, 16 insertions(+) diff --git a/modules/csg/csg_shape.cpp b/modules/csg/csg_shape.cpp index a13f731c114..f62e6f5c405 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 df503faf2e8..1622fb3a15f 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;