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>2009-05-09 06:37:12 +0400
committerJoshua Leung <aligorith@gmail.com>2009-05-09 06:37:12 +0400
commit029c27b0bed239cfc9b27b6ef92bcd3d87bcfd1b (patch)
treedb4c07d66a0564e8ec4864f04db15547649a2bb5 /source/blender
parent5fa80e74a1d18ca8798b2b42f6b4ecc09787ba30 (diff)
2.5 Bugfixes:
More work on getting these marker-dependent tools working. They should finally work now :)
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/editors/animation/anim_filter.c4
-rw-r--r--source/blender/editors/animation/anim_markers.c17
-rw-r--r--source/blender/editors/include/ED_anim_api.h2
-rw-r--r--source/blender/editors/space_action/action_edit.c14
-rw-r--r--source/blender/editors/space_action/action_select.c14
-rw-r--r--source/blender/editors/space_graph/graph_edit.c13
-rw-r--r--source/blender/editors/space_graph/graph_select.c11
-rw-r--r--source/blender/editors/transform/transform.c8
8 files changed, 46 insertions, 37 deletions
diff --git a/source/blender/editors/animation/anim_filter.c b/source/blender/editors/animation/anim_filter.c
index b177a19a07f..67f89b3358d 100644
--- a/source/blender/editors/animation/anim_filter.c
+++ b/source/blender/editors/animation/anim_filter.c
@@ -292,9 +292,7 @@ short ANIM_animdata_get_context (const bContext *C, bAnimContext *ac)
/* get useful default context settings from context */
ac->scene= scene;
if (scene) {
- ac->markers.first= scene->markers.first;
- ac->markers.last= scene->markers.last;
-
+ ac->markers= &scene->markers;
ac->obact= (scene->basact)? scene->basact->object : NULL;
}
ac->sa= sa;
diff --git a/source/blender/editors/animation/anim_markers.c b/source/blender/editors/animation/anim_markers.c
index 3848eef3608..2abec6b831c 100644
--- a/source/blender/editors/animation/anim_markers.c
+++ b/source/blender/editors/animation/anim_markers.c
@@ -119,6 +119,7 @@ void ED_markers_get_minmax (ListBase *markers, short sel, float *first, float *l
int selcount = 0;
/* sanity check */
+ printf("markers = %p - %p, %p \n", markers, markers->first, markers->last);
if (markers == NULL) {
*first = 0.0f;
*last = 0.0f;
@@ -126,11 +127,11 @@ void ED_markers_get_minmax (ListBase *markers, short sel, float *first, float *l
}
if (markers->first && markers->last) {
- TimeMarker *first= markers->first;
- TimeMarker *last= markers->last;
+ TimeMarker *fm= markers->first;
+ TimeMarker *lm= markers->last;
- min= first->frame;
- max= last->frame;
+ min= (float)fm->frame;
+ max= (float)lm->frame;
}
else {
*first = 0.0f;
@@ -157,15 +158,15 @@ void ED_markers_get_minmax (ListBase *markers, short sel, float *first, float *l
if (marker->flag & SELECT) {
if (marker->frame < min)
min= (float)marker->frame;
- else if (marker->frame > max)
+ if (marker->frame > max)
max= (float)marker->frame;
}
}
else {
if (marker->frame < min)
- min= marker->frame;
- else if (marker->frame > max)
- max= marker->frame;
+ min= (float)marker->frame;
+ if (marker->frame > max)
+ max= (float)marker->frame;
}
}
}
diff --git a/source/blender/editors/include/ED_anim_api.h b/source/blender/editors/include/ED_anim_api.h
index e0f322b79ff..efc0a0b9a57 100644
--- a/source/blender/editors/include/ED_anim_api.h
+++ b/source/blender/editors/include/ED_anim_api.h
@@ -64,7 +64,7 @@ typedef struct bAnimContext {
struct Scene *scene; /* active scene */
struct Object *obact; /* active object */
- ListBase markers; /* active set of markers */
+ ListBase *markers; /* active set of markers */
} bAnimContext;
/* Main Data container types */
diff --git a/source/blender/editors/space_action/action_edit.c b/source/blender/editors/space_action/action_edit.c
index 99360450367..af074ca348d 100644
--- a/source/blender/editors/space_action/action_edit.c
+++ b/source/blender/editors/space_action/action_edit.c
@@ -1118,7 +1118,10 @@ static void snap_action_keys(bAnimContext *ac, short mode)
memset(&bed, 0, sizeof(BeztEditData));
bed.scene= ac->scene;
- bed.list= ac->scene->markers; /* for marker-snapping option */
+ if (mode == ACTKEYS_SNAP_NEAREST_MARKER) {
+ bed.list.first= (ac->markers) ? ac->markers->first : NULL;
+ bed.list.last= (ac->markers) ? ac->markers->last : NULL;
+ }
/* snap keyframes */
for (ale= anim_data.first; ale; ale= ale->next) {
@@ -1211,13 +1214,14 @@ static void mirror_action_keys(bAnimContext *ac, short mode)
/* for 'first selected marker' mode, need to find first selected marker first! */
// XXX should this be made into a helper func in the API?
if (mode == ACTKEYS_MIRROR_MARKER) {
- Scene *scene= ac->scene;
TimeMarker *marker= NULL;
/* find first selected marker */
- for (marker= scene->markers.first; marker; marker=marker->next) {
- if (marker->flag & SELECT) {
- break;
+ if (ac->markers) {
+ for (marker= ac->markers->first; marker; marker=marker->next) {
+ if (marker->flag & SELECT) {
+ break;
+ }
}
}
diff --git a/source/blender/editors/space_action/action_select.c b/source/blender/editors/space_action/action_select.c
index bb3f16dd506..d4782418be7 100644
--- a/source/blender/editors/space_action/action_select.c
+++ b/source/blender/editors/space_action/action_select.c
@@ -390,18 +390,19 @@ static void markers_selectkeys_between (bAnimContext *ac)
bAnimListElem *ale;
int filter;
- BeztEditFunc select_cb;
+ BeztEditFunc ok_cb, select_cb;
BeztEditData bed;
float min, max;
/* get extreme markers */
- ED_markers_get_minmax(&ac->markers, 1, &min, &max);
-
+ ED_markers_get_minmax(ac->markers, 1, &min, &max);
min -= 0.5f;
max += 0.5f;
/* get editing funcs + data */
+ ok_cb= ANIM_editkeyframes_ok(BEZT_OK_FRAMERANGE);
select_cb= ANIM_editkeyframes_select(SELECT_ADD);
+
memset(&bed, 0, sizeof(BeztEditData));
bed.f1= min;
bed.f2= max;
@@ -416,11 +417,11 @@ static void markers_selectkeys_between (bAnimContext *ac)
if (nob) {
ANIM_nla_mapping_apply_fcurve(nob, ale->key_data, 0, 1);
- ANIM_fcurve_keys_bezier_loop(&bed, ale->key_data, NULL, select_cb, NULL);
+ ANIM_fcurve_keys_bezier_loop(&bed, ale->key_data, ok_cb, select_cb, NULL);
ANIM_nla_mapping_apply_fcurve(nob, ale->key_data, 1, 1);
}
else {
- ANIM_fcurve_keys_bezier_loop(&bed, ale->key_data, NULL, select_cb, NULL);
+ ANIM_fcurve_keys_bezier_loop(&bed, ale->key_data, ok_cb, select_cb, NULL);
}
}
@@ -473,7 +474,7 @@ static void columnselect_action_keys (bAnimContext *ac, short mode)
break;
case ACTKEYS_COLUMNSEL_MARKERS_COLUMN: /* list of selected markers */
- ED_markers_make_cfra_list(&ac->markers, &bed.list, 1);
+ ED_markers_make_cfra_list(ac->markers, &bed.list, 1);
break;
default: /* invalid option */
@@ -765,6 +766,7 @@ static void mouse_action_keys (bAnimContext *ac, int mval[2], short select_mode,
if (ale == NULL) {
/* channel not found */
printf("Error: animation channel (index = %d) not found in mouse_action_keys() \n", channel_index);
+ return;
}
else {
/* found match - must return here... */
diff --git a/source/blender/editors/space_graph/graph_edit.c b/source/blender/editors/space_graph/graph_edit.c
index 40d66725847..d4bdfce5414 100644
--- a/source/blender/editors/space_graph/graph_edit.c
+++ b/source/blender/editors/space_graph/graph_edit.c
@@ -1396,7 +1396,10 @@ static void snap_graph_keys(bAnimContext *ac, short mode)
memset(&bed, 0, sizeof(BeztEditData));
bed.scene= ac->scene;
- bed.list= ac->markers; /* for marker-snapping option */
+ if (mode == GRAPHKEYS_SNAP_NEAREST_MARKER) {
+ bed.list.first= (ac->markers) ? ac->markers->first : NULL;
+ bed.list.last= (ac->markers) ? ac->markers->last : NULL;
+ }
/* snap keyframes */
for (ale= anim_data.first; ale; ale= ale->next) {
@@ -1490,9 +1493,11 @@ static void mirror_graph_keys(bAnimContext *ac, short mode)
TimeMarker *marker= NULL;
/* find first selected marker */
- for (marker= ac->markers.first; marker; marker=marker->next) {
- if (marker->flag & SELECT) {
- break;
+ if (ac->markers) {
+ for (marker= ac->markers->first; marker; marker=marker->next) {
+ if (marker->flag & SELECT) {
+ break;
+ }
}
}
diff --git a/source/blender/editors/space_graph/graph_select.c b/source/blender/editors/space_graph/graph_select.c
index a2ecb3a3fad..3a99c9498ac 100644
--- a/source/blender/editors/space_graph/graph_select.c
+++ b/source/blender/editors/space_graph/graph_select.c
@@ -354,18 +354,19 @@ static void markers_selectkeys_between (bAnimContext *ac)
bAnimListElem *ale;
int filter;
- BeztEditFunc select_cb;
+ BeztEditFunc ok_cb, select_cb;
BeztEditData bed;
float min, max;
/* get extreme markers */
- ED_markers_get_minmax(&ac->markers, 1, &min, &max);
-
+ ED_markers_get_minmax(ac->markers, 1, &min, &max);
min -= 0.5f;
max += 0.5f;
/* get editing funcs + data */
+ ok_cb= ANIM_editkeyframes_ok(BEZT_OK_FRAMERANGE);
select_cb= ANIM_editkeyframes_select(SELECT_ADD);
+
memset(&bed, 0, sizeof(BeztEditData));
bed.f1= min;
bed.f2= max;
@@ -380,11 +381,11 @@ static void markers_selectkeys_between (bAnimContext *ac)
if (nob) {
ANIM_nla_mapping_apply_fcurve(nob, ale->key_data, 0, 1);
- ANIM_fcurve_keys_bezier_loop(&bed, ale->key_data, NULL, select_cb, NULL);
+ ANIM_fcurve_keys_bezier_loop(&bed, ale->key_data, ok_cb, select_cb, NULL);
ANIM_nla_mapping_apply_fcurve(nob, ale->key_data, 1, 1);
}
else {
- ANIM_fcurve_keys_bezier_loop(&bed, ale->key_data, NULL, select_cb, NULL);
+ ANIM_fcurve_keys_bezier_loop(&bed, ale->key_data, ok_cb, select_cb, NULL);
}
}
diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c
index 1e1d12ff36c..4212964ccec 100644
--- a/source/blender/editors/transform/transform.c
+++ b/source/blender/editors/transform/transform.c
@@ -89,15 +89,13 @@
#include "BKE_utildefines.h"
#include "BKE_context.h"
-//#include "BSE_drawipo.h"
-//#include "BSE_editnla_types.h" /* for NLAWIDTH */
//#include "BSE_editaction_types.h"
-//#include "BSE_time.h"
//#include "BSE_view.h"
#include "ED_image.h"
#include "ED_screen.h"
#include "ED_space_api.h"
+#include "ED_markers.h"
#include "ED_util.h"
#include "ED_view3d.h"
@@ -4388,8 +4386,8 @@ static void doAnimEdit_SnapFrame(TransInfo *t, TransData *td, Object *ob, short
val= *(td->val);
/* snap to nearest marker */
- // XXX missing function!
- //val= (float)find_nearest_marker_time(val);
+ // TODO: need some more careful checks for where data comes from
+ val= (float)ED_markers_find_nearest_marker_time(&t->scene->markers, val);
/* convert frame out of nla-action time */
if (ob)