Compare commits

..

43 Commits

Author SHA1 Message Date
30f65b54a7 Merge branch 'master' into draw-colormanagement 2020-02-11 14:57:41 +01:00
9052c6fafa Fix crash when selecting in edit mode with eevee 2020-02-11 14:52:42 +01:00
a01e7d62c5 Style: Rename processor arguments in C api and glsl impl. 2020-02-11 14:52:09 +01:00
a9ad4c805e Add comment about UI color space 2020-02-11 13:21:31 +01:00
0db60af623 - Address reviewers comments 2020-02-11 01:49:06 +01:00
c7b319279e Merge branch 'master' into draw-colormanagement
# Conflicts:
#	source/blender/draw/engines/overlay/overlay_armature.c
2020-02-07 02:05:45 +01:00
863632e7e2 OCIO: Style fixes 2020-02-07 02:03:15 +01:00
61d66b528e Cleanup: Update comments & fix some style issues 2020-02-05 00:25:32 +01:00
c0675868a3 Overlay: Fix edit text overlay invert logic op not working
The result is still different as the inversion is done in scene refered
linear and not in sRGB space as it used to be.
2020-01-31 23:58:49 +01:00
f9914a8ef9 Overlay: Armature: Fix look regression because of linear space rendering
If rendering using linear color the blending of color is different.
So we compensate by using non linear mix of the color inside the shader and
modify color mixing on the cpu.
2020-01-31 19:40:56 +01:00
fe327c0970 Overlay: Put all colors inside draw_common.c for correct colormanagment.
The only exception is for text drawing where the color needs to be sRGB
bytes. This could be fixed in the future.

There are only two hardcoded values remaining but are rather not important:
- object center transform gizmo darkening.
- particle display default color.
2020-01-31 18:59:32 +01:00
691c6f94bb Cleanup: Workbench: Remove background code
We now use clear color to apply background color in render mode.
2020-01-31 04:21:56 +01:00
a7ac3a3ee3 Overlay: Support viewport background modes
Port code from Workbench.
2020-01-31 04:19:33 +01:00
711c4bba54 Cleanup: DRW: Remove unused code and redundant state changes 2020-01-31 04:18:28 +01:00
a3ee3b8f24 Overlay: Move Alt+B clipping bounds display from workbench to overlay 2020-01-29 04:10:55 +01:00
66e1ca26f0 Cleanup: OCIO: Remove immVertexFormat in GLSL implementation
This was only needed for cycles/external engines.
2020-01-28 02:25:52 +01:00
b180c8b847 Render API: Make external engine render in linear space for the viewport
This just replace the OCIO shader by a simple image shader without
color transformation.
2020-01-28 02:18:08 +01:00
089b55885c OCIO: Use GroupTransform to avoid doing 3 transforms instead of 2
This exposes OCIO::GroupTransform to C api to be able to chain the
display transform with a corrective transform to output display linear
colors.

For now the display code only use an exponent transform to go back to
linear but should use a ColorSpaceTransform once we have the correct
config.
2020-01-28 00:23:34 +01:00
5cab93d89f DRW: Remove drw_engines_draw_overlays routine
It makes no sense to have it separate now.
2020-01-27 01:28:41 +01:00
8de055452d Overlays: Fix wireframe shading not working 2020-01-27 01:24:58 +01:00
da240defef Overlay: Don't always allocate the antialiasing buffer and draw background...
...in the main overlay buffer.

This is required if we do caching in the future.
2020-01-26 21:36:46 +01:00
bef1c0d11e DRW: ColorManagement: Fix ghosting with cycles. 2020-01-26 21:08:30 +01:00
be68e89948 DRW: ColorManagement: Fix viewport render pipeline
The final output needs to be merged in another buffer. So we still use
the offscreen buffer for that.
2020-01-26 20:45:52 +01:00
5db185d1c4 GPUViewport: Fix image uv editor. 2020-01-26 17:33:19 +01:00
2616a0a9d6 GPUViewport: Add fallback colormanagment
Just assume sRGB display and no color correction.
2020-01-26 17:32:53 +01:00
adf98e6360 DRW: Move color management to the GPUViewport
This moves the colormanagement step at the blitting step of the viewport.
This means the overlay (including gizmos) must all be rendered in a
separate buffer (meaning they are more or less properly color managed).

The draw manager sets the display transform to apply to the GPUViewport.
2020-01-26 17:09:27 +01:00
419a818eec OCIO: Support overlay blending in linear colorspace in GLSL backend
This add the possibility for the caller to add an extra color texture
to composite on top of the main texture. The compositing is done in post
viewtransform linear space.

However, this means the caller needs to pass the proper color processor
to undo and apply the display transform.
2020-01-26 17:03:25 +01:00
281fb48440 DRW: Color Management: Rework code to accept new color transform needed 2020-01-25 01:11:04 +01:00
e18f0a4cfb Overlay: Add other background types (checker and gradient) 2020-01-24 19:24:04 +01:00
e9411b8ccf Overlay: Cleanup Image background implementation
The background images are now rendered normally on a cleared
canvas. They then get masked by the render when the background
is drawn with a special blend mode.
2020-01-24 18:08:20 +01:00
05dda64cf2 DRW: Color Management: Do some rearangement of the draw code
This puts the color management functions inside one file.

We group all post transform drawing into DRW_draw_callbacks_post_scene.
2020-01-24 16:23:51 +01:00
a25bb245e9 Overlay: Fix background covering the outline 2020-01-24 16:21:56 +01:00
34fd04f3b9 OCIO: Fix curve cache preventing curvemapping update 2020-01-23 01:57:37 +01:00
7d25c74615 DRW: Remove DrawEngineType draw_background function
This moves all background duties to the overlay engine which does alpha
under drawing (sort of).

This means keeping transparency info through the whole pipeline.

For now I just updated workbench which surely still need some cleanups.

Only Solid background is reimplemented.
2020-01-23 00:16:40 +01:00
a6bfab516e OCIO: Add back IMM hack
This is needed to avoid crash in some circumstances.
2020-01-23 00:01:44 +01:00
af37c863eb Cleanup: EEVEE: Remove alpha checker drawing
This will be ported to the overlay engine.
2020-01-22 19:36:34 +01:00
45dc1139e8 DRW: Move Color-Management handling to draw manager
This is first part of the color managmeent refactor.

The drawing of the overlays is done in a sRGB texture to retain some bits
of accuracy.

The transform is applied after the overlays blending for now.

There is much left to be done.
2020-01-22 19:36:34 +01:00
a23f7a85ca Cleanup: EEVEE: Move debug draw to eevee_renderpass.c 2020-01-22 19:36:34 +01:00
73f612fa3b GPU: Add sRGB framebuffer support
Only enable GL_FRAMEBUFFER_SRGB on framebuffer objects as the main
framebuffer is likely to be srgb, and as of now we don't use linear
color for area texture.
2020-01-22 19:36:34 +01:00
986ff34d1e GPUViewport: Cleanup and use always use RGBA16F 2020-01-22 19:36:34 +01:00
e00455381f Cleanup: OpenColorIO: Remove state tracking
Theses are useless. Better assume the state is has been changed.
2020-01-22 19:36:34 +01:00
fa010dddda DRW: Use Batch API instead of IMM for color managment
A little cleanup that should avoid some state changes and pipeline stall.
2020-01-22 19:36:34 +01:00
a0283355fc OpenColorIO: Improve/Cleanup Implementation
This split the shader cache into caches for Shader, Lut and CurveMapping.

This way we can have smoother updates when tweaking/animating the color
managment (i.e. exposure and gamma should only recompile the shader).

The curvemapping, predivide and dither options are no longer compile time
optimized but use uniforms. I did not measure any performance difference.
2020-01-22 19:36:34 +01:00
3130 changed files with 368139 additions and 411297 deletions

View File

@@ -1,7 +1,6 @@
{
"project_id" : "Blender",
"conduit_uri" : "https://developer.blender.org/",
"phabricator.uri" : "https://developer.blender.org/",
"git.default-relative-commit" : "origin/master",
"arc.land.update.default" : "rebase",
"arc.land.onto.default" : "master"

View File

@@ -132,7 +132,9 @@ PenaltyBreakAssignment: 100
AllowShortFunctionsOnASingleLine: None
SortIncludes: true
# Disable for now since it complicates initial migration tests,
# TODO: look into enabling this in the future.
SortIncludes: false
# Don't right align escaped newlines to the right because we have a wide default
AlignEscapedNewlines: DontAlign

View File

@@ -180,14 +180,6 @@ option(WITH_BULLET "Enable Bullet (Physics Engine)" ON)
option(WITH_SYSTEM_BULLET "Use the systems bullet library (currently unsupported due to missing features in upstream!)" )
mark_as_advanced(WITH_SYSTEM_BULLET)
option(WITH_OPENCOLORIO "Enable OpenColorIO color management" ON)
if(APPLE)
# There's no OpenXR runtime in sight for macOS, neither is code well
# tested there -> disable it by default.
option(WITH_XR_OPENXR "Enable VR features through the OpenXR specification" OFF)
mark_as_advanced(WITH_XR_OPENXR)
else()
option(WITH_XR_OPENXR "Enable VR features through the OpenXR specification" ON)
endif()
# Compositor
option(WITH_COMPOSITOR "Enable the tile based nodal compositor" ON)
@@ -319,10 +311,6 @@ mark_as_advanced(WITH_SYSTEM_GLOG)
# Freestyle
option(WITH_FREESTYLE "Enable Freestyle (advanced edges rendering)" ON)
# New object types
option(WITH_NEW_OBJECT_TYPES "Enable new hair and pointcloud objects (use for development only, don't save in files)" OFF)
mark_as_advanced(WITH_NEW_OBJECT_TYPES)
# Misc
if(WIN32)
option(WITH_INPUT_IME "Enable Input Method Editor (IME) for complex Asian character input" ON)
@@ -504,8 +492,7 @@ if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID MATCHES "Clang")
if(NOT MSVC)
find_library(COMPILER_ASAN_LIBRARY asan ${CMAKE_C_IMPLICIT_LINK_DIRECTORIES})
else()
find_library(
COMPILER_ASAN_LIBRARY NAMES clang_rt.asan-x86_64
find_library( COMPILER_ASAN_LIBRARY NAMES clang_rt.asan-x86_64
PATHS
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\LLVM\\LLVM;]/lib/clang/7.0.0/lib/windows
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\LLVM\\LLVM;]/lib/clang/6.0.0/lib/windows
@@ -645,9 +632,6 @@ set_and_warn_dependency(WITH_TBB WITH_OPENIMAGEDENOISE OFF)
set_and_warn_dependency(WITH_TBB WITH_OPENVDB OFF)
set_and_warn_dependency(WITH_TBB WITH_MOD_FLUID OFF)
# OpenVDB uses 'half' type from OpenEXR & fails to link without OpenEXR enabled.
set_and_warn_dependency(WITH_IMAGE_OPENEXR WITH_OPENVDB OFF)
# auto enable openimageio for cycles
if(WITH_CYCLES)
set(WITH_OPENIMAGEIO ON)
@@ -684,7 +668,6 @@ if(WITH_GHOST_SDL OR WITH_HEADLESS)
set(WITH_X11_ALPHA OFF)
set(WITH_GHOST_XDND OFF)
set(WITH_INPUT_IME OFF)
set(WITH_XR_OPENXR OFF)
endif()
if(WITH_CPU_SSE)
@@ -915,28 +898,6 @@ if(NOT WITH_SYSTEM_EIGEN3)
set(EIGEN3_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/extern/Eigen3)
endif()
if(WITH_OPENVDB)
list(APPEND OPENVDB_DEFINITIONS -DWITH_OPENVDB)
if(WITH_OPENVDB_3_ABI_COMPATIBLE)
list(APPEND OPENVDB_DEFINITIONS -DOPENVDB_3_ABI_COMPATIBLE)
endif()
list(APPEND OPENVDB_INCLUDE_DIRS
${BOOST_INCLUDE_DIR}
${TBB_INCLUDE_DIRS}
${OPENEXR_INCLUDE_DIRS})
list(APPEND OPENVDB_LIBRARIES ${OPENEXR_LIBRARIES} ${ZLIB_LIBRARIES})
if(WITH_OPENVDB_BLOSC)
list(APPEND OPENVDB_DEFINITIONS -DWITH_OPENVDB_BLOSC)
list(APPEND OPENVDB_LIBRARIES ${BLOSC_LIBRARIES} ${ZLIB_LIBRARIES})
endif()
list(APPEND OPENVDB_LIBRARIES ${BOOST_LIBRARIES} ${TBB_LIBRARIES})
endif()
#-----------------------------------------------------------------------------
# Configure OpenGL.
@@ -1440,7 +1401,6 @@ elseif(CMAKE_C_COMPILER_ID MATCHES "Clang")
# flags to undo strict flags
ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_UNUSED_PARAMETER -Wno-unused-parameter)
ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_UNUSED_VARIABLE -Wno-unused-variable)
ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_UNUSED_MACROS -Wno-unused-macros)
ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_MISSING_VARIABLE_DECLARATIONS -Wno-missing-variable-declarations)
@@ -1459,8 +1419,6 @@ elseif(CMAKE_C_COMPILER_ID MATCHES "Clang")
ADD_CHECK_CXX_COMPILER_FLAG(CXX_REMOVE_STRICT_FLAGS CXX_WARN_NO_REORDER -Wno-reorder)
ADD_CHECK_CXX_COMPILER_FLAG(CXX_REMOVE_STRICT_FLAGS CXX_WARN_NO_COMMENT -Wno-comment)
ADD_CHECK_CXX_COMPILER_FLAG(CXX_REMOVE_STRICT_FLAGS CXX_WARN_NO_UNUSED_TYPEDEFS -Wno-unused-local-typedefs)
ADD_CHECK_CXX_COMPILER_FLAG(CXX_REMOVE_STRICT_FLAGS CXX_WARN_NO_UNDEFINED_VAR_TEMPLATE -Wno-undefined-var-template)
ADD_CHECK_CXX_COMPILER_FLAG(CXX_REMOVE_STRICT_FLAGS CXX_WARN_NO_INSTANTIATION_AFTER_SPECIALIZATION -Wno-instantiation-after-specialization)
elseif(CMAKE_C_COMPILER_ID MATCHES "Intel")
@@ -1711,7 +1669,6 @@ if(FIRST_RUN)
info_cfg_option(WITH_CYCLES)
info_cfg_option(WITH_FREESTYLE)
info_cfg_option(WITH_OPENCOLORIO)
info_cfg_option(WITH_XR_OPENXR)
info_cfg_option(WITH_OPENIMAGEDENOISE)
info_cfg_option(WITH_OPENVDB)
info_cfg_option(WITH_ALEMBIC)

View File

@@ -545,7 +545,7 @@ update: .FORCE
$(PYTHON) ./build_files/utils/make_update.py
format: .FORCE
PATH="../lib/${OS_NCASE}_${CPU}/llvm/bin/:../lib/${OS_NCASE}_centos7_${CPU}/llvm/bin/:../lib/${OS_NCASE}/llvm/bin/:$(PATH)" \
PATH="../lib/${OS_NCASE}/llvm/bin/:$(PATH)" \
$(PYTHON) source/tools/utils_maintenance/clang_format_paths.py $(PATHS)

View File

@@ -98,13 +98,15 @@ else()
include(cmake/pugixml.cmake)
endif()
include(cmake/openimagedenoise.cmake)
include(cmake/embree.cmake)
include(cmake/xr_openxr.cmake)
if(WITH_WEBP)
include(cmake/webp.cmake)
endif()
if(WITH_EMBREE)
include(cmake/embree.cmake)
endif()
if(WIN32)
# HMD branch deps
include(cmake/hidapi.cmake)

View File

@@ -44,7 +44,7 @@ if(WIN32)
elseif(APPLE)
set(BOOST_CONFIGURE_COMMAND ./bootstrap.sh)
set(BOOST_BUILD_COMMAND ./b2)
set(BOOST_BUILD_OPTIONS toolset=darwin cxxflags=${PLATFORM_CXXFLAGS} linkflags=${PLATFORM_LDFLAGS} visibility=global --disable-icu boost.locale.icu=off)
set(BOOST_BUILD_OPTIONS toolset=darwin cxxflags=${PLATFORM_CXXFLAGS} linkflags=${PLATFORM_LDFLAGS} --disable-icu boost.locale.icu=off)
set(BOOST_HARVEST_CMD echo .)
set(BOOST_PATCH_COMMAND echo .)
else()

View File

@@ -161,8 +161,6 @@ harvest(opensubdiv/include opensubdiv/include "*.h")
harvest(opensubdiv/lib opensubdiv/lib "*.a")
harvest(openvdb/include/openvdb openvdb/include/openvdb "*.h")
harvest(openvdb/lib openvdb/lib "*.a")
harvest(xr_openxr_sdk/include/openxr xr_openxr_sdk/include/openxr "*.h")
harvest(xr_openxr_sdk/lib xr_openxr_sdk/lib "*.a")
harvest(osl/bin osl/bin "oslc")
harvest(osl/include osl/include "*.h")
harvest(osl/lib osl/lib "*.a")

View File

@@ -40,7 +40,6 @@ ExternalProject_Add(ll
URL_HASH MD5=${LLVM_HASH}
CMAKE_GENERATOR ${LLVM_GENERATOR}
PREFIX ${BUILD_DIR}/ll
PATCH_COMMAND ${PATCH_CMD} -p 1 -d ${BUILD_DIR}/ll/src/ll < ${PATCH_DIR}/llvm.diff
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/llvm ${DEFAULT_CMAKE_FLAGS} ${LLVM_EXTRA_ARGS}
INSTALL_DIR ${LIBDIR}/llvm
)

View File

@@ -20,6 +20,7 @@ if(WIN32)
option(ENABLE_MINGW64 "Enable building of ffmpeg/iconv/libsndfile/lapack/fftw3 by installing mingw64" ON)
endif()
option(WITH_WEBP "Enable building of oiio with webp support" OFF)
option(WITH_EMBREE "Enable building of Embree" OFF)
set(MAKE_THREADS 1 CACHE STRING "Number of threads to run make with")
if(NOT BUILD_MODE)

View File

@@ -73,7 +73,6 @@ set(OSL_EXTRA_ARGS
-DSTOP_ON_WARNING=OFF
-DUSE_LLVM_BITCODE=OFF
-DUSE_PARTIO=OFF
-DUSE_QT=OFF
${OSL_SIMD_FLAGS}
-DPARTIO_LIBRARIES=
)

View File

@@ -43,7 +43,7 @@ if(WIN32)
PREFIX ${BUILD_DIR}/python
CONFIGURE_COMMAND ""
BUILD_COMMAND cd ${BUILD_DIR}/python/src/external_python/pcbuild/ && set IncludeTkinter=false && call build.bat -e -p ${PYTHON_ARCH} -c ${BUILD_MODE}
INSTALL_COMMAND ${PYTHON_BINARY_INTERNAL} ${PYTHON_SRC}/PC/layout/main.py -b ${PYTHON_SRC}/PCbuild/amd64 -s ${PYTHON_SRC} -t ${PYTHON_SRC}/tmp/ --include-underpth --include-stable --include-pip --include-dev --include-launchers --include-venv --include-symbols ${PYTHON_EXTRA_INSTLAL_FLAGS} --copy ${LIBDIR}/python
INSTALL_COMMAND ${PYTHON_BINARY_INTERNAL} ${PYTHON_SRC}/PC/layout/main.py -b ${PYTHON_SRC}/PCbuild/amd64 -s ${PYTHON_SRC} -t ${PYTHON_SRC}/tmp/ --include-underpth --include-stable --include-pip --include-dev --include-launchers --include-symbols ${PYTHON_EXTRA_INSTLAL_FLAGS} --copy ${LIBDIR}/python
)
else()

View File

@@ -299,9 +299,9 @@ set(SQLITE_VERSION 3.24.0)
set(SQLITE_URI https://www.sqlite.org/2018/sqlite-src-3240000.zip)
set(SQLITE_HASH fb558c49ee21a837713c4f1e7e413309aabdd9c7)
set(EMBREE_VERSION 3.8.0)
set(EMBREE_VERSION 3.2.4)
set(EMBREE_URI https://github.com/embree/embree/archive/v${EMBREE_VERSION}.zip)
set(EMBREE_HASH ac504d5426945fe25dec1267e0c39d52)
set(EMBREE_HASH 3d4a1147002ff43939d45140aa9d6fb8)
set(USD_VERSION 19.11)
set(USD_URI https://github.com/PixarAnimationStudios/USD/archive/v${USD_VERSION}.tar.gz)
@@ -318,7 +318,3 @@ set(LIBGLU_HASH 151aef599b8259efe9acd599c96ea2a3)
set(MESA_VERSION 18.3.1)
set(MESA_URI ftp://ftp.freedesktop.org/pub/mesa//mesa-${MESA_VERSION}.tar.xz)
set(MESA_HASH d60828056d77bfdbae0970f9b15fb1be)
set(XR_OPENXR_SDK_VERSION 1.0.6)
set(XR_OPENXR_SDK_URI https://github.com/KhronosGroup/OpenXR-SDK/archive/release-${XR_OPENXR_SDK_VERSION}.tar.gz)
set(XR_OPENXR_SDK_HASH 21daea7c3bfec365298d779a0e19caa1)

View File

@@ -1,59 +0,0 @@
# ***** BEGIN GPL LICENSE BLOCK *****
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ***** END GPL LICENSE BLOCK *****
# Keep flags in sync with install_deps.sh ones in compile_XR_OpenXR_SDK()
set(XR_OPENXR_SDK_EXTRA_ARGS
-DBUILD_FORCE_GENERATION=OFF
-DBUILD_LOADER=ON
-DDYNAMIC_LOADER=OFF
)
if(UNIX AND NOT APPLE)
list(APPEND XR_OPENXR_SDK_EXTRA_ARGS
-DBUILD_WITH_WAYLAND_HEADERS=OFF
-DBUILD_WITH_XCB_HEADERS=OFF
-DBUILD_WITH_XLIB_HEADERS=ON
-DCMAKE_CXX_FLAGS=-DDISABLE_STD_FILESYSTEM=1
)
endif()
ExternalProject_Add(external_xr_openxr_sdk
URL ${XR_OPENXR_SDK_URI}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
URL_HASH MD5=${XR_OPENXR_SDK_HASH}
PREFIX ${BUILD_DIR}/xr_openxr_sdk
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/xr_openxr_sdk ${DEFAULT_CMAKE_FLAGS} ${XR_OPENXR_SDK_EXTRA_ARGS}
INSTALL_DIR ${LIBDIR}/xr_openxr_sdk
)
if(WIN32)
if(BUILD_MODE STREQUAL Release)
ExternalProject_Add_Step(external_xr_openxr_sdk after_install
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/xr_openxr_sdk/include/openxr ${HARVEST_TARGET}/xr_openxr_sdk/include/openxr
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/xr_openxr_sdk/lib ${HARVEST_TARGET}/xr_openxr_sdk/lib
DEPENDEES install
)
endif()
if(BUILD_MODE STREQUAL Debug)
ExternalProject_Add_Step(external_xr_openxr_sdk after_install
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/xr_openxr_sdk/lib/openxr_loader.lib ${HARVEST_TARGET}/xr_openxr_sdk/lib/openxr_loader_d.lib
DEPENDEES install
)
endif()
endif()

File diff suppressed because it is too large Load Diff

View File

@@ -1,2 +0,0 @@
# Files contains mixed line endings, patch needs to preserve them to apply.
opencollada.diff binary

View File

@@ -26,8 +26,8 @@ include(FindPackageMessage)
include(SelectLibraryConfigurations)
if(ILMBASE_USE_STATIC_LIBS)
set(_ilmbase_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
if( ILMBASE_USE_STATIC_LIBS )
set( _ilmbase_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
if(WIN32)
set(CMAKE_FIND_LIBRARY_SUFFIXES .lib .a ${CMAKE_FIND_LIBRARY_SUFFIXES})
else()
@@ -247,7 +247,7 @@ if(ILMBASE_FOUND)
endif()
# Restore the original find library ordering
if(ILMBASE_USE_STATIC_LIBS )
if( ILMBASE_USE_STATIC_LIBS )
set(CMAKE_FIND_LIBRARY_SUFFIXES ${_ilmbase_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES})
endif()

View File

@@ -230,7 +230,7 @@ if(OPENEXR_FOUND)
endif()
# Restore the original find library ordering
if(OPENEXR_USE_STATIC_LIBS )
if( OPENEXR_USE_STATIC_LIBS )
set(CMAKE_FIND_LIBRARY_SUFFIXES ${_openexr_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES})
endif()

View File

@@ -1,13 +0,0 @@
--- a/lib/Support/Unix/Path.inc 2020-02-17 09:24:26.000000000 +0100
+++ b/lib/Support/Unix/Path.inc 2020-02-17 09:26:25.000000000 +0100
@@ -1200,7 +1200,9 @@
/// implementation.
std::error_code copy_file(const Twine &From, const Twine &To) {
uint32_t Flag = COPYFILE_DATA;
-#if __has_builtin(__builtin_available) && defined(COPYFILE_CLONE)
+ // BLENDER: This optimization makes LLVM not build on older Xcode versions,
+ // just disable until everyone has new enough Xcode versions.
+#if 0
if (__builtin_available(macos 10.12, *)) {
bool IsSymlink;
if (std::error_code Error = is_symlink_file(From, IsSymlink))

View File

@@ -3,32 +3,19 @@ index 95abbe2..4f14f30 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -254,11 +254,11 @@ if(USE_STATIC_MSVC_RUNTIME)
endif()
#adding PCRE
-find_package(PCRE)
+#find_package(PCRE)
if (PCRE_FOUND)
message(STATUS "SUCCESSFUL: PCRE found")
else () # if pcre not found building its local copy from ./Externals
- if (WIN32 OR APPLE)
+ if (1)
message("WARNING: Native PCRE not found, taking PCRE from ./Externals")
add_definitions(-DPCRE_STATIC)
add_subdirectory(${EXTERNAL_LIBRARIES}/pcre)
diff --git a/DAEValidator/CMakeLists.txt b/DAEValidator/CMakeLists.txt
index 03ad540..f7d05cf 100644
--- a/DAEValidator/CMakeLists.txt
+++ b/DAEValidator/CMakeLists.txt
@@ -98,7 +98,7 @@ if (WIN32)
# C4710: 'function' : function not inlined
# C4711: function 'function' selected for inline expansion
# C4820: 'bytes' bytes padding added after construct 'member_name'
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP /Wall /WX /wd4505 /wd4514 /wd4592 /wd4710 /wd4711 /wd4820")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP /Wall /wd4505 /wd4514 /wd4592 /wd4710 /wd4711 /wd4820")
else ()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -Werror")
endif ()
endif()
#adding PCRE
-find_package(PCRE)
+#find_package(PCRE)
if (PCRE_FOUND)
message(STATUS "SUCCESSFUL: PCRE found")
else () # if pcre not found building its local copy from ./Externals
- if (WIN32 OR APPLE)
+ if (1)
message("WARNING: Native PCRE not found, taking PCRE from ./Externals")
add_definitions(-DPCRE_STATIC)
add_subdirectory(${EXTERNAL_LIBRARIES}/pcre)
diff --git a/DAEValidator/library/include/no_warning_begin b/DAEValidator/library/include/no_warning_begin
index 7a69c32..defb315 100644
--- a/DAEValidator/library/include/no_warning_begin
@@ -43,8 +30,34 @@ index 7a69c32..defb315 100644
# if defined(_MSC_VER) && defined(_DEBUG)
# pragma warning(disable:4548)
# endif
diff --git a/GeneratedSaxParser/src/GeneratedSaxParserUtils.cpp b/GeneratedSaxParser/src/GeneratedSaxParserUtils.cpp
index 1f9a3ee..d151e9a 100644
--- a/GeneratedSaxParser/src/GeneratedSaxParserUtils.cpp
+++ b/GeneratedSaxParser/src/GeneratedSaxParserUtils.cpp
@@ -1553,7 +1553,7 @@ namespace GeneratedSaxParser
#if defined(COLLADABU_OS_WIN) && !defined(__MINGW32__)
return _isnan( value ) ? true : false;
#else
-#ifdef isnan
+#if defined(isnan) || defined(__APPLE__)
return isnan( value );
#else
return std::isnan(value);
diff --git a/DAEValidator/CMakeLists.txt b/DAEValidator/CMakeLists.txt
index 03ad540f..f7d05cfb 100644
--- a/DAEValidator/CMakeLists.txt
+++ b/DAEValidator/CMakeLists.txt
@@ -98,7 +98,7 @@ if (WIN32)
# C4710: 'function' : function not inlined
# C4711: function 'function' selected for inline expansion
# C4820: 'bytes' bytes padding added after construct 'member_name'
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP /Wall /WX /wd4505 /wd4514 /wd4592 /wd4710 /wd4711 /wd4820")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP /Wall /wd4505 /wd4514 /wd4592 /wd4710 /wd4711 /wd4820")
else ()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -Werror")
endif ()
diff --git a/DAEValidator/library/src/ArgumentParser.cpp b/DAEValidator/library/src/ArgumentParser.cpp
index 897e4dc..98a69ff 100644
index 897e4dcf..98a69ff1 100644
--- a/DAEValidator/library/src/ArgumentParser.cpp
+++ b/DAEValidator/library/src/ArgumentParser.cpp
@@ -6,10 +6,10 @@
@@ -61,28 +74,14 @@ index 897e4dc..98a69ff 100644
#endif
namespace opencollada
diff --git a/Externals/LibXML/CMakeLists.txt b/Externals/LibXML/CMakeLists.txt
index 40081e7..e1d1bfa 100644
--- a/Externals/LibXML/CMakeLists.txt
+++ b/Externals/LibXML/CMakeLists.txt
@@ -9,6 +9,7 @@ add_definitions(
-DLIBXML_SCHEMAS_ENABLED
-DLIBXML_XPATH_ENABLED
-DLIBXML_TREE_ENABLED
+ -DLIBXML_STATIC
)
if(USE_STATIC_MSVC_RUNTIME)
diff --git a/GeneratedSaxParser/src/GeneratedSaxParserUtils.cpp b/GeneratedSaxParser/src/GeneratedSaxParserUtils.cpp
index 1f9a3ee..d151e9a 100644
--- a/GeneratedSaxParser/src/GeneratedSaxParserUtils.cpp
+++ b/GeneratedSaxParser/src/GeneratedSaxParserUtils.cpp
@@ -1553,7 +1553,7 @@ namespace GeneratedSaxParser
#if defined(COLLADABU_OS_WIN) && !defined(__MINGW32__)
return _isnan( value ) ? true : false;
#else
-#ifdef isnan
+#if defined(isnan) || defined(__APPLE__)
return isnan( value );
#else
return std::isnan(value);
diff -Naur orig/Externals/LibXML/CMakeLists.txt external_opencollada/Externals/LibXML/CMakeLists.txt
--- orig/Externals/LibXML/CMakeLists.txt 2018-11-26 15:43:10 -0700
+++ external_opencollada/Externals/LibXML/CMakeLists.txt 2020-01-21 14:15:04 -0700
@@ -9,6 +9,7 @@
-DLIBXML_SCHEMAS_ENABLED
-DLIBXML_XPATH_ENABLED
-DLIBXML_TREE_ENABLED
+ -DLIBXML_STATIC
)
if(USE_STATIC_MSVC_RUNTIME)

View File

@@ -98,7 +98,7 @@ class VersionInfo:
self.is_development_build = False
else:
# Development build
self.full_version = self.version + self.version_char + '-' + self.hash
self.full_version = self.version + '-' + self.hash
self.is_development_build = True
def _parse_header_file(self, filename, define):

View File

@@ -70,64 +70,9 @@ class ArchiveWithIndicator:
self.archive_filepath = self.base_dir / archive_name
self.ready_indicator_filepath = self.base_dir / ready_indicator_name
def is_ready_unsafe(self) -> bool:
"""
Check whether the archive is ready for access.
No guarding about possible network failres is done here.
"""
if not self.ready_indicator_filepath.exists():
return False
# Sometimes on macOS indicator file appears prior to the actual archive
# despite the order of creation and os.sync() used in tag_ready().
# So consider archive not ready if there is an indicator without an
# actual archive.
if not self.archive_filepath.exists():
print('Found indicator without actual archive, waiting for archive '
f'({self.archive_filepath}) to appear.')
return False
# Read archive size from indicator/
#
# Assume that file is either empty or is fully written. This is being checked
# by performing ValueError check since empty string will throw this exception
# when attempted to be converted to int.
expected_archive_size_str = self.ready_indicator_filepath.read_text()
try:
expected_archive_size = int(expected_archive_size_str)
except ValueError:
print(f'Invalid archive size "{expected_archive_size_str}"')
return False
# Wait for until archive is fully stored.
actual_archive_size = self.archive_filepath.stat().st_size
if actual_archive_size != expected_archive_size:
print('Partial/invalid archive size (expected '
f'{expected_archive_size} got {actual_archive_size})')
return False
return True
def is_ready(self) -> bool:
"""
Check whether the archive is ready for access.
Will tolerate possible network failures: if there is a network failure
or if there is still no proper permission on a file False is returned.
"""
# There are some intermitten problem happening at a random which is
# translates to "OSError : [WinError 59] An unexpected network error occurred".
# Some reports suggests it might be due to lack of permissions to the file,
# which might be applicable in our case since it's possible that file is
# initially created with non-accessible permissions and gets chmod-ed
# after initial creation.
try:
return self.is_ready_unsafe()
except OSError as e:
print(f'Exception checking archive: {e}')
return False
"""Check whether the archive is ready for access."""
return self.ready_indicator_filepath.exists()
def tag_ready(self) -> None:
"""
@@ -143,8 +88,7 @@ class ArchiveWithIndicator:
# an actual file.
if util.get_current_platform() != util.Platform.WINDOWS:
os.sync()
archive_size = self.archive_filepath.stat().st_size
self.ready_indicator_filepath.write_text(str(archive_size))
self.ready_indicator_filepath.touch()
def clean(self) -> None:
"""

View File

@@ -326,9 +326,6 @@ class BaseCodeSigner(metaclass=abc.ABCMeta):
self.copy_signed_files_to_directory(
unpacked_signed_files_dir, destination_dir)
logger_builder.info('Removing archive with signed files...')
self.signed_archive_info.clean()
############################################################################
# Signing server side helpers.

View File

@@ -40,5 +40,5 @@ execute_process(
)
if(NOT exit_code EQUAL "0")
message(FATAL_ERROR "Non-zero exit code of codesign tool")
message( FATAL_ERROR "Non-zero exit code of codesign tool")
endif()

View File

@@ -66,22 +66,6 @@ FIND_PROGRAM(OSL_COMPILER oslc
HINTS ${_osl_SEARCH_DIRS}
PATH_SUFFIXES bin)
get_filename_component(OSL_SHADER_HINT ${OSL_COMPILER} DIRECTORY)
get_filename_component(OSL_SHADER_HINT ${OSL_SHADER_DIR}/../ ABSOLUTE)
FIND_PATH(OSL_SHADER_DIR
NAMES
stdosl.h
HINTS
${OSL_ROOT_DIR}
${OSL_SHADER_HINT}
$ENV{OSLHOME}
/usr/share/OSL/
/usr/include/OSL/
PATH_SUFFIXES
shaders
)
# handle the QUIETLY and REQUIRED arguments and set OSL_FOUND to TRUE if
# all listed variables are TRUE
INCLUDE(FindPackageHandleStandardArgs)

View File

@@ -1,73 +0,0 @@
# - Find OpenXR-SDK libraries
# Find the native OpenXR-SDK includes and libraries
#
# Note that there is a distinction between the OpenXR standard and the SDK. The
# latter provides utilities to use the standard but is not part of it. Most
# importantly, it contains C headers and a loader library, which manages
# dynamic linking to OpenXR runtimes like Monado, Windows Mixed Reality or
# Oculus. See the repository for more details:
# https://github.com/KhronosGroup/OpenXR-SDK
#
# This module defines
# XR_OPENXR_SDK_INCLUDE_DIRS, where to find OpenXR-SDK headers, Set when
# XR_OPENXR_SDK_INCLUDE_DIR is found.
# XR_OPENXR_SDK_LIBRARIES, libraries to link against to use OpenXR.
# XR_OPENXR_SDK_ROOT_DIR, the base directory to search for OpenXR-SDK.
# This can also be an environment variable.
# XR_OPENXR_SDK_FOUND, if false, do not try to use OpenXR-SDK.
#
# also defined, but not for general use are
# XR_OPENXR_SDK_LOADER_LIBRARY, where to find the OpenXR-SDK loader library.
#=============================================================================
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
#
# This software is distributed WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================
# If XR_OPENXR_SDK_ROOT_DIR was defined in the environment, use it.
IF(NOT XR_OPENXR_SDK_ROOT_DIR AND NOT $ENV{XR_OPENXR_SDK_ROOT_DIR} STREQUAL "")
SET(XR_OPENXR_SDK_ROOT_DIR $ENV{XR_OPENXR_SDK_ROOT_DIR})
ENDIF()
SET(_xr_openxr_sdk_SEARCH_DIRS
${XR_OPENXR_SDK_ROOT_DIR}
/opt/lib/xr-openxr-sdk
)
FIND_PATH(XR_OPENXR_SDK_INCLUDE_DIR
NAMES
openxr/openxr.h
HINTS
${_xr_openxr_sdk_SEARCH_DIRS}
PATH_SUFFIXES
include
)
FIND_LIBRARY(XR_OPENXR_SDK_LOADER_LIBRARY
NAMES
openxr_loader
HINTS
${_xr_openxr_sdk_SEARCH_DIRS}
PATH_SUFFIXES
lib64 lib
)
# handle the QUIETLY and REQUIRED arguments and set XR_OPENXR_SDK_FOUND to TRUE if
# all listed variables are TRUE
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(XR_OPENXR_SDK DEFAULT_MSG
XR_OPENXR_SDK_LOADER_LIBRARY XR_OPENXR_SDK_INCLUDE_DIR)
IF(XR_OPENXR_SDK_FOUND)
SET(XR_OPENXR_SDK_LIBRARIES ${XR_OPENXR_SDK_LOADER_LIBRARY})
SET(XR_OPENXR_SDK_INCLUDE_DIRS ${XR_OPENXR_SDK_INCLUDE_DIR})
ENDIF(XR_OPENXR_SDK_FOUND)
MARK_AS_ADVANCED(
XR_OPENXR_SDK_INCLUDE_DIR
XR_OPENXR_SDK_LOADER_LIBRARY
)

View File

@@ -63,9 +63,6 @@ macro(BLENDER_SRC_GTEST_EX)
if(WITH_OPENMP_STATIC)
target_link_libraries(${TARGET_NAME} ${OpenMP_LIBRARIES})
endif()
if(UNIX AND NOT APPLE)
target_link_libraries(${TARGET_NAME} bf_intern_libc_compat)
endif()
get_property(GENERATOR_IS_MULTI_CONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
if(GENERATOR_IS_MULTI_CONFIG)

View File

@@ -61,6 +61,3 @@ if(UNIX AND NOT APPLE)
set(WITH_X11_XINPUT ON CACHE BOOL "" FORCE)
set(WITH_X11_XF86VMODE ON CACHE BOOL "" FORCE)
endif()
if(NOT APPLE)
set(WITH_XR_OPENXR ON CACHE BOOL "" FORCE)
endif()

View File

@@ -6,6 +6,7 @@
#
set(WITH_INSTALL_PORTABLE ON CACHE BOOL "" FORCE)
set(WITH_SYSTEM_GLEW ON CACHE BOOL "" FORCE)
set(WITH_ALEMBIC OFF CACHE BOOL "" FORCE)
set(WITH_BOOST OFF CACHE BOOL "" FORCE)
@@ -44,7 +45,6 @@ set(WITH_OPENAL OFF CACHE BOOL "" FORCE)
set(WITH_OPENCOLLADA OFF CACHE BOOL "" FORCE)
set(WITH_OPENCOLORIO OFF CACHE BOOL "" FORCE)
set(WITH_OPENIMAGEDENOISE OFF CACHE BOOL "" FORCE)
set(WITH_XR_OPENXR OFF CACHE BOOL "" FORCE)
set(WITH_OPENIMAGEIO OFF CACHE BOOL "" FORCE)
set(WITH_OPENMP OFF CACHE BOOL "" FORCE)
set(WITH_OPENSUBDIV OFF CACHE BOOL "" FORCE)

View File

@@ -65,6 +65,3 @@ if(UNIX AND NOT APPLE)
set(WITH_X11_XINPUT ON CACHE BOOL "" FORCE)
set(WITH_X11_XF86VMODE ON CACHE BOOL "" FORCE)
endif()
if(NOT APPLE)
set(WITH_XR_OPENXR ON CACHE BOOL "" FORCE)
endif()

View File

@@ -45,7 +45,3 @@ elseif(APPLE)
# OpenMP causes linking error on build, disable.
set(WITH_MEM_JEMALLOC OFF CACHE BOOL "" FORCE)
endif()
if(WIN32)
set(WITH_WINDOWS_BUNDLE_CRT OFF CACHE BOOL "" FORCE)
endif()

View File

@@ -122,7 +122,7 @@ function(target_link_libraries_optimized
)
foreach(_LIB ${LIBS})
target_link_libraries(${TARGET} INTERFACE optimized "${_LIB}")
target_link_libraries(${TARGET} optimized "${_LIB}")
endforeach()
endfunction()
@@ -132,7 +132,7 @@ function(target_link_libraries_debug
)
foreach(_LIB ${LIBS})
target_link_libraries(${TARGET} INTERFACE debug "${_LIB}")
target_link_libraries(${TARGET} debug "${_LIB}")
endforeach()
endfunction()
@@ -170,7 +170,6 @@ function(blender_include_dirs_sys
endfunction()
function(blender_source_group
name
sources
)
@@ -206,13 +205,6 @@ function(blender_source_group
source_group("${GROUP_ID}" FILES ${_SRC})
endforeach()
endif()
# if enabled, set the FOLDER property for visual studio projects
if(WINDOWS_USE_VISUAL_STUDIO_PROJECT_FOLDERS)
get_filename_component(FolderDir ${CMAKE_CURRENT_SOURCE_DIR} DIRECTORY)
string(REPLACE ${CMAKE_SOURCE_DIR} "" FolderDir ${FolderDir})
set_target_properties(${name} PROPERTIES FOLDER ${FolderDir})
endif()
endfunction()
@@ -303,11 +295,11 @@ function(blender_add_lib__impl
set(next_library_mode "${library_lower}")
else()
if("${next_library_mode}" STREQUAL "optimized")
target_link_libraries(${name} INTERFACE optimized ${library})
target_link_libraries(${name} optimized ${library})
elseif("${next_library_mode}" STREQUAL "debug")
target_link_libraries(${name} INTERFACE debug ${library})
target_link_libraries(${name} debug ${library})
else()
target_link_libraries(${name} INTERFACE ${library})
target_link_libraries(${name} ${library})
endif()
set(next_library_mode "")
endif()
@@ -316,7 +308,14 @@ function(blender_add_lib__impl
# works fine without having the includes
# listed is helpful for IDE's (QtCreator/MSVC)
blender_source_group("${name}" "${sources}")
blender_source_group("${sources}")
# if enabled, set the FOLDER property for visual studio projects
if(WINDOWS_USE_VISUAL_STUDIO_PROJECT_FOLDERS)
get_filename_component(FolderDir ${CMAKE_CURRENT_SOURCE_DIR} DIRECTORY)
string(REPLACE ${CMAKE_SOURCE_DIR} "" FolderDir ${FolderDir})
set_target_properties(${name} PROPERTIES FOLDER ${FolderDir})
endif()
list_assert_duplicates("${sources}")
list_assert_duplicates("${includes}")
@@ -947,7 +946,7 @@ function(data_to_c_simple
set_source_files_properties(${_file_to} PROPERTIES GENERATED TRUE)
endfunction()
# Function for converting pixmap directory to a '.png' and then a '.c' file.
# macro for converting pixmap directory to a png and then a c file
function(data_to_c_simple_icons
path_from icon_prefix icon_names
list_to_add
@@ -1139,8 +1138,8 @@ endmacro()
macro(blender_precompile_headers target cpp header)
if(MSVC)
# get the name for the pch output file
get_filename_component(pchbase ${cpp} NAME_WE)
set(pchfinal "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${pchbase}.pch")
get_filename_component( pchbase ${cpp} NAME_WE )
set( pchfinal "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${pchbase}.pch" )
# mark the cpp as the one outputting the pch
set_property(SOURCE ${cpp} APPEND PROPERTY OBJECT_OUTPUTS "${pchfinal}")
@@ -1160,18 +1159,11 @@ macro(blender_precompile_headers target cpp header)
endmacro()
macro(set_and_warn_dependency
_dependency _setting _val)
# when $_dependency is disabled, forces $_setting = $_val
if(NOT ${${_dependency}} AND ${${_setting}})
message(STATUS "'${_dependency}' is disabled: forcing 'set(${_setting} ${_val})'")
set(${_setting} ${_val})
endif()
_dependency _setting _val)
# when $_dependency is disabled, forces $_setting = $_val
if(NOT ${${_dependency}} AND ${${_setting}})
message(STATUS "'${_dependency}' is disabled: forcing 'set(${_setting} ${_val})'")
set(${_setting} ${_val})
endif()
endmacro()
macro(without_system_libs_begin)
set(CMAKE_IGNORE_PATH "${CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES};${CMAKE_SYSTEM_INCLUDE_PATH};${CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES};${CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES}")
endmacro()
macro(without_system_libs_end)
unset(CMAKE_IGNORE_PATH)
endmacro()

View File

@@ -381,7 +381,7 @@ if(WITH_CYCLES_OSL)
endif()
if(WITH_CYCLES_EMBREE)
find_package(Embree 3.8.0 REQUIRED)
find_package(Embree 3.2.4 REQUIRED)
set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -Xlinker -stack_size -Xlinker 0x100000")
endif()
@@ -411,21 +411,11 @@ if(WITH_OPENMP)
# Copy libomp.dylib to allow executables like datatoc and tests to work.
execute_process(
COMMAND mkdir -p ${CMAKE_BINARY_DIR}/Resources/lib
COMMAND cp -p ${LIBDIR}/openmp/lib/libomp.dylib ${CMAKE_BINARY_DIR}/Resources/lib/libomp.dylib
)
COMMAND mkdir -p ${CMAKE_BINARY_DIR}/Resources/lib
COMMAND cp -p ${LIBDIR}/openmp/lib/libomp.dylib ${CMAKE_BINARY_DIR}/Resources/lib/libomp.dylib)
execute_process(
COMMAND mkdir -p ${CMAKE_BINARY_DIR}/bin/Resources/lib
COMMAND cp -p ${LIBDIR}/openmp/lib/libomp.dylib ${CMAKE_BINARY_DIR}/bin/Resources/lib/libomp.dylib
)
endif()
endif()
if(WITH_XR_OPENXR)
find_package(OpenXR-SDK)
if(NOT OPENXR_SDK_FOUND)
message(WARNING "OpenXR-SDK was not found, disabling WITH_XR_OPENXR")
set(WITH_XR_OPENXR OFF)
COMMAND mkdir -p ${CMAKE_BINARY_DIR}/bin/Resources/lib
COMMAND cp -p ${LIBDIR}/openmp/lib/libomp.dylib ${CMAKE_BINARY_DIR}/bin/Resources/lib/libomp.dylib)
endif()
endif()

View File

@@ -104,7 +104,7 @@ else()
endif()
if(NOT ${CMAKE_GENERATOR} MATCHES "Xcode")
# Force CMAKE_OSX_DEPLOYMENT_TARGET for makefiles, will not work else (CMake bug?)
# force CMAKE_OSX_DEPLOYMENT_TARGET for makefiles, will not work else ( cmake bug ? )
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mmacosx-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mmacosx-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET}")
add_definitions("-DMACOSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}")

View File

@@ -72,21 +72,26 @@ macro(find_package_wrapper)
endif()
endmacro()
# ----------------------------------------------------------------------------
# Precompiled Libraries
#
# These are libraries that may be precompiled. For this we disable searching in
# the system directories so that we don't accidentally use them instead.
if(EXISTS ${LIBDIR})
without_system_libs_begin()
endif()
find_package_wrapper(JPEG REQUIRED)
find_package_wrapper(PNG REQUIRED)
find_package_wrapper(ZLIB REQUIRED)
find_package_wrapper(Freetype REQUIRED)
if(WITH_LZO AND WITH_SYSTEM_LZO)
find_package_wrapper(LZO)
if(NOT LZO_FOUND)
message(FATAL_ERROR "Failed finding system LZO version!")
endif()
endif()
if(WITH_SYSTEM_EIGEN3)
find_package_wrapper(Eigen3)
if(NOT EIGEN3_FOUND)
message(FATAL_ERROR "Failed finding system Eigen3 version!")
endif()
endif()
# else values are set below for all platforms
if(WITH_PYTHON)
# No way to set py35, remove for now.
# find_package(PythonLibs)
@@ -121,6 +126,14 @@ if(WITH_IMAGE_TIFF)
endif()
endif()
# Audio IO
if(WITH_SYSTEM_AUDASPACE)
find_package_wrapper(Audaspace)
if(NOT AUDASPACE_FOUND OR NOT AUDASPACE_C_FOUND)
message(FATAL_ERROR "Audaspace external library not found!")
endif()
endif()
if(WITH_OPENAL)
find_package_wrapper(OpenAL)
if(NOT OPENAL_FOUND)
@@ -153,6 +166,13 @@ if(WITH_SDL)
endif()
endif()
if(WITH_JACK)
find_package_wrapper(Jack)
if(NOT JACK_FOUND)
set(WITH_JACK OFF)
endif()
endif()
# Codecs
if(WITH_CODEC_SNDFILE)
find_package_wrapper(SndFile)
@@ -373,7 +393,7 @@ if(WITH_OPENCOLORIO)
endif()
if(WITH_CYCLES_EMBREE)
find_package(Embree 3.8.0 REQUIRED)
find_package(Embree 3.2.4 REQUIRED)
endif()
if(WITH_OPENIMAGEDENOISE)
@@ -428,21 +448,6 @@ if(WITH_TBB)
find_package_wrapper(TBB)
endif()
if(WITH_XR_OPENXR)
find_package(XR-OpenXR-SDK)
if(NOT XR_OPENXR_SDK_FOUND)
message(WARNING "OpenXR-SDK not found, disabling WITH_XR_OPENXR")
set(WITH_XR_OPENXR OFF)
endif()
endif()
if(EXISTS ${LIBDIR})
without_system_libs_end()
endif()
# ----------------------------------------------------------------------------
# Build and Link Flags
# OpenSuse needs lutil, ArchLinux not, for now keep, can avoid by using --as-needed
if(HAIKU)
list(APPEND PLATFORM_LINKLIBS -lnetwork)
@@ -475,36 +480,6 @@ add_definitions(-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE
#
# Keep last, so indirectly linked libraries don't override our own pre-compiled libs.
if(WITH_LZO AND WITH_SYSTEM_LZO)
find_package_wrapper(LZO)
if(NOT LZO_FOUND)
message(FATAL_ERROR "Failed finding system LZO version!")
endif()
endif()
if(WITH_SYSTEM_EIGEN3)
find_package_wrapper(Eigen3)
if(NOT EIGEN3_FOUND)
message(FATAL_ERROR "Failed finding system Eigen3 version!")
endif()
endif()
# Jack is intended to use the system library.
if(WITH_JACK)
find_package_wrapper(Jack)
if(NOT JACK_FOUND)
set(WITH_JACK OFF)
endif()
endif()
# Audio IO
if(WITH_SYSTEM_AUDASPACE)
find_package_wrapper(Audaspace)
if(NOT AUDASPACE_FOUND OR NOT AUDASPACE_C_FOUND)
message(FATAL_ERROR "Audaspace external library not found!")
endif()
endif()
if(WITH_X11)
find_package(X11 REQUIRED)

View File

@@ -144,14 +144,6 @@ else()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /nologo /J /Gd /MP /bigobj")
endif()
# C++ standards conformace (/permissive-) is available on msvc 15.5 (1912) and up
if(MSVC_VERSION GREATER 1911 AND NOT MSVC_CLANG)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /permissive-")
# Two-phase name lookup does not place nicely with OpenMP yet, so disable for now
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Zc:twoPhase-")
endif()
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MDd /ZI")
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /MDd /ZI")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MD")
@@ -504,7 +496,7 @@ if(WITH_OPENVDB)
set(OPENVDB_LIBPATH ${OPENVDB}/lib)
set(OPENVDB_INCLUDE_DIRS ${OPENVDB}/include)
set(OPENVDB_LIBRARIES optimized ${OPENVDB_LIBPATH}/openvdb.lib debug ${OPENVDB_LIBPATH}/openvdb_d.lib ${BLOSC_LIBRARIES})
set(OPENVDB_DEFINITIONS -DNOMINMAX -DOPENVDB_STATICLIB -D_USE_MATH_DEFINES)
set(OPENVDB_DEFINITIONS -DNOMINMAX)
endif()
if(WITH_OPENIMAGEDENOISE)
@@ -607,7 +599,7 @@ endif()
if(WITH_CYCLES_OSL)
set(CYCLES_OSL ${LIBDIR}/osl CACHE PATH "Path to OpenShadingLanguage installation")
set(OSL_SHADER_DIR ${CYCLES_OSL}/shaders)
find_library(OSL_LIB_EXEC NAMES oslexec PATHS ${CYCLES_OSL}/lib)
find_library(OSL_LIB_COMP NAMES oslcomp PATHS ${CYCLES_OSL}/lib)
find_library(OSL_LIB_QUERY NAMES oslquery PATHS ${CYCLES_OSL}/lib)
@@ -671,8 +663,8 @@ if(WITH_USD)
set(USD_DEBUG_LIB ${LIBDIR}/usd/lib/libusd_m_d.lib)
set(USD_LIBRARY_DIR ${LIBDIR}/usd/lib/usd)
set(USD_LIBRARIES
debug ${USD_DEBUG_LIB}
optimized ${USD_RELEASE_LIB}
debug ${USD_DEBUG_LIB}
optimized ${USD_RELEASE_LIB}
)
endif()
endif()
@@ -713,15 +705,3 @@ if(WINDOWS_PYTHON_DEBUG)
</Project>")
endif()
endif()
if(WITH_XR_OPENXR)
if(EXISTS ${LIBDIR}/xr_openxr_sdk)
set(XR_OPENXR_SDK ${LIBDIR}/xr_openxr_sdk)
set(XR_OPENXR_SDK_LIBPATH ${LIBDIR}/xr_openxr_sdk/lib)
set(XR_OPENXR_SDK_INCLUDE_DIR ${XR_OPENXR_SDK}/include)
set(XR_OPENXR_SDK_LIBRARIES optimized ${XR_OPENXR_SDK_LIBPATH}/openxr_loader.lib debug ${XR_OPENXR_SDK_LIBPATH}/openxr_loader_d.lib)
else()
message(WARNING "OpenXR-SDK was not found, disabling WITH_XR_OPENXR")
set(WITH_XR_OPENXR OFF)
endif()
endif()

View File

@@ -34,9 +34,6 @@ if "%VS_InstallDir%"=="" (
set VCVARS=%VS_InstallDir%\VC\Auxiliary\Build\vcvarsall.bat
if exist "%VCVARS%" (
if NOT "%verbose%" == "" (
echo calling "%VCVARS%" %BUILD_ARCH%
)
call "%VCVARS%" %BUILD_ARCH%
) else (
if NOT "%verbose%" == "" (
@@ -46,9 +43,6 @@ if exist "%VCVARS%" (
)
rem try msbuild
if NOT "%verbose%" == "" (
echo Testing for MSBuild
)
msbuild /version > NUL
if errorlevel 1 (
if NOT "%verbose%" == "" (
@@ -62,9 +56,6 @@ if NOT "%verbose%" == "" (
)
REM try the c++ compiler
if NOT "%verbose%" == "" (
echo Testing for the C/C++ Compiler
)
cl 2> NUL 1>&2
if errorlevel 1 (
if NOT "%verbose%" == "" (

View File

@@ -23,7 +23,7 @@ echo - with_tests ^(enable building unit tests^)
echo - nobuildinfo ^(disable buildinfo^)
echo - debug ^(Build an unoptimized debuggable build^)
echo - packagename [newname] ^(override default cpack package name^)
echo - builddir [newdir] ^(override default build folder^)
echo - buildir [newdir] ^(override default build folder^)
echo - 2017 ^(build with visual studio 2017^)
echo - 2017pre ^(build with visual studio 2017 pre-release^)
echo - 2017b ^(build with visual studio 2017 Build Tools^)

View File

@@ -1,44 +0,0 @@
"""
The message bus system can be used to receive notifications when properties of
Blender datablocks are changed via the data API.
Limitations
-----------
The message bus system is triggered by updates via the RNA system. This means
that the following updates will result in a notification on the message bus:
- Changes via the Python API, for example ``some_object.location.x += 3``.
- Changes via the sliders, fields, and buttons in the user interface.
The following updates do **not** trigger message bus notifications:
- Moving objects in the 3D Viewport.
- Changes performed by the animation system.
Example Use
-----------
Below is an example of subscription to changes in the active object's location.
"""
import bpy
# Any Python object can act as the subscription's owner.
owner = object()
subscribe_to = bpy.context.object.location
def msgbus_callback(*args):
# This will print:
# Something changed! (1, 2, 3)
print("Something changed!", args)
bpy.msgbus.subscribe_rna(
key=subscribe_to,
owner=owner,
args=(1, 2, 3),
notify=msgbus_callback,
)

View File

@@ -1,6 +0,0 @@
"""
Some properties are converted to Python objects when you retrieve them. This
needs to be avoided in order to create the subscription, by using
``datablock.path_resolve("property_name", False)``:
"""
subscribe_to = bpy.context.object.path_resolve("name", False)

View File

@@ -1,5 +0,0 @@
"""
It is also possible to create subscriptions on a property of all instances of a
certain type:
"""
subscribe_to = (bpy.types.Object, "location")

View File

@@ -6,7 +6,7 @@ bl_info = {
"location": "SpaceBar Search -> Add-on Preferences Example",
"description": "Example Add-on",
"warning": "",
"doc_url": "",
"wiki_url": "",
"tracker_url": "",
"category": "Object",
}

View File

@@ -22,7 +22,7 @@ offers a set of extensive examples, including advanced features.
.. note::
You can use the :class:`Image` type to load and set textures.
See :class:`Image.gl_load` and :class:`Image.gl_free`,
See :class:`Image.gl_load` and :class:`Image.gl_load`,
for example.

View File

@@ -255,9 +255,9 @@ Examples:
>>> bpy.ops.object.scale_apply()
{'FINISHED'}
.. tip::
.. note::
The :ref:`Operator Cheat Sheet <blender_manual:bpy.ops.wm.operator_cheat_sheet>`.
The menu item: :menuselection:`Help --> Operator Cheat Sheet`
gives a list of all operators and their default values in Python syntax, along with the generated docs.
This is a good way to get an overview of all Blender's operators.

View File

@@ -223,7 +223,6 @@ else:
"aud",
"bgl",
"blf",
"imbuf",
"bmesh",
"bmesh.ops",
"bmesh.types",
@@ -1756,7 +1755,6 @@ def write_rst_contents(basepath):
app_modules = (
"bpy.context", # note: not actually a module
"bpy.data", # note: not actually a module
"bpy.msgbus", # note: not actually a module
"bpy.ops",
"bpy.types",
@@ -1781,7 +1779,7 @@ def write_rst_contents(basepath):
standalone_modules = (
# submodules are added in parent page
"mathutils", "freestyle", "bgl", "blf", "imbuf", "gpu", "gpu_extras",
"mathutils", "freestyle", "bgl", "blf", "gpu", "gpu_extras",
"aud", "bpy_extras", "idprop.types", "bmesh",
)
@@ -1847,29 +1845,6 @@ def write_rst_ops_index(basepath):
file.close()
def write_rst_msgbus(basepath):
"""
Write the rst files of bpy.msgbus module
"""
if 'bpy.msgbus' in EXCLUDE_MODULES:
return
# Write the index.
filepath = os.path.join(basepath, "bpy.msgbus.rst")
file = open(filepath, "w", encoding="utf-8")
fw = file.write
fw(title_string("Message Bus (bpy.msgbus)", "="))
write_example_ref("", fw, "bpy.msgbus")
fw(".. toctree::\n")
fw(" :glob:\n\n")
fw(" bpy.msgbus.*\n\n")
file.close()
# Write the contents.
pymodule2sphinx(basepath, 'bpy.msgbus', bpy.msgbus, 'Message Bus')
EXAMPLE_SET_USED.add("bpy.msgbus")
def write_rst_data(basepath):
'''
Write the rst file of bpy.data module
@@ -1911,7 +1886,6 @@ def write_rst_importable_modules(basepath):
# C_modules
"aud": "Audio System",
"blf": "Font Drawing",
"imbuf": "Image Buffer",
"gpu": "GPU Shader Module",
"gpu.types": "GPU Types",
"gpu.matrix": "GPU Matrix",
@@ -2024,7 +1998,6 @@ def rna2sphinx(basepath):
write_rst_bpy(basepath) # bpy, disabled by default
write_rst_types_index(basepath) # bpy.types
write_rst_ops_index(basepath) # bpy.ops
write_rst_msgbus(basepath) # bpy.msgbus
pyrna2sphinx(basepath) # bpy.types.* and bpy.ops.*
write_rst_data(basepath) # bpy.data
write_rst_importable_modules(basepath)

View File

@@ -37,10 +37,10 @@ class ISynchronizer;
/**
* @interface IDevice
* The IDevice interface represents an output device for sound sources.
* Output devices may be several backends such as platform independand like
* SDL or OpenAL or platform specific like ALSA, but they may also be
* Output devices may be several backends such as plattform independand like
* SDL or OpenAL or plattform specific like ALSA, but they may also be
* files, RAM buffers or other types of streams.
* \warning Thread safety must be insured so that no reader is being called
* \warning Thread safety must be insured so that no reader is beeing called
* twice at the same time.
*/
class IDevice : public ILockable

View File

@@ -35,8 +35,6 @@ AUD_NAMESPACE_BEGIN
class AUD_API IDeviceFactory
{
public:
virtual ~IDeviceFactory() {}
/**
* Opens an audio device for playback.
* \exception Exception Thrown if the audio device cannot be opened.

View File

@@ -40,8 +40,6 @@ class Buffer;
class AUD_API IFileInput
{
public:
virtual ~IFileInput() {};
/**
* Creates a reader for a file to be read.
* \param filename Path to the file to be read.

View File

@@ -171,7 +171,7 @@ bool DynamicMusic::pause()
bool DynamicMusic::seek(float position)
{
bool result = false;
bool result;
if(m_currentHandle != nullptr)
{

View File

@@ -415,11 +415,4 @@ if(CMAKE_COMPILER_IS_GNUCXX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fpermissive")
endif()
if(MSVC)
# bullet is responsible for quite a few silly warnings
# suppress all of them. Not great, but they really needed
# to sort that out themselves.
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W0")
endif()
blender_add_lib(extern_bullet "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")

View File

@@ -683,23 +683,23 @@ static int cuewNvrtcInit(void) {
int cuewInit(cuuint32_t flags) {
int result = CUEW_SUCCESS;
int result = CUEW_SUCCESS;
if (flags & CUEW_INIT_CUDA) {
result = cuewCudaInit();
if (result != CUEW_SUCCESS) {
return result;
}
}
if (flags & CUEW_INIT_CUDA) {
result = cuewCudaInit();
if (result != CUEW_SUCCESS) {
return result;
}
}
if (flags & CUEW_INIT_NVRTC) {
result = cuewNvrtcInit();
if (result != CUEW_SUCCESS) {
return result;
}
}
if (flags & CUEW_INIT_NVRTC) {
result = cuewNvrtcInit();
if (result != CUEW_SUCCESS) {
return result;
}
}
return result;
return result;
}
@@ -798,10 +798,7 @@ static int path_exists(const char *path) {
const char *cuewCompilerPath(void) {
#ifdef _WIN32
const char *defaultpaths[] = {
"C:/CUDA/bin",
"C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v10.1/bin",
NULL};
const char *defaultpaths[] = {"C:/CUDA/bin", NULL};
const char *executable = "nvcc.exe";
#else
const char *defaultpaths[] = {
@@ -835,12 +832,9 @@ const char *cuewCompilerPath(void) {
}
}
#ifndef _WIN32
{
#ifdef _WIN32
FILE *handle = popen("where nvcc", "r");
#else
FILE *handle = popen("which nvcc", "r");
#endif
if (handle) {
char buffer[4096] = {0};
int len = fread(buffer, 1, sizeof(buffer) - 1, handle);
@@ -851,6 +845,7 @@ const char *cuewCompilerPath(void) {
}
}
}
#endif
return NULL;
}
@@ -864,6 +859,23 @@ int cuewNvrtcVersion(void) {
return 0;
}
static size_t safe_strnlen(const char *s, size_t maxlen) {
size_t length;
for (length = 0; length < maxlen; s++, length++) {
if (*s == '\0') {
break;
}
}
return length;
}
static char *safe_strncpy(char *dest, const char *src, size_t n) {
const size_t src_len = safe_strnlen(src, n - 1);
memcpy(dest, src, src_len);
dest[src_len] = '\0';
return dest;
}
int cuewCompilerVersion(void) {
const char *path = cuewCompilerPath();
const char *marker = "Cuda compilation tools, release ";
@@ -879,9 +891,8 @@ int cuewCompilerVersion(void) {
}
/* get --version output */
strncat(command, "\"", 1);
strncat(command, path, sizeof(command) - 1);
strncat(command, "\" --version", sizeof(command) - strlen(path) - 1);
safe_strncpy(command, path, sizeof(command));
strncat(command, " --version", sizeof(command) - strlen(path));
pipe = popen(command, "r");
if (!pipe) {
fprintf(stderr, "CUDA: failed to run compiler to retrieve version");
@@ -911,3 +922,4 @@ int cuewCompilerVersion(void) {
return 10 * major + minor;
}

View File

@@ -24,21 +24,6 @@ set(CMAKE_CXX_STANDARD 14)
add_subdirectory(dracoenc)
# Build blender-draco-exporter module.
set(SRC
src/draco-compressor.cpp
src/draco-compressor.h
)
set(INC
dracoenc/src
)
set(LIB
dracoenc
)
add_library(extern_draco SHARED "${SRC}")
target_include_directories(extern_draco PUBLIC "${INC}")
target_link_libraries(extern_draco PUBLIC "${LIB}")
blender_source_group(extern_draco "${SRC}")
add_library(extern_draco SHARED src/draco-compressor.cpp src/draco-compressor.h)
target_include_directories(extern_draco PUBLIC dracoenc/src)
target_link_libraries(extern_draco PUBLIC dracoenc)

View File

@@ -77,11 +77,6 @@ if(WIN32)
list(APPEND INC
src/windows
)
if(MSVC)
# Suppress warning about google::LogMessageFatal::~LogMessageFatal
# not returning.
add_definitions("/wd4722")
endif()
else()
list(APPEND INC
include

View File

@@ -54,10 +54,6 @@ if(WITH_OPENVDB)
add_definitions(-DOPENVDB_STATICLIB)
endif()
if(WIN32)
add_definitions(-D_USE_MATH_DEFINES)
endif()
set(INC
${MANTA_PP}
${MANTA_PP}/fileio
@@ -84,11 +80,22 @@ endif()
if(WITH_OPENVDB)
list(APPEND INC_SYS
${BOOST_INCLUDE_DIR}
${OPENEXR_INCLUDE_DIRS}
${OPENVDB_INCLUDE_DIRS}
)
list(APPEND LIB
${OPENVDB_LIBRARIES}
${OPENEXR_LIBRARIES}
${ZLIB_LIBRARIES}
${BOOST_LIBRARIES}
)
if(WITH_OPENVDB_BLOSC)
list(APPEND LIB
${BLOSC_LIBRARIES}
${ZLIB_LIBRARIES}
)
endif()
endif()
set(SRC
@@ -106,7 +113,6 @@ set(SRC
${MANTA_PP}/fastmarch.cpp
${MANTA_PP}/fastmarch.h
${MANTA_PP}/fastmarch.h.reg.cpp
${MANTA_PP}/fileio/ioutil.cpp
${MANTA_PP}/fileio/iogrids.cpp
${MANTA_PP}/fileio/iomeshes.cpp
${MANTA_PP}/fileio/ioparticles.cpp

View File

@@ -47,17 +47,17 @@ if [[ "$CLEAN_REPOSITORY" -eq "1" ]]; then
git checkout develop
fi
MANTA_BUILD_PATH=$MANTA_INSTALLATION/build_blender/
MANTA_BUILD_PATH=$MANTA_INSTALLATION/mantaflowgit/build_blender/
mkdir -p $MANTA_BUILD_PATH
cd $MANTA_BUILD_PATH
cmake ../mantaflowgit -DGUI=OFF -DOPENMP=$USE_OMP -DTBB=$USE_TBB -DBLENDER=ON -DPREPDEBUG=ON && make -j8
cmake .. -DGUI=OFF -DOPENMP=$USE_OMP -DTBB=$USE_TBB -DBLENDER=ON -DPREPDEBUG=ON && make -j8
# ==================== 3) COPY MANTAFLOW FILES TO BLENDER ROOT ===========================
mkdir -p $BLENDER_INSTALLATION/blender/tmp/dependencies/ && cp -Rf $MANTA_INSTALLATION/mantaflowgit/dependencies/cnpy "$_"
mkdir -p $BLENDER_INSTALLATION/blender/tmp/helper/ && cp -Rf $MANTA_INSTALLATION/mantaflowgit/source/util "$_"
mkdir -p $BLENDER_INSTALLATION/blender/tmp/helper/ && cp -Rf $MANTA_INSTALLATION/mantaflowgit/source/pwrapper "$_"
mkdir -p $BLENDER_INSTALLATION/blender/tmp/preprocessed/ && cp -Rf $MANTA_INSTALLATION/build_blender/pp/source/. "$_"
mkdir -p $BLENDER_INSTALLATION/blender/tmp/preprocessed/ && cp -Rf $MANTA_INSTALLATION/mantaflowgit/build_blender/pp/source/. "$_"
# Remove some files that are not need in Blender
rm $BLENDER_INSTALLATION/blender/tmp/dependencies/cnpy/example1.cpp

View File

@@ -192,7 +192,7 @@ int cbDisableConstructor(PyObject *self, PyObject *args, PyObject *kwds)
return -1;
}
PyMODINIT_FUNC PyInit_manta_main(void)
PyMODINIT_FUNC PyInit_Main(void)
{
MantaEnsureRegistration();
#if PY_MAJOR_VERSION >= 3
@@ -567,7 +567,7 @@ void WrapperRegistry::construct(const string &scriptname, const vector<string> &
registerDummyTypes();
// work around for certain gcc versions, cast to char*
PyImport_AppendInittab((char *)gDefaultModuleName.c_str(), PyInit_manta_main);
PyImport_AppendInittab((char *)gDefaultModuleName.c_str(), PyInit_Main);
}
inline PyObject *castPy(PyTypeObject *p)

View File

@@ -62,7 +62,7 @@ void MantaEnsureRegistration();
#ifdef BLENDER
# ifdef PyMODINIT_FUNC
PyMODINIT_FUNC PyInit_manta_main(void);
PyMODINIT_FUNC PyInit_Main(void);
# endif
#endif

View File

@@ -17,13 +17,16 @@
// link to omp & tbb for now
#if OPENMP == 1 || TBB == 1
# define MANTA_ENABLE_PARALLEL 1
# define MANTA_ENABLE_PARALLEL 0
// allow the preconditioner to be computed in parallel? (can lead to slightly non-deterministic
// results)
# define MANTA_ENABLE_PARALLEL_PC 0
// use c++11 code?
# define MANTA_USE_CPP11 1
#else
# define MANTA_ENABLE_PARALLEL 0
# define MANTA_ENABLE_PARALLEL_PC 0
# define MANTA_USE_CPP11 0
#endif
#if MANTA_ENABLE_PARALLEL == 1
@@ -500,7 +503,11 @@ template<class N, class T> struct RCMatrix {
for (Iterator it = row_begin(i); it; ++it)
result.fix_element(it.index(), i, it.value());
}
#if MANTA_USE_CPP11 == 1
return std::move(result);
#else
return result;
#endif
}
RCMatrix getKtK() const
@@ -525,7 +532,12 @@ template<class N, class T> struct RCMatrix {
}
}
}
parallel_end return result;
parallel_end
#if MANTA_USE_CPP11 == 1
return std::move(result);
#else
return result;
#endif
}
RCMatrix operator*(const RCMatrix &m) const
@@ -549,7 +561,12 @@ template<class N, class T> struct RCMatrix {
}
}
}
parallel_end return result;
parallel_end
#if MANTA_USE_CPP11 == 1
return std::move(result);
#else
return result;
#endif
}
RCMatrix sqrt() const
@@ -564,7 +581,12 @@ template<class N, class T> struct RCMatrix {
result.set_element(i, j, std::sqrt(it_A.value()));
}
}
parallel_end return result;
parallel_end
#if MANTA_USE_CPP11 == 1
return std::move(result);
#else
return result;
#endif
}
RCMatrix operator*(const double k) const
@@ -579,7 +601,12 @@ template<class N, class T> struct RCMatrix {
result.add_to_element(i, j, it_A.value() * k);
}
}
parallel_end return result;
parallel_end
#if MANTA_USE_CPP11 == 1
return std::move(result);
#else
return result;
#endif
}
RCMatrix applyKernel(const RCMatrix &kernel, const int nx, const int ny) const
@@ -613,7 +640,12 @@ template<class N, class T> struct RCMatrix {
}
}
}
parallel_end return result;
parallel_end
#if MANTA_USE_CPP11 == 1
return std::move(result);
#else
return result;
#endif
}
RCMatrix applyHorizontalKernel(const RCMatrix &kernel, const int nx, const int ny) const
@@ -647,7 +679,12 @@ template<class N, class T> struct RCMatrix {
}
}
}
parallel_end return result;
parallel_end
#if MANTA_USE_CPP11 == 1
return std::move(result);
#else
return result;
#endif
}
RCMatrix applyVerticalKernel(const RCMatrix &kernel, const int nx, const int ny) const
@@ -681,7 +718,12 @@ template<class N, class T> struct RCMatrix {
}
}
}
parallel_end return result;
parallel_end
#if MANTA_USE_CPP11 == 1
return std::move(result);
#else
return result;
#endif
}
RCMatrix applySeparableKernel(const RCMatrix &kernelH,
@@ -705,7 +747,11 @@ template<class N, class T> struct RCMatrix {
{
std::vector<T> result(n, 0.0);
multiply(rhs, result);
#if MANTA_USE_CPP11 == 1
return std::move(result);
#else
return result;
#endif
}
void multiply(const std::vector<T> &rhs, std::vector<T> &result) const
{
@@ -786,7 +832,11 @@ template<class N, class T> struct RCMatrix {
for (N i = 0; i < result.size(); i++) {
result[i] = std::abs(result[i] - rhs[i]);
}
#if MANTA_USE_CPP11 == 1
return std::move(result);
#else
return result;
#endif
}
T norm() const
{
@@ -974,7 +1024,11 @@ template<class N, class T> struct RCFixedMatrix {
{
std::vector<T> result(n, 0.0);
multiply(rhs, result);
#if MANTA_USE_CPP11 == 1
return std::move(result);
#else
return result;
#endif
}
void multiply(const std::vector<T> &rhs, std::vector<T> &result) const
{
@@ -1010,7 +1064,12 @@ template<class N, class T> struct RCFixedMatrix {
}
}
}
parallel_end return result;
parallel_end
#if MANTA_USE_CPP11 == 1
return std::move(result);
#else
return result;
#endif
}
RCMatrix<N, T> toRCMatrix() const
@@ -1028,7 +1087,12 @@ template<class N, class T> struct RCFixedMatrix {
result.matrix[i]->value[j] = value[rowstart[i] + j];
}
}
parallel_end return result;
parallel_end
#if MANTA_USE_CPP11 == 1
return std::move(result);
#else
return result;
#endif
}
};

View File

@@ -15,7 +15,7 @@
#define _VECTORBASE_H
// get rid of windos min/max defines
#if (defined(WIN32) || defined(_WIN32)) && !defined(NOMINMAX)
#if defined(WIN32) || defined(_WIN32)
# define NOMINMAX
#endif

View File

@@ -298,7 +298,7 @@ template<class T> void writeGridRaw(const string &name, Grid<T> *grid)
debMsg("writing grid " << grid->getName() << " to raw file " << name, 1);
#if NO_ZLIB != 1
gzFile gzf = (gzFile)safeGzopen(name.c_str(), "wb1"); // do some compression
gzFile gzf = gzopen(name.c_str(), "wb1"); // do some compression
if (!gzf)
errMsg("writeGridRaw: can't open file " << name);
gzwrite(gzf, &((*grid)[0]), sizeof(T) * grid->getSizeX() * grid->getSizeY() * grid->getSizeZ());
@@ -313,7 +313,7 @@ template<class T> void readGridRaw(const string &name, Grid<T> *grid)
debMsg("reading grid " << grid->getName() << " from raw file " << name, 1);
#if NO_ZLIB != 1
gzFile gzf = (gzFile)safeGzopen(name.c_str(), "rb");
gzFile gzf = gzopen(name.c_str(), "rb");
if (!gzf)
errMsg("readGridRaw: can't open file " << name);
@@ -350,7 +350,7 @@ void getUniFileSize(const string &name, int &x, int &y, int &z, int *t, std::str
{
x = y = z = 0;
#if NO_ZLIB != 1
gzFile gzf = (gzFile)safeGzopen(name.c_str(), "rb");
gzFile gzf = gzopen(name.c_str(), "rb");
if (gzf) {
char ID[5] = {0, 0, 0, 0, 0};
gzread(gzf, ID, 4);
@@ -499,7 +499,7 @@ template<class T> void writeGridUni(const string &name, Grid<T> *grid)
else
errMsg("writeGridUni: unknown element type");
gzFile gzf = (gzFile)safeGzopen(name.c_str(), "wb1"); // do some compression
gzFile gzf = gzopen(name.c_str(), "wb1"); // do some compression
if (!gzf)
errMsg("writeGridUni: can't open file " << name);
@@ -527,7 +527,7 @@ template<class T> void readGridUni(const string &name, Grid<T> *grid)
debMsg("Reading grid " << grid->getName() << " from uni file " << name, 1);
#if NO_ZLIB != 1
gzFile gzf = (gzFile)safeGzopen(name.c_str(), "rb");
gzFile gzf = gzopen(name.c_str(), "rb");
if (!gzf)
errMsg("readGridUni: can't open file " << name);
@@ -736,7 +736,7 @@ template<class T> void writeGrid4dUni(const string &name, Grid4d<T> *grid)
else
errMsg("writeGrid4dUni: unknown element type");
gzFile gzf = (gzFile)safeGzopen(name.c_str(), "wb1"); // do some compression
gzFile gzf = gzopen(name.c_str(), "wb1"); // do some compression
if (!gzf)
errMsg("writeGrid4dUni: can't open file " << name);
@@ -778,7 +778,7 @@ void readGrid4dUni(
// optionally - reuse file handle, if valid one is passed in fileHandle pointer...
if ((!fileHandle) || (fileHandle && (*fileHandle == NULL))) {
gzf = (gzFile)safeGzopen(name.c_str(), "rb");
gzf = gzopen(name.c_str(), "rb");
if (!gzf)
errMsg("readGrid4dUni: can't open file " << name);
@@ -905,7 +905,7 @@ template<class T> void writeGrid4dRaw(const string &name, Grid4d<T> *grid)
debMsg("writing grid4d " << grid->getName() << " to raw file " << name, 1);
#if NO_ZLIB != 1
gzFile gzf = (gzFile)safeGzopen(name.c_str(), "wb1"); // do some compression
gzFile gzf = gzopen(name.c_str(), "wb1"); // do some compression
if (!gzf)
errMsg("writeGrid4dRaw: can't open file " << name);
gzwrite(gzf,
@@ -922,7 +922,7 @@ template<class T> void readGrid4dRaw(const string &name, Grid4d<T> *grid)
debMsg("reading grid4d " << grid->getName() << " from raw file " << name, 1);
#if NO_ZLIB != 1
gzFile gzf = (gzFile)safeGzopen(name.c_str(), "rb");
gzFile gzf = gzopen(name.c_str(), "rb");
if (!gzf)
errMsg("readGrid4dRaw: can't open file " << name);

View File

@@ -158,7 +158,7 @@ void readBobjFile(const string &name, Mesh *mesh, bool append)
const Real dx = mesh->getParent()->getDx();
const Vec3 gs = toVec3(mesh->getParent()->getGridSize());
gzFile gzf = (gzFile)safeGzopen(name.c_str(), "rb1"); // do some compression
gzFile gzf = gzopen(name.c_str(), "rb1"); // do some compression
if (!gzf)
errMsg("readBobj: unable to open file");
@@ -213,7 +213,7 @@ void writeBobjFile(const string &name, Mesh *mesh)
const Real dx = mesh->getParent()->getDx();
const Vec3i gs = mesh->getParent()->getGridSize();
gzFile gzf = (gzFile)safeGzopen(name.c_str(), "wb1"); // do some compression
gzFile gzf = gzopen(name.c_str(), "wb1"); // do some compression
if (!gzf)
errMsg("writeBobj: unable to open file");
@@ -412,7 +412,7 @@ template<class T> void readMdataUni(const std::string &name, MeshDataImpl<T> *md
debMsg("reading mesh data " << mdata->getName() << " from uni file " << name, 1);
#if NO_ZLIB != 1
gzFile gzf = (gzFile)safeGzopen(name.c_str(), "rb");
gzFile gzf = gzopen(name.c_str(), "rb");
if (!gzf)
errMsg("can't open file " << name);
@@ -460,7 +460,7 @@ template<class T> void writeMdataUni(const std::string &name, MeshDataImpl<T> *m
MuTime stamp;
head.timestamp = stamp.time;
gzFile gzf = (gzFile)safeGzopen(name.c_str(), "wb1"); // do some compression
gzFile gzf = gzopen(name.c_str(), "wb1"); // do some compression
if (!gzf)
errMsg("can't open file " << name);
gzwrite(gzf, ID, 4);

View File

@@ -176,7 +176,7 @@ void writeParticlesUni(const std::string &name, const BasicParticleSystem *parts
MuTime stamp;
head.timestamp = stamp.time;
gzFile gzf = (gzFile)safeGzopen(name.c_str(), "wb1"); // do some compression
gzFile gzf = gzopen(name.c_str(), "wb1"); // do some compression
if (!gzf)
errMsg("can't open file " << name);
@@ -206,7 +206,7 @@ void readParticlesUni(const std::string &name, BasicParticleSystem *parts)
debMsg("reading particles " << parts->getName() << " from uni file " << name, 1);
#if NO_ZLIB != 1
gzFile gzf = (gzFile)safeGzopen(name.c_str(), "rb");
gzFile gzf = gzopen(name.c_str(), "rb");
if (!gzf)
errMsg("can't open file " << name);
@@ -273,7 +273,7 @@ template<class T> void writePdataUni(const std::string &name, ParticleDataImpl<T
MuTime stamp;
head.timestamp = stamp.time;
gzFile gzf = (gzFile)safeGzopen(name.c_str(), "wb1"); // do some compression
gzFile gzf = gzopen(name.c_str(), "wb1"); // do some compression
if (!gzf)
errMsg("can't open file " << name);
gzwrite(gzf, ID, 4);
@@ -299,7 +299,7 @@ template<class T> void readPdataUni(const std::string &name, ParticleDataImpl<T>
debMsg("reading particle data " << pdata->getName() << " from uni file " << name, 1);
#if NO_ZLIB != 1
gzFile gzf = (gzFile)safeGzopen(name.c_str(), "rb");
gzFile gzf = gzopen(name.c_str(), "rb");
if (!gzf)
errMsg("can't open file " << name);

View File

@@ -1,60 +0,0 @@
// DO NOT EDIT !
// This file is generated using the MantaFlow preprocessor (prep generate).
/******************************************************************************
*
* MantaFlow fluid solver framework
* Copyright 2011-2020 Tobias Pfaff, Nils Thuerey
*
* This program is free software, distributed under the terms of the
* Apache License, Version 2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Helper functions to handle file IO
*
******************************************************************************/
#include "mantaio.h"
#if NO_ZLIB != 1
extern "C" {
# include <zlib.h>
}
# if defined(WIN32) || defined(_WIN32)
# include <windows.h>
# include <string>
# endif
using namespace std;
namespace Manta {
# if defined(WIN32) || defined(_WIN32)
static wstring stringToWstring(const char *str)
{
const int length_wc = MultiByteToWideChar(CP_UTF8, 0, str, strlen(str), NULL, 0);
wstring strWide(length_wc, 0);
MultiByteToWideChar(CP_UTF8, 0, str, strlen(str), &strWide[0], length_wc);
return strWide;
}
# endif
void *safeGzopen(const char *filename, const char *mode)
{
gzFile gzfile;
# if defined(WIN32) || defined(_WIN32)
wstring filenameWide = stringToWstring(filename);
gzfile = gzopen_w(filenameWide.c_str(), mode);
# else
gzfile = gzopen(filename, mode);
# endif
return gzfile;
}
#endif
} // namespace

View File

@@ -76,8 +76,6 @@ template<class T> void readMdataUni(const std::string &name, MeshDataImpl<T> *md
void getUniFileSize(
const std::string &name, int &x, int &y, int &z, int *t = NULL, std::string *info = NULL);
void *safeGzopen(const char *filename, const char *mode);
} // namespace Manta
#endif

View File

@@ -1,3 +1,3 @@
#define MANTA_GIT_VERSION "commit 5fbd3d04381b21afce4a593d1fe2d9bc7bef5424"
#define MANTA_GIT_VERSION "commit abfff159b5ea8cee93d858f4b8be2a308b58b51d"

View File

@@ -1244,67 +1244,15 @@ void PbRegister_gridMaxDiffVec3()
}
}
struct knCopyMacToVec3 : public KernelBase {
knCopyMacToVec3(MACGrid &source, Grid<Vec3> &target)
: KernelBase(&source, 0), source(source), target(target)
{
runMessage();
run();
}
inline void op(int i, int j, int k, MACGrid &source, Grid<Vec3> &target) const
{
target(i, j, k) = source(i, j, k);
}
inline MACGrid &getArg0()
{
return source;
}
typedef MACGrid type0;
inline Grid<Vec3> &getArg1()
{
return target;
}
typedef Grid<Vec3> type1;
void runMessage()
{
debMsg("Executing kernel knCopyMacToVec3 ", 3);
debMsg("Kernel range"
<< " x " << maxX << " y " << maxY << " z " << minZ << " - " << maxZ << " ",
4);
};
void operator()(const tbb::blocked_range<IndexInt> &__r) const
{
const int _maxX = maxX;
const int _maxY = maxY;
if (maxZ > 1) {
for (int k = __r.begin(); k != (int)__r.end(); k++)
for (int j = 0; j < _maxY; j++)
for (int i = 0; i < _maxX; i++)
op(i, j, k, source, target);
}
else {
const int k = 0;
for (int j = __r.begin(); j != (int)__r.end(); j++)
for (int i = 0; i < _maxX; i++)
op(i, j, k, source, target);
}
}
void run()
{
if (maxZ > 1)
tbb::parallel_for(tbb::blocked_range<IndexInt>(minZ, maxZ), *this);
else
tbb::parallel_for(tbb::blocked_range<IndexInt>(0, maxY), *this);
}
MACGrid &source;
Grid<Vec3> &target;
};
// simple helper functions to copy (convert) mac to vec3 , and levelset to real grids
// (are assumed to be the same for running the test cases - in general they're not!)
void copyMacToVec3(MACGrid &source, Grid<Vec3> &target)
{
knCopyMacToVec3(source, target);
FOR_IJK(target)
{
target(i, j, k) = source(i, j, k);
}
}
static PyObject *_W_3(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
{
@@ -1375,14 +1323,10 @@ void PbRegister_convertMacToVec3()
}
}
struct knResampleVec3ToMac : public KernelBase {
knResampleVec3ToMac(Grid<Vec3> &source, MACGrid &target)
: KernelBase(&source, 1), source(source), target(target)
{
runMessage();
run();
}
inline void op(int i, int j, int k, Grid<Vec3> &source, MACGrid &target) const
//! vec3->mac grid conversion , but with full resampling
void resampleVec3ToMac(Grid<Vec3> &source, MACGrid &target)
{
FOR_IJK_BND(target, 1)
{
target(i, j, k)[0] = 0.5 * (source(i - 1, j, k)[0] + source(i, j, k))[0];
target(i, j, k)[1] = 0.5 * (source(i, j - 1, k)[1] + source(i, j, k))[1];
@@ -1390,55 +1334,6 @@ struct knResampleVec3ToMac : public KernelBase {
target(i, j, k)[2] = 0.5 * (source(i, j, k - 1)[2] + source(i, j, k))[2];
}
}
inline Grid<Vec3> &getArg0()
{
return source;
}
typedef Grid<Vec3> type0;
inline MACGrid &getArg1()
{
return target;
}
typedef MACGrid type1;
void runMessage()
{
debMsg("Executing kernel knResampleVec3ToMac ", 3);
debMsg("Kernel range"
<< " x " << maxX << " y " << maxY << " z " << minZ << " - " << maxZ << " ",
4);
};
void operator()(const tbb::blocked_range<IndexInt> &__r) const
{
const int _maxX = maxX;
const int _maxY = maxY;
if (maxZ > 1) {
for (int k = __r.begin(); k != (int)__r.end(); k++)
for (int j = 1; j < _maxY; j++)
for (int i = 1; i < _maxX; i++)
op(i, j, k, source, target);
}
else {
const int k = 0;
for (int j = __r.begin(); j != (int)__r.end(); j++)
for (int i = 1; i < _maxX; i++)
op(i, j, k, source, target);
}
}
void run()
{
if (maxZ > 1)
tbb::parallel_for(tbb::blocked_range<IndexInt>(minZ, maxZ), *this);
else
tbb::parallel_for(tbb::blocked_range<IndexInt>(1, maxY), *this);
}
Grid<Vec3> &source;
MACGrid &target;
};
//! vec3->mac grid conversion , but with full resampling
void resampleVec3ToMac(Grid<Vec3> &source, MACGrid &target)
{
knResampleVec3ToMac(source, target);
}
static PyObject *_W_5(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
{
@@ -1472,66 +1367,13 @@ void PbRegister_resampleVec3ToMac()
}
}
struct knResampleMacToVec3 : public KernelBase {
knResampleMacToVec3(MACGrid &source, Grid<Vec3> &target)
: KernelBase(&source, 1), source(source), target(target)
{
runMessage();
run();
}
inline void op(int i, int j, int k, MACGrid &source, Grid<Vec3> &target) const
//! mac->vec3 grid conversion , with full resampling
void resampleMacToVec3(MACGrid &source, Grid<Vec3> &target)
{
FOR_IJK_BND(target, 1)
{
target(i, j, k) = source.getCentered(i, j, k);
}
inline MACGrid &getArg0()
{
return source;
}
typedef MACGrid type0;
inline Grid<Vec3> &getArg1()
{
return target;
}
typedef Grid<Vec3> type1;
void runMessage()
{
debMsg("Executing kernel knResampleMacToVec3 ", 3);
debMsg("Kernel range"
<< " x " << maxX << " y " << maxY << " z " << minZ << " - " << maxZ << " ",
4);
};
void operator()(const tbb::blocked_range<IndexInt> &__r) const
{
const int _maxX = maxX;
const int _maxY = maxY;
if (maxZ > 1) {
for (int k = __r.begin(); k != (int)__r.end(); k++)
for (int j = 1; j < _maxY; j++)
for (int i = 1; i < _maxX; i++)
op(i, j, k, source, target);
}
else {
const int k = 0;
for (int j = __r.begin(); j != (int)__r.end(); j++)
for (int i = 1; i < _maxX; i++)
op(i, j, k, source, target);
}
}
void run()
{
if (maxZ > 1)
tbb::parallel_for(tbb::blocked_range<IndexInt>(minZ, maxZ), *this);
else
tbb::parallel_for(tbb::blocked_range<IndexInt>(1, maxY), *this);
}
MACGrid &source;
Grid<Vec3> &target;
};
//! mac->vec3 grid conversion , with full resampling
void resampleMacToVec3(MACGrid &source, Grid<Vec3> &target)
{
knResampleMacToVec3(source, target);
}
static PyObject *_W_6(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
{
@@ -1565,65 +1407,12 @@ void PbRegister_resampleMacToVec3()
}
}
struct knCopyLevelsetToReal : public KernelBase {
knCopyLevelsetToReal(LevelsetGrid &source, Grid<Real> &target)
: KernelBase(&source, 0), source(source), target(target)
{
runMessage();
run();
}
inline void op(int i, int j, int k, LevelsetGrid &source, Grid<Real> &target) const
void copyLevelsetToReal(LevelsetGrid &source, Grid<Real> &target)
{
FOR_IJK(target)
{
target(i, j, k) = source(i, j, k);
}
inline LevelsetGrid &getArg0()
{
return source;
}
typedef LevelsetGrid type0;
inline Grid<Real> &getArg1()
{
return target;
}
typedef Grid<Real> type1;
void runMessage()
{
debMsg("Executing kernel knCopyLevelsetToReal ", 3);
debMsg("Kernel range"
<< " x " << maxX << " y " << maxY << " z " << minZ << " - " << maxZ << " ",
4);
};
void operator()(const tbb::blocked_range<IndexInt> &__r) const
{
const int _maxX = maxX;
const int _maxY = maxY;
if (maxZ > 1) {
for (int k = __r.begin(); k != (int)__r.end(); k++)
for (int j = 0; j < _maxY; j++)
for (int i = 0; i < _maxX; i++)
op(i, j, k, source, target);
}
else {
const int k = 0;
for (int j = __r.begin(); j != (int)__r.end(); j++)
for (int i = 0; i < _maxX; i++)
op(i, j, k, source, target);
}
}
void run()
{
if (maxZ > 1)
tbb::parallel_for(tbb::blocked_range<IndexInt>(minZ, maxZ), *this);
else
tbb::parallel_for(tbb::blocked_range<IndexInt>(0, maxY), *this);
}
LevelsetGrid &source;
Grid<Real> &target;
};
void copyLevelsetToReal(LevelsetGrid &source, Grid<Real> &target)
{
knCopyLevelsetToReal(source, target);
}
static PyObject *_W_7(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
{
@@ -1657,95 +1446,17 @@ void PbRegister_copyLevelsetToReal()
}
}
struct knCopyVec3ToReal : public KernelBase {
knCopyVec3ToReal(Grid<Vec3> &source,
Grid<Real> &targetX,
Grid<Real> &targetY,
Grid<Real> &targetZ)
: KernelBase(&source, 0),
source(source),
targetX(targetX),
targetY(targetY),
targetZ(targetZ)
{
runMessage();
run();
}
inline void op(int i,
int j,
int k,
Grid<Vec3> &source,
Grid<Real> &targetX,
Grid<Real> &targetY,
Grid<Real> &targetZ) const
{
targetX(i, j, k) = source(i, j, k).x;
targetY(i, j, k) = source(i, j, k).y;
targetZ(i, j, k) = source(i, j, k).z;
}
inline Grid<Vec3> &getArg0()
{
return source;
}
typedef Grid<Vec3> type0;
inline Grid<Real> &getArg1()
{
return targetX;
}
typedef Grid<Real> type1;
inline Grid<Real> &getArg2()
{
return targetY;
}
typedef Grid<Real> type2;
inline Grid<Real> &getArg3()
{
return targetZ;
}
typedef Grid<Real> type3;
void runMessage()
{
debMsg("Executing kernel knCopyVec3ToReal ", 3);
debMsg("Kernel range"
<< " x " << maxX << " y " << maxY << " z " << minZ << " - " << maxZ << " ",
4);
};
void operator()(const tbb::blocked_range<IndexInt> &__r) const
{
const int _maxX = maxX;
const int _maxY = maxY;
if (maxZ > 1) {
for (int k = __r.begin(); k != (int)__r.end(); k++)
for (int j = 0; j < _maxY; j++)
for (int i = 0; i < _maxX; i++)
op(i, j, k, source, targetX, targetY, targetZ);
}
else {
const int k = 0;
for (int j = __r.begin(); j != (int)__r.end(); j++)
for (int i = 0; i < _maxX; i++)
op(i, j, k, source, targetX, targetY, targetZ);
}
}
void run()
{
if (maxZ > 1)
tbb::parallel_for(tbb::blocked_range<IndexInt>(minZ, maxZ), *this);
else
tbb::parallel_for(tbb::blocked_range<IndexInt>(0, maxY), *this);
}
Grid<Vec3> &source;
Grid<Real> &targetX;
Grid<Real> &targetY;
Grid<Real> &targetZ;
};
void copyVec3ToReal(Grid<Vec3> &source,
Grid<Real> &targetX,
Grid<Real> &targetY,
Grid<Real> &targetZ)
{
knCopyVec3ToReal(source, targetX, targetY, targetZ);
FOR_IJK(source)
{
targetX(i, j, k) = source(i, j, k).x;
targetY(i, j, k) = source(i, j, k).y;
targetZ(i, j, k) = source(i, j, k).z;
}
}
static PyObject *_W_8(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
{
@@ -1781,95 +1492,17 @@ void PbRegister_copyVec3ToReal()
}
}
struct knCopyRealToVec3 : public KernelBase {
knCopyRealToVec3(Grid<Real> &sourceX,
Grid<Real> &sourceY,
Grid<Real> &sourceZ,
Grid<Vec3> &target)
: KernelBase(&sourceX, 0),
sourceX(sourceX),
sourceY(sourceY),
sourceZ(sourceZ),
target(target)
{
runMessage();
run();
}
inline void op(int i,
int j,
int k,
Grid<Real> &sourceX,
Grid<Real> &sourceY,
Grid<Real> &sourceZ,
Grid<Vec3> &target) const
{
target(i, j, k).x = sourceX(i, j, k);
target(i, j, k).y = sourceY(i, j, k);
target(i, j, k).z = sourceZ(i, j, k);
}
inline Grid<Real> &getArg0()
{
return sourceX;
}
typedef Grid<Real> type0;
inline Grid<Real> &getArg1()
{
return sourceY;
}
typedef Grid<Real> type1;
inline Grid<Real> &getArg2()
{
return sourceZ;
}
typedef Grid<Real> type2;
inline Grid<Vec3> &getArg3()
{
return target;
}
typedef Grid<Vec3> type3;
void runMessage()
{
debMsg("Executing kernel knCopyRealToVec3 ", 3);
debMsg("Kernel range"
<< " x " << maxX << " y " << maxY << " z " << minZ << " - " << maxZ << " ",
4);
};
void operator()(const tbb::blocked_range<IndexInt> &__r) const
{
const int _maxX = maxX;
const int _maxY = maxY;
if (maxZ > 1) {
for (int k = __r.begin(); k != (int)__r.end(); k++)
for (int j = 0; j < _maxY; j++)
for (int i = 0; i < _maxX; i++)
op(i, j, k, sourceX, sourceY, sourceZ, target);
}
else {
const int k = 0;
for (int j = __r.begin(); j != (int)__r.end(); j++)
for (int i = 0; i < _maxX; i++)
op(i, j, k, sourceX, sourceY, sourceZ, target);
}
}
void run()
{
if (maxZ > 1)
tbb::parallel_for(tbb::blocked_range<IndexInt>(minZ, maxZ), *this);
else
tbb::parallel_for(tbb::blocked_range<IndexInt>(0, maxY), *this);
}
Grid<Real> &sourceX;
Grid<Real> &sourceY;
Grid<Real> &sourceZ;
Grid<Vec3> &target;
};
void copyRealToVec3(Grid<Real> &sourceX,
Grid<Real> &sourceY,
Grid<Real> &sourceZ,
Grid<Vec3> &target)
{
knCopyRealToVec3(sourceX, sourceY, sourceZ, target);
FOR_IJK(target)
{
target(i, j, k).x = sourceX(i, j, k);
target(i, j, k).y = sourceY(i, j, k);
target(i, j, k).z = sourceZ(i, j, k);
}
}
static PyObject *_W_9(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
{

View File

@@ -773,9 +773,9 @@ void LevelsetGrid::createMesh(Mesh &mesh)
Grid<int> edgeVY(mParent);
Grid<int> edgeVZ(mParent);
for (int k = 0; k < mSize.z - 1; k++)
for (int i = 0; i < mSize.x - 1; i++)
for (int j = 0; j < mSize.y - 1; j++)
for (int i = 0; i < mSize.x - 1; i++) {
for (int k = 0; k < mSize.z - 1; k++) {
Real value[8] = {get(i, j, k),
get(i + 1, j, k),
get(i + 1, j + 1, k),

View File

@@ -182,7 +182,7 @@ void BasicParticleSystem::writeParticlesText(const string name) const
void BasicParticleSystem::writeParticlesRawPositionsGz(const string name) const
{
#if NO_ZLIB != 1
gzFile gzf = (gzFile)safeGzopen(name.c_str(), "wb1");
gzFile gzf = gzopen(name.c_str(), "wb1");
if (!gzf)
errMsg("can't open file " << name);
for (IndexInt i = 0; i < this->size(); ++i) {
@@ -198,7 +198,7 @@ void BasicParticleSystem::writeParticlesRawPositionsGz(const string name) const
void BasicParticleSystem::writeParticlesRawVelocityGz(const string name) const
{
#if NO_ZLIB != 1
gzFile gzf = (gzFile)safeGzopen(name.c_str(), "wb1");
gzFile gzf = gzopen(name.c_str(), "wb1");
if (!gzf)
errMsg("can't open file " << name);
if (mPdataVec3.size() < 1)

View File

@@ -1335,7 +1335,7 @@ struct KnConfForce : public KernelBase {
void vorticityConfinement(MACGrid &vel,
const FlagGrid &flags,
Real strength = 0,
Real strengthGlobal = 0,
const Grid<Real> *strengthCell = NULL)
{
Grid<Vec3> velCenter(flags.getParent()), curl(flags.getParent()), force(flags.getParent());
@@ -1344,7 +1344,7 @@ void vorticityConfinement(MACGrid &vel,
GetCentered(velCenter, vel);
CurlOp(velCenter, curl);
GridNorm(norm, curl);
KnConfForce(force, norm, curl, strength, strengthCell);
KnConfForce(force, norm, curl, strengthGlobal, strengthCell);
KnApplyForceField(flags, vel, force, NULL, true, false);
}
static PyObject *_W_8(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
@@ -1359,11 +1359,11 @@ static PyObject *_W_8(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
ArgLocker _lock;
MACGrid &vel = *_args.getPtr<MACGrid>("vel", 0, &_lock);
const FlagGrid &flags = *_args.getPtr<FlagGrid>("flags", 1, &_lock);
Real strength = _args.getOpt<Real>("strength", 2, 0, &_lock);
Real strengthGlobal = _args.getOpt<Real>("strengthGlobal", 2, 0, &_lock);
const Grid<Real> *strengthCell = _args.getPtrOpt<Grid<Real>>(
"strengthCell", 3, NULL, &_lock);
_retval = getPyNone();
vorticityConfinement(vel, flags, strength, strengthCell);
vorticityConfinement(vel, flags, strengthGlobal, strengthCell);
_args.check();
}
pbFinalizePlugin(parent, "vorticityConfinement", !noTiming);

View File

@@ -18,7 +18,6 @@
******************************************************************************/
#include "particle.h"
#include "general.h"
#include "grid.h"
#include "commonkernels.h"
#include "randomstream.h"
@@ -1430,9 +1429,9 @@ struct correctLevelset : public KernelBase {
Real t = (t_high - maxEV) / (t_high - t_low);
correction = t * t * t - 3 * t * t + 3 * t;
}
correction = clamp(correction,
Real(0),
Real(1)); // enforce correction factor to [0,1] (not explicitly in paper)
correction = (correction < 0) ?
0 :
correction; // enforce correction factor to [0,1] (not explicitly in paper)
const Vec3 gridPos = Vec3(i, j, k) + Vec3(0.5); // shifted by half cell
const Real correctedPhi = fabs(norm(gridPos - pAcc(i, j, k))) - rAcc(i, j, k) * correction;

View File

@@ -1829,15 +1829,13 @@ struct KnUpdateFlagsObs : public KernelBase {
const MACGrid *fractions,
const Grid<Real> &phiObs,
const Grid<Real> *phiOut,
const Grid<Real> *phiIn,
int boundaryWidth)
: KernelBase(&flags, boundaryWidth),
const Grid<Real> *phiIn)
: KernelBase(&flags, 1),
flags(flags),
fractions(fractions),
phiObs(phiObs),
phiOut(phiOut),
phiIn(phiIn),
boundaryWidth(boundaryWidth)
phiIn(phiIn)
{
runMessage();
run();
@@ -1849,8 +1847,7 @@ struct KnUpdateFlagsObs : public KernelBase {
const MACGrid *fractions,
const Grid<Real> &phiObs,
const Grid<Real> *phiOut,
const Grid<Real> *phiIn,
int boundaryWidth) const
const Grid<Real> *phiIn) const
{
bool isObs = false;
@@ -1913,11 +1910,6 @@ struct KnUpdateFlagsObs : public KernelBase {
return phiIn;
}
typedef Grid<Real> type4;
inline int &getArg5()
{
return boundaryWidth;
}
typedef int type5;
void runMessage()
{
debMsg("Executing kernel KnUpdateFlagsObs ", 3);
@@ -1931,15 +1923,15 @@ struct KnUpdateFlagsObs : public KernelBase {
const int _maxY = maxY;
if (maxZ > 1) {
for (int k = __r.begin(); k != (int)__r.end(); k++)
for (int j = boundaryWidth; j < _maxY; j++)
for (int i = boundaryWidth; i < _maxX; i++)
op(i, j, k, flags, fractions, phiObs, phiOut, phiIn, boundaryWidth);
for (int j = 1; j < _maxY; j++)
for (int i = 1; i < _maxX; i++)
op(i, j, k, flags, fractions, phiObs, phiOut, phiIn);
}
else {
const int k = 0;
for (int j = __r.begin(); j != (int)__r.end(); j++)
for (int i = boundaryWidth; i < _maxX; i++)
op(i, j, k, flags, fractions, phiObs, phiOut, phiIn, boundaryWidth);
for (int i = 1; i < _maxX; i++)
op(i, j, k, flags, fractions, phiObs, phiOut, phiIn);
}
}
void run()
@@ -1947,14 +1939,13 @@ struct KnUpdateFlagsObs : public KernelBase {
if (maxZ > 1)
tbb::parallel_for(tbb::blocked_range<IndexInt>(minZ, maxZ), *this);
else
tbb::parallel_for(tbb::blocked_range<IndexInt>(boundaryWidth, maxY), *this);
tbb::parallel_for(tbb::blocked_range<IndexInt>(1, maxY), *this);
}
FlagGrid &flags;
const MACGrid *fractions;
const Grid<Real> &phiObs;
const Grid<Real> *phiOut;
const Grid<Real> *phiIn;
int boundaryWidth;
};
//! update obstacle and outflow flags from levelsets
@@ -1963,10 +1954,9 @@ void setObstacleFlags(FlagGrid &flags,
const Grid<Real> &phiObs,
const MACGrid *fractions = NULL,
const Grid<Real> *phiOut = NULL,
const Grid<Real> *phiIn = NULL,
int boundaryWidth = 1)
const Grid<Real> *phiIn = NULL)
{
KnUpdateFlagsObs(flags, fractions, phiObs, phiOut, phiIn, boundaryWidth);
KnUpdateFlagsObs(flags, fractions, phiObs, phiOut, phiIn);
}
static PyObject *_W_18(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
{
@@ -1983,9 +1973,8 @@ static PyObject *_W_18(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
const MACGrid *fractions = _args.getPtrOpt<MACGrid>("fractions", 2, NULL, &_lock);
const Grid<Real> *phiOut = _args.getPtrOpt<Grid<Real>>("phiOut", 3, NULL, &_lock);
const Grid<Real> *phiIn = _args.getPtrOpt<Grid<Real>>("phiIn", 4, NULL, &_lock);
int boundaryWidth = _args.getOpt<int>("boundaryWidth", 5, 1, &_lock);
_retval = getPyNone();
setObstacleFlags(flags, phiObs, fractions, phiOut, phiIn, boundaryWidth);
setObstacleFlags(flags, phiObs, fractions, phiOut, phiIn);
_args.check();
}
pbFinalizePlugin(parent, "setObstacleFlags", !noTiming);

View File

@@ -1171,11 +1171,6 @@ void solvePressureSystem(Grid<Real> &rhs,
maxIter = 100;
pmg = gMapMG[parent];
// Release MG from previous step if present (e.g. if previous solve was with MGStatic)
if (pmg && preconditioner == PcMGDynamic) {
releaseMG(parent);
pmg = nullptr;
}
if (!pmg) {
pmg = new GridMg(pressure.getSize());
gMapMG[parent] = pmg;

View File

@@ -76,7 +76,3 @@ endif()
if(WITH_QUADRIFLOW)
add_subdirectory(quadriflow)
endif()
if(UNIX AND NOT APPLE)
add_subdirectory(libc_compat)
endif()

View File

@@ -37,8 +37,8 @@
#endif
#define WIN32_LEAN_AND_MEAN
#include <intrin.h>
#include <windows.h>
#include <intrin.h>
#if defined(__clang__)
# pragma GCC diagnostic push

View File

@@ -47,10 +47,10 @@
#ifndef __ATOMIC_OPS_UTILS_H__
#define __ATOMIC_OPS_UTILS_H__
#include <limits.h>
#include <stddef.h>
#include <stdint.h>
#include <stddef.h>
#include <stdlib.h>
#include <limits.h>
#include <assert.h>

View File

@@ -25,8 +25,8 @@
#include "AUD_PyInit.h"
#include <AUD_Sound.h>
#include <python/PyAPI.h>
#include <python/PySound.h>
#include <python/PyAPI.h>
extern "C" {
extern void *BKE_sound_get_factory(void *sound);

View File

@@ -18,23 +18,23 @@
* \ingroup clog
*/
#include <assert.h>
#include <stdarg.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
#include <assert.h>
/* Disable for small single threaded programs
* to avoid having to link with pthreads. */
#ifdef WITH_CLOG_PTHREADS
# include "atomic_ops.h"
# include <pthread.h>
# include "atomic_ops.h"
#endif
/* For 'isatty' to check for color. */
#if defined(__unix__) || defined(__APPLE__) || defined(__HAIKU__)
# include <sys/time.h>
# include <unistd.h>
# include <sys/time.h>
#endif
#if defined(_MSC_VER)

View File

@@ -177,11 +177,14 @@ if(CXX_HAS_AVX2)
add_definitions(-DWITH_KERNEL_AVX2)
endif()
# LLVM and OSL need to build without RTTI
if(WIN32 AND MSVC)
set(RTTI_DISABLE_FLAGS "/GR- -DBOOST_NO_RTTI -DBOOST_NO_TYPEID")
elseif(CMAKE_COMPILER_IS_GNUCC OR (CMAKE_C_COMPILER_ID MATCHES "Clang"))
set(RTTI_DISABLE_FLAGS "-fno-rtti -DBOOST_NO_RTTI -DBOOST_NO_TYPEID")
if(WITH_CYCLES_OSL)
# LLVM and OSL need to build without RTTI
if(WIN32 AND MSVC)
set(RTTI_DISABLE_FLAGS "/GR- -DBOOST_NO_RTTI -DBOOST_NO_TYPEID")
elseif(CMAKE_COMPILER_IS_GNUCC OR (CMAKE_C_COMPILER_ID MATCHES "Clang"))
set(RTTI_DISABLE_FLAGS "-fno-rtti -DBOOST_NO_RTTI -DBOOST_NO_TYPEID")
endif()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${RTTI_DISABLE_FLAGS}")
endif()
# Definitions and Includes
@@ -225,8 +228,11 @@ if(WITH_CYCLES_DEVICE_OPTIX)
SYSTEM
${OPTIX_INCLUDE_DIR}
)
# Need pre-compiled CUDA binaries in the OptiX device
set(WITH_CYCLES_CUDA_BINARIES ON)
else()
message(STATUS "OptiX not found, disabling it from Cycles")
message(STATUS "Optix not found, disabling it from Cycles")
set(WITH_CYCLES_DEVICE_OPTIX OFF)
endif()
endif()
@@ -350,6 +356,17 @@ if(WITH_CYCLES_NETWORK)
add_definitions(-DWITH_NETWORK)
endif()
if(WITH_OPENCOLORIO)
add_definitions(-DWITH_OCIO)
include_directories(
SYSTEM
${OPENCOLORIO_INCLUDE_DIRS}
)
if(WIN32)
add_definitions(-DOpenColorIO_STATIC)
endif()
endif()
if(WITH_CYCLES_STANDALONE OR WITH_CYCLES_NETWORK OR WITH_CYCLES_CUBIN_COMPILER)
add_subdirectory(app)
endif()

View File

@@ -51,17 +51,14 @@ endif()
# Common configuration.
link_directories(
${OPENIMAGEIO_LIBPATH}
${BOOST_LIBPATH}
${PNG_LIBPATH}
${JPEG_LIBPATH}
${ZLIB_LIBPATH}
${TIFF_LIBPATH}
${OPENEXR_LIBPATH}
${OPENJPEG_LIBPATH}
${OPENVDB_LIBPATH}
)
link_directories(${OPENIMAGEIO_LIBPATH}
${BOOST_LIBPATH}
${PNG_LIBPATH}
${JPEG_LIBPATH}
${ZLIB_LIBPATH}
${TIFF_LIBPATH}
${OPENEXR_LIBPATH}
${OPENJPEG_LIBPATH})
if(WITH_OPENCOLORIO)
link_directories(${OPENCOLORIO_LIBPATH})

View File

@@ -14,8 +14,8 @@
* limitations under the License.
*/
#include <stdint.h>
#include <stdio.h>
#include <stdint.h>
#include <string>
#include <vector>

View File

@@ -20,11 +20,11 @@
#include "util/util_args.h"
#include "util/util_foreach.h"
#include "util/util_logging.h"
#include "util/util_path.h"
#include "util/util_stats.h"
#include "util/util_string.h"
#include "util/util_task.h"
#include "util/util_logging.h"
using namespace ccl;

View File

@@ -16,12 +16,12 @@
#include <stdio.h>
#include "device/device.h"
#include "render/buffers.h"
#include "render/camera.h"
#include "render/integrator.h"
#include "device/device.h"
#include "render/scene.h"
#include "render/session.h"
#include "render/integrator.h"
#include "util/util_args.h"
#include "util/util_foreach.h"

View File

@@ -16,9 +16,9 @@
#include <stdio.h>
#include <sstream>
#include <algorithm>
#include <iterator>
#include <sstream>
#include "graph/node_xml.h"
@@ -32,8 +32,8 @@
#include "render/nodes.h"
#include "render/object.h"
#include "render/osl.h"
#include "render/scene.h"
#include "render/shader.h"
#include "render/scene.h"
#include "subd/subd_patch.h"
#include "subd/subd_split.h"
@@ -292,7 +292,7 @@ static void xml_read_shader_graph(XMLReadState &state, Shader *shader, xml_node
filepath = path_join(state.base, filepath);
}
snode = OSLShaderManager::osl_node(manager, filepath);
snode = ((OSLShaderManager *)manager)->osl_node(filepath);
if (!snode) {
fprintf(stderr, "Failed to create OSL node from \"%s\".\n", filepath.c_str());

View File

@@ -38,7 +38,6 @@ set(SRC
CCL_api.h
blender_device.h
blender_id_map.h
blender_image.h
blender_object_cull.h
blender_sync.h
blender_session.h
@@ -92,20 +91,6 @@ if(WITH_MOD_FLUID)
add_definitions(-DWITH_FLUID)
endif()
if(WITH_NEW_OBJECT_TYPES)
add_definitions(-DWITH_NEW_OBJECT_TYPES)
endif()
if(WITH_OPENVDB)
add_definitions(-DWITH_OPENVDB ${OPENVDB_DEFINITIONS})
list(APPEND INC_SYS
${OPENVDB_INCLUDE_DIRS}
)
list(APPEND LIB
${OPENVDB_LIBRARIES}
)
endif()
blender_add_lib(bf_intern_cycles "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
# avoid link failure with clang 3.4 debug

View File

@@ -22,7 +22,7 @@ bl_info = {
"blender": (2, 80, 0),
"description": "Cycles renderer integration",
"warning": "",
"doc_url": "https://docs.blender.org/manual/en/latest/render/cycles/",
"wiki_url": "https://docs.blender.org/manual/en/latest/render/cycles/",
"tracker_url": "",
"support": 'OFFICIAL',
"category": "Render"}

View File

@@ -33,7 +33,7 @@ def _is_using_buggy_driver():
# in the version string, but those cards do not quite work and
# causing crashes.
return True
regex = re.compile(".*Compatibility Profile Context ([0-9]+(\\.[0-9]+)+)$")
regex = re.compile(".*Compatibility Profile Context ([0-9]+(\.[0-9]+)+)$")
if not regex.match(version):
# Skip cards like FireGL
return False
@@ -245,6 +245,9 @@ def list_render_passes(srl):
if srl.use_pass_transmission_direct: yield ("TransDir", "RGB", 'COLOR')
if srl.use_pass_transmission_indirect: yield ("TransInd", "RGB", 'COLOR')
if srl.use_pass_transmission_color: yield ("TransCol", "RGB", 'COLOR')
if srl.use_pass_subsurface_direct: yield ("SubsurfaceDir", "RGB", 'COLOR')
if srl.use_pass_subsurface_indirect: yield ("SubsurfaceInd", "RGB", 'COLOR')
if srl.use_pass_subsurface_color: yield ("SubsurfaceCol", "RGB", 'COLOR')
if srl.use_pass_emit: yield ("Emit", "RGB", 'COLOR')
if srl.use_pass_environment: yield ("Env", "RGB", 'COLOR')
@@ -255,7 +258,6 @@ def list_render_passes(srl):
if crl.pass_debug_bvh_traversed_instances: yield ("Debug BVH Traversed Instances", "X", 'VALUE')
if crl.pass_debug_bvh_intersections: yield ("Debug BVH Intersections", "X", 'VALUE')
if crl.pass_debug_ray_bounces: yield ("Debug Ray Bounces", "X", 'VALUE')
if crl.pass_debug_sample_count: yield ("Debug Sample Count", "X", 'VALUE')
if crl.use_pass_volume_direct: yield ("VolumeDir", "RGB", 'COLOR')
if crl.use_pass_volume_indirect: yield ("VolumeInd", "RGB", 'COLOR')
@@ -282,7 +284,8 @@ def list_render_passes(srl):
yield ("Denoising Intensity", "X", 'VALUE')
clean_options = ("denoising_diffuse_direct", "denoising_diffuse_indirect",
"denoising_glossy_direct", "denoising_glossy_indirect",
"denoising_transmission_direct", "denoising_transmission_indirect")
"denoising_transmission_direct", "denoising_transmission_indirect",
"denoising_subsurface_direct", "denoising_subsurface_indirect")
if any(getattr(crl, option) for option in clean_options):
yield ("Denoising Clean", "RGB", 'COLOR')

View File

@@ -153,12 +153,12 @@ class CYCLES_OT_denoise_animation(Operator):
self.report({'ERROR'}, str(e))
return {'FINISHED'}
self.report({'INFO'}, "Denoising completed")
self.report({'INFO'}, "Denoising completed.")
return {'FINISHED'}
class CYCLES_OT_merge_images(Operator):
"Combine OpenEXR multilayer images rendered with different sample " \
"Combine OpenEXR multilayer images rendered with different sample" \
"ranges into one image with reduced noise"
bl_idname = "cycles.merge_images"
bl_label = "Merge Images"

View File

@@ -112,7 +112,6 @@ enum_use_layer_samples = (
enum_sampling_pattern = (
('SOBOL', "Sobol", "Use Sobol random sampling pattern"),
('CORRELATED_MUTI_JITTER', "Correlated Multi-Jitter", "Use Correlated Multi-Jitter random sampling pattern"),
('PROGRESSIVE_MUTI_JITTER', "Progressive Multi-Jitter", "Use Progressive Multi-Jitter random sampling pattern"),
)
enum_integrator = (
@@ -179,6 +178,10 @@ enum_view3d_shading_render_pass= (
('TRANSMISSION_INDIRECT', "Transmission Indirect", "Show the Transmission Indirect render pass", 45),
('TRANSMISSION_COLOR', "Transmission Color", "Show the Transmission Color render pass", 46),
('SUBSURFACE_DIRECT', "Subsurface Direct", "Show the Subsurface Direct render pass", 47),
('SUBSURFACE_INDIRECT', "Subsurface Indirect", "Show the Subsurface Indirect render pass", 48),
('SUBSURFACE_COLOR', "Subsurface Color", "Show the Subsurface Color render pass", 49),
('VOLUME_DIRECT', "Volume Direct", "Show the Volume Direct render pass", 50),
('VOLUME_INDIRECT', "Volume Indirect", "Show the Volume Indirect render pass", 51),
@@ -194,12 +197,7 @@ enum_aov_types = (
('COLOR', "Color", "Write a Color pass", 1),
)
enum_viewport_denoising = (
('NONE', "None", "Disable viewport denoising", 0),
('OPTIX', "OptiX AI-Accelerated", "Use the OptiX denoiser running on the GPU (requires at least one compatible OptiX device)", 1),
)
enum_denoising_optix_input_passes = (
enum_denoising_optix_input_passes= (
('RGB', "Color", "Use only color as input", 1),
('RGB_ALBEDO', "Color + Albedo", "Use color and albedo data as input", 2),
('RGB_ALBEDO_NORMAL', "Color + Albedo + Normal", "Use color, albedo and normal data as input", 3),
@@ -231,18 +229,6 @@ class CyclesRenderSettings(bpy.types.PropertyGroup):
default='PATH',
)
preview_pause: BoolProperty(
name="Pause Preview",
description="Pause all viewport preview renders",
default=False,
)
preview_denoising: EnumProperty(
name="Viewport Denoising",
description="Denoise the image after each preview update with the selected denoiser engine",
items=enum_viewport_denoising,
default='NONE',
)
use_square_samples: BoolProperty(
name="Square Samples",
description="Square sampling values for easier artist control",
@@ -261,6 +247,11 @@ class CyclesRenderSettings(bpy.types.PropertyGroup):
min=0, max=(1 << 24),
default=32,
)
preview_pause: BoolProperty(
name="Pause Preview",
description="Pause all viewport preview renders",
default=False,
)
aa_samples: IntProperty(
name="AA Samples",
description="Number of antialiasing samples to render for each pixel",
@@ -273,7 +264,6 @@ class CyclesRenderSettings(bpy.types.PropertyGroup):
min=0, max=2097151,
default=32,
)
diffuse_samples: IntProperty(
name="Diffuse Samples",
description="Number of diffuse bounce samples to render for each AA sample",
@@ -304,12 +294,14 @@ class CyclesRenderSettings(bpy.types.PropertyGroup):
min=1, max=1024,
default=1,
)
subsurface_samples: IntProperty(
name="Subsurface Samples",
description="Number of subsurface scattering samples to render for each AA sample",
min=1, max=1024,
default=1,
)
volume_samples: IntProperty(
name="Volume Samples",
description="Number of volume scattering samples to render for each AA sample",
@@ -350,26 +342,6 @@ class CyclesRenderSettings(bpy.types.PropertyGroup):
default=0.01,
)
use_adaptive_sampling: BoolProperty(
name="Use Adaptive Sampling",
description="Automatically reduce the number of samples per pixel based on estimated noise level",
default=False,
)
adaptive_threshold: FloatProperty(
name="Adaptive Sampling Threshold",
description="Noise level step to stop sampling at, lower values reduce noise the cost of render time. Zero for automatic setting based on number of AA samples",
min=0.0, max=1.0,
default=0.0,
precision=4,
)
adaptive_min_samples: IntProperty(
name="Adaptive Min Samples",
description="Minimum AA samples for adaptive sampling, to discover noisy features before stopping sampling. Zero for automatic setting based on number of AA samples",
min=0, max=4096,
default=0,
)
min_light_bounces: IntProperty(
name="Min Light Bounces",
description="Minimum number of light bounces. Setting this higher reduces noise in the first bounces, "
@@ -444,20 +416,13 @@ class CyclesRenderSettings(bpy.types.PropertyGroup):
default=8,
)
volume_step_rate: FloatProperty(
name="Step Rate",
description="Globally adjust detail for volume rendering, on top of automatically estimated step size. "
"Higher values reduce render time, lower values render with more detail",
default=1.0,
min=0.01, max=100.0, soft_min=0.1, soft_max=10.0, precision=2
)
volume_preview_step_rate: FloatProperty(
name="Step Rate",
description="Globally adjust detail for volume rendering, on top of automatically estimated step size. "
"Higher values reduce render time, lower values render with more detail",
default=1.0,
min=0.01, max=100.0, soft_min=0.1, soft_max=10.0, precision=2
volume_step_size: FloatProperty(
name="Step Size",
description="Distance between volume shader samples when rendering the volume "
"(lower values give more accurate and detailed results, but also increased render time)",
default=0.1,
min=0.0000001, max=100000.0, soft_min=0.01, soft_max=1.0, precision=4,
unit='LENGTH'
)
volume_max_steps: IntProperty(
@@ -597,12 +562,6 @@ class CyclesRenderSettings(bpy.types.PropertyGroup):
default=64,
subtype='PIXEL'
)
preview_denoising_start_sample: IntProperty(
name="Start Denoising",
description="Sample to start denoising the preview at",
min=0, max=(1 << 24),
default=1,
)
debug_reset_timeout: FloatProperty(
name="Reset timeout",
@@ -682,6 +641,7 @@ class CyclesRenderSettings(bpy.types.PropertyGroup):
('DIFFUSE', "Diffuse", ""),
('GLOSSY', "Glossy", ""),
('TRANSMISSION', "Transmission", ""),
('SUBSURFACE', "Subsurface", ""),
),
)
@@ -941,14 +901,6 @@ class CyclesMaterialSettings(bpy.types.PropertyGroup):
default='LINEAR',
)
volume_step_rate: FloatProperty(
name="Step Rate",
description="Scale the distance between volume shader samples when rendering the volume "
"(lower values give more accurate and detailed results, but also increased render time)",
default=1.0,
min=0.001, max=1000.0, soft_min=0.1, soft_max=10.0, precision=4
)
displacement_method: EnumProperty(
name="Displacement Method",
description="Method to use for the displacement",
@@ -1059,13 +1011,6 @@ class CyclesWorldSettings(bpy.types.PropertyGroup):
items=enum_volume_interpolation,
default='LINEAR',
)
volume_step_size: FloatProperty(
name="Step Size",
description="Distance between volume shader samples when rendering the volume "
"(lower values give more accurate and detailed results, but also increased render time)",
default=1.0,
min=0.0000001, max=100000.0, soft_min=0.1, soft_max=100.0, precision=4
)
@classmethod
def register(cls):
@@ -1176,7 +1121,7 @@ class CyclesObjectSettings(bpy.types.PropertyGroup):
motion_steps: IntProperty(
name="Motion Steps",
description="Control accuracy of motion blur, more steps gives more memory usage (actual number of steps is 2^(steps - 1))",
min=1, max=7,
min=1, soft_max=8,
default=1,
)
@@ -1340,12 +1285,7 @@ class CyclesRenderLayerSettings(bpy.types.PropertyGroup):
default=False,
update=update_render_passes,
)
pass_debug_sample_count: BoolProperty(
name="Debug Sample Count",
description="Number of samples/camera rays per pixel",
default=False,
update=update_render_passes,
)
use_pass_volume_direct: BoolProperty(
name="Volume Direct",
description="Deliver direct volumetric scattering pass",
@@ -1365,6 +1305,12 @@ class CyclesRenderLayerSettings(bpy.types.PropertyGroup):
default=False,
update=update_render_passes,
)
use_optix_denoising: BoolProperty(
name="Use OptiX AI Denoising",
description="Denoise the rendered image with the OptiX AI denoiser",
default=False,
update=update_render_passes,
)
denoising_diffuse_direct: BoolProperty(
name="Diffuse Direct",
description="Denoise the direct diffuse lighting",
@@ -1395,6 +1341,16 @@ class CyclesRenderLayerSettings(bpy.types.PropertyGroup):
description="Denoise the indirect transmission lighting",
default=True,
)
denoising_subsurface_direct: BoolProperty(
name="Subsurface Direct",
description="Denoise the direct subsurface lighting",
default=True,
)
denoising_subsurface_indirect: BoolProperty(
name="Subsurface Indirect",
description="Denoise the indirect subsurface lighting",
default=True,
)
denoising_strength: FloatProperty(
name="Denoising Strength",
description="Controls neighbor pixel weighting for the denoising filter (lower values preserve more detail, but aren't as smooth)",
@@ -1431,18 +1387,11 @@ class CyclesRenderLayerSettings(bpy.types.PropertyGroup):
min=0, max=7,
default=0,
)
use_optix_denoising: BoolProperty(
name="OptiX AI-Accelerated",
description="Use the OptiX denoiser to denoise the rendered image",
default=False,
update=update_render_passes,
)
denoising_optix_input_passes: EnumProperty(
name="Input Passes",
description="Passes handed over to the OptiX denoiser (this can have different effects on the denoised image)",
description="Controls which passes the OptiX AI denoiser should use as input, which can have different effects on the denoised image",
items=enum_denoising_optix_input_passes,
default='RGB_ALBEDO',
default='RGB',
)
use_pass_crypto_object: BoolProperty(

View File

@@ -112,10 +112,6 @@ def show_device_active(context):
return True
return context.preferences.addons[__package__].preferences.has_active_device()
def show_optix_denoising(context):
# OptiX AI denoiser can be used when at least one device supports OptiX
return bool(context.preferences.addons[__package__].preferences.get_devices_for_type('OPTIX'))
def draw_samples_info(layout, context):
cscene = context.scene.cycles
@@ -181,23 +177,17 @@ class CYCLES_RENDER_PT_sampling(CyclesButtonsPanel, Panel):
if not use_optix(context):
layout.prop(cscene, "progressive")
if not use_branched_path(context):
if cscene.progressive == 'PATH' or use_branched_path(context) is False:
col = layout.column(align=True)
col.prop(cscene, "samples", text="Render")
col.prop(cscene, "preview_samples", text="Viewport")
draw_samples_info(layout, context)
else:
col = layout.column(align=True)
col.prop(cscene, "aa_samples", text="Render")
col.prop(cscene, "preview_aa_samples", text="Viewport")
# Viewport denoising is currently only supported with OptiX
if show_optix_denoising(context):
col = layout.column()
col.prop(cscene, "preview_denoising")
if not use_branched_path(context):
draw_samples_info(layout, context)
class CYCLES_RENDER_PT_sampling_sub_samples(CyclesButtonsPanel, Panel):
bl_label = "Sub Samples"
@@ -205,7 +195,9 @@ class CYCLES_RENDER_PT_sampling_sub_samples(CyclesButtonsPanel, Panel):
@classmethod
def poll(cls, context):
return use_branched_path(context)
scene = context.scene
cscene = scene.cycles
return cscene.progressive != 'PATH' and use_branched_path(context)
def draw(self, context):
layout = self.layout
@@ -230,32 +222,6 @@ class CYCLES_RENDER_PT_sampling_sub_samples(CyclesButtonsPanel, Panel):
draw_samples_info(layout, context)
class CYCLES_RENDER_PT_sampling_adaptive(CyclesButtonsPanel, Panel):
bl_label = "Adaptive Sampling"
bl_parent_id = "CYCLES_RENDER_PT_sampling"
bl_options = {'DEFAULT_CLOSED'}
def draw_header(self, context):
layout = self.layout
scene = context.scene
cscene = scene.cycles
layout.prop(cscene, "use_adaptive_sampling", text="")
def draw(self, context):
layout = self.layout
layout.use_property_split = True
layout.use_property_decorate = False
scene = context.scene
cscene = scene.cycles
layout.active = cscene.use_adaptive_sampling
col = layout.column(align=True)
col.prop(cscene, "adaptive_min_samples", text="Min Samples")
col.prop(cscene, "adaptive_threshold", text="Noise Threshold")
class CYCLES_RENDER_PT_sampling_advanced(CyclesButtonsPanel, Panel):
bl_label = "Advanced"
bl_parent_id = "CYCLES_RENDER_PT_sampling"
@@ -273,9 +239,7 @@ class CYCLES_RENDER_PT_sampling_advanced(CyclesButtonsPanel, Panel):
row.prop(cscene, "seed")
row.prop(cscene, "use_animated_seed", text="", icon='TIME')
col = layout.column(align=True)
col.active = not(cscene.use_adaptive_sampling)
col.prop(cscene, "sampling_pattern", text="Pattern")
layout.prop(cscene, "sampling_pattern", text="Pattern")
layout.prop(cscene, "use_square_samples")
@@ -373,7 +337,7 @@ class CYCLES_RENDER_PT_subdivision(CyclesButtonsPanel, Panel):
col = layout.column()
sub = col.column(align=True)
sub.prop(cscene, "dicing_rate", text="Dicing Rate Render")
sub.prop(cscene, "preview_dicing_rate", text="Viewport")
sub.prop(cscene, "preview_dicing_rate", text="Preview")
col.separator()
@@ -428,11 +392,9 @@ class CYCLES_RENDER_PT_volumes(CyclesButtonsPanel, Panel):
scene = context.scene
cscene = scene.cycles
col = layout.column(align=True)
col.prop(cscene, "volume_step_rate", text="Step Rate Render")
col.prop(cscene, "volume_preview_step_rate", text="Viewport")
layout.prop(cscene, "volume_max_steps", text="Max Steps")
col = layout.column()
col.prop(cscene, "volume_step_size", text="Step Size")
col.prop(cscene, "volume_max_steps", text="Max Steps")
class CYCLES_RENDER_PT_light_paths(CyclesButtonsPanel, Panel):
@@ -673,6 +635,9 @@ class CYCLES_RENDER_PT_performance_tiles(CyclesButtonsPanel, Panel):
sub = col.column()
sub.active = not rd.use_save_buffers
for view_layer in scene.view_layers:
if view_layer.cycles.use_denoising:
sub.active = False
sub.prop(cscene, "use_progressive_refine")
@@ -740,11 +705,6 @@ class CYCLES_RENDER_PT_performance_viewport(CyclesButtonsPanel, Panel):
col.prop(rd, "preview_pixel_size", text="Pixel Size")
col.prop(cscene, "preview_start_resolution", text="Start Pixels")
if show_optix_denoising(context):
sub = col.row(align=True)
sub.active = cscene.preview_denoising != 'NONE'
sub.prop(cscene, "preview_denoising_start_sample", text="Denoising Start Sample")
class CYCLES_RENDER_PT_filter(CyclesButtonsPanel, Panel):
bl_label = "Filter"
@@ -772,8 +732,6 @@ class CYCLES_RENDER_PT_filter(CyclesButtonsPanel, Panel):
col.prop(view_layer, "use_solid", text="Surfaces")
col = flow.column()
col.prop(view_layer, "use_strand", text="Hair")
col = flow.column()
col.prop(view_layer, "use_volumes", text="Volumes")
if with_freestyle:
col = flow.column()
col.prop(view_layer, "use_freestyle", text="Freestyle")
@@ -845,8 +803,6 @@ class CYCLES_RENDER_PT_passes_data(CyclesButtonsPanel, Panel):
col.prop(cycles_view_layer, "denoising_store_passes", text="Denoising Data")
col = flow.column()
col.prop(cycles_view_layer, "pass_debug_render_time", text="Render Time")
col = flow.column()
col.prop(cycles_view_layer, "pass_debug_sample_count", text="Sample Count")
layout.separator()
@@ -890,6 +846,14 @@ class CYCLES_RENDER_PT_passes_light(CyclesButtonsPanel, Panel):
row.prop(view_layer, "use_pass_transmission_indirect", text="Indirect", toggle=True)
row.prop(view_layer, "use_pass_transmission_color", text="Color", toggle=True)
split = layout.split(factor=0.35)
split.use_property_split = False
split.label(text="Subsurface")
row = split.row(align=True)
row.prop(view_layer, "use_pass_subsurface_direct", text="Direct", toggle=True)
row.prop(view_layer, "use_pass_subsurface_indirect", text="Indirect", toggle=True)
row.prop(view_layer, "use_pass_subsurface_color", text="Color", toggle=True)
split = layout.split(factor=0.35)
split.use_property_split = False
split.label(text="Volume")
@@ -1017,14 +981,15 @@ class CYCLES_RENDER_PT_denoising(CyclesButtonsPanel, Panel):
col = split.column(align=True)
if show_optix_denoising(context):
col.prop(cycles_view_layer, "use_optix_denoising")
col.separator(factor=2.0)
if use_optix(context):
col.prop(cycles_view_layer, "use_optix_denoising", text="OptiX AI Denoising")
if cycles_view_layer.use_optix_denoising:
col.prop(cycles_view_layer, "denoising_optix_input_passes")
return
col.separator(factor=2.0)
col.prop(cycles_view_layer, "denoising_radius", text="Radius")
col.prop(cycles_view_layer, "denoising_strength", slider=True, text="Strength")
col.prop(cycles_view_layer, "denoising_feature_strength", slider=True, text="Feature Strength")
@@ -1071,6 +1036,15 @@ class CYCLES_RENDER_PT_denoising(CyclesButtonsPanel, Panel):
split = layout.split(factor=0.5)
split.active = cycles_view_layer.use_denoising or cycles_view_layer.denoising_store_passes
col = split.column()
col.alignment = 'RIGHT'
col.label(text="Subsurface")
row = split.row(align=True)
row.use_property_split = False
row.prop(cycles_view_layer, "denoising_subsurface_direct", text="Direct", toggle=True)
row.prop(cycles_view_layer, "denoising_subsurface_indirect", text="Indirect", toggle=True)
class CYCLES_PT_post_processing(CyclesButtonsPanel, Panel):
bl_label = "Post Processing"
@@ -1417,6 +1391,8 @@ class CYCLES_LIGHT_PT_light(CyclesButtonsPanel, Panel):
light = context.light
clamp = light.cycles
layout.use_property_decorate = False
if self.bl_space_type == 'PROPERTIES':
layout.row().prop(light, "type", expand=True)
layout.use_property_split = True
@@ -1698,9 +1674,6 @@ class CYCLES_WORLD_PT_settings_volume(CyclesButtonsPanel, Panel):
sub.prop(cworld, "volume_sampling", text="Sampling")
col.prop(cworld, "volume_interpolation", text="Interpolation")
col.prop(cworld, "homogeneous_volume", text="Homogeneous")
sub = col.column()
sub.active = not cworld.homogeneous_volume
sub.prop(cworld, "volume_step_size")
class CYCLES_MATERIAL_PT_preview(CyclesButtonsPanel, Panel):
@@ -1832,9 +1805,6 @@ class CYCLES_MATERIAL_PT_settings_volume(CyclesButtonsPanel, Panel):
sub.prop(cmat, "volume_sampling", text="Sampling")
col.prop(cmat, "volume_interpolation", text="Interpolation")
col.prop(cmat, "homogeneous_volume", text="Homogeneous")
sub = col.column()
sub.active = not cmat.homogeneous_volume
sub.prop(cmat, "volume_step_rate")
def draw(self, context):
self.draw_shared(self, context, context.material)
@@ -1882,7 +1852,7 @@ class CYCLES_RENDER_PT_bake_influence(CyclesButtonsPanel, Panel):
cscene = scene.cycles
rd = scene.render
if rd.use_bake_multires == False and cscene.bake_type in {
'NORMAL', 'COMBINED', 'DIFFUSE', 'GLOSSY', 'TRANSMISSION'}:
'NORMAL', 'COMBINED', 'DIFFUSE', 'GLOSSY', 'TRANSMISSION', 'SUBSURFACE'}:
return True
def draw(self, context):
@@ -1921,7 +1891,7 @@ class CYCLES_RENDER_PT_bake_influence(CyclesButtonsPanel, Panel):
flow.prop(cbk, "use_pass_ambient_occlusion")
flow.prop(cbk, "use_pass_emit")
elif cscene.bake_type in {'DIFFUSE', 'GLOSSY', 'TRANSMISSION'}:
elif cscene.bake_type in {'DIFFUSE', 'GLOSSY', 'TRANSMISSION', 'SUBSURFACE'}:
row = col.row(align=True)
row.use_property_split = False
row.prop(cbk, "use_pass_direct", toggle=True)
@@ -2222,6 +2192,8 @@ def draw_device(self, context):
col = layout.column()
col.prop(cscene, "feature_set")
scene = context.scene
col = layout.column()
col.active = show_device_active(context)
col.prop(cscene, "device")
@@ -2276,7 +2248,6 @@ classes = (
CYCLES_PT_integrator_presets,
CYCLES_RENDER_PT_sampling,
CYCLES_RENDER_PT_sampling_sub_samples,
CYCLES_RENDER_PT_sampling_adaptive,
CYCLES_RENDER_PT_sampling_advanced,
CYCLES_RENDER_PT_light_paths,
CYCLES_RENDER_PT_light_paths_max_bounces,

View File

@@ -42,7 +42,10 @@ def custom_bake_remap(scene):
'GLOSSY_COLOR',
'TRANSMISSION_DIRECT',
'TRANSMISSION_INDIRECT',
'TRANSMISSION_COLOR')
'TRANSMISSION_COLOR',
'SUBSURFACE_DIRECT',
'SUBSURFACE_INDIRECT',
'SUBSURFACE_COLOR')
diffuse_direct_idx = bake_lookup.index('DIFFUSE_DIRECT')

View File

@@ -725,26 +725,22 @@ static void blender_camera_view_subset(BL::RenderEngine &b_engine,
BoundBox2D cam, view;
float view_aspect, cam_aspect, sensor_size;
/* Get viewport viewplane. */
/* get viewport viewplane */
BlenderCamera view_bcam;
blender_camera_init(&view_bcam, b_render);
blender_camera_from_view(&view_bcam, b_engine, b_scene, b_v3d, b_rv3d, width, height, true);
blender_camera_viewplane(&view_bcam, width, height, &view, &view_aspect, &sensor_size);
/* Get camera viewplane. */
/* get camera viewplane */
BlenderCamera cam_bcam;
blender_camera_init(&cam_bcam, b_render);
blender_camera_from_object(&cam_bcam, b_engine, b_ob, true);
/* Camera border is affect by aspect, viewport is not. */
cam_bcam.pixelaspect.x = b_render.pixel_aspect_x();
cam_bcam.pixelaspect.y = b_render.pixel_aspect_y();
blender_camera_viewplane(
&cam_bcam, cam_bcam.full_width, cam_bcam.full_height, &cam, &cam_aspect, &sensor_size);
/* Return */
/* return */
*view_box = view * (1.0f / view_aspect);
*cam_box = cam * (1.0f / cam_aspect);
}
@@ -867,8 +863,7 @@ void BlenderSync::sync_view(BL::SpaceView3D &b_v3d,
}
}
BufferParams BlenderSync::get_buffer_params(BL::Scene &b_scene,
BL::RenderSettings &b_render,
BufferParams BlenderSync::get_buffer_params(BL::RenderSettings &b_render,
BL::SpaceView3D &b_v3d,
BL::RegionView3D &b_rv3d,
Camera *cam,
@@ -904,11 +899,7 @@ BufferParams BlenderSync::get_buffer_params(BL::Scene &b_scene,
params.height = height;
}
PassType display_pass = update_viewport_display_passes(b_v3d, params.passes);
/* Can only denoise the combined image pass */
params.denoising_data_pass = display_pass == PASS_COMBINED &&
update_viewport_display_denoising(b_v3d, b_scene);
update_viewport_display_passes(b_v3d, params.passes);
return params;
}

View File

@@ -595,6 +595,40 @@ static void ExportCurveTriangleGeometry(Mesh *mesh, ParticleCurveData *CData, in
/* texture coords still needed */
}
static void export_hair_motion_validate_attribute(Hair *hair,
int motion_step,
int num_motion_keys,
bool have_motion)
{
Attribute *attr_mP = hair->attributes.find(ATTR_STD_MOTION_VERTEX_POSITION);
const int num_keys = hair->curve_keys.size();
if (num_motion_keys != num_keys || !have_motion) {
/* No motion or hair "topology" changed, remove attributes again. */
if (num_motion_keys != num_keys) {
VLOG(1) << "Hair topology changed, removing attribute.";
}
else {
VLOG(1) << "No motion, removing attribute.";
}
hair->attributes.remove(ATTR_STD_MOTION_VERTEX_POSITION);
}
else if (motion_step > 0) {
VLOG(1) << "Filling in new motion vertex position for motion_step " << motion_step;
/* Motion, fill up previous steps that we might have skipped because
* they had no motion, but we need them anyway now. */
for (int step = 0; step < motion_step; step++) {
float4 *mP = attr_mP->data_float4() + step * num_keys;
for (int key = 0; key < num_keys; key++) {
mP[key] = float3_to_float4(hair->curve_keys[key]);
mP[key].w = hair->curve_radius[key];
}
}
}
}
static void ExportCurveSegments(Scene *scene, Hair *hair, ParticleCurveData *CData)
{
int num_keys = 0;
@@ -714,40 +748,6 @@ static float4 LerpCurveSegmentMotionCV(ParticleCurveData *CData, int sys, int cu
return lerp(mP, mP2, remainder);
}
static void export_hair_motion_validate_attribute(Hair *hair,
int motion_step,
int num_motion_keys,
bool have_motion)
{
Attribute *attr_mP = hair->attributes.find(ATTR_STD_MOTION_VERTEX_POSITION);
const int num_keys = hair->curve_keys.size();
if (num_motion_keys != num_keys || !have_motion) {
/* No motion or hair "topology" changed, remove attributes again. */
if (num_motion_keys != num_keys) {
VLOG(1) << "Hair topology changed, removing attribute.";
}
else {
VLOG(1) << "No motion, removing attribute.";
}
hair->attributes.remove(ATTR_STD_MOTION_VERTEX_POSITION);
}
else if (motion_step > 0) {
VLOG(1) << "Filling in new motion vertex position for motion_step " << motion_step;
/* Motion, fill up previous steps that we might have skipped because
* they had no motion, but we need them anyway now. */
for (int step = 0; step < motion_step; step++) {
float4 *mP = attr_mP->data_float4() + step * num_keys;
for (int key = 0; key < num_keys; key++) {
mP[key] = float3_to_float4(hair->curve_keys[key]);
mP[key].w = hair->curve_radius[key];
}
}
}
}
static void ExportCurveSegmentsMotion(Hair *hair, ParticleCurveData *CData, int motion_step)
{
VLOG(1) << "Exporting curve motion segments for hair " << hair->name << ", motion step "
@@ -817,7 +817,7 @@ static void ExportCurveSegmentsMotion(Hair *hair, ParticleCurveData *CData, int
}
}
/* In case of new attribute, we verify if there really was any motion. */
/* in case of new attribute, we verify if there really was any motion */
if (new_attribute) {
export_hair_motion_validate_attribute(hair, motion_step, i, have_motion);
}
@@ -1154,198 +1154,7 @@ void BlenderSync::sync_particle_hair(
}
}
#ifdef WITH_NEW_OBJECT_TYPES
static float4 hair_point_as_float4(BL::HairPoint b_point)
{
float4 mP = float3_to_float4(get_float3(b_point.co()));
mP.w = b_point.radius();
return mP;
}
static float4 interpolate_hair_points(BL::Hair b_hair,
const int first_point_index,
const int num_points,
const float step)
{
const float curve_t = step * (num_points - 1);
const int point_a = clamp((int)curve_t, 0, num_points - 1);
const int point_b = min(point_a + 1, num_points - 1);
const float t = curve_t - (float)point_a;
return lerp(hair_point_as_float4(b_hair.points[first_point_index + point_a]),
hair_point_as_float4(b_hair.points[first_point_index + point_b]),
t);
}
static void export_hair_curves(Scene *scene, Hair *hair, BL::Hair b_hair)
{
/* TODO: optimize so we can straight memcpy arrays from Blender? */
/* Add requested attributes. */
Attribute *attr_intercept = NULL;
Attribute *attr_random = NULL;
if (hair->need_attribute(scene, ATTR_STD_CURVE_INTERCEPT)) {
attr_intercept = hair->attributes.add(ATTR_STD_CURVE_INTERCEPT);
}
if (hair->need_attribute(scene, ATTR_STD_CURVE_RANDOM)) {
attr_random = hair->attributes.add(ATTR_STD_CURVE_RANDOM);
}
/* Reserve memory. */
const int num_keys = b_hair.points.length();
const int num_curves = b_hair.curves.length();
if (num_curves > 0) {
VLOG(1) << "Exporting curve segments for hair " << hair->name;
}
hair->reserve_curves(num_curves, num_keys);
/* Export curves and points. */
vector<float> points_length;
BL::Hair::curves_iterator b_curve_iter;
for (b_hair.curves.begin(b_curve_iter); b_curve_iter != b_hair.curves.end(); ++b_curve_iter) {
BL::HairCurve b_curve = *b_curve_iter;
const int first_point_index = b_curve.first_point_index();
const int num_points = b_curve.num_points();
float3 prev_co = make_float3(0.0f, 0.0f, 0.0f);
float length = 0.0f;
if (attr_intercept) {
points_length.clear();
points_length.reserve(num_points);
}
/* Position and radius. */
for (int i = 0; i < num_points; i++) {
BL::HairPoint b_point = b_hair.points[first_point_index + i];
const float3 co = get_float3(b_point.co());
const float radius = b_point.radius();
hair->add_curve_key(co, radius);
if (attr_intercept) {
if (i > 0) {
length += len(co - prev_co);
points_length.push_back(length);
}
prev_co = co;
}
}
/* Normalized 0..1 attribute along curve. */
if (attr_intercept) {
for (int i = 0; i < num_points; i++) {
attr_intercept->add((length == 0.0f) ? 0.0f : points_length[i] / length);
}
}
/* Random number per curve. */
if (attr_random != NULL) {
attr_random->add(hash_uint2_to_float(b_curve.index(), 0));
}
/* Curve. */
const int shader_index = 0;
hair->add_curve(first_point_index, shader_index);
}
}
static void export_hair_curves_motion(Hair *hair, BL::Hair b_hair, int motion_step)
{
VLOG(1) << "Exporting curve motion segments for hair " << hair->name << ", motion step "
<< motion_step;
/* Find or add attribute. */
Attribute *attr_mP = hair->attributes.find(ATTR_STD_MOTION_VERTEX_POSITION);
bool new_attribute = false;
if (!attr_mP) {
VLOG(1) << "Creating new motion vertex position attribute";
attr_mP = hair->attributes.add(ATTR_STD_MOTION_VERTEX_POSITION);
new_attribute = true;
}
/* Export motion keys. */
const int num_keys = hair->curve_keys.size();
float4 *mP = attr_mP->data_float4() + motion_step * num_keys;
bool have_motion = false;
int num_motion_keys = 0;
int curve_index = 0;
BL::Hair::curves_iterator b_curve_iter;
for (b_hair.curves.begin(b_curve_iter); b_curve_iter != b_hair.curves.end(); ++b_curve_iter) {
BL::HairCurve b_curve = *b_curve_iter;
const int first_point_index = b_curve.first_point_index();
const int num_points = b_curve.num_points();
Hair::Curve curve = hair->get_curve(curve_index);
curve_index++;
if (num_points == curve.num_keys) {
/* Number of keys matches. */
for (int i = 0; i < num_points; i++) {
int point_index = first_point_index + i;
if (point_index < num_keys) {
mP[num_motion_keys] = hair_point_as_float4(b_hair.points[point_index]);
num_motion_keys++;
if (!have_motion) {
/* TODO: use epsilon for comparison? Was needed for particles due to
* transform, but ideally should not happen anymore. */
float4 curve_key = float3_to_float4(hair->curve_keys[i]);
curve_key.w = hair->curve_radius[i];
have_motion = !(mP[i] == curve_key);
}
}
}
}
else {
/* Number of keys has changed. Generate an interpolated version
* to preserve motion blur. */
const float step_size = curve.num_keys > 1 ? 1.0f / (curve.num_keys - 1) : 0.0f;
for (int i = 0; i < curve.num_keys; i++) {
const float step = i * step_size;
mP[num_motion_keys] = interpolate_hair_points(b_hair, first_point_index, num_points, step);
num_motion_keys++;
}
have_motion = true;
}
}
/* In case of new attribute, we verify if there really was any motion. */
if (new_attribute) {
export_hair_motion_validate_attribute(hair, motion_step, num_motion_keys, have_motion);
}
}
#endif /* WITH_NEW_OBJECT_TYPES */
/* Hair object. */
void BlenderSync::sync_hair(Hair *hair, BL::Object &b_ob, bool motion, int motion_step)
{
#ifdef WITH_NEW_OBJECT_TYPES
/* Convert Blender hair to Cycles curves. */
BL::Hair b_hair(b_ob.data());
if (motion) {
export_hair_curves_motion(hair, b_hair, motion_step);
}
else {
export_hair_curves(scene, hair, b_hair);
}
#else
(void)hair;
(void)b_ob;
(void)motion;
(void)motion_step;
#endif /* WITH_NEW_OBJECT_TYPES */
}
void BlenderSync::sync_hair(BL::Depsgraph b_depsgraph,
BL::Object b_ob,
Geometry *geom,
const vector<Shader *> &used_shaders)
void BlenderSync::sync_hair(BL::Depsgraph b_depsgraph, BL::Object b_ob, Geometry *geom)
{
Hair *hair = (geom->type == Geometry::HAIR) ? static_cast<Hair *>(geom) : NULL;
Mesh *mesh = (geom->type == Geometry::MESH) ? static_cast<Mesh *>(geom) : NULL;
@@ -1363,28 +1172,15 @@ void BlenderSync::sync_hair(BL::Depsgraph b_depsgraph,
oldtriangles.steal_data(mesh->triangles);
}
geom->clear();
geom->used_shaders = used_shaders;
if (view_layer.use_hair && scene->curve_system_manager->use_curves) {
#ifdef WITH_NEW_OBJECT_TYPES
if (b_ob.type() == BL::Object::type_HAIR) {
/* Hair object. */
sync_hair(hair, b_ob, false);
assert(mesh == NULL);
}
else
#endif
{
/* Particle hair. */
bool need_undeformed = geom->need_attribute(scene, ATTR_STD_GENERATED);
BL::Mesh b_mesh = object_to_mesh(
b_data, b_ob, b_depsgraph, need_undeformed, Mesh::SUBDIVISION_NONE);
/* Particle hair. */
bool need_undeformed = geom->need_attribute(scene, ATTR_STD_GENERATED);
BL::Mesh b_mesh = object_to_mesh(
b_data, b_ob, b_depsgraph, need_undeformed, Mesh::SUBDIVISION_NONE);
if (b_mesh) {
sync_particle_hair(geom, b_mesh, b_ob, false);
free_object_to_mesh(b_data, b_ob, b_mesh);
}
if (b_mesh) {
sync_particle_hair(geom, b_mesh, b_ob, false);
free_object_to_mesh(b_data, b_ob, b_mesh);
}
}
@@ -1411,24 +1207,13 @@ void BlenderSync::sync_hair_motion(BL::Depsgraph b_depsgraph,
/* Export deformed coordinates. */
if (ccl::BKE_object_is_deform_modified(b_ob, b_scene, preview)) {
#ifdef WITH_NEW_OBJECT_TYPES
if (b_ob.type() == BL::Object::type_HAIR) {
/* Hair object. */
sync_hair(hair, b_ob, true, motion_step);
assert(mesh == NULL);
/* Particle hair. */
BL::Mesh b_mesh = object_to_mesh(b_data, b_ob, b_depsgraph, false, Mesh::SUBDIVISION_NONE);
if (b_mesh) {
sync_particle_hair(geom, b_mesh, b_ob, true, motion_step);
free_object_to_mesh(b_data, b_ob, b_mesh);
return;
}
else
#endif
{
/* Particle hair. */
BL::Mesh b_mesh = object_to_mesh(b_data, b_ob, b_depsgraph, false, Mesh::SUBDIVISION_NONE);
if (b_mesh) {
sync_particle_hair(geom, b_mesh, b_ob, true, motion_step);
free_object_to_mesh(b_data, b_ob, b_mesh);
return;
}
}
}
/* No deformation on this frame, copy coordinates if other frames did have it. */

View File

@@ -17,26 +17,8 @@
#include "blender/blender_device.h"
#include "blender/blender_util.h"
#include "util/util_foreach.h"
CCL_NAMESPACE_BEGIN
enum DenoiserType {
DENOISER_NONE = 0,
DENOISER_OPTIX = 1,
DENOISER_NUM
};
enum ComputeDevice {
COMPUTE_DEVICE_CPU = 0,
COMPUTE_DEVICE_CUDA = 1,
COMPUTE_DEVICE_OPENCL = 2,
COMPUTE_DEVICE_OPTIX = 3,
COMPUTE_DEVICE_NUM
};
int blender_device_threads(BL::Scene &b_scene)
{
BL::RenderSettings b_r = b_scene.render();
@@ -58,7 +40,7 @@ DeviceInfo blender_device_info(BL::Preferences &b_preferences, BL::Scene &b_scen
/* Find network device. */
vector<DeviceInfo> devices = Device::available_devices(DEVICE_MASK_NETWORK);
if (!devices.empty()) {
return devices.front();
device = devices.front();
}
}
else if (get_enum(cscene, "device") == 1) {
@@ -75,6 +57,14 @@ DeviceInfo blender_device_info(BL::Preferences &b_preferences, BL::Scene &b_scen
}
/* Test if we are using GPU devices. */
enum ComputeDevice {
COMPUTE_DEVICE_CPU = 0,
COMPUTE_DEVICE_CUDA = 1,
COMPUTE_DEVICE_OPENCL = 2,
COMPUTE_DEVICE_OPTIX = 3,
COMPUTE_DEVICE_NUM = 4,
};
ComputeDevice compute_device = (ComputeDevice)get_enum(
cpreferences, "compute_device_type", COMPUTE_DEVICE_NUM, COMPUTE_DEVICE_CPU);
@@ -116,34 +106,6 @@ DeviceInfo blender_device_info(BL::Preferences &b_preferences, BL::Scene &b_scen
}
}
/* Ensure there is an OptiX device when using the OptiX denoiser. */
bool use_optix_denoising = get_enum(cscene, "preview_denoising", DENOISER_NUM, DENOISER_NONE) ==
DENOISER_OPTIX &&
!background;
BL::Scene::view_layers_iterator b_view_layer;
for (b_scene.view_layers.begin(b_view_layer); b_view_layer != b_scene.view_layers.end();
++b_view_layer) {
PointerRNA crl = RNA_pointer_get(&b_view_layer->ptr, "cycles");
if (get_boolean(crl, "use_optix_denoising")) {
use_optix_denoising = true;
}
}
if (use_optix_denoising && device.type != DEVICE_OPTIX) {
vector<DeviceInfo> optix_devices = Device::available_devices(DEVICE_MASK_OPTIX);
if (!optix_devices.empty()) {
/* Convert to a special multi device with separate denoising devices. */
if (device.multi_devices.empty()) {
device.multi_devices.push_back(device);
}
/* Simply use the first available OptiX device. */
const DeviceInfo optix_device = optix_devices.front();
device.id += optix_device.id; /* Uniquely identify this special multi device. */
device.denoising_devices.push_back(optix_device);
}
}
return device;
}

View File

@@ -18,9 +18,9 @@
#define __BLENDER_DEVICE_H__
#include "MEM_guardedalloc.h"
#include "RNA_types.h"
#include "RNA_access.h"
#include "RNA_blender_cpp.h"
#include "RNA_types.h"
#include "device/device.h"

View File

@@ -23,8 +23,6 @@
#include "blender/blender_sync.h"
#include "blender/blender_util.h"
#include "util/util_foreach.h"
CCL_NAMESPACE_BEGIN
Geometry *BlenderSync::sync_geometry(BL::Depsgraph &b_depsgraph,
@@ -38,19 +36,11 @@ Geometry *BlenderSync::sync_geometry(BL::Depsgraph &b_depsgraph,
BL::ID b_key_id = (BKE_object_is_modified(b_ob)) ? b_ob_instance : b_ob_data;
GeometryKey key(b_key_id.ptr.data, use_particle_hair);
BL::Material material_override = view_layer.material_override;
Shader *default_shader = (b_ob.type() == BL::Object::type_VOLUME) ? scene->default_volume :
scene->default_surface;
#ifdef WITH_NEW_OBJECT_TYPES
Geometry::Type geom_type = ((b_ob.type() == BL::Object::type_HAIR || use_particle_hair) &&
Shader *default_shader = scene->default_surface;
Geometry::Type geom_type = (use_particle_hair &&
(scene->curve_system_manager->primitive != CURVE_TRIANGLES)) ?
Geometry::HAIR :
Geometry::MESH;
#else
Geometry::Type geom_type = ((use_particle_hair) &&
(scene->curve_system_manager->primitive != CURVE_TRIANGLES)) ?
Geometry::HAIR :
Geometry::MESH;
#endif
/* Find shader indices. */
vector<Shader *> used_shaders;
@@ -127,22 +117,20 @@ Geometry *BlenderSync::sync_geometry(BL::Depsgraph &b_depsgraph,
geometry_synced.insert(geom);
geom->clear();
geom->used_shaders = used_shaders;
geom->name = ustring(b_ob_data.name().c_str());
#ifdef WITH_NEW_OBJECT_TYPES
if (b_ob.type() == BL::Object::type_HAIR || use_particle_hair) {
#else
if (use_particle_hair) {
#endif
sync_hair(b_depsgraph, b_ob, geom, used_shaders);
sync_hair(b_depsgraph, b_ob, geom);
}
else if (b_ob.type() == BL::Object::type_VOLUME || object_fluid_gas_domain_find(b_ob)) {
else if (object_fluid_gas_domain_find(b_ob)) {
Mesh *mesh = static_cast<Mesh *>(geom);
sync_volume(b_ob, mesh, used_shaders);
sync_volume(b_ob, mesh);
}
else {
Mesh *mesh = static_cast<Mesh *>(geom);
sync_mesh(b_depsgraph, b_ob, mesh, used_shaders);
sync_mesh(b_depsgraph, b_ob, mesh);
}
return geom;
@@ -173,14 +161,10 @@ void BlenderSync::sync_geometry_motion(BL::Depsgraph &b_depsgraph,
return;
}
#ifdef WITH_NEW_OBJECT_TYPES
if (b_ob.type() == BL::Object::type_HAIR || use_particle_hair) {
#else
if (use_particle_hair) {
#endif
sync_hair_motion(b_depsgraph, b_ob, geom, motion_step);
}
else if (b_ob.type() == BL::Object::type_VOLUME || object_fluid_gas_domain_find(b_ob)) {
else if (object_fluid_gas_domain_find(b_ob)) {
/* No volume motion blur support yet. */
}
else {

View File

@@ -14,71 +14,206 @@
* limitations under the License.
*/
#include "MEM_guardedalloc.h"
#include "render/image.h"
#include "blender/blender_image.h"
#include "blender/blender_sync.h"
#include "blender/blender_session.h"
#include "blender/blender_util.h"
CCL_NAMESPACE_BEGIN
/* Packed Images */
BlenderImageLoader::BlenderImageLoader(BL::Image b_image, int frame)
: b_image(b_image), frame(frame), free_cache(!b_image.has_data())
/* builtin image file name is actually an image datablock name with
* absolute sequence frame number concatenated via '@' character
*
* this function splits frame from builtin name
*/
int BlenderSession::builtin_image_frame(const string &builtin_name)
{
int last = builtin_name.find_last_of('@');
return atoi(builtin_name.substr(last + 1, builtin_name.size() - last - 1).c_str());
}
bool BlenderImageLoader::load_metadata(ImageMetaData &metadata)
void BlenderSession::builtin_image_info(const string &builtin_name,
void *builtin_data,
ImageMetaData &metadata)
{
metadata.width = b_image.size()[0];
metadata.height = b_image.size()[1];
metadata.depth = 1;
metadata.channels = b_image.channels();
/* empty image */
metadata.width = 1;
metadata.height = 1;
if (b_image.is_float()) {
if (metadata.channels == 1) {
metadata.type = IMAGE_DATA_TYPE_FLOAT;
if (!builtin_data)
return;
/* recover ID pointer */
PointerRNA ptr;
RNA_id_pointer_create((ID *)builtin_data, &ptr);
BL::ID b_id(ptr);
if (b_id.is_a(&RNA_Image)) {
/* image data */
BL::Image b_image(b_id);
metadata.builtin_free_cache = !b_image.has_data();
metadata.is_float = b_image.is_float();
metadata.width = b_image.size()[0];
metadata.height = b_image.size()[1];
metadata.depth = 1;
metadata.channels = b_image.channels();
if (metadata.is_float) {
/* Float images are already converted on the Blender side,
* no need to do anything in Cycles. */
metadata.colorspace = u_colorspace_raw;
}
else if (metadata.channels == 4) {
metadata.type = IMAGE_DATA_TYPE_FLOAT4;
}
else {
return false;
}
else if (b_id.is_a(&RNA_Object)) {
/* smoke volume data */
BL::Object b_ob(b_id);
BL::FluidDomainSettings b_domain = object_fluid_gas_domain_find(b_ob);
metadata.is_float = true;
metadata.depth = 1;
metadata.channels = 1;
if (!b_domain)
return;
if (builtin_name == Attribute::standard_name(ATTR_STD_VOLUME_DENSITY) ||
builtin_name == Attribute::standard_name(ATTR_STD_VOLUME_FLAME) ||
builtin_name == Attribute::standard_name(ATTR_STD_VOLUME_HEAT) ||
builtin_name == Attribute::standard_name(ATTR_STD_VOLUME_TEMPERATURE))
metadata.channels = 1;
else if (builtin_name == Attribute::standard_name(ATTR_STD_VOLUME_COLOR))
metadata.channels = 4;
else if (builtin_name == Attribute::standard_name(ATTR_STD_VOLUME_VELOCITY))
metadata.channels = 3;
else
return;
int3 resolution = get_int3(b_domain.domain_resolution());
int amplify = (b_domain.use_noise()) ? b_domain.noise_scale() : 1;
/* Velocity and heat data is always low-resolution. */
if (builtin_name == Attribute::standard_name(ATTR_STD_VOLUME_VELOCITY) ||
builtin_name == Attribute::standard_name(ATTR_STD_VOLUME_HEAT)) {
amplify = 1;
}
/* Float images are already converted on the Blender side,
* no need to do anything in Cycles. */
metadata.colorspace = u_colorspace_raw;
metadata.width = resolution.x * amplify;
metadata.height = resolution.y * amplify;
metadata.depth = resolution.z * amplify;
}
else {
if (metadata.channels == 1) {
metadata.type = IMAGE_DATA_TYPE_BYTE;
/* TODO(sergey): Check we're indeed in shader node tree. */
PointerRNA ptr;
RNA_pointer_create(NULL, &RNA_Node, builtin_data, &ptr);
BL::Node b_node(ptr);
if (b_node.is_a(&RNA_ShaderNodeTexPointDensity)) {
BL::ShaderNodeTexPointDensity b_point_density_node(b_node);
metadata.channels = 4;
metadata.width = b_point_density_node.resolution();
metadata.height = metadata.width;
metadata.depth = metadata.width;
metadata.is_float = true;
}
else if (metadata.channels == 4) {
metadata.type = IMAGE_DATA_TYPE_BYTE4;
}
}
bool BlenderSession::builtin_image_pixels(const string &builtin_name,
void *builtin_data,
int tile,
unsigned char *pixels,
const size_t pixels_size,
const bool associate_alpha,
const bool free_cache)
{
if (!builtin_data) {
return false;
}
const int frame = builtin_image_frame(builtin_name);
PointerRNA ptr;
RNA_id_pointer_create((ID *)builtin_data, &ptr);
BL::Image b_image(ptr);
const int width = b_image.size()[0];
const int height = b_image.size()[1];
const int channels = b_image.channels();
unsigned char *image_pixels = image_get_pixels_for_frame(b_image, frame, tile);
const size_t num_pixels = ((size_t)width) * height;
if (image_pixels && num_pixels * channels == pixels_size) {
memcpy(pixels, image_pixels, pixels_size * sizeof(unsigned char));
}
else {
if (channels == 1) {
memset(pixels, 0, pixels_size * sizeof(unsigned char));
}
else {
return false;
const size_t num_pixels_safe = pixels_size / channels;
unsigned char *cp = pixels;
for (size_t i = 0; i < num_pixels_safe; i++, cp += channels) {
cp[0] = 255;
cp[1] = 0;
cp[2] = 255;
if (channels == 4) {
cp[3] = 255;
}
}
}
}
if (image_pixels) {
MEM_freeN(image_pixels);
}
/* Free image buffers to save memory during render. */
if (free_cache) {
b_image.buffers_free();
}
if (associate_alpha) {
/* Premultiply, byte images are always straight for Blender. */
unsigned char *cp = pixels;
for (size_t i = 0; i < num_pixels; i++, cp += channels) {
cp[0] = (cp[0] * cp[3]) >> 8;
cp[1] = (cp[1] * cp[3]) >> 8;
cp[2] = (cp[2] * cp[3]) >> 8;
}
}
return true;
}
bool BlenderImageLoader::load_pixels(const ImageMetaData &metadata,
void *pixels,
const size_t pixels_size,
const bool associate_alpha)
bool BlenderSession::builtin_image_float_pixels(const string &builtin_name,
void *builtin_data,
int tile,
float *pixels,
const size_t pixels_size,
const bool,
const bool free_cache)
{
const size_t num_pixels = ((size_t)metadata.width) * metadata.height;
const int channels = metadata.channels;
const int tile = 0; /* TODO(lukas): Support tiles here? */
if (!builtin_data) {
return false;
}
if (b_image.is_float()) {
PointerRNA ptr;
RNA_id_pointer_create((ID *)builtin_data, &ptr);
BL::ID b_id(ptr);
if (b_id.is_a(&RNA_Image)) {
/* image data */
BL::Image b_image(b_id);
int frame = builtin_image_frame(builtin_name);
const int width = b_image.size()[0];
const int height = b_image.size()[1];
const int channels = b_image.channels();
float *image_pixels;
image_pixels = image_get_float_pixels_for_frame(b_image, frame, tile);
const size_t num_pixels = ((size_t)width) * height;
if (image_pixels && num_pixels * channels == pixels_size) {
memcpy(pixels, image_pixels, pixels_size * sizeof(float));
@@ -89,7 +224,7 @@ bool BlenderImageLoader::load_pixels(const ImageMetaData &metadata,
}
else {
const size_t num_pixels_safe = pixels_size / channels;
float *fp = (float *)pixels;
float *fp = pixels;
for (int i = 0; i < num_pixels_safe; i++, fp += channels) {
fp[0] = 1.0f;
fp[1] = 0.0f;
@@ -104,91 +239,107 @@ bool BlenderImageLoader::load_pixels(const ImageMetaData &metadata,
if (image_pixels) {
MEM_freeN(image_pixels);
}
}
else {
unsigned char *image_pixels = image_get_pixels_for_frame(b_image, frame, tile);
if (image_pixels && num_pixels * channels == pixels_size) {
memcpy(pixels, image_pixels, pixels_size * sizeof(unsigned char));
/* Free image buffers to save memory during render. */
if (free_cache) {
b_image.buffers_free();
}
return true;
}
else if (b_id.is_a(&RNA_Object)) {
/* smoke volume data */
BL::Object b_ob(b_id);
BL::FluidDomainSettings b_domain = object_fluid_gas_domain_find(b_ob);
if (!b_domain) {
return false;
}
#ifdef WITH_FLUID
int3 resolution = get_int3(b_domain.domain_resolution());
int length, amplify = (b_domain.use_noise()) ? b_domain.noise_scale() : 1;
/* Velocity and heat data is always low-resolution. */
if (builtin_name == Attribute::standard_name(ATTR_STD_VOLUME_VELOCITY) ||
builtin_name == Attribute::standard_name(ATTR_STD_VOLUME_HEAT)) {
amplify = 1;
}
const int width = resolution.x * amplify;
const int height = resolution.y * amplify;
const int depth = resolution.z * amplify;
const size_t num_pixels = ((size_t)width) * height * depth;
if (builtin_name == Attribute::standard_name(ATTR_STD_VOLUME_DENSITY)) {
FluidDomainSettings_density_grid_get_length(&b_domain.ptr, &length);
if (length == num_pixels) {
FluidDomainSettings_density_grid_get(&b_domain.ptr, pixels);
return true;
}
}
else if (builtin_name == Attribute::standard_name(ATTR_STD_VOLUME_FLAME)) {
/* this is in range 0..1, and interpreted by the OpenGL smoke viewer
* as 1500..3000 K with the first part faded to zero density */
FluidDomainSettings_flame_grid_get_length(&b_domain.ptr, &length);
if (length == num_pixels) {
FluidDomainSettings_flame_grid_get(&b_domain.ptr, pixels);
return true;
}
}
else if (builtin_name == Attribute::standard_name(ATTR_STD_VOLUME_COLOR)) {
/* the RGB is "premultiplied" by density for better interpolation results */
FluidDomainSettings_color_grid_get_length(&b_domain.ptr, &length);
if (length == num_pixels * 4) {
FluidDomainSettings_color_grid_get(&b_domain.ptr, pixels);
return true;
}
}
else if (builtin_name == Attribute::standard_name(ATTR_STD_VOLUME_VELOCITY)) {
FluidDomainSettings_velocity_grid_get_length(&b_domain.ptr, &length);
if (length == num_pixels * 3) {
FluidDomainSettings_velocity_grid_get(&b_domain.ptr, pixels);
return true;
}
}
else if (builtin_name == Attribute::standard_name(ATTR_STD_VOLUME_HEAT)) {
FluidDomainSettings_heat_grid_get_length(&b_domain.ptr, &length);
if (length == num_pixels) {
FluidDomainSettings_heat_grid_get(&b_domain.ptr, pixels);
return true;
}
}
else if (builtin_name == Attribute::standard_name(ATTR_STD_VOLUME_TEMPERATURE)) {
FluidDomainSettings_temperature_grid_get_length(&b_domain.ptr, &length);
if (length == num_pixels) {
FluidDomainSettings_temperature_grid_get(&b_domain.ptr, pixels);
return true;
}
}
else {
if (channels == 1) {
memset(pixels, 0, pixels_size * sizeof(unsigned char));
}
else {
const size_t num_pixels_safe = pixels_size / channels;
unsigned char *cp = (unsigned char *)pixels;
for (size_t i = 0; i < num_pixels_safe; i++, cp += channels) {
cp[0] = 255;
cp[1] = 0;
cp[2] = 255;
if (channels == 4) {
cp[3] = 255;
}
}
}
fprintf(
stderr, "Cycles error: unknown volume attribute %s, skipping\n", builtin_name.c_str());
pixels[0] = 0.0f;
return false;
}
if (image_pixels) {
MEM_freeN(image_pixels);
}
if (associate_alpha) {
/* Premultiply, byte images are always straight for Blender. */
unsigned char *cp = (unsigned char *)pixels;
for (size_t i = 0; i < num_pixels; i++, cp += channels) {
cp[0] = (cp[0] * cp[3]) >> 8;
cp[1] = (cp[1] * cp[3]) >> 8;
cp[2] = (cp[2] * cp[3]) >> 8;
}
#endif
fprintf(stderr, "Cycles error: unexpected smoke volume resolution, skipping\n");
}
else {
/* We originally were passing view_layer here but in reality we need a
* a depsgraph to pass to the RE_point_density_minmax() function.
*/
/* TODO(sergey): Check we're indeed in shader node tree. */
PointerRNA ptr;
RNA_pointer_create(NULL, &RNA_Node, builtin_data, &ptr);
BL::Node b_node(ptr);
if (b_node.is_a(&RNA_ShaderNodeTexPointDensity)) {
BL::ShaderNodeTexPointDensity b_point_density_node(b_node);
int length;
b_point_density_node.calc_point_density(b_depsgraph, &length, &pixels);
}
}
/* Free image buffers to save memory during render. */
if (free_cache) {
b_image.buffers_free();
}
return true;
}
string BlenderImageLoader::name() const
{
return BL::Image(b_image).name();
}
bool BlenderImageLoader::equals(const ImageLoader &other) const
{
const BlenderImageLoader &other_loader = (const BlenderImageLoader &)other;
return b_image == other_loader.b_image && frame == other_loader.frame;
}
/* Point Density */
BlenderPointDensityLoader::BlenderPointDensityLoader(BL::Depsgraph b_depsgraph,
BL::ShaderNodeTexPointDensity b_node)
: b_depsgraph(b_depsgraph), b_node(b_node)
{
}
bool BlenderPointDensityLoader::load_metadata(ImageMetaData &metadata)
{
metadata.channels = 4;
metadata.width = b_node.resolution();
metadata.height = metadata.width;
metadata.depth = metadata.width;
metadata.type = IMAGE_DATA_TYPE_FLOAT4;
return true;
}
bool BlenderPointDensityLoader::load_pixels(const ImageMetaData &,
void *pixels,
const size_t,
const bool)
{
int length;
b_node.calc_point_density(b_depsgraph, &length, (float **)&pixels);
return true;
return false;
}
void BlenderSession::builtin_images_load()
@@ -206,15 +357,4 @@ void BlenderSession::builtin_images_load()
manager->device_load_builtin(device, session->scene, session->progress);
}
string BlenderPointDensityLoader::name() const
{
return BL::ShaderNodeTexPointDensity(b_node).name();
}
bool BlenderPointDensityLoader::equals(const ImageLoader &other) const
{
const BlenderPointDensityLoader &other_loader = (const BlenderPointDensityLoader &)other;
return b_node == other_loader.b_node && b_depsgraph == other_loader.b_depsgraph;
}
CCL_NAMESPACE_END

View File

@@ -1,61 +0,0 @@
/*
* Copyright 2011-2020 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 __BLENDER_IMAGE_H__
#define __BLENDER_IMAGE_H__
#include "RNA_blender_cpp.h"
#include "render/image.h"
CCL_NAMESPACE_BEGIN
class BlenderImageLoader : public ImageLoader {
public:
BlenderImageLoader(BL::Image b_image, int frame);
bool load_metadata(ImageMetaData &metadata) override;
bool load_pixels(const ImageMetaData &metadata,
void *pixels,
const size_t pixels_size,
const bool associate_alpha) override;
string name() const override;
bool equals(const ImageLoader &other) const override;
BL::Image b_image;
int frame;
bool free_cache;
};
class BlenderPointDensityLoader : public ImageLoader {
public:
BlenderPointDensityLoader(BL::Depsgraph depsgraph, BL::ShaderNodeTexPointDensity b_node);
bool load_metadata(ImageMetaData &metadata) override;
bool load_pixels(const ImageMetaData &metadata,
void *pixels,
const size_t pixels_size,
const bool associate_alpha) override;
string name() const override;
bool equals(const ImageLoader &other) const override;
BL::Depsgraph b_depsgraph;
BL::ShaderNodeTexPointDensity b_node;
};
CCL_NAMESPACE_END
#endif /* __BLENDER_IMAGE_H__ */

View File

@@ -14,25 +14,25 @@
* limitations under the License.
*/
#include "render/camera.h"
#include "render/colorspace.h"
#include "render/mesh.h"
#include "render/object.h"
#include "render/scene.h"
#include "render/camera.h"
#include "blender/blender_session.h"
#include "blender/blender_sync.h"
#include "blender/blender_session.h"
#include "blender/blender_util.h"
#include "subd/subd_patch.h"
#include "subd/subd_split.h"
#include "util/util_algorithm.h"
#include "util/util_disjoint_set.h"
#include "util/util_foreach.h"
#include "util/util_hash.h"
#include "util/util_logging.h"
#include "util/util_math.h"
#include "util/util_disjoint_set.h"
#include "mikktspace.h"
@@ -285,27 +285,14 @@ static void attr_create_vertex_color(Scene *scene, Mesh *mesh, BL::Mesh &b_mesh,
BL::Mesh::vertex_colors_iterator l;
for (b_mesh.vertex_colors.begin(l); l != b_mesh.vertex_colors.end(); ++l) {
const bool active_render = l->active_render();
AttributeStandard vcol_std = (active_render) ? ATTR_STD_VERTEX_COLOR : ATTR_STD_NONE;
ustring vcol_name = ustring(l->name().c_str());
const bool need_vcol = mesh->need_attribute(scene, vcol_name) ||
mesh->need_attribute(scene, vcol_std);
if (!need_vcol) {
if (!mesh->need_attribute(scene, ustring(l->name().c_str())))
continue;
}
Attribute *vcol_attr = NULL;
if (active_render) {
vcol_attr = mesh->subd_attributes.add(vcol_std, vcol_name);
}
else {
vcol_attr = mesh->subd_attributes.add(vcol_name, TypeRGBA, ATTR_ELEMENT_CORNER_BYTE);
}
Attribute *attr = mesh->subd_attributes.add(
ustring(l->name().c_str()), TypeRGBA, ATTR_ELEMENT_CORNER_BYTE);
BL::Mesh::polygons_iterator p;
uchar4 *cdata = vcol_attr->data_uchar4();
uchar4 *cdata = attr->data_uchar4();
for (b_mesh.polygons.begin(p); p != b_mesh.polygons.end(); ++p) {
int n = p->loop_total();
@@ -320,27 +307,14 @@ static void attr_create_vertex_color(Scene *scene, Mesh *mesh, BL::Mesh &b_mesh,
else {
BL::Mesh::vertex_colors_iterator l;
for (b_mesh.vertex_colors.begin(l); l != b_mesh.vertex_colors.end(); ++l) {
const bool active_render = l->active_render();
AttributeStandard vcol_std = (active_render) ? ATTR_STD_VERTEX_COLOR : ATTR_STD_NONE;
ustring vcol_name = ustring(l->name().c_str());
const bool need_vcol = mesh->need_attribute(scene, vcol_name) ||
mesh->need_attribute(scene, vcol_std);
if (!need_vcol) {
if (!mesh->need_attribute(scene, ustring(l->name().c_str())))
continue;
}
Attribute *vcol_attr = NULL;
if (active_render) {
vcol_attr = mesh->attributes.add(vcol_std, vcol_name);
}
else {
vcol_attr = mesh->attributes.add(vcol_name, TypeRGBA, ATTR_ELEMENT_CORNER_BYTE);
}
Attribute *attr = mesh->attributes.add(
ustring(l->name().c_str()), TypeRGBA, ATTR_ELEMENT_CORNER_BYTE);
BL::Mesh::loop_triangles_iterator t;
uchar4 *cdata = vcol_attr->data_uchar4();
uchar4 *cdata = attr->data_uchar4();
for (b_mesh.loop_triangles.begin(t); t != b_mesh.loop_triangles.end(); ++t) {
int3 li = get_int3(t->loops());
@@ -941,10 +915,7 @@ static void sync_mesh_fluid_motion(BL::Object &b_ob, Scene *scene, Mesh *mesh)
}
}
void BlenderSync::sync_mesh(BL::Depsgraph b_depsgraph,
BL::Object b_ob,
Mesh *mesh,
const vector<Shader *> &used_shaders)
void BlenderSync::sync_mesh(BL::Depsgraph b_depsgraph, BL::Object b_ob, Mesh *mesh)
{
array<int> oldtriangles;
array<Mesh::SubdFace> oldsubd_faces;
@@ -953,9 +924,6 @@ void BlenderSync::sync_mesh(BL::Depsgraph b_depsgraph,
oldsubd_faces.steal_data(mesh->subd_faces);
oldsubd_face_corners.steal_data(mesh->subd_face_corners);
mesh->clear();
mesh->used_shaders = used_shaders;
mesh->subdivision_type = Mesh::SUBDIVISION_NONE;
if (view_layer.use_surfaces) {
@@ -997,12 +965,6 @@ void BlenderSync::sync_mesh_motion(BL::Depsgraph b_depsgraph,
Mesh *mesh,
int motion_step)
{
/* Fluid motion blur already exported. */
BL::FluidDomainSettings b_fluid_domain = object_fluid_liquid_domain_find(b_ob);
if (b_fluid_domain) {
return;
}
/* Skip if no vertices were exported. */
size_t numverts = mesh->verts.size();
if (numverts == 0) {

View File

@@ -15,14 +15,14 @@
*/
#include "render/camera.h"
#include "render/graph.h"
#include "render/integrator.h"
#include "render/graph.h"
#include "render/light.h"
#include "render/mesh.h"
#include "render/nodes.h"
#include "render/object.h"
#include "render/particles.h"
#include "render/scene.h"
#include "render/nodes.h"
#include "render/particles.h"
#include "render/shader.h"
#include "blender/blender_object_cull.h"
@@ -67,20 +67,10 @@ bool BlenderSync::object_is_mesh(BL::Object &b_ob)
return false;
}
BL::Object::type_enum type = b_ob.type();
#ifdef WITH_NEW_OBJECT_TYPES
if (type == BL::Object::type_VOLUME || type == BL::Object::type_HAIR) {
#else
if (type == BL::Object::type_VOLUME) {
#endif
/* Will be exported attached to mesh. */
return true;
}
else if (type == BL::Object::type_CURVE) {
if (b_ob.type() == BL::Object::type_CURVE) {
/* Skip exporting curves without faces, overhead can be
* significant if there are many for path animation. */
BL::Curve b_curve(b_ob_data);
BL::Curve b_curve(b_ob.data());
return (b_curve.bevel_object() || b_curve.extrude() != 0.0f || b_curve.bevel_depth() != 0.0f ||
b_curve.dimensions() == BL::Curve::dimensions_2D || b_ob.modifiers.length());
@@ -276,7 +266,7 @@ Object *BlenderSync::sync_object(BL::Depsgraph &b_depsgraph,
uint motion_steps;
if (need_motion == Scene::MOTION_BLUR) {
motion_steps = object_motion_steps(b_parent, b_ob, Object::MAX_MOTION_STEPS);
motion_steps = object_motion_steps(b_parent, b_ob);
geom->motion_steps = motion_steps;
if (motion_steps && object_use_deform_motion(b_parent, b_ob)) {
geom->use_motion_blur = true;

View File

@@ -19,8 +19,8 @@
#include "blender/CCL_api.h"
#include "blender/blender_device.h"
#include "blender/blender_session.h"
#include "blender/blender_sync.h"
#include "blender/blender_session.h"
#include "blender/blender_util.h"
#include "render/denoising.h"
@@ -38,8 +38,8 @@
#ifdef WITH_OSL
# include "render/osl.h"
# include <OSL/oslconfig.h>
# include <OSL/oslquery.h>
# include <OSL/oslconfig.h>
#endif
#ifdef WITH_OPENCL

View File

@@ -41,8 +41,8 @@
#include "util/util_progress.h"
#include "util/util_time.h"
#include "blender/blender_session.h"
#include "blender/blender_sync.h"
#include "blender/blender_session.h"
#include "blender/blender_util.h"
CCL_NAMESPACE_BEGIN
@@ -138,6 +138,14 @@ void BlenderSession::create_session()
scene = new Scene(scene_params, session->device);
scene->name = b_scene.name();
/* setup callbacks for builtin image support */
scene->image_manager->builtin_image_info_cb = function_bind(
&BlenderSession::builtin_image_info, this, _1, _2, _3);
scene->image_manager->builtin_image_pixels_cb = function_bind(
&BlenderSession::builtin_image_pixels, this, _1, _2, _3, _4, _5, _6, _7);
scene->image_manager->builtin_image_float_pixels_cb = function_bind(
&BlenderSession::builtin_image_float_pixels, this, _1, _2, _3, _4, _5, _6, _7);
session->scene = scene;
/* There is no single depsgraph to use for the entire render.
@@ -158,7 +166,7 @@ void BlenderSession::create_session()
/* set buffer parameters */
BufferParams buffer_params = BlenderSync::get_buffer_params(
b_scene, b_render, b_v3d, b_rv3d, scene->camera, width, height);
b_render, b_v3d, b_rv3d, scene->camera, width, height);
session->reset(buffer_params, session_params.samples);
b_engine.use_highlight_tiles(session_params.progressive_refine == false);
@@ -236,7 +244,7 @@ void BlenderSession::reset_session(BL::BlendData &b_data, BL::Depsgraph &b_depsg
BL::SpaceView3D b_null_space_view3d(PointerRNA_NULL);
BL::RegionView3D b_null_region_view3d(PointerRNA_NULL);
BufferParams buffer_params = BlenderSync::get_buffer_params(
b_scene, b_render, b_null_space_view3d, b_null_region_view3d, scene->camera, width, height);
b_render, b_null_space_view3d, b_null_region_view3d, scene->camera, width, height);
session->reset(buffer_params, session_params.samples);
b_engine.use_highlight_tiles(session_params.progressive_refine == false);
@@ -270,6 +278,8 @@ static ShaderEvalType get_shader_type(const string &pass_type)
return SHADER_EVAL_GLOSSY_COLOR;
else if (strcmp(shader_type, "TRANSMISSION_COLOR") == 0)
return SHADER_EVAL_TRANSMISSION_COLOR;
else if (strcmp(shader_type, "SUBSURFACE_COLOR") == 0)
return SHADER_EVAL_SUBSURFACE_COLOR;
else if (strcmp(shader_type, "EMIT") == 0)
return SHADER_EVAL_EMISSION;
@@ -286,6 +296,8 @@ static ShaderEvalType get_shader_type(const string &pass_type)
return SHADER_EVAL_GLOSSY;
else if (strcmp(shader_type, "TRANSMISSION") == 0)
return SHADER_EVAL_TRANSMISSION;
else if (strcmp(shader_type, "SUBSURFACE") == 0)
return SHADER_EVAL_SUBSURFACE;
/* extra */
else if (strcmp(shader_type, "ENVIRONMENT") == 0)
@@ -448,7 +460,7 @@ void BlenderSession::render(BL::Depsgraph &b_depsgraph_)
SessionParams session_params = BlenderSync::get_session_params(
b_engine, b_userpref, b_scene, background);
BufferParams buffer_params = BlenderSync::get_buffer_params(
b_scene, b_render, b_v3d, b_rv3d, scene->camera, width, height);
b_render, b_v3d, b_rv3d, scene->camera, width, height);
/* render each layer */
BL::ViewLayer b_view_layer = b_depsgraph.view_layer_eval();
@@ -462,8 +474,7 @@ void BlenderSession::render(BL::Depsgraph &b_depsgraph_)
b_rlay_name = b_view_layer.name();
/* add passes */
vector<Pass> passes = sync->sync_render_passes(
b_rlay, b_view_layer, session_params.adaptive_sampling);
vector<Pass> passes = sync->sync_render_passes(b_rlay, b_view_layer);
buffer_params.passes = passes;
PointerRNA crl = RNA_pointer_get(&b_view_layer.ptr, "cycles");
@@ -629,6 +640,8 @@ static int bake_pass_filter_get(const int pass_filter)
flag |= BAKE_FILTER_GLOSSY;
if ((pass_filter & BL::BakeSettings::pass_filter_TRANSMISSION) != 0)
flag |= BAKE_FILTER_TRANSMISSION;
if ((pass_filter & BL::BakeSettings::pass_filter_SUBSURFACE) != 0)
flag |= BAKE_FILTER_SUBSURFACE;
if ((pass_filter & BL::BakeSettings::pass_filter_EMIT) != 0)
flag |= BAKE_FILTER_EMISSION;
@@ -693,7 +706,7 @@ void BlenderSession::bake(BL::Depsgraph &b_depsgraph_,
SessionParams session_params = BlenderSync::get_session_params(
b_engine, b_userpref, b_scene, background);
BufferParams buffer_params = BlenderSync::get_buffer_params(
b_scene, b_render, b_v3d, b_rv3d, scene->camera, width, height);
b_render, b_v3d, b_rv3d, scene->camera, width, height);
scene->bake_manager->set_shader_limit((size_t)b_engine.tile_x(), (size_t)b_engine.tile_y());
@@ -838,11 +851,11 @@ void BlenderSession::synchronize(BL::Depsgraph &b_depsgraph_)
if (session->params.modified(session_params) || scene->params.modified(scene_params)) {
free_session();
create_session();
return;
}
/* increase samples, but never decrease */
session->set_samples(session_params.samples);
session->set_denoising_start_sample(session_params.denoising_start_sample);
session->set_pause(session_pause);
/* copy recalc flags, outside of mutex so we can decide to do the real
@@ -873,28 +886,10 @@ void BlenderSession::synchronize(BL::Depsgraph &b_depsgraph_)
else
sync->sync_camera(b_render, b_camera_override, width, height, "");
/* get buffer parameters */
BufferParams buffer_params = BlenderSync::get_buffer_params(
b_scene, b_render, b_v3d, b_rv3d, scene->camera, width, height);
if (session_params.device.type != DEVICE_OPTIX &&
session_params.device.denoising_devices.empty()) {
/* cannot use OptiX denoising when it is not supported by the device. */
buffer_params.denoising_data_pass = false;
}
else {
session->set_denoising(buffer_params.denoising_data_pass, true);
}
if (scene->film->denoising_data_pass != buffer_params.denoising_data_pass) {
scene->film->denoising_data_pass = buffer_params.denoising_data_pass;
/* Force a scene and session reset below. */
scene->film->tag_update(scene);
}
/* reset if needed */
if (scene->need_reset()) {
BufferParams buffer_params = BlenderSync::get_buffer_params(
b_render, b_v3d, b_rv3d, scene->camera, width, height);
session->reset(buffer_params, session_params.samples);
/* After session reset, so device is not accessing image data anymore. */
@@ -961,7 +956,7 @@ bool BlenderSession::draw(int w, int h)
SessionParams session_params = BlenderSync::get_session_params(
b_engine, b_userpref, b_scene, background);
BufferParams buffer_params = BlenderSync::get_buffer_params(
b_scene, b_render, b_v3d, b_rv3d, scene->camera, width, height);
b_render, b_v3d, b_rv3d, scene->camera, width, height);
bool session_pause = BlenderSync::get_session_pause(b_scene, background);
if (session_pause == false) {
@@ -979,7 +974,7 @@ bool BlenderSession::draw(int w, int h)
/* draw */
BufferParams buffer_params = BlenderSync::get_buffer_params(
b_scene, b_render, b_v3d, b_rv3d, scene->camera, width, height);
b_render, b_v3d, b_rv3d, scene->camera, width, height);
DeviceDrawParams draw_params;
if (session->params.display_buffer_linear) {

Some files were not shown because too many files have changed in this diff Show More