diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2019-03-18 17:56:16 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2019-03-18 19:11:43 +0300 |
commit | 8fb0b9aebbd409216dec77c4b1bf2a2fbba80698 (patch) | |
tree | 5de8ac995f5eac6d5c7c299ea5c4228aacac33fd /source/blender/blenkernel/BKE_modifier.h | |
parent | 91ffd39e77498b81634750527aa5069c950a4d59 (diff) |
Subdiv: Enable topology cache in edit mode
The general idea of this change is to have a runtime data pointer
in the ModifierData, so it can be preserved through copy-on-write
updates by the dependency graph.
This is where subdivision surface modifier can store its topology
cache, so it is not getting trashed on every copy-on-write which
is happening when moving a vertex.
Similar mechanism should be used by multiresolution, dynamic paint
and some other modifiers which cache evaluated data.
This fixes T61746.
Thing to keep in mind, that there are more reports about slow
subdivision surface in the tracker, but that boils down to the
fact that those have a lot of extraordinary vertices, and hence
a lot slower to evaluated topology.
Other thing is, this speeds up oeprations which doesn't change
topology (i.e. moving vertices).
Reviewers: brecht
Reviewed By: brecht
Maniphest Tasks: T61746
Differential Revision: https://developer.blender.org/D4541
Diffstat (limited to 'source/blender/blenkernel/BKE_modifier.h')
-rw-r--r-- | source/blender/blenkernel/BKE_modifier.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/source/blender/blenkernel/BKE_modifier.h b/source/blender/blenkernel/BKE_modifier.h index 1a1e510b9e1..22782b675f5 100644 --- a/source/blender/blenkernel/BKE_modifier.h +++ b/source/blender/blenkernel/BKE_modifier.h @@ -233,6 +233,8 @@ typedef struct ModifierTypeInfo { /* Free internal modifier data variables, this function should * not free the md variable itself. * + * This function is responsible for freeing the runtime data as well. + * * This function is optional. */ void (*freeData)(struct ModifierData *md); @@ -301,6 +303,18 @@ typedef struct ModifierTypeInfo { */ void (*foreachTexLink)(struct ModifierData *md, struct Object *ob, TexWalkFunc walk, void *userData); + + /* Free given runtime data. + * + * This data is coming from a modifier of the corresponding type, but actual + * modifier data is not known here. + * + * Notes: + * - The data itself is to be de-allocated as well. + * - This calback is allowed to receive NULL pointer as a data, so it's + * more like "ensure the data is freed". + */ + void (*freeRuntimeData)(void *runtime_data); } ModifierTypeInfo; /* Initialize modifier's global data (type info and some common global storages). */ |