[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [37297] branches/soc-2011-onion/source/ blender/editors: == Pivot Last ==
Jason Wilkins
Jason.A.Wilkins at gmail.com
Tue Jun 7 17:45:55 CEST 2011
Revision: 37297
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=37297
Author: jwilkins
Date: 2011-06-07 15:45:54 +0000 (Tue, 07 Jun 2011)
Log Message:
-----------
== Pivot Last ==
Pivot last now works in vertex paint mode.
Generalized so that it works for any mode that uses paint stroke with a 'get_location' function, which is sculpt and vertex paint. Other paint modes should follow as things are generalized, but I'll make it work with the other modes if I can for now.
Modified Paths:
--------------
branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_stroke.c
branches/soc-2011-onion/source/blender/editors/sculpt_paint/sculpt.c
branches/soc-2011-onion/source/blender/editors/space_view3d/view3d_edit.c
Modified: branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_stroke.c
===================================================================
--- branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_stroke.c 2011-06-07 15:33:01 UTC (rev 37296)
+++ branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_stroke.c 2011-06-07 15:45:54 UTC (rev 37297)
@@ -1590,6 +1590,21 @@
stroke->last_mouse_position[1] = mouse[1];
stroke->update_step(C, stroke, &itemptr);
+
+ /* update last stroke location */
+ {
+ Object *ob= CTX_data_active_object(C);
+
+ if (ob && ob->paint) {
+ if (stroke->get_location) {
+ ob->paint->last_stroke_valid= 1;
+ copy_v3_v3(ob->paint->last_stroke, location);
+ }
+ else {
+ ob->paint->last_stroke_valid= 0;
+ }
+ }
+ }
}
/* Returns zero if no sculpt changes should be made, non-zero otherwise */
Modified: branches/soc-2011-onion/source/blender/editors/sculpt_paint/sculpt.c
===================================================================
--- branches/soc-2011-onion/source/blender/editors/sculpt_paint/sculpt.c 2011-06-07 15:33:01 UTC (rev 37296)
+++ branches/soc-2011-onion/source/blender/editors/sculpt_paint/sculpt.c 2011-06-07 15:45:54 UTC (rev 37297)
@@ -4111,11 +4111,6 @@
paint_brush_set(p, brush);
}
- /* update last stroke position */
- ob->paint->last_stroke_valid= 1;
- copy_v3_v3(ob->paint->last_stroke, ss->cache->true_location);
- mul_m4_v3(ob->obmat, ob->paint->last_stroke);
-
sculpt_cache_free(ss->cache);
ss->cache = NULL;
Modified: branches/soc-2011-onion/source/blender/editors/space_view3d/view3d_edit.c
===================================================================
--- branches/soc-2011-onion/source/blender/editors/space_view3d/view3d_edit.c 2011-06-07 15:33:01 UTC (rev 37296)
+++ branches/soc-2011-onion/source/blender/editors/space_view3d/view3d_edit.c 2011-06-07 15:45:54 UTC (rev 37297)
@@ -393,6 +393,7 @@
static float lastofs[3] = {0,0,0};
RegionView3D *rv3d;
ViewOpsData *vod= MEM_callocN(sizeof(ViewOpsData), "viewops data");
+ Object *ob= CTX_data_active_object(C);
float* last_stroke;
/* store data */
@@ -417,7 +418,7 @@
vod->use_dyn_ofs= 0;
- last_stroke= ED_paint_get_last_stroke(CTX_data_active_object(C));
+ last_stroke= ED_paint_get_last_stroke(ob);
if ((U.uiflag & USER_ORBIT_LAST_STROKE && last_stroke != NULL) ||
(U.uiflag & USER_ORBIT_SELECTION))
@@ -425,14 +426,15 @@
vod->use_dyn_ofs= 1;
}
- /* setup offset */
copy_v3_v3(vod->ofs, rv3d->ofs);
if (vod->use_dyn_ofs) {
+ /* last stroke takes priority over active object center */
if (last_stroke) {
- /* last stroke takes priority over active object center */
- negate_v3_v3(vod->dyn_ofs, last_stroke);
+ /* last_stroke is in object local space, dyn_ofs is in world space */
+ mul_v3_m4v3(vod->dyn_ofs, ob->obmat, last_stroke);
+ negate_v3(vod->dyn_ofs);
}
else {
/* If there's no selection, lastofs is unmodified and last value since static */
More information about the Bf-blender-cvs
mailing list