|
Blender
V2.93
|
#include "MEM_guardedalloc.h"#include "CLG_log.h"#include "DNA_key_types.h"#include "DNA_layer_types.h"#include "DNA_mesh_types.h"#include "DNA_meshdata_types.h"#include "DNA_object_types.h"#include "DNA_scene_types.h"#include "BLI_array_utils.h"#include "BLI_listbase.h"#include "BKE_context.h"#include "BKE_editmesh.h"#include "BKE_key.h"#include "BKE_layer.h"#include "BKE_lib_id.h"#include "BKE_main.h"#include "BKE_mesh.h"#include "BKE_object.h"#include "BKE_undo_system.h"#include "DEG_depsgraph.h"#include "ED_mesh.h"#include "ED_object.h"#include "ED_undo.h"#include "ED_util.h"#include "WM_api.h"#include "WM_types.h"#include "BLI_array_store.h"#include "BLI_array_store_utils.h"#include "BLI_task.h"Go to the source code of this file.
Classes | |
| struct | BArrayCustomData |
| struct | UndoMesh |
| struct | UMArrayData |
| struct | MeshUndoStep_Elem |
| struct | MeshUndoStep |
Macros | |
| #define | USE_ARRAY_STORE |
| #define | ARRAY_CHUNK_SIZE 256 |
| #define | USE_ARRAY_STORE_THREAD |
Typedefs | |
Undo Conversion | |
| typedef struct BArrayCustomData | BArrayCustomData |
| typedef struct UndoMesh | UndoMesh |
Functions | |
| static void * | undomesh_from_editmesh (UndoMesh *um, BMEditMesh *em, Key *key) |
| static void | undomesh_to_editmesh (UndoMesh *um, Object *ob, BMEditMesh *em, Key *key) |
| static void | undomesh_free_data (UndoMesh *um) |
| static Object * | editmesh_object_from_context (bContext *C) |
Variables | |
| static CLG_LogRef | LOG = {"ed.undo.mesh"} |
Implements ED Undo System | |
| |
| typedef struct MeshUndoStep_Elem | MeshUndoStep_Elem |
| typedef struct MeshUndoStep | MeshUndoStep |
| static bool | mesh_undosys_poll (bContext *C) |
| static bool | mesh_undosys_step_encode (struct bContext *C, struct Main *bmain, UndoStep *us_p) |
| static void | mesh_undosys_step_decode (struct bContext *C, struct Main *bmain, UndoStep *us_p, const eUndoStepDir UNUSED(dir), bool UNUSED(is_final)) |
| static void | mesh_undosys_step_free (UndoStep *us_p) |
| static void | mesh_undosys_foreach_ID_ref (UndoStep *us_p, UndoTypeForEachIDRefFn foreach_ID_ref_fn, void *user_data) |
| void | ED_mesh_undosys_type (UndoType *ut) |
Array Store | |
| struct { | |
| struct BArrayStore_AtSize bs_stride | |
| int users | |
| ListBase local_links | |
| TaskPool * task_pool | |
| } | um_arraystore = {{NULL}} |
| static void | um_arraystore_cd_compact (struct CustomData *cdata, const size_t data_len, bool create, const BArrayCustomData *bcd_reference, BArrayCustomData **r_bcd_first) |
| static void | um_arraystore_cd_expand (const BArrayCustomData *bcd, struct CustomData *cdata, const size_t data_len) |
| static void | um_arraystore_cd_free (BArrayCustomData *bcd) |
| static void | um_arraystore_compact_ex (UndoMesh *um, const UndoMesh *um_ref, bool create) |
| static void | um_arraystore_compact (UndoMesh *um, const UndoMesh *um_ref) |
| static void | um_arraystore_compact_with_info (UndoMesh *um, const UndoMesh *um_ref) |
| static void | um_arraystore_compact_cb (TaskPool *__restrict UNUSED(pool), void *taskdata) |
| static void | um_arraystore_expand_clear (UndoMesh *um) |
| static void | um_arraystore_expand (UndoMesh *um) |
| static void | um_arraystore_free (UndoMesh *um) |
| #define ARRAY_CHUNK_SIZE 256 |
Definition at line 67 of file editmesh_undo.c.
| #define USE_ARRAY_STORE |
Definition at line 55 of file editmesh_undo.c.
| #define USE_ARRAY_STORE_THREAD |
Definition at line 69 of file editmesh_undo.c.
| typedef struct BArrayCustomData BArrayCustomData |
| typedef struct MeshUndoStep MeshUndoStep |
| typedef struct MeshUndoStep_Elem MeshUndoStep_Elem |
| void ED_mesh_undosys_type | ( | UndoType * | ut | ) |
Definition at line 840 of file editmesh_undo.c.
References UndoType::flags, mesh_undosys_foreach_ID_ref(), mesh_undosys_poll(), mesh_undosys_step_decode(), mesh_undosys_step_encode(), mesh_undosys_step_free(), UndoType::name, UndoType::poll, UndoType::step_decode, UndoType::step_encode, UndoType::step_foreach_ID_ref, UndoType::step_free, UndoType::step_size, and UNDOTYPE_FLAG_NEED_CONTEXT_FOR_ENCODE.
Referenced by ED_undosys_type_init().
Definition at line 701 of file editmesh_undo.c.
References C, CTX_data_view_layer(), Object::data, Mesh::edit_mesh, NULL, OB_MESH, OBEDIT_FROM_VIEW_LAYER, and Object::type.
Referenced by mesh_undosys_poll().
|
static |
Definition at line 827 of file editmesh_undo.c.
References MeshUndoStep::elems, MeshUndoStep::elems_len, MeshUndoStep_Elem::obedit_ref, and user_data.
Referenced by ED_mesh_undosys_type().
|
static |
Definition at line 734 of file editmesh_undo.c.
References C, editmesh_object_from_context(), and NULL.
Referenced by ED_mesh_undosys_type(), and mesh_undosys_step_decode().
|
static |
Definition at line 770 of file editmesh_undo.c.
References BKE_object_is_in_editmode(), BLI_assert, C, CLOG_ERROR, CTX_data_scene(), CTX_data_view_layer(), MeshUndoStep_Elem::data, Object::data, DEG_id_tag_update(), ED_undo_object_editmode_restore_helper(), ED_undo_object_set_active_or_warn(), Mesh::edit_mesh, MeshUndoStep::elems, MeshUndoStep::elems_len, Object::id, ID_RECALC_GEOMETRY, Main::is_memfile_undo_flush_needed, Mesh::key, LOG, mesh_undosys_poll(), UndoStep::name, ID::name, NC_GEOM, ND_DATA, BMEditMesh::needs_flush_to_id, NULL, MeshUndoStep_Elem::obedit_ref, scene, UndoMesh::selectmode, ToolSettings::selectmode, Scene::toolsettings, undomesh_to_editmesh(), and WM_event_add_notifier().
Referenced by ED_mesh_undosys_type().
|
static |
Definition at line 739 of file editmesh_undo.c.
References C, CTX_data_view_layer(), MeshUndoStep_Elem::data, UndoStep::data_size, ED_undo_editmode_objects_from_view_layer(), Mesh::edit_mesh, MeshUndoStep::elems, MeshUndoStep::elems_len, Main::is_memfile_undo_flush_needed, Mesh::key, MEM_callocN, MEM_freeN, BMEditMesh::needs_flush_to_id, MeshUndoStep_Elem::obedit_ref, MeshUndoStep::step, UndoMesh::undo_size, and undomesh_from_editmesh().
Referenced by ED_mesh_undosys_type().
|
static |
Definition at line 816 of file editmesh_undo.c.
References MeshUndoStep_Elem::data, MeshUndoStep::elems, MeshUndoStep::elems_len, MEM_freeN, and undomesh_free_data().
Referenced by ED_mesh_undosys_type().
|
static |
Definition at line 140 of file editmesh_undo.c.
References ARRAY_CHUNK_SIZE, BLI_array_store_at_size_ensure(), BLI_array_store_state_add(), CustomData_layertype_is_dynamic(), CustomData_sizeof(), CustomDataLayer::data, if(), CustomData::layers, MEM_callocN, MEM_freeN, BArrayCustomData::next, NULL, BArrayCustomData::states, BArrayCustomData::states_len, stride, CustomData::totlayer, BArrayCustomData::type, type, CustomDataLayer::type, and um_arraystore.
Referenced by um_arraystore_compact_ex().
|
static |
Definition at line 265 of file editmesh_undo.c.
References BLI_array_store_state_data_get_alloc(), BLI_assert, CustomData_sizeof(), CustomDataLayer::data, CustomData::layers, BArrayCustomData::next, NULL, BArrayCustomData::states, BArrayCustomData::states_len, stride, BArrayCustomData::type, CustomDataLayer::type, and UNUSED_VARS_NDEBUG.
Referenced by um_arraystore_expand().
|
static |
Definition at line 289 of file editmesh_undo.c.
References BLI_array_store_at_size_get(), BLI_array_store_state_remove(), CustomData_sizeof(), MEM_freeN, BArrayCustomData::next, BArrayCustomData::states, BArrayCustomData::states_len, stride, BArrayCustomData::type, and um_arraystore.
Referenced by um_arraystore_free().
Move data from allocated arrays to de-duplicated states and clear arrays.
Definition at line 374 of file editmesh_undo.c.
References um_arraystore_compact_ex().
Referenced by um_arraystore_compact_with_info().
|
static |
Definition at line 426 of file editmesh_undo.c.
References UMArrayData::um, um_arraystore_compact_with_info(), and UMArrayData::um_ref.
| create | When false, only free the arrays. This is done since when reading from an undo state, they must be temporarily expanded. then discarded afterwards, having this argument avoids having 2x code paths. |
Definition at line 310 of file editmesh_undo.c.
References ARRAY_CHUNK_SIZE, BKE_mesh_update_customdata_pointers(), BLI_array_store_at_size_ensure(), BLI_array_store_state_add(), BLI_assert, Key::block, KeyBlock::data, UndoMesh::edata, Key::elemsize, ListBase::first, Mesh::key, UndoMesh::keyblocks, UndoMesh::ldata, Mesh::ldata, UndoMesh::me, MEM_freeN, MEM_mallocN, UndoMesh::mselect, Mesh::mselect, KeyBlock::next, NULL, UndoMesh::pdata, UndoMesh::store, stride, Mesh::totedge, KeyBlock::totelem, Key::totkey, Mesh::totloop, Mesh::totpoly, Mesh::totselect, Mesh::totvert, um_arraystore, um_arraystore_cd_compact(), and UndoMesh::vdata.
Referenced by um_arraystore_compact(), and um_arraystore_expand_clear().
Definition at line 379 of file editmesh_undo.c.
References BLI_array_store_at_size_calc_memory_usage(), double(), TIMEIT_END, TIMEIT_START, um_arraystore, and um_arraystore_compact().
Referenced by um_arraystore_compact_cb().
|
static |
Definition at line 442 of file editmesh_undo.c.
References BKE_mesh_update_customdata_pointers(), BLI_array_store_state_data_get_alloc(), BLI_assert, Key::block, KeyBlock::data, UndoMesh::edata, Key::elemsize, ListBase::first, Mesh::key, UndoMesh::keyblocks, UndoMesh::ldata, Mesh::ldata, UndoMesh::me, UndoMesh::mselect, Mesh::mselect, KeyBlock::next, UndoMesh::pdata, state, UndoMesh::store, stride, Mesh::totedge, KeyBlock::totelem, Key::totkey, Mesh::totloop, Mesh::totpoly, Mesh::totselect, Mesh::totvert, UMArrayData::um, um_arraystore_cd_expand(), UNUSED_VARS_NDEBUG, and UndoMesh::vdata.
Referenced by undomesh_free_data(), and undomesh_to_editmesh().
|
static |
Remove data we only expanded for temporary use.
Definition at line 437 of file editmesh_undo.c.
References NULL, UMArrayData::um, and um_arraystore_compact_ex().
Referenced by undomesh_to_editmesh().
|
static |
Definition at line 476 of file editmesh_undo.c.
References BLI_array_store_at_size_clear(), BLI_array_store_at_size_get(), BLI_array_store_state_remove(), BLI_assert, BLI_task_pool_free(), UndoMesh::edata, Key::elemsize, Mesh::key, UndoMesh::keyblocks, UndoMesh::ldata, UndoMesh::me, MEM_freeN, UndoMesh::mselect, Mesh::mselect, NULL, UndoMesh::pdata, state, UndoMesh::store, stride, Key::totkey, UMArrayData::um, um_arraystore, um_arraystore_cd_free(), and UndoMesh::vdata.
Referenced by undomesh_free_data().
|
static |
Definition at line 671 of file editmesh_undo.c.
References BKE_key_free(), BKE_mesh_free_data(), BLI_findptr(), BLI_remlink(), BLI_task_pool_work_and_wait(), data, Mesh::key, UndoMesh::me, MEM_freeN, UMArrayData::um, um_arraystore, um_arraystore_expand(), and um_arraystore_free().
Referenced by mesh_undosys_step_free().
|
static |
Definition at line 527 of file editmesh_undo.c.
References BKE_id_copy_ex(), BLI_array_is_zeroed, BLI_assert, BLI_task_pool_work_and_wait(), BMEditMesh::bm, BM_mesh_bm_to_me(), Key::id, Mesh::key, LIB_ID_COPY_LOCALIZE, LIB_ID_COPY_NO_ANIMDATA, UndoMesh::me, NULL, UMArrayData::um, and um_arraystore.
Referenced by mesh_undosys_step_encode().
|
static |
Definition at line 591 of file editmesh_undo.c.
References BKE_editmesh_create(), BKE_keyblock_is_basis(), BKE_keyblock_update_from_mesh(), BLI_findlink(), BLI_task_pool_work_and_wait(), Key::block, BMEditMesh::bm, bm, BM_mesh_bm_from_me(), BM_mesh_create(), BM_SPACEARR_DIRTY_ALL, BMALLOC_TEMPLATE_FROM_ME, KeyBlock::data, EDBM_mesh_free(), Key::elemsize, KEY_RELATIVE, UndoMesh::me, MEM_freeN, MEM_mallocN, MEM_SAFE_FREE, BMEditMesh::selectmode, BMesh::selectmode, UndoMesh::selectmode, BMesh::shapenr, UndoMesh::shapenr, Object::shapenr, BMesh::spacearr_dirty, TIMEIT_END, TIMEIT_START, KeyBlock::totelem, BMesh::totvert, Mesh::totvert, Key::type, UMArrayData::um, um_arraystore, um_arraystore_expand(), and um_arraystore_expand_clear().
Referenced by mesh_undosys_step_decode().
| struct BArrayStore_AtSize bs_stride |
Definition at line 114 of file editmesh_undo.c.
| ListBase local_links |
Definition at line 132 of file editmesh_undo.c.
|
static |
We only need this locally.
Definition at line 77 of file editmesh_undo.c.
Referenced by mesh_undosys_step_decode().
| TaskPool* task_pool |
Definition at line 135 of file editmesh_undo.c.
Referenced by BKE_editmesh_loop_tangent_calc(), BKE_lib_override_library_main_operations_create(), BKE_mesh_calc_loop_tangent_ex(), BKE_mesh_normals_loop_split(), BLI_task_parallel_mempool(), bvh_reference_sort(), bvh_reference_sort_threaded(), blender::deg::deg_evaluate_on_refresh(), distribute_particles_on_dm(), do_sequence_proxy(), IMB_processor_apply_threaded(), IMB_processor_apply_threaded_scanlines(), project_paint_op(), psys_cache_child_paths(), start_prefetch_threads(), and task_parallel_iterator_do().
| struct { ... } um_arraystore |
| int users |
Definition at line 129 of file editmesh_undo.c.