Log In
New Account
Home My Page Projects Blender 2.x BF release
Summary Activity Tracker SCM Files

Blender 2.6 Bug Tracker: Browse

[#24672] Bone.evaluate_envelope() is misleading

Date:
2010-11-12 00:35
Priority:
3
State:
Closed
Submitted by:
Tom Edwards (artfunkel)
Assigned to:
Campbell Barton (campbellbarton)
Category:
Python
Status:
Fixed / Closed
Relates to:
Duplicates:
Patches:
 
Summary:
Bone.evaluate_envelope() is misleading
Detailed description
evaluate_envelope() is available from Bone and PoseBone. However, it is only useful when used in conjunction with PoseBone.

Here is the process needed to check a bone's envelope strength for a vertex:

bone.evaluate_envelope( mesh.matrix_world * armature.matrix_world.copy().invert() * bone.matrix_local * vertex.co )

The problem is at bone.matrix_local. Regular Bone bones point down the Z axis, but PoseBones point down the Y axis (I assume there is a reason for this). The Y axis pose matrix is the one Blender uses to calculate envelopes, leaving the Z axis equivalent totally useless.

We can't stop people from plugging the Bone matrix into the function, but removing the function from Bone would send a pretty strong hint that PoseBone is the place to go.

Followup

Message
  • Date: 2010-11-17 03:37
  • Sender: Dan Eicher
  • Needs to be using bone->arm_[head,tail] because that's in armature (or parent, who knows?) space while bone->head is in bone local space.

    Tested with (where Bone.000 has a parent);
    C.active_pose_bone.evaluate_envelope(C.scene.cursor_location)
    bpy.data.armatures["Armature"].bones["Bone.000"].evaluate_envelope(C.scene.cursor_location)

    and they both return the same value with the patch but not without.

    Index: source/blender/makesrna/intern/rna_armature_api.c
    ===================================================================
    --- source/blender/makesrna/intern/rna_armature_api.c (revision 33110)
    +++ source/blender/makesrna/intern/rna_armature_api.c (working copy)
    @@ -51,7 +51,7 @@
    float rna_Bone_do_envelope(Bone *bone, float *vec)
    {
    float scale = (bone->flag & BONE_MULT_VG_ENV) == BONE_MULT_VG_ENV ? bone->weight : 1.0f;
    - return distfactor_to_bone(vec, bone->head, bone->tail, bone->rad_head * scale, bone->rad_tail * scale, bone->dist * scale);
    + return distfactor_to_bone(vec, bone->arm_head, bone->arm_tail, bone->rad_head * scale, bone->rad_tail * scale, bone->dist * scale);
    }

    #else
 

Attached Files:

No Files Currently Attached

Changes:

Field Old Value Date By
ResolutionNone2010-11-17 04:27campbellbarton
close_date2010-11-17 04:272010-11-17 04:27campbellbarton
status_idOpen2010-11-17 04:27campbellbarton
assigned_tonone2010-11-12 07:32aligorith