diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-01-10 16:07:01 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-01-10 16:07:01 +0400 |
commit | c3c3df3aecf885946b52d5eff72c4134a1c9478e (patch) | |
tree | a78ff65446fea248c14940b2e8aaf158104b07e6 /source/blender/blenkernel/intern/customdata.c | |
parent | bed36187802eaa1acc59516b338eb3ec2b8038bb (diff) |
editmesh texface drawing, reuse customdata offset rather then looking up each UV and vertex color, gives overall ~9.5% drawing speedup in my tests.
was also doing NULL checks on UV's which are never NULL in this case.
Diffstat (limited to 'source/blender/blenkernel/intern/customdata.c')
-rw-r--r-- | source/blender/blenkernel/intern/customdata.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/customdata.c b/source/blender/blenkernel/intern/customdata.c index 82c0535254b..aca16861a75 100644 --- a/source/blender/blenkernel/intern/customdata.c +++ b/source/blender/blenkernel/intern/customdata.c @@ -2104,6 +2104,24 @@ int CustomData_get_offset(const CustomData *data, int type) return data->layers[layer_index].offset; } +int CustomData_get_n_offset(const CustomData *data, int type, int n) +{ + /* get the layer index of the active layer of type */ + int layer_index = CustomData_get_layer_index_n(data, type, n); + if (layer_index < 0) return -1; + + return data->layers[layer_index].offset; +} + +int CustomData_get_active_offset(const CustomData *data, int type) +{ + /* get the layer index of the active layer of type */ + int layer_index = CustomData_get_active_layer_index(data, type); + if (layer_index < 0) return -1; + + return data->layers[layer_index].offset; +} + int CustomData_set_layer_name(const CustomData *data, int type, int n, const char *name) { /* get the layer index of the first layer of type */ |