diff options
author | Joshua Leung <aligorith@gmail.com> | 2011-04-19 17:01:50 +0400 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2011-04-19 17:01:50 +0400 |
commit | 94b99b5d4a7c20cf2f4488b599e74619a7c860a6 (patch) | |
tree | 3ab0c737968a6d739e72b2a990eedbbdc329ac57 /source/blender/blenkernel/intern/ipo.c | |
parent | c4debb1c642af4f97818d1e33986223b69b0aa6d (diff) |
Bugfix [#25960] Action/NLA Editor issues with animdata context
Actions now get tagged with an ID-code, which is used to determine
what ID-blocks they can be assigned to. This ensures that material
actions cannot be assigned to the object-level for example.
* Action lists in general will now show only the actions that can be
set for that particular slot. This prevents selection of invalid
actions, and helps cut down the list of actions.
** An exception here is the Add Action Clip in NLA Editor, which will
show all actions but will only add where appropriate. This is because
it's not easy/possible to tell in advance which blocktypes to filter
for when building this list. (TODO?)
* The "Action Editor" is now strictly for object-level action
editing+setting now. This avoids repeateded confusion by people who
try using this to view their shapekey actions, which should go to the
Shape Key Editor instead!
** A context switcher for the legitimate times where this capability
might come in handy is still being investigated.
* "Floating" actions (i.e. actions in some action_library.blend) are
NOT able to be automatically tagged until they are assigned to some
datablocks (i.e. loaded onto the rig + played back once). It is
possible to write scripts that check for certain RNA-paths and "guess"
what datablocks they work on, but it is recommended that you load up
the Datablocks Viewer, and go through such actions by hand, setting
the "ID Root Type" property as appropriate per action.
Diffstat (limited to 'source/blender/blenkernel/intern/ipo.c')
-rw-r--r-- | source/blender/blenkernel/intern/ipo.c | 43 |
1 files changed, 42 insertions, 1 deletions
diff --git a/source/blender/blenkernel/intern/ipo.c b/source/blender/blenkernel/intern/ipo.c index 08e0ad4f3ff..689e17958fe 100644 --- a/source/blender/blenkernel/intern/ipo.c +++ b/source/blender/blenkernel/intern/ipo.c @@ -1372,7 +1372,7 @@ static void icu_to_fcurves (ID *id, ListBase *groups, ListBase *list, IpoCurve * * This does not assume that any ID or AnimData uses it, but does assume that * it is given two lists, which it will perform driver/animation-data separation. */ -static void ipo_to_animato (ID *id, Ipo *ipo, char actname[], char constname[], Sequence * seq, ListBase *animgroups, ListBase *anim, ListBase *drivers) +static void ipo_to_animato (ID *id, Ipo *ipo, char actname[], char constname[], Sequence *seq, ListBase *animgroups, ListBase *anim, ListBase *drivers) { IpoCurve *icu; @@ -1804,6 +1804,10 @@ void do_versions_ipos_to_animato(Main *main) BLI_freelinkN(&ob->constraintChannels, conchan); } } + + /* object's action will always be object-rooted */ + if (adt->action) + adt->action->idroot = ID_OB; } /* shapekeys */ @@ -1822,6 +1826,10 @@ void do_versions_ipos_to_animato(Main *main) /* Convert Shapekey data... */ ipo_to_animdata(id, key->ipo, NULL, NULL, NULL); + + if (adt->action) + adt->action->idroot = key->ipo->blocktype; + key->ipo->id.us--; key->ipo= NULL; } @@ -1840,6 +1848,10 @@ void do_versions_ipos_to_animato(Main *main) /* Convert Material data... */ ipo_to_animdata(id, ma->ipo, NULL, NULL, NULL); + + if (adt->action) + adt->action->idroot = ma->ipo->blocktype; + ma->ipo->id.us--; ma->ipo= NULL; } @@ -1858,6 +1870,10 @@ void do_versions_ipos_to_animato(Main *main) /* Convert World data... */ ipo_to_animdata(id, wo->ipo, NULL, NULL, NULL); + + if (adt->action) + adt->action->idroot = wo->ipo->blocktype; + wo->ipo->id.us--; wo->ipo= NULL; } @@ -1904,6 +1920,10 @@ void do_versions_ipos_to_animato(Main *main) /* convert IPO */ ipo_to_animdata((ID *)scene, seq->ipo, NULL, NULL, seq); + + if (adt->action) + adt->action->idroot = ID_SCE; /* scene-rooted */ + seq->ipo->id.us--; seq->ipo = NULL; } @@ -1925,6 +1945,10 @@ void do_versions_ipos_to_animato(Main *main) /* Convert Texture data... */ ipo_to_animdata(id, te->ipo, NULL, NULL, NULL); + + if (adt->action) + adt->action->idroot = te->ipo->blocktype; + te->ipo->id.us--; te->ipo= NULL; } @@ -1943,6 +1967,10 @@ void do_versions_ipos_to_animato(Main *main) /* Convert Camera data... */ ipo_to_animdata(id, ca->ipo, NULL, NULL, NULL); + + if (adt->action) + adt->action->idroot = ca->ipo->blocktype; + ca->ipo->id.us--; ca->ipo= NULL; } @@ -1961,6 +1989,10 @@ void do_versions_ipos_to_animato(Main *main) /* Convert Lamp data... */ ipo_to_animdata(id, la->ipo, NULL, NULL, NULL); + + if (adt->action) + adt->action->idroot = la->ipo->blocktype; + la->ipo->id.us--; la->ipo= NULL; } @@ -1979,6 +2011,10 @@ void do_versions_ipos_to_animato(Main *main) /* Convert Curve data... */ ipo_to_animdata(id, cu->ipo, NULL, NULL, NULL); + + if (adt->action) + adt->action->idroot = cu->ipo->blocktype; + cu->ipo->id.us--; cu->ipo= NULL; } @@ -2001,6 +2037,10 @@ void do_versions_ipos_to_animato(Main *main) if (G.f & G_DEBUG) printf("\tconverting action %s \n", id->name+2); + /* if old action, it will be object-only... */ + if (act->chanbase.first) + act->idroot = ID_OB; + /* be careful! some of the actions we encounter will be converted ones... */ action_to_animato(NULL, act, &act->groups, &act->curves, &drivers); } @@ -2018,6 +2058,7 @@ void do_versions_ipos_to_animato(Main *main) /* add a new action for this, and convert all data into that action */ new_act= add_empty_action("ConvIPO_Action"); // XXX need a better name... ipo_to_animato(NULL, ipo, NULL, NULL, NULL, NULL, &new_act->curves, &drivers); + new_act->idroot = ipo->blocktype; } /* clear fake-users, and set user-count to zero to make sure it is cleared on file-save */ |