diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2011-05-18 15:21:10 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2011-05-18 15:21:10 +0400 |
commit | 66f51ba5d1b15620b90e79c961756c53c0e6526a (patch) | |
tree | 05caa4ce60ea0fc614cece0dd9548a38de6dc124 /source/blender/python | |
parent | 178ba76b09fc923213a26257bbd5b82d0ad26bf0 (diff) |
RNA: make mechanism used by operators to keep python instance alive more generic, to be used by render engine later.
Diffstat (limited to 'source/blender/python')
-rw-r--r-- | source/blender/python/intern/bpy_rna.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c index 917015b905b..4f62c545a71 100644 --- a/source/blender/python/intern/bpy_rna.c +++ b/source/blender/python/intern/bpy_rna.c @@ -6040,17 +6040,18 @@ static int bpy_class_call(bContext *C, PointerRNA *ptr, FunctionRNA *func, Param bpy_context_set(C, &gilstate); if (!is_static) { - /* exception, operators store their PyObjects for re-use */ + /* some datatypes (operator, render engine) can store PyObjects for re-use */ if(ptr->data) { - if(RNA_struct_is_a(ptr->type, &RNA_Operator)) { - wmOperator *op= ptr->data; - if(op->py_instance) { - py_class_instance= op->py_instance; + void **instance = RNA_struct_instance(ptr); + + if(instance) { + if(*instance) { + py_class_instance= *instance; Py_INCREF(py_class_instance); } else { /* store the instance here once its created */ - py_class_instance_store= &op->py_instance; + py_class_instance_store= instance; } } } |