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:
authorCampbell Barton <ideasman42@gmail.com>2012-07-20 23:11:47 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-07-20 23:11:47 +0400
commit16516238e2b25ce53144c2dcea5323dc7313b724 (patch)
treeb5b76b9aed638da59a66cb187be91874798c7836 /source/blender/makesrna/intern/rna_nla.c
parentf883337ba3ad23370ca23f0601f231883ac3c021 (diff)
patch [#32152] Make NlaTrack.is_solo settable
from Peter Amstutz (tetron)
Diffstat (limited to 'source/blender/makesrna/intern/rna_nla.c')
-rw-r--r--source/blender/makesrna/intern/rna_nla.c41
1 files changed, 39 insertions, 2 deletions
diff --git a/source/blender/makesrna/intern/rna_nla.c b/source/blender/makesrna/intern/rna_nla.c
index edfbf0f2efd..b47f957ac76 100644
--- a/source/blender/makesrna/intern/rna_nla.c
+++ b/source/blender/makesrna/intern/rna_nla.c
@@ -357,6 +357,43 @@ static void rna_NlaStrip_remove(NlaTrack *track, bContext *C, ReportList *report
}
}
+/* Set the 'solo' setting for the given NLA-track, making sure that it is the only one
+ * that has this status in its AnimData block.
+ */
+void rna_NlaTrack_solo_set(PointerRNA *ptr, int value)
+{
+ NlaTrack *data = (NlaTrack*)ptr->data;
+ AnimData *adt = BKE_animdata_from_id(ptr->id.data);
+ NlaTrack *nt;
+
+ if (data == NULL) {
+ return;
+ }
+
+ /* firstly, make sure 'solo' flag for all tracks is disabled */
+ for (nt = data; nt; nt = nt->next) {
+ nt->flag &= ~NLATRACK_SOLO;
+ }
+ for (nt = data; nt; nt = nt->prev) {
+ nt->flag &= ~NLATRACK_SOLO;
+ }
+
+ /* now, enable 'solo' for the given track if appropriate */
+ if (value) {
+ /* set solo status */
+ data->flag |= NLATRACK_SOLO;
+
+ /* set solo-status on AnimData */
+ adt->flag |= ADT_NLA_SOLO_TRACK;
+ }
+ else {
+ /* solo status was already cleared on track */
+
+ /* clear solo-status on AnimData */
+ adt->flag &= ~ADT_NLA_SOLO_TRACK;
+ }
+}
+
#else
/* enum defines exported for rna_animation.c */
@@ -637,13 +674,13 @@ static void rna_def_nlatrack(BlenderRNA *brna)
prop = RNA_def_property(srna, "is_solo", PROP_BOOLEAN, PROP_NONE);
/* can be made editable by hooking it up to the necessary NLA API methods */
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", NLATRACK_SOLO);
RNA_def_property_ui_text(prop, "Solo",
"NLA Track is evaluated itself (i.e. active Action and all other NLA Tracks in the "
"same AnimData block are disabled)");
RNA_def_property_update(prop, NC_ANIMATION | ND_NLA, NULL); /* this will do? */
-
+ RNA_def_property_boolean_funcs(prop, NULL, "rna_NlaTrack_solo_set");
+
prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", NLATRACK_SELECTED);
RNA_def_property_ui_text(prop, "Select", "NLA Track is selected");