Blender  V2.93
rna_object_api.c
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  *
16  * The Original Code is Copyright (C) 2009 Blender Foundation.
17  * All rights reserved.
18  */
19 
24 #include <stdio.h>
25 #include <stdlib.h>
26 #include <string.h>
27 #include <time.h>
28 
29 #include "BLI_kdopbvh.h"
30 #include "BLI_utildefines.h"
31 
32 #include "RNA_define.h"
33 
34 #include "DNA_constraint_types.h"
35 #include "DNA_layer_types.h"
36 #include "DNA_modifier_types.h"
37 #include "DNA_object_types.h"
38 
39 #include "BKE_gpencil_curve.h"
40 #include "BKE_layer.h"
41 
42 #include "DEG_depsgraph.h"
43 
44 #include "ED_outliner.h"
45 
46 #include "rna_internal.h" /* own include */
47 
48 static const EnumPropertyItem space_items[] = {
49  {CONSTRAINT_SPACE_WORLD, "WORLD", 0, "World Space", "The most global space in Blender"},
51  "POSE",
52  0,
53  "Pose Space",
54  "The pose space of a bone (its armature's object space)"},
56  "LOCAL_WITH_PARENT",
57  0,
58  "Local With Parent",
59  "The rest pose local space of a bone (thus matrix includes parent transforms)"},
60  {CONSTRAINT_SPACE_LOCAL, "LOCAL", 0, "Local Space", "The local space of an object/bone"},
61  {0, NULL, 0, NULL, NULL},
62 };
63 
64 #ifdef RNA_RUNTIME
65 
66 # include "BLI_math.h"
67 
68 # include "BKE_bvhutils.h"
69 # include "BKE_constraint.h"
70 # include "BKE_context.h"
71 # include "BKE_customdata.h"
72 # include "BKE_font.h"
73 # include "BKE_global.h"
74 # include "BKE_layer.h"
75 # include "BKE_main.h"
76 # include "BKE_mball.h"
77 # include "BKE_mesh.h"
78 # include "BKE_modifier.h"
79 # include "BKE_object.h"
80 # include "BKE_report.h"
81 
82 # include "ED_object.h"
83 # include "ED_screen.h"
84 
85 # include "DNA_curve_types.h"
86 # include "DNA_mesh_types.h"
87 # include "DNA_meshdata_types.h"
88 # include "DNA_scene_types.h"
89 # include "DNA_view3d_types.h"
90 
91 # include "DEG_depsgraph_query.h"
92 
93 # include "MEM_guardedalloc.h"
94 
95 static void rna_Object_select_set(
96  Object *ob, bContext *C, ReportList *reports, bool select, ViewLayer *view_layer)
97 {
98  if (view_layer == NULL) {
99  view_layer = CTX_data_view_layer(C);
100  }
101  Base *base = BKE_view_layer_base_find(view_layer, ob);
102 
103  if (!base) {
104  if (select) {
105  BKE_reportf(reports,
106  RPT_ERROR,
107  "Object '%s' can't be selected because it is not in View Layer '%s'!",
108  ob->id.name + 2,
109  view_layer->name);
110  }
111  return;
112  }
113 
115 
120 }
121 
122 static bool rna_Object_select_get(Object *ob, bContext *C, ViewLayer *view_layer)
123 {
124  if (view_layer == NULL) {
125  view_layer = CTX_data_view_layer(C);
126  }
127  Base *base = BKE_view_layer_base_find(view_layer, ob);
128 
129  if (!base) {
130  return false;
131  }
132 
133  return ((base->flag & BASE_SELECTED) != 0);
134 }
135 
136 static void rna_Object_hide_set(
137  Object *ob, bContext *C, ReportList *reports, bool hide, ViewLayer *view_layer)
138 {
139  if (view_layer == NULL) {
140  view_layer = CTX_data_view_layer(C);
141  }
142  Base *base = BKE_view_layer_base_find(view_layer, ob);
143 
144  if (!base) {
145  if (hide) {
146  BKE_reportf(reports,
147  RPT_ERROR,
148  "Object '%s' can't be hidden because it is not in View Layer '%s'!",
149  ob->id.name + 2,
150  view_layer->name);
151  }
152  return;
153  }
154 
155  if (hide) {
156  base->flag |= BASE_HIDDEN;
157  }
158  else {
159  base->flag &= ~BASE_HIDDEN;
160  }
161 
163  BKE_layer_collection_sync(scene, view_layer);
166 }
167 
168 static bool rna_Object_hide_get(Object *ob, bContext *C, ViewLayer *view_layer)
169 {
170  if (view_layer == NULL) {
171  view_layer = CTX_data_view_layer(C);
172  }
173  Base *base = BKE_view_layer_base_find(view_layer, ob);
174 
175  if (!base) {
176  return false;
177  }
178 
179  return ((base->flag & BASE_HIDDEN) != 0);
180 }
181 
182 static bool rna_Object_visible_get(Object *ob, bContext *C, ViewLayer *view_layer, View3D *v3d)
183 {
184  if (view_layer == NULL) {
185  view_layer = CTX_data_view_layer(C);
186  }
187  if (v3d == NULL) {
188  v3d = CTX_wm_view3d(C);
189  }
190  Base *base = BKE_view_layer_base_find(view_layer, ob);
191 
192  if (!base) {
193  return false;
194  }
195 
196  return BASE_VISIBLE(v3d, base);
197 }
198 
199 static bool rna_Object_holdout_get(Object *ob, bContext *C, ViewLayer *view_layer)
200 {
201  if (view_layer == NULL) {
202  view_layer = CTX_data_view_layer(C);
203  }
204  Base *base = BKE_view_layer_base_find(view_layer, ob);
205 
206  if (!base) {
207  return false;
208  }
209 
210  return ((base->flag & BASE_HOLDOUT) != 0);
211 }
212 
213 static bool rna_Object_indirect_only_get(Object *ob, bContext *C, ViewLayer *view_layer)
214 {
215  if (view_layer == NULL) {
216  view_layer = CTX_data_view_layer(C);
217  }
218  Base *base = BKE_view_layer_base_find(view_layer, ob);
219 
220  if (!base) {
221  return false;
222  }
223 
224  return ((base->flag & BASE_INDIRECT_ONLY) != 0);
225 }
226 
227 static Base *rna_Object_local_view_property_helper(bScreen *screen,
228  View3D *v3d,
229  ViewLayer *view_layer,
230  Object *ob,
231  ReportList *reports,
232  Scene **r_scene)
233 {
234  wmWindow *win = NULL;
235  if (v3d->localvd == NULL) {
236  BKE_report(reports, RPT_ERROR, "Viewport not in local view");
237  return NULL;
238  }
239 
240  if (view_layer == NULL) {
241  win = ED_screen_window_find(screen, G_MAIN->wm.first);
242  view_layer = WM_window_get_active_view_layer(win);
243  }
244 
245  Base *base = BKE_view_layer_base_find(view_layer, ob);
246  if (base == NULL) {
247  BKE_reportf(
248  reports, RPT_WARNING, "Object %s not in view layer %s", ob->id.name + 2, view_layer->name);
249  }
250  if (r_scene != NULL && win != NULL) {
251  *r_scene = win->scene;
252  }
253  return base;
254 }
255 
256 static bool rna_Object_local_view_get(Object *ob, ReportList *reports, View3D *v3d)
257 {
258  if (v3d->localvd == NULL) {
259  BKE_report(reports, RPT_ERROR, "Viewport not in local view");
260  return false;
261  }
262 
263  return ((ob->base_local_view_bits & v3d->local_view_uuid) != 0);
264 }
265 
266 static void rna_Object_local_view_set(Object *ob,
267  ReportList *reports,
268  PointerRNA *v3d_ptr,
269  bool state)
270 {
271  bScreen *screen = (bScreen *)v3d_ptr->owner_id;
272  View3D *v3d = v3d_ptr->data;
273  Scene *scene;
274  Base *base = rna_Object_local_view_property_helper(screen, v3d, NULL, ob, reports, &scene);
275  if (base == NULL) {
276  return; /* Error reported. */
277  }
278  const short local_view_bits_prev = base->local_view_bits;
280  if (local_view_bits_prev != base->local_view_bits) {
282  ScrArea *area = ED_screen_area_find_with_spacedata(screen, (SpaceLink *)v3d, true);
283  if (area) {
285  }
286  }
287 }
288 
289 static bool rna_Object_visible_in_viewport_get(Object *ob, View3D *v3d)
290 {
291  return BKE_object_is_visible_in_viewport(v3d, ob);
292 }
293 
294 /* Convert a given matrix from a space to another (using the object and/or a bone as
295  * reference). */
296 static void rna_Object_mat_convert_space(Object *ob,
297  ReportList *reports,
298  bPoseChannel *pchan,
299  float *mat,
300  float *mat_ret,
301  int from,
302  int to)
303 {
304  copy_m4_m4((float(*)[4])mat_ret, (float(*)[4])mat);
305 
306  /* Error in case of invalid from/to values when pchan is NULL */
307  if (pchan == NULL) {
309  const char *identifier = NULL;
310  RNA_enum_identifier(space_items, from, &identifier);
311  BKE_reportf(reports,
312  RPT_ERROR,
313  "'from_space' '%s' is invalid when no pose bone is given!",
314  identifier);
315  return;
316  }
318  const char *identifier = NULL;
319  RNA_enum_identifier(space_items, to, &identifier);
320  BKE_reportf(reports,
321  RPT_ERROR,
322  "'to_space' '%s' is invalid when no pose bone is given!",
323  identifier);
324  return;
325  }
326  }
327  /* These checks are extra security, they should never occur. */
328  if (from == CONSTRAINT_SPACE_CUSTOM) {
329  const char *identifier = NULL;
330  RNA_enum_identifier(space_items, from, &identifier);
331  BKE_reportf(reports,
332  RPT_ERROR,
333  "'from_space' '%s' is invalid when no custom space is given!",
334  identifier);
335  return;
336  }
337  if (to == CONSTRAINT_SPACE_CUSTOM) {
338  const char *identifier = NULL;
339  RNA_enum_identifier(space_items, to, &identifier);
340  BKE_reportf(reports,
341  RPT_ERROR,
342  "'to_space' '%s' is invalid when no custom space is given!",
343  identifier);
344  return;
345  }
346 
347  BKE_constraint_mat_convertspace(ob, pchan, NULL, (float(*)[4])mat_ret, from, to, false);
348 }
349 
350 static void rna_Object_calc_matrix_camera(Object *ob,
352  float mat_ret[16],
353  int width,
354  int height,
355  float scalex,
356  float scaley)
357 {
358  const Object *ob_eval = DEG_get_evaluated_object(depsgraph, ob);
360 
361  /* setup parameters */
364 
365  /* compute matrix, viewplane, .. */
368 
369  copy_m4_m4((float(*)[4])mat_ret, params.winmat);
370 }
371 
372 static void rna_Object_camera_fit_coords(
373  Object *ob, Depsgraph *depsgraph, int num_cos, float *cos, float co_ret[3], float *scale_ret)
374 {
376  depsgraph, (const float(*)[3])cos, num_cos / 3, ob, co_ret, scale_ret);
377 }
378 
379 /* copied from Mesh_getFromObject and adapted to RNA interface */
380 static Mesh *rna_Object_to_mesh(Object *object,
381  ReportList *reports,
382  bool preserve_all_data_layers,
384 {
385  /* TODO(sergey): Make it more re-usable function, de-duplicate with
386  * rna_Main_meshes_new_from_object. */
387  switch (object->type) {
388  case OB_FONT:
389  case OB_CURVE:
390  case OB_SURF:
391  case OB_MBALL:
392  case OB_MESH:
393  break;
394  default:
395  BKE_report(reports, RPT_ERROR, "Object does not have geometry data");
396  return NULL;
397  }
398 
399  return BKE_object_to_mesh(depsgraph, object, preserve_all_data_layers);
400 }
401 
402 static void rna_Object_to_mesh_clear(Object *object)
403 {
404  BKE_object_to_mesh_clear(object);
405 }
406 
407 static Curve *rna_Object_to_curve(Object *object,
408  ReportList *reports,
410  bool apply_modifiers)
411 {
412  if (!ELEM(object->type, OB_FONT, OB_CURVE)) {
413  BKE_report(reports, RPT_ERROR, "Object is not a curve or a text");
414  return NULL;
415  }
416 
417  if (depsgraph == NULL) {
418  BKE_report(reports, RPT_ERROR, "Invalid depsgraph");
419  return NULL;
420  }
421 
422  return BKE_object_to_curve(object, depsgraph, apply_modifiers);
423 }
424 
425 static void rna_Object_to_curve_clear(Object *object)
426 {
428 }
429 
430 static PointerRNA rna_Object_shape_key_add(
431  Object *ob, bContext *C, ReportList *reports, const char *name, bool from_mix)
432 {
433  Main *bmain = CTX_data_main(C);
434  KeyBlock *kb = NULL;
435 
436  if ((kb = BKE_object_shapekey_insert(bmain, ob, name, from_mix))) {
437  PointerRNA keyptr;
438 
439  RNA_pointer_create((ID *)BKE_key_from_object(ob), &RNA_ShapeKey, kb, &keyptr);
441 
444 
445  return keyptr;
446  }
447  else {
448  BKE_reportf(reports, RPT_ERROR, "Object '%s' does not support shapes", ob->id.name + 2);
449  return PointerRNA_NULL;
450  }
451 }
452 
453 static void rna_Object_shape_key_remove(Object *ob,
454  Main *bmain,
455  ReportList *reports,
456  PointerRNA *kb_ptr)
457 {
458  KeyBlock *kb = kb_ptr->data;
459  Key *key = BKE_key_from_object(ob);
460 
461  if ((key == NULL) || BLI_findindex(&key->block, kb) == -1) {
462  BKE_report(reports, RPT_ERROR, "ShapeKey not found");
463  return;
464  }
465 
466  if (!BKE_object_shapekey_remove(bmain, ob, kb)) {
467  BKE_report(reports, RPT_ERROR, "Could not remove ShapeKey");
468  return;
469  }
470 
473 
474  RNA_POINTER_INVALIDATE(kb_ptr);
475 }
476 
477 static void rna_Object_shape_key_clear(Object *ob, Main *bmain)
478 {
479  BKE_object_shapekey_free(bmain, ob);
480 
483 }
484 
485 # if 0
486 static void rna_Mesh_assign_verts_to_group(
487  Object *ob, bDeformGroup *group, int *indices, int totindex, float weight, int assignmode)
488 {
489  if (ob->type != OB_MESH) {
490  BKE_report(reports, RPT_ERROR, "Object should be of mesh type");
491  return;
492  }
493 
494  Mesh *me = (Mesh *)ob->data;
495  int group_index = BLI_findlink(&ob->defbase, group);
496  if (group_index == -1) {
497  BKE_report(reports, RPT_ERROR, "No vertex groups assigned to mesh");
498  return;
499  }
500 
501  if (assignmode != WEIGHT_REPLACE && assignmode != WEIGHT_ADD && assignmode != WEIGHT_SUBTRACT) {
502  BKE_report(reports, RPT_ERROR, "Bad assignment mode");
503  return;
504  }
505 
506  /* makes a set of dVerts corresponding to the mVerts */
507  if (!me->dvert) {
508  create_dverts(&me->id);
509  }
510 
511  /* loop list adding verts to group */
512  for (i = 0; i < totindex; i++) {
513  if (i < 0 || i >= me->totvert) {
514  BKE_report(reports, RPT_ERROR, "Bad vertex index in list");
515  return;
516  }
517 
518  add_vert_defnr(ob, group_index, i, weight, assignmode);
519  }
520 }
521 # endif
522 
523 /* don't call inside a loop */
524 static int mesh_looptri_to_poly_index(Mesh *me_eval, const MLoopTri *lt)
525 {
526  const int *index_mp_to_orig = CustomData_get_layer(&me_eval->pdata, CD_ORIGINDEX);
527  return index_mp_to_orig ? index_mp_to_orig[lt->poly] : lt->poly;
528 }
529 
530 /* TOOD(sergey): Make the Python API more clear that evaluation might happen, or requite
531  * passing fully evaluated depsgraph. */
532 static Object *eval_object_ensure(Object *ob,
533  bContext *C,
534  ReportList *reports,
535  PointerRNA *rnaptr_depsgraph)
536 {
537  if (ob->runtime.data_eval == NULL) {
538  Object *ob_orig = ob;
539  Depsgraph *depsgraph = rnaptr_depsgraph != NULL ? rnaptr_depsgraph->data : NULL;
540  if (depsgraph == NULL) {
542  }
543  if (depsgraph != NULL) {
545  }
546  if (ob == NULL || BKE_object_get_evaluated_mesh(ob) == NULL) {
547  BKE_reportf(
548  reports, RPT_ERROR, "Object '%s' has no evaluated mesh data", ob_orig->id.name + 2);
549  return NULL;
550  }
551  }
552  return ob;
553 }
554 
555 static void rna_Object_ray_cast(Object *ob,
556  bContext *C,
557  ReportList *reports,
558  float origin[3],
559  float direction[3],
560  float distance,
561  PointerRNA *rnaptr_depsgraph,
562  bool *r_success,
563  float r_location[3],
564  float r_normal[3],
565  int *r_index)
566 {
567  bool success = false;
568 
569  /* TODO(sergey): This isn't very reliable check. It is possible to have non-NULL pointer
570  * but which is out of date, and possibly dangling one. */
571  if ((ob = eval_object_ensure(ob, C, reports, rnaptr_depsgraph)) == NULL) {
572  return;
573  }
574 
575  /* Test BoundBox first (efficiency) */
577  float distmin;
578  normalize_v3(
579  direction); /* Needed for valid distance check from isect_ray_aabb_v3_simple() call. */
580  if (!bb ||
581  (isect_ray_aabb_v3_simple(origin, direction, bb->vec[0], bb->vec[6], &distmin, NULL) &&
582  distmin <= distance)) {
583  BVHTreeFromMesh treeData = {NULL};
584 
585  /* No need to managing allocation or freeing of the BVH data.
586  * This is generated and freed as needed. */
587  Mesh *mesh_eval = BKE_object_get_evaluated_mesh(ob);
588  BKE_bvhtree_from_mesh_get(&treeData, mesh_eval, BVHTREE_FROM_LOOPTRI, 4);
589 
590  /* may fail if the mesh has no faces, in that case the ray-cast misses */
591  if (treeData.tree != NULL) {
592  BVHTreeRayHit hit;
593 
594  hit.index = -1;
595  hit.dist = distance;
596 
597  if (BLI_bvhtree_ray_cast(treeData.tree,
598  origin,
599  direction,
600  0.0f,
601  &hit,
602  treeData.raycast_callback,
603  &treeData) != -1) {
604  if (hit.dist <= distance) {
605  *r_success = success = true;
606 
607  copy_v3_v3(r_location, hit.co);
608  copy_v3_v3(r_normal, hit.no);
609  *r_index = mesh_looptri_to_poly_index(mesh_eval, &treeData.looptri[hit.index]);
610  }
611  }
612 
613  free_bvhtree_from_mesh(&treeData);
614  }
615  }
616  if (success == false) {
617  *r_success = false;
618 
619  zero_v3(r_location);
620  zero_v3(r_normal);
621  *r_index = -1;
622  }
623 }
624 
625 static void rna_Object_closest_point_on_mesh(Object *ob,
626  bContext *C,
627  ReportList *reports,
628  float origin[3],
629  float distance,
630  PointerRNA *rnaptr_depsgraph,
631  bool *r_success,
632  float r_location[3],
633  float r_normal[3],
634  int *r_index)
635 {
636  BVHTreeFromMesh treeData = {NULL};
637 
638  if ((ob = eval_object_ensure(ob, C, reports, rnaptr_depsgraph)) == NULL) {
639  return;
640  }
641 
642  /* No need to managing allocation or freeing of the BVH data.
643  * this is generated and freed as needed. */
644  Mesh *mesh_eval = BKE_object_get_evaluated_mesh(ob);
645  BKE_bvhtree_from_mesh_get(&treeData, mesh_eval, BVHTREE_FROM_LOOPTRI, 4);
646 
647  if (treeData.tree == NULL) {
648  BKE_reportf(reports,
649  RPT_ERROR,
650  "Object '%s' could not create internal data for finding nearest point",
651  ob->id.name + 2);
652  return;
653  }
654  else {
655  BVHTreeNearest nearest;
656 
657  nearest.index = -1;
658  nearest.dist_sq = distance * distance;
659 
661  treeData.tree, origin, &nearest, treeData.nearest_callback, &treeData) != -1) {
662  *r_success = true;
663 
664  copy_v3_v3(r_location, nearest.co);
665  copy_v3_v3(r_normal, nearest.no);
666  *r_index = mesh_looptri_to_poly_index(mesh_eval, &treeData.looptri[nearest.index]);
667 
668  goto finally;
669  }
670  }
671 
672  *r_success = false;
673 
674  zero_v3(r_location);
675  zero_v3(r_normal);
676  *r_index = -1;
677 
678 finally:
679  free_bvhtree_from_mesh(&treeData);
680 }
681 
682 static bool rna_Object_is_modified(Object *ob, Scene *scene, int settings)
683 {
684  return BKE_object_is_modified(scene, ob) & settings;
685 }
686 
687 static bool rna_Object_is_deform_modified(Object *ob, Scene *scene, int settings)
688 {
689  return BKE_object_is_deform_modified(scene, ob) & settings;
690 }
691 
692 # ifndef NDEBUG
693 
694 # include "BKE_mesh_runtime.h"
695 
696 void rna_Object_me_eval_info(
697  struct Object *ob, bContext *C, int type, PointerRNA *rnaptr_depsgraph, char *result)
698 {
699  Mesh *me_eval = NULL;
700  char *ret = NULL;
701 
702  result[0] = '\0';
703 
704  switch (type) {
705  case 1:
706  case 2:
707  if ((ob = eval_object_ensure(ob, C, NULL, rnaptr_depsgraph)) == NULL) {
708  return;
709  }
710  }
711 
712  switch (type) {
713  case 0:
714  if (ob->type == OB_MESH) {
715  me_eval = ob->data;
716  }
717  break;
718  case 1:
719  me_eval = ob->runtime.mesh_deform_eval;
720  break;
721  case 2:
722  me_eval = BKE_object_get_evaluated_mesh(ob);
723  break;
724  }
725 
726  if (me_eval) {
727  ret = BKE_mesh_runtime_debug_info(me_eval);
728  if (ret) {
729  strcpy(result, ret);
730  MEM_freeN(ret);
731  }
732  }
733 }
734 # else
735 void rna_Object_me_eval_info(struct Object *UNUSED(ob),
736  bContext *UNUSED(C),
737  int UNUSED(type),
738  PointerRNA *UNUSED(rnaptr_depsgraph),
739  char *result)
740 {
741  result[0] = '\0';
742 }
743 # endif /* NDEBUG */
744 
745 static bool rna_Object_update_from_editmode(Object *ob, Main *bmain)
746 {
747  /* fail gracefully if we aren't in edit-mode. */
748  const bool result = ED_object_editmode_load(bmain, ob);
749  if (result) {
750  /* Loading edit mesh to mesh changes geometry, and scripts might expect it to be properly
751  * informed about changes. */
753  }
754  return result;
755 }
756 
757 bool rna_Object_generate_gpencil_strokes(Object *ob,
758  bContext *C,
759  ReportList *reports,
760  Object *ob_gpencil,
761  bool use_collections,
762  float scale_thickness,
763  float sample)
764 {
765  if (ob->type != OB_CURVE) {
766  BKE_reportf(reports,
767  RPT_ERROR,
768  "Object '%s' is not valid for this operation! Only curves are supported",
769  ob->id.name + 2);
770  return false;
771  }
772  Main *bmain = CTX_data_main(C);
774 
776  bmain, scene, ob_gpencil, ob, use_collections, scale_thickness, sample);
777 
779 
780  return true;
781 }
782 #else /* RNA_RUNTIME */
783 
785 {
786  FunctionRNA *func;
787  PropertyRNA *parm;
788 
789  static const EnumPropertyItem mesh_type_items[] = {
790  {eModifierMode_Realtime, "PREVIEW", 0, "Preview", "Apply modifier preview settings"},
791  {eModifierMode_Render, "RENDER", 0, "Render", "Apply modifier render settings"},
792  {0, NULL, 0, NULL, NULL},
793  };
794 
795 # ifndef NDEBUG
796  static const EnumPropertyItem mesh_dm_info_items[] = {
797  {0, "SOURCE", 0, "Source", "Source mesh"},
798  {1, "DEFORM", 0, "Deform", "Objects deform mesh"},
799  {2, "FINAL", 0, "Final", "Objects final mesh"},
800  {0, NULL, 0, NULL, NULL},
801  };
802 # endif
803 
804  /* Special wrapper to access the base selection value */
805  func = RNA_def_function(srna, "select_get", "rna_Object_select_get");
807  func, "Test if the object is selected. The selection state is per view layer");
809  parm = RNA_def_pointer(
810  func, "view_layer", "ViewLayer", "", "Use this instead of the active view layer");
811  parm = RNA_def_boolean(func, "result", 0, "", "Object selected");
812  RNA_def_function_return(func, parm);
813 
814  func = RNA_def_function(srna, "select_set", "rna_Object_select_set");
816  func, "Select or deselect the object. The selection state is per view layer");
818  parm = RNA_def_boolean(func, "state", 0, "", "Selection state to define");
820  parm = RNA_def_pointer(
821  func, "view_layer", "ViewLayer", "", "Use this instead of the active view layer");
822 
823  func = RNA_def_function(srna, "hide_get", "rna_Object_hide_get");
825  func,
826  "Test if the object is hidden for viewport editing. This hiding state is per view layer");
828  parm = RNA_def_pointer(
829  func, "view_layer", "ViewLayer", "", "Use this instead of the active view layer");
830  parm = RNA_def_boolean(func, "result", 0, "", "Object hidden");
831  RNA_def_function_return(func, parm);
832 
833  func = RNA_def_function(srna, "hide_set", "rna_Object_hide_set");
835  func, "Hide the object for viewport editing. This hiding state is per view layer");
837  parm = RNA_def_boolean(func, "state", 0, "", "Hide state to define");
839  parm = RNA_def_pointer(
840  func, "view_layer", "ViewLayer", "", "Use this instead of the active view layer");
841 
842  func = RNA_def_function(srna, "visible_get", "rna_Object_visible_get");
844  "Test if the object is visible in the 3D viewport, taking into "
845  "account all visibility settings");
847  parm = RNA_def_pointer(
848  func, "view_layer", "ViewLayer", "", "Use this instead of the active view layer");
849  parm = RNA_def_pointer(
850  func, "viewport", "SpaceView3D", "", "Use this instead of the active 3D viewport");
851  parm = RNA_def_boolean(func, "result", 0, "", "Object visible");
852  RNA_def_function_return(func, parm);
853 
854  func = RNA_def_function(srna, "holdout_get", "rna_Object_holdout_get");
855  RNA_def_function_ui_description(func, "Test if object is masked in the view layer");
857  parm = RNA_def_pointer(
858  func, "view_layer", "ViewLayer", "", "Use this instead of the active view layer");
859  parm = RNA_def_boolean(func, "result", 0, "", "Object holdout");
860  RNA_def_function_return(func, parm);
861 
862  func = RNA_def_function(srna, "indirect_only_get", "rna_Object_indirect_only_get");
864  "Test if object is set to contribute only indirectly (through "
865  "shadows and reflections) in the view layer");
867  parm = RNA_def_pointer(
868  func, "view_layer", "ViewLayer", "", "Use this instead of the active view layer");
869  parm = RNA_def_boolean(func, "result", 0, "", "Object indirect only");
870  RNA_def_function_return(func, parm);
871 
872  /* Local View */
873  func = RNA_def_function(srna, "local_view_get", "rna_Object_local_view_get");
874  RNA_def_function_ui_description(func, "Get the local view state for this object");
876  parm = RNA_def_pointer(func, "viewport", "SpaceView3D", "", "Viewport in local view");
878  parm = RNA_def_boolean(func, "result", 0, "", "Object local view state");
879  RNA_def_function_return(func, parm);
880 
881  func = RNA_def_function(srna, "local_view_set", "rna_Object_local_view_set");
882  RNA_def_function_ui_description(func, "Set the local view state for this object");
884  parm = RNA_def_pointer(func, "viewport", "SpaceView3D", "", "Viewport in local view");
886  parm = RNA_def_boolean(func, "state", 0, "", "Local view state to define");
888 
889  /* Viewport */
890  func = RNA_def_function(srna, "visible_in_viewport_get", "rna_Object_visible_in_viewport_get");
892  func, "Check for local view and local collections for this viewport and object");
893  parm = RNA_def_pointer(func, "viewport", "SpaceView3D", "", "Viewport in local collections");
895  parm = RNA_def_boolean(func, "result", 0, "", "Object viewport visibility");
896  RNA_def_function_return(func, parm);
897 
898  /* Matrix space conversion */
899  func = RNA_def_function(srna, "convert_space", "rna_Object_mat_convert_space");
901  func, "Convert (transform) the given matrix from one space to another");
903  parm = RNA_def_pointer(
904  func,
905  "pose_bone",
906  "PoseBone",
907  "",
908  "Bone to use to define spaces (may be None, in which case only the two 'WORLD' and "
909  "'LOCAL' spaces are usable)");
910  parm = RNA_def_property(func, "matrix", PROP_FLOAT, PROP_MATRIX);
912  RNA_def_property_ui_text(parm, "", "The matrix to transform");
913  parm = RNA_def_property(func, "matrix_return", PROP_FLOAT, PROP_MATRIX);
915  RNA_def_property_ui_text(parm, "", "The transformed matrix");
916  RNA_def_function_output(func, parm);
917  parm = RNA_def_enum(func,
918  "from_space",
919  space_items,
921  "",
922  "The space in which 'matrix' is currently");
923  parm = RNA_def_enum(func,
924  "to_space",
925  space_items,
927  "",
928  "The space to which you want to transform 'matrix'");
929 
930  /* Camera-related operations */
931  func = RNA_def_function(srna, "calc_matrix_camera", "rna_Object_calc_matrix_camera");
933  "Generate the camera projection matrix of this object "
934  "(mostly useful for Camera and Light types)");
935  parm = RNA_def_pointer(
936  func, "depsgraph", "Depsgraph", "", "Depsgraph to get evaluated data from");
938  parm = RNA_def_property(func, "result", PROP_FLOAT, PROP_MATRIX);
940  RNA_def_property_ui_text(parm, "", "The camera projection matrix");
941  RNA_def_function_output(func, parm);
942  parm = RNA_def_int(func, "x", 1, 0, INT_MAX, "", "Width of the render area", 0, 10000);
943  parm = RNA_def_int(func, "y", 1, 0, INT_MAX, "", "Height of the render area", 0, 10000);
944  parm = RNA_def_float(
945  func, "scale_x", 1.0f, 1.0e-6f, FLT_MAX, "", "Width scaling factor", 1.0e-2f, 100.0f);
946  parm = RNA_def_float(
947  func, "scale_y", 1.0f, 1.0e-6f, FLT_MAX, "", "Height scaling factor", 1.0e-2f, 100.0f);
948 
949  func = RNA_def_function(srna, "camera_fit_coords", "rna_Object_camera_fit_coords");
951  "Compute the coordinate (and scale for ortho cameras) "
952  "given object should be to 'see' all given coordinates");
953  parm = RNA_def_pointer(
954  func, "depsgraph", "Depsgraph", "", "Depsgraph to get evaluated data from");
956  parm = RNA_def_float_array(func,
957  "coordinates",
958  1,
959  NULL,
960  -FLT_MAX,
961  FLT_MAX,
962  "",
963  "Coordinates to fit in",
964  -FLT_MAX,
965  FLT_MAX);
967  parm = RNA_def_property(func, "co_return", PROP_FLOAT, PROP_XYZ);
968  RNA_def_property_array(parm, 3);
969  RNA_def_property_ui_text(parm, "", "The location to aim to be able to see all given points");
971  parm = RNA_def_property(func, "scale_return", PROP_FLOAT, PROP_NONE);
973  parm, "", "The ortho scale to aim to be able to see all given points (if relevant)");
975 
976  /* mesh */
977  func = RNA_def_function(srna, "to_mesh", "rna_Object_to_mesh");
979  func,
980  "Create a Mesh data-block from the current state of the object. The object owns the "
981  "data-block. To force free it use to_mesh_clear(). "
982  "The result is temporary and can not be used by objects from the main database");
984  RNA_def_boolean(func,
985  "preserve_all_data_layers",
986  false,
987  "",
988  "Preserve all data layers in the mesh, like UV maps and vertex groups. "
989  "By default Blender only computes the subset of data layers needed for viewport "
990  "display and rendering, for better performance");
992  func,
993  "depsgraph",
994  "Depsgraph",
995  "Dependency Graph",
996  "Evaluated dependency graph which is required when preserve_all_data_layers is true");
997  parm = RNA_def_pointer(func, "mesh", "Mesh", "", "Mesh created from object");
998  RNA_def_function_return(func, parm);
999 
1000  func = RNA_def_function(srna, "to_mesh_clear", "rna_Object_to_mesh_clear");
1001  RNA_def_function_ui_description(func, "Clears mesh data-block created by to_mesh()");
1002 
1003  /* curve */
1004  func = RNA_def_function(srna, "to_curve", "rna_Object_to_curve");
1006  func,
1007  "Create a Curve data-block from the current state of the object. This only works for curve "
1008  "and text objects. The object owns the data-block. To force free it, use to_curve_clear(). "
1009  "The result is temporary and can not be used by objects from the main database");
1011  parm = RNA_def_pointer(
1012  func, "depsgraph", "Depsgraph", "Dependency Graph", "Evaluated dependency graph");
1014  RNA_def_boolean(func,
1015  "apply_modifiers",
1016  false,
1017  "",
1018  "Apply the deform modifiers on the control points of the curve. This is only "
1019  "supported for curve objects");
1020  parm = RNA_def_pointer(func, "curve", "Curve", "", "Curve created from object");
1021  RNA_def_function_return(func, parm);
1022 
1023  func = RNA_def_function(srna, "to_curve_clear", "rna_Object_to_curve_clear");
1024  RNA_def_function_ui_description(func, "Clears curve data-block created by to_curve()");
1025 
1026  /* Armature */
1027  func = RNA_def_function(srna, "find_armature", "BKE_modifiers_is_deformed_by_armature");
1029  func, "Find armature influencing this object as a parent or via a modifier");
1030  parm = RNA_def_pointer(
1031  func, "ob_arm", "Object", "", "Armature object influencing this object or NULL");
1032  RNA_def_function_return(func, parm);
1033 
1034  /* Shape key */
1035  func = RNA_def_function(srna, "shape_key_add", "rna_Object_shape_key_add");
1036  RNA_def_function_ui_description(func, "Add shape key to this object");
1038  RNA_def_string(func, "name", "Key", 0, "", "Unique name for the new keyblock"); /* optional */
1039  RNA_def_boolean(func, "from_mix", 1, "", "Create new shape from existing mix of shapes");
1040  parm = RNA_def_pointer(func, "key", "ShapeKey", "", "New shape keyblock");
1042  RNA_def_function_return(func, parm);
1043 
1044  func = RNA_def_function(srna, "shape_key_remove", "rna_Object_shape_key_remove");
1045  RNA_def_function_ui_description(func, "Remove a Shape Key from this object");
1047  parm = RNA_def_pointer(func, "key", "ShapeKey", "", "Keyblock to be removed");
1050 
1051  func = RNA_def_function(srna, "shape_key_clear", "rna_Object_shape_key_clear");
1052  RNA_def_function_ui_description(func, "Remove all Shape Keys from this object");
1054 
1055  /* Ray Cast */
1056  func = RNA_def_function(srna, "ray_cast", "rna_Object_ray_cast");
1058  func,
1059  "Cast a ray onto evaluated geometry, in object space "
1060  "(using context's or provided depsgraph to get evaluated mesh if needed)");
1062 
1063  /* ray start and end */
1064  parm = RNA_def_float_vector(func,
1065  "origin",
1066  3,
1067  NULL,
1068  -FLT_MAX,
1069  FLT_MAX,
1070  "",
1071  "Origin of the ray, in object space",
1072  -1e4,
1073  1e4);
1075  parm = RNA_def_float_vector(func,
1076  "direction",
1077  3,
1078  NULL,
1079  -FLT_MAX,
1080  FLT_MAX,
1081  "",
1082  "Direction of the ray, in object space",
1083  -1e4,
1084  1e4);
1086  RNA_def_float(func,
1087  "distance",
1089  0.0,
1091  "",
1092  "Maximum distance",
1093  0.0,
1095  parm = RNA_def_pointer(
1096  func,
1097  "depsgraph",
1098  "Depsgraph",
1099  "",
1100  "Depsgraph to use to get evaluated data, when called from original object "
1101  "(only needed if current Context's depsgraph is not suitable)");
1103 
1104  /* return location and normal */
1105  parm = RNA_def_boolean(func, "result", 0, "", "Whether the ray successfully hit the geometry");
1106  RNA_def_function_output(func, parm);
1107  parm = RNA_def_float_vector(func,
1108  "location",
1109  3,
1110  NULL,
1111  -FLT_MAX,
1112  FLT_MAX,
1113  "Location",
1114  "The hit location of this ray cast",
1115  -1e4,
1116  1e4);
1118  RNA_def_function_output(func, parm);
1119  parm = RNA_def_float_vector(func,
1120  "normal",
1121  3,
1122  NULL,
1123  -FLT_MAX,
1124  FLT_MAX,
1125  "Normal",
1126  "The face normal at the ray cast hit location",
1127  -1e4,
1128  1e4);
1130  RNA_def_function_output(func, parm);
1131  parm = RNA_def_int(
1132  func, "index", 0, 0, 0, "", "The face index, -1 when original data isn't available", 0, 0);
1133  RNA_def_function_output(func, parm);
1134 
1135  /* Nearest Point */
1136  func = RNA_def_function(srna, "closest_point_on_mesh", "rna_Object_closest_point_on_mesh");
1138  func,
1139  "Find the nearest point on evaluated geometry, in object space "
1140  "(using context's or provided depsgraph to get evaluated mesh if needed)");
1142 
1143  /* location of point for test and max distance */
1144  parm = RNA_def_float_vector(func,
1145  "origin",
1146  3,
1147  NULL,
1148  -FLT_MAX,
1149  FLT_MAX,
1150  "",
1151  "Point to find closest geometry from (in object space)",
1152  -1e4,
1153  1e4);
1155  /* default is sqrt(FLT_MAX) */
1156  RNA_def_float(
1157  func, "distance", 1.844674352395373e+19, 0.0, FLT_MAX, "", "Maximum distance", 0.0, FLT_MAX);
1158  parm = RNA_def_pointer(
1159  func,
1160  "depsgraph",
1161  "Depsgraph",
1162  "",
1163  "Depsgraph to use to get evaluated data, when called from original object "
1164  "(only needed if current Context's depsgraph is not suitable)");
1166 
1167  /* return location and normal */
1168  parm = RNA_def_boolean(func, "result", 0, "", "Whether closest point on geometry was found");
1169  RNA_def_function_output(func, parm);
1170  parm = RNA_def_float_vector(func,
1171  "location",
1172  3,
1173  NULL,
1174  -FLT_MAX,
1175  FLT_MAX,
1176  "Location",
1177  "The location on the object closest to the point",
1178  -1e4,
1179  1e4);
1181  RNA_def_function_output(func, parm);
1182  parm = RNA_def_float_vector(func,
1183  "normal",
1184  3,
1185  NULL,
1186  -FLT_MAX,
1187  FLT_MAX,
1188  "Normal",
1189  "The face normal at the closest point",
1190  -1e4,
1191  1e4);
1193  RNA_def_function_output(func, parm);
1194 
1195  parm = RNA_def_int(
1196  func, "index", 0, 0, 0, "", "The face index, -1 when original data isn't available", 0, 0);
1197  RNA_def_function_output(func, parm);
1198 
1199  /* View */
1200 
1201  /* utility function for checking if the object is modified */
1202  func = RNA_def_function(srna, "is_modified", "rna_Object_is_modified");
1204  "Determine if this object is modified from the base mesh data");
1205  parm = RNA_def_pointer(func, "scene", "Scene", "", "Scene in which to check the object");
1207  parm = RNA_def_enum(func, "settings", mesh_type_items, 0, "", "Modifier settings to apply");
1209  parm = RNA_def_boolean(func, "result", 0, "", "Whether the object is modified");
1210  RNA_def_function_return(func, parm);
1211 
1212  func = RNA_def_function(srna, "is_deform_modified", "rna_Object_is_deform_modified");
1214  func, "Determine if this object is modified by a deformation from the base mesh data");
1215  parm = RNA_def_pointer(func, "scene", "Scene", "", "Scene in which to check the object");
1217  parm = RNA_def_enum(func, "settings", mesh_type_items, 0, "", "Modifier settings to apply");
1219  parm = RNA_def_boolean(func, "result", 0, "", "Whether the object is deform-modified");
1220  RNA_def_function_return(func, parm);
1221 
1222 # ifndef NDEBUG
1223  /* mesh */
1224  func = RNA_def_function(srna, "dm_info", "rna_Object_me_eval_info");
1226  func,
1227  "Returns a string for original/evaluated mesh data (debug builds only, "
1228  "using context's or provided depsgraph to get evaluated mesh if needed)");
1230 
1231  parm = RNA_def_enum(func, "type", mesh_dm_info_items, 0, "", "Modifier settings to apply");
1233  parm = RNA_def_pointer(
1234  func,
1235  "depsgraph",
1236  "Depsgraph",
1237  "",
1238  "Depsgraph to use to get evaluated data, when called from original object "
1239  "(only needed if current Context's depsgraph is not suitable)");
1241  /* weak!, no way to return dynamic string type */
1242  parm = RNA_def_string(func, "result", NULL, 16384, "", "Requested information");
1243  RNA_def_parameter_flags(parm, PROP_THICK_WRAP, 0); /* needed for string return value */
1244  RNA_def_function_output(func, parm);
1245 # endif /* NDEBUG */
1246 
1247  func = RNA_def_function(srna, "update_from_editmode", "rna_Object_update_from_editmode");
1248  RNA_def_function_ui_description(func, "Load the objects edit-mode data into the object data");
1250  parm = RNA_def_boolean(func, "result", 0, "", "Success");
1251  RNA_def_function_return(func, parm);
1252 
1253  func = RNA_def_function(srna, "cache_release", "BKE_object_free_caches");
1255  "Release memory used by caches associated with this object. "
1256  "Intended to be used by render engines only");
1257 
1258  /* Convert curve object to gpencil strokes. */
1259  func = RNA_def_function(srna, "generate_gpencil_strokes", "rna_Object_generate_gpencil_strokes");
1260  RNA_def_function_ui_description(func, "Convert a curve object to grease pencil strokes.");
1262 
1263  parm = RNA_def_pointer(func,
1264  "grease_pencil_object",
1265  "Object",
1266  "",
1267  "Grease Pencil object used to create new strokes");
1269  parm = RNA_def_boolean(func, "use_collections", true, "", "Use Collections");
1270  parm = RNA_def_float(
1271  func, "scale_thickness", 1.0f, 0.0f, FLT_MAX, "", "Thickness scaling factor", 0.0f, 100.0f);
1272  parm = RNA_def_float(
1273  func, "sample", 0.0f, 0.0f, FLT_MAX, "", "Sample distance, zero to disable", 0.0f, 100.0f);
1274  parm = RNA_def_boolean(func, "result", 0, "", "Result");
1275  RNA_def_function_return(func, parm);
1276 }
1277 
1278 #endif /* RNA_RUNTIME */
BVHTree * BKE_bvhtree_from_mesh_get(struct BVHTreeFromMesh *data, struct Mesh *mesh, const BVHCacheType bvh_cache_type, const int tree_type)
Definition: bvhutils.c:1413
void free_bvhtree_from_mesh(struct BVHTreeFromMesh *data)
Definition: bvhutils.c:1701
@ BVHTREE_FROM_LOOPTRI
Definition: BKE_bvhutils.h:93
void BKE_camera_params_init(CameraParams *params)
Definition: camera.c:271
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)
Definition: camera.c:370
void BKE_camera_params_compute_matrix(CameraParams *params)
Definition: camera.c:436
void BKE_constraint_mat_convertspace(struct Object *ob, struct bPoseChannel *pchan, struct bConstraintOb *cob, float mat[4][4], short from, short to, const bool keep_scale)
Definition: constraint.c:264
struct Scene * CTX_data_scene(const bContext *C)
Definition: context.c:1034
struct ViewLayer * CTX_data_view_layer(const bContext *C)
Definition: context.c:1044
struct Depsgraph * CTX_data_ensure_evaluated_depsgraph(const bContext *C)
Definition: context.c:1424
struct View3D * CTX_wm_view3d(const bContext *C)
Definition: context.c:760
struct Main * CTX_data_main(const bContext *C)
Definition: context.c:1018
CustomData interface, see also DNA_customdata_types.h.
void * CustomData_get_layer(const struct CustomData *data, int type)
#define G_MAIN
Definition: BKE_global.h:232
void BKE_gpencil_convert_curve(struct Main *bmain, struct Scene *scene, struct Object *ob_gp, struct Object *ob_cu, const bool use_collections, const float scale_thickness, const float sample)
struct Key * BKE_key_from_object(const struct Object *ob)
struct Base * BKE_view_layer_base_find(struct ViewLayer *view_layer, struct Object *ob)
Definition: layer.c:394
bool BKE_object_is_visible_in_viewport(const struct View3D *v3d, const struct Object *ob)
void BKE_layer_collection_sync(const struct Scene *scene, struct ViewLayer *view_layer)
char * BKE_mesh_runtime_debug_info(struct Mesh *me_eval)
Definition: mesh_runtime.c:302
General operations, lookup, etc. for blender objects.
void BKE_object_to_mesh_clear(struct Object *object)
Definition: object.c:5673
struct KeyBlock * BKE_object_shapekey_insert(struct Main *bmain, struct Object *ob, const char *name, const bool from_mix)
Definition: object.c:4726
int BKE_object_is_deform_modified(struct Scene *scene, struct Object *ob)
Definition: object.c:5018
struct Mesh * BKE_object_get_evaluated_mesh(struct Object *object)
Definition: object.c:4459
struct Curve * BKE_object_to_curve(struct Object *object, struct Depsgraph *depsgraph, bool apply_modifiers)
Definition: object.c:5682
struct Mesh * BKE_object_to_mesh(struct Depsgraph *depsgraph, struct Object *object, bool preserve_all_data_layers)
Definition: object.c:5664
struct BoundBox * BKE_object_boundbox_get(struct Object *ob)
Definition: object.c:3817
void BKE_object_to_curve_clear(struct Object *object)
Definition: object.c:5691
int BKE_object_is_modified(struct Scene *scene, struct Object *ob)
Definition: object.c:4869
bool BKE_object_shapekey_remove(struct Main *bmain, struct Object *ob, struct KeyBlock *kb)
Definition: object.c:4775
bool BKE_object_shapekey_free(struct Main *bmain, struct Object *ob)
Definition: object.c:4758
void BKE_report(ReportList *reports, ReportType type, const char *message)
Definition: report.c:104
void BKE_reportf(ReportList *reports, ReportType type, const char *format,...) ATTR_PRINTF_FORMAT(3
#define BVH_RAYCAST_DIST_MAX
Definition: BLI_kdopbvh.h:105
int BLI_bvhtree_ray_cast(BVHTree *tree, const float co[3], const float dir[3], float radius, BVHTreeRayHit *hit, BVHTree_RayCastCallback callback, void *userdata)
Definition: BLI_kdopbvh.c:1984
int BLI_bvhtree_find_nearest(BVHTree *tree, const float co[3], BVHTreeNearest *nearest, BVHTree_NearestPointCallback callback, void *userdata)
Definition: BLI_kdopbvh.c:1654
int BLI_findindex(const struct ListBase *listbase, const void *vlink) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
void * BLI_findlink(const struct ListBase *listbase, int number) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
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)
Definition: math_geom.c:3308
void copy_m4_m4(float m1[4][4], const float m2[4][4])
Definition: math_matrix.c:95
MINLINE float normalize_v3(float r[3])
MINLINE void copy_v3_v3(float r[3], const float a[3])
MINLINE void zero_v3(float r[3])
#define UNUSED(x)
#define SET_FLAG_FROM_TEST(value, test, flag)
#define ELEM(...)
struct Depsgraph Depsgraph
Definition: DEG_depsgraph.h:51
void DEG_id_tag_update(struct ID *id, int flag)
void DEG_relations_tag_update(struct Main *bmain)
struct Object * DEG_get_evaluated_object(const struct Depsgraph *depsgraph, struct Object *object)
@ ID_RECALC_SELECT
Definition: DNA_ID.h:638
@ ID_RECALC_GEOMETRY
Definition: DNA_ID.h:611
@ ID_RECALC_BASE_FLAGS
Definition: DNA_ID.h:641
@ CONSTRAINT_SPACE_CUSTOM
@ CONSTRAINT_SPACE_POSE
@ CONSTRAINT_SPACE_WORLD
@ CONSTRAINT_SPACE_LOCAL
@ CONSTRAINT_SPACE_PARLOCAL
@ CD_ORIGINDEX
@ BASE_HIDDEN
@ BASE_INDIRECT_ONLY
@ BASE_HOLDOUT
@ BASE_SELECTED
@ eModifierMode_Render
@ eModifierMode_Realtime
Object is a sort of wrapper for general info.
@ OB_MBALL
@ OB_SURF
@ OB_FONT
@ OB_MESH
@ OB_CURVE
#define BASE_VISIBLE(v3d, base)
#define WEIGHT_REPLACE
Definition: ED_mesh.h:345
#define WEIGHT_ADD
Definition: ED_mesh.h:346
#define WEIGHT_SUBTRACT
Definition: ED_mesh.h:347
void ED_object_base_select(struct Base *base, eObjectSelect_Mode mode)
Definition: object_select.c:98
bool ED_object_editmode_load(struct Main *bmain, struct Object *obedit)
Definition: object_edit.c:667
@ BA_DESELECT
Definition: ED_object.h:146
@ BA_SELECT
Definition: ED_object.h:147
void ED_outliner_select_sync_from_object_tag(struct bContext *C)
Definition: outliner_sync.c:56
void ED_area_tag_redraw(ScrArea *area)
Definition: area.c:745
ScrArea * ED_screen_area_find_with_spacedata(const bScreen *screen, const struct SpaceLink *sl, const bool only_visible)
struct wmWindow * ED_screen_window_find(const struct bScreen *screen, const struct wmWindowManager *wm)
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei width
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum type
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei height
Read Guarded memory(de)allocation.
StructRNA RNA_ShapeKey
#define RNA_POINTER_INVALIDATE(ptr)
Definition: RNA_access.h:1425
@ PARM_RNAPTR
Definition: RNA_types.h:339
@ PARM_REQUIRED
Definition: RNA_types.h:337
@ PARM_OUTPUT
Definition: RNA_types.h:338
@ FUNC_USE_REPORTS
Definition: RNA_types.h:578
@ FUNC_USE_MAIN
Definition: RNA_types.h:576
@ FUNC_USE_CONTEXT
Definition: RNA_types.h:577
@ PROP_FLOAT
Definition: RNA_types.h:75
@ PROP_THICK_WRAP
Definition: RNA_types.h:270
@ PROP_DYNAMIC
Definition: RNA_types.h:275
@ PROP_NEVER_NULL
Definition: RNA_types.h:225
@ PROP_MATRIX
Definition: RNA_types.h:144
@ PROP_XYZ
Definition: RNA_types.h:148
@ PROP_NONE
Definition: RNA_types.h:113
#define C
Definition: RandGen.cpp:39
#define ND_DRAW
Definition: WM_types.h:362
#define ND_DATA
Definition: WM_types.h:408
#define ND_OB_SELECT
Definition: WM_types.h:342
#define NC_SCENE
Definition: WM_types.h:279
#define NC_GPENCIL
Definition: WM_types.h:300
#define NC_OBJECT
Definition: WM_types.h:280
StackEntry * from
Scene scene
const Depsgraph * depsgraph
static ushort indices[]
uiWidgetBaseParameters params[MAX_WIDGET_BASE_BATCH]
void(* MEM_freeN)(void *vmemh)
Definition: mallocn.c:41
static ulong state[N]
INLINE Rall1d< T, V, S > cos(const Rall1d< T, V, S > &arg)
Definition: rall1d.h:319
static void area(int d1, int d2, int e1, int e2, float weights[2])
static void sample(SocketReader *reader, int x, int y, float color[4])
return ret
void RNA_pointer_create(ID *id, StructRNA *type, void *data, PointerRNA *r_ptr)
Definition: rna_access.c:146
const PointerRNA PointerRNA_NULL
Definition: rna_access.c:71
bool RNA_enum_identifier(const EnumPropertyItem *item, const int value, const char **r_identifier)
Definition: rna_access.c:1830
PropertyRNA * RNA_def_float(StructOrFunctionRNA *cont_, const char *identifier, float default_value, float hardmin, float hardmax, const char *ui_name, const char *ui_description, float softmin, float softmax)
Definition: rna_define.c:3825
PropertyRNA * RNA_def_boolean(StructOrFunctionRNA *cont_, const char *identifier, bool default_value, const char *ui_name, const char *ui_description)
Definition: rna_define.c:3481
PropertyRNA * RNA_def_pointer(StructOrFunctionRNA *cont_, const char *identifier, const char *type, const char *ui_name, const char *ui_description)
Definition: rna_define.c:4159
void RNA_def_parameter_clear_flags(PropertyRNA *prop, PropertyFlag flag_property, ParameterFlag flag_parameter)
Definition: rna_define.c:1555
void RNA_def_function_return(FunctionRNA *func, PropertyRNA *ret)
Definition: rna_define.c:4302
PropertyRNA * RNA_def_float_array(StructOrFunctionRNA *cont_, const char *identifier, int len, const float *default_value, float hardmin, float hardmax, const char *ui_name, const char *ui_description, float softmin, float softmax)
Definition: rna_define.c:4065
void RNA_def_property_ui_text(PropertyRNA *prop, const char *name, const char *description)
Definition: rna_define.c:1676
FunctionRNA * RNA_def_function(StructRNA *srna, const char *identifier, const char *call)
Definition: rna_define.c:4262
void RNA_def_function_output(FunctionRNA *UNUSED(func), PropertyRNA *ret)
Definition: rna_define.c:4327
void RNA_def_property_multi_array(PropertyRNA *prop, int dimension, const int length[])
Definition: rna_define.c:1629
PropertyRNA * RNA_def_float_vector(StructOrFunctionRNA *cont_, const char *identifier, int len, const float *default_value, float hardmin, float hardmax, const char *ui_name, const char *ui_description, float softmin, float softmax)
Definition: rna_define.c:3851
void RNA_def_property_array(PropertyRNA *prop, int length)
Definition: rna_define.c:1568
void RNA_def_function_ui_description(FunctionRNA *func, const char *description)
Definition: rna_define.c:4337
const int rna_matrix_dimsize_4x4[]
Definition: rna_define.c:1626
PropertyRNA * RNA_def_property(StructOrFunctionRNA *cont_, const char *identifier, int type, int subtype)
Definition: rna_define.c:1279
void RNA_def_function_flag(FunctionRNA *func, int flag)
Definition: rna_define.c:4332
PropertyRNA * RNA_def_string(StructOrFunctionRNA *cont_, const char *identifier, const char *default_value, int maxlen, const char *ui_name, const char *ui_description)
Definition: rna_define.c:3675
PropertyRNA * RNA_def_int(StructOrFunctionRNA *cont_, const char *identifier, int default_value, int hardmin, int hardmax, const char *ui_name, const char *ui_description, int softmin, int softmax)
Definition: rna_define.c:3585
PropertyRNA * RNA_def_enum(StructOrFunctionRNA *cont_, const char *identifier, const EnumPropertyItem *items, int default_value, const char *ui_name, const char *ui_description)
Definition: rna_define.c:3771
void RNA_def_parameter_flags(PropertyRNA *prop, PropertyFlag flag_property, ParameterFlag flag_parameter)
Definition: rna_define.c:1547
static const EnumPropertyItem space_items[]
void RNA_api_object(StructRNA *srna)
BVHTree_RayCastCallback raycast_callback
Definition: BKE_bvhutils.h:70
struct BVHTree * tree
Definition: BKE_bvhutils.h:66
BVHTree_NearestPointCallback nearest_callback
Definition: BKE_bvhutils.h:69
const struct MLoopTri * looptri
Definition: BKE_bvhutils.h:77
float co[3]
Definition: BLI_kdopbvh.h:59
float no[3]
Definition: BLI_kdopbvh.h:62
float co[3]
Definition: BLI_kdopbvh.h:84
float no[3]
Definition: BLI_kdopbvh.h:86
short flag
unsigned short local_view_bits
float vec[8][3]
Definition: DNA_ID.h:273
char name[66]
Definition: DNA_ID.h:283
ListBase block
unsigned int poly
Definition: BKE_main.h:116
struct MDeformVert * dvert
int totvert
struct Mesh * mesh_deform_eval
struct ID * data_eval
ListBase defbase
Object_Runtime runtime
unsigned short base_local_view_bits
void * data
void * data
Definition: RNA_types.h:52
struct ID * owner_id
Definition: RNA_types.h:50
unsigned short local_view_uuid
struct View3D * localvd
char name[64]
struct Scene * scene
__forceinline const avxb select(const avxb &m, const avxb &t, const avxb &f)
Definition: util_avxb.h:167
ccl_device_inline float distance(const float2 &a, const float2 &b)
void WM_main_add_notifier(unsigned int 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)
Definition: wm_window.c:2286