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:
authorDalai Felinto <dfelinto@gmail.com>2018-03-29 16:36:01 +0300
committerDalai Felinto <dfelinto@gmail.com>2018-03-29 16:36:01 +0300
commit11130970c6a3ff14cb4dd0caece2137891b43e87 (patch)
treeb21d79b38e4ee28ed9762973e8ea1cc604dcfd1b
parentf6ad53804099802ab3f5eafa830f95f8545eb888 (diff)
parentca5f3dd2200725712a665705fc25e20a208d6295 (diff)
Merge commit 'origin/master^' into blender2.8
-rw-r--r--build_files/build_environment/CMakeLists.txt1
-rw-r--r--build_files/build_environment/cmake/harvest.cmake2
-rw-r--r--intern/cycles/kernel/closure/bsdf.h28
-rw-r--r--intern/cycles/kernel/kernel_passes.h2
-rw-r--r--intern/cycles/kernel/kernel_path_state.h2
-rw-r--r--intern/cycles/util/util_sseb.h2
-rw-r--r--intern/cycles/util/util_thread.cpp14
-rw-r--r--intern/cycles/util/util_thread.h35
-rw-r--r--intern/ghost/intern/GHOST_SystemCocoa.h5
-rw-r--r--intern/ghost/intern/GHOST_SystemCocoa.mm6
-rw-r--r--intern/ghost/intern/GHOST_SystemSDL.cpp4
-rw-r--r--intern/ghost/intern/GHOST_SystemWin32.h8
-rw-r--r--intern/openvdb/CMakeLists.txt1
-rw-r--r--intern/openvdb/intern/openvdb_writer.cc2
-rw-r--r--source/blender/blenlib/BLI_array_utils.h12
-rw-r--r--source/blender/blenlib/intern/array_utils.c17
-rw-r--r--source/blender/collada/AnimationImporter.cpp19
-rw-r--r--source/blender/collada/AnimationImporter.h2
-rw-r--r--source/blender/makesrna/intern/rna_scene_api.c2
-rw-r--r--source/blender/windowmanager/intern/wm_window.c2
20 files changed, 136 insertions, 30 deletions
diff --git a/build_files/build_environment/CMakeLists.txt b/build_files/build_environment/CMakeLists.txt
index 885133f970c..f177560c5f6 100644
--- a/build_files/build_environment/CMakeLists.txt
+++ b/build_files/build_environment/CMakeLists.txt
@@ -58,7 +58,6 @@ include(cmake/openexr.cmake)
include(cmake/freetype.cmake)
include(cmake/freeglut.cmake)
include(cmake/glew.cmake)
-include(cmake/hdf5.cmake)
include(cmake/alembic.cmake)
include(cmake/glfw.cmake)
include(cmake/clew.cmake)
diff --git a/build_files/build_environment/cmake/harvest.cmake b/build_files/build_environment/cmake/harvest.cmake
index f23939a7ba6..9ebd5206d27 100644
--- a/build_files/build_environment/cmake/harvest.cmake
+++ b/build_files/build_environment/cmake/harvest.cmake
@@ -102,8 +102,6 @@ if(BUILD_MODE STREQUAL Release)
${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/python/ ${HARVEST_TARGET}/python/ &&
# alembic
${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/alembic ${HARVEST_TARGET}/alembic &&
- # hdf5
- ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/hdf5 ${HARVEST_TARGET}/hdf5 &&
# BlendThumb
${CMAKE_COMMAND} -E copy ${LIBDIR}/BlendThumb64/bin/blendthumb.dll ${HARVEST_TARGET}/ThumbHandler/lib/BlendThumb64.dll &&
${CMAKE_COMMAND} -E copy ${LIBDIR}/BlendThumb32/bin/blendthumb.dll ${HARVEST_TARGET}/ThumbHandler/lib/BlendThumb.dll &&
diff --git a/intern/cycles/kernel/closure/bsdf.h b/intern/cycles/kernel/closure/bsdf.h
index e3beff6675a..d8ff69ca241 100644
--- a/intern/cycles/kernel/closure/bsdf.h
+++ b/intern/cycles/kernel/closure/bsdf.h
@@ -36,20 +36,42 @@ CCL_NAMESPACE_BEGIN
/* Returns the square of the roughness of the closure if it has roughness,
* 0 for singular closures and 1 otherwise. */
-ccl_device_inline float bsdf_get_roughness_squared(const ShaderClosure *sc)
+ccl_device_inline float bsdf_get_specular_roughness_squared(const ShaderClosure *sc)
{
if(CLOSURE_IS_BSDF_SINGULAR(sc->type)) {
return 0.0f;
}
if(CLOSURE_IS_BSDF_MICROFACET(sc->type)) {
- MicrofacetBsdf *bsdf = (MicrofacetBsdf*) sc;
+ MicrofacetBsdf *bsdf = (MicrofacetBsdf*)sc;
return bsdf->alpha_x*bsdf->alpha_y;
}
return 1.0f;
}
+ccl_device_inline float bsdf_get_roughness_squared(const ShaderClosure *sc)
+{
+ /* This version includes diffuse, mainly for baking Principled BSDF
+ * where specular and metallic zero otherwise does not bake the
+ * specified roughness parameter. */
+ if(sc->type == CLOSURE_BSDF_OREN_NAYAR_ID) {
+ OrenNayarBsdf *bsdf = (OrenNayarBsdf*)sc;
+ return sqr(sqr(bsdf->roughness));
+ }
+
+ if(sc->type == CLOSURE_BSDF_PRINCIPLED_DIFFUSE_ID) {
+ PrincipledDiffuseBsdf *bsdf = (PrincipledDiffuseBsdf*)sc;
+ return sqr(sqr(bsdf->roughness));
+ }
+
+ if(CLOSURE_IS_BSDF_DIFFUSE(sc->type)) {
+ return 0.0f;
+ }
+
+ return bsdf_get_specular_roughness_squared(sc);
+}
+
ccl_device_forceinline int bsdf_sample(KernelGlobals *kg,
ShaderData *sd,
const ShaderClosure *sc,
@@ -176,7 +198,7 @@ ccl_device_forceinline int bsdf_sample(KernelGlobals *kg,
float threshold_squared = kernel_data.background.transparent_roughness_squared_threshold;
if(threshold_squared >= 0.0f) {
- if(bsdf_get_roughness_squared(sc) <= threshold_squared) {
+ if(bsdf_get_specular_roughness_squared(sc) <= threshold_squared) {
label |= LABEL_TRANSMIT_TRANSPARENT;
}
}
diff --git a/intern/cycles/kernel/kernel_passes.h b/intern/cycles/kernel/kernel_passes.h
index 1933d695f92..a42a8e9812f 100644
--- a/intern/cycles/kernel/kernel_passes.h
+++ b/intern/cycles/kernel/kernel_passes.h
@@ -140,7 +140,7 @@ ccl_device_inline void kernel_update_denoising_features(KernelGlobals *kg,
/* All closures contribute to the normal feature, but only diffuse-like ones to the albedo. */
normal += sc->N * sc->sample_weight;
sum_weight += sc->sample_weight;
- if(bsdf_get_roughness_squared(sc) > sqr(0.075f)) {
+ if(bsdf_get_specular_roughness_squared(sc) > sqr(0.075f)) {
albedo += sc->weight;
sum_nonspecular_weight += sc->sample_weight;
}
diff --git a/intern/cycles/kernel/kernel_path_state.h b/intern/cycles/kernel/kernel_path_state.h
index 479bb22d780..8a358e51f94 100644
--- a/intern/cycles/kernel/kernel_path_state.h
+++ b/intern/cycles/kernel/kernel_path_state.h
@@ -164,6 +164,7 @@ ccl_device_inline void path_state_next(KernelGlobals *kg, ccl_addr_space PathSta
#endif
}
+#ifdef __VOLUME__
ccl_device_inline bool path_state_volume_next(KernelGlobals *kg, ccl_addr_space PathState *state)
{
/* For volume bounding meshes we pass through without counting transparent
@@ -180,6 +181,7 @@ ccl_device_inline bool path_state_volume_next(KernelGlobals *kg, ccl_addr_space
return true;
}
+#endif
ccl_device_inline uint path_state_ray_visibility(KernelGlobals *kg, ccl_addr_space PathState *state)
{
diff --git a/intern/cycles/util/util_sseb.h b/intern/cycles/util/util_sseb.h
index 93c22aafdcd..977976c3fc0 100644
--- a/intern/cycles/util/util_sseb.h
+++ b/intern/cycles/util/util_sseb.h
@@ -119,7 +119,7 @@ __forceinline const sseb unpacklo( const sseb& a, const sseb& b ) { return _mm_u
__forceinline const sseb unpackhi( const sseb& a, const sseb& b ) { return _mm_unpackhi_ps(a, b); }
template<size_t i0, size_t i1, size_t i2, size_t i3> __forceinline const sseb shuffle( const sseb& a ) {
- return _mm_shuffle_epi32(a, _MM_SHUFFLE(i3, i2, i1, i0));
+ return _mm_castsi128_ps(_mm_shuffle_epi32(a, _MM_SHUFFLE(i3, i2, i1, i0)));
}
template<> __forceinline const sseb shuffle<0, 1, 0, 1>( const sseb& a ) {
diff --git a/intern/cycles/util/util_thread.cpp b/intern/cycles/util/util_thread.cpp
index 3dcb09804b0..c66aa484264 100644
--- a/intern/cycles/util/util_thread.cpp
+++ b/intern/cycles/util/util_thread.cpp
@@ -26,7 +26,11 @@ thread::thread(function<void(void)> run_cb, int group)
joined_(false),
group_(group)
{
+#if (__cplusplus > 199711L) || (defined(_MSC_VER) && _MSC_VER >= 1800)
+ thread_ = std::thread(&thread::run, this);
+#else
pthread_create(&pthread_id_, NULL, run, (void*)this);
+#endif
}
thread::~thread()
@@ -60,7 +64,17 @@ void *thread::run(void *arg)
bool thread::join()
{
joined_ = true;
+#if (__cplusplus > 199711L) || (defined(_MSC_VER) && _MSC_VER >= 1800)
+ try {
+ thread_.join();
+ return true;
+ }
+ catch (const std::system_error&) {
+ return false;
+ }
+#else
return pthread_join(pthread_id_, NULL) == 0;
+#endif
}
CCL_NAMESPACE_END
diff --git a/intern/cycles/util/util_thread.h b/intern/cycles/util/util_thread.h
index 1e91fb8a706..4d8f464359c 100644
--- a/intern/cycles/util/util_thread.h
+++ b/intern/cycles/util/util_thread.h
@@ -24,10 +24,16 @@
# include <functional>
#else
# include <boost/thread.hpp>
+# include <pthread.h>
#endif
-#include <pthread.h>
#include <queue>
+#ifdef _WIN32
+# include "util_windows.h"
+#else
+# include <pthread.h>
+#endif
+
#ifdef __APPLE__
# include <libkern/OSAtomic.h>
#endif
@@ -60,7 +66,11 @@ public:
protected:
function<void(void)> run_cb_;
+#if (__cplusplus > 199711L) || (defined(_MSC_VER) && _MSC_VER >= 1800)
+ std::thread thread_;
+#else
pthread_t pthread_id_;
+#endif
bool joined_;
int group_;
};
@@ -81,7 +91,24 @@ public:
inline void unlock() {
OSSpinLockUnlock(&spin_);
}
-#else /* __APPLE__ */
+#elif defined(_WIN32)
+ inline thread_spin_lock() {
+ const DWORD SPIN_COUNT = 50000;
+ InitializeCriticalSectionAndSpinCount(&cs_, SPIN_COUNT);
+ }
+
+ inline ~thread_spin_lock() {
+ DeleteCriticalSection(&cs_);
+ }
+
+ inline void lock() {
+ EnterCriticalSection(&cs_);
+ }
+
+ inline void unlock() {
+ LeaveCriticalSection(&cs_);
+ }
+#else
inline thread_spin_lock() {
pthread_spin_init(&spin_, 0);
}
@@ -97,10 +124,12 @@ public:
inline void unlock() {
pthread_spin_unlock(&spin_);
}
-#endif /* __APPLE__ */
+#endif
protected:
#ifdef __APPLE__
OSSpinLock spin_;
+#elif defined(_WIN32)
+ CRITICAL_SECTION cs_;
#else
pthread_spinlock_t spin_;
#endif
diff --git a/intern/ghost/intern/GHOST_SystemCocoa.h b/intern/ghost/intern/GHOST_SystemCocoa.h
index 62d9774d81d..8586c91b615 100644
--- a/intern/ghost/intern/GHOST_SystemCocoa.h
+++ b/intern/ghost/intern/GHOST_SystemCocoa.h
@@ -280,6 +280,11 @@ public:
*/
GHOST_TSuccess handleKeyEvent(void *eventPtr);
+ /**
+ * Informs if the system provides native dialogs (eg. confirm quit)
+ */
+ virtual bool supportsNativeDialogs(void);
+
protected:
/**
* Initializes the system.
diff --git a/intern/ghost/intern/GHOST_SystemCocoa.mm b/intern/ghost/intern/GHOST_SystemCocoa.mm
index 011719ea946..43ed30bd415 100644
--- a/intern/ghost/intern/GHOST_SystemCocoa.mm
+++ b/intern/ghost/intern/GHOST_SystemCocoa.mm
@@ -1710,3 +1710,9 @@ void GHOST_SystemCocoa::putClipboard(GHOST_TInt8 *buffer, bool selection) const
[pool drain];
}
+
+bool
+GHOST_SystemCocoa::supportsNativeDialogs(void)
+{
+ return false;
+}
diff --git a/intern/ghost/intern/GHOST_SystemSDL.cpp b/intern/ghost/intern/GHOST_SystemSDL.cpp
index db555910f4b..d7860577338 100644
--- a/intern/ghost/intern/GHOST_SystemSDL.cpp
+++ b/intern/ghost/intern/GHOST_SystemSDL.cpp
@@ -636,9 +636,9 @@ GHOST_SystemSDL::addDirtyWindow(GHOST_WindowSDL *bad_wind)
}
bool
-GHOST_SystemSDL::supportsNativeDialogs(void)
+GHOST_SystemSDL::supportsNativeDialogs(void)
{
- return false
+ return false;
}
GHOST_TSuccess GHOST_SystemSDL::getButtons(GHOST_Buttons& buttons) const
diff --git a/intern/ghost/intern/GHOST_SystemWin32.h b/intern/ghost/intern/GHOST_SystemWin32.h
index 6bf2c5b8d6f..0f15f9180ae 100644
--- a/intern/ghost/intern/GHOST_SystemWin32.h
+++ b/intern/ghost/intern/GHOST_SystemWin32.h
@@ -223,10 +223,10 @@ public:
*/
static GHOST_TSuccess pushDragDropEvent(GHOST_TEventType eventType, GHOST_TDragnDropTypes draggedObjectType, GHOST_WindowWin32 *window, int mouseX, int mouseY, void *data);
-/**
- * Confirms quitting he program when there is just one window left open
- * in the application
- */
+ /**
+ * Confirms quitting he program when there is just one window left open
+ * in the application
+ */
int confirmQuit(GHOST_IWindow *window) const;
protected:
diff --git a/intern/openvdb/CMakeLists.txt b/intern/openvdb/CMakeLists.txt
index e0ecdb52929..4b872f25d45 100644
--- a/intern/openvdb/CMakeLists.txt
+++ b/intern/openvdb/CMakeLists.txt
@@ -38,6 +38,7 @@ set(SRC
if(WITH_OPENVDB)
add_definitions(
-DWITH_OPENVDB
+ -DOPENVDB_3_ABI_COMPATIBLE
)
list(APPEND INC_SYS
diff --git a/intern/openvdb/intern/openvdb_writer.cc b/intern/openvdb/intern/openvdb_writer.cc
index e886c5a76a8..b83691ac7de 100644
--- a/intern/openvdb/intern/openvdb_writer.cc
+++ b/intern/openvdb/intern/openvdb_writer.cc
@@ -45,7 +45,7 @@ void OpenVDBWriter::insert(const openvdb::GridBase::Ptr &grid)
void OpenVDBWriter::insert(const openvdb::GridBase &grid)
{
-#if (OPENVDB_LIBRARY_MAJOR_VERSION_NUMBER == 3)
+#if (OPENVDB_LIBRARY_MAJOR_VERSION_NUMBER >= 3)
m_grids->push_back(grid.copyGrid());
#else
m_grids->push_back(grid.copyGridWithNewTree());
diff --git a/source/blender/blenlib/BLI_array_utils.h b/source/blender/blenlib/BLI_array_utils.h
index a46c87cec40..9a510bcfc3b 100644
--- a/source/blender/blenlib/BLI_array_utils.h
+++ b/source/blender/blenlib/BLI_array_utils.h
@@ -74,10 +74,18 @@ bool _bli_array_iter_span(
bool use_wrap, bool use_delimit_bounds,
bool (*test_fn)(const void *arr_item, void *user_data), void *user_data,
unsigned int span_step[2], unsigned int *r_span_len);
-#define BLI_array_iter_span(arr, arr_len, use_wrap, use_delimit_bounds, test_fn, user_data, \
- span_step, r_span_len) \
+#define BLI_array_iter_span( \
+ arr, arr_len, use_wrap, use_delimit_bounds, test_fn, user_data, \
+ span_step, r_span_len) \
_bli_array_iter_span( \
arr, arr_len, sizeof(*(arr)), use_wrap, use_delimit_bounds, test_fn, user_data, \
span_step, r_span_len)
+bool _bli_array_is_zeroed(
+ const void *arr,
+ unsigned int arr_len, size_t arr_stride);
+#define BLI_array_is_zeroed(arr, arr_len) \
+ _bli_array_is_zeroed( \
+ arr, arr_len, sizeof(*(arr)))
+
#endif /* __BLI_ARRAY_UTILS_H__ */
diff --git a/source/blender/blenlib/intern/array_utils.c b/source/blender/blenlib/intern/array_utils.c
index 32f0111babd..7b2d35a763c 100644
--- a/source/blender/blenlib/intern/array_utils.c
+++ b/source/blender/blenlib/intern/array_utils.c
@@ -308,3 +308,20 @@ bool _bli_array_iter_span(
return false;
}
+
+/**
+ * Simple utility to check memory is zeroed.
+ */
+bool _bli_array_is_zeroed(
+ const void *arr_v,
+ unsigned int arr_len, size_t arr_stride)
+{
+ const char *arr_step = (const char *)arr_v;
+ size_t i = arr_stride * arr_len;
+ while (i--) {
+ if (*(arr_step++)) {
+ return false;
+ }
+ }
+ return true;
+}
diff --git a/source/blender/collada/AnimationImporter.cpp b/source/blender/collada/AnimationImporter.cpp
index ee3fddbf5b7..31dd7d5de46 100644
--- a/source/blender/collada/AnimationImporter.cpp
+++ b/source/blender/collada/AnimationImporter.cpp
@@ -109,7 +109,7 @@ void AnimationImporter::animation_to_fcurves(COLLADAFW::AnimationCurve *curve)
fcu->flag = (FCURVE_VISIBLE | FCURVE_AUTO_HANDLES | FCURVE_SELECTED);
// fcu->rna_path = BLI_strdupn(path, strlen(path));
fcu->array_index = 0;
- fcu->totvert = curve->getKeyCount();
+ //fcu->totvert = curve->getKeyCount();
// create beztriple for each key
for (unsigned int j = 0; j < curve->getKeyCount(); j++) {
@@ -669,6 +669,13 @@ void AnimationImporter:: Assign_float_animations(const COLLADAFW::UniqueId& list
}
+float AnimationImporter::convert_to_focal_length(float in_xfov, int fov_type, float aspect, float sensorx)
+{
+ // NOTE: Needs more testing (As we curretnly have no official test data for this)
+ float xfov = (fov_type == CAMERA_YFOV) ? (2.0f * atanf(aspect * tanf(DEG2RADF(in_xfov) * 0.5f))) : DEG2RADF(in_xfov);
+ return fov_to_focallength(xfov, sensorx);
+}
+
/*
* Lens animations must be stored in COLLADA by using FOV,
* while blender internally uses focal length.
@@ -698,13 +705,9 @@ void AnimationImporter::Assign_lens_animations(const COLLADAFW::UniqueId& listid
FCurve *fcu = *iter;
for (unsigned int i = 0; i < fcu->totvert; i++) {
-
- double input_fov = fcu->bezt[i].vec[1][1];
-
- // NOTE: Needs more testing (As we curretnly have no official test data for this)
- double xfov = (fov_type == CAMERA_YFOV) ? (2.0f * atanf(aspect * tanf(DEG2RADF(input_fov) * 0.5f))) : DEG2RADF(input_fov);
-
- fcu->bezt[i].vec[1][1] = fov_to_focallength(xfov, cam->sensor_x);
+ fcu->bezt[i].vec[0][1] = convert_to_focal_length(fcu->bezt[i].vec[0][1], fov_type, aspect, cam->sensor_x);
+ fcu->bezt[i].vec[1][1] = convert_to_focal_length(fcu->bezt[i].vec[1][1], fov_type, aspect, cam->sensor_x);
+ fcu->bezt[i].vec[2][1] = convert_to_focal_length(fcu->bezt[i].vec[2][1], fov_type, aspect, cam->sensor_x);
}
BLI_addtail(AnimCurves, fcu);
diff --git a/source/blender/collada/AnimationImporter.h b/source/blender/collada/AnimationImporter.h
index 7dc4131dd69..1f2de2f3162 100644
--- a/source/blender/collada/AnimationImporter.h
+++ b/source/blender/collada/AnimationImporter.h
@@ -202,6 +202,8 @@ public:
// gives a world-space mat, end's mat not included
bool calc_joint_parent_mat_rest(float mat[4][4], float par[4][4], COLLADAFW::Node *node, COLLADAFW::Node *end);
+ float convert_to_focal_length(float in_xfov, int fov_type, float aspect, float sensorx);
+
#ifdef ARMATURE_TEST
Object *get_joint_object(COLLADAFW::Node *root, COLLADAFW::Node *node, Object *par_job);
#endif
diff --git a/source/blender/makesrna/intern/rna_scene_api.c b/source/blender/makesrna/intern/rna_scene_api.c
index 212578cf3f0..cb3c2078cfe 100644
--- a/source/blender/makesrna/intern/rna_scene_api.c
+++ b/source/blender/makesrna/intern/rna_scene_api.c
@@ -366,7 +366,7 @@ void RNA_api_scene(StructRNA *srna)
RNA_def_float(func, "shutter_close", 1.0f, -1.0f, 1.0f, "Shutter close", "", -1.0f, 1.0f);
RNA_def_boolean(func, "selected_only" , 0, "Selected only", "Export only selected objects");
RNA_def_boolean(func, "uvs" , 1, "UVs", "Export UVs");
- RNA_def_boolean(func, "normals" , 1, "Normals", "Export cormals");
+ RNA_def_boolean(func, "normals" , 1, "Normals", "Export normals");
RNA_def_boolean(func, "vcolors" , 0, "Vertex colors", "Export vertex colors");
RNA_def_boolean(func, "apply_subdiv" , 1, "Subsurfs as meshes", "Export subdivision surfaces as meshes");
RNA_def_boolean(func, "flatten" , 0, "Flatten hierarchy", "Flatten hierarchy");
diff --git a/source/blender/windowmanager/intern/wm_window.c b/source/blender/windowmanager/intern/wm_window.c
index 84a4c3786e6..2ed16dd20db 100644
--- a/source/blender/windowmanager/intern/wm_window.c
+++ b/source/blender/windowmanager/intern/wm_window.c
@@ -385,7 +385,7 @@ static uiBlock *block_create_confirm_quit(struct bContext *C, struct ARegion *ar
UI_block_emboss_set(block, UI_EMBOSS);
uiLayout *layout = UI_block_layout(
- block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, 10, 2, U.pixelsize * 480, U.pixelsize * 110, 0, style);
+ block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, 10, 2, U.widget_unit * 24, U.widget_unit * 6, 0, style);
/* Text and some vertical space */
{