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
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.
-rw-r--r--source/blender/blenkernel/intern/fcurve.c2
-rw-r--r--source/blender/editors/space_graph/graph_buttons.c11
-rw-r--r--source/blender/editors/space_graph/graph_draw.c41
-rw-r--r--source/blender/makesdna/DNA_anim_types.h2
-rw-r--r--source/blender/makesrna/intern/rna_fcurve.c7
5 files changed, 49 insertions, 14 deletions
diff --git a/source/blender/blenkernel/intern/fcurve.c b/source/blender/blenkernel/intern/fcurve.c
index cb54d77f08e..a0e631cfe8f 100644
--- a/source/blender/blenkernel/intern/fcurve.c
+++ b/source/blender/blenkernel/intern/fcurve.c
@@ -2239,7 +2239,7 @@ float evaluate_fcurve (FCurve *fcu, float evaltime)
/* only evaluate if there's a callback for this */
// TODO: implement the 'influence' control feature...
if (fmi && fmi->evaluate_modifier) {
- if ((fcm->flag & FMODIFIER_FLAG_DISABLED) == 0)
+ if ((fcm->flag & (FMODIFIER_FLAG_DISABLED|FMODIFIER_FLAG_MUTED)) == 0)
fmi->evaluate_modifier(fcu, fcm, &cvalue, evaltime);
}
}
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 */
diff --git a/source/blender/makesdna/DNA_anim_types.h b/source/blender/makesdna/DNA_anim_types.h
index 7a2be3ff2a8..eefcf9f9ce5 100644
--- a/source/blender/makesdna/DNA_anim_types.h
+++ b/source/blender/makesdna/DNA_anim_types.h
@@ -61,6 +61,8 @@ enum {
FMODIFIER_FLAG_EXPANDED = (1<<1),
/* modifier is active one (in UI) for editing purposes */
FMODIFIER_FLAG_ACTIVE = (1<<2),
+ /* user wants modifier to be skipped */
+ FMODIFIER_FLAG_MUTED = (1<<3),
} eFModifier_Flags;
/* --- */
diff --git a/source/blender/makesrna/intern/rna_fcurve.c b/source/blender/makesrna/intern/rna_fcurve.c
index 2380d7e29e1..5b8e05f840b 100644
--- a/source/blender/makesrna/intern/rna_fcurve.c
+++ b/source/blender/makesrna/intern/rna_fcurve.c
@@ -491,10 +491,15 @@ void rna_def_fmodifier(BlenderRNA *brna)
RNA_def_property_boolean_sdna(prop, NULL, "flag", FMODIFIER_FLAG_EXPANDED);
RNA_def_property_ui_text(prop, "Expanded", "F-Curve Modifier's panel is expanded in UI.");
+ prop= RNA_def_property(srna, "muted", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", FMODIFIER_FLAG_MUTED);
+ RNA_def_property_ui_text(prop, "Muted", "F-Curve Modifier will not be evaluated.");
+
// XXX this is really an internal flag, but it may be useful for some tools to be able to access this...
prop= RNA_def_property(srna, "disabled", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", FMODIFIER_FLAG_DISABLED );
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", FMODIFIER_FLAG_DISABLED);
RNA_def_property_ui_text(prop, "Disabled", "F-Curve Modifier has invalid settings and will not be evaluated.");
// TODO: setting this to true must ensure that all others in stack are turned off too...