From f154b03ceacc182e69ad3ee4befa5f68c223831e Mon Sep 17 00:00:00 2001 From: Jesse Yurkovich Date: Wed, 23 Jul 2025 09:08:01 +0200 Subject: [PATCH] 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 --- tests/python/modules/io_report.py | 35 ++++++++++++++++++++++++------- 1 file changed, 28 insertions(+), 7 deletions(-) diff --git a/tests/python/modules/io_report.py b/tests/python/modules/io_report.py index a3e2465dffd..14b4d40709f 100644 --- a/tests/python/modules/io_report.py +++ b/tests/python/modules/io_report.py @@ -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")