Hi Aligorith, Love this behavior, also goes along with how "new material" works now, making a copy of the active one.
Cheers! -- Pablo Vazquez CG Artist Blender Foundation Certificated Trainer E-mail: [email protected] Website: http://www.pablovazquez.org On Tue, Jan 11, 2011 at 01:40, Joshua Leung <[email protected]> wrote: > Revision: 34241 > > http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=34241 > Author: aligorith > Date: 2011-01-11 00:39:59 +0000 (Tue, 11 Jan 2011) > Log Message: > ----------- > "New Action" Operator: > > When creating new actions using the "new" button the Action Editor > header databrowse, or the NLA editor's "Animation Data" databrowse, > the existing action will get copied (if it exists) instead of an empty > action getting added everytime. > > Apparently this behaviour is very good for being able to "version" > actions within a single .blend file (Bassam?) > > Modified Paths: > -------------- > trunk/blender/source/blender/editors/space_action/action_edit.c > > Modified: trunk/blender/source/blender/editors/space_action/action_edit.c > =================================================================== > --- trunk/blender/source/blender/editors/space_action/action_edit.c > 2011-01-11 00:21:43 UTC (rev 34240) > +++ trunk/blender/source/blender/editors/space_action/action_edit.c > 2011-01-11 00:39:59 UTC (rev 34241) > @@ -76,26 +76,42 @@ > > static int act_new_exec(bContext *C, wmOperator *UNUSED(op)) > { > - bAction *action; > PointerRNA ptr, idptr; > PropertyRNA *prop; > > - // XXX need to restore behaviour to copy old actions... > - action= add_empty_action("Action"); > - > /* hook into UI */ > uiIDContextProperty(C, &ptr, &prop); > - > - if(prop) { > - /* when creating new ID blocks, use is already 1, but RNA > - * pointer se also increases user, so this compensates it */ > + > + if (prop) { > + bAction *action=NULL, *oldact=NULL; > + PointerRNA oldptr; > + > + /* create action - the way to do this depends on whether > we've got an > + * existing one there already, in which case we make a copy > of it > + * (which is useful for "versioning" actions within the same > file) > + */ > + oldptr = RNA_property_pointer_get(&ptr, prop); > + oldact = (bAction *)oldptr.id.data; > + > + if (oldact && GS(oldact->id.name)==ID_AC) { > + /* make a copy of the existing action */ > + action= copy_action(oldact); > + } > + else { > + /* just make a new (empty) action */ > + action= add_empty_action("Action"); > + } > + > + /* when creating new ID blocks, use is already 1 (fake user), > + * but RNA pointer use also increases user, so this > compensates it > + */ > action->id.us--; > - > + > RNA_id_pointer_create(&action->id, &idptr); > RNA_property_pointer_set(&ptr, prop, idptr); > RNA_property_update(C, &ptr, prop); > } > - > + > /* set notifier that keyframes have changed */ > WM_event_add_notifier(C, NC_ANIMATION|ND_KEYFRAME|NA_EDITED, NULL); > > > _______________________________________________ > Bf-blender-cvs mailing list > [email protected] > http://lists.blender.org/mailman/listinfo/bf-blender-cvs > _______________________________________________ Bf-committers mailing list [email protected] http://lists.blender.org/mailman/listinfo/bf-committers
