diff options
author | Sybren A. Stüvel <sybren@blender.org> | 2020-04-24 18:23:44 +0300 |
---|---|---|
committer | Sybren A. Stüvel <sybren@blender.org> | 2020-04-24 18:23:44 +0300 |
commit | a8441fc90086bf21dc50dc9dcd6085e0a0674921 (patch) | |
tree | f02a5d015e1b315175c1887f7de6a3c575cb1ea8 /source/blender/blenkernel/intern/mball_tessellate.c | |
parent | 4542b50afcfc9b797d5f3048393ba1f1836561a0 (diff) |
Fix T69753 Instanced Metaballs not rendering but showing up in Viewport
This hides the original metaballs when they are used in
duplifaces/-verts instancing, and still shows the instanced metaballs.
The visibility of the original metaballs is now determined by the
visibility of the instancer. I'm not too thrilled about this, but at
least it gives users the ability to show/hide the metaballs for
viewport/render.
Differential Revision: https://developer.blender.org/D7478
Diffstat (limited to 'source/blender/blenkernel/intern/mball_tessellate.c')
-rw-r--r-- | source/blender/blenkernel/intern/mball_tessellate.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/mball_tessellate.c b/source/blender/blenkernel/intern/mball_tessellate.c index cd629c888a4..ad178e76ef6 100644 --- a/source/blender/blenkernel/intern/mball_tessellate.c +++ b/source/blender/blenkernel/intern/mball_tessellate.c @@ -44,6 +44,7 @@ #include "BKE_displist.h" #include "BKE_mball_tessellate.h" /* own include */ +#include "BKE_object.h" #include "BKE_scene.h" #include "DEG_depsgraph.h" @@ -1191,6 +1192,8 @@ static void init_meta(Depsgraph *depsgraph, PROCESS *process, Scene *scene, Obje int obnr, zero_size = 0; char obname[MAX_ID_NAME]; SceneBaseIter iter; + const eEvaluationMode deg_eval_mode = DEG_get_mode(depsgraph); + const short parenting_dupli_transflag = (OB_DUPLIFACES | OB_DUPLIVERTS); copy_m4_m4(obmat, ob->obmat); /* to cope with duplicators from BKE_scene_base_iter_next */ invert_m4_m4(obinv, ob->obmat); @@ -1204,6 +1207,14 @@ static void init_meta(Depsgraph *depsgraph, PROCESS *process, Scene *scene, Obje zero_size = 0; ml = NULL; + /* If this metaball is the original that's used for duplication, only have it it visible when + * the instancer is visible too. */ + if ((base->flag_legacy & OB_FROMDUPLI) == 0 && ob->parent != NULL && + (ob->parent->transflag & parenting_dupli_transflag) != 0 && + (BKE_object_visibility(ob->parent, deg_eval_mode) & OB_VISIBLE_SELF) == 0) { + continue; + } + if (bob == ob && (base->flag_legacy & OB_FROMDUPLI) == 0) { mb = ob->data; |