Fix T70838: crash on cycles render after recent fix

My bad for not figuring out how to run our unittests since I got back to
Windows.
This commit is contained in:
Dalai Felinto 2019-10-15 10:12:52 -03:00
parent 4d3a317258
commit 7df7a8f3f1
Notes: blender-bot 2023-02-14 00:29:16 +01:00
Referenced by issue #70838, [Segfault<>BKE_object_is_visible_in_viewport] when rendering the default cube in cycles, despite viewport rendering works fine.
Referenced by issue #70821, Hair Radius Is Actually Hair Diameter
2 changed files with 3 additions and 1 deletions

View File

@ -555,7 +555,7 @@ void BlenderSync::sync_objects(BL::Depsgraph &b_depsgraph,
/* test if object needs to be hidden */
const bool show_self = b_instance.show_self();
const bool show_particles = b_instance.show_particles();
const bool show_in_viewport = b_ob.visible_in_viewport_get(b_v3d);
const bool show_in_viewport = !b_v3d || b_ob.visible_in_viewport_get(b_v3d);
if (show_in_viewport && (show_self || show_particles)) {
/* object itself */

View File

@ -1061,6 +1061,8 @@ bool BKE_base_is_visible(const View3D *v3d, const Base *base)
bool BKE_object_is_visible_in_viewport(const struct View3D *v3d, const struct Object *ob)
{
BLI_assert(v3d != NULL);
if (ob->restrictflag & OB_RESTRICT_VIEWPORT) {
return false;
}