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