Check whether stuff is visible before baking it, closes #10525

This commit is contained in:
Juan Linietsky 2017-09-06 18:24:29 -03:00
parent c771e03ee2
commit 36e91b07d8

View file

@ -1092,7 +1092,7 @@ void GIProbe::_plot_mesh(const Transform &p_xform, Ref<Mesh> &p_mesh, Baker *p_b
void GIProbe::_find_meshes(Node *p_at_node, Baker *p_baker) {
MeshInstance *mi = Object::cast_to<MeshInstance>(p_at_node);
if (mi && mi->get_flag(GeometryInstance::FLAG_USE_BAKED_LIGHT)) {
if (mi && mi->get_flag(GeometryInstance::FLAG_USE_BAKED_LIGHT) && mi->is_visible_in_tree()) {
Ref<Mesh> mesh = mi->get_mesh();
if (mesh.is_valid()) {
@ -1115,6 +1115,8 @@ void GIProbe::_find_meshes(Node *p_at_node, Baker *p_baker) {
if (Spatial *s = Object::cast_to<Spatial>(p_at_node)) {
if (s->is_visible_in_tree()) {
Array meshes = p_at_node->call("get_meshes");
for (int i = 0; i < meshes.size(); i += 2) {
@ -1135,6 +1137,7 @@ void GIProbe::_find_meshes(Node *p_at_node, Baker *p_baker) {
}
}
}
}
for (int i = 0; i < p_at_node->get_child_count(); i++) {