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 ...
This commit is contained in:
2013-01-04 03:47:37 +00:00
parent a50794e4f9
commit 9dbe85c17e
5 changed files with 29 additions and 0 deletions

View File

@@ -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,

View File

@@ -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 */