I’m trying to make a small change to the bevel modifier that has been highly requested by artists over the years… and that is to “edge groups” or something similar to be able to apply several bevel modifiers with different edge weights.
I’ve got the RNA/DNA changes made, and I think I’m 90% of the way there. Basically it’s a simple UI element to add the selection of a custom attribute (edge weight) here, and then elsewhere in MOD_bevel.cc we just use that custom group instead of bevel_weight_edge:
if (limit_method == MOD_BEVEL_ANGLE) {
sub = uiLayoutColumn(col, false);
uiLayoutSetActive(sub, edge_bevel);
uiItemR(col, ptr, "angle_limit", UI_ITEM_NONE, nullptr, ICON_NONE);
}
else if (limit_method == MOD_BEVEL_WEIGHT) {
// new UI element
sub = uiLayoutColumn(col, false);
uiLayoutSetActive(sub, edge_bevel);
uiItemR(col, ptr, "custom_weight", UI_ITEM_NONE, nullptr, ICON_NONE);
// how to populate a dropdown box that looks for attributes of edge -> float ?
}
else if (limit_method == MOD_BEVEL_VGROUP) {
modifier_vgroup_ui(col, ptr, &ob_ptr, "vertex_group", "invert_vertex_group", nullptr);
}
But now I just need a UI function similar to the existing function that allows you to select a vertex group:
in MOD_bevel.cc:
modifier_vgroup_ui(col, ptr, &ob_ptr, "vertex_group", "invert_vertex_group", nullptr);
Which calls this guy:
void modifier_vgroup_ui(uiLayout *layout,
PointerRNA *ptr,
PointerRNA *ob_ptr,
const char *vgroup_prop,
const char *invert_vgroup_prop,
const char *text)
{
bool has_vertex_group = RNA_string_length(ptr, vgroup_prop) != 0;
uiLayout *row = uiLayoutRow(layout, true);
uiItemPointerR(row, ptr, vgroup_prop, ob_ptr, "vertex_groups", text, ICON_GROUP_VERTEX);
if (invert_vgroup_prop != nullptr) {
uiLayout *sub = uiLayoutRow(row, true);
uiLayoutSetActive(sub, has_vertex_group);
uiLayoutSetPropDecorate(sub, false);
uiItemR(sub, ptr, invert_vgroup_prop, UI_ITEM_NONE, "", ICON_ARROW_LEFTRIGHT);
}
}
I’d like to do the exact same thing, except populate a list of attributes that are of the type “Edge → Float”.
Any suggestions? Does such a UI function exist somewhere else?
If you don’t know what I’m talking about in terms of attributes, it’s pretty new in version 4. Bevel Edge Weights are no longer associated with the MeshEdge object, but now use the “Attributes” interface.
With this version of Blender we are closer then ever to being able to have multiple edge groups. Basically we just need to change the name of the Attribute which is pulled for the edge weights. I think this is a small change that could have a big impact for a lot of users (particularly hard surface modelers).