Fix T63283: Second subdivision modifier does not ignore crease
This is something where there is no single correct behavior, sometimes it's needed to ignore the crease to make mesh more smooth. But sometimes crease is to be considered after first subdivision surface: for example, when adding extra subdivisions for render-time displacement. Made it an option whether modifier needs to take crease into account or not. Existing files should be openable in the 2.7 compatible way, to re-create an old behavior the options is to be manually disabled in the modifier settings. Reviewers: brecht Reviewed By: brecht Differential Revision: https://developer.blender.org/D4652
This commit is contained in:
@@ -2967,6 +2967,34 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
|
||||
}
|
||||
}
|
||||
|
||||
if (!MAIN_VERSION_ATLEAST(bmain, 280, 54)) {
|
||||
for (Object *ob = bmain->objects.first; ob; ob = ob->id.next) {
|
||||
bool is_first_subdiv = true;
|
||||
for (ModifierData *md = ob->modifiers.first; md; md = md->next) {
|
||||
if (md->type == eModifierType_Subsurf) {
|
||||
SubsurfModifierData *smd = (SubsurfModifierData *)md;
|
||||
if (is_first_subdiv) {
|
||||
smd->flags |= eSubsurfModifierFlag_UseCrease;
|
||||
}
|
||||
else {
|
||||
smd->flags &= ~eSubsurfModifierFlag_UseCrease;
|
||||
}
|
||||
is_first_subdiv = false;
|
||||
}
|
||||
else if (md->type == eModifierType_Multires) {
|
||||
MultiresModifierData *mmd = (MultiresModifierData *)md;
|
||||
if (is_first_subdiv) {
|
||||
mmd->flags |= eMultiresModifierFlag_UseCrease;
|
||||
}
|
||||
else {
|
||||
mmd->flags &= ~eMultiresModifierFlag_UseCrease;
|
||||
}
|
||||
is_first_subdiv = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
/* Versioning code until next subversion bump goes here. */
|
||||
|
||||
|
Reference in New Issue
Block a user