diff options
author | Ben Batt <benbatt@gmail.com> | 2006-12-05 20:42:03 +0300 |
---|---|---|
committer | Ben Batt <benbatt@gmail.com> | 2006-12-05 20:42:03 +0300 |
commit | 4f8079d49cc0cc037ef429123ee6faf031b5c333 (patch) | |
tree | 027e9ed89fd694d45827b4a46431976ab59fa755 /source/blender/blenkernel/BKE_customdata.h | |
parent | 869eeadeff956f88f48a3b26ea69d0c2938233a3 (diff) |
Modifier Stack: Limit calculation to required data.
This commit upgrades the modifier stack to only calculate the data which is
needed, either by modifiers further down the stack or by other functions at
the end of the stack (e.g. drawing functions).
This speeds up modifier stack recalculation, especially where vertex
groups and UV coordinates are concerned. For example, a mesh with an Armature
modifier followed by a Subsurf modifier would previously have required the
Subsurf modifier to interpolate all the vertex groups in the mesh, slowing
down modifier calculations considerably. With this update, vertex group data
is not propagated beyond the Armature modifier, so calculations are faster.
Note that this depends on the order of modifiers in the stack. If the Armature
and Subsurf modifiers were swapped in the above example, the Subsurf modifier
would have to interpolate vertex groups, as they are needed by the Armature
modifier.
Diffstat (limited to 'source/blender/blenkernel/BKE_customdata.h')
-rw-r--r-- | source/blender/blenkernel/BKE_customdata.h | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/source/blender/blenkernel/BKE_customdata.h b/source/blender/blenkernel/BKE_customdata.h index ce32f06e320..d48340998e0 100644 --- a/source/blender/blenkernel/BKE_customdata.h +++ b/source/blender/blenkernel/BKE_customdata.h @@ -36,9 +36,10 @@ struct CustomData; struct CustomDataLayer; typedef int CustomDataMask; -extern CustomDataMask CD_MASK_MESH[]; -extern CustomDataMask CD_MASK_EDITMESH[]; -extern CustomDataMask CD_MASK_DERIVEDMESH[]; +extern const CustomDataMask CD_MASK_BAREMESH; +extern const CustomDataMask CD_MASK_MESH; +extern const CustomDataMask CD_MASK_EDITMESH; +extern const CustomDataMask CD_MASK_DERIVEDMESH; /* for ORIGINDEX layer type, indicates no original index for this element */ #define ORIGINDEX_NONE -1 @@ -54,15 +55,15 @@ extern CustomDataMask CD_MASK_DERIVEDMESH[]; #define CD_REFERENCE 3 /* reference original pointers, set layer flag NOFREE */ /* initialises a CustomData object with the same layer setup as source. - * mask must be an array of length CD_NUMTYPES elements, that indicates + * mask is a bitfield where (mask & (1 << (layer type))) indicates * if a layer should be copied or not. alloctype must be one of the above. */ void CustomData_copy(const struct CustomData *source, struct CustomData *dest, - CustomDataMask *mask, int alloctype, int totelem); + CustomDataMask mask, int alloctype, int totelem); /* same as the above, except that will preserve existing layers, and only add * the layers that were not there yet */ void CustomData_merge(const struct CustomData *source, struct CustomData *dest, - CustomDataMask *mask, int alloctype, int totelem); + CustomDataMask mask, int alloctype, int totelem); /* frees data associated with a CustomData object (doesn't free the object * itself, though) @@ -105,6 +106,13 @@ int CustomData_has_layer(const struct CustomData *data, int type); * returns the layer data */ void *CustomData_duplicate_referenced_layer(struct CustomData *data, int type); +/* set the CD_FLAG_NOCOPY flag in custom data layers where the mask is + * zero for the layer type, so only layer types specified by the mask + * will be copied + */ +void CustomData_set_only_copy(const struct CustomData *data, + CustomDataMask mask); + /* copies data from one CustomData object to another * objects need not be compatible, each source layer is copied to the * first dest layer of correct type (if there is none, the layer is skipped) @@ -191,4 +199,7 @@ void CustomData_from_em_block(const struct CustomData *source, void CustomData_file_write_info(int type, char **structname, int *structnum); int CustomData_sizeof(int type); +/* get the name of a layer type */ +const char *CustomData_layertype_name(int type); + #endif |