Blender  V3.3
rna_object.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 
7 #include <stdio.h>
8 #include <stdlib.h>
9 
10 #include "DNA_action_types.h"
11 #include "DNA_brush_types.h"
12 #include "DNA_collection_types.h"
13 #include "DNA_customdata_types.h"
15 #include "DNA_lightprobe_types.h"
16 #include "DNA_material_types.h"
17 #include "DNA_mesh_types.h"
18 #include "DNA_meta_types.h"
19 #include "DNA_object_force_types.h"
20 #include "DNA_object_types.h"
21 #include "DNA_scene_types.h"
22 #include "DNA_shader_fx_types.h"
23 #include "DNA_workspace_types.h"
24 
25 #include "BLI_math.h"
26 #include "BLI_utildefines.h"
27 
28 #include "BLT_translation.h"
29 
30 #include "BKE_camera.h"
31 #include "BKE_collection.h"
32 #include "BKE_editlattice.h"
33 #include "BKE_editmesh.h"
34 #include "BKE_layer.h"
35 #include "BKE_object_deform.h"
36 #include "BKE_object_facemap.h"
37 #include "BKE_paint.h"
38 
39 #include "RNA_access.h"
40 #include "RNA_define.h"
41 #include "RNA_enum_types.h"
42 
43 #include "rna_internal.h"
44 
45 #include "BLI_sys_types.h" /* needed for intptr_t used in ED_mesh.h */
46 #include "ED_mesh.h"
47 
48 #include "WM_api.h"
49 #include "WM_types.h"
50 
51 #include "DEG_depsgraph_query.h"
52 
54  {OB_MODE_OBJECT, "OBJECT", ICON_OBJECT_DATAMODE, "Object Mode", ""},
55  {OB_MODE_EDIT, "EDIT", ICON_EDITMODE_HLT, "Edit Mode", ""},
56  {OB_MODE_POSE, "POSE", ICON_POSE_HLT, "Pose Mode", ""},
57  {OB_MODE_SCULPT, "SCULPT", ICON_SCULPTMODE_HLT, "Sculpt Mode", ""},
58  {OB_MODE_VERTEX_PAINT, "VERTEX_PAINT", ICON_VPAINT_HLT, "Vertex Paint", ""},
59  {OB_MODE_WEIGHT_PAINT, "WEIGHT_PAINT", ICON_WPAINT_HLT, "Weight Paint", ""},
60  {OB_MODE_TEXTURE_PAINT, "TEXTURE_PAINT", ICON_TPAINT_HLT, "Texture Paint", ""},
61  {OB_MODE_PARTICLE_EDIT, "PARTICLE_EDIT", ICON_PARTICLEMODE, "Particle Edit", ""},
63  "EDIT_GPENCIL",
64  ICON_EDITMODE_HLT,
65  "Edit Mode",
66  "Edit Grease Pencil Strokes"},
68  "SCULPT_GPENCIL",
69  ICON_SCULPTMODE_HLT,
70  "Sculpt Mode",
71  "Sculpt Grease Pencil Strokes"},
73  "PAINT_GPENCIL",
74  ICON_GREASEPENCIL,
75  "Draw Mode",
76  "Paint Grease Pencil Strokes"},
78  "WEIGHT_GPENCIL",
79  ICON_WPAINT_HLT,
80  "Weight Paint",
81  "Grease Pencil Weight Paint Strokes"},
83  "VERTEX_GPENCIL",
84  ICON_VPAINT_HLT,
85  "Vertex Paint",
86  "Grease Pencil Vertex Paint Strokes"},
87  {OB_MODE_SCULPT_CURVES, "SCULPT_CURVES", ICON_SCULPTMODE_HLT, "Sculpt Mode", ""},
88  {0, NULL, 0, NULL, NULL},
89 };
90 
91 /* Same as above, but with names that distinguish grease pencil. */
93  {OB_MODE_OBJECT, "OBJECT", ICON_OBJECT_DATAMODE, "Object Mode", ""},
94  {OB_MODE_EDIT, "EDIT", ICON_EDITMODE_HLT, "Edit Mode", ""},
95  {OB_MODE_POSE, "POSE", ICON_POSE_HLT, "Pose Mode", ""},
96  {OB_MODE_SCULPT, "SCULPT", ICON_SCULPTMODE_HLT, "Sculpt Mode", ""},
97  {OB_MODE_VERTEX_PAINT, "VERTEX_PAINT", ICON_VPAINT_HLT, "Vertex Paint", ""},
98  {OB_MODE_WEIGHT_PAINT, "WEIGHT_PAINT", ICON_WPAINT_HLT, "Weight Paint", ""},
99  {OB_MODE_TEXTURE_PAINT, "TEXTURE_PAINT", ICON_TPAINT_HLT, "Texture Paint", ""},
100  {OB_MODE_PARTICLE_EDIT, "PARTICLE_EDIT", ICON_PARTICLEMODE, "Particle Edit", ""},
102  "EDIT_GPENCIL",
103  ICON_EDITMODE_HLT,
104  "Grease Pencil Edit Mode",
105  "Edit Grease Pencil Strokes"},
107  "SCULPT_GPENCIL",
108  ICON_SCULPTMODE_HLT,
109  "Grease Pencil Sculpt Mode",
110  "Sculpt Grease Pencil Strokes"},
112  "PAINT_GPENCIL",
113  ICON_GREASEPENCIL,
114  "Grease Pencil Draw",
115  "Paint Grease Pencil Strokes"},
117  "VERTEX_GPENCIL",
118  ICON_VPAINT_HLT,
119  "Grease Pencil Vertex Paint",
120  "Grease Pencil Vertex Paint Strokes"},
122  "WEIGHT_GPENCIL",
123  ICON_WPAINT_HLT,
124  "Grease Pencil Weight Paint",
125  "Grease Pencil Weight Paint Strokes"},
126  {0, NULL, 0, NULL, NULL},
127 };
128 
130  {OB_PLAINAXES, "PLAIN_AXES", ICON_EMPTY_AXIS, "Plain Axes", ""},
131  {OB_ARROWS, "ARROWS", ICON_EMPTY_ARROWS, "Arrows", ""},
132  {OB_SINGLE_ARROW, "SINGLE_ARROW", ICON_EMPTY_SINGLE_ARROW, "Single Arrow", ""},
133  {OB_CIRCLE, "CIRCLE", ICON_MESH_CIRCLE, "Circle", ""},
134  {OB_CUBE, "CUBE", ICON_CUBE, "Cube", ""},
135  {OB_EMPTY_SPHERE, "SPHERE", ICON_SPHERE, "Sphere", ""},
136  {OB_EMPTY_CONE, "CONE", ICON_CONE, "Cone", ""},
137  {OB_EMPTY_IMAGE, "IMAGE", ICON_FILE_IMAGE, "Image", ""},
138  {0, NULL, 0, NULL, NULL},
139 };
140 
142  {OB_EMPTY_IMAGE_DEPTH_DEFAULT, "DEFAULT", 0, "Default", ""},
143  {OB_EMPTY_IMAGE_DEPTH_FRONT, "FRONT", 0, "Front", ""},
144  {OB_EMPTY_IMAGE_DEPTH_BACK, "BACK", 0, "Back", ""},
145  {0, NULL, 0, NULL, NULL},
146 };
147 
149  {GP_EMPTY, "EMPTY", ICON_EMPTY_AXIS, "Blank", "Create an empty grease pencil object"},
150  {GP_STROKE, "STROKE", ICON_STROKE, "Stroke", "Create a simple stroke with basic colors"},
151  {GP_MONKEY, "MONKEY", ICON_MONKEY, "Monkey", "Construct a Suzanne grease pencil object"},
153  {GP_LRT_SCENE,
154  "LRT_SCENE",
155  ICON_SCENE_DATA,
156  "Scene Line Art",
157  "Quickly set up line art for the entire scene"},
159  "LRT_COLLECTION",
160  ICON_OUTLINER_COLLECTION,
161  "Collection Line Art",
162  "Quickly set up line art for the active collection"},
163  {GP_LRT_OBJECT,
164  "LRT_OBJECT",
165  ICON_OBJECT_DATA,
166  "Object Line Art",
167  "Quickly set up line art for the active object"},
168  {0, NULL, 0, NULL, NULL}};
169 
171  {PAROBJECT, "OBJECT", 0, "Object", "The object is parented to an object"},
172  {PARSKEL, "ARMATURE", 0, "Armature", ""},
173  /* PARSKEL reuse will give issues. */
174  {PARSKEL, "LATTICE", 0, "Lattice", "The object is parented to a lattice"},
175  {PARVERT1, "VERTEX", 0, "Vertex", "The object is parented to a vertex"},
176  {PARVERT3, "VERTEX_3", 0, "3 Vertices", ""},
177  {PARBONE, "BONE", 0, "Bone", "The object is parented to a bone"},
178  {0, NULL, 0, NULL, NULL},
179 };
180 
181 #define INSTANCE_ITEMS_SHARED \
182  {0, "NONE", 0, "None", ""}, \
183  {OB_DUPLIVERTS, "VERTS", 0, "Vertices", "Instantiate child objects on all vertices"}, \
184  { \
185  OB_DUPLIFACES, "FACES", 0, "Faces", "Instantiate child objects on all faces" \
186  }
187 
188 #define INSTANCE_ITEM_COLLECTION \
189  { \
190  OB_DUPLICOLLECTION, "COLLECTION", 0, "Collection", "Enable collection instancing" \
191  }
195  {0, NULL, 0, NULL, NULL},
196 };
197 #ifdef RNA_RUNTIME
198 static EnumPropertyItem instance_items_nogroup[] = {
200  {0, NULL, 0, NULL, NULL},
201 };
202 
203 static EnumPropertyItem instance_items_empty[] = {
204  {0, "NONE", 0, "None", ""},
206  {0, NULL, 0, NULL, NULL},
207 };
208 
209 static EnumPropertyItem instance_items_font[] = {
210  {0, "NONE", 0, "None", ""},
211  {OB_DUPLIVERTS, "VERTS", 0, "Vertices", "Use Object Font on characters"},
212  {0, NULL, 0, NULL, NULL},
213 };
214 #endif
215 #undef INSTANCE_ITEMS_SHARED
216 #undef INSTANCE_ITEM_COLLECTION
217 
219  {MB_BALL, "BALL", ICON_META_BALL, "Ball", ""},
220  {MB_TUBE, "CAPSULE", ICON_META_CAPSULE, "Capsule", ""},
221  {MB_PLANE, "PLANE", ICON_META_PLANE, "Plane", ""},
222  /* NOTE: typo at original definition! */
223  {MB_ELIPSOID, "ELLIPSOID", ICON_META_ELLIPSOID, "Ellipsoid", ""},
224  {MB_CUBE, "CUBE", ICON_META_CUBE, "Cube", ""},
225  {0, NULL, 0, NULL, NULL},
226 };
227 
229  {LIGHTPROBE_TYPE_CUBE, "CUBE", ICON_LIGHTPROBE_CUBEMAP, "Cube", ""},
230  {LIGHTPROBE_TYPE_PLANAR, "PLANAR", ICON_LIGHTPROBE_PLANAR, "Planar", ""},
231  {LIGHTPROBE_TYPE_GRID, "GRID", ICON_LIGHTPROBE_GRID, "Grid", ""},
232  {0, NULL, 0, NULL, NULL},
233 };
234 
235 /* used for 2 enums */
236 #define OBTYPE_CU_CURVE \
237  { \
238  OB_CURVES_LEGACY, "CURVE", ICON_OUTLINER_OB_CURVE, "Curve", "" \
239  }
240 #define OBTYPE_CU_SURF \
241  { \
242  OB_SURF, "SURFACE", ICON_OUTLINER_OB_SURFACE, "Surface", "" \
243  }
244 #define OBTYPE_CU_FONT \
245  { \
246  OB_FONT, "FONT", ICON_OUTLINER_OB_FONT, "Text", "" \
247  }
248 
250  {OB_MESH, "MESH", ICON_OUTLINER_OB_MESH, "Mesh", ""},
253  {OB_MBALL, "META", ICON_OUTLINER_OB_META, "Metaball", ""},
255  {OB_CURVES, "CURVES", ICON_OUTLINER_OB_CURVES, "Hair Curves", ""},
256  {OB_POINTCLOUD, "POINTCLOUD", ICON_OUTLINER_OB_POINTCLOUD, "Point Cloud", ""},
257  {OB_VOLUME, "VOLUME", ICON_OUTLINER_OB_VOLUME, "Volume", ""},
258  {OB_GPENCIL, "GPENCIL", ICON_OUTLINER_OB_GREASEPENCIL, "Grease Pencil", ""},
260  {OB_ARMATURE, "ARMATURE", ICON_OUTLINER_OB_ARMATURE, "Armature", ""},
261  {OB_LATTICE, "LATTICE", ICON_OUTLINER_OB_LATTICE, "Lattice", ""},
263  {OB_EMPTY, "EMPTY", ICON_OUTLINER_OB_EMPTY, "Empty", ""},
265  {OB_LAMP, "LIGHT", ICON_OUTLINER_OB_LIGHT, "Light", ""},
266  {OB_LIGHTPROBE, "LIGHT_PROBE", ICON_OUTLINER_OB_LIGHTPROBE, "Light Probe", ""},
268  {OB_CAMERA, "CAMERA", ICON_OUTLINER_OB_CAMERA, "Camera", ""},
270  {OB_SPEAKER, "SPEAKER", ICON_OUTLINER_OB_SPEAKER, "Speaker", ""},
271  {0, NULL, 0, NULL, NULL},
272 };
273 
278  {0, NULL, 0, NULL, NULL},
279 };
280 
282  {ROT_MODE_QUAT, "QUATERNION", 0, "Quaternion (WXYZ)", "No Gimbal Lock"},
283  {ROT_MODE_XYZ, "XYZ", 0, "XYZ Euler", "XYZ Rotation Order - prone to Gimbal Lock (default)"},
284  {ROT_MODE_XZY, "XZY", 0, "XZY Euler", "XZY Rotation Order - prone to Gimbal Lock"},
285  {ROT_MODE_YXZ, "YXZ", 0, "YXZ Euler", "YXZ Rotation Order - prone to Gimbal Lock"},
286  {ROT_MODE_YZX, "YZX", 0, "YZX Euler", "YZX Rotation Order - prone to Gimbal Lock"},
287  {ROT_MODE_ZXY, "ZXY", 0, "ZXY Euler", "ZXY Rotation Order - prone to Gimbal Lock"},
288  {ROT_MODE_ZYX, "ZYX", 0, "ZYX Euler", "ZYX Rotation Order - prone to Gimbal Lock"},
290  "AXIS_ANGLE",
291  0,
292  "Axis Angle",
293  "Axis Angle (W+XYZ), defines a rotation around some axis defined by 3D-Vector"},
294  {0, NULL, 0, NULL, NULL},
295 };
296 
298  {OB_POSX, "POS_X", 0, "+X", ""},
299  {OB_POSY, "POS_Y", 0, "+Y", ""},
300  {OB_POSZ, "POS_Z", 0, "+Z", ""},
301  {OB_NEGX, "NEG_X", 0, "-X", ""},
302  {OB_NEGY, "NEG_Y", 0, "-Y", ""},
303  {OB_NEGZ, "NEG_Z", 0, "-Z", ""},
304  {0, NULL, 0, NULL, NULL},
305 };
306 
307 #ifdef RNA_RUNTIME
308 
309 # include "BLI_math.h"
310 
311 # include "DNA_ID.h"
312 # include "DNA_constraint_types.h"
313 # include "DNA_gpencil_types.h"
314 # include "DNA_key_types.h"
315 # include "DNA_lattice_types.h"
316 # include "DNA_node_types.h"
317 
318 # include "BKE_armature.h"
319 # include "BKE_brush.h"
320 # include "BKE_constraint.h"
321 # include "BKE_context.h"
322 # include "BKE_curve.h"
323 # include "BKE_deform.h"
324 # include "BKE_effect.h"
325 # include "BKE_global.h"
326 # include "BKE_key.h"
327 # include "BKE_material.h"
328 # include "BKE_mesh.h"
329 # include "BKE_mesh_wrapper.h"
330 # include "BKE_modifier.h"
331 # include "BKE_object.h"
332 # include "BKE_particle.h"
333 # include "BKE_scene.h"
334 
335 # include "DEG_depsgraph.h"
336 # include "DEG_depsgraph_build.h"
337 
338 # include "ED_curve.h"
339 # include "ED_lattice.h"
340 # include "ED_object.h"
341 # include "ED_particle.h"
342 
343 static void rna_Object_internal_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
344 {
346 }
347 
348 static void rna_Object_internal_update_draw(Main *UNUSED(bmain),
349  Scene *UNUSED(scene),
350  PointerRNA *ptr)
351 {
354 }
355 
356 static void rna_Object_matrix_world_update(Main *bmain, Scene *scene, PointerRNA *ptr)
357 {
358  /* don't use compat so we get predictable rotation */
359  BKE_object_apply_mat4((Object *)ptr->owner_id, ((Object *)ptr->owner_id)->obmat, false, true);
360  rna_Object_internal_update(bmain, scene, ptr);
361 }
362 
363 static void rna_Object_hide_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
364 {
365  Object *ob = (Object *)ptr->owner_id;
370 }
371 
372 static void rna_Object_duplicator_visibility_flag_update(Main *UNUSED(bmain),
373  Scene *UNUSED(scene),
374  PointerRNA *ptr)
375 {
376  Object *ob = (Object *)ptr->owner_id;
378 }
379 
380 static void rna_MaterialIndex_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
381 {
382  Object *ob = (Object *)ptr->owner_id;
383  if (ob && ob->type == OB_GPENCIL) {
384  /* notifying material property in topbar */
386  }
387 }
388 
389 static void rna_GPencil_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
390 {
391  Object *ob = (Object *)ptr->owner_id;
392  if (ob && ob->type == OB_GPENCIL) {
393  bGPdata *gpd = (bGPdata *)ob->data;
396  }
397 }
398 
399 static void rna_Object_matrix_local_get(PointerRNA *ptr, float values[16])
400 {
401  Object *ob = (Object *)ptr->owner_id;
402  BKE_object_matrix_local_get(ob, (float(*)[4])values);
403 }
404 
405 static void rna_Object_matrix_local_set(PointerRNA *ptr, const float values[16])
406 {
407  Object *ob = (Object *)ptr->owner_id;
408  float local_mat[4][4];
409 
410  /* Localspace matrix is truly relative to the parent,
411  * but parameters stored in object are relative to parentinv matrix.
412  * Undo the parent inverse part before applying it as local matrix. */
413  if (ob->parent) {
414  float invmat[4][4];
415  invert_m4_m4(invmat, ob->parentinv);
416  mul_m4_m4m4(local_mat, invmat, (float(*)[4])values);
417  }
418  else {
419  copy_m4_m4(local_mat, (float(*)[4])values);
420  }
421 
422  /* Don't use compatible so we get predictable rotation, and do not use parenting either,
423  * because it's a local matrix! */
424  BKE_object_apply_mat4(ob, local_mat, false, false);
425 }
426 
427 static void rna_Object_matrix_basis_get(PointerRNA *ptr, float values[16])
428 {
429  Object *ob = (Object *)ptr->owner_id;
430  BKE_object_to_mat4(ob, (float(*)[4])values);
431 }
432 
433 static void rna_Object_matrix_basis_set(PointerRNA *ptr, const float values[16])
434 {
435  Object *ob = (Object *)ptr->owner_id;
436  BKE_object_apply_mat4(ob, (float(*)[4])values, false, false);
437 }
438 
439 void rna_Object_internal_update_data_impl(PointerRNA *ptr)
440 {
443 }
444 
446 {
447  rna_Object_internal_update_data_impl(ptr);
448 }
449 
450 void rna_Object_internal_update_data_dependency(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
451 {
453  rna_Object_internal_update_data_impl(ptr);
454 }
455 
456 static void rna_Object_active_shape_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
457 {
458  Object *ob = (Object *)ptr->owner_id;
459 
461  /* exit/enter editmode to get new shape */
462  switch (ob->type) {
463  case OB_MESH: {
464  Mesh *me = ob->data;
465  BMEditMesh *em = me->edit_mesh;
466  int select_mode = em->selectmode;
467  EDBM_mesh_load(bmain, ob);
468  EDBM_mesh_make(ob, select_mode, true);
469  em = me->edit_mesh;
470 
471  DEG_id_tag_update(&me->id, 0);
472 
474  break;
475  }
476  case OB_CURVES_LEGACY:
477  case OB_SURF:
478  ED_curve_editnurb_load(bmain, ob);
480  break;
481  case OB_LATTICE:
484  break;
485  }
486  }
487 
488  rna_Object_internal_update_data_impl(ptr);
489 }
490 
491 static void rna_Object_dependency_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
492 {
496 }
497 
498 void rna_Object_data_update(Main *bmain, Scene *scene, PointerRNA *ptr)
499 {
500  Object *object = (Object *)ptr->data;
501 
502  if (object->mode == OB_MODE_SCULPT) {
504  }
505 
506  rna_Object_internal_update_data_dependency(bmain, scene, ptr);
507 }
508 
509 static PointerRNA rna_Object_data_get(PointerRNA *ptr)
510 {
511  Object *ob = (Object *)ptr->data;
512  if (ob->type == OB_MESH) {
513  Mesh *me = (Mesh *)ob->data;
515  return rna_pointer_inherit_refine(ptr, &RNA_Mesh, me);
516  }
517  return rna_pointer_inherit_refine(ptr, &RNA_ID, ob->data);
518 }
519 
520 static void rna_Object_data_set(PointerRNA *ptr, PointerRNA value, struct ReportList *reports)
521 {
522  Object *ob = (Object *)ptr->data;
523  ID *id = value.data;
524 
525  if (ob->mode & OB_MODE_EDIT) {
526  return;
527  }
528 
529  /* assigning NULL only for empties */
530  if ((id == NULL) && (ob->type != OB_EMPTY)) {
531  return;
532  }
533 
534  if (id && ((id->tag & LIB_TAG_NO_MAIN) != (ob->id.tag & LIB_TAG_NO_MAIN))) {
535  BKE_report(reports,
536  RPT_ERROR,
537  "Can only assign evaluated data to evaluated object, or original data to "
538  "original object");
539  return;
540  }
541 
542  if (ob->type == OB_EMPTY) {
543  if (ob->data) {
544  id_us_min((ID *)ob->data);
545  ob->data = NULL;
546  }
547 
548  if (!id || GS(id->name) == ID_IM) {
549  id_us_plus(id);
550  ob->data = id;
551  }
552  }
553  else if (ob->type == OB_MESH) {
554  BKE_mesh_assign_object(G_MAIN, ob, (Mesh *)id);
555  }
556  else {
557  if (ob->data) {
558  id_us_min((ID *)ob->data);
559  }
560 
561  /* no need to type-check here ID. this is done in the _typef() function */
563  id_us_plus(id);
564 
565  ob->data = id;
567 
568  if (GS(id->name) == ID_CU_LEGACY) {
570  }
571  else if (ob->type == OB_ARMATURE) {
572  BKE_pose_rebuild(G_MAIN, ob, ob->data, true);
573  }
574  }
575 }
576 
577 static StructRNA *rna_Object_data_typef(PointerRNA *ptr)
578 {
579  Object *ob = (Object *)ptr->data;
580 
581  /* keep in sync with OB_DATA_SUPPORT_ID() macro */
582  switch (ob->type) {
583  case OB_EMPTY:
584  return &RNA_Image;
585  case OB_MESH:
586  return &RNA_Mesh;
587  case OB_CURVES_LEGACY:
588  return &RNA_Curve;
589  case OB_SURF:
590  return &RNA_Curve;
591  case OB_FONT:
592  return &RNA_Curve;
593  case OB_MBALL:
594  return &RNA_MetaBall;
595  case OB_LAMP:
596  return &RNA_Light;
597  case OB_CAMERA:
598  return &RNA_Camera;
599  case OB_LATTICE:
600  return &RNA_Lattice;
601  case OB_ARMATURE:
602  return &RNA_Armature;
603  case OB_SPEAKER:
604  return &RNA_Speaker;
605  case OB_LIGHTPROBE:
606  return &RNA_LightProbe;
607  case OB_GPENCIL:
608  return &RNA_GreasePencil;
609  case OB_CURVES:
610  return &RNA_Curves;
611  case OB_POINTCLOUD:
612  return &RNA_PointCloud;
613  case OB_VOLUME:
614  return &RNA_Volume;
615  default:
616  return &RNA_ID;
617  }
618 }
619 
620 static bool rna_Object_data_poll(PointerRNA *ptr, const PointerRNA value)
621 {
622  Object *ob = (Object *)ptr->data;
623 
624  if (ob->type == OB_GPENCIL) {
625  /* GP Object - Don't allow using "Annotation" GP datablocks here */
626  bGPdata *gpd = value.data;
627  return (gpd->flag & GP_DATA_ANNOTATIONS) == 0;
628  }
629 
630  return true;
631 }
632 
633 static void rna_Object_parent_set(PointerRNA *ptr,
634  PointerRNA value,
635  struct ReportList *UNUSED(reports))
636 {
637  Object *ob = (Object *)ptr->data;
638  Object *par = (Object *)value.data;
639 
640  {
641  ED_object_parent(ob, par, ob->partype, ob->parsubstr);
642  }
643 }
644 
645 static bool rna_Object_parent_override_apply(Main *bmain,
646  PointerRNA *ptr_dst,
647  PointerRNA *ptr_src,
648  PointerRNA *ptr_storage,
649  PropertyRNA *prop_dst,
650  PropertyRNA *prop_src,
651  PropertyRNA *UNUSED(prop_storage),
652  const int len_dst,
653  const int len_src,
654  const int len_storage,
655  PointerRNA *UNUSED(ptr_item_dst),
656  PointerRNA *UNUSED(ptr_item_src),
657  PointerRNA *UNUSED(ptr_item_storage),
659 {
660  BLI_assert(len_dst == len_src && (!ptr_storage || len_dst == len_storage) && len_dst == 0);
662  "Unsupported RNA override operation on object parent pointer");
663  UNUSED_VARS_NDEBUG(ptr_storage, len_dst, len_src, len_storage, opop);
664 
665  /* We need a special handling here because setting parent resets invert parent matrix,
666  * which is evil in our case. */
667  Object *ob = (Object *)ptr_dst->data;
668  Object *parent_dst = RNA_property_pointer_get(ptr_dst, prop_dst).data;
669  Object *parent_src = RNA_property_pointer_get(ptr_src, prop_src).data;
670 
671  if (parent_src == parent_dst) {
672  return false;
673  }
674 
675  if (parent_src == NULL) {
676  /* The only case where we do want default behavior (with matrix reset). */
677  ED_object_parent(ob, parent_src, ob->partype, ob->parsubstr);
678  }
679  else {
680  ob->parent = parent_src;
681  }
682  RNA_property_update_main(bmain, NULL, ptr_dst, prop_dst);
683  return true;
684 }
685 
686 static void rna_Object_parent_type_set(PointerRNA *ptr, int value)
687 {
688  Object *ob = (Object *)ptr->data;
689 
690  /* Skip if type did not change (otherwise we loose parent inverse in ED_object_parent). */
691  if (ob->partype == value) {
692  return;
693  }
694 
695  ED_object_parent(ob, ob->parent, value, ob->parsubstr);
696 }
697 
698 static const EnumPropertyItem *rna_Object_parent_type_itemf(bContext *UNUSED(C),
699  PointerRNA *ptr,
700  PropertyRNA *UNUSED(prop),
701  bool *r_free)
702 {
703  Object *ob = (Object *)ptr->data;
704  EnumPropertyItem *item = NULL;
705  int totitem = 0;
706 
708 
709  if (ob->parent) {
710  Object *par = ob->parent;
711 
712  if (par->type == OB_LATTICE) {
713  /* special hack: prevents this overriding others */
714  RNA_enum_items_add_value(&item, &totitem, &parent_type_items[2], PARSKEL);
715  }
716  else if (par->type == OB_ARMATURE) {
717  /* special hack: prevents this being overridden */
718  RNA_enum_items_add_value(&item, &totitem, &parent_type_items[1], PARSKEL);
720  }
721 
722  if (OB_TYPE_SUPPORT_PARVERT(par->type)) {
725  }
726  }
727 
728  RNA_enum_item_end(&item, &totitem);
729  *r_free = true;
730 
731  return item;
732 }
733 
734 static void rna_Object_empty_display_type_set(PointerRNA *ptr, int value)
735 {
736  Object *ob = (Object *)ptr->data;
737 
739 }
740 
741 static void rna_Object_parent_bone_set(PointerRNA *ptr, const char *value)
742 {
743  Object *ob = (Object *)ptr->data;
744 
745  ED_object_parent(ob, ob->parent, ob->partype, value);
746 }
747 
748 static const EnumPropertyItem *rna_Object_instance_type_itemf(bContext *UNUSED(C),
749  PointerRNA *ptr,
750  PropertyRNA *UNUSED(prop),
751  bool *UNUSED(r_free))
752 {
753  Object *ob = (Object *)ptr->data;
754  const EnumPropertyItem *item;
755 
756  if (ob->type == OB_EMPTY) {
757  item = instance_items_empty;
758  }
759  else if (ob->type == OB_FONT) {
760  item = instance_items_font;
761  }
762  else {
763  item = instance_items_nogroup;
764  }
765 
766  return item;
767 }
768 
769 static void rna_Object_dup_collection_set(PointerRNA *ptr,
770  PointerRNA value,
771  struct ReportList *UNUSED(reports))
772 {
773  Object *ob = (Object *)ptr->data;
774  Collection *grp = (Collection *)value.data;
775 
776  /* Must not let this be set if the object belongs in this group already,
777  * thus causing a cycle/infinite-recursion leading to crashes on load T25298. */
778  if (BKE_collection_has_object_recursive(grp, ob) == 0) {
779  if (ob->type == OB_EMPTY) {
781  ob->instance_collection = grp;
783  }
784  else {
785  BKE_report(NULL, RPT_ERROR, "Only empty objects support collection instances");
786  }
787  }
788  else {
790  RPT_ERROR,
791  "Cannot set instance-collection as object belongs in group being instanced, thus "
792  "causing a cycle");
793  }
794 }
795 
796 static void rna_Object_vertex_groups_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
797 {
798  Object *ob = (Object *)ptr->data;
800  iter->valid = 0;
801  return;
802  }
803 
805  iter->valid = defbase != NULL;
806 
807  rna_iterator_listbase_begin(iter, defbase, NULL);
808 }
809 
810 static void rna_VertexGroup_name_set(PointerRNA *ptr, const char *value)
811 {
812  Object *ob = (Object *)ptr->owner_id;
814  return;
815  }
816 
817  bDeformGroup *dg = (bDeformGroup *)ptr->data;
818  BLI_strncpy_utf8(dg->name, value, sizeof(dg->name));
820 }
821 
822 static int rna_VertexGroup_index_get(PointerRNA *ptr)
823 {
824  Object *ob = (Object *)ptr->owner_id;
826  return -1;
827  }
828 
829  const ListBase *defbase = BKE_object_defgroup_list(ob);
830  return BLI_findindex(defbase, ptr->data);
831 }
832 
833 static PointerRNA rna_Object_active_vertex_group_get(PointerRNA *ptr)
834 {
835  Object *ob = (Object *)ptr->owner_id;
837  return PointerRNA_NULL;
838  }
839 
840  const ListBase *defbase = BKE_object_defgroup_list(ob);
841 
843  ptr, &RNA_VertexGroup, BLI_findlink(defbase, BKE_object_defgroup_active_index_get(ob) - 1));
844 }
845 
846 static void rna_Object_active_vertex_group_set(PointerRNA *ptr,
847  PointerRNA value,
848  struct ReportList *reports)
849 {
850  Object *ob = (Object *)ptr->owner_id;
852  return;
853  }
854 
855  const ListBase *defbase = BKE_object_defgroup_list(ob);
856 
857  int index = BLI_findindex(defbase, value.data);
858  if (index == -1) {
859  BKE_reportf(reports,
860  RPT_ERROR,
861  "VertexGroup '%s' not found in object '%s'",
862  ((bDeformGroup *)value.data)->name,
863  ob->id.name + 2);
864  return;
865  }
866 
868 }
869 
870 static int rna_Object_active_vertex_group_index_get(PointerRNA *ptr)
871 {
872  Object *ob = (Object *)ptr->owner_id;
874  return -1;
875  }
876 
878 }
879 
880 static void rna_Object_active_vertex_group_index_set(PointerRNA *ptr, int value)
881 {
882  Object *ob = (Object *)ptr->owner_id;
884  return;
885  }
886 
888 }
889 
890 static void rna_Object_active_vertex_group_index_range(
891  PointerRNA *ptr, int *min, int *max, int *UNUSED(softmin), int *UNUSED(softmax))
892 {
893  Object *ob = (Object *)ptr->owner_id;
894 
895  *min = 0;
897  *max = 0;
898  return;
899  }
900  const ListBase *defbase = BKE_object_defgroup_list(ob);
901  *max = max_ii(0, BLI_listbase_count(defbase) - 1);
902 }
903 
904 void rna_object_vgroup_name_index_get(PointerRNA *ptr, char *value, int index)
905 {
906  Object *ob = (Object *)ptr->owner_id;
908  value[0] = '\0';
909  return;
910  }
911 
912  const ListBase *defbase = BKE_object_defgroup_list(ob);
913  const bDeformGroup *dg = BLI_findlink(defbase, index - 1);
914 
915  if (dg) {
916  BLI_strncpy(value, dg->name, sizeof(dg->name));
917  }
918  else {
919  value[0] = '\0';
920  }
921 }
922 
924 {
925  Object *ob = (Object *)ptr->owner_id;
927  return 0;
928  }
929 
930  const ListBase *defbase = BKE_object_defgroup_list(ob);
931  bDeformGroup *dg = BLI_findlink(defbase, index - 1);
932  return (dg) ? strlen(dg->name) : 0;
933 }
934 
935 void rna_object_vgroup_name_index_set(PointerRNA *ptr, const char *value, short *index)
936 {
937  Object *ob = (Object *)ptr->owner_id;
939  *index = -1;
940  return;
941  }
942 
943  *index = BKE_object_defgroup_name_index(ob, value) + 1;
944 }
945 
946 void rna_object_vgroup_name_set(PointerRNA *ptr, const char *value, char *result, int maxlen)
947 {
948  Object *ob = (Object *)ptr->owner_id;
950  result[0] = '\0';
951  return;
952  }
953 
955  if (dg) {
956  /* No need for BLI_strncpy_utf8, since this matches an existing group. */
957  BLI_strncpy(result, value, maxlen);
958  return;
959  }
960 
961  result[0] = '\0';
962 }
963 
964 static void rna_FaceMap_name_set(PointerRNA *ptr, const char *value)
965 {
966  Object *ob = (Object *)ptr->owner_id;
967  bFaceMap *fmap = (bFaceMap *)ptr->data;
968  BLI_strncpy_utf8(fmap->name, value, sizeof(fmap->name));
970 }
971 
972 static int rna_FaceMap_index_get(PointerRNA *ptr)
973 {
974  Object *ob = (Object *)ptr->owner_id;
975 
976  return BLI_findindex(&ob->fmaps, ptr->data);
977 }
978 
979 static PointerRNA rna_Object_active_face_map_get(PointerRNA *ptr)
980 {
981  Object *ob = (Object *)ptr->owner_id;
982  return rna_pointer_inherit_refine(ptr, &RNA_FaceMap, BLI_findlink(&ob->fmaps, ob->actfmap - 1));
983 }
984 
985 static int rna_Object_active_face_map_index_get(PointerRNA *ptr)
986 {
987  Object *ob = (Object *)ptr->owner_id;
988  return ob->actfmap - 1;
989 }
990 
991 static void rna_Object_active_face_map_index_set(PointerRNA *ptr, int value)
992 {
993  Object *ob = (Object *)ptr->owner_id;
994  ob->actfmap = value + 1;
995 }
996 
997 static void rna_Object_active_face_map_index_range(
998  PointerRNA *ptr, int *min, int *max, int *UNUSED(softmin), int *UNUSED(softmax))
999 {
1000  Object *ob = (Object *)ptr->owner_id;
1001 
1002  *min = 0;
1003  *max = max_ii(0, BLI_listbase_count(&ob->fmaps) - 1);
1004 }
1005 
1006 void rna_object_BKE_object_facemap_name_index_get(PointerRNA *ptr, char *value, int index)
1007 {
1008  Object *ob = (Object *)ptr->owner_id;
1009  bFaceMap *fmap;
1010 
1011  fmap = BLI_findlink(&ob->fmaps, index - 1);
1012 
1013  if (fmap) {
1014  BLI_strncpy(value, fmap->name, sizeof(fmap->name));
1015  }
1016  else {
1017  value[0] = '\0';
1018  }
1019 }
1020 
1021 int rna_object_BKE_object_facemap_name_index_length(PointerRNA *ptr, int index)
1022 {
1023  Object *ob = (Object *)ptr->owner_id;
1024  bFaceMap *fmap;
1025 
1026  fmap = BLI_findlink(&ob->fmaps, index - 1);
1027  return (fmap) ? strlen(fmap->name) : 0;
1028 }
1029 
1030 void rna_object_BKE_object_facemap_name_index_set(PointerRNA *ptr, const char *value, short *index)
1031 {
1032  Object *ob = (Object *)ptr->owner_id;
1033  *index = BKE_object_facemap_name_index(ob, value) + 1;
1034 }
1035 
1036 void rna_object_fmap_name_set(PointerRNA *ptr, const char *value, char *result, int maxlen)
1037 {
1038  Object *ob = (Object *)ptr->owner_id;
1039  bFaceMap *fmap = BKE_object_facemap_find_name(ob, value);
1040  if (fmap) {
1041  /* No need for BLI_strncpy_utf8, since this matches an existing group. */
1042  BLI_strncpy(result, value, maxlen);
1043  return;
1044  }
1045 
1046  result[0] = '\0';
1047 }
1048 
1049 void rna_object_uvlayer_name_set(PointerRNA *ptr, const char *value, char *result, int maxlen)
1050 {
1051  Object *ob = (Object *)ptr->owner_id;
1052  Mesh *me;
1053  CustomDataLayer *layer;
1054  int a;
1055 
1056  if (ob->type == OB_MESH && ob->data) {
1057  me = (Mesh *)ob->data;
1058 
1059  for (a = 0; a < me->ldata.totlayer; a++) {
1060  layer = &me->ldata.layers[a];
1061 
1062  if (layer->type == CD_MLOOPUV && STREQ(layer->name, value)) {
1063  BLI_strncpy(result, value, maxlen);
1064  return;
1065  }
1066  }
1067  }
1068 
1069  result[0] = '\0';
1070 }
1071 
1072 void rna_object_vcollayer_name_set(PointerRNA *ptr, const char *value, char *result, int maxlen)
1073 {
1074  Object *ob = (Object *)ptr->owner_id;
1075  Mesh *me;
1076  CustomDataLayer *layer;
1077  int a;
1078 
1079  if (ob->type == OB_MESH && ob->data) {
1080  me = (Mesh *)ob->data;
1081 
1082  for (a = 0; a < me->fdata.totlayer; a++) {
1083  layer = &me->fdata.layers[a];
1084 
1085  if (layer->type == CD_MCOL && STREQ(layer->name, value)) {
1086  BLI_strncpy(result, value, maxlen);
1087  return;
1088  }
1089  }
1090  }
1091 
1092  result[0] = '\0';
1093 }
1094 
1095 static int rna_Object_active_material_index_get(PointerRNA *ptr)
1096 {
1097  Object *ob = (Object *)ptr->owner_id;
1098  return MAX2(ob->actcol - 1, 0);
1099 }
1100 
1101 static void rna_Object_active_material_index_set(PointerRNA *ptr, int value)
1102 {
1103  Object *ob = (Object *)ptr->owner_id;
1104  ob->actcol = value + 1;
1105 
1106  if (ob->type == OB_MESH) {
1107  Mesh *me = ob->data;
1108 
1109  if (me->edit_mesh) {
1110  me->edit_mesh->mat_nr = value;
1111  }
1112  }
1113 }
1114 
1115 static void rna_Object_active_material_index_range(
1116  PointerRNA *ptr, int *min, int *max, int *UNUSED(softmin), int *UNUSED(softmax))
1117 {
1118  Object *ob = (Object *)ptr->owner_id;
1119  *min = 0;
1120  *max = max_ii(ob->totcol - 1, 0);
1121 }
1122 
1123 /* returns active base material */
1124 static PointerRNA rna_Object_active_material_get(PointerRNA *ptr)
1125 {
1126  Object *ob = (Object *)ptr->owner_id;
1127  Material *ma;
1128 
1129  ma = (ob->totcol) ? BKE_object_material_get(ob, ob->actcol) : NULL;
1130  return rna_pointer_inherit_refine(ptr, &RNA_Material, ma);
1131 }
1132 
1133 static void rna_Object_active_material_set(PointerRNA *ptr,
1134  PointerRNA value,
1135  struct ReportList *UNUSED(reports))
1136 {
1137  Object *ob = (Object *)ptr->owner_id;
1138 
1139  DEG_id_tag_update(value.data, 0);
1143 
1144  if (ob->type == OB_GPENCIL) {
1145  /* notifying material property in topbar */
1147  }
1148 }
1149 
1150 static int rna_Object_active_material_editable(PointerRNA *ptr, const char **UNUSED(r_info))
1151 {
1152  Object *ob = (Object *)ptr->owner_id;
1153  bool is_editable;
1154 
1155  if ((ob->matbits == NULL) || (ob->actcol == 0) || ob->matbits[ob->actcol - 1]) {
1156  is_editable = !ID_IS_LINKED(ob);
1157  }
1158  else {
1159  is_editable = ob->data ? !ID_IS_LINKED(ob->data) : false;
1160  }
1161 
1162  return is_editable ? PROP_EDITABLE : 0;
1163 }
1164 
1165 static void rna_Object_active_particle_system_index_range(
1166  PointerRNA *ptr, int *min, int *max, int *UNUSED(softmin), int *UNUSED(softmax))
1167 {
1168  Object *ob = (Object *)ptr->owner_id;
1169  *min = 0;
1170  *max = max_ii(0, BLI_listbase_count(&ob->particlesystem) - 1);
1171 }
1172 
1173 static int rna_Object_active_particle_system_index_get(PointerRNA *ptr)
1174 {
1175  Object *ob = (Object *)ptr->owner_id;
1176  return psys_get_current_num(ob);
1177 }
1178 
1179 static void rna_Object_active_particle_system_index_set(PointerRNA *ptr, int value)
1180 {
1181  Object *ob = (Object *)ptr->owner_id;
1182  psys_set_current_num(ob, value);
1183 }
1184 
1185 static void rna_Object_particle_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *ptr)
1186 {
1187  /* TODO: Disabled for now, because bContext is not available. */
1188 # if 0
1189  Object *ob = (Object *)ptr->owner_id;
1191 # else
1192  (void)scene;
1193  (void)ptr;
1194 # endif
1195 }
1196 
1197 /* rotation - axis-angle */
1198 static void rna_Object_rotation_axis_angle_get(PointerRNA *ptr, float *value)
1199 {
1200  Object *ob = ptr->data;
1201 
1202  /* for now, assume that rotation mode is axis-angle */
1203  value[0] = ob->rotAngle;
1204  copy_v3_v3(&value[1], ob->rotAxis);
1205 }
1206 
1207 /* rotation - axis-angle */
1208 static void rna_Object_rotation_axis_angle_set(PointerRNA *ptr, const float *value)
1209 {
1210  Object *ob = ptr->data;
1211 
1212  /* for now, assume that rotation mode is axis-angle */
1213  ob->rotAngle = value[0];
1214  copy_v3_v3(ob->rotAxis, &value[1]);
1215 
1216  /* TODO: validate axis? */
1217 }
1218 
1219 static void rna_Object_rotation_mode_set(PointerRNA *ptr, int value)
1220 {
1221  Object *ob = ptr->data;
1222 
1223  /* use API Method for conversions... */
1225  ob->quat, ob->rot, ob->rotAxis, &ob->rotAngle, ob->rotmode, (short)value);
1226 
1227  /* finally, set the new rotation type */
1228  ob->rotmode = value;
1229 }
1230 
1231 static void rna_Object_dimensions_get(PointerRNA *ptr, float *value)
1232 {
1233  Object *ob = ptr->data;
1234  BKE_object_dimensions_get(ob, value);
1235 }
1236 
1237 static void rna_Object_dimensions_set(PointerRNA *ptr, const float *value)
1238 {
1239  Object *ob = ptr->data;
1240  BKE_object_dimensions_set(ob, value, 0);
1241 }
1242 
1243 static int rna_Object_location_editable(PointerRNA *ptr, int index)
1244 {
1245  Object *ob = (Object *)ptr->data;
1246 
1247  /* only if the axis in question is locked, not editable... */
1248  if ((index == 0) && (ob->protectflag & OB_LOCK_LOCX)) {
1249  return 0;
1250  }
1251  else if ((index == 1) && (ob->protectflag & OB_LOCK_LOCY)) {
1252  return 0;
1253  }
1254  else if ((index == 2) && (ob->protectflag & OB_LOCK_LOCZ)) {
1255  return 0;
1256  }
1257  else {
1258  return PROP_EDITABLE;
1259  }
1260 }
1261 
1262 static int rna_Object_scale_editable(PointerRNA *ptr, int index)
1263 {
1264  Object *ob = (Object *)ptr->data;
1265 
1266  /* only if the axis in question is locked, not editable... */
1267  if ((index == 0) && (ob->protectflag & OB_LOCK_SCALEX)) {
1268  return 0;
1269  }
1270  else if ((index == 1) && (ob->protectflag & OB_LOCK_SCALEY)) {
1271  return 0;
1272  }
1273  else if ((index == 2) && (ob->protectflag & OB_LOCK_SCALEZ)) {
1274  return 0;
1275  }
1276  else {
1277  return PROP_EDITABLE;
1278  }
1279 }
1280 
1281 static int rna_Object_rotation_euler_editable(PointerRNA *ptr, int index)
1282 {
1283  Object *ob = (Object *)ptr->data;
1284 
1285  /* only if the axis in question is locked, not editable... */
1286  if ((index == 0) && (ob->protectflag & OB_LOCK_ROTX)) {
1287  return 0;
1288  }
1289  else if ((index == 1) && (ob->protectflag & OB_LOCK_ROTY)) {
1290  return 0;
1291  }
1292  else if ((index == 2) && (ob->protectflag & OB_LOCK_ROTZ)) {
1293  return 0;
1294  }
1295  else {
1296  return PROP_EDITABLE;
1297  }
1298 }
1299 
1300 static int rna_Object_rotation_4d_editable(PointerRNA *ptr, int index)
1301 {
1302  Object *ob = (Object *)ptr->data;
1303 
1304  /* only consider locks if locking components individually... */
1305  if (ob->protectflag & OB_LOCK_ROT4D) {
1306  /* only if the axis in question is locked, not editable... */
1307  if ((index == 0) && (ob->protectflag & OB_LOCK_ROTW)) {
1308  return 0;
1309  }
1310  else if ((index == 1) && (ob->protectflag & OB_LOCK_ROTX)) {
1311  return 0;
1312  }
1313  else if ((index == 2) && (ob->protectflag & OB_LOCK_ROTY)) {
1314  return 0;
1315  }
1316  else if ((index == 3) && (ob->protectflag & OB_LOCK_ROTZ)) {
1317  return 0;
1318  }
1319  }
1320 
1321  return PROP_EDITABLE;
1322 }
1323 
1324 static int rna_MaterialSlot_index(const PointerRNA *ptr)
1325 {
1326  /* There is an offset, so that `ptr->data` is not null and unique across IDs. */
1327  return (uintptr_t)ptr->data - (uintptr_t)ptr->owner_id;
1328 }
1329 
1330 static int rna_MaterialSlot_index_get(PointerRNA *ptr)
1331 {
1332  return rna_MaterialSlot_index(ptr);
1333 }
1334 
1335 static int rna_MaterialSlot_material_editable(PointerRNA *ptr, const char **UNUSED(r_info))
1336 {
1337  Object *ob = (Object *)ptr->owner_id;
1338  const int index = rna_MaterialSlot_index(ptr);
1339  bool is_editable;
1340 
1341  if ((ob->matbits == NULL) || ob->matbits[index]) {
1342  is_editable = !ID_IS_LINKED(ob);
1343  }
1344  else {
1345  is_editable = ob->data ? !ID_IS_LINKED(ob->data) : false;
1346  }
1347 
1348  return is_editable ? PROP_EDITABLE : 0;
1349 }
1350 
1351 static PointerRNA rna_MaterialSlot_material_get(PointerRNA *ptr)
1352 {
1353  Object *ob = (Object *)ptr->owner_id;
1354  Material *ma;
1355  const int index = rna_MaterialSlot_index(ptr);
1356 
1357  if (DEG_is_evaluated_object(ob)) {
1358  ma = BKE_object_material_get_eval(ob, index + 1);
1359  }
1360  else {
1361  ma = BKE_object_material_get(ob, index + 1);
1362  }
1363  return rna_pointer_inherit_refine(ptr, &RNA_Material, ma);
1364 }
1365 
1366 static void rna_MaterialSlot_material_set(PointerRNA *ptr,
1367  PointerRNA value,
1368  struct ReportList *UNUSED(reports))
1369 {
1370  Object *ob = (Object *)ptr->owner_id;
1371  int index = rna_MaterialSlot_index(ptr);
1372 
1376 }
1377 
1378 static bool rna_MaterialSlot_material_poll(PointerRNA *ptr, PointerRNA value)
1379 {
1380  Object *ob = (Object *)ptr->owner_id;
1381  Material *ma = (Material *)value.data;
1382 
1383  if (ob->type == OB_GPENCIL) {
1384  /* GP Materials only */
1385  return (ma->gp_style != NULL);
1386  }
1387  else {
1388  /* Everything except GP materials */
1389  return (ma->gp_style == NULL);
1390  }
1391 }
1392 
1393 static int rna_MaterialSlot_link_get(PointerRNA *ptr)
1394 {
1395  Object *ob = (Object *)ptr->owner_id;
1396  int index = rna_MaterialSlot_index(ptr);
1397  if (index < ob->totcol) {
1398  return ob->matbits[index] != 0;
1399  }
1400  return false;
1401 }
1402 
1403 static void rna_MaterialSlot_link_set(PointerRNA *ptr, int value)
1404 {
1405  Object *ob = (Object *)ptr->owner_id;
1406  int index = rna_MaterialSlot_index(ptr);
1407 
1408  if (value) {
1409  ob->matbits[index] = 1;
1410  /* DEPRECATED */
1411  // ob->colbits |= (1 << index);
1412  }
1413  else {
1414  ob->matbits[index] = 0;
1415  /* DEPRECATED */
1416  // ob->colbits &= ~(1 << index);
1417  }
1418 }
1419 
1420 static int rna_MaterialSlot_name_length(PointerRNA *ptr)
1421 {
1422  Object *ob = (Object *)ptr->owner_id;
1423  Material *ma;
1424  int index = rna_MaterialSlot_index(ptr);
1425 
1426  ma = BKE_object_material_get(ob, index + 1);
1427 
1428  if (ma) {
1429  return strlen(ma->id.name + 2);
1430  }
1431 
1432  return 0;
1433 }
1434 
1435 static void rna_MaterialSlot_name_get(PointerRNA *ptr, char *str)
1436 {
1437  Object *ob = (Object *)ptr->owner_id;
1438  Material *ma;
1439  int index = rna_MaterialSlot_index(ptr);
1440 
1441  ma = BKE_object_material_get(ob, index + 1);
1442 
1443  if (ma) {
1444  strcpy(str, ma->id.name + 2);
1445  }
1446  else {
1447  str[0] = '\0';
1448  }
1449 }
1450 
1451 static void rna_MaterialSlot_update(Main *bmain, Scene *scene, PointerRNA *ptr)
1452 {
1453  rna_Object_internal_update(bmain, scene, ptr);
1454 
1457  DEG_relations_tag_update(bmain);
1458 }
1459 
1460 static char *rna_MaterialSlot_path(const PointerRNA *ptr)
1461 {
1462  int index = rna_MaterialSlot_index(ptr);
1463  return BLI_sprintfN("material_slots[%d]", index);
1464 }
1465 
1466 static int rna_Object_material_slots_length(PointerRNA *ptr)
1467 {
1468  Object *ob = (Object *)ptr->owner_id;
1469  if (DEG_is_evaluated_object(ob)) {
1470  return BKE_object_material_count_eval(ob);
1471  }
1472  else {
1473  return ob->totcol;
1474  }
1475 }
1476 
1477 static void rna_Object_material_slots_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
1478 {
1479  const int length = rna_Object_material_slots_length(ptr);
1480  iter->internal.count.item = 0;
1481  iter->internal.count.ptr = ptr->owner_id;
1482  iter->valid = length > 0;
1483 }
1484 
1485 static void rna_Object_material_slots_next(CollectionPropertyIterator *iter)
1486 {
1487  const int length = rna_Object_material_slots_length(&iter->ptr);
1488  iter->internal.count.item++;
1489  iter->valid = iter->internal.count.item < length;
1490 }
1491 
1492 static PointerRNA rna_Object_material_slots_get(CollectionPropertyIterator *iter)
1493 {
1494  PointerRNA ptr;
1495  ID *id = (ID *)iter->internal.count.ptr;
1496  RNA_pointer_create(id,
1497  &RNA_MaterialSlot,
1498  /* Add offset, so that `ptr->data` is not null and unique across IDs. */
1499  (void *)(iter->internal.count.item + (uintptr_t)id),
1500  &ptr);
1501  return ptr;
1502 }
1503 
1504 static void rna_Object_material_slots_end(CollectionPropertyIterator *UNUSED(iter))
1505 {
1506 }
1507 
1508 static PointerRNA rna_Object_display_get(PointerRNA *ptr)
1509 {
1510  return rna_pointer_inherit_refine(ptr, &RNA_ObjectDisplay, ptr->data);
1511 }
1512 
1513 static char *rna_ObjectDisplay_path(const PointerRNA *UNUSED(ptr))
1514 {
1515  return BLI_strdup("display");
1516 }
1517 
1518 static PointerRNA rna_Object_active_particle_system_get(PointerRNA *ptr)
1519 {
1520  Object *ob = (Object *)ptr->owner_id;
1521  ParticleSystem *psys = psys_get_current(ob);
1522  return rna_pointer_inherit_refine(ptr, &RNA_ParticleSystem, psys);
1523 }
1524 
1525 static void rna_Object_active_shape_key_index_range(
1526  PointerRNA *ptr, int *min, int *max, int *UNUSED(softmin), int *UNUSED(softmax))
1527 {
1528  Object *ob = (Object *)ptr->owner_id;
1529  Key *key = BKE_key_from_object(ob);
1530 
1531  *min = 0;
1532  if (key) {
1533  *max = BLI_listbase_count(&key->block) - 1;
1534  if (*max < 0) {
1535  *max = 0;
1536  }
1537  }
1538  else {
1539  *max = 0;
1540  }
1541 }
1542 
1543 static int rna_Object_active_shape_key_index_get(PointerRNA *ptr)
1544 {
1545  Object *ob = (Object *)ptr->owner_id;
1546 
1547  return MAX2(ob->shapenr - 1, 0);
1548 }
1549 
1550 static void rna_Object_active_shape_key_index_set(PointerRNA *ptr, int value)
1551 {
1552  Object *ob = (Object *)ptr->owner_id;
1553 
1554  ob->shapenr = value + 1;
1555 }
1556 
1557 static PointerRNA rna_Object_active_shape_key_get(PointerRNA *ptr)
1558 {
1559  Object *ob = (Object *)ptr->owner_id;
1560  Key *key = BKE_key_from_object(ob);
1561  KeyBlock *kb;
1562  PointerRNA keyptr;
1563 
1564  if (key == NULL) {
1565  return PointerRNA_NULL;
1566  }
1567 
1568  kb = BLI_findlink(&key->block, ob->shapenr - 1);
1569  RNA_pointer_create((ID *)key, &RNA_ShapeKey, kb, &keyptr);
1570  return keyptr;
1571 }
1572 
1573 static PointerRNA rna_Object_field_get(PointerRNA *ptr)
1574 {
1575  Object *ob = (Object *)ptr->owner_id;
1576 
1577  return rna_pointer_inherit_refine(ptr, &RNA_FieldSettings, ob->pd);
1578 }
1579 
1580 static PointerRNA rna_Object_collision_get(PointerRNA *ptr)
1581 {
1582  Object *ob = (Object *)ptr->owner_id;
1583 
1584  if (ob->type != OB_MESH) {
1585  return PointerRNA_NULL;
1586  }
1587 
1588  return rna_pointer_inherit_refine(ptr, &RNA_CollisionSettings, ob->pd);
1589 }
1590 
1591 static PointerRNA rna_Object_active_constraint_get(PointerRNA *ptr)
1592 {
1593  Object *ob = (Object *)ptr->owner_id;
1595  return rna_pointer_inherit_refine(ptr, &RNA_Constraint, con);
1596 }
1597 
1598 static void rna_Object_active_constraint_set(PointerRNA *ptr,
1599  PointerRNA value,
1600  struct ReportList *UNUSED(reports))
1601 {
1602  Object *ob = (Object *)ptr->owner_id;
1604 }
1605 
1606 static bConstraint *rna_Object_constraints_new(Object *object, Main *bmain, int type)
1607 {
1608  bConstraint *new_con = BKE_constraint_add_for_object(object, NULL, type);
1609 
1610  ED_object_constraint_tag_update(bmain, object, new_con);
1612 
1613  return new_con;
1614 }
1615 
1616 static void rna_Object_constraints_remove(Object *object,
1617  Main *bmain,
1618  ReportList *reports,
1619  PointerRNA *con_ptr)
1620 {
1621  bConstraint *con = con_ptr->data;
1622  if (BLI_findindex(&object->constraints, con) == -1) {
1623  BKE_reportf(reports,
1624  RPT_ERROR,
1625  "Constraint '%s' not found in object '%s'",
1626  con->name,
1627  object->id.name + 2);
1628  return;
1629  }
1630 
1631  BKE_constraint_remove(&object->constraints, con);
1632  RNA_POINTER_INVALIDATE(con_ptr);
1633 
1634  ED_object_constraint_update(bmain, object);
1637 }
1638 
1639 static void rna_Object_constraints_clear(Object *object, Main *bmain)
1640 {
1642 
1643  ED_object_constraint_update(bmain, object);
1645 
1647 }
1648 
1649 static void rna_Object_constraints_move(
1650  Object *object, Main *bmain, ReportList *reports, int from, int to)
1651 {
1652  if (from == to) {
1653  return;
1654  }
1655 
1656  if (!BLI_listbase_move_index(&object->constraints, from, to)) {
1657  BKE_reportf(reports, RPT_ERROR, "Could not move constraint from index '%d' to '%d'", from, to);
1658  return;
1659  }
1660 
1661  ED_object_constraint_tag_update(bmain, object, NULL);
1663 }
1664 
1665 static bConstraint *rna_Object_constraints_copy(Object *object, Main *bmain, PointerRNA *con_ptr)
1666 {
1667  bConstraint *con = con_ptr->data;
1668  bConstraint *new_con = BKE_constraint_copy_for_object(object, con);
1670 
1671  ED_object_constraint_tag_update(bmain, object, new_con);
1673 
1674  return new_con;
1675 }
1676 
1677 bool rna_Object_constraints_override_apply(Main *bmain,
1678  PointerRNA *ptr_dst,
1679  PointerRNA *ptr_src,
1680  PointerRNA *UNUSED(ptr_storage),
1681  PropertyRNA *prop_dst,
1682  PropertyRNA *UNUSED(prop_src),
1683  PropertyRNA *UNUSED(prop_storage),
1684  const int UNUSED(len_dst),
1685  const int UNUSED(len_src),
1686  const int UNUSED(len_storage),
1687  PointerRNA *UNUSED(ptr_item_dst),
1688  PointerRNA *UNUSED(ptr_item_src),
1689  PointerRNA *UNUSED(ptr_item_storage),
1691 {
1693  "Unsupported RNA override operation on constraints collection");
1694 
1695  Object *ob_dst = (Object *)ptr_dst->owner_id;
1696  Object *ob_src = (Object *)ptr_src->owner_id;
1697 
1698  /* Remember that insertion operations are defined and stored in correct order, which means that
1699  * even if we insert several items in a row, we always insert first one, then second one, etc.
1700  * So we should always find 'anchor' constraint in both _src *and* _dst. */
1701  const size_t name_offset = offsetof(bConstraint, name);
1703  opop->subitem_reference_name,
1704  name_offset,
1705  opop->subitem_reference_index);
1706  /* If `con_anchor` is NULL, `con_src` will be inserted in first position. */
1707 
1709  &ob_src->constraints, opop->subitem_local_name, name_offset, opop->subitem_local_index);
1710 
1711  if (con_src == NULL) {
1712  BLI_assert(con_src != NULL);
1713  return false;
1714  }
1715 
1716  bConstraint *con_dst = BKE_constraint_duplicate_ex(con_src, 0, true);
1717 
1718  /* This handles NULL anchor as expected by adding at head of list. */
1719  BLI_insertlinkafter(&ob_dst->constraints, con_anchor, con_dst);
1720 
1721  /* This should actually *not* be needed in typical cases.
1722  * However, if overridden source was edited, we *may* have some new conflicting names. */
1723  BKE_constraint_unique_name(con_dst, &ob_dst->constraints);
1724 
1725  // printf("%s: We inserted a constraint...\n", __func__);
1726  RNA_property_update_main(bmain, NULL, ptr_dst, prop_dst);
1727  return true;
1728 }
1729 
1730 static ModifierData *rna_Object_modifier_new(
1731  Object *object, bContext *C, ReportList *reports, const char *name, int type)
1732 {
1734  reports, CTX_data_main(C), CTX_data_scene(C), object, name, type);
1735 
1737 
1738  return md;
1739 }
1740 
1741 static void rna_Object_modifier_remove(Object *object,
1742  bContext *C,
1743  ReportList *reports,
1744  PointerRNA *md_ptr)
1745 {
1746  ModifierData *md = md_ptr->data;
1747  if (ED_object_modifier_remove(reports, CTX_data_main(C), CTX_data_scene(C), object, md) ==
1748  false) {
1749  /* error is already set */
1750  return;
1751  }
1752 
1753  RNA_POINTER_INVALIDATE(md_ptr);
1754 
1756 }
1757 
1758 static void rna_Object_modifier_clear(Object *object, bContext *C)
1759 {
1761 
1763 }
1764 
1765 static PointerRNA rna_Object_active_modifier_get(PointerRNA *ptr)
1766 {
1767  Object *ob = (Object *)ptr->owner_id;
1769  return rna_pointer_inherit_refine(ptr, &RNA_Modifier, md);
1770 }
1771 
1772 static void rna_Object_active_modifier_set(PointerRNA *ptr, PointerRNA value, ReportList *reports)
1773 {
1774  Object *ob = (Object *)ptr->owner_id;
1775  ModifierData *md = value.data;
1776 
1778 
1779  if (RNA_pointer_is_null(&value)) {
1781  return;
1782  }
1783 
1784  if (BLI_findindex(&ob->modifiers, md) == -1) {
1785  BKE_reportf(
1786  reports, RPT_ERROR, "Modifier \"%s\" is not in the object's modifier list", md->name);
1787  return;
1788  }
1789 
1791 }
1792 
1793 bool rna_Object_modifiers_override_apply(Main *bmain,
1794  PointerRNA *ptr_dst,
1795  PointerRNA *ptr_src,
1796  PointerRNA *UNUSED(ptr_storage),
1797  PropertyRNA *prop_dst,
1798  PropertyRNA *UNUSED(prop_src),
1799  PropertyRNA *UNUSED(prop_storage),
1800  const int UNUSED(len_dst),
1801  const int UNUSED(len_src),
1802  const int UNUSED(len_storage),
1803  PointerRNA *UNUSED(ptr_item_dst),
1804  PointerRNA *UNUSED(ptr_item_src),
1805  PointerRNA *UNUSED(ptr_item_storage),
1807 {
1809  "Unsupported RNA override operation on modifiers collection");
1810 
1811  Object *ob_dst = (Object *)ptr_dst->owner_id;
1812  Object *ob_src = (Object *)ptr_src->owner_id;
1813 
1814  /* Remember that insertion operations are defined and stored in correct order, which means that
1815  * even if we insert several items in a row, we always insert first one, then second one, etc.
1816  * So we should always find 'anchor' modifier in both _src *and* _dst. */
1817  const size_t name_offset = offsetof(ModifierData, name);
1819  opop->subitem_reference_name,
1820  name_offset,
1821  opop->subitem_reference_index);
1822  /* If `mod_anchor` is NULL, `mod_src` will be inserted in first position. */
1823 
1825  &ob_src->modifiers, opop->subitem_local_name, name_offset, opop->subitem_local_index);
1826 
1827  if (mod_src == NULL) {
1828  BLI_assert(mod_src != NULL);
1829  return false;
1830  }
1831 
1832  /* While it would be nicer to use lower-level BKE_modifier_new() here, this one is lacking
1833  * special-cases handling (particles and other physics modifiers mostly), so using the ED version
1834  * instead, to avoid duplicating code. */
1836  NULL, bmain, NULL, ob_dst, mod_src->name, mod_src->type);
1837 
1838  if (mod_dst == NULL) {
1839  /* This can happen e.g. when a modifier type is tagged as `eModifierTypeFlag_Single`, and that
1840  * modifier has somehow been added already by another code path (e.g.
1841  * `rna_CollisionSettings_dependency_update` does add the `eModifierType_Collision` singleton
1842  * modifier).
1843  *
1844  * Try to handle this by finding already existing one here. */
1845  const ModifierTypeInfo *mti = BKE_modifier_get_info((ModifierType)mod_src->type);
1846  if (mti->flags & eModifierTypeFlag_Single) {
1847  mod_dst = BKE_modifiers_findby_type(ob_dst, (ModifierType)mod_src->type);
1848  }
1849 
1850  if (mod_dst == NULL) {
1851  BLI_assert(mod_src != NULL);
1852  return false;
1853  }
1854  }
1855 
1856  /* XXX Current handling of 'copy' from particle-system modifier is *very* bad (it keeps same psys
1857  * pointer as source, then calling code copies psys of object separately and do some magic
1858  * remapping of pointers...), unfortunately several pieces of code in Object editing area rely on
1859  * this behavior. So for now, hacking around it to get it doing what we want it to do, as getting
1860  * a proper behavior would be everything but trivial, and this whole particle thingy is
1861  * end-of-life. */
1862  ParticleSystem *psys_dst = (mod_dst->type == eModifierType_ParticleSystem) ?
1863  ((ParticleSystemModifierData *)mod_dst)->psys :
1864  NULL;
1865  BKE_modifier_copydata(mod_src, mod_dst);
1866  if (mod_dst->type == eModifierType_ParticleSystem) {
1867  psys_dst->flag &= ~PSYS_DELETE;
1868  ((ParticleSystemModifierData *)mod_dst)->psys = psys_dst;
1869  }
1870 
1871  BLI_remlink(&ob_dst->modifiers, mod_dst);
1872  /* This handles NULL anchor as expected by adding at head of list. */
1873  BLI_insertlinkafter(&ob_dst->modifiers, mod_anchor, mod_dst);
1874 
1875  // printf("%s: We inserted a modifier '%s'...\n", __func__, mod_dst->name);
1876  RNA_property_update_main(bmain, NULL, ptr_dst, prop_dst);
1877  return true;
1878 }
1879 
1880 static GpencilModifierData *rna_Object_greasepencil_modifier_new(
1881  Object *object, bContext *C, ReportList *reports, const char *name, int type)
1882 {
1884  reports, CTX_data_main(C), CTX_data_scene(C), object, name, type);
1885 }
1886 
1887 static void rna_Object_greasepencil_modifier_remove(Object *object,
1888  bContext *C,
1889  ReportList *reports,
1890  PointerRNA *gmd_ptr)
1891 {
1892  GpencilModifierData *gmd = gmd_ptr->data;
1893  if (ED_object_gpencil_modifier_remove(reports, CTX_data_main(C), object, gmd) == false) {
1894  /* error is already set */
1895  return;
1896  }
1897 
1898  RNA_POINTER_INVALIDATE(gmd_ptr);
1899 
1901 }
1902 
1903 static void rna_Object_greasepencil_modifier_clear(Object *object, bContext *C)
1904 {
1907 }
1908 
1909 bool rna_Object_greasepencil_modifiers_override_apply(Main *bmain,
1910  PointerRNA *ptr_dst,
1911  PointerRNA *ptr_src,
1912  PointerRNA *UNUSED(ptr_storage),
1913  PropertyRNA *prop_dst,
1914  PropertyRNA *UNUSED(prop_src),
1915  PropertyRNA *UNUSED(prop_storage),
1916  const int UNUSED(len_dst),
1917  const int UNUSED(len_src),
1918  const int UNUSED(len_storage),
1919  PointerRNA *UNUSED(ptr_item_dst),
1920  PointerRNA *UNUSED(ptr_item_src),
1921  PointerRNA *UNUSED(ptr_item_storage),
1923 {
1925  "Unsupported RNA override operation on modifiers collection");
1926 
1927  Object *ob_dst = (Object *)ptr_dst->owner_id;
1928  Object *ob_src = (Object *)ptr_src->owner_id;
1929 
1930  /* Remember that insertion operations are defined and stored in correct order, which means that
1931  * even if we insert several items in a row, we always insert first one, then second one, etc.
1932  * So we should always find 'anchor' modifier in both _src *and* _dst. */
1933  const size_t name_offset = offsetof(GpencilModifierData, name);
1935  &ob_dst->greasepencil_modifiers,
1936  opop->subitem_reference_name,
1937  name_offset,
1938  opop->subitem_reference_index);
1939  /* If `mod_anchor` is NULL, `mod_src` will be inserted in first position. */
1940 
1941  GpencilModifierData *mod_src = BLI_listbase_string_or_index_find(&ob_src->greasepencil_modifiers,
1942  opop->subitem_local_name,
1943  name_offset,
1944  opop->subitem_local_index);
1945 
1946  if (mod_src == NULL) {
1947  BLI_assert(mod_src != NULL);
1948  return false;
1949  }
1950 
1951  /* While it would be nicer to use lower-level BKE_modifier_new() here, this one is lacking
1952  * special-cases handling (particles and other physics modifiers mostly), so using the ED version
1953  * instead, to avoid duplicating code. */
1955  NULL, bmain, NULL, ob_dst, mod_src->name, mod_src->type);
1956 
1957  BLI_remlink(&ob_dst->greasepencil_modifiers, mod_dst);
1958  /* This handles NULL anchor as expected by adding at head of list. */
1959  BLI_insertlinkafter(&ob_dst->greasepencil_modifiers, mod_anchor, mod_dst);
1960 
1961  // printf("%s: We inserted a gpencil modifier '%s'...\n", __func__, mod_dst->name);
1962  RNA_property_update_main(bmain, NULL, ptr_dst, prop_dst);
1963  return true;
1964 }
1965 
1966 /* shader fx */
1967 static ShaderFxData *rna_Object_shaderfx_new(
1968  Object *object, bContext *C, ReportList *reports, const char *name, int type)
1969 {
1970  return ED_object_shaderfx_add(reports, CTX_data_main(C), CTX_data_scene(C), object, name, type);
1971 }
1972 
1973 static void rna_Object_shaderfx_remove(Object *object,
1974  bContext *C,
1975  ReportList *reports,
1976  PointerRNA *gmd_ptr)
1977 {
1978  ShaderFxData *gmd = gmd_ptr->data;
1979  if (ED_object_shaderfx_remove(reports, CTX_data_main(C), object, gmd) == false) {
1980  /* error is already set */
1981  return;
1982  }
1983 
1984  RNA_POINTER_INVALIDATE(gmd_ptr);
1985 
1987 }
1988 
1989 static void rna_Object_shaderfx_clear(Object *object, bContext *C)
1990 {
1993 }
1994 
1995 static void rna_Object_boundbox_get(PointerRNA *ptr, float *values)
1996 {
1997  Object *ob = (Object *)ptr->owner_id;
1998  const BoundBox *bb = BKE_object_boundbox_get(ob);
1999  if (bb) {
2000  memcpy(values, bb->vec, sizeof(bb->vec));
2001  }
2002  else {
2003  copy_vn_fl(values, sizeof(bb->vec) / sizeof(float), 0.0f);
2004  }
2005 }
2006 
2007 static bool check_object_vgroup_support_and_warn(const Object *ob,
2008  const char *op_name,
2009  ReportList *reports)
2010 {
2012  const char *ob_type_name = "Unknown";
2014  BKE_reportf(reports, RPT_ERROR, "%s is not supported for '%s' objects", op_name, ob_type_name);
2015  return false;
2016  }
2017  return true;
2018 }
2019 
2020 static bDeformGroup *rna_Object_vgroup_new(Object *ob,
2021  Main *bmain,
2022  ReportList *reports,
2023  const char *name)
2024 {
2025  if (!check_object_vgroup_support_and_warn(ob, "VertexGroups.new()", reports)) {
2026  return NULL;
2027  }
2028 
2029  bDeformGroup *defgroup = BKE_object_defgroup_add_name(ob, name);
2030 
2031  DEG_relations_tag_update(bmain);
2033 
2034  return defgroup;
2035 }
2036 
2037 static void rna_Object_vgroup_remove(Object *ob,
2038  Main *bmain,
2039  ReportList *reports,
2040  PointerRNA *defgroup_ptr)
2041 {
2042  if (!check_object_vgroup_support_and_warn(ob, "VertexGroups.remove()", reports)) {
2043  return;
2044  }
2045 
2046  bDeformGroup *defgroup = defgroup_ptr->data;
2048 
2049  if (BLI_findindex(defbase, defgroup) == -1) {
2050  BKE_reportf(reports,
2051  RPT_ERROR,
2052  "DeformGroup '%s' not in object '%s'",
2053  defgroup->name,
2054  ob->id.name + 2);
2055  return;
2056  }
2057 
2058  BKE_object_defgroup_remove(ob, defgroup);
2059  RNA_POINTER_INVALIDATE(defgroup_ptr);
2060 
2061  DEG_relations_tag_update(bmain);
2063 }
2064 
2065 static void rna_Object_vgroup_clear(Object *ob, Main *bmain, ReportList *reports)
2066 {
2067  if (!check_object_vgroup_support_and_warn(ob, "VertexGroups.clear()", reports)) {
2068  return;
2069  }
2070 
2072 
2073  DEG_relations_tag_update(bmain);
2075 }
2076 
2077 static void rna_VertexGroup_vertex_add(ID *id,
2078  bDeformGroup *def,
2079  ReportList *reports,
2080  int index_len,
2081  int *index,
2082  float weight,
2083  int assignmode)
2084 {
2085  Object *ob = (Object *)id;
2086 
2088  BKE_report(
2089  reports, RPT_ERROR, "VertexGroup.add(): cannot be called while object is in edit mode");
2090  return;
2091  }
2092 
2093  while (index_len--) {
2094  /* XXX: not efficient calling within loop. */
2095  ED_vgroup_vert_add(ob, def, *index++, weight, assignmode);
2096  }
2097 
2100 }
2101 
2102 static void rna_VertexGroup_vertex_remove(
2103  ID *id, bDeformGroup *dg, ReportList *reports, int index_len, int *index)
2104 {
2105  Object *ob = (Object *)id;
2106 
2108  BKE_report(
2109  reports, RPT_ERROR, "VertexGroup.remove(): cannot be called while object is in edit mode");
2110  return;
2111  }
2112 
2113  while (index_len--) {
2114  ED_vgroup_vert_remove(ob, dg, *index++);
2115  }
2116 
2119 }
2120 
2121 static float rna_VertexGroup_weight(ID *id, bDeformGroup *dg, ReportList *reports, int index)
2122 {
2123  float weight = ED_vgroup_vert_weight((Object *)id, dg, index);
2124 
2125  if (weight < 0) {
2126  BKE_report(reports, RPT_ERROR, "Vertex not in group");
2127  }
2128  return weight;
2129 }
2130 
2131 static bFaceMap *rna_Object_fmap_new(Object *ob, const char *name)
2132 {
2133  bFaceMap *fmap = BKE_object_facemap_add_name(ob, name);
2134 
2136 
2137  return fmap;
2138 }
2139 
2140 static void rna_Object_fmap_remove(Object *ob, ReportList *reports, PointerRNA *fmap_ptr)
2141 {
2142  bFaceMap *fmap = fmap_ptr->data;
2143  if (BLI_findindex(&ob->fmaps, fmap) == -1) {
2144  BKE_reportf(
2145  reports, RPT_ERROR, "Face map '%s' not in object '%s'", fmap->name, ob->id.name + 2);
2146  return;
2147  }
2148 
2149  BKE_object_facemap_remove(ob, fmap);
2150  RNA_POINTER_INVALIDATE(fmap_ptr);
2151 
2153 }
2154 
2155 static void rna_Object_fmap_clear(Object *ob)
2156 {
2158 
2160 }
2161 
2162 static void rna_FaceMap_face_add(
2163  ID *id, bFaceMap *fmap, ReportList *reports, int index_len, int *index)
2164 {
2165  Object *ob = (Object *)id;
2166 
2167  if (BKE_object_is_in_editmode(ob)) {
2168  BKE_report(reports, RPT_ERROR, "FaceMap.add(): cannot be called while object is in edit mode");
2169  return;
2170  }
2171 
2172  while (index_len--) {
2173  ED_object_facemap_face_add(ob, fmap, *index++);
2174  }
2175 
2177 }
2178 
2179 static void rna_FaceMap_face_remove(
2180  ID *id, bFaceMap *fmap, ReportList *reports, int index_len, int *index)
2181 {
2182  Object *ob = (Object *)id;
2183 
2184  if (BKE_object_is_in_editmode(ob)) {
2185  BKE_report(reports, RPT_ERROR, "FaceMap.add(): cannot be called while object is in edit mode");
2186  return;
2187  }
2188 
2189  while (index_len--) {
2190  ED_object_facemap_face_remove(ob, fmap, *index++);
2191  }
2192 
2194 }
2195 
2196 /* generic poll functions */
2198 {
2199  return ((Object *)value.owner_id)->type == OB_LATTICE;
2200 }
2201 
2203 {
2204  return ((Object *)value.owner_id)->type == OB_CURVES_LEGACY;
2205 }
2206 
2208 {
2209  return ((Object *)value.owner_id)->type == OB_ARMATURE;
2210 }
2211 
2213 {
2214  return ((Object *)value.owner_id)->type == OB_MESH;
2215 }
2216 
2218 {
2219  return ((Object *)value.owner_id)->type == OB_CAMERA;
2220 }
2221 
2223 {
2224  return ((Object *)value.owner_id)->type == OB_LAMP;
2225 }
2226 
2228 {
2229  return ((Object *)value.owner_id)->type == OB_GPENCIL;
2230 }
2231 
2232 int rna_Object_use_dynamic_topology_sculpting_get(PointerRNA *ptr)
2233 {
2234  SculptSession *ss = ((Object *)ptr->owner_id)->sculpt;
2235  return (ss && ss->bm);
2236 }
2237 
2238 static void rna_object_lineart_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
2239 {
2242 }
2243 
2244 static char *rna_ObjectLineArt_path(const PointerRNA *UNUSED(ptr))
2245 {
2246  return BLI_strdup("lineart");
2247 }
2248 
2249 static bool mesh_symmetry_get_common(PointerRNA *ptr, const eMeshSymmetryType sym)
2250 {
2251  const Object *ob = (Object *)ptr->owner_id;
2252  if (ob->type != OB_MESH) {
2253  return false;
2254  }
2255 
2256  const Mesh *mesh = ob->data;
2257  return mesh->symmetry & sym;
2258 }
2259 
2260 static bool rna_Object_mesh_symmetry_x_get(PointerRNA *ptr)
2261 {
2262  return mesh_symmetry_get_common(ptr, ME_SYMMETRY_X);
2263 }
2264 
2265 static bool rna_Object_mesh_symmetry_y_get(PointerRNA *ptr)
2266 {
2267  return mesh_symmetry_get_common(ptr, ME_SYMMETRY_Y);
2268 }
2269 
2270 static bool rna_Object_mesh_symmetry_z_get(PointerRNA *ptr)
2271 {
2272  return mesh_symmetry_get_common(ptr, ME_SYMMETRY_Z);
2273 }
2274 
2275 static void mesh_symmetry_set_common(PointerRNA *ptr,
2276  const bool value,
2277  const eMeshSymmetryType sym)
2278 {
2279  Object *ob = (Object *)ptr->owner_id;
2280  if (ob->type != OB_MESH) {
2281  return;
2282  }
2283 
2284  Mesh *mesh = ob->data;
2285  if (value) {
2286  mesh->symmetry |= sym;
2287  }
2288  else {
2289  mesh->symmetry &= ~sym;
2290  }
2291 }
2292 
2293 static void rna_Object_mesh_symmetry_x_set(PointerRNA *ptr, bool value)
2294 {
2295  mesh_symmetry_set_common(ptr, value, ME_SYMMETRY_X);
2296 }
2297 
2298 static void rna_Object_mesh_symmetry_y_set(PointerRNA *ptr, bool value)
2299 {
2300  mesh_symmetry_set_common(ptr, value, ME_SYMMETRY_Y);
2301 }
2302 
2303 static void rna_Object_mesh_symmetry_z_set(PointerRNA *ptr, bool value)
2304 {
2305  mesh_symmetry_set_common(ptr, value, ME_SYMMETRY_Z);
2306 }
2307 
2308 static int rna_Object_mesh_symmetry_yz_editable(PointerRNA *ptr, const char **UNUSED(r_info))
2309 {
2310  const Object *ob = (Object *)ptr->owner_id;
2311  if (ob->type != OB_MESH) {
2312  return 0;
2313  }
2314 
2315  const Mesh *mesh = ob->data;
2317  /* Only X symmetry is available in weightpaint mode. */
2318  return 0;
2319  }
2320 
2321  return PROP_EDITABLE;
2322 }
2323 
2324 void rna_Object_lightgroup_get(PointerRNA *ptr, char *value)
2325 {
2326  BKE_lightgroup_membership_get(((Object *)ptr->owner_id)->lightgroup, value);
2327 }
2328 
2329 int rna_Object_lightgroup_length(PointerRNA *ptr)
2330 {
2331  return BKE_lightgroup_membership_length(((Object *)ptr->owner_id)->lightgroup);
2332 }
2333 
2334 void rna_Object_lightgroup_set(PointerRNA *ptr, const char *value)
2335 {
2336  BKE_lightgroup_membership_set(&((Object *)ptr->owner_id)->lightgroup, value);
2337 }
2338 
2339 #else
2340 
2342 {
2343  StructRNA *srna;
2344  PropertyRNA *prop;
2345  FunctionRNA *func;
2346  PropertyRNA *parm;
2347 
2348  static const EnumPropertyItem assign_mode_items[] = {
2349  {WEIGHT_REPLACE, "REPLACE", 0, "Replace", "Replace"},
2350  {WEIGHT_ADD, "ADD", 0, "Add", "Add"},
2351  {WEIGHT_SUBTRACT, "SUBTRACT", 0, "Subtract", "Subtract"},
2352  {0, NULL, 0, NULL, NULL},
2353  };
2354 
2355  srna = RNA_def_struct(brna, "VertexGroup", NULL);
2356  RNA_def_struct_sdna(srna, "bDeformGroup");
2358  srna, "Vertex Group", "Group of vertices, used for armature deform and other purposes");
2359  RNA_def_struct_ui_icon(srna, ICON_GROUP_VERTEX);
2360 
2361  prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
2362  RNA_def_property_ui_text(prop, "Name", "Vertex group name");
2363  RNA_def_struct_name_property(srna, prop);
2364  RNA_def_property_string_funcs(prop, NULL, NULL, "rna_VertexGroup_name_set");
2365  /* update data because modifiers may use T24761. */
2367  prop, NC_GEOM | ND_DATA | NA_RENAME, "rna_Object_internal_update_data_dependency");
2368 
2369  prop = RNA_def_property(srna, "lock_weight", PROP_BOOLEAN, PROP_NONE);
2370  RNA_def_property_ui_text(prop, "", "Maintain the relative weights for the group");
2371  RNA_def_property_boolean_sdna(prop, NULL, "flag", 0);
2372  /* update data because modifiers may use T24761. */
2373  RNA_def_property_update(prop, NC_GEOM | ND_DATA | NA_RENAME, "rna_Object_internal_update_data");
2374 
2375  prop = RNA_def_property(srna, "index", PROP_INT, PROP_UNSIGNED);
2377  RNA_def_property_int_funcs(prop, "rna_VertexGroup_index_get", NULL, NULL);
2378  RNA_def_property_ui_text(prop, "Index", "Index number of the vertex group");
2379 
2380  func = RNA_def_function(srna, "add", "rna_VertexGroup_vertex_add");
2381  RNA_def_function_ui_description(func, "Add vertices to the group");
2383  /* TODO: see how array size of 0 works, this shouldn't be used. */
2384  parm = RNA_def_int_array(func, "index", 1, NULL, 0, 0, "", "List of indices", 0, 0);
2386  parm = RNA_def_float(func, "weight", 0, 0.0f, 1.0f, "", "Vertex weight", 0.0f, 1.0f);
2388  parm = RNA_def_enum(func, "type", assign_mode_items, 0, "", "Vertex assign mode");
2390 
2391  func = RNA_def_function(srna, "remove", "rna_VertexGroup_vertex_remove");
2392  RNA_def_function_ui_description(func, "Remove vertices from the group");
2394  /* TODO: see how array size of 0 works, this shouldn't be used. */
2395  parm = RNA_def_int_array(func, "index", 1, NULL, 0, 0, "", "List of indices", 0, 0);
2397 
2398  func = RNA_def_function(srna, "weight", "rna_VertexGroup_weight");
2399  RNA_def_function_ui_description(func, "Get a vertex weight from the group");
2401  parm = RNA_def_int(func, "index", 0, 0, INT_MAX, "Index", "The index of the vertex", 0, INT_MAX);
2403  parm = RNA_def_float(func, "weight", 0, 0.0f, 1.0f, "", "Vertex weight", 0.0f, 1.0f);
2404  RNA_def_function_return(func, parm);
2405 }
2406 
2407 static void rna_def_face_map(BlenderRNA *brna)
2408 {
2409  StructRNA *srna;
2410  PropertyRNA *prop;
2411 
2412  FunctionRNA *func;
2413  PropertyRNA *parm;
2414 
2415  srna = RNA_def_struct(brna, "FaceMap", NULL);
2416  RNA_def_struct_sdna(srna, "bFaceMap");
2418  srna, "Face Map", "Group of faces, each face can only be part of one map");
2419  RNA_def_struct_ui_icon(srna, ICON_MOD_TRIANGULATE);
2420 
2421  prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
2422  RNA_def_property_ui_text(prop, "Name", "Face map name");
2423  RNA_def_struct_name_property(srna, prop);
2424  RNA_def_property_string_funcs(prop, NULL, NULL, "rna_FaceMap_name_set");
2425  /* update data because modifiers may use T24761. */
2426  RNA_def_property_update(prop, NC_GEOM | ND_DATA | NA_RENAME, "rna_Object_internal_update_data");
2427 
2428  prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
2429  RNA_def_property_boolean_sdna(prop, NULL, "flag", SELECT);
2430  RNA_def_property_ui_text(prop, "Select", "Face map selection state (for tools to use)");
2431  /* important not to use a notifier here, creates a feedback loop! */
2432 
2433  prop = RNA_def_property(srna, "index", PROP_INT, PROP_UNSIGNED);
2435  RNA_def_property_int_funcs(prop, "rna_FaceMap_index_get", NULL, NULL);
2436  RNA_def_property_ui_text(prop, "Index", "Index number of the face map");
2437 
2438  func = RNA_def_function(srna, "add", "rna_FaceMap_face_add");
2439  RNA_def_function_ui_description(func, "Add faces to the face-map");
2441  /* TODO: see how array size of 0 works, this shouldn't be used. */
2442  parm = RNA_def_int_array(func, "index", 1, NULL, 0, 0, "", "List of indices", 0, 0);
2444 
2445  func = RNA_def_function(srna, "remove", "rna_FaceMap_face_remove");
2446  RNA_def_function_ui_description(func, "Remove faces from the face-map");
2448  /* TODO: see how array size of 0 works, this shouldn't be used. */
2449  parm = RNA_def_int_array(func, "index", 1, NULL, 0, 0, "", "List of indices", 0, 0);
2451 }
2452 
2454 {
2455  StructRNA *srna;
2456  PropertyRNA *prop;
2457 
2458  static const EnumPropertyItem link_items[] = {
2459  {1, "OBJECT", 0, "Object", ""},
2460  {0, "DATA", 0, "Data", ""},
2461  {0, NULL, 0, NULL, NULL},
2462  };
2463 
2464  /* NOTE: there is no MaterialSlot equivalent in DNA, so the internal
2465  * pointer data points to ob->mat + index, and we manually implement
2466  * get/set for the properties. */
2467 
2468  srna = RNA_def_struct(brna, "MaterialSlot", NULL);
2469  RNA_def_struct_ui_text(srna, "Material Slot", "Material slot in an object");
2470  RNA_def_struct_ui_icon(srna, ICON_MATERIAL_DATA);
2471 
2473 
2474  /* WARNING! Order is crucial for override to work properly here... :/
2475  * 'link' must come before material pointer,
2476  * since it defines where (in object or obdata) that one is set! */
2477  prop = RNA_def_property(srna, "link", PROP_ENUM, PROP_NONE);
2478  RNA_def_property_enum_items(prop, link_items);
2480  prop, "rna_MaterialSlot_link_get", "rna_MaterialSlot_link_set", NULL);
2481  RNA_def_property_ui_text(prop, "Link", "Link material to object or the object's data");
2482  RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_MaterialSlot_update");
2483 
2484  prop = RNA_def_property(srna, "material", PROP_POINTER, PROP_NONE);
2485  RNA_def_property_struct_type(prop, "Material");
2487  RNA_def_property_editable_func(prop, "rna_MaterialSlot_material_editable");
2489  "rna_MaterialSlot_material_get",
2490  "rna_MaterialSlot_material_set",
2491  NULL,
2492  "rna_MaterialSlot_material_poll");
2493  RNA_def_property_ui_text(prop, "Material", "Material data-block used by this material slot");
2494  RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_MaterialSlot_update");
2495 
2496  prop = RNA_def_property(srna, "slot_index", PROP_INT, PROP_NONE);
2498  RNA_def_property_int_funcs(prop, "rna_MaterialSlot_index_get", NULL, NULL);
2499 
2500  prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
2502  prop, "rna_MaterialSlot_name_get", "rna_MaterialSlot_name_length", NULL);
2503  RNA_def_property_ui_text(prop, "Name", "Material slot name");
2507  RNA_def_struct_name_property(srna, prop);
2508 
2510 
2511  RNA_def_struct_path_func(srna, "rna_MaterialSlot_path");
2512 }
2513 
2515 {
2516  StructRNA *srna;
2517  PropertyRNA *prop;
2518 
2519  FunctionRNA *func;
2520  PropertyRNA *parm;
2521 
2522  RNA_def_property_srna(cprop, "ObjectConstraints");
2523  srna = RNA_def_struct(brna, "ObjectConstraints", NULL);
2524  RNA_def_struct_sdna(srna, "Object");
2525  RNA_def_struct_ui_text(srna, "Object Constraints", "Collection of object constraints");
2526 
2527  /* Collection active property */
2528  prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
2529  RNA_def_property_struct_type(prop, "Constraint");
2531  prop, "rna_Object_active_constraint_get", "rna_Object_active_constraint_set", NULL, NULL);
2533  RNA_def_property_ui_text(prop, "Active Constraint", "Active Object constraint");
2534 
2535  /* Constraint collection */
2536  func = RNA_def_function(srna, "new", "rna_Object_constraints_new");
2537  RNA_def_function_ui_description(func, "Add a new constraint to this object");
2539  /* object to add */
2540  parm = RNA_def_enum(
2541  func, "type", rna_enum_constraint_type_items, 1, "", "Constraint type to add");
2543  /* return type */
2544  parm = RNA_def_pointer(func, "constraint", "Constraint", "", "New constraint");
2545  RNA_def_function_return(func, parm);
2546 
2547  func = RNA_def_function(srna, "remove", "rna_Object_constraints_remove");
2548  RNA_def_function_ui_description(func, "Remove a constraint from this object");
2550  /* constraint to remove */
2551  parm = RNA_def_pointer(func, "constraint", "Constraint", "", "Removed constraint");
2554 
2555  func = RNA_def_function(srna, "clear", "rna_Object_constraints_clear");
2557  RNA_def_function_ui_description(func, "Remove all constraint from this object");
2558 
2559  func = RNA_def_function(srna, "move", "rna_Object_constraints_move");
2560  RNA_def_function_ui_description(func, "Move a constraint to a different position");
2562  parm = RNA_def_int(
2563  func, "from_index", -1, INT_MIN, INT_MAX, "From Index", "Index to move", 0, 10000);
2565  parm = RNA_def_int(func, "to_index", -1, INT_MIN, INT_MAX, "To Index", "Target index", 0, 10000);
2567 
2568  func = RNA_def_function(srna, "copy", "rna_Object_constraints_copy");
2569  RNA_def_function_ui_description(func, "Add a new constraint that is a copy of the given one");
2571  /* constraint to copy */
2572  parm = RNA_def_pointer(func,
2573  "constraint",
2574  "Constraint",
2575  "",
2576  "Constraint to copy - may belong to a different object");
2579  /* return type */
2580  parm = RNA_def_pointer(func, "new_constraint", "Constraint", "", "New constraint");
2581  RNA_def_function_return(func, parm);
2582 }
2583 
2584 /* object.modifiers */
2586 {
2587  StructRNA *srna;
2588 
2589  FunctionRNA *func;
2590  PropertyRNA *parm;
2591  PropertyRNA *prop;
2592 
2593  RNA_def_property_srna(cprop, "ObjectModifiers");
2594  srna = RNA_def_struct(brna, "ObjectModifiers", NULL);
2595  RNA_def_struct_sdna(srna, "Object");
2596  RNA_def_struct_ui_text(srna, "Object Modifiers", "Collection of object modifiers");
2597 
2598 # if 0
2599  prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
2600  RNA_def_property_struct_type(prop, "EditBone");
2601  RNA_def_property_pointer_sdna(prop, NULL, "act_edbone");
2603  RNA_def_property_ui_text(prop, "Active EditBone", "Armatures active edit bone");
2604  // RNA_def_property_update(prop, 0, "rna_Armature_act_editbone_update");
2605  RNA_def_property_pointer_funcs(prop, NULL, "rna_Armature_act_edit_bone_set", NULL, NULL);
2606 
2607  /* TODO: redraw. */
2608  // RNA_def_property_collection_active(prop, prop_act);
2609 # endif
2610 
2611  /* add modifier */
2612  func = RNA_def_function(srna, "new", "rna_Object_modifier_new");
2614  RNA_def_function_ui_description(func, "Add a new modifier");
2615  parm = RNA_def_string(func, "name", "Name", 0, "", "New name for the modifier");
2617  /* modifier to add */
2618  parm = RNA_def_enum(
2619  func, "type", rna_enum_object_modifier_type_items, 1, "", "Modifier type to add");
2621  /* return type */
2622  parm = RNA_def_pointer(func, "modifier", "Modifier", "", "Newly created modifier");
2623  RNA_def_function_return(func, parm);
2624 
2625  /* remove modifier */
2626  func = RNA_def_function(srna, "remove", "rna_Object_modifier_remove");
2628  RNA_def_function_ui_description(func, "Remove an existing modifier from the object");
2629  /* modifier to remove */
2630  parm = RNA_def_pointer(func, "modifier", "Modifier", "", "Modifier to remove");
2633 
2634  /* clear all modifiers */
2635  func = RNA_def_function(srna, "clear", "rna_Object_modifier_clear");
2637  RNA_def_function_ui_description(func, "Remove all modifiers from the object");
2638 
2639  /* Active modifier. */
2640  prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
2641  RNA_def_property_struct_type(prop, "Modifier");
2643  prop, "rna_Object_active_modifier_get", "rna_Object_active_modifier_set", NULL, NULL);
2647  RNA_def_property_ui_text(prop, "Active Modifier", "The active modifier in the list");
2649 }
2650 
2651 /* object.grease_pencil_modifiers */
2653 {
2654  StructRNA *srna;
2655 
2656  FunctionRNA *func;
2657  PropertyRNA *parm;
2658 
2659  RNA_def_property_srna(cprop, "ObjectGpencilModifiers");
2660  srna = RNA_def_struct(brna, "ObjectGpencilModifiers", NULL);
2661  RNA_def_struct_sdna(srna, "Object");
2663  srna, "Object Grease Pencil Modifiers", "Collection of object grease pencil modifiers");
2664 
2665  /* add greasepencil modifier */
2666  func = RNA_def_function(srna, "new", "rna_Object_greasepencil_modifier_new");
2668  RNA_def_function_ui_description(func, "Add a new greasepencil_modifier");
2669  parm = RNA_def_string(func, "name", "Name", 0, "", "New name for the greasepencil_modifier");
2671  /* greasepencil_modifier to add */
2672  parm = RNA_def_enum(func,
2673  "type",
2675  1,
2676  "",
2677  "Modifier type to add");
2679  /* return type */
2680  parm = RNA_def_pointer(
2681  func, "greasepencil_modifier", "GpencilModifier", "", "Newly created modifier");
2682  RNA_def_function_return(func, parm);
2683 
2684  /* remove greasepencil_modifier */
2685  func = RNA_def_function(srna, "remove", "rna_Object_greasepencil_modifier_remove");
2688  "Remove an existing greasepencil_modifier from the object");
2689  /* greasepencil_modifier to remove */
2690  parm = RNA_def_pointer(
2691  func, "greasepencil_modifier", "GpencilModifier", "", "Modifier to remove");
2694 
2695  /* clear all greasepencil modifiers */
2696  func = RNA_def_function(srna, "clear", "rna_Object_greasepencil_modifier_clear");
2698  RNA_def_function_ui_description(func, "Remove all grease pencil modifiers from the object");
2699 }
2700 
2701 /* object.shaderfxs */
2703 {
2704  StructRNA *srna;
2705 
2706  FunctionRNA *func;
2707  PropertyRNA *parm;
2708 
2709  RNA_def_property_srna(cprop, "ObjectShaderFx");
2710  srna = RNA_def_struct(brna, "ObjectShaderFx", NULL);
2711  RNA_def_struct_sdna(srna, "Object");
2712  RNA_def_struct_ui_text(srna, "Object Shader Effects", "Collection of object effects");
2713 
2714  /* add shader_fx */
2715  func = RNA_def_function(srna, "new", "rna_Object_shaderfx_new");
2717  RNA_def_function_ui_description(func, "Add a new shader fx");
2718  parm = RNA_def_string(func, "name", "Name", 0, "", "New name for the effect");
2720  /* shader to add */
2721  parm = RNA_def_enum(
2722  func, "type", rna_enum_object_shaderfx_type_items, 1, "", "Effect type to add");
2724  /* return type */
2725  parm = RNA_def_pointer(func, "shader_fx", "ShaderFx", "", "Newly created effect");
2726  RNA_def_function_return(func, parm);
2727 
2728  /* remove shader_fx */
2729  func = RNA_def_function(srna, "remove", "rna_Object_shaderfx_remove");
2731  RNA_def_function_ui_description(func, "Remove an existing effect from the object");
2732  /* shader to remove */
2733  parm = RNA_def_pointer(func, "shader_fx", "ShaderFx", "", "Effect to remove");
2736 
2737  /* clear all shader fx */
2738  func = RNA_def_function(srna, "clear", "rna_Object_shaderfx_clear");
2740  RNA_def_function_ui_description(func, "Remove all effects from the object");
2741 }
2742 
2743 /* object.particle_systems */
2745 {
2746  StructRNA *srna;
2747 
2748  PropertyRNA *prop;
2749 
2750  /* FunctionRNA *func; */
2751  /* PropertyRNA *parm; */
2752 
2753  RNA_def_property_srna(cprop, "ParticleSystems");
2754  srna = RNA_def_struct(brna, "ParticleSystems", NULL);
2755  RNA_def_struct_sdna(srna, "Object");
2756  RNA_def_struct_ui_text(srna, "Particle Systems", "Collection of particle systems");
2757 
2758  prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
2759  RNA_def_property_struct_type(prop, "ParticleSystem");
2760  RNA_def_property_pointer_funcs(prop, "rna_Object_active_particle_system_get", NULL, NULL, NULL);
2762  prop, "Active Particle System", "Active particle system being displayed");
2764 
2765  prop = RNA_def_property(srna, "active_index", PROP_INT, PROP_UNSIGNED);
2768  "rna_Object_active_particle_system_index_get",
2769  "rna_Object_active_particle_system_index_set",
2770  "rna_Object_active_particle_system_index_range");
2772  prop, "Active Particle System Index", "Index of active particle system slot");
2773  RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_particle_update");
2774 }
2775 
2776 /* object.vertex_groups */
2778 {
2779  StructRNA *srna;
2780 
2781  PropertyRNA *prop;
2782 
2783  FunctionRNA *func;
2784  PropertyRNA *parm;
2785 
2786  RNA_def_property_srna(cprop, "VertexGroups");
2787  srna = RNA_def_struct(brna, "VertexGroups", NULL);
2788  RNA_def_struct_sdna(srna, "Object");
2789  RNA_def_struct_ui_text(srna, "Vertex Groups", "Collection of vertex groups");
2790 
2791  prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
2792  RNA_def_property_struct_type(prop, "VertexGroup");
2794  "rna_Object_active_vertex_group_get",
2795  "rna_Object_active_vertex_group_set",
2796  NULL,
2797  NULL);
2799  RNA_def_property_ui_text(prop, "Active Vertex Group", "Vertex groups of the object");
2800  RNA_def_property_update(prop, NC_GEOM | ND_DATA, "rna_Object_internal_update_data");
2801 
2802  prop = RNA_def_property(srna, "active_index", PROP_INT, PROP_UNSIGNED);
2805  "rna_Object_active_vertex_group_index_get",
2806  "rna_Object_active_vertex_group_index_set",
2807  "rna_Object_active_vertex_group_index_range");
2809  prop, "Active Vertex Group Index", "Active index in vertex group array");
2810  RNA_def_property_update(prop, NC_GEOM | ND_DATA, "rna_Object_internal_update_data");
2811 
2812  /* vertex groups */ /* add_vertex_group */
2813  func = RNA_def_function(srna, "new", "rna_Object_vgroup_new");
2815  RNA_def_function_ui_description(func, "Add vertex group to object");
2816  RNA_def_string(func, "name", "Group", 0, "", "Vertex group name"); /* optional */
2817  parm = RNA_def_pointer(func, "group", "VertexGroup", "", "New vertex group");
2818  RNA_def_function_return(func, parm);
2819 
2820  func = RNA_def_function(srna, "remove", "rna_Object_vgroup_remove");
2822  RNA_def_function_ui_description(func, "Delete vertex group from object");
2823  parm = RNA_def_pointer(func, "group", "VertexGroup", "", "Vertex group to remove");
2826 
2827  func = RNA_def_function(srna, "clear", "rna_Object_vgroup_clear");
2829  RNA_def_function_ui_description(func, "Delete all vertex groups from object");
2830 }
2831 
2832 /* object.face_maps */
2834 {
2835  StructRNA *srna;
2836 
2837  PropertyRNA *prop;
2838 
2839  FunctionRNA *func;
2840  PropertyRNA *parm;
2841 
2842  RNA_def_property_srna(cprop, "FaceMaps");
2843  srna = RNA_def_struct(brna, "FaceMaps", NULL);
2844  RNA_def_struct_sdna(srna, "Object");
2845  RNA_def_struct_ui_text(srna, "Face Maps", "Collection of face maps");
2846 
2847  prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
2848  RNA_def_property_struct_type(prop, "FaceMap");
2850  prop, "rna_Object_active_face_map_get", "rna_Object_active_face_map_set", NULL, NULL);
2851  RNA_def_property_ui_text(prop, "Active Face Map", "Face maps of the object");
2852  RNA_def_property_update(prop, NC_GEOM | ND_DATA, "rna_Object_internal_update_data");
2853 
2854  prop = RNA_def_property(srna, "active_index", PROP_INT, PROP_UNSIGNED);
2856  RNA_def_property_int_sdna(prop, NULL, "actfmap");
2858  "rna_Object_active_face_map_index_get",
2859  "rna_Object_active_face_map_index_set",
2860  "rna_Object_active_face_map_index_range");
2861  RNA_def_property_ui_text(prop, "Active Face Map Index", "Active index in face map array");
2862  RNA_def_property_update(prop, NC_GEOM | ND_DATA, "rna_Object_internal_update_data");
2863 
2864  /* face maps */ /* add_face_map */
2865  func = RNA_def_function(srna, "new", "rna_Object_fmap_new");
2866  RNA_def_function_ui_description(func, "Add face map to object");
2867  RNA_def_string(func, "name", "Map", 0, "", "face map name"); /* optional */
2868  parm = RNA_def_pointer(func, "fmap", "FaceMap", "", "New face map");
2869  RNA_def_function_return(func, parm);
2870 
2871  func = RNA_def_function(srna, "remove", "rna_Object_fmap_remove");
2873  RNA_def_function_ui_description(func, "Delete vertex group from object");
2874  parm = RNA_def_pointer(func, "group", "FaceMap", "", "Face map to remove");
2877 
2878  func = RNA_def_function(srna, "clear", "rna_Object_fmap_clear");
2879  RNA_def_function_ui_description(func, "Delete all vertex groups from object");
2880 }
2881 
2883 {
2884  StructRNA *srna;
2885  PropertyRNA *prop;
2886 
2887  srna = RNA_def_struct(brna, "ObjectDisplay", NULL);
2888  RNA_def_struct_ui_text(srna, "Object Display", "Object display settings for 3D viewport");
2889  RNA_def_struct_sdna(srna, "Object");
2890  RNA_def_struct_nested(brna, srna, "Object");
2891  RNA_def_struct_path_func(srna, "rna_ObjectDisplay_path");
2892 
2894 
2895  prop = RNA_def_property(srna, "show_shadows", PROP_BOOLEAN, PROP_NONE);
2898  RNA_def_property_ui_text(prop, "Shadow", "Object cast shadows in the 3D viewport");
2900 
2902 }
2903 
2905 {
2906  StructRNA *srna;
2907  PropertyRNA *prop;
2908 
2909  static EnumPropertyItem prop_feature_line_usage_items[] = {
2910  {OBJECT_LRT_INHERIT, "INHERIT", 0, "Inherit", "Use settings from the parent collection"},
2912  "INCLUDE",
2913  0,
2914  "Include",
2915  "Generate feature lines for this object's data"},
2917  "OCCLUSION_ONLY",
2918  0,
2919  "Occlusion Only",
2920  "Only use the object data to produce occlusion"},
2922  "EXCLUDE",
2923  0,
2924  "Exclude",
2925  "Don't use this object for Line Art rendering"},
2927  "INTERSECTION_ONLY",
2928  0,
2929  "Intersection Only",
2930  "Only generate intersection lines for this collection"},
2932  "NO_INTERSECTION",
2933  0,
2934  "No Intersection",
2935  "Include this object but do not generate intersection lines"},
2937  "FORCE_INTERSECTION",
2938  0,
2939  "Force Intersection",
2940  "Generate intersection lines even with objects that disabled intersection"},
2941  {0, NULL, 0, NULL, NULL},
2942  };
2943 
2944  srna = RNA_def_struct(brna, "ObjectLineArt", NULL);
2945  RNA_def_struct_ui_text(srna, "Object Line Art", "Object line art settings");
2946  RNA_def_struct_sdna(srna, "ObjectLineArt");
2947  RNA_def_struct_path_func(srna, "rna_ObjectLineArt_path");
2948 
2949  prop = RNA_def_property(srna, "usage", PROP_ENUM, PROP_NONE);
2950  RNA_def_property_enum_items(prop, prop_feature_line_usage_items);
2951  RNA_def_property_ui_text(prop, "Usage", "How to use this object in line art calculation");
2952  RNA_def_property_update(prop, 0, "rna_object_lineart_update");
2953 
2954  prop = RNA_def_property(srna, "use_crease_override", PROP_BOOLEAN, PROP_NONE);
2957  prop, "Use Crease", "Use this object's crease setting to overwrite scene global");
2958  RNA_def_property_update(prop, 0, "rna_object_lineart_update");
2959 
2960  prop = RNA_def_property(srna, "crease_threshold", PROP_FLOAT, PROP_ANGLE);
2961  RNA_def_property_range(prop, 0, DEG2RAD(180.0f));
2962  RNA_def_property_ui_range(prop, 0.0f, DEG2RAD(180.0f), 0.01f, 1);
2963  RNA_def_property_ui_text(prop, "Crease", "Angles smaller than this will be treated as creases");
2964  RNA_def_property_update(prop, 0, "rna_object_lineart_update");
2965 
2966  prop = RNA_def_property(srna, "use_intersection_priority_override", PROP_BOOLEAN, PROP_NONE);
2969  prop,
2970  "Use Intersection Priority",
2971  "Use this object's intersection priority to override collection setting");
2972  RNA_def_property_update(prop, 0, "rna_object_lineart_update");
2973 
2974  prop = RNA_def_property(srna, "intersection_priority", PROP_INT, PROP_NONE);
2975  RNA_def_property_range(prop, 0, 255);
2977  "Intersection Priority",
2978  "The intersection line will be included into the object with the "
2979  "higher intersection priority value");
2980  RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_object_lineart_update");
2981 }
2982 
2984 {
2985  PropertyRNA *prop;
2986 
2987  /* Hide options. */
2988  prop = RNA_def_property(srna, "hide_viewport", PROP_BOOLEAN, PROP_NONE);
2989  RNA_def_property_boolean_sdna(prop, NULL, "visibility_flag", OB_HIDE_VIEWPORT);
2990  RNA_def_property_ui_text(prop, "Disable in Viewports", "Globally disable in viewports");
2991  RNA_def_property_ui_icon(prop, ICON_RESTRICT_VIEW_OFF, -1);
2992  RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_hide_update");
2993 
2994  prop = RNA_def_property(srna, "hide_select", PROP_BOOLEAN, PROP_NONE);
2995  RNA_def_property_boolean_sdna(prop, NULL, "visibility_flag", OB_HIDE_SELECT);
2997  RNA_def_property_ui_text(prop, "Disable Selection", "Disable selection in viewport");
2998  RNA_def_property_ui_icon(prop, ICON_RESTRICT_SELECT_OFF, -1);
2999  RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_hide_update");
3000 
3001  prop = RNA_def_property(srna, "hide_render", PROP_BOOLEAN, PROP_NONE);
3002  RNA_def_property_boolean_sdna(prop, NULL, "visibility_flag", OB_HIDE_RENDER);
3003  RNA_def_property_ui_text(prop, "Disable in Renders", "Globally disable in renders");
3004  RNA_def_property_ui_icon(prop, ICON_RESTRICT_RENDER_OFF, -1);
3005  RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_hide_update");
3006 
3007  /* Instancer options. */
3008  prop = RNA_def_property(srna, "show_instancer_for_render", PROP_BOOLEAN, PROP_NONE);
3009  RNA_def_property_boolean_sdna(prop, NULL, "duplicator_visibility_flag", OB_DUPLI_FLAG_RENDER);
3010  RNA_def_property_ui_text(prop, "Render Instancer", "Make instancer visible when rendering");
3012  prop, NC_OBJECT | ND_DRAW, "rna_Object_duplicator_visibility_flag_update");
3013 
3014  prop = RNA_def_property(srna, "show_instancer_for_viewport", PROP_BOOLEAN, PROP_NONE);
3015  RNA_def_property_boolean_sdna(prop, NULL, "duplicator_visibility_flag", OB_DUPLI_FLAG_VIEWPORT);
3016  RNA_def_property_ui_text(prop, "Display Instancer", "Make instancer visible in the viewport");
3018  prop, NC_OBJECT | ND_DRAW, "rna_Object_duplicator_visibility_flag_update");
3019 
3020  /* Ray visibility. */
3021  prop = RNA_def_property(srna, "visible_camera", PROP_BOOLEAN, PROP_NONE);
3022  RNA_def_property_boolean_negative_sdna(prop, NULL, "visibility_flag", OB_HIDE_CAMERA);
3023  RNA_def_property_ui_text(prop, "Camera Visibility", "Object visibility to camera rays");
3024  RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_internal_update_draw");
3025 
3026  prop = RNA_def_property(srna, "visible_diffuse", PROP_BOOLEAN, PROP_NONE);
3027  RNA_def_property_boolean_negative_sdna(prop, NULL, "visibility_flag", OB_HIDE_DIFFUSE);
3028  RNA_def_property_ui_text(prop, "Diffuse Visibility", "Object visibility to diffuse rays");
3029  RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_internal_update_draw");
3030 
3031  prop = RNA_def_property(srna, "visible_glossy", PROP_BOOLEAN, PROP_NONE);
3032  RNA_def_property_boolean_negative_sdna(prop, NULL, "visibility_flag", OB_HIDE_GLOSSY);
3033  RNA_def_property_ui_text(prop, "Glossy Visibility", "Object visibility to glossy rays");
3034  RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_internal_update_draw");
3035 
3036  prop = RNA_def_property(srna, "visible_transmission", PROP_BOOLEAN, PROP_NONE);
3039  prop, "Transmission Visibility", "Object visibility to transmission rays");
3040  RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_internal_update_draw");
3041 
3042  prop = RNA_def_property(srna, "visible_volume_scatter", PROP_BOOLEAN, PROP_NONE);
3045  prop, "Volume Scatter Visibility", "Object visibility to volume scattering rays");
3046  RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_internal_update_draw");
3047 
3048  prop = RNA_def_property(srna, "visible_shadow", PROP_BOOLEAN, PROP_NONE);
3049  RNA_def_property_boolean_negative_sdna(prop, NULL, "visibility_flag", OB_HIDE_SHADOW);
3050  RNA_def_property_ui_text(prop, "Shadow Visibility", "Object visibility to shadow rays");
3051  RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_internal_update_draw");
3052 
3053  /* Holdout and shadow catcher. */
3054  prop = RNA_def_property(srna, "is_holdout", PROP_BOOLEAN, PROP_NONE);
3055  RNA_def_property_boolean_sdna(prop, NULL, "visibility_flag", OB_HOLDOUT);
3057  prop,
3058  "Holdout",
3059  "Render objects as a holdout or matte, creating a hole in the image with zero alpha, to "
3060  "fill out in compositing with real footage or another render");
3061  RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_hide_update");
3062 
3063  prop = RNA_def_property(srna, "is_shadow_catcher", PROP_BOOLEAN, PROP_NONE);
3064  RNA_def_property_boolean_sdna(prop, NULL, "visibility_flag", OB_SHADOW_CATCHER);
3066  prop,
3067  "Shadow Catcher",
3068  "Only render shadows and reflections on this object, for compositing renders into real "
3069  "footage. Objects with this setting are considered to already exist in the footage, "
3070  "objects without it are synthetic objects being composited into it");
3071  RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_internal_update_draw");
3072 }
3073 
3074 static void rna_def_object(BlenderRNA *brna)
3075 {
3076  StructRNA *srna;
3077  PropertyRNA *prop;
3078 
3079  static const EnumPropertyItem up_items[] = {
3080  {OB_POSX, "X", 0, "X", ""},
3081  {OB_POSY, "Y", 0, "Y", ""},
3082  {OB_POSZ, "Z", 0, "Z", ""},
3083  {0, NULL, 0, NULL, NULL},
3084  };
3085 
3086  static const EnumPropertyItem drawtype_items[] = {
3087  {OB_BOUNDBOX, "BOUNDS", 0, "Bounds", "Display the bounds of the object"},
3088  {OB_WIRE, "WIRE", 0, "Wire", "Display the object as a wireframe"},
3089  {OB_SOLID,
3090  "SOLID",
3091  0,
3092  "Solid",
3093  "Display the object as a solid (if solid drawing is enabled in the viewport)"},
3094  {OB_TEXTURE,
3095  "TEXTURED",
3096  0,
3097  "Textured",
3098  "Display the object with textures (if textures are enabled in the viewport)"},
3099  {0, NULL, 0, NULL, NULL},
3100  };
3101 
3102  static const EnumPropertyItem boundtype_items[] = {
3103  {OB_BOUND_BOX, "BOX", 0, "Box", "Display bounds as box"},
3104  {OB_BOUND_SPHERE, "SPHERE", 0, "Sphere", "Display bounds as sphere"},
3105  {OB_BOUND_CYLINDER, "CYLINDER", 0, "Cylinder", "Display bounds as cylinder"},
3106  {OB_BOUND_CONE, "CONE", 0, "Cone", "Display bounds as cone"},
3107  {OB_BOUND_CAPSULE, "CAPSULE", 0, "Capsule", "Display bounds as capsule"},
3108  {0, NULL, 0, NULL, NULL},
3109  };
3110 
3111  static int boundbox_dimsize[] = {8, 3};
3112 
3113  srna = RNA_def_struct(brna, "Object", "ID");
3114  RNA_def_struct_ui_text(srna, "Object", "Object data-block defining an object in a scene");
3116  RNA_def_struct_ui_icon(srna, ICON_OBJECT_DATA);
3117 
3119 
3120  prop = RNA_def_property(srna, "data", PROP_POINTER, PROP_NONE);
3121  RNA_def_property_struct_type(prop, "ID");
3123  "rna_Object_data_get",
3124  "rna_Object_data_set",
3125  "rna_Object_data_typef",
3126  "rna_Object_data_poll");
3128  RNA_def_property_ui_text(prop, "Data", "Object data");
3129  RNA_def_property_update(prop, 0, "rna_Object_data_update");
3130 
3131  prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
3132  RNA_def_property_enum_sdna(prop, NULL, "type");
3136  RNA_def_property_ui_text(prop, "Type", "Type of object");
3138 
3139  prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
3140  RNA_def_property_enum_sdna(prop, NULL, "mode");
3143  RNA_def_property_ui_text(prop, "Mode", "Object interaction mode");
3144 
3145  /* for data access */
3146  prop = RNA_def_property(srna, "bound_box", PROP_FLOAT, PROP_NONE);
3147  RNA_def_property_multi_array(prop, 2, boundbox_dimsize);
3151  RNA_def_property_float_funcs(prop, "rna_Object_boundbox_get", NULL, NULL);
3153  prop,
3154  "Bounding Box",
3155  "Object's bounding box in object-space coordinates, all values are -1.0 when "
3156  "not available");
3157 
3158  /* parent */
3159  prop = RNA_def_property(srna, "parent", PROP_POINTER, PROP_NONE);
3160  RNA_def_property_pointer_funcs(prop, NULL, "rna_Object_parent_set", NULL, NULL);
3162  RNA_def_property_override_funcs(prop, NULL, NULL, "rna_Object_parent_override_apply");
3163  RNA_def_property_ui_text(prop, "Parent", "Parent object");
3164  RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_dependency_update");
3165 
3166  prop = RNA_def_property(srna, "parent_type", PROP_ENUM, PROP_NONE);
3167  RNA_def_property_enum_bitflag_sdna(prop, NULL, "partype");
3170  prop, NULL, "rna_Object_parent_type_set", "rna_Object_parent_type_itemf");
3171  RNA_def_property_ui_text(prop, "Parent Type", "Type of parent relation");
3172  RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_dependency_update");
3173 
3174  prop = RNA_def_property(srna, "parent_vertices", PROP_INT, PROP_UNSIGNED);
3175  RNA_def_property_int_sdna(prop, NULL, "par1");
3176  RNA_def_property_array(prop, 3);
3178  prop, "Parent Vertices", "Indices of vertices in case of a vertex parenting relation");
3179  RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_internal_update");
3180 
3181  prop = RNA_def_property(srna, "parent_bone", PROP_STRING, PROP_NONE);
3182  RNA_def_property_string_sdna(prop, NULL, "parsubstr");
3183  RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Object_parent_bone_set");
3185  prop, "Parent Bone", "Name of parent bone in case of a bone parenting relation");
3186  RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_dependency_update");
3187 
3188  prop = RNA_def_property(srna, "use_camera_lock_parent", PROP_BOOLEAN, PROP_NONE);
3192  "Camera Parent Lock",
3193  "View Lock 3D viewport camera transformation affects the object's "
3194  "parent instead");
3195  RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_internal_update");
3196 
3197  /* Track and Up flags */
3198  /* XXX: these have been saved here for a bit longer (after old track was removed),
3199  * since some other tools still refer to this */
3200  prop = RNA_def_property(srna, "track_axis", PROP_ENUM, PROP_NONE);
3201  RNA_def_property_enum_sdna(prop, NULL, "trackflag");
3204  prop,
3205  "Track Axis",
3206  "Axis that points in the 'forward' direction (applies to Instance Vertices when "
3207  "Align to Vertex Normal is enabled)");
3208  RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_internal_update");
3209 
3210  prop = RNA_def_property(srna, "up_axis", PROP_ENUM, PROP_NONE);
3211  RNA_def_property_enum_sdna(prop, NULL, "upflag");
3212  RNA_def_property_enum_items(prop, up_items);
3214  prop,
3215  "Up Axis",
3216  "Axis that points in the upward direction (applies to Instance Vertices when "
3217  "Align to Vertex Normal is enabled)");
3218  RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_internal_update");
3219 
3220  /* materials */
3221  prop = RNA_def_property(srna, "material_slots", PROP_COLLECTION, PROP_NONE);
3222  RNA_def_property_struct_type(prop, "MaterialSlot");
3224  /* Don't dereference the material slot pointer, it is the slot index encoded in a pointer. */
3226  "rna_Object_material_slots_begin",
3227  "rna_Object_material_slots_next",
3228  "rna_Object_material_slots_end",
3229  "rna_Object_material_slots_get",
3230  "rna_Object_material_slots_length",
3231  NULL,
3232  NULL,
3233  NULL);
3234  RNA_def_property_ui_text(prop, "Material Slots", "Material slots in the object");
3235 
3236  prop = RNA_def_property(srna, "active_material", PROP_POINTER, PROP_NONE);
3237  RNA_def_property_struct_type(prop, "Material");
3239  "rna_Object_active_material_get",
3240  "rna_Object_active_material_set",
3241  NULL,
3242  "rna_MaterialSlot_material_poll");
3244  RNA_def_property_editable_func(prop, "rna_Object_active_material_editable");
3245  RNA_def_property_ui_text(prop, "Active Material", "Active material being displayed");
3246  RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_MaterialSlot_update");
3247 
3248  prop = RNA_def_property(srna, "active_material_index", PROP_INT, PROP_UNSIGNED);
3249  RNA_def_property_int_sdna(prop, NULL, "actcol");
3252  "rna_Object_active_material_index_get",
3253  "rna_Object_active_material_index_set",
3254  "rna_Object_active_material_index_range");
3255  RNA_def_property_ui_text(prop, "Active Material Index", "Index of active material slot");
3256  RNA_def_property_update(prop, NC_MATERIAL | ND_SHADING_LINKS, "rna_MaterialIndex_update");
3257 
3258  /* transform */
3259  prop = RNA_def_property(srna, "location", PROP_FLOAT, PROP_TRANSLATION);
3260  RNA_def_property_float_sdna(prop, NULL, "loc");
3261  RNA_def_property_editable_array_func(prop, "rna_Object_location_editable");
3262  RNA_def_property_ui_text(prop, "Location", "Location of the object");
3263  RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, RNA_TRANSLATION_PREC_DEFAULT);
3264  RNA_def_property_update(prop, NC_OBJECT | ND_TRANSFORM, "rna_Object_internal_update");
3265 
3266  prop = RNA_def_property(srna, "rotation_quaternion", PROP_FLOAT, PROP_QUATERNION);
3267  RNA_def_property_float_sdna(prop, NULL, "quat");
3268  RNA_def_property_editable_array_func(prop, "rna_Object_rotation_4d_editable");
3269  RNA_def_property_ui_text(prop, "Quaternion Rotation", "Rotation in Quaternions");
3270  RNA_def_property_update(prop, NC_OBJECT | ND_TRANSFORM, "rna_Object_internal_update");
3271 
3272  /* XXX: for axis-angle, it would have been nice to have 2 separate fields for UI purposes, but
3273  * having a single one is better for Keyframing and other property-management situations...
3274  */
3275  prop = RNA_def_property(srna, "rotation_axis_angle", PROP_FLOAT, PROP_AXISANGLE);
3276  RNA_def_property_array(prop, 4);
3278  prop, "rna_Object_rotation_axis_angle_get", "rna_Object_rotation_axis_angle_set", NULL);
3279  RNA_def_property_editable_array_func(prop, "rna_Object_rotation_4d_editable");
3282  prop, "Axis-Angle Rotation", "Angle of Rotation for Axis-Angle rotation representation");
3283  RNA_def_property_update(prop, NC_OBJECT | ND_TRANSFORM, "rna_Object_internal_update");
3284 
3285  prop = RNA_def_property(srna, "rotation_euler", PROP_FLOAT, PROP_EULER);
3286  RNA_def_property_float_sdna(prop, NULL, "rot");
3287  RNA_def_property_editable_array_func(prop, "rna_Object_rotation_euler_editable");
3288  RNA_def_property_ui_text(prop, "Euler Rotation", "Rotation in Eulers");
3289  RNA_def_property_update(prop, NC_OBJECT | ND_TRANSFORM, "rna_Object_internal_update");
3290 
3291  prop = RNA_def_property(srna, "rotation_mode", PROP_ENUM, PROP_NONE);
3292  RNA_def_property_enum_sdna(prop, NULL, "rotmode");
3294  RNA_def_property_enum_funcs(prop, NULL, "rna_Object_rotation_mode_set", NULL);
3295  RNA_def_property_ui_text(prop, "Rotation Mode", "");
3296  RNA_def_property_update(prop, NC_OBJECT | ND_TRANSFORM, "rna_Object_internal_update");
3297 
3298  prop = RNA_def_property(srna, "scale", PROP_FLOAT, PROP_XYZ);
3300  RNA_def_property_editable_array_func(prop, "rna_Object_scale_editable");
3301  RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, 3);
3302  RNA_def_property_ui_text(prop, "Scale", "Scaling of the object");
3303  RNA_def_property_update(prop, NC_OBJECT | ND_TRANSFORM, "rna_Object_internal_update");
3304 
3305  prop = RNA_def_property(srna, "dimensions", PROP_FLOAT, PROP_XYZ_LENGTH);
3306  RNA_def_property_array(prop, 3);
3307  /* Only as convenient helper for py API, and conflicts with animating scale. */
3312  prop, "rna_Object_dimensions_get", "rna_Object_dimensions_set", NULL);
3315  "Dimensions",
3316  "Absolute bounding box dimensions of the object.\n"
3317  "Warning: Assigning to it or its members multiple consecutive times "
3318  "will not work correctly, as this needs up-to-date evaluated data");
3319  RNA_def_property_update(prop, NC_OBJECT | ND_TRANSFORM, "rna_Object_internal_update");
3320 
3321  /* delta transforms */
3322  prop = RNA_def_property(srna, "delta_location", PROP_FLOAT, PROP_TRANSLATION);
3323  RNA_def_property_float_sdna(prop, NULL, "dloc");
3325  prop, "Delta Location", "Extra translation added to the location of the object");
3326  RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, RNA_TRANSLATION_PREC_DEFAULT);
3327  RNA_def_property_update(prop, NC_OBJECT | ND_TRANSFORM, "rna_Object_internal_update");
3328 
3329  prop = RNA_def_property(srna, "delta_rotation_euler", PROP_FLOAT, PROP_EULER);
3330  RNA_def_property_float_sdna(prop, NULL, "drot");
3332  prop,
3333  "Delta Rotation (Euler)",
3334  "Extra rotation added to the rotation of the object (when using Euler rotations)");
3335  RNA_def_property_update(prop, NC_OBJECT | ND_TRANSFORM, "rna_Object_internal_update");
3336 
3337  prop = RNA_def_property(srna, "delta_rotation_quaternion", PROP_FLOAT, PROP_QUATERNION);
3338  RNA_def_property_float_sdna(prop, NULL, "dquat");
3340  prop,
3341  "Delta Rotation (Quaternion)",
3342  "Extra rotation added to the rotation of the object (when using Quaternion rotations)");
3343  RNA_def_property_update(prop, NC_OBJECT | ND_TRANSFORM, "rna_Object_internal_update");
3344 
3345 # if 0 /* XXX not supported well yet... */
3346  prop = RNA_def_property(srna, "delta_rotation_axis_angle", PROP_FLOAT, PROP_AXISANGLE);
3347  /* FIXME: this is not a single field any more! (drotAxis and drotAngle) */
3348  RNA_def_property_float_sdna(prop, NULL, "dquat");
3351  prop,
3352  "Delta Rotation (Axis Angle)",
3353  "Extra rotation added to the rotation of the object (when using Axis-Angle rotations)");
3354  RNA_def_property_update(prop, NC_OBJECT | ND_TRANSFORM, "rna_Object_internal_update");
3355 # endif
3356 
3357  prop = RNA_def_property(srna, "delta_scale", PROP_FLOAT, PROP_XYZ);
3358  RNA_def_property_float_sdna(prop, NULL, "dscale");
3360  RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, 3);
3361  RNA_def_property_ui_text(prop, "Delta Scale", "Extra scaling added to the scale of the object");
3362  RNA_def_property_update(prop, NC_OBJECT | ND_TRANSFORM, "rna_Object_internal_update");
3363 
3364  /* transform locks */
3365  prop = RNA_def_property(srna, "lock_location", PROP_BOOLEAN, PROP_NONE);
3366  RNA_def_property_boolean_sdna(prop, NULL, "protectflag", OB_LOCK_LOCX);
3367  RNA_def_property_array(prop, 3);
3368  RNA_def_property_ui_text(prop, "Lock Location", "Lock editing of location when transforming");
3369  RNA_def_property_ui_icon(prop, ICON_UNLOCKED, 1);
3370  RNA_def_property_update(prop, NC_OBJECT | ND_TRANSFORM, "rna_Object_internal_update");
3371 
3372  prop = RNA_def_property(srna, "lock_rotation", PROP_BOOLEAN, PROP_NONE);
3373  RNA_def_property_boolean_sdna(prop, NULL, "protectflag", OB_LOCK_ROTX);
3374  RNA_def_property_array(prop, 3);
3375  RNA_def_property_ui_text(prop, "Lock Rotation", "Lock editing of rotation when transforming");
3376  RNA_def_property_ui_icon(prop, ICON_UNLOCKED, 1);
3377  RNA_def_property_update(prop, NC_OBJECT | ND_TRANSFORM, "rna_Object_internal_update");
3378 
3379  /* XXX this is sub-optimal - it really should be included above,
3380  * but due to technical reasons we can't do this! */
3381  prop = RNA_def_property(srna, "lock_rotation_w", PROP_BOOLEAN, PROP_NONE);
3382  RNA_def_property_boolean_sdna(prop, NULL, "protectflag", OB_LOCK_ROTW);
3383  RNA_def_property_ui_icon(prop, ICON_UNLOCKED, 1);
3385  prop,
3386  "Lock Rotation (4D Angle)",
3387  "Lock editing of 'angle' component of four-component rotations when transforming");
3388  /* XXX this needs a better name */
3389  prop = RNA_def_property(srna, "lock_rotations_4d", PROP_BOOLEAN, PROP_NONE);
3390  RNA_def_property_boolean_sdna(prop, NULL, "protectflag", OB_LOCK_ROT4D);
3392  prop,
3393  "Lock Rotations (4D)",
3394  "Lock editing of four component rotations by components (instead of as Eulers)");
3395 
3396  prop = RNA_def_property(srna, "lock_scale", PROP_BOOLEAN, PROP_NONE);
3397  RNA_def_property_boolean_sdna(prop, NULL, "protectflag", OB_LOCK_SCALEX);
3398  RNA_def_property_array(prop, 3);
3399  RNA_def_property_ui_text(prop, "Lock Scale", "Lock editing of scale when transforming");
3400  RNA_def_property_ui_icon(prop, ICON_UNLOCKED, 1);
3401  RNA_def_property_update(prop, NC_OBJECT | ND_TRANSFORM, "rna_Object_internal_update");
3402 
3403  /* matrix */
3404  prop = RNA_def_property(srna, "matrix_world", PROP_FLOAT, PROP_MATRIX);
3405  RNA_def_property_float_sdna(prop, NULL, "obmat");
3410  RNA_def_property_ui_text(prop, "Matrix World", "Worldspace transformation matrix");
3411  RNA_def_property_update(prop, NC_OBJECT | ND_TRANSFORM, "rna_Object_matrix_world_update");
3412 
3413  prop = RNA_def_property(srna, "matrix_local", PROP_FLOAT, PROP_MATRIX);
3419  prop,
3420  "Local Matrix",
3421  "Parent relative transformation matrix.\n"
3422  "Warning: Only takes into account object parenting, so e.g. in case of bone parenting "
3423  "you get a matrix relative to the Armature object, not to the actual parent bone");
3425  prop, "rna_Object_matrix_local_get", "rna_Object_matrix_local_set", NULL);
3426  RNA_def_property_update(prop, NC_OBJECT | ND_TRANSFORM, "rna_Object_internal_update");
3427 
3428  prop = RNA_def_property(srna, "matrix_basis", PROP_FLOAT, PROP_MATRIX);
3434  "Input Matrix",
3435  "Matrix access to location, rotation and scale (including deltas), "
3436  "before constraints and parenting are applied");
3438  prop, "rna_Object_matrix_basis_get", "rna_Object_matrix_basis_set", NULL);
3439  RNA_def_property_update(prop, NC_OBJECT | ND_TRANSFORM, "rna_Object_internal_update");
3440 
3441  /* Parent_inverse. */
3442  prop = RNA_def_property(srna, "matrix_parent_inverse", PROP_FLOAT, PROP_MATRIX);
3443  RNA_def_property_float_sdna(prop, NULL, "parentinv");
3446  prop, "Parent Inverse Matrix", "Inverse of object's parent matrix at time of parenting");
3447  RNA_def_property_update(prop, NC_OBJECT | ND_TRANSFORM, "rna_Object_internal_update");
3448 
3449  /* modifiers */
3450  prop = RNA_def_property(srna, "modifiers", PROP_COLLECTION, PROP_NONE);
3451  RNA_def_property_struct_type(prop, "Modifier");
3453  prop, "Modifiers", "Modifiers affecting the geometric data of the object");
3454  RNA_def_property_override_funcs(prop, NULL, NULL, "rna_Object_modifiers_override_apply");
3456  rna_def_object_modifiers(brna, prop);
3457 
3458  /* Grease Pencil modifiers. */
3459  prop = RNA_def_property(srna, "grease_pencil_modifiers", PROP_COLLECTION, PROP_NONE);
3460  RNA_def_property_collection_sdna(prop, NULL, "greasepencil_modifiers", NULL);
3461  RNA_def_property_struct_type(prop, "GpencilModifier");
3463  prop, "Grease Pencil Modifiers", "Modifiers affecting the data of the grease pencil object");
3465  prop, NULL, NULL, "rna_Object_greasepencil_modifiers_override_apply");
3468 
3469  /* Shader FX. */
3470  prop = RNA_def_property(srna, "shader_effects", PROP_COLLECTION, PROP_NONE);
3471  RNA_def_property_collection_sdna(prop, NULL, "shader_fx", NULL);
3472  RNA_def_property_struct_type(prop, "ShaderFx");
3473  RNA_def_property_ui_text(prop, "Shader Effects", "Effects affecting display of object");
3475  rna_def_object_shaderfxs(brna, prop);
3477 
3478  /* constraints */
3479  prop = RNA_def_property(srna, "constraints", PROP_COLLECTION, PROP_NONE);
3480  RNA_def_property_struct_type(prop, "Constraint");
3483  prop, "Constraints", "Constraints affecting the transformation of the object");
3484  RNA_def_property_override_funcs(prop, NULL, NULL, "rna_Object_constraints_override_apply");
3485 # if 0
3487  prop, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "constraints__add", "constraints__remove");
3488 # endif
3489  rna_def_object_constraints(brna, prop);
3490 
3491  /* vertex groups */
3492  prop = RNA_def_property(srna, "vertex_groups", PROP_COLLECTION, PROP_NONE);
3494  "rna_Object_vertex_groups_begin",
3495  "rna_iterator_listbase_next",
3496  "rna_iterator_listbase_end",
3497  "rna_iterator_listbase_get",
3498  NULL,
3499  NULL,
3500  NULL,
3501  NULL);
3502  RNA_def_property_struct_type(prop, "VertexGroup");
3504  RNA_def_property_ui_text(prop, "Vertex Groups", "Vertex groups of the object");
3505  rna_def_object_vertex_groups(brna, prop);
3506 
3507  /* face maps */
3508  prop = RNA_def_property(srna, "face_maps", PROP_COLLECTION, PROP_NONE);
3509  RNA_def_property_collection_sdna(prop, NULL, "fmaps", NULL);
3510  RNA_def_property_struct_type(prop, "FaceMap");
3512  RNA_def_property_ui_text(prop, "Face Maps", "Maps of faces of the object");
3513  rna_def_object_face_maps(brna, prop);
3514 
3515  /* empty */
3516  prop = RNA_def_property(srna, "empty_display_type", PROP_ENUM, PROP_NONE);
3517  RNA_def_property_enum_sdna(prop, NULL, "empty_drawtype");
3519  RNA_def_property_enum_funcs(prop, NULL, "rna_Object_empty_display_type_set", NULL);
3520  RNA_def_property_ui_text(prop, "Empty Display Type", "Viewport display style for empties");
3522 
3523  prop = RNA_def_property(srna, "empty_display_size", PROP_FLOAT, PROP_DISTANCE);
3524  RNA_def_property_float_sdna(prop, NULL, "empty_drawsize");
3525  RNA_def_property_range(prop, 0.0001f, 1000.0f);
3526  RNA_def_property_ui_range(prop, 0.01, 100, 1, 2);
3528  prop, "Empty Display Size", "Size of display for empties in the viewport");
3530 
3531  prop = RNA_def_property(srna, "empty_image_offset", PROP_FLOAT, PROP_NONE);
3532  RNA_def_property_float_sdna(prop, NULL, "ima_ofs");
3533  RNA_def_property_ui_text(prop, "Origin Offset", "Origin offset distance");
3534  RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 0.1f, 2);
3536 
3537  prop = RNA_def_property(srna, "image_user", PROP_POINTER, PROP_NONE);
3539  RNA_def_property_pointer_sdna(prop, NULL, "iuser");
3541  prop,
3542  "Image User",
3543  "Parameters defining which layer, pass and frame of the image is displayed");
3545 
3546  prop = RNA_def_property(srna, "empty_image_depth", PROP_ENUM, PROP_NONE);
3549  prop, "Empty Image Depth", "Determine which other objects will occlude the image");
3551 
3552  prop = RNA_def_property(srna, "show_empty_image_perspective", PROP_BOOLEAN, PROP_NONE);
3554  prop, NULL, "empty_image_visibility_flag", OB_EMPTY_IMAGE_HIDE_PERSPECTIVE);
3556  prop, "Display in Perspective Mode", "Display image in perspective mode");
3558 
3559  prop = RNA_def_property(srna, "show_empty_image_orthographic", PROP_BOOLEAN, PROP_NONE);
3561  prop, NULL, "empty_image_visibility_flag", OB_EMPTY_IMAGE_HIDE_ORTHOGRAPHIC);
3563  prop, "Display in Orthographic Mode", "Display image in orthographic mode");
3565 
3566  prop = RNA_def_property(srna, "show_empty_image_only_axis_aligned", PROP_BOOLEAN, PROP_NONE);
3568  prop, NULL, "empty_image_visibility_flag", OB_EMPTY_IMAGE_HIDE_NON_AXIS_ALIGNED);
3570  "Display Only Axis Aligned",
3571  "Only display the image when it is aligned with the view axis");
3573 
3574  prop = RNA_def_property(srna, "use_empty_image_alpha", PROP_BOOLEAN, PROP_NONE);
3577  prop,
3578  "Use Alpha",
3579  "Use alpha blending instead of alpha test (can produce sorting artifacts)");
3581 
3582  static EnumPropertyItem prop_empty_image_side_items[] = {
3583  {0, "DOUBLE_SIDED", 0, "Both", ""},
3584  {OB_EMPTY_IMAGE_HIDE_BACK, "FRONT", 0, "Front", ""},
3585  {OB_EMPTY_IMAGE_HIDE_FRONT, "BACK", 0, "Back", ""},
3586  {0, NULL, 0, NULL, NULL},
3587  };
3588  prop = RNA_def_property(srna, "empty_image_side", PROP_ENUM, PROP_NONE);
3589  RNA_def_property_enum_bitflag_sdna(prop, NULL, "empty_image_visibility_flag");
3590  RNA_def_property_enum_items(prop, prop_empty_image_side_items);
3591  RNA_def_property_ui_text(prop, "Empty Image Side", "Show front/back side");
3593 
3594  prop = RNA_def_property(srna, "add_rest_position_attribute", PROP_BOOLEAN, PROP_NONE);
3597  "Add Rest Position",
3598  "Add a \"rest_position\" attribute that is a copy of the position "
3599  "attribute before shape keys and modifiers are evaluated");
3600  RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_internal_update_data");
3601 
3602  /* render */
3603  prop = RNA_def_property(srna, "pass_index", PROP_INT, PROP_UNSIGNED);
3604  RNA_def_property_int_sdna(prop, NULL, "index");
3606  prop, "Pass Index", "Index number for the \"Object Index\" render pass");
3607  RNA_def_property_update(prop, NC_OBJECT, "rna_Object_internal_update_draw");
3608 
3609  prop = RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR);
3611  prop, "Color", "Object color and alpha, used when faces have the ObColor mode enabled");
3612  RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_internal_update_draw");
3613 
3614  /* physics */
3615  prop = RNA_def_property(srna, "field", PROP_POINTER, PROP_NONE);
3616  RNA_def_property_pointer_sdna(prop, NULL, "pd");
3617  RNA_def_property_struct_type(prop, "FieldSettings");
3618  RNA_def_property_pointer_funcs(prop, "rna_Object_field_get", NULL, NULL, NULL);
3620  prop, "Field Settings", "Settings for using the object as a field in physics simulation");
3621 
3622  prop = RNA_def_property(srna, "collision", PROP_POINTER, PROP_NONE);
3623  RNA_def_property_pointer_sdna(prop, NULL, "pd");
3624  RNA_def_property_struct_type(prop, "CollisionSettings");
3625  RNA_def_property_pointer_funcs(prop, "rna_Object_collision_get", NULL, NULL, NULL);
3627  "Collision Settings",
3628  "Settings for using the object as a collider in physics simulation");
3629 
3630  prop = RNA_def_property(srna, "soft_body", PROP_POINTER, PROP_NONE);
3631  RNA_def_property_pointer_sdna(prop, NULL, "soft");
3632  RNA_def_property_struct_type(prop, "SoftBodySettings");
3633  RNA_def_property_ui_text(prop, "Soft Body Settings", "Settings for soft body simulation");
3634 
3635  prop = RNA_def_property(srna, "particle_systems", PROP_COLLECTION, PROP_NONE);
3636  RNA_def_property_collection_sdna(prop, NULL, "particlesystem", NULL);
3637  RNA_def_property_struct_type(prop, "ParticleSystem");
3638  RNA_def_property_ui_text(prop, "Particle Systems", "Particle systems emitted from the object");
3639  rna_def_object_particle_systems(brna, prop);
3640 
3641  prop = RNA_def_property(srna, "rigid_body", PROP_POINTER, PROP_NONE);
3642  RNA_def_property_pointer_sdna(prop, NULL, "rigidbody_object");
3643  RNA_def_property_struct_type(prop, "RigidBodyObject");
3644  RNA_def_property_ui_text(prop, "Rigid Body Settings", "Settings for rigid body simulation");
3645 
3646  prop = RNA_def_property(srna, "rigid_body_constraint", PROP_POINTER, PROP_NONE);
3647  RNA_def_property_pointer_sdna(prop, NULL, "rigidbody_constraint");
3648  RNA_def_property_struct_type(prop, "RigidBodyConstraint");
3649  RNA_def_property_ui_text(prop, "Rigid Body Constraint", "Constraint constraining rigid bodies");
3650 
3652 
3653  /* instancing */
3654  prop = RNA_def_property(srna, "instance_type", PROP_ENUM, PROP_NONE);
3655  RNA_def_property_enum_bitflag_sdna(prop, NULL, "transflag");
3657  RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Object_instance_type_itemf");
3658  RNA_def_property_ui_text(prop, "Instance Type", "If not None, object instancing method to use");
3659  RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_dependency_update");
3660 
3661  prop = RNA_def_property(srna, "use_instance_vertices_rotation", PROP_BOOLEAN, PROP_NONE);
3662  RNA_def_property_boolean_sdna(prop, NULL, "transflag", OB_DUPLIROT);
3664  prop, "Orient with Normals", "Rotate instance according to vertex normal");
3666 
3667  prop = RNA_def_property(srna, "use_instance_faces_scale", PROP_BOOLEAN, PROP_NONE);
3669  RNA_def_property_ui_text(prop, "Scale to Face Sizes", "Scale instance based on face size");
3670  RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_internal_update");
3671 
3672  prop = RNA_def_property(srna, "instance_faces_scale", PROP_FLOAT, PROP_NONE);
3673  RNA_def_property_float_sdna(prop, NULL, "instance_faces_scale");
3674  RNA_def_property_range(prop, 0.001f, 10000.0f);
3675  RNA_def_property_ui_text(prop, "Instance Faces Scale", "Scale the face instance objects");
3676  RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_internal_update");
3677 
3678  prop = RNA_def_property(srna, "instance_collection", PROP_POINTER, PROP_NONE);
3679  RNA_def_property_struct_type(prop, "Collection");
3680  RNA_def_property_pointer_sdna(prop, NULL, "instance_collection");
3682  RNA_def_property_pointer_funcs(prop, NULL, "rna_Object_dup_collection_set", NULL, NULL);
3683  RNA_def_property_ui_text(prop, "Instance Collection", "Instance an existing collection");
3684  RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_dependency_update");
3685 
3686  prop = RNA_def_property(srna, "is_instancer", PROP_BOOLEAN, PROP_NONE);
3687  RNA_def_property_boolean_sdna(prop, NULL, "transflag", OB_DUPLI);
3691 
3692  /* drawing */
3693  prop = RNA_def_property(srna, "display_type", PROP_ENUM, PROP_NONE);
3694  RNA_def_property_enum_sdna(prop, NULL, "dt");
3695  RNA_def_property_enum_items(prop, drawtype_items);
3696  RNA_def_property_ui_text(prop, "Display As", "How to display object in viewport");
3697  RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_internal_update");
3698 
3699  prop = RNA_def_property(srna, "show_bounds", PROP_BOOLEAN, PROP_NONE);
3701  RNA_def_property_ui_text(prop, "Display Bounds", "Display the object's bounds");
3703 
3704  prop = RNA_def_property(srna, "display_bounds_type", PROP_ENUM, PROP_NONE);
3705  RNA_def_property_enum_sdna(prop, NULL, "boundtype");
3706  RNA_def_property_enum_items(prop, boundtype_items);
3707  RNA_def_property_ui_text(prop, "Display Bounds Type", "Object boundary display type");
3709 
3710  prop = RNA_def_property(srna, "show_name", PROP_BOOLEAN, PROP_NONE);
3712  RNA_def_property_ui_text(prop, "Display Name", "Display the object's name");
3714 
3715  prop = RNA_def_property(srna, "show_axis", PROP_BOOLEAN, PROP_NONE);
3717  RNA_def_property_ui_text(prop, "Display Axes", "Display the object's origin and axes");
3719 
3720  prop = RNA_def_property(srna, "show_texture_space", PROP_BOOLEAN, PROP_NONE);
3722  RNA_def_property_ui_text(prop, "Display Texture Space", "Display the object's texture space");
3724 
3725  prop = RNA_def_property(srna, "show_wire", PROP_BOOLEAN, PROP_NONE);
3728  prop, "Display Wire", "Display the object's wireframe over solid shading");
3730 
3731  prop = RNA_def_property(srna, "show_all_edges", PROP_BOOLEAN, PROP_NONE);
3733  RNA_def_property_ui_text(prop, "Display All Edges", "Display all edges for mesh objects");
3735 
3736  prop = RNA_def_property(srna, "use_grease_pencil_lights", PROP_BOOLEAN, PROP_NONE);
3739  RNA_def_property_ui_text(prop, "Use Lights", "Lights affect grease pencil object");
3740  RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_GPencil_update");
3741 
3742  prop = RNA_def_property(srna, "show_transparent", PROP_BOOLEAN, PROP_NONE);
3745  prop, "Display Transparent", "Display material transparency in the object");
3747 
3748  prop = RNA_def_property(srna, "show_in_front", PROP_BOOLEAN, PROP_NONE);
3750  RNA_def_property_ui_text(prop, "In Front", "Make the object display in front of others");
3751  RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_GPencil_update");
3752 
3753  /* pose */
3754  prop = RNA_def_property(srna, "pose_library", PROP_POINTER, PROP_NONE);
3755  RNA_def_property_pointer_sdna(prop, NULL, "poselib");
3756  RNA_def_property_struct_type(prop, "Action");
3759  "Pose Library",
3760  "Deprecated, will be removed in Blender 3.3. "
3761  "Action used as a pose library for armatures");
3762 
3763  prop = RNA_def_property(srna, "pose", PROP_POINTER, PROP_NONE);
3764  RNA_def_property_pointer_sdna(prop, NULL, "pose");
3765  RNA_def_property_struct_type(prop, "Pose");
3766  RNA_def_property_ui_text(prop, "Pose", "Current pose for armatures");
3767 
3768  /* shape keys */
3769  prop = RNA_def_property(srna, "show_only_shape_key", PROP_BOOLEAN, PROP_NONE);
3770  RNA_def_property_boolean_sdna(prop, NULL, "shapeflag", OB_SHAPE_LOCK);
3772  prop, "Shape Key Lock", "Always show the current shape for this object");
3773  RNA_def_property_ui_icon(prop, ICON_UNPINNED, 1);
3774  RNA_def_property_update(prop, 0, "rna_Object_internal_update_data");
3775 
3776  prop = RNA_def_property(srna, "use_shape_key_edit_mode", PROP_BOOLEAN, PROP_NONE);
3779  prop, "Shape Key Edit Mode", "Apply shape keys in edit mode (for meshes only)");
3780  RNA_def_property_ui_icon(prop, ICON_EDITMODE_HLT, 0);
3781  RNA_def_property_update(prop, 0, "rna_Object_internal_update_data");
3782 
3783  prop = RNA_def_property(srna, "active_shape_key", PROP_POINTER, PROP_NONE);
3784  RNA_def_property_struct_type(prop, "ShapeKey");
3787  RNA_def_property_pointer_funcs(prop, "rna_Object_active_shape_key_get", NULL, NULL, NULL);
3788  RNA_def_property_ui_text(prop, "Active Shape Key", "Current shape key");
3789 
3790  prop = RNA_def_property(srna, "active_shape_key_index", PROP_INT, PROP_NONE);
3791  RNA_def_property_int_sdna(prop, NULL, "shapenr");
3792  RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); /* XXX this is really unpredictable... */
3794  "rna_Object_active_shape_key_index_get",
3795  "rna_Object_active_shape_key_index_set",
3796  "rna_Object_active_shape_key_index_range");
3797  RNA_def_property_ui_text(prop, "Active Shape Key Index", "Current shape key index");
3798  RNA_def_property_update(prop, 0, "rna_Object_active_shape_update");
3799 
3800  /* sculpt */
3801  prop = RNA_def_property(srna, "use_dynamic_topology_sculpting", PROP_BOOLEAN, PROP_NONE);
3802  RNA_def_property_boolean_funcs(prop, "rna_Object_use_dynamic_topology_sculpting_get", NULL);
3804  RNA_def_property_ui_text(prop, "Dynamic Topology Sculpting", NULL);
3805 
3806  /* Base Settings */
3807  prop = RNA_def_property(srna, "is_from_instancer", PROP_BOOLEAN, PROP_NONE);
3808  RNA_def_property_boolean_sdna(prop, NULL, "base_flag", BASE_FROM_DUPLI);
3809  RNA_def_property_ui_text(prop, "Base from Instancer", "Object comes from a instancer");
3813 
3814  prop = RNA_def_property(srna, "is_from_set", PROP_BOOLEAN, PROP_NONE);
3815  RNA_def_property_boolean_sdna(prop, NULL, "base_flag", BASE_FROM_SET);
3816  RNA_def_property_ui_text(prop, "Base from Set", "Object comes from a background set");
3820 
3821  /* Object Display */
3822  prop = RNA_def_property(srna, "display", PROP_POINTER, PROP_NONE);
3824  RNA_def_property_struct_type(prop, "ObjectDisplay");
3825  RNA_def_property_pointer_funcs(prop, "rna_Object_display_get", NULL, NULL, NULL);
3826  RNA_def_property_ui_text(prop, "Object Display", "Object display settings for 3D viewport");
3827 
3828  /* Line Art */
3829  prop = RNA_def_property(srna, "lineart", PROP_POINTER, PROP_NONE);
3830  RNA_def_property_struct_type(prop, "ObjectLineArt");
3831  RNA_def_property_ui_text(prop, "Line Art", "Line art settings for the object");
3832 
3833  /* Mesh Symmetry Settings */
3834 
3835  prop = RNA_def_property(srna, "use_mesh_mirror_x", PROP_BOOLEAN, PROP_NONE);
3837  prop, "rna_Object_mesh_symmetry_x_get", "rna_Object_mesh_symmetry_x_set");
3839  RNA_def_property_ui_text(prop, "X", "Enable mesh symmetry in the X axis");
3840 
3841  prop = RNA_def_property(srna, "use_mesh_mirror_y", PROP_BOOLEAN, PROP_NONE);
3843  prop, "rna_Object_mesh_symmetry_y_get", "rna_Object_mesh_symmetry_y_set");
3845  RNA_def_property_editable_func(prop, "rna_Object_mesh_symmetry_yz_editable");
3846  RNA_def_property_ui_text(prop, "Y", "Enable mesh symmetry in the Y axis");
3847 
3848  prop = RNA_def_property(srna, "use_mesh_mirror_z", PROP_BOOLEAN, PROP_NONE);
3850  prop, "rna_Object_mesh_symmetry_z_get", "rna_Object_mesh_symmetry_z_set");
3852  RNA_def_property_editable_func(prop, "rna_Object_mesh_symmetry_yz_editable");
3853  RNA_def_property_ui_text(prop, "Z", "Enable mesh symmetry in the Z axis");
3854 
3855  /* Lightgroup Membership */
3856  prop = RNA_def_property(srna, "lightgroup", PROP_STRING, PROP_NONE);
3858  "rna_Object_lightgroup_get",
3859  "rna_Object_lightgroup_length",
3860  "rna_Object_lightgroup_set");
3862  RNA_def_property_ui_text(prop, "Lightgroup", "Lightgroup that the object belongs to");
3863 
3865 
3866  /* anim */
3868 
3869  rna_def_animviz_common(srna);
3871 
3872  RNA_api_object(srna);
3873 }
3874 
3876 {
3877  rna_def_object(brna);
3878 
3879  RNA_define_animate_sdna(false);
3880  rna_def_vertex_group(brna);
3881  rna_def_face_map(brna);
3882  rna_def_material_slot(brna);
3883  rna_def_object_display(brna);
3884  rna_def_object_lineart(brna);
3886 }
3887 
3888 #endif
void BKE_rotMode_change_values(float quat[4], float eul[3], float axis[3], float *angle, short oldMode, short newMode)
Definition: armature.c:1983
void BKE_pose_rebuild(struct Main *bmain, struct Object *ob, struct bArmature *arm, bool do_id_user)
Definition: armature.c:2362
Camera data-block and utility functions.
bool BKE_collection_has_object_recursive(struct Collection *collection, struct Object *ob)
Definition: collection.c:921
bool BKE_constraint_remove(ListBase *list, struct bConstraint *con)
Definition: constraint.c:5592
struct bConstraint * BKE_constraint_copy_for_object(struct Object *ob, struct bConstraint *src)
Definition: constraint.c:5966
void BKE_constraints_free(struct ListBase *list)
Definition: constraint.c:5587
struct bConstraint * BKE_constraint_add_for_object(struct Object *ob, const char *name, short type)
Definition: constraint.c:5870
struct bConstraint * BKE_constraints_active_get(struct ListBase *list)
Definition: constraint.c:6001
void BKE_constraints_active_set(ListBase *list, struct bConstraint *con)
Definition: constraint.c:6017
void BKE_constraint_unique_name(struct bConstraint *con, struct ListBase *list)
Definition: constraint.c:112
struct bConstraint * BKE_constraint_duplicate_ex(struct bConstraint *src, int flag, bool do_extern)
Definition: constraint.c:5947
struct Scene * CTX_data_scene(const bContext *C)
Definition: context.c:1090
struct Main * CTX_data_main(const bContext *C)
Definition: context.c:1074
void BKE_curve_type_test(struct Object *ob)
Definition: curve.cc:482
support for deformation groups and hooks.
bool BKE_object_supports_vertex_groups(const struct Object *ob)
int BKE_object_defgroup_active_index_get(const struct Object *ob)
struct ListBase * BKE_object_defgroup_list_mutable(struct Object *ob)
Definition: deform.c:552
void BKE_object_defgroup_active_index_set(struct Object *ob, int new_index)
Definition: deform.c:568
int BKE_object_defgroup_name_index(const struct Object *ob, const char *name)
const struct ListBase * BKE_object_defgroup_list(const struct Object *ob)
void BKE_object_defgroup_unique_name(struct bDeformGroup *dg, struct Object *ob)
Definition: deform.c:692
struct bDeformGroup * BKE_object_defgroup_find_name(const struct Object *ob, const char *name)
void BKE_editlattice_load(struct Object *obedit)
Definition: editlattice.c:70
void BKE_editlattice_make(struct Object *obedit)
Definition: editlattice.c:44
void BKE_editmesh_looptri_and_normals_calc(BMEditMesh *em)
Definition: editmesh.c:135
#define G_MAIN
Definition: BKE_global.h:267
struct Key * BKE_key_from_object(struct Object *ob)
Definition: key.c:1803
void BKE_lightgroup_membership_set(struct LightgroupMembership **lgm, const char *name)
Definition: layer.c:2642
void BKE_lightgroup_membership_get(struct LightgroupMembership *lgm, char *name)
Definition: layer.c:2624
void BKE_main_collection_sync_remap(const struct Main *bmain)
int BKE_lightgroup_membership_length(struct LightgroupMembership *lgm)
Definition: layer.c:2634
void id_us_min(struct ID *id)
Definition: lib_id.c:313
void id_us_plus(struct ID *id)
Definition: lib_id.c:305
bool BKE_id_is_in_global_main(struct ID *id)
Definition: lib_id.c:1902
General operations, lookup, etc. for materials.
struct Material * BKE_object_material_get(struct Object *ob, short act)
Definition: material.c:687
int BKE_object_material_count_eval(struct Object *ob)
Definition: material.c:746
void BKE_object_materials_test(struct Main *bmain, struct Object *ob, struct ID *id)
Definition: material.c:864
void BKE_object_material_assign(struct Main *bmain, struct Object *ob, struct Material *ma, short act, int assign_type)
Definition: material.c:1047
struct Material * BKE_object_material_get_eval(struct Object *ob, short act)
Definition: material.c:707
@ BKE_MAT_ASSIGN_EXISTING
Definition: BKE_material.h:79
void BKE_mesh_assign_object(struct Main *bmain, struct Object *ob, struct Mesh *me)
Definition: mesh.cc:1377
struct Mesh * BKE_mesh_wrapper_ensure_subdivision(struct Mesh *me)
const ModifierTypeInfo * BKE_modifier_get_info(ModifierType type)
@ eModifierTypeFlag_Single
Definition: BKE_modifier.h:93
void BKE_modifier_copydata(const struct ModifierData *md, struct ModifierData *target)
struct ModifierData * BKE_modifiers_findby_type(const struct Object *ob, ModifierType type)
General operations, lookup, etc. for blender objects.
void BKE_object_empty_draw_type_set(struct Object *ob, int value)
Definition: object.cc:3937
void BKE_object_dimensions_set(struct Object *ob, const float value[3], int axis_mask)
Definition: object.cc:3834
void BKE_object_dimensions_get(struct Object *ob, float r_vec[3])
Definition: object.cc:3786
bool BKE_object_is_in_editmode_vgroup(const struct Object *ob)
void BKE_object_modifier_set_active(struct Object *ob, struct ModifierData *md)
Definition: object.cc:1367
void BKE_object_to_mat4(struct Object *ob, float r_mat[4][4])
Definition: object.cc:3082
void BKE_object_apply_mat4(struct Object *ob, const float mat[4][4], bool use_compat, bool use_parent)
Definition: object.cc:3575
const struct BoundBox * BKE_object_boundbox_get(struct Object *ob)
Definition: object.cc:3684
struct ModifierData * BKE_object_active_modifier(const struct Object *ob)
void BKE_object_matrix_local_get(struct Object *ob, float r_mat[4][4])
Definition: object.cc:3093
bool BKE_object_is_in_editmode(const struct Object *ob)
Functions for dealing with objects and deform verts, used by painting and tools.
void BKE_object_defgroup_remove(struct Object *ob, struct bDeformGroup *defgroup)
struct bDeformGroup * BKE_object_defgroup_add_name(struct Object *ob, const char *name)
Definition: object_deform.c:95
void BKE_object_defgroup_remove_all(struct Object *ob)
Functions for dealing with object face-maps.
int BKE_object_facemap_name_index(struct Object *ob, const char *name)
void BKE_object_facemap_remove(struct Object *ob, struct bFaceMap *fmap)
void BKE_object_facemap_clear(struct Object *ob)
void BKE_object_facemap_unique_name(struct Object *ob, struct bFaceMap *fmap)
struct bFaceMap * BKE_object_facemap_find_name(struct Object *ob, const char *name)
struct bFaceMap * BKE_object_facemap_add_name(struct Object *ob, const char *name)
void BKE_sculpt_ensure_orig_mesh_data(struct Scene *scene, struct Object *object)
Definition: paint.c:2144
void psys_set_current_num(struct Object *ob, int index)
Definition: particle.c:666
short psys_get_current_num(struct Object *ob)
Definition: particle.c:649
struct ParticleSystem * psys_get_current(struct Object *ob)
Definition: particle.c:634
void BKE_reportf(ReportList *reports, eReportType type, const char *format,...) ATTR_PRINTF_FORMAT(3
void BKE_report(ReportList *reports, eReportType type, const char *message)
Definition: report.c:83
#define BLI_assert(a)
Definition: BLI_assert.h:46
bool BLI_listbase_move_index(ListBase *listbase, int from, int to) ATTR_NONNULL()
Definition: listbase.c:436
void void * BLI_listbase_string_or_index_find(const struct ListBase *listbase, const char *string, size_t string_offset, int index) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
void BLI_insertlinkafter(struct ListBase *listbase, void *vprevlink, void *vnewlink) ATTR_NONNULL(1)
Definition: listbase.c:301
void BLI_remlink(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
Definition: listbase.c:100
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)
int BLI_listbase_count(const struct ListBase *listbase) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
MINLINE int max_ii(int a, int b)
void mul_m4_m4m4(float R[4][4], const float A[4][4], const float B[4][4])
Definition: math_matrix.c:259
bool invert_m4_m4(float R[4][4], const float A[4][4])
Definition: math_matrix.c:1287
void copy_m4_m4(float m1[4][4], const float m2[4][4])
Definition: math_matrix.c:77
#define DEG2RAD(_deg)
MINLINE void copy_v3_v3(float r[3], const float a[3])
void copy_vn_fl(float *array_tar, int size, float val)
Definition: math_vector.c:1259
size_t size_t char * BLI_sprintfN(const char *__restrict format,...) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1) ATTR_MALLOC ATTR_PRINTF_FORMAT(1
char * BLI_strdup(const char *str) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL() ATTR_MALLOC
Definition: string.c:42
char * BLI_strncpy(char *__restrict dst, const char *__restrict src, size_t maxncpy) ATTR_NONNULL()
Definition: string.c:64
char * BLI_strncpy_utf8(char *__restrict dst, const char *__restrict src, size_t maxncpy) ATTR_NONNULL(1
#define UNUSED_VARS_NDEBUG(...)
#define UNUSED(x)
#define MAX2(a, b)
#define STREQ(a, b)
#define BLT_I18NCONTEXT_ID_ID
void DEG_id_tag_update(struct ID *id, int flag)
void DEG_relations_tag_update(struct Main *bmain)
bool DEG_is_evaluated_object(const struct Object *object)
ID and Library types, which are fundamental for sdna.
@ ID_RECALC_TRANSFORM
Definition: DNA_ID.h:771
@ ID_RECALC_COPY_ON_WRITE
Definition: DNA_ID.h:834
@ ID_RECALC_SHADING
Definition: DNA_ID.h:811
@ ID_RECALC_GEOMETRY
Definition: DNA_ID.h:791
#define ID_IS_LINKED(_id)
Definition: DNA_ID.h:566
@ IDOVERRIDE_LIBRARY_OP_INSERT_AFTER
Definition: DNA_ID.h:230
@ IDOVERRIDE_LIBRARY_OP_REPLACE
Definition: DNA_ID.h:220
@ LIB_TAG_NO_MAIN
Definition: DNA_ID.h:744
@ ID_IM
Definition: DNA_ID_enums.h:53
@ ID_CU_LEGACY
Definition: DNA_ID_enums.h:49
@ ROT_MODE_XZY
@ ROT_MODE_QUAT
@ ROT_MODE_ZXY
@ ROT_MODE_AXISANGLE
@ ROT_MODE_ZYX
@ ROT_MODE_XYZ
@ ROT_MODE_YXZ
@ ROT_MODE_YZX
Object groups, one object can be in many groups at once.
@ CONSTRAINT_OVERRIDE_LIBRARY_LOCAL
@ CD_MLOOPUV
@ GP_DATA_ANNOTATIONS
@ BASE_FROM_DUPLI
@ BASE_FROM_SET
@ LIGHTPROBE_TYPE_CUBE
@ LIGHTPROBE_TYPE_PLANAR
@ LIGHTPROBE_TYPE_GRID
@ ME_EDIT_MIRROR_VERTEX_GROUPS
eMeshSymmetryType
@ ME_SYMMETRY_X
@ ME_SYMMETRY_Y
@ ME_SYMMETRY_Z
#define MB_BALL
#define MB_TUBE
#define MB_ELIPSOID
#define MB_PLANE
#define MB_CUBE
ModifierType
@ eModifierType_ParticleSystem
@ OB_WIRE
@ OB_TEXTURE
@ OB_BOUNDBOX
@ OB_SOLID
@ OB_MODE_VERTEX_GPENCIL
@ OB_MODE_EDIT_GPENCIL
@ OB_MODE_PARTICLE_EDIT
@ OB_MODE_EDIT
@ OB_MODE_WEIGHT_PAINT
@ OB_MODE_WEIGHT_GPENCIL
@ OB_MODE_SCULPT
@ OB_MODE_SCULPT_CURVES
@ OB_MODE_SCULPT_GPENCIL
@ OB_MODE_POSE
@ OB_MODE_TEXTURE_PAINT
@ OB_MODE_OBJECT
@ OB_MODE_VERTEX_PAINT
@ OB_MODE_PAINT_GPENCIL
Object is a sort of wrapper for general info.
@ OB_HIDE_TRANSMISSION
@ OB_HOLDOUT
@ OB_HIDE_RENDER
@ OB_HIDE_CAMERA
@ OB_HIDE_SELECT
@ OB_HIDE_GLOSSY
@ OB_HIDE_SHADOW
@ OB_SHADOW_CATCHER
@ OB_HIDE_VIEWPORT
@ OB_HIDE_DIFFUSE
@ OB_HIDE_VOLUME_SCATTER
#define OB_DATA_SUPPORT_ID(_id_type)
@ OB_EMPTY_IMAGE_USE_ALPHA_BLEND
@ OB_EMPTY_CONE
@ OB_SINGLE_ARROW
@ OB_PLAINAXES
@ OB_ARROWS
@ OB_CIRCLE
@ OB_CUBE
@ OB_EMPTY_IMAGE
@ OB_EMPTY_SPHERE
@ OB_MODIFIER_FLAG_ADD_REST_POSITION
#define OB_TYPE_SUPPORT_PARVERT(_type)
@ OB_SHAPE_EDIT_MODE
@ OB_SHAPE_LOCK
@ OB_SPEAKER
@ OB_LATTICE
@ OB_MBALL
@ OB_EMPTY
@ OB_SURF
@ OB_CAMERA
@ OB_FONT
@ OB_ARMATURE
@ OB_LAMP
@ OB_MESH
@ OB_POINTCLOUD
@ OB_VOLUME
@ OB_CURVES_LEGACY
@ OB_CURVES
@ OB_GPENCIL
@ OB_LIGHTPROBE
@ OBJECT_LRT_OWN_INTERSECTION_PRIORITY
@ OBJECT_LRT_OWN_CREASE
@ OB_POSX
@ OB_NEGZ
@ OB_POSY
@ OB_NEGX
@ OB_POSZ
@ OB_NEGY
@ OB_LOCK_ROTZ
@ OB_LOCK_ROT4D
@ OB_LOCK_SCALEZ
@ OB_LOCK_ROTX
@ OB_LOCK_SCALEX
@ OB_LOCK_ROTW
@ OB_LOCK_LOCY
@ OB_LOCK_LOCZ
@ OB_LOCK_ROTY
@ OB_LOCK_SCALEY
@ OB_LOCK_LOCX
@ OB_DUPLI_FLAG_VIEWPORT
@ OB_DUPLI_FLAG_RENDER
@ GP_STROKE
@ GP_MONKEY
@ GP_EMPTY
@ GP_LRT_OBJECT
@ GP_LRT_COLLECTION
@ GP_LRT_SCENE
@ OB_DRAWNAME
@ OB_DRAWBOUNDOX
@ OB_DRAW_ALL_EDGES
@ OB_AXIS
@ OB_USE_GPENCIL_LIGHTS
@ OB_DRAW_NO_SHADOW_CAST
@ OB_DRAW_IN_FRONT
@ OB_TEXSPACE
@ OB_DRAWWIRE
@ OB_DRAWTRANSP
#define OB_EMPTY_IMAGE_DEPTH_BACK
@ OB_BOUND_CAPSULE
@ OB_BOUND_SPHERE
@ OB_BOUND_CONE
@ OB_BOUND_BOX
@ OB_BOUND_CYLINDER
#define OB_EMPTY_IMAGE_DEPTH_FRONT
@ OB_TRANSFORM_ADJUST_ROOT_PARENT_FOR_VIEW_LOCK
@ OB_DUPLI
@ OB_DUPLIVERTS
@ OB_DUPLIROT
@ OB_DUPLIFACES_SCALE
@ OB_EMPTY_IMAGE_HIDE_FRONT
@ OB_EMPTY_IMAGE_HIDE_NON_AXIS_ALIGNED
@ OB_EMPTY_IMAGE_HIDE_ORTHOGRAPHIC
@ OB_EMPTY_IMAGE_HIDE_BACK
@ OB_EMPTY_IMAGE_HIDE_PERSPECTIVE
@ OBJECT_LRT_INCLUDE
@ OBJECT_LRT_NO_INTERSECTION
@ OBJECT_LRT_EXCLUDE
@ OBJECT_LRT_INHERIT
@ OBJECT_LRT_OCCLUSION_ONLY
@ OBJECT_LRT_INTERSECTION_ONLY
@ OBJECT_LRT_FORCE_INTERSECTION
@ PARVERT1
@ PARSKEL
@ PAROBJECT
@ PARVERT3
@ PARBONE
#define OB_EMPTY_IMAGE_DEPTH_DEFAULT
#define PSYS_DELETE
void EDBM_mesh_load(struct Main *bmain, struct Object *ob)
void ED_vgroup_vert_add(struct Object *ob, struct bDeformGroup *dg, int vertnum, float weight, int assignmode)
#define WEIGHT_REPLACE
Definition: ED_mesh.h:449
float ED_vgroup_vert_weight(struct Object *ob, struct bDeformGroup *dg, int vertnum)
#define WEIGHT_ADD
Definition: ED_mesh.h:450
#define WEIGHT_SUBTRACT
Definition: ED_mesh.h:451
void ED_vgroup_vert_remove(struct Object *ob, struct bDeformGroup *dg, int vertnum)
void EDBM_mesh_make(struct Object *ob, int select_mode, bool add_key_index)
void ED_object_shaderfx_clear(struct Main *bmain, struct Object *ob)
struct ModifierData * ED_object_modifier_add(struct ReportList *reports, struct Main *bmain, struct Scene *scene, struct Object *ob, const char *name, int type)
struct GpencilModifierData * ED_object_gpencil_modifier_add(struct ReportList *reports, struct Main *bmain, struct Scene *scene, struct Object *ob, const char *name, int type)
bool ED_object_shaderfx_remove(struct ReportList *reports, struct Main *bmain, struct Object *ob, struct ShaderFxData *fx)
void ED_object_facemap_face_add(struct Object *ob, struct bFaceMap *fmap, int facenum)
void ED_object_constraint_active_set(struct Object *ob, struct bConstraint *con)
void ED_object_modifier_clear(struct Main *bmain, struct Scene *scene, struct Object *ob)
void ED_object_parent(struct Object *ob, struct Object *parent, int type, const char *substr)
bool ED_object_gpencil_modifier_remove(struct ReportList *reports, struct Main *bmain, struct Object *ob, struct GpencilModifierData *md)
void ED_object_constraint_tag_update(struct Main *bmain, struct Object *ob, struct bConstraint *con)
void ED_object_constraint_update(struct Main *bmain, struct Object *ob)
bool ED_object_modifier_remove(struct ReportList *reports, struct Main *bmain, struct Scene *scene, struct Object *ob, struct ModifierData *md)
void ED_object_gpencil_modifier_clear(struct Main *bmain, struct Object *ob)
struct ShaderFxData * ED_object_shaderfx_add(struct ReportList *reports, struct Main *bmain, struct Scene *scene, struct Object *ob, const char *name, int type)
void ED_object_facemap_face_remove(struct Object *ob, struct bFaceMap *fmap, int facenum)
void PE_current_changed(struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob)
_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
#define RNA_POINTER_INVALIDATE(ptr)
Definition: RNA_access.h:744
@ PARM_RNAPTR
Definition: RNA_types.h:354
@ PARM_REQUIRED
Definition: RNA_types.h:352
@ FUNC_USE_REPORTS
Definition: RNA_types.h:663
@ FUNC_USE_MAIN
Definition: RNA_types.h:661
@ FUNC_USE_CONTEXT
Definition: RNA_types.h:662
@ FUNC_USE_SELF_ID
Definition: RNA_types.h:650
@ STRUCT_ID_REFCOUNT
Definition: RNA_types.h:706
@ PROP_FLOAT
Definition: RNA_types.h:61
@ PROP_BOOLEAN
Definition: RNA_types.h:59
@ PROP_ENUM
Definition: RNA_types.h:63
@ PROP_INT
Definition: RNA_types.h:60
@ PROP_STRING
Definition: RNA_types.h:62
@ PROP_POINTER
Definition: RNA_types.h:64
@ PROP_COLLECTION
Definition: RNA_types.h:65
#define RNA_ENUM_ITEM_SEPR
Definition: RNA_types.h:483
#define RNA_TRANSLATION_PREC_DEFAULT
Definition: RNA_types.h:117
@ PROPOVERRIDE_OVERRIDABLE_LIBRARY
Definition: RNA_types.h:312
@ PROPOVERRIDE_NO_COMPARISON
Definition: RNA_types.h:320
@ PROPOVERRIDE_IGNORE
Definition: RNA_types.h:332
@ PROPOVERRIDE_LIBRARY_INSERTION
Definition: RNA_types.h:337
@ PROPOVERRIDE_NO_PROP_NAME
Definition: RNA_types.h:344
@ PROP_THICK_WRAP
Definition: RNA_types.h:285
@ PROP_DYNAMIC
Definition: RNA_types.h:290
@ PROP_ANIMATABLE
Definition: RNA_types.h:202
@ PROP_PROPORTIONAL
Definition: RNA_types.h:223
@ PROP_NEVER_UNLINK
Definition: RNA_types.h:246
@ PROP_EDITABLE
Definition: RNA_types.h:189
@ PROP_NEVER_NULL
Definition: RNA_types.h:239
@ PROP_NO_DEG_UPDATE
Definition: RNA_types.h:301
@ PROP_ID_SELF_CHECK
Definition: RNA_types.h:232
@ PROP_ID_REFCOUNT
Definition: RNA_types.h:226
@ PROP_MATRIX
Definition: RNA_types.h:158
@ PROP_XYZ
Definition: RNA_types.h:162
@ PROP_DISTANCE
Definition: RNA_types.h:149
@ PROP_COLOR
Definition: RNA_types.h:153
@ PROP_ANGLE
Definition: RNA_types.h:145
@ PROP_AXISANGLE
Definition: RNA_types.h:161
@ PROP_EULER
Definition: RNA_types.h:159
@ PROP_NONE
Definition: RNA_types.h:126
@ PROP_TRANSLATION
Definition: RNA_types.h:154
@ PROP_XYZ_LENGTH
Definition: RNA_types.h:163
@ PROP_UNSIGNED
Definition: RNA_types.h:142
@ PROP_QUATERNION
Definition: RNA_types.h:160
#define C
Definition: RandGen.cpp:25
#define ND_SHADING
Definition: WM_types.h:425
#define NC_GEOM
Definition: WM_types.h:343
#define ND_DRAW
Definition: WM_types.h:410
#define ND_DATA
Definition: WM_types.h:456
#define NA_ADDED
Definition: WM_types.h:525
#define ND_MODIFIER
Definition: WM_types.h:411
#define NA_EDITED
Definition: WM_types.h:523
#define ND_PARENT
Definition: WM_types.h:416
#define NC_MATERIAL
Definition: WM_types.h:330
#define ND_CONSTRAINT
Definition: WM_types.h:413
#define NA_REMOVED
Definition: WM_types.h:526
#define NC_GPENCIL
Definition: WM_types.h:349
#define ND_TRANSFORM
Definition: WM_types.h:405
#define NA_RENAME
Definition: WM_types.h:527
#define ND_OB_SHADING
Definition: WM_types.h:406
#define ND_SPACE_VIEW3D
Definition: WM_types.h:471
#define NC_OBJECT
Definition: WM_types.h:329
#define ND_SHADING_LINKS
Definition: WM_types.h:427
#define NC_SPACE
Definition: WM_types.h:342
#define SELECT
StackEntry * from
Scene scene
SyclQueue void void size_t num_bytes void
void ED_curve_editnurb_make(Object *obedit)
Definition: editcurve.c:1271
void ED_curve_editnurb_load(Main *bmain, Object *obedit)
Definition: editcurve.c:1234
#define str(s)
#define GS(x)
Definition: iris.c:225
static unsigned a[3]
Definition: RandGen.cpp:78
T length(const vec_base< T, Size > &a)
SymEdge< T > * sym(const SymEdge< T > *se)
Definition: delaunay_2d.cc:99
void RNA_pointer_create(ID *id, StructRNA *type, void *data, PointerRNA *r_ptr)
Definition: rna_access.c:136
const PointerRNA PointerRNA_NULL
Definition: rna_access.c:61
PointerRNA RNA_property_pointer_get(PointerRNA *ptr, PropertyRNA *prop)
Definition: rna_access.c:3493
void rna_iterator_listbase_begin(CollectionPropertyIterator *iter, ListBase *lb, IteratorSkipFunc skip)
Definition: rna_access.c:4729
bool RNA_enum_name_from_value(const EnumPropertyItem *item, int value, const char **r_name)
Definition: rna_access.c:5106
void RNA_property_update_main(Main *bmain, Scene *scene, PointerRNA *ptr, PropertyRNA *prop)
Definition: rna_access.c:2143
PointerRNA rna_pointer_inherit_refine(PointerRNA *ptr, StructRNA *type, void *data)
Definition: rna_access.c:186
bool RNA_pointer_is_null(const PointerRNA *ptr)
Definition: rna_access.c:164
void rna_def_animdata_common(StructRNA *srna)
void rna_def_animviz_common(StructRNA *srna)
Definition: rna_animviz.c:315
void rna_def_motionpath_common(StructRNA *srna)
Definition: rna_animviz.c:96
const EnumPropertyItem rna_enum_constraint_type_items[]
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:3836
void RNA_def_property_pointer_sdna(PropertyRNA *prop, const char *structname, const char *propname)
Definition: rna_define.c:2740
void RNA_define_lib_overridable(const bool make_overridable)
Definition: rna_define.c:742
void RNA_def_struct_path_func(StructRNA *srna, const char *path)
Definition: rna_define.c:1193
void RNA_define_animate_sdna(bool animate)
Definition: rna_define.c:748
PropertyRNA * RNA_def_pointer(StructOrFunctionRNA *cont_, const char *identifier, const char *type, const char *ui_name, const char *ui_description)
Definition: rna_define.c:4170
void RNA_def_property_boolean_sdna(PropertyRNA *prop, const char *structname, const char *propname, int64_t bit)
Definition: rna_define.c:2236
void RNA_def_parameter_clear_flags(PropertyRNA *prop, PropertyFlag flag_property, ParameterFlag flag_parameter)
Definition: rna_define.c:1526
PropertyRNA * RNA_def_int_array(StructOrFunctionRNA *cont_, const char *identifier, int len, const int *default_value, int hardmin, int hardmax, const char *ui_name, const char *ui_description, int softmin, int softmax)
Definition: rna_define.c:3655
void RNA_def_property_string_funcs(PropertyRNA *prop, const char *get, const char *length, const char *set)
Definition: rna_define.c:3285
void RNA_def_function_return(FunctionRNA *func, PropertyRNA *ret)
Definition: rna_define.c:4312
void RNA_def_property_float_funcs(PropertyRNA *prop, const char *get, const char *set, const char *range)
Definition: rna_define.c:3126
void RNA_def_property_ui_text(PropertyRNA *prop, const char *name, const char *description)
Definition: rna_define.c:1645
void RNA_def_property_string_sdna(PropertyRNA *prop, const char *structname, const char *propname)
Definition: rna_define.c:2695
void RNA_def_property_ui_icon(PropertyRNA *prop, int icon, int consecutive)
Definition: rna_define.c:1653
FunctionRNA * RNA_def_function(StructRNA *srna, const char *identifier, const char *call)
Definition: rna_define.c:4273
void RNA_def_property_srna(PropertyRNA *prop, const char *type)
Definition: rna_define.c:3474
void RNA_def_property_collection_funcs(PropertyRNA *prop, const char *begin, const char *next, const char *end, const char *get, const char *length, const char *lookupint, const char *lookupstring, const char *assignint)
Definition: rna_define.c:3420
void RNA_def_struct_ui_text(StructRNA *srna, const char *name, const char *description)
Definition: rna_define.c:1237
void RNA_def_property_boolean_default(PropertyRNA *prop, bool value)
Definition: rna_define.c:1937
void RNA_def_property_boolean_funcs(PropertyRNA *prop, const char *get, const char *set)
Definition: rna_define.c:2944
void RNA_def_property_multi_array(PropertyRNA *prop, int dimension, const int length[])
Definition: rna_define.c:1598
const float rna_default_axis_angle[4]
Definition: rna_define.c:1591
void RNA_def_property_editable_array_func(PropertyRNA *prop, const char *editable)
Definition: rna_define.c:2867
void RNA_def_property_enum_items(PropertyRNA *prop, const EnumPropertyItem *item)
Definition: rna_define.c:1872
void RNA_def_struct_sdna(StructRNA *srna, const char *structname)
Definition: rna_define.c:1048
void RNA_def_struct_clear_flag(StructRNA *srna, int flag)
Definition: rna_define.c:1138
void RNA_def_property_array(PropertyRNA *prop, int length)
Definition: rna_define.c:1539
void RNA_def_property_range(PropertyRNA *prop, double min, double max)
Definition: rna_define.c:1737
void RNA_def_property_struct_type(PropertyRNA *prop, const char *type)
Definition: rna_define.c:1772
void RNA_def_property_collection_sdna(PropertyRNA *prop, const char *structname, const char *propname, const char *lengthpropname)
Definition: rna_define.c:2769
void RNA_def_function_ui_description(FunctionRNA *func, const char *description)
Definition: rna_define.c:4347
void RNA_def_property_update(PropertyRNA *prop, int noteflag, const char *func)
Definition: rna_define.c:2900
const int rna_matrix_dimsize_4x4[]
Definition: rna_define.c:1595
void RNA_def_property_enum_funcs(PropertyRNA *prop, const char *get, const char *set, const char *item)
Definition: rna_define.c:3224
void RNA_def_property_editable_func(PropertyRNA *prop, const char *editable)
Definition: rna_define.c:2855
PropertyRNA * RNA_def_property(StructOrFunctionRNA *cont_, const char *identifier, int type, int subtype)
Definition: rna_define.c:1257
void RNA_def_property_enum_bitflag_sdna(PropertyRNA *prop, const char *structname, const char *propname)
Definition: rna_define.c:2669
void RNA_enum_item_end(EnumPropertyItem **items, int *totitem)
Definition: rna_define.c:4487
void RNA_def_struct_name_property(struct StructRNA *srna, struct PropertyRNA *prop)
Definition: rna_define.c:1103
void RNA_def_function_flag(FunctionRNA *func, int flag)
Definition: rna_define.c:4342
void RNA_def_property_clear_flag(PropertyRNA *prop, PropertyFlag flag)
Definition: rna_define.c:1495
void RNA_def_property_pointer_funcs(PropertyRNA *prop, const char *get, const char *set, const char *type_fn, const char *poll)
Definition: rna_define.c:3385
StructRNA * RNA_def_struct(BlenderRNA *brna, const char *identifier, const char *from)
Definition: rna_define.c:1028
void RNA_def_property_enum_sdna(PropertyRNA *prop, const char *structname, const char *propname)
Definition: rna_define.c:2601
void RNA_def_property_int_funcs(PropertyRNA *prop, const char *get, const char *set, const char *range)
Definition: rna_define.c:3028
void RNA_def_struct_ui_icon(StructRNA *srna, int icon)
Definition: rna_define.c:1245
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:3687
void RNA_def_property_override_funcs(PropertyRNA *prop, const char *diff, const char *store, const char *apply)
Definition: rna_define.c:2879
void RNA_def_property_translation_context(PropertyRNA *prop, const char *context)
Definition: rna_define.c:2848
void RNA_def_property_flag(PropertyRNA *prop, PropertyFlag flag)
Definition: rna_define.c:1490
void RNA_def_property_override_clear_flag(PropertyRNA *prop, PropertyOverrideFlag flag)
Definition: rna_define.c:1508
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:3597
void RNA_def_property_float_sdna(PropertyRNA *prop, const char *structname, const char *propname)
Definition: rna_define.c:2493
void RNA_enum_items_add_value(EnumPropertyItem **items, int *totitem, const EnumPropertyItem *item, int value)
Definition: rna_define.c:4472
void RNA_def_property_ui_range(PropertyRNA *prop, double min, double max, double step, int precision)
Definition: rna_define.c:1664
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:3783
void RNA_def_property_int_sdna(PropertyRNA *prop, const char *structname, const char *propname)
Definition: rna_define.c:2343
void RNA_def_property_float_array_default(PropertyRNA *prop, const float *array)
Definition: rna_define.c:2043
void RNA_def_property_boolean_negative_sdna(PropertyRNA *prop, const char *structname, const char *propname, int64_t booleanbit)
Definition: rna_define.c:2327
void RNA_def_struct_nested(BlenderRNA *brna, StructRNA *srna, const char *structname)
Definition: rna_define.c:1119
void RNA_def_property_override_flag(PropertyRNA *prop, PropertyOverrideFlag flag)
Definition: rna_define.c:1503
void RNA_def_parameter_flags(PropertyRNA *prop, PropertyFlag flag_property, ParameterFlag flag_parameter)
Definition: rna_define.c:1518
const EnumPropertyItem rna_enum_object_greasepencil_modifier_type_items[]
bool rna_Curve_object_poll(struct PointerRNA *ptr, struct PointerRNA value)
void rna_object_vcollayer_name_set(struct PointerRNA *ptr, const char *value, char *result, int maxlen)
void rna_object_vgroup_name_index_set(struct PointerRNA *ptr, const char *value, short *index)
void rna_object_vgroup_name_index_get(struct PointerRNA *ptr, char *value, int index)
bool rna_Camera_object_poll(struct PointerRNA *ptr, struct PointerRNA value)
bool rna_Light_object_poll(struct PointerRNA *ptr, struct PointerRNA value)
bool rna_Lattice_object_poll(struct PointerRNA *ptr, struct PointerRNA value)
void rna_object_uvlayer_name_set(struct PointerRNA *ptr, const char *value, char *result, int maxlen)
void rna_Object_internal_update_data(struct Main *bmain, struct Scene *scene, struct PointerRNA *ptr)
void RNA_api_object(struct StructRNA *srna)
bool rna_Mesh_object_poll(struct PointerRNA *ptr, struct PointerRNA value)
bool rna_GPencil_object_poll(struct PointerRNA *ptr, struct PointerRNA value)
int rna_object_vgroup_name_index_length(struct PointerRNA *ptr, int index)
bool rna_Armature_object_poll(struct PointerRNA *ptr, struct PointerRNA value)
void rna_object_vgroup_name_set(struct PointerRNA *ptr, const char *value, char *result, int maxlen)
const EnumPropertyItem rna_enum_object_modifier_type_items[]
Definition: rna_modifier.c:49
static void rna_def_object_grease_pencil_modifiers(BlenderRNA *brna, PropertyRNA *cprop)
Definition: rna_object.c:2652
const EnumPropertyItem rna_enum_object_empty_drawtype_items[]
Definition: rna_object.c:129
const EnumPropertyItem rna_enum_metaelem_type_items[]
Definition: rna_object.c:218
static void rna_def_object_face_maps(BlenderRNA *brna, PropertyRNA *cprop)
Definition: rna_object.c:2833
#define OBTYPE_CU_CURVE
Definition: rna_object.c:236
#define OBTYPE_CU_FONT
Definition: rna_object.c:244
const EnumPropertyItem rna_enum_workspace_object_mode_items[]
Definition: rna_object.c:92
static void rna_def_object_shaderfxs(BlenderRNA *brna, PropertyRNA *cprop)
Definition: rna_object.c:2702
static const EnumPropertyItem instance_items[]
Definition: rna_object.c:192
static void rna_def_face_map(BlenderRNA *brna)
Definition: rna_object.c:2407
static const EnumPropertyItem parent_type_items[]
Definition: rna_object.c:170
const EnumPropertyItem rna_enum_object_gpencil_type_items[]
Definition: rna_object.c:148
const EnumPropertyItem rna_enum_object_rotation_mode_items[]
Definition: rna_object.c:281
static void rna_def_object_visibility(StructRNA *srna)
Definition: rna_object.c:2983
static void rna_def_material_slot(BlenderRNA *brna)
Definition: rna_object.c:2453
static void rna_def_object(BlenderRNA *brna)
Definition: rna_object.c:3074
const EnumPropertyItem rna_enum_lightprobes_type_items[]
Definition: rna_object.c:228
static void rna_def_object_vertex_groups(BlenderRNA *brna, PropertyRNA *cprop)
Definition: rna_object.c:2777
const EnumPropertyItem rna_enum_object_mode_items[]
Definition: rna_object.c:53
static void rna_def_object_lineart(BlenderRNA *brna)
Definition: rna_object.c:2904
const EnumPropertyItem rna_enum_object_axis_items[]
Definition: rna_object.c:297
const EnumPropertyItem rna_enum_object_type_curve_items[]
Definition: rna_object.c:274
#define INSTANCE_ITEM_COLLECTION
Definition: rna_object.c:188
const EnumPropertyItem rna_enum_object_type_items[]
Definition: rna_object.c:249
#define OBTYPE_CU_SURF
Definition: rna_object.c:240
static void rna_def_object_modifiers(BlenderRNA *brna, PropertyRNA *cprop)
Definition: rna_object.c:2585
static const EnumPropertyItem rna_enum_object_empty_image_depth_items[]
Definition: rna_object.c:141
static void rna_def_vertex_group(BlenderRNA *brna)
Definition: rna_object.c:2341
static void rna_def_object_display(BlenderRNA *brna)
Definition: rna_object.c:2882
static void rna_def_object_constraints(BlenderRNA *brna, PropertyRNA *cprop)
Definition: rna_object.c:2514
static void rna_def_object_particle_systems(BlenderRNA *brna, PropertyRNA *cprop)
Definition: rna_object.c:2744
void RNA_def_object(BlenderRNA *brna)
Definition: rna_object.c:3875
#define INSTANCE_ITEMS_SHARED
Definition: rna_object.c:181
const EnumPropertyItem rna_enum_object_shaderfx_type_items[]
Definition: rna_shader_fx.c:33
#define min(a, b)
Definition: sort.c:35
_W64 unsigned int uintptr_t
Definition: stdint.h:119
short selectmode
Definition: BKE_editmesh.h:52
short mat_nr
Definition: BKE_editmesh.h:54
union CollectionPropertyIterator::@1147 internal
void * ptr
Definition: RNA_types.h:398
Definition: DNA_ID.h:368
int tag
Definition: DNA_ID.h:387
char name[66]
Definition: DNA_ID.h:378
Definition: BKE_main.h:121
struct BMEditMesh * edit_mesh
char symmetry
char editflag
ModifierTypeFlag flags
Definition: BKE_modifier.h:161
short partype
ListBase particlesystem
ListBase constraints
struct Collection * instance_collection
ListBase modifiers
ListBase greasepencil_modifiers
char * matbits
struct PartDeflect * pd
unsigned short actfmap
float rot[3]
short shapenr
float parentinv[4][4]
float quat[4]
short rotmode
float rotAngle
float rotAxis[3]
short protectflag
struct Object * parent
void * data
ListBase fmaps
char parsubstr[64]
void * data
Definition: RNA_types.h:38
struct ID * owner_id
Definition: RNA_types.h:36
struct BMesh * bm
Definition: BKE_paint.h:539
char name[64]
float max
void WM_main_add_notifier(unsigned int type, void *reference)
PointerRNA * ptr
Definition: wm_files.c:3480