Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/editors/sculpt_paint/sculpt_intern.h')
-rw-r--r--source/blender/editors/sculpt_paint/sculpt_intern.h105
1 files changed, 77 insertions, 28 deletions
diff --git a/source/blender/editors/sculpt_paint/sculpt_intern.h b/source/blender/editors/sculpt_paint/sculpt_intern.h
index 620033422b2..1a596909d8d 100644
--- a/source/blender/editors/sculpt_paint/sculpt_intern.h
+++ b/source/blender/editors/sculpt_paint/sculpt_intern.h
@@ -36,6 +36,7 @@
#include "BKE_paint.h"
#include "BKE_pbvh.h"
+struct AutomaskingCache;
struct KeyBlock;
struct Object;
struct SculptPoseIKChainSegment;
@@ -65,6 +66,9 @@ void SCULPT_flush_update_step(bContext *C, SculptUpdateType update_flags);
void SCULPT_flush_update_done(const bContext *C, Object *ob, SculptUpdateType update_flags);
void SCULPT_flush_stroke_deform(struct Sculpt *sd, Object *ob, bool is_proxy_used);
+/* Should be used after modifying the mask or Face Sets IDs. */
+void SCULPT_tag_update_overlays(bContext *C);
+
/* Stroke */
typedef struct SculptCursorGeometryInfo {
@@ -88,6 +92,9 @@ float SCULPT_raycast_init(struct ViewContext *vc,
float ray_normal[3],
bool original);
+/* Symmetry */
+char SCULPT_mesh_symmetry_xyz_get(Object *object);
+
/* Sculpt PBVH abstraction API */
void SCULPT_vertex_random_access_ensure(struct SculptSession *ss);
@@ -163,6 +170,10 @@ int SCULPT_active_vertex_get(SculptSession *ss);
const float *SCULPT_active_vertex_co_get(SculptSession *ss);
void SCULPT_active_vertex_normal_get(SculptSession *ss, float normal[3]);
+/* Returns PBVH deformed vertices array if shape keys or deform modifiers are used, otherwise
+ * returns mesh original vertices array. */
+struct MVert *SCULPT_mesh_deformed_mverts_get(SculptSession *ss);
+
/* Fake Neighbors */
#define FAKE_NEIGHBOR_NONE -1
@@ -182,7 +193,7 @@ bool SCULPT_vertex_is_boundary(const SculptSession *ss, const int index);
void SCULPT_vertex_visible_set(SculptSession *ss, int index, bool visible);
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 Object *ob);
void SCULPT_visibility_sync_all_vertex_to_face_sets(struct SculptSession *ss);
/* Face Sets API */
@@ -325,11 +336,17 @@ enum eDynTopoWarnFlag SCULPT_dynamic_topology_check(Scene *scene, Object *ob);
void SCULPT_pbvh_clear(Object *ob);
-/* Automasking. */
-float SCULPT_automasking_factor_get(SculptSession *ss, int vert);
+/* Auto-masking. */
+float SCULPT_automasking_factor_get(struct AutomaskingCache *automasking,
+ SculptSession *ss,
+ int vert);
-void SCULPT_automasking_init(Sculpt *sd, Object *ob);
-void SCULPT_automasking_end(Object *ob);
+/* Returns the automasking cache depending on the active tool. Used for code that can run both for
+ * brushes and filter. */
+struct AutomaskingCache *SCULPT_automasking_active_cache_get(SculptSession *ss);
+
+struct AutomaskingCache *SCULPT_automasking_cache_init(Sculpt *sd, Brush *brush, Object *ob);
+void SCULPT_automasking_cache_free(struct AutomaskingCache *automasking);
bool SCULPT_is_automasking_mode_enabled(const Sculpt *sd,
const Brush *br,
@@ -362,13 +379,20 @@ void SCULPT_do_cloth_brush(struct Sculpt *sd,
void SCULPT_cloth_simulation_free(struct SculptClothSimulation *cloth_sim);
-struct SculptClothSimulation *SCULPT_cloth_brush_simulation_create(struct SculptSession *ss,
- struct Brush *brush,
- const float cloth_mass,
- const float cloth_damping,
- const bool use_collisions);
+struct SculptClothSimulation *SCULPT_cloth_brush_simulation_create(
+ struct SculptSession *ss,
+ const float cloth_mass,
+ const float cloth_damping,
+ const float cloth_softbody_strength,
+ const bool use_collisions,
+ const bool needs_deform_coords);
void SCULPT_cloth_brush_simulation_init(struct SculptSession *ss,
struct SculptClothSimulation *cloth_sim);
+
+void SCULPT_cloth_sim_activate_nodes(struct SculptClothSimulation *cloth_sim,
+ PBVHNode **nodes,
+ int totnode);
+
void SCULPT_cloth_brush_store_simulation_state(struct SculptSession *ss,
struct SculptClothSimulation *cloth_sim);
@@ -378,13 +402,13 @@ void SCULPT_cloth_brush_do_simulation_step(struct Sculpt *sd,
struct PBVHNode **nodes,
int totnode);
-void SCULPT_cloth_brush_build_nodes_constraints(struct Sculpt *sd,
- struct Object *ob,
- struct PBVHNode **nodes,
- int totnode,
- struct SculptClothSimulation *cloth_sim,
- float initial_location[3],
- const float radius);
+void SCULPT_cloth_brush_ensure_nodes_constraints(struct Sculpt *sd,
+ struct Object *ob,
+ struct PBVHNode **nodes,
+ int totnode,
+ struct SculptClothSimulation *cloth_sim,
+ float initial_location[3],
+ const float radius);
void SCULPT_cloth_simulation_limits_draw(const uint gpuattr,
const struct Brush *brush,
@@ -405,7 +429,7 @@ BLI_INLINE bool SCULPT_is_cloth_deform_brush(const Brush *brush)
BRUSH_CLOTH_DEFORM_GRAB,
BRUSH_CLOTH_DEFORM_SNAKE_HOOK)) ||
/* All brushes that are not the cloth brush deform the simulation using softbody
- constriants instead of applying forces. */
+ * constraints instead of applying forces. */
(brush->sculpt_tool != SCULPT_TOOL_CLOTH &&
brush->deform_target == BRUSH_DEFORM_TARGET_CLOTH_SIM);
}
@@ -727,10 +751,13 @@ typedef struct SculptBrushTest {
float dist;
int mirror_symmetry_pass;
+ int radial_symmetry_pass;
+ float symm_rot_mat_inv[4][4];
+
/* For circle (not sphere) projection. */
float plane_view[4];
- /* Some tool code uses a plane for it's calculateions. */
+ /* Some tool code uses a plane for its calculations. */
float plane_tool[4];
/* View3d clipping - only set rv3d for clipping */
@@ -786,6 +813,14 @@ float SCULPT_brush_strength_factor(struct SculptSession *ss,
const int vertex_index,
const int thread_id);
+/* Tilts a normal by the x and y tilt values using the view axis. */
+void SCULPT_tilt_apply_to_normal(float r_normal[3],
+ struct StrokeCache *cache,
+ const float tilt_strength);
+
+/* Get effective surface normal with pen tilt and tilt strength applied to it. */
+void SCULPT_tilt_effective_normal_get(const SculptSession *ss, const Brush *brush, float r_no[3]);
+
/* just for vertex paint. */
bool SCULPT_pbvh_calc_area_normal(const struct Brush *brush,
Object *ob,
@@ -808,6 +843,13 @@ typedef struct AutomaskingSettings {
int initial_face_set;
} AutomaskingSettings;
+typedef struct AutomaskingCache {
+ AutomaskingSettings settings;
+ /* Precomputed auto-mask factor indexed by vertex, owned by the auto-masking system and
+ * initialized in #SCULPT_automasking_cache_init when needed. */
+ float *factor;
+} AutomaskingCache;
+
typedef struct StrokeCache {
/* Invariants */
float initial_radius;
@@ -836,9 +878,16 @@ typedef struct StrokeCache {
bool pen_flip;
bool invert;
float pressure;
- float mouse[2];
float bstrength;
float normal_weight; /* from brush (with optional override) */
+ float x_tilt;
+ float y_tilt;
+
+ /* Position of the mouse corresponding to the stroke location, modified by the paint_stroke
+ * operator according to the stroke type. */
+ float mouse[2];
+ /* Position of the mouse event in screen space, not modified by the stroke type. */
+ float mouse_event[2];
float (*prev_colors)[4];
@@ -945,11 +994,8 @@ typedef struct StrokeCache {
float true_gravity_direction[3];
float gravity_direction[3];
- /* Automasking. */
- AutomaskingSettings automask_settings;
- /* Precomputed automask factor indexed by vertex, owned by the automasking system and initialized
- * in SCULPT_automasking_init when needed. */
- float *automask_factor;
+ /* Auto-masking. */
+ AutomaskingCache *automasking;
float stroke_local_mat[4][4];
float multiplane_scrape_angle;
@@ -971,6 +1017,7 @@ typedef enum SculptFilterOrientation {
void SCULPT_filter_to_orientation_space(float r_v[3], struct FilterCache *filter_cache);
void SCULPT_filter_to_object_space(float r_v[3], struct FilterCache *filter_cache);
+void SCULPT_filter_zero_disabled_axis_components(float r_v[3], struct FilterCache *filter_cache);
typedef struct FilterCache {
bool enabled_axis[3];
@@ -1020,13 +1067,13 @@ typedef struct FilterCache {
float *prev_mask;
float mask_expand_initial_co[3];
- /* Used to prevent undesired results on certain mesh filters. */
- float *automask;
-
int new_face_set;
int *prev_face_set;
int active_face_set;
+
+ /* Auto-masking. */
+ AutomaskingCache *automasking;
} FilterCache;
void SCULPT_cache_calc_brushdata_symm(StrokeCache *cache,
@@ -1060,6 +1107,8 @@ void SCULPT_OT_face_set_box_gesture(struct wmOperatorType *ot);
void SCULPT_OT_trim_lasso_gesture(struct wmOperatorType *ot);
void SCULPT_OT_trim_box_gesture(struct wmOperatorType *ot);
+void SCULPT_OT_project_line_gesture(struct wmOperatorType *ot);
+
/* Face Sets. */
void SCULPT_OT_face_sets_randomize_colors(struct wmOperatorType *ot);
void SCULPT_OT_face_sets_change_visibility(struct wmOperatorType *ot);