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>2013-01-04 07:47:37 +0400
committerCampbell Barton <ideasman42@gmail.com>2013-01-04 07:47:37 +0400
commit9dbe85c17ea0e3a9279780e51a9caea69ea056ed (patch)
tree2616faf930c04d57d1259798cf0bf081ae914e40 /source/blender/python/generic
parenta50794e4f93cb2756fce5c585ad46327cfe27f46 (diff)
expose common extensions for image/movie/audio types, since python scripts had to do this internally.
- bpy.path.extensions_image - bpy.path.extensions_movie - bpy.path.extensions_audio eg: if os.path.splitext(filename)[1].lower() in bpy.path.extensions_image: ... we have an image ...
Diffstat (limited to 'source/blender/python/generic')
-rw-r--r--source/blender/python/generic/py_capi_utils.c17
-rw-r--r--source/blender/python/generic/py_capi_utils.h1
2 files changed, 18 insertions, 0 deletions
diff --git a/source/blender/python/generic/py_capi_utils.c b/source/blender/python/generic/py_capi_utils.c
index f62fdaf09db..9a064923736 100644
--- a/source/blender/python/generic/py_capi_utils.c
+++ b/source/blender/python/generic/py_capi_utils.c
@@ -241,6 +241,23 @@ PyObject *PyC_Object_GetAttrStringArgs(PyObject *o, Py_ssize_t n, ...)
return item;
}
+PyObject *PyC_FrozenSetFromStrings(const char **strings)
+{
+ const char **str;
+ PyObject *ret;
+
+ ret = PyFrozenSet_New(NULL);
+
+ for (str = strings; *str; str++) {
+ PyObject *py_str = PyUnicode_FromString(*str);
+ PySet_Add(ret, py_str);
+ Py_DECREF(py_str);
+ }
+
+ return ret;
+}
+
+
/* similar to PyErr_Format(),
*
* implementation - we cant actually preprend the existing exception,
diff --git a/source/blender/python/generic/py_capi_utils.h b/source/blender/python/generic/py_capi_utils.h
index 45c9247d710..db582bd7086 100644
--- a/source/blender/python/generic/py_capi_utils.h
+++ b/source/blender/python/generic/py_capi_utils.h
@@ -33,6 +33,7 @@ void PyC_LineSpit(void);
void PyC_StackSpit(void);
PyObject * PyC_ExceptionBuffer(void);
PyObject * PyC_Object_GetAttrStringArgs(PyObject *o, Py_ssize_t n, ...);
+PyObject * PyC_FrozenSetFromStrings(const char **strings);
PyObject * PyC_Err_Format_Prefix(PyObject *exception_type_prefix, const char *format, ...);
void PyC_FileAndNum(const char **filename, int *lineno);
void PyC_FileAndNum_Safe(const char **filename, int *lineno); /* checks python is running */