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:
authorJoshua Leung <aligorith@gmail.com>2009-07-11 03:25:30 +0400
committerJoshua Leung <aligorith@gmail.com>2009-07-11 03:25:30 +0400
commit66a81a4062b8cc01452316c8eeb442b0acf2663e (patch)
tree3a0a40d65ad8cf39e6b9ea72042ef2d04ce8f60d /source/blender/editors/space_nla
parentb609f2aa790e122504aad34512d08241c2e01079 (diff)
NLA SoC: Names for NLA Strips
In order to be able to better identify NLA Strips (and to reduce the complexity of the text on them), I've implemented a name property for the strips. The names are made to be unique within the AnimData block the strip comes from, though this may not always happen if not enough relevant context info is present to validate this.
Diffstat (limited to 'source/blender/editors/space_nla')
-rw-r--r--source/blender/editors/space_nla/nla_buttons.c3
-rw-r--r--source/blender/editors/space_nla/nla_draw.c25
-rw-r--r--source/blender/editors/space_nla/nla_edit.c31
3 files changed, 34 insertions, 25 deletions
diff --git a/source/blender/editors/space_nla/nla_buttons.c b/source/blender/editors/space_nla/nla_buttons.c
index c0a2b9476e3..a74037d1ace 100644
--- a/source/blender/editors/space_nla/nla_buttons.c
+++ b/source/blender/editors/space_nla/nla_buttons.c
@@ -215,7 +215,8 @@ static void nla_panel_properties(const bContext *C, Panel *pa)
/* Strip Properties ------------------------------------- */
/* strip type */
- row= uiLayoutRow(layout, 1);
+ row= uiLayoutColumn(layout, 1);
+ uiItemR(row, NULL, ICON_NLA, &strip_ptr, "name", 0, 0, 0); // XXX icon?
uiItemR(row, NULL, 0, &strip_ptr, "type", 0, 0, 0);
/* strip extents */
diff --git a/source/blender/editors/space_nla/nla_draw.c b/source/blender/editors/space_nla/nla_draw.c
index 7fb15c62277..8d56670a149 100644
--- a/source/blender/editors/space_nla/nla_draw.c
+++ b/source/blender/editors/space_nla/nla_draw.c
@@ -445,26 +445,11 @@ static void nla_draw_strip_text (NlaTrack *nlt, NlaStrip *strip, int index, View
else
sprintf(dir, "->");
- /* for now, just init the string with fixed-formats */
- switch (strip->type) {
- case NLASTRIP_TYPE_TRANSITION: /* Transition */
- sprintf(str, "%d | Transition | %.2f %s %.2f",
- index, strip->start, dir, strip->end);
- break;
-
- case NLASTRIP_TYPE_META: /* Meta */
- sprintf(str, "%d | %sMeta | %.2f %s %.2f",
- index, ((strip->flag & NLASTRIP_FLAG_TEMP_META)?"Temp-":""),
- strip->start, dir, strip->end);
- break;
-
- case NLASTRIP_TYPE_CLIP: /* Action-Clip (default) */
- default:
- sprintf(str, "%d | Act: %s | %.2f %s %.2f",
- index, ((strip->act)?strip->act->id.name+2:"<NONE>"),
- strip->start, dir, strip->end);
- break;
- }
+ /* just print the name and the range */
+ if (strip->flag & NLASTRIP_FLAG_TEMP_META)
+ sprintf(str, "Temp-Meta | %.2f %s %.2f", strip->start, dir, strip->end);
+ else
+ sprintf(str, "%s | %.2f %s %.2f", strip->name, strip->start, dir, strip->end);
/* set text colour - if colours (see above) are light, draw black text, otherwise draw white */
if (strip->flag & (NLASTRIP_FLAG_ACTIVE|NLASTRIP_FLAG_SELECT|NLASTRIP_FLAG_TWEAKUSER))
diff --git a/source/blender/editors/space_nla/nla_edit.c b/source/blender/editors/space_nla/nla_edit.c
index cb151429dd1..9ddd8daab0d 100644
--- a/source/blender/editors/space_nla/nla_edit.c
+++ b/source/blender/editors/space_nla/nla_edit.c
@@ -307,6 +307,9 @@ static int nlaedit_add_actionclip_exec (bContext *C, wmOperator *op)
nlt= add_nlatrack(adt, NULL);
BKE_nlatrack_add_strip(nlt, strip);
}
+
+ /* auto-name it */
+ BKE_nlastrip_validate_name(adt, strip);
}
/* free temp data */
@@ -363,6 +366,7 @@ static int nlaedit_add_transition_exec (bContext *C, wmOperator *op)
/* for each track, find pairs of strips to add transitions to */
for (ale= anim_data.first; ale; ale= ale->next) {
NlaTrack *nlt= (NlaTrack *)ale->data;
+ AnimData *adt= BKE_animdata_from_id(ale->id);
NlaStrip *s1, *s2;
/* get initial pair of strips */
@@ -410,6 +414,9 @@ static int nlaedit_add_transition_exec (bContext *C, wmOperator *op)
strip->scale= 1.0f;
strip->repeat = 1.0f;
+ /* auto-name it */
+ BKE_nlastrip_validate_name(adt, strip);
+
/* make note of this */
done++;
}
@@ -470,9 +477,18 @@ static int nlaedit_add_meta_exec (bContext *C, wmOperator *op)
/* for each track, find pairs of strips to add transitions to */
for (ale= anim_data.first; ale; ale= ale->next) {
NlaTrack *nlt= (NlaTrack *)ale->data;
+ AnimData *adt= BKE_animdata_from_id(ale->id);
+ NlaStrip *strip;
/* create meta-strips from the continuous chains of selected strips */
BKE_nlastrips_make_metas(&nlt->strips, 0);
+
+ /* name the metas */
+ for (strip= nlt->strips.first; strip; strip= strip->next) {
+ /* auto-name this strip if selected (that means it is a meta) */
+ if (strip->flag & NLASTRIP_FLAG_SELECT)
+ BKE_nlastrip_validate_name(adt, strip);
+ }
}
/* free temp data */
@@ -605,6 +621,9 @@ static int nlaedit_duplicate_exec (bContext *C, wmOperator *op)
/* deselect the original and the active flag */
strip->flag &= ~(NLASTRIP_FLAG_SELECT|NLASTRIP_FLAG_ACTIVE);
+ /* auto-name it */
+ BKE_nlastrip_validate_name(adt, strip);
+
done++;
}
}
@@ -728,7 +747,7 @@ void NLA_OT_delete (wmOperatorType *ot)
// - variable-length splits?
/* split a given Action-Clip strip */
-static void nlaedit_split_strip_actclip (NlaTrack *nlt, NlaStrip *strip)
+static void nlaedit_split_strip_actclip (AnimData *adt, NlaTrack *nlt, NlaStrip *strip)
{
NlaStrip *nstrip;
float midframe, midaframe, len;
@@ -765,10 +784,13 @@ static void nlaedit_split_strip_actclip (NlaTrack *nlt, NlaStrip *strip)
/* clear the active flag from the copy */
nstrip->flag &= ~NLASTRIP_FLAG_ACTIVE;
+
+ /* auto-name the new strip */
+ BKE_nlastrip_validate_name(adt, nstrip);
}
/* split a given Meta strip */
-static void nlaedit_split_strip_meta (NlaTrack *nlt, NlaStrip *strip)
+static void nlaedit_split_strip_meta (AnimData *adt, NlaTrack *nlt, NlaStrip *strip)
{
/* simply ungroup it for now... */
BKE_nlastrips_clear_metastrip(&nlt->strips, strip);
@@ -795,6 +817,7 @@ static int nlaedit_split_exec (bContext *C, wmOperator *op)
/* for each NLA-Track, split all selected strips into two strips */
for (ale= anim_data.first; ale; ale= ale->next) {
NlaTrack *nlt= (NlaTrack *)ale->data;
+ AnimData *adt= BKE_animdata_from_id(ale->id);
NlaStrip *strip, *next;
for (strip= nlt->strips.first; strip; strip= next) {
@@ -805,11 +828,11 @@ static int nlaedit_split_exec (bContext *C, wmOperator *op)
/* splitting method depends on the type of strip */
switch (strip->type) {
case NLASTRIP_TYPE_CLIP: /* action-clip */
- nlaedit_split_strip_actclip(nlt, strip);
+ nlaedit_split_strip_actclip(adt, nlt, strip);
break;
case NLASTRIP_TYPE_META: /* meta-strips need special handling */
- nlaedit_split_strip_meta(nlt, strip);
+ nlaedit_split_strip_meta(adt, nlt, strip);
break;
default: /* for things like Transitions, do not split! */