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:
authorSergey Sharybin <sergey.vfx@gmail.com>2013-06-09 16:53:17 +0400
committerSergey Sharybin <sergey.vfx@gmail.com>2013-06-09 16:53:17 +0400
commit40f21d829da56fe9202641be38190ceb2673ff07 (patch)
tree450e0035cee8a395825076e52e3a73fb9062147e
parentf3a4eab75134ef92d58edd02553fe6e9f74c8fde (diff)
Fix #35638: Object disappears when rotating after using the simplify brush
-rw-r--r--source/blender/editors/sculpt_paint/sculpt.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c
index 35bc006bb98..8533dd3bc48 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -120,7 +120,7 @@ float *ED_sculpt_get_last_stroke(struct Object *ob)
void ED_sculpt_get_average_stroke(Object *ob, float stroke[3])
{
- if (ob->sculpt->last_stroke_valid) {
+ if (ob->sculpt->last_stroke_valid && ob->sculpt->average_stroke_counter > 0) {
float fac = 1.0f / ob->sculpt->average_stroke_counter;
mul_v3_v3fl(stroke, ob->sculpt->average_stroke_accum, fac);
}
@@ -2980,6 +2980,7 @@ static void sculpt_topology_update(Sculpt *sd, Object *ob, Brush *brush)
/* Only act if some verts are inside the brush area */
if (totnode) {
PBVHTopologyUpdateMode mode = PBVH_Subdivide;
+ float location[3];
if ((sd->flags & SCULPT_DYNTOPO_COLLAPSE) ||
(brush->sculpt_tool == SCULPT_TOOL_SIMPLIFY))
@@ -3006,6 +3007,13 @@ static void sculpt_topology_update(Sculpt *sd, Object *ob, Brush *brush)
}
MEM_freeN(nodes);
+
+ /* update average stroke position */
+ copy_v3_v3(location, ss->cache->true_location);
+ mul_m4_v3(ob->obmat, location);
+
+ add_v3_v3(ob->sculpt->average_stroke_accum, location);
+ ob->sculpt->average_stroke_counter++;
}
}