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 /* keep in sync with OB_DATA_SUPPORT_ID() macro */
144 switch (GS(data->name)) {
149 type = BKE_curve_type_get((struct Curve *)data);
172 if (RNA_enum_id_from_value(id_type_items, GS(data->name), &idname) == 0)
175 BKE_reportf(reports, RPT_ERROR, "ID type '%s' is not valid for a object", idname);
183 ob = BKE_object_add_only_object(type, name);
187 test_object_materials(ob->data);
192 void rna_Main_objects_remove(Main *bmain, ReportList *reports, struct Object *object)
194 if (ID_REAL_USERS(object) <= 0) {
195 BKE_object_unlink(object); /* needed or ID pointers to this are not cleared */
196 BKE_libblock_free(&bmain->object, object);
199 BKE_reportf(reports, RPT_ERROR, "Object \"%s\" must have zero users to be removed, found %d",
200 object->id.name + 2, ID_REAL_USERS(object));
204 Material *rna_Main_materials_new(Main *UNUSED(bmain), const char *name)
206 ID *id = (ID *)BKE_material_add(name);
208 return (Material *)id;
210 void rna_Main_materials_remove(Main *bmain, ReportList *reports, struct Material *material)
212 if (ID_REAL_USERS(material) <= 0)
213 BKE_libblock_free(&bmain->mat, material);
215 BKE_reportf(reports, RPT_ERROR, "Material \"%s\" must have zero users to be removed, found %d",
216 material->id.name + 2, ID_REAL_USERS(material));
218 /* XXX python now has invalid pointer? */
221 bNodeTree *rna_Main_nodetree_new(Main *UNUSED(bmain), const char *name, int type)
223 bNodeTree *tree = ntreeAddTree(name, type, NODE_GROUP);
225 id_us_min(&tree->id);
228 void rna_Main_nodetree_remove(Main *bmain, ReportList *reports, struct bNodeTree *tree)
230 if (ID_REAL_USERS(tree) <= 0)
231 BKE_libblock_free(&bmain->nodetree, tree);
233 BKE_reportf(reports, RPT_ERROR, "Node Tree \"%s\" must have zero users to be removed, found %d",
234 tree->id.name + 2, ID_REAL_USERS(tree));
236 /* XXX python now has invalid pointer? */
239 Mesh *rna_Main_meshes_new(Main *UNUSED(bmain), const char *name)
241 Mesh *me = BKE_mesh_add(name);
245 void rna_Main_meshes_remove(Main *bmain, ReportList *reports, Mesh *mesh)
247 if (ID_REAL_USERS(mesh) <= 0)
248 BKE_libblock_free(&bmain->mesh, mesh);
250 BKE_reportf(reports, RPT_ERROR, "Mesh \"%s\" must have zero users to be removed, found %d",
251 mesh->id.name + 2, ID_REAL_USERS(mesh));
253 /* XXX python now has invalid pointer? */
256 Lamp *rna_Main_lamps_new(Main *UNUSED(bmain), const char *name, int type)
258 Lamp *lamp = BKE_lamp_add(name);
260 id_us_min(&lamp->id);
263 void rna_Main_lamps_remove(Main *bmain, ReportList *reports, Lamp *lamp)
265 if (ID_REAL_USERS(lamp) <= 0)
266 BKE_libblock_free(&bmain->lamp, lamp);
268 BKE_reportf(reports, RPT_ERROR, "Lamp \"%s\" must have zero users to be removed, found %d",
269 lamp->id.name + 2, ID_REAL_USERS(lamp));
271 /* XXX python now has invalid pointer? */
274 Image *rna_Main_images_new(Main *UNUSED(bmain), const char *name, int width, int height, int alpha, int float_buffer)
276 float color[4] = {0.0, 0.0, 0.0, 1.0};
277 Image *image = BKE_image_add_generated(width, height, name, alpha ? 32 : 24, float_buffer, 0, color);
278 id_us_min(&image->id);
281 Image *rna_Main_images_load(Main *UNUSED(bmain), ReportList *reports, const char *filepath)
286 ima = BKE_image_load(filepath);
289 BKE_reportf(reports, RPT_ERROR, "Can't read: \"%s\", %s", filepath,
290 errno ? strerror(errno) : "Unsupported image format");
294 void rna_Main_images_remove(Main *bmain, ReportList *reports, Image *image)
296 if (ID_REAL_USERS(image) <= 0)
297 BKE_libblock_free(&bmain->image, image);
299 BKE_reportf(reports, RPT_ERROR, "Image \"%s\" must have zero users to be removed, found %d",
300 image->id.name + 2, ID_REAL_USERS(image));
302 /* XXX python now has invalid pointer? */
305 Lattice *rna_Main_lattices_new(Main *UNUSED(bmain), const char *name)
307 Lattice *lt = BKE_lattice_add(name);
311 void rna_Main_lattices_remove(Main *bmain, ReportList *reports, struct Lattice *lt)
313 if (ID_REAL_USERS(lt) <= 0)
314 BKE_libblock_free(&bmain->latt, lt);
316 BKE_reportf(reports, RPT_ERROR, "Lattice \"%s\" must have zero users to be removed, found %d",
317 lt->id.name + 2, ID_REAL_USERS(lt));
320 Curve *rna_Main_curves_new(Main *UNUSED(bmain), const char *name, int type)
322 Curve *cu = BKE_curve_add(name, type);
326 void rna_Main_curves_remove(Main *bmain, ReportList *reports, struct Curve *cu)
328 if (ID_REAL_USERS(cu) <= 0)
329 BKE_libblock_free(&bmain->curve, cu);
331 BKE_reportf(reports, RPT_ERROR, "Curve \"%s\" must have zero users to be removed, found %d",
332 cu->id.name + 2, ID_REAL_USERS(cu));
335 MetaBall *rna_Main_metaballs_new(Main *UNUSED(bmain), const char *name)
337 MetaBall *mb = BKE_mball_add(name);
341 void rna_Main_metaballs_remove(Main *bmain, ReportList *reports, struct MetaBall *mb)
343 if (ID_REAL_USERS(mb) <= 0)
344 BKE_libblock_free(&bmain->mball, mb);
346 BKE_reportf(reports, RPT_ERROR, "Metaball \"%s\" must have zero users to be removed, found %d",
347 mb->id.name + 2, ID_REAL_USERS(mb));
350 VFont *rna_Main_fonts_load(Main *bmain, ReportList *reports, const char *filepath)
355 font = BKE_vfont_load(bmain, filepath);
358 BKE_reportf(reports, RPT_ERROR, "Can't read: \"%s\", %s", filepath,
359 errno ? strerror(errno) : "Unsupported font format");
364 void rna_Main_fonts_remove(Main *bmain, ReportList *reports, VFont *vfont)
366 if (ID_REAL_USERS(vfont) <= 0)
367 BKE_libblock_free(&bmain->vfont, vfont);
369 BKE_reportf(reports, RPT_ERROR, "Font \"%s\" must have zero users to be removed, found %d",
370 vfont->id.name + 2, ID_REAL_USERS(vfont));
372 /* XXX python now has invalid pointer? */
375 Tex *rna_Main_textures_new(Main *UNUSED(bmain), const char *name, int type)
377 Tex *tex = add_texture(name);
378 tex_set_type(tex, type);
382 void rna_Main_textures_remove(Main *bmain, ReportList *reports, struct Tex *tex)
384 if (ID_REAL_USERS(tex) <= 0)
385 BKE_libblock_free(&bmain->tex, tex);
387 BKE_reportf(reports, RPT_ERROR, "Texture \"%s\" must have zero users to be removed, found %d",
388 tex->id.name + 2, ID_REAL_USERS(tex));
391 Brush *rna_Main_brushes_new(Main *UNUSED(bmain), const char *name)
393 Brush *brush = BKE_brush_add(name);
394 id_us_min(&brush->id);
397 void rna_Main_brushes_remove(Main *bmain, ReportList *reports, struct Brush *brush)
399 if (ID_REAL_USERS(brush) <= 0)
400 BKE_libblock_free(&bmain->brush, brush);
402 BKE_reportf(reports, RPT_ERROR, "Brush \"%s\" must have zero users to be removed, found %d",
403 brush->id.name + 2, ID_REAL_USERS(brush));
406 World *rna_Main_worlds_new(Main *UNUSED(bmain), const char *name)
408 World *world = add_world(name);
409 id_us_min(&world->id);
412 void rna_Main_worlds_remove(Main *bmain, ReportList *reports, struct World *world)
414 if (ID_REAL_USERS(world) <= 0)
415 BKE_libblock_free(&bmain->world, world);
417 BKE_reportf(reports, RPT_ERROR, "World \"%s\" must have zero users to be removed, found %d",
418 world->id.name + 2, ID_REAL_USERS(world));
421 Group *rna_Main_groups_new(Main *UNUSED(bmain), const char *name)
423 return add_group(name);
425 void rna_Main_groups_remove(Main *bmain, Group *group)
427 BKE_group_unlink(group);
428 BKE_libblock_free(&bmain->group, group);
429 /* XXX python now has invalid pointer? */
432 Speaker *rna_Main_speakers_new(Main *UNUSED(bmain), const char *name)
434 Speaker *speaker = BKE_speaker_add(name);
435 id_us_min(&speaker->id);
438 void rna_Main_speakers_remove(Main *bmain, ReportList *reports, Speaker *speaker)
440 if (ID_REAL_USERS(speaker) <= 0)
441 BKE_libblock_free(&bmain->speaker, speaker);
443 BKE_reportf(reports, RPT_ERROR, "Speaker \"%s\" must have zero users to be removed, found %d",
444 speaker->id.name + 2, ID_REAL_USERS(speaker));
446 /* XXX python now has invalid pointer? */
449 Text *rna_Main_texts_new(Main *UNUSED(bmain), const char *name)
451 return BKE_text_add(name);
453 void rna_Main_texts_remove(Main *bmain, Text *text)
455 BKE_text_unlink(bmain, text);
456 BKE_libblock_free(&bmain->text, text);
457 /* XXX python now has invalid pointer? */
460 Text *rna_Main_texts_load(Main *bmain, ReportList *reports, const char *filepath)
465 txt = BKE_text_load(filepath, bmain->name);
468 BKE_reportf(reports, RPT_ERROR, "Can't read: \"%s\", %s", filepath,
469 errno ? strerror(errno) : "Unable to load text");
474 bArmature *rna_Main_armatures_new(Main *UNUSED(bmain), const char *name)
476 bArmature *arm = BKE_armature_add(name);
480 void rna_Main_armatures_remove(Main *bmain, ReportList *reports, bArmature *arm)
482 if (ID_REAL_USERS(arm) <= 0)
483 BKE_libblock_free(&bmain->armature, arm);
485 BKE_reportf(reports, RPT_ERROR, "Armature \"%s\" must have zero users to be removed, found %d",
486 arm->id.name + 2, ID_REAL_USERS(arm));
488 /* XXX python now has invalid pointer? */
491 bAction *rna_Main_actions_new(Main *UNUSED(bmain), const char *name)
493 bAction *act = add_empty_action(name);
495 act->id.flag &= ~LIB_FAKEUSER;
498 void rna_Main_actions_remove(Main *bmain, ReportList *reports, bAction *act)
500 if (ID_REAL_USERS(act) <= 0)
501 BKE_libblock_free(&bmain->action, act);
503 BKE_reportf(reports, RPT_ERROR, "Action \"%s\" must have zero users to be removed, found %d",
504 act->id.name + 2, ID_REAL_USERS(act));
506 /* XXX python now has invalid pointer? */
509 ParticleSettings *rna_Main_particles_new(Main *bmain, const char *name)
511 ParticleSettings *part = psys_new_settings(name, bmain);
512 id_us_min(&part->id);
515 void rna_Main_particles_remove(Main *bmain, ReportList *reports, ParticleSettings *part)
517 if (ID_REAL_USERS(part) <= 0)
518 BKE_libblock_free(&bmain->particle, part);
520 BKE_reportf(reports, RPT_ERROR, "Particle Settings \"%s\" must have zero users to be removed, found %d",
521 part->id.name + 2, ID_REAL_USERS(part));
523 /* XXX python now has invalid pointer? */
526 MovieClip *rna_Main_movieclip_load(Main *UNUSED(bmain), ReportList *reports, const char *filepath)
531 clip = BKE_movieclip_file_add(filepath);
534 BKE_reportf(reports, RPT_ERROR, "Can't read: \"%s\", %s.", filepath,
535 errno ? strerror(errno) : "Unable to load movie clip");
540 void rna_Main_movieclips_remove(Main *bmain, MovieClip *clip)
542 BKE_movieclip_unlink(bmain, clip);
543 BKE_libblock_free(&bmain->movieclip, clip);
544 /* XXX python now has invalid pointer? */
547 Mask *rna_Main_mask_new(Main *UNUSED(bmain), const char *name)
551 mask = BKE_mask_new("Mask");
556 void rna_Main_masks_remove(Main *bmain, Mask *mask)
558 BKE_mask_unlink(bmain, mask);
559 BKE_libblock_free(&bmain->mask, mask);
560 /* XXX python now has invalid pointer? */
563 /* tag functions, all the same */
564 void rna_Main_cameras_tag(Main *bmain, int value) { tag_main_lb(&bmain->camera, value); }
565 void rna_Main_scenes_tag(Main *bmain, int value) { tag_main_lb(&bmain->scene, value); }
566 void rna_Main_objects_tag(Main *bmain, int value) { tag_main_lb(&bmain->object, value); }
567 void rna_Main_materials_tag(Main *bmain, int value) { tag_main_lb(&bmain->mat, value); }
568 void rna_Main_node_groups_tag(Main *bmain, int value) { tag_main_lb(&bmain->nodetree, value); }
569 void rna_Main_meshes_tag(Main *bmain, int value) { tag_main_lb(&bmain->mesh, value); }
570 void rna_Main_lamps_tag(Main *bmain, int value) { tag_main_lb(&bmain->lamp, value); }
571 void rna_Main_libraries_tag(Main *bmain, int value) { tag_main_lb(&bmain->library, value); }
572 void rna_Main_screens_tag(Main *bmain, int value) { tag_main_lb(&bmain->screen, value); }
573 void rna_Main_window_managers_tag(Main *bmain, int value) { tag_main_lb(&bmain->wm, value); }
574 void rna_Main_images_tag(Main *bmain, int value) { tag_main_lb(&bmain->image, value); }
575 void rna_Main_lattices_tag(Main *bmain, int value) { tag_main_lb(&bmain->latt, value); }
576 void rna_Main_curves_tag(Main *bmain, int value) { tag_main_lb(&bmain->curve, value); }
577 void rna_Main_metaballs_tag(Main *bmain, int value) { tag_main_lb(&bmain->mball, value); }
578 void rna_Main_fonts_tag(Main *bmain, int value) { tag_main_lb(&bmain->vfont, value); }
579 void rna_Main_textures_tag(Main *bmain, int value) { tag_main_lb(&bmain->tex, value); }
580 void rna_Main_brushes_tag(Main *bmain, int value) { tag_main_lb(&bmain->brush, value); }
581 void rna_Main_worlds_tag(Main *bmain, int value) { tag_main_lb(&bmain->world, value); }
582 void rna_Main_groups_tag(Main *bmain, int value) { tag_main_lb(&bmain->group, value); }
583 void rna_Main_shape_keys_tag(Main *bmain, int value) { tag_main_lb(&bmain->key, value); }
584 void rna_Main_scripts_tag(Main *bmain, int value) { tag_main_lb(&bmain->script, value); }
585 void rna_Main_texts_tag(Main *bmain, int value) { tag_main_lb(&bmain->text, value); }
586 void rna_Main_speakers_tag(Main *bmain, int value) { tag_main_lb(&bmain->speaker, value); }
587 void rna_Main_sounds_tag(Main *bmain, int value) { tag_main_lb(&bmain->sound, value); }
588 void rna_Main_armatures_tag(Main *bmain, int value) { tag_main_lb(&bmain->armature, value); }
589 void rna_Main_actions_tag(Main *bmain, int value) { tag_main_lb(&bmain->action, value); }
590 void rna_Main_particles_tag(Main *bmain, int value) { tag_main_lb(&bmain->particle, value); }
591 void rna_Main_gpencil_tag(Main *bmain, int value) { tag_main_lb(&bmain->gpencil, value); }
592 void rna_Main_movieclips_tag(Main *bmain, int value) { tag_main_lb(&bmain->movieclip, value); }
593 void rna_Main_masks_tag(Main *bmain, int value) { tag_main_lb(&bmain->mask, value); }
595 static int rna_Main_cameras_is_updated_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_CA); }
596 static int rna_Main_scenes_is_updated_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_SCE); }
597 static int rna_Main_objects_is_updated_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_OB); }
598 static int rna_Main_materials_is_updated_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_MA); }
599 static int rna_Main_node_groups_is_updated_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_NT); }
600 static int rna_Main_meshes_is_updated_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_ME); }
601 static int rna_Main_lamps_is_updated_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_LA); }
602 static int rna_Main_libraries_is_updated_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_LI); }
603 static int rna_Main_screens_is_updated_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_SCR); }
604 static int rna_Main_window_managers_is_updated_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_WM); }
605 static int rna_Main_images_is_updated_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_IM); }
606 static int rna_Main_lattices_is_updated_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_LT); }
607 static int rna_Main_curves_is_updated_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_CU); }
608 static int rna_Main_metaballs_is_updated_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_MB); }
609 static int rna_Main_fonts_is_updated_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_VF); }
610 static int rna_Main_textures_is_updated_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_TE); }
611 static int rna_Main_brushes_is_updated_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_BR); }
612 static int rna_Main_worlds_is_updated_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_WO); }
613 static int rna_Main_groups_is_updated_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_GR); }
614 static int rna_Main_texts_is_updated_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_TXT); }
615 static int rna_Main_speakers_is_updated_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_SPK); }
616 static int rna_Main_sounds_is_updated_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_SO); }
617 static int rna_Main_armatures_is_updated_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_AR); }
618 static int rna_Main_actions_is_updated_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_AC); }
619 static int rna_Main_particles_is_updated_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_PA); }
620 static int rna_Main_gpencil_is_updated_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_GD); }
624 void RNA_api_main(StructRNA *srna)
629 /* maybe we want to add functions in 'bpy.data' still?
630 * for now they are all in collections bpy.data.images.new(...) */
631 func = RNA_def_function(srna, "add_image", "rna_Main_add_image");
632 RNA_def_function_ui_description(func, "Add a new image");
633 parm = RNA_def_string_file_path(func, "filepath", "", 0, "", "File path to load image from");
634 RNA_def_property_flag(parm, PROP_REQUIRED);
635 parm = RNA_def_pointer(func, "image", "Image", "", "New image");
636 RNA_def_function_return(func, parm);
640 void RNA_def_main_cameras(BlenderRNA *brna, PropertyRNA *cprop)
647 RNA_def_property_srna(cprop, "BlendDataCameras");
648 srna = RNA_def_struct(brna, "BlendDataCameras", NULL);
649 RNA_def_struct_sdna(srna, "Main");
650 RNA_def_struct_ui_text(srna, "Main Cameras", "Collection of cameras");
652 func = RNA_def_function(srna, "new", "rna_Main_cameras_new");
653 RNA_def_function_ui_description(func, "Add a new camera to the main database");
654 parm = RNA_def_string(func, "name", "Camera", 0, "", "New name for the datablock");
655 RNA_def_property_flag(parm, PROP_REQUIRED);
657 parm = RNA_def_pointer(func, "camera", "Camera", "", "New camera datablock");
658 RNA_def_function_return(func, parm);
660 func = RNA_def_function(srna, "remove", "rna_Main_cameras_remove");
661 RNA_def_function_flag(func, FUNC_USE_REPORTS);
662 RNA_def_function_ui_description(func, "Remove a camera from the current blendfile");
663 parm = RNA_def_pointer(func, "camera", "Camera", "", "Camera to remove");
664 RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL);
666 func = RNA_def_function(srna, "tag", "rna_Main_cameras_tag");
667 parm = RNA_def_boolean(func, "value", 0, "Value", "");
668 RNA_def_property_flag(parm, PROP_REQUIRED);
670 prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
671 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
672 RNA_def_property_boolean_funcs(prop, "rna_Main_cameras_is_updated_get", NULL);
675 void RNA_def_main_scenes(BlenderRNA *brna, PropertyRNA *cprop)
682 RNA_def_property_srna(cprop, "BlendDataScenes");
683 srna = RNA_def_struct(brna, "BlendDataScenes", NULL);
684 RNA_def_struct_sdna(srna, "Main");
685 RNA_def_struct_ui_text(srna, "Main Scenes", "Collection of scenes");
687 func = RNA_def_function(srna, "new", "rna_Main_scenes_new");
688 RNA_def_function_ui_description(func, "Add a new scene to the main database");
689 parm = RNA_def_string(func, "name", "Scene", 0, "", "New name for the datablock");
690 RNA_def_property_flag(parm, PROP_REQUIRED);
692 parm = RNA_def_pointer(func, "scene", "Scene", "", "New scene datablock");
693 RNA_def_function_return(func, parm);
695 func = RNA_def_function(srna, "remove", "rna_Main_scenes_remove");
696 RNA_def_function_flag(func, FUNC_USE_CONTEXT | FUNC_USE_REPORTS);
697 RNA_def_function_ui_description(func, "Remove a scene from the current blendfile");
698 parm = RNA_def_pointer(func, "scene", "Scene", "", "Scene to remove");
699 RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL);
701 func = RNA_def_function(srna, "tag", "rna_Main_scenes_tag");
702 parm = RNA_def_boolean(func, "value", 0, "Value", "");
703 RNA_def_property_flag(parm, PROP_REQUIRED);
705 prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
706 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
707 RNA_def_property_boolean_funcs(prop, "rna_Main_scenes_is_updated_get", NULL);
710 void RNA_def_main_objects(BlenderRNA *brna, PropertyRNA *cprop)
717 RNA_def_property_srna(cprop, "BlendDataObjects");
718 srna = RNA_def_struct(brna, "BlendDataObjects", NULL);
719 RNA_def_struct_sdna(srna, "Main");
720 RNA_def_struct_ui_text(srna, "Main Objects", "Collection of objects");
722 func = RNA_def_function(srna, "new", "rna_Main_objects_new");
723 RNA_def_function_flag(func, FUNC_USE_REPORTS);
724 RNA_def_function_ui_description(func, "Add a new object to the main database");
725 parm = RNA_def_string(func, "name", "Object", 0, "", "New name for the datablock");
726 RNA_def_property_flag(parm, PROP_REQUIRED);
727 parm = RNA_def_pointer(func, "object_data", "ID", "", "Object data or None for an empty object");
728 RNA_def_property_flag(parm, PROP_REQUIRED);
731 parm = RNA_def_pointer(func, "object", "Object", "", "New object datablock");
732 RNA_def_function_return(func, parm);
734 func = RNA_def_function(srna, "remove", "rna_Main_objects_remove");
735 RNA_def_function_ui_description(func, "Remove a object from the current blendfile");
736 RNA_def_function_flag(func, FUNC_USE_REPORTS);
737 parm = RNA_def_pointer(func, "object", "Object", "", "Object to remove");
738 RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL);
740 func = RNA_def_function(srna, "tag", "rna_Main_objects_tag");
741 parm = RNA_def_boolean(func, "value", 0, "Value", "");
742 RNA_def_property_flag(parm, PROP_REQUIRED);
744 prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
745 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
746 RNA_def_property_boolean_funcs(prop, "rna_Main_objects_is_updated_get", NULL);
749 void RNA_def_main_materials(BlenderRNA *brna, PropertyRNA *cprop)
756 RNA_def_property_srna(cprop, "BlendDataMaterials");
757 srna = RNA_def_struct(brna, "BlendDataMaterials", NULL);
758 RNA_def_struct_sdna(srna, "Main");
759 RNA_def_struct_ui_text(srna, "Main Materials", "Collection of materials");
761 func = RNA_def_function(srna, "new", "rna_Main_materials_new");
762 RNA_def_function_ui_description(func, "Add a new material to the main database");
763 parm = RNA_def_string(func, "name", "Material", 0, "", "New name for the datablock");
764 RNA_def_property_flag(parm, PROP_REQUIRED);
766 parm = RNA_def_pointer(func, "material", "Material", "", "New material datablock");
767 RNA_def_function_return(func, parm);
769 func = RNA_def_function(srna, "remove", "rna_Main_materials_remove");
770 RNA_def_function_flag(func, FUNC_USE_REPORTS);
771 RNA_def_function_ui_description(func, "Remove a material from the current blendfile");
772 parm = RNA_def_pointer(func, "material", "Material", "", "Material to remove");
773 RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL);
775 func = RNA_def_function(srna, "tag", "rna_Main_materials_tag");
776 parm = RNA_def_boolean(func, "value", 0, "Value", "");
777 RNA_def_property_flag(parm, PROP_REQUIRED);
779 prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
780 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
781 RNA_def_property_boolean_funcs(prop, "rna_Main_materials_is_updated_get", NULL);
783 void RNA_def_main_node_groups(BlenderRNA *brna, PropertyRNA *cprop)
790 static EnumPropertyItem node_nodetree_items[] = {
791 {0, "SHADER", 0, "Shader", ""},
792 {1, "COMPOSITE", 0, "Composite", ""},
793 {2, "TEXTURE", 0, "Texture", ""},
794 {0, NULL, 0, NULL, NULL}
797 RNA_def_property_srna(cprop, "BlendDataNodeTrees");
798 srna = RNA_def_struct(brna, "BlendDataNodeTrees", NULL);
799 RNA_def_struct_sdna(srna, "Main");
800 RNA_def_struct_ui_text(srna, "Main Node Trees", "Collection of node trees");
802 func = RNA_def_function(srna, "new", "rna_Main_nodetree_new");
803 RNA_def_function_ui_description(func, "Add a new node tree to the main database");
804 parm = RNA_def_string(func, "name", "NodeGroup", 0, "", "New name for the datablock");
805 RNA_def_property_flag(parm, PROP_REQUIRED);
806 parm = RNA_def_enum(func, "type", node_nodetree_items, 0, "Type", "The type of node_group to add");
807 RNA_def_property_flag(parm, PROP_REQUIRED);
809 parm = RNA_def_pointer(func, "tree", "NodeTree", "", "New node tree datablock");
810 RNA_def_function_return(func, parm);
812 func = RNA_def_function(srna, "remove", "rna_Main_nodetree_remove");
813 RNA_def_function_flag(func, FUNC_USE_REPORTS);
814 RNA_def_function_ui_description(func, "Remove a node tree from the current blendfile");
815 parm = RNA_def_pointer(func, "tree", "NodeTree", "", "Node tree to remove");
816 RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL);
818 func = RNA_def_function(srna, "tag", "rna_Main_node_groups_tag");
819 parm = RNA_def_boolean(func, "value", 0, "Value", "");
820 RNA_def_property_flag(parm, PROP_REQUIRED);
822 prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
823 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
824 RNA_def_property_boolean_funcs(prop, "rna_Main_node_groups_is_updated_get", NULL);
826 void RNA_def_main_meshes(BlenderRNA *brna, PropertyRNA *cprop)
833 RNA_def_property_srna(cprop, "BlendDataMeshes");
834 srna = RNA_def_struct(brna, "BlendDataMeshes", NULL);
835 RNA_def_struct_sdna(srna, "Main");
836 RNA_def_struct_ui_text(srna, "Main Meshes", "Collection of meshes");
838 func = RNA_def_function(srna, "new", "rna_Main_meshes_new");
839 RNA_def_function_ui_description(func, "Add a new mesh to the main database");
840 parm = RNA_def_string(func, "name", "Mesh", 0, "", "New name for the datablock");
841 RNA_def_property_flag(parm, PROP_REQUIRED);
843 parm = RNA_def_pointer(func, "mesh", "Mesh", "", "New mesh datablock");
844 RNA_def_function_return(func, parm);
846 func = RNA_def_function(srna, "remove", "rna_Main_meshes_remove");
847 RNA_def_function_flag(func, FUNC_USE_REPORTS);
848 RNA_def_function_ui_description(func, "Remove a mesh from the current blendfile");
849 parm = RNA_def_pointer(func, "mesh", "Mesh", "", "Mesh to remove");
850 RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL);
852 func = RNA_def_function(srna, "tag", "rna_Main_meshes_tag");
853 parm = RNA_def_boolean(func, "value", 0, "Value", "");
854 RNA_def_property_flag(parm, PROP_REQUIRED);
856 prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
857 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
858 RNA_def_property_boolean_funcs(prop, "rna_Main_meshes_is_updated_get", NULL);
860 void RNA_def_main_lamps(BlenderRNA *brna, PropertyRNA *cprop)
867 RNA_def_property_srna(cprop, "BlendDataLamps");
868 srna = RNA_def_struct(brna, "BlendDataLamps", NULL);
869 RNA_def_struct_sdna(srna, "Main");
870 RNA_def_struct_ui_text(srna, "Main Lamps", "Collection of lamps");
872 func = RNA_def_function(srna, "new", "rna_Main_lamps_new");
873 RNA_def_function_ui_description(func, "Add a new lamp to the main database");
874 parm = RNA_def_string(func, "name", "Lamp", 0, "", "New name for the datablock");
875 RNA_def_property_flag(parm, PROP_REQUIRED);
876 parm = RNA_def_enum(func, "type", lamp_type_items, 0, "Type", "The type of texture to add");
877 RNA_def_property_flag(parm, PROP_REQUIRED);
879 parm = RNA_def_pointer(func, "lamp", "Lamp", "", "New lamp datablock");
880 RNA_def_function_return(func, parm);
882 func = RNA_def_function(srna, "remove", "rna_Main_lamps_remove");
883 RNA_def_function_flag(func, FUNC_USE_REPORTS);
884 RNA_def_function_ui_description(func, "Remove a lamp from the current blendfile");
885 parm = RNA_def_pointer(func, "lamp", "Lamp", "", "Lamp to remove");
886 RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL);
888 func = RNA_def_function(srna, "tag", "rna_Main_lamps_tag");
889 parm = RNA_def_boolean(func, "value", 0, "Value", "");
890 RNA_def_property_flag(parm, PROP_REQUIRED);
892 prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
893 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
894 RNA_def_property_boolean_funcs(prop, "rna_Main_lamps_is_updated_get", NULL);
897 void RNA_def_main_libraries(BlenderRNA *brna, PropertyRNA *cprop)
904 RNA_def_property_srna(cprop, "BlendDataLibraries");
905 srna = RNA_def_struct(brna, "BlendDataLibraries", NULL);
906 RNA_def_struct_sdna(srna, "Main");
907 RNA_def_struct_ui_text(srna, "Main Libraries", "Collection of libraries");
909 func = RNA_def_function(srna, "tag", "rna_Main_libraries_tag");
910 parm = RNA_def_boolean(func, "value", 0, "Value", "");
911 RNA_def_property_flag(parm, PROP_REQUIRED);
913 prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
914 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
915 RNA_def_property_boolean_funcs(prop, "rna_Main_libraries_is_updated_get", NULL);
918 void RNA_def_main_screens(BlenderRNA *brna, PropertyRNA *cprop)
925 RNA_def_property_srna(cprop, "BlendDataScreens");
926 srna = RNA_def_struct(brna, "BlendDataScreens", NULL);
927 RNA_def_struct_sdna(srna, "Main");
928 RNA_def_struct_ui_text(srna, "Main Screens", "Collection of screens");
930 func = RNA_def_function(srna, "tag", "rna_Main_screens_tag");
931 parm = RNA_def_boolean(func, "value", 0, "Value", "");
932 RNA_def_property_flag(parm, PROP_REQUIRED);
934 prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
935 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
936 RNA_def_property_boolean_funcs(prop, "rna_Main_screens_is_updated_get", NULL);
939 void RNA_def_main_window_managers(BlenderRNA *brna, PropertyRNA *cprop)
946 RNA_def_property_srna(cprop, "BlendDataWindowManagers");
947 srna = RNA_def_struct(brna, "BlendDataWindowManagers", NULL);
948 RNA_def_struct_sdna(srna, "Main");
949 RNA_def_struct_ui_text(srna, "Main Window Managers", "Collection of window managers");
951 func = RNA_def_function(srna, "tag", "rna_Main_window_managers_tag");
952 parm = RNA_def_boolean(func, "value", 0, "Value", "");
953 RNA_def_property_flag(parm, PROP_REQUIRED);
955 prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
956 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
957 RNA_def_property_boolean_funcs(prop, "rna_Main_window_managers_is_updated_get", NULL);
959 void RNA_def_main_images(BlenderRNA *brna, PropertyRNA *cprop)
966 RNA_def_property_srna(cprop, "BlendDataImages");
967 srna = RNA_def_struct(brna, "BlendDataImages", NULL);
968 RNA_def_struct_sdna(srna, "Main");
969 RNA_def_struct_ui_text(srna, "Main Images", "Collection of images");
971 func = RNA_def_function(srna, "new", "rna_Main_images_new");
972 RNA_def_function_ui_description(func, "Add a new image to the main database");
973 parm = RNA_def_string(func, "name", "Image", 0, "", "New name for the datablock");
974 RNA_def_property_flag(parm, PROP_REQUIRED);
975 parm = RNA_def_int(func, "width", 1024, 1, INT_MAX, "", "Width of the image", 0, INT_MAX);
976 RNA_def_property_flag(parm, PROP_REQUIRED);
977 parm = RNA_def_int(func, "height", 1024, 1, INT_MAX, "", "Height of the image", 0, INT_MAX);
978 RNA_def_property_flag(parm, PROP_REQUIRED);
979 RNA_def_boolean(func, "alpha", 0, "Alpha", "Use alpha channel");
980 RNA_def_boolean(func, "float_buffer", 0, "Float Buffer", "Create an image with floating point color");
982 parm = RNA_def_pointer(func, "image", "Image", "", "New image datablock");
983 RNA_def_function_return(func, parm);
985 func = RNA_def_function(srna, "load", "rna_Main_images_load");
986 RNA_def_function_flag(func, FUNC_USE_REPORTS);
987 RNA_def_function_ui_description(func, "Load a new image into the main database");
988 parm = RNA_def_string_file_path(func, "filepath", "File Path", 0, "", "path of the file to load");
989 RNA_def_property_flag(parm, PROP_REQUIRED);
991 parm = RNA_def_pointer(func, "image", "Image", "", "New image datablock");
992 RNA_def_function_return(func, parm);
994 func = RNA_def_function(srna, "remove", "rna_Main_images_remove");
995 RNA_def_function_flag(func, FUNC_USE_REPORTS);
996 RNA_def_function_ui_description(func, "Remove an image from the current blendfile");
997 parm = RNA_def_pointer(func, "image", "Image", "", "Image to remove");
998 RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL);
1000 func = RNA_def_function(srna, "tag", "rna_Main_images_tag");
1001 parm = RNA_def_boolean(func, "value", 0, "Value", "");
1002 RNA_def_property_flag(parm, PROP_REQUIRED);
1004 prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
1005 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
1006 RNA_def_property_boolean_funcs(prop, "rna_Main_images_is_updated_get", NULL);
1009 void RNA_def_main_lattices(BlenderRNA *brna, PropertyRNA *cprop)
1016 RNA_def_property_srna(cprop, "BlendDataLattices");
1017 srna = RNA_def_struct(brna, "BlendDataLattices", NULL);
1018 RNA_def_struct_sdna(srna, "Main");
1019 RNA_def_struct_ui_text(srna, "Main Lattices", "Collection of lattices");
1021 func = RNA_def_function(srna, "new", "rna_Main_lattices_new");
1022 RNA_def_function_ui_description(func, "Add a new lattice to the main database");
1023 parm = RNA_def_string(func, "name", "Lattice", 0, "", "New name for the datablock");
1024 RNA_def_property_flag(parm, PROP_REQUIRED);
1026 parm = RNA_def_pointer(func, "lattice", "Lattice", "", "New lattices datablock");
1027 RNA_def_function_return(func, parm);
1029 func = RNA_def_function(srna, "remove", "rna_Main_lattices_remove");
1030 RNA_def_function_flag(func, FUNC_USE_REPORTS);
1031 RNA_def_function_ui_description(func, "Remove a lattice from the current blendfile");
1032 parm = RNA_def_pointer(func, "lattice", "Lattice", "", "Lattice to remove");
1033 RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL);
1035 func = RNA_def_function(srna, "tag", "rna_Main_lattices_tag");
1036 parm = RNA_def_boolean(func, "value", 0, "Value", "");
1037 RNA_def_property_flag(parm, PROP_REQUIRED);
1039 prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
1040 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
1041 RNA_def_property_boolean_funcs(prop, "rna_Main_lattices_is_updated_get", NULL);
1043 void RNA_def_main_curves(BlenderRNA *brna, PropertyRNA *cprop)
1050 RNA_def_property_srna(cprop, "BlendDataCurves");
1051 srna = RNA_def_struct(brna, "BlendDataCurves", NULL);
1052 RNA_def_struct_sdna(srna, "Main");
1053 RNA_def_struct_ui_text(srna, "Main Curves", "Collection of curves");
1055 func = RNA_def_function(srna, "new", "rna_Main_curves_new");
1056 RNA_def_function_ui_description(func, "Add a new curve to the main database");
1057 parm = RNA_def_string(func, "name", "Curve", 0, "", "New name for the datablock");
1058 RNA_def_property_flag(parm, PROP_REQUIRED);
1059 parm = RNA_def_enum(func, "type", object_type_curve_items, 0, "Type", "The type of curve to add");
1060 RNA_def_property_flag(parm, PROP_REQUIRED);
1062 parm = RNA_def_pointer(func, "curve", "Curve", "", "New curve datablock");
1063 RNA_def_function_return(func, parm);
1065 func = RNA_def_function(srna, "remove", "rna_Main_curves_remove");
1066 RNA_def_function_flag(func, FUNC_USE_REPORTS);
1067 RNA_def_function_ui_description(func, "Remove a curve from the current blendfile");
1068 parm = RNA_def_pointer(func, "curve", "Curve", "", "Curve to remove");
1069 RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL);
1071 func = RNA_def_function(srna, "tag", "rna_Main_curves_tag");
1072 parm = RNA_def_boolean(func, "value", 0, "Value", "");
1073 RNA_def_property_flag(parm, PROP_REQUIRED);
1075 prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
1076 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
1077 RNA_def_property_boolean_funcs(prop, "rna_Main_curves_is_updated_get", NULL);
1079 void RNA_def_main_metaballs(BlenderRNA *brna, PropertyRNA *cprop)
1086 RNA_def_property_srna(cprop, "BlendDataMetaBalls");
1087 srna = RNA_def_struct(brna, "BlendDataMetaBalls", NULL);
1088 RNA_def_struct_sdna(srna, "Main");
1089 RNA_def_struct_ui_text(srna, "Main Metaballs", "Collection of metaballs");
1091 func = RNA_def_function(srna, "new", "rna_Main_metaballs_new");
1092 RNA_def_function_ui_description(func, "Add a new metaball to the main database");
1093 parm = RNA_def_string(func, "name", "MetaBall", 0, "", "New name for the datablock");
1094 RNA_def_property_flag(parm, PROP_REQUIRED);
1096 parm = RNA_def_pointer(func, "metaball", "MetaBall", "", "New metaball datablock");
1097 RNA_def_function_return(func, parm);
1099 func = RNA_def_function(srna, "remove", "rna_Main_metaballs_remove");
1100 RNA_def_function_flag(func, FUNC_USE_REPORTS);
1101 RNA_def_function_ui_description(func, "Remove a metaball from the current blendfile");
1102 parm = RNA_def_pointer(func, "metaball", "MetaBall", "", "Metaball to remove");
1103 RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL);
1105 func = RNA_def_function(srna, "tag", "rna_Main_metaballs_tag");
1106 parm = RNA_def_boolean(func, "value", 0, "Value", "");
1107 RNA_def_property_flag(parm, PROP_REQUIRED);
1109 prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
1110 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
1111 RNA_def_property_boolean_funcs(prop, "rna_Main_metaballs_is_updated_get", NULL);
1113 void RNA_def_main_fonts(BlenderRNA *brna, PropertyRNA *cprop)
1120 RNA_def_property_srna(cprop, "BlendDataFonts");
1121 srna = RNA_def_struct(brna, "BlendDataFonts", NULL);
1122 RNA_def_struct_sdna(srna, "Main");
1123 RNA_def_struct_ui_text(srna, "Main Fonts", "Collection of fonts");
1125 func = RNA_def_function(srna, "load", "rna_Main_fonts_load");
1126 RNA_def_function_flag(func, FUNC_USE_REPORTS);
1127 RNA_def_function_ui_description(func, "Load a new font into the main database");
1128 parm = RNA_def_string_file_path(func, "filepath", "File Path", 0, "", "path of the font to load");
1129 RNA_def_property_flag(parm, PROP_REQUIRED);
1131 parm = RNA_def_pointer(func, "vfont", "VectorFont", "", "New font datablock");
1132 RNA_def_function_return(func, parm);
1134 func = RNA_def_function(srna, "remove", "rna_Main_fonts_remove");
1135 RNA_def_function_flag(func, FUNC_USE_REPORTS);
1136 RNA_def_function_ui_description(func, "Remove a font from the current blendfile");
1137 parm = RNA_def_pointer(func, "vfont", "VectorFont", "", "Font to remove");
1138 RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL);
1140 func = RNA_def_function(srna, "tag", "rna_Main_fonts_tag");
1141 parm = RNA_def_boolean(func, "value", 0, "Value", "");
1142 RNA_def_property_flag(parm, PROP_REQUIRED);
1144 prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
1145 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
1146 RNA_def_property_boolean_funcs(prop, "rna_Main_fonts_is_updated_get", NULL);
1148 void RNA_def_main_textures(BlenderRNA *brna, PropertyRNA *cprop)
1155 RNA_def_property_srna(cprop, "BlendDataTextures");
1156 srna = RNA_def_struct(brna, "BlendDataTextures", NULL);
1157 RNA_def_struct_sdna(srna, "Main");
1158 RNA_def_struct_ui_text(srna, "Main Textures", "Collection of groups");
1160 func = RNA_def_function(srna, "new", "rna_Main_textures_new");
1161 RNA_def_function_ui_description(func, "Add a new texture to the main database");
1162 parm = RNA_def_string(func, "name", "Texture", 0, "", "New name for the datablock");
1163 RNA_def_property_flag(parm, PROP_REQUIRED);
1164 parm = RNA_def_enum(func, "type", texture_type_items, 0, "Type", "The type of texture to add");
1165 RNA_def_property_flag(parm, PROP_REQUIRED);
1167 parm = RNA_def_pointer(func, "texture", "Texture", "", "New texture datablock");
1168 RNA_def_function_return(func, parm);
1170 func = RNA_def_function(srna, "remove", "rna_Main_textures_remove");
1171 RNA_def_function_flag(func, FUNC_USE_REPORTS);
1172 RNA_def_function_ui_description(func, "Remove a texture from the current blendfile");
1173 parm = RNA_def_pointer(func, "texture", "Texture", "", "Texture to remove");
1174 RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL);
1176 func = RNA_def_function(srna, "tag", "rna_Main_textures_tag");
1177 parm = RNA_def_boolean(func, "value", 0, "Value", "");
1178 RNA_def_property_flag(parm, PROP_REQUIRED);
1180 prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
1181 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
1182 RNA_def_property_boolean_funcs(prop, "rna_Main_textures_is_updated_get", NULL);
1184 void RNA_def_main_brushes(BlenderRNA *brna, PropertyRNA *cprop)
1191 RNA_def_property_srna(cprop, "BlendDataBrushes");
1192 srna = RNA_def_struct(brna, "BlendDataBrushes", NULL);
1193 RNA_def_struct_sdna(srna, "Main");
1194 RNA_def_struct_ui_text(srna, "Main Brushes", "Collection of brushes");
1196 func = RNA_def_function(srna, "new", "rna_Main_brushes_new");
1197 RNA_def_function_ui_description(func, "Add a new brush to the main database");
1198 parm = RNA_def_string(func, "name", "Brush", 0, "", "New name for the datablock");
1199 RNA_def_property_flag(parm, PROP_REQUIRED);
1201 parm = RNA_def_pointer(func, "brush", "Brush", "", "New brush datablock");
1202 RNA_def_function_return(func, parm);
1204 func = RNA_def_function(srna, "remove", "rna_Main_brushes_remove");
1205 RNA_def_function_flag(func, FUNC_USE_REPORTS);
1206 RNA_def_function_ui_description(func, "Remove a brush from the current blendfile");
1207 parm = RNA_def_pointer(func, "brush", "Brush", "", "Brush to remove");
1208 RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL);
1210 func = RNA_def_function(srna, "tag", "rna_Main_brushes_tag");
1211 parm = RNA_def_boolean(func, "value", 0, "Value", "");
1212 RNA_def_property_flag(parm, PROP_REQUIRED);
1214 prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
1215 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
1216 RNA_def_property_boolean_funcs(prop, "rna_Main_brushes_is_updated_get", NULL);
1219 void RNA_def_main_worlds(BlenderRNA *brna, PropertyRNA *cprop)
1226 RNA_def_property_srna(cprop, "BlendDataWorlds");
1227 srna = RNA_def_struct(brna, "BlendDataWorlds", NULL);
1228 RNA_def_struct_sdna(srna, "Main");
1229 RNA_def_struct_ui_text(srna, "Main Worlds", "Collection of worlds");
1231 func = RNA_def_function(srna, "new", "rna_Main_worlds_new");
1232 RNA_def_function_ui_description(func, "Add a new world to the main database");
1233 parm = RNA_def_string(func, "name", "World", 0, "", "New name for the datablock");
1234 RNA_def_property_flag(parm, PROP_REQUIRED);
1236 parm = RNA_def_pointer(func, "world", "World", "", "New world datablock");
1237 RNA_def_function_return(func, parm);
1239 func = RNA_def_function(srna, "remove", "rna_Main_worlds_remove");
1240 RNA_def_function_flag(func, FUNC_USE_REPORTS);
1241 RNA_def_function_ui_description(func, "Remove a world from the current blendfile");
1242 parm = RNA_def_pointer(func, "world", "World", "", "World to remove");
1243 RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL);
1245 func = RNA_def_function(srna, "tag", "rna_Main_worlds_tag");
1246 parm = RNA_def_boolean(func, "value", 0, "Value", "");
1247 RNA_def_property_flag(parm, PROP_REQUIRED);
1249 prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
1250 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
1251 RNA_def_property_boolean_funcs(prop, "rna_Main_worlds_is_updated_get", NULL);
1254 void RNA_def_main_groups(BlenderRNA *brna, PropertyRNA *cprop)
1261 RNA_def_property_srna(cprop, "BlendDataGroups");
1262 srna = RNA_def_struct(brna, "BlendDataGroups", NULL);
1263 RNA_def_struct_sdna(srna, "Main");
1264 RNA_def_struct_ui_text(srna, "Main Groups", "Collection of groups");
1266 func = RNA_def_function(srna, "new", "rna_Main_groups_new");
1267 RNA_def_function_ui_description(func, "Add a new group to the main database");
1268 parm = RNA_def_string(func, "name", "Group", 0, "", "New name for the datablock");
1269 RNA_def_property_flag(parm, PROP_REQUIRED);
1271 parm = RNA_def_pointer(func, "group", "Group", "", "New group datablock");
1272 RNA_def_function_return(func, parm);
1274 func = RNA_def_function(srna, "remove", "rna_Main_groups_remove");
1275 RNA_def_function_ui_description(func, "Remove a group from the current blendfile");
1276 parm = RNA_def_pointer(func, "group", "Group", "", "Group to remove");
1277 RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL);
1279 func = RNA_def_function(srna, "tag", "rna_Main_groups_tag");
1280 parm = RNA_def_boolean(func, "value", 0, "Value", "");
1281 RNA_def_property_flag(parm, PROP_REQUIRED);
1283 prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
1284 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
1285 RNA_def_property_boolean_funcs(prop, "rna_Main_groups_is_updated_get", NULL);
1288 void RNA_def_main_speakers(BlenderRNA *brna, PropertyRNA *cprop)
1295 RNA_def_property_srna(cprop, "BlendDataSpeakers");
1296 srna = RNA_def_struct(brna, "BlendDataSpeakers", NULL);
1297 RNA_def_struct_sdna(srna, "Main");
1298 RNA_def_struct_ui_text(srna, "Main Speakers", "Collection of speakers");
1300 func = RNA_def_function(srna, "new", "rna_Main_speakers_new");
1301 RNA_def_function_ui_description(func, "Add a new speaker to the main database");
1302 parm = RNA_def_string(func, "name", "Speaker", 0, "", "New name for the datablock");
1303 RNA_def_property_flag(parm, PROP_REQUIRED);
1305 parm = RNA_def_pointer(func, "speaker", "Speaker", "", "New speaker datablock");
1306 RNA_def_function_return(func, parm);
1308 func = RNA_def_function(srna, "remove", "rna_Main_speakers_remove");
1309 RNA_def_function_flag(func, FUNC_USE_REPORTS);
1310 RNA_def_function_ui_description(func, "Remove a speaker from the current blendfile");
1311 parm = RNA_def_pointer(func, "speaker", "Speaker", "", "Speaker to remove");
1312 RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL);
1314 func = RNA_def_function(srna, "tag", "rna_Main_speakers_tag");
1315 parm = RNA_def_boolean(func, "value", 0, "Value", "");
1316 RNA_def_property_flag(parm, PROP_REQUIRED);
1318 prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
1319 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
1320 RNA_def_property_boolean_funcs(prop, "rna_Main_speakers_is_updated_get", NULL);
1323 void RNA_def_main_texts(BlenderRNA *brna, PropertyRNA *cprop)
1330 RNA_def_property_srna(cprop, "BlendDataTexts");
1331 srna = RNA_def_struct(brna, "BlendDataTexts", NULL);
1332 RNA_def_struct_sdna(srna, "Main");
1333 RNA_def_struct_ui_text(srna, "Main Texts", "Collection of texts");
1335 func = RNA_def_function(srna, "new", "rna_Main_texts_new");
1336 RNA_def_function_ui_description(func, "Add a new text to the main database");
1337 parm = RNA_def_string(func, "name", "Text", 0, "", "New name for the datablock");
1338 RNA_def_property_flag(parm, PROP_REQUIRED);
1340 parm = RNA_def_pointer(func, "text", "Text", "", "New text datablock");
1341 RNA_def_function_return(func, parm);
1343 func = RNA_def_function(srna, "remove", "rna_Main_texts_remove");
1344 RNA_def_function_ui_description(func, "Remove a text from the current blendfile");
1345 parm = RNA_def_pointer(func, "text", "Text", "", "Text to remove");
1346 RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL);
1349 func = RNA_def_function(srna, "load", "rna_Main_texts_load");
1350 RNA_def_function_flag(func, FUNC_USE_REPORTS);
1351 RNA_def_function_ui_description(func, "Add a new text to the main database from a file");
1352 parm = RNA_def_string_file_path(func, "filepath", "Path", FILE_MAX, "", "path for the datablock");
1353 RNA_def_property_flag(parm, PROP_REQUIRED);
1355 parm = RNA_def_pointer(func, "text", "Text", "", "New text datablock");
1356 RNA_def_function_return(func, parm);
1358 func = RNA_def_function(srna, "tag", "rna_Main_texts_tag");
1359 parm = RNA_def_boolean(func, "value", 0, "Value", "");
1360 RNA_def_property_flag(parm, PROP_REQUIRED);
1362 prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
1363 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
1364 RNA_def_property_boolean_funcs(prop, "rna_Main_texts_is_updated_get", NULL);
1367 void RNA_def_main_sounds(BlenderRNA *brna, PropertyRNA *cprop)
1374 RNA_def_property_srna(cprop, "BlendDataSounds");
1375 srna = RNA_def_struct(brna, "BlendDataSounds", NULL);
1376 RNA_def_struct_sdna(srna, "Main");
1377 RNA_def_struct_ui_text(srna, "Main Sounds", "Collection of sounds");
1381 func = RNA_def_function(srna, "tag", "rna_Main_sounds_tag");
1382 parm = RNA_def_boolean(func, "value", 0, "Value", "");
1383 RNA_def_property_flag(parm, PROP_REQUIRED);
1385 prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
1386 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
1387 RNA_def_property_boolean_funcs(prop, "rna_Main_sounds_is_updated_get", NULL);
1390 void RNA_def_main_armatures(BlenderRNA *brna, PropertyRNA *cprop)
1397 RNA_def_property_srna(cprop, "BlendDataArmatures");
1398 srna = RNA_def_struct(brna, "BlendDataArmatures", NULL);
1399 RNA_def_struct_sdna(srna, "Main");
1400 RNA_def_struct_ui_text(srna, "Main Armatures", "Collection of armatures");
1402 func = RNA_def_function(srna, "new", "rna_Main_armatures_new");
1403 RNA_def_function_ui_description(func, "Add a new armature to the main database");
1404 parm = RNA_def_string(func, "name", "Armature", 0, "", "New name for the datablock");
1405 RNA_def_property_flag(parm, PROP_REQUIRED);
1407 parm = RNA_def_pointer(func, "armature", "Armature", "", "New armature datablock");
1408 RNA_def_function_return(func, parm);
1410 func = RNA_def_function(srna, "remove", "rna_Main_armatures_remove");
1411 RNA_def_function_flag(func, FUNC_USE_REPORTS);
1412 RNA_def_function_ui_description(func, "Remove a armature from the current blendfile");
1413 parm = RNA_def_pointer(func, "armature", "Armature", "", "Armature to remove");
1414 RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL);
1416 func = RNA_def_function(srna, "tag", "rna_Main_armatures_tag");
1417 parm = RNA_def_boolean(func, "value", 0, "Value", "");
1418 RNA_def_property_flag(parm, PROP_REQUIRED);
1420 prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
1421 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
1422 RNA_def_property_boolean_funcs(prop, "rna_Main_armatures_is_updated_get", NULL);
1424 void RNA_def_main_actions(BlenderRNA *brna, PropertyRNA *cprop)
1431 RNA_def_property_srna(cprop, "BlendDataActions");
1432 srna = RNA_def_struct(brna, "BlendDataActions", NULL);
1433 RNA_def_struct_sdna(srna, "Main");
1434 RNA_def_struct_ui_text(srna, "Main Actions", "Collection of actions");
1436 func = RNA_def_function(srna, "new", "rna_Main_actions_new");
1437 RNA_def_function_ui_description(func, "Add a new action to the main database");
1438 parm = RNA_def_string(func, "name", "Action", 0, "", "New name for the datablock");
1439 RNA_def_property_flag(parm, PROP_REQUIRED);
1441 parm = RNA_def_pointer(func, "action", "Action", "", "New action datablock");
1442 RNA_def_function_return(func, parm);
1444 func = RNA_def_function(srna, "remove", "rna_Main_actions_remove");
1445 RNA_def_function_flag(func, FUNC_USE_REPORTS);
1446 RNA_def_function_ui_description(func, "Remove a action from the current blendfile");
1447 parm = RNA_def_pointer(func, "action", "Action", "", "Action to remove");
1448 RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL);
1450 func = RNA_def_function(srna, "tag", "rna_Main_actions_tag");
1451 parm = RNA_def_boolean(func, "value", 0, "Value", "");
1452 RNA_def_property_flag(parm, PROP_REQUIRED);
1454 prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
1455 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
1456 RNA_def_property_boolean_funcs(prop, "rna_Main_actions_is_updated_get", NULL);
1458 void RNA_def_main_particles(BlenderRNA *brna, PropertyRNA *cprop)
1465 RNA_def_property_srna(cprop, "BlendDataParticles");
1466 srna = RNA_def_struct(brna, "BlendDataParticles", NULL);
1467 RNA_def_struct_sdna(srna, "Main");
1468 RNA_def_struct_ui_text(srna, "Main Particle Settings", "Collection of particle settings");
1470 func = RNA_def_function(srna, "new", "rna_Main_particles_new");
1471 RNA_def_function_ui_description(func, "Add a new particle settings instance to the main database");
1472 parm = RNA_def_string(func, "name", "ParticleSettings", 0, "", "New name for the datablock");
1473 RNA_def_property_flag(parm, PROP_REQUIRED);
1475 parm = RNA_def_pointer(func, "particle", "ParticleSettings", "", "New particle settings datablock");
1476 RNA_def_function_return(func, parm);
1478 func = RNA_def_function(srna, "remove", "rna_Main_particles_remove");
1479 RNA_def_function_flag(func, FUNC_USE_REPORTS);
1480 RNA_def_function_ui_description(func, "Remove a particle settings instance from the current blendfile");
1481 parm = RNA_def_pointer(func, "particle", "ParticleSettings", "", "Particle Settings to remove");
1482 RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL);
1484 func = RNA_def_function(srna, "tag", "rna_Main_particles_tag");
1485 parm = RNA_def_boolean(func, "value", 0, "Value", "");
1486 RNA_def_property_flag(parm, PROP_REQUIRED);
1488 prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
1489 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
1490 RNA_def_property_boolean_funcs(prop, "rna_Main_particles_is_updated_get", NULL);
1493 void RNA_def_main_gpencil(BlenderRNA *brna, PropertyRNA *cprop)
1500 RNA_def_property_srna(cprop, "BlendDataGreasePencils");
1501 srna = RNA_def_struct(brna, "BlendDataGreasePencils", NULL);
1502 RNA_def_struct_sdna(srna, "Main");
1503 RNA_def_struct_ui_text(srna, "Main Grease Pencils", "Collection of grease pencils");
1505 func = RNA_def_function(srna, "tag", "rna_Main_gpencil_tag");
1506 parm = RNA_def_boolean(func, "value", 0, "Value", "");
1507 RNA_def_property_flag(parm, PROP_REQUIRED);
1509 prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
1510 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
1511 RNA_def_property_boolean_funcs(prop, "rna_Main_gpencil_is_updated_get", NULL);
1514 void RNA_def_main_movieclips(BlenderRNA *brna, PropertyRNA *cprop)
1520 RNA_def_property_srna(cprop, "BlendDataMovieClips");
1521 srna = RNA_def_struct(brna, "BlendDataMovieClips", NULL);
1522 RNA_def_struct_sdna(srna, "Main");
1523 RNA_def_struct_ui_text(srna, "Main Movie Clips", "Collection of movie clips");
1525 func = RNA_def_function(srna, "tag", "rna_Main_movieclips_tag");
1526 parm = RNA_def_boolean(func, "value", 0, "Value", "");
1527 RNA_def_property_flag(parm, PROP_REQUIRED);
1529 func = RNA_def_function(srna, "remove", "rna_Main_movieclips_remove");
1530 RNA_def_function_ui_description(func, "Remove a movie clip from the current blendfile.");
1531 parm = RNA_def_pointer(func, "clip", "MovieClip", "", "Movie clip to remove");
1532 RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL);
1535 func = RNA_def_function(srna, "load", "rna_Main_movieclip_load");
1536 RNA_def_function_flag(func, FUNC_USE_REPORTS);
1537 RNA_def_function_ui_description(func, "Add a new movie clip to the main database from a file");
1538 parm = RNA_def_string_file_path(func, "filepath", "Path", FILE_MAX, "", "path for the datablock");
1539 RNA_def_property_flag(parm, PROP_REQUIRED);
1541 parm = RNA_def_pointer(func, "clip", "MovieClip", "", "New movie clip datablock");
1542 RNA_def_function_return(func, parm);
1545 void RNA_def_main_masks(BlenderRNA *brna, PropertyRNA *cprop)
1551 RNA_def_property_srna(cprop, "BlendDataMasks");
1552 srna = RNA_def_struct(brna, "BlendDataMasks", NULL);
1553 RNA_def_struct_sdna(srna, "Main");
1554 RNA_def_struct_ui_text(srna, "Main Masks", "Collection of masks");
1556 func = RNA_def_function(srna, "tag", "rna_Main_masks_tag");
1557 parm = RNA_def_boolean(func, "value", 0, "Value", "");
1558 RNA_def_property_flag(parm, PROP_REQUIRED);
1561 func = RNA_def_function(srna, "new", "rna_Main_mask_new");
1562 RNA_def_function_ui_description(func, "Add a new mask with a given name to the main database");
1563 parm = RNA_def_string_file_path(func, "name", "", MAX_ID_NAME - 2, "Mask", "Name of new mask datablock");
1565 parm = RNA_def_pointer(func, "mask", "Mask", "", "New mask datablock");
1566 RNA_def_function_return(func, parm);
1569 func = RNA_def_function(srna, "remove", "rna_Main_masks_remove");
1570 RNA_def_function_ui_description(func, "Remove a masks from the current blendfile.");
1571 parm = RNA_def_pointer(func, "mask", "Mask", "", "Mask to remove");
1572 RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL);