124 if (*((
bool *)rebuild)) {
143 int *node_grid_indices;
147 for (
int i = 0; i < totgrid; i++) {
148 if (
data->modified_grids[node_grid_indices[i]] == 1) {
166 if (memcmp(
a, b,
sizeof(
float[3])) != 0) {
214 index = unode->
index;
223 for (
int i = 0; i < unode->
totvert; i++) {
228 for (
int i = 0; i < unode->
totvert; i++) {
234 for (
int i = 0; i < unode->
totvert; i++) {
251 for (
int i = 0; i < unode->
totvert; i++) {
257 for (
int i = 0; i < unode->
totvert; i++) {
264 for (
int i = 0; i < unode->
totvert; i++) {
278 grids = subdiv_ccg->
grids;
283 for (
int j = 0; j < unode->
totgrid; j++) {
284 grid = grids[unode->
grids[j]];
286 for (
int i = 0; i < gridsize * gridsize; i++, co++) {
305 for (
int i = 0; i < unode->
totvert; i++) {
317 for (
int i = 0; i < unode->
totgrid; i++) {
333 int *index = unode->
index;
337 for (
int i = 0; i < unode->
totvert; i++) {
358 index = unode->
index;
362 for (
int i = 0; i < unode->
totvert; i++) {
363 if (vmask[index[i]] != unode->
mask[i]) {
364 SWAP(
float, vmask[index[i]], unode->
mask[i]);
376 grids = subdiv_ccg->
grids;
381 for (
int j = 0; j < unode->
totgrid; j++) {
382 grid = grids[unode->
grids[j]];
384 for (
int i = 0; i < gridsize * gridsize; i++,
mask++) {
399 for (
int i = 0; i < me->
totpoly; i++) {
455 .use_toolflags =
false,
593 switch (unode->
type) {
647 bool update =
false,
rebuild =
false, update_mask =
false, update_visibility =
false;
648 bool need_mask =
false;
649 bool need_refine_subdiv =
false;
651 for (unode = lb->
first; unode; unode = unode->
next) {
709 char *undo_modified_grids =
NULL;
710 bool use_multires_undo =
false;
712 for (unode = lb->
first; unode; unode = unode->
next) {
731 use_multires_undo =
true;
734 switch (unode->
type) {
743 update_visibility =
true;
761 need_refine_subdiv =
true;
769 BLI_assert(!
"Dynamic topology should've already been handled");
774 if (use_multires_undo) {
775 for (unode = lb->
first; unode; unode = unode->
next) {
783 if (undo_modified_grids ==
NULL) {
787 for (
int i = 0; i < unode->
totgrid; i++) {
788 undo_modified_grids[unode->
grids[i]] = 1;
793 if (subdiv_ccg !=
NULL && need_refine_subdiv) {
798 bool tag_update =
false;
805 .modified_grids = undo_modified_grids,
814 if (update_visibility) {
857 while (unode !=
NULL) {
878 for (
int i = 0; i < unode->
totgrid; i++) {
934 if (usculpt ==
NULL) {
945 if (usculpt ==
NULL) {
957 int *grid_indices, totgrid;
960 size_t alloc_size =
sizeof(*unode->
grid_hidden) * (
size_t)totgrid;
963 for (
int i = 0; i < totgrid; i++) {
964 if (grid_hidden[grid_indices[i]]) {
1031 size_t alloc_size =
sizeof(*unode->
co) * (
size_t)allvert;
1037 alloc_size =
sizeof(*unode->
no) * (
size_t)allvert;
1054 const size_t alloc_size =
sizeof(*unode->
mask) * (
size_t)allvert;
1060 const size_t alloc_size =
sizeof(*unode->
col) * (
size_t)allvert;
1068 BLI_assert(!
"Dynamic topology should've already been handled");
1080 const size_t alloc_size =
sizeof(*unode->
grids) * (
size_t)totgrid;
1088 const size_t alloc_size =
sizeof(*unode->
index) * (
size_t)allvert;
1094 const size_t alloc_size =
sizeof(*unode->
orig_co) * (
size_t)allvert;
1133 const int *vert_indices;
1138 for (
int i = 0; i < allvert; i++) {
1205 for (
int i = 0; i < me->
totpoly; i++) {
1222 if (unode ==
NULL) {
1332 int totgrid, *grids;
1334 memcpy(unode->
grids, grids,
sizeof(
int) * totgrid);
1337 const int *vert_indices;
1341 memcpy(unode->
index, vert_indices,
sizeof(
int) * unode->
totvert);
1360 BLI_assert(!
"Dynamic topology should've already been handled");
1491 const bool is_final)
1503 while ((us_iter != us) || (!is_final && us_iter == us)) {
1506 if (us_iter == us) {
1526 if (us_iter == us) {
1606 ut->
name =
"Sculpt";
1691 for (
int i = 0; i < totnodes; i++) {
typedef float(TangentPoint)[2]
BLI_INLINE float * CCG_elem_offset_co(const CCGKey *key, CCGElem *elem, int offset)
BLI_INLINE float * CCG_elem_offset_mask(const CCGKey *key, CCGElem *elem, int offset)
struct Scene * CTX_data_scene(const bContext *C)
struct ViewLayer * CTX_data_view_layer(const bContext *C)
struct Depsgraph * CTX_data_ensure_evaluated_depsgraph(const bContext *C)
struct Object * CTX_data_active_object(const bContext *C)
struct View3D * CTX_wm_view3d(const bContext *C)
CustomData interface, see also DNA_customdata_types.h.
void CustomData_free(struct CustomData *data, int totelem)
void * CustomData_get_layer(const struct CustomData *data, int type)
void CustomData_copy(const struct CustomData *source, struct CustomData *dest, CustomDataMask mask, eCDAllocType alloctype, int totelem)
const CustomData_MeshMasks CD_MASK_MESH
struct KeyBlock * BKE_keyblock_find_name(struct Key *key, const char name[])
float(* BKE_keyblock_convert_to_vertcos(struct Object *ob, struct KeyBlock *kb))[3]
struct Key * BKE_key_from_object(const struct Object *ob)
void BKE_mesh_calc_normals(struct Mesh *me)
void BKE_mesh_update_customdata_pointers(struct Mesh *me, const bool do_ensure_tess_cd)
void BKE_mesh_flush_hidden_from_verts(struct Mesh *me)
float(* BKE_multires_create_deformed_base_mesh_vert_coords(struct Depsgraph *depsgraph, struct Object *object, struct MultiresModifierData *mmd, int *r_num_deformed_verts))[3]
void multires_mark_as_modified(struct Depsgraph *depsgraph, struct Object *object, enum MultiresModifiedFlags flags)
General operations, lookup, etc. for blender objects.
struct Mesh * BKE_object_get_original_mesh(struct Object *object)
ePaintMode BKE_paintmode_get_active_from_context(const struct bContext *C)
void BKE_sculpt_update_object_for_edit(struct Depsgraph *depsgraph, struct Object *ob_orig, bool need_pmap, bool need_mask, bool need_colors)
void BKE_sculptsession_free_deformMats(struct SculptSession *ss)
struct MultiresModifierData * BKE_sculpt_multires_active(struct Scene *scene, struct Object *ob)
bool BKE_sculptsession_use_pbvh_draw(const struct Object *ob, const struct View3D *v3d)
void BKE_pbvh_node_mark_update(PBVHNode *node)
void BKE_pbvh_node_get_verts(PBVH *pbvh, PBVHNode *node, const int **r_vert_indices, struct MVert **r_verts)
#define BKE_pbvh_vertex_iter_begin(pbvh, node, vi, mode)
void BKE_pbvh_node_mark_update_visibility(PBVHNode *node)
void BKE_pbvh_node_num_verts(PBVH *pbvh, PBVHNode *node, int *r_uniquevert, int *r_totvert)
void BKE_pbvh_update_visibility(PBVH *pbvh)
PBVHType BKE_pbvh_type(const PBVH *pbvh)
#define BKE_pbvh_vertex_iter_end
struct GSet * BKE_pbvh_bmesh_node_faces(PBVHNode *node)
bool BKE_pbvh_node_vert_update_check_any(PBVH *pbvh, PBVHNode *node)
void BKE_pbvh_node_get_grids(PBVH *pbvh, PBVHNode *node, int **grid_indices, int *totgrid, int *maxgrid, int *gridsize, struct CCGElem ***r_griddata)
void BKE_pbvh_node_fully_hidden_set(PBVHNode *node, int fully_hidden)
void BKE_pbvh_parallel_range_settings(struct TaskParallelSettings *settings, bool use_threading, int totnode)
void BKE_pbvh_update_vertex_data(PBVH *pbvh, int flags)
void BKE_pbvh_node_mark_update_mask(PBVHNode *node)
void BKE_pbvh_vert_coords_apply(struct PBVH *pbvh, const float(*vertCos)[3], const int totvert)
void BKE_pbvh_update_bounds(PBVH *pbvh, int flags)
void BKE_pbvh_search_callback(PBVH *pbvh, BKE_pbvh_SearchCallback scb, void *search_data, BKE_pbvh_HitCallback hcb, void *hit_data)
void BKE_pbvh_node_mark_redraw(PBVHNode *node)
unsigned int ** BKE_pbvh_grid_hidden(const PBVH *pbvh)
void BKE_pbvh_search_gather(PBVH *pbvh, BKE_pbvh_SearchCallback scb, void *search_data, PBVHNode ***array, int *tot)
void BKE_scene_graph_evaluated_ensure(struct Depsgraph *depsgraph, struct Main *bmain)
void BKE_subdiv_ccg_key_top_level(struct CCGKey *key, const SubdivCCG *subdiv_ccg)
bool BKE_subdiv_eval_refine_from_mesh(struct Subdiv *subdiv, const struct Mesh *mesh, const float(*coarse_vertex_cos)[3])
@ MULTIRES_HIDDEN_MODIFIED
@ MULTIRES_COORDS_MODIFIED
const UndoType * BKE_UNDOSYS_TYPE_SCULPT
UndoStep * BKE_undosys_step_push_init_with_type(UndoStack *ustack, struct bContext *C, const char *name, const UndoType *ut)
UndoStep * BKE_undosys_stack_init_or_active_with_type(UndoStack *ustack, const UndoType *ut)
#define BKE_undosys_stack_limit_steps_and_memory_defaults(ustack)
UndoPushReturn BKE_undosys_step_push(UndoStack *ustack, struct bContext *C, const char *name)
#define BLI_BITMAP_TEST(_bitmap, _index)
#define BLI_BITMAP_SIZE(_tot)
#define BLI_BITMAP_FLIP(_bitmap, _index)
#define BLI_BITMAP_NEW(_tot, _alloc_string)
#define BLI_BITMAP_SET(_bitmap, _index, _set)
#define GSET_ITER(gs_iter_, gset_)
BLI_INLINE void * BLI_gsetIterator_getKey(GSetIterator *gsi)
BLI_INLINE bool BLI_listbase_is_empty(const struct ListBase *lb)
#define LISTBASE_FOREACH(type, var, list)
BLI_INLINE void BLI_listbase_clear(struct ListBase *lb)
void BLI_addtail(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
int BLI_findindex(const struct ListBase *listbase, const void *vlink) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
void * BLI_findptr(const struct ListBase *listbase, const void *ptr, const int offset) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
MINLINE void copy_v4_v4(float r[4], const float a[4])
MINLINE void normal_float_to_short_v3(short r[3], const float n[3])
MINLINE void copy_v3_v3(float r[3], const float a[3])
MINLINE void copy_v3_v3_short(short r[3], const short a[3])
MINLINE void swap_v3_v3(float a[3], float b[3])
char * BLI_strncpy(char *__restrict dst, const char *__restrict src, const size_t maxncpy) ATTR_NONNULL()
void BLI_task_parallel_range(const int start, const int stop, void *userdata, TaskParallelRangeFunc func, const TaskParallelSettings *settings)
void BLI_thread_unlock(int type)
void BLI_thread_lock(int type)
struct Depsgraph Depsgraph
void DEG_id_tag_update(struct ID *id, int flag)
#define ID_REAL_USERS(id)
@ ME_SCULPT_DYNAMIC_TOPOLOGY
Object is a sort of wrapper for general info.
#define OBACT(_view_layer)
void ED_object_mode_generic_exit(struct Main *bmain, struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob)
void ED_object_sculptmode_enter_ex(struct Main *bmain, struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob, const bool force_dyntopo, struct ReportList *reports)
void ED_undo_push(struct bContext *C, const char *str)
struct UndoStack * ED_undo_stack_get(void)
void ED_undosys_stack_memfile_id_changed_tag(struct UndoStack *ustack, struct ID *id)
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum type
Read Guarded memory(de)allocation.
void BM_data_layer_add(BMesh *bm, CustomData *data, int type)
void BM_log_all_added(BMesh *bm, BMLog *log)
BMLogEntry * BM_log_entry_add(BMLog *log)
void BM_log_cleanup_entry(BMLogEntry *entry)
void BM_log_face_modified(BMLog *log, BMFace *f)
void BM_log_redo(BMesh *bm, BMLog *log)
BMLog * BM_log_from_existing_entries_create(BMesh *bm, BMLogEntry *entry)
void BM_log_vert_before_modified(BMLog *log, BMVert *v, const int cd_vert_mask_offset)
void BM_log_entry_drop(BMLogEntry *entry)
void BM_log_undo(BMesh *bm, BMLog *log)
void BM_log_before_all_removed(BMesh *bm, BMLog *log)
const BMAllocTemplate bm_mesh_allocsize_default
BMesh * BM_mesh_create(const BMAllocTemplate *allocsize, const struct BMeshCreateParams *params)
BMesh Make Mesh.
ATTR_WARN_UNUSED_RESULT const BMVert * v
const Depsgraph * depsgraph
void(* MEM_freeN)(void *vmemh)
void *(* MEM_dupallocN)(const void *vmemh)
size_t(* MEM_allocN_len)(const void *vmemh)
void *(* MEM_callocN)(size_t len, const char *str)
static void update(bNodeTree *ntree)
void SCULPT_vertcos_to_key(Object *ob, KeyBlock *kb, const float(*vertCos)[3])
void SCULPT_visibility_sync_all_vertex_to_face_sets(SculptSession *ss)
void SCULPT_update_object_bounding_box(Object *ob)
void SCULPT_visibility_sync_all_face_sets_to_vertices(Object *ob)
void SCULPT_pbvh_clear(Object *ob)
void SCULPT_dynamic_topology_disable(bContext *C, SculptUndoNode *unode)
void SCULPT_dyntopo_node_layers_add(SculptSession *ss)
struct SculptUndoNode SculptUndoNode
@ SCULPT_UNDO_DYNTOPO_SYMMETRIZE
@ SCULPT_UNDO_DYNTOPO_END
@ SCULPT_UNDO_DYNTOPO_BEGIN
static SculptUndoNodeGeometry * sculpt_undo_geometry_get(SculptUndoNode *unode)
static void sculpt_undo_restore_list(bContext *C, Depsgraph *depsgraph, ListBase *lb)
static void sculpt_undosys_step_decode(struct bContext *C, struct Main *bmain, UndoStep *us_p, const eUndoStepDir dir, bool is_final)
static void sculpt_undo_geometry_restore(SculptUndoNode *unode, Object *object)
static void update_cb_partial(PBVHNode *node, void *userdata)
SculptUndoNode * SCULPT_undo_get_node(PBVHNode *node)
void ED_sculpt_undo_geometry_begin(struct Object *ob, const char *name)
static bool sculpt_undo_restore_color(bContext *C, SculptUndoNode *unode)
static void sculpt_undo_store_mask(Object *ob, SculptUndoNode *unode)
static bool sculpt_undo_restore_deformed(const SculptSession *ss, SculptUndoNode *unode, int uindex, int oindex, float coord[3])
SculptUndoNode * SCULPT_undo_get_first_node()
static void sculpt_undo_push_all_grids(Object *object)
static SculptUndoNode * sculpt_undo_face_sets_push(Object *ob, SculptUndoType type)
static bool sculpt_undo_use_multires_mesh(bContext *C)
void ED_sculpt_undo_geometry_end(struct Object *ob)
static bool sculpt_undo_restore_mask(bContext *C, SculptUndoNode *unode)
static void sculpt_undo_geometry_store_data(SculptUndoNodeGeometry *geometry, Object *object)
static SculptUndoNode * sculpt_undo_alloc_node(Object *ob, PBVHNode *node, SculptUndoType type)
static size_t sculpt_undo_alloc_and_store_hidden(PBVH *pbvh, SculptUndoNode *unode)
void ED_sculpt_undosys_type(UndoType *ut)
static void sculpt_undosys_step_encode_init(struct bContext *UNUSED(C), UndoStep *us_p)
static void sculpt_undo_refine_subdiv(Depsgraph *depsgraph, SculptSession *ss, Object *object, struct Subdiv *subdiv)
static bool sculpt_undo_restore_face_sets(bContext *C, SculptUndoNode *unode)
static SculptUndoNode * sculpt_undo_alloc_node_type(Object *object, SculptUndoType type)
void SCULPT_undo_push_end_ex(const bool use_nested_undo)
static UndoSculpt * sculpt_undosys_step_get_nodes(UndoStep *us_p)
static void sculpt_undosys_step_decode_redo(struct bContext *C, Depsgraph *depsgraph, SculptUndoStep *us)
void ED_sculpt_undo_push_multires_mesh_begin(bContext *C, const char *str)
static UndoSculpt * sculpt_undo_get_nodes(void)
static SculptUndoNode * sculpt_undo_geometry_push(Object *object, SculptUndoType type)
static bool sculpt_undo_restore_coords(bContext *C, Depsgraph *depsgraph, SculptUndoNode *unode)
void SCULPT_undo_push_end(void)
static bool sculpt_undosys_step_encode(struct bContext *UNUSED(C), struct Main *bmain, UndoStep *us_p)
static void sculpt_undo_bmesh_enable(Object *ob, SculptUndoNode *unode)
void ED_sculpt_undo_push_multires_mesh_end(bContext *C, const char *str)
static void sculpt_undo_store_hidden(Object *ob, SculptUndoNode *unode)
static void sculpt_undo_bmesh_restore_begin(bContext *C, SculptUndoNode *unode, Object *ob, SculptSession *ss)
static void update_cb(PBVHNode *node, void *rebuild)
SculptUndoNode * SCULPT_undo_push_node(Object *ob, PBVHNode *node, SculptUndoType type)
static SculptUndoNode * sculpt_undo_bmesh_push(Object *ob, PBVHNode *node, SculptUndoType type)
void SCULPT_undo_push_begin(Object *ob, const char *name)
static void sculpt_undo_store_color(Object *ob, SculptUndoNode *unode)
static void sculpt_undo_geometry_restore_data(SculptUndoNodeGeometry *geometry, Object *object)
static int sculpt_undo_bmesh_restore(bContext *C, SculptUndoNode *unode, Object *ob, SculptSession *ss)
static void sculpt_undo_free_list(ListBase *lb)
static void sculpt_undosys_step_decode_redo_impl(struct bContext *C, Depsgraph *depsgraph, SculptUndoStep *us)
static SculptUndoNode * sculpt_undo_find_or_alloc_node_type(Object *object, SculptUndoType type)
static void sculpt_undosys_step_decode_undo_impl(struct bContext *C, Depsgraph *depsgraph, SculptUndoStep *us)
struct SculptUndoStep SculptUndoStep
static void sculpt_undo_bmesh_restore_end(bContext *C, SculptUndoNode *unode, Object *ob, SculptSession *ss)
struct UndoSculpt UndoSculpt
static void sculpt_undo_bmesh_restore_generic_task_cb(void *__restrict userdata, const int n, const TaskParallelTLS *__restrict UNUSED(tls))
static void sculpt_undosys_step_free(UndoStep *us_p)
static bool test_swap_v3_v3(float a[3], float b[3])
static void sculpt_undo_store_coords(Object *ob, SculptUndoNode *unode)
static void sculpt_undosys_step_decode_undo(struct bContext *C, Depsgraph *depsgraph, SculptUndoStep *us, const bool is_final)
static void sculpt_undo_bmesh_restore_generic(SculptUndoNode *unode, Object *ob, SculptSession *ss)
static bool sculpt_undo_restore_hidden(bContext *C, SculptUndoNode *unode)
static void sculpt_undo_geometry_free_data(SculptUndoNodeGeometry *geometry)
char is_memfile_undo_flush_needed
struct CustomData pdata ldata
struct CustomData vdata edata fdata
struct SculptSession * sculpt
struct SubdivCCG * subdiv_ccg
struct KeyBlock * shapekey_active
struct MultiresModifierData * modifier
struct SculptSession::@53 multires
bool deform_modifiers_active
struct BMLogEntry * bm_entry
BLI_bitmap ** grid_hidden
SculptUndoNodeGeometry geometry_modified
SculptUndoNodeGeometry geometry_bmesh_enter
char shapeName[sizeof(((KeyBlock *) 0)) ->name]
SculptUndoNodeGeometry geometry_original
struct SculptUndoNode * next
BLI_bitmap ** grid_hidden
const struct UndoType * type
void(* step_decode)(struct bContext *C, struct Main *bmain, UndoStep *us, const eUndoStepDir dir, bool is_final)
bool(* step_encode)(struct bContext *C, struct Main *bmain, UndoStep *us)
void(* step_encode_init)(struct bContext *C, UndoStep *us)
void(* step_free)(UndoStep *us)
bool(* poll)(struct bContext *C)
ccl_device_inline float4 mask(const int4 &mask, const float4 &a)
void WM_event_add_notifier(const bContext *C, uint type, void *reference)
void WM_file_tag_modified(void)