[Bf-blender-cvs] [35eb4e9866f] PSketch-279: Push Brush: Tweaks for controllability

Joshua Leung noreply at git.blender.org
Tue May 8 18:03:23 CEST 2018


Commit: 35eb4e9866ffe1f77d0d5e70f7960d9437417a2b
Author: Joshua Leung
Date:   Sun Dec 31 18:10:05 2017 +1300
Branches: PSketch-279
https://developer.blender.org/rB35eb4e9866ffe1f77d0d5e70f7960d9437417a2b

Push Brush: Tweaks for controllability

* Allow restricting movement on X/Z axes for greater control,
  especially on odd axes

* Add header tips for this brush. To be refined later!

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

M	release/scripts/startup/bl_ui/space_view3d_toolbar.py
M	source/blender/editors/armature/pose_sculpt.c

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

diff --git a/release/scripts/startup/bl_ui/space_view3d_toolbar.py b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
index 1178267452e..4d75b382da0 100644
--- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py
+++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
@@ -925,7 +925,7 @@ class VIEW3D_PT_tools_posemode_sculpt(View3DPanel, Panel):
 
         if tool in ('GRAB', 'PUSH', 'DRAW', 'ADJUST'):
             layout.prop(brush, "use_initial_only")
-        if tool in ('CURL', 'STRETCH'):
+        if tool in ('PUSH', 'CURL', 'STRETCH'):
             layout.row().prop(brush, "xz_mode", expand=True)
 
         if tool == 'STRETCH':
diff --git a/source/blender/editors/armature/pose_sculpt.c b/source/blender/editors/armature/pose_sculpt.c
index 958080cf150..8562d733196 100644
--- a/source/blender/editors/armature/pose_sculpt.c
+++ b/source/blender/editors/armature/pose_sculpt.c
@@ -292,6 +292,10 @@ static void psculpt_brush_header_info(bContext *C)
 		case PSCULPT_BRUSH_RESET:
 			ED_area_headerprint(sa, IFACE_("Reset Pose: Paint to blend pose back to rest pose  |  Shift to Invert (blend pose back to pre-sculpt condition)"));
 			break;
+			
+		case PSCULPT_BRUSH_PUSH:
+			ED_area_headerprint(sa, IFACE_("Push Shape: Move to adjust shape of bendy bones"));
+			break;
 		
 		default:
 			ED_area_headerprint(sa, IFACE_("Pose Sculpting in progress..."));
@@ -1519,6 +1523,7 @@ static void psculpt_brush_push_apply(tPoseSculptingOp *pso, bPoseChannel *pchan,
 	float mid[2];
 	
 	bool do_head = false, do_tail = false;
+	bool do_x = false, do_z = false;
 	float fac;
 	
 	/* skip if bone is not a bendy bone */
@@ -1537,9 +1542,6 @@ static void psculpt_brush_push_apply(tPoseSculptingOp *pso, bPoseChannel *pchan,
 		if (tab == NULL) {
 			return;
 		}
-#if 0 // XXX: Save values below!
-		
-#endif
 	}
 	
 	/* compute inverse matrix to convert from screen-space to bone space */
@@ -1573,6 +1575,16 @@ static void psculpt_brush_push_apply(tPoseSculptingOp *pso, bPoseChannel *pchan,
 		do_head = do_tail = true;
 	}
 	
+	
+	/* affect x/z axes? */
+	if (ELEM(brush->xzMode, PSCULPT_BRUSH_DO_XZ, PSCULPT_BRUSH_DO_X)) {
+		do_x = true;
+	}
+	if (ELEM(brush->xzMode, PSCULPT_BRUSH_DO_XZ, PSCULPT_BRUSH_DO_Z)) {
+		do_z = true;	
+	}
+	
+	
 	/* compute effect to apply */
 	if (tab) {
 		/* If "grab initial" is in use, use the stored fac instead of
@@ -1603,12 +1615,12 @@ static void psculpt_brush_push_apply(tPoseSculptingOp *pso, bPoseChannel *pchan,
 	// TODO: Use pressure/fac to adjust ease in/out? Or perhaps the y-values?
 	// TODO: Clamp values to prevent overshooting the max bounds?
 	if (do_head) {
-		pchan->curveInX += delta[0];
-		pchan->curveInY += delta[2];
+		if (do_x) pchan->curveInX += delta[0];
+		if (do_z) pchan->curveInY += delta[2];
 	}
 	if (do_tail) {
-		pchan->curveOutX += delta[0];
-		pchan->curveOutY += delta[2];
+		if (do_x) pchan->curveOutX += delta[0];
+		if (do_z) pchan->curveOutY += delta[2];
 	}
 	
 	/* move the endpoints of the bone too? */



More information about the Bf-blender-cvs mailing list