Blender  V3.3
rna_ID.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 
7 #include <stdio.h>
8 #include <stdlib.h>
9 
10 #include "DNA_ID.h"
11 #include "DNA_material_types.h"
12 #include "DNA_object_types.h"
13 #include "DNA_vfont_types.h"
14 
15 #include "BLI_utildefines.h"
16 
17 #include "BKE_icons.h"
18 #include "BKE_lib_id.h"
19 #include "BKE_main_namemap.h"
20 #include "BKE_object.h"
21 
22 #include "RNA_access.h"
23 #include "RNA_define.h"
24 #include "RNA_enum_types.h"
25 
26 #include "WM_types.h"
27 
28 #include "rna_internal.h"
29 
30 /* enum of ID-block types
31  * NOTE: need to keep this in line with the other defines for these
32  */
34  {ID_AC, "ACTION", ICON_ACTION, "Action", ""},
35  {ID_AR, "ARMATURE", ICON_ARMATURE_DATA, "Armature", ""},
36  {ID_BR, "BRUSH", ICON_BRUSH_DATA, "Brush", ""},
37  {ID_CF, "CACHEFILE", ICON_FILE, "Cache File", ""},
38  {ID_CA, "CAMERA", ICON_CAMERA_DATA, "Camera", ""},
39  {ID_GR, "COLLECTION", ICON_OUTLINER_COLLECTION, "Collection", ""},
40  {ID_CU_LEGACY, "CURVE", ICON_CURVE_DATA, "Curve", ""},
41  {ID_CV, "CURVES", ICON_CURVES_DATA, "Curves", ""},
42  {ID_VF, "FONT", ICON_FONT_DATA, "Font", ""},
43  {ID_GD, "GREASEPENCIL", ICON_GREASEPENCIL, "Grease Pencil", ""},
44  {ID_IM, "IMAGE", ICON_IMAGE_DATA, "Image", ""},
45  {ID_KE, "KEY", ICON_SHAPEKEY_DATA, "Key", ""},
46  {ID_LT, "LATTICE", ICON_LATTICE_DATA, "Lattice", ""},
47  {ID_LI, "LIBRARY", ICON_LIBRARY_DATA_DIRECT, "Library", ""},
48  {ID_LA, "LIGHT", ICON_LIGHT_DATA, "Light", ""},
49  {ID_LP, "LIGHT_PROBE", ICON_LIGHTPROBE_CUBEMAP, "Light Probe", ""},
50  {ID_LS, "LINESTYLE", ICON_LINE_DATA, "Line Style", ""},
51  {ID_MSK, "MASK", ICON_MOD_MASK, "Mask", ""},
52  {ID_MA, "MATERIAL", ICON_MATERIAL_DATA, "Material", ""},
53  {ID_ME, "MESH", ICON_MESH_DATA, "Mesh", ""},
54  {ID_MB, "META", ICON_META_DATA, "Metaball", ""},
55  {ID_MC, "MOVIECLIP", ICON_TRACKER, "Movie Clip", ""},
56  {ID_NT, "NODETREE", ICON_NODETREE, "Node Tree", ""},
57  {ID_OB, "OBJECT", ICON_OBJECT_DATA, "Object", ""},
58  {ID_PC, "PAINTCURVE", ICON_CURVE_BEZCURVE, "Paint Curve", ""},
59  {ID_PAL, "PALETTE", ICON_COLOR, "Palette", ""},
60  {ID_PA, "PARTICLE", ICON_PARTICLE_DATA, "Particle", ""},
61  {ID_PT, "POINTCLOUD", ICON_POINTCLOUD_DATA, "Point Cloud", ""},
62  {ID_SCE, "SCENE", ICON_SCENE_DATA, "Scene", ""},
63  {ID_SIM, "SIMULATION", ICON_PHYSICS, "Simulation", ""}, /* TODO: Use correct icon. */
64  {ID_SO, "SOUND", ICON_SOUND, "Sound", ""},
65  {ID_SPK, "SPEAKER", ICON_SPEAKER, "Speaker", ""},
66  {ID_TXT, "TEXT", ICON_TEXT, "Text", ""},
67  {ID_TE, "TEXTURE", ICON_TEXTURE_DATA, "Texture", ""},
68  {ID_VO, "VOLUME", ICON_VOLUME_DATA, "Volume", ""},
69  {ID_WM, "WINDOWMANAGER", ICON_WINDOW, "Window Manager", ""},
70  {ID_WS, "WORKSPACE", ICON_WORKSPACE, "Workspace", ""},
71  {ID_WO, "WORLD", ICON_WORLD_DATA, "World", ""},
72  {0, NULL, 0, NULL, NULL},
73 };
74 
77  "NOOP",
78  0,
79  "No-Op",
80  "Does nothing, prevents adding actual overrides (NOT USED)"},
82  "REPLACE",
83  0,
84  "Replace",
85  "Replace value of reference by overriding one"},
87  "DIFF_ADD",
88  0,
89  "Differential",
90  "Stores and apply difference between reference and local value (NOT USED)"},
92  "DIFF_SUB",
93  0,
94  "Differential",
95  "Stores and apply difference between reference and local value (NOT USED)"},
97  "FACT_MULTIPLY",
98  0,
99  "Factor",
100  "Stores and apply multiplication factor between reference and local value (NOT USED)"},
102  "INSERT_AFTER",
103  0,
104  "Insert After",
105  "Insert a new item into collection after the one referenced in subitem_reference_name or "
106  "_index"},
108  "INSERT_BEFORE",
109  0,
110  "Insert Before",
111  "Insert a new item into collection after the one referenced in subitem_reference_name or "
112  "_index (NOT USED)"},
113  {0, NULL, 0, NULL, NULL},
114 };
115 
120  /* Datablocks */
121  {FILTER_ID_AC, "filter_action", ICON_ACTION, "Actions", "Show Action data-blocks"},
122  {FILTER_ID_AR,
123  "filter_armature",
124  ICON_ARMATURE_DATA,
125  "Armatures",
126  "Show Armature data-blocks"},
127  {FILTER_ID_BR, "filter_brush", ICON_BRUSH_DATA, "Brushes", "Show Brushes data-blocks"},
128  {FILTER_ID_CA, "filter_camera", ICON_CAMERA_DATA, "Cameras", "Show Camera data-blocks"},
129  {FILTER_ID_CF, "filter_cachefile", ICON_FILE, "Cache Files", "Show Cache File data-blocks"},
130  {FILTER_ID_CU_LEGACY, "filter_curve", ICON_CURVE_DATA, "Curves", "Show Curve data-blocks"},
131  {FILTER_ID_GD,
132  "filter_grease_pencil",
133  ICON_GREASEPENCIL,
134  "Grease Pencil",
135  "Show Grease pencil data-blocks"},
136  {FILTER_ID_GR,
137  "filter_group",
138  ICON_OUTLINER_COLLECTION,
139  "Collections",
140  "Show Collection data-blocks"},
141  {FILTER_ID_CV,
142  "filter_curves",
143  ICON_CURVES_DATA,
144  "Hair Curves",
145  "Show/hide Curves data-blocks"},
146  {FILTER_ID_IM, "filter_image", ICON_IMAGE_DATA, "Images", "Show Image data-blocks"},
147  {FILTER_ID_LA, "filter_light", ICON_LIGHT_DATA, "Lights", "Show Light data-blocks"},
148  {FILTER_ID_LP,
149  "filter_light_probe",
150  ICON_OUTLINER_DATA_LIGHTPROBE,
151  "Light Probes",
152  "Show Light Probe data-blocks"},
153  {FILTER_ID_LS,
154  "filter_linestyle",
155  ICON_LINE_DATA,
156  "Freestyle Linestyles",
157  "Show Freestyle's Line Style data-blocks"},
158  {FILTER_ID_LT, "filter_lattice", ICON_LATTICE_DATA, "Lattices", "Show Lattice data-blocks"},
159  {FILTER_ID_MA,
160  "filter_material",
161  ICON_MATERIAL_DATA,
162  "Materials",
163  "Show Material data-blocks"},
164  {FILTER_ID_MB, "filter_metaball", ICON_META_DATA, "Metaballs", "Show Metaball data-blocks"},
165  {FILTER_ID_MC,
166  "filter_movie_clip",
167  ICON_TRACKER,
168  "Movie Clips",
169  "Show Movie Clip data-blocks"},
170  {FILTER_ID_ME, "filter_mesh", ICON_MESH_DATA, "Meshes", "Show Mesh data-blocks"},
171  {FILTER_ID_MSK, "filter_mask", ICON_MOD_MASK, "Masks", "Show Mask data-blocks"},
172  {FILTER_ID_NT, "filter_node_tree", ICON_NODETREE, "Node Trees", "Show Node Tree data-blocks"},
173  {FILTER_ID_OB, "filter_object", ICON_OBJECT_DATA, "Objects", "Show Object data-blocks"},
174  {FILTER_ID_PA,
175  "filter_particle_settings",
176  ICON_PARTICLE_DATA,
177  "Particles Settings",
178  "Show Particle Settings data-blocks"},
179  {FILTER_ID_PAL, "filter_palette", ICON_COLOR, "Palettes", "Show Palette data-blocks"},
180  {FILTER_ID_PC,
181  "filter_paint_curve",
182  ICON_CURVE_BEZCURVE,
183  "Paint Curves",
184  "Show Paint Curve data-blocks"},
185  {FILTER_ID_PT,
186  "filter_pointcloud",
187  ICON_POINTCLOUD_DATA,
188  "Point Clouds",
189  "Show/hide Point Cloud data-blocks"},
190  {FILTER_ID_SCE, "filter_scene", ICON_SCENE_DATA, "Scenes", "Show Scene data-blocks"},
191  {FILTER_ID_SIM,
192  "filter_simulation",
193  ICON_PHYSICS,
194  "Simulations",
195  "Show Simulation data-blocks"}, /* TODO: Use correct icon. */
196  {FILTER_ID_SPK, "filter_speaker", ICON_SPEAKER, "Speakers", "Show Speaker data-blocks"},
197  {FILTER_ID_SO, "filter_sound", ICON_SOUND, "Sounds", "Show Sound data-blocks"},
198  {FILTER_ID_TE, "filter_texture", ICON_TEXTURE_DATA, "Textures", "Show Texture data-blocks"},
199  {FILTER_ID_TXT, "filter_text", ICON_TEXT, "Texts", "Show Text data-blocks"},
200  {FILTER_ID_VF, "filter_font", ICON_FONT_DATA, "Fonts", "Show Font data-blocks"},
201  {FILTER_ID_VO, "filter_volume", ICON_VOLUME_DATA, "Volumes", "Show/hide Volume data-blocks"},
202  {FILTER_ID_WO, "filter_world", ICON_WORLD_DATA, "Worlds", "Show World data-blocks"},
203  {FILTER_ID_WS,
204  "filter_work_space",
205  ICON_WORKSPACE,
206  "Workspaces",
207  "Show workspace data-blocks"},
208  {0, NULL, 0, NULL, NULL},
209 };
210 
211 #ifdef RNA_RUNTIME
212 
213 # include "DNA_anim_types.h"
214 
215 # include "BLI_listbase.h"
216 # include "BLI_math_base.h"
217 
218 # include "BKE_anim_data.h"
219 # include "BKE_global.h" /* XXX, remove me */
220 # include "BKE_idprop.h"
221 # include "BKE_idtype.h"
222 # include "BKE_lib_override.h"
223 # include "BKE_lib_query.h"
224 # include "BKE_lib_remap.h"
225 # include "BKE_library.h"
226 # include "BKE_material.h"
227 # include "BKE_vfont.h"
228 
229 # include "DEG_depsgraph.h"
230 # include "DEG_depsgraph_build.h"
231 # include "DEG_depsgraph_query.h"
232 
233 # include "ED_asset.h"
234 
235 # include "WM_api.h"
236 
237 # ifdef WITH_PYTHON
238 # include "BPY_extern.h"
239 # endif
240 
241 void rna_ID_override_library_property_operation_refname_get(PointerRNA *ptr, char *value)
242 {
244  strcpy(value, (opop->subitem_reference_name == NULL) ? "" : opop->subitem_reference_name);
245 }
246 
247 int rna_ID_override_library_property_operation_refname_length(PointerRNA *ptr)
248 {
250  return (opop->subitem_reference_name == NULL) ? 0 : strlen(opop->subitem_reference_name);
251 }
252 
253 void rna_ID_override_library_property_operation_locname_get(PointerRNA *ptr, char *value)
254 {
256  strcpy(value, (opop->subitem_local_name == NULL) ? "" : opop->subitem_local_name);
257 }
258 
259 int rna_ID_override_library_property_operation_locname_length(PointerRNA *ptr)
260 {
262  return (opop->subitem_local_name == NULL) ? 0 : strlen(opop->subitem_local_name);
263 }
264 
265 /* name functions that ignore the first two ID characters */
266 void rna_ID_name_get(PointerRNA *ptr, char *value)
267 {
268  ID *id = (ID *)ptr->data;
269  BLI_strncpy(value, id->name + 2, sizeof(id->name) - 2);
270 }
271 
273 {
274  ID *id = (ID *)ptr->data;
275  return strlen(id->name + 2);
276 }
277 
278 void rna_ID_name_set(PointerRNA *ptr, const char *value)
279 {
280  ID *id = (ID *)ptr->data;
282  BLI_strncpy_utf8(id->name + 2, value, sizeof(id->name) - 2);
285 
286  if (GS(id->name) == ID_OB) {
287  Object *ob = (Object *)id;
288  if (ob->type == OB_MBALL) {
290  }
291  }
292 }
293 
294 static int rna_ID_name_editable(PointerRNA *ptr, const char **UNUSED(r_info))
295 {
296  ID *id = (ID *)ptr->data;
297 
298  if (GS(id->name) == ID_VF) {
299  VFont *vfont = (VFont *)id;
300  if (BKE_vfont_is_builtin(vfont)) {
301  return 0;
302  }
303  }
304  else if (!BKE_id_is_in_global_main(id)) {
305  return 0;
306  }
307 
308  return PROP_EDITABLE;
309 }
310 
311 void rna_ID_name_full_get(PointerRNA *ptr, char *value)
312 {
313  ID *id = (ID *)ptr->data;
314  BKE_id_full_name_get(value, id, 0);
315 }
316 
317 int rna_ID_name_full_length(PointerRNA *ptr)
318 {
319  ID *id = (ID *)ptr->data;
320  char name[MAX_ID_FULL_NAME];
321  BKE_id_full_name_get(name, id, 0);
322  return strlen(name);
323 }
324 
325 static int rna_ID_is_evaluated_get(PointerRNA *ptr)
326 {
327  ID *id = (ID *)ptr->data;
328 
329  return (DEG_get_original_id(id) != id);
330 }
331 
332 static PointerRNA rna_ID_original_get(PointerRNA *ptr)
333 {
334  ID *id = (ID *)ptr->data;
335 
336  return rna_pointer_inherit_refine(ptr, &RNA_ID, DEG_get_original_id(id));
337 }
338 
339 short RNA_type_to_ID_code(const StructRNA *type)
340 {
341  const StructRNA *base_type = RNA_struct_base_child_of(type, &RNA_ID);
342  if (UNLIKELY(base_type == NULL)) {
343  return 0;
344  }
345  if (base_type == &RNA_Action) {
346  return ID_AC;
347  }
348  if (base_type == &RNA_Armature) {
349  return ID_AR;
350  }
351  if (base_type == &RNA_Brush) {
352  return ID_BR;
353  }
354  if (base_type == &RNA_CacheFile) {
355  return ID_CF;
356  }
357  if (base_type == &RNA_Camera) {
358  return ID_CA;
359  }
360  if (base_type == &RNA_Curve) {
361  return ID_CU_LEGACY;
362  }
363  if (base_type == &RNA_GreasePencil) {
364  return ID_GD;
365  }
366  if (base_type == &RNA_Collection) {
367  return ID_GR;
368  }
369  if (base_type == &RNA_Image) {
370  return ID_IM;
371  }
372  if (base_type == &RNA_Key) {
373  return ID_KE;
374  }
375  if (base_type == &RNA_Light) {
376  return ID_LA;
377  }
378  if (base_type == &RNA_Library) {
379  return ID_LI;
380  }
381  if (base_type == &RNA_FreestyleLineStyle) {
382  return ID_LS;
383  }
384  if (base_type == &RNA_Curves) {
385  return ID_CV;
386  }
387  if (base_type == &RNA_Lattice) {
388  return ID_LT;
389  }
390  if (base_type == &RNA_Material) {
391  return ID_MA;
392  }
393  if (base_type == &RNA_MetaBall) {
394  return ID_MB;
395  }
396  if (base_type == &RNA_MovieClip) {
397  return ID_MC;
398  }
399  if (base_type == &RNA_Mesh) {
400  return ID_ME;
401  }
402  if (base_type == &RNA_Mask) {
403  return ID_MSK;
404  }
405  if (base_type == &RNA_NodeTree) {
406  return ID_NT;
407  }
408  if (base_type == &RNA_Object) {
409  return ID_OB;
410  }
411  if (base_type == &RNA_ParticleSettings) {
412  return ID_PA;
413  }
414  if (base_type == &RNA_Palette) {
415  return ID_PAL;
416  }
417  if (base_type == &RNA_PaintCurve) {
418  return ID_PC;
419  }
420  if (base_type == &RNA_PointCloud) {
421  return ID_PT;
422  }
423  if (base_type == &RNA_LightProbe) {
424  return ID_LP;
425  }
426  if (base_type == &RNA_Scene) {
427  return ID_SCE;
428  }
429  if (base_type == &RNA_Screen) {
430  return ID_SCR;
431  }
432 # ifdef WITH_SIMULATION_DATABLOCK
433  if (base_type == &RNA_Simulation) {
434  return ID_SIM;
435  }
436 # endif
437  if (base_type == &RNA_Sound) {
438  return ID_SO;
439  }
440  if (base_type == &RNA_Speaker) {
441  return ID_SPK;
442  }
443  if (base_type == &RNA_Texture) {
444  return ID_TE;
445  }
446  if (base_type == &RNA_Text) {
447  return ID_TXT;
448  }
449  if (base_type == &RNA_VectorFont) {
450  return ID_VF;
451  }
452  if (base_type == &RNA_Volume) {
453  return ID_VO;
454  }
455  if (base_type == &RNA_WorkSpace) {
456  return ID_WS;
457  }
458  if (base_type == &RNA_World) {
459  return ID_WO;
460  }
461  if (base_type == &RNA_WindowManager) {
462  return ID_WM;
463  }
464 
465  return 0;
466 }
467 
468 StructRNA *ID_code_to_RNA_type(short idcode)
469 {
470  /* NOTE: this switch doesn't use a 'default',
471  * so adding new ID's causes a warning. */
472  switch ((ID_Type)idcode) {
473  case ID_AC:
474  return &RNA_Action;
475  case ID_AR:
476  return &RNA_Armature;
477  case ID_BR:
478  return &RNA_Brush;
479  case ID_CA:
480  return &RNA_Camera;
481  case ID_CF:
482  return &RNA_CacheFile;
483  case ID_CU_LEGACY:
484  return &RNA_Curve;
485  case ID_GD:
486  return &RNA_GreasePencil;
487  case ID_GR:
488  return &RNA_Collection;
489  case ID_CV:
490  return &RNA_Curves;
491  case ID_IM:
492  return &RNA_Image;
493  case ID_KE:
494  return &RNA_Key;
495  case ID_LA:
496  return &RNA_Light;
497  case ID_LI:
498  return &RNA_Library;
499  case ID_LS:
500  return &RNA_FreestyleLineStyle;
501  case ID_LT:
502  return &RNA_Lattice;
503  case ID_MA:
504  return &RNA_Material;
505  case ID_MB:
506  return &RNA_MetaBall;
507  case ID_MC:
508  return &RNA_MovieClip;
509  case ID_ME:
510  return &RNA_Mesh;
511  case ID_MSK:
512  return &RNA_Mask;
513  case ID_NT:
514  return &RNA_NodeTree;
515  case ID_OB:
516  return &RNA_Object;
517  case ID_PA:
518  return &RNA_ParticleSettings;
519  case ID_PAL:
520  return &RNA_Palette;
521  case ID_PC:
522  return &RNA_PaintCurve;
523  case ID_PT:
524  return &RNA_PointCloud;
525  case ID_LP:
526  return &RNA_LightProbe;
527  case ID_SCE:
528  return &RNA_Scene;
529  case ID_SCR:
530  return &RNA_Screen;
531  case ID_SIM:
532 # ifdef WITH_SIMULATION_DATABLOCK
533  return &RNA_Simulation;
534 # else
535  return &RNA_ID;
536 # endif
537  case ID_SO:
538  return &RNA_Sound;
539  case ID_SPK:
540  return &RNA_Speaker;
541  case ID_TE:
542  return &RNA_Texture;
543  case ID_TXT:
544  return &RNA_Text;
545  case ID_VF:
546  return &RNA_VectorFont;
547  case ID_VO:
548  return &RNA_Volume;
549  case ID_WM:
550  return &RNA_WindowManager;
551  case ID_WO:
552  return &RNA_World;
553  case ID_WS:
554  return &RNA_WorkSpace;
555 
556  /* deprecated */
557  case ID_IP:
558  break;
559  }
560 
561  return &RNA_ID;
562 }
563 
565 {
566  ID *id = (ID *)ptr->data;
567 
568  return ID_code_to_RNA_type(GS(id->name));
569 }
570 
572 {
573  ID *id = (ID *)ptr->data;
574  return &id->properties;
575 }
576 
577 void rna_ID_fake_user_set(PointerRNA *ptr, bool value)
578 {
579  ID *id = (ID *)ptr->data;
580 
581  if (value) {
582  id_fake_user_set(id);
583  }
584  else {
585  id_fake_user_clear(id);
586  }
587 }
588 
589 void rna_ID_extra_user_set(PointerRNA *ptr, bool value)
590 {
591  ID *id = (ID *)ptr->data;
592 
593  if (value) {
594  id_us_ensure_real(id);
595  }
596  else {
597  id_us_clear_real(id);
598  }
599 }
600 
602 {
603  return (IDProperty **)&ptr->data;
604 }
605 
607 {
609 }
610 
612  ReportList *reports,
613  void *data,
614  const char *identifier,
615  StructValidateFunc validate,
618 {
619  PointerRNA dummyptr;
620 
621  /* create dummy pointer */
623 
624  /* validate the python class */
625  if (validate(&dummyptr, data, NULL) != 0) {
626  return NULL;
627  }
628 
629  /* NOTE: it looks like there is no length limit on the srna id since its
630  * just a char pointer, but take care here, also be careful that python
631  * owns the string pointer which it could potentially free while blender
632  * is running. */
634  BKE_reportf(reports,
635  RPT_ERROR,
636  "Registering id property class: '%s' is too long, maximum length is %d",
637  identifier,
639  return NULL;
640  }
641 
643 }
644 
646 {
647  return ptr->type;
648 }
649 
650 static ID *rna_ID_evaluated_get(ID *id, struct Depsgraph *depsgraph)
651 {
652  return DEG_get_evaluated_id(depsgraph, id);
653 }
654 
655 static ID *rna_ID_copy(ID *id, Main *bmain)
656 {
657  ID *newid = BKE_id_copy(bmain, id);
658 
659  if (newid != NULL) {
660  id_us_min(newid);
661  }
662 
664 
665  return newid;
666 }
667 
668 static void rna_ID_asset_mark(ID *id)
669 {
670  if (ED_asset_mark_id(id)) {
673  }
674 }
675 
676 static void rna_ID_asset_generate_preview(ID *id, bContext *C)
677 {
679 
682 }
683 
684 static void rna_ID_asset_clear(ID *id)
685 {
686  if (ED_asset_clear_id(id)) {
689  }
690 }
691 
692 static ID *rna_ID_override_create(ID *id, Main *bmain, bool remap_local_usages)
693 {
694  if (!ID_IS_OVERRIDABLE_LIBRARY(id)) {
695  return NULL;
696  }
697 
698  if (remap_local_usages) {
699  BKE_main_id_tag_all(bmain, LIB_TAG_DOIT, true);
700  }
701 
702  ID *local_id = NULL;
703 # ifdef WITH_PYTHON
705 # endif
706 
707  local_id = BKE_lib_override_library_create_from_id(bmain, id, remap_local_usages);
708 
709 # ifdef WITH_PYTHON
711 # endif
712 
713  if (remap_local_usages) {
714  BKE_main_id_tag_all(bmain, LIB_TAG_DOIT, false);
715  }
716 
719 
720  return local_id;
721 }
722 
723 static ID *rna_ID_override_hierarchy_create(
724  ID *id, Main *bmain, Scene *scene, ViewLayer *view_layer, ID *id_instance_hint)
725 {
726  if (!ID_IS_OVERRIDABLE_LIBRARY(id)) {
727  return NULL;
728  }
729 
730  BKE_main_id_tag_all(bmain, LIB_TAG_DOIT, false);
731 
732  ID *id_root_override = NULL;
733 
734 # ifdef WITH_PYTHON
736 # endif
737 
739  bmain, scene, view_layer, NULL, id, id, id_instance_hint, &id_root_override, false);
740 
741 # ifdef WITH_PYTHON
743 # endif
744 
747 
748  return id_root_override;
749 }
750 
751 static void rna_ID_override_template_create(ID *id, ReportList *reports)
752 {
753  if (!U.experimental.use_override_templates) {
754  BKE_report(reports, RPT_ERROR, "Override template experimental feature is disabled");
755  return;
756  }
757  if (ID_IS_LINKED(id)) {
758  BKE_report(reports, RPT_ERROR, "Unable to create override template for linked data-blocks");
759  return;
760  }
761  if (ID_IS_OVERRIDE_LIBRARY(id)) {
762  BKE_report(
763  reports, RPT_ERROR, "Unable to create override template for overridden data-blocks");
764  return;
765  }
767 
769 }
770 
771 static void rna_ID_override_library_operations_update(ID *id,
772  IDOverrideLibrary *UNUSED(override_library),
773  Main *bmain,
774  ReportList *reports)
775 {
776  if (!ID_IS_OVERRIDE_LIBRARY_REAL(id)) {
777  BKE_reportf(reports, RPT_ERROR, "ID '%s' isn't an override", id->name);
778  return;
779  }
780 
781  if (ID_IS_LINKED(id)) {
782  BKE_reportf(reports, RPT_ERROR, "ID '%s' is linked, cannot edit its overrides", id->name);
783  return;
784  }
785 
787 
789 }
790 
791 static void rna_ID_override_library_reset(ID *id,
792  IDOverrideLibrary *UNUSED(override_library),
793  Main *bmain,
794  ReportList *reports,
795  bool do_hierarchy,
796  bool set_system_override)
797 {
798  if (!ID_IS_OVERRIDE_LIBRARY_REAL(id)) {
799  BKE_reportf(reports, RPT_ERROR, "ID '%s' isn't an override", id->name);
800  return;
801  }
802 
803  if (do_hierarchy) {
804  BKE_lib_override_library_id_hierarchy_reset(bmain, id, set_system_override);
805  }
806  else {
807  BKE_lib_override_library_id_reset(bmain, id, set_system_override);
808  }
809 
811 }
812 
813 static void rna_ID_override_library_destroy(ID *id,
814  IDOverrideLibrary *UNUSED(override_library),
815  Main *bmain,
816  ReportList *reports,
817  bool do_hierarchy)
818 {
819  if (!ID_IS_OVERRIDE_LIBRARY_REAL(id)) {
820  BKE_reportf(reports, RPT_ERROR, "ID '%s' isn't an override", id->name);
821  return;
822  }
823 
824  if (do_hierarchy) {
826  }
827  else {
829  BKE_id_delete(bmain, id);
830  }
831 
833 }
834 
835 static IDOverrideLibraryProperty *rna_ID_override_library_properties_add(
836  IDOverrideLibrary *override_library, ReportList *reports, const char rna_path[])
837 {
838  bool created;
840  override_library, rna_path, &created);
841 
842  if (!created) {
843  BKE_report(reports, RPT_DEBUG, "No new override property created, property already exists");
844  }
845 
847  return result;
848 }
849 
850 static void rna_ID_override_library_properties_remove(IDOverrideLibrary *override_library,
851  ReportList *reports,
852  IDOverrideLibraryProperty *override_property)
853 {
854  if (BLI_findindex(&override_library->properties, override_property) == -1) {
855  BKE_report(reports, RPT_ERROR, "Override property cannot be removed");
856  return;
857  }
858 
859  BKE_lib_override_library_property_delete(override_library, override_property);
860 
862 }
863 
864 static IDOverrideLibraryPropertyOperation *rna_ID_override_library_property_operations_add(
865  IDOverrideLibraryProperty *override_property,
866  ReportList *reports,
867  int operation,
868  const char *subitem_refname,
869  const char *subitem_locname,
870  int subitem_refindex,
871  int subitem_locindex)
872 {
873  bool created;
874  bool strict;
876  override_property,
877  operation,
878  subitem_refname,
879  subitem_locname,
880  subitem_refindex,
881  subitem_locindex,
882  false,
883  &strict,
884  &created);
885  if (!created) {
886  BKE_report(reports, RPT_DEBUG, "No new override operation created, operation already exists");
887  }
888 
890  return result;
891 }
892 
893 static void rna_ID_override_library_property_operations_remove(
894  IDOverrideLibraryProperty *override_property,
895  ReportList *reports,
896  IDOverrideLibraryPropertyOperation *override_operation)
897 {
898  if (BLI_findindex(&override_property->operations, override_operation) == -1) {
899  BKE_report(reports, RPT_ERROR, "Override operation cannot be removed");
900  return;
901  }
902 
903  BKE_lib_override_library_property_operation_delete(override_property, override_operation);
904 
906 }
907 
908 static void rna_ID_update_tag(ID *id, Main *bmain, ReportList *reports, int flag)
909 {
910  /* XXX, new function for this! */
911 # if 0
912  if (ob->type == OB_FONT) {
913  Curve *cu = ob->data;
914  freedisplist(&cu->disp);
915  BKE_vfont_to_curve(bmain, sce, ob, FO_EDIT, NULL);
916  }
917 # endif
918 
919  if (flag == 0) {
920  /* pass */
921  }
922  else {
923  int allow_flag = 0;
924 
925  /* ensure flag us correct for the type */
926  switch (GS(id->name)) {
927  case ID_OB:
928  /* TODO(sergey): This is kind of difficult to predict since different
929  * object types supports different flags. Maybe does not worth checking
930  * for this at all. Or maybe let dependency graph to return whether
931  * the tag was valid or not. */
932  allow_flag = ID_RECALC_ALL;
933  break;
934  /* Could add particle updates later */
935 # if 0
936  case ID_PA:
937  allow_flag = OB_RECALC_ALL | PSYS_RECALC;
938  break;
939 # endif
940  case ID_AC:
941  allow_flag = ID_RECALC_ANIMATION;
942  break;
943  default:
944  if (id_can_have_animdata(id)) {
945  allow_flag = ID_RECALC_ANIMATION;
946  }
947  }
948 
949  if (flag & ~allow_flag) {
951  BKE_reportf(reports,
952  RPT_ERROR,
953  "%s is not compatible with %s 'refresh' options",
954  RNA_struct_identifier(srna),
955  allow_flag ? "the specified" : "any");
956  return;
957  }
958  }
959 
960  DEG_id_tag_update_ex(bmain, id, flag);
961 }
962 
963 static void rna_ID_user_clear(ID *id)
964 {
965  id_fake_user_clear(id);
966  id->us = 0; /* don't save */
967 }
968 
969 static void rna_ID_user_remap(ID *id, Main *bmain, ID *new_id)
970 {
971  if ((GS(id->name) == GS(new_id->name)) && (id != new_id)) {
972  /* For now, do not allow remapping data in linked data from here... */
975  }
976 }
977 
978 static struct ID *rna_ID_make_local(struct ID *self, Main *bmain, bool UNUSED(clear_proxy))
979 {
980  BKE_lib_id_make_local(bmain, self, 0);
981 
982  ID *ret_id = self->newid ? self->newid : self;
984  return ret_id;
985 }
986 
987 static AnimData *rna_ID_animation_data_create(ID *id, Main *bmain)
988 {
989  AnimData *adt = BKE_animdata_ensure_id(id);
991  return adt;
992 }
993 
994 static void rna_ID_animation_data_free(ID *id, Main *bmain)
995 {
996  BKE_animdata_free(id, true);
998 }
999 
1000 # ifdef WITH_PYTHON
1002 {
1003  ID *id = (ID *)ptr->data;
1004  return &id->py_instance;
1005 }
1006 # endif
1007 
1008 static void rna_IDPArray_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
1009 {
1010  IDProperty *prop = (IDProperty *)ptr->data;
1011  rna_iterator_array_begin(iter, IDP_IDPArray(prop), sizeof(IDProperty), prop->len, 0, NULL);
1012 }
1013 
1014 static int rna_IDPArray_length(PointerRNA *ptr)
1015 {
1016  IDProperty *prop = (IDProperty *)ptr->data;
1017  return prop->len;
1018 }
1019 
1020 int rna_IDMaterials_assign_int(PointerRNA *ptr, int key, const PointerRNA *assign_ptr)
1021 {
1022  ID *id = ptr->owner_id;
1023  short *totcol = BKE_id_material_len_p(id);
1024  Material *mat_id = (Material *)assign_ptr->owner_id;
1025  if (totcol && (key >= 0 && key < *totcol)) {
1028  BKE_id_material_assign(G_MAIN, id, mat_id, key + 1);
1029  return 1;
1030  }
1031  else {
1032  return 0;
1033  }
1034 }
1035 
1036 static void rna_IDMaterials_append_id(ID *id, Main *bmain, Material *ma)
1037 {
1038  BKE_id_material_append(bmain, id, ma);
1039 
1042 }
1043 
1044 static Material *rna_IDMaterials_pop_id(ID *id, Main *bmain, ReportList *reports, int index_i)
1045 {
1046  Material *ma;
1047  short *totcol = BKE_id_material_len_p(id);
1048  const short totcol_orig = *totcol;
1049  if (index_i < 0) {
1050  index_i += (*totcol);
1051  }
1052 
1053  if ((index_i < 0) || (index_i >= (*totcol))) {
1054  BKE_report(reports, RPT_ERROR, "Index out of range");
1055  return NULL;
1056  }
1057 
1058  ma = BKE_id_material_pop(bmain, id, index_i);
1059 
1060  if (*totcol == totcol_orig) {
1061  BKE_report(reports, RPT_ERROR, "No material to removed");
1062  return NULL;
1063  }
1064 
1068 
1069  return ma;
1070 }
1071 
1072 static void rna_IDMaterials_clear_id(ID *id, Main *bmain)
1073 {
1074  BKE_id_material_clear(bmain, id);
1075 
1079 }
1080 
1081 static void rna_Library_filepath_set(PointerRNA *ptr, const char *value)
1082 {
1083  Library *lib = (Library *)ptr->data;
1086 }
1087 
1088 /* ***** ImagePreview ***** */
1089 
1090 static void rna_ImagePreview_is_custom_set(PointerRNA *ptr, int value, enum eIconSizes size)
1091 {
1092  ID *id = ptr->owner_id;
1093  PreviewImage *prv_img = (PreviewImage *)ptr->data;
1094 
1095  if (id != NULL) {
1096  BLI_assert(prv_img == BKE_previewimg_id_ensure(id));
1097  }
1098 
1099  if ((value && (prv_img->flag[size] & PRV_USER_EDITED)) ||
1100  (!value && !(prv_img->flag[size] & PRV_USER_EDITED))) {
1101  return;
1102  }
1103 
1104  if (value) {
1105  prv_img->flag[size] |= PRV_USER_EDITED;
1106  }
1107  else {
1108  prv_img->flag[size] &= ~PRV_USER_EDITED;
1109  }
1110 
1111  prv_img->flag[size] |= PRV_CHANGED;
1112 
1114 }
1115 
1116 static void rna_ImagePreview_size_get(PointerRNA *ptr, int *values, enum eIconSizes size)
1117 {
1118  ID *id = ptr->owner_id;
1119  PreviewImage *prv_img = (PreviewImage *)ptr->data;
1120 
1121  if (id != NULL) {
1122  BLI_assert(prv_img == BKE_previewimg_id_ensure(id));
1123  }
1124 
1125  BKE_previewimg_ensure(prv_img, size);
1126 
1127  values[0] = prv_img->w[size];
1128  values[1] = prv_img->h[size];
1129 }
1130 
1131 static void rna_ImagePreview_size_set(PointerRNA *ptr, const int *values, enum eIconSizes size)
1132 {
1133  ID *id = ptr->owner_id;
1134  PreviewImage *prv_img = (PreviewImage *)ptr->data;
1135 
1136  if (id != NULL) {
1137  BLI_assert(prv_img == BKE_previewimg_id_ensure(id));
1138  }
1139 
1141 
1142  if (values[0] && values[1]) {
1143  prv_img->rect[size] = MEM_callocN(values[0] * values[1] * sizeof(unsigned int), "prv_rect");
1144 
1145  prv_img->w[size] = values[0];
1146  prv_img->h[size] = values[1];
1147  }
1148 
1149  prv_img->flag[size] |= (PRV_CHANGED | PRV_USER_EDITED);
1150 }
1151 
1152 static int rna_ImagePreview_pixels_get_length(const PointerRNA *ptr,
1154  enum eIconSizes size)
1155 {
1156  ID *id = ptr->owner_id;
1157  PreviewImage *prv_img = (PreviewImage *)ptr->data;
1158 
1159  if (id != NULL) {
1160  BLI_assert(prv_img == BKE_previewimg_id_ensure(id));
1161  }
1162 
1163  BKE_previewimg_ensure(prv_img, size);
1164 
1165  length[0] = prv_img->w[size] * prv_img->h[size];
1166 
1167  return length[0];
1168 }
1169 
1170 static void rna_ImagePreview_pixels_get(PointerRNA *ptr, int *values, enum eIconSizes size)
1171 {
1172  ID *id = ptr->owner_id;
1173  PreviewImage *prv_img = (PreviewImage *)ptr->data;
1174 
1175  if (id != NULL) {
1176  BLI_assert(prv_img == BKE_previewimg_id_ensure(id));
1177  }
1178 
1179  BKE_previewimg_ensure(prv_img, size);
1180 
1181  memcpy(values, prv_img->rect[size], prv_img->w[size] * prv_img->h[size] * sizeof(unsigned int));
1182 }
1183 
1184 static void rna_ImagePreview_pixels_set(PointerRNA *ptr, const int *values, enum eIconSizes size)
1185 {
1186  ID *id = ptr->owner_id;
1187  PreviewImage *prv_img = (PreviewImage *)ptr->data;
1188 
1189  if (id != NULL) {
1190  BLI_assert(prv_img == BKE_previewimg_id_ensure(id));
1191  }
1192 
1193  memcpy(prv_img->rect[size], values, prv_img->w[size] * prv_img->h[size] * sizeof(unsigned int));
1194  prv_img->flag[size] |= PRV_USER_EDITED;
1195 }
1196 
1197 static int rna_ImagePreview_pixels_float_get_length(const PointerRNA *ptr,
1199  enum eIconSizes size)
1200 {
1201  ID *id = ptr->owner_id;
1202  PreviewImage *prv_img = (PreviewImage *)ptr->data;
1203 
1204  BLI_assert(sizeof(unsigned int) == 4);
1205 
1206  if (id != NULL) {
1207  BLI_assert(prv_img == BKE_previewimg_id_ensure(id));
1208  }
1209 
1210  BKE_previewimg_ensure(prv_img, size);
1211 
1212  length[0] = prv_img->w[size] * prv_img->h[size] * 4;
1213 
1214  return length[0];
1215 }
1216 
1217 static void rna_ImagePreview_pixels_float_get(PointerRNA *ptr, float *values, enum eIconSizes size)
1218 {
1219  ID *id = ptr->owner_id;
1220  PreviewImage *prv_img = (PreviewImage *)ptr->data;
1221 
1222  unsigned char *data = (unsigned char *)prv_img->rect[size];
1223  const size_t len = prv_img->w[size] * prv_img->h[size] * 4;
1224  size_t i;
1225 
1226  BLI_assert(sizeof(unsigned int) == 4);
1227 
1228  if (id != NULL) {
1229  BLI_assert(prv_img == BKE_previewimg_id_ensure(id));
1230  }
1231 
1232  BKE_previewimg_ensure(prv_img, size);
1233 
1234  for (i = 0; i < len; i++) {
1235  values[i] = data[i] * (1.0f / 255.0f);
1236  }
1237 }
1238 
1239 static void rna_ImagePreview_pixels_float_set(PointerRNA *ptr,
1240  const float *values,
1241  enum eIconSizes size)
1242 {
1243  ID *id = ptr->owner_id;
1244  PreviewImage *prv_img = (PreviewImage *)ptr->data;
1245 
1246  unsigned char *data = (unsigned char *)prv_img->rect[size];
1247  const size_t len = prv_img->w[size] * prv_img->h[size] * 4;
1248  size_t i;
1249 
1250  BLI_assert(sizeof(unsigned int) == 4);
1251 
1252  if (id != NULL) {
1253  BLI_assert(prv_img == BKE_previewimg_id_ensure(id));
1254  }
1255 
1256  for (i = 0; i < len; i++) {
1257  data[i] = unit_float_to_uchar_clamp(values[i]);
1258  }
1259  prv_img->flag[size] |= PRV_USER_EDITED;
1260 }
1261 
1262 static void rna_ImagePreview_is_image_custom_set(PointerRNA *ptr, bool value)
1263 {
1264  rna_ImagePreview_is_custom_set(ptr, value, ICON_SIZE_PREVIEW);
1265 }
1266 
1267 static void rna_ImagePreview_image_size_get(PointerRNA *ptr, int *values)
1268 {
1269  rna_ImagePreview_size_get(ptr, values, ICON_SIZE_PREVIEW);
1270 }
1271 
1272 static void rna_ImagePreview_image_size_set(PointerRNA *ptr, const int *values)
1273 {
1274  rna_ImagePreview_size_set(ptr, values, ICON_SIZE_PREVIEW);
1275 }
1276 
1277 static int rna_ImagePreview_image_pixels_get_length(const PointerRNA *ptr,
1279 {
1280  return rna_ImagePreview_pixels_get_length(ptr, length, ICON_SIZE_PREVIEW);
1281 }
1282 
1283 static void rna_ImagePreview_image_pixels_get(PointerRNA *ptr, int *values)
1284 {
1285  rna_ImagePreview_pixels_get(ptr, values, ICON_SIZE_PREVIEW);
1286 }
1287 
1288 static void rna_ImagePreview_image_pixels_set(PointerRNA *ptr, const int *values)
1289 {
1290  rna_ImagePreview_pixels_set(ptr, values, ICON_SIZE_PREVIEW);
1291 }
1292 
1293 static int rna_ImagePreview_image_pixels_float_get_length(const PointerRNA *ptr,
1295 {
1296  return rna_ImagePreview_pixels_float_get_length(ptr, length, ICON_SIZE_PREVIEW);
1297 }
1298 
1299 static void rna_ImagePreview_image_pixels_float_get(PointerRNA *ptr, float *values)
1300 {
1301  rna_ImagePreview_pixels_float_get(ptr, values, ICON_SIZE_PREVIEW);
1302 }
1303 
1304 static void rna_ImagePreview_image_pixels_float_set(PointerRNA *ptr, const float *values)
1305 {
1306  rna_ImagePreview_pixels_float_set(ptr, values, ICON_SIZE_PREVIEW);
1307 }
1308 
1309 static void rna_ImagePreview_is_icon_custom_set(PointerRNA *ptr, bool value)
1310 {
1311  rna_ImagePreview_is_custom_set(ptr, value, ICON_SIZE_ICON);
1312 }
1313 
1314 static void rna_ImagePreview_icon_size_get(PointerRNA *ptr, int *values)
1315 {
1316  rna_ImagePreview_size_get(ptr, values, ICON_SIZE_ICON);
1317 }
1318 
1319 static void rna_ImagePreview_icon_size_set(PointerRNA *ptr, const int *values)
1320 {
1321  rna_ImagePreview_size_set(ptr, values, ICON_SIZE_ICON);
1322 }
1323 
1324 static int rna_ImagePreview_icon_pixels_get_length(const PointerRNA *ptr,
1326 {
1327  return rna_ImagePreview_pixels_get_length(ptr, length, ICON_SIZE_ICON);
1328 }
1329 
1330 static void rna_ImagePreview_icon_pixels_get(PointerRNA *ptr, int *values)
1331 {
1332  rna_ImagePreview_pixels_get(ptr, values, ICON_SIZE_ICON);
1333 }
1334 
1335 static void rna_ImagePreview_icon_pixels_set(PointerRNA *ptr, const int *values)
1336 {
1337  rna_ImagePreview_pixels_set(ptr, values, ICON_SIZE_ICON);
1338 }
1339 
1340 static int rna_ImagePreview_icon_pixels_float_get_length(const PointerRNA *ptr,
1342 {
1343  return rna_ImagePreview_pixels_float_get_length(ptr, length, ICON_SIZE_ICON);
1344 }
1345 
1346 static void rna_ImagePreview_icon_pixels_float_get(PointerRNA *ptr, float *values)
1347 {
1348  rna_ImagePreview_pixels_float_get(ptr, values, ICON_SIZE_ICON);
1349 }
1350 
1351 static void rna_ImagePreview_icon_pixels_float_set(PointerRNA *ptr, const float *values)
1352 {
1353  rna_ImagePreview_pixels_float_set(ptr, values, ICON_SIZE_ICON);
1354 }
1355 
1356 static int rna_ImagePreview_icon_id_get(PointerRNA *ptr)
1357 {
1358  /* Using a callback here allows us to only generate icon matching
1359  * that preview when icon_id is requested. */
1361 }
1362 static void rna_ImagePreview_icon_reload(PreviewImage *prv)
1363 {
1364  /* will lazy load on next use, but only in case icon is not user-modified! */
1365  if (!(prv->flag[ICON_SIZE_ICON] & PRV_USER_EDITED) &&
1366  !(prv->flag[ICON_SIZE_PREVIEW] & PRV_USER_EDITED)) {
1367  BKE_previewimg_clear(prv);
1368  }
1369 }
1370 
1371 static PointerRNA rna_IDPreview_get(PointerRNA *ptr)
1372 {
1373  ID *id = (ID *)ptr->data;
1374  PreviewImage *prv_img = BKE_previewimg_id_get(id);
1375 
1376  return rna_pointer_inherit_refine(ptr, &RNA_ImagePreview, prv_img);
1377 }
1378 
1379 static IDProperty **rna_IDPropertyWrapPtr_idprops(PointerRNA *ptr)
1380 {
1381  if (ptr == NULL) {
1382  return NULL;
1383  }
1384  return (IDProperty **)&ptr->data;
1385 }
1386 
1387 static void rna_Library_version_get(PointerRNA *ptr, int *value)
1388 {
1389  Library *lib = (Library *)ptr->data;
1390  value[0] = lib->versionfile / 100;
1391  value[1] = lib->versionfile % 100;
1392  value[2] = lib->subversionfile;
1393 }
1394 
1395 static void rna_Library_reload(Library *lib, bContext *C, ReportList *reports)
1396 {
1397 # ifdef WITH_PYTHON
1399 # endif
1400 
1401  WM_lib_reload(lib, C, reports);
1402 
1403 # ifdef WITH_PYTHON
1405 # endif
1406 }
1407 
1408 #else
1409 
1411 {
1412  StructRNA *srna;
1413  PropertyRNA *prop;
1414 
1415  /* this is struct is used for holding the virtual
1416  * PropertyRNA's for ID properties */
1417  srna = RNA_def_struct(brna, "PropertyGroupItem", NULL);
1418  RNA_def_struct_sdna(srna, "IDProperty");
1420  srna, "ID Property", "Property that stores arbitrary, user defined properties");
1421 
1422  /* IDP_STRING */
1423  prop = RNA_def_property(srna, "string", PROP_STRING, PROP_NONE);
1425 
1426  /* IDP_INT */
1427  prop = RNA_def_property(srna, "int", PROP_INT, PROP_NONE);
1429 
1430  prop = RNA_def_property(srna, "int_array", PROP_INT, PROP_NONE);
1432  RNA_def_property_array(prop, 1);
1433 
1434  /* IDP_FLOAT */
1435  prop = RNA_def_property(srna, "float", PROP_FLOAT, PROP_NONE);
1437 
1438  prop = RNA_def_property(srna, "float_array", PROP_FLOAT, PROP_NONE);
1440  RNA_def_property_array(prop, 1);
1441 
1442  /* IDP_DOUBLE */
1443  prop = RNA_def_property(srna, "double", PROP_FLOAT, PROP_NONE);
1445 
1446  prop = RNA_def_property(srna, "double_array", PROP_FLOAT, PROP_NONE);
1448  RNA_def_property_array(prop, 1);
1449 
1450  /* IDP_GROUP */
1451  prop = RNA_def_property(srna, "group", PROP_POINTER, PROP_NONE);
1454  RNA_def_property_struct_type(prop, "PropertyGroup");
1455 
1456  prop = RNA_def_property(srna, "collection", PROP_COLLECTION, PROP_NONE);
1458  RNA_def_property_struct_type(prop, "PropertyGroup");
1459 
1460  prop = RNA_def_property(srna, "idp_array", PROP_COLLECTION, PROP_NONE);
1461  RNA_def_property_struct_type(prop, "PropertyGroup");
1463  "rna_IDPArray_begin",
1464  "rna_iterator_array_next",
1465  "rna_iterator_array_end",
1466  "rna_iterator_array_get",
1467  "rna_IDPArray_length",
1468  NULL,
1469  NULL,
1470  NULL);
1472 
1473  /* never tested, maybe its useful to have this? */
1474 # if 0
1475  prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
1478  RNA_def_property_ui_text(prop, "Name", "Unique name used in the code and scripting");
1479  RNA_def_struct_name_property(srna, prop);
1480 # endif
1481 
1482  /* IDP_ID */
1483  prop = RNA_def_property(srna, "id", PROP_POINTER, PROP_NONE);
1485  RNA_def_property_struct_type(prop, "ID");
1486 
1487  /* ID property groups > level 0, since level 0 group is merged
1488  * with native RNA properties. the builtin_properties will take
1489  * care of the properties here */
1490  srna = RNA_def_struct(brna, "PropertyGroup", NULL);
1491  RNA_def_struct_sdna(srna, "IDPropertyGroup");
1492  RNA_def_struct_ui_text(srna, "ID Property Group", "Group of ID properties");
1493  RNA_def_struct_idprops_func(srna, "rna_PropertyGroup_idprops");
1495  srna, "rna_PropertyGroup_register", "rna_PropertyGroup_unregister", NULL);
1496  RNA_def_struct_refine_func(srna, "rna_PropertyGroup_refine");
1497 
1498  /* important so python types can have their name used in list views
1499  * however this isn't perfect because it overrides how python would set the name
1500  * when we only really want this so RNA_def_struct_name_property() is set to something useful */
1501  prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
1503  // RNA_def_property_clear_flag(prop, PROP_EDITABLE);
1504  RNA_def_property_ui_text(prop, "Name", "Unique name used in the code and scripting");
1505  RNA_def_struct_name_property(srna, prop);
1506 }
1507 
1509 {
1510  StructRNA *srna;
1511  FunctionRNA *func;
1512  PropertyRNA *parm;
1513 
1514  /* for mesh/mball/curve materials */
1515  srna = RNA_def_struct(brna, "IDMaterials", NULL);
1516  RNA_def_struct_sdna(srna, "ID");
1517  RNA_def_struct_ui_text(srna, "ID Materials", "Collection of materials");
1518 
1519  func = RNA_def_function(srna, "append", "rna_IDMaterials_append_id");
1521  RNA_def_function_ui_description(func, "Add a new material to the data-block");
1522  parm = RNA_def_pointer(func, "material", "Material", "", "Material to add");
1524 
1525  func = RNA_def_function(srna, "pop", "rna_IDMaterials_pop_id");
1527  RNA_def_function_ui_description(func, "Remove a material from the data-block");
1528  parm = RNA_def_int(
1529  func, "index", -1, -MAXMAT, MAXMAT, "", "Index of material to remove", 0, MAXMAT);
1530  parm = RNA_def_pointer(func, "material", "Material", "", "Material to remove");
1531  RNA_def_function_return(func, parm);
1532 
1533  func = RNA_def_function(srna, "clear", "rna_IDMaterials_clear_id");
1535  RNA_def_function_ui_description(func, "Remove all materials from the data-block");
1536 }
1537 
1539 {
1540  StructRNA *srna;
1541  FunctionRNA *func;
1542  PropertyRNA *prop;
1543 
1544  srna = RNA_def_struct(brna, "ImagePreview", NULL);
1545  RNA_def_struct_sdna(srna, "PreviewImage");
1546  RNA_def_struct_ui_text(srna, "Image Preview", "Preview image and icon");
1547 
1548  prop = RNA_def_property(srna, "is_image_custom", PROP_BOOLEAN, PROP_NONE);
1549  RNA_def_property_boolean_sdna(prop, NULL, "flag[ICON_SIZE_PREVIEW]", PRV_USER_EDITED);
1550  RNA_def_property_boolean_funcs(prop, NULL, "rna_ImagePreview_is_image_custom_set");
1552  "Custom Image",
1553  "True if this preview image has been modified by py script,"
1554  "and is no more auto-generated by Blender");
1555 
1556  prop = RNA_def_int_vector(
1557  srna, "image_size", 2, NULL, 0, 0, "Image Size", "Width and height in pixels", 0, 0);
1560  prop, "rna_ImagePreview_image_size_get", "rna_ImagePreview_image_size_set", NULL);
1561 
1562  prop = RNA_def_property(srna, "image_pixels", PROP_INT, PROP_NONE);
1565  RNA_def_property_ui_text(prop, "Image Pixels", "Image pixels, as bytes (always 32-bit RGBA)");
1566  RNA_def_property_dynamic_array_funcs(prop, "rna_ImagePreview_image_pixels_get_length");
1568  prop, "rna_ImagePreview_image_pixels_get", "rna_ImagePreview_image_pixels_set", NULL);
1569 
1570  prop = RNA_def_property(srna, "image_pixels_float", PROP_FLOAT, PROP_NONE);
1574  prop, "Float Image Pixels", "Image pixels components, as floats (RGBA concatenated values)");
1575  RNA_def_property_dynamic_array_funcs(prop, "rna_ImagePreview_image_pixels_float_get_length");
1577  "rna_ImagePreview_image_pixels_float_get",
1578  "rna_ImagePreview_image_pixels_float_set",
1579  NULL);
1580 
1581  prop = RNA_def_property(srna, "is_icon_custom", PROP_BOOLEAN, PROP_NONE);
1582  RNA_def_property_boolean_sdna(prop, NULL, "flag[ICON_SIZE_ICON]", PRV_USER_EDITED);
1583  RNA_def_property_boolean_funcs(prop, NULL, "rna_ImagePreview_is_icon_custom_set");
1585  "Custom Icon",
1586  "True if this preview icon has been modified by py script,"
1587  "and is no more auto-generated by Blender");
1588 
1589  prop = RNA_def_int_vector(
1590  srna, "icon_size", 2, NULL, 0, 0, "Icon Size", "Width and height in pixels", 0, 0);
1593  prop, "rna_ImagePreview_icon_size_get", "rna_ImagePreview_icon_size_set", NULL);
1594 
1595  prop = RNA_def_property(srna, "icon_pixels", PROP_INT, PROP_NONE);
1598  RNA_def_property_ui_text(prop, "Icon Pixels", "Icon pixels, as bytes (always 32-bit RGBA)");
1599  RNA_def_property_dynamic_array_funcs(prop, "rna_ImagePreview_icon_pixels_get_length");
1601  prop, "rna_ImagePreview_icon_pixels_get", "rna_ImagePreview_icon_pixels_set", NULL);
1602 
1603  prop = RNA_def_property(srna, "icon_pixels_float", PROP_FLOAT, PROP_NONE);
1607  prop, "Float Icon Pixels", "Icon pixels components, as floats (RGBA concatenated values)");
1608  RNA_def_property_dynamic_array_funcs(prop, "rna_ImagePreview_icon_pixels_float_get_length");
1610  "rna_ImagePreview_icon_pixels_float_get",
1611  "rna_ImagePreview_icon_pixels_float_set",
1612  NULL);
1613 
1614  prop = RNA_def_int(srna,
1615  "icon_id",
1616  0,
1617  INT_MIN,
1618  INT_MAX,
1619  "Icon ID",
1620  "Unique integer identifying this preview as an icon (zero means invalid)",
1621  INT_MIN,
1622  INT_MAX);
1624  RNA_def_property_int_funcs(prop, "rna_ImagePreview_icon_id_get", NULL, NULL);
1625 
1626  func = RNA_def_function(srna, "reload", "rna_ImagePreview_icon_reload");
1627  RNA_def_function_ui_description(func, "Reload the preview from its source path");
1628 }
1629 
1631 {
1632  StructRNA *srna;
1633  PropertyRNA *prop;
1634 
1635  static const EnumPropertyItem override_library_property_flag_items[] = {
1637  "MANDATORY",
1638  0,
1639  "Mandatory",
1640  "For templates, prevents the user from removing predefined operation (NOT USED)"},
1642  "LOCKED",
1643  0,
1644  "Locked",
1645  "Prevents the user from modifying that override operation (NOT USED)"},
1646  {0, NULL, 0, NULL, NULL},
1647  };
1648 
1649  srna = RNA_def_struct(brna, "IDOverrideLibraryPropertyOperation", NULL);
1651  "ID Library Override Property Operation",
1652  "Description of an override operation over an overridden property");
1653 
1654  prop = RNA_def_enum(srna,
1655  "operation",
1658  "Operation",
1659  "What override operation is performed");
1660  RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* For now. */
1661 
1662  prop = RNA_def_enum(
1663  srna, "flag", override_library_property_flag_items, 0, "Flags", "Optional flags (NOT USED)");
1664  RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* For now. */
1665 
1666  prop = RNA_def_string(srna,
1667  "subitem_reference_name",
1668  NULL,
1669  INT_MAX,
1670  "Subitem Reference Name",
1671  "Used to handle insertions into collection");
1672  RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* For now. */
1674  "rna_ID_override_library_property_operation_refname_get",
1675  "rna_ID_override_library_property_operation_refname_length",
1676  NULL);
1677 
1678  prop = RNA_def_string(srna,
1679  "subitem_local_name",
1680  NULL,
1681  INT_MAX,
1682  "Subitem Local Name",
1683  "Used to handle insertions into collection");
1684  RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* For now. */
1686  "rna_ID_override_library_property_operation_locname_get",
1687  "rna_ID_override_library_property_operation_locname_length",
1688  NULL);
1689 
1690  prop = RNA_def_int(srna,
1691  "subitem_reference_index",
1692  -1,
1693  -1,
1694  INT_MAX,
1695  "Subitem Reference Index",
1696  "Used to handle insertions into collection",
1697  -1,
1698  INT_MAX);
1699  RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* For now. */
1700 
1701  prop = RNA_def_int(srna,
1702  "subitem_local_index",
1703  -1,
1704  -1,
1705  INT_MAX,
1706  "Subitem Local Index",
1707  "Used to handle insertions into collection",
1708  -1,
1709  INT_MAX);
1710  RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* For now. */
1711 }
1712 
1714 {
1715  StructRNA *srna;
1716  FunctionRNA *func;
1717  PropertyRNA *parm;
1718 
1719  RNA_def_property_srna(cprop, "IDOverrideLibraryPropertyOperations");
1720  srna = RNA_def_struct(brna, "IDOverrideLibraryPropertyOperations", NULL);
1721  RNA_def_struct_sdna(srna, "IDOverrideLibraryProperty");
1722  RNA_def_struct_ui_text(srna, "Override Operations", "Collection of override operations");
1723 
1724  /* Add Property */
1725  func = RNA_def_function(srna, "add", "rna_ID_override_library_property_operations_add");
1726  RNA_def_function_ui_description(func, "Add a new operation");
1728  parm = RNA_def_enum(func,
1729  "operation",
1732  "Operation",
1733  "What override operation is performed");
1735  parm = RNA_def_string(func,
1736  "subitem_reference_name",
1737  NULL,
1738  INT_MAX,
1739  "Subitem Reference Name",
1740  "Used to handle insertions into collection");
1741  parm = RNA_def_string(func,
1742  "subitem_local_name",
1743  NULL,
1744  INT_MAX,
1745  "Subitem Local Name",
1746  "Used to handle insertions into collection");
1747  parm = RNA_def_int(func,
1748  "subitem_reference_index",
1749  -1,
1750  -1,
1751  INT_MAX,
1752  "Subitem Reference Index",
1753  "Used to handle insertions into collection",
1754  -1,
1755  INT_MAX);
1756  parm = RNA_def_int(func,
1757  "subitem_local_index",
1758  -1,
1759  -1,
1760  INT_MAX,
1761  "Subitem Local Index",
1762  "Used to handle insertions into collection",
1763  -1,
1764  INT_MAX);
1765  parm = RNA_def_pointer(func,
1766  "property",
1767  "IDOverrideLibraryPropertyOperation",
1768  "New Operation",
1769  "Created operation");
1770  RNA_def_function_return(func, parm);
1771 
1772  func = RNA_def_function(srna, "remove", "rna_ID_override_library_property_operations_remove");
1773  RNA_def_function_ui_description(func, "Remove and delete an operation");
1775  parm = RNA_def_pointer(func,
1776  "operation",
1777  "IDOverrideLibraryPropertyOperation",
1778  "Operation",
1779  "Override operation to be deleted");
1781 }
1782 
1784 {
1785  StructRNA *srna;
1786  PropertyRNA *prop;
1787 
1788  srna = RNA_def_struct(brna, "IDOverrideLibraryProperty", NULL);
1790  srna, "ID Library Override Property", "Description of an overridden property");
1791 
1792  /* String pointer, we *should* add get/set/etc.
1793  * But NULL rna_path would be a nasty bug anyway. */
1794  prop = RNA_def_string(srna,
1795  "rna_path",
1796  NULL,
1797  INT_MAX,
1798  "RNA Path",
1799  "RNA path leading to that property, from owning ID");
1800  RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* For now. */
1801 
1802  prop = RNA_def_collection(srna,
1803  "operations",
1804  "IDOverrideLibraryPropertyOperation",
1805  "Operations",
1806  "List of overriding operations for a property");
1809 
1811 }
1812 
1814 {
1815  StructRNA *srna;
1816  FunctionRNA *func;
1817  PropertyRNA *parm;
1818 
1819  RNA_def_property_srna(cprop, "IDOverrideLibraryProperties");
1820  srna = RNA_def_struct(brna, "IDOverrideLibraryProperties", NULL);
1821  RNA_def_struct_sdna(srna, "IDOverrideLibrary");
1822  RNA_def_struct_ui_text(srna, "Override Properties", "Collection of override properties");
1823 
1824  /* Add Property */
1825  func = RNA_def_function(srna, "add", "rna_ID_override_library_properties_add");
1827  func, "Add a property to the override library when it doesn't exist yet");
1829  parm = RNA_def_pointer(func,
1830  "property",
1831  "IDOverrideLibraryProperty",
1832  "New Property",
1833  "Newly created override property or existing one");
1834  RNA_def_function_return(func, parm);
1835  parm = RNA_def_string(
1836  func, "rna_path", NULL, 256, "RNA Path", "RNA-Path of the property to add");
1838 
1839  func = RNA_def_function(srna, "remove", "rna_ID_override_library_properties_remove");
1840  RNA_def_function_ui_description(func, "Remove and delete a property");
1842  parm = RNA_def_pointer(func,
1843  "property",
1844  "IDOverrideLibraryProperty",
1845  "Property",
1846  "Override property to be deleted");
1848 }
1849 
1851 {
1852  StructRNA *srna;
1853  PropertyRNA *prop;
1854  FunctionRNA *func;
1855 
1856  srna = RNA_def_struct(brna, "IDOverrideLibrary", NULL);
1858  srna, "ID Library Override", "Struct gathering all data needed by overridden linked IDs");
1859 
1860  prop = RNA_def_pointer(
1861  srna, "reference", "ID", "Reference ID", "Linked ID used as reference by this override");
1863 
1865  srna,
1866  "hierarchy_root",
1867  "ID",
1868  "Hierarchy Root ID",
1869  "Library override ID used as root of the override hierarchy this ID is a member of");
1870 
1871  prop = RNA_def_boolean(srna,
1872  "is_in_hierarchy",
1873  true,
1874  "Is In Hierarchy",
1875  "Whether this library override is defined as part of a library "
1876  "hierarchy, or as a single, isolated and autonomous override");
1880 
1881  prop = RNA_def_boolean(srna,
1882  "is_system_override",
1883  false,
1884  "Is System Override",
1885  "Whether this library override exists only for the override hierarchy, "
1886  "or if it is actually editable by the user");
1890 
1891  prop = RNA_def_collection(srna,
1892  "properties",
1893  "IDOverrideLibraryProperty",
1894  "Properties",
1895  "List of overridden properties");
1898 
1899  /* Update function. */
1900  func = RNA_def_function(srna, "operations_update", "rna_ID_override_library_operations_update");
1903  "Update the library override operations based on the "
1904  "differences between this override ID and its reference");
1905 
1906  func = RNA_def_function(srna, "reset", "rna_ID_override_library_reset");
1908  "Reset this override to match again its linked reference ID");
1911  func,
1912  "do_hierarchy",
1913  true,
1914  "",
1915  "Also reset all the dependencies of this override to match their reference linked IDs");
1916  RNA_def_boolean(func,
1917  "set_system_override",
1918  false,
1919  "",
1920  "Reset all user-editable overrides as (non-editable) system overrides");
1921 
1922  func = RNA_def_function(srna, "destroy", "rna_ID_override_library_destroy");
1924  func, "Delete this override ID and remap its usages to its linked reference ID instead");
1926  RNA_def_boolean(func,
1927  "do_hierarchy",
1928  true,
1929  "",
1930  "Also delete all the dependencies of this override and remap their usages to "
1931  "their reference linked IDs");
1932 
1934 }
1935 
1936 static void rna_def_ID(BlenderRNA *brna)
1937 {
1938  StructRNA *srna;
1939  FunctionRNA *func;
1940  PropertyRNA *prop, *parm;
1941 
1942  static const EnumPropertyItem update_flag_items[] = {
1943  {ID_RECALC_TRANSFORM, "OBJECT", 0, "Object", ""},
1944  {ID_RECALC_GEOMETRY, "DATA", 0, "Data", ""},
1945  {ID_RECALC_ANIMATION, "TIME", 0, "Time", ""},
1946  {0, NULL, 0, NULL, NULL},
1947  };
1948 
1949  srna = RNA_def_struct(brna, "ID", NULL);
1951  srna,
1952  "ID",
1953  "Base type for data-blocks, defining a unique name, linking from other libraries "
1954  "and garbage collection");
1956  RNA_def_struct_refine_func(srna, "rna_ID_refine");
1957  RNA_def_struct_idprops_func(srna, "rna_ID_idprops");
1958 
1959  prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
1960  RNA_def_property_ui_text(prop, "Name", "Unique data-block ID name");
1961  RNA_def_property_string_funcs(prop, "rna_ID_name_get", "rna_ID_name_length", "rna_ID_name_set");
1963  RNA_def_property_editable_func(prop, "rna_ID_name_editable");
1966  RNA_def_struct_name_property(srna, prop);
1967 
1968  prop = RNA_def_property(srna, "name_full", PROP_STRING, PROP_NONE);
1970  prop, "Full Name", "Unique data-block ID name, including library one is any");
1971  RNA_def_property_string_funcs(prop, "rna_ID_name_full_get", "rna_ID_name_full_length", NULL);
1974 
1975  prop = RNA_def_property(srna, "is_evaluated", PROP_BOOLEAN, PROP_NONE);
1977  prop,
1978  "Is Evaluated",
1979  "Whether this ID is runtime-only, evaluated data-block, or actual data from .blend file");
1980  RNA_def_property_boolean_funcs(prop, "rna_ID_is_evaluated_get", NULL);
1982 
1983  prop = RNA_def_property(srna, "original", PROP_POINTER, PROP_NONE);
1984  RNA_def_property_struct_type(prop, "ID");
1986  prop,
1987  "Original ID",
1988  "Actual data-block from .blend file (Main database) that generated that evaluated one");
1989  RNA_def_property_pointer_funcs(prop, "rna_ID_original_get", NULL, NULL, NULL);
1993 
1994  prop = RNA_def_property(srna, "users", PROP_INT, PROP_UNSIGNED);
1995  RNA_def_property_int_sdna(prop, NULL, "us");
1997  RNA_def_property_ui_text(prop, "Users", "Number of times this data-block is referenced");
1998 
1999  prop = RNA_def_property(srna, "use_fake_user", PROP_BOOLEAN, PROP_NONE);
2001  RNA_def_property_ui_text(prop, "Fake User", "Save this data-block even if it has no users");
2002  RNA_def_property_ui_icon(prop, ICON_FAKE_USER_OFF, true);
2003  RNA_def_property_boolean_funcs(prop, NULL, "rna_ID_fake_user_set");
2004 
2005  prop = RNA_def_property(srna, "use_extra_user", PROP_BOOLEAN, PROP_NONE);
2008  prop,
2009  "Extra User",
2010  "Indicates whether an extra user is set or not (mainly for internal/debug usages)");
2011  RNA_def_property_boolean_funcs(prop, NULL, "rna_ID_extra_user_set");
2012 
2013  prop = RNA_def_property(srna, "is_embedded_data", PROP_BOOLEAN, PROP_NONE);
2017  prop,
2018  "Embedded Data",
2019  "This data-block is not an independent one, but is actually a sub-data of another ID "
2020  "(typical example: root node trees or master collections)");
2021 
2022  prop = RNA_def_property(srna, "tag", PROP_BOOLEAN, PROP_NONE);
2026  "Tag",
2027  "Tools can use this to tag data for their own purposes "
2028  "(initial state is undefined)");
2029 
2030  prop = RNA_def_property(srna, "is_library_indirect", PROP_BOOLEAN, PROP_NONE);
2033  RNA_def_property_ui_text(prop, "Is Indirect", "Is this ID block linked indirectly");
2034 
2035  prop = RNA_def_property(srna, "library", PROP_POINTER, PROP_NONE);
2036  RNA_def_property_pointer_sdna(prop, NULL, "lib");
2039  RNA_def_property_ui_text(prop, "Library", "Library file the data-block is linked from");
2040 
2041  prop = RNA_def_pointer(srna,
2042  "library_weak_reference",
2043  "LibraryWeakReference",
2044  "Library Weak Reference",
2045  "Weak reference to a data-block in another library .blend file (used to "
2046  "re-use already appended data instead of appending new copies)");
2049 
2050  prop = RNA_def_property(srna, "asset_data", PROP_POINTER, PROP_NONE);
2053  RNA_def_property_ui_text(prop, "Asset Data", "Additional data for an asset data-block");
2054 
2055  prop = RNA_def_pointer(
2056  srna, "override_library", "IDOverrideLibrary", "Library Override", "Library override data");
2060 
2061  prop = RNA_def_pointer(srna,
2062  "preview",
2063  "ImagePreview",
2064  "Preview",
2065  "Preview image and icon of this data-block (always None if not supported "
2066  "for this type of data)");
2069  RNA_def_property_pointer_funcs(prop, "rna_IDPreview_get", NULL, NULL, NULL);
2070 
2071  /* functions */
2072  func = RNA_def_function(srna, "evaluated_get", "rna_ID_evaluated_get");
2074  func, "Get corresponding evaluated ID from the given dependency graph");
2075  parm = RNA_def_pointer(
2076  func, "depsgraph", "Depsgraph", "", "Dependency graph to perform lookup in");
2078  parm = RNA_def_pointer(func, "id", "ID", "", "New copy of the ID");
2079  RNA_def_function_return(func, parm);
2080 
2081  func = RNA_def_function(srna, "copy", "rna_ID_copy");
2083  func, "Create a copy of this data-block (not supported for all data-blocks)");
2085  parm = RNA_def_pointer(func, "id", "ID", "", "New copy of the ID");
2086  RNA_def_function_return(func, parm);
2087 
2088  func = RNA_def_function(srna, "asset_mark", "rna_ID_asset_mark");
2090  func,
2091  "Enable easier reuse of the data-block through the Asset Browser, with the help of "
2092  "customizable metadata (like previews, descriptions and tags)");
2093 
2094  func = RNA_def_function(srna, "asset_clear", "rna_ID_asset_clear");
2096  func,
2097  "Delete all asset metadata and turn the asset data-block back into a normal data-block");
2098 
2099  func = RNA_def_function(srna, "asset_generate_preview", "rna_ID_asset_generate_preview");
2101  func, "Generate preview image (might be scheduled in a background thread)");
2103 
2104  func = RNA_def_function(srna, "override_create", "rna_ID_override_create");
2106  "Create an overridden local copy of this linked data-block (not "
2107  "supported for all data-blocks)");
2109  parm = RNA_def_pointer(func, "id", "ID", "", "New overridden local copy of the ID");
2110  RNA_def_function_return(func, parm);
2111  RNA_def_boolean(func,
2112  "remap_local_usages",
2113  false,
2114  "",
2115  "Whether local usages of the linked ID should be remapped to the new "
2116  "library override of it");
2117 
2118  func = RNA_def_function(srna, "override_hierarchy_create", "rna_ID_override_hierarchy_create");
2120  func,
2121  "Create an overridden local copy of this linked data-block, and most of its dependencies "
2122  "when it is a Collection or and Object");
2124  parm = RNA_def_pointer(func, "id", "ID", "", "New overridden local copy of the root ID");
2125  RNA_def_function_return(func, parm);
2126  parm = RNA_def_pointer(
2127  func, "scene", "Scene", "", "In which scene the new overrides should be instantiated");
2129  parm = RNA_def_pointer(func,
2130  "view_layer",
2131  "ViewLayer",
2132  "",
2133  "In which view layer the new overrides should be instantiated");
2135  RNA_def_pointer(func,
2136  "reference",
2137  "ID",
2138  "",
2139  "Another ID (usually an Object or Collection) used as a hint to decide where to "
2140  "instantiate the new overrides");
2141 
2142  func = RNA_def_function(srna, "override_template_create", "rna_ID_override_template_create");
2143  RNA_def_function_ui_description(func, "Create an override template for this ID");
2145 
2146  func = RNA_def_function(srna, "user_clear", "rna_ID_user_clear");
2148  "Clear the user count of a data-block so its not saved, "
2149  "on reload the data will be removed");
2150 
2151  func = RNA_def_function(srna, "user_remap", "rna_ID_user_remap");
2153  func, "Replace all usage in the .blend file of this ID by new given one");
2155  parm = RNA_def_pointer(func, "new_id", "ID", "", "New ID to use");
2157 
2158  func = RNA_def_function(srna, "make_local", "rna_ID_make_local");
2160  func,
2161  "Make this datablock local, return local one "
2162  "(may be a copy of the original, in case it is also indirectly used)");
2164  parm = RNA_def_boolean(func, "clear_proxy", true, "", "Deprecated, has no effect");
2165  parm = RNA_def_pointer(func, "id", "ID", "", "This ID, or the new ID if it was copied");
2166  RNA_def_function_return(func, parm);
2167 
2168  func = RNA_def_function(srna, "user_of_id", "BKE_library_ID_use_ID");
2170  "Count the number of times that ID uses/references given one");
2171  parm = RNA_def_pointer(func, "id", "ID", "", "ID to count usages");
2173  parm = RNA_def_int(func,
2174  "count",
2175  0,
2176  0,
2177  INT_MAX,
2178  "",
2179  "Number of usages/references of given id by current data-block",
2180  0,
2181  INT_MAX);
2182  RNA_def_function_return(func, parm);
2183 
2184  func = RNA_def_function(srna, "animation_data_create", "rna_ID_animation_data_create");
2187  func, "Create animation data to this ID, note that not all ID types support this");
2188  parm = RNA_def_pointer(func, "anim_data", "AnimData", "", "New animation data or NULL");
2189  RNA_def_function_return(func, parm);
2190 
2191  func = RNA_def_function(srna, "animation_data_clear", "rna_ID_animation_data_free");
2193  RNA_def_function_ui_description(func, "Clear animation on this this ID");
2194 
2195  func = RNA_def_function(srna, "update_tag", "rna_ID_update_tag");
2198  "Tag the ID to update its display data, "
2199  "e.g. when calling :class:`bpy.types.Scene.update`");
2200  RNA_def_enum_flag(func, "refresh", update_flag_items, 0, "", "Type of updates to perform");
2201 
2202  func = RNA_def_function(srna, "preview_ensure", "BKE_previewimg_id_ensure");
2204  "Ensure that this ID has preview data (if ID type supports it)");
2205  parm = RNA_def_pointer(
2206  func, "preview_image", "ImagePreview", "", "The existing or created preview");
2207  RNA_def_function_return(func, parm);
2208 
2209 # ifdef WITH_PYTHON
2210  RNA_def_struct_register_funcs(srna, NULL, NULL, "rna_ID_instance");
2211 # endif
2212 }
2213 
2214 static void rna_def_library(BlenderRNA *brna)
2215 {
2216  StructRNA *srna;
2217  FunctionRNA *func;
2218  PropertyRNA *prop;
2219 
2220  srna = RNA_def_struct(brna, "Library", "ID");
2221  RNA_def_struct_ui_text(srna, "Library", "External .blend file from which data is linked");
2222  RNA_def_struct_ui_icon(srna, ICON_LIBRARY_DATA_DIRECT);
2223 
2224  prop = RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH);
2225  RNA_def_property_string_sdna(prop, NULL, "filepath");
2226  RNA_def_property_ui_text(prop, "File Path", "Path to the library .blend file");
2227  RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Library_filepath_set");
2228 
2229  prop = RNA_def_property(srna, "parent", PROP_POINTER, PROP_NONE);
2230  RNA_def_property_struct_type(prop, "Library");
2232  RNA_def_property_ui_text(prop, "Parent", "");
2233 
2234  prop = RNA_def_property(srna, "packed_file", PROP_POINTER, PROP_NONE);
2235  RNA_def_property_pointer_sdna(prop, NULL, "packedfile");
2236  RNA_def_property_ui_text(prop, "Packed File", "");
2237 
2238  prop = RNA_def_int_vector(srna,
2239  "version",
2240  3,
2241  NULL,
2242  0,
2243  INT_MAX,
2244  "Version",
2245  "Version of Blender the library .blend was saved with",
2246  0,
2247  INT_MAX);
2248  RNA_def_property_int_funcs(prop, "rna_Library_version_get", NULL, NULL);
2251 
2252  func = RNA_def_function(srna, "reload", "rna_Library_reload");
2254  RNA_def_function_ui_description(func, "Reload this library and all its linked data-blocks");
2255 }
2256 
2258 {
2259  StructRNA *srna;
2260  PropertyRNA *prop;
2261 
2262  srna = RNA_def_struct(brna, "LibraryWeakReference", NULL);
2264  srna,
2265  "LibraryWeakReference",
2266  "Read-only external reference to a linked data-block and its library file");
2267 
2268  prop = RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH);
2269  RNA_def_property_string_sdna(prop, NULL, "library_filepath");
2271  RNA_def_property_ui_text(prop, "File Path", "Path to the library .blend file");
2272 
2273  prop = RNA_def_property(srna, "id_name", PROP_STRING, PROP_FILEPATH);
2274  RNA_def_property_string_sdna(prop, NULL, "library_id_name");
2277  prop,
2278  "ID name",
2279  "Full ID name in the library .blend file (including the two leading 'id type' chars)");
2280 }
2281 
2287 {
2288  StructRNA *srna;
2289 
2290  srna = RNA_def_struct(brna, "IDPropertyWrapPtr", NULL);
2291  RNA_def_struct_idprops_func(srna, "rna_IDPropertyWrapPtr_idprops");
2293 }
2294 
2296 {
2297  StructRNA *srna;
2298 
2299  /* built-in unknown type */
2300  srna = RNA_def_struct(brna, "UnknownType", NULL);
2302  srna, "Unknown Type", "Stub RNA type used for pointers to unknown or internal data");
2303 
2304  /* built-in any type */
2305  srna = RNA_def_struct(brna, "AnyType", NULL);
2306  RNA_def_struct_ui_text(srna, "Any Type", "RNA type used for pointers to any possible data");
2307 
2308  rna_def_ID(brna);
2310  rna_def_image_preview(brna);
2311  rna_def_ID_properties(brna);
2312  rna_def_ID_materials(brna);
2313  rna_def_library(brna);
2316 }
2317 
2318 #endif
void BKE_animdata_free(struct ID *id, bool do_id_user)
Definition: anim_data.c:197
bool id_can_have_animdata(const struct ID *id)
struct AnimData * BKE_animdata_ensure_id(struct ID *id)
Definition: anim_data.c:90
#define G_MAIN
Definition: BKE_global.h:267
struct PreviewImage * BKE_previewimg_id_ensure(struct ID *id)
Definition: icons.cc:385
void BKE_previewimg_ensure(struct PreviewImage *prv, int size)
Definition: icons.cc:517
void BKE_previewimg_clear(struct PreviewImage *prv)
Definition: icons.cc:303
void BKE_previewimg_clear_single(struct PreviewImage *prv, enum eIconSizes size)
Definition: icons.cc:291
struct PreviewImage * BKE_previewimg_id_get(const struct ID *id)
int BKE_icon_preview_ensure(struct ID *id, struct PreviewImage *preview)
Definition: icons.cc:767
#define IDP_IDPArray(prop)
Definition: BKE_idprop.h:272
struct ID * BKE_id_copy(struct Main *bmain, const struct ID *id)
void BKE_id_newptr_and_tag_clear(struct ID *id)
Definition: lib_id.c:359
void BKE_main_id_tag_all(struct Main *mainvar, int tag, bool value)
Definition: lib_id.c:930
void id_us_min(struct ID *id)
Definition: lib_id.c:313
void id_fake_user_set(struct ID *id)
Definition: lib_id.c:343
void id_us_ensure_real(struct ID *id)
Definition: lib_id.c:260
void id_us_clear_real(struct ID *id)
Definition: lib_id.c:278
bool BKE_id_is_in_global_main(struct ID *id)
Definition: lib_id.c:1902
void BKE_id_full_name_get(char name[MAX_ID_FULL_NAME], const struct ID *id, char separator_char)
bool BKE_lib_id_make_local(struct Main *bmain, struct ID *id, int flags)
Definition: lib_id.c:533
void BKE_id_delete(struct Main *bmain, void *idv) ATTR_NONNULL()
void BLI_libblock_ensure_unique_name(struct Main *bmain, const char *name) ATTR_NONNULL()
Definition: lib_id.c:1813
void id_fake_user_clear(struct ID *id)
Definition: lib_id.c:351
#define MAX_ID_FULL_NAME
Definition: BKE_lib_id.h:550
struct IDOverrideLibraryProperty * BKE_lib_override_library_property_get(struct IDOverrideLibrary *override, const char *rna_path, bool *r_created)
bool BKE_lib_override_library_template_create(struct ID *id)
bool BKE_lib_override_library_create(struct Main *bmain, struct Scene *scene, struct ViewLayer *view_layer, struct Library *owner_library, struct ID *id_root_reference, struct ID *id_hierarchy_root_reference, struct ID *id_instance_hint, struct ID **r_id_root_override, const bool do_fully_editable)
void BKE_lib_override_library_id_hierarchy_reset(struct Main *bmain, struct ID *id_root, bool do_reset_system_override)
struct IDOverrideLibraryPropertyOperation * BKE_lib_override_library_property_operation_get(struct IDOverrideLibraryProperty *override_property, short operation, const char *subitem_refname, const char *subitem_locname, int subitem_refindex, int subitem_locindex, bool strict, bool *r_strict, bool *r_created)
void BKE_lib_override_library_delete(struct Main *bmain, struct ID *id_root)
void BKE_lib_override_library_property_operation_delete(struct IDOverrideLibraryProperty *override_property, struct IDOverrideLibraryPropertyOperation *override_property_operation)
void BKE_lib_override_library_id_reset(struct Main *bmain, struct ID *id_root, bool do_reset_system_override)
struct ID * BKE_lib_override_library_create_from_id(struct Main *bmain, struct ID *reference_id, bool do_tagged_remap)
void BKE_lib_override_library_property_delete(struct IDOverrideLibrary *override, struct IDOverrideLibraryProperty *override_property)
bool BKE_lib_override_library_operations_create(struct Main *bmain, struct ID *local)
@ ID_REMAP_SKIP_NEVER_NULL_USAGE
Definition: BKE_lib_remap.h:45
@ ID_REMAP_SKIP_INDIRECT_USAGE
Definition: BKE_lib_remap.h:36
void void BKE_libblock_remap(struct Main *bmain, void *old_idv, void *new_idv, short remap_flags) ATTR_NONNULL(1
void BKE_library_filepath_set(struct Main *bmain, struct Library *lib, const char *filepath)
Definition: library.c:112
void BKE_main_namemap_remove_name(struct Main *bmain, struct ID *id, const char *name) ATTR_NONNULL()
General operations, lookup, etc. for materials.
void BKE_id_material_assign(struct Main *bmain, struct ID *id, struct Material *ma, short act)
Definition: material.c:905
void BKE_id_material_append(struct Main *bmain, struct ID *id, struct Material *ma)
Definition: material.c:559
short * BKE_id_material_len_p(struct ID *id)
Definition: material.c:403
struct Material * BKE_id_material_pop(struct Main *bmain, struct ID *id, int index)
Definition: material.c:583
void BKE_id_material_clear(struct Main *bmain, struct ID *id)
Definition: material.c:621
General operations, lookup, etc. for blender objects.
void BKE_reportf(ReportList *reports, eReportType type, const char *format,...) ATTR_PRINTF_FORMAT(3
void BKE_report(ReportList *reports, eReportType type, const char *message)
Definition: report.c:83
bool BKE_vfont_to_curve(struct Object *ob, int mode)
Definition: vfont.c:1744
bool BKE_vfont_is_builtin(const struct VFont *vfont)
Definition: vfont.c:223
#define BLI_assert(a)
Definition: BLI_assert.h:46
void BLI_kdtree_nd_() free(KDTree *tree)
Definition: kdtree_impl.h:102
int BLI_findindex(const struct ListBase *listbase, const void *vlink) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
size_t BLI_strnlen(const char *str, size_t maxlen) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
Definition: string.c:899
char * BLI_strncpy(char *__restrict dst, const char *__restrict src, size_t maxncpy) ATTR_NONNULL()
Definition: string.c:64
char * BLI_strncpy_utf8(char *__restrict dst, const char *__restrict src, size_t maxncpy) ATTR_NONNULL(1
#define UNUSED(x)
#define UNLIKELY(x)
#define BPy_BEGIN_ALLOW_THREADS
Definition: BPY_extern.h:54
#define BPy_END_ALLOW_THREADS
Definition: BPY_extern.h:58
struct Depsgraph Depsgraph
Definition: DEG_depsgraph.h:35
void DEG_id_tag_update_ex(struct Main *bmain, struct ID *id, int flag)
void DEG_id_tag_update(struct ID *id, int flag)
void DEG_relations_tag_update(struct Main *bmain)
struct ID * DEG_get_evaluated_id(const struct Depsgraph *depsgraph, struct ID *id)
struct ID * DEG_get_original_id(struct ID *id)
ID and Library types, which are fundamental for sdna.
@ IDOVERRIDE_LIBRARY_FLAG_LOCKED
Definition: DNA_ID.h:240
@ IDOVERRIDE_LIBRARY_FLAG_MANDATORY
Definition: DNA_ID.h:238
#define FILTER_ID_OB
Definition: DNA_ID.h:916
#define FILTER_ID_MC
Definition: DNA_ID.h:912
#define FILTER_ID_SPK
Definition: DNA_ID.h:920
#define FILTER_ID_CF
Definition: DNA_ID.h:927
@ ID_RECALC_TRANSFORM
Definition: DNA_ID.h:771
@ ID_RECALC_ANIMATION
Definition: DNA_ID.h:794
@ ID_RECALC_GEOMETRY
Definition: DNA_ID.h:791
@ ID_RECALC_ALL
Definition: DNA_ID.h:891
#define FILTER_ID_AC
Definition: DNA_ID.h:899
#define FILTER_ID_MA
Definition: DNA_ID.h:910
#define ID_IS_OVERRIDE_LIBRARY_REAL(_id)
Definition: DNA_ID.h:581
#define FILTER_ID_CA
Definition: DNA_ID.h:902
#define FILTER_ID_SO
Definition: DNA_ID.h:921
#define FILTER_ID_PT
Definition: DNA_ID.h:931
#define ID_IS_OVERRIDABLE_LIBRARY(_id)
Definition: DNA_ID.h:574
#define FILTER_ID_CU_LEGACY
Definition: DNA_ID.h:903
#define FILTER_ID_BR
Definition: DNA_ID.h:901
#define FILTER_ID_WS
Definition: DNA_ID.h:928
#define FILTER_ID_MB
Definition: DNA_ID.h:911
#define FILTER_ID_VF
Definition: DNA_ID.h:924
#define ID_IS_LINKED(_id)
Definition: DNA_ID.h:566
#define MAX_ID_NAME
Definition: DNA_ID.h:337
#define FILTER_ID_LA
Definition: DNA_ID.h:907
#define FILTER_ID_GR
Definition: DNA_ID.h:905
#define FILTER_ID_TE
Definition: DNA_ID.h:922
#define FILTER_ID_LT
Definition: DNA_ID.h:909
#define FILTER_ID_LS
Definition: DNA_ID.h:908
#define FILTER_ID_PA
Definition: DNA_ID.h:926
#define FILTER_ID_CV
Definition: DNA_ID.h:930
#define FILTER_ID_ME
Definition: DNA_ID.h:913
#define FILTER_ID_AR
Definition: DNA_ID.h:900
#define MAX_IDPROP_NAME
Definition: DNA_ID.h:131
@ IDOVERRIDE_LIBRARY_OP_MULTIPLY
Definition: DNA_ID.h:227
@ IDOVERRIDE_LIBRARY_OP_INSERT_AFTER
Definition: DNA_ID.h:230
@ IDOVERRIDE_LIBRARY_OP_NOOP
Definition: DNA_ID.h:218
@ IDOVERRIDE_LIBRARY_OP_SUBTRACT
Definition: DNA_ID.h:225
@ IDOVERRIDE_LIBRARY_OP_ADD
Definition: DNA_ID.h:223
@ IDOVERRIDE_LIBRARY_OP_INSERT_BEFORE
Definition: DNA_ID.h:231
@ IDOVERRIDE_LIBRARY_OP_REPLACE
Definition: DNA_ID.h:220
#define FILTER_ID_SIM
Definition: DNA_ID.h:933
#define FILTER_ID_MSK
Definition: DNA_ID.h:914
@ LIB_TAG_INDIRECT
Definition: DNA_ID.h:677
@ LIB_TAG_EXTRAUSER
Definition: DNA_ID.h:698
@ LIB_TAG_DOIT
Definition: DNA_ID.h:707
@ LIB_EMBEDDED_DATA
Definition: DNA_ID.h:635
@ LIB_FAKEUSER
Definition: DNA_ID.h:630
#define FILTER_ID_GD
Definition: DNA_ID.h:904
#define FILTER_ID_PC
Definition: DNA_ID.h:918
#define ID_IS_OVERRIDE_LIBRARY(_id)
Definition: DNA_ID.h:588
#define FILTER_ID_PAL
Definition: DNA_ID.h:917
#define FILTER_ID_IM
Definition: DNA_ID.h:906
struct IDProperty IDProperty
#define FILTER_ID_SCE
Definition: DNA_ID.h:919
#define FILTER_ID_LP
Definition: DNA_ID.h:929
#define FILTER_ID_VO
Definition: DNA_ID.h:932
@ PRV_CHANGED
Definition: DNA_ID.h:517
@ PRV_USER_EDITED
Definition: DNA_ID.h:518
#define FILTER_ID_WO
Definition: DNA_ID.h:925
@ IDOVERRIDE_LIBRARY_FLAG_NO_HIERARCHY
Definition: DNA_ID.h:322
@ IDOVERRIDE_LIBRARY_FLAG_SYSTEM_DEFINED
Definition: DNA_ID.h:327
#define FILTER_ID_NT
Definition: DNA_ID.h:915
#define FILTER_ID_TXT
Definition: DNA_ID.h:923
eIconSizes
Definition: DNA_ID_enums.h:14
@ ICON_SIZE_PREVIEW
Definition: DNA_ID_enums.h:16
@ ICON_SIZE_ICON
Definition: DNA_ID_enums.h:15
ID_Type
Definition: DNA_ID_enums.h:44
@ ID_WM
Definition: DNA_ID_enums.h:72
@ ID_CA
Definition: DNA_ID_enums.h:56
@ ID_AR
Definition: DNA_ID_enums.h:66
@ ID_MC
Definition: DNA_ID_enums.h:73
@ ID_CF
Definition: DNA_ID_enums.h:78
@ ID_LI
Definition: DNA_ID_enums.h:46
@ ID_TE
Definition: DNA_ID_enums.h:52
@ ID_IM
Definition: DNA_ID_enums.h:53
@ ID_VO
Definition: DNA_ID_enums.h:83
@ ID_WS
Definition: DNA_ID_enums.h:79
@ ID_NT
Definition: DNA_ID_enums.h:68
@ ID_LA
Definition: DNA_ID_enums.h:55
@ ID_KE
Definition: DNA_ID_enums.h:58
@ ID_TXT
Definition: DNA_ID_enums.h:62
@ ID_SO
Definition: DNA_ID_enums.h:64
@ ID_SCE
Definition: DNA_ID_enums.h:45
@ ID_LS
Definition: DNA_ID_enums.h:75
@ ID_MSK
Definition: DNA_ID_enums.h:74
@ ID_GD
Definition: DNA_ID_enums.h:71
@ ID_CV
Definition: DNA_ID_enums.h:81
@ ID_PAL
Definition: DNA_ID_enums.h:76
@ ID_BR
Definition: DNA_ID_enums.h:69
@ ID_LP
Definition: DNA_ID_enums.h:80
@ ID_WO
Definition: DNA_ID_enums.h:59
@ ID_SIM
Definition: DNA_ID_enums.h:84
@ ID_MA
Definition: DNA_ID_enums.h:51
@ ID_AC
Definition: DNA_ID_enums.h:67
@ ID_SCR
Definition: DNA_ID_enums.h:60
@ ID_CU_LEGACY
Definition: DNA_ID_enums.h:49
@ ID_VF
Definition: DNA_ID_enums.h:61
@ ID_ME
Definition: DNA_ID_enums.h:48
@ ID_IP
Definition: DNA_ID_enums.h:57
@ ID_GR
Definition: DNA_ID_enums.h:65
@ ID_SPK
Definition: DNA_ID_enums.h:63
@ ID_MB
Definition: DNA_ID_enums.h:50
@ ID_LT
Definition: DNA_ID_enums.h:54
@ ID_OB
Definition: DNA_ID_enums.h:47
@ ID_PA
Definition: DNA_ID_enums.h:70
@ ID_PT
Definition: DNA_ID_enums.h:82
@ ID_PC
Definition: DNA_ID_enums.h:77
#define MAXMAT
Object is a sort of wrapper for general info.
@ OB_MBALL
@ OB_FONT
#define FO_EDIT
bool ED_asset_clear_id(struct ID *id)
bool ED_asset_mark_id(struct ID *id)
void ED_asset_generate_preview(const struct bContext *C, struct ID *id)
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum type
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.h:28
@ PARM_REQUIRED
Definition: RNA_types.h:352
void(* StructFreeFunc)(void *data)
Definition: RNA_types.h:737
int(* StructValidateFunc)(struct PointerRNA *ptr, void *data, int *have_function)
Definition: RNA_types.h:732
@ FUNC_USE_REPORTS
Definition: RNA_types.h:663
@ FUNC_USE_MAIN
Definition: RNA_types.h:661
@ FUNC_USE_CONTEXT
Definition: RNA_types.h:662
@ FUNC_USE_SELF_ID
Definition: RNA_types.h:650
@ STRUCT_ID_REFCOUNT
Definition: RNA_types.h:706
@ STRUCT_ID
Definition: RNA_types.h:705
@ STRUCT_NO_DATABLOCK_IDPROPERTIES
Definition: RNA_types.h:717
int(* StructCallbackFunc)(struct bContext *C, struct PointerRNA *ptr, struct FunctionRNA *func, ParameterList *list)
Definition: RNA_types.h:733
@ PROP_FLOAT
Definition: RNA_types.h:61
@ PROP_BOOLEAN
Definition: RNA_types.h:59
@ PROP_INT
Definition: RNA_types.h:60
@ PROP_STRING
Definition: RNA_types.h:62
@ PROP_POINTER
Definition: RNA_types.h:64
@ PROP_COLLECTION
Definition: RNA_types.h:65
@ PROPOVERRIDE_OVERRIDABLE_LIBRARY
Definition: RNA_types.h:312
@ PROPOVERRIDE_NO_COMPARISON
Definition: RNA_types.h:320
@ PROPOVERRIDE_IGNORE
Definition: RNA_types.h:332
@ PROP_THICK_WRAP
Definition: RNA_types.h:285
@ PROP_DYNAMIC
Definition: RNA_types.h:290
@ PROP_EDITABLE
Definition: RNA_types.h:189
@ PROP_LIB_EXCEPTION
Definition: RNA_types.h:195
@ PROP_NEVER_NULL
Definition: RNA_types.h:239
@ PROP_PTR_NO_OWNERSHIP
Definition: RNA_types.h:257
@ PROP_HIDDEN
Definition: RNA_types.h:216
@ PROP_IDPROPERTY
Definition: RNA_types.h:288
@ PROP_PIXEL
Definition: RNA_types.h:141
@ PROP_NONE
Definition: RNA_types.h:126
@ PROP_UNSIGNED
Definition: RNA_types.h:142
@ PROP_FILEPATH
Definition: RNA_types.h:129
#define C
Definition: RandGen.cpp:25
#define NC_ID
Definition: WM_types.h:345
#define ND_DRAW
Definition: WM_types.h:410
#define NC_WM
Definition: WM_types.h:324
#define ND_LIB_OVERRIDE_CHANGED
Definition: WM_types.h:367
#define NA_ADDED
Definition: WM_types.h:525
#define NA_EDITED
Definition: WM_types.h:523
#define NC_ASSET
Definition: WM_types.h:354
#define NA_REMOVED
Definition: WM_types.h:526
#define NA_RENAME
Definition: WM_types.h:527
#define ND_OB_SHADING
Definition: WM_types.h:406
#define NC_OBJECT
Definition: WM_types.h:329
return(oflags[bm->toolflag_index].f &oflag) !=0
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
Definition: btDbvt.cpp:52
unsigned int U
Definition: btGjkEpa3.h:78
Scene scene
const Depsgraph * depsgraph
int len
Definition: draw_manager.c:108
DRWShaderLibrary * lib
#define GS(x)
Definition: iris.c:225
void *(* MEM_callocN)(size_t len, const char *str)
Definition: mallocn.c:31
MINLINE unsigned char unit_float_to_uchar_clamp(float val)
T length(const vec_base< T, Size > &a)
static void rna_def_ID_override_library(BlenderRNA *brna)
Definition: rna_ID.c:1850
static const EnumPropertyItem rna_enum_override_library_property_operation_items[]
Definition: rna_ID.c:75
static void rna_def_ID_override_library_property_operation(BlenderRNA *brna)
Definition: rna_ID.c:1630
static void rna_def_ID_override_library_property(BlenderRNA *brna)
Definition: rna_ID.c:1783
const EnumPropertyItem rna_enum_id_type_items[]
Definition: rna_ID.c:33
static void rna_def_ID_override_library_properties(BlenderRNA *brna, PropertyRNA *cprop)
Definition: rna_ID.c:1813
void RNA_def_ID(BlenderRNA *brna)
Definition: rna_ID.c:2295
const struct IDFilterEnumPropertyItem rna_enum_id_type_filter_items[]
Definition: rna_ID.c:119
static void rna_def_ID(BlenderRNA *brna)
Definition: rna_ID.c:1936
static void rna_def_library_weak_reference(BlenderRNA *brna)
Definition: rna_ID.c:2257
static void rna_def_ID_properties(BlenderRNA *brna)
Definition: rna_ID.c:1410
static void rna_def_idproperty_wrap_ptr(BlenderRNA *brna)
Definition: rna_ID.c:2286
static void rna_def_image_preview(BlenderRNA *brna)
Definition: rna_ID.c:1538
static void rna_def_library(BlenderRNA *brna)
Definition: rna_ID.c:2214
static void rna_def_ID_override_library_property_operations(BlenderRNA *brna, PropertyRNA *cprop)
Definition: rna_ID.c:1713
static void rna_def_ID_materials(BlenderRNA *brna)
Definition: rna_ID.c:1508
const char * RNA_struct_identifier(const StructRNA *type)
Definition: rna_access.c:586
void RNA_pointer_create(ID *id, StructRNA *type, void *data, PointerRNA *r_ptr)
Definition: rna_access.c:136
void rna_iterator_array_begin(CollectionPropertyIterator *iter, void *ptr, int itemsize, int length, bool free_ptr, IteratorSkipFunc skip)
Definition: rna_access.c:4781
PointerRNA rna_pointer_inherit_refine(PointerRNA *ptr, StructRNA *type, void *data)
Definition: rna_access.c:186
const StructRNA * RNA_struct_base_child_of(const StructRNA *type, const StructRNA *parent_type)
Definition: rna_access.c:644
void RNA_def_struct_refine_func(StructRNA *srna, const char *refine)
Definition: rna_define.c:1148
void RNA_def_property_pointer_sdna(PropertyRNA *prop, const char *structname, const char *propname)
Definition: rna_define.c:2740
PropertyRNA * RNA_def_boolean(StructOrFunctionRNA *cont_, const char *identifier, bool default_value, const char *ui_name, const char *ui_description)
Definition: rna_define.c:3493
PropertyRNA * RNA_def_enum_flag(StructOrFunctionRNA *cont_, const char *identifier, const EnumPropertyItem *items, int default_value, const char *ui_name, const char *ui_description)
Definition: rna_define.c:3806
PropertyRNA * RNA_def_pointer(StructOrFunctionRNA *cont_, const char *identifier, const char *type, const char *ui_name, const char *ui_description)
Definition: rna_define.c:4170
void RNA_def_struct_flag(StructRNA *srna, int flag)
Definition: rna_define.c:1133
void RNA_def_property_boolean_sdna(PropertyRNA *prop, const char *structname, const char *propname, int64_t bit)
Definition: rna_define.c:2236
void RNA_def_property_string_funcs(PropertyRNA *prop, const char *get, const char *length, const char *set)
Definition: rna_define.c:3285
void RNA_def_function_return(FunctionRNA *func, PropertyRNA *ret)
Definition: rna_define.c:4312
void RNA_def_property_float_funcs(PropertyRNA *prop, const char *get, const char *set, const char *range)
Definition: rna_define.c:3126
void RNA_def_property_ui_text(PropertyRNA *prop, const char *name, const char *description)
Definition: rna_define.c:1645
void RNA_def_property_string_sdna(PropertyRNA *prop, const char *structname, const char *propname)
Definition: rna_define.c:2695
void RNA_def_property_ui_icon(PropertyRNA *prop, int icon, int consecutive)
Definition: rna_define.c:1653
FunctionRNA * RNA_def_function(StructRNA *srna, const char *identifier, const char *call)
Definition: rna_define.c:4273
void RNA_def_property_srna(PropertyRNA *prop, const char *type)
Definition: rna_define.c:3474
void RNA_def_property_collection_funcs(PropertyRNA *prop, const char *begin, const char *next, const char *end, const char *get, const char *length, const char *lookupint, const char *lookupstring, const char *assignint)
Definition: rna_define.c:3420
void RNA_def_struct_ui_text(StructRNA *srna, const char *name, const char *description)
Definition: rna_define.c:1237
void RNA_def_property_boolean_funcs(PropertyRNA *prop, const char *get, const char *set)
Definition: rna_define.c:2944
void RNA_def_struct_register_funcs(StructRNA *srna, const char *reg, const char *unreg, const char *instance)
Definition: rna_define.c:1172
void RNA_def_property_dynamic_array_funcs(PropertyRNA *prop, const char *getlength)
Definition: rna_define.c:2926
void RNA_def_property_multi_array(PropertyRNA *prop, int dimension, const int length[])
Definition: rna_define.c:1598
StructRNA * RNA_def_struct_ptr(BlenderRNA *brna, const char *identifier, StructRNA *srnafrom)
Definition: rna_define.c:900
void RNA_def_struct_sdna(StructRNA *srna, const char *structname)
Definition: rna_define.c:1048
void RNA_def_property_array(PropertyRNA *prop, int length)
Definition: rna_define.c:1539
void RNA_def_property_string_maxlength(PropertyRNA *prop, int maxlength)
Definition: rna_define.c:1920
void RNA_def_property_struct_type(PropertyRNA *prop, const char *type)
Definition: rna_define.c:1772
void RNA_def_function_ui_description(FunctionRNA *func, const char *description)
Definition: rna_define.c:4347
void RNA_def_property_update(PropertyRNA *prop, int noteflag, const char *func)
Definition: rna_define.c:2900
void RNA_def_property_editable_func(PropertyRNA *prop, const char *editable)
Definition: rna_define.c:2855
PropertyRNA * RNA_def_property(StructOrFunctionRNA *cont_, const char *identifier, int type, int subtype)
Definition: rna_define.c:1257
PropertyRNA * RNA_def_int_vector(StructOrFunctionRNA *cont_, const char *identifier, int len, const int *default_value, int hardmin, int hardmax, const char *ui_name, const char *ui_description, int softmin, int softmax)
Definition: rna_define.c:3623
void RNA_def_struct_name_property(struct StructRNA *srna, struct PropertyRNA *prop)
Definition: rna_define.c:1103
void RNA_def_function_flag(FunctionRNA *func, int flag)
Definition: rna_define.c:4342
void RNA_def_property_clear_flag(PropertyRNA *prop, PropertyFlag flag)
Definition: rna_define.c:1495
void RNA_def_property_pointer_funcs(PropertyRNA *prop, const char *get, const char *set, const char *type_fn, const char *poll)
Definition: rna_define.c:3385
StructRNA * RNA_def_struct(BlenderRNA *brna, const char *identifier, const char *from)
Definition: rna_define.c:1028
void RNA_def_property_int_funcs(PropertyRNA *prop, const char *get, const char *set, const char *range)
Definition: rna_define.c:3028
void RNA_def_struct_ui_icon(StructRNA *srna, int icon)
Definition: rna_define.c:1245
void RNA_struct_free(BlenderRNA *brna, StructRNA *srna)
Definition: rna_define.c:777
PropertyRNA * RNA_def_string(StructOrFunctionRNA *cont_, const char *identifier, const char *default_value, int maxlen, const char *ui_name, const char *ui_description)
Definition: rna_define.c:3687
void RNA_def_struct_idprops_func(StructRNA *srna, const char *idproperties)
Definition: rna_define.c:1160
void RNA_def_property_flag(PropertyRNA *prop, PropertyFlag flag)
Definition: rna_define.c:1490
PropertyRNA * RNA_def_int(StructOrFunctionRNA *cont_, const char *identifier, int default_value, int hardmin, int hardmax, const char *ui_name, const char *ui_description, int softmin, int softmax)
Definition: rna_define.c:3597
void RNA_def_property_subtype(PropertyRNA *prop, PropertySubType subtype)
Definition: rna_define.c:1534
PropertyRNA * RNA_def_collection(StructOrFunctionRNA *cont_, const char *identifier, const char *type, const char *ui_name, const char *ui_description)
Definition: rna_define.c:4205
PropertyRNA * RNA_def_enum(StructOrFunctionRNA *cont_, const char *identifier, const EnumPropertyItem *items, int default_value, const char *ui_name, const char *ui_description)
Definition: rna_define.c:3783
void RNA_def_property_int_sdna(PropertyRNA *prop, const char *structname, const char *propname)
Definition: rna_define.c:2343
void RNA_def_property_boolean_negative_sdna(PropertyRNA *prop, const char *structname, const char *propname, int64_t booleanbit)
Definition: rna_define.c:2327
void RNA_def_property_override_flag(PropertyRNA *prop, PropertyOverrideFlag flag)
Definition: rna_define.c:1503
void RNA_def_parameter_flags(PropertyRNA *prop, PropertyFlag flag_property, ParameterFlag flag_parameter)
Definition: rna_define.c:1518
void rna_PropertyGroup_unregister(struct Main *bmain, struct StructRNA *type)
void rna_ID_name_set(struct PointerRNA *ptr, const char *value)
int rna_ID_name_length(struct PointerRNA *ptr)
struct StructRNA * rna_PropertyGroup_register(struct Main *bmain, struct ReportList *reports, void *data, const char *identifier, StructValidateFunc validate, StructCallbackFunc call, StructFreeFunc free)
int rna_IDMaterials_assign_int(struct PointerRNA *ptr, int key, const struct PointerRNA *assign_ptr)
struct StructRNA * rna_ID_refine(struct PointerRNA *ptr)
BlenderRNA BLENDER_RNA
struct IDProperty ** rna_PropertyGroup_idprops(struct PointerRNA *ptr)
struct StructRNA * rna_PropertyGroup_refine(struct PointerRNA *ptr)
StructRNA RNA_PropertyGroup
void rna_ID_name_get(struct PointerRNA *ptr, char *value)
void rna_ID_fake_user_set(struct PointerRNA *ptr, bool value)
struct IDProperty ** rna_ID_idprops(struct PointerRNA *ptr)
void ** rna_ID_instance(PointerRNA *ptr)
ListBase properties
Definition: DNA_ID.h:296
struct ID * reference
Definition: DNA_ID.h:294
int len
Definition: DNA_ID.h:121
Definition: DNA_ID.h:368
void * py_instance
Definition: DNA_ID.h:435
struct ID * newid
Definition: DNA_ID.h:370
IDProperty * properties
Definition: DNA_ID.h:409
IDOverrideLibrary * override_library
Definition: DNA_ID.h:412
char name[66]
Definition: DNA_ID.h:378
Definition: BKE_main.h:121
struct StructRNA * type
Definition: RNA_types.h:37
void * data
Definition: RNA_types.h:38
struct ID * owner_id
Definition: RNA_types.h:36
unsigned int h[2]
Definition: DNA_ID.h:532
short flag[2]
Definition: DNA_ID.h:533
unsigned int * rect[2]
Definition: DNA_ID.h:535
unsigned int w[2]
Definition: DNA_ID.h:531
void WM_main_add_notifier(unsigned int type, void *reference)
PointerRNA * ptr
Definition: wm_files.c:3480