Commit: a0e1b6573ad742cb77c47780b78d6a26fa206c73
Author: Joshua Leung
Date: Mon Apr 20 17:21:05 2015 +1200
Branches: master
https://developer.blender.org/rBa0e1b6573ad742cb77c47780b78d6a26fa206c73
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.
===================================================================
M source/blender/makesrna/intern/rna_space.c
===================================================================
diff --git a/source/blender/makesrna/intern/rna_space.c
b/source/blender/makesrna/intern/rna_space.c
index 0c94575..e174d1c 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 */
_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs