[Bf-blender-cvs] [e3fe8128e41] blender2.8: Merge branch 'master' into blender2.8
Campbell Barton
noreply at git.blender.org
Fri Sep 29 11:42:14 CEST 2017
Commit: e3fe8128e41bb7c576f02ba234dfabf5c399cb60
Author: Campbell Barton
Date: Fri Sep 29 19:55:00 2017 +1000
Branches: blender2.8
https://developer.blender.org/rBe3fe8128e41bb7c576f02ba234dfabf5c399cb60
Merge branch 'master' into blender2.8
===================================================================
===================================================================
diff --cc CMakeLists.txt
index 2f920474f09,1bb514b14b9..12f546dd158
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@@ -494,12 -500,18 +494,17 @@@ endif(
# Experimental support of C11 and C++11
#
# We default options to whatever default standard in the current compiler.
- if(CMAKE_COMPILER_IS_GNUCC AND (NOT "${CMAKE_C_COMPILER_VERSION}" VERSION_LESS "6.0") AND (NOT WITH_CXX11))
+ if(APPLE)
+ set(_c11_init ON)
+ set(_cxx11_init ON)
+ set(WITH_C11 ON)
+ set(WITH_CXX11 ON)
+ elseif(CMAKE_COMPILER_IS_GNUCC AND (NOT "${CMAKE_C_COMPILER_VERSION}" VERSION_LESS "6.0") AND (NOT WITH_CXX11))
set(_c11_init ON)
- set(_cxx11_init ON)
else()
set(_c11_init OFF)
- set(_cxx11_init OFF)
endif()
+set(_cxx11_init ON)
option(WITH_C11 "Build with C11 standard enabled, for development use only!" ${_c11_init})
mark_as_advanced(WITH_C11)
diff --cc source/blender/editors/mesh/mesh_data.c
index 2767ce75a5f,737c8ac665d..f2e60c55574
--- a/source/blender/editors/mesh/mesh_data.c
+++ b/source/blender/editors/mesh/mesh_data.c
@@@ -440,6 -464,20 +440,20 @@@ int ED_mesh_color_add(Mesh *me, const c
return layernum;
}
+ bool ED_mesh_color_ensure(struct Mesh *me, const char *name)
+ {
+ BLI_assert(me->edit_btmesh == NULL);
+
+ if (!me->mloopcol && me->totloop) {
+ CustomData_add_layer_named(&me->ldata, CD_MLOOPCOL, CD_DEFAULT, NULL, me->totloop, name);
+ BKE_mesh_update_customdata_pointers(me, true);
+ }
+
- DAG_id_tag_update(&me->id, 0);
++ DEG_id_tag_update(&me->id, 0);
+
+ return (me->mloopcol != NULL);
+ }
+
bool ED_mesh_color_remove_index(Mesh *me, const int n)
{
CustomData *ldata = GET_CD_DATA(me, ldata);
diff --cc source/blender/editors/sculpt_paint/paint_vertex.c
index 9046a768eaf,18b71dedc07..c3fb67816da
--- a/source/blender/editors/sculpt_paint/paint_vertex.c
+++ b/source/blender/editors/sculpt_paint/paint_vertex.c
@@@ -3128,15 -3481,9 +3493,13 @@@ static int vpaint_mode_toggle_exec(bCon
paint_cursor_delete_textures();
}
else {
+ EvaluationContext eval_ctx;
+
+ CTX_data_eval_ctx(C, &eval_ctx);
+
ob->mode |= mode_flag;
- if (me->mloopcol == NULL) {
- make_vertexcol(ob);
- }
+ ED_mesh_color_ensure(me, NULL);
if (vp == NULL)
vp = scene->toolsettings->vpaint = new_vpaint(0);
diff --cc source/blender/editors/sculpt_paint/paint_vertex_color_ops.c
index 00000000000,5325d660f91..3cec9dfc063
mode 000000,100644..100644
--- a/source/blender/editors/sculpt_paint/paint_vertex_color_ops.c
+++ b/source/blender/editors/sculpt_paint/paint_vertex_color_ops.c
@@@ -1,0 -1,111 +1,112 @@@
+ /*
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+ /** \file blender/editors/sculpt_paint/paint_vertex_color_ops.c
+ * \ingroup edsculpt
+ */
+
+ #include "MEM_guardedalloc.h"
+
+ #include "DNA_mesh_types.h"
+ #include "DNA_meshdata_types.h"
+ #include "DNA_object_types.h"
+
+ #include "BKE_context.h"
-#include "BKE_depsgraph.h"
+ #include "BKE_mesh.h"
+ #include "BKE_deform.h"
+
++#include "DEG_depsgraph.h"
++
+ #include "WM_api.h"
+ #include "WM_types.h"
+
+ #include "ED_mesh.h"
+
+ #include "paint_intern.h" /* own include */
+
+
+ static int vertex_weight_paint_mode_poll(bContext *C)
+ {
+ Object *ob = CTX_data_active_object(C);
+ Mesh *me = BKE_mesh_from_object(ob);
+ return (ob && (ob->mode == OB_MODE_VERTEX_PAINT || ob->mode == OB_MODE_WEIGHT_PAINT)) &&
+ (me && me->totpoly && me->dvert);
+ }
+
+ static bool vertex_paint_from_weight(bContext *C)
+ {
+ Object *ob = CTX_data_active_object(C);
+ Mesh *me;
+ const MPoly *mp;
+ int vgroup_active;
+
+ if (((me = BKE_mesh_from_object(ob)) == NULL ||
+ (ED_mesh_color_ensure(me, NULL)) == false))
+ {
+ return false;
+ }
+
+ /* TODO: respect selection. */
+ mp = me->mpoly;
+ vgroup_active = ob->actdef - 1;
+ for (int i = 0; i < me->totpoly; i++, mp++) {
+ MLoopCol *lcol = &me->mloopcol[mp->loopstart];
+ uint j = 0;
+ do{
+ uint vidx = me->mloop[mp->loopstart + j].v;
+ const float weight = defvert_find_weight(&me->dvert[vidx], vgroup_active);
+ const uchar grayscale = weight * 255;
+ lcol->r = grayscale;
+ lcol->b = grayscale;
+ lcol->g = grayscale;
+ lcol++;
+ j++;
+ } while (j < mp->totloop);
+ }
+
- DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
++ DEG_id_tag_update(&ob->id, OB_RECALC_DATA);
+ WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, ob);
+ return true;
+ }
+
+ static int vertex_paint_from_weight_exec(bContext *C, wmOperator *UNUSED(op))
+ {
+ if (vertex_paint_from_weight(C)) {
+ return OPERATOR_FINISHED;
+ }
+ return OPERATOR_CANCELLED;
+ }
+
+ void PAINT_OT_vertex_color_from_weight(wmOperatorType *ot)
+ {
+ /* identifiers */
+ ot->name = "Vertex Color from Weight";
+ ot->idname = "PAINT_OT_vertex_color_from_weight";
+ ot->description = "Converts active weight into greyscale vertex colors";
+
+ /* api callback */
+ ot->exec = vertex_paint_from_weight_exec;
+ ot->poll = vertex_weight_paint_mode_poll;
+
+ /* flags */
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+
+ /* TODO: invert, alpha */
+ }
diff --cc source/blender/editors/space_view3d/drawobject.c
index 953eda42373,5f01092f5b0..fa88d63ae1c
--- a/source/blender/editors/space_view3d/drawobject.c
+++ b/source/blender/editors/space_view3d/drawobject.c
@@@ -9792,10 -8457,10 +9792,10 @@@ void draw_object_backbufsel
else {
Mesh *me = ob->data;
if ((me->editflag & ME_EDIT_PAINT_VERT_SEL) &&
- /* currently vertex select only supports weight paint */
- (ob->mode & OB_MODE_WEIGHT_PAINT))
+ /* currently vertex select supports weight paint and vertex paint*/
+ ((ob->mode & OB_MODE_WEIGHT_PAINT) || (ob->mode & OB_MODE_VERTEX_PAINT)))
{
- bbs_mesh_solid_verts(scene, ob);
+ bbs_mesh_solid_verts(eval_ctx, scene, ob);
}
else {
bbs_mesh_solid_faces(scene, ob);
More information about the Bf-blender-cvs
mailing list