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
38 #include "RNA_define.h"
39 #include "RNA_access.h"
40 #include "RNA_enum_types.h"
41 #include "rna_internal.h"
43 #include "BKE_utildefines.h"
48 #include "BKE_camera.h"
49 #include "BKE_curve.h"
51 #include "BKE_armature.h"
53 #include "BKE_library.h"
54 #include "BKE_object.h"
55 #include "BKE_material.h"
56 #include "BKE_image.h"
57 #include "BKE_texture.h"
58 #include "BKE_scene.h"
60 #include "BKE_action.h"
61 #include "BKE_group.h"
62 #include "BKE_brush.h"
63 #include "BKE_lattice.h"
64 #include "BKE_mball.h"
65 #include "BKE_world.h"
66 #include "BKE_particle.h"
69 #include "BKE_depsgraph.h"
70 #include "BKE_speaker.h"
71 #include "BKE_movieclip.h"
74 #include "DNA_armature_types.h"
75 #include "DNA_camera_types.h"
76 #include "DNA_curve_types.h"
77 #include "DNA_lamp_types.h"
78 #include "DNA_material_types.h"
79 #include "DNA_mesh_types.h"
80 #include "DNA_object_types.h"
81 #include "DNA_speaker_types.h"
82 #include "DNA_text_types.h"
83 #include "DNA_texture_types.h"
84 #include "DNA_group_types.h"
85 #include "DNA_brush_types.h"
86 #include "DNA_lattice_types.h"
87 #include "DNA_meta_types.h"
88 #include "DNA_world_types.h"
89 #include "DNA_particle_types.h"
90 #include "DNA_vfont_types.h"
91 #include "DNA_node_types.h"
92 #include "DNA_movieclip_types.h"
93 #include "DNA_mask_types.h"
95 #include "ED_screen.h"
97 Camera *rna_Main_cameras_new(Main *UNUSED(bmain), const char *name)
99 ID *id = BKE_camera_add(name);
103 void rna_Main_cameras_remove(Main *bmain, ReportList *reports, struct Camera *camera)
105 if (ID_REAL_USERS(camera) <= 0)
106 BKE_libblock_free(&bmain->camera, camera);
108 BKE_reportf(reports, RPT_ERROR, "Camera \"%s\" must have zero users to be removed, found %d",
109 camera->id.name + 2, ID_REAL_USERS(camera));
111 /* XXX python now has invalid pointer? */
114 Scene *rna_Main_scenes_new(Main *UNUSED(bmain), const char *name)
116 return BKE_scene_add(name);
118 void rna_Main_scenes_remove(Main *bmain, bContext *C, ReportList *reports, struct Scene *scene)
120 /* don't call BKE_libblock_free(...) directly */
124 newscene = scene->id.prev;
125 else if (scene->id.next)
126 newscene = scene->id.next;
128 BKE_reportf(reports, RPT_ERROR, "Scene \"%s\" is the last, cant ve removed", scene->id.name + 2);
132 if (CTX_wm_screen(C)->scene == scene)
133 ED_screen_set_scene(C, CTX_wm_screen(C), newscene);
135 BKE_scene_unlink(bmain, scene, newscene);
138 Object *rna_Main_objects_new(Main *UNUSED(bmain), ReportList *reports, const char *name, ID *data)
143 switch (GS(data->name)) {
148 type = BKE_curve_type_get((struct Curve *)data);
171 if (RNA_enum_id_from_value(id_type_items, GS(data->name), &idname) == 0)
174 BKE_reportf(reports, RPT_ERROR, "ID type '%s' is not valid for a object", idname);
182 ob = BKE_object_add_only_object(type, name);
186 test_object_materials(ob->data);
191 void rna_Main_objects_remove(Main *bmain, ReportList *reports, struct Object *object)
193 if (ID_REAL_USERS(object) <= 0) {
194 BKE_object_unlink(object); /* needed or ID pointers to this are not cleared */
195 BKE_libblock_free(&bmain->object, object);
198 BKE_reportf(reports, RPT_ERROR, "Object \"%s\" must have zero users to be removed, found %d",
199 object->id.name + 2, ID_REAL_USERS(object));
203 Material *rna_Main_materials_new(Main *UNUSED(bmain), const char *name)
205 ID *id = (ID *)BKE_material_add(name);
207 return (Material *)id;
209 void rna_Main_materials_remove(Main *bmain, ReportList *reports, struct Material *material)
211 if (ID_REAL_USERS(material) <= 0)
212 BKE_libblock_free(&bmain->mat, material);
214 BKE_reportf(reports, RPT_ERROR, "Material \"%s\" must have zero users to be removed, found %d",
215 material->id.name + 2, ID_REAL_USERS(material));
217 /* XXX python now has invalid pointer? */
220 bNodeTree *rna_Main_nodetree_new(Main *UNUSED(bmain), const char *name, int type)
222 bNodeTree *tree = ntreeAddTree(name, type, NODE_GROUP);
224 id_us_min(&tree->id);
227 void rna_Main_nodetree_remove(Main *bmain, ReportList *reports, struct bNodeTree *tree)
229 if (ID_REAL_USERS(tree) <= 0)
230 BKE_libblock_free(&bmain->nodetree, tree);
232 BKE_reportf(reports, RPT_ERROR, "Node Tree \"%s\" must have zero users to be removed, found %d",
233 tree->id.name + 2, ID_REAL_USERS(tree));
235 /* XXX python now has invalid pointer? */
238 Mesh *rna_Main_meshes_new(Main *UNUSED(bmain), const char *name)
240 Mesh *me = BKE_mesh_add(name);
244 void rna_Main_meshes_remove(Main *bmain, ReportList *reports, Mesh *mesh)
246 if (ID_REAL_USERS(mesh) <= 0)
247 BKE_libblock_free(&bmain->mesh, mesh);
249 BKE_reportf(reports, RPT_ERROR, "Mesh \"%s\" must have zero users to be removed, found %d",
250 mesh->id.name + 2, ID_REAL_USERS(mesh));
252 /* XXX python now has invalid pointer? */
255 Lamp *rna_Main_lamps_new(Main *UNUSED(bmain), const char *name, int type)
257 Lamp *lamp = BKE_lamp_add(name);
259 id_us_min(&lamp->id);
262 void rna_Main_lamps_remove(Main *bmain, ReportList *reports, Lamp *lamp)
264 if (ID_REAL_USERS(lamp) <= 0)
265 BKE_libblock_free(&bmain->lamp, lamp);
267 BKE_reportf(reports, RPT_ERROR, "Lamp \"%s\" must have zero users to be removed, found %d",
268 lamp->id.name + 2, ID_REAL_USERS(lamp));
270 /* XXX python now has invalid pointer? */
273 Image *rna_Main_images_new(Main *UNUSED(bmain), const char *name, int width, int height, int alpha, int float_buffer)
275 float color[4] = {0.0, 0.0, 0.0, 1.0};
276 Image *image = BKE_image_add_generated(width, height, name, alpha ? 32 : 24, float_buffer, 0, color);
277 id_us_min(&image->id);
280 Image *rna_Main_images_load(Main *UNUSED(bmain), ReportList *reports, const char *filepath)
285 ima = BKE_image_load(filepath);
288 BKE_reportf(reports, RPT_ERROR, "Can't read: \"%s\", %s", filepath,
289 errno ? strerror(errno) : "Unsupported image format");
293 void rna_Main_images_remove(Main *bmain, ReportList *reports, Image *image)
295 if (ID_REAL_USERS(image) <= 0)
296 BKE_libblock_free(&bmain->image, image);
298 BKE_reportf(reports, RPT_ERROR, "Image \"%s\" must have zero users to be removed, found %d",
299 image->id.name + 2, ID_REAL_USERS(image));
301 /* XXX python now has invalid pointer? */
304 Lattice *rna_Main_lattices_new(Main *UNUSED(bmain), const char *name)
306 Lattice *lt = BKE_lattice_add(name);
310 void rna_Main_lattices_remove(Main *bmain, ReportList *reports, struct Lattice *lt)
312 if (ID_REAL_USERS(lt) <= 0)
313 BKE_libblock_free(&bmain->latt, lt);
315 BKE_reportf(reports, RPT_ERROR, "Lattice \"%s\" must have zero users to be removed, found %d",
316 lt->id.name + 2, ID_REAL_USERS(lt));
319 Curve *rna_Main_curves_new(Main *UNUSED(bmain), const char *name, int type)
321 Curve *cu = BKE_curve_add(name, type);
325 void rna_Main_curves_remove(Main *bmain, ReportList *reports, struct Curve *cu)
327 if (ID_REAL_USERS(cu) <= 0)
328 BKE_libblock_free(&bmain->curve, cu);
330 BKE_reportf(reports, RPT_ERROR, "Curve \"%s\" must have zero users to be removed, found %d",
331 cu->id.name + 2, ID_REAL_USERS(cu));
334 MetaBall *rna_Main_metaballs_new(Main *UNUSED(bmain), const char *name)
336 MetaBall *mb = BKE_mball_add(name);
340 void rna_Main_metaballs_remove(Main *bmain, ReportList *reports, struct MetaBall *mb)
342 if (ID_REAL_USERS(mb) <= 0)
343 BKE_libblock_free(&bmain->mball, mb);
345 BKE_reportf(reports, RPT_ERROR, "Metaball \"%s\" must have zero users to be removed, found %d",
346 mb->id.name + 2, ID_REAL_USERS(mb));
349 VFont *rna_Main_fonts_load(Main *bmain, ReportList *reports, const char *filepath)
354 font = BKE_vfont_load(bmain, filepath);
357 BKE_reportf(reports, RPT_ERROR, "Can't read: \"%s\", %s", filepath,
358 errno ? strerror(errno) : "Unsupported font format");
363 void rna_Main_fonts_remove(Main *bmain, ReportList *reports, VFont *vfont)
365 if (ID_REAL_USERS(vfont) <= 0)
366 BKE_libblock_free(&bmain->vfont, vfont);
368 BKE_reportf(reports, RPT_ERROR, "Font \"%s\" must have zero users to be removed, found %d",
369 vfont->id.name + 2, ID_REAL_USERS(vfont));
371 /* XXX python now has invalid pointer? */
374 Tex *rna_Main_textures_new(Main *UNUSED(bmain), const char *name, int type)
376 Tex *tex = add_texture(name);
377 tex_set_type(tex, type);
381 void rna_Main_textures_remove(Main *bmain, ReportList *reports, struct Tex *tex)
383 if (ID_REAL_USERS(tex) <= 0)
384 BKE_libblock_free(&bmain->tex, tex);
386 BKE_reportf(reports, RPT_ERROR, "Texture \"%s\" must have zero users to be removed, found %d",
387 tex->id.name + 2, ID_REAL_USERS(tex));
390 Brush *rna_Main_brushes_new(Main *UNUSED(bmain), const char *name)
392 Brush *brush = BKE_brush_add(name);
393 id_us_min(&brush->id);
396 void rna_Main_brushes_remove(Main *bmain, ReportList *reports, struct Brush *brush)
398 if (ID_REAL_USERS(brush) <= 0)
399 BKE_libblock_free(&bmain->brush, brush);
401 BKE_reportf(reports, RPT_ERROR, "Brush \"%s\" must have zero users to be removed, found %d",
402 brush->id.name + 2, ID_REAL_USERS(brush));
405 World *rna_Main_worlds_new(Main *UNUSED(bmain), const char *name)
407 World *world = add_world(name);
408 id_us_min(&world->id);
411 void rna_Main_worlds_remove(Main *bmain, ReportList *reports, struct World *world)
413 if (ID_REAL_USERS(world) <= 0)
414 BKE_libblock_free(&bmain->world, world);
416 BKE_reportf(reports, RPT_ERROR, "World \"%s\" must have zero users to be removed, found %d",
417 world->id.name + 2, ID_REAL_USERS(world));
420 Group *rna_Main_groups_new(Main *UNUSED(bmain), const char *name)
422 return add_group(name);
424 void rna_Main_groups_remove(Main *bmain, Group *group)
426 BKE_group_unlink(group);
427 BKE_libblock_free(&bmain->group, group);
428 /* XXX python now has invalid pointer? */
431 Speaker *rna_Main_speakers_new(Main *UNUSED(bmain), const char *name)
433 Speaker *speaker = BKE_speaker_add(name);
434 id_us_min(&speaker->id);
437 void rna_Main_speakers_remove(Main *bmain, ReportList *reports, Speaker *speaker)
439 if (ID_REAL_USERS(speaker) <= 0)
440 BKE_libblock_free(&bmain->speaker, speaker);
442 BKE_reportf(reports, RPT_ERROR, "Speaker \"%s\" must have zero users to be removed, found %d",
443 speaker->id.name + 2, ID_REAL_USERS(speaker));
445 /* XXX python now has invalid pointer? */
448 Text *rna_Main_texts_new(Main *UNUSED(bmain), const char *name)
450 return BKE_text_add(name);
452 void rna_Main_texts_remove(Main *bmain, Text *text)
454 BKE_text_unlink(bmain, text);
455 BKE_libblock_free(&bmain->text, text);
456 /* XXX python now has invalid pointer? */
459 Text *rna_Main_texts_load(Main *bmain, ReportList *reports, const char *filepath)
464 txt = BKE_text_load(filepath, bmain->name);
467 BKE_reportf(reports, RPT_ERROR, "Can't read: \"%s\", %s", filepath,
468 errno ? strerror(errno) : "Unable to load text");
473 bArmature *rna_Main_armatures_new(Main *UNUSED(bmain), const char *name)
475 bArmature *arm = BKE_armature_add(name);
479 void rna_Main_armatures_remove(Main *bmain, ReportList *reports, bArmature *arm)
481 if (ID_REAL_USERS(arm) <= 0)
482 BKE_libblock_free(&bmain->armature, arm);
484 BKE_reportf(reports, RPT_ERROR, "Armature \"%s\" must have zero users to be removed, found %d",
485 arm->id.name + 2, ID_REAL_USERS(arm));
487 /* XXX python now has invalid pointer? */
490 bAction *rna_Main_actions_new(Main *UNUSED(bmain), const char *name)
492 bAction *act = add_empty_action(name);
494 act->id.flag &= ~LIB_FAKEUSER;
497 void rna_Main_actions_remove(Main *bmain, ReportList *reports, bAction *act)
499 if (ID_REAL_USERS(act) <= 0)
500 BKE_libblock_free(&bmain->action, act);
502 BKE_reportf(reports, RPT_ERROR, "Action \"%s\" must have zero users to be removed, found %d",
503 act->id.name + 2, ID_REAL_USERS(act));
505 /* XXX python now has invalid pointer? */
508 ParticleSettings *rna_Main_particles_new(Main *bmain, const char *name)
510 ParticleSettings *part = psys_new_settings(name, bmain);
511 id_us_min(&part->id);
514 void rna_Main_particles_remove(Main *bmain, ReportList *reports, ParticleSettings *part)
516 if (ID_REAL_USERS(part) <= 0)
517 BKE_libblock_free(&bmain->particle, part);
519 BKE_reportf(reports, RPT_ERROR, "Particle Settings \"%s\" must have zero users to be removed, found %d",
520 part->id.name + 2, ID_REAL_USERS(part));
522 /* XXX python now has invalid pointer? */
525 MovieClip *rna_Main_movieclip_load(Main *UNUSED(bmain), ReportList *reports, const char *filepath)
530 clip = BKE_movieclip_file_add(filepath);
533 BKE_reportf(reports, RPT_ERROR, "Can't read: \"%s\", %s.", filepath,
534 errno ? strerror(errno) : "Unable to load movie clip");
539 void rna_Main_movieclips_remove(Main *bmain, MovieClip *clip)
541 BKE_movieclip_unlink(bmain, clip);
542 BKE_libblock_free(&bmain->movieclip, clip);
543 /* XXX python now has invalid pointer? */
546 Mask *rna_Main_mask_new(Main *UNUSED(bmain), const char *name)
550 mask = BKE_mask_new("Mask");
555 void rna_Main_masks_remove(Main *bmain, Mask *mask)
557 BKE_mask_unlink(bmain, mask);
558 BKE_libblock_free(&bmain->mask, mask);
559 /* XXX python now has invalid pointer? */
562 /* tag functions, all the same */
563 void rna_Main_cameras_tag(Main *bmain, int value) { tag_main_lb(&bmain->camera, value); }
564 void rna_Main_scenes_tag(Main *bmain, int value) { tag_main_lb(&bmain->scene, value); }
565 void rna_Main_objects_tag(Main *bmain, int value) { tag_main_lb(&bmain->object, value); }
566 void rna_Main_materials_tag(Main *bmain, int value) { tag_main_lb(&bmain->mat, value); }
567 void rna_Main_node_groups_tag(Main *bmain, int value) { tag_main_lb(&bmain->nodetree, value); }
568 void rna_Main_meshes_tag(Main *bmain, int value) { tag_main_lb(&bmain->mesh, value); }
569 void rna_Main_lamps_tag(Main *bmain, int value) { tag_main_lb(&bmain->lamp, value); }
570 void rna_Main_libraries_tag(Main *bmain, int value) { tag_main_lb(&bmain->library, value); }
571 void rna_Main_screens_tag(Main *bmain, int value) { tag_main_lb(&bmain->screen, value); }
572 void rna_Main_window_managers_tag(Main *bmain, int value) { tag_main_lb(&bmain->wm, value); }
573 void rna_Main_images_tag(Main *bmain, int value) { tag_main_lb(&bmain->image, value); }
574 void rna_Main_lattices_tag(Main *bmain, int value) { tag_main_lb(&bmain->latt, value); }
575 void rna_Main_curves_tag(Main *bmain, int value) { tag_main_lb(&bmain->curve, value); }
576 void rna_Main_metaballs_tag(Main *bmain, int value) { tag_main_lb(&bmain->mball, value); }
577 void rna_Main_fonts_tag(Main *bmain, int value) { tag_main_lb(&bmain->vfont, value); }
578 void rna_Main_textures_tag(Main *bmain, int value) { tag_main_lb(&bmain->tex, value); }
579 void rna_Main_brushes_tag(Main *bmain, int value) { tag_main_lb(&bmain->brush, value); }
580 void rna_Main_worlds_tag(Main *bmain, int value) { tag_main_lb(&bmain->world, value); }
581 void rna_Main_groups_tag(Main *bmain, int value) { tag_main_lb(&bmain->group, value); }
582 void rna_Main_shape_keys_tag(Main *bmain, int value) { tag_main_lb(&bmain->key, value); }
583 void rna_Main_scripts_tag(Main *bmain, int value) { tag_main_lb(&bmain->script, value); }
584 void rna_Main_texts_tag(Main *bmain, int value) { tag_main_lb(&bmain->text, value); }
585 void rna_Main_speakers_tag(Main *bmain, int value) { tag_main_lb(&bmain->speaker, value); }
586 void rna_Main_sounds_tag(Main *bmain, int value) { tag_main_lb(&bmain->sound, value); }
587 void rna_Main_armatures_tag(Main *bmain, int value) { tag_main_lb(&bmain->armature, value); }
588 void rna_Main_actions_tag(Main *bmain, int value) { tag_main_lb(&bmain->action, value); }
589 void rna_Main_particles_tag(Main *bmain, int value) { tag_main_lb(&bmain->particle, value); }
590 void rna_Main_gpencil_tag(Main *bmain, int value) { tag_main_lb(&bmain->gpencil, value); }
591 void rna_Main_movieclips_tag(Main *bmain, int value) { tag_main_lb(&bmain->movieclip, value); }
592 void rna_Main_masks_tag(Main *bmain, int value) { tag_main_lb(&bmain->mask, value); }
594 static int rna_Main_cameras_is_updated_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_CA); }
595 static int rna_Main_scenes_is_updated_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_SCE); }
596 static int rna_Main_objects_is_updated_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_OB); }
597 static int rna_Main_materials_is_updated_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_MA); }
598 static int rna_Main_node_groups_is_updated_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_NT); }
599 static int rna_Main_meshes_is_updated_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_ME); }
600 static int rna_Main_lamps_is_updated_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_LA); }
601 static int rna_Main_libraries_is_updated_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_LI); }
602 static int rna_Main_screens_is_updated_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_SCR); }
603 static int rna_Main_window_managers_is_updated_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_WM); }
604 static int rna_Main_images_is_updated_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_IM); }
605 static int rna_Main_lattices_is_updated_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_LT); }
606 static int rna_Main_curves_is_updated_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_CU); }
607 static int rna_Main_metaballs_is_updated_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_MB); }
608 static int rna_Main_fonts_is_updated_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_VF); }
609 static int rna_Main_textures_is_updated_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_TE); }
610 static int rna_Main_brushes_is_updated_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_BR); }
611 static int rna_Main_worlds_is_updated_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_WO); }
612 static int rna_Main_groups_is_updated_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_GR); }
613 static int rna_Main_texts_is_updated_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_TXT); }
614 static int rna_Main_speakers_is_updated_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_SPK); }
615 static int rna_Main_sounds_is_updated_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_SO); }
616 static int rna_Main_armatures_is_updated_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_AR); }
617 static int rna_Main_actions_is_updated_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_AC); }
618 static int rna_Main_particles_is_updated_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_PA); }
619 static int rna_Main_gpencil_is_updated_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_GD); }
623 void RNA_api_main(StructRNA *srna)
628 /* maybe we want to add functions in 'bpy.data' still?
629 * for now they are all in collections bpy.data.images.new(...) */
630 func = RNA_def_function(srna, "add_image", "rna_Main_add_image");
631 RNA_def_function_ui_description(func, "Add a new image");
632 parm = RNA_def_string_file_path(func, "filepath", "", 0, "", "File path to load image from");
633 RNA_def_property_flag(parm, PROP_REQUIRED);
634 parm = RNA_def_pointer(func, "image", "Image", "", "New image");
635 RNA_def_function_return(func, parm);
639 void RNA_def_main_cameras(BlenderRNA *brna, PropertyRNA *cprop)
646 RNA_def_property_srna(cprop, "BlendDataCameras");
647 srna = RNA_def_struct(brna, "BlendDataCameras", NULL);
648 RNA_def_struct_sdna(srna, "Main");
649 RNA_def_struct_ui_text(srna, "Main Cameras", "Collection of cameras");
651 func = RNA_def_function(srna, "new", "rna_Main_cameras_new");
652 RNA_def_function_ui_description(func, "Add a new camera to the main database");
653 parm = RNA_def_string(func, "name", "Camera", 0, "", "New name for the datablock");
654 RNA_def_property_flag(parm, PROP_REQUIRED);
656 parm = RNA_def_pointer(func, "camera", "Camera", "", "New camera datablock");
657 RNA_def_function_return(func, parm);
659 func = RNA_def_function(srna, "remove", "rna_Main_cameras_remove");
660 RNA_def_function_flag(func, FUNC_USE_REPORTS);
661 RNA_def_function_ui_description(func, "Remove a camera from the current blendfile");
662 parm = RNA_def_pointer(func, "camera", "Camera", "", "Camera to remove");
663 RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL);
665 func = RNA_def_function(srna, "tag", "rna_Main_cameras_tag");
666 parm = RNA_def_boolean(func, "value", 0, "Value", "");
667 RNA_def_property_flag(parm, PROP_REQUIRED);
669 prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
670 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
671 RNA_def_property_boolean_funcs(prop, "rna_Main_cameras_is_updated_get", NULL);
674 void RNA_def_main_scenes(BlenderRNA *brna, PropertyRNA *cprop)
681 RNA_def_property_srna(cprop, "BlendDataScenes");
682 srna = RNA_def_struct(brna, "BlendDataScenes", NULL);
683 RNA_def_struct_sdna(srna, "Main");
684 RNA_def_struct_ui_text(srna, "Main Scenes", "Collection of scenes");
686 func = RNA_def_function(srna, "new", "rna_Main_scenes_new");
687 RNA_def_function_ui_description(func, "Add a new scene to the main database");
688 parm = RNA_def_string(func, "name", "Scene", 0, "", "New name for the datablock");
689 RNA_def_property_flag(parm, PROP_REQUIRED);
691 parm = RNA_def_pointer(func, "scene", "Scene", "", "New scene datablock");
692 RNA_def_function_return(func, parm);
694 func = RNA_def_function(srna, "remove", "rna_Main_scenes_remove");
695 RNA_def_function_flag(func, FUNC_USE_CONTEXT | FUNC_USE_REPORTS);
696 RNA_def_function_ui_description(func, "Remove a scene from the current blendfile");
697 parm = RNA_def_pointer(func, "scene", "Scene", "", "Scene to remove");
698 RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL);
700 func = RNA_def_function(srna, "tag", "rna_Main_scenes_tag");
701 parm = RNA_def_boolean(func, "value", 0, "Value", "");
702 RNA_def_property_flag(parm, PROP_REQUIRED);
704 prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
705 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
706 RNA_def_property_boolean_funcs(prop, "rna_Main_scenes_is_updated_get", NULL);
709 void RNA_def_main_objects(BlenderRNA *brna, PropertyRNA *cprop)
716 RNA_def_property_srna(cprop, "BlendDataObjects");
717 srna = RNA_def_struct(brna, "BlendDataObjects", NULL);
718 RNA_def_struct_sdna(srna, "Main");
719 RNA_def_struct_ui_text(srna, "Main Objects", "Collection of objects");
721 func = RNA_def_function(srna, "new", "rna_Main_objects_new");
722 RNA_def_function_flag(func, FUNC_USE_REPORTS);
723 RNA_def_function_ui_description(func, "Add a new object to the main database");
724 parm = RNA_def_string(func, "name", "Object", 0, "", "New name for the datablock");
725 RNA_def_property_flag(parm, PROP_REQUIRED);
726 parm = RNA_def_pointer(func, "object_data", "ID", "", "Object data or None for an empty object");
727 RNA_def_property_flag(parm, PROP_REQUIRED);
730 parm = RNA_def_pointer(func, "object", "Object", "", "New object datablock");
731 RNA_def_function_return(func, parm);
733 func = RNA_def_function(srna, "remove", "rna_Main_objects_remove");
734 RNA_def_function_ui_description(func, "Remove a object from the current blendfile");
735 RNA_def_function_flag(func, FUNC_USE_REPORTS);
736 parm = RNA_def_pointer(func, "object", "Object", "", "Object to remove");
737 RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL);
739 func = RNA_def_function(srna, "tag", "rna_Main_objects_tag");
740 parm = RNA_def_boolean(func, "value", 0, "Value", "");
741 RNA_def_property_flag(parm, PROP_REQUIRED);
743 prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
744 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
745 RNA_def_property_boolean_funcs(prop, "rna_Main_objects_is_updated_get", NULL);
748 void RNA_def_main_materials(BlenderRNA *brna, PropertyRNA *cprop)
755 RNA_def_property_srna(cprop, "BlendDataMaterials");
756 srna = RNA_def_struct(brna, "BlendDataMaterials", NULL);
757 RNA_def_struct_sdna(srna, "Main");
758 RNA_def_struct_ui_text(srna, "Main Materials", "Collection of materials");
760 func = RNA_def_function(srna, "new", "rna_Main_materials_new");
761 RNA_def_function_ui_description(func, "Add a new material to the main database");
762 parm = RNA_def_string(func, "name", "Material", 0, "", "New name for the datablock");
763 RNA_def_property_flag(parm, PROP_REQUIRED);
765 parm = RNA_def_pointer(func, "material", "Material", "", "New material datablock");
766 RNA_def_function_return(func, parm);
768 func = RNA_def_function(srna, "remove", "rna_Main_materials_remove");
769 RNA_def_function_flag(func, FUNC_USE_REPORTS);
770 RNA_def_function_ui_description(func, "Remove a material from the current blendfile");
771 parm = RNA_def_pointer(func, "material", "Material", "", "Material to remove");
772 RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL);
774 func = RNA_def_function(srna, "tag", "rna_Main_materials_tag");
775 parm = RNA_def_boolean(func, "value", 0, "Value", "");
776 RNA_def_property_flag(parm, PROP_REQUIRED);
778 prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
779 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
780 RNA_def_property_boolean_funcs(prop, "rna_Main_materials_is_updated_get", NULL);
782 void RNA_def_main_node_groups(BlenderRNA *brna, PropertyRNA *cprop)
789 static EnumPropertyItem node_nodetree_items[] = {
790 {0, "SHADER", 0, "Shader", ""},
791 {1, "COMPOSITE", 0, "Composite", ""},
792 {2, "TEXTURE", 0, "Texture", ""},
793 {0, NULL, 0, NULL, NULL}
796 RNA_def_property_srna(cprop, "BlendDataNodeTrees");
797 srna = RNA_def_struct(brna, "BlendDataNodeTrees", NULL);
798 RNA_def_struct_sdna(srna, "Main");
799 RNA_def_struct_ui_text(srna, "Main Node Trees", "Collection of node trees");
801 func = RNA_def_function(srna, "new", "rna_Main_nodetree_new");
802 RNA_def_function_ui_description(func, "Add a new node tree to the main database");
803 parm = RNA_def_string(func, "name", "NodeGroup", 0, "", "New name for the datablock");
804 RNA_def_property_flag(parm, PROP_REQUIRED);
805 parm = RNA_def_enum(func, "type", node_nodetree_items, 0, "Type", "The type of node_group to add");
806 RNA_def_property_flag(parm, PROP_REQUIRED);
808 parm = RNA_def_pointer(func, "tree", "NodeTree", "", "New node tree datablock");
809 RNA_def_function_return(func, parm);
811 func = RNA_def_function(srna, "remove", "rna_Main_nodetree_remove");
812 RNA_def_function_flag(func, FUNC_USE_REPORTS);
813 RNA_def_function_ui_description(func, "Remove a node tree from the current blendfile");
814 parm = RNA_def_pointer(func, "tree", "NodeTree", "", "Node tree to remove");
815 RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL);
817 func = RNA_def_function(srna, "tag", "rna_Main_node_groups_tag");
818 parm = RNA_def_boolean(func, "value", 0, "Value", "");
819 RNA_def_property_flag(parm, PROP_REQUIRED);
821 prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
822 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
823 RNA_def_property_boolean_funcs(prop, "rna_Main_node_groups_is_updated_get", NULL);
825 void RNA_def_main_meshes(BlenderRNA *brna, PropertyRNA *cprop)
832 RNA_def_property_srna(cprop, "BlendDataMeshes");
833 srna = RNA_def_struct(brna, "BlendDataMeshes", NULL);
834 RNA_def_struct_sdna(srna, "Main");
835 RNA_def_struct_ui_text(srna, "Main Meshes", "Collection of meshes");
837 func = RNA_def_function(srna, "new", "rna_Main_meshes_new");
838 RNA_def_function_ui_description(func, "Add a new mesh to the main database");
839 parm = RNA_def_string(func, "name", "Mesh", 0, "", "New name for the datablock");
840 RNA_def_property_flag(parm, PROP_REQUIRED);
842 parm = RNA_def_pointer(func, "mesh", "Mesh", "", "New mesh datablock");
843 RNA_def_function_return(func, parm);
845 func = RNA_def_function(srna, "remove", "rna_Main_meshes_remove");
846 RNA_def_function_flag(func, FUNC_USE_REPORTS);
847 RNA_def_function_ui_description(func, "Remove a mesh from the current blendfile");
848 parm = RNA_def_pointer(func, "mesh", "Mesh", "", "Mesh to remove");
849 RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL);
851 func = RNA_def_function(srna, "tag", "rna_Main_meshes_tag");
852 parm = RNA_def_boolean(func, "value", 0, "Value", "");
853 RNA_def_property_flag(parm, PROP_REQUIRED);
855 prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
856 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
857 RNA_def_property_boolean_funcs(prop, "rna_Main_meshes_is_updated_get", NULL);
859 void RNA_def_main_lamps(BlenderRNA *brna, PropertyRNA *cprop)
866 RNA_def_property_srna(cprop, "BlendDataLamps");
867 srna = RNA_def_struct(brna, "BlendDataLamps", NULL);
868 RNA_def_struct_sdna(srna, "Main");
869 RNA_def_struct_ui_text(srna, "Main Lamps", "Collection of lamps");
871 func = RNA_def_function(srna, "new", "rna_Main_lamps_new");
872 RNA_def_function_ui_description(func, "Add a new lamp to the main database");
873 parm = RNA_def_string(func, "name", "Lamp", 0, "", "New name for the datablock");
874 RNA_def_property_flag(parm, PROP_REQUIRED);
875 parm = RNA_def_enum(func, "type", lamp_type_items, 0, "Type", "The type of texture to add");
876 RNA_def_property_flag(parm, PROP_REQUIRED);
878 parm = RNA_def_pointer(func, "lamp", "Lamp", "", "New lamp datablock");
879 RNA_def_function_return(func, parm);
881 func = RNA_def_function(srna, "remove", "rna_Main_lamps_remove");
882 RNA_def_function_flag(func, FUNC_USE_REPORTS);
883 RNA_def_function_ui_description(func, "Remove a lamp from the current blendfile");
884 parm = RNA_def_pointer(func, "lamp", "Lamp", "", "Lamp to remove");
885 RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL);
887 func = RNA_def_function(srna, "tag", "rna_Main_lamps_tag");
888 parm = RNA_def_boolean(func, "value", 0, "Value", "");
889 RNA_def_property_flag(parm, PROP_REQUIRED);
891 prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
892 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
893 RNA_def_property_boolean_funcs(prop, "rna_Main_lamps_is_updated_get", NULL);
896 void RNA_def_main_libraries(BlenderRNA *brna, PropertyRNA *cprop)
903 RNA_def_property_srna(cprop, "BlendDataLibraries");
904 srna = RNA_def_struct(brna, "BlendDataLibraries", NULL);
905 RNA_def_struct_sdna(srna, "Main");
906 RNA_def_struct_ui_text(srna, "Main Libraries", "Collection of libraries");
908 func = RNA_def_function(srna, "tag", "rna_Main_libraries_tag");
909 parm = RNA_def_boolean(func, "value", 0, "Value", "");
910 RNA_def_property_flag(parm, PROP_REQUIRED);
912 prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
913 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
914 RNA_def_property_boolean_funcs(prop, "rna_Main_libraries_is_updated_get", NULL);
917 void RNA_def_main_screens(BlenderRNA *brna, PropertyRNA *cprop)
924 RNA_def_property_srna(cprop, "BlendDataScreens");
925 srna = RNA_def_struct(brna, "BlendDataScreens", NULL);
926 RNA_def_struct_sdna(srna, "Main");
927 RNA_def_struct_ui_text(srna, "Main Screens", "Collection of screens");
929 func = RNA_def_function(srna, "tag", "rna_Main_screens_tag");
930 parm = RNA_def_boolean(func, "value", 0, "Value", "");
931 RNA_def_property_flag(parm, PROP_REQUIRED);
933 prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
934 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
935 RNA_def_property_boolean_funcs(prop, "rna_Main_screens_is_updated_get", NULL);
938 void RNA_def_main_window_managers(BlenderRNA *brna, PropertyRNA *cprop)
945 RNA_def_property_srna(cprop, "BlendDataWindowManagers");
946 srna = RNA_def_struct(brna, "BlendDataWindowManagers", NULL);
947 RNA_def_struct_sdna(srna, "Main");
948 RNA_def_struct_ui_text(srna, "Main Window Managers", "Collection of window managers");
950 func = RNA_def_function(srna, "tag", "rna_Main_window_managers_tag");
951 parm = RNA_def_boolean(func, "value", 0, "Value", "");
952 RNA_def_property_flag(parm, PROP_REQUIRED);
954 prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
955 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
956 RNA_def_property_boolean_funcs(prop, "rna_Main_window_managers_is_updated_get", NULL);
958 void RNA_def_main_images(BlenderRNA *brna, PropertyRNA *cprop)
965 RNA_def_property_srna(cprop, "BlendDataImages");
966 srna = RNA_def_struct(brna, "BlendDataImages", NULL);
967 RNA_def_struct_sdna(srna, "Main");
968 RNA_def_struct_ui_text(srna, "Main Images", "Collection of images");
970 func = RNA_def_function(srna, "new", "rna_Main_images_new");
971 RNA_def_function_ui_description(func, "Add a new image to the main database");
972 parm = RNA_def_string(func, "name", "Image", 0, "", "New name for the datablock");
973 RNA_def_property_flag(parm, PROP_REQUIRED);
974 parm = RNA_def_int(func, "width", 1024, 1, INT_MAX, "", "Width of the image", 0, INT_MAX);
975 RNA_def_property_flag(parm, PROP_REQUIRED);
976 parm = RNA_def_int(func, "height", 1024, 1, INT_MAX, "", "Height of the image", 0, INT_MAX);
977 RNA_def_property_flag(parm, PROP_REQUIRED);
978 RNA_def_boolean(func, "alpha", 0, "Alpha", "Use alpha channel");
979 RNA_def_boolean(func, "float_buffer", 0, "Float Buffer", "Create an image with floating point color");
981 parm = RNA_def_pointer(func, "image", "Image", "", "New image datablock");
982 RNA_def_function_return(func, parm);
984 func = RNA_def_function(srna, "load", "rna_Main_images_load");
985 RNA_def_function_flag(func, FUNC_USE_REPORTS);
986 RNA_def_function_ui_description(func, "Load a new image into the main database");
987 parm = RNA_def_string_file_path(func, "filepath", "File Path", 0, "", "path of the file to load");
988 RNA_def_property_flag(parm, PROP_REQUIRED);
990 parm = RNA_def_pointer(func, "image", "Image", "", "New image datablock");
991 RNA_def_function_return(func, parm);
993 func = RNA_def_function(srna, "remove", "rna_Main_images_remove");
994 RNA_def_function_flag(func, FUNC_USE_REPORTS);
995 RNA_def_function_ui_description(func, "Remove an image from the current blendfile");
996 parm = RNA_def_pointer(func, "image", "Image", "", "Image to remove");
997 RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL);
999 func = RNA_def_function(srna, "tag", "rna_Main_images_tag");
1000 parm = RNA_def_boolean(func, "value", 0, "Value", "");
1001 RNA_def_property_flag(parm, PROP_REQUIRED);
1003 prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
1004 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
1005 RNA_def_property_boolean_funcs(prop, "rna_Main_images_is_updated_get", NULL);
1008 void RNA_def_main_lattices(BlenderRNA *brna, PropertyRNA *cprop)
1015 RNA_def_property_srna(cprop, "BlendDataLattices");
1016 srna = RNA_def_struct(brna, "BlendDataLattices", NULL);
1017 RNA_def_struct_sdna(srna, "Main");
1018 RNA_def_struct_ui_text(srna, "Main Lattices", "Collection of lattices");
1020 func = RNA_def_function(srna, "new", "rna_Main_lattices_new");
1021 RNA_def_function_ui_description(func, "Add a new lattice to the main database");
1022 parm = RNA_def_string(func, "name", "Lattice", 0, "", "New name for the datablock");
1023 RNA_def_property_flag(parm, PROP_REQUIRED);
1025 parm = RNA_def_pointer(func, "lattice", "Lattice", "", "New lattices datablock");
1026 RNA_def_function_return(func, parm);
1028 func = RNA_def_function(srna, "remove", "rna_Main_lattices_remove");
1029 RNA_def_function_flag(func, FUNC_USE_REPORTS);
1030 RNA_def_function_ui_description(func, "Remove a lattice from the current blendfile");
1031 parm = RNA_def_pointer(func, "lattice", "Lattice", "", "Lattice to remove");
1032 RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL);
1034 func = RNA_def_function(srna, "tag", "rna_Main_lattices_tag");
1035 parm = RNA_def_boolean(func, "value", 0, "Value", "");
1036 RNA_def_property_flag(parm, PROP_REQUIRED);
1038 prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
1039 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
1040 RNA_def_property_boolean_funcs(prop, "rna_Main_lattices_is_updated_get", NULL);
1042 void RNA_def_main_curves(BlenderRNA *brna, PropertyRNA *cprop)
1049 RNA_def_property_srna(cprop, "BlendDataCurves");
1050 srna = RNA_def_struct(brna, "BlendDataCurves", NULL);
1051 RNA_def_struct_sdna(srna, "Main");
1052 RNA_def_struct_ui_text(srna, "Main Curves", "Collection of curves");
1054 func = RNA_def_function(srna, "new", "rna_Main_curves_new");
1055 RNA_def_function_ui_description(func, "Add a new curve to the main database");
1056 parm = RNA_def_string(func, "name", "Curve", 0, "", "New name for the datablock");
1057 RNA_def_property_flag(parm, PROP_REQUIRED);
1058 parm = RNA_def_enum(func, "type", object_type_curve_items, 0, "Type", "The type of curve to add");
1059 RNA_def_property_flag(parm, PROP_REQUIRED);
1061 parm = RNA_def_pointer(func, "curve", "Curve", "", "New curve datablock");
1062 RNA_def_function_return(func, parm);
1064 func = RNA_def_function(srna, "remove", "rna_Main_curves_remove");
1065 RNA_def_function_flag(func, FUNC_USE_REPORTS);
1066 RNA_def_function_ui_description(func, "Remove a curve from the current blendfile");
1067 parm = RNA_def_pointer(func, "curve", "Curve", "", "Curve to remove");
1068 RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL);
1070 func = RNA_def_function(srna, "tag", "rna_Main_curves_tag");
1071 parm = RNA_def_boolean(func, "value", 0, "Value", "");
1072 RNA_def_property_flag(parm, PROP_REQUIRED);
1074 prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
1075 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
1076 RNA_def_property_boolean_funcs(prop, "rna_Main_curves_is_updated_get", NULL);
1078 void RNA_def_main_metaballs(BlenderRNA *brna, PropertyRNA *cprop)
1085 RNA_def_property_srna(cprop, "BlendDataMetaBalls");
1086 srna = RNA_def_struct(brna, "BlendDataMetaBalls", NULL);
1087 RNA_def_struct_sdna(srna, "Main");
1088 RNA_def_struct_ui_text(srna, "Main Metaballs", "Collection of metaballs");
1090 func = RNA_def_function(srna, "new", "rna_Main_metaballs_new");
1091 RNA_def_function_ui_description(func, "Add a new metaball to the main database");
1092 parm = RNA_def_string(func, "name", "MetaBall", 0, "", "New name for the datablock");
1093 RNA_def_property_flag(parm, PROP_REQUIRED);
1095 parm = RNA_def_pointer(func, "metaball", "MetaBall", "", "New metaball datablock");
1096 RNA_def_function_return(func, parm);
1098 func = RNA_def_function(srna, "remove", "rna_Main_metaballs_remove");
1099 RNA_def_function_flag(func, FUNC_USE_REPORTS);
1100 RNA_def_function_ui_description(func, "Remove a metaball from the current blendfile");
1101 parm = RNA_def_pointer(func, "metaball", "MetaBall", "", "Metaball to remove");
1102 RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL);
1104 func = RNA_def_function(srna, "tag", "rna_Main_metaballs_tag");
1105 parm = RNA_def_boolean(func, "value", 0, "Value", "");
1106 RNA_def_property_flag(parm, PROP_REQUIRED);
1108 prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
1109 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
1110 RNA_def_property_boolean_funcs(prop, "rna_Main_metaballs_is_updated_get", NULL);
1112 void RNA_def_main_fonts(BlenderRNA *brna, PropertyRNA *cprop)
1119 RNA_def_property_srna(cprop, "BlendDataFonts");
1120 srna = RNA_def_struct(brna, "BlendDataFonts", NULL);
1121 RNA_def_struct_sdna(srna, "Main");
1122 RNA_def_struct_ui_text(srna, "Main Fonts", "Collection of fonts");
1124 func = RNA_def_function(srna, "load", "rna_Main_fonts_load");
1125 RNA_def_function_flag(func, FUNC_USE_REPORTS);
1126 RNA_def_function_ui_description(func, "Load a new font into the main database");
1127 parm = RNA_def_string_file_path(func, "filepath", "File Path", 0, "", "path of the font to load");
1128 RNA_def_property_flag(parm, PROP_REQUIRED);
1130 parm = RNA_def_pointer(func, "vfont", "VectorFont", "", "New font datablock");
1131 RNA_def_function_return(func, parm);
1133 func = RNA_def_function(srna, "remove", "rna_Main_fonts_remove");
1134 RNA_def_function_flag(func, FUNC_USE_REPORTS);
1135 RNA_def_function_ui_description(func, "Remove a font from the current blendfile");
1136 parm = RNA_def_pointer(func, "vfont", "VectorFont", "", "Font to remove");
1137 RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL);
1139 func = RNA_def_function(srna, "tag", "rna_Main_fonts_tag");
1140 parm = RNA_def_boolean(func, "value", 0, "Value", "");
1141 RNA_def_property_flag(parm, PROP_REQUIRED);
1143 prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
1144 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
1145 RNA_def_property_boolean_funcs(prop, "rna_Main_fonts_is_updated_get", NULL);
1147 void RNA_def_main_textures(BlenderRNA *brna, PropertyRNA *cprop)
1154 RNA_def_property_srna(cprop, "BlendDataTextures");
1155 srna = RNA_def_struct(brna, "BlendDataTextures", NULL);
1156 RNA_def_struct_sdna(srna, "Main");
1157 RNA_def_struct_ui_text(srna, "Main Textures", "Collection of groups");
1159 func = RNA_def_function(srna, "new", "rna_Main_textures_new");
1160 RNA_def_function_ui_description(func, "Add a new texture to the main database");
1161 parm = RNA_def_string(func, "name", "Texture", 0, "", "New name for the datablock");
1162 RNA_def_property_flag(parm, PROP_REQUIRED);
1163 parm = RNA_def_enum(func, "type", texture_type_items, 0, "Type", "The type of texture to add");
1164 RNA_def_property_flag(parm, PROP_REQUIRED);
1166 parm = RNA_def_pointer(func, "texture", "Texture", "", "New texture datablock");
1167 RNA_def_function_return(func, parm);
1169 func = RNA_def_function(srna, "remove", "rna_Main_textures_remove");
1170 RNA_def_function_flag(func, FUNC_USE_REPORTS);
1171 RNA_def_function_ui_description(func, "Remove a texture from the current blendfile");
1172 parm = RNA_def_pointer(func, "texture", "Texture", "", "Texture to remove");
1173 RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL);
1175 func = RNA_def_function(srna, "tag", "rna_Main_textures_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_textures_is_updated_get", NULL);
1183 void RNA_def_main_brushes(BlenderRNA *brna, PropertyRNA *cprop)
1190 RNA_def_property_srna(cprop, "BlendDataBrushes");
1191 srna = RNA_def_struct(brna, "BlendDataBrushes", NULL);
1192 RNA_def_struct_sdna(srna, "Main");
1193 RNA_def_struct_ui_text(srna, "Main Brushes", "Collection of brushes");
1195 func = RNA_def_function(srna, "new", "rna_Main_brushes_new");
1196 RNA_def_function_ui_description(func, "Add a new brush to the main database");
1197 parm = RNA_def_string(func, "name", "Brush", 0, "", "New name for the datablock");
1198 RNA_def_property_flag(parm, PROP_REQUIRED);
1200 parm = RNA_def_pointer(func, "brush", "Brush", "", "New brush datablock");
1201 RNA_def_function_return(func, parm);
1203 func = RNA_def_function(srna, "remove", "rna_Main_brushes_remove");
1204 RNA_def_function_flag(func, FUNC_USE_REPORTS);
1205 RNA_def_function_ui_description(func, "Remove a brush from the current blendfile");
1206 parm = RNA_def_pointer(func, "brush", "Brush", "", "Brush to remove");
1207 RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL);
1209 func = RNA_def_function(srna, "tag", "rna_Main_brushes_tag");
1210 parm = RNA_def_boolean(func, "value", 0, "Value", "");
1211 RNA_def_property_flag(parm, PROP_REQUIRED);
1213 prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
1214 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
1215 RNA_def_property_boolean_funcs(prop, "rna_Main_brushes_is_updated_get", NULL);
1218 void RNA_def_main_worlds(BlenderRNA *brna, PropertyRNA *cprop)
1225 RNA_def_property_srna(cprop, "BlendDataWorlds");
1226 srna = RNA_def_struct(brna, "BlendDataWorlds", NULL);
1227 RNA_def_struct_sdna(srna, "Main");
1228 RNA_def_struct_ui_text(srna, "Main Worlds", "Collection of worlds");
1230 func = RNA_def_function(srna, "new", "rna_Main_worlds_new");
1231 RNA_def_function_ui_description(func, "Add a new world to the main database");
1232 parm = RNA_def_string(func, "name", "World", 0, "", "New name for the datablock");
1233 RNA_def_property_flag(parm, PROP_REQUIRED);
1235 parm = RNA_def_pointer(func, "world", "World", "", "New world datablock");
1236 RNA_def_function_return(func, parm);
1238 func = RNA_def_function(srna, "remove", "rna_Main_worlds_remove");
1239 RNA_def_function_flag(func, FUNC_USE_REPORTS);
1240 RNA_def_function_ui_description(func, "Remove a world from the current blendfile");
1241 parm = RNA_def_pointer(func, "world", "World", "", "World to remove");
1242 RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL);
1244 func = RNA_def_function(srna, "tag", "rna_Main_worlds_tag");
1245 parm = RNA_def_boolean(func, "value", 0, "Value", "");
1246 RNA_def_property_flag(parm, PROP_REQUIRED);
1248 prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
1249 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
1250 RNA_def_property_boolean_funcs(prop, "rna_Main_worlds_is_updated_get", NULL);
1253 void RNA_def_main_groups(BlenderRNA *brna, PropertyRNA *cprop)
1260 RNA_def_property_srna(cprop, "BlendDataGroups");
1261 srna = RNA_def_struct(brna, "BlendDataGroups", NULL);
1262 RNA_def_struct_sdna(srna, "Main");
1263 RNA_def_struct_ui_text(srna, "Main Groups", "Collection of groups");
1265 func = RNA_def_function(srna, "new", "rna_Main_groups_new");
1266 RNA_def_function_ui_description(func, "Add a new group to the main database");
1267 parm = RNA_def_string(func, "name", "Group", 0, "", "New name for the datablock");
1268 RNA_def_property_flag(parm, PROP_REQUIRED);
1270 parm = RNA_def_pointer(func, "group", "Group", "", "New group datablock");
1271 RNA_def_function_return(func, parm);
1273 func = RNA_def_function(srna, "remove", "rna_Main_groups_remove");
1274 RNA_def_function_ui_description(func, "Remove a group from the current blendfile");
1275 parm = RNA_def_pointer(func, "group", "Group", "", "Group to remove");
1276 RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL);
1278 func = RNA_def_function(srna, "tag", "rna_Main_groups_tag");
1279 parm = RNA_def_boolean(func, "value", 0, "Value", "");
1280 RNA_def_property_flag(parm, PROP_REQUIRED);
1282 prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
1283 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
1284 RNA_def_property_boolean_funcs(prop, "rna_Main_groups_is_updated_get", NULL);
1287 void RNA_def_main_speakers(BlenderRNA *brna, PropertyRNA *cprop)
1294 RNA_def_property_srna(cprop, "BlendDataSpeakers");
1295 srna = RNA_def_struct(brna, "BlendDataSpeakers", NULL);
1296 RNA_def_struct_sdna(srna, "Main");
1297 RNA_def_struct_ui_text(srna, "Main Speakers", "Collection of speakers");
1299 func = RNA_def_function(srna, "new", "rna_Main_speakers_new");
1300 RNA_def_function_ui_description(func, "Add a new speaker to the main database");
1301 parm = RNA_def_string(func, "name", "Speaker", 0, "", "New name for the datablock");
1302 RNA_def_property_flag(parm, PROP_REQUIRED);
1304 parm = RNA_def_pointer(func, "speaker", "Speaker", "", "New speaker datablock");
1305 RNA_def_function_return(func, parm);
1307 func = RNA_def_function(srna, "remove", "rna_Main_speakers_remove");
1308 RNA_def_function_flag(func, FUNC_USE_REPORTS);
1309 RNA_def_function_ui_description(func, "Remove a speaker from the current blendfile");
1310 parm = RNA_def_pointer(func, "speaker", "Speaker", "", "Speaker to remove");
1311 RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL);
1313 func = RNA_def_function(srna, "tag", "rna_Main_speakers_tag");
1314 parm = RNA_def_boolean(func, "value", 0, "Value", "");
1315 RNA_def_property_flag(parm, PROP_REQUIRED);
1317 prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
1318 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
1319 RNA_def_property_boolean_funcs(prop, "rna_Main_speakers_is_updated_get", NULL);
1322 void RNA_def_main_texts(BlenderRNA *brna, PropertyRNA *cprop)
1329 RNA_def_property_srna(cprop, "BlendDataTexts");
1330 srna = RNA_def_struct(brna, "BlendDataTexts", NULL);
1331 RNA_def_struct_sdna(srna, "Main");
1332 RNA_def_struct_ui_text(srna, "Main Texts", "Collection of texts");
1334 func = RNA_def_function(srna, "new", "rna_Main_texts_new");
1335 RNA_def_function_ui_description(func, "Add a new text to the main database");
1336 parm = RNA_def_string(func, "name", "Text", 0, "", "New name for the datablock");
1337 RNA_def_property_flag(parm, PROP_REQUIRED);
1339 parm = RNA_def_pointer(func, "text", "Text", "", "New text datablock");
1340 RNA_def_function_return(func, parm);
1342 func = RNA_def_function(srna, "remove", "rna_Main_texts_remove");
1343 RNA_def_function_ui_description(func, "Remove a text from the current blendfile");
1344 parm = RNA_def_pointer(func, "text", "Text", "", "Text to remove");
1345 RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL);
1348 func = RNA_def_function(srna, "load", "rna_Main_texts_load");
1349 RNA_def_function_flag(func, FUNC_USE_REPORTS);
1350 RNA_def_function_ui_description(func, "Add a new text to the main database from a file");
1351 parm = RNA_def_string_file_path(func, "filepath", "Path", FILE_MAX, "", "path for the datablock");
1352 RNA_def_property_flag(parm, PROP_REQUIRED);
1354 parm = RNA_def_pointer(func, "text", "Text", "", "New text datablock");
1355 RNA_def_function_return(func, parm);
1357 func = RNA_def_function(srna, "tag", "rna_Main_texts_tag");
1358 parm = RNA_def_boolean(func, "value", 0, "Value", "");
1359 RNA_def_property_flag(parm, PROP_REQUIRED);
1361 prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
1362 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
1363 RNA_def_property_boolean_funcs(prop, "rna_Main_texts_is_updated_get", NULL);
1366 void RNA_def_main_sounds(BlenderRNA *brna, PropertyRNA *cprop)
1373 RNA_def_property_srna(cprop, "BlendDataSounds");
1374 srna = RNA_def_struct(brna, "BlendDataSounds", NULL);
1375 RNA_def_struct_sdna(srna, "Main");
1376 RNA_def_struct_ui_text(srna, "Main Sounds", "Collection of sounds");
1380 func = RNA_def_function(srna, "tag", "rna_Main_sounds_tag");
1381 parm = RNA_def_boolean(func, "value", 0, "Value", "");
1382 RNA_def_property_flag(parm, PROP_REQUIRED);
1384 prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
1385 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
1386 RNA_def_property_boolean_funcs(prop, "rna_Main_sounds_is_updated_get", NULL);
1389 void RNA_def_main_armatures(BlenderRNA *brna, PropertyRNA *cprop)
1396 RNA_def_property_srna(cprop, "BlendDataArmatures");
1397 srna = RNA_def_struct(brna, "BlendDataArmatures", NULL);
1398 RNA_def_struct_sdna(srna, "Main");
1399 RNA_def_struct_ui_text(srna, "Main Armatures", "Collection of armatures");
1401 func = RNA_def_function(srna, "new", "rna_Main_armatures_new");
1402 RNA_def_function_ui_description(func, "Add a new armature to the main database");
1403 parm = RNA_def_string(func, "name", "Armature", 0, "", "New name for the datablock");
1404 RNA_def_property_flag(parm, PROP_REQUIRED);
1406 parm = RNA_def_pointer(func, "armature", "Armature", "", "New armature datablock");
1407 RNA_def_function_return(func, parm);
1409 func = RNA_def_function(srna, "remove", "rna_Main_armatures_remove");
1410 RNA_def_function_flag(func, FUNC_USE_REPORTS);
1411 RNA_def_function_ui_description(func, "Remove a armature from the current blendfile");
1412 parm = RNA_def_pointer(func, "armature", "Armature", "", "Armature to remove");
1413 RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL);
1415 func = RNA_def_function(srna, "tag", "rna_Main_armatures_tag");
1416 parm = RNA_def_boolean(func, "value", 0, "Value", "");
1417 RNA_def_property_flag(parm, PROP_REQUIRED);
1419 prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
1420 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
1421 RNA_def_property_boolean_funcs(prop, "rna_Main_armatures_is_updated_get", NULL);
1423 void RNA_def_main_actions(BlenderRNA *brna, PropertyRNA *cprop)
1430 RNA_def_property_srna(cprop, "BlendDataActions");
1431 srna = RNA_def_struct(brna, "BlendDataActions", NULL);
1432 RNA_def_struct_sdna(srna, "Main");
1433 RNA_def_struct_ui_text(srna, "Main Actions", "Collection of actions");
1435 func = RNA_def_function(srna, "new", "rna_Main_actions_new");
1436 RNA_def_function_ui_description(func, "Add a new action to the main database");
1437 parm = RNA_def_string(func, "name", "Action", 0, "", "New name for the datablock");
1438 RNA_def_property_flag(parm, PROP_REQUIRED);
1440 parm = RNA_def_pointer(func, "action", "Action", "", "New action datablock");
1441 RNA_def_function_return(func, parm);
1443 func = RNA_def_function(srna, "remove", "rna_Main_actions_remove");
1444 RNA_def_function_flag(func, FUNC_USE_REPORTS);
1445 RNA_def_function_ui_description(func, "Remove a action from the current blendfile");
1446 parm = RNA_def_pointer(func, "action", "Action", "", "Action to remove");
1447 RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL);
1449 func = RNA_def_function(srna, "tag", "rna_Main_actions_tag");
1450 parm = RNA_def_boolean(func, "value", 0, "Value", "");
1451 RNA_def_property_flag(parm, PROP_REQUIRED);
1453 prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
1454 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
1455 RNA_def_property_boolean_funcs(prop, "rna_Main_actions_is_updated_get", NULL);
1457 void RNA_def_main_particles(BlenderRNA *brna, PropertyRNA *cprop)
1464 RNA_def_property_srna(cprop, "BlendDataParticles");
1465 srna = RNA_def_struct(brna, "BlendDataParticles", NULL);
1466 RNA_def_struct_sdna(srna, "Main");
1467 RNA_def_struct_ui_text(srna, "Main Particle Settings", "Collection of particle settings");
1469 func = RNA_def_function(srna, "new", "rna_Main_particles_new");
1470 RNA_def_function_ui_description(func, "Add a new particle settings instance to the main database");
1471 parm = RNA_def_string(func, "name", "ParticleSettings", 0, "", "New name for the datablock");
1472 RNA_def_property_flag(parm, PROP_REQUIRED);
1474 parm = RNA_def_pointer(func, "particle", "ParticleSettings", "", "New particle settings datablock");
1475 RNA_def_function_return(func, parm);
1477 func = RNA_def_function(srna, "remove", "rna_Main_particles_remove");
1478 RNA_def_function_flag(func, FUNC_USE_REPORTS);
1479 RNA_def_function_ui_description(func, "Remove a particle settings instance from the current blendfile");
1480 parm = RNA_def_pointer(func, "particle", "ParticleSettings", "", "Particle Settings to remove");
1481 RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL);
1483 func = RNA_def_function(srna, "tag", "rna_Main_particles_tag");
1484 parm = RNA_def_boolean(func, "value", 0, "Value", "");
1485 RNA_def_property_flag(parm, PROP_REQUIRED);
1487 prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
1488 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
1489 RNA_def_property_boolean_funcs(prop, "rna_Main_particles_is_updated_get", NULL);
1492 void RNA_def_main_gpencil(BlenderRNA *brna, PropertyRNA *cprop)
1499 RNA_def_property_srna(cprop, "BlendDataGreasePencils");
1500 srna = RNA_def_struct(brna, "BlendDataGreasePencils", NULL);
1501 RNA_def_struct_sdna(srna, "Main");
1502 RNA_def_struct_ui_text(srna, "Main Grease Pencils", "Collection of grease pencils");
1504 func = RNA_def_function(srna, "tag", "rna_Main_gpencil_tag");
1505 parm = RNA_def_boolean(func, "value", 0, "Value", "");
1506 RNA_def_property_flag(parm, PROP_REQUIRED);
1508 prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
1509 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
1510 RNA_def_property_boolean_funcs(prop, "rna_Main_gpencil_is_updated_get", NULL);
1513 void RNA_def_main_movieclips(BlenderRNA *brna, PropertyRNA *cprop)
1519 RNA_def_property_srna(cprop, "BlendDataMovieClips");
1520 srna = RNA_def_struct(brna, "BlendDataMovieClips", NULL);
1521 RNA_def_struct_sdna(srna, "Main");
1522 RNA_def_struct_ui_text(srna, "Main Movie Clips", "Collection of movie clips");
1524 func = RNA_def_function(srna, "tag", "rna_Main_movieclips_tag");
1525 parm = RNA_def_boolean(func, "value", 0, "Value", "");
1526 RNA_def_property_flag(parm, PROP_REQUIRED);
1528 func = RNA_def_function(srna, "remove", "rna_Main_movieclips_remove");
1529 RNA_def_function_ui_description(func, "Remove a movie clip from the current blendfile.");
1530 parm = RNA_def_pointer(func, "clip", "MovieClip", "", "Movie clip to remove");
1531 RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL);
1534 func = RNA_def_function(srna, "load", "rna_Main_movieclip_load");
1535 RNA_def_function_flag(func, FUNC_USE_REPORTS);
1536 RNA_def_function_ui_description(func, "Add a new movie clip to the main database from a file");
1537 parm = RNA_def_string_file_path(func, "filepath", "Path", FILE_MAX, "", "path for the datablock");
1538 RNA_def_property_flag(parm, PROP_REQUIRED);
1540 parm = RNA_def_pointer(func, "clip", "MovieClip", "", "New movie clip datablock");
1541 RNA_def_function_return(func, parm);
1544 void RNA_def_main_masks(BlenderRNA *brna, PropertyRNA *cprop)
1550 RNA_def_property_srna(cprop, "BlendDataMasks");
1551 srna = RNA_def_struct(brna, "BlendDataMasks", NULL);
1552 RNA_def_struct_sdna(srna, "Main");
1553 RNA_def_struct_ui_text(srna, "Main Masks", "Collection of masks");
1555 func = RNA_def_function(srna, "tag", "rna_Main_masks_tag");
1556 parm = RNA_def_boolean(func, "value", 0, "Value", "");
1557 RNA_def_property_flag(parm, PROP_REQUIRED);
1560 func = RNA_def_function(srna, "new", "rna_Main_mask_new");
1561 RNA_def_function_ui_description(func, "Add a new mask with a given name to the main database");
1562 parm = RNA_def_string_file_path(func, "name", "", MAX_ID_NAME - 2, "Mask", "Name of new mask datablock");
1564 parm = RNA_def_pointer(func, "mask", "Mask", "", "New mask datablock");
1565 RNA_def_function_return(func, parm);
1568 func = RNA_def_function(srna, "remove", "rna_Main_masks_remove");
1569 RNA_def_function_ui_description(func, "Remove a masks from the current blendfile.");
1570 parm = RNA_def_pointer(func, "mask", "Mask", "", "Mask to remove");
1571 RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL);