99namespace ed::sculpt_paint::undo {
199 bool applied_ =
true;
311 constexpr int zstd_level = 3;
313 const size_t dst_size = ZSTD_compress(compress_buffer.
data(),
314 compress_buffer.
size(),
315 filter_buffer.
data(),
316 filter_buffer.
size(),
318 if (ZSTD_isError(dst_size)) {
319 compress_buffer.
clear();
323 compress_buffer.
resize(dst_size);
330 const unsigned long long dst_size_in_bytes = ZSTD_getFrameContentSize(src.
data(), src.
size());
331 if (
ELEM(dst_size_in_bytes, ZSTD_CONTENTSIZE_ERROR, ZSTD_CONTENTSIZE_UNKNOWN)) {
336 buffer.
resize(dst_size_in_bytes);
338 if (ZSTD_isError(
result)) {
378 this->multires_undo = step_data.
grids.grids_num != 0;
381 for (
const int i : this->nodes_to_compress.
index_range()) {
382 this->unique_verts_nums[i] = this->nodes_to_compress[i]->unique_verts_num;
387 this->compression_started =
true;
414 const int nodes_num =
nodes.size();
418 struct CompressLocalData {
425 CompressLocalData &local_data = all_tls.
local();
426 for (
const int i : range) {
429 nodes[i]->orig_position :
434 new (&compressed_data[i])
Array<std::byte>(local_data.compressed.as_span());
439 data->nodes_to_compress.clear_and_shrink();
441 size_t memory_size = 0;
444 memory_size += compressed_data[i].
as_span().size_in_bytes();
448 data->compressed_positions = std::move(compressed_data);
449 data->owner_step_data->undo_size += memory_size;
451 data->compression_ready.store(
true, std::memory_order_release);
511 return mesh.verts_num == step_data.
mesh.verts_num;
516 return std::any_of(indices.
begin(), indices.
end(), [&](
const int i) { return data[i]; });
520 Depsgraph &depsgraph,
553 std::swap(full[i], indexed[indices[i]]);
579 LocalData &tls = all_tls.
local();
580 for (
const int i : range) {
584 const Span<int> verts = tls.indices.as_span().take_front(unique_verts_num);
588 MutableSpan undo_positions = tls.positions.as_mutable_span();
600 if (shape_key_data) {
603 if (!shape_key_data->dependent_keys.is_empty()) {
606 undo_positions.
take_front(unique_verts_num), verts, active_data, translations);
612 if (shape_key_data->basis_key_active) {
648 LocalData &tls = all_tls.
local();
649 for (
const int i : range) {
652 const Span<int> grids = tls.indices.as_span();
656 MutableSpan node_positions = tls.positions.as_mutable_span();
661 for (
const int offset :
data.index_range()) {
662 std::swap(
data[offset], undo_data[offset]);
687 hide_vert.
span[vert] = !hide_vert.
span[vert];
688 modified_verts[vert] =
true;
711 const bool value_a = a[j];
712 const bool value_b =
b[j];
733 for (
const int i : face_indices.index_range()) {
734 const int face = face_indices[i];
737 hide_poly.
span[face] = !hide_poly.
span[face];
738 modified_faces[face] =
true;
752 for (std::unique_ptr<Node> &unode : step_data.
nodes) {
755 unode->vert_indices.as_span().take_front(unode->unique_verts_num),
756 color_attribute.
span,
763 modified_verts.
fill_indices(unode->vert_indices.as_span(),
true);
780 for (
const int i :
index.index_range()) {
781 const int vert =
index[i];
782 if (
mask.span[vert] != unode.
mask[i]) {
783 std::swap(
mask.span[vert], unode.
mask[i]);
784 modified_verts[vert] =
true;
806 for (
const int offset :
data.index_range()) {
807 std::swap(
data[offset], undo_data[offset]);
822 *id_cast<Mesh *>(
object.
data));
823 bool modified =
false;
825 const int face = face_indices[i];
830 modified_face_set_faces[face] =
true;
854 pbvh.tag_masks_changed(node_mask);
929 geometry->attribute_storage =
mesh->attribute_storage.wrap();
939 mesh->runtime->face_offsets_sharing_info,
941 &
geometry->face_offsets_sharing_info);
960 mesh->totface_legacy = 0;
962 mesh->attribute_storage.wrap() =
geometry->attribute_storage.wrap();
972 geometry->face_offsets_sharing_info,
973 &
mesh->face_offset_indices,
974 &
mesh->runtime->face_offsets_sharing_info);
985 &
geometry->face_offsets_sharing_info);
1013 switch (step_data.
type) {
1107 "Undo step type and sculpt geometry type do not match: skipping undo state restore");
1115 switch (step_data.
type) {
1134 Array<bool> modified_grids(subdiv_ccg.grids_num,
false);
1143 pbvh.tag_positions_changed(changed_nodes);
1151 const Mesh &
mesh = *id_cast<const Mesh *>(
object.
data);
1162 pbvh.tag_positions_changed(changed_nodes);
1167 mesh.tag_positions_changed();
1175 mesh.runtime->corner_normals_cache.tag_dirty();
1177 pbvh.update_bounds(*depsgraph,
object);
1193 Array<bool> modified_grids(subdiv_ccg.grids_num,
false);
1194 for (std::unique_ptr<Node> &unode : step_data.
nodes) {
1202 pbvh.tag_visibility_changed(changed_nodes);
1206 const Mesh &
mesh = *id_cast<const Mesh *>(
object.
data);
1208 for (std::unique_ptr<Node> &unode : step_data.
nodes) {
1218 pbvh.tag_visibility_changed(changed_nodes);
1222 pbvh.update_visibility(
object);
1237 const Mesh &
mesh = *id_cast<const Mesh *>(
object.
data);
1239 for (std::unique_ptr<Node> &unode : step_data.
nodes) {
1252 subdiv_ccg,
nodes[i], faces_vector);
1256 pbvh.tag_visibility_changed(changed_nodes);
1265 pbvh.tag_visibility_changed(changed_nodes);
1269 pbvh.update_visibility(
object);
1284 for (std::unique_ptr<Node> &unode : step_data.
nodes) {
1293 pbvh.tag_masks_changed(changed_nodes);
1297 const Mesh &
mesh = *id_cast<const Mesh *>(
object.
data);
1299 for (std::unique_ptr<Node> &unode : step_data.
nodes) {
1310 pbvh.tag_masks_changed(changed_nodes);
1323 const Mesh &
mesh = *id_cast<const Mesh *>(
object.
data);
1325 for (std::unique_ptr<Node> &unode : step_data.
nodes) {
1337 subdiv_ccg,
nodes[i], faces_vector);
1341 pbvh.tag_face_sets_changed(changed_nodes);
1350 pbvh.tag_face_sets_changed(changed_nodes);
1365 const Mesh &
mesh = *id_cast<const Mesh *>(
object.
data);
1373 pbvh.tag_attribute_changed(changed_nodes,
mesh.active_color_attribute);
1404 if (step_data.
bmesh.bm_entry) {
1407 step_data.~StepData();
1422 if (step_data->
type != type) {
1432 return node_ptr->get();
1448 unode.
grid_hidden[i].copy_from(grid_hidden[grid_indices[i]]);
1461 unode.
normal.as_mutable_span());
1464 const Mesh &
mesh = *id_cast<const Mesh *>(
object.
data);
1468 mesh.vert_positions();
1520 if (
mask.is_empty()) {
1552 unode.
col.reinitialize(verts.
size());
1554 faces, corner_verts, vert_to_face_map, colors, color_attribute.
domain, verts, unode.
col);
1557 for (
const int face :
node.faces()) {
1558 for (
const int corner : faces[face]) {
1624 unode.
position.reinitialize(verts_num);
1626 unode.
normal.reinitialize(verts_num);
1675 const Mesh &base_mesh = *id_cast<const Mesh *>(
object.
data);
1681 const int verts_num = unode.
grids.
size() * grid_area;
1692 unode.
position.reinitialize(verts_num);
1694 unode.
normal.reinitialize(verts_num);
1746 if (step_data->
nodes.is_empty()) {
1751 step_data->
nodes.append(std::make_unique<Node>());
1753 step_data->
type = type;
1833 std::unique_ptr<Node> new_unode = std::make_unique<Node>();
1854 step_data->
type = type;
1865 switch (
pbvh.type()) {
1898 step_data->
type = type;
1900 switch (
pbvh.type()) {
1908 nodes_to_fill.append({&
nodes[i], unode});
1912 for (const auto &[node, unode] : nodes_to_fill.as_span().slice(range)) {
1913 fill_node_data_mesh(depsgraph, object, *node, type, *unode);
1925 nodes_to_fill.append({&
nodes[i], unode});
1929 for (const auto &[node, unode] : nodes_to_fill.as_span().slice(range)) {
1930 fill_node_data_grids(object, *node, type, *unode);
1946 attr->
domain = std::nullopt;
1951 const char *name =
mesh->active_color_attribute;
1956 const std::optional<bke::AttributeMetaData> meta_data = attributes.
lookup_meta_data(name);
1960 attr->
domain = meta_data->domain;
1962 attr->
type = meta_data->data_type;
2015 switch (
pbvh.type()) {
2057 size_t size =
sizeof(
Node);
2058 size +=
node.position.as_span().size_in_bytes();
2059 size +=
node.orig_position.as_span().size_in_bytes();
2060 size +=
node.normal.as_span().size_in_bytes();
2061 size +=
node.col.as_span().size_in_bytes();
2062 size +=
node.mask.as_span().size_in_bytes();
2063 size +=
node.loop_col.as_span().size_in_bytes();
2064 size +=
node.vert_indices.as_span().size_in_bytes();
2065 size +=
node.corner_indices.as_span().size_in_bytes();
2066 size +=
node.vert_hidden.size() / 8;
2067 size +=
node.face_hidden.size() / 8;
2068 size +=
node.grids.as_span().size_in_bytes();
2069 size +=
node.grid_hidden.all_bits().size() / 8;
2070 size +=
node.face_sets.as_span().size_in_bytes();
2071 size +=
node.face_indices.as_span().size_in_bytes();
2082 step_data->
nodes.append(std::move(
node));
2087 for (std::unique_ptr<Node> &unode : step_data->
nodes) {
2100 step_data->
nodes.index_range(),
2104 for (const int i : range) {
2105 size += node_size_in_bytes(*step_data->nodes[i]);
2109 std::plus<size_t>());
2114 if (
wm->op_undo_depth == 0 || use_nested_undo) {
2117 if (
wm->op_undo_depth == 0) {
2124 SculptUndoStep *us =
reinterpret_cast<SculptUndoStep *
>(
2127 save_active_attribute(ob, &us->active_color_end);
2162 if (attr.domain != attr_ref->
domain ||
2167 mesh->attributes_for_write(),
2179 mesh->attributes_for_write().add(
2234 Depsgraph *depsgraph,
2236 const bool is_final)
2248 while ((us_iter != us) || (!is_final && us_iter == us)) {
2254 if (us_iter == us) {
2279 if (us_iter == us) {
2392 size_t step_size = 0;
2412 if (
wm->op_undo_depth == 0) {
2415 if (
wm->op_undo_depth == 0) {
2465 const SculptSession *sculpt_session =
object->runtime->sculpt_session;
2511 return std::nullopt;
2522 return std::nullopt;
2525 result->normals.take_front(
node.verts().size())};
2533 return std::nullopt;
2544 for (
const BMVert *vert : verts) {
2563 return std::nullopt;
2565 return unode->
col.as_span();
2573 return std::nullopt;
2583 return std::nullopt;
2593 return std::nullopt;
2603 return std::nullopt;
CustomData interface, see also DNA_customdata_types.h.
General operations, lookup, etc. for blender objects.
#define BKE_undosys_stack_limit_steps_and_memory_defaults(ustack)
#define SCOPED_TIMER_AVERAGED(name)
#define CLOG_WARN(clg_ref,...)
#define ID_REAL_USERS(id)
Object is a sort of wrapper for general info.
#define PRF_scope(category)
#define BLI_assert_unreachable()
Span< T > as_span() const
MutableSpan< T > as_mutable_span()
IndexRange index_range() const
void fill(const T &value) const
void reinitialize(const int64_t new_size)
static AttributeOwner from_id(ID *id)
static IndexMask from_predicate(const IndexMask &universe, LinearAllocator<> &memory, Fn &&predicate, exec_mode::Mode mode=exec_mode::parallel)
constexpr IndexRange()=default
constexpr IndexRange take_front(int64_t n) const
constexpr int64_t size() const
constexpr MutableSpan slice(const int64_t start, const int64_t size) const
constexpr bool is_empty() const
constexpr Span< T > as_span() const
constexpr void fill_indices(Span< IndexT > indices, const T &value) const
constexpr MutableSpan take_front(const int64_t n) const
constexpr int64_t size_in_bytes() const
constexpr const T * data() const
constexpr int64_t size() const
constexpr const T * end() const
constexpr IndexRange index_range() const
constexpr const T * begin() const
IndexRange index_range() const
void resize(const int64_t new_size)
Span< T > as_span() const
int64_t group_size() const
IndexRange index_range() const
bool contains(StringRef name) const
std::optional< AttributeMetaData > lookup_meta_data(StringRef name) const
GAttributeReader lookup(const StringRef name) const
GSpanAttributeWriter lookup_or_add_for_write_span(StringRef name, AttrDomain domain, AttrType data_type, const AttributeInit &initializer=AttributeInitDefaultValue())
NonMovable(NonMovable &&other)=delete
constexpr bool is_empty() const
void foreach_index(Fn &&fn, Mode mode=exec_mode::serial) const
VecBase< float, D > step(VecOp< float, D >, VecOp< float, D >) RET
void node_geometry(float3 orco_attr, KernelGlobals &kg, ShadingData &sd, float3 &position, float3 &normal, float3 &tangent, float3 &true_normal, float3 &incoming, float3 ¶metric, float &backfacing, float &pointiness, float &random_per_island)
IndexRange grid_range(const int grid_area, const int grid)
bool is_color_attribute(const AttributeMetaData &meta_data)
pbvh::Tree & pbvh_ensure(Depsgraph &depsgraph, Object &object)
pbvh::Tree * pbvh_get(Object &object)
void update_mask_bmesh(const BMesh &bm, const IndexMask &node_mask, Tree &pbvh)
void update_mask_mesh(const Mesh &mesh, const IndexMask &node_mask, Tree &pbvh)
IndexMask all_leaf_nodes(const Tree &pbvh, IndexMaskMemory &memory)
Span< float3 > vert_normals_eval(const Depsgraph &depsgraph, const Object &object_orig)
void update_mask_grids(const SubdivCCG &subdiv_ccg, const IndexMask &node_mask, Tree &pbvh)
void store_bounds_orig(Tree &pbvh)
Span< int > node_face_indices_calc_grids(const SubdivCCG &subdiv_ccg, const GridsNode &node, Vector< int > &faces)
Span< float3 > vert_positions_eval(const Depsgraph &depsgraph, const Object &object_orig)
bool eval_refine_from_mesh(Subdiv *subdiv, const Mesh *mesh, Span< float3 > coarse_vert_positions)
AttrType cpp_type_to_attribute_type(const CPPType &type)
bool convert_attribute(AttributeOwner &owner, bke::MutableAttributeAccessor attributes, const StringRef name, const bke::AttrDomain dst_domain, const bke::AttrType dst_type, ReportList *reports)
void mode_generic_exit(Main *bmain, Depsgraph *depsgraph, Scene *scene, Object *ob)
bke::GSpanAttributeWriter active_color_attribute_for_write(Mesh &mesh)
void gather_colors_vert(OffsetIndices< int > faces, Span< int > corner_verts, GroupedSpan< int > vert_to_face_map, GSpan color_attribute, bke::AttrDomain color_domain, Span< int > verts, MutableSpan< float4 > r_colors)
void gather_colors(GSpan color_attribute, Span< int > indices, MutableSpan< float4 > r_colors)
void swap_gathered_colors(Span< int > indices, GMutableSpan color_attribute, MutableSpan< float4 > r_colors)
bke::GAttributeReader active_color_attribute(const Mesh &mesh)
void disable(bContext *C, undo::StepData *undo_step)
bke::SpanAttributeWriter< int > ensure_face_sets_mesh(Mesh &mesh)
void sync_all_from_faces(Object &object)
void filter_decompress(const Span< std::byte > src, Vector< std::byte > &buffer, Vector< T > &dst)
template void filter_decompress< float3 >(Span< std::byte >, Vector< std::byte > &, Vector< float3 > &)
template void filter_decompress< int >(Span< std::byte >, Vector< std::byte > &, Vector< int > &)
template void filter_compress< float3 >(Span< float3 >, Vector< std::byte > &, Vector< std::byte > &)
void filter_compress(const Span< T > src, Vector< std::byte > &filter_buffer, Vector< std::byte > &compress_buffer)
static void save_active_attribute(Object &object, SculptAttrRef *attr)
void push_end(Object &ob)
bool has_bmesh_log_entry()
static void bmesh_enable(Object &object, const StepData &step_data)
void push_nodes(const Depsgraph &depsgraph, Object &object, const IndexMask &node_mask, const Type type)
static void store_vert_visibility_grids(const SubdivCCG &subdiv_ccg, const bke::pbvh::GridsNode &node, Node &unode)
static bool use_multires_mesh(bContext *C)
static void step_decode(bContext *C, Main *bmain, UndoStep *us_p, const eUndoStepDir dir, const bool is_final)
static void geometry_push(const Object &object)
static void store_positions_grids(const SubdivCCG &subdiv_ccg, Node &unode)
static BLI_NOINLINE void bmesh_push(const Object &object, const bke::pbvh::BMeshNode *node, Type type)
static void free_step_data(StepData &step_data)
void push_multires_mesh_begin(bContext *C, const char *str)
void push_multires_mesh_end(bContext *C, const char *str)
static void fill_node_data_mesh(const Depsgraph &depsgraph, const Object &object, const bke::pbvh::MeshNode &node, const Type type, Node &unode)
static size_t node_size_in_bytes(const Node &node)
static bool topology_matches(const StepData &step_data, const Object &object)
static SculptUndoStep * get_active_step()
static void store_face_visibility(const Mesh &mesh, Node &unode)
size_t step_memory_size_get(UndoStep *step)
static void refine_subdiv(Depsgraph *depsgraph, const SculptSession &ss, Object &object, bke::subdiv::Subdiv *subdiv)
static void bmesh_handle_dyntopo_end(bContext *C, StepData &step_data, Object &object)
static void restore_vert_visibility_mesh(Object &object, Node &unode, const MutableSpan< bool > modified_verts)
static void step_encode_init(bContext *, UndoStep *us_p)
static size_t estimate_geometry_step_size(const StepData &step_data)
static bool use_multires_undo(const StepData &step_data, const SculptSession &ss)
void push_begin_ex(const Scene &, Object &ob, const char *name)
static void step_decode_redo_impl(bContext *C, Depsgraph *depsgraph, SculptUndoStep *us)
static void restore_geometry_data(const NodeGeometry *geometry, Mesh *mesh)
void push_enter_sculpt_mode(const Scene &, Object &ob, const wmOperator *op)
static StepData * get_step_data()
static void store_vert_visibility_mesh(const Mesh &mesh, const bke::pbvh::Node &node, Node &unode)
static void store_mask_grids(const SubdivCCG &subdiv_ccg, Node &unode)
static NodeGeometry * geometry_get(StepData &step_data)
static void store_positions_mesh(const Depsgraph &depsgraph, const Object &object, Node &unode)
static void fill_node_data_grids(const Object &object, const bke::pbvh::GridsNode &node, const Type type, Node &unode)
static void geometry_free_data(NodeGeometry *geometry)
static void step_decode_undo(bContext *C, Depsgraph *depsgraph, SculptUndoStep *us, const bool is_final)
static void restore_hidden_face(Object &object, Node &unode, const MutableSpan< bool > modified_faces)
void geometry_begin_ex(const Scene &scene, Object &ob, const char *name)
static void restore_position_grids(const MutableSpan< float3 > positions, const CCGKey &key, PositionUndoStorage &undo_data, const MutableSpan< bool > modified_grids)
static void step_free(UndoStep *us_p)
void register_type(UndoType *ut)
static void restore_position_mesh(Object &object, PositionUndoStorage &undo_data, const MutableSpan< bool > modified_verts)
static const Node * get_node(const bke::pbvh::Node *node, const Type type)
static bool step_encode(bContext *, Main *bmain, UndoStep *us_p)
static void restore_vert_visibility_grids(SubdivCCG &subdiv_ccg, Node &unode, const MutableSpan< bool > modified_grids)
static bool indices_contain_true(const Span< bool > data, const Span< int > indices)
static void set_active_layer(bContext *C, const SculptAttrRef *attr_ref)
static Node * ensure_node(StepData &step_data, const bke::pbvh::Node &node, bool &r_new)
static void save_common_data(Object &ob, SculptUndoStep *us)
void geometry_begin(const Scene &scene, Object &ob, const wmOperator *op)
static void restore_mask_grids(Object &object, Node &unode, const MutableSpan< bool > modified_grids)
static void step_decode_undo_impl(bContext *C, Depsgraph *depsgraph, SculptUndoStep *us)
static void restore_list(bContext *C, Depsgraph *depsgraph, StepData &step_data)
void geometry_end(Object &ob)
static void step_decode_redo(bContext *C, Depsgraph *depsgraph, SculptUndoStep *us)
static void restore_color(Object &object, StepData &step_data, const MutableSpan< bool > modified_verts)
static void store_geometry_data(NodeGeometry *geometry, const Object &object)
static void store_mask_mesh(const Mesh &mesh, Node &unode)
static void bmesh_restore_generic(StepData &step_data, Object &object)
void push_node(const Depsgraph &depsgraph, const Object &object, const bke::pbvh::Node *node, const Type type)
static bool restore_active_shape_key(bContext &C, Depsgraph &depsgraph, const StepData &step_data, Object &object)
static void restore_mask_mesh(Object &object, Node &unode, const MutableSpan< bool > modified_verts)
static void store_color(const Mesh &mesh, const bke::pbvh::MeshNode &node, Node &unode)
void push_begin(const Scene &scene, Object &ob, const wmOperator *op)
void restore_from_bmesh_enter_geometry(const StepData &step_data, Mesh &mesh)
static void store_face_sets(const Mesh &mesh, Node &unode)
static bool restore_face_sets(Object &object, Node &unode, const MutableSpan< bool > modified_face_set_faces)
static int bmesh_restore(bContext *C, Depsgraph &depsgraph, StepData &step_data, Object &object)
static size_t calculate_node_geometry_allocated_size(const NodeGeometry &node_geometry)
void push_end_ex(Object &ob, const bool use_nested_undo)
static void swap_indexed_data(MutableSpan< T > full, const Span< int > indices, MutableSpan< T > indexed)
static void restore_geometry(StepData &step_data, Object &object)
static void bmesh_handle_dyntopo_begin(bContext *C, StepData &step_data, Object &object)
void object_sculpt_mode_enter(Main &bmain, Depsgraph &depsgraph, Scene &scene, Object &ob, bool force_dyntopo, ReportList *reports)
std::optional< Span< float > > orig_mask_data_lookup_grids(const Object &object, const bke::pbvh::GridsNode &node)
std::optional< Span< int > > orig_face_set_data_lookup_mesh(const Object &object, const bke::pbvh::MeshNode &node)
void gather_data_grids(const SubdivCCG &subdiv_ccg, Span< T > src, Span< int > grids, MutableSpan< T > node_data)
std::optional< OrigPositionData > orig_position_data_lookup_grids(const Object &object, const bke::pbvh::GridsNode &node)
void orig_position_data_gather_bmesh(const BMLog &bm_log, const Set< BMVert *, 0 > &verts, MutableSpan< float3 > positions, MutableSpan< float3 > normals)
void translations_from_new_positions(Span< float3 > new_positions, Span< int > verts, Span< float3 > old_positions, MutableSpan< float3 > translations)
std::optional< Span< float4 > > orig_color_data_lookup_mesh(const Object &object, const bke::pbvh::MeshNode &node)
void scatter_data_mesh(Span< T > src, Span< int > indices, MutableSpan< T > dst)
void apply_translations(Span< float3 > translations, Span< int > verts, MutableSpan< float3 > positions)
void gather_data_mesh(Span< T > src, Span< int > indices, MutableSpan< T > dst)
std::optional< Span< float > > orig_mask_data_lookup_mesh(const Object &object, const bke::pbvh::MeshNode &node)
std::optional< OrigPositionData > orig_position_data_lookup_mesh_all_verts(const Object &object, const bke::pbvh::MeshNode &node)
std::optional< OrigPositionData > orig_position_data_lookup_mesh(const Object &object, const bke::pbvh::MeshNode &node)
std::optional< Span< int > > orig_face_set_data_lookup_grids(const Object &object, const bke::pbvh::GridsNode &node)
constexpr ParallelGrainSize grain_size(int grain_size)
void copy_shared_pointer(T *src_ptr, const ImplicitSharingInfo *src_sharing_info, T **r_dst_ptr, const ImplicitSharingInfo **r_dst_sharing_info)
void free_shared_data(T **data, const ImplicitSharingInfo **sharing_info)
void parallel_for(const IndexRange range, const int64_t grain_size, const Function &function, const TaskSizeHints &size_hints=detail::TaskSizeHints_Static(1))
auto isolate_task(const Function &function)
Value parallel_reduce(IndexRange range, int64_t grain_size, const Value &identity, const Function &function, const Reduction &reduction)
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
Object * BKE_view_layer_active_object_get(const ViewLayer *view_layer)
void multires_mark_as_modified(Depsgraph *depsgraph, Object *object, MultiresModifiedFlags flags)
const Set< BMFace *, 0 > & BKE_pbvh_bmesh_node_faces(bke::pbvh::BMeshNode *node)
MultiresModifierData * BKE_sculpt_multires_active(const Scene *scene, Object *ob)
UndoStack * ED_undo_stack_get()
@ UNDOTYPE_FLAG_DECODE_ACTIVE_STEP
void BM_log_original_vert_data(BMLog *log, BMVert *v, const float **r_co, const float **r_no)
KeyBlock * BKE_keyblock_from_object(Object *ob)
KeyBlock * BKE_keyblock_find_name(Key *key, const char name[])
void BM_log_redo(BMesh *bm, BMLog *log)
void BM_log_all_added(BMesh *bm, BMLog *log)
void BKE_sculptsession_free_pbvh(Object &object)
ViewLayer * CTX_data_view_layer(const bContext *C)
BitGroupVector & BKE_subdiv_ccg_grid_hidden_ensure(SubdivCCG &subdiv_ccg)
void BKE_scene_graph_evaluated_ensure(Depsgraph *depsgraph, Main *bmain)
CCGKey BKE_subdiv_ccg_key_top_level(const SubdivCCG &subdiv_ccg)
void BKE_subdiv_ccg_grid_hidden_free(SubdivCCG &subdiv_ccg)
void filter_transpose_delta(const uint8_t *src, uint8_t *dst, size_t items_num, size_t item_size)
void multires_flush_sculpt_updates(Object *object)
Array< float3 > BKE_multires_create_deformed_base_mesh_vert_coords(Depsgraph *depsgraph, Object *object, MultiresModifierData *mmd)
void BLI_task_pool_work_and_wait(TaskPool *pool)
VecBase< float, 4 > float4
void BKE_pbvh_sync_visibility_from_verts(Object &object)
int BLI_findindex(const ListBase *listbase, const void *vlink) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
void BM_log_before_all_removed(BMesh *bm, BMLog *log)
void DEG_id_tag_update(ID *id, unsigned int flags)
BMesh const char void * data
@ MULTIRES_COORDS_MODIFIED
@ MULTIRES_HIDDEN_MODIFIED
Depsgraph * CTX_data_ensure_evaluated_depsgraph(const bContext *C, bool rna_write_check=false)
void ED_undo_push(bContext *C, const char *str, UndoEncodeHints hints=UndoEncodeHints(0))
UndoStep * BKE_undosys_stack_init_or_active_with_type(UndoStack *ustack, const UndoType *ut)
int CustomData_get_offset_named(const CustomData *data, eCustomDataType type, StringRef name)
BMLog * BM_log_from_existing_entries_create(BMesh *bm, BMLogEntry *entry)
const UndoType * BKE_UNDOSYS_TYPE_SCULPT
bool BKE_view_layer_synced_ensure(const Main &bmain, const Scene *scene, ViewLayer *view_layer)
const Set< BMVert *, 0 > & BKE_pbvh_bmesh_node_other_verts(bke::pbvh::BMeshNode *node)
const BMAllocTemplate bm_mesh_allocsize_default
RegionView3D * CTX_wm_region_view3d(const bContext *C)
@ ME_SCULPT_DYNAMIC_TOPOLOGY
void WM_event_add_notifier(const bContext *C, uint type, void *reference)
void BLI_task_pool_free(TaskPool *pool)
void BKE_sculptsession_free_deformMats(SculptSession *ss)
void BM_log_face_modified(BMLog *log, BMFace *f)
void CustomData_count_memory(const CustomData &data, int totelem, MemoryCounter &memory)
BMLogEntry * BM_log_entry_add(BMLog *log)
bool BKE_sculptsession_use_pbvh_draw(const Object *ob, const RegionView3D *rv3d)
void BM_log_undo(BMesh *bm, BMLog *log)
void WM_file_tag_modified()
Main * CTX_data_main(const bContext *C)
const CustomData_MeshMasks CD_MASK_MESH
void CustomData_free(CustomData *data)
void BKE_id_attributes_active_color_set(struct ID *id, std::optional< StringRef > name)
void BKE_sculptsession_update_for_edit(Depsgraph *depsgraph, Object *ob_orig, bool is_paint_tool)
void BM_data_layer_add_named(BMesh *bm, CustomData *data, int type, const StringRef name)
Scene * CTX_data_scene(const bContext *C)
Mesh * BKE_object_get_original_mesh(const Object *object)
VecBase< float, 3 > float3
Key * BKE_key_from_object(Object *ob)
BMesh * BM_mesh_create(const BMAllocTemplate *allocsize, const BMeshCreateParams *params)
BMesh Make Mesh.
Object * CTX_data_active_object(const bContext *C)
void unfilter_transpose_delta(const uint8_t *src, uint8_t *dst, size_t items_num, size_t item_size)
void BM_log_vert_before_modified(BMLog *log, BMVert *v, const int cd_vert_mask_offset)
void BLI_task_pool_push(TaskPool *pool, TaskRunFunction run, void *taskdata, bool free_taskdata, TaskFreeFunction freedata)
const Set< BMVert *, 0 > & BKE_pbvh_bmesh_node_unique_verts(bke::pbvh::BMeshNode *node)
void CustomData_init_from(const CustomData *source, CustomData *dest, eCustomDataMask mask, int totelem)
PaintMode BKE_paintmode_get_active_from_context(const bContext *C)
void BKE_mesh_clear_geometry(Mesh *mesh)
eUndoPushReturn BKE_undosys_step_push(UndoStack *ustack, bContext *C, const char *name, UndoEncodeHints hints)
void BM_mesh_normals_update(BMesh *bm)
void BM_log_entry_drop(BMLogEntry *entry)
void ED_undosys_stack_memfile_id_changed_tag(UndoStack *ustack, ID *id)
TaskPool * BLI_task_pool_create_background(void *userdata, eTaskPriority priority)
UndoStep * BKE_undosys_step_push_init_with_type(UndoStack *ustack, bContext *C, const char *name, const UndoType *ut)
ListBaseT< KeyBlock > block
bool is_memfile_undo_flush_needed
bke::ObjectRuntime * runtime
KeyBlock * shapekey_active
MultiresModifierData * multires_modifier
bool deform_modifiers_active
Array< float3 > positions
BitGroupVector grid_hidden
bool(*) poll(bContext *C)
void(*) step_free(UndoStep *us)
void(*) step_decode(bContext *C, Main *bmain, UndoStep *us, eUndoStepDir dir, bool is_final)
bool(*) step_encode(bContext *C, Main *bmain, UndoStep *us)
void(*) step_encode_init(bContext *C, UndoStep *us)
SculptSession * sculpt_session
MutableVArraySpan< T > span
static std::optional< ShapeKeyData > from_object(Object &object)
int * face_offset_indices
bke::AttributeStorage attribute_storage
const ImplicitSharingInfo * face_offsets_sharing_info
Array< float3, 0 > orig_position
Vector< int > face_indices
BitGroupVector< 0 > grid_hidden
Array< float3, 0 > normal
BitVector< 0 > face_hidden
Array< int, 0 > vert_indices
Array< float4, 0 > loop_col
Array< int, 0 > face_sets
BitVector< 0 > vert_hidden
Array< float3, 0 > position
Vector< int, 0 > corner_indices
std::atomic< bool > compression_ready
Array< Array< std::byte > > compressed_indices
TaskPool * compression_task_pool
void ensure_compression_complete()
Array< int > unique_verts_nums
std::atomic< bool > compression_started
static void compress_fn(TaskPool *, void *task_data)
StepData * owner_step_data
PositionUndoStorage(StepData &step_data)
Vector< std::unique_ptr< Node > > nodes_to_compress
Array< Array< std::byte > > compressed_positions
std::optional< bke::AttrDomain > domain
SculptAttrRef active_color_start
SculptAttrRef active_color_end
NodeGeometry geometry_enter
Vector< std::unique_ptr< Node > > nodes
struct blender::ed::sculpt_paint::undo::StepData::@215211107015304361034301322047137170060312277124 grids
struct blender::ed::sculpt_paint::undo::StepData::@122226043223236050374162026040070012345131255174 bmesh
struct blender::ed::sculpt_paint::undo::StepData::@304076261154065047305032143163302111343365002361 mesh
NodeGeometry geometry_original
std::unique_ptr< PositionUndoStorage > position_step_storage
std::string active_shape_key_name
Map< const bke::pbvh::Node *, std::unique_ptr< Node > > undo_nodes_by_pbvh_node
NodeGeometry geometry_modified
struct wmOperatorType * type