Page MenuHome

Fix "Dimension" issues?
ActivePublic

Authored by Bastien Montagne (mont29) on Mar 15 2014, 12:55 PM.
diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c
index 0970af4..cbb29d4 100644
--- a/source/blender/blenkernel/intern/object.c
+++ b/source/blender/blenkernel/intern/object.c
@@ -2529,13 +2529,13 @@ void BKE_object_dimensions_set(Object *ob, const float *value)
mat4_to_size(scale, ob->obmat);
- len[0] = bb->vec[4][0] - bb->vec[0][0];
- len[1] = bb->vec[2][1] - bb->vec[0][1];
- len[2] = bb->vec[1][2] - bb->vec[0][2];
+ len[0] = fabsf(scale[0]) * (bb->vec[4][0] - bb->vec[0][0]);
+ len[1] = fabsf(scale[1]) * (bb->vec[2][1] - bb->vec[0][1]);
+ len[2] = fabsf(scale[2]) * (bb->vec[1][2] - bb->vec[0][2]);
- if (len[0] > 0.f) ob->size[0] = value[0] / len[0];
- if (len[1] > 0.f) ob->size[1] = value[1] / len[1];
- if (len[2] > 0.f) ob->size[2] = value[2] / len[2];
+ if (len[0] > 0.f) ob->size[0] *= value[0] / len[0];
+ if (len[1] > 0.f) ob->size[1] *= value[1] / len[1];
+ if (len[2] > 0.f) ob->size[2] *= value[2] / len[2];
}
}

Event Timeline

Bastien Montagne (mont29) changed the title of this paste from untitled to Fix "Dimension" issues?.
Bastien Montagne (mont29) updated the paste's language from autodetect to autodetect.
Bastien Montagne (mont29) updated the paste's language from autodetect to diff.Mar 15 2014, 12:58 PM