diff --git a/CMakeLists.txt b/CMakeLists.txt
index 90fd4c33da6..c50caa4a348 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -124,6 +124,10 @@ mark_as_advanced(WITH_PYTHON_SECURITY) # some distributions see this as a secur
option(WITH_PYTHON_SAFETY "Enable internal API error checking to track invalid data to prevent crash on access (at the expense of some effeciency, only enable for development)." OFF)
option(WITH_PYTHON_MODULE "Enable building as a python module which runs without a user interface, like running regular blender in background mode (experimental, only enable for development)" OFF)
+if (APPLE)
+ option(WITH_PYTHON_FRAMEWORK "Enable building using the Python available in the framework (OSX only)" OFF)
+endif()
+
option(WITH_BUILDINFO "Include extra build details (only disable for development & faster builds)" ON)
option(WITH_IK_ITASC "Enable ITASC IK solver (only disable for development & for incompatible C++ compilers)" ON)
option(WITH_IK_SOLVER "Enable Legacy IK solver (only disable for development)" ON)
@@ -242,6 +246,10 @@ option(WITH_RAYOPTIMIZATION "Enable use of SIMD (SSE) optimizations for the rayt
if(UNIX AND NOT APPLE)
option(WITH_INSTALL_PORTABLE "Install redistributeable runtime, otherwise install into CMAKE_INSTALL_PREFIX" ON)
option(WITH_STATIC_LIBS "Try to link with static libraries, as much as possible, to make blender more portable across distributions" OFF)
+ if(WITH_STATIC_LIBS)
+ option(WITH_BOOST_ICU "Boost uses ICU library (required for linking with static Boost built with libicu)." OFF)
+ mark_as_advanced(WITH_BOOST_ICU)
+ endif()
endif()
option(WITH_PYTHON_INSTALL "Copy system python into the blender install folder" ON)
option(WITH_PYTHON_INSTALL_NUMPY "Copy system numpy into the blender install folder" ON)
@@ -253,7 +261,7 @@ option(WITH_CYCLES "Enable cycles Render Engine" ON)
option(WITH_CYCLES_TEST "Build cycles test application" OFF)
option(WITH_CYCLES_OSL "Build Cycles with OSL support" OFF)
option(WITH_CYCLES_CUDA_BINARIES "Build cycles CUDA binaries" OFF)
-set(CYCLES_CUDA_BINARIES_ARCH sm_13 sm_20 sm_21 sm_30 CACHE STRING "CUDA architectures to build binaries for")
+set(CYCLES_CUDA_BINARIES_ARCH sm_20 sm_21 sm_30 CACHE STRING "CUDA architectures to build binaries for")
mark_as_advanced(CYCLES_CUDA_BINARIES_ARCH)
unset(PLATFORM_DEFAULT)
@@ -682,7 +690,7 @@ if(UNIX AND NOT APPLE)
list(APPEND __boost_packages locale)
endif()
find_package(Boost 1.48 COMPONENTS ${__boost_packages})
- if(Boost_USE_STATIC_LIBS AND Boost_USE_ICU)
+ if(Boost_USE_STATIC_LIBS AND WITH_BOOST_ICU)
find_package(IcuLinux)
endif()
mark_as_advanced(Boost_DIR) # why doesnt boost do this?
@@ -1460,11 +1468,10 @@ elseif(APPLE)
endif()
if(WITH_PYTHON)
- if(NOT WITH_PYTHON_MODULE)
- # we use precompiled libraries for py 3.3 and up by default
-
+ # we use precompiled libraries for py 3.3 and up by default
+ set(PYTHON_VERSION 3.3)
+ if(NOT WITH_PYTHON_MODULE AND NOT WITH_PYTHON_FRAMEWORK)
# normally cached but not since we include them with blender
- set(PYTHON_VERSION 3.3)
set(PYTHON_INCLUDE_DIR "${LIBDIR}/python/include/python${PYTHON_VERSION}m")
# set(PYTHON_BINARY "${LIBDIR}/python/bin/python${PYTHON_VERSION}") # not used yet
set(PYTHON_LIBRARY python${PYTHON_VERSION}m)
@@ -1472,9 +1479,6 @@ elseif(APPLE)
# set(PYTHON_LINKFLAGS "-u _PyMac_Error") # won't build with this enabled
else()
# module must be compiled against Python framework
-
- # normally cached but not since we include them with blender
- set(PYTHON_VERSION 3.3)
set(PYTHON_INCLUDE_DIR "/Library/Frameworks/Python.framework/Versions/${PYTHON_VERSION}/include/python${PYTHON_VERSION}m")
set(PYTHON_BINARY "/Library/Frameworks/Python.framework/Versions/${PYTHON_VERSION}/bin/python${PYTHON_VERSION}")
#set(PYTHON_LIBRARY python${PYTHON_VERSION})
@@ -1576,8 +1580,8 @@ elseif(APPLE)
set(WITH_INPUT_NDOF OFF) # unsupported
endif()
- if(WITH_PYTHON_MODULE)
- set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} /Library/Frameworks/Python.framework/Versions/${PYTHON_VERSION}/python")# force cmake to link right framework
+ if(WITH_PYTHON_MODULE OR WITH_PYTHON_FRAMEWORK)
+ set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} /Library/Frameworks/Python.framework/Versions/${PYTHON_VERSION}/Python")# force cmake to link right framework
endif()
if(WITH_OPENCOLLADA)
@@ -2185,6 +2189,9 @@ if(FIRST_RUN)
info_cfg_option(WITH_PYTHON_INSTALL_NUMPY)
info_cfg_option(WITH_PYTHON_MODULE)
info_cfg_option(WITH_PYTHON_SAFETY)
+ if(APPLE)
+ info_cfg_option(WITH_PYTHON_FRAMEWORK)
+ endif()
info_cfg_text("Modifiers:")
info_cfg_option(WITH_MOD_BOOLEAN)
diff --git a/build_files/build_environment/install_deps.sh b/build_files/build_environment/install_deps.sh
index 97bd94f55b2..5175eb9a4f6 100755
--- a/build_files/build_environment/install_deps.sh
+++ b/build_files/build_environment/install_deps.sh
@@ -188,7 +188,7 @@ OCIO_VERSION_MIN="1.0"
OCIO_FORCE_REBUILD=false
OCIO_SKIP=false
-OIIO_VERSION="1.1.1"
+OIIO_VERSION="1.1.7"
OIIO_SOURCE="https://github.com/OpenImageIO/oiio/tarball/Release-$OIIO_VERSION"
OIIO_VERSION_MIN="1.1"
OIIO_FORCE_REBUILD=false
@@ -203,8 +203,8 @@ LLVM_FORCE_REBUILD=false
LLVM_SKIP=false
# OSL needs to be compiled for now!
-OSL_VERSION="1.2.0"
-OSL_SOURCE="https://github.com/mont29/OpenShadingLanguage/archive/blender-fixes.tar.gz"
+OSL_VERSION="1.3.0"
+OSL_SOURCE="https://github.com/imageworks/OpenShadingLanguage/archive/Release-1.3.0.tar.gz"
OSL_FORCE_REBUILD=false
OSL_SKIP=false
@@ -780,27 +780,6 @@ compile_OIIO() {
tar -C $SRC --transform "s,(.*/?)OpenImageIO-oiio[^/]*(.*),\1OpenImageIO-$OIIO_VERSION\2,x" \
-xf $_src.tar.gz
- cd $_src
-
- # XXX Ugly patching hack!
- cat << EOF | patch -p1
-diff --git a/src/libutil/SHA1.cpp b/src/libutil/SHA1.cpp
-index b9e6c8b..c761185 100644
---- a/src/libutil/SHA1.cpp
-+++ b/src/libutil/SHA1.cpp
-@@ -8,9 +8,9 @@
-
- // If compiling with MFC, you might want to add #include "StdAfx.h"
-
-+#include "SHA1.h"
- #include "hash.h"
- #include "dassert.h"
--#include "SHA1.h"
-
- #ifdef SHA1_UTILITY_FUNCTIONS
- #define SHA1_MAX_FILE_BUFFER 8000
-EOF
-
cd $CWD
fi
@@ -1991,7 +1970,7 @@ print_info() {
INFO " $_2"
_buildargs="$_buildargs $_1 $_2"
elif $ALL_STATIC; then
- _1="-D Boost_USE_ICU=ON"
+ _1="-D WITH_BOOST_ICU=ON"
INFO " $_1"
_buildargs="$_buildargs $_1"
fi
@@ -2054,6 +2033,10 @@ print_info() {
INFO "BF_OIIO = '$INST/oiio'"
fi
+ if [ -d $INST/osl ]; then
+ INFO "BF_OSL = '$INST/osl'"
+ fi
+
if [ -d $INST/boost ]; then
INFO "BF_BOOST = '$INST/boost'"
INFO "WITH_BF_BOOST = True"
diff --git a/build_files/buildbot/config/user-config-cuda-glibc211-i686.py b/build_files/buildbot/config/user-config-cuda-glibc211-i686.py
index e72218e6615..0e56c4326f9 100644
--- a/build_files/buildbot/config/user-config-cuda-glibc211-i686.py
+++ b/build_files/buildbot/config/user-config-cuda-glibc211-i686.py
@@ -2,4 +2,4 @@ BF_BUILDDIR = '../blender-build/linux-glibc211-i686'
BF_INSTALLDIR = '../blender-install/linux-glibc211-i686'
BF_NUMJOBS = 1
-BF_CYCLES_CUDA_BINARIES_ARCH = ['sm_13', 'sm_20', 'sm_21', 'sm_30']
+BF_CYCLES_CUDA_BINARIES_ARCH = ['sm_20', 'sm_21', 'sm_30']
diff --git a/build_files/buildbot/config/user-config-cuda-glibc211-x86_64.py b/build_files/buildbot/config/user-config-cuda-glibc211-x86_64.py
index 10738a11eaa..59725522e18 100644
--- a/build_files/buildbot/config/user-config-cuda-glibc211-x86_64.py
+++ b/build_files/buildbot/config/user-config-cuda-glibc211-x86_64.py
@@ -2,4 +2,4 @@ BF_BUILDDIR = '../blender-build/linux-glibc211-x86_64'
BF_INSTALLDIR = '../blender-install/linux-glibc211-x86_64'
BF_NUMJOBS = 1
-BF_CYCLES_CUDA_BINARIES_ARCH = ['sm_13', 'sm_20', 'sm_21', 'sm_30']
+BF_CYCLES_CUDA_BINARIES_ARCH = ['sm_20', 'sm_21', 'sm_30']
diff --git a/build_files/scons/config/darwin-config.py b/build_files/scons/config/darwin-config.py
index f662ec4d2d1..0e413711210 100644
--- a/build_files/scons/config/darwin-config.py
+++ b/build_files/scons/config/darwin-config.py
@@ -315,7 +315,7 @@ BF_BOOST_LIBPATH = '${BF_BOOST}/lib'
WITH_BF_CYCLES_CUDA_BINARIES = False
BF_CYCLES_CUDA_NVCC = '/usr/local/cuda/bin/nvcc'
-BF_CYCLES_CUDA_BINARIES_ARCH = ['sm_13', 'sm_20', 'sm_21']
+BF_CYCLES_CUDA_BINARIES_ARCH = ['sm_20', 'sm_21', 'sm_30']
#Freestyle
WITH_BF_FREESTYLE = True
diff --git a/build_files/scons/config/linux-config.py b/build_files/scons/config/linux-config.py
index 22e82662ae7..2aec75edb08 100644
--- a/build_files/scons/config/linux-config.py
+++ b/build_files/scons/config/linux-config.py
@@ -209,7 +209,7 @@ WITH_BF_CYCLES = WITH_BF_OIIO and WITH_BF_BOOST
WITH_BF_CYCLES_CUDA_BINARIES = False
BF_CYCLES_CUDA_NVCC = '/usr/local/cuda/bin/nvcc'
-BF_CYCLES_CUDA_BINARIES_ARCH = ['sm_13', 'sm_20', 'sm_21', 'sm_30']
+BF_CYCLES_CUDA_BINARIES_ARCH = ['sm_20', 'sm_21', 'sm_30']
WITH_BF_OPENMP = True
diff --git a/build_files/scons/config/win32-mingw-config.py b/build_files/scons/config/win32-mingw-config.py
index 5362e35878e..691a4842625 100644
--- a/build_files/scons/config/win32-mingw-config.py
+++ b/build_files/scons/config/win32-mingw-config.py
@@ -174,7 +174,7 @@ BF_RAYOPTIMIZATION_SSE_FLAGS = ['-msse']
#CUDA
WITH_BF_CYCLES_CUDA_BINARIES = False
#BF_CYCLES_CUDA_NVCC = "" # Path to the nvidia compiler
-BF_CYCLES_CUDA_BINARIES_ARCH = ['sm_13', 'sm_20', 'sm_21', 'sm_30']
+BF_CYCLES_CUDA_BINARIES_ARCH = ['sm_20', 'sm_21', 'sm_30']
#Freestyle
WITH_BF_FREESTYLE = True
diff --git a/build_files/scons/config/win32-vc-config.py b/build_files/scons/config/win32-vc-config.py
index 06c925ac7da..5aa1e7650cc 100644
--- a/build_files/scons/config/win32-vc-config.py
+++ b/build_files/scons/config/win32-vc-config.py
@@ -189,7 +189,7 @@ BF_BOOST_LIBPATH = '${BF_BOOST}/lib'
#CUDA
WITH_BF_CYCLES_CUDA_BINARIES = False
#BF_CYCLES_CUDA_NVCC = "" # Path to the nvidia compiler
-BF_CYCLES_CUDA_BINARIES_ARCH = ['sm_13', 'sm_20', 'sm_21', 'sm_30']
+BF_CYCLES_CUDA_BINARIES_ARCH = ['sm_20', 'sm_21', 'sm_30']
#Ray trace optimization
WITH_BF_RAYOPTIMIZATION = True
diff --git a/build_files/scons/config/win64-mingw-config.py b/build_files/scons/config/win64-mingw-config.py
index 5e6e16b1771..203d63bb1a1 100644
--- a/build_files/scons/config/win64-mingw-config.py
+++ b/build_files/scons/config/win64-mingw-config.py
@@ -146,7 +146,7 @@ BF_OPENCOLLADA_LIBPATH = '${BF_OPENCOLLADA}/lib'
WITH_BF_CYCLES = True
WITH_BF_CYCLES_CUDA_BINARIES = False
BF_CYCLES_CUDA_NVCC = "" # Path to the NVIDIA CUDA compiler
-BF_CYCLES_CUDA_BINARIES_ARCH = ['sm_13', 'sm_20', 'sm_21', 'sm_30']
+BF_CYCLES_CUDA_BINARIES_ARCH = ['sm_20', 'sm_21', 'sm_30']
WITH_BF_OIIO = True
BF_OIIO = LIBDIR + '/openimageio'
diff --git a/build_files/scons/config/win64-vc-config.py b/build_files/scons/config/win64-vc-config.py
index ef938ff3337..c2f57dab0a7 100644
--- a/build_files/scons/config/win64-vc-config.py
+++ b/build_files/scons/config/win64-vc-config.py
@@ -185,7 +185,7 @@ BF_BOOST_LIBPATH = '${BF_BOOST}/lib'
#CUDA
WITH_BF_CYCLES_CUDA_BINARIES = False
#BF_CYCLES_CUDA_NVCC = "" # Path to the nvidia compiler
-BF_CYCLES_CUDA_BINARIES_ARCH = ['sm_13', 'sm_20', 'sm_21', 'sm_30']
+BF_CYCLES_CUDA_BINARIES_ARCH = ['sm_20', 'sm_21', 'sm_30']
#Ray trace optimization
WITH_BF_RAYOPTIMIZATION = True
diff --git a/doc/license/bf-members.txt b/doc/license/bf-members.txt
index 41aad8b7264..d2f71a56ad5 100644
--- a/doc/license/bf-members.txt
+++ b/doc/license/bf-members.txt
@@ -35,7 +35,7 @@ Eric Van Hensbergen
Christian Reichlin
brian moore
Anthony Walker
-Carsten Hfer
+Carsten Höfer
Raymond Fordham
David Megginson
Jason Schmidt
@@ -78,7 +78,7 @@ Ken Payne
DEBEUX Sylvain
Douglas Philips
Lai Che Hung
-Johan Bolmsj
+Johan Bolmsjö
Aaron Mitchell
Teinye Horsfall
Martin Marbach
@@ -98,7 +98,7 @@ lukas schroeder
Dan Lyke
Mark Thorpe
A.D. Arul Nirai Selvan
-Herbert Ptzl
+Herbert Pötzl
Andy Payne
LAFFITTE Benoit (KenjForce)
James Ertle
@@ -148,7 +148,7 @@ Kendall Dugger
Brice Due
Simon Vogl
Bernd Koestler
-clment CORDIER
+clément CORDIER
CreationAnimation.com
Pete Carss
HERSEN Antoine
@@ -197,9 +197,9 @@ cadic jean-yves
Ralf Pietersz
KAZY
serge Jadot
-Herv LOUINET
+Hervé LOUINET
Tom Houtman
-Magnus Khler
+Magnus Kööhler
Martin Sinnaeve
Kevin Yank
Tomoichi Iriyama
@@ -221,12 +221,12 @@ Gianluigi Belli
Naoki Abe
NOTTE Jean-Pierre
Jack Way
-Bjrn Westlin
+Björn Westlin
Mitch Magee
wizoptic
Jake Edge
David Hoover
-Xabier Goi
+Xabier Goñi
Daniel Fort
Erik Noteboom
Pavel Vostatek
@@ -234,7 +234,7 @@ Javier Belanche Alonso
Jeffrey Blank
Nathan Ryan
Peter Wrangell
-Josef Sie§
+Josef SieĂ
Timm Krumnack
Steve Martin
Shigeru Matsumoto
@@ -261,7 +261,7 @@ Colin Foster
Sascha Adler
Stuart Duncan
Brendon Smith
-Sbastien COLLETTE
+Sébastien COLLETTE
Clemens Auer
Kay Fricke
Fabian Fagerholm
@@ -282,7 +282,7 @@ STEMax
Jeff Cox
Trevor Ratliff
Matt Henley
-Franois VALETTE
+François VALETTE
Rob Saunders
Mike Luethi
Rami Aubourg-Kaires
@@ -290,9 +290,9 @@ Matthew Thomas
Allan Jacobsen
Adam Lowe
David Hostetler
-Loc Vigneras
+LoĂŻc Vigneras
Dan Reiland
-Pedro Daz del Arco
+Pedro DĂaz del Arco
Pierre Beyssac
Chris Davey
YOSHIAKI Nishino
@@ -385,7 +385,7 @@ Kiernan Holland
Holger Malessa
Masanori Okuda
Andrea Maracci
-Kai-Peter Bckman
+Kai-Peter BĂ€ckman
Gregg Patton
Luis M Ibarra
Julian Green
@@ -394,7 +394,7 @@ Mark Winkelman
Ebbe L. Nielsen
Carlos Orozco
magnetHead
-Krckel Oliver
+KrĂŒckel Oliver
Thomas Ingham
Wes Devauld
Uwe Steinmann
@@ -417,7 +417,7 @@ Steve Mackay
NDNWarrior
Christopher Gray
Darius Clarke (Socinian)
-Jean-Sbastien SEVESTRE
+Jean-Sébastien SEVESTRE
Douglas Fellows
Craig Symons
Quincin Gonjon
@@ -447,7 +447,7 @@ Markus Q. Roberts
Christoher Bartak
Peter Truog
Eric Dynowski
-Philipp Ghring
+Philipp GĂŒhring
Pierre-Yves RANNO
Jason Nollan (Cluh)
Launay Jean-Claude
@@ -465,7 +465,7 @@ TROJANI Cedric
David Polston
Patrick Mullen
Tetsuya Okuno
-Bodo Jger
+Bodo JĂ€ger
Leon Brooks
Cedric Adjih
Michael L. Fisher
@@ -521,7 +521,7 @@ Vincent Stoessel
Adrian Virnig
Chris Dixon
Travis Cole
-Mrten Mrtensson
+MÄrten MÄrtensson
Evan Scott
Mark Coletti
Ken Burke
@@ -541,7 +541,7 @@ Iain Russell
Thomas Bleicher
Anthony Zishka
Jefferson Dubrule
-Esa Piiril
+Esa PiirilÀ
Bill Thiede
William Anderson
Alexander Kittel
@@ -561,7 +561,7 @@ John DiLauro
John Miller
Frederic Crozat
Matt Welland
-Paul Calc
+Paul Calcé
Joe Prochilo
Justin Shafer
Joe Croft
@@ -571,7 +571,7 @@ Alain Gallo
Phuoc Ngo
Krabat
Derek Harmison
-Sbastien Devine
+Sébastien Devine
Kenneth P. Stox
Wade Felde
Kai Groshert
@@ -603,7 +603,7 @@ Martin Forisch
Guillermina Manon
Randal D. Adams
Kevin Reagh (kevin3D)
-Wolfgang Khn
+Wolfgang KĂŒhn
BEAUSOLEIL Arnaud
Stan Jakubek
Klaus Brand
@@ -628,7 +628,7 @@ Samuel Seay
Mike Schaudies
Robert Sherwood
Fernando Villalon Panzano
-Jrg Roschke
+Jörg Roschke
Carl Symons
Peter Pichler
Alan Heckart
@@ -714,7 +714,7 @@ Rau, Bernhard
Stephen Uithoven
Ken Beyer
Matjaz Jakopec
-Eckhard M. Jger
+Eckhard M. JĂ€ger
Mike Siebach
John Harger
Justin W. Carper
@@ -747,7 +747,7 @@ Karl Bartel
Ralph Howes
Matthew J. Stott
Omar Priego
-ke Westerstrm
+Ă
ke Westerström
Imago Viva
James E Hill
Rune Myrland
@@ -785,7 +785,7 @@ Claude Bilat
Mario Palomo
Neipi
Grethus Bode
-Jan Mller
+Jan MĂŒller
Mark Pearson
Stanislav Osicka
DataCare Solutions AG
@@ -804,9 +804,9 @@ Aaron Bredon
Hideki Suzuki
josef radinger
Robert Friemer
-Jrg Zastrau
+Jörg Zastrau
Burton Bicksler
-Kimmo Ms
+Kimmo Mösö
Robert F Johnson
Mark Johnson
Avi Bercovich
@@ -821,21 +821,21 @@ Duffaud
Marco Ardito
Simon Suter
Tobias Huelsdau
-Winfried Englnder
+Winfried EnglÀnder
Stephen Groundwater
Joel Ray Holveck
Mag. Tibor Rudas
Hartmut Wolf
Douglas Jones
brett hartshorn
-Beat Mgert
+Beat MĂ€gert
Javon Prince
bri
James Klicman
Harvey Fong
jeroen v.d. Meulen
Wim Vandersmissen
-Carlos Moreno Rodrguez
+Carlos Moreno RodrĂguez
Trausti Kristjansson
Larry Snyder
olivier
@@ -887,7 +887,7 @@ Fred Roberts
Njin-Zu Chen
GUILLON Marc
Felix Klock
-Ernesto Salas Rodrguez
+Ernesto Salas RodrĂguez
Pavel Roskin
Jaap
Stefan Maass
@@ -911,7 +911,7 @@ delerue
Dirk Behrens
Doc Holiday
Wouter Kerkhoven
-Andreas Bttner
+Andreas BĂŒttner
James Black
Nicholas Ward
David Oberbeck
@@ -940,7 +940,7 @@ Ian Whitworth
Ruud H.G. van Tol
Pierre Lo Cicero
Srinivas Digumarty
-digitalvelocityš
+digitalvelocityÂź
Alan J Booth
Tony OBrien
Douglas Toltzman
@@ -957,12 +957,12 @@ Craig Spitzer
Jeffrey Van Ness
Lucas Vergnettes
Wolfgang Michaelis
-Luis Jimnez Linares
+Luis Jiménez Linares
Julian Eden
Ms Lilo von Hanffstengel
Kurt B. Kaiser
Mark Ping
-Combe
+Combée
Diego Matho
MELIN Philippe
Damian Sobieralski
@@ -1028,7 +1028,7 @@ evolutie
Stephane Portha
Robert Gentner
David B. Camhy
-Ren Foucart
+René Foucart
Coyok Drio
Mark Ng
klein michael
@@ -1094,14 +1094,14 @@ Stuart MacKinnon
Dietrich Dietz - the IMaGiNation project (IMGN)
Tina Hirsch
John R Thorp
-Frdric Bouvier
+Frédéric Bouvier
LINETTE
Felix Rabe
Chay Adamou
nick harron
stephen john ford
Kino
-Daniel Sjlie
+Daniel Sjölie
Matthias Derer
Alain VALLETON
Kervin Pierre
@@ -1142,13 +1142,13 @@ Satoshi Yamasaki
Rolf-Dieter Klein
J. Deetman
Helge Walter
-Roland Strlberg
+Roland StrÄlberg
Nicolas Morenas (Caronte)
Simon Clarke
Maigrot Michel
Rod Robinson
Kevin Cozens
-Germn Alonso (taz)
+GermĂĄn Alonso (taz)
Martin Stegeman
Henrik Jordfald Olsen
Mitchell Skinner
@@ -1157,7 +1157,7 @@ Spiridon G. Kontarakis
Bas Denissen
Loic Dachary
Michael Rutter
-Thorsten Schlter
+Thorsten SchlĂŒter
hijothema
Andreas Hauser
Holger Haase
@@ -1232,9 +1232,9 @@ Starr Kline
John Lullie
Chiffi Cosimo
Morgan McMillian
-Stefan Hbner
+Stefan HĂŒbner
Loic de MONTAIGNAC
-Andrs Castillo
+Andrés Castillo
Francesco Anselmo
Ingo Guenther
James C. Davis, Jr.
@@ -1314,7 +1314,7 @@ Luke Titley
marinus meijers
Henry Kaminski
Alistair Riddoch
-Daniel Nmm
+Daniel NĂŒmm
Matthew Meadows
Bjoern Paschen
Paul Fredrickson
@@ -1325,7 +1325,7 @@ Thomas Muldowney
Cheyenne Cloud, LLC
Helmut A. Goettl
Martin A. Boegelund
-Benot Cousson
+BenoĂźt Cousson
Scott Brooks
Ferlet Patrice
Aaron Porterfield
@@ -1335,13 +1335,13 @@ Rui Paulo Sanguinheira Diogo
Jason Saville
Active-Websight GbR
Bryon Roche
-Gustavo Muoz
+Gustavo Muñoz
Christopher Gillanders
Phil Frost Tate
Gilles Gonon
Kay
James C. Franklin
-Luis Enrique Caamao Navas
+Luis Enrique Caamaño Navas
Alexander "estartu" Felder
Marc Ledermann
vrijschrift.org
@@ -1371,7 +1371,7 @@ Maurizio Sibaud
Ron Bolger
Nathan Parton
Andrew Fry
-VINCENT Stphane
+VINCENT Stéphane
Yan Yan
Justin L Graham
Wade Beasley
diff --git a/doc/python_api/sphinx_doc_gen.py b/doc/python_api/sphinx_doc_gen.py
index a1e88983a03..72e92e5855f 100644
--- a/doc/python_api/sphinx_doc_gen.py
+++ b/doc/python_api/sphinx_doc_gen.py
@@ -1491,7 +1491,9 @@ def write_sphinx_conf_py(basepath):
def execfile(filepath):
global_namespace = {"__file__": filepath, "__name__": "__main__"}
- exec(compile(open(filepath).read(), filepath, 'exec'), global_namespace)
+ file_handle = open(filepath)
+ exec(compile(file_handle.read(), filepath, 'exec'), global_namespace)
+ file_handle.close()
def write_rst_contents(basepath):
diff --git a/doc/python_api/sphinx_doc_gen.sh b/doc/python_api/sphinx_doc_gen.sh
index 92461961920..14919f678be 100755
--- a/doc/python_api/sphinx_doc_gen.sh
+++ b/doc/python_api/sphinx_doc_gen.sh
@@ -32,8 +32,7 @@ blender_version_char=$(grep BLENDER_VERSION_CHAR $blender_srcdir/source/blender/
blender_version_cycle=$(grep BLENDER_VERSION_CYCLE $blender_srcdir/source/blender/blenkernel/BKE_blender.h | awk '{print $3}')
blender_subversion=$(grep BLENDER_SUBVERSION $blender_srcdir/source/blender/blenkernel/BKE_blender.h | awk '{print $3}')
-if [ "$blender_version_cycle" == "release" ]
-then
+if [ "$blender_version_cycle" == "release" ] ; then
BLENDER_VERSION=$(expr $blender_version / 100)_$(expr $blender_version % 100)$blender_version_char"_release"
else
BLENDER_VERSION=$(expr $blender_version / 100)_$(expr $blender_version % 100)_$blender_subversion
@@ -109,6 +108,11 @@ if $DO_UPLOAD ; then
# better redirect
ssh $SSH_USER@emo.blender.org 'echo "
Redirecting...Redirecting..." > '$SSH_UPLOAD'/250PythonDoc/index.html'
+ # redirect for release only so wiki can point here
+ if [ "$blender_version_cycle" == "release" ] ; then
+ ssh $SSH_USER@emo.blender.org 'echo "Redirecting...Redirecting..." > '$SSH_UPLOAD'/blender_python_api/index.html'
+ fi
+
if $DO_OUT_PDF ; then
# rename so local PDF has matching name.
rsync --progress -avze "ssh -p 22" $SPHINXBASE/sphinx-out/blender_python_reference_$BLENDER_VERSION.pdf $SSH_HOST:$SSH_UPLOAD_FULL/blender_python_reference_$BLENDER_VERSION.pdf
diff --git a/extern/libmv/CMakeLists.txt b/extern/libmv/CMakeLists.txt
index a51f576d965..0fc90fdd9b9 100644
--- a/extern/libmv/CMakeLists.txt
+++ b/extern/libmv/CMakeLists.txt
@@ -191,14 +191,6 @@ if(WIN32)
third_party/msinttypes
)
endif()
-
- if(MSVC)
- set(MSVC_OFLAGS O1 O2 Ox)
- foreach(FLAG ${MSVC_OFLAGS})
- string(REPLACE "${FLAG}" "Od" CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}")
- string(REPLACE "${FLAG}" "Od" CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO}")
- endforeach()
- endif()
else()
list(APPEND SRC
third_party/glog/src/demangle.cc
diff --git a/extern/libmv/SConscript b/extern/libmv/SConscript
index b47086f3e91..8fd8c566e4d 100644
--- a/extern/libmv/SConscript
+++ b/extern/libmv/SConscript
@@ -11,10 +11,6 @@ Import('env')
defs = []
-cflags_libmv = Split(env['CFLAGS'])
-ccflags_libmv = Split(env['CCFLAGS'])
-cxxflags_libmv = Split(env['CXXFLAGS'])
-
defs.append('V3DLIB_ENABLE_SUITESPARSE')
defs.append('GOOGLE_GLOG_DLL_DECL=')
@@ -41,29 +37,12 @@ if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc', '
src += ['./third_party/glog/src/logging.cc', './third_party/glog/src/raw_logging.cc', './third_party/glog/src/utilities.cc', './third_party/glog/src/vlog_is_on.cc']
src += ['./third_party/glog/src/windows/port.cc']
-
- if env['OURPLATFORM'] in ('win32-vc', 'win64-vc'):
- cflags_libmv.append('/Od')
- ccflags_libmv.append('/Od')
- cxxflags_libmv.append('/Od')
-
- if not env['BF_DEBUG']:
- defs.append('NDEBUG')
- else:
- if not env['BF_DEBUG']:
- cflags_libmv += Split(env['REL_CFLAGS'])
- ccflags_libmv += Split(env['REL_CCFLAGS'])
- cxxflags_libmv += Split(env['REL_CXXFLAGS'])
else:
src += env.Glob("third_party/glog/src/*.cc")
incs += ' ./third_party/glog/src'
- if not env['BF_DEBUG']:
- cflags_libmv += Split(env['REL_CFLAGS'])
- ccflags_libmv += Split(env['REL_CCFLAGS'])
- cxxflags_libmv += Split(env['REL_CXXFLAGS'])
incs += ' ./third_party/ssba ./third_party/ldl/Include ../colamd/Include'
-env.BlenderLib ( libname = 'extern_libmv', sources=src, includes=Split(incs), defines=defs, libtype=['extern', 'player'], priority=[20,137], compileflags=cflags_libmv, cc_compileflags=ccflags_libmv, cxx_compileflags=cxxflags_libmv )
+env.BlenderLib ( libname = 'extern_libmv', sources=src, includes=Split(incs), defines=defs, libtype=['extern', 'player'], priority=[20,137] )
SConscript(['third_party/SConscript'])
diff --git a/extern/libmv/bundle.sh b/extern/libmv/bundle.sh
index 23e90fc8f7d..53487cf020e 100755
--- a/extern/libmv/bundle.sh
+++ b/extern/libmv/bundle.sh
@@ -184,14 +184,6 @@ if(WIN32)
third_party/msinttypes
)
endif()
-
- if(MSVC)
- set(MSVC_OFLAGS O1 O2 Ox)
- foreach(FLAG \${MSVC_OFLAGS})
- string(REPLACE "\${FLAG}" "Od" CMAKE_CXX_FLAGS_RELEASE "\${CMAKE_CXX_FLAGS_RELEASE}")
- string(REPLACE "\${FLAG}" "Od" CMAKE_C_FLAGS_RELWITHDEBINFO "\${CMAKE_C_FLAGS_RELWITHDEBINFO}")
- endforeach()
- endif()
else()
list(APPEND SRC
${third_glog_sources}
@@ -228,10 +220,6 @@ Import('env')
defs = []
-cflags_libmv = Split(env['CFLAGS'])
-ccflags_libmv = Split(env['CCFLAGS'])
-cxxflags_libmv = Split(env['CXXFLAGS'])
-
defs.append('V3DLIB_ENABLE_SUITESPARSE')
defs.append('GOOGLE_GLOG_DLL_DECL=')
@@ -249,30 +237,13 @@ if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc', '
${win_src}
src += ['./third_party/glog/src/logging.cc', './third_party/glog/src/raw_logging.cc', './third_party/glog/src/utilities.cc', './third_party/glog/src/vlog_is_on.cc']
src += ['./third_party/glog/src/windows/port.cc']
-
- if env['OURPLATFORM'] in ('win32-vc', 'win64-vc'):
- cflags_libmv.append('/Od')
- ccflags_libmv.append('/Od')
- cxxflags_libmv.append('/Od')
-
- if not env['BF_DEBUG']:
- defs.append('NDEBUG')
- else:
- if not env['BF_DEBUG']:
- cflags_libmv += Split(env['REL_CFLAGS'])
- ccflags_libmv += Split(env['REL_CCFLAGS'])
- cxxflags_libmv += Split(env['REL_CXXFLAGS'])
else:
src += env.Glob("third_party/glog/src/*.cc")
incs += ' ./third_party/glog/src'
- if not env['BF_DEBUG']:
- cflags_libmv += Split(env['REL_CFLAGS'])
- ccflags_libmv += Split(env['REL_CCFLAGS'])
- cxxflags_libmv += Split(env['REL_CXXFLAGS'])
incs += ' ./third_party/ssba ./third_party/ldl/Include ../colamd/Include'
-env.BlenderLib ( libname = 'extern_libmv', sources=src, includes=Split(incs), defines=defs, libtype=['extern', 'player'], priority=[20,137], compileflags=cflags_libmv, cc_compileflags=ccflags_libmv, cxx_compileflags=cxxflags_libmv )
+env.BlenderLib ( libname = 'extern_libmv', sources=src, includes=Split(incs), defines=defs, libtype=['extern', 'player'], priority=[20,137] )
SConscript(['third_party/SConscript'])
EOF
diff --git a/extern/libmv/third_party/ceres/CMakeLists.txt b/extern/libmv/third_party/ceres/CMakeLists.txt
index e2f06d74646..f0c0a4b269f 100644
--- a/extern/libmv/third_party/ceres/CMakeLists.txt
+++ b/extern/libmv/third_party/ceres/CMakeLists.txt
@@ -31,6 +31,7 @@ set(INC
include
internal
../gflags
+ ../../
)
set(INC_SYS
diff --git a/extern/libmv/third_party/ceres/bundle.sh b/extern/libmv/third_party/ceres/bundle.sh
index ccf6d0aca16..76630bc0626 100755
--- a/extern/libmv/third_party/ceres/bundle.sh
+++ b/extern/libmv/third_party/ceres/bundle.sh
@@ -120,6 +120,7 @@ set(INC
include
internal
../gflags
+ ../..
)
set(INC_SYS
diff --git a/intern/cycles/blender/addon/__init__.py b/intern/cycles/blender/addon/__init__.py
index 16cfdca8977..526c5658b93 100644
--- a/intern/cycles/blender/addon/__init__.py
+++ b/intern/cycles/blender/addon/__init__.py
@@ -21,7 +21,7 @@
bl_info = {
"name": "Cycles Render Engine",
"author": "",
- "blender": (2, 60, 5),
+ "blender": (2, 66, 0),
"location": "Info header, render engine menu",
"description": "Cycles Render Engine integration",
"warning": "",
diff --git a/intern/cycles/blender/addon/ui.py b/intern/cycles/blender/addon/ui.py
index b9fbb85581e..8da30acaf22 100644
--- a/intern/cycles/blender/addon/ui.py
+++ b/intern/cycles/blender/addon/ui.py
@@ -1123,13 +1123,9 @@ class CyclesScene_PT_simplify(CyclesButtonsPanel, Panel):
layout.active = rd.use_simplify
- split = layout.split()
-
- col = split.column()
- col.prop(rd, "simplify_subdivision", text="Subdivision")
-
- col = split.column()
- col.prop(rd, "simplify_child_particles", text="Child Particles")
+ row = layout.row()
+ row.prop(rd, "simplify_subdivision", text="Subdivision")
+ row.prop(rd, "simplify_child_particles", text="Child Particles")
def draw_device(self, context):
diff --git a/intern/cycles/device/device_cpu.cpp b/intern/cycles/device/device_cpu.cpp
index c2ba91faf69..47f3273fdfa 100644
--- a/intern/cycles/device/device_cpu.cpp
+++ b/intern/cycles/device/device_cpu.cpp
@@ -67,11 +67,6 @@ public:
task_pool.stop();
}
- bool support_advanced_shading()
- {
- return true;
- }
-
void mem_alloc(device_memory& mem, MemoryType type)
{
mem.device_pointer = mem.data_pointer;
diff --git a/intern/cycles/device/device_cuda.cpp b/intern/cycles/device/device_cuda.cpp
index 77082006169..173ac3d57df 100644
--- a/intern/cycles/device/device_cuda.cpp
+++ b/intern/cycles/device/device_cuda.cpp
@@ -209,8 +209,8 @@ public:
int major, minor;
cuDeviceComputeCapability(&major, &minor, cuDevId);
- if(major <= 1 && minor <= 2) {
- cuda_error_message(string_printf("CUDA device supported only with compute capability 1.3 or up, found %d.%d.", major, minor));
+ if(major <= 1 && minor <= 3) {
+ cuda_error_message(string_printf("CUDA device supported only with compute capability 2.0 or up, found %d.%d.", major, minor));
return false;
}
}
@@ -242,8 +242,8 @@ public:
#ifdef _WIN32
if(cuHavePrecompiledKernels()) {
- if(major <= 1 && minor <= 2)
- cuda_error_message(string_printf("CUDA device requires compute capability 1.3 or up, found %d.%d. Your GPU is not supported.", major, minor));
+ if(major <= 1 && minor <= 3)
+ cuda_error_message(string_printf("CUDA device requires compute capability 2.0 or up, found %d.%d. Your GPU is not supported.", major, minor));
else
cuda_error_message(string_printf("CUDA binary kernel for this graphics card compute capability (%d.%d) not found.", major, minor));
return "";
diff --git a/intern/cycles/device/device_network.cpp b/intern/cycles/device/device_network.cpp
index f5545c3dfdf..201f04bc5d8 100644
--- a/intern/cycles/device/device_network.cpp
+++ b/intern/cycles/device/device_network.cpp
@@ -222,11 +222,6 @@ public:
RPCSend snd(socket, "task_cancel");
snd.write();
}
-
- bool support_advanced_shading()
- {
- return true; /* todo: get this info from device */
- }
};
Device *device_network_create(DeviceInfo& info, Stats &stats, const char *address)
@@ -242,6 +237,8 @@ void device_network_info(vector& devices)
info.description = "Network Device";
info.id = "NETWORK";
info.num = 0;
+ info.advanced_shading = true; /* todo: get this info from device */
+ info.pack_images = false;
devices.push_back(info);
}
diff --git a/intern/cycles/kernel/kernel_path.h b/intern/cycles/kernel/kernel_path.h
index 9b13f4d2a42..865ba7ca676 100644
--- a/intern/cycles/kernel/kernel_path.h
+++ b/intern/cycles/kernel/kernel_path.h
@@ -28,11 +28,7 @@
#include "kernel_curve.h"
#include "kernel_primitive.h"
#include "kernel_projection.h"
-#ifdef __QBVH__
-#include "kernel_qbvh.h"
-#else
#include "kernel_bvh.h"
-#endif
#include "kernel_accumulate.h"
#include "kernel_camera.h"
#include "kernel_shader.h"
diff --git a/intern/cycles/render/light.cpp b/intern/cycles/render/light.cpp
index ccc6c5142bd..47e9dd8e7f5 100644
--- a/intern/cycles/render/light.cpp
+++ b/intern/cycles/render/light.cpp
@@ -360,10 +360,10 @@ void LightManager::device_update_distribution(Device *device, DeviceScene *dscen
/* bit of an ugly hack to compensate for emitting triangles influencing
* amount of samples we get for this pass */
- if(scene->integrator->progressive && kintegrator->pdf_triangles != 0.0f)
- kfilm->pass_shadow_scale = 0.5f;
- else
- kfilm->pass_shadow_scale = 1.0f;
+ kfilm->pass_shadow_scale = 1.0f;
+
+ if(kintegrator->pdf_triangles != 0.0f)
+ kfilm->pass_shadow_scale *= 0.5f;
if(num_background_lights < num_lights)
kfilm->pass_shadow_scale *= (float)(num_lights - num_background_lights)/(float)num_lights;
diff --git a/intern/cycles/util/util_cuda.h b/intern/cycles/util/util_cuda.h
index 69cf025de77..55feb3f84cb 100644
--- a/intern/cycles/util/util_cuda.h
+++ b/intern/cycles/util/util_cuda.h
@@ -206,7 +206,8 @@ typedef enum CUjit_target_enum
CU_TARGET_COMPUTE_13,
CU_TARGET_COMPUTE_20,
CU_TARGET_COMPUTE_21,
- CU_TARGET_COMPUTE_30
+ CU_TARGET_COMPUTE_30,
+ CU_TARGET_COMPUTE_35
} CUjit_target;
typedef enum CUjit_fallback_enum
diff --git a/intern/cycles/util/util_dynlib.cpp b/intern/cycles/util/util_dynlib.cpp
index 5836073a07a..3eaa16ab37d 100644
--- a/intern/cycles/util/util_dynlib.cpp
+++ b/intern/cycles/util/util_dynlib.cpp
@@ -22,7 +22,7 @@
#ifdef _WIN32
-#include
+#include
CCL_NAMESPACE_BEGIN
diff --git a/intern/ghost/intern/GHOST_DisplayManagerSDL.cpp b/intern/ghost/intern/GHOST_DisplayManagerSDL.cpp
index 86f0380c8d6..0d077ebc204 100644
--- a/intern/ghost/intern/GHOST_DisplayManagerSDL.cpp
+++ b/intern/ghost/intern/GHOST_DisplayManagerSDL.cpp
@@ -39,7 +39,7 @@ GHOST_DisplayManagerSDL::GHOST_DisplayManagerSDL(GHOST_SystemSDL *system)
GHOST_DisplayManager(),
m_system(system)
{
- memset(&m_mode, 0, sizeof m_mode);
+ memset(&m_mode, 0, sizeof(m_mode));
}
GHOST_TSuccess
diff --git a/intern/ghost/intern/GHOST_DisplayManagerX11.cpp b/intern/ghost/intern/GHOST_DisplayManagerX11.cpp
index 754218191a5..7830f42cbb7 100644
--- a/intern/ghost/intern/GHOST_DisplayManagerX11.cpp
+++ b/intern/ghost/intern/GHOST_DisplayManagerX11.cpp
@@ -40,7 +40,6 @@
#include "GHOST_SystemX11.h"
-
GHOST_DisplayManagerX11::
GHOST_DisplayManagerX11(
GHOST_SystemX11 *system
@@ -82,9 +81,9 @@ getNumDisplaySettings(
return GHOST_kFailure;
}
- /* The X11 man page says vidmodes needs to be freed, but doing so causes a
- * segfault. - z0r */
- XF86VidModeGetAllModeLines(dpy, DefaultScreen(dpy), &numSettings, &vidmodes);
+ if (XF86VidModeGetAllModeLines(dpy, DefaultScreen(dpy), &numSettings, &vidmodes)) {
+ XFree(vidmodes);
+ }
#else
/* We only have one X11 setting at the moment. */
@@ -95,6 +94,17 @@ getNumDisplaySettings(
return GHOST_kSuccess;
}
+/* from SDL2 */
+#ifdef WITH_X11_XF86VMODE
+static int
+calculate_rate(XF86VidModeModeInfo *info)
+{
+ return (info->htotal
+ && info->vtotal) ? (1000 * info->dotclock / (info->htotal *
+ info->vtotal)) : 0;
+}
+#endif
+
GHOST_TSuccess
GHOST_DisplayManagerX11::
getDisplaySetting(
@@ -102,51 +112,46 @@ getDisplaySetting(
GHOST_TInt32 index,
GHOST_DisplaySetting& setting) const
{
-
-#ifdef WITH_X11_XF86VMODE
- int majorVersion, minorVersion;
- XF86VidModeModeInfo **vidmodes;
Display *dpy = m_system->getXDisplay();
- int numSettings;
-
- GHOST_ASSERT(display < 1, "Only single display systems are currently supported.\n");
if (dpy == NULL)
return GHOST_kFailure;
+#ifdef WITH_X11_XF86VMODE
+ int majorVersion, minorVersion;
+
+ GHOST_ASSERT(display < 1, "Only single display systems are currently supported.\n");
+
majorVersion = minorVersion = 0;
- if (!XF86VidModeQueryVersion(dpy, &majorVersion, &minorVersion)) {
- fprintf(stderr, "Error: XF86VidMode extension missing!\n");
- return GHOST_kFailure;
+ if (XF86VidModeQueryVersion(dpy, &majorVersion, &minorVersion)) {
+ XF86VidModeModeInfo **vidmodes;
+ int numSettings;
+
+ if (XF86VidModeGetAllModeLines(dpy, DefaultScreen(dpy), &numSettings, &vidmodes)) {
+ GHOST_ASSERT(index < numSettings, "Requested setting outside of valid range.\n");
+
+ setting.xPixels = vidmodes[index]->hdisplay;
+ setting.yPixels = vidmodes[index]->vdisplay;
+ setting.bpp = DefaultDepth(dpy, DefaultScreen(dpy));
+ setting.frequency = calculate_rate(vidmodes[index]);
+ XFree(vidmodes);
+
+ return GHOST_kSuccess;
+ }
}
+ else {
+ fprintf(stderr, "Warning: XF86VidMode extension missing!\n");
+ /* fallback to non xf86vmode below */
+ }
+#endif /* WITH_X11_XF86VMODE */
- /* The X11 man page says vidmodes needs to be freed, but doing so causes a
- * segfault. - z0r */
- XF86VidModeGetAllModeLines(dpy, DefaultScreen(dpy), &numSettings, &vidmodes);
- GHOST_ASSERT(index < numSettings, "Requested setting outside of valid range.\n");
-
- setting.xPixels = vidmodes[index]->hdisplay;
- setting.yPixels = vidmodes[index]->vdisplay;
- setting.bpp = DefaultDepth(dpy, DefaultScreen(dpy));
-
-#else
GHOST_ASSERT(display < 1, "Only single display systems are currently supported.\n");
GHOST_ASSERT(index < 1, "Requested setting outside of valid range.\n");
-
- Display *x_display = m_system->getXDisplay();
- if (x_display == NULL) {
- return GHOST_kFailure;
- }
-
- setting.xPixels = DisplayWidth(x_display, DefaultScreen(x_display));
- setting.yPixels = DisplayHeight(x_display, DefaultScreen(x_display));
- setting.bpp = DefaultDepth(x_display, DefaultScreen(x_display));
-#endif
-
- /* Don't think it's possible to get this value from X!
- * So let's guess!! */
- setting.frequency = 60;
+ setting.xPixels = DisplayWidth(dpy, DefaultScreen(dpy));
+ setting.yPixels = DisplayHeight(dpy, DefaultScreen(dpy));
+ setting.bpp = DefaultDepth(dpy, DefaultScreen(dpy));
+ setting.frequency = 60.0f;
return GHOST_kSuccess;
}
@@ -171,15 +176,13 @@ setCurrentDisplaySetting(
const GHOST_DisplaySetting& setting)
{
#ifdef WITH_X11_XF86VMODE
- /* Mode switching code ported from Quake 2:
- * ftp: ftp.idsoftware.com/idstuff/source/q2source-3.21.zip
- * See linux/gl_glx.c:GLimp_SetMode
+ /* Mode switching code ported from SDL:
+ * See: src/video/x11/SDL_x11modes.c:set_best_resolution
*/
int majorVersion, minorVersion;
XF86VidModeModeInfo **vidmodes;
Display *dpy = m_system->getXDisplay();
int scrnum, num_vidmodes;
- int best_fit, best_dist, dist, x, y;
if (dpy == NULL)
return GHOST_kFailure;
@@ -197,41 +200,62 @@ setCurrentDisplaySetting(
majorVersion, minorVersion);
# endif
- /* The X11 man page says vidmodes needs to be freed, but doing so causes a
- * segfault. - z0r */
- XF86VidModeGetAllModeLines(dpy, scrnum, &num_vidmodes, &vidmodes);
+ if (XF86VidModeGetAllModeLines(dpy, scrnum, &num_vidmodes, &vidmodes)) {
+ int best_fit = -1;
- best_dist = 9999999;
- best_fit = -1;
+ for (int i = 0; i < num_vidmodes; i++) {
+ if (vidmodes[i]->hdisplay < setting.xPixels ||
+ vidmodes[i]->vdisplay < setting.yPixels)
+ {
+ continue;
+ }
- for (int i = 0; i < num_vidmodes; i++) {
- if (setting.xPixels > vidmodes[i]->hdisplay ||
- setting.yPixels > vidmodes[i]->vdisplay)
- continue;
+ if (best_fit == -1 ||
+ (vidmodes[i]->hdisplay < vidmodes[best_fit]->hdisplay) ||
+ (vidmodes[i]->hdisplay == vidmodes[best_fit]->hdisplay &&
+ vidmodes[i]->vdisplay < vidmodes[best_fit]->vdisplay))
+ {
+ best_fit = i;
+ continue;
+ }
- x = setting.xPixels - vidmodes[i]->hdisplay;
- y = setting.yPixels - vidmodes[i]->vdisplay;
- dist = (x * x) + (y * y);
- if (dist < best_dist) {
- best_dist = dist;
- best_fit = i;
+ if ((vidmodes[i]->hdisplay == vidmodes[best_fit]->hdisplay) &&
+ (vidmodes[i]->vdisplay == vidmodes[best_fit]->vdisplay))
+ {
+ if (!setting.frequency) {
+ /* Higher is better, right? */
+ if (calculate_rate(vidmodes[i]) >
+ calculate_rate(vidmodes[best_fit]))
+ {
+ best_fit = i;
+ }
+ }
+ else {
+ if (abs(calculate_rate(vidmodes[i]) - (int)setting.frequency) <
+ abs(calculate_rate(vidmodes[best_fit]) - (int)setting.frequency))
+ {
+ best_fit = i;
+ }
+ }
+ }
}
- }
- if (best_fit != -1) {
-# ifdef _DEBUG
- int actualWidth, actualHeight;
- actualWidth = vidmodes[best_fit]->hdisplay;
- actualHeight = vidmodes[best_fit]->vdisplay;
- printf("Switching to video mode %dx%d\n",
- actualWidth, actualHeight);
-# endif
+ if (best_fit != -1) {
+ # ifdef _DEBUG
+ printf("Switching to video mode %dx%d %dx%d %d\n",
+ vidmodes[best_fit]->hdisplay, vidmodes[best_fit]->vdisplay,
+ vidmodes[best_fit]->htotal, vidmodes[best_fit]->vtotal,
+ calculate_rate(vidmodes[best_fit]));
+ # endif
- /* change to the mode */
- XF86VidModeSwitchToMode(dpy, scrnum, vidmodes[best_fit]);
+ /* change to the mode */
+ XF86VidModeSwitchToMode(dpy, scrnum, vidmodes[best_fit]);
- /* Move the viewport to top left */
- XF86VidModeSetViewPort(dpy, scrnum, 0, 0);
+ /* Move the viewport to top left */
+ XF86VidModeSetViewPort(dpy, scrnum, 0, 0);
+ }
+
+ XFree(vidmodes);
}
else {
return GHOST_kFailure;
@@ -245,7 +269,3 @@ setCurrentDisplaySetting(
return GHOST_kSuccess;
#endif
}
-
-
-
-
diff --git a/intern/ghost/intern/GHOST_DropTargetWin32.cpp b/intern/ghost/intern/GHOST_DropTargetWin32.cpp
index 89e9a91b34c..5288b77a3c6 100644
--- a/intern/ghost/intern/GHOST_DropTargetWin32.cpp
+++ b/intern/ghost/intern/GHOST_DropTargetWin32.cpp
@@ -32,7 +32,7 @@
#include "GHOST_Debug.h"
#include "GHOST_DropTargetWin32.h"
-#include
+#include
#include "utf_winfunc.h"
#include "utfconv.h"
diff --git a/intern/ghost/intern/GHOST_SystemWin32.cpp b/intern/ghost/intern/GHOST_SystemWin32.cpp
index 138109ce48b..3005930d30c 100644
--- a/intern/ghost/intern/GHOST_SystemWin32.cpp
+++ b/intern/ghost/intern/GHOST_SystemWin32.cpp
@@ -296,6 +296,9 @@ bool GHOST_SystemWin32::processEvents(bool waitForEvent)
// Process all the events waiting for us
while (::PeekMessageW(&msg, 0, 0, 0, PM_REMOVE) != 0) {
+ // TranslateMessage doesn't alter the message, and doesn't change our raw keyboard data.
+ // Needed for MapVirtualKey or if we ever need to get chars from wm_ime_char or similar.
+ ::TranslateMessage(&msg);
::DispatchMessageW(&msg);
anyProcessed = true;
}
@@ -729,13 +732,17 @@ GHOST_EventKey *GHOST_SystemWin32::processKeyEvent(GHOST_IWindow *window, RAWINP
int r;
GetKeyboardState((PBYTE)state);
- if ((r = ToUnicodeEx(vk, 0, state, utf16, 2, 0, system->m_keylayout))) {
- if ((r > 0 && r < 3)) {
- utf16[r] = 0;
- conv_utf_16_to_8(utf16, utf8_char, 6);
- }
- else if (r == -1) {
- utf8_char[0] = '\0';
+ // don't call ToUnicodeEx on dead keys as it clears the buffer and so won't allow diacritical composition.
+ if (MapVirtualKeyW(vk,2) != 0) {
+ // todo: ToUnicodeEx can respond with up to 4 utf16 chars (only 2 here). Could be up to 24 utf8 bytes.
+ if ((r = ToUnicodeEx(vk, raw.data.keyboard.MakeCode, state, utf16, 2, 0, system->m_keylayout))) {
+ if ((r > 0 && r < 3)) {
+ utf16[r] = 0;
+ conv_utf_16_to_8(utf16, utf8_char, 6);
+ }
+ else if (r == -1) {
+ utf8_char[0] = '\0';
+ }
}
}
diff --git a/intern/ghost/intern/GHOST_WindowWin32.cpp b/intern/ghost/intern/GHOST_WindowWin32.cpp
index bf429527199..7566e7fe71c 100644
--- a/intern/ghost/intern/GHOST_WindowWin32.cpp
+++ b/intern/ghost/intern/GHOST_WindowWin32.cpp
@@ -470,38 +470,22 @@ void GHOST_WindowWin32::getWindowBounds(GHOST_Rect& bounds) const
void GHOST_WindowWin32::getClientBounds(GHOST_Rect& bounds) const
{
RECT rect;
- GHOST_TWindowState state = this->getState();
- LONG_PTR result = ::GetWindowLongPtr(m_hWnd, GWL_STYLE);
- int sm_cysizeframe = GetSystemMetrics(SM_CYSIZEFRAME);
- ::GetWindowRect(m_hWnd, &rect);
+ POINT coord;
+ ::GetClientRect(m_hWnd, &rect);
- if ((result & (WS_POPUP | WS_MAXIMIZE)) != (WS_POPUP | WS_MAXIMIZE)) {
- if (state == GHOST_kWindowStateMaximized) {
- // in maximized state we don't have borders on the window
- bounds.m_b = rect.bottom - GetSystemMetrics(SM_CYCAPTION) - sm_cysizeframe * 2;
- bounds.m_l = rect.left + sm_cysizeframe;
- bounds.m_r = rect.right - sm_cysizeframe;
- bounds.m_t = rect.top;
- }
- else if (state == GHOST_kWindowStateEmbedded) {
- bounds.m_b = rect.bottom;
- bounds.m_l = rect.left;
- bounds.m_r = rect.right;
- bounds.m_t = rect.top;
- }
- else {
- bounds.m_b = rect.bottom - GetSystemMetrics(SM_CYCAPTION) - sm_cysizeframe * 2;
- bounds.m_l = rect.left;
- bounds.m_r = rect.right - sm_cysizeframe * 2;
- bounds.m_t = rect.top;
- }
- }
- else {
- bounds.m_b = rect.bottom;
- bounds.m_l = rect.left;
- bounds.m_r = rect.right;
- bounds.m_t = rect.top;
- }
+ coord.x = rect.left;
+ coord.y = rect.top;
+ ::ClientToScreen(m_hWnd, &coord);
+
+ bounds.m_l = coord.x;
+ bounds.m_t = coord.y;
+
+ coord.x = rect.right;
+ coord.y = rect.bottom;
+ ::ClientToScreen(m_hWnd, &coord);
+
+ bounds.m_r = coord.x;
+ bounds.m_b = coord.y;
}
@@ -712,6 +696,7 @@ GHOST_TSuccess GHOST_WindowWin32::initMultisample(PIXELFORMATDESCRIPTOR pfd)
WGL_ACCELERATION_ARB, WGL_FULL_ACCELERATION_ARB,
WGL_COLOR_BITS_ARB, pfd.cColorBits,
WGL_DEPTH_BITS_ARB, pfd.cDepthBits,
+ WGL_ALPHA_BITS_ARB, pfd.cAlphaBits,
WGL_STENCIL_BITS_ARB, pfd.cStencilBits,
WGL_DOUBLE_BUFFER_ARB, GL_TRUE,
WGL_SAMPLE_BUFFERS_ARB, GL_TRUE,
@@ -1321,6 +1306,9 @@ static int WeightPixelFormat(PIXELFORMATDESCRIPTOR& pfd)
weight += pfd.cColorBits - 8;
+ if (pfd.cAlphaBits > 0)
+ weight ++;
+
/* want swap copy capability -- it matters a lot */
if (pfd.dwFlags & PFD_SWAP_COPY) weight += 16;
diff --git a/intern/ghost/intern/GHOST_WindowX11.cpp b/intern/ghost/intern/GHOST_WindowX11.cpp
index 50520b7eda5..8184475b610 100644
--- a/intern/ghost/intern/GHOST_WindowX11.cpp
+++ b/intern/ghost/intern/GHOST_WindowX11.cpp
@@ -213,6 +213,7 @@ GHOST_WindowX11(
attributes[i++] = GLX_BLUE_SIZE; attributes[i++] = 1;
attributes[i++] = GLX_GREEN_SIZE; attributes[i++] = 1;
attributes[i++] = GLX_DEPTH_SIZE; attributes[i++] = 1;
+ attributes[i++] = GLX_ALPHA_SIZE; attributes[i++] = 1;
/* GLX >= 1.4 required for multi-sample */
if (samples && (glxVersionMajor >= 1) && (glxVersionMinor >= 4)) {
attributes[i++] = GLX_SAMPLE_BUFFERS; attributes[i++] = 1;
diff --git a/intern/rigidbody/RBI_api.h b/intern/rigidbody/RBI_api.h
index 9dde2cc3049..e7c88d96873 100644
--- a/intern/rigidbody/RBI_api.h
+++ b/intern/rigidbody/RBI_api.h
@@ -257,6 +257,7 @@ extern rbConstraint *RB_constraint_new_slider(float pivot[3], float orn[4], rbRi
extern rbConstraint *RB_constraint_new_piston(float pivot[3], float orn[4], rbRigidBody *rb1, rbRigidBody *rb2);
extern rbConstraint *RB_constraint_new_6dof(float pivot[3], float orn[4], rbRigidBody *rb1, rbRigidBody *rb2);
extern rbConstraint *RB_constraint_new_6dof_spring(float pivot[3], float orn[4], rbRigidBody *rb1, rbRigidBody *rb2);
+extern rbConstraint *RB_constraint_new_motor(float pivot[3], float orn[4], rbRigidBody *rb1, rbRigidBody *rb2);
/* ............ */
@@ -292,6 +293,11 @@ extern void RB_constraint_set_damping_6dof_spring(rbConstraint *con, int axis, f
extern void RB_constraint_set_spring_6dof_spring(rbConstraint *con, int axis, int enable);
extern void RB_constraint_set_equilibrium_6dof_spring(rbConstraint *con);
+/* motors */
+extern void RB_constraint_set_enable_motor(rbConstraint *con, int enable_lin, int enable_ang);
+extern void RB_constraint_set_max_impulse_motor(rbConstraint *con, float max_impulse_lin, float max_impulse_ang);
+extern void RB_constraint_set_target_velocity_motor(rbConstraint *con, float velocity_lin, float velocity_ang);
+
/* Set number of constraint solver iterations made per step, this overrided world setting
* To use default set it to -1 */
extern void RB_constraint_set_solver_iterations(rbConstraint *con, int num_solver_iterations);
diff --git a/intern/rigidbody/rb_bullet_api.cpp b/intern/rigidbody/rb_bullet_api.cpp
index 58345d4e08c..a628c35218c 100644
--- a/intern/rigidbody/rb_bullet_api.cpp
+++ b/intern/rigidbody/rb_bullet_api.cpp
@@ -850,6 +850,27 @@ rbConstraint *RB_constraint_new_6dof_spring(float pivot[3], float orn[4], rbRigi
return (rbConstraint *)con;
}
+rbConstraint *RB_constraint_new_motor(float pivot[3], float orn[4], rbRigidBody *rb1, rbRigidBody *rb2)
+{
+ btRigidBody *body1 = rb1->body;
+ btRigidBody *body2 = rb2->body;
+ btTransform transform1;
+ btTransform transform2;
+
+ make_constraint_transforms(transform1, transform2, body1, body2, pivot, orn);
+
+ btGeneric6DofConstraint *con = new btGeneric6DofConstraint(*body1, *body2, transform1, transform2, true);
+
+ /* unlock constraint axes */
+ for (int i = 0; i < 6; i++) {
+ con->setLimit(i, 0.0f, -1.0f);
+ }
+ /* unlock motor axes */
+ con->getTranslationalLimitMotor()->m_upperLimit.setValue(-1.0f, -1.0f, -1.0f);
+
+ return (rbConstraint*)con;
+}
+
/* Cleanup ----------------------------- */
void RB_constraint_delete(rbConstraint *con)
@@ -947,4 +968,28 @@ void RB_constraint_set_breaking_threshold(rbConstraint *con, float threshold)
constraint->setBreakingImpulseThreshold(threshold);
}
+void RB_constraint_set_enable_motor(rbConstraint *con, int enable_lin, int enable_ang)
+{
+ btGeneric6DofConstraint *constraint = reinterpret_cast(con);
+
+ constraint->getTranslationalLimitMotor()->m_enableMotor[0] = enable_lin;
+ constraint->getRotationalLimitMotor(0)->m_enableMotor = enable_ang;
+}
+
+void RB_constraint_set_max_impulse_motor(rbConstraint *con, float max_impulse_lin, float max_impulse_ang)
+{
+ btGeneric6DofConstraint *constraint = reinterpret_cast(con);
+
+ constraint->getTranslationalLimitMotor()->m_maxMotorForce.setX(max_impulse_lin);
+ constraint->getRotationalLimitMotor(0)->m_maxMotorForce = max_impulse_ang;
+}
+
+void RB_constraint_set_target_velocity_motor(rbConstraint *con, float velocity_lin, float velocity_ang)
+{
+ btGeneric6DofConstraint *constraint = reinterpret_cast(con);
+
+ constraint->getTranslationalLimitMotor()->m_targetVelocity.setX(velocity_lin);
+ constraint->getRotationalLimitMotor(0)->m_targetVelocity = velocity_ang;
+}
+
/* ********************************** */
diff --git a/intern/smoke/intern/WAVELET_NOISE.h b/intern/smoke/intern/WAVELET_NOISE.h
index fce901b68aa..1b2fbfab58c 100644
--- a/intern/smoke/intern/WAVELET_NOISE.h
+++ b/intern/smoke/intern/WAVELET_NOISE.h
@@ -45,6 +45,8 @@
#include
+#include
+
#ifdef WIN32
#include
#define isnan _isnan
diff --git a/intern/utfconv/utf_winfunc.c b/intern/utfconv/utf_winfunc.c
index 18f0e808562..77209313926 100644
--- a/intern/utfconv/utf_winfunc.c
+++ b/intern/utfconv/utf_winfunc.c
@@ -29,7 +29,7 @@
#include "utf_winfunc.h"
#include
-#include
+#include
#include
diff --git a/release/datafiles/splash.png b/release/datafiles/splash.png
index 41284eff9c1..7affcab8a82 100644
Binary files a/release/datafiles/splash.png and b/release/datafiles/splash.png differ
diff --git a/release/scripts/modules/bl_i18n_utils/bl_process_msg.py b/release/scripts/modules/bl_i18n_utils/bl_process_msg.py
index 5381af8d543..006d7170571 100644
--- a/release/scripts/modules/bl_i18n_utils/bl_process_msg.py
+++ b/release/scripts/modules/bl_i18n_utils/bl_process_msg.py
@@ -435,41 +435,71 @@ def dump_py_messages_from_files(messages, check_ctxt, files):
# -------------------------------------------------------------------------
# Gather function names
- # so far only 'text' keywords, but we may want others translated later
- translate_kw = ("text", )
+ # In addition of UI func, also parse pgettext ones...
+ # Tuples of (module name, (short names, ...)).
+ pgettext_variants = (
+ ("pgettext", ("_",)),
+ ("pgettext_iface", ("iface_",)),
+ ("pgettext_tip", ("tip_",))
+ )
+ pgettext_variants_args = {"msgid": (0, {"msgctxt": 1})}
- # key: func_id
- # val: [(arg_kw, arg_pos), (arg_kw, arg_pos), ...]
+ # key: msgid keywords.
+ # val: tuples of ((keywords,), context_getter_func) to get a context for that msgid.
+ # Note: order is important, first one wins!
+ translate_kw = {
+ "text": ((("text_ctxt",), _ctxt_to_ctxt),
+ (("operator",), _op_to_ctxt),
+ ),
+ "msgid": ((("msgctxt",), _ctxt_to_ctxt),
+ ),
+ }
+
+ context_kw_set = {}
+ for k, ctxts in translate_kw.items():
+ s = set()
+ for c, _ in ctxts:
+ s |= set(c)
+ context_kw_set[k] = s
+
+ # {func_id: {msgid: (arg_pos,
+ # {msgctxt: arg_pos,
+ # ...
+ # }
+ # ),
+ # ...
+ # },
+ # ...
+ # }
func_translate_args = {}
- # as we only have one translate keyword, no need for complex context extraction setup for now...
- # And it's already enough complex like that!
- # Note: order is important, first one wins!
- context_kw = ((("text_ctxt",), _ctxt_to_ctxt),
- (("operator",), _op_to_ctxt),
- )
- context_kw_set = set()
- for c, _ in context_kw:
- context_kw_set |= set(c)
-
- # Like func_translate_args.
- func_context_args = {}
+ # First, functions from UILayout
+ # First loop is for msgid args, second one is for msgctxt args.
+ for func_id, func in bpy.types.UILayout.bl_rna.functions.items():
+ # check it has one or more arguments as defined in translate_kw
+ for arg_pos, (arg_kw, arg) in enumerate(func.parameters.items()):
+ if ((arg_kw in translate_kw) and (not arg.is_output) and (arg.type == 'STRING')):
+ func_translate_args.setdefault(func_id, {})[arg_kw] = (arg_pos, {})
+ for func_id, func in bpy.types.UILayout.bl_rna.functions.items():
+ if func_id not in func_translate_args:
+ continue
+ for arg_pos, (arg_kw, arg) in enumerate(func.parameters.items()):
+ if (not arg.is_output) and (arg.type == 'STRING'):
+ for msgid, msgctxts in context_kw_set.items():
+ if arg_kw in msgctxts:
+ func_translate_args[func_id][msgid][1][arg_kw] = arg_pos
+ # We manually add funcs from bpy.app.translations
+ for func_id, func_ids in pgettext_variants:
+ func_translate_args[func_id] = pgettext_variants_args
+ for func_id in func_ids:
+ func_translate_args[func_id] = pgettext_variants_args
+ #print(func_translate_args)
# Break recursive nodes look up on some kind of nodes.
# E.g. we donât want to get strings inside subscripts (blah["foo"])!
- stopper_nodes = {ast.Subscript, }
+ stopper_nodes = {ast.Subscript}
# Consider strings separate: ("a" if test else "b")
- separate_nodes = {ast.IfExp, }
-
- # For now only consider functions from UILayout...
- for func_id, func in bpy.types.UILayout.bl_rna.functions.items():
- # check it has one or more arguments as defined in translate_kw
- for (arg_pos, (arg_kw, arg)) in enumerate(func.parameters.items()):
- if ((arg_kw in translate_kw) and (not arg.is_output) and (arg.type == 'STRING')):
- func_translate_args.setdefault(func_id, []).append((arg_kw, arg_pos))
- elif ((arg_kw in context_kw_set) and (not arg.is_output) and (arg.type == 'STRING')):
- func_context_args.setdefault(func_id, []).append((arg_kw, arg_pos))
- #print(func_context_args)
+ separate_nodes = {ast.IfExp}
check_ctxt_py = None
if check_ctxt:
@@ -489,40 +519,42 @@ def dump_py_messages_from_files(messages, check_ctxt, files):
# print("found function at")
# print("%s:%d" % (fp, node.lineno))
- # lambda's
+ # We can't skip such situations! from blah import foo\nfoo("bar") would also be an ast.Name func!
if type(node.func) == ast.Name:
+ func_id = node.func.id
+ elif hasattr(node.func, "attr"):
+ func_id = node.func.attr
+ # Ugly things like getattr(self, con.type)(context, box, con)
+ else:
continue
- # getattr(self, con.type)(context, box, con)
- if not hasattr(node.func, "attr"):
- continue
+ func_args = func_translate_args.get(func_id, {})
- # First try to get i18n context.
- context_args = func_context_args.get(node.func.attr, ())
- context = ""
- context_elements = {}
- for arg_kw, arg_pos in context_args:
- if arg_pos < len(node.args):
- context_elements[arg_kw] = node.args[arg_pos]
- else:
- for kw in node.keywords:
- if kw.arg == arg_kw:
- context_elements[arg_kw] = kw.value
+ # First try to get i18n contexts, for every possible msgid id.
+ contexts = dict.fromkeys(func_args.keys(), "")
+ for msgid, (_, context_args) in func_args.items():
+ context_elements = {}
+ for arg_kw, arg_pos in context_args.items():
+ if arg_pos < len(node.args):
+ context_elements[arg_kw] = node.args[arg_pos]
+ else:
+ for kw in node.keywords:
+ if kw.arg == arg_kw:
+ context_elements[arg_kw] = kw.value
+ break
+ #print(context_elements)
+ for kws, proc in translate_kw[msgid]:
+ if set(kws) <= context_elements.keys():
+ args = tuple(context_elements[k] for k in kws)
+ #print("running ", proc, " with ", args)
+ ctxt = proc(*args)
+ if ctxt:
+ contexts[msgid] = ctxt
break
- #print(context_elements)
- for kws, proc in context_kw:
- if set(kws) <= context_elements.keys():
- args = tuple(context_elements[k] for k in kws)
- #print("running ", proc, " with ", args)
- ctxt = proc(*args)
- if ctxt:
- context = ctxt
- break
- translate_args = func_translate_args.get(node.func.attr, ())
#print(translate_args)
# do nothing if not found
- for arg_kw, arg_pos in translate_args:
+ for arg_kw, (arg_pos, _) in func_args.items():
estr_lst = [(None, ())]
if arg_pos < len(node.args):
estr_lst = extract_strings_split(node.args[arg_pos])
@@ -535,7 +567,7 @@ def dump_py_messages_from_files(messages, check_ctxt, files):
#print(estr, nds)
for estr, nds in estr_lst:
if estr:
- key = (context, estr)
+ key = (contexts[arg_kw], estr)
if nds:
msgsrc = ["{}:{}".format(fp_rel, sorted({nd.lineno for nd in nds})[0])]
else:
diff --git a/release/scripts/modules/bl_i18n_utils/settings.py b/release/scripts/modules/bl_i18n_utils/settings.py
index 01bc925cedd..7e37dffbf10 100644
--- a/release/scripts/modules/bl_i18n_utils/settings.py
+++ b/release/scripts/modules/bl_i18n_utils/settings.py
@@ -94,7 +94,7 @@ LANGUAGES_FILE = "languages"
IMPORT_MIN_LEVEL = -1
# Languages in /branches we do not want to import in /trunk currently...
-IMPORT_LANGUAGES_SKIP = {'am', 'bg', 'fi', 'el', 'et', 'hi', 'ne', 'pl', 'ro', 'uz', 'uz@cyrillic'}
+IMPORT_LANGUAGES_SKIP = {'am', 'bg', 'fi', 'el', 'et', 'ne', 'pl', 'ro', 'uz', 'uz@cyrillic'}
# The comment prefix used in generated messages.txt file.
MSG_COMMENT_PREFIX = "#~ "
@@ -227,9 +227,10 @@ PYGETTEXT_KEYWORDS = (() +
for it in ("CTX_IFACE_", "CTX_TIP_", "CTX_N_")) +
tuple(("{}\\((?:[^\"',]+,){{1,2}}\\s*" + _msg_re + r"\s*(?:\)|,)").format(it)
- for it in ("BKE_report", "BKE_reportf", "BKE_reports_prepend", "BKE_reports_prependf")) +
+ for it in ("BKE_report", "BKE_reportf", "BKE_reports_prepend", "BKE_reports_prependf",
+ "CTX_wm_operator_poll_msg_set")) +
- tuple(("{}\\((?:[^\"',]+,){{3}}\\s*" + _msg_re + r"\s*,").format(it)
+ tuple(("{}\\((?:[^\"',]+,){{3}}\\s*" + _msg_re + r"\s*\)").format(it)
for it in ("BMO_error_raise",)) +
tuple(("{}\\((?:[^\"',]+,)\\s*" + _msg_re + r"\s*(?:\)|,)").format(it)
diff --git a/release/scripts/modules/bl_i18n_utils/spell_check_utils.py b/release/scripts/modules/bl_i18n_utils/spell_check_utils.py
index f2d777d22f1..6adf3213b56 100644
--- a/release/scripts/modules/bl_i18n_utils/spell_check_utils.py
+++ b/release/scripts/modules/bl_i18n_utils/spell_check_utils.py
@@ -220,7 +220,7 @@ dict_uimsgs = {
"grless",
"http",
"init",
- "kbit",
+ "kbit", "kb",
"lensdist",
"loc", "rot", "pos",
"lorem",
diff --git a/release/scripts/modules/bpy_extras/mesh_utils.py b/release/scripts/modules/bpy_extras/mesh_utils.py
index 8b93b5922e9..f4fdfece947 100644
--- a/release/scripts/modules/bpy_extras/mesh_utils.py
+++ b/release/scripts/modules/bpy_extras/mesh_utils.py
@@ -152,10 +152,13 @@ def edge_face_count_dict(mesh):
faces using each edge.
:rtype: dict
"""
- face_edge_keys = [face.edge_keys for face in mesh.tessfaces]
+
face_edge_count = {}
- for face_keys in face_edge_keys:
- for key in face_keys:
+ loops = mesh.loops
+ edges = mesh.edges
+ for poly in mesh.polygons:
+ for i in poly.loop_indices:
+ key = edges[loops[i].edge_index].key
try:
face_edge_count[key] += 1
except:
diff --git a/release/scripts/modules/bpy_extras/object_utils.py b/release/scripts/modules/bpy_extras/object_utils.py
index 5797b8b7bf3..ab5dc3e6aee 100644
--- a/release/scripts/modules/bpy_extras/object_utils.py
+++ b/release/scripts/modules/bpy_extras/object_utils.py
@@ -124,8 +124,9 @@ def object_data_add(context, obdata, operator=None, use_active_layer=True):
else:
base.layers = [True if i == scene.active_layer
else False for i in range(len(scene.layers))]
- if v3d:
- base.layers_from_view(context.space_data)
+ else:
+ if v3d:
+ base.layers_from_view(context.space_data)
obj_new.matrix_world = add_object_align_init(context, operator)
diff --git a/release/scripts/presets/interface_theme/back_to_black.xml b/release/scripts/presets/interface_theme/back_to_black.xml
index bb625c6452c..05216841cbd 100644
--- a/release/scripts/presets/interface_theme/back_to_black.xml
+++ b/release/scripts/presets/interface_theme/back_to_black.xml
@@ -800,7 +800,8 @@
line_input="#cecece"
line_info="#00aa00"
line_error="#dc6060"
- cursor="#dc6060">
+ cursor="#dc6060"
+ select="#ffffff30">
+ cursor="#dc6060"
+ select="#c6777799">
+ cursor="#dc6060"
+ select="#4e4e8f80">
+ cursor="#dc6060"
+ select="#ffffff30">
+ cursor="#f47421"
+ select="#641f4480">
")
- else:
- layout.label(text="")
elif self.layout_type in {'GRID'}:
layout.alignment = 'CENTER'
layout.label(text="", icon_value=icon)
@@ -566,7 +564,7 @@ class MATERIAL_PT_halo(MaterialButtonsPanel, Panel):
row.prop(halo, toggle, text="")
sub = row.column()
sub.active = getattr(halo, toggle)
- sub.prop(halo, number, text=name)
+ sub.prop(halo, number, text=name, translate=False)
if not color == "":
sub.prop(mat, color, text="")
@@ -593,9 +591,9 @@ class MATERIAL_PT_halo(MaterialButtonsPanel, Panel):
col.prop(halo, "use_soft")
col = split.column()
- number_but(col, "use_ring", "ring_count", "Rings", "mirror_color")
- number_but(col, "use_lines", "line_count", "Lines", "specular_color")
- number_but(col, "use_star", "star_tip_count", "Star tips", "")
+ number_but(col, "use_ring", "ring_count", iface_("Rings"), "mirror_color")
+ number_but(col, "use_lines", "line_count", iface_("Lines"), "specular_color")
+ number_but(col, "use_star", "star_tip_count", iface_("Star Tips"), "")
class MATERIAL_PT_flare(MaterialButtonsPanel, Panel):
diff --git a/release/scripts/startup/bl_ui/properties_particle.py b/release/scripts/startup/bl_ui/properties_particle.py
index 0aa2c14a0c7..f6784cbbaa3 100644
--- a/release/scripts/startup/bl_ui/properties_particle.py
+++ b/release/scripts/startup/bl_ui/properties_particle.py
@@ -97,7 +97,8 @@ class PARTICLE_PT_context_particles(ParticleButtonsPanel, Panel):
if ob:
row = layout.row()
- row.template_list("UI_UL_list", "", ob, "particle_systems", ob.particle_systems, "active_index", rows=2)
+ row.template_list("UI_UL_list", "particle_systems", ob, "particle_systems",
+ ob.particle_systems, "active_index", rows=2)
col = row.column(align=True)
col.operator("object.particle_system_add", icon='ZOOMIN', text="")
@@ -637,7 +638,7 @@ class PARTICLE_PT_physics(ParticleButtonsPanel, Panel):
layout.label(text="Fluid interaction:")
row = layout.row()
- row.template_list("UI_UL_list", "", psys, "targets", psys, "active_particle_target_index")
+ row.template_list("UI_UL_list", "particle_targets", psys, "targets", psys, "active_particle_target_index")
col = row.column()
sub = col.row()
@@ -703,7 +704,8 @@ class PARTICLE_PT_boidbrain(ParticleButtonsPanel, Panel):
# Currently boids can only use the first state so these are commented out for now.
#row = layout.row()
- #row.template_list("UI_UL_list", "", boids, "states", boids, "active_boid_state_index", compact="True")
+ #row.template_list("UI_UL_list", "particle_boids", boids, "states",
+ # boids, "active_boid_state_index", compact="True")
#col = row.row()
#sub = col.row(align=True)
#sub.operator("boid.state_add", icon='ZOOMIN', text="")
@@ -724,7 +726,7 @@ class PARTICLE_PT_boidbrain(ParticleButtonsPanel, Panel):
row.label(text="")
row = layout.row()
- row.template_list("UI_UL_list", "", state, "rules", state, "active_boid_rule_index")
+ row.template_list("UI_UL_list", "particle_boids_rules", state, "rules", state, "active_boid_rule_index")
col = row.column()
sub = col.row()
@@ -887,7 +889,8 @@ class PARTICLE_PT_render(ParticleButtonsPanel, Panel):
if part.use_group_count and not part.use_whole_group:
row = layout.row()
- row.template_list("UI_UL_list", "", part, "dupli_weights", part, "active_dupliweight_index")
+ row.template_list("UI_UL_list", "particle_dupli_weights", part, "dupli_weights",
+ part, "active_dupliweight_index")
col = row.column()
sub = col.row()
diff --git a/release/scripts/startup/bl_ui/properties_physics_common.py b/release/scripts/startup/bl_ui/properties_physics_common.py
index 90cf397f526..2d9d4649e28 100644
--- a/release/scripts/startup/bl_ui/properties_physics_common.py
+++ b/release/scripts/startup/bl_ui/properties_physics_common.py
@@ -108,7 +108,8 @@ def point_cache_ui(self, context, cache, enabled, cachetype):
if not cachetype == 'RIGID_BODY':
row = layout.row()
- row.template_list("UI_UL_list", "", cache, "point_caches", cache.point_caches, "active_index", rows=2)
+ row.template_list("UI_UL_list", "point_caches", cache, "point_caches",
+ cache.point_caches, "active_index", rows=2)
col = row.column(align=True)
col.operator("ptcache.add", icon='ZOOMIN', text="")
col.operator("ptcache.remove", icon='ZOOMOUT', text="")
diff --git a/release/scripts/startup/bl_ui/properties_physics_rigidbody.py b/release/scripts/startup/bl_ui/properties_physics_rigidbody.py
index 922eee66ddc..d7ed7bb4d1a 100644
--- a/release/scripts/startup/bl_ui/properties_physics_rigidbody.py
+++ b/release/scripts/startup/bl_ui/properties_physics_rigidbody.py
@@ -36,12 +36,6 @@ class PHYSICS_PT_rigid_body(PHYSICS_PT_rigidbody_panel, Panel):
return (obj and obj.rigid_body and
(not context.scene.render.use_game_engine))
- def draw_header(self, context):
- obj = context.object
- rbo = obj.rigid_body
- if rbo is not None:
- self.layout.prop(rbo, "enabled", text="")
-
def draw(self, context):
layout = self.layout
@@ -50,7 +44,10 @@ class PHYSICS_PT_rigid_body(PHYSICS_PT_rigidbody_panel, Panel):
if rbo is not None:
layout.prop(rbo, "type", text="Type")
- layout.prop(rbo, "kinematic", text="Animated")
+ row = layout.row()
+ if rbo.type == 'ACTIVE':
+ row.prop(rbo, "enabled", text="Dynamic")
+ row.prop(rbo, "kinematic", text="Animated")
if rbo.type == 'ACTIVE':
layout.prop(rbo, "mass")
diff --git a/release/scripts/startup/bl_ui/properties_physics_rigidbody_constraint.py b/release/scripts/startup/bl_ui/properties_physics_rigidbody_constraint.py
index e4e5b94407d..a49c6d623ca 100644
--- a/release/scripts/startup/bl_ui/properties_physics_rigidbody_constraint.py
+++ b/release/scripts/startup/bl_ui/properties_physics_rigidbody_constraint.py
@@ -51,11 +51,12 @@ class PHYSICS_PT_rigid_body_constraint(PHYSICS_PT_rigidbody_constraint_panel, Pa
layout.prop(rbc, "object1")
layout.prop(rbc, "object2")
- row = layout.row()
- row.prop(rbc, "use_breaking")
- sub = row.row()
- sub.active = rbc.use_breaking
- sub.prop(rbc, "breaking_threshold", text="Threshold")
+ if rbc.type != 'MOTOR':
+ row = layout.row()
+ row.prop(rbc, "use_breaking")
+ sub = row.row()
+ sub.active = rbc.use_breaking
+ sub.prop(rbc, "breaking_threshold", text="Threshold")
row = layout.row()
row.prop(rbc, "override_solver_iterations", text="Override Iterations")
@@ -113,6 +114,30 @@ class PHYSICS_PT_rigid_body_constraint(PHYSICS_PT_rigidbody_constraint_panel, Pa
sub.prop(rbc, "limit_ang_x_lower", text="Lower")
sub.prop(rbc, "limit_ang_x_upper", text="Upper")
+ elif rbc.type == 'MOTOR':
+ col = layout.column(align=True)
+ col.label("Linear motor:")
+
+ row = col.row()
+ sub = row.row()
+ sub.scale_x = 0.5
+ sub.prop(rbc, "use_motor_lin", toggle=True, text="Enable")
+ sub = row.row()
+ sub.active = rbc.use_motor_lin
+ sub.prop(rbc, "motor_lin_target_velocity", text="Target Velocity")
+ sub.prop(rbc, "motor_lin_max_impulse", text="Max Impulse")
+
+ col.label("Angular motor:")
+
+ row = col.row()
+ sub = row.row()
+ sub.scale_x = 0.5
+ sub.prop(rbc, "use_motor_ang", toggle=True, text="Enable")
+ sub = row.row()
+ sub.active = rbc.use_motor_ang
+ sub.prop(rbc, "motor_ang_target_velocity", text="Target Velocity")
+ sub.prop(rbc, "motor_ang_max_impulse", text="Max Impulse")
+
elif rbc.type in {'GENERIC', 'GENERIC_SPRING'}:
col = layout.column(align=True)
col.label("Limits:")
diff --git a/release/scripts/startup/bl_ui/properties_scene.py b/release/scripts/startup/bl_ui/properties_scene.py
index 68a097e6188..519f9ca47fa 100644
--- a/release/scripts/startup/bl_ui/properties_scene.py
+++ b/release/scripts/startup/bl_ui/properties_scene.py
@@ -94,7 +94,7 @@ class SCENE_PT_keying_sets(SceneButtonsPanel, Panel):
row = layout.row()
col = row.column()
- col.template_list("UI_UL_list", "", scene, "keying_sets", scene.keying_sets, "active_index", rows=2)
+ col.template_list("UI_UL_list", "keying_sets", scene, "keying_sets", scene.keying_sets, "active_index", rows=2)
col = row.column(align=True)
col.operator("anim.keying_set_add", icon='ZOOMIN', text="")
diff --git a/release/scripts/startup/bl_ui/space_clip.py b/release/scripts/startup/bl_ui/space_clip.py
index bc5d89fd45b..e32db805a29 100644
--- a/release/scripts/startup/bl_ui/space_clip.py
+++ b/release/scripts/startup/bl_ui/space_clip.py
@@ -746,7 +746,7 @@ class CLIP_PT_stabilization(CLIP_PT_reconstruction_panel, Panel):
layout.active = stab.use_2d_stabilization
row = layout.row()
- row.template_list("UI_UL_list", "", stab, "tracks",
+ row.template_list("UI_UL_list", "stabilization_tracks", stab, "tracks",
stab, "active_track_index", rows=3)
sub = row.column(align=True)
diff --git a/release/scripts/startup/bl_ui/space_dopesheet.py b/release/scripts/startup/bl_ui/space_dopesheet.py
index 094fa4a7c6d..adeae9da790 100644
--- a/release/scripts/startup/bl_ui/space_dopesheet.py
+++ b/release/scripts/startup/bl_ui/space_dopesheet.py
@@ -240,6 +240,10 @@ class DOPESHEET_MT_channel(Menu):
layout.operator("anim.channels_delete")
+ layout.separator()
+ layout.operator("anim.channels_group")
+ layout.operator("anim.channels_ungroup")
+
layout.separator()
layout.operator_menu_enum("anim.channels_setting_toggle", "type")
layout.operator_menu_enum("anim.channels_setting_enable", "type")
diff --git a/release/scripts/startup/bl_ui/space_graph.py b/release/scripts/startup/bl_ui/space_graph.py
index 4cb6538458f..2d0b1c93d13 100644
--- a/release/scripts/startup/bl_ui/space_graph.py
+++ b/release/scripts/startup/bl_ui/space_graph.py
@@ -160,6 +160,10 @@ class GRAPH_MT_channel(Menu):
layout.operator("anim.channels_delete")
+ layout.separator()
+ layout.operator("anim.channels_group")
+ layout.operator("anim.channels_ungroup")
+
layout.separator()
layout.operator_menu_enum("anim.channels_setting_toggle", "type")
layout.operator_menu_enum("anim.channels_setting_enable", "type")
diff --git a/release/scripts/startup/bl_ui/space_node.py b/release/scripts/startup/bl_ui/space_node.py
index c46b1c20738..104c1500756 100644
--- a/release/scripts/startup/bl_ui/space_node.py
+++ b/release/scripts/startup/bl_ui/space_node.py
@@ -252,6 +252,7 @@ class NODE_PT_quality(bpy.types.Panel):
col = layout.column()
col.prop(tree, "use_opencl")
+ col.prop(tree, "use_groupnode_buffer")
col.prop(tree, "two_pass")
col.prop(snode, "show_highlight")
col.prop(snode, "use_hidden_preview")
diff --git a/release/scripts/startup/bl_ui/space_view3d_toolbar.py b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
index 2fb420dabea..05c1793b29f 100644
--- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py
+++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
@@ -264,6 +264,8 @@ class VIEW3D_PT_tools_curveedit(View3DPanel, Panel):
col.operator("curve.cyclic_toggle")
col.operator("curve.switch_direction")
col.operator("curve.spline_type_set")
+ col.operator("curve.radius_set")
+ col.operator("curve.smooth_radius")
col = layout.column(align=True)
col.label(text="Handles:")
@@ -278,6 +280,7 @@ class VIEW3D_PT_tools_curveedit(View3DPanel, Panel):
col.label(text="Modeling:")
col.operator("curve.extrude_move", text="Extrude")
col.operator("curve.subdivide")
+ col.operator("curve.smooth")
draw_repeat_tools(context, layout)
@@ -1054,6 +1057,11 @@ class VIEW3D_PT_tools_weightpaint_options(Panel, View3DPaintPanel):
col.prop(wpaint, "input_samples")
+ col.label("Show Zero Weights:")
+ rowsub = col.row()
+ rowsub.active = (not tool_settings.use_multipaint)
+ rowsub.prop(tool_settings, "vertex_group_user", expand=True)
+
self.unified_paint_settings(col, context)
# Commented out because the Apply button isn't an operator yet, making these settings useless
@@ -1222,7 +1230,7 @@ class VIEW3D_PT_tools_particlemode(View3DPanel, Panel):
if pe.type == 'PARTICLES':
if ob.particle_systems:
if len(ob.particle_systems) > 1:
- layout.template_list("UI_UL_list", "", ob, "particle_systems",
+ layout.template_list("UI_UL_list", "particle_systems", ob, "particle_systems",
ob.particle_systems, "active_index", rows=2, maxrows=3)
ptcache = ob.particle_systems.active.point_cache
@@ -1232,8 +1240,8 @@ class VIEW3D_PT_tools_particlemode(View3DPanel, Panel):
ptcache = md.point_cache
if ptcache and len(ptcache.point_caches) > 1:
- layout.template_list("UI_UL_list", "", ptcache, "point_caches", ptcache.point_caches, "active_index",
- rows=2, maxrows=3)
+ layout.template_list("UI_UL_list", "particles_point_caches", ptcache, "point_caches",
+ ptcache.point_caches, "active_index", rows=2, maxrows=3)
if not pe.is_editable:
layout.label(text="Point cache must be baked")
diff --git a/release/scripts/templates_py/operator_modal_timer.py b/release/scripts/templates_py/operator_modal_timer.py
index 72c153df9d2..3088d59fbcf 100644
--- a/release/scripts/templates_py/operator_modal_timer.py
+++ b/release/scripts/templates_py/operator_modal_timer.py
@@ -14,7 +14,7 @@ class ModalTimerOperator(bpy.types.Operator):
if event.type == 'TIMER':
# change theme color, silly!
- color = context.user_preferences.themes[0].view_3d.space.back
+ color = context.user_preferences.themes[0].view_3d.space.gradients.high_gradient
color.s = 1.0
color.h += 0.01
diff --git a/source/blender/blenfont/BLF_translation.h b/source/blender/blenfont/BLF_translation.h
index 8a99f486783..197809426ae 100644
--- a/source/blender/blenfont/BLF_translation.h
+++ b/source/blender/blenfont/BLF_translation.h
@@ -112,7 +112,7 @@ const char *BLF_translate_do_tooltip(const char *msgctxt, const char *msgid);
/* Default, void context.
* WARNING! The "" context is not the same as no (NULL) context at mo/boost::locale level!
- * NOTE: We translate BLF_I18NCONTEXT_DEFAULT as BLF_I18NCONTEXT_DEFAULT_BPY in Python, as we canât use "natural"
+ * NOTE: We translate BLF_I18NCONTEXT_DEFAULT as BLF_I18NCONTEXT_DEFAULT_BPY in Python, as we can't use "natural"
* None value in rna string properties... :/
* For perf reason, we only use the first char to detect this context, so other contexts should never start
* with the same char!
diff --git a/source/blender/blenfont/intern/blf.c b/source/blender/blenfont/intern/blf.c
index 16756769675..061e8e28607 100644
--- a/source/blender/blenfont/intern/blf.c
+++ b/source/blender/blenfont/intern/blf.c
@@ -43,6 +43,8 @@
#include "DNA_listBase.h"
#include "DNA_vec_types.h"
+#include "BLI_math.h"
+
#include "BIF_gl.h"
#include "BLF_api.h"
@@ -516,8 +518,8 @@ static void blf_draw__start(FontBLF *font, GLint *mode, GLint *param)
if (font->flags & BLF_ASPECT)
glScalef(font->aspect[0], font->aspect[1], font->aspect[2]);
- if (font->flags & BLF_ROTATION)
- glRotatef(font->angle, 0.0f, 0.0f, 1.0f);
+ if (font->flags & BLF_ROTATION) /* radians -> degrees */
+ glRotatef(font->angle * (float)(180.0 / M_PI), 0.0f, 0.0f, 1.0f);
if (font->shadow || font->blur)
glGetFloatv(GL_CURRENT_COLOR, font->orig_col);
diff --git a/source/blender/blenfont/intern/blf_internal_types.h b/source/blender/blenfont/intern/blf_internal_types.h
index 1acc3dad4cf..de6e70e4461 100644
--- a/source/blender/blenfont/intern/blf_internal_types.h
+++ b/source/blender/blenfont/intern/blf_internal_types.h
@@ -166,7 +166,7 @@ typedef struct FontBLF {
/* initial position for draw the text. */
float pos[3];
- /* angle in degrees. */
+ /* angle in radians. */
float angle;
/* blur: 3 or 5 large kernel */
diff --git a/source/blender/blenkernel/BKE_DerivedMesh.h b/source/blender/blenkernel/BKE_DerivedMesh.h
index 5f504df5628..486834f9540 100644
--- a/source/blender/blenkernel/BKE_DerivedMesh.h
+++ b/source/blender/blenkernel/BKE_DerivedMesh.h
@@ -95,7 +95,7 @@ struct BMEditMesh;
struct ListBase;
struct PBVH;
-#define DM_OMP_LIMIT 0 /* setting zero so we can catch bugs in OpenMP/BMesh */
+#define DM_OMP_LIMIT 10000 /* setting zero so we can catch bugs in OpenMP/BMesh */
/* number of sub-elements each mesh element has (for interpolation) */
#define SUB_ELEMS_VERT 0
diff --git a/source/blender/blenkernel/BKE_blender.h b/source/blender/blenkernel/BKE_blender.h
index 871e9918f6f..d66909449e4 100644
--- a/source/blender/blenkernel/BKE_blender.h
+++ b/source/blender/blenkernel/BKE_blender.h
@@ -41,8 +41,8 @@ extern "C" {
/* these lines are grep'd, watch out for our not-so-awesome regex
* and keep comment above the defines.
* Use STRINGIFY() rather than defining with quotes */
-#define BLENDER_VERSION 265
-#define BLENDER_SUBVERSION 10
+#define BLENDER_VERSION 266
+#define BLENDER_SUBVERSION 0
/* 262 was the last editmesh release but it has compatibility code for bmesh data */
#define BLENDER_MINVERSION 262
@@ -50,9 +50,9 @@ extern "C" {
/* used by packaging tools */
/* can be left blank, otherwise a,b,c... etc with no quotes */
-#define BLENDER_VERSION_CHAR a
+#define BLENDER_VERSION_CHAR
/* alpha/beta/rc/release, docs use this */
-#define BLENDER_VERSION_CYCLE beta
+#define BLENDER_VERSION_CYCLE alpha
extern char versionstr[]; /* from blender.c */
diff --git a/source/blender/blenkernel/BKE_bmesh.h b/source/blender/blenkernel/BKE_bmesh.h
index 8bfee836c0d..4bc21625cf3 100644
--- a/source/blender/blenkernel/BKE_bmesh.h
+++ b/source/blender/blenkernel/BKE_bmesh.h
@@ -38,7 +38,7 @@
/*NOTE: this is the bmesh 1.0 code. it's completely outdated.*/
/* uncomment to use the new bevel operator as a modifier */
-// #define USE_BM_BEVEL_OP_AS_MOD
+#define USE_BM_BEVEL_OP_AS_MOD
/* bevel tool defines */
/* element flags */
@@ -53,6 +53,7 @@
#define BME_BEVEL_RADIUS (1 << 2)
#define BME_BEVEL_ANGLE (1 << 3)
#define BME_BEVEL_WEIGHT (1 << 4)
+#define BME_BEVEL_VGROUP (1 << 5)
//~ #define BME_BEVEL_EWEIGHT (1<<4)
//~ #define BME_BEVEL_VWEIGHT (1<<5)
#define BME_BEVEL_PERCENT (1 << 6)
diff --git a/source/blender/blenkernel/BKE_deform.h b/source/blender/blenkernel/BKE_deform.h
index 0fa7356b64e..b209e8bf667 100644
--- a/source/blender/blenkernel/BKE_deform.h
+++ b/source/blender/blenkernel/BKE_deform.h
@@ -55,6 +55,7 @@ void defvert_add_index_notest(struct MDeformVert *dv, int de
void defvert_remove_group(struct MDeformVert *dvert, struct MDeformWeight *dw);
void defvert_clear(struct MDeformVert *dvert);
int defvert_find_shared(const struct MDeformVert *dvert_a, const struct MDeformVert *dvert_b);
+bool defvert_is_weight_zero(const struct MDeformVert *dvert, const int defgroup_tot);
void BKE_defvert_array_free_elems(struct MDeformVert *dvert, int totvert);
void BKE_defvert_array_free(struct MDeformVert *dvert, int totvert);
diff --git a/source/blender/blenkernel/BKE_depsgraph.h b/source/blender/blenkernel/BKE_depsgraph.h
index 49dc1bfd732..4cdfc1cba95 100644
--- a/source/blender/blenkernel/BKE_depsgraph.h
+++ b/source/blender/blenkernel/BKE_depsgraph.h
@@ -99,8 +99,16 @@ int is_acyclic(struct DagForest *dag);
/* ********** API *************** */
/* Note that the DAG never executes changes in Objects, only sets flags in Objects */
-/* (re)-create dependency graph for scene */
-void DAG_scene_sort(struct Main *bmain, struct Scene *sce);
+/* clear all dependency graphs, call this when changing relations between objects.
+ * the dependency graphs will be rebuilt just before they are used to avoid them
+ * getting rebuild many times during operators */
+void DAG_relations_tag_update(struct Main *bmain);
+
+/* (re)-create the dependency graph before using it */
+void DAG_scene_relations_update(struct Main *bmain, struct Scene *sce);
+
+/* force an immediate rebuild of the dependency graph, only needed in rare cases */
+void DAG_scene_relations_rebuild(struct Main *bmain, struct Scene *scene);
/* flag all objects that need recalc because they're animated */
void DAG_scene_update_flags(struct Main *bmain, struct Scene *sce, unsigned int lay, const short do_time);
@@ -109,10 +117,8 @@ void DAG_scene_flush_update(struct Main *bmain, struct Scene *sce, unsigned i
/* tag objects for update on file load */
void DAG_on_visible_update(struct Main *bmain, const short do_time);
-/* when setting manual RECALC flags, call this afterwards */
-void DAG_ids_flush_update(struct Main *bmain, int time);
-
/* tag datablock to get updated for the next redraw */
+void DAG_id_tag_update_ex(struct Main *bmain, struct ID *id, short flag);
void DAG_id_tag_update(struct ID *id, short flag);
/* flush all tagged updates */
void DAG_ids_flush_tagged(struct Main *bmain);
diff --git a/source/blender/blenkernel/BKE_image.h b/source/blender/blenkernel/BKE_image.h
index d12b048bc96..dd7e06259bd 100644
--- a/source/blender/blenkernel/BKE_image.h
+++ b/source/blender/blenkernel/BKE_image.h
@@ -152,6 +152,9 @@ void BKE_image_pool_free(struct ImagePool *pool);
struct ImBuf *BKE_image_pool_acquire_ibuf(struct Image *ima, struct ImageUser *iuser, struct ImagePool *pool);
void BKE_image_pool_release_ibuf(struct Image *ima, struct ImBuf *ibuf, struct ImagePool *pool);
+/* set an alpha mode based on file extension */
+void BKE_image_alpha_mode_from_extension(struct Image *image);
+
/* returns a new image or NULL if it can't load */
struct Image *BKE_image_load(struct Main *bmain, const char *filepath);
/* returns existing Image when filename/type is same (frame optional) */
diff --git a/source/blender/blenkernel/BKE_node.h b/source/blender/blenkernel/BKE_node.h
index 5024b3636c5..19fe621ade9 100644
--- a/source/blender/blenkernel/BKE_node.h
+++ b/source/blender/blenkernel/BKE_node.h
@@ -261,6 +261,12 @@ typedef struct bNodeType {
#define SOCK_IN 1
#define SOCK_OUT 2
+typedef enum eNodeSizePreset {
+ NODE_SIZE_DEFAULT,
+ NODE_SIZE_SMALL,
+ NODE_SIZE_LARGE
+} eNodeSizePreset;
+
struct bNodeTreeExec;
typedef void (*bNodeTreeCallback)(void *calldata, struct ID *owner_id, struct bNodeTree *ntree);
@@ -419,6 +425,7 @@ void node_type_base(struct bNodeTreeType *ttype, struct bNodeType *nt
const char *name, short nclass, short flag);
void node_type_socket_templates(struct bNodeType *ntype, struct bNodeSocketTemplate *inputs, struct bNodeSocketTemplate *outputs);
void node_type_size(struct bNodeType *ntype, int width, int minwidth, int maxwidth);
+void node_type_size_preset(struct bNodeType *ntype, eNodeSizePreset size);
void node_type_init(struct bNodeType *ntype, void (*initfunc)(struct bNodeTree *ntree, struct bNode *node, struct bNodeTemplate *ntemp));
void node_type_valid(struct bNodeType *ntype, int (*validfunc)(struct bNodeTree *ntree, struct bNodeTemplate *ntemp));
void node_type_storage(struct bNodeType *ntype,
diff --git a/source/blender/blenkernel/BKE_object.h b/source/blender/blenkernel/BKE_object.h
index 19c04676548..89860cd0da9 100644
--- a/source/blender/blenkernel/BKE_object.h
+++ b/source/blender/blenkernel/BKE_object.h
@@ -103,7 +103,8 @@ struct Object *BKE_object_pose_armature_get(struct Object *ob);
void BKE_object_where_is_calc(struct Scene *scene, struct Object *ob);
void BKE_object_where_is_calc_ex(struct Scene *scene, struct RigidBodyWorld *rbw, struct Object *ob);
void BKE_object_where_is_calc_time(struct Scene *scene, struct Object *ob, float ctime);
-void BKE_object_where_is_calc_time_ex(struct Scene *scene, struct RigidBodyWorld *rbw, struct Object *ob, float ctime);
+void BKE_object_where_is_calc_time_ex(struct Scene *scene, struct Object *ob, float ctime,
+ struct RigidBodyWorld *rbw);
void BKE_object_where_is_calc_simul(struct Scene *scene, struct Object *ob);
void BKE_object_where_is_calc_mat4(struct Scene *scene, struct Object *ob, float obmat[4][4]);
@@ -149,7 +150,8 @@ void BKE_object_tfm_protected_restore(struct Object *ob,
const short protectflag);
void BKE_object_handle_update(struct Scene *scene, struct Object *ob);
-void BKE_object_handle_update_ex(struct Scene *scene, struct RigidBodyWorld *rbw, struct Object *ob);
+void BKE_object_handle_update_ex(struct Scene *scene, struct Object *ob,
+ struct RigidBodyWorld *rbw);
void BKE_object_sculpt_modifiers_changed(struct Object *ob);
int BKE_object_obdata_texspace_get(struct Object *ob, short **r_texflag, float **r_loc, float **r_size, float **r_rot);
diff --git a/source/blender/blenkernel/BKE_particle.h b/source/blender/blenkernel/BKE_particle.h
index a9a8bc32064..6c207675cb1 100644
--- a/source/blender/blenkernel/BKE_particle.h
+++ b/source/blender/blenkernel/BKE_particle.h
@@ -220,7 +220,10 @@ typedef struct ParticleCollision {
ParticleCollisionElement pce;
- float total_time, inv_timestep;
+ /* total_time is the amount of time in this subframe
+ * inv_total_time is the opposite
+ * inv_timestep is the inverse of the amount of time in this frame */
+ float total_time, inv_total_time, inv_timestep;
float radius;
float co1[3], co2[3];
diff --git a/source/blender/blenkernel/BKE_sequencer.h b/source/blender/blenkernel/BKE_sequencer.h
index e3d9c513c5c..eef134a6872 100644
--- a/source/blender/blenkernel/BKE_sequencer.h
+++ b/source/blender/blenkernel/BKE_sequencer.h
@@ -356,6 +356,8 @@ typedef struct SeqLoadInfo {
typedef struct Sequence *(*SeqLoadFunc)(struct bContext *, ListBase *, struct SeqLoadInfo *);
struct Sequence *BKE_sequence_alloc(ListBase *lb, int cfra, int machine);
+
+void BKE_sequence_alpha_mode_from_extension(struct Sequence *seq);
void BKE_sequence_init_colorspace(struct Sequence *seq);
struct Sequence *BKE_sequencer_add_image_strip(struct bContext *C, ListBase *seqbasep, struct SeqLoadInfo *seq_load);
diff --git a/source/blender/blenkernel/BKE_text.h b/source/blender/blenkernel/BKE_text.h
index 3e882a048eb..3d7b5d1c8e4 100644
--- a/source/blender/blenkernel/BKE_text.h
+++ b/source/blender/blenkernel/BKE_text.h
@@ -109,6 +109,10 @@ int text_check_identifier_nodigit(const char ch);
int text_check_whitespace(const char ch);
int text_find_identifier_start(const char *str, int i);
+/* defined in bpy_interface.c */
+extern int text_check_identifier_unicode(const unsigned int ch);
+extern int text_check_identifier_nodigit_unicode(const unsigned int ch);
+
enum {
TXT_MOVE_LINE_UP = -1,
TXT_MOVE_LINE_DOWN = 1
diff --git a/source/blender/blenkernel/BKE_tracking.h b/source/blender/blenkernel/BKE_tracking.h
index eb7004b1ced..9bdc96e187d 100644
--- a/source/blender/blenkernel/BKE_tracking.h
+++ b/source/blender/blenkernel/BKE_tracking.h
@@ -46,6 +46,7 @@ struct MovieDistortion;
struct Camera;
struct Object;
struct Scene;
+struct rcti;
/* **** Common functions **** */
@@ -156,6 +157,8 @@ struct ImBuf *BKE_tracking_undistort_frame(struct MovieTracking *tracking, struc
struct ImBuf *BKE_tracking_distort_frame(struct MovieTracking *tracking, struct ImBuf *ibuf,
int calibration_width, int calibration_height, float overscan);
+void BKE_tracking_max_undistortion_delta_across_bound(struct MovieTracking *tracking, struct rcti *rect, float delta[2]);
+
/* **** Image sampling **** */
struct ImBuf *BKE_tracking_sample_pattern(int frame_width, int frame_height,
struct ImBuf *struct_ibuf, struct MovieTrackingTrack *track,
diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c
index 8e740075bc6..6b3c95a5cd3 100644
--- a/source/blender/blenkernel/intern/DerivedMesh.c
+++ b/source/blender/blenkernel/intern/DerivedMesh.c
@@ -1017,8 +1017,12 @@ void weight_to_rgb(float r_rgb[3], const float weight)
/* draw_flag's for calc_weightpaint_vert_color */
enum {
- CALC_WP_MULTIPAINT = (1 << 0),
- CALC_WP_AUTO_NORMALIZE = (1 << 1)
+ /* only one of these should be set, keep first (for easy bit-shifting) */
+ CALC_WP_GROUP_USER_ACTIVE = (1 << 1),
+ CALC_WP_GROUP_USER_ALL = (1 << 2),
+
+ CALC_WP_MULTIPAINT = (1 << 3),
+ CALC_WP_AUTO_NORMALIZE = (1 << 4)
};
static void weightpaint_color(unsigned char r_col[4], ColorBand *coba, const float input)
@@ -1050,7 +1054,7 @@ static void calc_weightpaint_vert_color(
{
float input = 0.0f;
- int make_black = FALSE;
+ bool make_black = false;
if ((defbase_sel_tot > 1) && (draw_flag & CALC_WP_MULTIPAINT)) {
int was_a_nonzero = FALSE;
@@ -1072,7 +1076,7 @@ static void calc_weightpaint_vert_color(
/* make it black if the selected groups have no weight on a vertex */
if (was_a_nonzero == FALSE) {
- make_black = TRUE;
+ make_black = true;
}
else if ((draw_flag & CALC_WP_AUTO_NORMALIZE) == FALSE) {
input /= defbase_sel_tot; /* get the average */
@@ -1081,6 +1085,17 @@ static void calc_weightpaint_vert_color(
else {
/* default, non tricky behavior */
input = defvert_find_weight(dv, defbase_act);
+
+ if (draw_flag & CALC_WP_GROUP_USER_ACTIVE) {
+ if (input == 0.0f) {
+ make_black = true;
+ }
+ }
+ else if (draw_flag & CALC_WP_GROUP_USER_ALL) {
+ if (input == 0.0f) {
+ make_black = defvert_is_weight_zero(dv, defbase_tot);
+ }
+ }
}
if (make_black) { /* TODO, theme color */
@@ -1138,7 +1153,12 @@ static unsigned char *calc_weightpaint_vert_array(Object *ob, DerivedMesh *dm, i
}
else {
int col_i;
- weightpaint_color((unsigned char *)&col_i, coba, 0.0f);
+ if (draw_flag & (CALC_WP_GROUP_USER_ACTIVE | CALC_WP_GROUP_USER_ALL)) {
+ col_i = 0;
+ }
+ else {
+ weightpaint_color((unsigned char *)&col_i, coba, 0.0f);
+ }
fill_vn_i((int *)wtcol_v, numVerts, col_i);
}
@@ -1354,8 +1374,11 @@ static void mesh_calc_modifiers(Scene *scene, Object *ob, float (*inputVertexCos
int sculpt_mode = ob->mode & OB_MODE_SCULPT && ob->sculpt;
int sculpt_dyntopo = (sculpt_mode && ob->sculpt->bm);
- const int draw_flag = ((scene->toolsettings->multipaint ? CALC_WP_MULTIPAINT : 0) |
+ const int draw_flag = ((scene->toolsettings->multipaint ? CALC_WP_MULTIPAINT :
+ /* CALC_WP_GROUP_USER_ACTIVE or CALC_WP_GROUP_USER_ALL*/
+ (1 << scene->toolsettings->weightuser)) |
(scene->toolsettings->auto_normalize ? CALC_WP_AUTO_NORMALIZE : 0));
+
/* Generic preview only in object mode! */
const int do_mod_mcol = (ob->mode == OB_MODE_OBJECT);
#if 0 /* XXX Will re-enable this when we have global mod stack options. */
@@ -2720,7 +2743,7 @@ void DM_vertex_attributes_from_gpu(DerivedMesh *dm, GPUVertexAttribs *gattribs,
a = attribs->tottface++;
attribs->tface[a].array = tfdata->layers[layer].data;
- attribs->tface[a].em_offset = tfdata->layers[layer].offset;
+ attribs->tface[a].em_offset = ldata->layers[layer].offset;
attribs->tface[a].gl_index = gattribs->layer[b].glindex;
attribs->tface[a].gl_texco = gattribs->layer[b].gltexco;
}
@@ -2757,7 +2780,8 @@ void DM_vertex_attributes_from_gpu(DerivedMesh *dm, GPUVertexAttribs *gattribs,
a = attribs->totmcol++;
attribs->mcol[a].array = tfdata->layers[layer].data;
- attribs->mcol[a].em_offset = tfdata->layers[layer].offset;
+ /* odd, store the offset for a different layer type here, but editmode draw code expects it */
+ attribs->mcol[a].em_offset = ldata->layers[layer].offset;
attribs->mcol[a].gl_index = gattribs->layer[b].glindex;
}
}
@@ -2773,6 +2797,7 @@ void DM_vertex_attributes_from_gpu(DerivedMesh *dm, GPUVertexAttribs *gattribs,
a = attribs->totmcol++;
attribs->mcol[a].array = tfdata->layers[layer].data;
+ /* odd, store the offset for a different layer type here, but editmode draw code expects it */
attribs->mcol[a].em_offset = tfdata->layers[layer].offset;
attribs->mcol[a].gl_index = gattribs->layer[b].glindex;
}
diff --git a/source/blender/blenkernel/intern/anim.c b/source/blender/blenkernel/intern/anim.c
index a6b3008e00a..4eb26e81ae2 100644
--- a/source/blender/blenkernel/intern/anim.c
+++ b/source/blender/blenkernel/intern/anim.c
@@ -69,7 +69,6 @@
#include "BKE_depsgraph.h"
#include "BKE_anim.h"
#include "BKE_report.h"
-#include "BKE_rigidbody.h"
// XXX bad level call...
@@ -320,46 +319,45 @@ static void motionpaths_calc_optimise_depsgraph(Scene *scene, ListBase *targets)
}
/* "brew me a list that's sorted a bit faster now depsy" */
- DAG_scene_sort(G.main, scene);
+ DAG_scene_relations_rebuild(G.main, scene);
}
/* update scene for current frame */
static void motionpaths_calc_update_scene(Scene *scene)
{
#if 1 // 'production' optimizations always on
- Base *base, *last = NULL;
- float ctime = BKE_scene_frame_get(scene);
-
- /* only stuff that moves or needs display still */
- DAG_scene_update_flags(G.main, scene, scene->lay, TRUE);
-
- /* find the last object with the tag
- * - all those afterwards are assumed to not be relevant for our calculations
- */
- /* optimize further by moving out... */
- for (base = scene->base.first; base; base = base->next) {
- if (base->object->flag & BA_TEMP_TAG)
- last = base;
+
+ /* rigid body simulation needs complete update to work correctly for now */
+ /* RB_TODO investigate if we could avoid updating everything */
+ if (BKE_scene_check_rigidbody_active(scene)) {
+ BKE_scene_update_for_newframe(G.main, scene, scene->lay);
}
-
- /* run rigidbody sim
- * NOTE: keep in sync with BKE_scene_update_for_newframe() in scene.c
- */
- // XXX: this position may still change, objects not being updated correctly before simulation is run
- // NOTE: current position is so that rigidbody sim affects other objects
- if (BKE_scene_check_rigidbody_active(scene))
- BKE_rigidbody_do_simulation(scene, ctime);
-
- /* perform updates for tagged objects */
- /* XXX: this will break if rigs depend on scene or other data that
- * is animated but not attached to/updatable from objects */
- for (base = scene->base.first; base; base = base->next) {
- /* update this object */
- BKE_object_handle_update(scene, base->object);
+ else { /* otherwise we can optimize by restricting updates */
+ Base *base, *last = NULL;
- /* if this is the last one we need to update, let's stop to save some time */
- if (base == last)
- break;
+ /* only stuff that moves or needs display still */
+ DAG_scene_update_flags(G.main, scene, scene->lay, TRUE);
+
+ /* find the last object with the tag
+ * - all those afterwards are assumed to not be relevant for our calculations
+ */
+ /* optimize further by moving out... */
+ for (base = scene->base.first; base; base = base->next) {
+ if (base->object->flag & BA_TEMP_TAG)
+ last = base;
+ }
+
+ /* perform updates for tagged objects */
+ /* XXX: this will break if rigs depend on scene or other data that
+ * is animated but not attached to/updatable from objects */
+ for (base = scene->base.first; base; base = base->next) {
+ /* update this object */
+ BKE_object_handle_update(scene, base->object);
+
+ /* if this is the last one we need to update, let's stop to save some time */
+ if (base == last)
+ break;
+ }
}
#else // original, 'always correct' version
/* do all updates
diff --git a/source/blender/blenkernel/intern/blender.c b/source/blender/blenkernel/intern/blender.c
index fb2d1a3aaf7..be316197078 100644
--- a/source/blender/blenkernel/intern/blender.c
+++ b/source/blender/blenkernel/intern/blender.c
@@ -1000,8 +1000,7 @@ int BKE_copybuffer_paste(bContext *C, char *libname, ReportList *reports)
flag_all_listbases_ids(LIB_PRE_EXISTING, 0);
/* recreate dependency graph to include new objects */
- DAG_scene_sort(bmain, scene);
- DAG_ids_flush_update(bmain, 0);
+ DAG_relations_tag_update(bmain);
BLO_blendhandle_close(bh);
/* remove library... */
diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c
index 1a25def3829..48ad3f51389 100644
--- a/source/blender/blenkernel/intern/constraint.c
+++ b/source/blender/blenkernel/intern/constraint.c
@@ -4261,7 +4261,7 @@ static void con_unlink_refs_cb(bConstraint *UNUSED(con), ID **idpoin, short isRe
/* Free data of a specific constraint if it has any info.
* be sure to run BIK_clear_data() when freeing an IK constraint,
- * unless DAG_scene_sort is called.
+ * unless DAG_relations_tag_update is called.
*/
void BKE_free_constraint_data(bConstraint *con)
{
diff --git a/source/blender/blenkernel/intern/context.c b/source/blender/blenkernel/intern/context.c
index a45afa5e69a..a9e3d52f223 100644
--- a/source/blender/blenkernel/intern/context.c
+++ b/source/blender/blenkernel/intern/context.c
@@ -48,6 +48,8 @@
#include "BLI_threads.h"
#include "BLI_utildefines.h"
+#include "BLF_translation.h"
+
#include "BKE_context.h"
#include "BKE_main.h"
#include "BKE_screen.h"
@@ -851,7 +853,7 @@ void CTX_wm_operator_poll_msg_set(bContext *C, const char *msg)
const char *CTX_wm_operator_poll_msg_get(bContext *C)
{
- return C->wm.operator_poll_msg;
+ return IFACE_(C->wm.operator_poll_msg);
}
/* data context */
diff --git a/source/blender/blenkernel/intern/curve.c b/source/blender/blenkernel/intern/curve.c
index 7d6212f8760..2da75ec64be 100644
--- a/source/blender/blenkernel/intern/curve.c
+++ b/source/blender/blenkernel/intern/curve.c
@@ -2202,6 +2202,70 @@ static void make_bevel_list_segment_3D(BevList *bl)
copy_qt_qt(bevp2->quat, bevp1->quat);
}
+/* only for 2 points */
+static void make_bevel_list_segment_2D(BevList *bl)
+{
+ BevPoint *bevp2 = (BevPoint *)(bl + 1);
+ BevPoint *bevp1 = bevp2 + 1;
+
+ const float x1 = bevp1->vec[0] - bevp2->vec[0];
+ const float y1 = bevp1->vec[1] - bevp2->vec[1];
+
+ calc_bevel_sin_cos(x1, y1, -x1, -y1, &(bevp1->sina), &(bevp1->cosa));
+ bevp2->sina = bevp1->sina;
+ bevp2->cosa = bevp1->cosa;
+
+ /* fill in dir & quat */
+ make_bevel_list_segment_3D(bl);
+}
+
+static void make_bevel_list_2D(BevList *bl)
+{
+ /* note: bevp->dir and bevp->quat are not needed for beveling but are
+ * used when making a path from a 2D curve, therefor they need to be set - Campbell */
+
+ BevPoint *bevp2 = (BevPoint *)(bl + 1);
+ BevPoint *bevp1 = bevp2 + (bl->nr - 1);
+ BevPoint *bevp0 = bevp1 - 1;
+ int nr;
+
+ nr = bl->nr;
+ while (nr--) {
+ const float x1 = bevp1->vec[0] - bevp0->vec[0];
+ const float x2 = bevp1->vec[0] - bevp2->vec[0];
+ const float y1 = bevp1->vec[1] - bevp0->vec[1];
+ const float y2 = bevp1->vec[1] - bevp2->vec[1];
+
+ calc_bevel_sin_cos(x1, y1, x2, y2, &(bevp1->sina), &(bevp1->cosa));
+
+ /* from: make_bevel_list_3D_zup, could call but avoid a second loop.
+ * no need for tricky tilt calculation as with 3D curves */
+ bisect_v3_v3v3v3(bevp1->dir, bevp0->vec, bevp1->vec, bevp2->vec);
+ vec_to_quat(bevp1->quat, bevp1->dir, 5, 1);
+ /* done with inline make_bevel_list_3D_zup */
+
+ bevp0 = bevp1;
+ bevp1 = bevp2;
+ bevp2++;
+ }
+
+ /* correct non-cyclic cases */
+ if (bl->poly == -1) {
+ BevPoint *bevp = (BevPoint *)(bl + 1);
+ bevp1 = bevp + 1;
+ bevp->sina = bevp1->sina;
+ bevp->cosa = bevp1->cosa;
+ bevp = (BevPoint *)(bl + 1);
+ bevp += (bl->nr - 1);
+ bevp1 = bevp - 1;
+ bevp->sina = bevp1->sina;
+ bevp->cosa = bevp1->cosa;
+
+ /* correct for the dir/quat, see above why its needed */
+ bevel_list_cyclic_fix_3D(bl);
+ }
+}
+
void BKE_curve_bevelList_make(Object *ob)
{
/*
@@ -2216,7 +2280,7 @@ void BKE_curve_bevelList_make(Object *ob)
BPoint *bp;
BevList *bl, *blnew, *blnext;
BevPoint *bevp, *bevp2, *bevp1 = NULL, *bevp0;
- float min, inp, x1, x2, y1, y2;
+ float min, inp;
struct bevelsort *sortdata, *sd, *sd1;
int a, b, nr, poly, resolu = 0, len = 0;
int do_tilt, do_radius, do_weight;
@@ -2534,76 +2598,22 @@ void BKE_curve_bevelList_make(Object *ob)
/* STEP 4: 2D-COSINES or 3D ORIENTATION */
if ((cu->flag & CU_3D) == 0) {
- /* note: bevp->dir and bevp->quat are not needed for beveling but are
- * used when making a path from a 2D curve, therefor they need to be set - Campbell */
- bl = cu->bev.first;
- while (bl) {
-
+ /* 2D Curves */
+ for (bl = cu->bev.first; bl; bl = bl->next) {
if (bl->nr < 2) {
/* do nothing */
}
else if (bl->nr == 2) { /* 2 pnt, treat separate */
- bevp2 = (BevPoint *)(bl + 1);
- bevp1 = bevp2 + 1;
-
- x1 = bevp1->vec[0] - bevp2->vec[0];
- y1 = bevp1->vec[1] - bevp2->vec[1];
-
- calc_bevel_sin_cos(x1, y1, -x1, -y1, &(bevp1->sina), &(bevp1->cosa));
- bevp2->sina = bevp1->sina;
- bevp2->cosa = bevp1->cosa;
-
- /* fill in dir & quat */
- make_bevel_list_segment_3D(bl);
+ make_bevel_list_segment_2D(bl);
}
else {
- bevp2 = (BevPoint *)(bl + 1);
- bevp1 = bevp2 + (bl->nr - 1);
- bevp0 = bevp1 - 1;
-
- nr = bl->nr;
- while (nr--) {
- x1 = bevp1->vec[0] - bevp0->vec[0];
- x2 = bevp1->vec[0] - bevp2->vec[0];
- y1 = bevp1->vec[1] - bevp0->vec[1];
- y2 = bevp1->vec[1] - bevp2->vec[1];
-
- calc_bevel_sin_cos(x1, y1, x2, y2, &(bevp1->sina), &(bevp1->cosa));
-
- /* from: make_bevel_list_3D_zup, could call but avoid a second loop.
- * no need for tricky tilt calculation as with 3D curves */
- bisect_v3_v3v3v3(bevp1->dir, bevp0->vec, bevp1->vec, bevp2->vec);
- vec_to_quat(bevp1->quat, bevp1->dir, 5, 1);
- /* done with inline make_bevel_list_3D_zup */
-
- bevp0 = bevp1;
- bevp1 = bevp2;
- bevp2++;
- }
-
- /* correct non-cyclic cases */
- if (bl->poly == -1) {
- bevp = (BevPoint *)(bl + 1);
- bevp1 = bevp + 1;
- bevp->sina = bevp1->sina;
- bevp->cosa = bevp1->cosa;
- bevp = (BevPoint *)(bl + 1);
- bevp += (bl->nr - 1);
- bevp1 = bevp - 1;
- bevp->sina = bevp1->sina;
- bevp->cosa = bevp1->cosa;
-
- /* correct for the dir/quat, see above why its needed */
- bevel_list_cyclic_fix_3D(bl);
- }
+ make_bevel_list_2D(bl);
}
- bl = bl->next;
}
}
- else { /* 3D Curves */
- bl = cu->bev.first;
- while (bl) {
-
+ else {
+ /* 3D Curves */
+ for (bl = cu->bev.first; bl; bl = bl->next) {
if (bl->nr < 2) {
/* do nothing */
}
@@ -2613,7 +2623,6 @@ void BKE_curve_bevelList_make(Object *ob)
else {
make_bevel_list_3D(bl, (int)(resolu * cu->twist_smooth), cu->twist_mode);
}
- bl = bl->next;
}
}
}
diff --git a/source/blender/blenkernel/intern/deform.c b/source/blender/blenkernel/intern/deform.c
index de15100de0b..439180e8d76 100644
--- a/source/blender/blenkernel/intern/deform.c
+++ b/source/blender/blenkernel/intern/deform.c
@@ -41,14 +41,13 @@
#include "DNA_meshdata_types.h"
#include "DNA_object_types.h"
-#include "BKE_deform.h"
-
#include "BLI_listbase.h"
#include "BLI_math.h"
#include "BLI_path_util.h"
#include "BLI_string.h"
#include "BLI_utildefines.h"
+#include "BKE_deform.h" /* own include */
void defgroup_copy_list(ListBase *outbase, ListBase *inbase)
{
@@ -787,6 +786,24 @@ int defvert_find_shared(const MDeformVert *dvert_a, const MDeformVert *dvert_b)
return -1;
}
+/**
+ * return true if has no weights
+ */
+bool defvert_is_weight_zero(const struct MDeformVert *dvert, const int defgroup_tot)
+{
+ MDeformWeight *dw = dvert->dw;
+ unsigned int i;
+ for (i = dvert->totweight; i != 0; i--, dw++) {
+ if (dw->weight != 0.0f) {
+ /* check the group is in-range, happens on rare situations */
+ if (LIKELY(dw->def_nr < defgroup_tot)) {
+ return false;
+ }
+ }
+ }
+ return true;
+}
+
/* -------------------------------------------------------------------- */
/* Defvert Array functions */
diff --git a/source/blender/blenkernel/intern/depsgraph.c b/source/blender/blenkernel/intern/depsgraph.c
index 99d0c5ed964..8c55ad02dc6 100644
--- a/source/blender/blenkernel/intern/depsgraph.c
+++ b/source/blender/blenkernel/intern/depsgraph.c
@@ -837,7 +837,6 @@ DagForest *build_dag(Main *bmain, Scene *sce, short mask)
DagAdjList *itA;
dag = sce->theDag;
- sce->dagisvalid = 1;
if (dag)
free_forest(dag);
else {
@@ -1846,8 +1845,18 @@ static void scene_sort_groups(Main *bmain, Scene *sce)
}
}
+/* free the depency graph */
+static void dag_scene_free(Scene *sce)
+{
+ if (sce->theDag) {
+ free_forest(sce->theDag);
+ MEM_freeN(sce->theDag);
+ sce->theDag = NULL;
+ }
+}
+
/* sort the base list on dependency order */
-void DAG_scene_sort(Main *bmain, Scene *sce)
+static void dag_scene_build(Main *bmain, Scene *sce)
{
DagNode *node, *rootnode;
DagNodeQueue *nqueue;
@@ -1856,7 +1865,7 @@ void DAG_scene_sort(Main *bmain, Scene *sce)
int skip = 0;
ListBase tempbase;
Base *base;
-
+
tempbase.first = tempbase.last = NULL;
build_dag(bmain, sce, DAG_RL_ALL_BUT_DATA);
@@ -1936,10 +1945,34 @@ void DAG_scene_sort(Main *bmain, Scene *sce)
printf(" %s\n", base->object->id.name);
}
}
+
/* temporal...? */
sce->recalc |= SCE_PRV_CHANGED; /* test for 3d preview */
}
+/* clear all dependency graphs */
+void DAG_relations_tag_update(Main *bmain)
+{
+ Scene *sce;
+
+ for (sce = bmain->scene.first; sce; sce = sce->id.next)
+ dag_scene_free(sce);
+}
+
+/* rebuild dependency graph only for a given scene */
+void DAG_scene_relations_rebuild(Main *bmain, Scene *sce)
+{
+ dag_scene_free(sce);
+ DAG_scene_relations_update(bmain, sce);
+}
+
+/* create dependency graph if it was cleared or didn't exist yet */
+void DAG_scene_relations_update(Main *bmain, Scene *sce)
+{
+ if (!sce->theDag)
+ dag_scene_build(bmain, sce);
+}
+
static void lib_id_recalc_tag(Main *bmain, ID *id)
{
id->flag |= LIB_ID_RECALC;
@@ -2177,7 +2210,7 @@ void DAG_scene_flush_update(Main *bmain, Scene *sce, unsigned int lay, const sho
if (sce->theDag == NULL) {
printf("DAG zero... not allowed to happen!\n");
- DAG_scene_sort(bmain, sce);
+ DAG_scene_relations_update(bmain, sce);
}
firstnode = sce->theDag->DagNode.first; /* always scene node */
@@ -2545,20 +2578,6 @@ static void dag_current_scene_layers(Main *bmain, ListBase *lb)
}
}
-void DAG_ids_flush_update(Main *bmain, int time)
-{
- ListBase listbase;
- DagSceneLayer *dsl;
-
- /* get list of visible scenes and layers */
- dag_current_scene_layers(bmain, &listbase);
-
- for (dsl = listbase.first; dsl; dsl = dsl->next)
- DAG_scene_flush_update(bmain, dsl->scene, dsl->layer, time);
-
- BLI_freelistN(&listbase);
-}
-
void DAG_on_visible_update(Main *bmain, const short do_time)
{
ListBase listbase;
@@ -2895,12 +2914,10 @@ void DAG_ids_clear_recalc(Main *bmain)
memset(bmain->id_tag_update, 0, sizeof(bmain->id_tag_update));
}
-void DAG_id_tag_update(ID *id, short flag)
+void DAG_id_tag_update_ex(Main *bmain, ID *id, short flag)
{
- Main *bmain = G.main;
-
if (id == NULL) return;
-
+
/* tag ID for update */
if (flag) {
if (flag & OB_RECALC_OB)
@@ -2955,6 +2972,11 @@ void DAG_id_tag_update(ID *id, short flag)
}
}
+void DAG_id_tag_update(ID *id, short flag)
+{
+ DAG_id_tag_update_ex(G.main, id, flag);
+}
+
void DAG_id_type_tag(Main *bmain, short idtype)
{
if (idtype == ID_NT) {
@@ -3169,7 +3191,7 @@ void DAG_print_dependencies(Main *bmain, Scene *scene, Object *ob)
}
else {
printf("\nDEPENDENCY RELATIONS for %s\n\n", scene->id.name + 2);
- DAG_scene_sort(bmain, scene);
+ DAG_scene_relations_rebuild(bmain, scene);
}
dag_print_dependencies = 0;
diff --git a/source/blender/blenkernel/intern/editderivedmesh.c b/source/blender/blenkernel/intern/editderivedmesh.c
index d652b97e2fa..11c05772962 100644
--- a/source/blender/blenkernel/intern/editderivedmesh.c
+++ b/source/blender/blenkernel/intern/editderivedmesh.c
@@ -997,6 +997,43 @@ static void emDM_drawMappedFacesTex(DerivedMesh *dm,
emDM_drawFacesTex_common(dm, NULL, setDrawOptions, compareDrawOptions, userData);
}
+/**
+ * \note
+ *
+ * For UV's:
+ * const MLoopUV *luv = BM_ELEM_CD_GET_VOID_P(loop, attribs->tface[i].em_offset);
+ *
+ * This is intentionally different to calling:
+ * CustomData_bmesh_get_n(&bm->ldata, loop->head.data, CD_MLOOPUV, i);
+ *
+ * ... because the material may use layer names to select different UV's
+ * see: [#34378]
+ */
+static void emdm_pass_attrib_vertex_glsl(DMVertexAttribs *attribs, BMLoop *loop, int index_in_face)
+{
+ BMVert *eve = loop->v;
+ int i;
+
+ if (attribs->totorco) {
+ const float *orco = attribs->orco.array[BM_elem_index_get(eve)];
+ glVertexAttrib3fvARB(attribs->orco.gl_index, orco);
+ }
+ for (i = 0; i < attribs->tottface; i++) {
+ const MLoopUV *luv = BM_ELEM_CD_GET_VOID_P(loop, attribs->tface[i].em_offset);
+ glVertexAttrib2fvARB(attribs->tface[i].gl_index, luv->uv);
+ }
+ for (i = 0; i < attribs->totmcol; i++) {
+ const MLoopCol *cp = BM_ELEM_CD_GET_VOID_P(loop, attribs->mcol[i].em_offset);
+ GLubyte col[4];
+ col[0] = cp->b; col[1] = cp->g; col[2] = cp->r; col[3] = cp->a;
+ glVertexAttrib4ubvARB(attribs->mcol[i].gl_index, col);
+ }
+ if (attribs->tottang) {
+ const float *tang = attribs->tang.array[i * 4 + index_in_face];
+ glVertexAttrib3fvARB(attribs->tang.gl_index, tang);
+ }
+}
+
static void emDM_drawMappedFacesGLSL(DerivedMesh *dm,
DMSetMaterial setMaterial,
DMSetDrawOptions setDrawOptions,
@@ -1012,7 +1049,7 @@ static void emDM_drawMappedFacesGLSL(DerivedMesh *dm,
DMVertexAttribs attribs;
GPUVertexAttribs gattribs;
- int i, b, matnr, new_matnr, do_draw;
+ int i, matnr, new_matnr, do_draw;
do_draw = FALSE;
matnr = -1;
@@ -1023,30 +1060,6 @@ static void emDM_drawMappedFacesGLSL(DerivedMesh *dm,
glShadeModel(GL_SMOOTH);
BM_mesh_elem_index_ensure(bm, BM_VERT | BM_FACE);
-#define PASSATTRIB(loop, eve, vert) { \
- if (attribs.totorco) { \
- float *orco = attribs.orco.array[BM_elem_index_get(eve)]; \
- glVertexAttrib3fvARB(attribs.orco.gl_index, orco); \
- } \
- for (b = 0; b < attribs.tottface; b++) { \
- MLoopUV *_luv = CustomData_bmesh_get_n(&bm->ldata, loop->head.data, \
- CD_MLOOPUV, b); \
- glVertexAttrib2fvARB(attribs.tface[b].gl_index, _luv->uv); \
- } \
- for (b = 0; b < attribs.totmcol; b++) { \
- MLoopCol *_cp = CustomData_bmesh_get_n(&bm->ldata, loop->head.data, \
- CD_MLOOPCOL, b); \
- GLubyte _col[4]; \
- _col[0] = _cp->b; _col[1] = _cp->g; _col[2] = _cp->r; _col[3] = _cp->a; \
- glVertexAttrib4ubvARB(attribs.mcol[b].gl_index, _col); \
- } \
- if (attribs.tottang) { \
- float *tang = attribs.tang.array[i * 4 + vert]; \
- glVertexAttrib3fvARB(attribs.tang.gl_index, tang); \
- } \
- } (void)0
-
-
for (i = 0, ltri = em->looptris[0]; i < em->tottri; i++, ltri += 3) {
int drawSmooth;
@@ -1069,20 +1082,20 @@ static void emDM_drawMappedFacesGLSL(DerivedMesh *dm,
if (vertexCos) glNormal3fv(bmdm->polyNos[BM_elem_index_get(efa)]);
else glNormal3fv(efa->no);
- PASSATTRIB(ltri[0], ltri[0]->v, 0);
+ emdm_pass_attrib_vertex_glsl(&attribs, ltri[0], 0);
if (vertexCos) glVertex3fv(vertexCos[BM_elem_index_get(ltri[0]->v)]);
else glVertex3fv(ltri[0]->v->co);
- PASSATTRIB(ltri[1], ltri[1]->v, 1);
+ emdm_pass_attrib_vertex_glsl(&attribs, ltri[1], 1);
if (vertexCos) glVertex3fv(vertexCos[BM_elem_index_get(ltri[1]->v)]);
else glVertex3fv(ltri[1]->v->co);
- PASSATTRIB(ltri[2], ltri[2]->v, 2);
+ emdm_pass_attrib_vertex_glsl(&attribs, ltri[2], 2);
if (vertexCos) glVertex3fv(vertexCos[BM_elem_index_get(ltri[2]->v)]);
else glVertex3fv(ltri[2]->v->co);
}
else {
- PASSATTRIB(ltri[0], ltri[0]->v, 0);
+ emdm_pass_attrib_vertex_glsl(&attribs, ltri[0], 0);
if (vertexCos) {
glNormal3fv(vertexNos[BM_elem_index_get(ltri[0]->v)]);
glVertex3fv(vertexCos[BM_elem_index_get(ltri[0]->v)]);
@@ -1092,7 +1105,7 @@ static void emDM_drawMappedFacesGLSL(DerivedMesh *dm,
glVertex3fv(ltri[0]->v->co);
}
- PASSATTRIB(ltri[1], ltri[1]->v, 1);
+ emdm_pass_attrib_vertex_glsl(&attribs, ltri[1], 1);
if (vertexCos) {
glNormal3fv(vertexNos[BM_elem_index_get(ltri[1]->v)]);
glVertex3fv(vertexCos[BM_elem_index_get(ltri[1]->v)]);
@@ -1102,7 +1115,7 @@ static void emDM_drawMappedFacesGLSL(DerivedMesh *dm,
glVertex3fv(ltri[1]->v->co);
}
- PASSATTRIB(ltri[2], ltri[2]->v, 2);
+ emdm_pass_attrib_vertex_glsl(&attribs, ltri[2], 2);
if (vertexCos) {
glNormal3fv(vertexNos[BM_elem_index_get(ltri[2]->v)]);
glVertex3fv(vertexCos[BM_elem_index_get(ltri[2]->v)]);
@@ -1115,7 +1128,6 @@ static void emDM_drawMappedFacesGLSL(DerivedMesh *dm,
glEnd();
}
}
-#undef PASSATTRIB
}
static void emDM_drawFacesGLSL(DerivedMesh *dm,
@@ -1124,6 +1136,38 @@ static void emDM_drawFacesGLSL(DerivedMesh *dm,
dm->drawMappedFacesGLSL(dm, setMaterial, NULL, NULL);
}
+/* emdm_pass_attrib_vertex_glsl's note about em_offset use applies here */
+static void emdm_pass_attrib_vertex_mat(DMVertexAttribs *attribs, BMLoop *loop, int index_in_face)
+{
+ BMVert *eve = loop->v;
+ int i;
+
+ if (attribs->totorco) {
+ float *orco = attribs->orco.array[BM_elem_index_get(eve)];
+ if (attribs->orco.gl_texco)
+ glTexCoord3fv(orco);
+ else
+ glVertexAttrib3fvARB(attribs->orco.gl_index, orco);
+ }
+ for (i = 0; i < attribs->tottface; i++) {
+ const MLoopUV *luv = BM_ELEM_CD_GET_VOID_P(loop, attribs->tface[i].em_offset);
+ if (attribs->tface[i].gl_texco)
+ glTexCoord2fv(luv->uv);
+ else
+ glVertexAttrib2fvARB(attribs->tface[i].gl_index, luv->uv);
+ }
+ for (i = 0; i < attribs->totmcol; i++) {
+ const MLoopCol *cp = BM_ELEM_CD_GET_VOID_P(loop, attribs->mcol[i].em_offset);
+ GLubyte col[4];
+ col[0] = cp->b; col[1] = cp->g; col[2] = cp->r; col[3] = cp->a;
+ glVertexAttrib4ubvARB(attribs->mcol[i].gl_index, col);
+ }
+ if (attribs->tottang) {
+ float *tang = attribs->tang.array[i * 4 + index_in_face];
+ glVertexAttrib4fvARB(attribs->tang.gl_index, tang);
+ }
+}
+
static void emDM_drawMappedFacesMat(DerivedMesh *dm,
void (*setMaterial)(void *userData, int, void *attribs),
int (*setFace)(void *userData, int index), void *userData)
@@ -1137,7 +1181,7 @@ static void emDM_drawMappedFacesMat(DerivedMesh *dm,
BMLoop **ltri;
DMVertexAttribs attribs = {{{0}}};
GPUVertexAttribs gattribs;
- int i, b, matnr, new_matnr;
+ int i, matnr, new_matnr;
matnr = -1;
@@ -1146,35 +1190,6 @@ static void emDM_drawMappedFacesMat(DerivedMesh *dm,
BM_mesh_elem_index_ensure(bm, BM_VERT | BM_FACE);
-#define PASSATTRIB(loop, eve, vert) { \
- if (attribs.totorco) { \
- float *orco = attribs.orco.array[BM_elem_index_get(eve)]; \
- if (attribs.orco.gl_texco) \
- glTexCoord3fv(orco); \
- else \
- glVertexAttrib3fvARB(attribs.orco.gl_index, orco); \
- } \
- for (b = 0; b < attribs.tottface; b++) { \
- MLoopUV *_luv = CustomData_bmesh_get_n(&bm->ldata, loop->head.data, \
- CD_MLOOPUV, b); \
- if (attribs.tface[b].gl_texco) \
- glTexCoord2fv(_luv->uv); \
- else \
- glVertexAttrib2fvARB(attribs.tface[b].gl_index, _luv->uv); \
- } \
- for (b = 0; b < attribs.totmcol; b++) { \
- MLoopCol *_cp = CustomData_bmesh_get_n(&bm->ldata, loop->head.data, \
- CD_MLOOPCOL, b); \
- GLubyte _col[4]; \
- _col[0] = _cp->b; _col[1] = _cp->g; _col[2] = _cp->r; _col[3] = _cp->a; \
- glVertexAttrib4ubvARB(attribs.mcol[b].gl_index, _col); \
- } \
- if (attribs.tottang) { \
- float *tang = attribs.tang.array[i * 4 + vert]; \
- glVertexAttrib4fvARB(attribs.tang.gl_index, tang); \
- } \
- } (void)0
-
for (i = 0, ltri = em->looptris[0]; i < em->tottri; i++, ltri += 3) {
int drawSmooth;
@@ -1198,21 +1213,21 @@ static void emDM_drawMappedFacesMat(DerivedMesh *dm,
if (vertexCos) glNormal3fv(bmdm->polyNos[BM_elem_index_get(efa)]);
else glNormal3fv(efa->no);
- PASSATTRIB(ltri[0], ltri[0]->v, 0);
+ emdm_pass_attrib_vertex_mat(&attribs, ltri[0], 0);
if (vertexCos) glVertex3fv(vertexCos[BM_elem_index_get(ltri[0]->v)]);
else glVertex3fv(ltri[0]->v->co);
- PASSATTRIB(ltri[1], ltri[1]->v, 1);
+ emdm_pass_attrib_vertex_mat(&attribs, ltri[1], 1);
if (vertexCos) glVertex3fv(vertexCos[BM_elem_index_get(ltri[1]->v)]);
else glVertex3fv(ltri[1]->v->co);
- PASSATTRIB(ltri[2], ltri[2]->v, 2);
+ emdm_pass_attrib_vertex_mat(&attribs, ltri[2], 2);
if (vertexCos) glVertex3fv(vertexCos[BM_elem_index_get(ltri[2]->v)]);
else glVertex3fv(ltri[2]->v->co);
}
else {
- PASSATTRIB(ltri[0], ltri[0]->v, 0);
+ emdm_pass_attrib_vertex_mat(&attribs, ltri[0], 0);
if (vertexCos) {
glNormal3fv(vertexNos[BM_elem_index_get(ltri[0]->v)]);
glVertex3fv(vertexCos[BM_elem_index_get(ltri[0]->v)]);
@@ -1222,7 +1237,7 @@ static void emDM_drawMappedFacesMat(DerivedMesh *dm,
glVertex3fv(ltri[0]->v->co);
}
- PASSATTRIB(ltri[1], ltri[1]->v, 1);
+ emdm_pass_attrib_vertex_mat(&attribs, ltri[1], 1);
if (vertexCos) {
glNormal3fv(vertexNos[BM_elem_index_get(ltri[1]->v)]);
glVertex3fv(vertexCos[BM_elem_index_get(ltri[1]->v)]);
@@ -1232,7 +1247,7 @@ static void emDM_drawMappedFacesMat(DerivedMesh *dm,
glVertex3fv(ltri[1]->v->co);
}
- PASSATTRIB(ltri[2], ltri[2]->v, 2);
+ emdm_pass_attrib_vertex_mat(&attribs, ltri[2], 2);
if (vertexCos) {
glNormal3fv(vertexNos[BM_elem_index_get(ltri[2]->v)]);
glVertex3fv(vertexCos[BM_elem_index_get(ltri[2]->v)]);
@@ -1244,7 +1259,6 @@ static void emDM_drawMappedFacesMat(DerivedMesh *dm,
}
glEnd();
}
-#undef PASSATTRIB
}
static void emDM_getMinMax(DerivedMesh *dm, float min_r[3], float max_r[3])
diff --git a/source/blender/blenkernel/intern/idprop.c b/source/blender/blenkernel/intern/idprop.c
index 9fdf51ceba9..19ef1e3971d 100644
--- a/source/blender/blenkernel/intern/idprop.c
+++ b/source/blender/blenkernel/intern/idprop.c
@@ -454,7 +454,7 @@ void IDP_ReplaceGroupInGroup(IDProperty *dest, IDProperty *src)
if (strcmp(loop->name, prop->name) == 0) {
IDProperty *copy = IDP_CopyProperty(prop);
- BLI_insertlink(&dest->data.group, loop, copy);
+ BLI_insertlinkafter(&dest->data.group, loop, copy);
BLI_remlink(&dest->data.group, loop);
IDP_FreeProperty(loop);
@@ -479,7 +479,7 @@ void IDP_ReplaceInGroup(IDProperty *group, IDProperty *prop)
{
IDProperty *loop;
if ((loop = IDP_GetPropertyFromGroup(group, prop->name))) {
- BLI_insertlink(&group->data.group, loop, prop);
+ BLI_insertlinkafter(&group->data.group, loop, prop);
BLI_remlink(&group->data.group, loop);
IDP_FreeProperty(loop);
@@ -532,7 +532,7 @@ int IDP_InsertToGroup(IDProperty *group, IDProperty *previous, IDProperty *pnew)
{
if (IDP_GetPropertyFromGroup(group, pnew->name) == NULL) {
group->len++;
- BLI_insertlink(&group->data.group, previous, pnew);
+ BLI_insertlinkafter(&group->data.group, previous, pnew);
return 1;
}
diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c
index de85cb54cfd..3655afdf088 100644
--- a/source/blender/blenkernel/intern/image.c
+++ b/source/blender/blenkernel/intern/image.c
@@ -571,6 +571,20 @@ static void image_init_color_management(Image *ima)
}
}
+void BKE_image_alpha_mode_from_extension(Image *image)
+{
+ if (BLI_testextensie(image->name, ".exr") ||
+ BLI_testextensie(image->name, ".cin") ||
+ BLI_testextensie(image->name, ".dpx") ||
+ BLI_testextensie(image->name, ".hdr"))
+ {
+ image->alpha_mode = IMA_ALPHA_PREMUL;
+ }
+ else {
+ image->alpha_mode = IMA_ALPHA_STRAIGHT;
+ }
+}
+
Image *BKE_image_load(Main *bmain, const char *filepath)
{
Image *ima;
diff --git a/source/blender/blenkernel/intern/key.c b/source/blender/blenkernel/intern/key.c
index cb0a11a16e0..f3dc391738e 100644
--- a/source/blender/blenkernel/intern/key.c
+++ b/source/blender/blenkernel/intern/key.c
@@ -246,7 +246,7 @@ void BKE_key_sort(Key *key)
/* find the right location and insert before */
for (kb2 = key->block.first; kb2; kb2 = kb2->next) {
if (kb2->pos > kb->pos) {
- BLI_insertlink(&key->block, kb2->prev, kb);
+ BLI_insertlinkafter(&key->block, kb2->prev, kb);
break;
}
}
diff --git a/source/blender/blenkernel/intern/movieclip.c b/source/blender/blenkernel/intern/movieclip.c
index 943d9e9452a..eceac61ddb6 100644
--- a/source/blender/blenkernel/intern/movieclip.c
+++ b/source/blender/blenkernel/intern/movieclip.c
@@ -216,7 +216,7 @@ static ImBuf *movieclip_load_sequence_file(MovieClip *clip, MovieClipUser *user,
colorspace = clip->colorspace_settings.name;
}
- loadflag = IB_rect | IB_multilayer;
+ loadflag = IB_rect | IB_multilayer | IB_alphamode_detect;
/* read ibuf */
ibuf = IMB_loadiffname(name, loadflag, colorspace);
diff --git a/source/blender/blenkernel/intern/node.c b/source/blender/blenkernel/intern/node.c
index 97bee320ecb..86fe47268d6 100644
--- a/source/blender/blenkernel/intern/node.c
+++ b/source/blender/blenkernel/intern/node.c
@@ -2028,9 +2028,8 @@ void node_type_base(bNodeTreeType *ttype, bNodeType *ntype, int type, const char
ntype->update_internal_links = ttype->update_internal_links;
/* default size values */
- ntype->width = 140;
- ntype->minwidth = 100;
- ntype->maxwidth = 320;
+ node_type_size_preset(ntype, NODE_SIZE_DEFAULT);
+
ntype->height = 100;
ntype->minheight = 30;
ntype->maxheight = FLT_MAX;
@@ -2062,6 +2061,21 @@ void node_type_size(struct bNodeType *ntype, int width, int minwidth, int maxwid
ntype->maxwidth = maxwidth;
}
+void node_type_size_preset(struct bNodeType *ntype, eNodeSizePreset size)
+{
+ switch (size) {
+ case NODE_SIZE_DEFAULT:
+ node_type_size(ntype, 140, 100, 320);
+ break;
+ case NODE_SIZE_SMALL:
+ node_type_size(ntype, 100, 80, 320);
+ break;
+ case NODE_SIZE_LARGE:
+ node_type_size(ntype, 140, 120, 500);
+ break;
+ }
+}
+
void node_type_storage(bNodeType *ntype, const char *storagename, void (*freestoragefunc)(struct bNode *), void (*copystoragefunc)(struct bNode *, struct bNode *))
{
if (storagename)
diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c
index 119dc8c7d11..5cea2c9fe0e 100644
--- a/source/blender/blenkernel/intern/object.c
+++ b/source/blender/blenkernel/intern/object.c
@@ -74,6 +74,7 @@
#include "BKE_bullet.h"
#include "BKE_colortools.h"
#include "BKE_deform.h"
+#include "BKE_depsgraph.h"
#include "BKE_DerivedMesh.h"
#include "BKE_animsys.h"
#include "BKE_anim.h"
@@ -410,7 +411,8 @@ static void unlink_object__unlinkModifierLinks(void *userData, Object *ob, Objec
if (*obpoin == unlinkOb) {
*obpoin = NULL;
- ob->recalc |= OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME; // XXX: should this just be OB_RECALC_DATA?
+ // XXX: should this just be OB_RECALC_DATA?
+ DAG_id_tag_update(&ob->id, OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME);
}
}
@@ -444,14 +446,14 @@ void BKE_object_unlink(Object *ob)
obt->proxy = NULL;
if (obt->proxy_from == ob) {
obt->proxy_from = NULL;
- obt->recalc |= OB_RECALC_OB;
+ DAG_id_tag_update(&obt->id, OB_RECALC_OB);
}
if (obt->proxy_group == ob)
obt->proxy_group = NULL;
if (obt->parent == ob) {
obt->parent = NULL;
- obt->recalc |= OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME;
+ DAG_id_tag_update(&obt->id, OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME);
}
modifiers_foreachObjectLink(obt, unlink_object__unlinkModifierLinks, ob);
@@ -461,15 +463,15 @@ void BKE_object_unlink(Object *ob)
if (cu->bevobj == ob) {
cu->bevobj = NULL;
- obt->recalc |= OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME;
+ DAG_id_tag_update(&obt->id, OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME);
}
if (cu->taperobj == ob) {
cu->taperobj = NULL;
- obt->recalc |= OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME;
+ DAG_id_tag_update(&obt->id, OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME);
}
if (cu->textoncurve == ob) {
cu->textoncurve = NULL;
- obt->recalc |= OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME;
+ DAG_id_tag_update(&obt->id, OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME);
}
}
else if (obt->type == OB_ARMATURE && obt->pose) {
@@ -487,7 +489,7 @@ void BKE_object_unlink(Object *ob)
if (ct->tar == ob) {
ct->tar = NULL;
ct->subtarget[0] = '\0';
- obt->recalc |= OB_RECALC_DATA;
+ DAG_id_tag_update(&obt->id, OB_RECALC_DATA);
}
}
@@ -501,7 +503,7 @@ void BKE_object_unlink(Object *ob)
}
else if (ELEM(OB_MBALL, ob->type, obt->type)) {
if (BKE_mball_is_basis_for(obt, ob))
- obt->recalc |= OB_RECALC_DATA;
+ DAG_id_tag_update(&obt->id, OB_RECALC_DATA);
}
sca_remove_ob_poin(obt, ob);
@@ -518,7 +520,7 @@ void BKE_object_unlink(Object *ob)
if (ct->tar == ob) {
ct->tar = NULL;
ct->subtarget[0] = '\0';
- obt->recalc |= OB_RECALC_DATA;
+ DAG_id_tag_update(&obt->id, OB_RECALC_DATA);
}
}
@@ -530,12 +532,12 @@ void BKE_object_unlink(Object *ob)
/* object is deflector or field */
if (ob->pd) {
if (obt->soft)
- obt->recalc |= OB_RECALC_DATA;
+ DAG_id_tag_update(&obt->id, OB_RECALC_DATA);
/* cloth */
for (md = obt->modifiers.first; md; md = md->next)
if (md->type == eModifierType_Cloth)
- obt->recalc |= OB_RECALC_DATA;
+ DAG_id_tag_update(&obt->id, OB_RECALC_DATA);
}
/* strips */
@@ -564,14 +566,14 @@ void BKE_object_unlink(Object *ob)
for (; pt; pt = pt->next) {
if (pt->ob == ob) {
pt->ob = NULL;
- obt->recalc |= OB_RECALC_DATA;
+ DAG_id_tag_update(&obt->id, OB_RECALC_DATA);
break;
}
}
if (tpsys->target_ob == ob) {
tpsys->target_ob = NULL;
- obt->recalc |= OB_RECALC_DATA;
+ DAG_id_tag_update(&obt->id, OB_RECALC_DATA);
}
if (tpsys->part->dup_ob == ob)
@@ -606,7 +608,7 @@ void BKE_object_unlink(Object *ob)
}
}
if (ob->pd)
- obt->recalc |= OB_RECALC_DATA;
+ DAG_id_tag_update(&obt->id, OB_RECALC_DATA);
}
obt = obt->id.next;
@@ -984,7 +986,7 @@ Object *BKE_object_add(struct Scene *scene, int type)
base = BKE_scene_base_add(scene, ob);
BKE_scene_base_deselect_all(scene);
BKE_scene_base_select(scene, base);
- ob->recalc |= OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME;
+ DAG_id_tag_update(&ob->id, OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME);
return ob;
}
@@ -1494,7 +1496,8 @@ void BKE_object_make_proxy(Object *ob, Object *target, Object *gob)
ob->proxy_group = gob;
id_lib_extern(&target->id);
- ob->recalc = target->recalc = OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME;
+ DAG_id_tag_update(&ob->id, OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME);
+ DAG_id_tag_update(&target->id, OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME);
/* copy transform
* - gob means this proxy comes from a group, just apply the matrix
@@ -2132,7 +2135,8 @@ static int where_is_object_parslow(Object *ob, float obmat[4][4], float slowmat[
}
/* note, scene is the active scene while actual_scene is the scene the object resides in */
-void BKE_object_where_is_calc_time_ex(Scene *scene, RigidBodyWorld *rbw, Object *ob, float ctime)
+void BKE_object_where_is_calc_time_ex(Scene *scene, Object *ob, float ctime,
+ RigidBodyWorld *rbw)
{
if (ob == NULL) return;
@@ -2158,6 +2162,8 @@ void BKE_object_where_is_calc_time_ex(Scene *scene, RigidBodyWorld *rbw, Object
BKE_object_to_mat4(ob, ob->obmat);
}
+ /* try to fall back to the scene rigid body world if none given */
+ rbw = rbw ? rbw : scene->rigidbody_world;
/* read values pushed into RBO from sim/cache... */
BKE_rigidbody_sync_transforms(rbw, ob, ctime);
@@ -2177,7 +2183,7 @@ void BKE_object_where_is_calc_time_ex(Scene *scene, RigidBodyWorld *rbw, Object
void BKE_object_where_is_calc_time(Scene *scene, Object *ob, float ctime)
{
- BKE_object_where_is_calc_time_ex(scene, NULL, ob, ctime);
+ BKE_object_where_is_calc_time_ex(scene, ob, ctime, NULL);
}
/* get object transformation matrix without recalculating dependencies and
@@ -2203,17 +2209,17 @@ void BKE_object_where_is_calc_mat4(Scene *scene, Object *ob, float obmat[4][4])
void BKE_object_where_is_calc_ex(Scene *scene, RigidBodyWorld *rbw, Object *ob)
{
- BKE_object_where_is_calc_time_ex(scene, rbw, ob, BKE_scene_frame_get(scene));
+ BKE_object_where_is_calc_time_ex(scene, ob, BKE_scene_frame_get(scene), rbw);
}
void BKE_object_where_is_calc(Scene *scene, Object *ob)
{
- BKE_object_where_is_calc_time_ex(scene, NULL, ob, BKE_scene_frame_get(scene));
+ BKE_object_where_is_calc_time_ex(scene, ob, BKE_scene_frame_get(scene), NULL);
}
-void BKE_object_where_is_calc_simul(Scene *scene, Object *ob)
/* was written for the old game engine (until 2.04) */
/* It seems that this function is only called
* for a lamp that is the child of another object */
+void BKE_object_where_is_calc_simul(Scene *scene, Object *ob)
{
Object *par;
float *fp1, *fp2;
@@ -2644,7 +2650,8 @@ int BKE_object_parent_loop_check(const Object *par, const Object *ob)
/* the main object update call, for object matrix, constraints, keys and displist (modifiers) */
/* requires flags to be set! */
/* Ideally we shouldn't have to pass the rigid body world, but need bigger restructuring to avoid id */
-void BKE_object_handle_update_ex(Scene *scene, RigidBodyWorld *rbw, Object *ob)
+void BKE_object_handle_update_ex(Scene *scene, Object *ob,
+ RigidBodyWorld *rbw)
{
if (ob->recalc & OB_RECALC_ALL) {
/* speed optimization for animation lookups */
@@ -2846,7 +2853,7 @@ void BKE_object_handle_update_ex(Scene *scene, RigidBodyWorld *rbw, Object *ob)
*/
void BKE_object_handle_update(Scene *scene, Object *ob)
{
- BKE_object_handle_update_ex(scene, NULL, ob);
+ BKE_object_handle_update_ex(scene, ob, NULL);
}
void BKE_object_sculpt_modifiers_changed(Object *ob)
diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c
index c01ea4e518d..f90fde983aa 100644
--- a/source/blender/blenkernel/intern/particle.c
+++ b/source/blender/blenkernel/intern/particle.c
@@ -3509,12 +3509,12 @@ ModifierData *object_add_particle_system(Scene *scene, Object *ob, const char *n
psys->flag = PSYS_ENABLED | PSYS_CURRENT;
psys->cfra = BKE_scene_frame_get_from_ctime(scene, CFRA + 1);
- DAG_scene_sort(G.main, scene);
+ DAG_relations_tag_update(G.main);
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
return md;
}
-void object_remove_particle_system(Scene *scene, Object *ob)
+void object_remove_particle_system(Scene *UNUSED(scene), Object *ob)
{
ParticleSystem *psys = psys_get_current(ob);
ParticleSystemModifierData *psmd;
@@ -3552,7 +3552,7 @@ void object_remove_particle_system(Scene *scene, Object *ob)
else
ob->mode &= ~OB_MODE_PARTICLE_EDIT;
- DAG_scene_sort(G.main, scene);
+ DAG_relations_tag_update(G.main);
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
}
static void default_particle_settings(ParticleSettings *part)
diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c
index 6e4937d11ec..3efe25794e1 100644
--- a/source/blender/blenkernel/intern/particle_system.c
+++ b/source/blender/blenkernel/intern/particle_system.c
@@ -3028,13 +3028,20 @@ static void basic_rotate(ParticleSettings *part, ParticleData *pa, float dfra, f
normalize_qt(pa->state.rot);
}
-/************************************************/
-/* Collisions */
-/************************************************/
+/************************************************
+ * Collisions
+ *
+ * The algorithm is roughly:
+ * 1. Use a BVH tree to search for faces that a particle may collide with.
+ * 2. Use Newton's method to find the exact time at which the collision occurs.
+ * http://en.wikipedia.org/wiki/Newton's_method
+ *
+ ************************************************/
#define COLLISION_MAX_COLLISIONS 10
#define COLLISION_MIN_RADIUS 0.001f
#define COLLISION_MIN_DISTANCE 0.0001f
#define COLLISION_ZERO 0.00001f
+#define COLLISION_INIT_STEP 0.00008f
typedef float (*NRDistanceFunc)(float *p, float radius, ParticleCollisionElement *pce, float *nor);
static float nr_signed_distance_to_plane(float *p, float radius, ParticleCollisionElement *pce, float *nor)
{
@@ -3189,16 +3196,20 @@ static void collision_point_on_surface(float p[3], ParticleCollisionElement *pce
/* find first root in range [0-1] starting from 0 */
static float collision_newton_rhapson(ParticleCollision *col, float radius, ParticleCollisionElement *pce, NRDistanceFunc distance_func)
{
- float t0, t1, d0, d1, dd, n[3];
+ float t0, t1, dt_init, d0, d1, dd, n[3];
int iter;
pce->inv_nor = -1;
+ /* Initial step size should be small, but not too small or floating point
+ * precision errors will appear. - z0r */
+ dt_init = COLLISION_INIT_STEP * col->inv_total_time;
+
/* start from the beginning */
t0 = 0.f;
collision_interpolate_element(pce, t0, col->f, col);
d0 = distance_func(col->co1, radius, pce, n);
- t1 = 0.001f;
+ t1 = dt_init;
d1 = 0.f;
for (iter=0; iter<10; iter++) {//, itersum++) {
@@ -3208,11 +3219,6 @@ static float collision_newton_rhapson(ParticleCollision *col, float radius, Part
d1 = distance_func(pce->p, radius, pce, n);
- /* no movement, so no collision */
- if (d1 == d0) {
- return -1.f;
- }
-
/* particle already inside face, so report collision */
if (iter == 0 && d0 < 0.f && d0 > -radius) {
copy_v3_v3(pce->p, col->co1);
@@ -3220,7 +3226,24 @@ static float collision_newton_rhapson(ParticleCollision *col, float radius, Part
pce->inside = 1;
return 0.f;
}
-
+
+ /* Zero gradient (no movement relative to element). Can't step from
+ * here. */
+ if (d1 == d0) {
+ /* If first iteration, try from other end where the gradient may be
+ * greater. Note: code duplicated below. */
+ if (iter == 0) {
+ t0 = 1.f;
+ collision_interpolate_element(pce, t0, col->f, col);
+ d0 = distance_func(col->co2, radius, pce, n);
+ t1 = 1.0f - dt_init;
+ d1 = 0.f;
+ continue;
+ }
+ else
+ return -1.f;
+ }
+
dd = (t1-t0)/(d1-d0);
t0 = t1;
@@ -3228,14 +3251,14 @@ static float collision_newton_rhapson(ParticleCollision *col, float radius, Part
t1 -= d1*dd;
- /* particle movin away from plane could also mean a strangely rotating face, so check from end */
+ /* Particle moving away from plane could also mean a strangely rotating
+ * face, so check from end. Note: code duplicated above. */
if (iter == 0 && t1 < 0.f) {
t0 = 1.f;
collision_interpolate_element(pce, t0, col->f, col);
d0 = distance_func(col->co2, radius, pce, n);
- t1 = 0.999f;
+ t1 = 1.0f - dt_init;
d1 = 0.f;
-
continue;
}
else if (iter == 1 && (t1 < -COLLISION_ZERO || t1 > 1.f))
@@ -3683,6 +3706,7 @@ static void collision_check(ParticleSimulationData *sim, int p, float dfra, floa
memset(&col, 0, sizeof(ParticleCollision));
col.total_time = timestep * dfra;
+ col.inv_total_time = 1.0f/col.total_time;
col.inv_timestep = 1.0f/timestep;
col.cfra = cfra;
diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c
index 4302032ade1..27c5e03132e 100644
--- a/source/blender/blenkernel/intern/pointcache.c
+++ b/source/blender/blenkernel/intern/pointcache.c
@@ -52,6 +52,8 @@
#include "BLI_math.h"
#include "BLI_utildefines.h"
+#include "BLF_translation.h"
+
#include "PIL_time.h"
#include "WM_api.h"
@@ -3505,11 +3507,11 @@ void BKE_ptcache_update_info(PTCacheID *pid)
/* smoke doesn't use frame 0 as info frame so can't check based on totpoint */
if (pid->type == PTCACHE_TYPE_SMOKE_DOMAIN && totframes)
- BLI_snprintf(cache->info, sizeof(cache->info), "%i frames found!", totframes);
+ BLI_snprintf(cache->info, sizeof(cache->info), IFACE_("%i frames found!"), totframes);
else if (totframes && cache->totpoint)
- BLI_snprintf(cache->info, sizeof(cache->info), "%i points found!", cache->totpoint);
+ BLI_snprintf(cache->info, sizeof(cache->info), IFACE_("%i points found!"), cache->totpoint);
else
- BLI_snprintf(cache->info, sizeof(cache->info), "No valid data to read!");
+ BLI_snprintf(cache->info, sizeof(cache->info), IFACE_("No valid data to read!"));
return;
}
@@ -3518,9 +3520,9 @@ void BKE_ptcache_update_info(PTCacheID *pid)
int totpoint = pid->totpoint(pid->calldata, 0);
if (cache->totpoint > totpoint)
- BLI_snprintf(mem_info, sizeof(mem_info), "%i cells + High Resolution cached", totpoint);
+ BLI_snprintf(mem_info, sizeof(mem_info), IFACE_("%i cells + High Resolution cached"), totpoint);
else
- BLI_snprintf(mem_info, sizeof(mem_info), "%i cells cached", totpoint);
+ BLI_snprintf(mem_info, sizeof(mem_info), IFACE_("%i cells cached"), totpoint);
}
else {
int cfra = cache->startframe;
@@ -3530,7 +3532,7 @@ void BKE_ptcache_update_info(PTCacheID *pid)
totframes++;
}
- BLI_snprintf(mem_info, sizeof(mem_info), "%i frames on disk", totframes);
+ BLI_snprintf(mem_info, sizeof(mem_info), IFACE_("%i frames on disk"), totframes);
}
}
else {
@@ -3554,17 +3556,18 @@ void BKE_ptcache_update_info(PTCacheID *pid)
mb = (bytes > 1024.0f * 1024.0f);
- BLI_snprintf(mem_info, sizeof(mem_info), "%i frames in memory (%.1f %s)",
+ BLI_snprintf(mem_info, sizeof(mem_info), IFACE_("%i frames in memory (%.1f %s)"),
totframes,
bytes / (mb ? 1024.0f * 1024.0f : 1024.0f),
- mb ? "Mb" : "kb");
+ mb ? IFACE_("Mb") : IFACE_("kb"));
}
if (cache->flag & PTCACHE_OUTDATED) {
- BLI_snprintf(cache->info, sizeof(cache->info), "%s, cache is outdated!", mem_info);
+ BLI_snprintf(cache->info, sizeof(cache->info), IFACE_("%s, cache is outdated!"), mem_info);
}
else if (cache->flag & PTCACHE_FRAMES_SKIPPED) {
- BLI_snprintf(cache->info, sizeof(cache->info), "%s, not exact since frame %i.", mem_info, cache->last_exact);
+ BLI_snprintf(cache->info, sizeof(cache->info), IFACE_("%s, not exact since frame %i."),
+ mem_info, cache->last_exact);
}
else {
BLI_snprintf(cache->info, sizeof(cache->info), "%s.", mem_info);
@@ -3586,4 +3589,3 @@ void BKE_ptcache_invalidate(PointCache *cache)
cache->last_exact = MIN2(cache->startframe, 0);
}
}
-
diff --git a/source/blender/blenkernel/intern/rigidbody.c b/source/blender/blenkernel/intern/rigidbody.c
index 26f0c25617f..4c6bae122cd 100644
--- a/source/blender/blenkernel/intern/rigidbody.c
+++ b/source/blender/blenkernel/intern/rigidbody.c
@@ -633,8 +633,18 @@ void BKE_rigidbody_validate_sim_constraint(RigidBodyWorld *rbw, Object *ob, shor
else
RB_constraint_set_limits_6dof(rbc->physics_constraint, RB_LIMIT_ANG_Z, 0.0f, -1.0f);
break;
+ case RBC_TYPE_MOTOR:
+ rbc->physics_constraint = RB_constraint_new_motor(loc, rot, rb1, rb2);
+
+ RB_constraint_set_enable_motor(rbc->physics_constraint, rbc->flag & RBC_FLAG_USE_MOTOR_LIN, rbc->flag & RBC_FLAG_USE_MOTOR_ANG);
+ RB_constraint_set_max_impulse_motor(rbc->physics_constraint, rbc->motor_lin_max_impulse, rbc->motor_ang_max_impulse);
+ RB_constraint_set_target_velocity_motor(rbc->physics_constraint, rbc->motor_lin_target_velocity, rbc->motor_ang_target_velocity);
+ break;
}
}
+ else { /* can't create constraint without both rigid bodies */
+ return;
+ }
RB_constraint_set_enabled(rbc->physics_constraint, rbc->flag & RBC_FLAG_ENABLED);
@@ -813,6 +823,11 @@ RigidBodyCon *BKE_rigidbody_create_constraint(Scene *scene, Object *ob, short ty
rbc->spring_stiffness_y = 10.0f;
rbc->spring_stiffness_z = 10.0f;
+ rbc->motor_lin_max_impulse = 1.0f;
+ rbc->motor_lin_target_velocity = 1.0f;
+ rbc->motor_ang_max_impulse = 1.0f;
+ rbc->motor_ang_target_velocity = 1.0f;
+
/* flag cache as outdated */
BKE_rigidbody_cache_reset(rbw);
@@ -1259,7 +1274,7 @@ void BKE_rigidbody_do_simulation(Scene *scene, float ctime)
}
/* advance simulation, we can only step one frame forward */
- if (ctime == rbw->ltime + 1) {
+ if (ctime == rbw->ltime + 1 && !(cache->flag & PTCACHE_BAKED)) {
/* write cache for first frame when on second frame */
if (rbw->ltime == startframe && (cache->flag & PTCACHE_OUTDATED || cache->last_exact == 0)) {
BKE_ptcache_write(&pid, startframe);
@@ -1308,7 +1323,7 @@ struct RigidBodyCon *BKE_rigidbody_create_constraint(Scene *scene, Object *ob, s
struct RigidBodyWorld *BKE_rigidbody_get_world(Scene *scene) { return NULL; }
void BKE_rigidbody_remove_object(Scene *scene, Object *ob) {}
void BKE_rigidbody_remove_constraint(Scene *scene, Object *ob) {}
-void BKE_rigidbody_sync_transforms(Scene *scene, Object *ob, float ctime) {}
+void BKE_rigidbody_sync_transforms(RigidBodyWorld *rbw, Object *ob, float ctime) {}
void BKE_rigidbody_aftertrans_update(Object *ob, float loc[3], float rot[3], float quat[4], float rotAxis[3], float rotAngle) {}
void BKE_rigidbody_cache_reset(RigidBodyWorld *rbw) {}
void BKE_rigidbody_do_simulation(Scene *scene, float ctime) {}
diff --git a/source/blender/blenkernel/intern/sca.c b/source/blender/blenkernel/intern/sca.c
index eb4e0d9c679..6433b73fda0 100644
--- a/source/blender/blenkernel/intern/sca.c
+++ b/source/blender/blenkernel/intern/sca.c
@@ -734,7 +734,7 @@ void sca_move_sensor(bSensor *sens_to_move, Object *ob, int move_up)
}
if (tmp) {
BLI_remlink(&ob->sensors, sens);
- BLI_insertlink(&ob->sensors, tmp, sens);
+ BLI_insertlinkafter(&ob->sensors, tmp, sens);
}
}
}
@@ -778,7 +778,7 @@ void sca_move_controller(bController *cont_to_move, Object *ob, int move_up)
tmp = tmp->next;
}
BLI_remlink(&ob->controllers, cont);
- BLI_insertlink(&ob->controllers, tmp, cont);
+ BLI_insertlinkafter(&ob->controllers, tmp, cont);
}
}
@@ -818,7 +818,7 @@ void sca_move_actuator(bActuator *act_to_move, Object *ob, int move_up)
}
if (tmp) {
BLI_remlink(&ob->actuators, act);
- BLI_insertlink(&ob->actuators, tmp, act);
+ BLI_insertlinkafter(&ob->actuators, tmp, act);
}
}
}
diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c
index 9934d9b6e9a..e1e4563e89f 100644
--- a/source/blender/blenkernel/intern/scene.c
+++ b/source/blender/blenkernel/intern/scene.c
@@ -177,6 +177,7 @@ Scene *BKE_scene_copy(Scene *sce, int type)
scen->obedit = NULL;
scen->stats = NULL;
scen->fps_info = NULL;
+ scen->rigidbody_world = NULL; /* RB_TODO figure out a way of copying the rigid body world */
BLI_duplicatelist(&(scen->markers), &(sce->markers));
BLI_duplicatelist(&(scen->transform_spaces), &(sce->transform_spaces));
@@ -404,7 +405,7 @@ void BKE_scene_free(Scene *sce)
BKE_color_managed_view_settings_free(&sce->view_settings);
}
-static Scene *scene_add(Main *bmain, const char *name)
+Scene *BKE_scene_add(Main *bmain, const char *name)
{
Scene *sce;
ParticleEditSettings *pset;
@@ -639,11 +640,6 @@ static Scene *scene_add(Main *bmain, const char *name)
return sce;
}
-Scene *BKE_scene_add(Main *bmain, const char *name)
-{
- return scene_add(bmain, name);
-}
-
Base *BKE_scene_base_find(Scene *scene, Object *ob)
{
return BLI_findptr(&scene->base, ob, offsetof(Base, object));
@@ -679,12 +675,11 @@ void BKE_scene_set_background(Main *bmain, Scene *scene)
}
/* sort baselist */
- DAG_scene_sort(bmain, scene);
+ DAG_scene_relations_rebuild(bmain, scene);
/* ensure dags are built for sets */
- for (sce = scene->set; sce; sce = sce->set)
- if (sce->theDag == NULL)
- DAG_scene_sort(bmain, sce);
+ for (sce = scene; sce; sce = sce->set)
+ DAG_scene_relations_update(bmain, sce);
/* copy layers and flags from bases to objects */
for (base = scene->base.first; base; base = base->next) {
@@ -1155,7 +1150,7 @@ static void scene_update_tagged_recursive(Main *bmain, Scene *scene, Scene *scen
for (base = scene->base.first; base; base = base->next) {
Object *ob = base->object;
- BKE_object_handle_update_ex(scene_parent, scene->rigidbody_world, ob);
+ BKE_object_handle_update_ex(scene_parent, ob, scene->rigidbody_world);
if (ob->dup_group && (ob->transflag & OB_DUPLIGROUP))
group_handle_recalc_and_update(scene_parent, ob, ob->dup_group);
@@ -1180,9 +1175,15 @@ static void scene_update_tagged_recursive(Main *bmain, Scene *scene, Scene *scen
/* this is called in main loop, doing tagged updates before redraw */
void BKE_scene_update_tagged(Main *bmain, Scene *scene)
{
+ Scene *sce_iter;
+
/* keep this first */
BLI_callback_exec(bmain, &scene->id, BLI_CB_EVT_SCENE_UPDATE_PRE);
+ /* (re-)build dependency graph if needed */
+ for (sce_iter = scene; sce_iter; sce_iter = sce_iter->set)
+ DAG_scene_relations_update(bmain, sce_iter);
+
/* flush recalc flags to dependencies */
DAG_ids_flush_tagged(bmain);
@@ -1233,10 +1234,8 @@ void BKE_scene_update_for_newframe(Main *bmain, Scene *sce, unsigned int lay)
/* clear animation overrides */
/* XXX TODO... */
- for (sce_iter = sce; sce_iter; sce_iter = sce_iter->set) {
- if (sce_iter->theDag == NULL)
- DAG_scene_sort(bmain, sce_iter);
- }
+ for (sce_iter = sce; sce_iter; sce_iter = sce_iter->set)
+ DAG_scene_relations_update(bmain, sce_iter);
/* flush recalc flags to dependencies, if we were only changing a frame
* this would not be necessary, but if a user or a script has modified
diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c
index 45393726add..68618287546 100644
--- a/source/blender/blenkernel/intern/sequencer.c
+++ b/source/blender/blenkernel/intern/sequencer.c
@@ -3955,6 +3955,24 @@ Sequence *BKE_sequence_alloc(ListBase *lb, int cfra, int machine)
return seq;
}
+void BKE_sequence_alpha_mode_from_extension(Sequence *seq)
+{
+ if (seq->strip && seq->strip->stripdata) {
+ char *name = seq->strip->stripdata->name;
+
+ if (BLI_testextensie(name, ".exr") ||
+ BLI_testextensie(name, ".cin") ||
+ BLI_testextensie(name, ".dpx") ||
+ BLI_testextensie(name, ".hdr"))
+ {
+ seq->alpha_mode = IMA_ALPHA_PREMUL;
+ }
+ else {
+ seq->alpha_mode = IMA_ALPHA_STRAIGHT;
+ }
+ }
+}
+
void BKE_sequence_init_colorspace(Sequence *seq)
{
if (seq->strip && seq->strip->stripdata) {
diff --git a/source/blender/blenkernel/intern/text.c b/source/blender/blenkernel/intern/text.c
index 86e7a152a4a..74c0a76f82d 100644
--- a/source/blender/blenkernel/intern/text.c
+++ b/source/blender/blenkernel/intern/text.c
@@ -2938,6 +2938,18 @@ int text_check_identifier_nodigit(const char ch)
return 0;
}
+#ifndef WITH_PYTHON
+int text_check_identifier_unicode(const unsigned int ch)
+{
+ return (ch < 255 && text_check_identifier((char)ch));
+}
+
+int text_check_identifier_nodigit_unicode(const unsigned int ch)
+{
+ return (ch < 255 && text_check_identifier_nodigit((char)ch));
+}
+#endif /* WITH_PYTHON */
+
int text_check_whitespace(const char ch)
{
if (ch == ' ' || ch == '\t' || ch == '\r' || ch == '\n')
diff --git a/source/blender/blenkernel/intern/tracking.c b/source/blender/blenkernel/intern/tracking.c
index 8b81e474e76..1a7458f531c 100644
--- a/source/blender/blenkernel/intern/tracking.c
+++ b/source/blender/blenkernel/intern/tracking.c
@@ -141,8 +141,10 @@ static void tracking_dopesheet_free(MovieTrackingDopesheet *dopesheet)
}
BLI_freelistN(&dopesheet->channels);
+ BLI_freelistN(&dopesheet->coverage_segments);
dopesheet->channels.first = dopesheet->channels.last = NULL;
+ dopesheet->coverage_segments.first = dopesheet->coverage_segments.last = NULL;
dopesheet->tot_channel = 0;
}
@@ -1605,6 +1607,67 @@ ImBuf *BKE_tracking_distort_frame(MovieTracking *tracking, ImBuf *ibuf, int cali
calibration_height, overscan, FALSE);
}
+void BKE_tracking_max_undistortion_delta_across_bound(MovieTracking *tracking, rcti *rect, float delta[2])
+{
+ int a;
+ float pos[2], warped_pos[2];
+ const int coord_delta = 5;
+
+ delta[0] = delta[1] = -FLT_MAX;
+
+ for (a = rect->xmin; a <= rect->xmax + coord_delta; a += coord_delta) {
+ if (a > rect->xmax)
+ a = rect->xmax;
+
+ /* bottom edge */
+ pos[0] = a;
+ pos[1] = rect->ymin;
+
+ BKE_tracking_undistort_v2(tracking, pos, warped_pos);
+
+ delta[0] = max_ff(delta[0], fabs(pos[0] - warped_pos[0]));
+ delta[1] = max_ff(delta[1], fabs(pos[1] - warped_pos[1]));
+
+ /* top edge */
+ pos[0] = a;
+ pos[1] = rect->ymax;
+
+ BKE_tracking_undistort_v2(tracking, pos, warped_pos);
+
+ delta[0] = max_ff(delta[0], fabs(pos[0] - warped_pos[0]));
+ delta[1] = max_ff(delta[1], fabs(pos[1] - warped_pos[1]));
+
+ if (a >= rect->xmax)
+ break;
+ }
+
+ for (a = rect->ymin; a <= rect->ymax + coord_delta; a += coord_delta) {
+ if (a > rect->ymax)
+ a = rect->ymax;
+
+ /* left edge */
+ pos[0] = rect->xmin;
+ pos[1] = a;
+
+ BKE_tracking_undistort_v2(tracking, pos, warped_pos);
+
+ delta[0] = max_ff(delta[0], fabs(pos[0] - warped_pos[0]));
+ delta[1] = max_ff(delta[1], fabs(pos[1] - warped_pos[1]));
+
+ /* right edge */
+ pos[0] = rect->xmax;
+ pos[1] = a;
+
+ BKE_tracking_undistort_v2(tracking, pos, warped_pos);
+
+ delta[0] = max_ff(delta[0], fabs(pos[0] - warped_pos[0]));
+ delta[1] = max_ff(delta[1], fabs(pos[1] - warped_pos[1]));
+
+ if (a >= rect->ymax)
+ break;
+ }
+}
+
/*********************** Image sampling *************************/
static void disable_imbuf_channels(ImBuf *ibuf, MovieTrackingTrack *track, int grayscale)
@@ -3723,6 +3786,88 @@ static void tracking_dopesheet_sort(MovieTracking *tracking, int sort_method, in
}
}
+static int coverage_from_count(int count)
+{
+ if (count < 8)
+ return TRACKING_COVERAGE_BAD;
+ else if (count < 16)
+ return TRACKING_COVERAGE_ACCEPTABLE;
+ return TRACKING_COVERAGE_OK;
+}
+
+static void tracking_dopesheet_calc_coverage(MovieTracking *tracking)
+{
+ MovieTrackingDopesheet *dopesheet = &tracking->dopesheet;
+ MovieTrackingObject *object = BKE_tracking_object_get_active(tracking);
+ ListBase *tracksbase = BKE_tracking_object_get_tracks(tracking, object);
+ MovieTrackingTrack *track;
+ int frames, start_frame = INT_MAX, end_frame = -INT_MAX;
+ int *per_frame_counter;
+ int prev_coverage, last_segment_frame;
+ int i;
+
+ /* find frame boundaries */
+ for (track = tracksbase->first; track; track = track->next) {
+ start_frame = min_ii(start_frame, track->markers[0].framenr);
+ end_frame = max_ii(end_frame, track->markers[track->markersnr - 1].framenr);
+ }
+
+ frames = end_frame - start_frame + 1;
+
+ /* this is a per-frame counter of markers (how many markers belongs to the same frame) */
+ per_frame_counter = MEM_callocN(sizeof(int) * frames, "per frame track counter");
+
+ /* find per-frame markers count */
+ for (track = tracksbase->first; track; track = track->next) {
+ int i;
+
+ for (i = 0; i < track->markersnr; i++) {
+ MovieTrackingMarker *marker = &track->markers[i];
+
+ /* TODO: perhaps we need to add check for non-single-frame track here */
+ if ((marker->flag & MARKER_DISABLED) == 0)
+ per_frame_counter[marker->framenr - start_frame]++;
+ }
+ }
+
+ /* convert markers count to coverage and detect segments with the same coverage */
+ prev_coverage = coverage_from_count(per_frame_counter[0]);
+ last_segment_frame = start_frame;
+
+ /* means only disabled tracks in the beginning, could be ignored */
+ if (!per_frame_counter[0])
+ prev_coverage = TRACKING_COVERAGE_OK;
+
+ for (i = 1; i < frames; i++) {
+ int coverage = coverage_from_count(per_frame_counter[i]);
+
+ /* means only disabled tracks in the end, could be ignored */
+ if (i == frames - 1 && !per_frame_counter[i])
+ coverage = TRACKING_COVERAGE_OK;
+
+ if (coverage != prev_coverage || i == frames - 1) {
+ MovieTrackingDopesheetCoverageSegment *coverage_segment;
+ int end_segment_frame = i - 1 + start_frame;
+
+ if (end_segment_frame == last_segment_frame)
+ end_segment_frame++;
+
+ coverage_segment = MEM_callocN(sizeof(MovieTrackingDopesheetCoverageSegment), "tracking coverage segment");
+ coverage_segment->coverage = prev_coverage;
+ coverage_segment->start_frame = last_segment_frame;
+ coverage_segment->end_frame = end_segment_frame;
+
+ BLI_addtail(&dopesheet->coverage_segments, coverage_segment);
+
+ last_segment_frame = end_segment_frame;
+ }
+
+ prev_coverage = coverage;
+ }
+
+ MEM_freeN(per_frame_counter);
+}
+
void BKE_tracking_dopesheet_tag_update(MovieTracking *tracking)
{
MovieTrackingDopesheet *dopesheet = &tracking->dopesheet;
@@ -3750,6 +3895,7 @@ void BKE_tracking_dopesheet_update(MovieTracking *tracking)
reconstruction = BKE_tracking_object_get_reconstruction(tracking, object);
+ /* channels */
for (track = tracksbase->first; track; track = track->next) {
MovieTrackingDopesheetChannel *channel;
@@ -3777,5 +3923,8 @@ void BKE_tracking_dopesheet_update(MovieTracking *tracking)
tracking_dopesheet_sort(tracking, sort_method, inverse);
+ /* frame coverage */
+ tracking_dopesheet_calc_coverage(tracking);
+
dopesheet->ok = TRUE;
}
diff --git a/source/blender/blenlib/BLI_listbase.h b/source/blender/blenlib/BLI_listbase.h
index d06956e39de..54cd687eeac 100644
--- a/source/blender/blenlib/BLI_listbase.h
+++ b/source/blender/blenlib/BLI_listbase.h
@@ -32,6 +32,7 @@
* \ingroup bli
*/
+#include "BLI_utildefines.h"
#include "DNA_listBase.h"
//struct ListBase;
//struct LinkData;
@@ -40,7 +41,6 @@
extern "C" {
#endif
-void BLI_insertlink(struct ListBase *listbase, void *vprevlink, void *vnewlink);
int BLI_findindex(const struct ListBase *listbase, const void *vlink);
int BLI_findstringindex(const struct ListBase *listbase, const char *id, const int offset);
@@ -59,7 +59,7 @@ void *BLI_rfindptr(const struct ListBase *listbase, const void *ptr, const int o
void BLI_freelistN(struct ListBase *listbase);
void BLI_addtail(struct ListBase *listbase, void *vlink);
void BLI_remlink(struct ListBase *listbase, void *vlink);
-int BLI_remlink_safe(struct ListBase *listbase, void *vlink);
+bool BLI_remlink_safe(struct ListBase *listbase, void *vlink);
void BLI_addhead(struct ListBase *listbase, void *vlink);
void BLI_insertlinkbefore(struct ListBase *listbase, void *vnextlink, void *vnewlink);
diff --git a/source/blender/blenlib/BLI_math_base.h b/source/blender/blenlib/BLI_math_base.h
index 94063c9a40a..aa4e697b48b 100644
--- a/source/blender/blenlib/BLI_math_base.h
+++ b/source/blender/blenlib/BLI_math_base.h
@@ -217,5 +217,26 @@ extern double round(double x);
double double_round(double x, int ndigits);
-#endif /* __BLI_MATH_BASE_H__ */
+/* asserts, some math functions expect normalized inputs
+ * check the vector is unit length, or zero length (which can't be helped in some cases).
+ */
+#ifdef DEBUG
+/* note: 0.0001 is too small becaues normals may be converted from short's: see [#34322] */
+# define BLI_ASSERT_UNIT_EPSILON 0.0002f
+# define BLI_ASSERT_UNIT_V3(v) { \
+ const float _test_unit = len_squared_v3(v); \
+ BLI_assert((fabsf(_test_unit - 1.0f) < BLI_ASSERT_UNIT_EPSILON) || \
+ (fabsf(_test_unit) < BLI_ASSERT_UNIT_EPSILON)); \
+} (void)0
+# define BLI_ASSERT_UNIT_V2(v) { \
+ const float _test_unit = len_squared_v2(v); \
+ BLI_assert((fabsf(_test_unit - 1.0f) < BLI_ASSERT_UNIT_EPSILON) || \
+ (fabsf(_test_unit) < BLI_ASSERT_UNIT_EPSILON)); \
+} (void)0
+#else
+# define BLI_ASSERT_UNIT_V2(v) (void)0
+# define BLI_ASSERT_UNIT_V3(v) (void)0
+#endif
+
+#endif /* __BLI_MATH_BASE_H__ */
diff --git a/source/blender/blenlib/BLI_math_rotation.h b/source/blender/blenlib/BLI_math_rotation.h
index e349a05ac23..5ba37d70ca5 100644
--- a/source/blender/blenlib/BLI_math_rotation.h
+++ b/source/blender/blenlib/BLI_math_rotation.h
@@ -186,6 +186,8 @@ float fov_to_focallength(float fov, float sensor);
float angle_wrap_rad(float angle);
float angle_wrap_deg(float angle);
+float angle_compat_rad(float angle, float angle_compat);
+
int mat3_from_axis_conversion(int from_forward, int from_up, int to_forward, int to_up,
float r_mat[3][3]);
diff --git a/source/blender/blenlib/BLI_scanfill.h b/source/blender/blenlib/BLI_scanfill.h
index 7830c0675b4..ce2c6a4252f 100644
--- a/source/blender/blenlib/BLI_scanfill.h
+++ b/source/blender/blenlib/BLI_scanfill.h
@@ -72,7 +72,8 @@ typedef struct ScanFillVert {
float xy[2]; /* 2D copy of vertex location (using dominant axis) */
unsigned int keyindex; /* original index #, for restoring key information */
short poly_nr;
- unsigned char f, h;
+ unsigned char edge_tot; /* number of edges using this vertex */
+ unsigned char f;
} ScanFillVert;
typedef struct ScanFillEdge {
diff --git a/source/blender/blenlib/BLI_string_utf8.h b/source/blender/blenlib/BLI_string_utf8.h
index ecbc4cb1cd4..30d5c28bf98 100644
--- a/source/blender/blenlib/BLI_string_utf8.h
+++ b/source/blender/blenlib/BLI_string_utf8.h
@@ -41,6 +41,7 @@ int BLI_str_utf8_size_safe(const char *p);
/* copied from glib */
unsigned int BLI_str_utf8_as_unicode(const char *p);
unsigned int BLI_str_utf8_as_unicode_and_size(const char *__restrict p, size_t *__restrict index);
+unsigned int BLI_str_utf8_as_unicode_and_size_safe(const char *__restrict p, size_t *__restrict index);
unsigned int BLI_str_utf8_as_unicode_step(const char *__restrict p, size_t *__restrict index);
size_t BLI_str_utf8_from_unicode(unsigned int c, char *outbuf);
diff --git a/source/blender/blenlib/intern/BLI_heap.c b/source/blender/blenlib/intern/BLI_heap.c
index dcc028630e2..aa54969b6f8 100644
--- a/source/blender/blenlib/intern/BLI_heap.c
+++ b/source/blender/blenlib/intern/BLI_heap.c
@@ -167,7 +167,7 @@ HeapNode *BLI_heap_insert(Heap *heap, float value, void *ptr)
heap->freenodes = (HeapNode *)(((HeapNode *)heap->freenodes)->ptr);
}
else {
- node = (HeapNode *)BLI_memarena_alloc(heap->arena, sizeof *node);
+ node = (HeapNode *)BLI_memarena_alloc(heap->arena, sizeof(*node));
}
node->value = value;
diff --git a/source/blender/blenlib/intern/BLI_mempool.c b/source/blender/blenlib/intern/BLI_mempool.c
index 7670b057a7f..5f0c90f234d 100644
--- a/source/blender/blenlib/intern/BLI_mempool.c
+++ b/source/blender/blenlib/intern/BLI_mempool.c
@@ -54,6 +54,9 @@
#define FREEWORD MAKE_ID('f', 'r', 'e', 'e')
+/* currently totalloc isnt used */
+// #define USE_TOTALLOC
+
typedef struct BLI_freenode {
struct BLI_freenode *next;
int freeword; /* used to identify this as a freed node */
@@ -110,6 +113,7 @@ BLI_mempool *BLI_mempool_create(int esize, int totelem, int pchunk, int flag)
pool->pchunk = pchunk;
pool->csize = esize * pchunk;
pool->chunks.first = pool->chunks.last = NULL;
+ pool->totalloc = 0;
pool->totused = 0;
maxchunks = totelem / pchunk + 1;
@@ -159,10 +163,11 @@ BLI_mempool *BLI_mempool_create(int esize, int totelem, int pchunk, int flag)
}
}
- /* set the end of this chunks memoryy to the new tail for next iteration */
+ /* set the end of this chunks memory to the new tail for next iteration */
lasttail = curnode;
-
+#ifdef USE_TOTALLOC
pool->totalloc += pool->pchunk;
+#endif
}
/* terminate the list */
curnode->next = NULL;
@@ -213,8 +218,9 @@ void *BLI_mempool_alloc(BLI_mempool *pool)
}
}
curnode->next = NULL; /* terminate the list */
-
+#ifdef USE_TOTALLOC
pool->totalloc += pool->pchunk;
+#endif
}
retval = pool->free;
@@ -282,7 +288,9 @@ void BLI_mempool_free(BLI_mempool *pool, void *addr)
}
BLI_addtail(&pool->chunks, first);
+#ifdef USE_TOTALLOC
pool->totalloc = pool->pchunk;
+#endif
pool->free = first->data; /* start of the list */
for (tmpaddr = first->data, i = 0; i < pool->pchunk; i++) {
diff --git a/source/blender/blenlib/intern/listbase.c b/source/blender/blenlib/intern/listbase.c
index c60a9ae6bfc..348efaf40a9 100644
--- a/source/blender/blenlib/intern/listbase.c
+++ b/source/blender/blenlib/intern/listbase.c
@@ -28,9 +28,10 @@
/** \file blender/blenlib/intern/listbase.c
* \ingroup bli
+ *
+ * Manipulations on ListBase structs
*/
-
#include
#include
@@ -41,10 +42,11 @@
#include "BLI_listbase.h"
-
/* implementation */
-/* Ripped this from blender.c */
+/**
+ * moves the entire contents of \a src onto the end of \a dst.
+ */
void BLI_movelisttolist(ListBase *dst, ListBase *src)
{
if (src->first == NULL) return;
@@ -61,6 +63,9 @@ void BLI_movelisttolist(ListBase *dst, ListBase *src)
src->first = src->last = NULL;
}
+/**
+ * Prepends \a vlink (assumed to begin with a Link) onto listbase.
+ */
void BLI_addhead(ListBase *listbase, void *vlink)
{
Link *link = vlink;
@@ -77,6 +82,9 @@ void BLI_addhead(ListBase *listbase, void *vlink)
}
+/**
+ * Appends \a vlink (assumed to begin with a Link) onto listbase.
+ */
void BLI_addtail(ListBase *listbase, void *vlink)
{
Link *link = vlink;
@@ -93,6 +101,9 @@ void BLI_addtail(ListBase *listbase, void *vlink)
}
+/**
+ * Removes \a vlink from \a listbase. Assumes it is linked into there!
+ */
void BLI_remlink(ListBase *listbase, void *vlink)
{
Link *link = vlink;
@@ -107,18 +118,24 @@ void BLI_remlink(ListBase *listbase, void *vlink)
if (listbase->first == link) listbase->first = link->next;
}
-int BLI_remlink_safe(ListBase *listbase, void *vlink)
+/**
+ * Checks that \a vlink is linked into listbase, removing it from there if so.
+ */
+bool BLI_remlink_safe(ListBase *listbase, void *vlink)
{
if (BLI_findindex(listbase, vlink) != -1) {
BLI_remlink(listbase, vlink);
- return 1;
+ return true;
}
else {
- return 0;
+ return false;
}
}
+/**
+ * Removes \a vlink from listbase and disposes of it. Assumes it is linked into there!
+ */
void BLI_freelinkN(ListBase *listbase, void *vlink)
{
Link *link = vlink;
@@ -131,43 +148,11 @@ void BLI_freelinkN(ListBase *listbase, void *vlink)
}
-void BLI_insertlink(ListBase *listbase, void *vprevlink, void *vnewlink)
-{
- Link *prevlink = vprevlink;
- Link *newlink = vnewlink;
-
- /* newlink comes after prevlink */
- if (newlink == NULL) return;
- if (listbase == NULL) return;
-
- /* empty list */
- if (listbase->first == NULL) {
-
- listbase->first = newlink;
- listbase->last = newlink;
- return;
- }
-
- /* insert before first element */
- if (prevlink == NULL) {
- newlink->next = listbase->first;
- newlink->prev = NULL;
- newlink->next->prev = newlink;
- listbase->first = newlink;
- return;
- }
-
- /* at end of list */
- if (listbase->last == prevlink)
- listbase->last = newlink;
-
- newlink->next = prevlink->next;
- prevlink->next = newlink;
- if (newlink->next) newlink->next->prev = newlink;
- newlink->prev = prevlink;
-}
-
-/* This uses insertion sort, so NOT ok for large list */
+/**
+ * Sorts the elements of listbase into the order defined by cmp
+ * (which should return 1 iff its first arg should come after its second arg).
+ * This uses insertion sort, so NOT ok for large list.
+ */
void BLI_sortlist(ListBase *listbase, int (*cmp)(void *, void *))
{
Link *current = NULL;
@@ -193,6 +178,10 @@ void BLI_sortlist(ListBase *listbase, int (*cmp)(void *, void *))
}
}
+/**
+ * Inserts \a vnewlink immediately following \a vprevlink in \a listbase.
+ * Or, if \a vprevlink is NULL, puts \a vnewlink at the front of the list.
+ */
void BLI_insertlinkafter(ListBase *listbase, void *vprevlink, void *vnewlink)
{
Link *prevlink = vprevlink;
@@ -213,21 +202,28 @@ void BLI_insertlinkafter(ListBase *listbase, void *vprevlink, void *vnewlink)
if (prevlink == NULL) {
newlink->prev = NULL;
newlink->next = listbase->first;
- ((Link *)listbase->first)->prev = newlink;
+ newlink->next->prev = newlink;
listbase->first = newlink;
return;
}
/* at end of list */
- if (listbase->last == prevlink)
+ if (listbase->last == prevlink) {
listbase->last = newlink;
+ }
newlink->next = prevlink->next;
newlink->prev = prevlink;
prevlink->next = newlink;
- if (newlink->next) newlink->next->prev = newlink;
+ if (newlink->next) {
+ newlink->next->prev = newlink;
+ }
}
+/**
+ * Inserts \a vnewlink immediately preceding \a vnextlink in listbase.
+ * Or, if \a vnextlink is NULL, puts \a vnewlink at the end of the list.
+ */
void BLI_insertlinkbefore(ListBase *listbase, void *vnextlink, void *vnewlink)
{
Link *nextlink = vnextlink;
@@ -254,16 +250,22 @@ void BLI_insertlinkbefore(ListBase *listbase, void *vnextlink, void *vnewlink)
}
/* at beginning of list */
- if (listbase->first == nextlink)
+ if (listbase->first == nextlink) {
listbase->first = newlink;
+ }
newlink->next = nextlink;
newlink->prev = nextlink->prev;
nextlink->prev = newlink;
- if (newlink->prev) newlink->prev->next = newlink;
+ if (newlink->prev) {
+ newlink->prev->next = newlink;
+ }
}
+/**
+ * Removes and disposes of the entire contents of listbase using direct free(3).
+ */
void BLI_freelist(ListBase *listbase)
{
Link *link, *next;
@@ -282,6 +284,9 @@ void BLI_freelist(ListBase *listbase)
listbase->last = NULL;
}
+/**
+ * Removes and disposes of the entire contents of \a listbase using guardedalloc.
+ */
void BLI_freelistN(ListBase *listbase)
{
Link *link, *next;
@@ -300,6 +305,9 @@ void BLI_freelistN(ListBase *listbase)
}
+/**
+ * Returns the number of elements in \a listbase.
+ */
int BLI_countlist(const ListBase *listbase)
{
Link *link;
@@ -315,6 +323,9 @@ int BLI_countlist(const ListBase *listbase)
return count;
}
+/**
+ * Returns the nth element of \a listbase, numbering from 1.
+ */
void *BLI_findlink(const ListBase *listbase, int number)
{
Link *link = NULL;
@@ -330,6 +341,9 @@ void *BLI_findlink(const ListBase *listbase, int number)
return link;
}
+/**
+ * Returns the nth-last element of \a listbase, numbering from 1.
+ */
void *BLI_rfindlink(const ListBase *listbase, int number)
{
Link *link = NULL;
@@ -345,6 +359,9 @@ void *BLI_rfindlink(const ListBase *listbase, int number)
return link;
}
+/**
+ * Returns the position of \a vlink within \a listbase, numbering from 1, or -1 if not found.
+ */
int BLI_findindex(const ListBase *listbase, const void *vlink)
{
Link *link = NULL;
@@ -365,6 +382,10 @@ int BLI_findindex(const ListBase *listbase, const void *vlink)
return -1;
}
+/**
+ * Finds the first element of \a listbase which contains the null-terminated
+ * string \a id at the specified offset, returning NULL if not found.
+ */
void *BLI_findstring(const ListBase *listbase, const char *id, const int offset)
{
Link *link = NULL;
@@ -383,6 +404,10 @@ void *BLI_findstring(const ListBase *listbase, const char *id, const int offset)
return NULL;
}
/* same as above but find reverse */
+/**
+ * Finds the last element of \a listbase which contains the
+ * null-terminated string \a id at the specified offset, returning NULL if not found.
+ */
void *BLI_rfindstring(const ListBase *listbase, const char *id, const int offset)
{
Link *link = NULL;
@@ -401,6 +426,10 @@ void *BLI_rfindstring(const ListBase *listbase, const char *id, const int offset
return NULL;
}
+/**
+ * Finds the first element of \a listbase which contains a pointer to the
+ * null-terminated string \a id at the specified offset, returning NULL if not found.
+ */
void *BLI_findstring_ptr(const ListBase *listbase, const char *id, const int offset)
{
Link *link = NULL;
@@ -420,6 +449,10 @@ void *BLI_findstring_ptr(const ListBase *listbase, const char *id, const int off
return NULL;
}
/* same as above but find reverse */
+/**
+ * Finds the last element of \a listbase which contains a pointer to the
+ * null-terminated string \a id at the specified offset, returning NULL if not found.
+ */
void *BLI_rfindstring_ptr(const ListBase *listbase, const char *id, const int offset)
{
Link *link = NULL;
@@ -440,6 +473,8 @@ void *BLI_rfindstring_ptr(const ListBase *listbase, const char *id, const int of
}
void *BLI_findptr(const ListBase *listbase, const void *ptr, const int offset)
+/* finds the first element of listbase which contains the specified pointer value
+at the specified offset, returning NULL if not found. */
{
Link *link = NULL;
const void *ptr_iter;
@@ -448,7 +483,7 @@ void *BLI_findptr(const ListBase *listbase, const void *ptr, const int offset)
for (link = listbase->first; link; link = link->next) {
/* exact copy of BLI_findstring(), except for this line */
- ptr_iter = *((const char **)(((const char *)link) + offset));
+ ptr_iter = *((const void **)(((const char *)link) + offset));
if (ptr == ptr_iter) {
return link;
@@ -459,6 +494,8 @@ void *BLI_findptr(const ListBase *listbase, const void *ptr, const int offset)
}
/* same as above but find reverse */
void *BLI_rfindptr(const ListBase *listbase, const void *ptr, const int offset)
+/* finds the last element of listbase which contains the specified pointer value
+at the specified offset, returning NULL if not found. */
{
Link *link = NULL;
const void *ptr_iter;
@@ -467,7 +504,7 @@ void *BLI_rfindptr(const ListBase *listbase, const void *ptr, const int offset)
for (link = listbase->last; link; link = link->prev) {
/* exact copy of BLI_rfindstring(), except for this line */
- ptr_iter = *((const char **)(((const char *)link) + offset));
+ ptr_iter = *((const void **)(((const char *)link) + offset));
if (ptr == ptr_iter) {
return link;
@@ -478,6 +515,8 @@ void *BLI_rfindptr(const ListBase *listbase, const void *ptr, const int offset)
}
int BLI_findstringindex(const ListBase *listbase, const char *id, const int offset)
+/* returns the 1-based index of the first element of listbase which contains the specified
+null-terminated string at the specified offset, or -1 if not found. */
{
Link *link = NULL;
const char *id_iter;
@@ -499,6 +538,7 @@ int BLI_findstringindex(const ListBase *listbase, const char *id, const int offs
}
void BLI_duplicatelist(ListBase *dst, const ListBase *src)
+/* sets dst to a duplicate of the entire contents of src. dst may be the same as src. */
{
struct Link *dst_link, *src_link;
diff --git a/source/blender/blenlib/intern/math_color_inline.c b/source/blender/blenlib/intern/math_color_inline.c
index c24da9fcf80..e9a1c0abc38 100644
--- a/source/blender/blenlib/intern/math_color_inline.c
+++ b/source/blender/blenlib/intern/math_color_inline.c
@@ -174,7 +174,8 @@ MINLINE void srgb_to_linearrgb_uchar4_predivide(float linear[4], const unsigned
}
/* color macros for themes */
-#define rgba_char_args_set_fl(col, r, g, b, a) rgba_char_args_set(col, r * 255, g * 255, b * 255, a * 255)
+#define rgba_char_args_set_fl(col, r, g, b, a) \
+ rgba_char_args_set(col, (r) * 255, (g) * 255, (b) * 255, (a) * 255)
MINLINE void rgba_char_args_set(char col[4], const char r, const char g, const char b, const char a)
{
diff --git a/source/blender/blenlib/intern/math_geom.c b/source/blender/blenlib/intern/math_geom.c
index 810c15437dc..baca7bb8f8a 100644
--- a/source/blender/blenlib/intern/math_geom.c
+++ b/source/blender/blenlib/intern/math_geom.c
@@ -2001,10 +2001,7 @@ bool axis_dominant_v3_to_m3(float r_mat[3][3], const float normal[3])
float angle;
/* double check they are normalized */
-#ifdef DEBUG
- float test;
- BLI_assert(fabsf((test = len_squared_v3(normal)) - 1.0f) < 0.0001f || fabsf(test) < 0.0001f);
-#endif
+ BLI_ASSERT_UNIT_V3(normal);
cross_v3_v3v3(axis, normal, up);
angle = saacos(dot_v3v3(normal, up));
diff --git a/source/blender/blenlib/intern/math_rotation.c b/source/blender/blenlib/intern/math_rotation.c
index c0ea817ae4a..26576b2dcb2 100644
--- a/source/blender/blenlib/intern/math_rotation.c
+++ b/source/blender/blenlib/intern/math_rotation.c
@@ -1740,6 +1740,12 @@ float angle_wrap_deg(float angle)
return mod_inline(angle + 180.0f, 360.0f) - 180.0f;
}
+/* returns an angle compatible with angle_compat */
+float angle_compat_rad(float angle, float angle_compat)
+{
+ return angle + (floorf(((angle_compat - angle) / (float)M_PI) + 0.5f)) * (float)M_PI;
+}
+
/* axis conversion */
static float _axis_convert_matrix[23][3][3] = {
{{-1.0, 0.0, 0.0}, {0.0, -1.0, 0.0}, {0.0, 0.0, 1.0}},
diff --git a/source/blender/blenlib/intern/math_vector.c b/source/blender/blenlib/intern/math_vector.c
index 490ed2a99fb..58d444f5794 100644
--- a/source/blender/blenlib/intern/math_vector.c
+++ b/source/blender/blenlib/intern/math_vector.c
@@ -235,11 +235,8 @@ float angle_signed_v2v2(const float v1[2], const float v2[2])
float angle_normalized_v3v3(const float v1[3], const float v2[3])
{
/* double check they are normalized */
-#ifdef DEBUG
- float test;
- BLI_assert(fabsf((test = len_squared_v3(v1)) - 1.0f) < 0.0001f || fabsf(test) < 0.0001f);
- BLI_assert(fabsf((test = len_squared_v3(v2)) - 1.0f) < 0.0001f || fabsf(test) < 0.0001f);
-#endif
+ BLI_ASSERT_UNIT_V3(v1);
+ BLI_ASSERT_UNIT_V3(v2);
/* this is the same as acos(dot_v3v3(v1, v2)), but more accurate */
if (dot_v3v3(v1, v2) < 0.0f) {
@@ -258,11 +255,8 @@ float angle_normalized_v3v3(const float v1[3], const float v2[3])
float angle_normalized_v2v2(const float v1[2], const float v2[2])
{
/* double check they are normalized */
-#ifdef DEBUG
- float test;
- BLI_assert(fabsf((test = len_squared_v2(v1)) - 1.0f) < 0.0001f || fabsf(test) < 0.0001f);
- BLI_assert(fabsf((test = len_squared_v2(v2)) - 1.0f) < 0.0001f || fabsf(test) < 0.0001f);
-#endif
+ BLI_ASSERT_UNIT_V2(v1);
+ BLI_ASSERT_UNIT_V2(v2);
/* this is the same as acos(dot_v3v3(v1, v2)), but more accurate */
if (dot_v2v2(v1, v2) < 0.0f) {
@@ -449,10 +443,7 @@ void rotate_normalized_v3_v3v3fl(float r[3], const float p[3], const float axis[
const float sintheta = sin(angle);
/* double check they are normalized */
-#ifdef DEBUG
- float test;
- BLI_assert(fabsf((test = len_squared_v3(axis)) - 1.0f) < 0.0001f || fabsf(test) < 0.0001f);
-#endif
+ BLI_ASSERT_UNIT_V3(axis);
r[0] = ((costheta + (1 - costheta) * axis[0] * axis[0]) * p[0]) +
(((1 - costheta) * axis[0] * axis[1] - axis[2] * sintheta) * p[1]) +
diff --git a/source/blender/blenlib/intern/scanfill.c b/source/blender/blenlib/intern/scanfill.c
index 298e37137ce..4d42d71f490 100644
--- a/source/blender/blenlib/intern/scanfill.c
+++ b/source/blender/blenlib/intern/scanfill.c
@@ -95,7 +95,7 @@ typedef struct ScanFillVertLink {
#define SF_EPSILON 0.00003f
-#define SF_VERT_UNKNOWN 1 /* TODO, what is this for exactly? - need to document it! */
+#define SF_VERT_AVAILABLE 1 /* available - in an edge */
#define SF_VERT_ZERO_LEN 255
/* Optionally set ScanFillEdge f to this to mark original boundary edges.
@@ -424,7 +424,7 @@ static void testvertexnearedge(ScanFillContext *sf_ctx)
ScanFillEdge *eed, *ed1;
for (eve = sf_ctx->fillvertbase.first; eve; eve = eve->next) {
- if (eve->h == 1) {
+ if (eve->edge_tot == 1) {
/* find the edge which has vertex eve,
* note: we _know_ this will crash if 'ed1' becomes NULL
* but this will never happen. */
@@ -444,14 +444,14 @@ static void testvertexnearedge(ScanFillContext *sf_ctx)
if (eve != eed->v1 && eve != eed->v2 && eve->poly_nr == eed->poly_nr) {
if (compare_v3v3(eve->co, eed->v1->co, SF_EPSILON)) {
ed1->v2 = eed->v1;
- eed->v1->h++;
- eve->h = 0;
+ eed->v1->edge_tot++;
+ eve->edge_tot = 0;
break;
}
else if (compare_v3v3(eve->co, eed->v2->co, SF_EPSILON)) {
ed1->v2 = eed->v2;
- eed->v2->h++;
- eve->h = 0;
+ eed->v2->edge_tot++;
+ eve->edge_tot = 0;
break;
}
else {
@@ -465,7 +465,7 @@ static void testvertexnearedge(ScanFillContext *sf_ctx)
ed1->f = 0;
ed1->poly_nr = eed->poly_nr;
eed->v1 = eve;
- eve->h = 3;
+ eve->edge_tot = 3;
break;
}
}
@@ -646,14 +646,14 @@ static int scanfill(ScanFillContext *sf_ctx, PolyFill *pf, const int flag)
ed1 = sc->edge_first;
while (ed1) { /* set connectflags */
nexted = ed1->next;
- if (ed1->v1->h == 1 || ed1->v2->h == 1) {
+ if (ed1->v1->edge_tot == 1 || ed1->v2->edge_tot == 1) {
BLI_remlink((ListBase *)&(sc->edge_first), ed1);
BLI_addtail(&sf_ctx->filledgebase, ed1);
- if (ed1->v1->h > 1) ed1->v1->h--;
- if (ed1->v2->h > 1) ed1->v2->h--;
+ if (ed1->v1->edge_tot > 1) ed1->v1->edge_tot--;
+ if (ed1->v2->edge_tot > 1) ed1->v2->edge_tot--;
}
else {
- ed1->v2->f = SF_VERT_UNKNOWN;
+ ed1->v2->f = SF_VERT_AVAILABLE;
}
ed1 = nexted;
@@ -674,8 +674,8 @@ static int scanfill(ScanFillContext *sf_ctx, PolyFill *pf, const int flag)
/* printf("just 1 edge to vert\n"); */
BLI_addtail(&sf_ctx->filledgebase, ed1);
ed1->v2->f = 0;
- ed1->v1->h--;
- ed1->v2->h--;
+ ed1->v1->edge_tot--;
+ ed1->v2->edge_tot--;
}
else {
/* test rest of vertices */
@@ -742,10 +742,10 @@ static int scanfill(ScanFillContext *sf_ctx, PolyFill *pf, const int flag)
ed3 = BLI_scanfill_edge_add(sf_ctx, v2, best_sc->vert);
BLI_remlink(&sf_ctx->filledgebase, ed3);
BLI_insertlinkbefore((ListBase *)&(sc->edge_first), ed2, ed3);
- ed3->v2->f = SF_VERT_UNKNOWN;
+ ed3->v2->f = SF_VERT_AVAILABLE;
ed3->f = SF_EDGE_UNKNOWN;
- ed3->v1->h++;
- ed3->v2->h++;
+ ed3->v1->edge_tot++;
+ ed3->v2->edge_tot++;
}
else {
/* new triangle */
@@ -755,31 +755,31 @@ static int scanfill(ScanFillContext *sf_ctx, PolyFill *pf, const int flag)
BLI_remlink((ListBase *)&(sc->edge_first), ed1);
BLI_addtail(&sf_ctx->filledgebase, ed1);
ed1->v2->f = 0;
- ed1->v1->h--;
- ed1->v2->h--;
+ ed1->v1->edge_tot--;
+ ed1->v2->edge_tot--;
/* ed2 can be removed when it's a boundary edge */
if ((ed2->f == 0 && twoconnected) || (ed2->f == SF_EDGE_BOUNDARY)) {
BLI_remlink((ListBase *)&(sc->edge_first), ed2);
BLI_addtail(&sf_ctx->filledgebase, ed2);
ed2->v2->f = 0;
- ed2->v1->h--;
- ed2->v2->h--;
+ ed2->v1->edge_tot--;
+ ed2->v2->edge_tot--;
}
/* new edge */
ed3 = BLI_scanfill_edge_add(sf_ctx, v1, v3);
BLI_remlink(&sf_ctx->filledgebase, ed3);
ed3->f = SF_EDGE_UNKNOWN;
- ed3->v1->h++;
- ed3->v2->h++;
+ ed3->v1->edge_tot++;
+ ed3->v2->edge_tot++;
/* printf("add new edge %x %x\n", v1, v3); */
sc1 = addedgetoscanlist(sf_ctx, ed3, verts);
if (sc1) { /* ed3 already exists: remove if a boundary */
/* printf("Edge exists\n"); */
- ed3->v1->h--;
- ed3->v2->h--;
+ ed3->v1->edge_tot--;
+ ed3->v2->edge_tot--;
ed3 = sc1->edge_first;
while (ed3) {
@@ -787,8 +787,8 @@ static int scanfill(ScanFillContext *sf_ctx, PolyFill *pf, const int flag)
if (twoconnected || ed3->f == SF_EDGE_BOUNDARY) {
BLI_remlink((ListBase *)&(sc1->edge_first), ed3);
BLI_addtail(&sf_ctx->filledgebase, ed3);
- ed3->v1->h--;
- ed3->v2->h--;
+ ed3->v1->edge_tot--;
+ ed3->v2->edge_tot--;
}
break;
}
@@ -797,19 +797,21 @@ static int scanfill(ScanFillContext *sf_ctx, PolyFill *pf, const int flag)
}
}
}
+
/* test for loose edges */
ed1 = sc->edge_first;
while (ed1) {
nexted = ed1->next;
- if (ed1->v1->h < 2 || ed1->v2->h < 2) {
+ if (ed1->v1->edge_tot < 2 || ed1->v2->edge_tot < 2) {
BLI_remlink((ListBase *)&(sc->edge_first), ed1);
BLI_addtail(&sf_ctx->filledgebase, ed1);
- if (ed1->v1->h > 1) ed1->v1->h--;
- if (ed1->v2->h > 1) ed1->v2->h--;
+ if (ed1->v1->edge_tot > 1) ed1->v1->edge_tot--;
+ if (ed1->v2->edge_tot > 1) ed1->v2->edge_tot--;
}
ed1 = nexted;
}
+ /* done with loose edges */
}
sc++;
@@ -861,7 +863,7 @@ int BLI_scanfill_calc_ex(ScanFillContext *sf_ctx, const int flag, const float no
while (eve) {
eve->f = 0;
eve->poly_nr = 0;
- eve->h = 0;
+ eve->edge_tot = 0;
eve = eve->next;
a += 1;
}
@@ -899,15 +901,15 @@ int BLI_scanfill_calc_ex(ScanFillContext *sf_ctx, const int flag, const float no
eed = sf_ctx->filledgebase.first;
while (eed) {
eed->poly_nr = 0;
- eed->v1->f = SF_VERT_UNKNOWN;
- eed->v2->f = SF_VERT_UNKNOWN;
+ eed->v1->f = SF_VERT_AVAILABLE;
+ eed->v2->f = SF_VERT_AVAILABLE;
eed = eed->next;
}
eve = sf_ctx->fillvertbase.first;
while (eve) {
- if (eve->f & SF_VERT_UNKNOWN) {
+ if (eve->f & SF_VERT_AVAILABLE) {
ok = 1;
break;
}
@@ -1017,8 +1019,8 @@ int BLI_scanfill_calc_ex(ScanFillContext *sf_ctx, const int flag, const float no
/* STEP 2: remove loose edges and strings of edges */
eed = sf_ctx->filledgebase.first;
while (eed) {
- if (eed->v1->h++ > 250) break;
- if (eed->v2->h++ > 250) break;
+ if (eed->v1->edge_tot++ > 250) break;
+ if (eed->v2->edge_tot++ > 250) break;
eed = eed->next;
}
if (eed) {
@@ -1039,14 +1041,14 @@ int BLI_scanfill_calc_ex(ScanFillContext *sf_ctx, const int flag, const float no
while (eed) {
if (toggle & 1) nexted = eed->next;
else nexted = eed->prev;
- if (eed->v1->h == 1) {
- eed->v2->h--;
+ if (eed->v1->edge_tot == 1) {
+ eed->v2->edge_tot--;
BLI_remlink(&sf_ctx->fillvertbase, eed->v1);
BLI_remlink(&sf_ctx->filledgebase, eed);
ok = 1;
}
- else if (eed->v2->h == 1) {
- eed->v1->h--;
+ else if (eed->v2->edge_tot == 1) {
+ eed->v1->edge_tot--;
BLI_remlink(&sf_ctx->fillvertbase, eed->v2);
BLI_remlink(&sf_ctx->filledgebase, eed);
ok = 1;
@@ -1061,13 +1063,13 @@ int BLI_scanfill_calc_ex(ScanFillContext *sf_ctx, const int flag, const float no
/* CURRENT STATUS:
- * - eve->f :1 = available in edges
- * - eve->xs :polynumber
- * - eve->h :amount of edges connected to vertex
- * - eve->tmp.v :store! original vertex number
+ * - eve->f :1 = available in edges
+ * - eve->poly_nr :polynumber
+ * - eve->edge_tot :amount of edges connected to vertex
+ * - eve->tmp.v :store! original vertex number
*
- * - eed->f :1 = boundary edge (optionally set by caller)
- * - eed->poly_nr :poly number
+ * - eed->f :1 = boundary edge (optionally set by caller)
+ * - eed->poly_nr :poly number
*/
@@ -1096,7 +1098,7 @@ int BLI_scanfill_calc_ex(ScanFillContext *sf_ctx, const int flag, const float no
min_xy_p[1] = (min_xy_p[1]) < (eve->xy[1]) ? (min_xy_p[1]) : (eve->xy[1]);
max_xy_p[0] = (max_xy_p[0]) > (eve->xy[0]) ? (max_xy_p[0]) : (eve->xy[0]);
max_xy_p[1] = (max_xy_p[1]) > (eve->xy[1]) ? (max_xy_p[1]) : (eve->xy[1]);
- if (eve->h > 2) pflist[eve->poly_nr - 1].f = 1;
+ if (eve->edge_tot > 2) pflist[eve->poly_nr - 1].f = 1;
eve = eve->next;
}
diff --git a/source/blender/blenlib/intern/string.c b/source/blender/blenlib/intern/string.c
index 28fdf7b61db..3500f3f1805 100644
--- a/source/blender/blenlib/intern/string.c
+++ b/source/blender/blenlib/intern/string.c
@@ -199,12 +199,15 @@ char *BLI_str_quoted_substrN(const char *__restrict str, const char *__restrict
/* get the starting point (i.e. where prefix starts, and add prefixLen+1 to it to get be after the first " */
startMatch = strstr(str, prefix) + prefixLen + 1;
-
- /* get the end point (i.e. where the next occurance of " is after the starting point) */
- endMatch = strchr(startMatch, '"'); /* " NOTE: this comment here is just so that my text editor still shows the functions ok... */
-
- /* return the slice indicated */
- return BLI_strdupn(startMatch, (size_t)(endMatch - startMatch));
+ if (startMatch) {
+ /* get the end point (i.e. where the next occurance of " is after the starting point) */
+ endMatch = strchr(startMatch, '"'); /* " NOTE: this comment here is just so that my text editor still shows the functions ok... */
+
+ if (endMatch)
+ /* return the slice indicated */
+ return BLI_strdupn(startMatch, (size_t)(endMatch - startMatch));
+ }
+ return BLI_strdupn("", 0);
}
/* Replaces all occurrences of oldText with newText in str, returning a new string that doesn't
diff --git a/source/blender/blenlib/intern/string_utf8.c b/source/blender/blenlib/intern/string_utf8.c
index 9e0f9197ca3..26235de4dd2 100644
--- a/source/blender/blenlib/intern/string_utf8.c
+++ b/source/blender/blenlib/intern/string_utf8.c
@@ -369,7 +369,7 @@ size_t BLI_strncpy_wchar_from_utf8(wchar_t *__restrict dst_w, const char *__rest
int BLI_str_utf8_size(const char *p)
{
int mask = 0, len;
- unsigned char c = (unsigned char) *p;
+ const unsigned char c = (unsigned char) *p;
UTF8_COMPUTE (c, mask, len, -1);
@@ -382,7 +382,7 @@ int BLI_str_utf8_size(const char *p)
int BLI_str_utf8_size_safe(const char *p)
{
int mask = 0, len;
- unsigned char c = (unsigned char) *p;
+ const unsigned char c = (unsigned char) *p;
UTF8_COMPUTE (c, mask, len, 1);
@@ -408,10 +408,10 @@ unsigned int BLI_str_utf8_as_unicode(const char *p)
{
int i, mask = 0, len;
unsigned int result;
- unsigned char c = (unsigned char) *p;
+ const unsigned char c = (unsigned char) *p;
UTF8_COMPUTE (c, mask, len, -1);
- if (len == -1)
+ if (UNLIKELY(len == -1))
return BLI_UTF8_ERR;
UTF8_GET (result, p, i, mask, len, BLI_UTF8_ERR);
@@ -423,16 +423,32 @@ unsigned int BLI_str_utf8_as_unicode_and_size(const char *__restrict p, size_t *
{
int i, mask = 0, len;
unsigned int result;
- unsigned char c = (unsigned char) *p;
+ const unsigned char c = (unsigned char) *p;
UTF8_COMPUTE (c, mask, len, -1);
- if (len == -1)
+ if (UNLIKELY(len == -1))
return BLI_UTF8_ERR;
UTF8_GET (result, p, i, mask, len, BLI_UTF8_ERR);
*index += len;
return result;
}
+unsigned int BLI_str_utf8_as_unicode_and_size_safe(const char *__restrict p, size_t *__restrict index)
+{
+ int i, mask = 0, len;
+ unsigned int result;
+ const unsigned char c = (unsigned char) *p;
+
+ UTF8_COMPUTE (c, mask, len, -1);
+ if (UNLIKELY(len == -1)) {
+ *index += 1;
+ return c;
+ }
+ UTF8_GET (result, p, i, mask, len, BLI_UTF8_ERR);
+ *index += len;
+ return result;
+}
+
/* another variant that steps over the index,
* note, currently this also falls back to latin1 for text drawing. */
unsigned int BLI_str_utf8_as_unicode_step(const char *__restrict p, size_t *__restrict index)
@@ -445,7 +461,7 @@ unsigned int BLI_str_utf8_as_unicode_step(const char *__restrict p, size_t *__re
c = (unsigned char) *p;
UTF8_COMPUTE (c, mask, len, -1);
- if (len == -1) {
+ if (UNLIKELY(len == -1)) {
/* when called with NULL end, result will never be NULL,
* checks for a NULL character */
char *p_next = BLI_str_find_next_char_utf8(p, NULL);
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index 7d6ea1be77d..44a73fa14a0 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -41,6 +41,7 @@
#include // for fabs
#include /* for va_start/end */
+#include "BLI_utildefines.h"
#ifndef WIN32
# include // for read close
#else
@@ -120,6 +121,7 @@
#include "BKE_context.h"
#include "BKE_curve.h"
#include "BKE_deform.h"
+#include "BKE_depsgraph.h"
#include "BKE_effect.h"
#include "BKE_fcurve.h"
#include "BKE_global.h" // for G
@@ -831,7 +833,7 @@ static int read_file_dna(FileData *fd)
for (bhead = blo_firstbhead(fd); bhead; bhead = blo_nextbhead(fd, bhead)) {
if (bhead->code == DNA1) {
- int do_endian_swap = (fd->flags & FD_FLAGS_SWITCH_ENDIAN) ? 1 : 0;
+ const bool do_endian_swap = (fd->flags & FD_FLAGS_SWITCH_ENDIAN) != 0;
fd->filesdna = DNA_sdna_from_data(&bhead[1], bhead->len, do_endian_swap);
if (fd->filesdna) {
@@ -954,11 +956,11 @@ static FileData *filedata_new(void)
fd->filedes = -1;
fd->gzfiledes = NULL;
- /* XXX, this doesn't need to be done all the time,
- * but it keeps us re-entrant, remove once we have
- * a lib that provides a nice lock. - zr
- */
- fd->memsdna = DNA_sdna_from_data(DNAstr, DNAlen, 0);
+ /* XXX, this doesn't need to be done all the time,
+ * but it keeps us re-entrant, remove once we have
+ * a lib that provides a nice lock. - zr
+ */
+ fd->memsdna = DNA_sdna_from_data(DNAstr, DNAlen, false);
fd->datamap = oldnewmap_new();
fd->globmap = oldnewmap_new();
@@ -2713,7 +2715,7 @@ static void direct_link_constraints(FileData *fd, ListBase *lb)
}
}
-static void lib_link_pose(FileData *fd, Object *ob, bPose *pose)
+static void lib_link_pose(FileData *fd, Main *bmain, Object *ob, bPose *pose)
{
bPoseChannel *pchan;
bArmature *arm = ob->data;
@@ -2757,7 +2759,7 @@ static void lib_link_pose(FileData *fd, Object *ob, bPose *pose)
}
if (rebuild) {
- ob->recalc = (OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME);
+ DAG_id_tag_update_ex(bmain, &ob->id, OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME);
pose->flag |= POSE_RECALC;
}
}
@@ -4222,7 +4224,7 @@ static void lib_link_object(FileData *fd, Main *main)
/* if id.us==0 a new base will be created later on */
/* WARNING! Also check expand_object(), should reflect the stuff below. */
- lib_link_pose(fd, ob, ob->pose);
+ lib_link_pose(fd, main, ob, ob->pose);
lib_link_constraints(fd, &ob->id, &ob->constraints);
// XXX deprecated - old animation system <<<
@@ -5128,7 +5130,6 @@ static void direct_link_scene(FileData *fd, Scene *sce)
RigidBodyWorld *rbw;
sce->theDag = NULL;
- sce->dagisvalid = 0;
sce->obedit = NULL;
sce->stats = NULL;
sce->fps_info = NULL;
@@ -6476,6 +6477,7 @@ static void direct_link_movieclip(FileData *fd, MovieClip *clip)
clip->tracking.dopesheet.ok = 0;
clip->tracking.dopesheet.channels.first = clip->tracking.dopesheet.channels.last = NULL;
+ clip->tracking.dopesheet.coverage_segments.first = clip->tracking.dopesheet.coverage_segments.last = NULL;
link_list(fd, &tracking->objects);
@@ -8862,8 +8864,12 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
SEQ_BEGIN (scene->ed, seq)
{
- if (seq->flag & SEQ_MAKE_PREMUL)
+ if (seq->flag & SEQ_MAKE_PREMUL) {
seq->alpha_mode = SEQ_ALPHA_STRAIGHT;
+ }
+ else {
+ BKE_sequence_alpha_mode_from_extension(seq);
+ }
}
SEQ_END
@@ -8889,8 +8895,12 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
}
for (image = main->image.first; image; image = image->id.next) {
- if (image->flag & IMA_DO_PREMUL)
+ if (image->flag & IMA_DO_PREMUL) {
image->alpha_mode = IMA_ALPHA_STRAIGHT;
+ }
+ else {
+ BKE_image_alpha_mode_from_extension(image);
+ }
image->flag &= ~IMA_DONE_TAG;
}
@@ -8913,7 +8923,10 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
if (image == blo_do_versions_newlibadr(fd, otex->id.lib, otex->ima))
break;
- if (otex) {
+ /* no duplication if the texture and image datablock are not
+ * from the same .blend file, the image datablock may not have
+ * been loaded from a library file otherwise */
+ if (otex && (tex->id.lib == image->id.lib)) {
/* copy image datablock */
nimage = BKE_image_copy(main, image);
nimage->flag |= IMA_IGNORE_ALPHA|IMA_DONE_TAG;
@@ -10398,7 +10411,7 @@ static void give_base_to_groups(Main *mainvar, Scene *scene)
base = BKE_scene_base_add(scene, ob);
base->flag |= SELECT;
base->object->flag= base->flag;
- ob->recalc |= OB_RECALC_OB|OB_RECALC_DATA|OB_RECALC_TIME;
+ DAG_id_tag_update(&ob->id, OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME);
scene->basact = base;
/* assign the group */
diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c
index 475d96fd709..50e1e229eba 100644
--- a/source/blender/blenloader/intern/writefile.c
+++ b/source/blender/blenloader/intern/writefile.c
@@ -89,6 +89,8 @@
# include "BLI_winstuff.h"
#endif
+#include "BLI_utildefines.h"
+
/* allow writefile to use deprecated functionality (for forward compatibility code) */
#define DNA_DEPRECATED_ALLOW
@@ -201,7 +203,7 @@ static WriteData *writedata_new(int file)
if (wd == NULL) return NULL;
- wd->sdna = DNA_sdna_from_data(DNAstr, DNAlen, 0);
+ wd->sdna = DNA_sdna_from_data(DNAstr, DNAlen, false);
wd->file= file;
diff --git a/source/blender/bmesh/bmesh_class.h b/source/blender/bmesh/bmesh_class.h
index 3dd2e7a6131..384ff341dff 100644
--- a/source/blender/bmesh/bmesh_class.h
+++ b/source/blender/bmesh/bmesh_class.h
@@ -291,6 +291,6 @@ enum {
* but should not error on valid cases */
#define BM_LOOP_RADIAL_MAX 10000
#define BM_NGON_MAX 100000
-#define BM_OMP_LIMIT 0 /* setting zero so we can catch bugs in OpenMP/BMesh */
+#define BM_OMP_LIMIT 10000 /* setting zero so we can catch bugs in OpenMP/BMesh */
#endif /* __BMESH_CLASS_H__ */
diff --git a/source/blender/bmesh/intern/bmesh_opdefines.c b/source/blender/bmesh/intern/bmesh_opdefines.c
index c5eeceb43a3..7e3ee9d249e 100644
--- a/source/blender/bmesh/intern/bmesh_opdefines.c
+++ b/source/blender/bmesh/intern/bmesh_opdefines.c
@@ -1410,18 +1410,6 @@ static BMOpDefine bmo_bevel_def = {
{{"faces.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* output faces */
{{'\0'}},
},
-/* old bevel*/
-// {{"geom", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}}, /* input edges and vertices */
-// {"face_spans", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* new geometry */
-// {"face_holes", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* new geometry */
-// {"use_lengths", BMO_OP_SLOT_BOOL}, /* grab edge lengths from a PROP_FLT customdata layer */
-// {"use_even", BMO_OP_SLOT_BOOL}, /* corner vert placement: use shell/angle calculations */
-// {"use_dist", BMO_OP_SLOT_BOOL}, /* corner vert placement: evaluate percent as a distance,
-// * modifier uses this. We could do this as another float setting */
-// {"lengthlayer", BMO_OP_SLOT_INT}, /* which PROP_FLT layer to us */
-// {"percent", BMO_OP_SLOT_FLT}, /* percentage to expand beveled edge */
-// {{'\0'}},
-// },
bmo_bevel_exec,
BMO_OP_FLAG_UNTAN_MULTIRES
diff --git a/source/blender/bmesh/intern/bmesh_operators.c b/source/blender/bmesh/intern/bmesh_operators.c
index 98958596324..00f8dbe06bf 100644
--- a/source/blender/bmesh/intern/bmesh_operators.c
+++ b/source/blender/bmesh/intern/bmesh_operators.c
@@ -595,13 +595,13 @@ void BMO_mesh_flag_disable_all(BMesh *bm, BMOperator *UNUSED(op), const char hty
const char flag_types[3] = {BM_VERT, BM_EDGE, BM_FACE};
- BMIter iter;
BMElemF *ele;
int i;
#pragma omp parallel for schedule(dynamic) if (bm->totvert + bm->totedge + bm->totface >= BM_OMP_LIMIT)
for (i = 0; i < 3; i++) {
if (htype & flag_types[i]) {
+ BMIter iter;
BM_ITER_MESH (ele, &iter, bm, iter_types[i]) {
BMO_elem_flag_disable(bm, ele, oflag);
}
diff --git a/source/blender/bmesh/intern/bmesh_polygon.c b/source/blender/bmesh/intern/bmesh_polygon.c
index 1aa4d7c5e00..9592c34fc75 100644
--- a/source/blender/bmesh/intern/bmesh_polygon.c
+++ b/source/blender/bmesh/intern/bmesh_polygon.c
@@ -674,7 +674,7 @@ static BMLoop *poly_find_ear(BMFace *f, float (*projectverts)[2], const bool use
i = (((len_squared_v3v3(larr[0]->v->co, larr[2]->v->co) >
len_squared_v3v3(larr[1]->v->co, larr[3]->v->co) * bias)) != use_beauty);
i4 = (i + 3) % 4;
- /* Check produced tris arenât too flat/narrow...
+ /* Check produced tris aren't too flat/narrow...
* Probably not the best test, but is quite efficient and should at least avoid null-area faces! */
cos1 = fabsf(cos_v3v3v3(larr[i4]->v->co, larr[i]->v->co, larr[i + 1]->v->co));
cos2 = fabsf(cos_v3v3v3(larr[i4]->v->co, larr[i + 2]->v->co, larr[i + 1]->v->co));
@@ -741,7 +741,8 @@ static BMLoop *poly_find_ear(BMFace *f, float (*projectverts)[2], const bool use
/* Compare to prev best (i.e. lowest) cos. */
if (cos < bestcos) {
/* We must check this tri would not leave a (too much) degenerated remaining face! */
- /* For now just assume if the average of cos of all "remaining face"'s corners is below a given threshold, itâs OK. */
+ /* For now just assume if the average of cos of all
+ * "remaining face"'s corners is below a given threshold, it's OK. */
float avgcos = fabsf(cos_v3v3v3(v1->co, v3->co, l_iter->next->next->v->co));
const int i_limit = (i - 1 + len) % len;
avgcos += fabsf(cos_v3v3v3(l_iter->prev->prev->v->co, v1->co, v3->co));
diff --git a/source/blender/bmesh/operators/bmo_bevel.c b/source/blender/bmesh/operators/bmo_bevel.c
index c56af821a93..795531d6776 100644
--- a/source/blender/bmesh/operators/bmo_bevel.c
+++ b/source/blender/bmesh/operators/bmo_bevel.c
@@ -55,7 +55,7 @@ void bmo_bevel_exec(BMesh *bm, BMOperator *op)
}
}
- BM_mesh_bevel(bm, offset, seg, vonly);
+ BM_mesh_bevel(bm, offset, seg, vonly, false, NULL, -1);
BMO_slot_buffer_from_enabled_hflag(bm, op, op->slots_out, "faces.out", BM_FACE, BM_ELEM_TAG);
}
diff --git a/source/blender/bmesh/tools/bmesh_bevel.c b/source/blender/bmesh/tools/bmesh_bevel.c
index 1e74354603b..5adef16de14 100644
--- a/source/blender/bmesh/tools/bmesh_bevel.c
+++ b/source/blender/bmesh/tools/bmesh_bevel.c
@@ -30,11 +30,15 @@
#include "MEM_guardedalloc.h"
+#include "DNA_object_types.h"
+#include "DNA_meshdata_types.h"
+
#include "BLI_array.h"
#include "BLI_math.h"
#include "BLI_memarena.h"
#include "BKE_customdata.h"
+#include "BKE_deform.h"
#include "bmesh.h"
#include "./intern/bmesh_private.h"
@@ -104,6 +108,7 @@ typedef struct BevVert {
BMVert *v; /* original mesh vertex */
int edgecount; /* total number of edges around the vertex */
int selcount; /* number of selected edges around the vertex */
+ float offset; /* offset for this vertex, if vertex_only bevel */
EdgeHalf *edges; /* array of size edgecount; CCW order from vertex normal side */
VMesh *vmesh; /* mesh structure for replacing vertex */
} BevVert;
@@ -117,7 +122,10 @@ typedef struct BevelParams {
float offset; /* blender units to offset each side of a beveled edge */
int seg; /* number of segments in beveled edge profile */
- int vertex_only; /* bevel vertices only */
+ bool vertex_only; /* bevel vertices only */
+ bool use_weights; /* bevel amount affected by weights on edges or verts */
+ const struct MDeformVert *dvert; /* vertex group array, maybe set if vertex_only */
+ int vertex_group; /* vertex group index, maybe set if vertex_only */
} BevelParams;
// #pragma GCC diagnostic ignored "-Wpadded"
@@ -665,7 +673,7 @@ static void build_boundary(BevelParams *bp, BevVert *bv)
return;
}
- lastd = bp->vertex_only ? bp->offset : e->offset;
+ lastd = bp->vertex_only? bv->offset : e->offset;
vm->boundstart = NULL;
do {
if (e->is_bev) {
@@ -1722,6 +1730,7 @@ static void bevel_vert_construct(BMesh *bm, BevelParams *bp, BMVert *v)
BMFace *f;
BMIter iter, iter2;
EdgeHalf *e;
+ float weight;
int i, found_shared_face, ccw_test_sum;
int nsel = 0;
int ntot = 0;
@@ -1760,11 +1769,24 @@ static void bevel_vert_construct(BMesh *bm, BevelParams *bp, BMVert *v)
bv->v = v;
bv->edgecount = ntot;
bv->selcount = nsel;
+ bv->offset = bp->offset;
bv->edges = (EdgeHalf *)BLI_memarena_alloc(bp->mem_arena, ntot * sizeof(EdgeHalf));
bv->vmesh = (VMesh *)BLI_memarena_alloc(bp->mem_arena, sizeof(VMesh));
bv->vmesh->seg = bp->seg;
BLI_ghash_insert(bp->vert_hash, v, bv);
+ if (bp->vertex_only) {
+ /* if weighted, modify offset by weight */
+ if (bp->dvert != NULL && bp->vertex_group != -1) {
+ weight = defvert_find_weight(bp->dvert + BM_elem_index_get(v), bp->vertex_group);
+ if (weight <= 0.0f) {
+ BM_elem_flag_disable(v, BM_ELEM_TAG);
+ return;
+ }
+ bv->offset *= weight;
+ }
+ }
+
/* add edges to bv->edges in order that keeps adjacent edges sharing
* a face, if possible */
i = 0;
@@ -1815,7 +1837,16 @@ static void bevel_vert_construct(BMesh *bm, BevelParams *bp, BMVert *v)
e->seg = 0;
}
e->is_rev = (bme->v2 == v);
- e->offset = e->is_bev ? bp->offset : 0.0f;
+ if (e->is_bev) {
+ e->offset = bp->offset;
+ if (bp->use_weights) {
+ weight = BM_elem_float_data_get(&bm->edata, bme, CD_BWEIGHT);
+ e->offset *= weight;
+ }
+ }
+ else {
+ e->offset = 0.0f;
+ }
}
/* find wrap-around shared face */
BM_ITER_ELEM (f, &iter2, bme, BM_FACES_OF_EDGE) {
@@ -2034,7 +2065,9 @@ static void bevel_build_edge_polygons(BMesh *bm, BevelParams *bp, BMEdge *bme)
*
* \warning all tagged edges _must_ be manifold.
*/
-void BM_mesh_bevel(BMesh *bm, const float offset, const float segments, const int vertex_only)
+void BM_mesh_bevel(BMesh *bm, const float offset, const float segments,
+ const bool vertex_only, const bool use_weights,
+ const struct MDeformVert *dvert, const int vertex_group)
{
BMIter iter;
BMVert *v;
@@ -2044,6 +2077,9 @@ void BM_mesh_bevel(BMesh *bm, const float offset, const float segments, const in
bp.offset = offset;
bp.seg = segments;
bp.vertex_only = vertex_only;
+ bp.use_weights = use_weights;
+ bp.dvert = dvert;
+ bp.vertex_group = vertex_group;
if (bp.offset > 0) {
/* primary alloc */
diff --git a/source/blender/bmesh/tools/bmesh_bevel.h b/source/blender/bmesh/tools/bmesh_bevel.h
index d56aa13c984..f214125fa1c 100644
--- a/source/blender/bmesh/tools/bmesh_bevel.h
+++ b/source/blender/bmesh/tools/bmesh_bevel.h
@@ -27,6 +27,10 @@
* \ingroup bmesh
*/
-void BM_mesh_bevel(BMesh *bm, const float offset, const float segments, const int vertex_only);
+struct MDeformVert;
+
+void BM_mesh_bevel(BMesh *bm, const float offset, const float segments,
+ const bool vertex_only, const bool use_weights,
+ const struct MDeformVert *dvert, const int vertex_group);
#endif /* __BMESH_BEVEL_H__ */
diff --git a/source/blender/collada/AnimationImporter.cpp b/source/blender/collada/AnimationImporter.cpp
index 943c4fb574d..60188071832 100644
--- a/source/blender/collada/AnimationImporter.cpp
+++ b/source/blender/collada/AnimationImporter.cpp
@@ -1888,7 +1888,7 @@ Object *AnimationImporter::get_joint_object(COLLADAFW::Node *root, COLLADAFW::No
job->lay = BKE_scene_base_find(scene, job)->lay = 2;
mul_v3_fl(job->size, 0.5f);
- job->recalc |= OB_RECALC_OB;
+ DAG_id_tag_update(&job->id, OB_RECALC_OB);
verify_adt_action((ID *)&job->id, 1);
@@ -1909,14 +1909,14 @@ Object *AnimationImporter::get_joint_object(COLLADAFW::Node *root, COLLADAFW::No
if (par_job) {
job->parent = par_job;
- par_job->recalc |= OB_RECALC_OB;
+ DAG_id_tag_update(&par_job->id, OB_RECALC_OB);
job->parsubstr[0] = 0;
}
BKE_object_where_is_calc(scene, job);
// after parenting and layer change
- DAG_scene_sort(CTX_data_main(C), scene);
+ DAG_relations_tag_update(CTX_data_main(C));
joint_objects[node->getUniqueId()] = job;
}
diff --git a/source/blender/collada/ArmatureExporter.h b/source/blender/collada/ArmatureExporter.h
index 6222496a9f7..931cc5d2988 100644
--- a/source/blender/collada/ArmatureExporter.h
+++ b/source/blender/collada/ArmatureExporter.h
@@ -70,7 +70,6 @@ public:
//void operator()(Object *ob);
private:
- Scene *scene;
UnitConverter converter;
const ExportSettings *export_settings;
diff --git a/source/blender/collada/ArmatureImporter.cpp b/source/blender/collada/ArmatureImporter.cpp
index fefad7dd8ec..c270a1e6b20 100644
--- a/source/blender/collada/ArmatureImporter.cpp
+++ b/source/blender/collada/ArmatureImporter.cpp
@@ -415,10 +415,23 @@ void ArmatureImporter::create_armature_bones(SkinInfo& skin)
break;
}
- if (shared)
+ if (!shared && this->joint_parent_map.size() > 0) {
+ // All armatures have been created while creating the Node tree.
+ // The Collada exporter currently does not create a
+ // strict relationship between geometries and armatures
+ // So when we reimport a Blender collada file, then we have
+ // to guess what is meant.
+ // XXX This is not safe when we have more than one armatures
+ // in the import.
+ shared = this->joint_parent_map.begin()->second;
+ }
+
+ if (shared) {
ob_arm = skin.set_armature(shared);
- else
+ }
+ else {
ob_arm = skin.create_armature(scene); //once for every armature
+ }
// enter armature edit mode
ED_armature_to_edit(ob_arm);
@@ -659,38 +672,44 @@ void ArmatureImporter::make_shape_keys()
//Prereq: all the geometries must be imported and mesh objects must be made
Object *source_ob = this->mesh_importer->get_object_by_geom_uid((*mc)->getSource());
- Mesh *source_me = (Mesh*) source_ob->data;
- //insert key to source mesh
- Key *key = source_me->key = BKE_key_add((ID *)source_me);
- key->type = KEY_RELATIVE;
- KeyBlock *kb;
-
- //insert basis key
- kb = BKE_keyblock_add_ctime(key, "Basis", FALSE);
- BKE_key_convert_from_mesh(source_me, kb);
+ if (source_ob) {
- //insert other shape keys
- for (int i = 0 ; i < morphTargetIds.getCount() ; i++ ) {
- //better to have a seperate map of morph objects,
- //This'll do for now since only mesh morphing is imported
-
- Mesh *me = this->mesh_importer->get_mesh_by_geom_uid(morphTargetIds[i]);
+ Mesh *source_me = (Mesh*) source_ob->data;
+ //insert key to source mesh
+ Key *key = source_me->key = BKE_key_add((ID *)source_me);
+ key->type = KEY_RELATIVE;
+ KeyBlock *kb;
- if (me) {
- me->key = key;
- std::string morph_name = *this->mesh_importer->get_geometry_name(me->id.name);
+ //insert basis key
+ kb = BKE_keyblock_add_ctime(key, "Basis", FALSE);
+ BKE_key_convert_from_mesh(source_me, kb);
- kb = BKE_keyblock_add_ctime(key, morph_name.c_str(), FALSE);
- BKE_key_convert_from_mesh(me, kb);
+ //insert other shape keys
+ for (int i = 0 ; i < morphTargetIds.getCount() ; i++ ) {
+ //better to have a seperate map of morph objects,
+ //This'll do for now since only mesh morphing is imported
+
+ Mesh *me = this->mesh_importer->get_mesh_by_geom_uid(morphTargetIds[i]);
- //apply weights
- weight = morphWeights.getFloatValues()->getData()[i];
- kb->curval = weight;
- }
- else {
- fprintf(stderr, "Morph target geometry not found.\n");
+ if (me) {
+ me->key = key;
+ std::string morph_name = *this->mesh_importer->get_geometry_name(me->id.name);
+
+ kb = BKE_keyblock_add_ctime(key, morph_name.c_str(), FALSE);
+ BKE_key_convert_from_mesh(me, kb);
+
+ //apply weights
+ weight = morphWeights.getFloatValues()->getData()[i];
+ kb->curval = weight;
+ }
+ else {
+ fprintf(stderr, "Morph target geometry not found.\n");
+ }
}
}
+ else {
+ fprintf(stderr, "Morph target object not found.\n");
+ }
}
}
diff --git a/source/blender/collada/DocumentImporter.cpp b/source/blender/collada/DocumentImporter.cpp
index 8af4d0652d9..2b906fa9ac2 100644
--- a/source/blender/collada/DocumentImporter.cpp
+++ b/source/blender/collada/DocumentImporter.cpp
@@ -180,14 +180,16 @@ void DocumentImporter::finish()
{
if (mImportStage != General)
return;
-
+
+ Main *bmain = CTX_data_main(mContext);
+ // TODO: create a new scene except the selected - use current blender scene for it
+ Scene *sce = CTX_data_scene(mContext);
+
/** TODO Break up and put into 2-pass parsing of DAE */
std::vector::iterator it;
for (it = vscenes.begin(); it != vscenes.end(); it++) {
PointerRNA sceneptr, unit_settings;
PropertyRNA *system, *scale;
- // TODO: create a new scene except the selected - use current blender scene for it
- Scene *sce = CTX_data_scene(mContext);
// for scene unit settings: system, scale_length
@@ -228,9 +230,7 @@ void DocumentImporter::finish()
}
// update scene
- Main *bmain = CTX_data_main(mContext);
- DAG_scene_sort(bmain, sce);
- DAG_ids_flush_update(bmain, 0);
+ DAG_relations_tag_update(bmain);
WM_event_add_notifier(mContext, NC_OBJECT | ND_TRANSFORM, NULL);
}
@@ -241,6 +241,7 @@ void DocumentImporter::finish()
armature_importer.set_tags_map(this->uid_tags_map);
armature_importer.make_armatures(mContext);
armature_importer.make_shape_keys();
+ DAG_relations_tag_update(bmain);
#if 0
armature_importer.fix_animation();
@@ -249,8 +250,9 @@ void DocumentImporter::finish()
for (std::vector::iterator it = vscenes.begin(); it != vscenes.end(); it++) {
const COLLADAFW::NodePointerArray& roots = (*it)->getRootNodes();
- for (unsigned int i = 0; i < roots.getCount(); i++)
+ for (unsigned int i = 0; i < roots.getCount(); i++) {
translate_anim_recursive(roots[i], NULL, NULL);
+ }
}
if (libnode_ob.size()) {
@@ -273,8 +275,7 @@ void DocumentImporter::finish()
}
libnode_ob.clear();
- DAG_scene_sort(CTX_data_main(mContext), sce);
- DAG_ids_flush_update(CTX_data_main(mContext), 0);
+ DAG_relations_tag_update(bmain);
}
}
@@ -309,13 +310,22 @@ void DocumentImporter::translate_anim_recursive(COLLADAFW::Node *node, COLLADAFW
#endif
unsigned int i;
+
//for (i = 0; i < 4; i++)
// ob =
anim_importer.translate_Animations(node, root_map, object_map, FW_object_map);
- COLLADAFW::NodePointerArray &children = node->getChildNodes();
- for (i = 0; i < children.getCount(); i++) {
- translate_anim_recursive(children[i], node, NULL);
+ if (node->getType() == COLLADAFW::Node::JOINT && par == NULL) {
+ // For Skeletons without root node we have to simulate the
+ // root node here and recursively enter the same function
+ // XXX: maybe this can be made more elegant.
+ translate_anim_recursive(node, node, parob);
+ }
+ else {
+ COLLADAFW::NodePointerArray &children = node->getChildNodes();
+ for (i = 0; i < children.getCount(); i++) {
+ translate_anim_recursive(children[i], node, NULL);
+ }
}
}
@@ -376,7 +386,7 @@ Object *DocumentImporter::create_instance_node(Object *source_ob, COLLADAFW::Nod
fprintf(stderr, "create under node id=%s from node id=%s\n", instance_node ? instance_node->getOriginalId().c_str() : NULL, source_node ? source_node->getOriginalId().c_str() : NULL);
Object *obn = BKE_object_copy(source_ob);
- obn->recalc |= OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME;
+ DAG_id_tag_update(&obn->id, OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME);
BKE_scene_base_add(sce, obn);
if (instance_node) {
@@ -403,8 +413,7 @@ Object *DocumentImporter::create_instance_node(Object *source_ob, COLLADAFW::Nod
anim_importer.read_node_transform(source_node, obn);
}
- /*DAG_scene_sort(CTX_data_main(mContext), sce);
- DAG_ids_flush_update(CTX_data_main(mContext), 0);*/
+ /*DAG_relations_tag_update(CTX_data_main(mContext));*/
COLLADAFW::NodePointerArray &children = source_node->getChildNodes();
if (children.getCount()) {
@@ -462,7 +471,21 @@ std::vector