Mesh: Move freestyle tags to generic attributes

This commit moves the freestyle edge and face mark tags to become
generic attributes, similar to other changes over the past years. The
attributes are called "freestyle_edge" and "freestyle_face", and they're
now propagated like regular boolean attributes.

Compatibility wise, forward and backward blend file compatibility are
maintained (for forward compatibility this is implemented a bit
differently than in the past because of the ongoing `AttributeStorage`
transition). In the Python API, `use_freestyle_mark` has been removed;
the attribute API should be used instead (just like bevel weights).
The BMesh (`freestyle`) accessors are removed too.

The conversions benefit from the fact that bit-wise, the old structs are
the same as `bool`, so we can convert to the old and new formats without
reallocating arrays.

Pull Request: https://projects.blender.org/blender/blender/pulls/141996
This commit is contained in:
Hans Goudey
2025-07-16 18:26:26 +02:00
committed by Hans Goudey
parent feb4122f62
commit b20ecee555
24 changed files with 265 additions and 267 deletions

View File

@@ -147,7 +147,7 @@ class SCENE_OT_freestyle_add_edge_marks_to_keying_set(Operator):
bpy.ops.object.mode_set(mode='OBJECT', toggle=False)
for i, edge in enumerate(mesh.edges):
if not edge.hide and edge.select:
path = "edges[{:d}].use_freestyle_mark".format(i)
path = "attributes[\"freestyle_edge\"].data[{:d}].value".format(i)
ks.paths.add(mesh, path, index=0)
bpy.ops.object.mode_set(mode=ob_mode, toggle=False)
return {'FINISHED'}
@@ -178,7 +178,7 @@ class SCENE_OT_freestyle_add_face_marks_to_keying_set(Operator):
bpy.ops.object.mode_set(mode='OBJECT', toggle=False)
for i, polygon in enumerate(mesh.polygons):
if not polygon.hide and polygon.select:
path = "polygons[{:d}].use_freestyle_mark".format(i)
path = "attributes[\"freestyle_face\"].data[{:d}].value".format(i)
ks.paths.add(mesh, path, index=0)
bpy.ops.object.mode_set(mode=ob_mode, toggle=False)
return {'FINISHED'}