[Bf-blender-cvs] [0445454] master: Fix T38077: Scaling bones in EditMode drawn using envelope display mode scales joint radii instead

Joshua Leung noreply at git.blender.org
Thu Jan 9 12:55:56 CET 2014


Commit: 0445454f1e9409058c465b80c180ca8c25b45772
Author: Joshua Leung
Date:   Fri Jan 10 00:44:03 2014 +1300
https://developer.blender.org/rB0445454f1e9409058c465b80c180ca8c25b45772

Fix T38077: Scaling bones in EditMode drawn using envelope display mode scales joint radii instead

When trying to scale bones in EditMode and the bones were drawn using envelope display mode,
this resulted in the joint radii (i.e. the inner part of envelopes) being adjusted instead.
It turns out that this was due to an old hack that was put in place back in 2.4x (see the
tracker logs for full details of the problem here).

This commit introduces the following fixes:
1) Removed the old hack. Scaling (S) works normally now.
2) Ctrl-Alt-S (i.e. "Scale Envelopes/BBones") is as-is.
   That is, it is used to adjust the size falloff-region around a bone
   (i.e. the "dist" property)
3) Added Alt-S hotkey in EditMode for armatures for adjusting the radii of bones.
   This change just means that the "TFM_BONE_ENVELOPE" mode is now able to be
   accessed from the UI as a tool on its own right (instead of being accessible
   via the old undocumented hack). This tool adjusts the radii of the bone joints,
   which define the actual full-influence region of the envelopes.

===================================================================

M	release/scripts/startup/bl_ui/space_view3d.py
M	source/blender/editors/armature/armature_ops.c
M	source/blender/editors/transform/transform_conversions.c

===================================================================

diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py
index 1fed424..0844bff 100644
--- a/release/scripts/startup/bl_ui/space_view3d.py
+++ b/release/scripts/startup/bl_ui/space_view3d.py
@@ -251,11 +251,12 @@ class VIEW3D_MT_transform_armature(VIEW3D_MT_transform_base):
         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'
+        if obj.type == 'ARMATURE' and obj.mode in {'EDIT', 'POSE'}:
+            if obj.data.draw_type == 'BBONE':
+                layout.operator("transform.transform", text="Scale BBone").mode = 'BONE_SIZE'
+            elif obj.data.draw_type == 'ENVELOPE':
+                layout.operator("transform.transform", text="Scale Envelope Distance").mode = 'BONE_SIZE'
+                layout.operator("transform.transform", text="Scale Radius").mode = 'BONE_ENVELOPE'
 
         if context.edit_object and context.edit_object.type == 'ARMATURE':
             layout.operator("armature.align")
diff --git a/source/blender/editors/armature/armature_ops.c b/source/blender/editors/armature/armature_ops.c
index feb9b0f..be23c28 100644
--- a/source/blender/editors/armature/armature_ops.c
+++ b/source/blender/editors/armature/armature_ops.c
@@ -294,7 +294,10 @@ void ED_keymap_armature(wmKeyConfig *keyconf)
 	/*  1) envelope/b-bone size */
 	kmi = WM_keymap_add_item(keymap, "TRANSFORM_OT_transform", SKEY, KM_PRESS, KM_CTRL | KM_ALT, 0);
 	RNA_enum_set(kmi->ptr, "mode", TFM_BONESIZE);
-	/*  2) set roll */
+	/*  2) envelope radius */
+	kmi = WM_keymap_add_item(keymap, "TRANSFORM_OT_transform", SKEY, KM_PRESS, KM_ALT, 0);
+	RNA_enum_set(kmi->ptr, "mode", TFM_BONE_ENVELOPE);
+	/*  3) set roll */
 	kmi = WM_keymap_add_item(keymap, "TRANSFORM_OT_transform", RKEY, KM_PRESS, KM_CTRL, 0);
 	RNA_enum_set(kmi->ptr, "mode", TFM_BONE_ROLL);
 		
diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c
index c9aac31..2c001ca 100644
--- a/source/blender/editors/transform/transform_conversions.c
+++ b/source/blender/editors/transform/transform_conversions.c
@@ -1072,14 +1072,6 @@ static void createTransArmatureVerts(TransInfo *t)
 	TransData *td;
 	float mtx[3][3], smtx[3][3], bonemat[3][3];
 	
-	/* special hack for envelope drawmode and scaling:
-	 *  to allow scaling the size of the envelope around single points,
-	 *	mode should become TFM_BONE_ENVELOPE in this case
-	 */
-	// TODO: maybe we need a separate hotkey for it, but this is consistent with 2.4x for now
-	if ((t->mode == TFM_RESIZE) && (arm->drawtype == ARM_ENVELOPE))
-		t->mode = TFM_BONE_ENVELOPE;
-	
 	t->total = 0;
 	for (ebo = edbo->first; ebo; ebo = ebo->next) {
 		if (EBONE_VISIBLE(arm, ebo) && !(ebo->flag & BONE_EDITMODE_LOCKED)) {




More information about the Bf-blender-cvs mailing list