diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2011-05-04 17:15:42 +0400 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2011-05-04 17:15:42 +0400 |
commit | d000103e80c076fb5bbdfbc87dc978b5e693564d (patch) | |
tree | 17540c107989f234e4b2028c1d273f4a72bbe0f5 /source/blender/editors/sculpt_paint | |
parent | 5d1fdb73ce1457b39df893887951fe6571580897 (diff) |
Own TODO item: sculpting on constructive modifiers
- Constructive modifiers are enabled by default in sculpt mode.
- There's option to disable all constructive modifiers in the "Options"
panel of toolbox in sculpt mode,
- Use one column in options panel to make strings easier to read
- No modifiers would still be applied on multires
Diffstat (limited to 'source/blender/editors/sculpt_paint')
-rw-r--r-- | source/blender/editors/sculpt_paint/sculpt.c | 17 | ||||
-rw-r--r-- | source/blender/editors/sculpt_paint/sculpt_intern.h | 3 | ||||
-rw-r--r-- | source/blender/editors/sculpt_paint/sculpt_undo.c | 5 |
3 files changed, 12 insertions, 13 deletions
diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index c7733ced1f3..7156b49c026 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -172,7 +172,7 @@ static int sculpt_has_active_modifiers(Scene *scene, Object *ob) } /* Checks if there are any supported deformation modifiers active */ -int sculpt_modifiers_active(Scene *scene, Object *ob) +static int sculpt_modifiers_active(Scene *scene, Sculpt *sd, Object *ob) { ModifierData *md; Mesh *me= (Mesh*)ob->data; @@ -189,12 +189,11 @@ int sculpt_modifiers_active(Scene *scene, Object *ob) /* exception for shape keys because we can edit those */ for(; md; md= md->next) { ModifierTypeInfo *mti = modifierType_getInfo(md->type); - if(!modifier_isEnabled(scene, md, eModifierMode_Realtime)) continue; if(md->type==eModifierType_ShapeKey) continue; - if(mti->type==eModifierTypeType_OnlyDeform) - return 1; + if(mti->type==eModifierTypeType_OnlyDeform) return 1; + else if((sd->flags & SCULPT_ONLY_DEFORM)==0) return 1; } return 0; @@ -2705,13 +2704,13 @@ void sculpt_free_deformMats(SculptSession *ss) ss->deform_imats = NULL; } -void sculpt_update_mesh_elements(Scene *scene, Object *ob, int need_fmap) +void sculpt_update_mesh_elements(Scene *scene, Sculpt *sd, Object *ob, int need_fmap) { DerivedMesh *dm = mesh_get_derived_final(scene, ob, CD_MASK_BAREMESH); SculptSession *ss = ob->sculpt; MultiresModifierData *mmd= sculpt_multires_active(scene, ob); - ss->modifiers_active= sculpt_modifiers_active(scene, ob); + ss->modifiers_active= sculpt_modifiers_active(scene, sd, ob); if(!mmd) ss->kb= ob_get_keyblock(ob); else ss->kb= NULL; @@ -3256,7 +3255,7 @@ static void sculpt_stroke_modifiers_check(bContext *C, Object *ob) Sculpt *sd = CTX_data_tool_settings(C)->sculpt; Brush *brush = paint_brush(&sd->paint); - sculpt_update_mesh_elements(CTX_data_scene(C), ob, brush->sculpt_tool == SCULPT_TOOL_SMOOTH); + sculpt_update_mesh_elements(CTX_data_scene(C), sd, ob, brush->sculpt_tool == SCULPT_TOOL_SMOOTH); } } @@ -3358,7 +3357,7 @@ static int sculpt_brush_stroke_init(bContext *C, ReportList *UNUSED(reports)) view3d_operator_needs_opengl(C); sculpt_brush_init_tex(sd, ss); - sculpt_update_mesh_elements(scene, ob, brush->sculpt_tool == SCULPT_TOOL_SMOOTH); + sculpt_update_mesh_elements(scene, sd, ob, brush->sculpt_tool == SCULPT_TOOL_SMOOTH); return 1; } @@ -3685,7 +3684,7 @@ static void sculpt_init_session(Scene *scene, Object *ob) { ob->sculpt = MEM_callocN(sizeof(SculptSession), "sculpt session"); - sculpt_update_mesh_elements(scene, ob, 0); + sculpt_update_mesh_elements(scene, scene->toolsettings->sculpt, ob, 0); } static int sculpt_toggle_mode(bContext *C, wmOperator *UNUSED(op)) diff --git a/source/blender/editors/sculpt_paint/sculpt_intern.h b/source/blender/editors/sculpt_paint/sculpt_intern.h index 5e017d0dc20..33970ea0179 100644 --- a/source/blender/editors/sculpt_paint/sculpt_intern.h +++ b/source/blender/editors/sculpt_paint/sculpt_intern.h @@ -64,7 +64,7 @@ struct Brush *sculptmode_brush(void); void sculpt(Sculpt *sd); int sculpt_poll(struct bContext *C); -void sculpt_update_mesh_elements(struct Scene *scene, struct Object *ob, int need_fmap); +void sculpt_update_mesh_elements(struct Scene *scene, struct Sculpt *sd, struct Object *ob, int need_fmap); /* Deformed mesh sculpt */ void sculpt_free_deformMats(struct SculptSession *ss); @@ -112,7 +112,6 @@ SculptUndoNode *sculpt_undo_get_node(PBVHNode *node); void sculpt_undo_push_begin(const char *name); void sculpt_undo_push_end(void); -int sculpt_modifiers_active(Scene *scene, Object *ob); void sculpt_vertcos_to_key(Object *ob, KeyBlock *kb, float (*vertCos)[3]); #endif diff --git a/source/blender/editors/sculpt_paint/sculpt_undo.c b/source/blender/editors/sculpt_paint/sculpt_undo.c index eeca174d802..c4ea5c9478c 100644 --- a/source/blender/editors/sculpt_paint/sculpt_undo.c +++ b/source/blender/editors/sculpt_paint/sculpt_undo.c @@ -84,6 +84,7 @@ static void sculpt_restore_deformed(SculptSession *ss, SculptUndoNode *unode, in static void sculpt_undo_restore(bContext *C, ListBase *lb) { Scene *scene = CTX_data_scene(C); + Sculpt *sd = CTX_data_tool_settings(C)->sculpt; Object *ob = CTX_data_active_object(C); DerivedMesh *dm = mesh_get_derived_final(scene, ob, 0); SculptSession *ss = ob->sculpt; @@ -93,7 +94,7 @@ static void sculpt_undo_restore(bContext *C, ListBase *lb) int *index; int i, j, update= 0; - sculpt_update_mesh_elements(scene, ob, 0); + sculpt_update_mesh_elements(scene, sd, ob, 0); for(unode=lb->first; unode; unode=unode->next) { if(!(strcmp(unode->idname, ob->id.name)==0)) @@ -113,7 +114,7 @@ static void sculpt_undo_restore(bContext *C, ListBase *lb) if (kb) { ob->shapenr= BLI_findindex(&key->block, kb) + 1; - sculpt_update_mesh_elements(scene, ob, 0); + sculpt_update_mesh_elements(scene, sd, ob, 0); WM_event_add_notifier(C, NC_OBJECT|ND_DATA, ob); } else { /* key has been removed -- skip this undo node */ |