[Bf-blender-cvs] [bc67467f506] PSketch-279: PSculpt: XKEY and ZKEY can be used to toggle axis locks for sculpt brushes (WIP code)

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


Commit: bc67467f506746dd11da3d4d3d7fba806964274e
Author: Joshua Leung
Date:   Tue Jan 2 04:58:38 2018 +1300
Branches: PSketch-279
https://developer.blender.org/rBbc67467f506746dd11da3d4d3d7fba806964274e

PSculpt: XKEY and ZKEY can be used to toggle axis locks for sculpt brushes (WIP code)

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

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 8562d733196..93ed3938c6c 100644
--- a/source/blender/editors/armature/pose_sculpt.c
+++ b/source/blender/editors/armature/pose_sculpt.c
@@ -2198,6 +2198,43 @@ static int psculpt_brush_modal(bContext *C, wmOperator *op, const wmEvent *event
 			redraw_region = true;
 			redraw_toolsettings = true;
 			break;
+			
+		/* Dynamically toggle XZ locks */
+		case XKEY:
+			if (pso->brush->xzMode == PSCULPT_BRUSH_DO_XZ) {
+				/* only do X (i.e. we're trying to restrict things) */
+				pso->brush->xzMode = PSCULPT_BRUSH_DO_X;
+			}
+			else if (pso->brush->xzMode == PSCULPT_BRUSH_DO_X) {
+				/* only do Z (as we can't keep doing X now) */
+				pso->brush->xzMode = PSCULPT_BRUSH_DO_Z;
+			}
+			else {
+				/* clear all restrictions */
+				pso->brush->xzMode = PSCULPT_BRUSH_DO_XZ;
+			}
+			
+			// TODO: recalc immediately
+			redraw_toolsettings = true;
+			break;
+		
+		case ZKEY:
+			if (pso->brush->xzMode == PSCULPT_BRUSH_DO_XZ) {
+				/* only do Z (i.e. we're trying to restrict things) */
+				pso->brush->xzMode = PSCULPT_BRUSH_DO_Z;
+			}
+			else if (pso->brush->xzMode == PSCULPT_BRUSH_DO_Z) {
+				/* only do X (as we can't keep doing Z now) */
+				pso->brush->xzMode = PSCULPT_BRUSH_DO_X;
+			}
+			else {
+				/* clear all restrictions */
+				pso->brush->xzMode = PSCULPT_BRUSH_DO_XZ;
+			}
+			
+			// TODO: recalc immediately
+			redraw_toolsettings = true;
+			break;
 	}
 	
 	/* Redraw region? */



More information about the Bf-blender-cvs mailing list