Merged changes in the trunk up to revision 32565.
This commit is contained in:
@@ -34,7 +34,9 @@
|
||||
|
||||
#include "BLI_path_util.h"
|
||||
#include "BLI_bpath.h"
|
||||
|
||||
|
||||
#include "BKE_utildefines.h"
|
||||
|
||||
/* external util modules */
|
||||
#include "../generic/geometry.h"
|
||||
#include "../generic/bgl.h"
|
||||
@@ -53,7 +55,7 @@ static char bpy_script_paths_doc[] =
|
||||
" :return: (system, user) strings will be empty when not found.\n"
|
||||
" :rtype: tuple of strigs\n";
|
||||
|
||||
PyObject *bpy_script_paths(PyObject *self)
|
||||
PyObject *bpy_script_paths(PyObject *UNUSED(self))
|
||||
{
|
||||
PyObject *ret= PyTuple_New(2);
|
||||
char *path;
|
||||
@@ -75,7 +77,7 @@ static char bpy_blend_paths_doc[] =
|
||||
" :type absolute: boolean\n"
|
||||
" :return: path list.\n"
|
||||
" :rtype: list of strigs\n";
|
||||
static PyObject *bpy_blend_paths(PyObject * self, PyObject *args, PyObject *kw)
|
||||
static PyObject *bpy_blend_paths(PyObject *UNUSED(self), PyObject *args, PyObject *kw)
|
||||
{
|
||||
struct BPathIterator bpi;
|
||||
PyObject *list = PyList_New(0), *st; /* stupidly big string to be safe */
|
||||
@@ -126,7 +128,7 @@ static char bpy_user_resource_doc[] =
|
||||
" :type subdir: string\n"
|
||||
" :return: a path.\n"
|
||||
" :rtype: string\n";
|
||||
static PyObject *bpy_user_resource(PyObject * self, PyObject *args, PyObject *kw)
|
||||
static PyObject *bpy_user_resource(PyObject *UNUSED(self), PyObject *args, PyObject *kw)
|
||||
{
|
||||
char *type;
|
||||
char *subdir= NULL;
|
||||
|
||||
@@ -26,16 +26,22 @@
|
||||
|
||||
#include "BLI_path_util.h"
|
||||
|
||||
#include "BKE_utildefines.h"
|
||||
#include "BKE_blender.h"
|
||||
#include "BKE_global.h"
|
||||
#include "structseq.h"
|
||||
|
||||
#include "../generic/py_capi_utils.h"
|
||||
|
||||
#ifdef BUILD_DATE
|
||||
extern char build_date[];
|
||||
extern char build_time[];
|
||||
extern char build_rev[];
|
||||
extern char build_platform[];
|
||||
extern char build_type[];
|
||||
extern char build_cflags[];
|
||||
extern char build_cxxflags[];
|
||||
extern char build_linkflags[];
|
||||
#endif
|
||||
|
||||
static PyTypeObject BlenderAppType;
|
||||
@@ -44,7 +50,6 @@ static PyStructSequence_Field app_info_fields[] = {
|
||||
{"version", "The Blender version as a tuple of 3 numbers. eg. (2, 50, 11)"},
|
||||
{"version_string", "The Blender version formatted as a string"},
|
||||
{"binary_path", "The location of blenders executable, useful for utilities that spawn new instances"},
|
||||
{"debug", "Boolean, set when blender is running in debug mode (started with -d)"},
|
||||
{"background", "Boolean, True when blender is running without a user interface (started with -b)"},
|
||||
|
||||
/* buildinfo */
|
||||
@@ -53,6 +58,9 @@ static PyStructSequence_Field app_info_fields[] = {
|
||||
{"build_revision", "The subversion revision this blender instance was built with"},
|
||||
{"build_platform", "The platform this blender instance was built for"},
|
||||
{"build_type", "The type of build (Release, Debug)"},
|
||||
{"build_cflags", ""},
|
||||
{"build_cxxflags", ""},
|
||||
{"build_linkflags", ""},
|
||||
{0}
|
||||
};
|
||||
|
||||
@@ -85,7 +93,6 @@ static PyObject *make_app_info(void)
|
||||
SetObjItem(Py_BuildValue("(iii)", BLENDER_VERSION/100, BLENDER_VERSION%100, BLENDER_SUBVERSION));
|
||||
SetObjItem(PyUnicode_FromFormat("%d.%02d (sub %d)", BLENDER_VERSION/100, BLENDER_VERSION%100, BLENDER_SUBVERSION));
|
||||
SetStrItem(bprogname);
|
||||
SetObjItem(PyBool_FromLong(G.f & G_DEBUG));
|
||||
SetObjItem(PyBool_FromLong(G.background));
|
||||
|
||||
/* build info */
|
||||
@@ -95,12 +102,18 @@ static PyObject *make_app_info(void)
|
||||
SetStrItem(build_rev);
|
||||
SetStrItem(build_platform);
|
||||
SetStrItem(build_type);
|
||||
SetStrItem(build_cflags);
|
||||
SetStrItem(build_cxxflags);
|
||||
SetStrItem(build_linkflags);
|
||||
#else
|
||||
SetStrItem("Unknown");
|
||||
SetStrItem("Unknown");
|
||||
SetStrItem("Unknown");
|
||||
SetStrItem("Unknown");
|
||||
SetStrItem("Unknown");
|
||||
SetStrItem("Unknown");
|
||||
SetStrItem("Unknown");
|
||||
SetStrItem("Unknown");
|
||||
#endif
|
||||
|
||||
#undef SetIntItem
|
||||
@@ -114,10 +127,51 @@ static PyObject *make_app_info(void)
|
||||
return app_info;
|
||||
}
|
||||
|
||||
/* a few getsets because it makes sense for them to be in bpy.app even though
|
||||
* they are not static */
|
||||
static PyObject *bpy_app_debug_get(PyObject *UNUSED(self), void *UNUSED(closure))
|
||||
{
|
||||
return PyBool_FromLong(G.f & G_DEBUG);
|
||||
}
|
||||
|
||||
static int bpy_app_debug_set(PyObject *UNUSED(self), PyObject *value, void *UNUSED(closure))
|
||||
{
|
||||
int param= PyObject_IsTrue(value);
|
||||
|
||||
if(param < 0) {
|
||||
PyErr_SetString(PyExc_TypeError, "bpy.app.debug can only be True/False");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if(param) G.f |= G_DEBUG;
|
||||
else G.f &= ~G_DEBUG;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static PyObject *bpy_app_tempdir_get(PyObject *UNUSED(self), void *UNUSED(closure))
|
||||
{
|
||||
extern char btempdir[];
|
||||
return PyC_UnicodeFromByte(btempdir);
|
||||
}
|
||||
|
||||
PyGetSetDef bpy_app_debug_getset= {"debug", bpy_app_debug_get, bpy_app_debug_set, "Boolean, set when blender is running in debug mode (started with -d)", NULL};
|
||||
PyGetSetDef bpy_app_tempdir_getset= {"tempdir", bpy_app_tempdir_get, NULL, "String, the temp directory used by blender (read-only)", NULL};
|
||||
|
||||
static void py_struct_seq_getset_init(void)
|
||||
{
|
||||
/* tricky dynamic members, not to py-spec! */
|
||||
|
||||
PyDict_SetItemString(BlenderAppType.tp_dict, bpy_app_debug_getset.name, PyDescr_NewGetSet(&BlenderAppType, &bpy_app_debug_getset));
|
||||
PyDict_SetItemString(BlenderAppType.tp_dict, bpy_app_tempdir_getset.name, PyDescr_NewGetSet(&BlenderAppType, &bpy_app_tempdir_getset));
|
||||
}
|
||||
/* end dynamic bpy.app */
|
||||
|
||||
|
||||
PyObject *BPY_app_struct(void)
|
||||
{
|
||||
PyObject *ret;
|
||||
|
||||
|
||||
PyStructSequence_InitType(&BlenderAppType, &app_info_desc);
|
||||
|
||||
ret= make_app_info();
|
||||
@@ -125,6 +179,10 @@ PyObject *BPY_app_struct(void)
|
||||
/* prevent user from creating new instances */
|
||||
BlenderAppType.tp_init = NULL;
|
||||
BlenderAppType.tp_new = NULL;
|
||||
|
||||
|
||||
/* kindof a hack ontop of PyStructSequence */
|
||||
py_struct_seq_getset_init();
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@@ -237,7 +237,7 @@ static char *copy_values(PyObject *seq, PointerRNA *ptr, PropertyRNA *prop, int
|
||||
return data;
|
||||
}
|
||||
|
||||
static int py_to_array(PyObject *py, PointerRNA *ptr, PropertyRNA *prop, ParameterList *parms, char *param_data, ItemTypeCheckFunc check_item_type, const char *item_type_str, int item_size, ItemConvertFunc convert_item, RNA_SetArrayFunc rna_set_array, const char *error_prefix)
|
||||
static int py_to_array(PyObject *py, PointerRNA *ptr, PropertyRNA *prop, char *param_data, ItemTypeCheckFunc check_item_type, const char *item_type_str, int item_size, ItemConvertFunc convert_item, RNA_SetArrayFunc rna_set_array, const char *error_prefix)
|
||||
{
|
||||
int totdim, dim_size[MAX_ARRAY_DIMENSION];
|
||||
int totitem;
|
||||
@@ -358,18 +358,18 @@ static void bool_set_index(PointerRNA *ptr, PropertyRNA *prop, int index, void *
|
||||
RNA_property_boolean_set_index(ptr, prop, index, *(int*)value);
|
||||
}
|
||||
|
||||
int pyrna_py_to_array(PointerRNA *ptr, PropertyRNA *prop, ParameterList *parms, char *param_data, PyObject *py, const char *error_prefix)
|
||||
int pyrna_py_to_array(PointerRNA *ptr, PropertyRNA *prop, char *param_data, PyObject *py, const char *error_prefix)
|
||||
{
|
||||
int ret;
|
||||
switch (RNA_property_type(prop)) {
|
||||
case PROP_FLOAT:
|
||||
ret= py_to_array(py, ptr, prop, parms, param_data, py_float_check, "float", sizeof(float), py_to_float, (RNA_SetArrayFunc)RNA_property_float_set_array, error_prefix);
|
||||
ret= py_to_array(py, ptr, prop, param_data, py_float_check, "float", sizeof(float), py_to_float, (RNA_SetArrayFunc)RNA_property_float_set_array, error_prefix);
|
||||
break;
|
||||
case PROP_INT:
|
||||
ret= py_to_array(py, ptr, prop, parms, param_data, py_int_check, "int", sizeof(int), py_to_int, (RNA_SetArrayFunc)RNA_property_int_set_array, error_prefix);
|
||||
ret= py_to_array(py, ptr, prop, param_data, py_int_check, "int", sizeof(int), py_to_int, (RNA_SetArrayFunc)RNA_property_int_set_array, error_prefix);
|
||||
break;
|
||||
case PROP_BOOLEAN:
|
||||
ret= py_to_array(py, ptr, prop, parms, param_data, py_bool_check, "boolean", sizeof(int), py_to_bool, (RNA_SetArrayFunc)RNA_property_boolean_set_array, error_prefix);
|
||||
ret= py_to_array(py, ptr, prop, param_data, py_bool_check, "boolean", sizeof(int), py_to_bool, (RNA_SetArrayFunc)RNA_property_boolean_set_array, error_prefix);
|
||||
break;
|
||||
default:
|
||||
PyErr_SetString(PyExc_TypeError, "not an array type");
|
||||
|
||||
@@ -43,6 +43,7 @@
|
||||
#include "BLI_math_base.h"
|
||||
#include "BLI_string.h"
|
||||
|
||||
#include "BKE_utildefines.h"
|
||||
#include "BKE_context.h"
|
||||
#include "BKE_text.h"
|
||||
#include "BKE_font.h" /* only for utf8towchar */
|
||||
@@ -104,7 +105,8 @@ void bpy_context_set(bContext *C, PyGILState_STATE *gilstate)
|
||||
}
|
||||
}
|
||||
|
||||
void bpy_context_clear(bContext *C, PyGILState_STATE *gilstate)
|
||||
/* context should be used but not now because it causes some bugs */
|
||||
void bpy_context_clear(bContext *UNUSED(C), PyGILState_STATE *gilstate)
|
||||
{
|
||||
py_call_level--;
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
#include "MEM_guardedalloc.h"
|
||||
#include "BKE_report.h"
|
||||
|
||||
static PyObject *pyop_poll( PyObject * self, PyObject * args)
|
||||
static PyObject *pyop_poll(PyObject *UNUSED(self), PyObject *args)
|
||||
{
|
||||
wmOperatorType *ot;
|
||||
char *opname;
|
||||
@@ -80,7 +80,7 @@ static PyObject *pyop_poll( PyObject * self, PyObject * args)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static PyObject *pyop_call( PyObject * self, PyObject * args)
|
||||
static PyObject *pyop_call(PyObject *UNUSED(self), PyObject *args)
|
||||
{
|
||||
wmOperatorType *ot;
|
||||
int error_val = 0;
|
||||
@@ -196,7 +196,7 @@ static PyObject *pyop_call( PyObject * self, PyObject * args)
|
||||
|
||||
}
|
||||
|
||||
static PyObject *pyop_as_string( PyObject * self, PyObject * args)
|
||||
static PyObject *pyop_as_string(PyObject *UNUSED(self), PyObject *args)
|
||||
{
|
||||
wmOperatorType *ot;
|
||||
PointerRNA ptr;
|
||||
@@ -248,7 +248,7 @@ static PyObject *pyop_as_string( PyObject * self, PyObject * args)
|
||||
return pybuf;
|
||||
}
|
||||
|
||||
static PyObject *pyop_dir(PyObject *self)
|
||||
static PyObject *pyop_dir(PyObject *UNUSED(self))
|
||||
{
|
||||
PyObject *list = PyList_New(0), *name;
|
||||
wmOperatorType *ot;
|
||||
@@ -262,7 +262,7 @@ static PyObject *pyop_dir(PyObject *self)
|
||||
return list;
|
||||
}
|
||||
|
||||
static PyObject *pyop_getrna(PyObject *self, PyObject *value)
|
||||
static PyObject *pyop_getrna(PyObject *UNUSED(self), PyObject *value)
|
||||
{
|
||||
wmOperatorType *ot;
|
||||
PointerRNA ptr;
|
||||
|
||||
@@ -84,7 +84,7 @@ void macro_wrapper(wmOperatorType *ot, void *userdata)
|
||||
operator_properties_init(ot);
|
||||
}
|
||||
|
||||
PyObject *PYOP_wrap_macro_define(PyObject *self, PyObject *args)
|
||||
PyObject *PYOP_wrap_macro_define(PyObject *UNUSED(self), PyObject *args)
|
||||
{
|
||||
wmOperatorType *ot;
|
||||
wmOperatorTypeMacro *otmacro;
|
||||
|
||||
@@ -58,7 +58,7 @@
|
||||
#include "../generic/IDProp.h" /* for IDprop lookups */
|
||||
#include "../generic/py_capi_utils.h"
|
||||
|
||||
static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, ParameterList *parms, void *data, PyObject *value, const char *error_prefix);
|
||||
static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyObject *value, const char *error_prefix);
|
||||
static PyObject *pyrna_prop_array_subscript_slice(BPy_PropertyArrayRNA *self, PointerRNA *ptr, PropertyRNA *prop, int start, int stop, int length);
|
||||
static Py_ssize_t pyrna_prop_array_length(BPy_PropertyArrayRNA *self);
|
||||
static Py_ssize_t pyrna_prop_collection_length(BPy_PropertyRNA *self);
|
||||
@@ -135,7 +135,7 @@ static int mathutils_rna_vector_set(BaseMathObject *bmo, int subtype)
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int mathutils_rna_vector_get_index(BaseMathObject *bmo, int subtype, int index)
|
||||
static int mathutils_rna_vector_get_index(BaseMathObject *bmo, int UNUSED(subtype), int index)
|
||||
{
|
||||
BPy_PropertyRNA *self= (BPy_PropertyRNA *)bmo->cb_user;
|
||||
|
||||
@@ -146,7 +146,7 @@ static int mathutils_rna_vector_get_index(BaseMathObject *bmo, int subtype, int
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int mathutils_rna_vector_set_index(BaseMathObject *bmo, int subtype, int index)
|
||||
static int mathutils_rna_vector_set_index(BaseMathObject *bmo, int UNUSED(subtype), int index)
|
||||
{
|
||||
BPy_PropertyRNA *self= (BPy_PropertyRNA *)bmo->cb_user;
|
||||
|
||||
@@ -176,7 +176,7 @@ Mathutils_Callback mathutils_rna_array_cb = {
|
||||
/* bpyrna matrix callbacks */
|
||||
static int mathutils_rna_matrix_cb_index= -1; /* index for our callbacks */
|
||||
|
||||
static int mathutils_rna_matrix_get(BaseMathObject *bmo, int subtype)
|
||||
static int mathutils_rna_matrix_get(BaseMathObject *bmo, int UNUSED(subtype))
|
||||
{
|
||||
BPy_PropertyRNA *self= (BPy_PropertyRNA *)bmo->cb_user;
|
||||
|
||||
@@ -187,7 +187,7 @@ static int mathutils_rna_matrix_get(BaseMathObject *bmo, int subtype)
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int mathutils_rna_matrix_set(BaseMathObject *bmo, int subtype)
|
||||
static int mathutils_rna_matrix_set(BaseMathObject *bmo, int UNUSED(subtype))
|
||||
{
|
||||
BPy_PropertyRNA *self= (BPy_PropertyRNA *)bmo->cb_user;
|
||||
|
||||
@@ -864,7 +864,7 @@ int pyrna_pydict_to_props(PointerRNA *ptr, PyObject *kw, int all_args, const cha
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
if (pyrna_py_to_prop(ptr, prop, NULL, NULL, item, error_prefix)) {
|
||||
if (pyrna_py_to_prop(ptr, prop, NULL, item, error_prefix)) {
|
||||
error_val= -1;
|
||||
break;
|
||||
}
|
||||
@@ -918,7 +918,7 @@ static PyObject *pyrna_func_to_py(BPy_DummyPointerRNA *pyrna, FunctionRNA *func)
|
||||
|
||||
|
||||
|
||||
static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, ParameterList *parms, void *data, PyObject *value, const char *error_prefix)
|
||||
static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyObject *value, const char *error_prefix)
|
||||
{
|
||||
/* XXX hard limits should be checked here */
|
||||
int type = RNA_property_type(prop);
|
||||
@@ -941,7 +941,7 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, ParameterList *p
|
||||
return -1;
|
||||
}
|
||||
/* done getting the length */
|
||||
ok= pyrna_py_to_array(ptr, prop, parms, data, value, error_prefix);
|
||||
ok= pyrna_py_to_array(ptr, prop, data, value, error_prefix);
|
||||
|
||||
if (!ok) {
|
||||
/* PyErr_Format(PyExc_AttributeError, "%.200s %s", error_prefix, error_str); */
|
||||
@@ -964,7 +964,7 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, ParameterList *p
|
||||
else
|
||||
param = PyLong_AsLong( value );
|
||||
|
||||
if( param < 0 || param > 1) {
|
||||
if(param < 0) {
|
||||
PyErr_Format(PyExc_TypeError, "%.200s %.200s.%.200s expected True/False or 0/1", error_prefix, RNA_struct_identifier(ptr->type), RNA_property_identifier(prop));
|
||||
return -1;
|
||||
} else {
|
||||
@@ -1391,7 +1391,7 @@ static PyObject *pyrna_prop_collection_subscript_str(BPy_PropertyRNA *self, cons
|
||||
}
|
||||
/* static PyObject *pyrna_prop_array_subscript_str(BPy_PropertyRNA *self, char *keyname) */
|
||||
|
||||
static PyObject *pyrna_prop_collection_subscript_slice(PointerRNA *ptr, PropertyRNA *prop, int start, int stop, int length)
|
||||
static PyObject *pyrna_prop_collection_subscript_slice(PointerRNA *ptr, PropertyRNA *prop, int start, int stop)
|
||||
{
|
||||
PointerRNA newptr;
|
||||
PyObject *list = PyList_New(stop - start);
|
||||
@@ -1513,7 +1513,7 @@ static PyObject *pyrna_prop_collection_subscript(BPy_PropertyRNA *self, PyObject
|
||||
return PyList_New(0);
|
||||
}
|
||||
else if (step == 1) {
|
||||
return pyrna_prop_collection_subscript_slice(&self->ptr, self->prop, start, stop, len);
|
||||
return pyrna_prop_collection_subscript_slice(&self->ptr, self->prop, start, stop);
|
||||
}
|
||||
else {
|
||||
PyErr_SetString(PyExc_TypeError, "bpy_prop_collection[slice]: slice steps not supported with rna");
|
||||
@@ -2431,7 +2431,7 @@ static char pyrna_struct_type_recast_doc[] =
|
||||
" :return: a new instance of this object with the type initialized again.\n"
|
||||
" :rtype: subclass of :class:`bpy_struct`";
|
||||
|
||||
static PyObject *pyrna_struct_type_recast(BPy_StructRNA *self, PyObject *args)
|
||||
static PyObject *pyrna_struct_type_recast(BPy_StructRNA *self)
|
||||
{
|
||||
PointerRNA r_ptr;
|
||||
RNA_pointer_recast(&self->ptr, &r_ptr);
|
||||
@@ -2751,7 +2751,7 @@ static int pyrna_struct_setattro( BPy_StructRNA *self, PyObject *pyname, PyObjec
|
||||
PyErr_SetString(PyExc_AttributeError, "bpy_struct: del not supported");
|
||||
return -1;
|
||||
}
|
||||
return pyrna_py_to_prop(&self->ptr, prop, NULL, NULL, value, "bpy_struct: item.attr = val:");
|
||||
return pyrna_py_to_prop(&self->ptr, prop, NULL, value, "bpy_struct: item.attr = val:");
|
||||
}
|
||||
else {
|
||||
return PyObject_GenericSetAttr((PyObject *)self, pyname, value);
|
||||
@@ -2835,7 +2835,7 @@ static int pyrna_prop_collection_setattro( BPy_PropertyRNA *self, PyObject *pyna
|
||||
else if(RNA_property_collection_type_get(&self->ptr, self->prop, &r_ptr)) {
|
||||
if ((prop = RNA_struct_find_property(&r_ptr, name))) {
|
||||
/* pyrna_py_to_prop sets its own exceptions */
|
||||
return pyrna_py_to_prop(&r_ptr, prop, NULL, NULL, value, "BPy_PropertyRNA - Attribute (setattr):");
|
||||
return pyrna_py_to_prop(&r_ptr, prop, NULL, value, "BPy_PropertyRNA - Attribute (setattr):");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3409,7 +3409,7 @@ static struct PyMethodDef pyrna_prop_collection_idprop_methods[] = {
|
||||
|
||||
/* only needed for subtyping, so a new class gets a valid BPy_StructRNA
|
||||
* todo - also accept useful args */
|
||||
static PyObject * pyrna_struct_new(PyTypeObject *type, PyObject *args, PyObject *kwds) {
|
||||
static PyObject * pyrna_struct_new(PyTypeObject *type, PyObject *args, PyObject *UNUSED(kwds)) {
|
||||
|
||||
BPy_StructRNA *base;
|
||||
|
||||
@@ -3432,7 +3432,7 @@ static PyObject * pyrna_struct_new(PyTypeObject *type, PyObject *args, PyObject
|
||||
|
||||
/* only needed for subtyping, so a new class gets a valid BPy_StructRNA
|
||||
* todo - also accept useful args */
|
||||
static PyObject * pyrna_prop_new(PyTypeObject *type, PyObject *args, PyObject *kwds) {
|
||||
static PyObject * pyrna_prop_new(PyTypeObject *type, PyObject *args, PyObject *UNUSED(kwds)) {
|
||||
|
||||
BPy_PropertyRNA *base;
|
||||
|
||||
@@ -3454,7 +3454,7 @@ static PyObject * pyrna_prop_new(PyTypeObject *type, PyObject *args, PyObject *k
|
||||
}
|
||||
}
|
||||
|
||||
PyObject *pyrna_param_to_py(PointerRNA *ptr, ParameterList *parms, PropertyRNA *prop, void *data)
|
||||
PyObject *pyrna_param_to_py(PointerRNA *ptr, PropertyRNA *prop, void *data)
|
||||
{
|
||||
PyObject *ret;
|
||||
int type = RNA_property_type(prop);
|
||||
@@ -3704,7 +3704,7 @@ static PyObject * pyrna_func_call(PyObject *self, PyObject *args, PyObject *kw)
|
||||
continue;
|
||||
}
|
||||
|
||||
err= pyrna_py_to_prop(&funcptr, parm, &parms, iter.data, item, "");
|
||||
err= pyrna_py_to_prop(&funcptr, parm, iter.data, item, "");
|
||||
|
||||
if(err!=0) {
|
||||
/* the error generated isnt that useful, so generate it again with a useful prefix
|
||||
@@ -3717,7 +3717,7 @@ static PyObject * pyrna_func_call(PyObject *self, PyObject *args, PyObject *kw)
|
||||
else
|
||||
snprintf(error_prefix, sizeof(error_prefix), "%s.%s(): error with argument %d, \"%s\" - ", RNA_struct_identifier(self_ptr->type), RNA_function_identifier(self_func), i, parm_id);
|
||||
|
||||
pyrna_py_to_prop(&funcptr, parm, &parms, iter.data, item, error_prefix);
|
||||
pyrna_py_to_prop(&funcptr, parm, iter.data, item, error_prefix);
|
||||
|
||||
break;
|
||||
}
|
||||
@@ -3822,13 +3822,13 @@ static PyObject * pyrna_func_call(PyObject *self, PyObject *args, PyObject *kw)
|
||||
flag= RNA_property_flag(parm);
|
||||
|
||||
if (flag & PROP_OUTPUT)
|
||||
PyTuple_SET_ITEM(ret, i++, pyrna_param_to_py(&funcptr, &parms, parm, iter.data));
|
||||
PyTuple_SET_ITEM(ret, i++, pyrna_param_to_py(&funcptr, parm, iter.data));
|
||||
}
|
||||
|
||||
RNA_parameter_list_end(&iter);
|
||||
}
|
||||
else
|
||||
ret= pyrna_param_to_py(&funcptr, &parms, pret_single, retdata_single);
|
||||
ret= pyrna_param_to_py(&funcptr, pret_single, retdata_single);
|
||||
|
||||
/* possible there is an error in conversion */
|
||||
if(ret==NULL)
|
||||
@@ -5012,7 +5012,7 @@ static int bpy_class_validate(PointerRNA *dummyptr, void *py_data, int *have_fun
|
||||
if(strcmp(identifier, rna_attr) == 0) { \
|
||||
item= PyObject_GetAttrString(py_class, py_attr); \
|
||||
if(item && item != Py_None) { \
|
||||
if(pyrna_py_to_prop(dummyptr, prop, NULL, NULL, item, "validating class error:") != 0) { \
|
||||
if(pyrna_py_to_prop(dummyptr, prop, NULL, item, "validating class error:") != 0) { \
|
||||
Py_DECREF(item); \
|
||||
return -1; \
|
||||
} \
|
||||
@@ -5036,7 +5036,7 @@ static int bpy_class_validate(PointerRNA *dummyptr, void *py_data, int *have_fun
|
||||
else {
|
||||
Py_DECREF(item); /* no need to keep a ref, the class owns it */
|
||||
|
||||
if(pyrna_py_to_prop(dummyptr, prop, NULL, NULL, item, "validating class error:") != 0)
|
||||
if(pyrna_py_to_prop(dummyptr, prop, NULL, item, "validating class error:") != 0)
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@@ -5156,7 +5156,7 @@ static int bpy_class_call(PointerRNA *ptr, FunctionRNA *func, ParameterList *par
|
||||
continue;
|
||||
}
|
||||
|
||||
parmitem= pyrna_param_to_py(&funcptr, parms, parm, iter.data);
|
||||
parmitem= pyrna_param_to_py(&funcptr, parm, iter.data);
|
||||
PyTuple_SET_ITEM(args, i, parmitem);
|
||||
i++;
|
||||
}
|
||||
@@ -5191,7 +5191,7 @@ static int bpy_class_call(PointerRNA *ptr, FunctionRNA *func, ParameterList *par
|
||||
err= -1;
|
||||
}
|
||||
else if(ret_len==1) {
|
||||
err= pyrna_py_to_prop(&funcptr, pret_single, parms, retdata_single, ret, "calling class function:");
|
||||
err= pyrna_py_to_prop(&funcptr, pret_single, retdata_single, ret, "calling class function:");
|
||||
}
|
||||
else if (ret_len > 1) {
|
||||
|
||||
@@ -5214,7 +5214,7 @@ static int bpy_class_call(PointerRNA *ptr, FunctionRNA *func, ParameterList *par
|
||||
|
||||
/* only useful for single argument returns, we'll need another list loop for multiple */
|
||||
if (flag & PROP_OUTPUT) {
|
||||
err= pyrna_py_to_prop(&funcptr, parm, parms, iter.data, PyTuple_GET_ITEM(ret, i++), "calling class function:");
|
||||
err= pyrna_py_to_prop(&funcptr, parm, iter.data, PyTuple_GET_ITEM(ret, i++), "calling class function:");
|
||||
if(err)
|
||||
break;
|
||||
}
|
||||
@@ -5328,7 +5328,7 @@ void pyrna_free_types(void)
|
||||
* - Should still be fixed - Campbell
|
||||
* */
|
||||
|
||||
static PyObject *pyrna_basetype_register(PyObject *self, PyObject *py_class)
|
||||
static PyObject *pyrna_basetype_register(PyObject *UNUSED(self), PyObject *py_class)
|
||||
{
|
||||
bContext *C= NULL;
|
||||
ReportList reports;
|
||||
@@ -5425,7 +5425,7 @@ static int pyrna_srna_contains_pointer_prop_srna(StructRNA *srna_props, StructRN
|
||||
return 0;
|
||||
}
|
||||
|
||||
static PyObject *pyrna_basetype_unregister(PyObject *self, PyObject *py_class)
|
||||
static PyObject *pyrna_basetype_unregister(PyObject *UNUSED(self), PyObject *py_class)
|
||||
{
|
||||
bContext *C= NULL;
|
||||
StructUnregisterFunc unreg;
|
||||
|
||||
@@ -99,7 +99,7 @@ void pyrna_alloc_types(void);
|
||||
void pyrna_free_types(void);
|
||||
|
||||
/* primitive type conversion */
|
||||
int pyrna_py_to_array(PointerRNA *ptr, PropertyRNA *prop, ParameterList *parms, char *param_data, PyObject *py, const char *error_prefix);
|
||||
int pyrna_py_to_array(PointerRNA *ptr, PropertyRNA *prop, char *param_data, PyObject *py, const char *error_prefix);
|
||||
int pyrna_py_to_array_index(PointerRNA *ptr, PropertyRNA *prop, int arraydim, int arrayoffset, int index, PyObject *py, const char *error_prefix);
|
||||
PyObject *pyrna_array_index(PointerRNA *ptr, PropertyRNA *prop, int index);
|
||||
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
#include "bpy_util.h"
|
||||
|
||||
#include "DNA_screen_types.h"
|
||||
#include "BKE_utildefines.h"
|
||||
#include "BKE_context.h"
|
||||
#include "ED_space_api.h"
|
||||
|
||||
@@ -34,7 +35,7 @@
|
||||
#define RNA_CAPSULE_ID "RNA_HANDLE"
|
||||
#define RNA_CAPSULE_ID_INVALID "RNA_HANDLE_REMOVED"
|
||||
|
||||
void cb_region_draw(const bContext *C, ARegion *ar, void *customdata)
|
||||
void cb_region_draw(const bContext *C, ARegion *UNUSED(ar), void *customdata)
|
||||
{
|
||||
PyObject *cb_func, *cb_args, *result;
|
||||
PyGILState_STATE gilstate;
|
||||
|
||||
Reference in New Issue
Block a user