Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source/blender/draw/intern/draw_curves.cc18
1 files changed, 18 insertions, 0 deletions
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);