diff options
author | Nicholas Bishop <nicholasbishop@gmail.com> | 2012-06-25 00:18:32 +0400 |
---|---|---|
committer | Nicholas Bishop <nicholasbishop@gmail.com> | 2012-06-25 00:18:32 +0400 |
commit | ac9344de75ea775cc0f50db4a28b79356217dc73 (patch) | |
tree | 889c8f0f0f62f576a1c6f33f1b700e16f2dc74a3 /source/blender/blenkernel/intern | |
parent | 4f0551bca562e1fd11dcda360adadb92378fb4cc (diff) |
Fixes for modifier data in multi-user meshes.
When removing a skin or multires modifier, it skips deletion of the
associated CustomData layer if the object has any other modifiers of
that type. This check has been extended to all objects that use the
object's data.
Similarly, deleting higher multires levels and multires subdivision
will not update the maximum level of any other multires modifiers on
objects that link to the same mesh.
Note that modifier_apply_obdata() doesn't need any changes as it
does not allow applying to multi-user data.
Object joining has also been modified to synchronize multires levels
objects that share a mesh. This is needed because joining can
subdivide or delete levels in order to match the maximum level of the
join-from object to the join-to object.
Fixes bug [#31880] instance multiresolution modifier error.
http://projects.blender.org/tracker/index.php?func=detail&aid=31880&group_id=9&atid=498
Reviewed by Sergey:
http://codereview.appspot.com/6332047/
Diffstat (limited to 'source/blender/blenkernel/intern')
-rw-r--r-- | source/blender/blenkernel/intern/multires.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/source/blender/blenkernel/intern/multires.c b/source/blender/blenkernel/intern/multires.c index cb6f6823f48..2bc5c37b41b 100644 --- a/source/blender/blenkernel/intern/multires.c +++ b/source/blender/blenkernel/intern/multires.c @@ -347,7 +347,7 @@ static int multires_get_level(Object *ob, MultiresModifierData *mmd, int render) return (mmd->modifier.scene) ? get_render_subsurf_level(&mmd->modifier.scene->r, mmd->lvl) : mmd->lvl; } -static void multires_set_tot_level(Object *ob, MultiresModifierData *mmd, int lvl) +void multires_set_tot_level(Object *ob, MultiresModifierData *mmd, int lvl) { mmd->totlvl = lvl; @@ -2105,6 +2105,8 @@ void multires_load_old(Object *ob, Mesh *me) me->mr = NULL; } +/* If 'ob' and 'to_ob' both have multires modifiers, syncronize them + * such that 'ob' has the same total number of levels as 'to_ob'. */ static void multires_sync_levels(Scene *scene, Object *ob, Object *to_ob) { MultiresModifierData *mmd = get_multires_modifier(scene, ob, 1); @@ -2119,10 +2121,12 @@ static void multires_sync_levels(Scene *scene, Object *ob, Object *to_ob) multires_customdata_delete(ob->data); } - if (!mmd || !to_mmd) return; - - if (mmd->totlvl > to_mmd->totlvl) multires_del_higher(mmd, ob, to_mmd->totlvl); - else multires_subdivide(mmd, ob, to_mmd->totlvl, 0, mmd->simple); + if (mmd && to_mmd) { + if (mmd->totlvl > to_mmd->totlvl) + multires_del_higher(mmd, ob, to_mmd->totlvl); + else + multires_subdivide(mmd, ob, to_mmd->totlvl, 0, mmd->simple); + } } static void multires_apply_smat(Scene *scene, Object *ob, float smat[3][3]) |