diff options
author | Campbell Barton <ideasman42@gmail.com> | 2014-10-28 17:53:31 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2014-10-28 17:55:35 +0300 |
commit | ba76f0c6a29e3955ead99b32d2fb41c534c1dbc5 (patch) | |
tree | 8b1c4b79d8ec44ee2e3c326035e667e11f045d4d | |
parent | ee4fb233618c0842e216042f442fbbc4d000b0bb (diff) |
Lattice: add-object radius should never scale data
own error, lattice assumes rest state is unscaled data,
scaling needs to be done in object mode.
-rw-r--r-- | source/blender/editors/object/object_add.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c index 8972dd7cf08..24dcf85cec8 100644 --- a/source/blender/editors/object/object_add.c +++ b/source/blender/editors/object/object_add.c @@ -449,14 +449,23 @@ static int object_add_exec(bContext *C, wmOperator *op) Object *ob; bool enter_editmode; unsigned int layer; - float loc[3], rot[3]; + float loc[3], rot[3], radius; WM_operator_view3d_unit_defaults(C, op); if (!ED_object_add_generic_get_opts(C, op, 'Z', loc, rot, &enter_editmode, &layer, NULL)) return OPERATOR_CANCELLED; + radius = RNA_float_get(op->ptr, "radius"); ob = ED_object_add_type(C, RNA_enum_get(op->ptr, "type"), loc, rot, enter_editmode, layer); - BKE_object_obdata_size_init(ob, RNA_float_get(op->ptr, "radius")); + + if (ob->type == OB_LATTICE) { + /* lattice is a special case! + * we never want to scale the obdata since that is the rest-state */ + copy_v3_fl(ob->size, radius); + } + else { + BKE_object_obdata_size_init(ob, radius); + } return OPERATOR_FINISHED; } |