[Bf-blender-cvs] [8b03dd8e9d6] soc-2017-sculpting_brush: Updated files to create Clipping brush

decoda noreply at git.blender.org
Mon Jun 5 19:05:28 CEST 2017


Commit: 8b03dd8e9d6563e1d4c009bf5f7ea144a3e1de07
Author: decoda
Date:   Mon Jun 5 22:33:10 2017 +0530
Branches: soc-2017-sculpting_brush
https://developer.blender.org/rB8b03dd8e9d6563e1d4c009bf5f7ea144a3e1de07

Updated files to create Clipping brush

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

M	release/datafiles/brushicons/clip.png
M	source/blender/blenkernel/intern/brush.c
M	source/blender/blenkernel/intern/scene.c
M	source/blender/blenloader/intern/versioning_270.c
M	source/blender/blenloader/intern/versioning_defaults.c
M	source/blender/editors/datafiles/CMakeLists.txt
M	source/blender/editors/include/ED_datafiles.h
M	source/blender/editors/include/UI_icons.h
M	source/blender/editors/interface/interface_icons.c
M	source/blender/editors/sculpt_paint/paint_ops.c
M	source/blender/editors/sculpt_paint/sculpt.c
M	source/blender/makesdna/DNA_brush_types.h
M	source/blender/makesdna/DNA_scene_types.h
M	source/blender/makesrna/intern/rna_brush.c

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

diff --git a/release/datafiles/brushicons/clip.png b/release/datafiles/brushicons/clip.png
index ce5e418bb79..f5ad388e002 100644
Binary files a/release/datafiles/brushicons/clip.png and b/release/datafiles/brushicons/clip.png differ
diff --git a/source/blender/blenkernel/intern/brush.c b/source/blender/blenkernel/intern/brush.c
index 57b707a31d3..0801e346107 100644
--- a/source/blender/blenkernel/intern/brush.c
+++ b/source/blender/blenkernel/intern/brush.c
@@ -406,6 +406,11 @@ void BKE_brush_sculpt_reset(Brush *br)
 			br->sub_col[0] = 0.250000;
 			br->sub_col[1] = 1.000000;
 			break;
+		case SCULPT_TOOL_CLIP:
+			br->add_col[1] = 1.000000;
+			br->sub_col[0] = 0.250000;
+			br->sub_col[1] = 1.000000;
+			break;
 		case SCULPT_TOOL_ROTATE:
 			br->alpha = 1.0;
 			break;
diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c
index 5933aaccd66..60b86efc384 100644
--- a/source/blender/blenkernel/intern/scene.c
+++ b/source/blender/blenkernel/intern/scene.c
@@ -815,6 +815,11 @@ void BKE_scene_init(Scene *sce)
 		gp_brush->size = 50;
 		gp_brush->strength = 0.5f; // XXX?
 		gp_brush->flag = GP_EDITBRUSH_FLAG_USE_FALLOFF;
+
+		gp_brush = &gset->brush[GP_EDITBRUSH_TYPE_CLIP];  /*clipping*/
+		gp_brush->size = 40;
+		gp_brush->strength = 0.5f; // XXX?
+		gp_brush->flag = GP_EDITBRUSH_FLAG_USE_FALLOFF;
 		
 		gp_brush = &gset->brush[GP_EDITBRUSH_TYPE_RANDOMIZE];
 		gp_brush->size = 25;
diff --git a/source/blender/blenloader/intern/versioning_270.c b/source/blender/blenloader/intern/versioning_270.c
index d2f43a2d79e..259826a6a2b 100644
--- a/source/blender/blenloader/intern/versioning_270.c
+++ b/source/blender/blenloader/intern/versioning_270.c
@@ -1525,7 +1525,7 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *main)
 				ParticleEditSettings *pset = &ts->particle;
 				for (int a = 0; a < PE_TOT_BRUSH; a++) {
 					if (pset->brush[a].count == 0) {
-						pset->brush[a].count = 10;
+						pset->brush[a].count = 11;
 					}
 				}
 			}
diff --git a/source/blender/blenloader/intern/versioning_defaults.c b/source/blender/blenloader/intern/versioning_defaults.c
index e34f12b1cf9..41fceb951c2 100644
--- a/source/blender/blenloader/intern/versioning_defaults.c
+++ b/source/blender/blenloader/intern/versioning_defaults.c
@@ -144,6 +144,11 @@ void BLO_update_defaults_startup_blend(Main *bmain)
 				brush->size = 50;
 				brush->strength = 0.5f; // XXX?
 				brush->flag = GP_EDITBRUSH_FLAG_USE_FALLOFF;
+
+				brush = &gset->brush[GP_EDITBRUSH_TYPE_CLIP];  /* clipping */
+				brush->size = 40;
+				brush->strength = 0.5f; // XXX?
+				brush->flag = GP_EDITBRUSH_FLAG_USE_FALLOFF;
 				
 				brush = &gset->brush[GP_EDITBRUSH_TYPE_RANDOMIZE];
 				brush->size = 25;
diff --git a/source/blender/editors/datafiles/CMakeLists.txt b/source/blender/editors/datafiles/CMakeLists.txt
index 2a84ca7f297..2c59a9e6756 100644
--- a/source/blender/editors/datafiles/CMakeLists.txt
+++ b/source/blender/editors/datafiles/CMakeLists.txt
@@ -70,6 +70,7 @@ if(WITH_BLENDER)
 		data_to_c_simple(../../../../release/datafiles/brushicons/blob.png SRC)
 		data_to_c_simple(../../../../release/datafiles/brushicons/blur.png SRC)
 		data_to_c_simple(../../../../release/datafiles/brushicons/clay.png SRC)
+        data_to_c_simple(../../../../release/datafiles/brushicons/clip.png SRC)
 		data_to_c_simple(../../../../release/datafiles/brushicons/claystrips.png SRC)
 		data_to_c_simple(../../../../release/datafiles/brushicons/clone.png SRC)
 		data_to_c_simple(../../../../release/datafiles/brushicons/crease.png SRC)
diff --git a/source/blender/editors/include/ED_datafiles.h b/source/blender/editors/include/ED_datafiles.h
index 661ab58b98c..b1458bb08be 100644
--- a/source/blender/editors/include/ED_datafiles.h
+++ b/source/blender/editors/include/ED_datafiles.h
@@ -105,6 +105,9 @@ extern char datatoc_flatten_png[];
 extern int datatoc_grab_png_size;
 extern char datatoc_grab_png[];
 
+extern int datatoc_clip_png_size;
+extern char datatoc_clip_png[];
+
 extern int datatoc_inflate_png_size;
 extern char datatoc_inflate_png[];
 
diff --git a/source/blender/editors/include/UI_icons.h b/source/blender/editors/include/UI_icons.h
index 8420591aa3e..2c7032ca68a 100644
--- a/source/blender/editors/include/UI_icons.h
+++ b/source/blender/editors/include/UI_icons.h
@@ -950,6 +950,7 @@ DEF_ICON(BRUSH_BLOB)
 DEF_ICON(BRUSH_BLUR)
 DEF_ICON(BRUSH_CLAY)
 DEF_ICON(BRUSH_CLAY_STRIPS)
+DEF_ICON(BRUSH_CLIP)
 DEF_ICON(BRUSH_CLONE)
 DEF_ICON(BRUSH_CREASE)
 DEF_ICON(BRUSH_DARKEN)
diff --git a/source/blender/editors/interface/interface_icons.c b/source/blender/editors/interface/interface_icons.c
index 65b12fcd64e..6cc85fa065c 100644
--- a/source/blender/editors/interface/interface_icons.c
+++ b/source/blender/editors/interface/interface_icons.c
@@ -374,6 +374,7 @@ static void init_brush_icons(void)
 	INIT_BRUSH_ICON(ICON_BRUSH_FILL, fill);
 	INIT_BRUSH_ICON(ICON_BRUSH_FLATTEN, flatten);
 	INIT_BRUSH_ICON(ICON_BRUSH_GRAB, grab);
+	INIT_BRUSH_ICON(ICON_BRUSH_CLIP, clip);
 	INIT_BRUSH_ICON(ICON_BRUSH_INFLATE, inflate);
 	INIT_BRUSH_ICON(ICON_BRUSH_LAYER, layer);
 	INIT_BRUSH_ICON(ICON_BRUSH_LIGHTEN, lighten);
diff --git a/source/blender/editors/sculpt_paint/paint_ops.c b/source/blender/editors/sculpt_paint/paint_ops.c
index f88b64129e7..6842e6a5fb8 100644
--- a/source/blender/editors/sculpt_paint/paint_ops.c
+++ b/source/blender/editors/sculpt_paint/paint_ops.c
@@ -1592,6 +1592,7 @@ void ED_keymap_paint(wmKeyConfig *keyconf)
 	keymap_brush_select(keymap, OB_MODE_SCULPT, SCULPT_TOOL_PINCH, PKEY, 0);
 	keymap_brush_select(keymap, OB_MODE_SCULPT, SCULPT_TOOL_INFLATE, IKEY, 0);
 	keymap_brush_select(keymap, OB_MODE_SCULPT, SCULPT_TOOL_GRAB, GKEY, 0);
+	keymap_brush_select(keymap, OB_MODE_SCULPT, SCULPT_TOOL_CLIP, YKEY, 0);
 	keymap_brush_select(keymap, OB_MODE_SCULPT, SCULPT_TOOL_LAYER, LKEY, 0);
 	keymap_brush_select(keymap, OB_MODE_SCULPT, SCULPT_TOOL_FLATTEN, TKEY, KM_SHIFT);
 	keymap_brush_select(keymap, OB_MODE_SCULPT, SCULPT_TOOL_CLAY, CKEY, 0);
diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c
index 44cc2720a32..bcbb92e4468 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -1230,7 +1230,6 @@ static float brush_strength(
 
 		case SCULPT_TOOL_ROTATE:
 			return alpha * pressure * feather;
-
 		default:
 			return 0;
 	}
@@ -3053,6 +3052,12 @@ static void do_clay_strips_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int t
 	            ((sd->flags & SCULPT_USE_OPENMP) && totnode > SCULPT_THREADED_LIMIT), false);
 }
 
+static void do_clip_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode)  /*clipping*/
+{
+	// some functions in future
+
+}
+
 static void do_fill_brush_task_cb_ex(
         void *userdata, void *UNUSED(userdata_chunk), const int n, const int thread_id)
 {
@@ -3439,6 +3444,9 @@ static void do_brush_action(Sculpt *sd, Object *ob, Brush *brush, UnifiedPaintSe
 			case SCULPT_TOOL_ROTATE:
 				do_rotate_brush(sd, ob, nodes, totnode);
 				break;
+			case SCULPT_TOOL_CLIP: /*CLIP*/
+				do_clip_brush(sd, ob, nodes, totnode);
+				break;
 			case SCULPT_TOOL_SNAKE_HOOK:
 				do_snake_hook_brush(sd, ob, nodes, totnode);
 				break;
@@ -3915,6 +3923,8 @@ static const char *sculpt_tool_name(Sculpt *sd)
 			return "Inflate Brush";
 		case SCULPT_TOOL_GRAB:
 			return "Grab Brush";
+		case SCULPT_TOOL_CLIP:  /*clip*/
+			return "Clip Brush";
 		case SCULPT_TOOL_NUDGE:
 			return "Nudge Brush";
 		case SCULPT_TOOL_THUMB:
diff --git a/source/blender/makesdna/DNA_brush_types.h b/source/blender/makesdna/DNA_brush_types.h
index f4a1677efc4..4d4d6a2cf9d 100644
--- a/source/blender/makesdna/DNA_brush_types.h
+++ b/source/blender/makesdna/DNA_brush_types.h
@@ -252,7 +252,8 @@ typedef enum BrushSculptTool {
 	SCULPT_TOOL_CREASE = 16,
 	SCULPT_TOOL_BLOB = 17,
 	SCULPT_TOOL_CLAY_STRIPS = 18,
-	SCULPT_TOOL_MASK = 19
+	SCULPT_TOOL_MASK = 19,
+	SCULPT_TOOL_CLIP = 20
 } BrushSculptTool;
 
 /** When #BRUSH_ACCUMULATE is used */
diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h
index c2711c465e1..ffd895aa7d6 100644
--- a/source/blender/makesdna/DNA_scene_types.h
+++ b/source/blender/makesdna/DNA_scene_types.h
@@ -1191,7 +1191,7 @@ typedef enum eGP_EditBrush_Types {
 	GP_EDITBRUSH_TYPE_SIMPLIFY  = 8,
 	GP_EDITBRUSH_TYPE_CLONE     = 9,
 	GP_EDITBRUSH_TYPE_STRENGTH  = 10,
-
+	GP_EDITBRUSH_TYPE_CLIP = 11,
 	/* !!! Update GP_EditBrush_Data brush[###]; below !!! */
 	TOT_GP_EDITBRUSH_TYPES
 } eGP_EditBrush_Types;
@@ -1229,7 +1229,7 @@ typedef enum eGP_EditBrush_Flag {
 
 /* GPencil Stroke Sculpting Settings */
 typedef struct GP_BrushEdit_Settings {
-	GP_EditBrush_Data brush[11];  /* TOT_GP_EDITBRUSH_TYPES */
+	GP_EditBrush_Data brush[12];  /* TOT_GP_EDITBRUSH_TYPES */
 	void *paintcursor;            /* runtime */
 	
 	int brushtype;                /* eGP_EditBrush_Types */
diff --git a/source/blender/makesrna/intern/rna_brush.c b/source/blender/makesrna/intern/rna_brush.c
index ac348c1750c..fab4ccc1d75 100644
--- a/source/blender/makesrna/intern/rna_brush.c
+++ b/source/blender/makesrna/intern/rna_brush.c
@@ -71,6 +71,7 @@ EnumPropertyItem rna_enum_brush_sculpt_tool_items[] = {
 	{SCULPT_TOOL_FILL, "FILL", ICON_BRUSH_FILL, "Fill", ""},
 	{SCULPT_TOOL_FLATTEN, "FLATTEN", ICON_BRUSH_FLATTEN, "Flatten", ""},
 	{SCULPT_TOOL_GRAB, "GRAB", ICON_BRUSH_GRAB, "Grab", ""},
+	{SCULPT_TOOL_CLIP, "CLIP", ICON_BRUSH_CLIP, "Clip", ""},
 	{SCULPT_TOOL_INFLATE, "INFLATE", ICON_BRUSH_INFLATE, "Inflate", ""},
 	{SCULPT_TOOL_LAYER, "LAYER", ICON_BRUSH_LAYER, "Layer", ""},
 	{SCULPT_TOOL_MASK, "MASK", ICON_BRUSH_MASK, "Mask", ""},




More information about the Bf-blender-cvs mailing list