diff options
author | Campbell Barton <ideasman42@gmail.com> | 2009-11-10 00:03:54 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2009-11-10 00:03:54 +0300 |
commit | 5935ef004935b27fc5795349aed32f87cf637049 (patch) | |
tree | f36022abb03938420606405e9afc841b14d4bd81 /source/blender/editors/space_buttons | |
parent | 3e2766bc2ee7523ea68caedc5b11e9498ddcbbc1 (diff) |
use armature active bone as a pointer rather then a flag for each bone that needs looking up.
- rna vars arm.bones.active & rna.edit_bones.active
- needed special undo support.
- readfile.c loads.
- duplicate and copy_armature support.
- keep the draw flag, renamed to BONE_DRAW_ACTIVE, only use for openGL drawing.
Note: it may be better to allow active/unselected as with objects.
Diffstat (limited to 'source/blender/editors/space_buttons')
-rw-r--r-- | source/blender/editors/space_buttons/buttons_context.c | 34 |
1 files changed, 7 insertions, 27 deletions
diff --git a/source/blender/editors/space_buttons/buttons_context.c b/source/blender/editors/space_buttons/buttons_context.c index 026498f17af..47055851e03 100644 --- a/source/blender/editors/space_buttons/buttons_context.c +++ b/source/blender/editors/space_buttons/buttons_context.c @@ -243,26 +243,9 @@ static int buttons_context_path_material(ButsContextPath *path) return 0; } -static Bone *find_active_bone(Bone *bone) -{ - Bone *active; - - for(; bone; bone=bone->next) { - if(bone->flag & BONE_ACTIVE) - return bone; - - active= find_active_bone(bone->childbase.first); - if(active) - return active; - } - - return NULL; -} - static int buttons_context_path_bone(ButsContextPath *path) { bArmature *arm; - Bone *bone; EditBone *edbo; /* if we have an armature, get the active bone */ @@ -270,19 +253,16 @@ static int buttons_context_path_bone(ButsContextPath *path) arm= path->ptr[path->len-1].data; if(arm->edbo) { - for(edbo=arm->edbo->first; edbo; edbo=edbo->next) { - if(edbo->flag & BONE_ACTIVE) { - RNA_pointer_create(&arm->id, &RNA_EditBone, edbo, &path->ptr[path->len]); - path->len++; - return 1; - } + if(arm->act_edbone) { + edbo= arm->act_edbone; + RNA_pointer_create(&arm->id, &RNA_EditBone, edbo, &path->ptr[path->len]); + path->len++; + return 1; } } else { - bone= find_active_bone(arm->bonebase.first); - - if(bone) { - RNA_pointer_create(&arm->id, &RNA_Bone, bone, &path->ptr[path->len]); + if(arm->act_bone) { + RNA_pointer_create(&arm->id, &RNA_Bone, arm->act_bone, &path->ptr[path->len]); path->len++; return 1; } |