113
106
/* draw settings for generator modifier */
114
107
static void draw_modifier__generator(uiLayout *layout, ID *id, FModifier *fcm, short width)
116
FMod_Generator *data= (FMod_Generator *)fcm->data;
109
FMod_Generator *data = (FMod_Generator *)fcm->data;
117
110
uiLayout /* *col, */ /* UNUSED */ *row;
114
short bwidth = width - 30; /* max button width */
122
116
/* init the RNA-pointer */
123
117
RNA_pointer_create(id, &RNA_FModifierFunctionGenerator, fcm, &ptr);
125
119
/* basic settings (backdrop + mode selector + some padding) */
126
/* col= uiLayoutColumn(layout, 1); */ /* UNUSED */
127
block= uiLayoutGetBlock(layout);
120
/* col = uiLayoutColumn(layout, TRUE); */ /* UNUSED */
121
block = uiLayoutGetBlock(layout);
128
122
uiBlockBeginAlign(block);
129
but = uiDefButR(block, MENU, B_FMODIFIER_REDRAW, NULL, 0, 0, width-30, UI_UNIT_Y, &ptr, "mode", -1, 0, 0, -1, -1, NULL);
130
uiButSetFunc(but, validate_fmodifier_cb, fcm, NULL);
132
uiDefButR(block, TOG, B_FMODIFIER_REDRAW, NULL, 0, 0, width-30, UI_UNIT_Y, &ptr, "use_additive", -1, 0, 0, -1, -1, NULL);
123
but = uiDefButR(block, MENU, B_FMODIFIER_REDRAW, NULL, 0, 0, bwidth, UI_UNIT_Y, &ptr, "mode", -1, 0, 0, -1, -1, NULL);
124
uiButSetFunc(but, validate_fmodifier_cb, fcm, NULL);
126
uiDefButR(block, TOG, B_FMODIFIER_REDRAW, NULL, 0, 0, bwidth, UI_UNIT_Y, &ptr, "use_additive", -1, 0, 0, -1, -1, NULL);
133
127
uiBlockEndAlign(block);
135
129
/* now add settings for individual modes */
139
133
float *cp = NULL;
143
138
/* draw polynomial order selector */
144
row= uiLayoutRow(layout, 0);
145
block= uiLayoutGetBlock(row);
146
but = uiDefButI(block, NUM, B_FMODIFIER_REDRAW, IFACE_("Poly Order:"), 10, 0, width-30, 19,
147
&data->poly_order, 1, 100, 0, 0,
148
TIP_("'Order' of the Polynomial (for a polynomial with n terms, 'order' is n-1)"));
149
uiButSetFunc(but, validate_fmodifier_cb, fcm, NULL);
139
row = uiLayoutRow(layout, FALSE);
140
block = uiLayoutGetBlock(row);
141
but = uiDefButI(block, NUM, B_FMODIFIER_REDRAW, IFACE_("Poly Order:"), 10, 0, bwidth, 20,
142
&data->poly_order, 1, 100, 0, 0,
143
TIP_("'Order' of the Polynomial (for a polynomial with n terms, 'order' is n-1)"));
144
uiButSetFunc(but, validate_fmodifier_cb, fcm, NULL);
147
/* calculate maximum width of label for "x^n" labels */
148
if (data->arraysize > 2) {
149
BLI_snprintf(xval, sizeof(xval), "x^%u", data->arraysize);
150
maxXWidth = UI_GetStringWidth(xval) + 10; /* XXX: UI_GetStringWidth is not accurate */
153
/* basic size (just "x") */
154
maxXWidth = UI_GetStringWidth("x") + 10;
152
157
/* draw controls for each coefficient and a + sign at end of row */
153
row= uiLayoutRow(layout, 1);
154
block= uiLayoutGetBlock(row);
158
row = uiLayoutRow(layout, TRUE);
159
block = uiLayoutGetBlock(row);
156
cp= data->coefficients;
157
for (i=0; (i < data->arraysize) && (cp); i++, cp++) {
158
/* To align with first line */
161
cp = data->coefficients;
162
for (i = 0; (i < data->arraysize) && (cp); i++, cp++) {
163
/* To align with first line... */
160
uiDefBut(block, LABEL, 1, " ", 0, 0, 50, 20, NULL, 0.0, 0.0, 0, 0, "");
165
uiDefBut(block, LABEL, 1, " ", 0, 0, 40, 20, NULL, 0.0, 0.0, 0, 0, "");
162
uiDefBut(block, LABEL, 1, "y =", 0, 0, 50, 20, NULL, 0.0, 0.0, 0, 0, "");
167
uiDefBut(block, LABEL, 1, "y =", 0, 0, 40, 20, NULL, 0.0, 0.0, 0, 0, "");
163
169
/* coefficient */
164
uiDefButF(block, NUM, B_FMODIFIER_REDRAW, "", 0, 0, 150, 20, cp, -UI_FLT_MAX, UI_FLT_MAX,
170
uiDefButF(block, NUM, B_FMODIFIER_REDRAW, "", 0, 0, bwidth / 2, 20, cp, -UI_FLT_MAX, UI_FLT_MAX,
165
171
10, 3, TIP_("Coefficient for polynomial"));
167
173
/* 'x' param (and '+' if necessary) */
175
BLI_strncpy(xval, "", sizeof(xval));
177
BLI_strncpy(xval, "x", sizeof(xval));
173
sprintf(xval, "x^%u", i);
174
uiDefBut(block, LABEL, 1, xval, 0, 0, 50, 20, NULL, 0.0, 0.0, 0, 0, TIP_("Power of x"));
179
BLI_snprintf(xval, sizeof(xval), "x^%u", i);
180
uiDefBut(block, LABEL, 1, xval, 0, 0, maxXWidth, 20, NULL, 0.0, 0.0, 0, 0, TIP_("Power of x"));
176
if ( (i != (data->arraysize - 1)) || ((i==0) && data->arraysize==2) ) {
177
uiDefBut(block, LABEL, 1, "+", 0, 0, 30, 20, NULL, 0.0, 0.0, 0, 0, "");
182
if ( (i != (data->arraysize - 1)) || ((i == 0) && data->arraysize == 2) ) {
183
uiDefBut(block, LABEL, 1, "+", 0, 0, 20, 20, NULL, 0.0, 0.0, 0, 0, "");
179
185
/* next coefficient on a new row */
180
row= uiLayoutRow(layout, 1);
181
block= uiLayoutGetBlock(row);
186
row = uiLayoutRow(layout, TRUE);
187
block = uiLayoutGetBlock(row);
184
/* For alignement in UI! */
185
uiDefBut(block, LABEL, 1, " ", 0, 0, 30, 20, NULL, 0.0, 0.0, 0, 0, "");
190
/* For alignment in UI! */
191
uiDefBut(block, LABEL, 1, " ", 0, 0, 20, 20, NULL, 0.0, 0.0, 0, 0, "");
196
202
/* draw polynomial order selector */
197
row= uiLayoutRow(layout, 0);
198
block= uiLayoutGetBlock(row);
199
but = uiDefButI(block, NUM, B_FMODIFIER_REDRAW, IFACE_("Poly Order:"), 0, 0, width-30, 19,
200
&data->poly_order, 1, 100, 0, 0,
201
TIP_("'Order' of the Polynomial (for a polynomial with n terms, 'order' is n-1)"));
202
uiButSetFunc(but, validate_fmodifier_cb, fcm, NULL);
203
row = uiLayoutRow(layout, FALSE);
204
block = uiLayoutGetBlock(row);
205
but = uiDefButI(block, NUM, B_FMODIFIER_REDRAW, IFACE_("Poly Order:"), 0, 0, width - 30, 19,
206
&data->poly_order, 1, 100, 0, 0,
207
TIP_("'Order' of the Polynomial (for a polynomial with n terms, 'order' is n-1)"));
208
uiButSetFunc(but, validate_fmodifier_cb, fcm, NULL);
205
211
/* draw controls for each pair of coefficients */
206
row= uiLayoutRow(layout, 1);
207
block= uiLayoutGetBlock(row);
212
row = uiLayoutRow(layout, TRUE);
213
block = uiLayoutGetBlock(row);
209
cp= data->coefficients;
210
for (i=0; (i < data->poly_order) && (cp); i++, cp+=2) {
215
cp = data->coefficients;
216
for (i = 0; (i < data->poly_order) && (cp); i++, cp += 2) {
211
217
/* To align with first line */
213
219
uiDefBut(block, LABEL, 1, " ", 0, 0, 50, 20, NULL, 0.0, 0.0, 0, 0, "");
223
229
uiDefBut(block, LABEL, 1, "x +", 0, 0, 40, 20, NULL, 0.0, 0.0, 0, 0, "");
225
uiDefButF(block, NUM, B_FMODIFIER_REDRAW, "", 0, 0, 100, 20, cp+1, -UI_FLT_MAX, UI_FLT_MAX,
231
uiDefButF(block, NUM, B_FMODIFIER_REDRAW, "", 0, 0, 100, 20, cp + 1, -UI_FLT_MAX, UI_FLT_MAX,
226
232
10, 3, TIP_("Second coefficient"));
228
/* closing bracket and '+' sign */
229
if ( (i != (data->poly_order - 1)) || ((i==0) && data->poly_order==2) ) {
230
uiDefBut(block, LABEL, 1, ") +", 0, 0, 30, 20, NULL, 0.0, 0.0, 0, 0, "");
234
/* closing bracket and multiplication sign */
235
if ( (i != (data->poly_order - 1)) || ((i == 0) && data->poly_order == 2) ) {
236
uiDefBut(block, LABEL, 1, ") ×", 0, 0, 40, 20, NULL, 0.0, 0.0, 0, 0, "");
232
/* set up new row for the next pair of coefficients*/
233
row= uiLayoutRow(layout, 1);
234
block= uiLayoutGetBlock(row);
238
/* set up new row for the next pair of coefficients */
239
row = uiLayoutRow(layout, TRUE);
240
block = uiLayoutGetBlock(row);
237
uiDefBut(block, LABEL, 1, ")", 0, 0, 20, 20, NULL, 0.0, 0.0, 0, 0, "");
243
uiDefBut(block, LABEL, 1, ") ", 0, 0, 40, 20, NULL, 0.0, 0.0, 0, 0, "");
253
259
RNA_pointer_create(id, &RNA_FModifierFunctionGenerator, fcm, &ptr);
255
261
/* add the settings */
256
col= uiLayoutColumn(layout, 1);
257
uiItemR(col, &ptr, "function_type", 0, "", ICON_NONE);
258
uiItemR(col, &ptr, "use_additive", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
260
col= uiLayoutColumn(layout, 0); // no grouping for now
261
uiItemR(col, &ptr, "amplitude", 0, NULL, ICON_NONE);
262
uiItemR(col, &ptr, "phase_multiplier", 0, NULL, ICON_NONE);
263
uiItemR(col, &ptr, "phase_offset", 0, NULL, ICON_NONE);
264
uiItemR(col, &ptr, "value_offset", 0, NULL, ICON_NONE);
262
col = uiLayoutColumn(layout, TRUE);
263
uiItemR(col, &ptr, "function_type", 0, "", ICON_NONE);
264
uiItemR(col, &ptr, "use_additive", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
266
col = uiLayoutColumn(layout, FALSE); // no grouping for now
267
uiItemR(col, &ptr, "amplitude", 0, NULL, ICON_NONE);
268
uiItemR(col, &ptr, "phase_multiplier", 0, NULL, ICON_NONE);
269
uiItemR(col, &ptr, "phase_offset", 0, NULL, ICON_NONE);
270
uiItemR(col, &ptr, "value_offset", 0, NULL, ICON_NONE);
267
273
/* --------------- */
278
284
/* split into 2 columns
279
285
* NOTE: the mode comboboxes shouldn't get labels, otherwise there isn't enough room
281
split= uiLayoutSplit(layout, 0.5f, 0);
287
split = uiLayoutSplit(layout, 0.5f, FALSE);
283
289
/* before range */
284
col= uiLayoutColumn(split, 1);
285
uiItemL(col, IFACE_("Before:"), ICON_NONE);
286
uiItemR(col, &ptr, "mode_before", 0, "", ICON_NONE);
287
uiItemR(col, &ptr, "cycles_before", 0, NULL, ICON_NONE);
290
col = uiLayoutColumn(split, TRUE);
291
uiItemL(col, IFACE_("Before:"), ICON_NONE);
292
uiItemR(col, &ptr, "mode_before", 0, "", ICON_NONE);
293
uiItemR(col, &ptr, "cycles_before", 0, NULL, ICON_NONE);
289
295
/* after range */
290
col= uiLayoutColumn(split, 1);
291
uiItemL(col, IFACE_("After:"), ICON_NONE);
292
uiItemR(col, &ptr, "mode_after", 0, "", ICON_NONE);
293
uiItemR(col, &ptr, "cycles_after", 0, NULL, ICON_NONE);
296
col = uiLayoutColumn(split, TRUE);
297
uiItemL(col, IFACE_("After:"), ICON_NONE);
298
uiItemR(col, &ptr, "mode_after", 0, "", ICON_NONE);
299
uiItemR(col, &ptr, "cycles_after", 0, NULL, ICON_NONE);
296
302
/* --------------- */
308
314
uiItemR(layout, &ptr, "blend_type", 0, NULL, ICON_NONE);
310
316
/* split into 2 columns */
311
split= uiLayoutSplit(layout, 0.5f, 0);
317
split = uiLayoutSplit(layout, 0.5f, FALSE);
314
col= uiLayoutColumn(split, 0);
315
uiItemR(col, &ptr, "scale", 0, NULL, ICON_NONE);
316
uiItemR(col, &ptr, "strength", 0, NULL, ICON_NONE);
320
col = uiLayoutColumn(split, FALSE);
321
uiItemR(col, &ptr, "scale", 0, NULL, ICON_NONE);
322
uiItemR(col, &ptr, "strength", 0, NULL, ICON_NONE);
319
col= uiLayoutColumn(split, 0);
320
uiItemR(col, &ptr, "phase", 0, NULL, ICON_NONE);
321
uiItemR(col, &ptr, "depth", 0, NULL, ICON_NONE);
324
/* --------------- */
326
#define BINARYSEARCH_FRAMEEQ_THRESH 0.0001f
328
/* Binary search algorithm for finding where to insert Envelope Data Point.
329
* Returns the index to insert at (data already at that index will be offset if replace is 0)
331
static int binarysearch_fcm_envelopedata_index (FCM_EnvelopeData array[], float frame, int arraylen, short *exists)
333
int start=0, end=arraylen;
334
int loopbreaker= 0, maxloop= arraylen * 2;
336
/* initialize exists-flag first */
339
/* sneaky optimisations (don't go through searching process if...):
340
* - keyframe to be added is to be added out of current bounds
341
* - keyframe to be added would replace one of the existing ones on bounds
343
if ((arraylen <= 0) || (array == NULL)) {
344
printf("Warning: binarysearch_fcm_envelopedata_index() encountered invalid array\n");
348
/* check whether to add before/after/on */
351
/* 'First' Point (when only one point, this case is used) */
352
framenum= array[0].time;
353
if (IS_EQT(frame, framenum, BINARYSEARCH_FRAMEEQ_THRESH)) {
357
else if (frame < framenum)
361
framenum= array[(arraylen-1)].time;
362
if (IS_EQT(frame, framenum, BINARYSEARCH_FRAMEEQ_THRESH)) {
364
return (arraylen - 1);
366
else if (frame > framenum)
371
/* most of the time, this loop is just to find where to put it
372
* - 'loopbreaker' is just here to prevent infinite loops
374
for (loopbreaker=0; (start <= end) && (loopbreaker < maxloop); loopbreaker++) {
375
/* compute and get midpoint */
376
int mid = start + ((end - start) / 2); /* we calculate the midpoint this way to avoid int overflows... */
377
float midfra= array[mid].time;
379
/* check if exactly equal to midpoint */
380
if (IS_EQT(frame, midfra, BINARYSEARCH_FRAMEEQ_THRESH)) {
385
/* repeat in upper/lower half */
388
else if (frame < midfra)
392
/* print error if loop-limit exceeded */
393
if (loopbreaker == (maxloop-1)) {
394
printf("Error: binarysearch_fcm_envelopedata_index() was taking too long\n");
396
// include debug info
397
printf("\tround = %d: start = %d, end = %d, arraylen = %d\n", loopbreaker, start, end, arraylen);
400
/* not found, so return where to place it */
325
col = uiLayoutColumn(split, FALSE);
326
uiItemR(col, &ptr, "phase", 0, NULL, ICON_NONE);
327
uiItemR(col, &ptr, "depth", 0, NULL, ICON_NONE);
404
330
/* callback to add new envelope data point */
405
// TODO: should we have a separate file for things like this?
406
static void fmod_envelope_addpoint_cb (bContext *C, void *fcm_dv, void *UNUSED(arg))
331
static void fmod_envelope_addpoint_cb(bContext *C, void *fcm_dv, void *UNUSED(arg))
408
Scene *scene= CTX_data_scene(C);
409
FMod_Envelope *env= (FMod_Envelope *)fcm_dv;
333
Scene *scene = CTX_data_scene(C);
334
FMod_Envelope *env = (FMod_Envelope *)fcm_dv;
410
335
FCM_EnvelopeData *fedn;
411
336
FCM_EnvelopeData fed;
413
338
/* init template data */
416
fed.time= (float)scene->r.cfra; // XXX make this int for ease of use?
341
fed.time = (float)scene->r.cfra; // XXX make this int for ease of use?
419
344
/* check that no data exists for the current frame... */
421
346
short exists = -1;
422
int i= binarysearch_fcm_envelopedata_index(env->data, (float)(scene->r.cfra), env->totvert, &exists);
347
int i = BKE_fcm_envelope_find_index(env->data, (float)(scene->r.cfra), env->totvert, &exists);
424
349
/* binarysearch_...() will set exists by default to 0, so if it is non-zero, that means that the point exists already */
429
fedn= MEM_callocN((env->totvert+1)*sizeof(FCM_EnvelopeData), "FCM_EnvelopeData");
354
fedn = MEM_callocN((env->totvert + 1) * sizeof(FCM_EnvelopeData), "FCM_EnvelopeData");
431
356
/* add the points that should occur before the point to be pasted */
433
memcpy(fedn, env->data, i*sizeof(FCM_EnvelopeData));
358
memcpy(fedn, env->data, i * sizeof(FCM_EnvelopeData));
435
360
/* add point to paste at index i */
438
363
/* add the points that occur after the point to be pasted */
439
364
if (i < env->totvert)
440
memcpy(fedn+i+1, env->data+i, (env->totvert-i)*sizeof(FCM_EnvelopeData));
365
memcpy(fedn + i + 1, env->data + i, (env->totvert - i) * sizeof(FCM_EnvelopeData));
442
367
/* replace (+ free) old with new */
443
368
MEM_freeN(env->data);
449
env->data= MEM_callocN(sizeof(FCM_EnvelopeData), "FCM_EnvelopeData");
374
env->data = MEM_callocN(sizeof(FCM_EnvelopeData), "FCM_EnvelopeData");
456
381
/* callback to remove envelope data point */
457
382
// TODO: should we have a separate file for things like this?
458
static void fmod_envelope_deletepoint_cb (bContext *UNUSED(C), void *fcm_dv, void *ind_v)
383
static void fmod_envelope_deletepoint_cb(bContext *UNUSED(C), void *fcm_dv, void *ind_v)
460
FMod_Envelope *env= (FMod_Envelope *)fcm_dv;
385
FMod_Envelope *env = (FMod_Envelope *)fcm_dv;
461
386
FCM_EnvelopeData *fedn;
462
int index= GET_INT_FROM_POINTER(ind_v);
387
int index = GET_INT_FROM_POINTER(ind_v);
464
389
/* check that no data exists for the current frame... */
465
390
if (env->totvert > 1) {
466
391
/* allocate a new smaller array */
467
fedn= MEM_callocN(sizeof(FCM_EnvelopeData)*(env->totvert-1), "FCM_EnvelopeData");
392
fedn = MEM_callocN(sizeof(FCM_EnvelopeData) * (env->totvert - 1), "FCM_EnvelopeData");
469
memcpy(fedn, env->data, sizeof(FCM_EnvelopeData)*(index));
470
memcpy(fedn + index, env->data + (index + 1), sizeof(FCM_EnvelopeData)*((env->totvert - index)-1));
394
memcpy(fedn, env->data, sizeof(FCM_EnvelopeData) * (index));
395
memcpy(fedn + index, env->data + (index + 1), sizeof(FCM_EnvelopeData) * ((env->totvert - index) - 1));
472
397
/* free old array, and set the new */
473
398
MEM_freeN(env->data);
478
403
/* just free array, since the only vert was deleted */
480
405
MEM_freeN(env->data);
487
412
/* draw settings for envelope modifier */
488
413
static void draw_modifier__envelope(uiLayout *layout, ID *id, FModifier *fcm, short UNUSED(width))
490
FMod_Envelope *env= (FMod_Envelope *)fcm->data;
415
FMod_Envelope *env = (FMod_Envelope *)fcm->data;
491
416
FCM_EnvelopeData *fed;
492
417
uiLayout *col, *row;
499
424
RNA_pointer_create(id, &RNA_FModifierEnvelope, fcm, &ptr);
501
426
/* general settings */
502
col= uiLayoutColumn(layout, 1);
503
uiItemL(col, IFACE_("Envelope:"), ICON_NONE);
504
uiItemR(col, &ptr, "reference_value", 0, NULL, ICON_NONE);
506
row= uiLayoutRow(col, 1);
507
uiItemR(row, &ptr, "default_min", 0, IFACE_("Min"), ICON_NONE);
508
uiItemR(row, &ptr, "default_max", 0, IFACE_("Max"), ICON_NONE);
427
col = uiLayoutColumn(layout, TRUE);
428
uiItemL(col, IFACE_("Envelope:"), ICON_NONE);
429
uiItemR(col, &ptr, "reference_value", 0, NULL, ICON_NONE);
431
row = uiLayoutRow(col, TRUE);
432
uiItemR(row, &ptr, "default_min", 0, IFACE_("Min"), ICON_NONE);
433
uiItemR(row, &ptr, "default_max", 0, IFACE_("Max"), ICON_NONE);
510
435
/* control points header */
511
// TODO: move this control-point control stuff to using the new special widgets for lists
512
// the current way is far too cramped
513
row= uiLayoutRow(layout, 0);
514
block= uiLayoutGetBlock(row);
516
uiDefBut(block, LABEL, 1, IFACE_("Control Points:"), 0, 0, 150, 20, NULL, 0.0, 0.0, 0, 0, "");
518
but = uiDefBut(block, BUT, B_FMODIFIER_REDRAW, IFACE_("Add Point"), 0, 0, 150, 19,
519
NULL, 0, 0, 0, 0, TIP_("Add a new control-point to the envelope on the current frame"));
520
uiButSetFunc(but, fmod_envelope_addpoint_cb, env, NULL);
436
/* TODO: move this control-point control stuff to using the new special widgets for lists
437
* the current way is far too cramped */
438
row = uiLayoutRow(layout, FALSE);
439
block = uiLayoutGetBlock(row);
441
uiDefBut(block, LABEL, 1, IFACE_("Control Points:"), 0, 0, 150, 20, NULL, 0.0, 0.0, 0, 0, "");
443
but = uiDefBut(block, BUT, B_FMODIFIER_REDRAW, IFACE_("Add Point"), 0, 0, 150, 19,
444
NULL, 0, 0, 0, 0, TIP_("Add a new control-point to the envelope on the current frame"));
445
uiButSetFunc(but, fmod_envelope_addpoint_cb, env, NULL);
522
447
/* control points list */
523
for (i=0, fed=env->data; i < env->totvert; i++, fed++) {
448
for (i = 0, fed = env->data; i < env->totvert; i++, fed++) {
524
449
/* get a new row to operate on */
525
row= uiLayoutRow(layout, 1);
526
block= uiLayoutGetBlock(row);
450
row = uiLayoutRow(layout, TRUE);
451
block = uiLayoutGetBlock(row);
528
453
uiBlockBeginAlign(block);
529
but=uiDefButF(block, NUM, B_FMODIFIER_REDRAW, IFACE_("Fra:"), 0, 0, 90, 20,
530
&fed->time, -MAXFRAMEF, MAXFRAMEF, 10, 1, TIP_("Frame that envelope point occurs"));
531
uiButSetFunc(but, validate_fmodifier_cb, fcm, NULL);
533
uiDefButF(block, NUM, B_FMODIFIER_REDRAW, IFACE_("Min:"), 0, 0, 100, 20,
534
&fed->min, -UI_FLT_MAX, UI_FLT_MAX, 10, 2, TIP_("Minimum bound of envelope at this point"));
535
uiDefButF(block, NUM, B_FMODIFIER_REDRAW, IFACE_("Max:"), 0, 0, 100, 20,
536
&fed->max, -UI_FLT_MAX, UI_FLT_MAX, 10, 2, TIP_("Maximum bound of envelope at this point"));
538
but = uiDefIconBut(block, BUT, B_FMODIFIER_REDRAW, ICON_X, 0, 0, 18, 20,
539
NULL, 0.0, 0.0, 0.0, 0.0, TIP_("Delete envelope control point"));
540
uiButSetFunc(but, fmod_envelope_deletepoint_cb, env, SET_INT_IN_POINTER(i));
454
but = uiDefButF(block, NUM, B_FMODIFIER_REDRAW, IFACE_("Fra:"), 0, 0, 90, 20,
455
&fed->time, -MAXFRAMEF, MAXFRAMEF, 10, 1, TIP_("Frame that envelope point occurs"));
456
uiButSetFunc(but, validate_fmodifier_cb, fcm, NULL);
458
uiDefButF(block, NUM, B_FMODIFIER_REDRAW, IFACE_("Min:"), 0, 0, 100, 20,
459
&fed->min, -UI_FLT_MAX, UI_FLT_MAX, 10, 2, TIP_("Minimum bound of envelope at this point"));
460
uiDefButF(block, NUM, B_FMODIFIER_REDRAW, IFACE_("Max:"), 0, 0, 100, 20,
461
&fed->max, -UI_FLT_MAX, UI_FLT_MAX, 10, 2, TIP_("Maximum bound of envelope at this point"));
463
but = uiDefIconBut(block, BUT, B_FMODIFIER_REDRAW, ICON_X, 0, 0, 18, 20,
464
NULL, 0.0, 0.0, 0.0, 0.0, TIP_("Delete envelope control point"));
465
uiButSetFunc(but, fmod_envelope_deletepoint_cb, env, SET_INT_IN_POINTER(i));
541
466
uiBlockBeginAlign(block);
556
481
/* row 1: minimum */
558
/* row= uiLayoutRow(layout, 0); */ /* UNUSED */
483
/* row = uiLayoutRow(layout, FALSE); */ /* UNUSED */
560
485
/* split into 2 columns */
561
split= uiLayoutSplit(layout, 0.5f, 0);
486
split = uiLayoutSplit(layout, 0.5f, FALSE);
564
col= uiLayoutColumn(split, 1);
565
uiItemR(col, &ptr, "use_min_x", 0, NULL, ICON_NONE);
566
uiItemR(col, &ptr, "min_x", 0, NULL, ICON_NONE);
489
col = uiLayoutColumn(split, TRUE);
490
uiItemR(col, &ptr, "use_min_x", 0, NULL, ICON_NONE);
491
uiItemR(col, &ptr, "min_x", 0, NULL, ICON_NONE);
569
col= uiLayoutColumn(split, 1);
570
uiItemR(col, &ptr, "use_min_y", 0, NULL, ICON_NONE);
571
uiItemR(col, &ptr, "min_y", 0, NULL, ICON_NONE);
494
col = uiLayoutColumn(split, TRUE);
495
uiItemR(col, &ptr, "use_min_y", 0, NULL, ICON_NONE);
496
uiItemR(col, &ptr, "min_y", 0, NULL, ICON_NONE);
574
499
/* row 2: maximum */
576
/* row= uiLayoutRow(layout, 0); */ /* UNUSED */
501
/* row = uiLayoutRow(layout, FALSE); */ /* UNUSED */
578
503
/* split into 2 columns */
579
split= uiLayoutSplit(layout, 0.5f, 0);
504
split = uiLayoutSplit(layout, 0.5f, FALSE);
582
col= uiLayoutColumn(split, 1);
583
uiItemR(col, &ptr, "use_max_x", 0, NULL, ICON_NONE);
584
uiItemR(col, &ptr, "max_x", 0, NULL, ICON_NONE);
507
col = uiLayoutColumn(split, TRUE);
508
uiItemR(col, &ptr, "use_max_x", 0, NULL, ICON_NONE);
509
uiItemR(col, &ptr, "max_x", 0, NULL, ICON_NONE);
587
col= uiLayoutColumn(split, 1);
588
uiItemR(col, &ptr, "use_max_y", 0, NULL, ICON_NONE);
589
uiItemR(col, &ptr, "max_y", 0, NULL, ICON_NONE);
512
col = uiLayoutColumn(split, TRUE);
513
uiItemR(col, &ptr, "use_max_y", 0, NULL, ICON_NONE);
514
uiItemR(col, &ptr, "max_y", 0, NULL, ICON_NONE);
602
527
RNA_pointer_create(id, &RNA_FModifierStepped, fcm, &ptr);
604
529
/* block 1: "stepping" settings */
605
col= uiLayoutColumn(layout, 0);
606
uiItemR(col, &ptr, "frame_step", 0, NULL, ICON_NONE);
607
uiItemR(col, &ptr, "frame_offset", 0, NULL, ICON_NONE);
530
col = uiLayoutColumn(layout, FALSE);
531
uiItemR(col, &ptr, "frame_step", 0, NULL, ICON_NONE);
532
uiItemR(col, &ptr, "frame_offset", 0, NULL, ICON_NONE);
609
534
/* block 2: start range settings */
610
col= uiLayoutColumn(layout, 1);
611
uiItemR(col, &ptr, "use_frame_start", 0, NULL, ICON_NONE);
535
col = uiLayoutColumn(layout, TRUE);
536
uiItemR(col, &ptr, "use_frame_start", 0, NULL, ICON_NONE);
613
sub = uiLayoutColumn(col, 1);
614
uiLayoutSetActive(sub, RNA_boolean_get(&ptr, "use_frame_start"));
615
uiItemR(sub, &ptr, "frame_start", 0, NULL, ICON_NONE);
538
sub = uiLayoutColumn(col, TRUE);
539
uiLayoutSetActive(sub, RNA_boolean_get(&ptr, "use_frame_start"));
540
uiItemR(sub, &ptr, "frame_start", 0, NULL, ICON_NONE);
617
542
/* block 3: end range settings */
618
col= uiLayoutColumn(layout, 1);
619
uiItemR(col, &ptr, "use_frame_end", 0, NULL, ICON_NONE);
543
col = uiLayoutColumn(layout, TRUE);
544
uiItemR(col, &ptr, "use_frame_end", 0, NULL, ICON_NONE);
621
sub = uiLayoutColumn(col, 1);
622
uiLayoutSetActive(sub, RNA_boolean_get(&ptr, "use_frame_end"));
623
uiItemR(sub, &ptr, "frame_end", 0, NULL, ICON_NONE);
546
sub = uiLayoutColumn(col, TRUE);
547
uiLayoutSetActive(sub, RNA_boolean_get(&ptr, "use_frame_end"));
548
uiItemR(sub, &ptr, "frame_end", 0, NULL, ICON_NONE);
626
551
/* --------------- */
628
void ANIM_uiTemplate_fmodifier_draw (uiLayout *layout, ID *id, ListBase *modifiers, FModifier *fcm)
553
void ANIM_uiTemplate_fmodifier_draw(uiLayout *layout, ID *id, ListBase *modifiers, FModifier *fcm)
630
FModifierTypeInfo *fmi= fmodifier_get_typeinfo(fcm);
555
FModifierTypeInfo *fmi = fmodifier_get_typeinfo(fcm);
631
556
uiLayout *box, *row, *sub, *col;
637
562
/* init the RNA-pointer */
726
651
box = uiLayoutBox(layout);
728
653
/* restricted range ----------------------------------------------------- */
729
col = uiLayoutColumn(box, 1);
654
col = uiLayoutColumn(box, TRUE);
731
656
/* top row: use restricted range */
732
row= uiLayoutRow(col, 1);
657
row = uiLayoutRow(col, TRUE);
733
658
uiItemR(row, &ptr, "use_restricted_range", 0, NULL, ICON_NONE);
735
660
if (fcm->flag & FMODIFIER_FLAG_RANGERESTRICT) {
736
661
/* second row: settings */
737
row = uiLayoutRow(col, 1);
662
row = uiLayoutRow(col, TRUE);
739
664
uiItemR(row, &ptr, "frame_start", 0, IFACE_("Start"), ICON_NONE);
740
665
uiItemR(row, &ptr, "frame_end", 0, IFACE_("End"), ICON_NONE);
742
667
/* third row: blending influence */
743
row = uiLayoutRow(col, 1);
668
row = uiLayoutRow(col, TRUE);
745
670
uiItemR(row, &ptr, "blend_in", 0, IFACE_("In"), ICON_NONE);
746
671
uiItemR(row, &ptr, "blend_out", 0, IFACE_("Out"), ICON_NONE);
749
674
/* influence -------------------------------------------------------------- */
750
col = uiLayoutColumn(box, 1);
675
col = uiLayoutColumn(box, TRUE);
752
677
/* top row: use influence */
753
678
uiItemR(col, &ptr, "use_influence", 0, NULL, ICON_NONE);