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-03-16 04:12:37 +0300
committerJoshua Leung <aligorith@gmail.com>2009-03-16 04:12:37 +0300
commit8522b08e05c31f9fc4b5fee25c64b884593dc180 (patch)
tree0dd3b66d607ca3e3355d3a9f7311d5088ad28ce3 /source/blender/editors
parent9ad4cd89c2cdee8d8086f7da9d9b35fdec12366a (diff)
F-Curve Modifiers: Generator Modifier Code
* Rewrote the Generator modifier to be more efficient and support more options * A few UI tweaks for this, but the UI for this is still not yet functional though.
Diffstat (limited to 'source/blender/editors')
-rw-r--r--source/blender/editors/space_graph/graph_buttons.c57
-rw-r--r--source/blender/editors/space_graph/space_graph.c4
2 files changed, 52 insertions, 9 deletions
diff --git a/source/blender/editors/space_graph/graph_buttons.c b/source/blender/editors/space_graph/graph_buttons.c
index 7c078ad184d..c53b6a720de 100644
--- a/source/blender/editors/space_graph/graph_buttons.c
+++ b/source/blender/editors/space_graph/graph_buttons.c
@@ -231,8 +231,47 @@ static void do_graph_region_modifier_buttons(bContext *C, void *arg, int event)
}
}
+/* macro for use here to draw background box and set height */
+#define DRAW_BACKDROP(height, h) \
+ { \
+ height= h; \
+ if (active) uiBlockSetCol(block, TH_BUT_ACTION); \
+ uiDefBut(block, ROUNDBOX, B_REDR, "", 10-8, *yco-height, width, height-1, NULL, 5.0, 0.0, 12.0, (float)rb_col, ""); \
+ if (active) uiBlockSetCol(block, TH_AUTO); \
+ }
+
+/* draw settings for generator modifier */
+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;
+
+ switch (data->mode) {
+ case FCM_GENERATOR_POLYNOMIAL: /* polynomial expression */
+ {
+ /* we overwrite cvalue with the sum of the polynomial */
+ float value= 0.0f, *cp = NULL;
+ unsigned int i;
+
+ /* draw backdrop */
+ DRAW_BACKDROP((*height), 96);
+
+ /* for each coefficient, add to value, which we'll write to *cvalue in one go */
+ cp= data->coefficients;
+ for (i=0; (i < data->arraysize) && (cp); i++, cp++) {
+
+ }
+ }
+ break;
+
+#ifndef DISABLE_PYTHON
+ case FCM_GENERATOR_EXPRESSION: /* py-expression */
+ // TODO...
+ break;
+#endif /* DISABLE_PYTHON */
+ }
+}
+
-/* for now, just print name of modifier */
static void graph_panel_modifier_draw(uiBlock *block, FCurve *fcu, FModifier *fcm, int *yco)
{
FModifierTypeInfo *fmi= fmodifier_get_typeinfo(fcm);
@@ -269,12 +308,16 @@ static void graph_panel_modifier_draw(uiBlock *block, FCurve *fcu, FModifier *fc
/* when modifier is expanded, draw settings */
if (fcm->flag & FMODIFIER_FLAG_EXPANDED) {
- height= 97;
-
- /* draw backdrop */
- if (active) uiBlockSetCol(block, TH_BUT_ACTION);
- uiDefBut(block, ROUNDBOX, B_REDR, "", 10-8, *yco-height, width, height-1, NULL, 5.0, 0.0, 12.0, (float)rb_col, "");
- if (active) uiBlockSetCol(block, TH_AUTO);
+ /* draw settings for individual modifiers */
+ switch (fcm->type) {
+ case FMODIFIER_TYPE_GENERATOR: /* Generator */
+ _draw_modifier__generator(block, fcu, fcm, yco, &height, width, active, rb_col);
+ break;
+
+ default: /* unknown type */
+ DRAW_BACKDROP(height, 96);
+ break;
+ }
}
/* adjust height for new to start */
diff --git a/source/blender/editors/space_graph/space_graph.c b/source/blender/editors/space_graph/space_graph.c
index 9466a0674d1..10ba28dbcac 100644
--- a/source/blender/editors/space_graph/space_graph.c
+++ b/source/blender/editors/space_graph/space_graph.c
@@ -83,7 +83,7 @@ ARegion *graph_has_buttons_region(ScrArea *sa)
BLI_insertlinkafter(&sa->regionbase, ar, arnew);
arnew->regiontype= RGN_TYPE_UI;
- arnew->alignment= RGN_ALIGN_TOP|RGN_SPLIT_PREV;
+ arnew->alignment= RGN_ALIGN_BOTTOM|RGN_SPLIT_PREV;
arnew->flag = RGN_FLAG_HIDDEN;
@@ -569,7 +569,7 @@ void ED_spacetype_ipo(void)
/* regions: UI buttons */
art= MEM_callocN(sizeof(ARegionType), "spacetype graphedit region");
art->regionid = RGN_TYPE_UI;
- art->minsizey= 160;
+ art->minsizey= 200;
art->keymapflag= ED_KEYMAP_UI|ED_KEYMAP_FRAMES;
art->listener= NULL; // graph_region_listener;
art->init= graph_buttons_area_init;