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:
authorCampbell Barton <ideasman42@gmail.com>2010-11-23 15:05:35 +0300
committerCampbell Barton <ideasman42@gmail.com>2010-11-23 15:05:35 +0300
commitee1d2adc1685b4aea3a02155379bc02b9298acc9 (patch)
tree53205d0a4b643b706b353290ff804fe043bded22 /source/blender
parent855b83caece3bf95443852ce5e73a8e759273a7d (diff)
partial fix for [#23532]
- Python calling operators didn't run WM_operator_properties_sanitize() so enum functions called from python were given a NULL context. - PROP_ENUM_NO_CONTEXT and PROP_NEVER_NULL used the same value in the enum (possible conflict).
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/makesrna/RNA_types.h2
-rw-r--r--source/blender/python/intern/bpy_operator.c2
-rw-r--r--source/blender/windowmanager/WM_api.h2
-rw-r--r--source/blender/windowmanager/intern/wm_operators.c6
4 files changed, 7 insertions, 5 deletions
diff --git a/source/blender/makesrna/RNA_types.h b/source/blender/makesrna/RNA_types.h
index 5caae56010f..3fafae00ca6 100644
--- a/source/blender/makesrna/RNA_types.h
+++ b/source/blender/makesrna/RNA_types.h
@@ -192,7 +192,7 @@ typedef enum PropertyFlag {
PROP_RAW_ARRAY = 1<<14,
PROP_FREE_POINTERS = 1<<15,
PROP_DYNAMIC = 1<<17, /* for dynamic arrays, and retvals of type string */
- PROP_ENUM_NO_CONTEXT = 1<<18 /* for enum that shouldn't be contextual */
+ PROP_ENUM_NO_CONTEXT = 1<<24 /* for enum that shouldn't be contextual */
} PropertyFlag;
typedef struct CollectionPropertyIterator {
diff --git a/source/blender/python/intern/bpy_operator.c b/source/blender/python/intern/bpy_operator.c
index e78e79fd6a8..c471f354fd4 100644
--- a/source/blender/python/intern/bpy_operator.c
+++ b/source/blender/python/intern/bpy_operator.c
@@ -156,6 +156,7 @@ static PyObject *pyop_call(PyObject *UNUSED(self), PyObject *args)
}
else {
WM_operator_properties_create_ptr(&ptr, ot);
+ WM_operator_properties_sanitize(&ptr, 0);
if(kw && PyDict_Size(kw))
error_val= pyrna_pydict_to_props(&ptr, kw, 0, "Converting py args to operator properties: ");
@@ -306,6 +307,7 @@ static PyObject *pyop_getrna(PyObject *UNUSED(self), PyObject *value)
/* XXX - should call WM_operator_properties_free */
WM_operator_properties_create_ptr(&ptr, ot);
+ WM_operator_properties_sanitize(&ptr, 0);
pyrna= (BPy_StructRNA *)pyrna_struct_CreatePyObject(&ptr);
diff --git a/source/blender/windowmanager/WM_api.h b/source/blender/windowmanager/WM_api.h
index 4ddeeb35c2b..405db630932 100644
--- a/source/blender/windowmanager/WM_api.h
+++ b/source/blender/windowmanager/WM_api.h
@@ -225,7 +225,7 @@ int WM_operator_name_call (struct bContext *C, const char *opstring, int conte
int WM_operator_call_py(struct bContext *C, struct wmOperatorType *ot, int context, struct PointerRNA *properties, struct ReportList *reports);
void WM_operator_properties_alloc(struct PointerRNA **ptr, struct IDProperty **properties, const char *opstring); /* used for keymap and macro items */
-void WM_operator_properties_sanitize(struct PointerRNA *ptr, int val); /* make props context sensitive or not */
+void WM_operator_properties_sanitize(struct PointerRNA *ptr, const short no_context); /* make props context sensitive or not */
void WM_operator_properties_create(struct PointerRNA *ptr, const char *opstring);
void WM_operator_properties_create_ptr(struct PointerRNA *ptr, struct wmOperatorType *ot);
void WM_operator_properties_free(struct PointerRNA *ptr);
diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c
index 0578be94983..c83d3277610 100644
--- a/source/blender/windowmanager/intern/wm_operators.c
+++ b/source/blender/windowmanager/intern/wm_operators.c
@@ -585,12 +585,12 @@ void WM_operator_properties_alloc(PointerRNA **ptr, IDProperty **properties, con
}
-void WM_operator_properties_sanitize(PointerRNA *ptr, int val)
+void WM_operator_properties_sanitize(PointerRNA *ptr, const short no_context)
{
RNA_STRUCT_BEGIN(ptr, prop) {
switch(RNA_property_type(prop)) {
case PROP_ENUM:
- if (val)
+ if (no_context)
RNA_def_property_flag(prop, PROP_ENUM_NO_CONTEXT);
else
RNA_def_property_clear_flag(prop, PROP_ENUM_NO_CONTEXT);
@@ -602,7 +602,7 @@ void WM_operator_properties_sanitize(PointerRNA *ptr, int val)
/* recurse into operator properties */
if (RNA_struct_is_a(ptype, &RNA_OperatorProperties)) {
PointerRNA opptr = RNA_property_pointer_get(ptr, prop);
- WM_operator_properties_sanitize(&opptr, val);
+ WM_operator_properties_sanitize(&opptr, no_context);
}
break;
}