[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [36458] trunk/blender: replace OBJECT_OT_location_apply, OBJECT_OT_scale_apply, OBJECT_OT_rotation_apply with OBJECT_OT_transform_apply with 3 boolean options .
Campbell Barton
ideasman42 at gmail.com
Tue May 3 09:09:02 CEST 2011
Revision: 36458
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=36458
Author: campbellbarton
Date: 2011-05-03 07:09:02 +0000 (Tue, 03 May 2011)
Log Message:
-----------
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.
Modified Paths:
--------------
trunk/blender/release/scripts/startup/bl_ui/space_view3d.py
trunk/blender/source/blender/editors/object/object_intern.h
trunk/blender/source/blender/editors/object/object_ops.c
trunk/blender/source/blender/editors/object/object_transform.c
Modified: trunk/blender/release/scripts/startup/bl_ui/space_view3d.py
===================================================================
--- trunk/blender/release/scripts/startup/bl_ui/space_view3d.py 2011-05-03 07:05:01 UTC (rev 36457)
+++ trunk/blender/release/scripts/startup/bl_ui/space_view3d.py 2011-05-03 07:09:02 UTC (rev 36458)
@@ -851,10 +851,15 @@
def draw(self, context):
layout = self.layout
- layout.operator("object.location_apply", text="Location")
- layout.operator("object.rotation_apply", text="Rotation")
- layout.operator("object.scale_apply", text="Scale")
+ layout.operator("object.transform_apply", text="Location").location = True
+ layout.operator("object.transform_apply", text="Rotation").rotation = True
+ layout.operator("object.transform_apply", text="Scale").scale = True
+ props = layout.operator("object.transform_apply", text="Rotation & Scale")
+ props.scale = True
+ props.rotation = True
+
layout.separator()
+
layout.operator("object.visual_transform_apply", text="Visual Transform")
layout.operator("object.duplicates_make_real")
Modified: trunk/blender/source/blender/editors/object/object_intern.h
===================================================================
--- trunk/blender/source/blender/editors/object/object_intern.h 2011-05-03 07:05:01 UTC (rev 36457)
+++ trunk/blender/source/blender/editors/object/object_intern.h 2011-05-03 07:09:02 UTC (rev 36458)
@@ -55,9 +55,7 @@
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 */
Modified: trunk/blender/source/blender/editors/object/object_ops.c
===================================================================
--- trunk/blender/source/blender/editors/object/object_ops.c 2011-05-03 07:05:01 UTC (rev 36457)
+++ trunk/blender/source/blender/editors/object/object_ops.c 2011-05-03 07:09:02 UTC (rev 36458)
@@ -65,9 +65,7 @@
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);
Modified: trunk/blender/source/blender/editors/object/object_transform.c
===================================================================
--- trunk/blender/source/blender/editors/object/object_transform.c 2011-05-03 07:05:01 UTC (rev 36457)
+++ trunk/blender/source/blender/editors/object/object_transform.c 2011-05-03 07:09:02 UTC (rev 36458)
@@ -386,7 +386,7 @@
}
}
-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,66 +595,39 @@
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);
-}
+ 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");
-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;
+ if(loc || rot || sca) {
+ return apply_objects_internal(C, op->reports, loc, rot, sca);
+ }
+ else {
+ return OPERATOR_CANCELLED;
+ }
}
-static int scale_apply_exec(bContext *C, wmOperator *op)
+void OBJECT_OT_transform_apply(wmOperatorType *ot)
{
- return apply_objects_internal(C, op->reports, 0, 1, 0);
-}
-
-void OBJECT_OT_scale_apply(wmOperatorType *ot)
-{
/* identifiers */
- ot->name= "Apply Scale";
- ot->description = "Apply the object's scale to its data";
- ot->idname= "OBJECT_OT_scale_apply";
-
+ ot->name= "Apply Object Transform";
+ ot->description = "Apply the object's transformation to its data";
+ ot->idname= "OBJECT_OT_transform_apply";
+
/* api callbacks */
- ot->exec= scale_apply_exec;
+ ot->exec= object_transform_apply_exec;
ot->poll= ED_operator_objectmode;
-
+
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
-}
-static int rotation_apply_exec(bContext *C, wmOperator *op)
-{
- return apply_objects_internal(C, op->reports, 0, 0, 1);
+ RNA_def_boolean(ot->srna, "location", 0, "Location", "");
+ RNA_def_boolean(ot->srna, "rotation", 0, "Rotation", "");
+ RNA_def_boolean(ot->srna, "scale", 0, "Scale", "");
}
-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->poll= ED_operator_objectmode;
-
- /* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
-}
-
/********************* Set Object Center ************************/
enum {
More information about the Bf-blender-cvs
mailing list