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