Commit: b69aad60bda23a53482b2c2ae98715c23a715bc8 Author: Jacques Lucke Date: Tue Jun 7 15:03:38 2022 +0200 Branches: master https://developer.blender.org/rBb69aad60bda23a53482b2c2ae98715c23a715bc8
Curves: use root/tip radius of the first curve in the viewport Viewport drawing does not support a per point radius attribute yet. Instead, it has a fixed set of radius parameters that are used for all curves in the same object. Now those radii are retrieved from the radius attribute of the points on the first curve. This allows users to control the radius of curves to some degree until proper per-point radius is supported. =================================================================== M source/blender/draw/intern/draw_curves.cc =================================================================== diff --git a/source/blender/draw/intern/draw_curves.cc b/source/blender/draw/intern/draw_curves.cc index 39d4845994f..749383edc6d 100644 --- a/source/blender/draw/intern/draw_curves.cc +++ b/source/blender/draw/intern/draw_curves.cc @@ -13,6 +13,9 @@ #include "DNA_curves_types.h" #include "DNA_customdata_types.h" +#include "BKE_curves.hh" +#include "BKE_geometry_set.hh" + #include "GPU_batch.h" #include "GPU_capabilities.h" #include "GPU_compute.h" @@ -325,6 +328,21 @@ DRWShadingGroup *DRW_shgroup_curves_create_sub(Object *object, float hair_rad_tip = 0.0f; bool hair_close_tip = true; + /* Use the radius of the root and tip of the first curve for now. This is a workaround that we + * use for now because we can't use a per-point radius yet. */ + Curves &curves_id = *static_cast<Curves *>(object->data); + const blender::bke::CurvesGeometry &curves = blender::bke::CurvesGeometry::wrap( + curves_id.geometry); + if (curves.curves_num() >= 1) { + CurveComponent curves_component; + curves_component.replace(&curves_id, GeometryOwnershipType::ReadOnly); + blender::VArray<float> radii = curves_component.attribute_get_for_read( + "radius", ATTR_DOMAIN_POINT, 0.005f); + const blender::IndexRange first_curve_points = curves.points_for_curve(0); + hair_rad_root = radii[first_curve_points.first()]; + hair_rad_tip = radii[first_curve_points.last()]; + } + DRW_shgroup_uniform_texture(shgrp, "hairPointBuffer", curves_cache->final[subdiv].proc_tex); if (curves_cache->length_tex) { DRW_shgroup_uniform_texture(shgrp, "hairLen", curves_cache->length_tex); _______________________________________________ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org List details, subscription details or unsubscribe: https://lists.blender.org/mailman/listinfo/bf-blender-cvs