Cleanup: use paint/sculpt prefix in BKE_paint.h

PoseIKChain for example reads as if this is related to armature/pose
when it's a sculpting feature.
This commit is contained in:
Campbell Barton
2020-01-08 12:59:48 +11:00
parent 55daa0d444
commit 0e37045f32
5 changed files with 54 additions and 52 deletions

View File

@@ -85,14 +85,14 @@ typedef enum ePaintMode {
#define PAINT_MODE_HAS_BRUSH(mode) !ELEM(mode, PAINT_MODE_SCULPT_UV)
/* overlay invalidation */
typedef enum eOverlayControlFlags {
typedef enum ePaintOverlayControlFlags {
PAINT_OVERLAY_INVALID_TEXTURE_PRIMARY = 1,
PAINT_OVERLAY_INVALID_TEXTURE_SECONDARY = (1 << 2),
PAINT_OVERLAY_INVALID_CURVE = (1 << 3),
PAINT_OVERLAY_OVERRIDE_CURSOR = (1 << 4),
PAINT_OVERLAY_OVERRIDE_PRIMARY = (1 << 5),
PAINT_OVERLAY_OVERRIDE_SECONDARY = (1 << 6),
} eOverlayControlFlags;
} ePaintOverlayControlFlags;
#define PAINT_OVERRIDE_MASK \
(PAINT_OVERLAY_OVERRIDE_SECONDARY | PAINT_OVERLAY_OVERRIDE_PRIMARY | \
@@ -102,12 +102,12 @@ typedef enum eOverlayControlFlags {
* flip or mirror transform values depending on where the vertex is and where the transform
* operation started to support XYZ symmetry on those operations in a predictable way. */
#define AREA_SYMM_DEFAULT 0
#define PAINT_SYMM_AREA_DEFAULT 0
typedef enum ePaintSymmetryAreas {
AREA_SYMM_X = (1 << 0),
AREA_SYMM_Y = (1 << 1),
AREA_SYMM_Z = (1 << 2),
PAINT_SYMM_AREA_X = (1 << 0),
PAINT_SYMM_AREA_Y = (1 << 1),
PAINT_SYMM_AREA_Z = (1 << 2),
} ePaintSymmetryAreas;
#define PAINT_SYMM_AREAS 8
@@ -119,8 +119,8 @@ void BKE_paint_invalidate_cursor_overlay(struct Scene *scene,
struct ViewLayer *view_layer,
struct CurveMapping *curve);
void BKE_paint_invalidate_overlay_all(void);
eOverlayControlFlags BKE_paint_get_overlay_flags(void);
void BKE_paint_reset_overlay_invalid(eOverlayControlFlags flag);
ePaintOverlayControlFlags BKE_paint_get_overlay_flags(void);
void BKE_paint_reset_overlay_invalid(ePaintOverlayControlFlags flag);
void BKE_paint_set_overlay_override(enum eOverlayFlags flag);
/* palettes */
@@ -226,7 +226,7 @@ struct SculptVertexPaintGeomMap {
};
/* Pose Brush IK Chain */
typedef struct PoseIKChainSegment {
typedef struct SculptPoseIKChainSegment {
float orig[3];
float head[3];
@@ -241,12 +241,12 @@ typedef struct PoseIKChainSegment {
float trans_mat[PAINT_SYMM_AREAS][4][4];
float pivot_mat[PAINT_SYMM_AREAS][4][4];
float pivot_mat_inv[PAINT_SYMM_AREAS][4][4];
} PoseIKChainSegment;
} SculptPoseIKChainSegment;
typedef struct PoseIKChain {
PoseIKChainSegment *segments;
typedef struct SculptPoseIKChain {
SculptPoseIKChainSegment *segments;
int tot_segments;
} PoseIKChain;
} SculptPoseIKChain;
/* Session data (mode-specific) */
@@ -313,7 +313,7 @@ typedef struct SculptSession {
/* Pose Brush Preview */
float pose_origin[3];
PoseIKChain *pose_ik_chain_preview;
SculptPoseIKChain *pose_ik_chain_preview;
/* Transform operator */
float pivot_pos[3];

View File

@@ -79,7 +79,7 @@ const char PAINT_CURSOR_VERTEX_PAINT[3] = {255, 255, 255};
const char PAINT_CURSOR_WEIGHT_PAINT[3] = {200, 200, 255};
const char PAINT_CURSOR_TEXTURE_PAINT[3] = {255, 255, 255};
static eOverlayControlFlags overlay_flags = 0;
static ePaintOverlayControlFlags overlay_flags = 0;
void BKE_paint_invalidate_overlay_tex(Scene *scene, ViewLayer *view_layer, const Tex *tex)
{
@@ -120,7 +120,7 @@ void BKE_paint_invalidate_overlay_all(void)
PAINT_OVERLAY_INVALID_TEXTURE_PRIMARY | PAINT_OVERLAY_INVALID_CURVE);
}
eOverlayControlFlags BKE_paint_get_overlay_flags(void)
ePaintOverlayControlFlags BKE_paint_get_overlay_flags(void)
{
return overlay_flags;
}
@@ -143,7 +143,7 @@ void BKE_paint_set_overlay_override(eOverlayFlags flags)
}
}
void BKE_paint_reset_overlay_invalid(eOverlayControlFlags flag)
void BKE_paint_reset_overlay_invalid(ePaintOverlayControlFlags flag)
{
overlay_flags &= ~(flag);
}

View File

@@ -252,14 +252,14 @@ static int load_tex(Brush *br, ViewContext *vc, float zoom, bool col, bool prima
TexSnapshot *target;
MTex *mtex = (primary) ? &br->mtex : &br->mask_mtex;
eOverlayControlFlags overlay_flags = BKE_paint_get_overlay_flags();
ePaintOverlayControlFlags overlay_flags = BKE_paint_get_overlay_flags();
GLubyte *buffer = NULL;
int size;
bool refresh;
eOverlayControlFlags invalid = ((primary) ?
(overlay_flags & PAINT_OVERLAY_INVALID_TEXTURE_PRIMARY) :
(overlay_flags & PAINT_OVERLAY_INVALID_TEXTURE_SECONDARY));
ePaintOverlayControlFlags invalid =
((primary) ? (overlay_flags & PAINT_OVERLAY_INVALID_TEXTURE_PRIMARY) :
(overlay_flags & PAINT_OVERLAY_INVALID_TEXTURE_SECONDARY));
target = (primary) ? &primary_snap : &secondary_snap;
refresh = !target->overlay_texture || (invalid != 0) ||
@@ -422,7 +422,7 @@ static int load_tex_cursor(Brush *br, ViewContext *vc, float zoom)
{
bool init;
eOverlayControlFlags overlay_flags = BKE_paint_get_overlay_flags();
ePaintOverlayControlFlags overlay_flags = BKE_paint_get_overlay_flags();
GLubyte *buffer = NULL;
int size;
@@ -836,7 +836,7 @@ static bool paint_draw_alpha_overlay(UnifiedPaintSettings *ups,
bool alpha_overlay_active = false;
eOverlayControlFlags flags = BKE_paint_get_overlay_flags();
ePaintOverlayControlFlags flags = BKE_paint_get_overlay_flags();
gpuPushAttr(GPU_DEPTH_BUFFER_BIT | GPU_BLEND_BIT);
/* Translate to region. */

View File

@@ -3535,15 +3535,15 @@ static void do_elastic_deform_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, in
static ePaintSymmetryAreas sculpt_get_vertex_symm_area(const float co[3])
{
ePaintSymmetryAreas symm_area = AREA_SYMM_DEFAULT;
ePaintSymmetryAreas symm_area = PAINT_SYMM_AREA_DEFAULT;
if (co[0] < 0.0f) {
symm_area |= AREA_SYMM_X;
symm_area |= PAINT_SYMM_AREA_X;
}
if (co[1] < 0.0f) {
symm_area |= AREA_SYMM_Y;
symm_area |= PAINT_SYMM_AREA_Y;
}
if (co[2] < 0.0f) {
symm_area |= AREA_SYMM_Z;
symm_area |= PAINT_SYMM_AREA_Z;
}
return symm_area;
}
@@ -3584,9 +3584,9 @@ static void sculpt_flip_quat_by_symm_area(float quat[3],
}
}
static void pose_solve_ik_chain(PoseIKChain *ik_chain, const float initial_target[3])
static void pose_solve_ik_chain(SculptPoseIKChain *ik_chain, const float initial_target[3])
{
PoseIKChainSegment *segments = ik_chain->segments;
SculptPoseIKChainSegment *segments = ik_chain->segments;
int tot_segments = ik_chain->tot_segments;
float target[3];
@@ -3633,9 +3633,11 @@ static void pose_solve_ik_chain(PoseIKChain *ik_chain, const float initial_targe
}
}
static void pose_solve_roll_chain(PoseIKChain *ik_chain, const Brush *brush, const float roll)
static void pose_solve_roll_chain(SculptPoseIKChain *ik_chain,
const Brush *brush,
const float roll)
{
PoseIKChainSegment *segments = ik_chain->segments;
SculptPoseIKChainSegment *segments = ik_chain->segments;
int tot_segments = ik_chain->tot_segments;
for (int i = 0; i < tot_segments; i++) {
@@ -3663,8 +3665,8 @@ static void do_pose_brush_task_cb_ex(void *__restrict userdata,
{
SculptThreadedTaskData *data = userdata;
SculptSession *ss = data->ob->sculpt;
PoseIKChain *ik_chain = ss->cache->pose_ik_chain;
PoseIKChainSegment *segments = ik_chain->segments;
SculptPoseIKChain *ik_chain = ss->cache->pose_ik_chain;
SculptPoseIKChainSegment *segments = ik_chain->segments;
PBVHVertexIter vd;
float disp[3], new_co[3];
@@ -3729,7 +3731,7 @@ static void do_pose_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode)
return;
}
PoseIKChain *ik_chain = ss->cache->pose_ik_chain;
SculptPoseIKChain *ik_chain = ss->cache->pose_ik_chain;
/* Solve the positions and rotations of the IK chain. */
if (ss->cache->invert) {
@@ -4067,7 +4069,7 @@ static void pose_brush_init_task_cb_ex(void *__restrict userdata,
BKE_pbvh_vertex_iter_end;
}
void sculpt_pose_ik_chain_free(PoseIKChain *ik_chain)
void sculpt_pose_ik_chain_free(SculptPoseIKChain *ik_chain)
{
for (int i = 0; i < ik_chain->tot_segments; i++) {
MEM_SAFE_FREE(ik_chain->segments[i].weights);
@@ -4076,12 +4078,12 @@ void sculpt_pose_ik_chain_free(PoseIKChain *ik_chain)
MEM_SAFE_FREE(ik_chain);
}
PoseIKChain *sculpt_pose_ik_chain_init(Sculpt *sd,
Object *ob,
SculptSession *ss,
Brush *br,
const float initial_location[3],
const float radius)
SculptPoseIKChain *sculpt_pose_ik_chain_init(Sculpt *sd,
Object *ob,
SculptSession *ss,
Brush *br,
const float initial_location[3],
const float radius)
{
float chain_end[3];
@@ -4105,9 +4107,9 @@ PoseIKChain *sculpt_pose_ik_chain_init(Sculpt *sd,
pose_factor_grow[nearest_vertex_index] = 1.0f;
/* Init the IK chain with empty weights. */
PoseIKChain *ik_chain = MEM_callocN(sizeof(PoseIKChain), "Pose IK Chain");
SculptPoseIKChain *ik_chain = MEM_callocN(sizeof(SculptPoseIKChain), "Pose IK Chain");
ik_chain->tot_segments = br->pose_ik_segments;
ik_chain->segments = MEM_callocN(ik_chain->tot_segments * sizeof(PoseIKChainSegment),
ik_chain->segments = MEM_callocN(ik_chain->tot_segments * sizeof(SculptPoseIKChainSegment),
"Pose IK Chain Segments");
for (int i = 0; i < br->pose_ik_segments; i++) {
ik_chain->segments[i].weights = MEM_callocN(totvert * sizeof(float), "Pose IK weights");

View File

@@ -37,7 +37,7 @@ struct KeyBlock;
struct Object;
struct SculptUndoNode;
struct bContext;
struct PoseIKChainSegment;
struct SculptPoseIKChainSegment;
bool sculpt_mode_poll(struct bContext *C);
bool sculpt_mode_poll_view3d(struct bContext *C);
@@ -75,14 +75,14 @@ void sculpt_pose_calc_pose_data(struct Sculpt *sd,
float *r_pose_origin,
float *r_pose_factor);
struct PoseIKChain *sculpt_pose_ik_chain_init(struct Sculpt *sd,
struct Object *ob,
struct SculptSession *ss,
struct Brush *br,
const float initial_location[3],
const float radius);
struct SculptPoseIKChain *sculpt_pose_ik_chain_init(struct Sculpt *sd,
struct Object *ob,
struct SculptSession *ss,
struct Brush *br,
const float initial_location[3],
const float radius);
void sculpt_pose_ik_chain_free(struct PoseIKChain *ik_chain);
void sculpt_pose_ik_chain_free(struct SculptPoseIKChain *ik_chain);
/* Sculpt PBVH abstraction API */
const float *sculpt_vertex_co_get(struct SculptSession *ss, int index);
@@ -388,7 +388,7 @@ typedef struct StrokeCache {
float anchored_location[3];
/* Pose brush */
struct PoseIKChain *pose_ik_chain;
struct SculptPoseIKChain *pose_ik_chain;
float vertex_rotation; /* amount to rotate the vertices when using rotate brush */
struct Dial *dial;