diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-05-03 11:09:02 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-05-03 11:09:02 +0400 |
commit | 0a415b6e7179f2bf734b216746035bc9af559a1d (patch) | |
tree | 2c07c583e2e750ef93d2c0570cd96f0ea1bb6409 /source | |
parent | 08a914095e75ee7b45b7f188e0db9f87c10b480c (diff) |
replace OBJECT_OT_location_apply, OBJECT_OT_scale_apply, OBJECT_OT_rotation_apply with OBJECT_OT_transform_apply with 3 boolean options.
added back menu item from 2.4x to apply Rotation & Scale.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/editors/object/object_intern.h | 4 | ||||
-rw-r--r-- | source/blender/editors/object/object_ops.c | 4 | ||||
-rw-r--r-- | source/blender/editors/object/object_transform.c | 69 |
3 files changed, 23 insertions, 54 deletions
diff --git a/source/blender/editors/object/object_intern.h b/source/blender/editors/object/object_intern.h index dfaffe73209..801880f0f32 100644 --- a/source/blender/editors/object/object_intern.h +++ b/source/blender/editors/object/object_intern.h @@ -55,9 +55,7 @@ void OBJECT_OT_rotation_clear(struct wmOperatorType *ot); void OBJECT_OT_scale_clear(struct wmOperatorType *ot); void OBJECT_OT_origin_clear(struct wmOperatorType *ot); void OBJECT_OT_visual_transform_apply(struct wmOperatorType *ot); -void OBJECT_OT_location_apply(struct wmOperatorType *ot); -void OBJECT_OT_scale_apply(struct wmOperatorType *ot); -void OBJECT_OT_rotation_apply(struct wmOperatorType *ot); +void OBJECT_OT_transform_apply(struct wmOperatorType *ot); void OBJECT_OT_origin_set(struct wmOperatorType *ot); /* object_relations.c */ diff --git a/source/blender/editors/object/object_ops.c b/source/blender/editors/object/object_ops.c index 04152369a7e..ff9b13379a2 100644 --- a/source/blender/editors/object/object_ops.c +++ b/source/blender/editors/object/object_ops.c @@ -65,9 +65,7 @@ void ED_operatortypes_object(void) WM_operatortype_append(OBJECT_OT_scale_clear); WM_operatortype_append(OBJECT_OT_origin_clear); WM_operatortype_append(OBJECT_OT_visual_transform_apply); - WM_operatortype_append(OBJECT_OT_location_apply); - WM_operatortype_append(OBJECT_OT_scale_apply); - WM_operatortype_append(OBJECT_OT_rotation_apply); + WM_operatortype_append(OBJECT_OT_transform_apply); WM_operatortype_append(OBJECT_OT_origin_set); WM_operatortype_append(OBJECT_OT_mode_set); diff --git a/source/blender/editors/object/object_transform.c b/source/blender/editors/object/object_transform.c index 04600080eb8..bce16ceeed2 100644 --- a/source/blender/editors/object/object_transform.c +++ b/source/blender/editors/object/object_transform.c @@ -386,7 +386,7 @@ static void ignore_parent_tx(Main *bmain, Scene *scene, Object *ob ) } } -static int apply_objects_internal(bContext *C, ReportList *reports, int apply_loc, int apply_scale, int apply_rot) +static int apply_objects_internal(bContext *C, ReportList *reports, int apply_loc, int apply_rot, int apply_scale) { Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); @@ -595,64 +595,37 @@ void OBJECT_OT_visual_transform_apply(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; } -static int location_apply_exec(bContext *C, wmOperator *op) +static int object_transform_apply_exec(bContext *C, wmOperator *op) { - return apply_objects_internal(C, op->reports, 1, 0, 0); -} - -void OBJECT_OT_location_apply(wmOperatorType *ot) -{ - /* identifiers */ - ot->name= "Apply Location"; - ot->description = "Apply the object's location to its data"; - ot->idname= "OBJECT_OT_location_apply"; - - /* api callbacks */ - ot->exec= location_apply_exec; - ot->poll= ED_operator_objectmode; /* editmode will crash */ - - /* flags */ - ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; -} + const int loc= RNA_boolean_get(op->ptr, "location"); + const int rot= RNA_boolean_get(op->ptr, "rotation"); + const int sca= RNA_boolean_get(op->ptr, "scale"); -static int scale_apply_exec(bContext *C, wmOperator *op) -{ - return apply_objects_internal(C, op->reports, 0, 1, 0); + if(loc || rot || sca) { + return apply_objects_internal(C, op->reports, loc, rot, sca); + } + else { + return OPERATOR_CANCELLED; + } } -void OBJECT_OT_scale_apply(wmOperatorType *ot) +void OBJECT_OT_transform_apply(wmOperatorType *ot) { /* identifiers */ - ot->name= "Apply Scale"; - ot->description = "Apply the object's scale to its data"; - ot->idname= "OBJECT_OT_scale_apply"; - - /* api callbacks */ - ot->exec= scale_apply_exec; - ot->poll= ED_operator_objectmode; - - /* flags */ - ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; -} + ot->name= "Apply Object Transform"; + ot->description = "Apply the object's transformation to its data"; + ot->idname= "OBJECT_OT_transform_apply"; -static int rotation_apply_exec(bContext *C, wmOperator *op) -{ - return apply_objects_internal(C, op->reports, 0, 0, 1); -} - -void OBJECT_OT_rotation_apply(wmOperatorType *ot) -{ - /* identifiers */ - ot->name= "Apply Rotation"; - ot->description = "Apply the object's rotation to its data"; - ot->idname= "OBJECT_OT_rotation_apply"; - /* api callbacks */ - ot->exec= rotation_apply_exec; + ot->exec= object_transform_apply_exec; ot->poll= ED_operator_objectmode; - + /* flags */ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; + + RNA_def_boolean(ot->srna, "location", 0, "Location", ""); + RNA_def_boolean(ot->srna, "rotation", 0, "Rotation", ""); + RNA_def_boolean(ot->srna, "scale", 0, "Scale", ""); } /********************* Set Object Center ************************/ |