diff options
author | Antonioya <blendergit@gmail.com> | 2019-07-23 10:46:29 +0300 |
---|---|---|
committer | Antonioya <blendergit@gmail.com> | 2019-07-23 10:46:29 +0300 |
commit | 2204bfcf9e1c3a38e60830bd97775dd72158f4d6 (patch) | |
tree | 4f9c827389a23a431f8771b4ca02f410860c0242 /source/blender/blenkernel/intern/modifier.c | |
parent | f64db794ee690f05905ace0a66d81d2e75549b90 (diff) | |
parent | 34ad6da4a06ef46cd19945f61cc5f968538546a8 (diff) |
Merge branch 'master' into temp-gpencil-drw-engine
Diffstat (limited to 'source/blender/blenkernel/intern/modifier.c')
-rw-r--r-- | source/blender/blenkernel/intern/modifier.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/modifier.c b/source/blender/blenkernel/intern/modifier.c index 2254207e545..c23fe30d311 100644 --- a/source/blender/blenkernel/intern/modifier.c +++ b/source/blender/blenkernel/intern/modifier.c @@ -778,6 +778,41 @@ bool modifiers_usesArmature(Object *ob, bArmature *arm) return false; } +bool modifiers_usesSubsurfFacedots(struct Scene *scene, Object *ob) +{ + /* Search (backward) in the modifier stack to find if we have a subsurf modifier (enabled) before + * the last modifier displayed on cage (or if the subsurf is the last). */ + VirtualModifierData virtualModifierData; + ModifierData *md = modifiers_getVirtualModifierList(ob, &virtualModifierData); + int cage_index = modifiers_getCageIndex(scene, ob, NULL, 1); + if (cage_index == -1) { + return false; + } + /* Find first modifier enabled on cage. */ + for (int i = 0; md && i < cage_index; i++) { + md = md->next; + } + /* Now from this point, search for subsurf modifier. */ + for (; md; md = md->prev) { + const ModifierTypeInfo *mti = modifierType_getInfo(md->type); + if (md->type == eModifierType_Subsurf) { + ModifierMode mode = eModifierMode_Realtime | eModifierMode_Editmode; + if (modifier_isEnabled(scene, md, mode)) { + return true; + } + } + else if (mti->type == eModifierTypeType_OnlyDeform) { + /* Theses modifiers do not reset the subdiv flag nor change the topology. + * We can still search for a subsurf modifier. */ + } + else { + /* Other modifiers may reset the subdiv facedot flag or create. */ + return false; + } + } + return false; +} + bool modifier_isCorrectableDeformed(ModifierData *md) { const ModifierTypeInfo *mti = modifierType_getInfo(md->type); |