Blender V5.0
rna_ID.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2023 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
8
9#include <cstdlib>
10
11#include "DNA_ID.h"
12#include "DNA_material_types.h"
13
14#include "BKE_lib_id.hh"
15#include "BKE_library.hh"
16
17#include "BLT_translation.hh"
18
19#include "RNA_define.hh"
20#include "RNA_enum_types.hh"
21
22#include "WM_types.hh"
23
24#include "rna_internal.hh"
25
26/* enum of ID-block types
27 * NOTE: need to keep this in line with the other defines for these
28 */
30 {ID_AC, "ACTION", ICON_ACTION, "Action", ""},
31 {ID_AR, "ARMATURE", ICON_ARMATURE_DATA, "Armature", ""},
32 {ID_BR, "BRUSH", ICON_BRUSH_DATA, "Brush", ""},
33 {ID_CF, "CACHEFILE", ICON_FILE, "Cache File", ""},
34 {ID_CA, "CAMERA", ICON_CAMERA_DATA, "Camera", ""},
35 {ID_GR, "COLLECTION", ICON_OUTLINER_COLLECTION, "Collection", ""},
36 {ID_CU_LEGACY, "CURVE", ICON_CURVE_DATA, "Curve", ""},
37 {ID_CV, "CURVES", ICON_CURVES_DATA, "Curves", ""},
38 {ID_VF, "FONT", ICON_FONT_DATA, "Font", ""},
39 {ID_GD_LEGACY, "GREASEPENCIL", ICON_GREASEPENCIL, "Grease Pencil", ""},
40 {ID_GP, "GREASEPENCIL_V3", ICON_GREASEPENCIL, "Grease Pencil v3", ""},
41 {ID_IM, "IMAGE", ICON_IMAGE_DATA, "Image", ""},
42 {ID_KE, "KEY", ICON_SHAPEKEY_DATA, "Key", ""},
43 {ID_LT, "LATTICE", ICON_LATTICE_DATA, "Lattice", ""},
44 {ID_LI, "LIBRARY", ICON_LIBRARY_DATA_DIRECT, "Library", ""},
45 {ID_LA, "LIGHT", ICON_LIGHT_DATA, "Light", ""},
46 {ID_LP, "LIGHT_PROBE", ICON_LIGHTPROBE_SPHERE, "Light Probe", ""},
47 {ID_LS, "LINESTYLE", ICON_LINE_DATA, "Line Style", ""},
48 {ID_MSK, "MASK", ICON_MOD_MASK, "Mask", ""},
49 {ID_MA, "MATERIAL", ICON_MATERIAL_DATA, "Material", ""},
50 {ID_ME, "MESH", ICON_MESH_DATA, "Mesh", ""},
51 {ID_MB, "META", ICON_META_DATA, "Metaball", ""},
52 {ID_MC, "MOVIECLIP", ICON_TRACKER, "Movie Clip", ""},
53 {ID_NT, "NODETREE", ICON_NODETREE, "Node Tree", ""},
54 {ID_OB, "OBJECT", ICON_OBJECT_DATA, "Object", ""},
55 {ID_PC, "PAINTCURVE", ICON_CURVE_BEZCURVE, "Paint Curve", ""},
56 {ID_PAL, "PALETTE", ICON_COLOR, "Palette", ""},
57 {ID_PA, "PARTICLE", ICON_PARTICLE_DATA, "Particle", ""},
58 {ID_PT, "POINTCLOUD", ICON_POINTCLOUD_DATA, "Point Cloud", ""},
59 {ID_SCE, "SCENE", ICON_SCENE_DATA, "Scene", ""},
60 {ID_SCR, "SCREEN", ICON_WORKSPACE, "Screen", ""},
61 {ID_SO, "SOUND", ICON_SOUND, "Sound", ""},
62 {ID_SPK, "SPEAKER", ICON_SPEAKER, "Speaker", ""},
63 {ID_TXT, "TEXT", ICON_TEXT, "Text", ""},
64 {ID_TE, "TEXTURE", ICON_TEXTURE_DATA, "Texture", ""},
65 {ID_VO, "VOLUME", ICON_VOLUME_DATA, "Volume", ""},
66 {ID_WM, "WINDOWMANAGER", ICON_WINDOW, "Window Manager", ""},
67 {ID_WS, "WORKSPACE", ICON_WORKSPACE, "Workspace", ""},
68 {ID_WO, "WORLD", ICON_WORLD_DATA, "World", ""},
69 {0, nullptr, 0, nullptr, nullptr},
70};
71
74 "NOOP",
75 0,
76 "No-Op",
77 "Does nothing, prevents adding actual overrides (NOT USED)"},
79 "REPLACE",
80 0,
81 "Replace",
82 "Replace value of reference by overriding one"},
84 "DIFF_ADD",
85 0,
86 "Differential",
87 "Stores and apply difference between reference and local value (NOT USED)"},
89 "DIFF_SUB",
90 0,
91 "Differential",
92 "Stores and apply difference between reference and local value (NOT USED)"},
94 "FACT_MULTIPLY",
95 0,
96 "Factor",
97 "Stores and apply multiplication factor between reference and local value (NOT USED)"},
99 "INSERT_AFTER",
100 0,
101 "Insert After",
102 "Insert a new item into collection after the one referenced in "
103 "subitem_reference_name/_id or _index"},
105 "INSERT_BEFORE",
106 0,
107 "Insert Before",
108 "Insert a new item into collection before the one referenced in "
109 "subitem_reference_name/_id or _index (NOT USED)"},
110 {0, nullptr, 0, nullptr, nullptr},
111};
112
117 /* Datablocks */
118 {FILTER_ID_AC, "filter_action", ICON_ACTION, "Actions", "Show Action data-blocks"},
120 "filter_armature",
121 ICON_ARMATURE_DATA,
122 "Armatures",
123 "Show Armature data-blocks"},
124 {FILTER_ID_BR, "filter_brush", ICON_BRUSH_DATA, "Brushes", "Show Brushes data-blocks"},
125 {FILTER_ID_CA, "filter_camera", ICON_CAMERA_DATA, "Cameras", "Show Camera data-blocks"},
126 {FILTER_ID_CF, "filter_cachefile", ICON_FILE, "Cache Files", "Show Cache File data-blocks"},
127 {FILTER_ID_CU_LEGACY, "filter_curve", ICON_CURVE_DATA, "Curves", "Show Curve data-blocks"},
129 "filter_annotations",
130 ICON_OUTLINER_DATA_GREASEPENCIL,
131 "Annotations",
132 "Show Annotation data-blocks"},
134 "filter_grease_pencil",
135 ICON_GREASEPENCIL,
136 "Grease Pencil",
137 "Show Grease Pencil data-blocks"},
138 {FILTER_ID_GR, "filter_group", ICON_GROUP, "Collections", "Show Collection data-blocks"},
140 "filter_curves",
141 ICON_CURVES_DATA,
142 "Hair Curves",
143 "Show/hide Curves data-blocks"},
144 {FILTER_ID_IM, "filter_image", ICON_IMAGE_DATA, "Images", "Show Image data-blocks"},
145 {FILTER_ID_LA, "filter_light", ICON_LIGHT_DATA, "Lights", "Show Light data-blocks"},
147 "filter_light_probe",
148 ICON_OUTLINER_DATA_LIGHTPROBE,
149 "Light Probes",
150 "Show Light Probe data-blocks"},
152 "filter_linestyle",
153 ICON_LINE_DATA,
154 "Freestyle Linestyles",
155 "Show Freestyle's Line Style data-blocks"},
156 {FILTER_ID_LT, "filter_lattice", ICON_LATTICE_DATA, "Lattices", "Show Lattice data-blocks"},
158 "filter_material",
159 ICON_MATERIAL_DATA,
160 "Materials",
161 "Show Material data-blocks"},
162 {FILTER_ID_MB, "filter_metaball", ICON_META_DATA, "Metaballs", "Show Metaball data-blocks"},
164 "filter_movie_clip",
165 ICON_TRACKER,
166 "Movie Clips",
167 "Show Movie Clip data-blocks"},
168 {FILTER_ID_ME, "filter_mesh", ICON_MESH_DATA, "Meshes", "Show Mesh data-blocks"},
169 {FILTER_ID_MSK, "filter_mask", ICON_MOD_MASK, "Masks", "Show Mask data-blocks"},
170 {FILTER_ID_NT, "filter_node_tree", ICON_NODETREE, "Node Trees", "Show Node Tree data-blocks"},
171 {FILTER_ID_OB, "filter_object", ICON_OBJECT_DATA, "Objects", "Show Object data-blocks"},
173 "filter_particle_settings",
174 ICON_PARTICLE_DATA,
175 "Particles Settings",
176 "Show Particle Settings data-blocks"},
177 {FILTER_ID_PAL, "filter_palette", ICON_COLOR, "Palettes", "Show Palette data-blocks"},
179 "filter_paint_curve",
180 ICON_CURVE_BEZCURVE,
181 "Paint Curves",
182 "Show Paint Curve data-blocks"},
184 "filter_pointcloud",
185 ICON_POINTCLOUD_DATA,
186 "Point Clouds",
187 "Show/hide Point Cloud data-blocks"},
188 {FILTER_ID_SCE, "filter_scene", ICON_SCENE_DATA, "Scenes", "Show Scene data-blocks"},
189 {FILTER_ID_SPK, "filter_speaker", ICON_SPEAKER, "Speakers", "Show Speaker data-blocks"},
190 {FILTER_ID_SO, "filter_sound", ICON_SOUND, "Sounds", "Show Sound data-blocks"},
191 {FILTER_ID_TE, "filter_texture", ICON_TEXTURE_DATA, "Textures", "Show Texture data-blocks"},
192 {FILTER_ID_TXT, "filter_text", ICON_TEXT, "Texts", "Show Text data-blocks"},
193 {FILTER_ID_VF, "filter_font", ICON_FONT_DATA, "Fonts", "Show Font data-blocks"},
194 {FILTER_ID_VO, "filter_volume", ICON_VOLUME_DATA, "Volumes", "Show/hide Volume data-blocks"},
195 {FILTER_ID_WO, "filter_world", ICON_WORLD_DATA, "Worlds", "Show World data-blocks"},
197 "filter_work_space",
198 ICON_WORKSPACE,
199 "Workspaces",
200 "Show workspace data-blocks"},
201 {0, nullptr, 0, nullptr, nullptr},
202};
203
204#ifdef RNA_RUNTIME
205
206# include "DNA_anim_types.h"
207
208# include "BLI_listbase.h"
209# include "BLI_math_base.h"
210
211# include "BLT_translation.hh"
212
213# include "BLO_readfile.hh"
214
215# include "BKE_anim_data.hh"
216# include "BKE_global.hh" /* XXX, remove me */
217# include "BKE_icons.h"
218# include "BKE_idprop.hh"
219# include "BKE_idtype.hh"
220# include "BKE_lib_override.hh"
221# include "BKE_lib_query.hh"
222# include "BKE_lib_remap.hh"
223# include "BKE_library.hh"
224# include "BKE_main_invariants.hh"
225# include "BKE_material.hh"
226# include "BKE_preview_image.hh"
227# include "BKE_vfont.hh"
228
229# include "DEG_depsgraph.hh"
230# include "DEG_depsgraph_build.hh"
231# include "DEG_depsgraph_query.hh"
232
233# include "ED_asset.hh"
234
235# include "WM_api.hh"
236
237# ifdef WITH_PYTHON
238# include "BPY_extern.hh"
239# endif
240
241void rna_ID_override_library_property_operation_refname_get(PointerRNA *ptr, char *value)
242{
244 ptr->data);
245 strcpy(value, (opop->subitem_reference_name == nullptr) ? "" : opop->subitem_reference_name);
246}
247
248int rna_ID_override_library_property_operation_refname_length(PointerRNA *ptr)
249{
251 ptr->data);
252 return (opop->subitem_reference_name == nullptr) ? 0 : strlen(opop->subitem_reference_name);
253}
254
255void rna_ID_override_library_property_operation_locname_get(PointerRNA *ptr, char *value)
256{
258 ptr->data);
259 strcpy(value, (opop->subitem_local_name == nullptr) ? "" : opop->subitem_local_name);
260}
261
262int rna_ID_override_library_property_operation_locname_length(PointerRNA *ptr)
263{
265 ptr->data);
266 return (opop->subitem_local_name == nullptr) ? 0 : strlen(opop->subitem_local_name);
267}
268
269/* name functions that ignore the first two ID characters */
270void rna_ID_name_get(PointerRNA *ptr, char *value)
271{
272 ID *id = (ID *)ptr->data;
273 strcpy(value, id->name + 2);
274}
275
277{
278 ID *id = (ID *)ptr->data;
279 return strlen(id->name + 2);
280}
281
282static int rna_ID_rename(ID *self, Main *bmain, const char *new_name, const int mode)
283{
284 IDNewNameResult result = BKE_id_rename(*bmain, *self, new_name, IDNewNameMode(mode));
285 return int(result.action);
286}
287
288void rna_ID_name_set(PointerRNA *ptr, const char *value)
289{
290 ID *id = (ID *)ptr->data;
291
292 rna_ID_rename(id, G_MAIN, value, int(IDNewNameMode::RenameExistingNever));
293}
294
295static int rna_ID_name_editable(const PointerRNA *ptr, const char **r_info)
296{
297 ID *id = (ID *)ptr->data;
298
299 /* NOTE: For the time being, allow rename of local liboverrides from the RNA API.
300 * While this is not allowed from the UI, this should work with modern liboverride code,
301 * and could be useful in some cases. */
302 if (!ID_IS_EDITABLE(id)) {
303 if (r_info) {
304 if (ID_IS_PACKED(id)) {
305 *r_info = N_("Packed data-blocks cannot be renamed");
306 }
307 else {
308 *r_info = N_("Linked data-blocks cannot be renamed");
309 }
310 }
311 return 0;
312 }
313
314 if (GS(id->name) == ID_VF) {
315 VFont *vfont = (VFont *)id;
316 if (BKE_vfont_is_builtin(vfont)) {
317 if (r_info) {
318 *r_info = N_("Built-in fonts cannot be renamed");
319 }
320 return 0;
321 }
322 }
323 else if (!BKE_id_is_in_global_main(id)) {
324 if (r_info) {
325 *r_info = N_("Data-blocks not in global Main data-base cannot be renamed");
326 }
327 return 0;
328 }
329
330 return PROP_EDITABLE;
331}
332
333void rna_ID_name_full_get(PointerRNA *ptr, char *value)
334{
335 ID *id = (ID *)ptr->data;
336 BKE_id_full_name_get(value, id, 0);
337}
338
339int rna_ID_name_full_length(PointerRNA *ptr)
340{
341 ID *id = (ID *)ptr->data;
344 return strlen(name);
345}
346
347static int rna_ID_type_get(PointerRNA *ptr)
348{
349 ID *id = static_cast<ID *>(ptr->data);
350 return GS(id->name);
351}
352
353static bool rna_ID_is_evaluated_get(PointerRNA *ptr)
354{
355 ID *id = (ID *)ptr->data;
356
357 return DEG_get_original(id) != id;
358}
359
360static PointerRNA rna_ID_original_get(PointerRNA *ptr)
361{
362 ID *id = (ID *)ptr->data;
363
365}
366
367short RNA_type_to_ID_code(const StructRNA *type)
368{
369 const StructRNA *base_type = RNA_struct_base_child_of(type, &RNA_ID);
370 if (UNLIKELY(base_type == nullptr)) {
371 return 0;
372 }
373 if (base_type == &RNA_Action) {
374 return ID_AC;
375 }
376 if (base_type == &RNA_Armature) {
377 return ID_AR;
378 }
379 if (base_type == &RNA_Brush) {
380 return ID_BR;
381 }
382 if (base_type == &RNA_CacheFile) {
383 return ID_CF;
384 }
385 if (base_type == &RNA_Camera) {
386 return ID_CA;
387 }
388 if (base_type == &RNA_Curve) {
389 return ID_CU_LEGACY;
390 }
391 if (base_type == &RNA_Annotation) {
392 return ID_GD_LEGACY;
393 }
394 if (base_type == &RNA_GreasePencil) {
395 return ID_GP;
396 }
397 if (base_type == &RNA_Collection) {
398 return ID_GR;
399 }
400 if (base_type == &RNA_Image) {
401 return ID_IM;
402 }
403 if (base_type == &RNA_Key) {
404 return ID_KE;
405 }
406 if (base_type == &RNA_Light) {
407 return ID_LA;
408 }
409 if (base_type == &RNA_Library) {
410 return ID_LI;
411 }
412 if (base_type == &RNA_FreestyleLineStyle) {
413 return ID_LS;
414 }
415 if (base_type == &RNA_Curves) {
416 return ID_CV;
417 }
418 if (base_type == &RNA_Lattice) {
419 return ID_LT;
420 }
421 if (base_type == &RNA_Material) {
422 return ID_MA;
423 }
424 if (base_type == &RNA_MetaBall) {
425 return ID_MB;
426 }
427 if (base_type == &RNA_MovieClip) {
428 return ID_MC;
429 }
430 if (base_type == &RNA_Mesh) {
431 return ID_ME;
432 }
433 if (base_type == &RNA_Mask) {
434 return ID_MSK;
435 }
436 if (base_type == &RNA_NodeTree) {
437 return ID_NT;
438 }
439 if (base_type == &RNA_Object) {
440 return ID_OB;
441 }
442 if (base_type == &RNA_ParticleSettings) {
443 return ID_PA;
444 }
445 if (base_type == &RNA_Palette) {
446 return ID_PAL;
447 }
448 if (base_type == &RNA_PaintCurve) {
449 return ID_PC;
450 }
451 if (base_type == &RNA_PointCloud) {
452 return ID_PT;
453 }
454 if (base_type == &RNA_LightProbe) {
455 return ID_LP;
456 }
457 if (base_type == &RNA_Scene) {
458 return ID_SCE;
459 }
460 if (base_type == &RNA_Screen) {
461 return ID_SCR;
462 }
463 if (base_type == &RNA_Sound) {
464 return ID_SO;
465 }
466 if (base_type == &RNA_Speaker) {
467 return ID_SPK;
468 }
469 if (base_type == &RNA_Texture) {
470 return ID_TE;
471 }
472 if (base_type == &RNA_Text) {
473 return ID_TXT;
474 }
475 if (base_type == &RNA_VectorFont) {
476 return ID_VF;
477 }
478 if (base_type == &RNA_Volume) {
479 return ID_VO;
480 }
481 if (base_type == &RNA_WorkSpace) {
482 return ID_WS;
483 }
484 if (base_type == &RNA_World) {
485 return ID_WO;
486 }
487 if (base_type == &RNA_WindowManager) {
488 return ID_WM;
489 }
490
491 return 0;
492}
493
494StructRNA *ID_code_to_RNA_type(short idcode)
495{
496 /* NOTE: this switch doesn't use a 'default',
497 * so adding new ID's causes a warning. */
498 switch ((ID_Type)idcode) {
499 case ID_AC:
500 return &RNA_Action;
501 case ID_AR:
502 return &RNA_Armature;
503 case ID_BR:
504 return &RNA_Brush;
505 case ID_CA:
506 return &RNA_Camera;
507 case ID_CF:
508 return &RNA_CacheFile;
509 case ID_CU_LEGACY:
510 return &RNA_Curve;
511 case ID_GD_LEGACY:
512 return &RNA_Annotation;
513 case ID_GP:
514 return &RNA_GreasePencil;
515 case ID_GR:
516 return &RNA_Collection;
517 case ID_CV:
518 return &RNA_Curves;
519 case ID_IM:
520 return &RNA_Image;
521 case ID_KE:
522 return &RNA_Key;
523 case ID_LA:
524 return &RNA_Light;
525 case ID_LI:
526 return &RNA_Library;
527 case ID_LS:
528 return &RNA_FreestyleLineStyle;
529 case ID_LT:
530 return &RNA_Lattice;
531 case ID_MA:
532 return &RNA_Material;
533 case ID_MB:
534 return &RNA_MetaBall;
535 case ID_MC:
536 return &RNA_MovieClip;
537 case ID_ME:
538 return &RNA_Mesh;
539 case ID_MSK:
540 return &RNA_Mask;
541 case ID_NT:
542 return &RNA_NodeTree;
543 case ID_OB:
544 return &RNA_Object;
545 case ID_PA:
546 return &RNA_ParticleSettings;
547 case ID_PAL:
548 return &RNA_Palette;
549 case ID_PC:
550 return &RNA_PaintCurve;
551 case ID_PT:
552 return &RNA_PointCloud;
553 case ID_LP:
554 return &RNA_LightProbe;
555 case ID_SCE:
556 return &RNA_Scene;
557 case ID_SCR:
558 return &RNA_Screen;
559 case ID_SO:
560 return &RNA_Sound;
561 case ID_SPK:
562 return &RNA_Speaker;
563 case ID_TE:
564 return &RNA_Texture;
565 case ID_TXT:
566 return &RNA_Text;
567 case ID_VF:
568 return &RNA_VectorFont;
569 case ID_VO:
570 return &RNA_Volume;
571 case ID_WM:
572 return &RNA_WindowManager;
573 case ID_WO:
574 return &RNA_World;
575 case ID_WS:
576 return &RNA_WorkSpace;
577 }
578
579 return &RNA_ID;
580}
581
583{
584 ID *id = (ID *)ptr->data;
585
586 return ID_code_to_RNA_type(GS(id->name));
587}
588
590{
591 ID *id = (ID *)ptr->data;
592 return &id->properties;
593}
594
596{
597 ID *id = (ID *)ptr->data;
598 return &id->system_properties;
599}
600
601int rna_ID_is_runtime_editable(const PointerRNA *ptr, const char **r_info)
602{
603 ID *id = (ID *)ptr->data;
604 /* TODO: This should be abstracted in a BKE function or define, somewhat related to #88555. */
607 {
608 *r_info = N_(
609 "Cannot edit 'runtime' status of non-blendfile data-blocks, as they are by definition "
610 "always runtime");
611 return 0;
612 }
613
614 return PROP_EDITABLE;
615}
616
617bool rna_ID_is_runtime_get(PointerRNA *ptr)
618{
619 ID *id = (ID *)ptr->data;
620 /* TODO: This should be abstracted in a BKE function or define, somewhat related to #88555. */
623 {
624 return true;
625 }
626
627 return (id->tag & ID_TAG_RUNTIME) != 0;
628}
629
630bool rna_ID_is_editable_get(PointerRNA *ptr)
631{
632 ID *id = (ID *)ptr->data;
633 return ID_IS_EDITABLE(id);
634}
635
636void rna_ID_fake_user_set(PointerRNA *ptr, bool value)
637{
638 ID *id = (ID *)ptr->data;
639
640 if (value) {
642 }
643 else {
645 }
646}
647
648void rna_ID_extra_user_set(PointerRNA *ptr, bool value)
649{
650 ID *id = (ID *)ptr->data;
651
652 if (value) {
654 }
655 else {
657 }
658}
659
661{
662 return (IDProperty **)&ptr->data;
663}
664
665bool rna_PropertyGroup_unregister(Main * /*bmain*/, StructRNA *type)
666{
667# ifdef WITH_PYTHON
668 /* Ensure that a potential py object representing this RNA type is properly dereferenced. */
670# endif
671
673 return true;
674}
675
677 ReportList *reports,
678 void *data,
679 const char *identifier,
680 StructValidateFunc validate,
681 StructCallbackFunc /*call*/,
682 StructFreeFunc /*free*/)
683{
684 /* create dummy pointer */
685 PointerRNA dummy_ptr = RNA_pointer_create_discrete(nullptr, &RNA_PropertyGroup, nullptr);
686
687 /* validate the python class */
688 if (validate(&dummy_ptr, data, nullptr) != 0) {
689 return nullptr;
690 }
691
692 /* NOTE: it looks like there is no length limit on the srna id since its
693 * just a char pointer, but take care here, also be careful that python
694 * owns the string pointer which it could potentially free while blender
695 * is running. */
696 if (BLI_strnlen(identifier, MAX_IDPROP_NAME) == MAX_IDPROP_NAME) {
697 BKE_reportf(reports,
698 RPT_ERROR,
699 "Registering id property class: '%s' is too long, maximum length is %d",
700 identifier,
702 return nullptr;
703 }
704
705 return RNA_def_struct_ptr(&BLENDER_RNA, identifier, &RNA_PropertyGroup); /* XXX */
706}
707
709{
710 return ptr->type;
711}
712
713static ID *rna_ID_evaluated_get(ID *id, Depsgraph *depsgraph)
714{
715 return DEG_get_evaluated(depsgraph, id);
716}
717
718static ID *rna_ID_copy(ID *id, Main *bmain)
719{
720 ID *newid = BKE_id_copy_for_use_in_bmain(bmain, id);
721
722 if (newid != nullptr) {
723 id_us_min(newid);
724 }
725
727 BKE_main_ensure_invariants(*bmain, *newid);
728
729 return newid;
730}
731
732static void rna_ID_asset_mark(ID *id)
733{
737 }
738}
739
740static void rna_ID_asset_generate_preview(ID *id, bContext *C)
741{
743
746}
747
748static void rna_ID_asset_clear(ID *id)
749{
753 }
754}
755
756static void rna_ID_asset_data_set(PointerRNA *ptr, PointerRNA value, ReportList *reports)
757{
758 ID *destination = static_cast<ID *>(ptr->data);
759
760 /* Avoid marking as asset by assigning. This should be done with `.asset_mark()`.
761 * This is just for clarity of the API, and to accommodate future changes. */
762 if (destination->asset_data == nullptr) {
763 BKE_report(reports,
764 RPT_ERROR,
765 "Asset data can only be assigned to assets. Use asset_mark() to mark as an asset.");
766 return;
767 }
768
769 const AssetMetaData *asset_data = static_cast<const AssetMetaData *>(value.data);
770 if (asset_data == nullptr) {
771 /* Avoid clearing the asset data on assets. Un-marking as asset should be done with
772 * `.asset_clear()`. This is just for clarity of the API, and to accommodate future changes. */
773 BKE_report(reports, RPT_ERROR, "Asset data cannot be None");
774 return;
775 }
776
777 const bool assigned_ok = blender::ed::asset::copy_to_id(asset_data, destination);
778 if (!assigned_ok) {
780 reports, RPT_ERROR, "'%s' is of a type that cannot be an asset", destination->name + 2);
781 return;
782 }
783
786}
787
788static ID *rna_ID_override_create(ID *id, Main *bmain, bool remap_local_usages)
789{
790 if (!ID_IS_OVERRIDABLE_LIBRARY(id)) {
791 return nullptr;
792 }
793
794 if (remap_local_usages) {
795 BKE_main_id_tag_all(bmain, ID_TAG_DOIT, true);
796 }
797
798 ID *local_id = nullptr;
799# ifdef WITH_PYTHON
801# endif
802
803 local_id = BKE_lib_override_library_create_from_id(bmain, id, remap_local_usages);
804
805# ifdef WITH_PYTHON
807# endif
808
809 if (remap_local_usages) {
810 BKE_main_id_tag_all(bmain, ID_TAG_DOIT, false);
811 }
812
815
816 return local_id;
817}
818
819static ID *rna_ID_override_hierarchy_create(ID *id,
820 Main *bmain,
821 Scene *scene,
822 ViewLayer *view_layer,
823 ID *id_instance_hint,
824 bool do_fully_editable)
825{
826 if (!ID_IS_OVERRIDABLE_LIBRARY(id)) {
827 return nullptr;
828 }
829
830 BKE_main_id_tag_all(bmain, ID_TAG_DOIT, false);
831
832 ID *id_root_override = nullptr;
833
834# ifdef WITH_PYTHON
836# endif
837
839 scene,
840 view_layer,
841 nullptr,
842 id,
843 id,
844 id_instance_hint,
845 &id_root_override,
846 do_fully_editable);
847
848# ifdef WITH_PYTHON
850# endif
851
854
855 return id_root_override;
856}
857
858static void rna_ID_override_library_operations_update(ID *id,
859 IDOverrideLibrary * /*override_library*/,
860 Main *bmain,
861 ReportList *reports)
862{
864 BKE_reportf(reports, RPT_ERROR, "ID '%s' isn't an override", id->name);
865 return;
866 }
867
868 if (ID_IS_LINKED(id)) {
869 BKE_reportf(reports, RPT_ERROR, "ID '%s' is linked, cannot edit its overrides", id->name);
870 return;
871 }
872
874
876}
877
878static void rna_ID_override_library_reset(ID *id,
879 IDOverrideLibrary * /*override_library*/,
880 Main *bmain,
881 ReportList *reports,
882 bool do_hierarchy,
883 bool set_system_override)
884{
886 BKE_reportf(reports, RPT_ERROR, "ID '%s' isn't an override", id->name);
887 return;
888 }
889
890 if (do_hierarchy) {
891 BKE_lib_override_library_id_hierarchy_reset(bmain, id, set_system_override);
892 }
893 else {
894 BKE_lib_override_library_id_reset(bmain, id, set_system_override);
895 }
896
898}
899
900static void rna_ID_override_library_destroy(ID *id,
901 IDOverrideLibrary * /*override_library*/,
902 Main *bmain,
903 ReportList *reports,
904 bool do_hierarchy)
905{
907 BKE_reportf(reports, RPT_ERROR, "ID '%s' isn't an override", id->name);
908 return;
909 }
910
911 if (do_hierarchy) {
913 }
914 else {
916 BKE_id_delete(bmain, id);
917 }
918
920}
921
922static bool rna_ID_override_library_resync(ID *id,
923 IDOverrideLibrary *override_library,
924 Main *bmain,
925 ReportList *reports,
926 Scene *scene,
927 ViewLayer *view_layer,
928 Collection *override_resync_residual_storage,
929 bool do_hierarchy_enforce,
930 bool do_whole_hierarchy)
931{
932 BLI_assert(id->override_library == override_library);
933
934 if (!override_library->hierarchy_root ||
935 (override_library->flag & LIBOVERRIDE_FLAG_NO_HIERARCHY) != 0)
936 {
938 reports,
940 "Data-block '%s' is not a library override, or not part of a library override hierarchy",
941 id->name);
942 return false;
943 }
944
945 ID *id_root = do_whole_hierarchy ? override_library->hierarchy_root : id;
946 BlendFileReadReport bf_reports = {};
947 bf_reports.reports = reports;
948
949 const bool success = BKE_lib_override_library_resync(bmain,
950 scene,
951 view_layer,
952 id_root,
953 override_resync_residual_storage,
954 do_hierarchy_enforce,
955 &bf_reports);
956
958 return success;
959}
960
961static IDOverrideLibraryProperty *rna_ID_override_library_properties_add(
962 IDOverrideLibrary *override_library, ReportList *reports, const char rna_path[])
963{
964 bool created;
966 override_library, rna_path, &created);
967
968 if (!created) {
969 BKE_report(reports, RPT_DEBUG, "No new override property created, property already exists");
970 }
971
973 return result;
974}
975
976static void rna_ID_override_library_properties_remove(IDOverrideLibrary *override_library,
977 ReportList *reports,
978 IDOverrideLibraryProperty *override_property)
979{
980 if (BLI_findindex(&override_library->properties, override_property) == -1) {
981 BKE_report(reports, RPT_ERROR, "Override property cannot be removed");
982 return;
983 }
984
985 BKE_lib_override_library_property_delete(override_library, override_property);
986
988}
989
990static IDOverrideLibraryPropertyOperation *rna_ID_override_library_property_operations_add(
991 IDOverrideLibraryProperty *override_property,
992 ReportList *reports,
993 int operation,
994 const bool use_id,
995 const char *subitem_refname,
996 const char *subitem_locname,
997 ID *subitem_refid,
998 ID *subitem_locid,
999 int subitem_refindex,
1000 int subitem_locindex)
1001{
1002 bool created;
1003 bool strict;
1005 override_property,
1006 operation,
1007 subitem_refname,
1008 subitem_locname,
1009 use_id ? std::optional(subitem_refid) : std::nullopt,
1010 use_id ? std::optional(subitem_locid) : std::nullopt,
1011 subitem_refindex,
1012 subitem_locindex,
1013 false,
1014 &strict,
1015 &created);
1016 if (!created) {
1017 BKE_report(reports, RPT_DEBUG, "No new override operation created, operation already exists");
1018 }
1019
1021 return result;
1022}
1023
1024static void rna_ID_override_library_property_operations_remove(
1025 IDOverrideLibraryProperty *override_property,
1026 ReportList *reports,
1027 IDOverrideLibraryPropertyOperation *override_operation)
1028{
1029 if (BLI_findindex(&override_property->operations, override_operation) == -1) {
1030 BKE_report(reports, RPT_ERROR, "Override operation cannot be removed");
1031 return;
1032 }
1033
1034 BKE_lib_override_library_property_operation_delete(override_property, override_operation);
1035
1037}
1038
1039static void rna_ID_update_tag(ID *id, Main *bmain, ReportList *reports, int flag)
1040{
1041/* XXX, new function for this! */
1042# if 0
1043 if (ob->type == OB_FONT) {
1044 Curve *cu = ob->data;
1045 freedisplist(&cu->disp);
1046 BKE_vfont_to_curve(bmain, sce, ob, FO_EDIT, nullptr);
1047 }
1048# endif
1049
1050 if (flag == 0) {
1051 /* pass */
1052 }
1053 else {
1054 int allow_flag = 0;
1055
1056 /* ensure flag us correct for the type */
1057 switch (GS(id->name)) {
1058 case ID_OB:
1059 /* TODO(sergey): This is kind of difficult to predict since different
1060 * object types supports different flags. Maybe does not worth checking
1061 * for this at all. Or maybe let dependency graph to return whether
1062 * the tag was valid or not. */
1063 allow_flag = ID_RECALC_ALL;
1064 break;
1065/* Could add particle updates later */
1066# if 0
1067 case ID_PA:
1068 allow_flag = OB_RECALC_ALL | PSYS_RECALC;
1069 break;
1070# endif
1071 case ID_AC:
1072 allow_flag = ID_RECALC_ANIMATION;
1073 break;
1074 default:
1075 if (id_can_have_animdata(id)) {
1076 allow_flag = ID_RECALC_ANIMATION;
1077 }
1078 }
1079
1080 if (flag & ~allow_flag) {
1081 StructRNA *srna = ID_code_to_RNA_type(GS(id->name));
1082 BKE_reportf(reports,
1083 RPT_ERROR,
1084 allow_flag ? N_("%s is not compatible with the specified 'refresh' options") :
1085 N_("%s is not compatible with any 'refresh' options"),
1086 RNA_struct_identifier(srna));
1087 return;
1088 }
1089 }
1090
1091 DEG_id_tag_update_ex(bmain, id, flag);
1092}
1093
1094static void rna_ID_user_clear(ID *id)
1095{
1097 id->us = 0; /* don't save */
1098}
1099
1100static void rna_ID_user_remap(ID *id, Main *bmain, ID *new_id)
1101{
1102 if ((GS(id->name) == GS(new_id->name)) && (id != new_id)) {
1103 /* For now, do not allow remapping data in linked data from here... */
1106
1108 }
1109}
1110
1111static ID *rna_ID_make_local(
1112 ID *self, Main *bmain, bool /*clear_proxy*/, bool clear_liboverride, bool clear_asset_data)
1113{
1114 if (ID_IS_LINKED(self)) {
1115 int flags = 0;
1116 if (clear_asset_data) {
1118 }
1119
1120 BKE_lib_id_make_local(bmain, self, flags);
1121 }
1124 }
1125
1126 ID *ret_id = self->newid ? self->newid : self;
1128
1129 if (clear_liboverride && ID_IS_OVERRIDE_LIBRARY_REAL(ret_id)) {
1131 }
1132
1133 return ret_id;
1134}
1135
1136static AnimData *rna_ID_animation_data_create(ID *id, Main *bmain)
1137{
1140 return adt;
1141}
1142
1143static void rna_ID_animation_data_free(ID *id, Main *bmain)
1144{
1145 BKE_animdata_free(id, true);
1147}
1148
1149# ifdef WITH_PYTHON
1151{
1152 ID *id = (ID *)ptr->data;
1153 return &id->py_instance;
1154}
1155# endif
1156
1157static void rna_IDPArray_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
1158{
1159 IDProperty *prop = (IDProperty *)ptr->data;
1161 iter, ptr, IDP_property_array_get(prop), sizeof(IDProperty), prop->len, 0, nullptr);
1162}
1163
1164static int rna_IDPArray_length(PointerRNA *ptr)
1165{
1166 IDProperty *prop = (IDProperty *)ptr->data;
1167 return prop->len;
1168}
1169
1170bool rna_IDMaterials_assign_int(PointerRNA *ptr, int key, const PointerRNA *assign_ptr)
1171{
1172 ID *id = ptr->owner_id;
1173 short *totcol = BKE_id_material_len_p(id);
1174 Material *mat_id = (Material *)assign_ptr->owner_id;
1175 if (totcol && (key >= 0 && key < *totcol)) {
1178 BKE_id_material_assign(G_MAIN, id, mat_id, key + 1);
1179 return true;
1180 }
1181 else {
1182 return false;
1183 }
1184}
1185
1186static void rna_IDMaterials_append_id(ID *id, Main *bmain, Material *ma)
1187{
1188 BKE_id_material_append(bmain, id, ma);
1189
1192}
1193
1194static Material *rna_IDMaterials_pop_id(ID *id, Main *bmain, ReportList *reports, int index_i)
1195{
1196 Material *ma;
1197 short *totcol = BKE_id_material_len_p(id);
1198 const short totcol_orig = *totcol;
1199 if (index_i < 0) {
1200 index_i += (*totcol);
1201 }
1202
1203 if ((index_i < 0) || (index_i >= (*totcol))) {
1204 BKE_report(reports, RPT_ERROR, "Index out of range");
1205 return nullptr;
1206 }
1207
1208 ma = BKE_id_material_pop(bmain, id, index_i);
1209
1210 if (*totcol == totcol_orig) {
1211 BKE_report(reports, RPT_ERROR, "No material to removed");
1212 return nullptr;
1213 }
1214
1218
1219 return ma;
1220}
1221
1222static void rna_IDMaterials_clear_id(ID *id, Main *bmain)
1223{
1224 BKE_id_material_clear(bmain, id);
1225
1229}
1230
1231static void rna_Library_filepath_set(PointerRNA *ptr, const char *value)
1232{
1233 Library *lib = (Library *)ptr->data;
1236}
1237
1238/* ***** ImagePreview ***** */
1239
1240static void rna_ImagePreview_is_custom_set(PointerRNA *ptr, int value, enum eIconSizes size)
1241{
1242 ID *id = ptr->owner_id;
1243 PreviewImage *prv_img = (PreviewImage *)ptr->data;
1244
1245 if (id != nullptr) {
1246 BLI_assert(prv_img == BKE_previewimg_id_ensure(id));
1247 }
1248
1249 if ((value && (prv_img->flag[size] & PRV_USER_EDITED)) ||
1250 (!value && !(prv_img->flag[size] & PRV_USER_EDITED)))
1251 {
1252 return;
1253 }
1254
1255 if (value) {
1256 prv_img->flag[size] |= PRV_USER_EDITED;
1257 }
1258 else {
1259 prv_img->flag[size] &= ~PRV_USER_EDITED;
1260 }
1261
1262 prv_img->flag[size] |= PRV_CHANGED;
1263
1265}
1266
1267static void rna_ImagePreview_size_get(PointerRNA *ptr, int *values, enum eIconSizes size)
1268{
1269 ID *id = ptr->owner_id;
1270 PreviewImage *prv_img = (PreviewImage *)ptr->data;
1271
1272 if (id != nullptr) {
1273 BLI_assert(prv_img == BKE_previewimg_id_ensure(id));
1274 }
1275
1276 BKE_previewimg_ensure(prv_img, size);
1277
1278 values[0] = prv_img->w[size];
1279 values[1] = prv_img->h[size];
1280}
1281
1282static void rna_ImagePreview_size_set(PointerRNA *ptr, const int *values, enum eIconSizes size)
1283{
1284 ID *id = ptr->owner_id;
1285 PreviewImage *prv_img = (PreviewImage *)ptr->data;
1286
1287 if (id != nullptr) {
1288 BLI_assert(prv_img == BKE_previewimg_id_ensure(id));
1289 }
1290
1292
1293 if (values[0] && values[1]) {
1294 prv_img->rect[size] = MEM_calloc_arrayN<uint>(size_t(values[0]) * size_t(values[1]),
1295 "prv_rect");
1296
1297 prv_img->w[size] = values[0];
1298 prv_img->h[size] = values[1];
1299 }
1300
1301 prv_img->flag[size] |= (PRV_CHANGED | PRV_USER_EDITED);
1302}
1303
1304static int rna_ImagePreview_pixels_get_length(const PointerRNA *ptr,
1306 enum eIconSizes size)
1307{
1308 ID *id = ptr->owner_id;
1309 PreviewImage *prv_img = (PreviewImage *)ptr->data;
1310
1311 if (id != nullptr) {
1312 BLI_assert(prv_img == BKE_previewimg_id_ensure(id));
1313 }
1314
1315 BKE_previewimg_ensure(prv_img, size);
1316
1317 length[0] = prv_img->w[size] * prv_img->h[size];
1318
1319 return length[0];
1320}
1321
1322static void rna_ImagePreview_pixels_get(PointerRNA *ptr, int *values, enum eIconSizes size)
1323{
1324 ID *id = ptr->owner_id;
1325 PreviewImage *prv_img = (PreviewImage *)ptr->data;
1326
1327 if (id != nullptr) {
1328 BLI_assert(prv_img == BKE_previewimg_id_ensure(id));
1329 }
1330
1331 BKE_previewimg_ensure(prv_img, size);
1332
1333 memcpy(values, prv_img->rect[size], prv_img->w[size] * prv_img->h[size] * sizeof(uint));
1334}
1335
1336static void rna_ImagePreview_pixels_set(PointerRNA *ptr, const int *values, enum eIconSizes size)
1337{
1338 ID *id = ptr->owner_id;
1339 PreviewImage *prv_img = (PreviewImage *)ptr->data;
1340
1341 if (id != nullptr) {
1342 BLI_assert(prv_img == BKE_previewimg_id_ensure(id));
1343 }
1344
1345 memcpy(prv_img->rect[size], values, prv_img->w[size] * prv_img->h[size] * sizeof(uint));
1346 prv_img->flag[size] |= PRV_USER_EDITED;
1347}
1348
1349static int rna_ImagePreview_pixels_float_get_length(const PointerRNA *ptr,
1351 enum eIconSizes size)
1352{
1353 ID *id = ptr->owner_id;
1354 PreviewImage *prv_img = (PreviewImage *)ptr->data;
1355
1356 BLI_assert(sizeof(uint) == 4);
1357
1358 if (id != nullptr) {
1359 BLI_assert(prv_img == BKE_previewimg_id_ensure(id));
1360 }
1361
1362 BKE_previewimg_ensure(prv_img, size);
1363
1364 length[0] = prv_img->w[size] * prv_img->h[size] * 4;
1365
1366 return length[0];
1367}
1368
1369static void rna_ImagePreview_pixels_float_get(PointerRNA *ptr, float *values, enum eIconSizes size)
1370{
1371 ID *id = ptr->owner_id;
1372 PreviewImage *prv_img = (PreviewImage *)ptr->data;
1373
1374 uchar *data = (uchar *)prv_img->rect[size];
1375 const size_t len = prv_img->w[size] * prv_img->h[size] * 4;
1376 size_t i;
1377
1378 BLI_assert(sizeof(uint) == 4);
1379
1380 if (id != nullptr) {
1381 BLI_assert(prv_img == BKE_previewimg_id_ensure(id));
1382 }
1383
1384 BKE_previewimg_ensure(prv_img, size);
1385
1386 for (i = 0; i < len; i++) {
1387 values[i] = data[i] * (1.0f / 255.0f);
1388 }
1389}
1390
1391static void rna_ImagePreview_pixels_float_set(PointerRNA *ptr,
1392 const float *values,
1393 enum eIconSizes size)
1394{
1395 ID *id = ptr->owner_id;
1396 PreviewImage *prv_img = (PreviewImage *)ptr->data;
1397
1398 uchar *data = (uchar *)prv_img->rect[size];
1399 const size_t len = prv_img->w[size] * prv_img->h[size] * 4;
1400 size_t i;
1401
1402 BLI_assert(sizeof(uint) == 4);
1403
1404 if (id != nullptr) {
1405 BLI_assert(prv_img == BKE_previewimg_id_ensure(id));
1406 }
1407
1408 for (i = 0; i < len; i++) {
1409 data[i] = unit_float_to_uchar_clamp(values[i]);
1410 }
1411 prv_img->flag[size] |= PRV_USER_EDITED;
1412}
1413
1414static void rna_ImagePreview_is_image_custom_set(PointerRNA *ptr, bool value)
1415{
1416 rna_ImagePreview_is_custom_set(ptr, value, ICON_SIZE_PREVIEW);
1417}
1418
1419static void rna_ImagePreview_image_size_get(PointerRNA *ptr, int *values)
1420{
1421 rna_ImagePreview_size_get(ptr, values, ICON_SIZE_PREVIEW);
1422}
1423
1424static void rna_ImagePreview_image_size_set(PointerRNA *ptr, const int *values)
1425{
1426 rna_ImagePreview_size_set(ptr, values, ICON_SIZE_PREVIEW);
1427}
1428
1429static int rna_ImagePreview_image_pixels_get_length(const PointerRNA *ptr,
1431{
1432 return rna_ImagePreview_pixels_get_length(ptr, length, ICON_SIZE_PREVIEW);
1433}
1434
1435static void rna_ImagePreview_image_pixels_get(PointerRNA *ptr, int *values)
1436{
1437 rna_ImagePreview_pixels_get(ptr, values, ICON_SIZE_PREVIEW);
1438}
1439
1440static void rna_ImagePreview_image_pixels_set(PointerRNA *ptr, const int *values)
1441{
1442 rna_ImagePreview_pixels_set(ptr, values, ICON_SIZE_PREVIEW);
1443}
1444
1445static int rna_ImagePreview_image_pixels_float_get_length(const PointerRNA *ptr,
1447{
1448 return rna_ImagePreview_pixels_float_get_length(ptr, length, ICON_SIZE_PREVIEW);
1449}
1450
1451static void rna_ImagePreview_image_pixels_float_get(PointerRNA *ptr, float *values)
1452{
1453 rna_ImagePreview_pixels_float_get(ptr, values, ICON_SIZE_PREVIEW);
1454}
1455
1456static void rna_ImagePreview_image_pixels_float_set(PointerRNA *ptr, const float *values)
1457{
1458 rna_ImagePreview_pixels_float_set(ptr, values, ICON_SIZE_PREVIEW);
1459}
1460
1461static void rna_ImagePreview_is_icon_custom_set(PointerRNA *ptr, bool value)
1462{
1463 rna_ImagePreview_is_custom_set(ptr, value, ICON_SIZE_ICON);
1464}
1465
1466static void rna_ImagePreview_icon_size_get(PointerRNA *ptr, int *values)
1467{
1468 rna_ImagePreview_size_get(ptr, values, ICON_SIZE_ICON);
1469}
1470
1471static void rna_ImagePreview_icon_size_set(PointerRNA *ptr, const int *values)
1472{
1473 rna_ImagePreview_size_set(ptr, values, ICON_SIZE_ICON);
1474}
1475
1476static int rna_ImagePreview_icon_pixels_get_length(const PointerRNA *ptr,
1478{
1479 return rna_ImagePreview_pixels_get_length(ptr, length, ICON_SIZE_ICON);
1480}
1481
1482static void rna_ImagePreview_icon_pixels_get(PointerRNA *ptr, int *values)
1483{
1484 rna_ImagePreview_pixels_get(ptr, values, ICON_SIZE_ICON);
1485}
1486
1487static void rna_ImagePreview_icon_pixels_set(PointerRNA *ptr, const int *values)
1488{
1489 rna_ImagePreview_pixels_set(ptr, values, ICON_SIZE_ICON);
1490}
1491
1492static int rna_ImagePreview_icon_pixels_float_get_length(const PointerRNA *ptr,
1494{
1495 return rna_ImagePreview_pixels_float_get_length(ptr, length, ICON_SIZE_ICON);
1496}
1497
1498static void rna_ImagePreview_icon_pixels_float_get(PointerRNA *ptr, float *values)
1499{
1500 rna_ImagePreview_pixels_float_get(ptr, values, ICON_SIZE_ICON);
1501}
1502
1503static void rna_ImagePreview_icon_pixels_float_set(PointerRNA *ptr, const float *values)
1504{
1505 rna_ImagePreview_pixels_float_set(ptr, values, ICON_SIZE_ICON);
1506}
1507
1508static int rna_ImagePreview_icon_id_get(PointerRNA *ptr)
1509{
1510 /* Using a callback here allows us to only generate icon matching
1511 * that preview when icon_id is requested. */
1512 return BKE_icon_preview_ensure(ptr->owner_id, (PreviewImage *)(ptr->data));
1513}
1514static void rna_ImagePreview_icon_reload(PreviewImage *prv)
1515{
1516 /* will lazy load on next use, but only in case icon is not user-modified! */
1517 if (!(prv->flag[ICON_SIZE_ICON] & PRV_USER_EDITED) &&
1519 {
1521 }
1522}
1523
1524static PointerRNA rna_IDPreview_get(PointerRNA *ptr)
1525{
1526 ID *id = (ID *)ptr->data;
1527 PreviewImage *prv_img = BKE_previewimg_id_get(id);
1528
1529 return RNA_pointer_create_with_parent(*ptr, &RNA_ImagePreview, prv_img);
1530}
1531
1532static IDProperty **rna_IDPropertyWrapPtr_idprops(PointerRNA *ptr)
1533{
1534 if (ptr == nullptr) {
1535 return nullptr;
1536 }
1537 return (IDProperty **)&ptr->data;
1538}
1539
1540static void rna_Library_version_get(PointerRNA *ptr, int *value)
1541{
1542 Library *lib = (Library *)ptr->data;
1543 value[0] = lib->runtime->versionfile / 100;
1544 value[1] = lib->runtime->versionfile % 100;
1545 value[2] = lib->runtime->subversionfile;
1546}
1547
1548static void rna_Library_archive_libraries_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
1549{
1550 iter->parent = *ptr;
1551 Library *lib = static_cast<Library *>(ptr->data);
1552
1553 Library **archive_libraries_iter = lib->runtime->archived_libraries.begin();
1554 iter->internal.custom = archive_libraries_iter;
1555
1556 iter->valid = archive_libraries_iter != lib->runtime->archived_libraries.end();
1557}
1558
1559static void rna_Library_archive_libraries_next(CollectionPropertyIterator *iter)
1560{
1561 Library *lib = static_cast<Library *>(iter->parent.data);
1562 Library **archive_libraries_iter = static_cast<Library **>(iter->internal.custom);
1563
1564 archive_libraries_iter++;
1565 iter->internal.custom = archive_libraries_iter;
1566
1567 iter->valid = archive_libraries_iter != lib->runtime->archived_libraries.end();
1568}
1569
1570static PointerRNA rna_Library_archive_libraries_get(CollectionPropertyIterator *iter)
1571{
1572 Library **archive_libraries_iter = static_cast<Library **>(iter->internal.custom);
1573 return RNA_pointer_create_with_parent(iter->parent, &RNA_Library, *archive_libraries_iter);
1574}
1575
1576static int rna_Library_archive_libraries_length(PointerRNA *ptr)
1577{
1578 Library *lib = static_cast<Library *>(ptr->data);
1579 return int(lib->runtime->archived_libraries.size());
1580}
1581
1582static bool rna_Library_archive_libraries_lookupint(PointerRNA *ptr, int key, PointerRNA *r_ptr)
1583{
1584 Library *lib = static_cast<Library *>(ptr->data);
1585 if (key < 0 || key >= lib->runtime->archived_libraries.size()) {
1586 return false;
1587 }
1588
1589 Library *archive_library = lib->runtime->archived_libraries[key];
1590 rna_pointer_create_with_ancestors(*ptr, &RNA_Library, archive_library, *r_ptr);
1591 return true;
1592}
1593
1594static PointerRNA rna_Library_parent_get(PointerRNA *ptr)
1595{
1596 Library *lib = ptr->data_as<Library>();
1597 Library *parent = lib->runtime->parent;
1598 return RNA_id_pointer_create(reinterpret_cast<ID *>(parent));
1599}
1600
1601static void rna_Library_reload(Library *lib, bContext *C, ReportList *reports)
1602{
1603# ifdef WITH_PYTHON
1605# endif
1606
1607 WM_lib_reload(lib, C, reports);
1608
1609# ifdef WITH_PYTHON
1611# endif
1612}
1613
1614#else
1615
1617{
1618 StructRNA *srna;
1619 PropertyRNA *prop;
1620
1621 /* this is struct is used for holding the virtual
1622 * PropertyRNA's for ID properties */
1623 srna = RNA_def_struct(brna, "PropertyGroupItem", nullptr);
1624 RNA_def_struct_sdna(srna, "IDProperty");
1626 srna, "ID Property", "Property that stores arbitrary, user defined properties");
1627
1628 /* IDP_STRING */
1629 prop = RNA_def_property(srna, "string", PROP_STRING, PROP_NONE);
1631
1632 /* IDP_INT */
1633 prop = RNA_def_property(srna, "int", PROP_INT, PROP_NONE);
1635
1636 prop = RNA_def_property(srna, "int_array", PROP_INT, PROP_NONE);
1638 RNA_def_property_array(prop, 1);
1639
1640 /* IDP_FLOAT */
1641 prop = RNA_def_property(srna, "float", PROP_FLOAT, PROP_NONE);
1643
1644 prop = RNA_def_property(srna, "float_array", PROP_FLOAT, PROP_NONE);
1646 RNA_def_property_array(prop, 1);
1647
1648 /* IDP_DOUBLE */
1649 prop = RNA_def_property(srna, "double", PROP_FLOAT, PROP_NONE);
1651
1652 prop = RNA_def_property(srna, "double_array", PROP_FLOAT, PROP_NONE);
1654 RNA_def_property_array(prop, 1);
1655
1656 /* IDP_BOOLEAN */
1657 prop = RNA_def_property(srna, "bool", PROP_BOOLEAN, PROP_NONE);
1659
1660 prop = RNA_def_property(srna, "bool_array", PROP_BOOLEAN, PROP_NONE);
1662 RNA_def_property_array(prop, 1);
1663
1664 /* IDP_ENUM */
1665 prop = RNA_def_property(srna, "enum", PROP_ENUM, PROP_NONE);
1668
1669 /* IDP_GROUP */
1670 prop = RNA_def_property(srna, "group", PROP_POINTER, PROP_NONE);
1673 RNA_def_property_struct_type(prop, "PropertyGroup");
1674
1675 prop = RNA_def_property(srna, "collection", PROP_COLLECTION, PROP_NONE);
1677 RNA_def_property_struct_type(prop, "PropertyGroup");
1678
1679 prop = RNA_def_property(srna, "idp_array", PROP_COLLECTION, PROP_NONE);
1680 RNA_def_property_struct_type(prop, "PropertyGroup");
1682 "rna_IDPArray_begin",
1683 "rna_iterator_array_next",
1684 "rna_iterator_array_end",
1685 "rna_iterator_array_get",
1686 "rna_IDPArray_length",
1687 nullptr,
1688 nullptr,
1689 nullptr);
1691
1692/* never tested, maybe its useful to have this? */
1693# if 0
1694 prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
1697 RNA_def_property_ui_text(prop, "Name", "Unique name used in the code and scripting");
1698 RNA_def_struct_name_property(srna, prop);
1699# endif
1700
1701 /* IDP_ID */
1702 prop = RNA_def_property(srna, "id", PROP_POINTER, PROP_NONE);
1704 RNA_def_property_struct_type(prop, "ID");
1705
1706 /* ID property groups > level 0, since level 0 group is merged
1707 * with native RNA properties. the builtin_properties will take
1708 * care of the properties here */
1709 srna = RNA_def_struct(brna, "PropertyGroup", nullptr);
1710 RNA_def_struct_sdna(srna, "IDPropertyGroup");
1711 RNA_def_struct_ui_text(srna, "ID Property Group", "Group of ID properties");
1712 /* For property groups, both 'user-defined' and system-defined properties are the same.
1713 * The user-defined access is kept to allow 'dict-type' subscripting in python. */
1714 RNA_def_struct_idprops_func(srna, "rna_PropertyGroup_idprops");
1715 RNA_def_struct_system_idprops_func(srna, "rna_PropertyGroup_idprops");
1717 srna, "rna_PropertyGroup_register", "rna_PropertyGroup_unregister", nullptr);
1718 RNA_def_struct_refine_func(srna, "rna_PropertyGroup_refine");
1719
1720 /* important so python types can have their name used in list views
1721 * however this isn't perfect because it overrides how python would set the name
1722 * when we only really want this so RNA_def_struct_name_property() is set to something useful */
1723 prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
1725 // RNA_def_property_clear_flag(prop, PROP_EDITABLE);
1726 RNA_def_property_ui_text(prop, "Name", "Unique name used in the code and scripting");
1727 RNA_def_struct_name_property(srna, prop);
1728}
1729
1731{
1732 StructRNA *srna;
1733 FunctionRNA *func;
1734 PropertyRNA *parm;
1735
1736 /* For mesh/meta-ball/curve materials. */
1737 srna = RNA_def_struct(brna, "IDMaterials", nullptr);
1738 RNA_def_struct_sdna(srna, "ID");
1739 RNA_def_struct_ui_text(srna, "ID Materials", "Collection of materials");
1740
1741 func = RNA_def_function(srna, "append", "rna_IDMaterials_append_id");
1743 RNA_def_function_ui_description(func, "Add a new material to the data-block");
1744 parm = RNA_def_pointer(func, "material", "Material", "", "Material to add");
1746
1747 func = RNA_def_function(srna, "pop", "rna_IDMaterials_pop_id");
1749 RNA_def_function_ui_description(func, "Remove a material from the data-block");
1750 parm = RNA_def_int(
1751 func, "index", -1, -MAXMAT, MAXMAT, "", "Index of material to remove", 0, MAXMAT);
1752 parm = RNA_def_pointer(func, "material", "Material", "", "Material to remove");
1753 RNA_def_function_return(func, parm);
1754
1755 func = RNA_def_function(srna, "clear", "rna_IDMaterials_clear_id");
1757 RNA_def_function_ui_description(func, "Remove all materials from the data-block");
1758}
1759
1761{
1762 StructRNA *srna;
1763 FunctionRNA *func;
1764 PropertyRNA *prop;
1765
1766 srna = RNA_def_struct(brna, "ImagePreview", nullptr);
1767 RNA_def_struct_sdna(srna, "PreviewImage");
1768 RNA_def_struct_ui_text(srna, "Image Preview", "Preview image and icon");
1769
1770 prop = RNA_def_property(srna, "is_image_custom", PROP_BOOLEAN, PROP_NONE);
1771 RNA_def_property_boolean_sdna(prop, nullptr, "flag[ICON_SIZE_PREVIEW]", PRV_USER_EDITED);
1772 RNA_def_property_boolean_funcs(prop, nullptr, "rna_ImagePreview_is_image_custom_set");
1774 "Custom Image",
1775 "True if this preview image has been modified by py script, "
1776 "and is no more auto-generated by Blender");
1777
1778 prop = RNA_def_int_vector(
1779 srna, "image_size", 2, nullptr, 0, 0, "Image Size", "Width and height in pixels", 0, 0);
1782 prop, "rna_ImagePreview_image_size_get", "rna_ImagePreview_image_size_set", nullptr);
1783
1784 prop = RNA_def_property(srna, "image_pixels", PROP_INT, PROP_NONE);
1786 RNA_def_property_multi_array(prop, 1, nullptr);
1787 RNA_def_property_ui_text(prop, "Image Pixels", "Image pixels, as bytes (always 32-bit RGBA)");
1788 RNA_def_property_dynamic_array_funcs(prop, "rna_ImagePreview_image_pixels_get_length");
1790 prop, "rna_ImagePreview_image_pixels_get", "rna_ImagePreview_image_pixels_set", nullptr);
1791
1792 prop = RNA_def_property(srna, "image_pixels_float", PROP_FLOAT, PROP_NONE);
1794 RNA_def_property_multi_array(prop, 1, nullptr);
1796 prop, "Float Image Pixels", "Image pixels components, as floats (RGBA concatenated values)");
1797 RNA_def_property_dynamic_array_funcs(prop, "rna_ImagePreview_image_pixels_float_get_length");
1799 "rna_ImagePreview_image_pixels_float_get",
1800 "rna_ImagePreview_image_pixels_float_set",
1801 nullptr);
1802
1803 prop = RNA_def_property(srna, "is_icon_custom", PROP_BOOLEAN, PROP_NONE);
1804 RNA_def_property_boolean_sdna(prop, nullptr, "flag[ICON_SIZE_ICON]", PRV_USER_EDITED);
1805 RNA_def_property_boolean_funcs(prop, nullptr, "rna_ImagePreview_is_icon_custom_set");
1807 "Custom Icon",
1808 "True if this preview icon has been modified by py script, "
1809 "and is no more auto-generated by Blender");
1810
1811 prop = RNA_def_int_vector(
1812 srna, "icon_size", 2, nullptr, 0, 0, "Icon Size", "Width and height in pixels", 0, 0);
1815 prop, "rna_ImagePreview_icon_size_get", "rna_ImagePreview_icon_size_set", nullptr);
1816
1817 prop = RNA_def_property(srna, "icon_pixels", PROP_INT, PROP_NONE);
1819 RNA_def_property_multi_array(prop, 1, nullptr);
1820 RNA_def_property_ui_text(prop, "Icon Pixels", "Icon pixels, as bytes (always 32-bit RGBA)");
1821 RNA_def_property_dynamic_array_funcs(prop, "rna_ImagePreview_icon_pixels_get_length");
1823 prop, "rna_ImagePreview_icon_pixels_get", "rna_ImagePreview_icon_pixels_set", nullptr);
1824
1825 prop = RNA_def_property(srna, "icon_pixels_float", PROP_FLOAT, PROP_NONE);
1827 RNA_def_property_multi_array(prop, 1, nullptr);
1829 prop, "Float Icon Pixels", "Icon pixels components, as floats (RGBA concatenated values)");
1830 RNA_def_property_dynamic_array_funcs(prop, "rna_ImagePreview_icon_pixels_float_get_length");
1832 "rna_ImagePreview_icon_pixels_float_get",
1833 "rna_ImagePreview_icon_pixels_float_set",
1834 nullptr);
1835
1836 prop = RNA_def_int(srna,
1837 "icon_id",
1838 0,
1839 INT_MIN,
1840 INT_MAX,
1841 "Icon ID",
1842 "Unique integer identifying this preview as an icon (zero means invalid)",
1843 INT_MIN,
1844 INT_MAX);
1846 RNA_def_property_int_funcs(prop, "rna_ImagePreview_icon_id_get", nullptr, nullptr);
1847
1848 func = RNA_def_function(srna, "reload", "rna_ImagePreview_icon_reload");
1849 RNA_def_function_ui_description(func, "Reload the preview from its source path");
1850}
1851
1853{
1854 StructRNA *srna;
1855 PropertyRNA *prop;
1856
1857 static const EnumPropertyItem override_library_property_flag_items[] = {
1859 "MANDATORY",
1860 0,
1861 "Mandatory",
1862 "For templates, prevents the user from removing predefined operation (NOT USED)"},
1864 "LOCKED",
1865 0,
1866 "Locked",
1867 "Prevents the user from modifying that override operation (NOT USED)"},
1869 "IDPOINTER_MATCH_REFERENCE",
1870 0,
1871 "Match Reference",
1872 "The ID pointer overridden by this operation is expected to match the reference hierarchy"},
1874 "IDPOINTER_ITEM_USE_ID",
1875 0,
1876 "ID Item Use ID Pointer",
1877 "RNA collections of IDs only, the reference to the item also uses the ID pointer itself, "
1878 "not only its name"},
1879 {0, nullptr, 0, nullptr, nullptr},
1880 };
1881
1882 srna = RNA_def_struct(brna, "IDOverrideLibraryPropertyOperation", nullptr);
1884 "ID Library Override Property Operation",
1885 "Description of an override operation over an overridden property");
1886
1887 prop = RNA_def_enum(srna,
1888 "operation",
1891 "Operation",
1892 "What override operation is performed");
1893 RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* For now. */
1894
1895 prop = RNA_def_enum_flag(
1896 srna, "flag", override_library_property_flag_items, 0, "Flags", "Status flags");
1897 RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* For now. */
1898
1899 prop = RNA_def_string(srna,
1900 "subitem_reference_name",
1901 nullptr,
1902 INT_MAX,
1903 "Subitem Reference Name",
1904 "Used to handle changes into collection");
1905 RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* For now. */
1907 "rna_ID_override_library_property_operation_refname_get",
1908 "rna_ID_override_library_property_operation_refname_length",
1909 nullptr);
1910
1911 prop = RNA_def_string(srna,
1912 "subitem_local_name",
1913 nullptr,
1914 INT_MAX,
1915 "Subitem Local Name",
1916 "Used to handle changes into collection");
1917 RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* For now. */
1919 "rna_ID_override_library_property_operation_locname_get",
1920 "rna_ID_override_library_property_operation_locname_length",
1921 nullptr);
1922
1923 prop = RNA_def_pointer(srna,
1924 "subitem_reference_id",
1925 "ID",
1926 "Subitem Reference ID",
1927 "Collection of IDs only, used to disambiguate between potential IDs with "
1928 "same name from different libraries");
1929 RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* For now. */
1930
1931 prop = RNA_def_pointer(srna,
1932 "subitem_local_id",
1933 "ID",
1934 "Subitem Local ID",
1935 "Collection of IDs only, used to disambiguate between potential IDs with "
1936 "same name from different libraries");
1937 RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* For now. */
1938
1939 prop = RNA_def_int(srna,
1940 "subitem_reference_index",
1941 -1,
1942 -1,
1943 INT_MAX,
1944 "Subitem Reference Index",
1945 "Used to handle changes into collection",
1946 -1,
1947 INT_MAX);
1948 RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* For now. */
1949
1950 prop = RNA_def_int(srna,
1951 "subitem_local_index",
1952 -1,
1953 -1,
1954 INT_MAX,
1955 "Subitem Local Index",
1956 "Used to handle changes into collection",
1957 -1,
1958 INT_MAX);
1959 RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* For now. */
1960}
1961
1963{
1964 StructRNA *srna;
1965 FunctionRNA *func;
1966 PropertyRNA *parm;
1967
1968 RNA_def_property_srna(cprop, "IDOverrideLibraryPropertyOperations");
1969 srna = RNA_def_struct(brna, "IDOverrideLibraryPropertyOperations", nullptr);
1970 RNA_def_struct_sdna(srna, "IDOverrideLibraryProperty");
1971 RNA_def_struct_ui_text(srna, "Override Operations", "Collection of override operations");
1972
1973 /* Add Property */
1974 func = RNA_def_function(srna, "add", "rna_ID_override_library_property_operations_add");
1975 RNA_def_function_ui_description(func, "Add a new operation");
1977 parm = RNA_def_enum(func,
1978 "operation",
1981 "Operation",
1982 "What override operation is performed");
1984 parm = RNA_def_boolean(
1985 func,
1986 "use_id",
1987 false,
1988 "Use ID Pointer Subitem",
1989 "Whether the found or created liboverride operation should use ID pointers or not");
1990 parm = RNA_def_string(func,
1991 "subitem_reference_name",
1992 nullptr,
1993 INT_MAX,
1994 "Subitem Reference Name",
1995 "Used to handle insertions or ID replacements into collection");
1996 parm = RNA_def_string(func,
1997 "subitem_local_name",
1998 nullptr,
1999 INT_MAX,
2000 "Subitem Local Name",
2001 "Used to handle insertions or ID replacements into collection");
2002 parm = RNA_def_pointer(func,
2003 "subitem_reference_id",
2004 "ID",
2005 "Subitem Reference ID",
2006 "Used to handle ID replacements into collection");
2007 parm = RNA_def_pointer(func,
2008 "subitem_local_id",
2009 "ID",
2010 "Subitem Local ID",
2011 "Used to handle ID replacements into collection");
2012 parm = RNA_def_int(func,
2013 "subitem_reference_index",
2014 -1,
2015 -1,
2016 INT_MAX,
2017 "Subitem Reference Index",
2018 "Used to handle insertions or ID replacements into collection",
2019 -1,
2020 INT_MAX);
2021 parm = RNA_def_int(func,
2022 "subitem_local_index",
2023 -1,
2024 -1,
2025 INT_MAX,
2026 "Subitem Local Index",
2027 "Used to handle insertions or ID replacements into collection",
2028 -1,
2029 INT_MAX);
2030 parm = RNA_def_pointer(func,
2031 "property",
2032 "IDOverrideLibraryPropertyOperation",
2033 "New Operation",
2034 "Created operation");
2035 RNA_def_function_return(func, parm);
2036
2037 func = RNA_def_function(srna, "remove", "rna_ID_override_library_property_operations_remove");
2038 RNA_def_function_ui_description(func, "Remove and delete an operation");
2040 parm = RNA_def_pointer(func,
2041 "operation",
2042 "IDOverrideLibraryPropertyOperation",
2043 "Operation",
2044 "Override operation to be deleted");
2046}
2047
2049{
2050 StructRNA *srna;
2051 PropertyRNA *prop;
2052
2053 srna = RNA_def_struct(brna, "IDOverrideLibraryProperty", nullptr);
2055 srna, "ID Library Override Property", "Description of an overridden property");
2056
2057 /* String pointer, we *should* add get/set/etc.
2058 * But nullptr rna_path would be a nasty bug anyway. */
2059 prop = RNA_def_string(srna,
2060 "rna_path",
2061 nullptr,
2062 INT_MAX,
2063 "RNA Path",
2064 "RNA path leading to that property, from owning ID");
2065 RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* For now. */
2066
2067 prop = RNA_def_collection(srna,
2068 "operations",
2069 "IDOverrideLibraryPropertyOperation",
2070 "Operations",
2071 "List of overriding operations for a property");
2074
2076}
2077
2079{
2080 StructRNA *srna;
2081 FunctionRNA *func;
2082 PropertyRNA *parm;
2083
2084 RNA_def_property_srna(cprop, "IDOverrideLibraryProperties");
2085 srna = RNA_def_struct(brna, "IDOverrideLibraryProperties", nullptr);
2086 RNA_def_struct_sdna(srna, "IDOverrideLibrary");
2087 RNA_def_struct_ui_text(srna, "Override Properties", "Collection of override properties");
2088
2089 /* Add Property */
2090 func = RNA_def_function(srna, "add", "rna_ID_override_library_properties_add");
2092 func, "Add a property to the override library when it doesn't exist yet");
2094 parm = RNA_def_pointer(func,
2095 "property",
2096 "IDOverrideLibraryProperty",
2097 "New Property",
2098 "Newly created override property or existing one");
2099 RNA_def_function_return(func, parm);
2100 parm = RNA_def_string(
2101 func, "rna_path", nullptr, 256, "RNA Path", "RNA-Path of the property to add");
2103
2104 func = RNA_def_function(srna, "remove", "rna_ID_override_library_properties_remove");
2105 RNA_def_function_ui_description(func, "Remove and delete a property");
2107 parm = RNA_def_pointer(func,
2108 "property",
2109 "IDOverrideLibraryProperty",
2110 "Property",
2111 "Override property to be deleted");
2113}
2114
2116{
2117 StructRNA *srna;
2118 PropertyRNA *prop;
2119 FunctionRNA *func;
2120 PropertyRNA *parm;
2121
2122 srna = RNA_def_struct(brna, "IDOverrideLibrary", nullptr);
2124 srna, "ID Library Override", "Struct gathering all data needed by overridden linked IDs");
2125
2126 prop = RNA_def_pointer(
2127 srna, "reference", "ID", "Reference ID", "Linked ID used as reference by this override");
2129
2131 srna,
2132 "hierarchy_root",
2133 "ID",
2134 "Hierarchy Root ID",
2135 "Library override ID used as root of the override hierarchy this ID is a member of");
2136
2137 prop = RNA_def_boolean(srna,
2138 "is_in_hierarchy",
2139 true,
2140 "Is In Hierarchy",
2141 "Whether this library override is defined as part of a library "
2142 "hierarchy, or as a single, isolated and autonomous override");
2146
2147 prop = RNA_def_boolean(srna,
2148 "is_system_override",
2149 false,
2150 "Is System Override",
2151 "Whether this library override exists only for the override hierarchy, "
2152 "or if it is actually editable by the user");
2156
2157 prop = RNA_def_collection(srna,
2158 "properties",
2159 "IDOverrideLibraryProperty",
2160 "Properties",
2161 "List of overridden properties");
2164
2165 /* Update function. */
2166 func = RNA_def_function(srna, "operations_update", "rna_ID_override_library_operations_update");
2169 "Update the library override operations based on the "
2170 "differences between this override ID and its reference");
2171
2172 func = RNA_def_function(srna, "reset", "rna_ID_override_library_reset");
2174 "Reset this override to match again its linked reference ID");
2177 func,
2178 "do_hierarchy",
2179 true,
2180 "",
2181 "Also reset all the dependencies of this override to match their reference linked IDs");
2182 RNA_def_boolean(func,
2183 "set_system_override",
2184 false,
2185 "",
2186 "Reset all user-editable overrides as (non-editable) system overrides");
2187
2188 func = RNA_def_function(srna, "destroy", "rna_ID_override_library_destroy");
2190 func, "Delete this override ID and remap its usages to its linked reference ID instead");
2192 RNA_def_boolean(func,
2193 "do_hierarchy",
2194 true,
2195 "",
2196 "Also delete all the dependencies of this override and remap their usages to "
2197 "their reference linked IDs");
2198
2199 func = RNA_def_function(srna, "resync", "rna_ID_override_library_resync");
2201 func, "Resync the data-block and its sub-hierarchy, or the whole hierarchy if requested");
2203 parm = RNA_def_boolean(
2204 func, "success", false, "Success", "Whether the resync process was successful or not");
2205 RNA_def_function_return(func, parm);
2206 parm = RNA_def_pointer(
2207 func,
2208 "scene",
2209 "Scene",
2210 "",
2211 "The scene to operate in (for contextual things like keeping active object active, ensuring "
2212 "all overridden objects remain instantiated, etc.)");
2214 parm = RNA_def_pointer(func,
2215 "view_layer",
2216 "ViewLayer",
2217 "",
2218 "The view layer to operate in (same usage as the ``scene`` data, in case "
2219 "it is not provided the scene's collection will be used instead)");
2220 parm = RNA_def_pointer(
2221 func,
2222 "residual_storage",
2223 "Collection",
2224 "",
2225 "Collection where to store objects that are instantiated in any other collection anymore "
2226 "(garbage collection, will be created if needed and none is provided)");
2227 RNA_def_boolean(func,
2228 "do_hierarchy_enforce",
2229 false,
2230 "",
2231 "Enforce restoring the dependency hierarchy between data-blocks to match the "
2232 "one from the reference linked hierarchy (WARNING: if some ID pointers have "
2233 "been purposely overridden, these will be reset to their default value)");
2235 func,
2236 "do_whole_hierarchy",
2237 false,
2238 "",
2239 "Resync the whole hierarchy this data-block belongs to, not only its own sub-hierarchy");
2240
2242}
2243
2244static void rna_def_ID(BlenderRNA *brna)
2245{
2246 StructRNA *srna;
2247 FunctionRNA *func;
2248 PropertyRNA *prop, *parm;
2249
2250 static const EnumPropertyItem update_flag_items[] = {
2251 {ID_RECALC_TRANSFORM, "OBJECT", 0, "Object", ""},
2252 {ID_RECALC_GEOMETRY, "DATA", 0, "Data", ""},
2253 {ID_RECALC_ANIMATION, "TIME", 0, "Time", ""},
2254 {0, nullptr, 0, nullptr, nullptr},
2255 };
2256
2257 static const EnumPropertyItem rename_mode_items[] = {
2259 "NEVER",
2260 0,
2261 "Never Rename",
2262 "Never rename an existing ID whose name would conflict, the currently renamed ID will get "
2263 "a numeric suffix appended to its new name"},
2265 "ALWAYS",
2266 0,
2267 "Always Rename",
2268 "Always rename an existing ID whose name would conflict, ensuring that the currently "
2269 "renamed ID will get requested name"},
2271 "SAME_ROOT",
2272 0,
2273 "Rename If Same Root",
2274 "Only rename an existing ID whose name would conflict if its name root (everything besides "
2275 "the numerical suffix) is the same as the existing name of the currently renamed ID"},
2276 {0, nullptr, 0, nullptr, nullptr},
2277 };
2278
2279 static const EnumPropertyItem rename_result_items[] = {
2281 "UNCHANGED",
2282 0,
2283 "Unchanged",
2284 "The ID was not renamed, e.g. because it is already named as requested"},
2286 "UNCHANGED_COLLISION",
2287 0,
2288 "Unchanged Due to Collision",
2289 "The ID was not renamed, because requested name would have collided with another existing "
2290 "ID's name, and the automatically adjusted name was the same as the current ID's name"},
2292 "RENAMED_NO_COLLISION",
2293 0,
2294 "Renamed Without Collision",
2295 "The ID was renamed as requested, without creating any name collision"},
2297 "RENAMED_COLLISION_ADJUSTED",
2298 0,
2299 "Renamed With Collision",
2300 "The ID was renamed with adjustment of the requested name, to avoid a name collision"},
2302 "RENAMED_COLLISION_FORCED",
2303 0,
2304 "Renamed Enforced With Collision",
2305 "The ID was renamed as requested, also renaming another ID to avoid a name collision"},
2306 {0, nullptr, 0, nullptr, nullptr},
2307 };
2308
2309 srna = RNA_def_struct(brna, "ID", nullptr);
2311 srna,
2312 "ID",
2313 "Base type for data-blocks, defining a unique name, linking from other libraries "
2314 "and garbage collection");
2316 RNA_def_struct_refine_func(srna, "rna_ID_refine");
2317 RNA_def_struct_idprops_func(srna, "rna_ID_idprops");
2318 RNA_def_struct_system_idprops_func(srna, "rna_ID_system_idprops");
2319
2320 prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
2322 prop, "Name", "Unique data-block ID name (within a same type and library)");
2323 RNA_def_property_string_funcs(prop, "rna_ID_name_get", "rna_ID_name_length", "rna_ID_name_set");
2325 RNA_def_property_editable_func(prop, "rna_ID_name_editable");
2326 RNA_def_property_update(prop, NC_ID | NA_RENAME, nullptr);
2328 RNA_def_struct_name_property(srna, prop);
2329
2330 prop = RNA_def_property(srna, "name_full", PROP_STRING, PROP_NONE);
2332 prop, "Full Name", "Unique data-block ID name, including library one if any");
2333 RNA_def_property_string_funcs(prop, "rna_ID_name_full_get", "rna_ID_name_full_length", nullptr);
2336
2337 prop = RNA_def_property(srna, "id_type", PROP_ENUM, PROP_NONE);
2338 RNA_def_property_ui_text(prop, "Type", "Type identifier of this data-block");
2341 RNA_def_property_enum_funcs(prop, "rna_ID_type_get", nullptr, nullptr);
2344
2345 prop = RNA_def_property(srna, "session_uid", PROP_INT, PROP_NONE);
2347 prop,
2348 "Session UID",
2349 "A session-wide unique identifier for the data block that remains the "
2350 "same across renames and internal reallocations, unchanged when reloading the file");
2352
2353 prop = RNA_def_property(srna, "is_evaluated", PROP_BOOLEAN, PROP_NONE);
2355 prop,
2356 "Is Evaluated",
2357 "Whether this ID is runtime-only, evaluated data-block, or actual data from .blend file");
2358 RNA_def_property_boolean_funcs(prop, "rna_ID_is_evaluated_get", nullptr);
2360
2361 prop = RNA_def_property(srna, "original", PROP_POINTER, PROP_NONE);
2362 RNA_def_property_struct_type(prop, "ID");
2364 prop,
2365 "Original ID",
2366 "Actual data-block from .blend file (Main database) that generated that evaluated one");
2367 RNA_def_property_pointer_funcs(prop, "rna_ID_original_get", nullptr, nullptr, nullptr);
2371
2372 prop = RNA_def_property(srna, "users", PROP_INT, PROP_UNSIGNED);
2373 RNA_def_property_int_sdna(prop, nullptr, "us");
2375 RNA_def_property_ui_text(prop, "Users", "Number of times this data-block is referenced");
2376
2377 prop = RNA_def_property(srna, "use_fake_user", PROP_BOOLEAN, PROP_NONE);
2378 RNA_def_property_boolean_sdna(prop, nullptr, "flag", ID_FLAG_FAKEUSER);
2379 RNA_def_property_ui_text(prop, "Fake User", "Save this data-block even if it has no users");
2380 RNA_def_property_ui_icon(prop, ICON_FAKE_USER_OFF, true);
2381 RNA_def_property_boolean_funcs(prop, nullptr, "rna_ID_fake_user_set");
2382
2383 prop = RNA_def_property(srna, "use_extra_user", PROP_BOOLEAN, PROP_NONE);
2384 RNA_def_property_boolean_sdna(prop, nullptr, "tag", ID_TAG_EXTRAUSER);
2386 prop,
2387 "Extra User",
2388 "Indicates whether an extra user is set or not (mainly for internal/debug usages)");
2389 RNA_def_property_boolean_funcs(prop, nullptr, "rna_ID_extra_user_set");
2390
2391 prop = RNA_def_property(srna, "is_embedded_data", PROP_BOOLEAN, PROP_NONE);
2395 prop,
2396 "Embedded Data",
2397 "This data-block is not an independent one, but is actually a sub-data of another ID "
2398 "(typical example: root node trees or master collections)");
2399
2400 prop = RNA_def_property(srna, "is_linked_packed", PROP_BOOLEAN, PROP_NONE);
2404 prop, "Linked Packed", "This data-block is linked and packed into the .blend file");
2405
2406 prop = RNA_def_property(srna, "is_missing", PROP_BOOLEAN, PROP_NONE);
2407 RNA_def_property_boolean_sdna(prop, nullptr, "tag", ID_TAG_MISSING);
2410 "Missing Data",
2411 "This data-block is a place-holder for missing linked data (i.e. it is "
2412 "[an override of] a linked data that could not be found anymore)");
2413
2414 prop = RNA_def_property(srna, "is_runtime_data", PROP_BOOLEAN, PROP_NONE);
2415 RNA_def_property_boolean_sdna(prop, nullptr, "tag", ID_TAG_RUNTIME);
2416 RNA_def_property_editable_func(prop, "rna_ID_is_runtime_editable");
2417 RNA_def_property_boolean_funcs(prop, "rna_ID_is_runtime_get", nullptr);
2420 "Runtime Data",
2421 "This data-block is runtime data, i.e. it won't be saved in .blend "
2422 "file. Note that e.g. evaluated IDs are always runtime, so this value "
2423 "is only editable for data-blocks in Main data-base.");
2424
2425 prop = RNA_def_property(srna, "is_editable", PROP_BOOLEAN, PROP_NONE);
2426 RNA_def_property_boolean_funcs(prop, "rna_ID_is_editable_get", nullptr);
2429 "Editable",
2430 "This data-block is editable in the user interface. Linked data-blocks "
2431 "are not editable, except if they were loaded as editable assets.");
2432
2433 prop = RNA_def_property(srna, "tag", PROP_BOOLEAN, PROP_NONE);
2434 RNA_def_property_boolean_sdna(prop, nullptr, "tag", ID_TAG_DOIT);
2437 "Tag",
2438 "Tools can use this to tag data for their own purposes "
2439 "(initial state is undefined)");
2440
2441 prop = RNA_def_property(srna, "is_library_indirect", PROP_BOOLEAN, PROP_NONE);
2442 RNA_def_property_boolean_sdna(prop, nullptr, "tag", ID_TAG_INDIRECT);
2444 RNA_def_property_ui_text(prop, "Is Indirect", "Is this ID block linked indirectly");
2445
2446 prop = RNA_def_property(srna, "library", PROP_POINTER, PROP_NONE);
2447 RNA_def_property_pointer_sdna(prop, nullptr, "lib");
2450 RNA_def_property_ui_text(prop, "Library", "Library file the data-block is linked from");
2451
2452 prop = RNA_def_pointer(srna,
2453 "library_weak_reference",
2454 "LibraryWeakReference",
2455 "Library Weak Reference",
2456 "Weak reference to a data-block in another library .blend file (used to "
2457 "re-use already appended data instead of appending new copies)");
2460
2461 prop = RNA_def_property(srna, "asset_data", PROP_POINTER, PROP_NONE);
2463 RNA_def_property_pointer_funcs(prop, nullptr, "rna_ID_asset_data_set", nullptr, nullptr);
2465 RNA_def_property_ui_text(prop, "Asset Data", "Additional data for an asset data-block");
2466
2467 prop = RNA_def_pointer(
2468 srna, "override_library", "IDOverrideLibrary", "Library Override", "Library override data");
2472
2473 prop = RNA_def_pointer(srna,
2474 "preview",
2475 "ImagePreview",
2476 "Preview",
2477 "Preview image and icon of this data-block (always None if not supported "
2478 "for this type of data)");
2481 RNA_def_property_pointer_funcs(prop, "rna_IDPreview_get", nullptr, nullptr, nullptr);
2482
2483 /* functions */
2484 func = RNA_def_function(srna, "rename", "rna_ID_rename");
2486 func, "More refined handling in case the new name collides with another ID's name");
2488 parm = RNA_def_string(func,
2489 "name",
2490 nullptr,
2491 MAX_NAME,
2492 "",
2493 "New name to rename the ID to, if empty will re-use the current ID name");
2495 parm = RNA_def_enum(func,
2496 "mode",
2497 rename_mode_items,
2499 "",
2500 "How to handle name collision, in case the requested new name is already "
2501 "used by another ID of the same type");
2502 parm = RNA_def_enum(func,
2503 "id_rename_result",
2504 rename_result_items,
2506 "",
2507 "How did the renaming of the data-block went on");
2508 RNA_def_function_return(func, parm);
2509
2510 func = RNA_def_function(srna, "evaluated_get", "rna_ID_evaluated_get");
2512 func,
2513 "Get corresponding evaluated ID from the given dependency graph. Note that this does not "
2514 "ensure the dependency graph is fully evaluated, it just returns the result of the last "
2515 "evaluation.");
2516 parm = RNA_def_pointer(
2517 func, "depsgraph", "Depsgraph", "", "Dependency graph to perform lookup in");
2519 parm = RNA_def_pointer(func, "id", "ID", "", "New copy of the ID");
2520 RNA_def_function_return(func, parm);
2521
2522 func = RNA_def_function(srna, "copy", "rna_ID_copy");
2524 func,
2525 "Create a copy of this data-block (not supported for all data-blocks). "
2526 "The result is added to the Blend-File Data (Main database), with all references to other "
2527 "data-blocks ensured to be from within the same Blend-File Data.");
2529 parm = RNA_def_pointer(func, "id", "ID", "", "New copy of the ID");
2530 RNA_def_function_return(func, parm);
2531
2532 func = RNA_def_function(srna, "asset_mark", "rna_ID_asset_mark");
2534 func,
2535 "Enable easier reuse of the data-block through the Asset Browser, with the help of "
2536 "customizable metadata (like previews, descriptions and tags)");
2537
2538 func = RNA_def_function(srna, "asset_clear", "rna_ID_asset_clear");
2540 func,
2541 "Delete all asset metadata and turn the asset data-block back into a normal data-block");
2542
2543 func = RNA_def_function(srna, "asset_generate_preview", "rna_ID_asset_generate_preview");
2545 func, "Generate preview image (might be scheduled in a background thread)");
2547
2548 func = RNA_def_function(srna, "override_create", "rna_ID_override_create");
2550 "Create an overridden local copy of this linked data-block (not "
2551 "supported for all data-blocks)");
2553 parm = RNA_def_pointer(func, "id", "ID", "", "New overridden local copy of the ID");
2554 RNA_def_function_return(func, parm);
2555 RNA_def_boolean(func,
2556 "remap_local_usages",
2557 false,
2558 "",
2559 "Whether local usages of the linked ID should be remapped to the new "
2560 "library override of it");
2561
2562 func = RNA_def_function(srna, "override_hierarchy_create", "rna_ID_override_hierarchy_create");
2564 func,
2565 "Create an overridden local copy of this linked data-block, and most of its dependencies "
2566 "when it is a Collection or and Object");
2568 parm = RNA_def_pointer(func, "id", "ID", "", "New overridden local copy of the root ID");
2569 RNA_def_function_return(func, parm);
2570 parm = RNA_def_pointer(
2571 func, "scene", "Scene", "", "In which scene the new overrides should be instantiated");
2573 parm = RNA_def_pointer(func,
2574 "view_layer",
2575 "ViewLayer",
2576 "",
2577 "In which view layer the new overrides should be instantiated");
2579 RNA_def_pointer(func,
2580 "reference",
2581 "ID",
2582 "",
2583 "Another ID (usually an Object or Collection) used as a hint to decide where to "
2584 "instantiate the new overrides");
2585 RNA_def_boolean(func,
2586 "do_fully_editable",
2587 false,
2588 "",
2589 "Make all library overrides generated by this call fully editable by the user "
2590 "(none will be 'system overrides')");
2591
2592 func = RNA_def_function(srna, "user_clear", "rna_ID_user_clear");
2594 "Clear the user count of a data-block so its not saved, "
2595 "on reload the data will be removed");
2596
2597 func = RNA_def_function(srna, "user_remap", "rna_ID_user_remap");
2599 func, "Replace all usage in the .blend file of this ID by new given one");
2601 parm = RNA_def_pointer(func, "new_id", "ID", "", "New ID to use");
2603
2604 func = RNA_def_function(srna, "make_local", "rna_ID_make_local");
2606 func,
2607 "Make this data-block local, return local one "
2608 "(may be a copy of the original, in case it is also indirectly used)");
2610 parm = RNA_def_boolean(func, "clear_proxy", true, "", "Deprecated, has no effect");
2611 parm = RNA_def_boolean(func,
2612 "clear_liboverride",
2613 false,
2614 "",
2615 "Remove potential library override data from the newly made local data");
2617 func,
2618 "clear_asset_data",
2619 true,
2620 "",
2621 "Remove potential asset metadata so the newly local data-block is not treated as asset "
2622 "data-block and won't show up in asset libraries");
2623 parm = RNA_def_pointer(func, "id", "ID", "", "This ID, or the new ID if it was copied");
2624 RNA_def_function_return(func, parm);
2625
2626 func = RNA_def_function(srna, "user_of_id", "BKE_library_ID_use_ID");
2628 "Count the number of times that ID uses/references given one");
2629 parm = RNA_def_pointer(func, "id", "ID", "", "ID to count usages");
2631 parm = RNA_def_int(func,
2632 "count",
2633 0,
2634 0,
2635 INT_MAX,
2636 "",
2637 "Number of usages/references of given id by current data-block",
2638 0,
2639 INT_MAX);
2640 RNA_def_function_return(func, parm);
2641
2642 func = RNA_def_function(srna, "animation_data_create", "rna_ID_animation_data_create");
2645 func, "Create animation data to this ID, note that not all ID types support this");
2646 parm = RNA_def_pointer(func, "anim_data", "AnimData", "", "New animation data or nullptr");
2647 RNA_def_function_return(func, parm);
2648
2649 func = RNA_def_function(srna, "animation_data_clear", "rna_ID_animation_data_free");
2651 RNA_def_function_ui_description(func, "Clear animation on this ID");
2652
2653 func = RNA_def_function(srna, "update_tag", "rna_ID_update_tag");
2656 "Tag the ID to update its display data, "
2657 "e.g. when calling :class:`bpy.types.Scene.update`");
2658 RNA_def_enum_flag(func, "refresh", update_flag_items, 0, "", "Type of updates to perform");
2659
2660 func = RNA_def_function(srna, "preview_ensure", "BKE_previewimg_id_ensure");
2662 "Ensure that this ID has preview data (if ID type supports it)");
2663 parm = RNA_def_pointer(
2664 func, "preview_image", "ImagePreview", "", "The existing or created preview");
2665 RNA_def_function_return(func, parm);
2666
2667# ifdef WITH_PYTHON
2668 RNA_def_struct_register_funcs(srna, nullptr, nullptr, "rna_ID_instance");
2669# endif
2670}
2671
2672static void rna_def_library(BlenderRNA *brna)
2673{
2674 StructRNA *srna;
2675 FunctionRNA *func;
2676 PropertyRNA *prop;
2677
2678 srna = RNA_def_struct(brna, "Library", "ID");
2679 RNA_def_struct_ui_text(srna, "Library", "External .blend file from which data is linked");
2680 RNA_def_struct_ui_icon(srna, ICON_LIBRARY_DATA_DIRECT);
2681
2682 prop = RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH);
2683 RNA_def_property_string_sdna(prop, nullptr, "filepath");
2685 RNA_def_property_ui_text(prop, "File Path", "Path to the library .blend file");
2686 RNA_def_property_string_funcs(prop, nullptr, nullptr, "rna_Library_filepath_set");
2687
2688 prop = RNA_def_property(srna, "parent", PROP_POINTER, PROP_NONE);
2689 RNA_def_property_pointer_funcs(prop, "rna_Library_parent_get", nullptr, nullptr, nullptr);
2690 RNA_def_property_struct_type(prop, "Library");
2692 RNA_def_property_ui_text(prop, "Parent", "");
2693
2694 prop = RNA_def_property(srna, "packed_file", PROP_POINTER, PROP_NONE);
2695 RNA_def_property_pointer_sdna(prop, nullptr, "packedfile");
2696 RNA_def_property_ui_text(prop, "Packed File", "");
2697
2698 prop = RNA_def_int_vector(srna,
2699 "version",
2700 3,
2701 nullptr,
2702 0,
2703 INT_MAX,
2704 "Version",
2705 "Version of Blender the library .blend was saved with",
2706 0,
2707 INT_MAX);
2708 RNA_def_property_int_funcs(prop, "rna_Library_version_get", nullptr, nullptr);
2711
2712 prop = RNA_def_property(srna, "needs_liboverride_resync", PROP_BOOLEAN, PROP_NONE);
2713 RNA_def_property_boolean_sdna(prop, nullptr, "runtime->tag", LIBRARY_TAG_RESYNC_REQUIRED);
2715 "Library Overrides Need resync",
2716 "True if this library contains library overrides that are linked in "
2717 "current blendfile, and that had to be recursively resynced on load "
2718 "(it is recommended to open and re-save that library blendfile then)");
2719
2720 prop = RNA_def_property(srna, "is_editable", PROP_BOOLEAN, PROP_NONE);
2721 RNA_def_property_boolean_sdna(prop, nullptr, "runtime->tag", LIBRARY_ASSET_EDITABLE);
2724 "Editable",
2725 "Data-blocks in this library are editable despite being linked. "
2726 "Used by brush assets and their dependencies.");
2727
2728 prop = RNA_def_property(srna, "is_archive", PROP_BOOLEAN, PROP_NONE);
2732 "Is Archive",
2733 "This library is an 'archive' storage for packed linked IDs "
2734 "originally linked from its 'archive parent' library.");
2735
2736 prop = RNA_def_property(srna, "archive_parent_library", PROP_POINTER, PROP_NONE);
2737 RNA_def_property_pointer_sdna(prop, nullptr, "archive_parent_library");
2738 RNA_def_property_struct_type(prop, "Library");
2741 "Parent Archive Library",
2742 "Source library from which this archive of packed IDs was generated");
2743
2744 prop = RNA_def_property(srna, "archive_libraries", PROP_COLLECTION, PROP_NONE);
2745 RNA_def_property_struct_type(prop, "Library");
2747 "rna_Library_archive_libraries_begin",
2748 "rna_Library_archive_libraries_next",
2749 nullptr,
2750 "rna_Library_archive_libraries_get",
2751 "rna_Library_archive_libraries_length",
2752 "rna_Library_archive_libraries_lookupint",
2753 nullptr,
2754 nullptr);
2757 prop,
2758 "Archive Libraries",
2759 "Archive libraries of packed IDs, generated (and owned) by this source library");
2760
2761 func = RNA_def_function(srna, "reload", "rna_Library_reload");
2763 RNA_def_function_ui_description(func, "Reload this library and all its linked data-blocks");
2764}
2765
2767{
2768 StructRNA *srna;
2769 PropertyRNA *prop;
2770
2771 srna = RNA_def_struct(brna, "LibraryWeakReference", nullptr);
2773 srna,
2774 "LibraryWeakReference",
2775 "Read-only external reference to a linked data-block and its library file");
2776
2777 prop = RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH);
2778 RNA_def_property_string_sdna(prop, nullptr, "library_filepath");
2780 RNA_def_property_ui_text(prop, "File Path", "Path to the library .blend file");
2781
2782 prop = RNA_def_property(srna, "id_name", PROP_STRING, PROP_FILEPATH);
2783 RNA_def_property_string_sdna(prop, nullptr, "library_id_name");
2785 prop,
2786 "ID name",
2787 "Full ID name in the library .blend file (including the two leading 'id type' chars)");
2788}
2789
2795{
2796 StructRNA *srna;
2797
2798 srna = RNA_def_struct(brna, "IDPropertyWrapPtr", nullptr);
2799 /* For property groups, both 'user-defined' and system-defined properties are the same.
2800 * The user-defined access is kept to allow 'dict-type' subscripting in python. */
2801 RNA_def_struct_idprops_func(srna, "rna_IDPropertyWrapPtr_idprops");
2802 RNA_def_struct_system_idprops_func(srna, "rna_IDPropertyWrapPtr_idprops");
2804}
2805
2807{
2808 StructRNA *srna;
2809
2810 /* built-in unknown type */
2811 srna = RNA_def_struct(brna, "UnknownType", nullptr);
2813 srna, "Unknown Type", "Stub RNA type used for pointers to unknown or internal data");
2814
2815 /* built-in any type */
2816 srna = RNA_def_struct(brna, "AnyType", nullptr);
2817 RNA_def_struct_ui_text(srna, "Any Type", "RNA type used for pointers to any possible data");
2818
2819 rna_def_ID(brna);
2824 rna_def_library(brna);
2827}
2828
2829#endif
AnimData * BKE_animdata_ensure_id(ID *id)
Definition anim_data.cc:97
bool id_can_have_animdata(const ID *id)
Definition anim_data.cc:73
void BKE_animdata_free(ID *id, bool do_id_user)
Definition anim_data.cc:188
#define G_MAIN
int BKE_icon_preview_ensure(struct ID *id, struct PreviewImage *preview)
Definition icons.cc:335
#define IDP_property_array_get(prop)
void BKE_id_newptr_and_tag_clear(ID *id)
Definition lib_id.cc:412
void BKE_id_delete(Main *bmain, void *idv) ATTR_NONNULL()
@ LIB_ID_MAKELOCAL_ASSET_DATA_CLEAR
ID * BKE_id_copy_for_use_in_bmain(Main *bmain, const ID *id)
Definition lib_id.cc:851
IDNewNameMode
void BKE_id_full_name_get(char name[MAX_ID_FULL_NAME], const ID *id, char separator_char)
Definition lib_id.cc:2432
void id_fake_user_set(ID *id)
Definition lib_id.cc:396
IDNewNameResult BKE_id_rename(Main &bmain, ID &id, blender::StringRefNull name, const IDNewNameMode mode=IDNewNameMode::RenameExistingNever)
Definition lib_id.cc:2392
bool BKE_lib_id_make_local(Main *bmain, ID *id, int flags)
Definition lib_id.cc:598
void id_us_ensure_real(ID *id)
Definition lib_id.cc:313
void id_fake_user_clear(ID *id)
Definition lib_id.cc:404
void id_us_clear_real(ID *id)
Definition lib_id.cc:331
void id_us_min(ID *id)
Definition lib_id.cc:366
#define MAX_ID_FULL_NAME
void BKE_main_id_tag_all(Main *mainvar, int tag, bool value)
Definition lib_id.cc:1224
bool BKE_id_is_in_global_main(ID *id)
Definition lib_id.cc:2500
ID * BKE_lib_override_library_create_from_id(Main *bmain, ID *reference_id, bool do_tagged_remap)
void BKE_lib_override_library_property_operation_delete(IDOverrideLibraryProperty *liboverride_property, IDOverrideLibraryPropertyOperation *liboverride_property_operation)
IDOverrideLibraryProperty * BKE_lib_override_library_property_get(IDOverrideLibrary *liboverride, const char *rna_path, bool *r_created)
IDOverrideLibraryPropertyOperation * BKE_lib_override_library_property_operation_get(IDOverrideLibraryProperty *liboverride_property, short operation, const char *subitem_refname, const char *subitem_locname, const std::optional< ID * > &subitem_refid, const std::optional< ID * > &subitem_locid, int subitem_refindex, int subitem_locindex, bool strict, bool *r_strict, bool *r_created)
void BKE_lib_override_library_id_reset(Main *bmain, ID *id_root, bool do_reset_system_override)
bool BKE_lib_override_library_resync(Main *bmain, Scene *scene, ViewLayer *view_layer, ID *id_root, Collection *override_resync_residual_storage, bool do_hierarchy_enforce, BlendFileReadReport *reports)
bool BKE_lib_override_library_create(Main *bmain, Scene *scene, ViewLayer *view_layer, Library *owner_library, ID *id_root_reference, ID *id_hierarchy_root_reference, ID *id_instance_hint, ID **r_id_root_override, const bool do_fully_editable)
void BKE_lib_override_library_id_hierarchy_reset(Main *bmain, ID *id_root, bool do_reset_system_override)
void BKE_lib_override_library_operations_create(Main *bmain, ID *local, int *r_report_flags)
void BKE_lib_override_library_make_local(Main *bmain, ID *id)
void BKE_lib_override_library_delete(Main *bmain, ID *id_root)
void BKE_lib_override_library_property_delete(IDOverrideLibrary *liboverride, IDOverrideLibraryProperty *liboverride_property)
void void BKE_libblock_remap(Main *bmain, void *old_idv, void *new_idv, int remap_flags) ATTR_NONNULL(1
@ ID_REMAP_SKIP_NEVER_NULL_USAGE
@ ID_REMAP_SKIP_INDIRECT_USAGE
void BKE_library_filepath_set(Main *bmain, Library *lib, const char *filepath)
Definition library.cc:229
@ LIBRARY_ASSET_EDITABLE
@ LIBRARY_TAG_RESYNC_REQUIRED
void BKE_main_ensure_invariants(Main &bmain, std::optional< blender::Span< ID * > > modified_ids=std::nullopt)
General operations, lookup, etc. for materials.
void BKE_id_material_clear(Main *bmain, ID *id)
void BKE_id_material_assign(Main *bmain, ID *id, Material *ma, short act)
short * BKE_id_material_len_p(ID *id)
void BKE_id_material_append(Main *bmain, ID *id, Material *ma)
Material * BKE_id_material_pop(Main *bmain, ID *id, int index)
PreviewImage * BKE_previewimg_id_get(const ID *id)
void BKE_previewimg_ensure(PreviewImage *prv, int size)
PreviewImage * BKE_previewimg_id_ensure(ID *id)
void BKE_previewimg_clear_single(PreviewImage *prv, enum eIconSizes size)
void BKE_previewimg_clear(PreviewImage *prv)
void BKE_reportf(ReportList *reports, eReportType type, const char *format,...) ATTR_PRINTF_FORMAT(3
@ RPT_ERROR_INVALID_INPUT
Definition BKE_report.hh:40
@ RPT_DEBUG
Definition BKE_report.hh:34
@ RPT_ERROR
Definition BKE_report.hh:39
void BKE_report(ReportList *reports, eReportType type, const char *message)
Definition report.cc:153
@ FO_EDIT
Definition BKE_vfont.hh:78
bool BKE_vfont_is_builtin(const VFont *vfont)
Definition vfont.cc:277
bool BKE_vfont_to_curve(Object *ob, eEditFontMode mode)
#define BLI_assert(a)
Definition BLI_assert.h:46
int BLI_findindex(const ListBase *listbase, const void *vlink) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
Definition listbase.cc:586
int char char int int int int size_t BLI_strnlen(const char *str, size_t maxlen) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
Definition string.cc:913
unsigned char uchar
unsigned int uint
#define UNLIKELY(x)
external readfile function prototypes.
#define BLT_I18NCONTEXT_ID_ID
void BPY_free_srna_pytype(StructRNA *srna)
Definition bpy_rna.cc:10084
#define BPy_BEGIN_ALLOW_THREADS
Definition BPY_extern.hh:52
#define BPy_END_ALLOW_THREADS
Definition BPY_extern.hh:56
void DEG_id_tag_update(ID *id, unsigned int flags)
void DEG_relations_tag_update(Main *bmain)
T * DEG_get_original(T *id)
T * DEG_get_evaluated(const Depsgraph *depsgraph, T *id)
ID and Library types, which are fundamental for SDNA.
#define FILTER_ID_GD_LEGACY
Definition DNA_ID.h:1202
#define ID_IS_PACKED(_id)
Definition DNA_ID.h:700
#define FILTER_ID_OB
Definition DNA_ID.h:1214
#define FILTER_ID_MC
Definition DNA_ID.h:1210
@ ID_TAG_COPIED_ON_EVAL
Definition DNA_ID.h:997
@ ID_TAG_EXTRAUSER
Definition DNA_ID.h:878
@ ID_TAG_TEMP_MAIN
Definition DNA_ID.h:971
@ ID_TAG_INDIRECT
Definition DNA_ID.h:848
@ ID_TAG_RUNTIME
Definition DNA_ID.h:859
@ ID_TAG_LOCALIZED
Definition DNA_ID.h:987
@ ID_TAG_MISSING
Definition DNA_ID.h:867
@ ID_TAG_COPIED_ON_EVAL_FINAL_RESULT
Definition DNA_ID.h:1007
@ ID_TAG_DOIT
Definition DNA_ID.h:1036
@ ID_TAG_NO_MAIN
Definition DNA_ID.h:978
#define FILTER_ID_SPK
Definition DNA_ID.h:1218
#define FILTER_ID_CF
Definition DNA_ID.h:1225
@ ID_RECALC_TRANSFORM
Definition DNA_ID.h:1054
@ ID_RECALC_ANIMATION
Definition DNA_ID.h:1077
@ ID_RECALC_GEOMETRY
Definition DNA_ID.h:1074
@ ID_RECALC_ALL
Definition DNA_ID.h:1188
#define FILTER_ID_AC
Definition DNA_ID.h:1197
#define FILTER_ID_MA
Definition DNA_ID.h:1208
#define ID_IS_OVERRIDE_LIBRARY_REAL(_id)
Definition DNA_ID.h:723
#define FILTER_ID_CA
Definition DNA_ID.h:1200
#define FILTER_ID_SO
Definition DNA_ID.h:1219
#define FILTER_ID_PT
Definition DNA_ID.h:1229
#define ID_IS_OVERRIDABLE_LIBRARY(_id)
Definition DNA_ID.h:716
@ LIBOVERRIDE_OP_FLAG_MANDATORY
Definition DNA_ID.h:248
@ LIBOVERRIDE_OP_FLAG_LOCKED
Definition DNA_ID.h:250
@ LIBOVERRIDE_OP_FLAG_IDPOINTER_ITEM_USE_ID
Definition DNA_ID.h:262
@ LIBOVERRIDE_OP_FLAG_IDPOINTER_MATCH_REFERENCE
Definition DNA_ID.h:256
#define FILTER_ID_CU_LEGACY
Definition DNA_ID.h:1201
#define FILTER_ID_BR
Definition DNA_ID.h:1199
#define FILTER_ID_WS
Definition DNA_ID.h:1226
#define FILTER_ID_MB
Definition DNA_ID.h:1209
#define FILTER_ID_VF
Definition DNA_ID.h:1222
#define ID_IS_LINKED(_id)
Definition DNA_ID.h:694
#define MAX_ID_NAME
Definition DNA_ID.h:373
#define FILTER_ID_LA
Definition DNA_ID.h:1205
#define FILTER_ID_GR
Definition DNA_ID.h:1203
#define FILTER_ID_TE
Definition DNA_ID.h:1220
#define FILTER_ID_LT
Definition DNA_ID.h:1207
#define FILTER_ID_LS
Definition DNA_ID.h:1206
#define FILTER_ID_PA
Definition DNA_ID.h:1224
#define FILTER_ID_CV
Definition DNA_ID.h:1228
#define ID_IS_EDITABLE(_id)
Definition DNA_ID.h:705
#define FILTER_ID_ME
Definition DNA_ID.h:1211
#define FILTER_ID_AR
Definition DNA_ID.h:1198
#define MAX_IDPROP_NAME
Definition DNA_ID.h:186
#define FILTER_ID_MSK
Definition DNA_ID.h:1212
#define FILTER_ID_PC
Definition DNA_ID.h:1216
#define FILTER_ID_GP
Definition DNA_ID.h:1236
@ LIBOVERRIDE_OP_NOOP
Definition DNA_ID.h:228
@ LIBOVERRIDE_OP_ADD
Definition DNA_ID.h:233
@ LIBOVERRIDE_OP_SUBTRACT
Definition DNA_ID.h:235
@ LIBOVERRIDE_OP_REPLACE
Definition DNA_ID.h:230
@ LIBOVERRIDE_OP_MULTIPLY
Definition DNA_ID.h:237
@ LIBOVERRIDE_OP_INSERT_BEFORE
Definition DNA_ID.h:241
@ LIBOVERRIDE_OP_INSERT_AFTER
Definition DNA_ID.h:240
#define FILTER_ID_PAL
Definition DNA_ID.h:1215
#define FILTER_ID_IM
Definition DNA_ID.h:1204
@ LIBOVERRIDE_FLAG_NO_HIERARCHY
Definition DNA_ID.h:358
@ LIBOVERRIDE_FLAG_SYSTEM_DEFINED
Definition DNA_ID.h:363
#define FILTER_ID_SCE
Definition DNA_ID.h:1217
#define FILTER_ID_LP
Definition DNA_ID.h:1227
#define FILTER_ID_VO
Definition DNA_ID.h:1230
@ ID_FLAG_LINKED_AND_PACKED
Definition DNA_ID.h:804
@ ID_FLAG_FAKEUSER
Definition DNA_ID.h:769
@ ID_FLAG_EMBEDDED_DATA
Definition DNA_ID.h:774
@ LIBRARY_FLAG_IS_ARCHIVE
Definition DNA_ID.h:593
@ PRV_CHANGED
Definition DNA_ID.h:618
@ PRV_USER_EDITED
Definition DNA_ID.h:620
#define FILTER_ID_WO
Definition DNA_ID.h:1223
#define FILTER_ID_NT
Definition DNA_ID.h:1213
#define FILTER_ID_TXT
Definition DNA_ID.h:1221
eIconSizes
@ ICON_SIZE_PREVIEW
@ ICON_SIZE_ICON
ID_Type
@ ID_WM
@ ID_CA
@ ID_AR
@ ID_MC
@ ID_CF
@ ID_LI
@ ID_TE
@ ID_IM
@ ID_VO
@ ID_WS
@ ID_NT
@ ID_LA
@ ID_KE
@ ID_TXT
@ ID_SO
@ ID_SCE
@ ID_LS
@ ID_MSK
@ ID_CV
@ ID_PAL
@ ID_BR
@ ID_LP
@ ID_WO
@ ID_MA
@ ID_AC
@ ID_SCR
@ ID_CU_LEGACY
@ ID_GD_LEGACY
@ ID_VF
@ ID_ME
@ ID_GR
@ ID_SPK
@ ID_MB
@ ID_LT
@ ID_OB
@ ID_GP
@ ID_PA
@ ID_PT
@ ID_PC
#define MAX_NAME
Definition DNA_defs.h:50
#define MAXMAT
@ OB_FONT
short RNA_type_to_ID_code(const StructRNA *type)
StructRNA * ID_code_to_RNA_type(short idcode)
#define RNA_MAX_ARRAY_DIMENSION
Definition RNA_define.hh:27
@ PARM_REQUIRED
Definition RNA_types.hh:545
@ FUNC_USE_REPORTS
Definition RNA_types.hh:914
@ FUNC_USE_MAIN
Definition RNA_types.hh:912
@ FUNC_USE_CONTEXT
Definition RNA_types.hh:913
@ FUNC_USE_SELF_ID
Definition RNA_types.hh:889
@ STRUCT_ID_REFCOUNT
Definition RNA_types.hh:959
@ STRUCT_ID
Definition RNA_types.hh:953
@ STRUCT_NO_DATABLOCK_IDPROPERTIES
Definition RNA_types.hh:970
int(*)(PointerRNA *ptr, void *data, bool *have_function) StructValidateFunc
Definition RNA_types.hh:985
@ PROP_FLOAT
Definition RNA_types.hh:164
@ PROP_BOOLEAN
Definition RNA_types.hh:162
@ PROP_ENUM
Definition RNA_types.hh:166
@ PROP_INT
Definition RNA_types.hh:163
@ PROP_STRING
Definition RNA_types.hh:165
@ PROP_POINTER
Definition RNA_types.hh:167
@ PROP_COLLECTION
Definition RNA_types.hh:168
int(*)(bContext *C, PointerRNA *ptr, FunctionRNA *func, ParameterList *list) StructCallbackFunc
Definition RNA_types.hh:986
void(*)(void *data) StructFreeFunc
Definition RNA_types.hh:990
@ PROPOVERRIDE_OVERRIDABLE_LIBRARY
Definition RNA_types.hh:503
@ PROPOVERRIDE_NO_COMPARISON
Definition RNA_types.hh:511
@ PROPOVERRIDE_IGNORE
Definition RNA_types.hh:523
PropertyFlag
Definition RNA_types.hh:300
@ PROP_THICK_WRAP
Definition RNA_types.hh:423
@ PROP_DYNAMIC
Definition RNA_types.hh:428
@ PROP_PATH_SUPPORTS_BLEND_RELATIVE
Definition RNA_types.hh:456
@ PROP_EDITABLE
Definition RNA_types.hh:306
@ PROP_LIB_EXCEPTION
Definition RNA_types.hh:312
@ PROP_NEVER_NULL
Definition RNA_types.hh:377
@ PROP_PTR_NO_OWNERSHIP
Definition RNA_types.hh:395
@ PROP_HIDDEN
Definition RNA_types.hh:338
@ PROP_IDPROPERTY
Definition RNA_types.hh:426
@ PROP_PIXEL
Definition RNA_types.hh:248
@ PROP_NONE
Definition RNA_types.hh:233
@ PROP_UNSIGNED
Definition RNA_types.hh:249
@ PROP_FILEPATH
Definition RNA_types.hh:236
#define C
Definition RandGen.cpp:29
#define NC_WINDOW
Definition WM_types.hh:375
#define NC_ID
Definition WM_types.hh:395
#define ND_DRAW
Definition WM_types.hh:461
#define NC_WM
Definition WM_types.hh:374
#define ND_LIB_OVERRIDE_CHANGED
Definition WM_types.hh:419
#define NA_ADDED
Definition WM_types.hh:586
#define NA_EDITED
Definition WM_types.hh:584
#define NC_ASSET
Definition WM_types.hh:404
#define NA_REMOVED
Definition WM_types.hh:587
#define NA_RENAME
Definition WM_types.hh:588
#define ND_OB_SHADING
Definition WM_types.hh:457
#define NC_OBJECT
Definition WM_types.hh:379
BMesh const char void * data
PyObject * self
BPy_StructRNA * depsgraph
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
Definition btDbvt.cpp:52
#define GS(x)
float length(VecOp< float, D >) RET
DEG_id_tag_update_ex(cb_data->bmain, cb_data->owner_id, ID_RECALC_TAG_FOR_UNDO|ID_RECALC_SYNC_TO_EVAL)
void * MEM_calloc_arrayN(size_t len, size_t size, const char *str)
Definition mallocn.cc:123
MINLINE unsigned char unit_float_to_uchar_clamp(float val)
bool copy_to_id(const AssetMetaData *asset_data, ID *destination)
void generate_preview(const bContext *C, ID *id)
const char * name
static void rna_def_ID_override_library(BlenderRNA *brna)
Definition rna_ID.cc:2115
static const EnumPropertyItem rna_enum_override_library_property_operation_items[]
Definition rna_ID.cc:72
static void rna_def_ID_override_library_property_operation(BlenderRNA *brna)
Definition rna_ID.cc:1852
static void rna_def_ID_override_library_property(BlenderRNA *brna)
Definition rna_ID.cc:2048
const EnumPropertyItem rna_enum_id_type_items[]
Definition rna_ID.cc:29
static void rna_def_ID_override_library_properties(BlenderRNA *brna, PropertyRNA *cprop)
Definition rna_ID.cc:2078
const IDFilterEnumPropertyItem rna_enum_id_type_filter_items[]
Definition rna_ID.cc:116
void RNA_def_ID(BlenderRNA *brna)
Definition rna_ID.cc:2806
static void rna_def_ID(BlenderRNA *brna)
Definition rna_ID.cc:2244
static void rna_def_library_weak_reference(BlenderRNA *brna)
Definition rna_ID.cc:2766
static void rna_def_ID_properties(BlenderRNA *brna)
Definition rna_ID.cc:1616
static void rna_def_idproperty_wrap_ptr(BlenderRNA *brna)
Definition rna_ID.cc:2794
static void rna_def_image_preview(BlenderRNA *brna)
Definition rna_ID.cc:1760
static void rna_def_library(BlenderRNA *brna)
Definition rna_ID.cc:2672
static void rna_def_ID_override_library_property_operations(BlenderRNA *brna, PropertyRNA *cprop)
Definition rna_ID.cc:1962
static void rna_def_ID_materials(BlenderRNA *brna)
Definition rna_ID.cc:1730
const StructRNA * RNA_struct_base_child_of(const StructRNA *type, const StructRNA *parent_type)
const char * RNA_struct_identifier(const StructRNA *type)
void rna_iterator_array_begin(CollectionPropertyIterator *iter, PointerRNA *ptr, void *data, size_t itemsize, int64_t length, bool free_ptr, IteratorSkipFunc skip)
void rna_pointer_create_with_ancestors(const PointerRNA &parent, StructRNA *type, void *data, PointerRNA &r_ptr)
PointerRNA RNA_pointer_create_discrete(ID *id, StructRNA *type, void *data)
PointerRNA RNA_pointer_create_with_parent(const PointerRNA &parent, StructRNA *type, void *data)
PointerRNA RNA_id_pointer_create(ID *id)
void RNA_def_property_boolean_sdna(PropertyRNA *prop, const char *structname, const char *propname, int64_t booleanbit)
void RNA_def_struct_name_property(StructRNA *srna, PropertyRNA *prop)
PropertyRNA * RNA_def_string(StructOrFunctionRNA *cont_, const char *identifier, const char *default_value, const int maxlen, const char *ui_name, const char *ui_description)
void RNA_def_struct_refine_func(StructRNA *srna, const char *refine)
void RNA_def_property_pointer_sdna(PropertyRNA *prop, const char *structname, const char *propname)
void RNA_def_struct_system_idprops_func(StructRNA *srna, const char *system_idproperties)
void RNA_def_struct_flag(StructRNA *srna, int flag)
void RNA_def_property_string_funcs(PropertyRNA *prop, const char *get, const char *length, const char *set)
void RNA_def_function_return(FunctionRNA *func, PropertyRNA *ret)
void RNA_def_property_float_funcs(PropertyRNA *prop, const char *get, const char *set, const char *range)
void RNA_def_property_ui_text(PropertyRNA *prop, const char *name, const char *description)
void RNA_def_property_string_sdna(PropertyRNA *prop, const char *structname, const char *propname)
void RNA_def_property_ui_icon(PropertyRNA *prop, int icon, int consecutive)
void RNA_def_property_srna(PropertyRNA *prop, const char *type)
void RNA_def_property_collection_funcs(PropertyRNA *prop, const char *begin, const char *next, const char *end, const char *get, const char *length, const char *lookupint, const char *lookupstring, const char *assignint)
void RNA_def_struct_ui_text(StructRNA *srna, const char *name, const char *description)
void RNA_def_property_boolean_funcs(PropertyRNA *prop, const char *get, const char *set)
void RNA_def_struct_register_funcs(StructRNA *srna, const char *reg, const char *unreg, const char *instance)
void RNA_def_property_dynamic_array_funcs(PropertyRNA *prop, const char *getlength)
void RNA_def_property_multi_array(PropertyRNA *prop, int dimension, const int length[])
PropertyRNA * RNA_def_enum(StructOrFunctionRNA *cont_, const char *identifier, const EnumPropertyItem *items, const int default_value, const char *ui_name, const char *ui_description)
PropertyRNA * RNA_def_int_vector(StructOrFunctionRNA *cont_, const char *identifier, const int len, const int *default_value, const int hardmin, const int hardmax, const char *ui_name, const char *ui_description, const int softmin, const int softmax)
void RNA_def_property_enum_items(PropertyRNA *prop, const EnumPropertyItem *item)
void RNA_def_struct_sdna(StructRNA *srna, const char *structname)
FunctionRNA * RNA_def_function(StructRNA *srna, const char *identifier, const char *call)
void RNA_def_property_array(PropertyRNA *prop, int length)
PropertyRNA * RNA_def_pointer(StructOrFunctionRNA *cont_, const char *identifier, const char *type, const char *ui_name, const char *ui_description)
void RNA_def_property_string_maxlength(PropertyRNA *prop, int maxlength)
void RNA_def_property_struct_type(PropertyRNA *prop, const char *type)
void RNA_def_function_ui_description(FunctionRNA *func, const char *description)
void RNA_def_property_update(PropertyRNA *prop, int noteflag, const char *func)
PropertyRNA * RNA_def_property(StructOrFunctionRNA *cont_, const char *identifier, int type, int subtype)
void RNA_def_property_enum_funcs(PropertyRNA *prop, const char *get, const char *set, const char *item)
StructRNA * RNA_def_struct_ptr(BlenderRNA *brna, const char *identifier, StructRNA *srnafrom)
void RNA_def_property_editable_func(PropertyRNA *prop, const char *editable)
StructRNA * RNA_def_struct(BlenderRNA *brna, const char *identifier, const char *from)
PropertyRNA * RNA_def_enum_flag(StructOrFunctionRNA *cont_, const char *identifier, const EnumPropertyItem *items, const int default_value, const char *ui_name, const char *ui_description)
void RNA_def_function_flag(FunctionRNA *func, int flag)
void RNA_def_property_clear_flag(PropertyRNA *prop, PropertyFlag flag)
void RNA_def_property_pointer_funcs(PropertyRNA *prop, const char *get, const char *set, const char *type_fn, const char *poll)
void RNA_def_property_int_funcs(PropertyRNA *prop, const char *get, const char *set, const char *range)
void RNA_def_struct_ui_icon(StructRNA *srna, int icon)
PropertyRNA * RNA_def_boolean(StructOrFunctionRNA *cont_, const char *identifier, const bool default_value, const char *ui_name, const char *ui_description)
void RNA_struct_free(BlenderRNA *brna, StructRNA *srna)
PropertyRNA * RNA_def_collection(StructOrFunctionRNA *cont_, const char *identifier, const char *type, const char *ui_name, const char *ui_description)
void RNA_def_struct_idprops_func(StructRNA *srna, const char *idproperties)
void RNA_def_property_translation_context(PropertyRNA *prop, const char *context)
void RNA_def_property_flag(PropertyRNA *prop, PropertyFlag flag)
void RNA_def_property_subtype(PropertyRNA *prop, PropertySubType subtype)
void RNA_def_property_int_sdna(PropertyRNA *prop, const char *structname, const char *propname)
PropertyRNA * RNA_def_int(StructOrFunctionRNA *cont_, const char *identifier, const int default_value, const int hardmin, const int hardmax, const char *ui_name, const char *ui_description, const int softmin, const int softmax)
void RNA_def_property_boolean_negative_sdna(PropertyRNA *prop, const char *structname, const char *propname, int64_t booleanbit)
void RNA_def_property_override_flag(PropertyRNA *prop, PropertyOverrideFlag flag)
void RNA_def_parameter_flags(PropertyRNA *prop, PropertyFlag flag_property, ParameterFlag flag_parameter)
int rna_ID_name_length(PointerRNA *ptr)
void rna_ID_name_get(PointerRNA *ptr, char *value)
StructRNA * rna_ID_refine(PointerRNA *ptr)
StructRNA * rna_PropertyGroup_refine(PointerRNA *ptr)
BlenderRNA BLENDER_RNA
bool rna_IDMaterials_assign_int(PointerRNA *ptr, int key, const PointerRNA *assign_ptr)
void ** rna_ID_instance(PointerRNA *ptr)
bool rna_PropertyGroup_unregister(Main *bmain, StructRNA *type)
IDProperty ** rna_ID_system_idprops(PointerRNA *ptr)
IDProperty ** rna_PropertyGroup_idprops(PointerRNA *ptr)
StructRNA * rna_PropertyGroup_register(Main *bmain, ReportList *reports, void *data, const char *identifier, StructValidateFunc validate, StructCallbackFunc call, StructFreeFunc free)
void rna_ID_fake_user_set(PointerRNA *ptr, bool value)
StructRNA RNA_PropertyGroup
void rna_ID_name_set(PointerRNA *ptr, const char *value)
IDProperty ** rna_ID_idprops(PointerRNA *ptr)
const EnumPropertyItem rna_enum_dummy_DEFAULT_items[]
Definition rna_rna.cc:32
The meta-data of an asset. By creating and giving this for a data-block (ID.asset_data),...
union CollectionPropertyIterator::@220100362304005352221007113371015217044252346141 internal
ListBase properties
Definition DNA_ID.h:336
unsigned int flag
Definition DNA_ID.h:348
struct ID * hierarchy_root
Definition DNA_ID.h:344
struct ID * reference
Definition DNA_ID.h:334
Definition DNA_ID.h:414
struct AssetMetaData * asset_data
Definition DNA_ID.h:423
char name[258]
Definition DNA_ID.h:432
IDOverrideLibrary * override_library
Definition DNA_ID.h:494
ID * owner_id
Definition RNA_types.hh:51
void * data
Definition RNA_types.hh:53
short flag[2]
Definition DNA_ID.h:644
i
Definition text_draw.cc:230
uint len
#define N_(msgid)
static DynamicLibrary lib
void WM_main_add_notifier(uint type, void *reference)
PointerRNA * ptr
Definition wm_files.cc:4238
uint8_t flag
Definition wm_window.cc:145