2 * This program is free software; you can redistribute it and/or
3 * modify it under the terms of the GNU General Public License
4 * as published by the Free Software Foundation; either version 2
5 * of the License, or (at your option) any later version.
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the Free Software Foundation,
14 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16 * The Original Code is Copyright (C) 2009 Blender Foundation.
17 * All rights reserved.
29 #include "DNA_modifier_types.h"
30 #include "DNA_object_types.h"
31 #include "DNA_space_types.h"
33 #include "BLI_utildefines.h"
35 #include "RNA_access.h"
36 #include "RNA_define.h"
37 #include "RNA_enum_types.h"
39 #include "rna_internal.h"
43 # include "BKE_action.h"
44 # include "BKE_armature.h"
45 # include "BKE_brush.h"
46 # include "BKE_camera.h"
47 # include "BKE_collection.h"
48 # include "BKE_curve.h"
49 # include "BKE_displist.h"
50 # include "BKE_font.h"
51 # include "BKE_gpencil.h"
52 # include "BKE_hair.h"
53 # include "BKE_icons.h"
54 # include "BKE_idtype.h"
55 # include "BKE_image.h"
56 # include "BKE_lattice.h"
57 # include "BKE_lib_remap.h"
58 # include "BKE_light.h"
59 # include "BKE_lightprobe.h"
60 # include "BKE_linestyle.h"
61 # include "BKE_mask.h"
62 # include "BKE_material.h"
63 # include "BKE_mball.h"
64 # include "BKE_mesh.h"
65 # include "BKE_movieclip.h"
66 # include "BKE_node.h"
67 # include "BKE_object.h"
68 # include "BKE_paint.h"
69 # include "BKE_particle.h"
70 # include "BKE_pointcloud.h"
71 # include "BKE_scene.h"
72 # include "BKE_simulation.h"
73 # include "BKE_sound.h"
74 # include "BKE_speaker.h"
75 # include "BKE_text.h"
76 # include "BKE_texture.h"
77 # include "BKE_volume.h"
78 # include "BKE_workspace.h"
79 # include "BKE_world.h"
81 # include "DEG_depsgraph_build.h"
82 # include "DEG_depsgraph_query.h"
84 # include "DNA_armature_types.h"
85 # include "DNA_brush_types.h"
86 # include "DNA_camera_types.h"
87 # include "DNA_collection_types.h"
88 # include "DNA_curve_types.h"
89 # include "DNA_gpencil_types.h"
90 # include "DNA_hair_types.h"
91 # include "DNA_lattice_types.h"
92 # include "DNA_light_types.h"
93 # include "DNA_lightprobe_types.h"
94 # include "DNA_mask_types.h"
95 # include "DNA_material_types.h"
96 # include "DNA_mesh_types.h"
97 # include "DNA_meta_types.h"
98 # include "DNA_movieclip_types.h"
99 # include "DNA_node_types.h"
100 # include "DNA_particle_types.h"
101 # include "DNA_pointcloud_types.h"
102 # include "DNA_simulation_types.h"
103 # include "DNA_sound_types.h"
104 # include "DNA_speaker_types.h"
105 # include "DNA_text_types.h"
106 # include "DNA_texture_types.h"
107 # include "DNA_vfont_types.h"
108 # include "DNA_volume_types.h"
109 # include "DNA_world_types.h"
111 # include "ED_screen.h"
113 # include "BLT_translation.h"
116 # include "BPY_extern.h"
120 # include "WM_types.h"
122 static void rna_idname_validate(const char *name, char *r_name)
124 BLI_strncpy(r_name, name, MAX_ID_NAME - 2);
125 BLI_utf8_invalid_strip(r_name, strlen(r_name));
128 static void rna_Main_ID_remove(Main *bmain,
135 ID *id = id_ptr->data;
136 if (id->tag & LIB_TAG_NO_MAIN) {
139 "%s '%s' is outside of main database and can not be removed from it",
140 BKE_idtype_idcode_to_name(GS(id->name)),
145 BKE_id_delete(bmain, id);
146 RNA_POINTER_INVALIDATE(id_ptr);
147 /* Force full redraw, mandatory to avoid crashes when running this from UI... */
148 WM_main_add_notifier(NC_WINDOW, NULL);
150 else if (ID_REAL_USERS(id) <= 0) {
151 const int flag = (do_id_user ? 0 : LIB_ID_FREE_NO_USER_REFCOUNT) |
152 (do_ui_user ? 0 : LIB_ID_FREE_NO_UI_USER);
153 /* Still using ID flags here, this is in-between commit anyway... */
154 BKE_id_free_ex(bmain, id, flag, true);
155 RNA_POINTER_INVALIDATE(id_ptr);
161 "%s '%s' must have zero users to be removed, found %d (try with do_unlink=True parameter)",
162 BKE_idtype_idcode_to_name(GS(id->name)),
168 static Camera *rna_Main_cameras_new(Main *bmain, const char *name)
170 char safe_name[MAX_ID_NAME - 2];
171 rna_idname_validate(name, safe_name);
173 ID *id = BKE_camera_add(bmain, safe_name);
176 WM_main_add_notifier(NC_ID | NA_ADDED, NULL);
181 static Scene *rna_Main_scenes_new(Main *bmain, const char *name)
183 char safe_name[MAX_ID_NAME - 2];
184 rna_idname_validate(name, safe_name);
186 Scene *scene = BKE_scene_add(bmain, safe_name);
188 WM_main_add_notifier(NC_ID | NA_ADDED, NULL);
192 static void rna_Main_scenes_remove(
193 Main *bmain, bContext *C, ReportList *reports, PointerRNA *scene_ptr, bool do_unlink)
195 /* don't call BKE_id_free(...) directly */
196 Scene *scene = scene_ptr->data;
198 if (BKE_scene_can_be_removed(bmain, scene)) {
199 Scene *scene_new = scene->id.prev ? scene->id.prev : scene->id.next;
201 wmWindow *win = CTX_wm_window(C);
203 if (WM_window_get_active_scene(win) == scene) {
206 BPy_BEGIN_ALLOW_THREADS;
209 WM_window_set_active_scene(bmain, C, win, scene_new);
212 BPy_END_ALLOW_THREADS;
216 rna_Main_ID_remove(bmain, reports, scene_ptr, do_unlink, true, true);
221 "Scene '%s' is the last local one, cannot be removed",
226 static Object *rna_Main_objects_new(Main *bmain, ReportList *reports, const char *name, ID *data)
228 if (data != NULL && (data->tag & LIB_TAG_NO_MAIN)) {
231 "Can not create object in main database with an evaluated data data-block");
235 char safe_name[MAX_ID_NAME - 2];
236 rna_idname_validate(name, safe_name);
242 type = BKE_object_obdata_to_type(data);
245 if (RNA_enum_id_from_value(rna_enum_id_type_items, GS(data->name), &idname) == 0) {
249 BKE_reportf(reports, RPT_ERROR, "ID type '%s' is not valid for an object", idname);
256 ob = BKE_object_add_only_object(bmain, type, safe_name);
259 BKE_object_materials_test(bmain, ob, ob->data);
261 WM_main_add_notifier(NC_ID | NA_ADDED, NULL);
266 static Material *rna_Main_materials_new(Main *bmain, const char *name)
268 char safe_name[MAX_ID_NAME - 2];
269 rna_idname_validate(name, safe_name);
271 ID *id = (ID *)BKE_material_add(bmain, safe_name);
274 WM_main_add_notifier(NC_ID | NA_ADDED, NULL);
276 return (Material *)id;
279 static void rna_Main_materials_gpencil_data(Main *UNUSED(bmain), PointerRNA *id_ptr)
281 ID *id = id_ptr->data;
282 Material *ma = (Material *)id;
283 BKE_gpencil_material_attr_init(ma);
286 static void rna_Main_materials_gpencil_remove(Main *UNUSED(bmain), PointerRNA *id_ptr)
288 ID *id = id_ptr->data;
289 Material *ma = (Material *)id;
291 MEM_SAFE_FREE(ma->gp_style);
295 static const EnumPropertyItem *rna_Main_nodetree_type_itemf(bContext *UNUSED(C),
296 PointerRNA *UNUSED(ptr),
297 PropertyRNA *UNUSED(prop),
300 return rna_node_tree_type_itemf(NULL, NULL, r_free);
302 static struct bNodeTree *rna_Main_nodetree_new(Main *bmain, const char *name, int type)
304 char safe_name[MAX_ID_NAME - 2];
305 rna_idname_validate(name, safe_name);
307 bNodeTreeType *typeinfo = rna_node_tree_type_from_enum(type);
309 bNodeTree *ntree = ntreeAddTree(bmain, safe_name, typeinfo->idname);
311 id_us_min(&ntree->id);
319 static Mesh *rna_Main_meshes_new(Main *bmain, const char *name)
321 char safe_name[MAX_ID_NAME - 2];
322 rna_idname_validate(name, safe_name);
324 Mesh *me = BKE_mesh_add(bmain, safe_name);
327 WM_main_add_notifier(NC_ID | NA_ADDED, NULL);
332 /* copied from Mesh_getFromObject and adapted to RNA interface */
333 static Mesh *rna_Main_meshes_new_from_object(Main *bmain,
336 bool preserve_all_data_layers,
337 Depsgraph *depsgraph)
339 switch (object->type) {
347 BKE_report(reports, RPT_ERROR, "Object does not have geometry data");
351 Mesh *mesh = BKE_mesh_new_from_object_to_bmain(
352 bmain, depsgraph, object, preserve_all_data_layers);
354 WM_main_add_notifier(NC_ID | NA_ADDED, NULL);
359 static Light *rna_Main_lights_new(Main *bmain, const char *name, int type)
361 char safe_name[MAX_ID_NAME - 2];
362 rna_idname_validate(name, safe_name);
364 Light *lamp = BKE_light_add(bmain, safe_name);
366 id_us_min(&lamp->id);
368 WM_main_add_notifier(NC_ID | NA_ADDED, NULL);
373 static Image *rna_Main_images_new(Main *bmain,
383 char safe_name[MAX_ID_NAME - 2];
384 rna_idname_validate(name, safe_name);
386 float color[4] = {0.0, 0.0, 0.0, 1.0};
387 Image *image = BKE_image_add_generated(bmain,
398 id_us_min(&image->id);
400 WM_main_add_notifier(NC_ID | NA_ADDED, NULL);
404 static Image *rna_Main_images_load(Main *bmain,
406 const char *filepath,
412 if (check_existing) {
413 ima = BKE_image_load_exists(bmain, filepath);
416 ima = BKE_image_load(bmain, filepath);
422 "Cannot read '%s': %s",
424 errno ? strerror(errno) : TIP_("unsupported image format"));
427 id_us_min((ID *)ima);
429 WM_main_add_notifier(NC_ID | NA_ADDED, NULL);
434 static Lattice *rna_Main_lattices_new(Main *bmain, const char *name)
436 char safe_name[MAX_ID_NAME - 2];
437 rna_idname_validate(name, safe_name);
439 Lattice *lt = BKE_lattice_add(bmain, safe_name);
442 WM_main_add_notifier(NC_ID | NA_ADDED, NULL);
447 static Curve *rna_Main_curves_new(Main *bmain, const char *name, int type)
449 char safe_name[MAX_ID_NAME - 2];
450 rna_idname_validate(name, safe_name);
452 Curve *cu = BKE_curve_add(bmain, safe_name, type);
455 WM_main_add_notifier(NC_ID | NA_ADDED, NULL);
460 static MetaBall *rna_Main_metaballs_new(Main *bmain, const char *name)
462 char safe_name[MAX_ID_NAME - 2];
463 rna_idname_validate(name, safe_name);
465 MetaBall *mb = BKE_mball_add(bmain, safe_name);
468 WM_main_add_notifier(NC_ID | NA_ADDED, NULL);
473 static VFont *rna_Main_fonts_load(Main *bmain,
475 const char *filepath,
481 if (check_existing) {
482 font = BKE_vfont_load_exists(bmain, filepath);
485 font = BKE_vfont_load(bmain, filepath);
491 "Cannot read '%s': %s",
493 errno ? strerror(errno) : TIP_("unsupported font format"));
496 WM_main_add_notifier(NC_ID | NA_ADDED, NULL);
501 static Tex *rna_Main_textures_new(Main *bmain, const char *name, int type)
503 char safe_name[MAX_ID_NAME - 2];
504 rna_idname_validate(name, safe_name);
506 Tex *tex = BKE_texture_add(bmain, safe_name);
507 BKE_texture_type_set(tex, type);
510 WM_main_add_notifier(NC_ID | NA_ADDED, NULL);
515 static Brush *rna_Main_brushes_new(Main *bmain, const char *name, int mode)
517 char safe_name[MAX_ID_NAME - 2];
518 rna_idname_validate(name, safe_name);
520 Brush *brush = BKE_brush_add(bmain, safe_name, mode);
521 id_us_min(&brush->id);
523 WM_main_add_notifier(NC_ID | NA_ADDED, NULL);
528 static void rna_Main_brush_gpencil_data(Main *UNUSED(bmain), PointerRNA *id_ptr)
530 ID *id = id_ptr->data;
531 Brush *brush = (Brush *)id;
532 BKE_brush_init_gpencil_settings(brush);
535 static World *rna_Main_worlds_new(Main *bmain, const char *name)
537 char safe_name[MAX_ID_NAME - 2];
538 rna_idname_validate(name, safe_name);
540 World *world = BKE_world_add(bmain, safe_name);
541 id_us_min(&world->id);
543 WM_main_add_notifier(NC_ID | NA_ADDED, NULL);
548 static Collection *rna_Main_collections_new(Main *bmain, const char *name)
550 char safe_name[MAX_ID_NAME - 2];
551 rna_idname_validate(name, safe_name);
553 Collection *collection = BKE_collection_add(bmain, NULL, safe_name);
555 WM_main_add_notifier(NC_ID | NA_ADDED, NULL);
560 static Speaker *rna_Main_speakers_new(Main *bmain, const char *name)
562 char safe_name[MAX_ID_NAME - 2];
563 rna_idname_validate(name, safe_name);
565 Speaker *speaker = BKE_speaker_add(bmain, safe_name);
566 id_us_min(&speaker->id);
568 WM_main_add_notifier(NC_ID | NA_ADDED, NULL);
573 static bSound *rna_Main_sounds_load(Main *bmain, const char *name, bool check_existing)
577 if (check_existing) {
578 sound = BKE_sound_new_file_exists(bmain, name);
581 sound = BKE_sound_new_file(bmain, name);
584 id_us_min(&sound->id);
586 WM_main_add_notifier(NC_ID | NA_ADDED, NULL);
591 static Text *rna_Main_texts_new(Main *bmain, const char *name)
593 char safe_name[MAX_ID_NAME - 2];
594 rna_idname_validate(name, safe_name);
596 Text *text = BKE_text_add(bmain, safe_name);
598 WM_main_add_notifier(NC_ID | NA_ADDED, NULL);
603 static Text *rna_Main_texts_load(Main *bmain,
605 const char *filepath,
611 txt = BKE_text_load_ex(bmain, filepath, BKE_main_blendfile_path(bmain), is_internal);
616 "Cannot read '%s': %s",
618 errno ? strerror(errno) : TIP_("unable to load text"));
621 WM_main_add_notifier(NC_ID | NA_ADDED, NULL);
626 static bArmature *rna_Main_armatures_new(Main *bmain, const char *name)
628 char safe_name[MAX_ID_NAME - 2];
629 rna_idname_validate(name, safe_name);
631 bArmature *arm = BKE_armature_add(bmain, safe_name);
634 WM_main_add_notifier(NC_ID | NA_ADDED, NULL);
639 static bAction *rna_Main_actions_new(Main *bmain, const char *name)
641 char safe_name[MAX_ID_NAME - 2];
642 rna_idname_validate(name, safe_name);
644 bAction *act = BKE_action_add(bmain, safe_name);
645 id_fake_user_clear(&act->id);
647 WM_main_add_notifier(NC_ID | NA_ADDED, NULL);
652 static ParticleSettings *rna_Main_particles_new(Main *bmain, const char *name)
654 char safe_name[MAX_ID_NAME - 2];
655 rna_idname_validate(name, safe_name);
657 ParticleSettings *part = BKE_particlesettings_add(bmain, safe_name);
658 id_us_min(&part->id);
660 WM_main_add_notifier(NC_ID | NA_ADDED, NULL);
665 static Palette *rna_Main_palettes_new(Main *bmain, const char *name)
667 char safe_name[MAX_ID_NAME - 2];
668 rna_idname_validate(name, safe_name);
670 Palette *palette = BKE_palette_add(bmain, safe_name);
671 id_us_min(&palette->id);
673 WM_main_add_notifier(NC_ID | NA_ADDED, NULL);
675 return (Palette *)palette;
678 static MovieClip *rna_Main_movieclip_load(Main *bmain,
680 const char *filepath,
687 if (check_existing) {
688 clip = BKE_movieclip_file_add_exists(bmain, filepath);
691 clip = BKE_movieclip_file_add(bmain, filepath);
695 DEG_relations_tag_update(bmain);
700 "Cannot read '%s': %s",
702 errno ? strerror(errno) : TIP_("unable to load movie clip"));
705 id_us_min((ID *)clip);
707 WM_main_add_notifier(NC_ID | NA_ADDED, NULL);
712 static Mask *rna_Main_mask_new(Main *bmain, const char *name)
714 char safe_name[MAX_ID_NAME - 2];
715 rna_idname_validate(name, safe_name);
717 Mask *mask = BKE_mask_new(bmain, safe_name);
719 WM_main_add_notifier(NC_ID | NA_ADDED, NULL);
724 static FreestyleLineStyle *rna_Main_linestyles_new(Main *bmain, const char *name)
726 char safe_name[MAX_ID_NAME - 2];
727 rna_idname_validate(name, safe_name);
729 FreestyleLineStyle *linestyle = BKE_linestyle_new(bmain, safe_name);
730 id_us_min(&linestyle->id);
732 WM_main_add_notifier(NC_ID | NA_ADDED, NULL);
737 static LightProbe *rna_Main_lightprobe_new(Main *bmain, const char *name, int type)
739 char safe_name[MAX_ID_NAME - 2];
740 rna_idname_validate(name, safe_name);
742 LightProbe *probe = BKE_lightprobe_add(bmain, safe_name);
744 BKE_lightprobe_type_set(probe, type);
746 id_us_min(&probe->id);
748 WM_main_add_notifier(NC_ID | NA_ADDED, NULL);
753 static bGPdata *rna_Main_gpencils_new(Main *bmain, const char *name)
755 char safe_name[MAX_ID_NAME - 2];
756 rna_idname_validate(name, safe_name);
758 bGPdata *gpd = BKE_gpencil_data_addnew(bmain, safe_name);
761 WM_main_add_notifier(NC_ID | NA_ADDED, NULL);
766 # ifdef WITH_HAIR_NODES
767 static Hair *rna_Main_hairs_new(Main *bmain, const char *name)
769 char safe_name[MAX_ID_NAME - 2];
770 rna_idname_validate(name, safe_name);
772 Hair *hair = BKE_hair_add(bmain, safe_name);
773 id_us_min(&hair->id);
775 WM_main_add_notifier(NC_ID | NA_ADDED, NULL);
781 # ifdef WITH_POINT_CLOUD
782 static PointCloud *rna_Main_pointclouds_new(Main *bmain, const char *name)
784 char safe_name[MAX_ID_NAME - 2];
785 rna_idname_validate(name, safe_name);
787 PointCloud *pointcloud = BKE_pointcloud_add(bmain, safe_name);
788 id_us_min(&pointcloud->id);
790 WM_main_add_notifier(NC_ID | NA_ADDED, NULL);
796 static Volume *rna_Main_volumes_new(Main *bmain, const char *name)
798 char safe_name[MAX_ID_NAME - 2];
799 rna_idname_validate(name, safe_name);
801 Volume *volume = BKE_volume_add(bmain, safe_name);
802 id_us_min(&volume->id);
804 WM_main_add_notifier(NC_ID | NA_ADDED, NULL);
809 # ifdef WITH_GEOMETRY_NODES
810 static Simulation *rna_Main_simulations_new(Main *bmain, const char *name)
812 char safe_name[MAX_ID_NAME - 2];
813 rna_idname_validate(name, safe_name);
815 Simulation *simulation = BKE_simulation_add(bmain, safe_name);
816 id_us_min(&simulation->id);
818 WM_main_add_notifier(NC_ID | NA_ADDED, NULL);
824 /* tag functions, all the same */
825 # define RNA_MAIN_ID_TAG_FUNCS_DEF(_func_name, _listbase_name, _id_type) \
826 static void rna_Main_##_func_name##_tag(Main *bmain, bool value) \
828 BKE_main_id_tag_listbase(&bmain->_listbase_name, LIB_TAG_DOIT, value); \
831 RNA_MAIN_ID_TAG_FUNCS_DEF(cameras, cameras, ID_CA)
832 RNA_MAIN_ID_TAG_FUNCS_DEF(scenes, scenes, ID_SCE)
833 RNA_MAIN_ID_TAG_FUNCS_DEF(objects, objects, ID_OB)
834 RNA_MAIN_ID_TAG_FUNCS_DEF(materials, materials, ID_MA)
835 RNA_MAIN_ID_TAG_FUNCS_DEF(node_groups, nodetrees, ID_NT)
836 RNA_MAIN_ID_TAG_FUNCS_DEF(meshes, meshes, ID_ME)
837 RNA_MAIN_ID_TAG_FUNCS_DEF(lights, lights, ID_LA)
838 RNA_MAIN_ID_TAG_FUNCS_DEF(libraries, libraries, ID_LI)
839 RNA_MAIN_ID_TAG_FUNCS_DEF(screens, screens, ID_SCR)
840 RNA_MAIN_ID_TAG_FUNCS_DEF(window_managers, wm, ID_WM)
841 RNA_MAIN_ID_TAG_FUNCS_DEF(images, images, ID_IM)
842 RNA_MAIN_ID_TAG_FUNCS_DEF(lattices, lattices, ID_LT)
843 RNA_MAIN_ID_TAG_FUNCS_DEF(curves, curves, ID_CU)
844 RNA_MAIN_ID_TAG_FUNCS_DEF(metaballs, metaballs, ID_MB)
845 RNA_MAIN_ID_TAG_FUNCS_DEF(fonts, fonts, ID_VF)
846 RNA_MAIN_ID_TAG_FUNCS_DEF(textures, textures, ID_TE)
847 RNA_MAIN_ID_TAG_FUNCS_DEF(brushes, brushes, ID_BR)
848 RNA_MAIN_ID_TAG_FUNCS_DEF(worlds, worlds, ID_WO)
849 RNA_MAIN_ID_TAG_FUNCS_DEF(collections, collections, ID_GR)
850 // RNA_MAIN_ID_TAG_FUNCS_DEF(shape_keys, key, ID_KE)
851 RNA_MAIN_ID_TAG_FUNCS_DEF(texts, texts, ID_TXT)
852 RNA_MAIN_ID_TAG_FUNCS_DEF(speakers, speakers, ID_SPK)
853 RNA_MAIN_ID_TAG_FUNCS_DEF(sounds, sounds, ID_SO)
854 RNA_MAIN_ID_TAG_FUNCS_DEF(armatures, armatures, ID_AR)
855 RNA_MAIN_ID_TAG_FUNCS_DEF(actions, actions, ID_AC)
856 RNA_MAIN_ID_TAG_FUNCS_DEF(particles, particles, ID_PA)
857 RNA_MAIN_ID_TAG_FUNCS_DEF(palettes, palettes, ID_PAL)
858 RNA_MAIN_ID_TAG_FUNCS_DEF(gpencils, gpencils, ID_GD)
859 RNA_MAIN_ID_TAG_FUNCS_DEF(movieclips, movieclips, ID_MC)
860 RNA_MAIN_ID_TAG_FUNCS_DEF(masks, masks, ID_MSK)
861 RNA_MAIN_ID_TAG_FUNCS_DEF(linestyle, linestyles, ID_LS)
862 RNA_MAIN_ID_TAG_FUNCS_DEF(cachefiles, cachefiles, ID_CF)
863 RNA_MAIN_ID_TAG_FUNCS_DEF(paintcurves, paintcurves, ID_PC)
864 RNA_MAIN_ID_TAG_FUNCS_DEF(workspaces, workspaces, ID_WS)
865 RNA_MAIN_ID_TAG_FUNCS_DEF(lightprobes, lightprobes, ID_LP)
866 # ifdef WITH_HAIR_NODES
867 RNA_MAIN_ID_TAG_FUNCS_DEF(hairs, hairs, ID_HA)
869 # ifdef WITH_POINT_CLOUD
870 RNA_MAIN_ID_TAG_FUNCS_DEF(pointclouds, pointclouds, ID_PT)
872 RNA_MAIN_ID_TAG_FUNCS_DEF(volumes, volumes, ID_VO)
873 # ifdef WITH_GEOMETRY_NODES
874 RNA_MAIN_ID_TAG_FUNCS_DEF(simulations, simulations, ID_SIM)
877 # undef RNA_MAIN_ID_TAG_FUNCS_DEF
881 void RNA_api_main(StructRNA *UNUSED(srna))
887 /* maybe we want to add functions in 'bpy.data' still?
888 * for now they are all in collections bpy.data.images.new(...) */
889 func = RNA_def_function(srna, "add_image", "rna_Main_add_image");
890 RNA_def_function_ui_description(func, "Add a new image");
891 parm = RNA_def_string_file_path(func, "filepath", NULL, 0, "", "File path to load image from");
892 RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
893 parm = RNA_def_pointer(func, "image", "Image", "", "New image");
894 RNA_def_function_return(func, parm);
898 void RNA_def_main_cameras(BlenderRNA *brna, PropertyRNA *cprop)
904 RNA_def_property_srna(cprop, "BlendDataCameras");
905 srna = RNA_def_struct(brna, "BlendDataCameras", NULL);
906 RNA_def_struct_sdna(srna, "Main");
907 RNA_def_struct_ui_text(srna, "Main Cameras", "Collection of cameras");
909 func = RNA_def_function(srna, "new", "rna_Main_cameras_new");
910 RNA_def_function_ui_description(func, "Add a new camera to the main database");
911 parm = RNA_def_string(func, "name", "Camera", 0, "", "New name for the data-block");
912 RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
914 parm = RNA_def_pointer(func, "camera", "Camera", "", "New camera data-block");
915 RNA_def_function_return(func, parm);
917 func = RNA_def_function(srna, "remove", "rna_Main_ID_remove");
918 RNA_def_function_flag(func, FUNC_USE_REPORTS);
919 RNA_def_function_ui_description(func, "Remove a camera from the current blendfile");
920 parm = RNA_def_pointer(func, "camera", "Camera", "", "Camera to remove");
921 RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
922 RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
923 RNA_def_boolean(func,
927 "Unlink all usages of this camera before deleting it "
928 "(WARNING: will also delete objects instancing that camera data)");
929 RNA_def_boolean(func,
933 "Decrement user counter of all datablocks used by this camera");
935 func, "do_ui_user", true, "", "Make sure interface does not reference this camera");
937 func = RNA_def_function(srna, "tag", "rna_Main_cameras_tag");
938 parm = RNA_def_boolean(func, "value", 0, "Value", "");
939 RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
942 void RNA_def_main_scenes(BlenderRNA *brna, PropertyRNA *cprop)
948 RNA_def_property_srna(cprop, "BlendDataScenes");
949 srna = RNA_def_struct(brna, "BlendDataScenes", NULL);
950 RNA_def_struct_sdna(srna, "Main");
951 RNA_def_struct_ui_text(srna, "Main Scenes", "Collection of scenes");
953 func = RNA_def_function(srna, "new", "rna_Main_scenes_new");
954 RNA_def_function_ui_description(func, "Add a new scene to the main database");
955 parm = RNA_def_string(func, "name", "Scene", 0, "", "New name for the data-block");
956 RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
958 parm = RNA_def_pointer(func, "scene", "Scene", "", "New scene data-block");
959 RNA_def_function_return(func, parm);
961 func = RNA_def_function(srna, "remove", "rna_Main_scenes_remove");
962 RNA_def_function_flag(func, FUNC_USE_CONTEXT | FUNC_USE_REPORTS);
963 RNA_def_function_ui_description(func, "Remove a scene from the current blendfile");
964 parm = RNA_def_pointer(func, "scene", "Scene", "", "Scene to remove");
965 RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
966 RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
968 func, "do_unlink", true, "", "Unlink all usages of this scene before deleting it");
970 func = RNA_def_function(srna, "tag", "rna_Main_scenes_tag");
971 parm = RNA_def_boolean(func, "value", 0, "Value", "");
972 RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
975 void RNA_def_main_objects(BlenderRNA *brna, PropertyRNA *cprop)
981 RNA_def_property_srna(cprop, "BlendDataObjects");
982 srna = RNA_def_struct(brna, "BlendDataObjects", NULL);
983 RNA_def_struct_sdna(srna, "Main");
984 RNA_def_struct_ui_text(srna, "Main Objects", "Collection of objects");
986 func = RNA_def_function(srna, "new", "rna_Main_objects_new");
987 RNA_def_function_flag(func, FUNC_USE_REPORTS);
988 RNA_def_function_ui_description(func, "Add a new object to the main database");
989 parm = RNA_def_string(func, "name", "Object", 0, "", "New name for the data-block");
990 RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
991 parm = RNA_def_pointer(func, "object_data", "ID", "", "Object data or None for an empty object");
992 RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
995 parm = RNA_def_pointer(func, "object", "Object", "", "New object data-block");
996 RNA_def_function_return(func, parm);
998 func = RNA_def_function(srna, "remove", "rna_Main_ID_remove");
999 RNA_def_function_ui_description(func, "Remove a object from the current blendfile");
1000 RNA_def_function_flag(func, FUNC_USE_REPORTS);
1001 parm = RNA_def_pointer(func, "object", "Object", "", "Object to remove");
1002 RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
1003 RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
1005 func, "do_unlink", true, "", "Unlink all usages of this object before deleting it");
1006 RNA_def_boolean(func,
1010 "Decrement user counter of all datablocks used by this object");
1012 func, "do_ui_user", true, "", "Make sure interface does not reference this object");
1014 func = RNA_def_function(srna, "tag", "rna_Main_objects_tag");
1015 parm = RNA_def_boolean(func, "value", 0, "Value", "");
1016 RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
1019 void RNA_def_main_materials(BlenderRNA *brna, PropertyRNA *cprop)
1025 RNA_def_property_srna(cprop, "BlendDataMaterials");
1026 srna = RNA_def_struct(brna, "BlendDataMaterials", NULL);
1027 RNA_def_struct_sdna(srna, "Main");
1028 RNA_def_struct_ui_text(srna, "Main Materials", "Collection of materials");
1030 func = RNA_def_function(srna, "new", "rna_Main_materials_new");
1031 RNA_def_function_ui_description(func, "Add a new material to the main database");
1032 parm = RNA_def_string(func, "name", "Material", 0, "", "New name for the data-block");
1033 RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
1035 parm = RNA_def_pointer(func, "material", "Material", "", "New material data-block");
1036 RNA_def_function_return(func, parm);
1038 func = RNA_def_function(srna, "create_gpencil_data", "rna_Main_materials_gpencil_data");
1039 RNA_def_function_ui_description(func, "Add grease pencil material settings");
1040 parm = RNA_def_pointer(func, "material", "Material", "", "Material");
1041 RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
1043 func = RNA_def_function(srna, "remove_gpencil_data", "rna_Main_materials_gpencil_remove");
1044 RNA_def_function_ui_description(func, "Remove grease pencil material settings");
1045 parm = RNA_def_pointer(func, "material", "Material", "", "Material");
1046 RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
1048 func = RNA_def_function(srna, "remove", "rna_Main_ID_remove");
1049 RNA_def_function_flag(func, FUNC_USE_REPORTS);
1050 RNA_def_function_ui_description(func, "Remove a material from the current blendfile");
1051 parm = RNA_def_pointer(func, "material", "Material", "", "Material to remove");
1052 RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
1053 RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
1055 func, "do_unlink", true, "", "Unlink all usages of this material before deleting it");
1056 RNA_def_boolean(func,
1060 "Decrement user counter of all datablocks used by this material");
1062 func, "do_ui_user", true, "", "Make sure interface does not reference this material");
1064 func = RNA_def_function(srna, "tag", "rna_Main_materials_tag");
1065 parm = RNA_def_boolean(func, "value", 0, "Value", "");
1066 RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
1068 void RNA_def_main_node_groups(BlenderRNA *brna, PropertyRNA *cprop)
1074 static const EnumPropertyItem dummy_items[] = {
1075 {0, "DUMMY", 0, "", ""},
1076 {0, NULL, 0, NULL, NULL},
1079 RNA_def_property_srna(cprop, "BlendDataNodeTrees");
1080 srna = RNA_def_struct(brna, "BlendDataNodeTrees", NULL);
1081 RNA_def_struct_sdna(srna, "Main");
1082 RNA_def_struct_ui_text(srna, "Main Node Trees", "Collection of node trees");
1084 func = RNA_def_function(srna, "new", "rna_Main_nodetree_new");
1085 RNA_def_function_ui_description(func, "Add a new node tree to the main database");
1086 parm = RNA_def_string(func, "name", "NodeGroup", 0, "", "New name for the data-block");
1087 RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
1088 parm = RNA_def_enum(func, "type", dummy_items, 0, "Type", "The type of node_group to add");
1089 RNA_def_property_enum_funcs(parm, NULL, NULL, "rna_Main_nodetree_type_itemf");
1090 RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
1092 parm = RNA_def_pointer(func, "tree", "NodeTree", "", "New node tree data-block");
1093 RNA_def_function_return(func, parm);
1095 func = RNA_def_function(srna, "remove", "rna_Main_ID_remove");
1096 RNA_def_function_flag(func, FUNC_USE_REPORTS);
1097 RNA_def_function_ui_description(func, "Remove a node tree from the current blendfile");
1098 parm = RNA_def_pointer(func, "tree", "NodeTree", "", "Node tree to remove");
1099 RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
1100 RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
1102 func, "do_unlink", true, "", "Unlink all usages of this node tree before deleting it");
1103 RNA_def_boolean(func,
1107 "Decrement user counter of all datablocks used by this node tree");
1109 func, "do_ui_user", true, "", "Make sure interface does not reference this node tree");
1111 func = RNA_def_function(srna, "tag", "rna_Main_node_groups_tag");
1112 parm = RNA_def_boolean(func, "value", 0, "Value", "");
1113 RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
1115 void RNA_def_main_meshes(BlenderRNA *brna, PropertyRNA *cprop)
1121 RNA_def_property_srna(cprop, "BlendDataMeshes");
1122 srna = RNA_def_struct(brna, "BlendDataMeshes", NULL);
1123 RNA_def_struct_sdna(srna, "Main");
1124 RNA_def_struct_ui_text(srna, "Main Meshes", "Collection of meshes");
1126 func = RNA_def_function(srna, "new", "rna_Main_meshes_new");
1127 RNA_def_function_ui_description(func, "Add a new mesh to the main database");
1128 parm = RNA_def_string(func, "name", "Mesh", 0, "", "New name for the data-block");
1129 RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
1131 parm = RNA_def_pointer(func, "mesh", "Mesh", "", "New mesh data-block");
1132 RNA_def_function_return(func, parm);
1134 func = RNA_def_function(srna, "new_from_object", "rna_Main_meshes_new_from_object");
1135 RNA_def_function_ui_description(
1137 "Add a new mesh created from given object (undeformed geometry if object is original, and "
1138 "final evaluated geometry, with all modifiers etc., if object is evaluated)");
1139 RNA_def_function_flag(func, FUNC_USE_REPORTS);
1140 parm = RNA_def_pointer(func, "object", "Object", "", "Object to create mesh from");
1141 RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
1142 RNA_def_boolean(func,
1143 "preserve_all_data_layers",
1146 "Preserve all data layers in the mesh, like UV maps and vertex groups. "
1147 "By default Blender only computes the subset of data layers needed for viewport "
1148 "display and rendering, for better performance");
1154 "Evaluated dependency graph which is required when preserve_all_data_layers is true");
1155 parm = RNA_def_pointer(func,
1159 "Mesh created from object, remove it if it is only used for export");
1160 RNA_def_function_return(func, parm);
1162 func = RNA_def_function(srna, "remove", "rna_Main_ID_remove");
1163 RNA_def_function_flag(func, FUNC_USE_REPORTS);
1164 RNA_def_function_ui_description(func, "Remove a mesh from the current blendfile");
1165 parm = RNA_def_pointer(func, "mesh", "Mesh", "", "Mesh to remove");
1166 RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
1167 RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
1168 RNA_def_boolean(func,
1172 "Unlink all usages of this mesh before deleting it "
1173 "(WARNING: will also delete objects instancing that mesh data)");
1174 RNA_def_boolean(func,
1178 "Decrement user counter of all datablocks used by this mesh data");
1180 func, "do_ui_user", true, "", "Make sure interface does not reference this mesh data");
1182 func = RNA_def_function(srna, "tag", "rna_Main_meshes_tag");
1183 parm = RNA_def_boolean(func, "value", 0, "Value", "");
1184 RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
1187 void RNA_def_main_lights(BlenderRNA *brna, PropertyRNA *cprop)
1193 RNA_def_property_srna(cprop, "BlendDataLights");
1194 srna = RNA_def_struct(brna, "BlendDataLights", NULL);
1195 RNA_def_struct_sdna(srna, "Main");
1196 RNA_def_struct_ui_text(srna, "Main Lights", "Collection of lights");
1198 func = RNA_def_function(srna, "new", "rna_Main_lights_new");
1199 RNA_def_function_ui_description(func, "Add a new light to the main database");
1200 parm = RNA_def_string(func, "name", "Light", 0, "", "New name for the data-block");
1201 RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
1202 parm = RNA_def_enum(
1203 func, "type", rna_enum_light_type_items, 0, "Type", "The type of texture to add");
1204 RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
1206 parm = RNA_def_pointer(func, "light", "Light", "", "New light data-block");
1207 RNA_def_function_return(func, parm);
1209 func = RNA_def_function(srna, "remove", "rna_Main_ID_remove");
1210 RNA_def_function_flag(func, FUNC_USE_REPORTS);
1211 RNA_def_function_ui_description(func, "Remove a light from the current blendfile");
1212 parm = RNA_def_pointer(func, "light", "Light", "", "Light to remove");
1213 RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
1214 RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
1215 RNA_def_boolean(func,
1219 "Unlink all usages of this Light before deleting it "
1220 "(WARNING: will also delete objects instancing that light data)");
1221 RNA_def_boolean(func,
1225 "Decrement user counter of all datablocks used by this light data");
1227 func, "do_ui_user", true, "", "Make sure interface does not reference this light data");
1229 func = RNA_def_function(srna, "tag", "rna_Main_lights_tag");
1230 parm = RNA_def_boolean(func, "value", 0, "Value", "");
1231 RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
1234 void RNA_def_main_libraries(BlenderRNA *brna, PropertyRNA *cprop)
1240 RNA_def_property_srna(cprop, "BlendDataLibraries");
1241 srna = RNA_def_struct(brna, "BlendDataLibraries", NULL);
1242 RNA_def_struct_sdna(srna, "Main");
1243 RNA_def_struct_ui_text(srna, "Main Libraries", "Collection of libraries");
1245 func = RNA_def_function(srna, "tag", "rna_Main_libraries_tag");
1246 parm = RNA_def_boolean(func, "value", 0, "Value", "");
1247 RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
1249 func = RNA_def_function(srna, "remove", "rna_Main_ID_remove");
1250 RNA_def_function_flag(func, FUNC_USE_REPORTS);
1251 RNA_def_function_ui_description(func, "Remove a camera from the current blendfile");
1252 parm = RNA_def_pointer(func, "library", "Library", "", "Library to remove");
1253 RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
1254 RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
1256 func, "do_unlink", true, "", "Unlink all usages of this library before deleting it");
1257 RNA_def_boolean(func,
1261 "Decrement user counter of all datablocks used by this object");
1263 func, "do_ui_user", true, "", "Make sure interface does not reference this object");
1266 void RNA_def_main_screens(BlenderRNA *brna, PropertyRNA *cprop)
1272 RNA_def_property_srna(cprop, "BlendDataScreens");
1273 srna = RNA_def_struct(brna, "BlendDataScreens", NULL);
1274 RNA_def_struct_sdna(srna, "Main");
1275 RNA_def_struct_ui_text(srna, "Main Screens", "Collection of screens");
1277 func = RNA_def_function(srna, "tag", "rna_Main_screens_tag");
1278 parm = RNA_def_boolean(func, "value", 0, "Value", "");
1279 RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
1282 void RNA_def_main_window_managers(BlenderRNA *brna, PropertyRNA *cprop)
1288 RNA_def_property_srna(cprop, "BlendDataWindowManagers");
1289 srna = RNA_def_struct(brna, "BlendDataWindowManagers", NULL);
1290 RNA_def_struct_sdna(srna, "Main");
1291 RNA_def_struct_ui_text(srna, "Main Window Managers", "Collection of window managers");
1293 func = RNA_def_function(srna, "tag", "rna_Main_window_managers_tag");
1294 parm = RNA_def_boolean(func, "value", 0, "Value", "");
1295 RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
1297 void RNA_def_main_images(BlenderRNA *brna, PropertyRNA *cprop)
1303 RNA_def_property_srna(cprop, "BlendDataImages");
1304 srna = RNA_def_struct(brna, "BlendDataImages", NULL);
1305 RNA_def_struct_sdna(srna, "Main");
1306 RNA_def_struct_ui_text(srna, "Main Images", "Collection of images");
1308 func = RNA_def_function(srna, "new", "rna_Main_images_new");
1309 RNA_def_function_ui_description(func, "Add a new image to the main database");
1310 parm = RNA_def_string(func, "name", "Image", 0, "", "New name for the data-block");
1311 RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
1312 parm = RNA_def_int(func, "width", 1024, 1, INT_MAX, "", "Width of the image", 1, INT_MAX);
1313 RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
1314 parm = RNA_def_int(func, "height", 1024, 1, INT_MAX, "", "Height of the image", 1, INT_MAX);
1315 RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
1316 RNA_def_boolean(func, "alpha", 0, "Alpha", "Use alpha channel");
1318 func, "float_buffer", 0, "Float Buffer", "Create an image with floating-point color");
1319 RNA_def_boolean(func, "stereo3d", 0, "Stereo 3D", "Create left and right views");
1320 RNA_def_boolean(func, "is_data", 0, "Is Data", "Create image with non-color data color space");
1321 RNA_def_boolean(func, "tiled", 0, "Tiled", "Create a tiled image");
1323 parm = RNA_def_pointer(func, "image", "Image", "", "New image data-block");
1324 RNA_def_function_return(func, parm);
1326 func = RNA_def_function(srna, "load", "rna_Main_images_load");
1327 RNA_def_function_flag(func, FUNC_USE_REPORTS);
1328 RNA_def_function_ui_description(func, "Load a new image into the main database");
1329 parm = RNA_def_string_file_path(
1330 func, "filepath", "File Path", 0, "", "path of the file to load");
1331 RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
1332 RNA_def_boolean(func,
1336 "Using existing data-block if this file is already loaded");
1338 parm = RNA_def_pointer(func, "image", "Image", "", "New image data-block");
1339 RNA_def_function_return(func, parm);
1341 func = RNA_def_function(srna, "remove", "rna_Main_ID_remove");
1342 RNA_def_function_flag(func, FUNC_USE_REPORTS);
1343 RNA_def_function_ui_description(func, "Remove an image from the current blendfile");
1344 parm = RNA_def_pointer(func, "image", "Image", "", "Image to remove");
1345 RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
1346 RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
1348 func, "do_unlink", true, "", "Unlink all usages of this image before deleting it");
1350 func, "do_id_user", true, "", "Decrement user counter of all datablocks used by this image");
1352 func, "do_ui_user", true, "", "Make sure interface does not reference this image");
1354 func = RNA_def_function(srna, "tag", "rna_Main_images_tag");
1355 parm = RNA_def_boolean(func, "value", 0, "Value", "");
1356 RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
1359 void RNA_def_main_lattices(BlenderRNA *brna, PropertyRNA *cprop)
1365 RNA_def_property_srna(cprop, "BlendDataLattices");
1366 srna = RNA_def_struct(brna, "BlendDataLattices", NULL);
1367 RNA_def_struct_sdna(srna, "Main");
1368 RNA_def_struct_ui_text(srna, "Main Lattices", "Collection of lattices");
1370 func = RNA_def_function(srna, "new", "rna_Main_lattices_new");
1371 RNA_def_function_ui_description(func, "Add a new lattice to the main database");
1372 parm = RNA_def_string(func, "name", "Lattice", 0, "", "New name for the data-block");
1373 RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
1375 parm = RNA_def_pointer(func, "lattice", "Lattice", "", "New lattices data-block");
1376 RNA_def_function_return(func, parm);
1378 func = RNA_def_function(srna, "remove", "rna_Main_ID_remove");
1379 RNA_def_function_flag(func, FUNC_USE_REPORTS);
1380 RNA_def_function_ui_description(func, "Remove a lattice from the current blendfile");
1381 parm = RNA_def_pointer(func, "lattice", "Lattice", "", "Lattice to remove");
1382 RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
1383 RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
1384 RNA_def_boolean(func,
1388 "Unlink all usages of this lattice before deleting it "
1389 "(WARNING: will also delete objects instancing that lattice data)");
1390 RNA_def_boolean(func,
1394 "Decrement user counter of all datablocks used by this lattice data");
1396 func, "do_ui_user", true, "", "Make sure interface does not reference this lattice data");
1398 func = RNA_def_function(srna, "tag", "rna_Main_lattices_tag");
1399 parm = RNA_def_boolean(func, "value", 0, "Value", "");
1400 RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
1402 void RNA_def_main_curves(BlenderRNA *brna, PropertyRNA *cprop)
1408 RNA_def_property_srna(cprop, "BlendDataCurves");
1409 srna = RNA_def_struct(brna, "BlendDataCurves", NULL);
1410 RNA_def_struct_sdna(srna, "Main");
1411 RNA_def_struct_ui_text(srna, "Main Curves", "Collection of curves");
1413 func = RNA_def_function(srna, "new", "rna_Main_curves_new");
1414 RNA_def_function_ui_description(func, "Add a new curve to the main database");
1415 parm = RNA_def_string(func, "name", "Curve", 0, "", "New name for the data-block");
1416 RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
1417 parm = RNA_def_enum(
1418 func, "type", rna_enum_object_type_curve_items, 0, "Type", "The type of curve to add");
1419 RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
1421 parm = RNA_def_pointer(func, "curve", "Curve", "", "New curve data-block");
1422 RNA_def_function_return(func, parm);
1424 func = RNA_def_function(srna, "remove", "rna_Main_ID_remove");
1425 RNA_def_function_flag(func, FUNC_USE_REPORTS);
1426 RNA_def_function_ui_description(func, "Remove a curve from the current blendfile");
1427 parm = RNA_def_pointer(func, "curve", "Curve", "", "Curve to remove");
1428 RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
1429 RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
1430 RNA_def_boolean(func,
1434 "Unlink all usages of this curve before deleting it "
1435 "(WARNING: will also delete objects instancing that curve data)");
1436 RNA_def_boolean(func,
1440 "Decrement user counter of all datablocks used by this curve data");
1442 func, "do_ui_user", true, "", "Make sure interface does not reference this curve data");
1444 func = RNA_def_function(srna, "tag", "rna_Main_curves_tag");
1445 parm = RNA_def_boolean(func, "value", 0, "Value", "");
1446 RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
1448 void RNA_def_main_metaballs(BlenderRNA *brna, PropertyRNA *cprop)
1454 RNA_def_property_srna(cprop, "BlendDataMetaBalls");
1455 srna = RNA_def_struct(brna, "BlendDataMetaBalls", NULL);
1456 RNA_def_struct_sdna(srna, "Main");
1457 RNA_def_struct_ui_text(srna, "Main Metaballs", "Collection of metaballs");
1459 func = RNA_def_function(srna, "new", "rna_Main_metaballs_new");
1460 RNA_def_function_ui_description(func, "Add a new metaball to the main database");
1461 parm = RNA_def_string(func, "name", "MetaBall", 0, "", "New name for the data-block");
1462 RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
1464 parm = RNA_def_pointer(func, "metaball", "MetaBall", "", "New metaball data-block");
1465 RNA_def_function_return(func, parm);
1467 func = RNA_def_function(srna, "remove", "rna_Main_ID_remove");
1468 RNA_def_function_flag(func, FUNC_USE_REPORTS);
1469 RNA_def_function_ui_description(func, "Remove a metaball from the current blendfile");
1470 parm = RNA_def_pointer(func, "metaball", "MetaBall", "", "Metaball to remove");
1471 RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
1472 RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
1473 RNA_def_boolean(func,
1477 "Unlink all usages of this metaball before deleting it "
1478 "(WARNING: will also delete objects instancing that metaball data)");
1479 RNA_def_boolean(func,
1483 "Decrement user counter of all datablocks used by this metaball data");
1485 func, "do_ui_user", true, "", "Make sure interface does not reference this metaball data");
1487 func = RNA_def_function(srna, "tag", "rna_Main_metaballs_tag");
1488 parm = RNA_def_boolean(func, "value", 0, "Value", "");
1489 RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
1491 void RNA_def_main_fonts(BlenderRNA *brna, PropertyRNA *cprop)
1497 RNA_def_property_srna(cprop, "BlendDataFonts");
1498 srna = RNA_def_struct(brna, "BlendDataFonts", NULL);
1499 RNA_def_struct_sdna(srna, "Main");
1500 RNA_def_struct_ui_text(srna, "Main Fonts", "Collection of fonts");
1502 func = RNA_def_function(srna, "load", "rna_Main_fonts_load");
1503 RNA_def_function_flag(func, FUNC_USE_REPORTS);
1504 RNA_def_function_ui_description(func, "Load a new font into the main database");
1505 parm = RNA_def_string_file_path(
1506 func, "filepath", "File Path", 0, "", "path of the font to load");
1507 RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
1508 RNA_def_boolean(func,
1512 "Using existing data-block if this file is already loaded");
1514 parm = RNA_def_pointer(func, "vfont", "VectorFont", "", "New font data-block");
1515 RNA_def_function_return(func, parm);
1517 func = RNA_def_function(srna, "remove", "rna_Main_ID_remove");
1518 RNA_def_function_flag(func, FUNC_USE_REPORTS);
1519 RNA_def_function_ui_description(func, "Remove a font from the current blendfile");
1520 parm = RNA_def_pointer(func, "vfont", "VectorFont", "", "Font to remove");
1521 RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
1522 RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
1524 func, "do_unlink", true, "", "Unlink all usages of this font before deleting it");
1526 func, "do_id_user", true, "", "Decrement user counter of all datablocks used by this font");
1528 func, "do_ui_user", true, "", "Make sure interface does not reference this font");
1530 func = RNA_def_function(srna, "tag", "rna_Main_fonts_tag");
1531 parm = RNA_def_boolean(func, "value", 0, "Value", "");
1532 RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
1534 void RNA_def_main_textures(BlenderRNA *brna, PropertyRNA *cprop)
1540 RNA_def_property_srna(cprop, "BlendDataTextures");
1541 srna = RNA_def_struct(brna, "BlendDataTextures", NULL);
1542 RNA_def_struct_sdna(srna, "Main");
1543 RNA_def_struct_ui_text(srna, "Main Textures", "Collection of textures");
1545 func = RNA_def_function(srna, "new", "rna_Main_textures_new");
1546 RNA_def_function_ui_description(func, "Add a new texture to the main database");
1547 parm = RNA_def_string(func, "name", "Texture", 0, "", "New name for the data-block");
1548 RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
1549 parm = RNA_def_enum(
1550 func, "type", rna_enum_texture_type_items, 0, "Type", "The type of texture to add");
1551 RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
1553 parm = RNA_def_pointer(func, "texture", "Texture", "", "New texture data-block");
1554 RNA_def_function_return(func, parm);
1556 func = RNA_def_function(srna, "remove", "rna_Main_ID_remove");
1557 RNA_def_function_flag(func, FUNC_USE_REPORTS);
1558 RNA_def_function_ui_description(func, "Remove a texture from the current blendfile");
1559 parm = RNA_def_pointer(func, "texture", "Texture", "", "Texture to remove");
1560 RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
1561 RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
1563 func, "do_unlink", true, "", "Unlink all usages of this texture before deleting it");
1564 RNA_def_boolean(func,
1568 "Decrement user counter of all datablocks used by this texture");
1570 func, "do_ui_user", true, "", "Make sure interface does not reference this texture");
1572 func = RNA_def_function(srna, "tag", "rna_Main_textures_tag");
1573 parm = RNA_def_boolean(func, "value", 0, "Value", "");
1574 RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
1576 void RNA_def_main_brushes(BlenderRNA *brna, PropertyRNA *cprop)
1582 RNA_def_property_srna(cprop, "BlendDataBrushes");
1583 srna = RNA_def_struct(brna, "BlendDataBrushes", NULL);
1584 RNA_def_struct_sdna(srna, "Main");
1585 RNA_def_struct_ui_text(srna, "Main Brushes", "Collection of brushes");
1587 func = RNA_def_function(srna, "new", "rna_Main_brushes_new");
1588 RNA_def_function_ui_description(func, "Add a new brush to the main database");
1589 parm = RNA_def_string(func, "name", "Brush", 0, "", "New name for the data-block");
1590 RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
1591 parm = RNA_def_enum(func,
1593 rna_enum_object_mode_items,
1594 OB_MODE_TEXTURE_PAINT,
1596 "Paint Mode for the new brush");
1598 parm = RNA_def_pointer(func, "brush", "Brush", "", "New brush data-block");
1599 RNA_def_function_return(func, parm);
1601 func = RNA_def_function(srna, "remove", "rna_Main_ID_remove");
1602 RNA_def_function_flag(func, FUNC_USE_REPORTS);
1603 RNA_def_function_ui_description(func, "Remove a brush from the current blendfile");
1604 parm = RNA_def_pointer(func, "brush", "Brush", "", "Brush to remove");
1605 RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
1606 RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
1608 func, "do_unlink", true, "", "Unlink all usages of this brush before deleting it");
1610 func, "do_id_user", true, "", "Decrement user counter of all datablocks used by this brush");
1612 func, "do_ui_user", true, "", "Make sure interface does not reference this brush");
1614 func = RNA_def_function(srna, "tag", "rna_Main_brushes_tag");
1615 parm = RNA_def_boolean(func, "value", 0, "Value", "");
1616 RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
1618 func = RNA_def_function(srna, "create_gpencil_data", "rna_Main_brush_gpencil_data");
1619 RNA_def_function_ui_description(func, "Add grease pencil brush settings");
1620 parm = RNA_def_pointer(func, "brush", "Brush", "", "Brush");
1621 RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
1624 void RNA_def_main_worlds(BlenderRNA *brna, PropertyRNA *cprop)
1630 RNA_def_property_srna(cprop, "BlendDataWorlds");
1631 srna = RNA_def_struct(brna, "BlendDataWorlds", NULL);
1632 RNA_def_struct_sdna(srna, "Main");
1633 RNA_def_struct_ui_text(srna, "Main Worlds", "Collection of worlds");
1635 func = RNA_def_function(srna, "new", "rna_Main_worlds_new");
1636 RNA_def_function_ui_description(func, "Add a new world to the main database");
1637 parm = RNA_def_string(func, "name", "World", 0, "", "New name for the data-block");
1638 RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
1640 parm = RNA_def_pointer(func, "world", "World", "", "New world data-block");
1641 RNA_def_function_return(func, parm);
1643 func = RNA_def_function(srna, "remove", "rna_Main_ID_remove");
1644 RNA_def_function_flag(func, FUNC_USE_REPORTS);
1645 RNA_def_function_ui_description(func, "Remove a world from the current blendfile");
1646 parm = RNA_def_pointer(func, "world", "World", "", "World to remove");
1647 RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
1648 RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
1650 func, "do_unlink", true, "", "Unlink all usages of this world before deleting it");
1652 func, "do_id_user", true, "", "Decrement user counter of all datablocks used by this world");
1654 func, "do_ui_user", true, "", "Make sure interface does not reference this world");
1656 func = RNA_def_function(srna, "tag", "rna_Main_worlds_tag");
1657 parm = RNA_def_boolean(func, "value", 0, "Value", "");
1658 RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
1661 void RNA_def_main_collections(BlenderRNA *brna, PropertyRNA *cprop)
1667 RNA_def_property_srna(cprop, "BlendDataCollections");
1668 srna = RNA_def_struct(brna, "BlendDataCollections", NULL);
1669 RNA_def_struct_sdna(srna, "Main");
1670 RNA_def_struct_ui_text(srna, "Main Collections", "Collection of collections");
1672 func = RNA_def_function(srna, "new", "rna_Main_collections_new");
1673 RNA_def_function_ui_description(func, "Add a new collection to the main database");
1674 parm = RNA_def_string(func, "name", "Collection", 0, "", "New name for the data-block");
1675 RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
1677 parm = RNA_def_pointer(func, "collection", "Collection", "", "New collection data-block");
1678 RNA_def_function_return(func, parm);
1680 func = RNA_def_function(srna, "remove", "rna_Main_ID_remove");
1681 RNA_def_function_ui_description(func, "Remove a collection from the current blendfile");
1682 RNA_def_function_flag(func, FUNC_USE_REPORTS);
1683 parm = RNA_def_pointer(func, "collection", "Collection", "", "Collection to remove");
1684 RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
1685 RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
1687 func, "do_unlink", true, "", "Unlink all usages of this collection before deleting it");
1688 RNA_def_boolean(func,
1692 "Decrement user counter of all datablocks used by this collection");
1694 func, "do_ui_user", true, "", "Make sure interface does not reference this collection");
1696 func = RNA_def_function(srna, "tag", "rna_Main_collections_tag");
1697 parm = RNA_def_boolean(func, "value", 0, "Value", "");
1698 RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
1701 void RNA_def_main_speakers(BlenderRNA *brna, PropertyRNA *cprop)
1707 RNA_def_property_srna(cprop, "BlendDataSpeakers");
1708 srna = RNA_def_struct(brna, "BlendDataSpeakers", NULL);
1709 RNA_def_struct_sdna(srna, "Main");
1710 RNA_def_struct_ui_text(srna, "Main Speakers", "Collection of speakers");
1712 func = RNA_def_function(srna, "new", "rna_Main_speakers_new");
1713 RNA_def_function_ui_description(func, "Add a new speaker to the main database");
1714 parm = RNA_def_string(func, "name", "Speaker", 0, "", "New name for the data-block");
1715 RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
1717 parm = RNA_def_pointer(func, "speaker", "Speaker", "", "New speaker data-block");
1718 RNA_def_function_return(func, parm);
1720 func = RNA_def_function(srna, "remove", "rna_Main_ID_remove");
1721 RNA_def_function_flag(func, FUNC_USE_REPORTS);
1722 RNA_def_function_ui_description(func, "Remove a speaker from the current blendfile");
1723 parm = RNA_def_pointer(func, "speaker", "Speaker", "", "Speaker to remove");
1724 RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
1725 RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
1726 RNA_def_boolean(func,
1730 "Unlink all usages of this speaker before deleting it "
1731 "(WARNING: will also delete objects instancing that speaker data)");
1732 RNA_def_boolean(func,
1736 "Decrement user counter of all datablocks used by this speaker data");
1738 func, "do_ui_user", true, "", "Make sure interface does not reference this speaker data");
1740 func = RNA_def_function(srna, "tag", "rna_Main_speakers_tag");
1741 parm = RNA_def_boolean(func, "value", 0, "Value", "");
1742 RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
1745 void RNA_def_main_texts(BlenderRNA *brna, PropertyRNA *cprop)
1751 RNA_def_property_srna(cprop, "BlendDataTexts");
1752 srna = RNA_def_struct(brna, "BlendDataTexts", NULL);
1753 RNA_def_struct_sdna(srna, "Main");
1754 RNA_def_struct_ui_text(srna, "Main Texts", "Collection of texts");
1756 func = RNA_def_function(srna, "new", "rna_Main_texts_new");
1757 RNA_def_function_ui_description(func, "Add a new text to the main database");
1758 parm = RNA_def_string(func, "name", "Text", 0, "", "New name for the data-block");
1759 RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
1761 parm = RNA_def_pointer(func, "text", "Text", "", "New text data-block");
1762 RNA_def_function_return(func, parm);
1764 func = RNA_def_function(srna, "remove", "rna_Main_ID_remove");
1765 RNA_def_function_ui_description(func, "Remove a text from the current blendfile");
1766 RNA_def_function_flag(func, FUNC_USE_REPORTS);
1767 parm = RNA_def_pointer(func, "text", "Text", "", "Text to remove");
1768 RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
1769 RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
1771 func, "do_unlink", true, "", "Unlink all usages of this text before deleting it");
1773 func, "do_id_user", true, "", "Decrement user counter of all datablocks used by this text");
1775 func, "do_ui_user", true, "", "Make sure interface does not reference this text");
1778 func = RNA_def_function(srna, "load", "rna_Main_texts_load");
1779 RNA_def_function_flag(func, FUNC_USE_REPORTS);
1780 RNA_def_function_ui_description(func, "Add a new text to the main database from a file");
1781 parm = RNA_def_string_file_path(
1782 func, "filepath", "Path", FILE_MAX, "", "path for the data-block");
1783 RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
1784 parm = RNA_def_boolean(
1785 func, "internal", 0, "Make internal", "Make text file internal after loading");
1787 parm = RNA_def_pointer(func, "text", "Text", "", "New text data-block");
1788 RNA_def_function_return(func, parm);
1790 func = RNA_def_function(srna, "tag", "rna_Main_texts_tag");
1791 parm = RNA_def_boolean(func, "value", 0, "Value", "");
1792 RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
1795 void RNA_def_main_sounds(BlenderRNA *brna, PropertyRNA *cprop)
1801 RNA_def_property_srna(cprop, "BlendDataSounds");
1802 srna = RNA_def_struct(brna, "BlendDataSounds", NULL);
1803 RNA_def_struct_sdna(srna, "Main");
1804 RNA_def_struct_ui_text(srna, "Main Sounds", "Collection of sounds");
1807 func = RNA_def_function(srna, "load", "rna_Main_sounds_load");
1808 RNA_def_function_ui_description(func, "Add a new sound to the main database from a file");
1809 parm = RNA_def_string_file_path(
1810 func, "filepath", "Path", FILE_MAX, "", "path for the data-block");
1811 RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
1812 RNA_def_boolean(func,
1816 "Using existing data-block if this file is already loaded");
1818 parm = RNA_def_pointer(func, "sound", "Sound", "", "New text data-block");
1819 RNA_def_function_return(func, parm);
1821 func = RNA_def_function(srna, "remove", "rna_Main_ID_remove");
1822 RNA_def_function_flag(func, FUNC_USE_REPORTS);
1823 RNA_def_function_ui_description(func, "Remove a sound from the current blendfile");
1824 parm = RNA_def_pointer(func, "sound", "Sound", "", "Sound to remove");
1825 RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
1826 RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
1828 func, "do_unlink", true, "", "Unlink all usages of this sound before deleting it");
1830 func, "do_id_user", true, "", "Decrement user counter of all datablocks used by this sound");
1832 func, "do_ui_user", true, "", "Make sure interface does not reference this sound");
1834 func = RNA_def_function(srna, "tag", "rna_Main_sounds_tag");
1835 parm = RNA_def_boolean(func, "value", 0, "Value", "");
1836 RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
1839 void RNA_def_main_armatures(BlenderRNA *brna, PropertyRNA *cprop)
1845 RNA_def_property_srna(cprop, "BlendDataArmatures");
1846 srna = RNA_def_struct(brna, "BlendDataArmatures", NULL);
1847 RNA_def_struct_sdna(srna, "Main");
1848 RNA_def_struct_ui_text(srna, "Main Armatures", "Collection of armatures");
1850 func = RNA_def_function(srna, "new", "rna_Main_armatures_new");
1851 RNA_def_function_ui_description(func, "Add a new armature to the main database");
1852 parm = RNA_def_string(func, "name", "Armature", 0, "", "New name for the data-block");
1853 RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
1855 parm = RNA_def_pointer(func, "armature", "Armature", "", "New armature data-block");
1856 RNA_def_function_return(func, parm);
1858 func = RNA_def_function(srna, "remove", "rna_Main_ID_remove");
1859 RNA_def_function_flag(func, FUNC_USE_REPORTS);
1860 RNA_def_function_ui_description(func, "Remove a armature from the current blendfile");
1861 parm = RNA_def_pointer(func, "armature", "Armature", "", "Armature to remove");
1862 RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
1863 RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
1864 RNA_def_boolean(func,
1868 "Unlink all usages of this armature before deleting it "
1869 "(WARNING: will also delete objects instancing that armature data)");
1870 RNA_def_boolean(func,
1874 "Decrement user counter of all datablocks used by this armature data");
1876 func, "do_ui_user", true, "", "Make sure interface does not reference this armature data");
1878 func = RNA_def_function(srna, "tag", "rna_Main_armatures_tag");
1879 parm = RNA_def_boolean(func, "value", 0, "Value", "");
1880 RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
1882 void RNA_def_main_actions(BlenderRNA *brna, PropertyRNA *cprop)
1888 RNA_def_property_srna(cprop, "BlendDataActions");
1889 srna = RNA_def_struct(brna, "BlendDataActions", NULL);
1890 RNA_def_struct_sdna(srna, "Main");
1891 RNA_def_struct_ui_text(srna, "Main Actions", "Collection of actions");
1893 func = RNA_def_function(srna, "new", "rna_Main_actions_new");
1894 RNA_def_function_ui_description(func, "Add a new action to the main database");
1895 parm = RNA_def_string(func, "name", "Action", 0, "", "New name for the data-block");
1896 RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
1898 parm = RNA_def_pointer(func, "action", "Action", "", "New action data-block");
1899 RNA_def_function_return(func, parm);
1901 func = RNA_def_function(srna, "remove", "rna_Main_ID_remove");
1902 RNA_def_function_flag(func, FUNC_USE_REPORTS);
1903 RNA_def_function_ui_description(func, "Remove a action from the current blendfile");
1904 parm = RNA_def_pointer(func, "action", "Action", "", "Action to remove");
1905 RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
1906 RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
1908 func, "do_unlink", true, "", "Unlink all usages of this action before deleting it");
1909 RNA_def_boolean(func,
1913 "Decrement user counter of all datablocks used by this action");
1915 func, "do_ui_user", true, "", "Make sure interface does not reference this action");
1917 func = RNA_def_function(srna, "tag", "rna_Main_actions_tag");
1918 parm = RNA_def_boolean(func, "value", 0, "Value", "");
1919 RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
1921 void RNA_def_main_particles(BlenderRNA *brna, PropertyRNA *cprop)
1927 RNA_def_property_srna(cprop, "BlendDataParticles");
1928 srna = RNA_def_struct(brna, "BlendDataParticles", NULL);
1929 RNA_def_struct_sdna(srna, "Main");
1930 RNA_def_struct_ui_text(srna, "Main Particle Settings", "Collection of particle settings");
1932 func = RNA_def_function(srna, "new", "rna_Main_particles_new");
1933 RNA_def_function_ui_description(func,
1934 "Add a new particle settings instance to the main database");
1935 parm = RNA_def_string(func, "name", "ParticleSettings", 0, "", "New name for the data-block");
1936 RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
1938 parm = RNA_def_pointer(
1939 func, "particle", "ParticleSettings", "", "New particle settings data-block");
1940 RNA_def_function_return(func, parm);
1942 func = RNA_def_function(srna, "remove", "rna_Main_ID_remove");
1943 RNA_def_function_flag(func, FUNC_USE_REPORTS);
1944 RNA_def_function_ui_description(
1945 func, "Remove a particle settings instance from the current blendfile");
1946 parm = RNA_def_pointer(func, "particle", "ParticleSettings", "", "Particle Settings to remove");
1947 RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
1948 RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
1949 RNA_def_boolean(func,
1953 "Unlink all usages of those particle settings before deleting them");
1954 RNA_def_boolean(func,
1958 "Decrement user counter of all datablocks used by this particle settings");
1959 RNA_def_boolean(func,
1963 "Make sure interface does not reference this particle settings");
1965 func = RNA_def_function(srna, "tag", "rna_Main_particles_tag");
1966 parm = RNA_def_boolean(func, "value", 0, "Value", "");
1967 RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
1970 void RNA_def_main_palettes(BlenderRNA *brna, PropertyRNA *cprop)
1976 RNA_def_property_srna(cprop, "BlendDataPalettes");
1977 srna = RNA_def_struct(brna, "BlendDataPalettes", NULL);
1978 RNA_def_struct_sdna(srna, "Main");
1979 RNA_def_struct_ui_text(srna, "Main Palettes", "Collection of palettes");
1981 func = RNA_def_function(srna, "new", "rna_Main_palettes_new");
1982 RNA_def_function_ui_description(func, "Add a new palette to the main database");
1983 parm = RNA_def_string(func, "name", "Palette", 0, "", "New name for the data-block");
1984 RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
1986 parm = RNA_def_pointer(func, "palette", "Palette", "", "New palette data-block");
1987 RNA_def_function_return(func, parm);
1989 func = RNA_def_function(srna, "remove", "rna_Main_ID_remove");
1990 RNA_def_function_flag(func, FUNC_USE_REPORTS);
1991 RNA_def_function_ui_description(func, "Remove a palette from the current blendfile");
1992 parm = RNA_def_pointer(func, "palette", "Palette", "", "Palette to remove");
1993 RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
1994 RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
1996 func, "do_unlink", true, "", "Unlink all usages of this palette before deleting it");
1997 RNA_def_boolean(func,
2001 "Decrement user counter of all datablocks used by this palette");
2003 func, "do_ui_user", true, "", "Make sure interface does not reference this palette");
2005 func = RNA_def_function(srna, "tag", "rna_Main_palettes_tag");
2006 parm = RNA_def_boolean(func, "value", 0, "Value", "");
2007 RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
2009 void RNA_def_main_cachefiles(BlenderRNA *brna, PropertyRNA *cprop)
2015 RNA_def_property_srna(cprop, "BlendDataCacheFiles");
2016 srna = RNA_def_struct(brna, "BlendDataCacheFiles", NULL);
2017 RNA_def_struct_sdna(srna, "Main");
2018 RNA_def_struct_ui_text(srna, "Main Cache Files", "Collection of cache files");
2020 func = RNA_def_function(srna, "tag", "rna_Main_cachefiles_tag");
2021 parm = RNA_def_boolean(func, "value", 0, "Value", "");
2022 RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
2024 void RNA_def_main_paintcurves(BlenderRNA *brna, PropertyRNA *cprop)
2030 RNA_def_property_srna(cprop, "BlendDataPaintCurves");
2031 srna = RNA_def_struct(brna, "BlendDataPaintCurves", NULL);
2032 RNA_def_struct_sdna(srna, "Main");
2033 RNA_def_struct_ui_text(srna, "Main Paint Curves", "Collection of paint curves");
2035 func = RNA_def_function(srna, "tag", "rna_Main_paintcurves_tag");
2036 parm = RNA_def_boolean(func, "value", 0, "Value", "");
2037 RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
2039 void RNA_def_main_gpencil(BlenderRNA *brna, PropertyRNA *cprop)
2045 RNA_def_property_srna(cprop, "BlendDataGreasePencils");
2046 srna = RNA_def_struct(brna, "BlendDataGreasePencils", NULL);
2047 RNA_def_struct_sdna(srna, "Main");
2048 RNA_def_struct_ui_text(srna, "Main Grease Pencils", "Collection of grease pencils");
2050 func = RNA_def_function(srna, "tag", "rna_Main_gpencils_tag");
2051 parm = RNA_def_boolean(func, "value", 0, "Value", "");
2052 RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
2054 func = RNA_def_function(srna, "new", "rna_Main_gpencils_new");
2055 RNA_def_function_ui_description(func, "Add a new grease pencil datablock to the main database");
2056 parm = RNA_def_string(func, "name", "GreasePencil", 0, "", "New name for the data-block");
2057 RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
2059 parm = RNA_def_pointer(
2060 func, "grease_pencil", "GreasePencil", "", "New grease pencil data-block");
2061 RNA_def_function_return(func, parm);
2063 func = RNA_def_function(srna, "remove", "rna_Main_ID_remove");
2064 RNA_def_function_flag(func, FUNC_USE_REPORTS);
2065 RNA_def_function_ui_description(func,
2066 "Remove a grease pencil instance from the current blendfile");
2067 parm = RNA_def_pointer(func, "grease_pencil", "GreasePencil", "", "Grease Pencil to remove");
2068 RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
2069 RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
2071 func, "do_unlink", true, "", "Unlink all usages of this grease pencil before deleting it");
2072 RNA_def_boolean(func,
2076 "Decrement user counter of all datablocks used by this grease pencil");
2078 func, "do_ui_user", true, "", "Make sure interface does not reference this grease pencil");
2081 void RNA_def_main_movieclips(BlenderRNA *brna, PropertyRNA *cprop)
2087 RNA_def_property_srna(cprop, "BlendDataMovieClips");
2088 srna = RNA_def_struct(brna, "BlendDataMovieClips", NULL);
2089 RNA_def_struct_sdna(srna, "Main");
2090 RNA_def_struct_ui_text(srna, "Main Movie Clips", "Collection of movie clips");
2092 func = RNA_def_function(srna, "tag", "rna_Main_movieclips_tag");
2093 parm = RNA_def_boolean(func, "value", 0, "Value", "");
2094 RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
2096 func = RNA_def_function(srna, "remove", "rna_Main_ID_remove");
2097 RNA_def_function_flag(func, FUNC_USE_REPORTS);
2098 RNA_def_function_ui_description(func, "Remove a movie clip from the current blendfile.");
2099 parm = RNA_def_pointer(func, "clip", "MovieClip", "", "Movie clip to remove");
2100 RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
2101 RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
2103 func, "do_unlink", true, "", "Unlink all usages of this movie clip before deleting it");
2104 RNA_def_boolean(func,
2108 "Decrement user counter of all datablocks used by this movie clip");
2110 func, "do_ui_user", true, "", "Make sure interface does not reference this movie clip");
2113 func = RNA_def_function(srna, "load", "rna_Main_movieclip_load");
2114 RNA_def_function_flag(func, FUNC_USE_REPORTS);
2115 RNA_def_function_ui_description(
2117 "Add a new movie clip to the main database from a file "
2118 "(while ``check_existing`` is disabled for consistency with other load functions, "
2119 "behavior with multiple movie-clips using the same file may incorrectly generate proxies)");
2120 parm = RNA_def_string_file_path(
2121 func, "filepath", "Path", FILE_MAX, "", "path for the data-block");
2122 RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
2123 RNA_def_boolean(func,
2127 "Using existing data-block if this file is already loaded");
2129 parm = RNA_def_pointer(func, "clip", "MovieClip", "", "New movie clip data-block");
2130 RNA_def_function_return(func, parm);
2133 void RNA_def_main_masks(BlenderRNA *brna, PropertyRNA *cprop)
2139 RNA_def_property_srna(cprop, "BlendDataMasks");
2140 srna = RNA_def_struct(brna, "BlendDataMasks", NULL);
2141 RNA_def_struct_sdna(srna, "Main");
2142 RNA_def_struct_ui_text(srna, "Main Masks", "Collection of masks");
2144 func = RNA_def_function(srna, "tag", "rna_Main_masks_tag");
2145 parm = RNA_def_boolean(func, "value", 0, "Value", "");
2146 RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
2149 func = RNA_def_function(srna, "new", "rna_Main_mask_new");
2150 RNA_def_function_ui_description(func, "Add a new mask with a given name to the main database");
2151 parm = RNA_def_string(
2152 func, "name", NULL, MAX_ID_NAME - 2, "Mask", "Name of new mask data-block");
2153 RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
2155 parm = RNA_def_pointer(func, "mask", "Mask", "", "New mask data-block");
2156 RNA_def_function_return(func, parm);
2159 func = RNA_def_function(srna, "remove", "rna_Main_ID_remove");
2160 RNA_def_function_flag(func, FUNC_USE_REPORTS);
2161 RNA_def_function_ui_description(func, "Remove a masks from the current blendfile.");
2162 parm = RNA_def_pointer(func, "mask", "Mask", "", "Mask to remove");
2163 RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
2164 RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
2166 func, "do_unlink", true, "", "Unlink all usages of this mask before deleting it");
2168 func, "do_id_user", true, "", "Decrement user counter of all datablocks used by this mask");
2170 func, "do_ui_user", true, "", "Make sure interface does not reference this mask");
2173 void RNA_def_main_linestyles(BlenderRNA *brna, PropertyRNA *cprop)
2179 RNA_def_property_srna(cprop, "BlendDataLineStyles");
2180 srna = RNA_def_struct(brna, "BlendDataLineStyles", NULL);
2181 RNA_def_struct_sdna(srna, "Main");
2182 RNA_def_struct_ui_text(srna, "Main Line Styles", "Collection of line styles");
2184 func = RNA_def_function(srna, "tag", "rna_Main_linestyle_tag");
2185 parm = RNA_def_boolean(func, "value", 0, "Value", "");
2186 RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
2188 func = RNA_def_function(srna, "new", "rna_Main_linestyles_new");
2189 RNA_def_function_ui_description(func, "Add a new line style instance to the main database");
2190 parm = RNA_def_string(func, "name", "FreestyleLineStyle", 0, "", "New name for the data-block");
2191 RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
2193 parm = RNA_def_pointer(func, "linestyle", "FreestyleLineStyle", "", "New line style data-block");
2194 RNA_def_function_return(func, parm);
2196 func = RNA_def_function(srna, "remove", "rna_Main_ID_remove");
2197 RNA_def_function_flag(func, FUNC_USE_REPORTS);
2198 RNA_def_function_ui_description(func, "Remove a line style instance from the current blendfile");
2199 parm = RNA_def_pointer(func, "linestyle", "FreestyleLineStyle", "", "Line style to remove");
2200 RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
2201 RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
2203 func, "do_unlink", true, "", "Unlink all usages of this line style before deleting it");
2204 RNA_def_boolean(func,
2208 "Decrement user counter of all datablocks used by this line style");
2210 func, "do_ui_user", true, "", "Make sure interface does not reference this line style");
2213 void RNA_def_main_workspaces(BlenderRNA *brna, PropertyRNA *cprop)
2219 RNA_def_property_srna(cprop, "BlendDataWorkSpaces");
2220 srna = RNA_def_struct(brna, "BlendDataWorkSpaces", NULL);
2221 RNA_def_struct_sdna(srna, "Main");
2222 RNA_def_struct_ui_text(srna, "Main Workspaces", "Collection of workspaces");
2224 func = RNA_def_function(srna, "tag", "rna_Main_workspaces_tag");
2225 parm = RNA_def_boolean(func, "value", 0, "Value", "");
2226 RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
2229 void RNA_def_main_lightprobes(BlenderRNA *brna, PropertyRNA *cprop)
2235 RNA_def_property_srna(cprop, "BlendDataProbes");
2236 srna = RNA_def_struct(brna, "BlendDataProbes", NULL);
2237 RNA_def_struct_sdna(srna, "Main");
2238 RNA_def_struct_ui_text(srna, "Main Light Probes", "Collection of light probes");
2240 func = RNA_def_function(srna, "new", "rna_Main_lightprobe_new");
2241 RNA_def_function_ui_description(func, "Add a new probe to the main database");
2242 parm = RNA_def_string(func, "name", "Probe", 0, "", "New name for the data-block");
2243 RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
2244 parm = RNA_def_enum(
2245 func, "type", rna_enum_lightprobes_type_items, 0, "Type", "The type of lightprobe to add");
2246 RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
2248 parm = RNA_def_pointer(func, "lightprobe", "LightProbe", "", "New light probe data-block");
2249 RNA_def_function_return(func, parm);
2251 func = RNA_def_function(srna, "remove", "rna_Main_ID_remove");
2252 RNA_def_function_flag(func, FUNC_USE_REPORTS);
2253 RNA_def_function_ui_description(func, "Remove a probe from the current blendfile");
2254 parm = RNA_def_pointer(func, "lightprobe", "LightProbe", "", "Probe to remove");
2255 RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
2256 RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
2257 RNA_def_boolean(func,
2261 "Unlink all usages of this probe before deleting it "
2262 "(WARNING: will also delete objects instancing that light probe data)");
2263 RNA_def_boolean(func,
2267 "Decrement user counter of all datablocks used by this light probe");
2269 func, "do_ui_user", true, "", "Make sure interface does not reference this light probe");
2271 func = RNA_def_function(srna, "tag", "rna_Main_lightprobes_tag");
2272 parm = RNA_def_boolean(func, "value", 0, "Value", "");
2273 RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
2276 # ifdef WITH_HAIR_NODES
2277 void RNA_def_main_hairs(BlenderRNA *brna, PropertyRNA *cprop)
2283 RNA_def_property_srna(cprop, "BlendDataHairs");
2284 srna = RNA_def_struct(brna, "BlendDataHairs", NULL);
2285 RNA_def_struct_sdna(srna, "Main");
2286 RNA_def_struct_ui_text(srna, "Main Hairs", "Collection of hairs");
2288 func = RNA_def_function(srna, "new", "rna_Main_hairs_new");
2289 RNA_def_function_ui_description(func, "Add a new hair to the main database");
2290 parm = RNA_def_string(func, "name", "Hair", 0, "", "New name for the data-block");
2291 RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
2293 parm = RNA_def_pointer(func, "hair", "Hair", "", "New hair data-block");
2294 RNA_def_function_return(func, parm);
2296 func = RNA_def_function(srna, "remove", "rna_Main_ID_remove");
2297 RNA_def_function_flag(func, FUNC_USE_REPORTS);
2298 RNA_def_function_ui_description(func, "Remove a hair from the current blendfile");
2299 parm = RNA_def_pointer(func, "hair", "Hair", "", "Hair to remove");
2300 RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
2301 RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
2302 RNA_def_boolean(func,
2306 "Unlink all usages of this hair before deleting it "
2307 "(WARNING: will also delete objects instancing that hair data)");
2308 RNA_def_boolean(func,
2312 "Decrement user counter of all datablocks used by this hair data");
2314 func, "do_ui_user", true, "", "Make sure interface does not reference this hair data");
2316 func = RNA_def_function(srna, "tag", "rna_Main_hairs_tag");
2317 parm = RNA_def_boolean(func, "value", 0, "Value", "");
2318 RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
2322 # ifdef WITH_POINT_CLOUD
2323 void RNA_def_main_pointclouds(BlenderRNA *brna, PropertyRNA *cprop)
2329 RNA_def_property_srna(cprop, "BlendDataPointClouds");
2330 srna = RNA_def_struct(brna, "BlendDataPointClouds", NULL);
2331 RNA_def_struct_sdna(srna, "Main");
2332 RNA_def_struct_ui_text(srna, "Main Point Clouds", "Collection of point clouds");
2334 func = RNA_def_function(srna, "new", "rna_Main_pointclouds_new");
2335 RNA_def_function_ui_description(func, "Add a new point cloud to the main database");
2336 parm = RNA_def_string(func, "name", "PointCloud", 0, "", "New name for the data-block");
2337 RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
2339 parm = RNA_def_pointer(func, "pointcloud", "PointCloud", "", "New point cloud data-block");
2340 RNA_def_function_return(func, parm);
2342 func = RNA_def_function(srna, "remove", "rna_Main_ID_remove");
2343 RNA_def_function_flag(func, FUNC_USE_REPORTS);
2344 RNA_def_function_ui_description(func, "Remove a point cloud from the current blendfile");
2345 parm = RNA_def_pointer(func, "pointcloud", "PointCloud", "", "Point cloud to remove");
2346 RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
2347 RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
2348 RNA_def_boolean(func,
2352 "Unlink all usages of this point cloud before deleting it "
2353 "(WARNING: will also delete objects instancing that point cloud data)");
2354 RNA_def_boolean(func,
2358 "Decrement user counter of all datablocks used by this point cloud data");
2359 RNA_def_boolean(func,
2363 "Make sure interface does not reference this point cloud data");
2365 func = RNA_def_function(srna, "tag", "rna_Main_pointclouds_tag");
2366 parm = RNA_def_boolean(func, "value", 0, "Value", "");
2367 RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
2371 void RNA_def_main_volumes(BlenderRNA *brna, PropertyRNA *cprop)
2377 RNA_def_property_srna(cprop, "BlendDataVolumes");
2378 srna = RNA_def_struct(brna, "BlendDataVolumes", NULL);
2379 RNA_def_struct_sdna(srna, "Main");
2380 RNA_def_struct_ui_text(srna, "Main Volumes", "Collection of volumes");
2382 func = RNA_def_function(srna, "new", "rna_Main_volumes_new");
2383 RNA_def_function_ui_description(func, "Add a new volume to the main database");
2384 parm = RNA_def_string(func, "name", "Volume", 0, "", "New name for the data-block");
2385 RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
2387 parm = RNA_def_pointer(func, "volume", "Volume", "", "New volume data-block");
2388 RNA_def_function_return(func, parm);
2390 func = RNA_def_function(srna, "remove", "rna_Main_ID_remove");
2391 RNA_def_function_flag(func, FUNC_USE_REPORTS);
2392 RNA_def_function_ui_description(func, "Remove a volume from the current blendfile");
2393 parm = RNA_def_pointer(func, "volume", "Volume", "", "Volume to remove");
2394 RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
2395 RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
2396 RNA_def_boolean(func,
2400 "Unlink all usages of this volume before deleting it "
2401 "(WARNING: will also delete objects instancing that volume data)");
2402 RNA_def_boolean(func,
2406 "Decrement user counter of all datablocks used by this volume data");
2408 func, "do_ui_user", true, "", "Make sure interface does not reference this volume data");
2410 func = RNA_def_function(srna, "tag", "rna_Main_volumes_tag");
2411 parm = RNA_def_boolean(func, "value", 0, "Value", "");
2412 RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
2415 # ifdef WITH_GEOMETRY_NODES
2416 void RNA_def_main_simulations(BlenderRNA *brna, PropertyRNA *cprop)
2422 RNA_def_property_srna(cprop, "BlendDataSimulations");
2423 srna = RNA_def_struct(brna, "BlendDataSimulations", NULL);
2424 RNA_def_struct_sdna(srna, "Main");
2425 RNA_def_struct_ui_text(srna, "Main Simulations", "Collection of simulations");
2427 func = RNA_def_function(srna, "new", "rna_Main_simulations_new");
2428 RNA_def_function_ui_description(func, "Add a new simulation to the main database");
2429 parm = RNA_def_string(func, "name", "Simulation", 0, "", "New name for the data-block");
2430 RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
2432 parm = RNA_def_pointer(func, "simulation", "Simulation", "", "New simulation data-block");
2433 RNA_def_function_return(func, parm);
2435 func = RNA_def_function(srna, "remove", "rna_Main_ID_remove");
2436 RNA_def_function_flag(func, FUNC_USE_REPORTS);
2437 RNA_def_function_ui_description(func, "Remove a simulation from the current blendfile");
2438 parm = RNA_def_pointer(func, "simulation", "Simulation", "", "Simulation to remove");
2439 RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
2440 RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
2442 func, "do_unlink", true, "", "Unlink all usages of this simulation before deleting it");
2443 RNA_def_boolean(func,
2447 "Decrement user counter of all datablocks used by this simulation data");
2449 func, "do_ui_user", true, "", "Make sure interface does not reference this simulation data");
2451 func = RNA_def_function(srna, "tag", "rna_Main_simulations_tag");
2452 parm = RNA_def_boolean(func, "value", 0, "Value", "");
2453 RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);