[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [32215] trunk/blender: Action/ Shapekey Editor Bugfixes:
Joshua Leung
aligorith at gmail.com
Thu Sep 30 14:42:45 CEST 2010
Revision: 32215
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=32215
Author: aligorith
Date: 2010-09-30 14:42:45 +0200 (Thu, 30 Sep 2010)
Log Message:
-----------
Action/Shapekey Editor Bugfixes:
* Shapekey editor now shows ID-box for showing and editing the action assigned here. This should help alleviate the misconceptions arising to #23823, where user tries to load shapekey action into Action Editor (context there is ob-action only).
There are still a few minor update bugs that I still need to fix here (i.e. post keyframing) though. Those shouldn't take too long I think.
* Changing the action used in the Action Editor properly decrements the user counts now. This solves the bug where you could get actions with a high usercount, but not that many actual users.
Modified Paths:
--------------
trunk/blender/release/scripts/ui/space_dopesheet.py
trunk/blender/source/blender/makesrna/intern/rna_space.c
Modified: trunk/blender/release/scripts/ui/space_dopesheet.py
===================================================================
--- trunk/blender/release/scripts/ui/space_dopesheet.py 2010-09-30 12:10:18 UTC (rev 32214)
+++ trunk/blender/release/scripts/ui/space_dopesheet.py 2010-09-30 12:42:45 UTC (rev 32215)
@@ -100,7 +100,7 @@
if st.mode == 'DOPESHEET':
dopesheet_filter(layout, context)
- elif st.mode == 'ACTION':
+ elif st.mode in ('ACTION','SHAPEKEY'):
layout.template_ID(st, "action", new="action.new")
if st.mode != 'GPENCIL':
Modified: trunk/blender/source/blender/makesrna/intern/rna_space.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_space.c 2010-09-30 12:10:18 UTC (rev 32214)
+++ trunk/blender/source/blender/makesrna/intern/rna_space.c 2010-09-30 12:42:45 UTC (rev 32215)
@@ -31,7 +31,10 @@
#include "rna_internal.h"
+#include "BKE_key.h"
+
#include "DNA_action_types.h"
+#include "DNA_key_types.h"
#include "DNA_node_types.h"
#include "DNA_object_types.h"
#include "DNA_space_types.h"
@@ -629,12 +632,28 @@
Object *obact= (scene->basact)? scene->basact->object: NULL;
/* we must set this action to be the one used by active object (if not pinned) */
- if(obact/* && saction->pin == 0*/) {
- AnimData *adt= BKE_id_add_animdata(&obact->id); /* this only adds if non-existant */
+ if (obact/* && saction->pin == 0*/) {
+ AnimData *adt = NULL;
+ if (saction->mode == SACTCONT_ACTION) {
+ // TODO: context selector could help decide this with more control?
+ adt= BKE_id_add_animdata(&obact->id); /* this only adds if non-existant */
+ }
+ else if (saction->mode == SACTCONT_SHAPEKEY) {
+ Key *key = ob_get_key(obact);
+ if (key)
+ adt= BKE_id_add_animdata(&key->id); /* this only adds if non-existant */
+ }
+
/* set action */
- adt->action= saction->action;
- id_us_plus(&adt->action->id);
+ if (adt) {
+ /* fix id-count of action we're replacing */
+ id_us_min(&adt->action->id);
+
+ /* show new id-count of action we're replacing */
+ adt->action= saction->action;
+ id_us_plus(&adt->action->id);
+ }
/* force depsgraph flush too */
DAG_id_flush_update(&obact->id, OB_RECALC_OB|OB_RECALC_DATA);
@@ -644,14 +663,33 @@
static void rna_SpaceDopeSheetEditor_mode_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
SpaceAction *saction= (SpaceAction*)(ptr->data);
+ Object *obact= (scene->basact)? scene->basact->object: NULL;
- /* special exception for ShapeKey Editor mode:
- * enable 'show sliders' by default, since one of the main
- * points of the ShapeKey Editor is to provide a one-stop shop
- * for controlling the shapekeys, whose main control is the value
- */
- if (saction->mode == SACTCONT_SHAPEKEY)
+ /* special exceptions for ShapeKey Editor mode */
+ if (saction->mode == SACTCONT_SHAPEKEY) {
+ Key *key = ob_get_key(obact);
+
+ /* 1) update the action stored for the editor */
+ if (key)
+ saction->action = (key->adt)? key->adt->action : NULL;
+ else
+ saction->action = NULL;
+
+ /* 2) enable 'show sliders' by default, since one of the main
+ * points of the ShapeKey Editor is to provide a one-stop shop
+ * for controlling the shapekeys, whose main control is the value
+ */
saction->flag |= SACTION_SLIDERS;
+ }
+ /* make sure action stored is valid */
+ else if (saction->mode == SACTCONT_ACTION) {
+ /* 1) update the action stored for the editor */
+ // TODO: context selector could help decide this with more control?
+ if (obact)
+ saction->action = (obact->adt)? obact->adt->action : NULL;
+ else
+ saction->action = NULL;
+ }
}
/* Space Graph Editor */
More information about the Bf-blender-cvs
mailing list