diff options
Diffstat (limited to 'source/blender/editors/object')
-rw-r--r-- | source/blender/editors/object/object_add.c | 4 | ||||
-rw-r--r-- | source/blender/editors/object/object_bake.c | 2 | ||||
-rw-r--r-- | source/blender/editors/object/object_constraint.c | 2 | ||||
-rw-r--r-- | source/blender/editors/object/object_edit.c | 18 | ||||
-rw-r--r-- | source/blender/editors/object/object_group.c | 2 | ||||
-rw-r--r-- | source/blender/editors/object/object_hook.c | 2 | ||||
-rw-r--r-- | source/blender/editors/object/object_intern.h | 8 | ||||
-rw-r--r-- | source/blender/editors/object/object_lattice.c | 1 | ||||
-rw-r--r-- | source/blender/editors/object/object_modifier.c | 2 | ||||
-rw-r--r-- | source/blender/editors/object/object_ops.c | 2 | ||||
-rw-r--r-- | source/blender/editors/object/object_relations.c | 2 | ||||
-rw-r--r-- | source/blender/editors/object/object_select.c | 2 | ||||
-rw-r--r-- | source/blender/editors/object/object_shapekey.c | 8 | ||||
-rw-r--r-- | source/blender/editors/object/object_transform.c | 118 | ||||
-rw-r--r-- | source/blender/editors/object/object_vgroup.c | 5 |
15 files changed, 75 insertions, 103 deletions
diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c index 67cae8d4155..aa3b7f9422a 100644 --- a/source/blender/editors/object/object_add.c +++ b/source/blender/editors/object/object_add.c @@ -49,12 +49,10 @@ #include "BKE_constraint.h" #include "BKE_context.h" #include "BKE_curve.h" -#include "BKE_customdata.h" #include "BKE_depsgraph.h" #include "BKE_DerivedMesh.h" #include "BKE_displist.h" #include "BKE_effect.h" -#include "BKE_global.h" #include "BKE_group.h" #include "BKE_lattice.h" #include "BKE_library.h" @@ -67,9 +65,7 @@ #include "BKE_particle.h" #include "BKE_report.h" #include "BKE_sca.h" -#include "BKE_scene.h" #include "BKE_texture.h" -#include "BKE_utildefines.h" #include "RNA_access.h" #include "RNA_define.h" diff --git a/source/blender/editors/object/object_bake.c b/source/blender/editors/object/object_bake.c index 6261c33a6f7..98252723816 100644 --- a/source/blender/editors/object/object_bake.c +++ b/source/blender/editors/object/object_bake.c @@ -48,8 +48,6 @@ #include "BKE_global.h" #include "BKE_image.h" #include "BKE_main.h" -#include "BKE_object.h" -#include "BKE_utildefines.h" #include "BKE_report.h" #include "RE_pipeline.h" diff --git a/source/blender/editors/object/object_constraint.c b/source/blender/editors/object/object_constraint.c index 8f83a412c96..de4a931e069 100644 --- a/source/blender/editors/object/object_constraint.c +++ b/source/blender/editors/object/object_constraint.c @@ -40,6 +40,7 @@ #include "DNA_curve_types.h" #include "DNA_scene_types.h" #include "DNA_text_types.h" +#include "DNA_object_types.h" #include "BKE_action.h" #include "BKE_armature.h" @@ -50,7 +51,6 @@ #include "BKE_main.h" #include "BKE_object.h" #include "BKE_report.h" -#include "BKE_utildefines.h" #include "BIK_api.h" #ifndef DISABLE_PYTHON diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c index 18da264336e..8bbe5a1b0ab 100644 --- a/source/blender/editors/object/object_edit.c +++ b/source/blender/editors/object/object_edit.c @@ -51,43 +51,25 @@ #include "BLI_ghash.h" #include "BLI_rand.h" -#include "BKE_action.h" #include "BKE_anim.h" -#include "BKE_armature.h" #include "BKE_constraint.h" #include "BKE_context.h" -#include "BKE_customdata.h" -#include "BKE_blender.h" #include "BKE_cloth.h" #include "BKE_curve.h" -#include "BKE_displist.h" #include "BKE_depsgraph.h" -#include "BKE_DerivedMesh.h" -#include "BKE_effect.h" #include "BKE_font.h" -#include "BKE_global.h" -#include "BKE_group.h" #include "BKE_image.h" -#include "BKE_key.h" -#include "BKE_lattice.h" #include "BKE_library.h" #include "BKE_main.h" #include "BKE_material.h" #include "BKE_mball.h" #include "BKE_mesh.h" -#include "BKE_nla.h" #include "BKE_object.h" #include "BKE_paint.h" -#include "BKE_particle.h" #include "BKE_pointcache.h" #include "BKE_property.h" -#include "BKE_report.h" #include "BKE_sca.h" -#include "BKE_scene.h" #include "BKE_softbody.h" -#include "BKE_subsurf.h" -#include "BKE_texture.h" -#include "BKE_utildefines.h" #include "BKE_modifier.h" #include "ED_armature.h" diff --git a/source/blender/editors/object/object_group.c b/source/blender/editors/object/object_group.c index b0a6c6471a2..8a0e598af9f 100644 --- a/source/blender/editors/object/object_group.c +++ b/source/blender/editors/object/object_group.c @@ -39,11 +39,9 @@ #include "BKE_context.h" #include "BKE_depsgraph.h" -#include "BKE_global.h" #include "BKE_group.h" #include "BKE_main.h" #include "BKE_report.h" -#include "BKE_scene.h" #include "ED_screen.h" diff --git a/source/blender/editors/object/object_hook.c b/source/blender/editors/object/object_hook.c index fefefae586c..2ee82a194cc 100644 --- a/source/blender/editors/object/object_hook.c +++ b/source/blender/editors/object/object_hook.c @@ -43,7 +43,6 @@ #include "BKE_action.h" #include "BKE_context.h" -#include "BKE_customdata.h" #include "BKE_depsgraph.h" #include "BKE_main.h" #include "BKE_mesh.h" @@ -51,7 +50,6 @@ #include "BKE_object.h" #include "BKE_report.h" #include "BKE_scene.h" -#include "BKE_utildefines.h" #include "RNA_define.h" #include "RNA_access.h" diff --git a/source/blender/editors/object/object_intern.h b/source/blender/editors/object/object_intern.h index 3c22ccdad8f..bd48db2f780 100644 --- a/source/blender/editors/object/object_intern.h +++ b/source/blender/editors/object/object_intern.h @@ -131,10 +131,10 @@ void OBJECT_OT_hook_reset(struct wmOperatorType *ot); void OBJECT_OT_hook_recenter(struct wmOperatorType *ot); /* object_lattice.c */ -void free_editLatt(Object *ob); -void make_editLatt(Object *obedit); -void load_editLatt(Object *obedit); -void remake_editLatt(Object *obedit); +void free_editLatt(struct Object *ob); +void make_editLatt(struct Object *obedit); +void load_editLatt(struct Object *obedit); +void remake_editLatt(struct Object *obedit); void LATTICE_OT_select_all(struct wmOperatorType *ot); void LATTICE_OT_make_regular(struct wmOperatorType *ot); diff --git a/source/blender/editors/object/object_lattice.c b/source/blender/editors/object/object_lattice.c index 52f779748fa..a1fb10e350e 100644 --- a/source/blender/editors/object/object_lattice.c +++ b/source/blender/editors/object/object_lattice.c @@ -45,7 +45,6 @@ #include "BKE_key.h" #include "BKE_lattice.h" #include "BKE_mesh.h" -#include "BKE_utildefines.h" #include "ED_screen.h" #include "ED_view3d.h" diff --git a/source/blender/editors/object/object_modifier.c b/source/blender/editors/object/object_modifier.c index a54ed9bd239..286e953a69a 100644 --- a/source/blender/editors/object/object_modifier.c +++ b/source/blender/editors/object/object_modifier.c @@ -43,7 +43,6 @@ #include "BLI_string.h" #include "BLI_path_util.h" -#include "BKE_action.h" #include "BKE_curve.h" #include "BKE_context.h" #include "BKE_depsgraph.h" @@ -61,7 +60,6 @@ #include "BKE_object.h" #include "BKE_particle.h" #include "BKE_softbody.h" -#include "BKE_utildefines.h" #include "RNA_access.h" #include "RNA_define.h" diff --git a/source/blender/editors/object/object_ops.c b/source/blender/editors/object/object_ops.c index 610a82d964c..97dc6f7486c 100644 --- a/source/blender/editors/object/object_ops.c +++ b/source/blender/editors/object/object_ops.c @@ -38,8 +38,6 @@ #include "BLI_blenlib.h" #include "BKE_context.h" -#include "BKE_global.h" -#include "BKE_utildefines.h" #include "RNA_access.h" #include "RNA_define.h" diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c index 463db871f55..23bcf5309c5 100644 --- a/source/blender/editors/object/object_relations.c +++ b/source/blender/editors/object/object_relations.c @@ -41,6 +41,7 @@ #include "DNA_particle_types.h" #include "DNA_scene_types.h" #include "DNA_world_types.h" +#include "DNA_object_types.h" #include "BLI_math.h" #include "BLI_editVert.h" @@ -68,7 +69,6 @@ #include "BKE_sca.h" #include "BKE_scene.h" #include "BKE_texture.h" -#include "BKE_utildefines.h" #include "WM_api.h" #include "WM_types.h" diff --git a/source/blender/editors/object/object_select.c b/source/blender/editors/object/object_select.c index 3c86c135914..accdb67fb99 100644 --- a/source/blender/editors/object/object_select.c +++ b/source/blender/editors/object/object_select.c @@ -44,7 +44,6 @@ #include "BLI_string.h" #include "BKE_context.h" -#include "BKE_depsgraph.h" #include "BKE_group.h" #include "BKE_main.h" #include "BKE_material.h" @@ -52,7 +51,6 @@ #include "BKE_property.h" #include "BKE_report.h" #include "BKE_scene.h" -#include "BKE_utildefines.h" #include "BKE_deform.h" #include "WM_api.h" diff --git a/source/blender/editors/object/object_shapekey.c b/source/blender/editors/object/object_shapekey.c index 6735d07b591..7b1ab933e28 100644 --- a/source/blender/editors/object/object_shapekey.c +++ b/source/blender/editors/object/object_shapekey.c @@ -45,20 +45,14 @@ #include "DNA_mesh_types.h" #include "DNA_meshdata_types.h" #include "DNA_scene_types.h" +#include "DNA_object_types.h" -#include "BKE_action.h" -#include "BKE_anim.h" #include "BKE_context.h" -#include "BKE_curve.h" #include "BKE_depsgraph.h" -#include "BKE_global.h" -#include "BKE_ipo.h" #include "BKE_key.h" #include "BKE_library.h" #include "BKE_main.h" -#include "BKE_mesh.h" #include "BKE_object.h" -#include "BKE_utildefines.h" #include "BLO_sys_types.h" // for intptr_t support diff --git a/source/blender/editors/object/object_transform.c b/source/blender/editors/object/object_transform.c index d7961a8cd2b..bbafde60755 100644 --- a/source/blender/editors/object/object_transform.c +++ b/source/blender/editors/object/object_transform.c @@ -34,6 +34,7 @@ #include "DNA_meshdata_types.h" #include "DNA_object_types.h" #include "DNA_scene_types.h" +#include "DNA_group_types.h" #include "BLI_math.h" #include "BLI_editVert.h" @@ -42,12 +43,10 @@ #include "BKE_context.h" #include "BKE_curve.h" #include "BKE_depsgraph.h" -#include "BKE_global.h" #include "BKE_main.h" #include "BKE_mesh.h" #include "BKE_object.h" #include "BKE_report.h" -#include "BKE_utildefines.h" #include "RNA_define.h" #include "RNA_access.h" @@ -774,14 +773,45 @@ static int object_origin_set_exec(bContext *C, wmOperator *op) for (tob= bmain->object.first; tob; tob= tob->id.next) { if(tob->data) ((ID *)tob->data)->flag &= ~LIB_DOIT; + if(tob->dup_group) + ((ID *)tob->dup_group)->flag &= ~LIB_DOIT; } CTX_DATA_BEGIN(C, Object*, ob, selected_editable_objects) { if((ob->flag & OB_DONE)==0) { + int do_inverse_offset = FALSE; ob->flag |= OB_DONE; + if(centermode == ORIGIN_TO_CURSOR) { + copy_v3_v3(cent, cursor); + invert_m4_m4(ob->imat, ob->obmat); + mul_m4_v3(ob->imat, cent); + } + if(ob->data == NULL) { - /* pass */ + /* special support for dupligroups */ + if((ob->transflag & OB_DUPLIGROUP) && ob->dup_group && (ob->dup_group->id.flag & LIB_DOIT)==0) { + if(ob->dup_group->id.lib) { + tot_lib_error++; + } + else { + if(centermode == ORIGIN_TO_CURSOR) { /* done */ } + else { + /* only bounds support */ + INIT_MINMAX(min, max); + minmax_object_duplis(scene, ob, min, max); + mid_v3_v3v3(cent, min, max); + invert_m4_m4(ob->imat, ob->obmat); + mul_m4_v3(ob->imat, cent); + } + + add_v3_v3(ob->dup_group->dupli_ofs, cent); + + tot_change++; + ob->dup_group->id.flag |= LIB_DOIT; + do_inverse_offset= TRUE; + } + } } else if (((ID *)ob->data)->lib) { tot_lib_error++; @@ -790,40 +820,26 @@ static int object_origin_set_exec(bContext *C, wmOperator *op) if(obedit==NULL && ob->type==OB_MESH) { Mesh *me= ob->data; - if(centermode == ORIGIN_TO_CURSOR) { - copy_v3_v3(cent, cursor); - invert_m4_m4(ob->imat, ob->obmat); - mul_m4_v3(ob->imat, cent); - } else { - if(around==V3D_CENTROID) - mesh_center_median(me, cent); - else - mesh_center_bounds(me, cent); - } + if(centermode == ORIGIN_TO_CURSOR) { /* done */ } + else if(around==V3D_CENTROID) { mesh_center_median(me, cent); } + else { mesh_center_bounds(me, cent); } negate_v3_v3(cent_neg, cent); mesh_translate(me, cent_neg, 1); tot_change++; me->id.flag |= LIB_DOIT; + do_inverse_offset= TRUE; } else if (ELEM(ob->type, OB_CURVE, OB_SURF)) { Curve *cu= ob->data; - if(centermode == ORIGIN_TO_CURSOR) { - copy_v3_v3(cent, cursor); - invert_m4_m4(ob->imat, ob->obmat); - mul_m4_v3(ob->imat, cent); - } - else { - if(around==V3D_CENTROID) - curve_center_median(cu, cent); - else - curve_center_bounds(cu, cent); - } + if(centermode == ORIGIN_TO_CURSOR) { /* done */ } + else if(around==V3D_CENTROID) { curve_center_median(cu, cent); } + else { curve_center_bounds(cu, cent); } /* don't allow Z change if curve is 2D */ - if( !( cu->flag & CU_3D ) ) + if((ob->type == OB_CURVE) && !(cu->flag & CU_3D)) cent[2] = 0.0; negate_v3_v3(cent_neg, cent); @@ -831,6 +847,7 @@ static int object_origin_set_exec(bContext *C, wmOperator *op) tot_change++; cu->id.flag |= LIB_DOIT; + do_inverse_offset= TRUE; if(obedit) { if (centermode == GEOMETRY_TO_ORIGIN) { @@ -849,9 +866,7 @@ static int object_origin_set_exec(bContext *C, wmOperator *op) } else { if(centermode == ORIGIN_TO_CURSOR) { - copy_v3_v3(cent, cursor); - invert_m4_m4(ob->imat, ob->obmat); - mul_m4_v3(ob->imat, cent); + /* done */ } else { cent[0]= 0.5f * ( cu->bb->vec[4][0] + cu->bb->vec[0][0]); @@ -865,6 +880,7 @@ static int object_origin_set_exec(bContext *C, wmOperator *op) tot_change++; cu->id.flag |= LIB_DOIT; + do_inverse_offset= TRUE; } } else if(ob->type==OB_ARMATURE) { @@ -883,6 +899,7 @@ static int object_origin_set_exec(bContext *C, wmOperator *op) tot_change++; arm->id.flag |= LIB_DOIT; + /* do_inverse_offset= TRUE; */ /* docenter_armature() handles this */ where_is_object(scene, ob); ignore_parent_tx(bmain, scene, ob); @@ -893,33 +910,34 @@ static int object_origin_set_exec(bContext *C, wmOperator *op) } /* offset other selected objects */ - if(centermode != GEOMETRY_TO_ORIGIN) { + if(do_inverse_offset && (centermode != GEOMETRY_TO_ORIGIN)) { /* was the object data modified * note: the functions above must set 'cent' */ - if(ob->data && (((ID *)ob->data)->flag && LIB_DOIT) && ob->type != OB_ARMATURE) { - copy_v3_v3(centn, cent); - mul_mat3_m4_v3(ob->obmat, centn); /* ommit translation part */ - add_v3_v3(ob->loc, centn); - - where_is_object(scene, ob); - ignore_parent_tx(bmain, scene, ob); + copy_v3_v3(centn, cent); + mul_mat3_m4_v3(ob->obmat, centn); /* ommit translation part */ + add_v3_v3(ob->loc, centn); - /* other users? */ - CTX_DATA_BEGIN(C, Object*, ob_other, selected_editable_objects) { - if((ob_other->flag & OB_DONE)==0 && (ob_other->data == ob->data)) { - ob_other->flag |= OB_DONE; - ob_other->recalc= OB_RECALC_OB|OB_RECALC_DATA; - - copy_v3_v3(centn, cent); - mul_mat3_m4_v3(ob_other->obmat, centn); /* ommit translation part */ - add_v3_v3(ob_other->loc, centn); - - where_is_object(scene, ob_other); - ignore_parent_tx(bmain, scene, ob_other); - } + where_is_object(scene, ob); + ignore_parent_tx(bmain, scene, ob); + + /* other users? */ + CTX_DATA_BEGIN(C, Object*, ob_other, selected_editable_objects) { + if( (ob_other->flag & OB_DONE)==0 && + ( (ob->data && (ob->data == ob_other->data)) || + (ob->dup_group==ob_other->dup_group && (ob->transflag|ob_other->transflag) & OB_DUPLIGROUP) ) + ) { + ob_other->flag |= OB_DONE; + ob_other->recalc= OB_RECALC_OB|OB_RECALC_DATA; + + copy_v3_v3(centn, cent); + mul_mat3_m4_v3(ob_other->obmat, centn); /* ommit translation part */ + add_v3_v3(ob_other->loc, centn); + + where_is_object(scene, ob_other); + ignore_parent_tx(bmain, scene, ob_other); } - CTX_DATA_END; } + CTX_DATA_END; } } } diff --git a/source/blender/editors/object/object_vgroup.c b/source/blender/editors/object/object_vgroup.c index ff48e7e349a..86f0c5fa874 100644 --- a/source/blender/editors/object/object_vgroup.c +++ b/source/blender/editors/object/object_vgroup.c @@ -50,13 +50,8 @@ #include "BKE_customdata.h" #include "BKE_deform.h" #include "BKE_depsgraph.h" -#include "BKE_DerivedMesh.h" -#include "BKE_displist.h" #include "BKE_global.h" -#include "BKE_lattice.h" #include "BKE_mesh.h" -#include "BKE_paint.h" -#include "BKE_utildefines.h" #include "BKE_report.h" #include "RNA_access.h" |