Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenkernel/intern/mball_tessellate.c
| Show All 38 Lines | |||||
| #include "BLI_memarena.h" | #include "BLI_memarena.h" | ||||
| #include "BLI_string_utils.h" | #include "BLI_string_utils.h" | ||||
| #include "BLI_utildefines.h" | #include "BLI_utildefines.h" | ||||
| #include "BKE_global.h" | #include "BKE_global.h" | ||||
| #include "BKE_displist.h" | #include "BKE_displist.h" | ||||
| #include "BKE_mball_tessellate.h" /* own include */ | #include "BKE_mball_tessellate.h" /* own include */ | ||||
| #include "BKE_object.h" | |||||
| #include "BKE_scene.h" | #include "BKE_scene.h" | ||||
| #include "DEG_depsgraph.h" | #include "DEG_depsgraph.h" | ||||
| #include "DEG_depsgraph_query.h" | #include "DEG_depsgraph_query.h" | ||||
| #include "BLI_strict_flags.h" | #include "BLI_strict_flags.h" | ||||
| /* experimental (faster) normal calculation */ | /* experimental (faster) normal calculation */ | ||||
| ▲ Show 20 Lines • Show All 1,131 Lines • ▼ Show 20 Lines | static void init_meta(Depsgraph *depsgraph, PROCESS *process, Scene *scene, Object *ob) | ||||
| Object *bob; | Object *bob; | ||||
| MetaBall *mb; | MetaBall *mb; | ||||
| const MetaElem *ml; | const MetaElem *ml; | ||||
| float obinv[4][4], obmat[4][4]; | float obinv[4][4], obmat[4][4]; | ||||
| unsigned int i; | unsigned int i; | ||||
| int obnr, zero_size = 0; | int obnr, zero_size = 0; | ||||
| char obname[MAX_ID_NAME]; | char obname[MAX_ID_NAME]; | ||||
| SceneBaseIter iter; | SceneBaseIter iter; | ||||
| const eEvaluationMode deg_eval_mode = DEG_get_mode(depsgraph); | |||||
| const short parenting_dupli_transflag = (OB_DUPLIFACES | OB_DUPLIVERTS); | |||||
sybren: The patch could be extended to support other instancing methods as well, but these are relevant… | |||||
| copy_m4_m4(obmat, ob->obmat); /* to cope with duplicators from BKE_scene_base_iter_next */ | copy_m4_m4(obmat, ob->obmat); /* to cope with duplicators from BKE_scene_base_iter_next */ | ||||
| invert_m4_m4(obinv, ob->obmat); | invert_m4_m4(obinv, ob->obmat); | ||||
| BLI_split_name_num(obname, &obnr, ob->id.name + 2, '.'); | BLI_split_name_num(obname, &obnr, ob->id.name + 2, '.'); | ||||
| /* make main array */ | /* make main array */ | ||||
| BKE_scene_base_iter_next(depsgraph, &iter, &sce_iter, 0, NULL, NULL); | BKE_scene_base_iter_next(depsgraph, &iter, &sce_iter, 0, NULL, NULL); | ||||
| while (BKE_scene_base_iter_next(depsgraph, &iter, &sce_iter, 1, &base, &bob)) { | while (BKE_scene_base_iter_next(depsgraph, &iter, &sce_iter, 1, &base, &bob)) { | ||||
| if (bob->type == OB_MBALL) { | if (bob->type == OB_MBALL) { | ||||
| zero_size = 0; | zero_size = 0; | ||||
| ml = NULL; | 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) { | |||||
Done Inline ActionsMaybe some of this logic should be moved to BKE_object_visibility() itself? sybren: Maybe some of this logic should be moved to `BKE_object_visibility()` itself?
| |||||
Done Inline ActionsIf this duplicator logic can remain localized here, I wouldn't mind. Moving into BKE_object_visibility makes sense if other callers need to inline these checks too. A risk could be that the flags ob->parent->transflag for e.g. aren't valid, which could be difficult to debug. campbellbarton: If this duplicator logic can remain localized here, I wouldn't mind.
Moving into… | |||||
| continue; | |||||
| } | |||||
| if (bob == ob && (base->flag_legacy & OB_FROMDUPLI) == 0) { | if (bob == ob && (base->flag_legacy & OB_FROMDUPLI) == 0) { | ||||
| mb = ob->data; | mb = ob->data; | ||||
| if (mb->editelems) { | if (mb->editelems) { | ||||
| ml = mb->editelems->first; | ml = mb->editelems->first; | ||||
| } | } | ||||
| else { | else { | ||||
| ml = mb->elems.first; | ml = mb->elems.first; | ||||
| ▲ Show 20 Lines • Show All 250 Lines • Show Last 20 Lines | |||||
The patch could be extended to support other instancing methods as well, but these are relevant to T69753. Once this fix is accepted by the reviewers, we can look at extending.