Blender V5.0
rna_object_api.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2009 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
8
9#include <cstdlib>
10#include <cstring>
11#include <ctime>
12
13#include "BLI_kdopbvh.hh"
14#include "BLI_math_geom.h"
15
16#include "RNA_define.hh"
17
19#include "DNA_modifier_types.h"
20
21#include "ED_outliner.hh"
22
23#include "rna_internal.hh" /* own include */
24
25#define MESH_DM_INFO_STR_MAX 16384
26
27static const EnumPropertyItem space_items[] = {
28 {CONSTRAINT_SPACE_WORLD, "WORLD", 0, "World Space", "The most global space in Blender"},
30 "POSE",
31 0,
32 "Pose Space",
33 "The pose space of a bone (its armature's object space)"},
35 "LOCAL_WITH_PARENT",
36 0,
37 "Local With Parent",
38 "The rest pose local space of a bone (this matrix includes parent transforms)"},
39 {CONSTRAINT_SPACE_LOCAL, "LOCAL", 0, "Local Space", "The local space of an object/bone"},
40 {0, nullptr, 0, nullptr, nullptr},
41};
42
43#ifdef RNA_RUNTIME
44
45# include "BKE_bvhutils.hh"
46# include "BKE_constraint.h"
47# include "BKE_context.hh"
48# include "BKE_crazyspace.hh"
49# include "BKE_customdata.hh"
50# include "BKE_global.hh"
51# include "BKE_layer.hh"
52# include "BKE_main.hh"
53# include "BKE_mball.hh"
54# include "BKE_mesh.hh"
55# include "BKE_mesh_runtime.hh"
56# include "BKE_modifier.hh"
57# include "BKE_object.hh"
58# include "BKE_object_types.hh"
59# include "BKE_report.hh"
60# include "BKE_vfont.hh"
61
62# include "ED_object.hh"
63# include "ED_screen.hh"
64
65# include "DNA_curve_types.h"
66# include "DNA_mesh_types.h"
67# include "DNA_scene_types.h"
68# include "DNA_view3d_types.h"
69
70# include "DEG_depsgraph_query.hh"
71
72# include "MEM_guardedalloc.h"
73
74static Base *find_view_layer_base_with_synced_ensure(
75 Object *ob, bContext *C, PointerRNA *view_layer_ptr, Scene **r_scene, ViewLayer **r_view_layer)
76{
77 Scene *scene;
78 ViewLayer *view_layer;
79 if (view_layer_ptr->data) {
80 scene = (Scene *)view_layer_ptr->owner_id;
81 view_layer = static_cast<ViewLayer *>(view_layer_ptr->data);
82 }
83 else {
84 scene = CTX_data_scene(C);
85 view_layer = CTX_data_view_layer(C);
86 }
87 if (r_scene != nullptr) {
88 *r_scene = scene;
89 }
90 if (r_view_layer != nullptr) {
91 *r_view_layer = view_layer;
92 }
93
94 BKE_view_layer_synced_ensure(scene, view_layer);
95 return BKE_view_layer_base_find(view_layer, ob);
96}
97
98static void rna_Object_select_set(
99 Object *ob, bContext *C, ReportList *reports, bool select, PointerRNA *view_layer_ptr)
100{
101 Scene *scene;
102 ViewLayer *view_layer;
103 Base *base = find_view_layer_base_with_synced_ensure(ob, C, view_layer_ptr, &scene, &view_layer);
104
105 if (!base) {
106 if (select) {
107 BKE_reportf(reports,
108 RPT_ERROR,
109 "Object '%s' cannot be selected because it is not in View Layer '%s'!",
110 ob->id.name + 2,
111 view_layer->name);
112 }
113 return;
114 }
115
118
122}
123
124static bool rna_Object_select_get(Object *ob, bContext *C, PointerRNA *view_layer_ptr)
125{
126 Base *base = find_view_layer_base_with_synced_ensure(ob, C, view_layer_ptr, nullptr, nullptr);
127 if (!base) {
128 return false;
129 }
130
131 return ((base->flag & BASE_SELECTED) != 0);
132}
133
134static void rna_Object_hide_set(
135 Object *ob, bContext *C, ReportList *reports, bool hide, PointerRNA *view_layer_ptr)
136{
137 Scene *scene;
138 ViewLayer *view_layer;
139 Base *base = find_view_layer_base_with_synced_ensure(ob, C, view_layer_ptr, &scene, &view_layer);
140 if (!base) {
141 if (hide) {
142 BKE_reportf(reports,
143 RPT_ERROR,
144 "Object '%s' cannot be hidden because it is not in View Layer '%s'!",
145 ob->id.name + 2,
146 view_layer->name);
147 }
148 return;
149 }
150
151 if (hide) {
152 base->flag |= BASE_HIDDEN;
153 }
154 else {
155 base->flag &= ~BASE_HIDDEN;
156 }
157
161}
162
163static bool rna_Object_hide_get(Object *ob, bContext *C, PointerRNA *view_layer_ptr)
164{
165 Base *base = find_view_layer_base_with_synced_ensure(ob, C, view_layer_ptr, nullptr, nullptr);
166 if (!base) {
167 return false;
168 }
169
170 return ((base->flag & BASE_HIDDEN) != 0);
171}
172
173static bool rna_Object_visible_get(Object *ob,
174 bContext *C,
175 PointerRNA *view_layer_ptr,
176 View3D *v3d)
177{
178 Base *base = find_view_layer_base_with_synced_ensure(ob, C, view_layer_ptr, nullptr, nullptr);
179 if (v3d == nullptr) {
180 v3d = CTX_wm_view3d(C);
181 }
182
183 if (!base) {
184 return false;
185 }
186
187 return BASE_VISIBLE(v3d, base);
188}
189
190static bool rna_Object_holdout_get(Object *ob, bContext *C, PointerRNA *view_layer_ptr)
191{
192 Base *base = find_view_layer_base_with_synced_ensure(ob, C, view_layer_ptr, nullptr, nullptr);
193 if (!base) {
194 return false;
195 }
196
197 return ((base->flag & BASE_HOLDOUT) != 0) || ((ob->visibility_flag & OB_HOLDOUT) != 0);
198}
199
200static bool rna_Object_indirect_only_get(Object *ob, bContext *C, PointerRNA *view_layer_ptr)
201{
202 Base *base = find_view_layer_base_with_synced_ensure(ob, C, view_layer_ptr, nullptr, nullptr);
203 if (!base) {
204 return false;
205 }
206
207 return ((base->flag & BASE_INDIRECT_ONLY) != 0);
208}
209
210static Base *rna_Object_local_view_property_helper(bScreen *screen,
211 View3D *v3d,
212 ViewLayer *view_layer,
213 Object *ob,
214 ReportList *reports,
215 Scene **r_scene)
216{
217 wmWindow *win = nullptr;
218 if (v3d->localvd == nullptr) {
219 BKE_report(reports, RPT_ERROR, "Viewport not in local view");
220 return nullptr;
221 }
222
223 if (view_layer == nullptr) {
224 win = ED_screen_window_find(screen, static_cast<wmWindowManager *>(G_MAIN->wm.first));
225 view_layer = WM_window_get_active_view_layer(win);
226 }
227
228 BKE_view_layer_synced_ensure(win ? WM_window_get_active_scene(win) : nullptr, view_layer);
229 Base *base = BKE_view_layer_base_find(view_layer, ob);
230 if (base == nullptr) {
232 reports, RPT_WARNING, "Object %s not in view layer %s", ob->id.name + 2, view_layer->name);
233 }
234 if (r_scene != nullptr && win != nullptr) {
235 *r_scene = win->scene;
236 }
237 return base;
238}
239
240static bool rna_Object_local_view_get(Object *ob, ReportList *reports, View3D *v3d)
241{
242 if (v3d->localvd == nullptr) {
243 BKE_report(reports, RPT_ERROR, "Viewport not in local view");
244 return false;
245 }
246
247 return ((ob->base_local_view_bits & v3d->local_view_uid) != 0);
248}
249
250static void rna_Object_local_view_set(Object *ob,
251 ReportList *reports,
252 PointerRNA *v3d_ptr,
253 bool state)
254{
255 bScreen *screen = (bScreen *)v3d_ptr->owner_id;
256 View3D *v3d = static_cast<View3D *>(v3d_ptr->data);
257 Scene *scene;
258 Base *base = rna_Object_local_view_property_helper(screen, v3d, nullptr, ob, reports, &scene);
259 if (base == nullptr) {
260 return; /* Error reported. */
261 }
262 const short local_view_bits_prev = base->local_view_bits;
264 if (local_view_bits_prev != base->local_view_bits) {
266 ScrArea *area = ED_screen_area_find_with_spacedata(screen, (SpaceLink *)v3d, true);
267 if (area) {
268 ED_area_tag_redraw(area);
269 }
270 }
271}
272
273static bool rna_Object_visible_in_viewport_get(Object *ob, View3D *v3d)
274{
275 return BKE_object_is_visible_in_viewport(v3d, ob);
276}
277
278/* Convert a given matrix from a space to another (using the object and/or a bone as
279 * reference). */
280static void rna_Object_mat_convert_space(Object *ob,
281 ReportList *reports,
282 bPoseChannel *pchan,
283 const float mat[16],
284 float mat_ret[16],
285 int from,
286 int to)
287{
288 copy_m4_m4((float (*)[4])mat_ret, (float (*)[4])mat);
289
292
293 /* Error in case of invalid from/to values when pchan is nullptr */
294 if (pchan == nullptr) {
296 const char *identifier = nullptr;
297 RNA_enum_identifier(space_items, from, &identifier);
298 BKE_reportf(reports,
299 RPT_ERROR,
300 "'from_space' '%s' is invalid when no pose bone is given!",
301 identifier);
302 return;
303 }
305 const char *identifier = nullptr;
306 RNA_enum_identifier(space_items, to, &identifier);
307 BKE_reportf(reports,
308 RPT_ERROR,
309 "'to_space' '%s' is invalid when no pose bone is given!",
310 identifier);
311 return;
312 }
313 }
314 /* These checks are extra security, they should never occur. */
315 if (from == CONSTRAINT_SPACE_CUSTOM) {
316 const char *identifier = nullptr;
317 RNA_enum_identifier(space_items, from, &identifier);
318 BKE_reportf(reports,
319 RPT_ERROR,
320 "'from_space' '%s' is invalid when no custom space is given!",
321 identifier);
322 return;
323 }
324 if (to == CONSTRAINT_SPACE_CUSTOM) {
325 const char *identifier = nullptr;
326 RNA_enum_identifier(space_items, to, &identifier);
327 BKE_reportf(reports,
328 RPT_ERROR,
329 "'to_space' '%s' is invalid when no custom space is given!",
330 identifier);
331 return;
332 }
333
334 BKE_constraint_mat_convertspace(ob, pchan, nullptr, (float (*)[4])mat_ret, from, to, false);
335}
336
337static void rna_Object_calc_matrix_camera(Object *ob,
338 Depsgraph *depsgraph,
339 float mat_ret[16],
340 int width,
341 int height,
342 float scalex,
343 float scaley)
344{
345 const Object *ob_eval = DEG_get_evaluated(depsgraph, ob);
347
348 /* setup parameters */
351
352 /* Compute matrix, view-plane, etc. */
353 BKE_camera_params_compute_viewplane(&params, width, height, scalex, scaley);
355
356 copy_m4_m4((float (*)[4])mat_ret, params.winmat);
357}
358
359static void rna_Object_camera_fit_coords(Object *ob,
360 Depsgraph *depsgraph,
361 const float *cos,
362 int cos_num,
363 float co_ret[3],
364 float *scale_ret)
365{
367 depsgraph, (const float (*)[3])cos, cos_num / 3, ob, co_ret, scale_ret);
368}
369
370static void rna_Object_crazyspace_eval(Object *object,
371 ReportList *reports,
372 Depsgraph *depsgraph,
373 Scene *scene)
374{
375 BKE_crazyspace_api_eval(depsgraph, scene, object, reports);
376}
377
378static void rna_Object_crazyspace_displacement_to_deformed(Object *object,
379 ReportList *reports,
380 const int vertex_index,
381 const float displacement[3],
382 float r_displacement_deformed[3])
383{
385 object, reports, vertex_index, displacement, r_displacement_deformed);
386}
387
388static void rna_Object_crazyspace_displacement_to_original(Object *object,
389 ReportList *reports,
390 const int vertex_index,
391 const float displacement_deformed[3],
392 float r_displacement[3])
393{
395 object, reports, vertex_index, displacement_deformed, r_displacement);
396}
397
398static void rna_Object_crazyspace_eval_clear(Object *object)
399{
401}
402
403/* copied from Mesh_getFromObject and adapted to RNA interface */
404static Mesh *rna_Object_to_mesh(Object *object,
405 ReportList *reports,
406 bool preserve_all_data_layers,
407 Depsgraph *depsgraph)
408{
409 /* TODO(sergey): Make it more re-usable function, de-duplicate with
410 * rna_Main_meshes_new_from_object. */
411 switch (object->type) {
412 case OB_FONT:
413 case OB_CURVES_LEGACY:
414 case OB_SURF:
415 case OB_MBALL:
416 case OB_MESH:
417 break;
418 default:
419 BKE_report(reports, RPT_ERROR, "Object does not have geometry data");
420 return nullptr;
421 }
422
423 return BKE_object_to_mesh(depsgraph, object, preserve_all_data_layers);
424}
425
426static void rna_Object_to_mesh_clear(Object *object)
427{
429}
430
431static Curve *rna_Object_to_curve(Object *object,
432 ReportList *reports,
433 Depsgraph *depsgraph,
434 bool apply_modifiers)
435{
436 if (!ELEM(object->type, OB_FONT, OB_CURVES_LEGACY)) {
437 BKE_report(reports, RPT_ERROR, "Object is not a curve or a text");
438 return nullptr;
439 }
440
441 if (depsgraph == nullptr) {
442 BKE_report(reports, RPT_ERROR, "Invalid depsgraph");
443 return nullptr;
444 }
445
446 return BKE_object_to_curve(object, depsgraph, apply_modifiers);
447}
448
449static void rna_Object_to_curve_clear(Object *object)
450{
452}
453
454static PointerRNA rna_Object_shape_key_add(
455 Object *ob, bContext *C, ReportList *reports, const char *name, bool from_mix)
456{
457 Main *bmain = CTX_data_main(C);
458 KeyBlock *kb = nullptr;
459
460 if ((kb = BKE_object_shapekey_insert(bmain, ob, name, from_mix))) {
461 /* Set the initial blend value. */
462 kb->curval = 1.0f;
463 CLAMP(kb->curval, kb->slidermin, kb->slidermax);
464
466 (ID *)BKE_key_from_object(ob), &RNA_ShapeKey, kb);
468
471
472 return keyptr;
473 }
474 else {
475 BKE_reportf(reports, RPT_ERROR, "Object '%s' does not support shapes", ob->id.name + 2);
476 return PointerRNA_NULL;
477 }
478}
479
480static void rna_Object_shape_key_remove(Object *ob,
481 Main *bmain,
482 ReportList *reports,
483 PointerRNA *kb_ptr)
484{
485 KeyBlock *kb = static_cast<KeyBlock *>(kb_ptr->data);
486 Key *key = BKE_key_from_object(ob);
487
488 if ((key == nullptr) || BLI_findindex(&key->block, kb) == -1) {
489 BKE_report(reports, RPT_ERROR, "ShapeKey not found");
490 return;
491 }
492
493 if (!BKE_object_shapekey_remove(bmain, ob, kb)) {
494 BKE_report(reports, RPT_ERROR, "Could not remove ShapeKey");
495 return;
496 }
497
500
501 kb_ptr->invalidate();
502}
503
504static void rna_Object_shape_key_clear(Object *ob, Main *bmain)
505{
506 BKE_object_shapekey_free(bmain, ob);
507
510}
511
512# if 0
513static void rna_Mesh_assign_verts_to_group(
514 Object *ob, bDeformGroup *group, int *indices, int totindex, float weight, int assignmode)
515{
516 if (ob->type != OB_MESH) {
517 BKE_report(reports, RPT_ERROR, "Object should be of mesh type");
518 return;
519 }
520
521 Mesh *mesh = (Mesh *)ob->data;
522 int group_index = BLI_findlink(&ob->defbase, group);
523 if (group_index == -1) {
524 BKE_report(reports, RPT_ERROR, "No vertex groups assigned to mesh");
525 return;
526 }
527
528 if (assignmode != WEIGHT_REPLACE && assignmode != WEIGHT_ADD && assignmode != WEIGHT_SUBTRACT) {
529 BKE_report(reports, RPT_ERROR, "Bad assignment mode");
530 return;
531 }
532
533 /* makes a set of dVerts corresponding to the mVerts */
534 if (!mesh->dvert) {
535 create_dverts(&mesh->id);
536 }
537
538 /* Loop list adding verts to group. */
539 for (i = 0; i < totindex; i++) {
540 if (i < 0 || i >= mesh->verts_num) {
541 BKE_report(reports, RPT_ERROR, "Bad vertex index in list");
542 return;
543 }
544
545 add_vert_defnr(ob, group_index, i, weight, assignmode);
546 }
547}
548# endif
549
550/* don't call inside a loop */
551static int mesh_corner_tri_to_face_index(Mesh *mesh_eval, const int tri_index)
552{
553 const blender::Span<int> tri_faces = mesh_eval->corner_tri_faces();
554 const int face_i = tri_faces[tri_index];
555 const int *index_face_to_orig = static_cast<const int *>(
557 return index_face_to_orig ? index_face_to_orig[face_i] : face_i;
558}
559
560/* TODO(sergey): Make the Python API more clear that evaluation might happen, or require
561 * passing fully evaluated depsgraph. */
562static Object *eval_object_ensure(Object *ob,
563 bContext *C,
564 ReportList *reports,
565 PointerRNA *rnaptr_depsgraph)
566{
567 if (ob->runtime->data_eval == nullptr) {
568 Object *ob_orig = ob;
569 Depsgraph *depsgraph = rnaptr_depsgraph != nullptr ?
570 static_cast<Depsgraph *>(rnaptr_depsgraph->data) :
571 nullptr;
572 if (depsgraph == nullptr) {
574 }
575 if (depsgraph != nullptr) {
577 }
578 if (ob == nullptr || BKE_object_get_evaluated_mesh(ob) == nullptr) {
580 reports, RPT_ERROR, "Object '%s' has no evaluated mesh data", ob_orig->id.name + 2);
581 return nullptr;
582 }
583 }
584 return ob;
585}
586
587static void rna_Object_ray_cast(Object *ob,
588 bContext *C,
589 ReportList *reports,
590 const float origin[3],
591 const float direction[3],
592 float distance,
593 PointerRNA *rnaptr_depsgraph,
594 bool *r_success,
595 float r_location[3],
596 float r_normal[3],
597 int *r_index)
598{
599 bool success = false;
600
601 /* TODO(sergey): This isn't very reliable check. It is possible to have non-nullptr pointer
602 * but which is out of date, and possibly dangling one. */
603 if ((ob = eval_object_ensure(ob, C, reports, rnaptr_depsgraph)) == nullptr) {
604 return;
605 }
606
607 Mesh *mesh_eval = BKE_object_get_evaluated_mesh(ob);
608
609 /* Test bounding box first (efficiency) */
610 const std::optional<blender::Bounds<blender::float3>> bounds = mesh_eval->bounds_min_max();
611 if (!bounds) {
612 return;
613 }
614 float distmin;
615
616 /* Needed for valid distance check from #isect_ray_aabb_v3_simple() call. */
617 float direction_unit[3];
618 normalize_v3_v3(direction_unit, direction);
619
621 origin, direction_unit, bounds->min, bounds->max, &distmin, nullptr) &&
622 distmin <= distance)
623 {
624
625 /* No need to managing allocation or freeing of the BVH data.
626 * This is generated and freed as needed. */
627 blender::bke::BVHTreeFromMesh treeData = mesh_eval->bvh_corner_tris();
628
629 /* may fail if the mesh has no faces, in that case the ray-cast misses */
630 if (treeData.tree != nullptr) {
631 BVHTreeRayHit hit;
632
633 hit.index = -1;
634 hit.dist = distance;
635
636 if (BLI_bvhtree_ray_cast(treeData.tree,
637 origin,
638 direction_unit,
639 0.0f,
640 &hit,
641 treeData.raycast_callback,
642 &treeData) != -1)
643 {
644 if (hit.dist <= distance) {
645 *r_success = success = true;
646
647 copy_v3_v3(r_location, hit.co);
648 copy_v3_v3(r_normal, hit.no);
649 *r_index = mesh_corner_tri_to_face_index(mesh_eval, hit.index);
650 }
651 }
652 }
653 }
654 if (success == false) {
655 *r_success = false;
656
657 zero_v3(r_location);
658 zero_v3(r_normal);
659 *r_index = -1;
660 }
661}
662
663static void rna_Object_closest_point_on_mesh(Object *ob,
664 bContext *C,
665 ReportList *reports,
666 const float origin[3],
667 float distance,
668 PointerRNA *rnaptr_depsgraph,
669 bool *r_success,
670 float r_location[3],
671 float r_normal[3],
672 int *r_index)
673{
674
675 if ((ob = eval_object_ensure(ob, C, reports, rnaptr_depsgraph)) == nullptr) {
676 return;
677 }
678
679 /* No need to managing allocation or freeing of the BVH data.
680 * this is generated and freed as needed. */
681 Mesh *mesh_eval = BKE_object_get_evaluated_mesh(ob);
682 blender::bke::BVHTreeFromMesh treeData = mesh_eval->bvh_corner_tris();
683
684 if (treeData.tree == nullptr) {
685 BKE_reportf(reports,
686 RPT_ERROR,
687 "Object '%s' could not create internal data for finding nearest point",
688 ob->id.name + 2);
689 return;
690 }
691 else {
692 BVHTreeNearest nearest;
693
694 nearest.index = -1;
695 nearest.dist_sq = distance * distance;
696
698 treeData.tree, origin, &nearest, treeData.nearest_callback, &treeData) != -1)
699 {
700 *r_success = true;
701
702 copy_v3_v3(r_location, nearest.co);
703 copy_v3_v3(r_normal, nearest.no);
704 *r_index = mesh_corner_tri_to_face_index(mesh_eval, nearest.index);
705 }
706 else {
707 *r_success = false;
708
709 zero_v3(r_location);
710 zero_v3(r_normal);
711 *r_index = -1;
712 }
713 }
714}
715
716static bool rna_Object_is_modified(Object *ob, Scene *scene, int settings)
717{
718 return BKE_object_is_modified(scene, ob) & settings;
719}
720
721static bool rna_Object_is_deform_modified(Object *ob, Scene *scene, int settings)
722{
723 return BKE_object_is_deform_modified(scene, ob) & settings;
724}
725
726# ifndef NDEBUG
727
728# include "BKE_mesh_runtime.hh"
729
730void rna_Object_me_eval_info(
731 Object *ob, bContext *C, int type, PointerRNA *rnaptr_depsgraph, char *result)
732{
733 const Mesh *mesh_eval = nullptr;
734 char *ret = nullptr;
735
736 result[0] = '\0';
737
738 switch (type) {
739 case 1:
740 case 2:
741 if ((ob = eval_object_ensure(ob, C, nullptr, rnaptr_depsgraph)) == nullptr) {
742 return;
743 }
744 }
745
746 switch (type) {
747 case 0:
748 if (ob->type == OB_MESH) {
749 mesh_eval = static_cast<Mesh *>(ob->data);
750 }
751 break;
752 case 1:
753 mesh_eval = BKE_object_get_mesh_deform_eval(ob);
754 break;
755 case 2:
756 mesh_eval = BKE_object_get_evaluated_mesh(ob);
757 break;
758 }
759
760 if (mesh_eval) {
761 ret = BKE_mesh_debug_info(mesh_eval);
762 if (ret) {
764 MEM_freeN(ret);
765 }
766 }
767}
768# else
769void rna_Object_me_eval_info(Object * /*ob*/,
770 bContext * /*C*/,
771 int /*type*/,
772 PointerRNA * /*rnaptr_depsgraph*/,
773 char *result)
774{
775 result[0] = '\0';
776}
777# endif /* NDEBUG */
778
779static bool rna_Object_update_from_editmode(Object *ob, Main *bmain)
780{
781 /* fail gracefully if we aren't in edit-mode. */
782 const bool result = blender::ed::object::editmode_load(bmain, ob);
783 if (result) {
784 /* Loading edit mesh to mesh changes geometry, and scripts might expect it to be properly
785 * informed about changes. */
787 }
788 return result;
789}
790
791#else /* RNA_RUNTIME */
792
794{
795 FunctionRNA *func;
796 PropertyRNA *parm;
797
798 static const EnumPropertyItem mesh_type_items[] = {
799 {eModifierMode_Realtime, "PREVIEW", 0, "Preview", "Apply modifier preview settings"},
800 {eModifierMode_Render, "RENDER", 0, "Render", "Apply modifier render settings"},
801 {0, nullptr, 0, nullptr, nullptr},
802 };
803
804# ifndef NDEBUG
805 static const EnumPropertyItem mesh_dm_info_items[] = {
806 {0, "SOURCE", 0, "Source", "Source mesh"},
807 {1, "DEFORM", 0, "Deform", "Objects deform mesh"},
808 {2, "FINAL", 0, "Final", "Objects final mesh"},
809 {0, nullptr, 0, nullptr, nullptr},
810 };
811# endif
812
813 /* Special wrapper to access the base selection value */
814 func = RNA_def_function(srna, "select_get", "rna_Object_select_get");
816 func, "Test if the object is selected. The selection state is per view layer.");
818 parm = RNA_def_pointer(
819 func, "view_layer", "ViewLayer", "", "Use this instead of the active view layer");
821 parm = RNA_def_boolean(func, "result", false, "", "Object selected");
822 RNA_def_function_return(func, parm);
823
824 func = RNA_def_function(srna, "select_set", "rna_Object_select_set");
826 func, "Select or deselect the object. The selection state is per view layer.");
828 parm = RNA_def_boolean(func, "state", false, "", "Selection state to define");
830 parm = RNA_def_pointer(
831 func, "view_layer", "ViewLayer", "", "Use this instead of the active view layer");
833
834 func = RNA_def_function(srna, "hide_get", "rna_Object_hide_get");
836 func,
837 "Test if the object is hidden for viewport editing. This hiding state is per view layer.");
839 parm = RNA_def_pointer(
840 func, "view_layer", "ViewLayer", "", "Use this instead of the active view layer");
842 parm = RNA_def_boolean(func, "result", false, "", "Object hidden");
843 RNA_def_function_return(func, parm);
844
845 func = RNA_def_function(srna, "hide_set", "rna_Object_hide_set");
847 func, "Hide the object for viewport editing. This hiding state is per view layer.");
849 parm = RNA_def_boolean(func, "state", false, "", "Hide state to define");
851 parm = RNA_def_pointer(
852 func, "view_layer", "ViewLayer", "", "Use this instead of the active view layer");
854
855 func = RNA_def_function(srna, "visible_get", "rna_Object_visible_get");
857 "Test if the object is visible in the 3D viewport, taking into "
858 "account all visibility settings");
860 parm = RNA_def_pointer(
861 func, "view_layer", "ViewLayer", "", "Use this instead of the active view layer");
863 parm = RNA_def_pointer(
864 func, "viewport", "SpaceView3D", "", "Use this instead of the active 3D viewport");
865 parm = RNA_def_boolean(func, "result", false, "", "Object visible");
866 RNA_def_function_return(func, parm);
867
868 func = RNA_def_function(srna, "holdout_get", "rna_Object_holdout_get");
869 RNA_def_function_ui_description(func, "Test if object is masked in the view layer");
871 parm = RNA_def_pointer(
872 func, "view_layer", "ViewLayer", "", "Use this instead of the active view layer");
874 parm = RNA_def_boolean(func, "result", false, "", "Object holdout");
875 RNA_def_function_return(func, parm);
876
877 func = RNA_def_function(srna, "indirect_only_get", "rna_Object_indirect_only_get");
879 "Test if object is set to contribute only indirectly (through "
880 "shadows and reflections) in the view layer");
882 parm = RNA_def_pointer(
883 func, "view_layer", "ViewLayer", "", "Use this instead of the active view layer");
885 parm = RNA_def_boolean(func, "result", false, "", "Object indirect only");
886 RNA_def_function_return(func, parm);
887
888 /* Local View */
889 func = RNA_def_function(srna, "local_view_get", "rna_Object_local_view_get");
890 RNA_def_function_ui_description(func, "Get the local view state for this object");
892 parm = RNA_def_pointer(func, "viewport", "SpaceView3D", "", "Viewport in local view");
894 parm = RNA_def_boolean(func, "result", false, "", "Object local view state");
895 RNA_def_function_return(func, parm);
896
897 func = RNA_def_function(srna, "local_view_set", "rna_Object_local_view_set");
898 RNA_def_function_ui_description(func, "Set the local view state for this object");
900 parm = RNA_def_pointer(func, "viewport", "SpaceView3D", "", "Viewport in local view");
902 parm = RNA_def_boolean(func, "state", false, "", "Local view state to define");
904
905 /* Viewport */
906 func = RNA_def_function(srna, "visible_in_viewport_get", "rna_Object_visible_in_viewport_get");
908 func, "Check for local view and local collections for this viewport and object");
909 parm = RNA_def_pointer(func, "viewport", "SpaceView3D", "", "Viewport in local collections");
911 parm = RNA_def_boolean(func, "result", false, "", "Object viewport visibility");
912 RNA_def_function_return(func, parm);
913
914 /* Matrix space conversion */
915 func = RNA_def_function(srna, "convert_space", "rna_Object_mat_convert_space");
917 func, "Convert (transform) the given matrix from one space to another");
919 parm = RNA_def_pointer(
920 func,
921 "pose_bone",
922 "PoseBone",
923 "",
924 "Bone to use to define spaces (may be None, in which case only the two 'WORLD' and "
925 "'LOCAL' spaces are usable)");
926 parm = RNA_def_property(func, "matrix", PROP_FLOAT, PROP_MATRIX);
928 RNA_def_property_ui_text(parm, "", "The matrix to transform");
929 parm = RNA_def_property(func, "matrix_return", PROP_FLOAT, PROP_MATRIX);
931 RNA_def_property_ui_text(parm, "", "The transformed matrix");
932 RNA_def_function_output(func, parm);
933 parm = RNA_def_enum(func,
934 "from_space",
937 "",
938 "The space in which 'matrix' is currently");
939 parm = RNA_def_enum(func,
940 "to_space",
943 "",
944 "The space to which you want to transform 'matrix'");
945
946 /* Camera-related operations */
947 func = RNA_def_function(srna, "calc_matrix_camera", "rna_Object_calc_matrix_camera");
949 "Generate the camera projection matrix of this object "
950 "(mostly useful for Camera and Light types)");
951 parm = RNA_def_pointer(
952 func, "depsgraph", "Depsgraph", "", "Depsgraph to get evaluated data from");
954 parm = RNA_def_property(func, "result", PROP_FLOAT, PROP_MATRIX);
956 RNA_def_property_ui_text(parm, "", "The camera projection matrix");
957 RNA_def_function_output(func, parm);
958 parm = RNA_def_int(func, "x", 1, 0, INT_MAX, "", "Width of the render area", 0, 10000);
959 parm = RNA_def_int(func, "y", 1, 0, INT_MAX, "", "Height of the render area", 0, 10000);
960 parm = RNA_def_float(
961 func, "scale_x", 1.0f, 1.0e-6f, FLT_MAX, "", "Width scaling factor", 1.0e-2f, 100.0f);
962 parm = RNA_def_float(
963 func, "scale_y", 1.0f, 1.0e-6f, FLT_MAX, "", "Height scaling factor", 1.0e-2f, 100.0f);
964
965 func = RNA_def_function(srna, "camera_fit_coords", "rna_Object_camera_fit_coords");
967 "Compute the coordinate (and scale for ortho cameras) "
968 "given object should be to 'see' all given coordinates");
969 parm = RNA_def_pointer(
970 func, "depsgraph", "Depsgraph", "", "Depsgraph to get evaluated data from");
972 parm = RNA_def_float_array(func,
973 "coordinates",
974 1,
975 nullptr,
976 -FLT_MAX,
977 FLT_MAX,
978 "",
979 "Coordinates to fit in",
980 -FLT_MAX,
981 FLT_MAX);
983 parm = RNA_def_property(func, "co_return", PROP_FLOAT, PROP_XYZ);
984 RNA_def_property_array(parm, 3);
985 RNA_def_property_ui_text(parm, "", "The location to aim to be able to see all given points");
987 parm = RNA_def_property(func, "scale_return", PROP_FLOAT, PROP_NONE);
989 parm, "", "The ortho scale to aim to be able to see all given points (if relevant)");
991
992 /* Crazy-space access. */
993
994 func = RNA_def_function(srna, "crazyspace_eval", "rna_Object_crazyspace_eval");
996 func,
997 "Compute orientation mapping between vertices of an original object and object with shape "
998 "keys and deforming modifiers applied."
999 "The evaluation is to be freed with the crazyspace_eval_free function");
1001 parm = RNA_def_pointer(
1002 func, "depsgraph", "Depsgraph", "Dependency Graph", "Evaluated dependency graph");
1004 parm = RNA_def_pointer(func, "scene", "Scene", "Scene", "Scene of the object");
1006
1007 func = RNA_def_function(srna,
1008 "crazyspace_displacement_to_deformed",
1009 "rna_Object_crazyspace_displacement_to_deformed");
1011 func, "Convert displacement vector from non-deformed object space to deformed object space");
1013 RNA_def_property(func, "vertex_index", PROP_INT, PROP_NONE);
1015 parm = RNA_def_property(func, "displacement", PROP_FLOAT, PROP_XYZ);
1016 RNA_def_property_array(parm, 3);
1017 parm = RNA_def_property(func, "displacement_deformed", PROP_FLOAT, PROP_XYZ);
1018 RNA_def_property_array(parm, 3);
1019 RNA_def_function_output(func, parm);
1020
1021 func = RNA_def_function(srna,
1022 "crazyspace_displacement_to_original",
1023 "rna_Object_crazyspace_displacement_to_original");
1025 func, "Convert displacement vector from deformed object space to non-deformed object space");
1027 RNA_def_property(func, "vertex_index", PROP_INT, PROP_NONE);
1029 parm = RNA_def_property(func, "displacement", PROP_FLOAT, PROP_XYZ);
1030 RNA_def_property_array(parm, 3);
1031 parm = RNA_def_property(func, "displacement_original", PROP_FLOAT, PROP_XYZ);
1032 RNA_def_property_array(parm, 3);
1033 RNA_def_function_output(func, parm);
1034
1035 RNA_def_function(srna, "crazyspace_eval_clear", "rna_Object_crazyspace_eval_clear");
1036 RNA_def_function_ui_description(func, "Free evaluated state of crazyspace");
1037
1038 /* mesh */
1039 func = RNA_def_function(srna, "to_mesh", "rna_Object_to_mesh");
1041 func,
1042 "Create a Mesh data-block from the current state of the object. The object owns the "
1043 "data-block. To force free it use to_mesh_clear(). "
1044 "The result is temporary and cannot be used by objects from the main database.");
1046 RNA_def_boolean(func,
1047 "preserve_all_data_layers",
1048 false,
1049 "",
1050 "Preserve all data layers in the mesh, like UV maps and vertex groups. "
1051 "By default Blender only computes the subset of data layers needed for viewport "
1052 "display and rendering, for better performance.");
1054 func,
1055 "depsgraph",
1056 "Depsgraph",
1057 "Dependency Graph",
1058 "Evaluated dependency graph which is required when preserve_all_data_layers is true");
1059 parm = RNA_def_pointer(func, "mesh", "Mesh", "", "Mesh created from object");
1060 RNA_def_function_return(func, parm);
1061
1062 func = RNA_def_function(srna, "to_mesh_clear", "rna_Object_to_mesh_clear");
1063 RNA_def_function_ui_description(func, "Clears mesh data-block created by to_mesh()");
1064
1065 /* curve */
1066 func = RNA_def_function(srna, "to_curve", "rna_Object_to_curve");
1068 func,
1069 "Create a Curve data-block from the current state of the object. This only works for curve "
1070 "and text objects. The object owns the data-block. To force free it, use to_curve_clear(). "
1071 "The result is temporary and cannot be used by objects from the main database.");
1073 parm = RNA_def_pointer(
1074 func, "depsgraph", "Depsgraph", "Dependency Graph", "Evaluated dependency graph");
1076 RNA_def_boolean(func,
1077 "apply_modifiers",
1078 false,
1079 "",
1080 "Apply the deform modifiers on the control points of the curve. This is only "
1081 "supported for curve objects.");
1082 parm = RNA_def_pointer(func, "curve", "Curve", "", "Curve created from object");
1083 RNA_def_function_return(func, parm);
1084
1085 func = RNA_def_function(srna, "to_curve_clear", "rna_Object_to_curve_clear");
1086 RNA_def_function_ui_description(func, "Clears curve data-block created by to_curve()");
1087
1088 /* Armature */
1089 func = RNA_def_function(srna, "find_armature", "BKE_modifiers_is_deformed_by_armature");
1091 func, "Find armature influencing this object as a parent or via a modifier");
1092 parm = RNA_def_pointer(
1093 func, "ob_arm", "Object", "", "Armature object influencing this object or nullptr");
1094 RNA_def_function_return(func, parm);
1095
1096 /* Shape key */
1097 func = RNA_def_function(srna, "shape_key_add", "rna_Object_shape_key_add");
1098 RNA_def_function_ui_description(func, "Add shape key to this object");
1100 RNA_def_string(func, "name", "Key", 0, "", "Unique name for the new key-block"); /* optional */
1101 RNA_def_boolean(func, "from_mix", true, "", "Create new shape from existing mix of shapes");
1102 parm = RNA_def_pointer(func, "key", "ShapeKey", "", "New shape key-block");
1104 RNA_def_function_return(func, parm);
1105
1106 func = RNA_def_function(srna, "shape_key_remove", "rna_Object_shape_key_remove");
1107 RNA_def_function_ui_description(func, "Remove a Shape Key from this object");
1109 parm = RNA_def_pointer(func, "key", "ShapeKey", "", "Key-block to be removed");
1112
1113 func = RNA_def_function(srna, "shape_key_clear", "rna_Object_shape_key_clear");
1114 RNA_def_function_ui_description(func, "Remove all Shape Keys from this object");
1116
1117 /* Ray Cast */
1118 func = RNA_def_function(srna, "ray_cast", "rna_Object_ray_cast");
1120 func,
1121 "Cast a ray onto evaluated geometry, in object space "
1122 "(using context's or provided depsgraph to get evaluated mesh if needed)");
1124
1125 /* ray start and end */
1126 parm = RNA_def_float_vector(func,
1127 "origin",
1128 3,
1129 nullptr,
1130 -FLT_MAX,
1131 FLT_MAX,
1132 "",
1133 "Origin of the ray, in object space",
1134 -1e4,
1135 1e4);
1137 parm = RNA_def_float_vector(func,
1138 "direction",
1139 3,
1140 nullptr,
1141 -FLT_MAX,
1142 FLT_MAX,
1143 "",
1144 "Direction of the ray, in object space",
1145 -1e4,
1146 1e4);
1148 RNA_def_float(func,
1149 "distance",
1151 0.0,
1153 "",
1154 "Maximum distance",
1155 0.0,
1157 parm = RNA_def_pointer(
1158 func,
1159 "depsgraph",
1160 "Depsgraph",
1161 "",
1162 "Depsgraph to use to get evaluated data, when called from original object "
1163 "(only needed if current Context's depsgraph is not suitable)");
1165
1166 /* return location and normal */
1167 parm = RNA_def_boolean(
1168 func, "result", false, "", "Whether the ray successfully hit the geometry");
1169 RNA_def_function_output(func, parm);
1170 parm = RNA_def_float_vector(func,
1171 "location",
1172 3,
1173 nullptr,
1174 -FLT_MAX,
1175 FLT_MAX,
1176 "Location",
1177 "The hit location of this ray cast",
1178 -1e4,
1179 1e4);
1181 RNA_def_function_output(func, parm);
1182 parm = RNA_def_float_vector(func,
1183 "normal",
1184 3,
1185 nullptr,
1186 -FLT_MAX,
1187 FLT_MAX,
1188 "Normal",
1189 "The face normal at the ray cast hit location",
1190 -1e4,
1191 1e4);
1193 RNA_def_function_output(func, parm);
1194 parm = RNA_def_int(
1195 func, "index", 0, 0, 0, "", "The face index, -1 when original data isn't available", 0, 0);
1196 RNA_def_function_output(func, parm);
1197
1198 /* Nearest Point */
1199 func = RNA_def_function(srna, "closest_point_on_mesh", "rna_Object_closest_point_on_mesh");
1201 func,
1202 "Find the nearest point on evaluated geometry, in object space "
1203 "(using context's or provided depsgraph to get evaluated mesh if needed)");
1205
1206 /* location of point for test and max distance */
1207 parm = RNA_def_float_vector(func,
1208 "origin",
1209 3,
1210 nullptr,
1211 -FLT_MAX,
1212 FLT_MAX,
1213 "",
1214 "Point to find closest geometry from (in object space)",
1215 -1e4,
1216 1e4);
1218 /* default is sqrt(FLT_MAX) */
1220 func, "distance", 1.844674352395373e+19, 0.0, FLT_MAX, "", "Maximum distance", 0.0, FLT_MAX);
1221 parm = RNA_def_pointer(
1222 func,
1223 "depsgraph",
1224 "Depsgraph",
1225 "",
1226 "Depsgraph to use to get evaluated data, when called from original object "
1227 "(only needed if current Context's depsgraph is not suitable)");
1229
1230 /* return location and normal */
1231 parm = RNA_def_boolean(func, "result", false, "", "Whether closest point on geometry was found");
1232 RNA_def_function_output(func, parm);
1233 parm = RNA_def_float_vector(func,
1234 "location",
1235 3,
1236 nullptr,
1237 -FLT_MAX,
1238 FLT_MAX,
1239 "Location",
1240 "The location on the object closest to the point",
1241 -1e4,
1242 1e4);
1244 RNA_def_function_output(func, parm);
1245 parm = RNA_def_float_vector(func,
1246 "normal",
1247 3,
1248 nullptr,
1249 -FLT_MAX,
1250 FLT_MAX,
1251 "Normal",
1252 "The face normal at the closest point",
1253 -1e4,
1254 1e4);
1256 RNA_def_function_output(func, parm);
1257
1258 parm = RNA_def_int(
1259 func, "index", 0, 0, 0, "", "The face index, -1 when original data isn't available", 0, 0);
1260 RNA_def_function_output(func, parm);
1261
1262 /* View */
1263
1264 /* utility function for checking if the object is modified */
1265 func = RNA_def_function(srna, "is_modified", "rna_Object_is_modified");
1267 "Determine if this object is modified from the base mesh data");
1268 parm = RNA_def_pointer(func, "scene", "Scene", "", "Scene in which to check the object");
1270 parm = RNA_def_enum(func, "settings", mesh_type_items, 0, "", "Modifier settings to apply");
1272 parm = RNA_def_boolean(func, "result", false, "", "Whether the object is modified");
1273 RNA_def_function_return(func, parm);
1274
1275 func = RNA_def_function(srna, "is_deform_modified", "rna_Object_is_deform_modified");
1277 func, "Determine if this object is modified by a deformation from the base mesh data");
1278 parm = RNA_def_pointer(func, "scene", "Scene", "", "Scene in which to check the object");
1280 parm = RNA_def_enum(func, "settings", mesh_type_items, 0, "", "Modifier settings to apply");
1282 parm = RNA_def_boolean(func, "result", false, "", "Whether the object is deform-modified");
1283 RNA_def_function_return(func, parm);
1284
1285# ifndef NDEBUG
1286 /* mesh */
1287 func = RNA_def_function(srna, "dm_info", "rna_Object_me_eval_info");
1289 func,
1290 "Returns a string for original/evaluated mesh data (debug builds only, "
1291 "using context's or provided depsgraph to get evaluated mesh if needed)");
1293
1294 parm = RNA_def_enum(func, "type", mesh_dm_info_items, 0, "", "Modifier settings to apply");
1296 parm = RNA_def_pointer(
1297 func,
1298 "depsgraph",
1299 "Depsgraph",
1300 "",
1301 "Depsgraph to use to get evaluated data, when called from original object "
1302 "(only needed if current Context's depsgraph is not suitable)");
1304 /* weak!, no way to return dynamic string type */
1305 parm = RNA_def_string(
1306 func, "result", nullptr, MESH_DM_INFO_STR_MAX, "", "Requested information");
1308 parm, PROP_THICK_WRAP, ParameterFlag(0)); /* needed for string return value */
1309 RNA_def_function_output(func, parm);
1310# endif /* !NDEBUG */
1311
1312 func = RNA_def_function(srna, "update_from_editmode", "rna_Object_update_from_editmode");
1313 RNA_def_function_ui_description(func, "Load the objects edit-mode data into the object data");
1315 parm = RNA_def_boolean(func, "result", false, "", "Success");
1316 RNA_def_function_return(func, parm);
1317
1318 func = RNA_def_function(srna, "cache_release", "BKE_object_free_caches");
1320 "Release memory used by caches associated with this object. "
1321 "Intended to be used by render engines only.");
1322}
1323
1324#endif /* RNA_RUNTIME */
void BKE_camera_params_init(CameraParams *params)
bool BKE_camera_view_frame_fit_to_coords(const struct Depsgraph *depsgraph, const float(*cos)[3], int num_cos, struct Object *camera_ob, float r_co[3], float *r_scale)
void BKE_camera_params_from_object(CameraParams *params, const struct Object *cam_ob)
void BKE_camera_params_compute_viewplane(CameraParams *params, int winx, int winy, float aspx, float aspy)
void BKE_camera_params_compute_matrix(CameraParams *params)
void BKE_constraint_mat_convertspace(struct Object *ob, struct bPoseChannel *pchan, struct bConstraintOb *cob, float mat[4][4], short from, short to, bool keep_scale)
Depsgraph * CTX_data_ensure_evaluated_depsgraph(const bContext *C)
Scene * CTX_data_scene(const bContext *C)
Main * CTX_data_main(const bContext *C)
View3D * CTX_wm_view3d(const bContext *C)
ViewLayer * CTX_data_view_layer(const bContext *C)
void BKE_crazyspace_api_eval(Depsgraph *depsgraph, Scene *scene, Object *object, ReportList *reports)
void BKE_crazyspace_api_displacement_to_original(Object *object, ReportList *reports, int vertex_index, const float displacement_deformed[3], float r_displacement[3])
void BKE_crazyspace_api_eval_clear(Object *object)
void BKE_crazyspace_api_displacement_to_deformed(Object *object, ReportList *reports, int vertex_index, const float displacement[3], float r_displacement_deformed[3])
CustomData interface, see also DNA_customdata_types.h.
const void * CustomData_get_layer(const CustomData *data, eCustomDataType type)
#define G_MAIN
Key * BKE_key_from_object(Object *ob)
Definition key.cc:1791
void BKE_view_layer_synced_ensure(const Scene *scene, ViewLayer *view_layer)
bool BKE_object_is_visible_in_viewport(const View3D *v3d, const Object *ob)
void BKE_view_layer_need_resync_tag(ViewLayer *view_layer)
Base * BKE_view_layer_base_find(ViewLayer *view_layer, Object *ob)
char * BKE_mesh_debug_info(const Mesh *mesh) ATTR_NONNULL(1) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT
Definition mesh_debug.cc:28
General operations, lookup, etc. for blender objects.
void BKE_object_to_mesh_clear(Object *object)
void BKE_object_to_curve_clear(Object *object)
KeyBlock * BKE_object_shapekey_insert(Main *bmain, Object *ob, const char *name, bool from_mix)
Mesh * BKE_object_get_evaluated_mesh(const Object *object_eval)
bool BKE_object_shapekey_free(Main *bmain, Object *ob)
int BKE_object_is_deform_modified(Scene *scene, Object *ob)
bool BKE_object_shapekey_remove(Main *bmain, Object *ob, KeyBlock *kb)
const Mesh * BKE_object_get_mesh_deform_eval(const Object *object)
Mesh * BKE_object_to_mesh(Depsgraph *depsgraph, Object *object, bool preserve_all_data_layers)
Curve * BKE_object_to_curve(Object *object, Depsgraph *depsgraph, bool apply_modifiers)
int BKE_object_is_modified(Scene *scene, Object *ob)
void BKE_reportf(ReportList *reports, eReportType type, const char *format,...) ATTR_PRINTF_FORMAT(3
@ RPT_ERROR
Definition BKE_report.hh:39
@ RPT_WARNING
Definition BKE_report.hh:38
void BKE_report(ReportList *reports, eReportType type, const char *message)
Definition report.cc:153
#define BLI_assert(a)
Definition BLI_assert.h:46
#define BVH_RAYCAST_DIST_MAX
int BLI_bvhtree_find_nearest(const BVHTree *tree, const float co[3], BVHTreeNearest *nearest, BVHTree_NearestPointCallback callback, void *userdata)
int BLI_bvhtree_ray_cast(const BVHTree *tree, const float co[3], const float dir[3], float radius, BVHTreeRayHit *hit, BVHTree_RayCastCallback callback, void *userdata)
int BLI_findindex(const ListBase *listbase, const void *vlink) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
Definition listbase.cc:586
void * BLI_findlink(const ListBase *listbase, int number) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
Definition listbase.cc:534
bool isect_ray_aabb_v3_simple(const float orig[3], const float dir[3], const float bb_min[3], const float bb_max[3], float *tmin, float *tmax)
void copy_m4_m4(float m1[4][4], const float m2[4][4])
MINLINE void copy_v3_v3(float r[3], const float a[3])
MINLINE float normalize_v3_v3(float r[3], const float a[3])
MINLINE void zero_v3(float r[3])
char * BLI_strncpy(char *__restrict dst, const char *__restrict src, size_t dst_maxncpy) ATTR_NONNULL(1
#define CLAMP(a, b, c)
#define SET_FLAG_FROM_TEST(value, test, flag)
#define ELEM(...)
void DEG_id_tag_update(ID *id, unsigned int flags)
void DEG_relations_tag_update(Main *bmain)
T * DEG_get_evaluated(const Depsgraph *depsgraph, T *id)
@ ID_RECALC_SELECT
Definition DNA_ID.h:1101
@ ID_RECALC_GEOMETRY
Definition DNA_ID.h:1074
@ ID_RECALC_BASE_FLAGS
Definition DNA_ID.h:1104
@ CONSTRAINT_SPACE_CUSTOM
@ CONSTRAINT_SPACE_POSE
@ CONSTRAINT_SPACE_WORLD
@ CONSTRAINT_SPACE_OWNLOCAL
@ CONSTRAINT_SPACE_LOCAL
@ CONSTRAINT_SPACE_PARLOCAL
@ BASE_HIDDEN
@ BASE_INDIRECT_ONLY
@ BASE_HOLDOUT
@ eModifierMode_Render
@ eModifierMode_Realtime
@ OB_HOLDOUT
@ OB_MBALL
@ OB_SURF
@ OB_FONT
@ OB_MESH
@ OB_CURVES_LEGACY
#define BASE_SELECTED(v3d, base)
#define BASE_VISIBLE(v3d, base)
#define WEIGHT_REPLACE
#define WEIGHT_ADD
#define WEIGHT_SUBTRACT
void ED_outliner_select_sync_from_object_tag(bContext *C)
void ED_area_tag_redraw(ScrArea *area)
Definition area.cc:693
wmWindow * ED_screen_window_find(const bScreen *screen, const wmWindowManager *wm)
ScrArea * ED_screen_area_find_with_spacedata(const bScreen *screen, const SpaceLink *sl, bool only_visible)
Read Guarded memory(de)allocation.
ParameterFlag
Definition RNA_types.hh:544
@ PARM_RNAPTR
Definition RNA_types.hh:547
@ PARM_REQUIRED
Definition RNA_types.hh:545
@ PARM_OUTPUT
Definition RNA_types.hh:546
@ FUNC_USE_REPORTS
Definition RNA_types.hh:914
@ FUNC_USE_MAIN
Definition RNA_types.hh:912
@ FUNC_USE_CONTEXT
Definition RNA_types.hh:913
@ PROP_FLOAT
Definition RNA_types.hh:164
@ PROP_INT
Definition RNA_types.hh:163
PropertyFlag
Definition RNA_types.hh:300
@ PROP_THICK_WRAP
Definition RNA_types.hh:423
@ PROP_DYNAMIC
Definition RNA_types.hh:428
@ PROP_NEVER_NULL
Definition RNA_types.hh:377
@ PROP_MATRIX
Definition RNA_types.hh:265
@ PROP_XYZ
Definition RNA_types.hh:269
@ PROP_NONE
Definition RNA_types.hh:233
#define C
Definition RandGen.cpp:29
#define ND_DRAW
Definition WM_types.hh:461
#define ND_OB_SELECT
Definition WM_types.hh:442
#define NC_SCENE
Definition WM_types.hh:378
#define NC_OBJECT
Definition WM_types.hh:379
BPy_StructRNA * depsgraph
static btDbvtVolume bounds(btDbvtNode **leaves, int count)
Definition btDbvt.cpp:299
static ushort indices[]
#define cos
#define select(A, B, C)
float distance(VecOp< float, D >, VecOp< float, D >) RET
uiWidgetBaseParameters params[MAX_WIDGET_BASE_BATCH]
void MEM_freeN(void *vmemh)
Definition mallocn.cc:113
static ulong state[N]
void base_select(Base *base, eObjectSelect_Mode mode)
bool editmode_load(Main *bmain, Object *obedit)
const char * name
return ret
const PointerRNA PointerRNA_NULL
bool RNA_enum_identifier(const EnumPropertyItem *item, const int value, const char **r_identifier)
PointerRNA RNA_pointer_create_discrete(ID *id, StructRNA *type, void *data)
PropertyRNA * RNA_def_string(StructOrFunctionRNA *cont_, const char *identifier, const char *default_value, const int maxlen, const char *ui_name, const char *ui_description)
void RNA_def_parameter_clear_flags(PropertyRNA *prop, PropertyFlag flag_property, ParameterFlag flag_parameter)
void RNA_def_function_return(FunctionRNA *func, PropertyRNA *ret)
void RNA_def_property_ui_text(PropertyRNA *prop, const char *name, const char *description)
PropertyRNA * RNA_def_float(StructOrFunctionRNA *cont_, const char *identifier, const float default_value, const float hardmin, const float hardmax, const char *ui_name, const char *ui_description, const float softmin, const float softmax)
PropertyRNA * RNA_def_float_vector(StructOrFunctionRNA *cont_, const char *identifier, const int len, const float *default_value, const float hardmin, const float hardmax, const char *ui_name, const char *ui_description, const float softmin, const float softmax)
void RNA_def_property_multi_array(PropertyRNA *prop, int dimension, const int length[])
PropertyRNA * RNA_def_enum(StructOrFunctionRNA *cont_, const char *identifier, const EnumPropertyItem *items, const int default_value, const char *ui_name, const char *ui_description)
FunctionRNA * RNA_def_function(StructRNA *srna, const char *identifier, const char *call)
void RNA_def_property_array(PropertyRNA *prop, int length)
PropertyRNA * RNA_def_pointer(StructOrFunctionRNA *cont_, const char *identifier, const char *type, const char *ui_name, const char *ui_description)
void RNA_def_function_ui_description(FunctionRNA *func, const char *description)
const int rna_matrix_dimsize_4x4[]
PropertyRNA * RNA_def_property(StructOrFunctionRNA *cont_, const char *identifier, int type, int subtype)
void RNA_def_function_flag(FunctionRNA *func, int flag)
PropertyRNA * RNA_def_float_array(StructOrFunctionRNA *cont_, const char *identifier, const int len, const float *default_value, const float hardmin, const float hardmax, const char *ui_name, const char *ui_description, const float softmin, const float softmax)
PropertyRNA * RNA_def_boolean(StructOrFunctionRNA *cont_, const char *identifier, const bool default_value, const char *ui_name, const char *ui_description)
void RNA_def_function_output(FunctionRNA *, PropertyRNA *ret)
PropertyRNA * RNA_def_int(StructOrFunctionRNA *cont_, const char *identifier, const int default_value, const int hardmin, const int hardmax, const char *ui_name, const char *ui_description, const int softmin, const int softmax)
void RNA_def_parameter_flags(PropertyRNA *prop, PropertyFlag flag_property, ParameterFlag flag_parameter)
#define MESH_DM_INFO_STR_MAX
static const EnumPropertyItem space_items[]
void RNA_api_object(StructRNA *srna)
#define FLT_MAX
Definition stdcycles.h:14
short flag
unsigned short local_view_bits
Definition DNA_ID.h:414
char name[258]
Definition DNA_ID.h:432
float slidermax
float slidermin
float curval
ListBase block
CustomData face_data
ObjectRuntimeHandle * runtime
short visibility_flag
unsigned short base_local_view_bits
ID * owner_id
Definition RNA_types.hh:51
void invalidate()
Definition RNA_types.hh:110
void * data
Definition RNA_types.hh:53
struct View3D * localvd
unsigned short local_view_uid
char name[64]
BVHTree_NearestPointCallback nearest_callback
BVHTree_RayCastCallback raycast_callback
struct Scene * scene
i
Definition text_draw.cc:230
void WM_main_add_notifier(uint type, void *reference)
void WM_event_add_notifier(const bContext *C, uint type, void *reference)
ViewLayer * WM_window_get_active_view_layer(const wmWindow *win)
Scene * WM_window_get_active_scene(const wmWindow *win)