Mesh: Move bevel weight to generic attribute

Store bevel weights in two new named float attributes:
- `bevel_weight_vert`
- `bevel_weight_edge`

These attributes are naming conventions. Blender doesn't enforce
their data type or domain at all, but some editing features and
modifiers use the hard-coded name. Eventually those tools should
become more generic, but this is a simple change to allow more
flexibility in the meantime.

The largest user-visible changes are that the attributes populate the
attribute list, and are propagated by geometry nodes. The method of
removing this data is now the attribute list as well.

This is a breaking change. Forward compatibility is not preserved, and
the vertex and edge `bevel_weight` properties are removed. Python API
users are expected to use the attribute API to get and set the values.

Fixes #106949

Pull Request: blender/blender#108023
This commit is contained in:
2023-05-19 14:31:31 +02:00
committed by Hans Goudey
parent 51923c09e2
commit 2a56403cb0
27 changed files with 273 additions and 348 deletions

View File

@@ -496,16 +496,6 @@ class DATA_PT_customdata(MeshButtonsPanel, Panel):
else: else:
col.operator("mesh.customdata_custom_splitnormals_add", icon='ADD') col.operator("mesh.customdata_custom_splitnormals_add", icon='ADD')
if me.has_bevel_weight_edge:
col.operator("mesh.customdata_bevel_weight_edge_clear", icon='X')
else:
col.operator("mesh.customdata_bevel_weight_edge_add", icon='ADD')
if me.has_bevel_weight_vertex:
col.operator("mesh.customdata_bevel_weight_vertex_clear", icon='X')
else:
col.operator("mesh.customdata_bevel_weight_vertex_add", icon='ADD')
if me.has_crease_edge: if me.has_crease_edge:
col.operator("mesh.customdata_crease_edge_clear", icon='X') col.operator("mesh.customdata_crease_edge_clear", icon='X')
else: else:

View File

@@ -25,13 +25,13 @@ extern "C" {
/* Blender file format version. */ /* Blender file format version. */
#define BLENDER_FILE_VERSION BLENDER_VERSION #define BLENDER_FILE_VERSION BLENDER_VERSION
#define BLENDER_FILE_SUBVERSION 1 #define BLENDER_FILE_SUBVERSION 2
/* Minimum Blender version that supports reading file written with the current /* Minimum Blender version that supports reading file written with the current
* version. Older Blender versions will test this and show a warning if the file * version. Older Blender versions will test this and show a warning if the file
* was written with too new a version. */ * was written with too new a version. */
#define BLENDER_FILE_MIN_VERSION 306 #define BLENDER_FILE_MIN_VERSION 400
#define BLENDER_FILE_MIN_SUBVERSION 9 #define BLENDER_FILE_MIN_SUBVERSION 2
/** User readable version string. */ /** User readable version string. */
const char *BKE_blender_version_string(void); const char *BKE_blender_version_string(void);

View File

@@ -703,6 +703,8 @@ enum {
CD_CUSTOMLOOPNORMAL, /* Because we play with clnor and temp lnor layers here. */ CD_CUSTOMLOOPNORMAL, /* Because we play with clnor and temp lnor layers here. */
CD_FAKE_SHARP = CD_FAKE | 200, /* Sharp flag for edges, smooth flag for faces. */ CD_FAKE_SHARP = CD_FAKE | 200, /* Sharp flag for edges, smooth flag for faces. */
CD_FAKE_BWEIGHT = CD_FAKE | 300, /* UV seam flag for edges. */
}; };
enum { enum {

View File

@@ -44,6 +44,10 @@ void BKE_mesh_legacy_edge_crease_to_layers(struct Mesh *mesh);
* Copy bevel weights from vertices and edges to separate layers. * Copy bevel weights from vertices and edges to separate layers.
*/ */
void BKE_mesh_legacy_bevel_weight_to_layers(struct Mesh *mesh); void BKE_mesh_legacy_bevel_weight_to_layers(struct Mesh *mesh);
/**
* Move bevel weight to generic float attribute type.
*/
void BKE_mesh_legacy_bevel_weight_to_generic(struct Mesh *mesh);
/** /**
* Convert the old hide flags (#ME_HIDE) to the hidden element attribute for reading. * Convert the old hide flags (#ME_HIDE) to the hidden element attribute for reading.

View File

@@ -1167,29 +1167,6 @@ static void layerDefault_origindex(void *data, const int count)
copy_vn_i((int *)data, count, ORIGINDEX_NONE); copy_vn_i((int *)data, count, ORIGINDEX_NONE);
} }
static void layerInterp_bweight(const void **sources,
const float *weights,
const float * /*sub_weights*/,
int count,
void *dest)
{
float **in = (float **)sources;
if (count <= 0) {
return;
}
float f = 0.0f;
for (int i = 0; i < count; i++) {
const float interp_weight = weights[i];
f += *in[i] * interp_weight;
}
/* Delay writing to the destination in case dest is in sources. */
*((float *)dest) = f;
}
static void layerInterp_shapekey(const void **sources, static void layerInterp_shapekey(const void **sources,
const float *weights, const float *weights,
const float * /*sub_weights*/, const float * /*sub_weights*/,
@@ -1786,8 +1763,8 @@ static const LayerTypeInfo LAYERTYPEINFO[CD_NUMTYPES] = {
{sizeof(int), "", 0, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr}, {sizeof(int), "", 0, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr},
/* 28: CD_SHAPEKEY */ /* 28: CD_SHAPEKEY */
{sizeof(float[3]), "", 0, N_("ShapeKey"), nullptr, nullptr, layerInterp_shapekey}, {sizeof(float[3]), "", 0, N_("ShapeKey"), nullptr, nullptr, layerInterp_shapekey},
/* 29: CD_BWEIGHT */ /* 29: CD_BWEIGHT */ /* DEPRECATED*/
{sizeof(MFloatProperty), "MFloatProperty", 1, nullptr, nullptr, nullptr, layerInterp_bweight}, {sizeof(MFloatProperty), "MFloatProperty", 1},
/* 30: CD_CREASE */ /* 30: CD_CREASE */
{sizeof(float), "", 0, nullptr, nullptr, nullptr, layerInterp_propFloat}, {sizeof(float), "", 0, nullptr, nullptr, nullptr, layerInterp_propFloat},
/* 31: CD_ORIGSPACE_MLOOP */ /* 31: CD_ORIGSPACE_MLOOP */
@@ -2043,9 +2020,9 @@ const CustomData_MeshMasks CD_MASK_BAREMESH_ORIGINDEX = {
}; };
const CustomData_MeshMasks CD_MASK_MESH = { const CustomData_MeshMasks CD_MASK_MESH = {
/*vmask*/ (CD_MASK_PROP_FLOAT3 | CD_MASK_MDEFORMVERT | CD_MASK_MVERT_SKIN | /*vmask*/ (CD_MASK_PROP_FLOAT3 | CD_MASK_MDEFORMVERT | CD_MASK_MVERT_SKIN |
CD_MASK_PAINT_MASK | CD_MASK_PROP_ALL | CD_MASK_CREASE | CD_MASK_BWEIGHT), CD_MASK_PAINT_MASK | CD_MASK_PROP_ALL | CD_MASK_CREASE),
/*emask*/ /*emask*/
(CD_MASK_FREESTYLE_EDGE | CD_MASK_PROP_ALL | CD_MASK_BWEIGHT | CD_MASK_CREASE), (CD_MASK_FREESTYLE_EDGE | CD_MASK_PROP_ALL | CD_MASK_CREASE),
/*fmask*/ 0, /*fmask*/ 0,
/*pmask*/ /*pmask*/
(CD_MASK_FACEMAP | CD_MASK_FREESTYLE_FACE | CD_MASK_PROP_ALL), (CD_MASK_FACEMAP | CD_MASK_FREESTYLE_FACE | CD_MASK_PROP_ALL),
@@ -2055,10 +2032,9 @@ const CustomData_MeshMasks CD_MASK_MESH = {
const CustomData_MeshMasks CD_MASK_DERIVEDMESH = { const CustomData_MeshMasks CD_MASK_DERIVEDMESH = {
/*vmask*/ (CD_MASK_ORIGINDEX | CD_MASK_MDEFORMVERT | CD_MASK_SHAPEKEY | CD_MASK_MVERT_SKIN | /*vmask*/ (CD_MASK_ORIGINDEX | CD_MASK_MDEFORMVERT | CD_MASK_SHAPEKEY | CD_MASK_MVERT_SKIN |
CD_MASK_PAINT_MASK | CD_MASK_ORCO | CD_MASK_CLOTH_ORCO | CD_MASK_PROP_ALL | CD_MASK_PAINT_MASK | CD_MASK_ORCO | CD_MASK_CLOTH_ORCO | CD_MASK_PROP_ALL |
CD_MASK_CREASE | CD_MASK_BWEIGHT), CD_MASK_CREASE),
/*emask*/ /*emask*/
(CD_MASK_ORIGINDEX | CD_MASK_FREESTYLE_EDGE | CD_MASK_BWEIGHT | CD_MASK_PROP_ALL | (CD_MASK_ORIGINDEX | CD_MASK_FREESTYLE_EDGE | CD_MASK_PROP_ALL | CD_MASK_CREASE),
CD_MASK_CREASE),
/*fmask*/ (CD_MASK_ORIGINDEX | CD_MASK_ORIGSPACE | CD_MASK_PREVIEW_MCOL | CD_MASK_TANGENT), /*fmask*/ (CD_MASK_ORIGINDEX | CD_MASK_ORIGSPACE | CD_MASK_PREVIEW_MCOL | CD_MASK_TANGENT),
/*pmask*/ /*pmask*/
(CD_MASK_ORIGINDEX | CD_MASK_FREESTYLE_FACE | CD_MASK_FACEMAP | CD_MASK_PROP_ALL), (CD_MASK_ORIGINDEX | CD_MASK_FREESTYLE_FACE | CD_MASK_FACEMAP | CD_MASK_PROP_ALL),
@@ -2067,9 +2043,9 @@ const CustomData_MeshMasks CD_MASK_DERIVEDMESH = {
CD_MASK_PROP_ALL), /* XXX: MISSING #CD_MASK_MLOOPTANGENT ? */ CD_MASK_PROP_ALL), /* XXX: MISSING #CD_MASK_MLOOPTANGENT ? */
}; };
const CustomData_MeshMasks CD_MASK_BMESH = { const CustomData_MeshMasks CD_MASK_BMESH = {
/*vmask*/ (CD_MASK_MDEFORMVERT | CD_MASK_BWEIGHT | CD_MASK_MVERT_SKIN | CD_MASK_SHAPEKEY | /*vmask*/ (CD_MASK_MDEFORMVERT | CD_MASK_MVERT_SKIN | CD_MASK_SHAPEKEY |
CD_MASK_SHAPE_KEYINDEX | CD_MASK_PAINT_MASK | CD_MASK_PROP_ALL | CD_MASK_CREASE), CD_MASK_SHAPE_KEYINDEX | CD_MASK_PAINT_MASK | CD_MASK_PROP_ALL | CD_MASK_CREASE),
/*emask*/ (CD_MASK_BWEIGHT | CD_MASK_CREASE | CD_MASK_FREESTYLE_EDGE | CD_MASK_PROP_ALL), /*emask*/ (CD_MASK_CREASE | CD_MASK_FREESTYLE_EDGE | CD_MASK_PROP_ALL),
/*fmask*/ 0, /*fmask*/ 0,
/*pmask*/ /*pmask*/
(CD_MASK_FREESTYLE_FACE | CD_MASK_FACEMAP | CD_MASK_PROP_ALL), (CD_MASK_FREESTYLE_FACE | CD_MASK_FACEMAP | CD_MASK_PROP_ALL),
@@ -2077,12 +2053,12 @@ const CustomData_MeshMasks CD_MASK_BMESH = {
(CD_MASK_MDISPS | CD_MASK_CUSTOMLOOPNORMAL | CD_MASK_GRID_PAINT_MASK | CD_MASK_PROP_ALL), (CD_MASK_MDISPS | CD_MASK_CUSTOMLOOPNORMAL | CD_MASK_GRID_PAINT_MASK | CD_MASK_PROP_ALL),
}; };
const CustomData_MeshMasks CD_MASK_EVERYTHING = { const CustomData_MeshMasks CD_MASK_EVERYTHING = {
/*vmask*/ (CD_MASK_BM_ELEM_PYPTR | CD_MASK_ORIGINDEX | CD_MASK_MDEFORMVERT | CD_MASK_BWEIGHT | /*vmask*/ (CD_MASK_BM_ELEM_PYPTR | CD_MASK_ORIGINDEX | CD_MASK_MDEFORMVERT |
CD_MASK_MVERT_SKIN | CD_MASK_ORCO | CD_MASK_CLOTH_ORCO | CD_MASK_SHAPEKEY | CD_MASK_MVERT_SKIN | CD_MASK_ORCO | CD_MASK_CLOTH_ORCO | CD_MASK_SHAPEKEY |
CD_MASK_SHAPE_KEYINDEX | CD_MASK_PAINT_MASK | CD_MASK_PROP_ALL | CD_MASK_CREASE), CD_MASK_SHAPE_KEYINDEX | CD_MASK_PAINT_MASK | CD_MASK_PROP_ALL | CD_MASK_CREASE),
/*emask*/ /*emask*/
(CD_MASK_BM_ELEM_PYPTR | CD_MASK_ORIGINDEX | CD_MASK_BWEIGHT | CD_MASK_CREASE | (CD_MASK_BM_ELEM_PYPTR | CD_MASK_ORIGINDEX | CD_MASK_CREASE | CD_MASK_FREESTYLE_EDGE |
CD_MASK_FREESTYLE_EDGE | CD_MASK_PROP_ALL), CD_MASK_PROP_ALL),
/*fmask*/ /*fmask*/
(CD_MASK_MFACE | CD_MASK_ORIGINDEX | CD_MASK_NORMAL | CD_MASK_MTFACE | CD_MASK_MCOL | (CD_MASK_MFACE | CD_MASK_ORIGINDEX | CD_MASK_NORMAL | CD_MASK_MTFACE | CD_MASK_MCOL |
CD_MASK_ORIGSPACE | CD_MASK_TANGENT | CD_MASK_TESSLOOPNORMAL | CD_MASK_PREVIEW_MCOL | CD_MASK_ORIGSPACE | CD_MASK_TANGENT | CD_MASK_TESSLOOPNORMAL | CD_MASK_PREVIEW_MCOL |

View File

@@ -193,7 +193,7 @@ int BKE_object_data_transfer_dttype_to_cdtype(const int dtdata_type)
case DT_TYPE_SKIN: case DT_TYPE_SKIN:
return CD_MVERT_SKIN; return CD_MVERT_SKIN;
case DT_TYPE_BWEIGHT_VERT: case DT_TYPE_BWEIGHT_VERT:
return CD_BWEIGHT; return CD_FAKE_BWEIGHT;
case DT_TYPE_SHARP_EDGE: case DT_TYPE_SHARP_EDGE:
return CD_FAKE_SHARP; return CD_FAKE_SHARP;
@@ -202,7 +202,7 @@ int BKE_object_data_transfer_dttype_to_cdtype(const int dtdata_type)
case DT_TYPE_CREASE: case DT_TYPE_CREASE:
return CD_CREASE; return CD_CREASE;
case DT_TYPE_BWEIGHT_EDGE: case DT_TYPE_BWEIGHT_EDGE:
return CD_BWEIGHT; return CD_FAKE_BWEIGHT;
case DT_TYPE_FREESTYLE_EDGE: case DT_TYPE_FREESTYLE_EDGE:
return CD_FREESTYLE_EDGE; return CD_FREESTYLE_EDGE;
@@ -977,6 +977,24 @@ static bool data_transfer_layersmapping_generate(ListBase *r_map,
* since we can't access them from mesh vertices :/ */ * since we can't access them from mesh vertices :/ */
return false; return false;
} }
if (r_map && cddata_type == CD_FAKE_BWEIGHT) {
if (!CustomData_get_layer_named(&me_dst->vdata, CD_PROP_FLOAT, "bevel_weight_vert")) {
CustomData_add_layer_named(
&me_dst->vdata, CD_PROP_FLOAT, CD_SET_DEFAULT, me_dst->totvert, "bevel_weight_vert");
}
data_transfer_layersmapping_add_item_cd(
r_map,
CD_PROP_FLOAT,
mix_mode,
mix_factor,
mix_weights,
CustomData_get_layer_named(&me_src->vdata, CD_PROP_FLOAT, "bevel_weight_vert"),
CustomData_get_layer_named_for_write(
&me_dst->vdata, CD_PROP_FLOAT, "bevel_weight_vert", me_dst->totvert),
interp,
interp_data);
return true;
}
} }
else if (elem_type == ME_EDGE) { else if (elem_type == ME_EDGE) {
if (!(cddata_type & CD_FAKE)) { /* Unused for edges, currently... */ if (!(cddata_type & CD_FAKE)) { /* Unused for edges, currently... */
@@ -1039,6 +1057,25 @@ static bool data_transfer_layersmapping_generate(ListBase *r_map,
interp_data); interp_data);
return true; return true;
} }
if (r_map && cddata_type == CD_FAKE_BWEIGHT) {
if (!CustomData_get_layer_named(&me_dst->edata, CD_PROP_FLOAT, "bevel_weight_edge")) {
CustomData_add_layer_named(
&me_dst->edata, CD_PROP_FLOAT, CD_SET_DEFAULT, me_dst->totedge, "bevel_weight_edge");
}
data_transfer_layersmapping_add_item_cd(
r_map,
CD_PROP_FLOAT,
mix_mode,
mix_factor,
mix_weights,
CustomData_get_layer_named(&me_src->edata, CD_PROP_FLOAT, "bevel_weight_edge"),
CustomData_get_layer_named_for_write(
&me_dst->edata, CD_PROP_FLOAT, "bevel_weight_edge", me_dst->totedge),
interp,
interp_data);
return true;
}
return false; return false;
} }
else if (elem_type == ME_LOOP) { else if (elem_type == ME_LOOP) {

View File

@@ -1334,6 +1334,56 @@ void BKE_mesh_legacy_bevel_weight_to_layers(Mesh *mesh)
} }
} }
void BKE_mesh_legacy_bevel_weight_to_generic(Mesh *mesh)
{
using namespace blender;
if (!mesh->attributes().contains("bevel_weight_vert")) {
void *data = nullptr;
const ImplicitSharingInfo *sharing_info = nullptr;
for (const int i : IndexRange(mesh->vdata.totlayer)) {
CustomDataLayer &layer = mesh->vdata.layers[i];
if (layer.type == CD_BWEIGHT) {
data = layer.data;
sharing_info = layer.sharing_info;
layer.data = nullptr;
layer.sharing_info = nullptr;
CustomData_free_layer(&mesh->vdata, CD_BWEIGHT, mesh->totvert, i);
break;
}
}
if (data != nullptr) {
CustomData_add_layer_named_with_data(
&mesh->vdata, CD_PROP_FLOAT, data, mesh->totvert, "bevel_weight_vert", sharing_info);
}
if (sharing_info != nullptr) {
sharing_info->remove_user_and_delete_if_last();
}
}
if (!mesh->attributes().contains("bevel_weight_edge")) {
void *data = nullptr;
const ImplicitSharingInfo *sharing_info = nullptr;
for (const int i : IndexRange(mesh->edata.totlayer)) {
CustomDataLayer &layer = mesh->edata.layers[i];
if (layer.type == CD_BWEIGHT) {
data = layer.data;
sharing_info = layer.sharing_info;
layer.data = nullptr;
layer.sharing_info = nullptr;
CustomData_free_layer(&mesh->edata, CD_BWEIGHT, mesh->totedge, i);
break;
}
}
if (data != nullptr) {
CustomData_add_layer_named_with_data(
&mesh->edata, CD_PROP_FLOAT, data, mesh->totedge, "bevel_weight_edge", sharing_info);
}
if (sharing_info != nullptr) {
sharing_info->remove_user_and_delete_if_last();
}
}
}
/** \} */ /** \} */
/* -------------------------------------------------------------------- */ /* -------------------------------------------------------------------- */

View File

@@ -108,6 +108,12 @@ void blo_do_versions_400(FileData * /*fd*/, Library * /*lib*/, Main *bmain)
version_movieclips_legacy_camera_object(bmain); version_movieclips_legacy_camera_object(bmain);
} }
if (!MAIN_VERSION_ATLEAST(bmain, 400, 2)) {
LISTBASE_FOREACH (Mesh *, mesh, &bmain->meshes) {
BKE_mesh_legacy_bevel_weight_to_generic(mesh);
}
}
/** /**
* Versioning code until next subversion bump goes here. * Versioning code until next subversion bump goes here.
* *

View File

@@ -336,6 +336,8 @@ typedef struct BevelParams {
float pro_super_r; float pro_super_r;
/** Bevel amount affected by weights on edges or verts. */ /** Bevel amount affected by weights on edges or verts. */
bool use_weights; bool use_weights;
int bweight_offset_vert;
int bweight_offset_edge;
/** Should bevel prefer to slide along edges rather than keep widths spec? */ /** Should bevel prefer to slide along edges rather than keep widths spec? */
bool loop_slide; bool loop_slide;
/** Should offsets be limited by collisions? */ /** Should offsets be limited by collisions? */
@@ -1279,9 +1281,12 @@ static void offset_meet_lines_percent_or_absolute(BevelParams *bp,
d5 = bp->offset * BM_edge_calc_length(e5.e) / 100.0f; d5 = bp->offset * BM_edge_calc_length(e5.e) / 100.0f;
} }
if (bp->use_weights) { if (bp->use_weights) {
CustomData *cd = &bp->bm->edata; e1_wt = bp->bweight_offset_edge == -1 ?
e1_wt = BM_elem_float_data_get(cd, e1->e, CD_BWEIGHT); 0.0f :
e2_wt = BM_elem_float_data_get(cd, e2->e, CD_BWEIGHT); BM_ELEM_CD_GET_FLOAT(e1->e, bp->bweight_offset_edge);
e2_wt = bp->bweight_offset_edge == -1 ?
0.0f :
BM_ELEM_CD_GET_FLOAT(e2->e, bp->bweight_offset_edge);
} }
else { else {
e1_wt = 1.0f; e1_wt = 1.0f;
@@ -1607,9 +1612,10 @@ static bool offset_on_edge_between(BevelParams *bp,
if (bp->offset_type == BEVEL_AMT_PERCENT) { if (bp->offset_type == BEVEL_AMT_PERCENT) {
float wt = 1.0; float wt = 1.0;
if (bp->use_weights) { if (bp->use_weights) {
CustomData *cd = &bp->bm->edata; wt = bp->bweight_offset_edge == -1 ?
wt = 0.5f * (BM_elem_float_data_get(cd, e1->e, CD_BWEIGHT) + 0.0f :
BM_elem_float_data_get(cd, e2->e, CD_BWEIGHT)); 0.5f * (BM_ELEM_CD_GET_FLOAT(e1->e, bp->bweight_offset_edge) +
BM_ELEM_CD_GET_FLOAT(e2->e, bp->bweight_offset_edge));
} }
interp_v3_v3v3(meetco, v->co, v2->co, wt * bp->offset / 100.0f); interp_v3_v3v3(meetco, v->co, v2->co, wt * bp->offset / 100.0f);
} }
@@ -6441,7 +6447,8 @@ static BevVert *bevel_vert_construct(BMesh *bm, BevelParams *bp, BMVert *v)
bv->offset *= weight; bv->offset *= weight;
} }
else if (bp->use_weights) { else if (bp->use_weights) {
weight = BM_elem_float_data_get(&bm->vdata, v, CD_BWEIGHT); weight = bp->bweight_offset_vert == -1 ? 0.0f :
BM_ELEM_CD_GET_FLOAT(v, bp->bweight_offset_vert);
bv->offset *= weight; bv->offset *= weight;
} }
/* Find center axis. NOTE: Don't use vert normal, can give unwanted results. */ /* Find center axis. NOTE: Don't use vert normal, can give unwanted results. */
@@ -6521,7 +6528,9 @@ static BevVert *bevel_vert_construct(BMesh *bm, BevelParams *bp, BMVert *v)
e->offset_r_spec = e->offset_l_spec; e->offset_r_spec = e->offset_l_spec;
} }
if (bp->use_weights) { if (bp->use_weights) {
weight = BM_elem_float_data_get(&bm->edata, e->e, CD_BWEIGHT); weight = bp->bweight_offset_edge == -1 ?
0.0f :
BM_ELEM_CD_GET_FLOAT(e->e, bp->bweight_offset_edge);
e->offset_l_spec *= weight; e->offset_l_spec *= weight;
e->offset_r_spec *= weight; e->offset_r_spec *= weight;
} }
@@ -7755,6 +7764,10 @@ void BM_mesh_bevel(BMesh *bm,
.pro_super_r = -logf(2.0) / logf(sqrtf(profile)), /* Convert to superellipse exponent. */ .pro_super_r = -logf(2.0) / logf(sqrtf(profile)), /* Convert to superellipse exponent. */
.affect_type = affect_type, .affect_type = affect_type,
.use_weights = use_weights, .use_weights = use_weights,
.bweight_offset_vert = CustomData_get_offset_named(
&bm->vdata, CD_PROP_FLOAT, "bevel_weight_vert"),
.bweight_offset_edge = CustomData_get_offset_named(
&bm->edata, CD_PROP_FLOAT, "bevel_weight_edge"),
.loop_slide = loop_slide, .loop_slide = loop_slide,
.limit_offset = limit_offset, .limit_offset = limit_offset,
.offset_adjust = (bp.affect_type != BEVEL_AFFECT_VERTICES) && .offset_adjust = (bp.affect_type != BEVEL_AFFECT_VERTICES) &&

View File

@@ -454,7 +454,8 @@ MeshRenderData *mesh_render_data_create(Object *object,
mr->vert_crease_ofs = CustomData_get_offset(&mr->bm->vdata, CD_CREASE); mr->vert_crease_ofs = CustomData_get_offset(&mr->bm->vdata, CD_CREASE);
mr->edge_crease_ofs = CustomData_get_offset(&mr->bm->edata, CD_CREASE); mr->edge_crease_ofs = CustomData_get_offset(&mr->bm->edata, CD_CREASE);
mr->bweight_ofs = CustomData_get_offset(&mr->bm->edata, CD_BWEIGHT); mr->bweight_ofs = CustomData_get_offset_named(
&mr->bm->edata, CD_PROP_FLOAT, "bevel_weight_edge");
#ifdef WITH_FREESTYLE #ifdef WITH_FREESTYLE
mr->freestyle_edge_ofs = CustomData_get_offset(&mr->bm->edata, CD_FREESTYLE_EDGE); mr->freestyle_edge_ofs = CustomData_get_offset(&mr->bm->edata, CD_FREESTYLE_EDGE);
mr->freestyle_face_ofs = CustomData_get_offset(&mr->bm->pdata, CD_FREESTYLE_FACE); mr->freestyle_face_ofs = CustomData_get_offset(&mr->bm->pdata, CD_FREESTYLE_FACE);

View File

@@ -149,6 +149,7 @@ static bool path_select_poll_property(const bContext *C,
struct UserData { struct UserData {
BMesh *bm; BMesh *bm;
Mesh *me; Mesh *me;
int cd_offset;
const struct PathSelectParams *op_params; const struct PathSelectParams *op_params;
}; };
@@ -182,7 +183,24 @@ static void mouse_mesh_shortest_path_vert(Scene *UNUSED(scene),
BMEditMesh *em = BKE_editmesh_from_object(obedit); BMEditMesh *em = BKE_editmesh_from_object(obedit);
BMesh *bm = em->bm; BMesh *bm = em->bm;
struct UserData user_data = {bm, obedit->data, op_params}; int cd_offset = -1;
switch (op_params->edge_mode) {
case EDGE_MODE_SELECT:
case EDGE_MODE_TAG_SEAM:
case EDGE_MODE_TAG_SHARP:
#ifdef WITH_FREESTYLE
case EDGE_MODE_TAG_FREESTYLE:
#endif
break;
case EDGE_MODE_TAG_CREASE:
cd_offset = CustomData_get_offset(&bm->edata, CD_CREASE);
break;
case EDGE_MODE_TAG_BEVEL:
cd_offset = CustomData_get_offset_named(&bm->edata, CD_PROP_FLOAT, "bevel_weight_edge");
break;
}
struct UserData user_data = {bm, obedit->data, cd_offset, op_params};
LinkNode *path = NULL; LinkNode *path = NULL;
bool is_path_ordered = false; bool is_path_ordered = false;
@@ -281,7 +299,6 @@ static bool edgetag_test_cb(BMEdge *e, void *user_data_v)
{ {
struct UserData *user_data = user_data_v; struct UserData *user_data = user_data_v;
const char edge_mode = user_data->op_params->edge_mode; const char edge_mode = user_data->op_params->edge_mode;
BMesh *bm = user_data->bm;
switch (edge_mode) { switch (edge_mode) {
case EDGE_MODE_SELECT: case EDGE_MODE_SELECT:
@@ -291,11 +308,11 @@ static bool edgetag_test_cb(BMEdge *e, void *user_data_v)
case EDGE_MODE_TAG_SHARP: case EDGE_MODE_TAG_SHARP:
return BM_elem_flag_test(e, BM_ELEM_SMOOTH) ? false : true; return BM_elem_flag_test(e, BM_ELEM_SMOOTH) ? false : true;
case EDGE_MODE_TAG_CREASE: case EDGE_MODE_TAG_CREASE:
return BM_elem_float_data_get(&bm->edata, e, CD_CREASE) ? true : false;
case EDGE_MODE_TAG_BEVEL: case EDGE_MODE_TAG_BEVEL:
return BM_elem_float_data_get(&bm->edata, e, CD_BWEIGHT) ? true : false; return BM_ELEM_CD_GET_FLOAT(e, user_data->cd_offset);
#ifdef WITH_FREESTYLE #ifdef WITH_FREESTYLE
case EDGE_MODE_TAG_FREESTYLE: { case EDGE_MODE_TAG_FREESTYLE: {
BMesh *bm = user_data->bm;
FreestyleEdge *fed = CustomData_bmesh_get(&bm->edata, e->head.data, CD_FREESTYLE_EDGE); FreestyleEdge *fed = CustomData_bmesh_get(&bm->edata, e->head.data, CD_FREESTYLE_EDGE);
return (!fed) ? false : (fed->flag & FREESTYLE_EDGE_MARK) ? true : false; return (!fed) ? false : (fed->flag & FREESTYLE_EDGE_MARK) ? true : false;
} }
@@ -320,10 +337,8 @@ static void edgetag_set_cb(BMEdge *e, bool val, void *user_data_v)
BM_elem_flag_set(e, BM_ELEM_SMOOTH, !val); BM_elem_flag_set(e, BM_ELEM_SMOOTH, !val);
break; break;
case EDGE_MODE_TAG_CREASE: case EDGE_MODE_TAG_CREASE:
BM_elem_float_data_set(&bm->edata, e, CD_CREASE, (val) ? 1.0f : 0.0f);
break;
case EDGE_MODE_TAG_BEVEL: case EDGE_MODE_TAG_BEVEL:
BM_elem_float_data_set(&bm->edata, e, CD_BWEIGHT, (val) ? 1.0f : 0.0f); BM_ELEM_CD_SET_FLOAT(e, user_data->cd_offset, (val) ? 1.0f : 0.0f);
break; break;
#ifdef WITH_FREESTYLE #ifdef WITH_FREESTYLE
case EDGE_MODE_TAG_FREESTYLE: { case EDGE_MODE_TAG_FREESTYLE: {
@@ -352,8 +367,8 @@ static void edgetag_ensure_cd_flag(Mesh *me, const char edge_mode)
} }
break; break;
case EDGE_MODE_TAG_BEVEL: case EDGE_MODE_TAG_BEVEL:
if (!CustomData_has_layer(&bm->edata, CD_BWEIGHT)) { if (!CustomData_has_layer_named(&bm->edata, CD_PROP_FLOAT, "bevel_weight_edge")) {
BM_data_layer_add(bm, &bm->edata, CD_BWEIGHT); BM_data_layer_add_named(bm, &bm->edata, CD_PROP_FLOAT, "bevel_weight_edge");
} }
break; break;
#ifdef WITH_FREESTYLE #ifdef WITH_FREESTYLE
@@ -380,7 +395,24 @@ static void mouse_mesh_shortest_path_edge(Scene *scene,
BMEditMesh *em = BKE_editmesh_from_object(obedit); BMEditMesh *em = BKE_editmesh_from_object(obedit);
BMesh *bm = em->bm; BMesh *bm = em->bm;
struct UserData user_data = {bm, obedit->data, op_params}; int cd_offset = -1;
switch (op_params->edge_mode) {
case EDGE_MODE_SELECT:
case EDGE_MODE_TAG_SEAM:
case EDGE_MODE_TAG_SHARP:
#ifdef WITH_FREESTYLE
case EDGE_MODE_TAG_FREESTYLE:
#endif
break;
case EDGE_MODE_TAG_CREASE:
cd_offset = CustomData_get_offset(&bm->edata, CD_CREASE);
break;
case EDGE_MODE_TAG_BEVEL:
cd_offset = CustomData_get_offset_named(&bm->edata, CD_PROP_FLOAT, "bevel_weight_edge");
break;
}
struct UserData user_data = {bm, obedit->data, cd_offset, op_params};
LinkNode *path = NULL; LinkNode *path = NULL;
bool is_path_ordered = false; bool is_path_ordered = false;
@@ -516,7 +548,24 @@ static void mouse_mesh_shortest_path_face(Scene *UNUSED(scene),
BMEditMesh *em = BKE_editmesh_from_object(obedit); BMEditMesh *em = BKE_editmesh_from_object(obedit);
BMesh *bm = em->bm; BMesh *bm = em->bm;
struct UserData user_data = {bm, obedit->data, op_params}; int cd_offset = -1;
switch (op_params->edge_mode) {
case EDGE_MODE_SELECT:
case EDGE_MODE_TAG_SEAM:
case EDGE_MODE_TAG_SHARP:
#ifdef WITH_FREESTYLE
case EDGE_MODE_TAG_FREESTYLE:
#endif
break;
case EDGE_MODE_TAG_CREASE:
cd_offset = CustomData_get_offset(&bm->edata, CD_CREASE);
break;
case EDGE_MODE_TAG_BEVEL:
cd_offset = CustomData_get_offset_named(&bm->edata, CD_PROP_FLOAT, "bevel_weight_edge");
break;
}
struct UserData user_data = {bm, obedit->data, cd_offset, op_params};
LinkNode *path = NULL; LinkNode *path = NULL;
bool is_path_ordered = false; bool is_path_ordered = false;

View File

@@ -630,7 +630,6 @@ static int similar_edge_select_exec(bContext *C, wmOperator *op)
const float thresh = RNA_float_get(op->ptr, "threshold"); const float thresh = RNA_float_get(op->ptr, "threshold");
const float thresh_radians = thresh * (float)M_PI + FLT_EPSILON; const float thresh_radians = thresh * (float)M_PI + FLT_EPSILON;
const int compare = RNA_enum_get(op->ptr, "compare"); const int compare = RNA_enum_get(op->ptr, "compare");
int custom_data_type = -1;
int tot_edges_selected_all = 0; int tot_edges_selected_all = 0;
uint objects_len = 0; uint objects_len = 0;
@@ -669,15 +668,6 @@ static int similar_edge_select_exec(bContext *C, wmOperator *op)
break; break;
} }
switch (type) {
case SIMEDGE_CREASE:
custom_data_type = CD_CREASE;
break;
case SIMEDGE_BEVEL:
custom_data_type = CD_BWEIGHT;
break;
}
int tree_index = 0; int tree_index = 0;
for (uint ob_index = 0; ob_index < objects_len; ob_index++) { for (uint ob_index = 0; ob_index < objects_len; ob_index++) {
Object *ob = objects[ob_index]; Object *ob = objects[ob_index];
@@ -696,14 +686,31 @@ static int similar_edge_select_exec(bContext *C, wmOperator *op)
} }
break; break;
} }
case SIMEDGE_CREASE: case SIMEDGE_CREASE: {
case SIMEDGE_BEVEL: { if (!CustomData_has_layer(&bm->edata, CD_CREASE)) {
if (!CustomData_has_layer(&bm->edata, custom_data_type)) {
BLI_kdtree_1d_insert(tree_1d, tree_index++, (float[1]){0.0f}); BLI_kdtree_1d_insert(tree_1d, tree_index++, (float[1]){0.0f});
continue; continue;
} }
break; break;
} }
case SIMEDGE_BEVEL: {
if (!CustomData_has_layer_named(&bm->edata, CD_PROP_FLOAT, "bevel_weight_edge")) {
BLI_kdtree_1d_insert(tree_1d, tree_index++, (float[1]){0.0f});
continue;
}
break;
}
}
int custom_data_offset;
switch (type) {
case SIMEDGE_CREASE:
custom_data_offset = CustomData_get_offset(&bm->edata, CD_CREASE);
break;
case SIMEDGE_BEVEL:
custom_data_offset = CustomData_get_offset_named(
&bm->edata, CD_PROP_FLOAT, "bevel_weight_edge");
break;
} }
float ob_m3[3][3], ob_m3_inv[3][3]; float ob_m3[3][3], ob_m3_inv[3][3];
@@ -763,8 +770,7 @@ static int similar_edge_select_exec(bContext *C, wmOperator *op)
} }
case SIMEDGE_CREASE: case SIMEDGE_CREASE:
case SIMEDGE_BEVEL: { case SIMEDGE_BEVEL: {
const float *value = CustomData_bmesh_get( const float *value = BM_ELEM_CD_GET_FLOAT_P(edge, custom_data_offset);
&bm->edata, edge->head.data, custom_data_type);
BLI_kdtree_1d_insert(tree_1d, tree_index++, value); BLI_kdtree_1d_insert(tree_1d, tree_index++, value);
break; break;
} }
@@ -799,9 +805,13 @@ static int similar_edge_select_exec(bContext *C, wmOperator *op)
} }
break; break;
} }
case SIMEDGE_CREASE: case SIMEDGE_CREASE: {
has_custom_data_layer = CustomData_has_layer(&bm->edata, CD_CREASE);
ATTR_FALLTHROUGH;
}
case SIMEDGE_BEVEL: { case SIMEDGE_BEVEL: {
has_custom_data_layer = CustomData_has_layer(&bm->edata, custom_data_type); has_custom_data_layer = CustomData_has_layer_named(
&bm->edata, CD_PROP_FLOAT, "bevel_weight_edge");
if (!has_custom_data_layer) { if (!has_custom_data_layer) {
/* Proceed only if we have to select all the edges that have custom data value of 0.0f. /* Proceed only if we have to select all the edges that have custom data value of 0.0f.
* In this case we will just select all the edges. * In this case we will just select all the edges.
@@ -817,6 +827,17 @@ static int similar_edge_select_exec(bContext *C, wmOperator *op)
copy_m3_m4(ob_m3, ob->object_to_world); copy_m3_m4(ob_m3, ob->object_to_world);
invert_m3_m3(ob_m3_inv, ob_m3); invert_m3_m3(ob_m3_inv, ob_m3);
int custom_data_offset;
switch (type) {
case SIMEDGE_CREASE:
custom_data_offset = CustomData_get_offset(&bm->edata, CD_CREASE);
break;
case SIMEDGE_BEVEL:
custom_data_offset = CustomData_get_offset_named(
&bm->edata, CD_PROP_FLOAT, "bevel_weight_edge");
break;
}
BMEdge *edge; /* Mesh edge. */ BMEdge *edge; /* Mesh edge. */
BMIter iter; /* Selected edges iterator. */ BMIter iter; /* Selected edges iterator. */
@@ -903,8 +924,7 @@ static int similar_edge_select_exec(bContext *C, wmOperator *op)
break; break;
} }
const float *value = CustomData_bmesh_get( const float *value = BM_ELEM_CD_GET_FLOAT_P(edge, custom_data_offset);
&bm->edata, edge->head.data, custom_data_type);
if (ED_select_similar_compare_float_tree(tree_1d, *value, thresh, compare)) { if (ED_select_similar_compare_float_tree(tree_1d, *value, thresh, compare)) {
select = true; select = true;
} }

View File

@@ -825,126 +825,6 @@ void MESH_OT_customdata_custom_splitnormals_clear(wmOperatorType *ot)
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
} }
/* Vertex bevel weight. */
static int mesh_customdata_bevel_weight_vertex_state(bContext *C)
{
const Object *object = ED_object_context(C);
if (object && object->type == OB_MESH) {
const Mesh *mesh = static_cast<Mesh *>(object->data);
if (!ID_IS_LINKED(mesh)) {
const CustomData *data = GET_CD_DATA(mesh, vdata);
return CustomData_has_layer(data, CD_BWEIGHT);
}
}
return -1;
}
static bool mesh_customdata_bevel_weight_vertex_add_poll(bContext *C)
{
return mesh_customdata_bevel_weight_vertex_state(C) == 0;
}
static int mesh_customdata_bevel_weight_vertex_add_exec(bContext *C, wmOperator * /*op*/)
{
return mesh_customdata_add_exec__internal(C, BM_VERT, CD_BWEIGHT);
}
void MESH_OT_customdata_bevel_weight_vertex_add(wmOperatorType *ot)
{
ot->name = "Add Vertex Bevel Weight";
ot->idname = "MESH_OT_customdata_bevel_weight_vertex_add";
ot->description = "Add a vertex bevel weight layer";
ot->exec = mesh_customdata_bevel_weight_vertex_add_exec;
ot->poll = mesh_customdata_bevel_weight_vertex_add_poll;
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
static bool mesh_customdata_bevel_weight_vertex_clear_poll(bContext *C)
{
return (mesh_customdata_bevel_weight_vertex_state(C) == 1);
}
static int mesh_customdata_bevel_weight_vertex_clear_exec(bContext *C, wmOperator * /*op*/)
{
return mesh_customdata_clear_exec__internal(C, BM_VERT, CD_BWEIGHT);
}
void MESH_OT_customdata_bevel_weight_vertex_clear(wmOperatorType *ot)
{
ot->name = "Clear Vertex Bevel Weight";
ot->idname = "MESH_OT_customdata_bevel_weight_vertex_clear";
ot->description = "Clear the vertex bevel weight layer";
ot->exec = mesh_customdata_bevel_weight_vertex_clear_exec;
ot->poll = mesh_customdata_bevel_weight_vertex_clear_poll;
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
/* Edge bevel weight. */
static int mesh_customdata_bevel_weight_edge_state(bContext *C)
{
const Object *ob = ED_object_context(C);
if (ob && ob->type == OB_MESH) {
const Mesh *mesh = static_cast<Mesh *>(ob->data);
if (!ID_IS_LINKED(mesh)) {
const CustomData *data = GET_CD_DATA(mesh, edata);
return CustomData_has_layer(data, CD_BWEIGHT);
}
}
return -1;
}
static bool mesh_customdata_bevel_weight_edge_add_poll(bContext *C)
{
return mesh_customdata_bevel_weight_edge_state(C) == 0;
}
static int mesh_customdata_bevel_weight_edge_add_exec(bContext *C, wmOperator * /*op*/)
{
return mesh_customdata_add_exec__internal(C, BM_EDGE, CD_BWEIGHT);
}
void MESH_OT_customdata_bevel_weight_edge_add(wmOperatorType *ot)
{
ot->name = "Add Edge Bevel Weight";
ot->idname = "MESH_OT_customdata_bevel_weight_edge_add";
ot->description = "Add an edge bevel weight layer";
ot->exec = mesh_customdata_bevel_weight_edge_add_exec;
ot->poll = mesh_customdata_bevel_weight_edge_add_poll;
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
static bool mesh_customdata_bevel_weight_edge_clear_poll(bContext *C)
{
return mesh_customdata_bevel_weight_edge_state(C) == 1;
}
static int mesh_customdata_bevel_weight_edge_clear_exec(bContext *C, wmOperator * /*op*/)
{
return mesh_customdata_clear_exec__internal(C, BM_EDGE, CD_BWEIGHT);
}
void MESH_OT_customdata_bevel_weight_edge_clear(wmOperatorType *ot)
{
ot->name = "Clear Edge Bevel Weight";
ot->idname = "MESH_OT_customdata_bevel_weight_edge_clear";
ot->description = "Clear the edge bevel weight layer";
ot->exec = mesh_customdata_bevel_weight_edge_clear_exec;
ot->poll = mesh_customdata_bevel_weight_edge_clear_poll;
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
/* Edge crease. */ /* Edge crease. */
static int mesh_customdata_crease_edge_state(bContext *C) static int mesh_customdata_crease_edge_state(bContext *C)

View File

@@ -323,10 +323,6 @@ void MESH_OT_customdata_skin_add(struct wmOperatorType *ot);
void MESH_OT_customdata_skin_clear(struct wmOperatorType *ot); void MESH_OT_customdata_skin_clear(struct wmOperatorType *ot);
void MESH_OT_customdata_custom_splitnormals_add(struct wmOperatorType *ot); void MESH_OT_customdata_custom_splitnormals_add(struct wmOperatorType *ot);
void MESH_OT_customdata_custom_splitnormals_clear(struct wmOperatorType *ot); void MESH_OT_customdata_custom_splitnormals_clear(struct wmOperatorType *ot);
void MESH_OT_customdata_bevel_weight_vertex_add(struct wmOperatorType *ot);
void MESH_OT_customdata_bevel_weight_vertex_clear(struct wmOperatorType *ot);
void MESH_OT_customdata_bevel_weight_edge_add(struct wmOperatorType *ot);
void MESH_OT_customdata_bevel_weight_edge_clear(struct wmOperatorType *ot);
void MESH_OT_customdata_crease_vertex_add(struct wmOperatorType *ot); void MESH_OT_customdata_crease_vertex_add(struct wmOperatorType *ot);
void MESH_OT_customdata_crease_vertex_clear(struct wmOperatorType *ot); void MESH_OT_customdata_crease_vertex_clear(struct wmOperatorType *ot);
void MESH_OT_customdata_crease_edge_add(struct wmOperatorType *ot); void MESH_OT_customdata_crease_edge_add(struct wmOperatorType *ot);

View File

@@ -141,10 +141,6 @@ void ED_operatortypes_mesh(void)
WM_operatortype_append(MESH_OT_customdata_skin_clear); WM_operatortype_append(MESH_OT_customdata_skin_clear);
WM_operatortype_append(MESH_OT_customdata_custom_splitnormals_add); WM_operatortype_append(MESH_OT_customdata_custom_splitnormals_add);
WM_operatortype_append(MESH_OT_customdata_custom_splitnormals_clear); WM_operatortype_append(MESH_OT_customdata_custom_splitnormals_clear);
WM_operatortype_append(MESH_OT_customdata_bevel_weight_vertex_add);
WM_operatortype_append(MESH_OT_customdata_bevel_weight_vertex_clear);
WM_operatortype_append(MESH_OT_customdata_bevel_weight_edge_add);
WM_operatortype_append(MESH_OT_customdata_bevel_weight_edge_clear);
WM_operatortype_append(MESH_OT_customdata_crease_vertex_add); WM_operatortype_append(MESH_OT_customdata_crease_vertex_add);
WM_operatortype_append(MESH_OT_customdata_crease_vertex_clear); WM_operatortype_append(MESH_OT_customdata_crease_vertex_clear);
WM_operatortype_append(MESH_OT_customdata_crease_edge_add); WM_operatortype_append(MESH_OT_customdata_crease_edge_add);

View File

@@ -705,7 +705,7 @@ static int sculpt_face_set_init_exec(bContext *C, wmOperator *op)
} }
case SCULPT_FACE_SETS_FROM_BEVEL_WEIGHT: { case SCULPT_FACE_SETS_FROM_BEVEL_WEIGHT: {
const float *bevel_weights = static_cast<const float *>( const float *bevel_weights = static_cast<const float *>(
CustomData_get_layer(&mesh->edata, CD_BWEIGHT)); CustomData_get_layer_named(&mesh->edata, CD_PROP_FLOAT, "bevel_weight_edge"));
sculpt_face_sets_init_flood_fill( sculpt_face_sets_init_flood_fill(
ob, [&](const int /*from_face*/, const int edge, const int /*to_face*/) -> bool { ob, [&](const int /*from_face*/, const int edge, const int /*to_face*/) -> bool {
return bevel_weights ? bevel_weights[edge] < threshold : true; return bevel_weights ? bevel_weights[edge] < threshold : true;

View File

@@ -305,10 +305,12 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float
BMEdge *eed; BMEdge *eed;
BMIter iter; BMIter iter;
const int cd_vert_bweight_offset = CustomData_get_offset(&bm->vdata, CD_BWEIGHT); const int cd_vert_bweight_offset = CustomData_get_offset_named(
&bm->vdata, CD_PROP_FLOAT, "bevel_weight_vert");
const int cd_vert_crease_offset = CustomData_get_offset(&bm->vdata, CD_CREASE); const int cd_vert_crease_offset = CustomData_get_offset(&bm->vdata, CD_CREASE);
const int cd_vert_skin_offset = CustomData_get_offset(&bm->vdata, CD_MVERT_SKIN); const int cd_vert_skin_offset = CustomData_get_offset(&bm->vdata, CD_MVERT_SKIN);
const int cd_edge_bweight_offset = CustomData_get_offset(&bm->edata, CD_BWEIGHT); const int cd_edge_bweight_offset = CustomData_get_offset_named(
&bm->edata, CD_PROP_FLOAT, "bevel_weight_edge");
const int cd_edge_crease_offset = CustomData_get_offset(&bm->edata, CD_CREASE); const int cd_edge_crease_offset = CustomData_get_offset(&bm->edata, CD_CREASE);
has_skinradius = (cd_vert_skin_offset != -1); has_skinradius = (cd_vert_skin_offset != -1);
@@ -997,10 +999,11 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float
if (apply_vcos || median->bv_weight || median->v_crease || median->skin[0] || if (apply_vcos || median->bv_weight || median->v_crease || median->skin[0] ||
median->skin[1]) { median->skin[1]) {
if (median->bv_weight) { if (median->bv_weight) {
if (!CustomData_has_layer(&bm->vdata, CD_BWEIGHT)) { if (!CustomData_has_layer_named(&bm->vdata, CD_PROP_FLOAT, "bevel_weight_vert")) {
BM_data_layer_add(bm, &bm->vdata, CD_BWEIGHT); BM_data_layer_add_named(bm, &bm->vdata, CD_PROP_FLOAT, "bevel_weight_vert");
} }
cd_vert_bweight_offset = CustomData_get_offset(&bm->vdata, CD_BWEIGHT); cd_vert_bweight_offset = CustomData_get_offset_named(
&bm->vdata, CD_PROP_FLOAT, "bevel_weight_vert");
BLI_assert(cd_vert_bweight_offset != -1); BLI_assert(cd_vert_bweight_offset != -1);
scale_bv_weight = compute_scale_factor(ve_median->bv_weight, median->bv_weight); scale_bv_weight = compute_scale_factor(ve_median->bv_weight, median->bv_weight);
@@ -1067,10 +1070,11 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float
if (median->be_weight || median->e_crease) { if (median->be_weight || median->e_crease) {
if (median->be_weight) { if (median->be_weight) {
if (!CustomData_has_layer(&bm->edata, CD_BWEIGHT)) { if (!CustomData_has_layer_named(&bm->edata, CD_PROP_FLOAT, "bevel_weight_edge")) {
BM_data_layer_add(bm, &bm->edata, CD_BWEIGHT); BM_data_layer_add_named(bm, &bm->edata, CD_PROP_FLOAT, "bevel_weight_edge");
} }
cd_edge_bweight_offset = CustomData_get_offset(&bm->edata, CD_BWEIGHT); cd_edge_bweight_offset = CustomData_get_offset_named(
&bm->edata, CD_PROP_FLOAT, "bevel_weight_edge");
BLI_assert(cd_edge_bweight_offset != -1); BLI_assert(cd_edge_bweight_offset != -1);
scale_be_weight = compute_scale_factor(ve_median->be_weight, median->be_weight); scale_be_weight = compute_scale_factor(ve_median->be_weight, median->be_weight);

View File

@@ -67,10 +67,11 @@ static void createTransEdge(bContext *UNUSED(C), TransInfo *t)
/* create data we need */ /* create data we need */
if (t->mode == TFM_BWEIGHT) { if (t->mode == TFM_BWEIGHT) {
if (!CustomData_has_layer(&em->bm->edata, CD_BWEIGHT)) { if (!CustomData_has_layer_named(&em->bm->edata, CD_PROP_FLOAT, "bevel_weight_edge")) {
BM_data_layer_add(em->bm, &em->bm->edata, CD_BWEIGHT); BM_data_layer_add_named(em->bm, &em->bm->edata, CD_PROP_FLOAT, "bevel_weight_edge");
} }
cd_edge_float_offset = CustomData_get_offset(&em->bm->edata, CD_BWEIGHT); cd_edge_float_offset = CustomData_get_offset_named(
&em->bm->edata, CD_PROP_FLOAT, "bevel_weight_edge");
} }
else { /* if (t->mode == TFM_EDGE_CREASE) { */ else { /* if (t->mode == TFM_EDGE_CREASE) { */
BLI_assert(t->mode == TFM_EDGE_CREASE); BLI_assert(t->mode == TFM_EDGE_CREASE);

View File

@@ -28,7 +28,7 @@
#include "transform_convert.h" #include "transform_convert.h"
/* -------------------------------------------------------------------- */ /* -------------------------------------------------------------------- */
/** \name Edit Mesh #CD_BWEIGHT and #CD_CREASE Transform Creation /** \name Edit Mesh Bevel Weight and #CD_CREASE Transform Creation
* \{ */ * \{ */
static float *tc_mesh_cdata_transdata_center(const struct TransIslandData *island_data, static float *tc_mesh_cdata_transdata_center(const struct TransIslandData *island_data,
@@ -85,10 +85,10 @@ static void createTransMeshVertCData(bContext *UNUSED(C), TransInfo *t)
int cd_offset = -1; int cd_offset = -1;
if (t->mode == TFM_BWEIGHT) { if (t->mode == TFM_BWEIGHT) {
if (!CustomData_has_layer(&bm->vdata, CD_BWEIGHT)) { if (!CustomData_has_layer_named(&bm->vdata, CD_PROP_FLOAT, "bevel_weight_vert")) {
BM_data_layer_add(bm, &bm->vdata, CD_BWEIGHT); BM_data_layer_add_named(bm, &bm->vdata, CD_PROP_FLOAT, "bevel_weight_vert");
} }
cd_offset = CustomData_get_offset(&bm->vdata, CD_BWEIGHT); cd_offset = CustomData_get_offset_named(&bm->vdata, CD_PROP_FLOAT, "bevel_weight_vert");
} }
else { else {
if (!CustomData_has_layer(&bm->vdata, CD_CREASE)) { if (!CustomData_has_layer(&bm->vdata, CD_CREASE)) {

View File

@@ -21,7 +21,6 @@ static inline bool naive_edges_equal(const int2 &edge1, const int2 &edge2)
static void add_new_vertices(Mesh &mesh, const Span<int> new_to_old_verts_map) static void add_new_vertices(Mesh &mesh, const Span<int> new_to_old_verts_map)
{ {
/* These types aren't supported for interpolation below. */ /* These types aren't supported for interpolation below. */
CustomData_free_layers(&mesh.vdata, CD_BWEIGHT, mesh.totvert);
CustomData_free_layers(&mesh.vdata, CD_SHAPEKEY, mesh.totvert); CustomData_free_layers(&mesh.vdata, CD_SHAPEKEY, mesh.totvert);
CustomData_free_layers(&mesh.vdata, CD_CLOTH_ORCO, mesh.totvert); CustomData_free_layers(&mesh.vdata, CD_CLOTH_ORCO, mesh.totvert);
CustomData_free_layers(&mesh.vdata, CD_MVERT_SKIN, mesh.totvert); CustomData_free_layers(&mesh.vdata, CD_MVERT_SKIN, mesh.totvert);

View File

@@ -201,7 +201,6 @@ typedef enum eCustomDataType {
#define CD_MASK_SHAPE_KEYINDEX (1 << CD_SHAPE_KEYINDEX) #define CD_MASK_SHAPE_KEYINDEX (1 << CD_SHAPE_KEYINDEX)
#define CD_MASK_SHAPEKEY (1 << CD_SHAPEKEY) #define CD_MASK_SHAPEKEY (1 << CD_SHAPEKEY)
#define CD_MASK_BWEIGHT (1 << CD_BWEIGHT)
#define CD_MASK_CREASE (1 << CD_CREASE) #define CD_MASK_CREASE (1 << CD_CREASE)
#define CD_MASK_ORIGSPACE_MLOOP (1LL << CD_ORIGSPACE_MLOOP) #define CD_MASK_ORIGSPACE_MLOOP (1LL << CD_ORIGSPACE_MLOOP)
#define CD_MASK_PREVIEW_MLOOPCOL (1LL << CD_PREVIEW_MLOOPCOL) #define CD_MASK_PREVIEW_MLOOPCOL (1LL << CD_PREVIEW_MLOOPCOL)

View File

@@ -185,16 +185,6 @@ static bool rna_Mesh_has_custom_normals_get(PointerRNA *ptr)
return BKE_mesh_has_custom_loop_normals(me); return BKE_mesh_has_custom_loop_normals(me);
} }
static bool rna_Mesh_has_edge_bevel_weight_get(PointerRNA *ptr)
{
return CustomData_has_layer(rna_mesh_edata(ptr), CD_BWEIGHT);
}
static bool rna_Mesh_has_vertex_bevel_weight_get(PointerRNA *ptr)
{
return CustomData_has_layer(rna_mesh_vdata(ptr), CD_BWEIGHT);
}
static bool rna_Mesh_has_edge_crease_get(PointerRNA *ptr) static bool rna_Mesh_has_edge_crease_get(PointerRNA *ptr)
{ {
return CustomData_has_layer(rna_mesh_edata(ptr), CD_CREASE); return CustomData_has_layer(rna_mesh_edata(ptr), CD_CREASE);
@@ -499,40 +489,6 @@ static void rna_MeshVertex_select_set(PointerRNA *ptr, bool value)
select_vert[index] = value; select_vert[index] = value;
} }
static float rna_MeshVertex_bevel_weight_get(PointerRNA *ptr)
{
const Mesh *mesh = rna_mesh(ptr);
const int index = rna_MeshVertex_index_get(ptr);
const float *values = (const float *)CustomData_get_layer(&mesh->vdata, CD_BWEIGHT);
return values == NULL ? 0.0f : values[index];
}
static void rna_MeshVertex_bevel_weight_set(PointerRNA *ptr, float value)
{
Mesh *mesh = rna_mesh(ptr);
const int index = rna_MeshVertex_index_get(ptr);
float *values = (float *)CustomData_add_layer(
&mesh->vdata, CD_BWEIGHT, CD_SET_DEFAULT, mesh->totvert);
values[index] = clamp_f(value, 0.0f, 1.0f);
}
static float rna_MEdge_bevel_weight_get(PointerRNA *ptr)
{
const Mesh *mesh = rna_mesh(ptr);
const int index = rna_MeshEdge_index_get(ptr);
const float *values = (const float *)CustomData_get_layer(&mesh->edata, CD_BWEIGHT);
return values == NULL ? 0.0f : values[index];
}
static void rna_MEdge_bevel_weight_set(PointerRNA *ptr, float value)
{
Mesh *mesh = rna_mesh(ptr);
const int index = rna_MeshEdge_index_get(ptr);
float *values = (float *)CustomData_add_layer(
&mesh->edata, CD_BWEIGHT, CD_SET_DEFAULT, mesh->totedge);
values[index] = clamp_f(value, 0.0f, 1.0f);
}
static float rna_MEdge_crease_get(PointerRNA *ptr) static float rna_MEdge_crease_get(PointerRNA *ptr)
{ {
const Mesh *mesh = rna_mesh(ptr); const Mesh *mesh = rna_mesh(ptr);
@@ -2324,13 +2280,6 @@ static void rna_def_mvert(BlenderRNA *brna)
RNA_def_property_boolean_funcs(prop, "rna_MeshVertex_hide_get", "rna_MeshVertex_hide_set"); RNA_def_property_boolean_funcs(prop, "rna_MeshVertex_hide_get", "rna_MeshVertex_hide_set");
RNA_def_property_update(prop, 0, "rna_Mesh_update_select"); RNA_def_property_update(prop, 0, "rna_Mesh_update_select");
prop = RNA_def_property(srna, "bevel_weight", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_funcs(
prop, "rna_MeshVertex_bevel_weight_get", "rna_MeshVertex_bevel_weight_set", NULL);
RNA_def_property_ui_text(
prop, "Bevel Weight", "Weight used by the Bevel modifier 'Only Vertices' option");
RNA_def_property_update(prop, 0, "rna_Mesh_update_data_legacy_deg_tag_all");
prop = RNA_def_property(srna, "groups", PROP_COLLECTION, PROP_NONE); prop = RNA_def_property(srna, "groups", PROP_COLLECTION, PROP_NONE);
RNA_def_property_collection_funcs(prop, RNA_def_property_collection_funcs(prop,
"rna_MeshVertex_groups_begin", "rna_MeshVertex_groups_begin",
@@ -2384,12 +2333,6 @@ static void rna_def_medge(BlenderRNA *brna)
prop, "Crease", "Weight used by the Subdivision Surface modifier for creasing"); prop, "Crease", "Weight used by the Subdivision Surface modifier for creasing");
RNA_def_property_update(prop, 0, "rna_Mesh_update_data_legacy_deg_tag_all"); RNA_def_property_update(prop, 0, "rna_Mesh_update_data_legacy_deg_tag_all");
prop = RNA_def_property(srna, "bevel_weight", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_funcs(
prop, "rna_MEdge_bevel_weight_get", "rna_MEdge_bevel_weight_set", NULL);
RNA_def_property_ui_text(prop, "Bevel Weight", "Weight used by the Bevel modifier");
RNA_def_property_update(prop, 0, "rna_Mesh_update_data_legacy_deg_tag_all");
prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE); prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_funcs(prop, "rna_MeshEdge_select_get", "rna_MeshEdge_select_set"); RNA_def_property_boolean_funcs(prop, "rna_MeshEdge_select_get", "rna_MeshEdge_select_set");
RNA_def_property_ui_text(prop, "Select", ""); RNA_def_property_ui_text(prop, "Select", "");
@@ -3823,18 +3766,6 @@ static void rna_def_mesh(BlenderRNA *brna)
RNA_def_property_boolean_funcs(prop, "rna_Mesh_has_custom_normals_get", NULL); RNA_def_property_boolean_funcs(prop, "rna_Mesh_has_custom_normals_get", NULL);
RNA_define_verify_sdna(true); RNA_define_verify_sdna(true);
prop = RNA_def_property(srna, "has_bevel_weight_edge", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_ui_text(
prop, "Has Edge Bevel Weight", "True if the mesh has an edge bevel weight layer");
RNA_def_property_boolean_funcs(prop, "rna_Mesh_has_edge_bevel_weight_get", NULL);
prop = RNA_def_property(srna, "has_bevel_weight_vertex", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_ui_text(
prop, "Has Vertex Bevel Weight", "True if the mesh has an vertex bevel weight layer");
RNA_def_property_boolean_funcs(prop, "rna_Mesh_has_vertex_bevel_weight_get", NULL);
prop = RNA_def_property(srna, "has_crease_edge", PROP_BOOLEAN, PROP_NONE); prop = RNA_def_property(srna, "has_crease_edge", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_ui_text(prop, "Has Edge Crease", "True if the mesh has an edge crease layer"); RNA_def_property_ui_text(prop, "Has Edge Crease", "True if the mesh has an edge crease layer");

View File

@@ -72,10 +72,6 @@ static void requiredDataMask(ModifierData *md, CustomData_MeshMasks *r_cddata_ma
if (bmd->defgrp_name[0] != '\0') { if (bmd->defgrp_name[0] != '\0') {
r_cddata_masks->vmask |= CD_MASK_MDEFORMVERT; r_cddata_masks->vmask |= CD_MASK_MDEFORMVERT;
} }
if (bmd->lim_flags & MOD_BEVEL_WEIGHT) {
r_cddata_masks->vmask |= CD_MASK_BWEIGHT;
r_cddata_masks->emask |= CD_MASK_BWEIGHT;
}
} }
/* /*
@@ -125,10 +121,15 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh *
MOD_get_vgroup(ctx->object, mesh, bmd->defgrp_name, &dvert, &vgroup); MOD_get_vgroup(ctx->object, mesh, bmd->defgrp_name, &dvert, &vgroup);
} }
const int bweight_offset_vert = CustomData_get_offset_named(
&bm->vdata, CD_PROP_FLOAT, "bevel_weight_vert");
const int bweight_offset_edge = CustomData_get_offset_named(
&bm->edata, CD_PROP_FLOAT, "bevel_weight_edge");
if (bmd->affect_type == MOD_BEVEL_AFFECT_VERTICES) { if (bmd->affect_type == MOD_BEVEL_AFFECT_VERTICES) {
BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) { BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) {
if (bmd->lim_flags & MOD_BEVEL_WEIGHT) { if (bmd->lim_flags & MOD_BEVEL_WEIGHT) {
weight = BM_elem_float_data_get(&bm->vdata, v, CD_BWEIGHT); weight = bweight_offset_vert == -1 ? 0.0f : BM_ELEM_CD_GET_FLOAT(v, bweight_offset_vert);
if (weight == 0.0f) { if (weight == 0.0f) {
continue; continue;
} }
@@ -165,7 +166,7 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh *
BM_ITER_MESH (e, &iter, bm, BM_EDGES_OF_MESH) { BM_ITER_MESH (e, &iter, bm, BM_EDGES_OF_MESH) {
if (BM_edge_is_manifold(e)) { if (BM_edge_is_manifold(e)) {
if (bmd->lim_flags & MOD_BEVEL_WEIGHT) { if (bmd->lim_flags & MOD_BEVEL_WEIGHT) {
weight = BM_elem_float_data_get(&bm->edata, e, CD_BWEIGHT); weight = bweight_offset_edge == -1 ? 0.0f : BM_ELEM_CD_GET_FLOAT(e, bweight_offset_edge);
if (weight == 0.0f) { if (weight == 0.0f) {
continue; continue;
} }

View File

@@ -385,8 +385,8 @@ Mesh *MOD_solidify_extrude_modifyMesh(ModifierData *md, const ModifierEvalContex
float *result_edge_bweight = nullptr; float *result_edge_bweight = nullptr;
if (do_bevel_convex) { if (do_bevel_convex) {
result_edge_bweight = static_cast<float *>( result_edge_bweight = static_cast<float *>(CustomData_add_layer_named(
CustomData_add_layer(&result->edata, CD_BWEIGHT, CD_SET_DEFAULT, result->totedge)); &result->edata, CD_PROP_FLOAT, CD_SET_DEFAULT, result->totedge, "bevel_weight_edge"));
} }
/* Initializes: (`i_end`, `do_shell_align`, `vert_index`). */ /* Initializes: (`i_end`, `do_shell_align`, `vert_index`). */

View File

@@ -191,9 +191,9 @@ Mesh *MOD_solidify_nonmanifold_modifyMesh(ModifierData *md,
/* These might be null. */ /* These might be null. */
const float *orig_vert_bweight = static_cast<const float *>( const float *orig_vert_bweight = static_cast<const float *>(
CustomData_get_layer(&mesh->vdata, CD_BWEIGHT)); CustomData_get_layer_named(&mesh->vdata, CD_PROP_FLOAT, "bevel_weight_vert"));
const float *orig_edge_bweight = static_cast<const float *>( const float *orig_edge_bweight = static_cast<const float *>(
CustomData_get_layer(&mesh->edata, CD_BWEIGHT)); CustomData_get_layer_named(&mesh->edata, CD_PROP_FLOAT, "bevel_weight_edge"));
const float *orig_edge_crease = static_cast<const float *>( const float *orig_edge_crease = static_cast<const float *>(
CustomData_get_layer(&mesh->edata, CD_CREASE)); CustomData_get_layer(&mesh->edata, CD_CREASE));
@@ -2001,11 +2001,11 @@ Mesh *MOD_solidify_nonmanifold_modifyMesh(ModifierData *md,
int *origindex_poly = static_cast<int *>( int *origindex_poly = static_cast<int *>(
CustomData_get_layer_for_write(&result->pdata, CD_ORIGINDEX, result->totpoly)); CustomData_get_layer_for_write(&result->pdata, CD_ORIGINDEX, result->totpoly));
float *result_edge_bweight = static_cast<float *>( float *result_edge_bweight = static_cast<float *>(CustomData_get_layer_named_for_write(
CustomData_get_layer_for_write(&result->edata, CD_BWEIGHT, result->totedge)); &result->edata, CD_PROP_FLOAT, "bevel_weight_edge", result->totedge));
if (bevel_convex != 0.0f || orig_vert_bweight != nullptr) { if (bevel_convex != 0.0f || orig_vert_bweight != nullptr) {
result_edge_bweight = static_cast<float *>( result_edge_bweight = static_cast<float *>(CustomData_add_layer_named(
CustomData_add_layer(&result->edata, CD_BWEIGHT, CD_SET_DEFAULT, result->totedge)); &result->edata, CD_PROP_FLOAT, CD_SET_DEFAULT, result->totedge, "bevel_weight_edge"));
} }
/* Checks that result has dvert data. */ /* Checks that result has dvert data. */

View File

@@ -120,7 +120,6 @@ static void expand_mesh(Mesh &mesh,
/* Remove types that aren't supported for interpolation in this node. */ /* Remove types that aren't supported for interpolation in this node. */
if (vert_expand != 0) { if (vert_expand != 0) {
CustomData_free_layers(&mesh.vdata, CD_ORCO, mesh.totvert); CustomData_free_layers(&mesh.vdata, CD_ORCO, mesh.totvert);
CustomData_free_layers(&mesh.vdata, CD_BWEIGHT, mesh.totvert);
CustomData_free_layers(&mesh.vdata, CD_SHAPEKEY, mesh.totvert); CustomData_free_layers(&mesh.vdata, CD_SHAPEKEY, mesh.totvert);
CustomData_free_layers(&mesh.vdata, CD_CLOTH_ORCO, mesh.totvert); CustomData_free_layers(&mesh.vdata, CD_CLOTH_ORCO, mesh.totvert);
CustomData_free_layers(&mesh.vdata, CD_MVERT_SKIN, mesh.totvert); CustomData_free_layers(&mesh.vdata, CD_MVERT_SKIN, mesh.totvert);
@@ -129,7 +128,6 @@ static void expand_mesh(Mesh &mesh,
CustomData_realloc(&mesh.vdata, old_verts_num, mesh.totvert); CustomData_realloc(&mesh.vdata, old_verts_num, mesh.totvert);
} }
if (edge_expand != 0) { if (edge_expand != 0) {
CustomData_free_layers(&mesh.edata, CD_BWEIGHT, mesh.totedge);
CustomData_free_layers(&mesh.edata, CD_FREESTYLE_EDGE, mesh.totedge); CustomData_free_layers(&mesh.edata, CD_FREESTYLE_EDGE, mesh.totedge);
const int old_edges_num = mesh.totedge; const int old_edges_num = mesh.totedge;
mesh.totedge += edge_expand; mesh.totedge += edge_expand;

View File

@@ -87,8 +87,6 @@ PyDoc_STRVAR(bpy_bmlayeraccess_collection__deform_doc,
PyDoc_STRVAR( PyDoc_STRVAR(
bpy_bmlayeraccess_collection__shape_doc, bpy_bmlayeraccess_collection__shape_doc,
"Vertex shapekey absolute location (as a 3D Vector).\n\n:type: :class:`BMLayerCollection`"); "Vertex shapekey absolute location (as a 3D Vector).\n\n:type: :class:`BMLayerCollection`");
PyDoc_STRVAR(bpy_bmlayeraccess_collection__bevel_weight_doc,
"Bevel weight float in [0 - 1].\n\n:type: :class:`BMLayerCollection`");
PyDoc_STRVAR(bpy_bmlayeraccess_collection__crease_doc, PyDoc_STRVAR(bpy_bmlayeraccess_collection__crease_doc,
"Crease for subdivision surface - float in [0 - 1].\n\n:type: " "Crease for subdivision surface - float in [0 - 1].\n\n:type: "
":class:`BMLayerCollection`"); ":class:`BMLayerCollection`");
@@ -205,11 +203,6 @@ static PyGetSetDef bpy_bmlayeraccess_vert_getseters[] = {
(setter)NULL, (setter)NULL,
bpy_bmlayeraccess_collection__shape_doc, bpy_bmlayeraccess_collection__shape_doc,
(void *)CD_SHAPEKEY}, (void *)CD_SHAPEKEY},
{"bevel_weight",
(getter)bpy_bmlayeraccess_collection_get,
(setter)NULL,
bpy_bmlayeraccess_collection__bevel_weight_doc,
(void *)CD_BWEIGHT},
{"crease", {"crease",
(getter)bpy_bmlayeraccess_collection_get, (getter)bpy_bmlayeraccess_collection_get,
(setter)NULL, (setter)NULL,
@@ -261,11 +254,6 @@ static PyGetSetDef bpy_bmlayeraccess_edge_getseters[] = {
bpy_bmlayeraccess_collection__string_doc, bpy_bmlayeraccess_collection__string_doc,
(void *)CD_PROP_STRING}, (void *)CD_PROP_STRING},
{"bevel_weight",
(getter)bpy_bmlayeraccess_collection_get,
(setter)NULL,
bpy_bmlayeraccess_collection__bevel_weight_doc,
(void *)CD_BWEIGHT},
{"crease", {"crease",
(getter)bpy_bmlayeraccess_collection_get, (getter)bpy_bmlayeraccess_collection_get,
(setter)NULL, (setter)NULL,
@@ -1160,10 +1148,6 @@ PyObject *BPy_BMLayerItem_GetItem(BPy_BMElem *py_ele, BPy_BMLayerItem *py_layer)
ret = Vector_CreatePyObject_wrap((float *)value, 3, NULL); ret = Vector_CreatePyObject_wrap((float *)value, 3, NULL);
break; break;
} }
case CD_BWEIGHT: {
ret = PyFloat_FromDouble(*(float *)value);
break;
}
case CD_CREASE: { case CD_CREASE: {
ret = PyFloat_FromDouble(*(float *)value); ret = PyFloat_FromDouble(*(float *)value);
break; break;
@@ -1275,18 +1259,6 @@ int BPy_BMLayerItem_SetItem(BPy_BMElem *py_ele, BPy_BMLayerItem *py_layer, PyObj
} }
break; break;
} }
case CD_BWEIGHT: {
const float tmp_val = PyFloat_AsDouble(py_value);
if (UNLIKELY(tmp_val == -1 && PyErr_Occurred())) {
PyErr_Format(
PyExc_TypeError, "expected a float, not a %.200s", Py_TYPE(py_value)->tp_name);
ret = -1;
}
else {
*(float *)value = clamp_f(tmp_val, 0.0f, 1.0f);
}
break;
}
case CD_CREASE: { case CD_CREASE: {
const float tmp_val = PyFloat_AsDouble(py_value); const float tmp_val = PyFloat_AsDouble(py_value);
if (UNLIKELY(tmp_val == -1 && PyErr_Occurred())) { if (UNLIKELY(tmp_val == -1 && PyErr_Occurred())) {