[Bf-blender-cvs] [2b3b481c3d6] blender2.8: Merge branch 'master' into blender2.8

Campbell Barton noreply at git.blender.org
Wed Nov 14 01:29:43 CET 2018


Commit: 2b3b481c3d6553e7a4dd90efc25518fe8e1a5bc6
Author: Campbell Barton
Date:   Wed Nov 14 11:24:37 2018 +1100
Branches: blender2.8
https://developer.blender.org/rB2b3b481c3d6553e7a4dd90efc25518fe8e1a5bc6

Merge branch 'master' into blender2.8

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



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

diff --cc source/blender/blenkernel/BKE_paint.h
index 6f54e2b3b17,eedf5f7985e..e09aed4b372
--- a/source/blender/blenkernel/BKE_paint.h
+++ b/source/blender/blenkernel/BKE_paint.h
@@@ -75,18 -68,18 +75,19 @@@ extern const char PAINT_CURSOR_WEIGHT_P
  extern const char PAINT_CURSOR_TEXTURE_PAINT[3];
  
  typedef enum ePaintMode {
- 	ePaintSculpt = 0,
+ 	PAINT_MODE_SCULPT = 0,
  	/** Vertex color. */
- 	ePaintVertex = 1,
- 	ePaintWeight = 2,
+ 	PAINT_MODE_VERTEX = 1,
+ 	PAINT_MODE_WEIGHT = 2,
  	/** 3D view (projection painting). */
- 	ePaintTexture3D = 3,
+ 	PAINT_MODE_TEXTURE_3D = 3,
  	/** Image space (2D painting). */
- 	ePaintTexture2D = 4,
- 	ePaintSculptUV = 5,
- 	ePaintGpencil = 6,
+ 	PAINT_MODE_TEXTURE_2D = 4,
+ 	PAINT_MODE_SCULPT_UV = 5,
++	PAINT_MODE_GPENCIL = 6,
  
- 	ePaintInvalid = 7,
+ 	/** Keep last. */
 -	PAINT_MODE_INVALID = 6
++	PAINT_MODE_INVALID = 7,
  } ePaintMode;
  
  /* overlay invalidation */
@@@ -99,12 -92,13 +100,13 @@@ typedef enum eOverlayControlFlags 
  	PAINT_OVERLAY_OVERRIDE_SECONDARY = (1 << 6)
  } eOverlayControlFlags;
  
- #define PAINT_OVERRIDE_MASK (PAINT_OVERLAY_OVERRIDE_SECONDARY | \
- 						     PAINT_OVERLAY_OVERRIDE_PRIMARY | \
- 						     PAINT_OVERLAY_OVERRIDE_CURSOR)
+ #define PAINT_OVERRIDE_MASK \
+ 	(PAINT_OVERLAY_OVERRIDE_SECONDARY | \
+ 	 PAINT_OVERLAY_OVERRIDE_PRIMARY | \
+ 	 PAINT_OVERLAY_OVERRIDE_CURSOR)
  
 -void BKE_paint_invalidate_overlay_tex(struct Scene *scene, const struct Tex *tex);
 -void BKE_paint_invalidate_cursor_overlay(struct Scene *scene, struct CurveMapping *curve);
 +void BKE_paint_invalidate_overlay_tex(struct Scene *scene, struct ViewLayer *view_layer, const struct Tex *tex);
 +void BKE_paint_invalidate_cursor_overlay(struct Scene *scene, struct ViewLayer *view_layer, struct CurveMapping *curve);
  void BKE_paint_invalidate_overlay_all(void);
  eOverlayControlFlags BKE_paint_get_overlay_flags(void);
  void BKE_paint_reset_overlay_invalid(eOverlayControlFlags flag);
diff --cc source/blender/blenkernel/intern/paint.c
index e31021d7d48,dd5d801d2ac..24782af4d22
--- a/source/blender/blenkernel/intern/paint.c
+++ b/source/blender/blenkernel/intern/paint.c
@@@ -99,14 -83,14 +99,14 @@@ void BKE_paint_invalidate_overlay_tex(S
  		return;
  
  	if (br->mtex.tex == tex)
- 		overlay_flags |= PAINT_INVALID_OVERLAY_TEXTURE_PRIMARY;
+ 		overlay_flags |= PAINT_OVERLAY_INVALID_TEXTURE_PRIMARY;
  	if (br->mask_mtex.tex == tex)
- 		overlay_flags |= PAINT_INVALID_OVERLAY_TEXTURE_SECONDARY;
+ 		overlay_flags |= PAINT_OVERLAY_INVALID_TEXTURE_SECONDARY;
  }
  
 -void BKE_paint_invalidate_cursor_overlay(Scene *scene, CurveMapping *curve)
 +void BKE_paint_invalidate_cursor_overlay(Scene *scene, ViewLayer *view_layer, CurveMapping *curve)
  {
 -	Paint *p = BKE_paint_get_active(scene);
 +	Paint *p = BKE_paint_get_active(scene, view_layer);
  	Brush *br = p->brush;
  
  	if (br && br->curve == curve)
@@@ -151,20 -135,18 +151,20 @@@ Paint *BKE_paint_get_active_from_paintm
  		ToolSettings *ts = sce->toolsettings;
  
  		switch (mode) {
- 			case ePaintSculpt:
+ 			case PAINT_MODE_SCULPT:
  				return &ts->sculpt->paint;
- 			case ePaintVertex:
+ 			case PAINT_MODE_VERTEX:
  				return &ts->vpaint->paint;
- 			case ePaintWeight:
+ 			case PAINT_MODE_WEIGHT:
  				return &ts->wpaint->paint;
- 			case ePaintTexture2D:
- 			case ePaintTexture3D:
+ 			case PAINT_MODE_TEXTURE_2D:
+ 			case PAINT_MODE_TEXTURE_3D:
  				return &ts->imapaint.paint;
- 			case ePaintSculptUV:
+ 			case PAINT_MODE_SCULPT_UV:
  				return &ts->uvsculpt->paint;
- 			case ePaintGpencil:
++			case PAINT_MODE_GPENCIL:
 +				return &ts->gp_paint->paint;
- 			case ePaintInvalid:
+ 			case PAINT_MODE_INVALID:
  				return NULL;
  			default:
  				return &ts->imapaint.paint;
@@@ -174,50 -156,13 +174,50 @@@
  	return NULL;
  }
  
 -Paint *BKE_paint_get_active(Scene *sce)
 +const EnumPropertyItem *BKE_paint_get_tool_enum_from_paintmode(ePaintMode mode)
  {
 -	if (sce) {
 +	switch (mode) {
- 		case ePaintSculpt:
++		case PAINT_MODE_SCULPT:
 +			return rna_enum_brush_sculpt_tool_items;
- 		case ePaintVertex:
++		case PAINT_MODE_VERTEX:
 +			return rna_enum_brush_vertex_tool_items;
- 		case ePaintWeight:
++		case PAINT_MODE_WEIGHT:
 +			return rna_enum_brush_weight_tool_items;
- 		case ePaintTexture2D:
- 		case ePaintTexture3D:
++		case PAINT_MODE_TEXTURE_2D:
++		case PAINT_MODE_TEXTURE_3D:
 +			return rna_enum_brush_image_tool_items;
- 		case ePaintSculptUV:
++		case PAINT_MODE_SCULPT_UV:
 +			return NULL;
- 		case ePaintGpencil:
++		case PAINT_MODE_GPENCIL:
 +			return rna_enum_brush_gpencil_types_items;
- 		case ePaintInvalid:
++		case PAINT_MODE_INVALID:
 +			break;
 +	}
 +	return NULL;
 +}
 +
 +const char *BKE_paint_get_tool_prop_id_from_paintmode(ePaintMode mode)
 +{
 +	switch (mode) {
- 		case ePaintSculpt: return "sculpt_tool";
- 		case ePaintVertex: return "vertex_tool";
- 		case ePaintWeight: return "weight_tool";
- 		case ePaintTexture2D:
- 		case ePaintTexture3D: return "image_tool";
- 		case ePaintGpencil: return "gpencil_tool";
++		case PAINT_MODE_SCULPT: return "sculpt_tool";
++		case PAINT_MODE_VERTEX: return "vertex_tool";
++		case PAINT_MODE_WEIGHT: return "weight_tool";
++		case PAINT_MODE_TEXTURE_2D:
++		case PAINT_MODE_TEXTURE_3D: return "image_tool";
++		case PAINT_MODE_GPENCIL: return "gpencil_tool";
 +		default:
 +			/* invalid paint mode */
 +			return NULL;
 +	}
 +}
 +
 +Paint *BKE_paint_get_active(Scene *sce, ViewLayer *view_layer)
 +{
 +	if (sce && view_layer) {
  		ToolSettings *ts = sce->toolsettings;
  
 -		if (sce->basact && sce->basact->object) {
 -			switch (sce->basact->object->mode) {
 +		if (view_layer->basact && view_layer->basact->object) {
 +			switch (view_layer->basact->object->mode) {
  				case OB_MODE_SCULPT:
  					return &ts->sculpt->paint;
  				case OB_MODE_VERTEX_PAINT:
@@@ -324,35 -263,9 +324,35 @@@ ePaintMode BKE_paintmode_get_active_fro
  		}
  	}
  
- 	return ePaintInvalid;
+ 	return PAINT_MODE_INVALID;
  }
  
 +ePaintMode BKE_paintmode_get_from_tool(const struct bToolRef *tref)
 +{
 +	if (tref->space_type == SPACE_VIEW3D) {
 +		switch (tref->mode) {
 +			case CTX_MODE_SCULPT:
- 				return ePaintSculpt;
++				return PAINT_MODE_SCULPT;
 +			case CTX_MODE_PAINT_VERTEX:
- 				return ePaintVertex;
++				return PAINT_MODE_VERTEX;
 +			case CTX_MODE_PAINT_WEIGHT:
- 				return ePaintWeight;
++				return PAINT_MODE_WEIGHT;
 +			case CTX_MODE_GPENCIL_PAINT:
- 				return ePaintGpencil;
++				return PAINT_MODE_GPENCIL;
 +			case CTX_MODE_PAINT_TEXTURE:
- 				return ePaintTexture3D;
++				return PAINT_MODE_TEXTURE_3D;
 +		}
 +	}
 +	else if (tref->space_type == SPACE_IMAGE) {
 +		switch (tref->mode) {
 +			case SI_MODE_PAINT:
- 				return ePaintTexture2D;
++				return PAINT_MODE_TEXTURE_2D;
 +		}
 +	}
 +
- 	return ePaintInvalid;
++	return PAINT_MODE_INVALID;
 +}
 +
  Brush *BKE_paint_brush(Paint *p)
  {
  	return p ? p->brush : NULL;
@@@ -401,27 -280,6 +401,27 @@@ void BKE_paint_runtime_init(const ToolS
  	}
  }
  
 +uint BKE_paint_get_brush_tool_offset_from_paintmode(const ePaintMode mode)
 +{
 +	switch (mode) {
- 		case ePaintTexture2D:
- 		case ePaintTexture3D:
++		case PAINT_MODE_TEXTURE_2D:
++		case PAINT_MODE_TEXTURE_3D:
 +			return offsetof(Brush, imagepaint_tool);
- 		case ePaintSculpt:
++		case PAINT_MODE_SCULPT:
 +			return offsetof(Brush, sculpt_tool);
- 		case ePaintVertex:
++		case PAINT_MODE_VERTEX:
 +			return offsetof(Brush, vertexpaint_tool);
- 		case ePaintWeight:
++		case PAINT_MODE_WEIGHT:
 +			return offsetof(Brush, weightpaint_tool);
- 		case ePaintGpencil:
++		case PAINT_MODE_GPENCIL:
 +			return offsetof(Brush, gpencil_tool);
- 		case ePaintSculptUV:
- 		case ePaintInvalid:
++		case PAINT_MODE_SCULPT_UV:
++		case PAINT_MODE_INVALID:
 +			break; /* We don't use these yet. */
 +	}
 +	return 0;
 +}
 +
  /** Free (or release) any data used by this paint curve (does not free the pcurve itself). */
  void BKE_paint_curve_free(PaintCurve *pc)
  {
@@@ -617,21 -477,22 +617,21 @@@ void BKE_paint_cavity_curve_preset(Pain
  	curvemapping_changed(p->cavity_curve, false);
  }
  
 -eObjectMode BKE_paint_object_mode_from_paint_mode(ePaintMode mode)
 +eObjectMode BKE_paint_object_mode_from_paintmode(ePaintMode mode)
  {
  	switch (mode) {
- 		case ePaintSculpt:
+ 		case PAINT_MODE_SCULPT:
  			return OB_MODE_SCULPT;
- 		case ePaintVertex:
+ 		case PAINT_MODE_VERTEX:
  			return OB_MODE_VERTEX_PAINT;
- 		case ePaintWeight:
+ 		case PAINT_MODE_WEIGHT:
  			return OB_MODE_WEIGHT_PAINT;
- 		case ePaintTexture2D:
- 		case ePaintTexture3D:
 -		case PAINT_MODE_TEXTURE_3D:
 -			return OB_MODE_TEXTURE_PAINT;
+ 		case PAINT_MODE_TEXTURE_2D:
++		case PAINT_MODE_TEXTURE_3D:
  			return OB_MODE_TEXTURE_PAINT;
- 		case ePaintSculptUV:
+ 		case PAINT_MODE_SCULPT_UV:
  			return OB_MODE_EDIT;
- 		case ePaintInvalid:
+ 		case PAINT_MODE_INVALID:
  		default:
  			return 0;
  	}
diff --cc source/blender/editors/interface/interface_icons.c
index 69f42fbfc07,eed7f2ec0f2..d8bdeaa8159
--- a/source/blender/editors/interface/interface_icons.c
+++ b/source/blender/editors/interface/interface_icons.c
@@@ -1670,106 -1187,48 +1670,106 @@@ static int ui_id_brush_get_icon(const b
  
  	if (br->flag & BRUSH_CUSTOM_ICON) {
  		BKE_icon_id_ensure(id);
 -		ui_id_brush_render(C, id);
 +		ui_id_icon_render(C, id, true);
  	}
  	else {
 +		WorkSpace *workspace = CTX_wm_workspace(C);
  		Object *ob = CTX_data_active_object(C);
 -		SpaceImage *sima;
  		const EnumPropertyItem *items = NULL;
- 		ePaintMode paint_mode = ePaintInvalid;
 -		int tool = PAINT_TOOL_DRAW, mode = 0;
++		ePaintMode paint_mode = PAINT_MODE_INVALID;
 +		ScrArea *sa = CTX_wm_area(C);
 +		char space_type = sa->spacetype;
 +		/* When in an unsupported space. */
 +		if (!ELEM(space_type, SPACE_VIEW3D, SPACE_IMAGE)) {
 +			space_type = workspace->tools_space_type;
 +		}
  
  		/* XXX: this is not nice, should probably make brushes
  		 * be strictly in one paint mode only to avoid
  		 * checking various context stuff here */
  
 -		if (CTX_wm_view3d(C) && ob) {
 -			if (ob->mode & OB_MODE_SCULPT)
 -				mode = OB_MODE_SCULPT;
 -			else if (ob->mode & (OB_MODE_VERTEX_PAINT | OB_MODE_WEIGHT_PAINT))
 -				mode = OB_MODE_VERTEX_PAINT;
 -			else if (ob->mode & OB_MODE_TEXTUR

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list