4 * ***** BEGIN GPL LICENSE BLOCK *****
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software Foundation,
18 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 * The Original Code is Copyright (C) 2009 Blender Foundation.
21 * All rights reserved.
24 * Contributor(s): Blender Foundation
26 * ***** END GPL LICENSE BLOCK *****
33 #include "RNA_define.h"
34 #include "RNA_access.h"
35 #include "RNA_enum_types.h"
37 #include "BKE_utildefines.h"
42 #include "BKE_curve.h"
44 #include "BKE_armature.h"
45 #include "BKE_library.h"
46 #include "BKE_object.h"
47 #include "BKE_material.h"
48 #include "BKE_image.h"
49 #include "BKE_texture.h"
50 #include "BKE_scene.h"
52 #include "BKE_action.h"
53 #include "BKE_group.h"
54 #include "BKE_brush.h"
55 #include "BKE_lattice.h"
56 #include "BKE_mball.h"
57 #include "BKE_world.h"
58 #include "BKE_particle.h"
62 #include "DNA_armature_types.h"
63 #include "DNA_camera_types.h"
64 #include "DNA_curve_types.h"
65 #include "DNA_lamp_types.h"
66 #include "DNA_material_types.h"
67 #include "DNA_mesh_types.h"
68 #include "DNA_object_types.h"
69 #include "DNA_text_types.h"
70 #include "DNA_texture_types.h"
71 #include "DNA_group_types.h"
72 #include "DNA_brush_types.h"
73 #include "DNA_lattice_types.h"
74 #include "DNA_meta_types.h"
75 #include "DNA_world_types.h"
76 #include "DNA_particle_types.h"
77 #include "DNA_vfont_types.h"
78 #include "DNA_node_types.h"
80 #include "ED_screen.h"
82 Tex *rna_Main_add_texture(Main *bmain, char *name)
84 return add_texture(name);
87 Camera *rna_Main_cameras_new(Main *bmain, char* name)
89 ID *id= add_camera(name);
93 void rna_Main_cameras_remove(Main *bmain, ReportList *reports, struct Camera *camera)
95 if(ID_REAL_USERS(camera) <= 0)
96 free_libblock(&bmain->camera, camera);
98 BKE_reportf(reports, RPT_ERROR, "Camera \"%s\" must have zero users to be removed, found %d.", camera->id.name+2, ID_REAL_USERS(camera));
100 /* XXX python now has invalid pointer? */
103 Scene *rna_Main_scenes_new(Main *bmain, char* name)
105 return add_scene(name);
107 void rna_Main_scenes_remove(Main *bmain, bContext *C, ReportList *reports, struct Scene *scene)
109 /* dont call free_libblock(...) directly */
113 newscene= scene->id.prev;
114 else if(scene->id.next)
115 newscene= scene->id.next;
117 BKE_reportf(reports, RPT_ERROR, "Scene \"%s\" is the last, cant ve removed.", scene->id.name+2);
121 ED_screen_set_scene(C, newscene);
123 unlink_scene(bmain, scene, newscene);
126 Object *rna_Main_objects_new(Main *bmain, ReportList *reports, char* name, ID *data)
131 switch(GS(data->name)) {
136 type= curve_type((struct Curve *)data);
156 if(RNA_enum_id_from_value(id_type_items, GS(data->name), &idname) == 0)
159 BKE_reportf(reports, RPT_ERROR, "ID type '%s' is not valid for a object.", idname);
167 ob= add_only_object(type, name);
171 test_object_materials(ob->data);
176 void rna_Main_objects_remove(Main *bmain, ReportList *reports, struct Object *object)
178 if(ID_REAL_USERS(object) <= 0) {
179 unlink_object(object); /* needed or ID pointers to this are not cleared */
180 free_libblock(&bmain->object, object);
183 BKE_reportf(reports, RPT_ERROR, "Object \"%s\" must have zero users to be removed, found %d.", object->id.name+2, ID_REAL_USERS(object));
187 struct Material *rna_Main_materials_new(Main *bmain, char* name)
189 ID *id= (ID *)add_material(name);
191 return (Material *)id;
193 void rna_Main_materials_remove(Main *bmain, ReportList *reports, struct Material *material)
195 if(ID_REAL_USERS(material) <= 0)
196 free_libblock(&bmain->mat, material);
198 BKE_reportf(reports, RPT_ERROR, "Material \"%s\" must have zero users to be removed, found %d.", material->id.name+2, ID_REAL_USERS(material));
200 /* XXX python now has invalid pointer? */
203 // XXX, commended for now, need to see how this can be used with node groups.
204 struct bNodeTree *rna_Main_nodetree_new(Main *bmain, int type)
206 bNodeTree *tree = ntreeAddTree(type);
210 void rna_Main_nodetree_remove(Main *bmain, ReportList *reports, struct bNodeTree *tree)
212 if(ID_REAL_USERS(tree) <= 0)
213 free_libblock(&bmain->nodetree, tree);
215 BKE_reportf(reports, RPT_ERROR, "Node Tree \"%s\" must have zero users to be removed, found %d.", tree->id.name+2, ID_REAL_USERS(tree));
217 /* XXX python now has invalid pointer? */
220 Mesh *rna_Main_meshes_new(Main *bmain, char* name)
222 Mesh *me= add_mesh(name);
226 void rna_Main_meshes_remove(Main *bmain, ReportList *reports, Mesh *mesh)
228 if(ID_REAL_USERS(mesh) <= 0)
229 free_libblock(&bmain->mesh, mesh);
231 BKE_reportf(reports, RPT_ERROR, "Mesh \"%s\" must have zero users to be removed, found %d.", mesh->id.name+2, ID_REAL_USERS(mesh));
233 /* XXX python now has invalid pointer? */
236 Lamp *rna_Main_lamps_new(Main *bmain, char* name)
238 Lamp *lamp= add_lamp(name);
242 void rna_Main_lamps_remove(Main *bmain, ReportList *reports, Lamp *lamp)
244 if(ID_REAL_USERS(lamp) <= 0)
245 free_libblock(&bmain->lamp, lamp);
247 BKE_reportf(reports, RPT_ERROR, "Lamp \"%s\" must have zero users to be removed, found %d.", lamp->id.name+2, ID_REAL_USERS(lamp));
249 /* XXX python now has invalid pointer? */
252 Image *rna_Main_images_new(Main *bmain, char* name, int width, int height, int alpha, int float_buffer)
254 float color[4]= {0.0, 0.0, 0.0, 1.0};
255 Image *image= BKE_add_image_size(width, height, name, alpha ? 32:24, float_buffer, 0, color);
259 Image *rna_Main_images_load(Main *bmain, ReportList *reports, char *filepath)
264 ima= BKE_add_image_file(filepath);
267 BKE_reportf(reports, RPT_ERROR, "Can't read: \"%s\", %s.", filepath, errno ? strerror(errno) : "Unsupported image format");
271 void rna_Main_images_remove(Main *bmain, ReportList *reports, Image *image)
273 if(ID_REAL_USERS(image) <= 0)
274 free_libblock(&bmain->image, image);
276 BKE_reportf(reports, RPT_ERROR, "Image \"%s\" must have zero users to be removed, found %d.", image->id.name+2, ID_REAL_USERS(image));
278 /* XXX python now has invalid pointer? */
281 Lattice *rna_Main_lattices_new(Main *bmain, char* name)
283 Lattice *lt= add_lattice(name);
287 void rna_Main_lattices_remove(Main *bmain, ReportList *reports, struct Lattice *lt)
289 if(ID_REAL_USERS(lt) <= 0)
290 free_libblock(&bmain->latt, lt);
292 BKE_reportf(reports, RPT_ERROR, "Lattice \"%s\" must have zero users to be removed, found %d.", lt->id.name+2, ID_REAL_USERS(lt));
295 Curve *rna_Main_curves_new(Main *bmain, char* name, int type)
297 Curve *cu= add_curve(name, type);
301 void rna_Main_curves_remove(Main *bmain, ReportList *reports, struct Curve *cu)
303 if(ID_REAL_USERS(cu) <= 0)
304 free_libblock(&bmain->curve, cu);
306 BKE_reportf(reports, RPT_ERROR, "Curve \"%s\" must have zero users to be removed, found %d.", cu->id.name+2, ID_REAL_USERS(cu));
309 MetaBall *rna_Main_metaballs_new(Main *bmain, char* name)
311 MetaBall *mb= add_mball(name);
315 void rna_Main_metaballs_remove(Main *bmain, ReportList *reports, struct MetaBall *mb)
317 if(ID_REAL_USERS(mb) <= 0)
318 free_libblock(&bmain->mball, mb);
320 BKE_reportf(reports, RPT_ERROR, "MetaBall \"%s\" must have zero users to be removed, found %d.", mb->id.name+2, ID_REAL_USERS(mb));
323 VFont *rna_Main_fonts_load(Main *bmain, ReportList *reports, char *filepath)
328 font= load_vfont(filepath);
331 BKE_reportf(reports, RPT_ERROR, "Can't read: \"%s\", %s.", filepath, errno ? strerror(errno) : "Unsupported font format");
336 void rna_Main_fonts_remove(Main *bmain, ReportList *reports, VFont *vfont)
338 if(ID_REAL_USERS(vfont) <= 0)
339 free_libblock(&bmain->vfont, vfont);
341 BKE_reportf(reports, RPT_ERROR, "Font \"%s\" must have zero users to be removed, found %d.", vfont->id.name+2, ID_REAL_USERS(vfont));
343 /* XXX python now has invalid pointer? */
346 Tex *rna_Main_textures_new(Main *bmain, char* name, int type)
348 Tex *tex= add_texture(name);
349 tex_set_type(tex, type);
353 void rna_Main_textures_remove(Main *bmain, ReportList *reports, struct Tex *tex)
355 if(ID_REAL_USERS(tex) <= 0)
356 free_libblock(&bmain->tex, tex);
358 BKE_reportf(reports, RPT_ERROR, "Texture \"%s\" must have zero users to be removed, found %d.", tex->id.name+2, ID_REAL_USERS(tex));
361 Brush *rna_Main_brushes_new(Main *bmain, char* name)
363 Brush *brush = add_brush(name);
367 void rna_Main_brushes_remove(Main *bmain, ReportList *reports, struct Brush *brush)
369 if(ID_REAL_USERS(brush) <= 0)
370 free_libblock(&bmain->brush, brush);
372 BKE_reportf(reports, RPT_ERROR, "Brush \"%s\" must have zero users to be removed, found %d.", brush->id.name+2, ID_REAL_USERS(brush));
375 World *rna_Main_worlds_new(Main *bmain, char* name)
377 World *world = add_world(name);
381 void rna_Main_worlds_remove(Main *bmain, ReportList *reports, struct World *world)
383 if(ID_REAL_USERS(world) <= 0)
384 free_libblock(&bmain->world, world);
386 BKE_reportf(reports, RPT_ERROR, "World \"%s\" must have zero users to be removed, found %d.", world->id.name+2, ID_REAL_USERS(world));
389 Group *rna_Main_groups_new(Main *bmain, char* name)
391 return add_group(name);
393 void rna_Main_groups_remove(Main *bmain, ReportList *reports, Group *group)
396 free_libblock(&bmain->group, group);
397 /* XXX python now has invalid pointer? */
400 Text *rna_Main_texts_new(Main *bmain, char* name)
402 return add_empty_text(name);
404 void rna_Main_texts_remove(Main *bmain, ReportList *reports, Text *text)
406 unlink_text(bmain, text);
407 free_libblock(&bmain->text, text);
408 /* XXX python now has invalid pointer? */
411 Text *rna_Main_texts_load(Main *bmain, ReportList *reports, char* filepath)
416 txt= add_text(filepath, bmain->name);
419 BKE_reportf(reports, RPT_ERROR, "Can't read: \"%s\", %s.", filepath, errno ? strerror(errno) : "Unable to load text");
424 bArmature *rna_Main_armatures_new(Main *bmain, char* name)
426 bArmature *arm= add_armature(name);
430 void rna_Main_armatures_remove(Main *bmain, ReportList *reports, bArmature *arm)
432 if(ID_REAL_USERS(arm) <= 0)
433 free_libblock(&bmain->armature, arm);
435 BKE_reportf(reports, RPT_ERROR, "Armature \"%s\" must have zero users to be removed, found %d.", arm->id.name+2, ID_REAL_USERS(arm));
437 /* XXX python now has invalid pointer? */
440 bAction *rna_Main_actions_new(Main *bmain, char* name)
442 bAction *act= add_empty_action(name);
444 act->id.flag &= ~LIB_FAKEUSER;
447 void rna_Main_actions_remove(Main *bmain, ReportList *reports, bAction *act)
449 if(ID_REAL_USERS(act) <= 0)
450 free_libblock(&bmain->action, act);
452 BKE_reportf(reports, RPT_ERROR, "Action \"%s\" must have zero users to be removed, found %d.", act->id.name+2, ID_REAL_USERS(act));
454 /* XXX python now has invalid pointer? */
457 ParticleSettings *rna_Main_particles_new(Main *bmain, char* name)
459 ParticleSettings *part = psys_new_settings(name, bmain);
463 void rna_Main_particles_remove(Main *bmain, ReportList *reports, ParticleSettings *part)
465 if(ID_REAL_USERS(part) <= 0)
466 free_libblock(&bmain->particle, part);
468 BKE_reportf(reports, RPT_ERROR, "Particle Settings \"%s\" must have zero users to be removed, found %d.", part->id.name+2, ID_REAL_USERS(part));
470 /* XXX python now has invalid pointer? */
475 void RNA_api_main(StructRNA *srna)
481 /* maybe we want to add functions in 'bpy.data' still?
482 * for now they are all in collections bpy.data.images.new(...) */
484 func= RNA_def_function(srna, "add_image", "rna_Main_add_image");
485 RNA_def_function_ui_description(func, "Add a new image.");
486 parm= RNA_def_string(func, "filepath", "", 0, "", "File path to load image from.");
487 RNA_def_property_flag(parm, PROP_REQUIRED);
488 parm= RNA_def_pointer(func, "image", "Image", "", "New image.");
489 RNA_def_function_return(func, parm);
494 void RNA_def_main_cameras(BlenderRNA *brna, PropertyRNA *cprop)
500 RNA_def_property_srna(cprop, "MainCameras");
501 srna= RNA_def_struct(brna, "MainCameras", NULL);
502 RNA_def_struct_ui_text(srna, "Main Cameras", "Collection of cameras");
504 func= RNA_def_function(srna, "new", "rna_Main_cameras_new");
505 RNA_def_function_ui_description(func, "Add a new camera to the main database");
506 parm= RNA_def_string(func, "name", "Camera", 0, "", "New name for the datablock.");
507 RNA_def_property_flag(parm, PROP_REQUIRED);
509 parm= RNA_def_pointer(func, "camera", "Camera", "", "New camera datablock.");
510 RNA_def_function_return(func, parm);
512 func= RNA_def_function(srna, "remove", "rna_Main_cameras_remove");
513 RNA_def_function_flag(func, FUNC_USE_REPORTS);
514 RNA_def_function_ui_description(func, "Remove a camera from the current blendfile.");
515 parm= RNA_def_pointer(func, "camera", "Camera", "", "Camera to remove.");
516 RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
519 void RNA_def_main_scenes(BlenderRNA *brna, PropertyRNA *cprop)
525 RNA_def_property_srna(cprop, "MainScenes");
526 srna= RNA_def_struct(brna, "MainScenes", NULL);
527 RNA_def_struct_ui_text(srna, "Main Scenes", "Collection of scenes");
529 func= RNA_def_function(srna, "new", "rna_Main_scenes_new");
530 RNA_def_function_ui_description(func, "Add a new scene to the main database");
531 parm= RNA_def_string(func, "name", "Scene", 0, "", "New name for the datablock.");
532 RNA_def_property_flag(parm, PROP_REQUIRED);
534 parm= RNA_def_pointer(func, "scene", "Scene", "", "New scene datablock.");
535 RNA_def_function_return(func, parm);
537 func= RNA_def_function(srna, "remove", "rna_Main_scenes_remove");
538 RNA_def_function_flag(func, FUNC_USE_CONTEXT|FUNC_USE_REPORTS);
539 RNA_def_function_ui_description(func, "Remove a scene from the current blendfile.");
540 parm= RNA_def_pointer(func, "scene", "Scene", "", "Scene to remove.");
541 RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
544 void RNA_def_main_objects(BlenderRNA *brna, PropertyRNA *cprop)
550 RNA_def_property_srna(cprop, "MainObjects");
551 srna= RNA_def_struct(brna, "MainObjects", NULL);
552 RNA_def_struct_ui_text(srna, "Main Objects", "Collection of objects");
554 func= RNA_def_function(srna, "new", "rna_Main_objects_new");
555 RNA_def_function_flag(func, FUNC_USE_REPORTS);
556 RNA_def_function_ui_description(func, "Add a new object to the main database");
557 parm= RNA_def_string(func, "name", "Object", 0, "", "New name for the datablock.");
558 RNA_def_property_flag(parm, PROP_REQUIRED);
559 parm= RNA_def_pointer(func, "object_data", "ID", "", "Object data or None for an empty object.");
560 RNA_def_property_flag(parm, PROP_REQUIRED);
563 parm= RNA_def_pointer(func, "object", "Object", "", "New object datablock.");
564 RNA_def_function_return(func, parm);
566 func= RNA_def_function(srna, "remove", "rna_Main_objects_remove");
567 RNA_def_function_ui_description(func, "Remove a object from the current blendfile.");
568 RNA_def_function_flag(func, FUNC_USE_REPORTS);
569 parm= RNA_def_pointer(func, "object", "Object", "", "Object to remove.");
570 RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
573 void RNA_def_main_materials(BlenderRNA *brna, PropertyRNA *cprop)
579 RNA_def_property_srna(cprop, "MainMaterials");
580 srna= RNA_def_struct(brna, "MainMaterials", NULL);
581 RNA_def_struct_ui_text(srna, "Main Material", "Collection of materials");
583 func= RNA_def_function(srna, "new", "rna_Main_materials_new");
584 RNA_def_function_ui_description(func, "Add a new material to the main database");
585 parm= RNA_def_string(func, "name", "Material", 0, "", "New name for the datablock.");
586 RNA_def_property_flag(parm, PROP_REQUIRED);
588 parm= RNA_def_pointer(func, "material", "Material", "", "New material datablock.");
589 RNA_def_function_return(func, parm);
591 func= RNA_def_function(srna, "remove", "rna_Main_materials_remove");
592 RNA_def_function_flag(func, FUNC_USE_REPORTS);
593 RNA_def_function_ui_description(func, "Remove a material from the current blendfile.");
594 parm= RNA_def_pointer(func, "material", "Material", "", "Material to remove.");
595 RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
597 void RNA_def_main_node_groups(BlenderRNA *brna, PropertyRNA *cprop)
600 // FunctionRNA *func;
601 // PropertyRNA *parm;
603 /* static EnumPropertyItem node_nodetree_items[] = {
604 {0, "SHADER", 0, "Shader", ""},
605 {1, "COMPOSITE", 0, "Composite", ""},
606 {2, "TEXTURE", 0, "Texture", ""},
607 {0, NULL, 0, NULL, NULL}}; */
609 RNA_def_property_srna(cprop, "MainNodeTrees");
610 srna= RNA_def_struct(brna, "MainNodeTrees", NULL);
611 RNA_def_struct_ui_text(srna, "Main Node Trees", "Collection of node trees");
613 #if 0 // need to see some examples of using these functions before enabling.
614 func= RNA_def_function(srna, "new", "rna_Main_nodetree_new");
615 RNA_def_function_ui_description(func, "Add a new node tree to the main database");
616 parm= RNA_def_enum(func, "type", node_nodetree_items, 0, "Type", "The type of curve object to add");
617 RNA_def_property_flag(parm, PROP_REQUIRED);
619 parm= RNA_def_pointer(func, "tree", "NodeTree", "", "New node tree datablock.");
620 RNA_def_function_return(func, parm);
622 func= RNA_def_function(srna, "remove", "rna_Main_nodetree_remove");
623 RNA_def_function_flag(func, FUNC_USE_REPORTS);
624 RNA_def_function_ui_description(func, "Remove a node tree from the current blendfile.");
625 parm= RNA_def_pointer(func, "tree", "NodeTree", "", "Node tree to remove.");
626 RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
629 void RNA_def_main_meshes(BlenderRNA *brna, PropertyRNA *cprop)
635 RNA_def_property_srna(cprop, "MainMeshes");
636 srna= RNA_def_struct(brna, "MainMeshes", NULL);
637 RNA_def_struct_ui_text(srna, "Main Meshes", "Collection of meshes");
639 func= RNA_def_function(srna, "new", "rna_Main_meshes_new");
640 RNA_def_function_ui_description(func, "Add a new mesh to the main database");
641 parm= RNA_def_string(func, "name", "Mesh", 0, "", "New name for the datablock.");
642 RNA_def_property_flag(parm, PROP_REQUIRED);
644 parm= RNA_def_pointer(func, "mesh", "Mesh", "", "New mesh datablock.");
645 RNA_def_function_return(func, parm);
647 func= RNA_def_function(srna, "remove", "rna_Main_meshes_remove");
648 RNA_def_function_flag(func, FUNC_USE_REPORTS);
649 RNA_def_function_ui_description(func, "Remove a mesh from the current blendfile.");
650 parm= RNA_def_pointer(func, "mesh", "Mesh", "", "Mesh to remove.");
651 RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
653 void RNA_def_main_lamps(BlenderRNA *brna, PropertyRNA *cprop)
659 RNA_def_property_srna(cprop, "MainLamps");
660 srna= RNA_def_struct(brna, "MainLamps", NULL);
661 RNA_def_struct_ui_text(srna, "Main Lamps", "Collection of lamps");
663 func= RNA_def_function(srna, "new", "rna_Main_lamps_new");
664 RNA_def_function_ui_description(func, "Add a new lamp to the main database");
665 parm= RNA_def_string(func, "name", "Lamp", 0, "", "New name for the datablock.");
666 RNA_def_property_flag(parm, PROP_REQUIRED);
668 parm= RNA_def_pointer(func, "lamp", "Lamp", "", "New lamp datablock.");
669 RNA_def_function_return(func, parm);
671 func= RNA_def_function(srna, "remove", "rna_Main_lamps_remove");
672 RNA_def_function_flag(func, FUNC_USE_REPORTS);
673 RNA_def_function_ui_description(func, "Remove a lamp from the current blendfile.");
674 parm= RNA_def_pointer(func, "lamp", "Lamp", "", "Lamp to remove.");
675 RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
677 void RNA_def_main_libraries(BlenderRNA *brna, PropertyRNA *cprop)
681 void RNA_def_main_screens(BlenderRNA *brna, PropertyRNA *cprop)
685 void RNA_def_main_window_managers(BlenderRNA *brna, PropertyRNA *cprop)
689 void RNA_def_main_images(BlenderRNA *brna, PropertyRNA *cprop)
695 RNA_def_property_srna(cprop, "MainImages");
696 srna= RNA_def_struct(brna, "MainImages", NULL);
697 RNA_def_struct_ui_text(srna, "Main Images", "Collection of images");
699 func= RNA_def_function(srna, "new", "rna_Main_images_new");
700 RNA_def_function_ui_description(func, "Add a new image to the main database");
701 parm= RNA_def_string(func, "name", "Image", 0, "", "New name for the datablock.");
702 RNA_def_property_flag(parm, PROP_REQUIRED);
703 parm= RNA_def_int(func, "width", 1024, 1, INT_MAX, "", "Width of the image.", 0, INT_MAX);
704 parm= RNA_def_int(func, "height", 1024, 1, INT_MAX, "", "Height of the image.", 0, INT_MAX);
705 parm= RNA_def_boolean(func, "alpha", 0, "Alpha", "Use alpha channel");
706 parm= RNA_def_boolean(func, "float_buffer", 0, "Float Buffer", "Create an image with floating point color");
708 parm= RNA_def_pointer(func, "image", "Image", "", "New image datablock.");
709 RNA_def_function_return(func, parm);
711 func= RNA_def_function(srna, "load", "rna_Main_images_load");
712 RNA_def_function_flag(func, FUNC_USE_REPORTS);
713 RNA_def_function_ui_description(func, "Load a new image into the main database");
714 parm= RNA_def_string(func, "filepath", "File Path", 0, "", "path of the file to load.");
715 RNA_def_property_flag(parm, PROP_REQUIRED);
717 parm= RNA_def_pointer(func, "image", "Image", "", "New image datablock.");
718 RNA_def_function_return(func, parm);
720 func= RNA_def_function(srna, "remove", "rna_Main_images_remove");
721 RNA_def_function_flag(func, FUNC_USE_REPORTS);
722 RNA_def_function_ui_description(func, "Remove an image from the current blendfile.");
723 parm= RNA_def_pointer(func, "image", "Image", "", "Image to remove.");
724 RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
727 void RNA_def_main_lattices(BlenderRNA *brna, PropertyRNA *cprop)
733 RNA_def_property_srna(cprop, "MainLattices");
734 srna= RNA_def_struct(brna, "MainLattices", NULL);
735 RNA_def_struct_ui_text(srna, "Main Lattices", "Collection of lattices");
737 func= RNA_def_function(srna, "new", "rna_Main_lattices_new");
738 RNA_def_function_ui_description(func, "Add a new lattice to the main database");
739 parm= RNA_def_string(func, "name", "Lattice", 0, "", "New name for the datablock.");
740 RNA_def_property_flag(parm, PROP_REQUIRED);
742 parm= RNA_def_pointer(func, "lattice", "Lattice", "", "New lattices datablock.");
743 RNA_def_function_return(func, parm);
745 func= RNA_def_function(srna, "remove", "rna_Main_lattices_remove");
746 RNA_def_function_flag(func, FUNC_USE_REPORTS);
747 RNA_def_function_ui_description(func, "Remove a lattice from the current blendfile.");
748 parm= RNA_def_pointer(func, "lattice", "Lattice", "", "Lattice to remove.");
749 RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
751 void RNA_def_main_curves(BlenderRNA *brna, PropertyRNA *cprop)
757 RNA_def_property_srna(cprop, "MainCurves");
758 srna= RNA_def_struct(brna, "MainCurves", NULL);
759 RNA_def_struct_ui_text(srna, "Main Curves", "Collection of curves");
761 func= RNA_def_function(srna, "new", "rna_Main_curves_new");
762 RNA_def_function_ui_description(func, "Add a new curve to the main database");
763 parm= RNA_def_string(func, "name", "Curve", 0, "", "New name for the datablock.");
764 RNA_def_property_flag(parm, PROP_REQUIRED);
765 parm= RNA_def_enum(func, "type", object_type_curve_items, 0, "Type", "The type of curve to add");
766 RNA_def_property_flag(parm, PROP_REQUIRED);
768 parm= RNA_def_pointer(func, "curve", "Curve", "", "New curve datablock.");
769 RNA_def_function_return(func, parm);
771 func= RNA_def_function(srna, "remove", "rna_Main_curves_remove");
772 RNA_def_function_flag(func, FUNC_USE_REPORTS);
773 RNA_def_function_ui_description(func, "Remove a curve from the current blendfile.");
774 parm= RNA_def_pointer(func, "curve", "Curve", "", "Curve to remove.");
775 RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
777 void RNA_def_main_metaballs(BlenderRNA *brna, PropertyRNA *cprop)
783 RNA_def_property_srna(cprop, "MainMetaBalls");
784 srna= RNA_def_struct(brna, "MainMetaBalls", NULL);
785 RNA_def_struct_ui_text(srna, "Main MetaBall", "Collection of metaballs");
787 func= RNA_def_function(srna, "new", "rna_Main_metaballs_new");
788 RNA_def_function_ui_description(func, "Add a new metaball to the main database");
789 parm= RNA_def_string(func, "name", "MetaBall", 0, "", "New name for the datablock.");
790 RNA_def_property_flag(parm, PROP_REQUIRED);
792 parm= RNA_def_pointer(func, "metaball", "MetaBall", "", "New metaball datablock.");
793 RNA_def_function_return(func, parm);
795 func= RNA_def_function(srna, "remove", "rna_Main_metaballs_remove");
796 RNA_def_function_flag(func, FUNC_USE_REPORTS);
797 RNA_def_function_ui_description(func, "Remove a metaball from the current blendfile.");
798 parm= RNA_def_pointer(func, "metaball", "MetaBall", "", "MetaBall to remove.");
799 RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
801 void RNA_def_main_fonts(BlenderRNA *brna, PropertyRNA *cprop)
807 RNA_def_property_srna(cprop, "MainFonts");
808 srna= RNA_def_struct(brna, "MainFonts", NULL);
809 RNA_def_struct_ui_text(srna, "Main Fonts", "Collection of fonts");
811 func= RNA_def_function(srna, "load", "rna_Main_fonts_load");
812 RNA_def_function_flag(func, FUNC_USE_REPORTS);
813 RNA_def_function_ui_description(func, "Load a new font into the main database");
814 parm= RNA_def_string(func, "filepath", "File Path", 0, "", "path of the font to load.");
815 RNA_def_property_flag(parm, PROP_REQUIRED);
817 parm= RNA_def_pointer(func, "vfont", "VectorFont", "", "New font datablock.");
818 RNA_def_function_return(func, parm);
820 func= RNA_def_function(srna, "remove", "rna_Main_fonts_remove");
821 RNA_def_function_flag(func, FUNC_USE_REPORTS);
822 RNA_def_function_ui_description(func, "Remove a font from the current blendfile.");
823 parm= RNA_def_pointer(func, "vfont", "VectorFont", "", "Font to remove.");
824 RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
826 void RNA_def_main_textures(BlenderRNA *brna, PropertyRNA *cprop)
832 RNA_def_property_srna(cprop, "MainTextures");
833 srna= RNA_def_struct(brna, "MainTextures", NULL);
834 RNA_def_struct_ui_text(srna, "Main Textures", "Collection of groups");
836 func= RNA_def_function(srna, "new", "rna_Main_textures_new");
837 RNA_def_function_ui_description(func, "Add a new texture to the main database");
838 parm= RNA_def_string(func, "name", "Texture", 0, "", "New name for the datablock.");
839 RNA_def_property_flag(parm, PROP_REQUIRED);
840 parm= RNA_def_enum(func, "type", texture_type_items, 0, "Type", "The type of texture to add");
841 RNA_def_property_flag(parm, PROP_REQUIRED);
843 parm= RNA_def_pointer(func, "texture", "Texture", "", "New texture datablock.");
844 RNA_def_function_return(func, parm);
846 func= RNA_def_function(srna, "remove", "rna_Main_textures_remove");
847 RNA_def_function_flag(func, FUNC_USE_REPORTS);
848 RNA_def_function_ui_description(func, "Remove a texture from the current blendfile.");
849 parm= RNA_def_pointer(func, "texture", "Texture", "", "Texture to remove.");
850 RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
852 void RNA_def_main_brushes(BlenderRNA *brna, PropertyRNA *cprop)
858 RNA_def_property_srna(cprop, "MainBrushes");
859 srna= RNA_def_struct(brna, "MainBrushes", NULL);
860 RNA_def_struct_ui_text(srna, "Main Brushes", "Collection of brushes");
862 func= RNA_def_function(srna, "new", "rna_Main_brushes_new");
863 RNA_def_function_ui_description(func, "Add a new brush to the main database");
864 parm= RNA_def_string(func, "name", "Brush", 0, "", "New name for the datablock.");
865 RNA_def_property_flag(parm, PROP_REQUIRED);
867 parm= RNA_def_pointer(func, "brush", "Brush", "", "New brush datablock.");
868 RNA_def_function_return(func, parm);
870 func= RNA_def_function(srna, "remove", "rna_Main_brushes_remove");
871 RNA_def_function_flag(func, FUNC_USE_REPORTS);
872 RNA_def_function_ui_description(func, "Remove a brush from the current blendfile.");
873 parm= RNA_def_pointer(func, "brush", "Brush", "", "Brush to remove.");
874 RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
877 void RNA_def_main_worlds(BlenderRNA *brna, PropertyRNA *cprop)
883 RNA_def_property_srna(cprop, "MainWorlds");
884 srna= RNA_def_struct(brna, "MainWorlds", NULL);
885 RNA_def_struct_ui_text(srna, "Main Worlds", "Collection of worlds");
887 func= RNA_def_function(srna, "new", "rna_Main_worlds_new");
888 RNA_def_function_ui_description(func, "Add a new world to the main database");
889 parm= RNA_def_string(func, "name", "World", 0, "", "New name for the datablock.");
890 RNA_def_property_flag(parm, PROP_REQUIRED);
892 parm= RNA_def_pointer(func, "world", "World", "", "New world datablock.");
893 RNA_def_function_return(func, parm);
895 func= RNA_def_function(srna, "remove", "rna_Main_worlds_remove");
896 RNA_def_function_flag(func, FUNC_USE_REPORTS);
897 RNA_def_function_ui_description(func, "Remove a world from the current blendfile.");
898 parm= RNA_def_pointer(func, "world", "World", "", "World to remove.");
899 RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
902 void RNA_def_main_groups(BlenderRNA *brna, PropertyRNA *cprop)
908 RNA_def_property_srna(cprop, "MainGroups");
909 srna= RNA_def_struct(brna, "MainGroups", NULL);
910 RNA_def_struct_ui_text(srna, "Main Groups", "Collection of groups");
912 func= RNA_def_function(srna, "new", "rna_Main_groups_new");
913 RNA_def_function_ui_description(func, "Add a new group to the main database");
914 parm= RNA_def_string(func, "name", "Group", 0, "", "New name for the datablock.");
915 RNA_def_property_flag(parm, PROP_REQUIRED);
917 parm= RNA_def_pointer(func, "group", "Group", "", "New group datablock.");
918 RNA_def_function_return(func, parm);
920 func= RNA_def_function(srna, "remove", "rna_Main_groups_remove");
921 RNA_def_function_flag(func, FUNC_USE_REPORTS);
922 RNA_def_function_ui_description(func, "Remove a group from the current blendfile.");
923 parm= RNA_def_pointer(func, "group", "Group", "", "Group to remove.");
924 RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
926 void RNA_def_main_texts(BlenderRNA *brna, PropertyRNA *cprop)
932 RNA_def_property_srna(cprop, "MainTexts");
933 srna= RNA_def_struct(brna, "MainTexts", NULL);
934 RNA_def_struct_ui_text(srna, "Main Texts", "Collection of texts");
936 func= RNA_def_function(srna, "new", "rna_Main_texts_new");
937 RNA_def_function_ui_description(func, "Add a new text to the main database");
938 parm= RNA_def_string(func, "name", "Text", 0, "", "New name for the datablock.");
939 RNA_def_property_flag(parm, PROP_REQUIRED);
941 parm= RNA_def_pointer(func, "text", "Text", "", "New text datablock.");
942 RNA_def_function_return(func, parm);
944 func= RNA_def_function(srna, "remove", "rna_Main_texts_remove");
945 RNA_def_function_flag(func, FUNC_USE_REPORTS);
946 RNA_def_function_ui_description(func, "Remove a text from the current blendfile.");
947 parm= RNA_def_pointer(func, "text", "Text", "", "Text to remove.");
948 RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
951 func= RNA_def_function(srna, "load", "rna_Main_texts_load");
952 RNA_def_function_flag(func, FUNC_USE_REPORTS);
953 RNA_def_function_ui_description(func, "Add a new text to the main database from a file");
954 parm= RNA_def_string(func, "filepath", "Path", FILE_MAXDIR + FILE_MAXFILE, "", "path for the datablock.");
955 RNA_def_property_flag(parm, PROP_REQUIRED);
957 parm= RNA_def_pointer(func, "text", "Text", "", "New text datablock.");
958 RNA_def_function_return(func, parm);
960 void RNA_def_main_sounds(BlenderRNA *brna, PropertyRNA *cprop)
964 void RNA_def_main_armatures(BlenderRNA *brna, PropertyRNA *cprop)
970 RNA_def_property_srna(cprop, "MainArmatures");
971 srna= RNA_def_struct(brna, "MainArmatures", NULL);
972 RNA_def_struct_ui_text(srna, "Main Armatures", "Collection of armatures");
974 func= RNA_def_function(srna, "new", "rna_Main_armatures_new");
975 RNA_def_function_ui_description(func, "Add a new armature to the main database");
976 parm= RNA_def_string(func, "name", "Armature", 0, "", "New name for the datablock.");
977 RNA_def_property_flag(parm, PROP_REQUIRED);
979 parm= RNA_def_pointer(func, "armature", "Armature", "", "New armature datablock.");
980 RNA_def_function_return(func, parm);
982 func= RNA_def_function(srna, "remove", "rna_Main_armatures_remove");
983 RNA_def_function_flag(func, FUNC_USE_REPORTS);
984 RNA_def_function_ui_description(func, "Remove a armature from the current blendfile.");
985 parm= RNA_def_pointer(func, "armature", "Armature", "", "Armature to remove.");
986 RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
988 void RNA_def_main_actions(BlenderRNA *brna, PropertyRNA *cprop)
994 RNA_def_property_srna(cprop, "MainActions");
995 srna= RNA_def_struct(brna, "MainActions", NULL);
996 RNA_def_struct_ui_text(srna, "Main Actions", "Collection of actions");
998 func= RNA_def_function(srna, "new", "rna_Main_actions_new");
999 RNA_def_function_ui_description(func, "Add a new action to the main database");
1000 parm= RNA_def_string(func, "name", "Action", 0, "", "New name for the datablock.");
1001 RNA_def_property_flag(parm, PROP_REQUIRED);
1003 parm= RNA_def_pointer(func, "action", "Action", "", "New action datablock.");
1004 RNA_def_function_return(func, parm);
1006 func= RNA_def_function(srna, "remove", "rna_Main_actions_remove");
1007 RNA_def_function_flag(func, FUNC_USE_REPORTS);
1008 RNA_def_function_ui_description(func, "Remove a action from the current blendfile.");
1009 parm= RNA_def_pointer(func, "action", "Action", "", "Action to remove.");
1010 RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
1012 void RNA_def_main_particles(BlenderRNA *brna, PropertyRNA *cprop)
1018 RNA_def_property_srna(cprop, "MainParticles");
1019 srna= RNA_def_struct(brna, "MainParticles", NULL);
1020 RNA_def_struct_ui_text(srna, "Main Particle Settings", "Collection of particle settings");
1022 func= RNA_def_function(srna, "new", "rna_Main_particles_new");
1023 RNA_def_function_ui_description(func, "Add a new particle settings instance to the main database");
1024 parm= RNA_def_string(func, "name", "ParticleSettings", 0, "", "New name for the datablock.");
1025 RNA_def_property_flag(parm, PROP_REQUIRED);
1027 parm= RNA_def_pointer(func, "particle", "ParticleSettings", "", "New particle settings datablock.");
1028 RNA_def_function_return(func, parm);
1030 func= RNA_def_function(srna, "remove", "rna_Main_particles_remove");
1031 RNA_def_function_flag(func, FUNC_USE_REPORTS);
1032 RNA_def_function_ui_description(func, "Remove a particle settings instance from the current blendfile.");
1033 parm= RNA_def_pointer(func, "particle", "ParticleSettings", "", "Particle Settings to remove.");
1034 RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
1036 void RNA_def_main_gpencil(BlenderRNA *brna, PropertyRNA *cprop)