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-02 08:51:14 +0400
committerJoshua Leung <aligorith@gmail.com>2009-05-02 08:51:14 +0400
commit4cf8900c703e236cb67d6220812add28fabca46c (patch)
tree7c84e320f3d38e11341055e67b537c8cdc8d964b /source/blender/editors
parent4b025d68657c197b302516b96f69405aa957accf (diff)
F-Curve Modifiers - Per-Modifier Muting:
It is now possible to mute individual modifiers so that they will not contribute to the final result.
Diffstat (limited to 'source/blender/editors')
-rw-r--r--source/blender/editors/space_graph/graph_buttons.c11
-rw-r--r--source/blender/editors/space_graph/graph_draw.c41
2 files changed, 40 insertions, 12 deletions
diff --git a/source/blender/editors/space_graph/graph_buttons.c b/source/blender/editors/space_graph/graph_buttons.c
index 9c7c3c3e812..ee10e4ef3b3 100644
--- a/source/blender/editors/space_graph/graph_buttons.c
+++ b/source/blender/editors/space_graph/graph_buttons.c
@@ -871,17 +871,20 @@ static void graph_panel_modifier_draw(uiBlock *block, FCurve *fcu, FModifier *fc
but= uiDefBut(block, ROUNDBOX, B_REDR, "", 0, *yco-2, width, 24, NULL, 5.0, 0.0, 15.0, (float)(rb_col-20), "");
/* expand */
- uiDefIconButBitS(block, ICONTOG, FMODIFIER_FLAG_EXPANDED, B_REDR, ICON_TRIA_RIGHT, 5, *yco-1, 20, 20, &fcm->flag, 0.0, 0.0, 0, 0, "Modifier is expanded");
+ uiDefIconButBitS(block, ICONTOG, FMODIFIER_FLAG_EXPANDED, B_REDR, ICON_TRIA_RIGHT, 5, *yco-1, 20, 20, &fcm->flag, 0.0, 0.0, 0, 0, "Modifier is expanded.");
/* checkbox for 'active' status (for now) */
- but= uiDefIconButBitS(block, ICONTOG, FMODIFIER_FLAG_ACTIVE, B_REDR, ICON_RADIOBUT_OFF, 25, *yco-1, 20, 20, &fcm->flag, 0.0, 0.0, 0, 0, "Modifier is active one");
+ but= uiDefIconButBitS(block, ICONTOG, FMODIFIER_FLAG_ACTIVE, B_REDR, ICON_RADIOBUT_OFF, 25, *yco-1, 20, 20, &fcm->flag, 0.0, 0.0, 0, 0, "Modifier is active one.");
uiButSetFunc(but, activate_fmodifier_cb, fcu, fcm);
/* name */
if (fmi)
- but= uiDefBut(block, LABEL, 1, fmi->name, 10+40, *yco, 240, 20, NULL, 0.0, 0.0, 0, 0, "F-Curve Modifier Type. Click to make modifier active one.");
+ uiDefBut(block, LABEL, 1, fmi->name, 10+40, *yco, 150, 20, NULL, 0.0, 0.0, 0, 0, "F-Curve Modifier Type. Click to make modifier active one.");
else
- but= uiDefBut(block, LABEL, 1, "<Unknown Modifier>", 10+40, *yco, 240, 20, NULL, 0.0, 0.0, 0, 0, "F-Curve Modifier Type. Click to make modifier active one.");
+ uiDefBut(block, LABEL, 1, "<Unknown Modifier>", 10+40, *yco, 150, 20, NULL, 0.0, 0.0, 0, 0, "F-Curve Modifier Type. Click to make modifier active one.");
+
+ /* 'mute' button */
+ uiDefIconButBitS(block, ICONTOG, FMODIFIER_FLAG_MUTED, B_REDR, ICON_MUTE_IPO_OFF, 10+(width-60), *yco-1, 20, 20, &fcm->flag, 0.0, 0.0, 0, 0, "Modifier is temporarily muted (not evaluated).");
/* delete button */
but= uiDefIconBut(block, BUT, B_REDR, ICON_X, 10+(width-30), *yco, 19, 19, NULL, 0.0, 0.0, 0.0, 0.0, "Delete F-Curve Modifier.");
diff --git a/source/blender/editors/space_graph/graph_draw.c b/source/blender/editors/space_graph/graph_draw.c
index 6f33a5dd682..e3a6d502332 100644
--- a/source/blender/editors/space_graph/graph_draw.c
+++ b/source/blender/editors/space_graph/graph_draw.c
@@ -775,6 +775,37 @@ void graph_draw_ghost_curves (bAnimContext *ac, SpaceIpo *sipo, ARegion *ar, Vie
glDisable(GL_BLEND);
}
+/* check if any FModifiers to draw controls for - fcm is 'active' modifier */
+static 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 there's an active modifier - don't draw if it is cycles modifier, since
+ * that basically still shows the original points
+ */
+ if ((fcm) && (fcm->type == FMODIFIER_TYPE_CYCLES))
+ return 0;
+
+ /* if only one modifier - don't draw if it is muted or disabled */
+ if (fcu->modifiers.first == fcu->modifiers.last) {
+ fcm= fcu->modifiers.first;
+ if (fcm->flag & (FMODIFIER_FLAG_DISABLED|FMODIFIER_FLAG_MUTED))
+ 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;
+}
+
/* This is called twice from space_graph.c -> graph_main_area_draw()
* Unselected then selected F-Curves are drawn so that they do not occlude each other.
*/
@@ -853,14 +884,8 @@ void graph_draw_curves (bAnimContext *ac, SpaceIpo *sipo, ARegion *ar, View2DGri
}
/* 2) draw handles and vertices as appropriate based on active */
- if ( ((fcm) && (fcm->type != FMODIFIER_TYPE_CYCLES)) || (fcu->modifiers.first && !fcm) ) {
- /* draw controls for the 'active' modifier
- * - there may not be an 'active' modifier on this curve to draw
- * - this curve may not be active, so modifier controls shouldn't get drawn either
- *
- * NOTE: cycles modifier is currently an exception where the original points can still be edited, so
- * this branch is skipped... (TODO: set up the generic system for this so that we don't need special hacks like this)
- */
+ if (fcurve_needs_draw_fmodifier_controls(fcu, fcm)) {
+ /* only draw controls if this is the active modifier */
if ((fcu->flag & FCURVE_ACTIVE) && (fcm)) {
switch (fcm->type) {
case FMODIFIER_TYPE_ENVELOPE: /* envelope */