Commit: 5c5de14ad70d14c05b63602a946a6e72a45d6a4f
Author: Brecht Van Lommel
Date:   Thu Jan 31 12:36:00 2019 +0100
Branches: master
https://developer.blender.org/rB5c5de14ad70d14c05b63602a946a6e72a45d6a4f

Cleanup: avoid some unnecessary inverse matrix math.

===================================================================

M       source/blender/blenkernel/intern/object_update.c
M       source/blender/editors/sculpt_paint/sculpt.c

===================================================================

diff --git a/source/blender/blenkernel/intern/object_update.c 
b/source/blender/blenkernel/intern/object_update.c
index a716750ee73..5cf40cd13a4 100644
--- a/source/blender/blenkernel/intern/object_update.c
+++ b/source/blender/blenkernel/intern/object_update.c
@@ -282,7 +282,7 @@ void BKE_object_synchronize_to_original(Depsgraph 
*depsgraph, Object *object)
        object_orig->base_flag = object->base_flag;
        /* Transformation flags. */
        copy_m4_m4(object_orig->obmat, object->obmat);
-       invert_m4_m4(object_orig->imat, object_orig->obmat);
+       copy_m4_m4(object_orig->imat, object->imat);
        copy_m4_m4(object_orig->constinv, object->constinv);
        object_orig->transflag = object->transflag;
        object_orig->flag = object->flag;
diff --git a/source/blender/editors/sculpt_paint/sculpt.c 
b/source/blender/editors/sculpt_paint/sculpt.c
index f3a06988f1b..a9e5a243865 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -5168,8 +5168,8 @@ static void sculpt_stroke_update_step(bContext *C, struct 
PaintStroke *UNUSED(st
        sculpt_restore_mesh(sd, ob);
 
        if (sd->flags & (SCULPT_DYNTOPO_DETAIL_CONSTANT | 
SCULPT_DYNTOPO_DETAIL_MANUAL)) {
-               float object_space_constant_detail = sd->constant_detail * 
mat4_to_scale(ob->imat);
-               BKE_pbvh_bmesh_detail_size_set(ss->pbvh, 1.0f / 
object_space_constant_detail);
+               float object_space_constant_detail = mat4_to_scale(ob->obmat) / 
sd->constant_detail;
+               BKE_pbvh_bmesh_detail_size_set(ss->pbvh, 
object_space_constant_detail);
        }
        else if (sd->flags & SCULPT_DYNTOPO_DETAIL_BRUSH) {
                BKE_pbvh_bmesh_detail_size_set(ss->pbvh, ss->cache->radius * 
sd->detail_percent / 100.0f);
@@ -6115,8 +6115,8 @@ static int sculpt_detail_flood_fill_exec(bContext *C, 
wmOperator *UNUSED(op))
        size = max_fff(dim[0], dim[1], dim[2]);
 
        /* update topology size */
-       float object_space_constant_detail = sd->constant_detail * 
mat4_to_scale(ob->imat);
-       BKE_pbvh_bmesh_detail_size_set(ss->pbvh, 1.0f / 
object_space_constant_detail);
+       float object_space_constant_detail = mat4_to_scale(ob->obmat) / 
sd->constant_detail;
+       BKE_pbvh_bmesh_detail_size_set(ss->pbvh, object_space_constant_detail);
 
        sculpt_undo_push_begin("Dynamic topology flood fill");
        sculpt_undo_push_node(ob, NULL, SCULPT_UNDO_COORDS);

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to