Make CSG Shape work with GIProbe, fixes #20465

This commit is contained in:
Juan Linietsky 2019-01-27 18:28:41 -03:00
parent 7e99ac22ae
commit 0d438c7b18
2 changed files with 16 additions and 0 deletions

View file

@ -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");

View file

@ -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;