Bevel Weight Toggle - Script

Hi,

https://imgur.com/a/G2QkkwU

I’m a simple 3d artist, but my wife (@RihamToulan) is luckily much smarter than me and made me some python scripts.

I work a lot with the bevel modifier and bevel weight and found it obnoxiously annoying that it doesn’t just allow me to toggle the bevel weight value between 0 and 1.

I mean, who needs a bevel weight value of 0.77. That’s just silly. :face_with_hand_over_mouth:

This script will:
"Toggles Bevel edge values between 0 and 1 using the bevel value on the last edge selected"

Download it here
Or just copy the below

And if it’s useful to you, maybe send her a nice tweet

import bpy
import bmesh

'''
Toggles Bevel edge values between 0 and 1 using the bevel value on the last edge selected
'''

def toggleBevel():

    obj = bpy.context.object
    mesh = obj.data
    bm = bmesh.from_edit_mesh(mesh)

    bevelWeightLayer = bm.edges.layers.bevel_weight.verify()
    selectedEdges = [e for e  in bm.edges if e.select]
    lastEdge = selectedEdges[-1]

    value = not bool(lastEdge[bevelWeightLayer])

    for edge in selectedEdges:
        edge[bevelWeightLayer] = value

    bmesh.update_edit_mesh(mesh)

try:
    toggleBevel()
except Exception as e:
    print ("Failed to toggle!\nError: %s"%e)
6 Likes

Hello, How to Install this script ?
Also the toogle subdiv modifier script, Will it behave like Modo Toogle Subsurf Smooth operator ?