Blender V4.5
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) {
108 RPT_ERROR,
109 "Object '%s' can't 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) {
143 RPT_ERROR,
144 "Object '%s' can't 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,
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,
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,
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);
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);
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);
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);
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,
372 Depsgraph *depsgraph,
373 Scene *scene)
374{
376}
377
378static void rna_Object_crazyspace_displacement_to_deformed(Object *object,
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,
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,
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,
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))) {
462 (ID *)BKE_key_from_object(ob), &RNA_ShapeKey, kb);
464
467
468 return keyptr;
469 }
470 else {
471 BKE_reportf(reports, RPT_ERROR, "Object '%s' does not support shapes", ob->id.name + 2);
472 return PointerRNA_NULL;
473 }
474}
475
476static void rna_Object_shape_key_remove(Object *ob,
477 Main *bmain,
479 PointerRNA *kb_ptr)
480{
481 KeyBlock *kb = static_cast<KeyBlock *>(kb_ptr->data);
482 Key *key = BKE_key_from_object(ob);
483
484 if ((key == nullptr) || BLI_findindex(&key->block, kb) == -1) {
485 BKE_report(reports, RPT_ERROR, "ShapeKey not found");
486 return;
487 }
488
489 if (!BKE_object_shapekey_remove(bmain, ob, kb)) {
490 BKE_report(reports, RPT_ERROR, "Could not remove ShapeKey");
491 return;
492 }
493
496
497 kb_ptr->invalidate();
498}
499
500static void rna_Object_shape_key_clear(Object *ob, Main *bmain)
501{
502 BKE_object_shapekey_free(bmain, ob);
503
506}
507
508# if 0
509static void rna_Mesh_assign_verts_to_group(
510 Object *ob, bDeformGroup *group, int *indices, int totindex, float weight, int assignmode)
511{
512 if (ob->type != OB_MESH) {
513 BKE_report(reports, RPT_ERROR, "Object should be of mesh type");
514 return;
515 }
516
517 Mesh *mesh = (Mesh *)ob->data;
518 int group_index = BLI_findlink(&ob->defbase, group);
519 if (group_index == -1) {
520 BKE_report(reports, RPT_ERROR, "No vertex groups assigned to mesh");
521 return;
522 }
523
524 if (assignmode != WEIGHT_REPLACE && assignmode != WEIGHT_ADD && assignmode != WEIGHT_SUBTRACT) {
525 BKE_report(reports, RPT_ERROR, "Bad assignment mode");
526 return;
527 }
528
529 /* makes a set of dVerts corresponding to the mVerts */
530 if (!mesh->dvert) {
531 create_dverts(&mesh->id);
532 }
533
534 /* Loop list adding verts to group. */
535 for (i = 0; i < totindex; i++) {
536 if (i < 0 || i >= mesh->verts_num) {
537 BKE_report(reports, RPT_ERROR, "Bad vertex index in list");
538 return;
539 }
540
541 add_vert_defnr(ob, group_index, i, weight, assignmode);
542 }
543}
544# endif
545
546/* don't call inside a loop */
547static int mesh_corner_tri_to_face_index(Mesh *mesh_eval, const int tri_index)
548{
549 const blender::Span<int> tri_faces = mesh_eval->corner_tri_faces();
550 const int face_i = tri_faces[tri_index];
551 const int *index_face_to_orig = static_cast<const int *>(
553 return index_face_to_orig ? index_face_to_orig[face_i] : face_i;
554}
555
556/* TODO(sergey): Make the Python API more clear that evaluation might happen, or require
557 * passing fully evaluated depsgraph. */
558static Object *eval_object_ensure(Object *ob,
559 bContext *C,
561 PointerRNA *rnaptr_depsgraph)
562{
563 if (ob->runtime->data_eval == nullptr) {
564 Object *ob_orig = ob;
565 Depsgraph *depsgraph = rnaptr_depsgraph != nullptr ?
566 static_cast<Depsgraph *>(rnaptr_depsgraph->data) :
567 nullptr;
568 if (depsgraph == nullptr) {
570 }
571 if (depsgraph != nullptr) {
573 }
574 if (ob == nullptr || BKE_object_get_evaluated_mesh(ob) == nullptr) {
576 reports, RPT_ERROR, "Object '%s' has no evaluated mesh data", ob_orig->id.name + 2);
577 return nullptr;
578 }
579 }
580 return ob;
581}
582
583static void rna_Object_ray_cast(Object *ob,
584 bContext *C,
586 const float origin[3],
587 const float direction[3],
588 float distance,
589 PointerRNA *rnaptr_depsgraph,
590 bool *r_success,
591 float r_location[3],
592 float r_normal[3],
593 int *r_index)
594{
595 bool success = false;
596
597 /* TODO(sergey): This isn't very reliable check. It is possible to have non-nullptr pointer
598 * but which is out of date, and possibly dangling one. */
599 if ((ob = eval_object_ensure(ob, C, reports, rnaptr_depsgraph)) == nullptr) {
600 return;
601 }
602
603 Mesh *mesh_eval = BKE_object_get_evaluated_mesh(ob);
604
605 /* Test bounding box first (efficiency) */
606 const std::optional<blender::Bounds<blender::float3>> bounds = mesh_eval->bounds_min_max();
607 if (!bounds) {
608 return;
609 }
610 float distmin;
611
612 /* Needed for valid distance check from #isect_ray_aabb_v3_simple() call. */
613 float direction_unit[3];
614 normalize_v3_v3(direction_unit, direction);
615
617 origin, direction_unit, bounds->min, bounds->max, &distmin, nullptr) &&
618 distmin <= distance))
619 {
620
621 /* No need to managing allocation or freeing of the BVH data.
622 * This is generated and freed as needed. */
623 blender::bke::BVHTreeFromMesh treeData = mesh_eval->bvh_corner_tris();
624
625 /* may fail if the mesh has no faces, in that case the ray-cast misses */
626 if (treeData.tree != nullptr) {
627 BVHTreeRayHit hit;
628
629 hit.index = -1;
630 hit.dist = distance;
631
632 if (BLI_bvhtree_ray_cast(treeData.tree,
633 origin,
634 direction_unit,
635 0.0f,
636 &hit,
637 treeData.raycast_callback,
638 &treeData) != -1)
639 {
640 if (hit.dist <= distance) {
641 *r_success = success = true;
642
643 copy_v3_v3(r_location, hit.co);
644 copy_v3_v3(r_normal, hit.no);
645 *r_index = mesh_corner_tri_to_face_index(mesh_eval, hit.index);
646 }
647 }
648 }
649 }
650 if (success == false) {
651 *r_success = false;
652
653 zero_v3(r_location);
654 zero_v3(r_normal);
655 *r_index = -1;
656 }
657}
658
659static void rna_Object_closest_point_on_mesh(Object *ob,
660 bContext *C,
662 const float origin[3],
663 float distance,
664 PointerRNA *rnaptr_depsgraph,
665 bool *r_success,
666 float r_location[3],
667 float r_normal[3],
668 int *r_index)
669{
670
671 if ((ob = eval_object_ensure(ob, C, reports, rnaptr_depsgraph)) == nullptr) {
672 return;
673 }
674
675 /* No need to managing allocation or freeing of the BVH data.
676 * this is generated and freed as needed. */
677 Mesh *mesh_eval = BKE_object_get_evaluated_mesh(ob);
678 blender::bke::BVHTreeFromMesh treeData = mesh_eval->bvh_corner_tris();
679
680 if (treeData.tree == nullptr) {
682 RPT_ERROR,
683 "Object '%s' could not create internal data for finding nearest point",
684 ob->id.name + 2);
685 return;
686 }
687 else {
688 BVHTreeNearest nearest;
689
690 nearest.index = -1;
691 nearest.dist_sq = distance * distance;
692
694 treeData.tree, origin, &nearest, treeData.nearest_callback, &treeData) != -1)
695 {
696 *r_success = true;
697
698 copy_v3_v3(r_location, nearest.co);
699 copy_v3_v3(r_normal, nearest.no);
700 *r_index = mesh_corner_tri_to_face_index(mesh_eval, nearest.index);
701 }
702 else {
703 *r_success = false;
704
705 zero_v3(r_location);
706 zero_v3(r_normal);
707 *r_index = -1;
708 }
709 }
710}
711
712static bool rna_Object_is_modified(Object *ob, Scene *scene, int settings)
713{
714 return BKE_object_is_modified(scene, ob) & settings;
715}
716
717static bool rna_Object_is_deform_modified(Object *ob, Scene *scene, int settings)
718{
719 return BKE_object_is_deform_modified(scene, ob) & settings;
720}
721
722# ifndef NDEBUG
723
724# include "BKE_mesh_runtime.hh"
725
726void rna_Object_me_eval_info(
727 Object *ob, bContext *C, int type, PointerRNA *rnaptr_depsgraph, char *result)
728{
729 const Mesh *mesh_eval = nullptr;
730 char *ret = nullptr;
731
732 result[0] = '\0';
733
734 switch (type) {
735 case 1:
736 case 2:
737 if ((ob = eval_object_ensure(ob, C, nullptr, rnaptr_depsgraph)) == nullptr) {
738 return;
739 }
740 }
741
742 switch (type) {
743 case 0:
744 if (ob->type == OB_MESH) {
745 mesh_eval = static_cast<Mesh *>(ob->data);
746 }
747 break;
748 case 1:
749 mesh_eval = BKE_object_get_mesh_deform_eval(ob);
750 break;
751 case 2:
752 mesh_eval = BKE_object_get_evaluated_mesh(ob);
753 break;
754 }
755
756 if (mesh_eval) {
757 ret = BKE_mesh_debug_info(mesh_eval);
758 if (ret) {
760 MEM_freeN(ret);
761 }
762 }
763}
764# else
765void rna_Object_me_eval_info(Object * /*ob*/,
766 bContext * /*C*/,
767 int /*type*/,
768 PointerRNA * /*rnaptr_depsgraph*/,
769 char *result)
770{
771 result[0] = '\0';
772}
773# endif /* NDEBUG */
774
775static bool rna_Object_update_from_editmode(Object *ob, Main *bmain)
776{
777 /* fail gracefully if we aren't in edit-mode. */
778 const bool result = blender::ed::object::editmode_load(bmain, ob);
779 if (result) {
780 /* Loading edit mesh to mesh changes geometry, and scripts might expect it to be properly
781 * informed about changes. */
783 }
784 return result;
785}
786
787#else /* RNA_RUNTIME */
788
790{
791 FunctionRNA *func;
792 PropertyRNA *parm;
793
794 static const EnumPropertyItem mesh_type_items[] = {
795 {eModifierMode_Realtime, "PREVIEW", 0, "Preview", "Apply modifier preview settings"},
796 {eModifierMode_Render, "RENDER", 0, "Render", "Apply modifier render settings"},
797 {0, nullptr, 0, nullptr, nullptr},
798 };
799
800# ifndef NDEBUG
801 static const EnumPropertyItem mesh_dm_info_items[] = {
802 {0, "SOURCE", 0, "Source", "Source mesh"},
803 {1, "DEFORM", 0, "Deform", "Objects deform mesh"},
804 {2, "FINAL", 0, "Final", "Objects final mesh"},
805 {0, nullptr, 0, nullptr, nullptr},
806 };
807# endif
808
809 /* Special wrapper to access the base selection value */
810 func = RNA_def_function(srna, "select_get", "rna_Object_select_get");
812 func, "Test if the object is selected. The selection state is per view layer.");
814 parm = RNA_def_pointer(
815 func, "view_layer", "ViewLayer", "", "Use this instead of the active view layer");
817 parm = RNA_def_boolean(func, "result", false, "", "Object selected");
818 RNA_def_function_return(func, parm);
819
820 func = RNA_def_function(srna, "select_set", "rna_Object_select_set");
822 func, "Select or deselect the object. The selection state is per view layer.");
824 parm = RNA_def_boolean(func, "state", false, "", "Selection state to define");
826 parm = RNA_def_pointer(
827 func, "view_layer", "ViewLayer", "", "Use this instead of the active view layer");
829
830 func = RNA_def_function(srna, "hide_get", "rna_Object_hide_get");
832 func,
833 "Test if the object is hidden for viewport editing. This hiding state is per view layer.");
835 parm = RNA_def_pointer(
836 func, "view_layer", "ViewLayer", "", "Use this instead of the active view layer");
838 parm = RNA_def_boolean(func, "result", false, "", "Object hidden");
839 RNA_def_function_return(func, parm);
840
841 func = RNA_def_function(srna, "hide_set", "rna_Object_hide_set");
843 func, "Hide the object for viewport editing. This hiding state is per view layer.");
845 parm = RNA_def_boolean(func, "state", false, "", "Hide state to define");
847 parm = RNA_def_pointer(
848 func, "view_layer", "ViewLayer", "", "Use this instead of the active view layer");
850
851 func = RNA_def_function(srna, "visible_get", "rna_Object_visible_get");
853 "Test if the object is visible in the 3D viewport, taking into "
854 "account all visibility settings");
856 parm = RNA_def_pointer(
857 func, "view_layer", "ViewLayer", "", "Use this instead of the active view layer");
859 parm = RNA_def_pointer(
860 func, "viewport", "SpaceView3D", "", "Use this instead of the active 3D viewport");
861 parm = RNA_def_boolean(func, "result", false, "", "Object visible");
862 RNA_def_function_return(func, parm);
863
864 func = RNA_def_function(srna, "holdout_get", "rna_Object_holdout_get");
865 RNA_def_function_ui_description(func, "Test if object is masked in the view layer");
867 parm = RNA_def_pointer(
868 func, "view_layer", "ViewLayer", "", "Use this instead of the active view layer");
870 parm = RNA_def_boolean(func, "result", false, "", "Object holdout");
871 RNA_def_function_return(func, parm);
872
873 func = RNA_def_function(srna, "indirect_only_get", "rna_Object_indirect_only_get");
875 "Test if object is set to contribute only indirectly (through "
876 "shadows and reflections) in the view layer");
878 parm = RNA_def_pointer(
879 func, "view_layer", "ViewLayer", "", "Use this instead of the active view layer");
881 parm = RNA_def_boolean(func, "result", false, "", "Object indirect only");
882 RNA_def_function_return(func, parm);
883
884 /* Local View */
885 func = RNA_def_function(srna, "local_view_get", "rna_Object_local_view_get");
886 RNA_def_function_ui_description(func, "Get the local view state for this object");
888 parm = RNA_def_pointer(func, "viewport", "SpaceView3D", "", "Viewport in local view");
890 parm = RNA_def_boolean(func, "result", false, "", "Object local view state");
891 RNA_def_function_return(func, parm);
892
893 func = RNA_def_function(srna, "local_view_set", "rna_Object_local_view_set");
894 RNA_def_function_ui_description(func, "Set the local view state for this object");
896 parm = RNA_def_pointer(func, "viewport", "SpaceView3D", "", "Viewport in local view");
898 parm = RNA_def_boolean(func, "state", false, "", "Local view state to define");
900
901 /* Viewport */
902 func = RNA_def_function(srna, "visible_in_viewport_get", "rna_Object_visible_in_viewport_get");
904 func, "Check for local view and local collections for this viewport and object");
905 parm = RNA_def_pointer(func, "viewport", "SpaceView3D", "", "Viewport in local collections");
907 parm = RNA_def_boolean(func, "result", false, "", "Object viewport visibility");
908 RNA_def_function_return(func, parm);
909
910 /* Matrix space conversion */
911 func = RNA_def_function(srna, "convert_space", "rna_Object_mat_convert_space");
913 func, "Convert (transform) the given matrix from one space to another");
915 parm = RNA_def_pointer(
916 func,
917 "pose_bone",
918 "PoseBone",
919 "",
920 "Bone to use to define spaces (may be None, in which case only the two 'WORLD' and "
921 "'LOCAL' spaces are usable)");
922 parm = RNA_def_property(func, "matrix", PROP_FLOAT, PROP_MATRIX);
924 RNA_def_property_ui_text(parm, "", "The matrix to transform");
925 parm = RNA_def_property(func, "matrix_return", PROP_FLOAT, PROP_MATRIX);
927 RNA_def_property_ui_text(parm, "", "The transformed matrix");
928 RNA_def_function_output(func, parm);
929 parm = RNA_def_enum(func,
930 "from_space",
933 "",
934 "The space in which 'matrix' is currently");
935 parm = RNA_def_enum(func,
936 "to_space",
939 "",
940 "The space to which you want to transform 'matrix'");
941
942 /* Camera-related operations */
943 func = RNA_def_function(srna, "calc_matrix_camera", "rna_Object_calc_matrix_camera");
945 "Generate the camera projection matrix of this object "
946 "(mostly useful for Camera and Light types)");
947 parm = RNA_def_pointer(
948 func, "depsgraph", "Depsgraph", "", "Depsgraph to get evaluated data from");
950 parm = RNA_def_property(func, "result", PROP_FLOAT, PROP_MATRIX);
952 RNA_def_property_ui_text(parm, "", "The camera projection matrix");
953 RNA_def_function_output(func, parm);
954 parm = RNA_def_int(func, "x", 1, 0, INT_MAX, "", "Width of the render area", 0, 10000);
955 parm = RNA_def_int(func, "y", 1, 0, INT_MAX, "", "Height of the render area", 0, 10000);
956 parm = RNA_def_float(
957 func, "scale_x", 1.0f, 1.0e-6f, FLT_MAX, "", "Width scaling factor", 1.0e-2f, 100.0f);
958 parm = RNA_def_float(
959 func, "scale_y", 1.0f, 1.0e-6f, FLT_MAX, "", "Height scaling factor", 1.0e-2f, 100.0f);
960
961 func = RNA_def_function(srna, "camera_fit_coords", "rna_Object_camera_fit_coords");
963 "Compute the coordinate (and scale for ortho cameras) "
964 "given object should be to 'see' all given coordinates");
965 parm = RNA_def_pointer(
966 func, "depsgraph", "Depsgraph", "", "Depsgraph to get evaluated data from");
968 parm = RNA_def_float_array(func,
969 "coordinates",
970 1,
971 nullptr,
972 -FLT_MAX,
973 FLT_MAX,
974 "",
975 "Coordinates to fit in",
976 -FLT_MAX,
977 FLT_MAX);
979 parm = RNA_def_property(func, "co_return", PROP_FLOAT, PROP_XYZ);
980 RNA_def_property_array(parm, 3);
981 RNA_def_property_ui_text(parm, "", "The location to aim to be able to see all given points");
983 parm = RNA_def_property(func, "scale_return", PROP_FLOAT, PROP_NONE);
985 parm, "", "The ortho scale to aim to be able to see all given points (if relevant)");
987
988 /* Crazy-space access. */
989
990 func = RNA_def_function(srna, "crazyspace_eval", "rna_Object_crazyspace_eval");
992 func,
993 "Compute orientation mapping between vertices of an original object and object with shape "
994 "keys and deforming modifiers applied."
995 "The evaluation is to be freed with the crazyspace_eval_free function");
997 parm = RNA_def_pointer(
998 func, "depsgraph", "Depsgraph", "Dependency Graph", "Evaluated dependency graph");
1000 parm = RNA_def_pointer(func, "scene", "Scene", "Scene", "Scene of the object");
1002
1003 func = RNA_def_function(srna,
1004 "crazyspace_displacement_to_deformed",
1005 "rna_Object_crazyspace_displacement_to_deformed");
1007 func, "Convert displacement vector from non-deformed object space to deformed object space");
1009 RNA_def_property(func, "vertex_index", PROP_INT, PROP_NONE);
1011 parm = RNA_def_property(func, "displacement", PROP_FLOAT, PROP_XYZ);
1012 RNA_def_property_array(parm, 3);
1013 parm = RNA_def_property(func, "displacement_deformed", PROP_FLOAT, PROP_XYZ);
1014 RNA_def_property_array(parm, 3);
1015 RNA_def_function_output(func, parm);
1016
1017 func = RNA_def_function(srna,
1018 "crazyspace_displacement_to_original",
1019 "rna_Object_crazyspace_displacement_to_original");
1021 func, "Convert displacement vector from deformed object space to non-deformed object space");
1023 RNA_def_property(func, "vertex_index", PROP_INT, PROP_NONE);
1025 parm = RNA_def_property(func, "displacement", PROP_FLOAT, PROP_XYZ);
1026 RNA_def_property_array(parm, 3);
1027 parm = RNA_def_property(func, "displacement_original", PROP_FLOAT, PROP_XYZ);
1028 RNA_def_property_array(parm, 3);
1029 RNA_def_function_output(func, parm);
1030
1031 RNA_def_function(srna, "crazyspace_eval_clear", "rna_Object_crazyspace_eval_clear");
1032 RNA_def_function_ui_description(func, "Free evaluated state of crazyspace");
1033
1034 /* mesh */
1035 func = RNA_def_function(srna, "to_mesh", "rna_Object_to_mesh");
1037 func,
1038 "Create a Mesh data-block from the current state of the object. The object owns the "
1039 "data-block. To force free it use to_mesh_clear(). "
1040 "The result is temporary and cannot be used by objects from the main database.");
1042 RNA_def_boolean(func,
1043 "preserve_all_data_layers",
1044 false,
1045 "",
1046 "Preserve all data layers in the mesh, like UV maps and vertex groups. "
1047 "By default Blender only computes the subset of data layers needed for viewport "
1048 "display and rendering, for better performance.");
1050 func,
1051 "depsgraph",
1052 "Depsgraph",
1053 "Dependency Graph",
1054 "Evaluated dependency graph which is required when preserve_all_data_layers is true");
1055 parm = RNA_def_pointer(func, "mesh", "Mesh", "", "Mesh created from object");
1056 RNA_def_function_return(func, parm);
1057
1058 func = RNA_def_function(srna, "to_mesh_clear", "rna_Object_to_mesh_clear");
1059 RNA_def_function_ui_description(func, "Clears mesh data-block created by to_mesh()");
1060
1061 /* curve */
1062 func = RNA_def_function(srna, "to_curve", "rna_Object_to_curve");
1064 func,
1065 "Create a Curve data-block from the current state of the object. This only works for curve "
1066 "and text objects. The object owns the data-block. To force free it, use to_curve_clear(). "
1067 "The result is temporary and cannot be used by objects from the main database.");
1069 parm = RNA_def_pointer(
1070 func, "depsgraph", "Depsgraph", "Dependency Graph", "Evaluated dependency graph");
1072 RNA_def_boolean(func,
1073 "apply_modifiers",
1074 false,
1075 "",
1076 "Apply the deform modifiers on the control points of the curve. This is only "
1077 "supported for curve objects.");
1078 parm = RNA_def_pointer(func, "curve", "Curve", "", "Curve created from object");
1079 RNA_def_function_return(func, parm);
1080
1081 func = RNA_def_function(srna, "to_curve_clear", "rna_Object_to_curve_clear");
1082 RNA_def_function_ui_description(func, "Clears curve data-block created by to_curve()");
1083
1084 /* Armature */
1085 func = RNA_def_function(srna, "find_armature", "BKE_modifiers_is_deformed_by_armature");
1087 func, "Find armature influencing this object as a parent or via a modifier");
1088 parm = RNA_def_pointer(
1089 func, "ob_arm", "Object", "", "Armature object influencing this object or nullptr");
1090 RNA_def_function_return(func, parm);
1091
1092 /* Shape key */
1093 func = RNA_def_function(srna, "shape_key_add", "rna_Object_shape_key_add");
1094 RNA_def_function_ui_description(func, "Add shape key to this object");
1096 RNA_def_string(func, "name", "Key", 0, "", "Unique name for the new keyblock"); /* optional */
1097 RNA_def_boolean(func, "from_mix", true, "", "Create new shape from existing mix of shapes");
1098 parm = RNA_def_pointer(func, "key", "ShapeKey", "", "New shape keyblock");
1100 RNA_def_function_return(func, parm);
1101
1102 func = RNA_def_function(srna, "shape_key_remove", "rna_Object_shape_key_remove");
1103 RNA_def_function_ui_description(func, "Remove a Shape Key from this object");
1105 parm = RNA_def_pointer(func, "key", "ShapeKey", "", "Keyblock to be removed");
1108
1109 func = RNA_def_function(srna, "shape_key_clear", "rna_Object_shape_key_clear");
1110 RNA_def_function_ui_description(func, "Remove all Shape Keys from this object");
1112
1113 /* Ray Cast */
1114 func = RNA_def_function(srna, "ray_cast", "rna_Object_ray_cast");
1116 func,
1117 "Cast a ray onto evaluated geometry, in object space "
1118 "(using context's or provided depsgraph to get evaluated mesh if needed)");
1120
1121 /* ray start and end */
1122 parm = RNA_def_float_vector(func,
1123 "origin",
1124 3,
1125 nullptr,
1126 -FLT_MAX,
1127 FLT_MAX,
1128 "",
1129 "Origin of the ray, in object space",
1130 -1e4,
1131 1e4);
1133 parm = RNA_def_float_vector(func,
1134 "direction",
1135 3,
1136 nullptr,
1137 -FLT_MAX,
1138 FLT_MAX,
1139 "",
1140 "Direction of the ray, in object space",
1141 -1e4,
1142 1e4);
1144 RNA_def_float(func,
1145 "distance",
1147 0.0,
1149 "",
1150 "Maximum distance",
1151 0.0,
1153 parm = RNA_def_pointer(
1154 func,
1155 "depsgraph",
1156 "Depsgraph",
1157 "",
1158 "Depsgraph to use to get evaluated data, when called from original object "
1159 "(only needed if current Context's depsgraph is not suitable)");
1161
1162 /* return location and normal */
1163 parm = RNA_def_boolean(
1164 func, "result", false, "", "Whether the ray successfully hit the geometry");
1165 RNA_def_function_output(func, parm);
1166 parm = RNA_def_float_vector(func,
1167 "location",
1168 3,
1169 nullptr,
1170 -FLT_MAX,
1171 FLT_MAX,
1172 "Location",
1173 "The hit location of this ray cast",
1174 -1e4,
1175 1e4);
1177 RNA_def_function_output(func, parm);
1178 parm = RNA_def_float_vector(func,
1179 "normal",
1180 3,
1181 nullptr,
1182 -FLT_MAX,
1183 FLT_MAX,
1184 "Normal",
1185 "The face normal at the ray cast hit location",
1186 -1e4,
1187 1e4);
1189 RNA_def_function_output(func, parm);
1190 parm = RNA_def_int(
1191 func, "index", 0, 0, 0, "", "The face index, -1 when original data isn't available", 0, 0);
1192 RNA_def_function_output(func, parm);
1193
1194 /* Nearest Point */
1195 func = RNA_def_function(srna, "closest_point_on_mesh", "rna_Object_closest_point_on_mesh");
1197 func,
1198 "Find the nearest point on evaluated geometry, in object space "
1199 "(using context's or provided depsgraph to get evaluated mesh if needed)");
1201
1202 /* location of point for test and max distance */
1203 parm = RNA_def_float_vector(func,
1204 "origin",
1205 3,
1206 nullptr,
1207 -FLT_MAX,
1208 FLT_MAX,
1209 "",
1210 "Point to find closest geometry from (in object space)",
1211 -1e4,
1212 1e4);
1214 /* default is sqrt(FLT_MAX) */
1216 func, "distance", 1.844674352395373e+19, 0.0, FLT_MAX, "", "Maximum distance", 0.0, FLT_MAX);
1217 parm = RNA_def_pointer(
1218 func,
1219 "depsgraph",
1220 "Depsgraph",
1221 "",
1222 "Depsgraph to use to get evaluated data, when called from original object "
1223 "(only needed if current Context's depsgraph is not suitable)");
1225
1226 /* return location and normal */
1227 parm = RNA_def_boolean(func, "result", false, "", "Whether closest point on geometry was found");
1228 RNA_def_function_output(func, parm);
1229 parm = RNA_def_float_vector(func,
1230 "location",
1231 3,
1232 nullptr,
1233 -FLT_MAX,
1234 FLT_MAX,
1235 "Location",
1236 "The location on the object closest to the point",
1237 -1e4,
1238 1e4);
1240 RNA_def_function_output(func, parm);
1241 parm = RNA_def_float_vector(func,
1242 "normal",
1243 3,
1244 nullptr,
1245 -FLT_MAX,
1246 FLT_MAX,
1247 "Normal",
1248 "The face normal at the closest point",
1249 -1e4,
1250 1e4);
1252 RNA_def_function_output(func, parm);
1253
1254 parm = RNA_def_int(
1255 func, "index", 0, 0, 0, "", "The face index, -1 when original data isn't available", 0, 0);
1256 RNA_def_function_output(func, parm);
1257
1258 /* View */
1259
1260 /* utility function for checking if the object is modified */
1261 func = RNA_def_function(srna, "is_modified", "rna_Object_is_modified");
1263 "Determine if this object is modified from the base mesh data");
1264 parm = RNA_def_pointer(func, "scene", "Scene", "", "Scene in which to check the object");
1266 parm = RNA_def_enum(func, "settings", mesh_type_items, 0, "", "Modifier settings to apply");
1268 parm = RNA_def_boolean(func, "result", false, "", "Whether the object is modified");
1269 RNA_def_function_return(func, parm);
1270
1271 func = RNA_def_function(srna, "is_deform_modified", "rna_Object_is_deform_modified");
1273 func, "Determine if this object is modified by a deformation from the base mesh data");
1274 parm = RNA_def_pointer(func, "scene", "Scene", "", "Scene in which to check the object");
1276 parm = RNA_def_enum(func, "settings", mesh_type_items, 0, "", "Modifier settings to apply");
1278 parm = RNA_def_boolean(func, "result", false, "", "Whether the object is deform-modified");
1279 RNA_def_function_return(func, parm);
1280
1281# ifndef NDEBUG
1282 /* mesh */
1283 func = RNA_def_function(srna, "dm_info", "rna_Object_me_eval_info");
1285 func,
1286 "Returns a string for original/evaluated mesh data (debug builds only, "
1287 "using context's or provided depsgraph to get evaluated mesh if needed)");
1289
1290 parm = RNA_def_enum(func, "type", mesh_dm_info_items, 0, "", "Modifier settings to apply");
1292 parm = RNA_def_pointer(
1293 func,
1294 "depsgraph",
1295 "Depsgraph",
1296 "",
1297 "Depsgraph to use to get evaluated data, when called from original object "
1298 "(only needed if current Context's depsgraph is not suitable)");
1300 /* weak!, no way to return dynamic string type */
1301 parm = RNA_def_string(
1302 func, "result", nullptr, MESH_DM_INFO_STR_MAX, "", "Requested information");
1304 parm, PROP_THICK_WRAP, ParameterFlag(0)); /* needed for string return value */
1305 RNA_def_function_output(func, parm);
1306# endif /* !NDEBUG */
1307
1308 func = RNA_def_function(srna, "update_from_editmode", "rna_Object_update_from_editmode");
1309 RNA_def_function_ui_description(func, "Load the objects edit-mode data into the object data");
1311 parm = RNA_def_boolean(func, "result", false, "", "Success");
1312 RNA_def_function_return(func, parm);
1313
1314 func = RNA_def_function(srna, "cache_release", "BKE_object_free_caches");
1316 "Release memory used by caches associated with this object. "
1317 "Intended to be used by render engines only.");
1318}
1319
1320#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:1824
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
void BKE_report(ReportList *reports, eReportType type, const char *message)
Definition report.cc:126
#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 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:1009
@ ID_RECALC_GEOMETRY
Definition DNA_ID.h:982
@ ID_RECALC_BASE_FLAGS
Definition DNA_ID.h:1012
@ 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:714
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:510
@ PARM_RNAPTR
Definition RNA_types.hh:513
@ PARM_REQUIRED
Definition RNA_types.hh:511
@ PARM_OUTPUT
Definition RNA_types.hh:512
@ FUNC_USE_REPORTS
Definition RNA_types.hh:805
@ FUNC_USE_MAIN
Definition RNA_types.hh:803
@ FUNC_USE_CONTEXT
Definition RNA_types.hh:804
@ PROP_FLOAT
Definition RNA_types.hh:152
@ PROP_INT
Definition RNA_types.hh:151
PropertyFlag
Definition RNA_types.hh:286
@ PROP_THICK_WRAP
Definition RNA_types.hh:397
@ PROP_DYNAMIC
Definition RNA_types.hh:402
@ PROP_NEVER_NULL
Definition RNA_types.hh:351
@ PROP_MATRIX
Definition RNA_types.hh:253
@ PROP_XYZ
Definition RNA_types.hh:257
@ PROP_NONE
Definition RNA_types.hh:221
#define C
Definition RandGen.cpp:29
#define ND_DRAW
Definition WM_types.hh:458
#define ND_OB_SELECT
Definition WM_types.hh:439
#define NC_SCENE
Definition WM_types.hh:375
ReportList * reports
Definition WM_types.hh:1025
#define NC_OBJECT
Definition WM_types.hh:376
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)
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:404
char name[66]
Definition DNA_ID.h:415
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)