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/makesdna | |
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/makesdna')
-rw-r--r-- | source/blender/makesdna/DNA_ID.h | 1 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_object_types.h | 6 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_scene_types.h | 6 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_text_types.h | 2 |
4 files changed, 8 insertions, 7 deletions
diff --git a/source/blender/makesdna/DNA_ID.h b/source/blender/makesdna/DNA_ID.h index 48da28b6bbe..dde1daee5c9 100644 --- a/source/blender/makesdna/DNA_ID.h +++ b/source/blender/makesdna/DNA_ID.h @@ -143,6 +143,7 @@ typedef struct ID { int us; int icon_id; IDProperty *properties; + void *py_instance; } ID; /** diff --git a/source/blender/makesdna/DNA_object_types.h b/source/blender/makesdna/DNA_object_types.h index 5c3c3ac7a0b..c25afb0ec6a 100644 --- a/source/blender/makesdna/DNA_object_types.h +++ b/source/blender/makesdna/DNA_object_types.h @@ -299,15 +299,15 @@ typedef struct Object { struct FluidsimSettings *fluidsimSettings; /* if fluidsim enabled, store additional settings */ - /* Runtime valuated curve-specific data, not stored in the file */ - struct CurveCache *curve_cache; - struct DerivedMesh *derivedDeform, *derivedFinal; uint64_t lastDataMask; /* the custom data layer mask that was last used to calculate derivedDeform and derivedFinal */ uint64_t customdata_mask; /* (extra) custom data layer mask to use for creating derivedmesh, set by depsgraph */ unsigned int state; /* bit masks of game controllers that are active */ unsigned int init_state; /* bit masks of initial state as recorded by the users */ + /* Runtime valuated curve-specific data, not stored in the file */ + struct CurveCache *curve_cache; + ListBase gpulamp; /* runtime, for glsl lamp display only */ ListBase pc_ids; ListBase *duplilist; /* for temporary dupli list storage, only for use by RNA API */ diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h index a3b0b8ac2c7..da08aa4685c 100644 --- a/source/blender/makesdna/DNA_scene_types.h +++ b/source/blender/makesdna/DNA_scene_types.h @@ -1720,12 +1720,12 @@ typedef struct Scene { /* Physics simulation settings */ struct PhysicsSettings physics_settings; - /* Movie Tracking */ - struct MovieClip *clip; /* active movie clip */ - uint64_t customdata_mask; /* XXX. runtime flag for drawing, actually belongs in the window, only used by BKE_object_handle_update() */ uint64_t customdata_mask_modal; /* XXX. same as above but for temp operator use (gl renders) */ + /* Movie Tracking */ + struct MovieClip *clip; /* active movie clip */ + /* Color Management */ ColorManagedViewSettings view_settings; ColorManagedDisplaySettings display_settings; diff --git a/source/blender/makesdna/DNA_text_types.h b/source/blender/makesdna/DNA_text_types.h index 8d1bba6ca4f..c7969cd30e7 100644 --- a/source/blender/makesdna/DNA_text_types.h +++ b/source/blender/makesdna/DNA_text_types.h @@ -61,8 +61,8 @@ typedef struct Text { char *undo_buf; int undo_pos, undo_len; - void *compiled; double mtime; + void *compiled; } Text; #define TXT_TABSIZE 4 |