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