Merged changes in the trunk up to revision 55546.

Conflicts resolved:
source/blenderplayer/bad_level_call_stubs/SConscript

Partly reverted changes to intern/cycles/blender/addon/ui.py in revision 52899
to make it easier to merge trunk changes.
This commit is contained in:
2013-03-24 12:13:13 +00:00
379 changed files with 6689 additions and 5533 deletions

View File

@@ -27,8 +27,6 @@
* to access C defined builtin functions.
* A script writer should never directly access this module.
*/
#define WITH_PYTHON /* for AUD_PyInit.h, possibly others */
#include <Python.h>

View File

@@ -107,9 +107,10 @@ static PyObject *make_app_info(void)
if (app_info == NULL) {
return NULL;
}
#if 0
#define SetIntItem(flag) \
PyStructSequence_SET_ITEM(app_info, pos++, PyLong_FromLong(flag))
#endif
#define SetStrItem(str) \
PyStructSequence_SET_ITEM(app_info, pos++, PyUnicode_FromString(str))
#define SetBytesItem(str) \

View File

@@ -74,7 +74,7 @@ typedef struct GHashKey {
static GHashKey *_ghashutil_keyalloc(const void *msgctxt, const void *msgid)
{
GHashKey *key = MEM_mallocN(sizeof(GHashKey), "Py i18n GHashKey");
key->msgctxt = BLI_strdup(msgctxt ? msgctxt : BLF_I18NCONTEXT_DEFAULT_BPY);
key->msgctxt = BLI_strdup(BLF_is_default_context(msgctxt) ? BLF_I18NCONTEXT_DEFAULT_BPYRNA : msgctxt);
key->msgid = BLI_strdup(msgid);
return key;
}
@@ -195,7 +195,7 @@ static void _build_translations_cache(PyObject *py_messages, const char *locale)
else {
PyObject *tmp = PyTuple_GET_ITEM(pykey, 0);
if (tmp == Py_None) {
msgctxt = BLF_I18NCONTEXT_DEFAULT_BPY;
msgctxt = BLF_I18NCONTEXT_DEFAULT_BPYRNA;
}
else if (PyUnicode_Check(tmp)) {
msgctxt = _PyUnicode_AsString(tmp);
@@ -433,7 +433,7 @@ static PyObject *app_translations_contexts_make(void)
PyDoc_STRVAR(app_translations_contexts_doc,
"A named tuple containing all pre-defined translation contexts.\n"
"WARNING: Never use a (new) context starting with \"" BLF_I18NCONTEXT_DEFAULT_BPY "\", it would be internally "
"WARNING: Never use a (new) context starting with \"" BLF_I18NCONTEXT_DEFAULT_BPYRNA "\", it would be internally "
"assimilated as the default one!\n"
);
@@ -441,7 +441,7 @@ PyDoc_STRVAR(app_translations_contexts_C_to_py_doc,
"A readonly dict mapping contexts' C-identifiers to their py-identifiers."
);
PyMemberDef app_translations_members[] = {
static PyMemberDef app_translations_members[] = {
{(char *)"contexts", T_OBJECT_EX, offsetof(BlenderAppTranslations, contexts), READONLY,
app_translations_contexts_doc},
{(char *)"contexts_C_to_py", T_OBJECT_EX, offsetof(BlenderAppTranslations, contexts_C_to_py), READONLY,
@@ -486,7 +486,7 @@ static PyObject *app_translations_locales_get(PyObject *UNUSED(self), void *UNUS
return ret;
}
PyGetSetDef app_translations_getseters[] = {
static PyGetSetDef app_translations_getseters[] = {
/* {name, getter, setter, doc, userdata} */
{(char *)"locale", (getter)app_translations_locale_get, NULL, app_translations_locale_doc, NULL},
{(char *)"locales", (getter)app_translations_locales_get, NULL, app_translations_locales_doc, NULL},
@@ -570,7 +570,7 @@ static PyObject *app_translations_pgettext_iface(BlenderAppTranslations *UNUSED(
}
PyDoc_STRVAR(app_translations_pgettext_tip_doc,
".. method:: pgettext(msgid, msgctxt)\n"
".. method:: pgettext_tip(msgid, msgctxt)\n"
"\n"
" Try to translate the given msgid (with optional msgctxt), if tooltips' translation is enabled.\n"
" NOTE: See pgettext notes.\n"
@@ -588,6 +588,25 @@ static PyObject *app_translations_pgettext_tip(BlenderAppTranslations *UNUSED(se
return _py_pgettext(args, kw, BLF_translate_do_tooltip);
}
PyDoc_STRVAR(app_translations_pgettext_data_doc,
".. method:: pgettext_data(msgid, msgctxt)\n"
"\n"
" Try to translate the given msgid (with optional msgctxt), if new data name's translation is enabled.\n"
" NOTE: See pgettext notes.\n"
"\n"
" :arg msgid: The string to translate.\n"
" :type msgid: string\n"
" :arg msgctxt: The translation context.\n"
" :type msgctxt: string or None\n"
" :default msgctxt: BLF_I18NCONTEXT_DEFAULT value.\n"
" :return: The translated string (or msgid if no translation was found).\n"
"\n"
);
static PyObject *app_translations_pgettext_data(BlenderAppTranslations *UNUSED(self), PyObject *args, PyObject *kw)
{
return _py_pgettext(args, kw, BLF_translate_do_new_dataname);
}
PyDoc_STRVAR(app_translations_locale_explode_doc,
".. method:: locale_explode(locale)\n"
"\n"
@@ -618,20 +637,22 @@ static PyObject *app_translations_locale_explode(BlenderAppTranslations *UNUSED(
return Py_BuildValue("sssss", language, country, variant, language_country, language_variant);
}
PyMethodDef app_translations_methods[] = {
static PyMethodDef app_translations_methods[] = {
/* Can't use METH_KEYWORDS alone, see http://bugs.python.org/issue11587 */
{(char *)"register", (PyCFunction)app_translations_py_messages_register, METH_VARARGS | METH_KEYWORDS,
app_translations_py_messages_register_doc},
{(char *)"unregister", (PyCFunction)app_translations_py_messages_unregister, METH_VARARGS | METH_KEYWORDS,
app_translations_py_messages_unregister_doc},
{(char *)"pgettext", (PyCFunction)app_translations_pgettext, METH_VARARGS | METH_KEYWORDS | METH_STATIC,
app_translations_pgettext_doc},
{(char *)"pgettext_iface", (PyCFunction)app_translations_pgettext_iface, METH_VARARGS | METH_KEYWORDS | METH_STATIC,
app_translations_pgettext_iface_doc},
{(char *)"pgettext_tip", (PyCFunction)app_translations_pgettext_tip, METH_VARARGS | METH_KEYWORDS | METH_STATIC,
app_translations_pgettext_tip_doc},
{(char *)"locale_explode", (PyCFunction)app_translations_locale_explode, METH_VARARGS | METH_KEYWORDS | METH_STATIC,
app_translations_locale_explode_doc},
{"register", (PyCFunction)app_translations_py_messages_register, METH_VARARGS | METH_KEYWORDS,
app_translations_py_messages_register_doc},
{"unregister", (PyCFunction)app_translations_py_messages_unregister, METH_VARARGS | METH_KEYWORDS,
app_translations_py_messages_unregister_doc},
{"pgettext", (PyCFunction)app_translations_pgettext, METH_VARARGS | METH_KEYWORDS | METH_STATIC,
app_translations_pgettext_doc},
{"pgettext_iface", (PyCFunction)app_translations_pgettext_iface, METH_VARARGS | METH_KEYWORDS | METH_STATIC,
app_translations_pgettext_iface_doc},
{"pgettext_tip", (PyCFunction)app_translations_pgettext_tip, METH_VARARGS | METH_KEYWORDS | METH_STATIC,
app_translations_pgettext_tip_doc},
{"pgettext_data", (PyCFunction)app_translations_pgettext_data, METH_VARARGS | METH_KEYWORDS | METH_STATIC,
app_translations_pgettext_data_doc},
{"locale_explode", (PyCFunction)app_translations_locale_explode, METH_VARARGS | METH_KEYWORDS | METH_STATIC,
app_translations_locale_explode_doc},
{NULL}
};
@@ -697,7 +718,7 @@ PyDoc_STRVAR(app_translations_doc,
static PyTypeObject BlenderAppTranslationsType = {
PyVarObject_HEAD_INIT(NULL, 0)
/* tp_name */
(char *)"bpy.app._translations_type",
"bpy.app._translations_type",
/* tp_basicsize */
sizeof(BlenderAppTranslations),
0, /* tp_itemsize */

View File

@@ -31,11 +31,11 @@
#include <Python.h>
#include "BLI_utildefines.h"
#include "WM_api.h"
#include "WM_types.h"
#include "BLI_utildefines.h"
#include "RNA_access.h"
#include "RNA_define.h"
@@ -45,7 +45,7 @@
static void operator_properties_init(wmOperatorType *ot)
{
PyObject *py_class = ot->ext.data;
PyTypeObject *py_class = ot->ext.data;
RNA_struct_blender_type_set(ot->ext.srna, ot);
/* only call this so pyrna_deferred_register_class gives a useful error
@@ -62,7 +62,6 @@ static void operator_properties_init(wmOperatorType *ot)
{
/* picky developers will notice that 'bl_property' won't work with inheritance
* get direct from the dict to avoid raising a load of attribute errors (yes this isnt ideal) - campbell */
PyTypeObject *py_class = ot->ext.data;
PyObject *py_class_dict = py_class->tp_dict;
PyObject *bl_property = PyDict_GetItem(py_class_dict, bpy_intern_str_bl_property);
const char *prop_id;

View File

@@ -4339,7 +4339,7 @@ static int foreach_parse_args(BPy_PropertyRNA *self, PyObject *args,
if (!PySequence_Check(*seq) && PyObject_CheckBuffer(*seq)) {
PyErr_Format(PyExc_TypeError,
"foreach_get/set expected second argument to be a sequence or buffer, not a %.200s",
Py_TYPE(seq)->tp_name);
Py_TYPE(*seq)->tp_name);
return -1;
}
@@ -6823,14 +6823,14 @@ static int pyrna_deferred_register_class_recursive(StructRNA *srna, PyTypeObject
return pyrna_deferred_register_props(srna, py_class->tp_dict); /* getattr(..., "__dict__") returns a proxy */
}
int pyrna_deferred_register_class(StructRNA *srna, PyObject *py_class)
int pyrna_deferred_register_class(StructRNA *srna, PyTypeObject *py_class)
{
/* Panels and Menus don't need this
* save some time and skip the checks here */
if (!RNA_struct_idprops_register_check(srna))
return 0;
return pyrna_deferred_register_class_recursive(srna, (PyTypeObject *)py_class);
return pyrna_deferred_register_class_recursive(srna, py_class);
}
/*-------------------- Type Registration ------------------------*/
@@ -7524,7 +7524,7 @@ static PyObject *pyrna_register_class(PyObject *UNUSED(self), PyObject *py_class
*
* item = PyObject_GetAttrString(py_class, "__dict__");
*/
if (pyrna_deferred_register_class(srna_new, py_class) != 0)
if (pyrna_deferred_register_class(srna_new, (PyTypeObject *)py_class) != 0)
return NULL;
/* call classed register method () */

View File

@@ -189,7 +189,7 @@ int pyrna_set_to_enum_bitfield(EnumPropertyItem *items, PyObject *value, int *r_
int pyrna_enum_value_from_id(EnumPropertyItem *item, const char *identifier, int *value, const char *error_prefix);
int pyrna_deferred_register_class(struct StructRNA *srna, PyObject *py_class);
int pyrna_deferred_register_class(struct StructRNA *srna, PyTypeObject *py_class);
/* called before stopping python */
void pyrna_alloc_types(void);

View File

@@ -131,6 +131,7 @@ static PyObject *PyInit_gpu(void)
PyDict_SetItemString(d, # f, val); \
Py_DECREF(val)
#if 0 /* UNUSED */
#define PY_OBJ_ADD_ID(d, s, f) \
val = PyUnicode_FromString(&s->f->id.name[2]); \
PyObject_SetAttrString(d, # f, val); \
@@ -145,6 +146,7 @@ static PyObject *PyInit_gpu(void)
val = PyUnicode_FromString(s->f); \
PyObject_SetAttrString(d, # f, val); \
Py_DECREF(val)
#endif
PyDoc_STRVAR(GPU_export_shader_doc,
"export_shader(scene, material)\n"