Blender  V2.93
rna_object.c
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  */
16 
21 #include <stdio.h>
22 #include <stdlib.h>
23 
24 #include "DNA_action_types.h"
25 #include "DNA_brush_types.h"
26 #include "DNA_collection_types.h"
27 #include "DNA_customdata_types.h"
29 #include "DNA_lightprobe_types.h"
30 #include "DNA_material_types.h"
31 #include "DNA_mesh_types.h"
32 #include "DNA_meta_types.h"
33 #include "DNA_object_force_types.h"
34 #include "DNA_object_types.h"
35 #include "DNA_scene_types.h"
36 #include "DNA_shader_fx_types.h"
37 #include "DNA_workspace_types.h"
38 
39 #include "BLI_math.h"
40 #include "BLI_utildefines.h"
41 
42 #include "BLT_translation.h"
43 
44 #include "BKE_camera.h"
45 #include "BKE_collection.h"
46 #include "BKE_editlattice.h"
47 #include "BKE_editmesh.h"
48 #include "BKE_layer.h"
49 #include "BKE_object_deform.h"
50 #include "BKE_object_facemap.h"
51 #include "BKE_paint.h"
52 
53 #include "RNA_access.h"
54 #include "RNA_define.h"
55 #include "RNA_enum_types.h"
56 
57 #include "rna_internal.h"
58 
59 #include "BLI_sys_types.h" /* needed for intptr_t used in ED_mesh.h */
60 #include "ED_mesh.h"
61 
62 #include "WM_api.h"
63 #include "WM_types.h"
64 
66  {OB_MODE_OBJECT, "OBJECT", ICON_OBJECT_DATAMODE, "Object Mode", ""},
67  {OB_MODE_EDIT, "EDIT", ICON_EDITMODE_HLT, "Edit Mode", ""},
68  {OB_MODE_POSE, "POSE", ICON_POSE_HLT, "Pose Mode", ""},
69  {OB_MODE_SCULPT, "SCULPT", ICON_SCULPTMODE_HLT, "Sculpt Mode", ""},
70  {OB_MODE_VERTEX_PAINT, "VERTEX_PAINT", ICON_VPAINT_HLT, "Vertex Paint", ""},
71  {OB_MODE_WEIGHT_PAINT, "WEIGHT_PAINT", ICON_WPAINT_HLT, "Weight Paint", ""},
72  {OB_MODE_TEXTURE_PAINT, "TEXTURE_PAINT", ICON_TPAINT_HLT, "Texture Paint", ""},
73  {OB_MODE_PARTICLE_EDIT, "PARTICLE_EDIT", ICON_PARTICLEMODE, "Particle Edit", ""},
75  "EDIT_GPENCIL",
76  ICON_EDITMODE_HLT,
77  "Edit Mode",
78  "Edit Grease Pencil Strokes"},
80  "SCULPT_GPENCIL",
81  ICON_SCULPTMODE_HLT,
82  "Sculpt Mode",
83  "Sculpt Grease Pencil Strokes"},
85  "PAINT_GPENCIL",
86  ICON_GREASEPENCIL,
87  "Draw",
88  "Paint Grease Pencil Strokes"},
90  "WEIGHT_GPENCIL",
91  ICON_WPAINT_HLT,
92  "Weight Paint",
93  "Grease Pencil Weight Paint Strokes"},
95  "VERTEX_GPENCIL",
96  ICON_VPAINT_HLT,
97  "Vertex Paint",
98  "Grease Pencil Vertex Paint Strokes"},
99  {0, NULL, 0, NULL, NULL},
100 };
101 
102 /* Same as above, but with names that distinguish grease pencil. */
104  {OB_MODE_OBJECT, "OBJECT", ICON_OBJECT_DATAMODE, "Object Mode", ""},
105  {OB_MODE_EDIT, "EDIT", ICON_EDITMODE_HLT, "Edit Mode", ""},
106  {OB_MODE_POSE, "POSE", ICON_POSE_HLT, "Pose Mode", ""},
107  {OB_MODE_SCULPT, "SCULPT", ICON_SCULPTMODE_HLT, "Sculpt Mode", ""},
108  {OB_MODE_VERTEX_PAINT, "VERTEX_PAINT", ICON_VPAINT_HLT, "Vertex Paint", ""},
109  {OB_MODE_WEIGHT_PAINT, "WEIGHT_PAINT", ICON_WPAINT_HLT, "Weight Paint", ""},
110  {OB_MODE_TEXTURE_PAINT, "TEXTURE_PAINT", ICON_TPAINT_HLT, "Texture Paint", ""},
111  {OB_MODE_PARTICLE_EDIT, "PARTICLE_EDIT", ICON_PARTICLEMODE, "Particle Edit", ""},
113  "EDIT_GPENCIL",
114  ICON_EDITMODE_HLT,
115  "Grease Pencil Edit Mode",
116  "Edit Grease Pencil Strokes"},
118  "SCULPT_GPENCIL",
119  ICON_SCULPTMODE_HLT,
120  "Grease Pencil Sculpt Mode",
121  "Sculpt Grease Pencil Strokes"},
123  "PAINT_GPENCIL",
124  ICON_GREASEPENCIL,
125  "Grease Pencil Draw",
126  "Paint Grease Pencil Strokes"},
128  "VERTEX_GPENCIL",
129  ICON_VPAINT_HLT,
130  "Grease Pencil Vertex Paint",
131  "Grease Pencil Vertex Paint Strokes"},
133  "WEIGHT_GPENCIL",
134  ICON_WPAINT_HLT,
135  "Grease Pencil Weight Paint",
136  "Grease Pencil Weight Paint Strokes"},
137  {0, NULL, 0, NULL, NULL},
138 };
139 
141  {OB_PLAINAXES, "PLAIN_AXES", ICON_EMPTY_AXIS, "Plain Axes", ""},
142  {OB_ARROWS, "ARROWS", ICON_EMPTY_ARROWS, "Arrows", ""},
143  {OB_SINGLE_ARROW, "SINGLE_ARROW", ICON_EMPTY_SINGLE_ARROW, "Single Arrow", ""},
144  {OB_CIRCLE, "CIRCLE", ICON_MESH_CIRCLE, "Circle", ""},
145  {OB_CUBE, "CUBE", ICON_CUBE, "Cube", ""},
146  {OB_EMPTY_SPHERE, "SPHERE", ICON_SPHERE, "Sphere", ""},
147  {OB_EMPTY_CONE, "CONE", ICON_CONE, "Cone", ""},
148  {OB_EMPTY_IMAGE, "IMAGE", ICON_FILE_IMAGE, "Image", ""},
149  {0, NULL, 0, NULL, NULL},
150 };
151 
153  {OB_EMPTY_IMAGE_DEPTH_DEFAULT, "DEFAULT", 0, "Default", ""},
154  {OB_EMPTY_IMAGE_DEPTH_FRONT, "FRONT", 0, "Front", ""},
155  {OB_EMPTY_IMAGE_DEPTH_BACK, "BACK", 0, "Back", ""},
156  {0, NULL, 0, NULL, NULL},
157 };
158 
160  {GP_EMPTY, "EMPTY", ICON_EMPTY_AXIS, "Blank", "Create an empty grease pencil object"},
161  {GP_STROKE, "STROKE", ICON_STROKE, "Stroke", "Create a simple stroke with basic colors"},
162  {GP_MONKEY, "MONKEY", ICON_MONKEY, "Monkey", "Construct a Suzanne grease pencil object"},
163  {0, "", 0, NULL, NULL},
164  {GP_LRT_SCENE,
165  "LRT_SCENE",
166  ICON_SCENE_DATA,
167  "Scene Line Art",
168  "Quickly set up line art for the entire scene"},
170  "LRT_COLLECTION",
171  ICON_OUTLINER_COLLECTION,
172  "Collection Line Art",
173  "Quickly set up line art for the active collection"},
174  {GP_LRT_OBJECT,
175  "LRT_OBJECT",
176  ICON_OBJECT_DATA,
177  "Object Line Art",
178  "Quickly set up line art for the active object"},
179  {0, NULL, 0, NULL, NULL}};
180 
182  {PAROBJECT, "OBJECT", 0, "Object", "The object is parented to an object"},
183  {PARSKEL, "ARMATURE", 0, "Armature", ""},
184  /* PARSKEL reuse will give issues. */
185  {PARSKEL, "LATTICE", 0, "Lattice", "The object is parented to a lattice"},
186  {PARVERT1, "VERTEX", 0, "Vertex", "The object is parented to a vertex"},
187  {PARVERT3, "VERTEX_3", 0, "3 Vertices", ""},
188  {PARBONE, "BONE", 0, "Bone", "The object is parented to a bone"},
189  {0, NULL, 0, NULL, NULL},
190 };
191 
192 #define INSTANCE_ITEMS_SHARED \
193  {0, "NONE", 0, "None", ""}, \
194  {OB_DUPLIVERTS, "VERTS", 0, "Vertices", "Instantiate child objects on all vertices"}, \
195  { \
196  OB_DUPLIFACES, "FACES", 0, "Faces", "Instantiate child objects on all faces" \
197  }
198 
199 #define INSTANCE_ITEM_COLLECTION \
200  { \
201  OB_DUPLICOLLECTION, "COLLECTION", 0, "Collection", "Enable collection instancing" \
202  }
206  {0, NULL, 0, NULL, NULL},
207 };
208 #ifdef RNA_RUNTIME
209 static EnumPropertyItem instance_items_nogroup[] = {
211  {0, NULL, 0, NULL, NULL},
212 };
213 
214 static EnumPropertyItem instance_items_pointcloud[] = {
215  {0, "NONE", 0, "None", ""},
216  {OB_DUPLIVERTS, "POINTS", 0, "Points", "Instantiate child objects on all points"},
217  {0, NULL, 0, NULL, NULL},
218 };
219 #endif
220 #undef INSTANCE_ITEMS_SHARED
221 #undef INSTANCE_ITEM_COLLECTION
222 
224  {MB_BALL, "BALL", ICON_META_BALL, "Ball", ""},
225  {MB_TUBE, "CAPSULE", ICON_META_CAPSULE, "Capsule", ""},
226  {MB_PLANE, "PLANE", ICON_META_PLANE, "Plane", ""},
227  /* NOTE: typo at original definition! */
228  {MB_ELIPSOID, "ELLIPSOID", ICON_META_ELLIPSOID, "Ellipsoid", ""},
229  {MB_CUBE, "CUBE", ICON_META_CUBE, "Cube", ""},
230  {0, NULL, 0, NULL, NULL},
231 };
232 
234  {LIGHTPROBE_TYPE_CUBE, "CUBE", ICON_LIGHTPROBE_CUBEMAP, "Cube", ""},
235  {LIGHTPROBE_TYPE_PLANAR, "PLANAR", ICON_LIGHTPROBE_PLANAR, "Planar", ""},
236  {LIGHTPROBE_TYPE_GRID, "GRID", ICON_LIGHTPROBE_GRID, "Grid", ""},
237  {0, NULL, 0, NULL, NULL},
238 };
239 
240 /* used for 2 enums */
241 #define OBTYPE_CU_CURVE \
242  { \
243  OB_CURVE, "CURVE", ICON_OUTLINER_OB_CURVE, "Curve", "" \
244  }
245 #define OBTYPE_CU_SURF \
246  { \
247  OB_SURF, "SURFACE", ICON_OUTLINER_OB_SURFACE, "Surface", "" \
248  }
249 #define OBTYPE_CU_FONT \
250  { \
251  OB_FONT, "FONT", ICON_OUTLINER_OB_FONT, "Text", "" \
252  }
253 
255  {OB_MESH, "MESH", ICON_OUTLINER_OB_MESH, "Mesh", ""},
258  {OB_MBALL, "META", ICON_OUTLINER_OB_META, "Metaball", ""},
260  {OB_HAIR, "HAIR", ICON_OUTLINER_OB_HAIR, "Hair", ""},
261  {OB_POINTCLOUD, "POINTCLOUD", ICON_OUTLINER_OB_POINTCLOUD, "Point Cloud", ""},
262  {OB_VOLUME, "VOLUME", ICON_OUTLINER_OB_VOLUME, "Volume", ""},
263  {OB_GPENCIL, "GPENCIL", ICON_OUTLINER_OB_GREASEPENCIL, "Grease Pencil", ""},
264  {0, "", 0, NULL, NULL},
265  {OB_ARMATURE, "ARMATURE", ICON_OUTLINER_OB_ARMATURE, "Armature", ""},
266  {OB_LATTICE, "LATTICE", ICON_OUTLINER_OB_LATTICE, "Lattice", ""},
267  {0, "", 0, NULL, NULL},
268  {OB_EMPTY, "EMPTY", ICON_OUTLINER_OB_EMPTY, "Empty", ""},
269  {0, "", 0, NULL, NULL},
270  {OB_LAMP, "LIGHT", ICON_OUTLINER_OB_LIGHT, "Light", ""},
271  {OB_LIGHTPROBE, "LIGHT_PROBE", ICON_OUTLINER_OB_LIGHTPROBE, "Light Probe", ""},
272  {0, "", 0, NULL, NULL},
273  {OB_CAMERA, "CAMERA", ICON_OUTLINER_OB_CAMERA, "Camera", ""},
274  {0, "", 0, NULL, NULL},
275  {OB_SPEAKER, "SPEAKER", ICON_OUTLINER_OB_SPEAKER, "Speaker", ""},
276  {0, NULL, 0, NULL, NULL},
277 };
278 
283  {0, NULL, 0, NULL, NULL},
284 };
285 
287  {ROT_MODE_QUAT, "QUATERNION", 0, "Quaternion (WXYZ)", "No Gimbal Lock"},
288  {ROT_MODE_XYZ, "XYZ", 0, "XYZ Euler", "XYZ Rotation Order - prone to Gimbal Lock (default)"},
289  {ROT_MODE_XZY, "XZY", 0, "XZY Euler", "XZY Rotation Order - prone to Gimbal Lock"},
290  {ROT_MODE_YXZ, "YXZ", 0, "YXZ Euler", "YXZ Rotation Order - prone to Gimbal Lock"},
291  {ROT_MODE_YZX, "YZX", 0, "YZX Euler", "YZX Rotation Order - prone to Gimbal Lock"},
292  {ROT_MODE_ZXY, "ZXY", 0, "ZXY Euler", "ZXY Rotation Order - prone to Gimbal Lock"},
293  {ROT_MODE_ZYX, "ZYX", 0, "ZYX Euler", "ZYX Rotation Order - prone to Gimbal Lock"},
295  "AXIS_ANGLE",
296  0,
297  "Axis Angle",
298  "Axis Angle (W+XYZ), defines a rotation around some axis defined by 3D-Vector"},
299  {0, NULL, 0, NULL, NULL},
300 };
301 
303  {OB_POSX, "POS_X", 0, "+X", ""},
304  {OB_POSY, "POS_Y", 0, "+Y", ""},
305  {OB_POSZ, "POS_Z", 0, "+Z", ""},
306  {OB_NEGX, "NEG_X", 0, "-X", ""},
307  {OB_NEGY, "NEG_Y", 0, "-Y", ""},
308  {OB_NEGZ, "NEG_Z", 0, "-Z", ""},
309  {0, NULL, 0, NULL, NULL},
310 };
311 
312 #ifdef RNA_RUNTIME
313 
314 # include "BLI_math.h"
315 
316 # include "DNA_ID.h"
317 # include "DNA_constraint_types.h"
318 # include "DNA_gpencil_types.h"
319 # include "DNA_key_types.h"
320 # include "DNA_lattice_types.h"
321 # include "DNA_node_types.h"
322 
323 # include "BKE_armature.h"
324 # include "BKE_brush.h"
325 # include "BKE_constraint.h"
326 # include "BKE_context.h"
327 # include "BKE_curve.h"
328 # include "BKE_deform.h"
329 # include "BKE_effect.h"
330 # include "BKE_global.h"
331 # include "BKE_key.h"
332 # include "BKE_material.h"
333 # include "BKE_mesh.h"
334 # include "BKE_modifier.h"
335 # include "BKE_object.h"
336 # include "BKE_particle.h"
337 # include "BKE_scene.h"
338 
339 # include "DEG_depsgraph.h"
340 # include "DEG_depsgraph_build.h"
341 
342 # include "ED_curve.h"
343 # include "ED_lattice.h"
344 # include "ED_object.h"
345 # include "ED_particle.h"
346 
347 static void rna_Object_internal_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
348 {
350 }
351 
352 static void rna_Object_internal_update_draw(Main *UNUSED(bmain),
353  Scene *UNUSED(scene),
354  PointerRNA *ptr)
355 {
358 }
359 
360 static void rna_Object_matrix_world_update(Main *bmain, Scene *scene, PointerRNA *ptr)
361 {
362  /* don't use compat so we get predictable rotation */
363  BKE_object_apply_mat4((Object *)ptr->owner_id, ((Object *)ptr->owner_id)->obmat, false, true);
364  rna_Object_internal_update(bmain, scene, ptr);
365 }
366 
367 static void rna_Object_hide_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
368 {
369  Object *ob = (Object *)ptr->owner_id;
374 }
375 
376 static void rna_Object_duplicator_visibility_flag_update(Main *UNUSED(bmain),
377  Scene *UNUSED(scene),
378  PointerRNA *ptr)
379 {
380  Object *ob = (Object *)ptr->owner_id;
382 }
383 
384 static void rna_MaterialIndex_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
385 {
386  Object *ob = (Object *)ptr->owner_id;
387  if (ob && ob->type == OB_GPENCIL) {
388  /* notifying material property in topbar */
390  }
391 }
392 
393 static void rna_GPencil_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
394 {
395  Object *ob = (Object *)ptr->owner_id;
396  if (ob && ob->type == OB_GPENCIL) {
397  bGPdata *gpd = (bGPdata *)ob->data;
400  }
401 }
402 
403 static void rna_Object_matrix_local_get(PointerRNA *ptr, float values[16])
404 {
405  Object *ob = (Object *)ptr->owner_id;
406  BKE_object_matrix_local_get(ob, (float(*)[4])values);
407 }
408 
409 static void rna_Object_matrix_local_set(PointerRNA *ptr, const float values[16])
410 {
411  Object *ob = (Object *)ptr->owner_id;
412  float local_mat[4][4];
413 
414  /* Localspace matrix is truly relative to the parent,
415  * but parameters stored in object are relative to parentinv matrix.
416  * Undo the parent inverse part before applying it as local matrix. */
417  if (ob->parent) {
418  float invmat[4][4];
419  invert_m4_m4(invmat, ob->parentinv);
420  mul_m4_m4m4(local_mat, invmat, (float(*)[4])values);
421  }
422  else {
423  copy_m4_m4(local_mat, (float(*)[4])values);
424  }
425 
426  /* Don't use compatible so we get predictable rotation, and do not use parenting either,
427  * because it's a local matrix! */
428  BKE_object_apply_mat4(ob, local_mat, false, false);
429 }
430 
431 static void rna_Object_matrix_basis_get(PointerRNA *ptr, float values[16])
432 {
433  Object *ob = (Object *)ptr->owner_id;
434  BKE_object_to_mat4(ob, (float(*)[4])values);
435 }
436 
437 static void rna_Object_matrix_basis_set(PointerRNA *ptr, const float values[16])
438 {
439  Object *ob = (Object *)ptr->owner_id;
440  BKE_object_apply_mat4(ob, (float(*)[4])values, false, false);
441 }
442 
443 void rna_Object_internal_update_data_impl(PointerRNA *ptr)
444 {
447 }
448 
450 {
451  rna_Object_internal_update_data_impl(ptr);
452 }
453 
454 void rna_Object_internal_update_data_dependency(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
455 {
457  rna_Object_internal_update_data_impl(ptr);
458 }
459 
460 static void rna_Object_active_shape_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
461 {
462  Object *ob = (Object *)ptr->owner_id;
463 
465  /* exit/enter editmode to get new shape */
466  switch (ob->type) {
467  case OB_MESH: {
468  Mesh *me = ob->data;
469  BMEditMesh *em = me->edit_mesh;
470  int select_mode = em->selectmode;
471  EDBM_mesh_load(bmain, ob);
472  EDBM_mesh_make(ob, select_mode, true);
473  em = me->edit_mesh;
474 
475  DEG_id_tag_update(&me->id, 0);
476 
479  break;
480  }
481  case OB_CURVE:
482  case OB_SURF:
483  ED_curve_editnurb_load(bmain, ob);
485  break;
486  case OB_LATTICE:
489  break;
490  }
491  }
492 
493  rna_Object_internal_update_data_impl(ptr);
494 }
495 
496 static void rna_Object_dependency_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
497 {
501 }
502 
503 void rna_Object_data_update(Main *bmain, Scene *scene, PointerRNA *ptr)
504 {
505  Object *object = (Object *)ptr->data;
506 
507  if (object->mode == OB_MODE_SCULPT) {
509  }
510 
511  rna_Object_internal_update_data_dependency(bmain, scene, ptr);
512 }
513 
514 static void rna_Object_data_set(PointerRNA *ptr, PointerRNA value, struct ReportList *reports)
515 {
516  Object *ob = (Object *)ptr->data;
517  ID *id = value.data;
518 
519  if (ob->mode & OB_MODE_EDIT) {
520  return;
521  }
522 
523  /* assigning NULL only for empties */
524  if ((id == NULL) && (ob->type != OB_EMPTY)) {
525  return;
526  }
527 
528  if (id && ((id->tag & LIB_TAG_NO_MAIN) != (ob->id.tag & LIB_TAG_NO_MAIN))) {
529  BKE_report(reports,
530  RPT_ERROR,
531  "Can only assign evaluated data to evaluated object, or original data to "
532  "original object");
533  return;
534  }
535 
536  if (ob->type == OB_EMPTY) {
537  if (ob->data) {
538  id_us_min((ID *)ob->data);
539  ob->data = NULL;
540  }
541 
542  if (!id || GS(id->name) == ID_IM) {
543  id_us_plus(id);
544  ob->data = id;
545  }
546  }
547  else if (ob->type == OB_MESH) {
548  BKE_mesh_assign_object(G_MAIN, ob, (Mesh *)id);
549  }
550  else {
551  if (ob->data) {
552  id_us_min((ID *)ob->data);
553  }
554 
555  /* no need to type-check here ID. this is done in the _typef() function */
557  id_us_plus(id);
558 
559  ob->data = id;
561 
562  if (GS(id->name) == ID_CU) {
564  }
565  else if (ob->type == OB_ARMATURE) {
566  BKE_pose_rebuild(G_MAIN, ob, ob->data, true);
567  }
568  }
569 }
570 
571 static StructRNA *rna_Object_data_typef(PointerRNA *ptr)
572 {
573  Object *ob = (Object *)ptr->data;
574 
575  /* keep in sync with OB_DATA_SUPPORT_ID() macro */
576  switch (ob->type) {
577  case OB_EMPTY:
578  return &RNA_Image;
579  case OB_MESH:
580  return &RNA_Mesh;
581  case OB_CURVE:
582  return &RNA_Curve;
583  case OB_SURF:
584  return &RNA_Curve;
585  case OB_FONT:
586  return &RNA_Curve;
587  case OB_MBALL:
588  return &RNA_MetaBall;
589  case OB_LAMP:
590  return &RNA_Light;
591  case OB_CAMERA:
592  return &RNA_Camera;
593  case OB_LATTICE:
594  return &RNA_Lattice;
595  case OB_ARMATURE:
596  return &RNA_Armature;
597  case OB_SPEAKER:
598  return &RNA_Speaker;
599  case OB_LIGHTPROBE:
600  return &RNA_LightProbe;
601  case OB_GPENCIL:
602  return &RNA_GreasePencil;
603  case OB_HAIR:
604 # ifdef WITH_HAIR_NODES
605  return &RNA_Hair;
606 # else
607  return &RNA_ID;
608 # endif
609  case OB_POINTCLOUD:
610 # ifdef WITH_POINT_CLOUD
611  return &RNA_PointCloud;
612 # else
613  return &RNA_ID;
614 # endif
615  case OB_VOLUME:
616  return &RNA_Volume;
617  default:
618  return &RNA_ID;
619  }
620 }
621 
622 static bool rna_Object_data_poll(PointerRNA *ptr, const PointerRNA value)
623 {
624  Object *ob = (Object *)ptr->data;
625 
626  if (ob->type == OB_GPENCIL) {
627  /* GP Object - Don't allow using "Annotation" GP datablocks here */
628  bGPdata *gpd = value.data;
629  return (gpd->flag & GP_DATA_ANNOTATIONS) == 0;
630  }
631 
632  return true;
633 }
634 
635 static void rna_Object_parent_set(PointerRNA *ptr,
636  PointerRNA value,
637  struct ReportList *UNUSED(reports))
638 {
639  Object *ob = (Object *)ptr->data;
640  Object *par = (Object *)value.data;
641 
642  {
643  ED_object_parent(ob, par, ob->partype, ob->parsubstr);
644  }
645 }
646 
647 static bool rna_Object_parent_override_apply(Main *UNUSED(bmain),
648  PointerRNA *ptr_dst,
649  PointerRNA *ptr_src,
650  PointerRNA *ptr_storage,
651  PropertyRNA *prop_dst,
652  PropertyRNA *prop_src,
653  PropertyRNA *UNUSED(prop_storage),
654  const int len_dst,
655  const int len_src,
656  const int len_storage,
657  PointerRNA *UNUSED(ptr_item_dst),
658  PointerRNA *UNUSED(ptr_item_src),
659  PointerRNA *UNUSED(ptr_item_storage),
661 {
662  BLI_assert(len_dst == len_src && (!ptr_storage || len_dst == len_storage) && len_dst == 0);
664  "Unsupported RNA override operation on object parent pointer");
665  UNUSED_VARS_NDEBUG(ptr_storage, len_dst, len_src, len_storage, opop);
666 
667  /* We need a special handling here because setting parent resets invert parent matrix,
668  * which is evil in our case. */
669  Object *ob = (Object *)ptr_dst->data;
670  Object *parent_dst = RNA_property_pointer_get(ptr_dst, prop_dst).data;
671  Object *parent_src = RNA_property_pointer_get(ptr_src, prop_src).data;
672 
673  if (parent_src == parent_dst) {
674  return false;
675  }
676 
677  if (parent_src == NULL) {
678  /* The only case where we do want default behavior (with matrix reset). */
679  ED_object_parent(ob, parent_src, ob->partype, ob->parsubstr);
680  }
681  else {
682  ob->parent = parent_src;
683  }
684  return true;
685 }
686 
687 static void rna_Object_parent_type_set(PointerRNA *ptr, int value)
688 {
689  Object *ob = (Object *)ptr->data;
690 
691  ED_object_parent(ob, ob->parent, value, ob->parsubstr);
692 }
693 
694 static const EnumPropertyItem *rna_Object_parent_type_itemf(bContext *UNUSED(C),
695  PointerRNA *ptr,
696  PropertyRNA *UNUSED(prop),
697  bool *r_free)
698 {
699  Object *ob = (Object *)ptr->data;
700  EnumPropertyItem *item = NULL;
701  int totitem = 0;
702 
704 
705  if (ob->parent) {
706  Object *par = ob->parent;
707 
708  if (par->type == OB_LATTICE) {
709  /* special hack: prevents this overriding others */
710  RNA_enum_items_add_value(&item, &totitem, &parent_type_items[2], PARSKEL);
711  }
712  else if (par->type == OB_ARMATURE) {
713  /* special hack: prevents this being overridden */
714  RNA_enum_items_add_value(&item, &totitem, &parent_type_items[1], PARSKEL);
716  }
717 
718  if (OB_TYPE_SUPPORT_PARVERT(par->type)) {
721  }
722  }
723 
724  RNA_enum_item_end(&item, &totitem);
725  *r_free = true;
726 
727  return item;
728 }
729 
730 static void rna_Object_empty_display_type_set(PointerRNA *ptr, int value)
731 {
732  Object *ob = (Object *)ptr->data;
733 
735 }
736 
737 static void rna_Object_parent_bone_set(PointerRNA *ptr, const char *value)
738 {
739  Object *ob = (Object *)ptr->data;
740 
741  ED_object_parent(ob, ob->parent, ob->partype, value);
742 }
743 
744 static const EnumPropertyItem *rna_Object_instance_type_itemf(bContext *UNUSED(C),
745  PointerRNA *ptr,
746  PropertyRNA *UNUSED(prop),
747  bool *UNUSED(r_free))
748 {
749  Object *ob = (Object *)ptr->data;
750  const EnumPropertyItem *item;
751 
752  if (ob->type == OB_EMPTY) {
753  item = instance_items;
754  }
755  else if (ob->type == OB_POINTCLOUD) {
756  item = instance_items_pointcloud;
757  }
758  else {
759  item = instance_items_nogroup;
760  }
761 
762  return item;
763 }
764 
765 static void rna_Object_dup_collection_set(PointerRNA *ptr,
766  PointerRNA value,
767  struct ReportList *UNUSED(reports))
768 {
769  Object *ob = (Object *)ptr->data;
770  Collection *grp = (Collection *)value.data;
771 
772  /* Must not let this be set if the object belongs in this group already,
773  * thus causing a cycle/infinite-recursion leading to crashes on load T25298. */
774  if (BKE_collection_has_object_recursive(grp, ob) == 0) {
775  if (ob->type == OB_EMPTY) {
777  ob->instance_collection = grp;
779  }
780  else {
781  BKE_report(NULL, RPT_ERROR, "Only empty objects support collection instances");
782  }
783  }
784  else {
786  RPT_ERROR,
787  "Cannot set instance-collection as object belongs in group being instanced, thus "
788  "causing a cycle");
789  }
790 }
791 
792 static void rna_VertexGroup_name_set(PointerRNA *ptr, const char *value)
793 {
794  Object *ob = (Object *)ptr->owner_id;
795  bDeformGroup *dg = (bDeformGroup *)ptr->data;
796  BLI_strncpy_utf8(dg->name, value, sizeof(dg->name));
798 }
799 
800 static int rna_VertexGroup_index_get(PointerRNA *ptr)
801 {
802  Object *ob = (Object *)ptr->owner_id;
803 
804  return BLI_findindex(&ob->defbase, ptr->data);
805 }
806 
807 static PointerRNA rna_Object_active_vertex_group_get(PointerRNA *ptr)
808 {
809  Object *ob = (Object *)ptr->owner_id;
811  ptr, &RNA_VertexGroup, BLI_findlink(&ob->defbase, ob->actdef - 1));
812 }
813 
814 static void rna_Object_active_vertex_group_set(PointerRNA *ptr,
815  PointerRNA value,
816  struct ReportList *reports)
817 {
818  Object *ob = (Object *)ptr->owner_id;
819  int index = BLI_findindex(&ob->defbase, value.data);
820  if (index == -1) {
821  BKE_reportf(reports,
822  RPT_ERROR,
823  "VertexGroup '%s' not found in object '%s'",
824  ((bDeformGroup *)value.data)->name,
825  ob->id.name + 2);
826  return;
827  }
828 
829  ob->actdef = index + 1;
830 }
831 
832 static int rna_Object_active_vertex_group_index_get(PointerRNA *ptr)
833 {
834  Object *ob = (Object *)ptr->owner_id;
835  return ob->actdef - 1;
836 }
837 
838 static void rna_Object_active_vertex_group_index_set(PointerRNA *ptr, int value)
839 {
840  Object *ob = (Object *)ptr->owner_id;
841  ob->actdef = value + 1;
842 }
843 
844 static void rna_Object_active_vertex_group_index_range(
845  PointerRNA *ptr, int *min, int *max, int *UNUSED(softmin), int *UNUSED(softmax))
846 {
847  Object *ob = (Object *)ptr->owner_id;
848 
849  *min = 0;
850  *max = max_ii(0, BLI_listbase_count(&ob->defbase) - 1);
851 }
852 
853 void rna_object_vgroup_name_index_get(PointerRNA *ptr, char *value, int index)
854 {
855  Object *ob = (Object *)ptr->owner_id;
856  bDeformGroup *dg;
857 
858  dg = BLI_findlink(&ob->defbase, index - 1);
859 
860  if (dg) {
861  BLI_strncpy(value, dg->name, sizeof(dg->name));
862  }
863  else {
864  value[0] = '\0';
865  }
866 }
867 
869 {
870  Object *ob = (Object *)ptr->owner_id;
871  bDeformGroup *dg;
872 
873  dg = BLI_findlink(&ob->defbase, index - 1);
874  return (dg) ? strlen(dg->name) : 0;
875 }
876 
877 void rna_object_vgroup_name_index_set(PointerRNA *ptr, const char *value, short *index)
878 {
879  Object *ob = (Object *)ptr->owner_id;
880  *index = BKE_object_defgroup_name_index(ob, value) + 1;
881 }
882 
883 void rna_object_vgroup_name_set(PointerRNA *ptr, const char *value, char *result, int maxlen)
884 {
885  Object *ob = (Object *)ptr->owner_id;
887  if (dg) {
888  /* No need for BLI_strncpy_utf8, since this matches an existing group. */
889  BLI_strncpy(result, value, maxlen);
890  return;
891  }
892 
893  result[0] = '\0';
894 }
895 
896 static void rna_FaceMap_name_set(PointerRNA *ptr, const char *value)
897 {
898  Object *ob = (Object *)ptr->owner_id;
899  bFaceMap *fmap = (bFaceMap *)ptr->data;
900  BLI_strncpy_utf8(fmap->name, value, sizeof(fmap->name));
902 }
903 
904 static int rna_FaceMap_index_get(PointerRNA *ptr)
905 {
906  Object *ob = (Object *)ptr->owner_id;
907 
908  return BLI_findindex(&ob->fmaps, ptr->data);
909 }
910 
911 static PointerRNA rna_Object_active_face_map_get(PointerRNA *ptr)
912 {
913  Object *ob = (Object *)ptr->owner_id;
915 }
916 
917 static int rna_Object_active_face_map_index_get(PointerRNA *ptr)
918 {
919  Object *ob = (Object *)ptr->owner_id;
920  return ob->actfmap - 1;
921 }
922 
923 static void rna_Object_active_face_map_index_set(PointerRNA *ptr, int value)
924 {
925  Object *ob = (Object *)ptr->owner_id;
926  ob->actfmap = value + 1;
927 }
928 
929 static void rna_Object_active_face_map_index_range(
930  PointerRNA *ptr, int *min, int *max, int *UNUSED(softmin), int *UNUSED(softmax))
931 {
932  Object *ob = (Object *)ptr->owner_id;
933 
934  *min = 0;
935  *max = max_ii(0, BLI_listbase_count(&ob->fmaps) - 1);
936 }
937 
938 void rna_object_BKE_object_facemap_name_index_get(PointerRNA *ptr, char *value, int index)
939 {
940  Object *ob = (Object *)ptr->owner_id;
941  bFaceMap *fmap;
942 
943  fmap = BLI_findlink(&ob->fmaps, index - 1);
944 
945  if (fmap) {
946  BLI_strncpy(value, fmap->name, sizeof(fmap->name));
947  }
948  else {
949  value[0] = '\0';
950  }
951 }
952 
953 int rna_object_BKE_object_facemap_name_index_length(PointerRNA *ptr, int index)
954 {
955  Object *ob = (Object *)ptr->owner_id;
956  bFaceMap *fmap;
957 
958  fmap = BLI_findlink(&ob->fmaps, index - 1);
959  return (fmap) ? strlen(fmap->name) : 0;
960 }
961 
962 void rna_object_BKE_object_facemap_name_index_set(PointerRNA *ptr, const char *value, short *index)
963 {
964  Object *ob = (Object *)ptr->owner_id;
965  *index = BKE_object_facemap_name_index(ob, value) + 1;
966 }
967 
968 void rna_object_fmap_name_set(PointerRNA *ptr, const char *value, char *result, int maxlen)
969 {
970  Object *ob = (Object *)ptr->owner_id;
971  bFaceMap *fmap = BKE_object_facemap_find_name(ob, value);
972  if (fmap) {
973  /* No need for BLI_strncpy_utf8, since this matches an existing group. */
974  BLI_strncpy(result, value, maxlen);
975  return;
976  }
977 
978  result[0] = '\0';
979 }
980 
981 void rna_object_uvlayer_name_set(PointerRNA *ptr, const char *value, char *result, int maxlen)
982 {
983  Object *ob = (Object *)ptr->owner_id;
984  Mesh *me;
985  CustomDataLayer *layer;
986  int a;
987 
988  if (ob->type == OB_MESH && ob->data) {
989  me = (Mesh *)ob->data;
990 
991  for (a = 0; a < me->ldata.totlayer; a++) {
992  layer = &me->ldata.layers[a];
993 
994  if (layer->type == CD_MLOOPUV && STREQ(layer->name, value)) {
995  BLI_strncpy(result, value, maxlen);
996  return;
997  }
998  }
999  }
1000 
1001  result[0] = '\0';
1002 }
1003 
1004 void rna_object_vcollayer_name_set(PointerRNA *ptr, const char *value, char *result, int maxlen)
1005 {
1006  Object *ob = (Object *)ptr->owner_id;
1007  Mesh *me;
1008  CustomDataLayer *layer;
1009  int a;
1010 
1011  if (ob->type == OB_MESH && ob->data) {
1012  me = (Mesh *)ob->data;
1013 
1014  for (a = 0; a < me->fdata.totlayer; a++) {
1015  layer = &me->fdata.layers[a];
1016 
1017  if (layer->type == CD_MCOL && STREQ(layer->name, value)) {
1018  BLI_strncpy(result, value, maxlen);
1019  return;
1020  }
1021  }
1022  }
1023 
1024  result[0] = '\0';
1025 }
1026 
1027 static int rna_Object_active_material_index_get(PointerRNA *ptr)
1028 {
1029  Object *ob = (Object *)ptr->owner_id;
1030  return MAX2(ob->actcol - 1, 0);
1031 }
1032 
1033 static void rna_Object_active_material_index_set(PointerRNA *ptr, int value)
1034 {
1035  Object *ob = (Object *)ptr->owner_id;
1036  ob->actcol = value + 1;
1037 
1038  if (ob->type == OB_MESH) {
1039  Mesh *me = ob->data;
1040 
1041  if (me->edit_mesh) {
1042  me->edit_mesh->mat_nr = value;
1043  }
1044  }
1045 }
1046 
1047 static void rna_Object_active_material_index_range(
1048  PointerRNA *ptr, int *min, int *max, int *UNUSED(softmin), int *UNUSED(softmax))
1049 {
1050  Object *ob = (Object *)ptr->owner_id;
1051  *min = 0;
1052  *max = max_ii(ob->totcol - 1, 0);
1053 }
1054 
1055 /* returns active base material */
1056 static PointerRNA rna_Object_active_material_get(PointerRNA *ptr)
1057 {
1058  Object *ob = (Object *)ptr->owner_id;
1059  Material *ma;
1060 
1061  ma = (ob->totcol) ? BKE_object_material_get(ob, ob->actcol) : NULL;
1063 }
1064 
1065 static void rna_Object_active_material_set(PointerRNA *ptr,
1066  PointerRNA value,
1067  struct ReportList *UNUSED(reports))
1068 {
1069  Object *ob = (Object *)ptr->owner_id;
1070 
1071  DEG_id_tag_update(value.data, 0);
1075 
1076  if (ob->type == OB_GPENCIL) {
1077  /* notifying material property in topbar */
1079  }
1080 }
1081 
1082 static int rna_Object_active_material_editable(PointerRNA *ptr, const char **UNUSED(r_info))
1083 {
1084  Object *ob = (Object *)ptr->owner_id;
1085  bool is_editable;
1086 
1087  if ((ob->matbits == NULL) || (ob->actcol == 0) || ob->matbits[ob->actcol - 1]) {
1088  is_editable = !ID_IS_LINKED(ob);
1089  }
1090  else {
1091  is_editable = ob->data ? !ID_IS_LINKED(ob->data) : false;
1092  }
1093 
1094  return is_editable ? PROP_EDITABLE : 0;
1095 }
1096 
1097 static void rna_Object_active_particle_system_index_range(
1098  PointerRNA *ptr, int *min, int *max, int *UNUSED(softmin), int *UNUSED(softmax))
1099 {
1100  Object *ob = (Object *)ptr->owner_id;
1101  *min = 0;
1102  *max = max_ii(0, BLI_listbase_count(&ob->particlesystem) - 1);
1103 }
1104 
1105 static int rna_Object_active_particle_system_index_get(PointerRNA *ptr)
1106 {
1107  Object *ob = (Object *)ptr->owner_id;
1108  return psys_get_current_num(ob);
1109 }
1110 
1111 static void rna_Object_active_particle_system_index_set(PointerRNA *ptr, int value)
1112 {
1113  Object *ob = (Object *)ptr->owner_id;
1114  psys_set_current_num(ob, value);
1115 }
1116 
1117 static void rna_Object_particle_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *ptr)
1118 {
1119  /* TODO: Disabled for now, because bContext is not available. */
1120 # if 0
1121  Object *ob = (Object *)ptr->owner_id;
1123 # else
1124  (void)scene;
1125  (void)ptr;
1126 # endif
1127 }
1128 
1129 /* rotation - axis-angle */
1130 static void rna_Object_rotation_axis_angle_get(PointerRNA *ptr, float *value)
1131 {
1132  Object *ob = ptr->data;
1133 
1134  /* for now, assume that rotation mode is axis-angle */
1135  value[0] = ob->rotAngle;
1136  copy_v3_v3(&value[1], ob->rotAxis);
1137 }
1138 
1139 /* rotation - axis-angle */
1140 static void rna_Object_rotation_axis_angle_set(PointerRNA *ptr, const float *value)
1141 {
1142  Object *ob = ptr->data;
1143 
1144  /* for now, assume that rotation mode is axis-angle */
1145  ob->rotAngle = value[0];
1146  copy_v3_v3(ob->rotAxis, &value[1]);
1147 
1148  /* TODO: validate axis? */
1149 }
1150 
1151 static void rna_Object_rotation_mode_set(PointerRNA *ptr, int value)
1152 {
1153  Object *ob = ptr->data;
1154 
1155  /* use API Method for conversions... */
1157  ob->quat, ob->rot, ob->rotAxis, &ob->rotAngle, ob->rotmode, (short)value);
1158 
1159  /* finally, set the new rotation type */
1160  ob->rotmode = value;
1161 }
1162 
1163 static void rna_Object_dimensions_get(PointerRNA *ptr, float *value)
1164 {
1165  Object *ob = ptr->data;
1166  BKE_object_dimensions_get(ob, value);
1167 }
1168 
1169 static void rna_Object_dimensions_set(PointerRNA *ptr, const float *value)
1170 {
1171  Object *ob = ptr->data;
1172  BKE_object_dimensions_set(ob, value, 0);
1173 }
1174 
1175 static int rna_Object_location_editable(PointerRNA *ptr, int index)
1176 {
1177  Object *ob = (Object *)ptr->data;
1178 
1179  /* only if the axis in question is locked, not editable... */
1180  if ((index == 0) && (ob->protectflag & OB_LOCK_LOCX)) {
1181  return 0;
1182  }
1183  else if ((index == 1) && (ob->protectflag & OB_LOCK_LOCY)) {
1184  return 0;
1185  }
1186  else if ((index == 2) && (ob->protectflag & OB_LOCK_LOCZ)) {
1187  return 0;
1188  }
1189  else {
1190  return PROP_EDITABLE;
1191  }
1192 }
1193 
1194 static int rna_Object_scale_editable(PointerRNA *ptr, int index)
1195 {
1196  Object *ob = (Object *)ptr->data;
1197 
1198  /* only if the axis in question is locked, not editable... */
1199  if ((index == 0) && (ob->protectflag & OB_LOCK_SCALEX)) {
1200  return 0;
1201  }
1202  else if ((index == 1) && (ob->protectflag & OB_LOCK_SCALEY)) {
1203  return 0;
1204  }
1205  else if ((index == 2) && (ob->protectflag & OB_LOCK_SCALEZ)) {
1206  return 0;
1207  }
1208  else {
1209  return PROP_EDITABLE;
1210  }
1211 }
1212 
1213 static int rna_Object_rotation_euler_editable(PointerRNA *ptr, int index)
1214 {
1215  Object *ob = (Object *)ptr->data;
1216 
1217  /* only if the axis in question is locked, not editable... */
1218  if ((index == 0) && (ob->protectflag & OB_LOCK_ROTX)) {
1219  return 0;
1220  }
1221  else if ((index == 1) && (ob->protectflag & OB_LOCK_ROTY)) {
1222  return 0;
1223  }
1224  else if ((index == 2) && (ob->protectflag & OB_LOCK_ROTZ)) {
1225  return 0;
1226  }
1227  else {
1228  return PROP_EDITABLE;
1229  }
1230 }
1231 
1232 static int rna_Object_rotation_4d_editable(PointerRNA *ptr, int index)
1233 {
1234  Object *ob = (Object *)ptr->data;
1235 
1236  /* only consider locks if locking components individually... */
1237  if (ob->protectflag & OB_LOCK_ROT4D) {
1238  /* only if the axis in question is locked, not editable... */
1239  if ((index == 0) && (ob->protectflag & OB_LOCK_ROTW)) {
1240  return 0;
1241  }
1242  else if ((index == 1) && (ob->protectflag & OB_LOCK_ROTX)) {
1243  return 0;
1244  }
1245  else if ((index == 2) && (ob->protectflag & OB_LOCK_ROTY)) {
1246  return 0;
1247  }
1248  else if ((index == 3) && (ob->protectflag & OB_LOCK_ROTZ)) {
1249  return 0;
1250  }
1251  }
1252 
1253  return PROP_EDITABLE;
1254 }
1255 
1256 static int rna_MaterialSlot_material_editable(PointerRNA *ptr, const char **UNUSED(r_info))
1257 {
1258  Object *ob = (Object *)ptr->owner_id;
1259  const int index = (Material **)ptr->data - ob->mat;
1260  bool is_editable;
1261 
1262  if ((ob->matbits == NULL) || ob->matbits[index]) {
1263  is_editable = !ID_IS_LINKED(ob);
1264  }
1265  else {
1266  is_editable = ob->data ? !ID_IS_LINKED(ob->data) : false;
1267  }
1268 
1269  return is_editable ? PROP_EDITABLE : 0;
1270 }
1271 
1272 static PointerRNA rna_MaterialSlot_material_get(PointerRNA *ptr)
1273 {
1274  Object *ob = (Object *)ptr->owner_id;
1275  Material *ma;
1276  const int index = (Material **)ptr->data - ob->mat;
1277 
1278  ma = BKE_object_material_get(ob, index + 1);
1280 }
1281 
1282 static void rna_MaterialSlot_material_set(PointerRNA *ptr,
1283  PointerRNA value,
1284  struct ReportList *UNUSED(reports))
1285 {
1286  Object *ob = (Object *)ptr->owner_id;
1287  int index = (Material **)ptr->data - ob->mat;
1288 
1292 }
1293 
1294 static bool rna_MaterialSlot_material_poll(PointerRNA *ptr, PointerRNA value)
1295 {
1296  Object *ob = (Object *)ptr->owner_id;
1297  Material *ma = (Material *)value.data;
1298 
1299  if (ob->type == OB_GPENCIL) {
1300  /* GP Materials only */
1301  return (ma->gp_style != NULL);
1302  }
1303  else {
1304  /* Everything except GP materials */
1305  return (ma->gp_style == NULL);
1306  }
1307 }
1308 
1309 static int rna_MaterialSlot_link_get(PointerRNA *ptr)
1310 {
1311  Object *ob = (Object *)ptr->owner_id;
1312  int index = (Material **)ptr->data - ob->mat;
1313 
1314  return ob->matbits[index] != 0;
1315 }
1316 
1317 static void rna_MaterialSlot_link_set(PointerRNA *ptr, int value)
1318 {
1319  Object *ob = (Object *)ptr->owner_id;
1320  int index = (Material **)ptr->data - ob->mat;
1321 
1322  if (value) {
1323  ob->matbits[index] = 1;
1324  /* DEPRECATED */
1325  // ob->colbits |= (1 << index);
1326  }
1327  else {
1328  ob->matbits[index] = 0;
1329  /* DEPRECATED */
1330  // ob->colbits &= ~(1 << index);
1331  }
1332 }
1333 
1334 static int rna_MaterialSlot_name_length(PointerRNA *ptr)
1335 {
1336  Object *ob = (Object *)ptr->owner_id;
1337  Material *ma;
1338  int index = (Material **)ptr->data - ob->mat;
1339 
1340  ma = BKE_object_material_get(ob, index + 1);
1341 
1342  if (ma) {
1343  return strlen(ma->id.name + 2);
1344  }
1345 
1346  return 0;
1347 }
1348 
1349 static void rna_MaterialSlot_name_get(PointerRNA *ptr, char *str)
1350 {
1351  Object *ob = (Object *)ptr->owner_id;
1352  Material *ma;
1353  int index = (Material **)ptr->data - ob->mat;
1354 
1355  ma = BKE_object_material_get(ob, index + 1);
1356 
1357  if (ma) {
1358  strcpy(str, ma->id.name + 2);
1359  }
1360  else {
1361  str[0] = '\0';
1362  }
1363 }
1364 
1365 static void rna_MaterialSlot_update(Main *bmain, Scene *scene, PointerRNA *ptr)
1366 {
1367  rna_Object_internal_update(bmain, scene, ptr);
1368 
1371  DEG_relations_tag_update(bmain);
1372 }
1373 
1374 static char *rna_MaterialSlot_path(PointerRNA *ptr)
1375 {
1376  Object *ob = (Object *)ptr->owner_id;
1377  int index = (Material **)ptr->data - ob->mat;
1378 
1379  return BLI_sprintfN("material_slots[%d]", index);
1380 }
1381 
1382 static PointerRNA rna_Object_display_get(PointerRNA *ptr)
1383 {
1385 }
1386 
1387 static char *rna_ObjectDisplay_path(PointerRNA *UNUSED(ptr))
1388 {
1389  return BLI_strdup("display");
1390 }
1391 
1392 static PointerRNA rna_Object_active_particle_system_get(PointerRNA *ptr)
1393 {
1394  Object *ob = (Object *)ptr->owner_id;
1395  ParticleSystem *psys = psys_get_current(ob);
1397 }
1398 
1399 static void rna_Object_active_shape_key_index_range(
1400  PointerRNA *ptr, int *min, int *max, int *UNUSED(softmin), int *UNUSED(softmax))
1401 {
1402  Object *ob = (Object *)ptr->owner_id;
1403  Key *key = BKE_key_from_object(ob);
1404 
1405  *min = 0;
1406  if (key) {
1407  *max = BLI_listbase_count(&key->block) - 1;
1408  if (*max < 0) {
1409  *max = 0;
1410  }
1411  }
1412  else {
1413  *max = 0;
1414  }
1415 }
1416 
1417 static int rna_Object_active_shape_key_index_get(PointerRNA *ptr)
1418 {
1419  Object *ob = (Object *)ptr->owner_id;
1420 
1421  return MAX2(ob->shapenr - 1, 0);
1422 }
1423 
1424 static void rna_Object_active_shape_key_index_set(PointerRNA *ptr, int value)
1425 {
1426  Object *ob = (Object *)ptr->owner_id;
1427 
1428  ob->shapenr = value + 1;
1429 }
1430 
1431 static PointerRNA rna_Object_active_shape_key_get(PointerRNA *ptr)
1432 {
1433  Object *ob = (Object *)ptr->owner_id;
1434  Key *key = BKE_key_from_object(ob);
1435  KeyBlock *kb;
1436  PointerRNA keyptr;
1437 
1438  if (key == NULL) {
1439  return PointerRNA_NULL;
1440  }
1441 
1442  kb = BLI_findlink(&key->block, ob->shapenr - 1);
1443  RNA_pointer_create((ID *)key, &RNA_ShapeKey, kb, &keyptr);
1444  return keyptr;
1445 }
1446 
1447 static PointerRNA rna_Object_field_get(PointerRNA *ptr)
1448 {
1449  Object *ob = (Object *)ptr->owner_id;
1450 
1451  /* weak */
1452  if (!ob->pd) {
1453  ob->pd = BKE_partdeflect_new(0);
1454  }
1455 
1457 }
1458 
1459 static PointerRNA rna_Object_collision_get(PointerRNA *ptr)
1460 {
1461  Object *ob = (Object *)ptr->owner_id;
1462 
1463  if (ob->type != OB_MESH) {
1464  return PointerRNA_NULL;
1465  }
1466 
1467  /* weak */
1468  if (!ob->pd) {
1469  ob->pd = BKE_partdeflect_new(0);
1470  }
1471 
1473 }
1474 
1475 static PointerRNA rna_Object_active_constraint_get(PointerRNA *ptr)
1476 {
1477  Object *ob = (Object *)ptr->owner_id;
1480 }
1481 
1482 static void rna_Object_active_constraint_set(PointerRNA *ptr,
1483  PointerRNA value,
1484  struct ReportList *UNUSED(reports))
1485 {
1486  Object *ob = (Object *)ptr->owner_id;
1488 }
1489 
1490 static bConstraint *rna_Object_constraints_new(Object *object, Main *bmain, int type)
1491 {
1492  bConstraint *new_con = BKE_constraint_add_for_object(object, NULL, type);
1493 
1494  ED_object_constraint_tag_update(bmain, object, new_con);
1496 
1497  return new_con;
1498 }
1499 
1500 static void rna_Object_constraints_remove(Object *object,
1501  Main *bmain,
1502  ReportList *reports,
1503  PointerRNA *con_ptr)
1504 {
1505  bConstraint *con = con_ptr->data;
1506  if (BLI_findindex(&object->constraints, con) == -1) {
1507  BKE_reportf(reports,
1508  RPT_ERROR,
1509  "Constraint '%s' not found in object '%s'",
1510  con->name,
1511  object->id.name + 2);
1512  return;
1513  }
1514 
1515  BKE_constraint_remove(&object->constraints, con);
1516  RNA_POINTER_INVALIDATE(con_ptr);
1517 
1518  ED_object_constraint_update(bmain, object);
1521 }
1522 
1523 static void rna_Object_constraints_clear(Object *object, Main *bmain)
1524 {
1526 
1527  ED_object_constraint_update(bmain, object);
1529 
1531 }
1532 
1533 static void rna_Object_constraints_move(
1534  Object *object, Main *bmain, ReportList *reports, int from, int to)
1535 {
1536  if (from == to) {
1537  return;
1538  }
1539 
1540  if (!BLI_listbase_move_index(&object->constraints, from, to)) {
1541  BKE_reportf(reports, RPT_ERROR, "Could not move constraint from index '%d' to '%d'", from, to);
1542  return;
1543  }
1544 
1545  ED_object_constraint_tag_update(bmain, object, NULL);
1547 }
1548 
1549 static bConstraint *rna_Object_constraints_copy(Object *object, Main *bmain, PointerRNA *con_ptr)
1550 {
1551  bConstraint *con = con_ptr->data;
1552  bConstraint *new_con = BKE_constraint_copy_for_object(object, con);
1553 
1554  ED_object_constraint_tag_update(bmain, object, new_con);
1556 
1557  return new_con;
1558 }
1559 
1560 bool rna_Object_constraints_override_apply(Main *UNUSED(bmain),
1561  PointerRNA *ptr_dst,
1562  PointerRNA *ptr_src,
1563  PointerRNA *UNUSED(ptr_storage),
1564  PropertyRNA *UNUSED(prop_dst),
1565  PropertyRNA *UNUSED(prop_src),
1566  PropertyRNA *UNUSED(prop_storage),
1567  const int UNUSED(len_dst),
1568  const int UNUSED(len_src),
1569  const int UNUSED(len_storage),
1570  PointerRNA *UNUSED(ptr_item_dst),
1571  PointerRNA *UNUSED(ptr_item_src),
1572  PointerRNA *UNUSED(ptr_item_storage),
1574 {
1576  "Unsupported RNA override operation on constraints collection");
1577 
1578  Object *ob_dst = (Object *)ptr_dst->owner_id;
1579  Object *ob_src = (Object *)ptr_src->owner_id;
1580 
1581  /* Remember that insertion operations are defined and stored in correct order, which means that
1582  * even if we insert several items in a row, we always insert first one, then second one, etc.
1583  * So we should always find 'anchor' constraint in both _src *and* _dst. */
1584  bConstraint *con_anchor = NULL;
1585  if (opop->subitem_local_name && opop->subitem_local_name[0]) {
1586  con_anchor = BLI_findstring(
1587  &ob_dst->constraints, opop->subitem_local_name, offsetof(bConstraint, name));
1588  }
1589  if (con_anchor == NULL && opop->subitem_local_index >= 0) {
1590  con_anchor = BLI_findlink(&ob_dst->constraints, opop->subitem_local_index);
1591  }
1592  /* Otherwise we just insert in first position. */
1593 
1594  bConstraint *con_src = NULL;
1595  if (opop->subitem_local_name && opop->subitem_local_name[0]) {
1596  con_src = BLI_findstring(
1597  &ob_src->constraints, opop->subitem_local_name, offsetof(bConstraint, name));
1598  }
1599  if (con_src == NULL && opop->subitem_local_index >= 0) {
1600  con_src = BLI_findlink(&ob_src->constraints, opop->subitem_local_index);
1601  }
1602  con_src = con_src ? con_src->next : ob_src->constraints.first;
1603 
1604  if (con_src == NULL) {
1605  BLI_assert(con_src != NULL);
1606  return false;
1607  }
1608 
1609  bConstraint *con_dst = BKE_constraint_duplicate_ex(con_src, 0, true);
1610 
1611  /* This handles NULL anchor as expected by adding at head of list. */
1612  BLI_insertlinkafter(&ob_dst->constraints, con_anchor, con_dst);
1613 
1614  /* This should actually *not* be needed in typical cases.
1615  * However, if overridden source was edited, we *may* have some new conflicting names. */
1616  BKE_constraint_unique_name(con_dst, &ob_dst->constraints);
1617 
1618  // printf("%s: We inserted a constraint...\n", __func__);
1619  return true;
1620 }
1621 
1622 static ModifierData *rna_Object_modifier_new(
1623  Object *object, bContext *C, ReportList *reports, const char *name, int type)
1624 {
1626  reports, CTX_data_main(C), CTX_data_scene(C), object, name, type);
1627 
1629 
1630  return md;
1631 }
1632 
1633 static void rna_Object_modifier_remove(Object *object,
1634  bContext *C,
1635  ReportList *reports,
1636  PointerRNA *md_ptr)
1637 {
1638  ModifierData *md = md_ptr->data;
1639  if (ED_object_modifier_remove(reports, CTX_data_main(C), CTX_data_scene(C), object, md) ==
1640  false) {
1641  /* error is already set */
1642  return;
1643  }
1644 
1645  RNA_POINTER_INVALIDATE(md_ptr);
1646 
1648 }
1649 
1650 static void rna_Object_modifier_clear(Object *object, bContext *C)
1651 {
1653 
1655 }
1656 
1657 static PointerRNA rna_Object_active_modifier_get(PointerRNA *ptr)
1658 {
1659  Object *ob = (Object *)ptr->owner_id;
1662 }
1663 
1664 static void rna_Object_active_modifier_set(PointerRNA *ptr, PointerRNA value, ReportList *reports)
1665 {
1666  Object *ob = (Object *)ptr->owner_id;
1667  ModifierData *md = value.data;
1668 
1669  if (RNA_pointer_is_null(&value)) {
1671  return;
1672  }
1673 
1674  if (BLI_findindex(&ob->modifiers, md) == -1) {
1675  BKE_reportf(
1676  reports, RPT_ERROR, "Modifier \"%s\" is not in the object's modifier list", md->name);
1677  return;
1678  }
1679 
1681 }
1682 
1683 bool rna_Object_modifiers_override_apply(Main *bmain,
1684  PointerRNA *ptr_dst,
1685  PointerRNA *ptr_src,
1686  PointerRNA *UNUSED(ptr_storage),
1687  PropertyRNA *UNUSED(prop_dst),
1688  PropertyRNA *UNUSED(prop_src),
1689  PropertyRNA *UNUSED(prop_storage),
1690  const int UNUSED(len_dst),
1691  const int UNUSED(len_src),
1692  const int UNUSED(len_storage),
1693  PointerRNA *UNUSED(ptr_item_dst),
1694  PointerRNA *UNUSED(ptr_item_src),
1695  PointerRNA *UNUSED(ptr_item_storage),
1697 {
1699  "Unsupported RNA override operation on modifiers collection");
1700 
1701  Object *ob_dst = (Object *)ptr_dst->owner_id;
1702  Object *ob_src = (Object *)ptr_src->owner_id;
1703 
1704  /* Remember that insertion operations are defined and stored in correct order, which means that
1705  * even if we insert several items in a row, we always insert first one, then second one, etc.
1706  * So we should always find 'anchor' modifier in both _src *and* _dst. */
1707  ModifierData *mod_anchor = NULL;
1708  if (opop->subitem_local_name && opop->subitem_local_name[0]) {
1709  mod_anchor = BLI_findstring(
1710  &ob_dst->modifiers, opop->subitem_local_name, offsetof(ModifierData, name));
1711  }
1712  if (mod_anchor == NULL && opop->subitem_local_index >= 0) {
1713  mod_anchor = BLI_findlink(&ob_dst->modifiers, opop->subitem_local_index);
1714  }
1715  /* Otherwise we just insert in first position. */
1716 
1717  ModifierData *mod_src = NULL;
1718  if (opop->subitem_local_name && opop->subitem_local_name[0]) {
1719  mod_src = BLI_findstring(
1720  &ob_src->modifiers, opop->subitem_local_name, offsetof(ModifierData, name));
1721  }
1722  if (mod_src == NULL && opop->subitem_local_index >= 0) {
1723  mod_src = BLI_findlink(&ob_src->modifiers, opop->subitem_local_index);
1724  }
1725  mod_src = mod_src ? mod_src->next : ob_src->modifiers.first;
1726 
1727  if (mod_src == NULL) {
1728  BLI_assert(mod_src != NULL);
1729  return false;
1730  }
1731 
1732  /* While it would be nicer to use lower-level BKE_modifier_new() here, this one is lacking
1733  * special-cases handling (particles and other physics modifiers mostly), so using the ED version
1734  * instead, to avoid duplicating code. */
1736  NULL, bmain, NULL, ob_dst, mod_src->name, mod_src->type);
1737 
1738  /* XXX Current handling of 'copy' from particle-system modifier is *very* bad (it keeps same psys
1739  * pointer as source, then calling code copies psys of object separately and do some magic
1740  * remapping of pointers...), unfortunately several pieces of code in Object editing area rely on
1741  * this behavior. So for now, hacking around it to get it doing what we want it to do, as getting
1742  * a proper behavior would be everything but trivial, and this whole particle thingy is
1743  * end-of-life. */
1744  ParticleSystem *psys_dst = (mod_dst->type == eModifierType_ParticleSystem) ?
1745  ((ParticleSystemModifierData *)mod_dst)->psys :
1746  NULL;
1747  BKE_modifier_copydata(mod_src, mod_dst);
1748  if (mod_dst->type == eModifierType_ParticleSystem) {
1749  psys_dst->flag &= ~PSYS_DELETE;
1750  ((ParticleSystemModifierData *)mod_dst)->psys = psys_dst;
1751  }
1752 
1753  BLI_remlink(&ob_dst->modifiers, mod_dst);
1754  /* This handles NULL anchor as expected by adding at head of list. */
1755  BLI_insertlinkafter(&ob_dst->modifiers, mod_anchor, mod_dst);
1756 
1757  // printf("%s: We inserted a modifier '%s'...\n", __func__, mod_dst->name);
1758  return true;
1759 }
1760 
1761 static GpencilModifierData *rna_Object_greasepencil_modifier_new(
1762  Object *object, bContext *C, ReportList *reports, const char *name, int type)
1763 {
1765  reports, CTX_data_main(C), CTX_data_scene(C), object, name, type);
1766 }
1767 
1768 static void rna_Object_greasepencil_modifier_remove(Object *object,
1769  bContext *C,
1770  ReportList *reports,
1771  PointerRNA *gmd_ptr)
1772 {
1773  GpencilModifierData *gmd = gmd_ptr->data;
1774  if (ED_object_gpencil_modifier_remove(reports, CTX_data_main(C), object, gmd) == false) {
1775  /* error is already set */
1776  return;
1777  }
1778 
1779  RNA_POINTER_INVALIDATE(gmd_ptr);
1780 
1782 }
1783 
1784 static void rna_Object_greasepencil_modifier_clear(Object *object, bContext *C)
1785 {
1788 }
1789 
1790 bool rna_Object_greasepencil_modifiers_override_apply(Main *bmain,
1791  PointerRNA *ptr_dst,
1792  PointerRNA *ptr_src,
1793  PointerRNA *UNUSED(ptr_storage),
1794  PropertyRNA *UNUSED(prop_dst),
1795  PropertyRNA *UNUSED(prop_src),
1796  PropertyRNA *UNUSED(prop_storage),
1797  const int UNUSED(len_dst),
1798  const int UNUSED(len_src),
1799  const int UNUSED(len_storage),
1800  PointerRNA *UNUSED(ptr_item_dst),
1801  PointerRNA *UNUSED(ptr_item_src),
1802  PointerRNA *UNUSED(ptr_item_storage),
1804 {
1806  "Unsupported RNA override operation on modifiers collection");
1807 
1808  Object *ob_dst = (Object *)ptr_dst->owner_id;
1809  Object *ob_src = (Object *)ptr_src->owner_id;
1810 
1811  /* Remember that insertion operations are defined and stored in correct order, which means that
1812  * even if we insert several items in a row, we always insert first one, then second one, etc.
1813  * So we should always find 'anchor' modifier in both _src *and* _dst. */
1814  GpencilModifierData *mod_anchor = NULL;
1815  if (opop->subitem_local_name && opop->subitem_local_name[0]) {
1816  mod_anchor = BLI_findstring(
1817  &ob_dst->greasepencil_modifiers, opop->subitem_local_name, offsetof(ModifierData, name));
1818  }
1819  if (mod_anchor == NULL && opop->subitem_local_index >= 0) {
1820  mod_anchor = BLI_findlink(&ob_dst->greasepencil_modifiers, opop->subitem_local_index);
1821  }
1822  /* Otherwise we just insert in first position. */
1823 
1824  GpencilModifierData *mod_src = NULL;
1825  if (opop->subitem_local_name && opop->subitem_local_name[0]) {
1826  mod_src = BLI_findstring(
1827  &ob_src->greasepencil_modifiers, opop->subitem_local_name, offsetof(ModifierData, name));
1828  }
1829  if (mod_src == NULL && opop->subitem_local_index >= 0) {
1830  mod_src = BLI_findlink(&ob_src->greasepencil_modifiers, opop->subitem_local_index);
1831  }
1832  mod_src = mod_src ? mod_src->next : ob_src->greasepencil_modifiers.first;
1833 
1834  if (mod_src == NULL) {
1835  BLI_assert(mod_src != NULL);
1836  return false;
1837  }
1838 
1839  /* While it would be nicer to use lower-level BKE_modifier_new() here, this one is lacking
1840  * special-cases handling (particles and other physics modifiers mostly), so using the ED version
1841  * instead, to avoid duplicating code. */
1843  NULL, bmain, NULL, ob_dst, mod_src->name, mod_src->type);
1844 
1845  BLI_remlink(&ob_dst->modifiers, mod_dst);
1846  /* This handles NULL anchor as expected by adding at head of list. */
1847  BLI_insertlinkafter(&ob_dst->greasepencil_modifiers, mod_anchor, mod_dst);
1848 
1849  // printf("%s: We inserted a gpencil modifier '%s'...\n", __func__, mod_dst->name);
1850  return true;
1851 }
1852 
1853 /* shader fx */
1854 static ShaderFxData *rna_Object_shaderfx_new(
1855  Object *object, bContext *C, ReportList *reports, const char *name, int type)
1856 {
1857  return ED_object_shaderfx_add(reports, CTX_data_main(C), CTX_data_scene(C), object, name, type);
1858 }
1859 
1860 static void rna_Object_shaderfx_remove(Object *object,
1861  bContext *C,
1862  ReportList *reports,
1863  PointerRNA *gmd_ptr)
1864 {
1865  ShaderFxData *gmd = gmd_ptr->data;
1866  if (ED_object_shaderfx_remove(reports, CTX_data_main(C), object, gmd) == false) {
1867  /* error is already set */
1868  return;
1869  }
1870 
1871  RNA_POINTER_INVALIDATE(gmd_ptr);
1872 
1874 }
1875 
1876 static void rna_Object_shaderfx_clear(Object *object, bContext *C)
1877 {
1880 }
1881 
1882 static void rna_Object_boundbox_get(PointerRNA *ptr, float *values)
1883 {
1884  Object *ob = (Object *)ptr->owner_id;
1886  if (bb) {
1887  memcpy(values, bb->vec, sizeof(bb->vec));
1888  }
1889  else {
1890  copy_vn_fl(values, sizeof(bb->vec) / sizeof(float), 0.0f);
1891  }
1892 }
1893 
1894 static bDeformGroup *rna_Object_vgroup_new(Object *ob,
1895  Main *bmain,
1896  ReportList *reports,
1897  const char *name)
1898 {
1899  if (!OB_TYPE_SUPPORT_VGROUP(ob->type)) {
1900  const char *ob_type_name = "Unknown";
1902  BKE_reportf(
1903  reports, RPT_ERROR, "VertexGroups.new(): is not supported for '%s' objects", ob_type_name);
1904  return NULL;
1905  }
1906 
1907  bDeformGroup *defgroup = BKE_object_defgroup_add_name(ob, name);
1908 
1909  DEG_relations_tag_update(bmain);
1911 
1912  return defgroup;
1913 }
1914 
1915 static void rna_Object_vgroup_remove(Object *ob,
1916  Main *bmain,
1917  ReportList *reports,
1918  PointerRNA *defgroup_ptr)
1919 {
1920  bDeformGroup *defgroup = defgroup_ptr->data;
1921  if (BLI_findindex(&ob->defbase, defgroup) == -1) {
1922  BKE_reportf(reports,
1923  RPT_ERROR,
1924  "DeformGroup '%s' not in object '%s'",
1925  defgroup->name,
1926  ob->id.name + 2);
1927  return;
1928  }
1929 
1930  BKE_object_defgroup_remove(ob, defgroup);
1931  RNA_POINTER_INVALIDATE(defgroup_ptr);
1932 
1933  DEG_relations_tag_update(bmain);
1935 }
1936 
1937 static void rna_Object_vgroup_clear(Object *ob, Main *bmain)
1938 {
1940 
1941  DEG_relations_tag_update(bmain);
1943 }
1944 
1945 static void rna_VertexGroup_vertex_add(ID *id,
1946  bDeformGroup *def,
1947  ReportList *reports,
1948  int index_len,
1949  int *index,
1950  float weight,
1951  int assignmode)
1952 {
1953  Object *ob = (Object *)id;
1954 
1956  BKE_report(
1957  reports, RPT_ERROR, "VertexGroup.add(): cannot be called while object is in edit mode");
1958  return;
1959  }
1960 
1961  while (index_len--) {
1963  ob, def, *index++, weight, assignmode); /* XXX, not efficient calling within loop*/
1964  }
1965 
1968 }
1969 
1970 static void rna_VertexGroup_vertex_remove(
1971  ID *id, bDeformGroup *dg, ReportList *reports, int index_len, int *index)
1972 {
1973  Object *ob = (Object *)id;
1974 
1976  BKE_report(
1977  reports, RPT_ERROR, "VertexGroup.remove(): cannot be called while object is in edit mode");
1978  return;
1979  }
1980 
1981  while (index_len--) {
1982  ED_vgroup_vert_remove(ob, dg, *index++);
1983  }
1984 
1987 }
1988 
1989 static float rna_VertexGroup_weight(ID *id, bDeformGroup *dg, ReportList *reports, int index)
1990 {
1991  float weight = ED_vgroup_vert_weight((Object *)id, dg, index);
1992 
1993  if (weight < 0) {
1994  BKE_report(reports, RPT_ERROR, "Vertex not in group");
1995  }
1996  return weight;
1997 }
1998 
1999 static bFaceMap *rna_Object_fmap_new(Object *ob, const char *name)
2000 {
2001  bFaceMap *fmap = BKE_object_facemap_add_name(ob, name);
2002 
2004 
2005  return fmap;
2006 }
2007 
2008 static void rna_Object_fmap_remove(Object *ob, ReportList *reports, PointerRNA *fmap_ptr)
2009 {
2010  bFaceMap *fmap = fmap_ptr->data;
2011  if (BLI_findindex(&ob->fmaps, fmap) == -1) {
2012  BKE_reportf(
2013  reports, RPT_ERROR, "Face map '%s' not in object '%s'", fmap->name, ob->id.name + 2);
2014  return;
2015  }
2016 
2017  BKE_object_facemap_remove(ob, fmap);
2018  RNA_POINTER_INVALIDATE(fmap_ptr);
2019 
2021 }
2022 
2023 static void rna_Object_fmap_clear(Object *ob)
2024 {
2026 
2028 }
2029 
2030 static void rna_FaceMap_face_add(
2031  ID *id, bFaceMap *fmap, ReportList *reports, int index_len, int *index)
2032 {
2033  Object *ob = (Object *)id;
2034 
2035  if (BKE_object_is_in_editmode(ob)) {
2036  BKE_report(reports, RPT_ERROR, "FaceMap.add(): cannot be called while object is in edit mode");
2037  return;
2038  }
2039 
2040  while (index_len--) {
2041  ED_object_facemap_face_add(ob, fmap, *index++);
2042  }
2043 
2045 }
2046 
2047 static void rna_FaceMap_face_remove(
2048  ID *id, bFaceMap *fmap, ReportList *reports, int index_len, int *index)
2049 {
2050  Object *ob = (Object *)id;
2051 
2052  if (BKE_object_is_in_editmode(ob)) {
2053  BKE_report(reports, RPT_ERROR, "FaceMap.add(): cannot be called while object is in edit mode");
2054  return;
2055  }
2056 
2057  while (index_len--) {
2058  ED_object_facemap_face_remove(ob, fmap, *index++);
2059  }
2060 
2062 }
2063 
2064 /* generic poll functions */
2066 {
2067  return ((Object *)value.owner_id)->type == OB_LATTICE;
2068 }
2069 
2071 {
2072  return ((Object *)value.owner_id)->type == OB_CURVE;
2073 }
2074 
2076 {
2077  return ((Object *)value.owner_id)->type == OB_ARMATURE;
2078 }
2079 
2081 {
2082  return ((Object *)value.owner_id)->type == OB_MESH;
2083 }
2084 
2086 {
2087  return ((Object *)value.owner_id)->type == OB_CAMERA;
2088 }
2089 
2091 {
2092  return ((Object *)value.owner_id)->type == OB_LAMP;
2093 }
2094 
2096 {
2097  return ((Object *)value.owner_id)->type == OB_GPENCIL;
2098 }
2099 
2100 int rna_Object_use_dynamic_topology_sculpting_get(PointerRNA *ptr)
2101 {
2102  SculptSession *ss = ((Object *)ptr->owner_id)->sculpt;
2103  return (ss && ss->bm);
2104 }
2105 
2106 static void rna_object_lineart_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
2107 {
2110 }
2111 
2112 static bool mesh_symmetry_get_common(PointerRNA *ptr, const eMeshSymmetryType sym)
2113 {
2114  const Object *ob = (Object *)ptr->owner_id;
2115  if (ob->type != OB_MESH) {
2116  return false;
2117  }
2118 
2119  const Mesh *mesh = ob->data;
2120  return mesh->symmetry & sym;
2121 }
2122 
2123 static bool rna_Object_mesh_symmetry_x_get(PointerRNA *ptr)
2124 {
2125  return mesh_symmetry_get_common(ptr, ME_SYMMETRY_X);
2126 }
2127 
2128 static bool rna_Object_mesh_symmetry_y_get(PointerRNA *ptr)
2129 {
2130  return mesh_symmetry_get_common(ptr, ME_SYMMETRY_Y);
2131 }
2132 
2133 static bool rna_Object_mesh_symmetry_z_get(PointerRNA *ptr)
2134 {
2135  return mesh_symmetry_get_common(ptr, ME_SYMMETRY_Z);
2136 }
2137 
2138 static void mesh_symmetry_set_common(PointerRNA *ptr,
2139  const bool value,
2140  const eMeshSymmetryType sym)
2141 {
2142  Object *ob = (Object *)ptr->owner_id;
2143  if (ob->type != OB_MESH) {
2144  return;
2145  }
2146 
2147  Mesh *mesh = ob->data;
2148  if (value) {
2149  mesh->symmetry |= sym;
2150  }
2151  else {
2152  mesh->symmetry &= ~sym;
2153  }
2154 }
2155 
2156 static void rna_Object_mesh_symmetry_x_set(PointerRNA *ptr, bool value)
2157 {
2158  mesh_symmetry_set_common(ptr, value, ME_SYMMETRY_X);
2159 }
2160 
2161 static void rna_Object_mesh_symmetry_y_set(PointerRNA *ptr, bool value)
2162 {
2163  mesh_symmetry_set_common(ptr, value, ME_SYMMETRY_Y);
2164 }
2165 
2166 static void rna_Object_mesh_symmetry_z_set(PointerRNA *ptr, bool value)
2167 {
2168  mesh_symmetry_set_common(ptr, value, ME_SYMMETRY_Z);
2169 }
2170 
2171 static int rna_Object_mesh_symmetry_yz_editable(PointerRNA *ptr, const char **UNUSED(r_info))
2172 {
2173  const Object *ob = (Object *)ptr->owner_id;
2174  if (ob->type != OB_MESH) {
2175  return 0;
2176  }
2177 
2178  const Mesh *mesh = ob->data;
2180  /* Only X symmetry is available in weightpaint mode. */
2181  return 0;
2182  }
2183 
2184  return PROP_EDITABLE;
2185 }
2186 
2187 #else
2188 
2190 {
2191  StructRNA *srna;
2192  PropertyRNA *prop;
2193  FunctionRNA *func;
2194  PropertyRNA *parm;
2195 
2196  static const EnumPropertyItem assign_mode_items[] = {
2197  {WEIGHT_REPLACE, "REPLACE", 0, "Replace", "Replace"},
2198  {WEIGHT_ADD, "ADD", 0, "Add", "Add"},
2199  {WEIGHT_SUBTRACT, "SUBTRACT", 0, "Subtract", "Subtract"},
2200  {0, NULL, 0, NULL, NULL},
2201  };
2202 
2203  srna = RNA_def_struct(brna, "VertexGroup", NULL);
2204  RNA_def_struct_sdna(srna, "bDeformGroup");
2206  srna, "Vertex Group", "Group of vertices, used for armature deform and other purposes");
2207  RNA_def_struct_ui_icon(srna, ICON_GROUP_VERTEX);
2208 
2209  prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
2210  RNA_def_property_ui_text(prop, "Name", "Vertex group name");
2211  RNA_def_struct_name_property(srna, prop);
2212  RNA_def_property_string_funcs(prop, NULL, NULL, "rna_VertexGroup_name_set");
2213  /* update data because modifiers may use T24761. */
2215  prop, NC_GEOM | ND_DATA | NA_RENAME, "rna_Object_internal_update_data_dependency");
2216 
2217  prop = RNA_def_property(srna, "lock_weight", PROP_BOOLEAN, PROP_NONE);
2218  RNA_def_property_ui_text(prop, "", "Maintain the relative weights for the group");
2219  RNA_def_property_boolean_sdna(prop, NULL, "flag", 0);
2220  /* update data because modifiers may use T24761. */
2221  RNA_def_property_update(prop, NC_GEOM | ND_DATA | NA_RENAME, "rna_Object_internal_update_data");
2222 
2223  prop = RNA_def_property(srna, "index", PROP_INT, PROP_UNSIGNED);
2225  RNA_def_property_int_funcs(prop, "rna_VertexGroup_index_get", NULL, NULL);
2226  RNA_def_property_ui_text(prop, "Index", "Index number of the vertex group");
2227 
2228  func = RNA_def_function(srna, "add", "rna_VertexGroup_vertex_add");
2229  RNA_def_function_ui_description(func, "Add vertices to the group");
2231  /* TODO, see how array size of 0 works, this shouldn't be used */
2232  parm = RNA_def_int_array(func, "index", 1, NULL, 0, 0, "", "List of indices", 0, 0);
2234  parm = RNA_def_float(func, "weight", 0, 0.0f, 1.0f, "", "Vertex weight", 0.0f, 1.0f);
2236  parm = RNA_def_enum(func, "type", assign_mode_items, 0, "", "Vertex assign mode");
2238 
2239  func = RNA_def_function(srna, "remove", "rna_VertexGroup_vertex_remove");
2240  RNA_def_function_ui_description(func, "Remove vertices from the group");
2242  /* TODO, see how array size of 0 works, this shouldn't be used */
2243  parm = RNA_def_int_array(func, "index", 1, NULL, 0, 0, "", "List of indices", 0, 0);
2245 
2246  func = RNA_def_function(srna, "weight", "rna_VertexGroup_weight");
2247  RNA_def_function_ui_description(func, "Get a vertex weight from the group");
2249  parm = RNA_def_int(func, "index", 0, 0, INT_MAX, "Index", "The index of the vertex", 0, INT_MAX);
2251  parm = RNA_def_float(func, "weight", 0, 0.0f, 1.0f, "", "Vertex weight", 0.0f, 1.0f);
2252  RNA_def_function_return(func, parm);
2253 }
2254 
2255 static void rna_def_face_map(BlenderRNA *brna)
2256 {
2257  StructRNA *srna;
2258  PropertyRNA *prop;
2259 
2260  FunctionRNA *func;
2261  PropertyRNA *parm;
2262 
2263  srna = RNA_def_struct(brna, "FaceMap", NULL);
2264  RNA_def_struct_sdna(srna, "bFaceMap");
2266  srna, "Face Map", "Group of faces, each face can only be part of one map");
2267  RNA_def_struct_ui_icon(srna, ICON_MOD_TRIANGULATE);
2268 
2269  prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
2270  RNA_def_property_ui_text(prop, "Name", "Face map name");
2271  RNA_def_struct_name_property(srna, prop);
2272  RNA_def_property_string_funcs(prop, NULL, NULL, "rna_FaceMap_name_set");
2273  /* update data because modifiers may use T24761. */
2274  RNA_def_property_update(prop, NC_GEOM | ND_DATA | NA_RENAME, "rna_Object_internal_update_data");
2275 
2276  prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
2277  RNA_def_property_boolean_sdna(prop, NULL, "flag", SELECT);
2278  RNA_def_property_ui_text(prop, "Select", "Face map selection state (for tools to use)");
2279  /* important not to use a notifier here, creates a feedback loop! */
2280 
2281  prop = RNA_def_property(srna, "index", PROP_INT, PROP_UNSIGNED);
2283  RNA_def_property_int_funcs(prop, "rna_FaceMap_index_get", NULL, NULL);
2284  RNA_def_property_ui_text(prop, "Index", "Index number of the face map");
2285 
2286  func = RNA_def_function(srna, "add", "rna_FaceMap_face_add");
2287  RNA_def_function_ui_description(func, "Add faces to the face-map");
2289  /* TODO, see how array size of 0 works, this shouldn't be used */
2290  parm = RNA_def_int_array(func, "index", 1, NULL, 0, 0, "", "List of indices", 0, 0);
2292 
2293  func = RNA_def_function(srna, "remove", "rna_FaceMap_face_remove");
2294  RNA_def_function_ui_description(func, "Remove faces from the face-map");
2296  /* TODO, see how array size of 0 works, this shouldn't be used */
2297  parm = RNA_def_int_array(func, "index", 1, NULL, 0, 0, "", "List of indices", 0, 0);
2299 }
2300 
2302 {
2303  StructRNA *srna;
2304  PropertyRNA *prop;
2305 
2306  static const EnumPropertyItem link_items[] = {
2307  {1, "OBJECT", 0, "Object", ""},
2308  {0, "DATA", 0, "Data", ""},
2309  {0, NULL, 0, NULL, NULL},
2310  };
2311 
2312  /* NOTE: there is no MaterialSlot equivalent in DNA, so the internal
2313  * pointer data points to ob->mat + index, and we manually implement
2314  * get/set for the properties. */
2315 
2316  srna = RNA_def_struct(brna, "MaterialSlot", NULL);
2317  RNA_def_struct_ui_text(srna, "Material Slot", "Material slot in an object");
2318  RNA_def_struct_ui_icon(srna, ICON_MATERIAL_DATA);
2319 
2321 
2322  /* WARNING! Order is crucial for override to work properly here... :/
2323  * 'link' must come before material pointer,
2324  * since it defines where (in object or obdata) that one is set! */
2325  prop = RNA_def_property(srna, "link", PROP_ENUM, PROP_NONE);
2326  RNA_def_property_enum_items(prop, link_items);
2328  prop, "rna_MaterialSlot_link_get", "rna_MaterialSlot_link_set", NULL);
2329  RNA_def_property_ui_text(prop, "Link", "Link material to object or the object's data");
2330  RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_MaterialSlot_update");
2331 
2332  prop = RNA_def_property(srna, "material", PROP_POINTER, PROP_NONE);
2333  RNA_def_property_struct_type(prop, "Material");
2335  RNA_def_property_editable_func(prop, "rna_MaterialSlot_material_editable");
2337  "rna_MaterialSlot_material_get",
2338  "rna_MaterialSlot_material_set",
2339  NULL,
2340  "rna_MaterialSlot_material_poll");
2341  RNA_def_property_ui_text(prop, "Material", "Material data-block used by this material slot");
2342  RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_MaterialSlot_update");
2343 
2344  prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
2346  prop, "rna_MaterialSlot_name_get", "rna_MaterialSlot_name_length", NULL);
2347  RNA_def_property_ui_text(prop, "Name", "Material slot name");
2351  RNA_def_struct_name_property(srna, prop);
2352 
2354 
2355  RNA_def_struct_path_func(srna, "rna_MaterialSlot_path");
2356 }
2357 
2359 {
2360  StructRNA *srna;
2361  PropertyRNA *prop;
2362 
2363  FunctionRNA *func;
2364  PropertyRNA *parm;
2365 
2366  RNA_def_property_srna(cprop, "ObjectConstraints");
2367  srna = RNA_def_struct(brna, "ObjectConstraints", NULL);
2368  RNA_def_struct_sdna(srna, "Object");
2369  RNA_def_struct_ui_text(srna, "Object Constraints", "Collection of object constraints");
2370 
2371  /* Collection active property */
2372  prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
2373  RNA_def_property_struct_type(prop, "Constraint");
2375  prop, "rna_Object_active_constraint_get", "rna_Object_active_constraint_set", NULL, NULL);
2377  RNA_def_property_ui_text(prop, "Active Constraint", "Active Object constraint");
2378 
2379  /* Constraint collection */
2380  func = RNA_def_function(srna, "new", "rna_Object_constraints_new");
2381  RNA_def_function_ui_description(func, "Add a new constraint to this object");
2383  /* object to add */
2384  parm = RNA_def_enum(
2385  func, "type", rna_enum_constraint_type_items, 1, "", "Constraint type to add");
2387  /* return type */
2388  parm = RNA_def_pointer(func, "constraint", "Constraint", "", "New constraint");
2389  RNA_def_function_return(func, parm);
2390 
2391  func = RNA_def_function(srna, "remove", "rna_Object_constraints_remove");
2392  RNA_def_function_ui_description(func, "Remove a constraint from this object");
2394  /* constraint to remove */
2395  parm = RNA_def_pointer(func, "constraint", "Constraint", "", "Removed constraint");
2398 
2399  func = RNA_def_function(srna, "clear", "rna_Object_constraints_clear");
2401  RNA_def_function_ui_description(func, "Remove all constraint from this object");
2402 
2403  func = RNA_def_function(srna, "move", "rna_Object_constraints_move");
2404  RNA_def_function_ui_description(func, "Move a constraint to a different position");
2406  parm = RNA_def_int(
2407  func, "from_index", -1, INT_MIN, INT_MAX, "From Index", "Index to move", 0, 10000);
2409  parm = RNA_def_int(func, "to_index", -1, INT_MIN, INT_MAX, "To Index", "Target index", 0, 10000);
2411 
2412  func = RNA_def_function(srna, "copy", "rna_Object_constraints_copy");
2413  RNA_def_function_ui_description(func, "Add a new constraint that is a copy of the given one");
2415  /* constraint to copy */
2416  parm = RNA_def_pointer(func,
2417  "constraint",
2418  "Constraint",
2419  "",
2420  "Constraint to copy - may belong to a different object");
2423  /* return type */
2424  parm = RNA_def_pointer(func, "new_constraint", "Constraint", "", "New constraint");
2425  RNA_def_function_return(func, parm);
2426 }
2427 
2428 /* object.modifiers */
2430 {
2431  StructRNA *srna;
2432 
2433  FunctionRNA *func;
2434  PropertyRNA *parm;
2435  PropertyRNA *prop;
2436 
2437  RNA_def_property_srna(cprop, "ObjectModifiers");
2438  srna = RNA_def_struct(brna, "ObjectModifiers", NULL);
2439  RNA_def_struct_sdna(srna, "Object");
2440  RNA_def_struct_ui_text(srna, "Object Modifiers", "Collection of object modifiers");
2441 
2442 # if 0
2443  prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
2444  RNA_def_property_struct_type(prop, "EditBone");
2445  RNA_def_property_pointer_sdna(prop, NULL, "act_edbone");
2447  RNA_def_property_ui_text(prop, "Active EditBone", "Armatures active edit bone");
2448  /*RNA_def_property_update(prop, 0, "rna_Armature_act_editbone_update"); */
2449  RNA_def_property_pointer_funcs(prop, NULL, "rna_Armature_act_edit_bone_set", NULL, NULL);
2450 
2451  /* todo, redraw */
2452 /* RNA_def_property_collection_active(prop, prop_act); */
2453 # endif
2454 
2455  /* add modifier */
2456  func = RNA_def_function(srna, "new", "rna_Object_modifier_new");
2458  RNA_def_function_ui_description(func, "Add a new modifier");
2459  parm = RNA_def_string(func, "name", "Name", 0, "", "New name for the modifier");
2461  /* modifier to add */
2462  parm = RNA_def_enum(
2463  func, "type", rna_enum_object_modifier_type_items, 1, "", "Modifier type to add");
2465  /* return type */
2466  parm = RNA_def_pointer(func, "modifier", "Modifier", "", "Newly created modifier");
2467  RNA_def_function_return(func, parm);
2468 
2469  /* remove modifier */
2470  func = RNA_def_function(srna, "remove", "rna_Object_modifier_remove");
2472  RNA_def_function_ui_description(func, "Remove an existing modifier from the object");
2473  /* modifier to remove */
2474  parm = RNA_def_pointer(func, "modifier", "Modifier", "", "Modifier to remove");
2477 
2478  /* clear all modifiers */
2479  func = RNA_def_function(srna, "clear", "rna_Object_modifier_clear");
2481  RNA_def_function_ui_description(func, "Remove all modifiers from the object");
2482 
2483  /* Active modifier. */
2484  prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
2485  RNA_def_property_struct_type(prop, "Modifier");
2487  prop, "rna_Object_active_modifier_get", "rna_Object_active_modifier_set", NULL, NULL);
2491  RNA_def_property_ui_text(prop, "Active Modifier", "The active modifier in the list");
2493 }
2494 
2495 /* object.grease_pencil_modifiers */
2497 {
2498  StructRNA *srna;
2499 
2500  FunctionRNA *func;
2501  PropertyRNA *parm;
2502 
2503  RNA_def_property_srna(cprop, "ObjectGpencilModifiers");
2504  srna = RNA_def_struct(brna, "ObjectGpencilModifiers", NULL);
2505  RNA_def_struct_sdna(srna, "Object");
2507  srna, "Object Grease Pencil Modifiers", "Collection of object grease pencil modifiers");
2508 
2509  /* add greasepencil modifier */
2510  func = RNA_def_function(srna, "new", "rna_Object_greasepencil_modifier_new");
2512  RNA_def_function_ui_description(func, "Add a new greasepencil_modifier");
2513  parm = RNA_def_string(func, "name", "Name", 0, "", "New name for the greasepencil_modifier");
2515  /* greasepencil_modifier to add */
2516  parm = RNA_def_enum(func,
2517  "type",
2519  1,
2520  "",
2521  "Modifier type to add");
2523  /* return type */
2524  parm = RNA_def_pointer(
2525  func, "greasepencil_modifier", "GpencilModifier", "", "Newly created modifier");
2526  RNA_def_function_return(func, parm);
2527 
2528  /* remove greasepencil_modifier */
2529  func = RNA_def_function(srna, "remove", "rna_Object_greasepencil_modifier_remove");
2532  "Remove an existing greasepencil_modifier from the object");
2533  /* greasepencil_modifier to remove */
2534  parm = RNA_def_pointer(
2535  func, "greasepencil_modifier", "GpencilModifier", "", "Modifier to remove");
2538 
2539  /* clear all greasepencil modifiers */
2540  func = RNA_def_function(srna, "clear", "rna_Object_greasepencil_modifier_clear");
2542  RNA_def_function_ui_description(func, "Remove all grease pencil modifiers from the object");
2543 }
2544 
2545 /* object.shaderfxs */
2547 {
2548  StructRNA *srna;
2549 
2550  FunctionRNA *func;
2551  PropertyRNA *parm;
2552 
2553  RNA_def_property_srna(cprop, "ObjectShaderFx");
2554  srna = RNA_def_struct(brna, "ObjectShaderFx", NULL);
2555  RNA_def_struct_sdna(srna, "Object");
2556  RNA_def_struct_ui_text(srna, "Object Shader Effects", "Collection of object effects");
2557 
2558  /* add shader_fx */
2559  func = RNA_def_function(srna, "new", "rna_Object_shaderfx_new");
2561  RNA_def_function_ui_description(func, "Add a new shader fx");
2562  parm = RNA_def_string(func, "name", "Name", 0, "", "New name for the effect");
2564  /* shader to add */
2565  parm = RNA_def_enum(
2566  func, "type", rna_enum_object_shaderfx_type_items, 1, "", "Effect type to add");
2568  /* return type */
2569  parm = RNA_def_pointer(func, "shader_fx", "ShaderFx", "", "Newly created effect");
2570  RNA_def_function_return(func, parm);
2571 
2572  /* remove shader_fx */
2573  func = RNA_def_function(srna, "remove", "rna_Object_shaderfx_remove");
2575  RNA_def_function_ui_description(func, "Remove an existing effect from the object");
2576  /* shader to remove */
2577  parm = RNA_def_pointer(func, "shader_fx", "ShaderFx", "", "Effect to remove");
2580 
2581  /* clear all shader fx */
2582  func = RNA_def_function(srna, "clear", "rna_Object_shaderfx_clear");
2584  RNA_def_function_ui_description(func, "Remove all effects from the object");
2585 }
2586 
2587 /* object.particle_systems */
2589 {
2590  StructRNA *srna;
2591 
2592  PropertyRNA *prop;
2593 
2594  /* FunctionRNA *func; */
2595  /* PropertyRNA *parm; */
2596 
2597  RNA_def_property_srna(cprop, "ParticleSystems");
2598  srna = RNA_def_struct(brna, "ParticleSystems", NULL);
2599  RNA_def_struct_sdna(srna, "Object");
2600  RNA_def_struct_ui_text(srna, "Particle Systems", "Collection of particle systems");
2601 
2602  prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
2603  RNA_def_property_struct_type(prop, "ParticleSystem");
2604  RNA_def_property_pointer_funcs(prop, "rna_Object_active_particle_system_get", NULL, NULL, NULL);
2606  prop, "Active Particle System", "Active particle system being displayed");
2608 
2609  prop = RNA_def_property(srna, "active_index", PROP_INT, PROP_UNSIGNED);
2612  "rna_Object_active_particle_system_index_get",
2613  "rna_Object_active_particle_system_index_set",
2614  "rna_Object_active_particle_system_index_range");
2616  prop, "Active Particle System Index", "Index of active particle system slot");
2617  RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_particle_update");
2618 }
2619 
2620 /* object.vertex_groups */
2622 {
2623  StructRNA *srna;
2624 
2625  PropertyRNA *prop;
2626 
2627  FunctionRNA *func;
2628  PropertyRNA *parm;
2629 
2630  RNA_def_property_srna(cprop, "VertexGroups");
2631  srna = RNA_def_struct(brna, "VertexGroups", NULL);
2632  RNA_def_struct_sdna(srna, "Object");
2633  RNA_def_struct_ui_text(srna, "Vertex Groups", "Collection of vertex groups");
2634 
2635  prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
2636  RNA_def_property_struct_type(prop, "VertexGroup");
2638  "rna_Object_active_vertex_group_get",
2639  "rna_Object_active_vertex_group_set",
2640  NULL,
2641  NULL);
2643  RNA_def_property_ui_text(prop, "Active Vertex Group", "Vertex groups of the object");
2644  RNA_def_property_update(prop, NC_GEOM | ND_DATA, "rna_Object_internal_update_data");
2645 
2646  prop = RNA_def_property(srna, "active_index", PROP_INT, PROP_UNSIGNED);
2648  RNA_def_property_int_sdna(prop, NULL, "actdef");
2650  "rna_Object_active_vertex_group_index_get",
2651  "rna_Object_active_vertex_group_index_set",
2652  "rna_Object_active_vertex_group_index_range");
2654  prop, "Active Vertex Group Index", "Active index in vertex group array");
2655  RNA_def_property_update(prop, NC_GEOM | ND_DATA, "rna_Object_internal_update_data");
2656 
2657  /* vertex groups */ /* add_vertex_group */
2658  func = RNA_def_function(srna, "new", "rna_Object_vgroup_new");
2660  RNA_def_function_ui_description(func, "Add vertex group to object");
2661  RNA_def_string(func, "name", "Group", 0, "", "Vertex group name"); /* optional */
2662  parm = RNA_def_pointer(func, "group", "VertexGroup", "", "New vertex group");
2663  RNA_def_function_return(func, parm);
2664 
2665  func = RNA_def_function(srna, "remove", "rna_Object_vgroup_remove");
2667  RNA_def_function_ui_description(func, "Delete vertex group from object");
2668  parm = RNA_def_pointer(func, "group", "VertexGroup", "", "Vertex group to remove");
2671 
2672  func = RNA_def_function(srna, "clear", "rna_Object_vgroup_clear");
2674  RNA_def_function_ui_description(func, "Delete all vertex groups from object");
2675 }
2676 
2677 /* object.face_maps */
2679 {
2680  StructRNA *srna;
2681 
2682  PropertyRNA *prop;
2683 
2684  FunctionRNA *func;
2685  PropertyRNA *parm;
2686 
2687  RNA_def_property_srna(cprop, "FaceMaps");
2688  srna = RNA_def_struct(brna, "FaceMaps", NULL);
2689  RNA_def_struct_sdna(srna, "Object");
2690  RNA_def_struct_ui_text(srna, "Face Maps", "Collection of face maps");
2691 
2692  prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
2693  RNA_def_property_struct_type(prop, "FaceMap");
2695  prop, "rna_Object_active_face_map_get", "rna_Object_active_face_map_set", NULL, NULL);
2696  RNA_def_property_ui_text(prop, "Active Face Map", "Face maps of the object");
2697  RNA_def_property_update(prop, NC_GEOM | ND_DATA, "rna_Object_internal_update_data");
2698 
2699  prop = RNA_def_property(srna, "active_index", PROP_INT, PROP_UNSIGNED);
2701  RNA_def_property_int_sdna(prop, NULL, "actfmap");
2703  "rna_Object_active_face_map_index_get",
2704  "rna_Object_active_face_map_index_set",
2705  "rna_Object_active_face_map_index_range");
2706  RNA_def_property_ui_text(prop, "Active Face Map Index", "Active index in face map array");
2707  RNA_def_property_update(prop, NC_GEOM | ND_DATA, "rna_Object_internal_update_data");
2708 
2709  /* face maps */ /* add_face_map */
2710  func = RNA_def_function(srna, "new", "rna_Object_fmap_new");
2711  RNA_def_function_ui_description(func, "Add face map to object");
2712  RNA_def_string(func, "name", "Map", 0, "", "face map name"); /* optional */
2713  parm = RNA_def_pointer(func, "fmap", "FaceMap", "", "New face map");
2714  RNA_def_function_return(func, parm);
2715 
2716  func = RNA_def_function(srna, "remove", "rna_Object_fmap_remove");
2718  RNA_def_function_ui_description(func, "Delete vertex group from object");
2719  parm = RNA_def_pointer(func, "group", "FaceMap", "", "Face map to remove");
2722 
2723  func = RNA_def_function(srna, "clear", "rna_Object_fmap_clear");
2724  RNA_def_function_ui_description(func, "Delete all vertex groups from object");
2725 }
2726 
2728 {
2729  StructRNA *srna;
2730  PropertyRNA *prop;
2731 
2732  srna = RNA_def_struct(brna, "ObjectDisplay", NULL);
2733  RNA_def_struct_ui_text(srna, "Object Display", "Object display settings for 3D viewport");
2734  RNA_def_struct_sdna(srna, "Object");
2735  RNA_def_struct_nested(brna, srna, "Object");
2736  RNA_def_struct_path_func(srna, "rna_ObjectDisplay_path");
2737 
2739 
2740  prop = RNA_def_property(srna, "show_shadows", PROP_BOOLEAN, PROP_NONE);
2743  RNA_def_property_ui_text(prop, "Shadow", "Object cast shadows in the 3D viewport");
2745 
2747 }
2748 
2750 {
2751  StructRNA *srna;
2752  PropertyRNA *prop;
2753 
2754  static EnumPropertyItem prop_feature_line_usage_items[] = {
2755  {OBJECT_LRT_INHERIT, "INHERIT", 0, "Inherit", "Use settings from the parent collection"},
2757  "INCLUDE",
2758  0,
2759  "Include",
2760  "Generate feature lines for this object's data"},
2762  "OCCLUSION_ONLY",
2763  0,
2764  "Occlusion Only",
2765  "Only use the object data to produce occlusion"},
2767  "EXCLUDE",
2768  0,
2769  "Exclude",
2770  "Don't use this object for Line Art rendering"},
2772  "INTERSECTION_ONLY",
2773  0,
2774  "Intersection Only",
2775  "Only generate intersection lines for this collection"},
2777  "NO_INTERSECTION",
2778  0,
2779  "No Intersection",
2780  "Include this object but do not generate intersection lines"},
2781  {0, NULL, 0, NULL, NULL},
2782  };
2783 
2784  srna = RNA_def_struct(brna, "ObjectLineArt", NULL);
2785  RNA_def_struct_ui_text(srna, "Object Line Art", "Object line art settings");
2786  RNA_def_struct_sdna(srna, "ObjectLineArt");
2787 
2788  prop = RNA_def_property(srna, "usage", PROP_ENUM, PROP_NONE);
2789  RNA_def_property_enum_items(prop, prop_feature_line_usage_items);
2790  RNA_def_property_ui_text(prop, "Usage", "How to use this object in line art calculation");
2791  RNA_def_property_update(prop, 0, "rna_object_lineart_update");
2792 
2793  prop = RNA_def_property(srna, "use_crease_override", PROP_BOOLEAN, PROP_NONE);
2796  prop, "Use Crease", "Use this object's crease setting to overwrite scene global");
2797  RNA_def_property_update(prop, 0, "rna_object_lineart_update");
2798 
2799  prop = RNA_def_property(srna, "crease_threshold", PROP_FLOAT, PROP_ANGLE);
2800  RNA_def_property_range(prop, 0, DEG2RAD(180.0f));
2801  RNA_def_property_ui_range(prop, 0.0f, DEG2RAD(180.0f), 0.01f, 1);
2802  RNA_def_property_ui_text(prop, "Crease", "Angles smaller than this will be treated as creases");
2803  RNA_def_property_update(prop, 0, "rna_object_lineart_update");
2804 }
2805 
2806 static void rna_def_object(BlenderRNA *brna)
2807 {
2808  StructRNA *srna;
2809  PropertyRNA *prop;
2810 
2811  static const EnumPropertyItem up_items[] = {
2812  {OB_POSX, "X", 0, "X", ""},
2813  {OB_POSY, "Y", 0, "Y", ""},
2814  {OB_POSZ, "Z", 0, "Z", ""},
2815  {0, NULL, 0, NULL, NULL},
2816  };
2817 
2818  static const EnumPropertyItem drawtype_items[] = {
2819  {OB_BOUNDBOX, "BOUNDS", 0, "Bounds", "Display the bounds of the object"},
2820  {OB_WIRE, "WIRE", 0, "Wire", "Display the object as a wireframe"},
2821  {OB_SOLID,
2822  "SOLID",
2823  0,
2824  "Solid",
2825  "Display the object as a solid (if solid drawing is enabled in the viewport)"},
2826  {OB_TEXTURE,
2827  "TEXTURED",
2828  0,
2829  "Textured",
2830  "Display the object with textures (if textures are enabled in the viewport)"},
2831  {0, NULL, 0, NULL, NULL},
2832  };
2833 
2834  static const EnumPropertyItem boundtype_items[] = {
2835  {OB_BOUND_BOX, "BOX", 0, "Box", "Display bounds as box"},
2836  {OB_BOUND_SPHERE, "SPHERE", 0, "Sphere", "Display bounds as sphere"},
2837  {OB_BOUND_CYLINDER, "CYLINDER", 0, "Cylinder", "Display bounds as cylinder"},
2838  {OB_BOUND_CONE, "CONE", 0, "Cone", "Display bounds as cone"},
2839  {OB_BOUND_CAPSULE, "CAPSULE", 0, "Capsule", "Display bounds as capsule"},
2840  {0, NULL, 0, NULL, NULL},
2841  };
2842 
2843  static int boundbox_dimsize[] = {8, 3};
2844 
2845  srna = RNA_def_struct(brna, "Object", "ID");
2846  RNA_def_struct_ui_text(srna, "Object", "Object data-block defining an object in a scene");
2848  RNA_def_struct_ui_icon(srna, ICON_OBJECT_DATA);
2849 
2851 
2852  prop = RNA_def_property(srna, "data", PROP_POINTER, PROP_NONE);
2853  RNA_def_property_struct_type(prop, "ID");
2855  prop, NULL, "rna_Object_data_set", "rna_Object_data_typef", "rna_Object_data_poll");
2857  RNA_def_property_ui_text(prop, "Data", "Object data");
2858  RNA_def_property_update(prop, 0, "rna_Object_data_update");
2859 
2860  prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
2861  RNA_def_property_enum_sdna(prop, NULL, "type");
2865  RNA_def_property_ui_text(prop, "Type", "Type of object");
2867 
2868  prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
2869  RNA_def_property_enum_sdna(prop, NULL, "mode");
2872  RNA_def_property_ui_text(prop, "Mode", "Object interaction mode");
2873 
2874  /* for data access */
2875  prop = RNA_def_property(srna, "bound_box", PROP_FLOAT, PROP_NONE);
2876  RNA_def_property_multi_array(prop, 2, boundbox_dimsize);
2880  RNA_def_property_float_funcs(prop, "rna_Object_boundbox_get", NULL, NULL);
2882  prop,
2883  "Bounding Box",
2884  "Object's bounding box in object-space coordinates, all values are -1.0 when "
2885  "not available");
2886 
2887  /* parent */
2888  prop = RNA_def_property(srna, "parent", PROP_POINTER, PROP_NONE);
2889  RNA_def_property_pointer_funcs(prop, NULL, "rna_Object_parent_set", NULL, NULL);
2891  RNA_def_property_override_funcs(prop, NULL, NULL, "rna_Object_parent_override_apply");
2892  RNA_def_property_ui_text(prop, "Parent", "Parent object");
2893  RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_dependency_update");
2894 
2895  prop = RNA_def_property(srna, "parent_type", PROP_ENUM, PROP_NONE);
2896  RNA_def_property_enum_bitflag_sdna(prop, NULL, "partype");
2899  prop, NULL, "rna_Object_parent_type_set", "rna_Object_parent_type_itemf");
2900  RNA_def_property_ui_text(prop, "Parent Type", "Type of parent relation");
2901  RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_dependency_update");
2902 
2903  prop = RNA_def_property(srna, "parent_vertices", PROP_INT, PROP_UNSIGNED);
2904  RNA_def_property_int_sdna(prop, NULL, "par1");
2905  RNA_def_property_array(prop, 3);
2907  prop, "Parent Vertices", "Indices of vertices in case of a vertex parenting relation");
2908  RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_internal_update");
2909 
2910  prop = RNA_def_property(srna, "parent_bone", PROP_STRING, PROP_NONE);
2911  RNA_def_property_string_sdna(prop, NULL, "parsubstr");
2912  RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Object_parent_bone_set");
2914  prop, "Parent Bone", "Name of parent bone in case of a bone parenting relation");
2915  RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_dependency_update");
2916 
2917  prop = RNA_def_property(srna, "use_camera_lock_parent", PROP_BOOLEAN, PROP_NONE);
2921  "Camera Parent Lock",
2922  "View Lock 3D viewport camera transformation affects the object's "
2923  "parent instead");
2924  RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_internal_update");
2925 
2926  /* Track and Up flags */
2927  /* XXX: these have been saved here for a bit longer (after old track was removed),
2928  * since some other tools still refer to this */
2929  prop = RNA_def_property(srna, "track_axis", PROP_ENUM, PROP_NONE);
2930  RNA_def_property_enum_sdna(prop, NULL, "trackflag");
2933  prop,
2934  "Track Axis",
2935  "Axis that points in the 'forward' direction (applies to Instance Vertices when "
2936  "Align to Vertex Normal is enabled)");
2937  RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_internal_update");
2938 
2939  prop = RNA_def_property(srna, "up_axis", PROP_ENUM, PROP_NONE);
2940  RNA_def_property_enum_sdna(prop, NULL, "upflag");
2941  RNA_def_property_enum_items(prop, up_items);
2943  prop,
2944  "Up Axis",
2945  "Axis that points in the upward direction (applies to Instance Vertices when "
2946  "Align to Vertex Normal is enabled)");
2947  RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_internal_update");
2948 
2949  /* proxy */
2950  prop = RNA_def_property(srna, "proxy", PROP_POINTER, PROP_NONE);
2953  RNA_def_property_ui_text(prop, "Proxy", "Library object this proxy object controls");
2954 
2955  prop = RNA_def_property(srna, "proxy_collection", PROP_POINTER, PROP_NONE);
2956  RNA_def_property_pointer_sdna(prop, NULL, "proxy_group");
2960  prop, "Proxy Collection", "Library collection duplicator object this proxy object controls");
2961 
2962  /* materials */
2963  prop = RNA_def_property(srna, "material_slots", PROP_COLLECTION, PROP_NONE);
2964  RNA_def_property_collection_sdna(prop, NULL, "mat", "totcol");
2965  RNA_def_property_struct_type(prop, "MaterialSlot");
2967  /* don't dereference pointer! */
2969  prop, NULL, NULL, NULL, "rna_iterator_array_get", NULL, NULL, NULL, NULL);
2970  RNA_def_property_ui_text(prop, "Material Slots", "Material slots in the object");
2971 
2972  prop = RNA_def_property(srna, "active_material", PROP_POINTER, PROP_NONE);
2973  RNA_def_property_struct_type(prop, "Material");
2975  "rna_Object_active_material_get",
2976  "rna_Object_active_material_set",
2977  NULL,
2978  "rna_MaterialSlot_material_poll");
2980  RNA_def_property_editable_func(prop, "rna_Object_active_material_editable");
2981  RNA_def_property_ui_text(prop, "Active Material", "Active material being displayed");
2982  RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_MaterialSlot_update");
2983 
2984  prop = RNA_def_property(srna, "active_material_index", PROP_INT, PROP_UNSIGNED);
2985  RNA_def_property_int_sdna(prop, NULL, "actcol");
2988  "rna_Object_active_material_index_get",
2989  "rna_Object_active_material_index_set",
2990  "rna_Object_active_material_index_range");
2991  RNA_def_property_ui_text(prop, "Active Material Index", "Index of active material slot");
2992  RNA_def_property_update(prop, NC_MATERIAL | ND_SHADING_LINKS, "rna_MaterialIndex_update");
2993 
2994  /* transform */
2995  prop = RNA_def_property(srna, "location", PROP_FLOAT, PROP_TRANSLATION);
2996  RNA_def_property_float_sdna(prop, NULL, "loc");
2997  RNA_def_property_editable_array_func(prop, "rna_Object_location_editable");
2998  RNA_def_property_ui_text(prop, "Location", "Location of the object");
2999  RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, RNA_TRANSLATION_PREC_DEFAULT);
3000  RNA_def_property_update(prop, NC_OBJECT | ND_TRANSFORM, "rna_Object_internal_update");
3001 
3002  prop = RNA_def_property(srna, "rotation_quaternion", PROP_FLOAT, PROP_QUATERNION);
3003  RNA_def_property_float_sdna(prop, NULL, "quat");
3004  RNA_def_property_editable_array_func(prop, "rna_Object_rotation_4d_editable");
3005  RNA_def_property_ui_text(prop, "Quaternion Rotation", "Rotation in Quaternions");
3006  RNA_def_property_update(prop, NC_OBJECT | ND_TRANSFORM, "rna_Object_internal_update");
3007 
3008  /* XXX: for axis-angle, it would have been nice to have 2 separate fields for UI purposes, but
3009  * having a single one is better for Keyframing and other property-management situations...
3010  */
3011  prop = RNA_def_property(srna, "rotation_axis_angle", PROP_FLOAT, PROP_AXISANGLE);
3012  RNA_def_property_array(prop, 4);
3014  prop, "rna_Object_rotation_axis_angle_get", "rna_Object_rotation_axis_angle_set", NULL);
3015  RNA_def_property_editable_array_func(prop, "rna_Object_rotation_4d_editable");
3018  prop, "Axis-Angle Rotation", "Angle of Rotation for Axis-Angle rotation representation");
3019  RNA_def_property_update(prop, NC_OBJECT | ND_TRANSFORM, "rna_Object_internal_update");
3020 
3021  prop = RNA_def_property(srna, "rotation_euler", PROP_FLOAT, PROP_EULER);
3022  RNA_def_property_float_sdna(prop, NULL, "rot");
3023  RNA_def_property_editable_array_func(prop, "rna_Object_rotation_euler_editable");
3024  RNA_def_property_ui_text(prop, "Euler Rotation", "Rotation in Eulers");
3025  RNA_def_property_update(prop, NC_OBJECT | ND_TRANSFORM, "rna_Object_internal_update");
3026 
3027  prop = RNA_def_property(srna, "rotation_mode", PROP_ENUM, PROP_NONE);
3028  RNA_def_property_enum_sdna(prop, NULL, "rotmode");
3030  RNA_def_property_enum_funcs(prop, NULL, "rna_Object_rotation_mode_set", NULL);
3031  RNA_def_property_ui_text(prop, "Rotation Mode", "");
3032  RNA_def_property_update(prop, NC_OBJECT | ND_TRANSFORM, "rna_Object_internal_update");
3033 
3034  prop = RNA_def_property(srna, "scale", PROP_FLOAT, PROP_XYZ);
3036  RNA_def_property_editable_array_func(prop, "rna_Object_scale_editable");
3037  RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, 3);
3038  RNA_def_property_ui_text(prop, "Scale", "Scaling of the object");
3039  RNA_def_property_update(prop, NC_OBJECT | ND_TRANSFORM, "rna_Object_internal_update");
3040 
3041  prop = RNA_def_property(srna, "dimensions", PROP_FLOAT, PROP_XYZ_LENGTH);
3042  RNA_def_property_array(prop, 3);
3043  /* Only as convenient helper for py API, and conflicts with animating scale. */
3048  prop, "rna_Object_dimensions_get", "rna_Object_dimensions_set", NULL);
3051  "Dimensions",
3052  "Absolute bounding box dimensions of the object.\n"
3053  "Warning: Assigning to it or its members multiple consecutive times "
3054  "will not work correctly, as this needs up-to-date evaluated data");
3055  RNA_def_property_update(prop, NC_OBJECT | ND_TRANSFORM, "rna_Object_internal_update");
3056 
3057  /* delta transforms */
3058  prop = RNA_def_property(srna, "delta_location", PROP_FLOAT, PROP_TRANSLATION);
3059  RNA_def_property_float_sdna(prop, NULL, "dloc");
3061  prop, "Delta Location", "Extra translation added to the location of the object");
3062  RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, RNA_TRANSLATION_PREC_DEFAULT);
3063  RNA_def_property_update(prop, NC_OBJECT | ND_TRANSFORM, "rna_Object_internal_update");
3064 
3065  prop = RNA_def_property(srna, "delta_rotation_euler", PROP_FLOAT, PROP_EULER);
3066  RNA_def_property_float_sdna(prop, NULL, "drot");
3068  prop,
3069  "Delta Rotation (Euler)",
3070  "Extra rotation added to the rotation of the object (when using Euler rotations)");
3071  RNA_def_property_update(prop, NC_OBJECT | ND_TRANSFORM, "rna_Object_internal_update");
3072 
3073  prop = RNA_def_property(srna, "delta_rotation_quaternion", PROP_FLOAT, PROP_QUATERNION);
3074  RNA_def_property_float_sdna(prop, NULL, "dquat");
3076  prop,
3077  "Delta Rotation (Quaternion)",
3078  "Extra rotation added to the rotation of the object (when using Quaternion rotations)");
3079  RNA_def_property_update(prop, NC_OBJECT | ND_TRANSFORM, "rna_Object_internal_update");
3080 
3081 # if 0 /* XXX not supported well yet... */
3082  prop = RNA_def_property(srna, "delta_rotation_axis_angle", PROP_FLOAT, PROP_AXISANGLE);
3083  /* FIXME: this is not a single field any more! (drotAxis and drotAngle) */
3084  RNA_def_property_float_sdna(prop, NULL, "dquat");
3087  prop,
3088  "Delta Rotation (Axis Angle)",
3089  "Extra rotation added to the rotation of the object (when using Axis-Angle rotations)");
3090  RNA_def_property_update(prop, NC_OBJECT | ND_TRANSFORM, "rna_Object_internal_update");
3091 # endif
3092 
3093  prop = RNA_def_property(srna, "delta_scale", PROP_FLOAT, PROP_XYZ);
3094  RNA_def_property_float_sdna(prop, NULL, "dscale");
3096  RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, 3);
3097  RNA_def_property_ui_text(prop, "Delta Scale", "Extra scaling added to the scale of the object");
3098  RNA_def_property_update(prop, NC_OBJECT | ND_TRANSFORM, "rna_Object_internal_update");
3099 
3100  /* transform locks */
3101  prop = RNA_def_property(srna, "lock_location", PROP_BOOLEAN, PROP_NONE);
3102  RNA_def_property_boolean_sdna(prop, NULL, "protectflag", OB_LOCK_LOCX);
3103  RNA_def_property_array(prop, 3);
3104  RNA_def_property_ui_text(prop, "Lock Location", "Lock editing of location when transforming");
3105  RNA_def_property_ui_icon(prop, ICON_UNLOCKED, 1);
3106  RNA_def_property_update(prop, NC_OBJECT | ND_TRANSFORM, "rna_Object_internal_update");
3107 
3108  prop = RNA_def_property(srna, "lock_rotation", PROP_BOOLEAN, PROP_NONE);
3109  RNA_def_property_boolean_sdna(prop, NULL, "protectflag", OB_LOCK_ROTX);
3110  RNA_def_property_array(prop, 3);
3111  RNA_def_property_ui_text(prop, "Lock Rotation", "Lock editing of rotation when transforming");
3112  RNA_def_property_ui_icon(prop, ICON_UNLOCKED, 1);
3113  RNA_def_property_update(prop, NC_OBJECT | ND_TRANSFORM, "rna_Object_internal_update");
3114 
3115  /* XXX this is sub-optimal - it really should be included above,
3116  * but due to technical reasons we can't do this! */
3117  prop = RNA_def_property(srna, "lock_rotation_w", PROP_BOOLEAN, PROP_NONE);
3118  RNA_def_property_boolean_sdna(prop, NULL, "protectflag", OB_LOCK_ROTW);
3119  RNA_def_property_ui_icon(prop, ICON_UNLOCKED, 1);
3121  prop,
3122  "Lock Rotation (4D Angle)",
3123  "Lock editing of 'angle' component of four-component rotations when transforming");
3124  /* XXX this needs a better name */
3125  prop = RNA_def_property(srna, "lock_rotations_4d", PROP_BOOLEAN, PROP_NONE);
3126  RNA_def_property_boolean_sdna(prop, NULL, "protectflag", OB_LOCK_ROT4D);
3128  prop,
3129  "Lock Rotations (4D)",
3130  "Lock editing of four component rotations by components (instead of as Eulers)");
3131 
3132  prop = RNA_def_property(srna, "lock_scale", PROP_BOOLEAN, PROP_NONE);
3133  RNA_def_property_boolean_sdna(prop, NULL, "protectflag", OB_LOCK_SCALEX);
3134  RNA_def_property_array(prop, 3);
3135  RNA_def_property_ui_text(prop, "Lock Scale", "Lock editing of scale when transforming");
3136  RNA_def_property_ui_icon(prop, ICON_UNLOCKED, 1);
3137  RNA_def_property_update(prop, NC_OBJECT | ND_TRANSFORM, "rna_Object_internal_update");
3138 
3139  /* matrix */
3140  prop = RNA_def_property(srna, "matrix_world", PROP_FLOAT, PROP_MATRIX);
3141  RNA_def_property_float_sdna(prop, NULL, "obmat");
3146  RNA_def_property_ui_text(prop, "Matrix World", "Worldspace transformation matrix");
3147  RNA_def_property_update(prop, NC_OBJECT | ND_TRANSFORM, "rna_Object_matrix_world_update");
3148 
3149  prop = RNA_def_property(srna, "matrix_local", PROP_FLOAT, PROP_MATRIX);
3155  prop,
3156  "Local Matrix",
3157  "Parent relative transformation matrix.\n"
3158  "Warning: Only takes into account object parenting, so e.g. in case of bone parenting "
3159  "you get a matrix relative to the Armature object, not to the actual parent bone");
3161  prop, "rna_Object_matrix_local_get", "rna_Object_matrix_local_set", NULL);
3162  RNA_def_property_update(prop, NC_OBJECT | ND_TRANSFORM, "rna_Object_internal_update");
3163 
3164  prop = RNA_def_property(srna, "matrix_basis", PROP_FLOAT, PROP_MATRIX);
3170  "Input Matrix",
3171  "Matrix access to location, rotation and scale (including deltas), "
3172  "before constraints and parenting are applied");
3174  prop, "rna_Object_matrix_basis_get", "rna_Object_matrix_basis_set", NULL);
3175  RNA_def_property_update(prop, NC_OBJECT | ND_TRANSFORM, "rna_Object_internal_update");
3176 
3177  /*parent_inverse*/
3178  prop = RNA_def_property(srna, "matrix_parent_inverse", PROP_FLOAT, PROP_MATRIX);
3179  RNA_def_property_float_sdna(prop, NULL, "parentinv");
3182  prop, "Parent Inverse Matrix", "Inverse of object's parent matrix at time of parenting");
3183  RNA_def_property_update(prop, NC_OBJECT | ND_TRANSFORM, "rna_Object_internal_update");
3184 
3185  /* modifiers */
3186  prop = RNA_def_property(srna, "modifiers", PROP_COLLECTION, PROP_NONE);
3187  RNA_def_property_struct_type(prop, "Modifier");
3189  prop, "Modifiers", "Modifiers affecting the geometric data of the object");
3190  RNA_def_property_override_funcs(prop, NULL, NULL, "rna_Object_modifiers_override_apply");
3192  rna_def_object_modifiers(brna, prop);
3193 
3194  /* Grease Pencil modifiers. */
3195  prop = RNA_def_property(srna, "grease_pencil_modifiers", PROP_COLLECTION, PROP_NONE);
3196  RNA_def_property_collection_sdna(prop, NULL, "greasepencil_modifiers", NULL);
3197  RNA_def_property_struct_type(prop, "GpencilModifier");
3199  prop, "Grease Pencil Modifiers", "Modifiers affecting the data of the grease pencil object");
3201  prop, NULL, NULL, "rna_Object_greasepencil_modifiers_override_apply");
3204 
3205  /* Shader FX. */
3206  prop = RNA_def_property(srna, "shader_effects", PROP_COLLECTION, PROP_NONE);
3207  RNA_def_property_collection_sdna(prop, NULL, "shader_fx", NULL);
3208  RNA_def_property_struct_type(prop, "ShaderFx");
3209  RNA_def_property_ui_text(prop, "Shader Effects", "Effects affecting display of object");
3211  rna_def_object_shaderfxs(brna, prop);
3213 
3214  /* constraints */
3215  prop = RNA_def_property(srna, "constraints", PROP_COLLECTION, PROP_NONE);
3216  RNA_def_property_struct_type(prop, "Constraint");
3219  prop, "Constraints", "Constraints affecting the transformation of the object");
3220  RNA_def_property_override_funcs(prop, NULL, NULL, "rna_Object_constraints_override_apply");
3221 # if 0
3223  prop, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "constraints__add", "constraints__remove");
3224 # endif
3225  rna_def_object_constraints(brna, prop);
3226 
3227  /* vertex groups */
3228  prop = RNA_def_property(srna, "vertex_groups", PROP_COLLECTION, PROP_NONE);
3229  RNA_def_property_collection_sdna(prop, NULL, "defbase", NULL);
3230  RNA_def_property_struct_type(prop, "VertexGroup");
3232  RNA_def_property_ui_text(prop, "Vertex Groups", "Vertex groups of the object");
3233  rna_def_object_vertex_groups(brna, prop);
3234 
3235  /* face maps */
3236  prop = RNA_def_property(srna, "face_maps", PROP_COLLECTION, PROP_NONE);
3237  RNA_def_property_collection_sdna(prop, NULL, "fmaps", NULL);
3238  RNA_def_property_struct_type(prop, "FaceMap");
3240  RNA_def_property_ui_text(prop, "Face Maps", "Maps of faces of the object");
3241  rna_def_object_face_maps(brna, prop);
3242 
3243  /* empty */
3244  prop = RNA_def_property(srna, "empty_display_type", PROP_ENUM, PROP_NONE);
3245  RNA_def_property_enum_sdna(prop, NULL, "empty_drawtype");
3247  RNA_def_property_enum_funcs(prop, NULL, "rna_Object_empty_display_type_set", NULL);
3248  RNA_def_property_ui_text(prop, "Empty Display Type", "Viewport display style for empties");
3250 
3251  prop = RNA_def_property(srna, "empty_display_size", PROP_FLOAT, PROP_DISTANCE);
3252  RNA_def_property_float_sdna(prop, NULL, "empty_drawsize");
3253  RNA_def_property_range(prop, 0.0001f, 1000.0f);
3254  RNA_def_property_ui_range(prop, 0.01, 100, 1, 2);
3256  prop, "Empty Display Size", "Size of display for empties in the viewport");
3258 
3259  prop = RNA_def_property(srna, "empty_image_offset", PROP_FLOAT, PROP_NONE);
3260  RNA_def_property_float_sdna(prop, NULL, "ima_ofs");
3261  RNA_def_property_ui_text(prop, "Origin Offset", "Origin offset distance");
3262  RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 0.1f, 2);
3264 
3265  prop = RNA_def_property(srna, "image_user", PROP_POINTER, PROP_NONE);
3267  RNA_def_property_pointer_sdna(prop, NULL, "iuser");
3269  prop,
3270  "Image User",
3271  "Parameters defining which layer, pass and frame of the image is displayed");
3273 
3274  prop = RNA_def_property(srna, "empty_image_depth", PROP_ENUM, PROP_NONE);
3277  prop, "Empty Image Depth", "Determine which other objects will occlude the image");
3279 
3280  prop = RNA_def_property(srna, "show_empty_image_perspective", PROP_BOOLEAN, PROP_NONE);
3282  prop, NULL, "empty_image_visibility_flag", OB_EMPTY_IMAGE_HIDE_PERSPECTIVE);
3284  prop, "Display in Perspective Mode", "Display image in perspective mode");
3286 
3287  prop = RNA_def_property(srna, "show_empty_image_orthographic", PROP_BOOLEAN, PROP_NONE);
3289  prop, NULL, "empty_image_visibility_flag", OB_EMPTY_IMAGE_HIDE_ORTHOGRAPHIC);
3291  prop, "Display in Orthographic Mode", "Display image in orthographic mode");
3293 
3294  prop = RNA_def_property(srna, "show_empty_image_only_axis_aligned", PROP_BOOLEAN, PROP_NONE);
3296  prop, NULL, "empty_image_visibility_flag", OB_EMPTY_IMAGE_HIDE_NON_AXIS_ALIGNED);
3298  "Display Only Axis Aligned",
3299  "Only display the image when it is aligned with the view axis");
3301 
3302  prop = RNA_def_property(srna, "use_empty_image_alpha", PROP_BOOLEAN, PROP_NONE);
3305  prop,
3306  "Use Alpha",
3307  "Use alpha blending instead of alpha test (can produce sorting artifacts)");
3309 
3310  static EnumPropertyItem prop_empty_image_side_items[] = {
3311  {0, "DOUBLE_SIDED", 0, "Both", ""},
3312  {OB_EMPTY_IMAGE_HIDE_BACK, "FRONT", 0, "Front", ""},
3313  {OB_EMPTY_IMAGE_HIDE_FRONT, "BACK", 0, "Back", ""},
3314  {0, NULL, 0, NULL, NULL},
3315  };
3316  prop = RNA_def_property(srna, "empty_image_side", PROP_ENUM, PROP_NONE);
3317  RNA_def_property_enum_bitflag_sdna(prop, NULL, "empty_image_visibility_flag");
3318  RNA_def_property_enum_items(prop, prop_empty_image_side_items);
3319  RNA_def_property_ui_text(prop, "Empty Image Side", "Show front/back side");
3321 
3322  /* render */
3323  prop = RNA_def_property(srna, "pass_index", PROP_INT, PROP_UNSIGNED);
3324  RNA_def_property_int_sdna(prop, NULL, "index");
3326  prop, "Pass Index", "Index number for the \"Object Index\" render pass");
3327  RNA_def_property_update(prop, NC_OBJECT, "rna_Object_internal_update_draw");
3328 
3329  prop = RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR);
3331  prop, "Color", "Object color and alpha, used when faces have the ObColor mode enabled");
3332  RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_internal_update_draw");
3333 
3334  /* physics */
3335  prop = RNA_def_property(srna, "field", PROP_POINTER, PROP_NONE);
3336  RNA_def_property_pointer_sdna(prop, NULL, "pd");
3337  RNA_def_property_struct_type(prop, "FieldSettings");
3338  RNA_def_property_pointer_funcs(prop, "rna_Object_field_get", NULL, NULL, NULL);
3340  prop, "Field Settings", "Settings for using the object as a field in physics simulation");
3341 
3342  prop = RNA_def_property(srna, "collision", PROP_POINTER, PROP_NONE);
3343  RNA_def_property_pointer_sdna(prop, NULL, "pd");
3344  RNA_def_property_struct_type(prop, "CollisionSettings");
3345  RNA_def_property_pointer_funcs(prop, "rna_Object_collision_get", NULL, NULL, NULL);
3347  "Collision Settings",
3348  "Settings for using the object as a collider in physics simulation");
3349 
3350  prop = RNA_def_property(srna, "soft_body", PROP_POINTER, PROP_NONE);
3351  RNA_def_property_pointer_sdna(prop, NULL, "soft");
3352  RNA_def_property_struct_type(prop, "SoftBodySettings");
3353  RNA_def_property_ui_text(prop, "Soft Body Settings", "Settings for soft body simulation");
3354 
3355  prop = RNA_def_property(srna, "particle_systems", PROP_COLLECTION, PROP_NONE);
3356  RNA_def_property_collection_sdna(prop, NULL, "particlesystem", NULL);
3357  RNA_def_property_struct_type(prop, "ParticleSystem");
3358  RNA_def_property_ui_text(prop, "Particle Systems", "Particle systems emitted from the object");
3359  rna_def_object_particle_systems(brna, prop);
3360 
3361  prop = RNA_def_property(srna, "rigid_body", PROP_POINTER, PROP_NONE);
3362  RNA_def_property_pointer_sdna(prop, NULL, "rigidbody_object");
3363  RNA_def_property_struct_type(prop, "RigidBodyObject");
3364  RNA_def_property_ui_text(prop, "Rigid Body Settings", "Settings for rigid body simulation");
3365 
3366  prop = RNA_def_property(srna, "rigid_body_constraint", PROP_POINTER, PROP_NONE);
3367  RNA_def_property_pointer_sdna(prop, NULL, "rigidbody_constraint");
3368  RNA_def_property_struct_type(prop, "RigidBodyConstraint");
3369  RNA_def_property_ui_text(prop, "Rigid Body Constraint", "Constraint constraining rigid bodies");
3370 
3371  /* restrict */
3372  prop = RNA_def_property(srna, "hide_viewport", PROP_BOOLEAN, PROP_NONE);
3374  RNA_def_property_ui_text(prop, "Disable in Viewports", "Globally disable in viewports");
3375  RNA_def_property_ui_icon(prop, ICON_RESTRICT_VIEW_OFF, -1);
3376  RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_hide_update");
3377 
3378  prop = RNA_def_property(srna, "hide_select", PROP_BOOLEAN, PROP_NONE);
3379  RNA_def_property_boolean_sdna(prop, NULL, "restrictflag", OB_RESTRICT_SELECT);
3381  RNA_def_property_ui_text(prop, "Disable Selection", "Disable selection in viewport");
3382  RNA_def_property_ui_icon(prop, ICON_RESTRICT_SELECT_OFF, -1);
3383  RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_hide_update");
3384 
3385  prop = RNA_def_property(srna, "hide_render", PROP_BOOLEAN, PROP_NONE);
3386  RNA_def_property_boolean_sdna(prop, NULL, "restrictflag", OB_RESTRICT_RENDER);
3387  RNA_def_property_ui_text(prop, "Disable in Renders", "Globally disable in renders");
3388  RNA_def_property_ui_icon(prop, ICON_RESTRICT_RENDER_OFF, -1);
3389  RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_hide_update");
3390 
3391  prop = RNA_def_property(srna, "show_instancer_for_render", PROP_BOOLEAN, PROP_NONE);
3392  RNA_def_property_boolean_sdna(prop, NULL, "duplicator_visibility_flag", OB_DUPLI_FLAG_RENDER);
3393  RNA_def_property_ui_text(prop, "Render Instancer", "Make instancer visible when rendering");
3395  prop, NC_OBJECT | ND_DRAW, "rna_Object_duplicator_visibility_flag_update");
3396 
3397  prop = RNA_def_property(srna, "show_instancer_for_viewport", PROP_BOOLEAN, PROP_NONE);
3398  RNA_def_property_boolean_sdna(prop, NULL, "duplicator_visibility_flag", OB_DUPLI_FLAG_VIEWPORT);
3399  RNA_def_property_ui_text(prop, "Display Instancer", "Make instancer visible in the viewport");
3401  prop, NC_OBJECT | ND_DRAW, "rna_Object_duplicator_visibility_flag_update");
3402 
3403  /* instancing */
3404  prop = RNA_def_property(srna, "instance_type", PROP_ENUM, PROP_NONE);
3405  RNA_def_property_enum_bitflag_sdna(prop, NULL, "transflag");
3407  RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Object_instance_type_itemf");
3408  RNA_def_property_ui_text(prop, "Instance Type", "If not None, object instancing method to use");
3409  RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_dependency_update");
3410 
3411  prop = RNA_def_property(srna, "use_instance_vertices_rotation", PROP_BOOLEAN, PROP_NONE);
3412  RNA_def_property_boolean_sdna(prop, NULL, "transflag", OB_DUPLIROT);
3414  prop, "Orient with Normals", "Rotate instance according to vertex normal");
3416 
3417  prop = RNA_def_property(srna, "use_instance_faces_scale", PROP_BOOLEAN, PROP_NONE);
3419  RNA_def_property_ui_text(prop, "Scale to Face Sizes", "Scale instance based on face size");
3420  RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_internal_update");
3421 
3422  prop = RNA_def_property(srna, "instance_faces_scale", PROP_FLOAT, PROP_NONE);
3423  RNA_def_property_float_sdna(prop, NULL, "instance_faces_scale");
3424  RNA_def_property_range(prop, 0.001f, 10000.0f);
3425  RNA_def_property_ui_text(prop, "Instance Faces Scale", "Scale the face instance objects");
3426  RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_internal_update");
3427 
3428  prop = RNA_def_property(srna, "instance_collection", PROP_POINTER, PROP_NONE);
3429  RNA_def_property_struct_type(prop, "Collection");
3430  RNA_def_property_pointer_sdna(prop, NULL, "instance_collection");
3432  RNA_def_property_pointer_funcs(prop, NULL, "rna_Object_dup_collection_set", NULL, NULL);
3433  RNA_def_property_ui_text(prop, "Instance Collection", "Instance an existing collection");
3434  RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_dependency_update");
3435 
3436  prop = RNA_def_property(srna, "is_instancer", PROP_BOOLEAN, PROP_NONE);
3437  RNA_def_property_boolean_sdna(prop, NULL, "transflag", OB_DUPLI);
3441 
3442  /* drawing */
3443  prop = RNA_def_property(srna, "display_type", PROP_ENUM, PROP_NONE);
3444  RNA_def_property_enum_sdna(prop, NULL, "dt");
3445  RNA_def_property_enum_items(prop, drawtype_items);
3446  RNA_def_property_ui_text(prop, "Display As", "How to display object in viewport");
3447  RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_internal_update");
3448 
3449  prop = RNA_def_property(srna, "show_bounds", PROP_BOOLEAN, PROP_NONE);
3451  RNA_def_property_ui_text(prop, "Display Bounds", "Display the object's bounds");
3453 
3454  prop = RNA_def_property(srna, "display_bounds_type", PROP_ENUM, PROP_NONE);
3455  RNA_def_property_enum_sdna(prop, NULL, "boundtype");
3456  RNA_def_property_enum_items(prop, boundtype_items);
3457  RNA_def_property_ui_text(prop, "Display Bounds Type", "Object boundary display type");
3459 
3460  prop = RNA_def_property(srna, "show_name", PROP_BOOLEAN, PROP_NONE);
3462  RNA_def_property_ui_text(prop, "Display Name", "Display the object's name");
3464 
3465  prop = RNA_def_property(srna, "show_axis", PROP_BOOLEAN, PROP_NONE);
3467  RNA_def_property_ui_text(prop, "Display Axes", "Display the object's origin and axes");
3469 
3470  prop = RNA_def_property(srna, "show_texture_space", PROP_BOOLEAN, PROP_NONE);
3472  RNA_def_property_ui_text(prop, "Display Texture Space", "Display the object's texture space");
3474 
3475  prop = RNA_def_property(srna, "show_wire", PROP_BOOLEAN, PROP_NONE);
3478  prop, "Display Wire", "Display the object's wireframe over solid shading");
3480 
3481  prop = RNA_def_property(srna, "show_all_edges", PROP_BOOLEAN, PROP_NONE);
3483  RNA_def_property_ui_text(prop, "Display All Edges", "Display all edges for mesh objects");
3485 
3486  prop = RNA_def_property(srna, "use_grease_pencil_lights", PROP_BOOLEAN, PROP_NONE);
3489  RNA_def_property_ui_text(prop, "Use Lights", "Lights affect grease pencil object");
3490  RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_GPencil_update");
3491 
3492  prop = RNA_def_property(srna, "show_transparent", PROP_BOOLEAN, PROP_NONE);
3495  prop, "Display Transparent", "Display material transparency in the object");
3497 
3498  prop = RNA_def_property(srna, "show_in_front", PROP_BOOLEAN, PROP_NONE);
3500  RNA_def_property_ui_text(prop, "In Front", "Make the object display in front of others");
3501  RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_GPencil_update");
3502 
3503  /* pose */
3504  prop = RNA_def_property(srna, "pose_library", PROP_POINTER, PROP_NONE);
3505  RNA_def_property_pointer_sdna(prop, NULL, "poselib");
3506  RNA_def_property_struct_type(prop, "Action");
3508  RNA_def_property_ui_text(prop, "Pose Library", "Action used as a pose library for armatures");
3509 
3510  prop = RNA_def_property(srna, "pose", PROP_POINTER, PROP_NONE);
3511  RNA_def_property_pointer_sdna(prop, NULL, "pose");
3512  RNA_def_property_struct_type(prop, "Pose");
3513  RNA_def_property_ui_text(prop, "Pose", "Current pose for armatures");
3514 
3515  /* shape keys */
3516  prop = RNA_def_property(srna, "show_only_shape_key", PROP_BOOLEAN, PROP_NONE);
3517  RNA_def_property_boolean_sdna(prop, NULL, "shapeflag", OB_SHAPE_LOCK);
3519  prop, "Shape Key Lock", "Always show the current shape for this object");
3520  RNA_def_property_ui_icon(prop, ICON_UNPINNED, 1);
3521  RNA_def_property_update(prop, 0, "rna_Object_internal_update_data");
3522 
3523  prop = RNA_def_property(srna, "use_shape_key_edit_mode", PROP_BOOLEAN, PROP_NONE);
3526  prop, "Shape Key Edit Mode", "Apply shape keys in edit mode (for meshes only)");
3527  RNA_def_property_ui_icon(prop, ICON_EDITMODE_HLT, 0);
3528  RNA_def_property_update(prop, 0, "rna_Object_internal_update_data");
3529 
3530  prop = RNA_def_property(srna, "active_shape_key", PROP_POINTER, PROP_NONE);
3531  RNA_def_property_struct_type(prop, "ShapeKey");
3534  RNA_def_property_pointer_funcs(prop, "rna_Object_active_shape_key_get", NULL, NULL, NULL);
3535  RNA_def_property_ui_text(prop, "Active Shape Key", "Current shape key");
3536 
3537  prop = RNA_def_property(srna, "active_shape_key_index", PROP_INT, PROP_NONE);
3538  RNA_def_property_int_sdna(prop, NULL, "shapenr");
3539  RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); /* XXX this is really unpredictable... */
3541  "rna_Object_active_shape_key_index_get",
3542  "rna_Object_active_shape_key_index_set",
3543  "rna_Object_active_shape_key_index_range");
3544  RNA_def_property_ui_text(prop, "Active Shape Key Index", "Current shape key index");
3545  RNA_def_property_update(prop, 0, "rna_Object_active_shape_update");
3546 
3547  /* sculpt */
3548  prop = RNA_def_property(srna, "use_dynamic_topology_sculpting", PROP_BOOLEAN, PROP_NONE);
3549  RNA_def_property_boolean_funcs(prop, "rna_Object_use_dynamic_topology_sculpting_get", NULL);
3551  RNA_def_property_ui_text(prop, "Dynamic Topology Sculpting", NULL);
3552 
3553  /* Base Settings */
3554  prop = RNA_def_property(srna, "is_from_instancer", PROP_BOOLEAN, PROP_NONE);
3555  RNA_def_property_boolean_sdna(prop, NULL, "base_flag", BASE_FROM_DUPLI);
3556  RNA_def_property_ui_text(prop, "Base from Instancer", "Object comes from a instancer");
3560 
3561  prop = RNA_def_property(srna, "is_from_set", PROP_BOOLEAN, PROP_NONE);
3562  RNA_def_property_boolean_sdna(prop, NULL, "base_flag", BASE_FROM_SET);
3563  RNA_def_property_ui_text(prop, "Base from Set", "Object comes from a background set");
3567 
3568  /* Object Display */
3569  prop = RNA_def_property(srna, "display", PROP_POINTER, PROP_NONE);
3571  RNA_def_property_struct_type(prop, "ObjectDisplay");
3572  RNA_def_property_pointer_funcs(prop, "rna_Object_display_get", NULL, NULL, NULL);
3573  RNA_def_property_ui_text(prop, "Object Display", "Object display settings for 3D viewport");
3574 
3575  /* Line Art */
3576  prop = RNA_def_property(srna, "lineart", PROP_POINTER, PROP_NONE);
3577  RNA_def_property_struct_type(prop, "ObjectLineArt");
3578  RNA_def_property_ui_text(prop, "Line Art", "Line art settings for the object");
3579 
3580  /* Mesh Symmetry Settings */
3581 
3582  prop = RNA_def_property(srna, "use_mesh_mirror_x", PROP_BOOLEAN, PROP_NONE);
3584  prop, "rna_Object_mesh_symmetry_x_get", "rna_Object_mesh_symmetry_x_set");
3586  RNA_def_property_ui_text(prop, "X", "Enable mesh symmetry in the X axis");
3587 
3588  prop = RNA_def_property(srna, "use_mesh_mirror_y", PROP_BOOLEAN, PROP_NONE);
3590  prop, "rna_Object_mesh_symmetry_y_get", "rna_Object_mesh_symmetry_y_set");
3592  RNA_def_property_editable_func(prop, "rna_Object_mesh_symmetry_yz_editable");
3593  RNA_def_property_ui_text(prop, "Y", "Enable mesh symmetry in the Y axis");
3594 
3595  prop = RNA_def_property(srna, "use_mesh_mirror_z", PROP_BOOLEAN, PROP_NONE);
3597  prop, "rna_Object_mesh_symmetry_z_get", "rna_Object_mesh_symmetry_z_set");
3599  RNA_def_property_editable_func(prop, "rna_Object_mesh_symmetry_yz_editable");
3600  RNA_def_property_ui_text(prop, "Z", "Enable mesh symmetry in the Z axis");
3601 
3603 
3604  /* anim */
3606 
3607  rna_def_animviz_common(srna);
3609 
3610  RNA_api_object(srna);
3611 }
3612 
3614 {
3615  rna_def_object(brna);
3616 
3617  RNA_define_animate_sdna(false);
3618  rna_def_vertex_group(brna);
3619  rna_def_face_map(brna);
3620  rna_def_material_slot(brna);
3621  rna_def_object_display(brna);
3622  rna_def_object_lineart(brna);
3624 }
3625 
3626 #endif
void BKE_pose_rebuild(struct Main *bmain, struct Object *ob, struct bArmature *arm, const bool do_id_user)
Definition: armature.c:2536
void BKE_rotMode_change_values(float quat[4], float eul[3], float axis[3], float *angle, short oldMode, short newMode)
Definition: armature.c:1984
Camera data-block and utility functions.
bool BKE_collection_has_object_recursive(struct Collection *collection, struct Object *ob)
Definition: collection.c:961
bool BKE_constraint_remove(ListBase *list, struct bConstraint *con)
Definition: constraint.c:5515
struct bConstraint * BKE_constraint_copy_for_object(struct Object *ob, struct bConstraint *src)
Definition: constraint.c:5777
void BKE_constraints_free(struct ListBase *list)
Definition: constraint.c:5509
struct bConstraint * BKE_constraint_duplicate_ex(struct bConstraint *src, const int flag, const bool do_extern)
Definition: constraint.c:5755
struct bConstraint * BKE_constraint_add_for_object(struct Object *ob, const char *name, short type)
Definition: constraint.c:5672
struct bConstraint * BKE_constraints_active_get(struct ListBase *list)
Definition: constraint.c:5812
void BKE_constraints_active_set(ListBase *list, struct bConstraint *con)
Definition: constraint.c:5829
void BKE_constraint_unique_name(struct bConstraint *con, struct ListBase *list)
Definition: constraint.c:123
struct Scene * CTX_data_scene(const bContext *C)
Definition: context.c:1034
struct Main * CTX_data_main(const bContext *C)
Definition: context.c:1018
void BKE_curve_type_test(struct Object *ob)
Definition: curve.c:484
support for deformation groups and hooks.
int BKE_object_defgroup_name_index(const struct Object *ob, const char *name)
void BKE_object_defgroup_unique_name(struct bDeformGroup *dg, struct Object *ob)
Definition: deform.c:620
struct bDeformGroup * BKE_object_defgroup_find_name(const struct Object *ob, const char *name)
void BKE_editlattice_load(struct Object *obedit)
Definition: editlattice.c:84
void BKE_editlattice_make(struct Object *obedit)
Definition: editlattice.c:58
void BKE_editmesh_looptri_calc(BMEditMesh *em)
Definition: editmesh.c:135
struct PartDeflect * BKE_partdeflect_new(int type)
Definition: effect.c:86
#define G_MAIN
Definition: BKE_global.h:232
struct Key * BKE_key_from_object(const struct Object *ob)
void BKE_main_collection_sync_remap(const struct Main *bmain)
void id_us_min(struct ID *id)
Definition: lib_id.c:297
void id_us_plus(struct ID *id)
Definition: lib_id.c:288
bool BKE_id_is_in_global_main(struct ID *id)
Definition: lib_id.c:2287
General operations, lookup, etc. for materials.
struct Material * BKE_object_material_get(struct Object *ob, short act)
Definition: material.c:697
@ BKE_MAT_ASSIGN_EXISTING
Definition: BKE_material.h:70
void BKE_object_materials_test(struct Main *bmain, struct Object *ob, struct ID *id)
Definition: material.c:772
void BKE_object_material_assign(struct Main *bmain, struct Object *ob, struct Material *ma, short act, int assign_type)
Definition: material.c:850
void BKE_mesh_assign_object(struct Main *bmain, struct Object *ob, struct Mesh *me)
Definition: mesh.c:1283
void BKE_modifier_copydata(struct ModifierData *md, struct ModifierData *target)
General operations, lookup, etc. for blender objects.
void BKE_object_dimensions_set(struct Object *ob, const float value[3], int axis_mask)
Definition: object.c:3959
void BKE_object_dimensions_get(struct Object *ob, float r_vec[3])
Definition: object.c:3901
void BKE_object_empty_draw_type_set(struct Object *ob, const int value)
Definition: object.c:4061
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.c:1284
void BKE_object_to_mat4(struct Object *ob, float r_mat[4][4])
Definition: object.c:3234
struct BoundBox * BKE_object_boundbox_get(struct Object *ob)
Definition: object.c:3817
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.c:3245
void BKE_object_apply_mat4(struct Object *ob, const float mat[4][4], const bool use_compat, const bool use_parent)
Definition: object.c:3754
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)
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:2057
void psys_set_current_num(struct Object *ob, int index)
Definition: particle.c:677
short psys_get_current_num(struct Object *ob)
Definition: particle.c:660
struct ParticleSystem * psys_get_current(struct Object *ob)
Definition: particle.c:645
void BKE_report(ReportList *reports, ReportType type, const char *message)
Definition: report.c:104
void BKE_reportf(ReportList *reports, ReportType type, const char *format,...) ATTR_PRINTF_FORMAT(3
#define BLI_assert(a)
Definition: BLI_assert.h:58
bool BLI_listbase_move_index(ListBase *listbase, int from, int to) ATTR_NONNULL()
Definition: listbase.c:511
void BLI_insertlinkafter(struct ListBase *listbase, void *vprevlink, void *vnewlink) ATTR_NONNULL(1)
Definition: listbase.c:352
void * BLI_findstring(const struct ListBase *listbase, const char *id, const int offset) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
void BLI_remlink(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
Definition: listbase.c:133
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:262
bool invert_m4_m4(float R[4][4], const float A[4][4])
Definition: math_matrix.c:1278
void copy_m4_m4(float m1[4][4], const float m2[4][4])
Definition: math_matrix.c:95
#define DEG2RAD(_deg)
void copy_vn_fl(float *array_tar, const int size, const float val)
Definition: math_vector.c:1410
MINLINE void copy_v3_v3(float r[3], const float a[3])
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:70
char * BLI_strncpy(char *__restrict dst, const char *__restrict src, const size_t maxncpy) ATTR_NONNULL()
Definition: string.c:108
char * BLI_strncpy_utf8(char *__restrict dst, const char *__restrict src, size_t maxncpy) ATTR_NONNULL()
Definition: string_utf8.c:258
#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)
ID and Library types, which are fundamental for sdna.
@ ID_RECALC_TRANSFORM
Definition: DNA_ID.h:599
@ ID_RECALC_COPY_ON_WRITE
Definition: DNA_ID.h:654
@ ID_RECALC_SHADING
Definition: DNA_ID.h:631
@ ID_RECALC_GEOMETRY
Definition: DNA_ID.h:611
@ LIB_TAG_NO_MAIN
Definition: DNA_ID.h:572
#define ID_IS_LINKED(_id)
Definition: DNA_ID.h:426
@ IDOVERRIDE_LIBRARY_OP_INSERT_AFTER
Definition: DNA_ID.h:186
@ IDOVERRIDE_LIBRARY_OP_REPLACE
Definition: DNA_ID.h:176
@ ID_IM
Definition: DNA_ID_enums.h:65
@ ID_CU
Definition: DNA_ID_enums.h:61
@ 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.
@ CD_MLOOPUV
@ GP_DATA_ANNOTATIONS
@ BASE_FROM_DUPLI
@ BASE_FROM_SET
@ LIGHTPROBE_TYPE_CUBE
@ LIGHTPROBE_TYPE_PLANAR
@ LIGHTPROBE_TYPE_GRID
eMeshSymmetryType
@ ME_SYMMETRY_X
@ ME_SYMMETRY_Y
@ ME_SYMMETRY_Z
@ ME_EDIT_MIRROR_VERTEX_GROUPS
#define MB_BALL
#define MB_TUBE
#define MB_ELIPSOID
#define MB_PLANE
#define MB_CUBE
@ 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_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_BOUND_CAPSULE
@ OB_BOUND_SPHERE
@ OB_BOUND_CONE
@ OB_BOUND_BOX
@ OB_BOUND_CYLINDER
#define OB_DATA_SUPPORT_ID(_id_type)
@ 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
#define OB_TYPE_SUPPORT_PARVERT(_type)
@ OB_TRANSFORM_ADJUST_ROOT_PARENT_FOR_VIEW_LOCK
@ OB_DUPLI
@ OB_DUPLIVERTS
@ OB_DUPLIROT
@ OB_DUPLIFACES_SCALE
@ OBJECT_LRT_OWN_CREASE
@ 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_EMPTY_CONE
@ OB_SINGLE_ARROW
@ OB_PLAINAXES
@ OB_ARROWS
@ OB_CIRCLE
@ OB_CUBE
@ OB_EMPTY_IMAGE
@ OB_EMPTY_SPHERE
@ PARVERT1
@ PARSKEL
@ PAROBJECT
@ PARVERT3
@ PARBONE
@ GP_STROKE
@ GP_MONKEY
@ GP_EMPTY
@ GP_LRT_OBJECT
@ GP_LRT_COLLECTION
@ GP_LRT_SCENE
#define OB_EMPTY_IMAGE_DEPTH_FRONT
@ OB_SHAPE_EDIT_MODE
@ OB_SHAPE_LOCK
@ OBJECT_LRT_INCLUDE
@ OBJECT_LRT_NO_INTERSECTION
@ OBJECT_LRT_EXCLUDE
@ OBJECT_LRT_INHERIT
@ OBJECT_LRT_OCCLUSION_ONLY
@ OBJECT_LRT_INTERSECTION_ONLY
@ OB_POSX
@ OB_NEGZ
@ OB_POSY
@ OB_NEGX
@ OB_POSZ
@ OB_NEGY
#define OB_TYPE_SUPPORT_VGROUP(_type)
@ OB_EMPTY_IMAGE_USE_ALPHA_BLEND
@ OB_SPEAKER
@ OB_LATTICE
@ OB_MBALL
@ OB_EMPTY
@ OB_SURF
@ OB_CAMERA
@ OB_FONT
@ OB_ARMATURE
@ OB_LAMP
@ OB_MESH
@ OB_POINTCLOUD
@ OB_HAIR
@ OB_VOLUME
@ OB_CURVE
@ OB_GPENCIL
@ OB_LIGHTPROBE
#define OB_EMPTY_IMAGE_DEPTH_DEFAULT
@ OB_RESTRICT_VIEWPORT
@ OB_RESTRICT_SELECT
@ OB_RESTRICT_RENDER
@ OB_DUPLI_FLAG_VIEWPORT
@ OB_DUPLI_FLAG_RENDER
@ 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
#define PSYS_DELETE
void EDBM_mesh_load(struct Main *bmain, struct Object *ob)
void EDBM_mesh_make(struct Object *ob, const int select_mode, const bool add_key_index)
void ED_vgroup_vert_add(struct Object *ob, struct bDeformGroup *dg, int vertnum, float weight, int assignmode)
#define WEIGHT_REPLACE
Definition: ED_mesh.h:345
float ED_vgroup_vert_weight(struct Object *ob, struct bDeformGroup *dg, int vertnum)
#define WEIGHT_ADD
Definition: ED_mesh.h:346
#define WEIGHT_SUBTRACT
Definition: ED_mesh.h:347
void ED_vgroup_vert_remove(struct Object *ob, struct bDeformGroup *dg, int vertnum)
void EDBM_mesh_normals_update(struct BMEditMesh *em)
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)
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_parent(struct Object *ob, struct Object *parent, const int type, const char *substr)
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
StructRNA RNA_Material
StructRNA RNA_ObjectDisplay
StructRNA RNA_ShapeKey
StructRNA RNA_Armature
StructRNA RNA_Modifier
#define RNA_POINTER_INVALIDATE(ptr)
Definition: RNA_access.h:1425
StructRNA RNA_Constraint
StructRNA RNA_MetaBall
StructRNA RNA_Curve
StructRNA RNA_FieldSettings
StructRNA RNA_Mesh
StructRNA RNA_ParticleSystem
StructRNA RNA_Light
StructRNA RNA_Hair
StructRNA RNA_LightProbe
StructRNA RNA_GreasePencil
StructRNA RNA_ID
StructRNA RNA_Speaker
StructRNA RNA_Camera
StructRNA RNA_VertexGroup
StructRNA RNA_CollisionSettings
StructRNA RNA_FaceMap
StructRNA RNA_PointCloud
StructRNA RNA_Volume
StructRNA RNA_Image
StructRNA RNA_Lattice
@ PARM_RNAPTR
Definition: RNA_types.h:339
@ PARM_REQUIRED
Definition: RNA_types.h:337
@ FUNC_USE_REPORTS
Definition: RNA_types.h:578
@ FUNC_USE_MAIN
Definition: RNA_types.h:576
@ FUNC_USE_CONTEXT
Definition: RNA_types.h:577
@ FUNC_USE_SELF_ID
Definition: RNA_types.h:565
@ STRUCT_ID_REFCOUNT
Definition: RNA_types.h:621
@ PROP_FLOAT
Definition: RNA_types.h:75
@ PROP_BOOLEAN
Definition: RNA_types.h:73
@ PROP_ENUM
Definition: RNA_types.h:77
@ PROP_INT
Definition: RNA_types.h:74
@ PROP_STRING
Definition: RNA_types.h:76
@ PROP_POINTER
Definition: RNA_types.h:78
@ PROP_COLLECTION
Definition: RNA_types.h:79
#define RNA_TRANSLATION_PREC_DEFAULT
Definition: RNA_types.h:104
@ PROPOVERRIDE_OVERRIDABLE_LIBRARY
Definition: RNA_types.h:297
@ PROPOVERRIDE_NO_COMPARISON
Definition: RNA_types.h:305
@ PROPOVERRIDE_IGNORE
Definition: RNA_types.h:317
@ PROPOVERRIDE_LIBRARY_INSERTION
Definition: RNA_types.h:322
@ PROPOVERRIDE_NO_PROP_NAME
Definition: RNA_types.h:329
@ PROP_THICK_WRAP
Definition: RNA_types.h:270
@ PROP_DYNAMIC
Definition: RNA_types.h:275
@ PROP_ANIMATABLE
Definition: RNA_types.h:188
@ PROP_PROPORTIONAL
Definition: RNA_types.h:209
@ PROP_NEVER_UNLINK
Definition: RNA_types.h:232
@ PROP_EDITABLE
Definition: RNA_types.h:175
@ PROP_NEVER_NULL
Definition: RNA_types.h:225
@ PROP_NO_DEG_UPDATE
Definition: RNA_types.h:286
@ PROP_ID_SELF_CHECK
Definition: RNA_types.h:218
@ PROP_ID_REFCOUNT
Definition: RNA_types.h:212
@ PROP_MATRIX
Definition: RNA_types.h:144
@ PROP_XYZ
Definition: RNA_types.h:148
@ PROP_DISTANCE
Definition: RNA_types.h:135
@ PROP_COLOR
Definition: RNA_types.h:139
@ PROP_ANGLE
Definition: RNA_types.h:132
@ PROP_AXISANGLE
Definition: RNA_types.h:147
@ PROP_EULER
Definition: RNA_types.h:145
@ PROP_NONE
Definition: RNA_types.h:113
@ PROP_TRANSLATION
Definition: RNA_types.h:140
@ PROP_XYZ_LENGTH
Definition: RNA_types.h:149
@ PROP_UNSIGNED
Definition: RNA_types.h:129
@ PROP_QUATERNION
Definition: RNA_types.h:146
#define C
Definition: RandGen.cpp:39
#define NC_GEOM
Definition: WM_types.h:294
#define ND_DRAW
Definition: WM_types.h:362
#define ND_DATA
Definition: WM_types.h:408
#define NA_ADDED
Definition: WM_types.h:464
#define ND_MODIFIER
Definition: WM_types.h:363
#define NA_EDITED
Definition: WM_types.h:462
#define ND_PARENT
Definition: WM_types.h:368
#define NC_MATERIAL
Definition: WM_types.h:281
#define ND_CONSTRAINT
Definition: WM_types.h:365
#define NA_REMOVED
Definition: WM_types.h:465
#define NC_GPENCIL
Definition: WM_types.h:300
#define ND_TRANSFORM
Definition: WM_types.h:357
#define NA_RENAME
Definition: WM_types.h:466
#define ND_OB_SHADING
Definition: WM_types.h:358
#define ND_SPACE_VIEW3D
Definition: WM_types.h:423
#define NC_OBJECT
Definition: WM_types.h:280
#define ND_SHADING_LINKS
Definition: WM_types.h:379
#define NC_SPACE
Definition: WM_types.h:293
#define SELECT
StackEntry * from
Scene scene
void ED_curve_editnurb_make(Object *obedit)
Definition: editcurve.c:1289
void ED_curve_editnurb_load(Main *bmain, Object *obedit)
Definition: editcurve.c:1251
#define str(s)
#define GS(x)
Definition: iris.c:241
static unsigned a[3]
Definition: RandGen.cpp:92
void RNA_pointer_create(ID *id, StructRNA *type, void *data, PointerRNA *r_ptr)
Definition: rna_access.c:146
const PointerRNA PointerRNA_NULL
Definition: rna_access.c:71
PointerRNA RNA_property_pointer_get(PointerRNA *ptr, PropertyRNA *prop)
Definition: rna_access.c:3641
bool RNA_enum_name_from_value(const EnumPropertyItem *item, int value, const char **r_name)
Definition: rna_access.c:6504
PointerRNA rna_pointer_inherit_refine(PointerRNA *ptr, StructRNA *type, void *data)
Definition: rna_access.c:196
bool RNA_pointer_is_null(const PointerRNA *ptr)
Definition: rna_access.c:174
void rna_def_animdata_common(StructRNA *srna)
void rna_def_animviz_common(StructRNA *srna)
Definition: rna_animviz.c:308
void rna_def_motionpath_common(StructRNA *srna)
Definition: rna_animviz.c:85
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:3825
void RNA_def_property_pointer_sdna(PropertyRNA *prop, const char *structname, const char *propname)
Definition: rna_define.c:2762
void RNA_define_lib_overridable(const bool make_overridable)
Definition: rna_define.c:760
void RNA_def_struct_path_func(StructRNA *srna, const char *path)
Definition: rna_define.c:1212
void RNA_define_animate_sdna(bool animate)
Definition: rna_define.c:766
PropertyRNA * RNA_def_pointer(StructOrFunctionRNA *cont_, const char *identifier, const char *type, const char *ui_name, const char *ui_description)
Definition: rna_define.c:4159
void RNA_def_property_boolean_sdna(PropertyRNA *prop, const char *structname, const char *propname, int64_t bit)
Definition: rna_define.c:2257
void RNA_def_parameter_clear_flags(PropertyRNA *prop, PropertyFlag flag_property, ParameterFlag flag_parameter)
Definition: rna_define.c:1555
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:3643
void RNA_def_property_string_funcs(PropertyRNA *prop, const char *get, const char *length, const char *set)
Definition: rna_define.c:3312
void RNA_def_function_return(FunctionRNA *func, PropertyRNA *ret)
Definition: rna_define.c:4302
void RNA_def_property_float_funcs(PropertyRNA *prop, const char *get, const char *set, const char *range)
Definition: rna_define.c:3153
void RNA_def_property_ui_text(PropertyRNA *prop, const char *name, const char *description)
Definition: rna_define.c:1676
void RNA_def_property_string_sdna(PropertyRNA *prop, const char *structname, const char *propname)
Definition: rna_define.c:2717
void RNA_def_property_ui_icon(PropertyRNA *prop, int icon, int consecutive)
Definition: rna_define.c:1684
FunctionRNA * RNA_def_function(StructRNA *srna, const char *identifier, const char *call)
Definition: rna_define.c:4262
void RNA_def_property_srna(PropertyRNA *prop, const char *type)
Definition: rna_define.c:3462
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:3408
void RNA_def_struct_ui_text(StructRNA *srna, const char *name, const char *description)
Definition: rna_define.c:1259
void RNA_def_property_boolean_default(PropertyRNA *prop, bool value)
Definition: rna_define.c:1957
void RNA_def_property_boolean_funcs(PropertyRNA *prop, const char *get, const char *set)
Definition: rna_define.c:2971
void RNA_def_property_multi_array(PropertyRNA *prop, int dimension, const int length[])
Definition: rna_define.c:1629
const float rna_default_axis_angle[4]
Definition: rna_define.c:1621
void RNA_def_property_editable_array_func(PropertyRNA *prop, const char *editable)
Definition: rna_define.c:2889
void RNA_def_property_enum_items(PropertyRNA *prop, const EnumPropertyItem *item)
Definition: rna_define.c:1892
void RNA_def_struct_sdna(StructRNA *srna, const char *structname)
Definition: rna_define.c:1067
void RNA_def_struct_clear_flag(StructRNA *srna, int flag)
Definition: rna_define.c:1157
void RNA_def_property_array(PropertyRNA *prop, int length)
Definition: rna_define.c:1568
void RNA_def_property_range(PropertyRNA *prop, double min, double max)
Definition: rna_define.c:1757
void RNA_def_property_struct_type(PropertyRNA *prop, const char *type)
Definition: rna_define.c:1792
void RNA_def_property_collection_sdna(PropertyRNA *prop, const char *structname, const char *propname, const char *lengthpropname)
Definition: rna_define.c:2791
void RNA_def_function_ui_description(FunctionRNA *func, const char *description)
Definition: rna_define.c:4337
void RNA_def_property_update(PropertyRNA *prop, int noteflag, const char *func)
Definition: rna_define.c:2927
const int rna_matrix_dimsize_4x4[]
Definition: rna_define.c:1626
void RNA_def_property_enum_funcs(PropertyRNA *prop, const char *get, const char *set, const char *item)
Definition: rna_define.c:3251
void RNA_def_property_editable_func(PropertyRNA *prop, const char *editable)
Definition: rna_define.c:2877
PropertyRNA * RNA_def_property(StructOrFunctionRNA *cont_, const char *identifier, int type, int subtype)
Definition: rna_define.c:1279
void RNA_def_property_enum_bitflag_sdna(PropertyRNA *prop, const char *structname, const char *propname)
Definition: rna_define.c:2691
void RNA_enum_item_end(EnumPropertyItem **items, int *totitem)
Definition: rna_define.c:4470
void RNA_def_struct_name_property(struct StructRNA *srna, struct PropertyRNA *prop)
Definition: rna_define.c:1122
void RNA_def_function_flag(FunctionRNA *func, int flag)
Definition: rna_define.c:4332
void RNA_def_property_clear_flag(PropertyRNA *prop, PropertyFlag flag)
Definition: rna_define.c:1517
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:3373
StructRNA * RNA_def_struct(BlenderRNA *brna, const char *identifier, const char *from)
Definition: rna_define.c:1047
void RNA_def_property_enum_sdna(PropertyRNA *prop, const char *structname, const char *propname)
Definition: rna_define.c:2623
void RNA_def_property_int_funcs(PropertyRNA *prop, const char *get, const char *set, const char *range)
Definition: rna_define.c:3055
void RNA_def_struct_ui_icon(StructRNA *srna, int icon)
Definition: rna_define.c:1267
PropertyRNA * RNA_def_string(StructOrFunctionRNA *cont_, const char *identifier, const char *default_value, int maxlen, const char *ui_name, const char *ui_description)
Definition: rna_define.c:3675
void RNA_def_property_override_funcs(PropertyRNA *prop, const char *diff, const char *store, const char *apply)
Definition: rna_define.c:2906
void RNA_def_property_translation_context(PropertyRNA *prop, const char *context)
Definition: rna_define.c:2870
void RNA_def_property_flag(PropertyRNA *prop, PropertyFlag flag)
Definition: rna_define.c:1512
void RNA_def_property_override_clear_flag(PropertyRNA *prop, PropertyOverrideFlag flag)
Definition: rna_define.c:1530
PropertyRNA * RNA_def_int(StructOrFunctionRNA *cont_, const char *identifier, int default_value, int hardmin, int hardmax, const char *ui_name, const char *ui_description, int softmin, int softmax)
Definition: rna_define.c:3585
void RNA_def_property_float_sdna(PropertyRNA *prop, const char *structname, const char *propname)
Definition: rna_define.c:2515
void RNA_enum_items_add_value(EnumPropertyItem **items, int *totitem, const EnumPropertyItem *item, int value)
Definition: rna_define.c:4455
void RNA_def_property_ui_range(PropertyRNA *prop, double min, double max, double step, int precision)
Definition: rna_define.c:1706
PropertyRNA * RNA_def_enum(StructOrFunctionRNA *cont_, const char *identifier, const EnumPropertyItem *items, int default_value, const char *ui_name, const char *ui_description)
Definition: rna_define.c:3771
void RNA_def_property_int_sdna(PropertyRNA *prop, const char *structname, const char *propname)
Definition: rna_define.c:2364
void RNA_def_property_float_array_default(PropertyRNA *prop, const float *array)
Definition: rna_define.c:2064
void RNA_def_property_boolean_negative_sdna(PropertyRNA *prop, const char *structname, const char *propname, int64_t booleanbit)
Definition: rna_define.c:2348
void RNA_def_struct_nested(BlenderRNA *brna, StructRNA *srna, const char *structname)
Definition: rna_define.c:1138
void RNA_def_property_override_flag(PropertyRNA *prop, PropertyOverrideFlag flag)
Definition: rna_define.c:1525
void RNA_def_parameter_flags(PropertyRNA *prop, PropertyFlag flag_property, ParameterFlag flag_parameter)
Definition: rna_define.c:1547
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:62
static void rna_def_object_grease_pencil_modifiers(BlenderRNA *brna, PropertyRNA *cprop)
Definition: rna_object.c:2496
const EnumPropertyItem rna_enum_object_empty_drawtype_items[]
Definition: rna_object.c:140
const EnumPropertyItem rna_enum_metaelem_type_items[]
Definition: rna_object.c:223
static void rna_def_object_face_maps(BlenderRNA *brna, PropertyRNA *cprop)
Definition: rna_object.c:2678
#define OBTYPE_CU_CURVE
Definition: rna_object.c:241
#define OBTYPE_CU_FONT
Definition: rna_object.c:249
const EnumPropertyItem rna_enum_workspace_object_mode_items[]
Definition: rna_object.c:103
static void rna_def_object_shaderfxs(BlenderRNA *brna, PropertyRNA *cprop)
Definition: rna_object.c:2546
static const EnumPropertyItem instance_items[]
Definition: rna_object.c:203
static void rna_def_face_map(BlenderRNA *brna)
Definition: rna_object.c:2255
static const EnumPropertyItem parent_type_items[]
Definition: rna_object.c:181
const EnumPropertyItem rna_enum_object_gpencil_type_items[]
Definition: rna_object.c:159
const EnumPropertyItem rna_enum_object_rotation_mode_items[]
Definition: rna_object.c:286
static void rna_def_material_slot(BlenderRNA *brna)
Definition: rna_object.c:2301
static void rna_def_object(BlenderRNA *brna)
Definition: rna_object.c:2806
const EnumPropertyItem rna_enum_lightprobes_type_items[]
Definition: rna_object.c:233
static void rna_def_object_vertex_groups(BlenderRNA *brna, PropertyRNA *cprop)
Definition: rna_object.c:2621
const EnumPropertyItem rna_enum_object_mode_items[]
Definition: rna_object.c:65
static void rna_def_object_lineart(BlenderRNA *brna)
Definition: rna_object.c:2749
const EnumPropertyItem rna_enum_object_axis_items[]
Definition: rna_object.c:302
const EnumPropertyItem rna_enum_object_type_curve_items[]
Definition: rna_object.c:279
#define INSTANCE_ITEM_COLLECTION
Definition: rna_object.c:199
const EnumPropertyItem rna_enum_object_type_items[]
Definition: rna_object.c:254
#define OBTYPE_CU_SURF
Definition: rna_object.c:245
static void rna_def_object_modifiers(BlenderRNA *brna, PropertyRNA *cprop)
Definition: rna_object.c:2429
static const EnumPropertyItem rna_enum_object_empty_image_depth_items[]
Definition: rna_object.c:152
static void rna_def_vertex_group(BlenderRNA *brna)
Definition: rna_object.c:2189
static void rna_def_object_display(BlenderRNA *brna)
Definition: rna_object.c:2727
static void rna_def_object_constraints(BlenderRNA *brna, PropertyRNA *cprop)
Definition: rna_object.c:2358
static void rna_def_object_particle_systems(BlenderRNA *brna, PropertyRNA *cprop)
Definition: rna_object.c:2588
void RNA_def_object(BlenderRNA *brna)
Definition: rna_object.c:3613
#define INSTANCE_ITEMS_SHARED
Definition: rna_object.c:192
const EnumPropertyItem rna_enum_object_shaderfx_type_items[]
Definition: rna_shader_fx.c:47
#define min(a, b)
Definition: sort.c:51
short selectmode
Definition: BKE_editmesh.h:72
short mat_nr
Definition: BKE_editmesh.h:73
struct GpencilModifierData * next
Definition: DNA_ID.h:273
int tag
Definition: DNA_ID.h:292
char name[66]
Definition: DNA_ID.h:283
Definition: BKE_main.h:116
struct BMEditMesh * edit_mesh
char symmetry
char editflag
struct ModifierData * next
short partype
ListBase particlesystem
ListBase defbase
ListBase constraints
struct Collection * instance_collection
ListBase modifiers
ListBase greasepencil_modifiers
struct Material ** mat
char * matbits
struct PartDeflect * pd
unsigned short actfmap
float rot[3]
short shapenr
float parentinv[4][4]
unsigned short actdef
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:52
struct ID * owner_id
Definition: RNA_types.h:50
struct BMesh * bm
Definition: BKE_paint.h:493
struct bConstraint * next
char name[64]
float max
void WM_main_add_notifier(unsigned int type, void *reference)
PointerRNA * ptr
Definition: wm_files.c:3157