Merged changes in the trunk up to revision 40520.

This commit is contained in:
2011-09-24 21:39:11 +00:00
192 changed files with 5106 additions and 5052 deletions

View File

@@ -18,9 +18,6 @@ defs = []
if is_debug:
defs.append('_DEBUG')
if env['WITH_BF_INTERNATIONAL']:
defs.append('INTERNATIONAL')
sources = env.Glob('generic/*.c')
env.BlenderLib( libname = 'bf_python_ext', sources = Split(sources), includes = Split(incs), defines = defs, libtype = ['core','player'], priority = [363,165]) # ketsji is 360
@@ -44,5 +41,8 @@ if env['WITH_BF_PYTHON_SAFETY']:
if env['BF_BUILDINFO']:
defs.append('BUILD_DATE')
if env['WITH_BF_INTERNATIONAL']:
defs.append('INTERNATIONAL')
sources = env.Glob('intern/*.c')
env.BlenderLib( libname = 'bf_python', sources = Split(sources), includes = Split(incs), defines = defs, libtype = ['core'], priority = [361])

View File

@@ -48,8 +48,4 @@ set(SRC
py_capi_utils.h
)
if(WITH_INTERNATIONAL)
add_definitions(-DINTERNATIONAL)
endif()
blender_add_lib(bf_python_ext "${SRC}" "${INC}" "${INC_SYS}")

View File

@@ -31,15 +31,9 @@
#include "blf_py_api.h"
#include "../../blenfont/BLF_api.h"
#include "../../blenfont/BLF_translation.h"
#include "BLI_utildefines.h"
#ifdef INTERNATIONAL
#include "DNA_userdef_types.h" /* is it bad level? */
#endif
PyDoc_STRVAR(py_blf_position_doc,
".. function:: position(fontid, x, y, z)\n"
"\n"
@@ -371,33 +365,24 @@ static PyObject *py_blf_load(PyObject *UNUSED(self), PyObject *args)
return PyLong_FromLong(BLF_load(filename));
}
PyDoc_STRVAR(py_blf_gettext_doc,
".. function:: gettext(msgid)\n"
PyDoc_STRVAR(py_blf_unload_doc,
".. function:: unload(filename)\n"
"\n"
" Get a msg in local language.\n"
" Unload an existing font.\n"
"\n"
" :arg msgid: the source string.\n"
" :type msgid: string\n"
" :return: the localized string.\n"
" :rtype: string\n"
" :arg filename: the filename of the font.\n"
" :type filename: string\n"
);
static PyObject *py_blf_gettext(PyObject *UNUSED(self), PyObject *value)
static PyObject *py_blf_unload(PyObject *UNUSED(self), PyObject *args)
{
#ifdef INTERNATIONAL
if ((U.transopts & USER_DOTRANSLATE) && (U.transopts & USER_TR_IFACE)) {
const char *msgid= _PyUnicode_AsString(value);
if(msgid == NULL) {
PyErr_SetString(PyExc_TypeError, "blf.gettext expects a single string argument");
return NULL;
}
char* filename;
return PyUnicode_FromString(BLF_gettext(msgid));
}
else
#endif /* INTERNATIONAL */
{
return Py_INCREF(value), value;
}
if (!PyArg_ParseTuple(args, "s:blf.unload", &filename))
return NULL;
BLF_unload(filename);
Py_RETURN_NONE;
}
/*----------------------------MODULE INIT-------------------------*/
@@ -415,7 +400,7 @@ static PyMethodDef BLF_methods[] = {
{"shadow_offset", (PyCFunction) py_blf_shadow_offset, METH_VARARGS, py_blf_shadow_offset_doc},
{"size", (PyCFunction) py_blf_size, METH_VARARGS, py_blf_size_doc},
{"load", (PyCFunction) py_blf_load, METH_VARARGS, py_blf_load_doc},
{"gettext", (PyCFunction) py_blf_gettext, METH_O, py_blf_gettext_doc},
{"unload", (PyCFunction) py_blf_unload, METH_VARARGS, py_blf_unload_doc},
{NULL, NULL, 0, NULL}
};

View File

@@ -96,4 +96,8 @@ if(WITH_AUDASPACE)
add_definitions(-DWITH_AUDASPACE)
endif()
if(WITH_INTERNATIONAL)
add_definitions(-DINTERNATIONAL)
endif()
blender_add_lib(bf_python "${SRC}" "${INC}" "${INC_SYS}")

View File

@@ -72,6 +72,7 @@ static EnumPropertyItem property_subtype_string_items[]= {
{PROP_FILEPATH, "FILE_PATH", 0, "File Path", ""},
{PROP_DIRPATH, "DIR_PATH", 0, "Directory Path", ""},
{PROP_FILENAME, "FILENAME", 0, "Filename", ""},
{PROP_TRANSLATE, "TRANSLATE", 0, "Translate", ""},
{PROP_NONE, "NONE", 0, "None", ""},
{0, NULL, 0, NULL, NULL}};

View File

@@ -73,6 +73,10 @@
#include "../generic/IDProp.h" /* for IDprop lookups */
#include "../generic/py_capi_utils.h"
#ifdef INTERNATIONAL
#include "UI_interface.h" /* bad level call into editors */
#endif
#define USE_PEDANTIC_WRITE
#define USE_MATHUTILS
#define USE_STRING_COERCE
@@ -1519,6 +1523,12 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyOb
}
else {
param= _PyUnicode_AsString(value);
#ifdef INTERNATIONAL
if(subtype == PROP_TRANSLATE) {
param= UI_translate_do_iface(param);
}
#endif // INTERNATIONAL
}
#else // USE_STRING_COERCE
param= _PyUnicode_AsString(value);