[Bf-blender-cvs] [6b477cfecbd] PSketch-279: WIP: Start of setting up a new Draw brush

Joshua Leung noreply at git.blender.org
Tue May 8 18:04:16 CEST 2018


Commit: 6b477cfecbda47b1ec2f84547d43776b81af4d55
Author: Joshua Leung
Date:   Wed Jan 24 17:56:55 2018 +1300
Branches: PSketch-279
https://developer.blender.org/rB6b477cfecbda47b1ec2f84547d43776b81af4d55

WIP: Start of setting up a new Draw brush

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

M	source/blender/editors/armature/pose_sculpt.c

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

diff --git a/source/blender/editors/armature/pose_sculpt.c b/source/blender/editors/armature/pose_sculpt.c
index dc35464c011..0e1b64795c9 100644
--- a/source/blender/editors/armature/pose_sculpt.c
+++ b/source/blender/editors/armature/pose_sculpt.c
@@ -106,6 +106,7 @@ typedef struct tPoseSculptingOp {
 	
 	/* Brush Specific Data */
 	float dvec[3];                /* mouse travel vector, or something else */
+	float pathlen;                /* total distance covered by the brush so far (3d space) */
 	
 	float center[3];              /* center of rotation */
 	float angle;                  /* angle of rotation */
@@ -267,7 +268,7 @@ static void psculpt_brush_header_info(bContext *C)
 	
 	switch (pset->brushtype) {
 		case PSCULPT_BRUSH_DRAW:
-			ED_area_headerprint(sa, IFACE_("Pose Sculpting: Draw Pose"));
+			ED_area_headerprint(sa, IFACE_("Pose Sculpting: Move to define the curvature of the bone chain under the brush"));
 			break;
 			
 		case PSCULPT_BRUSH_ADJUST:
@@ -1229,6 +1230,25 @@ static void psculpt_brush_rotate_apply(tPoseSculptingOp *pso, bPoseChannel *pcha
 	pchan_do_rotate(pso->ob, pchan, rmat);
 }
 
+/* Draw ------------------------------------------------ */
+
+/* "Draw" brush - Initial grab - Use to test what's under the mouse */
+static void psculpt_brush_draw_apply_first(tPoseSculptingOp *pso, bPoseChannel *pchan, float dist, float sco1[2], float sco2[2])
+{
+	
+}
+
+
+/* "Draw" brush - In-chain - Apply to a single bone */
+// XXX: Is this even needed?
+
+
+/* "Draw" brush - In-chain - Find bones to affect */
+static void psculpt_brush_do_draw_apply(tPoseSculptingOp *pso)
+{
+	// 1) Compute distance travelled
+	// 2) Check if on to next bone
+}
 
 /* Curl ------------------------------------------------ */
 
@@ -2020,7 +2040,22 @@ static void psculpt_brush_apply(bContext *C, wmOperator *op, PointerRNA *itemptr
 		
 		/* apply brushes */
 		switch (pso->brush_type) {
-			case PSCULPT_BRUSH_DRAW: // XXX: placeholder... we need a proper "draw" brush
+			case PSCULPT_BRUSH_DRAW:
+			{
+				/* Only test what's under the brush on the initial step.
+				 * After that, we'll only add extra bones based on the total
+				 * accumulated stroke length.
+				 */
+				if (pso->first) {
+					changed = psculpt_brush_do_apply(pso, psculpt_brush_draw_apply_first);
+				}
+				else {
+					ED_view3d_win_to_delta(pso->ar, delta, pso->dvec, zfac); // XXX?
+					changed = psculpt_brush_do_draw_apply(pso);
+				}
+				break;
+			}
+			
 			case PSCULPT_BRUSH_ADJUST:
 			{
 				if (pso->invert) {



More information about the Bf-blender-cvs mailing list