Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/sculpt_paint/sculpt_intern.h
| Show First 20 Lines • Show All 142 Lines • ▼ Show 20 Lines | if (neighbor_iterator.neighbors != neighbor_iterator.neighbors_fixed) { \ | ||||
| MEM_freeN(neighbor_iterator.neighbors); \ | MEM_freeN(neighbor_iterator.neighbors); \ | ||||
| } \ | } \ | ||||
| ((void)0) | ((void)0) | ||||
| int SCULPT_active_vertex_get(SculptSession *ss); | int SCULPT_active_vertex_get(SculptSession *ss); | ||||
| const float *SCULPT_active_vertex_co_get(SculptSession *ss); | const float *SCULPT_active_vertex_co_get(SculptSession *ss); | ||||
| void SCULPT_active_vertex_normal_get(SculptSession *ss, float normal[3]); | void SCULPT_active_vertex_normal_get(SculptSession *ss, float normal[3]); | ||||
| bool SCULPT_vertex_is_boundary(SculptSession *ss, const int index); | |||||
| /* Fake Neighbors */ | /* Fake Neighbors */ | ||||
| #define FAKE_NEIGHBOR_NONE -1 | #define FAKE_NEIGHBOR_NONE -1 | ||||
| void SCULPT_fake_neighbors_ensure(struct Sculpt *sd, Object *ob, const float max_dist); | void SCULPT_fake_neighbors_ensure(struct Sculpt *sd, Object *ob, const float max_dist); | ||||
| void SCULPT_fake_neighbors_enable(Object *ob); | void SCULPT_fake_neighbors_enable(Object *ob); | ||||
| void SCULPT_fake_neighbors_disable(Object *ob); | void SCULPT_fake_neighbors_disable(Object *ob); | ||||
| void SCULPT_fake_neighbors_free(struct Object *ob); | void SCULPT_fake_neighbors_free(struct Object *ob); | ||||
| /* Vertex Info. */ | |||||
| void SCULPT_boundary_info_ensure(Object *object); | |||||
| /* Boundary Info needs to be initialized in order to use this function. */ | |||||
| bool SCULPT_vertex_is_boundary(const SculptSession *ss, const int index); | |||||
sergey: `SculptSession` can be const. | |||||
| /* Sculpt Visibility API */ | /* Sculpt Visibility API */ | ||||
| void SCULPT_vertex_visible_set(SculptSession *ss, int index, bool visible); | void SCULPT_vertex_visible_set(SculptSession *ss, int index, bool visible); | ||||
| bool SCULPT_vertex_visible_get(SculptSession *ss, int index); | bool SCULPT_vertex_visible_get(SculptSession *ss, int index); | ||||
| void SCULPT_visibility_sync_all_face_sets_to_vertices(struct SculptSession *ss); | void SCULPT_visibility_sync_all_face_sets_to_vertices(struct SculptSession *ss); | ||||
| void SCULPT_visibility_sync_all_vertex_to_face_sets(struct SculptSession *ss); | void SCULPT_visibility_sync_all_vertex_to_face_sets(struct SculptSession *ss); | ||||
| /* Face Sets API */ | /* Face Sets API */ | ||||
| int SCULPT_active_face_set_get(SculptSession *ss); | int SCULPT_active_face_set_get(SculptSession *ss); | ||||
| int SCULPT_vertex_face_set_get(SculptSession *ss, int index); | int SCULPT_vertex_face_set_get(SculptSession *ss, int index); | ||||
| void SCULPT_vertex_face_set_set(SculptSession *ss, int index, int face_set); | void SCULPT_vertex_face_set_set(SculptSession *ss, int index, int face_set); | ||||
| bool SCULPT_vertex_has_face_set(SculptSession *ss, int index, int face_set); | bool SCULPT_vertex_has_face_set(SculptSession *ss, int index, int face_set); | ||||
| bool SCULPT_vertex_has_unique_face_set(SculptSession *ss, int index); | bool SCULPT_vertex_has_unique_face_set(SculptSession *ss, int index); | ||||
| int SCULPT_face_set_next_available_get(SculptSession *ss); | int SCULPT_face_set_next_available_get(SculptSession *ss); | ||||
| void SCULPT_face_set_visibility_set(SculptSession *ss, int face_set, bool visible); | void SCULPT_face_set_visibility_set(SculptSession *ss, int face_set, bool visible); | ||||
| bool SCULPT_vertex_all_face_sets_visible_get(SculptSession *ss, int index); | bool SCULPT_vertex_all_face_sets_visible_get(const SculptSession *ss, int index); | ||||
| bool SCULPT_vertex_any_face_set_visible_get(SculptSession *ss, int index); | bool SCULPT_vertex_any_face_set_visible_get(SculptSession *ss, int index); | ||||
| void SCULPT_face_sets_visibility_invert(SculptSession *ss); | void SCULPT_face_sets_visibility_invert(SculptSession *ss); | ||||
| void SCULPT_face_sets_visibility_all_set(SculptSession *ss, bool visible); | void SCULPT_face_sets_visibility_all_set(SculptSession *ss, bool visible); | ||||
| bool SCULPT_stroke_is_main_symmetry_pass(struct StrokeCache *cache); | bool SCULPT_stroke_is_main_symmetry_pass(struct StrokeCache *cache); | ||||
| bool SCULPT_stroke_is_first_brush_step(struct StrokeCache *cache); | bool SCULPT_stroke_is_first_brush_step(struct StrokeCache *cache); | ||||
| bool SCULPT_stroke_is_first_brush_step_of_symmetry_pass(struct StrokeCache *cache); | bool SCULPT_stroke_is_first_brush_step_of_symmetry_pass(struct StrokeCache *cache); | ||||
| ▲ Show 20 Lines • Show All 208 Lines • ▼ Show 20 Lines | |||||
| /* Paint Brush. */ | /* Paint Brush. */ | ||||
| void SCULPT_do_paint_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode); | void SCULPT_do_paint_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode); | ||||
| /* Smear Brush. */ | /* Smear Brush. */ | ||||
| void SCULPT_do_smear_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode); | void SCULPT_do_smear_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode); | ||||
| /* Smooth Brush. */ | /* Smooth Brush. */ | ||||
| void SCULPT_neighbor_average(SculptSession *ss, float avg[3], uint vert); | |||||
| void SCULPT_bmesh_neighbor_average(float avg[3], struct BMVert *v); | |||||
| void SCULPT_bmesh_four_neighbor_average(float avg[3], float direction[3], struct BMVert *v); | void SCULPT_bmesh_four_neighbor_average(float avg[3], float direction[3], struct BMVert *v); | ||||
| void SCULPT_neighbor_coords_average(SculptSession *ss, float result[3], int index); | void SCULPT_neighbor_coords_average(SculptSession *ss, float result[3], int index); | ||||
| float SCULPT_neighbor_mask_average(SculptSession *ss, int index); | float SCULPT_neighbor_mask_average(SculptSession *ss, int index); | ||||
| void SCULPT_neighbor_color_average(SculptSession *ss, float result[4], int index); | void SCULPT_neighbor_color_average(SculptSession *ss, float result[4], int index); | ||||
| /* Mask the mesh boundaries smoothing only the mesh surface without using automasking. */ | |||||
| void SCULPT_neighbor_coords_average_interior(SculptSession *ss, float result[3], int index); | |||||
| void SCULPT_smooth(Sculpt *sd, | void SCULPT_smooth(Sculpt *sd, | ||||
| Object *ob, | Object *ob, | ||||
| PBVHNode **nodes, | PBVHNode **nodes, | ||||
| const int totnode, | const int totnode, | ||||
| float bstrength, | float bstrength, | ||||
| const bool smooth_mask); | const bool smooth_mask); | ||||
| void SCULPT_do_smooth_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode); | void SCULPT_do_smooth_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode); | ||||
| ▲ Show 20 Lines • Show All 305 Lines • ▼ Show 20 Lines | |||||
| /* Cache stroke properties. Used because | /* Cache stroke properties. Used because | ||||
| * RNA property lookup isn't particularly fast. | * RNA property lookup isn't particularly fast. | ||||
| * | * | ||||
| * For descriptions of these settings, check the operator properties. | * For descriptions of these settings, check the operator properties. | ||||
| */ | */ | ||||
| #define SCULPT_CLAY_STABILIZER_LEN 10 | #define SCULPT_CLAY_STABILIZER_LEN 10 | ||||
| typedef struct AutomaskingSettings { | |||||
| /* Flags from eAutomasking_flag. */ | |||||
Done Inline ActionsIf it is a single bit, use typed enum. If it is a bitmask, call it flags. sergey: If it is a single bit, use typed enum. If it is a bitmask, call it `flags`. | |||||
Done Inline ActionsAdd a note that flags are from eAutomasking_flag. sergey: Add a note that flags are from `eAutomasking_flag`. | |||||
| int flags; | |||||
| int initial_face_set; | |||||
| } AutomaskingSettings; | |||||
| typedef struct StrokeCache { | typedef struct StrokeCache { | ||||
| /* Invariants */ | /* Invariants */ | ||||
| float initial_radius; | float initial_radius; | ||||
| float scale[3]; | float scale[3]; | ||||
| int flag; | int flag; | ||||
| float clip_tolerance[3]; | float clip_tolerance[3]; | ||||
| float initial_mouse[2]; | float initial_mouse[2]; | ||||
| ▲ Show 20 Lines • Show All 106 Lines • ▼ Show 20 Lines | typedef struct StrokeCache { | ||||
| bool alt_smooth; | bool alt_smooth; | ||||
| float plane_trim_squared; | float plane_trim_squared; | ||||
| bool supports_gravity; | bool supports_gravity; | ||||
| float true_gravity_direction[3]; | float true_gravity_direction[3]; | ||||
| float gravity_direction[3]; | float gravity_direction[3]; | ||||
| float *automask; | /* Automasking. */ | ||||
| AutomaskingSettings automask_settings; | |||||
| /* Precomputed automask factor indexed by vertex, owned by the automasking system and initialized | |||||
Done Inline ActionsThis field is inside of StrokeCache, making you to access cache->automask_cache which is redundant. It is more interesting to know:
Based on what elements are you can also choose better naming, which will facilitate understanding what you're accessing without jumping to the declaration with comment, Generally follow the rule: code should be locally readable and understandable (by others and future-you). sergey: This field is inside of `StrokeCache`, making you to access `cache->automask_cache` which is… | |||||
| * in SCULPT_automasking_init when needed. */ | |||||
| float *automask_factor; | |||||
| float stroke_local_mat[4][4]; | float stroke_local_mat[4][4]; | ||||
| float multiplane_scrape_angle; | float multiplane_scrape_angle; | ||||
| float wet_mix_prev_color[4]; | float wet_mix_prev_color[4]; | ||||
| float density_seed; | float density_seed; | ||||
| rcti previous_r; /* previous redraw rectangle */ | rcti previous_r; /* previous redraw rectangle */ | ||||
| ▲ Show 20 Lines • Show All 106 Lines • Show Last 20 Lines | |||||
SculptSession can be const.