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>2010-11-17 15:02:36 +0300
committerJoshua Leung <aligorith@gmail.com>2010-11-17 15:02:36 +0300
commitf7137610390804b8016240bc6401540a912e2495 (patch)
treebc0409baecb7a837e93d5794e0bfd1128b5f7584 /source/blender/editors/space_graph/graph_utils.c
parent91217f117f739dc93381a4542094141f46639be3 (diff)
Keyframing Operators: Improved Error Messages
* Keyframing operators now use the reports system for displaying all its error messages. - The benefit of this is that users no longer need to check the console for error messages if keyframing fails. - Unfortunately, reports are not currently viewable in any space/view in Blender, so... * Added a temporary operator (UI_OT_reports_to_textblock), which can be accessed in the UI from the button which appears in place of the icon when more than one report exists. This dumps the current list of reports to a textblock "Recent Reports", from which they can be viewed. This isn't really nice, but at least we now have a way to view these again, which makes debugging some things a pain. * Bugfix #24606 - when trying to add keyframes to F-Curves with F-Modifiers already which alter the curve significantly enough that the keyframes will have no effect, there are now warnings which aim to alleviate any confusion.
Diffstat (limited to 'source/blender/editors/space_graph/graph_utils.c')
-rw-r--r--source/blender/editors/space_graph/graph_utils.c69
1 files changed, 8 insertions, 61 deletions
diff --git a/source/blender/editors/space_graph/graph_utils.c b/source/blender/editors/space_graph/graph_utils.c
index 927149a268d..417d92782cc 100644
--- a/source/blender/editors/space_graph/graph_utils.c
+++ b/source/blender/editors/space_graph/graph_utils.c
@@ -87,57 +87,6 @@ bAnimListElem *get_active_fcurve_channel (bAnimContext *ac)
/* ************************************************************** */
/* Operator Polling Callbacks */
-/* check if any FModifiers to draw controls for - fcm is 'active' modifier
- * used for the polling callbacks + also for drawing
- */
-// TODO: restructure these tests
-// TODO: maybe for now, just allow editing always for now...
-short fcurve_needs_draw_fmodifier_controls (FCurve *fcu, FModifier *fcm)
-{
- /* don't draw if there aren't any modifiers at all */
- if (fcu->modifiers.first == NULL)
- return 0;
-
- /* if only one modifier
- * - don't draw if it is muted or disabled
- * - set it as the active one if no active one is present
- */
- if (fcu->modifiers.first == fcu->modifiers.last) {
- fcm= fcu->modifiers.first;
- if (fcm->flag & (FMODIFIER_FLAG_DISABLED|FMODIFIER_FLAG_MUTED))
- return 0;
- }
-
- /* if there's an active modifier - don't draw if it doesn't drastically
- * alter the curve...
- */
- if (fcm) {
- switch (fcm->type) {
- /* clearly harmless */
- case FMODIFIER_TYPE_CYCLES:
- return 0;
- case FMODIFIER_TYPE_STEPPED:
- return 0;
-
- /* borderline... */
- case FMODIFIER_TYPE_NOISE:
- return 0;
- }
- }
-
- /* if only active modifier - don't draw if it is muted or disabled */
- if (fcm) {
- if (fcm->flag & (FMODIFIER_FLAG_DISABLED|FMODIFIER_FLAG_MUTED))
- return 0;
- }
-
- /* if we're still here, this means that there are modifiers with controls to be drawn */
- // FIXME: what happens if all the modifiers were muted/disabled
- return 1;
-}
-
-/* ------------------- */
-
/* Check if there are any visible keyframes (for selection tools) */
int graphop_visible_keyframes_poll (bContext *C)
{
@@ -167,7 +116,6 @@ int graphop_visible_keyframes_poll (bContext *C)
for (ale = anim_data.first; ale; ale= ale->next) {
FCurve *fcu= (FCurve *)ale->data;
- FModifier *fcm;
/* visible curves for selection must fulfull the following criteria:
* - it has bezier keyframes
@@ -176,10 +124,10 @@ int graphop_visible_keyframes_poll (bContext *C)
*/
if (fcu->bezt == NULL)
continue;
- fcm= find_active_fmodifier(&fcu->modifiers);
-
- found= (fcurve_needs_draw_fmodifier_controls(fcu, fcm) == 0);
- if (found) break;
+ if (fcurve_are_keyframes_usable(fcu)) {
+ found = 1;
+ break;
+ }
}
/* cleanup and return findings */
@@ -216,7 +164,6 @@ int graphop_editable_keyframes_poll (bContext *C)
for (ale = anim_data.first; ale; ale= ale->next) {
FCurve *fcu= (FCurve *)ale->data;
- FModifier *fcm;
/* editable curves must fulfull the following criteria:
* - it has bezier keyframes
@@ -226,10 +173,10 @@ int graphop_editable_keyframes_poll (bContext *C)
*/
if (fcu->bezt == NULL)
continue;
- fcm= find_active_fmodifier(&fcu->modifiers);
-
- found= (fcurve_needs_draw_fmodifier_controls(fcu, fcm) == 0);
- if (found) break;
+ if (fcurve_is_keyframable(fcu)) {
+ found = 1;
+ break;
+ }
}
/* cleanup and return findings */