Curves: support sculpting on deformed curves

Previously, curves sculpt tools only worked on original data. This was
very limiting, because one could effectively only sculpt the curves when
all procedural effects were turned off. This patch adds support for curves
sculpting while looking the result of procedural effects (like deformation
based on the surface mesh). This functionality is also known as "crazy space"
support in Blender.

For more details see D15407.

Differential Revision: https://developer.blender.org/D15407
This commit is contained in:
2022-07-22 15:39:41 +02:00
parent 98bf714b37
commit 1f94b56d77
51 changed files with 1647 additions and 759 deletions

View File

@@ -204,7 +204,8 @@ struct GatherTasks {
/* Volumes only have very simple support currently. Only the first found volume is put into the
* output. */
UserCounter<VolumeComponent> first_volume;
UserCounter<const VolumeComponent> first_volume;
UserCounter<const GeometryComponentEditData> first_edit_data;
};
/** Current offsets while during the gather operation. */
@@ -582,7 +583,16 @@ static void gather_realize_tasks_recursive(GatherTasksInfo &gather_info,
const VolumeComponent *volume_component = static_cast<const VolumeComponent *>(component);
if (!gather_info.r_tasks.first_volume) {
volume_component->user_add();
gather_info.r_tasks.first_volume = const_cast<VolumeComponent *>(volume_component);
gather_info.r_tasks.first_volume = volume_component;
}
break;
}
case GEO_COMPONENT_TYPE_EDIT: {
const GeometryComponentEditData *edit_component =
static_cast<const GeometryComponentEditData *>(component);
if (!gather_info.r_tasks.first_edit_data) {
edit_component->user_add();
gather_info.r_tasks.first_edit_data = edit_component;
}
break;
}
@@ -1405,6 +1415,9 @@ GeometrySet realize_instances(GeometrySet geometry_set, const RealizeInstancesOp
if (gather_info.r_tasks.first_volume) {
new_geometry_set.add(*gather_info.r_tasks.first_volume);
}
if (gather_info.r_tasks.first_edit_data) {
new_geometry_set.add(*gather_info.r_tasks.first_edit_data);
}
return new_geometry_set;
}