Todo item: brought transform texture space back.
authorTon Roosendaal <ton@blender.org>
Wed, 5 Jan 2011 17:27:26 +0000 (17:27 +0000)
committerTon Roosendaal <ton@blender.org>
Wed, 5 Jan 2011 17:27:26 +0000 (17:27 +0000)
Code changes are minimal, re-using the code as already was there.

Options are in pulldown menu, or SHIFT+T and SHIFT+ALT+T

Might be that Martin likes to see it different... do we need
a special operatortype for it?

release/scripts/ui/space_view3d.py
source/blender/editors/include/ED_transform.h
source/blender/editors/transform/transform.c
source/blender/editors/transform/transform_conversions.c
source/blender/editors/transform/transform_ops.c

index 3ca751eeed95ec3046d31ba5b695266d29112671..e60440d33eaf556cdb5146d48782e2dd10441c38 100644 (file)
@@ -152,6 +152,13 @@ class VIEW3D_MT_transform(bpy.types.Menu):
         layout.operator("transform.warp", text="Warp")
         layout.operator("transform.push_pull", text="Push/Pull")
 
+        layout.separator()
+
+        layout.operator("transform.translate", text="Move Texture Space").texture_space = True
+        layout.operator("transform.resize", text="Scale Texture Space").texture_space = True
+
+        layout.separator()
+
         obj = context.object
         if obj.type == 'ARMATURE' and obj.mode in ('EDIT', 'POSE') and obj.data.draw_type in ('BBONE', 'ENVELOPE'):
             layout.operator("transform.transform", text="Scale Envelope/BBone").mode = 'BONE_SIZE'
index c9139a503f13f7fba948e9778993128daf0292c8..5864449a490fe8add94e64eaa41028b9fc045cc6 100644 (file)
@@ -142,6 +142,7 @@ void BIF_selectOrientation(void);
 #define P_GEO_SNAP             (P_SNAP|(1 << 4))
 #define P_ALIGN_SNAP   (P_GEO_SNAP|(1 << 5))
 #define P_CONSTRAINT   (1 << 6)
+#define P_OPTIONS              (1 << 7)
 
 void Transform_Properties(struct wmOperatorType *ot, int flags);
 
index 7d32ee69a5eae4bd98d36a73e10744d33e558a58..2b1746f0e9657e35a061490a066ace09946a7e8a 100644 (file)
@@ -1499,6 +1499,9 @@ int initTransform(bContext *C, TransInfo *t, wmOperator *op, wmEvent *event, int
 
        t->state = TRANS_STARTING;
 
+       if(RNA_boolean_get(op->ptr, "texture_space"))
+               options |= CTX_TEXTURE;
+       
        t->options = options;
 
        t->mode = mode;
index df267254d8fdbed2c09c0183571f22170c1431cc..333f0731289b75b57a3a26b24e63e1e36a32b6d1 100644 (file)
@@ -268,6 +268,7 @@ static void createTransTexspace(TransInfo *t)
        invert_m3_m3(td->smtx, td->mtx);
 
        if (give_obdata_texspace(ob, &texflag, &td->loc, &td->ext->size, &td->ext->rot)) {
+               ob->dtx |= OB_TEXSPACE;
                *texflag &= ~AUTOSPACE;
        }
 
index 322bb7cb7db4b754db2ed0e1bfaffbc4ef07f013..1854e05b574156bef2067b5de222de1cb8c6484f 100644 (file)
@@ -444,6 +444,11 @@ void Transform_Properties(struct wmOperatorType *ot, int flags)
                        }
                }
        }
+       
+       if (flags & P_OPTIONS)
+       {
+               RNA_def_boolean(ot->srna, "texture_space", 0, "Edit Object data texture space", "");
+       }
 
        // Add confirm method all the time. At the end because it's not really that important and should be hidden only in log, not in keymap edit
        prop = RNA_def_boolean(ot->srna, "release_confirm", 0, "Confirm on Release", "Always confirm operation when releasing button");
@@ -467,7 +472,7 @@ void TRANSFORM_OT_translate(struct wmOperatorType *ot)
 
        RNA_def_float_vector_xyz(ot->srna, "value", 3, NULL, -FLT_MAX, FLT_MAX, "Vector", "", -FLT_MAX, FLT_MAX);
 
-       Transform_Properties(ot, P_CONSTRAINT|P_PROPORTIONAL|P_MIRROR|P_ALIGN_SNAP);
+       Transform_Properties(ot, P_CONSTRAINT|P_PROPORTIONAL|P_MIRROR|P_ALIGN_SNAP|P_OPTIONS);
 }
 
 void TRANSFORM_OT_resize(struct wmOperatorType *ot)
@@ -487,7 +492,7 @@ void TRANSFORM_OT_resize(struct wmOperatorType *ot)
 
        RNA_def_float_vector(ot->srna, "value", 3, VecOne, -FLT_MAX, FLT_MAX, "Vector", "", -FLT_MAX, FLT_MAX);
 
-       Transform_Properties(ot, P_CONSTRAINT|P_PROPORTIONAL|P_MIRROR|P_GEO_SNAP);
+       Transform_Properties(ot, P_CONSTRAINT|P_PROPORTIONAL|P_MIRROR|P_GEO_SNAP|P_OPTIONS);
 }
 
 
@@ -854,6 +859,13 @@ void transform_keymap_for_space(wmKeyConfig *keyconf, wmKeyMap *keymap, int spac
                        RNA_string_set(km->ptr, "data_path", "tool_settings.use_snap");
 
                        km = WM_keymap_add_item(keymap, "TRANSFORM_OT_snap_type", TABKEY, KM_PRESS, KM_SHIFT|KM_CTRL, 0);
+                       
+                       km = WM_keymap_add_item(keymap, OP_TRANSLATION, TKEY, KM_PRESS, KM_SHIFT, 0);
+                       RNA_boolean_set(km->ptr, "texture_space", 1);
+                       
+                       km = WM_keymap_add_item(keymap, OP_RESIZE, TKEY, KM_PRESS, KM_SHIFT|KM_ALT, 0);
+                       RNA_boolean_set(km->ptr, "texture_space", 1);
+
 
                        break;
                case SPACE_ACTION: