Tests: add new Curves datablock to IO report

Add the new Curves datablock type to the IO report. This was created
for the new hair system but is more generally used for any type of curve
generated within geometry nodes.

The report itself is mostly just a dump of all available attributes for
the object.

Pull Request: https://projects.blender.org/blender/blender/pulls/142925
This commit is contained in:
Jesse Yurkovich
2025-07-23 09:08:01 +02:00
committed by Jesse Yurkovich
parent 605e6c0bbf
commit f154b03cea

View File

@@ -252,7 +252,7 @@ integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw
def _val_to_str(val) -> str:
if isinstance(val, bpy.types.BoolAttributeValue):
return f"{1 if val.value else 0}"
if isinstance(val, bpy.types.IntAttributeValue):
if isinstance(val, (bpy.types.IntAttributeValue, bpy.types.ByteIntAttributeValue)):
return f"{val.value}"
if isinstance(val, bpy.types.FloatAttributeValue):
return f"{fmtf(val.value)}"
@@ -323,12 +323,11 @@ integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw
return
desc.write(f" - attr '{attr.name}' {attr.data_type} {attr.domain}\n")
if isinstance(
attr,
bpy.types.BoolAttribute) or isinstance(
attr,
bpy.types.IntAttribute) or isinstance(
attr,
bpy.types.FloatAttribute):
attr,
(bpy.types.BoolAttribute,
bpy.types.IntAttribute,
bpy.types.ByteIntAttribute,
bpy.types.FloatAttribute)):
Report._write_collection_single(attr.data, desc)
else:
Report._write_collection_multi(attr.data, desc)
@@ -504,6 +503,28 @@ integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw
Report._write_custom_props(curve, desc)
desc.write(f"\n")
# curves(new) / hair
if len(bpy.data.hair_curves):
desc.write(f"==== Curves(new): {len(bpy.data.hair_curves)}\n")
for curve in bpy.data.hair_curves:
# overview
desc.write(
f"- Curve '{curve.name}' "
f"splines:{len(curve.curves)} "
f"control-points:{len(curve.points)}\n"
)
# attributes
for attr in sorted(curve.attributes, key=lambda x: x.name):
if not attr.is_internal:
Report._write_attr(attr, desc)
# materials
if curve.materials:
desc.write(f" - {len(curve.materials)} materials\n")
Report._write_collection_single(curve.materials, desc)
Report._write_animdata_desc(curve.animation_data, desc)
Report._write_custom_props(curve, desc)
desc.write(f"\n")
# objects
if len(bpy.data.objects):
desc.write(f"==== Objects: {len(bpy.data.objects)}\n")