[Bf-blender-cvs] [5edc7151f19] refactor-mesh-uv-map-generic: Merge branch 'master' into refactor-mesh-uv-map-generic
Baardaap
noreply at git.blender.org
Thu Dec 15 17:19:51 CET 2022
Commit: 5edc7151f19ebdf5813d5b5827f7cc9bebae641e
Author: Baardaap
Date: Thu Dec 15 15:08:05 2022 +0100
Branches: refactor-mesh-uv-map-generic
https://developer.blender.org/rB5edc7151f19ebdf5813d5b5827f7cc9bebae641e
Merge branch 'master' into refactor-mesh-uv-map-generic
===================================================================
===================================================================
diff --cc source/blender/blenkernel/intern/customdata.cc
index dd9aaf99d32,c8d7c4f2fdc..cb87bd2e95d
--- a/source/blender/blenkernel/intern/customdata.cc
+++ b/source/blender/blenkernel/intern/customdata.cc
@@@ -4418,7 -4492,7 +4418,7 @@@ static bool CustomData_layer_ensure_dat
switch (layer->type) {
/* When more instances of corrupt files are found, add them here. */
case CD_PROP_BOOL: /* See T84935. */
-- case CD_MLOOPUV: /* See T90620. */
++ case CD_MLOOPUV: /* See T90620. */ /*TODO(@Baardaap) check if this is run before or after versioning. If after we need to add CD_PROP_FLOAT2 to the list? */
layer->data = MEM_calloc_arrayN(count, typeInfo->size, layerType_getName(layer->type));
BLI_assert(layer->data);
if (typeInfo->set_default_value) {
diff --cc source/blender/draw/intern/draw_pbvh.cc
index cce7e106662,bc9c449544c..e5f8cce942a
--- a/source/blender/draw/intern/draw_pbvh.cc
+++ b/source/blender/draw/intern/draw_pbvh.cc
@@@ -66,6 -66,22 +66,22 @@@ using blender::Vector
using string = std::string;
+ static bool valid_pbvh_attr(int type)
+ {
+ switch (type) {
+ case CD_PBVH_CO_TYPE:
+ case CD_PBVH_NO_TYPE:
+ case CD_PBVH_FSET_TYPE:
+ case CD_PBVH_MASK_TYPE:
+ case CD_PROP_COLOR:
+ case CD_PROP_BYTE_COLOR:
- case CD_MLOOPUV:
++ case CD_PROP_FLOAT2:
+ return true;
+ }
+
+ return false;
+ }
+
struct PBVHVbo {
uint64_t type;
eAttrDomain domain;
diff --cc source/blender/modifiers/intern/MOD_array.cc
index 8d828bb45b5,1478ca0ecc5..7c277ffbeff
--- a/source/blender/modifiers/intern/MOD_array.cc
+++ b/source/blender/modifiers/intern/MOD_array.cc
@@@ -670,9 -671,10 +671,9 @@@ static Mesh *arrayModifier_doArray(Arra
/* handle UVs */
if (chunk_nloops > 0 && is_zero_v2(amd->uv_offset) == false) {
- const int totuv = CustomData_number_of_layers(&result->ldata, CD_MLOOPUV);
+ const int totuv = CustomData_number_of_layers(&result->ldata, CD_PROP_FLOAT2);
for (i = 0; i < totuv; i++) {
- float(*dmloopuv)[2] = CustomData_get_layer_n(&result->ldata, CD_PROP_FLOAT2, i);
- MLoopUV *dmloopuv = static_cast<MLoopUV *>(
- CustomData_get_layer_n(&result->ldata, CD_MLOOPUV, i));
++ float(*dmloopuv)[2] = static_cast<float (*)[2]>(CustomData_get_layer_n(&result->ldata, CD_PROP_FLOAT2, i));
dmloopuv += chunk_nloops;
for (c = 1; c < count; c++) {
const float uv_offset[2] = {
diff --cc source/blender/modifiers/intern/MOD_screw.cc
index 32237721384,930fa0c1aab..84fb4ac36cc
--- a/source/blender/modifiers/intern/MOD_screw.cc
+++ b/source/blender/modifiers/intern/MOD_screw.cc
@@@ -206,16 -205,16 +205,16 @@@ static Mesh *modifyMesh(ModifierData *m
};
uint maxVerts = 0, maxEdges = 0, maxPolys = 0;
- const uint totvert = (uint)mesh->totvert;
- const uint totedge = (uint)mesh->totedge;
- const uint totpoly = (uint)mesh->totpoly;
+ const uint totvert = uint(mesh->totvert);
+ const uint totedge = uint(mesh->totedge);
+ const uint totpoly = uint(mesh->totpoly);
- uint *edge_poly_map = NULL; /* orig edge to orig poly */
- uint *vert_loop_map = NULL; /* orig vert to orig loop */
+ uint *edge_poly_map = nullptr; /* orig edge to orig poly */
+ uint *vert_loop_map = nullptr; /* orig vert to orig loop */
/* UV Coords */
- const uint mloopuv_layers_tot = (uint)CustomData_number_of_layers(&mesh->ldata, CD_PROP_FLOAT2);
- float(**mloopuv_layers)[2] = BLI_array_alloca(mloopuv_layers, mloopuv_layers_tot);
- const uint mloopuv_layers_tot = uint(CustomData_number_of_layers(&mesh->ldata, CD_MLOOPUV));
- blender::Array<MLoopUV *> mloopuv_layers(mloopuv_layers_tot);
++ const uint mloopuv_layers_tot = uint(CustomData_number_of_layers(&mesh->ldata, CD_PROP_FLOAT2));
++ blender::Array<blender::float2 *> mloopuv_layers(mloopuv_layers_tot);
float uv_u_scale;
float uv_v_minmax[2] = {FLT_MAX, -FLT_MAX};
float uv_v_range_inv;
@@@ -409,7 -408,8 +408,7 @@@
if (mloopuv_layers_tot) {
uint uv_lay;
for (uv_lay = 0; uv_lay < mloopuv_layers_tot; uv_lay++) {
- mloopuv_layers[uv_lay] = CustomData_get_layer_n(&result->ldata, CD_PROP_FLOAT2, (int)uv_lay);
- mloopuv_layers[uv_lay] = static_cast<MLoopUV *>(
- CustomData_get_layer_n(&result->ldata, CD_MLOOPUV, int(uv_lay)));
++ mloopuv_layers[uv_lay] = static_cast<blender::float2 *>(CustomData_get_layer_n(&result->ldata, CD_PROP_FLOAT2, int(uv_lay)));
}
if (ltmd->flag & MOD_SCREW_UV_STRETCH_V) {
@@@ -907,32 -910,32 +909,32 @@@
if (mloopuv_layers_tot) {
uint uv_lay;
- const float uv_u_offset_a = (float)(step)*uv_u_scale;
- const float uv_u_offset_b = (float)(step + 1) * uv_u_scale;
+ const float uv_u_offset_a = float(step) * uv_u_scale;
+ const float uv_u_offset_b = float(step + 1) * uv_u_scale;
for (uv_lay = 0; uv_lay < mloopuv_layers_tot; uv_lay++) {
- float(*mluv)[2] = &mloopuv_layers[uv_lay][l_index];
- MLoopUV *mluv = &mloopuv_layers[uv_lay][l_index];
++ blender::float2 *mluv = &mloopuv_layers[uv_lay][l_index];
- mluv[quad_ord[0]].uv[0] += uv_u_offset_a;
- mluv[quad_ord[1]].uv[0] += uv_u_offset_a;
- mluv[quad_ord[2]].uv[0] += uv_u_offset_b;
- mluv[quad_ord[3]].uv[0] += uv_u_offset_b;
+ mluv[quad_ord[0]][0] += uv_u_offset_a;
+ mluv[quad_ord[1]][0] += uv_u_offset_a;
+ mluv[quad_ord[2]][0] += uv_u_offset_b;
+ mluv[quad_ord[3]][0] += uv_u_offset_b;
}
}
}
else {
if (mloopuv_layers_tot) {
- int l_index = (int)(ml_new - mloop_new);
+ int l_index = int(ml_new - mloop_new);
uint uv_lay;
- const float uv_u_offset_a = (float)(step)*uv_u_scale;
- const float uv_u_offset_b = (float)(step + 1) * uv_u_scale;
+ const float uv_u_offset_a = float(step) * uv_u_scale;
+ const float uv_u_offset_b = float(step + 1) * uv_u_scale;
for (uv_lay = 0; uv_lay < mloopuv_layers_tot; uv_lay++) {
- float(*mluv)[2] = &mloopuv_layers[uv_lay][l_index];
- MLoopUV *mluv = &mloopuv_layers[uv_lay][l_index];
++ blender::float2 *mluv = &mloopuv_layers[uv_lay][l_index];
- copy_v2_fl2(mluv[quad_ord[0]].uv, uv_u_offset_a, uv_v_offset_a);
- copy_v2_fl2(mluv[quad_ord[1]].uv, uv_u_offset_a, uv_v_offset_b);
- copy_v2_fl2(mluv[quad_ord[2]].uv, uv_u_offset_b, uv_v_offset_b);
- copy_v2_fl2(mluv[quad_ord[3]].uv, uv_u_offset_b, uv_v_offset_a);
+ copy_v2_fl2(mluv[quad_ord[0]], uv_u_offset_a, uv_v_offset_a);
+ copy_v2_fl2(mluv[quad_ord[1]], uv_u_offset_a, uv_v_offset_b);
+ copy_v2_fl2(mluv[quad_ord[2]], uv_u_offset_b, uv_v_offset_b);
+ copy_v2_fl2(mluv[quad_ord[3]], uv_u_offset_b, uv_v_offset_a);
}
}
}
More information about the Bf-blender-cvs
mailing list