Merge branch 'blender-v2.81-release'
This commit is contained in:
@@ -35,20 +35,20 @@ import re
|
|||||||
# regular expressions to find out which completer we need
|
# regular expressions to find out which completer we need
|
||||||
|
|
||||||
# line which starts with an import statement
|
# line which starts with an import statement
|
||||||
RE_MODULE = re.compile('^import(\s|$)|from.+')
|
RE_MODULE = re.compile(r'''^import(\s|$)|from.+''')
|
||||||
|
|
||||||
# The following regular expression means an 'unquoted' word
|
# The following regular expression means an 'unquoted' word
|
||||||
RE_UNQUOTED_WORD = re.compile(
|
RE_UNQUOTED_WORD = re.compile(
|
||||||
# don't start with a quote
|
# don't start with a quote
|
||||||
'''(?:^|[^"'a-zA-Z0-9_])'''
|
r'''(?:^|[^"'a-zA-Z0-9_])'''
|
||||||
# start with a \w = [a-zA-Z0-9_]
|
# start with a \w = [a-zA-Z0-9_]
|
||||||
'''((?:\w+'''
|
r'''((?:\w+'''
|
||||||
# allow also dots and closed bracket pairs []
|
# allow also dots and closed bracket pairs []
|
||||||
'''(?:\w|[.]|\[.+?\])*'''
|
r'''(?:\w|[.]|\[.+?\])*'''
|
||||||
# allow empty string
|
# allow empty string
|
||||||
'''|)'''
|
r'''|)'''
|
||||||
# allow an unfinished index at the end (including quotes)
|
# allow an unfinished index at the end (including quotes)
|
||||||
'''(?:\[[^\]]*$)?)$''',
|
r'''(?:\[[^\]]*$)?)$''',
|
||||||
# allow unicode as theoretically this is possible
|
# allow unicode as theoretically this is possible
|
||||||
re.UNICODE)
|
re.UNICODE)
|
||||||
|
|
||||||
|
|||||||
@@ -37,9 +37,11 @@
|
|||||||
|
|
||||||
#include "python_utildefines.h"
|
#include "python_utildefines.h"
|
||||||
|
|
||||||
#include "BLI_string.h"
|
|
||||||
|
|
||||||
#ifndef MATH_STANDALONE
|
#ifndef MATH_STANDALONE
|
||||||
|
# include "MEM_guardedalloc.h"
|
||||||
|
|
||||||
|
# include "BLI_string.h"
|
||||||
|
|
||||||
/* Only for BLI_strncpy_wchar_from_utf8,
|
/* Only for BLI_strncpy_wchar_from_utf8,
|
||||||
* should replace with py funcs but too late in release now. */
|
* should replace with py funcs but too late in release now. */
|
||||||
# include "BLI_string_utf8.h"
|
# include "BLI_string_utf8.h"
|
||||||
@@ -1044,23 +1046,15 @@ void *PyC_RNA_AsPointer(PyObject *value, const char *type_name)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* PyC_FlagSet_* functions - so flags/sets can be interchanged in a generic way */
|
PyObject *PyC_FlagSet_AsString(PyC_FlagSet *item)
|
||||||
# include "BLI_dynstr.h"
|
|
||||||
# include "MEM_guardedalloc.h"
|
|
||||||
|
|
||||||
char *PyC_FlagSet_AsString(PyC_FlagSet *item)
|
|
||||||
{
|
{
|
||||||
DynStr *dynstr = BLI_dynstr_new();
|
PyObject *py_items = PyList_New(0);
|
||||||
PyC_FlagSet *e;
|
for (; item->identifier; item++) {
|
||||||
char *cstring;
|
PyList_APPEND(py_items, PyUnicode_FromString(item->identifier));
|
||||||
|
|
||||||
for (e = item; item->identifier; item++) {
|
|
||||||
BLI_dynstr_appendf(dynstr, (e == item) ? "'%s'" : ", '%s'", item->identifier);
|
|
||||||
}
|
}
|
||||||
|
PyObject *py_string = PyObject_Repr(py_items);
|
||||||
cstring = BLI_dynstr_get_cstring(dynstr);
|
Py_DECREF(py_items);
|
||||||
BLI_dynstr_free(dynstr);
|
return py_string;
|
||||||
return cstring;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int PyC_FlagSet_ValueFromID_int(PyC_FlagSet *item, const char *identifier, int *r_value)
|
int PyC_FlagSet_ValueFromID_int(PyC_FlagSet *item, const char *identifier, int *r_value)
|
||||||
@@ -1081,10 +1075,10 @@ int PyC_FlagSet_ValueFromID(PyC_FlagSet *item,
|
|||||||
const char *error_prefix)
|
const char *error_prefix)
|
||||||
{
|
{
|
||||||
if (PyC_FlagSet_ValueFromID_int(item, identifier, r_value) == 0) {
|
if (PyC_FlagSet_ValueFromID_int(item, identifier, r_value) == 0) {
|
||||||
const char *enum_str = PyC_FlagSet_AsString(item);
|
PyObject *enum_str = PyC_FlagSet_AsString(item);
|
||||||
PyErr_Format(
|
PyErr_Format(
|
||||||
PyExc_ValueError, "%s: '%.200s' not found in (%s)", error_prefix, identifier, enum_str);
|
PyExc_ValueError, "%s: '%.200s' not found in (%U)", error_prefix, identifier, enum_str);
|
||||||
MEM_freeN((void *)enum_str);
|
Py_DECREF(enum_str);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -99,7 +99,7 @@ typedef struct PyC_FlagSet {
|
|||||||
const char *identifier;
|
const char *identifier;
|
||||||
} PyC_FlagSet;
|
} PyC_FlagSet;
|
||||||
|
|
||||||
char *PyC_FlagSet_AsString(PyC_FlagSet *item);
|
PyObject *PyC_FlagSet_AsString(PyC_FlagSet *item);
|
||||||
int PyC_FlagSet_ValueFromID_int(PyC_FlagSet *item, const char *identifier, int *r_value);
|
int PyC_FlagSet_ValueFromID_int(PyC_FlagSet *item, const char *identifier, int *r_value);
|
||||||
int PyC_FlagSet_ValueFromID(PyC_FlagSet *item,
|
int PyC_FlagSet_ValueFromID(PyC_FlagSet *item,
|
||||||
const char *identifier,
|
const char *identifier,
|
||||||
|
|||||||
Reference in New Issue
Block a user