Blender V5.0
rna_object.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2023 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
8
9#include <cstdlib>
10
11#include "DNA_action_types.h"
12#include "DNA_layer_types.h"
14#include "DNA_meta_types.h"
15#include "DNA_object_types.h"
16
17#include "BLI_math_rotation.h"
18
19#include "BLT_translation.hh"
20
21#include "BKE_paint.hh"
22
23#include "RNA_define.hh"
24#include "RNA_enum_types.hh"
25
26#include "rna_internal.hh"
27
28#include "ED_object_vgroup.hh"
29
30#include "WM_api.hh"
31#include "WM_types.hh"
32
34 {OB_MODE_OBJECT, "OBJECT", ICON_OBJECT_DATAMODE, "Object Mode", ""},
35 {OB_MODE_EDIT, "EDIT", ICON_EDITMODE_HLT, "Edit Mode", ""},
36 {OB_MODE_POSE, "POSE", ICON_POSE_HLT, "Pose Mode", ""},
37 {OB_MODE_SCULPT, "SCULPT", ICON_SCULPTMODE_HLT, "Sculpt Mode", ""},
38 {OB_MODE_VERTEX_PAINT, "VERTEX_PAINT", ICON_VPAINT_HLT, "Vertex Paint", ""},
39 {OB_MODE_WEIGHT_PAINT, "WEIGHT_PAINT", ICON_WPAINT_HLT, "Weight Paint", ""},
40 {OB_MODE_TEXTURE_PAINT, "TEXTURE_PAINT", ICON_TPAINT_HLT, "Texture Paint", ""},
41 {OB_MODE_PARTICLE_EDIT, "PARTICLE_EDIT", ICON_PARTICLEMODE, "Particle Edit", ""},
43 "EDIT_GPENCIL",
44 ICON_EDITMODE_HLT,
45 "Edit Mode",
46 "Edit Grease Pencil Strokes"},
48 "SCULPT_GREASE_PENCIL",
49 ICON_SCULPTMODE_HLT,
50 "Sculpt Mode",
51 "Sculpt Grease Pencil Strokes"},
53 "PAINT_GREASE_PENCIL",
54 ICON_GREASEPENCIL,
55 "Draw Mode",
56 "Paint Grease Pencil Strokes"},
58 "WEIGHT_GREASE_PENCIL",
59 ICON_WPAINT_HLT,
60 "Weight Paint",
61 "Grease Pencil Weight Paint Strokes"},
63 "VERTEX_GREASE_PENCIL",
64 ICON_VPAINT_HLT,
65 "Vertex Paint",
66 "Grease Pencil Vertex Paint Strokes"},
67 {OB_MODE_SCULPT_CURVES, "SCULPT_CURVES", ICON_SCULPTMODE_HLT, "Sculpt Mode", ""},
68 {0, nullptr, 0, nullptr, nullptr},
69};
70
72 {OB_MODE_OBJECT, "OBJECT", ICON_OBJECT_DATAMODE, "Object Mode", ""},
73 {OB_MODE_EDIT, "EDIT", ICON_EDITMODE_HLT, "Edit Mode", ""},
74 {OB_MODE_POSE, "POSE", ICON_POSE_HLT, "Pose Mode", ""},
75 {OB_MODE_SCULPT, "SCULPT", ICON_SCULPTMODE_HLT, "Sculpt Mode", ""},
76 {OB_MODE_VERTEX_PAINT, "VERTEX_PAINT", ICON_VPAINT_HLT, "Vertex Paint", ""},
77 {OB_MODE_WEIGHT_PAINT, "WEIGHT_PAINT", ICON_WPAINT_HLT, "Weight Paint", ""},
78 {OB_MODE_TEXTURE_PAINT, "TEXTURE_PAINT", ICON_TPAINT_HLT, "Texture Paint", ""},
79 {OB_MODE_PARTICLE_EDIT, "PARTICLE_EDIT", ICON_PARTICLEMODE, "Particle Edit", ""},
81 "EDIT_GPENCIL",
82 ICON_EDITMODE_HLT,
83 "Grease Pencil Edit Mode",
84 "Edit Grease Pencil Strokes"},
86 "SCULPT_GREASE_PENCIL",
87 ICON_SCULPTMODE_HLT,
88 "Grease Pencil Sculpt Mode",
89 "Sculpt Grease Pencil Strokes"},
91 "PAINT_GREASE_PENCIL",
92 ICON_GREASEPENCIL,
93 "Grease Pencil Draw",
94 "Paint Grease Pencil Strokes"},
96 "VERTEX_GREASE_PENCIL",
97 ICON_VPAINT_HLT,
98 "Grease Pencil Vertex Paint",
99 "Grease Pencil Vertex Paint Strokes"},
101 "WEIGHT_GREASE_PENCIL",
102 ICON_WPAINT_HLT,
103 "Grease Pencil Weight Paint",
104 "Grease Pencil Weight Paint Strokes"},
105 {0, nullptr, 0, nullptr, nullptr},
106};
107
109 {OB_PLAINAXES, "PLAIN_AXES", ICON_EMPTY_AXIS, "Plain Axes", ""},
110 {OB_ARROWS, "ARROWS", ICON_EMPTY_ARROWS, "Arrows", ""},
111 {OB_SINGLE_ARROW, "SINGLE_ARROW", ICON_EMPTY_SINGLE_ARROW, "Single Arrow", ""},
112 {OB_CIRCLE, "CIRCLE", ICON_MESH_CIRCLE, "Circle", ""},
113 {OB_CUBE, "CUBE", ICON_CUBE, "Cube", ""},
114 {OB_EMPTY_SPHERE, "SPHERE", ICON_SPHERE, "Sphere", ""},
115 {OB_EMPTY_CONE, "CONE", ICON_CONE, "Cone", ""},
116 {OB_EMPTY_IMAGE, "IMAGE", ICON_FILE_IMAGE, "Image", ""},
117 {0, nullptr, 0, nullptr, nullptr},
118};
119
121 {OB_EMPTY_IMAGE_DEPTH_DEFAULT, "DEFAULT", 0, "Default", ""},
122 {OB_EMPTY_IMAGE_DEPTH_FRONT, "FRONT", 0, "Front", ""},
123 {OB_EMPTY_IMAGE_DEPTH_BACK, "BACK", 0, "Back", ""},
124 {0, nullptr, 0, nullptr, nullptr},
125};
126
128 {GP_EMPTY, "EMPTY", ICON_EMPTY_AXIS, "Blank", "Create an empty Grease Pencil object"},
129 {GP_STROKE, "STROKE", ICON_STROKE, "Stroke", "Create a simple stroke with basic colors"},
130 {GP_MONKEY, "MONKEY", ICON_MONKEY, "Monkey", "Construct a Suzanne Grease Pencil object"},
133 "LINEART_SCENE",
134 ICON_SCENE_DATA,
135 "Scene Line Art",
136 "Quickly set up Line Art for the entire scene"},
138 "LINEART_COLLECTION",
139 ICON_OUTLINER_COLLECTION,
140 "Collection Line Art",
141 "Quickly set up Line Art for the active collection"},
143 "LINEART_OBJECT",
144 ICON_OBJECT_DATA,
145 "Object Line Art",
146 "Quickly set up Line Art for the active object"},
147 {0, nullptr, 0, nullptr, nullptr}};
148
150 {PAROBJECT, "OBJECT", 0, "Object", "The object is parented to an object"},
151 {PARSKEL, "ARMATURE", 0, "Armature", ""},
152 /* PARSKEL reuse will give issues. */
153 {PARSKEL, "LATTICE", 0, "Lattice", "The object is parented to a lattice"},
154 {PARVERT1, "VERTEX", 0, "Vertex", "The object is parented to a vertex"},
155 {PARVERT3, "VERTEX_3", 0, "3 Vertices", ""},
156 {PARBONE, "BONE", 0, "Bone", "The object is parented to a bone"},
157 {0, nullptr, 0, nullptr, nullptr},
158};
159
160#define INSTANCE_ITEMS_SHARED \
161 {0, "NONE", 0, "None", ""}, \
162 {OB_DUPLIVERTS, "VERTS", 0, "Vertices", "Instantiate child objects on all vertices"}, \
163 {OB_DUPLIFACES, "FACES", 0, "Faces", "Instantiate child objects on all faces"}
164
165#define INSTANCE_ITEM_COLLECTION \
166 {OB_DUPLICOLLECTION, "COLLECTION", 0, "Collection", "Enable collection instancing"}
170 {0, nullptr, 0, nullptr, nullptr},
171};
172#ifdef RNA_RUNTIME
173static EnumPropertyItem instance_items_nogroup[] = {
175 {0, nullptr, 0, nullptr, nullptr},
176};
177
178static EnumPropertyItem instance_items_empty[] = {
179 {0, "NONE", 0, "None", ""},
181 {0, nullptr, 0, nullptr, nullptr},
182};
183
184static EnumPropertyItem instance_items_font[] = {
185 {0, "NONE", 0, "None", ""},
186 {OB_DUPLIVERTS, "VERTS", 0, "Vertices", "Use Object Font on characters"},
187 {0, nullptr, 0, nullptr, nullptr},
188};
189#endif
190#undef INSTANCE_ITEMS_SHARED
191#undef INSTANCE_ITEM_COLLECTION
192
194 {MB_BALL, "BALL", ICON_META_BALL, "Ball", ""},
195 {MB_TUBE, "CAPSULE", ICON_META_CAPSULE, "Capsule", ""},
196 {MB_PLANE, "PLANE", ICON_META_PLANE, "Plane", ""},
197 /* NOTE: typo at original definition! */
198 {MB_ELIPSOID, "ELLIPSOID", ICON_META_ELLIPSOID, "Ellipsoid", ""},
199 {MB_CUBE, "CUBE", ICON_META_CUBE, "Cube", ""},
200 {0, nullptr, 0, nullptr, nullptr},
201};
202
204 {LIGHTPROBE_TYPE_SPHERE, "SPHERE", ICON_LIGHTPROBE_SPHERE, "Sphere", ""},
205 {LIGHTPROBE_TYPE_PLANE, "PLANE", ICON_LIGHTPROBE_PLANE, "Plane", ""},
206 {LIGHTPROBE_TYPE_VOLUME, "VOLUME", ICON_LIGHTPROBE_VOLUME, "Volume", ""},
207 {0, nullptr, 0, nullptr, nullptr},
208};
209
210/* used for 2 enums */
211#define OBTYPE_CU_CURVE {OB_CURVES_LEGACY, "CURVE", ICON_OUTLINER_OB_CURVE, "Curve", ""}
212#define OBTYPE_CU_SURF {OB_SURF, "SURFACE", ICON_OUTLINER_OB_SURFACE, "Surface", ""}
213#define OBTYPE_CU_FONT {OB_FONT, "FONT", ICON_OUTLINER_OB_FONT, "Text", ""}
214
216 {OB_MESH, "MESH", ICON_OUTLINER_OB_MESH, "Mesh", ""},
219 {OB_MBALL, "META", ICON_OUTLINER_OB_META, "Metaball", ""},
221 {OB_CURVES, "CURVES", ICON_OUTLINER_OB_CURVES, "Hair Curves", ""},
222 {OB_POINTCLOUD, "POINTCLOUD", ICON_OUTLINER_OB_POINTCLOUD, "Point Cloud", ""},
223 {OB_VOLUME, "VOLUME", ICON_OUTLINER_OB_VOLUME, "Volume", ""},
224 {OB_GREASE_PENCIL, "GREASEPENCIL", ICON_OUTLINER_OB_GREASEPENCIL, "Grease Pencil", ""},
226 {OB_ARMATURE, "ARMATURE", ICON_OUTLINER_OB_ARMATURE, "Armature", ""},
227 {OB_LATTICE, "LATTICE", ICON_OUTLINER_OB_LATTICE, "Lattice", ""},
229 {OB_EMPTY, "EMPTY", ICON_OUTLINER_OB_EMPTY, "Empty", ""},
231 {OB_LAMP, "LIGHT", ICON_OUTLINER_OB_LIGHT, "Light", ""},
232 {OB_LIGHTPROBE, "LIGHT_PROBE", ICON_OUTLINER_OB_LIGHTPROBE, "Light Probe", ""},
234 {OB_CAMERA, "CAMERA", ICON_OUTLINER_OB_CAMERA, "Camera", ""},
236 {OB_SPEAKER, "SPEAKER", ICON_OUTLINER_OB_SPEAKER, "Speaker", ""},
237 {0, nullptr, 0, nullptr, nullptr},
238};
239
244 {0, nullptr, 0, nullptr, nullptr},
245};
246
248 {ROT_MODE_QUAT, "QUATERNION", 0, "Quaternion (WXYZ)", "No Gimbal Lock"},
249 {ROT_MODE_XYZ, "XYZ", 0, "XYZ Euler", "XYZ Rotation Order - prone to Gimbal Lock (default)"},
250 {ROT_MODE_XZY, "XZY", 0, "XZY Euler", "XZY Rotation Order - prone to Gimbal Lock"},
251 {ROT_MODE_YXZ, "YXZ", 0, "YXZ Euler", "YXZ Rotation Order - prone to Gimbal Lock"},
252 {ROT_MODE_YZX, "YZX", 0, "YZX Euler", "YZX Rotation Order - prone to Gimbal Lock"},
253 {ROT_MODE_ZXY, "ZXY", 0, "ZXY Euler", "ZXY Rotation Order - prone to Gimbal Lock"},
254 {ROT_MODE_ZYX, "ZYX", 0, "ZYX Euler", "ZYX Rotation Order - prone to Gimbal Lock"},
256 "AXIS_ANGLE",
257 0,
258 "Axis Angle",
259 "Axis Angle (W+XYZ), defines a rotation around some axis defined by 3D-Vector"},
260 {0, nullptr, 0, nullptr, nullptr},
261};
262
264 {OB_POSX, "POS_X", 0, "+X", ""},
265 {OB_POSY, "POS_Y", 0, "+Y", ""},
266 {OB_POSZ, "POS_Z", 0, "+Z", ""},
267 {OB_NEGX, "NEG_X", 0, "-X", ""},
268 {OB_NEGY, "NEG_Y", 0, "-Y", ""},
269 {OB_NEGZ, "NEG_Z", 0, "-Z", ""},
270 {0, nullptr, 0, nullptr, nullptr},
271};
272
273#ifdef RNA_RUNTIME
274
275# include <algorithm>
276
277# include <fmt/format.h>
278
279# include "BLI_bounds.hh"
280
281# include "DNA_ID.h"
282# include "DNA_constraint_types.h"
285# include "DNA_key_types.h"
286# include "DNA_lattice_types.h"
287# include "DNA_material_types.h"
288# include "DNA_node_types.h"
289
290# include "BLI_math_matrix.h"
291# include "BLI_math_vector.h"
292
293# include "BKE_armature.hh"
294# include "BKE_brush.hh"
295# include "BKE_camera.h"
296# include "BKE_collection.hh"
297# include "BKE_constraint.h"
298# include "BKE_context.hh"
299# include "BKE_curve.hh"
300# include "BKE_deform.hh"
301# include "BKE_editlattice.h"
302# include "BKE_editmesh.hh"
303# include "BKE_effect.h"
304# include "BKE_global.hh"
305# include "BKE_key.hh"
306# include "BKE_layer.hh"
307# include "BKE_library.hh"
308# include "BKE_light_linking.h"
309# include "BKE_material.hh"
310# include "BKE_mesh.hh"
311# include "BKE_mesh_wrapper.hh"
312# include "BKE_modifier.hh"
313# include "BKE_object.hh"
314# include "BKE_object_deform.h"
315# include "BKE_particle.h"
316# include "BKE_scene.hh"
317
318# include "DEG_depsgraph.hh"
319# include "DEG_depsgraph_build.hh"
320
321# include "ED_curve.hh"
322# include "ED_lattice.hh"
323# include "ED_mesh.hh"
324# include "ED_object.hh"
325# include "ED_particle.hh"
326
327# include "DEG_depsgraph_query.hh"
328
329static void rna_Object_internal_update(Main * /*bmain*/, Scene * /*scene*/, PointerRNA *ptr)
330{
332}
333
334static void rna_Object_internal_update_draw(Main * /*bmain*/, Scene * /*scene*/, PointerRNA *ptr)
335{
338}
339
340static void rna_Object_matrix_world_update(Main *bmain, Scene *scene, PointerRNA *ptr)
341{
342 /* Don't use compatibility so we get predictable rotation. */
343 Object *ob = reinterpret_cast<Object *>(ptr->owner_id);
344 BKE_object_apply_mat4(ob, ob->object_to_world().ptr(), false, true);
345 rna_Object_internal_update(bmain, scene, ptr);
346}
347
348static void rna_Object_hide_update(Main *bmain, Scene * /*scene*/, PointerRNA *ptr)
349{
350 Object *ob = reinterpret_cast<Object *>(ptr->owner_id);
355}
356
357static void rna_Object_duplicator_visibility_flag_update(Main * /*bmain*/,
358 Scene * /*scene*/,
360{
361 Object *ob = reinterpret_cast<Object *>(ptr->owner_id);
363}
364
365static void rna_grease_pencil_update(Main * /*bmain*/, Scene * /*scene*/, PointerRNA *ptr)
366{
367 Object *ob = reinterpret_cast<Object *>(ptr->owner_id);
368 if (ob && ob->type == OB_GREASE_PENCIL) {
369 GreasePencil *grease_pencil = static_cast<GreasePencil *>(ob->data);
370 DEG_id_tag_update(&grease_pencil->id, ID_RECALC_GEOMETRY);
372 }
373}
374
375static void rna_Object_matrix_world_get(PointerRNA *ptr, float *values)
376{
377 Object *ob = static_cast<Object *>(ptr->data);
378 std::copy_n(ob->object_to_world().base_ptr(), 16, values);
379}
380
381static void rna_Object_matrix_world_set(PointerRNA *ptr, const float *values)
382{
383 Object *ob = static_cast<Object *>(ptr->data);
384 ob->runtime->object_to_world = blender::float4x4(values);
385}
386
387static void rna_Object_matrix_local_get(PointerRNA *ptr, float values[16])
388{
389 Object *ob = reinterpret_cast<Object *>(ptr->owner_id);
390 BKE_object_matrix_local_get(ob, (float (*)[4])values);
391}
392
393static void rna_Object_matrix_local_set(PointerRNA *ptr, const float values[16])
394{
395 Object *ob = reinterpret_cast<Object *>(ptr->owner_id);
396 float local_mat[4][4];
397
398 /* Local-space matrix is truly relative to the parent,
399 * but parameters stored in object are relative to parentinv matrix.
400 * Undo the parent inverse part before applying it as local matrix. */
401 if (ob->parent) {
402 float invmat[4][4];
403 invert_m4_m4(invmat, ob->parentinv);
404 mul_m4_m4m4(local_mat, invmat, (float (*)[4])values);
405 }
406 else {
407 copy_m4_m4(local_mat, (float (*)[4])values);
408 }
409
410 /* Don't use compatible so we get predictable rotation, and do not use parenting either,
411 * because it's a local matrix! */
412 BKE_object_apply_mat4(ob, local_mat, false, false);
413}
414
415static void rna_Object_matrix_basis_get(PointerRNA *ptr, float values[16])
416{
417 Object *ob = reinterpret_cast<Object *>(ptr->owner_id);
418 BKE_object_to_mat4(ob, (float (*)[4])values);
419}
420
421static void rna_Object_matrix_basis_set(PointerRNA *ptr, const float values[16])
422{
423 Object *ob = reinterpret_cast<Object *>(ptr->owner_id);
424 BKE_object_apply_mat4(ob, (float (*)[4])values, false, false);
425}
426
427void rna_Object_internal_update_data_impl(PointerRNA *ptr)
428{
431}
432
433void rna_Object_internal_update_data(Main * /*bmain*/, Scene * /*scene*/, PointerRNA *ptr)
434{
435 rna_Object_internal_update_data_impl(ptr);
436}
437
438void rna_Object_internal_update_data_dependency(Main *bmain, Scene * /*scene*/, PointerRNA *ptr)
439{
441 rna_Object_internal_update_data_impl(ptr);
442}
443
444static void rna_Object_active_shape_update(Main *bmain, Scene * /*scene*/, PointerRNA *ptr)
445{
446 Object *ob = reinterpret_cast<Object *>(ptr->owner_id);
447
449 /* exit/enter editmode to get new shape */
450 switch (ob->type) {
451 case OB_MESH: {
452 Mesh *mesh = static_cast<Mesh *>(ob->data);
453 BMEditMesh *em = mesh->runtime->edit_mesh.get();
454 int select_mode = em->selectmode;
455 EDBM_mesh_load(bmain, ob);
456 EDBM_mesh_make(ob, select_mode, true);
457 em = mesh->runtime->edit_mesh.get();
458
459 DEG_id_tag_update(&mesh->id, 0);
460
462 break;
463 }
464 case OB_CURVES_LEGACY:
465 case OB_SURF:
466 ED_curve_editnurb_load(bmain, ob);
468 break;
469 case OB_LATTICE:
472 break;
473 }
474 }
475
476 rna_Object_internal_update_data_impl(ptr);
477}
478
479static void rna_Object_dependency_update(Main *bmain, Scene * /*scene*/, PointerRNA *ptr)
480{
484}
485
486void rna_Object_data_update(Main *bmain, Scene *scene, PointerRNA *ptr)
487{
488 rna_Object_internal_update_data_dependency(bmain, scene, ptr);
489}
490
491static PointerRNA rna_Object_data_get(PointerRNA *ptr)
492{
493 Object *ob = static_cast<Object *>(ptr->data);
494 if (ob->type == OB_MESH) {
495 Mesh *mesh = static_cast<Mesh *>(ob->data);
497 return RNA_id_pointer_create(reinterpret_cast<ID *>(mesh));
498 }
499 return RNA_id_pointer_create(reinterpret_cast<ID *>(ob->data));
500}
501
502static void rna_Object_data_set(PointerRNA *ptr, PointerRNA value, ReportList *reports)
503{
504 Object *ob = static_cast<Object *>(ptr->data);
505 ID *id = static_cast<ID *>(value.data);
506
507 if (ob->mode & OB_MODE_EDIT) {
508 return;
509 }
510
511 /* assigning nullptr only for empties */
512 if ((id == nullptr) && (ob->type != OB_EMPTY)) {
513 return;
514 }
515
516 if (id && ((id->tag & ID_TAG_NO_MAIN) != (ob->id.tag & ID_TAG_NO_MAIN))) {
517 BKE_report(reports,
518 RPT_ERROR,
519 "Can only assign evaluated data to evaluated object, or original data to "
520 "original object");
521 return;
522 }
523
524 if (ob->type == OB_EMPTY) {
525 if (ob->data) {
526 id_us_min(static_cast<ID *>(ob->data));
527 ob->data = nullptr;
528 }
529
530 if (!id || GS(id->name) == ID_IM) {
531 id_us_plus(id);
532 ob->data = id;
533 }
534 }
535 else if (ob->type == OB_MESH) {
536 BKE_mesh_assign_object(G_MAIN, ob, reinterpret_cast<Mesh *>(id));
537 }
538 else {
539 if (ob->data) {
540 id_us_min(static_cast<ID *>(ob->data));
541 }
542
543 /* no need to type-check here ID. this is done in the _typef() function */
545 id_us_plus(id);
546
547 ob->data = id;
549
550 if (GS(id->name) == ID_CU_LEGACY) {
551 BKE_curve_type_test(ob, true);
552 }
553 else if (ob->type == OB_ARMATURE) {
554 BKE_pose_rebuild(G_MAIN, ob, static_cast<bArmature *>(ob->data), true);
555 }
556 }
557}
558
559static StructRNA *rna_Object_data_typef(PointerRNA *ptr)
560{
561 Object *ob = static_cast<Object *>(ptr->data);
562
563 /* keep in sync with OB_DATA_SUPPORT_ID() macro */
564 switch (ob->type) {
565 case OB_EMPTY:
566 return &RNA_Image;
567 case OB_MESH:
568 return &RNA_Mesh;
569 case OB_CURVES_LEGACY:
570 return &RNA_Curve;
571 case OB_SURF:
572 return &RNA_Curve;
573 case OB_FONT:
574 return &RNA_Curve;
575 case OB_MBALL:
576 return &RNA_MetaBall;
577 case OB_LAMP:
578 return &RNA_Light;
579 case OB_CAMERA:
580 return &RNA_Camera;
581 case OB_LATTICE:
582 return &RNA_Lattice;
583 case OB_ARMATURE:
584 return &RNA_Armature;
585 case OB_SPEAKER:
586 return &RNA_Speaker;
587 case OB_LIGHTPROBE:
588 return &RNA_LightProbe;
590 return &RNA_Annotation;
591 case OB_GREASE_PENCIL:
592 return &RNA_GreasePencil;
593 case OB_CURVES:
594 return &RNA_Curves;
595 case OB_POINTCLOUD:
596 return &RNA_PointCloud;
597 case OB_VOLUME:
598 return &RNA_Volume;
599 default:
600 return &RNA_ID;
601 }
602}
603
604static void rna_Object_parent_set(PointerRNA *ptr, PointerRNA value, ReportList * /*reports*/)
605{
606 Object *ob = static_cast<Object *>(ptr->data);
607 Object *par = static_cast<Object *>(value.data);
608
609 {
611 }
612}
613
614static bool rna_Object_parent_override_apply(Main *bmain,
616{
617 PointerRNA *ptr_dst = &rnaapply_ctx.ptr_dst;
618 PointerRNA *ptr_src = &rnaapply_ctx.ptr_src;
619 PointerRNA *ptr_storage = &rnaapply_ctx.ptr_storage;
620 PropertyRNA *prop_dst = rnaapply_ctx.prop_dst;
621 PropertyRNA *prop_src = rnaapply_ctx.prop_src;
622 const int len_dst = rnaapply_ctx.len_src;
623 const int len_src = rnaapply_ctx.len_src;
624 const int len_storage = rnaapply_ctx.len_storage;
626
627 BLI_assert(len_dst == len_src && (!ptr_storage || len_dst == len_storage) && len_dst == 0);
629 "Unsupported RNA override operation on object parent pointer");
630 UNUSED_VARS_NDEBUG(ptr_storage, len_dst, len_src, len_storage, opop);
631
632 /* We need a special handling here because setting parent resets invert parent matrix,
633 * which is evil in our case. */
634 Object *ob = static_cast<Object *>(ptr_dst->data);
635 Object *parent_dst = static_cast<Object *>(RNA_property_pointer_get(ptr_dst, prop_dst).data);
636 Object *parent_src = static_cast<Object *>(RNA_property_pointer_get(ptr_src, prop_src).data);
637
638 if (parent_src == parent_dst) {
639 return false;
640 }
641
642 if (parent_src == nullptr) {
643 /* The only case where we do want default behavior (with matrix reset). */
644 blender::ed::object::parent_set(ob, parent_src, ob->partype, ob->parsubstr);
645 }
646 else {
647 ob->parent = parent_src;
648 }
649 RNA_property_update_main(bmain, nullptr, ptr_dst, prop_dst);
650 return true;
651}
652
653static void rna_Object_parent_type_set(PointerRNA *ptr, int value)
654{
655 Object *ob = static_cast<Object *>(ptr->data);
656
657 /* Skip if type did not change (otherwise we loose parent inverse in
658 * blender::ed::object::parent_set). */
659 if (ob->partype == value) {
660 return;
661 }
662
664}
665
666static bool rna_Object_parent_type_override_apply(Main *bmain,
668{
669 PointerRNA *ptr_dst = &rnaapply_ctx.ptr_dst;
670 PointerRNA *ptr_src = &rnaapply_ctx.ptr_src;
671 PointerRNA *ptr_storage = &rnaapply_ctx.ptr_storage;
672 PropertyRNA *prop_dst = rnaapply_ctx.prop_dst;
673 PropertyRNA *prop_src = rnaapply_ctx.prop_src;
674 const int len_dst = rnaapply_ctx.len_src;
675 const int len_src = rnaapply_ctx.len_src;
676 const int len_storage = rnaapply_ctx.len_storage;
678
679 BLI_assert(len_dst == len_src && (!ptr_storage || len_dst == len_storage) && len_dst == 0);
681 "Unsupported RNA override operation on object parent pointer");
682 UNUSED_VARS_NDEBUG(ptr_storage, len_dst, len_src, len_storage, opop);
683
684 /* We need a special handling here because setting parent resets invert parent matrix,
685 * which is evil in our case. */
686 Object *ob = (Object *)(ptr_dst->data);
687 const int parent_type_dst = RNA_property_enum_get(ptr_dst, prop_dst);
688 const int parent_type_src = RNA_property_enum_get(ptr_src, prop_src);
689
690 if (parent_type_dst == parent_type_src) {
691 return false;
692 }
693
694 ob->partype = parent_type_src;
695 RNA_property_update_main(bmain, nullptr, ptr_dst, prop_dst);
696 return true;
697}
698
699static const EnumPropertyItem *rna_Object_parent_type_itemf(bContext * /*C*/,
701 PropertyRNA * /*prop*/,
702 bool *r_free)
703{
704 Object *ob = static_cast<Object *>(ptr->data);
705 EnumPropertyItem *item = nullptr;
706 int totitem = 0;
707
709
710 if (ob->parent) {
711 Object *par = ob->parent;
712
713 if (par->type == OB_LATTICE) {
714 /* special hack: prevents this overriding others */
716 }
717 else if (par->type == OB_ARMATURE) {
718 /* special hack: prevents this being overridden */
721 }
722
723 if (OB_TYPE_SUPPORT_PARVERT(par->type)) {
726 }
727 }
728
729 RNA_enum_item_end(&item, &totitem);
730 *r_free = true;
731
732 return item;
733}
734
735static void rna_Object_empty_display_type_set(PointerRNA *ptr, int value)
736{
737 Object *ob = static_cast<Object *>(ptr->data);
738
740}
741
742static void rna_Object_parent_bone_set(PointerRNA *ptr, const char *value)
743{
744 Object *ob = static_cast<Object *>(ptr->data);
745
747}
748
749static bool rna_Object_parent_bone_override_apply(Main *bmain,
751{
752 PointerRNA *ptr_dst = &rnaapply_ctx.ptr_dst;
753 PointerRNA *ptr_src = &rnaapply_ctx.ptr_src;
754 PointerRNA *ptr_storage = &rnaapply_ctx.ptr_storage;
755 PropertyRNA *prop_dst = rnaapply_ctx.prop_dst;
756 PropertyRNA *prop_src = rnaapply_ctx.prop_src;
757 const int len_dst = rnaapply_ctx.len_src;
758 const int len_src = rnaapply_ctx.len_src;
759 const int len_storage = rnaapply_ctx.len_storage;
761
762 BLI_assert(len_dst == len_src && (!ptr_storage || len_dst == len_storage) && len_dst == 0);
764 "Unsupported RNA override operation on object parent bone property");
765 UNUSED_VARS_NDEBUG(ptr_storage, len_dst, len_src, len_storage, opop);
766
767 /* We need a special handling here because setting parent resets invert parent matrix,
768 * which is evil in our case. */
769 Object *ob = (Object *)(ptr_dst->data);
770 char parent_bone_dst[MAX_ID_NAME - 2];
771 RNA_property_string_get(ptr_dst, prop_dst, parent_bone_dst);
772 char parent_bone_src[MAX_ID_NAME - 2];
773 RNA_property_string_get(ptr_src, prop_src, parent_bone_src);
774
775 if (STREQ(parent_bone_src, parent_bone_dst)) {
776 return false;
777 }
778
779 STRNCPY(ob->parsubstr, parent_bone_src);
780 RNA_property_update_main(bmain, nullptr, ptr_dst, prop_dst);
781 return true;
782}
783
784static const EnumPropertyItem *rna_Object_instance_type_itemf(bContext * /*C*/,
786 PropertyRNA * /*prop*/,
787 bool * /*r_free*/)
788{
789 Object *ob = static_cast<Object *>(ptr->data);
790 const EnumPropertyItem *item;
791
792 if (ob->type == OB_EMPTY) {
793 item = instance_items_empty;
794 }
795 else if (ob->type == OB_FONT) {
796 item = instance_items_font;
797 }
798 else {
799 item = instance_items_nogroup;
800 }
801
802 return item;
803}
804
805static void rna_Object_dup_collection_set(PointerRNA *ptr,
806 PointerRNA value,
807 ReportList * /*reports*/)
808{
809 Object *ob = static_cast<Object *>(ptr->data);
810 Collection *grp = static_cast<Collection *>(value.data);
811
812 /* Must not let this be set if the object belongs in this group already,
813 * thus causing a cycle/infinite-recursion leading to crashes on load #25298. */
814 if (BKE_collection_has_object_recursive(grp, ob) == 0) {
815 if (ob->type == OB_EMPTY) {
817 ob->instance_collection = grp;
819 }
820 else {
821 BKE_report(nullptr, RPT_ERROR, "Only empty objects support collection instances");
822 }
823 }
824 else {
826 nullptr,
827 RPT_ERROR,
828 "Cannot set instance-collection as object belongs in collection being instanced, thus "
829 "causing a cycle");
830 }
831}
832
833static void rna_Object_vertex_groups_update(Main * /*bmain*/, Scene * /*scene*/, PointerRNA *ptr)
834{
835 Object *ob = reinterpret_cast<Object *>(ptr->owner_id);
837 rna_Object_internal_update_data_impl(ptr);
838}
839
840static void rna_Object_vertex_groups_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
841{
842 Object *ob = static_cast<Object *>(ptr->data);
844 iter->valid = 0;
845 return;
846 }
847
849 iter->valid = defbase != nullptr;
850
851 rna_iterator_listbase_begin(iter, ptr, defbase, nullptr);
852}
853
854static void rna_VertexGroup_name_set(PointerRNA *ptr, const char *value)
855{
856 Object *ob = reinterpret_cast<Object *>(ptr->owner_id);
858 return;
859 }
860
861 bDeformGroup *dg = static_cast<bDeformGroup *>(ptr->data);
862 BKE_object_defgroup_set_name(dg, ob, value);
863}
864
865static int rna_VertexGroup_index_get(PointerRNA *ptr)
866{
867 Object *ob = reinterpret_cast<Object *>(ptr->owner_id);
869 return -1;
870 }
871
872 const ListBase *defbase = BKE_object_defgroup_list(ob);
873 return BLI_findindex(defbase, ptr->data);
874}
875
876static PointerRNA rna_Object_active_vertex_group_get(PointerRNA *ptr)
877{
878 Object *ob = reinterpret_cast<Object *>(ptr->owner_id);
880 return PointerRNA_NULL;
881 }
882
883 const ListBase *defbase = BKE_object_defgroup_list(ob);
884
886 *ptr, &RNA_VertexGroup, BLI_findlink(defbase, BKE_object_defgroup_active_index_get(ob) - 1));
887}
888
889static void rna_Object_active_vertex_group_set(PointerRNA *ptr,
890 PointerRNA value,
891 ReportList *reports)
892{
893 Object *ob = reinterpret_cast<Object *>(ptr->owner_id);
895 return;
896 }
897
898 const ListBase *defbase = BKE_object_defgroup_list(ob);
899
900 int index = BLI_findindex(defbase, value.data);
901 if (index == -1) {
902 BKE_reportf(reports,
903 RPT_ERROR,
904 "VertexGroup '%s' not found in object '%s'",
905 (static_cast<bDeformGroup *>(value.data))->name,
906 ob->id.name + 2);
907 return;
908 }
909
911}
912
913static int rna_Object_active_vertex_group_index_get(PointerRNA *ptr)
914{
915 Object *ob = reinterpret_cast<Object *>(ptr->owner_id);
917 return -1;
918 }
919
921}
922
923static void rna_Object_active_vertex_group_index_set(PointerRNA *ptr, int value)
924{
925 Object *ob = reinterpret_cast<Object *>(ptr->owner_id);
927 return;
928 }
929
931}
932
933static void rna_Object_active_vertex_group_index_range(
934 PointerRNA *ptr, int *min, int *max, int * /*softmin*/, int * /*softmax*/)
935{
936 Object *ob = reinterpret_cast<Object *>(ptr->owner_id);
937
938 *min = 0;
940 *max = 0;
941 return;
942 }
943 const ListBase *defbase = BKE_object_defgroup_list(ob);
944 *max = max_ii(0, BLI_listbase_count(defbase) - 1);
945}
946
947void rna_object_vgroup_name_index_get(PointerRNA *ptr, char *value, int index)
948{
949 Object *ob = reinterpret_cast<Object *>(ptr->owner_id);
951 value[0] = '\0';
952 return;
953 }
954
955 const ListBase *defbase = BKE_object_defgroup_list(ob);
956 const bDeformGroup *dg = static_cast<bDeformGroup *>(BLI_findlink(defbase, index - 1));
957
958 if (dg) {
959 strcpy(value, dg->name);
960 }
961 else {
962 value[0] = '\0';
963 }
964}
965
967{
968 Object *ob = reinterpret_cast<Object *>(ptr->owner_id);
970 return 0;
971 }
972
973 const ListBase *defbase = BKE_object_defgroup_list(ob);
974 bDeformGroup *dg = static_cast<bDeformGroup *>(BLI_findlink(defbase, index - 1));
975 return (dg) ? strlen(dg->name) : 0;
976}
977
978void rna_object_vgroup_name_index_set(PointerRNA *ptr, const char *value, short *index)
979{
980 Object *ob = reinterpret_cast<Object *>(ptr->owner_id);
982 *index = -1;
983 return;
984 }
985
986 *index = BKE_object_defgroup_name_index(ob, value) + 1;
987}
988
990 const char *value,
991 char *result,
992 int result_maxncpy)
993{
994 Object *ob = reinterpret_cast<Object *>(ptr->owner_id);
996 result[0] = '\0';
997 return;
998 }
999
1001 if (dg) {
1002 /* No need for BLI_strncpy_utf8, since this matches an existing group. */
1003 BLI_strncpy(result, value, result_maxncpy);
1004 return;
1005 }
1006
1007 result[0] = '\0';
1008}
1009
1011 const char *value,
1012 char *result,
1013 int result_maxncpy)
1014{
1015 Object *ob = reinterpret_cast<Object *>(ptr->owner_id);
1016 Mesh *mesh;
1017 CustomDataLayer *layer;
1018 int a;
1019
1020 if (ob->type == OB_MESH && ob->data) {
1021 mesh = static_cast<Mesh *>(ob->data);
1022
1023 for (a = 0; a < mesh->corner_data.totlayer; a++) {
1024 layer = &mesh->corner_data.layers[a];
1025
1026 if (layer->type == CD_PROP_FLOAT2 && STREQ(layer->name, value)) {
1027 BLI_strncpy(result, value, result_maxncpy);
1028 return;
1029 }
1030 }
1031 }
1032
1033 result[0] = '\0';
1034}
1035
1037 const char *value,
1038 char *result,
1039 int result_maxncpy)
1040{
1041 Object *ob = reinterpret_cast<Object *>(ptr->owner_id);
1042 Mesh *mesh;
1043 CustomDataLayer *layer;
1044 int a;
1045
1046 if (ob->type == OB_MESH && ob->data) {
1047 mesh = static_cast<Mesh *>(ob->data);
1048
1049 for (a = 0; a < mesh->fdata_legacy.totlayer; a++) {
1050 layer = &mesh->fdata_legacy.layers[a];
1051
1052 if (layer->type == CD_MCOL && STREQ(layer->name, value)) {
1053 BLI_strncpy(result, value, result_maxncpy);
1054 return;
1055 }
1056 }
1057 }
1058
1059 result[0] = '\0';
1060}
1061
1062static int rna_Object_active_material_index_get(PointerRNA *ptr)
1063{
1064 Object *ob = reinterpret_cast<Object *>(ptr->owner_id);
1065 return std::max<int>(ob->actcol - 1, 0);
1066}
1067
1068static void rna_Object_active_material_index_set(PointerRNA *ptr, int value)
1069{
1070 Object *ob = reinterpret_cast<Object *>(ptr->owner_id);
1071
1072 value = std::max(std::min(value, ob->totcol - 1), 0);
1073 ob->actcol = value + 1;
1074
1075 if (ob->type == OB_MESH) {
1076 Mesh *mesh = static_cast<Mesh *>(ob->data);
1077
1078 if (mesh->runtime->edit_mesh) {
1079 mesh->runtime->edit_mesh->mat_nr = value;
1080 }
1081 }
1082}
1083
1084static void rna_Object_active_material_index_range(
1085 PointerRNA *ptr, int *min, int *max, int * /*softmin*/, int * /*softmax*/)
1086{
1087 Object *ob = reinterpret_cast<Object *>(ptr->owner_id);
1088 *min = 0;
1089 *max = max_ii(ob->totcol - 1, 0);
1090}
1091
1092/* returns active base material */
1093static PointerRNA rna_Object_active_material_get(PointerRNA *ptr)
1094{
1095 Object *ob = reinterpret_cast<Object *>(ptr->owner_id);
1096 Material *ma;
1097
1098 ma = (ob->totcol) ? BKE_object_material_get(ob, ob->actcol) : nullptr;
1099 return RNA_id_pointer_create(reinterpret_cast<ID *>(ma));
1100}
1101
1102static void rna_Object_active_material_set(PointerRNA *ptr,
1103 PointerRNA value,
1104 ReportList * /*reports*/)
1105{
1106 Object *ob = reinterpret_cast<Object *>(ptr->owner_id);
1107
1108 DEG_id_tag_update(static_cast<ID *>(value.data), 0);
1110 BLI_assert(BKE_id_is_in_global_main(static_cast<ID *>(value.data)));
1112 G_MAIN, ob, static_cast<Material *>(value.data), ob->actcol, BKE_MAT_ASSIGN_EXISTING);
1113}
1114
1115static int rna_Object_active_material_editable(const PointerRNA *ptr, const char ** /*r_info*/)
1116{
1117 Object *ob = reinterpret_cast<Object *>(ptr->owner_id);
1118 bool is_editable;
1119
1120 if ((ob->matbits == nullptr) || (ob->actcol == 0) || ob->matbits[ob->actcol - 1]) {
1121 is_editable = ID_IS_EDITABLE(ob);
1122 }
1123 else {
1124 is_editable = ob->data ? ID_IS_EDITABLE(ob->data) : false;
1125 }
1126
1127 return is_editable ? int(PROP_EDITABLE) : 0;
1128}
1129
1130static void rna_Object_active_particle_system_index_range(
1131 PointerRNA *ptr, int *min, int *max, int * /*softmin*/, int * /*softmax*/)
1132{
1133 Object *ob = reinterpret_cast<Object *>(ptr->owner_id);
1134 *min = 0;
1136}
1137
1138static int rna_Object_active_particle_system_index_get(PointerRNA *ptr)
1139{
1140 Object *ob = reinterpret_cast<Object *>(ptr->owner_id);
1141 return psys_get_current_num(ob);
1142}
1143
1144static void rna_Object_active_particle_system_index_set(PointerRNA *ptr, int value)
1145{
1146 Object *ob = reinterpret_cast<Object *>(ptr->owner_id);
1147 psys_set_current_num(ob, value);
1148}
1149
1150static void rna_Object_particle_update(Main * /*bmain*/, Scene *scene, PointerRNA *ptr)
1151{
1152 /* TODO: Disabled for now, because bContext is not available. */
1153# if 0
1154 Object *ob = reinterpret_cast<Object *>(ptr->owner_id);
1155 PE_current_changed(nullptr, scene, ob);
1156# else
1157 (void)scene;
1158 (void)ptr;
1159# endif
1160}
1161
1162/* rotation - axis-angle */
1163static void rna_Object_rotation_axis_angle_get(PointerRNA *ptr, float *value)
1164{
1165 Object *ob = static_cast<Object *>(ptr->data);
1166
1167 /* for now, assume that rotation mode is axis-angle */
1168 value[0] = ob->rotAngle;
1169 copy_v3_v3(&value[1], ob->rotAxis);
1170}
1171
1172/* rotation - axis-angle */
1173static void rna_Object_rotation_axis_angle_set(PointerRNA *ptr, const float *value)
1174{
1175 Object *ob = static_cast<Object *>(ptr->data);
1176
1177 /* for now, assume that rotation mode is axis-angle */
1178 ob->rotAngle = value[0];
1179 copy_v3_v3(ob->rotAxis, &value[1]);
1180
1181 /* TODO: validate axis? */
1182}
1183
1184static void rna_Object_rotation_mode_set(PointerRNA *ptr, int value)
1185{
1186 Object *ob = static_cast<Object *>(ptr->data);
1187
1188 /* use API Method for conversions... */
1190 ob->quat, ob->rot, ob->rotAxis, &ob->rotAngle, ob->rotmode, short(value));
1191
1192 /* finally, set the new rotation type */
1193 ob->rotmode = value;
1194}
1195
1196static void rna_Object_dimensions_get(PointerRNA *ptr, float *value)
1197{
1198 Object *ob = static_cast<Object *>(ptr->data);
1200}
1201
1202static void rna_Object_dimensions_set(PointerRNA *ptr, const float *value)
1203{
1204 Object *ob = static_cast<Object *>(ptr->data);
1205 BKE_object_dimensions_set(ob, value, 0);
1206}
1207
1208static int rna_Object_location_editable(const PointerRNA *ptr, int index)
1209{
1210 Object *ob = static_cast<Object *>(ptr->data);
1211
1212 /* only if the axis in question is locked, not editable... */
1213 if ((index == 0) && (ob->protectflag & OB_LOCK_LOCX)) {
1214 return 0;
1215 }
1216 else if ((index == 1) && (ob->protectflag & OB_LOCK_LOCY)) {
1217 return 0;
1218 }
1219 else if ((index == 2) && (ob->protectflag & OB_LOCK_LOCZ)) {
1220 return 0;
1221 }
1222 else {
1223 return PROP_EDITABLE;
1224 }
1225}
1226
1227static int rna_Object_scale_editable(const PointerRNA *ptr, int index)
1228{
1229 Object *ob = static_cast<Object *>(ptr->data);
1230
1231 /* only if the axis in question is locked, not editable... */
1232 if ((index == 0) && (ob->protectflag & OB_LOCK_SCALEX)) {
1233 return 0;
1234 }
1235 else if ((index == 1) && (ob->protectflag & OB_LOCK_SCALEY)) {
1236 return 0;
1237 }
1238 else if ((index == 2) && (ob->protectflag & OB_LOCK_SCALEZ)) {
1239 return 0;
1240 }
1241 else {
1242 return PROP_EDITABLE;
1243 }
1244}
1245
1246static int rna_Object_rotation_euler_editable(const PointerRNA *ptr, int index)
1247{
1248 Object *ob = static_cast<Object *>(ptr->data);
1249
1250 /* only if the axis in question is locked, not editable... */
1251 if ((index == 0) && (ob->protectflag & OB_LOCK_ROTX)) {
1252 return 0;
1253 }
1254 else if ((index == 1) && (ob->protectflag & OB_LOCK_ROTY)) {
1255 return 0;
1256 }
1257 else if ((index == 2) && (ob->protectflag & OB_LOCK_ROTZ)) {
1258 return 0;
1259 }
1260 else {
1261 return PROP_EDITABLE;
1262 }
1263}
1264
1265static int rna_Object_rotation_4d_editable(const PointerRNA *ptr, int index)
1266{
1267 Object *ob = static_cast<Object *>(ptr->data);
1268
1269 /* only consider locks if locking components individually... */
1270 if (ob->protectflag & OB_LOCK_ROT4D) {
1271 /* only if the axis in question is locked, not editable... */
1272 if ((index == 0) && (ob->protectflag & OB_LOCK_ROTW)) {
1273 return 0;
1274 }
1275 else if ((index == 1) && (ob->protectflag & OB_LOCK_ROTX)) {
1276 return 0;
1277 }
1278 else if ((index == 2) && (ob->protectflag & OB_LOCK_ROTY)) {
1279 return 0;
1280 }
1281 else if ((index == 3) && (ob->protectflag & OB_LOCK_ROTZ)) {
1282 return 0;
1283 }
1284 }
1285
1286 return PROP_EDITABLE;
1287}
1288
1289static int rna_MaterialSlot_index(const PointerRNA *ptr)
1290{
1291 /* There is an offset, so that `ptr->data` is not null and unique across IDs. */
1292 return uintptr_t(ptr->data) - uintptr_t(ptr->owner_id);
1293}
1294
1295static int rna_MaterialSlot_index_get(PointerRNA *ptr)
1296{
1297 return rna_MaterialSlot_index(ptr);
1298}
1299
1300static int rna_MaterialSlot_material_editable(const PointerRNA *ptr, const char ** /*r_info*/)
1301{
1302 Object *ob = reinterpret_cast<Object *>(ptr->owner_id);
1303 const int index = rna_MaterialSlot_index(ptr);
1304 bool is_editable;
1305
1306 if ((ob->matbits == nullptr) || ob->matbits[index]) {
1307 is_editable = ID_IS_EDITABLE(ob);
1308 }
1309 else {
1310 is_editable = ob->data ? ID_IS_EDITABLE(ob->data) : false;
1311 }
1312
1313 return is_editable ? int(PROP_EDITABLE) : 0;
1314}
1315
1316static PointerRNA rna_MaterialSlot_material_get(PointerRNA *ptr)
1317{
1318 Object *ob = reinterpret_cast<Object *>(ptr->owner_id);
1319 Material *ma;
1320 const int index = rna_MaterialSlot_index(ptr);
1321
1322 if (DEG_is_evaluated(ob)) {
1323 ma = BKE_object_material_get_eval(ob, index + 1);
1324 }
1325 else {
1326 ma = BKE_object_material_get(ob, index + 1);
1327 }
1328 return RNA_id_pointer_create(reinterpret_cast<ID *>(ma));
1329}
1330
1331static void rna_MaterialSlot_material_set(PointerRNA *ptr,
1332 PointerRNA value,
1333 ReportList * /*reports*/)
1334{
1335 Object *ob = reinterpret_cast<Object *>(ptr->owner_id);
1336 int index = rna_MaterialSlot_index(ptr);
1337
1339 BLI_assert(BKE_id_is_in_global_main(static_cast<ID *>(value.data)));
1341 G_MAIN, ob, static_cast<Material *>(value.data), index + 1, BKE_MAT_ASSIGN_EXISTING);
1342}
1343
1344static bool rna_MaterialSlot_material_poll(PointerRNA *ptr, PointerRNA value)
1345{
1346 Object *ob = reinterpret_cast<Object *>(ptr->owner_id);
1347 Material *ma = static_cast<Material *>(value.data);
1348
1349 if (ELEM(ob->type, OB_GREASE_PENCIL)) {
1350 /* GP Materials only */
1351 return (ma->gp_style != nullptr);
1352 }
1353 else {
1354 /* Everything except GP materials */
1355 return (ma->gp_style == nullptr);
1356 }
1357}
1358
1359static int rna_MaterialSlot_link_get(PointerRNA *ptr)
1360{
1361 Object *ob = reinterpret_cast<Object *>(ptr->owner_id);
1362 int index = rna_MaterialSlot_index(ptr);
1363 if (index < ob->totcol) {
1364 return ob->matbits[index] != 0;
1365 }
1366 return false;
1367}
1368
1369static void rna_MaterialSlot_link_set(PointerRNA *ptr, int value)
1370{
1371 Object *ob = reinterpret_cast<Object *>(ptr->owner_id);
1372 int index = rna_MaterialSlot_index(ptr);
1373
1374 if (value) {
1375 ob->matbits[index] = 1;
1376 /* DEPRECATED */
1377 // ob->colbits |= (1 << index);
1378 }
1379 else {
1380 ob->matbits[index] = 0;
1381 /* DEPRECATED */
1382 // ob->colbits &= ~(1 << index);
1383 }
1384}
1385
1386static int rna_MaterialSlot_name_length(PointerRNA *ptr)
1387{
1388 Object *ob = reinterpret_cast<Object *>(ptr->owner_id);
1389 Material *ma;
1390 int index = rna_MaterialSlot_index(ptr);
1391
1392 ma = BKE_object_material_get(ob, index + 1);
1393
1394 if (ma) {
1395 return strlen(ma->id.name + 2);
1396 }
1397
1398 return 0;
1399}
1400
1401static void rna_MaterialSlot_name_get(PointerRNA *ptr, char *value)
1402{
1403 Object *ob = reinterpret_cast<Object *>(ptr->owner_id);
1404 Material *ma;
1405 int index = rna_MaterialSlot_index(ptr);
1406
1407 ma = BKE_object_material_get(ob, index + 1);
1408
1409 if (ma) {
1410 strcpy(value, ma->id.name + 2);
1411 }
1412 else {
1413 value[0] = '\0';
1414 }
1415}
1416
1417static void rna_MaterialSlot_update(Main *bmain, Scene *scene, PointerRNA *ptr)
1418{
1419 rna_Object_internal_update(bmain, scene, ptr);
1420
1424}
1425
1426static std::optional<std::string> rna_MaterialSlot_path(const PointerRNA *ptr)
1427{
1428 int index = rna_MaterialSlot_index(ptr);
1429 return fmt::format("material_slots[{}]", index);
1430}
1431
1432static int rna_Object_material_slots_length(PointerRNA *ptr)
1433{
1434 Object *ob = reinterpret_cast<Object *>(ptr->owner_id);
1435 if (DEG_is_evaluated(ob)) {
1437 }
1438 else {
1439 return ob->totcol;
1440 }
1441}
1442
1443static void rna_Object_material_slots_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
1444{
1445 const int length = rna_Object_material_slots_length(ptr);
1446 iter->parent = *ptr;
1447 iter->internal.count.item = 0;
1448 iter->internal.count.ptr = ptr->owner_id;
1449 iter->valid = length > 0;
1450}
1451
1452static void rna_Object_material_slots_next(CollectionPropertyIterator *iter)
1453{
1454 const int length = rna_Object_material_slots_length(&iter->ptr);
1455 iter->internal.count.item++;
1456 iter->valid = iter->internal.count.item < length;
1457}
1458
1459static PointerRNA rna_Object_material_slots_get(CollectionPropertyIterator *iter)
1460{
1461 ID *id = static_cast<ID *>(iter->internal.count.ptr);
1463 iter->parent,
1464 &RNA_MaterialSlot,
1465 /* Add offset, so that `ptr->data` is not null and unique across IDs. */
1466 (void *)(iter->internal.count.item + uintptr_t(id)));
1467 return ptr;
1468}
1469
1470static void rna_Object_material_slots_end(CollectionPropertyIterator * /*iter*/) {}
1471
1472static PointerRNA rna_Object_display_get(PointerRNA *ptr)
1473{
1474 return RNA_pointer_create_with_parent(*ptr, &RNA_ObjectDisplay, ptr->data);
1475}
1476
1477static std::optional<std::string> rna_ObjectDisplay_path(const PointerRNA * /*ptr*/)
1478{
1479 return "display";
1480}
1481
1482static PointerRNA rna_Object_active_particle_system_get(PointerRNA *ptr)
1483{
1484 Object *ob = reinterpret_cast<Object *>(ptr->owner_id);
1485 ParticleSystem *psys = psys_get_current(ob);
1486 return RNA_pointer_create_with_parent(*ptr, &RNA_ParticleSystem, psys);
1487}
1488
1489static void rna_Object_active_shape_key_index_range(
1490 PointerRNA *ptr, int *min, int *max, int * /*softmin*/, int * /*softmax*/)
1491{
1492 Object *ob = reinterpret_cast<Object *>(ptr->owner_id);
1493 Key *key = BKE_key_from_object(ob);
1494
1495 *min = 0;
1496 if (key) {
1497 *max = BLI_listbase_count(&key->block) - 1;
1498 if (*max < 0) {
1499 *max = 0;
1500 }
1501 }
1502 else {
1503 *max = 0;
1504 }
1505}
1506
1507static int rna_Object_active_shape_key_index_get(PointerRNA *ptr)
1508{
1509 Object *ob = reinterpret_cast<Object *>(ptr->owner_id);
1510
1511 return std::max<int>(ob->shapenr - 1, 0);
1512}
1513
1514static void rna_Object_active_shape_key_index_set(PointerRNA *ptr, int value)
1515{
1516 Object *ob = reinterpret_cast<Object *>(ptr->owner_id);
1517
1518 ob->shapenr = value + 1;
1519}
1520
1521static PointerRNA rna_Object_active_shape_key_get(PointerRNA *ptr)
1522{
1523 Object *ob = reinterpret_cast<Object *>(ptr->owner_id);
1524 Key *key = BKE_key_from_object(ob);
1525 KeyBlock *kb;
1526
1527 if (key == nullptr) {
1528 return PointerRNA_NULL;
1529 }
1530
1531 kb = static_cast<KeyBlock *>(BLI_findlink(&key->block, ob->shapenr - 1));
1532 PointerRNA keyptr = RNA_pointer_create_discrete(reinterpret_cast<ID *>(key), &RNA_ShapeKey, kb);
1533 return keyptr;
1534}
1535
1536static PointerRNA rna_Object_field_get(PointerRNA *ptr)
1537{
1538 Object *ob = reinterpret_cast<Object *>(ptr->owner_id);
1539
1540 return RNA_pointer_create_with_parent(*ptr, &RNA_FieldSettings, ob->pd);
1541}
1542
1543static PointerRNA rna_Object_collision_get(PointerRNA *ptr)
1544{
1545 Object *ob = reinterpret_cast<Object *>(ptr->owner_id);
1546
1547 if (ob->type != OB_MESH) {
1548 return PointerRNA_NULL;
1549 }
1550
1551 return RNA_pointer_create_with_parent(*ptr, &RNA_CollisionSettings, ob->pd);
1552}
1553
1554static PointerRNA rna_Object_active_constraint_get(PointerRNA *ptr)
1555{
1556 Object *ob = reinterpret_cast<Object *>(ptr->owner_id);
1558 return RNA_pointer_create_with_parent(*ptr, &RNA_Constraint, con);
1559}
1560
1561static void rna_Object_active_constraint_set(PointerRNA *ptr,
1562 PointerRNA value,
1563 ReportList * /*reports*/)
1564{
1565 Object *ob = reinterpret_cast<Object *>(ptr->owner_id);
1566 BKE_constraints_active_set(&ob->constraints, static_cast<bConstraint *>(value.data));
1567}
1568
1569static bConstraint *rna_Object_constraints_new(Object *object, Main *bmain, int type)
1570{
1571 bConstraint *new_con = BKE_constraint_add_for_object(object, nullptr, type);
1572
1573 blender::ed::object::constraint_tag_update(bmain, object, new_con);
1575
1576 /* The Depsgraph needs to be updated to reflect the new relationship that was added. */
1578
1579 return new_con;
1580}
1581
1582static void rna_Object_constraints_remove(Object *object,
1583 Main *bmain,
1584 ReportList *reports,
1585 PointerRNA *con_ptr)
1586{
1587 bConstraint *con = static_cast<bConstraint *>(con_ptr->data);
1588 if (BLI_findindex(&object->constraints, con) == -1) {
1589 BKE_reportf(reports,
1590 RPT_ERROR,
1591 "Constraint '%s' not found in object '%s'",
1592 con->name,
1593 object->id.name + 2);
1594 return;
1595 }
1596
1597 BKE_constraint_remove_ex(&object->constraints, object, con);
1598 con_ptr->invalidate();
1599
1603}
1604
1605static void rna_Object_constraints_clear(Object *object, Main *bmain)
1606{
1608
1611
1613}
1614
1615static void rna_Object_constraints_move(
1616 Object *object, Main *bmain, ReportList *reports, int from, int to)
1617{
1618 if (from == to) {
1619 return;
1620 }
1621
1622 if (!BLI_listbase_move_index(&object->constraints, from, to)) {
1623 BKE_reportf(reports, RPT_ERROR, "Could not move constraint from index '%d' to '%d'", from, to);
1624 return;
1625 }
1626
1627 blender::ed::object::constraint_tag_update(bmain, object, nullptr);
1629}
1630
1631static bConstraint *rna_Object_constraints_copy(Object *object, Main *bmain, PointerRNA *con_ptr)
1632{
1633 bConstraint *con = static_cast<bConstraint *>(con_ptr->data);
1634 bConstraint *new_con = BKE_constraint_copy_for_object(object, con);
1636
1637 blender::ed::object::constraint_tag_update(bmain, object, new_con);
1639
1640 return new_con;
1641}
1642
1643bool rna_Object_constraints_override_apply(Main *bmain,
1644 RNAPropertyOverrideApplyContext &rnaapply_ctx)
1645{
1646 PointerRNA *ptr_dst = &rnaapply_ctx.ptr_dst;
1647 PointerRNA *ptr_src = &rnaapply_ctx.ptr_src;
1648 PropertyRNA *prop_dst = rnaapply_ctx.prop_dst;
1650
1652 "Unsupported RNA override operation on constraints collection");
1653
1654 Object *ob_dst = reinterpret_cast<Object *>(ptr_dst->owner_id);
1655 Object *ob_src = reinterpret_cast<Object *>(ptr_src->owner_id);
1656
1657 /* Remember that insertion operations are defined and stored in correct order, which means that
1658 * even if we insert several items in a row, we always insert first one, then second one, etc.
1659 * So we should always find 'anchor' constraint in both _src *and* _dst. */
1660 const size_t name_offset = offsetof(bConstraint, name);
1661 bConstraint *con_anchor = static_cast<bConstraint *>(
1664 name_offset,
1666 /* If `con_anchor` is nullptr, `con_src` will be inserted in first position. */
1667
1669 &ob_src->constraints, opop->subitem_local_name, name_offset, opop->subitem_local_index));
1670
1671 if (con_src == nullptr) {
1672 BLI_assert(con_src != nullptr);
1673 return false;
1674 }
1675
1676 bConstraint *con_dst = BKE_constraint_duplicate_ex(con_src, 0, true);
1677
1678 /* This handles nullptr anchor as expected by adding at head of list. */
1679 BLI_insertlinkafter(&ob_dst->constraints, con_anchor, con_dst);
1680
1681 /* This should actually *not* be needed in typical cases.
1682 * However, if overridden source was edited, we *may* have some new conflicting names. */
1683 BKE_constraint_unique_name(con_dst, &ob_dst->constraints);
1684
1685 // printf("%s: We inserted a constraint...\n", __func__);
1686 RNA_property_update_main(bmain, nullptr, ptr_dst, prop_dst);
1687 return true;
1688}
1689
1690static ModifierData *rna_Object_modifier_new(
1691 Object *object, bContext *C, ReportList *reports, const char *name, int type)
1692{
1694 reports, CTX_data_main(C), CTX_data_scene(C), object, name, type);
1695
1697
1698 return md;
1699}
1700
1701static void rna_Object_modifier_remove(Object *object,
1702 bContext *C,
1703 ReportList *reports,
1704 PointerRNA *md_ptr)
1705{
1706 ModifierData *md = static_cast<ModifierData *>(md_ptr->data);
1708 reports, CTX_data_main(C), CTX_data_scene(C), object, md) == false)
1709 {
1710 /* error is already set */
1711 return;
1712 }
1713
1714 md_ptr->invalidate();
1715
1717}
1718
1719static void rna_Object_modifier_clear(Object *object, bContext *C)
1720{
1722
1724}
1725
1726static void rna_Object_modifier_move(Object *object, ReportList *reports, int from, int to)
1727{
1728 ModifierData *md = static_cast<ModifierData *>(BLI_findlink(&object->modifiers, from));
1729
1730 if (!md) {
1731 BKE_reportf(reports, RPT_ERROR, "Invalid original modifier index '%d'", from);
1732 return;
1733 }
1734
1735 blender::ed::object::modifier_move_to_index(reports, RPT_ERROR, object, md, to, false);
1736}
1737
1738static PointerRNA rna_Object_active_modifier_get(PointerRNA *ptr)
1739{
1740 Object *ob = reinterpret_cast<Object *>(ptr->owner_id);
1742 return RNA_pointer_create_with_parent(*ptr, &RNA_Modifier, md);
1743}
1744
1745static void rna_Object_active_modifier_set(PointerRNA *ptr, PointerRNA value, ReportList *reports)
1746{
1747 Object *ob = reinterpret_cast<Object *>(ptr->owner_id);
1748 ModifierData *md = static_cast<ModifierData *>(value.data);
1749
1751
1752 if (RNA_pointer_is_null(&value)) {
1753 BKE_object_modifier_set_active(ob, nullptr);
1754 return;
1755 }
1756
1757 if (BLI_findindex(&ob->modifiers, md) == -1) {
1759 reports, RPT_ERROR, "Modifier \"%s\" is not in the object's modifier list", md->name);
1760 return;
1761 }
1762
1764}
1765
1766bool rna_Object_modifiers_override_apply(Main *bmain,
1767 RNAPropertyOverrideApplyContext &rnaapply_ctx)
1768{
1769 PointerRNA *ptr_dst = &rnaapply_ctx.ptr_dst;
1770 PointerRNA *ptr_src = &rnaapply_ctx.ptr_src;
1771 PropertyRNA *prop_dst = rnaapply_ctx.prop_dst;
1773
1775 "Unsupported RNA override operation on modifiers collection");
1776
1777 Object *ob_dst = reinterpret_cast<Object *>(ptr_dst->owner_id);
1778 Object *ob_src = reinterpret_cast<Object *>(ptr_src->owner_id);
1779
1780 /* Remember that insertion operations are defined and stored in correct order, which means that
1781 * even if we insert several items in a row, we always insert first one, then second one, etc.
1782 * So we should always find 'anchor' modifier in both _src *and* _dst. */
1783 const size_t name_offset = offsetof(ModifierData, name);
1784 ModifierData *mod_anchor = static_cast<ModifierData *>(
1787 name_offset,
1789 /* If `mod_anchor` is nullptr, `mod_src` will be inserted in first position. */
1790
1792 &ob_src->modifiers, opop->subitem_local_name, name_offset, opop->subitem_local_index));
1793
1794 if (mod_src == nullptr) {
1795 BLI_assert(mod_src != nullptr);
1796 return false;
1797 }
1798
1799 /* While it would be nicer to use lower-level BKE_modifier_new() here, this one is lacking
1800 * special-cases handling (particles and other physics modifiers mostly), so using the ED version
1801 * instead, to avoid duplicating code. */
1803 nullptr, bmain, nullptr, ob_dst, mod_src->name, mod_src->type);
1804
1805 if (mod_dst == nullptr) {
1806 /* This can happen e.g. when a modifier type is tagged as `eModifierTypeFlag_Single`, and that
1807 * modifier has somehow been added already by another code path (e.g.
1808 * `rna_CollisionSettings_dependency_update` does add the `eModifierType_Collision` singleton
1809 * modifier).
1810 *
1811 * Try to handle this by finding already existing one here. */
1813 if (mti->flags & eModifierTypeFlag_Single) {
1814 mod_dst = BKE_modifiers_findby_type(ob_dst, (ModifierType)mod_src->type);
1815 }
1816
1817 if (mod_dst == nullptr) {
1818 BLI_assert(mod_src != nullptr);
1819 return false;
1820 }
1821 }
1822
1823 /* XXX Current handling of 'copy' from particle-system modifier is *very* bad (it keeps same psys
1824 * pointer as source, then calling code copies psys of object separately and do some magic
1825 * remapping of pointers...), unfortunately several pieces of code in Object editing area rely on
1826 * this behavior. So for now, hacking around it to get it doing what we want it to do, as getting
1827 * a proper behavior would be everything but trivial, and this whole particle thingy is
1828 * end-of-life. */
1829 ParticleSystem *psys_dst = (mod_dst->type == eModifierType_ParticleSystem) ?
1830 (reinterpret_cast<ParticleSystemModifierData *>(mod_dst))->psys :
1831 nullptr;
1832 const int persistent_uid = mod_dst->persistent_uid;
1833 BKE_modifier_copydata(mod_src, mod_dst);
1834 mod_dst->persistent_uid = persistent_uid;
1835 if (mod_dst->type == eModifierType_ParticleSystem) {
1836 psys_dst->flag &= ~PSYS_DELETE;
1837 (reinterpret_cast<ParticleSystemModifierData *>(mod_dst))->psys = psys_dst;
1838 }
1839
1840 BLI_remlink(&ob_dst->modifiers, mod_dst);
1841 /* This handles nullptr anchor as expected by adding at head of list. */
1842 BLI_insertlinkafter(&ob_dst->modifiers, mod_anchor, mod_dst);
1843
1844 // printf("%s: We inserted a modifier '%s'...\n", __func__, mod_dst->name);
1845 RNA_property_update_main(bmain, nullptr, ptr_dst, prop_dst);
1846 return true;
1847}
1848
1849/* shader fx */
1850static ShaderFxData *rna_Object_shaderfx_new(
1851 Object *object, bContext *C, ReportList *reports, const char *name, int type)
1852{
1854 reports, CTX_data_main(C), CTX_data_scene(C), object, name, type);
1855}
1856
1857static void rna_Object_shaderfx_remove(Object *object,
1858 bContext *C,
1859 ReportList *reports,
1860 PointerRNA *gmd_ptr)
1861{
1862 ShaderFxData *gmd = static_cast<ShaderFxData *>(gmd_ptr->data);
1863 if (blender::ed::object::shaderfx_remove(reports, CTX_data_main(C), object, gmd) == false) {
1864 /* error is already set */
1865 return;
1866 }
1867
1868 gmd_ptr->invalidate();
1869
1871}
1872
1873static void rna_Object_shaderfx_clear(Object *object, bContext *C)
1874{
1877}
1878
1879static void rna_Object_boundbox_get(PointerRNA *ptr, float *values)
1880{
1881 using namespace blender;
1882 Object *ob = reinterpret_cast<Object *>(ptr->owner_id);
1883 if (const std::optional<Bounds<float3>> bounds = BKE_object_boundbox_eval_cached_get(ob)) {
1884 *reinterpret_cast<std::array<float3, 8> *>(values) = blender::bounds::corners(*bounds);
1885 }
1886 else {
1887 copy_vn_fl(values, 8 * 3, 0.0f);
1888 }
1889}
1890
1891static bool check_object_vgroup_support_and_warn(const Object *ob,
1892 const char *op_name,
1893 ReportList *reports)
1894{
1896 const char *ob_type_name = "Unknown";
1898 BKE_reportf(reports, RPT_ERROR, "%s is not supported for '%s' objects", op_name, ob_type_name);
1899 return false;
1900 }
1901 return true;
1902}
1903
1904static bDeformGroup *rna_Object_vgroup_new(Object *ob,
1905 Main *bmain,
1906 ReportList *reports,
1907 const char *name)
1908{
1909 if (!check_object_vgroup_support_and_warn(ob, "VertexGroups.new()", reports)) {
1910 return nullptr;
1911 }
1912
1914
1917
1918 return defgroup;
1919}
1920
1921static void rna_Object_vgroup_remove(Object *ob,
1922 Main *bmain,
1923 ReportList *reports,
1924 PointerRNA *defgroup_ptr)
1925{
1926 if (!check_object_vgroup_support_and_warn(ob, "VertexGroups.remove()", reports)) {
1927 return;
1928 }
1929
1930 bDeformGroup *defgroup = static_cast<bDeformGroup *>(defgroup_ptr->data);
1932
1933 if (BLI_findindex(defbase, defgroup) == -1) {
1934 BKE_reportf(reports,
1935 RPT_ERROR,
1936 "DeformGroup '%s' not in object '%s'",
1937 defgroup->name,
1938 ob->id.name + 2);
1939 return;
1940 }
1941
1942 BKE_object_defgroup_remove(ob, defgroup);
1943 defgroup_ptr->invalidate();
1944
1947}
1948
1949static void rna_Object_vgroup_clear(Object *ob, Main *bmain, ReportList *reports)
1950{
1951 if (!check_object_vgroup_support_and_warn(ob, "VertexGroups.clear()", reports)) {
1952 return;
1953 }
1954
1956
1959}
1960
1961static void rna_VertexGroup_vertex_add(ID *id,
1962 bDeformGroup *def,
1963 ReportList *reports,
1964 const int *index,
1965 int index_num,
1966 float weight,
1967 int assignmode)
1968{
1969 Object *ob = reinterpret_cast<Object *>(id);
1970
1972 BKE_report(
1973 reports, RPT_ERROR, "VertexGroup.add(): cannot be called while object is in edit mode");
1974 return;
1975 }
1976
1977 while (index_num--) {
1978 /* XXX: not efficient calling within loop. */
1979 blender::ed::object::vgroup_vert_add(ob, def, *index++, weight, assignmode);
1980 }
1981
1983 WM_main_add_notifier(NC_GEOM | ND_DATA, static_cast<ID *>(ob->data));
1984}
1985
1986static void rna_VertexGroup_vertex_remove(
1987 ID *id, bDeformGroup *dg, ReportList *reports, const int *index, int index_num)
1988{
1989 Object *ob = reinterpret_cast<Object *>(id);
1990
1992 BKE_report(
1993 reports, RPT_ERROR, "VertexGroup.remove(): cannot be called while object is in edit mode");
1994 return;
1995 }
1996
1997 while (index_num--) {
1999 }
2000
2002 WM_main_add_notifier(NC_GEOM | ND_DATA, static_cast<ID *>(ob->data));
2003}
2004
2005static float rna_VertexGroup_weight(ID *id, bDeformGroup *dg, ReportList *reports, int index)
2006{
2008 reinterpret_cast<Object *>(id), dg, index);
2009
2010 if (weight < 0) {
2011 BKE_report(reports, RPT_ERROR, "Vertex not in group");
2012 }
2013 return weight;
2014}
2015
2016/* generic poll functions */
2017bool rna_Lattice_object_poll(PointerRNA * /*ptr*/, PointerRNA value)
2018{
2019 return (reinterpret_cast<Object *>(value.owner_id))->type == OB_LATTICE;
2020}
2021
2022bool rna_Curve_object_poll(PointerRNA * /*ptr*/, PointerRNA value)
2023{
2024 return (reinterpret_cast<Object *>(value.owner_id))->type == OB_CURVES_LEGACY;
2025}
2026
2027bool rna_Armature_object_poll(PointerRNA * /*ptr*/, PointerRNA value)
2028{
2029 return (reinterpret_cast<Object *>(value.owner_id))->type == OB_ARMATURE;
2030}
2031
2032bool rna_Mesh_object_poll(PointerRNA * /*ptr*/, PointerRNA value)
2033{
2034 return (reinterpret_cast<Object *>(value.owner_id))->type == OB_MESH;
2035}
2036
2037bool rna_Camera_object_poll(PointerRNA * /*ptr*/, PointerRNA value)
2038{
2039 return (reinterpret_cast<Object *>(value.owner_id))->type == OB_CAMERA;
2040}
2041
2042bool rna_Light_object_poll(PointerRNA * /*ptr*/, PointerRNA value)
2043{
2044 return (reinterpret_cast<Object *>(value.owner_id))->type == OB_LAMP;
2045}
2046
2047bool rna_Object_use_dynamic_topology_sculpting_get(PointerRNA *ptr)
2048{
2049 return BKE_object_sculpt_use_dyntopo(reinterpret_cast<Object *>(ptr->owner_id));
2050}
2051
2052static void rna_object_lineart_update(Main * /*bmain*/, Scene * /*scene*/, PointerRNA *ptr)
2053{
2056}
2057
2058static std::optional<std::string> rna_ObjectLineArt_path(const PointerRNA * /*ptr*/)
2059{
2060 return "lineart";
2061}
2062
2063static bool mesh_symmetry_get_common(PointerRNA *ptr, const eMeshSymmetryType sym)
2064{
2065 const Object *ob = reinterpret_cast<Object *>(ptr->owner_id);
2066 if (ob->type != OB_MESH) {
2067 return false;
2068 }
2069
2070 const Mesh *mesh = static_cast<Mesh *>(ob->data);
2071 return mesh->symmetry & sym;
2072}
2073
2074static bool rna_Object_mesh_symmetry_x_get(PointerRNA *ptr)
2075{
2076 return mesh_symmetry_get_common(ptr, ME_SYMMETRY_X);
2077}
2078
2079static bool rna_Object_mesh_symmetry_y_get(PointerRNA *ptr)
2080{
2081 return mesh_symmetry_get_common(ptr, ME_SYMMETRY_Y);
2082}
2083
2084static bool rna_Object_mesh_symmetry_z_get(PointerRNA *ptr)
2085{
2086 return mesh_symmetry_get_common(ptr, ME_SYMMETRY_Z);
2087}
2088
2089static void mesh_symmetry_set_common(PointerRNA *ptr,
2090 const bool value,
2091 const eMeshSymmetryType sym)
2092{
2093 Object *ob = reinterpret_cast<Object *>(ptr->owner_id);
2094 if (ob->type != OB_MESH) {
2095 return;
2096 }
2097
2098 Mesh *mesh = static_cast<Mesh *>(ob->data);
2099 if (value) {
2100 mesh->symmetry |= sym;
2101 }
2102 else {
2103 mesh->symmetry &= ~sym;
2104 }
2105}
2106
2107static void rna_Object_mesh_symmetry_x_set(PointerRNA *ptr, bool value)
2108{
2109 mesh_symmetry_set_common(ptr, value, ME_SYMMETRY_X);
2110}
2111
2112static void rna_Object_mesh_symmetry_y_set(PointerRNA *ptr, bool value)
2113{
2114 mesh_symmetry_set_common(ptr, value, ME_SYMMETRY_Y);
2115}
2116
2117static void rna_Object_mesh_symmetry_z_set(PointerRNA *ptr, bool value)
2118{
2119 mesh_symmetry_set_common(ptr, value, ME_SYMMETRY_Z);
2120}
2121
2122static int rna_Object_mesh_symmetry_yz_editable(const PointerRNA *ptr, const char ** /*r_info*/)
2123{
2124 const Object *ob = reinterpret_cast<Object *>(ptr->owner_id);
2125 if (ob->type != OB_MESH) {
2126 return 0;
2127 }
2128
2129 const Mesh *mesh = static_cast<Mesh *>(ob->data);
2131 /* Only X symmetry is available in weight-paint mode. */
2132 return 0;
2133 }
2134
2135 return PROP_EDITABLE;
2136}
2137
2138void rna_Object_lightgroup_get(PointerRNA *ptr, char *value)
2139{
2140 const LightgroupMembership *lgm = (reinterpret_cast<Object *>(ptr->owner_id))->lightgroup;
2141 char value_buf[sizeof(lgm->name)];
2142 int len = BKE_lightgroup_membership_get(lgm, value_buf);
2143 memcpy(value, value_buf, len + 1);
2144}
2145
2146int rna_Object_lightgroup_length(PointerRNA *ptr)
2147{
2148 const LightgroupMembership *lgm = (reinterpret_cast<Object *>(ptr->owner_id))->lightgroup;
2150}
2151
2152void rna_Object_lightgroup_set(PointerRNA *ptr, const char *value)
2153{
2154 BKE_lightgroup_membership_set(&(reinterpret_cast<Object *>(ptr->owner_id))->lightgroup, value);
2155}
2156
2157static PointerRNA rna_Object_light_linking_get(PointerRNA *ptr)
2158{
2159 return RNA_pointer_create_with_parent(*ptr, &RNA_ObjectLightLinking, ptr->data);
2160}
2161
2162static std::optional<std::string> rna_ObjectLightLinking_path(const PointerRNA * /*ptr*/)
2163{
2164 return "light_linking";
2165}
2166
2167bool rna_Object_light_linking_override_apply(Main *bmain,
2168 RNAPropertyOverrideApplyContext &rnaapply_ctx)
2169{
2170 /* NOTE: Here:
2171 * - `dst` is the new, being updated liboverride data, which is a clean copy from the linked
2172 * reference data.
2173 * - `src` is the old, stored liboverride data, which is the source to copy overridden data
2174 * from.
2175 */
2176
2177 PointerRNA *ptr_dst = &rnaapply_ctx.ptr_dst;
2178 PointerRNA *ptr_src = &rnaapply_ctx.ptr_src;
2179 PointerRNA *ptr_storage = &rnaapply_ctx.ptr_storage;
2180 const int len_dst = rnaapply_ctx.len_src;
2181 const int len_src = rnaapply_ctx.len_src;
2182 const int len_storage = rnaapply_ctx.len_storage;
2184
2185 BLI_assert(len_dst == len_src && (!ptr_storage || len_dst == len_storage) && len_dst == 0);
2187 "Unsupported RNA override operation on object light linking pointer");
2188 UNUSED_VARS_NDEBUG(ptr_storage, len_dst, len_src, len_storage, opop);
2189
2190 /* LightLinking is a special case, since you cannot edit/replace it, it's either existent or not.
2191 * Further more, when a lightlinking is added to the linked reference later on, the one created
2192 * for the liboverride needs to be 'merged', such that its overridable data is kept. */
2193 Object *ob_dst = blender::id_cast<Object *>(ptr_dst->owner_id);
2194 Object *ob_src = blender::id_cast<Object *>(ptr_src->owner_id);
2195
2196 if (ob_dst->light_linking == nullptr && ob_src->light_linking == nullptr) {
2197 /* Nothing to do. */
2198 return false;
2199 }
2200
2201 if (ob_dst->light_linking == nullptr && ob_src->light_linking != nullptr) {
2202 /* Copy light linking data from previous liboverride data into final liboverride one. */
2203 BKE_light_linking_copy(ob_dst, ob_src, 0);
2204 return true;
2205 }
2206 else if (ob_dst->light_linking != nullptr && ob_src->light_linking == nullptr) {
2207 /* Override has cleared/removed light linking data from its reference. */
2208 BKE_light_linking_delete(ob_dst, 0);
2209 return true;
2210 }
2211 else {
2212 BLI_assert(ob_dst->light_linking != nullptr && ob_src->light_linking != nullptr);
2213 /* Override had to create a light linking data, but now its reference also has one, need to
2214 * merge them by keeping the overridable data from the liboverride, while using the light
2215 * linking of the reference.
2216 *
2217 * Note that this case will not be encountered when the linked reference data already had
2218 * light linking data, since there will be no operation for the light linking pointer itself
2219 * then, only potentially for its internal overridable data (collections...). */
2220
2221 /* For these collections, only replace linked data with previously defined liboverride data if
2222 * the latter is non-null. Otherwise, assume that the previously defined liboverride data
2223 * property was 'unset', and can be replaced by the linked reference value. */
2224 if (ob_src->light_linking->receiver_collection != nullptr) {
2225 id_us_min(blender::id_cast<ID *>(ob_dst->light_linking->receiver_collection));
2227 id_us_plus(blender::id_cast<ID *>(ob_dst->light_linking->receiver_collection));
2228 }
2229 if (ob_src->light_linking->blocker_collection != nullptr) {
2230 id_us_min(blender::id_cast<ID *>(ob_dst->light_linking->blocker_collection));
2232 id_us_plus(blender::id_cast<ID *>(ob_dst->light_linking->blocker_collection));
2233 }
2234
2235 /* Note: LightLinking runtime data is currently set by depsgraph evaluation, so no need to
2236 * handle them here. */
2237 }
2238
2240
2243 return true;
2244}
2245
2246static PointerRNA rna_LightLinking_receiver_collection_get(PointerRNA *ptr)
2247{
2248 Object *object = reinterpret_cast<Object *>(ptr->owner_id);
2249 PointerRNA collection_ptr = RNA_id_pointer_create(
2250 reinterpret_cast<ID *>(BKE_light_linking_collection_get(object, LIGHT_LINKING_RECEIVER)));
2251 return collection_ptr;
2252}
2253
2254static void rna_LightLinking_receiver_collection_set(PointerRNA *ptr,
2255 PointerRNA value,
2256 ReportList * /*reports*/)
2257{
2258 Object *object = reinterpret_cast<Object *>(ptr->owner_id);
2259 Collection *new_collection = static_cast<Collection *>(value.data);
2260
2262}
2263
2264static PointerRNA rna_LightLinking_blocker_collection_get(PointerRNA *ptr)
2265{
2266 Object *object = reinterpret_cast<Object *>(ptr->owner_id);
2267 PointerRNA collection_ptr = RNA_id_pointer_create(
2268 reinterpret_cast<ID *>(BKE_light_linking_collection_get(object, LIGHT_LINKING_BLOCKER)));
2269 return collection_ptr;
2270}
2271
2272static void rna_LightLinking_blocker_collection_set(PointerRNA *ptr,
2273 PointerRNA value,
2274 ReportList * /*reports*/)
2275{
2276 Object *object = reinterpret_cast<Object *>(ptr->owner_id);
2277 Collection *new_collection = static_cast<Collection *>(value.data);
2278
2280}
2281
2282static void rna_LightLinking_collection_update(Main *bmain, Scene * /*scene*/, PointerRNA *ptr)
2283{
2285
2288}
2289
2290#else
2291
2293{
2294 StructRNA *srna;
2295 PropertyRNA *prop;
2296 FunctionRNA *func;
2297 PropertyRNA *parm;
2298
2299 static const EnumPropertyItem assign_mode_items[] = {
2300 {WEIGHT_REPLACE, "REPLACE", 0, "Replace", "Replace"},
2301 {WEIGHT_ADD, "ADD", 0, "Add", "Add"},
2302 {WEIGHT_SUBTRACT, "SUBTRACT", 0, "Subtract", "Subtract"},
2303 {0, nullptr, 0, nullptr, nullptr},
2304 };
2305
2306 srna = RNA_def_struct(brna, "VertexGroup", nullptr);
2307 RNA_def_struct_sdna(srna, "bDeformGroup");
2309 srna, "Vertex Group", "Group of vertices, used for armature deform and other purposes");
2310 RNA_def_struct_ui_icon(srna, ICON_GROUP_VERTEX);
2311
2312 prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
2313 RNA_def_property_ui_text(prop, "Name", "Vertex group name");
2314 RNA_def_struct_name_property(srna, prop);
2315 RNA_def_property_string_funcs(prop, nullptr, nullptr, "rna_VertexGroup_name_set");
2316 /* update data because modifiers may use #24761. */
2318 prop, NC_GEOM | ND_DATA | NA_RENAME, "rna_Object_internal_update_data_dependency");
2319
2320 prop = RNA_def_property(srna, "lock_weight", PROP_BOOLEAN, PROP_NONE);
2321 RNA_def_property_ui_text(prop, "", "Maintain the relative weights for the group");
2322 RNA_def_property_boolean_sdna(prop, nullptr, "flag", 0);
2323 /* update data because modifiers may use #24761. */
2324 RNA_def_property_update(prop, NC_GEOM | ND_DATA | NA_RENAME, "rna_Object_internal_update_data");
2325
2326 prop = RNA_def_property(srna, "index", PROP_INT, PROP_UNSIGNED);
2328 RNA_def_property_int_funcs(prop, "rna_VertexGroup_index_get", nullptr, nullptr);
2329 RNA_def_property_ui_text(prop, "Index", "Index number of the vertex group");
2330
2331 func = RNA_def_function(srna, "add", "rna_VertexGroup_vertex_add");
2332 RNA_def_function_ui_description(func, "Add vertices to the group");
2334 /* TODO: see how array size of 0 works, this shouldn't be used. */
2335 parm = RNA_def_int_array(func, "index", 1, nullptr, 0, 0, "", "List of indices", 0, 0);
2337 parm = RNA_def_float(func, "weight", 0, 0.0f, 1.0f, "", "Vertex weight", 0.0f, 1.0f);
2339 parm = RNA_def_enum(func, "type", assign_mode_items, 0, "", "Vertex assign mode");
2341
2342 func = RNA_def_function(srna, "remove", "rna_VertexGroup_vertex_remove");
2343 RNA_def_function_ui_description(func, "Remove vertices from the group");
2345 /* TODO: see how array size of 0 works, this shouldn't be used. */
2346 parm = RNA_def_int_array(func, "index", 1, nullptr, 0, 0, "", "List of indices", 0, 0);
2348
2349 func = RNA_def_function(srna, "weight", "rna_VertexGroup_weight");
2350 RNA_def_function_ui_description(func, "Get a vertex weight from the group");
2352 parm = RNA_def_int(func, "index", 0, 0, INT_MAX, "Index", "The index of the vertex", 0, INT_MAX);
2354 parm = RNA_def_float(func, "weight", 0, 0.0f, 1.0f, "", "Vertex weight", 0.0f, 1.0f);
2355 RNA_def_function_return(func, parm);
2356}
2357
2359{
2360 StructRNA *srna;
2361 PropertyRNA *prop;
2362
2363 static const EnumPropertyItem link_items[] = {
2364 {1, "OBJECT", ICON_OBJECT_DATAMODE, "Object", ""},
2365 {0, "DATA", ICON_MESH_DATA, "Data", ""},
2366 {0, nullptr, 0, nullptr, nullptr},
2367 };
2368
2369 /* NOTE: there is no MaterialSlot equivalent in DNA, so the internal
2370 * pointer data points to ob->mat + index, and we manually implement
2371 * get/set for the properties. */
2372
2373 srna = RNA_def_struct(brna, "MaterialSlot", nullptr);
2374 RNA_def_struct_ui_text(srna, "Material Slot", "Material slot in an object");
2375 RNA_def_struct_ui_icon(srna, ICON_MATERIAL_DATA);
2376
2378
2379 /* WARNING! Order is crucial for override to work properly here... :/
2380 * 'link' must come before material pointer,
2381 * since it defines where (in object or obdata) that one is set! */
2382 prop = RNA_def_property(srna, "link", PROP_ENUM, PROP_NONE);
2383 RNA_def_property_enum_items(prop, link_items);
2385 prop, "rna_MaterialSlot_link_get", "rna_MaterialSlot_link_set", nullptr);
2386 RNA_def_property_ui_text(prop, "Link", "Link material to object or the object's data");
2387 RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_MaterialSlot_update");
2388
2389 prop = RNA_def_property(srna, "material", PROP_POINTER, PROP_NONE);
2390 RNA_def_property_struct_type(prop, "Material");
2392 RNA_def_property_editable_func(prop, "rna_MaterialSlot_material_editable");
2394 "rna_MaterialSlot_material_get",
2395 "rna_MaterialSlot_material_set",
2396 nullptr,
2397 "rna_MaterialSlot_material_poll");
2398 RNA_def_property_ui_text(prop, "Material", "Material data-block used by this material slot");
2399 RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_MaterialSlot_update");
2400
2401 prop = RNA_def_property(srna, "slot_index", PROP_INT, PROP_NONE);
2403 RNA_def_property_int_funcs(prop, "rna_MaterialSlot_index_get", nullptr, nullptr);
2404
2405 prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
2407 prop, "rna_MaterialSlot_name_get", "rna_MaterialSlot_name_length", nullptr);
2408 RNA_def_property_ui_text(prop, "Name", "Material slot name");
2412 RNA_def_struct_name_property(srna, prop);
2413
2415
2416 RNA_def_struct_path_func(srna, "rna_MaterialSlot_path");
2417}
2418
2420{
2421 StructRNA *srna;
2422 PropertyRNA *prop;
2423
2424 FunctionRNA *func;
2425 PropertyRNA *parm;
2426
2427 RNA_def_property_srna(cprop, "ObjectConstraints");
2428 srna = RNA_def_struct(brna, "ObjectConstraints", nullptr);
2429 RNA_def_struct_sdna(srna, "Object");
2430 RNA_def_struct_ui_text(srna, "Object Constraints", "Collection of object constraints");
2431
2432 /* Collection active property */
2433 prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
2434 RNA_def_property_struct_type(prop, "Constraint");
2436 "rna_Object_active_constraint_get",
2437 "rna_Object_active_constraint_set",
2438 nullptr,
2439 nullptr);
2441 RNA_def_property_ui_text(prop, "Active Constraint", "Active Object constraint");
2442
2443 /* Constraint collection */
2444 func = RNA_def_function(srna, "new", "rna_Object_constraints_new");
2445 RNA_def_function_ui_description(func, "Add a new constraint to this object");
2447 /* object to add */
2448 parm = RNA_def_enum(
2449 func, "type", rna_enum_constraint_type_items, 1, "", "Constraint type to add");
2451 /* return type */
2452 parm = RNA_def_pointer(func, "constraint", "Constraint", "", "New constraint");
2453 RNA_def_function_return(func, parm);
2454
2455 func = RNA_def_function(srna, "remove", "rna_Object_constraints_remove");
2456 RNA_def_function_ui_description(func, "Remove a constraint from this object");
2458 /* constraint to remove */
2459 parm = RNA_def_pointer(func, "constraint", "Constraint", "", "Removed constraint");
2462
2463 func = RNA_def_function(srna, "clear", "rna_Object_constraints_clear");
2465 RNA_def_function_ui_description(func, "Remove all constraint from this object");
2466
2467 func = RNA_def_function(srna, "move", "rna_Object_constraints_move");
2468 RNA_def_function_ui_description(func, "Move a constraint to a different position");
2470 parm = RNA_def_int(
2471 func, "from_index", -1, INT_MIN, INT_MAX, "From Index", "Index to move", 0, 10000);
2473 parm = RNA_def_int(func, "to_index", -1, INT_MIN, INT_MAX, "To Index", "Target index", 0, 10000);
2475
2476 func = RNA_def_function(srna, "copy", "rna_Object_constraints_copy");
2477 RNA_def_function_ui_description(func, "Add a new constraint that is a copy of the given one");
2479 /* constraint to copy */
2480 parm = RNA_def_pointer(func,
2481 "constraint",
2482 "Constraint",
2483 "",
2484 "Constraint to copy - may belong to a different object");
2487 /* return type */
2488 parm = RNA_def_pointer(func, "new_constraint", "Constraint", "", "New constraint");
2489 RNA_def_function_return(func, parm);
2490}
2491
2492/* object.modifiers */
2494{
2495 StructRNA *srna;
2496
2497 FunctionRNA *func;
2498 PropertyRNA *parm;
2499 PropertyRNA *prop;
2500
2501 RNA_def_property_srna(cprop, "ObjectModifiers");
2502 srna = RNA_def_struct(brna, "ObjectModifiers", nullptr);
2503 RNA_def_struct_sdna(srna, "Object");
2504 RNA_def_struct_ui_text(srna, "Object Modifiers", "Collection of object modifiers");
2505
2506# if 0
2507 prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
2508 RNA_def_property_struct_type(prop, "EditBone");
2509 RNA_def_property_pointer_sdna(prop, nullptr, "act_edbone");
2511 RNA_def_property_ui_text(prop, "Active EditBone", "Armatures active edit bone");
2512 // RNA_def_property_update(prop, 0, "rna_Armature_act_editbone_update");
2514 prop, nullptr, "rna_Armature_act_edit_bone_set", nullptr, nullptr);
2515
2516 /* TODO: redraw. */
2517 // RNA_def_property_collection_active(prop, prop_act);
2518# endif
2519
2520 /* add modifier */
2521 func = RNA_def_function(srna, "new", "rna_Object_modifier_new");
2523 RNA_def_function_ui_description(func, "Add a new modifier");
2524 parm = RNA_def_string(func, "name", "Name", 0, "", "New name for the modifier");
2526 /* modifier to add */
2527 parm = RNA_def_enum(
2528 func, "type", rna_enum_object_modifier_type_items, 1, "", "Modifier type to add");
2530 /* return type */
2531 parm = RNA_def_pointer(func, "modifier", "Modifier", "", "Newly created modifier");
2532 RNA_def_function_return(func, parm);
2533
2534 /* remove modifier */
2535 func = RNA_def_function(srna, "remove", "rna_Object_modifier_remove");
2537 RNA_def_function_ui_description(func, "Remove an existing modifier from the object");
2538 /* modifier to remove */
2539 parm = RNA_def_pointer(func, "modifier", "Modifier", "", "Modifier to remove");
2542
2543 /* clear all modifiers */
2544 func = RNA_def_function(srna, "clear", "rna_Object_modifier_clear");
2546 RNA_def_function_ui_description(func, "Remove all modifiers from the object");
2547
2548 /* move a modifier */
2549 func = RNA_def_function(srna, "move", "rna_Object_modifier_move");
2550 RNA_def_function_ui_description(func, "Move a modifier to a different position");
2552 parm = RNA_def_int(
2553 func, "from_index", -1, INT_MIN, INT_MAX, "From Index", "Index to move", 0, 10000);
2555 parm = RNA_def_int(func, "to_index", -1, INT_MIN, INT_MAX, "To Index", "Target index", 0, 10000);
2557
2558 /* Active modifier. */
2559 prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
2560 RNA_def_property_struct_type(prop, "Modifier");
2562 prop, "rna_Object_active_modifier_get", "rna_Object_active_modifier_set", nullptr, nullptr);
2566 RNA_def_property_ui_text(prop, "Active Modifier", "The active modifier in the list");
2568}
2569
2570/* object.shaderfxs */
2572{
2573 StructRNA *srna;
2574
2575 FunctionRNA *func;
2576 PropertyRNA *parm;
2577
2578 RNA_def_property_srna(cprop, "ObjectShaderFx");
2579 srna = RNA_def_struct(brna, "ObjectShaderFx", nullptr);
2580 RNA_def_struct_sdna(srna, "Object");
2581 RNA_def_struct_ui_text(srna, "Object Shader Effects", "Collection of object effects");
2582
2583 /* add shader_fx */
2584 func = RNA_def_function(srna, "new", "rna_Object_shaderfx_new");
2586 RNA_def_function_ui_description(func, "Add a new shader fx");
2587 parm = RNA_def_string(func, "name", "Name", 0, "", "New name for the effect");
2589 /* shader to add */
2590 parm = RNA_def_enum(
2591 func, "type", rna_enum_object_shaderfx_type_items, 1, "", "Effect type to add");
2593 /* return type */
2594 parm = RNA_def_pointer(func, "shader_fx", "ShaderFx", "", "Newly created effect");
2595 RNA_def_function_return(func, parm);
2596
2597 /* remove shader_fx */
2598 func = RNA_def_function(srna, "remove", "rna_Object_shaderfx_remove");
2600 RNA_def_function_ui_description(func, "Remove an existing effect from the object");
2601 /* shader to remove */
2602 parm = RNA_def_pointer(func, "shader_fx", "ShaderFx", "", "Effect to remove");
2605
2606 /* clear all shader fx */
2607 func = RNA_def_function(srna, "clear", "rna_Object_shaderfx_clear");
2609 RNA_def_function_ui_description(func, "Remove all effects from the object");
2610}
2611
2612/* object.particle_systems */
2614{
2615 StructRNA *srna;
2616
2617 PropertyRNA *prop;
2618
2619 // FunctionRNA *func;
2620 // PropertyRNA *parm;
2621
2622 RNA_def_property_srna(cprop, "ParticleSystems");
2623 srna = RNA_def_struct(brna, "ParticleSystems", nullptr);
2624 RNA_def_struct_sdna(srna, "Object");
2625 RNA_def_struct_ui_text(srna, "Particle Systems", "Collection of particle systems");
2626
2627 prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
2628 RNA_def_property_struct_type(prop, "ParticleSystem");
2630 prop, "rna_Object_active_particle_system_get", nullptr, nullptr, nullptr);
2632 prop, "Active Particle System", "Active particle system being displayed");
2633 RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, nullptr);
2634
2635 prop = RNA_def_property(srna, "active_index", PROP_INT, PROP_UNSIGNED);
2638 "rna_Object_active_particle_system_index_get",
2639 "rna_Object_active_particle_system_index_set",
2640 "rna_Object_active_particle_system_index_range");
2642 prop, "Active Particle System Index", "Index of active particle system slot");
2643 RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_particle_update");
2644}
2645
2646/* object.vertex_groups */
2648{
2649 StructRNA *srna;
2650
2651 PropertyRNA *prop;
2652
2653 FunctionRNA *func;
2654 PropertyRNA *parm;
2655
2656 RNA_def_property_srna(cprop, "VertexGroups");
2657 srna = RNA_def_struct(brna, "VertexGroups", nullptr);
2658 RNA_def_struct_sdna(srna, "Object");
2659 RNA_def_struct_ui_text(srna, "Vertex Groups", "Collection of vertex groups");
2660
2661 prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
2662 RNA_def_property_struct_type(prop, "VertexGroup");
2664 "rna_Object_active_vertex_group_get",
2665 "rna_Object_active_vertex_group_set",
2666 nullptr,
2667 nullptr);
2669 RNA_def_property_ui_text(prop, "Active Vertex Group", "Vertex groups of the object");
2670 RNA_def_property_update(prop, NC_GEOM | ND_DATA, "rna_Object_vertex_groups_update");
2671
2672 prop = RNA_def_property(srna, "active_index", PROP_INT, PROP_UNSIGNED);
2675 "rna_Object_active_vertex_group_index_get",
2676 "rna_Object_active_vertex_group_index_set",
2677 "rna_Object_active_vertex_group_index_range");
2679 prop, "Active Vertex Group Index", "Active index in vertex group array");
2680 RNA_def_property_update(prop, NC_GEOM | ND_DATA, "rna_Object_vertex_groups_update");
2681
2682 /* vertex groups */ /* add_vertex_group */
2683 func = RNA_def_function(srna, "new", "rna_Object_vgroup_new");
2685 RNA_def_function_ui_description(func, "Add vertex group to object");
2686 RNA_def_string(func, "name", "Group", 0, "", "Vertex group name"); /* optional */
2687 parm = RNA_def_pointer(func, "group", "VertexGroup", "", "New vertex group");
2688 RNA_def_function_return(func, parm);
2689
2690 func = RNA_def_function(srna, "remove", "rna_Object_vgroup_remove");
2692 RNA_def_function_ui_description(func, "Delete vertex group from object");
2693 parm = RNA_def_pointer(func, "group", "VertexGroup", "", "Vertex group to remove");
2696
2697 func = RNA_def_function(srna, "clear", "rna_Object_vgroup_clear");
2699 RNA_def_function_ui_description(func, "Delete all vertex groups from object");
2700}
2701
2703{
2704 StructRNA *srna;
2705 PropertyRNA *prop;
2706
2707 srna = RNA_def_struct(brna, "ObjectDisplay", nullptr);
2708 RNA_def_struct_ui_text(srna, "Object Display", "Object display settings for 3D viewport");
2709 RNA_def_struct_sdna(srna, "Object");
2710 RNA_def_struct_nested(brna, srna, "Object");
2711 RNA_def_struct_path_func(srna, "rna_ObjectDisplay_path");
2712
2714
2715 prop = RNA_def_property(srna, "show_shadows", PROP_BOOLEAN, PROP_NONE);
2717 RNA_def_property_ui_text(prop, "Shadow", "Object cast shadows in the 3D viewport");
2718 RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, nullptr);
2719
2721}
2722
2724{
2725 StructRNA *srna;
2726 PropertyRNA *prop;
2727
2728 static const EnumPropertyItem prop_feature_line_usage_items[] = {
2729 {OBJECT_LRT_INHERIT, "INHERIT", 0, "Inherit", "Use settings from the parent collection"},
2731 "INCLUDE",
2732 0,
2733 "Include",
2734 "Generate feature lines for this object's data"},
2736 "OCCLUSION_ONLY",
2737 0,
2738 "Occlusion Only",
2739 "Only use the object data to produce occlusion"},
2741 "EXCLUDE",
2742 0,
2743 "Exclude",
2744 "Don't use this object for Line Art rendering"},
2746 "INTERSECTION_ONLY",
2747 0,
2748 "Intersection Only",
2749 "Only generate intersection lines for this collection"},
2751 "NO_INTERSECTION",
2752 0,
2753 "No Intersection",
2754 "Include this object but do not generate intersection lines"},
2756 "FORCE_INTERSECTION",
2757 0,
2758 "Force Intersection",
2759 "Generate intersection lines even with objects that disabled intersection"},
2760 {0, nullptr, 0, nullptr, nullptr},
2761 };
2762
2763 srna = RNA_def_struct(brna, "ObjectLineArt", nullptr);
2764 RNA_def_struct_ui_text(srna, "Object Line Art", "Object Line Art settings");
2765 RNA_def_struct_sdna(srna, "ObjectLineArt");
2766 RNA_def_struct_path_func(srna, "rna_ObjectLineArt_path");
2767
2768 prop = RNA_def_property(srna, "usage", PROP_ENUM, PROP_NONE);
2769 RNA_def_property_enum_items(prop, prop_feature_line_usage_items);
2770 RNA_def_property_ui_text(prop, "Usage", "How to use this object in Line Art calculation");
2771 RNA_def_property_update(prop, 0, "rna_object_lineart_update");
2772
2773 prop = RNA_def_property(srna, "use_crease_override", PROP_BOOLEAN, PROP_NONE);
2776 prop, "Use Crease", "Use this object's crease setting to overwrite scene global");
2777 RNA_def_property_update(prop, 0, "rna_object_lineart_update");
2778
2779 prop = RNA_def_property(srna, "crease_threshold", PROP_FLOAT, PROP_ANGLE);
2780 RNA_def_property_range(prop, 0, DEG2RAD(180.0f));
2781 RNA_def_property_ui_range(prop, 0.0f, DEG2RAD(180.0f), 0.01f, 1);
2782 RNA_def_property_ui_text(prop, "Crease", "Angles smaller than this will be treated as creases");
2783 RNA_def_property_update(prop, 0, "rna_object_lineart_update");
2784
2785 prop = RNA_def_property(srna, "use_intersection_priority_override", PROP_BOOLEAN, PROP_NONE);
2788 prop,
2789 "Use Intersection Priority",
2790 "Use this object's intersection priority to override collection setting");
2791 RNA_def_property_update(prop, 0, "rna_object_lineart_update");
2792
2793 prop = RNA_def_property(srna, "intersection_priority", PROP_INT, PROP_NONE);
2794 RNA_def_property_range(prop, 0, 255);
2796 "Intersection Priority",
2797 "The intersection line will be included into the object with the "
2798 "higher intersection priority value");
2799 RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_object_lineart_update");
2800}
2801
2803{
2804 PropertyRNA *prop;
2805
2806 /* Hide options. */
2807 prop = RNA_def_property(srna, "hide_viewport", PROP_BOOLEAN, PROP_NONE);
2808 RNA_def_property_boolean_sdna(prop, nullptr, "visibility_flag", OB_HIDE_VIEWPORT);
2809 RNA_def_property_ui_text(prop, "Disable in Viewports", "Globally disable in viewports");
2810 RNA_def_property_ui_icon(prop, ICON_RESTRICT_VIEW_OFF, -1);
2811 RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_hide_update");
2812
2813 prop = RNA_def_property(srna, "hide_select", PROP_BOOLEAN, PROP_NONE);
2814 RNA_def_property_boolean_sdna(prop, nullptr, "visibility_flag", OB_HIDE_SELECT);
2816 RNA_def_property_ui_text(prop, "Disable Selection", "Disable selection in viewport");
2817 RNA_def_property_ui_icon(prop, ICON_RESTRICT_SELECT_OFF, -1);
2818 RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_hide_update");
2819
2820 prop = RNA_def_property(srna, "hide_render", PROP_BOOLEAN, PROP_NONE);
2821 RNA_def_property_boolean_sdna(prop, nullptr, "visibility_flag", OB_HIDE_RENDER);
2822 RNA_def_property_ui_text(prop, "Disable in Renders", "Globally disable in renders");
2823 RNA_def_property_ui_icon(prop, ICON_RESTRICT_RENDER_OFF, -1);
2824 RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_hide_update");
2825
2826 prop = RNA_def_property(srna, "hide_probe_volume", PROP_BOOLEAN, PROP_NONE);
2827 RNA_def_property_boolean_sdna(prop, nullptr, "visibility_flag", OB_HIDE_PROBE_VOLUME);
2828 RNA_def_property_ui_text(prop, "Disable in Volume Probes", "Globally disable in volume probes");
2829 RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_internal_update_draw");
2830
2831 prop = RNA_def_property(srna, "hide_probe_sphere", PROP_BOOLEAN, PROP_NONE);
2832 RNA_def_property_boolean_sdna(prop, nullptr, "visibility_flag", OB_HIDE_PROBE_CUBEMAP);
2834 prop, "Disable in Spherical Light Probes", "Globally disable in spherical light probes");
2835 RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_internal_update_draw");
2836
2837 prop = RNA_def_property(srna, "hide_probe_plane", PROP_BOOLEAN, PROP_NONE);
2838 RNA_def_property_boolean_sdna(prop, nullptr, "visibility_flag", OB_HIDE_PROBE_PLANAR);
2840 prop, "Disable in Planar Light Probes", "Globally disable in planar light probes");
2841 RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_internal_update_draw");
2842
2843 prop = RNA_def_property(srna, "hide_surface_pick", PROP_BOOLEAN, PROP_NONE);
2844 RNA_def_property_boolean_sdna(prop, nullptr, "visibility_flag", OB_HIDE_SURFACE_PICK);
2846 prop,
2847 "Disable in Surface Picking",
2848 "Disable surface influence during selection, snapping and depth-picking operators. "
2849 "Usually used to avoid semi-transparent objects to affect scene navigation");
2850 RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_internal_update_draw");
2851
2852 /* Instancer options. */
2853 prop = RNA_def_property(srna, "show_instancer_for_render", PROP_BOOLEAN, PROP_NONE);
2854 RNA_def_property_boolean_sdna(prop, nullptr, "duplicator_visibility_flag", OB_DUPLI_FLAG_RENDER);
2855 RNA_def_property_ui_text(prop, "Render Instancer", "Make instancer visible when rendering");
2857 prop, NC_OBJECT | ND_DRAW, "rna_Object_duplicator_visibility_flag_update");
2858
2859 prop = RNA_def_property(srna, "show_instancer_for_viewport", PROP_BOOLEAN, PROP_NONE);
2861 prop, nullptr, "duplicator_visibility_flag", OB_DUPLI_FLAG_VIEWPORT);
2862 RNA_def_property_ui_text(prop, "Display Instancer", "Make instancer visible in the viewport");
2864 prop, NC_OBJECT | ND_DRAW, "rna_Object_duplicator_visibility_flag_update");
2865
2866 /* Ray visibility. */
2867 prop = RNA_def_property(srna, "visible_camera", PROP_BOOLEAN, PROP_NONE);
2868 RNA_def_property_boolean_negative_sdna(prop, nullptr, "visibility_flag", OB_HIDE_CAMERA);
2869 RNA_def_property_ui_text(prop, "Camera Visibility", "Object visibility to camera rays");
2870 RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_internal_update_draw");
2871
2872 prop = RNA_def_property(srna, "visible_diffuse", PROP_BOOLEAN, PROP_NONE);
2873 RNA_def_property_boolean_negative_sdna(prop, nullptr, "visibility_flag", OB_HIDE_DIFFUSE);
2874 RNA_def_property_ui_text(prop, "Diffuse Visibility", "Object visibility to diffuse rays");
2875 RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_internal_update_draw");
2876
2877 prop = RNA_def_property(srna, "visible_glossy", PROP_BOOLEAN, PROP_NONE);
2878 RNA_def_property_boolean_negative_sdna(prop, nullptr, "visibility_flag", OB_HIDE_GLOSSY);
2879 RNA_def_property_ui_text(prop, "Glossy Visibility", "Object visibility to glossy rays");
2880 RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_internal_update_draw");
2881
2882 prop = RNA_def_property(srna, "visible_transmission", PROP_BOOLEAN, PROP_NONE);
2883 RNA_def_property_boolean_negative_sdna(prop, nullptr, "visibility_flag", OB_HIDE_TRANSMISSION);
2885 prop, "Transmission Visibility", "Object visibility to transmission rays");
2886 RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_internal_update_draw");
2887
2888 prop = RNA_def_property(srna, "visible_volume_scatter", PROP_BOOLEAN, PROP_NONE);
2889 RNA_def_property_boolean_negative_sdna(prop, nullptr, "visibility_flag", OB_HIDE_VOLUME_SCATTER);
2891 prop, "Volume Scatter Visibility", "Object visibility to volume scattering rays");
2892 RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_internal_update_draw");
2893
2894 prop = RNA_def_property(srna, "visible_shadow", PROP_BOOLEAN, PROP_NONE);
2895 RNA_def_property_boolean_negative_sdna(prop, nullptr, "visibility_flag", OB_HIDE_SHADOW);
2896 RNA_def_property_ui_text(prop, "Shadow Visibility", "Object visibility to shadow rays");
2897 RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_internal_update_draw");
2898
2899 /* Holdout and shadow catcher. */
2900 prop = RNA_def_property(srna, "is_holdout", PROP_BOOLEAN, PROP_NONE);
2901 RNA_def_property_boolean_sdna(prop, nullptr, "visibility_flag", OB_HOLDOUT);
2903 prop,
2904 "Holdout",
2905 "Render objects as a holdout or matte, creating a hole in the image with zero alpha, to "
2906 "fill out in compositing with real footage or another render");
2907 RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_hide_update");
2908
2909 prop = RNA_def_property(srna, "is_shadow_catcher", PROP_BOOLEAN, PROP_NONE);
2910 RNA_def_property_boolean_sdna(prop, nullptr, "visibility_flag", OB_SHADOW_CATCHER);
2912 prop,
2913 "Shadow Catcher",
2914 "Only render shadows and reflections on this object, for compositing renders into real "
2915 "footage. Objects with this setting are considered to already exist in the footage, "
2916 "objects without it are synthetic objects being composited into it.");
2917 RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_internal_update_draw");
2918}
2919
2920static void rna_def_object(BlenderRNA *brna)
2921{
2922 StructRNA *srna;
2923 PropertyRNA *prop;
2924
2925 static const EnumPropertyItem up_items[] = {
2926 {OB_POSX, "X", 0, "X", ""},
2927 {OB_POSY, "Y", 0, "Y", ""},
2928 {OB_POSZ, "Z", 0, "Z", ""},
2929 {0, nullptr, 0, nullptr, nullptr},
2930 };
2931
2932 static const EnumPropertyItem drawtype_items[] = {
2933 {OB_BOUNDBOX, "BOUNDS", 0, "Bounds", "Display the bounds of the object"},
2934 {OB_WIRE, "WIRE", 0, "Wire", "Display the object as a wireframe"},
2935 {OB_SOLID,
2936 "SOLID",
2937 0,
2938 "Solid",
2939 "Display the object as a solid (if solid drawing is enabled in the viewport)"},
2940 {OB_TEXTURE,
2941 "TEXTURED",
2942 0,
2943 "Textured",
2944 "Display the object with textures (if textures are enabled in the viewport)"},
2945 {0, nullptr, 0, nullptr, nullptr},
2946 };
2947
2948 static const EnumPropertyItem boundtype_items[] = {
2949 {OB_BOUND_BOX, "BOX", 0, "Box", "Display bounds as box"},
2950 {OB_BOUND_SPHERE, "SPHERE", 0, "Sphere", "Display bounds as sphere"},
2951 {OB_BOUND_CYLINDER, "CYLINDER", 0, "Cylinder", "Display bounds as cylinder"},
2952 {OB_BOUND_CONE, "CONE", 0, "Cone", "Display bounds as cone"},
2953 {OB_BOUND_CAPSULE, "CAPSULE", 0, "Capsule", "Display bounds as capsule"},
2954 {0, nullptr, 0, nullptr, nullptr},
2955 };
2956
2957 static int boundbox_dimsize[] = {8, 3};
2958
2959 srna = RNA_def_struct(brna, "Object", "ID");
2960 RNA_def_struct_ui_text(srna, "Object", "Object data-block defining an object in a scene");
2962 RNA_def_struct_ui_icon(srna, ICON_OBJECT_DATA);
2963
2965
2966 prop = RNA_def_property(srna, "data", PROP_POINTER, PROP_NONE);
2967 RNA_def_property_struct_type(prop, "ID");
2969 prop, "rna_Object_data_get", "rna_Object_data_set", "rna_Object_data_typef", nullptr);
2971 RNA_def_property_ui_text(prop, "Data", "Object data");
2972 RNA_def_property_update(prop, 0, "rna_Object_data_update");
2973
2974 prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
2975 RNA_def_property_enum_sdna(prop, nullptr, "type");
2979 RNA_def_property_ui_text(prop, "Type", "Type of object");
2981
2982 prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
2983 RNA_def_property_enum_sdna(prop, nullptr, "mode");
2986 RNA_def_property_ui_text(prop, "Mode", "Object interaction mode");
2987
2988 /* for data access */
2989 prop = RNA_def_property(srna, "bound_box", PROP_FLOAT, PROP_NONE);
2990 RNA_def_property_multi_array(prop, 2, boundbox_dimsize);
2994 RNA_def_property_float_funcs(prop, "rna_Object_boundbox_get", nullptr, nullptr);
2996 prop,
2997 "Bounding Box",
2998 "Object's bounding box in object-space coordinates, all values are -1.0 when "
2999 "not available");
3000
3001 /* parent */
3002 prop = RNA_def_property(srna, "parent", PROP_POINTER, PROP_NONE);
3003 RNA_def_property_pointer_funcs(prop, nullptr, "rna_Object_parent_set", nullptr, nullptr);
3005 RNA_def_property_override_funcs(prop, nullptr, nullptr, "rna_Object_parent_override_apply");
3006 RNA_def_property_ui_text(prop, "Parent", "Parent object");
3007 RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_dependency_update");
3008
3009 prop = RNA_def_property(srna, "parent_type", PROP_ENUM, PROP_NONE);
3010 RNA_def_property_enum_bitflag_sdna(prop, nullptr, "partype");
3013 prop, nullptr, "rna_Object_parent_type_set", "rna_Object_parent_type_itemf");
3014 RNA_def_property_override_funcs(prop, nullptr, nullptr, "rna_Object_parent_type_override_apply");
3015 RNA_def_property_ui_text(prop, "Parent Type", "Type of parent relation");
3016 RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_dependency_update");
3017
3018 prop = RNA_def_property(srna, "parent_vertices", PROP_INT, PROP_UNSIGNED);
3019 RNA_def_property_int_sdna(prop, nullptr, "par1");
3020 RNA_def_property_array(prop, 3);
3022 prop, "Parent Vertices", "Indices of vertices in case of a vertex parenting relation");
3023 RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_internal_update");
3024
3025 prop = RNA_def_property(srna, "parent_bone", PROP_STRING, PROP_NONE);
3026 RNA_def_property_string_sdna(prop, nullptr, "parsubstr");
3027 RNA_def_property_string_funcs(prop, nullptr, nullptr, "rna_Object_parent_bone_set");
3028 RNA_def_property_override_funcs(prop, nullptr, nullptr, "rna_Object_parent_bone_override_apply");
3030 prop, "Parent Bone", "Name of parent bone in case of a bone parenting relation");
3031 RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_dependency_update");
3032
3033 prop = RNA_def_property(srna, "use_parent_final_indices", PROP_BOOLEAN, PROP_NONE);
3036 prop,
3037 "Use Final Indices",
3038 "Use the final evaluated indices rather than the original mesh indices");
3039 RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_internal_update");
3040
3041 prop = RNA_def_property(srna, "use_camera_lock_parent", PROP_BOOLEAN, PROP_NONE);
3043 prop, nullptr, "transflag", OB_TRANSFORM_ADJUST_ROOT_PARENT_FOR_VIEW_LOCK);
3045 "Camera Parent Lock",
3046 "View Lock 3D viewport camera transformation affects the object's "
3047 "parent instead");
3048 RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_internal_update");
3049
3050 /* Track and Up flags */
3051 /* XXX: these have been saved here for a bit longer (after old track was removed),
3052 * since some other tools still refer to this */
3053 prop = RNA_def_property(srna, "track_axis", PROP_ENUM, PROP_NONE);
3054 RNA_def_property_enum_sdna(prop, nullptr, "trackflag");
3057 prop,
3058 "Track Axis",
3059 "Axis that points in the 'forward' direction (applies to Instance Vertices when "
3060 "Align to Vertex Normal is enabled)");
3061 RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_internal_update");
3062
3063 prop = RNA_def_property(srna, "up_axis", PROP_ENUM, PROP_NONE);
3064 RNA_def_property_enum_sdna(prop, nullptr, "upflag");
3065 RNA_def_property_enum_items(prop, up_items);
3067 prop,
3068 "Up Axis",
3069 "Axis that points in the upward direction (applies to Instance Vertices when "
3070 "Align to Vertex Normal is enabled)");
3071 RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_internal_update");
3072
3073 /* materials */
3074 prop = RNA_def_property(srna, "material_slots", PROP_COLLECTION, PROP_NONE);
3075 RNA_def_property_struct_type(prop, "MaterialSlot");
3077 /* Don't dereference the material slot pointer, it is the slot index encoded in a pointer. */
3079 "rna_Object_material_slots_begin",
3080 "rna_Object_material_slots_next",
3081 "rna_Object_material_slots_end",
3082 "rna_Object_material_slots_get",
3083 "rna_Object_material_slots_length",
3084 nullptr,
3085 nullptr,
3086 nullptr);
3087 RNA_def_property_ui_text(prop, "Material Slots", "Material slots in the object");
3088
3089 prop = RNA_def_property(srna, "active_material", PROP_POINTER, PROP_NONE);
3090 RNA_def_property_struct_type(prop, "Material");
3092 "rna_Object_active_material_get",
3093 "rna_Object_active_material_set",
3094 nullptr,
3095 "rna_MaterialSlot_material_poll");
3097 RNA_def_property_editable_func(prop, "rna_Object_active_material_editable");
3098 RNA_def_property_ui_text(prop, "Active Material", "Active material being displayed");
3099 RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_MaterialSlot_update");
3100
3101 prop = RNA_def_property(srna, "active_material_index", PROP_INT, PROP_UNSIGNED);
3102 RNA_def_property_int_sdna(prop, nullptr, "actcol");
3106 "rna_Object_active_material_index_get",
3107 "rna_Object_active_material_index_set",
3108 "rna_Object_active_material_index_range");
3109 RNA_def_property_ui_text(prop, "Active Material Index", "Index of active material slot");
3111
3112 /* transform */
3113 prop = RNA_def_property(srna, "location", PROP_FLOAT, PROP_TRANSLATION);
3114 RNA_def_property_float_sdna(prop, nullptr, "loc");
3115 RNA_def_property_editable_array_func(prop, "rna_Object_location_editable");
3116 RNA_def_property_ui_text(prop, "Location", "Location of the object");
3118 RNA_def_property_update(prop, NC_OBJECT | ND_TRANSFORM, "rna_Object_internal_update");
3119
3120 prop = RNA_def_property(srna, "rotation_quaternion", PROP_FLOAT, PROP_QUATERNION);
3121 RNA_def_property_float_sdna(prop, nullptr, "quat");
3122 RNA_def_property_editable_array_func(prop, "rna_Object_rotation_4d_editable");
3123 RNA_def_property_ui_text(prop, "Quaternion Rotation", "Rotation in Quaternions");
3124 RNA_def_property_update(prop, NC_OBJECT | ND_TRANSFORM, "rna_Object_internal_update");
3125
3126 /* XXX: for axis-angle, it would have been nice to have 2 separate fields for UI purposes, but
3127 * having a single one is better for Keyframing and other property-management situations...
3128 */
3129 prop = RNA_def_property(srna, "rotation_axis_angle", PROP_FLOAT, PROP_AXISANGLE);
3130 RNA_def_property_array(prop, 4);
3132 prop, "rna_Object_rotation_axis_angle_get", "rna_Object_rotation_axis_angle_set", nullptr);
3133 RNA_def_property_editable_array_func(prop, "rna_Object_rotation_4d_editable");
3136 prop, "Axis-Angle Rotation", "Angle of Rotation for Axis-Angle rotation representation");
3137 RNA_def_property_update(prop, NC_OBJECT | ND_TRANSFORM, "rna_Object_internal_update");
3138
3139 prop = RNA_def_property(srna, "rotation_euler", PROP_FLOAT, PROP_EULER);
3140 RNA_def_property_float_sdna(prop, nullptr, "rot");
3141 RNA_def_property_editable_array_func(prop, "rna_Object_rotation_euler_editable");
3143 RNA_def_property_ui_text(prop, "Euler Rotation", "Rotation in Eulers");
3144 RNA_def_property_update(prop, NC_OBJECT | ND_TRANSFORM, "rna_Object_internal_update");
3145
3146 prop = RNA_def_property(srna, "rotation_mode", PROP_ENUM, PROP_NONE);
3147 RNA_def_property_enum_sdna(prop, nullptr, "rotmode");
3149 RNA_def_property_enum_funcs(prop, nullptr, "rna_Object_rotation_mode_set", nullptr);
3151 prop,
3152 "Rotation Mode",
3153 /* This description is shared by other "rotation_mode" properties. */
3154 "The kind of rotation to apply, values from other rotation modes are not used");
3155 RNA_def_property_update(prop, NC_OBJECT | ND_TRANSFORM, "rna_Object_internal_update");
3156
3157 prop = RNA_def_property(srna, "scale", PROP_FLOAT, PROP_XYZ);
3159 RNA_def_property_editable_array_func(prop, "rna_Object_scale_editable");
3161 RNA_def_property_ui_text(prop, "Scale", "Scaling of the object");
3162 RNA_def_property_update(prop, NC_OBJECT | ND_TRANSFORM, "rna_Object_internal_update");
3163
3164 prop = RNA_def_property(srna, "dimensions", PROP_FLOAT, PROP_XYZ_LENGTH);
3165 RNA_def_property_array(prop, 3);
3166 /* Only as convenient helper for py API, and conflicts with animating scale. */
3171 prop, "rna_Object_dimensions_get", "rna_Object_dimensions_set", nullptr);
3174 "Dimensions",
3175 "Absolute bounding box dimensions of the object.\n"
3176 "Warning: Assigning to it or its members multiple consecutive times "
3177 "will not work correctly, as this needs up-to-date evaluated data");
3178 RNA_def_property_update(prop, NC_OBJECT | ND_TRANSFORM, "rna_Object_internal_update");
3179
3180 /* delta transforms */
3181 prop = RNA_def_property(srna, "delta_location", PROP_FLOAT, PROP_TRANSLATION);
3182 RNA_def_property_float_sdna(prop, nullptr, "dloc");
3184 prop, "Delta Location", "Extra translation added to the location of the object");
3186 RNA_def_property_update(prop, NC_OBJECT | ND_TRANSFORM, "rna_Object_internal_update");
3187
3188 prop = RNA_def_property(srna, "delta_rotation_euler", PROP_FLOAT, PROP_EULER);
3189 RNA_def_property_float_sdna(prop, nullptr, "drot");
3191 prop,
3192 "Delta Rotation (Euler)",
3193 "Extra rotation added to the rotation of the object (when using Euler rotations)");
3195 RNA_def_property_update(prop, NC_OBJECT | ND_TRANSFORM, "rna_Object_internal_update");
3196
3197 prop = RNA_def_property(srna, "delta_rotation_quaternion", PROP_FLOAT, PROP_QUATERNION);
3198 RNA_def_property_float_sdna(prop, nullptr, "dquat");
3200 prop,
3201 "Delta Rotation (Quaternion)",
3202 "Extra rotation added to the rotation of the object (when using Quaternion rotations)");
3203 RNA_def_property_update(prop, NC_OBJECT | ND_TRANSFORM, "rna_Object_internal_update");
3204
3205# if 0 /* XXX not supported well yet... */
3206 prop = RNA_def_property(srna, "delta_rotation_axis_angle", PROP_FLOAT, PROP_AXISANGLE);
3207 /* FIXME: this is not a single field any more! (drotAxis and drotAngle) */
3208 RNA_def_property_float_sdna(prop, nullptr, "dquat");
3211 prop,
3212 "Delta Rotation (Axis Angle)",
3213 "Extra rotation added to the rotation of the object (when using Axis-Angle rotations)");
3214 RNA_def_property_update(prop, NC_OBJECT | ND_TRANSFORM, "rna_Object_internal_update");
3215# endif
3216
3217 prop = RNA_def_property(srna, "delta_scale", PROP_FLOAT, PROP_XYZ);
3218 RNA_def_property_float_sdna(prop, nullptr, "dscale");
3221 RNA_def_property_ui_text(prop, "Delta Scale", "Extra scaling added to the scale of the object");
3222 RNA_def_property_update(prop, NC_OBJECT | ND_TRANSFORM, "rna_Object_internal_update");
3223
3224 /* transform locks */
3225 prop = RNA_def_property(srna, "lock_location", PROP_BOOLEAN, PROP_NONE);
3226 RNA_def_property_boolean_bitset_array_sdna(prop, nullptr, "protectflag", OB_LOCK_LOCX, 3);
3227 RNA_def_property_ui_text(prop, "Lock Location", "Lock editing of location when transforming");
3228 RNA_def_property_ui_icon(prop, ICON_UNLOCKED, 1);
3229 RNA_def_property_update(prop, NC_OBJECT | ND_TRANSFORM, "rna_Object_internal_update");
3230
3231 prop = RNA_def_property(srna, "lock_rotation", PROP_BOOLEAN, PROP_NONE);
3232 RNA_def_property_boolean_bitset_array_sdna(prop, nullptr, "protectflag", OB_LOCK_ROTX, 3);
3233 RNA_def_property_ui_text(prop, "Lock Rotation", "Lock editing of rotation when transforming");
3234 RNA_def_property_ui_icon(prop, ICON_UNLOCKED, 1);
3235 RNA_def_property_update(prop, NC_OBJECT | ND_TRANSFORM, "rna_Object_internal_update");
3236
3237 /* XXX this is sub-optimal - it really should be included above,
3238 * but due to technical reasons we can't do this! */
3239 prop = RNA_def_property(srna, "lock_rotation_w", PROP_BOOLEAN, PROP_NONE);
3240 RNA_def_property_boolean_sdna(prop, nullptr, "protectflag", OB_LOCK_ROTW);
3241 RNA_def_property_ui_icon(prop, ICON_UNLOCKED, 1);
3243 prop,
3244 "Lock Rotation (4D Angle)",
3245 "Lock editing of 'angle' component of four-component rotations when transforming");
3246 /* XXX this needs a better name */
3247 prop = RNA_def_property(srna, "lock_rotations_4d", PROP_BOOLEAN, PROP_NONE);
3248 RNA_def_property_boolean_sdna(prop, nullptr, "protectflag", OB_LOCK_ROT4D);
3250 prop,
3251 "Lock Rotations (4D)",
3252 "Lock editing of four component rotations by components (instead of as Eulers)");
3253
3254 prop = RNA_def_property(srna, "lock_scale", PROP_BOOLEAN, PROP_NONE);
3255 RNA_def_property_boolean_bitset_array_sdna(prop, nullptr, "protectflag", OB_LOCK_SCALEX, 3);
3256 RNA_def_property_ui_text(prop, "Lock Scale", "Lock editing of scale when transforming");
3257 RNA_def_property_ui_icon(prop, ICON_UNLOCKED, 1);
3258 RNA_def_property_update(prop, NC_OBJECT | ND_TRANSFORM, "rna_Object_internal_update");
3259
3260 /* matrix */
3261 prop = RNA_def_property(srna, "matrix_world", PROP_FLOAT, PROP_MATRIX);
3267 prop, "rna_Object_matrix_world_get", "rna_Object_matrix_world_set", nullptr);
3268 RNA_def_property_ui_text(prop, "Matrix World", "Worldspace transformation matrix");
3269 RNA_def_property_update(prop, NC_OBJECT | ND_TRANSFORM, "rna_Object_matrix_world_update");
3270
3271 prop = RNA_def_property(srna, "matrix_local", PROP_FLOAT, PROP_MATRIX);
3277 prop,
3278 "Local Matrix",
3279 "Parent relative transformation matrix.\n"
3280 "Warning: Only takes into account object parenting, so e.g. in case of bone parenting "
3281 "you get a matrix relative to the Armature object, not to the actual parent bone");
3283 prop, "rna_Object_matrix_local_get", "rna_Object_matrix_local_set", nullptr);
3284 RNA_def_property_update(prop, NC_OBJECT | ND_TRANSFORM, "rna_Object_internal_update");
3285
3286 prop = RNA_def_property(srna, "matrix_basis", PROP_FLOAT, PROP_MATRIX);
3292 "Input Matrix",
3293 "Matrix access to location, rotation and scale (including deltas), "
3294 "before constraints and parenting are applied");
3296 prop, "rna_Object_matrix_basis_get", "rna_Object_matrix_basis_set", nullptr);
3297 RNA_def_property_update(prop, NC_OBJECT | ND_TRANSFORM, "rna_Object_internal_update");
3298
3299 /* Parent_inverse. */
3300 prop = RNA_def_property(srna, "matrix_parent_inverse", PROP_FLOAT, PROP_MATRIX);
3301 RNA_def_property_float_sdna(prop, nullptr, "parentinv");
3304 prop, "Parent Inverse Matrix", "Inverse of object's parent matrix at time of parenting");
3305 RNA_def_property_update(prop, NC_OBJECT | ND_TRANSFORM, "rna_Object_internal_update");
3306
3307 /* modifiers */
3308 prop = RNA_def_property(srna, "modifiers", PROP_COLLECTION, PROP_NONE);
3309 RNA_def_property_struct_type(prop, "Modifier");
3311 prop, "Modifiers", "Modifiers affecting the geometric data of the object");
3312 RNA_def_property_override_funcs(prop, nullptr, nullptr, "rna_Object_modifiers_override_apply");
3314 rna_def_object_modifiers(brna, prop);
3315
3316 /* Shader FX. */
3317 prop = RNA_def_property(srna, "shader_effects", PROP_COLLECTION, PROP_NONE);
3318 RNA_def_property_collection_sdna(prop, nullptr, "shader_fx", nullptr);
3319 RNA_def_property_struct_type(prop, "ShaderFx");
3320 RNA_def_property_ui_text(prop, "Shader Effects", "Effects affecting display of object");
3322 rna_def_object_shaderfxs(brna, prop);
3324
3325 /* constraints */
3326 prop = RNA_def_property(srna, "constraints", PROP_COLLECTION, PROP_NONE);
3327 RNA_def_property_struct_type(prop, "Constraint");
3330 prop, "Constraints", "Constraints affecting the transformation of the object");
3331 RNA_def_property_override_funcs(prop, nullptr, nullptr, "rna_Object_constraints_override_apply");
3332# if 0
3334 nullptr,
3335 nullptr,
3336 nullptr,
3337 nullptr,
3338 nullptr,
3339 nullptr,
3340 nullptr,
3341 "constraints__add",
3342 "constraints__remove");
3343# endif
3344 rna_def_object_constraints(brna, prop);
3345
3346 /* vertex groups */
3347 prop = RNA_def_property(srna, "vertex_groups", PROP_COLLECTION, PROP_NONE);
3349 "rna_Object_vertex_groups_begin",
3350 "rna_iterator_listbase_next",
3351 "rna_iterator_listbase_end",
3352 "rna_iterator_listbase_get",
3353 nullptr,
3354 nullptr,
3355 nullptr,
3356 nullptr);
3357 RNA_def_property_struct_type(prop, "VertexGroup");
3359 RNA_def_property_ui_text(prop, "Vertex Groups", "Vertex groups of the object");
3360 rna_def_object_vertex_groups(brna, prop);
3361
3362 /* empty */
3363 prop = RNA_def_property(srna, "empty_display_type", PROP_ENUM, PROP_NONE);
3364 RNA_def_property_enum_sdna(prop, nullptr, "empty_drawtype");
3366 RNA_def_property_enum_funcs(prop, nullptr, "rna_Object_empty_display_type_set", nullptr);
3367 RNA_def_property_ui_text(prop, "Empty Display Type", "Viewport display style for empties");
3368 RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, nullptr);
3369
3370 prop = RNA_def_property(srna, "empty_display_size", PROP_FLOAT, PROP_DISTANCE);
3371 RNA_def_property_float_sdna(prop, nullptr, "empty_drawsize");
3372 RNA_def_property_range(prop, 0.0001f, 1000.0f);
3373 RNA_def_property_ui_range(prop, 0.01, 100, 1, 2);
3375 prop, "Empty Display Size", "Size of display for empties in the viewport");
3376 RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, nullptr);
3377
3378 prop = RNA_def_property(srna, "empty_image_offset", PROP_FLOAT, PROP_NONE);
3379 RNA_def_property_float_sdna(prop, nullptr, "ima_ofs");
3380 RNA_def_property_ui_text(prop, "Origin Offset", "Origin offset distance");
3381 RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 0.1f, 2);
3382 RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, nullptr);
3383
3384 prop = RNA_def_property(srna, "image_user", PROP_POINTER, PROP_NONE);
3386 RNA_def_property_pointer_sdna(prop, nullptr, "iuser");
3388 prop,
3389 "Image User",
3390 "Parameters defining which layer, pass and frame of the image is displayed");
3391 RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, nullptr);
3392
3393 prop = RNA_def_property(srna, "empty_image_depth", PROP_ENUM, PROP_NONE);
3396 prop, "Empty Image Depth", "Determine which other objects will occlude the image");
3397 RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, nullptr);
3398
3399 prop = RNA_def_property(srna, "show_empty_image_perspective", PROP_BOOLEAN, PROP_NONE);
3401 prop, nullptr, "empty_image_visibility_flag", OB_EMPTY_IMAGE_HIDE_PERSPECTIVE);
3403 prop, "Display in Perspective Mode", "Display image in perspective mode");
3404 RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, nullptr);
3405
3406 prop = RNA_def_property(srna, "show_empty_image_orthographic", PROP_BOOLEAN, PROP_NONE);
3408 prop, nullptr, "empty_image_visibility_flag", OB_EMPTY_IMAGE_HIDE_ORTHOGRAPHIC);
3410 prop, "Display in Orthographic Mode", "Display image in orthographic mode");
3411 RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, nullptr);
3412
3413 prop = RNA_def_property(srna, "show_empty_image_only_axis_aligned", PROP_BOOLEAN, PROP_NONE);
3415 prop, nullptr, "empty_image_visibility_flag", OB_EMPTY_IMAGE_HIDE_NON_AXIS_ALIGNED);
3417 "Display Only Axis Aligned",
3418 "Only display the image when it is aligned with the view axis");
3419 RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, nullptr);
3420
3421 prop = RNA_def_property(srna, "use_empty_image_alpha", PROP_BOOLEAN, PROP_NONE);
3422 RNA_def_property_boolean_sdna(prop, nullptr, "empty_image_flag", OB_EMPTY_IMAGE_USE_ALPHA_BLEND);
3424 prop,
3425 "Use Alpha",
3426 "Use alpha blending instead of alpha test (can produce sorting artifacts)");
3427 RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, nullptr);
3428
3429 static const EnumPropertyItem prop_empty_image_side_items[] = {
3430 {0, "DOUBLE_SIDED", 0, "Both", ""},
3431 {OB_EMPTY_IMAGE_HIDE_BACK, "FRONT", 0, "Front", ""},
3432 {OB_EMPTY_IMAGE_HIDE_FRONT, "BACK", 0, "Back", ""},
3433 {0, nullptr, 0, nullptr, nullptr},
3434 };
3435 prop = RNA_def_property(srna, "empty_image_side", PROP_ENUM, PROP_NONE);
3436 RNA_def_property_enum_bitflag_sdna(prop, nullptr, "empty_image_visibility_flag");
3437 RNA_def_property_enum_items(prop, prop_empty_image_side_items);
3438 RNA_def_property_ui_text(prop, "Empty Image Side", "Show front/back side");
3440 RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, nullptr);
3441
3442 prop = RNA_def_property(srna, "add_rest_position_attribute", PROP_BOOLEAN, PROP_NONE);
3444 prop, nullptr, "modifier_flag", OB_MODIFIER_FLAG_ADD_REST_POSITION);
3446 "Add Rest Position",
3447 "Add a \"rest_position\" attribute that is a copy of the position "
3448 "attribute before shape keys and modifiers are evaluated");
3449 RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_internal_update_data");
3450
3451 /* render */
3452 prop = RNA_def_property(srna, "pass_index", PROP_INT, PROP_UNSIGNED);
3453 RNA_def_property_int_sdna(prop, nullptr, "index");
3455 prop, "Pass Index", "Index number for the \"Object Index\" render pass");
3456 RNA_def_property_update(prop, NC_OBJECT, "rna_Object_internal_update_draw");
3457
3458 prop = RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR);
3460 prop, "Color", "Object color and alpha, used when the Object Color mode is enabled");
3461 RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_internal_update_draw");
3462
3463 /* physics */
3464 prop = RNA_def_property(srna, "field", PROP_POINTER, PROP_NONE);
3465 RNA_def_property_pointer_sdna(prop, nullptr, "pd");
3466 RNA_def_property_struct_type(prop, "FieldSettings");
3467 RNA_def_property_pointer_funcs(prop, "rna_Object_field_get", nullptr, nullptr, nullptr);
3469 prop, "Field Settings", "Settings for using the object as a field in physics simulation");
3470
3471 prop = RNA_def_property(srna, "collision", PROP_POINTER, PROP_NONE);
3472 RNA_def_property_pointer_sdna(prop, nullptr, "pd");
3473 RNA_def_property_struct_type(prop, "CollisionSettings");
3474 RNA_def_property_pointer_funcs(prop, "rna_Object_collision_get", nullptr, nullptr, nullptr);
3476 "Collision Settings",
3477 "Settings for using the object as a collider in physics simulation");
3478
3479 prop = RNA_def_property(srna, "soft_body", PROP_POINTER, PROP_NONE);
3480 RNA_def_property_pointer_sdna(prop, nullptr, "soft");
3481 RNA_def_property_struct_type(prop, "SoftBodySettings");
3482 RNA_def_property_ui_text(prop, "Soft Body Settings", "Settings for soft body simulation");
3483
3484 prop = RNA_def_property(srna, "particle_systems", PROP_COLLECTION, PROP_NONE);
3485 RNA_def_property_collection_sdna(prop, nullptr, "particlesystem", nullptr);
3486 RNA_def_property_struct_type(prop, "ParticleSystem");
3487 RNA_def_property_ui_text(prop, "Particle Systems", "Particle systems emitted from the object");
3489
3490 prop = RNA_def_property(srna, "rigid_body", PROP_POINTER, PROP_NONE);
3491 RNA_def_property_pointer_sdna(prop, nullptr, "rigidbody_object");
3492 RNA_def_property_struct_type(prop, "RigidBodyObject");
3493 RNA_def_property_ui_text(prop, "Rigid Body Settings", "Settings for rigid body simulation");
3494
3495 prop = RNA_def_property(srna, "rigid_body_constraint", PROP_POINTER, PROP_NONE);
3496 RNA_def_property_pointer_sdna(prop, nullptr, "rigidbody_constraint");
3497 RNA_def_property_struct_type(prop, "RigidBodyConstraint");
3498 RNA_def_property_ui_text(prop, "Rigid Body Constraint", "Constraint constraining rigid bodies");
3499
3500 prop = RNA_def_property(srna, "use_simulation_cache", PROP_BOOLEAN, PROP_NONE);
3503 prop, "Use Simulation Cache", "Cache frames during simulation nodes playback");
3505 RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, nullptr);
3506
3508
3509 /* instancing */
3510 prop = RNA_def_property(srna, "instance_type", PROP_ENUM, PROP_NONE);
3511 RNA_def_property_enum_bitflag_sdna(prop, nullptr, "transflag");
3513 RNA_def_property_enum_funcs(prop, nullptr, nullptr, "rna_Object_instance_type_itemf");
3514 RNA_def_property_ui_text(prop, "Instance Type", "If not None, object instancing method to use");
3515 RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_dependency_update");
3516
3517 prop = RNA_def_property(srna, "use_instance_vertices_rotation", PROP_BOOLEAN, PROP_NONE);
3518 RNA_def_property_boolean_sdna(prop, nullptr, "transflag", OB_DUPLIROT);
3520 prop, "Orient with Normals", "Rotate instance according to vertex normal");
3521 RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, nullptr);
3522
3523 prop = RNA_def_property(srna, "use_instance_faces_scale", PROP_BOOLEAN, PROP_NONE);
3524 RNA_def_property_boolean_sdna(prop, nullptr, "transflag", OB_DUPLIFACES_SCALE);
3525 RNA_def_property_ui_text(prop, "Scale to Face Sizes", "Scale instance based on face size");
3526 RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_internal_update");
3527
3528 prop = RNA_def_property(srna, "instance_faces_scale", PROP_FLOAT, PROP_NONE);
3529 RNA_def_property_float_sdna(prop, nullptr, "instance_faces_scale");
3530 RNA_def_property_range(prop, 0.001f, 10000.0f);
3531 RNA_def_property_ui_text(prop, "Instance Faces Scale", "Scale the face instance objects");
3532 RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_internal_update");
3533
3534 prop = RNA_def_property(srna, "instance_collection", PROP_POINTER, PROP_NONE);
3535 RNA_def_property_struct_type(prop, "Collection");
3536 RNA_def_property_pointer_sdna(prop, nullptr, "instance_collection");
3538 RNA_def_property_pointer_funcs(prop, nullptr, "rna_Object_dup_collection_set", nullptr, nullptr);
3539 RNA_def_property_ui_text(prop, "Instance Collection", "Instance an existing collection");
3540 RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_dependency_update");
3541
3542 prop = RNA_def_property(srna, "is_instancer", PROP_BOOLEAN, PROP_NONE);
3543 RNA_def_property_boolean_sdna(prop, nullptr, "transflag", OB_DUPLI);
3547
3548 /* drawing */
3549 prop = RNA_def_property(srna, "display_type", PROP_ENUM, PROP_NONE);
3550 RNA_def_property_enum_sdna(prop, nullptr, "dt");
3551 RNA_def_property_enum_items(prop, drawtype_items);
3552 RNA_def_property_ui_text(prop, "Display As", "How to display object in viewport");
3553 RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_internal_update");
3554
3555 prop = RNA_def_property(srna, "show_bounds", PROP_BOOLEAN, PROP_NONE);
3556 RNA_def_property_boolean_sdna(prop, nullptr, "dtx", OB_DRAWBOUNDOX);
3557 RNA_def_property_ui_text(prop, "Display Bounds", "Display the object's bounds");
3558 RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, nullptr);
3559
3560 prop = RNA_def_property(srna, "display_bounds_type", PROP_ENUM, PROP_NONE);
3561 RNA_def_property_enum_sdna(prop, nullptr, "boundtype");
3562 RNA_def_property_enum_items(prop, boundtype_items);
3563 RNA_def_property_ui_text(prop, "Display Bounds Type", "Object boundary display type");
3564 RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, nullptr);
3565
3566 prop = RNA_def_property(srna, "show_name", PROP_BOOLEAN, PROP_NONE);
3567 RNA_def_property_boolean_sdna(prop, nullptr, "dtx", OB_DRAWNAME);
3568 RNA_def_property_ui_text(prop, "Display Name", "Display the object's name");
3569 RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, nullptr);
3570
3571 prop = RNA_def_property(srna, "show_axis", PROP_BOOLEAN, PROP_NONE);
3572 RNA_def_property_boolean_sdna(prop, nullptr, "dtx", OB_AXIS);
3573 RNA_def_property_ui_text(prop, "Display Axes", "Display the object's origin and axes");
3574 RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, nullptr);
3575
3576 prop = RNA_def_property(srna, "show_texture_space", PROP_BOOLEAN, PROP_NONE);
3577 RNA_def_property_boolean_sdna(prop, nullptr, "dtx", OB_TEXSPACE);
3578 RNA_def_property_ui_text(prop, "Display Texture Space", "Display the object's texture space");
3579 RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, nullptr);
3580
3581 prop = RNA_def_property(srna, "show_wire", PROP_BOOLEAN, PROP_NONE);
3582 RNA_def_property_boolean_sdna(prop, nullptr, "dtx", OB_DRAWWIRE);
3584 prop, "Display Wire", "Display the object's wireframe over solid shading");
3585 RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, nullptr);
3586
3587 prop = RNA_def_property(srna, "show_all_edges", PROP_BOOLEAN, PROP_NONE);
3588 RNA_def_property_boolean_sdna(prop, nullptr, "dtx", OB_DRAW_ALL_EDGES);
3589 RNA_def_property_ui_text(prop, "Display All Edges", "Display all edges for mesh objects");
3590 RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, nullptr);
3591
3592 prop = RNA_def_property(srna, "use_grease_pencil_lights", PROP_BOOLEAN, PROP_NONE);
3595 RNA_def_property_ui_text(prop, "Use Lights", "Lights affect Grease Pencil object");
3596 RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_grease_pencil_update");
3597
3598 prop = RNA_def_property(srna, "show_transparent", PROP_BOOLEAN, PROP_NONE);
3599 RNA_def_property_boolean_sdna(prop, nullptr, "dtx", OB_DRAWTRANSP);
3601 prop, "Display Transparent", "Display material transparency in the object");
3602 RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, nullptr);
3603
3604 prop = RNA_def_property(srna, "show_in_front", PROP_BOOLEAN, PROP_NONE);
3605 RNA_def_property_boolean_sdna(prop, nullptr, "dtx", OB_DRAW_IN_FRONT);
3606 RNA_def_property_ui_text(prop, "In Front", "Make the object display in front of others");
3607 RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_grease_pencil_update");
3608
3609 /* pose */
3610 prop = RNA_def_property(srna, "pose", PROP_POINTER, PROP_NONE);
3611 RNA_def_property_pointer_sdna(prop, nullptr, "pose");
3612 RNA_def_property_struct_type(prop, "Pose");
3613 RNA_def_property_ui_text(prop, "Pose", "Current pose for armatures");
3614
3615 /* shape keys */
3616 prop = RNA_def_property(srna, "show_only_shape_key", PROP_BOOLEAN, PROP_NONE);
3617 RNA_def_property_boolean_sdna(prop, nullptr, "shapeflag", OB_SHAPE_LOCK);
3619 prop, "Solo Active Shape Key", "Only show the active shape key at full value");
3620 RNA_def_property_ui_icon(prop, ICON_SOLO_OFF, 1);
3621 RNA_def_property_update(prop, 0, "rna_Object_internal_update_data");
3622
3623 prop = RNA_def_property(srna, "use_shape_key_edit_mode", PROP_BOOLEAN, PROP_NONE);
3624 RNA_def_property_boolean_sdna(prop, nullptr, "shapeflag", OB_SHAPE_EDIT_MODE);
3626 prop, "Shape Key Edit Mode", "Display shape keys in edit mode (for meshes only)");
3627 RNA_def_property_ui_icon(prop, ICON_EDITMODE_HLT, 0);
3628 RNA_def_property_update(prop, 0, "rna_Object_internal_update_data");
3629
3630 prop = RNA_def_property(srna, "active_shape_key", PROP_POINTER, PROP_NONE);
3631 RNA_def_property_struct_type(prop, "ShapeKey");
3635 prop, "rna_Object_active_shape_key_get", nullptr, nullptr, nullptr);
3636 RNA_def_property_ui_text(prop, "Active Shape Key", "Current shape key");
3637
3638 prop = RNA_def_property(srna, "active_shape_key_index", PROP_INT, PROP_NONE);
3639 RNA_def_property_int_sdna(prop, nullptr, "shapenr");
3640 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); /* XXX this is really unpredictable... */
3642 "rna_Object_active_shape_key_index_get",
3643 "rna_Object_active_shape_key_index_set",
3644 "rna_Object_active_shape_key_index_range");
3645 RNA_def_property_ui_text(prop, "Active Shape Key Index", "Current shape key index");
3646 RNA_def_property_update(prop, 0, "rna_Object_active_shape_update");
3647
3648 /* sculpt */
3649 prop = RNA_def_property(srna, "use_dynamic_topology_sculpting", PROP_BOOLEAN, PROP_NONE);
3650 RNA_def_property_boolean_funcs(prop, "rna_Object_use_dynamic_topology_sculpting_get", nullptr);
3652 RNA_def_property_ui_text(prop, "Dynamic Topology Sculpting", nullptr);
3653
3654 /* Base Settings */
3655 prop = RNA_def_property(srna, "is_from_instancer", PROP_BOOLEAN, PROP_NONE);
3656 RNA_def_property_boolean_sdna(prop, nullptr, "base_flag", BASE_FROM_DUPLI);
3657 RNA_def_property_ui_text(prop, "Base from Instancer", "Object comes from a instancer");
3661
3662 prop = RNA_def_property(srna, "is_from_set", PROP_BOOLEAN, PROP_NONE);
3663 RNA_def_property_boolean_sdna(prop, nullptr, "base_flag", BASE_FROM_SET);
3664 RNA_def_property_ui_text(prop, "Base from Set", "Object comes from a background set");
3668
3669 /* Object Display */
3670 prop = RNA_def_property(srna, "display", PROP_POINTER, PROP_NONE);
3672 RNA_def_property_struct_type(prop, "ObjectDisplay");
3673 RNA_def_property_pointer_funcs(prop, "rna_Object_display_get", nullptr, nullptr, nullptr);
3674 RNA_def_property_ui_text(prop, "Object Display", "Object display settings for 3D viewport");
3675
3676 /* Line Art */
3677 prop = RNA_def_property(srna, "lineart", PROP_POINTER, PROP_NONE);
3678 RNA_def_property_struct_type(prop, "ObjectLineArt");
3679 RNA_def_property_ui_text(prop, "Line Art", "Line Art settings for the object");
3680
3681 /* Mesh Symmetry Settings */
3682
3683 prop = RNA_def_property(srna, "use_mesh_mirror_x", PROP_BOOLEAN, PROP_NONE);
3685 prop, "rna_Object_mesh_symmetry_x_get", "rna_Object_mesh_symmetry_x_set");
3687 RNA_def_property_ui_text(prop, "X", "Enable mesh symmetry in the X axis");
3688 RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, nullptr);
3689
3690 prop = RNA_def_property(srna, "use_mesh_mirror_y", PROP_BOOLEAN, PROP_NONE);
3692 prop, "rna_Object_mesh_symmetry_y_get", "rna_Object_mesh_symmetry_y_set");
3694 RNA_def_property_editable_func(prop, "rna_Object_mesh_symmetry_yz_editable");
3695 RNA_def_property_ui_text(prop, "Y", "Enable mesh symmetry in the Y axis");
3696 RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, nullptr);
3697
3698 prop = RNA_def_property(srna, "use_mesh_mirror_z", PROP_BOOLEAN, PROP_NONE);
3700 prop, "rna_Object_mesh_symmetry_z_get", "rna_Object_mesh_symmetry_z_set");
3702 RNA_def_property_editable_func(prop, "rna_Object_mesh_symmetry_yz_editable");
3703 RNA_def_property_ui_text(prop, "Z", "Enable mesh symmetry in the Z axis");
3704 RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, nullptr);
3705
3706 /* Lightgroup Membership */
3707 prop = RNA_def_property(srna, "lightgroup", PROP_STRING, PROP_NONE);
3709 "rna_Object_lightgroup_get",
3710 "rna_Object_lightgroup_length",
3711 "rna_Object_lightgroup_set");
3713 RNA_def_property_ui_text(prop, "Lightgroup", "Lightgroup that the object belongs to");
3714
3715 /* Light Linking. */
3716 prop = RNA_def_property(srna, "light_linking", PROP_POINTER, PROP_NONE);
3718 RNA_def_property_struct_type(prop, "ObjectLightLinking");
3719 RNA_def_property_pointer_funcs(prop, "rna_Object_light_linking_get", nullptr, nullptr, nullptr);
3722 prop, nullptr, nullptr, "rna_Object_light_linking_override_apply");
3723 RNA_def_property_ui_text(prop, "Light Linking", "Light linking settings");
3724
3725 /* Shadow terminator. */
3726 prop = RNA_def_property(srna, "shadow_terminator_normal_offset", PROP_FLOAT, PROP_DISTANCE);
3727 RNA_def_property_range(prop, 0.0f, FLT_MAX);
3728 RNA_def_property_ui_range(prop, 0.0, 10, 0.01f, 4);
3730 prop,
3731 "Shadow Terminator Normal Offset",
3732 "Offset rays from the surface to reduce shadow terminator artifact on low poly geometry. "
3733 "Only affect triangles that are affected by the geometry offset");
3734
3735 RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, nullptr);
3736
3737 prop = RNA_def_property(srna, "shadow_terminator_geometry_offset", PROP_FLOAT, PROP_FACTOR);
3738 RNA_def_property_range(prop, 0.0f, FLT_MAX);
3739 RNA_def_property_ui_range(prop, 0.0, 1.0, 1, 2);
3741 "Shadow Terminator Geometry Offset",
3742 "Offset rays from the surface to reduce shadow terminator artifact on "
3743 "low poly geometry. Only affects triangles at grazing angles to light");
3744 RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, nullptr);
3745
3746 prop = RNA_def_property(srna, "shadow_terminator_shading_offset", PROP_FLOAT, PROP_FACTOR);
3747 RNA_def_property_range(prop, 0.0f, FLT_MAX);
3748 RNA_def_property_ui_range(prop, 0.0, 1.0, 1, 2);
3750 prop,
3751 "Shadow Terminator Shading Offset",
3752 "Push the shadow terminator towards the light to hide artifacts on low poly geometry");
3753 RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, nullptr);
3754
3756
3757 /* anim */
3759
3762
3763 RNA_api_object(srna);
3764}
3765
3767{
3768 StructRNA *srna;
3769 PropertyRNA *prop;
3770
3771 srna = RNA_def_struct(brna, "ObjectLightLinking", nullptr);
3772 RNA_def_struct_ui_text(srna, "Object Light Linking", "");
3773 RNA_def_struct_sdna(srna, "Object");
3774 RNA_def_struct_nested(brna, srna, "Object");
3775 RNA_def_struct_path_func(srna, "rna_ObjectLightLinking_path");
3776
3778
3779 prop = RNA_def_property(srna, "receiver_collection", PROP_POINTER, PROP_NONE);
3780 RNA_def_property_struct_type(prop, "Collection");
3783 "rna_LightLinking_receiver_collection_get",
3784 "rna_LightLinking_receiver_collection_set",
3785 nullptr,
3786 nullptr);
3788 "Receiver Collection",
3789 "Collection which defines light linking relation of this emitter");
3790 RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_LightLinking_collection_update");
3791
3792 prop = RNA_def_property(srna, "blocker_collection", PROP_POINTER, PROP_NONE);
3793 RNA_def_property_struct_type(prop, "Collection");
3796 "rna_LightLinking_blocker_collection_get",
3797 "rna_LightLinking_blocker_collection_set",
3798 nullptr,
3799 nullptr);
3801 "Blocker Collection",
3802 "Collection which defines objects which block light from this emitter");
3803 RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_LightLinking_collection_update");
3804
3806}
3807
3809{
3810 rna_def_object(brna);
3811
3819}
3820
3821#endif
void BKE_pose_rebuild(Main *bmain, Object *ob, bArmature *arm, bool do_id_user)
void BKE_rotMode_change_values(float quat[4], float eul[3], float axis[3], float *angle, short oldMode, short newMode)
Camera data-block and utility functions.
bool BKE_collection_has_object_recursive(Collection *collection, Object *ob)
void BKE_constraints_free(struct ListBase *list)
bool BKE_constraint_remove_ex(ListBase *list, struct Object *ob, struct bConstraint *con)
struct bConstraint * BKE_constraint_add_for_object(struct Object *ob, const char *name, short type)
struct bConstraint * BKE_constraint_copy_for_object(struct Object *ob, struct bConstraint *src)
struct bConstraint * BKE_constraint_duplicate_ex(struct bConstraint *src, int flag, bool do_extern)
struct bConstraint * BKE_constraints_active_get(struct ListBase *list)
void BKE_constraints_active_set(ListBase *list, struct bConstraint *con)
void BKE_constraint_unique_name(struct bConstraint *con, struct ListBase *list)
Scene * CTX_data_scene(const bContext *C)
Main * CTX_data_main(const bContext *C)
void BKE_curve_type_test(Object *ob, bool dimension_update)
Definition curve.cc:454
support for deformation groups and hooks.
void BKE_object_defgroup_active_index_set(Object *ob, int new_index)
Definition deform.cc:612
int BKE_object_defgroup_active_index_get(const Object *ob)
Definition deform.cc:607
bool BKE_object_supports_vertex_groups(const Object *ob)
Definition deform.cc:463
const ListBase * BKE_object_defgroup_list(const Object *ob)
Definition deform.cc:585
ListBase * BKE_object_defgroup_list_mutable(Object *ob)
Definition deform.cc:596
bDeformGroup * BKE_object_defgroup_find_name(const Object *ob, blender::StringRef name)
Definition deform.cc:526
int BKE_object_defgroup_name_index(const Object *ob, blender::StringRef name)
Definition deform.cc:591
void BKE_object_defgroup_set_name(bDeformGroup *dg, Object *ob, const char *new_name)
Definition deform.cc:762
void BKE_editlattice_load(struct Object *obedit)
void BKE_editlattice_make(struct Object *obedit)
void BKE_editmesh_looptris_and_normals_calc(BMEditMesh *em)
Definition editmesh.cc:95
#define G_MAIN
Key * BKE_key_from_object(Object *ob)
Definition key.cc:1791
void BKE_main_collection_sync_remap(const Main *bmain)
int BKE_lightgroup_membership_length(const LightgroupMembership *lgm)
void BKE_lightgroup_membership_set(LightgroupMembership **lgm, const char *name)
int BKE_lightgroup_membership_get(const LightgroupMembership *lgm, char *name)
void id_us_plus(ID *id)
Definition lib_id.cc:358
void id_us_min(ID *id)
Definition lib_id.cc:366
bool BKE_id_is_in_global_main(ID *id)
Definition lib_id.cc:2500
void BKE_light_linking_copy(struct Object *object_dst, const struct Object *object_src, const int copy_flags)
void BKE_light_linking_delete(struct Object *object, const int delete_flags)
@ LIGHT_LINKING_BLOCKER
@ LIGHT_LINKING_RECEIVER
void BKE_light_linking_collection_assign_only(struct Object *object, struct Collection *new_collection, LightLinkingType link_type)
struct Collection * BKE_light_linking_collection_get(const struct Object *object, LightLinkingType link_type)
General operations, lookup, etc. for materials.
int BKE_object_material_count_eval(const Object *ob)
@ BKE_MAT_ASSIGN_EXISTING
void BKE_object_materials_sync_length(Main *bmain, Object *ob, ID *id)
Material * BKE_object_material_get(Object *ob, short act)
Material * BKE_object_material_get_eval(Object *ob, short act)
void BKE_object_material_assign(Main *bmain, Object *ob, Material *ma, short act, int assign_type)
void BKE_mesh_assign_object(Main *bmain, Object *ob, Mesh *mesh)
Mesh * BKE_mesh_wrapper_ensure_subdivision(Mesh *mesh)
ModifierData * BKE_modifiers_findby_type(const Object *ob, ModifierType type)
const ModifierTypeInfo * BKE_modifier_get_info(ModifierType type)
@ eModifierTypeFlag_Single
void BKE_modifier_copydata(const ModifierData *md, ModifierData *target)
General operations, lookup, etc. for blender objects.
void BKE_object_matrix_local_get(Object *ob, float r_mat[4][4])
void BKE_object_empty_draw_type_set(Object *ob, int value)
void BKE_object_modifier_set_active(Object *ob, ModifierData *md)
bool BKE_object_is_in_editmode(const Object *ob)
void BKE_object_dimensions_set(Object *ob, const float value[3], int axis_mask)
void BKE_object_apply_mat4(Object *ob, const float mat[4][4], bool use_compat, bool use_parent)
void BKE_object_dimensions_eval_cached_get(const Object *ob, float r_vec[3])
std::optional< blender::Bounds< blender::float3 > > BKE_object_boundbox_eval_cached_get(const Object *ob)
ModifierData * BKE_object_active_modifier(const Object *ob)
void BKE_object_to_mat4(const Object *ob, float r_mat[4][4])
bool BKE_object_is_in_editmode_vgroup(const 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)
bool BKE_object_sculpt_use_dyntopo(const Object *object)
Definition paint.cc:3063
void psys_set_current_num(struct Object *ob, int index)
Definition particle.cc:571
short psys_get_current_num(struct Object *ob)
Definition particle.cc:552
struct ParticleSystem * psys_get_current(struct Object *ob)
Definition particle.cc:538
void BKE_reportf(ReportList *reports, eReportType type, const char *format,...) ATTR_PRINTF_FORMAT(3
@ RPT_ERROR
Definition BKE_report.hh:39
void BKE_report(ReportList *reports, eReportType type, const char *message)
Definition report.cc:153
#define BLI_assert(a)
Definition BLI_assert.h:46
#define BLI_assert_msg(a, msg)
Definition BLI_assert.h:53
int BLI_findindex(const ListBase *listbase, const void *vlink) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
Definition listbase.cc:586
void * BLI_findlink(const ListBase *listbase, int number) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
Definition listbase.cc:534
bool BLI_listbase_move_index(ListBase *listbase, int from, int to) ATTR_NONNULL()
Definition listbase.cc:467
void void * BLI_listbase_string_or_index_find(const ListBase *listbase, const char *string, size_t string_offset, int index) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
Definition listbase.cc:754
void BLI_insertlinkafter(ListBase *listbase, void *vprevlink, void *vnewlink) ATTR_NONNULL(1)
Definition listbase.cc:332
void BLI_remlink(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
Definition listbase.cc:131
int BLI_listbase_count(const ListBase *listbase) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
Definition listbase.cc:524
MINLINE int max_ii(int a, int b)
#define DEG2RAD(_deg)
void mul_m4_m4m4(float R[4][4], const float A[4][4], const float B[4][4])
void copy_m4_m4(float m1[4][4], const float m2[4][4])
bool invert_m4_m4(float inverse[4][4], const float mat[4][4])
MINLINE void copy_v3_v3(float r[3], const float a[3])
void copy_vn_fl(float *array_tar, int size, float val)
char * STRNCPY(char(&dst)[N], const char *src)
Definition BLI_string.h:693
char * BLI_strncpy(char *__restrict dst, const char *__restrict src, size_t dst_maxncpy) ATTR_NONNULL(1
#define UNUSED_VARS_NDEBUG(...)
#define ELEM(...)
#define STREQ(a, b)
#define BLT_I18NCONTEXT_ID_IMAGE
#define BLT_I18NCONTEXT_ID_ID
void DEG_id_tag_update(ID *id, unsigned int flags)
void DEG_relations_tag_update(Main *bmain)
bool DEG_is_evaluated(const T *id)
ID and Library types, which are fundamental for SDNA.
@ ID_TAG_NO_MAIN
Definition DNA_ID.h:978
@ ID_RECALC_TRANSFORM
Definition DNA_ID.h:1054
@ ID_RECALC_SHADING
Definition DNA_ID.h:1094
@ ID_RECALC_SYNC_TO_EVAL
Definition DNA_ID.h:1118
@ ID_RECALC_GEOMETRY
Definition DNA_ID.h:1074
#define MAX_ID_NAME
Definition DNA_ID.h:373
#define ID_IS_EDITABLE(_id)
Definition DNA_ID.h:705
@ LIBOVERRIDE_OP_REPLACE
Definition DNA_ID.h:230
@ LIBOVERRIDE_OP_INSERT_AFTER
Definition DNA_ID.h:240
@ ID_IM
@ ID_CU_LEGACY
@ ROT_MODE_XZY
@ ROT_MODE_QUAT
@ ROT_MODE_ZXY
@ ROT_MODE_AXISANGLE
@ ROT_MODE_ZYX
@ ROT_MODE_XYZ
@ ROT_MODE_YXZ
@ ROT_MODE_YZX
@ CONSTRAINT_OVERRIDE_LIBRARY_LOCAL
@ CD_PROP_FLOAT2
@ BASE_FROM_DUPLI
@ BASE_FROM_SET
@ LIGHTPROBE_TYPE_PLANE
@ LIGHTPROBE_TYPE_VOLUME
@ LIGHTPROBE_TYPE_SPHERE
@ ME_EDIT_MIRROR_VERTEX_GROUPS
eMeshSymmetryType
@ ME_SYMMETRY_X
@ ME_SYMMETRY_Y
@ ME_SYMMETRY_Z
@ MB_PLANE
@ MB_ELIPSOID
@ MB_TUBE
@ MB_CUBE
@ MB_BALL
@ eModifierType_ParticleSystem
@ OB_WIRE
@ OB_TEXTURE
@ OB_BOUNDBOX
@ OB_SOLID
@ OB_MODE_VERTEX_GREASE_PENCIL
@ OB_MODE_PARTICLE_EDIT
@ OB_MODE_EDIT_GPENCIL_LEGACY
@ OB_MODE_EDIT
@ OB_MODE_WEIGHT_PAINT
@ OB_MODE_SCULPT
@ OB_MODE_SCULPT_CURVES
@ OB_MODE_PAINT_GREASE_PENCIL
@ OB_MODE_SCULPT_GREASE_PENCIL
@ OB_MODE_POSE
@ OB_MODE_TEXTURE_PAINT
@ OB_MODE_OBJECT
@ OB_MODE_WEIGHT_GREASE_PENCIL
@ OB_MODE_VERTEX_PAINT
Object is a sort of wrapper for general info.
@ OB_EMPTY_IMAGE_USE_ALPHA_BLEND
@ 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
@ PARVERT1
@ PARSKEL
@ PAROBJECT
@ PARVERT3
@ PARBONE
@ GREASE_PENCIL_LINEART_SCENE
@ GP_STROKE
@ GREASE_PENCIL_LINEART_COLLECTION
@ GREASE_PENCIL_LINEART_OBJECT
@ GP_MONKEY
@ GP_EMPTY
@ OB_HIDE_TRANSMISSION
@ OB_HIDE_SURFACE_PICK
@ OB_HOLDOUT
@ OB_HIDE_PROBE_VOLUME
@ OB_HIDE_RENDER
@ OB_HIDE_CAMERA
@ OB_HIDE_PROBE_PLANAR
@ OB_HIDE_PROBE_CUBEMAP
@ OB_HIDE_SELECT
@ OB_HIDE_GLOSSY
@ OB_HIDE_SHADOW
@ OB_SHADOW_CATCHER
@ OB_HIDE_VIEWPORT
@ OB_HIDE_DIFFUSE
@ OB_HIDE_VOLUME_SCATTER
#define OB_DATA_SUPPORT_ID(_id_type)
@ OB_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
@ OB_SHAPE_EDIT_MODE
@ OB_SHAPE_LOCK
@ OB_MODIFIER_FLAG_ADD_REST_POSITION
#define OB_TYPE_SUPPORT_PARVERT(_type)
@ OB_EMPTY_CONE
@ OB_SINGLE_ARROW
@ OB_PLAINAXES
@ OB_ARROWS
@ OB_CIRCLE
@ OB_CUBE
@ OB_EMPTY_IMAGE
@ OB_EMPTY_SPHERE
@ OBJECT_LRT_OWN_INTERSECTION_PRIORITY
@ OBJECT_LRT_OWN_CREASE
@ OB_SPEAKER
@ OB_LATTICE
@ OB_MBALL
@ OB_EMPTY
@ OB_SURF
@ OB_CAMERA
@ OB_FONT
@ OB_GREASE_PENCIL
@ OB_ARMATURE
@ OB_LAMP
@ OB_MESH
@ OB_POINTCLOUD
@ OB_VOLUME
@ OB_CURVES_LEGACY
@ OB_GPENCIL_LEGACY
@ OB_CURVES
@ OB_LIGHTPROBE
@ OB_FLAG_USE_SIMULATION_CACHE
@ OB_TRANSFORM_ADJUST_ROOT_PARENT_FOR_VIEW_LOCK
@ OB_DUPLI
@ OB_PARENT_USE_FINAL_INDICES
@ OB_DUPLIVERTS
@ OB_DUPLIROT
@ OB_DUPLIFACES_SCALE
@ OB_EMPTY_IMAGE_DEPTH_DEFAULT
@ OB_EMPTY_IMAGE_DEPTH_FRONT
@ OB_EMPTY_IMAGE_DEPTH_BACK
@ OB_BOUND_CAPSULE
@ OB_BOUND_SPHERE
@ OB_BOUND_CONE
@ OB_BOUND_BOX
@ OB_BOUND_CYLINDER
@ OBJECT_LRT_INCLUDE
@ OBJECT_LRT_NO_INTERSECTION
@ OBJECT_LRT_EXCLUDE
@ OBJECT_LRT_INHERIT
@ OBJECT_LRT_OCCLUSION_ONLY
@ OBJECT_LRT_INTERSECTION_ONLY
@ OBJECT_LRT_FORCE_INTERSECTION
@ OB_DUPLI_FLAG_VIEWPORT
@ OB_DUPLI_FLAG_RENDER
@ OB_LOCK_ROTZ
@ OB_LOCK_ROT4D
@ OB_LOCK_SCALEZ
@ OB_LOCK_ROTX
@ OB_LOCK_SCALEX
@ OB_LOCK_ROTW
@ OB_LOCK_LOCY
@ OB_LOCK_LOCZ
@ OB_LOCK_ROTY
@ OB_LOCK_SCALEY
@ OB_LOCK_LOCX
@ OB_POSX
@ OB_NEGZ
@ OB_POSY
@ OB_NEGX
@ OB_POSZ
@ OB_NEGY
@ PSYS_DELETE
void EDBM_mesh_make(Object *ob, int select_mode, bool add_key_index)
void EDBM_mesh_load(Main *bmain, Object *ob)
#define WEIGHT_REPLACE
#define WEIGHT_ADD
#define WEIGHT_SUBTRACT
void PE_current_changed(Depsgraph *depsgraph, Scene *scene, Object *ob)
ParameterFlag
Definition RNA_types.hh:544
@ PARM_RNAPTR
Definition RNA_types.hh:547
@ PARM_REQUIRED
Definition RNA_types.hh:545
@ FUNC_USE_REPORTS
Definition RNA_types.hh:914
@ FUNC_USE_MAIN
Definition RNA_types.hh:912
@ FUNC_USE_CONTEXT
Definition RNA_types.hh:913
@ FUNC_USE_SELF_ID
Definition RNA_types.hh:889
@ STRUCT_ID_REFCOUNT
Definition RNA_types.hh:959
@ PROP_FLOAT
Definition RNA_types.hh:164
@ PROP_BOOLEAN
Definition RNA_types.hh:162
@ PROP_ENUM
Definition RNA_types.hh:166
@ PROP_INT
Definition RNA_types.hh:163
@ PROP_STRING
Definition RNA_types.hh:165
@ PROP_POINTER
Definition RNA_types.hh:167
@ PROP_COLLECTION
Definition RNA_types.hh:168
#define RNA_ENUM_ITEM_SEPR
Definition RNA_types.hh:676
#define RNA_TRANSLATION_PREC_DEFAULT
Definition RNA_types.hh:224
@ PROPOVERRIDE_OVERRIDABLE_LIBRARY
Definition RNA_types.hh:503
@ PROPOVERRIDE_NO_COMPARISON
Definition RNA_types.hh:511
@ PROPOVERRIDE_IGNORE
Definition RNA_types.hh:523
@ PROPOVERRIDE_LIBRARY_INSERTION
Definition RNA_types.hh:528
@ PROPOVERRIDE_NO_PROP_NAME
Definition RNA_types.hh:536
PropertyFlag
Definition RNA_types.hh:300
@ PROP_THICK_WRAP
Definition RNA_types.hh:423
@ PROP_DYNAMIC
Definition RNA_types.hh:428
@ PROP_ANIMATABLE
Definition RNA_types.hh:319
@ PROP_PROPORTIONAL
Definition RNA_types.hh:349
@ PROP_NEVER_UNLINK
Definition RNA_types.hh:384
@ PROP_EDITABLE
Definition RNA_types.hh:306
@ PROP_NEVER_NULL
Definition RNA_types.hh:377
@ PROP_NO_DEG_UPDATE
Definition RNA_types.hh:439
@ PROP_ID_SELF_CHECK
Definition RNA_types.hh:370
@ PROP_ID_REFCOUNT
Definition RNA_types.hh:364
@ PROP_MATRIX
Definition RNA_types.hh:265
@ PROP_XYZ
Definition RNA_types.hh:269
@ PROP_DISTANCE
Definition RNA_types.hh:256
@ PROP_COLOR
Definition RNA_types.hh:260
@ PROP_ANGLE
Definition RNA_types.hh:252
@ PROP_AXISANGLE
Definition RNA_types.hh:268
@ PROP_EULER
Definition RNA_types.hh:266
@ PROP_NONE
Definition RNA_types.hh:233
@ PROP_FACTOR
Definition RNA_types.hh:251
@ PROP_TRANSLATION
Definition RNA_types.hh:261
@ PROP_XYZ_LENGTH
Definition RNA_types.hh:270
@ PROP_UNSIGNED
Definition RNA_types.hh:249
@ PROP_QUATERNION
Definition RNA_types.hh:267
#define C
Definition RandGen.cpp:29
#define ND_SHADING
Definition WM_types.hh:477
#define NC_GEOM
Definition WM_types.hh:393
#define ND_DRAW
Definition WM_types.hh:461
#define ND_DATA
Definition WM_types.hh:509
#define ND_VERTEX_GROUP
Definition WM_types.hh:510
#define NA_ADDED
Definition WM_types.hh:586
#define ND_MODIFIER
Definition WM_types.hh:462
#define NA_EDITED
Definition WM_types.hh:584
#define ND_PARENT
Definition WM_types.hh:467
#define NC_MATERIAL
Definition WM_types.hh:380
#define ND_CONSTRAINT
Definition WM_types.hh:464
#define NA_REMOVED
Definition WM_types.hh:587
#define NC_GPENCIL
Definition WM_types.hh:399
#define ND_TRANSFORM
Definition WM_types.hh:456
#define NA_RENAME
Definition WM_types.hh:588
#define ND_OB_SHADING
Definition WM_types.hh:457
#define NC_OBJECT
Definition WM_types.hh:379
#define ND_SHADING_LINKS
Definition WM_types.hh:479
static btDbvtVolume bounds(btDbvtNode **leaves, int count)
Definition btDbvt.cpp:299
#define offsetof(t, d)
void ED_curve_editnurb_make(Object *obedit)
void ED_curve_editnurb_load(Main *bmain, Object *obedit)
#define GS(x)
float length(VecOp< float, D >) RET
std::array< VecBase< T, 3 >, 8 > corners(const Bounds< VecBase< T, 3 > > &bounds)
ModifierData * modifier_add(ReportList *reports, Main *bmain, Scene *scene, Object *ob, const char *name, int type)
void constraint_active_set(Object *ob, bConstraint *con)
void shaderfx_clear(Main *bmain, Object *ob)
void constraint_update(Main *bmain, Object *ob)
ShaderFxData * shaderfx_add(ReportList *reports, Main *bmain, Scene *scene, Object *ob, const char *name, int type)
float vgroup_vert_weight(Object *ob, bDeformGroup *dg, int vertnum)
void constraint_tag_update(Main *bmain, Object *ob, bConstraint *con)
bool parent_set(ReportList *reports, const bContext *C, Scene *scene, Object *const ob, Object *const par, int partype, bool xmirror, bool keep_transform, const int vert_par[3])
bool modifier_move_to_index(ReportList *reports, eReportType error_type, Object *ob, ModifierData *md, int index, bool allow_partial)
bool shaderfx_remove(ReportList *reports, Main *bmain, Object *ob, ShaderFxData *fx)
void vgroup_vert_add(Object *ob, bDeformGroup *dg, int vertnum, float weight, int assignmode)
void vgroup_vert_remove(Object *ob, bDeformGroup *dg, int vertnum)
void modifiers_clear(Main *bmain, Scene *scene, Object *ob)
bool modifier_remove(ReportList *reports, Main *bmain, Scene *scene, Object *ob, ModifierData *md)
SymEdge< T > * sym(const SymEdge< T > *se)
MatBase< float, 4, 4 > float4x4
const char * name
const PointerRNA PointerRNA_NULL
PointerRNA RNA_property_pointer_get(PointerRNA *ptr, PropertyRNA *prop)
void rna_iterator_listbase_begin(CollectionPropertyIterator *iter, PointerRNA *ptr, ListBase *lb, IteratorSkipFunc skip)
bool RNA_enum_name_from_value(const EnumPropertyItem *item, int value, const char **r_name)
void RNA_property_update_main(Main *bmain, Scene *scene, PointerRNA *ptr, PropertyRNA *prop)
bool RNA_pointer_is_null(const PointerRNA *ptr)
int RNA_property_enum_get(PointerRNA *ptr, PropertyRNA *prop)
std::string RNA_property_string_get(PointerRNA *ptr, PropertyRNA *prop)
PointerRNA RNA_pointer_create_discrete(ID *id, StructRNA *type, void *data)
PointerRNA RNA_pointer_create_with_parent(const PointerRNA &parent, StructRNA *type, void *data)
PointerRNA RNA_id_pointer_create(ID *id)
void rna_def_animdata_common(StructRNA *srna)
void rna_def_animviz_common(StructRNA *srna)
void rna_def_motionpath_common(StructRNA *srna)
const EnumPropertyItem rna_enum_constraint_type_items[]
void RNA_def_property_boolean_sdna(PropertyRNA *prop, const char *structname, const char *propname, int64_t booleanbit)
void RNA_def_struct_name_property(StructRNA *srna, PropertyRNA *prop)
PropertyRNA * RNA_def_string(StructOrFunctionRNA *cont_, const char *identifier, const char *default_value, const int maxlen, const char *ui_name, const char *ui_description)
PropertyRNA * RNA_def_int_array(StructOrFunctionRNA *cont_, const char *identifier, const int len, const int *default_value, const int hardmin, const int hardmax, const char *ui_name, const char *ui_description, const int softmin, const int softmax)
void RNA_def_property_pointer_sdna(PropertyRNA *prop, const char *structname, const char *propname)
void RNA_define_lib_overridable(const bool make_overridable)
void RNA_def_struct_path_func(StructRNA *srna, const char *path)
void RNA_define_animate_sdna(bool animate)
void RNA_def_parameter_clear_flags(PropertyRNA *prop, PropertyFlag flag_property, ParameterFlag flag_parameter)
void RNA_def_property_string_funcs(PropertyRNA *prop, const char *get, const char *length, const char *set)
void RNA_def_function_return(FunctionRNA *func, PropertyRNA *ret)
void RNA_def_property_float_funcs(PropertyRNA *prop, const char *get, const char *set, const char *range)
void RNA_def_property_ui_text(PropertyRNA *prop, const char *name, const char *description)
void RNA_def_property_string_sdna(PropertyRNA *prop, const char *structname, const char *propname)
void RNA_def_property_ui_icon(PropertyRNA *prop, int icon, int consecutive)
void RNA_def_property_srna(PropertyRNA *prop, const char *type)
PropertyRNA * RNA_def_float(StructOrFunctionRNA *cont_, const char *identifier, const float default_value, const float hardmin, const float hardmax, const char *ui_name, const char *ui_description, const float softmin, const float softmax)
void RNA_def_property_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)
void RNA_def_struct_ui_text(StructRNA *srna, const char *name, const char *description)
void RNA_def_property_boolean_bitset_array_sdna(PropertyRNA *prop, const char *structname, const char *propname, const int64_t booleanbit, const int length)
void RNA_def_property_boolean_default(PropertyRNA *prop, bool value)
void RNA_def_property_boolean_funcs(PropertyRNA *prop, const char *get, const char *set)
void RNA_def_property_multi_array(PropertyRNA *prop, int dimension, const int length[])
PropertyRNA * RNA_def_enum(StructOrFunctionRNA *cont_, const char *identifier, const EnumPropertyItem *items, const int default_value, const char *ui_name, const char *ui_description)
const float rna_default_axis_angle[4]
void RNA_def_property_editable_array_func(PropertyRNA *prop, const char *editable)
void RNA_def_property_enum_items(PropertyRNA *prop, const EnumPropertyItem *item)
void RNA_def_struct_sdna(StructRNA *srna, const char *structname)
FunctionRNA * RNA_def_function(StructRNA *srna, const char *identifier, const char *call)
void RNA_def_struct_clear_flag(StructRNA *srna, int flag)
void RNA_def_property_array(PropertyRNA *prop, int length)
void RNA_def_property_range(PropertyRNA *prop, double min, double max)
PropertyRNA * RNA_def_pointer(StructOrFunctionRNA *cont_, const char *identifier, const char *type, const char *ui_name, const char *ui_description)
void RNA_def_property_struct_type(PropertyRNA *prop, const char *type)
void RNA_def_property_collection_sdna(PropertyRNA *prop, const char *structname, const char *propname, const char *lengthpropname)
void RNA_def_function_ui_description(FunctionRNA *func, const char *description)
void RNA_def_property_update(PropertyRNA *prop, int noteflag, const char *func)
const int rna_matrix_dimsize_4x4[]
PropertyRNA * RNA_def_property(StructOrFunctionRNA *cont_, const char *identifier, int type, int subtype)
void RNA_def_property_enum_funcs(PropertyRNA *prop, const char *get, const char *set, const char *item)
void RNA_def_property_editable_func(PropertyRNA *prop, const char *editable)
void RNA_def_property_enum_bitflag_sdna(PropertyRNA *prop, const char *structname, const char *propname)
StructRNA * RNA_def_struct(BlenderRNA *brna, const char *identifier, const char *from)
void RNA_enum_item_end(EnumPropertyItem **items, int *totitem)
void RNA_def_function_flag(FunctionRNA *func, int flag)
void RNA_def_property_clear_flag(PropertyRNA *prop, PropertyFlag flag)
void RNA_def_property_pointer_funcs(PropertyRNA *prop, const char *get, const char *set, const char *type_fn, const char *poll)
void RNA_def_property_enum_sdna(PropertyRNA *prop, const char *structname, const char *propname)
void RNA_def_property_int_funcs(PropertyRNA *prop, const char *get, const char *set, const char *range)
void RNA_def_struct_ui_icon(StructRNA *srna, int icon)
void RNA_def_property_override_funcs(PropertyRNA *prop, const char *diff, const char *store, const char *apply)
void RNA_def_property_translation_context(PropertyRNA *prop, const char *context)
void RNA_def_property_flag(PropertyRNA *prop, PropertyFlag flag)
void RNA_def_property_override_clear_flag(PropertyRNA *prop, PropertyOverrideFlag flag)
void RNA_def_property_float_sdna(PropertyRNA *prop, const char *structname, const char *propname)
void RNA_enum_items_add_value(EnumPropertyItem **items, int *totitem, const EnumPropertyItem *item, int value)
void RNA_def_property_ui_range(PropertyRNA *prop, double min, double max, double step, int precision)
void RNA_def_property_int_sdna(PropertyRNA *prop, const char *structname, const char *propname)
void RNA_def_property_float_array_default(PropertyRNA *prop, const float *array)
PropertyRNA * RNA_def_int(StructOrFunctionRNA *cont_, const char *identifier, const int default_value, const int hardmin, const int hardmax, const char *ui_name, const char *ui_description, const int softmin, const int softmax)
void RNA_def_property_boolean_negative_sdna(PropertyRNA *prop, const char *structname, const char *propname, int64_t booleanbit)
void RNA_def_struct_nested(BlenderRNA *brna, StructRNA *srna, const char *structname)
void RNA_def_property_override_flag(PropertyRNA *prop, PropertyOverrideFlag flag)
void RNA_def_parameter_flags(PropertyRNA *prop, PropertyFlag flag_property, ParameterFlag flag_parameter)
bool rna_Armature_object_poll(PointerRNA *ptr, PointerRNA value)
bool rna_Light_object_poll(PointerRNA *ptr, PointerRNA value)
int rna_object_vgroup_name_index_length(PointerRNA *ptr, int index)
bool rna_Lattice_object_poll(PointerRNA *ptr, PointerRNA value)
void rna_object_vgroup_name_set(PointerRNA *ptr, const char *value, char *result, int result_maxncpy)
bool rna_Mesh_object_poll(PointerRNA *ptr, PointerRNA value)
void rna_object_uvlayer_name_set(PointerRNA *ptr, const char *value, char *result, int result_maxncpy)
void rna_object_vgroup_name_index_set(PointerRNA *ptr, const char *value, short *index)
bool rna_Camera_object_poll(PointerRNA *ptr, PointerRNA value)
void rna_object_vgroup_name_index_get(PointerRNA *ptr, char *value, int index)
void rna_object_vcollayer_name_set(PointerRNA *ptr, const char *value, char *result, int result_maxncpy)
bool rna_Curve_object_poll(PointerRNA *ptr, PointerRNA value)
void rna_Object_internal_update_data(Main *bmain, Scene *scene, PointerRNA *ptr)
void RNA_api_object(StructRNA *srna)
const EnumPropertyItem rna_enum_object_modifier_type_items[]
const EnumPropertyItem rna_enum_object_empty_drawtype_items[]
const EnumPropertyItem rna_enum_metaelem_type_items[]
#define OBTYPE_CU_CURVE
static void rna_def_object_light_linking(BlenderRNA *brna)
#define OBTYPE_CU_FONT
const EnumPropertyItem rna_enum_workspace_object_mode_items[]
Definition rna_object.cc:71
static void rna_def_object_shaderfxs(BlenderRNA *brna, PropertyRNA *cprop)
static const EnumPropertyItem instance_items[]
static const EnumPropertyItem parent_type_items[]
const EnumPropertyItem rna_enum_object_gpencil_type_items[]
const EnumPropertyItem rna_enum_object_rotation_mode_items[]
static void rna_def_object_visibility(StructRNA *srna)
static void rna_def_material_slot(BlenderRNA *brna)
static void rna_def_object(BlenderRNA *brna)
const EnumPropertyItem rna_enum_lightprobes_type_items[]
static void rna_def_object_vertex_groups(BlenderRNA *brna, PropertyRNA *cprop)
const EnumPropertyItem rna_enum_object_mode_items[]
Definition rna_object.cc:33
static void rna_def_object_lineart(BlenderRNA *brna)
const EnumPropertyItem rna_enum_object_axis_items[]
const EnumPropertyItem rna_enum_object_type_curve_items[]
#define INSTANCE_ITEM_COLLECTION
const EnumPropertyItem rna_enum_object_type_items[]
#define OBTYPE_CU_SURF
static void rna_def_object_modifiers(BlenderRNA *brna, PropertyRNA *cprop)
static const EnumPropertyItem rna_enum_object_empty_image_depth_items[]
static void rna_def_vertex_group(BlenderRNA *brna)
static void rna_def_object_display(BlenderRNA *brna)
static void rna_def_object_constraints(BlenderRNA *brna, PropertyRNA *cprop)
static void rna_def_object_particle_systems(BlenderRNA *brna, PropertyRNA *cprop)
void RNA_def_object(BlenderRNA *brna)
#define INSTANCE_ITEMS_SHARED
const EnumPropertyItem rna_enum_object_shaderfx_type_items[]
#define min(a, b)
Definition sort.cc:36
#define FLT_MAX
Definition stdcycles.h:14
short selectmode
union CollectionPropertyIterator::@220100362304005352221007113371015217044252346141 internal
CustomDataLayer * layers
Definition DNA_ID.h:414
int tag
Definition DNA_ID.h:442
char name[258]
Definition DNA_ID.h:432
ListBase block
struct Collection * blocker_collection
struct Collection * receiver_collection
struct MaterialGPencilStyle * gp_style
char symmetry
MeshRuntimeHandle * runtime
CustomData corner_data
char editflag
CustomData fdata_legacy
ModifierTypeFlag flags
ListBase particlesystem
ListBase constraints
struct Collection * instance_collection
ObjectRuntimeHandle * runtime
ListBase modifiers
char * matbits
struct PartDeflect * pd
float rot[3]
float parentinv[4][4]
float quat[4]
LightLinking * light_linking
float rotAxis[3]
short protectflag
struct Object * parent
char parsubstr[64]
ID * owner_id
Definition RNA_types.hh:51
void invalidate()
Definition RNA_types.hh:110
void * data
Definition RNA_types.hh:53
IDOverrideLibraryPropertyOperation * liboverride_operation
max
Definition text_draw.cc:251
uint len
void WM_main_add_notifier(uint type, void *reference)
PointerRNA * ptr
Definition wm_files.cc:4238