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>2015-04-20 08:21:05 +0300
committerJoshua Leung <aligorith@gmail.com>2015-04-20 08:27:58 +0300
commita0e1b6573ad742cb77c47780b78d6a26fa206c73 (patch)
treea42d69ba2473f7ab604b4224ba566954f56ea0c6 /source/blender/makesrna/intern
parent689241b6e5d962c14a6650082fc0ecf4a3a0aa5e (diff)
Action Editor "Browse" Fix: Stash active action if nothing else uses it
Following the initial action management commits for 2.74, blurrymind pointed out a problematic workflow involving the "Browse Action" dropdown in the Action Editor which would lead to actions being accidentally lost. Namely, it turns out that game animators frequently flip between different actions from the Browse menu while working. While the new up/down operators and/or other NLA based tools are better suited to this without the problems of actions getting lost, some additional precautions were needed for the Browse menu as well. So now, if the active action will have no users as a result of the switch (i.e. it was a new action, and the user is checking on a previous action via the Browse menu), this action will now get stashed. This workflow is not perfect though, as there is the problem of the stashed action strips not reflecting the actions they reference.
Diffstat (limited to 'source/blender/makesrna/intern')
-rw-r--r--source/blender/makesrna/intern/rna_space.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c
index 0c94575de4c..e174d1ce5d0 100644
--- a/source/blender/makesrna/intern/rna_space.c
+++ b/source/blender/makesrna/intern/rna_space.c
@@ -1240,9 +1240,26 @@ static void rna_SpaceDopeSheetEditor_action_update(Main *UNUSED(bmain), Scene *s
id_us_plus((ID *)adt->action);
}
else {
- /* fix id-count of action we're replacing */
+ /* Handle old action... */
if (adt->action) {
+ /* Fix id-count of action we're replacing */
id_us_min(&adt->action->id);
+
+ /* To prevent data loss (i.e. if users flip between actions using the Browse menu),
+ * stash this action if nothing else uses it.
+ *
+ * EXCEPTION:
+ * This callback runs when unlinking actions. In that case, we don't want to
+ * stash the action, as the user is signalling that they want to detach it.
+ * This can be reviewed again later, but it could get annoying if we keep these instead.
+ */
+ if ((adt->action->id.us <= 0) && (saction->action != NULL)) {
+ /* XXX: Things here get dodgy if this action is only partially completed,
+ * and the user then uses the browse menu to get back to this action,
+ * assigning it as the active action (i.e. the stash strip gets out of sync)
+ */
+ BKE_nla_action_stash(adt);
+ }
}
/* Assign new action, and adjust the usercounts accordingly */