[Bf-blender-cvs] [0e37045f32f] master: Cleanup: use paint/sculpt prefix in BKE_paint.h

Campbell Barton noreply at git.blender.org
Wed Jan 8 03:02:24 CET 2020


Commit: 0e37045f32f35ff2264838fbaadd48ca7f2a0117
Author: Campbell Barton
Date:   Wed Jan 8 12:59:48 2020 +1100
Branches: master
https://developer.blender.org/rB0e37045f32f35ff2264838fbaadd48ca7f2a0117

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.

===================================================================

M	source/blender/blenkernel/BKE_paint.h
M	source/blender/blenkernel/intern/paint.c
M	source/blender/editors/sculpt_paint/paint_cursor.c
M	source/blender/editors/sculpt_paint/sculpt.c
M	source/blender/editors/sculpt_paint/sculpt_intern.h

===================================================================

diff --git a/source/blender/blenkernel/BKE_paint.h b/source/blender/blenkernel/BKE_paint.h
index 6089db5ed46..db35fbde2c8 100644
--- a/source/blender/blenkernel/BKE_paint.h
+++ b/source/blender/blenkernel/BKE_paint.h
@@ -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];
diff --git a/source/blender/blenkernel/intern/paint.c b/source/blender/blenkernel/intern/paint.c
index 0c03f1db729..a334a088e0f 100644
--- a/source/blender/blenkernel/intern/paint.c
+++ b/source/blender/blenkernel/intern/paint.c
@@ -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);
 }
diff --git a/source/blender/editors/sculpt_paint/paint_cursor.c b/source/blender/editors/sculpt_paint/paint_cursor.c
index 9bc587de6da..19b4b9f569c 100644
--- a/source/blender/editors/sculpt_paint/paint_cursor.c
+++ b/source/blender/editors/sculpt_paint/paint_cursor.c
@@ -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. */
diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c
index c350cb3b48a..a9334edd39b 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -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_cal

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list