[Bf-blender-cvs] [101fd08348e] blender2.8: Merge branch 'master' into blender2.8
Campbell Barton
noreply at git.blender.org
Wed Nov 7 02:01:20 CET 2018
Commit: 101fd08348e5717f98af93481e6cc97d3bf920c3
Author: Campbell Barton
Date: Wed Nov 7 11:58:57 2018 +1100
Branches: blender2.8
https://developer.blender.org/rB101fd08348e5717f98af93481e6cc97d3bf920c3
Merge branch 'master' into blender2.8
===================================================================
===================================================================
diff --cc source/blender/blenkernel/BKE_paint.h
index b4b667ecb6b,a132af41567..6f54e2b3b17
--- a/source/blender/blenkernel/BKE_paint.h
+++ b/source/blender/blenkernel/BKE_paint.h
@@@ -76,14 -69,15 +76,17 @@@ extern const char PAINT_CURSOR_TEXTURE_
typedef enum ePaintMode {
ePaintSculpt = 0,
+ /** Vertex color. */
ePaintVertex = 1,
ePaintWeight = 2,
- ePaintTextureProjective = 3,
+ /** 3D view (projection painting). */
+ ePaintTexture3D = 3,
+ /** Image space (2D painting). */
ePaintTexture2D = 4,
ePaintSculptUV = 5,
- ePaintInvalid = 6
+ ePaintGpencil = 6,
+
+ ePaintInvalid = 7,
} ePaintMode;
/* overlay invalidation */
diff --cc source/blender/blenkernel/intern/paint.c
index db7cd513bf4,0541bd58c85..e31021d7d48
--- a/source/blender/blenkernel/intern/paint.c
+++ b/source/blender/blenkernel/intern/paint.c
@@@ -174,50 -156,13 +174,50 @@@ Paint *BKE_paint_get_active_from_paintm
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:
+ return rna_enum_brush_sculpt_tool_items;
+ case ePaintVertex:
+ return rna_enum_brush_vertex_tool_items;
+ case ePaintWeight:
+ return rna_enum_brush_weight_tool_items;
+ case ePaintTexture2D:
- case ePaintTextureProjective:
++ case ePaintTexture3D:
+ return rna_enum_brush_image_tool_items;
+ case ePaintSculptUV:
+ return NULL;
+ case ePaintGpencil:
+ return rna_enum_brush_gpencil_types_items;
+ case ePaintInvalid:
+ 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 ePaintTextureProjective: return "image_tool";
++ case ePaintTexture3D: return "image_tool";
+ case ePaintGpencil: 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:
@@@ -327,32 -266,6 +327,32 @@@ ePaintMode BKE_paintmode_get_active_fro
return ePaintInvalid;
}
+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;
+ case CTX_MODE_PAINT_VERTEX:
+ return ePaintVertex;
+ case CTX_MODE_PAINT_WEIGHT:
+ return ePaintWeight;
+ case CTX_MODE_GPENCIL_PAINT:
+ return ePaintGpencil;
+ case CTX_MODE_PAINT_TEXTURE:
- return ePaintTextureProjective;
++ return ePaintTexture3D;
+ }
+ }
+ else if (tref->space_type == SPACE_IMAGE) {
+ switch (tref->mode) {
+ case SI_MODE_PAINT:
+ return ePaintTexture2D;
+ }
+ }
+
+ return ePaintInvalid;
+}
+
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 ePaintTextureProjective:
++ case ePaintTexture3D:
+ return offsetof(Brush, imagepaint_tool);
+ case ePaintSculpt:
+ return offsetof(Brush, sculpt_tool);
+ case ePaintVertex:
+ return offsetof(Brush, vertexpaint_tool);
+ case ePaintWeight:
+ return offsetof(Brush, weightpaint_tool);
+ case ePaintGpencil:
+ return offsetof(Brush, gpencil_tool);
+ case ePaintSculptUV:
+ case ePaintInvalid:
+ 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)
{
@@@ -626,8 -486,9 +626,8 @@@ eObjectMode BKE_paint_object_mode_from_
return OB_MODE_VERTEX_PAINT;
case ePaintWeight:
return OB_MODE_WEIGHT_PAINT;
- case ePaintTexture3D:
- return OB_MODE_TEXTURE_PAINT;
case ePaintTexture2D:
- case ePaintTextureProjective:
++ case ePaintTexture3D:
return OB_MODE_TEXTURE_PAINT;
case ePaintSculptUV:
return OB_MODE_EDIT;
diff --cc source/blender/editors/interface/interface_icons.c
index 79d0c9852de,eed7f2ec0f2..5bcacca9214
--- a/source/blender/editors/interface/interface_icons.c
+++ b/source/blender/editors/interface/interface_icons.c
@@@ -1686,33 -1199,18 +1686,33 @@@ static int ui_id_brush_get_icon(const b
* 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_TEXTURE_PAINT)
- mode = OB_MODE_TEXTURE_PAINT;
+ if ((space_type == SPACE_VIEW3D) && ob) {
+ if (ob->mode & OB_MODE_SCULPT) {
+ paint_mode = ePaintSculpt;
+ }
+ else if (ob->mode & OB_MODE_VERTEX_PAINT) {
+ paint_mode = ePaintVertex;
+ }
+ else if (ob->mode & OB_MODE_WEIGHT_PAINT) {
+ paint_mode = ePaintWeight;
+ }
+ else if (ob->mode & OB_MODE_TEXTURE_PAINT) {
- paint_mode = ePaintTextureProjective;
++ paint_mode = ePaintTexture3D;
+ }
}
- else if ((sima = CTX_wm_space_image(C)) &&
- (sima->mode == SI_MODE_PAINT))
- {
- mode = OB_MODE_TEXTURE_PAINT;
+ else if (space_type == SPACE_IMAGE) {
+ int sima_mode;
+ if (sa->spacetype == space_type) {
+ SpaceImage *sima = sa->spacedata.first;
+ sima_mode = sima->mode;
+ }
+ else {
+ sima_mode = workspace->tools_mode;
+ }
+
+ if (sima_mode == SI_MODE_PAINT) {
+ paint_mode = ePaintTexture2D;
+ }
}
/* reset the icon */
diff --cc source/blender/editors/sculpt_paint/paint_cursor.c
index 294981e7303,fb938ed60c9..dfad5afc9dc
--- a/source/blender/editors/sculpt_paint/paint_cursor.c
+++ b/source/blender/editors/sculpt_paint/paint_cursor.c
@@@ -802,15 -788,21 +802,15 @@@ static void paint_draw_alpha_overlay
ViewContext *vc, int x, int y, float zoom, ePaintMode mode)
{
/* color means that primary brush texture is colured and secondary is used for alpha/mask control */
- bool col = ELEM(mode, ePaintTextureProjective, ePaintTexture2D, ePaintVertex) ? true : false;
+ bool col = ELEM(mode, ePaintTexture3D, ePaintTexture2D, ePaintVertex) ? true : false;
eOverlayControlFlags flags = BKE_paint_get_overlay_flags();
- /* save lots of GL state
- * TODO: check on whether all of these are needed? */
- glPushAttrib(GL_COLOR_BUFFER_BIT |
- GL_CURRENT_BIT |
- GL_DEPTH_BUFFER_BIT |
- GL_ENABLE_BIT |
- GL_LINE_BIT |
- GL_POLYGON_BIT |
- GL_STENCIL_BUFFER_BIT |
- GL_TRANSFORM_BIT |
- GL_VIEWPORT_BIT |
- GL_TEXTURE_BIT);
+ gpuPushAttrib(GPU_DEPTH_BUFFER_BIT | GPU_BLEND_BIT);
+ /* Translate to region. */
+ GPU_matrix_push();
+ GPU_matrix_translate_2f(vc->ar->winrct.xmin, vc->ar->winrct.ymin);
+ x -= vc->ar->winrct.xmin;
+ y -= vc->ar->winrct.ymin;
/* coloured overlay should be drawn separately */
if (col) {
diff --cc source/blender/editors/sculpt_paint/paint_image.c
index 4bd625c3cc6,6ad2f98c520..e528c64b6e2
--- a/source/blender/editors/sculpt_paint/paint_image.c
+++ b/source/blender/editors/sculpt_paint/paint_image.c
@@@ -1130,10 -1093,8 +1130,10 @@@ static int texture_paint_toggle_exec(bC
ob->mode |= mode_flag;
- BKE_paint_init(bmain, scene, ePaintTextureProjective, PAINT_CURSOR_TEXTURE_PAINT);
+ BKE_paint_init(bmain, scene, ePaintTexture3D, PAINT_CURSOR_TEXTURE_PAINT);
+ BKE_paint_toolslots_brush_validate(bmain, &imapaint->paint);
+
if (U.glreslimit != 0)
GPU_free_images(bmain);
GPU_paint_set_mipmap(bmain, 0);
diff --cc source/blender/editors/sculpt_paint/paint_ops.c
index 9bad1324aa6,07c57d1891b..136a6c9c664
--- a/source/blender/editors/sculpt_paint/paint_ops.c
+++ b/source/blender/editors/sculpt_paint/paint_ops.c
@@@ -482,14 -461,12 +482,14 @@@ static int brush_select_exec(bContext *
static void PAINT_OT_brush_select(wmOperatorType *ot)
{
+ /* Keep names matching 'rna_enum_object_mode_items' (besides active). */
static const EnumPropertyItem paint_mode_items[] = {
- {OB_MODE_ACTIVE, "ACTIVE", 0, "Current", "Set brush for active paint mode"},
- {OB_MODE_SCULPT, "SCULPT", ICON_SCULPTMODE_HLT, "Sculpt", ""},
- {OB_MODE_VERTEX_PAINT, "VERTEX_PAINT", ICON_VPAINT_HLT, "Vertex Paint", ""},
- {OB_MODE_WEIGHT_PAINT, "WEIGHT_PAINT", ICON_WPAINT_HLT, "Weight Paint", ""},
- {OB_MODE_TEXTURE_PAINT, "TEXTURE_PAINT", ICON_TPAINT_HLT, "Texture Paint", ""},
+ {ePaintInvalid, "ACTIVE", 0, "Current", "Set brush for active paint mode"},
+ {ePaintSculpt, "SCULPT", ICON_SCULPTMODE_HLT, "Sculpt", ""},
+ {ePaintVertex, "VERTEX_PAINT", ICON_VPAINT_HLT, "Vertex Paint", ""},
+ {ePaintWeight, "WEIGHT_PAINT", ICON_WPAINT_HLT, "Weight Paint", ""},
- {ePaintTextureProjective, "TEXTURE_PAINT", ICON_TPAINT_HLT, "Texture Paint", ""},
++ {ePaintTexture3D, "TEXTURE_PAINT", ICON_TPAINT_HLT, "Texture Paint", ""},
+ {ePaintGpencil, "GPENCIL_PAINT", ICON_GREASEPENCIL, "Grease Pencil Paint", ""},
{0, NULL, 0, NULL, NULL}
};
PropertyRNA *prop;
More information about the Bf-blender-cvs
mailing list