diff options
author | Campbell Barton <ideasman42@gmail.com> | 2010-06-09 23:31:10 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2010-06-09 23:31:10 +0400 |
commit | dd72ffe3ff6871960f644d6c4b16c1661c7b4e03 (patch) | |
tree | 27479b421912003d2aab0558a53a408e4cf527ba /source/blender/python | |
parent | 6b21085ed5d8bcd827859345105d7b37e1049d4b (diff) |
py/rna api:
- bpy.context wasnt being created from the python bpy.types.Context type defined in bpy_types.py (bpy.context.copy() failed for eg.)
- bpy.context.copy() was returning C defined methods like FloatProperty(), which are not useful in this case, removed.
Diffstat (limited to 'source/blender/python')
-rw-r--r-- | source/blender/python/intern/bpy.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/source/blender/python/intern/bpy.c b/source/blender/python/intern/bpy.c index 0d532a61ce7..4e1a0abc517 100644 --- a/source/blender/python/intern/bpy.c +++ b/source/blender/python/intern/bpy.c @@ -141,6 +141,7 @@ static void bpy_import_test(char *modname) void BPy_init_modules( void ) { extern BPy_StructRNA *bpy_context_module; + PointerRNA ctx_ptr; PyObject *mod; /* Needs to be first since this dir is needed for future modules */ @@ -181,9 +182,12 @@ void BPy_init_modules( void ) PyModule_AddObject( mod, "app", BPY_app_struct() ); /* bpy context */ - bpy_context_module= ( BPy_StructRNA * ) PyObject_NEW( BPy_StructRNA, &pyrna_struct_Type ); - RNA_pointer_create(NULL, &RNA_Context, BPy_GetContext(), &bpy_context_module->ptr); - bpy_context_module->freeptr= 0; + RNA_pointer_create(NULL, &RNA_Context, BPy_GetContext(), &ctx_ptr); + bpy_context_module= (BPy_StructRNA *)pyrna_struct_CreatePyObject(&ctx_ptr); + /* odd that this is needed, 1 ref on creation and another for the module + * but without we get a crash on exit */ + Py_INCREF(bpy_context_module); + PyModule_AddObject(mod, "context", (PyObject *)bpy_context_module); /* utility func's that have nowhere else to go */ |