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-08-02 17:15:20 +0400
committerJoshua Leung <aligorith@gmail.com>2009-08-02 17:15:20 +0400
commit81146e419cc9958559b3a4b0f1c919e378cce531 (patch)
tree40e1dbba948496b1484300b8c3b50da893a2d271
parent1aa3885ef72658771bec837007b3ef0296a81bc4 (diff)
NLA Tweaks:
* "Pushing down" the action to make a new strip will now make the new strip the 'active' one. * 'Active Action' field in Animation Data panel is now editable as long as we aren't in "tweakmode"
-rw-r--r--source/blender/blenkernel/BKE_nla.h1
-rw-r--r--source/blender/blenkernel/intern/nla.c25
-rw-r--r--source/blender/editors/space_nla/nla_buttons.c1
-rw-r--r--source/blender/makesrna/intern/rna_animation.c12
-rw-r--r--source/blender/makesrna/intern/rna_pose.c1
5 files changed, 38 insertions, 2 deletions
diff --git a/source/blender/blenkernel/BKE_nla.h b/source/blender/blenkernel/BKE_nla.h
index 241a8fd7b59..989043c1d67 100644
--- a/source/blender/blenkernel/BKE_nla.h
+++ b/source/blender/blenkernel/BKE_nla.h
@@ -80,6 +80,7 @@ short BKE_nlatrack_add_strip(struct NlaTrack *nlt, struct NlaStrip *strip);
/* ............ */
struct NlaStrip *BKE_nlastrip_find_active(struct NlaTrack *nlt);
+void BKE_nlastrip_set_active(struct AnimData *adt, struct NlaStrip *strip);
short BKE_nlastrip_within_bounds(struct NlaStrip *strip, float min, float max);
diff --git a/source/blender/blenkernel/intern/nla.c b/source/blender/blenkernel/intern/nla.c
index 1871ec006f4..c41c4ae78e4 100644
--- a/source/blender/blenkernel/intern/nla.c
+++ b/source/blender/blenkernel/intern/nla.c
@@ -993,6 +993,28 @@ NlaStrip *BKE_nlastrip_find_active (NlaTrack *nlt)
return NULL;
}
+/* Make the given NLA-Strip the active one within the given block */
+void BKE_nlastrip_set_active (AnimData *adt, NlaStrip *strip)
+{
+ NlaTrack *nlt;
+ NlaStrip *nls;
+
+ /* sanity checks */
+ if (adt == NULL)
+ return;
+
+ /* loop over tracks, deactivating*/
+ for (nlt= adt->nla_tracks.first; nlt; nlt= nlt->next) {
+ for (nls= nlt->strips.first; nls; nls= nls->next) {
+ if (nls != strip)
+ nls->flag &= ~NLASTRIP_FLAG_ACTIVE;
+ else
+ nls->flag |= NLASTRIP_FLAG_ACTIVE;
+ }
+ }
+}
+
+
/* Does the given NLA-strip fall within the given bounds (times)? */
short BKE_nlastrip_within_bounds (NlaStrip *strip, float min, float max)
{
@@ -1403,6 +1425,9 @@ void BKE_nla_action_pushdown (AnimData *adt)
// FIXME: this needs to be more automated, since user can rearrange strips
strip->extendmode= NLASTRIP_EXTEND_HOLD_FORWARD;
}
+
+ /* make strip the active one... */
+ BKE_nlastrip_set_active(adt, strip);
}
}
diff --git a/source/blender/editors/space_nla/nla_buttons.c b/source/blender/editors/space_nla/nla_buttons.c
index a87ab36714c..7184737e0ba 100644
--- a/source/blender/editors/space_nla/nla_buttons.c
+++ b/source/blender/editors/space_nla/nla_buttons.c
@@ -210,7 +210,6 @@ static void nla_panel_animdata (const bContext *C, Panel *pa)
/* Active Action Properties ------------------------------------- */
/* action */
row= uiLayoutRow(layout, 1);
- uiLayoutSetEnabled(row, (adt->flag & ADT_NLA_EDIT_ON)==0);
uiItemR(row, NULL, 0, &adt_ptr, "action", 0, 0, 0);
/* extrapolation */
diff --git a/source/blender/makesrna/intern/rna_animation.c b/source/blender/makesrna/intern/rna_animation.c
index 76ed62f6438..e334e2b5e90 100644
--- a/source/blender/makesrna/intern/rna_animation.c
+++ b/source/blender/makesrna/intern/rna_animation.c
@@ -38,6 +38,17 @@
#ifdef RNA_RUNTIME
+static int rna_AnimData_action_editable(PointerRNA *ptr)
+{
+ AnimData *adt= (AnimData *)ptr->data;
+
+ /* active action is only editable when it is not a tweaking strip */
+ if ((adt->flag & ADT_NLA_EDIT_ON) || (adt->actstrip) || (adt->tmpact))
+ return 0;
+ else
+ return 1;
+}
+
static void rna_ksPath_RnaPath_get(PointerRNA *ptr, char *value)
{
KS_Path *ksp= (KS_Path *)ptr->data;
@@ -191,6 +202,7 @@ void rna_def_animdata(BlenderRNA *brna)
/* Active Action */
prop= RNA_def_property(srna, "action", PROP_POINTER, PROP_NONE);
RNA_def_property_ui_text(prop, "Action", "Active Action for this datablock.");
+ RNA_def_property_editable_func(prop, "rna_AnimData_action_editable");
/* Active Action Settings */
prop= RNA_def_property(srna, "action_extrapolation", PROP_ENUM, PROP_NONE);
diff --git a/source/blender/makesrna/intern/rna_pose.c b/source/blender/makesrna/intern/rna_pose.c
index 095471dd053..0148ce819d4 100644
--- a/source/blender/makesrna/intern/rna_pose.c
+++ b/source/blender/makesrna/intern/rna_pose.c
@@ -60,7 +60,6 @@ static void rna_Pose_update(bContext *C, PointerRNA *ptr)
static char *rna_PoseChannel_path(PointerRNA *ptr)
{
- // XXX do we really need the 'pose.' bit?
return BLI_sprintfN("pose.pose_channels[\"%s\"]", ((bPoseChannel*)ptr->data)->name);
}