CurvesGeometry: Add initial vertex group support #106944
@ -25,6 +25,8 @@
|
||||
#include "BKE_attribute_math.hh"
|
||||
#include "BKE_curves.h"
|
||||
|
||||
#include "DNA_meshdata_types.h"
|
||||
filedescriptor marked this conversation as resolved
Outdated
|
||||
|
||||
namespace blender::bke {
|
||||
|
||||
namespace curves::nurbs {
|
||||
@ -257,6 +259,13 @@ class CurvesGeometry : public ::CurvesGeometry {
|
||||
Span<float2> surface_uv_coords() const;
|
||||
MutableSpan<float2> surface_uv_coords_for_write();
|
||||
|
||||
/**
|
||||
* Vertex group data, encoded as an array of indices and weights for every vertex.
|
||||
* \warning: May be empty.
|
||||
*/
|
||||
Span<MDeformVert> deform_verts() const;
|
||||
MutableSpan<MDeformVert> deform_verts_for_write();
|
||||
|
||||
/**
|
||||
* The largest and smallest position values of evaluated points.
|
||||
*/
|
||||
|
@ -458,6 +458,28 @@ MutableSpan<float2> CurvesGeometry::surface_uv_coords_for_write()
|
||||
return get_mutable_attribute<float2>(*this, ATTR_DOMAIN_CURVE, ATTR_SURFACE_UV_COORDINATE);
|
||||
}
|
||||
|
||||
Span<MDeformVert> CurvesGeometry::deform_verts() const
|
||||
{
|
||||
const MDeformVert *dverts = (const MDeformVert *)CustomData_get_layer(&this->point_data,
|
||||
CD_MDEFORMVERT);
|
||||
if (dverts == nullptr) {
|
||||
return {};
|
||||
}
|
||||
return {dverts, this->point_num};
|
||||
}
|
||||
|
||||
MutableSpan<MDeformVert> CurvesGeometry::deform_verts_for_write()
|
||||
{
|
||||
MDeformVert *dvert = (MDeformVert *)CustomData_get_layer_for_write(
|
||||
&this->point_data, CD_MDEFORMVERT, this->point_num);
|
||||
if (dvert != nullptr) {
|
||||
return {dvert, this->point_num};
|
||||
}
|
||||
return {(MDeformVert *)CustomData_add_layer(
|
||||
&this->point_data, CD_MDEFORMVERT, CD_SET_DEFAULT, this->point_num),
|
||||
this->point_num};
|
||||
}
|
||||
|
||||
/** \} */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
|
@ -10,7 +10,9 @@
|
||||
|
||||
#include "DNA_ID.h"
|
||||
#include "DNA_customdata_types.h"
|
||||
#include "DNA_object_types.h"
|
||||
|
||||
#include "BLI_listbase.h"
|
||||
#include "BLI_utildefines.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
@ -132,6 +134,14 @@ typedef struct CurvesGeometry {
|
||||
*/
|
||||
int curve_num;
|
||||
|
||||
/**
|
||||
* List of vertex group (#bDeformGroup) names and flags only.
|
||||
*/
|
||||
ListBase vertex_group_names;
|
||||
/** The active index in the #vertex_group_names list. */
|
||||
int vertex_group_active_index;
|
||||
char _pad[4];
|
||||
|
||||
/**
|
||||
* Runtime data for curves, stored as a pointer to allow defining this as a C++ class.
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user
Does it work to forward declare
MDeformVert
? It would be nice not to includeDNA_meshdata_types.h
in the curves header.