33namespace ed::pointcloud {
70 for (const int i : range) {
71 Object *ob = objects[i];
72 StepObject &object = us->objects[i];
73 const PointCloud &pointcloud = *id_cast<const PointCloud *>(ob->data);
74 object.obedit_ref.ptr = ob;
75 object.attribute_storage.wrap() = pointcloud.attribute_storage.wrap();
76 object.bounds_cache = pointcloud.runtime->bounds_cache;
77 object.bounds_with_radius_cache = pointcloud.runtime->bounds_with_radius_cache;
78 object.totpoint = pointcloud.totpoint;
82 bmain->is_memfile_undo_flush_needed =
true;
98 &us->
objects.first().obedit_ref.ptr,
100 sizeof(
decltype(us->
objects)::value_type));
107 const bool positions_changed = [&]() {
109 const bke::Attribute *attr_b =
object.attribute_storage.wrap().lookup(
"position");
110 if (!attr_b && !attr_a) {
113 if (!attr_a || !attr_b) {
116 return std::get<bke::Attribute::ArrayData>(attr_a->
data()).
data !=
117 std::get<bke::Attribute::ArrayData>(attr_b->
data()).data;
120 pointcloud.attribute_storage.wrap() =
object.attribute_storage.wrap();
123 pointcloud.runtime->bounds_cache =
object.bounds_cache;
124 pointcloud.runtime->bounds_with_radius_cache =
object.bounds_with_radius_cache;
125 if (positions_changed) {
132 *bmain, scene, view_layer, us->
objects.first().obedit_ref.ptr, us_p->
name, &
LOG);
155 (
reinterpret_cast<UndoRefID *
>(
const_cast<UndoRefID_Object *
>(&
object.obedit_ref))));
General operations, lookup, etc. for blender objects.
General operations for point clouds.
const DataVariant & data() const
static void foreach_ID_ref(UndoStep *us_p, UndoTypeForEachIDRefFn foreach_ID_ref_fn, void *user_data)
static void step_free(UndoStep *us_p)
static bool step_encode(bContext *C, Main *bmain, UndoStep *us_p)
static void step_decode(bContext *C, Main *bmain, UndoStep *us_p, const eUndoStepDir, bool)
bool editable_pointcloud_in_edit_mode_poll(bContext *C)
void undosys_type_register(UndoType *ut)
void parallel_for(const IndexRange range, const int64_t grain_size, const Function &function, const TaskSizeHints &size_hints=detail::TaskSizeHints_Static(1))
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
@ UNDOTYPE_FLAG_NEED_CONTEXT_FOR_ENCODE
@ UNDOTYPE_FLAG_ENCODE_PRE_MEMFILE_SUPPORTED
void ED_undo_object_set_active_or_warn(const Main &bmain, Scene *scene, ViewLayer *view_layer, Object *ob, const char *info, CLG_LogRef *log)
Vector< Object * > ED_undo_editmode_objects_from_view_layer(const Main &bmain, const Scene *scene, ViewLayer *view_layer)
ViewLayer * CTX_data_view_layer(const bContext *C)
void DEG_id_tag_update(ID *id, unsigned int flags)
wmWindowManager * CTX_wm_manager(const bContext *C)
void WM_event_add_notifier(const bContext *C, uint type, void *reference)
bool BKE_object_is_in_editmode(const Object *ob)
void ED_undo_object_editmode_restore_helper(Scene *scene, ViewLayer *view_layer, Object **object_array, uint object_array_len, uint object_array_stride)
void(*)(void *user_data, UndoRefID *id_ref) UndoTypeForEachIDRefFn
Scene * CTX_data_scene(const bContext *C)
void ED_undo_object_editmode_validate_scene_from_windows(wmWindowManager *wm, const Scene *scene_ref, Scene **scene_p, ViewLayer **view_layer_p)
bool is_memfile_undo_flush_needed
bool(*) poll(bContext *C)
void(*) step_free(UndoStep *us)
void(*) step_decode(bContext *C, Main *bmain, UndoStep *us, eUndoStepDir dir, bool is_final)
void(*) step_foreach_ID_ref(UndoStep *us, UndoTypeForEachIDRefFn foreach_ID_ref_fn, void *user_data)
bool(*) step_encode(bContext *C, Main *bmain, UndoStep *us)
Array< StepObject > objects
UndoRefID_Scene scene_ref
bke::AttributeStorage attribute_storage
SharedCache< Bounds< float3 > > bounds_with_radius_cache
SharedCache< Bounds< float3 > > bounds_cache
UndoRefID_Object obedit_ref