59 for (
int i = 0; i < edit->
totpoint; i++, pa++) {
69 pm =
undo->mem_cache.first();
71 for (; pm; pm = pm->
next) {
78 point =
undo->points = MEM_dupalloc(edit->
points);
81 for (
int i = 0; i < edit->
totpoint; i++, point++) {
82 point->
keys = MEM_dupalloc(point->
keys);
88 undo->undo_size = mem_used_prev < mem_used_curr ? mem_used_curr - mem_used_prev :
106 MEM_delete(point->keys);
121 point->keys = MEM_dupalloc(point->keys);
131 hkey = pa->
hair = MEM_dupalloc(pa->
hair);
135 key->time = &hkey->
time;
152 for (; pm; pm = pm->
next) {
161 if (
int(key->ftime) ==
int(pm->
frame)) {
165 key->time = &key->ftime;
179 for (i = 0, point =
undo->points; i < undo->totpoint; i++, point++) {
180 if (
undo->particles && (
undo->particles + i)->hair) {
181 MEM_delete((
undo->particles + i)->hair);
184 MEM_delete(point->
keys);
188 MEM_delete(
undo->points);
190 if (
undo->particles) {
191 MEM_delete(
undo->particles);
220 return (edit !=
nullptr);
262 if (edit ==
nullptr) [[unlikely]] {
Read Blender memory allocation and freeing.
void mode_generic_exit(Main *bmain, Depsgraph *depsgraph, Scene *scene, Object *ob)
void psys_free_path_cache(struct ParticleSystem *psys, struct PTCacheEdit *edit)
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
Object * BKE_view_layer_active_object_get(const ViewLayer *view_layer)
void BKE_particle_batch_cache_dirty_tag(struct ParticleSystem *psys, int mode)
@ UNDOTYPE_FLAG_NEED_CONTEXT_FOR_ENCODE
@ UNDOTYPE_FLAG_ENCODE_PRE_MEMFILE_SUPPORTED
void void void void void void BLI_duplicatelist(ListBase *dst, const ListBase *src) ATTR_NONNULL(1
Depsgraph * CTX_data_depsgraph_pointer(const bContext *C)
void ED_undo_object_set_active_or_warn(const Main &bmain, Scene *scene, ViewLayer *view_layer, Object *ob, const char *info, CLG_LogRef *log)
static bool particle_undosys_step_encode(bContext *C, Main *bmain, UndoStep *us_p)
ViewLayer * CTX_data_view_layer(const bContext *C)
size_t(*) MEM_get_memory_in_use()
void BKE_ptcache_mem_pointers_incr(void *cur[BPHYS_TOT_DATA])
void * MEM_dupalloc_void(const void *vmemh) ATTR_WARN_UNUSED_RESULT
PTCacheEdit * PE_get_current(Depsgraph *depsgraph, Scene *scene, Object *ob)
void DEG_id_tag_update(ID *id, unsigned int flags)
wmWindowManager * CTX_wm_manager(const bContext *C)
bool BKE_view_layer_synced_ensure(const Main &bmain, const Scene *scene, ViewLayer *view_layer)
static bool particle_undosys_poll(bContext *C)
static void undoptcache_free_data(PTCacheUndo *undo)
void BKE_ptcache_free_mem(ListBaseT< PTCacheMem > *mem_cache)
static void particle_undosys_foreach_ID_ref(UndoStep *us_p, UndoTypeForEachIDRefFn foreach_ID_ref_fn, void *user_data)
Main * CTX_data_main(const bContext *C)
void(*)(void *user_data, UndoRefID *id_ref) UndoTypeForEachIDRefFn
Scene * CTX_data_scene(const bContext *C)
static void particle_undosys_step_free(UndoStep *us_p)
static void undoptcache_to_editcache(PTCacheUndo *undo, PTCacheEdit *edit)
static void particle_undosys_step_decode(bContext *C, Main *bmain, UndoStep *us_p, const eUndoStepDir, bool)
static void undoptcache_from_editcache(PTCacheUndo *undo, PTCacheEdit *edit)
void ED_object_particle_edit_mode_enter_ex(Depsgraph *depsgraph, Scene *scene, Object *ob)
void BKE_ptcache_mem_pointers_init(struct PTCacheMem *pm, void *cur[BPHYS_TOT_DATA])
void ED_undo_object_editmode_validate_scene_from_windows(wmWindowManager *wm, const Scene *scene_ref, Scene **scene_p, ViewLayer **view_layer_p)
@ BKE_PARTICLE_BATCH_DIRTY_ALL
void ED_particle_undosys_type(UndoType *ut)
struct PTCacheEditKey * keys
PTCacheEditPoint * points
struct ParticleSystem * psys
struct PointCache * cache
eParticleSystem_Flag flag
UndoRefID_Object object_ref
UndoRefID_Scene scene_ref
ListBaseT< PTCacheMem > mem_cache
struct ToolSettings * toolsettings
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)