Merged changes in the trunk up to revision 50829.

Conflicts resolved:
source/blender/blenloader/intern/readfile.c
source/blender/render/intern/source/convertblender.c
source/blender/render/intern/source/pipeline.c

Also addressed code inconsistency due to changes in the trunk revision 50628 (color
management with OCIO) and 50806 (UV project material).  OCIO-related changes are marked
OCIO_TODO as in some other files modified in revision 50628.
This commit is contained in:
Tamito Kajiyama
2012-09-23 18:50:56 +00:00
1024 changed files with 399537 additions and 14461 deletions

View File

@@ -72,6 +72,7 @@ set(SRC
bpy_app_handlers.h
bpy_driver.h
bpy_intern_string.h
bpy_library.h
bpy_operator.h
bpy_operator_wrap.h
bpy_props.h

View File

@@ -37,6 +37,7 @@
#include "bpy_rna.h"
#include "bpy_app.h"
#include "bpy_props.h"
#include "bpy_library.h"
#include "bpy_operator.h"
#include "BLI_path_util.h"
@@ -240,7 +241,6 @@ static PyObject *bpy_import_test(const char *modname)
void BPy_init_modules(void)
{
extern BPy_StructRNA *bpy_context_module;
extern int bpy_lib_init(PyObject *);
PointerRNA ctx_ptr;
PyObject *mod;
@@ -276,7 +276,7 @@ void BPy_init_modules(void)
PyModule_AddObject(mod, "StructMetaPropGroup", (PyObject *)&pyrna_struct_meta_idprop_Type);
/* needs to be first so bpy_types can run */
bpy_lib_init(mod);
BPY_library_module(mod);
bpy_import_test("bpy_types");
PyModule_AddObject(mod, "data", BPY_rna_module()); /* imports bpy_types by running this */

View File

@@ -23,10 +23,13 @@
* \ingroup pythonintern
*/
#ifndef __BPY_H__
void BPy_init_modules(void);
extern PyObject *bpy_package_py;
/* bpy_interface_atexit.c */
void BPY_atexit_register(void);
void BPY_atexit_unregister(void);
#endif /* __BPY_H__ */

View File

@@ -26,11 +26,8 @@
#include <Python.h>
#include "BLI_utildefines.h"
#include "BLI_callbacks.h"
#include "RNA_types.h"
#include "RNA_access.h"
#include "bpy_rna.h"
#include "bpy_app_ffmpeg.h"
#ifdef WITH_FFMPEG
#include <libavcodec/avcodec.h>
@@ -80,8 +77,10 @@ static PyObject *make_ffmpeg_info(void)
return NULL;
}
#if 0 // UNUSED
#define SetIntItem(flag) \
PyStructSequence_SET_ITEM(ffmpeg_info, pos++, PyLong_FromLong(flag))
#endif
#define SetStrItem(str) \
PyStructSequence_SET_ITEM(ffmpeg_info, pos++, PyUnicode_FromString(str))
#define SetObjItem(obj) \
@@ -121,7 +120,7 @@ static PyObject *make_ffmpeg_info(void)
return NULL;
}
#undef SetIntItem
// #undef SetIntItem
#undef SetStrItem
#undef SetObjItem

View File

@@ -37,6 +37,8 @@
#include "bpy_rna.h"
#include "bpy_app_handlers.h"
#include "BPY_extern.h"
void bpy_app_generic_callback(struct Main *main, struct ID *id, void *arg);
static PyTypeObject BlenderAppCbType;

View File

@@ -53,6 +53,7 @@
#include "BLI_path_util.h"
#include "BLI_fileops.h"
#include "BLI_listbase.h"
#include "BLI_math_base.h"
#include "BLI_string.h"
#include "BLI_string_utf8.h"
@@ -383,6 +384,7 @@ typedef struct {
static int python_script_exec(bContext *C, const char *fn, struct Text *text,
struct ReportList *reports, const short do_jump)
{
Main *bmain_old = CTX_data_main(C);
PyObject *main_mod = NULL;
PyObject *py_dict = NULL, *py_result = NULL;
PyGILState_STATE gilstate;
@@ -461,7 +463,11 @@ static int python_script_exec(bContext *C, const char *fn, struct Text *text,
if (!py_result) {
if (text) {
if (do_jump) {
python_script_error_jump_text(text);
/* ensure text is valid before use, the script may have freed its self */
Main *bmain_new = CTX_data_main(C);
if ((bmain_old == bmain_new) && (BLI_findindex(&bmain_new->text, text) != -1)) {
python_script_error_jump_text(text);
}
}
}
BPy_errors_to_report(reports);
@@ -680,11 +686,20 @@ void BPY_modules_load_user(bContext *C)
int BPY_context_member_get(bContext *C, const char *member, bContextDataResult *result)
{
PyObject *pyctx = (PyObject *)CTX_py_dict_get(C);
PyObject *item = PyDict_GetItemString(pyctx, member);
PyGILState_STATE gilstate;
int use_gil = !PYC_INTERPRETER_ACTIVE;
PyObject *pyctx;
PyObject *item;
PointerRNA *ptr = NULL;
int done = FALSE;
if (use_gil)
gilstate = PyGILState_Ensure();
pyctx = (PyObject *)CTX_py_dict_get(C);
item = PyDict_GetItemString(pyctx, member);
if (item == NULL) {
/* pass */
}
@@ -720,7 +735,8 @@ int BPY_context_member_get(bContext *C, const char *member, bContextDataResult *
CTX_data_list_add(result, ptr->id.data, ptr->type, ptr->data);
}
else {
printf("List item not a valid type\n");
printf("PyContext: '%s' list item not a valid type in sequece type '%s'\n",
member, Py_TYPE(item)->tp_name);
}
}
@@ -740,6 +756,9 @@ int BPY_context_member_get(bContext *C, const char *member, bContextDataResult *
}
}
if (use_gil)
PyGILState_Release(gilstate);
return done;
}

View File

@@ -32,6 +32,7 @@
#include <Python.h>
#include "bpy_util.h"
#include "bpy.h" /* own include */
#include "WM_api.h"

View File

@@ -55,6 +55,7 @@
#include "DNA_space_types.h" /* FILE_LINK, FILE_RELPATH */
#include "bpy_util.h"
#include "bpy_library.h"
#ifdef USE_RNA_DATABLOCKS
# include "bpy_rna.h"
@@ -426,7 +427,7 @@ static PyObject *bpy_lib_dir(BPy_Library *self)
}
int bpy_lib_init(PyObject *mod_par)
int BPY_library_module(PyObject *mod_par)
{
static PyMethodDef load_meth = {"load", (PyCFunction)bpy_lib_load,
METH_STATIC | METH_VARARGS | METH_KEYWORDS,

View File

@@ -0,0 +1,32 @@
/*
* ***** BEGIN GPL LICENSE BLOCK *****
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* Contributor(s): Campbell Barton
*
* ***** END GPL LICENSE BLOCK *****
*/
/** \file blender/python/intern/bpy_library.h
* \ingroup pythonintern
*/
#ifndef __BPY_LIBRARY_H__
#define __BPY_LIBRARY_H__
int BPY_library_module(PyObject *);
#endif /* __BPY_LIBRARY_H__ */

View File

@@ -37,6 +37,8 @@
#include "RNA_types.h"
#include "BPY_extern.h"
#include "bpy_rna.h"
#include "bpy_rna_anim.h"
#include "bpy_props.h"
@@ -45,7 +47,7 @@
#include "bpy_intern_string.h"
#ifdef USE_PYRNA_INVALIDATE_WEAKREF
#include "MEM_guardedalloc.h"
# include "MEM_guardedalloc.h"
#endif
#include "BLI_dynstr.h"
@@ -55,7 +57,7 @@
#include "BLI_utildefines.h"
#ifdef USE_PYRNA_INVALIDATE_WEAKREF
#include "BLI_ghash.h"
# include "BLI_ghash.h"
#endif
#include "RNA_enum_types.h"
@@ -78,7 +80,7 @@
#include "../generic/py_capi_utils.h"
#ifdef WITH_INTERNATIONAL
#include "BLF_translation.h"
# include "BLF_translation.h"
#endif
#define USE_PEDANTIC_WRITE
@@ -2150,10 +2152,10 @@ static PyObject *pyrna_prop_collection_subscript_str(BPy_PropertyRNA *self, cons
* -1: exception set
* 0: not found
* 1: found */
int pyrna_prop_collection_subscript_str_lib_pair_ptr(BPy_PropertyRNA *self, PyObject *key,
const char *err_prefix, const short err_not_found,
PointerRNA *r_ptr
)
static int pyrna_prop_collection_subscript_str_lib_pair_ptr(BPy_PropertyRNA *self, PyObject *key,
const char *err_prefix, const short err_not_found,
PointerRNA *r_ptr
)
{
char *keyname;
@@ -5908,7 +5910,7 @@ PyTypeObject pyrna_prop_collection_iter_Type = {
NULL
};
PyObject *pyrna_prop_collection_iter_CreatePyObject(PointerRNA *ptr, PropertyRNA *prop)
static PyObject *pyrna_prop_collection_iter_CreatePyObject(PointerRNA *ptr, PropertyRNA *prop)
{
BPy_PropertyCollectionIterRNA *self = PyObject_New(BPy_PropertyCollectionIterRNA, &pyrna_prop_collection_iter_Type);

View File

@@ -175,6 +175,10 @@ PyObject *BPY_rna_types(void);
PyObject *pyrna_struct_CreatePyObject(PointerRNA *ptr);
PyObject *pyrna_prop_CreatePyObject(PointerRNA *ptr, PropertyRNA *prop);
/* extern'd by other modules which don't deal closely with RNA */
PyObject *pyrna_id_CreatePyObject(struct ID *id);
int pyrna_id_FromPyObject(PyObject *obj, struct ID **id);
/* operators also need this to set args */
int pyrna_pydict_to_props(PointerRNA *ptr, PyObject *kw, int all_args, const char *error_prefix);
PyObject *pyrna_prop_to_py(PointerRNA *ptr, PropertyRNA *prop);

View File

@@ -52,9 +52,6 @@
#include "bpy_util.h"
#include "bpy_rna_anim.h"
#define TRUE 1
#define FALSE 0
/* for keyframes and drivers */
static int pyrna_struct_anim_args_parse(
PointerRNA *ptr, const char *error_prefix, const char *path,

View File

@@ -74,8 +74,7 @@ static struct PyModuleDef gpumodule = {
NULL, NULL, NULL, NULL, NULL
};
PyMODINIT_FUNC
PyInit_gpu(void)
static PyObject *PyInit_gpu(void)
{
PyObject *m;

View File

@@ -28,12 +28,15 @@
* \ingroup pythonintern
*/
#include "BLI_utildefines.h"
#include "BPY_extern.h"
/* python, will come back */
//void BPY_script_exec(void) {}
//void BPY_python_start(void) {}
//void BPY_text_free_code(void) {}
void BPY_pyconstraint_exec(void) {}
void BPY_pyconstraint_target(void) {}
int BPY_is_pyconstraint(void) { return 0;}
void BPY_pyconstraint_update(void) {}
void BPY_pyconstraint_exec(struct bPythonConstraint *UNUSED(con), struct bConstraintOb *UNUSED(cob), struct ListBase *UNUSED(targets)) {}
void BPY_pyconstraint_target(struct bPythonConstraint *UNUSED(con), struct bConstraintTarget *UNUSED(ct)) {}
int BPY_is_pyconstraint(struct Text *UNUSED(text)) { return 0;}
void BPY_pyconstraint_update(struct Object *UNUSED(owner), struct bConstraint *UNUSED(con)) {}