Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/makesrna/intern/rna_main_api.c')
-rw-r--r--source/blender/makesrna/intern/rna_main_api.c356
1 files changed, 325 insertions, 31 deletions
diff --git a/source/blender/makesrna/intern/rna_main_api.c b/source/blender/makesrna/intern/rna_main_api.c
index d70962568e5..72ed625e5aa 100644
--- a/source/blender/makesrna/intern/rna_main_api.c
+++ b/source/blender/makesrna/intern/rna_main_api.c
@@ -28,6 +28,7 @@
#include <stdlib.h>
#include <stdio.h>
+#include <errno.h>
#include "RNA_define.h"
#include "RNA_access.h"
@@ -50,6 +51,13 @@
#include "BKE_text.h"
#include "BKE_action.h"
#include "BKE_group.h"
+#include "BKE_brush.h"
+#include "BKE_lattice.h"
+#include "BKE_mball.h"
+#include "BKE_world.h"
+#include "BKE_particle.h"
+#include "BKE_font.h"
+#include "BKE_node.h"
#include "DNA_armature_types.h"
#include "DNA_camera_types.h"
@@ -61,6 +69,13 @@
#include "DNA_text_types.h"
#include "DNA_texture_types.h"
#include "DNA_group_types.h"
+#include "DNA_brush_types.h"
+#include "DNA_lattice_types.h"
+#include "DNA_meta_types.h"
+#include "DNA_world_types.h"
+#include "DNA_particle_types.h"
+#include "DNA_vfont_types.h"
+#include "DNA_node_types.h"
#include "ED_screen.h"
@@ -190,6 +205,23 @@ 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)
+{
+ bNodeTree *tree = ntreeAddTree(type);
+ tree->id.us--;
+ return tree;
+}
+void rna_Main_nodetree_remove(Main *bmain, ReportList *reports, struct bNodeTree *tree)
+{
+ if(ID_REAL_USERS(tree) <= 0)
+ free_libblock(&bmain->nodetree, tree);
+ else
+ 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));
+
+ /* XXX python now has invalid pointer? */
+}
+
Mesh *rna_Main_meshes_new(Main *bmain, char* name)
{
Mesh *me= add_mesh(name);
@@ -222,16 +254,24 @@ 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 float_buffer)
+Image *rna_Main_images_new(Main *bmain, 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, float_buffer, 0, color);
+ Image *image= BKE_add_image_size(width, height, name, alpha ? 32:24, float_buffer, 0, color);
image->id.us--;
return image;
}
-Image *rna_Main_images_load(Main *bmain, char *filename)
+Image *rna_Main_images_load(Main *bmain, ReportList *reports, char *filepath)
{
- return BKE_add_image_file(filename, 0);
+ Image *ima;
+
+ errno= 0;
+ ima= BKE_add_image_file(filepath, 0);
+
+ if(!ima)
+ BKE_reportf(reports, RPT_ERROR, "Can't read: \"%s\", %s.", filepath, errno ? strerror(errno) : "Unsupported image format");
+
+ return ima;
}
void rna_Main_images_remove(Main *bmain, ReportList *reports, Image *image)
{
@@ -243,6 +283,20 @@ 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 *lt= add_lattice(name);
+ lt->id.us--;
+ return lt;
+}
+void rna_Main_lattices_remove(Main *bmain, ReportList *reports, struct Lattice *lt)
+{
+ if(ID_REAL_USERS(lt) <= 0)
+ free_libblock(&bmain->latt, lt);
+ else
+ 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 *cu= add_curve(name, type);
@@ -257,9 +311,47 @@ 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));
}
-Tex *rna_Main_textures_new(Main *bmain, char* name)
+MetaBall *rna_Main_metaballs_new(Main *bmain, char* name)
+{
+ MetaBall *mb= add_mball(name);
+ mb->id.us--;
+ return mb;
+}
+void rna_Main_metaballs_remove(Main *bmain, ReportList *reports, struct MetaBall *mb)
+{
+ if(ID_REAL_USERS(mb) <= 0)
+ free_libblock(&bmain->mball, mb);
+ else
+ 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 *font;
+
+ errno= 0;
+ font= load_vfont(filepath);
+
+ if(!font)
+ BKE_reportf(reports, RPT_ERROR, "Can't read: \"%s\", %s.", filepath, errno ? strerror(errno) : "Unsupported font format");
+
+ return font;
+
+}
+void rna_Main_fonts_remove(Main *bmain, ReportList *reports, VFont *vfont)
+{
+ if(ID_REAL_USERS(vfont) <= 0)
+ free_libblock(&bmain->vfont, vfont);
+ else
+ BKE_reportf(reports, RPT_ERROR, "Font \"%s\" must have zero users to be removed, found %d.", vfont->id.name+2, ID_REAL_USERS(vfont));
+
+ /* XXX python now has invalid pointer? */
+}
+
+Tex *rna_Main_textures_new(Main *bmain, char* name, int type)
{
Tex *tex= add_texture(name);
+ tex_set_type(tex, type);
tex->id.us--;
return tex;
}
@@ -271,6 +363,34 @@ 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 *brush = add_brush(name);
+ brush->id.us--;
+ return brush;
+}
+void rna_Main_brushes_remove(Main *bmain, ReportList *reports, struct Brush *brush)
+{
+ if(ID_REAL_USERS(brush) <= 0)
+ free_libblock(&bmain->brush, brush);
+ else
+ 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 *world = add_world(name);
+ world->id.us--;
+ return world;
+}
+void rna_Main_worlds_remove(Main *bmain, ReportList *reports, struct World *world)
+{
+ if(ID_REAL_USERS(world) <= 0)
+ free_libblock(&bmain->world, world);
+ else
+ 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)
{
return add_group(name);
@@ -278,7 +398,6 @@ Group *rna_Main_groups_new(Main *bmain, char* name)
void rna_Main_groups_remove(Main *bmain, ReportList *reports, Group *group)
{
unlink_group(group);
- group->id.us= 0;
free_libblock(&bmain->group, group);
/* XXX python now has invalid pointer? */
}
@@ -293,11 +412,16 @@ void rna_Main_texts_remove(Main *bmain, ReportList *reports, Text *text)
free_libblock(&bmain->text, text);
/* XXX python now has invalid pointer? */
}
-Text *rna_Main_texts_load(Main *bmain, ReportList *reports, char* path)
+
+Text *rna_Main_texts_load(Main *bmain, ReportList *reports, char* filepath)
{
- Text *txt= add_text(path, bmain->name);
- if(txt==NULL)
- BKE_reportf(reports, RPT_ERROR, "Couldn't load text from path \"%s\".", path);
+ Text *txt;
+
+ errno= 0;
+ txt= add_text(filepath, bmain->name);
+
+ if(!txt)
+ BKE_reportf(reports, RPT_ERROR, "Can't read: \"%s\", %s.", filepath, errno ? strerror(errno) : "Unable to load text");
return txt;
}
@@ -335,6 +459,22 @@ 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 *part = psys_new_settings(name, bmain);
+ part->id.us--;
+ return part;
+}
+void rna_Main_particles_remove(Main *bmain, ReportList *reports, ParticleSettings *part)
+{
+ if(ID_REAL_USERS(part) <= 0)
+ free_libblock(&bmain->particle, part);
+ else
+ 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));
+
+ /* XXX python now has invalid pointer? */
+}
+
#else
void RNA_api_main(StructRNA *srna)
@@ -348,7 +488,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, "filename", "", 0, "", "Filename to load image from.");
+ parm= RNA_def_string(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);
@@ -378,7 +518,7 @@ void RNA_def_main_cameras(BlenderRNA *brna, PropertyRNA *cprop)
RNA_def_function_flag(func, FUNC_USE_REPORTS);
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);
+ RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
}
void RNA_def_main_scenes(BlenderRNA *brna, PropertyRNA *cprop)
@@ -401,10 +541,9 @@ void RNA_def_main_scenes(BlenderRNA *brna, PropertyRNA *cprop)
func= RNA_def_function(srna, "remove", "rna_Main_scenes_remove");
RNA_def_function_flag(func, FUNC_USE_CONTEXT|FUNC_USE_REPORTS);
- parm= RNA_def_pointer(func, "scene", "Scene", "", "Scene to remove.");
- RNA_def_property_flag(parm, PROP_REQUIRED);
RNA_def_function_ui_description(func, "Remove a scene from the current blendfile.");
- RNA_def_property_flag(parm, PROP_REQUIRED);
+ parm= RNA_def_pointer(func, "scene", "Scene", "", "Scene to remove.");
+ RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
}
void RNA_def_main_objects(BlenderRNA *brna, PropertyRNA *cprop)
@@ -430,10 +569,10 @@ void RNA_def_main_objects(BlenderRNA *brna, PropertyRNA *cprop)
RNA_def_function_return(func, parm);
func= RNA_def_function(srna, "remove", "rna_Main_objects_remove");
+ RNA_def_function_ui_description(func, "Remove a object from the current blendfile.");
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);
- RNA_def_function_ui_description(func, "Remove a object from the current blendfile.");
+ RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
}
void RNA_def_main_materials(BlenderRNA *brna, PropertyRNA *cprop)
@@ -458,11 +597,39 @@ void RNA_def_main_materials(BlenderRNA *brna, PropertyRNA *cprop)
RNA_def_function_flag(func, FUNC_USE_REPORTS);
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);
+ RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
}
void RNA_def_main_node_groups(BlenderRNA *brna, PropertyRNA *cprop)
{
+ StructRNA *srna;
+// FunctionRNA *func;
+// PropertyRNA *parm;
+
+/* static EnumPropertyItem node_nodetree_items[] = {
+ {0, "SHADER", 0, "Shader", ""},
+ {1, "COMPOSITE", 0, "Composite", ""},
+ {2, "TEXTURE", 0, "Texture", ""},
+ {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");
+ RNA_def_property_flag(parm, PROP_REQUIRED);
+ /* return type */
+ parm= RNA_def_pointer(func, "tree", "NodeTree", "", "New node tree datablock.");
+ RNA_def_function_return(func, parm);
+ func= RNA_def_function(srna, "remove", "rna_Main_nodetree_remove");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ 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
}
void RNA_def_main_meshes(BlenderRNA *brna, PropertyRNA *cprop)
{
@@ -486,7 +653,7 @@ void RNA_def_main_meshes(BlenderRNA *brna, PropertyRNA *cprop)
RNA_def_function_flag(func, FUNC_USE_REPORTS);
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);
+ RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
}
void RNA_def_main_lamps(BlenderRNA *brna, PropertyRNA *cprop)
{
@@ -510,7 +677,7 @@ void RNA_def_main_lamps(BlenderRNA *brna, PropertyRNA *cprop)
RNA_def_function_flag(func, FUNC_USE_REPORTS);
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);
+ RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
}
void RNA_def_main_libraries(BlenderRNA *brna, PropertyRNA *cprop)
{
@@ -540,14 +707,16 @@ void RNA_def_main_images(BlenderRNA *brna, PropertyRNA *cprop)
RNA_def_property_flag(parm, PROP_REQUIRED);
parm= RNA_def_int(func, "width", 1024, 1, INT_MAX, "", "Width of the image.", 0, INT_MAX);
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");
/* return type */
parm= RNA_def_pointer(func, "image", "Image", "", "New image datablock.");
RNA_def_function_return(func, parm);
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, "filename", "File Name", 0, "", "path of the file to load.");
+ parm= RNA_def_string(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.");
@@ -557,12 +726,32 @@ void RNA_def_main_images(BlenderRNA *brna, PropertyRNA *cprop)
RNA_def_function_flag(func, FUNC_USE_REPORTS);
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);
+ RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
}
void RNA_def_main_lattices(BlenderRNA *brna, PropertyRNA *cprop)
{
+ StructRNA *srna;
+ FunctionRNA *func;
+ PropertyRNA *parm;
+ RNA_def_property_srna(cprop, "MainLattices");
+ srna= RNA_def_struct(brna, "MainLattices", NULL);
+ RNA_def_struct_ui_text(srna, "Main Lattices", "Collection of lattices");
+
+ func= RNA_def_function(srna, "new", "rna_Main_lattices_new");
+ RNA_def_function_ui_description(func, "Add a new lattice to the main database");
+ parm= RNA_def_string(func, "name", "Lattice", 0, "", "New name for the datablock.");
+ RNA_def_property_flag(parm, PROP_REQUIRED);
+ /* return type */
+ parm= RNA_def_pointer(func, "lattice", "Lattice", "", "New lattices datablock.");
+ RNA_def_function_return(func, parm);
+
+ func= RNA_def_function(srna, "remove", "rna_Main_lattices_remove");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ 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);
}
void RNA_def_main_curves(BlenderRNA *brna, PropertyRNA *cprop)
{
@@ -578,7 +767,7 @@ void RNA_def_main_curves(BlenderRNA *brna, PropertyRNA *cprop)
RNA_def_function_ui_description(func, "Add a new curve to the main database");
parm= RNA_def_string(func, "name", "Curve", 0, "", "New name for the datablock.");
RNA_def_property_flag(parm, PROP_REQUIRED);
- parm= RNA_def_enum(func, "type", object_type_curve_items, 0, "Type", "The type of curve object to add");
+ parm= RNA_def_enum(func, "type", object_type_curve_items, 0, "Type", "The type of curve to add");
RNA_def_property_flag(parm, PROP_REQUIRED);
/* return type */
parm= RNA_def_pointer(func, "curve", "Curve", "", "New curve datablock.");
@@ -588,15 +777,56 @@ void RNA_def_main_curves(BlenderRNA *brna, PropertyRNA *cprop)
RNA_def_function_flag(func, FUNC_USE_REPORTS);
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);
+ RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
}
void RNA_def_main_metaballs(BlenderRNA *brna, PropertyRNA *cprop)
{
+ StructRNA *srna;
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ RNA_def_property_srna(cprop, "MainMetaBalls");
+ srna= RNA_def_struct(brna, "MainMetaBalls", NULL);
+ RNA_def_struct_ui_text(srna, "Main MetaBall", "Collection of metaballs");
+ func= RNA_def_function(srna, "new", "rna_Main_metaballs_new");
+ RNA_def_function_ui_description(func, "Add a new metaball to the main database");
+ parm= RNA_def_string(func, "name", "MetaBall", 0, "", "New name for the datablock.");
+ RNA_def_property_flag(parm, PROP_REQUIRED);
+ /* return type */
+ parm= RNA_def_pointer(func, "metaball", "MetaBall", "", "New metaball datablock.");
+ RNA_def_function_return(func, parm);
+
+ func= RNA_def_function(srna, "remove", "rna_Main_metaballs_remove");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ 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);
}
-void RNA_def_main_vfonts(BlenderRNA *brna, PropertyRNA *cprop)
+void RNA_def_main_fonts(BlenderRNA *brna, PropertyRNA *cprop)
{
+ StructRNA *srna;
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ RNA_def_property_srna(cprop, "MainFonts");
+ srna= RNA_def_struct(brna, "MainFonts", NULL);
+ RNA_def_struct_ui_text(srna, "Main Fonts", "Collection of fonts");
+
+ 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.");
+ RNA_def_property_flag(parm, PROP_REQUIRED);
+ /* return type */
+ parm= RNA_def_pointer(func, "vfont", "VectorFont", "", "New font datablock.");
+ RNA_def_function_return(func, parm);
+ func= RNA_def_function(srna, "remove", "rna_Main_fonts_remove");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ 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);
}
void RNA_def_main_textures(BlenderRNA *brna, PropertyRNA *cprop)
{
@@ -612,6 +842,8 @@ void RNA_def_main_textures(BlenderRNA *brna, PropertyRNA *cprop)
RNA_def_function_ui_description(func, "Add a new texture to the main database");
parm= RNA_def_string(func, "name", "Texture", 0, "", "New name for the datablock.");
RNA_def_property_flag(parm, PROP_REQUIRED);
+ parm= RNA_def_enum(func, "type", texture_type_items, 0, "Type", "The type of texture to add");
+ RNA_def_property_flag(parm, PROP_REQUIRED);
/* return type */
parm= RNA_def_pointer(func, "texture", "Texture", "", "New texture datablock.");
RNA_def_function_return(func, parm);
@@ -620,16 +852,58 @@ void RNA_def_main_textures(BlenderRNA *brna, PropertyRNA *cprop)
RNA_def_function_flag(func, FUNC_USE_REPORTS);
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);
+ RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
}
void RNA_def_main_brushes(BlenderRNA *brna, PropertyRNA *cprop)
{
+ StructRNA *srna;
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ RNA_def_property_srna(cprop, "MainBrushes");
+ srna= RNA_def_struct(brna, "MainBrushes", NULL);
+ RNA_def_struct_ui_text(srna, "Main Brushes", "Collection of brushes");
+
+ func= RNA_def_function(srna, "new", "rna_Main_brushes_new");
+ RNA_def_function_ui_description(func, "Add a new brush to the main database");
+ parm= RNA_def_string(func, "name", "Brush", 0, "", "New name for the datablock.");
+ RNA_def_property_flag(parm, PROP_REQUIRED);
+ /* return type */
+ parm= RNA_def_pointer(func, "brush", "Brush", "", "New brush datablock.");
+ RNA_def_function_return(func, parm);
+ func= RNA_def_function(srna, "remove", "rna_Main_brushes_remove");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ 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);
}
+
void RNA_def_main_worlds(BlenderRNA *brna, PropertyRNA *cprop)
{
+ StructRNA *srna;
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ RNA_def_property_srna(cprop, "MainWorlds");
+ srna= RNA_def_struct(brna, "MainWorlds", NULL);
+ RNA_def_struct_ui_text(srna, "Main Worlds", "Collection of worlds");
+ func= RNA_def_function(srna, "new", "rna_Main_worlds_new");
+ RNA_def_function_ui_description(func, "Add a new world to the main database");
+ parm= RNA_def_string(func, "name", "World", 0, "", "New name for the datablock.");
+ RNA_def_property_flag(parm, PROP_REQUIRED);
+ /* return type */
+ parm= RNA_def_pointer(func, "world", "World", "", "New world datablock.");
+ RNA_def_function_return(func, parm);
+
+ func= RNA_def_function(srna, "remove", "rna_Main_worlds_remove");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ 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);
}
+
void RNA_def_main_groups(BlenderRNA *brna, PropertyRNA *cprop)
{
StructRNA *srna;
@@ -652,7 +926,7 @@ void RNA_def_main_groups(BlenderRNA *brna, PropertyRNA *cprop)
RNA_def_function_flag(func, FUNC_USE_REPORTS);
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);
+ RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
}
void RNA_def_main_texts(BlenderRNA *brna, PropertyRNA *cprop)
{
@@ -676,13 +950,13 @@ void RNA_def_main_texts(BlenderRNA *brna, PropertyRNA *cprop)
RNA_def_function_flag(func, FUNC_USE_REPORTS);
RNA_def_function_ui_description(func, "Remove a text from the current blendfile.");
parm= RNA_def_pointer(func, "text", "Text", "", "Text to remove.");
- RNA_def_property_flag(parm, PROP_REQUIRED);
+ RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
/* load func */
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, "path", "Path", FILE_MAXDIR + FILE_MAXFILE, "", "path for the datablock.");
+ parm= RNA_def_string(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.");
@@ -714,7 +988,7 @@ void RNA_def_main_armatures(BlenderRNA *brna, PropertyRNA *cprop)
RNA_def_function_flag(func, FUNC_USE_REPORTS);
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);
+ RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
}
void RNA_def_main_actions(BlenderRNA *brna, PropertyRNA *cprop)
{
@@ -738,11 +1012,31 @@ void RNA_def_main_actions(BlenderRNA *brna, PropertyRNA *cprop)
RNA_def_function_flag(func, FUNC_USE_REPORTS);
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);
+ RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
}
void RNA_def_main_particles(BlenderRNA *brna, PropertyRNA *cprop)
{
+ StructRNA *srna;
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ RNA_def_property_srna(cprop, "MainParticles");
+ srna= RNA_def_struct(brna, "MainParticles", NULL);
+ RNA_def_struct_ui_text(srna, "Main Particle Settings", "Collection of particle settings");
+
+ func= RNA_def_function(srna, "new", "rna_Main_particles_new");
+ RNA_def_function_ui_description(func, "Add a new particle settings instance to the main database");
+ parm= RNA_def_string(func, "name", "ParticleSettings", 0, "", "New name for the datablock.");
+ RNA_def_property_flag(parm, PROP_REQUIRED);
+ /* return type */
+ parm= RNA_def_pointer(func, "particle", "ParticleSettings", "", "New particle settings datablock.");
+ RNA_def_function_return(func, parm);
+ func= RNA_def_function(srna, "remove", "rna_Main_particles_remove");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ 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);
}
void RNA_def_main_gpencil(BlenderRNA *brna, PropertyRNA *cprop)
{