diff options
author | Martijn Versteegh <Baardaap> | 2022-05-20 10:36:30 +0300 |
---|---|---|
committer | Jacques Lucke <jacques@blender.org> | 2022-05-20 10:36:30 +0300 |
commit | 8e02b0d5d4f9882c87f1e95fc5b185c384b57fb0 (patch) | |
tree | 8c8471d1be97a146b2a81e527feb58b667175e8a /source/blender/blenkernel/intern | |
parent | af7502dd9b9538cdf6439daba7c7cec12d371e37 (diff) |
Cleanup: make functions for setting clone/stencil layer more consistent
This was missing in rBf1beb3b3f60be45854285935d6bfcedf839b317c.
Differential Revision: https://developer.blender.org/D14991
Diffstat (limited to 'source/blender/blenkernel/intern')
-rw-r--r-- | source/blender/blenkernel/intern/customdata.cc | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/source/blender/blenkernel/intern/customdata.cc b/source/blender/blenkernel/intern/customdata.cc index 623c3bb698c..ed11e5359ca 100644 --- a/source/blender/blenkernel/intern/customdata.cc +++ b/source/blender/blenkernel/intern/customdata.cc @@ -2599,18 +2599,24 @@ void CustomData_set_layer_render_index(CustomData *data, int type, int n) void CustomData_set_layer_clone_index(CustomData *data, int type, int n) { + const int layer_index = data->typemap[type]; + BLI_assert(customdata_typemap_is_valid(data)); + for (int i = 0; i < data->totlayer; i++) { if (data->layers[i].type == type) { - data->layers[i].active_clone = n - i; + data->layers[i].active_clone = n - layer_index; } } } void CustomData_set_layer_stencil_index(CustomData *data, int type, int n) { + const int layer_index = data->typemap[type]; + BLI_assert(customdata_typemap_is_valid(data)); + for (int i = 0; i < data->totlayer; i++) { if (data->layers[i].type == type) { - data->layers[i].active_mask = n - i; + data->layers[i].active_mask = n - layer_index; } } } |