Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Wilkins <Jason.A.Wilkins@gmail.com>2014-07-01 11:49:38 +0400
committerJason Wilkins <Jason.A.Wilkins@gmail.com>2014-07-01 11:49:38 +0400
commit1ead782e3c1a37112824674135ae3ad76298821d (patch)
tree8ca7b1c1b2ad15d07eb20c61655f716a7c98e73c
parent6741f8e7a0a35ac3df2f2cb71e6598dc13091b21 (diff)
parentf004893e492cbe29c308c726ab06ae7342d7c6c7 (diff)
Merge branch 'master' of git.blender.org:blender into soc-2014-viewport_fx
-rw-r--r--CMakeLists.txt32
-rw-r--r--SConstruct20
-rwxr-xr-xbuild_files/build_environment/install_deps.sh81
-rw-r--r--extern/libmv/CMakeLists.txt2
-rw-r--r--extern/libmv/third_party/ceres/SConscript2
-rwxr-xr-xextern/libmv/third_party/ceres/bundle.sh2
-rw-r--r--extern/xdnd/CMakeLists.txt2
-rw-r--r--intern/cycles/CMakeLists.txt5
-rw-r--r--intern/cycles/cmake/external_libs.cmake5
-rw-r--r--intern/cycles/kernel/CMakeLists.txt3
-rw-r--r--intern/cycles/kernel/kernel_shadow.h11
-rw-r--r--intern/cycles/render/mesh.cpp2
-rw-r--r--intern/elbeem/CMakeLists.txt2
-rw-r--r--intern/ghost/intern/GHOST_WindowWin32.cpp19
-rw-r--r--intern/smoke/CMakeLists.txt2
-rw-r--r--release/scripts/modules/bl_i18n_utils/utils_spell_check.py2
-rw-r--r--release/scripts/startup/bl_ui/properties_data_lamp.py2
-rw-r--r--release/scripts/startup/bl_ui/properties_render.py4
-rw-r--r--release/scripts/startup/bl_ui/space_image.py2
-rw-r--r--release/scripts/startup/bl_ui/space_userpref.py2
-rw-r--r--source/blender/blenkernel/intern/blender.c33
-rw-r--r--source/blender/blenkernel/intern/bpath.c3
-rw-r--r--source/blender/blenkernel/intern/cdderivedmesh.c18
-rw-r--r--source/blender/blenkernel/intern/particle.c3
-rw-r--r--source/blender/blenkernel/intern/sequencer.c2
-rw-r--r--source/blender/blenlib/BLI_stack.h27
-rw-r--r--source/blender/blenlib/BLI_stackdefines.h39
-rw-r--r--source/blender/blenlib/CMakeLists.txt1
-rw-r--r--source/blender/blenlib/intern/stack.c177
-rw-r--r--source/blender/bmesh/intern/bmesh_core.c4
-rw-r--r--source/blender/bmesh/intern/bmesh_queries.c8
-rw-r--r--source/blender/bmesh/operators/bmo_bisect_plane.c2
-rw-r--r--source/blender/bmesh/operators/bmo_connect.c4
-rw-r--r--source/blender/bmesh/operators/bmo_dissolve.c25
-rw-r--r--source/blender/bmesh/operators/bmo_removedoubles.c4
-rw-r--r--source/blender/bmesh/operators/bmo_subdivide_edgering.c4
-rw-r--r--source/blender/bmesh/tools/bmesh_bisect_plane.c4
-rw-r--r--source/blender/collada/EffectExporter.cpp4
-rw-r--r--source/blender/compositor/operations/COM_RenderLayersProg.cpp20
-rw-r--r--source/blender/compositor/operations/COM_WrapOperation.cpp13
-rw-r--r--source/blender/datatoc/CMakeLists.txt2
-rw-r--r--source/blender/editors/animation/anim_markers.c2
-rw-r--r--source/blender/editors/include/BIF_glutil.h2
-rw-r--r--source/blender/editors/include/ED_numinput.h2
-rw-r--r--source/blender/editors/include/ED_view3d.h7
-rw-r--r--source/blender/editors/include/UI_interface.h3
-rw-r--r--source/blender/editors/interface/interface_draw.c4
-rw-r--r--source/blender/editors/interface/interface_regions.c18
-rw-r--r--source/blender/editors/interface/interface_templates.c45
-rw-r--r--source/blender/editors/mesh/editmesh_bevel.c3
-rw-r--r--source/blender/editors/mesh/editmesh_inset.c3
-rw-r--r--source/blender/editors/mesh/editmesh_loopcut.c3
-rw-r--r--source/blender/editors/object/object_relations.c1
-rw-r--r--source/blender/editors/screen/glutil.c39
-rw-r--r--source/blender/editors/space_console/space_console.c13
-rw-r--r--source/blender/editors/space_graph/graph_draw.c11
-rw-r--r--source/blender/editors/space_image/image_draw.c34
-rw-r--r--source/blender/editors/space_image/image_intern.h2
-rw-r--r--source/blender/editors/space_image/image_ops.c32
-rw-r--r--source/blender/editors/space_image/space_image.c3
-rw-r--r--source/blender/editors/space_node/drawnode.c31
-rw-r--r--source/blender/editors/space_node/node_edit.c35
-rw-r--r--source/blender/editors/space_node/node_intern.h1
-rw-r--r--source/blender/editors/space_node/node_ops.c2
-rw-r--r--source/blender/editors/space_view3d/drawobject.c21
-rw-r--r--source/blender/editors/space_view3d/view3d_camera_control.c24
-rw-r--r--source/blender/editors/space_view3d/view3d_edit.c84
-rw-r--r--source/blender/editors/space_view3d/view3d_ops.c4
-rw-r--r--source/blender/editors/transform/transform.c48
-rw-r--r--source/blender/editors/util/numinput.c19
-rw-r--r--source/blender/freestyle/intern/blender_interface/BlenderFileLoader.cpp4
-rw-r--r--source/blender/freestyle/intern/python/Director.cpp18
-rw-r--r--source/blender/freestyle/intern/winged_edge/WEdge.h4
-rw-r--r--source/blender/gpu/GPU_material.h1
-rw-r--r--source/blender/gpu/intern/gpu_material.c5
-rw-r--r--source/blender/imbuf/CMakeLists.txt2
-rw-r--r--source/blender/imbuf/intern/png.c23
-rw-r--r--source/blender/makesdna/DNA_scene_types.h1
-rw-r--r--source/blender/makesdna/DNA_userdef_types.h2
-rw-r--r--source/blender/makesrna/intern/rna_actuator.c28
-rw-r--r--source/blender/makesrna/intern/rna_nodetree.c24
-rw-r--r--source/blender/makesrna/intern/rna_scene.c8
-rw-r--r--source/blender/makesrna/intern/rna_ui_api.c1
-rw-r--r--source/blender/makesrna/intern/rna_userdef.c4
-rw-r--r--source/blender/modifiers/intern/MOD_laplaciandeform.c3
-rw-r--r--source/blender/modifiers/intern/MOD_skin.c2
-rw-r--r--source/blender/modifiers/intern/MOD_solidify.c4
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_normal.c7
-rw-r--r--source/blender/python/generic/py_capi_utils.c6
-rw-r--r--source/blender/python/intern/bpy_interface.c34
-rw-r--r--source/blender/python/intern/bpy_rna.c2
-rw-r--r--source/blender/python/mathutils/mathutils_kdtree.c4
-rw-r--r--source/blender/render/intern/include/render_result.h7
-rw-r--r--source/blender/render/intern/source/external_engine.c6
-rw-r--r--source/blender/render/intern/source/pipeline.c19
-rw-r--r--source/blender/render/intern/source/render_result.c70
-rw-r--r--source/blenderplayer/bad_level_call_stubs/stubs.c2
-rw-r--r--source/gameengine/Converter/BL_ArmatureObject.cpp4
-rw-r--r--source/gameengine/GamePlayer/common/CMakeLists.txt2
-rw-r--r--source/gameengine/Ketsji/KX_PythonInit.cpp8
-rw-r--r--tests/gtests/blenlib/BLI_stack_test.cc137
-rw-r--r--tests/gtests/blenlib/CMakeLists.txt3
-rw-r--r--tests/gtests/bmesh/CMakeLists.txt2
-rw-r--r--tests/gtests/guardedalloc/CMakeLists.txt2
-rw-r--r--tests/gtests/testing/CMakeLists.txt4
105 files changed, 1094 insertions, 454 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 853c13fa256..956d6761591 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1125,7 +1125,7 @@ elseif(WIN32)
message(WARNING "Using HARDCODED libpng locations")
set(PNG_LIBRARIES libpng)
set(PNG "${LIBDIR}/png")
- set(PNG_INCLUDE_DIR "${PNG}/include")
+ set(PNG_INCLUDE_DIRS "${PNG}/include")
set(PNG_LIBPATH ${PNG}/lib) # not cmake defined
endif()
@@ -1401,7 +1401,7 @@ elseif(WIN32)
add_definitions(-DFREE_WINDOWS)
set(PNG "${LIBDIR}/png")
- set(PNG_INCLUDE_DIR "${PNG}/include")
+ set(PNG_INCLUDE_DIRS "${PNG}/include")
set(PNG_LIBPATH ${PNG}/lib) # not cmake defined
if(WITH_MINGW64)
@@ -1821,7 +1821,7 @@ elseif(APPLE)
endif()
set(PNG "${LIBDIR}/png")
- set(PNG_INCLUDE_DIR "${PNG}/include")
+ set(PNG_INCLUDE_DIRS "${PNG}/include")
set(PNG_LIBPATH ${PNG}/lib)
set(JPEG "${LIBDIR}/jpeg")
@@ -1927,16 +1927,22 @@ elseif(APPLE)
endif()
endif()
- if(WITH_OPENMP AND CMAKE_C_COMPILER_ID MATCHES "Clang" AND NOT ${CMAKE_C_COMPILER_VERSION} VERSION_LESS '3.4')
- set(OPENMP_FOUND ON)
- set(OpenMP_C_FLAGS "-fopenmp" CACHE STRING "C compiler flags for OpenMP parallization" FORCE)
- set(OpenMP_CXX_FLAGS "-fopenmp" CACHE STRING "C++ compiler flags for OpenMP parallization" FORCE)
- include_directories(${LIBDIR}/openmp/include)
- LINK_DIRECTORIES(${LIBDIR}/openmp/lib)
- execute_process(COMMAND ditto -arch ${CMAKE_OSX_ARCHITECTURES} ${LIBDIR}/openmp/lib/libiomp5.dylib ${CMAKE_BINARY_DIR}/bin/libiomp5.dylib) # for intermediate binaries, lib id is @loader_path
- else()
- set(OpenMP_C_FLAGS "" CACHE STRING "C compiler flags for OpenMP parallization" FORCE) # unset
- set(OpenMP_CXX_FLAGS "" CACHE STRING "C++ compiler flags for OpenMP parallization" FORCE) # unset
+ if(WITH_OPENMP)
+ execute_process(COMMAND ${CMAKE_C_COMPILER} --version OUTPUT_VARIABLE COMPILER_VENDOR)
+ string(SUBSTRING "${COMPILER_VENDOR}" 0 5 VENDOR_NAME) # truncate output
+ if(${VENDOR_NAME} MATCHES "Apple") # Apple does not support OpenMP yet
+ set(WITH_OPENMP OFF)
+ else() # vanilla gcc or clang_omp support OpenMP
+ message(STATUS "Using special OpenMP enabled compiler !")
+ set(OPENMP_FOUND ON)
+ set(OpenMP_C_FLAGS "-fopenmp" CACHE STRING "C compiler flags for OpenMP parallization" FORCE)
+ set(OpenMP_CXX_FLAGS "-fopenmp" CACHE STRING "C++ compiler flags for OpenMP parallization" FORCE)
+ include_directories(${LIBDIR}/openmp/include)
+ link_directories(${LIBDIR}/openmp/lib)
+ # This is a workaround for our helperbinaries ( datatoc, masgfmt, ... ),
+ # They are linked also to omp lib, so we need it in builddir for runtime exexcution, TODO: remove all unneeded dependencies from these
+ execute_process(COMMAND ditto -arch ${CMAKE_OSX_ARCHITECTURES} ${LIBDIR}/openmp/lib/libiomp5.dylib ${CMAKE_BINARY_DIR}/bin/libiomp5.dylib) # for intermediate binaries, lib id is @loader_path
+ endif()
endif()
set(EXETYPE MACOSX_BUNDLE)
diff --git a/SConstruct b/SConstruct
index bdb9b3a8bfb..134970dfdc3 100644
--- a/SConstruct
+++ b/SConstruct
@@ -178,16 +178,6 @@ if crossbuild and platform not in ('win32-vc', 'win64-vc'):
env['OURPLATFORM'] = platform
-# Put all auto configuration run-time tests here
-
-from FindSharedPtr import FindSharedPtr
-from FindUnorderedMap import FindUnorderedMap
-
-conf = Configure(env)
-FindSharedPtr(conf)
-FindUnorderedMap(conf)
-env = conf.Finish()
-
configfile = os.path.join("build_files", "scons", "config", platform + "-config.py")
if os.path.exists(configfile):
@@ -605,6 +595,16 @@ if not os.path.isdir ( B.root_build_dir):
# if not os.path.isdir(B.doc_build_dir) and env['WITH_BF_DOCS']:
# os.makedirs ( B.doc_build_dir )
+# Put all auto configuration run-time tests here
+
+from FindSharedPtr import FindSharedPtr
+from FindUnorderedMap import FindUnorderedMap
+
+conf = Configure(env)
+FindSharedPtr(conf)
+FindUnorderedMap(conf)
+env = conf.Finish()
+
###################################
# Ensure all data files are valid #
###################################
diff --git a/build_files/build_environment/install_deps.sh b/build_files/build_environment/install_deps.sh
index 4fa7946bb8b..d13a1e71d62 100755
--- a/build_files/build_environment/install_deps.sh
+++ b/build_files/build_environment/install_deps.sh
@@ -478,35 +478,56 @@ fi
# This has to be done here, because user might force some versions...
-PYTHON_SOURCE="http://python.org/ftp/python/$PYTHON_VERSION/Python-$PYTHON_VERSION.tgz"
-NUMPY_SOURCE="http://sourceforge.net/projects/numpy/files/NumPy/$NUMPY_VERSION/numpy-$NUMPY_VERSION.tar.gz"
+PYTHON_SOURCE=( "http://python.org/ftp/python/$PYTHON_VERSION/Python-$PYTHON_VERSION.tgz" )
+NUMPY_SOURCE=( "http://sourceforge.net/projects/numpy/files/NumPy/$NUMPY_VERSION/numpy-$NUMPY_VERSION.tar.gz" )
_boost_version_nodots=`echo "$BOOST_VERSION" | sed -r 's/\./_/g'`
-BOOST_SOURCE="http://sourceforge.net/projects/boost/files/boost/$BOOST_VERSION/boost_$_boost_version_nodots.tar.bz2/download"
+BOOST_SOURCE=( "http://sourceforge.net/projects/boost/files/boost/$BOOST_VERSION/boost_$_boost_version_nodots.tar.bz2/download" )
-OCIO_SOURCE="https://github.com/imageworks/OpenColorIO/tarball/v$OCIO_VERSION"
-#OPENEXR_SOURCE="http://download.savannah.nongnu.org/releases/openexr/openexr-$OPENEXR_VERSION.tar.gz"
-OPENEXR_SOURCE="https://github.com/mont29/openexr.git"
+OCIO_SOURCE=( "https://github.com/imageworks/OpenColorIO/tarball/v$OCIO_VERSION" )
+#OPENEXR_SOURCE=( "http://download.savannah.nongnu.org/releases/openexr/openexr-$OPENEXR_VERSION.tar.gz" )
+OPENEXR_SOURCE=( "https://github.com/mont29/openexr.git" )
OPENEXR_REPO_UID="2787aa1cf652d244ed45ae124eb1553f6cff11ee"
-ILMBASE_SOURCE="http://download.savannah.nongnu.org/releases/openexr/ilmbase-$ILMBASE_VERSION.tar.gz"
+ILMBASE_SOURCE=( "http://download.savannah.nongnu.org/releases/openexr/ilmbase-$ILMBASE_VERSION.tar.gz" )
-#OIIO_SOURCE="https://github.com/OpenImageIO/oiio/archive/Release-$OIIO_VERSION.tar.gz"
-OIIO_SOURCE="https://github.com/mont29/oiio.git"
+#OIIO_SOURCE=( "https://github.com/OpenImageIO/oiio/archive/Release-$OIIO_VERSION.tar.gz" )
+OIIO_SOURCE=( "https://github.com/mont29/oiio.git" )
OIIO_REPO_UID="99113d12619c90cf44721195a759674ea61f02b1"
-LLVM_SOURCE="http://llvm.org/releases/$LLVM_VERSION/llvm-$LLVM_VERSION.src.tar.gz"
-LLVM_CLANG_SOURCE="http://llvm.org/releases/$LLVM_VERSION/clang-$LLVM_VERSION.src.tar.gz"
-#OSL_SOURCE="https://github.com/imageworks/OpenShadingLanguage/archive/Release-$OSL_VERSION.tar.gz"
-#OSL_SOURCE="https://github.com/mont29/OpenShadingLanguage.git"
-OSL_SOURCE="https://github.com/imageworks/OpenShadingLanguage.git"
+LLVM_SOURCE=( "http://llvm.org/releases/$LLVM_VERSION/llvm-$LLVM_VERSION.src.tar.gz" )
+LLVM_CLANG_SOURCE=( "http://llvm.org/releases/$LLVM_VERSION/clang-$LLVM_VERSION.src.tar.gz" "http://llvm.org/releases/$LLVM_VERSION/cfe-$LLVM_VERSION.src.tar.gz" )
+#OSL_SOURCE=( "https://github.com/imageworks/OpenShadingLanguage/archive/Release-$OSL_VERSION.tar.gz" )
+#OSL_SOURCE=( "https://github.com/mont29/OpenShadingLanguage.git" )
+OSL_SOURCE=( "https://github.com/imageworks/OpenShadingLanguage.git" )
OSL_REPO_UID="4abd672ed3979e5e965323201a5ba5ab802a76a9"
-OPENCOLLADA_SOURCE="https://github.com/KhronosGroup/OpenCOLLADA.git"
+OPENCOLLADA_SOURCE=( "https://github.com/KhronosGroup/OpenCOLLADA.git" )
OPENCOLLADA_REPO_UID="18da7f4109a8eafaa290a33f5550501cc4c8bae8"
-FFMPEG_SOURCE="http://ffmpeg.org/releases/ffmpeg-$FFMPEG_VERSION.tar.bz2"
+FFMPEG_SOURCE=( "http://ffmpeg.org/releases/ffmpeg-$FFMPEG_VERSION.tar.bz2" )
##### Generic Helpers #####
+# Check return code of wget for success...
+download() {
+ declare -a sources=("${!1}")
+ sources_count=${#sources[@]}
+ error=1
+
+ for (( i=0; $i < $sources_count; i++ ))
+ do
+ wget -c ${sources[$i]} -O $2
+ if [ $? -eq 0 ]; then
+ error=0
+ break
+ fi
+ done
+
+ if [ $error -eq 1 ]; then
+ ERROR "wget could not find $1, or could not write it to $2, exiting"
+ exit 1
+ fi
+}
+
# Return 0 if $1 = $2 (i.e. 1.01.0 = 1.1, but 1.1.1 != 1.1), else 1.
# $1 and $2 should be version numbers made of numbers only.
version_eq() {
@@ -684,7 +705,7 @@ compile_Python() {
if [ ! -d $_src ]; then
mkdir -p $SRC
- wget -c $PYTHON_SOURCE -O $_src.tgz
+ download PYTHON_SOURCE[@] $_src.tgz
INFO "Unpacking Python-$PYTHON_VERSION"
tar -C $SRC -xf $_src.tgz
@@ -749,7 +770,7 @@ compile_Numpy() {
if [ ! -d $_src ]; then
mkdir -p $SRC
- wget -c $NUMPY_SOURCE -O $_src.tar.gz
+ download NUMPY_SOURCE[@] $_src.tar.gz
INFO "Unpacking Numpy-$NUMPY_VERSION"
tar -C $SRC -xf $_src.tar.gz
@@ -815,7 +836,7 @@ compile_Boost() {
if [ ! -d $_src ]; then
INFO "Downloading Boost-$BOOST_VERSION"
mkdir -p $SRC
- wget -c $BOOST_SOURCE -O $_src.tar.bz2
+ download BOOST_SOURCE[@] $_src.tar.bz2
tar -C $SRC --transform "s,(.*/?)boost_1_[^/]+(.*),\1boost-$BOOST_VERSION\2,x" -xf $_src.tar.bz2
fi
@@ -879,7 +900,7 @@ compile_OCIO() {
if [ ! -d $_src ]; then
INFO "Downloading OpenColorIO-$OCIO_VERSION"
mkdir -p $SRC
- wget -c $OCIO_SOURCE -O $_src.tar.gz
+ download OCIO_SOURCE[@] $_src.tar.gz
INFO "Unpacking OpenColorIO-$OCIO_VERSION"
tar -C $SRC --transform "s,(.*/?)imageworks-OpenColorIO[^/]*(.*),\1OpenColorIO-$OCIO_VERSION\2,x" \
@@ -975,7 +996,7 @@ compile_ILMBASE() {
if [ ! -d $_src ]; then
INFO "Downloading ILMBase-$ILMBASE_VERSION"
mkdir -p $SRC
- wget -c $ILMBASE_SOURCE -O $_src.tar.gz
+ download ILMBASE_SOURCE[@] $_src.tar.gz
INFO "Unpacking ILMBase-$ILMBASE_VERSION"
tar -C $SRC --transform "s,(.*/?)ilmbase-[^/]*(.*),\1ILMBase-$ILMBASE_VERSION\2,x" \
@@ -1067,13 +1088,13 @@ compile_OPENEXR() {
INFO "Downloading OpenEXR-$OPENEXR_VERSION"
mkdir -p $SRC
-# wget -c $OPENEXR_SOURCE -O $_src.tar.gz
+# download OPENEXR_SOURCE[@] $_src.tar.gz
# INFO "Unpacking OpenEXR-$OPENEXR_VERSION"
# tar -C $SRC --transform "s,(.*/?)openexr[^/]*(.*),\1OpenEXR-$OPENEXR_VERSION\2,x" \
# -xf $_src.tar.gz
- git clone $OPENEXR_SOURCE $_src
+ git clone ${OPENEXR_SOURCE[0]} $_src
fi
@@ -1169,13 +1190,13 @@ compile_OIIO() {
if [ ! -d $_src ]; then
mkdir -p $SRC
-# wget -c $OIIO_SOURCE -O "$_src.tar.gz"
+# download OIIO_SOURCE[@] "$_src.tar.gz"
# INFO "Unpacking OpenImageIO-$OIIO_VERSION"
# tar -C $SRC --transform "s,(.*/?)oiio-Release-[^/]*(.*),\1OpenImageIO-$OIIO_VERSION\2,x" \
# -xf $_src.tar.gz
- git clone $OIIO_SOURCE $_src
+ git clone ${OIIO_SOURCE[0]} $_src
fi
@@ -1292,8 +1313,8 @@ compile_LLVM() {
if [ ! -d $_src -o true ]; then
mkdir -p $SRC
- wget -c $LLVM_SOURCE -O "$_src.tar.gz"
- wget -c $LLVM_CLANG_SOURCE -O "$_src_clang.tar.gz"
+ download LLVM_SOURCE[@] "$_src.tar.gz"
+ download LLVM_CLANG_SOURCE[@] "$_src_clang.tar.gz"
INFO "Unpacking LLVM-$LLVM_VERSION"
tar -C $SRC --transform "s,([^/]*/?)llvm-[^/]*(.*),\1LLVM-$LLVM_VERSION\2,x" \
@@ -1400,13 +1421,13 @@ compile_OSL() {
if [ ! -d $_src ]; then
mkdir -p $SRC
-# wget -c $OSL_SOURCE -O "$_src.tar.gz"
+# download OSL_SOURCE[@] "$_src.tar.gz"
# INFO "Unpacking OpenShadingLanguage-$OSL_VERSION"
# tar -C $SRC --transform "s,(.*/?)OpenShadingLanguage-[^/]*(.*),\1OpenShadingLanguage-$OSL_VERSION\2,x" \
# -xf $_src.tar.gz
- git clone $OSL_SOURCE $_src
+ git clone ${OSL_SOURCE[0]} $_src
fi
@@ -1591,7 +1612,7 @@ compile_FFmpeg() {
if [ ! -d $_src ]; then
INFO "Downloading ffmpeg-$FFMPEG_VERSION"
mkdir -p $SRC
- wget -c $FFMPEG_SOURCE -O "$_src.tar.bz2"
+ download FFMPEG_SOURCE[@] "$_src.tar.bz2"
INFO "Unpacking ffmpeg-$FFMPEG_VERSION"
tar -C $SRC -xf $_src.tar.bz2
diff --git a/extern/libmv/CMakeLists.txt b/extern/libmv/CMakeLists.txt
index 5388570abec..9030ae9c1ed 100644
--- a/extern/libmv/CMakeLists.txt
+++ b/extern/libmv/CMakeLists.txt
@@ -68,7 +68,7 @@ if(WITH_LIBMV)
set(INC_SYS
../Eigen3
- ${PNG_INCLUDE_DIR}
+ ${PNG_INCLUDE_DIRS}
${ZLIB_INCLUDE_DIRS}
)
diff --git a/extern/libmv/third_party/ceres/SConscript b/extern/libmv/third_party/ceres/SConscript
index da7ec347478..573157cb770 100644
--- a/extern/libmv/third_party/ceres/SConscript
+++ b/extern/libmv/third_party/ceres/SConscript
@@ -7,8 +7,6 @@
import sys
import os
-from unordered_map import test_unordered_map
-
Import('env')
src = []
diff --git a/extern/libmv/third_party/ceres/bundle.sh b/extern/libmv/third_party/ceres/bundle.sh
index 9f19221a93c..e7239d9a823 100755
--- a/extern/libmv/third_party/ceres/bundle.sh
+++ b/extern/libmv/third_party/ceres/bundle.sh
@@ -209,8 +209,6 @@ cat > SConscript << EOF
import sys
import os
-from unordered_map import test_unordered_map
-
Import('env')
src = []
diff --git a/extern/xdnd/CMakeLists.txt b/extern/xdnd/CMakeLists.txt
index f7eded73d42..832ddfde396 100644
--- a/extern/xdnd/CMakeLists.txt
+++ b/extern/xdnd/CMakeLists.txt
@@ -28,7 +28,7 @@ set(INC
)
set(INC_SYS
-
+ ${X11_X11_INCLUDE_PATH}
)
set(SRC
diff --git a/intern/cycles/CMakeLists.txt b/intern/cycles/CMakeLists.txt
index efd5ec61525..ccf6aac945e 100644
--- a/intern/cycles/CMakeLists.txt
+++ b/intern/cycles/CMakeLists.txt
@@ -116,7 +116,10 @@ endif()
if(WITH_CYCLES_OSL)
add_definitions(-DWITH_OSL)
add_definitions(-DOSL_STATIC_LIBRARY)
- include_directories(${OSL_INCLUDES})
+ include_directories(
+ SYSTEM
+ ${OSL_INCLUDES}
+ )
endif()
add_definitions(
diff --git a/intern/cycles/cmake/external_libs.cmake b/intern/cycles/cmake/external_libs.cmake
index 6cc9cefcfee..cb1ae52b7f3 100644
--- a/intern/cycles/cmake/external_libs.cmake
+++ b/intern/cycles/cmake/external_libs.cmake
@@ -7,7 +7,10 @@ if(WITH_CYCLES_STANDALONE AND WITH_CYCLES_STANDALONE_GUI)
find_package(GLUT)
message(STATUS "GLUT_FOUND=${GLUT_FOUND}")
- include_directories(${GLUT_INCLUDE_DIR})
+ include_directories(
+ SYSTEM
+ ${GLUT_INCLUDE_DIR}
+ )
endif()
###########################################################################
diff --git a/intern/cycles/kernel/CMakeLists.txt b/intern/cycles/kernel/CMakeLists.txt
index 58142eec556..2ff6b53b0a5 100644
--- a/intern/cycles/kernel/CMakeLists.txt
+++ b/intern/cycles/kernel/CMakeLists.txt
@@ -113,6 +113,7 @@ set(SRC_GEOM_HEADERS
geom/geom.h
geom/geom_attribute.h
geom/geom_bvh.h
+ geom/geom_bvh_shadow.h
geom/geom_bvh_subsurface.h
geom/geom_bvh_traversal.h
geom/geom_curve.h
@@ -167,8 +168,6 @@ if(WITH_CYCLES_CUDA_BINARIES)
if(CUDA_VERSION LESS 60 AND ${arch} MATCHES "sm_50")
message(WARNING "Can't build kernel for CUDA sm_50 architecture, skipping")
- elseif(CUDA_VERSION LESS 50 AND ${arch} MATCHES "sm_35")
- message(WARNING "Can't build kernel for CUDA sm_35 architecture, skipping")
else()
add_custom_command(
OUTPUT ${cuda_cubin}
diff --git a/intern/cycles/kernel/kernel_shadow.h b/intern/cycles/kernel/kernel_shadow.h
index 97b25ecb8b7..439e8bbd585 100644
--- a/intern/cycles/kernel/kernel_shadow.h
+++ b/intern/cycles/kernel/kernel_shadow.h
@@ -64,18 +64,21 @@ ccl_device_inline bool shadow_blocked(KernelGlobals *kg, PathState *state, Ray *
bool blocked;
if(kernel_data.integrator.transparent_shadows) {
+ /* check transparent bounces here, for volume scatter which can do
+ * lighting before surface path termination is checked */
+ if(state->transparent_bounce >= kernel_data.integrator.transparent_max_bounce)
+ return true;
+
/* intersect to find an opaque surface, or record all transparent surface hits */
Intersection hits_stack[STACK_MAX_HITS];
- Intersection *hits;
+ Intersection *hits = hits_stack;
uint max_hits = kernel_data.integrator.transparent_max_bounce - state->transparent_bounce - 1;
/* prefer to use stack but use dynamic allocation if too deep max hits
* we need max_hits + 1 storage space due to the logic in
* scene_intersect_shadow_all which will first store and then check if
* the limit is exceeded */
- if(max_hits + 1 <= STACK_MAX_HITS)
- hits = hits_stack;
- else
+ if(max_hits + 1 > STACK_MAX_HITS)
hits = (Intersection*)malloc(sizeof(Intersection)*(max_hits + 1));
uint num_hits;
diff --git a/intern/cycles/render/mesh.cpp b/intern/cycles/render/mesh.cpp
index 3a95f5c106b..273443034c5 100644
--- a/intern/cycles/render/mesh.cpp
+++ b/intern/cycles/render/mesh.cpp
@@ -766,7 +766,7 @@ static void update_attribute_element_offset(Mesh *mesh, vector<float>& attr_floa
VoxelAttribute *voxel_data = mattr->data_voxel();
offset = voxel_data->slot;
}
- if(mattr->element == ATTR_ELEMENT_CORNER_BYTE) {
+ else if(mattr->element == ATTR_ELEMENT_CORNER_BYTE) {
uchar4 *data = mattr->data_uchar4();
offset = attr_uchar4.size();
diff --git a/intern/elbeem/CMakeLists.txt b/intern/elbeem/CMakeLists.txt
index 887abea3604..30c5615f1d2 100644
--- a/intern/elbeem/CMakeLists.txt
+++ b/intern/elbeem/CMakeLists.txt
@@ -29,7 +29,7 @@ set(INC
)
set(INC_SYS
- ${PNG_INCLUDE_DIR}
+ ${PNG_INCLUDE_DIRS}
${ZLIB_INCLUDE_DIRS}
)
diff --git a/intern/ghost/intern/GHOST_WindowWin32.cpp b/intern/ghost/intern/GHOST_WindowWin32.cpp
index 0599ebce761..c2d152a9712 100644
--- a/intern/ghost/intern/GHOST_WindowWin32.cpp
+++ b/intern/ghost/intern/GHOST_WindowWin32.cpp
@@ -571,8 +571,23 @@ GHOST_TSuccess GHOST_WindowWin32::setState(GHOST_TWindowState state)
GHOST_TSuccess GHOST_WindowWin32::setOrder(GHOST_TWindowOrder order)
{
- HWND hWndInsertAfter = order == GHOST_kWindowOrderTop ? HWND_TOP : HWND_BOTTOM;
- return ::SetWindowPos(m_hWnd, hWndInsertAfter, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE) == TRUE ? GHOST_kSuccess : GHOST_kFailure;
+ HWND hWndInsertAfter, hWndToRaise;
+
+ if (order == GHOST_kWindowOrderBottom) {
+ hWndInsertAfter = HWND_BOTTOM;
+ hWndToRaise = ::GetWindow(m_hWnd, GW_HWNDNEXT); /* the window to raise */
+ }
+ else {
+ hWndInsertAfter = HWND_TOP;
+ hWndToRaise = NULL;
+ }
+ if (::SetWindowPos(m_hWnd, hWndInsertAfter, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE) == FALSE) {
+ return GHOST_kFailure;
+ }
+ if (hWndToRaise && ::SetWindowPos(hWndToRaise, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE) == FALSE) {
+ return GHOST_kFailure;
+ }
+ return GHOST_kSuccess;
}
diff --git a/intern/smoke/CMakeLists.txt b/intern/smoke/CMakeLists.txt
index 2ca423dc73e..8cda0fd140f 100644
--- a/intern/smoke/CMakeLists.txt
+++ b/intern/smoke/CMakeLists.txt
@@ -30,7 +30,7 @@ set(INC
set(INC_SYS
${BULLET_INCLUDE_DIRS}
- ${PNG_INCLUDE_DIR}
+ ${PNG_INCLUDE_DIRS}
${ZLIB_INCLUDE_DIRS}
)
diff --git a/release/scripts/modules/bl_i18n_utils/utils_spell_check.py b/release/scripts/modules/bl_i18n_utils/utils_spell_check.py
index 9371159e0e7..99475603bf2 100644
--- a/release/scripts/modules/bl_i18n_utils/utils_spell_check.py
+++ b/release/scripts/modules/bl_i18n_utils/utils_spell_check.py
@@ -217,6 +217,7 @@ class SpellChecker():
"passepartout",
"perspectively",
"pixelate",
+ "polycount",
"polygonization", "polygonalization", # yuck!
"selectability",
"slurph",
@@ -455,6 +456,7 @@ class SpellChecker():
"uvwarp",
# Algorithm names
+ "ashikhmin", # Ashikhmin-Shirley
"beckmann",
"catmull",
"catrom",
diff --git a/release/scripts/startup/bl_ui/properties_data_lamp.py b/release/scripts/startup/bl_ui/properties_data_lamp.py
index 71fdc1d7b67..3aa0b71ae04 100644
--- a/release/scripts/startup/bl_ui/properties_data_lamp.py
+++ b/release/scripts/startup/bl_ui/properties_data_lamp.py
@@ -378,7 +378,7 @@ class DATA_PT_falloff_curve(DataButtonsPanel, Panel):
def draw(self, context):
lamp = context.lamp
- self.layout.template_curve_mapping(lamp, "falloff_curve")
+ self.layout.template_curve_mapping(lamp, "falloff_curve", use_negative_slope=True)
class DATA_PT_custom_props_lamp(DataButtonsPanel, PropertyPanel, Panel):
diff --git a/release/scripts/startup/bl_ui/properties_render.py b/release/scripts/startup/bl_ui/properties_render.py
index ce375eca894..42cb6086c35 100644
--- a/release/scripts/startup/bl_ui/properties_render.py
+++ b/release/scripts/startup/bl_ui/properties_render.py
@@ -396,7 +396,9 @@ class RENDER_PT_output(RenderButtonsPanel, Panel):
col.prop(rd, "use_overwrite")
col.prop(rd, "use_placeholder")
- split.prop(rd, "use_file_extension")
+ col = split.column()
+ col.prop(rd, "use_file_extension")
+ col.prop(rd, "use_render_cache")
layout.template_image_settings(image_settings, color_management=False)
diff --git a/release/scripts/startup/bl_ui/space_image.py b/release/scripts/startup/bl_ui/space_image.py
index f19e77eff8e..97c89df0693 100644
--- a/release/scripts/startup/bl_ui/space_image.py
+++ b/release/scripts/startup/bl_ui/space_image.py
@@ -154,6 +154,8 @@ class IMAGE_MT_image(Menu):
show_render = sima.show_render
+ layout.operator("image.read_renderlayers")
+
if ima:
if not show_render:
layout.operator("image.replace")
diff --git a/release/scripts/startup/bl_ui/space_userpref.py b/release/scripts/startup/bl_ui/space_userpref.py
index 31ca972726e..cba6f065a6f 100644
--- a/release/scripts/startup/bl_ui/space_userpref.py
+++ b/release/scripts/startup/bl_ui/space_userpref.py
@@ -865,6 +865,7 @@ class USERPREF_PT_file(Panel):
sub.label(text="Scripts:")
sub.label(text="Sounds:")
sub.label(text="Temp:")
+ sub.label(text="Render Cache:")
sub.label(text="I18n Branches:")
sub.label(text="Image Editor:")
sub.label(text="Animation Player:")
@@ -876,6 +877,7 @@ class USERPREF_PT_file(Panel):
sub.prop(paths, "script_directory", text="")
sub.prop(paths, "sound_directory", text="")
sub.prop(paths, "temporary_directory", text="")
+ sub.prop(paths, "render_cache_directory", text="")
sub.prop(paths, "i18n_branches_directory", text="")
sub.prop(paths, "image_editor", text="")
subsplit = sub.split(percentage=0.3)
diff --git a/source/blender/blenkernel/intern/blender.c b/source/blender/blenkernel/intern/blender.c
index a71d3987c58..8afd2c458cd 100644
--- a/source/blender/blenkernel/intern/blender.c
+++ b/source/blender/blenkernel/intern/blender.c
@@ -197,29 +197,38 @@ static void setup_app_data(bContext *C, BlendFileData *bfd, const char *filepath
bScreen *curscreen = NULL;
Scene *curscene = NULL;
int recover;
- char mode;
-
- /* 'u' = undo save, 'n' = no UI load */
- if (BLI_listbase_is_empty(&bfd->main->screen)) mode = 'u';
- else if (G.fileflags & G_FILE_NO_UI) mode = 'n';
- else mode = 0;
+ enum {
+ LOAD_UI = 1,
+ LOAD_UI_OFF,
+ LOAD_UNDO,
+ } mode;
+
+ if (BLI_listbase_is_empty(&bfd->main->screen)) {
+ mode = LOAD_UNDO;
+ }
+ else if (G.fileflags & G_FILE_NO_UI) {
+ mode = LOAD_UI_OFF;
+ }
+ else {
+ mode = LOAD_UI;
+ }
recover = (G.fileflags & G_FILE_RECOVER);
/* Free all render results, without this stale data gets displayed after loading files */
- if (mode != 'u') {
+ if (mode != LOAD_UNDO) {
RE_FreeAllRenderResults();
}
/* Only make filepaths compatible when loading for real (not undo) */
- if (mode != 'u') {
+ if (mode != LOAD_UNDO) {
clean_paths(bfd->main);
}
/* XXX here the complex windowmanager matching */
/* no load screens? */
- if (mode) {
+ if (mode != LOAD_UI) {
/* comes from readfile.c */
SWAP(ListBase, G.main->wm, bfd->main->wm);
SWAP(ListBase, G.main->screen, bfd->main->screen);
@@ -263,7 +272,7 @@ static void setup_app_data(bContext *C, BlendFileData *bfd, const char *filepath
}
/* case G_FILE_NO_UI or no screens in file */
- if (mode) {
+ if (mode != LOAD_UI) {
/* leave entire context further unaltered? */
CTX_data_scene_set(C, curscene);
}
@@ -332,7 +341,7 @@ static void setup_app_data(bContext *C, BlendFileData *bfd, const char *filepath
/* baseflags, groups, make depsgraph, etc */
/* first handle case if other windows have different scenes visible */
- if (mode == 0) {
+ if (mode == LOAD_UI) {
wmWindowManager *wm = G.main->wm.first;
if (wm) {
@@ -347,7 +356,7 @@ static void setup_app_data(bContext *C, BlendFileData *bfd, const char *filepath
}
BKE_scene_set_background(G.main, CTX_data_scene(C));
- if (mode != 'u') {
+ if (mode != LOAD_UNDO) {
IMB_colormanagement_check_file_config(G.main);
}
diff --git a/source/blender/blenkernel/intern/bpath.c b/source/blender/blenkernel/intern/bpath.c
index 2e1530740d8..dc2d0924bba 100644
--- a/source/blender/blenkernel/intern/bpath.c
+++ b/source/blender/blenkernel/intern/bpath.c
@@ -94,7 +94,8 @@ static bool checkMissingFiles_visit_cb(void *userdata, char *UNUSED(path_dst), c
/* high level function */
void BKE_bpath_missing_files_check(Main *bmain, ReportList *reports)
{
- BKE_bpath_traverse_main(bmain, checkMissingFiles_visit_cb, BKE_BPATH_TRAVERSE_ABS, reports);
+ BKE_bpath_traverse_main(bmain, checkMissingFiles_visit_cb,
+ BKE_BPATH_TRAVERSE_ABS | BKE_BPATH_TRAVERSE_SKIP_PACKED, reports);
}
typedef struct BPathRemap_Data {
diff --git a/source/blender/blenkernel/intern/cdderivedmesh.c b/source/blender/blenkernel/intern/cdderivedmesh.c
index 3cfa22a2dc6..f39b4e20b70 100644
--- a/source/blender/blenkernel/intern/cdderivedmesh.c
+++ b/source/blender/blenkernel/intern/cdderivedmesh.c
@@ -2601,15 +2601,15 @@ DerivedMesh *CDDM_merge_verts(DerivedMesh *dm, const int *vtargetmap, const int
int i, j, c;
- STACK_INIT(oldv);
- STACK_INIT(olde);
- STACK_INIT(oldl);
- STACK_INIT(oldp);
-
- STACK_INIT(mvert);
- STACK_INIT(medge);
- STACK_INIT(mloop);
- STACK_INIT(mpoly);
+ STACK_INIT(oldv, totvert_final);
+ STACK_INIT(olde, totedge);
+ STACK_INIT(oldl, totloop);
+ STACK_INIT(oldp, totpoly);
+
+ STACK_INIT(mvert, totvert_final);
+ STACK_INIT(medge, totedge);
+ STACK_INIT(mloop, totloop);
+ STACK_INIT(mpoly, totpoly);
/* fill newl with destination vertex indices */
mv = cddm->mvert;
diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c
index e5efffa5d0e..50152c7d053 100644
--- a/source/blender/blenkernel/intern/particle.c
+++ b/source/blender/blenkernel/intern/particle.c
@@ -2666,6 +2666,9 @@ static void psys_thread_create_path(ParticleThread *thread, struct ChildParticle
/* get the original coordinates (orco) for texture usage */
cpa_from = part->from;
cpa_num = pa->num;
+ /* XXX hack to avoid messed up particle num and subsequent crash (#40733) */
+ if (cpa_num > ctx->sim.psmd->dm->getNumTessFaces(ctx->sim.psmd->dm))
+ cpa_num = 0;
cpa_fuv = pa->fuv;
psys_particle_on_emitter(ctx->sim.psmd, cpa_from, cpa_num, DMCACHE_ISCHILD, cpa_fuv, pa->foffset, co, ornor, 0, 0, orco, 0);
diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c
index 2b386708cf8..f5efe04951f 100644
--- a/source/blender/blenkernel/intern/sequencer.c
+++ b/source/blender/blenkernel/intern/sequencer.c
@@ -2539,7 +2539,7 @@ static ImBuf *seq_render_scene_strip(const SeqRenderData *context, Sequence *seq
}
/* prevent eternal loop */
- do_seq = context->scene->r.scemode & R_DOSEQ;
+ do_seq = scene->r.scemode & R_DOSEQ;
scene->r.scemode &= ~R_DOSEQ;
#ifdef DURIAN_CAMERA_SWITCH
diff --git a/source/blender/blenlib/BLI_stack.h b/source/blender/blenlib/BLI_stack.h
index 564ff513490..d65c8f02462 100644
--- a/source/blender/blenlib/BLI_stack.h
+++ b/source/blender/blenlib/BLI_stack.h
@@ -28,27 +28,22 @@
* \ingroup bli
*/
+#include "BLI_compiler_attrs.h"
+
typedef struct BLI_Stack BLI_Stack;
-/* Create a new homogeneous stack with elements of 'elem_size' bytes */
-BLI_Stack *BLI_stack_new(int elem_size, const char *description);
+BLI_Stack *BLI_stack_new_ex(
+ const size_t elem_size, const char *description,
+ const size_t chunk_size) ATTR_NONNULL();
+BLI_Stack *BLI_stack_new(
+ const size_t elem_size, const char *description) ATTR_NONNULL();
-/* Free the stack's data and the stack itself */
-void BLI_stack_free(BLI_Stack *stack);
+void BLI_stack_free(BLI_Stack *stack) ATTR_NONNULL();
-/* Copies the source value onto the stack (note that it copies
- * elem_size bytes from 'src', the pointer itself is not stored) */
-void BLI_stack_push(BLI_Stack *stack, void *src);
+void BLI_stack_push(BLI_Stack *stack, const void *src) ATTR_NONNULL();
-/* Retrieves and removes the top element from the stack. The value is
- * copies to 'dst', which must be at least elem_size bytes.
- *
- * Does not reduce amount of allocated memory.
- *
- * If stack is empty, 'dst' will not be modified. */
-void BLI_stack_pop(BLI_Stack *stack, void *dst);
+void BLI_stack_pop(BLI_Stack *stack, void *dst) ATTR_NONNULL();
-/* Returns true if the stack is empty, false otherwise */
-int BLI_stack_empty(const BLI_Stack *stack);
+bool BLI_stack_is_empty(const BLI_Stack *stack) ATTR_NONNULL();
#endif
diff --git a/source/blender/blenlib/BLI_stackdefines.h b/source/blender/blenlib/BLI_stackdefines.h
index 3a4957599d6..24cb043cd43 100644
--- a/source/blender/blenlib/BLI_stackdefines.h
+++ b/source/blender/blenlib/BLI_stackdefines.h
@@ -23,20 +23,41 @@
/** \file BLI_stackdefines.h
* \ingroup bli
+ *
+ * Macro's for a simple array based stack
+ * \note Caller handles alloc & free).
*/
-/* simple stack */
-#define STACK_DECLARE(stack) unsigned int _##stack##_index
-#define STACK_INIT(stack) ((void)stack, (void)((_##stack##_index) = 0))
-#define STACK_SIZE(stack) ((void)stack, (_##stack##_index))
-#define STACK_PUSH(stack, val) (void)((stack)[(_##stack##_index)++] = val)
-#define STACK_PUSH_RET(stack) ((void)stack, ((stack)[(_##stack##_index)++]))
-#define STACK_PUSH_RET_PTR(stack) ((void)stack, &((stack)[(_##stack##_index)++]))
+/* only validate array-bounds in debug mode */
+#ifdef DEBUG
+# define STACK_DECLARE(stack) unsigned int _##stack##_index, _##stack##_totalloc
+# define STACK_INIT(stack, tot) ((void)stack, (void)((_##stack##_index) = 0), (void)((_##stack##_totalloc) = tot))
+# define _STACK_SIZETEST(stack, off) (BLI_assert((_##stack##_index) + off <= _##stack##_totalloc))
+# define _STACK_SWAP_TOTALLOC(stack_a, stack_b) SWAP(unsigned int, _##stack_a##_totalloc, _##stack_b##_totalloc)
+#else
+# define STACK_DECLARE(stack) unsigned int _##stack##_index
+# define STACK_INIT(stack, tot) ((void)stack, (void)((_##stack##_index) = 0), (void)(tot))
+# define _STACK_SIZETEST(stack, off) (void)(stack), (void)(off)
+# define _STACK_SWAP_TOTALLOC(stack_a, stack_b) (void)(stack_a), (void)(stack_b)
+#endif
+#define _STACK_BOUNDSTEST(stack, index) ((void)stack, BLI_assert(index >= 0 && index < _##stack##_index))
+
+
+#define STACK_SIZE(stack) ((void)stack, (_##stack##_index))
+/** add item to stack */
+#define STACK_PUSH(stack, val) ((void)stack, _STACK_SIZETEST(stack, 1), ((stack)[(_##stack##_index)++] = val))
+#define STACK_PUSH_RET(stack) ((void)stack, _STACK_SIZETEST(stack, 1), ((stack)[(_##stack##_index)++]))
+#define STACK_PUSH_RET_PTR(stack) ((void)stack, _STACK_SIZETEST(stack, 1), &((stack)[(_##stack##_index)++]))
+/** take last item from stack */
#define STACK_POP(stack) ((_##stack##_index) ? ((stack)[--(_##stack##_index)]) : NULL)
#define STACK_POP_PTR(stack) ((_##stack##_index) ? &((stack)[--(_##stack##_index)]) : NULL)
#define STACK_POP_DEFAULT(stack, r) ((_##stack##_index) ? ((stack)[--(_##stack##_index)]) : r)
-/* take care, re-orders */
+/** look at last item (assumes non-empty stack) */
+#define STACK_PEEK(stack) (BLI_assert(_##stack##_index), ((stack)[_##stack##_index - 1]))
+#define STACK_PEEK_PTR(stack) (BLI_assert(_##stack##_index), &((stack)[_##stack##_index - 1]))
+/** remove any item from the stack, take care, re-orders */
#define STACK_REMOVE(stack, i) \
+ _STACK_BOUNDSTEST(stack, i); \
if (--_##stack##_index != i) { \
stack[i] = stack[_##stack##_index]; \
} (void)0
@@ -44,11 +65,13 @@
#define STACK_SWAP(stack_a, stack_b) { \
SWAP(typeof(stack_a), stack_a, stack_b); \
SWAP(unsigned int, _##stack_a##_index, _##stack_b##_index); \
+ _STACK_SWAP_TOTALLOC(stack_a, stack_b); \
} (void)0
#else
#define STACK_SWAP(stack_a, stack_b) { \
SWAP(void *, stack_a, stack_b); \
SWAP(unsigned int, _##stack_a##_index, _##stack_b##_index); \
+ _STACK_SWAP_TOTALLOC(stack_a, stack_b); \
} (void)0
#endif
diff --git a/source/blender/blenlib/CMakeLists.txt b/source/blender/blenlib/CMakeLists.txt
index 9e360741b23..0c1c5f1d774 100644
--- a/source/blender/blenlib/CMakeLists.txt
+++ b/source/blender/blenlib/CMakeLists.txt
@@ -164,6 +164,7 @@ set(SRC
BLI_sort.h
BLI_sort_utils.h
BLI_stack.h
+ BLI_stackdefines.h
BLI_strict_flags.h
BLI_string.h
BLI_string_cursor_utf8.h
diff --git a/source/blender/blenlib/intern/stack.c b/source/blender/blenlib/intern/stack.c
index 5be2ed941a7..c2ee73d9693 100644
--- a/source/blender/blenlib/intern/stack.c
+++ b/source/blender/blenlib/intern/stack.c
@@ -28,83 +28,176 @@
#include <string.h>
#include <stdlib.h> /* abort() */
-#include "BLI_stack.h" /* own include */
-
#include "BLI_utildefines.h"
#include "MEM_guardedalloc.h"
-struct BLI_Stack {
- void *data;
+#include "BLI_stack.h" /* own include */
+
+#include "BLI_strict_flags.h"
+
+// #define USE_TOTELEM
- int totelem;
- int maxelem;
+#define CHUNK_EMPTY ((size_t)-1)
+/* target chunks size: 64kb */
+#define CHUNK_SIZE_DEFAULT (1 << 16)
+/* ensure we get at least this many elems per chunk */
+#define CHUNK_ELEM_MIN 32
- int elem_size;
+/* Gets the last element in the stack */
+#define CHUNK_LAST_ELEM(_stack) \
+ ((void)0, (((char *)(_stack)->chunk_curr->data) + \
+ ((_stack)->elem_size * (_stack)->chunk_index)))
+
+#define IS_POW2(a) (((a) & ((a) - 1)) == 0)
+
+struct StackChunk {
+ struct StackChunk *next;
+ char data[0];
+};
+
+struct BLI_Stack {
+ struct StackChunk *chunk_curr; /* currently active chunk */
+ struct StackChunk *chunk_free; /* free chunks */
+ size_t chunk_index; /* index into 'chunk_curr' */
+ size_t chunk_elem_max; /* number of elements per chunk */
+ size_t elem_size;
+#ifdef USE_TOTELEM
+ size_t totelem;
+#endif
};
-BLI_Stack *BLI_stack_new(int elem_size, const char *description)
+/**
+ * \return number of elements per chunk, optimized for slop-space.
+ */
+static size_t stack_chunk_elem_max_calc(const size_t elem_size, size_t chunk_size)
+{
+ /* get at least this number of elems per chunk */
+ const size_t elem_size_min = elem_size * CHUNK_ELEM_MIN;
+
+ BLI_assert((elem_size != 0) && (chunk_size != 0));
+
+ while (UNLIKELY(chunk_size <= elem_size_min)) {
+ chunk_size <<= 1;
+ }
+
+ /* account for slop-space */
+ chunk_size -= (sizeof(struct StackChunk) + MEM_SIZE_OVERHEAD);
+
+ return chunk_size / elem_size;
+}
+
+BLI_Stack *BLI_stack_new_ex(const size_t elem_size, const char *description,
+ const size_t chunk_size)
{
BLI_Stack *stack = MEM_callocN(sizeof(*stack), description);
+ stack->chunk_elem_max = stack_chunk_elem_max_calc(elem_size, chunk_size);
stack->elem_size = elem_size;
+ /* force init */
+ stack->chunk_index = stack->chunk_elem_max - 1;
+
+ /* ensure we have a correctly rounded size */
+ BLI_assert((IS_POW2(stack->elem_size) == 0) ||
+ (IS_POW2((stack->chunk_elem_max * stack->elem_size) +
+ (sizeof(struct StackChunk) + MEM_SIZE_OVERHEAD))));
return stack;
}
-void BLI_stack_free(BLI_Stack *stack)
+/**
+ * Create a new homogeneous stack with elements of 'elem_size' bytes.
+ */
+BLI_Stack *BLI_stack_new(const size_t elem_size, const char *description)
+{
+ return BLI_stack_new_ex(elem_size, description, CHUNK_SIZE_DEFAULT);
+}
+
+static void stack_free_chunks(struct StackChunk *data)
{
- if (stack) {
- if (stack->data)
- MEM_freeN(stack->data);
- MEM_freeN(stack);
+ while (data) {
+ struct StackChunk *data_next = data->next;
+ MEM_freeN(data);
+ data = data_next;
}
}
-/* Gets the last element in the stack */
-#define STACK_LAST_ELEM(stack__) \
- (((char *)(stack__)->data) + \
- ((stack__)->elem_size * ((stack__)->totelem - 1)))
+/**
+ * Free the stack's data and the stack itself
+ */
+void BLI_stack_free(BLI_Stack *stack)
+{
+ stack_free_chunks(stack->chunk_curr);
+ stack_free_chunks(stack->chunk_free);
+ MEM_freeN(stack);
+}
-void BLI_stack_push(BLI_Stack *stack, void *src)
+/**
+ * Copies the source value onto the stack (note that it copies
+ * elem_size bytes from 'src', the pointer itself is not stored)
+ */
+void BLI_stack_push(BLI_Stack *stack, const void *src)
{
- /* Ensure stack is large enough */
- if (stack->totelem == stack->maxelem) {
- if (stack->maxelem == 0) {
- /* Initialize stack with space for a small hardcoded
- * number of elements */
- stack->maxelem = 32;
- stack->data = MEM_mallocN((stack->elem_size *
- stack->maxelem), AT);
+ stack->chunk_index++;
+
+ if (UNLIKELY(stack->chunk_index == stack->chunk_elem_max)) {
+ struct StackChunk *chunk;
+ if (stack->chunk_free) {
+ chunk = stack->chunk_free;
+ stack->chunk_free = chunk->next;
}
else {
- /* Double stack size */
- int maxelem = stack->maxelem + stack->maxelem;
- /* Check for overflow */
- BLI_assert(maxelem > stack->maxelem);
- stack->data = MEM_reallocN(stack->data,
- (stack->elem_size *
- maxelem));
- stack->maxelem = maxelem;
+ chunk = MEM_mallocN(
+ sizeof(*chunk) + (stack->elem_size * stack->chunk_elem_max),
+ __func__);
}
+ chunk->next = stack->chunk_curr;
+ stack->chunk_curr = chunk;
+ stack->chunk_index = 0;
}
- BLI_assert(stack->totelem < stack->maxelem);
+ BLI_assert(stack->chunk_index < stack->chunk_elem_max);
- /* Copy source to end of stack */
+#ifdef USE_TOTELEM
stack->totelem++;
- memcpy(STACK_LAST_ELEM(stack), src, stack->elem_size);
+#endif
+
+ /* Copy source to end of stack */
+ memcpy(CHUNK_LAST_ELEM(stack), src, stack->elem_size);
}
+/**
+ * Retrieves and removes the top element from the stack.
+ * The value is copies to \a dst, which must be at least \a elem_size bytes.
+ *
+ * Does not reduce amount of allocated memory.
+ */
void BLI_stack_pop(BLI_Stack *stack, void *dst)
{
- BLI_assert(stack->totelem > 0);
- if (stack->totelem > 0) {
- memcpy(dst, STACK_LAST_ELEM(stack), stack->elem_size);
+ BLI_assert(BLI_stack_is_empty(stack) == false);
+
+ if (!BLI_stack_is_empty(stack)) {
+ memcpy(dst, CHUNK_LAST_ELEM(stack), stack->elem_size);
+#ifdef USE_TOTELEM
stack->totelem--;
+#endif
+ if (--stack->chunk_index == CHUNK_EMPTY) {
+ struct StackChunk *chunk_free;
+
+ chunk_free = stack->chunk_curr;
+ stack->chunk_curr = stack->chunk_curr->next;
+
+ chunk_free->next = stack->chunk_free;
+ stack->chunk_free = chunk_free;
+
+ stack->chunk_index = stack->chunk_elem_max - 1;
+ }
}
}
-int BLI_stack_empty(const BLI_Stack *stack)
+/**
+ * Returns true if the stack is empty, false otherwise
+ */
+bool BLI_stack_is_empty(const BLI_Stack *stack)
{
- return stack->totelem == 0;
+ return (stack->chunk_curr == NULL);
}
diff --git a/source/blender/bmesh/intern/bmesh_core.c b/source/blender/bmesh/intern/bmesh_core.c
index c4dc9909185..1c93eccf8bd 100644
--- a/source/blender/bmesh/intern/bmesh_core.c
+++ b/source/blender/bmesh/intern/bmesh_core.c
@@ -2038,7 +2038,7 @@ void bmesh_vert_separate(BMesh *bm, BMVert *v, BMVert ***r_vout, int *r_vout_len
BLI_smallhash_init_ex(&visithash, v_edgetot);
- STACK_INIT(stack);
+ STACK_INIT(stack, v_edgetot);
maxindex = 0;
BM_ITER_ELEM (e, &eiter, v, BM_EDGES_OF_VERT) {
@@ -2109,7 +2109,7 @@ void bmesh_vert_separate(BMesh *bm, BMVert *v, BMVert ***r_vout, int *r_vout_len
* by modifying data it loops over [#30632], this re-uses the 'stack' variable which is a bit
* bad practice but save alloc'ing a new array - note, the comment above is useful, keep it
* if you are tidying up code - campbell */
- STACK_INIT(stack);
+ STACK_INIT(stack, v_edgetot);
BM_ITER_ELEM (l, &liter, v, BM_LOOPS_OF_VERT) {
if (l->v == v) {
STACK_PUSH(stack, (BMEdge *)l);
diff --git a/source/blender/bmesh/intern/bmesh_queries.c b/source/blender/bmesh/intern/bmesh_queries.c
index d478ac07474..606e93d4a85 100644
--- a/source/blender/bmesh/intern/bmesh_queries.c
+++ b/source/blender/bmesh/intern/bmesh_queries.c
@@ -2068,7 +2068,7 @@ int BM_mesh_calc_face_groups(BMesh *bm, int *r_groups_array, int (**r_group_inde
BMFace *f;
int i;
- STACK_INIT(group_array);
+ STACK_INIT(group_array, bm->totface);
BLI_assert(((htype_step & ~(BM_VERT | BM_EDGE)) == 0) && (htype_step != 0));
@@ -2096,7 +2096,7 @@ int BM_mesh_calc_face_groups(BMesh *bm, int *r_groups_array, int (**r_group_inde
BLI_assert(tot_touch < tot_faces);
- STACK_INIT(stack);
+ STACK_INIT(stack, tot_faces);
BM_ITER_MESH (f, &iter, bm, BM_FACES_OF_MESH) {
if (BM_elem_flag_test(f, BM_ELEM_TAG) == false) {
@@ -2224,7 +2224,7 @@ int BM_mesh_calc_edge_groups(BMesh *bm, int *r_groups_array, int (**r_group_inde
BMEdge *e;
int i;
- STACK_INIT(group_array);
+ STACK_INIT(group_array, bm->totface);
/* init the array */
BM_ITER_MESH_INDEX (e, &iter, bm, BM_EDGES_OF_MESH, i) {
@@ -2250,7 +2250,7 @@ int BM_mesh_calc_edge_groups(BMesh *bm, int *r_groups_array, int (**r_group_inde
BLI_assert(tot_touch < tot_edges);
- STACK_INIT(stack);
+ STACK_INIT(stack, tot_edges);
BM_ITER_MESH (e, &iter, bm, BM_EDGES_OF_MESH) {
if (BM_elem_flag_test(e, BM_ELEM_TAG) == false) {
diff --git a/source/blender/bmesh/operators/bmo_bisect_plane.c b/source/blender/bmesh/operators/bmo_bisect_plane.c
index 378cf405e16..bed1ea5cb94 100644
--- a/source/blender/bmesh/operators/bmo_bisect_plane.c
+++ b/source/blender/bmesh/operators/bmo_bisect_plane.c
@@ -90,7 +90,7 @@ void bmo_bisect_plane_exec(BMesh *bm, BMOperator *op)
plane_outer[3] = plane[3] - dist;
plane_inner[3] = plane[3] + dist;
- STACK_INIT(vert_arr);
+ STACK_INIT(vert_arr, vert_arr_max);
BMO_ITER (v, &siter, op->slots_in, "geom", BM_VERT) {
if ((clear_outer && plane_point_side_v3(plane_outer, v->co) > 0.0f) ||
diff --git a/source/blender/bmesh/operators/bmo_connect.c b/source/blender/bmesh/operators/bmo_connect.c
index 8b0033a9342..4cf6e82fc8e 100644
--- a/source/blender/bmesh/operators/bmo_connect.c
+++ b/source/blender/bmesh/operators/bmo_connect.c
@@ -52,8 +52,8 @@ static int bm_face_connect_verts(BMesh *bm, BMFace *f, const bool check_degenera
BMLoop *l_last;
unsigned int i;
- STACK_INIT(loops_split);
- STACK_INIT(verts_pair);
+ STACK_INIT(loops_split, f->len);
+ STACK_INIT(verts_pair, f->len);
l_last = NULL;
BM_ITER_ELEM (l, &liter, f, BM_LOOPS_OF_FACE) {
diff --git a/source/blender/bmesh/operators/bmo_dissolve.c b/source/blender/bmesh/operators/bmo_dissolve.c
index f7b8352ed78..209ca30ddc3 100644
--- a/source/blender/bmesh/operators/bmo_dissolve.c
+++ b/source/blender/bmesh/operators/bmo_dissolve.c
@@ -357,6 +357,7 @@ void bmo_dissolve_verts_exec(BMesh *bm, BMOperator *op)
BMO_ITER (v, &oiter, op->slots_in, "verts", BM_VERT) {
BMIter itersub;
BMLoop *l_first;
+ BMEdge *e_first = NULL;
BM_ITER_ELEM (l_first, &itersub, v, BM_LOOPS_OF_VERT) {
BMLoop *l_iter;
l_iter = l_first;
@@ -364,26 +365,26 @@ void bmo_dissolve_verts_exec(BMesh *bm, BMOperator *op)
BMO_elem_flag_enable(bm, l_iter->v, VERT_ISGC);
BMO_elem_flag_enable(bm, l_iter->e, EDGE_ISGC);
} while ((l_iter = l_iter->next) != l_first);
+
+ e_first = l_first->e;
}
- /* clean wire edges and mark vert-edge-pairs (unrelated to checks above) */
- if ((e = v->e)) {
- int edge_count = 0;
+ /* important e_first won't be deleted */
+ if (e_first) {
+ e = e_first;
do {
e_next = BM_DISK_EDGE_NEXT(e, v);
if (BM_edge_is_wire(e)) {
BM_edge_kill(bm, e);
}
- else {
- BMO_elem_flag_enable(bm, e, EDGE_ISGC);
- edge_count += 1;
- }
- } while (v->e && (e = e_next) != v->e);
+ } while ((e = e_next) != e_first);
+ }
+ }
- /* tag here so we avoid feedback loop (checking topology as we edit) */
- if (edge_count == 2) {
- BMO_elem_flag_enable(bm, v, VERT_MARK_PAIR);
- }
+ BMO_ITER (v, &oiter, op->slots_in, "verts", BM_VERT) {
+ /* tag here so we avoid feedback loop (checking topology as we edit) */
+ if (BM_vert_is_edge_pair(v)) {
+ BMO_elem_flag_enable(bm, v, VERT_MARK_PAIR);
}
}
diff --git a/source/blender/bmesh/operators/bmo_removedoubles.c b/source/blender/bmesh/operators/bmo_removedoubles.c
index a17ab2133c1..814649c7dbf 100644
--- a/source/blender/bmesh/operators/bmo_removedoubles.c
+++ b/source/blender/bmesh/operators/bmo_removedoubles.c
@@ -92,8 +92,8 @@ static void remdoubles_createface(BMesh *bm, BMFace *f, BMOpSlot *slot_targetmap
STACK_DECLARE(edges);
STACK_DECLARE(loops);
- STACK_INIT(edges);
- STACK_INIT(loops);
+ STACK_INIT(edges, f->len);
+ STACK_INIT(loops, f->len);
BM_ITER_ELEM (l, &liter, f, BM_LOOPS_OF_FACE) {
BMVert *v1 = l->v;
diff --git a/source/blender/bmesh/operators/bmo_subdivide_edgering.c b/source/blender/bmesh/operators/bmo_subdivide_edgering.c
index ae1ff5a7389..e13a9df4474 100644
--- a/source/blender/bmesh/operators/bmo_subdivide_edgering.c
+++ b/source/blender/bmesh/operators/bmo_subdivide_edgering.c
@@ -970,8 +970,8 @@ static void bm_edgering_pair_subdiv(BMesh *bm,
BMEdge *e;
BMFace *f;
- STACK_INIT(edges_ring_arr);
- STACK_INIT(faces_ring_arr);
+ STACK_INIT(edges_ring_arr, stack_max);
+ STACK_INIT(faces_ring_arr, stack_max);
bm_edgeloop_vert_tag(el_store_a, false);
bm_edgeloop_vert_tag(el_store_b, true);
diff --git a/source/blender/bmesh/tools/bmesh_bisect_plane.c b/source/blender/bmesh/tools/bmesh_bisect_plane.c
index 0bd68e7a461..0ecb8066ac1 100644
--- a/source/blender/bmesh/tools/bmesh_bisect_plane.c
+++ b/source/blender/bmesh/tools/bmesh_bisect_plane.c
@@ -118,7 +118,7 @@ static void bm_face_bisect_verts(BMesh *bm, BMFace *f, const float plane[4], con
BMLoop *l_iter, *l_first;
bool use_dirs[3] = {false, false, false};
- STACK_INIT(vert_split_arr);
+ STACK_INIT(vert_split_arr, f_len_orig);
l_first = BM_FACE_FIRST_LOOP(f);
@@ -224,7 +224,7 @@ static void bm_face_bisect_verts(BMesh *bm, BMFace *f, const float plane[4], con
* while not all that nice, typically there are < 5 resulting faces,
* so its not _that_ bad. */
- STACK_INIT(face_split_arr);
+ STACK_INIT(face_split_arr, STACK_SIZE(vert_split_arr));
STACK_PUSH(face_split_arr, f);
for (i = 0; i < STACK_SIZE(vert_split_arr) - 1; i++) {
diff --git a/source/blender/collada/EffectExporter.cpp b/source/blender/collada/EffectExporter.cpp
index 218f2db54e3..3c35618a4cd 100644
--- a/source/blender/collada/EffectExporter.cpp
+++ b/source/blender/collada/EffectExporter.cpp
@@ -372,6 +372,10 @@ void EffectsExporter::operator()(Material *ma, Object *ob)
MTex *t = ma->mtex[tex_indices[a]];
Image *ima = t->tex->ima;
+ if (!ima) {
+ continue;
+ }
+
std::string key(id_name(ima));
key = translate_id(key);
int i = im_samp_map[key];
diff --git a/source/blender/compositor/operations/COM_RenderLayersProg.cpp b/source/blender/compositor/operations/COM_RenderLayersProg.cpp
index af0d1b0b4f4..7141dd7bf72 100644
--- a/source/blender/compositor/operations/COM_RenderLayersProg.cpp
+++ b/source/blender/compositor/operations/COM_RenderLayersProg.cpp
@@ -142,16 +142,13 @@ void RenderLayersBaseProg::executePixelSampled(float output[4], float x, float y
int ix = x - dx;
int iy = y - dy;
-#else
- int ix = x;
- int iy = y;
#endif
if (this->m_inputBuffer == NULL) {
zero_v4(output);
}
else {
- doInterpolation(output, ix, iy, sampler);
+ doInterpolation(output, x, y, sampler);
}
}
@@ -204,22 +201,13 @@ RenderLayersAlphaProg::RenderLayersAlphaProg() : RenderLayersBaseProg(SCE_PASS_C
void RenderLayersAlphaProg::executePixelSampled(float output[4], float x, float y, PixelSampler sampler)
{
- int ix = x;
- int iy = y;
float *inputBuffer = this->getInputBuffer();
- if (inputBuffer == NULL || ix < 0 || iy < 0 || ix >= (int)this->getWidth() || iy >= (int)this->getHeight() ) {
- output[0] = 0.0f;
- output[1] = 0.0f;
- output[2] = 0.0f;
- output[3] = 0.0f;
+ if (inputBuffer == NULL) {
+ zero_v4(output);
}
else {
- unsigned int offset = (iy * this->getWidth() + ix) * 4;
- output[0] = inputBuffer[offset + 3];
- output[1] = 0.0f;
- output[2] = 0.0f;
- output[3] = 0.0f;
+ doInterpolation(output, x, y, sampler);
}
}
diff --git a/source/blender/compositor/operations/COM_WrapOperation.cpp b/source/blender/compositor/operations/COM_WrapOperation.cpp
index e6cde05eae2..c30361d1df8 100644
--- a/source/blender/compositor/operations/COM_WrapOperation.cpp
+++ b/source/blender/compositor/operations/COM_WrapOperation.cpp
@@ -77,26 +77,25 @@ void WrapOperation::executePixelSampled(float output[4], float x, float y, Pixel
bool WrapOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output)
{
rcti newInput;
-
newInput.xmin = input->xmin;
newInput.xmax = input->xmax;
newInput.ymin = input->ymin;
newInput.ymax = input->ymax;
- if (m_wrappingType == 1 || m_wrappingType == 3) {
+ if (m_wrappingType == CMP_NODE_WRAP_X || m_wrappingType == CMP_NODE_WRAP_XY) {
// wrap only on the x-axis if tile is wrapping
newInput.xmin = getWrappedOriginalXPos(input->xmin);
- newInput.xmax = getWrappedOriginalXPos(input->xmax);
- if (newInput.xmin > newInput.xmax) {
+ newInput.xmax = getWrappedOriginalXPos(input->xmax) + 0.5f;
+ if (newInput.xmin >= newInput.xmax) {
newInput.xmin = 0;
newInput.xmax = this->getWidth();
}
}
- if (m_wrappingType == 2 || m_wrappingType == 3) {
+ if (m_wrappingType == CMP_NODE_WRAP_Y || m_wrappingType == CMP_NODE_WRAP_XY) {
// wrap only on the y-axis if tile is wrapping
newInput.ymin = getWrappedOriginalYPos(input->ymin);
- newInput.ymax = getWrappedOriginalYPos(input->ymax);
- if (newInput.ymin > newInput.ymax) {
+ newInput.ymax = getWrappedOriginalYPos(input->ymax) + 0.5f;
+ if (newInput.ymin >= newInput.ymax) {
newInput.ymin = 0;
newInput.ymax = this->getHeight();
}
diff --git a/source/blender/datatoc/CMakeLists.txt b/source/blender/datatoc/CMakeLists.txt
index 53fe8c32e9c..4c35a941757 100644
--- a/source/blender/datatoc/CMakeLists.txt
+++ b/source/blender/datatoc/CMakeLists.txt
@@ -53,7 +53,7 @@ if(NOT WITH_HEADLESS)
)
endif()
- include_directories(${PNG_INCLUDE_DIR})
+ include_directories(${PNG_INCLUDE_DIRS})
link_directories(${PNG_LIBPATH} ${ZLIB_LIBPATH})
add_executable(datatoc_icon ${SRC})
diff --git a/source/blender/editors/animation/anim_markers.c b/source/blender/editors/animation/anim_markers.c
index e0592e594be..e519fc8bfef 100644
--- a/source/blender/editors/animation/anim_markers.c
+++ b/source/blender/editors/animation/anim_markers.c
@@ -846,7 +846,7 @@ static int ed_marker_move_modal(bContext *C, wmOperator *op, const wmEvent *even
applyNumInput(&mm->num, &value);
if (hasNumInput(&mm->num)) {
- outputNumInput(&mm->num, str_tx);
+ outputNumInput(&mm->num, str_tx, scene->unit.scale_length);
}
else {
BLI_snprintf(str_tx, sizeof(str_tx), "%d", (int)value);
diff --git a/source/blender/editors/include/BIF_glutil.h b/source/blender/editors/include/BIF_glutil.h
index 48440d10ae3..b401f06f484 100644
--- a/source/blender/editors/include/BIF_glutil.h
+++ b/source/blender/editors/include/BIF_glutil.h
@@ -222,5 +222,7 @@ void glaDrawImBuf_glsl(struct ImBuf *ibuf, float x, float y, int zoomfilter,
/* Draw imbuf on a screen, preferably using GLSL display transform */
void glaDrawImBuf_glsl_ctx(const struct bContext *C, struct ImBuf *ibuf, float x, float y, int zoomfilter);
+void glaDrawBorderCorners(const struct rcti *border, float zoomx, float zoomy);
+
#endif /* __BIF_GLUTIL_H__ */
diff --git a/source/blender/editors/include/ED_numinput.h b/source/blender/editors/include/ED_numinput.h
index e7b52a49e8c..4e96ed0c7e7 100644
--- a/source/blender/editors/include/ED_numinput.h
+++ b/source/blender/editors/include/ED_numinput.h
@@ -76,7 +76,7 @@ enum {
*/
void initNumInput(NumInput *n);
-void outputNumInput(NumInput *n, char *str);
+void outputNumInput(NumInput *n, char *str, const float scale_length);
bool hasNumInput(const NumInput *n);
bool applyNumInput(NumInput *n, float *vec);
bool handleNumInput(struct bContext *C, NumInput *n, const struct wmEvent *event);
diff --git a/source/blender/editors/include/ED_view3d.h b/source/blender/editors/include/ED_view3d.h
index 43059d9af91..76839747076 100644
--- a/source/blender/editors/include/ED_view3d.h
+++ b/source/blender/editors/include/ED_view3d.h
@@ -332,6 +332,13 @@ void ED_view3d_camera_lock_init(struct View3D *v3d, struct RegionView3D *rv3d);
/* copy the view to the camera, return true if */
bool ED_view3d_camera_lock_sync(struct View3D *v3d, struct RegionView3D *rv3d);
+bool ED_view3d_camera_autokey(
+ struct Scene *scene, struct ID *id_key,
+ struct bContext *C, const bool do_rotate, const bool do_translate);
+bool ED_view3d_camera_lock_autokey(
+ struct View3D *v3d, struct RegionView3D *rv3d,
+ struct bContext *C, const bool do_rotate, const bool do_translate);
+
void ED_view3D_lock_clear(struct View3D *v3d);
struct BGpic *ED_view3D_background_image_new(struct View3D *v3d);
diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h
index 480e8f1e7b8..1565583b574 100644
--- a/source/blender/editors/include/UI_interface.h
+++ b/source/blender/editors/include/UI_interface.h
@@ -844,7 +844,8 @@ void uiTemplateIconView(uiLayout *layout, struct PointerRNA *ptr, const char *pr
void uiTemplateHistogram(uiLayout *layout, struct PointerRNA *ptr, const char *propname);
void uiTemplateWaveform(uiLayout *layout, struct PointerRNA *ptr, const char *propname);
void uiTemplateVectorscope(uiLayout *layout, struct PointerRNA *ptr, const char *propname);
-void uiTemplateCurveMapping(uiLayout *layout, struct PointerRNA *ptr, const char *propname, int type, int levels, int brush);
+void uiTemplateCurveMapping(uiLayout *layout, struct PointerRNA *ptr, const char *propname, int type,
+ int levels, int brush, int neg_slope);
void uiTemplateColorPicker(uiLayout *layout, struct PointerRNA *ptr, const char *propname, int value_slider, int lock, int lock_luminosity, int cubic);
void uiTemplateLayers(uiLayout *layout, struct PointerRNA *ptr, const char *propname,
PointerRNA *used_ptr, const char *used_propname, int active_layer);
diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c
index cc9f8ff00a9..f821aab8c4d 100644
--- a/source/blender/editors/interface/interface_draw.c
+++ b/source/blender/editors/interface/interface_draw.c
@@ -1028,13 +1028,13 @@ static void ui_draw_colorband_handle(
if (active)
glColor3ub(196, 196, 196);
else
- glColor3ub(128, 128, 128);
+ glColor3ub(96, 96, 96);
ui_draw_colorband_handle_tri(x, y1 + height, half_width, half_width, true);
if (active)
glColor3ub(255, 255, 255);
else
- glColor3ub(196, 196, 196);
+ glColor3ub(128, 128, 128);
ui_draw_colorband_handle_tri_hlight(x, y1 + height - 1, (half_width - 1), (half_width - 1));
glColor3ub(0, 0, 0);
diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c
index a3c3fb5e733..6f076abdd35 100644
--- a/source/blender/editors/interface/interface_regions.c
+++ b/source/blender/editors/interface/interface_regions.c
@@ -612,19 +612,29 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but)
rect_fl.xmax = rect_fl.xmin + fontw + (TIP_BORDER_X * 2);
rect_fl.ymax = but->rect.ymin + ofsy - TIP_BORDER_Y;
rect_fl.ymin = rect_fl.ymax - fonth - TIP_BORDER_Y;
-
-#undef TIP_BORDER_X
-#undef TIP_BORDER_Y
/* since the text has beens caled already, the size of tooltips is defined now */
/* here we try to figure out the right location */
if (butregion) {
+ float mx, my;
float ofsx_fl = rect_fl.xmin, ofsy_fl = rect_fl.ymax;
ui_block_to_window_fl(butregion, but->block, &ofsx_fl, &ofsy_fl);
- BLI_rctf_translate(&rect_fl, ofsx_fl - rect_fl.xmin, ofsy_fl - rect_fl.ymax);
+
+#if 1
+ /* use X mouse location */
+ mx = (win->eventstate->x + (TIP_BORDER_X * 2)) - BLI_rctf_cent_x(&but->rect);
+#else
+ mx = ofsx_fl - rect_fl.xmin;
+#endif
+ my = ofsy_fl - rect_fl.ymax;
+
+ BLI_rctf_translate(&rect_fl, mx, my);
}
BLI_rcti_rctf_copy(&rect_i, &rect_fl);
+#undef TIP_BORDER_X
+#undef TIP_BORDER_Y
+
/* clip with window boundaries */
winx = WM_window_pixels_x(win);
diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c
index 74977c2841e..243aa452f17 100644
--- a/source/blender/editors/interface/interface_templates.c
+++ b/source/blender/editors/interface/interface_templates.c
@@ -1954,7 +1954,7 @@ static void curvemap_tools_dofunc(bContext *C, void *cumap_v, int event)
ED_region_tag_redraw(CTX_wm_region(C));
}
-static uiBlock *curvemap_tools_func(bContext *C, ARegion *ar, void *cumap_v)
+static uiBlock *curvemap_tools_posslope_func(bContext *C, ARegion *ar, void *cumap_v)
{
uiBlock *block;
short yco = 0, menuwidth = 10 * UI_UNIT_X;
@@ -1982,6 +1982,34 @@ static uiBlock *curvemap_tools_func(bContext *C, ARegion *ar, void *cumap_v)
return block;
}
+static uiBlock *curvemap_tools_negslope_func(bContext *C, ARegion *ar, void *cumap_v)
+{
+ uiBlock *block;
+ short yco = 0, menuwidth = 10 * UI_UNIT_X;
+
+ block = uiBeginBlock(C, ar, __func__, UI_EMBOSS);
+ uiBlockSetButmFunc(block, curvemap_tools_dofunc, cumap_v);
+
+ uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, IFACE_("Reset View"), 0, yco -= UI_UNIT_Y,
+ menuwidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, UICURVE_FUNC_RESET_VIEW, "");
+ uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, IFACE_("Vector Handle"), 0, yco -= UI_UNIT_Y,
+ menuwidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, UICURVE_FUNC_HANDLE_VECTOR, "");
+ uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, IFACE_("Auto Handle"), 0, yco -= UI_UNIT_Y,
+ menuwidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, UICURVE_FUNC_HANDLE_AUTO, "");
+ uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, IFACE_("Extend Horizontal"), 0, yco -= UI_UNIT_Y,
+ menuwidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, UICURVE_FUNC_EXTEND_HOZ, "");
+ uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, IFACE_("Extend Extrapolated"), 0, yco -= UI_UNIT_Y,
+ menuwidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, UICURVE_FUNC_EXTEND_EXP, "");
+ uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, IFACE_("Reset Curve"), 0, yco -= UI_UNIT_Y,
+ menuwidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, UICURVE_FUNC_RESET_NEG, "");
+
+ uiBlockSetDirection(block, UI_RIGHT);
+ uiTextBoundsBlock(block, 50);
+
+ uiEndBlock(C, block);
+ return block;
+}
+
static uiBlock *curvemap_brush_tools_func(bContext *C, ARegion *ar, void *cumap_v)
{
uiBlock *block;
@@ -2038,7 +2066,7 @@ static void curvemap_buttons_reset(bContext *C, void *cb_v, void *cumap_v)
/* still unsure how this call evolves... we use labeltype for defining what curve-channels to show */
static void curvemap_buttons_layout(uiLayout *layout, PointerRNA *ptr, char labeltype, int levels,
- int brush, RNAUpdateCb *cb)
+ int brush, int neg_slope, RNAUpdateCb *cb)
{
CurveMapping *cumap = ptr->data;
CurveMap *cm = &cumap->cm[cumap->cur];
@@ -2132,8 +2160,12 @@ static void curvemap_buttons_layout(uiLayout *layout, PointerRNA *ptr, char labe
if (brush)
bt = uiDefIconBlockBut(block, curvemap_brush_tools_func, cumap, 0, ICON_MODIFIER, 0, 0, dx, dx, TIP_("Tools"));
+ else if (neg_slope)
+ bt = uiDefIconBlockBut(block, curvemap_tools_negslope_func, cumap, 0, ICON_MODIFIER,
+ 0, 0, dx, dx, TIP_("Tools"));
else
- bt = uiDefIconBlockBut(block, curvemap_tools_func, cumap, 0, ICON_MODIFIER, 0, 0, dx, dx, TIP_("Tools"));
+ bt = uiDefIconBlockBut(block, curvemap_tools_posslope_func, cumap, 0, ICON_MODIFIER,
+ 0, 0, dx, dx, TIP_("Tools"));
uiButSetNFunc(bt, rna_update_cb, MEM_dupallocN(cb), NULL);
@@ -2195,7 +2227,8 @@ static void curvemap_buttons_layout(uiLayout *layout, PointerRNA *ptr, char labe
uiBlockSetNFunc(block, NULL, NULL, NULL);
}
-void uiTemplateCurveMapping(uiLayout *layout, PointerRNA *ptr, const char *propname, int type, int levels, int brush)
+void uiTemplateCurveMapping(uiLayout *layout, PointerRNA *ptr, const char *propname, int type,
+ int levels, int brush, int neg_slope)
{
RNAUpdateCb *cb;
PropertyRNA *prop = RNA_struct_find_property(ptr, propname);
@@ -2226,7 +2259,7 @@ void uiTemplateCurveMapping(uiLayout *layout, PointerRNA *ptr, const char *propn
id = cptr.id.data;
uiBlockSetButLock(block, (id && id->lib), ERROR_LIBDATA_MESSAGE);
- curvemap_buttons_layout(layout, &cptr, type, levels, brush, cb);
+ curvemap_buttons_layout(layout, &cptr, type, levels, brush, neg_slope, cb);
uiBlockClearButLock(block);
@@ -3521,7 +3554,7 @@ void uiTemplateColormanagedViewSettings(uiLayout *layout, bContext *UNUSED(C), P
col = uiLayoutColumn(layout, false);
uiItemR(col, &view_transform_ptr, "use_curve_mapping", 0, NULL, ICON_NONE);
if (view_settings->flag & COLORMANAGE_VIEW_USE_CURVES)
- uiTemplateCurveMapping(col, &view_transform_ptr, "curve_mapping", 'c', true, 0);
+ uiTemplateCurveMapping(col, &view_transform_ptr, "curve_mapping", 'c', true, false, false);
}
/********************************* Component Menu *************************************/
diff --git a/source/blender/editors/mesh/editmesh_bevel.c b/source/blender/editors/mesh/editmesh_bevel.c
index ec1ea3e8e62..e25919b7400 100644
--- a/source/blender/editors/mesh/editmesh_bevel.c
+++ b/source/blender/editors/mesh/editmesh_bevel.c
@@ -79,13 +79,14 @@ static void edbm_bevel_update_header(wmOperator *op, bContext *C)
char msg[HEADER_LENGTH];
ScrArea *sa = CTX_wm_area(C);
+ Scene *sce = CTX_data_scene(C);
if (sa) {
BevelData *opdata = op->customdata;
char offset_str[NUM_STR_REP_LEN];
if (hasNumInput(&opdata->num_input)) {
- outputNumInput(&opdata->num_input, offset_str);
+ outputNumInput(&opdata->num_input, offset_str, sce->unit.scale_length);
}
else {
BLI_snprintf(offset_str, NUM_STR_REP_LEN, "%f", RNA_float_get(op->ptr, "offset"));
diff --git a/source/blender/editors/mesh/editmesh_inset.c b/source/blender/editors/mesh/editmesh_inset.c
index aa3a2c83243..dc40330b309 100644
--- a/source/blender/editors/mesh/editmesh_inset.c
+++ b/source/blender/editors/mesh/editmesh_inset.c
@@ -85,11 +85,12 @@ static void edbm_inset_update_header(wmOperator *op, bContext *C)
char msg[HEADER_LENGTH];
ScrArea *sa = CTX_wm_area(C);
+ Scene *sce = CTX_data_scene(C);
if (sa) {
char flts_str[NUM_STR_REP_LEN * 2];
if (hasNumInput(&opdata->num_input))
- outputNumInput(&opdata->num_input, flts_str);
+ outputNumInput(&opdata->num_input, flts_str, sce->unit.scale_length);
else {
BLI_snprintf(flts_str, NUM_STR_REP_LEN, "%f", RNA_float_get(op->ptr, "thickness"));
BLI_snprintf(flts_str + NUM_STR_REP_LEN, NUM_STR_REP_LEN, "%f", RNA_float_get(op->ptr, "depth"));
diff --git a/source/blender/editors/mesh/editmesh_loopcut.c b/source/blender/editors/mesh/editmesh_loopcut.c
index 4ef6c13ec3e..bb044f39fba 100644
--- a/source/blender/editors/mesh/editmesh_loopcut.c
+++ b/source/blender/editors/mesh/editmesh_loopcut.c
@@ -696,10 +696,11 @@ static int loopcut_modal(bContext *C, wmOperator *op, const wmEvent *event)
}
if (show_cuts) {
+ Scene *sce = CTX_data_scene(C);
char buf[64 + NUM_STR_REP_LEN * 2];
char str_rep[NUM_STR_REP_LEN * 2];
if (hasNumInput(&lcd->num)) {
- outputNumInput(&lcd->num, str_rep);
+ outputNumInput(&lcd->num, str_rep, sce->unit.scale_length);
}
else {
BLI_snprintf(str_rep, NUM_STR_REP_LEN, "%d", cuts);
diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c
index 9d7a3598083..3059d84a085 100644
--- a/source/blender/editors/object/object_relations.c
+++ b/source/blender/editors/object/object_relations.c
@@ -1635,6 +1635,7 @@ static int make_links_data_exec(bContext *C, wmOperator *op)
DAG_relations_tag_update(bmain);
WM_event_add_notifier(C, NC_SPACE | ND_SPACE_VIEW3D, CTX_wm_view3d(C));
+ WM_event_add_notifier(C, NC_ANIMATION | ND_NLA_ACTCHANGE, CTX_wm_view3d(C));
WM_event_add_notifier(C, NC_OBJECT, NULL);
return OPERATOR_FINISHED;
diff --git a/source/blender/editors/screen/glutil.c b/source/blender/editors/screen/glutil.c
index f31d79ff76b..0edde66ffff 100644
--- a/source/blender/editors/screen/glutil.c
+++ b/source/blender/editors/screen/glutil.c
@@ -50,6 +50,8 @@
#include "IMB_colormanagement.h"
#include "IMB_imbuf_types.h"
+#include "UI_interface.h"
+
#ifndef GL_CLAMP_TO_EDGE
#define GL_CLAMP_TO_EDGE 0x812F
#endif
@@ -1139,3 +1141,40 @@ void cpack(unsigned int x)
(((x) >> 8) & 0xFF),
(((x) >> 16) & 0xFF) );
}
+
+void glaDrawBorderCorners(const rcti *border, float zoomx, float zoomy)
+{
+ float delta_x = 4.0f * UI_DPI_FAC / zoomx;
+ float delta_y = 4.0f * UI_DPI_FAC / zoomy;
+
+ delta_x = min_ff(delta_x, border->xmax - border->xmin);
+ delta_y = min_ff(delta_y, border->ymax - border->ymin);
+
+ /* left bottom corner */
+ glBegin(GL_LINE_STRIP);
+ glVertex2f(border->xmin, border->ymin + delta_y);
+ glVertex2f(border->xmin, border->ymin);
+ glVertex2f(border->xmin + delta_x, border->ymin);
+ glEnd();
+
+ /* left top corner */
+ glBegin(GL_LINE_STRIP);
+ glVertex2f(border->xmin, border->ymax - delta_y);
+ glVertex2f(border->xmin, border->ymax);
+ glVertex2f(border->xmin + delta_x, border->ymax);
+ glEnd();
+
+ /* right bottom corner */
+ glBegin(GL_LINE_STRIP);
+ glVertex2f(border->xmax - delta_x, border->ymin);
+ glVertex2f(border->xmax, border->ymin);
+ glVertex2f(border->xmax, border->ymin + delta_y);
+ glEnd();
+
+ /* right top corner */
+ glBegin(GL_LINE_STRIP);
+ glVertex2f(border->xmax - delta_x, border->ymax);
+ glVertex2f(border->xmax, border->ymax);
+ glVertex2f(border->xmax, border->ymax - delta_y);
+ glEnd();
+}
diff --git a/source/blender/editors/space_console/space_console.c b/source/blender/editors/space_console/space_console.c
index 43313c7dd06..e4a61a8f06e 100644
--- a/source/blender/editors/space_console/space_console.c
+++ b/source/blender/editors/space_console/space_console.c
@@ -158,6 +158,18 @@ static void console_main_area_init(wmWindowManager *wm, ARegion *ar)
WM_event_add_dropbox_handler(&ar->handlers, lb);
}
+/* same as 'text_cursor' */
+static void console_cursor(wmWindow *win, ScrArea *sa, ARegion *ar)
+{
+ SpaceText *st = sa->spacedata.first;
+ int wmcursor = BC_TEXTEDITCURSOR;
+
+ if (st->text && BLI_rcti_isect_pt(&st->txtbar, win->eventstate->x - ar->winrct.xmin, st->txtbar.ymin)) {
+ wmcursor = CURSOR_STD;
+ }
+
+ WM_cursor_set(win, wmcursor);
+}
/* ************* dropboxes ************* */
@@ -396,6 +408,7 @@ void ED_spacetype_console(void)
art->init = console_main_area_init;
art->draw = console_main_area_draw;
+ art->cursor = console_cursor;
art->listener = console_main_area_listener;
diff --git a/source/blender/editors/space_graph/graph_draw.c b/source/blender/editors/space_graph/graph_draw.c
index 793a92d4dec..ed7cfe7da99 100644
--- a/source/blender/editors/space_graph/graph_draw.c
+++ b/source/blender/editors/space_graph/graph_draw.c
@@ -476,11 +476,12 @@ static void draw_fcurve_samples(SpaceIpo *sipo, ARegion *ar, FCurve *fcu)
static void draw_fcurve_curve(bAnimContext *ac, ID *id, FCurve *fcu, View2D *v2d, View2DGrid *grid)
{
ChannelDriver *driver;
- float samplefreq, ctime;
+ float samplefreq;
float stime, etime;
float unitFac;
float dx, dy;
short mapping_flag = ANIM_get_normalization_flags(ac);
+ int i, n;
/* when opening a blend file on a different sized screen or while dragging the toolbar this can happen
* best just bail out in this case */
@@ -524,10 +525,12 @@ static void draw_fcurve_curve(bAnimContext *ac, ID *id, FCurve *fcu, View2D *v2d
* the displayed values appear correctly in the viewport
*/
glBegin(GL_LINE_STRIP);
-
- for (ctime = stime; ctime <= etime; ctime += samplefreq)
+
+ for (i = 0, n = (etime - stime) / samplefreq + 0.5f; i < n; ++i) {
+ float ctime = stime + i * samplefreq;
glVertex2f(ctime, evaluate_fcurve(fcu, ctime) * unitFac);
-
+ }
+
glEnd();
/* restore driver */
diff --git a/source/blender/editors/space_image/image_draw.c b/source/blender/editors/space_image/image_draw.c
index 5f996f94a81..79c21bab01c 100644
--- a/source/blender/editors/space_image/image_draw.c
+++ b/source/blender/editors/space_image/image_draw.c
@@ -119,39 +119,7 @@ static void draw_render_info(Scene *scene, Image *ima, ARegion *ar, float zoomx,
UI_ThemeColor(TH_FACE_SELECT);
for (i = 0, tile = tiles; i < total_tiles; i++, tile++) {
- float delta_x = 4.0f * UI_DPI_FAC / zoomx;
- float delta_y = 4.0f * UI_DPI_FAC / zoomy;
-
- delta_x = min_ff(delta_x, tile->xmax - tile->xmin);
- delta_y = min_ff(delta_y, tile->ymax - tile->ymin);
-
- /* left bottom corner */
- glBegin(GL_LINE_STRIP);
- glVertex2f(tile->xmin, tile->ymin + delta_y);
- glVertex2f(tile->xmin, tile->ymin);
- glVertex2f(tile->xmin + delta_x, tile->ymin);
- glEnd();
-
- /* left top corner */
- glBegin(GL_LINE_STRIP);
- glVertex2f(tile->xmin, tile->ymax - delta_y);
- glVertex2f(tile->xmin, tile->ymax);
- glVertex2f(tile->xmin + delta_x, tile->ymax);
- glEnd();
-
- /* right bottom corner */
- glBegin(GL_LINE_STRIP);
- glVertex2f(tile->xmax - delta_x, tile->ymin);
- glVertex2f(tile->xmax, tile->ymin);
- glVertex2f(tile->xmax, tile->ymin + delta_y);
- glEnd();
-
- /* right top corner */
- glBegin(GL_LINE_STRIP);
- glVertex2f(tile->xmax - delta_x, tile->ymax);
- glVertex2f(tile->xmax, tile->ymax);
- glVertex2f(tile->xmax, tile->ymax - delta_y);
- glEnd();
+ glaDrawBorderCorners(tile, zoomx, zoomy);
}
MEM_freeN(tiles);
diff --git a/source/blender/editors/space_image/image_intern.h b/source/blender/editors/space_image/image_intern.h
index 4d391874f9b..8e556378803 100644
--- a/source/blender/editors/space_image/image_intern.h
+++ b/source/blender/editors/space_image/image_intern.h
@@ -90,6 +90,8 @@ void IMAGE_OT_curves_point_set(struct wmOperatorType *ot);
void IMAGE_OT_change_frame(struct wmOperatorType *ot);
+void IMAGE_OT_read_renderlayers(struct wmOperatorType *ot);
+
/* image_panels.c */
struct ImageUser *ntree_get_active_iuser(struct bNodeTree *ntree);
void image_buttons_register(struct ARegionType *art);
diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c
index cc769f13b82..7c021cf6645 100644
--- a/source/blender/editors/space_image/image_ops.c
+++ b/source/blender/editors/space_image/image_ops.c
@@ -2997,3 +2997,35 @@ void IMAGE_OT_change_frame(wmOperatorType *ot)
/* rna */
RNA_def_int(ot->srna, "frame", 0, MINAFRAME, MAXFRAME, "Frame", "", MINAFRAME, MAXFRAME);
}
+
+/* Reload cached render results... */
+/* goes over all scenes, reads render layers */
+static int image_read_renderlayers_exec(bContext *C, wmOperator *UNUSED(op))
+{
+ Scene *scene = CTX_data_scene(C);
+ SpaceImage *sima = CTX_wm_space_image(C);
+ Image *ima;
+
+ ima = BKE_image_verify_viewer(IMA_TYPE_R_RESULT, "Render Result");
+ if (sima->image == NULL) {
+ ED_space_image_set(sima, scene, NULL, ima);
+ }
+
+ RE_ReadRenderResult(scene, scene);
+
+ WM_event_add_notifier(C, NC_IMAGE | NA_EDITED, ima);
+ return OPERATOR_FINISHED;
+}
+
+void IMAGE_OT_read_renderlayers(wmOperatorType *ot)
+{
+ ot->name = "Read Render Layers";
+ ot->idname = "IMAGE_OT_read_renderlayers";
+ ot->description = "Read all the current scene's render layers from cache, as needed";
+
+ ot->poll = space_image_main_area_poll;
+ ot->exec = image_read_renderlayers_exec;
+
+ /* flags */
+ ot->flag = 0;
+}
diff --git a/source/blender/editors/space_image/space_image.c b/source/blender/editors/space_image/space_image.c
index d1868951987..0fb93ad27ee 100644
--- a/source/blender/editors/space_image/space_image.c
+++ b/source/blender/editors/space_image/space_image.c
@@ -255,6 +255,8 @@ static void image_operatortypes(void)
WM_operatortype_append(IMAGE_OT_toolshelf);
WM_operatortype_append(IMAGE_OT_change_frame);
+
+ WM_operatortype_append(IMAGE_OT_read_renderlayers);
}
static void image_keymap(struct wmKeyConfig *keyconf)
@@ -266,6 +268,7 @@ static void image_keymap(struct wmKeyConfig *keyconf)
WM_keymap_add_item(keymap, "IMAGE_OT_new", NKEY, KM_PRESS, KM_ALT, 0);
WM_keymap_add_item(keymap, "IMAGE_OT_open", OKEY, KM_PRESS, KM_ALT, 0);
WM_keymap_add_item(keymap, "IMAGE_OT_reload", RKEY, KM_PRESS, KM_ALT, 0);
+ WM_keymap_add_item(keymap, "IMAGE_OT_read_renderlayers", RKEY, KM_PRESS, KM_CTRL, 0);
WM_keymap_add_item(keymap, "IMAGE_OT_save", SKEY, KM_PRESS, KM_ALT, 0);
WM_keymap_add_item(keymap, "IMAGE_OT_save_as", F3KEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "IMAGE_OT_properties", NKEY, KM_PRESS, 0, 0);
diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c
index 4e709046f45..ef23fc24194 100644
--- a/source/blender/editors/space_node/drawnode.c
+++ b/source/blender/editors/space_node/drawnode.c
@@ -181,7 +181,7 @@ static void node_buts_time(uiLayout *layout, bContext *UNUSED(C), PointerRNA *pt
}
#endif
- uiTemplateCurveMapping(layout, ptr, "curve", 's', 0, 0);
+ uiTemplateCurveMapping(layout, ptr, "curve", 's', false, false, false);
row = uiLayoutRow(layout, true);
uiItemR(row, ptr, "frame_start", 0, IFACE_("Sta"), ICON_NONE);
@@ -195,7 +195,7 @@ static void node_buts_colorramp(uiLayout *layout, bContext *UNUSED(C), PointerRN
static void node_buts_curvevec(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
{
- uiTemplateCurveMapping(layout, ptr, "mapping", 'v', 0, 0);
+ uiTemplateCurveMapping(layout, ptr, "mapping", 'v', false, false, false);
}
#define SAMPLE_FLT_ISNONE FLT_MAX
@@ -223,7 +223,7 @@ static void node_buts_curvecol(uiLayout *layout, bContext *UNUSED(C), PointerRNA
cumap->flag &= ~CUMA_DRAW_SAMPLE;
}
- uiTemplateCurveMapping(layout, ptr, "mapping", 'c', 0, 0);
+ uiTemplateCurveMapping(layout, ptr, "mapping", 'c', false, false, false);
}
static void node_buts_normal(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
@@ -1841,7 +1841,7 @@ static void node_composit_buts_huecorrect(uiLayout *layout, bContext *UNUSED(C),
cumap->flag &= ~CUMA_DRAW_SAMPLE;
}
- uiTemplateCurveMapping(layout, ptr, "mapping", 'h', 0, 0);
+ uiTemplateCurveMapping(layout, ptr, "mapping", 'h', false, false, false);
}
static void node_composit_buts_ycc(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
@@ -3122,20 +3122,17 @@ void draw_nodespace_back_pix(const bContext *C, ARegion *ar, SpaceNode *snode, b
}
if ((snode->nodetree->flag & NTREE_VIEWER_BORDER) &&
- viewer_border->xmin < viewer_border->xmax &&
- viewer_border->ymin < viewer_border->ymax)
+ viewer_border->xmin < viewer_border->xmax &&
+ viewer_border->ymin < viewer_border->ymax)
{
- glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
- setlinestyle(3);
- cpack(0x4040FF);
-
- glRectf(x + snode->zoom * viewer_border->xmin * ibuf->x,
- y + snode->zoom * viewer_border->ymin * ibuf->y,
- x + snode->zoom * viewer_border->xmax * ibuf->x,
- y + snode->zoom * viewer_border->ymax * ibuf->y);
-
- setlinestyle(0);
- glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
+ rcti pixel_border;
+ UI_ThemeColor(TH_ACTIVE);
+ BLI_rcti_init(&pixel_border,
+ x + snode->zoom * viewer_border->xmin * ibuf->x,
+ x + snode->zoom * viewer_border->xmax * ibuf->x,
+ y + snode->zoom * viewer_border->ymin * ibuf->y,
+ y + snode->zoom * viewer_border->ymax * ibuf->y);
+ glaDrawBorderCorners(&pixel_border, 1.0f, 1.0f);
}
}
diff --git a/source/blender/editors/space_node/node_edit.c b/source/blender/editors/space_node/node_edit.c
index 5bbe0c1c229..1c41ce9d86d 100644
--- a/source/blender/editors/space_node/node_edit.c
+++ b/source/blender/editors/space_node/node_edit.c
@@ -2482,14 +2482,6 @@ static int viewer_border_exec(bContext *C, wmOperator *op)
btree->flag &= ~NTREE_VIEWER_BORDER;
}
else {
- if (ibuf->rect)
- memset(ibuf->rect, 0, 4 * ibuf->x * ibuf->y);
-
- if (ibuf->rect_float)
- memset(ibuf->rect_float, 0, 4 * ibuf->x * ibuf->y * sizeof(float));
-
- ibuf->userflags |= IB_DISPLAY_BUFFER_INVALID;
-
btree->flag |= NTREE_VIEWER_BORDER;
}
@@ -2526,3 +2518,30 @@ void NODE_OT_viewer_border(wmOperatorType *ot)
/* properties */
WM_operator_properties_gesture_border(ot, true);
}
+
+static int clear_viewer_border_exec(bContext *C, wmOperator *UNUSED(op))
+{
+ SpaceNode *snode = CTX_wm_space_node(C);
+ bNodeTree *btree = snode->nodetree;
+
+ btree->flag &= ~NTREE_VIEWER_BORDER;
+ snode_notify(C, snode);
+ WM_event_add_notifier(C, NC_NODE | ND_DISPLAY, NULL);
+
+ return OPERATOR_FINISHED;
+}
+
+void NODE_OT_clear_viewer_border(wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name = "Clear Viewer Border";
+ ot->description = "Clear the boundaries for viewer operations";
+ ot->idname = "NODE_OT_clear_viewer_border";
+
+ /* api callbacks */
+ ot->exec = clear_viewer_border_exec;
+ ot->poll = composite_node_active;
+
+ /* flags */
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+}
diff --git a/source/blender/editors/space_node/node_intern.h b/source/blender/editors/space_node/node_intern.h
index fa20aeb8624..86c8e80a228 100644
--- a/source/blender/editors/space_node/node_intern.h
+++ b/source/blender/editors/space_node/node_intern.h
@@ -217,6 +217,7 @@ void NODE_OT_tree_socket_move(struct wmOperatorType *ot);
void NODE_OT_shader_script_update(struct wmOperatorType *ot);
void NODE_OT_viewer_border(struct wmOperatorType *ot);
+void NODE_OT_clear_viewer_border(struct wmOperatorType *ot);
extern const char *node_context_dir[];
diff --git a/source/blender/editors/space_node/node_ops.c b/source/blender/editors/space_node/node_ops.c
index ac541ef6a28..807ed756c77 100644
--- a/source/blender/editors/space_node/node_ops.c
+++ b/source/blender/editors/space_node/node_ops.c
@@ -122,6 +122,7 @@ void node_operatortypes(void)
WM_operatortype_append(NODE_OT_shader_script_update);
WM_operatortype_append(NODE_OT_viewer_border);
+ WM_operatortype_append(NODE_OT_clear_viewer_border);
WM_operatortype_append(NODE_OT_tree_socket_add);
WM_operatortype_append(NODE_OT_tree_socket_remove);
@@ -321,6 +322,7 @@ void node_keymap(struct wmKeyConfig *keyconf)
WM_keymap_add_item(keymap, "NODE_OT_clipboard_paste", VKEY, KM_PRESS, KM_OSKEY, 0);
#endif
WM_keymap_add_item(keymap, "NODE_OT_viewer_border", BKEY, KM_PRESS, KM_CTRL, 0);
+ WM_keymap_add_item(keymap, "NODE_OT_clear_viewer_border", BKEY, KM_PRESS, KM_ALT | KM_CTRL, 0);
transform_keymap_for_space(keyconf, keymap, SPACE_NODE);
}
diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c
index 0e010eff94d..196507f133c 100644
--- a/source/blender/editors/space_view3d/drawobject.c
+++ b/source/blender/editors/space_view3d/drawobject.c
@@ -7171,16 +7171,19 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, const short
const bool is_obact = (ob == OBACT);
const bool render_override = (v3d->flag2 & V3D_RENDER_OVERRIDE) != 0;
const bool is_picking = (G.f & G_PICKSEL) != 0;
+ bool skip_object = false;
bool particle_skip_object = false; /* Draw particles but not their emitter object. */
if (ob != scene->obedit) {
- if (ob->restrictflag & OB_RESTRICT_VIEW) {
- return;
- }
- else if (render_override && ((ob->restrictflag & OB_RESTRICT_RENDER) ||
- (ob->transflag & OB_DUPLI)))
- {
- return;
+ if (ob->restrictflag & OB_RESTRICT_VIEW)
+ skip_object = true;
+
+ if (render_override) {
+ if (ob->restrictflag & OB_RESTRICT_RENDER)
+ skip_object = true;
+
+ if (ob->transflag & OB_DUPLI)
+ skip_object = true; /* note: can be reset by particle "draw emitter" below */
}
}
@@ -7197,6 +7200,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, const short
for (psys = ob->particlesystem.first; psys; psys = psys->next) {
/* Once we have found a psys which renders its emitter object, we are done. */
if (psys->part->draw & PART_DRAW_EMITTER) {
+ skip_object = false;
particle_skip_object = false;
break;
}
@@ -7204,6 +7208,9 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, const short
}
}
+ if (skip_object)
+ return;
+
/* xray delay? */
if ((dflag & DRAW_PICKING) == 0 && (base->flag & OB_FROMDUPLI) == 0 && (v3d->flag2 & V3D_RENDER_SHADOW) == 0) {
/* don't do xray in particle mode, need the z-buffer */
diff --git a/source/blender/editors/space_view3d/view3d_camera_control.c b/source/blender/editors/space_view3d/view3d_camera_control.c
index 230df49f386..e96db2b220f 100644
--- a/source/blender/editors/space_view3d/view3d_camera_control.c
+++ b/source/blender/editors/space_view3d/view3d_camera_control.c
@@ -272,28 +272,8 @@ void ED_view3d_cameracontrol_update(
}
/* record the motion */
- if (use_autokey && autokeyframe_cfra_can_key(scene, id_key)) {
- ListBase dsources = {NULL, NULL};
-
- /* add data-source override for the camera object */
- ANIM_relative_keyingset_add_source(&dsources, id_key, NULL, NULL);
-
- /* insert keyframes
- * 1) on the first frame
- * 2) on each subsequent frame
- * TODO: need to check in future that frame changed before doing this
- */
- if (do_rotate) {
- struct KeyingSet *ks = ANIM_builtin_keyingset_get_named(NULL, ANIM_KS_ROTATION_ID);
- ANIM_apply_keyingset(C, &dsources, NULL, ks, MODIFYKEY_MODE_INSERT, (float)CFRA);
- }
- if (do_translate) {
- struct KeyingSet *ks = ANIM_builtin_keyingset_get_named(NULL, ANIM_KS_LOCATION_ID);
- ANIM_apply_keyingset(C, &dsources, NULL, ks, MODIFYKEY_MODE_INSERT, (float)CFRA);
- }
-
- /* free temp data */
- BLI_freelistN(&dsources);
+ if (use_autokey) {
+ ED_view3d_camera_autokey(scene, id_key, C, do_rotate, do_translate);
}
}
diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c
index 26ede27bb08..762288acfab 100644
--- a/source/blender/editors/space_view3d/view3d_edit.c
+++ b/source/blender/editors/space_view3d/view3d_edit.c
@@ -71,6 +71,7 @@
#include "ED_armature.h"
#include "ED_particle.h"
+#include "ED_keyframing.h"
#include "ED_screen.h"
#include "ED_transform.h"
#include "ED_mesh.h"
@@ -183,6 +184,72 @@ bool ED_view3d_camera_lock_sync(View3D *v3d, RegionView3D *rv3d)
}
}
+bool ED_view3d_camera_autokey(
+ Scene *scene, ID *id_key,
+ struct bContext *C, const bool do_rotate, const bool do_translate)
+{
+ if (autokeyframe_cfra_can_key(scene, id_key)) {
+ ListBase dsources = {NULL, NULL};
+
+ /* add data-source override for the camera object */
+ ANIM_relative_keyingset_add_source(&dsources, id_key, NULL, NULL);
+
+ /* insert keyframes
+ * 1) on the first frame
+ * 2) on each subsequent frame
+ * TODO: need to check in future that frame changed before doing this
+ */
+ if (do_rotate) {
+ struct KeyingSet *ks = ANIM_builtin_keyingset_get_named(NULL, ANIM_KS_ROTATION_ID);
+ ANIM_apply_keyingset(C, &dsources, NULL, ks, MODIFYKEY_MODE_INSERT, (float)CFRA);
+ }
+ if (do_translate) {
+ struct KeyingSet *ks = ANIM_builtin_keyingset_get_named(NULL, ANIM_KS_LOCATION_ID);
+ ANIM_apply_keyingset(C, &dsources, NULL, ks, MODIFYKEY_MODE_INSERT, (float)CFRA);
+ }
+
+ /* free temp data */
+ BLI_freelistN(&dsources);
+
+ return true;
+ }
+ else {
+ return false;
+ }
+}
+
+/**
+ * Call after modifying a locked view.
+ *
+ * \note Not every view edit currently auto-keys (numpad for eg),
+ * this is complicated because of smoothview.
+ */
+bool ED_view3d_camera_lock_autokey(
+ View3D *v3d, RegionView3D *rv3d,
+ struct bContext *C, const bool do_rotate, const bool do_translate)
+{
+ /* similar to ED_view3d_cameracontrol_update */
+ if (ED_view3d_camera_lock_check(v3d, rv3d)) {
+ Scene *scene = CTX_data_scene(C);
+ ID *id_key;
+ Object *root_parent;
+ if ((U.uiflag & USER_CAM_LOCK_NO_PARENT) == 0 && (root_parent = v3d->camera->parent)) {
+ while (root_parent->parent) {
+ root_parent = root_parent->parent;
+ }
+ id_key = &root_parent->id;
+ }
+ else {
+ id_key = &v3d->camera->id;
+ }
+
+ return ED_view3d_camera_autokey(scene, id_key, C, do_rotate, do_translate);
+ }
+ else {
+ return false;
+ }
+}
+
/**
* For viewport operators that exit camera persp.
*
@@ -1052,7 +1119,9 @@ static int viewrotate_modal(bContext *C, wmOperator *op, const wmEvent *event)
viewrotate_apply(vod, event->x, event->y);
}
else if (event_code == VIEW_CONFIRM) {
+ ED_view3d_camera_lock_autokey(vod->v3d, vod->rv3d, C, true, true);
ED_view3d_depth_tag_update(vod->rv3d);
+
viewops_data_free(C, op);
return OPERATOR_FINISHED;
@@ -1860,6 +1929,7 @@ static int viewmove_modal(bContext *C, wmOperator *op, const wmEvent *event)
viewmove_apply(vod, event->x, event->y);
}
else if (event_code == VIEW_CONFIRM) {
+ ED_view3d_camera_lock_autokey(vod->v3d, vod->rv3d, C, false, true);
ED_view3d_depth_tag_update(vod->rv3d);
viewops_data_free(C, op);
@@ -2125,6 +2195,7 @@ static int viewzoom_modal(bContext *C, wmOperator *op, const wmEvent *event)
viewzoom_apply(vod, &event->x, U.viewzoom, (U.uiflag & USER_ZOOM_INVERT) != 0);
}
else if (event_code == VIEW_CONFIRM) {
+ ED_view3d_camera_lock_autokey(vod->v3d, vod->rv3d, C, false, true);
ED_view3d_depth_tag_update(vod->rv3d);
viewops_data_free(C, op);
@@ -2385,6 +2456,7 @@ static int viewdolly_modal(bContext *C, wmOperator *op, const wmEvent *event)
viewdolly_apply(vod, event->x, event->y, (U.uiflag & USER_ZOOM_INVERT) != 0);
}
else if (event_code == VIEW_CONFIRM) {
+ ED_view3d_camera_lock_autokey(vod->v3d, vod->rv3d, C, false, true);
ED_view3d_depth_tag_update(vod->rv3d);
viewops_data_free(C, op);
@@ -3867,6 +3939,7 @@ static int viewroll_modal(bContext *C, wmOperator *op, const wmEvent *event)
viewroll_apply(vod, event->x, event->y);
}
else if (event_code == VIEW_CONFIRM) {
+ ED_view3d_camera_lock_autokey(vod->v3d, vod->rv3d, C, true, false);
ED_view3d_depth_tag_update(vod->rv3d);
viewops_data_free(C, op);
@@ -4148,8 +4221,7 @@ static int background_image_add_invoke(bContext *C, wmOperator *op, const wmEven
if (ima) {
bgpic->ima = ima;
- if (ima->id.us == 0) id_us_plus(&ima->id);
- else id_lib_extern(&ima->id);
+ id_us_plus(&ima->id);
if (!(v3d->flag & V3D_DISPBGPICS))
v3d->flag |= V3D_DISPBGPICS;
@@ -4191,7 +4263,15 @@ static int background_image_remove_exec(bContext *C, wmOperator *op)
BGpic *bgpic_rem = BLI_findlink(&v3d->bgpicbase, index);
if (bgpic_rem) {
+ if (bgpic_rem->source == V3D_BGPIC_IMAGE) {
+ id_us_min((ID *)bgpic_rem->ima);
+ }
+ else if (bgpic_rem->source == V3D_BGPIC_MOVIE) {
+ id_us_min((ID *)bgpic_rem->clip);
+ }
+
ED_view3D_background_image_remove(v3d, bgpic_rem);
+
WM_event_add_notifier(C, NC_SPACE | ND_SPACE_VIEW3D, v3d);
return OPERATOR_FINISHED;
}
diff --git a/source/blender/editors/space_view3d/view3d_ops.c b/source/blender/editors/space_view3d/view3d_ops.c
index 612bdfa27b9..7e101fea138 100644
--- a/source/blender/editors/space_view3d/view3d_ops.c
+++ b/source/blender/editors/space_view3d/view3d_ops.c
@@ -77,7 +77,7 @@ static int view3d_copybuffer_exec(bContext *C, wmOperator *op)
}
CTX_DATA_END;
- BLI_make_file_string("/", str, BLI_temp_dir_session(), "copybuffer.blend");
+ BLI_make_file_string("/", str, BLI_temp_dir_base(), "copybuffer.blend");
BKE_copybuffer_save(str, op->reports);
BKE_report(op->reports, RPT_INFO, "Copied selected objects to buffer");
@@ -102,7 +102,7 @@ static int view3d_pastebuffer_exec(bContext *C, wmOperator *op)
{
char str[FILE_MAX];
- BLI_make_file_string("/", str, BLI_temp_dir_session(), "copybuffer.blend");
+ BLI_make_file_string("/", str, BLI_temp_dir_base(), "copybuffer.blend");
if (BKE_copybuffer_paste(C, str, op->reports)) {
WM_event_add_notifier(C, NC_WINDOW, NULL);
diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c
index 33d52ec1a00..32ba4ba763b 100644
--- a/source/blender/editors/transform/transform.c
+++ b/source/blender/editors/transform/transform.c
@@ -2841,7 +2841,7 @@ static void Bend(TransInfo *t, const int UNUSED(mval[2]))
if (hasNumInput(&t->num)) {
char c[NUM_STR_REP_LEN * 2];
- outputNumInput(&(t->num), c);
+ outputNumInput(&(t->num), c, t->scene->unit.scale_length);
BLI_snprintf(str, MAX_INFO_LEN, IFACE_("Bend Angle: %s Radius: %s Alt, Clamp %s"),
&c[0], &c[NUM_STR_REP_LEN],
@@ -3009,7 +3009,7 @@ static void applyShear(TransInfo *t, const int UNUSED(mval[2]))
if (hasNumInput(&t->num)) {
char c[NUM_STR_REP_LEN];
- outputNumInput(&(t->num), c);
+ outputNumInput(&(t->num), c, t->scene->unit.scale_length);
BLI_snprintf(str, MAX_INFO_LEN, IFACE_("Shear: %s %s"), c, t->proptext);
}
@@ -3108,7 +3108,7 @@ static void headerResize(TransInfo *t, float vec[3], char str[MAX_INFO_LEN])
char tvec[NUM_STR_REP_LEN * 3];
size_t ofs = 0;
if (hasNumInput(&t->num)) {
- outputNumInput(&(t->num), tvec);
+ outputNumInput(&(t->num), tvec, t->scene->unit.scale_length);
}
else {
BLI_snprintf(&tvec[0], NUM_STR_REP_LEN, "%.4f", vec[0]);
@@ -3520,7 +3520,7 @@ static void applyToSphere(TransInfo *t, const int UNUSED(mval[2]))
if (hasNumInput(&t->num)) {
char c[NUM_STR_REP_LEN];
- outputNumInput(&(t->num), c);
+ outputNumInput(&(t->num), c, t->scene->unit.scale_length);
BLI_snprintf(str, MAX_INFO_LEN, IFACE_("To Sphere: %s %s"), c, t->proptext);
}
@@ -3877,7 +3877,7 @@ static void applyRotation(TransInfo *t, const int UNUSED(mval[2]))
if (hasNumInput(&t->num)) {
char c[NUM_STR_REP_LEN];
- outputNumInput(&(t->num), c);
+ outputNumInput(&(t->num), c, t->scene->unit.scale_length);
ofs += BLI_snprintf(str + ofs, MAX_INFO_LEN - ofs, IFACE_("Rot: %s %s %s"), &c[0], t->con.text, t->proptext);
}
@@ -3981,7 +3981,7 @@ static void applyTrackball(TransInfo *t, const int UNUSED(mval[2]))
if (hasNumInput(&t->num)) {
char c[NUM_STR_REP_LEN * 2];
- outputNumInput(&(t->num), c);
+ outputNumInput(&(t->num), c, t->scene->unit.scale_length);
ofs += BLI_snprintf(str + ofs, MAX_INFO_LEN - ofs, IFACE_("Trackball: %s %s %s"),
&c[0], &c[NUM_STR_REP_LEN], t->proptext);
@@ -4083,7 +4083,7 @@ static void headerTranslation(TransInfo *t, float vec[3], char str[MAX_INFO_LEN]
float dist;
if (hasNumInput(&t->num)) {
- outputNumInput(&(t->num), tvec);
+ outputNumInput(&(t->num), tvec, t->scene->unit.scale_length);
dist = len_v3(t->num.val);
}
else {
@@ -4331,7 +4331,7 @@ static void applyShrinkFatten(TransInfo *t, const int UNUSED(mval[2]))
ofs += BLI_strncpy_rlen(str + ofs, IFACE_("Shrink/Fatten:"), MAX_INFO_LEN - ofs);
if (hasNumInput(&t->num)) {
char c[NUM_STR_REP_LEN];
- outputNumInput(&(t->num), c);
+ outputNumInput(&(t->num), c, t->scene->unit.scale_length);
ofs += BLI_snprintf(str + ofs, MAX_INFO_LEN - ofs, " %s", c);
}
else {
@@ -4426,7 +4426,7 @@ static void applyTilt(TransInfo *t, const int UNUSED(mval[2]))
if (hasNumInput(&t->num)) {
char c[NUM_STR_REP_LEN];
- outputNumInput(&(t->num), c);
+ outputNumInput(&(t->num), c, t->scene->unit.scale_length);
BLI_snprintf(str, MAX_INFO_LEN, IFACE_("Tilt: %s° %s"), &c[0], t->proptext);
@@ -4502,7 +4502,7 @@ static void applyCurveShrinkFatten(TransInfo *t, const int UNUSED(mval[2]))
if (hasNumInput(&t->num)) {
char c[NUM_STR_REP_LEN];
- outputNumInput(&(t->num), c);
+ outputNumInput(&(t->num), c, t->scene->unit.scale_length);
BLI_snprintf(str, MAX_INFO_LEN, IFACE_("Shrink/Fatten: %s"), c);
}
else {
@@ -4578,7 +4578,7 @@ static void applyMaskShrinkFatten(TransInfo *t, const int UNUSED(mval[2]))
if (hasNumInput(&t->num)) {
char c[NUM_STR_REP_LEN];
- outputNumInput(&(t->num), c);
+ outputNumInput(&(t->num), c, t->scene->unit.scale_length);
BLI_snprintf(str, MAX_INFO_LEN, IFACE_("Feather Shrink/Fatten: %s"), c);
}
else {
@@ -4671,7 +4671,7 @@ static void applyPushPull(TransInfo *t, const int UNUSED(mval[2]))
if (hasNumInput(&t->num)) {
char c[NUM_STR_REP_LEN];
- outputNumInput(&(t->num), c);
+ outputNumInput(&(t->num), c, t->scene->unit.scale_length);
BLI_snprintf(str, MAX_INFO_LEN, IFACE_("Push/Pull: %s%s %s"), c, t->con.text, t->proptext);
}
@@ -4764,7 +4764,7 @@ static void applyBevelWeight(TransInfo *t, const int UNUSED(mval[2]))
if (hasNumInput(&t->num)) {
char c[NUM_STR_REP_LEN];
- outputNumInput(&(t->num), c);
+ outputNumInput(&(t->num), c, t->scene->unit.scale_length);
if (weight >= 0.0f)
BLI_snprintf(str, MAX_INFO_LEN, IFACE_("Bevel Weight: +%s %s"), c, t->proptext);
@@ -4842,7 +4842,7 @@ static void applyCrease(TransInfo *t, const int UNUSED(mval[2]))
if (hasNumInput(&t->num)) {
char c[NUM_STR_REP_LEN];
- outputNumInput(&(t->num), c);
+ outputNumInput(&(t->num), c, t->scene->unit.scale_length);
if (crease >= 0.0f)
BLI_snprintf(str, MAX_INFO_LEN, IFACE_("Crease: +%s %s"), c, t->proptext);
@@ -4912,7 +4912,7 @@ static void headerBoneSize(TransInfo *t, float vec[3], char str[MAX_INFO_LEN])
{
char tvec[NUM_STR_REP_LEN * 3];
if (hasNumInput(&t->num)) {
- outputNumInput(&(t->num), tvec);
+ outputNumInput(&(t->num), tvec, t->scene->unit.scale_length);
}
else {
BLI_snprintf(&tvec[0], NUM_STR_REP_LEN, "%.4f", vec[0]);
@@ -5049,7 +5049,7 @@ static void applyBoneEnvelope(TransInfo *t, const int UNUSED(mval[2]))
if (hasNumInput(&t->num)) {
char c[NUM_STR_REP_LEN];
- outputNumInput(&(t->num), c);
+ outputNumInput(&(t->num), c, t->scene->unit.scale_length);
BLI_snprintf(str, MAX_INFO_LEN, IFACE_("Envelope: %s"), c);
}
else {
@@ -6224,7 +6224,7 @@ static void applyEdgeSlide(TransInfo *t, const int UNUSED(mval[2]))
if (hasNumInput(&t->num)) {
char c[NUM_STR_REP_LEN];
- outputNumInput(&(t->num), c);
+ outputNumInput(&(t->num), c, t->scene->unit.scale_length);
if (is_proportional) {
BLI_snprintf(str, MAX_INFO_LEN, IFACE_("Edge Slide: %s (E)ven: %s"),
@@ -6747,7 +6747,7 @@ static void applyVertSlide(TransInfo *t, const int UNUSED(mval[2]))
ofs += BLI_strncpy_rlen(str + ofs, IFACE_("Vert Slide: "), MAX_INFO_LEN - ofs);
if (hasNumInput(&t->num)) {
char c[NUM_STR_REP_LEN];
- outputNumInput(&(t->num), c);
+ outputNumInput(&(t->num), c, t->scene->unit.scale_length);
ofs += BLI_strncpy_rlen(str + ofs, &c[0], MAX_INFO_LEN - ofs);
}
else {
@@ -6814,7 +6814,7 @@ static void applyBoneRoll(TransInfo *t, const int UNUSED(mval[2]))
if (hasNumInput(&t->num)) {
char c[NUM_STR_REP_LEN];
- outputNumInput(&(t->num), c);
+ outputNumInput(&(t->num), c, t->scene->unit.scale_length);
BLI_snprintf(str, MAX_INFO_LEN, IFACE_("Roll: %s"), &c[0]);
}
@@ -6888,7 +6888,7 @@ static void applyBakeTime(TransInfo *t, const int mval[2])
if (hasNumInput(&t->num)) {
char c[NUM_STR_REP_LEN];
- outputNumInput(&(t->num), c);
+ outputNumInput(&(t->num), c, t->scene->unit.scale_length);
if (time >= 0.0f)
BLI_snprintf(str, MAX_INFO_LEN, IFACE_("Time: +%s %s"), c, t->proptext);
@@ -7099,7 +7099,7 @@ static void headerSeqSlide(TransInfo *t, float val[2], char str[MAX_INFO_LEN])
size_t ofs = 0;
if (hasNumInput(&t->num)) {
- outputNumInput(&(t->num), tvec);
+ outputNumInput(&(t->num), tvec, t->scene->unit.scale_length);
}
else {
BLI_snprintf(&tvec[0], NUM_STR_REP_LEN, "%.0f, %.0f", val[0], val[1]);
@@ -7325,7 +7325,7 @@ static void headerTimeTranslate(TransInfo *t, char str[MAX_INFO_LEN])
/* if numeric input is active, use results from that, otherwise apply snapping to result */
if (hasNumInput(&t->num)) {
- outputNumInput(&(t->num), tvec);
+ outputNumInput(&(t->num), tvec, t->scene->unit.scale_length);
}
else {
const Scene *scene = t->scene;
@@ -7489,7 +7489,7 @@ static void headerTimeSlide(TransInfo *t, float sval, char str[MAX_INFO_LEN])
char tvec[NUM_STR_REP_LEN * 3];
if (hasNumInput(&t->num)) {
- outputNumInput(&(t->num), tvec);
+ outputNumInput(&(t->num), tvec, t->scene->unit.scale_length);
}
else {
float minx = *((float *)(t->customData));
@@ -7637,7 +7637,7 @@ static void headerTimeScale(TransInfo *t, char str[MAX_INFO_LEN])
char tvec[NUM_STR_REP_LEN * 3];
if (hasNumInput(&t->num))
- outputNumInput(&(t->num), tvec);
+ outputNumInput(&(t->num), tvec, t->scene->unit.scale_length);
else
BLI_snprintf(&tvec[0], NUM_STR_REP_LEN, "%.4f", t->values[0]);
diff --git a/source/blender/editors/util/numinput.c b/source/blender/editors/util/numinput.c
index 26b9d8b5d71..a618ab8419b 100644
--- a/source/blender/editors/util/numinput.c
+++ b/source/blender/editors/util/numinput.c
@@ -87,15 +87,18 @@ void initNumInput(NumInput *n)
}
/* str must be NUM_STR_REP_LEN * (idx_max + 1) length. */
-void outputNumInput(NumInput *n, char *str)
+void outputNumInput(NumInput *n, char *str, const float scale_length)
{
- short i, j;
+ short j;
const int ln = NUM_STR_REP_LEN;
int prec = 2; /* draw-only, and avoids too much issues with radian->degrees conversion. */
for (j = 0; j <= n->idx_max; j++) {
/* if AFFECTALL and no number typed and cursor not on number, use first number */
- i = (n->flag & NUM_AFFECT_ALL && n->idx != j && !(n->val_flag[j] & NUM_EDITED)) ? 0 : j;
+ const short i = (n->flag & NUM_AFFECT_ALL && n->idx != j && !(n->val_flag[j] & NUM_EDITED)) ? 0 : j;
+
+ /* Use scale_length if needed! */
+ const float fac = ELEM3(n->unit_type[j], B_UNIT_LENGTH, B_UNIT_AREA, B_UNIT_VOLUME) ? scale_length : 1.0f;
if (n->val_flag[i] & NUM_EDITED) {
/* Get the best precision, allows us to draw '10.0001' as '10' instead! */
@@ -118,7 +121,7 @@ void outputNumInput(NumInput *n, char *str)
BLI_strncpy(val, "Invalid", sizeof(val));
}
else {
- bUnit_AsString(val, sizeof(val), (double)n->val[i], prec,
+ bUnit_AsString(val, sizeof(val), (double)(n->val[i] * fac), prec,
n->unit_sys, n->unit_type[i], true, false);
}
@@ -466,7 +469,9 @@ bool handleNumInput(bContext *C, NumInput *n, const wmEvent *event)
/* At this point, our value has changed, try to interpret it with python (if str is not empty!). */
if (n->str[0]) {
#ifdef WITH_PYTHON
+ Scene *sce = CTX_data_scene(C);
double val;
+ float fac = 1.0f;
char str_unit_convert[NUM_STR_REP_LEN * 6]; /* Should be more than enough! */
const char *default_unit = NULL;
@@ -474,6 +479,10 @@ bool handleNumInput(bContext *C, NumInput *n, const wmEvent *event)
if (n->unit_use_radians && n->unit_type[idx] == B_UNIT_ROTATION)
default_unit = "r";
+ /* Use scale_length if needed! */
+ if (ELEM3(n->unit_type[idx], B_UNIT_LENGTH, B_UNIT_AREA, B_UNIT_VOLUME))
+ fac /= sce->unit.scale_length;
+
BLI_strncpy(str_unit_convert, n->str, sizeof(str_unit_convert));
bUnit_ReplaceString(str_unit_convert, sizeof(str_unit_convert), default_unit, 1.0,
@@ -481,7 +490,7 @@ bool handleNumInput(bContext *C, NumInput *n, const wmEvent *event)
/* Note: with angles, we always get values as radians here... */
if (BPY_button_exec(C, str_unit_convert, &val, false) != -1) {
- n->val[idx] = (float)val;
+ n->val[idx] = (float)val * fac;
n->val_flag[idx] &= ~NUM_INVALID;
}
else {
diff --git a/source/blender/freestyle/intern/blender_interface/BlenderFileLoader.cpp b/source/blender/freestyle/intern/blender_interface/BlenderFileLoader.cpp
index b504d2c8c40..26a304ccf69 100644
--- a/source/blender/freestyle/intern/blender_interface/BlenderFileLoader.cpp
+++ b/source/blender/freestyle/intern/blender_interface/BlenderFileLoader.cpp
@@ -395,6 +395,8 @@ void BlenderFileLoader::insertShapeNode(ObjectInstanceRen *obi, int id)
vlr = obr->vlaknodes[a>>8].vlak;
else
vlr++;
+ if (vlr->mat->mode & MA_ONLYCAST)
+ continue;
if (vlr->mat->material_type == MA_TYPE_WIRE) {
wire_material = 1;
continue;
@@ -492,7 +494,7 @@ void BlenderFileLoader::insertShapeNode(ObjectInstanceRen *obi, int id)
vlr = obr->vlaknodes[p>>8].vlak;
else
vlr++;
- if (vlr->mat->material_type == MA_TYPE_WIRE)
+ if ((vlr->mat->mode & MA_ONLYCAST) || vlr->mat->material_type == MA_TYPE_WIRE)
continue;
copy_v3_v3(v1, vlr->v1->co);
copy_v3_v3(v2, vlr->v2->co);
diff --git a/source/blender/freestyle/intern/python/Director.cpp b/source/blender/freestyle/intern/python/Director.cpp
index db287fd054d..653fd0b1d29 100644
--- a/source/blender/freestyle/intern/python/Director.cpp
+++ b/source/blender/freestyle/intern/python/Director.cpp
@@ -74,7 +74,7 @@ int Director_BPy_BinaryPredicate0D___call__(BinaryPredicate0D *bp0D, Interface0D
Py_XDECREF(arg2);
return -1;
}
- PyObject *result = PyObject_CallMethod((PyObject *)bp0D->py_bp0D, (char *)"__call__", (char *)"OO", arg1, arg2);
+ PyObject *result = PyObject_CallMethod((PyObject *)bp0D->py_bp0D, "__call__", "OO", arg1, arg2);
Py_DECREF(arg1);
Py_DECREF(arg2);
if (!result)
@@ -101,7 +101,7 @@ int Director_BPy_BinaryPredicate1D___call__(BinaryPredicate1D *bp1D, Interface1D
Py_XDECREF(arg2);
return -1;
}
- PyObject *result = PyObject_CallMethod((PyObject *)bp1D->py_bp1D, (char *)"__call__", (char *)"OO", arg1, arg2);
+ PyObject *result = PyObject_CallMethod((PyObject *)bp1D->py_bp1D, "__call__", "OO", arg1, arg2);
Py_DECREF(arg1);
Py_DECREF(arg2);
if (!result)
@@ -124,7 +124,7 @@ int Director_BPy_UnaryPredicate0D___call__(UnaryPredicate0D *up0D, Interface0DIt
PyObject *arg = BPy_Interface0DIterator_from_Interface0DIterator(if0D_it, false);
if (!arg)
return -1;
- PyObject *result = PyObject_CallMethod((PyObject *)up0D->py_up0D, (char *)"__call__", (char *)"O", arg);
+ PyObject *result = PyObject_CallMethod((PyObject *)up0D->py_up0D, "__call__", "O", arg);
Py_DECREF(arg);
if (!result)
return -1;
@@ -146,7 +146,7 @@ int Director_BPy_UnaryPredicate1D___call__(UnaryPredicate1D *up1D, Interface1D&
PyObject *arg = Any_BPy_Interface1D_from_Interface1D(if1D);
if (!arg)
return -1;
- PyObject *result = PyObject_CallMethod((PyObject *)up1D->py_up1D, (char *)"__call__", (char *)"O", arg);
+ PyObject *result = PyObject_CallMethod((PyObject *)up1D->py_up1D, "__call__", "O", arg);
Py_DECREF(arg);
if (!result)
return -1;
@@ -168,7 +168,7 @@ int Director_BPy_StrokeShader_shade(StrokeShader *ss, Stroke& s)
PyObject *arg = BPy_Stroke_from_Stroke(s);
if (!arg)
return -1;
- PyObject *result = PyObject_CallMethod((PyObject *)ss->py_ss, (char *)"shade", (char *)"O", arg);
+ PyObject *result = PyObject_CallMethod((PyObject *)ss->py_ss, "shade", "O", arg);
Py_DECREF(arg);
if (!result)
return -1;
@@ -183,7 +183,7 @@ int Director_BPy_ChainingIterator_init(ChainingIterator *c_it)
PyErr_SetString(PyExc_RuntimeError, "Reference to Python object (py_c_it) not initialized");
return -1;
}
- PyObject *result = PyObject_CallMethod((PyObject *)c_it->py_c_it, (char *)"init", NULL);
+ PyObject *result = PyObject_CallMethod((PyObject *)c_it->py_c_it, "init", NULL);
if (!result)
return -1;
Py_DECREF(result);
@@ -199,7 +199,7 @@ int Director_BPy_ChainingIterator_traverse(ChainingIterator *c_it, AdjacencyIter
PyObject *arg = BPy_AdjacencyIterator_from_AdjacencyIterator(a_it);
if (!arg)
return -1;
- PyObject *result = PyObject_CallMethod((PyObject *)c_it->py_c_it, (char *)"traverse", (char *)"O", arg);
+ PyObject *result = PyObject_CallMethod((PyObject *)c_it->py_c_it, "traverse", "O", arg);
Py_DECREF(arg);
if (!result)
return -1;
@@ -229,7 +229,7 @@ int Director_BPy_UnaryFunction0D___call__(void *uf0D, void *py_uf0D, Interface0D
PyObject *arg = BPy_Interface0DIterator_from_Interface0DIterator(if0D_it, false);
if (!arg)
return -1;
- PyObject *result = PyObject_CallMethod(obj, (char *)"__call__", (char *)"O", arg);
+ PyObject *result = PyObject_CallMethod(obj, "__call__", "O", arg);
Py_DECREF(arg);
if (!result)
return -1;
@@ -288,7 +288,7 @@ int Director_BPy_UnaryFunction1D___call__(void *uf1D, void *py_uf1D, Interface1D
PyObject *arg = Any_BPy_Interface1D_from_Interface1D(if1D);
if (!arg)
return -1;
- PyObject *result = PyObject_CallMethod(obj, (char *)"__call__", (char *)"O", arg);
+ PyObject *result = PyObject_CallMethod(obj, "__call__", "O", arg);
Py_DECREF(arg);
if (!result)
return -1;
diff --git a/source/blender/freestyle/intern/winged_edge/WEdge.h b/source/blender/freestyle/intern/winged_edge/WEdge.h
index 6699a8113b6..41525e03d8e 100644
--- a/source/blender/freestyle/intern/winged_edge/WEdge.h
+++ b/source/blender/freestyle/intern/winged_edge/WEdge.h
@@ -1295,7 +1295,9 @@ protected:
class WingedEdge
{
public:
- WingedEdge() {}
+ WingedEdge() {
+ _numFaces = 0;
+ }
~WingedEdge()
{
diff --git a/source/blender/gpu/GPU_material.h b/source/blender/gpu/GPU_material.h
index b7f7633461c..a111401343e 100644
--- a/source/blender/gpu/GPU_material.h
+++ b/source/blender/gpu/GPU_material.h
@@ -149,6 +149,7 @@ void GPU_material_vertex_attributes(GPUMaterial *material,
struct GPUVertexAttribs *attrib);
bool GPU_material_do_color_management(GPUMaterial *mat);
+bool GPU_material_use_new_shading_nodes(GPUMaterial *mat);
/* Exported shading */
diff --git a/source/blender/gpu/intern/gpu_material.c b/source/blender/gpu/intern/gpu_material.c
index 52690ddb371..5a20936e26f 100644
--- a/source/blender/gpu/intern/gpu_material.c
+++ b/source/blender/gpu/intern/gpu_material.c
@@ -422,6 +422,11 @@ bool GPU_material_do_color_management(GPUMaterial *mat)
return !((mat->scene->gm.flag & GAME_GLSL_NO_COLOR_MANAGEMENT));
}
+bool GPU_material_use_new_shading_nodes(GPUMaterial *mat)
+{
+ return BKE_scene_use_new_shading_nodes(mat->scene);
+}
+
static GPUNodeLink *lamp_get_visibility(GPUMaterial *mat, GPULamp *lamp, GPUNodeLink **lv, GPUNodeLink **dist)
{
GPUNodeLink *visifac, *inpr;
diff --git a/source/blender/imbuf/CMakeLists.txt b/source/blender/imbuf/CMakeLists.txt
index 4025a41b6a7..e8977913948 100644
--- a/source/blender/imbuf/CMakeLists.txt
+++ b/source/blender/imbuf/CMakeLists.txt
@@ -36,7 +36,7 @@ set(INC
set(INC_SYS
${JPEG_INCLUDE_DIR}
- ${PNG_INCLUDE_DIR}
+ ${PNG_INCLUDE_DIRS}
${ZLIB_INCLUDE_DIRS}
)
diff --git a/source/blender/imbuf/intern/png.c b/source/blender/imbuf/intern/png.c
index b620dbd9b10..67aeda5d0b9 100644
--- a/source/blender/imbuf/intern/png.c
+++ b/source/blender/imbuf/intern/png.c
@@ -35,8 +35,10 @@
#include "BLI_utildefines.h"
#include "BLI_fileops.h"
-
#include "BLI_math.h"
+
+#include "BKE_global.h"
+
#include "MEM_guardedalloc.h"
#include "imbuf.h"
@@ -484,6 +486,23 @@ int imb_savepng(struct ImBuf *ibuf, const char *name, int flags)
return(1);
}
+static void imb_png_warning(png_structp UNUSED(png_ptr), png_const_charp message)
+{
+ /* We supress iCCP warnings. That's how Blender always used to behave,
+ * and with new libpng it became too much picky, giving a warning on
+ * the splash screen even.
+ */
+ if ((G.debug & G_DEBUG) == 0 && !strncmp(message, "iCCP", 4)) {
+ return;
+ }
+ fprintf(stderr, "libpng warning: %s\n", message);
+}
+
+static void imb_png_error(png_structp UNUSED(png_ptr), png_const_charp message)
+{
+ fprintf(stderr, "libpng error: %s\n", message);
+}
+
ImBuf *imb_loadpng(unsigned char *mem, size_t size, int flags, char colorspace[IM_MAX_SPACE])
{
struct ImBuf *ibuf = NULL;
@@ -513,6 +532,8 @@ ImBuf *imb_loadpng(unsigned char *mem, size_t size, int flags, char colorspace[I
return NULL;
}
+ png_set_error_fn(png_ptr, NULL, imb_png_error, imb_png_warning);
+
info_ptr = png_create_info_struct(png_ptr);
if (info_ptr == NULL) {
png_destroy_read_struct(&png_ptr, (png_infopp)NULL,
diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h
index c95cdb5c1f8..6b1cad120a7 100644
--- a/source/blender/makesdna/DNA_scene_types.h
+++ b/source/blender/makesdna/DNA_scene_types.h
@@ -1377,6 +1377,7 @@ typedef struct Scene {
/* #define R_RECURS_PROTECTION 0x20000 */
#define R_TEXNODE_PREVIEW 0x40000
#define R_VIEWPORT_PREVIEW 0x80000
+#define R_EXR_CACHE_FILE 0x100000
/* r->stamp */
#define R_STAMP_TIME 0x0001
diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h
index 987985f0ba7..cb2341b0b7f 100644
--- a/source/blender/makesdna/DNA_userdef_types.h
+++ b/source/blender/makesdna/DNA_userdef_types.h
@@ -422,6 +422,8 @@ typedef struct UserDef {
char tempdir[768]; /* FILE_MAXDIR length */
char fontdir[768];
char renderdir[1024]; /* FILE_MAX length */
+ /* EXR cache path */
+ char render_cachedir[768]; /* 768 = FILE_MAXDIR */
char textudir[768];
char pythondir[768];
char sounddir[768];
diff --git a/source/blender/makesrna/intern/rna_actuator.c b/source/blender/makesrna/intern/rna_actuator.c
index 3cc530ec368..62e681d1374 100644
--- a/source/blender/makesrna/intern/rna_actuator.c
+++ b/source/blender/makesrna/intern/rna_actuator.c
@@ -2061,7 +2061,7 @@ static void rna_def_mouse_actuator(BlenderRNA *brna)
};
srna = RNA_def_struct(brna, "MouseActuator", "Actuator");
- RNA_def_struct_ui_text(srna, "Mouse Actuator", "Actuator to ..");
+ RNA_def_struct_ui_text(srna, "Mouse Actuator", "");
RNA_def_struct_sdna_from(srna, "bMouseActuator", "data");
prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
@@ -2089,12 +2089,14 @@ static void rna_def_mouse_actuator(BlenderRNA *brna)
prop = RNA_def_property(srna, "reset_x", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_MOUSE_RESET_X);
- RNA_def_property_ui_text(prop, "Reset", "Reset the cursor's X position to the center of the screen space after calculating");
+ RNA_def_property_ui_text(prop, "Reset",
+ "Reset the cursor's X position to the center of the screen space after calculating");
RNA_def_property_update(prop, NC_LOGIC, NULL);
prop = RNA_def_property(srna, "reset_y", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_MOUSE_RESET_Y);
- RNA_def_property_ui_text(prop, "Reset", "Reset the cursor's Y position to the center of the screen space after calculating");
+ RNA_def_property_ui_text(prop, "Reset",
+ "Reset the cursor's Y position to the center of the screen space after calculating");
RNA_def_property_update(prop, NC_LOGIC, NULL);
prop = RNA_def_property(srna, "local_x", PROP_BOOLEAN, PROP_NONE);
@@ -2110,61 +2112,61 @@ static void rna_def_mouse_actuator(BlenderRNA *brna)
prop = RNA_def_property(srna, "threshold_x", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "threshold[0]");
RNA_def_property_ui_range(prop, 0, 0.5, 1, 3);
- RNA_def_property_ui_text(prop, "Threshold", "The amount of X motion before mouse movement will register");
+ RNA_def_property_ui_text(prop, "Threshold", "Amount of X motion before mouse movement will register");
RNA_def_property_update(prop, NC_LOGIC, NULL);
prop = RNA_def_property(srna, "threshold_y", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "threshold[1]");
RNA_def_property_ui_range(prop, 0, 0.5, 1, 3);
- RNA_def_property_ui_text(prop, "Threshold", "The amount of Y motion before mouse movement will register");
+ RNA_def_property_ui_text(prop, "Threshold", "Amount of Y motion before mouse movement will register");
RNA_def_property_update(prop, NC_LOGIC, NULL);
prop = RNA_def_property(srna, "object_axis_x", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "object_axis[0]");
RNA_def_property_enum_items(prop, prop_object_axis_items);
- RNA_def_property_ui_text(prop, "Obj Axis", "Local object axis mouse movement in the X direction will apply to");
+ RNA_def_property_ui_text(prop, "Object Axis", "Local object axis mouse movement in the X direction will apply to");
RNA_def_property_update(prop, NC_LOGIC, NULL);
prop = RNA_def_property(srna, "object_axis_y", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "object_axis[1]");
RNA_def_property_enum_items(prop, prop_object_axis_items);
- RNA_def_property_ui_text(prop, "Obj Axis", "The object axis mouse movement in the Y direction will apply to");
+ RNA_def_property_ui_text(prop, "Object Axis", "Local object axis mouse movement in the Y direction will apply to");
RNA_def_property_update(prop, NC_LOGIC, NULL);
prop = RNA_def_property(srna, "sensitivity_x", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "sensitivity[0]");
RNA_def_property_ui_range(prop, -100.0, 100.0, 0.2, 3);
- RNA_def_property_ui_text(prop, "Sensitivity", "Set the sensitivity of the X axis");
+ RNA_def_property_ui_text(prop, "Sensitivity", "Sensitivity of the X axis");
RNA_def_property_update(prop, NC_LOGIC, NULL);
prop = RNA_def_property(srna, "sensitivity_y", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "sensitivity[1]");
RNA_def_property_ui_range(prop, -100.0, 100.0, 0.2, 3);
- RNA_def_property_ui_text(prop, "Sensitivity", "Set the sensitivity of the Y axis");
+ RNA_def_property_ui_text(prop, "Sensitivity", "Sensitivity of the Y axis");
RNA_def_property_update(prop, NC_LOGIC, NULL);
prop = RNA_def_property(srna, "min_x", PROP_FLOAT, PROP_ANGLE);
RNA_def_property_float_sdna(prop, NULL, "limit_x[0]");
RNA_def_property_ui_range(prop, DEG2RADF(-3600.0f), 0.0, 9, 3);
- RNA_def_property_ui_text(prop, "min", "The maximum negative rotation allowed by x mouse movement (0 for infinite)");
+ RNA_def_property_ui_text(prop, "Min", "Maximum negative rotation allowed by X mouse movement (0 for infinite)");
RNA_def_property_update(prop, NC_LOGIC, NULL);
prop = RNA_def_property(srna, "max_x", PROP_FLOAT, PROP_ANGLE);
RNA_def_property_float_sdna(prop, NULL, "limit_x[1]");
RNA_def_property_ui_range(prop, 0.0, DEG2RADF(3600.0f), 9, 3);
- RNA_def_property_ui_text(prop, "max", "The maximum positive rotation allowed by x mouse movement (0 for infinite)");
+ RNA_def_property_ui_text(prop, "Max", "Maximum positive rotation allowed by X mouse movement (0 for infinite)");
RNA_def_property_update(prop, NC_LOGIC, NULL);
prop = RNA_def_property(srna, "min_y", PROP_FLOAT, PROP_ANGLE);
RNA_def_property_float_sdna(prop, NULL, "limit_y[0]");
RNA_def_property_ui_range(prop, DEG2RADF(-3600.0f), 0.0, 9, 3);
- RNA_def_property_ui_text(prop, "min", "The maximum negative rotation allowed by y mouse movement (0 for infinite)");
+ RNA_def_property_ui_text(prop, "Min", "Maximum negative rotation allowed by Y mouse movement (0 for infinite)");
RNA_def_property_update(prop, NC_LOGIC, NULL);
prop = RNA_def_property(srna, "max_y", PROP_FLOAT, PROP_ANGLE);
RNA_def_property_float_sdna(prop, NULL, "limit_y[1]");
RNA_def_property_ui_range(prop, 0.0, DEG2RADF(3600.0f), 9, 3);
- RNA_def_property_ui_text(prop, "max", "The maximum positive rotation allowed by y mouse movement (0 for infinite)");
+ RNA_def_property_ui_text(prop, "Max", "Maximum positive rotation allowed by Y mouse movement (0 for infinite)");
RNA_def_property_update(prop, NC_LOGIC, NULL);
}
diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c
index e550c4e85fb..065b6f787b6 100644
--- a/source/blender/makesrna/intern/rna_nodetree.c
+++ b/source/blender/makesrna/intern/rna_nodetree.c
@@ -658,30 +658,6 @@ static void rna_NodeTree_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *p
{
bNodeTree *ntree = (bNodeTree *)ptr->id.data;
- /* when using border, make it so no old data from outside of
- * border is hanging around
- * ideally shouldn't be in RNA callback, but how to teach
- * compo to only clear frame when border usage is actually
- * toggling
- */
- if (ntree->flag & NTREE_VIEWER_BORDER) {
- Image *ima = BKE_image_verify_viewer(IMA_TYPE_COMPOSITE, "Viewer Node");
- void *lock;
- ImBuf *ibuf = BKE_image_acquire_ibuf(ima, NULL, &lock);
-
- if (ibuf) {
- if (ibuf->rect)
- memset(ibuf->rect, 0, 4 * ibuf->x * ibuf->y);
-
- if (ibuf->rect_float)
- memset(ibuf->rect_float, 0, 4 * ibuf->x * ibuf->y * sizeof(float));
-
- ibuf->userflags |= IB_DISPLAY_BUFFER_INVALID;
- }
-
- BKE_image_release_ibuf(ima, ibuf, lock);
- }
-
WM_main_add_notifier(NC_NODE | NA_EDITED, NULL);
WM_main_add_notifier(NC_SCENE | ND_NODES, &ntree->id);
diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c
index bcdb469dd85..bce7d0062f2 100644
--- a/source/blender/makesrna/intern/rna_scene.c
+++ b/source/blender/makesrna/intern/rna_scene.c
@@ -4811,6 +4811,14 @@ static void rna_def_scene_render_data(BlenderRNA *brna)
"and length of frame numbers");
RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+ /* Render result EXR cache. */
+ prop = RNA_def_property(srna, "use_render_cache", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "scemode", R_EXR_CACHE_FILE);
+ RNA_def_property_ui_text(prop, "Cache Result",
+ "Save render cache to EXR files (useful for heavy compositing, "
+ "Note: affects indirectly rendered scenes)");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
/* Bake */
prop = RNA_def_property(srna, "bake_type", PROP_ENUM, PROP_NONE);
diff --git a/source/blender/makesrna/intern/rna_ui_api.c b/source/blender/makesrna/intern/rna_ui_api.c
index 3cdff730b00..d3d17a90f99 100644
--- a/source/blender/makesrna/intern/rna_ui_api.c
+++ b/source/blender/makesrna/intern/rna_ui_api.c
@@ -700,6 +700,7 @@ void RNA_api_ui_layout(StructRNA *srna)
RNA_def_enum(func, "type", curve_type_items, 0, "Type", "Type of curves to display");
RNA_def_boolean(func, "levels", false, "", "Show black/white levels");
RNA_def_boolean(func, "brush", false, "", "Show brush options");
+ RNA_def_boolean(func, "use_negative_slope", false, "", "Use a negative slope by default");
func = RNA_def_function(srna, "template_color_ramp", "uiTemplateColorRamp");
RNA_def_function_ui_description(func, "Item. A color ramp widget");
diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c
index f69e768670e..f4974266f60 100644
--- a/source/blender/makesrna/intern/rna_userdef.c
+++ b/source/blender/makesrna/intern/rna_userdef.c
@@ -4272,6 +4272,10 @@ static void rna_def_userdef_filepaths(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Temporary Directory", "The directory for storing temporary save files");
RNA_def_property_update(prop, 0, "rna_userdef_temp_update");
+ prop = RNA_def_property(srna, "render_cache_directory", PROP_STRING, PROP_DIRPATH);
+ RNA_def_property_string_sdna(prop, NULL, "render_cachedir");
+ RNA_def_property_ui_text(prop, "Render Cache Path", "Where to cache raw render results");
+
prop = RNA_def_property(srna, "image_editor", PROP_STRING, PROP_FILEPATH);
RNA_def_property_string_sdna(prop, NULL, "image_editor");
RNA_def_property_ui_text(prop, "Image Editor", "Path to an image editor");
diff --git a/source/blender/modifiers/intern/MOD_laplaciandeform.c b/source/blender/modifiers/intern/MOD_laplaciandeform.c
index f613d6063fe..ffadcda3e8c 100644
--- a/source/blender/modifiers/intern/MOD_laplaciandeform.c
+++ b/source/blender/modifiers/intern/MOD_laplaciandeform.c
@@ -604,7 +604,8 @@ static void initSystem(LaplacianDeformModifierData *lmd, Object *ob, DerivedMesh
int *index_anchors = MEM_mallocN(sizeof(int) * numVerts, __func__); /* over-alloc */
MFace *tessface;
STACK_DECLARE(index_anchors);
- STACK_INIT(index_anchors);
+
+ STACK_INIT(index_anchors, numVerts);
modifier_get_vgroup(ob, dm, lmd->anchor_grp_name, &dvert, &defgrp_index);
BLI_assert(dvert != NULL);
diff --git a/source/blender/modifiers/intern/MOD_skin.c b/source/blender/modifiers/intern/MOD_skin.c
index 832565cc247..825015fa25c 100644
--- a/source/blender/modifiers/intern/MOD_skin.c
+++ b/source/blender/modifiers/intern/MOD_skin.c
@@ -732,7 +732,7 @@ static EMat *build_edge_mats(const MVertSkin *vs,
}
}
- while (!BLI_stack_empty(stack)) {
+ while (!BLI_stack_is_empty(stack)) {
build_emats_stack(stack, visited_e, emat, emap, medge, vs, mvert);
}
diff --git a/source/blender/modifiers/intern/MOD_solidify.c b/source/blender/modifiers/intern/MOD_solidify.c
index 14a6b631bd6..95b0c37933c 100644
--- a/source/blender/modifiers/intern/MOD_solidify.c
+++ b/source/blender/modifiers/intern/MOD_solidify.c
@@ -274,8 +274,8 @@ static DerivedMesh *applyModifier(
face_nors, true);
}
- STACK_INIT(new_vert_arr);
- STACK_INIT(new_edge_arr);
+ STACK_INIT(new_vert_arr, numVerts * 2);
+ STACK_INIT(new_edge_arr, numEdges * 2);
if (smd->flag & MOD_SOLIDIFY_RIM) {
BLI_bitmap *orig_mvert_tag = BLI_BITMAP_NEW(numVerts, __func__);
diff --git a/source/blender/nodes/shader/nodes/node_shader_normal.c b/source/blender/nodes/shader/nodes/node_shader_normal.c
index 22b27ce4b71..fcd738f0b15 100644
--- a/source/blender/nodes/shader/nodes/node_shader_normal.c
+++ b/source/blender/nodes/shader/nodes/node_shader_normal.c
@@ -61,7 +61,12 @@ static void node_shader_exec_normal(void *UNUSED(data), int UNUSED(thread), bNod
static int gpu_shader_normal(GPUMaterial *mat, bNode *UNUSED(node), bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out)
{
GPUNodeLink *vec = GPU_uniform(out[0].vec);
- return GPU_stack_link(mat, "normal", in, out, vec);
+ int ret = GPU_stack_link(mat, "normal", in, out, vec);
+ if (ret && GPU_material_use_new_shading_nodes(mat)) {
+ float fac[3] = {1.0f, 0.0f, 0.0f};
+ GPU_link(mat, "invert", GPU_uniform(fac), out[1].link, &out[1].link);
+ }
+ return ret;
}
void register_node_type_sh_normal(void)
diff --git a/source/blender/python/generic/py_capi_utils.c b/source/blender/python/generic/py_capi_utils.c
index 96b5707ec27..36ae30ada22 100644
--- a/source/blender/python/generic/py_capi_utils.c
+++ b/source/blender/python/generic/py_capi_utils.c
@@ -419,7 +419,7 @@ PyObject *PyC_ExceptionBuffer(void)
if (!(string_io_mod = PyImport_ImportModule("io"))) {
goto error_cleanup;
}
- else if (!(string_io = PyObject_CallMethod(string_io_mod, (char *)"StringIO", NULL))) {
+ else if (!(string_io = PyObject_CallMethod(string_io_mod, "StringIO", NULL))) {
goto error_cleanup;
}
else if (!(string_io_getvalue = PyObject_GetAttrString(string_io, "getvalue"))) {
@@ -651,12 +651,12 @@ void PyC_RunQuicky(const char *filepath, int n, ...)
const char *format = va_arg(vargs, char *);
void *ptr = va_arg(vargs, void *);
- ret = PyObject_CallFunction(calcsize, (char *)"s", format);
+ ret = PyObject_CallFunction(calcsize, "s", format);
if (ret) {
sizes[i] = PyLong_AsLong(ret);
Py_DECREF(ret);
- ret = PyObject_CallFunction(unpack, (char *)"sy#", format, (char *)ptr, sizes[i]);
+ ret = PyObject_CallFunction(unpack, "sy#", format, (char *)ptr, sizes[i]);
}
if (ret == NULL) {
diff --git a/source/blender/python/intern/bpy_interface.c b/source/blender/python/intern/bpy_interface.c
index b7752b39900..ddfbfecc46e 100644
--- a/source/blender/python/intern/bpy_interface.c
+++ b/source/blender/python/intern/bpy_interface.c
@@ -212,25 +212,29 @@ static PyObject *CCL_initPython(void)
#endif
static struct _inittab bpy_internal_modules[] = {
- {(char *)"mathutils", PyInit_mathutils},
-// {(char *)"mathutils.geometry", PyInit_mathutils_geometry},
-// {(char *)"mathutils.noise", PyInit_mathutils_noise},
-// {(char *)"mathutils.kdtree", PyInit_mathutils_kdtree},
- {(char *)"_bpy_path", BPyInit__bpy_path},
- {(char *)"bgl", BPyInit_bgl},
- {(char *)"blf", BPyInit_blf},
- {(char *)"bmesh", BPyInit_bmesh},
- // {(char *)"bmesh.types", BPyInit_bmesh_types},
- // {(char *)"bmesh.utils", BPyInit_bmesh_utils},
- // {(char *)"bmesh.utils", BPyInit_bmesh_geometry},
+ {"mathutils", PyInit_mathutils},
+#if 0
+ {"mathutils.geometry", PyInit_mathutils_geometry},
+ {"mathutils.noise", PyInit_mathutils_noise},
+ {"mathutils.kdtree", PyInit_mathutils_kdtree},
+#endif
+ {"_bpy_path", BPyInit__bpy_path},
+ {"bgl", BPyInit_bgl},
+ {"blf", BPyInit_blf},
+ {"bmesh", BPyInit_bmesh},
+#if 0
+ {"bmesh.types", BPyInit_bmesh_types},
+ {"bmesh.utils", BPyInit_bmesh_utils},
+ {"bmesh.utils", BPyInit_bmesh_geometry},
+#endif
#ifdef WITH_AUDASPACE
- {(char *)"aud", AUD_initPython},
+ {"aud", AUD_initPython},
#endif
#ifdef WITH_CYCLES
- {(char *)"_cycles", CCL_initPython},
+ {"_cycles", CCL_initPython},
#endif
- {(char *)"gpu", GPU_initPython},
- {(char *)"idprop", BPyInit_idprop},
+ {"gpu", GPU_initPython},
+ {"idprop", BPyInit_idprop},
{NULL, NULL}
};
diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c
index 38a0f74f009..440af035bcd 100644
--- a/source/blender/python/intern/bpy_rna.c
+++ b/source/blender/python/intern/bpy_rna.c
@@ -6255,7 +6255,7 @@ static PyObject *pyrna_srna_Subtype(StructRNA *srna)
/* always use O not N when calling, N causes refcount errors */
#if 0
- newclass = PyObject_CallFunction(metaclass, (char *)"s(O) {sss()}",
+ newclass = PyObject_CallFunction(metaclass, "s(O) {sss()}",
idname, py_base, "__module__", "bpy.types", "__slots__");
#else
{
diff --git a/source/blender/python/mathutils/mathutils_kdtree.c b/source/blender/python/mathutils/mathutils_kdtree.c
index 0833d522a60..519778aea7d 100644
--- a/source/blender/python/mathutils/mathutils_kdtree.c
+++ b/source/blender/python/mathutils/mathutils_kdtree.c
@@ -102,7 +102,7 @@ static int PyKDTree__tp_init(PyKDTree *self, PyObject *args, PyObject *kwargs)
unsigned int maxsize;
const char *keywords[] = {"size", NULL};
- if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *)"I:KDTree", (char **)keywords, &maxsize)) {
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "I:KDTree", (char **)keywords, &maxsize)) {
return -1;
}
@@ -425,7 +425,7 @@ PyMODINIT_FUNC PyInit_mathutils_kdtree(void)
if (PyType_Ready(&PyKDTree_Type)) {
return NULL;
}
- PyModule_AddObject(m, (char *)"KDTree", (PyObject *) &PyKDTree_Type);
+ PyModule_AddObject(m, "KDTree", (PyObject *) &PyKDTree_Type);
return m;
}
diff --git a/source/blender/render/intern/include/render_result.h b/source/blender/render/intern/include/render_result.h
index 457f1377e9b..90ff69dbfbe 100644
--- a/source/blender/render/intern/include/render_result.h
+++ b/source/blender/render/intern/include/render_result.h
@@ -81,9 +81,14 @@ void render_result_exr_file_end(struct Render *re);
void render_result_exr_file_merge(struct RenderResult *rr, struct RenderResult *rrpart);
void render_result_exr_file_path(struct Scene *scene, const char *layname, int sample, char *filepath);
-int render_result_exr_file_read(struct Render *re, int sample);
+int render_result_exr_file_read_sample(struct Render *re, int sample);
int render_result_exr_file_read_path(struct RenderResult *rr, struct RenderLayer *rl_single, const char *filepath);
+/* EXR cache */
+
+void render_result_exr_file_cache_write(struct Render *re);
+bool render_result_exr_file_cache_read(struct Render *re);
+
/* Combined Pixel Rect */
struct ImBuf *render_result_rect_to_ibuf(struct RenderResult *rr, struct RenderData *rd);
diff --git a/source/blender/render/intern/source/external_engine.c b/source/blender/render/intern/source/external_engine.c
index 1df701c48eb..95ff68dadb3 100644
--- a/source/blender/render/intern/source/external_engine.c
+++ b/source/blender/render/intern/source/external_engine.c
@@ -664,6 +664,12 @@ int RE_engine_render(Render *re, int do_all)
BLI_rw_mutex_unlock(&re->resultmutex);
}
+ if (re->r.scemode & R_EXR_CACHE_FILE) {
+ BLI_rw_mutex_lock(&re->resultmutex, THREAD_LOCK_WRITE);
+ render_result_exr_file_cache_write(re);
+ BLI_rw_mutex_unlock(&re->resultmutex);
+ }
+
RE_parts_free(re);
if (BKE_reports_contain(re->reports, RPT_ERROR))
diff --git a/source/blender/render/intern/source/pipeline.c b/source/blender/render/intern/source/pipeline.c
index bdd911df33b..9f27021d23e 100644
--- a/source/blender/render/intern/source/pipeline.c
+++ b/source/blender/render/intern/source/pipeline.c
@@ -1229,7 +1229,13 @@ static void threaded_tile_processor(Render *re)
render_result_exr_file_end(re);
BLI_rw_mutex_unlock(&re->resultmutex);
}
-
+
+ if (re->r.scemode & R_EXR_CACHE_FILE) {
+ BLI_rw_mutex_lock(&re->resultmutex, THREAD_LOCK_WRITE);
+ render_result_exr_file_cache_write(re);
+ BLI_rw_mutex_unlock(&re->resultmutex);
+ }
+
/* unset threadsafety */
g_break = 0;
@@ -1662,7 +1668,10 @@ static void render_scene(Render *re, Scene *sce, int cfra)
/* initial setup */
RE_InitState(resc, re, &sce->r, NULL, winx, winy, &re->disprect);
-
+
+ /* We still want to use 'rendercache' setting from org (main) scene... */
+ resc->r.scemode = (resc->r.scemode & ~R_EXR_CACHE_FILE) | (re->r.scemode & R_EXR_CACHE_FILE);
+
/* still unsure entity this... */
resc->main = re->main;
resc->scene = sce;
@@ -1967,7 +1976,7 @@ static void composite_freestyle_renders(Render *re, int sample)
/* may be NULL in case of empty render layer */
if (freestyle_render) {
- render_result_exr_file_read(freestyle_render, sample);
+ render_result_exr_file_read_sample(freestyle_render, sample);
FRS_composite_result(re, srl, freestyle_render);
RE_FreeRenderResult(freestyle_render->result);
freestyle_render->result = NULL;
@@ -2041,7 +2050,7 @@ static void do_merge_fullsample(Render *re, bNodeTree *ntree)
if (re1 && (re1->r.scemode & R_FULL_SAMPLE)) {
if (sample) {
BLI_rw_mutex_lock(&re->resultmutex, THREAD_LOCK_WRITE);
- render_result_exr_file_read(re1, sample);
+ render_result_exr_file_read_sample(re1, sample);
#ifdef WITH_FREESTYLE
if (re1->r.mode & R_EDGE_FRS)
composite_freestyle_renders(re1, sample);
@@ -3108,7 +3117,7 @@ bool RE_ReadRenderResult(Scene *scene, Scene *scenode)
re->scene_color_manage = BKE_scene_check_color_management_enabled(scene);
BLI_rw_mutex_lock(&re->resultmutex, THREAD_LOCK_WRITE);
- success = render_result_exr_file_read(re, 0);
+ success = render_result_exr_file_cache_read(re);
BLI_rw_mutex_unlock(&re->resultmutex);
return success;
diff --git a/source/blender/render/intern/source/render_result.c b/source/blender/render/intern/source/render_result.c
index dd867852bdb..d8410fbe257 100644
--- a/source/blender/render/intern/source/render_result.c
+++ b/source/blender/render/intern/source/render_result.c
@@ -37,6 +37,7 @@
#include "BLI_utildefines.h"
#include "BLI_listbase.h"
+#include "BLI_md5.h"
#include "BLI_path_util.h"
#include "BLI_rect.h"
#include "BLI_string.h"
@@ -1012,7 +1013,7 @@ void render_result_exr_file_end(Render *re)
render_result_free_list(&re->fullresult, re->result);
re->result = NULL;
- render_result_exr_file_read(re, 0);
+ render_result_exr_file_read_sample(re, 0);
}
/* save part into exr file */
@@ -1038,25 +1039,23 @@ void render_result_exr_file_path(Scene *scene, const char *layname, int sample,
BLI_make_file_string("/", filepath, BLI_temp_dir_session(), name);
}
-/* only for temp buffer files, makes exact copy of render result */
-int render_result_exr_file_read(Render *re, int sample)
+/* only for temp buffer, makes exact copy of render result */
+int render_result_exr_file_read_sample(Render *re, int sample)
{
RenderLayer *rl;
- char str[FILE_MAX];
+ char str[FILE_MAXFILE + MAX_ID_NAME + MAX_ID_NAME + 100] = "";
bool success = true;
RE_FreeRenderResult(re->result);
re->result = render_result_new(re, &re->disprect, 0, RR_USE_MEM, RR_ALL_LAYERS);
for (rl = re->result->layers.first; rl; rl = rl->next) {
-
render_result_exr_file_path(re->scene, rl->name, sample, str);
printf("read exr tmp file: %s\n", str);
if (!render_result_exr_file_read_path(re->result, rl, str)) {
printf("cannot read: %s\n", str);
success = false;
-
}
}
@@ -1115,6 +1114,65 @@ int render_result_exr_file_read_path(RenderResult *rr, RenderLayer *rl_single, c
return 1;
}
+static void render_result_exr_file_cache_path(Scene *sce, const char *root, char *r_path)
+{
+ char filename_full[FILE_MAX + MAX_ID_NAME + 100], filename[FILE_MAXFILE], dirname[FILE_MAXDIR];
+ char path_digest[16] = {0};
+ char path_hexdigest[33];
+
+ /* If root is relative, use either current .blend file dir, or temp one if not saved. */
+ if (G.main->name[0]) {
+ BLI_split_dirfile(G.main->name, dirname, filename, sizeof(dirname), sizeof(filename));
+ BLI_replace_extension(filename, sizeof(filename), ""); /* strip '.blend' */
+ md5_buffer(G.main->name, strlen(G.main->name), path_digest);
+ }
+ else {
+ BLI_strncpy(dirname, BLI_temp_dir_base(), sizeof(dirname));
+ BLI_strncpy(filename, "UNSAVED", sizeof(filename));
+ }
+ md5_to_hexdigest(path_digest, path_hexdigest);
+
+ /* Default to *non-volatile* tmp dir. */
+ if (*root == '\0') {
+ root = BLI_temp_dir_base();
+ }
+
+ BLI_snprintf(filename_full, sizeof(filename_full), "cached_RR_%s_%s_%s.exr",
+ filename, sce->id.name + 2, path_hexdigest);
+ BLI_make_file_string(dirname, r_path, root, filename_full);
+}
+
+void render_result_exr_file_cache_write(Render *re)
+{
+ RenderResult *rr = re->result;
+ char str[FILE_MAXFILE + FILE_MAXFILE + MAX_ID_NAME + 100];
+ char *root = U.render_cachedir;
+
+ render_result_exr_file_cache_path(re->scene, root, str);
+ printf("Caching exr file, %dx%d, %s\n", rr->rectx, rr->recty, str);
+ RE_WriteRenderResult(NULL, rr, str, 0);
+}
+
+/* For cache, makes exact copy of render result */
+bool render_result_exr_file_cache_read(Render *re)
+{
+ char str[FILE_MAXFILE + MAX_ID_NAME + MAX_ID_NAME + 100] = "";
+ char *root = U.render_cachedir;
+
+ RE_FreeRenderResult(re->result);
+ re->result = render_result_new(re, &re->disprect, 0, RR_USE_MEM, RR_ALL_LAYERS);
+
+ /* First try cache. */
+ render_result_exr_file_cache_path(re->scene, root, str);
+
+ printf("read exr cache file: %s\n", str);
+ if (!render_result_exr_file_read_path(re->result, NULL, str)) {
+ printf("cannot read: %s\n", str);
+ return false;
+ }
+ return true;
+}
+
/*************************** Combined Pixel Rect *****************************/
ImBuf *render_result_rect_to_ibuf(RenderResult *rr, RenderData *rd)
diff --git a/source/blenderplayer/bad_level_call_stubs/stubs.c b/source/blenderplayer/bad_level_call_stubs/stubs.c
index 5c838bd4160..72f411b4231 100644
--- a/source/blenderplayer/bad_level_call_stubs/stubs.c
+++ b/source/blenderplayer/bad_level_call_stubs/stubs.c
@@ -530,7 +530,7 @@ struct uiLayout *uiTemplateConstraint(struct uiLayout *layout, struct PointerRNA
void uiTemplatePreview(struct uiLayout *layout, struct bContext *C, struct ID *id, int show_buttons, struct ID *parent,
struct MTex *slot, const char *preview_id) RET_NONE
void uiTemplateIDPreview(uiLayout *layout, struct bContext *C, struct PointerRNA *ptr, const char *propname, const char *newop, const char *openop, const char *unlinkop, int rows, int cols) RET_NONE
-void uiTemplateCurveMapping(uiLayout *layout, struct PointerRNA *ptr, const char *propname, int type, int levels, int brush) RET_NONE
+void uiTemplateCurveMapping(uiLayout *layout, struct PointerRNA *ptr, const char *propname, int type, int levels, int brush, int neg_slope) RET_NONE
void uiTemplateColorRamp(uiLayout *layout, struct PointerRNA *ptr, const char *propname, int expand) RET_NONE
void uiTemplateLayers(uiLayout *layout, struct PointerRNA *ptr, const char *propname, PointerRNA *used_ptr, const char *used_propname, int active_layer) RET_NONE
void uiTemplateImageLayers(struct uiLayout *layout, struct bContext *C, struct Image *ima, struct ImageUser *iuser) RET_NONE
diff --git a/source/gameengine/Converter/BL_ArmatureObject.cpp b/source/gameengine/Converter/BL_ArmatureObject.cpp
index 0392280444d..e11bc84a0da 100644
--- a/source/gameengine/Converter/BL_ArmatureObject.cpp
+++ b/source/gameengine/Converter/BL_ArmatureObject.cpp
@@ -319,6 +319,10 @@ void BL_ArmatureObject::LoadConstraints(KX_BlenderSceneConverter* converter)
}
}
}
+
+ // If we have constraints, make sure we get treated as an "animated" object
+ if (m_constraintNumber > 0)
+ GetActionManager();
}
BL_ArmatureConstraint* BL_ArmatureObject::GetConstraint(const char* posechannel, const char* constraintname)
diff --git a/source/gameengine/GamePlayer/common/CMakeLists.txt b/source/gameengine/GamePlayer/common/CMakeLists.txt
index 865e75b66c5..e6c980de566 100644
--- a/source/gameengine/GamePlayer/common/CMakeLists.txt
+++ b/source/gameengine/GamePlayer/common/CMakeLists.txt
@@ -56,7 +56,7 @@ set(INC_SYS
../../../../intern/moto/include
${GLEW_INCLUDE_PATH}
${PYTHON_INCLUDE_DIRS}
- ${PNG_INCLUDE_DIR}
+ ${PNG_INCLUDE_DIRS}
${ZLIB_INCLUDE_DIRS}
)
diff --git a/source/gameengine/Ketsji/KX_PythonInit.cpp b/source/gameengine/Ketsji/KX_PythonInit.cpp
index 64705c60f14..ca6658773e9 100644
--- a/source/gameengine/Ketsji/KX_PythonInit.cpp
+++ b/source/gameengine/Ketsji/KX_PythonInit.cpp
@@ -1960,10 +1960,10 @@ void removeImportMain(struct Main *maggie)
// Copied from bpy_interface.c
static struct _inittab bge_internal_modules[] = {
- {(char *)"mathutils", PyInit_mathutils},
- {(char *)"bgl", BPyInit_bgl},
- {(char *)"blf", BPyInit_blf},
- {(char *)"aud", AUD_initPython},
+ {"mathutils", PyInit_mathutils},
+ {"bgl", BPyInit_bgl},
+ {"blf", BPyInit_blf},
+ {"aud", AUD_initPython},
{NULL, NULL}
};
diff --git a/tests/gtests/blenlib/BLI_stack_test.cc b/tests/gtests/blenlib/BLI_stack_test.cc
new file mode 100644
index 00000000000..8ad4d957813
--- /dev/null
+++ b/tests/gtests/blenlib/BLI_stack_test.cc
@@ -0,0 +1,137 @@
+/* Apache License, Version 2.0 */
+
+#include "testing/testing.h"
+#include <string.h>
+
+extern "C" {
+#include "BLI_stack.h"
+#include "BLI_utildefines.h"
+#include "BLI_array.h"
+};
+
+#define SIZE 1024
+
+TEST(stack, Empty)
+{
+ BLI_Stack *stack;
+
+ stack = BLI_stack_new(sizeof(int), __func__);
+ EXPECT_EQ(BLI_stack_is_empty(stack), true);
+ BLI_stack_free(stack);
+}
+
+TEST(stack, One)
+{
+ BLI_Stack *stack;
+ unsigned int in = -1, out = 1;
+
+ stack = BLI_stack_new(sizeof(in), __func__);
+
+ BLI_stack_push(stack, (void *)&in);
+ EXPECT_EQ(BLI_stack_is_empty(stack), false);
+ BLI_stack_pop(stack, (void *)&out);
+ EXPECT_EQ(in, out);
+ EXPECT_EQ(BLI_stack_is_empty(stack), true);
+ BLI_stack_free(stack);
+}
+
+TEST(stack, Range)
+{
+ const int tot = SIZE;
+ BLI_Stack *stack;
+ int in, out;
+
+ stack = BLI_stack_new(sizeof(in), __func__);
+
+ for (in = 0; in < tot; in++) {
+ BLI_stack_push(stack, (void *)&in);
+ }
+
+ for (in = tot - 1; in >= 0; in--) {
+ EXPECT_EQ(BLI_stack_is_empty(stack), false);
+ BLI_stack_pop(stack, (void *)&out);
+ EXPECT_EQ(in, out);
+
+ }
+ EXPECT_EQ(BLI_stack_is_empty(stack), true);
+
+ BLI_stack_free(stack);
+}
+
+TEST(stack, String)
+{
+ const int tot = SIZE;
+ int i;
+
+ BLI_Stack *stack;
+ char in[] = "hello world!";
+ char out[sizeof(in)];
+
+ stack = BLI_stack_new(sizeof(in), __func__);
+
+ for (i = 0; i < tot; i++) {
+ *((int *)in) = i;
+ BLI_stack_push(stack, (void *)in);
+ }
+
+ for (i = tot - 1; i >= 0; i--) {
+ EXPECT_EQ(BLI_stack_is_empty(stack), false);
+ *((int *)in) = i;
+ BLI_stack_pop(stack, (void *)&out);
+ EXPECT_STREQ(in, out);
+
+ }
+ EXPECT_EQ(BLI_stack_is_empty(stack), true);
+
+ BLI_stack_free(stack);
+}
+
+TEST(stack, Reuse)
+{
+ const int sizes[] = {3, 11, 81, 400, 999, 12, 1, 9721, 7, 99, 5, 0};
+ int sizes_test[ARRAY_SIZE(sizes)];
+ const int *s;
+ int in, out, i;
+ int sum, sum_test;
+
+ BLI_Stack *stack;
+
+ stack = BLI_stack_new(sizeof(in), __func__);
+
+ /* add a bunch of numbers, ensure we get same sum out */
+ sum = 0;
+ for (s = sizes; *s; s++) {
+ for (i = *s; i != 0; i--) {
+ BLI_stack_push(stack, (void *)&i);
+ sum += i;
+ }
+ }
+ sum_test = 0;
+ while (!BLI_stack_is_empty(stack)) {
+ BLI_stack_pop(stack, (void *)&out);
+ sum_test += out;
+ }
+ EXPECT_EQ(sum, sum_test);
+
+ /* add and remove all except last */
+ for (s = sizes; *s; s++) {
+ for (i = *s; i >= 0; i--) {
+ BLI_stack_push(stack, (void *)&i);
+ }
+ for (i = *s; i > 0; i--) {
+ BLI_stack_pop(stack, (void *)&out);
+ }
+ }
+
+ i = ARRAY_SIZE(sizes) - 1;
+ while (!BLI_stack_is_empty(stack)) {
+ i--;
+ BLI_stack_pop(stack, (void *)&sizes_test[i]);
+ EXPECT_EQ(sizes[i], sizes_test[i]);
+ EXPECT_GT(i, -1);
+ }
+ EXPECT_EQ(i, 0);
+ EXPECT_EQ(memcmp(sizes, sizes_test, sizeof(sizes) - sizeof(int)), 0);
+
+ BLI_stack_free(stack);
+}
diff --git a/tests/gtests/blenlib/CMakeLists.txt b/tests/gtests/blenlib/CMakeLists.txt
index 4980ca2e8ad..07db51b887d 100644
--- a/tests/gtests/blenlib/CMakeLists.txt
+++ b/tests/gtests/blenlib/CMakeLists.txt
@@ -23,7 +23,7 @@
set(INC
.
- ../
+ ..
../../../source/blender/blenlib
../../../intern/guardedalloc
)
@@ -34,6 +34,7 @@ set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${PLATFORM_LINKFLAGS}")
set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} ${PLATFORM_LINKFLAGS_DEBUG}")
+BLENDER_TEST(BLI_stack "bf_blenlib")
BLENDER_TEST(BLI_math_color "bf_blenlib")
BLENDER_TEST(BLI_math_geom "bf_blenlib")
BLENDER_TEST(BLI_path_util "bf_blenlib;extern_wcwidth;${ZLIB_LIBRARIES}")
diff --git a/tests/gtests/bmesh/CMakeLists.txt b/tests/gtests/bmesh/CMakeLists.txt
index b1166a67bcd..b62141e5984 100644
--- a/tests/gtests/bmesh/CMakeLists.txt
+++ b/tests/gtests/bmesh/CMakeLists.txt
@@ -23,7 +23,7 @@
set(INC
.
- ../
+ ..
../../../source/blender/blenlib
../../../source/blender/makesdna
../../../source/blender/bmesh
diff --git a/tests/gtests/guardedalloc/CMakeLists.txt b/tests/gtests/guardedalloc/CMakeLists.txt
index c09f8729ab0..394bc0b6700 100644
--- a/tests/gtests/guardedalloc/CMakeLists.txt
+++ b/tests/gtests/guardedalloc/CMakeLists.txt
@@ -23,7 +23,7 @@
set(INC
.
- ../
+ ..
../../../intern/guardedalloc
)
diff --git a/tests/gtests/testing/CMakeLists.txt b/tests/gtests/testing/CMakeLists.txt
index 93a3049efd8..0e5da492ed2 100644
--- a/tests/gtests/testing/CMakeLists.txt
+++ b/tests/gtests/testing/CMakeLists.txt
@@ -23,7 +23,7 @@
set(INC
.
- ../
+ ..
../../../extern/libmv/third_party/gflags
../../../extern/gtest/include
)
@@ -43,6 +43,8 @@ set(INC_SYS
set(SRC
testing_main.cc
+
+ testing.h
)
blender_add_lib(bf_testing_main "${SRC}" "${INC}" "${INC_SYS}")