Fix #119886: Set curve node missing normals update tag
The change to use generic "capture field on geometry" utilities for this
node and other nodes like it means `AttributeWriter` with its update
tagging isn't being used anymore, the attribute is just being created
with the new values (for some cases anyway). To fix this, call the
attribute provider's update function when creating the attribute too.
This was noted as useful in 130701763b
too.
The initialization of curve and point cloud runtime structs is moved
because they now have to be allocated before any attributes are added.
This commit is contained in:
parent
2c301c921f
commit
73cc27b988
|
@ -510,22 +510,38 @@ bool BuiltinCustomDataLayerProvider::try_create(void *owner,
|
|||
return false;
|
||||
}
|
||||
|
||||
auto update = [&]() {
|
||||
if (update_on_change_ != nullptr) {
|
||||
update_on_change_(owner);
|
||||
}
|
||||
};
|
||||
|
||||
const int element_num = custom_data_access_.get_element_num(owner);
|
||||
if (stored_as_named_attribute_) {
|
||||
if (CustomData_has_layer_named(custom_data, data_type_, name_)) {
|
||||
/* Exists already. */
|
||||
return false;
|
||||
}
|
||||
return add_custom_data_layer_from_attribute_init(
|
||||
name_, *custom_data, stored_type_, element_num, initializer);
|
||||
if (add_custom_data_layer_from_attribute_init(
|
||||
name_, *custom_data, stored_type_, element_num, initializer))
|
||||
{
|
||||
update();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
if (CustomData_get_layer(custom_data, stored_type_) != nullptr) {
|
||||
/* Exists already. */
|
||||
return false;
|
||||
}
|
||||
return add_builtin_type_custom_data_layer_from_init(
|
||||
*custom_data, stored_type_, element_num, initializer);
|
||||
if (add_builtin_type_custom_data_layer_from_init(
|
||||
*custom_data, stored_type_, element_num, initializer))
|
||||
{
|
||||
update();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool BuiltinCustomDataLayerProvider::exists(const void *owner) const
|
||||
|
|
|
@ -58,6 +58,8 @@ CurvesGeometry::CurvesGeometry() : CurvesGeometry(0, 0) {}
|
|||
|
||||
CurvesGeometry::CurvesGeometry(const int point_num, const int curve_num)
|
||||
{
|
||||
this->runtime = MEM_new<CurvesGeometryRuntime>(__func__);
|
||||
|
||||
this->point_num = point_num;
|
||||
this->curve_num = curve_num;
|
||||
CustomData_reset(&this->point_data);
|
||||
|
@ -67,8 +69,6 @@ CurvesGeometry::CurvesGeometry(const int point_num, const int curve_num)
|
|||
this->attributes_for_write().add<float3>(
|
||||
"position", AttrDomain::Point, AttributeInitConstruct());
|
||||
|
||||
this->runtime = MEM_new<CurvesGeometryRuntime>(__func__);
|
||||
|
||||
if (curve_num > 0) {
|
||||
this->curve_offsets = static_cast<int *>(
|
||||
MEM_malloc_arrayN(this->curve_num + 1, sizeof(int), __func__));
|
||||
|
|
|
@ -62,11 +62,11 @@ static void pointcloud_init_data(ID *id)
|
|||
|
||||
MEMCPY_STRUCT_AFTER(pointcloud, DNA_struct_default_get(PointCloud), id);
|
||||
|
||||
pointcloud->runtime = new blender::bke::PointCloudRuntime();
|
||||
|
||||
CustomData_reset(&pointcloud->pdata);
|
||||
pointcloud->attributes_for_write().add<float3>(
|
||||
"position", blender::bke::AttrDomain::Point, blender::bke::AttributeInitConstruct());
|
||||
|
||||
pointcloud->runtime = new blender::bke::PointCloudRuntime();
|
||||
}
|
||||
|
||||
static void pointcloud_copy_data(Main * /*bmain*/,
|
||||
|
|
Loading…
Reference in New Issue