2 * ***** BEGIN GPL LICENSE BLOCK *****
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software Foundation,
16 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 * The Original Code is Copyright (C) 2009 Blender Foundation.
19 * All rights reserved.
22 * Contributor(s): Blender Foundation
24 * ***** END GPL LICENSE BLOCK *****
27 /** \file blender/makesrna/intern/rna_main_api.c
37 #include "DNA_modifier_types.h"
38 #include "DNA_space_types.h"
39 #include "DNA_object_types.h"
41 #include "BLI_utildefines.h"
42 #include "BLI_path_util.h"
44 #include "RNA_define.h"
45 #include "RNA_access.h"
46 #include "RNA_enum_types.h"
48 #include "rna_internal.h"
53 #include "BKE_camera.h"
54 #include "BKE_curve.h"
55 #include "BKE_DerivedMesh.h"
56 #include "BKE_displist.h"
58 #include "BKE_armature.h"
60 #include "BKE_library.h"
61 #include "BKE_object.h"
62 #include "BKE_material.h"
63 #include "BKE_icons.h"
64 #include "BKE_image.h"
65 #include "BKE_texture.h"
66 #include "BKE_scene.h"
67 #include "BKE_sound.h"
69 #include "BKE_action.h"
70 #include "BKE_group.h"
71 #include "BKE_brush.h"
72 #include "BKE_lattice.h"
73 #include "BKE_mball.h"
74 #include "BKE_world.h"
75 #include "BKE_particle.h"
76 #include "BKE_paint.h"
79 #include "BKE_depsgraph.h"
80 #include "BKE_speaker.h"
81 #include "BKE_movieclip.h"
83 #include "BKE_gpencil.h"
84 #include "BKE_linestyle.h"
86 #include "DNA_armature_types.h"
87 #include "DNA_camera_types.h"
88 #include "DNA_curve_types.h"
89 #include "DNA_lamp_types.h"
90 #include "DNA_material_types.h"
91 #include "DNA_mesh_types.h"
92 #include "DNA_speaker_types.h"
93 #include "DNA_sound_types.h"
94 #include "DNA_text_types.h"
95 #include "DNA_texture_types.h"
96 #include "DNA_group_types.h"
97 #include "DNA_brush_types.h"
98 #include "DNA_lattice_types.h"
99 #include "DNA_meta_types.h"
100 #include "DNA_world_types.h"
101 #include "DNA_particle_types.h"
102 #include "DNA_vfont_types.h"
103 #include "DNA_node_types.h"
104 #include "DNA_movieclip_types.h"
105 #include "DNA_mask_types.h"
106 #include "DNA_gpencil_types.h"
108 #include "ED_screen.h"
110 #include "BLT_translation.h"
113 # include "BPY_extern.h"
116 static Camera *rna_Main_cameras_new(Main *bmain, const char *name)
118 ID *id = BKE_camera_add(bmain, name);
122 static void rna_Main_cameras_remove(Main *bmain, ReportList *reports, PointerRNA *camera_ptr)
124 Camera *camera = camera_ptr->data;
125 if (ID_REAL_USERS(camera) <= 0) {
126 BKE_libblock_free(bmain, camera);
127 RNA_POINTER_INVALIDATE(camera_ptr);
130 BKE_reportf(reports, RPT_ERROR, "Camera '%s' must have zero users to be removed, found %d",
131 camera->id.name + 2, ID_REAL_USERS(camera));
135 static Scene *rna_Main_scenes_new(Main *bmain, const char *name)
137 return BKE_scene_add(bmain, name);
139 static void rna_Main_scenes_remove(Main *bmain, bContext *C, ReportList *reports, PointerRNA *scene_ptr)
141 /* don't call BKE_libblock_free(...) directly */
142 Scene *scene = scene_ptr->data;
145 if ((scene_new = scene->id.prev) ||
146 (scene_new = scene->id.next))
148 bScreen *sc = CTX_wm_screen(C);
149 if (sc->scene == scene) {
152 BPy_BEGIN_ALLOW_THREADS;
155 ED_screen_set_scene(C, sc, scene_new);
158 BPy_END_ALLOW_THREADS;
163 BKE_scene_unlink(bmain, scene, scene_new);
164 RNA_POINTER_INVALIDATE(scene_ptr);
167 BKE_reportf(reports, RPT_ERROR, "Scene '%s' is the last, cannot be removed", scene->id.name + 2);
171 static Object *rna_Main_objects_new(Main *bmain, ReportList *reports, const char *name, ID *data)
176 /* keep in sync with OB_DATA_SUPPORT_ID() macro */
177 switch (GS(data->name)) {
182 type = BKE_curve_type_get((Curve *)data);
205 if (RNA_enum_id_from_value(id_type_items, GS(data->name), &idname) == 0)
208 BKE_reportf(reports, RPT_ERROR, "ID type '%s' is not valid for an object", idname);
216 ob = BKE_object_add_only_object(bmain, type, name);
220 test_object_materials(bmain, ob->data);
225 static void rna_Main_objects_remove(Main *bmain, ReportList *reports, PointerRNA *object_ptr)
227 Object *object = object_ptr->data;
228 if (ID_REAL_USERS(object) <= 0) {
229 BKE_object_unlink(object); /* needed or ID pointers to this are not cleared */
230 BKE_libblock_free(bmain, object);
231 RNA_POINTER_INVALIDATE(object_ptr);
234 BKE_reportf(reports, RPT_ERROR, "Object '%s' must have zero users to be removed, found %d",
235 object->id.name + 2, ID_REAL_USERS(object));
239 static Material *rna_Main_materials_new(Main *bmain, const char *name)
241 ID *id = (ID *)BKE_material_add(bmain, name);
243 return (Material *)id;
245 static void rna_Main_materials_remove(Main *bmain, ReportList *reports, PointerRNA *material_ptr)
247 Material *material = material_ptr->data;
248 if (ID_REAL_USERS(material) <= 0) {
249 BKE_libblock_free(bmain, material);
250 RNA_POINTER_INVALIDATE(material_ptr);
253 BKE_reportf(reports, RPT_ERROR, "Material '%s' must have zero users to be removed, found %d",
254 material->id.name + 2, ID_REAL_USERS(material));
258 static EnumPropertyItem *rna_Main_nodetree_type_itemf(bContext *UNUSED(C), PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), bool *r_free)
260 return rna_node_tree_type_itemf(NULL, NULL, r_free);
262 static struct bNodeTree *rna_Main_nodetree_new(Main *bmain, const char *name, int type)
264 bNodeTreeType *typeinfo = rna_node_tree_type_from_enum(type);
266 bNodeTree *ntree = ntreeAddTree(bmain, name, typeinfo->idname);
268 id_us_min(&ntree->id);
274 static void rna_Main_nodetree_remove(Main *bmain, ReportList *reports, PointerRNA *ntree_ptr)
276 bNodeTree *ntree = ntree_ptr->data;
277 if (ID_REAL_USERS(ntree) <= 0) {
278 BKE_libblock_free(bmain, ntree);
279 RNA_POINTER_INVALIDATE(ntree_ptr);
282 BKE_reportf(reports, RPT_ERROR, "Node tree '%s' must have zero users to be removed, found %d",
283 ntree->id.name + 2, ID_REAL_USERS(ntree));
287 static Mesh *rna_Main_meshes_new(Main *bmain, const char *name)
289 Mesh *me = BKE_mesh_add(bmain, name);
294 /* copied from Mesh_getFromObject and adapted to RNA interface */
295 /* settings: 1 - preview, 2 - render */
296 Mesh *rna_Main_meshes_new_from_object(
297 Main *bmain, ReportList *reports, Scene *sce,
298 Object *ob, int apply_modifiers, int settings, int calc_tessface, int calc_undeformed)
308 BKE_report(reports, RPT_ERROR, "Object does not have geometry data");
312 return BKE_mesh_new_from_object(bmain, sce, ob, apply_modifiers, settings, calc_tessface, calc_undeformed);
315 static void rna_Main_meshes_remove(Main *bmain, ReportList *reports, PointerRNA *mesh_ptr)
317 Mesh *mesh = mesh_ptr->data;
318 if (ID_REAL_USERS(mesh) <= 0) {
319 BKE_libblock_free(bmain, mesh);
320 RNA_POINTER_INVALIDATE(mesh_ptr);
323 BKE_reportf(reports, RPT_ERROR, "Mesh '%s' must have zero users to be removed, found %d",
324 mesh->id.name + 2, ID_REAL_USERS(mesh));
328 static Lamp *rna_Main_lamps_new(Main *bmain, const char *name, int type)
330 Lamp *lamp = BKE_lamp_add(bmain, name);
332 id_us_min(&lamp->id);
335 static void rna_Main_lamps_remove(Main *bmain, ReportList *reports, PointerRNA *lamp_ptr)
337 Lamp *lamp = lamp_ptr->data;
338 if (ID_REAL_USERS(lamp) <= 0) {
339 BKE_libblock_free(bmain, lamp);
340 RNA_POINTER_INVALIDATE(lamp_ptr);
343 BKE_reportf(reports, RPT_ERROR, "Lamp '%s' must have zero users to be removed, found %d",
344 lamp->id.name + 2, ID_REAL_USERS(lamp));
348 static Image *rna_Main_images_new(Main *bmain, const char *name, int width, int height, int alpha, int float_buffer, int stereo3d)
350 float color[4] = {0.0, 0.0, 0.0, 1.0};
351 Image *image = BKE_image_add_generated(bmain, width, height, name, alpha ? 32 : 24, float_buffer, 0, color, stereo3d);
352 id_us_min(&image->id);
355 static Image *rna_Main_images_load(Main *bmain, ReportList *reports, const char *filepath, int check_existing)
360 if (check_existing) {
361 ima = BKE_image_load_exists(filepath);
364 ima = BKE_image_load(bmain, filepath);
368 BKE_reportf(reports, RPT_ERROR, "Cannot read '%s': %s", filepath,
369 errno ? strerror(errno) : TIP_("unsupported image format"));
374 static void rna_Main_images_remove(Main *bmain, ReportList *reports, PointerRNA *image_ptr)
376 Image *image = image_ptr->data;
377 if (ID_REAL_USERS(image) <= 0) {
378 BKE_libblock_free(bmain, image);
379 RNA_POINTER_INVALIDATE(image_ptr);
382 BKE_reportf(reports, RPT_ERROR, "Image '%s' must have zero users to be removed, found %d",
383 image->id.name + 2, ID_REAL_USERS(image));
387 static Lattice *rna_Main_lattices_new(Main *bmain, const char *name)
389 Lattice *lt = BKE_lattice_add(bmain, name);
393 static void rna_Main_lattices_remove(Main *bmain, ReportList *reports, PointerRNA *lt_ptr)
395 Lattice *lt = lt_ptr->data;
396 if (ID_REAL_USERS(lt) <= 0) {
397 BKE_libblock_free(bmain, lt);
398 RNA_POINTER_INVALIDATE(lt_ptr);
401 BKE_reportf(reports, RPT_ERROR, "Lattice '%s' must have zero users to be removed, found %d",
402 lt->id.name + 2, ID_REAL_USERS(lt));
406 static Curve *rna_Main_curves_new(Main *bmain, const char *name, int type)
408 Curve *cu = BKE_curve_add(bmain, name, type);
412 static void rna_Main_curves_remove(Main *bmain, ReportList *reports, PointerRNA *cu_ptr)
414 Curve *cu = cu_ptr->data;
415 if (ID_REAL_USERS(cu) <= 0) {
416 BKE_libblock_free(bmain, cu);
417 RNA_POINTER_INVALIDATE(cu_ptr);
420 BKE_reportf(reports, RPT_ERROR, "Curve '%s' must have zero users to be removed, found %d",
421 cu->id.name + 2, ID_REAL_USERS(cu));
425 static MetaBall *rna_Main_metaballs_new(Main *bmain, const char *name)
427 MetaBall *mb = BKE_mball_add(bmain, name);
431 static void rna_Main_metaballs_remove(Main *bmain, ReportList *reports, PointerRNA *mb_ptr)
433 MetaBall *mb = mb_ptr->data;
434 if (ID_REAL_USERS(mb) <= 0) {
435 BKE_libblock_free(bmain, mb);
436 RNA_POINTER_INVALIDATE(mb_ptr);
439 BKE_reportf(reports, RPT_ERROR, "Metaball '%s' must have zero users to be removed, found %d",
440 mb->id.name + 2, ID_REAL_USERS(mb));
444 static VFont *rna_Main_fonts_load(Main *bmain, ReportList *reports, const char *filepath)
449 font = BKE_vfont_load(bmain, filepath);
452 BKE_reportf(reports, RPT_ERROR, "Cannot read '%s': %s", filepath,
453 errno ? strerror(errno) : TIP_("unsupported font format"));
458 static void rna_Main_fonts_remove(Main *bmain, ReportList *reports, PointerRNA *vfont_ptr)
460 VFont *vfont = vfont_ptr->data;
461 if (ID_REAL_USERS(vfont) <= 0) {
462 BKE_libblock_free(bmain, vfont);
463 RNA_POINTER_INVALIDATE(vfont_ptr);
466 BKE_reportf(reports, RPT_ERROR, "Font '%s' must have zero users to be removed, found %d",
467 vfont->id.name + 2, ID_REAL_USERS(vfont));
471 static Tex *rna_Main_textures_new(Main *bmain, const char *name, int type)
473 Tex *tex = BKE_texture_add(bmain, name);
474 BKE_texture_type_set(tex, type);
478 static void rna_Main_textures_remove(Main *bmain, ReportList *reports, PointerRNA *tex_ptr)
480 Tex *tex = tex_ptr->data;
481 if (ID_REAL_USERS(tex) <= 0) {
482 BKE_libblock_free(bmain, tex);
483 RNA_POINTER_INVALIDATE(tex_ptr);
486 BKE_reportf(reports, RPT_ERROR, "Texture '%s' must have zero users to be removed, found %d",
487 tex->id.name + 2, ID_REAL_USERS(tex));
491 static Brush *rna_Main_brushes_new(Main *bmain, const char *name, int mode)
493 Brush *brush = BKE_brush_add(bmain, name, mode);
494 id_us_min(&brush->id);
498 static void rna_Main_brushes_remove(Main *bmain, ReportList *reports, PointerRNA *brush_ptr)
500 Brush *brush = brush_ptr->data;
501 if (ID_REAL_USERS(brush) <= 0) {
502 BKE_libblock_free(bmain, brush);
503 RNA_POINTER_INVALIDATE(brush_ptr);
506 BKE_reportf(reports, RPT_ERROR, "Brush '%s' must have zero users to be removed, found %d",
507 brush->id.name + 2, ID_REAL_USERS(brush));
511 static World *rna_Main_worlds_new(Main *bmain, const char *name)
513 World *world = add_world(bmain, name);
514 id_us_min(&world->id);
517 static void rna_Main_worlds_remove(Main *bmain, ReportList *reports, PointerRNA *world_ptr)
519 Group *world = world_ptr->data;
520 if (ID_REAL_USERS(world) <= 0) {
521 BKE_libblock_free(bmain, world);
522 RNA_POINTER_INVALIDATE(world_ptr);
525 BKE_reportf(reports, RPT_ERROR, "World '%s' must have zero users to be removed, found %d",
526 world->id.name + 2, ID_REAL_USERS(world));
530 static Group *rna_Main_groups_new(Main *bmain, const char *name)
532 return BKE_group_add(bmain, name);
534 static void rna_Main_groups_remove(Main *bmain, PointerRNA *group_ptr)
536 Group *group = group_ptr->data;
537 BKE_group_unlink(group);
538 BKE_libblock_free(bmain, group);
539 RNA_POINTER_INVALIDATE(group_ptr);
542 static Speaker *rna_Main_speakers_new(Main *bmain, const char *name)
544 Speaker *speaker = BKE_speaker_add(bmain, name);
545 id_us_min(&speaker->id);
548 static void rna_Main_speakers_remove(Main *bmain, ReportList *reports, PointerRNA *speaker_ptr)
550 Speaker *speaker = speaker_ptr->data;
551 if (ID_REAL_USERS(speaker) <= 0) {
552 BKE_libblock_free(bmain, speaker);
553 RNA_POINTER_INVALIDATE(speaker_ptr);
556 BKE_reportf(reports, RPT_ERROR, "Speaker '%s' must have zero users to be removed, found %d",
557 speaker->id.name + 2, ID_REAL_USERS(speaker));
561 static bSound *rna_Main_sounds_load(Main *bmain, const char *name)
563 bSound *sound = BKE_sound_new_file(bmain, name);
564 id_us_min(&sound->id);
567 static void rna_Main_sounds_remove(Main *bmain, ReportList *reports, PointerRNA *sound_ptr)
569 Speaker *sound = sound_ptr->data;
570 if (ID_REAL_USERS(sound) <= 0) {
571 BKE_libblock_free(bmain, sound);
572 RNA_POINTER_INVALIDATE(sound_ptr);
575 BKE_reportf(reports, RPT_ERROR, "Sound '%s' must have zero users to be removed, found %d",
576 sound->id.name + 2, ID_REAL_USERS(sound));
580 static Text *rna_Main_texts_new(Main *bmain, const char *name)
582 return BKE_text_add(bmain, name);
584 static void rna_Main_texts_remove(Main *bmain, PointerRNA *text_ptr)
586 Text *text = text_ptr->data;
587 BKE_text_unlink(bmain, text);
588 BKE_libblock_free(bmain, text);
589 RNA_POINTER_INVALIDATE(text_ptr);
592 static Text *rna_Main_texts_load(Main *bmain, ReportList *reports, const char *filepath, int is_internal)
597 txt = BKE_text_load_ex(bmain, filepath, bmain->name, is_internal);
600 BKE_reportf(reports, RPT_ERROR, "Cannot read '%s': %s", filepath,
601 errno ? strerror(errno) : TIP_("unable to load text"));
606 static bArmature *rna_Main_armatures_new(Main *bmain, const char *name)
608 bArmature *arm = BKE_armature_add(bmain, name);
612 static void rna_Main_armatures_remove(Main *bmain, ReportList *reports, PointerRNA *arm_ptr)
614 bArmature *arm = arm_ptr->data;
615 if (ID_REAL_USERS(arm) <= 0) {
616 BKE_libblock_free(bmain, arm);
617 RNA_POINTER_INVALIDATE(arm_ptr);
620 BKE_reportf(reports, RPT_ERROR, "Armature '%s' must have zero users to be removed, found %d",
621 arm->id.name + 2, ID_REAL_USERS(arm));
625 static bAction *rna_Main_actions_new(Main *bmain, const char *name)
627 bAction *act = add_empty_action(bmain, name);
629 act->id.flag &= ~LIB_FAKEUSER;
632 static void rna_Main_actions_remove(Main *bmain, ReportList *reports, PointerRNA *act_ptr)
634 bAction *act = act_ptr->data;
635 if (ID_REAL_USERS(act) <= 0) {
636 BKE_libblock_free(bmain, act);
637 RNA_POINTER_INVALIDATE(act_ptr);
640 BKE_reportf(reports, RPT_ERROR, "Action '%s' must have zero users to be removed, found %d",
641 act->id.name + 2, ID_REAL_USERS(act));
645 static ParticleSettings *rna_Main_particles_new(Main *bmain, const char *name)
647 ParticleSettings *part = psys_new_settings(name, bmain);
648 id_us_min(&part->id);
651 static void rna_Main_particles_remove(Main *bmain, ReportList *reports, PointerRNA *part_ptr)
653 ParticleSettings *part = part_ptr->data;
654 if (ID_REAL_USERS(part) <= 0) {
655 BKE_libblock_free(bmain, part);
656 RNA_POINTER_INVALIDATE(part_ptr);
659 BKE_reportf(reports, RPT_ERROR, "Particle settings '%s' must have zero users to be removed, found %d",
660 part->id.name + 2, ID_REAL_USERS(part));
664 static Palette *rna_Main_palettes_new(Main *bmain, const char *name)
666 Palette *palette = BKE_palette_add(bmain, name);
667 id_us_min(&palette->id);
668 return (Palette *)palette;
670 static void rna_Main_palettes_remove(Main *bmain, ReportList *reports, PointerRNA *palette_ptr)
672 Palette *palette = palette_ptr->data;
673 if (ID_REAL_USERS(palette) <= 0) {
674 BKE_libblock_free(bmain, palette);
675 RNA_POINTER_INVALIDATE(palette_ptr);
678 BKE_reportf(reports, RPT_ERROR, "Palette settings '%s' must have zero users to be removed, found %d",
679 palette->id.name + 2, ID_REAL_USERS(palette));
683 static MovieClip *rna_Main_movieclip_load(Main *bmain, ReportList *reports, const char *filepath)
688 clip = BKE_movieclip_file_add(bmain, filepath);
691 BKE_reportf(reports, RPT_ERROR, "Cannot read '%s': %s", filepath,
692 errno ? strerror(errno) : TIP_("unable to load movie clip"));
697 static void rna_Main_movieclips_remove(Main *bmain, PointerRNA *clip_ptr)
699 MovieClip *clip = clip_ptr->data;
700 BKE_movieclip_unlink(bmain, clip);
701 BKE_libblock_free(bmain, clip);
702 RNA_POINTER_INVALIDATE(clip_ptr);
705 static Mask *rna_Main_mask_new(Main *bmain, const char *name)
709 mask = BKE_mask_new(bmain, name);
714 static void rna_Main_masks_remove(Main *bmain, PointerRNA *mask_ptr)
716 Mask *mask = mask_ptr->data;
717 BKE_mask_free(bmain, mask);
718 BKE_libblock_free(bmain, mask);
719 RNA_POINTER_INVALIDATE(mask_ptr);
722 static void rna_Main_grease_pencil_remove(Main *bmain, ReportList *reports, PointerRNA *gpd_ptr)
724 bGPdata *gpd = gpd_ptr->data;
725 if (ID_REAL_USERS(gpd) <= 0) {
726 BKE_gpencil_free(gpd);
727 BKE_libblock_free(bmain, gpd);
728 RNA_POINTER_INVALIDATE(gpd_ptr);
731 BKE_reportf(reports, RPT_ERROR, "Grease pencil '%s' must have zero users to be removed, found %d",
732 gpd->id.name + 2, ID_REAL_USERS(gpd));
735 static FreestyleLineStyle *rna_Main_linestyles_new(Main *bmain, const char *name)
737 FreestyleLineStyle *linestyle = BKE_linestyle_new(bmain, name);
738 id_us_min(&linestyle->id);
742 static void rna_Main_linestyles_remove(Main *bmain, ReportList *reports, FreestyleLineStyle *linestyle)
744 if (ID_REAL_USERS(linestyle) <= 0)
745 BKE_libblock_free(bmain, linestyle);
747 BKE_reportf(reports, RPT_ERROR, "Line style '%s' must have zero users to be removed, found %d",
748 linestyle->id.name + 2, ID_REAL_USERS(linestyle));
750 /* XXX python now has invalid pointer? */
753 /* tag functions, all the same */
754 static void rna_Main_cameras_tag(Main *bmain, int value) { BKE_main_id_tag_listbase(&bmain->camera, value); }
755 static void rna_Main_scenes_tag(Main *bmain, int value) { BKE_main_id_tag_listbase(&bmain->scene, value); }
756 static void rna_Main_objects_tag(Main *bmain, int value) { BKE_main_id_tag_listbase(&bmain->object, value); }
757 static void rna_Main_materials_tag(Main *bmain, int value) { BKE_main_id_tag_listbase(&bmain->mat, value); }
758 static void rna_Main_node_groups_tag(Main *bmain, int value) { BKE_main_id_tag_listbase(&bmain->nodetree, value); }
759 static void rna_Main_meshes_tag(Main *bmain, int value) { BKE_main_id_tag_listbase(&bmain->mesh, value); }
760 static void rna_Main_lamps_tag(Main *bmain, int value) { BKE_main_id_tag_listbase(&bmain->lamp, value); }
761 static void rna_Main_libraries_tag(Main *bmain, int value) { BKE_main_id_tag_listbase(&bmain->library, value); }
762 static void rna_Main_screens_tag(Main *bmain, int value) { BKE_main_id_tag_listbase(&bmain->screen, value); }
763 static void rna_Main_window_managers_tag(Main *bmain, int value) { BKE_main_id_tag_listbase(&bmain->wm, value); }
764 static void rna_Main_images_tag(Main *bmain, int value) { BKE_main_id_tag_listbase(&bmain->image, value); }
765 static void rna_Main_lattices_tag(Main *bmain, int value) { BKE_main_id_tag_listbase(&bmain->latt, value); }
766 static void rna_Main_curves_tag(Main *bmain, int value) { BKE_main_id_tag_listbase(&bmain->curve, value); }
767 static void rna_Main_metaballs_tag(Main *bmain, int value) { BKE_main_id_tag_listbase(&bmain->mball, value); }
768 static void rna_Main_fonts_tag(Main *bmain, int value) { BKE_main_id_tag_listbase(&bmain->vfont, value); }
769 static void rna_Main_textures_tag(Main *bmain, int value) { BKE_main_id_tag_listbase(&bmain->tex, value); }
770 static void rna_Main_brushes_tag(Main *bmain, int value) { BKE_main_id_tag_listbase(&bmain->brush, value); }
771 static void rna_Main_worlds_tag(Main *bmain, int value) { BKE_main_id_tag_listbase(&bmain->world, value); }
772 static void rna_Main_groups_tag(Main *bmain, int value) { BKE_main_id_tag_listbase(&bmain->group, value); }
773 // static void rna_Main_shape_keys_tag(Main *bmain, int value) { BKE_main_id_tag_listbase(&bmain->key, value); }
774 // static void rna_Main_scripts_tag(Main *bmain, int value) { BKE_main_id_tag_listbase(&bmain->script, value); }
775 static void rna_Main_texts_tag(Main *bmain, int value) { BKE_main_id_tag_listbase(&bmain->text, value); }
776 static void rna_Main_speakers_tag(Main *bmain, int value) { BKE_main_id_tag_listbase(&bmain->speaker, value); }
777 static void rna_Main_sounds_tag(Main *bmain, int value) { BKE_main_id_tag_listbase(&bmain->sound, value); }
778 static void rna_Main_armatures_tag(Main *bmain, int value) { BKE_main_id_tag_listbase(&bmain->armature, value); }
779 static void rna_Main_actions_tag(Main *bmain, int value) { BKE_main_id_tag_listbase(&bmain->action, value); }
780 static void rna_Main_particles_tag(Main *bmain, int value) { BKE_main_id_tag_listbase(&bmain->particle, value); }
781 static void rna_Main_palettes_tag(Main *bmain, int value) { BKE_main_id_tag_listbase(&bmain->palettes, value); }
782 static void rna_Main_gpencil_tag(Main *bmain, int value) { BKE_main_id_tag_listbase(&bmain->gpencil, value); }
783 static void rna_Main_movieclips_tag(Main *bmain, int value) { BKE_main_id_tag_listbase(&bmain->movieclip, value); }
784 static void rna_Main_masks_tag(Main *bmain, int value) { BKE_main_id_tag_listbase(&bmain->mask, value); }
785 static void rna_Main_linestyle_tag(Main *bmain, int value) { BKE_main_id_tag_listbase(&bmain->linestyle, value); }
787 static int rna_Main_cameras_is_updated_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_CA) != 0; }
788 static int rna_Main_scenes_is_updated_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_SCE) != 0; }
789 static int rna_Main_objects_is_updated_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_OB) != 0; }
790 static int rna_Main_materials_is_updated_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_MA) != 0; }
791 static int rna_Main_node_groups_is_updated_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_NT) != 0; }
792 static int rna_Main_meshes_is_updated_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_ME) != 0; }
793 static int rna_Main_lamps_is_updated_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_LA) != 0; }
794 static int rna_Main_libraries_is_updated_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_LI) != 0; }
795 static int rna_Main_screens_is_updated_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_SCR) != 0; }
796 static int rna_Main_window_managers_is_updated_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_WM) != 0; }
797 static int rna_Main_images_is_updated_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_IM) != 0; }
798 static int rna_Main_lattices_is_updated_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_LT) != 0; }
799 static int rna_Main_curves_is_updated_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_CU) != 0; }
800 static int rna_Main_metaballs_is_updated_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_MB) != 0; }
801 static int rna_Main_fonts_is_updated_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_VF) != 0; }
802 static int rna_Main_textures_is_updated_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_TE) != 0; }
803 static int rna_Main_brushes_is_updated_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_BR) != 0; }
804 static int rna_Main_worlds_is_updated_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_WO) != 0; }
805 static int rna_Main_groups_is_updated_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_GR) != 0; }
806 static int rna_Main_texts_is_updated_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_TXT) != 0; }
807 static int rna_Main_speakers_is_updated_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_SPK) != 0; }
808 static int rna_Main_sounds_is_updated_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_SO) != 0; }
809 static int rna_Main_armatures_is_updated_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_AR) != 0; }
810 static int rna_Main_actions_is_updated_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_AC) != 0; }
811 static int rna_Main_particles_is_updated_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_PA) != 0; }
812 static int rna_Main_palettes_is_updated_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_PAL) != 0; }
813 static int rna_Main_gpencil_is_updated_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_GD) != 0; }
814 static int rna_Main_linestyle_is_updated_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_LS) != 0; }
818 void RNA_api_main(StructRNA *UNUSED(srna))
824 /* maybe we want to add functions in 'bpy.data' still?
825 * for now they are all in collections bpy.data.images.new(...) */
826 func = RNA_def_function(srna, "add_image", "rna_Main_add_image");
827 RNA_def_function_ui_description(func, "Add a new image");
828 parm = RNA_def_string_file_path(func, "filepath", NULL, 0, "", "File path to load image from");
829 RNA_def_property_flag(parm, PROP_REQUIRED);
830 parm = RNA_def_pointer(func, "image", "Image", "", "New image");
831 RNA_def_function_return(func, parm);
835 void RNA_def_main_cameras(BlenderRNA *brna, PropertyRNA *cprop)
842 RNA_def_property_srna(cprop, "BlendDataCameras");
843 srna = RNA_def_struct(brna, "BlendDataCameras", NULL);
844 RNA_def_struct_sdna(srna, "Main");
845 RNA_def_struct_ui_text(srna, "Main Cameras", "Collection of cameras");
847 func = RNA_def_function(srna, "new", "rna_Main_cameras_new");
848 RNA_def_function_ui_description(func, "Add a new camera to the main database");
849 parm = RNA_def_string(func, "name", "Camera", 0, "", "New name for the datablock");
850 RNA_def_property_flag(parm, PROP_REQUIRED);
852 parm = RNA_def_pointer(func, "camera", "Camera", "", "New camera datablock");
853 RNA_def_function_return(func, parm);
855 func = RNA_def_function(srna, "remove", "rna_Main_cameras_remove");
856 RNA_def_function_flag(func, FUNC_USE_REPORTS);
857 RNA_def_function_ui_description(func, "Remove a camera from the current blendfile");
858 parm = RNA_def_pointer(func, "camera", "Camera", "", "Camera to remove");
859 RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL | PROP_RNAPTR);
860 RNA_def_property_clear_flag(parm, PROP_THICK_WRAP);
862 func = RNA_def_function(srna, "tag", "rna_Main_cameras_tag");
863 parm = RNA_def_boolean(func, "value", 0, "Value", "");
864 RNA_def_property_flag(parm, PROP_REQUIRED);
866 prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
867 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
868 RNA_def_property_boolean_funcs(prop, "rna_Main_cameras_is_updated_get", NULL);
871 void RNA_def_main_scenes(BlenderRNA *brna, PropertyRNA *cprop)
878 RNA_def_property_srna(cprop, "BlendDataScenes");
879 srna = RNA_def_struct(brna, "BlendDataScenes", NULL);
880 RNA_def_struct_sdna(srna, "Main");
881 RNA_def_struct_ui_text(srna, "Main Scenes", "Collection of scenes");
883 func = RNA_def_function(srna, "new", "rna_Main_scenes_new");
884 RNA_def_function_ui_description(func, "Add a new scene to the main database");
885 parm = RNA_def_string(func, "name", "Scene", 0, "", "New name for the datablock");
886 RNA_def_property_flag(parm, PROP_REQUIRED);
888 parm = RNA_def_pointer(func, "scene", "Scene", "", "New scene datablock");
889 RNA_def_function_return(func, parm);
891 func = RNA_def_function(srna, "remove", "rna_Main_scenes_remove");
892 RNA_def_function_flag(func, FUNC_USE_CONTEXT | FUNC_USE_REPORTS);
893 RNA_def_function_ui_description(func, "Remove a scene from the current blendfile");
894 parm = RNA_def_pointer(func, "scene", "Scene", "", "Scene to remove");
895 RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL | PROP_RNAPTR);
896 RNA_def_property_clear_flag(parm, PROP_THICK_WRAP);
898 func = RNA_def_function(srna, "tag", "rna_Main_scenes_tag");
899 parm = RNA_def_boolean(func, "value", 0, "Value", "");
900 RNA_def_property_flag(parm, PROP_REQUIRED);
902 prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
903 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
904 RNA_def_property_boolean_funcs(prop, "rna_Main_scenes_is_updated_get", NULL);
907 void RNA_def_main_objects(BlenderRNA *brna, PropertyRNA *cprop)
914 RNA_def_property_srna(cprop, "BlendDataObjects");
915 srna = RNA_def_struct(brna, "BlendDataObjects", NULL);
916 RNA_def_struct_sdna(srna, "Main");
917 RNA_def_struct_ui_text(srna, "Main Objects", "Collection of objects");
919 func = RNA_def_function(srna, "new", "rna_Main_objects_new");
920 RNA_def_function_flag(func, FUNC_USE_REPORTS);
921 RNA_def_function_ui_description(func, "Add a new object to the main database");
922 parm = RNA_def_string(func, "name", "Object", 0, "", "New name for the datablock");
923 RNA_def_property_flag(parm, PROP_REQUIRED);
924 parm = RNA_def_pointer(func, "object_data", "ID", "", "Object data or None for an empty object");
925 RNA_def_property_flag(parm, PROP_REQUIRED);
928 parm = RNA_def_pointer(func, "object", "Object", "", "New object datablock");
929 RNA_def_function_return(func, parm);
931 func = RNA_def_function(srna, "remove", "rna_Main_objects_remove");
932 RNA_def_function_ui_description(func, "Remove a object from the current blendfile");
933 RNA_def_function_flag(func, FUNC_USE_REPORTS);
934 parm = RNA_def_pointer(func, "object", "Object", "", "Object to remove");
935 RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL | PROP_RNAPTR);
936 RNA_def_property_clear_flag(parm, PROP_THICK_WRAP);
938 func = RNA_def_function(srna, "tag", "rna_Main_objects_tag");
939 parm = RNA_def_boolean(func, "value", 0, "Value", "");
940 RNA_def_property_flag(parm, PROP_REQUIRED);
942 prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
943 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
944 RNA_def_property_boolean_funcs(prop, "rna_Main_objects_is_updated_get", NULL);
947 void RNA_def_main_materials(BlenderRNA *brna, PropertyRNA *cprop)
954 RNA_def_property_srna(cprop, "BlendDataMaterials");
955 srna = RNA_def_struct(brna, "BlendDataMaterials", NULL);
956 RNA_def_struct_sdna(srna, "Main");
957 RNA_def_struct_ui_text(srna, "Main Materials", "Collection of materials");
959 func = RNA_def_function(srna, "new", "rna_Main_materials_new");
960 RNA_def_function_ui_description(func, "Add a new material to the main database");
961 parm = RNA_def_string(func, "name", "Material", 0, "", "New name for the datablock");
962 RNA_def_property_flag(parm, PROP_REQUIRED);
964 parm = RNA_def_pointer(func, "material", "Material", "", "New material datablock");
965 RNA_def_function_return(func, parm);
967 func = RNA_def_function(srna, "remove", "rna_Main_materials_remove");
968 RNA_def_function_flag(func, FUNC_USE_REPORTS);
969 RNA_def_function_ui_description(func, "Remove a material from the current blendfile");
970 parm = RNA_def_pointer(func, "material", "Material", "", "Material to remove");
971 RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL | PROP_RNAPTR);
972 RNA_def_property_clear_flag(parm, PROP_THICK_WRAP);
974 func = RNA_def_function(srna, "tag", "rna_Main_materials_tag");
975 parm = RNA_def_boolean(func, "value", 0, "Value", "");
976 RNA_def_property_flag(parm, PROP_REQUIRED);
978 prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
979 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
980 RNA_def_property_boolean_funcs(prop, "rna_Main_materials_is_updated_get", NULL);
982 void RNA_def_main_node_groups(BlenderRNA *brna, PropertyRNA *cprop)
989 static EnumPropertyItem dummy_items[] = {
990 {0, "DUMMY", 0, "", ""},
991 {0, NULL, 0, NULL, NULL}
994 RNA_def_property_srna(cprop, "BlendDataNodeTrees");
995 srna = RNA_def_struct(brna, "BlendDataNodeTrees", NULL);
996 RNA_def_struct_sdna(srna, "Main");
997 RNA_def_struct_ui_text(srna, "Main Node Trees", "Collection of node trees");
999 func = RNA_def_function(srna, "new", "rna_Main_nodetree_new");
1000 RNA_def_function_ui_description(func, "Add a new node tree to the main database");
1001 parm = RNA_def_string(func, "name", "NodeGroup", 0, "", "New name for the datablock");
1002 RNA_def_property_flag(parm, PROP_REQUIRED);
1003 parm = RNA_def_enum(func, "type", dummy_items, 0, "Type", "The type of node_group to add");
1004 RNA_def_property_enum_funcs(parm, NULL, NULL, "rna_Main_nodetree_type_itemf");
1005 RNA_def_property_flag(parm, PROP_REQUIRED);
1007 parm = RNA_def_pointer(func, "tree", "NodeTree", "", "New node tree datablock");
1008 RNA_def_function_return(func, parm);
1010 func = RNA_def_function(srna, "remove", "rna_Main_nodetree_remove");
1011 RNA_def_function_flag(func, FUNC_USE_REPORTS);
1012 RNA_def_function_ui_description(func, "Remove a node tree from the current blendfile");
1013 parm = RNA_def_pointer(func, "tree", "NodeTree", "", "Node tree to remove");
1014 RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL | PROP_RNAPTR);
1015 RNA_def_property_clear_flag(parm, PROP_THICK_WRAP);
1017 func = RNA_def_function(srna, "tag", "rna_Main_node_groups_tag");
1018 parm = RNA_def_boolean(func, "value", 0, "Value", "");
1019 RNA_def_property_flag(parm, PROP_REQUIRED);
1021 prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
1022 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
1023 RNA_def_property_boolean_funcs(prop, "rna_Main_node_groups_is_updated_get", NULL);
1025 void RNA_def_main_meshes(BlenderRNA *brna, PropertyRNA *cprop)
1032 static EnumPropertyItem mesh_type_items[] = {
1033 {eModifierMode_Realtime, "PREVIEW", 0, "Preview", "Apply modifier preview settings"},
1034 {eModifierMode_Render, "RENDER", 0, "Render", "Apply modifier render settings"},
1035 {0, NULL, 0, NULL, NULL}
1038 RNA_def_property_srna(cprop, "BlendDataMeshes");
1039 srna = RNA_def_struct(brna, "BlendDataMeshes", NULL);
1040 RNA_def_struct_sdna(srna, "Main");
1041 RNA_def_struct_ui_text(srna, "Main Meshes", "Collection of meshes");
1043 func = RNA_def_function(srna, "new", "rna_Main_meshes_new");
1044 RNA_def_function_ui_description(func, "Add a new mesh to the main database");
1045 parm = RNA_def_string(func, "name", "Mesh", 0, "", "New name for the datablock");
1046 RNA_def_property_flag(parm, PROP_REQUIRED);
1048 parm = RNA_def_pointer(func, "mesh", "Mesh", "", "New mesh datablock");
1049 RNA_def_function_return(func, parm);
1051 func = RNA_def_function(srna, "new_from_object", "rna_Main_meshes_new_from_object");
1052 RNA_def_function_ui_description(func, "Add a new mesh created from object with modifiers applied");
1053 RNA_def_function_flag(func, FUNC_USE_REPORTS);
1054 parm = RNA_def_pointer(func, "scene", "Scene", "", "Scene within which to evaluate modifiers");
1055 RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL);
1056 parm = RNA_def_pointer(func, "object", "Object", "", "Object to create mesh from");
1057 RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL);
1058 parm = RNA_def_boolean(func, "apply_modifiers", 0, "", "Apply modifiers");
1059 RNA_def_property_flag(parm, PROP_REQUIRED);
1060 parm = RNA_def_enum(func, "settings", mesh_type_items, 0, "", "Modifier settings to apply");
1061 RNA_def_property_flag(parm, PROP_REQUIRED);
1062 RNA_def_boolean(func, "calc_tessface", true, "Calculate Tessellation", "Calculate tessellation faces");
1063 RNA_def_boolean(func, "calc_undeformed", false, "Calculate Undeformed", "Calculate undeformed vertex coordinates");
1064 parm = RNA_def_pointer(func, "mesh", "Mesh", "",
1065 "Mesh created from object, remove it if it is only used for export");
1066 RNA_def_function_return(func, parm);
1068 func = RNA_def_function(srna, "remove", "rna_Main_meshes_remove");
1069 RNA_def_function_flag(func, FUNC_USE_REPORTS);
1070 RNA_def_function_ui_description(func, "Remove a mesh from the current blendfile");
1071 parm = RNA_def_pointer(func, "mesh", "Mesh", "", "Mesh to remove");
1072 RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL | PROP_RNAPTR);
1073 RNA_def_property_clear_flag(parm, PROP_THICK_WRAP);
1075 func = RNA_def_function(srna, "tag", "rna_Main_meshes_tag");
1076 parm = RNA_def_boolean(func, "value", 0, "Value", "");
1077 RNA_def_property_flag(parm, PROP_REQUIRED);
1079 prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
1080 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
1081 RNA_def_property_boolean_funcs(prop, "rna_Main_meshes_is_updated_get", NULL);
1083 void RNA_def_main_lamps(BlenderRNA *brna, PropertyRNA *cprop)
1090 RNA_def_property_srna(cprop, "BlendDataLamps");
1091 srna = RNA_def_struct(brna, "BlendDataLamps", NULL);
1092 RNA_def_struct_sdna(srna, "Main");
1093 RNA_def_struct_ui_text(srna, "Main Lamps", "Collection of lamps");
1095 func = RNA_def_function(srna, "new", "rna_Main_lamps_new");
1096 RNA_def_function_ui_description(func, "Add a new lamp to the main database");
1097 parm = RNA_def_string(func, "name", "Lamp", 0, "", "New name for the datablock");
1098 RNA_def_property_flag(parm, PROP_REQUIRED);
1099 parm = RNA_def_enum(func, "type", lamp_type_items, 0, "Type", "The type of texture to add");
1100 RNA_def_property_flag(parm, PROP_REQUIRED);
1102 parm = RNA_def_pointer(func, "lamp", "Lamp", "", "New lamp datablock");
1103 RNA_def_function_return(func, parm);
1105 func = RNA_def_function(srna, "remove", "rna_Main_lamps_remove");
1106 RNA_def_function_flag(func, FUNC_USE_REPORTS);
1107 RNA_def_function_ui_description(func, "Remove a lamp from the current blendfile");
1108 parm = RNA_def_pointer(func, "lamp", "Lamp", "", "Lamp to remove");
1109 RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL | PROP_RNAPTR);
1110 RNA_def_property_clear_flag(parm, PROP_THICK_WRAP);
1112 func = RNA_def_function(srna, "tag", "rna_Main_lamps_tag");
1113 parm = RNA_def_boolean(func, "value", 0, "Value", "");
1114 RNA_def_property_flag(parm, PROP_REQUIRED);
1116 prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
1117 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
1118 RNA_def_property_boolean_funcs(prop, "rna_Main_lamps_is_updated_get", NULL);
1121 void RNA_def_main_libraries(BlenderRNA *brna, PropertyRNA *cprop)
1128 RNA_def_property_srna(cprop, "BlendDataLibraries");
1129 srna = RNA_def_struct(brna, "BlendDataLibraries", NULL);
1130 RNA_def_struct_sdna(srna, "Main");
1131 RNA_def_struct_ui_text(srna, "Main Libraries", "Collection of libraries");
1133 func = RNA_def_function(srna, "tag", "rna_Main_libraries_tag");
1134 parm = RNA_def_boolean(func, "value", 0, "Value", "");
1135 RNA_def_property_flag(parm, PROP_REQUIRED);
1137 prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
1138 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
1139 RNA_def_property_boolean_funcs(prop, "rna_Main_libraries_is_updated_get", NULL);
1142 void RNA_def_main_screens(BlenderRNA *brna, PropertyRNA *cprop)
1149 RNA_def_property_srna(cprop, "BlendDataScreens");
1150 srna = RNA_def_struct(brna, "BlendDataScreens", NULL);
1151 RNA_def_struct_sdna(srna, "Main");
1152 RNA_def_struct_ui_text(srna, "Main Screens", "Collection of screens");
1154 func = RNA_def_function(srna, "tag", "rna_Main_screens_tag");
1155 parm = RNA_def_boolean(func, "value", 0, "Value", "");
1156 RNA_def_property_flag(parm, PROP_REQUIRED);
1158 prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
1159 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
1160 RNA_def_property_boolean_funcs(prop, "rna_Main_screens_is_updated_get", NULL);
1163 void RNA_def_main_window_managers(BlenderRNA *brna, PropertyRNA *cprop)
1170 RNA_def_property_srna(cprop, "BlendDataWindowManagers");
1171 srna = RNA_def_struct(brna, "BlendDataWindowManagers", NULL);
1172 RNA_def_struct_sdna(srna, "Main");
1173 RNA_def_struct_ui_text(srna, "Main Window Managers", "Collection of window managers");
1175 func = RNA_def_function(srna, "tag", "rna_Main_window_managers_tag");
1176 parm = RNA_def_boolean(func, "value", 0, "Value", "");
1177 RNA_def_property_flag(parm, PROP_REQUIRED);
1179 prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
1180 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
1181 RNA_def_property_boolean_funcs(prop, "rna_Main_window_managers_is_updated_get", NULL);
1183 void RNA_def_main_images(BlenderRNA *brna, PropertyRNA *cprop)
1190 RNA_def_property_srna(cprop, "BlendDataImages");
1191 srna = RNA_def_struct(brna, "BlendDataImages", NULL);
1192 RNA_def_struct_sdna(srna, "Main");
1193 RNA_def_struct_ui_text(srna, "Main Images", "Collection of images");
1195 func = RNA_def_function(srna, "new", "rna_Main_images_new");
1196 RNA_def_function_ui_description(func, "Add a new image to the main database");
1197 parm = RNA_def_string(func, "name", "Image", 0, "", "New name for the datablock");
1198 RNA_def_property_flag(parm, PROP_REQUIRED);
1199 parm = RNA_def_int(func, "width", 1024, 1, INT_MAX, "", "Width of the image", 1, INT_MAX);
1200 RNA_def_property_flag(parm, PROP_REQUIRED);
1201 parm = RNA_def_int(func, "height", 1024, 1, INT_MAX, "", "Height of the image", 1, INT_MAX);
1202 RNA_def_property_flag(parm, PROP_REQUIRED);
1203 RNA_def_boolean(func, "alpha", 0, "Alpha", "Use alpha channel");
1204 RNA_def_boolean(func, "float_buffer", 0, "Float Buffer", "Create an image with floating point color");
1205 RNA_def_boolean(func, "stereo3d", 0, "Stereo 3D", "Create left and right views");
1207 parm = RNA_def_pointer(func, "image", "Image", "", "New image datablock");
1208 RNA_def_function_return(func, parm);
1210 func = RNA_def_function(srna, "load", "rna_Main_images_load");
1211 RNA_def_function_flag(func, FUNC_USE_REPORTS);
1212 RNA_def_function_ui_description(func, "Load a new image into the main database");
1213 parm = RNA_def_string_file_path(func, "filepath", "File Path", 0, "", "path of the file to load");
1214 RNA_def_property_flag(parm, PROP_REQUIRED);
1215 RNA_def_boolean(func, "check_existing", false, "",
1216 "Check whether this image filepath is already used, and return existing datablock in this case");
1218 parm = RNA_def_pointer(func, "image", "Image", "", "New image datablock");
1219 RNA_def_function_return(func, parm);
1221 func = RNA_def_function(srna, "remove", "rna_Main_images_remove");
1222 RNA_def_function_flag(func, FUNC_USE_REPORTS);
1223 RNA_def_function_ui_description(func, "Remove an image from the current blendfile");
1224 parm = RNA_def_pointer(func, "image", "Image", "", "Image to remove");
1225 RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL | PROP_RNAPTR);
1226 RNA_def_property_clear_flag(parm, PROP_THICK_WRAP);
1228 func = RNA_def_function(srna, "tag", "rna_Main_images_tag");
1229 parm = RNA_def_boolean(func, "value", 0, "Value", "");
1230 RNA_def_property_flag(parm, PROP_REQUIRED);
1232 prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
1233 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
1234 RNA_def_property_boolean_funcs(prop, "rna_Main_images_is_updated_get", NULL);
1237 void RNA_def_main_lattices(BlenderRNA *brna, PropertyRNA *cprop)
1244 RNA_def_property_srna(cprop, "BlendDataLattices");
1245 srna = RNA_def_struct(brna, "BlendDataLattices", NULL);
1246 RNA_def_struct_sdna(srna, "Main");
1247 RNA_def_struct_ui_text(srna, "Main Lattices", "Collection of lattices");
1249 func = RNA_def_function(srna, "new", "rna_Main_lattices_new");
1250 RNA_def_function_ui_description(func, "Add a new lattice to the main database");
1251 parm = RNA_def_string(func, "name", "Lattice", 0, "", "New name for the datablock");
1252 RNA_def_property_flag(parm, PROP_REQUIRED);
1254 parm = RNA_def_pointer(func, "lattice", "Lattice", "", "New lattices datablock");
1255 RNA_def_function_return(func, parm);
1257 func = RNA_def_function(srna, "remove", "rna_Main_lattices_remove");
1258 RNA_def_function_flag(func, FUNC_USE_REPORTS);
1259 RNA_def_function_ui_description(func, "Remove a lattice from the current blendfile");
1260 parm = RNA_def_pointer(func, "lattice", "Lattice", "", "Lattice to remove");
1261 RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL | PROP_RNAPTR);
1262 RNA_def_property_clear_flag(parm, PROP_THICK_WRAP);
1264 func = RNA_def_function(srna, "tag", "rna_Main_lattices_tag");
1265 parm = RNA_def_boolean(func, "value", 0, "Value", "");
1266 RNA_def_property_flag(parm, PROP_REQUIRED);
1268 prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
1269 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
1270 RNA_def_property_boolean_funcs(prop, "rna_Main_lattices_is_updated_get", NULL);
1272 void RNA_def_main_curves(BlenderRNA *brna, PropertyRNA *cprop)
1279 RNA_def_property_srna(cprop, "BlendDataCurves");
1280 srna = RNA_def_struct(brna, "BlendDataCurves", NULL);
1281 RNA_def_struct_sdna(srna, "Main");
1282 RNA_def_struct_ui_text(srna, "Main Curves", "Collection of curves");
1284 func = RNA_def_function(srna, "new", "rna_Main_curves_new");
1285 RNA_def_function_ui_description(func, "Add a new curve to the main database");
1286 parm = RNA_def_string(func, "name", "Curve", 0, "", "New name for the datablock");
1287 RNA_def_property_flag(parm, PROP_REQUIRED);
1288 parm = RNA_def_enum(func, "type", object_type_curve_items, 0, "Type", "The type of curve to add");
1289 RNA_def_property_flag(parm, PROP_REQUIRED);
1291 parm = RNA_def_pointer(func, "curve", "Curve", "", "New curve datablock");
1292 RNA_def_function_return(func, parm);
1294 func = RNA_def_function(srna, "remove", "rna_Main_curves_remove");
1295 RNA_def_function_flag(func, FUNC_USE_REPORTS);
1296 RNA_def_function_ui_description(func, "Remove a curve from the current blendfile");
1297 parm = RNA_def_pointer(func, "curve", "Curve", "", "Curve to remove");
1298 RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL | PROP_RNAPTR);
1299 RNA_def_property_clear_flag(parm, PROP_THICK_WRAP);
1301 func = RNA_def_function(srna, "tag", "rna_Main_curves_tag");
1302 parm = RNA_def_boolean(func, "value", 0, "Value", "");
1303 RNA_def_property_flag(parm, PROP_REQUIRED);
1305 prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
1306 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
1307 RNA_def_property_boolean_funcs(prop, "rna_Main_curves_is_updated_get", NULL);
1309 void RNA_def_main_metaballs(BlenderRNA *brna, PropertyRNA *cprop)
1316 RNA_def_property_srna(cprop, "BlendDataMetaBalls");
1317 srna = RNA_def_struct(brna, "BlendDataMetaBalls", NULL);
1318 RNA_def_struct_sdna(srna, "Main");
1319 RNA_def_struct_ui_text(srna, "Main Metaballs", "Collection of metaballs");
1321 func = RNA_def_function(srna, "new", "rna_Main_metaballs_new");
1322 RNA_def_function_ui_description(func, "Add a new metaball to the main database");
1323 parm = RNA_def_string(func, "name", "MetaBall", 0, "", "New name for the datablock");
1324 RNA_def_property_flag(parm, PROP_REQUIRED);
1326 parm = RNA_def_pointer(func, "metaball", "MetaBall", "", "New metaball datablock");
1327 RNA_def_function_return(func, parm);
1329 func = RNA_def_function(srna, "remove", "rna_Main_metaballs_remove");
1330 RNA_def_function_flag(func, FUNC_USE_REPORTS);
1331 RNA_def_function_ui_description(func, "Remove a metaball from the current blendfile");
1332 parm = RNA_def_pointer(func, "metaball", "MetaBall", "", "Metaball to remove");
1333 RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL | PROP_RNAPTR);
1334 RNA_def_property_clear_flag(parm, PROP_THICK_WRAP);
1336 func = RNA_def_function(srna, "tag", "rna_Main_metaballs_tag");
1337 parm = RNA_def_boolean(func, "value", 0, "Value", "");
1338 RNA_def_property_flag(parm, PROP_REQUIRED);
1340 prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
1341 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
1342 RNA_def_property_boolean_funcs(prop, "rna_Main_metaballs_is_updated_get", NULL);
1344 void RNA_def_main_fonts(BlenderRNA *brna, PropertyRNA *cprop)
1351 RNA_def_property_srna(cprop, "BlendDataFonts");
1352 srna = RNA_def_struct(brna, "BlendDataFonts", NULL);
1353 RNA_def_struct_sdna(srna, "Main");
1354 RNA_def_struct_ui_text(srna, "Main Fonts", "Collection of fonts");
1356 func = RNA_def_function(srna, "load", "rna_Main_fonts_load");
1357 RNA_def_function_flag(func, FUNC_USE_REPORTS);
1358 RNA_def_function_ui_description(func, "Load a new font into the main database");
1359 parm = RNA_def_string_file_path(func, "filepath", "File Path", 0, "", "path of the font to load");
1360 RNA_def_property_flag(parm, PROP_REQUIRED);
1362 parm = RNA_def_pointer(func, "vfont", "VectorFont", "", "New font datablock");
1363 RNA_def_function_return(func, parm);
1365 func = RNA_def_function(srna, "remove", "rna_Main_fonts_remove");
1366 RNA_def_function_flag(func, FUNC_USE_REPORTS);
1367 RNA_def_function_ui_description(func, "Remove a font from the current blendfile");
1368 parm = RNA_def_pointer(func, "vfont", "VectorFont", "", "Font to remove");
1369 RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL | PROP_RNAPTR);
1370 RNA_def_property_clear_flag(parm, PROP_THICK_WRAP);
1372 func = RNA_def_function(srna, "tag", "rna_Main_fonts_tag");
1373 parm = RNA_def_boolean(func, "value", 0, "Value", "");
1374 RNA_def_property_flag(parm, PROP_REQUIRED);
1376 prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
1377 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
1378 RNA_def_property_boolean_funcs(prop, "rna_Main_fonts_is_updated_get", NULL);
1380 void RNA_def_main_textures(BlenderRNA *brna, PropertyRNA *cprop)
1387 RNA_def_property_srna(cprop, "BlendDataTextures");
1388 srna = RNA_def_struct(brna, "BlendDataTextures", NULL);
1389 RNA_def_struct_sdna(srna, "Main");
1390 RNA_def_struct_ui_text(srna, "Main Textures", "Collection of groups");
1392 func = RNA_def_function(srna, "new", "rna_Main_textures_new");
1393 RNA_def_function_ui_description(func, "Add a new texture to the main database");
1394 parm = RNA_def_string(func, "name", "Texture", 0, "", "New name for the datablock");
1395 RNA_def_property_flag(parm, PROP_REQUIRED);
1396 parm = RNA_def_enum(func, "type", texture_type_items, 0, "Type", "The type of texture to add");
1397 RNA_def_property_flag(parm, PROP_REQUIRED);
1399 parm = RNA_def_pointer(func, "texture", "Texture", "", "New texture datablock");
1400 RNA_def_function_return(func, parm);
1402 func = RNA_def_function(srna, "remove", "rna_Main_textures_remove");
1403 RNA_def_function_flag(func, FUNC_USE_REPORTS);
1404 RNA_def_function_ui_description(func, "Remove a texture from the current blendfile");
1405 parm = RNA_def_pointer(func, "texture", "Texture", "", "Texture to remove");
1406 RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL | PROP_RNAPTR);
1407 RNA_def_property_clear_flag(parm, PROP_THICK_WRAP);
1409 func = RNA_def_function(srna, "tag", "rna_Main_textures_tag");
1410 parm = RNA_def_boolean(func, "value", 0, "Value", "");
1411 RNA_def_property_flag(parm, PROP_REQUIRED);
1413 prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
1414 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
1415 RNA_def_property_boolean_funcs(prop, "rna_Main_textures_is_updated_get", NULL);
1417 void RNA_def_main_brushes(BlenderRNA *brna, PropertyRNA *cprop)
1424 RNA_def_property_srna(cprop, "BlendDataBrushes");
1425 srna = RNA_def_struct(brna, "BlendDataBrushes", NULL);
1426 RNA_def_struct_sdna(srna, "Main");
1427 RNA_def_struct_ui_text(srna, "Main Brushes", "Collection of brushes");
1429 func = RNA_def_function(srna, "new", "rna_Main_brushes_new");
1430 RNA_def_function_ui_description(func, "Add a new brush to the main database");
1431 parm = RNA_def_string(func, "name", "Brush", 0, "", "New name for the datablock");
1432 RNA_def_property_flag(parm, PROP_REQUIRED);
1433 parm = RNA_def_enum(func, "mode", object_mode_items, OB_MODE_TEXTURE_PAINT, "", "Paint Mode for the new brush");
1435 parm = RNA_def_pointer(func, "brush", "Brush", "", "New brush datablock");
1436 RNA_def_function_return(func, parm);
1438 func = RNA_def_function(srna, "remove", "rna_Main_brushes_remove");
1439 RNA_def_function_flag(func, FUNC_USE_REPORTS);
1440 RNA_def_function_ui_description(func, "Remove a brush from the current blendfile");
1441 parm = RNA_def_pointer(func, "brush", "Brush", "", "Brush to remove");
1442 RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL | PROP_RNAPTR);
1443 RNA_def_property_clear_flag(parm, PROP_THICK_WRAP);
1445 func = RNA_def_function(srna, "tag", "rna_Main_brushes_tag");
1446 parm = RNA_def_boolean(func, "value", 0, "Value", "");
1447 RNA_def_property_flag(parm, PROP_REQUIRED);
1449 prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
1450 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
1451 RNA_def_property_boolean_funcs(prop, "rna_Main_brushes_is_updated_get", NULL);
1454 void RNA_def_main_worlds(BlenderRNA *brna, PropertyRNA *cprop)
1461 RNA_def_property_srna(cprop, "BlendDataWorlds");
1462 srna = RNA_def_struct(brna, "BlendDataWorlds", NULL);
1463 RNA_def_struct_sdna(srna, "Main");
1464 RNA_def_struct_ui_text(srna, "Main Worlds", "Collection of worlds");
1466 func = RNA_def_function(srna, "new", "rna_Main_worlds_new");
1467 RNA_def_function_ui_description(func, "Add a new world to the main database");
1468 parm = RNA_def_string(func, "name", "World", 0, "", "New name for the datablock");
1469 RNA_def_property_flag(parm, PROP_REQUIRED);
1471 parm = RNA_def_pointer(func, "world", "World", "", "New world datablock");
1472 RNA_def_function_return(func, parm);
1474 func = RNA_def_function(srna, "remove", "rna_Main_worlds_remove");
1475 RNA_def_function_flag(func, FUNC_USE_REPORTS);
1476 RNA_def_function_ui_description(func, "Remove a world from the current blendfile");
1477 parm = RNA_def_pointer(func, "world", "World", "", "World to remove");
1478 RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL | PROP_RNAPTR);
1479 RNA_def_property_clear_flag(parm, PROP_THICK_WRAP);
1481 func = RNA_def_function(srna, "tag", "rna_Main_worlds_tag");
1482 parm = RNA_def_boolean(func, "value", 0, "Value", "");
1483 RNA_def_property_flag(parm, PROP_REQUIRED);
1485 prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
1486 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
1487 RNA_def_property_boolean_funcs(prop, "rna_Main_worlds_is_updated_get", NULL);
1490 void RNA_def_main_groups(BlenderRNA *brna, PropertyRNA *cprop)
1497 RNA_def_property_srna(cprop, "BlendDataGroups");
1498 srna = RNA_def_struct(brna, "BlendDataGroups", NULL);
1499 RNA_def_struct_sdna(srna, "Main");
1500 RNA_def_struct_ui_text(srna, "Main Groups", "Collection of groups");
1502 func = RNA_def_function(srna, "new", "rna_Main_groups_new");
1503 RNA_def_function_ui_description(func, "Add a new group to the main database");
1504 parm = RNA_def_string(func, "name", "Group", 0, "", "New name for the datablock");
1505 RNA_def_property_flag(parm, PROP_REQUIRED);
1507 parm = RNA_def_pointer(func, "group", "Group", "", "New group datablock");
1508 RNA_def_function_return(func, parm);
1510 func = RNA_def_function(srna, "remove", "rna_Main_groups_remove");
1511 RNA_def_function_ui_description(func, "Remove a group from the current blendfile");
1512 parm = RNA_def_pointer(func, "group", "Group", "", "Group to remove");
1513 RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL | PROP_RNAPTR);
1514 RNA_def_property_clear_flag(parm, PROP_THICK_WRAP);
1516 func = RNA_def_function(srna, "tag", "rna_Main_groups_tag");
1517 parm = RNA_def_boolean(func, "value", 0, "Value", "");
1518 RNA_def_property_flag(parm, PROP_REQUIRED);
1520 prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
1521 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
1522 RNA_def_property_boolean_funcs(prop, "rna_Main_groups_is_updated_get", NULL);
1525 void RNA_def_main_speakers(BlenderRNA *brna, PropertyRNA *cprop)
1532 RNA_def_property_srna(cprop, "BlendDataSpeakers");
1533 srna = RNA_def_struct(brna, "BlendDataSpeakers", NULL);
1534 RNA_def_struct_sdna(srna, "Main");
1535 RNA_def_struct_ui_text(srna, "Main Speakers", "Collection of speakers");
1537 func = RNA_def_function(srna, "new", "rna_Main_speakers_new");
1538 RNA_def_function_ui_description(func, "Add a new speaker to the main database");
1539 parm = RNA_def_string(func, "name", "Speaker", 0, "", "New name for the datablock");
1540 RNA_def_property_flag(parm, PROP_REQUIRED);
1542 parm = RNA_def_pointer(func, "speaker", "Speaker", "", "New speaker datablock");
1543 RNA_def_function_return(func, parm);
1545 func = RNA_def_function(srna, "remove", "rna_Main_speakers_remove");
1546 RNA_def_function_flag(func, FUNC_USE_REPORTS);
1547 RNA_def_function_ui_description(func, "Remove a speaker from the current blendfile");
1548 parm = RNA_def_pointer(func, "speaker", "Speaker", "", "Speaker to remove");
1549 RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL | PROP_RNAPTR);
1550 RNA_def_property_clear_flag(parm, PROP_THICK_WRAP);
1552 func = RNA_def_function(srna, "tag", "rna_Main_speakers_tag");
1553 parm = RNA_def_boolean(func, "value", 0, "Value", "");
1554 RNA_def_property_flag(parm, PROP_REQUIRED);
1556 prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
1557 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
1558 RNA_def_property_boolean_funcs(prop, "rna_Main_speakers_is_updated_get", NULL);
1561 void RNA_def_main_texts(BlenderRNA *brna, PropertyRNA *cprop)
1568 RNA_def_property_srna(cprop, "BlendDataTexts");
1569 srna = RNA_def_struct(brna, "BlendDataTexts", NULL);
1570 RNA_def_struct_sdna(srna, "Main");
1571 RNA_def_struct_ui_text(srna, "Main Texts", "Collection of texts");
1573 func = RNA_def_function(srna, "new", "rna_Main_texts_new");
1574 RNA_def_function_ui_description(func, "Add a new text to the main database");
1575 parm = RNA_def_string(func, "name", "Text", 0, "", "New name for the datablock");
1576 RNA_def_property_flag(parm, PROP_REQUIRED);
1578 parm = RNA_def_pointer(func, "text", "Text", "", "New text datablock");
1579 RNA_def_function_return(func, parm);
1581 func = RNA_def_function(srna, "remove", "rna_Main_texts_remove");
1582 RNA_def_function_ui_description(func, "Remove a text from the current blendfile");
1583 parm = RNA_def_pointer(func, "text", "Text", "", "Text to remove");
1584 RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL | PROP_RNAPTR);
1585 RNA_def_property_clear_flag(parm, PROP_THICK_WRAP);
1588 func = RNA_def_function(srna, "load", "rna_Main_texts_load");
1589 RNA_def_function_flag(func, FUNC_USE_REPORTS);
1590 RNA_def_function_ui_description(func, "Add a new text to the main database from a file");
1591 parm = RNA_def_string_file_path(func, "filepath", "Path", FILE_MAX, "", "path for the datablock");
1592 RNA_def_property_flag(parm, PROP_REQUIRED);
1593 parm = RNA_def_boolean(func, "internal", 0, "Make internal", "Make text file internal after loading");
1595 parm = RNA_def_pointer(func, "text", "Text", "", "New text datablock");
1596 RNA_def_function_return(func, parm);
1598 func = RNA_def_function(srna, "tag", "rna_Main_texts_tag");
1599 parm = RNA_def_boolean(func, "value", 0, "Value", "");
1600 RNA_def_property_flag(parm, PROP_REQUIRED);
1602 prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
1603 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
1604 RNA_def_property_boolean_funcs(prop, "rna_Main_texts_is_updated_get", NULL);
1607 void RNA_def_main_sounds(BlenderRNA *brna, PropertyRNA *cprop)
1614 RNA_def_property_srna(cprop, "BlendDataSounds");
1615 srna = RNA_def_struct(brna, "BlendDataSounds", NULL);
1616 RNA_def_struct_sdna(srna, "Main");
1617 RNA_def_struct_ui_text(srna, "Main Sounds", "Collection of sounds");
1620 func = RNA_def_function(srna, "load", "rna_Main_sounds_load");
1621 RNA_def_function_ui_description(func, "Add a new sound to the main database from a file");
1622 parm = RNA_def_string_file_path(func, "filepath", "Path", FILE_MAX, "", "path for the datablock");
1623 RNA_def_property_flag(parm, PROP_REQUIRED);
1625 parm = RNA_def_pointer(func, "sound", "Sound", "", "New text datablock");
1626 RNA_def_function_return(func, parm);
1628 func = RNA_def_function(srna, "remove", "rna_Main_sounds_remove");
1629 RNA_def_function_flag(func, FUNC_USE_REPORTS);
1630 RNA_def_function_ui_description(func, "Remove a sound from the current blendfile");
1631 parm = RNA_def_pointer(func, "sound", "Sound", "", "Sound to remove");
1632 RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL | PROP_RNAPTR);
1633 RNA_def_property_clear_flag(parm, PROP_THICK_WRAP);
1635 func = RNA_def_function(srna, "tag", "rna_Main_sounds_tag");
1636 parm = RNA_def_boolean(func, "value", 0, "Value", "");
1637 RNA_def_property_flag(parm, PROP_REQUIRED);
1639 prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
1640 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
1641 RNA_def_property_boolean_funcs(prop, "rna_Main_sounds_is_updated_get", NULL);
1644 void RNA_def_main_armatures(BlenderRNA *brna, PropertyRNA *cprop)
1651 RNA_def_property_srna(cprop, "BlendDataArmatures");
1652 srna = RNA_def_struct(brna, "BlendDataArmatures", NULL);
1653 RNA_def_struct_sdna(srna, "Main");
1654 RNA_def_struct_ui_text(srna, "Main Armatures", "Collection of armatures");
1656 func = RNA_def_function(srna, "new", "rna_Main_armatures_new");
1657 RNA_def_function_ui_description(func, "Add a new armature to the main database");
1658 parm = RNA_def_string(func, "name", "Armature", 0, "", "New name for the datablock");
1659 RNA_def_property_flag(parm, PROP_REQUIRED);
1661 parm = RNA_def_pointer(func, "armature", "Armature", "", "New armature datablock");
1662 RNA_def_function_return(func, parm);
1664 func = RNA_def_function(srna, "remove", "rna_Main_armatures_remove");
1665 RNA_def_function_flag(func, FUNC_USE_REPORTS);
1666 RNA_def_function_ui_description(func, "Remove a armature from the current blendfile");
1667 parm = RNA_def_pointer(func, "armature", "Armature", "", "Armature to remove");
1668 RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL | PROP_RNAPTR);
1669 RNA_def_property_clear_flag(parm, PROP_THICK_WRAP);
1671 func = RNA_def_function(srna, "tag", "rna_Main_armatures_tag");
1672 parm = RNA_def_boolean(func, "value", 0, "Value", "");
1673 RNA_def_property_flag(parm, PROP_REQUIRED);
1675 prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
1676 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
1677 RNA_def_property_boolean_funcs(prop, "rna_Main_armatures_is_updated_get", NULL);
1679 void RNA_def_main_actions(BlenderRNA *brna, PropertyRNA *cprop)
1686 RNA_def_property_srna(cprop, "BlendDataActions");
1687 srna = RNA_def_struct(brna, "BlendDataActions", NULL);
1688 RNA_def_struct_sdna(srna, "Main");
1689 RNA_def_struct_ui_text(srna, "Main Actions", "Collection of actions");
1691 func = RNA_def_function(srna, "new", "rna_Main_actions_new");
1692 RNA_def_function_ui_description(func, "Add a new action to the main database");
1693 parm = RNA_def_string(func, "name", "Action", 0, "", "New name for the datablock");
1694 RNA_def_property_flag(parm, PROP_REQUIRED);
1696 parm = RNA_def_pointer(func, "action", "Action", "", "New action datablock");
1697 RNA_def_function_return(func, parm);
1699 func = RNA_def_function(srna, "remove", "rna_Main_actions_remove");
1700 RNA_def_function_flag(func, FUNC_USE_REPORTS);
1701 RNA_def_function_ui_description(func, "Remove a action from the current blendfile");
1702 parm = RNA_def_pointer(func, "action", "Action", "", "Action to remove");
1703 RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL | PROP_RNAPTR);
1704 RNA_def_property_clear_flag(parm, PROP_THICK_WRAP);
1706 func = RNA_def_function(srna, "tag", "rna_Main_actions_tag");
1707 parm = RNA_def_boolean(func, "value", 0, "Value", "");
1708 RNA_def_property_flag(parm, PROP_REQUIRED);
1710 prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
1711 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
1712 RNA_def_property_boolean_funcs(prop, "rna_Main_actions_is_updated_get", NULL);
1714 void RNA_def_main_particles(BlenderRNA *brna, PropertyRNA *cprop)
1721 RNA_def_property_srna(cprop, "BlendDataParticles");
1722 srna = RNA_def_struct(brna, "BlendDataParticles", NULL);
1723 RNA_def_struct_sdna(srna, "Main");
1724 RNA_def_struct_ui_text(srna, "Main Particle Settings", "Collection of particle settings");
1726 func = RNA_def_function(srna, "new", "rna_Main_particles_new");
1727 RNA_def_function_ui_description(func, "Add a new particle settings instance to the main database");
1728 parm = RNA_def_string(func, "name", "ParticleSettings", 0, "", "New name for the datablock");
1729 RNA_def_property_flag(parm, PROP_REQUIRED);
1731 parm = RNA_def_pointer(func, "particle", "ParticleSettings", "", "New particle settings datablock");
1732 RNA_def_function_return(func, parm);
1734 func = RNA_def_function(srna, "remove", "rna_Main_particles_remove");
1735 RNA_def_function_flag(func, FUNC_USE_REPORTS);
1736 RNA_def_function_ui_description(func, "Remove a particle settings instance from the current blendfile");
1737 parm = RNA_def_pointer(func, "particle", "ParticleSettings", "", "Particle Settings to remove");
1738 RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL | PROP_RNAPTR);
1739 RNA_def_property_clear_flag(parm, PROP_THICK_WRAP);
1741 func = RNA_def_function(srna, "tag", "rna_Main_particles_tag");
1742 parm = RNA_def_boolean(func, "value", 0, "Value", "");
1743 RNA_def_property_flag(parm, PROP_REQUIRED);
1745 prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
1746 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
1747 RNA_def_property_boolean_funcs(prop, "rna_Main_particles_is_updated_get", NULL);
1749 void RNA_def_main_palettes(BlenderRNA *brna, PropertyRNA *cprop)
1756 RNA_def_property_srna(cprop, "BlendDataPalettes");
1757 srna = RNA_def_struct(brna, "BlendDataPalettes", NULL);
1758 RNA_def_struct_sdna(srna, "Main");
1759 RNA_def_struct_ui_text(srna, "Main Palettes", "Collection of palettes");
1761 func = RNA_def_function(srna, "new", "rna_Main_palettes_new");
1762 RNA_def_function_ui_description(func, "Add a new palette to the main database");
1763 parm = RNA_def_string(func, "name", "Palette", 0, "", "New name for the datablock");
1764 RNA_def_property_flag(parm, PROP_REQUIRED);
1766 parm = RNA_def_pointer(func, "palette", "Palette", "", "New palette datablock");
1767 RNA_def_function_return(func, parm);
1769 func = RNA_def_function(srna, "remove", "rna_Main_palettes_remove");
1770 RNA_def_function_flag(func, FUNC_USE_REPORTS);
1771 RNA_def_function_ui_description(func, "Remove a palette from the current blendfile");
1772 parm = RNA_def_pointer(func, "palette", "Palette", "", "Palette to remove");
1773 RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL | PROP_RNAPTR);
1774 RNA_def_property_clear_flag(parm, PROP_THICK_WRAP);
1776 func = RNA_def_function(srna, "tag", "rna_Main_palettes_tag");
1777 parm = RNA_def_boolean(func, "value", 0, "Value", "");
1778 RNA_def_property_flag(parm, PROP_REQUIRED);
1780 prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
1781 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
1782 RNA_def_property_boolean_funcs(prop, "rna_Main_palettes_is_updated_get", NULL);
1784 void RNA_def_main_gpencil(BlenderRNA *brna, PropertyRNA *cprop)
1791 RNA_def_property_srna(cprop, "BlendDataGreasePencils");
1792 srna = RNA_def_struct(brna, "BlendDataGreasePencils", NULL);
1793 RNA_def_struct_sdna(srna, "Main");
1794 RNA_def_struct_ui_text(srna, "Main Grease Pencils", "Collection of grease pencils");
1796 func = RNA_def_function(srna, "tag", "rna_Main_gpencil_tag");
1797 parm = RNA_def_boolean(func, "value", 0, "Value", "");
1798 RNA_def_property_flag(parm, PROP_REQUIRED);
1800 func = RNA_def_function(srna, "new", "gpencil_data_addnew");
1801 RNA_def_function_flag(func, FUNC_NO_SELF);
1802 parm = RNA_def_string(func, "name", "GreasePencil", 0, "", "New name for the datablock");
1803 RNA_def_property_flag(parm, PROP_REQUIRED);
1805 parm = RNA_def_pointer(func, "grease_pencil", "GreasePencil", "", "New grease pencil datablock");
1806 RNA_def_function_return(func, parm);
1808 func = RNA_def_function(srna, "remove", "rna_Main_grease_pencil_remove");
1809 RNA_def_function_flag(func, FUNC_USE_REPORTS);
1810 RNA_def_function_ui_description(func, "Remove a grease pencil instance from the current blendfile");
1811 parm = RNA_def_pointer(func, "grease_pencil", "GreasePencil", "", "Grease Pencil to remove");
1812 RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL | PROP_RNAPTR);
1813 RNA_def_property_clear_flag(parm, PROP_THICK_WRAP);
1815 prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
1816 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
1817 RNA_def_property_boolean_funcs(prop, "rna_Main_gpencil_is_updated_get", NULL);
1820 void RNA_def_main_movieclips(BlenderRNA *brna, PropertyRNA *cprop)
1826 RNA_def_property_srna(cprop, "BlendDataMovieClips");
1827 srna = RNA_def_struct(brna, "BlendDataMovieClips", NULL);
1828 RNA_def_struct_sdna(srna, "Main");
1829 RNA_def_struct_ui_text(srna, "Main Movie Clips", "Collection of movie clips");
1831 func = RNA_def_function(srna, "tag", "rna_Main_movieclips_tag");
1832 parm = RNA_def_boolean(func, "value", 0, "Value", "");
1833 RNA_def_property_flag(parm, PROP_REQUIRED);
1835 func = RNA_def_function(srna, "remove", "rna_Main_movieclips_remove");
1836 RNA_def_function_ui_description(func, "Remove a movie clip from the current blendfile.");
1837 parm = RNA_def_pointer(func, "clip", "MovieClip", "", "Movie clip to remove");
1838 RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL | PROP_RNAPTR);
1839 RNA_def_property_clear_flag(parm, PROP_THICK_WRAP);
1842 func = RNA_def_function(srna, "load", "rna_Main_movieclip_load");
1843 RNA_def_function_flag(func, FUNC_USE_REPORTS);
1844 RNA_def_function_ui_description(func, "Add a new movie clip to the main database from a file");
1845 parm = RNA_def_string_file_path(func, "filepath", "Path", FILE_MAX, "", "path for the datablock");
1846 RNA_def_property_flag(parm, PROP_REQUIRED);
1848 parm = RNA_def_pointer(func, "clip", "MovieClip", "", "New movie clip datablock");
1849 RNA_def_function_return(func, parm);
1852 void RNA_def_main_masks(BlenderRNA *brna, PropertyRNA *cprop)
1858 RNA_def_property_srna(cprop, "BlendDataMasks");
1859 srna = RNA_def_struct(brna, "BlendDataMasks", NULL);
1860 RNA_def_struct_sdna(srna, "Main");
1861 RNA_def_struct_ui_text(srna, "Main Masks", "Collection of masks");
1863 func = RNA_def_function(srna, "tag", "rna_Main_masks_tag");
1864 parm = RNA_def_boolean(func, "value", 0, "Value", "");
1865 RNA_def_property_flag(parm, PROP_REQUIRED);
1868 func = RNA_def_function(srna, "new", "rna_Main_mask_new");
1869 RNA_def_function_ui_description(func, "Add a new mask with a given name to the main database");
1870 RNA_def_string_file_path(func, "name", NULL, MAX_ID_NAME - 2, "Mask", "Name of new mask datablock");
1872 parm = RNA_def_pointer(func, "mask", "Mask", "", "New mask datablock");
1873 RNA_def_function_return(func, parm);
1876 func = RNA_def_function(srna, "remove", "rna_Main_masks_remove");
1877 RNA_def_function_ui_description(func, "Remove a masks from the current blendfile.");
1878 parm = RNA_def_pointer(func, "mask", "Mask", "", "Mask to remove");
1879 RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL | PROP_RNAPTR);
1880 RNA_def_property_clear_flag(parm, PROP_THICK_WRAP);
1883 void RNA_def_main_linestyles(BlenderRNA *brna, PropertyRNA *cprop)
1890 RNA_def_property_srna(cprop, "BlendDataLineStyles");
1891 srna = RNA_def_struct(brna, "BlendDataLineStyles", NULL);
1892 RNA_def_struct_sdna(srna, "Main");
1893 RNA_def_struct_ui_text(srna, "Main Line Styles", "Collection of line styles");
1895 func = RNA_def_function(srna, "tag", "rna_Main_linestyle_tag");
1896 parm = RNA_def_boolean(func, "value", 0, "Value", "");
1897 RNA_def_property_flag(parm, PROP_REQUIRED);
1899 func = RNA_def_function(srna, "new", "rna_Main_linestyles_new");
1900 RNA_def_function_ui_description(func, "Add a new line style instance to the main database");
1901 parm = RNA_def_string(func, "name", "FreestyleLineStyle", 0, "", "New name for the datablock");
1902 RNA_def_property_flag(parm, PROP_REQUIRED);
1904 parm = RNA_def_pointer(func, "linestyle", "FreestyleLineStyle", "", "New line style datablock");
1905 RNA_def_function_return(func, parm);
1907 func = RNA_def_function(srna, "remove", "rna_Main_linestyles_remove");
1908 RNA_def_function_flag(func, FUNC_USE_REPORTS);
1909 RNA_def_function_ui_description(func, "Remove a line style instance from the current blendfile");
1910 parm = RNA_def_pointer(func, "linestyle", "FreestyleLineStyle", "", "Line style to remove");
1911 RNA_def_property_flag(parm, PROP_REQUIRED);
1913 prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
1914 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
1915 RNA_def_property_boolean_funcs(prop, "rna_Main_linestyle_is_updated_get", NULL);