Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/editors/space_action/action_select.c')
-rw-r--r--source/blender/editors/space_action/action_select.c53
1 files changed, 25 insertions, 28 deletions
diff --git a/source/blender/editors/space_action/action_select.c b/source/blender/editors/space_action/action_select.c
index 59d2063ea84..9dcfc626a50 100644
--- a/source/blender/editors/space_action/action_select.c
+++ b/source/blender/editors/space_action/action_select.c
@@ -93,7 +93,7 @@ static bAnimListElem *actkeys_find_list_element_at_position(bAnimContext *ac,
}
static void actkeys_list_element_to_keylist(bAnimContext *ac,
- DLRBT_Tree *anim_keys,
+ struct AnimKeylist *keylist,
bAnimListElem *ale)
{
AnimData *adt = ANIM_nla_mapping_get(ac, ale);
@@ -107,44 +107,44 @@ static void actkeys_list_element_to_keylist(bAnimContext *ac,
switch (ale->datatype) {
case ALE_SCE: {
Scene *scene = (Scene *)ale->key_data;
- scene_to_keylist(ads, scene, anim_keys, 0);
+ scene_to_keylist(ads, scene, keylist, 0);
break;
}
case ALE_OB: {
Object *ob = (Object *)ale->key_data;
- ob_to_keylist(ads, ob, anim_keys, 0);
+ ob_to_keylist(ads, ob, keylist, 0);
break;
}
case ALE_ACT: {
bAction *act = (bAction *)ale->key_data;
- action_to_keylist(adt, act, anim_keys, 0);
+ action_to_keylist(adt, act, keylist, 0);
break;
}
case ALE_FCURVE: {
FCurve *fcu = (FCurve *)ale->key_data;
- fcurve_to_keylist(adt, fcu, anim_keys, 0);
+ fcurve_to_keylist(adt, fcu, keylist, 0);
break;
}
}
}
else if (ale->type == ANIMTYPE_SUMMARY) {
/* dopesheet summary covers everything */
- summary_to_keylist(ac, anim_keys, 0);
+ summary_to_keylist(ac, keylist, 0);
}
else if (ale->type == ANIMTYPE_GROUP) {
/* TODO: why don't we just give groups key_data too? */
bActionGroup *agrp = (bActionGroup *)ale->data;
- agroup_to_keylist(adt, agrp, anim_keys, 0);
+ agroup_to_keylist(adt, agrp, keylist, 0);
}
else if (ale->type == ANIMTYPE_GPLAYER) {
/* TODO: why don't we just give gplayers key_data too? */
bGPDlayer *gpl = (bGPDlayer *)ale->data;
- gpl_to_keylist(ads, gpl, anim_keys);
+ gpl_to_keylist(ads, gpl, keylist);
}
else if (ale->type == ANIMTYPE_MASKLAYER) {
/* TODO: why don't we just give masklayers key_data too? */
MaskLayer *masklay = (MaskLayer *)ale->data;
- mask_to_keylist(ads, masklay, anim_keys);
+ mask_to_keylist(ads, masklay, keylist);
}
}
@@ -160,9 +160,8 @@ static void actkeys_find_key_in_list_element(bAnimContext *ac,
View2D *v2d = &ac->region->v2d;
- DLRBT_Tree anim_keys;
- BLI_dlrbTree_init(&anim_keys);
- actkeys_list_element_to_keylist(ac, &anim_keys, ale);
+ struct AnimKeylist *keylist = ED_keylist_create();
+ actkeys_list_element_to_keylist(ac, keylist, ale);
AnimData *adt = ANIM_nla_mapping_get(ac, ale);
@@ -171,25 +170,23 @@ static void actkeys_find_key_in_list_element(bAnimContext *ac,
/* half-size (for either side), but rounded up to nearest int (for easier targeting) */
key_hsize = roundf(key_hsize / 2.0f);
- float xmin = UI_view2d_region_to_view_x(v2d, region_x - (int)key_hsize);
- float xmax = UI_view2d_region_to_view_x(v2d, region_x + (int)key_hsize);
-
- for (ActKeyColumn *ak = anim_keys.root; ak; ak = (ak->cfra < xmin) ? ak->right : ak->left) {
- if (IN_RANGE(ak->cfra, xmin, xmax)) {
- /* set the frame to use, and apply inverse-correction for NLA-mapping
- * so that the frame will get selected by the selection functions without
- * requiring to map each frame once again...
- */
- *r_selx = BKE_nla_tweakedit_remap(adt, ak->cfra, NLATIME_CONVERT_UNMAP);
- *r_frame = ak->cfra;
- *r_found = true;
- *r_is_selected = (ak->sel & SELECT) != 0;
- break;
- }
+ const Range2f range = {UI_view2d_region_to_view_x(v2d, region_x - (int)key_hsize),
+ UI_view2d_region_to_view_x(v2d, region_x + (int)key_hsize)};
+ const ActKeyColumn *ak = ED_keylist_find_any_between(keylist, range);
+ if (ak) {
+
+ /* set the frame to use, and apply inverse-correction for NLA-mapping
+ * so that the frame will get selected by the selection functions without
+ * requiring to map each frame once again...
+ */
+ *r_selx = BKE_nla_tweakedit_remap(adt, ak->cfra, NLATIME_CONVERT_UNMAP);
+ *r_frame = ak->cfra;
+ *r_found = true;
+ *r_is_selected = (ak->sel & SELECT) != 0;
}
/* cleanup temporary lists */
- BLI_dlrbTree_free(&anim_keys);
+ ED_keylist_free(keylist);
}
static void actkeys_find_key_at_position(bAnimContext *ac,