Merge branch 'master' into blender2.8
authorCampbell Barton <ideasman42@gmail.com>
Fri, 29 Sep 2017 09:55:00 +0000 (19:55 +1000)
committerCampbell Barton <ideasman42@gmail.com>
Fri, 29 Sep 2017 09:55:00 +0000 (19:55 +1000)
26 files changed:
1  2 
CMakeLists.txt
build_files/cmake/platform/platform_apple.cmake
build_files/cmake/platform/platform_unix.cmake
intern/ghost/intern/GHOST_WindowCocoa.mm
intern/ghost/intern/GHOST_WindowX11.cpp
release/scripts/startup/bl_ui/space_view3d.py
release/scripts/startup/bl_ui/space_view3d_toolbar.py
source/blender/blenkernel/BKE_paint.h
source/blender/blenkernel/intern/cdderivedmesh.c
source/blender/blenkernel/intern/paint.c
source/blender/blenloader/intern/versioning_270.c
source/blender/collada/GeometryExporter.cpp
source/blender/editors/include/ED_mesh.h
source/blender/editors/mesh/mesh_data.c
source/blender/editors/sculpt_paint/CMakeLists.txt
source/blender/editors/sculpt_paint/paint_intern.h
source/blender/editors/sculpt_paint/paint_vertex.c
source/blender/editors/sculpt_paint/paint_vertex_color_ops.c
source/blender/editors/space_view3d/drawobject.c
source/blender/editors/space_view3d/view3d_header.c
source/blender/editors/transform/transform_conversions.c
source/blender/gpu/intern/gpu_buffers.c
source/blender/makesrna/RNA_access.h
source/blender/makesrna/intern/rna_brush.c
source/blender/makesrna/intern/rna_mesh.c
source/creator/CMakeLists.txt

diff --cc 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)
Simple merge
@@@ -440,6 -464,20 +440,20 @@@ int ED_mesh_color_add(Mesh *me, const c
        return layernum;
  }
  
 -      DAG_id_tag_update(&me->id, 0);
+ 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);
+       }
++      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);
@@@ -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);
index 0000000,5325d66..3cec9df
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,111 +1,112 @@@
 -#include "BKE_depsgraph.h"
+ /*
+  * ***** 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"
 -      DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
+ #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);
+       }
++      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 */
+ }
@@@ -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);
Simple merge
Simple merge