diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2010-06-02 22:04:31 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2010-06-02 22:04:31 +0400 |
commit | 89320c911eef0968f2c9c642da14a48f6a1bd5ae (patch) | |
tree | 9b1f3d5dd0d64de8d69376139c5c0fe8b9c7aa02 /source/blender/modifiers/intern/MOD_multires.c | |
parent | 9cbbc9d3afd8742a36969736f648743d4f943393 (diff) |
Sculpt & modifiers: patch by Sergey Sharybin, with modifications by me.
Fixes various crashes and redraw problems, most noticeable new feature
is that you can now sculpt on a multires mesh with deforming modifiers
preceding it.
I've left out support for sculpting on multires with enabled modifiers
following it, in this case only the base mesh can be sculpted now. The
code changes needed to do this are just too ugly in my opinion, would
need a more torough redesign which I don't think we should try now. In
my opinion this is also not really an important case, since it's going
to be incredibly slow anyway to run a modifier on a high res mesh while
sculpting.
So, to summarize current state:
* Fastest sculpting: base mesh with no modifiers or multires with only
modifiers preceding it.
* Slower sculpting: base mesh with modifiers, depends on the speed of
the modifiers.
* Not supported: multires mesh with modifiers following it.
Diffstat (limited to 'source/blender/modifiers/intern/MOD_multires.c')
-rw-r--r-- | source/blender/modifiers/intern/MOD_multires.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/source/blender/modifiers/intern/MOD_multires.c b/source/blender/modifiers/intern/MOD_multires.c index 945f17494f0..71e31656799 100644 --- a/source/blender/modifiers/intern/MOD_multires.c +++ b/source/blender/modifiers/intern/MOD_multires.c @@ -30,6 +30,8 @@ * */ +#include <stddef.h> + #include "BKE_cdderivedmesh.h" #include "BKE_multires.h" #include "BKE_modifier.h" @@ -60,6 +62,8 @@ static void copyData(ModifierData *md, ModifierData *target) static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *dm, int useRenderParams, int isFinalCalc) { + SculptSession *ss= ob->sculpt; + int sculpting= (ob->mode & OB_MODE_SCULPT) && ss; MultiresModifierData *mmd = (MultiresModifierData*)md; DerivedMesh *result; @@ -73,10 +77,10 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *dm, result->release(result); result= cddm; } - else if((ob->mode & OB_MODE_SCULPT) && ob->sculpt) { + else if(sculpting) { /* would be created on the fly too, just nicer this way on first stroke after e.g. switching levels */ - ob->sculpt->pbvh= result->getPBVH(ob, result); + ss->pbvh= result->getPBVH(ob, result); } return result; |