Merge branch 'temp_remove_particles' into blender2.8
authorLukas Tönne <lukas.toenne@gmail.com>
Mon, 2 May 2016 09:00:26 +0000 (11:00 +0200)
committerLukas Tönne <lukas.toenne@gmail.com>
Mon, 2 May 2016 09:00:26 +0000 (11:00 +0200)
44 files changed:
build_files/build_environment/install_deps.sh
build_files/cmake/config/blender_full.cmake
extern/curve_fit_nd/intern/curve_fit_cubic.c
extern/curve_fit_nd/intern/curve_fit_inline.h
intern/atomic/atomic_ops.h
intern/cycles/blender/addon/properties.py
intern/cycles/blender/blender_shader.cpp
intern/cycles/kernel/kernel_jitter.h
intern/cycles/render/nodes.h
intern/ghost/intern/GHOST_TimerManager.cpp
source/blender/blenkernel/BKE_image.h
source/blender/blenkernel/BKE_mesh.h
source/blender/blenkernel/intern/data_transfer.c
source/blender/blenkernel/intern/image.c
source/blender/blenkernel/intern/library.c
source/blender/blenkernel/intern/mesh.c
source/blender/blenkernel/intern/paint.c
source/blender/blenkernel/intern/scene.c
source/blender/bmesh/intern/bmesh_mesh_conv.c
source/blender/bmesh/intern/bmesh_mesh_conv.h
source/blender/bmesh/operators/bmo_mesh_conv.c
source/blender/collada/collada.cpp
source/blender/collada/collada_utils.cpp
source/blender/editors/curve/editcurve_paint.c
source/blender/editors/include/ED_mesh.h
source/blender/editors/interface/interface_icons.c
source/blender/editors/mesh/editmesh_tools.c
source/blender/editors/mesh/editmesh_utils.c
source/blender/editors/mesh/mesh_data.c
source/blender/editors/mesh/meshtools.c
source/blender/editors/object/object_edit.c
source/blender/editors/object/object_hook.c
source/blender/editors/object/object_relations.c
source/blender/editors/sculpt_paint/paint_image_proj.c
source/blender/editors/sculpt_paint/sculpt.c
source/blender/editors/space_file/space_file.c
source/blender/editors/space_node/node_relationships.c
source/blender/editors/space_text/text_draw.c
source/blender/editors/space_time/time_ops.c
source/blender/gpu/intern/gpu_extensions.c
source/blender/makesrna/intern/rna_actuator.c
source/blender/makesrna/intern/rna_object.c
source/blender/python/bmesh/bmesh_py_types.c
source/blenderplayer/bad_level_call_stubs/stubs.c

index 75da86db9ead3dcd269597d86686b4c3ae825439..6b9ac8f00fceba31d1b88c200f8e306a2eff1d55 100755 (executable)
@@ -372,6 +372,9 @@ MP3LAME_DEV=""
 OPENJPEG_USE=false
 OPENJPEG_DEV=""
 
+# Whether to use system GLEW or not (OpenSubDiv needs recent glew to work).
+NO_SYSTEM_GLEW=false
+
 # Switch to english language, else some things (like check_package_DEB()) won't work!
 LANG_BACK=$LANG
 LANG=""
@@ -1108,6 +1111,8 @@ compile_Boost() {
     OIIO_FORCE_REBUILD=true
     OSL_FORCE_BUILD=true
     OSL_FORCE_REBUILD=true
+    OPENVDB_FORCE_BUILD=true
+    OPENVDB_FORCE_REBUILD=true
 
     prepare_opt
 
@@ -1115,7 +1120,7 @@ compile_Boost() {
       INFO "Downloading Boost-$BOOST_VERSION"
       mkdir -p $SRC
       download BOOST_SOURCE[@] $_src.tar.bz2
-      tar -C $SRC --transform "s,(.*/?)boost_1_[^/]+(.*),\1boost-$BOOST_VERSION\2,x" -xf $_src.tar.bz2
+      tar -C $SRC --transform "s,\w*,boost-$BOOST_VERSION,x" -xf $_src.tar.bz2
     fi
 
     cd $_src
@@ -1339,7 +1344,7 @@ clean_OPENEXR() {
 
 compile_OPENEXR() {
   # To be changed each time we make edits that would modify the compiled result!
-  openexr_magic=13
+  openexr_magic=14
 
   # Clean install if needed!
   magic_compile_check openexr-$OPENEXR_VERSION $openexr_magic
@@ -1418,7 +1423,7 @@ compile_OPENEXR() {
     if [ -d $_inst ]; then
       _create_inst_shortcut
       # Copy ilmbase files here (blender expects same dir for ilmbase and openexr :/).
-      cp -Lrn $_ilmbase_inst/* $_inst_shortcut
+      cp -an $_ilmbase_inst/* $_inst_shortcut
     else
       ERROR "OpenEXR-$OPENEXR_VERSION failed to compile, exiting"
       exit 1
@@ -1959,7 +1964,7 @@ compile_BLOSC() {
     INFO "Done compiling Blosc-$OPENVDB_BLOSC_VERSION!"
   else
     INFO "Own Blosc-$OPENVDB_BLOSC_VERSION is up to date, nothing to do!"
-    INFO "If you want to force rebuild of this lib (and openexr), use the --force-openvdb option."
+    INFO "If you want to force rebuild of this lib (and openvdb), use the --force-openvdb option."
   fi
 
   magic_compile_set blosc-$OPENVDB_BLOSC_VERSION $blosc_magic
@@ -1985,7 +1990,7 @@ compile_OPENVDB() {
   PRINT ""
 
   # To be changed each time we make edits that would modify the compiled result!
-  openvdb_magic=0
+  openvdb_magic=1
   _init_openvdb
 
   # Clean install if needed!
@@ -2004,8 +2009,6 @@ compile_OPENVDB() {
       download OPENVDB_SOURCE[@] "$_src.tar.gz"
 
       INFO "Unpacking OpenVDB-$OPENVDB_VERSION"
-      #~ tar -C $SRC --transform "s,(.*/?)OpenShadingLanguage-[^/]*(.*),\1OpenShadingLanguage-$OPENVDB_VERSION\2,x" \
-          #~ -xf $_src.tar.gz
       tar -C $SRC -xf $_src.tar.gz
     fi
 
@@ -2020,48 +2023,40 @@ compile_OPENVDB() {
       #~ git reset --hard
     #~ fi
 
-    cd openvdb  # Grrrrrr...
-
-    # Always refresh the whole build!
-    if [ -d build ]; then
-      rm -rf build
-    fi
-    mkdir build
-    cd build
+    # Source builds here
+    cd openvdb
 
     make_d="DESTDIR=$_inst"
+    make_d="$make_d HDSO=/usr"
 
     if [ -d $INST/boost ]; then
-      make_d="$make_d -D BOOST_ROOT=$INST/boost -D Boost_NO_SYSTEM_PATHS=ON"
+      make_d="$make_d BOOST_INCL_DIR=$INST/boost/include BOOST_LIB_DIR=$INST/boost/lib"
     fi
 
-    #~ if [ "$_with_built_openexr" = true ]; then
-      #~ cmake_d="$cmake_d -D ILMBASE_HOME=$INST/openexr"
-      #~ cmake_d="$cmake_d -D OPENEXR_HOME=$INST/openexr"
-      #~ INFO "ILMBASE_HOME=$INST/openexr"
-    #~ fi
+    if [ "$_with_built_openexr" = true ]; then
+      make_d="$make_d ILMBASE_INCL_DIR=$INST/openexr/include ILMBASE_LIB_DIR=$INST/openexr/lib"
+      make_d="$make_d EXR_INCL_DIR=$INST/openexr/include EXR_LIB_DIR=$INST/openexr/lib"
+      INFO "ILMBASE_HOME=$INST/openexr"
+    fi
 
-    #~ cmake_d="-D CMAKE_BUILD_TYPE=Release"
-    #~ cmake_d="$cmake_d -D CMAKE_INSTALL_PREFIX=$_inst"
-    #~ # ptex is only needed when nicholas bishop is ready
-    #~ cmake_d="$cmake_d -D NO_PTEX=1"
-    #~ cmake_d="$cmake_d -D NO_CLEW=1"
-    #~ # maya plugin, docs, tutorials, regression tests and examples are not needed
-    #~ cmake_d="$cmake_d -D NO_MAYA=1 -D NO_DOC=1 -D NO_TUTORIALS=1 -D NO_REGRESSION=1 -DNO_EXAMPLES=1"
+    if [ -d $INST/blosc ]; then
+      make_d="$make_d BLOSC_INCL_DIR=$INST/blosc/include BLOSC_LIB_DIR=$INST/blosc/lib"
+    fi
 
-    #~ cmake $cmake_d ..
+    # Build without log4cplus, glfw, python module & docs
+    make_d="$make_d LOG4CPLUS_INCL_DIR= GLFW_INCL_DIR= PYTHON_VERSION= DOXYGEN="
 
-    #~ make -j$THREADS && make install
-    #~ make clean
+    make -j$THREADS lib $make_d install
+    make clean
 
-    #~ if [ -d $_inst ]; then
-      #~ _create_inst_shortcut
-    #~ else
-      #~ ERROR "OpenSubdiv-$OSD_VERSION failed to compile, exiting"
-      #~ exit 1
-    #~ fi
+    if [ -d $_inst ]; then
+      _create_inst_shortcut
+    else
+      ERROR "OpenVDB-$OPENVDB_VERSION failed to compile, exiting"
+      exit 1
+    fi
 
-    #~ magic_compile_set osd-$OSD_VERSION $osd_magic
+    magic_compile_set openvdb-$OPENVDB_VERSION $openvdb_magic
 
     cd $CWD
     INFO "Done compiling OpenVDB-$OPENVDB_VERSION!"
@@ -2167,7 +2162,7 @@ clean_FFmpeg() {
 
 compile_FFmpeg() {
   # To be changed each time we make edits that would modify the compiled result!
-  ffmpeg_magic=4
+  ffmpeg_magic=5
   _init_ffmpeg
 
   # Clean install if needed!
@@ -2234,7 +2229,7 @@ compile_FFmpeg() {
         --disable-postproc --disable-librtmp --disable-libopencore-amrnb \
         --disable-libopencore-amrwb --disable-libdc1394 --disable-version3 --disable-outdev=sdl \
         --disable-libxcb \
-        --disable-outdev=xv \
+        --disable-outdev=xv --disable-indev=sndio --disable-outdev=sndio \
         --disable-outdev=alsa --disable-indev=sdl --disable-indev=alsa --disable-indev=jack \
         --disable-indev=lavfi $extra
 
@@ -2261,7 +2256,7 @@ compile_FFmpeg() {
 
 #### Install on DEB-like ####
 get_package_version_DEB() {
-    dpkg-query -W -f '${Version}' $1 | sed -r 's/.*:\s*([0-9]+:)(([0-9]+\.?)+).*/\2/'
+    dpkg-query -W -f '${Version}' $1 | sed -r 's/([0-9]+:)?(([0-9]+\.?)+([0-9]+)).*/\2/'
 }
 
 check_package_DEB() {
@@ -2321,7 +2316,7 @@ install_packages_DEB() {
   if [ ! $SUDO ]; then
     WARNING "--no-sudo enabled, impossible to run apt-get install for $@, you'll have to do it yourself..."
   else
-    $SUDO apt-get install -y --force-yes $@
+    $SUDO apt-get install -y $@
     if [ $? -ge 1 ]; then
       ERROR "apt-get failed to install requested packages, exiting."
       exit 1
@@ -2341,30 +2336,6 @@ install_DEB() {
     [ "$(echo ${REPLY:=Y} | tr [:upper:] [:lower:])" != "y" ] && exit
   fi
 
-  if [ ! -z "`cat /etc/debian_version | grep ^6`"  ]; then
-    if [ -z "`cat /etc/apt/sources.list | grep backports.debian.org`"  ]; then
-      WARNING "Looks like you're using Debian Squeeze which does have broken CMake"
-      PRINT "It is highly recommended to install cmake from backports, otherwise"
-      PRINT "compilation of some libraries could fail"
-      PRINT ""
-      PRINT "You could install newer CMake from debian-backports repository"
-      PRINT "Add this this line to your /etc/apt/sources.lixt:"
-      PRINT ""
-      PRINT "deb http://backports.debian.org/debian-backports squeeze-backports main"
-      PRINT ""
-      PRINT "and then run:"
-      PRINT ""
-      PRINT "sudo apt-get update && sudo apt-get install cmake=2.8.7-4~bpo60+1 sudo apt-get install cmake=2.8.7-4~bpo60+1"
-      PRINT ""
-      PRINT "(you could also add this reporisotry using GUI like synaptic)"
-      PRINT ""
-      PRINT "Hit Enter to continue running the script, or hit Ctrl-C to abort the script"
-
-      read
-      PRINT ""
-    fi
-  fi
-
   if [ ! $SUDO ]; then
     WARNING "--no-sudo enabled, impossible to run apt-get update, you'll have to do it yourself..."
   else
@@ -2377,35 +2348,23 @@ install_DEB() {
   OGG_DEV="libogg-dev"
   THEORA_DEV="libtheora-dev"
 
-  _packages="gawk cmake cmake-curses-gui build-essential libjpeg-dev libpng-dev \
-             libfreetype6-dev libx11-dev \
+  _packages="gawk cmake cmake-curses-gui build-essential libjpeg-dev libpng-dev libtiff-dev \
+             git libfreetype6-dev libx11-dev flex bison libtbb-dev libxxf86vm-dev \
              libxcursor-dev libxi-dev wget libsqlite3-dev libxrandr-dev libxinerama-dev \
              libbz2-dev libncurses5-dev libssl-dev liblzma-dev libreadline-dev $OPENJPEG_DEV \
              libopenal-dev libglew-dev libglewmx-dev yasm $THEORA_DEV $VORBIS_DEV $OGG_DEV \
-             libsdl1.2-dev libfftw3-dev patch bzip2 libxml2-dev libtinyxml-dev"
+             libsdl1.2-dev libfftw3-dev patch bzip2 libxml2-dev libtinyxml-dev libjemalloc-dev"
 
   OPENJPEG_USE=true
   VORBIS_USE=true
   OGG_USE=true
   THEORA_USE=true
 
-  PRINT "$LIBYAML_CPP_VER"
+  PRINT ""
   # Some not-so-old distro (ubuntu 12.4) do not have it, do not fail in this case, just warn.
   YAMLCPP_DEV="libyaml-cpp-dev"
   check_package_DEB $YAMLCPP_DEV
   if [ $? -eq 0 ]; then
-    # Another Ubuntu hack - in 14.4, ocio uses (old) 0.3, while default is now 0.5... grrrrr.
-    if $LIBYAML_CPP_VER_DEFINED; then
-      YAMLCPP_VER_DEV="libyaml-cpp$LIBYAML_CPP_VER-dev"
-      check_package_DEB $YAMLCPP_VER_DEV
-      if [ $? -eq 0 ]; then
-        YAMLCPP_DEV=$YAMLCPP_VER_DEV
-      else
-        PRINT ""
-        WARNING "libyaml-cpp$LIBYAML_CPP_VER-dev not found!"
-        PRINT ""
-      fi
-    fi
     _packages="$_packages $YAMLCPP_DEV"
   else
     PRINT ""
@@ -2413,37 +2372,6 @@ install_DEB() {
     PRINT ""
   fi
 
-  # Install newest libtiff-dev in debian/ubuntu.
-  TIFF="libtiff"
-  check_package_DEB $TIFF
-  if [ $? -eq 0 ]; then
-    _packages="$_packages $TIFF-dev"
-  else
-    TIFF="libtiff5"
-    check_package_DEB $TIFF
-    if [ $? -eq 0 ]; then
-      _packages="$_packages $TIFF-dev"
-    else
-      TIFF="libtiff4"  # Some old distro, like e.g. ubuntu 10.04 :/
-      check_package_DEB $TIFF
-      if [ $? -eq 0 ]; then
-        _packages="$_packages $TIFF-dev"
-      fi
-    fi
-  fi
-
-  GIT="git"
-  check_package_DEB $GIT
-  if [ $? -eq 0 ]; then
-    _packages="$_packages $GIT"
-  else
-    GIT="git-core"  # Some old distro, like e.g. ubuntu 10.04 :/
-    check_package_DEB $GIT
-    if [ $? -eq 0 ]; then
-      _packages="$_packages $GIT"
-    fi
-  fi
-
   if [ "$WITH_ALL" = true ]; then
     _packages="$_packages libspnav-dev"
     # Only install jack if jack2 is not already installed!
@@ -2477,20 +2405,11 @@ install_DEB() {
 
   if [ "$WITH_ALL" = true ]; then
     PRINT ""
-    # Grmpf, debian is libxvidcore-dev and ubuntu libxvidcore4-dev!
-    # Note: not since ubuntu 10.04
     XVID_DEV="libxvidcore-dev"
     check_package_DEB $XVID_DEV
     if [ $? -eq 0 ]; then
       install_packages_DEB $XVID_DEV
       XVID_USE=true
-    else
-      XVID_DEV="libxvidcore4-dev"
-      check_package_DEB $XVID_DEV
-      if [ $? -eq 0 ]; then
-        install_packages_DEB $XVID_DEV
-        XVID_USE=true
-      fi
     fi
 
     PRINT ""
@@ -2510,6 +2429,44 @@ install_DEB() {
     fi
   fi
 
+  # Check cmake/glew versions and disable features for older distros.
+  # This is so Blender can at least compile.
+  PRINT ""
+  _cmake=`get_package_version_DEB cmake`
+  version_ge $_cmake "2.8.10"
+  if [ $? -eq 1 ]; then
+    version_ge $_cmake "2.8.8"
+    if [ $? -eq 1 ]; then
+      WARNING "OpenVDB and OpenCOLLADA disabled because cmake-$_cmake is not enough"
+      OPENVDB_SKIP=true
+      OPENCOLLADA_SKIP=true
+    else
+      WARNING "OpenVDB disabled because cmake-$_cmake is not enough"
+      OPENVDB_SKIP=true
+    fi
+  fi
+
+  PRINT ""
+  _glew=`get_package_version_DEB libglew-dev`
+  if [ -z $_glew ]; then
+    # Stupid virtual package in Ubuntu 12.04 doesn't show version number...
+    _glew=`apt-cache showpkg libglew-dev|tail -n1|awk '{print $2}'|sed 's/-.*//'`
+  fi
+  version_ge $_glew "1.9.0"
+  if [ $? -eq 1 ]; then
+    version_ge $_glew "1.7.0"
+    if [ $? -eq 1 ]; then
+      WARNING "OpenSubdiv disabled because GLEW-$_glew is not enough"
+      WARNING "Blender will not use system GLEW library"
+      OSD_SKIP=true
+      NO_SYSTEM_GLEW=true
+    else
+      WARNING "OpenSubdiv will compile with GLEW-$_glew but with limited capability"
+      WARNING "Blender will not use system GLEW library"
+      NO_SYSTEM_GLEW=true
+    fi
+  fi
+
 
   PRINT ""
   _do_compile_python=false
@@ -2564,15 +2521,8 @@ install_DEB() {
 
       boost_version=$(echo `get_package_version_DEB libboost-dev` | sed -r 's/^([0-9]+\.[0-9]+).*/\1/')
 
-      check_package_DEB libboost-locale$boost_version-dev
-      if [ $? -eq 0 ]; then
-        install_packages_DEB libboost-locale$boost_version-dev libboost-filesystem$boost_version-dev \
-                             libboost-regex$boost_version-dev libboost-system$boost_version-dev \
-                             libboost-thread$boost_version-dev libboost-wave$boost_version-dev
-        clean_Boost
-      else
-        compile_Boost
-      fi
+      install_packages_DEB libboost-{filesystem,iostreams,locale,regex,system,thread,wave}$boost_version-dev
+      clean_Boost
     else
       compile_Boost
     fi
@@ -2623,13 +2573,14 @@ install_DEB() {
     INFO "Forced OpenImageIO building, as requested..."
     compile_OIIO
   else
-    check_package_version_ge_lt_DEB libopenimageio-dev $OIIO_VERSION_MIN $OIIO_VERSION_MAX
-    if [ $? -eq 0 -a "$_with_built_openexr" = false ]; then
-      install_packages_DEB libopenimageio-dev
-      clean_OIIO
-    else
+    # XXX Debian Testing / Ubuntu 16.04 pulls in WAY too many deps (gtk2/opencv ?!) incl. OCIO build against libyaml-cpp0.3 so build for now...
+    #check_package_version_ge_lt_DEB libopenimageio-dev $OIIO_VERSION_MIN $OIIO_VERSION_MAX
+    #if [ $? -eq 0 -a "$_with_built_openexr" = false ]; then
+    #  install_packages_DEB libopenimageio-dev
+    #  clean_OIIO
+    #else
       compile_OIIO
-    fi
+    #fi
   fi
 
 
@@ -2638,6 +2589,7 @@ install_DEB() {
   _do_compile_llvm=false
   if [ "$LLVM_SKIP" = true ]; then
     WARNING "Skipping LLVM installation, as requested (this also implies skipping OSL!)..."
+    OSL_SKIP=true
   elif [ "$LLVM_FORCE_BUILD" = true ]; then
     INFO "Forced LLVM building, as requested..."
     _do_compile_llvm=true
@@ -2649,15 +2601,7 @@ install_DEB() {
       LLVM_VERSION_FOUND=$LLVM_VERSION
       clean_LLVM
     else
-      #~ check_package_version_ge_DEB llvm-dev $LLVM_VERSION_MIN
-      #~ if [ $? -eq 0 ]; then
-        #~ install_packages_DEB llvm-dev clang
-        #~ have_llvm=true
-        #~ LLVM_VERSION_FOUND=""  # Using default one, no need to specify it!
-        #~ clean_LLVM
-      #~ else
       _do_compile_llvm=true
-      #~ fi
     fi
   fi
 
@@ -2680,13 +2624,12 @@ install_DEB() {
     INFO "Forced OpenShadingLanguage building, as requested..."
     _do_compile_osl=true
   else
-      # No package currently!
+    # No package currently!
     _do_compile_osl=true
   fi
 
   if [ "$_do_compile_osl" = true ]; then
     if [ "$have_llvm" = true ]; then
-      install_packages_DEB flex bison libtbb-dev
       PRINT ""
       compile_OSL
     else
@@ -2696,23 +2639,33 @@ install_DEB() {
 
 
   PRINT ""
-  _do_compile_osd=false
   if [ "$OSD_SKIP" = true ]; then
     WARNING "Skipping OpenSubdiv installation, as requested..."
   elif [ "$OSD_FORCE_BUILD" = true ]; then
     INFO "Forced OpenSubdiv building, as requested..."
-    _do_compile_osd=true
+    compile_OSD
   else
-      # No package currently!
-    _do_compile_osd=true
-  fi
-
-  if [ "$_do_compile_osd" = true ]; then
-    install_packages_DEB flex bison libtbb-dev
+    # No package currently!
     PRINT ""
     compile_OSD
   fi
 
+  PRINT ""
+  if [ "$OPENVDB_SKIP" = true ]; then
+    WARNING "Skipping OpenVDB installation, as requested..."
+  elif [ "$OPENVDB_FORCE_BUILD" = true ]; then
+    INFO "Forced OpenVDB building, as requested..."
+    compile_OPENVDB
+  else
+    check_package_version_ge_DEB libopenvdb-dev $OPENVDB_VERSION_MIN
+    if [ $? -eq 0 ]; then
+      install_packages_DEB libopenvdb-dev libblosc-dev
+      clean_OPENVDB
+    else
+      compile_OPENVDB
+    fi
+  fi
+
 
   if [ "$WITH_OPENCOLLADA" = true ]; then
     _do_compile_collada=false
@@ -2723,7 +2676,7 @@ install_DEB() {
       INFO "Forced OpenCollada building, as requested..."
       _do_compile_collada=true
     else
-        # No package currently!
+      # No package currently!
       _do_compile_collada=true
     fi
 
@@ -2745,23 +2698,19 @@ install_DEB() {
     INFO "Forced FFMpeg building, as requested..."
     compile_FFmpeg
   else
-#    XXX Debian features libav packages as ffmpeg, those are not really compatible with blender code currently :/
-#        So for now, always build our own ffmpeg.
-#    check_package_DEB ffmpeg
-#    if [ $? -eq 0 ]; then
-#      install_packages_DEB ffmpeg
-#      ffmpeg_version=`get_package_version_DEB ffmpeg`
-#      PRINT "ffmpeg version: $ffmpeg_version"
-#      if [ ! -z "$ffmpeg_version" ]; then
-#        if  dpkg --compare-versions $ffmpeg_version gt 0.7.2; then
-#          install_packages_DEB libavfilter-dev libavcodec-dev libavdevice-dev libavformat-dev libavutil-dev libswscale-dev
-#          clean_FFmpeg
-#        else
-#          compile_FFmpeg
-#        fi
-#      fi
-#    fi
-    compile_FFmpeg
+    # XXX Debian Testing / Ubuntu 16.04 finally includes FFmpeg, so check as usual
+    check_package_DEB ffmpeg
+    if [ $? -eq 0 ]; then
+      check_package_version_ge_DEB ffmpeg $FFMPEG_VERSION_MIN
+      if [ $? -eq 0 ]; then
+        install_packages_DEB libavdevice-dev
+        clean_FFmpeg
+      else
+        compile_FFmpeg
+      fi
+    else
+      compile_FFmpeg
+    fi
   fi
 }
 
@@ -2769,7 +2718,7 @@ install_DEB() {
 #### Install on RPM-like ####
 rpm_flavour() {
   if [ -f /etc/redhat-release ]; then
-    if [ "`grep '6\.' /etc/redhat-release`" ]; then
+    if [ "`grep '[6-7]\.' /etc/redhat-release`" ]; then
       RPM="RHEL"
     else
       RPM="FEDORA"
@@ -2781,8 +2730,10 @@ rpm_flavour() {
 
 get_package_version_RPM() {
   rpm_flavour
-  if [ "$RPM" = "FEDORA" -o "$RPM" = "RHEL" ]; then
+  if [ "$RPM" = "RHEL" ]; then
     yum info $1 | grep Version | tail -n 1 | sed -r 's/.*:\s+(([0-9]+\.?)+).*/\1/'
+  elif [ "$RPM" = "FEDORA" ]; then
+    dnf info $1 | grep Version | tail -n 1 | sed -r 's/.*:\s+(([0-9]+\.?)+).*/\1/'
   elif [ "$RPM" = "SUSE" ]; then
     zypper info $1 | grep Version | tail -n 1 | sed -r 's/.*:\s+(([0-9]+\.?)+).*/\1/'
   fi
@@ -2790,8 +2741,10 @@ get_package_version_RPM() {
 
 check_package_RPM() {
   rpm_flavour
-  if [ "$RPM" = "FEDORA" -o "$RPM" = "RHEL" ]; then
+  if [ "$RPM" = "RHEL" ]; then
     r=`yum info $1 | grep -c 'Summary'`
+  elif [ "$RPM" = "FEDORA" ]; then
+    r=`dnf info $1 | grep -c 'Summary'`
   elif [ "$RPM" = "SUSE" ]; then
     r=`zypper info $1 | grep -c 'Summary'`
   fi
@@ -2838,26 +2791,28 @@ check_package_version_ge_lt_RPM() {
 
 install_packages_RPM() {
   rpm_flavour
-  if [ "$RPM" = "FEDORA" -o "$RPM" = "RHEL" ]; then
-    if [ ! $SUDO ]; then
-      WARNING "--no-sudo enabled, impossible to run yum install for $@, you'll have to do it yourself..."
-    else
-      $SUDO yum install -y $@
-      if [ $? -ge 1 ]; then
-        ERROR "yum failed to install requested packages, exiting."
-        exit 1
-      fi
+  if [ ! $SUDO ]; then
+    WARNING "--no-sudo enabled, impossible to install $@, you'll have to do it yourself..."
+  fi
+  if [ "$RPM" = "RHEL" ]; then
+    $SUDO yum install -y $@
+    if [ $? -ge 1 ]; then
+      ERROR "yum failed to install requested packages, exiting."
+      exit 1
+    fi
+
+  elif [ "$RPM" = "FEDORA" ]; then
+    $SUDO dnf install -y $@
+    if [ $? -ge 1 ]; then
+      ERROR "dnf failed to install requested packages, exiting."
+      exit 1
     fi
 
   elif [ "$RPM" = "SUSE" ]; then
-    if [ ! $SUDO ]; then
-      WARNING "--no-sudo enabled, impossible to run zypper install for $@, you'll have to do it yourself..."
-    else
-      $SUDO zypper --non-interactive install --auto-agree-with-licenses $@
-      if [ $? -ge 1 ]; then
-        ERROR "zypper failed to install requested packages, exiting."
-        exit 1
-      fi
+    $SUDO zypper --non-interactive install --auto-agree-with-licenses $@
+    if [ $? -ge 1 ]; then
+      ERROR "zypper failed to install requested packages, exiting."
+      exit 1
     fi
   fi
 }
@@ -2881,49 +2836,39 @@ install_RPM() {
     rpm_flavour
     if [ "$RPM" = "FEDORA" ]; then
       _fedora_rel="`egrep "[0-9]{1,}" /etc/fedora-release -o`"
-      $SUDO yum -y localinstall --nogpgcheck \
+      $SUDO dnf -y install --nogpgcheck \
       http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$_fedora_rel.noarch.rpm \
       http://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$_fedora_rel.noarch.rpm
 
-      $SUDO yum -y update
-
-      # Install cmake now because of difference with RHEL
-      $SUDO yum -y install cmake
+      $SUDO dnf -y update
 
     elif [ "$RPM" = "RHEL" ]; then
-      $SUDO yum -y localinstall --nogpgcheck \
-      http://download.fedoraproject.org/pub/epel/6/$(uname -i)/epel-release-6-8.noarch.rpm \
-      http://download1.rpmfusion.org/free/el/updates/6/$(uname -i)/rpmfusion-free-release-6-1.noarch.rpm \
-      http://download1.rpmfusion.org/nonfree/el/updates/6/$(uname -i)/rpmfusion-nonfree-release-6-1.noarch.rpm
-
-      $SUDO yum -y update
-
-      # Install cmake 2.8 from other repo
-      mkdir -p $SRC
-      if [ -f $SRC/cmake-2.8.8-4.el6.$(uname -m).rpm ]; then
-        PRINT ""
-        INFO "Special cmake already installed"
+      if [ "`grep '6\.' /etc/redhat-release`" ]; then
+        ERROR "Building with GCC 4.4 is not supported!"
+        exit 1
       else
-        curl -O ftp://ftp.pbone.net/mirror/atrpms.net/el6-$(uname -i)/atrpms/testing/cmake-2.8.8-4.el6.$(uname -m).rpm
-        mv cmake-2.8.8-4.el6.$(uname -m).rpm $SRC/
-        $SUDO rpm -ihv $SRC/cmake-2.8.8-4.el6.$(uname -m).rpm
+        $SUDO yum -y install --nogpgcheck \
+        http://download.fedoraproject.org/pub/epel/7/$(uname -i)/e/epel-release-7-6.noarch.rpm \
+        http://li.nux.ro/download/nux/dextop/el7/x86_64/nux-dextop-release-0-5.el7.nux.noarch.rpm
+
+        $SUDO yum -y update
       fi
 
     elif [ "$RPM" = "SUSE" ]; then
-      # Install this now to avoid using the version from packman repository...
-      if [ "$WITH_ALL" = true ]; then
-        install_packages_RPM libjack-devel
+      # Packman repo now includes name in link...
+      _suse_rel="`grep -w VERSION /etc/os-release | sed 's/[^0-9.]*//g'`"
+      _suse_name="`grep -w NAME /etc/os-release | gawk '{print $2}' | sed 's/\"//'`"
+      if [ $_suse_name ]; then
+        _suse_rel="${_suse_name}_${_suse_rel}"
       fi
 
-      _suse_rel="`grep VERSION /etc/SuSE-release | gawk '{print $3}'`"
-
       PRINT ""
       INFO "About to add 'packman' repository from http://packman.inode.at/suse/openSUSE_$_suse_rel/"
       INFO "This is only needed if you do not already have a packman repository enabled..."
       read -p "Do you want to add this repo (Y/n)?"
       if [ "$(echo ${REPLY:=Y} | tr [:upper:] [:lower:])" == "y" ]; then
         INFO "    Installing packman..."
-        $SUDO zypper ar --refresh --name 'Packman Repository' http://ftp.gwdg.de/pub/linux/packman/suse/openSUSE_$_suse_rel/ ftp.gwdg.de-suse
+        $SUDO zypper ar -f -n packman http://ftp.gwdg.de/pub/linux/misc/packman/suse/openSUSE_$_suse_rel/ packman
         INFO "    Done."
       else
         INFO "    Skipping packman installation."
@@ -2938,11 +2883,12 @@ install_RPM() {
   OGG_DEV="libogg-devel"
   THEORA_DEV="libtheora-devel"
 
-  _packages="gcc gcc-c++ git make cmake libtiff-devel libjpeg-devel\
-             libpng-devel libX11-devel libXi-devel libXcursor-devel libXrandr-devel libXinerama-devel \
+  _packages="gcc gcc-c++ git make cmake tar bzip2 xz findutils flex bison \
+             libtiff-devel libjpeg-devel libpng-devel sqlite-devel fftw-devel SDL-devel \
+             libX11-devel libXi-devel libXcursor-devel libXrandr-devel libXinerama-devel \
              wget ncurses-devel readline-devel $OPENJPEG_DEV openal-soft-devel \
              glew-devel yasm $THEORA_DEV $VORBIS_DEV $OGG_DEV patch \
-             libxml2-devel yaml-cpp-devel tinyxml-devel"
+             libxml2-devel yaml-cpp-devel tinyxml-devel jemalloc-devel"
 
   OPENJPEG_USE=true
   VORBIS_USE=true
@@ -2950,9 +2896,7 @@ install_RPM() {
   THEORA_USE=true
 
   if [ "$RPM" = "FEDORA" -o "$RPM" = "RHEL" ]; then
-    OPENEXR_DEV="openexr-devel"
-
-    _packages="$_packages freetype-devel libsqlite3x-devel fftw-devel SDL-devel"
+    _packages="$_packages freetype-devel tbb-devel"
 
     if [ "$WITH_ALL" = true ]; then
       _packages="$_packages jack-audio-connection-kit-devel"
@@ -2988,13 +2932,22 @@ install_RPM() {
     fi
 
   elif [ "$RPM" = "SUSE" ]; then
-    OPENEXR_DEV="libopenexr-devel"
-
-    _packages="$_packages cmake freetype2-devel sqlite3-devel fftw3-devel libSDL-devel"
+    _packages="$_packages freetype2-devel"
 
     PRINT ""
     install_packages_RPM $_packages
 
+    PRINT ""
+    # Install TBB on openSUSE, from temporary repo
+    check_package_RPM tbb-devel
+    if [ $? -eq 0 ]; then
+      install_packages_RPM tbb-devel
+    else
+      $SUDO zypper ar -f http://download.opensuse.org/repositories/devel:/libraries:/c_c++/openSUSE_$_suse_rel/devel:libraries:c_c++.repo
+      $SUDO zypper -n --gpg-auto-import-keys install tbb-devel
+      $SUDO zypper rr devel_libraries_c_c++
+    fi
+
     PRINT ""
     X264_DEV="libx264-devel"
     check_package_version_ge_RPM $X264_DEV $X264_VERSION_MIN
@@ -3083,19 +3036,30 @@ install_RPM() {
 
 
   PRINT ""
+  _do_compile_boost=false
   if [ "$BOOST_SKIP" = true ]; then
     WARNING "Skipping Boost installation, as requested..."
   elif [ "$BOOST_FORCE_BUILD" = true ]; then
     INFO "Forced Boost building, as requested..."
-    compile_Boost
+    _do_compile_boost=true
   else
     check_package_version_ge_RPM boost-devel $BOOST_VERSION_MIN
     if [ $? -eq 0 ]; then
       install_packages_RPM boost-devel
       clean_Boost
     else
-      compile_Boost
+      _do_compile_boost=true
+    fi
+  fi
+
+  if [ "$_do_compile_boost" = true ]; then
+    if [ "$RPM" = "SUSE" ]; then
+      install_packages_RPM gcc-fortran
+    else
+      install_packages_RPM libquadmath-devel bzip2-devel
     fi
+    PRINT ""
+    compile_Boost
   fi
 
 
@@ -3106,14 +3070,18 @@ install_RPM() {
     INFO "Forced OpenColorIO building, as requested..."
     compile_OCIO
   else
-    # XXX Always force build of own OCIO, until linux distro guys update their package to default libyaml-cpp ver (0.5)!
-    #check_package_version_ge_RPM OpenColorIO-devel $OCIO_VERSION_MIN
-    #if [ $? -eq 0 ]; then
-      #install_packages_RPM OpenColorIO-devel
-      #clean_OCIO
-    #else
+    if [ "$RPM" = "SUSE" ]; then
+      check_package_version_ge_RPM OpenColorIO-devel $OCIO_VERSION_MIN
+      if [ $? -eq 0 ]; then
+        install_packages_RPM OpenColorIO-devel
+        clean_OCIO
+      else
+        compile_OCIO
+      fi
+    # XXX Fedora/RHEL OCIO still depends on libyaml-cpp v0.3 even when system default is v0.5!
+    else
       compile_OCIO
-    #fi
+    fi
   fi
 
   PRINT ""
@@ -3123,10 +3091,10 @@ install_RPM() {
     INFO "Forced ILMBase/OpenEXR building, as requested..."
     compile_OPENEXR
   else
-    check_package_version_ge_RPM $OPENEXR_DEV $OPENEXR_VERSION_MIN
+    check_package_version_ge_RPM openexr-devel $OPENEXR_VERSION_MIN
     if [ $? -eq 0 ]; then
-      install_packages_RPM $OPENEXR_DEV
-      OPENEXR_VERSION=`get_package_version_RPM $OPENEXR_DEV`
+      install_packages_RPM openexr-devel
+      OPENEXR_VERSION=`get_package_version_RPM openexr-devel`
       ILMBASE_VERSION=$OPENEXR_VERSION
       clean_OPENEXR
     else
@@ -3141,13 +3109,14 @@ install_RPM() {
     INFO "Forced OpenImageIO building, as requested..."
     compile_OIIO
   else
-    check_package_version_ge_lt_RPM OpenImageIO-devel $OIIO_VERSION_MIN $OIIO_VERSION_MAX
-    if [ $? -eq 0 -a $_with_built_openexr == false ]; then
-      install_packages_RPM OpenImageIO-devel
-      clean_OIIO
-    else
+    # XXX RPM distros pulls in too much and depends on old libs, so better to build for now...
+    #check_package_version_ge_lt_RPM OpenImageIO-devel $OIIO_VERSION_MIN $OIIO_VERSION_MAX
+    #if [ $? -eq 0 -a $_with_built_openexr == false ]; then
+    #  install_packages_RPM OpenImageIO-devel
+    #  clean_OIIO
+    #else
       compile_OIIO
-    fi
+    #fi
   fi
 
 
@@ -3156,34 +3125,26 @@ install_RPM() {
   _do_compile_llvm=false
   if [ "$LLVM_SKIP" = true ]; then
     WARNING "Skipping LLVM installation, as requested (this also implies skipping OSL!)..."
+    OSL_SKIP=true
   elif [ "$LLVM_FORCE_BUILD" = true ]; then
     INFO "Forced LLVM building, as requested..."
     _do_compile_llvm=true
   else
-    # Problem compiling with LLVM 3.2 so match version 3.1 ...
     if [ "$RPM" = "SUSE" ]; then
-      check_package_version_match_RPM llvm-clang-devel $LLVM_VERSION
-      if [ $? -eq 0 ]; then
-        install_packages_RPM llvm-devel llvm-clang-devel
-        have_llvm=true
-        LLVM_VERSION_FOUND=$LLVM_VERSION
-        clean_LLVM
-      else
-        # Better to compile it than use minimum version from repo...
-        _do_compile_llvm=true
-      fi
+      CLANG_DEV="llvm-clang-devel"
     else
-      check_package_version_match_RPM clang-devel $LLVM_VERSION
-      if [ $? -eq 0 ]; then
-        install_packages_RPM llvm-devel clang-devel
-        have_llvm=true
-        LLVM_VERSION_FOUND=$LLVM_VERSION
-        clean_LLVM
-      else
-        # Better to compile it than use minimum version from repo...
-        _do_compile_llvm=true
-      fi
+      CLANG_DEV="clang-devel"
     fi
+    # XXX RHEL has 3.4 in repo but OSL complains about not finding MCJIT_LIBRARY, so compile for now...
+    #check_package_version_match_RPM $CLANG_DEV $LLVM_VERSION
+    #if [ $? -eq 0 ]; then
+    #  install_packages_RPM llvm-devel $CLANG_DEV
+    #  have_llvm=true
+    #  LLVM_VERSION_FOUND=$LLVM_VERSION
+    #  clean_LLVM
+    #else
+      _do_compile_llvm=true
+    #fi
   fi
 
   if [ "$_do_compile_llvm" = true ]; then
@@ -3211,10 +3172,6 @@ install_RPM() {
 
   if [ "$_do_compile_osl" = true ]; then
     if [ "$have_llvm" = true ]; then
-      install_packages_RPM flex bison
-      if [ "$RPM" = "FEDORA" -o "$RPM" = "RHEL" ]; then
-        install_packages_RPM tbb-devel
-      fi
       PRINT ""
       compile_OSL
     else
@@ -3224,24 +3181,26 @@ install_RPM() {
 
 
   PRINT ""
-  _do_compile_osd=false
   if [ "$OSD_SKIP" = true ]; then
     WARNING "Skipping OpenSubdiv installation, as requested..."
   elif [ "$OSD_FORCE_BUILD" = true ]; then
     INFO "Forced OpenSubdiv building, as requested..."
-    _do_compile_osd=true
+    compile_OSD
   else
     # No package currently!
-    _do_compile_osd=true
+    compile_OSD
   fi
 
-  if [ "$_do_compile_osd" = true ]; then
-    install_packages_RPM flex bison
-    if [ "$RPM" = "FEDORA" -o "$RPM" = "RHEL" ]; then
-      install_packages_RPM tbb-devel
-    fi
-    PRINT ""
-    compile_OSD
+
+  PRINT ""
+  if [ "$OPENVDB_SKIP" = true ]; then
+    WARNING "Skipping OpenVDB installation, as requested..."
+  elif [ "$OPENVDB_FORCE_BUILD" = true ]; then
+    INFO "Forced OpenVDB building, as requested..."
+    compile_OPENVDB
+  else
+    # No package currently!
+    compile_OPENVDB
   fi
 
 
@@ -3275,7 +3234,7 @@ install_RPM() {
     INFO "Forced FFMpeg building, as requested..."
     compile_FFmpeg
   else
-    check_package_version_ge_RPM ffmpeg $FFMPEG_VERSION_MIN
+    check_package_version_ge_RPM ffmpeg-devel $FFMPEG_VERSION_MIN
     if [ $? -eq 0 ]; then
       install_packages_RPM ffmpeg ffmpeg-devel
       clean_FFmpeg
@@ -3557,6 +3516,7 @@ install_ARCH() {
   _do_compile_llvm=false
   if [ "$LLVM_SKIP" = true ]; then
     WARNING "Skipping LLVM installation, as requested (this also implies skipping OSL!)..."
+    OSL_SKIP=true
   elif [ "$LLVM_FORCE_BUILD" = true ]; then
     INFO "Forced LLVM building, as requested..."
     _do_compile_llvm=true
@@ -3565,7 +3525,7 @@ install_ARCH() {
     if [ $? -eq 0 ]; then
       install_packages_ARCH llvm35 clang35
       have_llvm=true
-      LLVM_VERSION=`get_package_version_ARCH llvm`
+      LLVM_VERSION=`get_package_version_ARCH llvm35`
       LLVM_VERSION_FOUND=$LLVM_VERSION
       clean_LLVM
     else
@@ -3629,6 +3589,23 @@ install_ARCH() {
   fi
 
 
+  PRINT ""
+  if [ "$OPENVDB_SKIP" = true ]; then
+    WARNING "Skipping OpenVDB installation, as requested..."
+  elif [ "$OPENVDB_FORCE_BUILD" = true ]; then
+    INFO "Forced OpenVDB building, as requested..."
+    compile_OPENVDB
+  else
+    check_package_version_ge_ARCH openvdb $OPENVDB_VERSION_MIN
+    if [ $? -eq 0 ]; then
+      install_packages_ARCH openvdb
+      clean_OPENVDB
+    else
+      compile_OPENVDB
+    fi
+  fi
+
+
   if [ "$WITH_OPENCOLLADA" = true ]; then
     PRINT ""
     _do_compile_collada=false
@@ -3935,7 +3912,7 @@ print_info() {
 
   _buildargs="-U *SNDFILE* -U *PYTHON* -U *BOOST* -U *Boost*"
   _buildargs="$_buildargs -U *OPENCOLORIO* -U *OPENEXR* -U *OPENIMAGEIO* -U *LLVM* -U *CYCLES*"
-  _buildargs="$_buildargs -U *OPENSUBDIV* -U *COLLADA* -U *FFMPEG*"
+  _buildargs="$_buildargs -U *OPENSUBDIV* -U *OPENVDB* -U *COLLADA* -U *FFMPEG*"
 
   _1="-D WITH_CODEC_SNDFILE=ON"
   PRINT "  $_1"
@@ -4022,12 +3999,31 @@ print_info() {
     fi
   fi
 
+  if [ "$OPENVDB_SKIP" = false ]; then
+    _1="-D WITH_OPENVDB=ON"
+    _2="-D WITH_OPENVDB_BLOSC=ON"
+    PRINT "  $_1"
+    PRINT "  $_2"
+    _buildargs="$_buildargs $_1 $_2"
+    if [ -d $INST/openvdb ]; then
+      _1="-D OPENVDB_ROOT_DIR=$INST/openvdb"
+      PRINT "  $_1"
+      _buildargs="$_buildargs $_1"
+    fi
+  fi
+
   if [ "$WITH_OPENCOLLADA" = true ]; then
     _1="-D WITH_OPENCOLLADA=ON"
     PRINT "  $_1"
     _buildargs="$_buildargs $_1"
   fi
 
+  if [ "$NO_SYSTEM_GLEW" = true ]; then
+    _1="-D WITH_SYSTEM_GLEW=OFF"
+    PRINT "  $_1"
+    _buildargs="$_buildargs $_1"
+  fi
+
   if [ "$FFMPEG_SKIP" = false ]; then
     _1="-D WITH_CODEC_FFMPEG=ON"
     _2="-D FFMPEG_LIBRARIES='avformat;avcodec;avutil;avdevice;swscale;swresample;lzma;rt;`print_info_ffmpeglink`'"
index df8ed881d960dd9049189dfba6179e3221de0653..b50b42416fb10d9eabe1c458fa76f1d8a71bb387 100644 (file)
@@ -54,7 +54,7 @@ set(WITH_PLAYER              ON  CACHE BOOL "" FORCE)
 set(WITH_MEM_JEMALLOC        ON  CACHE BOOL "" FORCE)
 
 
-# platform dependant options
+# platform dependent options
 if(UNIX AND NOT APPLE)
        set(WITH_JACK                ON  CACHE BOOL "" FORCE)
        set(WITH_DOC_MANPAGE         ON  CACHE BOOL "" FORCE)
index 810cf92760d539198865142518e32e14cfb5d7a1..6aee04f20b15642fb738345f9a2a124796c2eadd 100644 (file)
@@ -814,8 +814,22 @@ static void fit_cubic_to_points(
                pt_a += dims;
        }
 
-       /* tan_center = (pt_a - pt_b).normalized() */
-       normalize_vn_vnvn(tan_center, pt_a, pt_b, dims);
+       {
+#ifdef USE_VLA
+               double tan_center_a[dims];
+               double tan_center_b[dims];
+#else
+               double *tan_center_a = alloca(sizeof(double) * dims);
+               double *tan_center_b = alloca(sizeof(double) * dims);
+#endif
+               const double *pt   = &points_offset[split_index * dims];
+
+               /* tan_center = ((pt_a - pt).normalized() + (pt - pt_b).normalized()).normalized() */
+               normalize_vn_vnvn(tan_center_a, pt_a, pt, dims);
+               normalize_vn_vnvn(tan_center_b, pt, pt_b, dims);
+               add_vn_vnvn(tan_center, tan_center_a, tan_center_b, dims);
+               normalize_vn(tan_center, dims);
+       }
 
        fit_cubic_to_points(
                points_offset, split_index + 1,
index 17aa02be3e5b42a81b572ff900f4f33ed904d773..1b47cbd5eb5a91ddc0c4d772ad6fd9dfe1b215ac 100644 (file)
@@ -209,6 +209,7 @@ static double len_vn(
 {
        return sqrt(len_squared_vn(v0, dims));
 }
+#endif
 
 MINLINE double normalize_vn(
         double v0[], const uint dims)
@@ -219,7 +220,6 @@ MINLINE double normalize_vn(
        }
        return d;
 }
-#endif
 
 /* v_out = (v0 - v1).normalized() */
 MINLINE double normalize_vn_vnvn(
index dc06a51f85979ef61b764f2d5fbfa8e8464a8595..06eb8f21da6cdb62f714240ad065f0d3df52e9ad 100644 (file)
@@ -45,6 +45,7 @@
  * arm7 architecture does have both 32 and 64bit atomics, however
  * it's gcc doesn't have __GCC_HAVE_SYNC_COMPARE_AND_SWAP_n defined.
  */
+#  define JE_FORCE_SYNC_COMPARE_AND_SWAP_1
 #  define JE_FORCE_SYNC_COMPARE_AND_SWAP_8
 #  define JE_FORCE_SYNC_COMPARE_AND_SWAP_4
 #endif
@@ -399,6 +400,12 @@ atomic_fetch_and_and_uint8(uint8_t *p, uint8_t b)
        return _InterlockedAnd8((char *)p, (char)b);
 #endif
 }
+#elif defined(JE_FORCE_SYNC_COMPARE_AND_SWAP_1)
+ATOMIC_INLINE uint8_t
+atomic_fetch_and_and_uint8(uint8_t *p, uint8_t b)
+{
+       return __sync_fetch_and_and(p, b);
+}
 #else
 #  error "Missing implementation for 8-bit atomic operations"
 #endif
index 6e7056f6c8a46acb8981fffb1d0b3517cc45a745..07a2e9403ff75922827e0cc1dc620a2e62af838b 100644 (file)
@@ -193,57 +193,57 @@ class CyclesRenderSettings(bpy.types.PropertyGroup):
         cls.aa_samples = IntProperty(
                 name="AA Samples",
                 description="Number of antialiasing samples to render for each pixel",
-                min=1, max=10000,
+                min=1, max=2097151,
                 default=4,
                 )
         cls.preview_aa_samples = IntProperty(
                 name="AA Samples",
                 description="Number of antialiasing samples to render in the viewport, unlimited if 0",
-                min=0, max=10000,
+                min=0, max=2097151,
                 default=4,
                 )
         cls.diffuse_samples = IntProperty(
                 name="Diffuse Samples",
                 description="Number of diffuse bounce samples to render for each AA sample",
-                min=1, max=10000,
+                min=1, max=1024,
                 default=1,
                 )
         cls.glossy_samples = IntProperty(
                 name="Glossy Samples",
                 description="Number of glossy bounce samples to render for each AA sample",
-                min=1, max=10000,
+                min=1, max=1024,
                 default=1,
                 )
         cls.transmission_samples = IntProperty(
                 name="Transmission Samples",
                 description="Number of transmission bounce samples to render for each AA sample",
-                min=1, max=10000,
+                min=1, max=1024,
                 default=1,
                 )
         cls.ao_samples = IntProperty(
                 name="Ambient Occlusion Samples",
                 description="Number of ambient occlusion samples to render for each AA sample",
-                min=1, max=10000,
+                min=1, max=1024,
                 default=1,
                 )
         cls.mesh_light_samples = IntProperty(
                 name="Mesh Light Samples",
                 description="Number of mesh emission light samples to render for each AA sample",
-                min=1, max=10000,
+                min=1, max=1024,
                 default=1,
                 )
 
         cls.subsurface_samples = IntProperty(
                 name="Subsurface Samples",
                 description="Number of subsurface scattering samples to render for each AA sample",
-                min=1, max=10000,
+                min=1, max=1024,
                 default=1,
                 )
 
         cls.volume_samples = IntProperty(
                 name="Volume Samples",
                 description="Number of volume scattering samples to render for each AA sample",
-                min=1, max=10000,
+                min=1, max=1024,
                 default=1,
                 )
 
index 4f7ca301fb71f2846309b054cad8189aa45e4f4b..3f919bcad887953817b3ca68a3701d3b918fdcb0 100644 (file)
@@ -602,12 +602,14 @@ static ShaderNode *add_node(Scene *scene,
                         * input/output type info needed for proper node construction.
                         */
                        OSL::OSLQuery query;
+                       string absolute_filepath;
 
                        if(!bytecode_hash.empty()) {
                                query.open_bytecode(b_script_node.bytecode());
                        }
                        else {
-                               OSLShaderManager::osl_query(query, b_script_node.filepath());
+                               absolute_filepath = blender_absolute_path(b_data, b_ntree, b_script_node.filepath());
+                               OSLShaderManager::osl_query(query, absolute_filepath);
                        }
                        /* TODO(sergey): Add proper query info error parsing. */
 
@@ -617,12 +619,11 @@ static ShaderNode *add_node(Scene *scene,
                         * so the names match those of the corresponding parameters exactly.
                         *
                         * Note 2: ShaderInput/ShaderOutput store shallow string copies only!
-                        * Socket names must be stored in the extra lists instead. */
+                        * So we register them as ustring to ensure the pointer stays valid. */
                        BL::Node::inputs_iterator b_input;
 
                        for(b_script_node.inputs.begin(b_input); b_input != b_script_node.inputs.end(); ++b_input) {
-                               script_node->input_names.push_back(ustring(b_input->name()));
-                               ShaderInput *input = script_node->add_input(script_node->input_names.back().c_str(),
+                               ShaderInput *input = script_node->add_input(ustring(b_input->name()).c_str(),
                                                                            convert_osl_socket_type(query, *b_input));
                                set_default_value(input, *b_input, b_data, b_ntree);
                        }
@@ -630,8 +631,7 @@ static ShaderNode *add_node(Scene *scene,
                        BL::Node::outputs_iterator b_output;
 
                        for(b_script_node.outputs.begin(b_output); b_output != b_script_node.outputs.end(); ++b_output) {
-                               script_node->output_names.push_back(ustring(b_output->name()));
-                               script_node->add_output(script_node->output_names.back().c_str(),
+                               script_node->add_output(ustring(b_output->name()).c_str(),
                                                        convert_osl_socket_type(query, *b_output));
                        }
 
@@ -645,7 +645,7 @@ static ShaderNode *add_node(Scene *scene,
                        }
                        else {
                                /* set filepath */
-                               script_node->filepath = blender_absolute_path(b_data, b_ntree, b_script_node.filepath());
+                               script_node->filepath = absolute_filepath;
                        }
 
                        node = script_node;
@@ -732,10 +732,10 @@ static ShaderNode *add_node(Scene *scene,
                                env->filename = image_user_file_path(b_image_user,
                                                                     b_image,
                                                                     b_scene.frame_current());
-                               env->animated = b_env_node.image_user().use_auto_refresh();
                                env->builtin_data = NULL;
                        }
 
+                       env->animated = b_env_node.image_user().use_auto_refresh();
                        env->use_alpha = b_image.use_alpha();
 
                        /* TODO(sergey): Does not work properly when we change builtin type. */
index a98881b5af3bc38d8a1896d1026447c721d5ce86..aec7bc33acda2564c622e43aae8d9a82811ba371 100644 (file)
@@ -175,7 +175,7 @@ ccl_device void cmj_sample_2D(int s, int N, int p, float *fx, float *fy)
 #else
        int m = float_to_int(sqrtf(N));
 #endif
-       int n = (N + m - 1)/m;
+       int n = (N - 1)/m + 1;
        float invN = 1.0f/N;
        float invm = 1.0f/m;
        float invn = 1.0f/n;
index 7400770d60a28df076b4a2204533af91e621eb1d..0b3ab68f9e081ee14d4bbb7597c3d0c108b37c3a 100644 (file)
@@ -977,11 +977,6 @@ public:
        string filepath;
        string bytecode_hash;
 
-       /* ShaderInput/ShaderOutput only stores a shallow string copy (const char *)!
-        * The actual socket names have to be stored externally to avoid memory errors. */
-       vector<ustring> input_names;
-       vector<ustring> output_names;
-
        virtual bool equals(const ShaderNode * /*other*/) { return false; }
 };
 
index 8cba0608f2bf3522721d0fc72599022dcec11366..f6ec9d3febe5b0b6dbcdfe91c4a464fb59f24361 100644 (file)
@@ -90,7 +90,6 @@ GHOST_TSuccess GHOST_TimerManager::removeTimer(GHOST_TimerTask *timer)
                // Remove the timer task
                m_timers.erase(iter);
                delete timer;
-               timer = NULL;
                success = GHOST_kSuccess;
        }
        else {
index 894ccae0dc8c4c4290c28116954e992907bb536d..eb98268c9f00ae6e2a88457587747ede29e55a4b 100644 (file)
@@ -61,6 +61,8 @@ void    BKE_image_free_buffers(struct Image *image);
 /* call from library */
 void    BKE_image_free(struct Image *image);
 
+void    BKE_image_init(struct Image *image);
+
 typedef void (StampCallback)(void *data, const char *propname, char *propvalue, int len);
 
 void    BKE_render_result_stamp_info(struct Scene *scene, struct Object *camera, struct RenderResult *rr, bool allocate_only);
index ac1f1576ebaf450b9223b5b22b68ccc15bd50ba6..c7d5857b873d0bfd8c26528e516e087c3c6dfa44 100644 (file)
@@ -69,7 +69,7 @@ extern "C" {
 
 /* *** mesh.c *** */
 
-struct BMesh *BKE_mesh_to_bmesh(struct Mesh *me, struct Object *ob);
+struct BMesh *BKE_mesh_to_bmesh(struct Mesh *me, struct Object *ob, const bool add_key_index);
 
 int poly_find_loop_from_vert(
         const struct MPoly *poly,
index 1dcacc3ae0af1e61113cc29735081c4c3c2bb223..7292ed2b5c5a8cc8be0d4ee29633d3edab8e8d1c 100644 (file)
@@ -459,9 +459,18 @@ static void data_transfer_layersmapping_add_item_cd(
         ListBase *r_map, const int cddata_type, const int mix_mode, const float mix_factor, const float *mix_weights,
         void *data_src, void *data_dst, cd_datatransfer_interp interp, void *interp_data)
 {
+       uint64_t data_flag = 0;
+
+       if (cddata_type == CD_FREESTYLE_EDGE) {
+               data_flag = FREESTYLE_EDGE_MARK;
+       }
+       else if (cddata_type == CD_FREESTYLE_FACE) {
+               data_flag = FREESTYLE_FACE_MARK;
+       }
+
        data_transfer_layersmapping_add_item(
                r_map, cddata_type, mix_mode, mix_factor, mix_weights, data_src, data_dst,
-               0, 0, 0, 0, 0, 0, interp, interp_data);
+               0, 0, 0, 0, 0, data_flag, interp, interp_data);
 }
 
 /* Note: All those layer mapping handlers return false *only* if they were given invalid parameters.
index 340b406722fd8223d87e785a6e04122c06085407..d5f9a2dac3e5b9430bdc14a5731d217b0fc4ad2b 100644 (file)
@@ -350,27 +350,41 @@ void BKE_image_free(Image *ima)
 }
 
 /* only image block itself */
-static Image *image_alloc(Main *bmain, const char *name, short source, short type)
+static void image_init(Image *ima, short source, short type)
 {
-       Image *ima;
+       BLI_assert(MEMCMP_STRUCT_OFS_IS_ZERO(ima, id));
 
-       ima = BKE_libblock_alloc(bmain, ID_IM, name);
-       if (ima) {
-               ima->ok = IMA_OK;
+       ima->ok = IMA_OK;
 
-               ima->xrep = ima->yrep = 1;
-               ima->aspx = ima->aspy = 1.0;
-               ima->gen_x = 1024; ima->gen_y = 1024;
-               ima->gen_type = 1;   /* no defines yet? */
+       ima->xrep = ima->yrep = 1;
+       ima->aspx = ima->aspy = 1.0;
+       ima->gen_x = 1024; ima->gen_y = 1024;
+       ima->gen_type = IMA_GENTYPE_GRID;
 
-               ima->source = source;
-               ima->type = type;
+       ima->source = source;
+       ima->type = type;
 
-               if (source == IMA_SRC_VIEWER)
-                       ima->flag |= IMA_VIEW_AS_RENDER;
+       if (source == IMA_SRC_VIEWER)
+               ima->flag |= IMA_VIEW_AS_RENDER;
 
-               BKE_color_managed_colorspace_settings_init(&ima->colorspace_settings);
-               ima->stereo3d_format = MEM_callocN(sizeof(Stereo3dFormat), "Image Stereo Format");
+       BKE_color_managed_colorspace_settings_init(&ima->colorspace_settings);
+       ima->stereo3d_format = MEM_callocN(sizeof(Stereo3dFormat), "Image Stereo Format");
+}
+
+void BKE_image_init(struct Image *image)
+{
+       if (image) {
+               image_init(image, IMA_SRC_GENERATED, IMA_TYPE_UV_TEST);
+       }
+}
+
+static Image *image_alloc(Main *bmain, const char *name, short source, short type)
+{
+       Image *ima;
+
+       ima = BKE_libblock_alloc(bmain, ID_IM, name);
+       if (ima) {
+               image_init(ima, source, type);
        }
 
        return ima;
index 0a8e91484145bc3990724f0a44231f798b47d689..071071d9d0fd09cc2a60c06336c4ec7342b87ab7 100644 (file)
@@ -918,7 +918,7 @@ void BKE_libblock_init_empty(ID *id)
                        BKE_texture_default((Tex *)id);
                        break;
                case ID_IM:
-                       /* Image is a bit complicated, for now assume NULLified im is OK. */
+                       BKE_image_init((Image *)id);
                        break;
                case ID_LT:
                        BKE_lattice_init((Lattice *)id);
index c10592882c0c72dead9e3df99876a79954290ea2..2af78cca79f6cb4e16602c60000cfda8356c1b45 100644 (file)
@@ -595,14 +595,17 @@ Mesh *BKE_mesh_copy(Mesh *me)
        return BKE_mesh_copy_ex(G.main, me);
 }
 
-BMesh *BKE_mesh_to_bmesh(Mesh *me, Object *ob)
+BMesh *BKE_mesh_to_bmesh(Mesh *me, Object *ob, const bool add_key_index)
 {
        BMesh *bm;
        const BMAllocTemplate allocsize = BMALLOC_TEMPLATE_FROM_ME(me);
 
        bm = BM_mesh_create(&allocsize);
 
-       BM_mesh_bm_from_me(bm, me, false, true, ob->shapenr);
+       BM_mesh_bm_from_me(
+               bm, me, (&(struct BMeshFromMeshParams){
+                   .add_key_index = add_key_index, .use_shapekey = true, .active_shapekey = ob->shapenr,
+               }));
 
        return bm;
 }
index 1b6fc92ef5e5b2621d9f7bd361465c3345879fca..3a2663c5d487608b82720c65ea5a770e208761f3 100644 (file)
@@ -635,7 +635,7 @@ static void sculptsession_bm_to_me_update_data_only(Object *ob, bool reorder)
                        }
                        if (reorder)
                                BM_log_mesh_elems_reorder(ss->bm, ss->bm_log);
-                       BM_mesh_bm_to_me(ss->bm, ob->data, false);
+                       BM_mesh_bm_to_me(ss->bm, ob->data, (&(struct BMeshToMeshParams){0}));
                }
        }
 }
index 61c3bfd5a48772d2bf56de3103f91fe3d85321e3..1a452fbdc96e85fddab65754262b15a2d4f63abe 100644 (file)
@@ -1754,7 +1754,7 @@ static void prepare_mesh_for_viewport_render(Main *bmain, Scene *scene)
                {
                        if (check_rendered_viewport_visible(bmain)) {
                                BMesh *bm = mesh->edit_btmesh->bm;
-                               BM_mesh_bm_to_me(bm, mesh, false);
+                               BM_mesh_bm_to_me(bm, mesh, (&(struct BMeshToMeshParams){0}));
                                DAG_id_tag_update(&mesh->id, 0);
                        }
                }
index 931413d834f9c376b8e54e888c75989e2ff95dad..7b102c9283bff5733909dd07134eb84c3ab5e45a 100644 (file)
@@ -224,7 +224,7 @@ static BMFace *bm_face_create_from_mpoly(
  */
 void BM_mesh_bm_from_me(
         BMesh *bm, Mesh *me,
-        const bool calc_face_normal, const bool set_key, int act_key_nr)
+        const struct BMeshFromMeshParams *params)
 {
        MVert *mvert;
        MEdge *medge;
@@ -237,11 +237,6 @@ void BM_mesh_bm_from_me(
        float (*keyco)[3] = NULL;
        int totuv, totloops, i, j;
 
-       int cd_vert_bweight_offset;
-       int cd_edge_bweight_offset;
-       int cd_edge_crease_offset;
-       int cd_shape_keyindex_offset;
-
        /* free custom data */
        /* this isnt needed in most cases but do just incase */
        CustomData_free(&bm->vdata, bm->totvert);
@@ -278,16 +273,21 @@ void BM_mesh_bm_from_me(
                CustomData_set_layer_name(&bm->ldata, CD_MLOOPUV, i, bm->pdata.layers[li].name);
        }
 
-       if ((act_key_nr != 0) && (me->key != NULL)) {
-               actkey = BLI_findlink(&me->key->block, act_key_nr - 1);
+       if ((params->active_shapekey != 0) && (me->key != NULL)) {
+               actkey = BLI_findlink(&me->key->block, params->active_shapekey - 1);
        }
        else {
                actkey = NULL;
        }
 
-       if (me->key) {
+       const int tot_shape_keys = me->key ? BLI_listbase_count(&me->key->block) : 0;
+       const float (**shape_key_table)[3] = tot_shape_keys ? BLI_array_alloca(shape_key_table, tot_shape_keys) : NULL;
+
+       if (tot_shape_keys || params->add_key_index) {
                CustomData_add_layer(&bm->vdata, CD_SHAPE_KEYINDEX, CD_ASSIGN, NULL, 0);
+       }
 
+       if (tot_shape_keys) {
                /* check if we need to generate unique ids for the shapekeys.
                 * this also exists in the file reading code, but is here for
                 * a sanity check */
@@ -305,7 +305,7 @@ void BM_mesh_bm_from_me(
 
                if (actkey && actkey->totelem == me->totvert) {
                        keyco = actkey->data;
-                       bm->shapenr = act_key_nr;
+                       bm->shapenr = params->active_shapekey;
                }
 
                for (i = 0, block = me->key->block.first; block; block = block->next, i++) {
@@ -314,6 +314,8 @@ void BM_mesh_bm_from_me(
 
                        j = CustomData_get_layer_index_n(&bm->vdata, CD_SHAPEKEY, i);
                        bm->vdata.layers[j].uid = block->uid;
+
+                       shape_key_table[i] = (const float (*)[3])block->data;
                }
        }
 
@@ -324,13 +326,17 @@ void BM_mesh_bm_from_me(
 
        BM_mesh_cd_flag_apply(bm, me->cd_flag);
 
-       cd_vert_bweight_offset = CustomData_get_offset(&bm->vdata, CD_BWEIGHT);
-       cd_edge_bweight_offset = CustomData_get_offset(&bm->edata, CD_BWEIGHT);
-       cd_edge_crease_offset  = CustomData_get_offset(&bm->edata, CD_CREASE);
-       cd_shape_keyindex_offset = me->key ? CustomData_get_offset(&bm->vdata, CD_SHAPE_KEYINDEX) : -1;
+       const int cd_vert_bweight_offset = CustomData_get_offset(&bm->vdata, CD_BWEIGHT);
+       const int cd_edge_bweight_offset = CustomData_get_offset(&bm->edata, CD_BWEIGHT);
+       const int cd_edge_crease_offset  = CustomData_get_offset(&bm->edata, CD_CREASE);
+       const int cd_shape_key_offset = me->key ? CustomData_get_offset(&bm->vdata, CD_SHAPEKEY) : -1;
+       const int cd_shape_keyindex_offset = (tot_shape_keys || params->add_key_index) ?
+                 CustomData_get_offset(&bm->vdata, CD_SHAPE_KEYINDEX) : -1;
 
        for (i = 0, mvert = me->mvert; i < me->totvert; i++, mvert++) {
-               v = vtable[i] = BM_vert_create(bm, keyco && set_key ? keyco[i] : mvert->co, NULL, BM_CREATE_SKIP_CD);
+               v = vtable[i] = BM_vert_create(
+                       bm, keyco && params->use_shapekey ? keyco[i] : mvert->co, NULL,
+                       BM_CREATE_SKIP_CD);
                BM_elem_index_set(v, i); /* set_ok */
 
                /* transfer flag */
@@ -348,17 +354,14 @@ void BM_mesh_bm_from_me(
 
                if (cd_vert_bweight_offset != -1) BM_ELEM_CD_SET_FLOAT(v, cd_vert_bweight_offset, (float)mvert->bweight / 255.0f);
 
-               /* set shapekey data */
-               if (me->key) {
-                       /* set shape key original index */
-                       if (cd_shape_keyindex_offset != -1) BM_ELEM_CD_SET_INT(v, cd_shape_keyindex_offset, i);
-
-                       for (block = me->key->block.first, j = 0; block; block = block->next, j++) {
-                               float *co = CustomData_bmesh_get_n(&bm->vdata, v->head.data, CD_SHAPEKEY, j);
+               /* set shape key original index */
+               if (cd_shape_keyindex_offset != -1) BM_ELEM_CD_SET_INT(v, cd_shape_keyindex_offset, i);
 
-                               if (co) {
-                                       copy_v3_v3(co, ((float *)block->data) + 3 * i);
-                               }
+               /* set shapekey data */
+               if (tot_shape_keys) {
+                       float (*co_dst)[3] = BM_ELEM_CD_GET_VOID_P(v, cd_shape_key_offset);
+                       for (j = 0; j < tot_shape_keys; j++, co_dst++) {
+                               copy_v3_v3(*co_dst, shape_key_table[j][i]);
                        }
                }
        }
@@ -438,7 +441,7 @@ void BM_mesh_bm_from_me(
                /* Copy Custom Data */
                CustomData_to_bmesh_block(&me->pdata, &bm->pdata, i, &f->head.data, true);
 
-               if (calc_face_normal) {
+               if (params->calc_face_normal) {
                        BM_face_normal_update(f);
                }
        }
@@ -511,7 +514,12 @@ static BMVert **bm_to_mesh_vertex_map(BMesh *bm, int ototvert)
        if (cd_shape_keyindex_offset != -1) {
                BM_ITER_MESH_INDEX (eve, &iter, bm, BM_VERTS_OF_MESH, i) {
                        const int keyi = BM_ELEM_CD_GET_INT(eve, cd_shape_keyindex_offset);
-                       if ((keyi != ORIGINDEX_NONE) && (keyi < ototvert)) {
+                       if ((keyi != ORIGINDEX_NONE) &&
+                           (keyi < ototvert) &&
+                           /* not fool-proof, but chances are if we have many verts with the same index,
+                            * we will want to use the first one, since the second is more likely to be a duplicate. */
+                           (vertMap[keyi] == NULL))
+                       {
                                vertMap[keyi] = eve;
                        }
                }
@@ -568,7 +576,9 @@ BLI_INLINE void bmesh_quick_edgedraw_flag(MEdge *med, BMEdge *e)
        }
 }
 
-void BM_mesh_bm_to_me(BMesh *bm, Mesh *me, bool do_tessface)
+void BM_mesh_bm_to_me(
+        BMesh *bm, Mesh *me,
+        const struct BMeshToMeshParams *params)
 {
        MLoop *mloop;
        MPoly *mpoly;
@@ -629,10 +639,13 @@ void BM_mesh_bm_to_me(BMesh *bm, Mesh *me, bool do_tessface)
        me->totface = 0;
        me->act_face = -1;
 
-       CustomData_copy(&bm->vdata, &me->vdata, CD_MASK_MESH, CD_CALLOC, me->totvert);
-       CustomData_copy(&bm->edata, &me->edata, CD_MASK_MESH, CD_CALLOC, me->totedge);
-       CustomData_copy(&bm->ldata, &me->ldata, CD_MASK_MESH, CD_CALLOC, me->totloop);
-       CustomData_copy(&bm->pdata, &me->pdata, CD_MASK_MESH, CD_CALLOC, me->totpoly);
+       {
+               const CustomDataMask mask = CD_MASK_MESH | params->cd_mask_extra;
+               CustomData_copy(&bm->vdata, &me->vdata, mask, CD_CALLOC, me->totvert);
+               CustomData_copy(&bm->edata, &me->edata, mask, CD_CALLOC, me->totedge);
+               CustomData_copy(&bm->ldata, &me->ldata, mask, CD_CALLOC, me->totloop);
+               CustomData_copy(&bm->pdata, &me->pdata, mask, CD_CALLOC, me->totpoly);
+       }
 
        CustomData_add_layer(&me->vdata, CD_MVERT, CD_ASSIGN, mvert, me->totvert);
        CustomData_add_layer(&me->edata, CD_MEDGE, CD_ASSIGN, medge, me->totedge);
@@ -781,11 +794,11 @@ void BM_mesh_bm_to_me(BMesh *bm, Mesh *me, bool do_tessface)
                if (vertMap) MEM_freeN(vertMap);
        }
 
-       if (do_tessface) {
+       if (params->calc_tessface) {
                BKE_mesh_tessface_calc(me);
        }
 
-       BKE_mesh_update_customdata_pointers(me, do_tessface);
+       BKE_mesh_update_customdata_pointers(me, params->calc_tessface);
 
        {
                BMEditSelection *selected;
index ce286f6c6629ba211bc36a1811dcc1f8a35519fa..218d821913d0bc3ad3f5c8aeab98338d6d4901a8 100644 (file)
@@ -39,9 +39,28 @@ void BM_mesh_cd_flag_ensure(BMesh *bm, struct Mesh *mesh, const char cd_flag);
 void BM_mesh_cd_flag_apply(BMesh *bm, const char cd_flag);
 char BM_mesh_cd_flag_from_bmesh(BMesh *bm);
 
+
+struct BMeshFromMeshParams {
+       unsigned int calc_face_normal : 1;
+       /* add a vertex CD_SHAPE_KEYINDEX layer */
+       unsigned int add_key_index : 1;
+       /* set vertex coordinates from the shapekey */
+       unsigned int use_shapekey : 1;
+       /* define the active shape key (index + 1) */
+       int active_shapekey;
+};
 void BM_mesh_bm_from_me(
         BMesh *bm, struct Mesh *me,
-        const bool calc_face_normal, const bool set_key, int act_key_nr);
-void BM_mesh_bm_to_me(BMesh *bm, struct Mesh *me, bool do_tessface);
+        const struct BMeshFromMeshParams *params)
+ATTR_NONNULL(1, 2, 3);
+
+struct BMeshToMeshParams {
+       unsigned int calc_tessface : 1;
+       int64_t cd_mask_extra;
+};
+void BM_mesh_bm_to_me(
+        BMesh *bm, struct Mesh *me,
+        const struct BMeshToMeshParams *params)
+ATTR_NONNULL(1, 2, 3);
 
 #endif /* __BMESH_MESH_CONV_H__ */
index d124aaaf80e0eb0f851279a6022d13baa600fd6a..0eb9bf90ca812eafe87d5069371064a98c6e77cf 100644 (file)
@@ -45,7 +45,10 @@ void bmo_mesh_to_bmesh_exec(BMesh *bm, BMOperator *op)
        Mesh *me     = BMO_slot_ptr_get(op->slots_in,  "mesh");
        bool set_key = BMO_slot_bool_get(op->slots_in, "use_shapekey");
 
-       BM_mesh_bm_from_me(bm, me, false, set_key, ob->shapenr);
+       BM_mesh_bm_from_me(
+               bm, me, (&(struct BMeshFromMeshParams){
+                    .use_shapekey = set_key, .active_shapekey = ob->shapenr,
+               }));
 
        if (me->key && ob->shapenr > me->key->totkey) {
                ob->shapenr = me->key->totkey - 1;
@@ -69,5 +72,5 @@ void bmo_bmesh_to_mesh_exec(BMesh *bm, BMOperator *op)
        /* Object *ob = BMO_slot_ptr_get(op, "object"); */
        const bool dotess = !BMO_slot_bool_get(op->slots_in, "skip_tessface");
 
-       BM_mesh_bm_to_me(bm, me, dotess);
+       BM_mesh_bm_to_me(bm, me, (&(struct BMeshToMeshParams){ .calc_tessface = dotess, }));
 }
index b1cbc01a9a6c7fad489410e4435de00f630ff297..b64b10e08339c4523ad6f36561f925c1a2016455 100644 (file)
@@ -118,12 +118,11 @@ int collada_export(Scene *sce,
        export_settings.export_set = BKE_object_relational_superset(sce, objectSet, (eObRelationTypes)includeFilter);
        int export_count = BLI_linklist_count(export_settings.export_set);
 
-       if (export_count==0)
-       {
+       if (export_count == 0) {
                if (export_settings.selected) {
                        fprintf(stderr, "Collada: Found no objects to export.\nPlease ensure that all objects which shall be exported are also visible in the 3D Viewport.\n");
                }
-               else{
+               else {
                        fprintf(stderr, "Collada: Your scene seems to be empty. No Objects will be exported.\n");
                }
        }
index efdfaadd3e28f525b299e67cfd8e70b9cd29d0f2..f8feed8145cc1732829eb0ef0525fc39d5a097b8 100644 (file)
@@ -357,9 +357,12 @@ void bc_triangulate_mesh(Mesh *me)
        int  quad_method = MOD_TRIANGULATE_QUAD_SHORTEDGE; /* XXX: The triangulation method selection could be offered in the UI */
         
        BMesh *bm = BM_mesh_create(&bm_mesh_allocsize_default);
-       BM_mesh_bm_from_me(bm, me, true, false, 0);
+       BMeshFromMeshParams bm_from_me_params = {0};
+       bm_from_me_params.calc_face_normal = true;
+       BM_mesh_bm_from_me(bm, me, &bm_from_me_params);
        BM_mesh_triangulate(bm, quad_method, use_beauty, tag_only, NULL, NULL, NULL);
 
-       BM_mesh_bm_to_me(bm, me, false);
+       BMeshToMeshParams bm_to_me_params = {0};
+       BM_mesh_bm_to_me(bm, me, &bm_to_me_params);
        BM_mesh_free(bm);
 }
index d24c33984ee3471d746f36400a7ae355333166fd..f17349822c9583421674b7785726c98054be1bbc 100644 (file)
@@ -876,6 +876,12 @@ static int curve_draw_exec(bContext *C, wmOperator *op)
                                if (coords_indices.radius != -1) {
                                        co[coords_indices.radius] = selem->pressure;
                                }
+
+                               /* remove doubles */
+                               if ((co != coords) && UNLIKELY(memcmp(co, co - dims, sizeof(float) * dims) == 0)) {
+                                       co -= dims;
+                                       stroke_len--;
+                               }
                        }
                }
 
@@ -1173,7 +1179,7 @@ static int curve_draw_modal(bContext *C, wmOperator *op, const wmEvent *event)
        else if (ELEM(event->type, MOUSEMOVE, INBETWEEN_MOUSEMOVE)) {
                if (cdd->state == CURVE_DRAW_PAINTING) {
                        const float mval_fl[2] = {UNPACK2(event->mval)};
-                       if (len_squared_v2v2(mval_fl, cdd->prev.location_world) > SQUARE(STROKE_SAMPLE_DIST_MIN_PX)) {
+                       if (len_squared_v2v2(mval_fl, cdd->prev.mouse) > SQUARE(STROKE_SAMPLE_DIST_MIN_PX)) {
                                curve_draw_event_add(op, event);
                        }
                }
index 5436ef4b06b1e4a4c7de81fa42606263130c2ef8..de798b1fce2ee29130f00a54a8f7516bd7e9533e 100644 (file)
@@ -80,7 +80,7 @@ void EDBM_mesh_normals_update(struct BMEditMesh *em);
 void EDBM_mesh_clear(struct BMEditMesh *em);
 
 void EDBM_selectmode_to_scene(struct bContext *C);
-void EDBM_mesh_make(struct ToolSettings *ts, struct Object *ob);
+void EDBM_mesh_make(struct ToolSettings *ts, struct Object *ob, const bool add_key_index);
 void EDBM_mesh_free(struct BMEditMesh *em);
 void EDBM_mesh_load(struct Object *ob);
 struct DerivedMesh *EDBM_mesh_deform_dm_get(struct BMEditMesh *em);
index 3682cff3908a528f00508f34dfb3e7634817bf64..34ea849aea78ff7b7e5bca7fc4798f183a62fefe 100644 (file)
@@ -1342,7 +1342,7 @@ static int ui_id_brush_get_icon(const bContext *C, ID *id)
                Object *ob = CTX_data_active_object(C);
                SpaceImage *sima;
                EnumPropertyItem *items = NULL;
-               int tool, mode = 0;
+               int tool = PAINT_TOOL_DRAW, mode = 0;
 
                /* XXX: this is not nice, should probably make brushes
                 * be strictly in one paint mode only to avoid
index 44f0c6f2248f5b550ef9f09e924362127dd36f52..49794d2e5cde3ca43590a12295558a6eb22ac344 100644 (file)
@@ -3011,7 +3011,7 @@ static Base *mesh_separate_tagged(Main *bmain, Scene *scene, Base *base_old, BMe
 
        BM_mesh_normals_update(bm_new);
 
-       BM_mesh_bm_to_me(bm_new, base_new->object->data, false);
+       BM_mesh_bm_to_me(bm_new, base_new->object->data, (&(struct BMeshToMeshParams){0}));
 
        BM_mesh_free(bm_new);
        ((Mesh *)base_new->object->data)->edit_btmesh = NULL;
@@ -3294,7 +3294,7 @@ static int edbm_separate_exec(bContext *C, wmOperator *op)
 
                                        bm_old = BM_mesh_create(&bm_mesh_allocsize_default);
 
-                                       BM_mesh_bm_from_me(bm_old, me, false, false, 0);
+                                       BM_mesh_bm_from_me(bm_old, me, (&(struct BMeshFromMeshParams){0}));
 
                                        switch (type) {
                                                case MESH_SEPARATE_MATERIAL:
@@ -3309,7 +3309,7 @@ static int edbm_separate_exec(bContext *C, wmOperator *op)
                                        }
 
                                        if (retval_iter) {
-                                               BM_mesh_bm_to_me(bm_old, me, false);
+                                               BM_mesh_bm_to_me(bm_old, me, (&(struct BMeshToMeshParams){0}));
 
                                                DAG_id_tag_update(&me->id, OB_RECALC_DATA);
                                                WM_event_add_notifier(C, NC_GEOM | ND_DATA, me);
index 33f8455e6146f67de9b3b202a1beb8562a2987d5..82ec93c162f9a0492a46a07422108f70b767e120 100644 (file)
@@ -347,7 +347,7 @@ void EDBM_selectmode_to_scene(bContext *C)
        WM_event_add_notifier(C, NC_SCENE | ND_TOOLSETTINGS, scene);
 }
 
-void EDBM_mesh_make(ToolSettings *ts, Object *ob)
+void EDBM_mesh_make(ToolSettings *ts, Object *ob, const bool add_key_index)
 {
        Mesh *me = ob->data;
        BMesh *bm;
@@ -356,7 +356,7 @@ void EDBM_mesh_make(ToolSettings *ts, Object *ob)
                BKE_mesh_convert_mfaces_to_mpolys(me);
        }
 
-       bm = BKE_mesh_to_bmesh(me, ob);
+       bm = BKE_mesh_to_bmesh(me, ob, add_key_index);
 
        if (me->edit_btmesh) {
                /* this happens when switching shape keys */
@@ -395,7 +395,7 @@ void EDBM_mesh_load(Object *ob)
                bm->shapenr = 1;
        }
 
-       BM_mesh_bm_to_me(bm, me, false);
+       BM_mesh_bm_to_me(bm, me, (&(struct BMeshToMeshParams){0}));
 
 #ifdef USE_TESSFACE_DEFAULT
        BKE_mesh_tessface_calc(me);
@@ -533,7 +533,10 @@ static void *editbtMesh_to_undoMesh(void *emv, void *obdata)
 
        /* BM_mesh_validate(em->bm); */ /* for troubleshooting */
 
-       BM_mesh_bm_to_me(em->bm, &um->me, false);
+       BM_mesh_bm_to_me(
+               em->bm, &um->me, (&(struct BMeshToMeshParams){
+                   .cd_mask_extra = CD_MASK_SHAPE_KEYINDEX,
+               }));
 
        um->selectmode = em->selectmode;
        um->shapenr = em->bm->shapenr;
@@ -557,7 +560,10 @@ static void undoMesh_to_editbtMesh(void *umv, void *em_v, void *obdata)
 
        bm = BM_mesh_create(&allocsize);
 
-       BM_mesh_bm_from_me(bm, &um->me, true, false, um->shapenr);
+       BM_mesh_bm_from_me(
+               bm, &um->me, (&(struct BMeshFromMeshParams){
+                   .calc_face_normal = true, .active_shapekey = um->shapenr,
+               }));
 
        em_tmp = BKE_editmesh_create(bm, true);
        *em = *em_tmp;
index a2054a5f43cde9deacd6b0c481c17747b29f4593..e0ddc017e93982c8f46185f01af314280df9e241 100644 (file)
@@ -582,7 +582,7 @@ static int drop_named_image_invoke(bContext *C, wmOperator *op, const wmEvent *e
        obedit = base->object;
        me = obedit->data;
        if (me->edit_btmesh == NULL) {
-               EDBM_mesh_make(scene->toolsettings, obedit);
+               EDBM_mesh_make(scene->toolsettings, obedit, false);
                exitmode = 1;
        }
        if (me->edit_btmesh == NULL)
index bad835b13e7c21464e48ef9ee97aee150b64eb11..90676d2b951ddf153cc212e286b9fd8ddf9fb152 100644 (file)
@@ -572,7 +572,7 @@ int join_mesh_exec(bContext *C, wmOperator *op)
        ED_object_editmode_exit(C, EM_FREEDATA | EM_WAITCURSOR | EM_DO_UNDO);
 #else
        /* toggle editmode using lower level functions so this can be called from python */
-       EDBM_mesh_make(scene->toolsettings, ob);
+       EDBM_mesh_make(scene->toolsettings, ob, false);
        EDBM_mesh_load(ob);
        EDBM_mesh_free(me->edit_btmesh);
        MEM_freeN(me->edit_btmesh);
index 2a199068a3b2a907c71a01d041abadf9848f898a..5b4364076f2cd87db8d85bc247c20017e931c5ac 100644 (file)
@@ -316,6 +316,27 @@ void OBJECT_OT_hide_render_set(wmOperatorType *ot)
 
 /* ******************* toggle editmode operator  ***************** */
 
+static bool mesh_needs_keyindex(const Mesh *me)
+{
+       if (me->key) {
+               return false;  /* will be added */
+       }
+
+       for (const Object *ob = G.main->object.first; ob; ob = ob->id.next) {
+               if ((ob->parent) && (ob->parent->data == me) && ELEM(ob->partype, PARVERT1, PARVERT3)) {
+                       return true;
+               }
+               if (ob->data == me) {
+                       for (const ModifierData *md = ob->modifiers.first; md; md = md->next) {
+                               if (md->type == eModifierType_Hook) {
+                                       return true;
+                               }
+                       }
+               }
+       }
+       return false;
+}
+
 /**
  * Load EditMode data back into the object,
  * optionally freeing the editmode data.
@@ -493,15 +514,15 @@ void ED_object_editmode_enter(bContext *C, int flag)
                ok = 1;
                scene->obedit = ob;  /* context sees this */
 
-               EDBM_mesh_make(scene->toolsettings, ob);
+               const bool use_key_index = mesh_needs_keyindex(ob->data);
+
+               EDBM_mesh_make(scene->toolsettings, ob, use_key_index);
 
                em = BKE_editmesh_from_object(ob);
                if (LIKELY(em)) {
                        /* order doesn't matter */
                        EDBM_mesh_normals_update(em);
                        BKE_editmesh_tessface_calc(em);
-
-                       BM_mesh_select_mode_flush(em->bm);
                }
 
                WM_event_add_notifier(C, NC_SCENE | ND_MODE | NS_EDITMODE_MESH, scene);
index 492b6724f93e2955fab133c4b019e8302fa2759c..438c10c51fa100132c8e16dc78a8f16beb09dc75 100644 (file)
@@ -316,7 +316,7 @@ static bool object_hook_index_array(Scene *scene, Object *obedit,
                        BMEditMesh *em;
 
                        EDBM_mesh_load(obedit);
-                       EDBM_mesh_make(scene->toolsettings, obedit);
+                       EDBM_mesh_make(scene->toolsettings, obedit, true);
 
                        DAG_id_tag_update(obedit->data, 0);
 
index 07b666ee510bf457a28484de3c71b95b4d4cab47..31b7b584a3ab4f9740b10b68251c979337ba8243 100644 (file)
@@ -135,7 +135,7 @@ static int vertex_parent_set_exec(bContext *C, wmOperator *op)
                BMEditMesh *em;
 
                EDBM_mesh_load(obedit);
-               EDBM_mesh_make(scene->toolsettings, obedit);
+               EDBM_mesh_make(scene->toolsettings, obedit, true);
 
                DAG_id_tag_update(obedit->data, 0);
 
index f614025fa0ee40aa071db8b7a822e0ec9a6544e0..bce3b46010b4bc2097d584dc5ffb6716a8d29758 100644 (file)
@@ -5866,15 +5866,17 @@ static int add_simple_uvs_exec(bContext *C, wmOperator *UNUSED(op))
 
        ED_mesh_uv_texture_ensure(me, NULL);
 
-       BM_mesh_bm_from_me(bm, me, true, false, 0);
-
+       BM_mesh_bm_from_me(
+               bm, me,(&(struct BMeshFromMeshParams){
+                   .calc_face_normal = true,
+               }));
        /* select all uv loops first - pack parameters needs this to make sure charts are registered */
        ED_uvedit_select_all(bm);
        ED_uvedit_unwrap_cube_project(ob, bm, 1.0, false);
        /* set the margin really quickly before the packing operation*/
        scene->toolsettings->uvcalc_margin = 0.001f;
        ED_uvedit_pack_islands(scene, ob, bm, false, false, true);
-       BM_mesh_bm_to_me(bm, me, false);
+       BM_mesh_bm_to_me(bm, me, (&(struct BMeshToMeshParams){0}));
        BM_mesh_free(bm);
 
        if (synch_selection)
index 40ff662a2c2157ffcd4b42d32691b2d6a39306c4..7ebc050978a53d16488a1775e7697a50380d2c45 100644 (file)
@@ -5003,7 +5003,10 @@ void sculpt_dynamic_topology_enable(bContext *C)
        /* Create triangles-only BMesh */
        ss->bm = BM_mesh_create(&allocsize);
 
-       BM_mesh_bm_from_me(ss->bm, me, true, true, ob->shapenr);
+       BM_mesh_bm_from_me(
+               ss->bm, me, (&(struct BMeshFromMeshParams){
+                   .calc_face_normal = true, .use_shapekey = true, .active_shapekey = ob->shapenr,
+               }));
        sculpt_dynamic_topology_triangulate(ss->bm);
        BM_data_layer_add(ss->bm, &ss->bm->vdata, CD_PAINT_MASK);
        sculpt_dyntopo_node_layers_add(ss);
index e77f545fbc091cb14d58ecb7168f793cd1e2bb48..7fb294529c9bd0df6b0e4d3cb6bf2e9d2e7448cb 100644 (file)
@@ -225,7 +225,7 @@ static void file_refresh(const bContext *C, ScrArea *sa)
        filelist_setsorting(sfile->files, params->sort);
        filelist_setfilter_options(sfile->files, (params->flag & FILE_HIDE_DOT) != 0,
                                                 false, /* TODO hide_parent, should be controllable? */
-                                                params->flag & FILE_FILTER ? params->filter : 0,
+                                                (params->flag & FILE_FILTER) ? params->filter : 0,
                                                 params->filter_id,
                                                 params->filter_glob,
                                                 params->filter_search);
index 07e79c5a59c444b8ec75a3b059ead6d8dbd88a09..4abc7f5e71b99ac03067a0bbae886bef4510db4a 100644 (file)
@@ -107,7 +107,7 @@ static bool node_group_has_output_dfs(bNode *node)
             current_node = current_node->next)
        {
                if (current_node->type == NODE_GROUP) {
-                       if (node_group_has_output_dfs(current_node)) {
+                       if (current_node->id && node_group_has_output_dfs(current_node)) {
                                return true;
                        }
                }
index 9448f6af69fb152a55873585c825a8dbcc68c38c..81605a80f69e28f26a3e0729ac30f3e47cd16266 100644 (file)
@@ -1009,7 +1009,7 @@ static void draw_documentation(const SpaceText *st, ARegion *ar)
                if (lines >= DOC_HEIGHT) break;
        }
 
-       if (0 /* XXX doc_scroll*/ > 0 && lines < DOC_HEIGHT) {
+       if (0 /* XXX doc_scroll*/ /* > 0 && lines < DOC_HEIGHT */) {
                // XXX doc_scroll--;
                draw_documentation(st, ar);
        }
index a7f549b65ae841a3901e96b339cdb221d884cd8e..7dd45327352d00109450a3d01f80c8e887606f42 100644 (file)
@@ -141,18 +141,18 @@ static int time_view_all_exec(bContext *C, wmOperator *UNUSED(op))
 {
        Scene *scene = CTX_data_scene(C);
        ARegion *ar = CTX_wm_region(C);
-       View2D *v2d = (ar) ? &ar->v2d : NULL;
-       float extra;
-       
+
        if (ELEM(NULL, scene, ar))
                return OPERATOR_CANCELLED;
-               
+
+       View2D *v2d = &ar->v2d;
+
        /* set extents of view to start/end frames (Preview Range too) */
        v2d->cur.xmin = (float)PSFRA;
        v2d->cur.xmax = (float)PEFRA;
        
        /* we need an extra "buffer" factor on either side so that the endpoints are visible */
-       extra = 0.01f * BLI_rctf_size_x(&v2d->cur);
+       const float extra = 0.01f * BLI_rctf_size_x(&v2d->cur);
        v2d->cur.xmin -= extra;
        v2d->cur.xmax += extra;
        
index 7d433a78411758f36ed8305b484e44526d839985..3c96b628cd6d28c0cf055dc1ba183a6817b8f66b 100644 (file)
@@ -259,8 +259,8 @@ bool GPU_legacy_support(void)
 
                        if (G.debug & G_DEBUG_GPU) {
                                printf("GL_CONTEXT_PROFILE_MASK = %#x (%s profile)\n", (unsigned int)profile,
-                                      profile & GL_CONTEXT_COMPATIBILITY_PROFILE_BIT ? "compatibility" :
-                                      profile & GL_CONTEXT_CORE_PROFILE_BIT ? "core" : "unknown");
+                                      (profile & GL_CONTEXT_COMPATIBILITY_PROFILE_BIT) ? "compatibility" :
+                                      (profile & GL_CONTEXT_CORE_PROFILE_BIT) ? "core" : "unknown");
                        }
 
                        if (profile == 0) {
index b425a454d33e84467c2021e8bde1f39af694d39c..a09853eaddc70f985ca01bc5c2b1617a8153de48 100644 (file)
@@ -333,7 +333,7 @@ static void rna_Actuator_constraint_detect_material_set(struct PointerRNA *ptr,
        bActuator *act = (bActuator *)ptr->data;
        bConstraintActuator *ca = act->data;
 
-       short old_value = (ca->flag & ACT_CONST_MATERIAL ? 1 : 0);
+       short old_value = (ca->flag & ACT_CONST_MATERIAL) ? 1 : 0;
 
        if (old_value != value) {
                ca->flag ^= ACT_CONST_MATERIAL;
index c9099f5faec75c805a022b58fa8acbb9611ae71c..00101f5692b87b45f8dc3654566d7866bc1cca21 100644 (file)
@@ -264,7 +264,7 @@ static void rna_Object_active_shape_update(Main *bmain, Scene *scene, PointerRNA
                switch (ob->type) {
                        case OB_MESH:
                                EDBM_mesh_load(ob);
-                               EDBM_mesh_make(scene->toolsettings, ob);
+                               EDBM_mesh_make(scene->toolsettings, ob, true);
 
                                DAG_id_tag_update(ob->data, 0);
 
@@ -298,7 +298,7 @@ static void rna_Object_select_update(Main *UNUSED(bmain), Scene *scene, PointerR
 {
        if (scene) {
                Object *ob = (Object *)ptr->id.data;
-               short mode = ob->flag & SELECT ? BA_SELECT : BA_DESELECT;
+               short mode = (ob->flag & SELECT) ? BA_SELECT : BA_DESELECT;
                ED_base_object_select(BKE_scene_base_find(scene, ob), mode);
        }
 }
@@ -306,7 +306,7 @@ static void rna_Object_select_update(Main *UNUSED(bmain), Scene *scene, PointerR
 static void rna_Base_select_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
 {
        Base *base = (Base *)ptr->data;
-       short mode = base->flag & BA_SELECT ? BA_SELECT : BA_DESELECT;
+       short mode = (base->flag & BA_SELECT) ? BA_SELECT : BA_DESELECT;
        ED_base_object_select(base, mode);
 }
 
@@ -1096,7 +1096,7 @@ static void rna_GameObjectSettings_state_get(PointerRNA *ptr, int *values)
 {
        Object *ob = (Object *)ptr->data;
        int i;
-       int all_states = (ob->scaflag & OB_ALLSTATE ? 1 : 0);
+       int all_states = (ob->scaflag & OB_ALLSTATE) ? 1 : 0;
 
        memset(values, 0, sizeof(int) * OB_MAX_STATES);
        for (i = 0; i < OB_MAX_STATES; i++) {
index 3c45cb9351409fa05d10465d696a7b80307760b4..a0722af522b1bd5e706e89c2f3f4149b92d45e60 100644 (file)
@@ -916,7 +916,7 @@ static PyObject *bpy_bmesh_to_mesh(BPy_BMesh *self, PyObject *args)
        /* python won't ensure matching uv/mtex */
        BM_mesh_cd_validate(bm);
 
-       BM_mesh_bm_to_me(bm, me, false);
+       BM_mesh_bm_to_me(bm, me, (&(struct BMeshToMeshParams){0}));
 
        /* we could have the user do this but if they forget blender can easy crash
         * since the references arrays for the objects derived meshes are now invalid */
@@ -1075,7 +1075,10 @@ static PyObject *bpy_bmesh_from_mesh(BPy_BMesh *self, PyObject *args, PyObject *
 
        bm = self->bm;
 
-       BM_mesh_bm_from_me(bm, me, use_fnorm, use_shape_key, shape_key_index + 1);
+       BM_mesh_bm_from_me(
+               bm, me, (&(struct BMeshFromMeshParams){
+                   .calc_face_normal = use_fnorm, .use_shapekey = use_shape_key, .active_shapekey = shape_key_index + 1,
+               }));
 
        Py_RETURN_NONE;
 }
index ea74c8074e52f0082a4165c9ccaf678900f6288d..f471b535838af9d7ff8b2e7a5bb29cd0f1a765ce 100644 (file)
@@ -220,7 +220,7 @@ bool BPY_string_is_keyword(const char *str) { return false; }
 /*new render funcs */
 void EDBM_selectmode_set(struct BMEditMesh *em) RET_NONE
 void EDBM_mesh_load(struct Object *ob) RET_NONE
-void EDBM_mesh_make(struct ToolSettings *ts, struct Object *ob) RET_NONE
+void EDBM_mesh_make(struct ToolSettings *ts, struct Object *ob, const bool use_key_index) RET_NONE
 void EDBM_mesh_normals_update(struct BMEditMesh *em) RET_NONE
 void *g_system;
 bool EDBM_mtexpoly_check(struct BMEditMesh *em) RET_ZERO