diff options
Diffstat (limited to 'source/blender/makesrna/intern/rna_main_api.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_main_api.c | 289 |
1 files changed, 230 insertions, 59 deletions
diff --git a/source/blender/makesrna/intern/rna_main_api.c b/source/blender/makesrna/intern/rna_main_api.c index b244d8ee5d3..c13bfaca8bb 100644 --- a/source/blender/makesrna/intern/rna_main_api.c +++ b/source/blender/makesrna/intern/rna_main_api.c @@ -79,15 +79,15 @@ #include "ED_screen.h" -Tex *rna_Main_add_texture(Main *bmain, char *name) +Tex *rna_Main_add_texture(Main *bmain, const char *name) { return add_texture(name); } -Camera *rna_Main_cameras_new(Main *bmain, char* name) +Camera *rna_Main_cameras_new(Main *bmain, const char *name) { ID *id= add_camera(name); - id->us--; + id_us_min(id); return (Camera *)id; } void rna_Main_cameras_remove(Main *bmain, ReportList *reports, struct Camera *camera) @@ -100,7 +100,7 @@ void rna_Main_cameras_remove(Main *bmain, ReportList *reports, struct Camera *ca /* XXX python now has invalid pointer? */ } -Scene *rna_Main_scenes_new(Main *bmain, char* name) +Scene *rna_Main_scenes_new(Main *bmain, const char *name) { return add_scene(name); } @@ -118,12 +118,13 @@ void rna_Main_scenes_remove(Main *bmain, bContext *C, ReportList *reports, struc return; } - ED_screen_set_scene(C, newscene); + if(CTX_wm_screen(C)->scene == scene) + ED_screen_set_scene(C, newscene); unlink_scene(bmain, scene, newscene); } -Object *rna_Main_objects_new(Main *bmain, ReportList *reports, char* name, ID *data) +Object *rna_Main_objects_new(Main *bmain, ReportList *reports, const char *name, ID *data) { Object *ob; int type= OB_EMPTY; @@ -161,11 +162,11 @@ Object *rna_Main_objects_new(Main *bmain, ReportList *reports, char* name, ID *d } } - data->us++; + id_us_plus(data); } ob= add_only_object(type, name); - ob->id.us--; + id_us_min(&ob->id); ob->data= data; test_object_materials(ob->data); @@ -176,7 +177,7 @@ Object *rna_Main_objects_new(Main *bmain, ReportList *reports, char* name, ID *d void rna_Main_objects_remove(Main *bmain, ReportList *reports, struct Object *object) { if(ID_REAL_USERS(object) <= 0) { - unlink_object(NULL, object); /* needed or ID pointers to this are not cleared */ + unlink_object(object); /* needed or ID pointers to this are not cleared */ free_libblock(&bmain->object, object); } else { @@ -184,10 +185,10 @@ void rna_Main_objects_remove(Main *bmain, ReportList *reports, struct Object *ob } } -struct Material *rna_Main_materials_new(Main *bmain, char* name) +struct Material *rna_Main_materials_new(Main *bmain, const char *name) { ID *id= (ID *)add_material(name); - id->us--; + id_us_min(id); return (Material *)id; } void rna_Main_materials_remove(Main *bmain, ReportList *reports, struct Material *material) @@ -200,11 +201,13 @@ void rna_Main_materials_remove(Main *bmain, ReportList *reports, struct Material /* XXX python now has invalid pointer? */ } -// XXX, commended for now, need to see how this can be used with node groups. -struct bNodeTree *rna_Main_nodetree_new(Main *bmain, int type) +struct bNodeTree *rna_Main_nodetree_new(Main *bmain, const char *name, int type) { - bNodeTree *tree = ntreeAddTree(type); - tree->id.us--; + bNodeTree *tree = ntreeAddTree(name, type, TRUE); + + ntreeMakeOwnType(tree); + + id_us_min(&tree->id); return tree; } void rna_Main_nodetree_remove(Main *bmain, ReportList *reports, struct bNodeTree *tree) @@ -217,10 +220,10 @@ void rna_Main_nodetree_remove(Main *bmain, ReportList *reports, struct bNodeTree /* XXX python now has invalid pointer? */ } -Mesh *rna_Main_meshes_new(Main *bmain, char* name) +Mesh *rna_Main_meshes_new(Main *bmain, const char *name) { Mesh *me= add_mesh(name); - me->id.us--; + id_us_min(&me->id); return me; } void rna_Main_meshes_remove(Main *bmain, ReportList *reports, Mesh *mesh) @@ -233,10 +236,11 @@ void rna_Main_meshes_remove(Main *bmain, ReportList *reports, Mesh *mesh) /* XXX python now has invalid pointer? */ } -Lamp *rna_Main_lamps_new(Main *bmain, char* name) +Lamp *rna_Main_lamps_new(Main *bmain, const char *name, int type) { Lamp *lamp= add_lamp(name); - lamp->id.us--; + lamp->type= type; + id_us_min(&lamp->id); return lamp; } void rna_Main_lamps_remove(Main *bmain, ReportList *reports, Lamp *lamp) @@ -249,19 +253,19 @@ void rna_Main_lamps_remove(Main *bmain, ReportList *reports, Lamp *lamp) /* XXX python now has invalid pointer? */ } -Image *rna_Main_images_new(Main *bmain, char* name, int width, int height, int alpha, int float_buffer) +Image *rna_Main_images_new(Main *bmain, const char *name, int width, int height, int alpha, int float_buffer) { float color[4]= {0.0, 0.0, 0.0, 1.0}; Image *image= BKE_add_image_size(width, height, name, alpha ? 32:24, float_buffer, 0, color); - image->id.us--; + id_us_min(&image->id); return image; } -Image *rna_Main_images_load(Main *bmain, ReportList *reports, char *filepath) +Image *rna_Main_images_load(Main *bmain, ReportList *reports, const char *filepath) { Image *ima; errno= 0; - ima= BKE_add_image_file(filepath, 0); + ima= BKE_add_image_file(filepath); if(!ima) BKE_reportf(reports, RPT_ERROR, "Can't read: \"%s\", %s.", filepath, errno ? strerror(errno) : "Unsupported image format"); @@ -278,10 +282,10 @@ void rna_Main_images_remove(Main *bmain, ReportList *reports, Image *image) /* XXX python now has invalid pointer? */ } -Lattice *rna_Main_lattices_new(Main *bmain, char* name) +Lattice *rna_Main_lattices_new(Main *bmain, const char *name) { Lattice *lt= add_lattice(name); - lt->id.us--; + id_us_min(<->id); return lt; } void rna_Main_lattices_remove(Main *bmain, ReportList *reports, struct Lattice *lt) @@ -292,10 +296,10 @@ void rna_Main_lattices_remove(Main *bmain, ReportList *reports, struct Lattice * BKE_reportf(reports, RPT_ERROR, "Lattice \"%s\" must have zero users to be removed, found %d.", lt->id.name+2, ID_REAL_USERS(lt)); } -Curve *rna_Main_curves_new(Main *bmain, char* name, int type) +Curve *rna_Main_curves_new(Main *bmain, const char *name, int type) { Curve *cu= add_curve(name, type); - cu->id.us--; + id_us_min(&cu->id); return cu; } void rna_Main_curves_remove(Main *bmain, ReportList *reports, struct Curve *cu) @@ -306,10 +310,10 @@ void rna_Main_curves_remove(Main *bmain, ReportList *reports, struct Curve *cu) BKE_reportf(reports, RPT_ERROR, "Curve \"%s\" must have zero users to be removed, found %d.", cu->id.name+2, ID_REAL_USERS(cu)); } -MetaBall *rna_Main_metaballs_new(Main *bmain, char* name) +MetaBall *rna_Main_metaballs_new(Main *bmain, const char *name) { MetaBall *mb= add_mball(name); - mb->id.us--; + id_us_min(&mb->id); return mb; } void rna_Main_metaballs_remove(Main *bmain, ReportList *reports, struct MetaBall *mb) @@ -320,7 +324,7 @@ void rna_Main_metaballs_remove(Main *bmain, ReportList *reports, struct MetaBall BKE_reportf(reports, RPT_ERROR, "MetaBall \"%s\" must have zero users to be removed, found %d.", mb->id.name+2, ID_REAL_USERS(mb)); } -VFont *rna_Main_fonts_load(Main *bmain, ReportList *reports, char *filepath) +VFont *rna_Main_fonts_load(Main *bmain, ReportList *reports, const char *filepath) { VFont *font; @@ -343,11 +347,11 @@ void rna_Main_fonts_remove(Main *bmain, ReportList *reports, VFont *vfont) /* XXX python now has invalid pointer? */ } -Tex *rna_Main_textures_new(Main *bmain, char* name, int type) +Tex *rna_Main_textures_new(Main *bmain, const char *name, int type) { Tex *tex= add_texture(name); tex_set_type(tex, type); - tex->id.us--; + id_us_min(&tex->id); return tex; } void rna_Main_textures_remove(Main *bmain, ReportList *reports, struct Tex *tex) @@ -358,10 +362,10 @@ void rna_Main_textures_remove(Main *bmain, ReportList *reports, struct Tex *tex) BKE_reportf(reports, RPT_ERROR, "Texture \"%s\" must have zero users to be removed, found %d.", tex->id.name+2, ID_REAL_USERS(tex)); } -Brush *rna_Main_brushes_new(Main *bmain, char* name) +Brush *rna_Main_brushes_new(Main *bmain, const char *name) { Brush *brush = add_brush(name); - brush->id.us--; + id_us_min(&brush->id); return brush; } void rna_Main_brushes_remove(Main *bmain, ReportList *reports, struct Brush *brush) @@ -372,10 +376,10 @@ void rna_Main_brushes_remove(Main *bmain, ReportList *reports, struct Brush *bru BKE_reportf(reports, RPT_ERROR, "Brush \"%s\" must have zero users to be removed, found %d.", brush->id.name+2, ID_REAL_USERS(brush)); } -World *rna_Main_worlds_new(Main *bmain, char* name) +World *rna_Main_worlds_new(Main *bmain, const char *name) { World *world = add_world(name); - world->id.us--; + id_us_min(&world->id); return world; } void rna_Main_worlds_remove(Main *bmain, ReportList *reports, struct World *world) @@ -386,7 +390,7 @@ void rna_Main_worlds_remove(Main *bmain, ReportList *reports, struct World *worl BKE_reportf(reports, RPT_ERROR, "World \"%s\" must have zero users to be removed, found %d.", world->id.name+2, ID_REAL_USERS(world)); } -Group *rna_Main_groups_new(Main *bmain, char* name) +Group *rna_Main_groups_new(Main *bmain, const char *name) { return add_group(name); } @@ -397,7 +401,7 @@ void rna_Main_groups_remove(Main *bmain, ReportList *reports, Group *group) /* XXX python now has invalid pointer? */ } -Text *rna_Main_texts_new(Main *bmain, char* name) +Text *rna_Main_texts_new(Main *bmain, const char *name) { return add_empty_text(name); } @@ -408,7 +412,7 @@ void rna_Main_texts_remove(Main *bmain, ReportList *reports, Text *text) /* XXX python now has invalid pointer? */ } -Text *rna_Main_texts_load(Main *bmain, ReportList *reports, char* filepath) +Text *rna_Main_texts_load(Main *bmain, ReportList *reports, const char *filepath) { Text *txt; @@ -421,10 +425,10 @@ Text *rna_Main_texts_load(Main *bmain, ReportList *reports, char* filepath) return txt; } -bArmature *rna_Main_armatures_new(Main *bmain, char* name) +bArmature *rna_Main_armatures_new(Main *bmain, const char *name) { bArmature *arm= add_armature(name); - arm->id.us--; + id_us_min(&arm->id); return arm; } void rna_Main_armatures_remove(Main *bmain, ReportList *reports, bArmature *arm) @@ -437,10 +441,10 @@ void rna_Main_armatures_remove(Main *bmain, ReportList *reports, bArmature *arm) /* XXX python now has invalid pointer? */ } -bAction *rna_Main_actions_new(Main *bmain, char* name) +bAction *rna_Main_actions_new(Main *bmain, const char *name) { bAction *act= add_empty_action(name); - act->id.us--; + id_us_min(&act->id); act->id.flag &= ~LIB_FAKEUSER; return act; } @@ -454,10 +458,10 @@ void rna_Main_actions_remove(Main *bmain, ReportList *reports, bAction *act) /* XXX python now has invalid pointer? */ } -ParticleSettings *rna_Main_particles_new(Main *bmain, char* name) +ParticleSettings *rna_Main_particles_new(Main *bmain, const char *name) { ParticleSettings *part = psys_new_settings(name, bmain); - part->id.us--; + id_us_min(&part->id); return part; } void rna_Main_particles_remove(Main *bmain, ReportList *reports, ParticleSettings *part) @@ -470,6 +474,35 @@ void rna_Main_particles_remove(Main *bmain, ReportList *reports, ParticleSetting /* XXX python now has invalid pointer? */ } +/* tag functions, all the same */ +void rna_Main_cameras_tag(Main *bmain, int value) { tag_main_lb(&bmain->camera, value); } +void rna_Main_scenes_tag(Main *bmain, int value) { tag_main_lb(&bmain->scene, value); } +void rna_Main_objects_tag(Main *bmain, int value) { tag_main_lb(&bmain->object, value); } +void rna_Main_materials_tag(Main *bmain, int value) { tag_main_lb(&bmain->mat, value); } +void rna_Main_node_groups_tag(Main *bmain, int value) { tag_main_lb(&bmain->nodetree, value); } +void rna_Main_meshes_tag(Main *bmain, int value) { tag_main_lb(&bmain->mesh, value); } +void rna_Main_lamps_tag(Main *bmain, int value) { tag_main_lb(&bmain->lamp, value); } +void rna_Main_libraries_tag(Main *bmain, int value) { tag_main_lb(&bmain->library, value); } +void rna_Main_screens_tag(Main *bmain, int value) { tag_main_lb(&bmain->screen, value); } +void rna_Main_window_managers_tag(Main *bmain, int value) { tag_main_lb(&bmain->wm, value); } +void rna_Main_images_tag(Main *bmain, int value) { tag_main_lb(&bmain->image, value); } +void rna_Main_lattices_tag(Main *bmain, int value) { tag_main_lb(&bmain->latt, value); } +void rna_Main_curves_tag(Main *bmain, int value) { tag_main_lb(&bmain->curve, value); } +void rna_Main_metaballs_tag(Main *bmain, int value) { tag_main_lb(&bmain->mball, value); } +void rna_Main_fonts_tag(Main *bmain, int value) { tag_main_lb(&bmain->vfont, value); } +void rna_Main_textures_tag(Main *bmain, int value) { tag_main_lb(&bmain->tex, value); } +void rna_Main_brushes_tag(Main *bmain, int value) { tag_main_lb(&bmain->brush, value); } +void rna_Main_worlds_tag(Main *bmain, int value) { tag_main_lb(&bmain->world, value); } +void rna_Main_groups_tag(Main *bmain, int value) { tag_main_lb(&bmain->group, value); } +void rna_Main_shape_keys_tag(Main *bmain, int value) { tag_main_lb(&bmain->key, value); } +void rna_Main_scripts_tag(Main *bmain, int value) { tag_main_lb(&bmain->script, value); } +void rna_Main_texts_tag(Main *bmain, int value) { tag_main_lb(&bmain->text, value); } +void rna_Main_sounds_tag(Main *bmain, int value) { tag_main_lb(&bmain->sound, value); } +void rna_Main_armatures_tag(Main *bmain, int value) { tag_main_lb(&bmain->armature, value); } +void rna_Main_actions_tag(Main *bmain, int value) { tag_main_lb(&bmain->action, value); } +void rna_Main_particles_tag(Main *bmain, int value) { tag_main_lb(&bmain->particle, value); } +void rna_Main_gpencil_tag(Main *bmain, int value) { tag_main_lb(&bmain->gpencil, value); } + #else void RNA_api_main(StructRNA *srna) @@ -483,7 +516,7 @@ void RNA_api_main(StructRNA *srna) /* func= RNA_def_function(srna, "add_image", "rna_Main_add_image"); RNA_def_function_ui_description(func, "Add a new image."); - parm= RNA_def_string(func, "filepath", "", 0, "", "File path to load image from."); + parm= RNA_def_string_file_path(func, "filepath", "", 0, "", "File path to load image from."); RNA_def_property_flag(parm, PROP_REQUIRED); parm= RNA_def_pointer(func, "image", "Image", "", "New image."); RNA_def_function_return(func, parm); @@ -514,6 +547,10 @@ void RNA_def_main_cameras(BlenderRNA *brna, PropertyRNA *cprop) RNA_def_function_ui_description(func, "Remove a camera from the current blendfile."); parm= RNA_def_pointer(func, "camera", "Camera", "", "Camera to remove."); RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL); + + func= RNA_def_function(srna, "tag", "rna_Main_cameras_tag"); + parm= RNA_def_boolean(func, "value", 0, "Value", ""); + RNA_def_property_flag(parm, PROP_REQUIRED); } void RNA_def_main_scenes(BlenderRNA *brna, PropertyRNA *cprop) @@ -568,6 +605,10 @@ void RNA_def_main_objects(BlenderRNA *brna, PropertyRNA *cprop) RNA_def_function_flag(func, FUNC_USE_REPORTS); parm= RNA_def_pointer(func, "object", "Object", "", "Object to remove."); RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL); + + func= RNA_def_function(srna, "tag", "rna_Main_objects_tag"); + parm= RNA_def_boolean(func, "value", 0, "Value", ""); + RNA_def_property_flag(parm, PROP_REQUIRED); } void RNA_def_main_materials(BlenderRNA *brna, PropertyRNA *cprop) @@ -593,27 +634,32 @@ void RNA_def_main_materials(BlenderRNA *brna, PropertyRNA *cprop) RNA_def_function_ui_description(func, "Remove a material from the current blendfile."); parm= RNA_def_pointer(func, "material", "Material", "", "Material to remove."); RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL); + + func= RNA_def_function(srna, "tag", "rna_Main_materials_tag"); + parm= RNA_def_boolean(func, "value", 0, "Value", ""); + RNA_def_property_flag(parm, PROP_REQUIRED); } void RNA_def_main_node_groups(BlenderRNA *brna, PropertyRNA *cprop) { StructRNA *srna; -// FunctionRNA *func; -// PropertyRNA *parm; + FunctionRNA *func; + PropertyRNA *parm; -/* static EnumPropertyItem node_nodetree_items[] = { + static EnumPropertyItem node_nodetree_items[] = { {0, "SHADER", 0, "Shader", ""}, {1, "COMPOSITE", 0, "Composite", ""}, {2, "TEXTURE", 0, "Texture", ""}, - {0, NULL, 0, NULL, NULL}}; */ + {0, NULL, 0, NULL, NULL}}; RNA_def_property_srna(cprop, "MainNodeTrees"); srna= RNA_def_struct(brna, "MainNodeTrees", NULL); RNA_def_struct_ui_text(srna, "Main Node Trees", "Collection of node trees"); -#if 0 // need to see some examples of using these functions before enabling. func= RNA_def_function(srna, "new", "rna_Main_nodetree_new"); RNA_def_function_ui_description(func, "Add a new node tree to the main database"); - parm= RNA_def_enum(func, "type", node_nodetree_items, 0, "Type", "The type of curve object to add"); + parm= RNA_def_string(func, "name", "NodeGroup", 0, "", "New name for the datablock."); + RNA_def_property_flag(parm, PROP_REQUIRED); + parm= RNA_def_enum(func, "type", node_nodetree_items, 0, "Type", "The type of node_group to add"); RNA_def_property_flag(parm, PROP_REQUIRED); /* return type */ parm= RNA_def_pointer(func, "tree", "NodeTree", "", "New node tree datablock."); @@ -624,7 +670,10 @@ void RNA_def_main_node_groups(BlenderRNA *brna, PropertyRNA *cprop) RNA_def_function_ui_description(func, "Remove a node tree from the current blendfile."); parm= RNA_def_pointer(func, "tree", "NodeTree", "", "Node tree to remove."); RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL); -#endif + + func= RNA_def_function(srna, "tag", "rna_Main_node_groups_tag"); + parm= RNA_def_boolean(func, "value", 0, "Value", ""); + RNA_def_property_flag(parm, PROP_REQUIRED); } void RNA_def_main_meshes(BlenderRNA *brna, PropertyRNA *cprop) { @@ -649,6 +698,10 @@ void RNA_def_main_meshes(BlenderRNA *brna, PropertyRNA *cprop) RNA_def_function_ui_description(func, "Remove a mesh from the current blendfile."); parm= RNA_def_pointer(func, "mesh", "Mesh", "", "Mesh to remove."); RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL); + + func= RNA_def_function(srna, "tag", "rna_Main_meshes_tag"); + parm= RNA_def_boolean(func, "value", 0, "Value", ""); + RNA_def_property_flag(parm, PROP_REQUIRED); } void RNA_def_main_lamps(BlenderRNA *brna, PropertyRNA *cprop) { @@ -664,6 +717,8 @@ void RNA_def_main_lamps(BlenderRNA *brna, PropertyRNA *cprop) RNA_def_function_ui_description(func, "Add a new lamp to the main database"); parm= RNA_def_string(func, "name", "Lamp", 0, "", "New name for the datablock."); RNA_def_property_flag(parm, PROP_REQUIRED); + parm= RNA_def_enum(func, "type", lamp_type_items, 0, "Type", "The type of texture to add"); + RNA_def_property_flag(parm, PROP_REQUIRED); /* return type */ parm= RNA_def_pointer(func, "lamp", "Lamp", "", "New lamp datablock."); RNA_def_function_return(func, parm); @@ -673,18 +728,55 @@ void RNA_def_main_lamps(BlenderRNA *brna, PropertyRNA *cprop) RNA_def_function_ui_description(func, "Remove a lamp from the current blendfile."); parm= RNA_def_pointer(func, "lamp", "Lamp", "", "Lamp to remove."); RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL); + + func= RNA_def_function(srna, "tag", "rna_Main_lamps_tag"); + parm= RNA_def_boolean(func, "value", 0, "Value", ""); + RNA_def_property_flag(parm, PROP_REQUIRED); } + void RNA_def_main_libraries(BlenderRNA *brna, PropertyRNA *cprop) { + StructRNA *srna; + FunctionRNA *func; + PropertyRNA *parm; + RNA_def_property_srna(cprop, "MainLibraries"); + srna= RNA_def_struct(brna, "MainLibraries", NULL); + RNA_def_struct_ui_text(srna, "Main Libraries", "Collection of libraries"); + + func= RNA_def_function(srna, "tag", "rna_Main_libraries_tag"); + parm= RNA_def_boolean(func, "value", 0, "Value", ""); + RNA_def_property_flag(parm, PROP_REQUIRED); } + void RNA_def_main_screens(BlenderRNA *brna, PropertyRNA *cprop) { + StructRNA *srna; + FunctionRNA *func; + PropertyRNA *parm; + + RNA_def_property_srna(cprop, "MainScreens"); + srna= RNA_def_struct(brna, "MainScreens", NULL); + RNA_def_struct_ui_text(srna, "Main Screens", "Collection of screens"); + func= RNA_def_function(srna, "tag", "rna_Main_screens_tag"); + parm= RNA_def_boolean(func, "value", 0, "Value", ""); + RNA_def_property_flag(parm, PROP_REQUIRED); } + void RNA_def_main_window_managers(BlenderRNA *brna, PropertyRNA *cprop) { - + StructRNA *srna; + FunctionRNA *func; + PropertyRNA *parm; + + RNA_def_property_srna(cprop, "MainWindowManagers"); + srna= RNA_def_struct(brna, "MainWindowManagers", NULL); + RNA_def_struct_ui_text(srna, "Main Window Managers", "Collection of window managers"); + + func= RNA_def_function(srna, "tag", "rna_Main_window_managers_tag"); + parm= RNA_def_boolean(func, "value", 0, "Value", ""); + RNA_def_property_flag(parm, PROP_REQUIRED); } void RNA_def_main_images(BlenderRNA *brna, PropertyRNA *cprop) { @@ -701,9 +793,11 @@ void RNA_def_main_images(BlenderRNA *brna, PropertyRNA *cprop) parm= RNA_def_string(func, "name", "Image", 0, "", "New name for the datablock."); RNA_def_property_flag(parm, PROP_REQUIRED); parm= RNA_def_int(func, "width", 1024, 1, INT_MAX, "", "Width of the image.", 0, INT_MAX); + RNA_def_property_flag(parm, PROP_REQUIRED); parm= RNA_def_int(func, "height", 1024, 1, INT_MAX, "", "Height of the image.", 0, INT_MAX); - parm= RNA_def_boolean(func, "alpha", 0, "Alpha", "Use alpha channel"); - parm= RNA_def_boolean(func, "float_buffer", 0, "Float Buffer", "Create an image with floating point color"); + RNA_def_property_flag(parm, PROP_REQUIRED); + RNA_def_boolean(func, "alpha", 0, "Alpha", "Use alpha channel"); + RNA_def_boolean(func, "float_buffer", 0, "Float Buffer", "Create an image with floating point color"); /* return type */ parm= RNA_def_pointer(func, "image", "Image", "", "New image datablock."); RNA_def_function_return(func, parm); @@ -711,7 +805,7 @@ void RNA_def_main_images(BlenderRNA *brna, PropertyRNA *cprop) func= RNA_def_function(srna, "load", "rna_Main_images_load"); RNA_def_function_flag(func, FUNC_USE_REPORTS); RNA_def_function_ui_description(func, "Load a new image into the main database"); - parm= RNA_def_string(func, "filepath", "File Path", 0, "", "path of the file to load."); + parm= RNA_def_string_file_path(func, "filepath", "File Path", 0, "", "path of the file to load."); RNA_def_property_flag(parm, PROP_REQUIRED); /* return type */ parm= RNA_def_pointer(func, "image", "Image", "", "New image datablock."); @@ -722,6 +816,10 @@ void RNA_def_main_images(BlenderRNA *brna, PropertyRNA *cprop) RNA_def_function_ui_description(func, "Remove an image from the current blendfile."); parm= RNA_def_pointer(func, "image", "Image", "", "Image to remove."); RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL); + + func= RNA_def_function(srna, "tag", "rna_Main_images_tag"); + parm= RNA_def_boolean(func, "value", 0, "Value", ""); + RNA_def_property_flag(parm, PROP_REQUIRED); } void RNA_def_main_lattices(BlenderRNA *brna, PropertyRNA *cprop) @@ -747,6 +845,10 @@ void RNA_def_main_lattices(BlenderRNA *brna, PropertyRNA *cprop) RNA_def_function_ui_description(func, "Remove a lattice from the current blendfile."); parm= RNA_def_pointer(func, "lattice", "Lattice", "", "Lattice to remove."); RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL); + + func= RNA_def_function(srna, "tag", "rna_Main_lattices_tag"); + parm= RNA_def_boolean(func, "value", 0, "Value", ""); + RNA_def_property_flag(parm, PROP_REQUIRED); } void RNA_def_main_curves(BlenderRNA *brna, PropertyRNA *cprop) { @@ -773,6 +875,10 @@ void RNA_def_main_curves(BlenderRNA *brna, PropertyRNA *cprop) RNA_def_function_ui_description(func, "Remove a curve from the current blendfile."); parm= RNA_def_pointer(func, "curve", "Curve", "", "Curve to remove."); RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL); + + func= RNA_def_function(srna, "tag", "rna_Main_curves_tag"); + parm= RNA_def_boolean(func, "value", 0, "Value", ""); + RNA_def_property_flag(parm, PROP_REQUIRED); } void RNA_def_main_metaballs(BlenderRNA *brna, PropertyRNA *cprop) { @@ -797,6 +903,10 @@ void RNA_def_main_metaballs(BlenderRNA *brna, PropertyRNA *cprop) RNA_def_function_ui_description(func, "Remove a metaball from the current blendfile."); parm= RNA_def_pointer(func, "metaball", "MetaBall", "", "MetaBall to remove."); RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL); + + func= RNA_def_function(srna, "tag", "rna_Main_metaballs_tag"); + parm= RNA_def_boolean(func, "value", 0, "Value", ""); + RNA_def_property_flag(parm, PROP_REQUIRED); } void RNA_def_main_fonts(BlenderRNA *brna, PropertyRNA *cprop) { @@ -811,7 +921,7 @@ void RNA_def_main_fonts(BlenderRNA *brna, PropertyRNA *cprop) func= RNA_def_function(srna, "load", "rna_Main_fonts_load"); RNA_def_function_flag(func, FUNC_USE_REPORTS); RNA_def_function_ui_description(func, "Load a new font into the main database"); - parm= RNA_def_string(func, "filepath", "File Path", 0, "", "path of the font to load."); + parm= RNA_def_string_file_path(func, "filepath", "File Path", 0, "", "path of the font to load."); RNA_def_property_flag(parm, PROP_REQUIRED); /* return type */ parm= RNA_def_pointer(func, "vfont", "VectorFont", "", "New font datablock."); @@ -822,6 +932,10 @@ void RNA_def_main_fonts(BlenderRNA *brna, PropertyRNA *cprop) RNA_def_function_ui_description(func, "Remove a font from the current blendfile."); parm= RNA_def_pointer(func, "vfont", "VectorFont", "", "Font to remove."); RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL); + + func= RNA_def_function(srna, "tag", "rna_Main_fonts_tag"); + parm= RNA_def_boolean(func, "value", 0, "Value", ""); + RNA_def_property_flag(parm, PROP_REQUIRED); } void RNA_def_main_textures(BlenderRNA *brna, PropertyRNA *cprop) { @@ -848,6 +962,10 @@ void RNA_def_main_textures(BlenderRNA *brna, PropertyRNA *cprop) RNA_def_function_ui_description(func, "Remove a texture from the current blendfile."); parm= RNA_def_pointer(func, "texture", "Texture", "", "Texture to remove."); RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL); + + func= RNA_def_function(srna, "tag", "rna_Main_textures_tag"); + parm= RNA_def_boolean(func, "value", 0, "Value", ""); + RNA_def_property_flag(parm, PROP_REQUIRED); } void RNA_def_main_brushes(BlenderRNA *brna, PropertyRNA *cprop) { @@ -872,6 +990,10 @@ void RNA_def_main_brushes(BlenderRNA *brna, PropertyRNA *cprop) RNA_def_function_ui_description(func, "Remove a brush from the current blendfile."); parm= RNA_def_pointer(func, "brush", "Brush", "", "Brush to remove."); RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL); + + func= RNA_def_function(srna, "tag", "rna_Main_brushes_tag"); + parm= RNA_def_boolean(func, "value", 0, "Value", ""); + RNA_def_property_flag(parm, PROP_REQUIRED); } void RNA_def_main_worlds(BlenderRNA *brna, PropertyRNA *cprop) @@ -897,6 +1019,10 @@ void RNA_def_main_worlds(BlenderRNA *brna, PropertyRNA *cprop) RNA_def_function_ui_description(func, "Remove a world from the current blendfile."); parm= RNA_def_pointer(func, "world", "World", "", "World to remove."); RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL); + + func= RNA_def_function(srna, "tag", "rna_Main_worlds_tag"); + parm= RNA_def_boolean(func, "value", 0, "Value", ""); + RNA_def_property_flag(parm, PROP_REQUIRED); } void RNA_def_main_groups(BlenderRNA *brna, PropertyRNA *cprop) @@ -922,6 +1048,10 @@ void RNA_def_main_groups(BlenderRNA *brna, PropertyRNA *cprop) RNA_def_function_ui_description(func, "Remove a group from the current blendfile."); parm= RNA_def_pointer(func, "group", "Group", "", "Group to remove."); RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL); + + func= RNA_def_function(srna, "tag", "rna_Main_groups_tag"); + parm= RNA_def_boolean(func, "value", 0, "Value", ""); + RNA_def_property_flag(parm, PROP_REQUIRED); } void RNA_def_main_texts(BlenderRNA *brna, PropertyRNA *cprop) { @@ -951,16 +1081,34 @@ void RNA_def_main_texts(BlenderRNA *brna, PropertyRNA *cprop) func= RNA_def_function(srna, "load", "rna_Main_texts_load"); RNA_def_function_flag(func, FUNC_USE_REPORTS); RNA_def_function_ui_description(func, "Add a new text to the main database from a file"); - parm= RNA_def_string(func, "filepath", "Path", FILE_MAXDIR + FILE_MAXFILE, "", "path for the datablock."); + parm= RNA_def_string_file_path(func, "filepath", "Path", FILE_MAXDIR + FILE_MAXFILE, "", "path for the datablock."); RNA_def_property_flag(parm, PROP_REQUIRED); /* return type */ parm= RNA_def_pointer(func, "text", "Text", "", "New text datablock."); RNA_def_function_return(func, parm); + + func= RNA_def_function(srna, "tag", "rna_Main_texts_tag"); + parm= RNA_def_boolean(func, "value", 0, "Value", ""); + RNA_def_property_flag(parm, PROP_REQUIRED); } + void RNA_def_main_sounds(BlenderRNA *brna, PropertyRNA *cprop) { + StructRNA *srna; + FunctionRNA *func; + PropertyRNA *parm; + + RNA_def_property_srna(cprop, "MainSounds"); + srna= RNA_def_struct(brna, "MainSounds", NULL); + RNA_def_struct_ui_text(srna, "Main Sounds", "Collection of sounds"); + /* TODO, 'load' */ + + func= RNA_def_function(srna, "tag", "rna_Main_sounds_tag"); + parm= RNA_def_boolean(func, "value", 0, "Value", ""); + RNA_def_property_flag(parm, PROP_REQUIRED); } + void RNA_def_main_armatures(BlenderRNA *brna, PropertyRNA *cprop) { StructRNA *srna; @@ -984,6 +1132,10 @@ void RNA_def_main_armatures(BlenderRNA *brna, PropertyRNA *cprop) RNA_def_function_ui_description(func, "Remove a armature from the current blendfile."); parm= RNA_def_pointer(func, "armature", "Armature", "", "Armature to remove."); RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL); + + func= RNA_def_function(srna, "tag", "rna_Main_armatures_tag"); + parm= RNA_def_boolean(func, "value", 0, "Value", ""); + RNA_def_property_flag(parm, PROP_REQUIRED); } void RNA_def_main_actions(BlenderRNA *brna, PropertyRNA *cprop) { @@ -1008,6 +1160,10 @@ void RNA_def_main_actions(BlenderRNA *brna, PropertyRNA *cprop) RNA_def_function_ui_description(func, "Remove a action from the current blendfile."); parm= RNA_def_pointer(func, "action", "Action", "", "Action to remove."); RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL); + + func= RNA_def_function(srna, "tag", "rna_Main_actions_tag"); + parm= RNA_def_boolean(func, "value", 0, "Value", ""); + RNA_def_property_flag(parm, PROP_REQUIRED); } void RNA_def_main_particles(BlenderRNA *brna, PropertyRNA *cprop) { @@ -1032,10 +1188,25 @@ void RNA_def_main_particles(BlenderRNA *brna, PropertyRNA *cprop) RNA_def_function_ui_description(func, "Remove a particle settings instance from the current blendfile."); parm= RNA_def_pointer(func, "particle", "ParticleSettings", "", "Particle Settings to remove."); RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL); + + func= RNA_def_function(srna, "tag", "rna_Main_particles_tag"); + parm= RNA_def_boolean(func, "value", 0, "Value", ""); + RNA_def_property_flag(parm, PROP_REQUIRED); } + void RNA_def_main_gpencil(BlenderRNA *brna, PropertyRNA *cprop) { + StructRNA *srna; + FunctionRNA *func; + PropertyRNA *parm; + RNA_def_property_srna(cprop, "MainGreasePencils"); + srna= RNA_def_struct(brna, "MainGreasePencils", NULL); + RNA_def_struct_ui_text(srna, "Main Grease Pencils", "Collection of grease pencils"); + + func= RNA_def_function(srna, "tag", "rna_Main_gpencil_tag"); + parm= RNA_def_boolean(func, "value", 0, "Value", ""); + RNA_def_property_flag(parm, PROP_REQUIRED); } #endif |