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