From f59767ff97295404dade1bc0d494cfe81e8a97bb Mon Sep 17 00:00:00 2001 From: Hans Goudey Date: Thu, 3 Feb 2022 10:49:51 -0600 Subject: Curves: Changes to the new curves data-block This patch refactors the "Hair" data-block, which will soon be renamed to "Curves". The larger change is switching from an array of `HairCurve` to find indices in the points array to simply storing an array of offsets. Using a single integer instead of two halves the amount of memory for that particular array. Besides that, there are some other changes in this patch: - Split the data-structure to a separate `CurveGeometry` DNA struct so it is usable for grease pencil too. - Update naming to be more aligned with newer code and the style guide. - Add direct access to some arrays in RNA -- Radius is now retrieved as a regular attribute in Cycles. -- `HairPoint` has been renamed to `CurvePoint` -- `HairCurve` has been renamed to `CurveSlice` - Add comments to the struct in DNA. The next steps are renaming `Hair` -> `Curves`, and adding support for other curve types: Bezier, Poly, and NURBS. Ref T95355 Differential Revision: https://developer.blender.org/D13987 --- source/blender/blenkernel/intern/attribute.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'source/blender/blenkernel/intern/attribute.c') diff --git a/source/blender/blenkernel/intern/attribute.c b/source/blender/blenkernel/intern/attribute.c index ee8ef5e97f7..73e00398084 100644 --- a/source/blender/blenkernel/intern/attribute.c +++ b/source/blender/blenkernel/intern/attribute.c @@ -90,10 +90,10 @@ static void get_domains(const ID *id, DomainInfo info[ATTR_DOMAIN_NUM]) } case ID_HA: { Hair *hair = (Hair *)id; - info[ATTR_DOMAIN_POINT].customdata = &hair->pdata; - info[ATTR_DOMAIN_POINT].length = hair->totpoint; - info[ATTR_DOMAIN_CURVE].customdata = &hair->cdata; - info[ATTR_DOMAIN_CURVE].length = hair->totcurve; + info[ATTR_DOMAIN_POINT].customdata = &hair->geometry.point_data; + info[ATTR_DOMAIN_POINT].length = hair->geometry.point_size; + info[ATTR_DOMAIN_CURVE].customdata = &hair->geometry.curve_data; + info[ATTR_DOMAIN_CURVE].length = hair->geometry.curve_size; break; } default: -- cgit v1.2.3