Specific operator for Push/Pull (no need to go through the generic operator and it...
authorMartin Poirier <theeth@yahoo.com>
Sun, 11 Apr 2010 16:04:11 +0000 (16:04 +0000)
committerMartin Poirier <theeth@yahoo.com>
Sun, 11 Apr 2010 16:04:11 +0000 (16:04 +0000)
release/scripts/ui/space_view3d.py
source/blender/editors/transform/transform_ops.c

index 01be3c1c30fcf58164242bd217a5ed04ca2085dc..85689e178eb9399d4c9537a4c79f5196ec85c652 100644 (file)
@@ -145,7 +145,7 @@ class VIEW3D_MT_transform(bpy.types.Menu):
         layout.operator("transform.tosphere", text="To Sphere")
         layout.operator("transform.shear", text="Shear")
         layout.operator("transform.warp", text="Warp")
-        layout.operator("transform.transform", text="Push/Pull").mode = 'PUSHPULL'
+        layout.operator("transform.push_pull", text="Push/Pull")
         if context.edit_object and context.edit_object.type == 'ARMATURE':
             layout.operator("armature.align")
         else:
index eba6482c8849e21e01718713d7a657d7a7fdf7b0..4571cc0ace92b48f8857796a1d52b8fc41f2406d 100644 (file)
@@ -61,6 +61,7 @@ char OP_RESIZE[] = "TRANSFORM_OT_resize";
 char OP_SHEAR[] = "TRANSFORM_OT_shear";
 char OP_WARP[] = "TRANSFORM_OT_warp";
 char OP_SHRINK_FATTEN[] = "TRANSFORM_OT_shrink_fatten";
+char OP_PUSH_PULL[] = "TRANSFORM_OT_push_pull";
 char OP_TILT[] = "TRANSFORM_OT_tilt";
 char OP_TRACKBALL[] = "TRANSFORM_OT_trackball";
 char OP_MIRROR[] = "TRANSFORM_OT_mirror";
@@ -75,6 +76,7 @@ void TRANSFORM_OT_resize(struct wmOperatorType *ot);
 void TRANSFORM_OT_shear(struct wmOperatorType *ot);
 void TRANSFORM_OT_warp(struct wmOperatorType *ot);
 void TRANSFORM_OT_shrink_fatten(struct wmOperatorType *ot);
+void TRANSFORM_OT_push_pull(struct wmOperatorType *ot);
 void TRANSFORM_OT_tilt(struct wmOperatorType *ot);
 void TRANSFORM_OT_trackball(struct wmOperatorType *ot);
 void TRANSFORM_OT_mirror(struct wmOperatorType *ot);
@@ -91,6 +93,7 @@ TransformModeItem transform_modes[] =
        {OP_SHEAR, TFM_SHEAR, TRANSFORM_OT_shear},
        {OP_WARP, TFM_WARP, TRANSFORM_OT_warp},
        {OP_SHRINK_FATTEN, TFM_SHRINKFATTEN, TRANSFORM_OT_shrink_fatten},
+       {OP_PUSH_PULL, TFM_PUSHPULL, TRANSFORM_OT_push_pull},
        {OP_TILT, TFM_TILT, TRANSFORM_OT_tilt},
        {OP_TRACKBALL, TFM_TRACKBALL, TRANSFORM_OT_trackball},
        {OP_MIRROR, TFM_MIRROR, TRANSFORM_OT_mirror},
@@ -579,6 +582,26 @@ void TRANSFORM_OT_shear(struct wmOperatorType *ot)
        // XXX Shear axis?
 }
 
+void TRANSFORM_OT_push_pull(struct wmOperatorType *ot)
+{
+       /* identifiers */
+       ot->name   = "Push/Pull";
+       ot->description= "Push/Pull selected items";
+       ot->idname = OP_PUSH_PULL;
+       ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING;
+
+       /* api callbacks */
+       ot->invoke = transform_invoke;
+       ot->exec   = transform_exec;
+       ot->modal  = transform_modal;
+       ot->cancel  = transform_cancel;
+       ot->poll   = ED_operator_areaactive;
+
+       RNA_def_float(ot->srna, "value", 0, -FLT_MAX, FLT_MAX, "Distance", "", -FLT_MAX, FLT_MAX);
+
+       Transform_Properties(ot, P_PROPORTIONAL|P_MIRROR|P_SNAP);
+}
+
 void TRANSFORM_OT_shrink_fatten(struct wmOperatorType *ot)
 {
        /* identifiers */