|
Blender
V2.59
|
00001 /* 00002 * $Id: rna_main_api.c 37031 2011-05-31 02:14:25Z campbellbarton $ 00003 * 00004 * ***** BEGIN GPL LICENSE BLOCK ***** 00005 * 00006 * This program is free software; you can redistribute it and/or 00007 * modify it under the terms of the GNU General Public License 00008 * as published by the Free Software Foundation; either version 2 00009 * of the License, or (at your option) any later version. 00010 * 00011 * This program is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 * GNU General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU General Public License 00017 * along with this program; if not, write to the Free Software Foundation, 00018 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00019 * 00020 * The Original Code is Copyright (C) 2009 Blender Foundation. 00021 * All rights reserved. 00022 * 00023 * 00024 * Contributor(s): Blender Foundation 00025 * 00026 * ***** END GPL LICENSE BLOCK ***** 00027 */ 00028 00034 #include <stdlib.h> 00035 #include <stdio.h> 00036 #include <errno.h> 00037 00038 #include "RNA_define.h" 00039 #include "RNA_access.h" 00040 #include "RNA_enum_types.h" 00041 00042 #include "BKE_utildefines.h" 00043 00044 #ifdef RNA_RUNTIME 00045 00046 #include "BKE_main.h" 00047 #include "BKE_curve.h" 00048 #include "BKE_mesh.h" 00049 #include "BKE_armature.h" 00050 #include "BKE_library.h" 00051 #include "BKE_object.h" 00052 #include "BKE_material.h" 00053 #include "BKE_image.h" 00054 #include "BKE_texture.h" 00055 #include "BKE_scene.h" 00056 #include "BKE_text.h" 00057 #include "BKE_action.h" 00058 #include "BKE_group.h" 00059 #include "BKE_brush.h" 00060 #include "BKE_lattice.h" 00061 #include "BKE_mball.h" 00062 #include "BKE_world.h" 00063 #include "BKE_particle.h" 00064 #include "BKE_font.h" 00065 #include "BKE_node.h" 00066 00067 #include "DNA_armature_types.h" 00068 #include "DNA_camera_types.h" 00069 #include "DNA_curve_types.h" 00070 #include "DNA_lamp_types.h" 00071 #include "DNA_material_types.h" 00072 #include "DNA_mesh_types.h" 00073 #include "DNA_object_types.h" 00074 #include "DNA_text_types.h" 00075 #include "DNA_texture_types.h" 00076 #include "DNA_group_types.h" 00077 #include "DNA_brush_types.h" 00078 #include "DNA_lattice_types.h" 00079 #include "DNA_meta_types.h" 00080 #include "DNA_world_types.h" 00081 #include "DNA_particle_types.h" 00082 #include "DNA_vfont_types.h" 00083 #include "DNA_node_types.h" 00084 00085 #include "ED_screen.h" 00086 00087 Tex *rna_Main_add_texture(Main *UNUSED(bmain), const char *name) 00088 { 00089 return add_texture(name); 00090 } 00091 00092 Camera *rna_Main_cameras_new(Main *UNUSED(bmain), const char *name) 00093 { 00094 ID *id= add_camera(name); 00095 id_us_min(id); 00096 return (Camera *)id; 00097 } 00098 void rna_Main_cameras_remove(Main *bmain, ReportList *reports, struct Camera *camera) 00099 { 00100 if(ID_REAL_USERS(camera) <= 0) 00101 free_libblock(&bmain->camera, camera); 00102 else 00103 BKE_reportf(reports, RPT_ERROR, "Camera \"%s\" must have zero users to be removed, found %d.", camera->id.name+2, ID_REAL_USERS(camera)); 00104 00105 /* XXX python now has invalid pointer? */ 00106 } 00107 00108 Scene *rna_Main_scenes_new(Main *UNUSED(bmain), const char *name) 00109 { 00110 return add_scene(name); 00111 } 00112 void rna_Main_scenes_remove(Main *bmain, bContext *C, ReportList *reports, struct Scene *scene) 00113 { 00114 /* dont call free_libblock(...) directly */ 00115 Scene *newscene; 00116 00117 if(scene->id.prev) 00118 newscene= scene->id.prev; 00119 else if(scene->id.next) 00120 newscene= scene->id.next; 00121 else { 00122 BKE_reportf(reports, RPT_ERROR, "Scene \"%s\" is the last, cant ve removed.", scene->id.name+2); 00123 return; 00124 } 00125 00126 if(CTX_wm_screen(C)->scene == scene) 00127 ED_screen_set_scene(C, newscene); 00128 00129 unlink_scene(bmain, scene, newscene); 00130 } 00131 00132 Object *rna_Main_objects_new(Main *UNUSED(bmain), ReportList *reports, const char *name, ID *data) 00133 { 00134 Object *ob; 00135 int type= OB_EMPTY; 00136 if(data) { 00137 switch(GS(data->name)) { 00138 case ID_ME: 00139 type= OB_MESH; 00140 break; 00141 case ID_CU: 00142 type= curve_type((struct Curve *)data); 00143 break; 00144 case ID_MB: 00145 type= OB_MBALL; 00146 break; 00147 case ID_LA: 00148 type= OB_LAMP; 00149 break; 00150 case ID_CA: 00151 type= OB_CAMERA; 00152 break; 00153 case ID_LT: 00154 type= OB_LATTICE; 00155 break; 00156 case ID_AR: 00157 type= OB_ARMATURE; 00158 break; 00159 default: 00160 { 00161 const char *idname; 00162 if(RNA_enum_id_from_value(id_type_items, GS(data->name), &idname) == 0) 00163 idname= "UNKNOWN"; 00164 00165 BKE_reportf(reports, RPT_ERROR, "ID type '%s' is not valid for a object.", idname); 00166 return NULL; 00167 } 00168 } 00169 00170 id_us_plus(data); 00171 } 00172 00173 ob= add_only_object(type, name); 00174 id_us_min(&ob->id); 00175 00176 ob->data= data; 00177 test_object_materials(ob->data); 00178 00179 return ob; 00180 } 00181 00182 void rna_Main_objects_remove(Main *bmain, ReportList *reports, struct Object *object) 00183 { 00184 if(ID_REAL_USERS(object) <= 0) { 00185 unlink_object(object); /* needed or ID pointers to this are not cleared */ 00186 free_libblock(&bmain->object, object); 00187 } 00188 else { 00189 BKE_reportf(reports, RPT_ERROR, "Object \"%s\" must have zero users to be removed, found %d.", object->id.name+2, ID_REAL_USERS(object)); 00190 } 00191 } 00192 00193 struct Material *rna_Main_materials_new(Main *UNUSED(bmain), const char *name) 00194 { 00195 ID *id= (ID *)add_material(name); 00196 id_us_min(id); 00197 return (Material *)id; 00198 } 00199 void rna_Main_materials_remove(Main *bmain, ReportList *reports, struct Material *material) 00200 { 00201 if(ID_REAL_USERS(material) <= 0) 00202 free_libblock(&bmain->mat, material); 00203 else 00204 BKE_reportf(reports, RPT_ERROR, "Material \"%s\" must have zero users to be removed, found %d.", material->id.name+2, ID_REAL_USERS(material)); 00205 00206 /* XXX python now has invalid pointer? */ 00207 } 00208 00209 struct bNodeTree *rna_Main_nodetree_new(Main *UNUSED(bmain), const char *name, int type) 00210 { 00211 bNodeTree *tree = ntreeAddTree(name, type, TRUE); 00212 00213 // ntreeMakeGroupSockets(tree); 00214 00215 id_us_min(&tree->id); 00216 return tree; 00217 } 00218 void rna_Main_nodetree_remove(Main *bmain, ReportList *reports, struct bNodeTree *tree) 00219 { 00220 if(ID_REAL_USERS(tree) <= 0) 00221 free_libblock(&bmain->nodetree, tree); 00222 else 00223 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)); 00224 00225 /* XXX python now has invalid pointer? */ 00226 } 00227 00228 Mesh *rna_Main_meshes_new(Main *UNUSED(bmain), const char *name) 00229 { 00230 Mesh *me= add_mesh(name); 00231 id_us_min(&me->id); 00232 return me; 00233 } 00234 void rna_Main_meshes_remove(Main *bmain, ReportList *reports, Mesh *mesh) 00235 { 00236 if(ID_REAL_USERS(mesh) <= 0) 00237 free_libblock(&bmain->mesh, mesh); 00238 else 00239 BKE_reportf(reports, RPT_ERROR, "Mesh \"%s\" must have zero users to be removed, found %d.", mesh->id.name+2, ID_REAL_USERS(mesh)); 00240 00241 /* XXX python now has invalid pointer? */ 00242 } 00243 00244 Lamp *rna_Main_lamps_new(Main *UNUSED(bmain), const char *name, int type) 00245 { 00246 Lamp *lamp= add_lamp(name); 00247 lamp->type= type; 00248 id_us_min(&lamp->id); 00249 return lamp; 00250 } 00251 void rna_Main_lamps_remove(Main *bmain, ReportList *reports, Lamp *lamp) 00252 { 00253 if(ID_REAL_USERS(lamp) <= 0) 00254 free_libblock(&bmain->lamp, lamp); 00255 else 00256 BKE_reportf(reports, RPT_ERROR, "Lamp \"%s\" must have zero users to be removed, found %d.", lamp->id.name+2, ID_REAL_USERS(lamp)); 00257 00258 /* XXX python now has invalid pointer? */ 00259 } 00260 00261 Image *rna_Main_images_new(Main *UNUSED(bmain), const char *name, int width, int height, int alpha, int float_buffer) 00262 { 00263 float color[4]= {0.0, 0.0, 0.0, 1.0}; 00264 Image *image= BKE_add_image_size(width, height, name, alpha ? 32:24, float_buffer, 0, color); 00265 id_us_min(&image->id); 00266 return image; 00267 } 00268 Image *rna_Main_images_load(Main *UNUSED(bmain), ReportList *reports, const char *filepath) 00269 { 00270 Image *ima; 00271 00272 errno= 0; 00273 ima= BKE_add_image_file(filepath); 00274 00275 if(!ima) 00276 BKE_reportf(reports, RPT_ERROR, "Can't read: \"%s\", %s.", filepath, errno ? strerror(errno) : "Unsupported image format"); 00277 00278 return ima; 00279 } 00280 void rna_Main_images_remove(Main *bmain, ReportList *reports, Image *image) 00281 { 00282 if(ID_REAL_USERS(image) <= 0) 00283 free_libblock(&bmain->image, image); 00284 else 00285 BKE_reportf(reports, RPT_ERROR, "Image \"%s\" must have zero users to be removed, found %d.", image->id.name+2, ID_REAL_USERS(image)); 00286 00287 /* XXX python now has invalid pointer? */ 00288 } 00289 00290 Lattice *rna_Main_lattices_new(Main *UNUSED(bmain), const char *name) 00291 { 00292 Lattice *lt= add_lattice(name); 00293 id_us_min(<->id); 00294 return lt; 00295 } 00296 void rna_Main_lattices_remove(Main *bmain, ReportList *reports, struct Lattice *lt) 00297 { 00298 if(ID_REAL_USERS(lt) <= 0) 00299 free_libblock(&bmain->latt, lt); 00300 else 00301 BKE_reportf(reports, RPT_ERROR, "Lattice \"%s\" must have zero users to be removed, found %d.", lt->id.name+2, ID_REAL_USERS(lt)); 00302 } 00303 00304 Curve *rna_Main_curves_new(Main *UNUSED(bmain), const char *name, int type) 00305 { 00306 Curve *cu= add_curve(name, type); 00307 id_us_min(&cu->id); 00308 return cu; 00309 } 00310 void rna_Main_curves_remove(Main *bmain, ReportList *reports, struct Curve *cu) 00311 { 00312 if(ID_REAL_USERS(cu) <= 0) 00313 free_libblock(&bmain->curve, cu); 00314 else 00315 BKE_reportf(reports, RPT_ERROR, "Curve \"%s\" must have zero users to be removed, found %d.", cu->id.name+2, ID_REAL_USERS(cu)); 00316 } 00317 00318 MetaBall *rna_Main_metaballs_new(Main *UNUSED(bmain), const char *name) 00319 { 00320 MetaBall *mb= add_mball(name); 00321 id_us_min(&mb->id); 00322 return mb; 00323 } 00324 void rna_Main_metaballs_remove(Main *bmain, ReportList *reports, struct MetaBall *mb) 00325 { 00326 if(ID_REAL_USERS(mb) <= 0) 00327 free_libblock(&bmain->mball, mb); 00328 else 00329 BKE_reportf(reports, RPT_ERROR, "MetaBall \"%s\" must have zero users to be removed, found %d.", mb->id.name+2, ID_REAL_USERS(mb)); 00330 } 00331 00332 VFont *rna_Main_fonts_load(Main *UNUSED(bmain), ReportList *reports, const char *filepath) 00333 { 00334 VFont *font; 00335 00336 errno= 0; 00337 font= load_vfont(filepath); 00338 00339 if(!font) 00340 BKE_reportf(reports, RPT_ERROR, "Can't read: \"%s\", %s.", filepath, errno ? strerror(errno) : "Unsupported font format"); 00341 00342 return font; 00343 00344 } 00345 void rna_Main_fonts_remove(Main *bmain, ReportList *reports, VFont *vfont) 00346 { 00347 if(ID_REAL_USERS(vfont) <= 0) 00348 free_libblock(&bmain->vfont, vfont); 00349 else 00350 BKE_reportf(reports, RPT_ERROR, "Font \"%s\" must have zero users to be removed, found %d.", vfont->id.name+2, ID_REAL_USERS(vfont)); 00351 00352 /* XXX python now has invalid pointer? */ 00353 } 00354 00355 Tex *rna_Main_textures_new(Main *UNUSED(bmain), const char *name, int type) 00356 { 00357 Tex *tex= add_texture(name); 00358 tex_set_type(tex, type); 00359 id_us_min(&tex->id); 00360 return tex; 00361 } 00362 void rna_Main_textures_remove(Main *bmain, ReportList *reports, struct Tex *tex) 00363 { 00364 if(ID_REAL_USERS(tex) <= 0) 00365 free_libblock(&bmain->tex, tex); 00366 else 00367 BKE_reportf(reports, RPT_ERROR, "Texture \"%s\" must have zero users to be removed, found %d.", tex->id.name+2, ID_REAL_USERS(tex)); 00368 } 00369 00370 Brush *rna_Main_brushes_new(Main *UNUSED(bmain), const char *name) 00371 { 00372 Brush *brush = add_brush(name); 00373 id_us_min(&brush->id); 00374 return brush; 00375 } 00376 void rna_Main_brushes_remove(Main *bmain, ReportList *reports, struct Brush *brush) 00377 { 00378 if(ID_REAL_USERS(brush) <= 0) 00379 free_libblock(&bmain->brush, brush); 00380 else 00381 BKE_reportf(reports, RPT_ERROR, "Brush \"%s\" must have zero users to be removed, found %d.", brush->id.name+2, ID_REAL_USERS(brush)); 00382 } 00383 00384 World *rna_Main_worlds_new(Main *UNUSED(bmain), const char *name) 00385 { 00386 World *world = add_world(name); 00387 id_us_min(&world->id); 00388 return world; 00389 } 00390 void rna_Main_worlds_remove(Main *bmain, ReportList *reports, struct World *world) 00391 { 00392 if(ID_REAL_USERS(world) <= 0) 00393 free_libblock(&bmain->world, world); 00394 else 00395 BKE_reportf(reports, RPT_ERROR, "World \"%s\" must have zero users to be removed, found %d.", world->id.name+2, ID_REAL_USERS(world)); 00396 } 00397 00398 Group *rna_Main_groups_new(Main *UNUSED(bmain), const char *name) 00399 { 00400 return add_group(name); 00401 } 00402 void rna_Main_groups_remove(Main *bmain, Group *group) 00403 { 00404 unlink_group(group); 00405 free_libblock(&bmain->group, group); 00406 /* XXX python now has invalid pointer? */ 00407 } 00408 00409 Text *rna_Main_texts_new(Main *UNUSED(bmain), const char *name) 00410 { 00411 return add_empty_text(name); 00412 } 00413 void rna_Main_texts_remove(Main *bmain, Text *text) 00414 { 00415 unlink_text(bmain, text); 00416 free_libblock(&bmain->text, text); 00417 /* XXX python now has invalid pointer? */ 00418 } 00419 00420 Text *rna_Main_texts_load(Main *bmain, ReportList *reports, const char *filepath) 00421 { 00422 Text *txt; 00423 00424 errno= 0; 00425 txt= add_text(filepath, bmain->name); 00426 00427 if(!txt) 00428 BKE_reportf(reports, RPT_ERROR, "Can't read: \"%s\", %s.", filepath, errno ? strerror(errno) : "Unable to load text"); 00429 00430 return txt; 00431 } 00432 00433 bArmature *rna_Main_armatures_new(Main *UNUSED(bmain), const char *name) 00434 { 00435 bArmature *arm= add_armature(name); 00436 id_us_min(&arm->id); 00437 return arm; 00438 } 00439 void rna_Main_armatures_remove(Main *bmain, ReportList *reports, bArmature *arm) 00440 { 00441 if(ID_REAL_USERS(arm) <= 0) 00442 free_libblock(&bmain->armature, arm); 00443 else 00444 BKE_reportf(reports, RPT_ERROR, "Armature \"%s\" must have zero users to be removed, found %d.", arm->id.name+2, ID_REAL_USERS(arm)); 00445 00446 /* XXX python now has invalid pointer? */ 00447 } 00448 00449 bAction *rna_Main_actions_new(Main *UNUSED(bmain), const char *name) 00450 { 00451 bAction *act= add_empty_action(name); 00452 id_us_min(&act->id); 00453 act->id.flag &= ~LIB_FAKEUSER; 00454 return act; 00455 } 00456 void rna_Main_actions_remove(Main *bmain, ReportList *reports, bAction *act) 00457 { 00458 if(ID_REAL_USERS(act) <= 0) 00459 free_libblock(&bmain->action, act); 00460 else 00461 BKE_reportf(reports, RPT_ERROR, "Action \"%s\" must have zero users to be removed, found %d.", act->id.name+2, ID_REAL_USERS(act)); 00462 00463 /* XXX python now has invalid pointer? */ 00464 } 00465 00466 ParticleSettings *rna_Main_particles_new(Main *bmain, const char *name) 00467 { 00468 ParticleSettings *part = psys_new_settings(name, bmain); 00469 id_us_min(&part->id); 00470 return part; 00471 } 00472 void rna_Main_particles_remove(Main *bmain, ReportList *reports, ParticleSettings *part) 00473 { 00474 if(ID_REAL_USERS(part) <= 0) 00475 free_libblock(&bmain->particle, part); 00476 else 00477 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)); 00478 00479 /* XXX python now has invalid pointer? */ 00480 } 00481 00482 /* tag functions, all the same */ 00483 void rna_Main_cameras_tag(Main *bmain, int value) { tag_main_lb(&bmain->camera, value); } 00484 void rna_Main_scenes_tag(Main *bmain, int value) { tag_main_lb(&bmain->scene, value); } 00485 void rna_Main_objects_tag(Main *bmain, int value) { tag_main_lb(&bmain->object, value); } 00486 void rna_Main_materials_tag(Main *bmain, int value) { tag_main_lb(&bmain->mat, value); } 00487 void rna_Main_node_groups_tag(Main *bmain, int value) { tag_main_lb(&bmain->nodetree, value); } 00488 void rna_Main_meshes_tag(Main *bmain, int value) { tag_main_lb(&bmain->mesh, value); } 00489 void rna_Main_lamps_tag(Main *bmain, int value) { tag_main_lb(&bmain->lamp, value); } 00490 void rna_Main_libraries_tag(Main *bmain, int value) { tag_main_lb(&bmain->library, value); } 00491 void rna_Main_screens_tag(Main *bmain, int value) { tag_main_lb(&bmain->screen, value); } 00492 void rna_Main_window_managers_tag(Main *bmain, int value) { tag_main_lb(&bmain->wm, value); } 00493 void rna_Main_images_tag(Main *bmain, int value) { tag_main_lb(&bmain->image, value); } 00494 void rna_Main_lattices_tag(Main *bmain, int value) { tag_main_lb(&bmain->latt, value); } 00495 void rna_Main_curves_tag(Main *bmain, int value) { tag_main_lb(&bmain->curve, value); } 00496 void rna_Main_metaballs_tag(Main *bmain, int value) { tag_main_lb(&bmain->mball, value); } 00497 void rna_Main_fonts_tag(Main *bmain, int value) { tag_main_lb(&bmain->vfont, value); } 00498 void rna_Main_textures_tag(Main *bmain, int value) { tag_main_lb(&bmain->tex, value); } 00499 void rna_Main_brushes_tag(Main *bmain, int value) { tag_main_lb(&bmain->brush, value); } 00500 void rna_Main_worlds_tag(Main *bmain, int value) { tag_main_lb(&bmain->world, value); } 00501 void rna_Main_groups_tag(Main *bmain, int value) { tag_main_lb(&bmain->group, value); } 00502 void rna_Main_shape_keys_tag(Main *bmain, int value) { tag_main_lb(&bmain->key, value); } 00503 void rna_Main_scripts_tag(Main *bmain, int value) { tag_main_lb(&bmain->script, value); } 00504 void rna_Main_texts_tag(Main *bmain, int value) { tag_main_lb(&bmain->text, value); } 00505 void rna_Main_sounds_tag(Main *bmain, int value) { tag_main_lb(&bmain->sound, value); } 00506 void rna_Main_armatures_tag(Main *bmain, int value) { tag_main_lb(&bmain->armature, value); } 00507 void rna_Main_actions_tag(Main *bmain, int value) { tag_main_lb(&bmain->action, value); } 00508 void rna_Main_particles_tag(Main *bmain, int value) { tag_main_lb(&bmain->particle, value); } 00509 void rna_Main_gpencil_tag(Main *bmain, int value) { tag_main_lb(&bmain->gpencil, value); } 00510 00511 #else 00512 00513 void RNA_api_main(StructRNA *srna) 00514 { 00515 /* 00516 FunctionRNA *func; 00517 PropertyRNA *parm; 00518 */ 00519 /* maybe we want to add functions in 'bpy.data' still? 00520 * for now they are all in collections bpy.data.images.new(...) */ 00521 /* 00522 func= RNA_def_function(srna, "add_image", "rna_Main_add_image"); 00523 RNA_def_function_ui_description(func, "Add a new image."); 00524 parm= RNA_def_string_file_path(func, "filepath", "", 0, "", "File path to load image from."); 00525 RNA_def_property_flag(parm, PROP_REQUIRED); 00526 parm= RNA_def_pointer(func, "image", "Image", "", "New image."); 00527 RNA_def_function_return(func, parm); 00528 */ 00529 00530 } 00531 00532 void RNA_def_main_cameras(BlenderRNA *brna, PropertyRNA *cprop) 00533 { 00534 StructRNA *srna; 00535 FunctionRNA *func; 00536 PropertyRNA *parm; 00537 00538 RNA_def_property_srna(cprop, "BlendDataCameras"); 00539 srna= RNA_def_struct(brna, "BlendDataCameras", NULL); 00540 RNA_def_struct_sdna(srna, "Main"); 00541 RNA_def_struct_ui_text(srna, "Main Cameras", "Collection of cameras"); 00542 00543 func= RNA_def_function(srna, "new", "rna_Main_cameras_new"); 00544 RNA_def_function_ui_description(func, "Add a new camera to the main database"); 00545 parm= RNA_def_string(func, "name", "Camera", 0, "", "New name for the datablock."); 00546 RNA_def_property_flag(parm, PROP_REQUIRED); 00547 /* return type */ 00548 parm= RNA_def_pointer(func, "camera", "Camera", "", "New camera datablock."); 00549 RNA_def_function_return(func, parm); 00550 00551 func= RNA_def_function(srna, "remove", "rna_Main_cameras_remove"); 00552 RNA_def_function_flag(func, FUNC_USE_REPORTS); 00553 RNA_def_function_ui_description(func, "Remove a camera from the current blendfile."); 00554 parm= RNA_def_pointer(func, "camera", "Camera", "", "Camera to remove."); 00555 RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL); 00556 00557 func= RNA_def_function(srna, "tag", "rna_Main_cameras_tag"); 00558 parm= RNA_def_boolean(func, "value", 0, "Value", ""); 00559 RNA_def_property_flag(parm, PROP_REQUIRED); 00560 } 00561 00562 void RNA_def_main_scenes(BlenderRNA *brna, PropertyRNA *cprop) 00563 { 00564 StructRNA *srna; 00565 FunctionRNA *func; 00566 PropertyRNA *parm; 00567 00568 RNA_def_property_srna(cprop, "BlendDataScenes"); 00569 srna= RNA_def_struct(brna, "BlendDataScenes", NULL); 00570 RNA_def_struct_sdna(srna, "Main"); 00571 RNA_def_struct_ui_text(srna, "Main Scenes", "Collection of scenes"); 00572 00573 func= RNA_def_function(srna, "new", "rna_Main_scenes_new"); 00574 RNA_def_function_ui_description(func, "Add a new scene to the main database"); 00575 parm= RNA_def_string(func, "name", "Scene", 0, "", "New name for the datablock."); 00576 RNA_def_property_flag(parm, PROP_REQUIRED); 00577 /* return type */ 00578 parm= RNA_def_pointer(func, "scene", "Scene", "", "New scene datablock."); 00579 RNA_def_function_return(func, parm); 00580 00581 func= RNA_def_function(srna, "remove", "rna_Main_scenes_remove"); 00582 RNA_def_function_flag(func, FUNC_USE_CONTEXT|FUNC_USE_REPORTS); 00583 RNA_def_function_ui_description(func, "Remove a scene from the current blendfile."); 00584 parm= RNA_def_pointer(func, "scene", "Scene", "", "Scene to remove."); 00585 RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL); 00586 } 00587 00588 void RNA_def_main_objects(BlenderRNA *brna, PropertyRNA *cprop) 00589 { 00590 StructRNA *srna; 00591 FunctionRNA *func; 00592 PropertyRNA *parm; 00593 00594 RNA_def_property_srna(cprop, "BlendDataObjects"); 00595 srna= RNA_def_struct(brna, "BlendDataObjects", NULL); 00596 RNA_def_struct_sdna(srna, "Main"); 00597 RNA_def_struct_ui_text(srna, "Main Objects", "Collection of objects"); 00598 00599 func= RNA_def_function(srna, "new", "rna_Main_objects_new"); 00600 RNA_def_function_flag(func, FUNC_USE_REPORTS); 00601 RNA_def_function_ui_description(func, "Add a new object to the main database"); 00602 parm= RNA_def_string(func, "name", "Object", 0, "", "New name for the datablock."); 00603 RNA_def_property_flag(parm, PROP_REQUIRED); 00604 parm= RNA_def_pointer(func, "object_data", "ID", "", "Object data or None for an empty object."); 00605 RNA_def_property_flag(parm, PROP_REQUIRED); 00606 00607 /* return type */ 00608 parm= RNA_def_pointer(func, "object", "Object", "", "New object datablock."); 00609 RNA_def_function_return(func, parm); 00610 00611 func= RNA_def_function(srna, "remove", "rna_Main_objects_remove"); 00612 RNA_def_function_ui_description(func, "Remove a object from the current blendfile."); 00613 RNA_def_function_flag(func, FUNC_USE_REPORTS); 00614 parm= RNA_def_pointer(func, "object", "Object", "", "Object to remove."); 00615 RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL); 00616 00617 func= RNA_def_function(srna, "tag", "rna_Main_objects_tag"); 00618 parm= RNA_def_boolean(func, "value", 0, "Value", ""); 00619 RNA_def_property_flag(parm, PROP_REQUIRED); 00620 } 00621 00622 void RNA_def_main_materials(BlenderRNA *brna, PropertyRNA *cprop) 00623 { 00624 StructRNA *srna; 00625 FunctionRNA *func; 00626 PropertyRNA *parm; 00627 00628 RNA_def_property_srna(cprop, "BlendDataMaterials"); 00629 srna= RNA_def_struct(brna, "BlendDataMaterials", NULL); 00630 RNA_def_struct_sdna(srna, "Main"); 00631 RNA_def_struct_ui_text(srna, "Main Material", "Collection of materials"); 00632 00633 func= RNA_def_function(srna, "new", "rna_Main_materials_new"); 00634 RNA_def_function_ui_description(func, "Add a new material to the main database"); 00635 parm= RNA_def_string(func, "name", "Material", 0, "", "New name for the datablock."); 00636 RNA_def_property_flag(parm, PROP_REQUIRED); 00637 /* return type */ 00638 parm= RNA_def_pointer(func, "material", "Material", "", "New material datablock."); 00639 RNA_def_function_return(func, parm); 00640 00641 func= RNA_def_function(srna, "remove", "rna_Main_materials_remove"); 00642 RNA_def_function_flag(func, FUNC_USE_REPORTS); 00643 RNA_def_function_ui_description(func, "Remove a material from the current blendfile."); 00644 parm= RNA_def_pointer(func, "material", "Material", "", "Material to remove."); 00645 RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL); 00646 00647 func= RNA_def_function(srna, "tag", "rna_Main_materials_tag"); 00648 parm= RNA_def_boolean(func, "value", 0, "Value", ""); 00649 RNA_def_property_flag(parm, PROP_REQUIRED); 00650 } 00651 void RNA_def_main_node_groups(BlenderRNA *brna, PropertyRNA *cprop) 00652 { 00653 StructRNA *srna; 00654 FunctionRNA *func; 00655 PropertyRNA *parm; 00656 00657 static EnumPropertyItem node_nodetree_items[] = { 00658 {0, "SHADER", 0, "Shader", ""}, 00659 {1, "COMPOSITE", 0, "Composite", ""}, 00660 {2, "TEXTURE", 0, "Texture", ""}, 00661 {0, NULL, 0, NULL, NULL}}; 00662 00663 RNA_def_property_srna(cprop, "BlendDataNodeTrees"); 00664 srna= RNA_def_struct(brna, "BlendDataNodeTrees", NULL); 00665 RNA_def_struct_sdna(srna, "Main"); 00666 RNA_def_struct_ui_text(srna, "Main Node Trees", "Collection of node trees"); 00667 00668 func= RNA_def_function(srna, "new", "rna_Main_nodetree_new"); 00669 RNA_def_function_ui_description(func, "Add a new node tree to the main database"); 00670 parm= RNA_def_string(func, "name", "NodeGroup", 0, "", "New name for the datablock."); 00671 RNA_def_property_flag(parm, PROP_REQUIRED); 00672 parm= RNA_def_enum(func, "type", node_nodetree_items, 0, "Type", "The type of node_group to add"); 00673 RNA_def_property_flag(parm, PROP_REQUIRED); 00674 /* return type */ 00675 parm= RNA_def_pointer(func, "tree", "NodeTree", "", "New node tree datablock."); 00676 RNA_def_function_return(func, parm); 00677 00678 func= RNA_def_function(srna, "remove", "rna_Main_nodetree_remove"); 00679 RNA_def_function_flag(func, FUNC_USE_REPORTS); 00680 RNA_def_function_ui_description(func, "Remove a node tree from the current blendfile."); 00681 parm= RNA_def_pointer(func, "tree", "NodeTree", "", "Node tree to remove."); 00682 RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL); 00683 00684 func= RNA_def_function(srna, "tag", "rna_Main_node_groups_tag"); 00685 parm= RNA_def_boolean(func, "value", 0, "Value", ""); 00686 RNA_def_property_flag(parm, PROP_REQUIRED); 00687 } 00688 void RNA_def_main_meshes(BlenderRNA *brna, PropertyRNA *cprop) 00689 { 00690 StructRNA *srna; 00691 FunctionRNA *func; 00692 PropertyRNA *parm; 00693 00694 RNA_def_property_srna(cprop, "BlendDataMeshes"); 00695 srna= RNA_def_struct(brna, "BlendDataMeshes", NULL); 00696 RNA_def_struct_sdna(srna, "Main"); 00697 RNA_def_struct_ui_text(srna, "Main Meshes", "Collection of meshes"); 00698 00699 func= RNA_def_function(srna, "new", "rna_Main_meshes_new"); 00700 RNA_def_function_ui_description(func, "Add a new mesh to the main database"); 00701 parm= RNA_def_string(func, "name", "Mesh", 0, "", "New name for the datablock."); 00702 RNA_def_property_flag(parm, PROP_REQUIRED); 00703 /* return type */ 00704 parm= RNA_def_pointer(func, "mesh", "Mesh", "", "New mesh datablock."); 00705 RNA_def_function_return(func, parm); 00706 00707 func= RNA_def_function(srna, "remove", "rna_Main_meshes_remove"); 00708 RNA_def_function_flag(func, FUNC_USE_REPORTS); 00709 RNA_def_function_ui_description(func, "Remove a mesh from the current blendfile."); 00710 parm= RNA_def_pointer(func, "mesh", "Mesh", "", "Mesh to remove."); 00711 RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL); 00712 00713 func= RNA_def_function(srna, "tag", "rna_Main_meshes_tag"); 00714 parm= RNA_def_boolean(func, "value", 0, "Value", ""); 00715 RNA_def_property_flag(parm, PROP_REQUIRED); 00716 } 00717 void RNA_def_main_lamps(BlenderRNA *brna, PropertyRNA *cprop) 00718 { 00719 StructRNA *srna; 00720 FunctionRNA *func; 00721 PropertyRNA *parm; 00722 00723 RNA_def_property_srna(cprop, "BlendDataLamps"); 00724 srna= RNA_def_struct(brna, "BlendDataLamps", NULL); 00725 RNA_def_struct_sdna(srna, "Main"); 00726 RNA_def_struct_ui_text(srna, "Main Lamps", "Collection of lamps"); 00727 00728 func= RNA_def_function(srna, "new", "rna_Main_lamps_new"); 00729 RNA_def_function_ui_description(func, "Add a new lamp to the main database"); 00730 parm= RNA_def_string(func, "name", "Lamp", 0, "", "New name for the datablock."); 00731 RNA_def_property_flag(parm, PROP_REQUIRED); 00732 parm= RNA_def_enum(func, "type", lamp_type_items, 0, "Type", "The type of texture to add"); 00733 RNA_def_property_flag(parm, PROP_REQUIRED); 00734 /* return type */ 00735 parm= RNA_def_pointer(func, "lamp", "Lamp", "", "New lamp datablock."); 00736 RNA_def_function_return(func, parm); 00737 00738 func= RNA_def_function(srna, "remove", "rna_Main_lamps_remove"); 00739 RNA_def_function_flag(func, FUNC_USE_REPORTS); 00740 RNA_def_function_ui_description(func, "Remove a lamp from the current blendfile."); 00741 parm= RNA_def_pointer(func, "lamp", "Lamp", "", "Lamp to remove."); 00742 RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL); 00743 00744 func= RNA_def_function(srna, "tag", "rna_Main_lamps_tag"); 00745 parm= RNA_def_boolean(func, "value", 0, "Value", ""); 00746 RNA_def_property_flag(parm, PROP_REQUIRED); 00747 } 00748 00749 void RNA_def_main_libraries(BlenderRNA *brna, PropertyRNA *cprop) 00750 { 00751 StructRNA *srna; 00752 FunctionRNA *func; 00753 PropertyRNA *parm; 00754 00755 RNA_def_property_srna(cprop, "BlendDataLibraries"); 00756 srna= RNA_def_struct(brna, "BlendDataLibraries", NULL); 00757 RNA_def_struct_sdna(srna, "Main"); 00758 RNA_def_struct_ui_text(srna, "Main Libraries", "Collection of libraries"); 00759 00760 func= RNA_def_function(srna, "tag", "rna_Main_libraries_tag"); 00761 parm= RNA_def_boolean(func, "value", 0, "Value", ""); 00762 RNA_def_property_flag(parm, PROP_REQUIRED); 00763 } 00764 00765 void RNA_def_main_screens(BlenderRNA *brna, PropertyRNA *cprop) 00766 { 00767 StructRNA *srna; 00768 FunctionRNA *func; 00769 PropertyRNA *parm; 00770 00771 RNA_def_property_srna(cprop, "BlendDataScreens"); 00772 srna= RNA_def_struct(brna, "BlendDataScreens", NULL); 00773 RNA_def_struct_sdna(srna, "Main"); 00774 RNA_def_struct_ui_text(srna, "Main Screens", "Collection of screens"); 00775 00776 func= RNA_def_function(srna, "tag", "rna_Main_screens_tag"); 00777 parm= RNA_def_boolean(func, "value", 0, "Value", ""); 00778 RNA_def_property_flag(parm, PROP_REQUIRED); 00779 } 00780 00781 void RNA_def_main_window_managers(BlenderRNA *brna, PropertyRNA *cprop) 00782 { 00783 StructRNA *srna; 00784 FunctionRNA *func; 00785 PropertyRNA *parm; 00786 00787 RNA_def_property_srna(cprop, "BlendDataWindowManagers"); 00788 srna= RNA_def_struct(brna, "BlendDataWindowManagers", NULL); 00789 RNA_def_struct_sdna(srna, "Main"); 00790 RNA_def_struct_ui_text(srna, "Main Window Managers", "Collection of window managers"); 00791 00792 func= RNA_def_function(srna, "tag", "rna_Main_window_managers_tag"); 00793 parm= RNA_def_boolean(func, "value", 0, "Value", ""); 00794 RNA_def_property_flag(parm, PROP_REQUIRED); 00795 } 00796 void RNA_def_main_images(BlenderRNA *brna, PropertyRNA *cprop) 00797 { 00798 StructRNA *srna; 00799 FunctionRNA *func; 00800 PropertyRNA *parm; 00801 00802 RNA_def_property_srna(cprop, "BlendDataImages"); 00803 srna= RNA_def_struct(brna, "BlendDataImages", NULL); 00804 RNA_def_struct_sdna(srna, "Main"); 00805 RNA_def_struct_ui_text(srna, "Main Images", "Collection of images"); 00806 00807 func= RNA_def_function(srna, "new", "rna_Main_images_new"); 00808 RNA_def_function_ui_description(func, "Add a new image to the main database"); 00809 parm= RNA_def_string(func, "name", "Image", 0, "", "New name for the datablock."); 00810 RNA_def_property_flag(parm, PROP_REQUIRED); 00811 parm= RNA_def_int(func, "width", 1024, 1, INT_MAX, "", "Width of the image.", 0, INT_MAX); 00812 RNA_def_property_flag(parm, PROP_REQUIRED); 00813 parm= RNA_def_int(func, "height", 1024, 1, INT_MAX, "", "Height of the image.", 0, INT_MAX); 00814 RNA_def_property_flag(parm, PROP_REQUIRED); 00815 RNA_def_boolean(func, "alpha", 0, "Alpha", "Use alpha channel"); 00816 RNA_def_boolean(func, "float_buffer", 0, "Float Buffer", "Create an image with floating point color"); 00817 /* return type */ 00818 parm= RNA_def_pointer(func, "image", "Image", "", "New image datablock."); 00819 RNA_def_function_return(func, parm); 00820 00821 func= RNA_def_function(srna, "load", "rna_Main_images_load"); 00822 RNA_def_function_flag(func, FUNC_USE_REPORTS); 00823 RNA_def_function_ui_description(func, "Load a new image into the main database"); 00824 parm= RNA_def_string_file_path(func, "filepath", "File Path", 0, "", "path of the file to load."); 00825 RNA_def_property_flag(parm, PROP_REQUIRED); 00826 /* return type */ 00827 parm= RNA_def_pointer(func, "image", "Image", "", "New image datablock."); 00828 RNA_def_function_return(func, parm); 00829 00830 func= RNA_def_function(srna, "remove", "rna_Main_images_remove"); 00831 RNA_def_function_flag(func, FUNC_USE_REPORTS); 00832 RNA_def_function_ui_description(func, "Remove an image from the current blendfile."); 00833 parm= RNA_def_pointer(func, "image", "Image", "", "Image to remove."); 00834 RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL); 00835 00836 func= RNA_def_function(srna, "tag", "rna_Main_images_tag"); 00837 parm= RNA_def_boolean(func, "value", 0, "Value", ""); 00838 RNA_def_property_flag(parm, PROP_REQUIRED); 00839 } 00840 00841 void RNA_def_main_lattices(BlenderRNA *brna, PropertyRNA *cprop) 00842 { 00843 StructRNA *srna; 00844 FunctionRNA *func; 00845 PropertyRNA *parm; 00846 00847 RNA_def_property_srna(cprop, "BlendDataLattices"); 00848 srna= RNA_def_struct(brna, "BlendDataLattices", NULL); 00849 RNA_def_struct_sdna(srna, "Main"); 00850 RNA_def_struct_ui_text(srna, "Main Lattices", "Collection of lattices"); 00851 00852 func= RNA_def_function(srna, "new", "rna_Main_lattices_new"); 00853 RNA_def_function_ui_description(func, "Add a new lattice to the main database"); 00854 parm= RNA_def_string(func, "name", "Lattice", 0, "", "New name for the datablock."); 00855 RNA_def_property_flag(parm, PROP_REQUIRED); 00856 /* return type */ 00857 parm= RNA_def_pointer(func, "lattice", "Lattice", "", "New lattices datablock."); 00858 RNA_def_function_return(func, parm); 00859 00860 func= RNA_def_function(srna, "remove", "rna_Main_lattices_remove"); 00861 RNA_def_function_flag(func, FUNC_USE_REPORTS); 00862 RNA_def_function_ui_description(func, "Remove a lattice from the current blendfile."); 00863 parm= RNA_def_pointer(func, "lattice", "Lattice", "", "Lattice to remove."); 00864 RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL); 00865 00866 func= RNA_def_function(srna, "tag", "rna_Main_lattices_tag"); 00867 parm= RNA_def_boolean(func, "value", 0, "Value", ""); 00868 RNA_def_property_flag(parm, PROP_REQUIRED); 00869 } 00870 void RNA_def_main_curves(BlenderRNA *brna, PropertyRNA *cprop) 00871 { 00872 StructRNA *srna; 00873 FunctionRNA *func; 00874 PropertyRNA *parm; 00875 00876 RNA_def_property_srna(cprop, "BlendDataCurves"); 00877 srna= RNA_def_struct(brna, "BlendDataCurves", NULL); 00878 RNA_def_struct_sdna(srna, "Main"); 00879 RNA_def_struct_ui_text(srna, "Main Curves", "Collection of curves"); 00880 00881 func= RNA_def_function(srna, "new", "rna_Main_curves_new"); 00882 RNA_def_function_ui_description(func, "Add a new curve to the main database"); 00883 parm= RNA_def_string(func, "name", "Curve", 0, "", "New name for the datablock."); 00884 RNA_def_property_flag(parm, PROP_REQUIRED); 00885 parm= RNA_def_enum(func, "type", object_type_curve_items, 0, "Type", "The type of curve to add"); 00886 RNA_def_property_flag(parm, PROP_REQUIRED); 00887 /* return type */ 00888 parm= RNA_def_pointer(func, "curve", "Curve", "", "New curve datablock."); 00889 RNA_def_function_return(func, parm); 00890 00891 func= RNA_def_function(srna, "remove", "rna_Main_curves_remove"); 00892 RNA_def_function_flag(func, FUNC_USE_REPORTS); 00893 RNA_def_function_ui_description(func, "Remove a curve from the current blendfile."); 00894 parm= RNA_def_pointer(func, "curve", "Curve", "", "Curve to remove."); 00895 RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL); 00896 00897 func= RNA_def_function(srna, "tag", "rna_Main_curves_tag"); 00898 parm= RNA_def_boolean(func, "value", 0, "Value", ""); 00899 RNA_def_property_flag(parm, PROP_REQUIRED); 00900 } 00901 void RNA_def_main_metaballs(BlenderRNA *brna, PropertyRNA *cprop) 00902 { 00903 StructRNA *srna; 00904 FunctionRNA *func; 00905 PropertyRNA *parm; 00906 00907 RNA_def_property_srna(cprop, "BlendDataMetaBalls"); 00908 srna= RNA_def_struct(brna, "BlendDataMetaBalls", NULL); 00909 RNA_def_struct_sdna(srna, "Main"); 00910 RNA_def_struct_ui_text(srna, "Main MetaBall", "Collection of metaballs"); 00911 00912 func= RNA_def_function(srna, "new", "rna_Main_metaballs_new"); 00913 RNA_def_function_ui_description(func, "Add a new metaball to the main database"); 00914 parm= RNA_def_string(func, "name", "MetaBall", 0, "", "New name for the datablock."); 00915 RNA_def_property_flag(parm, PROP_REQUIRED); 00916 /* return type */ 00917 parm= RNA_def_pointer(func, "metaball", "MetaBall", "", "New metaball datablock."); 00918 RNA_def_function_return(func, parm); 00919 00920 func= RNA_def_function(srna, "remove", "rna_Main_metaballs_remove"); 00921 RNA_def_function_flag(func, FUNC_USE_REPORTS); 00922 RNA_def_function_ui_description(func, "Remove a metaball from the current blendfile."); 00923 parm= RNA_def_pointer(func, "metaball", "MetaBall", "", "MetaBall to remove."); 00924 RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL); 00925 00926 func= RNA_def_function(srna, "tag", "rna_Main_metaballs_tag"); 00927 parm= RNA_def_boolean(func, "value", 0, "Value", ""); 00928 RNA_def_property_flag(parm, PROP_REQUIRED); 00929 } 00930 void RNA_def_main_fonts(BlenderRNA *brna, PropertyRNA *cprop) 00931 { 00932 StructRNA *srna; 00933 FunctionRNA *func; 00934 PropertyRNA *parm; 00935 00936 RNA_def_property_srna(cprop, "BlendDataFonts"); 00937 srna= RNA_def_struct(brna, "BlendDataFonts", NULL); 00938 RNA_def_struct_sdna(srna, "Main"); 00939 RNA_def_struct_ui_text(srna, "Main Fonts", "Collection of fonts"); 00940 00941 func= RNA_def_function(srna, "load", "rna_Main_fonts_load"); 00942 RNA_def_function_flag(func, FUNC_USE_REPORTS); 00943 RNA_def_function_ui_description(func, "Load a new font into the main database"); 00944 parm= RNA_def_string_file_path(func, "filepath", "File Path", 0, "", "path of the font to load."); 00945 RNA_def_property_flag(parm, PROP_REQUIRED); 00946 /* return type */ 00947 parm= RNA_def_pointer(func, "vfont", "VectorFont", "", "New font datablock."); 00948 RNA_def_function_return(func, parm); 00949 00950 func= RNA_def_function(srna, "remove", "rna_Main_fonts_remove"); 00951 RNA_def_function_flag(func, FUNC_USE_REPORTS); 00952 RNA_def_function_ui_description(func, "Remove a font from the current blendfile."); 00953 parm= RNA_def_pointer(func, "vfont", "VectorFont", "", "Font to remove."); 00954 RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL); 00955 00956 func= RNA_def_function(srna, "tag", "rna_Main_fonts_tag"); 00957 parm= RNA_def_boolean(func, "value", 0, "Value", ""); 00958 RNA_def_property_flag(parm, PROP_REQUIRED); 00959 } 00960 void RNA_def_main_textures(BlenderRNA *brna, PropertyRNA *cprop) 00961 { 00962 StructRNA *srna; 00963 FunctionRNA *func; 00964 PropertyRNA *parm; 00965 00966 RNA_def_property_srna(cprop, "BlendDataTextures"); 00967 srna= RNA_def_struct(brna, "BlendDataTextures", NULL); 00968 RNA_def_struct_sdna(srna, "Main"); 00969 RNA_def_struct_ui_text(srna, "Main Textures", "Collection of groups"); 00970 00971 func= RNA_def_function(srna, "new", "rna_Main_textures_new"); 00972 RNA_def_function_ui_description(func, "Add a new texture to the main database"); 00973 parm= RNA_def_string(func, "name", "Texture", 0, "", "New name for the datablock."); 00974 RNA_def_property_flag(parm, PROP_REQUIRED); 00975 parm= RNA_def_enum(func, "type", texture_type_items, 0, "Type", "The type of texture to add"); 00976 RNA_def_property_flag(parm, PROP_REQUIRED); 00977 /* return type */ 00978 parm= RNA_def_pointer(func, "texture", "Texture", "", "New texture datablock."); 00979 RNA_def_function_return(func, parm); 00980 00981 func= RNA_def_function(srna, "remove", "rna_Main_textures_remove"); 00982 RNA_def_function_flag(func, FUNC_USE_REPORTS); 00983 RNA_def_function_ui_description(func, "Remove a texture from the current blendfile."); 00984 parm= RNA_def_pointer(func, "texture", "Texture", "", "Texture to remove."); 00985 RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL); 00986 00987 func= RNA_def_function(srna, "tag", "rna_Main_textures_tag"); 00988 parm= RNA_def_boolean(func, "value", 0, "Value", ""); 00989 RNA_def_property_flag(parm, PROP_REQUIRED); 00990 } 00991 void RNA_def_main_brushes(BlenderRNA *brna, PropertyRNA *cprop) 00992 { 00993 StructRNA *srna; 00994 FunctionRNA *func; 00995 PropertyRNA *parm; 00996 00997 RNA_def_property_srna(cprop, "BlendDataBrushes"); 00998 srna= RNA_def_struct(brna, "BlendDataBrushes", NULL); 00999 RNA_def_struct_sdna(srna, "Main"); 01000 RNA_def_struct_ui_text(srna, "Main Brushes", "Collection of brushes"); 01001 01002 func= RNA_def_function(srna, "new", "rna_Main_brushes_new"); 01003 RNA_def_function_ui_description(func, "Add a new brush to the main database"); 01004 parm= RNA_def_string(func, "name", "Brush", 0, "", "New name for the datablock."); 01005 RNA_def_property_flag(parm, PROP_REQUIRED); 01006 /* return type */ 01007 parm= RNA_def_pointer(func, "brush", "Brush", "", "New brush datablock."); 01008 RNA_def_function_return(func, parm); 01009 01010 func= RNA_def_function(srna, "remove", "rna_Main_brushes_remove"); 01011 RNA_def_function_flag(func, FUNC_USE_REPORTS); 01012 RNA_def_function_ui_description(func, "Remove a brush from the current blendfile."); 01013 parm= RNA_def_pointer(func, "brush", "Brush", "", "Brush to remove."); 01014 RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL); 01015 01016 func= RNA_def_function(srna, "tag", "rna_Main_brushes_tag"); 01017 parm= RNA_def_boolean(func, "value", 0, "Value", ""); 01018 RNA_def_property_flag(parm, PROP_REQUIRED); 01019 } 01020 01021 void RNA_def_main_worlds(BlenderRNA *brna, PropertyRNA *cprop) 01022 { 01023 StructRNA *srna; 01024 FunctionRNA *func; 01025 PropertyRNA *parm; 01026 01027 RNA_def_property_srna(cprop, "BlendDataWorlds"); 01028 srna= RNA_def_struct(brna, "BlendDataWorlds", NULL); 01029 RNA_def_struct_sdna(srna, "Main"); 01030 RNA_def_struct_ui_text(srna, "Main Worlds", "Collection of worlds"); 01031 01032 func= RNA_def_function(srna, "new", "rna_Main_worlds_new"); 01033 RNA_def_function_ui_description(func, "Add a new world to the main database"); 01034 parm= RNA_def_string(func, "name", "World", 0, "", "New name for the datablock."); 01035 RNA_def_property_flag(parm, PROP_REQUIRED); 01036 /* return type */ 01037 parm= RNA_def_pointer(func, "world", "World", "", "New world datablock."); 01038 RNA_def_function_return(func, parm); 01039 01040 func= RNA_def_function(srna, "remove", "rna_Main_worlds_remove"); 01041 RNA_def_function_flag(func, FUNC_USE_REPORTS); 01042 RNA_def_function_ui_description(func, "Remove a world from the current blendfile."); 01043 parm= RNA_def_pointer(func, "world", "World", "", "World to remove."); 01044 RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL); 01045 01046 func= RNA_def_function(srna, "tag", "rna_Main_worlds_tag"); 01047 parm= RNA_def_boolean(func, "value", 0, "Value", ""); 01048 RNA_def_property_flag(parm, PROP_REQUIRED); 01049 } 01050 01051 void RNA_def_main_groups(BlenderRNA *brna, PropertyRNA *cprop) 01052 { 01053 StructRNA *srna; 01054 FunctionRNA *func; 01055 PropertyRNA *parm; 01056 01057 RNA_def_property_srna(cprop, "BlendDataGroups"); 01058 srna= RNA_def_struct(brna, "BlendDataGroups", NULL); 01059 RNA_def_struct_sdna(srna, "Main"); 01060 RNA_def_struct_ui_text(srna, "Main Groups", "Collection of groups"); 01061 01062 func= RNA_def_function(srna, "new", "rna_Main_groups_new"); 01063 RNA_def_function_ui_description(func, "Add a new group to the main database"); 01064 parm= RNA_def_string(func, "name", "Group", 0, "", "New name for the datablock."); 01065 RNA_def_property_flag(parm, PROP_REQUIRED); 01066 /* return type */ 01067 parm= RNA_def_pointer(func, "group", "Group", "", "New group datablock."); 01068 RNA_def_function_return(func, parm); 01069 01070 func= RNA_def_function(srna, "remove", "rna_Main_groups_remove"); 01071 RNA_def_function_ui_description(func, "Remove a group from the current blendfile."); 01072 parm= RNA_def_pointer(func, "group", "Group", "", "Group to remove."); 01073 RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL); 01074 01075 func= RNA_def_function(srna, "tag", "rna_Main_groups_tag"); 01076 parm= RNA_def_boolean(func, "value", 0, "Value", ""); 01077 RNA_def_property_flag(parm, PROP_REQUIRED); 01078 } 01079 void RNA_def_main_texts(BlenderRNA *brna, PropertyRNA *cprop) 01080 { 01081 StructRNA *srna; 01082 FunctionRNA *func; 01083 PropertyRNA *parm; 01084 01085 RNA_def_property_srna(cprop, "BlendDataTexts"); 01086 srna= RNA_def_struct(brna, "BlendDataTexts", NULL); 01087 RNA_def_struct_sdna(srna, "Main"); 01088 RNA_def_struct_ui_text(srna, "Main Texts", "Collection of texts"); 01089 01090 func= RNA_def_function(srna, "new", "rna_Main_texts_new"); 01091 RNA_def_function_ui_description(func, "Add a new text to the main database"); 01092 parm= RNA_def_string(func, "name", "Text", 0, "", "New name for the datablock."); 01093 RNA_def_property_flag(parm, PROP_REQUIRED); 01094 /* return type */ 01095 parm= RNA_def_pointer(func, "text", "Text", "", "New text datablock."); 01096 RNA_def_function_return(func, parm); 01097 01098 func= RNA_def_function(srna, "remove", "rna_Main_texts_remove"); 01099 RNA_def_function_ui_description(func, "Remove a text from the current blendfile."); 01100 parm= RNA_def_pointer(func, "text", "Text", "", "Text to remove."); 01101 RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL); 01102 01103 /* load func */ 01104 func= RNA_def_function(srna, "load", "rna_Main_texts_load"); 01105 RNA_def_function_flag(func, FUNC_USE_REPORTS); 01106 RNA_def_function_ui_description(func, "Add a new text to the main database from a file"); 01107 parm= RNA_def_string_file_path(func, "filepath", "Path", FILE_MAXDIR + FILE_MAXFILE, "", "path for the datablock."); 01108 RNA_def_property_flag(parm, PROP_REQUIRED); 01109 /* return type */ 01110 parm= RNA_def_pointer(func, "text", "Text", "", "New text datablock."); 01111 RNA_def_function_return(func, parm); 01112 01113 func= RNA_def_function(srna, "tag", "rna_Main_texts_tag"); 01114 parm= RNA_def_boolean(func, "value", 0, "Value", ""); 01115 RNA_def_property_flag(parm, PROP_REQUIRED); 01116 } 01117 01118 void RNA_def_main_sounds(BlenderRNA *brna, PropertyRNA *cprop) 01119 { 01120 StructRNA *srna; 01121 FunctionRNA *func; 01122 PropertyRNA *parm; 01123 01124 RNA_def_property_srna(cprop, "BlendDataSounds"); 01125 srna= RNA_def_struct(brna, "BlendDataSounds", NULL); 01126 RNA_def_struct_sdna(srna, "Main"); 01127 RNA_def_struct_ui_text(srna, "Main Sounds", "Collection of sounds"); 01128 01129 /* TODO, 'load' */ 01130 01131 func= RNA_def_function(srna, "tag", "rna_Main_sounds_tag"); 01132 parm= RNA_def_boolean(func, "value", 0, "Value", ""); 01133 RNA_def_property_flag(parm, PROP_REQUIRED); 01134 } 01135 01136 void RNA_def_main_armatures(BlenderRNA *brna, PropertyRNA *cprop) 01137 { 01138 StructRNA *srna; 01139 FunctionRNA *func; 01140 PropertyRNA *parm; 01141 01142 RNA_def_property_srna(cprop, "BlendDataArmatures"); 01143 srna= RNA_def_struct(brna, "BlendDataArmatures", NULL); 01144 RNA_def_struct_sdna(srna, "Main"); 01145 RNA_def_struct_ui_text(srna, "Main Armatures", "Collection of armatures"); 01146 01147 func= RNA_def_function(srna, "new", "rna_Main_armatures_new"); 01148 RNA_def_function_ui_description(func, "Add a new armature to the main database"); 01149 parm= RNA_def_string(func, "name", "Armature", 0, "", "New name for the datablock."); 01150 RNA_def_property_flag(parm, PROP_REQUIRED); 01151 /* return type */ 01152 parm= RNA_def_pointer(func, "armature", "Armature", "", "New armature datablock."); 01153 RNA_def_function_return(func, parm); 01154 01155 func= RNA_def_function(srna, "remove", "rna_Main_armatures_remove"); 01156 RNA_def_function_flag(func, FUNC_USE_REPORTS); 01157 RNA_def_function_ui_description(func, "Remove a armature from the current blendfile."); 01158 parm= RNA_def_pointer(func, "armature", "Armature", "", "Armature to remove."); 01159 RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL); 01160 01161 func= RNA_def_function(srna, "tag", "rna_Main_armatures_tag"); 01162 parm= RNA_def_boolean(func, "value", 0, "Value", ""); 01163 RNA_def_property_flag(parm, PROP_REQUIRED); 01164 } 01165 void RNA_def_main_actions(BlenderRNA *brna, PropertyRNA *cprop) 01166 { 01167 StructRNA *srna; 01168 FunctionRNA *func; 01169 PropertyRNA *parm; 01170 01171 RNA_def_property_srna(cprop, "BlendDataActions"); 01172 srna= RNA_def_struct(brna, "BlendDataActions", NULL); 01173 RNA_def_struct_sdna(srna, "Main"); 01174 RNA_def_struct_ui_text(srna, "Main Actions", "Collection of actions"); 01175 01176 func= RNA_def_function(srna, "new", "rna_Main_actions_new"); 01177 RNA_def_function_ui_description(func, "Add a new action to the main database"); 01178 parm= RNA_def_string(func, "name", "Action", 0, "", "New name for the datablock."); 01179 RNA_def_property_flag(parm, PROP_REQUIRED); 01180 /* return type */ 01181 parm= RNA_def_pointer(func, "action", "Action", "", "New action datablock."); 01182 RNA_def_function_return(func, parm); 01183 01184 func= RNA_def_function(srna, "remove", "rna_Main_actions_remove"); 01185 RNA_def_function_flag(func, FUNC_USE_REPORTS); 01186 RNA_def_function_ui_description(func, "Remove a action from the current blendfile."); 01187 parm= RNA_def_pointer(func, "action", "Action", "", "Action to remove."); 01188 RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL); 01189 01190 func= RNA_def_function(srna, "tag", "rna_Main_actions_tag"); 01191 parm= RNA_def_boolean(func, "value", 0, "Value", ""); 01192 RNA_def_property_flag(parm, PROP_REQUIRED); 01193 } 01194 void RNA_def_main_particles(BlenderRNA *brna, PropertyRNA *cprop) 01195 { 01196 StructRNA *srna; 01197 FunctionRNA *func; 01198 PropertyRNA *parm; 01199 01200 RNA_def_property_srna(cprop, "BlendDataParticles"); 01201 srna= RNA_def_struct(brna, "BlendDataParticles", NULL); 01202 RNA_def_struct_sdna(srna, "Main"); 01203 RNA_def_struct_ui_text(srna, "Main Particle Settings", "Collection of particle settings"); 01204 01205 func= RNA_def_function(srna, "new", "rna_Main_particles_new"); 01206 RNA_def_function_ui_description(func, "Add a new particle settings instance to the main database"); 01207 parm= RNA_def_string(func, "name", "ParticleSettings", 0, "", "New name for the datablock."); 01208 RNA_def_property_flag(parm, PROP_REQUIRED); 01209 /* return type */ 01210 parm= RNA_def_pointer(func, "particle", "ParticleSettings", "", "New particle settings datablock."); 01211 RNA_def_function_return(func, parm); 01212 01213 func= RNA_def_function(srna, "remove", "rna_Main_particles_remove"); 01214 RNA_def_function_flag(func, FUNC_USE_REPORTS); 01215 RNA_def_function_ui_description(func, "Remove a particle settings instance from the current blendfile."); 01216 parm= RNA_def_pointer(func, "particle", "ParticleSettings", "", "Particle Settings to remove."); 01217 RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL); 01218 01219 func= RNA_def_function(srna, "tag", "rna_Main_particles_tag"); 01220 parm= RNA_def_boolean(func, "value", 0, "Value", ""); 01221 RNA_def_property_flag(parm, PROP_REQUIRED); 01222 } 01223 01224 void RNA_def_main_gpencil(BlenderRNA *brna, PropertyRNA *cprop) 01225 { 01226 StructRNA *srna; 01227 FunctionRNA *func; 01228 PropertyRNA *parm; 01229 01230 RNA_def_property_srna(cprop, "BlendDataGreasePencils"); 01231 srna= RNA_def_struct(brna, "BlendDataGreasePencils", NULL); 01232 RNA_def_struct_sdna(srna, "Main"); 01233 RNA_def_struct_ui_text(srna, "Main Grease Pencils", "Collection of grease pencils"); 01234 01235 func= RNA_def_function(srna, "tag", "rna_Main_gpencil_tag"); 01236 parm= RNA_def_boolean(func, "value", 0, "Value", ""); 01237 RNA_def_property_flag(parm, PROP_REQUIRED); 01238 } 01239 01240 #endif 01241