Blender  V3.3
rna_key.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 
7 #include <stdlib.h>
8 
9 #include "DNA_ID.h"
10 #include "DNA_curve_types.h"
11 #include "DNA_key_types.h"
12 #include "DNA_lattice_types.h"
13 #include "DNA_mesh_types.h"
14 #include "DNA_scene_types.h"
15 
16 #include "BLI_math.h"
17 #include "BLI_utildefines.h"
18 
19 #include "BLT_translation.h"
20 
21 #include "RNA_access.h"
22 #include "RNA_define.h"
23 #include "RNA_enum_types.h"
24 
25 #include "MEM_guardedalloc.h"
26 
27 #include "rna_internal.h"
28 
30  {KEY_LINEAR, "KEY_LINEAR", 0, "Linear", ""},
31  {KEY_CARDINAL, "KEY_CARDINAL", 0, "Cardinal", ""},
32  {KEY_CATMULL_ROM, "KEY_CATMULL_ROM", 0, "Catmull-Rom", ""},
33  {KEY_BSPLINE, "KEY_BSPLINE", 0, "BSpline", ""},
34  {0, NULL, 0, NULL, NULL},
35 };
36 
37 #ifdef RNA_RUNTIME
38 
39 # include <stddef.h>
40 
41 # include "DNA_object_types.h"
42 
43 # include "BLI_listbase.h"
44 # include "BLI_string_utils.h"
45 
46 # include "BKE_animsys.h"
47 # include "BKE_key.h"
48 # include "BKE_main.h"
49 
50 # include "DEG_depsgraph.h"
51 
52 # include "WM_api.h"
53 # include "WM_types.h"
54 
55 static Key *rna_ShapeKey_find_key(ID *id)
56 {
57  switch (GS(id->name)) {
58  case ID_CU_LEGACY:
59  return ((Curve *)id)->key;
60  case ID_KE:
61  return (Key *)id;
62  case ID_LT:
63  return ((Lattice *)id)->key;
64  case ID_ME:
65  return ((Mesh *)id)->key;
66  case ID_OB:
67  return BKE_key_from_object((Object *)id);
68  default:
69  return NULL;
70  }
71 }
72 
73 static void rna_ShapeKey_name_set(PointerRNA *ptr, const char *value)
74 {
75  KeyBlock *kb = ptr->data;
76  char oldname[sizeof(kb->name)];
77 
78  /* make a copy of the old name first */
79  BLI_strncpy(oldname, kb->name, sizeof(kb->name));
80 
81  /* copy the new name into the name slot */
82  BLI_strncpy_utf8(kb->name, value, sizeof(kb->name));
83 
84  /* make sure the name is truly unique */
85  if (ptr->owner_id) {
86  Key *key = rna_ShapeKey_find_key(ptr->owner_id);
87  BLI_uniquename(&key->block,
88  kb,
90  '.',
91  offsetof(KeyBlock, name),
92  sizeof(kb->name));
93  }
94 
95  /* fix all the animation data which may link to this */
96  BKE_animdata_fix_paths_rename_all(NULL, "key_blocks", oldname, kb->name);
97 }
98 
99 static float rna_ShapeKey_frame_get(PointerRNA *ptr)
100 {
101  KeyBlock *kb = (KeyBlock *)ptr->data;
102  return kb->pos * 100.0f; /* Because pos is ctime/100... */
103 }
104 
105 static void rna_ShapeKey_value_set(PointerRNA *ptr, float value)
106 {
107  KeyBlock *data = (KeyBlock *)ptr->data;
108  CLAMP(value, data->slidermin, data->slidermax);
109  data->curval = value;
110 }
111 
112 static void rna_ShapeKey_value_range(
113  PointerRNA *ptr, float *min, float *max, float *UNUSED(softmin), float *UNUSED(softmax))
114 {
115  KeyBlock *data = (KeyBlock *)ptr->data;
116 
117  *min = data->slidermin;
118  *max = data->slidermax;
119 }
120 
121 /* epsilon for how close one end of shapekey range can get to the other */
122 # define SHAPEKEY_SLIDER_TOL 0.001f
123 
124 static void rna_ShapeKey_slider_min_range(
125  PointerRNA *ptr, float *min, float *max, float *UNUSED(softmin), float *UNUSED(softmax))
126 {
127  KeyBlock *data = (KeyBlock *)ptr->data;
128 
129  *min = -10.0f;
130  *max = data->slidermax - SHAPEKEY_SLIDER_TOL;
131 }
132 
133 static void rna_ShapeKey_slider_min_set(PointerRNA *ptr, float value)
134 {
135  KeyBlock *data = (KeyBlock *)ptr->data;
136  float min, max, softmin, softmax;
137 
138  rna_ShapeKey_slider_min_range(ptr, &min, &max, &softmin, &softmax);
139  CLAMP(value, min, max);
140  data->slidermin = value;
141 }
142 
143 static void rna_ShapeKey_slider_max_range(
144  PointerRNA *ptr, float *min, float *max, float *UNUSED(softmin), float *UNUSED(softmax))
145 {
146  KeyBlock *data = (KeyBlock *)ptr->data;
147 
148  *min = data->slidermin + SHAPEKEY_SLIDER_TOL;
149  *max = 10.0f;
150 }
151 
152 static void rna_ShapeKey_slider_max_set(PointerRNA *ptr, float value)
153 {
154  KeyBlock *data = (KeyBlock *)ptr->data;
155  float min, max, softmin, softmax;
156 
157  rna_ShapeKey_slider_max_range(ptr, &min, &max, &softmin, &softmax);
158  CLAMP(value, min, max);
159  data->slidermax = value;
160 }
161 
162 # undef SHAPEKEY_SLIDER_TOL
163 
164 /* ***** Normals accessors for shape-keys. ***** */
165 /* NOTE: with this we may recompute several times the same data, should we want to access verts,
166  * then polys, then loops normals... However,
167  * such case looks rather unlikely - and not worth adding some kind of caching in key-blocks.
168  */
169 
170 static Mesh *rna_KeyBlock_normals_get_mesh(const PointerRNA *ptr, ID *id)
171 {
172  Key *key = rna_ShapeKey_find_key((id == NULL && ptr != NULL) ? ptr->owner_id : id);
173  id = key ? key->from : NULL;
174 
175  if (id != NULL) {
176  switch (GS(id->name)) {
177  case ID_ME:
178  return (Mesh *)id;
179  case ID_OB: {
180  Object *ob = (Object *)id;
181  if (ob->type == OB_MESH) {
182  return ob->data;
183  }
184  }
185  default:
186  break;
187  }
188  }
189 
190  return NULL;
191 }
192 
193 static int rna_KeyBlock_normals_vert_len(const PointerRNA *ptr,
195 {
196  const Mesh *me = rna_KeyBlock_normals_get_mesh(ptr, NULL);
197 
198  length[0] = me ? me->totvert : 0;
199  length[1] = 3;
200 
201  return (length[0] * length[1]);
202 }
203 
204 static void rna_KeyBlock_normals_vert_calc(ID *id,
205  KeyBlock *data,
206  int *normals_len,
207  float **normals)
208 {
209  Mesh *me = rna_KeyBlock_normals_get_mesh(NULL, id);
210 
211  *normals_len = (me ? me->totvert : 0) * 3;
212 
213  if (ELEM(NULL, me, data) || (me->totvert == 0)) {
214  *normals = NULL;
215  return;
216  }
217 
218  *normals = MEM_mallocN(sizeof(**normals) * (size_t)(*normals_len), __func__);
219 
220  BKE_keyblock_mesh_calc_normals(data, me, (float(*)[3])(*normals), NULL, NULL);
221 }
222 
223 static int rna_KeyBlock_normals_poly_len(const PointerRNA *ptr,
225 {
226  const Mesh *me = rna_KeyBlock_normals_get_mesh(ptr, NULL);
227 
228  length[0] = me ? me->totpoly : 0;
229  length[1] = 3;
230 
231  return (length[0] * length[1]);
232 }
233 
234 static void rna_KeyBlock_normals_poly_calc(ID *id,
235  KeyBlock *data,
236  int *normals_len,
237  float **normals)
238 {
239  Mesh *me = rna_KeyBlock_normals_get_mesh(NULL, id);
240 
241  *normals_len = (me ? me->totpoly : 0) * 3;
242 
243  if (ELEM(NULL, me, data) || (me->totpoly == 0)) {
244  *normals = NULL;
245  return;
246  }
247 
248  *normals = MEM_mallocN(sizeof(**normals) * (size_t)(*normals_len), __func__);
249 
250  BKE_keyblock_mesh_calc_normals(data, me, NULL, (float(*)[3])(*normals), NULL);
251 }
252 
253 static int rna_KeyBlock_normals_loop_len(const PointerRNA *ptr,
255 {
256  const Mesh *me = rna_KeyBlock_normals_get_mesh(ptr, NULL);
257 
258  length[0] = me ? me->totloop : 0;
259  length[1] = 3;
260 
261  return (length[0] * length[1]);
262 }
263 
264 static void rna_KeyBlock_normals_loop_calc(ID *id,
265  KeyBlock *data,
266  int *normals_len,
267  float **normals)
268 {
269  Mesh *me = rna_KeyBlock_normals_get_mesh(NULL, id);
270 
271  *normals_len = (me ? me->totloop : 0) * 3;
272 
273  if (ELEM(NULL, me, data) || (me->totloop == 0)) {
274  *normals = NULL;
275  return;
276  }
277 
278  *normals = MEM_mallocN(sizeof(**normals) * (size_t)(*normals_len), __func__);
279 
280  BKE_keyblock_mesh_calc_normals(data, me, NULL, NULL, (float(*)[3])(*normals));
281 }
282 
284 {
285  Key *key = rna_ShapeKey_find_key(id);
286  KeyBlock *kb = NULL;
287  PointerRNA ptr;
288 
289  if (key && value < key->totkey) {
290  kb = BLI_findlink(&key->block, value);
291  }
292 
293  RNA_pointer_create(id, &RNA_ShapeKey, kb, &ptr);
294 
295  return ptr;
296 }
297 
298 int rna_object_shapekey_index_set(ID *id, PointerRNA value, int current)
299 {
300  Key *key = rna_ShapeKey_find_key(id);
301 
302  if (key) {
303  int a = BLI_findindex(&key->block, value.data);
304  if (a != -1) {
305  return a;
306  }
307  }
308 
309  return current;
310 }
311 
312 static PointerRNA rna_ShapeKey_relative_key_get(PointerRNA *ptr)
313 {
314  KeyBlock *kb = (KeyBlock *)ptr->data;
315 
317 }
318 
319 static void rna_ShapeKey_relative_key_set(PointerRNA *ptr,
320  PointerRNA value,
321  struct ReportList *UNUSED(reports))
322 {
323  KeyBlock *kb = (KeyBlock *)ptr->data;
324 
326 }
327 
328 static void rna_ShapeKeyPoint_co_get(PointerRNA *ptr, float *values)
329 {
330  float *vec = (float *)ptr->data;
331 
332  values[0] = vec[0];
333  values[1] = vec[1];
334  values[2] = vec[2];
335 }
336 
337 static void rna_ShapeKeyPoint_co_set(PointerRNA *ptr, const float *values)
338 {
339  float *vec = (float *)ptr->data;
340 
341  vec[0] = values[0];
342  vec[1] = values[1];
343  vec[2] = values[2];
344 }
345 
346 static float rna_ShapeKeyCurvePoint_tilt_get(PointerRNA *ptr)
347 {
348  float *vec = (float *)ptr->data;
349  return vec[3];
350 }
351 
352 static void rna_ShapeKeyCurvePoint_tilt_set(PointerRNA *ptr, float value)
353 {
354  float *vec = (float *)ptr->data;
355  vec[3] = value;
356 }
357 
358 static float rna_ShapeKeyCurvePoint_radius_get(PointerRNA *ptr)
359 {
360  float *vec = (float *)ptr->data;
361  return vec[4];
362 }
363 
364 static void rna_ShapeKeyCurvePoint_radius_set(PointerRNA *ptr, float value)
365 {
366  float *vec = (float *)ptr->data;
367  CLAMP_MIN(value, 0.0f);
368  vec[4] = value;
369 }
370 
371 static void rna_ShapeKeyBezierPoint_co_get(PointerRNA *ptr, float *values)
372 {
373  float *vec = (float *)ptr->data;
374 
375  values[0] = vec[0 + 3];
376  values[1] = vec[1 + 3];
377  values[2] = vec[2 + 3];
378 }
379 
380 static void rna_ShapeKeyBezierPoint_co_set(PointerRNA *ptr, const float *values)
381 {
382  float *vec = (float *)ptr->data;
383 
384  vec[0 + 3] = values[0];
385  vec[1 + 3] = values[1];
386  vec[2 + 3] = values[2];
387 }
388 
389 static void rna_ShapeKeyBezierPoint_handle_1_co_get(PointerRNA *ptr, float *values)
390 {
391  float *vec = (float *)ptr->data;
392 
393  values[0] = vec[0];
394  values[1] = vec[1];
395  values[2] = vec[2];
396 }
397 
398 static void rna_ShapeKeyBezierPoint_handle_1_co_set(PointerRNA *ptr, const float *values)
399 {
400  float *vec = (float *)ptr->data;
401 
402  vec[0] = values[0];
403  vec[1] = values[1];
404  vec[2] = values[2];
405 }
406 
407 static void rna_ShapeKeyBezierPoint_handle_2_co_get(PointerRNA *ptr, float *values)
408 {
409  float *vec = (float *)ptr->data;
410 
411  values[0] = vec[6 + 0];
412  values[1] = vec[6 + 1];
413  values[2] = vec[6 + 2];
414 }
415 
416 static void rna_ShapeKeyBezierPoint_handle_2_co_set(PointerRNA *ptr, const float *values)
417 {
418  float *vec = (float *)ptr->data;
419 
420  vec[6 + 0] = values[0];
421  vec[6 + 1] = values[1];
422  vec[6 + 2] = values[2];
423 }
424 
425 static float rna_ShapeKeyBezierPoint_tilt_get(PointerRNA *ptr)
426 {
427  float *vec = (float *)ptr->data;
428  return vec[9];
429 }
430 
431 static void rna_ShapeKeyBezierPoint_tilt_set(PointerRNA *ptr, float value)
432 {
433  float *vec = (float *)ptr->data;
434  vec[9] = value;
435 }
436 
437 static float rna_ShapeKeyBezierPoint_radius_get(PointerRNA *ptr)
438 {
439  float *vec = (float *)ptr->data;
440  return vec[10];
441 }
442 
443 static void rna_ShapeKeyBezierPoint_radius_set(PointerRNA *ptr, float value)
444 {
445  float *vec = (float *)ptr->data;
446  CLAMP_MIN(value, 0.0f);
447  vec[10] = value;
448 }
449 
450 /* Indexing and iteration of Curve points through sub-curves. */
451 typedef struct NurbInfo {
452  Nurb *nu;
453  int nurb_size, nurb_elem_step;
454 
455  /* Current index in the Nurb */
456  int nurb_index;
457 
458  /* Total index as item and element. */
459  int item_index, elem_index;
460 } NurbInfo;
461 
462 StructRNA *rna_ShapeKey_curve_point_type(Nurb *nu)
463 {
464  if (nu->bezt) {
465  return &RNA_ShapeKeyBezierPoint;
466  }
467  else {
468  return &RNA_ShapeKeyCurvePoint;
469  }
470 }
471 
472 static void rna_ShapeKey_NurbInfo_init(NurbInfo *r_info, Nurb *nu)
473 {
474  r_info->nu = nu;
475 
476  if (nu->bezt) {
477  r_info->nurb_size = nu->pntsu;
478  r_info->nurb_elem_step = KEYELEM_ELEM_LEN_BEZTRIPLE;
479  }
480  else {
481  r_info->nurb_size = nu->pntsu * nu->pntsv;
482  r_info->nurb_elem_step = KEYELEM_ELEM_LEN_BPOINT;
483  }
484 }
485 
486 static void rna_ShapeKey_NurbInfo_step(NurbInfo *r_info,
487  Nurb *nu,
488  int *p_raw_index,
489  bool input_elem)
490 {
491  rna_ShapeKey_NurbInfo_init(r_info, nu);
492 
493  if (input_elem) {
494  r_info->nurb_index = MIN2(r_info->nurb_size, *p_raw_index / r_info->nurb_elem_step);
495  *p_raw_index -= r_info->nurb_size * r_info->nurb_elem_step;
496  }
497  else {
498  r_info->nurb_index = MIN2(r_info->nurb_size, *p_raw_index);
499  *p_raw_index -= r_info->nurb_size;
500  }
501 
502  r_info->item_index += r_info->nurb_index;
503  r_info->elem_index += r_info->nurb_index * r_info->nurb_elem_step;
504 }
505 
506 static void rna_ShapeKey_NurbInfo_find_index(Key *key,
507  int raw_index,
508  bool input_elem,
509  NurbInfo *r_info)
510 {
511  Curve *cu = (Curve *)key->from;
512 
513  memset(r_info, 0, sizeof(*r_info));
514 
515  for (Nurb *nu = cu->nurb.first; nu && raw_index >= 0; nu = nu->next) {
516  rna_ShapeKey_NurbInfo_step(r_info, nu, &raw_index, input_elem);
517  }
518 }
519 
520 static int rna_ShapeKey_curve_find_index(Key *key, int elem_index)
521 {
522  NurbInfo info;
523  rna_ShapeKey_NurbInfo_find_index(key, elem_index, true, &info);
524  return info.item_index;
525 }
526 
527 typedef struct ShapeKeyCurvePoint {
528  StructRNA *type;
529  void *data;
530 } ShapeKeyCurvePoint;
531 
532 /* Build a mapping array for Curve objects with mixed sub-curve types. */
533 static void rna_ShapeKey_data_begin_mixed(CollectionPropertyIterator *iter,
534  Key *key,
535  KeyBlock *kb,
536  Curve *cu)
537 {
538  int point_count = rna_ShapeKey_curve_find_index(key, kb->totelem);
539 
540  ShapeKeyCurvePoint *points = MEM_malloc_arrayN(
541  point_count, sizeof(ShapeKeyCurvePoint), __func__);
542 
543  char *databuf = kb->data;
544  int items_left = point_count;
545  NurbInfo info = {NULL};
546 
547  for (Nurb *nu = cu->nurb.first; nu && items_left > 0; nu = nu->next) {
548  ShapeKeyCurvePoint *nurb_points = points + info.item_index;
549  char *nurb_data = databuf + info.elem_index * key->elemsize;
550 
551  rna_ShapeKey_NurbInfo_step(&info, nu, &items_left, false);
552 
553  StructRNA *type = rna_ShapeKey_curve_point_type(nu);
554 
555  for (int i = 0; i < info.nurb_index; i++) {
556  nurb_points[i].type = type;
557  nurb_points[i].data = nurb_data + i * info.nurb_elem_step * key->elemsize;
558  }
559  }
560 
561  rna_iterator_array_begin(iter, points, sizeof(*points), point_count, true, NULL);
562 }
563 
564 static void rna_ShapeKey_data_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
565 {
566  Key *key = rna_ShapeKey_find_key(ptr->owner_id);
567  KeyBlock *kb = (KeyBlock *)ptr->data;
568  int tot = kb->totelem, size = key->elemsize;
569 
570  if (GS(key->from->name) == ID_CU_LEGACY && tot > 0) {
571  Curve *cu = (Curve *)key->from;
572  StructRNA *type = NULL;
573  NurbInfo info = {0};
574 
575  /* Check if all sub-curves have the same type. */
576  LISTBASE_FOREACH (Nurb *, nu, &cu->nurb) {
577  if (type == NULL) {
578  type = rna_ShapeKey_curve_point_type(nu);
579  rna_ShapeKey_NurbInfo_init(&info, nu);
580  }
581  else if (type != rna_ShapeKey_curve_point_type(nu)) {
582  type = NULL;
583  break;
584  }
585  }
586 
587  /* If types are mixed, build a mapping array. */
588  if (type == NULL) {
589  rna_ShapeKey_data_begin_mixed(iter, key, kb, cu);
590  return;
591  }
592  else {
593  tot /= info.nurb_elem_step;
594  size *= info.nurb_elem_step;
595  }
596  }
597 
598  rna_iterator_array_begin(iter, (void *)kb->data, size, tot, 0, NULL);
599 }
600 
601 static int rna_ShapeKey_data_length(PointerRNA *ptr)
602 {
603  Key *key = rna_ShapeKey_find_key(ptr->owner_id);
604  KeyBlock *kb = (KeyBlock *)ptr->data;
605  int tot = kb->totelem;
606 
607  if (GS(key->from->name) == ID_CU_LEGACY) {
608  tot = rna_ShapeKey_curve_find_index(key, tot);
609  }
610 
611  return tot;
612 }
613 
614 static PointerRNA rna_ShapeKey_data_get(CollectionPropertyIterator *iter)
615 {
616  Key *key = rna_ShapeKey_find_key(iter->parent.owner_id);
617  void *ptr = rna_iterator_array_get(iter);
618  StructRNA *type = &RNA_ShapeKeyPoint;
619 
620  /* If data_begin allocated a mapping array, access it. */
621  if (iter->internal.array.free_ptr) {
622  ShapeKeyCurvePoint *point = ptr;
623 
624  return rna_pointer_inherit_refine(&iter->parent, point->type, point->data);
625  }
626 
627  if (GS(key->from->name) == ID_CU_LEGACY) {
628  Curve *cu = (Curve *)key->from;
629 
630  type = rna_ShapeKey_curve_point_type(cu->nurb.first);
631  }
632 
633  return rna_pointer_inherit_refine(&iter->parent, type, ptr);
634 }
635 
636 int rna_ShapeKey_data_lookup_int(PointerRNA *ptr, int index, PointerRNA *r_ptr)
637 {
638  Key *key = rna_ShapeKey_find_key(ptr->owner_id);
639  KeyBlock *kb = (KeyBlock *)ptr->data;
640  int elemsize = key->elemsize;
641  char *databuf = kb->data;
642 
643  memset(r_ptr, 0, sizeof(*r_ptr));
644 
645  if (index < 0) {
646  return false;
647  }
648 
649  if (GS(key->from->name) == ID_CU_LEGACY) {
650  NurbInfo info;
651  rna_ShapeKey_NurbInfo_find_index(key, index, false, &info);
652 
653  if (info.nu && info.nurb_index < info.nurb_size) {
654  StructRNA *type = rna_ShapeKey_curve_point_type(info.nu);
655 
656  *r_ptr = rna_pointer_inherit_refine(ptr, type, databuf + elemsize * info.elem_index);
657  return true;
658  }
659  }
660  else {
661  if (index < kb->totelem) {
662  *r_ptr = rna_pointer_inherit_refine(ptr, &RNA_ShapeKeyPoint, databuf + elemsize * index);
663  return true;
664  }
665  }
666 
667  return false;
668 }
669 
670 static char *rna_ShapeKey_path(const PointerRNA *ptr)
671 {
672  const KeyBlock *kb = (KeyBlock *)ptr->data;
673  const ID *id = ptr->owner_id;
674  char name_esc[sizeof(kb->name) * 2];
675 
676  BLI_str_escape(name_esc, kb->name, sizeof(name_esc));
677 
678  if ((id) && (GS(id->name) != ID_KE)) {
679  return BLI_sprintfN("shape_keys.key_blocks[\"%s\"]", name_esc);
680  }
681  else {
682  return BLI_sprintfN("key_blocks[\"%s\"]", name_esc);
683  }
684 }
685 
686 static void rna_Key_update_data(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
687 {
688  Key *key = (Key *)ptr->owner_id;
689  Object *ob;
690 
691  for (ob = bmain->objects.first; ob; ob = ob->id.next) {
692  if (BKE_key_from_object(ob) == key) {
695  }
696  }
697 }
698 
699 static void rna_ShapeKey_update_minmax(Main *bmain, Scene *scene, PointerRNA *ptr)
700 {
701  KeyBlock *data = (KeyBlock *)ptr->data;
702  if (IN_RANGE_INCL(data->curval, data->slidermin, data->slidermax)) {
703  return;
704  }
705  CLAMP(data->curval, data->slidermin, data->slidermax);
706  rna_Key_update_data(bmain, scene, ptr);
707 }
708 
709 static KeyBlock *rna_ShapeKeyData_find_keyblock(Key *key, float *point)
710 {
711  KeyBlock *kb;
712 
713  /* sanity checks */
714  if (ELEM(NULL, key, point)) {
715  return NULL;
716  }
717 
718  /* We'll need to manually search through the key-blocks and check
719  * if the point is somewhere in the middle of each block's data. */
720  for (kb = key->block.first; kb; kb = kb->next) {
721  if (kb->data) {
722  float *start = (float *)kb->data;
723  float *end;
724 
725  /* easy cases first */
726  if ((start == NULL) || (start > point)) {
727  /* there's no chance point is in array */
728  continue;
729  }
730  else if (start == point) {
731  /* exact match - point is first in array */
732  return kb;
733  }
734 
735  /* determine where end of array is
736  * - elemsize is in bytes, so use (char *) cast to get array in terms of bytes
737  */
738  end = (float *)((char *)start + (key->elemsize * kb->totelem));
739 
740  /* If point's address is less than the end,
741  * then it is somewhere between start and end, so in array. */
742  if (end > point) {
743  /* we've found the owner of the point data */
744  return kb;
745  }
746  }
747  }
748 
749  return NULL;
750 }
751 
752 static int rna_ShapeKeyPoint_get_index(Key *key, KeyBlock *kb, float *point)
753 {
754  /* if we frame the data array and point pointers as (char *), then the difference between
755  * them will be in bytes. Thus, dividing through by key->elemsize (number of bytes per point)
756  * gives us the offset of point from start of array.
757  */
758  char *start = (char *)kb->data;
759  char *pt = (char *)point;
760 
761  return (int)(pt - start) / key->elemsize;
762 }
763 
764 static char *rna_ShapeKeyPoint_path(const PointerRNA *ptr)
765 {
766  ID *id = ptr->owner_id;
767  Key *key = rna_ShapeKey_find_key(ptr->owner_id);
768  KeyBlock *kb;
769  float *point = (float *)ptr->data;
770 
771  /* if we can get a key block, we can construct a path */
772  kb = rna_ShapeKeyData_find_keyblock(key, point);
773 
774  if (kb) {
775  char name_esc_kb[sizeof(kb->name) * 2];
776  int index;
777 
778  index = rna_ShapeKeyPoint_get_index(key, kb, point);
779 
780  if (ELEM(ptr->type, &RNA_ShapeKeyBezierPoint, &RNA_ShapeKeyCurvePoint)) {
781  index = rna_ShapeKey_curve_find_index(key, index);
782  }
783 
784  BLI_str_escape(name_esc_kb, kb->name, sizeof(name_esc_kb));
785 
786  if (GS(id->name) == ID_KE) {
787  return BLI_sprintfN("key_blocks[\"%s\"].data[%d]", name_esc_kb, index);
788  }
789  else {
790  return BLI_sprintfN("shape_keys.key_blocks[\"%s\"].data[%d]", name_esc_kb, index);
791  }
792  }
793  else {
794  return NULL; /* XXX: there's really no way to resolve this... */
795  }
796 }
797 
798 #else
799 
800 static const float tilt_limit = DEG2RADF(21600.0f);
801 
802 static void rna_def_keydata(BlenderRNA *brna)
803 {
804  StructRNA *srna;
805  PropertyRNA *prop;
806 
807  srna = RNA_def_struct(brna, "ShapeKeyPoint", NULL);
808  RNA_def_struct_ui_text(srna, "Shape Key Point", "Point in a shape key");
809  RNA_def_struct_path_func(srna, "rna_ShapeKeyPoint_path");
810 
811  prop = RNA_def_property(srna, "co", PROP_FLOAT, PROP_TRANSLATION);
812  RNA_def_property_array(prop, 3);
813  RNA_def_property_float_funcs(prop, "rna_ShapeKeyPoint_co_get", "rna_ShapeKeyPoint_co_set", NULL);
814  RNA_def_property_ui_text(prop, "Location", "");
815  RNA_def_property_update(prop, 0, "rna_Key_update_data");
816 
817  srna = RNA_def_struct(brna, "ShapeKeyCurvePoint", NULL);
818  RNA_def_struct_ui_text(srna, "Shape Key Curve Point", "Point in a shape key for curves");
819  /* there's nothing type specific here, so this is fine for now */
820  RNA_def_struct_path_func(srna, "rna_ShapeKeyPoint_path");
821 
822  prop = RNA_def_property(srna, "co", PROP_FLOAT, PROP_TRANSLATION);
823  RNA_def_property_array(prop, 3);
824  RNA_def_property_float_funcs(prop, "rna_ShapeKeyPoint_co_get", "rna_ShapeKeyPoint_co_set", NULL);
825  RNA_def_property_ui_text(prop, "Location", "");
826  RNA_def_property_update(prop, 0, "rna_Key_update_data");
827 
828  prop = RNA_def_property(srna, "tilt", PROP_FLOAT, PROP_ANGLE);
830  prop, "rna_ShapeKeyCurvePoint_tilt_get", "rna_ShapeKeyCurvePoint_tilt_set", NULL);
833  RNA_def_property_ui_text(prop, "Tilt", "Tilt in 3D View");
834  RNA_def_property_update(prop, 0, "rna_Key_update_data");
835 
836  prop = RNA_def_property(srna, "radius", PROP_FLOAT, PROP_NONE);
838  prop, "rna_ShapeKeyCurvePoint_radius_get", "rna_ShapeKeyCurvePoint_radius_set", NULL);
839  RNA_def_property_range(prop, 0.0f, FLT_MAX);
840  RNA_def_property_ui_text(prop, "Radius", "Radius for beveling");
841  RNA_def_property_update(prop, 0, "rna_Key_update_data");
842 
843  srna = RNA_def_struct(brna, "ShapeKeyBezierPoint", NULL);
844  RNA_def_struct_ui_text(srna, "Shape Key Bezier Point", "Point in a shape key for Bezier curves");
845  /* there's nothing type specific here, so this is fine for now */
846  RNA_def_struct_path_func(srna, "rna_ShapeKeyPoint_path");
847 
848  prop = RNA_def_property(srna, "co", PROP_FLOAT, PROP_TRANSLATION);
849  RNA_def_property_array(prop, 3);
851  prop, "rna_ShapeKeyBezierPoint_co_get", "rna_ShapeKeyBezierPoint_co_set", NULL);
852  RNA_def_property_ui_text(prop, "Location", "");
853  RNA_def_property_update(prop, 0, "rna_Key_update_data");
854 
855  prop = RNA_def_property(srna, "handle_left", PROP_FLOAT, PROP_TRANSLATION);
856  RNA_def_property_array(prop, 3);
858  "rna_ShapeKeyBezierPoint_handle_1_co_get",
859  "rna_ShapeKeyBezierPoint_handle_1_co_set",
860  NULL);
861  RNA_def_property_ui_text(prop, "Handle 1 Location", "");
862  RNA_def_property_update(prop, 0, "rna_Key_update_data");
863 
864  prop = RNA_def_property(srna, "handle_right", PROP_FLOAT, PROP_TRANSLATION);
865  RNA_def_property_array(prop, 3);
867  "rna_ShapeKeyBezierPoint_handle_2_co_get",
868  "rna_ShapeKeyBezierPoint_handle_2_co_set",
869  NULL);
870  RNA_def_property_ui_text(prop, "Handle 2 Location", "");
871  RNA_def_property_update(prop, 0, "rna_Key_update_data");
872 
873  prop = RNA_def_property(srna, "tilt", PROP_FLOAT, PROP_ANGLE);
875  prop, "rna_ShapeKeyBezierPoint_tilt_get", "rna_ShapeKeyBezierPoint_tilt_set", NULL);
878  RNA_def_property_ui_text(prop, "Tilt", "Tilt in 3D View");
879  RNA_def_property_update(prop, 0, "rna_Key_update_data");
880 
881  prop = RNA_def_property(srna, "radius", PROP_FLOAT, PROP_NONE);
883  prop, "rna_ShapeKeyBezierPoint_radius_get", "rna_ShapeKeyBezierPoint_radius_set", NULL);
884  RNA_def_property_range(prop, 0.0f, FLT_MAX);
885  RNA_def_property_ui_text(prop, "Radius", "Radius for beveling");
886  RNA_def_property_update(prop, 0, "rna_Key_update_data");
887 }
888 
889 static void rna_def_keyblock(BlenderRNA *brna)
890 {
891  StructRNA *srna;
892  PropertyRNA *prop, *parm;
893  FunctionRNA *func;
894 
895  srna = RNA_def_struct(brna, "ShapeKey", NULL);
896  RNA_def_struct_ui_text(srna, "Shape Key", "Shape key in a shape keys data-block");
897  RNA_def_struct_sdna(srna, "KeyBlock");
898  RNA_def_struct_path_func(srna, "rna_ShapeKey_path");
899  RNA_def_struct_ui_icon(srna, ICON_SHAPEKEY_DATA);
900 
901  prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
902  RNA_def_property_ui_text(prop, "Name", "Name of Shape Key");
903  RNA_def_property_string_funcs(prop, NULL, NULL, "rna_ShapeKey_name_set");
904  RNA_def_property_update(prop, 0, "rna_Key_update_data");
905  RNA_def_struct_name_property(srna, prop);
906 
907  /* keys need to be sorted to edit this */
908  prop = RNA_def_property(srna, "frame", PROP_FLOAT, PROP_TIME);
910  RNA_def_property_float_sdna(prop, NULL, "pos");
911  RNA_def_property_float_funcs(prop, "rna_ShapeKey_frame_get", NULL, NULL);
912  RNA_def_property_ui_text(prop, "Frame", "Frame for absolute keys");
913  RNA_def_property_update(prop, 0, "rna_Key_update_data");
914 
915  /* for now, this is editable directly, as users can set this even if they're not animating them
916  * (to test results) */
917  prop = RNA_def_property(srna, "value", PROP_FLOAT, PROP_FACTOR);
918  RNA_def_property_float_sdna(prop, NULL, "curval");
920  RNA_def_property_float_funcs(prop, NULL, "rna_ShapeKey_value_set", "rna_ShapeKey_value_range");
921  RNA_def_property_ui_range(prop, -10.0f, 10.0f, 10, 3);
922  RNA_def_property_ui_text(prop, "Value", "Value of shape key at the current frame");
923  RNA_def_property_update(prop, 0, "rna_Key_update_data");
924 
925  prop = RNA_def_property(srna, "interpolation", PROP_ENUM, PROP_NONE);
926  RNA_def_property_enum_sdna(prop, NULL, "type");
928  RNA_def_property_ui_text(prop, "Interpolation", "Interpolation type for absolute shape keys");
929  RNA_def_property_update(prop, 0, "rna_Key_update_data");
930 
931  prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
932  RNA_def_property_string_sdna(prop, NULL, "vgroup");
933  RNA_def_property_ui_text(prop, "Vertex Group", "Vertex weight group, to blend with basis shape");
934  RNA_def_property_update(prop, 0, "rna_Key_update_data");
935 
936  prop = RNA_def_property(srna, "relative_key", PROP_POINTER, PROP_NONE);
937  RNA_def_property_struct_type(prop, "ShapeKey");
940  prop, "rna_ShapeKey_relative_key_get", "rna_ShapeKey_relative_key_set", NULL, NULL);
941  RNA_def_property_ui_text(prop, "Relative Key", "Shape used as a relative key");
942  RNA_def_property_update(prop, 0, "rna_Key_update_data");
943 
944  prop = RNA_def_property(srna, "mute", PROP_BOOLEAN, PROP_NONE);
947  RNA_def_property_ui_text(prop, "Mute", "Toggle this shape key");
948  RNA_def_property_ui_icon(prop, ICON_CHECKBOX_HLT, -1);
949  RNA_def_property_update(prop, 0, "rna_Key_update_data");
950 
951  prop = RNA_def_property(srna, "slider_min", PROP_FLOAT, PROP_NONE);
952  RNA_def_property_float_sdna(prop, NULL, "slidermin");
953  RNA_def_property_range(prop, -10.0f, 10.0f);
955  prop, NULL, "rna_ShapeKey_slider_min_set", "rna_ShapeKey_slider_min_range");
956  RNA_def_property_ui_text(prop, "Slider Min", "Minimum for slider");
957  RNA_def_property_update(prop, 0, "rna_ShapeKey_update_minmax");
958 
959  prop = RNA_def_property(srna, "slider_max", PROP_FLOAT, PROP_NONE);
960  RNA_def_property_float_sdna(prop, NULL, "slidermax");
961  RNA_def_property_range(prop, -10.0f, 10.0f);
962  RNA_def_property_float_default(prop, 1.0f);
964  prop, NULL, "rna_ShapeKey_slider_max_set", "rna_ShapeKey_slider_max_range");
965  RNA_def_property_ui_text(prop, "Slider Max", "Maximum for slider");
966  RNA_def_property_update(prop, 0, "rna_ShapeKey_update_minmax");
967 
968  prop = RNA_def_property(srna, "data", PROP_COLLECTION, PROP_NONE);
969  RNA_def_property_collection_sdna(prop, NULL, "data", "totelem");
970  RNA_def_property_struct_type(prop, "UnknownType");
972  RNA_def_property_ui_text(prop, "Data", "");
974  "rna_ShapeKey_data_begin",
975  NULL,
976  NULL,
977  "rna_ShapeKey_data_get",
978  "rna_ShapeKey_data_length",
979  "rna_ShapeKey_data_lookup_int",
980  NULL,
981  NULL);
982 
983  /* XXX multi-dim dynamic arrays are very badly supported by (py)rna currently,
984  * those are defined for the day it works better, for now user will get a 1D tuple.
985  */
986  func = RNA_def_function(srna, "normals_vertex_get", "rna_KeyBlock_normals_vert_calc");
988  "Compute local space vertices' normals for this shape key");
990  parm = RNA_def_property(func, "normals", PROP_FLOAT, /* PROP_DIRECTION */ PROP_NONE);
993  RNA_def_property_range(parm, -1.0f, 1.0f);
994  RNA_def_property_dynamic_array_funcs(parm, "rna_KeyBlock_normals_vert_len");
995 
996  func = RNA_def_function(srna, "normals_polygon_get", "rna_KeyBlock_normals_poly_calc");
997  RNA_def_function_ui_description(func, "Compute local space faces' normals for this shape key");
999  parm = RNA_def_property(func, "normals", PROP_FLOAT, /* PROP_DIRECTION */ PROP_NONE);
1002  RNA_def_property_range(parm, -1.0f, 1.0f);
1003  RNA_def_property_dynamic_array_funcs(parm, "rna_KeyBlock_normals_poly_len");
1004 
1005  func = RNA_def_function(srna, "normals_split_get", "rna_KeyBlock_normals_loop_calc");
1007  "Compute local space face corners' normals for this shape key");
1009  parm = RNA_def_property(func, "normals", PROP_FLOAT, /* PROP_DIRECTION */ PROP_NONE);
1012  RNA_def_property_range(parm, -1.0f, 1.0f);
1013  RNA_def_property_dynamic_array_funcs(parm, "rna_KeyBlock_normals_loop_len");
1014 }
1015 
1016 static void rna_def_key(BlenderRNA *brna)
1017 {
1018  StructRNA *srna;
1019  PropertyRNA *prop;
1020 
1021  srna = RNA_def_struct(brna, "Key", "ID");
1023  srna, "Key", "Shape keys data-block containing different shapes of geometric data-blocks");
1024  RNA_def_struct_ui_icon(srna, ICON_SHAPEKEY_DATA);
1025 
1026  prop = RNA_def_property(srna, "reference_key", PROP_POINTER, PROP_NONE);
1029  RNA_def_property_pointer_sdna(prop, NULL, "refkey");
1030  RNA_def_property_ui_text(prop, "Reference Key", "");
1031 
1032  prop = RNA_def_property(srna, "key_blocks", PROP_COLLECTION, PROP_NONE);
1033  RNA_def_property_collection_sdna(prop, NULL, "block", NULL);
1035  RNA_def_property_struct_type(prop, "ShapeKey");
1036  RNA_def_property_ui_text(prop, "Key Blocks", "Shape keys");
1037 
1039 
1040  prop = RNA_def_property(srna, "user", PROP_POINTER, PROP_NONE);
1043  RNA_def_property_pointer_sdna(prop, NULL, "from");
1044  RNA_def_property_ui_text(prop, "User", "Data-block using these shape keys");
1045 
1046  prop = RNA_def_property(srna, "use_relative", PROP_BOOLEAN, PROP_NONE);
1049  prop,
1050  "Relative",
1051  "Make shape keys relative, "
1052  "otherwise play through shapes as a sequence using the evaluation time");
1053  RNA_def_property_update(prop, 0, "rna_Key_update_data");
1054 
1055  prop = RNA_def_property(srna, "eval_time", PROP_FLOAT, PROP_NONE);
1056  RNA_def_property_float_sdna(prop, NULL, "ctime");
1059  RNA_def_property_ui_text(prop, "Evaluation Time", "Evaluation time for absolute shape keys");
1060  RNA_def_property_update(prop, 0, "rna_Key_update_data");
1061 }
1062 
1064 {
1065  rna_def_key(brna);
1066  rna_def_keyblock(brna);
1067  rna_def_keydata(brna);
1068 }
1069 
1070 #endif
void BKE_animdata_fix_paths_rename_all(struct ID *ref_id, const char *prefix, const char *oldName, const char *newName)
Definition: anim_data.c:1287
void BKE_keyblock_mesh_calc_normals(const struct KeyBlock *kb, const struct Mesh *mesh, float(*r_vertnors)[3], float(*r_polynors)[3], float(*r_loopnors)[3])
struct Key * BKE_key_from_object(struct Object *ob)
Definition: key.c:1803
#define LISTBASE_FOREACH(type, var, list)
Definition: BLI_listbase.h:336
int BLI_findindex(const struct ListBase *listbase, const void *vlink) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
void * BLI_findlink(const struct ListBase *listbase, int number) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
#define DEG2RADF(_deg)
size_t size_t char * BLI_sprintfN(const char *__restrict format,...) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1) ATTR_MALLOC ATTR_PRINTF_FORMAT(1
char * BLI_strncpy(char *__restrict dst, const char *__restrict src, size_t maxncpy) ATTR_NONNULL()
Definition: string.c:64
size_t size_t char size_t BLI_str_escape(char *__restrict dst, const char *__restrict src, size_t dst_maxncpy) ATTR_NONNULL()
Definition: string.c:250
char * BLI_strncpy_utf8(char *__restrict dst, const char *__restrict src, size_t maxncpy) ATTR_NONNULL(1
bool BLI_uniquename(struct ListBase *list, void *vlink, const char *defname, char delim, int name_offset, size_t name_len)
Definition: string_utils.c:309
#define UNUSED(x)
#define ELEM(...)
#define MIN2(a, b)
#define IN_RANGE_INCL(a, b, c)
#define CLAMP_MIN(a, b)
#define BLT_I18NCONTEXT_ID_SHAPEKEY
#define CTX_DATA_(context, msgid)
void DEG_id_tag_update(struct ID *id, int flag)
ID and Library types, which are fundamental for sdna.
@ ID_RECALC_GEOMETRY
Definition: DNA_ID.h:791
@ ID_KE
Definition: DNA_ID_enums.h:58
@ ID_CU_LEGACY
Definition: DNA_ID_enums.h:49
@ ID_ME
Definition: DNA_ID_enums.h:48
@ ID_LT
Definition: DNA_ID_enums.h:54
@ ID_OB
Definition: DNA_ID_enums.h:47
@ KEYBLOCK_MUTE
@ KEY_LINEAR
@ KEY_CARDINAL
@ KEY_BSPLINE
@ KEY_CATMULL_ROM
#define KEYELEM_ELEM_LEN_BPOINT
@ KEY_RELATIVE
#define KEYELEM_ELEM_LEN_BEZTRIPLE
Object is a sort of wrapper for general info.
@ OB_MESH
#define MINFRAME
#define MAXFRAME
_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.
Group Output data from inside of a node group A color picker Mix two input colors RGB to Convert a color s luminance to a grayscale value Generate a normal vector and a dot product Bright Control the brightness and contrast of the input color Vector Map an input vectors to used to fine tune the interpolation of the input Camera Retrieve information about the camera and how it relates to the current shading point s position CLAMP
in reality light always falls off quadratically Particle Retrieve the data of the particle that spawned the object for example to give variation to multiple instances of an object Point Retrieve information about points in a point cloud Retrieve the edges of an object as it appears to Cycles topology will always appear triangulated Convert a blackbody temperature to an RGB value Normal Generate a perturbed normal from an RGB normal map image Typically used for faking highly detailed surfaces Generate an OSL shader from a file or text data block Image Sample an image file as a texture Sky Generate a procedural sky texture Noise Generate fractal Perlin noise Wave Generate procedural bands or rings with noise Voronoi Generate Worley noise based on the distance to random points Typically used to generate textures such as or biological cells Brick Generate a procedural texture producing bricks Texture Retrieve multiple types of texture coordinates nTypically used as inputs for texture nodes Vector Convert a point
#define RNA_MAX_ARRAY_DIMENSION
Definition: RNA_define.h:28
@ PARM_OUTPUT
Definition: RNA_types.h:353
@ FUNC_USE_SELF_ID
Definition: RNA_types.h:650
@ PROP_FLOAT
Definition: RNA_types.h:61
@ PROP_BOOLEAN
Definition: RNA_types.h:59
@ PROP_ENUM
Definition: RNA_types.h:63
@ PROP_STRING
Definition: RNA_types.h:62
@ PROP_POINTER
Definition: RNA_types.h:64
@ PROP_COLLECTION
Definition: RNA_types.h:65
@ PROPOVERRIDE_OVERRIDABLE_LIBRARY
Definition: RNA_types.h:312
@ PROPOVERRIDE_NO_COMPARISON
Definition: RNA_types.h:320
@ PROPOVERRIDE_IGNORE
Definition: RNA_types.h:332
@ PROP_DYNAMIC
Definition: RNA_types.h:290
@ PROP_EDITABLE
Definition: RNA_types.h:189
@ PROP_NEVER_NULL
Definition: RNA_types.h:239
@ PROP_PTR_NO_OWNERSHIP
Definition: RNA_types.h:257
@ PROP_TIME
Definition: RNA_types.h:146
@ PROP_ANGLE
Definition: RNA_types.h:145
@ PROP_NONE
Definition: RNA_types.h:126
@ PROP_FACTOR
Definition: RNA_types.h:144
@ PROP_TRANSLATION
Definition: RNA_types.h:154
#define ND_MODIFIER
Definition: WM_types.h:411
#define NC_OBJECT
Definition: WM_types.h:329
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
Definition: btDbvt.cpp:52
Scene scene
#define GS(x)
Definition: iris.c:225
void *(* MEM_malloc_arrayN)(size_t len, size_t size, const char *str)
Definition: mallocn.c:34
void *(* MEM_mallocN)(size_t len, const char *str)
Definition: mallocn.c:33
static unsigned a[3]
Definition: RandGen.cpp:78
T length(const vec_base< T, Size > &a)
MutableSpan< float3 > normals
void RNA_pointer_create(ID *id, StructRNA *type, void *data, PointerRNA *r_ptr)
Definition: rna_access.c:136
void rna_iterator_array_begin(CollectionPropertyIterator *iter, void *ptr, int itemsize, int length, bool free_ptr, IteratorSkipFunc skip)
Definition: rna_access.c:4781
void * rna_iterator_array_get(CollectionPropertyIterator *iter)
Definition: rna_access.c:4829
PointerRNA rna_pointer_inherit_refine(PointerRNA *ptr, StructRNA *type, void *data)
Definition: rna_access.c:186
void rna_def_animdata_common(StructRNA *srna)
void RNA_def_property_pointer_sdna(PropertyRNA *prop, const char *structname, const char *propname)
Definition: rna_define.c:2740
void RNA_def_struct_path_func(StructRNA *srna, const char *path)
Definition: rna_define.c:1193
void RNA_def_property_boolean_sdna(PropertyRNA *prop, const char *structname, const char *propname, int64_t bit)
Definition: rna_define.c:2236
void RNA_def_property_string_funcs(PropertyRNA *prop, const char *get, const char *length, const char *set)
Definition: rna_define.c:3285
void RNA_def_property_float_default(PropertyRNA *prop, float value)
Definition: rna_define.c:2022
void RNA_def_property_float_funcs(PropertyRNA *prop, const char *get, const char *set, const char *range)
Definition: rna_define.c:3126
void RNA_def_property_ui_text(PropertyRNA *prop, const char *name, const char *description)
Definition: rna_define.c:1645
void RNA_def_property_string_sdna(PropertyRNA *prop, const char *structname, const char *propname)
Definition: rna_define.c:2695
void RNA_def_property_ui_icon(PropertyRNA *prop, int icon, int consecutive)
Definition: rna_define.c:1653
FunctionRNA * RNA_def_function(StructRNA *srna, const char *identifier, const char *call)
Definition: rna_define.c:4273
void RNA_def_property_collection_funcs(PropertyRNA *prop, const char *begin, const char *next, const char *end, const char *get, const char *length, const char *lookupint, const char *lookupstring, const char *assignint)
Definition: rna_define.c:3420
void RNA_def_struct_ui_text(StructRNA *srna, const char *name, const char *description)
Definition: rna_define.c:1237
void RNA_def_property_dynamic_array_funcs(PropertyRNA *prop, const char *getlength)
Definition: rna_define.c:2926
void RNA_def_property_multi_array(PropertyRNA *prop, int dimension, const int length[])
Definition: rna_define.c:1598
void RNA_def_property_enum_items(PropertyRNA *prop, const EnumPropertyItem *item)
Definition: rna_define.c:1872
void RNA_def_struct_sdna(StructRNA *srna, const char *structname)
Definition: rna_define.c:1048
void RNA_def_property_array(PropertyRNA *prop, int length)
Definition: rna_define.c:1539
void RNA_def_property_range(PropertyRNA *prop, double min, double max)
Definition: rna_define.c:1737
void RNA_def_property_struct_type(PropertyRNA *prop, const char *type)
Definition: rna_define.c:1772
void RNA_def_property_collection_sdna(PropertyRNA *prop, const char *structname, const char *propname, const char *lengthpropname)
Definition: rna_define.c:2769
void RNA_def_function_ui_description(FunctionRNA *func, const char *description)
Definition: rna_define.c:4347
void RNA_def_property_update(PropertyRNA *prop, int noteflag, const char *func)
Definition: rna_define.c:2900
PropertyRNA * RNA_def_property(StructOrFunctionRNA *cont_, const char *identifier, int type, int subtype)
Definition: rna_define.c:1257
void RNA_def_struct_name_property(struct StructRNA *srna, struct PropertyRNA *prop)
Definition: rna_define.c:1103
void RNA_def_function_flag(FunctionRNA *func, int flag)
Definition: rna_define.c:4342
void RNA_def_property_clear_flag(PropertyRNA *prop, PropertyFlag flag)
Definition: rna_define.c:1495
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:3385
StructRNA * RNA_def_struct(BlenderRNA *brna, const char *identifier, const char *from)
Definition: rna_define.c:1028
void RNA_def_property_enum_sdna(PropertyRNA *prop, const char *structname, const char *propname)
Definition: rna_define.c:2601
void RNA_def_struct_ui_icon(StructRNA *srna, int icon)
Definition: rna_define.c:1245
void RNA_def_property_flag(PropertyRNA *prop, PropertyFlag flag)
Definition: rna_define.c:1490
void RNA_def_property_float_sdna(PropertyRNA *prop, const char *structname, const char *propname)
Definition: rna_define.c:2493
void RNA_def_property_ui_range(PropertyRNA *prop, double min, double max, double step, int precision)
Definition: rna_define.c:1664
void RNA_def_property_override_flag(PropertyRNA *prop, PropertyOverrideFlag flag)
Definition: rna_define.c:1503
void RNA_def_parameter_flags(PropertyRNA *prop, PropertyFlag flag_property, ParameterFlag flag_parameter)
Definition: rna_define.c:1518
int rna_object_shapekey_index_set(struct ID *id, PointerRNA value, int current)
PointerRNA rna_object_shapekey_index_get(struct ID *id, int value)
static void rna_def_keyblock(BlenderRNA *brna)
Definition: rna_key.c:889
static void rna_def_keydata(BlenderRNA *brna)
Definition: rna_key.c:802
static void rna_def_key(BlenderRNA *brna)
Definition: rna_key.c:1016
static const float tilt_limit
Definition: rna_key.c:800
const EnumPropertyItem rna_enum_keyblock_type_items[]
Definition: rna_key.c:29
void RNA_def_key(BlenderRNA *brna)
Definition: rna_key.c:1063
#define min(a, b)
Definition: sort.c:35
void * free_ptr
Definition: RNA_types.h:380
union CollectionPropertyIterator::@1147 internal
ListBase nurb
Definition: DNA_ID.h:368
char name[66]
Definition: DNA_ID.h:378
char name[64]
Definition: DNA_key_types.h:52
float pos
Definition: DNA_key_types.h:32
struct KeyBlock * next
Definition: DNA_key_types.h:25
short relative
Definition: DNA_key_types.h:41
void * data
Definition: DNA_key_types.h:50
ID * from
Definition: DNA_key_types.h:88
int elemsize
Definition: DNA_key_types.h:80
ListBase block
Definition: DNA_key_types.h:84
void * first
Definition: DNA_listBase.h:31
Definition: BKE_main.h:121
ListBase objects
Definition: BKE_main.h:170
int totvert
int totpoly
int totloop
struct Nurb * next
BezTriple * bezt
void * data
struct StructRNA * type
Definition: RNA_types.h:37
void * data
Definition: RNA_types.h:38
struct ID * owner_id
Definition: RNA_types.h:36
float max
void WM_main_add_notifier(unsigned int type, void *reference)
PointerRNA * ptr
Definition: wm_files.c:3480