Blender  V2.93
rna_fcurve.c
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  */
16 
21 #include <stdlib.h>
22 
23 #include "DNA_anim_types.h"
24 #include "DNA_curve_types.h"
25 #include "DNA_object_types.h"
26 #include "DNA_scene_types.h"
27 
28 #include "MEM_guardedalloc.h"
29 
30 #include "BLT_translation.h"
31 
32 #include "BKE_action.h"
33 
34 #include "RNA_access.h"
35 #include "RNA_define.h"
36 #include "RNA_enum_types.h"
37 
38 #include "rna_internal.h"
39 
40 #include "WM_types.h"
41 
42 #include "ED_keyframes_edit.h"
43 #include "ED_keyframing.h"
44 
46  {FMODIFIER_TYPE_NULL, "NULL", 0, "Invalid", ""},
48  "GENERATOR",
49  0,
50  "Generator",
51  "Generate a curve using a factorized or expanded polynomial"},
53  "FNGENERATOR",
54  0,
55  "Built-In Function",
56  "Generate a curve using standard math functions such as sin and cos"},
58  "ENVELOPE",
59  0,
60  "Envelope",
61  "Reshape F-Curve values, e.g. change amplitude of movements"},
62  {FMODIFIER_TYPE_CYCLES, "CYCLES", 0, "Cycles", "Cyclic extend/repeat keyframe sequence"},
63  {FMODIFIER_TYPE_NOISE, "NOISE", 0, "Noise", "Add pseudo-random noise on top of F-Curves"},
64  /*{FMODIFIER_TYPE_FILTER, "FILTER", 0, "Filter", ""},*/ /* FIXME: not implemented yet! */
65  /*{FMODIFIER_TYPE_PYTHON, "PYTHON", 0, "Python", ""},*/ /* FIXME: not implemented yet! */
67  "LIMITS",
68  0,
69  "Limits",
70  "Restrict maximum and minimum values of F-Curve"},
72  "STEPPED",
73  0,
74  "Stepped Interpolation",
75  "Snap values to nearest grid step, e.g. for a stop-motion look"},
76  {0, NULL, 0, NULL, NULL},
77 };
78 
81  "NONE",
82  0,
83  "None",
84  "Automatic handles only take immediately adjacent keys into account"},
86  "CONT_ACCEL",
87  0,
88  "Continuous Acceleration",
89  "Automatic handles are adjusted to avoid jumps in acceleration, resulting "
90  "in smoother curves. However, key changes may affect interpolation over a "
91  "larger stretch of the curve"},
92  {0, NULL, 0, NULL, NULL},
93 };
94 
97  "KEYFRAME",
98  ICON_KEYTYPE_KEYFRAME_VEC,
99  "Keyframe",
100  "Normal keyframe, e.g. for key poses"},
102  "BREAKDOWN",
103  ICON_KEYTYPE_BREAKDOWN_VEC,
104  "Breakdown",
105  "A breakdown pose, e.g. for transitions between key poses"},
107  "MOVING_HOLD",
108  ICON_KEYTYPE_MOVING_HOLD_VEC,
109  "Moving Hold",
110  "A keyframe that is part of a moving hold"},
112  "EXTREME",
113  ICON_KEYTYPE_EXTREME_VEC,
114  "Extreme",
115  "An \"extreme\" pose, or some other purpose as needed"},
117  "JITTER",
118  ICON_KEYTYPE_JITTER_VEC,
119  "Jitter",
120  "A filler or baked keyframe for keying on ones, or some other purpose as needed"},
121  {0, NULL, 0, NULL, NULL},
122 };
123 
125  /* XXX: auto-easing is currently using a placeholder icon... */
127  "AUTO",
128  ICON_IPO_EASE_IN_OUT,
129  "Automatic Easing",
130  "Easing type is chosen automatically based on what the type of interpolation used "
131  "(e.g. Ease In for transitional types, and Ease Out for dynamic effects)"},
132 
134  "EASE_IN",
135  ICON_IPO_EASE_IN,
136  "Ease In",
137  "Only on the end closest to the next keyframe"},
139  "EASE_OUT",
140  ICON_IPO_EASE_OUT,
141  "Ease Out",
142  "Only on the end closest to the first keyframe"},
144  "EASE_IN_OUT",
145  ICON_IPO_EASE_IN_OUT,
146  "Ease In and Out",
147  "Segment between both keyframes"},
148  {0, NULL, 0, NULL, NULL},
149 };
150 
152  {DTAR_ROTMODE_AUTO, "AUTO", 0, "Auto Euler", "Euler using the rotation order of the target"},
153  {DTAR_ROTMODE_EULER_XYZ, "XYZ", 0, "XYZ Euler", "Euler using the XYZ rotation order"},
154  {DTAR_ROTMODE_EULER_XZY, "XZY", 0, "XZY Euler", "Euler using the XZY rotation order"},
155  {DTAR_ROTMODE_EULER_YXZ, "YXZ", 0, "YXZ Euler", "Euler using the YXZ rotation order"},
156  {DTAR_ROTMODE_EULER_YZX, "YZX", 0, "YZX Euler", "Euler using the YZX rotation order"},
157  {DTAR_ROTMODE_EULER_ZXY, "ZXY", 0, "ZXY Euler", "Euler using the ZXY rotation order"},
158  {DTAR_ROTMODE_EULER_ZYX, "ZYX", 0, "ZYX Euler", "Euler using the ZYX rotation order"},
159  {DTAR_ROTMODE_QUATERNION, "QUATERNION", 0, "Quaternion", "Quaternion rotation"},
161  "SWING_TWIST_X",
162  0,
163  "Swing and X Twist",
164  "Decompose into a swing rotation to aim the X axis, followed by twist around it"},
166  "SWING_TWIST_Y",
167  0,
168  "Swing and Y Twist",
169  "Decompose into a swing rotation to aim the Y axis, followed by twist around it"},
171  "SWING_TWIST_Z",
172  0,
173  "Swing and Z Twist",
174  "Decompose into a swing rotation to aim the Z axis, followed by twist around it"},
175  {0, NULL, 0, NULL, NULL},
176 };
177 
178 #ifdef RNA_RUNTIME
179 
180 # include "WM_api.h"
181 
182 static StructRNA *rna_FModifierType_refine(struct PointerRNA *ptr)
183 {
184  FModifier *fcm = (FModifier *)ptr->data;
185 
186  switch (fcm->type) {
188  return &RNA_FModifierGenerator;
192  return &RNA_FModifierEnvelope;
194  return &RNA_FModifierCycles;
196  return &RNA_FModifierNoise;
197 # if 0
199  return &RNA_FModifierFilter;
200 # endif
202  return &RNA_FModifierPython;
204  return &RNA_FModifierLimits;
206  return &RNA_FModifierStepped;
207  default:
208  return &RNA_UnknownType;
209  }
210 }
211 
212 /* ****************************** */
213 
214 # include "BKE_anim_data.h"
215 # include "BKE_fcurve.h"
216 # include "BKE_fcurve_driver.h"
217 
218 # include "DEG_depsgraph.h"
219 # include "DEG_depsgraph_build.h"
220 
221 static bool rna_ChannelDriver_is_simple_expression_get(PointerRNA *ptr)
222 {
223  ChannelDriver *driver = ptr->data;
224 
225  return BKE_driver_has_simple_expression(driver);
226 }
227 
228 static void rna_ChannelDriver_update_data(Main *bmain, Scene *scene, PointerRNA *ptr)
229 {
230  ID *id = ptr->owner_id;
231  ChannelDriver *driver = ptr->data;
232 
233  driver->flag &= ~DRIVER_FLAG_INVALID;
234 
235  /* TODO: this really needs an update guard... */
238 
240 }
241 
242 static void rna_ChannelDriver_update_expr(Main *bmain, Scene *scene, PointerRNA *ptr)
243 {
244  ChannelDriver *driver = ptr->data;
245 
246  /* tag driver as needing to be recompiled */
247  BKE_driver_invalidate_expression(driver, true, false);
248 
249  /* update_data() clears invalid flag and schedules for updates */
250  rna_ChannelDriver_update_data(bmain, scene, ptr);
251 }
252 
253 static void rna_DriverTarget_update_data(Main *bmain, Scene *scene, PointerRNA *ptr)
254 {
255  PointerRNA driverptr;
256  ChannelDriver *driver;
257  FCurve *fcu;
259 
260  /* find the driver this belongs to and update it */
261  for (fcu = adt->drivers.first; fcu; fcu = fcu->next) {
262  driver = fcu->driver;
263  fcu->flag &= ~FCURVE_DISABLED;
264 
265  if (driver) {
266  /* FIXME: need to be able to search targets for required one... */
267  /*BLI_findindex(&driver->targets, ptr->data) != -1) */
268  RNA_pointer_create(ptr->owner_id, &RNA_Driver, driver, &driverptr);
269  rna_ChannelDriver_update_data(bmain, scene, &driverptr);
270  }
271  }
272 }
273 
274 static void rna_DriverTarget_update_name(Main *bmain, Scene *scene, PointerRNA *ptr)
275 {
276  ChannelDriver *driver = ptr->data;
277  rna_DriverTarget_update_data(bmain, scene, ptr);
278 
279  BKE_driver_invalidate_expression(driver, false, true);
280 }
281 
282 /* ----------- */
283 
284 /* note: this function exists only to avoid id refcounting */
285 static void rna_DriverTarget_id_set(PointerRNA *ptr,
286  PointerRNA value,
287  struct ReportList *UNUSED(reports))
288 {
289  DriverTarget *dtar = (DriverTarget *)ptr->data;
290  dtar->id = value.data;
291 }
292 
293 static StructRNA *rna_DriverTarget_id_typef(PointerRNA *ptr)
294 {
295  DriverTarget *dtar = (DriverTarget *)ptr->data;
296  return ID_code_to_RNA_type(dtar->idtype);
297 }
298 
299 static int rna_DriverTarget_id_editable(PointerRNA *ptr, const char **UNUSED(r_info))
300 {
301  DriverTarget *dtar = (DriverTarget *)ptr->data;
302  return (dtar->idtype) ? PROP_EDITABLE : 0;
303 }
304 
305 static int rna_DriverTarget_id_type_editable(PointerRNA *ptr, const char **UNUSED(r_info))
306 {
307  DriverTarget *dtar = (DriverTarget *)ptr->data;
308 
309  /* when the id-type can only be object, don't allow editing
310  * otherwise, there may be strange crashes
311  */
312  return ((dtar->flag & DTAR_FLAG_ID_OB_ONLY) == 0);
313 }
314 
315 static void rna_DriverTarget_id_type_set(PointerRNA *ptr, int value)
316 {
318 
319  /* check if ID-type is settable */
320  if ((data->flag & DTAR_FLAG_ID_OB_ONLY) == 0) {
321  /* change ID-type to the new type */
322  data->idtype = value;
323  }
324  else {
325  /* make sure ID-type is Object */
326  data->idtype = ID_OB;
327  }
328 
329  /* clear the id-block if the type is invalid */
330  if ((data->id) && (GS(data->id->name) != data->idtype)) {
331  data->id = NULL;
332  }
333 }
334 
335 static void rna_DriverTarget_RnaPath_get(PointerRNA *ptr, char *value)
336 {
337  DriverTarget *dtar = (DriverTarget *)ptr->data;
338 
339  if (dtar->rna_path) {
340  strcpy(value, dtar->rna_path);
341  }
342  else {
343  value[0] = '\0';
344  }
345 }
346 
347 static int rna_DriverTarget_RnaPath_length(PointerRNA *ptr)
348 {
349  DriverTarget *dtar = (DriverTarget *)ptr->data;
350 
351  if (dtar->rna_path) {
352  return strlen(dtar->rna_path);
353  }
354  else {
355  return 0;
356  }
357 }
358 
359 static void rna_DriverTarget_RnaPath_set(PointerRNA *ptr, const char *value)
360 {
361  DriverTarget *dtar = (DriverTarget *)ptr->data;
362 
363  /* XXX in this case we need to be very careful,
364  * as this will require some new dependencies to be added! */
365  if (dtar->rna_path) {
366  MEM_freeN(dtar->rna_path);
367  }
368 
369  if (value[0]) {
370  dtar->rna_path = BLI_strdup(value);
371  }
372  else {
373  dtar->rna_path = NULL;
374  }
375 }
376 
377 static void rna_DriverVariable_type_set(PointerRNA *ptr, int value)
378 {
379  DriverVar *dvar = (DriverVar *)ptr->data;
380 
381  /* call the API function for this */
382  driver_change_variable_type(dvar, value);
383 }
384 
385 void rna_DriverVariable_name_set(PointerRNA *ptr, const char *value)
386 {
387  DriverVar *data = (DriverVar *)(ptr->data);
388 
389  BLI_strncpy_utf8(data->name, value, 64);
391 }
392 
393 /* ----------- */
394 
395 static DriverVar *rna_Driver_new_variable(ChannelDriver *driver)
396 {
397  /* call the API function for this */
398  return driver_add_new_variable(driver);
399 }
400 
401 static void rna_Driver_remove_variable(ChannelDriver *driver,
402  ReportList *reports,
403  PointerRNA *dvar_ptr)
404 {
405  DriverVar *dvar = dvar_ptr->data;
406  if (BLI_findindex(&driver->variables, dvar) == -1) {
407  BKE_report(reports, RPT_ERROR, "Variable does not exist in this driver");
408  return;
409  }
410 
411  driver_free_variable_ex(driver, dvar);
412  RNA_POINTER_INVALIDATE(dvar_ptr);
413 }
414 
415 /* ****************************** */
416 
417 static void rna_FKeyframe_handle1_get(PointerRNA *ptr, float *values)
418 {
419  BezTriple *bezt = (BezTriple *)ptr->data;
420 
421  values[0] = bezt->vec[0][0];
422  values[1] = bezt->vec[0][1];
423 }
424 
425 static void rna_FKeyframe_handle1_set(PointerRNA *ptr, const float *values)
426 {
427  BezTriple *bezt = (BezTriple *)ptr->data;
428 
429  bezt->vec[0][0] = values[0];
430  bezt->vec[0][1] = values[1];
431 }
432 
433 static void rna_FKeyframe_handle2_get(PointerRNA *ptr, float *values)
434 {
435  BezTriple *bezt = (BezTriple *)ptr->data;
436 
437  values[0] = bezt->vec[2][0];
438  values[1] = bezt->vec[2][1];
439 }
440 
441 static void rna_FKeyframe_handle2_set(PointerRNA *ptr, const float *values)
442 {
443  BezTriple *bezt = (BezTriple *)ptr->data;
444 
445  bezt->vec[2][0] = values[0];
446  bezt->vec[2][1] = values[1];
447 }
448 
449 static void rna_FKeyframe_ctrlpoint_get(PointerRNA *ptr, float *values)
450 {
451  BezTriple *bezt = (BezTriple *)ptr->data;
452 
453  values[0] = bezt->vec[1][0];
454  values[1] = bezt->vec[1][1];
455 }
456 
457 static void rna_FKeyframe_ctrlpoint_set(PointerRNA *ptr, const float *values)
458 {
459  BezTriple *bezt = (BezTriple *)ptr->data;
460 
461  bezt->vec[1][0] = values[0];
462  bezt->vec[1][1] = values[1];
463 }
464 
465 static void rna_FKeyframe_ctrlpoint_ui_set(PointerRNA *ptr, const float *values)
466 {
467  BezTriple *bezt = (BezTriple *)ptr->data;
468 
469  const float frame_delta = values[0] - bezt->vec[1][0];
470  const float value_delta = values[1] - bezt->vec[1][1];
471 
476  bezt->vec[0][0] += frame_delta;
477  bezt->vec[0][1] += value_delta;
478 
479  bezt->vec[1][0] = values[0];
480  bezt->vec[1][1] = values[1];
481 
482  bezt->vec[2][0] += frame_delta;
483  bezt->vec[2][1] += value_delta;
484 }
485 
486 /* ****************************** */
487 
488 static void rna_FCurve_RnaPath_get(PointerRNA *ptr, char *value)
489 {
490  FCurve *fcu = (FCurve *)ptr->data;
491 
492  if (fcu->rna_path) {
493  strcpy(value, fcu->rna_path);
494  }
495  else {
496  value[0] = '\0';
497  }
498 }
499 
500 static int rna_FCurve_RnaPath_length(PointerRNA *ptr)
501 {
502  FCurve *fcu = (FCurve *)ptr->data;
503 
504  if (fcu->rna_path) {
505  return strlen(fcu->rna_path);
506  }
507  else {
508  return 0;
509  }
510 }
511 
512 static void rna_FCurve_RnaPath_set(PointerRNA *ptr, const char *value)
513 {
514  FCurve *fcu = (FCurve *)ptr->data;
515 
516  if (fcu->rna_path) {
517  MEM_freeN(fcu->rna_path);
518  }
519 
520  if (value[0]) {
521  fcu->rna_path = BLI_strdup(value);
522  fcu->flag &= ~FCURVE_DISABLED;
523  }
524  else {
525  fcu->rna_path = NULL;
526  }
527 }
528 
529 static void rna_FCurve_group_set(PointerRNA *ptr,
530  PointerRNA value,
531  struct ReportList *UNUSED(reports))
532 {
533  ID *pid = ptr->owner_id;
534  ID *vid = value.owner_id;
535  FCurve *fcu = ptr->data;
536  bAction *act = NULL;
537 
538  /* get action */
539  if (ELEM(NULL, pid, vid)) {
540  printf("ERROR: one of the ID's for the groups to assign to is invalid (ptr=%p, val=%p)\n",
541  pid,
542  vid);
543  return;
544  }
545  else if (value.data && (pid != vid)) {
546  /* id's differ, cant do this, should raise an error */
547  printf("ERROR: ID's differ - ptr=%p vs value=%p\n", pid, vid);
548  return;
549  }
550 
551  if (GS(pid->name) == ID_AC && GS(vid->name) == ID_AC) {
552  /* The ID given is the action already -
553  * usually when F-Curve is obtained from an action's pointer. */
554  act = (bAction *)pid;
555  }
556  else {
557  /* the ID given is the owner of the F-Curve (for drivers) */
559  act = (adt) ? adt->action : NULL;
560  }
561 
562  /* already belongs to group? */
563  if (fcu->grp == value.data) {
564  /* nothing to do */
565  printf("ERROR: F-Curve already belongs to this group\n");
566  return;
567  }
568 
569  /* can only change group if we have info about the action the F-Curve is in
570  * (i.e. for drivers or random F-Curves, this cannot be done)
571  */
572  if (act == NULL) {
573  /* can't change the grouping of F-Curve when it doesn't belong to an action */
574  printf("ERROR: cannot assign F-Curve to group, since F-Curve is not attached to any ID\n");
575  return;
576  }
577  /* make sure F-Curve exists in this action first, otherwise we could still have been tricked */
578  else if (BLI_findindex(&act->curves, fcu) == -1) {
579  printf("ERROR: F-Curve (%p) doesn't exist in action '%s'\n", fcu, act->id.name);
580  return;
581  }
582 
583  /* try to remove F-Curve from action (including from any existing groups) */
585 
586  /* add the F-Curve back to the action now in the right place */
587  /* TODO: make the api function handle the case where there isn't any group to assign to */
588  if (value.data) {
589  /* add to its group using API function, which makes sure everything goes ok */
590  action_groups_add_channel(act, value.data, fcu);
591  }
592  else {
593  /* Need to add this back, but it can only go at the end of the list
594  * (or else will corrupt groups). */
595  BLI_addtail(&act->curves, fcu);
596  }
597 }
598 
599 /* calculate time extents of F-Curve */
600 static void rna_FCurve_range(FCurve *fcu, float range[2])
601 {
602  BKE_fcurve_calc_range(fcu, range, range + 1, false, false);
603 }
604 
605 static bool rna_FCurve_is_empty_get(PointerRNA *ptr)
606 {
607  FCurve *fcu = (FCurve *)ptr->data;
608  return BKE_fcurve_is_empty(fcu);
609 }
610 
611 static void rna_tag_animation_update(Main *bmain, ID *id)
612 {
613  const int tags = ID_RECALC_ANIMATION;
614  AnimData *adt = BKE_animdata_from_id(id);
615 
616  if (adt && adt->action) {
617  /* Action is separate datablock, needs separate tag. */
618  DEG_id_tag_update_ex(bmain, &adt->action->id, tags);
619  }
620 
621  DEG_id_tag_update_ex(bmain, id, tags);
622 }
623 
624 /* allow scripts to update curve after editing manually */
625 static void rna_FCurve_update_data_ex(ID *id, FCurve *fcu, Main *bmain)
626 {
627  sort_time_fcurve(fcu);
628  calchandles_fcurve(fcu);
629 
630  rna_tag_animation_update(bmain, id);
631 }
632 
633 /* RNA update callback for F-Curves after curve shape changes */
634 static void rna_FCurve_update_data(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
635 {
637  rna_FCurve_update_data_ex(ptr->owner_id, (FCurve *)ptr->data, bmain);
638 }
639 
640 static void rna_FCurve_update_data_relations(Main *bmain,
641  Scene *UNUSED(scene),
643 {
645 }
646 
647 /* RNA update callback for F-Curves to indicate that there are copy-on-write tagging/flushing
648  * needed (e.g. for properties that affect how animation gets evaluated).
649  */
650 static void rna_FCurve_update_eval(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
651 {
652  rna_tag_animation_update(bmain, ptr->owner_id);
653 }
654 
655 static PointerRNA rna_FCurve_active_modifier_get(PointerRNA *ptr)
656 {
657  FCurve *fcu = (FCurve *)ptr->data;
660 }
661 
662 static void rna_FCurve_active_modifier_set(PointerRNA *ptr,
663  PointerRNA value,
664  struct ReportList *UNUSED(reports))
665 {
666  FCurve *fcu = (FCurve *)ptr->data;
667  set_active_fmodifier(&fcu->modifiers, (FModifier *)value.data);
668 }
669 
670 static FModifier *rna_FCurve_modifiers_new(FCurve *fcu, int type)
671 {
672  return add_fmodifier(&fcu->modifiers, type, fcu);
673 }
674 
675 static void rna_FCurve_modifiers_remove(FCurve *fcu, ReportList *reports, PointerRNA *fcm_ptr)
676 {
677  FModifier *fcm = fcm_ptr->data;
678  if (BLI_findindex(&fcu->modifiers, fcm) == -1) {
679  BKE_reportf(reports, RPT_ERROR, "F-Curve modifier '%s' not found in F-Curve", fcm->name);
680  return;
681  }
682 
683  remove_fmodifier(&fcu->modifiers, fcm);
684  RNA_POINTER_INVALIDATE(fcm_ptr);
685 }
686 
687 static void rna_FModifier_active_set(PointerRNA *ptr, bool UNUSED(value))
688 {
689  FModifier *fcm = (FModifier *)ptr->data;
690 
691  /* don't toggle, always switch on */
692  fcm->flag |= FMODIFIER_FLAG_ACTIVE;
693 }
694 
695 static void rna_FModifier_start_frame_set(PointerRNA *ptr, float value)
696 {
697  FModifier *fcm = (FModifier *)ptr->data;
698 
699  CLAMP(value, MINAFRAMEF, MAXFRAMEF);
700  fcm->sfra = value;
701 
702  /* XXX: maintain old offset? */
703  if (fcm->sfra >= fcm->efra) {
704  fcm->efra = fcm->sfra;
705  }
706 }
707 
708 static void rna_FModifier_end_frame_set(PointerRNA *ptr, float value)
709 {
710  FModifier *fcm = (FModifier *)ptr->data;
711 
712  CLAMP(value, MINAFRAMEF, MAXFRAMEF);
713  fcm->efra = value;
714 
715  /* XXX: maintain old offset? */
716  if (fcm->efra <= fcm->sfra) {
717  fcm->sfra = fcm->efra;
718  }
719 }
720 
721 static void rna_FModifier_start_frame_range(PointerRNA *UNUSED(ptr),
722  float *min,
723  float *max,
724  float *UNUSED(softmin),
725  float *UNUSED(softmax))
726 {
727  // FModifier *fcm = (FModifier *)ptr->data;
728 
729  /* Technically, "sfra <= efra" must hold; however, we can't strictly enforce that,
730  * or else it becomes tricky to adjust the range, see: T36844.
731  *
732  * NOTE: we do not set soft-limits on lower bounds, as it's too confusing when you
733  * can't easily use the slider to set things here
734  */
735  *min = MINAFRAMEF;
736  *max = MAXFRAMEF;
737 }
738 
739 static void rna_FModifier_end_frame_range(
740  PointerRNA *ptr, float *min, float *max, float *softmin, float *softmax)
741 {
742  FModifier *fcm = (FModifier *)ptr->data;
743 
744  /* Technically, "sfra <= efra" must hold; however, we can't strictly enforce that,
745  * or else it becomes tricky to adjust the range, see: T36844. */
746  *min = MINAFRAMEF;
747  *softmin = (fcm->flag & FMODIFIER_FLAG_RANGERESTRICT) ? fcm->sfra : MINAFRAMEF;
748 
749  *softmax = MAXFRAMEF;
750  *max = MAXFRAMEF;
751 }
752 
753 static void rna_FModifier_blending_range(
754  PointerRNA *ptr, float *min, float *max, float *UNUSED(softmin), float *UNUSED(softmax))
755 {
756  FModifier *fcm = (FModifier *)ptr->data;
757 
758  *min = 0.0f;
759  *max = fcm->efra - fcm->sfra;
760 }
761 
762 static void rna_FModifier_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
763 {
764  ID *id = ptr->owner_id;
765  FModifier *fcm = (FModifier *)ptr->data;
766 
767  if (fcm->curve && fcm->type == FMODIFIER_TYPE_CYCLES) {
769  }
770 
771  rna_tag_animation_update(bmain, id);
772 }
773 
774 static void rna_FModifier_verify_data_update(Main *bmain, Scene *scene, PointerRNA *ptr)
775 {
776  FModifier *fcm = (FModifier *)ptr->data;
777  const FModifierTypeInfo *fmi = fmodifier_get_typeinfo(fcm);
778 
779  /* call the verify callback on the modifier if applicable */
780  if (fmi && fmi->verify_data) {
781  fmi->verify_data(fcm);
782  }
783 
784  rna_FModifier_update(bmain, scene, ptr);
785 }
786 
787 static void rna_FModifier_active_update(Main *bmain, Scene *scene, PointerRNA *ptr)
788 {
789  FModifier *fm, *fmo = (FModifier *)ptr->data;
790 
791  /* clear active state of other FModifiers in this list */
792  for (fm = fmo->prev; fm; fm = fm->prev) {
793  fm->flag &= ~FMODIFIER_FLAG_ACTIVE;
794  }
795  for (fm = fmo->next; fm; fm = fm->next) {
796  fm->flag &= ~FMODIFIER_FLAG_ACTIVE;
797  }
798 
799  rna_FModifier_update(bmain, scene, ptr);
800 }
801 
802 static int rna_FModifierGenerator_coefficients_get_length(PointerRNA *ptr,
804 {
805  FModifier *fcm = (FModifier *)ptr->data;
806  FMod_Generator *gen = fcm->data;
807 
808  if (gen) {
809  length[0] = gen->arraysize;
810  }
811  else {
812  length[0] = 0;
813  }
814 
815  return length[0];
816 }
817 
818 static void rna_FModifierGenerator_coefficients_get(PointerRNA *ptr, float *values)
819 {
820  FModifier *fcm = (FModifier *)ptr->data;
821  FMod_Generator *gen = fcm->data;
822  memcpy(values, gen->coefficients, gen->arraysize * sizeof(float));
823 }
824 
825 static void rna_FModifierGenerator_coefficients_set(PointerRNA *ptr, const float *values)
826 {
827  FModifier *fcm = (FModifier *)ptr->data;
828  FMod_Generator *gen = fcm->data;
829  memcpy(gen->coefficients, values, gen->arraysize * sizeof(float));
830 }
831 
832 static void rna_FModifierLimits_minx_set(PointerRNA *ptr, float value)
833 {
834  FModifier *fcm = (FModifier *)ptr->data;
835  FMod_Limits *data = fcm->data;
836 
837  data->rect.xmin = value;
838 
839  if (data->rect.xmin >= data->rect.xmax) {
840  data->rect.xmax = data->rect.xmin;
841  }
842 }
843 
844 static void rna_FModifierLimits_maxx_set(PointerRNA *ptr, float value)
845 {
846  FModifier *fcm = (FModifier *)ptr->data;
847  FMod_Limits *data = fcm->data;
848 
849  data->rect.xmax = value;
850 
851  if (data->rect.xmax <= data->rect.xmin) {
852  data->rect.xmin = data->rect.xmax;
853  }
854 }
855 
856 static void rna_FModifierLimits_miny_set(PointerRNA *ptr, float value)
857 {
858  FModifier *fcm = (FModifier *)ptr->data;
859  FMod_Limits *data = fcm->data;
860 
861  data->rect.ymin = value;
862 
863  if (data->rect.ymin >= data->rect.ymax) {
864  data->rect.ymax = data->rect.ymin;
865  }
866 }
867 
868 static void rna_FModifierLimits_maxy_set(PointerRNA *ptr, float value)
869 {
870  FModifier *fcm = (FModifier *)ptr->data;
871  FMod_Limits *data = fcm->data;
872 
873  data->rect.ymax = value;
874 
875  if (data->rect.ymax <= data->rect.ymin) {
876  data->rect.ymin = data->rect.ymax;
877  }
878 }
879 
880 static void rna_FModifierLimits_minx_range(PointerRNA *UNUSED(ptr),
881  float *min,
882  float *max,
883  float *UNUSED(softmin),
884  float *UNUSED(softmax))
885 {
886  // FModifier *fcm = (FModifier *)ptr->data;
887  // FMod_Limits *data = fcm->data;
888 
889  /* No soft-limits on lower bound -
890  * it's too confusing when you can't easily use the slider to set things here. */
891  *min = MINAFRAMEF;
892  *max = MAXFRAMEF;
893 }
894 
895 static void rna_FModifierLimits_maxx_range(
896  PointerRNA *ptr, float *min, float *max, float *softmin, float *softmax)
897 {
898  FModifier *fcm = (FModifier *)ptr->data;
899  FMod_Limits *data = fcm->data;
900 
901  *min = MINAFRAMEF;
902  *softmin = (data->flag & FCM_LIMIT_XMIN) ? data->rect.xmin : MINAFRAMEF;
903 
904  *softmax = MAXFRAMEF;
905  *max = MAXFRAMEF;
906 }
907 
908 static void rna_FModifierLimits_miny_range(PointerRNA *UNUSED(ptr),
909  float *min,
910  float *max,
911  float *UNUSED(softmin),
912  float *UNUSED(softmax))
913 {
914  // FModifier *fcm = (FModifier *)ptr->data;
915  // FMod_Limits *data = fcm->data;
916 
917  /* No soft-limits on lower bound -
918  * it's too confusing when you can't easily use the slider to set things here. */
919  *min = -FLT_MAX;
920  *max = FLT_MAX;
921 }
922 
923 static void rna_FModifierLimits_maxy_range(
924  PointerRNA *ptr, float *min, float *max, float *softmin, float *softmax)
925 {
926  FModifier *fcm = (FModifier *)ptr->data;
927  FMod_Limits *data = fcm->data;
928 
929  *min = -FLT_MAX;
930  *softmin = (data->flag & FCM_LIMIT_YMIN) ? data->rect.ymin : -FLT_MAX;
931 
932  *softmax = FLT_MAX;
933  *max = FLT_MAX;
934 }
935 
936 static void rna_FModifierStepped_start_frame_range(
937  PointerRNA *ptr, float *min, float *max, float *UNUSED(softmin), float *UNUSED(softmax))
938 {
939  FModifier *fcm = (FModifier *)ptr->data;
940  FMod_Stepped *data = fcm->data;
941 
942  *min = MINAFRAMEF;
943  *max = (data->flag & FCM_STEPPED_NO_AFTER) ? data->end_frame : MAXFRAMEF;
944 }
945 
946 static void rna_FModifierStepped_end_frame_range(
947  PointerRNA *ptr, float *min, float *max, float *UNUSED(softmin), float *UNUSED(softmax))
948 {
949  FModifier *fcm = (FModifier *)ptr->data;
950  FMod_Stepped *data = fcm->data;
951 
952  *min = (data->flag & FCM_STEPPED_NO_BEFORE) ? data->start_frame : MINAFRAMEF;
953  *max = MAXFRAMEF;
954 }
955 
956 static void rna_FModifierStepped_frame_start_set(PointerRNA *ptr, float value)
957 {
958  FModifier *fcm = (FModifier *)ptr->data;
959  FMod_Stepped *data = fcm->data;
960 
961  float prop_clamp_min = -FLT_MAX, prop_clamp_max = FLT_MAX, prop_soft_min, prop_soft_max;
962  rna_FModifierStepped_start_frame_range(
963  ptr, &prop_clamp_min, &prop_clamp_max, &prop_soft_min, &prop_soft_max);
964  value = CLAMPIS(value, prop_clamp_min, prop_clamp_max);
965 
966  /* Need to set both step-data's start/end and the start/end on the base-data,
967  * or else Restrict-Range doesn't work due to RNA-property shadowing (T52009)
968  */
969  data->start_frame = value;
970  fcm->sfra = value;
971 }
972 
973 static void rna_FModifierStepped_frame_end_set(PointerRNA *ptr, float value)
974 {
975  FModifier *fcm = (FModifier *)ptr->data;
976  FMod_Stepped *data = fcm->data;
977 
978  float prop_clamp_min = -FLT_MAX, prop_clamp_max = FLT_MAX, prop_soft_min, prop_soft_max;
979  rna_FModifierStepped_end_frame_range(
980  ptr, &prop_clamp_min, &prop_clamp_max, &prop_soft_min, &prop_soft_max);
981  value = CLAMPIS(value, prop_clamp_min, prop_clamp_max);
982 
983  /* Need to set both step-data's start/end and the start/end on the base-data,
984  * or else Restrict-Range doesn't work due to RNA-property shadowing (T52009)
985  */
986  data->end_frame = value;
987  fcm->efra = value;
988 }
989 
990 static BezTriple *rna_FKeyframe_points_insert(
991  ID *id, FCurve *fcu, Main *bmain, float frame, float value, int keyframe_type, int flag)
992 {
993  int index = insert_vert_fcurve(
994  fcu, frame, value, (char)keyframe_type, flag | INSERTKEY_NO_USERPREF);
995 
996  if ((fcu->bezt) && (index >= 0)) {
997  rna_tag_animation_update(bmain, id);
998 
999  return fcu->bezt + index;
1000  }
1001 
1002  return NULL;
1003 }
1004 
1005 static void rna_FKeyframe_points_add(ID *id, FCurve *fcu, Main *bmain, int tot)
1006 {
1007  if (tot > 0) {
1008  BezTriple *bezt;
1009 
1010  fcu->bezt = MEM_recallocN(fcu->bezt, sizeof(BezTriple) * (fcu->totvert + tot));
1011 
1012  bezt = fcu->bezt + fcu->totvert;
1013  fcu->totvert += tot;
1014 
1015  while (tot--) {
1016  /* defaults, no userprefs gives predictable results for API */
1017  bezt->f1 = bezt->f2 = bezt->f3 = SELECT;
1018  bezt->ipo = BEZT_IPO_BEZ;
1019  bezt->h1 = bezt->h2 = HD_AUTO_ANIM;
1020  bezt++;
1021  }
1022 
1023  rna_tag_animation_update(bmain, id);
1024  }
1025 }
1026 
1027 static void rna_FKeyframe_points_remove(
1028  ID *id, FCurve *fcu, Main *bmain, ReportList *reports, PointerRNA *bezt_ptr, bool do_fast)
1029 {
1030  BezTriple *bezt = bezt_ptr->data;
1031  int index = (int)(bezt - fcu->bezt);
1032  if (index < 0 || index >= fcu->totvert) {
1033  BKE_report(reports, RPT_ERROR, "Keyframe not in F-Curve");
1034  return;
1035  }
1036 
1037  delete_fcurve_key(fcu, index, !do_fast);
1038  RNA_POINTER_INVALIDATE(bezt_ptr);
1039 
1040  rna_tag_animation_update(bmain, id);
1041 }
1042 
1043 static FCM_EnvelopeData *rna_FModifierEnvelope_points_add(
1044  ID *id, FModifier *fmod, Main *bmain, ReportList *reports, float frame)
1045 {
1046  FCM_EnvelopeData fed;
1047  FMod_Envelope *env = (FMod_Envelope *)fmod->data;
1048  int i;
1049 
1050  rna_tag_animation_update(bmain, id);
1051 
1052  /* init template data */
1053  fed.min = -1.0f;
1054  fed.max = 1.0f;
1055  fed.time = frame;
1056  fed.f1 = fed.f2 = 0;
1057 
1058  if (env->data) {
1059  bool exists;
1060  i = BKE_fcm_envelope_find_index(env->data, frame, env->totvert, &exists);
1061  if (exists) {
1062  BKE_reportf(reports, RPT_ERROR, "Already a control point at frame %.6f", frame);
1063  return NULL;
1064  }
1065 
1066  /* realloc memory for extra point */
1067  env->data = (FCM_EnvelopeData *)MEM_reallocN((void *)env->data,
1068  (env->totvert + 1) * sizeof(FCM_EnvelopeData));
1069 
1070  /* move the points after the added point */
1071  if (i < env->totvert) {
1072  memmove(env->data + i + 1, env->data + i, (env->totvert - i) * sizeof(FCM_EnvelopeData));
1073  }
1074 
1075  env->totvert++;
1076  }
1077  else {
1078  env->data = MEM_mallocN(sizeof(FCM_EnvelopeData), "FCM_EnvelopeData");
1079  env->totvert = 1;
1080  i = 0;
1081  }
1082 
1083  /* add point to paste at index i */
1084  *(env->data + i) = fed;
1085  return (env->data + i);
1086 }
1087 
1088 static void rna_FModifierEnvelope_points_remove(
1089  ID *id, FModifier *fmod, Main *bmain, ReportList *reports, PointerRNA *point)
1090 {
1091  FCM_EnvelopeData *cp = point->data;
1092  FMod_Envelope *env = (FMod_Envelope *)fmod->data;
1093 
1094  int index = (int)(cp - env->data);
1095 
1096  /* test point is in range */
1097  if (index < 0 || index >= env->totvert) {
1098  BKE_report(reports, RPT_ERROR, "Control point not in Envelope F-Modifier");
1099  return;
1100  }
1101 
1102  rna_tag_animation_update(bmain, id);
1103 
1104  if (env->totvert > 1) {
1105  /* move data after the removed point */
1106 
1107  memmove(env->data + index,
1108  env->data + (index + 1),
1109  sizeof(FCM_EnvelopeData) * ((env->totvert - index) - 1));
1110 
1111  /* realloc smaller array */
1112  env->totvert--;
1113  env->data = (FCM_EnvelopeData *)MEM_reallocN((void *)env->data,
1114  (env->totvert) * sizeof(FCM_EnvelopeData));
1115  }
1116  else {
1117  /* just free array, since the only vert was deleted */
1118  if (env->data) {
1119  MEM_freeN(env->data);
1120  env->data = NULL;
1121  }
1122  env->totvert = 0;
1123  }
1124  RNA_POINTER_INVALIDATE(point);
1125 }
1126 
1127 static void rna_Keyframe_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
1128 {
1129  rna_tag_animation_update(bmain, ptr->owner_id);
1130 }
1131 
1132 static void rna_FModifier_show_expanded_set(PointerRNA *ptr, bool value)
1133 {
1134  FModifier *fcm = ptr->data;
1136 }
1137 
1138 #else
1139 
1141 {
1142  StructRNA *srna;
1143  PropertyRNA *prop;
1144 
1145  static const EnumPropertyItem generator_mode_items[] = {
1146  {FCM_GENERATOR_POLYNOMIAL, "POLYNOMIAL", 0, "Expanded Polynomial", ""},
1148  "POLYNOMIAL_FACTORISED",
1149  0,
1150  "Factorized Polynomial",
1151  ""},
1152  {0, NULL, 0, NULL, NULL},
1153  };
1154 
1155  srna = RNA_def_struct(brna, "FModifierGenerator", "FModifier");
1157  srna, "Generator F-Modifier", "Deterministically generate values for the modified F-Curve");
1158  RNA_def_struct_sdna_from(srna, "FMod_Generator", "data");
1159 
1160  /* define common props */
1161  prop = RNA_def_property(srna, "use_additive", PROP_BOOLEAN, PROP_NONE);
1164  "Additive",
1165  "Values generated by this modifier are applied on top of "
1166  "the existing values instead of overwriting them");
1167  RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_FModifier_update");
1168 
1169  prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
1170  RNA_def_property_enum_items(prop, generator_mode_items);
1171  RNA_def_property_ui_text(prop, "Mode", "Type of generator to use");
1173  prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_FModifier_verify_data_update");
1174 
1175  /* order of the polynomial */
1176  prop = RNA_def_property(srna, "poly_order", PROP_INT, PROP_NONE);
1178  prop,
1179  "Polynomial Order",
1180  "The highest power of 'x' for this polynomial (number of coefficients - 1)");
1181  RNA_def_property_range(prop, 1, 100);
1183  prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_FModifier_verify_data_update");
1184 
1185  /* coefficients array */
1186  prop = RNA_def_property(srna, "coefficients", PROP_FLOAT, PROP_NONE);
1187  RNA_def_property_array(prop, 32);
1189  RNA_def_property_dynamic_array_funcs(prop, "rna_FModifierGenerator_coefficients_get_length");
1191  "rna_FModifierGenerator_coefficients_get",
1192  "rna_FModifierGenerator_coefficients_set",
1193  NULL);
1195  prop, "Coefficients", "Coefficients for 'x' (starting from lowest power of x^0)");
1197  prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_FModifier_verify_data_update");
1198 }
1199 
1200 /* --------- */
1201 
1203 {
1204  StructRNA *srna;
1205  PropertyRNA *prop;
1206 
1207  static const EnumPropertyItem prop_type_items[] = {
1208  {0, "SIN", 0, "Sine", ""},
1209  {1, "COS", 0, "Cosine", ""},
1210  {2, "TAN", 0, "Tangent", ""},
1211  {3, "SQRT", 0, "Square Root", ""},
1212  {4, "LN", 0, "Natural Logarithm", ""},
1213  {5, "SINC", 0, "Normalized Sine", "sin(x) / x"},
1214  {0, NULL, 0, NULL, NULL},
1215  };
1216 
1217  srna = RNA_def_struct(brna, "FModifierFunctionGenerator", "FModifier");
1219  srna, "Built-In Function F-Modifier", "Generate values using a built-in function");
1220  RNA_def_struct_sdna_from(srna, "FMod_FunctionGenerator", "data");
1221 
1222  /* coefficients */
1223  prop = RNA_def_property(srna, "amplitude", PROP_FLOAT, PROP_NONE);
1225  prop, "Amplitude", "Scale factor determining the maximum/minimum values");
1226  RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_FModifier_update");
1227 
1228  prop = RNA_def_property(srna, "phase_multiplier", PROP_FLOAT, PROP_NONE);
1230  prop, "Phase Multiple", "Scale factor determining the 'speed' of the function");
1231  RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_FModifier_update");
1232 
1233  prop = RNA_def_property(srna, "phase_offset", PROP_FLOAT, PROP_NONE);
1234  RNA_def_property_ui_text(prop, "Phase Offset", "Constant factor to offset time by for function");
1235  RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_FModifier_update");
1236 
1237  prop = RNA_def_property(srna, "value_offset", PROP_FLOAT, PROP_NONE);
1238  RNA_def_property_ui_text(prop, "Value Offset", "Constant factor to offset values by");
1239  RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_FModifier_update");
1240 
1241  /* flags */
1242  prop = RNA_def_property(srna, "use_additive", PROP_BOOLEAN, PROP_NONE);
1245  "Additive",
1246  "Values generated by this modifier are applied on top of "
1247  "the existing values instead of overwriting them");
1248  RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_FModifier_update");
1249 
1250  prop = RNA_def_property(srna, "function_type", PROP_ENUM, PROP_NONE);
1251  RNA_def_property_enum_sdna(prop, NULL, "type");
1252  RNA_def_property_enum_items(prop, prop_type_items);
1253  RNA_def_property_ui_text(prop, "Type", "Type of built-in function to use");
1254  RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_FModifier_update");
1255 }
1256 
1257 /* --------- */
1258 
1260 {
1261  StructRNA *srna;
1262  PropertyRNA *prop;
1263 
1264  srna = RNA_def_struct(brna, "FModifierEnvelopeControlPoint", NULL);
1265  RNA_def_struct_ui_text(srna, "Envelope Control Point", "Control point for envelope F-Modifier");
1266  RNA_def_struct_sdna(srna, "FCM_EnvelopeData");
1267 
1268  /* min/max extents
1269  * - for now, these are allowed to go past each other, so that we can have inverted action
1270  * - technically, the range is limited by the settings in the envelope-modifier data, not here...
1271  */
1272  prop = RNA_def_property(srna, "min", PROP_FLOAT, PROP_NONE);
1273  RNA_def_property_float_sdna(prop, NULL, "min");
1274  RNA_def_property_ui_text(prop, "Minimum Value", "Lower bound of envelope at this control-point");
1275  RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_FModifier_update");
1276 
1277  prop = RNA_def_property(srna, "max", PROP_FLOAT, PROP_NONE);
1278  RNA_def_property_float_sdna(prop, NULL, "max");
1279  RNA_def_property_ui_text(prop, "Maximum Value", "Upper bound of envelope at this control-point");
1280  RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_FModifier_update");
1281 
1282  /* Frame */
1283  prop = RNA_def_property(srna, "frame", PROP_FLOAT, PROP_TIME);
1284  RNA_def_property_float_sdna(prop, NULL, "time");
1285  RNA_def_property_ui_text(prop, "Frame", "Frame this control-point occurs on");
1286  RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_FModifier_update");
1287 
1288  /* TODO: */
1289  /* - selection flags (not implemented in UI yet though) */
1290 }
1291 
1293 {
1294  StructRNA *srna;
1295 
1296  FunctionRNA *func;
1297  PropertyRNA *parm;
1298 
1299  RNA_def_property_srna(cprop, "FModifierEnvelopeControlPoints");
1300  srna = RNA_def_struct(brna, "FModifierEnvelopeControlPoints", NULL);
1301  RNA_def_struct_sdna(srna, "FModifier");
1302 
1304  srna, "Control Points", "Control points defining the shape of the envelope");
1305 
1306  func = RNA_def_function(srna, "add", "rna_FModifierEnvelope_points_add");
1307  RNA_def_function_ui_description(func, "Add a control point to a FModifierEnvelope");
1309  parm = RNA_def_float(func,
1310  "frame",
1311  0.0f,
1312  -FLT_MAX,
1313  FLT_MAX,
1314  "",
1315  "Frame to add this control-point",
1316  -FLT_MAX,
1317  FLT_MAX);
1319  parm = RNA_def_pointer(
1320  func, "point", "FModifierEnvelopeControlPoint", "", "Newly created control-point");
1321  RNA_def_function_return(func, parm);
1322 
1323  func = RNA_def_function(srna, "remove", "rna_FModifierEnvelope_points_remove");
1324  RNA_def_function_ui_description(func, "Remove a control-point from an FModifierEnvelope");
1326  parm = RNA_def_pointer(
1327  func, "point", "FModifierEnvelopeControlPoint", "", "Control-point to remove");
1329 }
1330 
1332 {
1333  StructRNA *srna;
1334  PropertyRNA *prop;
1335 
1336  srna = RNA_def_struct(brna, "FModifierEnvelope", "FModifier");
1337  RNA_def_struct_ui_text(srna, "Envelope F-Modifier", "Scale the values of the modified F-Curve");
1338  RNA_def_struct_sdna_from(srna, "FMod_Envelope", "data");
1339 
1340  /* Collections */
1341  prop = RNA_def_property(srna, "control_points", PROP_COLLECTION, PROP_NONE);
1342  RNA_def_property_collection_sdna(prop, NULL, "data", "totvert");
1343  RNA_def_property_struct_type(prop, "FModifierEnvelopeControlPoint");
1345  prop, "Control Points", "Control points defining the shape of the envelope");
1347 
1348  /* Range Settings */
1349  prop = RNA_def_property(srna, "reference_value", PROP_FLOAT, PROP_NONE);
1350  RNA_def_property_float_sdna(prop, NULL, "midval");
1352  prop, "Reference Value", "Value that envelope's influence is centered around / based on");
1353  RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_FModifier_update");
1354 
1355  prop = RNA_def_property(srna, "default_min", PROP_FLOAT, PROP_NONE);
1356  RNA_def_property_float_sdna(prop, NULL, "min");
1358  prop, "Default Minimum", "Lower distance from Reference Value for 1:1 default influence");
1359  RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_FModifier_update");
1360 
1361  prop = RNA_def_property(srna, "default_max", PROP_FLOAT, PROP_NONE);
1362  RNA_def_property_float_sdna(prop, NULL, "max");
1364  prop, "Default Maximum", "Upper distance from Reference Value for 1:1 default influence");
1365  RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_FModifier_update");
1366 }
1367 
1368 /* --------- */
1369 
1371 {
1372  StructRNA *srna;
1373  PropertyRNA *prop;
1374 
1375  static const EnumPropertyItem prop_type_items[] = {
1376  {FCM_EXTRAPOLATE_NONE, "NONE", 0, "No Cycles", "Don't do anything"},
1377  {FCM_EXTRAPOLATE_CYCLIC, "REPEAT", 0, "Repeat Motion", "Repeat keyframe range as-is"},
1379  "REPEAT_OFFSET",
1380  0,
1381  "Repeat with Offset",
1382  "Repeat keyframe range, but with offset based on gradient between "
1383  "start and end values"},
1385  "MIRROR",
1386  0,
1387  "Repeat Mirrored",
1388  "Alternate between forward and reverse playback of keyframe range"},
1389  {0, NULL, 0, NULL, NULL},
1390  };
1391 
1392  srna = RNA_def_struct(brna, "FModifierCycles", "FModifier");
1393  RNA_def_struct_ui_text(srna, "Cycles F-Modifier", "Repeat the values of the modified F-Curve");
1394  RNA_def_struct_sdna_from(srna, "FMod_Cycles", "data");
1395 
1396  /* before */
1397  prop = RNA_def_property(srna, "mode_before", PROP_ENUM, PROP_NONE);
1398  RNA_def_property_enum_sdna(prop, NULL, "before_mode");
1399  RNA_def_property_enum_items(prop, prop_type_items);
1400  RNA_def_property_ui_text(prop, "Before Mode", "Cycling mode to use before first keyframe");
1401  RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_FModifier_update");
1402 
1403  prop = RNA_def_property(srna, "cycles_before", PROP_INT, PROP_NONE);
1404  RNA_def_property_int_sdna(prop, NULL, "before_cycles");
1406  prop,
1407  "Before Cycles",
1408  "Maximum number of cycles to allow before first keyframe (0 = infinite)");
1409  RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_FModifier_update");
1410 
1411  /* after */
1412  prop = RNA_def_property(srna, "mode_after", PROP_ENUM, PROP_NONE);
1413  RNA_def_property_enum_sdna(prop, NULL, "after_mode");
1414  RNA_def_property_enum_items(prop, prop_type_items);
1415  RNA_def_property_ui_text(prop, "After Mode", "Cycling mode to use after last keyframe");
1416  RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_FModifier_update");
1417 
1418  prop = RNA_def_property(srna, "cycles_after", PROP_INT, PROP_NONE);
1419  RNA_def_property_int_sdna(prop, NULL, "after_cycles");
1421  "After Cycles",
1422  "Maximum number of cycles to allow after last keyframe (0 = infinite)");
1423  RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_FModifier_update");
1424 }
1425 
1426 /* --------- */
1427 
1429 {
1430  StructRNA *srna;
1431  /*PropertyRNA *prop; */
1432 
1433  srna = RNA_def_struct(brna, "FModifierPython", "FModifier");
1435  srna, "Python F-Modifier", "Perform user-defined operation on the modified F-Curve");
1436  RNA_def_struct_sdna_from(srna, "FMod_Python", "data");
1437 }
1438 
1439 /* --------- */
1440 
1442 {
1443  StructRNA *srna;
1444  PropertyRNA *prop;
1445 
1446  srna = RNA_def_struct(brna, "FModifierLimits", "FModifier");
1448  srna, "Limit F-Modifier", "Limit the time/value ranges of the modified F-Curve");
1449  RNA_def_struct_sdna_from(srna, "FMod_Limits", "data");
1450 
1451  prop = RNA_def_property(srna, "use_min_x", PROP_BOOLEAN, PROP_NONE);
1453  RNA_def_property_ui_text(prop, "Minimum X", "Use the minimum X value");
1454  RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_FModifier_update");
1455 
1456  prop = RNA_def_property(srna, "use_min_y", PROP_BOOLEAN, PROP_NONE);
1458  RNA_def_property_ui_text(prop, "Minimum Y", "Use the minimum Y value");
1459  RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_FModifier_update");
1460 
1461  prop = RNA_def_property(srna, "use_max_x", PROP_BOOLEAN, PROP_NONE);
1463  RNA_def_property_ui_text(prop, "Maximum X", "Use the maximum X value");
1464  RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_FModifier_update");
1465 
1466  prop = RNA_def_property(srna, "use_max_y", PROP_BOOLEAN, PROP_NONE);
1468  RNA_def_property_ui_text(prop, "Maximum Y", "Use the maximum Y value");
1469  RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_FModifier_update");
1470 
1471  prop = RNA_def_property(srna, "min_x", PROP_FLOAT, PROP_NONE);
1472  RNA_def_property_float_sdna(prop, NULL, "rect.xmin");
1474  prop, NULL, "rna_FModifierLimits_minx_set", "rna_FModifierLimits_minx_range");
1475  RNA_def_property_ui_text(prop, "Minimum X", "Lowest X value to allow");
1476  RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_FModifier_update");
1477 
1478  prop = RNA_def_property(srna, "min_y", PROP_FLOAT, PROP_NONE);
1479  RNA_def_property_float_sdna(prop, NULL, "rect.ymin");
1481  prop, NULL, "rna_FModifierLimits_miny_set", "rna_FModifierLimits_miny_range");
1482  RNA_def_property_ui_text(prop, "Minimum Y", "Lowest Y value to allow");
1483  RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_FModifier_update");
1484 
1485  prop = RNA_def_property(srna, "max_x", PROP_FLOAT, PROP_NONE);
1486  RNA_def_property_float_sdna(prop, NULL, "rect.xmax");
1488  prop, NULL, "rna_FModifierLimits_maxx_set", "rna_FModifierLimits_maxx_range");
1489  RNA_def_property_ui_text(prop, "Maximum X", "Highest X value to allow");
1490  RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_FModifier_update");
1491 
1492  prop = RNA_def_property(srna, "max_y", PROP_FLOAT, PROP_NONE);
1493  RNA_def_property_float_sdna(prop, NULL, "rect.ymax");
1495  prop, NULL, "rna_FModifierLimits_maxy_set", "rna_FModifierLimits_maxy_range");
1496  RNA_def_property_ui_text(prop, "Maximum Y", "Highest Y value to allow");
1497  RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_FModifier_update");
1498 }
1499 
1500 /* --------- */
1501 
1503 {
1504  StructRNA *srna;
1505  PropertyRNA *prop;
1506 
1507  static const EnumPropertyItem prop_modification_items[] = {
1508  {FCM_NOISE_MODIF_REPLACE, "REPLACE", 0, "Replace", ""},
1509  {FCM_NOISE_MODIF_ADD, "ADD", 0, "Add", ""},
1510  {FCM_NOISE_MODIF_SUBTRACT, "SUBTRACT", 0, "Subtract", ""},
1511  {FCM_NOISE_MODIF_MULTIPLY, "MULTIPLY", 0, "Multiply", ""},
1512  {0, NULL, 0, NULL, NULL},
1513  };
1514 
1515  srna = RNA_def_struct(brna, "FModifierNoise", "FModifier");
1516  RNA_def_struct_ui_text(srna, "Noise F-Modifier", "Give randomness to the modified F-Curve");
1517  RNA_def_struct_sdna_from(srna, "FMod_Noise", "data");
1518 
1519  prop = RNA_def_property(srna, "blend_type", PROP_ENUM, PROP_NONE);
1520  RNA_def_property_enum_sdna(prop, NULL, "modification");
1521  RNA_def_property_enum_items(prop, prop_modification_items);
1522  RNA_def_property_ui_text(prop, "Blend Type", "Method of modifying the existing F-Curve");
1523  RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_FModifier_update");
1524 
1525  prop = RNA_def_property(srna, "scale", PROP_FLOAT, PROP_NONE);
1526  RNA_def_property_float_sdna(prop, NULL, "size");
1527  RNA_def_property_ui_text(prop, "Scale", "Scaling (in time) of the noise");
1528  RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_FModifier_update");
1529 
1530  prop = RNA_def_property(srna, "strength", PROP_FLOAT, PROP_NONE);
1531  RNA_def_property_float_sdna(prop, NULL, "strength");
1533  prop,
1534  "Strength",
1535  "Amplitude of the noise - the amount that it modifies the underlying curve");
1536  RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_FModifier_update");
1537 
1538  prop = RNA_def_property(srna, "phase", PROP_FLOAT, PROP_NONE);
1539  RNA_def_property_float_sdna(prop, NULL, "phase");
1540  RNA_def_property_ui_text(prop, "Phase", "A random seed for the noise effect");
1541  RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_FModifier_update");
1542 
1543  prop = RNA_def_property(srna, "offset", PROP_FLOAT, PROP_NONE);
1544  RNA_def_property_float_sdna(prop, NULL, "offset");
1545  RNA_def_property_ui_text(prop, "Offset", "Time offset for the noise effect");
1546  RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_FModifier_update");
1547 
1548  prop = RNA_def_property(srna, "depth", PROP_INT, PROP_UNSIGNED);
1549  RNA_def_property_int_sdna(prop, NULL, "depth");
1550  RNA_def_property_ui_text(prop, "Depth", "Amount of fine level detail present in the noise");
1551  RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_FModifier_update");
1552 }
1553 
1554 /* --------- */
1555 
1557 {
1558  StructRNA *srna;
1559  PropertyRNA *prop;
1560 
1561  srna = RNA_def_struct(brna, "FModifierStepped", "FModifier");
1563  srna,
1564  "Stepped Interpolation F-Modifier",
1565  "Hold each interpolated value from the F-Curve for several frames without "
1566  "changing the timing");
1567  RNA_def_struct_sdna_from(srna, "FMod_Stepped", "data");
1568 
1569  /* properties */
1570  prop = RNA_def_property(srna, "frame_step", PROP_FLOAT, PROP_NONE);
1571  RNA_def_property_float_sdna(prop, NULL, "step_size");
1572  RNA_def_property_ui_text(prop, "Step Size", "Number of frames to hold each value");
1573  RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_FModifier_update");
1574 
1575  prop = RNA_def_property(srna, "frame_offset", PROP_FLOAT, PROP_NONE);
1576  RNA_def_property_float_sdna(prop, NULL, "offset");
1578  "Offset",
1579  "Reference number of frames before frames get held "
1580  "(use to get hold for '1-3' vs '5-7' holding patterns)");
1581  RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_FModifier_update");
1582 
1583  prop = RNA_def_property(srna, "use_frame_start", PROP_BOOLEAN, PROP_NONE);
1586  prop, "Use Start Frame", "Restrict modifier to only act after its 'start' frame");
1587  RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_FModifier_update");
1588 
1589  prop = RNA_def_property(srna, "use_frame_end", PROP_BOOLEAN, PROP_NONE);
1592  prop, "Use End Frame", "Restrict modifier to only act before its 'end' frame");
1593  RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_FModifier_update");
1594 
1595  prop = RNA_def_property(srna, "frame_start", PROP_FLOAT, PROP_NONE);
1596  RNA_def_property_float_sdna(prop, NULL, "start_frame");
1598  NULL,
1599  "rna_FModifierStepped_frame_start_set",
1600  "rna_FModifierStepped_start_frame_range");
1602  prop, "Start Frame", "Frame that modifier's influence starts (if applicable)");
1603  RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_FModifier_update");
1604 
1605  prop = RNA_def_property(srna, "frame_end", PROP_FLOAT, PROP_NONE);
1606  RNA_def_property_float_sdna(prop, NULL, "end_frame");
1608  prop, NULL, "rna_FModifierStepped_frame_end_set", "rna_FModifierStepped_end_frame_range");
1610  prop, "End Frame", "Frame that modifier's influence ends (if applicable)");
1611  RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_FModifier_update");
1612 }
1613 
1614 /* --------- */
1615 
1616 static void rna_def_fmodifier(BlenderRNA *brna)
1617 {
1618  StructRNA *srna;
1619  PropertyRNA *prop;
1620 
1621  /* base struct definition */
1622  srna = RNA_def_struct(brna, "FModifier", NULL);
1623  RNA_def_struct_refine_func(srna, "rna_FModifierType_refine");
1624  RNA_def_struct_ui_text(srna, "F-Modifier", "Modifier for values of F-Curve");
1625 
1626 # if 0 /* XXX not used yet */
1627  /* name */
1628  prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
1629  RNA_def_struct_name_property(srna, prop);
1630  RNA_def_property_ui_text(prop, "Name", "Short description of F-Curve Modifier");
1631 # endif /* XXX not used yet */
1632 
1633  /* type */
1634  prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
1638  RNA_def_property_ui_text(prop, "Type", "F-Curve Modifier Type");
1639 
1640  /* settings */
1641  prop = RNA_def_property(srna, "show_expanded", PROP_BOOLEAN, PROP_NONE);
1643  RNA_def_property_boolean_sdna(prop, NULL, "ui_expand_flag", 0);
1644  RNA_def_property_boolean_funcs(prop, NULL, "rna_FModifier_show_expanded_set");
1645  RNA_def_property_ui_text(prop, "Expanded", "F-Curve Modifier's panel is expanded in UI");
1646  RNA_def_property_ui_icon(prop, ICON_DISCLOSURE_TRI_RIGHT, 1);
1647 
1648  prop = RNA_def_property(srna, "mute", PROP_BOOLEAN, PROP_NONE);
1650  RNA_def_property_ui_text(prop, "Enabled", "Enable F-Curve modifier evaluation");
1651  RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME_PROP, "rna_FModifier_update");
1652  RNA_def_property_ui_icon(prop, ICON_CHECKBOX_HLT, -1);
1653 
1654  prop = RNA_def_property(srna, "is_valid", PROP_BOOLEAN, PROP_NONE);
1658  prop, "Disabled", "F-Curve Modifier has invalid settings and will not be evaluated");
1659  RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME_PROP, "rna_FModifier_update");
1660 
1661  /* TODO: setting this to true must ensure that all others in stack are turned off too... */
1662  prop = RNA_def_property(srna, "active", PROP_BOOLEAN, PROP_NONE);
1664  RNA_def_property_ui_text(prop, "Active", "F-Curve modifier will show settings in the editor");
1665  RNA_def_property_boolean_funcs(prop, NULL, "rna_FModifier_active_set");
1666  RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME_PROP, "rna_FModifier_active_update");
1667  RNA_def_property_ui_icon(prop, ICON_RADIOBUT_OFF, 1);
1668 
1669  /* restricted range */
1670  prop = RNA_def_property(srna, "use_restricted_range", PROP_BOOLEAN, PROP_NONE);
1673  prop,
1674  "Restrict Frame Range",
1675  "F-Curve Modifier is only applied for the specified frame range to help "
1676  "mask off effects in order to chain them");
1677  RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME_PROP, "rna_FModifier_update");
1678 
1679  prop = RNA_def_property(srna, "frame_start", PROP_FLOAT, PROP_NONE);
1680  RNA_def_property_float_sdna(prop, NULL, "sfra");
1682  prop, NULL, "rna_FModifier_start_frame_set", "rna_FModifier_start_frame_range");
1684  prop,
1685  "Start Frame",
1686  "Frame that modifier's influence starts (if Restrict Frame Range is in use)");
1687  RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME_PROP, "rna_FModifier_update");
1688 
1689  prop = RNA_def_property(srna, "frame_end", PROP_FLOAT, PROP_NONE);
1690  RNA_def_property_float_sdna(prop, NULL, "efra");
1692  prop, NULL, "rna_FModifier_end_frame_set", "rna_FModifier_end_frame_range");
1694  prop,
1695  "End Frame",
1696  "Frame that modifier's influence ends (if Restrict Frame Range is in use)");
1697  RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME_PROP, "rna_FModifier_update");
1698 
1699  prop = RNA_def_property(srna, "blend_in", PROP_FLOAT, PROP_NONE);
1700  RNA_def_property_float_sdna(prop, NULL, "blendin");
1701  RNA_def_property_float_funcs(prop, NULL, NULL, "rna_FModifier_blending_range");
1703  prop, "Blend In", "Number of frames from start frame for influence to take effect");
1704  RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME_PROP, "rna_FModifier_update");
1705 
1706  prop = RNA_def_property(srna, "blend_out", PROP_FLOAT, PROP_NONE);
1707  RNA_def_property_float_sdna(prop, NULL, "blendout");
1708  RNA_def_property_float_funcs(prop, NULL, NULL, "rna_FModifier_blending_range");
1710  prop, "Blend Out", "Number of frames from end frame for influence to fade out");
1711  RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME_PROP, "rna_FModifier_update");
1712 
1713  /* influence */
1714  prop = RNA_def_property(srna, "use_influence", PROP_BOOLEAN, PROP_NONE);
1717  prop, "Use Influence", "F-Curve Modifier's effects will be tempered by a default factor");
1718  RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME_PROP, "rna_FModifier_update");
1719 
1720  prop = RNA_def_property(srna, "influence", PROP_FLOAT, PROP_FACTOR);
1721  RNA_def_property_float_sdna(prop, NULL, "influence");
1722  RNA_def_property_range(prop, 0.0f, 1.0f);
1723  RNA_def_property_float_default(prop, 1.0f);
1725  prop, "Influence", "Amount of influence F-Curve Modifier will have when not fading in/out");
1726  RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME_PROP, "rna_FModifier_update");
1727 }
1728 
1729 /* *********************** */
1730 
1732 {
1733  StructRNA *srna;
1734  PropertyRNA *prop;
1735 
1736  static const EnumPropertyItem prop_trans_chan_items[] = {
1737  {DTAR_TRANSCHAN_LOCX, "LOC_X", 0, "X Location", ""},
1738  {DTAR_TRANSCHAN_LOCY, "LOC_Y", 0, "Y Location", ""},
1739  {DTAR_TRANSCHAN_LOCZ, "LOC_Z", 0, "Z Location", ""},
1740  {0, "", 0, NULL, NULL},
1741  {DTAR_TRANSCHAN_ROTX, "ROT_X", 0, "X Rotation", ""},
1742  {DTAR_TRANSCHAN_ROTY, "ROT_Y", 0, "Y Rotation", ""},
1743  {DTAR_TRANSCHAN_ROTZ, "ROT_Z", 0, "Z Rotation", ""},
1744  {DTAR_TRANSCHAN_ROTW, "ROT_W", 0, "W Rotation", ""},
1745  {0, "", 0, NULL, NULL},
1746  {DTAR_TRANSCHAN_SCALEX, "SCALE_X", 0, "X Scale", ""},
1747  {DTAR_TRANSCHAN_SCALEY, "SCALE_Y", 0, "Y Scale", ""},
1748  {DTAR_TRANSCHAN_SCALEZ, "SCALE_Z", 0, "Z Scale", ""},
1749  {DTAR_TRANSCHAN_SCALE_AVG, "SCALE_AVG", 0, "Average Scale", ""},
1750  {0, NULL, 0, NULL, NULL},
1751  };
1752 
1753  static const EnumPropertyItem prop_local_space_items[] = {
1754  {0,
1755  "WORLD_SPACE",
1756  0,
1757  "World Space",
1758  "Transforms include effects of parenting/restpose and constraints"},
1760  "TRANSFORM_SPACE",
1761  0,
1762  "Transform Space",
1763  "Transforms don't include parenting/restpose or constraints"},
1765  "LOCAL_SPACE",
1766  0,
1767  "Local Space",
1768  "Transforms include effects of constraints but not "
1769  "parenting/restpose"},
1770  {0, NULL, 0, NULL, NULL},
1771  };
1772 
1773  srna = RNA_def_struct(brna, "DriverTarget", NULL);
1774  RNA_def_struct_ui_text(srna, "Driver Target", "Source of input values for driver variables");
1775 
1776  /* Target Properties - ID-block to Drive */
1777  prop = RNA_def_property(srna, "id", PROP_POINTER, PROP_NONE);
1778  RNA_def_property_struct_type(prop, "ID");
1781  RNA_def_property_editable_func(prop, "rna_DriverTarget_id_editable");
1782  /* note: custom set function is ONLY to avoid rna setting a user for this. */
1784  prop, NULL, "rna_DriverTarget_id_set", "rna_DriverTarget_id_typef", NULL);
1786  "ID",
1787  "ID-block that the specific property used can be found from "
1788  "(id_type property must be set first)");
1789  RNA_def_property_update(prop, 0, "rna_DriverTarget_update_data");
1790 
1791  prop = RNA_def_property(srna, "id_type", PROP_ENUM, PROP_NONE);
1792  RNA_def_property_enum_sdna(prop, NULL, "idtype");
1795  RNA_def_property_enum_funcs(prop, NULL, "rna_DriverTarget_id_type_set", NULL);
1796  RNA_def_property_editable_func(prop, "rna_DriverTarget_id_type_editable");
1797  RNA_def_property_ui_text(prop, "ID Type", "Type of ID-block that can be used");
1799  RNA_def_property_update(prop, 0, "rna_DriverTarget_update_data");
1800 
1801  /* Target Properties - Property to Drive */
1802  prop = RNA_def_property(srna, "data_path", PROP_STRING, PROP_NONE);
1804  "rna_DriverTarget_RnaPath_get",
1805  "rna_DriverTarget_RnaPath_length",
1806  "rna_DriverTarget_RnaPath_set");
1807  RNA_def_property_ui_text(prop, "Data Path", "RNA Path (from ID-block) to property used");
1808  RNA_def_property_update(prop, 0, "rna_DriverTarget_update_data");
1809 
1810  prop = RNA_def_property(srna, "bone_target", PROP_STRING, PROP_NONE);
1811  RNA_def_property_string_sdna(prop, NULL, "pchan_name");
1812  RNA_def_property_ui_text(prop, "Bone Name", "Name of PoseBone to use as target");
1813  RNA_def_property_update(prop, 0, "rna_DriverTarget_update_data");
1814 
1815  prop = RNA_def_property(srna, "transform_type", PROP_ENUM, PROP_NONE);
1816  RNA_def_property_enum_sdna(prop, NULL, "transChan");
1817  RNA_def_property_enum_items(prop, prop_trans_chan_items);
1818  RNA_def_property_ui_text(prop, "Type", "Driver variable type");
1819  RNA_def_property_update(prop, 0, "rna_DriverTarget_update_data");
1820 
1821  prop = RNA_def_property(srna, "rotation_mode", PROP_ENUM, PROP_NONE);
1822  RNA_def_property_enum_sdna(prop, NULL, "rotation_mode");
1824  RNA_def_property_ui_text(prop, "Rotation Mode", "Mode for calculating rotation channel values");
1825  RNA_def_property_update(prop, 0, "rna_DriverTarget_update_data");
1826 
1827  prop = RNA_def_property(srna, "transform_space", PROP_ENUM, PROP_NONE);
1829  RNA_def_property_enum_items(prop, prop_local_space_items);
1830  RNA_def_property_ui_text(prop, "Transform Space", "Space in which transforms are used");
1831  RNA_def_property_update(prop, 0, "rna_DriverTarget_update_data");
1832 }
1833 
1834 static void rna_def_drivervar(BlenderRNA *brna)
1835 {
1836  StructRNA *srna;
1837  PropertyRNA *prop;
1838 
1839  static const EnumPropertyItem prop_type_items[] = {
1841  "SINGLE_PROP",
1842  ICON_RNA,
1843  "Single Property",
1844  "Use the value from some RNA property (Default)"},
1846  "TRANSFORMS",
1847  ICON_DRIVER_TRANSFORM,
1848  "Transform Channel",
1849  "Final transformation value of object or bone"},
1851  "ROTATION_DIFF",
1852  ICON_DRIVER_ROTATIONAL_DIFFERENCE,
1853  "Rotational Difference",
1854  "Use the angle between two bones"},
1856  "LOC_DIFF",
1857  ICON_DRIVER_DISTANCE,
1858  "Distance",
1859  "Distance between two bones or objects"},
1860  {0, NULL, 0, NULL, NULL},
1861  };
1862 
1863  srna = RNA_def_struct(brna, "DriverVariable", NULL);
1864  RNA_def_struct_sdna(srna, "DriverVar");
1866  srna, "Driver Variable", "Variable from some source/target for driver relationship");
1867 
1868  /* Variable Name */
1869  prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
1870  RNA_def_struct_name_property(srna, prop);
1871  RNA_def_property_string_funcs(prop, NULL, NULL, "rna_DriverVariable_name_set");
1873  prop,
1874  "Name",
1875  "Name to use in scripted expressions/functions (no spaces or dots are allowed, "
1876  "and must start with a letter)");
1877  RNA_def_property_update(prop, 0, "rna_DriverTarget_update_name"); /* XXX */
1878 
1879  /* Enums */
1880  prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
1881  RNA_def_property_enum_items(prop, prop_type_items);
1882  RNA_def_property_enum_funcs(prop, NULL, "rna_DriverVariable_type_set", NULL);
1883  RNA_def_property_ui_text(prop, "Type", "Driver variable type");
1884  RNA_def_property_update(prop, 0, "rna_ChannelDriver_update_data"); /* XXX */
1885 
1886  /* Targets */
1887  /* TODO: for nicer api, only expose the relevant props via subclassing,
1888  * instead of exposing the collection of targets */
1889  prop = RNA_def_property(srna, "targets", PROP_COLLECTION, PROP_NONE);
1890  RNA_def_property_collection_sdna(prop, NULL, "targets", "num_targets");
1891  RNA_def_property_struct_type(prop, "DriverTarget");
1893  RNA_def_property_ui_text(prop, "Targets", "Sources of input data for evaluating this variable");
1894 
1895  /* Name Validity Flags */
1896  prop = RNA_def_property(srna, "is_name_valid", PROP_BOOLEAN, PROP_NONE);
1899  RNA_def_property_ui_text(prop, "Is Name Valid", "Is this a valid name for a driver variable");
1900 }
1901 
1902 /* channeldriver.variables.* */
1904 {
1905  StructRNA *srna;
1906  /* PropertyRNA *prop; */
1907 
1908  FunctionRNA *func;
1909  PropertyRNA *parm;
1910 
1911  RNA_def_property_srna(cprop, "ChannelDriverVariables");
1912  srna = RNA_def_struct(brna, "ChannelDriverVariables", NULL);
1913  RNA_def_struct_sdna(srna, "ChannelDriver");
1915  srna, "ChannelDriver Variables", "Collection of channel driver Variables");
1916 
1917  /* add variable */
1918  func = RNA_def_function(srna, "new", "rna_Driver_new_variable");
1919  RNA_def_function_ui_description(func, "Add a new variable for the driver");
1920  /* return type */
1921  parm = RNA_def_pointer(func, "var", "DriverVariable", "", "Newly created Driver Variable");
1922  RNA_def_function_return(func, parm);
1923 
1924  /* remove variable */
1925  func = RNA_def_function(srna, "remove", "rna_Driver_remove_variable");
1926  RNA_def_function_ui_description(func, "Remove an existing variable from the driver");
1928  /* target to remove */
1929  parm = RNA_def_pointer(
1930  func, "variable", "DriverVariable", "", "Variable to remove from the driver");
1933 }
1934 
1936 {
1937  StructRNA *srna;
1938  PropertyRNA *prop;
1939 
1940  static const EnumPropertyItem prop_type_items[] = {
1941  {DRIVER_TYPE_AVERAGE, "AVERAGE", 0, "Averaged Value", ""},
1942  {DRIVER_TYPE_SUM, "SUM", 0, "Sum Values", ""},
1943  {DRIVER_TYPE_PYTHON, "SCRIPTED", 0, "Scripted Expression", ""},
1944  {DRIVER_TYPE_MIN, "MIN", 0, "Minimum Value", ""},
1945  {DRIVER_TYPE_MAX, "MAX", 0, "Maximum Value", ""},
1946  {0, NULL, 0, NULL, NULL},
1947  };
1948 
1949  srna = RNA_def_struct(brna, "Driver", NULL);
1950  RNA_def_struct_sdna(srna, "ChannelDriver");
1952  srna, "Driver", "Driver for the value of a setting based on an external value");
1953  RNA_def_struct_ui_icon(srna, ICON_DRIVER);
1954 
1955  /* Enums */
1956  prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
1957  RNA_def_property_enum_items(prop, prop_type_items);
1958  RNA_def_property_ui_text(prop, "Type", "Driver type");
1959  RNA_def_property_update(prop, 0, "rna_ChannelDriver_update_data");
1960 
1961  /* String values */
1962  prop = RNA_def_property(srna, "expression", PROP_STRING, PROP_NONE);
1963  RNA_def_property_ui_text(prop, "Expression", "Expression to use for Scripted Expression");
1964  RNA_def_property_update(prop, 0, "rna_ChannelDriver_update_expr");
1965 
1966  /* Collections */
1967  prop = RNA_def_property(srna, "variables", PROP_COLLECTION, PROP_NONE);
1968  RNA_def_property_collection_sdna(prop, NULL, "variables", NULL);
1969  RNA_def_property_struct_type(prop, "DriverVariable");
1971  RNA_def_property_ui_text(prop, "Variables", "Properties acting as inputs for this driver");
1972  rna_def_channeldriver_variables(brna, prop);
1973 
1974  /* Settings */
1975  prop = RNA_def_property(srna, "use_self", PROP_BOOLEAN, PROP_NONE);
1978  prop,
1979  "Use Self",
1980  "Include a 'self' variable in the name-space, "
1981  "so drivers can easily reference the data being modified (object, bone, etc...)");
1982 
1983  /* State Info (for Debugging) */
1984  prop = RNA_def_property(srna, "is_valid", PROP_BOOLEAN, PROP_NONE);
1987  prop, "Invalid", "Driver could not be evaluated in past, so should be skipped");
1988 
1989  prop = RNA_def_property(srna, "is_simple_expression", PROP_BOOLEAN, PROP_NONE);
1991  RNA_def_property_boolean_funcs(prop, "rna_ChannelDriver_is_simple_expression_get", NULL);
1993  prop,
1994  "Simple Expression",
1995  "The scripted expression can be evaluated without using the full python interpreter");
1996 
1997  /* Functions */
1998  RNA_api_drivers(srna);
1999 }
2000 
2001 /* *********************** */
2002 
2003 static void rna_def_fpoint(BlenderRNA *brna)
2004 {
2005  StructRNA *srna;
2006  PropertyRNA *prop;
2007 
2008  srna = RNA_def_struct(brna, "FCurveSample", NULL);
2009  RNA_def_struct_sdna(srna, "FPoint");
2010  RNA_def_struct_ui_text(srna, "F-Curve Sample", "Sample point for F-Curve");
2011 
2012  /* Boolean values */
2013  prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
2014  RNA_def_property_boolean_sdna(prop, NULL, "flag", 1);
2015  RNA_def_property_ui_text(prop, "Select", "Selection status");
2017 
2018  /* Vector value */
2019  prop = RNA_def_property(srna, "co", PROP_FLOAT, PROP_COORDS); /* keyframes are dimensionless */
2020  RNA_def_property_float_sdna(prop, NULL, "vec");
2021  RNA_def_property_array(prop, 2);
2022  RNA_def_property_ui_text(prop, "Point", "Point coordinates");
2024 }
2025 
2026 /* duplicate of BezTriple in rna_curve.c
2027  * but with F-Curve specific options updates/functionality
2028  */
2029 static void rna_def_fkeyframe(BlenderRNA *brna)
2030 {
2031  StructRNA *srna;
2032  PropertyRNA *prop;
2033 
2034  srna = RNA_def_struct(brna, "Keyframe", NULL);
2035  RNA_def_struct_sdna(srna, "BezTriple");
2037  srna, "Keyframe", "Bezier curve point with two handles defining a Keyframe on an F-Curve");
2038 
2039  /* Boolean values */
2040  prop = RNA_def_property(srna, "select_left_handle", PROP_BOOLEAN, PROP_NONE);
2042  RNA_def_property_ui_text(prop, "Handle 1 selected", "Left handle selection status");
2044 
2045  prop = RNA_def_property(srna, "select_right_handle", PROP_BOOLEAN, PROP_NONE);
2047  RNA_def_property_ui_text(prop, "Handle 2 selected", "Right handle selection status");
2049 
2050  prop = RNA_def_property(srna, "select_control_point", PROP_BOOLEAN, PROP_NONE);
2052  RNA_def_property_ui_text(prop, "Select", "Control point selection status");
2054 
2055  /* Enums */
2056  prop = RNA_def_property(srna, "handle_left_type", PROP_ENUM, PROP_NONE);
2057  RNA_def_property_enum_sdna(prop, NULL, "h1");
2059  RNA_def_property_ui_text(prop, "Left Handle Type", "Handle types");
2060  RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME_PROP, "rna_Keyframe_update");
2061 
2062  prop = RNA_def_property(srna, "handle_right_type", PROP_ENUM, PROP_NONE);
2063  RNA_def_property_enum_sdna(prop, NULL, "h2");
2065  RNA_def_property_ui_text(prop, "Right Handle Type", "Handle types");
2066  RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME_PROP, "rna_Keyframe_update");
2067 
2068  prop = RNA_def_property(srna, "interpolation", PROP_ENUM, PROP_NONE);
2069  RNA_def_property_enum_sdna(prop, NULL, "ipo");
2072  "Interpolation",
2073  "Interpolation method to use for segment of the F-Curve from "
2074  "this Keyframe until the next Keyframe");
2075  RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME_PROP, "rna_Keyframe_update");
2076 
2077  prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
2078  RNA_def_property_enum_sdna(prop, NULL, "hide");
2080  RNA_def_property_ui_text(prop, "Type", "Type of keyframe (for visual purposes only)");
2081  RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME_PROP, "rna_Keyframe_update");
2082 
2083  prop = RNA_def_property(srna, "easing", PROP_ENUM, PROP_NONE);
2084  RNA_def_property_enum_sdna(prop, NULL, "easing");
2087  "Easing",
2088  "Which ends of the segment between this and the next keyframe easing "
2089  "interpolation is applied to");
2090  RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME_PROP, "rna_Keyframe_update");
2091 
2092  prop = RNA_def_property(srna, "back", PROP_FLOAT, PROP_NONE);
2093  RNA_def_property_float_sdna(prop, NULL, "back");
2094  RNA_def_property_ui_text(prop, "Back", "Amount of overshoot for 'back' easing");
2095  RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME_PROP, "rna_Keyframe_update");
2096 
2097  prop = RNA_def_property(srna, "amplitude", PROP_FLOAT, PROP_NONE);
2098  RNA_def_property_float_sdna(prop, NULL, "amplitude");
2099  RNA_def_property_range(prop, 0.0f, FLT_MAX); /* only positive values... */
2101  prop, "Amplitude", "Amount to boost elastic bounces for 'elastic' easing");
2102  RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME_PROP, "rna_Keyframe_update");
2103 
2104  prop = RNA_def_property(srna, "period", PROP_FLOAT, PROP_NONE);
2105  RNA_def_property_float_sdna(prop, NULL, "period");
2106  RNA_def_property_ui_text(prop, "Period", "Time between bounces for elastic easing");
2107  RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME_PROP, "rna_Keyframe_update");
2108 
2109  /* Vector values */
2110  prop = RNA_def_property(
2111  srna, "handle_left", PROP_FLOAT, PROP_COORDS); /* keyframes are dimensionless */
2112  RNA_def_property_array(prop, 2);
2114  prop, "rna_FKeyframe_handle1_get", "rna_FKeyframe_handle1_set", NULL);
2116  prop, "Left Handle", "Coordinates of the left handle (before the control point)");
2117  RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_Keyframe_update");
2118 
2119  prop = RNA_def_property(srna, "co", PROP_FLOAT, PROP_COORDS); /* keyframes are dimensionless */
2120  RNA_def_property_array(prop, 2);
2122  prop, "rna_FKeyframe_ctrlpoint_get", "rna_FKeyframe_ctrlpoint_set", NULL);
2123  RNA_def_property_ui_text(prop, "Control Point", "Coordinates of the control point");
2124  RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_Keyframe_update");
2125 
2126  prop = RNA_def_property(
2127  srna, "co_ui", PROP_FLOAT, PROP_COORDS); /* keyframes are dimensionless */
2128  RNA_def_property_array(prop, 2);
2130  prop, "rna_FKeyframe_ctrlpoint_get", "rna_FKeyframe_ctrlpoint_ui_set", NULL);
2132  prop,
2133  "Control Point",
2134  "Coordinates of the control point. Note: Changing this value also updates the handles "
2135  "similar to using the graph editor transform operator");
2136  RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_Keyframe_update");
2137 
2138  prop = RNA_def_property(
2139  srna, "handle_right", PROP_FLOAT, PROP_COORDS); /* keyframes are dimensionless */
2140  RNA_def_property_array(prop, 2);
2142  prop, "rna_FKeyframe_handle2_get", "rna_FKeyframe_handle2_set", NULL);
2144  prop, "Right Handle", "Coordinates of the right handle (after the control point)");
2145  RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_Keyframe_update");
2146 }
2147 
2149 {
2150  /* add modifiers */
2151  StructRNA *srna;
2152  PropertyRNA *prop;
2153 
2154  FunctionRNA *func;
2155  PropertyRNA *parm;
2156 
2157  RNA_def_property_srna(cprop, "FCurveModifiers");
2158  srna = RNA_def_struct(brna, "FCurveModifiers", NULL);
2159  RNA_def_struct_sdna(srna, "FCurve");
2160  RNA_def_struct_ui_text(srna, "F-Curve Modifiers", "Collection of F-Curve Modifiers");
2161 
2162  /* Collection active property */
2163  prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
2164  RNA_def_property_struct_type(prop, "FModifier");
2166  prop, "rna_FCurve_active_modifier_get", "rna_FCurve_active_modifier_set", NULL, NULL);
2168  RNA_def_property_ui_text(prop, "Active F-Curve Modifier", "Active F-Curve Modifier");
2169 
2170  /* Constraint collection */
2171  func = RNA_def_function(srna, "new", "rna_FCurve_modifiers_new");
2172  RNA_def_function_ui_description(func, "Add a constraint to this object");
2173  /* return type */
2174  parm = RNA_def_pointer(func, "fmodifier", "FModifier", "", "New fmodifier");
2175  RNA_def_function_return(func, parm);
2176  /* object to add */
2177  parm = RNA_def_enum(
2178  func, "type", rna_enum_fmodifier_type_items, 1, "", "Constraint type to add");
2180 
2181  func = RNA_def_function(srna, "remove", "rna_FCurve_modifiers_remove");
2183  RNA_def_function_ui_description(func, "Remove a modifier from this F-Curve");
2184  /* modifier to remove */
2185  parm = RNA_def_pointer(func, "modifier", "FModifier", "", "Removed modifier");
2188 }
2189 
2190 /* fcurve.keyframe_points */
2192 {
2193  StructRNA *srna;
2194 
2195  FunctionRNA *func;
2196  PropertyRNA *parm;
2197 
2198  static const EnumPropertyItem keyframe_flag_items[] = {
2200  "REPLACE",
2201  0,
2202  "Replace",
2203  "Don't add any new keyframes, but just replace existing ones"},
2204  {INSERTKEY_NEEDED, "NEEDED", 0, "Needed", "Only adds keyframes that are needed"},
2205  {INSERTKEY_FAST,
2206  "FAST",
2207  0,
2208  "Fast",
2209  "Fast keyframe insertion to avoid recalculating the curve each time"},
2210  {0, NULL, 0, NULL, NULL},
2211  };
2212 
2213  RNA_def_property_srna(cprop, "FCurveKeyframePoints");
2214  srna = RNA_def_struct(brna, "FCurveKeyframePoints", NULL);
2215  RNA_def_struct_sdna(srna, "FCurve");
2216  RNA_def_struct_ui_text(srna, "Keyframe Points", "Collection of keyframe points");
2217 
2218  func = RNA_def_function(srna, "insert", "rna_FKeyframe_points_insert");
2219  RNA_def_function_ui_description(func, "Add a keyframe point to a F-Curve");
2221  parm = RNA_def_float(func,
2222  "frame",
2223  0.0f,
2224  -FLT_MAX,
2225  FLT_MAX,
2226  "",
2227  "X Value of this keyframe point",
2228  -FLT_MAX,
2229  FLT_MAX);
2231  parm = RNA_def_float(func,
2232  "value",
2233  0.0f,
2234  -FLT_MAX,
2235  FLT_MAX,
2236  "",
2237  "Y Value of this keyframe point",
2238  -FLT_MAX,
2239  FLT_MAX);
2241  RNA_def_enum_flag(func, "options", keyframe_flag_items, 0, "", "Keyframe options");
2242  RNA_def_enum(func,
2243  "keyframe_type",
2246  "",
2247  "Type of keyframe to insert");
2248  parm = RNA_def_pointer(func, "keyframe", "Keyframe", "", "Newly created keyframe");
2249  RNA_def_function_return(func, parm);
2250 
2251  func = RNA_def_function(srna, "add", "rna_FKeyframe_points_add");
2252  RNA_def_function_ui_description(func, "Add a keyframe point to a F-Curve");
2254  parm = RNA_def_int(
2255  func, "count", 1, 0, INT_MAX, "Number", "Number of points to add to the spline", 0, INT_MAX);
2257 
2258  func = RNA_def_function(srna, "remove", "rna_FKeyframe_points_remove");
2259  RNA_def_function_ui_description(func, "Remove keyframe from an F-Curve");
2261  parm = RNA_def_pointer(func, "keyframe", "Keyframe", "", "Keyframe to remove");
2264  /* optional */
2266  func, "fast", 0, "Fast", "Fast keyframe removal to avoid recalculating the curve each time");
2267 }
2268 
2269 static void rna_def_fcurve(BlenderRNA *brna)
2270 {
2271  StructRNA *srna;
2272  PropertyRNA *prop;
2273  FunctionRNA *func;
2274  PropertyRNA *parm;
2275 
2276  static const EnumPropertyItem prop_mode_extend_items[] = {
2278  "CONSTANT",
2279  0,
2280  "Constant",
2281  "Hold values of endpoint keyframes"},
2283  "LINEAR",
2284  0,
2285  "Linear",
2286  "Use slope of curve leading in/out of endpoint keyframes"},
2287  {0, NULL, 0, NULL, NULL},
2288  };
2289  static const EnumPropertyItem prop_mode_color_items[] = {
2291  "AUTO_RAINBOW",
2292  0,
2293  "Auto Rainbow",
2294  "Cycle through the rainbow, trying to give each curve a unique color"},
2296  "AUTO_RGB",
2297  0,
2298  "Auto XYZ to RGB",
2299  "Use axis colors for transform and color properties, and auto-rainbow for the rest"},
2301  "AUTO_YRGB",
2302  0,
2303  "Auto WXYZ to YRGB",
2304  "Use axis colors for XYZ parts of transform, and yellow for the 'W' channel"},
2306  "CUSTOM",
2307  0,
2308  "User Defined",
2309  "Use custom hand-picked color for F-Curve"},
2310  {0, NULL, 0, NULL, NULL},
2311  };
2312 
2313  srna = RNA_def_struct(brna, "FCurve", NULL);
2314  RNA_def_struct_ui_text(srna, "F-Curve", "F-Curve defining values of a period of time");
2315  RNA_def_struct_ui_icon(srna, ICON_ANIM_DATA);
2316 
2317  /* Enums */
2318  prop = RNA_def_property(srna, "extrapolation", PROP_ENUM, PROP_NONE);
2319  RNA_def_property_enum_sdna(prop, NULL, "extend");
2320  RNA_def_property_enum_items(prop, prop_mode_extend_items);
2322  prop,
2323  "Extrapolation",
2324  "Method used for evaluating value of F-Curve outside first and last keyframes");
2325  RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_FCurve_update_data");
2326 
2327  /* Pointers */
2328  prop = RNA_def_property(srna, "driver", PROP_POINTER, PROP_NONE);
2331  RNA_def_property_ui_text(prop, "Driver", "Channel Driver (only set for Driver F-Curves)");
2332 
2333  prop = RNA_def_property(srna, "group", PROP_POINTER, PROP_NONE);
2334  RNA_def_property_pointer_sdna(prop, NULL, "grp");
2336  RNA_def_property_ui_text(prop, "Group", "Action Group that this F-Curve belongs to");
2337  RNA_def_property_pointer_funcs(prop, NULL, "rna_FCurve_group_set", NULL, NULL);
2339 
2340  /* Path + Array Index */
2341  prop = RNA_def_property(srna, "data_path", PROP_STRING, PROP_NONE);
2343  prop, "rna_FCurve_RnaPath_get", "rna_FCurve_RnaPath_length", "rna_FCurve_RnaPath_set");
2344  RNA_def_property_ui_text(prop, "Data Path", "RNA Path to property affected by F-Curve");
2345  /* XXX need an update callback for this to that animation gets evaluated */
2346  RNA_def_property_update(prop, NC_ANIMATION, "rna_FCurve_update_data_relations");
2347 
2348  /* called 'index' when given as function arg */
2349  prop = RNA_def_property(srna, "array_index", PROP_INT, PROP_UNSIGNED);
2351  prop, "RNA Array Index", "Index to the specific property affected by F-Curve if applicable");
2352  /* XXX need an update callback for this so that animation gets evaluated */
2353  RNA_def_property_update(prop, NC_ANIMATION, "rna_FCurve_update_data_relations");
2354 
2355  /* Color */
2356  prop = RNA_def_property(srna, "color_mode", PROP_ENUM, PROP_NONE);
2357  RNA_def_property_enum_items(prop, prop_mode_color_items);
2359  prop, "Color Mode", "Method used to determine color of F-Curve in Graph Editor");
2361 
2362  prop = RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR);
2363  RNA_def_property_array(prop, 3);
2364  RNA_def_property_range(prop, 0.0f, 1.0f);
2365  RNA_def_property_ui_text(prop, "Color", "Color of the F-Curve in the Graph Editor");
2367 
2368  /* Flags */
2369  prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
2371  RNA_def_property_ui_text(prop, "Select", "F-Curve is selected for editing");
2373 
2374  prop = RNA_def_property(srna, "lock", PROP_BOOLEAN, PROP_NONE);
2376  RNA_def_property_ui_text(prop, "Lock", "F-Curve's settings cannot be edited");
2378 
2379  prop = RNA_def_property(srna, "mute", PROP_BOOLEAN, PROP_NONE);
2382  RNA_def_property_ui_text(prop, "Muted", "Disable F-Curve Modifier evaluation");
2383  RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, "rna_FCurve_update_eval");
2384 
2385  prop = RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE);
2388  prop, "Hide", "F-Curve and its keyframes are hidden in the Graph Editor graphs");
2390 
2391  prop = RNA_def_property(srna, "auto_smoothing", PROP_ENUM, PROP_NONE);
2394  prop, "Auto Handle Smoothing", "Algorithm used to compute automatic handles");
2395  RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_FCurve_update_data");
2396 
2397  /* State Info (for Debugging) */
2398  prop = RNA_def_property(srna, "is_valid", PROP_BOOLEAN, PROP_NONE);
2401  prop,
2402  "Valid",
2403  "False when F-Curve could not be evaluated in past, so should be skipped "
2404  "when evaluating");
2406 
2407  prop = RNA_def_property(srna, "is_empty", PROP_BOOLEAN, PROP_NONE);
2408  RNA_def_property_boolean_funcs(prop, "rna_FCurve_is_empty_get", NULL);
2411  "Empty",
2412  "True if the curve contributes no animation due to lack of "
2413  "keyframes or useful modifiers, and should be deleted");
2414 
2415  /* Collections */
2416  prop = RNA_def_property(srna, "sampled_points", PROP_COLLECTION, PROP_NONE);
2417  RNA_def_property_collection_sdna(prop, NULL, "fpt", "totvert");
2418  RNA_def_property_struct_type(prop, "FCurveSample");
2419  RNA_def_property_ui_text(prop, "Sampled Points", "Sampled animation data");
2420 
2421  prop = RNA_def_property(srna, "keyframe_points", PROP_COLLECTION, PROP_NONE);
2422  RNA_def_property_collection_sdna(prop, NULL, "bezt", "totvert");
2423  RNA_def_property_struct_type(prop, "Keyframe");
2424  RNA_def_property_ui_text(prop, "Keyframes", "User-editable keyframes");
2425  rna_def_fcurve_keyframe_points(brna, prop);
2426 
2427  prop = RNA_def_property(srna, "modifiers", PROP_COLLECTION, PROP_NONE);
2428  RNA_def_property_struct_type(prop, "FModifier");
2429  RNA_def_property_ui_text(prop, "Modifiers", "Modifiers affecting the shape of the F-Curve");
2430  rna_def_fcurve_modifiers(brna, prop);
2431 
2432  /* Functions */
2433  /* -- evaluate -- */
2434  func = RNA_def_function(srna, "evaluate", "evaluate_fcurve"); /* calls the C/API direct */
2435  RNA_def_function_ui_description(func, "Evaluate F-Curve");
2436  parm = RNA_def_float(func,
2437  "frame",
2438  1.0f,
2439  -FLT_MAX,
2440  FLT_MAX,
2441  "Frame",
2442  "Evaluate F-Curve at given frame",
2443  -FLT_MAX,
2444  FLT_MAX);
2446  /* return value */
2447  parm = RNA_def_float(func,
2448  "value",
2449  0,
2450  -FLT_MAX,
2451  FLT_MAX,
2452  "Value",
2453  "Value of F-Curve specific frame",
2454  -FLT_MAX,
2455  FLT_MAX);
2456  RNA_def_function_return(func, parm);
2457 
2458  /* -- update / recalculate -- */
2459  func = RNA_def_function(srna, "update", "rna_FCurve_update_data_ex");
2462  func, "Ensure keyframes are sorted in chronological order and handles are set correctly");
2463 
2464  /* -- time extents/range -- */
2465  func = RNA_def_function(srna, "range", "rna_FCurve_range");
2466  RNA_def_function_ui_description(func, "Get the time extents for F-Curve");
2467  /* return value */
2468  parm = RNA_def_float_vector(
2469  func, "range", 2, NULL, -FLT_MAX, FLT_MAX, "Range", "Min/Max values", -FLT_MAX, FLT_MAX);
2471  RNA_def_function_output(func, parm);
2472 
2473  /* -- auto-flag validity (ensures valid handling for data type) -- */
2474  func = RNA_def_function(
2475  srna, "update_autoflags", "update_autoflags_fcurve"); /* calls the C/API direct */
2477  func,
2478  "Update FCurve flags set automatically from affected property "
2479  "(currently, integer/discrete flags set when the property is not a float)");
2481  parm = RNA_def_pointer(
2482  func, "data", "AnyType", "Data", "Data containing the property controlled by given FCurve");
2484 
2485  /* Functions */
2486  RNA_api_fcurves(srna);
2487 }
2488 
2489 /* *********************** */
2490 
2492 {
2493  rna_def_fcurve(brna);
2494  rna_def_fkeyframe(brna);
2495  rna_def_fpoint(brna);
2496 
2497  rna_def_drivertarget(brna);
2498  rna_def_drivervar(brna);
2499  rna_def_channeldriver(brna);
2500 
2501  rna_def_fmodifier(brna);
2502 
2505 
2508 
2514 }
2515 
2516 #endif
Blender kernel action and pose functionality.
void action_groups_remove_channel(struct bAction *act, struct FCurve *fcu)
Definition: action.c:538
void action_groups_add_channel(struct bAction *act, struct bActionGroup *agrp, struct FCurve *fcurve)
Definition: action.c:431
struct AnimData * BKE_animdata_from_id(struct ID *id)
Definition: anim_data.c:96
int BKE_fcm_envelope_find_index(struct FCM_EnvelopeData *array, float frame, int arraylen, bool *r_exists)
bool BKE_fcurve_calc_range(struct FCurve *fcu, float *min, float *max, const bool do_sel_only, const bool do_min_length)
Definition: fcurve.c:795
const FModifierTypeInfo * fmodifier_get_typeinfo(const struct FModifier *fcm)
bool BKE_fcurve_is_empty(struct FCurve *fcu)
Definition: fcurve.c:2250
struct FModifier * find_active_fmodifier(ListBase *modifiers)
Definition: fmodifier.c:1288
void set_active_fmodifier(ListBase *modifiers, struct FModifier *fcm)
Definition: fmodifier.c:1311
bool remove_fmodifier(ListBase *modifiers, struct FModifier *fcm)
Definition: fmodifier.c:1226
void sort_time_fcurve(struct FCurve *fcu)
Definition: fcurve.c:1429
void calchandles_fcurve(struct FCurve *fcu)
Definition: fcurve.c:1391
struct FModifier * add_fmodifier(ListBase *modifiers, int type, struct FCurve *owner_fcu)
Definition: fmodifier.c:1114
void BKE_driver_invalidate_expression(struct ChannelDriver *driver, bool expr_changed, bool varname_changed)
bool BKE_driver_has_simple_expression(struct ChannelDriver *driver)
struct DriverVar * driver_add_new_variable(struct ChannelDriver *driver)
void driver_free_variable_ex(struct ChannelDriver *driver, struct DriverVar *dvar)
void driver_change_variable_type(struct DriverVar *dvar, int type)
void driver_variable_name_validate(struct DriverVar *dvar)
void BKE_report(ReportList *reports, ReportType type, const char *message)
Definition: report.c:104
void BKE_reportf(ReportList *reports, ReportType type, const char *format,...) ATTR_PRINTF_FORMAT(3
#define BLI_assert(a)
Definition: BLI_assert.h:58
void BLI_addtail(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
Definition: listbase.c:110
int BLI_findindex(const struct ListBase *listbase, const void *vlink) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
char * BLI_strdup(const char *str) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL() ATTR_MALLOC
Definition: string.c:70
char * BLI_strncpy_utf8(char *__restrict dst, const char *__restrict src, size_t maxncpy) ATTR_NONNULL()
Definition: string_utf8.c:258
#define CLAMPIS(a, b, c)
#define UNUSED(x)
#define SET_FLAG_FROM_TEST(value, test, flag)
#define ELEM(...)
#define BLT_I18NCONTEXT_ID_ACTION
#define BLT_I18NCONTEXT_ID_ID
void DEG_id_tag_update_ex(struct Main *bmain, struct ID *id, int flag)
void DEG_id_tag_update(struct ID *id, int flag)
void DEG_relations_tag_update(struct Main *bmain)
@ ID_RECALC_TRANSFORM
Definition: DNA_ID.h:599
@ ID_RECALC_ANIMATION
Definition: DNA_ID.h:614
@ ID_RECALC_GEOMETRY
Definition: DNA_ID.h:611
@ ID_AC
Definition: DNA_ID_enums.h:79
@ ID_OB
Definition: DNA_ID_enums.h:59
@ FCM_STEPPED_NO_AFTER
@ FCM_STEPPED_NO_BEFORE
@ DTAR_TRANSCHAN_ROTZ
@ DTAR_TRANSCHAN_SCALEX
@ DTAR_TRANSCHAN_SCALEZ
@ DTAR_TRANSCHAN_LOCX
@ DTAR_TRANSCHAN_ROTW
@ DTAR_TRANSCHAN_LOCY
@ DTAR_TRANSCHAN_ROTX
@ DTAR_TRANSCHAN_LOCZ
@ DTAR_TRANSCHAN_SCALE_AVG
@ DTAR_TRANSCHAN_SCALEY
@ DTAR_TRANSCHAN_ROTY
@ FCM_EXTRAPOLATE_MIRROR
@ FCM_EXTRAPOLATE_CYCLIC
@ FCM_EXTRAPOLATE_CYCLIC_OFFSET
@ FCM_EXTRAPOLATE_NONE
@ DRIVER_TYPE_AVERAGE
@ DRIVER_TYPE_PYTHON
@ DRIVER_TYPE_MAX
@ DRIVER_TYPE_MIN
@ DRIVER_TYPE_SUM
@ FCURVE_COLOR_AUTO_RGB
@ FCURVE_COLOR_AUTO_RAINBOW
@ FCURVE_COLOR_CUSTOM
@ FCURVE_COLOR_AUTO_YRGB
@ FCM_GENERATOR_ADDITIVE
@ FCM_LIMIT_XMIN
@ FCM_LIMIT_YMAX
@ FCM_LIMIT_XMAX
@ FCM_LIMIT_YMIN
@ FCM_NOISE_MODIF_REPLACE
@ FCM_NOISE_MODIF_SUBTRACT
@ FCM_NOISE_MODIF_ADD
@ FCM_NOISE_MODIF_MULTIPLY
@ DVAR_TYPE_LOC_DIFF
@ DVAR_TYPE_TRANSFORM_CHAN
@ DVAR_TYPE_ROT_DIFF
@ DVAR_TYPE_SINGLE_PROP
@ INSERTKEY_FAST
@ INSERTKEY_REPLACE
@ INSERTKEY_NEEDED
@ INSERTKEY_NO_USERPREF
@ FMODIFIER_TYPE_CYCLES
@ FMODIFIER_TYPE_FILTER
@ FMODIFIER_TYPE_STEPPED
@ FMODIFIER_TYPE_FN_GENERATOR
@ FMODIFIER_TYPE_NOISE
@ FMODIFIER_TYPE_NULL
@ FMODIFIER_TYPE_GENERATOR
@ FMODIFIER_TYPE_ENVELOPE
@ FMODIFIER_TYPE_PYTHON
@ FMODIFIER_TYPE_LIMITS
@ FCM_GENERATOR_POLYNOMIAL_FACTORISED
@ FCM_GENERATOR_POLYNOMIAL
@ FMODIFIER_FLAG_MUTED
@ FMODIFIER_FLAG_USEINFLUENCE
@ FMODIFIER_FLAG_ACTIVE
@ FMODIFIER_FLAG_DISABLED
@ FMODIFIER_FLAG_RANGERESTRICT
@ DTAR_ROTMODE_QUATERNION
@ DTAR_ROTMODE_SWING_TWIST_X
@ DTAR_ROTMODE_EULER_ZXY
@ DTAR_ROTMODE_SWING_TWIST_Y
@ DTAR_ROTMODE_EULER_XYZ
@ DTAR_ROTMODE_EULER_ZYX
@ DTAR_ROTMODE_AUTO
@ DTAR_ROTMODE_EULER_YXZ
@ DTAR_ROTMODE_EULER_XZY
@ DTAR_ROTMODE_SWING_TWIST_Z
@ DTAR_ROTMODE_EULER_YZX
@ DTAR_FLAG_LOCAL_CONSTS
@ DTAR_FLAG_LOCALSPACE
@ DTAR_FLAG_ID_OB_ONLY
@ DRIVER_FLAG_INVALID
@ DRIVER_FLAG_USE_SELF
@ FCURVE_DISABLED
@ FCURVE_MUTED
@ FCURVE_SELECTED
@ FCURVE_PROTECTED
@ FCURVE_VISIBLE
@ FCURVE_EXTRAPOLATE_CONSTANT
@ FCURVE_EXTRAPOLATE_LINEAR
@ FCURVE_SMOOTH_NONE
@ FCURVE_SMOOTH_CONT_ACCEL
@ DVAR_FLAG_INVALID_NAME
@ HD_AUTO_ANIM
@ BEZT_IPO_BEZ
@ BEZT_IPO_EASE_OUT
@ BEZT_IPO_EASE_AUTO
@ BEZT_IPO_EASE_IN
@ BEZT_IPO_EASE_IN_OUT
@ BEZT_KEYTYPE_EXTREME
@ BEZT_KEYTYPE_JITTER
@ BEZT_KEYTYPE_BREAKDOWN
@ BEZT_KEYTYPE_MOVEHOLD
@ BEZT_KEYTYPE_KEYFRAME
Object is a sort of wrapper for general info.
#define MAXFRAMEF
#define MINAFRAMEF
@ UI_PANEL_DATA_EXPAND_ROOT
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum type
Read Guarded memory(de)allocation.
#define MEM_recallocN(vmemh, len)
#define MEM_reallocN(vmemh, len)
Group RGB to Bright Vector Camera CLAMP
StructRNA RNA_FModifier
#define RNA_POINTER_INVALIDATE(ptr)
Definition: RNA_access.h:1425
StructRNA RNA_FModifierPython
StructRNA RNA_FModifierGenerator
StructRNA RNA_FModifierStepped
StructRNA RNA_FCurve
StructRNA RNA_FModifierEnvelope
StructRNA RNA_UnknownType
StructRNA RNA_FModifierNoise
StructRNA RNA_FModifierCycles
StructRNA RNA_FModifierLimits
StructRNA RNA_FModifierFunctionGenerator
StructRNA * ID_code_to_RNA_type(short idcode)
StructRNA RNA_Driver
#define RNA_MAX_ARRAY_DIMENSION
Definition: RNA_define.h:42
@ PARM_RNAPTR
Definition: RNA_types.h:339
@ PARM_REQUIRED
Definition: RNA_types.h:337
@ FUNC_USE_REPORTS
Definition: RNA_types.h:578
@ FUNC_USE_MAIN
Definition: RNA_types.h:576
@ FUNC_USE_CONTEXT
Definition: RNA_types.h:577
@ FUNC_USE_SELF_ID
Definition: RNA_types.h:565
@ PROP_FLOAT
Definition: RNA_types.h:75
@ PROP_BOOLEAN
Definition: RNA_types.h:73
@ PROP_ENUM
Definition: RNA_types.h:77
@ PROP_INT
Definition: RNA_types.h:74
@ PROP_STRING
Definition: RNA_types.h:76
@ PROP_POINTER
Definition: RNA_types.h:78
@ PROP_COLLECTION
Definition: RNA_types.h:79
@ PROPOVERRIDE_OVERRIDABLE_LIBRARY
Definition: RNA_types.h:297
@ PROP_THICK_WRAP
Definition: RNA_types.h:270
@ PROP_DYNAMIC
Definition: RNA_types.h:275
@ PROP_EDITABLE
Definition: RNA_types.h:175
@ PROP_NEVER_NULL
Definition: RNA_types.h:225
@ PROP_NO_DEG_UPDATE
Definition: RNA_types.h:286
@ PROP_PTR_NO_OWNERSHIP
Definition: RNA_types.h:242
@ PROP_TIME
Definition: RNA_types.h:133
@ PROP_COLOR
Definition: RNA_types.h:139
@ PROP_COORDS
Definition: RNA_types.h:153
@ PROP_NONE
Definition: RNA_types.h:113
@ PROP_FACTOR
Definition: RNA_types.h:131
@ PROP_UNSIGNED
Definition: RNA_types.h:129
#define NC_ANIMATION
Definition: WM_types.h:289
#define NC_SCENE
Definition: WM_types.h:279
#define NA_EDITED
Definition: WM_types.h:462
#define ND_SPACE_GRAPH
Definition: WM_types.h:427
#define ND_KEYFRAME_PROP
Definition: WM_types.h:395
#define ND_FRAME
Definition: WM_types.h:334
#define ND_KEYFRAME
Definition: WM_types.h:394
#define ND_ANIMCHAN
Definition: WM_types.h:396
#define NC_SPACE
Definition: WM_types.h:293
#define NA_SELECTED
Definition: WM_types.h:467
return(oflags[bm->toolflag_index].f &oflag) !=0
SIMD_FORCE_INLINE btScalar length(const btQuaternion &q)
Return the length of a quaternion.
Definition: btQuaternion.h:895
#define SELECT
Scene scene
#define GS(x)
Definition: iris.c:241
void delete_fcurve_key(FCurve *fcu, int index, bool do_recalc)
int insert_vert_fcurve(FCurve *fcu, float x, float y, eBezTriple_KeyframeType keyframe_type, eInsertKeyFlags flag)
Definition: keyframing.c:547
void(* MEM_freeN)(void *vmemh)
Definition: mallocn.c:41
void *(* MEM_mallocN)(size_t len, const char *str)
Definition: mallocn.c:47
const EnumPropertyItem rna_enum_id_type_items[]
Definition: rna_ID.c:46
void RNA_pointer_create(ID *id, StructRNA *type, void *data, PointerRNA *r_ptr)
Definition: rna_access.c:146
PointerRNA rna_pointer_inherit_refine(PointerRNA *ptr, StructRNA *type, void *data)
Definition: rna_access.c:196
const EnumPropertyItem rna_enum_beztriple_interpolation_mode_items[]
Definition: rna_curve.c:82
const EnumPropertyItem rna_enum_keyframe_handle_type_items[]
Definition: rna_curve.c:53
PropertyRNA * RNA_def_float(StructOrFunctionRNA *cont_, const char *identifier, float default_value, float hardmin, float hardmax, const char *ui_name, const char *ui_description, float softmin, float softmax)
Definition: rna_define.c:3825
void RNA_def_struct_refine_func(StructRNA *srna, const char *refine)
Definition: rna_define.c:1167
void RNA_def_property_pointer_sdna(PropertyRNA *prop, const char *structname, const char *propname)
Definition: rna_define.c:2762
PropertyRNA * RNA_def_boolean(StructOrFunctionRNA *cont_, const char *identifier, bool default_value, const char *ui_name, const char *ui_description)
Definition: rna_define.c:3481
PropertyRNA * RNA_def_enum_flag(StructOrFunctionRNA *cont_, const char *identifier, const EnumPropertyItem *items, int default_value, const char *ui_name, const char *ui_description)
Definition: rna_define.c:3795
PropertyRNA * RNA_def_pointer(StructOrFunctionRNA *cont_, const char *identifier, const char *type, const char *ui_name, const char *ui_description)
Definition: rna_define.c:4159
void RNA_def_property_boolean_sdna(PropertyRNA *prop, const char *structname, const char *propname, int64_t bit)
Definition: rna_define.c:2257
void RNA_def_parameter_clear_flags(PropertyRNA *prop, PropertyFlag flag_property, ParameterFlag flag_parameter)
Definition: rna_define.c:1555
void RNA_def_property_string_funcs(PropertyRNA *prop, const char *get, const char *length, const char *set)
Definition: rna_define.c:3312
void RNA_def_property_float_default(PropertyRNA *prop, float value)
Definition: rna_define.c:2042
void RNA_def_function_return(FunctionRNA *func, PropertyRNA *ret)
Definition: rna_define.c:4302
void RNA_def_property_enum_default(PropertyRNA *prop, int value)
Definition: rna_define.c:2127
void RNA_def_property_float_funcs(PropertyRNA *prop, const char *get, const char *set, const char *range)
Definition: rna_define.c:3153
void RNA_def_property_ui_text(PropertyRNA *prop, const char *name, const char *description)
Definition: rna_define.c:1676
void RNA_def_property_string_sdna(PropertyRNA *prop, const char *structname, const char *propname)
Definition: rna_define.c:2717
void RNA_def_property_ui_icon(PropertyRNA *prop, int icon, int consecutive)
Definition: rna_define.c:1684
FunctionRNA * RNA_def_function(StructRNA *srna, const char *identifier, const char *call)
Definition: rna_define.c:4262
void RNA_def_property_srna(PropertyRNA *prop, const char *type)
Definition: rna_define.c:3462
void RNA_def_struct_ui_text(StructRNA *srna, const char *name, const char *description)
Definition: rna_define.c:1259
void RNA_def_function_output(FunctionRNA *UNUSED(func), PropertyRNA *ret)
Definition: rna_define.c:4327
void RNA_def_property_boolean_funcs(PropertyRNA *prop, const char *get, const char *set)
Definition: rna_define.c:2971
void RNA_def_property_dynamic_array_funcs(PropertyRNA *prop, const char *getlength)
Definition: rna_define.c:2953
PropertyRNA * RNA_def_float_vector(StructOrFunctionRNA *cont_, const char *identifier, int len, const float *default_value, float hardmin, float hardmax, const char *ui_name, const char *ui_description, float softmin, float softmax)
Definition: rna_define.c:3851
void RNA_def_property_enum_items(PropertyRNA *prop, const EnumPropertyItem *item)
Definition: rna_define.c:1892
void RNA_def_struct_sdna(StructRNA *srna, const char *structname)
Definition: rna_define.c:1067
void RNA_def_property_array(PropertyRNA *prop, int length)
Definition: rna_define.c:1568
void RNA_def_property_range(PropertyRNA *prop, double min, double max)
Definition: rna_define.c:1757
void RNA_def_struct_sdna_from(StructRNA *srna, const char *structname, const char *propname)
Definition: rna_define.c:1094
void RNA_def_property_struct_type(PropertyRNA *prop, const char *type)
Definition: rna_define.c:1792
void RNA_def_property_collection_sdna(PropertyRNA *prop, const char *structname, const char *propname, const char *lengthpropname)
Definition: rna_define.c:2791
void RNA_def_function_ui_description(FunctionRNA *func, const char *description)
Definition: rna_define.c:4337
void RNA_def_property_update(PropertyRNA *prop, int noteflag, const char *func)
Definition: rna_define.c:2927
void RNA_def_property_enum_funcs(PropertyRNA *prop, const char *get, const char *set, const char *item)
Definition: rna_define.c:3251
void RNA_def_property_editable_func(PropertyRNA *prop, const char *editable)
Definition: rna_define.c:2877
PropertyRNA * RNA_def_property(StructOrFunctionRNA *cont_, const char *identifier, int type, int subtype)
Definition: rna_define.c:1279
void RNA_def_property_enum_bitflag_sdna(PropertyRNA *prop, const char *structname, const char *propname)
Definition: rna_define.c:2691
void RNA_def_struct_name_property(struct StructRNA *srna, struct PropertyRNA *prop)
Definition: rna_define.c:1122
void RNA_def_function_flag(FunctionRNA *func, int flag)
Definition: rna_define.c:4332
void RNA_def_property_clear_flag(PropertyRNA *prop, PropertyFlag flag)
Definition: rna_define.c:1517
void RNA_def_property_pointer_funcs(PropertyRNA *prop, const char *get, const char *set, const char *type_fn, const char *poll)
Definition: rna_define.c:3373
StructRNA * RNA_def_struct(BlenderRNA *brna, const char *identifier, const char *from)
Definition: rna_define.c:1047
void RNA_def_property_enum_sdna(PropertyRNA *prop, const char *structname, const char *propname)
Definition: rna_define.c:2623
void RNA_def_struct_ui_icon(StructRNA *srna, int icon)
Definition: rna_define.c:1267
void RNA_def_property_translation_context(PropertyRNA *prop, const char *context)
Definition: rna_define.c:2870
void RNA_def_property_flag(PropertyRNA *prop, PropertyFlag flag)
Definition: rna_define.c:1512
PropertyRNA * RNA_def_int(StructOrFunctionRNA *cont_, const char *identifier, int default_value, int hardmin, int hardmax, const char *ui_name, const char *ui_description, int softmin, int softmax)
Definition: rna_define.c:3585
void RNA_def_property_float_sdna(PropertyRNA *prop, const char *structname, const char *propname)
Definition: rna_define.c:2515
PropertyRNA * RNA_def_enum(StructOrFunctionRNA *cont_, const char *identifier, const EnumPropertyItem *items, int default_value, const char *ui_name, const char *ui_description)
Definition: rna_define.c:3771
void RNA_def_property_int_sdna(PropertyRNA *prop, const char *structname, const char *propname)
Definition: rna_define.c:2364
void RNA_def_property_boolean_negative_sdna(PropertyRNA *prop, const char *structname, const char *propname, int64_t booleanbit)
Definition: rna_define.c:2348
void RNA_def_property_override_flag(PropertyRNA *prop, PropertyOverrideFlag flag)
Definition: rna_define.c:1525
void RNA_def_parameter_flags(PropertyRNA *prop, PropertyFlag flag_property, ParameterFlag flag_parameter)
Definition: rna_define.c:1547
static void rna_def_fmodifier_noise(BlenderRNA *brna)
Definition: rna_fcurve.c:1502
static void rna_def_fmodifier_envelope(BlenderRNA *brna)
Definition: rna_fcurve.c:1331
void RNA_def_fcurve(BlenderRNA *brna)
Definition: rna_fcurve.c:2491
const EnumPropertyItem rna_enum_fmodifier_type_items[]
Definition: rna_fcurve.c:45
static void rna_def_fmodifier(BlenderRNA *brna)
Definition: rna_fcurve.c:1616
static void rna_def_channeldriver(BlenderRNA *brna)
Definition: rna_fcurve.c:1935
static void rna_def_channeldriver_variables(BlenderRNA *brna, PropertyRNA *cprop)
Definition: rna_fcurve.c:1903
const EnumPropertyItem rna_enum_beztriple_interpolation_easing_items[]
Definition: rna_fcurve.c:124
static void rna_def_drivervar(BlenderRNA *brna)
Definition: rna_fcurve.c:1834
static void rna_def_fmodifier_cycles(BlenderRNA *brna)
Definition: rna_fcurve.c:1370
static void rna_def_drivertarget(BlenderRNA *brna)
Definition: rna_fcurve.c:1731
static void rna_def_fcurve_keyframe_points(BlenderRNA *brna, PropertyRNA *cprop)
Definition: rna_fcurve.c:2191
static void rna_def_fmodifier_stepped(BlenderRNA *brna)
Definition: rna_fcurve.c:1556
static void rna_def_fmodifier_generator(BlenderRNA *brna)
Definition: rna_fcurve.c:1140
const EnumPropertyItem rna_enum_beztriple_keyframe_type_items[]
Definition: rna_fcurve.c:95
const EnumPropertyItem rna_enum_fcurve_auto_smoothing_items[]
Definition: rna_fcurve.c:79
static void rna_def_fcurve(BlenderRNA *brna)
Definition: rna_fcurve.c:2269
const EnumPropertyItem rna_enum_driver_target_rotation_mode_items[]
Definition: rna_fcurve.c:151
static void rna_def_fmodifier_limits(BlenderRNA *brna)
Definition: rna_fcurve.c:1441
static void rna_def_fmodifier_python(BlenderRNA *brna)
Definition: rna_fcurve.c:1428
static void rna_def_fpoint(BlenderRNA *brna)
Definition: rna_fcurve.c:2003
static void rna_def_fmodifier_envelope_ctrl(BlenderRNA *brna)
Definition: rna_fcurve.c:1259
static void rna_def_fmodifier_function_generator(BlenderRNA *brna)
Definition: rna_fcurve.c:1202
static void rna_def_fmodifier_envelope_control_points(BlenderRNA *brna, PropertyRNA *cprop)
Definition: rna_fcurve.c:1292
static void rna_def_fkeyframe(BlenderRNA *brna)
Definition: rna_fcurve.c:2029
static void rna_def_fcurve_modifiers(BlenderRNA *brna, PropertyRNA *cprop)
Definition: rna_fcurve.c:2148
void RNA_api_fcurves(StructRNA *srna)
void RNA_api_drivers(StructRNA *UNUSED(srna))
#define min(a, b)
Definition: sort.c:51
bAction * action
ListBase drivers
float vec[3][3]
ListBase variables
struct FCurve * next
bActionGroup * grp
char * rna_path
ChannelDriver * driver
BezTriple * bezt
short flag
unsigned int totvert
ListBase modifiers
FCM_EnvelopeData * data
void(* verify_data)(struct FModifier *fcm)
Definition: BKE_fcurve.h:100
char name[64]
struct FCurve * curve
struct FModifier * next
short ui_expand_flag
void * data
struct FModifier * prev
Definition: DNA_ID.h:273
char name[66]
Definition: DNA_ID.h:283
void * first
Definition: DNA_listBase.h:47
Definition: BKE_main.h:116
struct StructRNA * type
Definition: RNA_types.h:51
void * data
Definition: RNA_types.h:52
struct ID * owner_id
Definition: RNA_types.h:50
ListBase curves
float max
void WM_main_add_notifier(unsigned int type, void *reference)
PointerRNA * ptr
Definition: wm_files.c:3157