diff options
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/makesrna/RNA_enum_types.h | 2 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_ui.c | 32 | ||||
-rw-r--r-- | source/blender/python/intern/bpy_operator.c | 14 | ||||
-rw-r--r-- | source/blender/python/intern/bpy_rna.c | 3 | ||||
-rw-r--r-- | source/blender/render/intern/source/pipeline.c | 1 |
5 files changed, 33 insertions, 19 deletions
diff --git a/source/blender/makesrna/RNA_enum_types.h b/source/blender/makesrna/RNA_enum_types.h index 3e07896d760..f0e669a3569 100644 --- a/source/blender/makesrna/RNA_enum_types.h +++ b/source/blender/makesrna/RNA_enum_types.h @@ -75,6 +75,8 @@ extern EnumPropertyItem space_type_items[]; extern EnumPropertyItem keymap_propvalue_items[]; +extern EnumPropertyItem operator_context_items[]; + extern EnumPropertyItem wm_report_items[]; extern EnumPropertyItem property_unit_items[]; diff --git a/source/blender/makesrna/intern/rna_ui.c b/source/blender/makesrna/intern/rna_ui.c index c5738b58614..c87e76ebe02 100644 --- a/source/blender/makesrna/intern/rna_ui.c +++ b/source/blender/makesrna/intern/rna_ui.c @@ -36,6 +36,22 @@ #include "WM_types.h" +/* see WM_types.h */ +EnumPropertyItem operator_context_items[] = { + {WM_OP_INVOKE_DEFAULT, "INVOKE_DEFAULT", 0, "Invoke Default", ""}, + {WM_OP_INVOKE_REGION_WIN, "INVOKE_REGION_WIN", 0, "Invoke Region Window", ""}, + {WM_OP_INVOKE_REGION_CHANNELS, "INVOKE_REGION_CHANNELS", 0, "Invoke Region Channels", ""}, + {WM_OP_INVOKE_REGION_PREVIEW, "INVOKE_REGION_PREVIEW", 0, "Invoke Region Preview", ""}, + {WM_OP_INVOKE_AREA, "INVOKE_AREA", 0, "Invoke Area", ""}, + {WM_OP_INVOKE_SCREEN, "INVOKE_SCREEN", 0, "Invoke Screen", ""}, + {WM_OP_EXEC_DEFAULT, "EXEC_DEFAULT", 0, "Exec Default", ""}, + {WM_OP_EXEC_REGION_WIN, "EXEC_REGION_WIN", 0, "Exec Region Window", ""}, + {WM_OP_EXEC_REGION_CHANNELS, "EXEC_REGION_CHANNELS", 0, "Exec Region Channels", ""}, + {WM_OP_EXEC_REGION_PREVIEW, "EXEC_REGION_PREVIEW", 0, "Exec Region Preview", ""}, + {WM_OP_EXEC_AREA, "EXEC_AREA", 0, "Exec Area", ""}, + {WM_OP_EXEC_SCREEN, "EXEC_SCREEN", 0, "Exec Screen", ""}, + {0, NULL, 0, NULL, NULL}}; + #ifdef RNA_RUNTIME #include "MEM_guardedalloc.h" @@ -517,22 +533,6 @@ static void rna_def_ui_layout(BlenderRNA *brna) {UI_LAYOUT_ALIGN_CENTER, "CENTER", 0, "Center", ""}, {UI_LAYOUT_ALIGN_RIGHT, "RIGHT", 0, "Right", ""}, {0, NULL, 0, NULL, NULL}}; - - /* see WM_types.h */ - static EnumPropertyItem operator_context_items[] = { - {WM_OP_INVOKE_DEFAULT, "INVOKE_DEFAULT", 0, "Invoke Default", ""}, - {WM_OP_INVOKE_REGION_WIN, "INVOKE_REGION_WIN", 0, "Invoke Region Window", ""}, - {WM_OP_INVOKE_REGION_CHANNELS, "INVOKE_REGION_CHANNELS", 0, "Invoke Region Channels", ""}, - {WM_OP_INVOKE_REGION_PREVIEW, "INVOKE_REGION_PREVIEW", 0, "Invoke Region Preview", ""}, - {WM_OP_INVOKE_AREA, "INVOKE_AREA", 0, "Invoke Area", ""}, - {WM_OP_INVOKE_SCREEN, "INVOKE_SCREEN", 0, "Invoke Screen", ""}, - {WM_OP_EXEC_DEFAULT, "EXEC_DEFAULT", 0, "Exec Default", ""}, - {WM_OP_EXEC_REGION_WIN, "EXEC_REGION_WIN", 0, "Exec Region Window", ""}, - {WM_OP_EXEC_REGION_CHANNELS, "EXEC_REGION_CHANNELS", 0, "Exec Region Channels", ""}, - {WM_OP_EXEC_REGION_PREVIEW, "EXEC_REGION_PREVIEW", 0, "Exec Region Preview", ""}, - {WM_OP_EXEC_AREA, "EXEC_AREA", 0, "Exec Area", ""}, - {WM_OP_EXEC_SCREEN, "EXEC_SCREEN", 0, "Exec Screen", ""}, - {0, NULL, 0, NULL, NULL}}; /* layout */ diff --git a/source/blender/python/intern/bpy_operator.c b/source/blender/python/intern/bpy_operator.c index bdd3255ccea..df6ed4fefbb 100644 --- a/source/blender/python/intern/bpy_operator.c +++ b/source/blender/python/intern/bpy_operator.c @@ -48,8 +48,9 @@ static PyObject *pyop_call( PyObject * self, PyObject * args) int error_val = 0; PointerRNA ptr; int operator_ret= OPERATOR_CANCELLED; - + char *opname; + char *context_str= NULL; PyObject *kw= NULL; /* optional args */ PyObject *context_dict= NULL; /* optional args */ PyObject *context_dict_back; @@ -60,7 +61,7 @@ static PyObject *pyop_call( PyObject * self, PyObject * args) // XXX Todo, work out a better solution for passing on context, could make a tuple from self and pack the name and Context into it... bContext *C = BPy_GetContext(); - if (!PyArg_ParseTuple(args, "sO|O!i:_bpy.ops.call", &opname, &context_dict, &PyDict_Type, &kw, &context)) + if (!PyArg_ParseTuple(args, "sO|O!s:_bpy.ops.call", &opname, &context_dict, &PyDict_Type, &kw, &context_str)) return NULL; ot= WM_operatortype_exists(opname); @@ -70,6 +71,15 @@ static PyObject *pyop_call( PyObject * self, PyObject * args) return NULL; } + if(context_str) { + if(RNA_enum_value_from_id(operator_context_items, context_str, &operator_ret)==0) { + char *enum_str= BPy_enum_as_string(operator_context_items); + PyErr_Format(PyExc_TypeError, "Calling operator \"bpy.ops.%s\" error, expected a string enum in (%.200s)", opname, enum_str); + MEM_freeN(enum_str); + return NULL; + } + } + if(!PyDict_Check(context_dict)) context_dict= NULL; diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c index 04d29d40ca6..bdd27680557 100644 --- a/source/blender/python/intern/bpy_rna.c +++ b/source/blender/python/intern/bpy_rna.c @@ -389,7 +389,7 @@ static char *pyrna_enum_as_string(PointerRNA *ptr, PropertyRNA *prop) RNA_property_enum_items(BPy_GetContext(), ptr, prop, &item, NULL, &free); if(item) { - result= (char*)BPy_enum_as_string(item); + result= BPy_enum_as_string(item); } else { result= ""; @@ -401,6 +401,7 @@ static char *pyrna_enum_as_string(PointerRNA *ptr, PropertyRNA *prop) return result; } + static int pyrna_string_to_enum(PyObject *item, PointerRNA *ptr, PropertyRNA *prop, int *val, const char *error_prefix) { char *param= _PyUnicode_AsString(item); diff --git a/source/blender/render/intern/source/pipeline.c b/source/blender/render/intern/source/pipeline.c index c5d4392a53c..bcc91018488 100644 --- a/source/blender/render/intern/source/pipeline.c +++ b/source/blender/render/intern/source/pipeline.c @@ -2369,6 +2369,7 @@ static void do_merge_fullsample(Render *re, bNodeTree *ntree) float *col= rres.rectf + 4*y*re->rectx; for(x=0; x<re->rectx; x++, rf+=4, col+=4) { + /* clamping to 1.0 is needed for correct AA */ if(col[0]<0.0f) col[0]=0.0f; else if(col[0] > 1.0f) col[0]= 1.0f; if(col[1]<0.0f) col[1]=0.0f; else if(col[1] > 1.0f) col[1]= 1.0f; if(col[2]<0.0f) col[2]=0.0f; else if(col[2] > 1.0f) col[2]= 1.0f; |