Merged changes in the trunk up to revision 51448.

Conflicts resolved:
source/blender/blenkernel/CMakeLists.txt
source/blender/blenloader/intern/readfile.c
source/blender/editors/mesh/editmesh_tools.c
source/blender/makesrna/intern/rna_main_api.c
This commit is contained in:
2012-10-20 16:48:48 +00:00
1248 changed files with 37069 additions and 20324 deletions

View File

@@ -71,6 +71,7 @@
#include "BKE_speaker.h"
#include "BKE_movieclip.h"
#include "BKE_mask.h"
#include "BKE_gpencil.h"
#include "BKE_linestyle.h"
#include "DNA_armature_types.h"
@@ -93,9 +94,12 @@
#include "DNA_node_types.h"
#include "DNA_movieclip_types.h"
#include "DNA_mask_types.h"
#include "DNA_gpencil_types.h"
#include "ED_screen.h"
#include "BLF_translation.h"
static Camera *rna_Main_cameras_new(Main *UNUSED(bmain), const char *name)
{
ID *id = BKE_camera_add(name);
@@ -107,7 +111,7 @@ static void rna_Main_cameras_remove(Main *bmain, ReportList *reports, struct Cam
if (ID_REAL_USERS(camera) <= 0)
BKE_libblock_free(&bmain->camera, camera);
else
BKE_reportf(reports, RPT_ERROR, "Camera \"%s\" must have zero users to be removed, found %d",
BKE_reportf(reports, RPT_ERROR, "Camera '%s' must have zero users to be removed, found %d",
camera->id.name + 2, ID_REAL_USERS(camera));
/* XXX python now has invalid pointer? */
@@ -127,7 +131,7 @@ static void rna_Main_scenes_remove(Main *bmain, bContext *C, ReportList *reports
else if (scene->id.next)
newscene = scene->id.next;
else {
BKE_reportf(reports, RPT_ERROR, "Scene \"%s\" is the last, cant ve removed", scene->id.name + 2);
BKE_reportf(reports, RPT_ERROR, "Scene '%s' is the last, cannot be removed", scene->id.name + 2);
return;
}
@@ -174,7 +178,7 @@ static Object *rna_Main_objects_new(Main *UNUSED(bmain), ReportList *reports, co
if (RNA_enum_id_from_value(id_type_items, GS(data->name), &idname) == 0)
idname = "UNKNOWN";
BKE_reportf(reports, RPT_ERROR, "ID type '%s' is not valid for a object", idname);
BKE_reportf(reports, RPT_ERROR, "ID type '%s' is not valid for an object", idname);
return NULL;
}
}
@@ -198,7 +202,7 @@ static void rna_Main_objects_remove(Main *bmain, ReportList *reports, struct Obj
BKE_libblock_free(&bmain->object, object);
}
else {
BKE_reportf(reports, RPT_ERROR, "Object \"%s\" must have zero users to be removed, found %d",
BKE_reportf(reports, RPT_ERROR, "Object '%s' must have zero users to be removed, found %d",
object->id.name + 2, ID_REAL_USERS(object));
}
}
@@ -214,7 +218,7 @@ static void rna_Main_materials_remove(Main *bmain, ReportList *reports, struct M
if (ID_REAL_USERS(material) <= 0)
BKE_libblock_free(&bmain->mat, material);
else
BKE_reportf(reports, RPT_ERROR, "Material \"%s\" must have zero users to be removed, found %d",
BKE_reportf(reports, RPT_ERROR, "Material '%s' must have zero users to be removed, found %d",
material->id.name + 2, ID_REAL_USERS(material));
/* XXX python now has invalid pointer? */
@@ -232,7 +236,7 @@ static void rna_Main_nodetree_remove(Main *bmain, ReportList *reports, struct bN
if (ID_REAL_USERS(tree) <= 0)
BKE_libblock_free(&bmain->nodetree, tree);
else
BKE_reportf(reports, RPT_ERROR, "Node Tree \"%s\" must have zero users to be removed, found %d",
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? */
@@ -249,7 +253,7 @@ void rna_Main_meshes_remove(Main *bmain, ReportList *reports, Mesh *mesh)
if (ID_REAL_USERS(mesh) <= 0)
BKE_libblock_free(&bmain->mesh, mesh);
else
BKE_reportf(reports, RPT_ERROR, "Mesh \"%s\" must have zero users to be removed, found %d",
BKE_reportf(reports, RPT_ERROR, "Mesh '%s' must have zero users to be removed, found %d",
mesh->id.name + 2, ID_REAL_USERS(mesh));
/* XXX python now has invalid pointer? */
@@ -267,7 +271,7 @@ static void rna_Main_lamps_remove(Main *bmain, ReportList *reports, Lamp *lamp)
if (ID_REAL_USERS(lamp) <= 0)
BKE_libblock_free(&bmain->lamp, lamp);
else
BKE_reportf(reports, RPT_ERROR, "Lamp \"%s\" must have zero users to be removed, found %d",
BKE_reportf(reports, RPT_ERROR, "Lamp '%s' must have zero users to be removed, found %d",
lamp->id.name + 2, ID_REAL_USERS(lamp));
/* XXX python now has invalid pointer? */
@@ -288,8 +292,8 @@ static Image *rna_Main_images_load(Main *UNUSED(bmain), ReportList *reports, con
ima = BKE_image_load(filepath);
if (!ima)
BKE_reportf(reports, RPT_ERROR, "Can't read: \"%s\", %s", filepath,
errno ? strerror(errno) : "Unsupported image format");
BKE_reportf(reports, RPT_ERROR, "Cannot read '%s': %s", filepath,
errno ? strerror(errno) : TIP_("unsupported image format"));
return ima;
}
@@ -298,7 +302,7 @@ static void rna_Main_images_remove(Main *bmain, ReportList *reports, Image *imag
if (ID_REAL_USERS(image) <= 0)
BKE_libblock_free(&bmain->image, image);
else
BKE_reportf(reports, RPT_ERROR, "Image \"%s\" must have zero users to be removed, found %d",
BKE_reportf(reports, RPT_ERROR, "Image '%s' must have zero users to be removed, found %d",
image->id.name + 2, ID_REAL_USERS(image));
/* XXX python now has invalid pointer? */
@@ -315,7 +319,7 @@ static void rna_Main_lattices_remove(Main *bmain, ReportList *reports, struct La
if (ID_REAL_USERS(lt) <= 0)
BKE_libblock_free(&bmain->latt, lt);
else
BKE_reportf(reports, RPT_ERROR, "Lattice \"%s\" must have zero users to be removed, found %d",
BKE_reportf(reports, RPT_ERROR, "Lattice '%s' must have zero users to be removed, found %d",
lt->id.name + 2, ID_REAL_USERS(lt));
}
@@ -330,7 +334,7 @@ static void rna_Main_curves_remove(Main *bmain, ReportList *reports, struct Curv
if (ID_REAL_USERS(cu) <= 0)
BKE_libblock_free(&bmain->curve, cu);
else
BKE_reportf(reports, RPT_ERROR, "Curve \"%s\" must have zero users to be removed, found %d",
BKE_reportf(reports, RPT_ERROR, "Curve '%s' must have zero users to be removed, found %d",
cu->id.name + 2, ID_REAL_USERS(cu));
}
@@ -345,7 +349,7 @@ static void rna_Main_metaballs_remove(Main *bmain, ReportList *reports, struct M
if (ID_REAL_USERS(mb) <= 0)
BKE_libblock_free(&bmain->mball, mb);
else
BKE_reportf(reports, RPT_ERROR, "Metaball \"%s\" must have zero users to be removed, found %d",
BKE_reportf(reports, RPT_ERROR, "Metaball '%s' must have zero users to be removed, found %d",
mb->id.name + 2, ID_REAL_USERS(mb));
}
@@ -357,8 +361,8 @@ static VFont *rna_Main_fonts_load(Main *bmain, ReportList *reports, const char *
font = BKE_vfont_load(bmain, filepath);
if (!font)
BKE_reportf(reports, RPT_ERROR, "Can't read: \"%s\", %s", filepath,
errno ? strerror(errno) : "Unsupported font format");
BKE_reportf(reports, RPT_ERROR, "Cannot read '%s': %s", filepath,
errno ? strerror(errno) : TIP_("unsupported font format"));
return font;
@@ -368,7 +372,7 @@ static void rna_Main_fonts_remove(Main *bmain, ReportList *reports, VFont *vfont
if (ID_REAL_USERS(vfont) <= 0)
BKE_libblock_free(&bmain->vfont, vfont);
else
BKE_reportf(reports, RPT_ERROR, "Font \"%s\" must have zero users to be removed, found %d",
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? */
@@ -386,7 +390,7 @@ static void rna_Main_textures_remove(Main *bmain, ReportList *reports, struct Te
if (ID_REAL_USERS(tex) <= 0)
BKE_libblock_free(&bmain->tex, tex);
else
BKE_reportf(reports, RPT_ERROR, "Texture \"%s\" must have zero users to be removed, found %d",
BKE_reportf(reports, RPT_ERROR, "Texture '%s' must have zero users to be removed, found %d",
tex->id.name + 2, ID_REAL_USERS(tex));
}
@@ -401,7 +405,7 @@ static void rna_Main_brushes_remove(Main *bmain, ReportList *reports, struct Bru
if (ID_REAL_USERS(brush) <= 0)
BKE_libblock_free(&bmain->brush, brush);
else
BKE_reportf(reports, RPT_ERROR, "Brush \"%s\" must have zero users to be removed, found %d",
BKE_reportf(reports, RPT_ERROR, "Brush '%s' must have zero users to be removed, found %d",
brush->id.name + 2, ID_REAL_USERS(brush));
}
@@ -416,7 +420,7 @@ static void rna_Main_worlds_remove(Main *bmain, ReportList *reports, struct Worl
if (ID_REAL_USERS(world) <= 0)
BKE_libblock_free(&bmain->world, world);
else
BKE_reportf(reports, RPT_ERROR, "World \"%s\" must have zero users to be removed, found %d",
BKE_reportf(reports, RPT_ERROR, "World '%s' must have zero users to be removed, found %d",
world->id.name + 2, ID_REAL_USERS(world));
}
@@ -442,7 +446,7 @@ static void rna_Main_speakers_remove(Main *bmain, ReportList *reports, Speaker *
if (ID_REAL_USERS(speaker) <= 0)
BKE_libblock_free(&bmain->speaker, speaker);
else
BKE_reportf(reports, RPT_ERROR, "Speaker \"%s\" must have zero users to be removed, found %d",
BKE_reportf(reports, RPT_ERROR, "Speaker '%s' must have zero users to be removed, found %d",
speaker->id.name + 2, ID_REAL_USERS(speaker));
/* XXX python now has invalid pointer? */
@@ -467,8 +471,8 @@ static Text *rna_Main_texts_load(Main *bmain, ReportList *reports, const char *f
txt = BKE_text_load(filepath, bmain->name);
if (!txt)
BKE_reportf(reports, RPT_ERROR, "Can't read: \"%s\", %s", filepath,
errno ? strerror(errno) : "Unable to load text");
BKE_reportf(reports, RPT_ERROR, "Cannot read '%s': %s", filepath,
errno ? strerror(errno) : TIP_("unable to load text"));
return txt;
}
@@ -484,7 +488,7 @@ static void rna_Main_armatures_remove(Main *bmain, ReportList *reports, bArmatur
if (ID_REAL_USERS(arm) <= 0)
BKE_libblock_free(&bmain->armature, arm);
else
BKE_reportf(reports, RPT_ERROR, "Armature \"%s\" must have zero users to be removed, found %d",
BKE_reportf(reports, RPT_ERROR, "Armature '%s' must have zero users to be removed, found %d",
arm->id.name + 2, ID_REAL_USERS(arm));
/* XXX python now has invalid pointer? */
@@ -502,7 +506,7 @@ static void rna_Main_actions_remove(Main *bmain, ReportList *reports, bAction *a
if (ID_REAL_USERS(act) <= 0)
BKE_libblock_free(&bmain->action, act);
else
BKE_reportf(reports, RPT_ERROR, "Action \"%s\" must have zero users to be removed, found %d",
BKE_reportf(reports, RPT_ERROR, "Action '%s' must have zero users to be removed, found %d",
act->id.name + 2, ID_REAL_USERS(act));
/* XXX python now has invalid pointer? */
@@ -519,7 +523,7 @@ static void rna_Main_particles_remove(Main *bmain, ReportList *reports, Particle
if (ID_REAL_USERS(part) <= 0)
BKE_libblock_free(&bmain->particle, part);
else
BKE_reportf(reports, RPT_ERROR, "Particle Settings \"%s\" must have zero users to be removed, found %d",
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? */
@@ -533,8 +537,8 @@ static MovieClip *rna_Main_movieclip_load(Main *UNUSED(bmain), ReportList *repor
clip = BKE_movieclip_file_add(filepath);
if (!clip)
BKE_reportf(reports, RPT_ERROR, "Can't read: \"%s\", %s.", filepath,
errno ? strerror(errno) : "Unable to load movie clip");
BKE_reportf(reports, RPT_ERROR, "Cannot read '%s': %s", filepath,
errno ? strerror(errno) : TIP_("unable to load movie clip"));
return clip;
}
@@ -562,6 +566,19 @@ static void rna_Main_masks_remove(Main *bmain, Mask *mask)
/* XXX python now has invalid pointer? */
}
static void rna_Main_grease_pencil_remove(Main *bmain, ReportList *reports, bGPdata *gpd)
{
if (ID_REAL_USERS(gpd) <= 0) {
BKE_gpencil_free(gpd);
BKE_libblock_free(&bmain->gpencil, gpd);
}
else
BKE_reportf(reports, RPT_ERROR, "Grease Pencil '%s' must have zero users to be removed, found %d",
gpd->id.name + 2, ID_REAL_USERS(gpd));
/* XXX python now has invalid pointer? */
}
FreestyleLineStyle *rna_Main_linestyles_new(Main *bmain, const char* name)
{
FreestyleLineStyle *linestyle = FRS_new_linestyle(name, bmain);
@@ -994,9 +1011,9 @@ void RNA_def_main_images(BlenderRNA *brna, PropertyRNA *cprop)
RNA_def_function_ui_description(func, "Add a new image to the main database");
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);
parm = RNA_def_int(func, "width", 1024, 1, INT_MAX, "", "Width of the image", 1, 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_int(func, "height", 1024, 1, INT_MAX, "", "Height of the image", 1, INT_MAX);
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");
@@ -1528,6 +1545,20 @@ void RNA_def_main_gpencil(BlenderRNA *brna, PropertyRNA *cprop)
parm = RNA_def_boolean(func, "value", 0, "Value", "");
RNA_def_property_flag(parm, PROP_REQUIRED);
func = RNA_def_function(srna, "new", "gpencil_data_addnew");
RNA_def_function_flag(func, FUNC_NO_SELF);
parm = RNA_def_string(func, "name", "GreasePencil", 0, "", "New name for the datablock");
RNA_def_property_flag(parm, PROP_REQUIRED);
/* return type */
parm = RNA_def_pointer(func, "grease_pencil", "GreasePencil", "", "New grease pencil datablock");
RNA_def_function_return(func, parm);
func = RNA_def_function(srna, "remove", "rna_Main_grease_pencil_remove");
RNA_def_function_flag(func, FUNC_USE_REPORTS);
RNA_def_function_ui_description(func, "Remove a grease pencil instance from the current blendfile");
parm = RNA_def_pointer(func, "grease_pencil", "GreasePencil", "", "Grease Pencil to remove");
RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL);
prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_boolean_funcs(prop, "rna_Main_gpencil_is_updated_get", NULL);