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/blenloader | |
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/blenloader')
-rw-r--r-- | source/blender/blenloader/intern/readfile.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 7f92cc9e8bb..6349269440e 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -2221,6 +2221,7 @@ static void direct_link_id(FileData *fd, ID *id) /* this case means the data was written incorrectly, it should not happen */ IDP_DirectLinkGroup_OrFree(&id->properties, (fd->flags & FD_FLAGS_SWITCH_ENDIAN), fd); } + id->py_instance = NULL; } /* ************ READ CurveMapping *************** */ |