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:
Diffstat (limited to 'source/blender/editors')
-rw-r--r--source/blender/editors/space_graph/graph_buttons.c129
-rw-r--r--source/blender/editors/space_graph/graph_intern.h2
2 files changed, 45 insertions, 86 deletions
diff --git a/source/blender/editors/space_graph/graph_buttons.c b/source/blender/editors/space_graph/graph_buttons.c
index f2dcd297866..e68ee53521d 100644
--- a/source/blender/editors/space_graph/graph_buttons.c
+++ b/source/blender/editors/space_graph/graph_buttons.c
@@ -404,8 +404,7 @@ static void delete_fmodifier_cb (bContext *C, void *fcu_v, void *fcm_v)
static void draw_modifier__generator(uiBlock *block, FCurve *fcu, FModifier *fcm, int *yco, short *height, short width, short active, int rb_col)
{
FMod_Generator *data= (FMod_Generator *)fcm->data;
- char gen_mode[]="Generator Type%t|Expanded Polynomial%x0|Factorised Polynomial%x1|Built-In Function%x2|Expression%x3";
- char fn_type[]="Built-In Function%t|Sin%x0|Cos%x1|Tan%x2|Square Root%x3|Natural Log%x4|Normalised Sin%x5";
+ char gen_mode[]="Generator Type%t|Expanded Polynomial%x0|Factorised Polynomial%x1";
int cy= *yco - 30;
uiBut *but;
@@ -418,22 +417,16 @@ static void draw_modifier__generator(uiBlock *block, FCurve *fcu, FModifier *fcm
case FCM_GENERATOR_POLYNOMIAL_FACTORISED: /* factorised polynomial */
(*height) += 20 * data->poly_order + 15;
break;
- case FCM_GENERATOR_FUNCTION: /* builtin function */
- (*height) += 55; // xxx
- break;
- case FCM_GENERATOR_EXPRESSION: /* py-expression */
- // xxx nothing to draw
- break;
}
/* basic settings (backdrop + mode selector + some padding) */
DRAW_BACKDROP((*height));
uiBlockBeginAlign(block);
- but= uiDefButS(block, MENU, B_FMODIFIER_REDRAW, gen_mode, 10,cy,width-30,19, &data->mode, 0, 0, 0, 0, "Selects type of generator algorithm.");
+ but= uiDefButI(block, MENU, B_FMODIFIER_REDRAW, gen_mode, 10,cy,width-30,19, &data->mode, 0, 0, 0, 0, "Selects type of generator algorithm.");
uiButSetFunc(but, validate_fmodifier_cb, fcu, fcm);
cy -= 20;
- uiDefButBitS(block, TOG, FCM_GENERATOR_ADDITIVE, B_FMODIFIER_REDRAW, "Additive", 10,cy,width-30,19, &data->flag, 0, 0, 0, 0, "Values generated by this modifier are applied on top of the existing values instead of overwriting them");
+ uiDefButBitI(block, TOG, FCM_GENERATOR_ADDITIVE, B_FMODIFIER_REDRAW, "Additive", 10,cy,width-30,19, &data->flag, 0, 0, 0, 0, "Values generated by this modifier are applied on top of the existing values instead of overwriting them");
cy -= 35;
uiBlockEndAlign(block);
@@ -446,7 +439,7 @@ static void draw_modifier__generator(uiBlock *block, FCurve *fcu, FModifier *fcm
unsigned int i;
/* draw polynomial order selector */
- but= uiDefButS(block, NUM, B_FMODIFIER_REDRAW, "Poly Order: ", 10,cy,width-30,19, &data->poly_order, 1, 100, 0, 0, "'Order' of the Polynomial - for a polynomial with n terms, 'order' is n-1");
+ but= uiDefButI(block, NUM, B_FMODIFIER_REDRAW, "Poly Order: ", 10,cy,width-30,19, &data->poly_order, 1, 100, 0, 0, "'Order' of the Polynomial - for a polynomial with n terms, 'order' is n-1");
uiButSetFunc(but, validate_fmodifier_cb, fcu, fcm);
cy -= 35;
@@ -481,7 +474,7 @@ static void draw_modifier__generator(uiBlock *block, FCurve *fcu, FModifier *fcm
unsigned int i;
/* draw polynomial order selector */
- but= uiDefButS(block, NUM, B_FMODIFIER_REDRAW, "Poly Order: ", 10,cy,width-30,19, &data->poly_order, 1, 100, 0, 0, "'Order' of the Polynomial - for a polynomial with n terms, 'order' is n-1");
+ but= uiDefButI(block, NUM, B_FMODIFIER_REDRAW, "Poly Order: ", 10,cy,width-30,19, &data->poly_order, 1, 100, 0, 0, "'Order' of the Polynomial - for a polynomial with n terms, 'order' is n-1");
uiButSetFunc(but, validate_fmodifier_cb, fcu, fcm);
cy -= 35;
@@ -510,82 +503,42 @@ static void draw_modifier__generator(uiBlock *block, FCurve *fcu, FModifier *fcm
}
}
break;
-
- case FCM_GENERATOR_FUNCTION: /* built-in function */
- {
- float *cp= data->coefficients;
-
- /* draw function selector */
- but= uiDefButS(block, MENU, B_FMODIFIER_REDRAW, fn_type, 10,cy,width-30,19, &data->func_type, 0, 0, 0, 0, "Built-In Function to use");
- uiButSetFunc(but, validate_fmodifier_cb, fcu, fcm);
- cy -= 35;
-
- /* draw controls for equation of coefficients */
- /* row 1 */
- {
- uiDefBut(block, LABEL, 1, "y = ", 0, cy, 50, 20, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefButF(block, NUM, B_FMODIFIER_REDRAW, "", 50, cy, 150, 20, cp+3, -UI_FLT_MAX, UI_FLT_MAX, 10, 3, "Coefficient (D) for function");
- uiDefBut(block, LABEL, 1, "+", 200, cy, 30, 20, NULL, 0.0, 0.0, 0, 0, "");
- cy -= 20;
- }
-
- /* row 2 */
- {
- char func_name[32];
-
- /* coefficient outside bracket */
- uiDefButF(block, NUM, B_FMODIFIER_REDRAW, "", 5, cy, 80, 20, cp, -UI_FLT_MAX, UI_FLT_MAX, 10, 3, "Coefficient (A) for function");
-
- /* opening bracket */
- switch (data->func_type)
- {
- case FCM_GENERATOR_FN_SIN: /* sine wave */
- sprintf(func_name, "sin(");
- break;
- case FCM_GENERATOR_FN_COS: /* cosine wave */
- sprintf(func_name, "cos(");
- break;
- case FCM_GENERATOR_FN_TAN: /* tangent wave */
- sprintf(func_name, "tan(");
- break;
- case FCM_GENERATOR_FN_LN: /* natural log */
- sprintf(func_name, "ln(");
- break;
- case FCM_GENERATOR_FN_SQRT: /* square root */
- sprintf(func_name, "sqrt(");
- break;
- case FCM_GENERATOR_FN_SINC: /* normalised sine wave */
- sprintf(func_name, "sinc(");
- break;
- default: /* unknown */
- sprintf(func_name, "<fn?>(");
- break;
- }
- uiDefBut(block, LABEL, 1, func_name, 85, cy, 40, 20, NULL, 0.0, 0.0, 0, 0, "");
-
- /* coefficients inside bracket */
- uiDefButF(block, NUM, B_FMODIFIER_REDRAW, "", 120, cy, 75, 20, cp+1, -UI_FLT_MAX, UI_FLT_MAX, 10, 3, "Coefficient (B) of x");
-
- uiDefBut(block, LABEL, 1, "x+", 195, cy, 30, 20, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefButF(block, NUM, B_FMODIFIER_REDRAW, "", 225, cy, 80, 20, cp+2, -UI_FLT_MAX, UI_FLT_MAX, 10, 3, "Coefficient (C) of function");
-
- /* closing bracket */
- uiDefBut(block, LABEL, 1, ")", 300, cy, 30, 20, NULL, 0.0, 0.0, 0, 0, "");
- cy -= 20;
- }
- }
- break;
-
- case FCM_GENERATOR_EXPRESSION: /* py-expression */
- // TODO...
- break;
}
}
/* --------------- */
+/* draw settings for noise modifier */
+static void draw_modifier__fn_generator(uiBlock *block, FCurve *fcu, FModifier *fcm, int *yco, short *height, short width, short active, int rb_col)
+{
+ FMod_FunctionGenerator *data= (FMod_FunctionGenerator *)fcm->data;
+ int cy= (*yco - 30), cy1= (*yco - 50), cy2= (*yco - 70);
+ char fn_type[]="Built-In Function%t|Sin%x0|Cos%x1|Tan%x2|Square Root%x3|Natural Log%x4|Normalised Sin%x5";
+
+ /* set the height */
+ (*height) = 80;
+
+ /* basic settings (backdrop + some padding) */
+ DRAW_BACKDROP((*height));
+
+ uiDefButI(block, MENU, B_FMODIFIER_REDRAW, fn_type,
+ 3, cy, 300, 20, &data->type, 0, 0, 0, 0, "Type of function used to generate values");
+
+
+ uiDefButF(block, NUM, B_FMODIFIER_REDRAW, "Amplitude:",
+ 3, cy1, 150, 20, &data->amplitude, 0.000001, 10000.0, 0.01, 3, "Scale factor determining the maximum/minimum values.");
+ uiDefButF(block, NUM, B_FMODIFIER_REDRAW, "Value Offset:",
+ 3, cy2, 150, 20, &data->value_offset, 0.0, 10000.0, 0.01, 3, "Constant factor to offset values by.");
+
+ uiDefButF(block, NUM, B_FMODIFIER_REDRAW, "Phase Multiplier:",
+ 155, cy1, 150, 20, &data->phase_multiplier, 0.0, 100000.0, 0.1, 3, "Scale factor determining the 'speed' of the function.");
+ uiDefButF(block, NUM, B_FMODIFIER_REDRAW, "Phase Offset:",
+ 155, cy2, 150, 20, &data->phase_offset, 0.0, 100000.0, 0.1, 3, "Constant factor to offset time by for function.");
+
+}
+
+/* --------------- */
+
/* draw settings for cycles modifier */
static void draw_modifier__cycles(uiBlock *block, FCurve *fcu, FModifier *fcm, int *yco, short *height, short width, short active, int rb_col)
{
@@ -621,7 +574,7 @@ static void draw_modifier__noise(uiBlock *block, FCurve *fcu, FModifier *fcm, in
{
FMod_Noise *data= (FMod_Noise *)fcm->data;
int cy= (*yco - 30), cy1= (*yco - 50), cy2= (*yco - 70);
- char cyc_mode[]="Modification %t|Replace %x0|Add %x1|Subtract %x2|Multiply %x3";
+ char blend_mode[]="Modification %t|Replace %x0|Add %x1|Subtract %x2|Multiply %x3";
/* set the height */
(*height) = 80;
@@ -629,8 +582,8 @@ static void draw_modifier__noise(uiBlock *block, FCurve *fcu, FModifier *fcm, in
/* basic settings (backdrop + some padding) */
DRAW_BACKDROP((*height));
- uiDefButS(block, MENU, B_FMODIFIER_REDRAW, cyc_mode,
- 3, cy, 150, 20, &data->modification, 0, 0, 0, 0, "Method of modifying the existing F-Curve use before first keyframe");
+ uiDefButS(block, MENU, B_FMODIFIER_REDRAW, blend_mode,
+ 3, cy, 150, 20, &data->modification, 0, 0, 0, 0, "Method of combining the results of this modifier and other modifiers.");
uiDefButF(block, NUM, B_FMODIFIER_REDRAW, "Size:",
3, cy1, 150, 20, &data->size, 0.000001, 10000.0, 0.01, 3, "");
@@ -946,6 +899,10 @@ static void graph_panel_modifier_draw(uiBlock *block, FCurve *fcu, FModifier *fc
draw_modifier__generator(block, fcu, fcm, yco, &height, width, active, rb_col);
break;
+ case FMODIFIER_TYPE_FN_GENERATOR: /* Built-In Function Generator */
+ draw_modifier__fn_generator(block, fcu, fcm, yco, &height, width, active, rb_col);
+ break;
+
case FMODIFIER_TYPE_CYCLES: /* Cycles */
draw_modifier__cycles(block, fcu, fcm, yco, &height, width, active, rb_col);
break;
diff --git a/source/blender/editors/space_graph/graph_intern.h b/source/blender/editors/space_graph/graph_intern.h
index fd7fe7cc6c9..86e5451122d 100644
--- a/source/blender/editors/space_graph/graph_intern.h
+++ b/source/blender/editors/space_graph/graph_intern.h
@@ -32,6 +32,8 @@ struct bContext;
struct wmWindowManager;
struct bAnimContext;
struct bAnimListElem;
+struct FCurve;
+struct FModifier;
struct SpaceIpo;
struct ScrArea;
struct ARegion;