Merged changes in the trunk up to revision 51853.

Conflicts resolved:
source/blender/blenloader/intern/readfile.c
source/blender/bmesh/operators/bmo_utils.c

This commit also includes a fix of a bug identified during the merge and committed in revision 51853.
Thanks Thomas (dingto) for the timely fix!
This commit is contained in:
2012-11-04 02:22:56 +00:00
401 changed files with 5843 additions and 3351 deletions

View File

@@ -75,7 +75,7 @@ static EnumPropertyItem property_flag_enum_items[] = {
static EnumPropertyItem property_subtype_string_items[] = {
{PROP_FILEPATH, "FILE_PATH", 0, "File Path", ""},
{PROP_DIRPATH, "DIR_PATH", 0, "Directory Path", ""},
{PROP_FILENAME, "FILENAME", 0, "Filename", ""},
{PROP_FILENAME, "FILE_NAME", 0, "Filename", ""},
{PROP_BYTESTRING, "BYTE_STRING", 0, "Byte String", ""},
{PROP_TRANSLATE, "TRANSLATE", 0, "Translate", ""},
{PROP_PASSWORD, "PASSWORD", 0, "Password", 0},
@@ -310,35 +310,38 @@ static int py_long_as_int(PyObject *py_long, int *r_int)
/* terse macros for error checks shared between all funcs cant use function
* calls because of static strings passed to pyrna_set_to_enum_bitfield */
#define BPY_PROPDEF_CHECK(_func, _property_flag_items) \
if (id_len >= MAX_IDPROP_NAME) { \
if (UNLIKELY(id_len >= MAX_IDPROP_NAME)) { \
PyErr_Format(PyExc_TypeError, \
#_func"(): '%.200s' too long, max length is %d", \
id, MAX_IDPROP_NAME - 1); \
return NULL; \
} \
if (RNA_def_property_free_identifier(srna, id) == -1) { \
if (UNLIKELY(RNA_def_property_free_identifier(srna, id) == -1)) { \
PyErr_Format(PyExc_TypeError, \
#_func"(): '%s' is defined as a non-dynamic type", \
id); \
return NULL; \
} \
if (pyopts && pyrna_set_to_enum_bitfield(_property_flag_items, \
if (UNLIKELY(pyopts && pyrna_set_to_enum_bitfield(_property_flag_items, \
pyopts, \
&opts, \
#_func"(options={ ...}):")) \
#_func"(options={ ...}):"))) \
{ \
return NULL; \
} (void)0
#define BPY_PROPDEF_SUBTYPE_CHECK(_func, _property_flag_items, _subtype) \
BPY_PROPDEF_CHECK(_func, _property_flag_items); \
if (pysubtype && RNA_enum_value_from_id(_subtype, \
if (UNLIKELY(pysubtype && RNA_enum_value_from_id(_subtype, \
pysubtype, \
&subtype) == 0) \
&subtype) == 0)) \
{ \
const char *enum_str = BPy_enum_as_string(_subtype); \
PyErr_Format(PyExc_TypeError, \
#_func"(subtype='%s'): invalid subtype", \
pysubtype); \
#_func"(subtype='%s'): " \
"subtype not found in (%s)", \
pysubtype, enum_str); \
MEM_freeN((void *)enum_str); \
return NULL; \
} (void)0
@@ -922,7 +925,7 @@ BPY_PROPDEF_NAME_DOC
BPY_PROPDEF_DESC_DOC
" :arg options: Enumerator in ['HIDDEN', 'SKIP_SAVE', 'ANIMATABLE', 'LIBRARY_EDITABLE'].\n"
" :type options: set\n"
" :arg subtype: Enumerator in ['FILE_PATH', 'DIR_PATH', 'FILENAME', 'NONE'].\n"
" :arg subtype: Enumerator in ['FILE_PATH', 'DIR_PATH', 'FILE_NAME', 'NONE'].\n"
" :type subtype: string\n"
BPY_PROPDEF_UPDATE_DOC
);

View File

@@ -121,8 +121,7 @@ int pyrna_prop_validity_check(BPy_PropertyRNA *self)
void pyrna_invalidate(BPy_DummyPointerRNA *self)
{
self->ptr.type = NULL; /* this is checked for validity */
self->ptr.id.data = NULL; /* should not be needed but prevent bad pointer access, just in case */
RNA_POINTER_INVALIDATE(&self->ptr);
}
#ifdef USE_PYRNA_INVALIDATE_GC
@@ -832,7 +831,7 @@ static PyObject *pyrna_struct_str(BPy_StructRNA *self)
const char *name;
if (!PYRNA_STRUCT_IS_VALID(self)) {
return PyUnicode_FromFormat("<bpy_struct, %.200s dead>",
return PyUnicode_FromFormat("<bpy_struct, %.200s invalid>",
Py_TYPE(self)->tp_name);
}
@@ -1776,10 +1775,21 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyOb
if (data) {
if (flag & PROP_RNAPTR) {
if (value == Py_None)
memset(data, 0, sizeof(PointerRNA));
else
*((PointerRNA *)data) = param->ptr;
if (flag & PROP_THICK_WRAP) {
if (value == Py_None)
memset(data, 0, sizeof(PointerRNA));
else
*((PointerRNA *)data) = param->ptr;
}
else {
/* for function calls, we sometimes want to pass the 'ptr' directly,
* watch out that it remains valid!, possibly we could support this later if needed */
BLI_assert(value_new == NULL);
if (value == Py_None)
*((void **)data) = NULL;
else
*((PointerRNA **)data) = &param->ptr;
}
}
else if (value == Py_None) {
*((void **)data) = NULL;
@@ -3866,6 +3876,12 @@ static PyObject *pyrna_prop_collection_idprop_add(BPy_PropertyRNA *self)
{
PointerRNA r_ptr;
#ifdef USE_PEDANTIC_WRITE
if (rna_disallow_writes && rna_id_write_error(&self->ptr, NULL)) {
return NULL;
}
#endif /* USE_PEDANTIC_WRITE */
RNA_property_collection_add(&self->ptr, self->prop, &r_ptr);
if (!r_ptr.data) {
PyErr_SetString(PyExc_TypeError, "bpy_prop_collection.add(): not supported for this collection");
@@ -3880,6 +3896,12 @@ static PyObject *pyrna_prop_collection_idprop_remove(BPy_PropertyRNA *self, PyOb
{
int key = PyLong_AsLong(value);
#ifdef USE_PEDANTIC_WRITE
if (rna_disallow_writes && rna_id_write_error(&self->ptr, NULL)) {
return NULL;
}
#endif /* USE_PEDANTIC_WRITE */
if (key == -1 && PyErr_Occurred()) {
PyErr_SetString(PyExc_TypeError, "bpy_prop_collection.remove(): expected one int argument");
return NULL;
@@ -3895,6 +3917,12 @@ static PyObject *pyrna_prop_collection_idprop_remove(BPy_PropertyRNA *self, PyOb
static PyObject *pyrna_prop_collection_idprop_clear(BPy_PropertyRNA *self)
{
#ifdef USE_PEDANTIC_WRITE
if (rna_disallow_writes && rna_id_write_error(&self->ptr, NULL)) {
return NULL;
}
#endif /* USE_PEDANTIC_WRITE */
RNA_property_collection_clear(&self->ptr, self->prop);
Py_RETURN_NONE;
@@ -3904,6 +3932,12 @@ static PyObject *pyrna_prop_collection_idprop_move(BPy_PropertyRNA *self, PyObje
{
int key = 0, pos = 0;
#ifdef USE_PEDANTIC_WRITE
if (rna_disallow_writes && rna_id_write_error(&self->ptr, NULL)) {
return NULL;
}
#endif /* USE_PEDANTIC_WRITE */
if (!PyArg_ParseTuple(args, "ii", &key, &pos)) {
PyErr_SetString(PyExc_TypeError, "bpy_prop_collection.move(): expected two ints as arguments");
return NULL;
@@ -6917,11 +6951,9 @@ static int bpy_class_call(bContext *C, PointerRNA *ptr, FunctionRNA *func, Param
#ifdef USE_PEDANTIC_WRITE
const int is_operator = RNA_struct_is_a(ptr->type, &RNA_Operator);
const char *func_id = RNA_function_identifier(func);
// const char *func_id = RNA_function_identifier(func); /* UNUSED */
/* testing, for correctness, not operator and not draw function */
const short is_readonly = ((strncmp("draw", func_id, 4) == 0) || /* draw or draw_header */
/*strstr("render", func_id) ||*/
!is_operator);
const short is_readonly = !(RNA_function_flag(func) & FUNC_ALLOW_WRITE);
#endif
py_class = RNA_struct_py_type_get(ptr->type);