diff options
author | Campbell Barton <ideasman42@gmail.com> | 2017-07-26 16:49:20 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2017-07-26 16:49:20 +0300 |
commit | 3ed5c9a610b348841f1e48736f02d73976f034d4 (patch) | |
tree | 55bb80e49d06a872e273461be50c132cec2ca43a /source/blender/makesrna/intern/rna_internal.h | |
parent | 40a45e393e7651604f97202d21b6bfd5079253b8 (diff) |
PyAPI: Store PyInstances for ID's
This means once an ID is created,
it will keep using the same PyObject instance.
This has some advantages:
- Avoids unnecessary re-creation of instances on UI poll / redraw.
- Accessing free'd ID's gives an exception instead of crashing.
(long standing annoyance!, though this only applies to ID's
and not yet other data that uses the ID's - vertices for eg).
- Allows using instance comparison (a little faster).
Note that the instances won't be kept between undo.
Diffstat (limited to 'source/blender/makesrna/intern/rna_internal.h')
-rw-r--r-- | source/blender/makesrna/intern/rna_internal.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/source/blender/makesrna/intern/rna_internal.h b/source/blender/makesrna/intern/rna_internal.h index 577c2853201..00b1b53ad71 100644 --- a/source/blender/makesrna/intern/rna_internal.h +++ b/source/blender/makesrna/intern/rna_internal.h @@ -221,6 +221,7 @@ void rna_ID_name_set(struct PointerRNA *ptr, const char *value); struct StructRNA *rna_ID_refine(struct PointerRNA *ptr); struct IDProperty *rna_ID_idprops(struct PointerRNA *ptr, bool create); void rna_ID_fake_user_set(struct PointerRNA *ptr, int value); +void **rna_ID_instance(PointerRNA *ptr); struct IDProperty *rna_PropertyGroup_idprops(struct PointerRNA *ptr, bool create); void rna_PropertyGroup_unregister(struct Main *bmain, struct StructRNA *type); struct StructRNA *rna_PropertyGroup_register(struct Main *bmain, struct ReportList *reports, void *data, |