Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Wilkins <Jason.A.Wilkins@gmail.com>2012-05-03 07:51:30 +0400
committerJason Wilkins <Jason.A.Wilkins@gmail.com>2012-05-03 07:51:30 +0400
commit2a6217859e818fb9a791ed066ef05cf6f9cb02b2 (patch)
tree54d7aedebe81828d5e98d617db9996c8953f33b7 /source/blender/editors/sculpt_paint/sculpt.c
parentaf1720bc77532b2eea999ccd4aa8dfeff69efb62 (diff)
Patch [#30255] Center Last Stroke
Enables the NUMPERIOD view centering operator to work in sculpt mode. Hitting NUMPERIOD while in sculpt mode will center the view on the end of the last sculpting stroke made by the user. This is useful for quickly refocusing on the current work area without fussing with the view controls. It does not zoom into the stroke (slide only). It does nothing if there have been no strokes.
Diffstat (limited to 'source/blender/editors/sculpt_paint/sculpt.c')
-rw-r--r--source/blender/editors/sculpt_paint/sculpt.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c
index 8d2dfc8dbfa..51fe73bb527 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -101,6 +101,26 @@ void ED_sculpt_force_update(bContext *C)
multires_force_update(ob);
}
+float *ED_sculpt_get_last_stroke(struct Object *ob)
+{
+ return (ob && ob->sculpt && ob->sculpt->last_stroke_valid) ? ob->sculpt->last_stroke : NULL;
+}
+
+int ED_sculpt_minmax(bContext *C, float *min, float *max)
+{
+ Object *ob= CTX_data_active_object(C);
+
+ if (ob && ob->sculpt && ob->sculpt->last_stroke_valid) {
+ copy_v3_v3(min, ob->sculpt->last_stroke);
+ copy_v3_v3(max, ob->sculpt->last_stroke);
+
+ return 1;
+ }
+ else {
+ return 0;
+ }
+}
+
/* Sculpt mode handles multires differently from regular meshes, but only if
* it's the last modifier on the stack and it is not on the first level */
struct MultiresModifierData *sculpt_multires_active(Scene *scene, Object *ob)
@@ -3482,6 +3502,11 @@ static void sculpt_stroke_done(bContext *C, struct PaintStroke *UNUSED(stroke))
}
}
+ /* update last stroke position */
+ ob->sculpt->last_stroke_valid= 1;
+ copy_v3_v3(ob->sculpt->last_stroke, ss->cache->true_location);
+ mul_m4_v3(ob->obmat, ob->sculpt->last_stroke);
+
sculpt_cache_free(ss->cache);
ss->cache = NULL;