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>2011-07-17 16:37:38 +0400
committerJoshua Leung <aligorith@gmail.com>2011-07-17 16:37:38 +0400
commita0b769ce0efdb54b8c775aff486319be858dba74 (patch)
tree7d8c9964718643ebbed4ced5d7f9885d1264df7f /source/blender/editors
parent19aaadcbaba2aff7b4a8d6d55621e1acc061616e (diff)
Bugfix [#27412] PoseLib bug(maybe also corrupted data)
* Find first unused frame function was failing to correctly detect conflicts with the lower bound due to the way that markers are not stored in sorted order. Fixed by performing additional search passes. * Fixed some update bugs where there were missing notifiers. Most noticable when the poselib is being viewed in an Action Editor
Diffstat (limited to 'source/blender/editors')
-rw-r--r--source/blender/editors/armature/poselib.c49
1 files changed, 38 insertions, 11 deletions
diff --git a/source/blender/editors/armature/poselib.c b/source/blender/editors/armature/poselib.c
index 57da7733223..d09c4f1b5e0 100644
--- a/source/blender/editors/armature/poselib.c
+++ b/source/blender/editors/armature/poselib.c
@@ -110,22 +110,34 @@ static int poselib_get_free_index (bAction *act)
{
TimeMarker *marker;
int low=0, high=0;
+ short changed = 0;
/* sanity checks */
if (ELEM(NULL, act, act->markers.first)) return 1;
- /* loop over poses finding various values (poses are not stored in chronological order) */
- for (marker= act->markers.first; marker; marker= marker->next) {
- /* only increase low if value is 1 greater than low, to find "gaps" where
- * poses were removed from the poselib
- */
- if (marker->frame == (low + 1))
- low++;
+ /* As poses are not stored in chronological order, we must iterate over this list
+ * a few times until we don't make any new discoveries (mostly about the lower bound).
+ * Prevents problems with deleting then trying to add new poses [#27412]
+ */
+ do {
+ changed = 0;
- /* value replaces high if it is the highest value encountered yet */
- if (marker->frame > high)
- high= marker->frame;
- }
+ for (marker= act->markers.first; marker; marker= marker->next) {
+ /* only increase low if value is 1 greater than low, to find "gaps" where
+ * poses were removed from the poselib
+ */
+ if (marker->frame == (low + 1)) {
+ low++;
+ changed = 1;
+ }
+
+ /* value replaces high if it is the highest value encountered yet */
+ if (marker->frame > high) {
+ high= marker->frame;
+ changed = 1;
+ }
+ }
+ } while (changed != 0);
/* - if low is not equal to high, then low+1 is a gap
* - if low is equal to high, then high+1 is the next index (add at end)
@@ -331,6 +343,11 @@ static int poselib_sanitise_exec (bContext *C, wmOperator *op)
/* free temp memory */
BLI_dlrbTree_free(&keys);
+ /* send notifiers for this - using keyframe editing notifiers, since action
+ * may be being shown in anim editors as active action
+ */
+ WM_event_add_notifier(C, NC_ANIMATION|ND_KEYFRAME|NA_EDITED, NULL);
+
return OPERATOR_FINISHED;
}
@@ -555,6 +572,11 @@ static int poselib_remove_exec (bContext *C, wmOperator *op)
/* fix active pose number */
act->active_marker= 0;
+ /* send notifiers for this - using keyframe editing notifiers, since action
+ * may be being shown in anim editors as active action
+ */
+ WM_event_add_notifier(C, NC_ANIMATION|ND_KEYFRAME|NA_EDITED, NULL);
+
/* done */
return OPERATOR_FINISHED;
}
@@ -637,6 +659,11 @@ static int poselib_rename_exec (bContext *C, wmOperator *op)
BLI_strncpy(marker->name, newname, sizeof(marker->name));
BLI_uniquename(&act->markers, marker, "Pose", '.', offsetof(TimeMarker, name), sizeof(marker->name));
+ /* send notifiers for this - using keyframe editing notifiers, since action
+ * may be being shown in anim editors as active action
+ */
+ WM_event_add_notifier(C, NC_ANIMATION|ND_KEYFRAME|NA_EDITED, NULL);
+
/* done */
return OPERATOR_FINISHED;
}