varkenvarken / CreatingAdd-onsForBlender-2.93

4 stars 1 forks source link

Changes to 'crease' edits and treatment in Blender 4's 'bmesh' module. #1

Open robholder opened 3 months ago

robholder commented 3 months ago

I notice that Blender 4 has a different way to handle 'creases' in its bmesh module. As a result, ladder_05.py fails with Blender v4.

For the ladder_05.py add-on (line 86), the following may be a workaround to update the code for continued use:

Original code:

    # add a crease layer
    cl = bm.edges.layers.crease.new()

Possible new version for Blender > v4:

    cl = bm.edges.layers.float.new()

Combined to work with old and current versions of Blender (version 2.93 and version 4):

    cl = bm.edges.layers.float.new() if bpy.app.version >= (4,0,0) else bm.edges.layers.crease.new()
varkenvarken commented 3 months ago

good suggestion, thank you. there might be other bits of code that are no longer keeping pace with Blender's rapid development. I am not sure I want to create a new version of the book though, because I am not sure about the amount of interest and it would be a lot of work. but I will see if I can find some time to incorporate your contribution