[Bf-blender-cvs] [cea843c] soc-2016-pbvh-painting: Moved StrokeCache to sculpt_intern.h and included sculpt_intern.h in paint_vertex.c similar to how sculpt.c includes paint_intern.h.

Nathan Vollmer noreply at git.blender.org
Fri May 27 05:22:16 CEST 2016


Commit: cea843c83aa9f45d5a6cca4e9cbcbdba2892b05f
Author: Nathan Vollmer
Date:   Thu May 26 21:22:04 2016 -0600
Branches: soc-2016-pbvh-painting
https://developer.blender.org/rBcea843c83aa9f45d5a6cca4e9cbcbdba2892b05f

Moved StrokeCache to sculpt_intern.h and included sculpt_intern.h in paint_vertex.c similar to how sculpt.c includes paint_intern.h.

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

M	source/blender/editors/sculpt_paint/paint_vertex.c
M	source/blender/editors/sculpt_paint/sculpt.c
M	source/blender/editors/sculpt_paint/sculpt_intern.h

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

diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c
index cfc9b34..ea131f1 100644
--- a/source/blender/editors/sculpt_paint/paint_vertex.c
+++ b/source/blender/editors/sculpt_paint/paint_vertex.c
@@ -75,6 +75,7 @@
 #include "ED_screen.h"
 #include "ED_view3d.h"
 
+#include "sculpt_intern.h"
 #include "paint_intern.h"  /* own include */
 
 /* small structure to defer applying weight-paint results */
@@ -1748,7 +1749,6 @@ static int wpaint_mode_toggle_exec(bContext *C, wmOperator *op)
 	Scene *scene = CTX_data_scene(C);
 	VPaint *wp = scene->toolsettings->wpaint;
 	Mesh *me;
-
 	if (!is_mode_set) {
 		if (!ED_object_mode_compat_set(C, ob, mode_flag, op->reports)) {
 			return OPERATOR_CANCELLED;
diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c
index 1700ba5..8723c9b 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -37,7 +37,6 @@
 
 #include "BLI_math.h"
 #include "BLI_blenlib.h"
-#include "BLI_dial.h"
 #include "BLI_task.h"
 #include "BLI_threads.h"
 #include "BLI_utildefines.h"
@@ -51,7 +50,6 @@
 #include "DNA_node_types.h"
 #include "DNA_object_types.h"
 #include "DNA_scene_types.h"
-#include "DNA_brush_types.h"
 
 #include "BKE_pbvh.h"
 #include "BKE_brush.h"
@@ -79,7 +77,6 @@
 #include "ED_sculpt.h"
 #include "ED_object.h"
 #include "ED_screen.h"
-#include "ED_view3d.h"
 #include "paint_intern.h"
 #include "sculpt_intern.h"
 
@@ -165,111 +162,12 @@ static bool sculpt_brush_needs_rake_rotation(const Brush *brush)
 	return SCULPT_TOOL_HAS_RAKE(brush->sculpt_tool) && (brush->rake_factor != 0.0f);
 }
 
-/* Factor of brush to have rake point following behind
- * (could be configurable but this is reasonable default). */
-#define SCULPT_RAKE_BRUSH_FACTOR 0.25f
-
-struct SculptRakeData {
-	float follow_dist;
-	float follow_co[3];
-};
-
 typedef enum StrokeFlags {
 	CLIP_X = 1,
 	CLIP_Y = 2,
 	CLIP_Z = 4
 } StrokeFlags;
 
-/* Cache stroke properties. Used because
- * RNA property lookup isn't particularly fast.
- *
- * For descriptions of these settings, check the operator properties.
- */
-typedef struct StrokeCache {
-	/* Invariants */
-	float initial_radius;
-	float scale[3];
-	int flag;
-	float clip_tolerance[3];
-	float initial_mouse[2];
-
-	/* Variants */
-	float radius;
-	float radius_squared;
-	float true_location[3];
-	float location[3];
-
-	bool pen_flip;
-	bool invert;
-	float pressure;
-	float mouse[2];
-	float bstrength;
-	float normal_weight;  /* from brush (with optional override) */
-
-	/* The rest is temporary storage that isn't saved as a property */
-
-	bool first_time; /* Beginning of stroke may do some things special */
-
-	/* from ED_view3d_ob_project_mat_get() */
-	float projection_mat[4][4];
-
-	/* Clean this up! */
-	ViewContext *vc;
-	Brush *brush;
-
-	float special_rotation;
-	float grab_delta[3], grab_delta_symmetry[3];
-	float old_grab_location[3], orig_grab_location[3];
-
-	/* screen-space rotation defined by mouse motion */
-	float   rake_rotation[4], rake_rotation_symmetry[4];
-	bool is_rake_rotation_valid;
-	struct SculptRakeData rake_data;
-
-	int symmetry; /* Symmetry index between 0 and 7 bit combo 0 is Brush only;
-	               * 1 is X mirror; 2 is Y mirror; 3 is XY; 4 is Z; 5 is XZ; 6 is YZ; 7 is XYZ */
-	int mirror_symmetry_pass; /* the symmetry pass we are currently on between 0 and 7*/
-	float true_view_normal[3];
-	float view_normal[3];
-
-	/* sculpt_normal gets calculated by calc_sculpt_normal(), then the
-	 * sculpt_normal_symm gets updated quickly with the usual symmetry
-	 * transforms */
-	float sculpt_normal[3];
-	float sculpt_normal_symm[3];
-
-	/* Used for area texture mode, local_mat gets calculated by
-	 * calc_brush_local_mat() and used in tex_strength(). */
-	float brush_local_mat[4][4];
-	
-	float plane_offset[3]; /* used to shift the plane around when doing tiled strokes */
-	int tile_pass;
-
-	float last_center[3];
-	int radial_symmetry_pass;
-	float symm_rot_mat[4][4];
-	float symm_rot_mat_inv[4][4];
-	bool original;
-	float anchored_location[3];
-
-	float vertex_rotation; /* amount to rotate the vertices when using rotate brush */
-	Dial *dial;
-	
-	char saved_active_brush_name[MAX_ID_NAME];
-	char saved_mask_brush_tool;
-	int saved_smooth_size; /* smooth tool copies the size of the current tool */
-	bool alt_smooth;
-
-	float plane_trim_squared;
-
-	bool supports_gravity;
-	float true_gravity_direction[3];
-	float gravity_direction[3];
-
-	rcti previous_r; /* previous redraw rectangle */
-	rcti current_r; /* current redraw rectangle */
-} StrokeCache;
-
 /************** Access to original unmodified vertex data *************/
 
 typedef struct {
diff --git a/source/blender/editors/sculpt_paint/sculpt_intern.h b/source/blender/editors/sculpt_paint/sculpt_intern.h
index 108fe35..ca7b5a1 100644
--- a/source/blender/editors/sculpt_paint/sculpt_intern.h
+++ b/source/blender/editors/sculpt_paint/sculpt_intern.h
@@ -36,10 +36,14 @@
 #include "DNA_listBase.h"
 #include "DNA_vec_types.h"
 #include "DNA_key_types.h"
+#include "DNA_brush_types.h"
 
 #include "BLI_bitmap.h"
+#include "BLI_dial.h"
 #include "BKE_pbvh.h"
 
+#include "ED_view3d.h"
+
 struct bContext;
 struct KeyBlock;
 struct Object;
@@ -115,6 +119,106 @@ typedef struct SculptUndoNode {
 	char shapeName[sizeof(((KeyBlock *)0))->name];
 } SculptUndoNode;
 
+/* Factor of brush to have rake point following behind
+* (could be configurable but this is reasonable default). */
+#define SCULPT_RAKE_BRUSH_FACTOR 0.25f
+
+struct SculptRakeData {
+	float follow_dist;
+	float follow_co[3];
+};
+
+/* Cache stroke properties. Used because
+* RNA property lookup isn't particularly fast.
+*
+* For descriptions of these settings, check the operator properties.
+*/
+
+typedef struct StrokeCache {
+	/* Invariants */
+	float initial_radius;
+	float scale[3];
+	int flag;
+	float clip_tolerance[3];
+	float initial_mouse[2];
+
+	/* Variants */
+	float radius;
+	float radius_squared;
+	float true_location[3];
+	float location[3];
+
+	bool pen_flip;
+	bool invert;
+	float pressure;
+	float mouse[2];
+	float bstrength;
+	float normal_weight;  /* from brush (with optional override) */
+
+	/* The rest is temporary storage that isn't saved as a property */
+
+	bool first_time; /* Beginning of stroke may do some things special */
+
+	/* from ED_view3d_ob_project_mat_get() */
+	float projection_mat[4][4];
+
+	/* Clean this up! */
+	ViewContext *vc;
+	Brush *brush;
+
+	float special_rotation;
+	float grab_delta[3], grab_delta_symmetry[3];
+	float old_grab_location[3], orig_grab_location[3];
+
+	/* screen-space rotation defined by mouse motion */
+	float   rake_rotation[4], rake_rotation_symmetry[4];
+	bool is_rake_rotation_valid;
+	struct SculptRakeData rake_data;
+
+	int symmetry; /* Symmetry index between 0 and 7 bit combo 0 is Brush only;
+				  * 1 is X mirror; 2 is Y mirror; 3 is XY; 4 is Z; 5 is XZ; 6 is YZ; 7 is XYZ */
+	int mirror_symmetry_pass; /* the symmetry pass we are currently on between 0 and 7*/
+	float true_view_normal[3];
+	float view_normal[3];
+
+	/* sculpt_normal gets calculated by calc_sculpt_normal(), then the
+	* sculpt_normal_symm gets updated quickly with the usual symmetry
+	* transforms */
+	float sculpt_normal[3];
+	float sculpt_normal_symm[3];
+
+	/* Used for area texture mode, local_mat gets calculated by
+	* calc_brush_local_mat() and used in tex_strength(). */
+	float brush_local_mat[4][4];
+
+	float plane_offset[3]; /* used to shift the plane around when doing tiled strokes */
+	int tile_pass;
+
+	float last_center[3];
+	int radial_symmetry_pass;
+	float symm_rot_mat[4][4];
+	float symm_rot_mat_inv[4][4];
+	bool original;
+	float anchored_location[3];
+
+	float vertex_rotation; /* amount to rotate the vertices when using rotate brush */
+	Dial *dial;
+
+	char saved_active_brush_name[MAX_ID_NAME];
+	char saved_mask_brush_tool;
+	int saved_smooth_size; /* smooth tool copies the size of the current tool */
+	bool alt_smooth;
+
+	float plane_trim_squared;
+
+	bool supports_gravity;
+	float true_gravity_direction[3];
+	float gravity_direction[3];
+
+	rcti previous_r; /* previous redraw rectangle */
+	rcti current_r; /* current redraw rectangle */
+} StrokeCache;
+
 SculptUndoNode *sculpt_undo_push_node(Object *ob, PBVHNode *node, SculptUndoType type);
 SculptUndoNode *sculpt_undo_get_node(PBVHNode *node);
 void sculpt_undo_push_begin(const char *name);




More information about the Bf-blender-cvs mailing list