[Bf-blender-cvs] [2f4344e] soc-2013-paint: Merge branch 'master' into soc-2013-paint

Antony Riakiotakis noreply at git.blender.org
Thu Apr 17 19:00:38 CEST 2014


Commit: 2f4344e3e320a4d06d445a1e5b4d9d45ae02ff23
Author: Antony Riakiotakis
Date:   Thu Apr 17 20:00:18 2014 +0300
https://developer.blender.org/rB2f4344e3e320a4d06d445a1e5b4d9d45ae02ff23

Merge branch 'master' into soc-2013-paint

Conflicts:
	source/blender/blenkernel/intern/cdderivedmesh.c
	source/blender/blenkernel/intern/subsurf_ccg.c
	source/blender/blenloader/intern/versioning_270.c
	source/blender/editors/include/UI_interface.h
	source/blender/editors/sculpt_paint/paint_image_2d.c
	source/blender/editors/sculpt_paint/paint_stroke.c
	source/blender/editors/sculpt_paint/paint_utils.c
	source/blender/makesdna/DNA_scene_types.h

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



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

diff --cc source/blender/blenkernel/intern/brush.c
index a83ace7,8e611a1..fc9be23
--- a/source/blender/blenkernel/intern/brush.c
+++ b/source/blender/blenkernel/intern/brush.c
@@@ -763,17 -743,6 +757,17 @@@ float BKE_brush_sample_masktex(const Sc
  		          rgba, rgba + 1, rgba + 2, rgba + 3, thread, pool);
  	}
  
 +	switch(br->mask_pressure) {
 +		case BRUSH_MASK_PRESSURE_CUTOFF:
- 			intensity  = ((1.0 - intensity) < ups->pressure_value)? 1.0 : 0.0;
++			intensity  = ((1.0 - intensity) < ups->size_pressure_value)? 1.0 : 0.0;
 +			break;
 +		case BRUSH_MASK_PRESSURE_RAMP:
- 			intensity = ups->pressure_value + intensity*(1.0 - ups->pressure_value);
++			intensity = ups->size_pressure_value + intensity*(1.0 - ups->size_pressure_value);
 +			break;
 +		default:
 +			break;
 +	}
 +
  	return intensity;
  }
  
diff --cc source/blender/blenkernel/intern/cdderivedmesh.c
index 22cb8f2,5f38eb6..4d6763c
--- a/source/blender/blenkernel/intern/cdderivedmesh.c
+++ b/source/blender/blenkernel/intern/cdderivedmesh.c
@@@ -761,31 -757,36 +779,36 @@@ static void cdDM_drawFacesTex_common(De
  				}
  
  				glBegin(mf->v4 ? GL_QUADS : GL_TRIANGLES);
 -				if (tf) glTexCoord2fv(tf[i].uv[0]);
 +				if (tf) glTexCoord2fv(tf->uv[0]);
  				if (cp) glColor3ub(cp[3], cp[2], cp[1]);
  				mvert = &mv[mf->v1];
- 				if (mf->flag & ME_SMOOTH) glNormal3sv(mvert->no);
+ 				if (lnors) glNormal3sv((const GLshort *)lnors[0][0]);
+ 				else if (mf->flag & ME_SMOOTH) glNormal3sv(mvert->no);
  				glVertex3fv(mvert->co);
- 					
+ 
 -				if (tf) glTexCoord2fv(tf[i].uv[1]);
 +				if (tf) glTexCoord2fv(tf->uv[1]);
  				if (cp) glColor3ub(cp[7], cp[6], cp[5]);
  				mvert = &mv[mf->v2];
- 				if (mf->flag & ME_SMOOTH) glNormal3sv(mvert->no);
+ 				if (lnors) glNormal3sv((const GLshort *)lnors[0][1]);
+ 				else if (mf->flag & ME_SMOOTH) glNormal3sv(mvert->no);
  				glVertex3fv(mvert->co);
  
 -				if (tf) glTexCoord2fv(tf[i].uv[2]);
 +				if (tf) glTexCoord2fv(tf->uv[2]);
  				if (cp) glColor3ub(cp[11], cp[10], cp[9]);
  				mvert = &mv[mf->v3];
- 				if (mf->flag & ME_SMOOTH) glNormal3sv(mvert->no);
+ 				if (lnors) glNormal3sv((const GLshort *)lnors[0][2]);
+ 				else if (mf->flag & ME_SMOOTH) glNormal3sv(mvert->no);
  				glVertex3fv(mvert->co);
  
  				if (mf->v4) {
 -					if (tf) glTexCoord2fv(tf[i].uv[3]);
 +					if (tf) glTexCoord2fv(tf->uv[3]);
  					if (cp) glColor3ub(cp[15], cp[14], cp[13]);
  					mvert = &mv[mf->v4];
- 					if (mf->flag & ME_SMOOTH) glNormal3sv(mvert->no);
+ 					if (lnors) glNormal3sv((const GLshort *)lnors[0][3]);
+ 					else if (mf->flag & ME_SMOOTH) glNormal3sv(mvert->no);
  					glVertex3fv(mvert->co);
  				}
+ 				if (lnors) lnors++;
  				glEnd();
  			}
  			
@@@ -1082,12 -1098,13 +1123,13 @@@ static void cdDM_drawMappedFaces(Derive
  static void cdDM_drawMappedFacesTex(DerivedMesh *dm,
                                      DMSetDrawOptions setDrawOptions,
                                      DMCompareDrawOptions compareDrawOptions,
 -                                    void *userData)
 +                                    void *userData, DMDrawFlag flag)
  {
 -	cdDM_drawFacesTex_common(dm, NULL, setDrawOptions, compareDrawOptions, userData);
 +	cdDM_drawFacesTex_common(dm, NULL, setDrawOptions, compareDrawOptions, userData, flag);
  }
  
- static void cddm_draw_attrib_vertex(DMVertexAttribs *attribs, MVert *mvert, int a, int index, int vert, int smoothnormal)
+ static void cddm_draw_attrib_vertex(DMVertexAttribs *attribs, MVert *mvert, int a, int index, int vert,
+                                     short (*lnor)[3], int smoothnormal)
  {
  	const float zero[4] = {0.0f, 0.0f, 0.0f, 0.0f};
  	int b;
diff --cc source/blender/blenkernel/intern/subsurf_ccg.c
index a9b7207,252d513..a4ee12c
--- a/source/blender/blenkernel/intern/subsurf_ccg.c
+++ b/source/blender/blenkernel/intern/subsurf_ccg.c
@@@ -2161,7 -2261,7 +2262,8 @@@ static void ccgDM_drawFacesTex_common(D
  	CCGKey key;
  	MCol *mcol = dm->getTessFaceDataArray(dm, CD_PREVIEW_MCOL);
  	MTFace *tf = DM_get_tessface_data_layer(dm, CD_MTFACE);
 +	MTFace *tf_base;
+ 	short (*lnors)[4][3] = dm->getTessFaceDataArray(dm, CD_TESSLOOPNORMAL);
  	DMFlagMat *faceFlags = ccgdm->faceFlags;
  	DMDrawOption draw_option;
  	int i, totface, gridSize = ccgSubSurf_getGridSize(ss);
diff --cc source/blender/blenloader/intern/versioning_270.c
index 93a1c61,2dd227e..64d435f
--- a/source/blender/blenloader/intern/versioning_270.c
+++ b/source/blender/blenloader/intern/versioning_270.c
@@@ -162,10 -164,11 +164,19 @@@ void blo_do_versions_270(FileData *fd, 
  	}
  
  	if (!MAIN_VERSION_ATLEAST(main, 270, 2)) {
+ 		Mesh *me;
+ 
+ 		/* Mesh smoothresh deg->rad. */
+ 		for (me = main->mesh.first; me; me = me->id.next) {
+ 			me->smoothresh = DEG2RADF(me->smoothresh);
+ 		}
+ 	}
++
++	if (!MAIN_VERSION_ATLEAST(main, 270, 3)) {
 +		Scene *sce;
 +		for (sce = main->scene.first; sce; sce = sce->id.next) {
 +			sce->toolsettings->imapaint.new_slot_xresolution = 1024;
 +			sce->toolsettings->imapaint.new_slot_yresolution = 1024;
 +		}
 +	}
  }
diff --cc source/blender/editors/include/UI_interface.h
index c5c4ead,32db99f..54206fd
--- a/source/blender/editors/include/UI_interface.h
+++ b/source/blender/editors/include/UI_interface.h
@@@ -437,9 -433,7 +438,9 @@@ void    uiButSetDragName(uiBut *but, co
  void    uiButSetDragValue(uiBut *but);
  void    uiButSetDragImage(uiBut *but, const char *path, int icon, struct ImBuf *ima, float scale);
  
- int     UI_but_active_drop_name(struct bContext *C);
- int     UI_but_active_drop_color(struct bContext *C);
+ bool    UI_but_active_drop_name(struct bContext *C);
++bool    UI_but_active_drop_color(struct bContext *C);
 +struct uiBut  *ui_but_find_mouse_over(struct ARegion *ar, const struct wmEvent *event);
  
  void    uiButSetFlag(uiBut *but, int flag);
  void    uiButClearFlag(uiBut *but, int flag);
diff --cc source/blender/editors/interface/interface_handlers.c
index 39c358c,b4dc74c..8a60796
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@@ -6374,17 -6261,6 +6374,17 @@@ bool UI_but_active_drop_name(bContext *
  	return 0;
  }
  
- int UI_but_active_drop_color(bContext *C)
++bool UI_but_active_drop_color(bContext *C)
 +{
 +	ARegion *ar = CTX_wm_region(C);
 +	uiBut *but = ui_but_find_activated(ar);
 +
 +	if (but && but->type == COLOR)
- 		return 1;
++		return true;
 +
- 	return 0;
++	return false;
 +}
 +
  static void ui_blocks_set_tooltips(ARegion *ar, const bool enable)
  {
  	uiBlock *block;
diff --cc source/blender/editors/sculpt_paint/paint_image.c
index 07fbd4f,6961064..6eab555
--- a/source/blender/editors/sculpt_paint/paint_image.c
+++ b/source/blender/editors/sculpt_paint/paint_image.c
@@@ -635,49 -453,6 +635,50 @@@ typedef struct PaintOperation 
  	ViewContext vc;
  } PaintOperation;
  
 +bool paint_use_opacity_masking(Brush *brush)
 +{
 +	return (brush->flag & BRUSH_AIRBRUSH) ||
 +	       (brush->flag & BRUSH_DRAG_DOT) ||
 +	       (brush->flag & BRUSH_ANCHORED) ||
 +	       (brush->imagepaint_tool == PAINT_TOOL_SMEAR) ||
 +	       (brush->imagepaint_tool == PAINT_TOOL_SOFTEN) ||
 +	       (brush->imagepaint_tool == PAINT_TOOL_FILL) ||
 +	       (brush->flag & BRUSH_USE_GRADIENT) ||
 +	       (brush->mtex.tex && !ELEM3(brush->mtex.brush_map_mode, MTEX_MAP_MODE_TILED, MTEX_MAP_MODE_STENCIL, MTEX_MAP_MODE_3D)) ?
 +	            false : true;
 +}
 +
- void paint_brush_color_get(struct Brush *br, bool color_correction, bool invert, float distance, float pressure, float color[3])
++void paint_brush_color_get(struct Brush *br, bool color_correction, bool invert, float distance,
++                           float pressure, float color[3], struct ColorManagedDisplay *display)
 +{
 +	if (invert)
 +		copy_v3_v3(color, br->secondary_rgb);
 +	else {
 +		if (br->flag & BRUSH_USE_GRADIENT) {
 +			switch (br->gradient_stroke_mode) {
 +				case BRUSH_GRADIENT_PRESSURE:
 +					do_colorband(br->gradient, pressure, color);
 +					break;
 +				case BRUSH_GRADIENT_SPACING_REPEAT:
 +				{
 +					float coord = fmod(distance / br->gradient_spacing, 1.0);
 +					do_colorband(br->gradient, coord, color);
 +					break;
 +				}
 +				case BRUSH_GRADIENT_SPACING_CLAMP:
 +				{
 +					do_colorband(br->gradient, distance / br->gradient_spacing, color);
 +					break;
 +				}
 +			}
 +		}
 +		else
 +			copy_v3_v3(color, br->rgb);
 +	}
 +	if (color_correction)
- 		srgb_to_linearrgb_v3_v3(color, color);
++		IMB_colormanagement_display_to_scene_linear_v3(color, display);
 +}
 +
  void paint_brush_init_tex(Brush *brush)
  {
  	/* init mtex nodes */
diff --cc source/blender/editors/sculpt_paint/paint_image_2d.c
index 0d22eb9,c15d481..efe793d
--- a/source/blender/editors/sculpt_paint/paint_image_2d.c
+++ b/source/blender/editors/sculpt_paint/paint_image_2d.c
@@@ -373,9 -233,14 +373,12 @@@ static ImBuf *brush_painter_imbuf_new(B
  	Scene *scene = painter->scene;
  	Brush *brush = painter->brush;
  
+ 	const char *display_device = scene->display_settings.display_device;
+ 	struct ColorManagedDisplay *display = IMB_colormanagement_display_get_named(display_device);
+ 
  	rctf tex_mapping = painter->tex_mapping;
 -	rctf mask_mapping = painter->mask_mapping;
  	struct ImagePool *pool = painter->pool;
  
 -	bool use_masking = painter->cache.use_masking;
  	bool use_color_correction = painter->cache.use_color_correction;
  	bool use_float = painter->cache.use_float;
  	bool is_texbrush = painter->cache.is_texbrush;
@@@ -388,7 -259,11 +391,7 @@@
  
  	/* get brush color */
  	if (brush->imagepaint_tool == PAINT_TOOL_DRAW) {
- 		paint_brush_color_get(brush, use_color_correction, painter->cache.invert, distance, pressure, brush_rgb);
 -		copy_v3_v3(brush_rgb, brush->rgb);
 -
 -		if (use_color_correction) {
 -			IMB_colormanagement_display_to_scene_linear_v3(brush_rgb, display);
 -		}
++		paint_brush_color_get(brush, use_color_correction, painter->cache.invert, distance, pressure, brush_rgb, display);
  	}
  	else {
  		brush_rgb[0] = 1.0f;
@@@ -442,9 -330,14 +445,12 @@@ static void brush_painter_imbuf_update(
  	Scene *scene = painter->scene;
  	Brush *brush = painter->brush;
  
+ 	const char *display_device = scene->display_settings.dis

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list