diff options
author | Severin <julian_eisel@web.de> | 2014-12-04 22:48:11 +0300 |
---|---|---|
committer | Severin <julian_eisel@web.de> | 2014-12-04 22:48:11 +0300 |
commit | 1254e98a48aa92bbf6e707fbc28f42bee17a264f (patch) | |
tree | 8cd67d04e91e3513bb55e5e93d7f78a30c77ddc4 | |
parent | 151f2467a4c42d787d6d26869dbe402ccb725679 (diff) | |
parent | 226eb53bc7f6d0aa1769b6c889d3b15d1f4944b5 (diff) |
Merge branch 'master' into imeinput_method_editor
75 files changed, 564 insertions, 258 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index b69f844027e..93abf2b96b5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -354,7 +354,7 @@ option(WITH_CYCLES_CUDA_BINARIES "Build cycles CUDA binaries" OFF) set(CYCLES_CUDA_BINARIES_ARCH sm_20 sm_21 sm_30 sm_35 sm_50 CACHE STRING "CUDA architectures to build binaries for") mark_as_advanced(CYCLES_CUDA_BINARIES_ARCH) unset(PLATFORM_DEFAULT) -option(WITH_CYCLES_LOGGING "Build cycles with logging support" OFF) +option(WITH_CYCLES_LOGGING "Build cycles with logging support" ON) option(WITH_CYCLES_DEBUG "Build cycles with extra debug capabilities" OFF) mark_as_advanced(WITH_CYCLES_LOGGING) mark_as_advanced(WITH_CYCLES_DEBUG) diff --git a/build_files/buildbot/config/user-config-cuda-glibc211-i686.py b/build_files/buildbot/config/user-config-cuda-glibc211-i686.py index 854f535398b..ae5cbac8cc7 100644 --- a/build_files/buildbot/config/user-config-cuda-glibc211-i686.py +++ b/build_files/buildbot/config/user-config-cuda-glibc211-i686.py @@ -2,4 +2,4 @@ BF_BUILDDIR = '../blender-build/linux-glibc211-i686' BF_INSTALLDIR = '../blender-install/linux-glibc211-i686' BF_NUMJOBS = 1 -BF_CYCLES_CUDA_BINARIES_ARCH = ['sm_20', 'sm_21', 'sm_30', 'sm_35', 'sm_50'] +BF_CYCLES_CUDA_BINARIES_ARCH = ['sm_20', 'sm_21', 'sm_30', 'sm_35', 'sm_50', 'sm_52'] diff --git a/build_files/buildbot/config/user-config-cuda-glibc211-x86_64.py b/build_files/buildbot/config/user-config-cuda-glibc211-x86_64.py index 7e928948762..29b1b9f1ad7 100644 --- a/build_files/buildbot/config/user-config-cuda-glibc211-x86_64.py +++ b/build_files/buildbot/config/user-config-cuda-glibc211-x86_64.py @@ -2,4 +2,4 @@ BF_BUILDDIR = '../blender-build/linux-glibc211-x86_64' BF_INSTALLDIR = '../blender-install/linux-glibc211-x86_64' BF_NUMJOBS = 1 -BF_CYCLES_CUDA_BINARIES_ARCH = ['sm_20', 'sm_21', 'sm_30', 'sm_35', 'sm_50'] +BF_CYCLES_CUDA_BINARIES_ARCH = ['sm_20', 'sm_21', 'sm_30', 'sm_35', 'sm_50', 'sm_52'] diff --git a/build_files/scons/config/darwin-config.py b/build_files/scons/config/darwin-config.py index 96a6352fd3a..1fb6d649ae9 100644 --- a/build_files/scons/config/darwin-config.py +++ b/build_files/scons/config/darwin-config.py @@ -205,7 +205,7 @@ BF_BOOST_LIBPATH = '${BF_BOOST}/lib' WITH_BF_CYCLES_CUDA_BINARIES = False BF_CYCLES_CUDA_NVCC = '/usr/local/cuda/bin/nvcc' -BF_CYCLES_CUDA_BINARIES_ARCH = ['sm_20', 'sm_21', 'sm_30', 'sm_35', 'sm_50'] +BF_CYCLES_CUDA_BINARIES_ARCH = ['sm_20', 'sm_21', 'sm_30', 'sm_35', 'sm_50', 'sm_52'] #Freestyle WITH_BF_FREESTYLE = True diff --git a/build_files/scons/config/win32-vc-config.py b/build_files/scons/config/win32-vc-config.py index d903dedbd05..929ca437f40 100644 --- a/build_files/scons/config/win32-vc-config.py +++ b/build_files/scons/config/win32-vc-config.py @@ -197,7 +197,7 @@ BF_BOOST_LIBPATH = '${BF_BOOST}/lib' #CUDA WITH_BF_CYCLES_CUDA_BINARIES = False #BF_CYCLES_CUDA_NVCC = "" # Path to the nvidia compiler -BF_CYCLES_CUDA_BINARIES_ARCH = ['sm_20', 'sm_21', 'sm_30', 'sm_35', 'sm_50'] +BF_CYCLES_CUDA_BINARIES_ARCH = ['sm_20', 'sm_21', 'sm_30', 'sm_35', 'sm_50', 'sm_52'] #Ray trace optimization WITH_BF_RAYOPTIMIZATION = True diff --git a/build_files/scons/config/win64-vc-config.py b/build_files/scons/config/win64-vc-config.py index b34b2b82b04..82738ebd0ab 100644 --- a/build_files/scons/config/win64-vc-config.py +++ b/build_files/scons/config/win64-vc-config.py @@ -200,7 +200,7 @@ BF_BOOST_LIBPATH = '${BF_BOOST}/lib' #CUDA WITH_BF_CYCLES_CUDA_BINARIES = False #BF_CYCLES_CUDA_NVCC = "" # Path to the nvidia compiler -BF_CYCLES_CUDA_BINARIES_ARCH = ['sm_20', 'sm_21', 'sm_30', 'sm_35', 'sm_50'] +BF_CYCLES_CUDA_BINARIES_ARCH = ['sm_20', 'sm_21', 'sm_30', 'sm_35', 'sm_50', 'sm_52'] #Ray trace optimization WITH_BF_RAYOPTIMIZATION = True diff --git a/build_files/scons/tools/Blender.py b/build_files/scons/tools/Blender.py index afcc1d06436..d09710a28fc 100755 --- a/build_files/scons/tools/Blender.py +++ b/build_files/scons/tools/Blender.py @@ -390,6 +390,10 @@ def creator(env): incs.append('#/extern/libmv') defs.append('WITH_LIBMV') + if env['WITH_BF_CYCLES'] and env['WITH_BF_CYCLES_LOGGING']: + incs.append('#/intern/cycles/blender') + defs.append('WITH_CYCLES_LOGGING') + if env['WITH_BF_FFMPEG']: defs.append('WITH_FFMPEG') diff --git a/build_files/scons/tools/btools.py b/build_files/scons/tools/btools.py index 7857b7bb222..cf9962d1bff 100644 --- a/build_files/scons/tools/btools.py +++ b/build_files/scons/tools/btools.py @@ -197,7 +197,7 @@ def validate_arguments(args, bc): 'C_WARN', 'CC_WARN', 'CXX_WARN', 'LLIBS', 'PLATFORM_LINKFLAGS', 'MACOSX_ARCHITECTURE', 'MACOSX_SDK', 'XCODE_CUR_VER', 'C_COMPILER_ID', 'BF_CYCLES_CUDA_BINARIES_ARCH', 'BF_PROGRAM_LINKFLAGS', 'MACOSX_DEPLOYMENT_TARGET', - 'WITH_BF_CYCLES_DEBUG' + 'WITH_BF_CYCLES_DEBUG', 'WITH_BF_CYCLES_LOGGING' ] @@ -605,6 +605,7 @@ def read_opts(env, cfg, args): ('BF_CYCLES_CUDA_ENV', 'preset environement nvcc will execute in', ''), ('BF_CYCLES_CUDA_BINARIES_ARCH', 'CUDA architectures to compile binaries for', []), (BoolVariable('WITH_BF_CYCLES_DEBUG', 'Build Cycles engine with extra debugging capabilities', False)), + (BoolVariable('WITH_BF_CYCLES_LOGGING', 'Build Cycles engine with logging support', True)), (BoolVariable('WITH_BF_OIIO', 'Build with OpenImageIO', False)), (BoolVariable('WITH_BF_STATICOIIO', 'Statically link to OpenImageIO', False)), diff --git a/extern/libmv/SConscript b/extern/libmv/SConscript index 96282f3c3c2..c3e6a4b621d 100644 --- a/extern/libmv/SConscript +++ b/extern/libmv/SConscript @@ -46,17 +46,24 @@ if env['WITH_BF_LIBMV']: if env['OURPLATFORM'] in ('win32-vc', 'win64-vc'): incs += ' ./third_party/msinttypes' - src += ['./third_party/glog/src/logging.cc', './third_party/glog/src/raw_logging.cc', './third_party/glog/src/utilities.cc', './third_party/glog/src/vlog_is_on.cc'] - src += ['./third_party/glog/src/windows/port.cc'] else: - src += env.Glob("third_party/glog/src/*.cc") incs += ' ./third_party/glog/src' else: src = env.Glob("intern/stub.cc") src = [src for src in src if src.find('_test.cc') == -1] -env.BlenderLib ( libname = 'extern_libmv', sources=src, includes=Split(incs), defines=defs, libtype=['extern', 'player'], priority=[20,137] ) +env.BlenderLib(libname = 'extern_libmv', sources=src, includes=Split(incs), defines=defs, libtype=['extern', 'player'], priority=[20,137]) + +if env['WITH_BF_LIBMV'] or (env['WITH_BF_CYCLES'] and env['WITH_BF_CYCLES_LOGGING']): + glog_src = [] + if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc', 'win64-mingw'): + glog_src += ['./third_party/glog/src/logging.cc', './third_party/glog/src/raw_logging.cc', './third_party/glog/src/utilities.cc', './third_party/glog/src/vlog_is_on.cc'] + glog_src += ['./third_party/glog/src/windows/port.cc'] + else: + glog_src += env.Glob("third_party/glog/src/*.cc") + + env.BlenderLib(libname = 'extern_glog', sources=glog_src, includes=Split(incs), defines=defs, libtype=['extern', 'player'], priority=[20,137]) if env['WITH_BF_LIBMV']: SConscript(['third_party/SConscript']) diff --git a/extern/libmv/bundle.sh b/extern/libmv/bundle.sh index 45b0e27f126..e467cc98371 100755 --- a/extern/libmv/bundle.sh +++ b/extern/libmv/bundle.sh @@ -213,7 +213,7 @@ ${tests} endif() else() list(APPEND SRC - libmv-capi_stub.cc + intern/stub.cc ) endif() @@ -321,17 +321,24 @@ $src if env['OURPLATFORM'] in ('win32-vc', 'win64-vc'): incs += ' ./third_party/msinttypes' ${win_src} - src += ['./third_party/glog/src/logging.cc', './third_party/glog/src/raw_logging.cc', './third_party/glog/src/utilities.cc', './third_party/glog/src/vlog_is_on.cc'] - src += ['./third_party/glog/src/windows/port.cc'] else: - src += env.Glob("third_party/glog/src/*.cc") incs += ' ./third_party/glog/src' else: src = env.Glob("intern/stub.cc") src = [src for src in src if src.find('_test.cc') == -1] -env.BlenderLib ( libname = 'extern_libmv', sources=src, includes=Split(incs), defines=defs, libtype=['extern', 'player'], priority=[20,137] ) +env.BlenderLib(libname = 'extern_libmv', sources=src, includes=Split(incs), defines=defs, libtype=['extern', 'player'], priority=[20,137]) + +if env['WITH_BF_LIBMV'] or (env['WITH_BF_CYCLES'] and env['WITH_BF_CYCLES_LOGGING']): + glog_src = [] + if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc', 'win64-mingw'): + glog_src += ['./third_party/glog/src/logging.cc', './third_party/glog/src/raw_logging.cc', './third_party/glog/src/utilities.cc', './third_party/glog/src/vlog_is_on.cc'] + glog_src += ['./third_party/glog/src/windows/port.cc'] + else: + glog_src += env.Glob("third_party/glog/src/*.cc") + + env.BlenderLib(libname = 'extern_glog', sources=glog_src, includes=Split(incs), defines=defs, libtype=['extern', 'player'], priority=[20,137]) if env['WITH_BF_LIBMV']: SConscript(['third_party/SConscript']) diff --git a/extern/libmv/intern/reconstruction.cc b/extern/libmv/intern/reconstruction.cc index f89efd8e8ca..046671e467f 100644 --- a/extern/libmv/intern/reconstruction.cc +++ b/extern/libmv/intern/reconstruction.cc @@ -61,6 +61,7 @@ struct libmv_Reconstruction { CameraIntrinsics *intrinsics; double error; + bool is_valid; }; namespace { @@ -289,6 +290,12 @@ libmv_Reconstruction *libmv_solveReconstruction( LG << "number of markers for init: " << keyframe_markers.size(); + if (keyframe_markers.size() < 8) { + LG << "No enough markers to initialize from"; + libmv_reconstruction->is_valid = false; + return libmv_reconstruction; + } + update_callback.invoke(0, "Initial reconstruction"); EuclideanReconstructTwoFrames(keyframe_markers, &reconstruction); @@ -319,6 +326,7 @@ libmv_Reconstruction *libmv_solveReconstruction( progress_update_callback, callback_customdata); + libmv_reconstruction->is_valid = true; return (libmv_Reconstruction *) libmv_reconstruction; } @@ -377,9 +385,14 @@ libmv_Reconstruction *libmv_solveModal( progress_update_callback, callback_customdata); + libmv_reconstruction->is_valid = true; return (libmv_Reconstruction *) libmv_reconstruction; } +int libmv_reconstructionIsValid(libmv_Reconstruction *libmv_reconstruction) { + return libmv_reconstruction->is_valid; +} + void libmv_reconstructionDestroy(libmv_Reconstruction *libmv_reconstruction) { LIBMV_OBJECT_DELETE(libmv_reconstruction->intrinsics, CameraIntrinsics); LIBMV_OBJECT_DELETE(libmv_reconstruction, libmv_Reconstruction); diff --git a/extern/libmv/intern/reconstruction.h b/extern/libmv/intern/reconstruction.h index 88e810b54aa..8b6b34a6142 100644 --- a/extern/libmv/intern/reconstruction.h +++ b/extern/libmv/intern/reconstruction.h @@ -68,6 +68,8 @@ libmv_Reconstruction* libmv_solveModal( reconstruct_progress_update_cb progress_update_callback, void* callback_customdata); +int libmv_reconstructionIsValid(libmv_Reconstruction *libmv_reconstruction); + void libmv_reconstructionDestroy(libmv_Reconstruction* libmv_reconstruction); int libmv_reprojectionPointForTrack( diff --git a/extern/libmv/intern/stub.cc b/extern/libmv/intern/stub.cc index f307d831475..f02509de90a 100644 --- a/extern/libmv/intern/stub.cc +++ b/extern/libmv/intern/stub.cc @@ -138,6 +138,10 @@ libmv_Reconstruction *libmv_solveModal( return NULL; } +int libmv_reconstructionIsValid(libmv_Reconstruction * /*libmv_reconstruction*/) { + return 0; +} + int libmv_reprojectionPointForTrack( const libmv_Reconstruction * /*libmv_reconstruction*/, int /*track*/, diff --git a/intern/atomic/atomic_ops.h b/intern/atomic/atomic_ops.h index f63ff630c40..06a5c8d834e 100644 --- a/intern/atomic/atomic_ops.h +++ b/intern/atomic/atomic_ops.h @@ -34,6 +34,11 @@ #if defined (__APPLE__) # include <libkern/OSAtomic.h> #elif defined(_MSC_VER) +# define NOGDI +# ifndef NOMINMAX +# define NOMINMAX +# endif +# define WIN32_LEAN_AND_MEAN # include <windows.h> #elif defined(__arm__) /* Attempt to fix compilation error on Debian armel kernel. @@ -97,13 +102,13 @@ atomic_cas_uint64(uint64_t *v, uint64_t old, uint64_t _new) ATOMIC_INLINE uint64_t atomic_add_uint64(uint64_t *p, uint64_t x) { - return InterlockedExchangeAdd64(p, x); + return InterlockedExchangeAdd64((int64_t *)p, (int64_t)x); } ATOMIC_INLINE uint64_t atomic_sub_uint64(uint64_t *p, uint64_t x) { - return InterlockedExchangeAdd64(p, -((int64_t)x)); + return InterlockedExchangeAdd64((int64_t *)p, -((int64_t)x)); } ATOMIC_INLINE uint64_t diff --git a/intern/cycles/CMakeLists.txt b/intern/cycles/CMakeLists.txt index 7de1182282d..c8c71fe6856 100644 --- a/intern/cycles/CMakeLists.txt +++ b/intern/cycles/CMakeLists.txt @@ -163,6 +163,10 @@ include_directories( ${OPENEXR_INCLUDE_DIRS} ) +# TODO(sergey): Adjust so standalone repository is also happy. +include_directories( + ../atomic +) # Warnings if(CMAKE_COMPILER_IS_GNUCXX) diff --git a/intern/cycles/SConscript b/intern/cycles/SConscript index b399844534d..15a02881ec2 100644 --- a/intern/cycles/SConscript +++ b/intern/cycles/SConscript @@ -62,12 +62,23 @@ if env['WITH_BF_CYCLES_OSL']: if env['WITH_BF_CYCLES_DEBUG']: defs.append('WITH_CYCLES_DEBUG') +if env['WITH_BF_CYCLES_LOGGING']: + defs.append('WITH_CYCLES_LOGGING') + defs.append('GOOGLE_GLOG_DLL_DECL=') + if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc', 'win64-mingw'): + incs.append('#extern/libmv/third_party/glog/src/windows') + incs.append('#extern/libmv/third_party/gflags') + else: + incs.append('#extern/libmv/third_party/glog/src') + incs.append('#extern/libmv/third_party/gflags') + incs.extend('. bvh render device kernel kernel/osl kernel/svm util subd'.split()) incs.extend('#intern/guardedalloc #source/blender/makesrna #source/blender/makesdna #source/blender/blenlib'.split()) incs.extend('#source/blender/blenloader ../../source/blender/makesrna/intern'.split()) incs.append(env['BF_GLEW_INC']) incs.append('#/intern/glew-mx') +incs.append('#/intern/atomic') incs.append('#intern/mikktspace') incs.extend('#extern/glew/include #extern/clew/include #extern/cuew/include #intern/mikktspace'.split()) diff --git a/intern/cycles/device/device_cuda.cpp b/intern/cycles/device/device_cuda.cpp index b3d4215e51b..05f45ab92af 100644 --- a/intern/cycles/device/device_cuda.cpp +++ b/intern/cycles/device/device_cuda.cpp @@ -202,24 +202,8 @@ public: /* compute cubin name */ int major, minor; cuDeviceComputeCapability(&major, &minor, cuDevId); - string cubin; - /* ToDo: We don't bundle sm_52 kernel yet */ - if(major == 5 && minor == 2) { - if(experimental) - cubin = path_get(string_printf("lib/kernel_experimental_sm_%d%d.cubin", major, minor)); - else - cubin = path_get(string_printf("lib/kernel_sm_%d%d.cubin", major, minor)); - - if(path_exists(cubin)) - /* self build sm_52 kernel? Use it. */ - return cubin; - else - /* use 5.0 kernel as workaround */ - minor = 0; - } - /* attempt to use kernel provided with blender */ if(experimental) cubin = path_get(string_printf("lib/kernel_experimental_sm_%d%d.cubin", major, minor)); diff --git a/intern/cycles/kernel/kernel_types.h b/intern/cycles/kernel/kernel_types.h index ca75c261636..1595f7a715a 100644 --- a/intern/cycles/kernel/kernel_types.h +++ b/intern/cycles/kernel/kernel_types.h @@ -539,34 +539,25 @@ typedef enum AttributeStandard { #define MAX_CLOSURE 1 #endif -/* TODO(sergey): This is rather nasty bug happening in here, which - * could be simply a compilers bug for which we can't find a generic - * platform independent workaround. Also even if it's a compiler - * issue, it's not so simple to upgrade the compiler in the release - * environment for Linux and doing it so closer to the release is - * rather a risky business. - * - * For this release it's probably safer to stick with such a rather - * dirty solution, and look for a cleaner fix during the next release - * cycle. +/* This struct is to be 16 bytes aligned, we also keep some extra precautions: + * - All the float3 members are in the beginning of the struct, so compiler + * does not put own pddings trying to align this members. + * - We make sure OSL pointer is also 16 bytes aligned. */ typedef struct ShaderClosure { - ClosureType type; float3 weight; -#ifndef __APPLE__ + float3 N; + float3 T; + + ClosureType type; float sample_weight; -#endif float data0; float data1; float data2; + int pad1, pad2, pad3; - float3 N; - float3 T; -#ifdef __APPLE__ - float sample_weight; -#endif #ifdef __OSL__ - void *prim; + void *prim, *pad4; #endif } ShaderClosure; diff --git a/intern/cycles/kernel/osl/SConscript b/intern/cycles/kernel/osl/SConscript index d721edbaf6e..0a21d3e6819 100644 --- a/intern/cycles/kernel/osl/SConscript +++ b/intern/cycles/kernel/osl/SConscript @@ -38,6 +38,7 @@ incs.append(env['BF_OIIO_INC']) incs.append(env['BF_BOOST_INC']) incs.append(env['BF_OSL_INC']) incs.append(env['BF_OPENEXR_INC'].split()) +incs.append('#/intern/atomic') defs.append('CCL_NAMESPACE_BEGIN=namespace ccl {') defs.append('CCL_NAMESPACE_END=}') @@ -46,6 +47,16 @@ defs.append('WITH_OSL') if env['WITH_BF_CYCLES_DEBUG']: defs.append('WITH_CYCLES_DEBUG') +if env['WITH_BF_CYCLES_LOGGING']: + defs.append('WITH_CYCLES_LOGGING') + defs.append('GOOGLE_GLOG_DLL_DECL=') + if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc', 'win64-mingw'): + incs.append('#extern/libmv/third_party/glog/src/windows') + incs.append('#extern/libmv/third_party/gflags') + else: + incs.append('#extern/libmv/third_party/glog/src') + incs.append('#extern/libmv/third_party/gflags') + if env['OURPLATFORM'] in ('win32-vc', 'win64-vc'): cxxflags.append('-DBOOST_NO_RTTI -DBOOST_NO_TYPEID /fp:fast'.split()) incs.append(env['BF_PTHREADS_INC']) diff --git a/intern/cycles/kernel/osl/osl_closures.cpp b/intern/cycles/kernel/osl/osl_closures.cpp index bae9cb2f377..1d99f1d2682 100644 --- a/intern/cycles/kernel/osl/osl_closures.cpp +++ b/intern/cycles/kernel/osl/osl_closures.cpp @@ -189,7 +189,7 @@ static void register_closure(OSL::ShadingSystem *ss, const char *name, int id, O /* optimization: it's possible to not use a prepare function at all and * only initialize the actual class when accessing the closure component * data, but then we need to map the id to the class somehow */ - ss->register_closure(name, id, params, prepare, NULL); + ss->register_closure(name, id, params, prepare, NULL, 16); } void OSLShader::register_closures(OSLShadingSystem *ss_) diff --git a/intern/cycles/render/shader.h b/intern/cycles/render/shader.h index b267731abe5..29c10ffa4f3 100644 --- a/intern/cycles/render/shader.h +++ b/intern/cycles/render/shader.h @@ -18,6 +18,15 @@ #define __SHADER_H__ #ifdef WITH_OSL +# if defined(_MSC_VER) +/* Prevent OSL from pollyting the context with weird macroses from windows.h. + * TODO(sergey): Ideally it's only enough to have class/struct declarations in + * the header and skip header include here. + */ +# define NOGDI +# define NOMINMAX +# define WIN32_LEAN_AND_MEAN +# endif # include <OSL/oslexec.h> #endif diff --git a/intern/cycles/util/CMakeLists.txt b/intern/cycles/util/CMakeLists.txt index 295ebd24a5c..a07deb68b15 100644 --- a/intern/cycles/util/CMakeLists.txt +++ b/intern/cycles/util/CMakeLists.txt @@ -30,6 +30,7 @@ endif() set(SRC_HEADERS util_algorithm.h util_args.h + util_atomic.h util_boundbox.h util_cache.h util_debug.h diff --git a/intern/cycles/util/util_atomic.h b/intern/cycles/util/util_atomic.h new file mode 100644 index 00000000000..1bbb0a86e23 --- /dev/null +++ b/intern/cycles/util/util_atomic.h @@ -0,0 +1,33 @@ +/* + * Copyright 2014 Blender Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License + */ + +#ifndef __UTIL_ATOMIC_H__ +#define __UTIL_ATOMIC_H__ + +/* Using atomic ops header from Blender. */ +#include "atomic_ops.h" + +ATOMIC_INLINE void atomic_update_max_z(size_t *maximum_value, size_t value) +{ + size_t prev_value = *maximum_value; + while (prev_value < value) { + if (atomic_cas_z(maximum_value, prev_value, value) != prev_value) { + break; + } + } +} + +#endif /* __UTIL_ATOMIC_H__ */ diff --git a/intern/cycles/util/util_stats.h b/intern/cycles/util/util_stats.h index 8758b823084..fe6c162366e 100644 --- a/intern/cycles/util/util_stats.h +++ b/intern/cycles/util/util_stats.h @@ -17,6 +17,8 @@ #ifndef __UTIL_STATS_H__ #define __UTIL_STATS_H__ +#include "util_atomic.h" + CCL_NAMESPACE_BEGIN class Stats { @@ -24,14 +26,13 @@ public: Stats() : mem_used(0), mem_peak(0) {} void mem_alloc(size_t size) { - mem_used += size; - if(mem_used > mem_peak) - mem_peak = mem_used; + atomic_add_z(&mem_used, size); + atomic_update_max_z(&mem_peak, mem_used); } void mem_free(size_t size) { assert(mem_used >= size); - mem_used -= size; + atomic_sub_z(&mem_used, size); } size_t mem_used; diff --git a/release/scripts/freestyle/modules/parameter_editor.py b/release/scripts/freestyle/modules/parameter_editor.py index aad470edb9d..ba79c5514e2 100644 --- a/release/scripts/freestyle/modules/parameter_editor.py +++ b/release/scripts/freestyle/modules/parameter_editor.py @@ -916,10 +916,7 @@ def process(layer_name, lineset_name): # execute line set pre-processing callback functions for fn in callbacks_lineset_pre: - try: - fn(scene, layer, lineset) - except Exception as e: - print(e) + fn(scene, layer, lineset) selection_criteria = [] # prepare selection criteria by visibility diff --git a/release/scripts/startup/bl_ui/properties_grease_pencil_common.py b/release/scripts/startup/bl_ui/properties_grease_pencil_common.py index 789d0a10a9e..5975931b83f 100644 --- a/release/scripts/startup/bl_ui/properties_grease_pencil_common.py +++ b/release/scripts/startup/bl_ui/properties_grease_pencil_common.py @@ -195,12 +195,14 @@ class GPENCIL_PIE_tool_palette(Menu): # NW - Select (Non-Modal) col = pie.column() col.operator("gpencil.select_all", text="Select All", icon='PARTICLE_POINT') + col.operator("gpencil.select_all", text="Select Inverse", icon='BLANK1') col.operator("gpencil.select_linked", text="Select Linked", icon='LINKED') # NE - Select (Modal) col = pie.column() col.operator("gpencil.select_border", text="Border Select", icon='BORDER_RECT') col.operator("gpencil.select_circle", text="Circle Select", icon='META_EMPTY') + col.operator("gpencil.select_lasso", text="Lasso Select", icon='BORDER_LASSO') # SW - Edit Tools col = pie.column() diff --git a/release/scripts/startup/bl_ui/space_clip.py b/release/scripts/startup/bl_ui/space_clip.py index 158de750185..d2f2612c84e 100644 --- a/release/scripts/startup/bl_ui/space_clip.py +++ b/release/scripts/startup/bl_ui/space_clip.py @@ -426,7 +426,9 @@ class CLIP_PT_tools_solve(CLIP_PT_tracking_panel, Panel): col = layout.column() row = col.row() row.prop(settings, "use_tripod_solver", text="Tripod") - row.prop(settings, "use_keyframe_selection", text="Keyframe") + sub = row.row() + sub.active = not settings.use_tripod_solver + sub.prop(settings, "use_keyframe_selection", text="Keyframe") col = layout.column(align=True) col.active = (not settings.use_tripod_solver and diff --git a/source/blender/blenfont/intern/blf_glyph.c b/source/blender/blenfont/intern/blf_glyph.c index 7978d28a4ef..c65a0825a49 100644 --- a/source/blender/blenfont/intern/blf_glyph.c +++ b/source/blender/blenfont/intern/blf_glyph.c @@ -262,8 +262,8 @@ GlyphBLF *blf_glyph_add(FontBLF *font, unsigned int index, unsigned int c) g->xoff = -1; g->yoff = -1; bitmap = slot->bitmap; - g->width = bitmap.width; - g->height = bitmap.rows; + g->width = (int)bitmap.width; + g->height = (int)bitmap.rows; if (g->width && g->height) { if (sharp) { diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c index a71f69529b0..1915a058771 100644 --- a/source/blender/blenkernel/intern/DerivedMesh.c +++ b/source/blender/blenkernel/intern/DerivedMesh.c @@ -77,7 +77,7 @@ static DerivedMesh *navmesh_dm_createNavMeshForVisualization(DerivedMesh *dm); #include "GPU_glew.h" /* very slow! enable for testing only! */ -// #define USE_MODIFIER_VALIDATE +//#define USE_MODIFIER_VALIDATE #ifdef USE_MODIFIER_VALIDATE # define ASSERT_IS_VALID_DM(dm) (BLI_assert((dm == NULL) || (DM_is_valid(dm) == true))) diff --git a/source/blender/blenkernel/intern/cdderivedmesh.c b/source/blender/blenkernel/intern/cdderivedmesh.c index 4a25a92b385..6ac85695570 100644 --- a/source/blender/blenkernel/intern/cdderivedmesh.c +++ b/source/blender/blenkernel/intern/cdderivedmesh.c @@ -1132,7 +1132,7 @@ static void cdDM_drawMappedFacesGLSL(DerivedMesh *dm, } if (numdata != 0) { elementsize = GPU_attrib_element_size(datatypes, numdata); - buffer = GPU_buffer_alloc(elementsize * dm->drawObject->tot_triangle_point, true); + buffer = GPU_buffer_alloc(elementsize * dm->drawObject->tot_triangle_point, false); if (buffer == NULL) { GPU_buffer_unbind(); buffer = GPU_buffer_alloc(elementsize * dm->drawObject->tot_triangle_point, true); diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c index 5c4ebea7d78..36cd7e69601 100644 --- a/source/blender/blenkernel/intern/image.c +++ b/source/blender/blenkernel/intern/image.c @@ -273,7 +273,13 @@ void BKE_image_free_buffers(Image *ima) ima->rr = NULL; } - GPU_free_image(ima); + if (!G.background) { + /* Background mode doesn't use opnegl, + * so we can avoid freeing GPU images and save some + * time by skipping mutex lock. + */ + GPU_free_image(ima); + } ima->ok = IMA_OK; } diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c index 999c8fba80f..86a2b1d8b61 100644 --- a/source/blender/blenkernel/intern/sequencer.c +++ b/source/blender/blenkernel/intern/sequencer.c @@ -1489,20 +1489,25 @@ static void seq_proxy_build_frame(const SeqRenderData *context, Sequence *seq, i int quality; int rectx, recty; int ok; - ImBuf *ibuf; + ImBuf *ibuf_tmp, *ibuf; if (!seq_proxy_get_fname(seq, cfra, proxy_render_size, name)) { return; } - ibuf = seq_render_strip(context, seq, cfra); + ibuf_tmp = seq_render_strip(context, seq, cfra); - rectx = (proxy_render_size * ibuf->x) / 100; - recty = (proxy_render_size * ibuf->y) / 100; + rectx = (proxy_render_size * ibuf_tmp->x) / 100; + recty = (proxy_render_size * ibuf_tmp->y) / 100; - if (ibuf->x != rectx || ibuf->y != recty) { + if (ibuf_tmp->x != rectx || ibuf_tmp->y != recty) { + ibuf = IMB_dupImBuf(ibuf_tmp); + IMB_freeImBuf(ibuf_tmp); IMB_scalefastImBuf(ibuf, (short)rectx, (short)recty); } + else { + ibuf = ibuf_tmp; + } /* depth = 32 is intentionally left in, otherwise ALPHA channels * won't work... */ diff --git a/source/blender/blenkernel/intern/tracking_region_tracker.c b/source/blender/blenkernel/intern/tracking_region_tracker.c index 72c9b86270b..dd7def16ca8 100644 --- a/source/blender/blenkernel/intern/tracking_region_tracker.c +++ b/source/blender/blenkernel/intern/tracking_region_tracker.c @@ -113,7 +113,7 @@ static float *track_get_search_floatbuf(ImBuf *ibuf, MovieTrackingTrack *track, return gray_pixels; } -/* Get image boffer for a given frame +/* Get image buffer for a given frame * * Frame is in clip space. */ diff --git a/source/blender/blenkernel/intern/tracking_solver.c b/source/blender/blenkernel/intern/tracking_solver.c index 6d4e7efa815..d5e2f24e9ed 100644 --- a/source/blender/blenkernel/intern/tracking_solver.c +++ b/source/blender/blenkernel/intern/tracking_solver.c @@ -391,7 +391,7 @@ MovieReconstructContext *BKE_tracking_reconstruction_context_new(MovieClip *clip last_marker--; } - if (first < track->markersnr - 1) + if (first <= track->markersnr - 1) sfra = min_ii(sfra, first_marker->framenr); if (last >= 0) @@ -509,6 +509,11 @@ bool BKE_tracking_reconstruction_finish(MovieReconstructContext *context, MovieT MovieTrackingReconstruction *reconstruction; MovieTrackingObject *object; + if (!libmv_reconstructionIsValid(context->reconstruction)) { + printf("Failed solve the motion: most likely there are no good keyframes\n"); + return false; + } + tracks_map_merge(context->tracks_map, tracking); BKE_tracking_dopesheet_tag_update(tracking); diff --git a/source/blender/blenkernel/intern/writeffmpeg.c b/source/blender/blenkernel/intern/writeffmpeg.c index d4589237b6c..d4f5da2e36f 100644 --- a/source/blender/blenkernel/intern/writeffmpeg.c +++ b/source/blender/blenkernel/intern/writeffmpeg.c @@ -493,7 +493,7 @@ static void set_ffmpeg_properties(RenderData *rd, AVCodecContext *c, const char * * For as long we don't allow editing properties in the interface * it's all good. bug if we allow editing them, we'll need to - * repace it with some smarter code which would port settings + * replace it with some smarter code which would port settings * from deprecated to new one. */ ffmpeg_set_expert_options(rd); diff --git a/source/blender/blenlib/BLI_callbacks.h b/source/blender/blenlib/BLI_callbacks.h index 2f963cfac51..7cf524749c2 100644 --- a/source/blender/blenlib/BLI_callbacks.h +++ b/source/blender/blenlib/BLI_callbacks.h @@ -41,6 +41,7 @@ typedef enum { BLI_CB_EVT_FRAME_CHANGE_POST, BLI_CB_EVT_RENDER_PRE, BLI_CB_EVT_RENDER_POST, + BLI_CB_EVT_RENDER_WRITE, BLI_CB_EVT_RENDER_STATS, BLI_CB_EVT_RENDER_INIT, BLI_CB_EVT_RENDER_COMPLETE, diff --git a/source/blender/blenlib/CMakeLists.txt b/source/blender/blenlib/CMakeLists.txt index cb84c0d2e52..55a5d911d78 100644 --- a/source/blender/blenlib/CMakeLists.txt +++ b/source/blender/blenlib/CMakeLists.txt @@ -30,6 +30,7 @@ set(INC # ../blenkernel # dont add this back! ../makesdna ../../../intern/guardedalloc + ../../../intern/atomic ../../../extern/wcwidth ) diff --git a/source/blender/blenlib/SConscript b/source/blender/blenlib/SConscript index 2dabb5a7334..55747a426f0 100644 --- a/source/blender/blenlib/SConscript +++ b/source/blender/blenlib/SConscript @@ -35,6 +35,7 @@ incs = [ '.', '#/extern/wcwidth', '#/intern/guardedalloc', + '#/intern/atomic', '../makesdna', env['BF_FREETYPE_INC'], env['BF_ZLIB_INC'], diff --git a/source/blender/blenlib/intern/BLI_linklist.c b/source/blender/blenlib/intern/BLI_linklist.c index a0b61e7945c..6b79cf97e86 100644 --- a/source/blender/blenlib/intern/BLI_linklist.c +++ b/source/blender/blenlib/intern/BLI_linklist.c @@ -32,6 +32,8 @@ #include "MEM_guardedalloc.h" + +#include "BLI_utildefines.h" #include "BLI_linklist.h" #include "BLI_memarena.h" #include "BLI_mempool.h" @@ -96,7 +98,7 @@ void BLI_linklist_prepend_nlink(LinkNode **listp, void *ptr, LinkNode *nlink) void BLI_linklist_prepend(LinkNode **listp, void *ptr) { - LinkNode *nlink = MEM_mallocN(sizeof(*nlink), "nlink"); + LinkNode *nlink = MEM_mallocN(sizeof(*nlink), __func__); BLI_linklist_prepend_nlink(listp, ptr, nlink); } @@ -135,7 +137,7 @@ void BLI_linklist_append_nlink(LinkNode **listp, void *ptr, LinkNode *nlink) void BLI_linklist_append(LinkNode **listp, void *ptr) { - LinkNode *nlink = MEM_mallocN(sizeof(*nlink), "nlink"); + LinkNode *nlink = MEM_mallocN(sizeof(*nlink), __func__); BLI_linklist_append_nlink(listp, ptr, nlink); } @@ -177,7 +179,7 @@ void *BLI_linklist_pop_pool(struct LinkNode **listp, struct BLI_mempool *mempool void BLI_linklist_insert_after(LinkNode **listp, void *ptr) { - LinkNode *nlink = MEM_mallocN(sizeof(*nlink), "nlink"); + LinkNode *nlink = MEM_mallocN(sizeof(*nlink), __func__); LinkNode *node = *listp; nlink->link = ptr; diff --git a/source/blender/blenlib/intern/task.c b/source/blender/blenlib/intern/task.c index e4cded18b76..d187a8d1968 100644 --- a/source/blender/blenlib/intern/task.c +++ b/source/blender/blenlib/intern/task.c @@ -33,6 +33,8 @@ #include "BLI_task.h" #include "BLI_threads.h" +#include "atomic_ops.h" + /* Types */ typedef struct Task { @@ -49,8 +51,8 @@ struct TaskPool { volatile size_t num; volatile size_t done; - volatile int num_threads; - volatile int currently_running_tasks; + size_t num_threads; + size_t currently_running_tasks; ThreadMutex num_mutex; ThreadCondition num_cond; @@ -86,7 +88,7 @@ static void task_pool_num_decrease(TaskPool *pool, size_t done) BLI_assert(pool->num >= done); pool->num -= done; - pool->currently_running_tasks -= done; + atomic_sub_z(&pool->currently_running_tasks, done); pool->done += done; if (pool->num == 0) @@ -130,7 +132,7 @@ static bool task_scheduler_thread_wait_pop(TaskScheduler *scheduler, Task **task { *task = current_task; found_task = true; - pool->currently_running_tasks++; + atomic_add_z(&pool->currently_running_tasks, 1); BLI_remlink(&scheduler->queue, *task); break; } @@ -392,7 +394,7 @@ void BLI_task_pool_work_and_wait(TaskPool *pool) /* if found task, do it, otherwise wait until other tasks are done */ if (found_task) { /* run task */ - pool->currently_running_tasks++; + atomic_add_z(&pool->currently_running_tasks, 1); work_task->run(pool, work_task->taskdata, 0); /* delete task */ diff --git a/source/blender/bmesh/intern/bmesh_polygon.c b/source/blender/bmesh/intern/bmesh_polygon.c index a5a7bc5189e..4a1ab86a3fc 100644 --- a/source/blender/bmesh/intern/bmesh_polygon.c +++ b/source/blender/bmesh/intern/bmesh_polygon.c @@ -945,36 +945,26 @@ void BM_face_triangulate(BMesh *bm, BMFace *f, nf_i = 0; for (i = 0; i < edge_array_len; i++) { - BMFace *f_a, *f_b; + BMFace *f_pair[2]; BMEdge *e = edge_array[i]; + int j; #ifndef NDEBUG - const bool ok = BM_edge_face_pair(e, &f_a, &f_b); + const bool ok = BM_edge_face_pair(e, &f_pair[0], &f_pair[1]); BLI_assert(ok); #else - BM_edge_face_pair(e, &f_a, &f_b); + BM_edge_face_pair(e, &f_pair[0], &f_pair[1]); #endif - - if (FACE_USED_TEST(f_a) == false) { - FACE_USED_SET(f_a); /* set_dirty */ - - if (nf_i < edge_array_len) { - r_faces_new[nf_i++] = f_a; - } - else { - f_new = f_a; - break; - } - } - - if (FACE_USED_TEST(f_b) == false) { - FACE_USED_SET(f_b); /* set_dirty */ - - if (nf_i < edge_array_len) { - r_faces_new[nf_i++] = f_b; - } - else { - f_new = f_b; - break; + for (j = 0; j < 2; j++) { + if (FACE_USED_TEST(f_pair[j]) == false) { + FACE_USED_SET(f_pair[j]); /* set_dirty */ + + if (nf_i < edge_array_len) { + r_faces_new[nf_i++] = f_pair[j]; + } + else { + f_new = f_pair[j]; + break; + } } } } diff --git a/source/blender/bmesh/tools/bmesh_beautify.c b/source/blender/bmesh/tools/bmesh_beautify.c index 6639e767e77..a5b60268b8e 100644 --- a/source/blender/bmesh/tools/bmesh_beautify.c +++ b/source/blender/bmesh/tools/bmesh_beautify.c @@ -400,9 +400,10 @@ static void bm_edge_update_beauty_cost(BMEdge *e, Heap *eheap, HeapNode **eheap_ /** * \note This function sets the edge indices to invalid values. */ -void BM_mesh_beautify_fill(BMesh *bm, BMEdge **edge_array, const int edge_array_len, - const short flag, const short method, - const short oflag_edge, const short oflag_face) +void BM_mesh_beautify_fill( + BMesh *bm, BMEdge **edge_array, const int edge_array_len, + const short flag, const short method, + const short oflag_edge, const short oflag_face) { Heap *eheap; /* edge heap */ HeapNode **eheap_table; /* edge index aligned table pointing to the eheap */ diff --git a/source/blender/bmesh/tools/bmesh_beautify.h b/source/blender/bmesh/tools/bmesh_beautify.h index 7cc17008b50..0d6aa23b81d 100644 --- a/source/blender/bmesh/tools/bmesh_beautify.h +++ b/source/blender/bmesh/tools/bmesh_beautify.h @@ -31,12 +31,14 @@ enum { VERT_RESTRICT_TAG = (1 << 0), }; -void BM_mesh_beautify_fill(BMesh *bm, BMEdge **edge_array, const int edge_array_len, - const short flag, const short method, - const short oflag_edge, const short oflag_face); +void BM_mesh_beautify_fill( + BMesh *bm, BMEdge **edge_array, const int edge_array_len, + const short flag, const short method, + const short oflag_edge, const short oflag_face); -float BM_verts_calc_rotate_beauty(const BMVert *v1, const BMVert *v2, - const BMVert *v3, const BMVert *v4, - const short flag, const short method); +float BM_verts_calc_rotate_beauty( + const BMVert *v1, const BMVert *v2, + const BMVert *v3, const BMVert *v4, + const short flag, const short method); #endif /* __BMESH_BEAUTIFY_H__ */ diff --git a/source/blender/collada/ArmatureImporter.cpp b/source/blender/collada/ArmatureImporter.cpp index db24bf6d0cf..bdfb7021370 100644 --- a/source/blender/collada/ArmatureImporter.cpp +++ b/source/blender/collada/ArmatureImporter.cpp @@ -208,7 +208,7 @@ int ArmatureImporter::create_bone(SkinInfo *skin, COLLADAFW::Node *node, EditBon * tail locations for the affected bones (nodes which don't have any connected child) * Hint: The extended_bones set gets populated in ArmatureImporter::create_bone **/ -void ArmatureImporter::fix_bone_orientation(bArmature *armature, Bone *bone) +void ArmatureImporter::fix_leaf_bones(bArmature *armature, Bone *bone) { /* armature has no bones */ if (bone == NULL) @@ -220,27 +220,33 @@ void ArmatureImporter::fix_bone_orientation(bArmature *armature, Bone *bone) float leaf_length = (leaf_bone_length == FLT_MAX) ? 1.0 : leaf_bone_length; EditBone *ebone = get_edit_bone(armature, bone->name); - float vec[3]; - if (ebone->parent != NULL) { - EditBone *parent = ebone->parent; - sub_v3_v3v3(vec, ebone->head, parent->tail); - if (len_squared_v3(vec) < MINIMUM_BONE_LENGTH) - { - sub_v3_v3v3(vec, parent->tail, parent->head); + + if (this->import_settings->fix_orientation) { + if (ebone->parent != NULL) { + EditBone *parent = ebone->parent; + sub_v3_v3v3(vec, ebone->head, parent->tail); + if (len_squared_v3(vec) < MINIMUM_BONE_LENGTH) + { + sub_v3_v3v3(vec, parent->tail, parent->head); + } + } + else { + vec[2] = 0.1f; + sub_v3_v3v3(vec, ebone->tail, ebone->head); } } else { - vec[2] = 0.1f; sub_v3_v3v3(vec, ebone->tail, ebone->head); } + normalize_v3_v3(vec, vec); mul_v3_fl(vec, leaf_length); add_v3_v3v3(ebone->tail, ebone->head, vec); } for (Bone *child = (Bone *)bone->childbase.first; child; child = child->next) { - fix_bone_orientation(armature, child); + fix_leaf_bones(armature, child); } } @@ -447,7 +453,7 @@ void ArmatureImporter::create_armature_bones( ) ED_armature_to_edit(armature); connect_bone_chains(armature, (Bone *)armature->bonebase.first, UNLIMITED_CHAIN_MAX); - fix_bone_orientation(armature, (Bone *)armature->bonebase.first); + fix_leaf_bones(armature, (Bone *)armature->bonebase.first); // exit armature edit mode unskinned_armature_map[(*ri)->getUniqueId()] = ob_arm; @@ -584,7 +590,7 @@ void ArmatureImporter::create_armature_bones(SkinInfo& skin) ED_armature_to_edit(armature); connect_bone_chains(armature, (Bone *)armature->bonebase.first, UNLIMITED_CHAIN_MAX); - fix_bone_orientation(armature, (Bone *)armature->bonebase.first); + fix_leaf_bones(armature, (Bone *)armature->bonebase.first); // exit armature edit mode ED_armature_from_edit(armature); @@ -886,7 +892,7 @@ bool ArmatureImporter::get_joint_bind_mat(float m[4][4], COLLADAFW::Node *joint) /** * BoneExtended is a helper class needed for the Bone chain finder - * See ArmatureImporter::fix_bone_orientation() + * See ArmatureImporter::fix_leaf_bones() * and ArmatureImporter::connect_bone_chains() **/ diff --git a/source/blender/collada/ArmatureImporter.h b/source/blender/collada/ArmatureImporter.h index e09906e6c92..732fda80ff1 100644 --- a/source/blender/collada/ArmatureImporter.h +++ b/source/blender/collada/ArmatureImporter.h @@ -130,7 +130,7 @@ private: BoneExtended &add_bone_extended(EditBone *bone, COLLADAFW::Node * node); void clear_extended_boneset(); - void fix_bone_orientation(bArmature *armature, Bone *bone); + void fix_leaf_bones(bArmature *armature, Bone *bone); void connect_bone_chains(bArmature *armature, Bone *bone, const int max_chain_length); void set_pose( Object *ob_arm, COLLADAFW::Node *root_node, const char *parentname, float parent_mat[4][4]); diff --git a/source/blender/collada/ImportSettings.h b/source/blender/collada/ImportSettings.h index f2185b13c50..51a13da7724 100644 --- a/source/blender/collada/ImportSettings.h +++ b/source/blender/collada/ImportSettings.h @@ -33,6 +33,7 @@ struct ImportSettings { public: bool import_units; bool find_chains; + bool fix_orientation; int min_chain_length; char *filepath; }; diff --git a/source/blender/collada/collada.cpp b/source/blender/collada/collada.cpp index 826d634b8f1..f1d5f1a208a 100644 --- a/source/blender/collada/collada.cpp +++ b/source/blender/collada/collada.cpp @@ -46,14 +46,15 @@ int collada_import(bContext *C, const char *filepath, int import_units, int find_chains, + int fix_orientation, int min_chain_length) { ImportSettings import_settings; - import_settings.filepath = (char *)filepath; - - import_settings.import_units = import_units != 0; - import_settings.find_chains = find_chains != 0; + import_settings.filepath = (char *)filepath; + import_settings.import_units = import_units != 0; + import_settings.find_chains = find_chains != 0; + import_settings.fix_orientation = fix_orientation != 0; import_settings.min_chain_length = min_chain_length; DocumentImporter imp(C, &import_settings); diff --git a/source/blender/collada/collada.h b/source/blender/collada/collada.h index 0a2713b1db5..6819a62fdf0 100644 --- a/source/blender/collada/collada.h +++ b/source/blender/collada/collada.h @@ -57,6 +57,7 @@ int collada_import(struct bContext *C, const char *filepath, int import_units, int find_chains, + int fix_orientation, int min_chain_length); int collada_export(struct Scene *sce, diff --git a/source/blender/compositor/operations/COM_SunBeamsOperation.cpp b/source/blender/compositor/operations/COM_SunBeamsOperation.cpp index bcef652a8b5..12b04c386f2 100644 --- a/source/blender/compositor/operations/COM_SunBeamsOperation.cpp +++ b/source/blender/compositor/operations/COM_SunBeamsOperation.cpp @@ -50,34 +50,52 @@ void SunBeamsOperation::initExecution() * For a target point (x,y) the sector should be chosen such that * ``u >= v >= 0`` * This removes the need to handle all sorts of special cases. + * + * Template parameters: + * fxu : buffer increment in x for sector u+1 + * fxv : buffer increment in x for sector v+1 + * fyu : buffer increment in y for sector u+1 + * fyv : buffer increment in y for sector v+1 */ -template <int fxx, int fxy, int fyx, int fyy> +template <int fxu, int fxv, int fyu, int fyv> struct BufferLineAccumulator { /* utility functions implementing the matrix transform to/from sector space */ - - static inline void buffer_to_sector(int x, int y, int &u, int &v) + + static inline void buffer_to_sector(const float source[2], int x, int y, int &u, int &v) { - u = x * fxx + y * fyx; - v = x * fxy + y * fyy; + int x0 = (int)source[0]; + int y0 = (int)source[1]; + x -= x0; + y -= y0; + u = x * fxu + y * fyu; + v = x * fxv + y * fyv; } - static inline void buffer_to_sector(float x, float y, float &u, float &v) + static inline void buffer_to_sector(const float source[2], float x, float y, float &u, float &v) { - u = x * fxx + y * fyx; - v = x * fxy + y * fyy; + int x0 = (int)source[0]; + int y0 = (int)source[1]; + x -= (float)x0; + y -= (float)y0; + u = x * fxu + y * fyu; + v = x * fxv + y * fyv; } - static inline void sector_to_buffer(int u, int v, int &x, int &y) + static inline void sector_to_buffer(const float source[2], int u, int v, int &x, int &y) { - x = u * fxx + v * fxy; - y = u * fyx + v * fyy; + int x0 = (int)source[0]; + int y0 = (int)source[1]; + x = x0 + u * fxu + v * fxv; + y = y0 + u * fyu + v * fyv; } - static inline void sector_to_buffer(float u, float v, float &x, float &y) + static inline void sector_to_buffer(const float source[2], float u, float v, float &x, float &y) { - x = u * fxx + v * fxy; - y = u * fyx + v * fyy; + int x0 = (int)source[0]; + int y0 = (int)source[1]; + x = (float)x0 + u * fxu + v * fxv; + y = (float)y0 + u * fyu + v * fyv; } /** @@ -91,12 +109,12 @@ struct BufferLineAccumulator { * \param num Total steps in the loop * \param v, dv Vertical offset in sector space, for line offset perpendicular to the loop axis */ - static float *init_buffer_iterator(MemoryBuffer *input, const float source[2], const float pt_ofs[2], + static float *init_buffer_iterator(MemoryBuffer *input, const float source[2], const float co[2], float dist_min, float dist_max, int &x, int &y, int &num, float &v, float &dv, float &falloff_factor) { float pu, pv; - buffer_to_sector(pt_ofs[0], pt_ofs[1], pu, pv); + buffer_to_sector(source, co[0], co[1], pu, pv); /* line angle */ float tan_phi = pv / pu; @@ -113,9 +131,7 @@ struct BufferLineAccumulator { int end = (int)ceilf(umin); num = end - start; - sector_to_buffer(end, (int)ceilf(v), x, y); - x += (int)source[0]; - y += (int)source[1]; + sector_to_buffer(source, end, (int)ceilf(v), x, y); falloff_factor = dist_max > dist_min ? dr / (float)(dist_max - dist_min) : 0.0f; @@ -130,7 +146,7 @@ struct BufferLineAccumulator { * The loop runs backwards(!) over the primary sector space axis u, i.e. increasing distance to pt. * After each step it decrements v by dv < 1, adding a buffer shift when necessary. */ - static void eval(MemoryBuffer *input, float output[4], const float pt_ofs[2], const float source[2], + static void eval(MemoryBuffer *input, float output[4], const float co[2], const float source[2], float dist_min, float dist_max) { rcti rect = *input->getRect(); @@ -139,14 +155,16 @@ struct BufferLineAccumulator { float v, dv; float falloff_factor; float border[4]; - - if ((int)pt_ofs[0] == 0 && (int)pt_ofs[1] == 0) { + + zero_v4(output); + + if ((int)(co[0] - source[0]) == 0 && (int)(co[1] - source[1]) == 0) { copy_v4_v4(output, input->getBuffer() + COM_NUMBER_OF_CHANNELS * ((int)source[0] + input->getWidth() * (int)source[1])); return; } /* initialise the iteration variables */ - float *buffer = init_buffer_iterator(input, source, pt_ofs, dist_min, dist_max, x, y, num, v, dv, falloff_factor); + float *buffer = init_buffer_iterator(input, source, co, dist_min, dist_max, x, y, num, v, dv, falloff_factor); zero_v3(border); border[3] = 1.0f; @@ -178,18 +196,18 @@ struct BufferLineAccumulator { */ /* decrement u */ - x -= fxx; - y -= fyx; - buffer -= (fxx + fyx * buffer_width) * COM_NUMBER_OF_CHANNELS; + x -= fxu; + y -= fyu; + buffer -= (fxu + fyu * buffer_width) * COM_NUMBER_OF_CHANNELS; /* decrement v (in steps of dv < 1) */ v_local -= dv; if (v_local < 0.0f) { v_local += 1.0f; - x -= fxy; - y -= fyy; - buffer -= (fxy + fyy * buffer_width) * COM_NUMBER_OF_CHANNELS; + x -= fxv; + y -= fyv; + buffer -= (fxv + fyv * buffer_width) * COM_NUMBER_OF_CHANNELS; } } @@ -233,21 +251,21 @@ static void accumulate_line(MemoryBuffer *input, float output[4], const float co if (pt_ofs[0] > 0.0f) { if (pt_ofs[1] > 0.0f) { /* 2 */ - BufferLineAccumulator<0, 1, 1, 0>::eval(input, output, pt_ofs, source, dist_min, dist_max); + BufferLineAccumulator<0, 1, 1, 0>::eval(input, output, co, source, dist_min, dist_max); } else { /* 7 */ - BufferLineAccumulator<0, 1, -1, 0>::eval(input, output, pt_ofs, source, dist_min, dist_max); + BufferLineAccumulator<0, 1, -1, 0>::eval(input, output, co, source, dist_min, dist_max); } } else { if (pt_ofs[1] > 0.0f) { /* 3 */ - BufferLineAccumulator<0, -1, 1, 0>::eval(input, output, pt_ofs, source, dist_min, dist_max); + BufferLineAccumulator<0, -1, 1, 0>::eval(input, output, co, source, dist_min, dist_max); } else { /* 6 */ - BufferLineAccumulator<0, -1, -1, 0>::eval(input, output, pt_ofs, source, dist_min, dist_max); + BufferLineAccumulator<0, -1, -1, 0>::eval(input, output, co, source, dist_min, dist_max); } } } @@ -255,21 +273,21 @@ static void accumulate_line(MemoryBuffer *input, float output[4], const float co if (pt_ofs[0] > 0.0f) { if (pt_ofs[1] > 0.0f) { /* 1 */ - BufferLineAccumulator< 1, 0, 0, 1>::eval(input, output, pt_ofs, source, dist_min, dist_max); + BufferLineAccumulator< 1, 0, 0, 1>::eval(input, output, co, source, dist_min, dist_max); } else { /* 8 */ - BufferLineAccumulator< 1, 0, 0, -1>::eval(input, output, pt_ofs, source, dist_min, dist_max); + BufferLineAccumulator< 1, 0, 0, -1>::eval(input, output, co, source, dist_min, dist_max); } } else { if (pt_ofs[1] > 0.0f) { /* 4 */ - BufferLineAccumulator<-1, 0, 0, 1>::eval(input, output, pt_ofs, source, dist_min, dist_max); + BufferLineAccumulator<-1, 0, 0, 1>::eval(input, output, co, source, dist_min, dist_max); } else { /* 5 */ - BufferLineAccumulator<-1, 0, 0, -1>::eval(input, output, pt_ofs, source, dist_min, dist_max); + BufferLineAccumulator<-1, 0, 0, -1>::eval(input, output, co, source, dist_min, dist_max); } } } diff --git a/source/blender/editors/gpencil/drawgpencil.c b/source/blender/editors/gpencil/drawgpencil.c index 2584f578250..66a47a578e8 100644 --- a/source/blender/editors/gpencil/drawgpencil.c +++ b/source/blender/editors/gpencil/drawgpencil.c @@ -957,8 +957,11 @@ static void gp_draw_data(bGPdata *gpd, int offsx, int offsy, int winx, int winy, /* turn on smooth lines (i.e. anti-aliasing) */ glEnable(GL_LINE_SMOOTH); + glEnable(GL_POLYGON_SMOOTH); + glHint(GL_POLYGON_SMOOTH_HINT, GL_NICEST); + /* turn on alpha-blending */ - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA); glEnable(GL_BLEND); /* loop over layers, drawing them */ @@ -1055,6 +1058,7 @@ static void gp_draw_data(bGPdata *gpd, int offsx, int offsy, int winx, int winy, /* turn off alpha blending, then smooth lines */ glDisable(GL_BLEND); // alpha blending glDisable(GL_LINE_SMOOTH); // smooth lines + glDisable(GL_POLYGON_SMOOTH); // smooth poly lines /* restore initial gl conditions */ glLineWidth(1.0); diff --git a/source/blender/editors/gpencil/gpencil_edit.c b/source/blender/editors/gpencil/gpencil_edit.c index a6efeef8716..6c7cd747a55 100644 --- a/source/blender/editors/gpencil/gpencil_edit.c +++ b/source/blender/editors/gpencil/gpencil_edit.c @@ -967,7 +967,8 @@ void GPENCIL_OT_delete(wmOperatorType *ot) {GP_DELETEOP_STROKES, "STROKES", 0, "Strokes", "Delete selected strokes"}, {GP_DELETEOP_FRAME, "FRAME", 0, "Frame", "Delete active frame"}, {0, "", 0, NULL, NULL}, - {GP_DELETEOP_POINTS_DISSOLVE, "DISSOLVE_POINTS", 0, "Dissolve Points", "Delete selected points without splitting strokesp"}, + {GP_DELETEOP_POINTS_DISSOLVE, "DISSOLVE_POINTS", 0, "Dissolve Points", + "Delete selected points without splitting strokes"}, {0, NULL, 0, NULL, NULL} }; diff --git a/source/blender/editors/gpencil/gpencil_intern.h b/source/blender/editors/gpencil/gpencil_intern.h index b6b07c6001f..12f231a47bf 100644 --- a/source/blender/editors/gpencil/gpencil_intern.h +++ b/source/blender/editors/gpencil/gpencil_intern.h @@ -117,6 +117,7 @@ void GPENCIL_OT_select(struct wmOperatorType *ot); void GPENCIL_OT_select_all(struct wmOperatorType *ot); void GPENCIL_OT_select_circle(struct wmOperatorType *ot); void GPENCIL_OT_select_border(struct wmOperatorType *ot); +void GPENCIL_OT_select_lasso(struct wmOperatorType *ot); void GPENCIL_OT_select_linked(struct wmOperatorType *ot); void GPENCIL_OT_select_more(struct wmOperatorType *ot); diff --git a/source/blender/editors/gpencil/gpencil_ops.c b/source/blender/editors/gpencil/gpencil_ops.c index e46f71b8f53..5c96644eb96 100644 --- a/source/blender/editors/gpencil/gpencil_ops.c +++ b/source/blender/editors/gpencil/gpencil_ops.c @@ -124,6 +124,12 @@ static void ed_keymap_gpencil_editing(wmKeyConfig *keyconf) /* border select */ WM_keymap_add_item(keymap, "GPENCIL_OT_select_border", BKEY, KM_PRESS, 0, 0); + /* lasso select */ + kmi = WM_keymap_add_item(keymap, "GPENCIL_OT_select_lasso", EVT_TWEAK_A, KM_ANY, KM_CTRL, 0); + RNA_boolean_set(kmi->ptr, "deselect", false); + kmi = WM_keymap_add_item(keymap, "GPENCIL_OT_select_lasso", EVT_TWEAK_A, KM_ANY, KM_SHIFT | KM_CTRL, 0); + RNA_boolean_set(kmi->ptr, "deselect", true); + /* normal select */ WM_keymap_add_item(keymap, "GPENCIL_OT_select", SELECTMOUSE, KM_PRESS, 0, 0); @@ -201,6 +207,7 @@ void ED_operatortypes_gpencil(void) WM_operatortype_append(GPENCIL_OT_select_all); WM_operatortype_append(GPENCIL_OT_select_circle); WM_operatortype_append(GPENCIL_OT_select_border); + WM_operatortype_append(GPENCIL_OT_select_lasso); WM_operatortype_append(GPENCIL_OT_select_linked); WM_operatortype_append(GPENCIL_OT_select_more); diff --git a/source/blender/editors/gpencil/gpencil_select.c b/source/blender/editors/gpencil/gpencil_select.c index 29de5c414d8..6478af8c306 100644 --- a/source/blender/editors/gpencil/gpencil_select.c +++ b/source/blender/editors/gpencil/gpencil_select.c @@ -37,6 +37,7 @@ #include "BLI_math.h" #include "BLI_blenlib.h" +#include "BLI_lasso.h" #include "BLI_utildefines.h" #include "DNA_gpencil_types.h" @@ -658,6 +659,111 @@ void GPENCIL_OT_select_border(wmOperatorType *ot) } /* ********************************************** */ +/* Lasso */ + +static int gpencil_lasso_select_exec(bContext *C, wmOperator *op) +{ + GP_SpaceConversion gsc = {NULL}; + rcti rect = {0}; + + const bool extend = RNA_boolean_get(op->ptr, "extend"); + const bool select = !RNA_boolean_get(op->ptr, "deselect"); + + int mcords_tot; + const int (*mcords)[2] = WM_gesture_lasso_path_to_array(C, op, &mcords_tot); + + bool changed = false; + + /* sanity check */ + if (mcords == NULL) + return OPERATOR_PASS_THROUGH; + + /* compute boundbox of lasso (for faster testing later) */ + BLI_lasso_boundbox(&rect, mcords, mcords_tot); + + /* init space conversion stuff */ + gp_point_conversion_init(C, &gsc); + + /* deselect all strokes first? */ + if (select && !extend) { + CTX_DATA_BEGIN(C, bGPDstroke *, gps, editable_gpencil_strokes) + { + bGPDspoint *pt; + int i; + + for (i = 0, pt = gps->points; i < gps->totpoints; i++, pt++) { + pt->flag &= ~GP_SPOINT_SELECT; + } + + gps->flag &= ~GP_STROKE_SELECT; + } + CTX_DATA_END; + } + + /* select/deselect points */ + CTX_DATA_BEGIN(C, bGPDstroke *, gps, editable_gpencil_strokes) + { + bGPDspoint *pt; + int i; + + for (i = 0, pt = gps->points; i < gps->totpoints; i++, pt++) { + int x0, y0; + + /* convert point coords to screenspace */ + gp_point_to_xy(&gsc, gps, pt, &x0, &y0); + + /* test if in lasso boundbox + within the lasso noose */ + if ((!ELEM(V2D_IS_CLIPPED, x0, y0)) && BLI_rcti_isect_pt(&rect, x0, y0) && + BLI_lasso_is_point_inside(mcords, mcords_tot, x0, y0, INT_MAX)) + { + if (select) { + pt->flag |= GP_SPOINT_SELECT; + } + else { + pt->flag &= ~GP_SPOINT_SELECT; + } + + changed = true; + } + } + + /* Ensure that stroke selection is in sync with its points */ + gpencil_stroke_sync_selection(gps); + } + CTX_DATA_END; + + /* cleanup */ + MEM_freeN((void *)mcords); + + /* updates */ + if (changed) { + WM_event_add_notifier(C, NC_GPENCIL | NA_SELECTED, NULL); + } + + return OPERATOR_FINISHED; +} + +void GPENCIL_OT_select_lasso(wmOperatorType *ot) +{ + ot->name = "Lasso Select Strokes"; + ot->description = "Select Grease Pencil strokes using lasso selection"; + ot->idname = "GPENCIL_OT_select_lasso"; + + ot->invoke = WM_gesture_lasso_invoke; + ot->modal = WM_gesture_lasso_modal; + ot->exec = gpencil_lasso_select_exec; + ot->poll = gpencil_select_poll; + ot->cancel = WM_gesture_lasso_cancel; + + /* flags */ + ot->flag = OPTYPE_UNDO; + + RNA_def_collection_runtime(ot->srna, "path", &RNA_OperatorMousePath, "Path", ""); + RNA_def_boolean(ot->srna, "deselect", 0, "Deselect", "Deselect rather than select items"); + RNA_def_boolean(ot->srna, "extend", 1, "Extend", "Extend selection instead of deselecting everything first"); +} + +/* ********************************************** */ /* Mouse Click to Select */ static int gpencil_select_exec(bContext *C, wmOperator *op) diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h index 402d54cab5e..2823adaec42 100644 --- a/source/blender/editors/include/UI_interface.h +++ b/source/blender/editors/include/UI_interface.h @@ -1001,6 +1001,7 @@ void UI_butstore_free(uiBlock *block, uiButStore *bs); bool UI_butstore_is_valid(uiButStore *bs); bool UI_butstore_is_registered(uiBlock *block, uiBut *but); void UI_butstore_register(uiButStore *bs_handle, uiBut **but_p); +bool UI_butstore_register_update(uiBlock *block, uiBut *but_dst, const uiBut *but_src); void UI_butstore_unregister(uiButStore *bs_handle, uiBut **but_p); diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index efafd5f06e6..4cbb02c4dd5 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -728,6 +728,10 @@ static bool ui_but_update_from_old_block(const bContext *C, uiBlock *block, uiBu ui_but_update_linklines(block, oldbut, but); + if (!BLI_listbase_is_empty(&block->butstore)) { + UI_butstore_register_update(block, oldbut, but); + } + /* move/copy string from the new button to the old */ /* needed for alt+mouse wheel over enums */ if (but->str != but->strdata) { diff --git a/source/blender/editors/interface/interface_utils.c b/source/blender/editors/interface/interface_utils.c index 854f1763370..6cd5f5a7e05 100644 --- a/source/blender/editors/interface/interface_utils.c +++ b/source/blender/editors/interface/interface_utils.c @@ -390,6 +390,27 @@ void UI_butstore_unregister(uiButStore *bs_handle, uiBut **but_p) } /** + * Update the pointer for a registered button. + */ +bool UI_butstore_register_update(uiBlock *block, uiBut *but_dst, const uiBut *but_src) +{ + uiButStore *bs_handle; + bool found = false; + + for (bs_handle = block->butstore.first; bs_handle; bs_handle = bs_handle->next) { + uiButStoreElem *bs_elem; + for (bs_elem = bs_handle->items.first; bs_elem; bs_elem = bs_elem->next) { + if (*bs_elem->but_p == but_src) { + *bs_elem->but_p = but_dst; + found = true; + } + } + } + + return found; +} + +/** * NULL all pointers, don't free since the owner needs to be able to inspect. */ void UI_butstore_clear(uiBlock *block) diff --git a/source/blender/editors/io/io_collada.c b/source/blender/editors/io/io_collada.c index b45f3ccde2a..3ea2fba1f3b 100644 --- a/source/blender/editors/io/io_collada.c +++ b/source/blender/editors/io/io_collada.c @@ -366,6 +366,7 @@ static int wm_collada_import_exec(bContext *C, wmOperator *op) char filename[FILE_MAX]; int import_units; int find_chains; + int fix_orientation; int min_chain_length; if (!RNA_struct_property_is_set(op->ptr, "filepath")) { @@ -376,13 +377,17 @@ static int wm_collada_import_exec(bContext *C, wmOperator *op) /* Options panel */ import_units = RNA_boolean_get(op->ptr, "import_units"); find_chains = RNA_boolean_get(op->ptr, "find_chains"); + fix_orientation = RNA_boolean_get(op->ptr, "fix_orientation"); min_chain_length = RNA_int_get(op->ptr, "min_chain_length"); RNA_string_get(op->ptr, "filepath", filename); - if (collada_import(C, filename, - import_units, - find_chains, - min_chain_length)) { + if (collada_import( + C, filename, + import_units, + find_chains, + fix_orientation, + min_chain_length)) + { return OPERATOR_FINISHED; } else { @@ -408,11 +413,13 @@ static void uiCollada_importSettings(uiLayout *layout, PointerRNA *imfptr) uiItemL(row, IFACE_("Armature Options:"), ICON_MESH_DATA); row = uiLayoutRow(box, false); + uiItemR(row, imfptr, "fix_orientation", 0, NULL, ICON_NONE); + + row = uiLayoutRow(box, false); uiItemR(row, imfptr, "find_chains", 0, NULL, ICON_NONE); row = uiLayoutRow(box, false); uiItemR(row, imfptr, "min_chain_length", 0, NULL, ICON_NONE); - } static void wm_collada_import_draw(bContext *UNUSED(C), wmOperator *op) @@ -446,6 +453,10 @@ void WM_OT_collada_import(wmOperatorType *ot) "otherwise use the settings from the Imported scene"); RNA_def_boolean(ot->srna, + "fix_orientation", 0, "Fix Leaf Bones", + "Fix Orientation of Leaf Bones (Collada does only support Joints)"); + + RNA_def_boolean(ot->srna, "find_chains", 0, "Find Bone Chains", "Find best matching Bone Chains and ensure bones in chain are connected"); diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index d2698e08d9a..6df5c146b49 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -103,6 +103,8 @@ #if defined(__APPLE__) && defined _OPENMP #include <sys/sysctl.h> +#include "BLI_threads.h" + /* Query how many cores not counting HT aka physical cores we've got. */ static int system_physical_thread_count(void) { diff --git a/source/blender/editors/space_file/filelist.c b/source/blender/editors/space_file/filelist.c index 871abbda48a..ec57d08c21e 100644 --- a/source/blender/editors/space_file/filelist.c +++ b/source/blender/editors/space_file/filelist.c @@ -298,21 +298,21 @@ static bool is_hidden_file(const char *filename, short hide_dot) if (hide_dot) { if (filename[0] == '.' && filename[1] != '.' && filename[1] != 0) { - is_hidden = 1; /* ignore .file */ + is_hidden = true; /* ignore .file */ } else if (((filename[0] == '.') && (filename[1] == 0))) { - is_hidden = 1; /* ignore . */ + is_hidden = true; /* ignore . */ } else { int len = strlen(filename); if ((len > 0) && (filename[len - 1] == '~')) { - is_hidden = 1; /* ignore file~ */ + is_hidden = true; /* ignore file~ */ } } } else { if (((filename[0] == '.') && (filename[1] == 0))) { - is_hidden = 1; /* ignore . */ + is_hidden = true; /* ignore . */ } } return is_hidden; @@ -323,16 +323,16 @@ static bool is_filtered_file(struct direntry *file, const char *UNUSED(dir), uns bool is_filtered = false; if (filter) { if (file->flags & filter) { - is_filtered = 1; + is_filtered = true; } else if (file->type & S_IFDIR) { if (filter & FOLDERFILE) { - is_filtered = 1; + is_filtered = true; } } } else { - is_filtered = 1; + is_filtered = true; } return is_filtered && !is_hidden_file(file->relname, hide_dot); } diff --git a/source/blender/editors/space_view3d/drawmesh.c b/source/blender/editors/space_view3d/drawmesh.c index d5275adf769..755c633531d 100644 --- a/source/blender/editors/space_view3d/drawmesh.c +++ b/source/blender/editors/space_view3d/drawmesh.c @@ -96,7 +96,7 @@ typedef struct drawTFace_userData { BLI_INLINE int edge_vis_index(const int index) { return index * 2; } BLI_INLINE int edge_sel_index(const int index) { return index * 2 + 1; } -static BLI_bitmap *get_tface_mesh_marked_edge_info(Mesh *me) +static BLI_bitmap *get_tface_mesh_marked_edge_info(Mesh *me, bool draw_select_edges) { BLI_bitmap *bitmap_edge_flags = BLI_BITMAP_NEW(me->totedge * 2, __func__); MPoly *mp; @@ -112,8 +112,17 @@ static BLI_bitmap *get_tface_mesh_marked_edge_info(Mesh *me) ml = me->mloop + mp->loopstart; for (j = 0; j < mp->totloop; j++, ml++) { - BLI_BITMAP_ENABLE(bitmap_edge_flags, edge_vis_index(ml->e)); - if (select_set) BLI_BITMAP_ENABLE(bitmap_edge_flags, edge_sel_index(ml->e)); + if ((draw_select_edges == false) && + (select_set && BLI_BITMAP_TEST(bitmap_edge_flags, edge_sel_index(ml->e)))) + { + BLI_BITMAP_DISABLE(bitmap_edge_flags, edge_vis_index(ml->e)); + } + else { + BLI_BITMAP_ENABLE(bitmap_edge_flags, edge_vis_index(ml->e)); + if (select_set) { + BLI_BITMAP_ENABLE(bitmap_edge_flags, edge_sel_index(ml->e)); + } + } } } } @@ -128,21 +137,26 @@ static DMDrawOption draw_mesh_face_select__setHiddenOpts(void *userData, int ind Mesh *me = data->me; if (me->drawflag & ME_DRAWEDGES) { - if ((me->drawflag & ME_HIDDENEDGES) || (BLI_BITMAP_TEST(data->edge_flags, edge_vis_index(index)))) + if ((BLI_BITMAP_TEST(data->edge_flags, edge_vis_index(index)))) return DM_DRAW_OPTION_NORMAL; else return DM_DRAW_OPTION_SKIP; } - else if (BLI_BITMAP_TEST(data->edge_flags, edge_sel_index(index))) + else if (BLI_BITMAP_TEST(data->edge_flags, edge_sel_index(index)) && + BLI_BITMAP_TEST(data->edge_flags, edge_vis_index(index))) + { return DM_DRAW_OPTION_NORMAL; - else + } + else { return DM_DRAW_OPTION_SKIP; + } } static DMDrawOption draw_mesh_face_select__setSelectOpts(void *userData, int index) { drawMeshFaceSelect_userData *data = userData; - return (BLI_BITMAP_TEST(data->edge_flags, edge_sel_index(index))) ? DM_DRAW_OPTION_NORMAL : DM_DRAW_OPTION_SKIP; + return (BLI_BITMAP_TEST(data->edge_flags, edge_sel_index(index)) && + BLI_BITMAP_TEST(data->edge_flags, edge_vis_index(index))) ? DM_DRAW_OPTION_NORMAL : DM_DRAW_OPTION_SKIP; } /* draws unselected */ @@ -157,12 +171,12 @@ static DMDrawOption draw_mesh_face_select__drawFaceOptsInv(void *userData, int i return DM_DRAW_OPTION_SKIP; } -void draw_mesh_face_select(RegionView3D *rv3d, Mesh *me, DerivedMesh *dm) +void draw_mesh_face_select(RegionView3D *rv3d, Mesh *me, DerivedMesh *dm, bool draw_select_edges) { drawMeshFaceSelect_userData data; data.me = me; - data.edge_flags = get_tface_mesh_marked_edge_info(me); + data.edge_flags = get_tface_mesh_marked_edge_info(me, draw_select_edges); glEnable(GL_DEPTH_TEST); glDisable(GL_LIGHTING); @@ -939,8 +953,10 @@ static void draw_mesh_textured_old(Scene *scene, View3D *v3d, RegionView3D *rv3d draw_textured_end(); /* draw edges and selected faces over textured mesh */ - if (!(ob == scene->obedit) && (draw_flags & DRAW_FACE_SELECT)) - draw_mesh_face_select(rv3d, me, dm); + if (!(ob == scene->obedit) && (draw_flags & DRAW_FACE_SELECT)) { + bool draw_select_edges = (ob->mode & OB_MODE_TEXTURE_PAINT) == 0; + draw_mesh_face_select(rv3d, me, dm, draw_select_edges); + } /* reset from negative scale correction */ glFrontFace(GL_CCW); @@ -1136,8 +1152,10 @@ void draw_mesh_textured(Scene *scene, View3D *v3d, RegionView3D *rv3d, glMatrixMode(GL_MODELVIEW); /* faceselect mode drawing over textured mesh */ - if (!(ob == scene->obedit) && (draw_flags & DRAW_FACE_SELECT)) - draw_mesh_face_select(rv3d, ob->data, dm); + if (!(ob == scene->obedit) && (draw_flags & DRAW_FACE_SELECT)) { + bool draw_select_edges = (ob->mode & OB_MODE_TEXTURE_PAINT) == 0; + draw_mesh_face_select(rv3d, ob->data, dm, draw_select_edges); + } } /* Vertex Paint and Weight Paint */ @@ -1261,7 +1279,8 @@ void draw_mesh_paint(View3D *v3d, RegionView3D *rv3d, /* draw face selection on top */ if (draw_flags & DRAW_FACE_SELECT) { - draw_mesh_face_select(rv3d, me, dm); + bool draw_select_edges = (ob->mode & OB_MODE_TEXTURE_PAINT) == 0; + draw_mesh_face_select(rv3d, me, dm, draw_select_edges); } else if ((use_light == false) || (ob->dtx & OB_DRAWWIRE)) { const bool use_depth = (v3d->flag & V3D_ZBUF_SELECT) || !(ob->mode & OB_MODE_WEIGHT_PAINT); diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index 85cb48537cf..79d660f1dbe 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -3771,7 +3771,7 @@ static void draw_mesh_fancy(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D glFrontFace(GL_CCW); if (draw_flags & DRAW_FACE_SELECT) - draw_mesh_face_select(rv3d, me, dm); + draw_mesh_face_select(rv3d, me, dm, false); } else { draw_mesh_textured(scene, v3d, rv3d, ob, dm, draw_flags); diff --git a/source/blender/editors/space_view3d/view3d_intern.h b/source/blender/editors/space_view3d/view3d_intern.h index 84ac4f7d02d..d3a9f5ca967 100644 --- a/source/blender/editors/space_view3d/view3d_intern.h +++ b/source/blender/editors/space_view3d/view3d_intern.h @@ -163,7 +163,9 @@ bool draw_armature(Scene *scene, View3D *v3d, ARegion *ar, Base *base, /* drawmesh.c */ void draw_mesh_textured(Scene *scene, View3D *v3d, RegionView3D *rv3d, struct Object *ob, struct DerivedMesh *dm, const int draw_flags); -void draw_mesh_face_select(struct RegionView3D *rv3d, struct Mesh *me, struct DerivedMesh *dm); +void draw_mesh_face_select( + struct RegionView3D *rv3d, struct Mesh *me, struct DerivedMesh *dm, + bool draw_select_edges); void draw_mesh_paint_weight_faces(struct DerivedMesh *dm, const bool do_light, void *facemask_cb, void *user_data); void draw_mesh_paint_vcolor_faces(struct DerivedMesh *dm, const bool use_light, diff --git a/source/blender/gpu/intern/gpu_buffers.c b/source/blender/gpu/intern/gpu_buffers.c index 9a67e6d526f..8ac629d0ded 100644 --- a/source/blender/gpu/intern/gpu_buffers.c +++ b/source/blender/gpu/intern/gpu_buffers.c @@ -614,7 +614,7 @@ static GPUBuffer *gpu_buffer_setup(DerivedMesh *dm, GPUDrawObject *object, int *mat_orig_to_new; int *cur_index_per_mat; int i; - bool use_VBOs = (GLEW_ARB_vertex_buffer_object == 1) && !(U.gameflags & USER_DISABLE_VBO); + bool use_VBOs = (GLEW_ARB_vertex_buffer_object) && !(U.gameflags & USER_DISABLE_VBO); GLboolean uploaded; pool = gpu_get_global_buffer_pool(); diff --git a/source/blender/gpu/intern/gpu_extensions.c b/source/blender/gpu/intern/gpu_extensions.c index 036ea0d408e..a65b916bd01 100644 --- a/source/blender/gpu/intern/gpu_extensions.c +++ b/source/blender/gpu/intern/gpu_extensions.c @@ -268,7 +268,7 @@ int GPU_print_error(const char *str) { GLenum errCode; - if (G.debug & G_DEBUG) { + if ((G.debug & G_DEBUG)) { if ((errCode = glGetError()) != GL_NO_ERROR) { fprintf(stderr, "%s opengl error: %s\n", str, gluErrorString(errCode)); return 1; @@ -748,8 +748,8 @@ void GPU_texture_bind(GPUTexture *tex, int number) return; } - if (tex->fb) { - if (tex->fb->object == GG.currentfb) { + if ((G.debug & G_DEBUG)) { + if (tex->fb && tex->fb->object == GG.currentfb) { fprintf(stderr, "Feedback loop warning!: Attempting to bind texture attached to current framebuffer!\n"); } } @@ -884,8 +884,10 @@ int GPU_framebuffer_texture_attach(GPUFrameBuffer *fb, GPUTexture *tex, int slot return 0; } - if (tex->number != -1) { - fprintf(stderr, "Feedback loop warning!: Attempting to attach texture to framebuffer while still bound to texture unit for drawing!"); + if ((G.debug & G_DEBUG)) { + if (tex->number != -1) { + fprintf(stderr, "Feedback loop warning!: Attempting to attach texture to framebuffer while still bound to texture unit for drawing!"); + } } if (tex->depth) @@ -1252,8 +1254,8 @@ static void shader_print_errors(const char *task, char *log, const char **code, for (i = 0; i < totcode; i++) { const char *c, *pos, *end = code[i] + strlen(code[i]); int line = 1; - - if (G.debug & G_DEBUG) { + + if ((G.debug & G_DEBUG)) { fprintf(stderr, "===== shader string %d ====\n", i + 1); c = code[i]; diff --git a/source/blender/makesdna/DNA_mesh_types.h b/source/blender/makesdna/DNA_mesh_types.h index 688e17ef56a..8067fa5db2d 100644 --- a/source/blender/makesdna/DNA_mesh_types.h +++ b/source/blender/makesdna/DNA_mesh_types.h @@ -201,7 +201,7 @@ enum { ME_DRAW_VNORMALS = 1 << 3, ME_DRAWEIGHT = 1 << 4, - ME_HIDDENEDGES = 1 << 5, + /* ME_HIDDENEDGES = 1 << 5, */ /* DEPRECATED */ ME_DRAWCREASES = 1 << 6, ME_DRAWSEAMS = 1 << 7, diff --git a/source/blender/makesdna/DNA_space_types.h b/source/blender/makesdna/DNA_space_types.h index dd661d00d54..6489853bbaa 100644 --- a/source/blender/makesdna/DNA_space_types.h +++ b/source/blender/makesdna/DNA_space_types.h @@ -575,8 +575,9 @@ typedef enum eSpaceSeq_OverlayType { /* Config and Input for File Selector */ typedef struct FileSelectParams { char title[96]; /* title, also used for the text of the execute button */ - char dir[1056]; /* directory, FILE_MAX_LIBEXTRA, 1024 + 32, this is for extreme case when 1023 length path + char dir[1090]; /* directory, FILE_MAX_LIBEXTRA, 1024 + 66, this is for extreme case when 1023 length path * needs to be linked in, where foo.blend/Armature need adding */ + char pad_c1[2]; char file[256]; /* file */ char renamefile[256]; char renameedit[256]; /* annoying but the first is only used for initialization */ diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index 61f16285251..e65cf34bdad 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -737,7 +737,7 @@ static int rna_RenderSettings_threads_mode_get(PointerRNA *ptr) return (rd->mode & R_FIXED_THREADS); } -static int rna_RenderSettings_is_movie_fomat_get(PointerRNA *ptr) +static int rna_RenderSettings_is_movie_format_get(PointerRNA *ptr) { RenderData *rd = (RenderData *)ptr->data; return BKE_imtype_is_movie(rd->im_format.imtype); @@ -4801,7 +4801,7 @@ static void rna_def_scene_render_data(BlenderRNA *brna) RNA_def_property_clear_flag(prop, PROP_EDITABLE); prop = RNA_def_property(srna, "is_movie_format", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_funcs(prop, "rna_RenderSettings_is_movie_fomat_get", NULL); + RNA_def_property_boolean_funcs(prop, "rna_RenderSettings_is_movie_format_get", NULL); RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_ui_text(prop, "Movie Format", "When true the format is a movie"); diff --git a/source/blender/makesrna/intern/rna_sculpt_paint.c b/source/blender/makesrna/intern/rna_sculpt_paint.c index 09e42e48e93..73b7e310d1d 100644 --- a/source/blender/makesrna/intern/rna_sculpt_paint.c +++ b/source/blender/makesrna/intern/rna_sculpt_paint.c @@ -289,7 +289,8 @@ static char *rna_ParticleBrush_path(PointerRNA *UNUSED(ptr)) static void rna_Paint_brush_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) { - Brush *br = (Brush *)ptr->data; + Paint *paint = ptr->data; + Brush *br = paint->brush; BKE_paint_invalidate_overlay_all(); WM_main_add_notifier(NC_BRUSH | NA_EDITED, br); } diff --git a/source/blender/modifiers/intern/MOD_boolean_util.c b/source/blender/modifiers/intern/MOD_boolean_util.c index 6e62a21ec4c..061b1198f7e 100644 --- a/source/blender/modifiers/intern/MOD_boolean_util.c +++ b/source/blender/modifiers/intern/MOD_boolean_util.c @@ -365,14 +365,6 @@ BLI_INLINE MPoly *which_mpoly(ExportMeshData *export_data, int which_mesh) return mpoly; } -static void allocate_custom_layers(CustomData *data, int type, int num_elements, int num_layers) -{ - int i; - for (i = 0; i < num_layers; i++) { - CustomData_add_layer(data, type, CD_DEFAULT, NULL, num_elements); - } -} - /* Create new external mesh */ static void exporter_InitGeomArrays(ExportMeshData *export_data, int num_verts, int num_edges, @@ -392,24 +384,15 @@ static void exporter_InitGeomArrays(ExportMeshData *export_data, export_data->mloop = dm->getLoopArray(dm); export_data->mpoly = dm->getPolyArray(dm); - /* Allocate layers for UV layers and vertex colors. - * Without this interpolation of those data will not happen. - */ - allocate_custom_layers(&dm->loopData, CD_MLOOPCOL, num_loops, - CustomData_number_of_layers(&dm_left->loopData, CD_MLOOPCOL)); - allocate_custom_layers(&dm->loopData, CD_MLOOPUV, num_loops, - CustomData_number_of_layers(&dm_left->loopData, CD_MLOOPUV)); - - allocate_custom_layers(&dm->loopData, CD_MLOOPCOL, num_loops, - CustomData_number_of_layers(&dm_right->loopData, CD_MLOOPCOL)); - allocate_custom_layers(&dm->loopData, CD_MLOOPUV, num_loops, - CustomData_number_of_layers(&dm_right->loopData, CD_MLOOPUV)); - /* Merge custom data layers from operands. * * Will only create custom data layers for all the layers which appears in * the operand. Data for those layers will not be allocated or initialized. */ + + CustomData_merge(&dm_left->loopData, &dm->loopData, merge_mask, CD_DEFAULT, num_loops); + CustomData_merge(&dm_right->loopData, &dm->loopData, merge_mask, CD_DEFAULT, num_loops); + CustomData_merge(&dm_left->polyData, &dm->polyData, merge_mask, CD_DEFAULT, num_polys); CustomData_merge(&dm_right->polyData, &dm->polyData, merge_mask, CD_DEFAULT, num_polys); diff --git a/source/blender/python/intern/bpy_app_handlers.c b/source/blender/python/intern/bpy_app_handlers.c index 44da322efc0..cf20f6fa742 100644 --- a/source/blender/python/intern/bpy_app_handlers.c +++ b/source/blender/python/intern/bpy_app_handlers.c @@ -44,23 +44,24 @@ void bpy_app_generic_callback(struct Main *main, struct ID *id, void *arg); static PyTypeObject BlenderAppCbType; static PyStructSequence_Field app_cb_info_fields[] = { - {(char *)"frame_change_pre", (char *)"Callback list - on frame change for playback and rendering (before)"}, - {(char *)"frame_change_post", (char *)"Callback list - on frame change for playback and rendering (after)"}, - {(char *)"render_pre", (char *)"Callback list - on render (before)"}, - {(char *)"render_post", (char *)"Callback list - on render (after)"}, - {(char *)"render_stats", (char *)"Callback list - on printing render statistics"}, - {(char *)"render_init", (char *)"Callback list - on initialization of a render job"}, - {(char *)"render_complete", (char *)"Callback list - on completion of render job"}, - {(char *)"render_cancel", (char *)"Callback list - on canceling a render job"}, - {(char *)"load_pre", (char *)"Callback list - on loading a new blend file (before)"}, - {(char *)"load_post", (char *)"Callback list - on loading a new blend file (after)"}, - {(char *)"save_pre", (char *)"Callback list - on saving a blend file (before)"}, - {(char *)"save_post", (char *)"Callback list - on saving a blend file (after)"}, - {(char *)"scene_update_pre", (char *)"Callback list - on updating the scenes data (before)"}, - {(char *)"scene_update_post", (char *)"Callback list - on updating the scenes data (after)"}, - {(char *)"game_pre", (char *)"Callback list - on starting the game engine"}, - {(char *)"game_post", (char *)"Callback list - on ending the game engine"}, - {(char *)"version_update", (char *)"Callback list - on ending the versioning code"}, + {(char *)"frame_change_pre", (char *)"on frame change for playback and rendering (before)"}, + {(char *)"frame_change_post", (char *)"on frame change for playback and rendering (after)"}, + {(char *)"render_pre", (char *)"on render (before)"}, + {(char *)"render_post", (char *)"on render (after)"}, + {(char *)"render_write", (char *)"on writing a render frame (directly after the frame is written)"}, + {(char *)"render_stats", (char *)"on printing render statistics"}, + {(char *)"render_init", (char *)"on initialization of a render job"}, + {(char *)"render_complete", (char *)"on completion of render job"}, + {(char *)"render_cancel", (char *)"on canceling a render job"}, + {(char *)"load_pre", (char *)"on loading a new blend file (before)"}, + {(char *)"load_post", (char *)"on loading a new blend file (after)"}, + {(char *)"save_pre", (char *)"on saving a blend file (before)"}, + {(char *)"save_post", (char *)"on saving a blend file (after)"}, + {(char *)"scene_update_pre", (char *)"on updating the scenes data (before)"}, + {(char *)"scene_update_post", (char *)"on updating the scenes data (after)"}, + {(char *)"game_pre", (char *)"on starting the game engine"}, + {(char *)"game_post", (char *)"on ending the game engine"}, + {(char *)"version_update", (char *)"on ending the versioning code"}, /* sets the permanent tag */ # define APP_CB_OTHER_FIELDS 1 @@ -71,7 +72,7 @@ static PyStructSequence_Field app_cb_info_fields[] = { static PyStructSequence_Desc app_cb_info_desc = { (char *)"bpy.app.handlers", /* name */ - (char *)"This module contains callbacks", /* doc */ + (char *)"This module contains callback lists", /* doc */ app_cb_info_fields, /* fields */ ARRAY_SIZE(app_cb_info_fields) - 1 }; diff --git a/source/blender/render/intern/source/pipeline.c b/source/blender/render/intern/source/pipeline.c index f0c1b5a354c..1f17b82da3b 100644 --- a/source/blender/render/intern/source/pipeline.c +++ b/source/blender/render/intern/source/pipeline.c @@ -2834,6 +2834,9 @@ void RE_BlenderFrame(Render *re, Main *bmain, Scene *scene, SceneRenderLayer *sr } BLI_callback_exec(re->main, (ID *)scene, BLI_CB_EVT_RENDER_POST); /* keep after file save */ + if (write_still) { + BLI_callback_exec(re->main, (ID *)scene, BLI_CB_EVT_RENDER_WRITE); + } } BLI_callback_exec(re->main, (ID *)scene, G.is_break ? BLI_CB_EVT_RENDER_CANCEL : BLI_CB_EVT_RENDER_COMPLETE); @@ -3031,6 +3034,7 @@ void RE_BlenderAnim(Render *re, Main *bmain, Scene *scene, Object *camera_overri if (G.is_break == false) { BLI_callback_exec(re->main, (ID *)scene, BLI_CB_EVT_RENDER_POST); /* keep after file save */ + BLI_callback_exec(re->main, (ID *)scene, BLI_CB_EVT_RENDER_WRITE); } } else { @@ -3114,6 +3118,7 @@ void RE_BlenderAnim(Render *re, Main *bmain, Scene *scene, Object *camera_overri if (G.is_break == false) { BLI_callback_exec(re->main, (ID *)scene, BLI_CB_EVT_RENDER_POST); /* keep after file save */ + BLI_callback_exec(re->main, (ID *)scene, BLI_CB_EVT_RENDER_WRITE); } } } diff --git a/source/gameengine/Converter/BL_ActionActuator.cpp b/source/gameengine/Converter/BL_ActionActuator.cpp index 3dd013dfd63..f1a7287c0fe 100644 --- a/source/gameengine/Converter/BL_ActionActuator.cpp +++ b/source/gameengine/Converter/BL_ActionActuator.cpp @@ -320,8 +320,9 @@ bool BL_ActionActuator::Update(double curtime, bool frame) case ACT_ACTION_FLIPPER: // Convert into a play action and play back to the beginning + float temp = end; end = start; - start = obj->GetActionFrame(m_layer); + start = curr_action ? obj->GetActionFrame(m_layer) : temp; obj->PlayAction(m_action->id.name+2, start, end, m_layer, m_priority, 0, BL_Action::ACT_MODE_PLAY, m_layer_weight, m_ipo_flags, 1.f, blendmode); m_flag |= ACT_FLAG_PLAY_END; diff --git a/source/gameengine/Converter/BL_ModifierDeformer.cpp b/source/gameengine/Converter/BL_ModifierDeformer.cpp index 71dc1bdec87..3bc07113ff6 100644 --- a/source/gameengine/Converter/BL_ModifierDeformer.cpp +++ b/source/gameengine/Converter/BL_ModifierDeformer.cpp @@ -186,6 +186,7 @@ bool BL_ModifierDeformer::Update(void) m_dm->release(m_dm); // HACK! use deformedOnly as a user counter m_dm->deformedOnly = 1; + DM_update_materials(m_dm, blendobj); /* update the graphic controller */ PHY_IGraphicController *ctrl = m_gameobj->GetGraphicController(); if (ctrl) { diff --git a/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp b/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp index e17d4402556..38e7df6c573 100644 --- a/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp +++ b/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp @@ -504,9 +504,9 @@ bool CcdPhysicsEnvironment::RemoveCcdPhysicsController(CcdPhysicsController* ctr btRigidBody* body = ctrl->GetRigidBody(); if (body) { - for (int i=body->getNumConstraintRefs()-1;i>=0;i--) + for (int i = m_dynamicsWorld->getNumConstraints()-1;i>=0;i--) { - btTypedConstraint* con = body->getConstraintRef(i); + btTypedConstraint *con = m_dynamicsWorld->getConstraint(i); m_dynamicsWorld->removeConstraint(con); body->removeConstraintRef(con); //delete con; //might be kept by python KX_ConstraintWrapper |