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/python/intern')
-rw-r--r--source/blender/python/intern/CMakeLists.txt1
-rw-r--r--source/blender/python/intern/bpy_interface.c15
-rw-r--r--source/blender/python/intern/bpy_props.c2
-rw-r--r--source/blender/python/intern/bpy_rna.c36
4 files changed, 30 insertions, 24 deletions
diff --git a/source/blender/python/intern/CMakeLists.txt b/source/blender/python/intern/CMakeLists.txt
index 76fe439027f..4b397ee1870 100644
--- a/source/blender/python/intern/CMakeLists.txt
+++ b/source/blender/python/intern/CMakeLists.txt
@@ -36,6 +36,7 @@ set(INC
../../gpu
../../freestyle/intern/python
../../../../intern/guardedalloc
+ ../../../../intern/cycles/blender
)
set(INC_SYS
diff --git a/source/blender/python/intern/bpy_interface.c b/source/blender/python/intern/bpy_interface.c
index 7d91438e4f7..6c961d8e6a8 100644
--- a/source/blender/python/intern/bpy_interface.c
+++ b/source/blender/python/intern/bpy_interface.c
@@ -57,12 +57,13 @@
#include "BLI_string_utf8.h"
#include "BLI_utildefines.h"
-
#include "BKE_context.h"
#include "BKE_text.h"
#include "BKE_main.h"
#include "BKE_global.h" /* only for script checking */
+#include "CCL_api.h"
+
#include "BPY_extern.h"
#include "../generic/bpy_internal_import.h" // our own imports
@@ -176,8 +177,14 @@ void BPY_context_set(bContext *C)
/* defined in AUD_C-API.cpp */
extern PyObject *AUD_initPython(void);
-/* defined in cycles/blender */
-extern PyObject *CYCLES_initPython(void);
+
+#ifdef WITH_CYCLES
+/* defined in cycles module */
+static PyObject *CCL_initPython(void)
+{
+ return (PyObject*)CCL_python_module_init();
+}
+#endif
static struct _inittab bpy_internal_modules[] = {
{(char *)"mathutils", PyInit_mathutils},
@@ -189,7 +196,7 @@ static struct _inittab bpy_internal_modules[] = {
{(char *)"aud", AUD_initPython},
#endif
#ifdef WITH_CYCLES
- {(char *)"_cycles", CYCLES_initPython},
+ {(char *)"_cycles", CCL_initPython},
#endif
{(char *)"gpu", GPU_initPython},
{NULL, NULL}
diff --git a/source/blender/python/intern/bpy_props.c b/source/blender/python/intern/bpy_props.c
index 81eb81e90fa..d94ba8b9441 100644
--- a/source/blender/python/intern/bpy_props.c
+++ b/source/blender/python/intern/bpy_props.c
@@ -1423,7 +1423,7 @@ static PyObject *BPy_RemoveProperty(PyObject *self, PyObject *args, PyObject *kw
return ret;
}
else if (PyTuple_GET_SIZE(args) > 1) {
- PyErr_SetString(PyExc_ValueError, "all args must be keywords"); \
+ PyErr_SetString(PyExc_ValueError, "all args must be keywords");
return NULL;
}
diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c
index 9dfbe64e905..4940c53551e 100644
--- a/source/blender/python/intern/bpy_rna.c
+++ b/source/blender/python/intern/bpy_rna.c
@@ -743,14 +743,28 @@ int pyrna_enum_value_from_id(EnumPropertyItem *item, const char *identifier, int
return 0;
}
+/* note on __cmp__:
+ * checking the 'ptr->data' matches works in almost all cases,
+ * however there are a few RNA properties that are fake sub-structs and
+ * share the pointer with the parent, in those cases this happens 'a.b == a'
+ * see: r43352 for example.
+ *
+ * So compare the 'ptr->type' as well to avoid this problem.
+ * It's highly unlikely this would happen that 'ptr->data' and 'ptr->prop' would match,
+ * but _not_ 'ptr->type' but include this check for completeness.
+ * - campbell */
+
static int pyrna_struct_compare(BPy_StructRNA *a, BPy_StructRNA *b)
{
- return (a->ptr.data == b->ptr.data) ? 0 : -1;
+ return ( (a->ptr.data == b->ptr.data) &&
+ (a->ptr.type == b->ptr.type)) ? 0 : -1;
}
static int pyrna_prop_compare(BPy_PropertyRNA *a, BPy_PropertyRNA *b)
{
- return (a->prop == b->prop && a->ptr.data == b->ptr.data) ? 0 : -1;
+ return ( (a->prop == b->prop) &&
+ (a->ptr.data == b->ptr.data) &&
+ (a->ptr.type == b->ptr.type) ) ? 0 : -1;
}
static PyObject *pyrna_struct_richcmp(PyObject *a, PyObject *b, int op)
@@ -3055,7 +3069,6 @@ static PyObject *pyrna_struct_is_property_set(BPy_StructRNA *self, PyObject *arg
{
PropertyRNA *prop;
const char *name;
- int ret;
PYRNA_STRUCT_CHECK_OBJ(self);
@@ -3069,22 +3082,7 @@ static PyObject *pyrna_struct_is_property_set(BPy_StructRNA *self, PyObject *arg
return NULL;
}
- /* double property lookup, could speed up */
- /* return PyBool_FromLong(RNA_property_is_set(&self->ptr, name)); */
- if (RNA_property_flag(prop) & PROP_IDPROPERTY) {
- IDProperty *group = RNA_struct_idprops(&self->ptr, 0);
- if (group) {
- ret = IDP_GetPropertyFromGroup(group, name) ? 1:0;
- }
- else {
- ret = 0;
- }
- }
- else {
- ret = 1;
- }
-
- return PyBool_FromLong(ret);
+ return PyBool_FromLong(RNA_property_is_set(&self->ptr, prop));
}
PyDoc_STRVAR(pyrna_struct_is_property_hidden_doc,