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

@@ -645,7 +645,7 @@ static PyGetSetDef bpy_bmface_getseters[] = {
static PyGetSetDef bpy_bmloop_getseters[] = {
/* generic */
// flags are available but not used for loops.
/* flags are available but not used for loops. */
// {(char *)"select", (getter)bpy_bm_elem_hflag_get, (setter)bpy_bm_elem_hflag_set, (char *)bpy_bm_elem_select_doc, (void *)BM_ELEM_SELECT},
// {(char *)"hide", (getter)bpy_bm_elem_hflag_get, (setter)bpy_bm_elem_hflag_set, (char *)bpy_bm_elem_hide_doc, (void *)BM_ELEM_HIDDEN},
{(char *)"tag", (getter)bpy_bm_elem_hflag_get, (setter)bpy_bm_elem_hflag_set, (char *)bpy_bm_elem_tag_doc, (void *)BM_ELEM_TAG},

View File

@@ -387,7 +387,7 @@ void BPy_BM_init_types_select(void)
BPy_BMEditSelSeq_Type.tp_name = "BMEditSelSeq";
BPy_BMEditSelIter_Type.tp_name = "BMEditSelIter";
BPy_BMEditSelSeq_Type.tp_doc = NULL; // todo
BPy_BMEditSelSeq_Type.tp_doc = NULL; /* todo */
BPy_BMEditSelIter_Type.tp_doc = NULL;
BPy_BMEditSelSeq_Type.tp_repr = (reprfunc)NULL;

View File

@@ -300,40 +300,34 @@ static PyObject *BPy_IDGroup_Map_GetItem(BPy_IDProperty *self, PyObject *item)
}
/* returns NULL on success, error string on failure */
static int idp_sequence_type(PyObject *seq)
static int idp_sequence_type(PyObject *seq_fast)
{
PyObject *item;
int type = IDP_INT;
Py_ssize_t i, len = PySequence_Size(seq);
Py_ssize_t i, len = PySequence_Fast_GET_SIZE(seq_fast);
for (i = 0; i < len; i++) {
item = PySequence_GetItem(seq, i);
item = PySequence_Fast_GET_ITEM(seq_fast, i);
if (PyFloat_Check(item)) {
if (type == IDP_IDPARRAY) { /* mixed dict/int */
Py_DECREF(item);
return -1;
}
type = IDP_DOUBLE;
}
else if (PyLong_Check(item)) {
if (type == IDP_IDPARRAY) { /* mixed dict/int */
Py_DECREF(item);
return -1;
}
}
else if (PyMapping_Check(item)) {
if (i != 0 && (type != IDP_IDPARRAY)) { /* mixed dict/int */
Py_DECREF(item);
return -1;
}
type = IDP_IDPARRAY;
}
else {
Py_XDECREF(item);
return -1;
}
Py_DECREF(item);
}
return type;
@@ -386,48 +380,61 @@ const char *BPy_IDProperty_Map_ValidateAndCreate(PyObject *name_obj, IDProperty
//prop->subtype = IDP_STRING_SUB_BYTE;
}
else if (PySequence_Check(ob)) {
PyObject *ob_seq_fast = PySequence_Fast(ob, "py -> idprop");
PyObject *item;
int i;
if ((val.array.type = idp_sequence_type(ob)) == -1)
if (ob_seq_fast == NULL) {
PyErr_Print();
PyErr_Clear();
return "error converting the sequence";
}
if ((val.array.type = idp_sequence_type(ob_seq_fast)) == -1) {
Py_DECREF(ob_seq_fast);
return "only floats, ints and dicts are allowed in ID property arrays";
}
/* validate sequence and derive type.
* we assume IDP_INT unless we hit a float
* number; then we assume it's */
val.array.len = PySequence_Size(ob);
val.array.len = PySequence_Fast_GET_SIZE(ob_seq_fast);
switch (val.array.type) {
case IDP_DOUBLE:
prop = IDP_New(IDP_ARRAY, &val, name);
for (i = 0; i < val.array.len; i++) {
item = PySequence_GetItem(ob, i);
item = PySequence_Fast_GET_ITEM(ob_seq_fast, i);
((double *)IDP_Array(prop))[i] = (float)PyFloat_AsDouble(item);
Py_DECREF(item);
}
break;
case IDP_INT:
prop = IDP_New(IDP_ARRAY, &val, name);
for (i = 0; i < val.array.len; i++) {
item = PySequence_GetItem(ob, i);
item = PySequence_Fast_GET_ITEM(ob_seq_fast, i);
((int *)IDP_Array(prop))[i] = (int)PyLong_AsSsize_t(item);
Py_DECREF(item);
}
break;
case IDP_IDPARRAY:
prop = IDP_NewIDPArray(name);
for (i = 0; i < val.array.len; i++) {
const char *error;
item = PySequence_GetItem(ob, i);
item = PySequence_Fast_GET_ITEM(ob_seq_fast, i);
error = BPy_IDProperty_Map_ValidateAndCreate(NULL, prop, item);
Py_DECREF(item);
if (error)
if (error) {
Py_DECREF(ob_seq_fast);
return error;
}
}
break;
default:
Py_DECREF(ob_seq_fast);
return "internal error with idp array.type";
}
Py_DECREF(ob_seq_fast);
}
else if (PyMapping_Check(ob)) {
PyObject *keys, *vals, *key, *pval;
@@ -471,7 +478,7 @@ const char *BPy_IDProperty_Map_ValidateAndCreate(PyObject *name_obj, IDProperty
if (group->type == IDP_IDPARRAY) {
IDP_AppendArray(group, prop);
// IDP_FreeProperty(item); // IDP_AppendArray does a shallow copy (memcpy), only free memory
// IDP_FreeProperty(item); /* IDP_AppendArray does a shallow copy (memcpy), only free memory */
MEM_freeN(prop);
}
else {

View File

@@ -69,4 +69,4 @@ int PyC_FlagSet_ValueFromID(PyC_FlagSet *item, const char *identifier, int
int PyC_FlagSet_ToBitfield(PyC_FlagSet *items, PyObject *value, int *r_value, const char *error_prefix);
PyObject *PyC_FlagSet_FromBitfield(PyC_FlagSet *items, int flag);
#endif // __PY_CAPI_UTILS_H__
#endif /* __PY_CAPI_UTILS_H__ */

View File

@@ -30,13 +30,13 @@ set(INC
../../blenlib
../../blenloader
../../editors/include
../../gpu
../../makesdna
../../makesrna
../../windowmanager
../../gpu
../../../../intern/cycles/blender
../../freestyle/intern/python
../../../../intern/guardedalloc
../../../../intern/cycles/blender
)
set(INC_SYS

View File

@@ -29,4 +29,4 @@
PyObject *BPY_app_struct(void);
#endif // __BPY_APP_H__
#endif /* __BPY_APP_H__ */

View File

@@ -29,4 +29,4 @@
PyObject *BPY_app_ffmpeg_struct(void);
#endif // __BPY_APP_FFMPEG_H__
#endif /* __BPY_APP_FFMPEG_H__ */

View File

@@ -284,7 +284,7 @@ void bpy_app_generic_callback(struct Main *UNUSED(main), struct ID *id, void *ar
if (PyList_GET_SIZE(cb_list) > 0) {
PyGILState_STATE gilstate = PyGILState_Ensure();
PyObject *args = PyTuple_New(1); // save python creating each call
PyObject *args = PyTuple_New(1); /* save python creating each call */
PyObject *func;
PyObject *ret;
Py_ssize_t pos;

View File

@@ -29,4 +29,4 @@
PyObject *BPY_app_handlers_struct(void);
#endif // __BPY_APP_HANDLERS_H__
#endif /* __BPY_APP_HANDLERS_H__ */

View File

@@ -280,7 +280,7 @@ float BPY_driver_exec(ChannelDriver *driver, const float evaltime)
}
#if 0 // slow, with this can avoid all Py_CompileString above.
#if 0 /* slow, with this can avoid all Py_CompileString above. */
/* execute expression to get a value */
retval = PyRun_String(expr, Py_eval_input, bpy_pydriver_Dict, driver_vars);
#else

View File

@@ -36,4 +36,4 @@ extern PyObject *bpy_pydriver_Dict;
float BPY_driver_exec(struct ChannelDriver *driver, const float evaltime);
void BPY_driver_reset(void);
#endif // __BPY_DRIVER_H__
#endif /* __BPY_DRIVER_H__ */

View File

@@ -69,7 +69,7 @@
#include "BPY_extern.h"
#include "../generic/bpy_internal_import.h" // our own imports
#include "../generic/bpy_internal_import.h" /* our own imports */
#include "../generic/py_capi_utils.h"
/* inittab initialization functions */
@@ -180,10 +180,10 @@ void BPY_text_free_code(Text *text)
void BPY_modules_update(bContext *C)
{
#if 0 // slow, this runs all the time poll, draw etc 100's of time a sec.
#if 0 /* slow, this runs all the time poll, draw etc 100's of time a sec. */
PyObject *mod = PyImport_ImportModuleLevel("bpy", NULL, NULL, NULL, 0);
PyModule_AddObject(mod, "data", BPY_rna_module());
PyModule_AddObject(mod, "types", BPY_rna_types()); // atm this does not need updating
PyModule_AddObject(mod, "types", BPY_rna_types()); /* atm this does not need updating */
#endif
/* refreshes the main struct */
@@ -268,7 +268,7 @@ void BPY_python_start(int argc, const char **argv)
Py_Initialize();
// PySys_SetArgv(argc, argv); // broken in py3, not a huge deal
// PySys_SetArgv(argc, argv); /* broken in py3, not a huge deal */
/* sigh, why do python guys not have a (char **) version anymore? */
{
int i;

View File

@@ -28,4 +28,4 @@
void python_script_error_jump(const char *filepath, int *lineno, int *offset);
#endif // __BPY_TRACEBACK_H__
#endif /* __BPY_TRACEBACK_H__ */

View File

@@ -35,6 +35,8 @@
#include "BKE_report.h"
#include "BKE_context.h"
#include "BLF_translation.h"
#include "../generic/py_capi_utils.h"
static bContext *__py_context = NULL;
@@ -79,7 +81,7 @@ short BPy_reports_to_error(ReportList *reports, PyObject *exception, const short
short BPy_errors_to_report(ReportList *reports)
{
PyObject *pystring;
PyObject *pystring_format = NULL; // workaround, see below
PyObject *pystring_format = NULL; /* workaround, see below */
char *cstring;
const char *filename;
@@ -98,7 +100,7 @@ short BPy_errors_to_report(ReportList *reports)
pystring = PyC_ExceptionBuffer();
if (pystring == NULL) {
BKE_report(reports, RPT_ERROR, "unknown py-exception, couldn't convert");
BKE_report(reports, RPT_ERROR, "Unknown py-exception, couldn't convert");
return 0;
}
@@ -108,17 +110,18 @@ short BPy_errors_to_report(ReportList *reports)
cstring = _PyUnicode_AsString(pystring);
#if 0 // ARG!. workaround for a bug in blenders use of vsnprintf
#if 0 /* ARG!. workaround for a bug in blenders use of vsnprintf */
BKE_reportf(reports, RPT_ERROR, "%s\nlocation:%s:%d\n", cstring, filename, lineno);
#else
pystring_format = PyUnicode_FromFormat("%s\nlocation:%s:%d\n", cstring, filename, lineno);
pystring_format = PyUnicode_FromFormat(TIP_("%s\nlocation:%s:%d\n"), cstring, filename, lineno);
cstring = _PyUnicode_AsString(pystring_format);
BKE_report(reports, RPT_ERROR, cstring);
#endif
fprintf(stderr, "%s\nlocation:%s:%d\n", cstring, filename, lineno); // not exactly needed. just for testing
/* not exactly needed. just for testing */
fprintf(stderr, TIP_("%s\nlocation:%s:%d\n"), cstring, filename, lineno);
Py_DECREF(pystring);
Py_DECREF(pystring_format); // workaround
Py_DECREF(pystring_format); /* workaround */
return 1;
}

View File

@@ -858,7 +858,7 @@ PyTypeObject color_Type = {
* (i.e. it was allocated elsewhere by MEM_mallocN())
* pass Py_NEW - if vector is not a WRAPPER and managed by PYTHON
* (i.e. it must be created here with PyMEM_malloc())*/
PyObject *Color_CreatePyObject(float *col, int type, PyTypeObject *base_type)
PyObject *Color_CreatePyObject(float col[3], int type, PyTypeObject *base_type)
{
ColorObject *self;

View File

@@ -47,7 +47,7 @@ typedef struct {
* blender (stored in blend_data). This is an either/or struct not both*/
//prototypes
PyObject *Color_CreatePyObject(float *col, int type, PyTypeObject *base_type);
PyObject *Color_CreatePyObject(float col[3], int type, PyTypeObject *base_type);
PyObject *Color_CreatePyObject_cb(PyObject *cb_user,
unsigned char cb_type, unsigned char cb_subtype);

View File

@@ -43,6 +43,7 @@
#include "BLI_blenlib.h"
#include "BLI_math.h"
#include "BLI_noise.h"
#include "BLI_utildefines.h"
#include "MEM_guardedalloc.h"

View File

@@ -33,4 +33,4 @@ PyMODINIT_FUNC PyInit_mathutils_noise(void);
PyMODINIT_FUNC PyInit_mathutils_noise_types(void);
PyMODINIT_FUNC PyInit_mathutils_noise_metrics(void);
#endif // __MATHUTILS_NOISE_H__
#endif /* __MATHUTILS_NOISE_H__ */

View File

@@ -95,7 +95,7 @@ def seek(r, txt, recurs):
if GEN_PATH:
newtxt = txt + '.' + item
if item == 'rna_type' and VERBOSE_TYPE == False: # just avoid because it spits out loads of data
if item == 'rna_type' and VERBOSE_TYPE is False: # just avoid because it spits out loads of data
continue
value = getattr(r, item, None)
@@ -114,7 +114,7 @@ def seek(r, txt, recurs):
except:
length = 0
if VERBOSE == False and length >= 4:
if VERBOSE is False and length >= 4:
for i in (0, length - 1):
if i > 0:
if PRINT_DATA: