Compare commits

..

1 Commits

Author SHA1 Message Date
8ed495f27c Initial popover working 2018-04-22 15:20:59 +02:00
1858 changed files with 42813 additions and 68313 deletions

View File

@@ -2,6 +2,5 @@
"project_id" : "Blender", "project_id" : "Blender",
"conduit_uri" : "https://developer.blender.org/", "conduit_uri" : "https://developer.blender.org/",
"git.default-relative-commit" : "origin/blender2.8", "git.default-relative-commit" : "origin/blender2.8",
"arc.land.update.default" : "rebase", "arc.land.update.default" : "rebase"
"arc.land.onto.default" : "blender2.8"
} }

4
.gitmodules vendored
View File

@@ -3,18 +3,22 @@
url = ../blender-addons.git url = ../blender-addons.git
branch = blender2.8 branch = blender2.8
ignore = all ignore = all
branch = master
[submodule "release/scripts/addons_contrib"] [submodule "release/scripts/addons_contrib"]
path = release/scripts/addons_contrib path = release/scripts/addons_contrib
url = ../blender-addons-contrib.git url = ../blender-addons-contrib.git
branch = master branch = master
ignore = all ignore = all
branch = master
[submodule "release/datafiles/locale"] [submodule "release/datafiles/locale"]
path = release/datafiles/locale path = release/datafiles/locale
url = ../blender-translations.git url = ../blender-translations.git
branch = master branch = master
ignore = all ignore = all
branch = master
[submodule "source/tools"] [submodule "source/tools"]
path = source/tools path = source/tools
url = ../blender-dev-tools.git url = ../blender-dev-tools.git
branch = master branch = master
ignore = all ignore = all
branch = master

View File

@@ -66,12 +66,21 @@ endif()
# set_property(GLOBAL PROPERTY RULE_MESSAGES OFF) # set_property(GLOBAL PROPERTY RULE_MESSAGES OFF)
# global compile definitions since add_definitions() adds for all. # global compile definitions since add_definitions() adds for all.
set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS
$<$<CONFIG:Debug>:DEBUG;_DEBUG> if(NOT (${CMAKE_VERSION} VERSION_LESS 3.0))
$<$<CONFIG:Release>:NDEBUG> set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS
$<$<CONFIG:MinSizeRel>:NDEBUG> $<$<CONFIG:Debug>:DEBUG;_DEBUG>
$<$<CONFIG:RelWithDebInfo>:NDEBUG> $<$<CONFIG:Release>:NDEBUG>
) $<$<CONFIG:MinSizeRel>:NDEBUG>
$<$<CONFIG:RelWithDebInfo>:NDEBUG>
)
else()
# keep until CMake-3.0 is min requirement
set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS_DEBUG DEBUG _DEBUG)
set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS_RELEASE NDEBUG)
set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS_MINSIZEREL NDEBUG)
set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS_RELWITHDEBINFO NDEBUG)
endif()
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
# Set policy # Set policy
@@ -310,6 +319,7 @@ option(WITH_IMAGE_TIFF "Enable LibTIFF Support" ON)
option(WITH_IMAGE_DDS "Enable DDS Image Support" ON) option(WITH_IMAGE_DDS "Enable DDS Image Support" ON)
option(WITH_IMAGE_CINEON "Enable CINEON and DPX Image Support" ON) option(WITH_IMAGE_CINEON "Enable CINEON and DPX Image Support" ON)
option(WITH_IMAGE_HDR "Enable HDR Image Support" ON) option(WITH_IMAGE_HDR "Enable HDR Image Support" ON)
option(WITH_IMAGE_FRAMESERVER "Enable image FrameServer Support for rendering" ON)
# Audio/Video format support # Audio/Video format support
option(WITH_CODEC_AVI "Enable Blenders own AVI file support (raw/jpeg)" ON) option(WITH_CODEC_AVI "Enable Blenders own AVI file support (raw/jpeg)" ON)
@@ -511,52 +521,6 @@ if(CMAKE_COMPILER_IS_GNUCC)
mark_as_advanced(WITH_LINKER_GOLD) mark_as_advanced(WITH_LINKER_GOLD)
endif() endif()
if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID MATCHES "Clang")
option(WITH_COMPILER_ASAN "Build and link against address sanitizer (only for Debug & RelWithDebInfo targets)." OFF)
mark_as_advanced(WITH_COMPILER_ASAN)
if(WITH_COMPILER_ASAN)
set(_asan_defaults "\
-fsanitize=address \
-fsanitize=bool \
-fsanitize=bounds \
-fsanitize=enum \
-fsanitize=float-cast-overflow \
-fsanitize=float-divide-by-zero \
-fsanitize=nonnull-attribute \
-fsanitize=returns-nonnull-attribute \
-fsanitize=signed-integer-overflow \
-fsanitize=undefined \
-fsanitize=vla-bound \
-fno-sanitize=alignment \
")
if(NOT MSVC) # not all sanitizers are supported with clang-cl, these two however are very vocal about it
set(_asan_defaults "${_asan_defaults} -fsanitize=leak -fsanitize=object-size" )
endif()
set(COMPILER_ASAN_CFLAGS "${_asan_defaults}" CACHE STRING "C flags for address sanitizer")
mark_as_advanced(COMPILER_ASAN_CFLAGS)
set(COMPILER_ASAN_CXXFLAGS "${_asan_defaults}" CACHE STRING "C++ flags for address sanitizer")
mark_as_advanced(COMPILER_ASAN_CXXFLAGS)
unset(_asan_defaults)
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
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
)
endif()
mark_as_advanced(COMPILER_ASAN_LIBRARY)
endif()
endif()
# Dependency graph
option(WITH_LEGACY_DEPSGRAPH "Build Blender with legacy dependency graph" ON)
mark_as_advanced(WITH_LEGACY_DEPSGRAPH)
if(WIN32) if(WIN32)
# Use hardcoded paths or find_package to find externals # Use hardcoded paths or find_package to find externals
option(WITH_WINDOWS_FIND_MODULES "Use find_package to locate libraries" OFF) option(WITH_WINDOWS_FIND_MODULES "Use find_package to locate libraries" OFF)
@@ -817,19 +781,6 @@ set(PLATFORM_LINKLIBS "")
set(PLATFORM_LINKFLAGS "") set(PLATFORM_LINKFLAGS "")
set(PLATFORM_LINKFLAGS_DEBUG "") set(PLATFORM_LINKFLAGS_DEBUG "")
if(WITH_COMPILER_ASAN)
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} ${COMPILER_ASAN_CFLAGS}")
set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} ${COMPILER_ASAN_CFLAGS}")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${COMPILER_ASAN_CXXFLAGS}")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} ${COMPILER_ASAN_CXXFLAGS}")
if(MSVC)
set(COMPILER_ASAN_LINKER_FLAGS "/FUNCTIONPADMIN:6")
endif()
set(PLATFORM_LINKLIBS "${PLATFORM_LINKLIBS};${COMPILER_ASAN_LIBRARY}")
set(PLATFORM_LINKFLAGS "${COMPILER_ASAN_LIBRARY} ${COMPILER_ASAN_LINKER_FLAGS}")
set(PLATFORM_LINKFLAGS_DEBUG "${COMPILER_ASAN_LIBRARY} ${COMPILER_ASAN_LINKER_FLAGS}")
endif()
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
#Platform specifics #Platform specifics
@@ -1559,12 +1510,7 @@ else()
endif() endif()
# Visual Studio has all standards it supports available by default # Visual Studio has all standards it supports available by default
# Clang on windows copies this behavior and does not support these switches if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID MATCHES "Clang" OR CMAKE_C_COMPILER_ID MATCHES "Intel")
if(
CMAKE_COMPILER_IS_GNUCC OR
(CMAKE_C_COMPILER_ID MATCHES "Clang" AND (NOT MSVC)) OR
(CMAKE_C_COMPILER_ID MATCHES "Intel")
)
# Use C99 + GNU extensions, works with GCC, Clang, ICC # Use C99 + GNU extensions, works with GCC, Clang, ICC
if(WITH_C11) if(WITH_C11)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu11") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu11")

View File

@@ -236,10 +236,9 @@ help: .FORCE
@echo " * check_descriptions - check for duplicate/invalid descriptions" @echo " * check_descriptions - check for duplicate/invalid descriptions"
@echo "" @echo ""
@echo "Utilities (not associated with building blender)" @echo "Utilities (not associated with building blender)"
@echo " * icons - updates PNG icons from SVG files." @echo " * icons - updates PNG icons from SVG files."
@echo " * icons_geom - updates Geometry icons from BLEND file." @echo " * tgz - create a compressed archive of the source code."
@echo " * tgz - create a compressed archive of the source code." @echo " * update - updates git and all submodules"
@echo " * update - updates git and all submodules"
@echo "" @echo ""
@echo "Environment Variables" @echo "Environment Variables"
@echo " * BUILD_CMAKE_ARGS - arguments passed to CMake." @echo " * BUILD_CMAKE_ARGS - arguments passed to CMake."
@@ -424,12 +423,8 @@ icons: .FORCE
"$(BLENDER_DIR)/release/datafiles/blender_icons_update.py" "$(BLENDER_DIR)/release/datafiles/blender_icons_update.py"
"$(BLENDER_DIR)/release/datafiles/prvicons_update.py" "$(BLENDER_DIR)/release/datafiles/prvicons_update.py"
icons_geom: .FORCE
BLENDER_BIN="$(BUILD_DIR)/bin/blender" \
"$(BLENDER_DIR)/release/datafiles/blender_icons_geom_update.py"
update: .FORCE update: .FORCE
if [ "$(OS_NCASE)" = "darwin" ] && [ ! -d "../lib/$(OS_NCASE)" ]; then \ if [ "$(OS_NCASE)" == "darwin" ] && [ ! -d "../lib/$(OS_NCASE)" ]; then \
svn checkout https://svn.blender.org/svnroot/bf-blender/trunk/lib/$(OS_NCASE) ../lib/$(OS_NCASE) ; \ svn checkout https://svn.blender.org/svnroot/bf-blender/trunk/lib/$(OS_NCASE) ../lib/$(OS_NCASE) ; \
fi fi
if [ -d "../lib" ]; then \ if [ -d "../lib" ]; then \

View File

@@ -103,7 +103,6 @@ ExternalProject_Add(external_ffmpeg
--disable-indev=jack --disable-indev=jack
--disable-indev=alsa --disable-indev=alsa
--disable-outdev=alsa --disable-outdev=alsa
--disable-crystalhd
PATCH_COMMAND ${PATCH_CMD} --verbose -p 0 -N -d ${BUILD_DIR}/ffmpeg/src/external_ffmpeg < ${PATCH_DIR}/ffmpeg.diff PATCH_COMMAND ${PATCH_CMD} --verbose -p 0 -N -d ${BUILD_DIR}/ffmpeg/src/external_ffmpeg < ${PATCH_DIR}/ffmpeg.diff
BUILD_COMMAND ${CONFIGURE_ENV_NO_PERL} && cd ${BUILD_DIR}/ffmpeg/src/external_ffmpeg/ && make -j${MAKE_THREADS} BUILD_COMMAND ${CONFIGURE_ENV_NO_PERL} && cd ${BUILD_DIR}/ffmpeg/src/external_ffmpeg/ && make -j${MAKE_THREADS}
INSTALL_COMMAND ${CONFIGURE_ENV_NO_PERL} && cd ${BUILD_DIR}/ffmpeg/src/external_ffmpeg/ && make install INSTALL_COMMAND ${CONFIGURE_ENV_NO_PERL} && cd ${BUILD_DIR}/ffmpeg/src/external_ffmpeg/ && make install

View File

@@ -13,25 +13,3 @@
-# pragma message("Unknown compiler version - please run the configure tests and report the results") -# pragma message("Unknown compiler version - please run the configure tests and report the results")
-# endif -# endif
-#endif -#endif
--- a/boost/type_traits/has_nothrow_assign.hpp 2015-12-13 05:49:42 -0700
+++ b/boost/type_traits/has_nothrow_assign.hpp 2018-05-27 11:11:02 -0600
@@ -24,7 +24,7 @@
#include <boost/type_traits/remove_reference.hpp>
#endif
#endif
-#if defined(__GNUC__) || defined(__SUNPRO_CC)
+#if defined(__GNUC__) || defined(__SUNPRO_CC) || defined(__clang__)
#include <boost/type_traits/is_const.hpp>
#include <boost/type_traits/is_volatile.hpp>
#include <boost/type_traits/is_assignable.hpp>
--- a/boost/type_traits/has_nothrow_constructor.hpp 2015-12-13 05:49:42 -0700
+++ b/boost/type_traits/has_nothrow_constructor.hpp 2018-05-27 11:11:02 -0600
@@ -17,7 +17,7 @@
#if defined(BOOST_MSVC) || defined(BOOST_INTEL)
#include <boost/type_traits/has_trivial_constructor.hpp>
#endif
-#if defined(__GNUC__ ) || defined(__SUNPRO_CC)
+#if defined(__GNUC__ ) || defined(__SUNPRO_CC) || defined(__clang__)
#include <boost/type_traits/is_default_constructible.hpp>
#endif

View File

@@ -8,7 +8,7 @@ project(OpenVDB)
# -------------------------------------------------------------------------------- # --------------------------------------------------------------------------------
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules") set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules")
# -------------------------------------------------------------------------------- # --------------------------------------------------------------------------------

View File

@@ -88,14 +88,6 @@ elseif(WIN32)
set(DISABLE_RTTI "/EHs- /GR- ") set(DISABLE_RTTI "/EHs- /GR- ")
endif() endif()
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
include(CheckCXXCompilerFlag)
check_cxx_compiler_flag("-flifetime-dse=1" SUPPORTS_FLIFETIME)
if (SUPPORTS_FLIFETIME)
add_definitions(-flifetime-dse=1)
endif()
endif()
# Linker export definitions # Linker export definitions
if (WIN32) if (WIN32)
add_custom_command(OUTPUT tbb.def add_custom_command(OUTPUT tbb.def

View File

@@ -10,29 +10,3 @@ diff -Naur osl/src/external_osl/src/cmake/flexbison.cmake osl_bak/src/external_o
MAIN_DEPENDENCY ${flexsrc} MAIN_DEPENDENCY ${flexsrc}
DEPENDS ${${compiler_headers}} DEPENDS ${${compiler_headers}}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} ) WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} )
--- a/src/include/OSL/oslconfig.h 2016-10-31 16:48:19 -0600
+++ b/src/include/OSL/oslconfig.h 2018-05-27 11:18:08 -0600
@@ -44,12 +44,18 @@
// same if another packages is compiling against OSL and using these headers
// (OSL may be C++11 but the client package may be older, or vice versa --
// use these two symbols to differentiate these cases, when important).
-#if (__cplusplus >= 201402L)
-# define OSL_CPLUSPLUS_VERSION 14
-#elif (__cplusplus >= 201103L)
-# define OSL_CPLUSPLUS_VERSION 11
+
+// Force C++03 for MSVC in blender since svn the libraries are build with that
+#if !defined(_MSC_VER)
+ #if (__cplusplus >= 201402L)
+ # define OSL_CPLUSPLUS_VERSION 14
+ #elif (__cplusplus >= 201103L)
+ # define OSL_CPLUSPLUS_VERSION 11
+ #else
+ # define OSL_CPLUSPLUS_VERSION 3 /* presume C++03 */
+ #endif
#else
-# define OSL_CPLUSPLUS_VERSION 3 /* presume C++03 */
+ # define OSL_CPLUSPLUS_VERSION 3 /* presume C++03 */
#endif
// Symbol export defines

View File

@@ -139,10 +139,6 @@ set(ZLIB_LIBRARY "/usr/lib${MULTILIB}/libz.a" CACHE STRING "" FORCE)
# OpenVDB # OpenVDB
set(OPENVDB_LIBRARY set(OPENVDB_LIBRARY
/opt/lib/openvdb/lib/libopenvdb.a /opt/lib/openvdb/lib/libopenvdb.a
CACHE BOOL "" FORCE
)
set(BLOSC_LIBRARY
/opt/lib/blosc/lib/libblosc.a /opt/lib/blosc/lib/libblosc.a
CACHE BOOL "" FORCE CACHE BOOL "" FORCE
) )

View File

@@ -1,72 +0,0 @@
# - Find Blosc library
# Find the native Blosc includes and library
# This module defines
# BLOSC_INCLUDE_DIRS, where to find blosc.h, Set when
# Blosc is found.
# BLOSC_LIBRARIES, libraries to link against to use Blosc.
# BLOSC_ROOT_DIR, The base directory to search for Blosc.
# This can also be an environment variable.
# BLOSC_FOUND, If false, do not try to use Blosc.
#
# also defined, but not for general use are
# BLOSC_LIBRARY, where to find the Blosc library.
#=============================================================================
# Copyright 2018 Blender Foundation.
#
# 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 BLOSC_ROOT_DIR was defined in the environment, use it.
IF(NOT BLOSC_ROOT_DIR AND NOT $ENV{BLOSC_ROOT_DIR} STREQUAL "")
SET(BLOSC_ROOT_DIR $ENV{BLOSC_ROOT_DIR})
ENDIF()
SET(_blosc_SEARCH_DIRS
${BLOSC_ROOT_DIR}
/usr/local
/sw # Fink
/opt/local # DarwinPorts
/opt/lib/blosc
)
FIND_PATH(BLOSC_INCLUDE_DIR
NAMES
blosc.h
HINTS
${_blosc_SEARCH_DIRS}
PATH_SUFFIXES
include
)
FIND_LIBRARY(BLOSC_LIBRARY
NAMES
blosc
HINTS
${_blosc_SEARCH_DIRS}
PATH_SUFFIXES
lib64 lib
)
# handle the QUIETLY and REQUIRED arguments and set BLOSC_FOUND to TRUE if
# all listed variables are TRUE
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(BLOSC DEFAULT_MSG
BLOSC_LIBRARY BLOSC_INCLUDE_DIR)
IF(BLOSC_FOUND)
SET(BLOSC_LIBRARIES ${BLOSC_LIBRARY})
SET(BLOSC_INCLUDE_DIRS ${BLOSC_INCLUDE_DIR})
ELSE()
SET(BLOSC_BLOSC_FOUND FALSE)
ENDIF()
MARK_AS_ADVANCED(
BLOSC_INCLUDE_DIR
BLOSC_LIBRARY
)

View File

@@ -32,7 +32,6 @@ macro(BLENDER_SRC_GTEST_EX NAME SRC EXTRA_LIBS DO_ADD_TEST)
${EXTRA_LIBS} ${EXTRA_LIBS}
${PLATFORM_LINKLIBS} ${PLATFORM_LINKLIBS}
bf_testing_main bf_testing_main
bf_intern_eigen
bf_intern_guardedalloc bf_intern_guardedalloc
extern_gtest extern_gtest
extern_gmock extern_gmock

View File

@@ -23,6 +23,7 @@ set(WITH_IK_SOLVER ON CACHE BOOL "" FORCE)
set(WITH_IK_ITASC ON CACHE BOOL "" FORCE) set(WITH_IK_ITASC ON CACHE BOOL "" FORCE)
set(WITH_IMAGE_CINEON ON CACHE BOOL "" FORCE) set(WITH_IMAGE_CINEON ON CACHE BOOL "" FORCE)
set(WITH_IMAGE_DDS ON CACHE BOOL "" FORCE) set(WITH_IMAGE_DDS ON CACHE BOOL "" FORCE)
set(WITH_IMAGE_FRAMESERVER ON CACHE BOOL "" FORCE)
set(WITH_IMAGE_HDR ON CACHE BOOL "" FORCE) set(WITH_IMAGE_HDR ON CACHE BOOL "" FORCE)
set(WITH_IMAGE_OPENEXR ON CACHE BOOL "" FORCE) set(WITH_IMAGE_OPENEXR ON CACHE BOOL "" FORCE)
set(WITH_IMAGE_OPENJPEG ON CACHE BOOL "" FORCE) set(WITH_IMAGE_OPENJPEG ON CACHE BOOL "" FORCE)

View File

@@ -28,6 +28,7 @@ set(WITH_IK_SOLVER OFF CACHE BOOL "" FORCE)
set(WITH_IK_ITASC OFF CACHE BOOL "" FORCE) set(WITH_IK_ITASC OFF CACHE BOOL "" FORCE)
set(WITH_IMAGE_CINEON OFF CACHE BOOL "" FORCE) set(WITH_IMAGE_CINEON OFF CACHE BOOL "" FORCE)
set(WITH_IMAGE_DDS OFF CACHE BOOL "" FORCE) set(WITH_IMAGE_DDS OFF CACHE BOOL "" FORCE)
set(WITH_IMAGE_FRAMESERVER OFF CACHE BOOL "" FORCE)
set(WITH_IMAGE_HDR OFF CACHE BOOL "" FORCE) set(WITH_IMAGE_HDR OFF CACHE BOOL "" FORCE)
set(WITH_IMAGE_OPENEXR OFF CACHE BOOL "" FORCE) set(WITH_IMAGE_OPENEXR OFF CACHE BOOL "" FORCE)
set(WITH_IMAGE_OPENJPEG OFF CACHE BOOL "" FORCE) set(WITH_IMAGE_OPENJPEG OFF CACHE BOOL "" FORCE)

View File

@@ -23,6 +23,7 @@ set(WITH_IK_SOLVER ON CACHE BOOL "" FORCE)
set(WITH_IK_ITASC ON CACHE BOOL "" FORCE) set(WITH_IK_ITASC ON CACHE BOOL "" FORCE)
set(WITH_IMAGE_CINEON ON CACHE BOOL "" FORCE) set(WITH_IMAGE_CINEON ON CACHE BOOL "" FORCE)
set(WITH_IMAGE_DDS ON CACHE BOOL "" FORCE) set(WITH_IMAGE_DDS ON CACHE BOOL "" FORCE)
set(WITH_IMAGE_FRAMESERVER ON CACHE BOOL "" FORCE)
set(WITH_IMAGE_HDR ON CACHE BOOL "" FORCE) set(WITH_IMAGE_HDR ON CACHE BOOL "" FORCE)
set(WITH_IMAGE_OPENEXR ON CACHE BOOL "" FORCE) set(WITH_IMAGE_OPENEXR ON CACHE BOOL "" FORCE)
set(WITH_IMAGE_OPENJPEG ON CACHE BOOL "" FORCE) set(WITH_IMAGE_OPENJPEG ON CACHE BOOL "" FORCE)

View File

@@ -352,11 +352,6 @@ function(SETUP_LIBDIRS)
endif() endif()
endfunction() endfunction()
macro(setup_platform_linker_flags)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${PLATFORM_LINKFLAGS}")
set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} ${PLATFORM_LINKFLAGS_DEBUG}")
endmacro()
function(setup_liblinks function(setup_liblinks
target target
) )
@@ -430,7 +425,7 @@ function(setup_liblinks
target_link_libraries(${target} ${OPENSUBDIV_LIBRARIES}) target_link_libraries(${target} ${OPENSUBDIV_LIBRARIES})
endif() endif()
if(WITH_OPENVDB) if(WITH_OPENVDB)
target_link_libraries(${target} ${OPENVDB_LIBRARIES} ${TBB_LIBRARIES} ${BLOSC_LIBRARIES}) target_link_libraries(${target} ${OPENVDB_LIBRARIES} ${TBB_LIBRARIES})
endif() endif()
if(WITH_CYCLES_OSL) if(WITH_CYCLES_OSL)
target_link_libraries(${target} ${OSL_LIBRARIES}) target_link_libraries(${target} ${OSL_LIBRARIES})
@@ -586,7 +581,6 @@ function(SETUP_BLENDER_SORTED_LIBS)
bf_editor_space_outliner bf_editor_space_outliner
bf_editor_space_script bf_editor_space_script
bf_editor_space_sequencer bf_editor_space_sequencer
bf_editor_space_statusbar
bf_editor_space_text bf_editor_space_text
bf_editor_space_time bf_editor_space_time
bf_editor_space_topbar bf_editor_space_topbar

View File

@@ -358,7 +358,7 @@ if(WITH_LLVM)
execute_process(COMMAND ${LLVM_CONFIG} --libfiles execute_process(COMMAND ${LLVM_CONFIG} --libfiles
OUTPUT_VARIABLE LLVM_LIBRARY OUTPUT_VARIABLE LLVM_LIBRARY
OUTPUT_STRIP_TRAILING_WHITESPACE) OUTPUT_STRIP_TRAILING_WHITESPACE)
string(REPLACE ".a /" ".a;/" LLVM_LIBRARY ${LLVM_LIBRARY}) string(REPLACE " " ";" LLVM_LIBRARY ${LLVM_LIBRARY})
else() else()
set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -lLLVM-3.4") set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -lLLVM-3.4")
endif() endif()
@@ -418,7 +418,7 @@ if(${XCODE_VERSION} VERSION_EQUAL 5 OR ${XCODE_VERSION} VERSION_GREATER 5)
endif() endif()
# Get rid of eventually clashes, we export some symbols explicite as local # Get rid of eventually clashes, we export some symbols explicite as local
set(PLATFORM_LINKFLAGS set(PLATFORM_LINKFLAGS
"${PLATFORM_LINKFLAGS} -Xlinker -unexported_symbols_list -Xlinker '${CMAKE_SOURCE_DIR}/source/creator/osx_locals.map'" "${PLATFORM_LINKFLAGS} -Xlinker -unexported_symbols_list -Xlinker ${CMAKE_SOURCE_DIR}/source/creator/osx_locals.map"
) )
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")

View File

@@ -237,14 +237,10 @@ endif()
if(WITH_OPENVDB) if(WITH_OPENVDB)
find_package_wrapper(OpenVDB) find_package_wrapper(OpenVDB)
find_package_wrapper(TBB) find_package_wrapper(TBB)
find_package_wrapper(Blosc)
if(NOT OPENVDB_FOUND OR NOT TBB_FOUND) if(NOT OPENVDB_FOUND OR NOT TBB_FOUND)
set(WITH_OPENVDB OFF) set(WITH_OPENVDB OFF)
set(WITH_OPENVDB_BLOSC OFF) set(WITH_OPENVDB_BLOSC OFF)
message(STATUS "OpenVDB not found, disabling it") message(STATUS "OpenVDB not found, disabling it")
elseif(NOT BLOSC_FOUND)
set(WITH_OPENVDB_BLOSC OFF)
message(STATUS "Blosc not found, disabling it")
endif() endif()
endif() endif()

View File

@@ -29,15 +29,7 @@ if(NOT MSVC)
message(FATAL_ERROR "Compiler is unsupported") message(FATAL_ERROR "Compiler is unsupported")
endif() endif()
if(CMAKE_C_COMPILER_ID MATCHES "Clang") # Libraries configuration for Windows when compiling with MSVC.
set(MSVC_CLANG On)
set(MSVC_REDIST_DIR $ENV{VCToolsRedistDir})
if (DEFINED MSVC_REDIST_DIR)
file(TO_CMAKE_PATH ${MSVC_REDIST_DIR} MSVC_REDIST_DIR)
else()
message("Unable to detect the Visual Studio redist directory, copying of the runtime dlls will not work, try running from the visual studio developer prompt.")
endif()
endif()
set_property(GLOBAL PROPERTY USE_FOLDERS ${WINDOWS_USE_VISUAL_STUDIO_FOLDERS}) set_property(GLOBAL PROPERTY USE_FOLDERS ${WINDOWS_USE_VISUAL_STUDIO_FOLDERS})
@@ -127,18 +119,8 @@ set(CMAKE_INSTALL_OPENMP_LIBRARIES ${WITH_OPENMP})
set(CMAKE_INSTALL_SYSTEM_RUNTIME_DESTINATION .) set(CMAKE_INSTALL_SYSTEM_RUNTIME_DESTINATION .)
include(InstallRequiredSystemLibraries) include(InstallRequiredSystemLibraries)
remove_cc_flag("/MDd" "/MD") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /nologo /J /Gd /MP /EHsc")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /nologo /J /Gd /MP")
if(MSVC_CLANG) # Clangs version of cl doesn't support all flags
if(NOT WITH_CXX11) # C++11 is on by default in clang-cl and can't be turned off, if c++11 is not enabled in blender repress some c++11 related warnings.
set(CXX_WARN_FLAGS "-Wno-inconsistent-missing-override")
endif()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CXX_WARN_FLAGS} /nologo /J /Gd /EHsc -Wno-unused-command-line-argument -Wno-microsoft-enum-forward-reference ")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /nologo /J /Gd -Wno-unused-command-line-argument -Wno-microsoft-enum-forward-reference")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /nologo /J /Gd /MP /EHsc")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /nologo /J /Gd /MP")
endif()
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MTd") set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MTd")
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /MTd") set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /MTd")
@@ -149,7 +131,7 @@ set(CMAKE_C_FLAGS_MINSIZEREL "${CMAKE_C_FLAGS_MINSIZEREL} /MT")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} /MT") set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} /MT")
set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} /MT") set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} /MT")
set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} /SUBSYSTEM:CONSOLE /STACK:2097152 /INCREMENTAL:NO ") set(PLATFORM_LINKFLAGS "/SUBSYSTEM:CONSOLE /STACK:2097152 /INCREMENTAL:NO ")
set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} /NODEFAULTLIB:msvcrt.lib /NODEFAULTLIB:msvcmrt.lib /NODEFAULTLIB:msvcurt.lib /NODEFAULTLIB:msvcrtd.lib ") set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} /NODEFAULTLIB:msvcrt.lib /NODEFAULTLIB:msvcmrt.lib /NODEFAULTLIB:msvcurt.lib /NODEFAULTLIB:msvcrtd.lib ")
# Ignore meaningless for us linker warnings. # Ignore meaningless for us linker warnings.
@@ -162,7 +144,7 @@ else()
set(PLATFORM_LINKFLAGS "/MACHINE:IX86 /LARGEADDRESSAWARE ${PLATFORM_LINKFLAGS}") set(PLATFORM_LINKFLAGS "/MACHINE:IX86 /LARGEADDRESSAWARE ${PLATFORM_LINKFLAGS}")
endif() endif()
set(PLATFORM_LINKFLAGS_DEBUG "${PLATFORM_LINKFLAGS_DEBUG} /IGNORE:4099 /NODEFAULTLIB:libcmt.lib /NODEFAULTLIB:libc.lib") set(PLATFORM_LINKFLAGS_DEBUG "/IGNORE:4099 /NODEFAULTLIB:libcmt.lib /NODEFAULTLIB:libc.lib")
if(NOT DEFINED LIBDIR) if(NOT DEFINED LIBDIR)

View File

@@ -1,17 +0,0 @@
echo No explicit msvc version requested, autodetecting version.
call "%~dp0\detect_msvc2013.cmd"
if %ERRORLEVEL% EQU 0 goto DetectionComplete
call "%~dp0\detect_msvc2015.cmd"
if %ERRORLEVEL% EQU 0 goto DetectionComplete
call "%~dp0\detect_msvc2017.cmd"
if %ERRORLEVEL% EQU 0 goto DetectionComplete
echo Compiler Detection failed. Use verbose switch for more information.
exit /b 1
:DetectionComplete
echo Compiler Detection successfull, detected VS%BUILD_VS_YEAR%
exit /b 0

View File

@@ -1,26 +0,0 @@
if "%NOBUILD%"=="1" goto EOF
echo %TIME% > %BUILD_DIR%\buildtime.txt
msbuild ^
%BUILD_DIR%\Blender.sln ^
/target:build ^
/property:Configuration=%BUILD_TYPE% ^
/maxcpucount:2 ^
/verbosity:minimal ^
/p:platform=%MSBUILD_PLATFORM% ^
/flp:Summary;Verbosity=minimal;LogFile=%BUILD_DIR%\Build.log
if errorlevel 1 (
echo Error during build, see %BUILD_DIR%\Build.log for details
exit /b 1
)
msbuild ^
%BUILD_DIR%\INSTALL.vcxproj ^
/property:Configuration=%BUILD_TYPE% ^
/verbosity:minimal ^
/p:platform=%MSBUILD_PLATFORM%
if errorlevel 1 (
echo Error during install phase
exit /b 1
)
echo %TIME% >> %BUILD_DIR%\buildtime.txt
:EOF

View File

@@ -1,16 +0,0 @@
if "%NOBUILD%"=="1" goto EOF
set HAS_ERROR=
cd %BUILD_DIR%
echo %TIME% > buildtime.txt
ninja install
if errorlevel 1 (
set HAS_ERROR=1
)
echo %TIME% >>buildtime.txt
cd %BLENDER_DIR%
if "%HAS_ERROR%" == "1" (
echo Error during build
exit /b 1
)
:EOF

View File

@@ -1,54 +0,0 @@
if "%BUILD_VS_YEAR%"=="2013" set BUILD_VS_LIBDIRPOST=vc12
if "%BUILD_VS_YEAR%"=="2015" set BUILD_VS_LIBDIRPOST=vc14
if "%BUILD_VS_YEAR%"=="2017" set BUILD_VS_LIBDIRPOST=vc14
if "%BUILD_ARCH%"=="x64" (
set BUILD_VS_SVNDIR=win64_%BUILD_VS_LIBDIRPOST%
) else if "%BUILD_ARCH%"=="x86" (
set BUILD_VS_SVNDIR=windows_%BUILD_VS_LIBDIRPOST%
)
set BUILD_VS_LIBDIR="%BLENDER_DIR%..\lib\%BUILD_VS_SVNDIR%"
if NOT "%verbose%" == "" (
echo Library Directory = "%BUILD_VS_LIBDIR%"
)
if NOT EXIST %BUILD_VS_LIBDIR% (
rem libs not found, but svn is on the system
echo
if not "%SVN%"=="" (
echo.
echo The required external libraries in %BUILD_VS_LIBDIR% are missing
echo.
set /p GetLibs= "Would you like to download them? (y/n)"
if /I "!GetLibs!"=="Y" (
echo.
echo Downloading %BUILD_VS_SVNDIR% libraries, please wait.
echo.
:RETRY
"%SVN%" checkout https://svn.blender.org/svnroot/bf-blender/trunk/lib/%BUILD_VS_SVNDIR% %BUILD_VS_LIBDIR%
if errorlevel 1 (
set /p LibRetry= "Error during donwload, retry? y/n"
if /I "!LibRetry!"=="Y" (
cd %BUILD_VS_LIBDIR%
"%SVN%" cleanup
cd %BLENDER_DIR%
goto RETRY
)
echo.
echo Error: Download of external libraries failed.
echo This is needed for building, please manually run 'svn cleanup' and 'svn update' in
echo %BUILD_VS_LIBDIR% , until this is resolved you CANNOT make a successfull blender build
echo.
exit /b 1
)
)
)
)
if NOT EXIST %BUILD_VS_LIBDIR% (
echo.
echo Error: Required libraries not found at "%BUILD_VS_LIBDIR%"
echo This is needed for building, aborting!
echo.
exit /b 1
)

View File

@@ -1,6 +0,0 @@
set BLENDER_DIR_NOSPACES=%BLENDER_DIR: =%
if not "%BLENDER_DIR%"=="%BLENDER_DIR_NOSPACES%" (
echo There are spaces detected in the build path "%BLENDER_DIR%", this is currently not supported, exiting....
exit /b 1
)

View File

@@ -1,20 +0,0 @@
if NOT exist "%BLENDER_DIR%/source/tools" (
echo Checking out sub-modules
if not "%GIT%" == "" (
"%GIT%" submodule update --init --recursive --progress
if errorlevel 1 goto FAIL
"%GIT%" submodule foreach git checkout master
if errorlevel 1 goto FAIL
"%GIT%" submodule foreach git pull --rebase origin master
if errorlevel 1 goto FAIL
goto EOF
) else (
echo Blender submodules not found, and git not found in path to retrieve them.
goto FAIL
)
)
goto EOF
:FAIL
exit /b 1
:EOF

View File

@@ -1,75 +0,0 @@
set BUILD_CMAKE_ARGS=%BUILD_CMAKE_ARGS% -G "Visual Studio %BUILD_VS_VER% %BUILD_VS_YEAR%%WINDOWS_ARCH%" %TESTS_CMAKE_ARGS%
if "%BUILD_ARCH%"=="x64" (
set MSBUILD_PLATFORM=x64
) else if "%BUILD_ARCH%"=="x86" (
set MSBUILD_PLATFORM=win32
if "%WITH_CLANG%"=="1" (
echo Clang not supported for X86
exit /b 1
)
)
if "%WITH_CLANG%"=="1" (
set BUILD_CMAKE_ARGS=%BUILD_CMAKE_ARGS% -T"LLVM-vs2017"
if "%WITH_ASAN%"=="1" (
set BUILD_CMAKE_ARGS=%BUILD_CMAKE_ARGS% -DWITH_COMPILER_ASAN=On
)
) else (
if "%WITH_ASAN%"=="1" (
echo ASAN is only supported with clang.
exit /b 1
)
)
if NOT EXIST %BUILD_DIR%\nul (
mkdir %BUILD_DIR%
)
if "%MUST_CLEAN%"=="1" (
echo Cleaning %BUILD_DIR%
msbuild ^
%BUILD_DIR%\Blender.sln ^
/target:clean ^
/property:Configuration=%BUILD_TYPE% ^
/verbosity:minimal ^
/p:platform=%MSBUILD_PLATFORM%
)
if NOT EXIST %BUILD_DIR%\Blender.sln set MUST_CONFIGURE=1
if "%NOBUILD%"=="1" set MUST_CONFIGURE=1
if "%MUST_CONFIGURE%"=="1" (
if NOT "%verbose%" == "" (
echo %CMAKE% %BUILD_CMAKE_ARGS% -H%BLENDER_DIR% -B%BUILD_DIR%
)
cmake ^
%BUILD_CMAKE_ARGS% ^
-H%BLENDER_DIR% ^
-B%BUILD_DIR%
if %ERRORLEVEL% NEQ 0 (
echo "Configuration Failed"
exit /b 1
)
)
echo call "%VCVARS%" %BUILD_ARCH% > %BUILD_DIR%\rebuild.cmd
echo "%CMAKE%" . >> %BUILD_DIR%\rebuild.cmd
echo echo %%TIME%% ^> buildtime.txt >> %BUILD_DIR%\rebuild.cmd
echo msbuild ^
%BUILD_DIR%\Blender.sln ^
/target:build ^
/property:Configuration=%BUILD_TYPE% ^
/maxcpucount:2 ^
/verbosity:minimal ^
/p:platform=%MSBUILD_PLATFORM% ^
/flp:Summary;Verbosity=minimal;LogFile=%BUILD_DIR%\Build.log >> %BUILD_DIR%\rebuild.cmd
echo msbuild ^
%BUILD_DIR%\INSTALL.vcxproj ^
/property:Configuration=%BUILD_TYPE% ^
/verbosity:minimal ^
/p:platform=%MSBUILD_PLATFORM% >> %BUILD_DIR%\rebuild.cmd
echo echo %%TIME%% ^>^> buildtime.txt >> %BUILD_DIR%\rebuild.cmd

View File

@@ -1,74 +0,0 @@
set BUILD_CMAKE_ARGS=%BUILD_CMAKE_ARGS% -G "Ninja" %TESTS_CMAKE_ARGS% -DCMAKE_BUILD_TYPE=%BUILD_TYPE%
if "%WITH_CLANG%" == "1" (
set LLVM_DIR=
for /F "usebackq skip=2 tokens=1-2*" %%A IN (`REG QUERY "HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\LLVM\LLVM" /ve 2^>nul`) DO set LLVM_DIR=%%C
if DEFINED LLVM_DIR (
if NOT "%verbose%" == "" (
echo LLVM Detected at "%LLVM_DIR%"
)
goto DetectionComplete
)
REM Check 32 bits
for /F "usebackq skip=2 tokens=1-2*" %%A IN (`REG QUERY "HKEY_LOCAL_MACHINE\SOFTWARE\LLVM\LLVM" /ve 2^>nul`) DO set LLVM_DIR=%%C
if DEFINED LLVM_DIR (
if NOT "%verbose%" == "" (
echo LLVM Detected at "%LLVM_DIR%"
)
goto DetectionComplete
)
echo LLVM not found
exit /b 1
:DetectionComplete
set CC=%LLVM_DIR%\bin\clang-cl
set CXX=%LLVM_DIR%\bin\clang-cl
rem build and tested against 2017 15.7
set CFLAGS=-m64 -fmsc-version=1914
set CXXFLAGS=-m64 -fmsc-version=1914
if "%WITH_ASAN%"=="1" (
set BUILD_CMAKE_ARGS=%BUILD_CMAKE_ARGS% -DWITH_COMPILER_ASAN=On
)
)
if "%WITH_ASAN%"=="1" (
if "%WITH_CLANG%" == "" (
echo ASAN is only supported with clang.
exit /b 1
)
)
if NOT "%verbose%" == "" (
echo BUILD_CMAKE_ARGS=%BUILD_CMAKE_ARGS%
)
if NOT EXIST %BUILD_DIR%\nul (
mkdir %BUILD_DIR%
)
if "%MUST_CLEAN%"=="1" (
echo Cleaning %BUILD_DIR%
cd %BUILD_DIR%
%CMAKE% cmake --build . --config Clean
)
if NOT EXIST %BUILD_DIR%\Blender.sln set MUST_CONFIGURE=1
if "%NOBUILD%"=="1" set MUST_CONFIGURE=1
if "%MUST_CONFIGURE%"=="1" (
cmake ^
%BUILD_CMAKE_ARGS% ^
-H%BLENDER_DIR% ^
-B%BUILD_DIR%
if %ERRORLEVEL% NEQ 0 (
echo "Configuration Failed"
exit /b 1
)
)
echo call "%VCVARS%" %BUILD_ARCH% > %BUILD_DIR%\rebuild.cmd
echo echo %%TIME%% ^> buildtime.txt >> %BUILD_DIR%\rebuild.cmd
echo ninja install >> %BUILD_DIR%\rebuild.cmd
echo echo %%TIME%% ^>^> buildtime.txt >> %BUILD_DIR%\rebuild.cmd

View File

@@ -1,16 +0,0 @@
if "%BUILD_ARCH%"=="" (
if "%PROCESSOR_ARCHITECTURE%" == "AMD64" (
set WINDOWS_ARCH= Win64
set BUILD_ARCH=x64
) else if "%PROCESSOR_ARCHITEW6432%" == "AMD64" (
set WINDOWS_ARCH= Win64
set BUILD_ARCH=x64
) else (
set WINDOWS_ARCH=
set BUILD_ARCH=x86
)
) else if "%BUILD_ARCH%"=="x64" (
set WINDOWS_ARCH= Win64
) else if "%BUILD_ARCH%"=="x86" (
set WINDOWS_ARCH=
)

View File

@@ -1,3 +0,0 @@
set BUILD_VS_VER=12
set BUILD_VS_YEAR=2013
call "%~dp0\detect_msvc_classic.cmd"

View File

@@ -1,3 +0,0 @@
set BUILD_VS_VER=14
set BUILD_VS_YEAR=2015
call "%~dp0\detect_msvc_classic.cmd"

View File

@@ -1,70 +0,0 @@
if NOT "%verbose%" == "" (
echo Detecting msvc 2017
)
set BUILD_VS_VER=15
set ProgramFilesX86=%ProgramFiles(x86)%
if not exist "%ProgramFilesX86%" set ProgramFilesX86=%ProgramFiles%
set vs_where=%ProgramFilesX86%\Microsoft Visual Studio\Installer\vswhere.exe
if not exist "%vs_where%" (
if NOT "%verbose%" == "" (
echo Visual Studio 2017 ^(15.2 or newer^) is not detected
goto FAIL
)
)
for /f "usebackq tokens=1* delims=: " %%i in (`"%vs_where%" -products * -latest %VSWHERE_ARGS% -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64`) do (
if /i "%%i"=="installationPath" set VS_InstallDir=%%j
)
if "%VS_InstallDir%"=="" (
if NOT "%verbose%" == "" (
echo Visual Studio is detected but the "Desktop development with C++" workload has not been instlled
goto FAIL
)
)
set VCVARS=%VS_InstallDir%\VC\Auxiliary\Build\vcvarsall.bat
if exist "%VCVARS%" (
call "%VCVARS%" %BUILD_ARCH%
) else (
if NOT "%verbose%" == "" (
echo "%VCVARS%" not found
)
goto FAIL
)
rem try msbuild
msbuild /version > NUL
if errorlevel 1 (
if NOT "%verbose%" == "" (
echo Visual Studio %BUILD_VS_YEAR% msbuild not found
)
goto FAIL
)
if NOT "%verbose%" == "" (
echo Visual Studio %BUILD_VS_YEAR% msbuild found
)
REM try the c++ compiler
cl 2> NUL 1>&2
if errorlevel 1 (
if NOT "%verbose%" == "" (
echo Visual Studio %BUILD_VS_YEAR% C/C++ Compiler not found
)
goto FAIL
)
if NOT "%verbose%" == "" (
echo Visual Studio %BUILD_VS_YEAR% C/C++ Compiler found
)
if NOT "%verbose%" == "" (
echo Visual Studio 2017 is detected successfully
)
goto EOF
:FAIL
exit /b 1
:EOF

View File

@@ -1,69 +0,0 @@
if NOT "%verbose%" == "" (
echo Detecting msvc %BUILD_VS_YEAR%
)
set KEY_NAME="HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\%BUILD_VS_VER%.0\Setup\VC"
for /F "usebackq skip=2 tokens=1-2*" %%A IN (`REG QUERY %KEY_NAME% /v ProductDir 2^>nul`) DO set MSVC_VC_DIR=%%C
if DEFINED MSVC_VC_DIR (
if NOT "%verbose%" == "" (
echo Visual Studio %BUILD_VS_YEAR% on Win64 detected at "%MSVC_VC_DIR%"
)
goto msvc_detect_finally
)
REM Check 32 bits
set KEY_NAME="HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\%BUILD_VS_VER%.0\Setup\VC"
for /F "usebackq skip=2 tokens=1-2*" %%A IN (`REG QUERY %KEY_NAME% /v ProductDir 2^>nul`) DO set MSVC_VC_DIR=%%C
if DEFINED MSVC_VC_DIR (
if NOT "%verbose%" == "" (
echo Visual Studio %BUILD_VS_YEAR% on Win32 detected at "%MSVC_VC_DIR%"
)
goto msvc_detect_finally
)
if NOT "%verbose%" == "" (
echo Visual Studio %BUILD_VS_YEAR% not found.
)
goto FAIL
:msvc_detect_finally
set VCVARS=%MSVC_VC_DIR%\vcvarsall.bat
if not exist "%VCVARS%" (
echo "%VCVARS%" not found.
goto FAIL
)
call "%vcvars%" %BUILD_ARCH%
rem try msbuild
msbuild /version > NUL
if errorlevel 1 (
if NOT "%verbose%" == "" (
echo Visual Studio %BUILD_VS_YEAR% msbuild not found
)
goto FAIL
)
if NOT "%verbose%" == "" (
echo Visual Studio %BUILD_VS_YEAR% msbuild found
)
REM try the c++ compiler
cl 2> NUL 1>&2
if errorlevel 1 (
if NOT "%verbose%" == "" (
echo Visual Studio %BUILD_VS_YEAR% C/C++ Compiler not found
)
goto FAIL
)
if NOT "%verbose%" == "" (
echo Visual Studio %BUILD_VS_YEAR% C/C++ Compiler found
)
goto DetectionComplete
:FAIL
exit /b 1
:DetectionComplete
if NOT "%verbose%" == "" (
echo Visual Studio %BUILD_VS_YEAR% Detected successfuly
)
exit /b 0

View File

@@ -1,13 +0,0 @@
REM find all dependencies and set the corresponding environement variables.
for %%X in (svn.exe) do (set SVN=%%~$PATH:X)
for %%X in (cmake.exe) do (set CMAKE=%%~$PATH:X)
for %%X in (git.exe) do (set GIT=%%~$PATH:X)
if NOT "%verbose%" == "" (
echo svn : %SVN%
echo cmake : %CMAKE%
echo git : %GIT%
)
if "%CMAKE%" == "" (
echo Cmake not found in path, required for building, exiting...
exit /b 1
)

View File

@@ -1,84 +0,0 @@
set BUILD_DIR=%BLENDER_DIR%..\build_windows
set BUILD_TYPE=Release
:argv_loop
if NOT "%1" == "" (
REM Help Message
if "%1" == "help" (
set SHOW_HELP=1
goto EOF
)
REM Build Types
if "%1" == "debug" (
set BUILD_TYPE=Debug
REM Build Configurations
) else if "%1" == "noge" (
set BUILD_CMAKE_ARGS=%BUILD_CMAKE_ARGS% -DWITH_GAMEENGINE=OFF -DWITH_PLAYER=OFF
set BUILD_NGE=_noge
) else if "%1" == "builddir" (
set BUILD_DIR_OVERRRIDE="%BLENDER_DIR%..\%2"
shift /1
) else if "%1" == "with_tests" (
set TESTS_CMAKE_ARGS=-DWITH_GTESTS=On
) else if "%1" == "full" (
set TARGET=Full
set BUILD_CMAKE_ARGS=%BUILD_CMAKE_ARGS% ^
-C"%BLENDER_DIR%\build_files\cmake\config\blender_full.cmake"
) else if "%1" == "lite" (
set TARGET=Lite
set BUILD_CMAKE_ARGS=%BUILD_CMAKE_ARGS% -C"%BLENDER_DIR%\build_files\cmake\config\blender_lite.cmake"
) else if "%1" == "cycles" (
set TARGET=Cycles
set BUILD_CMAKE_ARGS=%BUILD_CMAKE_ARGS% -C"%BLENDER_DIR%\build_files\cmake\config\cycles_standalone.cmake"
) else if "%1" == "headless" (
set TARGET=Headless
set BUILD_CMAKE_ARGS=%BUILD_CMAKE_ARGS% -C"%BLENDER_DIR%\build_files\cmake\config\blender_headless.cmake"
) else if "%1" == "bpy" (
set TARGET=Bpy
set BUILD_CMAKE_ARGS=%BUILD_CMAKE_ARGS% -C"%BLENDER_DIR%\build_files\cmake\config\bpy_module.cmake"
) else if "%1" == "clang" (
set BUILD_CMAKE_ARGS=%BUILD_CMAKE_ARGS%
set WITH_CLANG=1
) else if "%1" == "release" (
set BUILD_CMAKE_ARGS=%BUILD_CMAKE_ARGS% -C"%BLENDER_DIR%\build_files\cmake\config\blender_release.cmake"
set TARGET=Release
) else if "%1" == "asan" (
set WITH_ASAN=1
) else if "%1" == "x86" (
set BUILD_ARCH=x86
) else if "%1" == "x64" (
set BUILD_ARCH=x64
) else if "%1" == "2017" (
set BUILD_VS_YEAR=2017
) else if "%1" == "2017pre" (
set BUILD_VS_YEAR=2017
set VSWHERE_ARGS=-prerelease
) else if "%1" == "2015" (
set BUILD_VS_YEAR=2015
) else if "%1" == "2013" (
set BUILD_VS_YEAR=2013
) else if "%1" == "packagename" (
set BUILD_CMAKE_ARGS=%BUILD_CMAKE_ARGS% -DCPACK_OVERRIDE_PACKAGENAME="%2"
shift /1
) else if "%1" == "nobuild" (
set NOBUILD=1
) else if "%1" == "showhash" (
SET BUILD_SHOW_HASHES=1
REM Non-Build Commands
) else if "%1" == "update" (
SET BUILD_UPDATE=1
) else if "%1" == "ninja" (
SET BUILD_WITH_NINJA=1
) else if "%1" == "clean" (
set MUST_CLEAN=1
) else if "%1" == "verbose" (
set VERBOSE=1
) else (
echo Command "%1" unknown, aborting!
exit /b 1
)
shift /1
goto argv_loop
)
:EOF
exit /b 0

View File

@@ -1,25 +0,0 @@
rem reset all variables so they do not get accidentally get carried over from previous builds
set BUILD_DIR_OVERRRIDE=
set BUILD_CMAKE_ARGS=
set BUILD_ARCH=
set BUILD_VS_VER=
set BUILD_VS_YEAR=
set BUILD_VS_LIBDIRPOST=
set BUILD_VS_LIBDIR=
set BUILD_VS_SVNDIR=
set BUILD_NGE=
set KEY_NAME=
set MSBUILD_PLATFORM=
set MUST_CLEAN=
set NOBUILD=
set TARGET=
set VERBOSE=
set WINDOWS_ARCH=
set TESTS_CMAKE_ARGS=
set VSWHERE_ARGS=
set BUILD_UPDATE=
set BUILD_SHOW_HASHES=
set SHOW_HELP=
set BUILD_WITH_NINJA=
set WITH_CLANG=
set WITH_ASAN=

View File

@@ -1,4 +0,0 @@
set BUILD_DIR=%BUILD_DIR%_%TARGET%%BUILD_NGE%_%BUILD_ARCH%_vc%BUILD_VS_VER%_%BUILD_TYPE%
if NOT "%BUILD_DIR_OVERRRIDE%"=="" (
set BUILD_DIR=%BUILD_DIR_OVERRRIDE%
)

View File

@@ -1,12 +0,0 @@
if "%GIT%" == "" (
echo Git not found, cannot show hashes.
goto EOF
)
cd "%BLENDER_DIR%"
for /f "delims=" %%i in ('%GIT% rev-parse HEAD') do echo Branch_hash=%%i
cd "%BLENDER_DIR%/release/datafiles/locale"
for /f "delims=" %%i in ('%GIT% rev-parse HEAD') do echo Locale_hash=%%i
cd "%BLENDER_DIR%/release/scripts/addons"
for /f "delims=" %%i in ('%GIT% rev-parse HEAD') do echo Addons_Hash=%%i
cd "%BLENDER_DIR%"
:EOF

View File

@@ -1,29 +0,0 @@
echo.
echo Convenience targets
echo - release ^(identical to the official blender.org builds^)
echo - full ^(same as release minus the cuda kernels^)
echo - lite
echo - headless
echo - cycles
echo - bpy
echo.
echo Utilities ^(not associated with building^)
echo - clean ^(Target must be set^)
echo - update
echo - nobuild ^(only generate project files^)
echo - showhash ^(Show git hashes of source tree^)
echo.
echo Configuration options
echo - verbose ^(enable diagnostic output during configuration^)
echo - with_tests ^(enable building unit tests^)
echo - noge ^(disable building game enginge and player^)
echo - debug ^(Build an unoptimized debuggable build^)
echo - packagename [newname] ^(override default cpack package name^)
echo - buildir [newdir] ^(override default build folder^)
echo - x86 ^(override host auto-detect and build 32 bit code^)
echo - x64 ^(override host auto-detect and build 64 bit code^)
echo - 2013 ^(build with visual studio 2013^)
echo - 2015 ^(build with visual studio 2015^) [EXPERIMENTAL]
echo - 2017 ^(build with visual studio 2017^) [EXPERIMENTAL]
echo - 2017pre ^(build with visual studio 2017 pre-release^) [EXPERIMENTAL]
echo.

View File

@@ -1,16 +0,0 @@
if "%SVN%" == "" (
echo svn not found, cannot update libraries
goto UPDATE_GIT
)
"%SVN%" up "%BLENDER_DIR%/../lib/*"
:UPDATE_GIT
if "%GIT%" == "" (
echo Git not found, cannot update code
goto EOF
)
"%GIT%" pull --rebase
"%GIT%" submodule foreach git pull --rebase origin master
:EOF

View File

@@ -20,6 +20,6 @@ The execution context is one of:
'EXEC_SCREEN') 'EXEC_SCREEN')
""" """
# collection add popup # group add popup
import bpy import bpy
bpy.ops.object.collection_instance_add('INVOKE_DEFAULT') bpy.ops.object.group_instance_add('INVOKE_DEFAULT')

View File

@@ -335,7 +335,7 @@ template<> EIGEN_STRONG_INLINE void prefetch<float>(const float* addr) { _mm_p
template<> EIGEN_STRONG_INLINE void prefetch<double>(const double* addr) { _mm_prefetch((const char*)(addr), _MM_HINT_T0); } template<> EIGEN_STRONG_INLINE void prefetch<double>(const double* addr) { _mm_prefetch((const char*)(addr), _MM_HINT_T0); }
template<> EIGEN_STRONG_INLINE void prefetch<int>(const int* addr) { _mm_prefetch((const char*)(addr), _MM_HINT_T0); } template<> EIGEN_STRONG_INLINE void prefetch<int>(const int* addr) { _mm_prefetch((const char*)(addr), _MM_HINT_T0); }
#if defined(_MSC_VER) && defined(_WIN64) && !defined(__INTEL_COMPILER) && !defined(__clang__) #if defined(_MSC_VER) && defined(_WIN64) && !defined(__INTEL_COMPILER)
// The temporary variable fixes an internal compilation error in vs <= 2008 and a wrong-result bug in vs 2010 // The temporary variable fixes an internal compilation error in vs <= 2008 and a wrong-result bug in vs 2010
// Direct of the struct members fixed bug #62. // Direct of the struct members fixed bug #62.
template<> EIGEN_STRONG_INLINE float pfirst<Packet4f>(const Packet4f& a) { return a.m128_f32[0]; } template<> EIGEN_STRONG_INLINE float pfirst<Packet4f>(const Packet4f& a) { return a.m128_f32[0]; }

View File

@@ -1,12 +0,0 @@
diff -Naur c:\blender-git\blender\extern\Eigen3/Eigen/src/Core/arch/SSE/PacketMath.h k:\BlenderGit\blender\extern\Eigen3/Eigen/src/Core/arch/SSE/PacketMath.h
--- c:\blender-git\blender\extern\Eigen3/Eigen/src/Core/arch/SSE/PacketMath.h 2018-05-25 13:29:14 -0600
+++ k:\BlenderGit\blender\extern\Eigen3/Eigen/src/Core/arch/SSE/PacketMath.h 2018-05-26 19:56:36 -0600
@@ -335,7 +335,7 @@
template<> EIGEN_STRONG_INLINE void prefetch<double>(const double* addr) { _mm_prefetch((const char*)(addr), _MM_HINT_T0); }
template<> EIGEN_STRONG_INLINE void prefetch<int>(const int* addr) { _mm_prefetch((const char*)(addr), _MM_HINT_T0); }
-#if defined(_MSC_VER) && defined(_WIN64) && !defined(__INTEL_COMPILER)
+#if defined(_MSC_VER) && defined(_WIN64) && !defined(__INTEL_COMPILER) && !defined(__clang__)
// The temporary variable fixes an internal compilation error in vs <= 2008 and a wrong-result bug in vs 2010
// Direct of the struct members fixed bug #62.
template<> EIGEN_STRONG_INLINE float pfirst<Packet4f>(const Packet4f& a) { return a.m128_f32[0]; }

View File

@@ -1,34 +1,3 @@
diff --git a/extern/bullet2/src/LinearMath/btScalar.h b/extern/bullet2/src/LinearMath/btScalar.h
--- a/extern/bullet2/src/LinearMath/btScalar.h
+++ b/extern/bullet2/src/LinearMath/btScalar.h
@@ -16,6 +16,9 @@
#ifndef BT_SCALAR_H
#define BT_SCALAR_H
+#if defined(_MSC_VER) && defined(__clang__) /* clang supplies it's own overloads already */
+#define BT_NO_SIMD_OPERATOR_OVERLOADS
+#endif
#ifdef BT_MANAGED_CODE
//Aligned data types not supported in managed code
@@ -83,7 +86,7 @@
#ifdef BT_USE_SSE
#if (_MSC_FULL_VER >= 170050727)//Visual Studio 2012 can compile SSE4/FMA3 (but SSE4/FMA3 is not enabled by default)
- #define BT_ALLOW_SSE4
+ //#define BT_ALLOW_SSE4 //disable this cause blender targets sse2
#endif //(_MSC_FULL_VER >= 160040219)
//BT_USE_SSE_IN_API is disabled under Windows by default, because
@@ -102,7 +105,7 @@
#endif //__MINGW32__
#ifdef BT_DEBUG
- #ifdef _MSC_VER
+ #if defined(_MSC_VER) && !defined(__clang__)
#include <stdio.h>
#define btAssert(x) { if(!(x)){printf("Assert "__FILE__ ":%u ("#x")\n", __LINE__);__debugbreak(); }}
#else//_MSC_VER
diff --git a/extern/bullet2/src/BulletCollision/CollisionDispatch/btCollisionWorld.h b/extern/bullet2/src/BulletCollision/CollisionDispatch/btCollisionWorld.h diff --git a/extern/bullet2/src/BulletCollision/CollisionDispatch/btCollisionWorld.h b/extern/bullet2/src/BulletCollision/CollisionDispatch/btCollisionWorld.h
index be9eca6..ec40c96 100644 index be9eca6..ec40c96 100644
--- a/extern/bullet2/src/BulletCollision/CollisionDispatch/btCollisionWorld.h --- a/extern/bullet2/src/BulletCollision/CollisionDispatch/btCollisionWorld.h

View File

@@ -16,9 +16,6 @@ subject to the following restrictions:
#ifndef BT_SCALAR_H #ifndef BT_SCALAR_H
#define BT_SCALAR_H #define BT_SCALAR_H
#if defined(_MSC_VER) && defined(__clang__) /* clang supplies it's own overloads already */
#define BT_NO_SIMD_OPERATOR_OVERLOADS
#endif
#ifdef BT_MANAGED_CODE #ifdef BT_MANAGED_CODE
//Aligned data types not supported in managed code //Aligned data types not supported in managed code
@@ -86,7 +83,7 @@ inline int btGetVersion()
#ifdef BT_USE_SSE #ifdef BT_USE_SSE
#if (_MSC_FULL_VER >= 170050727)//Visual Studio 2012 can compile SSE4/FMA3 (but SSE4/FMA3 is not enabled by default) #if (_MSC_FULL_VER >= 170050727)//Visual Studio 2012 can compile SSE4/FMA3 (but SSE4/FMA3 is not enabled by default)
//#define BT_ALLOW_SSE4 //disable this cause blender targets sse2 #define BT_ALLOW_SSE4
#endif //(_MSC_FULL_VER >= 160040219) #endif //(_MSC_FULL_VER >= 160040219)
//BT_USE_SSE_IN_API is disabled under Windows by default, because //BT_USE_SSE_IN_API is disabled under Windows by default, because
@@ -105,7 +102,7 @@ inline int btGetVersion()
#endif //__MINGW32__ #endif //__MINGW32__
#ifdef BT_DEBUG #ifdef BT_DEBUG
#if defined(_MSC_VER) && !defined(__clang__) #ifdef _MSC_VER
#include <stdio.h> #include <stdio.h>
#define btAssert(x) { if(!(x)){printf("Assert "__FILE__ ":%u ("#x")\n", __LINE__);__debugbreak(); }} #define btAssert(x) { if(!(x)){printf("Assert "__FILE__ ":%u ("#x")\n", __LINE__);__debugbreak(); }}
#else//_MSC_VER #else//_MSC_VER

View File

@@ -40,11 +40,7 @@
#include <windows.h> #include <windows.h>
#include <intrin.h> #include <intrin.h>
#if defined (__clang__) /******************************************************************************/
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wincompatible-pointer-types"
#endif
/* 64-bit operations. */ /* 64-bit operations. */
#if (LG_SIZEOF_PTR == 8 || LG_SIZEOF_INT == 8) #if (LG_SIZEOF_PTR == 8 || LG_SIZEOF_INT == 8)
/* Unsigned */ /* Unsigned */
@@ -209,9 +205,4 @@ ATOMIC_INLINE int8_t atomic_fetch_and_or_int8(int8_t *p, int8_t b)
#endif #endif
} }
#if defined (__clang__)
# pragma GCC diagnostic pop
#endif
#endif /* __ATOMIC_OPS_MSVC_H__ */ #endif /* __ATOMIC_OPS_MSVC_H__ */

View File

@@ -146,13 +146,10 @@ void CLG_exit(void);
void CLG_output_set(void *file_handle); void CLG_output_set(void *file_handle);
void CLG_output_use_basename_set(int value); void CLG_output_use_basename_set(int value);
void CLG_fatal_fn_set(void (*fatal_fn)(void *file_handle)); void CLG_fatal_fn_set(void (*fatal_fn)(void *file_handle));
void CLG_backtrace_fn_set(void (*fatal_fn)(void *file_handle));
void CLG_type_filter_include(const char *type_filter, int type_filter_len); void CLG_type_filter_include(const char *type_filter, int type_filter_len);
void CLG_type_filter_exclude(const char *type_filter, int type_filter_len); void CLG_type_filter_exclude(const char *type_filter, int type_filter_len);
void CLG_level_set(int level);
void CLG_logref_init(CLG_LogRef *clg_ref); void CLG_logref_init(CLG_LogRef *clg_ref);
/** Declare outside function, declare as extern in header. */ /** Declare outside function, declare as extern in header. */

View File

@@ -81,7 +81,6 @@ typedef struct CLogContext {
struct { struct {
void (*fatal_fn)(void *file_handle); void (*fatal_fn)(void *file_handle);
void (*backtrace_fn)(void *file_handle);
} callbacks; } callbacks;
} CLogContext; } CLogContext;
@@ -329,23 +328,15 @@ static CLG_LogType *clg_ctx_type_register(CLogContext *ctx, const char *identifi
return ty; return ty;
} }
static void clg_ctx_fatal_action(CLogContext *ctx) static void clg_ctx_fatal_action(CLogContext *ctx, FILE *file_handle)
{ {
if (ctx->callbacks.fatal_fn != NULL) { if (ctx->callbacks.fatal_fn != NULL) {
ctx->callbacks.fatal_fn(ctx->output_file); ctx->callbacks.fatal_fn(file_handle);
} }
fflush(ctx->output_file); fflush(file_handle);
abort(); abort();
} }
static void clg_ctx_backtrace(CLogContext *ctx)
{
/* Note: we avoid writing fo 'FILE', for backtrace we make an exception,
* if necessary we could have a version of the callback that writes to file descriptor all at once. */
ctx->callbacks.backtrace_fn(ctx->output_file);
fflush(ctx->output_file);
}
/** \} */ /** \} */
/* -------------------------------------------------------------------- */ /* -------------------------------------------------------------------- */
@@ -413,17 +404,12 @@ void CLG_log_str(
clg_str_append(&cstr, "\n"); clg_str_append(&cstr, "\n");
/* could be optional */ /* could be optional */
int bytes_written = write(lg->ctx->output, cstr.data, cstr.len); write(lg->ctx->output, cstr.data, cstr.len);
(void)bytes_written;
clg_str_free(&cstr); clg_str_free(&cstr);
if (lg->ctx->callbacks.backtrace_fn) {
clg_ctx_backtrace(lg->ctx);
}
if (severity == CLG_SEVERITY_FATAL) { if (severity == CLG_SEVERITY_FATAL) {
clg_ctx_fatal_action(lg->ctx); clg_ctx_fatal_action(lg->ctx, lg->ctx->output_file);
} }
} }
@@ -449,17 +435,12 @@ void CLG_logf(
clg_str_append(&cstr, "\n"); clg_str_append(&cstr, "\n");
/* could be optional */ /* could be optional */
int bytes_written = write(lg->ctx->output, cstr.data, cstr.len); write(lg->ctx->output, cstr.data, cstr.len);
(void)bytes_written;
clg_str_free(&cstr); clg_str_free(&cstr);
if (lg->ctx->callbacks.backtrace_fn) {
clg_ctx_backtrace(lg->ctx);
}
if (severity == CLG_SEVERITY_FATAL) { if (severity == CLG_SEVERITY_FATAL) {
clg_ctx_fatal_action(lg->ctx); clg_ctx_fatal_action(lg->ctx, lg->ctx->output_file);
} }
} }
@@ -489,11 +470,6 @@ static void CLG_ctx_fatal_fn_set(CLogContext *ctx, void (*fatal_fn)(void *file_h
ctx->callbacks.fatal_fn = fatal_fn; ctx->callbacks.fatal_fn = fatal_fn;
} }
static void CLG_ctx_backtrace_fn_set(CLogContext *ctx, void (*backtrace_fn)(void *file_handle))
{
ctx->callbacks.backtrace_fn = backtrace_fn;
}
static void clg_ctx_type_filter_append(CLG_IDFilter **flt_list, const char *type_match, int type_match_len) static void clg_ctx_type_filter_append(CLG_IDFilter **flt_list, const char *type_match, int type_match_len)
{ {
if (type_match_len == 0) { if (type_match_len == 0) {
@@ -516,14 +492,6 @@ static void CLG_ctx_type_filter_include(CLogContext *ctx, const char *type_match
clg_ctx_type_filter_append(&ctx->filters[1], type_match, type_match_len); clg_ctx_type_filter_append(&ctx->filters[1], type_match, type_match_len);
} }
static void CLG_ctx_level_set(CLogContext *ctx, int level)
{
ctx->default_type.level = level;
for (CLG_LogType *ty = ctx->types; ty; ty = ty->next) {
ty->level = level;
}
}
static CLogContext *CLG_ctx_init(void) static CLogContext *CLG_ctx_init(void)
{ {
CLogContext *ctx = MEM_callocN(sizeof(*ctx), __func__); CLogContext *ctx = MEM_callocN(sizeof(*ctx), __func__);
@@ -591,11 +559,6 @@ void CLG_fatal_fn_set(void (*fatal_fn)(void *file_handle))
CLG_ctx_fatal_fn_set(g_ctx, fatal_fn); CLG_ctx_fatal_fn_set(g_ctx, fatal_fn);
} }
void CLG_backtrace_fn_set(void (*fatal_fn)(void *file_handle))
{
CLG_ctx_backtrace_fn_set(g_ctx, fatal_fn);
}
void CLG_type_filter_exclude(const char *type_match, int type_match_len) void CLG_type_filter_exclude(const char *type_match, int type_match_len)
{ {
CLG_ctx_type_filter_exclude(g_ctx, type_match, type_match_len); CLG_ctx_type_filter_exclude(g_ctx, type_match, type_match_len);
@@ -606,12 +569,6 @@ void CLG_type_filter_include(const char *type_match, int type_match_len)
CLG_ctx_type_filter_include(g_ctx, type_match, type_match_len); CLG_ctx_type_filter_include(g_ctx, type_match, type_match_len);
} }
void CLG_level_set(int level)
{
CLG_ctx_level_set(g_ctx, level);
}
/** \} */ /** \} */
/* -------------------------------------------------------------------- */ /* -------------------------------------------------------------------- */

View File

@@ -31,7 +31,7 @@ elseif(NOT WITH_CPU_SSE)
set(CXX_HAS_SSE FALSE) set(CXX_HAS_SSE FALSE)
set(CXX_HAS_AVX FALSE) set(CXX_HAS_AVX FALSE)
set(CXX_HAS_AVX2 FALSE) set(CXX_HAS_AVX2 FALSE)
elseif(WIN32 AND MSVC AND NOT CMAKE_CXX_COMPILER_ID MATCHES "Clang") elseif(WIN32 AND MSVC)
set(CXX_HAS_SSE TRUE) set(CXX_HAS_SSE TRUE)
set(CXX_HAS_AVX TRUE) set(CXX_HAS_AVX TRUE)
set(CXX_HAS_AVX2 TRUE) set(CXX_HAS_AVX2 TRUE)
@@ -306,7 +306,7 @@ if(WITH_CYCLES_CUDA_BINARIES AND (NOT WITH_CYCLES_CUBIN_COMPILER))
elseif(${CUDA_VERSION} EQUAL "9.1") elseif(${CUDA_VERSION} EQUAL "9.1")
set(MAX_MSVC 1911) set(MAX_MSVC 1911)
endif() endif()
if(NOT MSVC_VERSION LESS ${MAX_MSVC} OR CMAKE_C_COMPILER_ID MATCHES "Clang") if(NOT MSVC_VERSION LESS ${MAX_MSVC})
message(STATUS "nvcc not supported for this compiler version, using cycles_cubin_cc instead.") message(STATUS "nvcc not supported for this compiler version, using cycles_cubin_cc instead.")
set(WITH_CYCLES_CUBIN_COMPILER ON) set(WITH_CYCLES_CUBIN_COMPILER ON)
endif() endif()

View File

@@ -52,7 +52,7 @@ from . import (
class CyclesRender(bpy.types.RenderEngine): class CyclesRender(bpy.types.RenderEngine):
bl_idname = 'CYCLES' bl_idname = 'CYCLES'
bl_label = "Cycles" bl_label = "Cycles Render"
bl_use_shading_nodes = True bl_use_shading_nodes = True
bl_use_preview = True bl_use_preview = True
bl_use_exclude_layers = True bl_use_exclude_layers = True
@@ -66,34 +66,33 @@ class CyclesRender(bpy.types.RenderEngine):
engine.free(self) engine.free(self)
# final render # final render
def update(self, data, depsgraph): def update(self, data, scene):
if not self.session: if not self.session:
if self.is_preview: if self.is_preview:
cscene = bpy.context.scene.cycles cscene = bpy.context.scene.cycles
use_osl = cscene.shading_system and cscene.device == 'CPU' use_osl = cscene.shading_system and cscene.device == 'CPU'
engine.create(self, data, preview_osl=use_osl) engine.create(self, data, scene,
None, None, None, use_osl)
else: else:
engine.create(self, data) engine.create(self, data, scene)
else:
engine.reset(self, data, scene)
engine.reset(self, data, depsgraph) def render_to_image(self, depsgraph):
def render(self, depsgraph):
engine.render(self, depsgraph) engine.render(self, depsgraph)
def bake(self, depsgraph, obj, pass_type, pass_filter, object_id, pixel_array, num_pixels, depth, result): def bake(self, depsgraph, scene, obj, pass_type, pass_filter, object_id, pixel_array, num_pixels, depth, result):
engine.bake(self, depsgraph, obj, pass_type, pass_filter, object_id, pixel_array, num_pixels, depth, result) engine.bake(self, depsgraph, obj, pass_type, pass_filter, object_id, pixel_array, num_pixels, depth, result)
# viewport render # viewport render
def view_update(self, context): def view_update(self, context):
if not self.session: if not self.session:
engine.create(self, context.blend_data, engine.create(self, context.blend_data, context.scene,
context.region, context.space_data, context.region_data) context.region, context.space_data, context.region_data)
engine.update(self, context.depsgraph, context.blend_data, context.scene)
engine.reset(self, context.blend_data, context.depsgraph) def render_to_view(self, context):
engine.sync(self, context.depsgraph, context.blend_data)
def view_draw(self, context):
engine.draw(self, context.depsgraph, context.region, context.space_data, context.region_data) engine.draw(self, context.depsgraph, context.region, context.space_data, context.region_data)
def update_script_node(self, node): def update_script_node(self, node):

View File

@@ -123,12 +123,13 @@ def exit():
_cycles.exit() _cycles.exit()
def create(engine, data, region=None, v3d=None, rv3d=None, preview_osl=False): def create(engine, data, scene, region=None, v3d=None, rv3d=None, preview_osl=False):
import _cycles
import bpy import bpy
import _cycles
data = data.as_pointer() data = data.as_pointer()
userpref = bpy.context.user_preferences.as_pointer() userpref = bpy.context.user_preferences.as_pointer()
scene = scene.as_pointer()
if region: if region:
region = region.as_pointer() region = region.as_pointer()
if v3d: if v3d:
@@ -136,8 +137,13 @@ def create(engine, data, region=None, v3d=None, rv3d=None, preview_osl=False):
if rv3d: if rv3d:
rv3d = rv3d.as_pointer() rv3d = rv3d.as_pointer()
if bpy.app.debug_value == 256:
_cycles.debug_flags_update(scene)
else:
_cycles.debug_flags_reset()
engine.session = _cycles.create( engine.session = _cycles.create(
engine.as_pointer(), userpref, data, region, v3d, rv3d, preview_osl) engine.as_pointer(), userpref, data, scene, region, v3d, rv3d, preview_osl)
def free(engine): def free(engine):
@@ -161,21 +167,14 @@ def bake(engine, depsgraph, obj, pass_type, pass_filter, object_id, pixel_array,
_cycles.bake(engine.session, depsgraph.as_pointer(), obj.as_pointer(), pass_type, pass_filter, object_id, pixel_array.as_pointer(), num_pixels, depth, result.as_pointer()) _cycles.bake(engine.session, depsgraph.as_pointer(), obj.as_pointer(), pass_type, pass_filter, object_id, pixel_array.as_pointer(), num_pixels, depth, result.as_pointer())
def reset(engine, data, depsgraph): def reset(engine, data, scene):
import _cycles import _cycles
import bpy
if bpy.app.debug_value == 256:
_cycles.debug_flags_update(depsgraph.scene)
else:
_cycles.debug_flags_reset()
data = data.as_pointer() data = data.as_pointer()
depsgraph = depsgraph.as_pointer() scene = scene.as_pointer()
_cycles.reset(engine.session, data, depsgraph) _cycles.reset(engine.session, data, scene)
def sync(engine, depsgraph, data): def update(engine, depsgraph, data, scene):
import _cycles import _cycles
_cycles.sync(engine.session, depsgraph.as_pointer()) _cycles.sync(engine.session, depsgraph.as_pointer())

View File

@@ -112,8 +112,7 @@ def update_script_node(node, report):
if ok: if ok:
# now update node with new sockets # now update node with new sockets
data = bpy.data.as_pointer() ok = _cycles.osl_update_node(node.id_data.as_pointer(), node.as_pointer(), oso_path)
ok = _cycles.osl_update_node(data, node.id_data.as_pointer(), node.as_pointer(), oso_path)
if not ok: if not ok:
report({'ERROR'}, "OSL query failed to open " + oso_path) report({'ERROR'}, "OSL query failed to open " + oso_path)

View File

@@ -1154,7 +1154,7 @@ class CyclesCurveRenderSettings(bpy.types.PropertyGroup):
default='THICK', default='THICK',
) )
cls.cull_backfacing = BoolProperty( cls.cull_backfacing = BoolProperty(
name="Cull Back-faces", name="Cull back-faces",
description="Do not test the back-face of each strand", description="Do not test the back-face of each strand",
default=True, default=True,
) )
@@ -1195,7 +1195,7 @@ class CyclesCurveRenderSettings(bpy.types.PropertyGroup):
def update_render_passes(self, context): def update_render_passes(self, context):
scene = context.scene scene = context.scene
rd = scene.render rd = scene.render
view_layer = context.view_layer view_layer = scene.view_layers.active
view_layer.update_render_passes() view_layer.update_render_passes()
class CyclesRenderLayerSettings(bpy.types.PropertyGroup): class CyclesRenderLayerSettings(bpy.types.PropertyGroup):
@@ -1330,6 +1330,49 @@ class CyclesRenderLayerSettings(bpy.types.PropertyGroup):
del bpy.types.ViewLayer.cycles del bpy.types.ViewLayer.cycles
class CyclesCurveSettings(bpy.types.PropertyGroup):
@classmethod
def register(cls):
bpy.types.ParticleSettings.cycles = PointerProperty(
name="Cycles Hair Settings",
description="Cycles hair settings",
type=cls,
)
cls.radius_scale = FloatProperty(
name="Radius Scaling",
description="Multiplier of width properties",
min=0.0, max=1000.0,
default=0.01,
)
cls.root_width = FloatProperty(
name="Root Size",
description="Strand's width at root",
min=0.0, max=1000.0,
default=1.0,
)
cls.tip_width = FloatProperty(
name="Tip Multiplier",
description="Strand's width at tip",
min=0.0, max=1000.0,
default=0.0,
)
cls.shape = FloatProperty(
name="Strand Shape",
description="Strand shape parameter",
min=-1.0, max=1.0,
default=0.0,
)
cls.use_closetip = BoolProperty(
name="Close tip",
description="Set tip radius to zero",
default=True,
)
@classmethod
def unregister(cls):
del bpy.types.ParticleSettings.cycles
class CyclesDeviceSettings(bpy.types.PropertyGroup): class CyclesDeviceSettings(bpy.types.PropertyGroup):
@classmethod @classmethod
def register(cls): def register(cls):
@@ -1460,6 +1503,7 @@ def register():
bpy.utils.register_class(CyclesMeshSettings) bpy.utils.register_class(CyclesMeshSettings)
bpy.utils.register_class(CyclesObjectSettings) bpy.utils.register_class(CyclesObjectSettings)
bpy.utils.register_class(CyclesCurveRenderSettings) bpy.utils.register_class(CyclesCurveRenderSettings)
bpy.utils.register_class(CyclesCurveSettings)
bpy.utils.register_class(CyclesDeviceSettings) bpy.utils.register_class(CyclesDeviceSettings)
bpy.utils.register_class(CyclesPreferences) bpy.utils.register_class(CyclesPreferences)
bpy.utils.register_class(CyclesRenderLayerSettings) bpy.utils.register_class(CyclesRenderLayerSettings)
@@ -1475,6 +1519,7 @@ def unregister():
bpy.utils.unregister_class(CyclesObjectSettings) bpy.utils.unregister_class(CyclesObjectSettings)
bpy.utils.unregister_class(CyclesVisibilitySettings) bpy.utils.unregister_class(CyclesVisibilitySettings)
bpy.utils.unregister_class(CyclesCurveRenderSettings) bpy.utils.unregister_class(CyclesCurveRenderSettings)
bpy.utils.unregister_class(CyclesCurveSettings)
bpy.utils.unregister_class(CyclesDeviceSettings) bpy.utils.unregister_class(CyclesDeviceSettings)
bpy.utils.unregister_class(CyclesPreferences) bpy.utils.unregister_class(CyclesPreferences)
bpy.utils.unregister_class(CyclesRenderLayerSettings) bpy.utils.unregister_class(CyclesRenderLayerSettings)

View File

@@ -20,10 +20,10 @@ import bpy
from bpy_extras.node_utils import find_node_input, find_output_node from bpy_extras.node_utils import find_node_input, find_output_node
from bpy.types import ( from bpy.types import (
Panel, Panel,
Menu, Menu,
Operator, Operator,
) )
class CYCLES_MT_sampling_presets(Menu): class CYCLES_MT_sampling_presets(Menu):
@@ -86,7 +86,6 @@ def use_sample_all_lights(context):
return cscene.sample_all_lights_direct or cscene.sample_all_lights_indirect return cscene.sample_all_lights_direct or cscene.sample_all_lights_indirect
def show_device_active(context): def show_device_active(context):
cscene = context.scene.cycles cscene = context.scene.cycles
if cscene.device != 'GPU': if cscene.device != 'GPU':
@@ -146,7 +145,6 @@ class CYCLES_RENDER_PT_sampling(CyclesButtonsPanel, Panel):
def draw(self, context): def draw(self, context):
layout = self.layout layout = self.layout
layout.use_property_split = False
scene = context.scene scene = context.scene
cscene = scene.cycles cscene = scene.cycles
@@ -156,52 +154,56 @@ class CYCLES_RENDER_PT_sampling(CyclesButtonsPanel, Panel):
row.operator("render.cycles_sampling_preset_add", text="", icon="ZOOMIN") row.operator("render.cycles_sampling_preset_add", text="", icon="ZOOMIN")
row.operator("render.cycles_sampling_preset_add", text="", icon="ZOOMOUT").remove_active = True row.operator("render.cycles_sampling_preset_add", text="", icon="ZOOMOUT").remove_active = True
layout.use_property_split = True row = layout.row()
sub = row.row()
sub.prop(cscene, "progressive", text="")
row.prop(cscene, "use_square_samples")
layout.prop(cscene, "progressive") split = layout.split()
col = split.column()
sub = col.column(align=True)
sub.label("Settings:")
seed_sub = sub.row(align=True)
seed_sub.prop(cscene, "seed")
seed_sub.prop(cscene, "use_animated_seed", text="", icon="TIME")
sub.prop(cscene, "sample_clamp_direct")
sub.prop(cscene, "sample_clamp_indirect")
sub.prop(cscene, "light_sampling_threshold")
if cscene.progressive == 'PATH' or use_branched_path(context) is False: if cscene.progressive == 'PATH' or use_branched_path(context) is False:
col = layout.column(align=True) col = split.column()
col.prop(cscene, "samples", text="Render Samples") sub = col.column(align=True)
col.prop(cscene, "preview_samples", text="Preview Samples") sub.label(text="Samples:")
col.prop(cscene, "use_square_samples") # Duplicate below. sub.prop(cscene, "samples", text="Render")
sub.prop(cscene, "preview_samples", text="Preview")
else: else:
col = layout.column(align=True) sub.label(text="AA Samples:")
col.prop(cscene, "aa_samples", text="Render Samples") sub.prop(cscene, "aa_samples", text="Render")
col.prop(cscene, "preview_aa_samples", text="Preview Samples") sub.prop(cscene, "preview_aa_samples", text="Preview")
col = layout.column(align=True) col = split.column()
col.prop(cscene, "diffuse_samples", text="Diffuse Samples") sub = col.column(align=True)
col.prop(cscene, "glossy_samples", text="Glossy Samples") sub.label(text="Samples:")
col.prop(cscene, "transmission_samples", text="Transmission Samples") sub.prop(cscene, "diffuse_samples", text="Diffuse")
col.prop(cscene, "ao_samples", text="AO Samples") sub.prop(cscene, "glossy_samples", text="Glossy")
sub.prop(cscene, "transmission_samples", text="Transmission")
sub.prop(cscene, "ao_samples", text="AO")
sub = col.row(align=True) subsub = sub.row(align=True)
sub.active = use_sample_all_lights(context) subsub.active = use_sample_all_lights(context)
sub.prop(cscene, "mesh_light_samples", text="Mesh Light Samples") subsub.prop(cscene, "mesh_light_samples", text="Mesh Light")
col.prop(cscene, "subsurface_samples", text="Subsurface Samples") sub.prop(cscene, "subsurface_samples", text="Subsurface")
col.prop(cscene, "volume_samples", text="Volume Samples") sub.prop(cscene, "volume_samples", text="Volume")
col.prop(cscene, "use_square_samples") # Duplicate above.
col = layout.column(align=True) col = layout.column(align=True)
col.prop(cscene, "sample_all_lights_direct") col.prop(cscene, "sample_all_lights_direct")
col.prop(cscene, "sample_all_lights_indirect") col.prop(cscene, "sample_all_lights_indirect")
col = layout.column(align=True)
col.prop(cscene, "light_sampling_threshold", text="Light Threshold")
col = layout.column(align=True)
col.prop(cscene, "sample_clamp_direct")
col.prop(cscene, "sample_clamp_indirect")
row = layout.row(align=True)
row.prop(cscene, "seed")
row.prop(cscene, "use_animated_seed", text="", icon="TIME")
layout.row().prop(cscene, "sampling_pattern", text="Pattern") layout.row().prop(cscene, "sampling_pattern", text="Pattern")
draw_samples_info(layout, context) draw_samples_info(layout, context)
@@ -211,48 +213,56 @@ class CYCLES_RENDER_PT_geometry(CyclesButtonsPanel, Panel):
def draw(self, context): def draw(self, context):
layout = self.layout layout = self.layout
layout.use_property_split = True
scene = context.scene scene = context.scene
cscene = scene.cycles cscene = scene.cycles
ccscene = scene.cycles_curves ccscene = scene.cycles_curves
col = layout.column(align=True) row = layout.row()
col.prop(cscene, "volume_step_size", text="Volume Step Size") row.label("Volume Sampling:")
col.prop(cscene, "volume_max_steps", text="Volume Max Steps") row = layout.row()
row.prop(cscene, "volume_step_size")
row.prop(cscene, "volume_max_steps")
col.separator() layout.separator()
if cscene.feature_set == 'EXPERIMENTAL': if cscene.feature_set == 'EXPERIMENTAL':
layout.label("Subdivision Rate:")
split = layout.split()
col = layout.column() col = split.column()
sub = col.column(align=True) sub = col.column(align=True)
sub.prop(cscene, "dicing_rate", text="Dicing Rate Render") sub.prop(cscene, "dicing_rate", text="Render")
sub.prop(cscene, "preview_dicing_rate", text="Dicing Rate Preview") sub.prop(cscene, "preview_dicing_rate", text="Preview")
col = split.column()
col.prop(cscene, "offscreen_dicing_scale", text="Offscreen Scale") col.prop(cscene, "offscreen_dicing_scale", text="Offscreen Scale")
col.prop(cscene, "max_subdivisions") col.prop(cscene, "max_subdivisions")
col.prop(cscene, "dicing_camera") layout.prop(cscene, "dicing_camera")
col.separator() layout.separator()
layout.prop(ccscene, "use_curves", text="Hair Rendering") layout.label("Hair:")
layout.prop(ccscene, "use_curves", text="Use Hair")
col = layout.column() col = layout.column()
col.active = ccscene.use_curves col.active = ccscene.use_curves
col.prop(ccscene, "minimum_width", text="Min Pixels") col.prop(ccscene, "primitive", text="Primitive")
col.prop(ccscene, "maximum_width", text="Max Extension")
col.prop(ccscene, "shape", text="Shape") col.prop(ccscene, "shape", text="Shape")
if not (ccscene.primitive in {'CURVE_SEGMENTS', 'LINE_SEGMENTS'} and ccscene.shape == 'RIBBONS'): if not (ccscene.primitive in {'CURVE_SEGMENTS', 'LINE_SEGMENTS'} and ccscene.shape == 'RIBBONS'):
col.prop(ccscene, "cull_backfacing", text="Cull back-faces") col.prop(ccscene, "cull_backfacing", text="Cull back-faces")
col.prop(ccscene, "primitive", text="Primitive")
if ccscene.primitive == 'TRIANGLES' and ccscene.shape == 'THICK': if ccscene.primitive == 'TRIANGLES' and ccscene.shape == 'THICK':
col.prop(ccscene, "resolution", text="Resolution") col.prop(ccscene, "resolution", text="Resolution")
elif ccscene.primitive == 'CURVE_SEGMENTS': elif ccscene.primitive == 'CURVE_SEGMENTS':
col.prop(ccscene, "subdivisions", text="Curve subdivisions") col.prop(ccscene, "subdivisions", text="Curve subdivisions")
row = col.row()
row.prop(ccscene, "minimum_width", text="Min Pixels")
row.prop(ccscene, "maximum_width", text="Max Extension")
class CYCLES_RENDER_PT_light_paths(CyclesButtonsPanel, Panel): class CYCLES_RENDER_PT_light_paths(CyclesButtonsPanel, Panel):
bl_label = "Light Paths" bl_label = "Light Paths"
@@ -260,7 +270,6 @@ class CYCLES_RENDER_PT_light_paths(CyclesButtonsPanel, Panel):
def draw(self, context): def draw(self, context):
layout = self.layout layout = self.layout
layout.use_property_split = True
scene = context.scene scene = context.scene
cscene = scene.cycles cscene = scene.cycles
@@ -270,18 +279,31 @@ class CYCLES_RENDER_PT_light_paths(CyclesButtonsPanel, Panel):
row.operator("render.cycles_integrator_preset_add", text="", icon="ZOOMIN") row.operator("render.cycles_integrator_preset_add", text="", icon="ZOOMIN")
row.operator("render.cycles_integrator_preset_add", text="", icon="ZOOMOUT").remove_active = True row.operator("render.cycles_integrator_preset_add", text="", icon="ZOOMOUT").remove_active = True
col = layout.column(align=True) split = layout.split()
col.prop(cscene, "max_bounces", text="Max Bounces")
col.prop(cscene, "transparent_max_bounces", text="Transparency") col = split.column()
col.prop(cscene, "diffuse_bounces", text="Diffuse")
col.prop(cscene, "glossy_bounces", text="Glossy") sub = col.column(align=True)
col.prop(cscene, "transmission_bounces", text="Transmission") sub.label("Transparency:")
col.prop(cscene, "volume_bounces", text="Volume") sub.prop(cscene, "transparent_max_bounces", text="Max")
col.separator()
col = layout.column()
col.prop(cscene, "blur_glossy")
col.prop(cscene, "caustics_reflective") col.prop(cscene, "caustics_reflective")
col.prop(cscene, "caustics_refractive") col.prop(cscene, "caustics_refractive")
col.prop(cscene, "blur_glossy")
col = split.column()
sub = col.column(align=True)
sub.label(text="Bounces:")
sub.prop(cscene, "max_bounces", text="Max")
sub = col.column(align=True)
sub.prop(cscene, "diffuse_bounces", text="Diffuse")
sub.prop(cscene, "glossy_bounces", text="Glossy")
sub.prop(cscene, "transmission_bounces", text="Transmission")
sub.prop(cscene, "volume_bounces", text="Volume")
class CYCLES_RENDER_PT_motion_blur(CyclesButtonsPanel, Panel): class CYCLES_RENDER_PT_motion_blur(CyclesButtonsPanel, Panel):
@@ -295,7 +317,6 @@ class CYCLES_RENDER_PT_motion_blur(CyclesButtonsPanel, Panel):
def draw(self, context): def draw(self, context):
layout = self.layout layout = self.layout
layout.use_property_split = True
scene = context.scene scene = context.scene
cscene = scene.cycles cscene = scene.cycles
@@ -328,35 +349,31 @@ class CYCLES_RENDER_PT_motion_blur(CyclesButtonsPanel, Panel):
class CYCLES_RENDER_PT_film(CyclesButtonsPanel, Panel): class CYCLES_RENDER_PT_film(CyclesButtonsPanel, Panel):
bl_label = "Film" bl_label = "Film"
bl_options = {'DEFAULT_CLOSED'}
def draw(self, context): def draw(self, context):
layout = self.layout layout = self.layout
layout.use_property_split = True
scene = context.scene scene = context.scene
cscene = scene.cycles cscene = scene.cycles
col = layout.column() split = layout.split()
col = split.column()
col.prop(cscene, "film_exposure") col.prop(cscene, "film_exposure")
col.separator()
layout.separator() sub = col.column(align=True)
sub.prop(cscene, "pixel_filter_type", text="")
col = layout.column()
col.prop(cscene, "pixel_filter_type")
if cscene.pixel_filter_type != 'BOX': if cscene.pixel_filter_type != 'BOX':
col.prop(cscene, "filter_width") sub.prop(cscene, "filter_width", text="Width")
layout.separator() col = split.column()
col = layout.column()
col.prop(cscene, "film_transparent") col.prop(cscene, "film_transparent")
sub = col.column() sub = col.row()
sub.prop(cscene, "film_transparent_glass", text="Transparent Glass") sub.prop(cscene, "film_transparent_glass", text="Transparent Glass")
sub.active = cscene.film_transparent sub.active = cscene.film_transparent
sub = col.row()
col = layout.column() sub.prop(cscene, "film_transparent_roughness", text="Roughness Threshold")
col.active = cscene.film_transparent and cscene.film_transparent_glass sub.active = cscene.film_transparent and cscene.film_transparent_glass
col.prop(cscene, "film_transparent_roughness", text="Roughness Threshold")
class CYCLES_RENDER_PT_performance(CyclesButtonsPanel, Panel): class CYCLES_RENDER_PT_performance(CyclesButtonsPanel, Panel):
@@ -365,62 +382,62 @@ class CYCLES_RENDER_PT_performance(CyclesButtonsPanel, Panel):
def draw(self, context): def draw(self, context):
layout = self.layout layout = self.layout
layout.use_property_split = True
scene = context.scene scene = context.scene
rd = scene.render rd = scene.render
cscene = scene.cycles cscene = scene.cycles
col = layout.column() split = layout.split()
col.row(align=True).prop(rd, "threads_mode") col = split.column(align=True)
col.label(text="Threads:")
col.row(align=True).prop(rd, "threads_mode", expand=True)
sub = col.column(align=True) sub = col.column(align=True)
sub.enabled = rd.threads_mode == 'FIXED' sub.enabled = rd.threads_mode == 'FIXED'
sub.prop(rd, "threads") sub.prop(rd, "threads")
col.separator() col.separator()
col = layout.column()
sub = col.column(align=True) sub = col.column(align=True)
sub.prop(rd, "tile_x", text="Tiles X") sub.label(text="Tiles:")
sub.prop(rd, "tile_y", text="Y") sub.prop(cscene, "tile_order", text="")
col.prop(cscene, "tile_order", text="Order")
sub = col.column() sub.prop(rd, "tile_x", text="X")
sub.active = not rd.use_save_buffers sub.prop(rd, "tile_y", text="Y")
subsub = sub.column()
subsub.active = not rd.use_save_buffers
for view_layer in scene.view_layers: for view_layer in scene.view_layers:
if view_layer.cycles.use_denoising: if view_layer.cycles.use_denoising:
sub.active = False subsub.active = False
sub.prop(cscene, "use_progressive_refine") subsub.prop(cscene, "use_progressive_refine")
layout.separator() col = split.column()
col = layout.column()
col.label(text="Final Render:")
col.prop(rd, "use_save_buffers") col.prop(rd, "use_save_buffers")
col.prop(rd, "use_persistent_data", text="Persistent Images") col.prop(rd, "use_persistent_data", text="Persistent Images")
layout.separator() col.separator()
col = layout.column()
col.label(text="Acceleration structure:")
col.prop(cscene, "debug_use_spatial_splits") col.prop(cscene, "debug_use_spatial_splits")
col.prop(cscene, "debug_use_hair_bvh") col.prop(cscene, "debug_use_hair_bvh")
sub = col.column() row = col.row()
sub.active = not cscene.debug_use_spatial_splits row.active = not cscene.debug_use_spatial_splits
sub.prop(cscene, "debug_bvh_time_steps") row.prop(cscene, "debug_bvh_time_steps")
layout.separator()
col = layout.column() col = layout.column()
col.prop(rd, "preview_pixel_size", text="Viewport Pixel Size") col.label(text="Viewport Resolution:")
col.prop(cscene, "preview_start_resolution", text="Start Pixels") split = col.split()
split.prop(rd, "preview_pixel_size", text="")
split.prop(cscene, "preview_start_resolution")
class CYCLES_RENDER_PT_filter(CyclesButtonsPanel, Panel): class CYCLES_RENDER_PT_layer_options(CyclesButtonsPanel, Panel):
bl_label = "Filter" bl_label = "Layer"
bl_context = "view_layer" bl_context = "view_layer"
def draw(self, context): def draw(self, context):
@@ -429,11 +446,11 @@ class CYCLES_RENDER_PT_filter(CyclesButtonsPanel, Panel):
scene = context.scene scene = context.scene
rd = scene.render rd = scene.render
view_layer = context.view_layer view_layer = scene.view_layers.active
col = layout.column() col = layout.column()
col.prop(view_layer, "use_sky", "Use Environment") col.prop(view_layer, "use_sky", "Use Environment")
col.prop(view_layer, "use_ao", "Use Ambient Occlusion") col.prop(view_layer, "use_ao", "Use AO")
col.prop(view_layer, "use_solid", "Use Surfaces") col.prop(view_layer, "use_solid", "Use Surfaces")
col.prop(view_layer, "use_strand", "Use Hair") col.prop(view_layer, "use_strand", "Use Hair")
if with_freestyle: if with_freestyle:
@@ -454,7 +471,7 @@ class CYCLES_RENDER_PT_layer_passes(CyclesButtonsPanel, Panel):
scene = context.scene scene = context.scene
rd = scene.render rd = scene.render
view_layer = context.view_layer view_layer = scene.view_layers.active
cycles_view_layer = view_layer.cycles cycles_view_layer = view_layer.cycles
split = layout.split() split = layout.split()
@@ -472,7 +489,7 @@ class CYCLES_RENDER_PT_layer_passes(CyclesButtonsPanel, Panel):
col.prop(view_layer, "use_pass_material_index") col.prop(view_layer, "use_pass_material_index")
col.separator() col.separator()
col.prop(view_layer, "use_pass_shadow") col.prop(view_layer, "use_pass_shadow")
col.prop(view_layer, "use_pass_ambient_occlusion", text="Ambient Occlusion") col.prop(view_layer, "use_pass_ambient_occlusion")
col.separator() col.separator()
col.prop(view_layer, "pass_alpha_threshold") col.prop(view_layer, "pass_alpha_threshold")
@@ -521,6 +538,49 @@ class CYCLES_RENDER_PT_layer_passes(CyclesButtonsPanel, Panel):
col.prop(cycles_view_layer, "pass_debug_ray_bounces") col.prop(cycles_view_layer, "pass_debug_ray_bounces")
class CYCLES_RENDER_PT_views(CyclesButtonsPanel, Panel):
bl_label = "Views"
bl_context = "view_layer"
bl_options = {'DEFAULT_CLOSED'}
def draw_header(self, context):
rd = context.scene.render
self.layout.prop(rd, "use_multiview", text="")
def draw(self, context):
layout = self.layout
scene = context.scene
rd = scene.render
rv = rd.views.active
layout.active = rd.use_multiview
basic_stereo = (rd.views_format == 'STEREO_3D')
row = layout.row()
row.prop(rd, "views_format", expand=True)
if basic_stereo:
row = layout.row()
row.template_list("VIEWLAYER_UL_renderviews", "name", rd, "stereo_views", rd.views, "active_index", rows=2)
row = layout.row()
row.label(text="File Suffix:")
row.prop(rv, "file_suffix", text="")
else:
row = layout.row()
row.template_list("VIEWLAYER_UL_renderviews", "name", rd, "views", rd.views, "active_index", rows=2)
col = row.column(align=True)
col.operator("scene.render_view_add", icon='ZOOMIN', text="")
col.operator("scene.render_view_remove", icon='ZOOMOUT', text="")
row = layout.row()
row.label(text="Camera Suffix:")
row.prop(rv, "camera_suffix", text="")
class CYCLES_RENDER_PT_denoising(CyclesButtonsPanel, Panel): class CYCLES_RENDER_PT_denoising(CyclesButtonsPanel, Panel):
bl_label = "Denoising" bl_label = "Denoising"
bl_context = "view_layer" bl_context = "view_layer"
@@ -528,7 +588,7 @@ class CYCLES_RENDER_PT_denoising(CyclesButtonsPanel, Panel):
def draw_header(self, context): def draw_header(self, context):
scene = context.scene scene = context.scene
view_layer = context.view_layer view_layer = scene.view_layers.active
cycles_view_layer = view_layer.cycles cycles_view_layer = view_layer.cycles
cscene = scene.cycles cscene = scene.cycles
layout = self.layout layout = self.layout
@@ -537,75 +597,51 @@ class CYCLES_RENDER_PT_denoising(CyclesButtonsPanel, Panel):
def draw(self, context): def draw(self, context):
layout = self.layout layout = self.layout
layout.use_property_split = True
scene = context.scene scene = context.scene
cscene = scene.cycles cscene = scene.cycles
view_layer = context.view_layer view_layer = scene.view_layers.active
cycles_view_layer = view_layer.cycles cycles_view_layer = view_layer.cycles
layout.active = cycles_view_layer.use_denoising layout.active = cycles_view_layer.use_denoising
col = layout.column() split = layout.split()
sub = col.column()
col = split.column()
sub = col.column(align=True)
sub.prop(cycles_view_layer, "denoising_radius", text="Radius") sub.prop(cycles_view_layer, "denoising_radius", text="Radius")
sub.prop(cycles_view_layer, "denoising_strength", slider=True, text="Strength") sub.prop(cycles_view_layer, "denoising_strength", slider=True, text="Strength")
col = split.column()
sub = col.column(align=True) sub = col.column(align=True)
sub.prop(cycles_view_layer, "denoising_feature_strength", slider=True, text="Feature Strength") sub.prop(cycles_view_layer, "denoising_feature_strength", slider=True, text="Feature Strength")
sub.prop(cycles_view_layer, "denoising_relative_pca") sub.prop(cycles_view_layer, "denoising_relative_pca")
# layout.use_property_split = False
"""
layout.separator() layout.separator()
col = layout.column(align=True) row = layout.row()
col.prop(cycles_view_layer, "denoising_diffuse_direct", text="Diffuse Direct") row.label(text="Diffuse:")
col.prop(cycles_view_layer, "denoising_diffuse_indirect", text="Indirect") sub = row.row(align=True)
sub.prop(cycles_view_layer, "denoising_diffuse_direct", text="Direct", toggle=True)
sub.prop(cycles_view_layer, "denoising_diffuse_indirect", text="Indirect", toggle=True)
col = layout.column(align=True) row = layout.row()
col.prop(cycles_view_layer, "denoising_glossy_direct", text="Glossy Direct") row.label(text="Glossy:")
col.prop(cycles_view_layer, "denoising_glossy_indirect", text="Indirect") sub = row.row(align=True)
sub.prop(cycles_view_layer, "denoising_glossy_direct", text="Direct", toggle=True)
sub.prop(cycles_view_layer, "denoising_glossy_indirect", text="Indirect", toggle=True)
col = layout.column(align=True) row = layout.row()
col.prop(cycles_view_layer, "denoising_transmission_direct", text="Transmission Direct") row.label(text="Transmission:")
col.prop(cycles_view_layer, "denoising_transmission_indirect", text="Indirect") sub = row.row(align=True)
sub.prop(cycles_view_layer, "denoising_transmission_direct", text="Direct", toggle=True)
sub.prop(cycles_view_layer, "denoising_transmission_indirect", text="Indirect", toggle=True)
col = layout.column(align=True) row = layout.row()
col.prop(cycles_view_layer, "denoising_subsurface_direct", text="Subsurface Direct") row.label(text="Subsurface:")
col.prop(cycles_view_layer, "denoising_subsurface_indirect", text="Indirect") sub = row.row(align=True)
""" sub.prop(cycles_view_layer, "denoising_subsurface_direct", text="Direct", toggle=True)
sub.prop(cycles_view_layer, "denoising_subsurface_indirect", text="Indirect", toggle=True)
layout.use_property_split = False
split = layout.split(percentage=0.5)
split.label(text="Diffuse")
col = split.column()
row = col.row(align=True)
row.prop(cycles_view_layer, "denoising_diffuse_direct", text="Direct", toggle=True)
row.prop(cycles_view_layer, "denoising_diffuse_indirect", text="Indirect", toggle=True)
split = layout.split(percentage=0.5)
split.label(text="Glossy")
col = split.column()
row = col.row(align=True)
row.prop(cycles_view_layer, "denoising_glossy_direct", text="Direct", toggle=True)
row.prop(cycles_view_layer, "denoising_glossy_indirect", text="Indirect", toggle=True)
split = layout.split(percentage=0.5)
split.label(text="Transmission")
col = split.column()
row = col.row(align=True)
row.prop(cycles_view_layer, "denoising_transmission_direct", text="Direct", toggle=True)
row.prop(cycles_view_layer, "denoising_transmission_indirect", text="Indirect", toggle=True)
split = layout.split(percentage=0.5)
split.label(text="Subsurface")
col = split.column()
row = col.row(align=True)
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): class CYCLES_PT_post_processing(CyclesButtonsPanel, Panel):
@@ -614,15 +650,17 @@ class CYCLES_PT_post_processing(CyclesButtonsPanel, Panel):
def draw(self, context): def draw(self, context):
layout = self.layout layout = self.layout
layout.use_property_split = True
rd = context.scene.render rd = context.scene.render
col = layout.column(align=True) split = layout.split()
col = split.column()
col.prop(rd, "use_compositing") col.prop(rd, "use_compositing")
col.prop(rd, "use_sequencer") col.prop(rd, "use_sequencer")
layout.prop(rd, "dither_intensity", text="Dither", slider=True) col = split.column()
col.prop(rd, "dither_intensity", text="Dither", slider=True)
class CYCLES_CAMERA_PT_dof(CyclesButtonsPanel, Panel): class CYCLES_CAMERA_PT_dof(CyclesButtonsPanel, Panel):
@@ -879,14 +917,10 @@ class CYCLES_LAMP_PT_preview(CyclesButtonsPanel, Panel):
@classmethod @classmethod
def poll(cls, context): def poll(cls, context):
return ( return context.lamp and \
context.lamp and not (context.lamp.type == 'AREA' and
not ( context.lamp.cycles.is_portal) \
context.lamp.type == 'AREA' and and CyclesButtonsPanel.poll(context)
context.lamp.cycles.is_portal
) and
CyclesButtonsPanel.poll(context)
)
def draw(self, context): def draw(self, context):
self.layout.template_preview(context.lamp) self.layout.template_preview(context.lamp)
@@ -918,9 +952,9 @@ class CYCLES_LAMP_PT_lamp(CyclesButtonsPanel, Panel):
col.prop(lamp, "shape", text="") col.prop(lamp, "shape", text="")
sub = col.column(align=True) sub = col.column(align=True)
if lamp.shape in {'SQUARE', 'DISK'}: if lamp.shape == 'SQUARE':
sub.prop(lamp, "size") sub.prop(lamp, "size")
elif lamp.shape in {'RECTANGLE', 'ELLIPSE'}: elif lamp.shape == 'RECTANGLE':
sub.prop(lamp, "size", text="Size X") sub.prop(lamp, "size", text="Size X")
sub.prop(lamp, "size_y", text="Size Y") sub.prop(lamp, "size_y", text="Size Y")
@@ -954,7 +988,7 @@ class CYCLES_LAMP_PT_nodes(CyclesButtonsPanel, Panel):
def poll(cls, context): def poll(cls, context):
return context.lamp and not (context.lamp.type == 'AREA' and return context.lamp and not (context.lamp.type == 'AREA' and
context.lamp.cycles.is_portal) and \ context.lamp.cycles.is_portal) and \
CyclesButtonsPanel.poll(context) CyclesButtonsPanel.poll(context)
def draw(self, context): def draw(self, context):
layout = self.layout layout = self.layout
@@ -1253,6 +1287,32 @@ class CYCLES_MATERIAL_PT_settings(CyclesButtonsPanel, Panel):
col.prop(mat, "pass_index") col.prop(mat, "pass_index")
class CYCLES_MATERIAL_PT_viewport(CyclesButtonsPanel, Panel):
bl_label = "Viewport"
bl_context = "material"
bl_options = {'DEFAULT_CLOSED'}
@classmethod
def poll(cls, context):
return context.material and CyclesButtonsPanel.poll(context)
def draw(self, context):
mat = context.material
layout = self.layout
split = layout.split()
col = split.column(align=True)
col.label("Color:")
col.prop(mat, "diffuse_color", text="")
col.prop(mat, "alpha")
col = split.column(align=True)
col.label("Specular:")
col.prop(mat, "specular_color", text="")
col.prop(mat, "specular_hardness", text="Hardness")
class CYCLES_RENDER_PT_bake(CyclesButtonsPanel, Panel): class CYCLES_RENDER_PT_bake(CyclesButtonsPanel, Panel):
bl_label = "Bake" bl_label = "Bake"
bl_context = "render" bl_context = "render"
@@ -1261,27 +1321,31 @@ class CYCLES_RENDER_PT_bake(CyclesButtonsPanel, Panel):
def draw(self, context): def draw(self, context):
layout = self.layout layout = self.layout
layout.use_property_split = True
scene = context.scene scene = context.scene
cscene = scene.cycles cscene = scene.cycles
cbk = scene.render.bake cbk = scene.render.bake
rd = scene.render rd = scene.render
if rd.use_bake_multires:
layout.operator("object.bake_image", icon='RENDER_STILL')
else:
layout.operator("object.bake", icon='RENDER_STILL').type = cscene.bake_type
col = layout.column() col = layout.column()
col.prop(rd, "use_bake_multires") col.prop(rd, "use_bake_multires")
if rd.use_bake_multires: if rd.use_bake_multires:
col.prop(rd, "bake_type") col.prop(rd, "bake_type")
col = layout.column() split = layout.split()
col = split.column()
col.prop(rd, "bake_margin") col.prop(rd, "bake_margin")
col.prop(rd, "use_bake_clear") col.prop(rd, "use_bake_clear")
col = split.column()
if rd.bake_type == 'DISPLACEMENT': if rd.bake_type == 'DISPLACEMENT':
col.prop(rd, "use_bake_lores_mesh") col.prop(rd, "use_bake_lores_mesh")
col.operator("object.bake_image", icon='RENDER_STILL')
else: else:
col.prop(cscene, "bake_type") col.prop(cscene, "bake_type")
@@ -1290,22 +1354,26 @@ class CYCLES_RENDER_PT_bake(CyclesButtonsPanel, Panel):
if cscene.bake_type == 'NORMAL': if cscene.bake_type == 'NORMAL':
col.prop(cbk, "normal_space", text="Space") col.prop(cbk, "normal_space", text="Space")
sub = col.row(align=True) row = col.row(align=True)
sub.prop(cbk, "normal_r", text="Swizzle R") row.label(text="Swizzle:")
sub.prop(cbk, "normal_g", text="G") row.prop(cbk, "normal_r", text="")
sub.prop(cbk, "normal_b", text="B") row.prop(cbk, "normal_g", text="")
row.prop(cbk, "normal_b", text="")
elif cscene.bake_type == 'COMBINED': elif cscene.bake_type == 'COMBINED':
row = col.row(align=True) row = col.row(align=True)
row.use_property_split = False
row.prop(cbk, "use_pass_direct", toggle=True) row.prop(cbk, "use_pass_direct", toggle=True)
row.prop(cbk, "use_pass_indirect", toggle=True) row.prop(cbk, "use_pass_indirect", toggle=True)
col = col.column() split = col.split()
col.active = cbk.use_pass_direct or cbk.use_pass_indirect split.active = cbk.use_pass_direct or cbk.use_pass_indirect
col = split.column()
col.prop(cbk, "use_pass_diffuse") col.prop(cbk, "use_pass_diffuse")
col.prop(cbk, "use_pass_glossy") col.prop(cbk, "use_pass_glossy")
col.prop(cbk, "use_pass_transmission") col.prop(cbk, "use_pass_transmission")
col = split.column()
col.prop(cbk, "use_pass_subsurface") col.prop(cbk, "use_pass_subsurface")
col.prop(cbk, "use_pass_ambient_occlusion") col.prop(cbk, "use_pass_ambient_occlusion")
col.prop(cbk, "use_pass_emit") col.prop(cbk, "use_pass_emit")
@@ -1318,12 +1386,13 @@ class CYCLES_RENDER_PT_bake(CyclesButtonsPanel, Panel):
layout.separator() layout.separator()
col = layout.column() split = layout.split()
col = split.column()
col.prop(cbk, "margin") col.prop(cbk, "margin")
col.prop(cbk, "use_clear", text="Clear Image") col.prop(cbk, "use_clear")
col.separator()
col = split.column()
col.prop(cbk, "use_selected_to_active") col.prop(cbk, "use_selected_to_active")
sub = col.column() sub = col.column()
sub.active = cbk.use_selected_to_active sub.active = cbk.use_selected_to_active
@@ -1334,9 +1403,6 @@ class CYCLES_RENDER_PT_bake(CyclesButtonsPanel, Panel):
else: else:
sub.prop(cbk, "cage_extrusion", text="Ray Distance") sub.prop(cbk, "cage_extrusion", text="Ray Distance")
layout.operator("object.bake", icon='RENDER_STILL').type = cscene.bake_type
class CYCLES_RENDER_PT_debug(CyclesButtonsPanel, Panel): class CYCLES_RENDER_PT_debug(CyclesButtonsPanel, Panel):
bl_label = "Debug" bl_label = "Debug"
bl_context = "render" bl_context = "render"
@@ -1388,6 +1454,37 @@ class CYCLES_RENDER_PT_debug(CyclesButtonsPanel, Panel):
col.prop(cscene, "debug_bvh_type") col.prop(cscene, "debug_bvh_type")
class CYCLES_PARTICLE_PT_curve_settings(CyclesButtonsPanel, Panel):
bl_label = "Cycles Hair Settings"
bl_context = "particle"
@classmethod
def poll(cls, context):
scene = context.scene
ccscene = scene.cycles_curves
psys = context.particle_system
use_curves = ccscene.use_curves and psys
return CyclesButtonsPanel.poll(context) and use_curves and psys.settings.type == 'HAIR'
def draw(self, context):
layout = self.layout
psys = context.particle_settings
cpsys = psys.cycles
row = layout.row()
row.prop(cpsys, "shape", text="Shape")
layout.label(text="Thickness:")
row = layout.row()
row.prop(cpsys, "root_width", text="Root")
row.prop(cpsys, "tip_width", text="Tip")
row = layout.row()
row.prop(cpsys, "radius_scale", text="Scaling")
row.prop(cpsys, "use_closetip", text="Close tip")
class CYCLES_SCENE_PT_simplify(CyclesButtonsPanel, Panel): class CYCLES_SCENE_PT_simplify(CyclesButtonsPanel, Panel):
bl_label = "Simplify" bl_label = "Simplify"
bl_context = "scene" bl_context = "scene"
@@ -1412,6 +1509,7 @@ class CYCLES_SCENE_PT_simplify(CyclesButtonsPanel, Panel):
row.prop(rd, "simplify_subdivision", text="Viewport") row.prop(rd, "simplify_subdivision", text="Viewport")
row.prop(rd, "simplify_subdivision_render", text="Render") row.prop(rd, "simplify_subdivision_render", text="Render")
col = layout.column(align=True) col = layout.column(align=True)
col.label(text="Child Particles") col.label(text="Child Particles")
row = col.row(align=True) row = col.row(align=True)
@@ -1447,22 +1545,23 @@ class CYCLES_SCENE_PT_simplify(CyclesButtonsPanel, Panel):
col = split.column() col = split.column()
col.prop(cscene, "ao_bounces_render") col.prop(cscene, "ao_bounces_render")
def draw_device(self, context): def draw_device(self, context):
scene = context.scene scene = context.scene
layout = self.layout layout = self.layout
layout.use_property_split = True
if context.engine == 'CYCLES': if context.engine == 'CYCLES':
from . import engine from . import engine
cscene = scene.cycles cscene = scene.cycles
col = layout.column() split = layout.split(percentage=1 / 3)
col.prop(cscene, "feature_set") split.label("Feature Set:")
split.prop(cscene, "feature_set", text="")
col = layout.column() split = layout.split(percentage=1 / 3)
col.active = show_device_active(context) split.label("Device:")
col.prop(cscene, "device") row = split.row()
row.active = show_device_active(context)
row.prop(cscene, "device", text="")
if engine.with_osl() and use_cpu(context): if engine.with_osl() and use_cpu(context):
layout.prop(cscene, "shading_system") layout.prop(cscene, "shading_system")
@@ -1475,9 +1574,8 @@ def draw_pause(self, context):
if context.engine == "CYCLES": if context.engine == "CYCLES":
view = context.space_data view = context.space_data
if view.shading.type == 'RENDERED': cscene = scene.cycles
cscene = scene.cycles layout.prop(cscene, "preview_pause", icon="PAUSE", text="")
layout.prop(cscene, "preview_pause", icon="PAUSE", text="")
def get_panels(): def get_panels():
@@ -1490,11 +1588,12 @@ def get_panels():
'DATA_PT_spot', 'DATA_PT_spot',
'MATERIAL_PT_context_material', 'MATERIAL_PT_context_material',
'MATERIAL_PT_preview', 'MATERIAL_PT_preview',
'VIEWLAYER_PT_filter', 'VIEWLAYER_PT_layer_options',
'VIEWLAYER_PT_layer_passes', 'VIEWLAYER_PT_layer_passes',
'VIEWLAYER_PT_views',
'RENDER_PT_post_processing', 'RENDER_PT_post_processing',
'SCENE_PT_simplify', 'SCENE_PT_simplify',
} }
panels = [] panels = []
for panel in bpy.types.Panel.__subclasses__(): for panel in bpy.types.Panel.__subclasses__():
@@ -1514,8 +1613,9 @@ classes = (
CYCLES_RENDER_PT_motion_blur, CYCLES_RENDER_PT_motion_blur,
CYCLES_RENDER_PT_film, CYCLES_RENDER_PT_film,
CYCLES_RENDER_PT_performance, CYCLES_RENDER_PT_performance,
CYCLES_RENDER_PT_filter, CYCLES_RENDER_PT_layer_options,
CYCLES_RENDER_PT_layer_passes, CYCLES_RENDER_PT_layer_passes,
CYCLES_RENDER_PT_views,
CYCLES_RENDER_PT_denoising, CYCLES_RENDER_PT_denoising,
CYCLES_PT_post_processing, CYCLES_PT_post_processing,
CYCLES_CAMERA_PT_dof, CYCLES_CAMERA_PT_dof,
@@ -1539,8 +1639,10 @@ classes = (
CYCLES_MATERIAL_PT_volume, CYCLES_MATERIAL_PT_volume,
CYCLES_MATERIAL_PT_displacement, CYCLES_MATERIAL_PT_displacement,
CYCLES_MATERIAL_PT_settings, CYCLES_MATERIAL_PT_settings,
CYCLES_MATERIAL_PT_viewport,
CYCLES_RENDER_PT_bake, CYCLES_RENDER_PT_bake,
CYCLES_RENDER_PT_debug, CYCLES_RENDER_PT_debug,
CYCLES_PARTICLE_PT_curve_settings,
CYCLES_SCENE_PT_simplify, CYCLES_SCENE_PT_simplify,
) )
@@ -1548,7 +1650,7 @@ classes = (
def register(): def register():
from bpy.utils import register_class from bpy.utils import register_class
bpy.types.RENDER_PT_context.append(draw_device) bpy.types.RENDER_PT_render.append(draw_device)
bpy.types.VIEW3D_HT_header.append(draw_pause) bpy.types.VIEW3D_HT_header.append(draw_pause)
for panel in get_panels(): for panel in get_panels():
@@ -1561,7 +1663,7 @@ def register():
def unregister(): def unregister():
from bpy.utils import unregister_class from bpy.utils import unregister_class
bpy.types.RENDER_PT_context.remove(draw_device) bpy.types.RENDER_PT_render.remove(draw_device)
bpy.types.VIEW3D_HT_header.remove(draw_pause) bpy.types.VIEW3D_HT_header.remove(draw_pause)
for panel in get_panels(): for panel in get_panels():

View File

@@ -433,14 +433,3 @@ def do_versions(self):
(bpy.data.version >= (2, 80, 0) and bpy.data.version <= (2, 80, 4)): (bpy.data.version >= (2, 80, 0) and bpy.data.version <= (2, 80, 4)):
# Switch to squared roughness convention # Switch to squared roughness convention
square_roughness_nodes_insert() square_roughness_nodes_insert()
if bpy.data.version <= (2, 80, 15):
# Copy cycles hair settings to internal settings
for part in bpy.data.particles:
cpart = part.get("cycles", None)
if cpart:
part.shape = cpart.get("shape", 0.0)
part.root_radius = cpart.get("root_width", 1.0)
part.tip_radius = cpart.get("tip_width", 0.0)
part.radius_scale = cpart.get("radius_scale", 0.01)
part.use_close_tip = cpart.get("use_closetip", True)

View File

@@ -95,8 +95,8 @@ static void blender_camera_init(BlenderCamera *bcam,
bcam->type = CAMERA_PERSPECTIVE; bcam->type = CAMERA_PERSPECTIVE;
bcam->zoom = 1.0f; bcam->zoom = 1.0f;
bcam->pixelaspect = make_float2(1.0f, 1.0f); bcam->pixelaspect = make_float2(1.0f, 1.0f);
bcam->sensor_width = 36.0f; bcam->sensor_width = 32.0f;
bcam->sensor_height = 24.0f; bcam->sensor_height = 18.0f;
bcam->sensor_fit = BlenderCamera::AUTO; bcam->sensor_fit = BlenderCamera::AUTO;
bcam->shuttertime = 1.0f; bcam->shuttertime = 1.0f;
bcam->motion_position = Camera::MOTION_POSITION_CENTER; bcam->motion_position = Camera::MOTION_POSITION_CENTER;

View File

@@ -149,16 +149,18 @@ static bool ObtainCacheParticleData(Mesh *mesh,
if(b_part.kink() == BL::ParticleSettings::kink_SPIRAL) if(b_part.kink() == BL::ParticleSettings::kink_SPIRAL)
ren_step += b_part.kink_extra_steps(); ren_step += b_part.kink_extra_steps();
PointerRNA cpsys = RNA_pointer_get(&b_part.ptr, "cycles");
CData->psys_firstcurve.push_back_slow(curvenum); CData->psys_firstcurve.push_back_slow(curvenum);
CData->psys_curvenum.push_back_slow(totcurves); CData->psys_curvenum.push_back_slow(totcurves);
CData->psys_shader.push_back_slow(shader); CData->psys_shader.push_back_slow(shader);
float radius = b_part.radius_scale() * 0.5f; float radius = get_float(cpsys, "radius_scale") * 0.5f;
CData->psys_rootradius.push_back_slow(radius * b_part.root_radius()); CData->psys_rootradius.push_back_slow(radius * get_float(cpsys, "root_width"));
CData->psys_tipradius.push_back_slow(radius * b_part.tip_radius()); CData->psys_tipradius.push_back_slow(radius * get_float(cpsys, "tip_width"));
CData->psys_shape.push_back_slow(b_part.shape()); CData->psys_shape.push_back_slow(get_float(cpsys, "shape"));
CData->psys_closetip.push_back_slow(b_part.use_close_tip()); CData->psys_closetip.push_back_slow(get_boolean(cpsys, "use_closetip"));
int pa_no = 0; int pa_no = 0;
if(!(b_part.child_type() == 0) && totchild != 0) if(!(b_part.child_type() == 0) && totchild != 0)

View File

@@ -1173,7 +1173,7 @@ Mesh *BlenderSync::sync_mesh(BL::Depsgraph& b_depsgraph,
* freed data from the blender side. * freed data from the blender side.
*/ */
if(preview && b_ob.type() != BL::Object::type_MESH) if(preview && b_ob.type() != BL::Object::type_MESH)
b_ob.update_from_editmode(b_data); b_ob.update_from_editmode();
bool need_undeformed = mesh->need_attribute(scene, ATTR_STD_GENERATED); bool need_undeformed = mesh->need_attribute(scene, ATTR_STD_GENERATED);
@@ -1189,7 +1189,7 @@ Mesh *BlenderSync::sync_mesh(BL::Depsgraph& b_depsgraph,
BL::Mesh b_mesh = object_to_mesh(b_data, BL::Mesh b_mesh = object_to_mesh(b_data,
b_ob, b_ob,
b_depsgraph, b_depsgraph,
false, true,
need_undeformed, need_undeformed,
mesh->subdivision_type); mesh->subdivision_type);
@@ -1277,7 +1277,7 @@ void BlenderSync::sync_mesh_motion(BL::Depsgraph& b_depsgraph,
b_mesh = object_to_mesh(b_data, b_mesh = object_to_mesh(b_data,
b_ob, b_ob,
b_depsgraph, b_depsgraph,
false, true,
false, false,
Mesh::SUBDIVISION_NONE); Mesh::SUBDIVISION_NONE);
} }

View File

@@ -162,24 +162,10 @@ void BlenderSync::sync_light(BL::Object& b_parent,
light->axisu = transform_get_column(&tfm, 0); light->axisu = transform_get_column(&tfm, 0);
light->axisv = transform_get_column(&tfm, 1); light->axisv = transform_get_column(&tfm, 1);
light->sizeu = b_area_lamp.size(); light->sizeu = b_area_lamp.size();
switch(b_area_lamp.shape()) { if(b_area_lamp.shape() == BL::AreaLamp::shape_RECTANGLE)
case BL::AreaLamp::shape_SQUARE: light->sizev = b_area_lamp.size_y();
light->sizev = light->sizeu; else
light->round = false; light->sizev = light->sizeu;
break;
case BL::AreaLamp::shape_RECTANGLE:
light->sizev = b_area_lamp.size_y();
light->round = false;
break;
case BL::AreaLamp::shape_DISK:
light->sizev = light->sizeu;
light->round = true;
break;
case BL::AreaLamp::shape_ELLIPSE:
light->sizev = b_area_lamp.size_y();
light->round = true;
break;
}
light->type = LIGHT_AREA; light->type = LIGHT_AREA;
break; break;
} }
@@ -278,25 +264,25 @@ void BlenderSync::sync_background_light(bool use_portal)
/* Object */ /* Object */
Object *BlenderSync::sync_object(BL::Depsgraph& b_depsgraph, Object *BlenderSync::sync_object(BL::Depsgraph& b_depsgraph,
BL::DepsgraphObjectInstance& b_instance, BL::Depsgraph::duplis_iterator& b_dupli_iter,
uint layer_flag, uint layer_flag,
float motion_time, float motion_time,
bool hide_tris, bool hide_tris,
BlenderObjectCulling& culling, BlenderObjectCulling& culling,
bool *use_portal) bool *use_portal)
{ {
const bool is_instance = b_instance.is_instance(); const bool is_instance = b_dupli_iter->is_instance();
BL::Object b_ob = b_instance.object(); BL::Object b_ob = b_dupli_iter->object();
BL::Object b_parent = is_instance ? b_instance.parent() BL::Object b_parent = is_instance ? b_dupli_iter->parent()
: b_instance.object(); : b_dupli_iter->object();
BL::Object b_ob_instance = is_instance ? b_instance.instance_object() BL::Object b_ob_instance = is_instance ? b_dupli_iter->instance_object()
: b_ob; : b_ob;
const bool motion = motion_time != 0.0f; const bool motion = motion_time != 0.0f;
/*const*/ Transform tfm = get_transform(b_ob.matrix_world()); /*const*/ Transform tfm = get_transform(b_ob.matrix_world());
int *persistent_id = NULL; int *persistent_id = NULL;
BL::Array<int, OBJECT_PERSISTENT_ID_SIZE> persistent_id_array; BL::Array<int, OBJECT_PERSISTENT_ID_SIZE> persistent_id_array;
if(is_instance) { if(is_instance) {
persistent_id_array = b_instance.persistent_id(); persistent_id_array = b_dupli_iter->persistent_id();
persistent_id = persistent_id_array.data; persistent_id = persistent_id_array.data;
} }
@@ -310,7 +296,7 @@ Object *BlenderSync::sync_object(BL::Depsgraph& b_depsgraph,
persistent_id, persistent_id,
b_ob, b_ob,
b_ob_instance, b_ob_instance,
is_instance ? b_instance.random_id() : 0, is_instance ? b_dupli_iter->random_id() : 0,
tfm, tfm,
use_portal); use_portal);
} }
@@ -448,12 +434,12 @@ Object *BlenderSync::sync_object(BL::Depsgraph& b_depsgraph,
/* dupli texture coordinates and random_id */ /* dupli texture coordinates and random_id */
if(is_instance) { if(is_instance) {
object->dupli_generated = 0.5f*get_float3(b_instance.orco()) - make_float3(0.5f, 0.5f, 0.5f); object->dupli_generated = 0.5f*get_float3(b_dupli_iter->orco()) - make_float3(0.5f, 0.5f, 0.5f);
object->dupli_uv = get_float2(b_instance.uv()); object->dupli_uv = get_float2(b_dupli_iter->uv());
object->random_id = b_instance.random_id(); object->random_id = b_dupli_iter->random_id();
/* Sync possible particle data. */ /* Sync possible particle data. */
sync_dupli_particle(b_ob, b_instance, object); sync_dupli_particle(b_ob, *b_dupli_iter, object);
} }
else { else {
object->dupli_generated = make_float3(0.0f, 0.0f, 0.0f); object->dupli_generated = make_float3(0.0f, 0.0f, 0.0f);
@@ -563,13 +549,12 @@ void BlenderSync::sync_objects(BL::Depsgraph& b_depsgraph, float motion_time)
bool cancel = false; bool cancel = false;
bool use_portal = false; bool use_portal = false;
BL::Depsgraph::object_instances_iterator b_instance_iter; BL::Depsgraph::duplis_iterator b_dupli_iter;
for(b_depsgraph.object_instances.begin(b_instance_iter); for(b_depsgraph.duplis.begin(b_dupli_iter);
b_instance_iter != b_depsgraph.object_instances.end() && !cancel; b_dupli_iter != b_depsgraph.duplis.end() && !cancel;
++b_instance_iter) ++b_dupli_iter)
{ {
BL::DepsgraphObjectInstance b_instance = *b_instance_iter; BL::Object b_ob = b_dupli_iter->object();
BL::Object b_ob = b_instance.object();
if(!b_ob.is_visible()) { if(!b_ob.is_visible()) {
continue; continue;
} }
@@ -585,7 +570,7 @@ void BlenderSync::sync_objects(BL::Depsgraph& b_depsgraph, float motion_time)
if(!object_render_hide(b_ob, true, true, hide_tris)) { if(!object_render_hide(b_ob, true, true, hide_tris)) {
/* object itself */ /* object itself */
sync_object(b_depsgraph, sync_object(b_depsgraph,
b_instance, b_dupli_iter,
~(0), /* until we get rid of layers */ ~(0), /* until we get rid of layers */
motion_time, motion_time,
hide_tris, hide_tris,

View File

@@ -28,11 +28,11 @@ CCL_NAMESPACE_BEGIN
/* Utilities */ /* Utilities */
bool BlenderSync::sync_dupli_particle(BL::Object& b_ob, bool BlenderSync::sync_dupli_particle(BL::Object& b_ob,
BL::DepsgraphObjectInstance& b_instance, BL::DepsgraphIter& b_dup,
Object *object) Object *object)
{ {
/* test if this dupli was generated from a particle sytem */ /* test if this dupli was generated from a particle sytem */
BL::ParticleSystem b_psys = b_instance.particle_system(); BL::ParticleSystem b_psys = b_dup.particle_system();
if(!b_psys) if(!b_psys)
return false; return false;
@@ -43,7 +43,7 @@ bool BlenderSync::sync_dupli_particle(BL::Object& b_ob,
return false; return false;
/* don't handle child particles yet */ /* don't handle child particles yet */
BL::Array<int, OBJECT_PERSISTENT_ID_SIZE> persistent_id = b_instance.persistent_id(); BL::Array<int, OBJECT_PERSISTENT_ID_SIZE> persistent_id = b_dup.persistent_id();
if(persistent_id[0] >= b_psys.particles.length()) if(persistent_id[0] >= b_psys.particles.length())
return false; return false;
@@ -53,7 +53,7 @@ bool BlenderSync::sync_dupli_particle(BL::Object& b_ob,
ParticleSystem *psys; ParticleSystem *psys;
bool first_use = !particle_system_map.is_used(key); bool first_use = !particle_system_map.is_used(key);
bool need_update = particle_system_map.sync(&psys, b_ob, b_instance.object(), key); bool need_update = particle_system_map.sync(&psys, b_ob, b_dup.object(), key);
/* no update needed? */ /* no update needed? */
if(!need_update && !object->mesh->need_update && !scene->object_manager->need_update) if(!need_update && !object->mesh->need_update && !scene->object_manager->need_update)

View File

@@ -203,10 +203,10 @@ static PyObject *exit_func(PyObject * /*self*/, PyObject * /*args*/)
static PyObject *create_func(PyObject * /*self*/, PyObject *args) static PyObject *create_func(PyObject * /*self*/, PyObject *args)
{ {
PyObject *pyengine, *pyuserpref, *pydata, *pyregion, *pyv3d, *pyrv3d; PyObject *pyengine, *pyuserpref, *pydata, *pyscene, *pyregion, *pyv3d, *pyrv3d;
int preview_osl; int preview_osl;
if(!PyArg_ParseTuple(args, "OOOOOOi", &pyengine, &pyuserpref, &pydata, if(!PyArg_ParseTuple(args, "OOOOOOOi", &pyengine, &pyuserpref, &pydata, &pyscene,
&pyregion, &pyv3d, &pyrv3d, &preview_osl)) &pyregion, &pyv3d, &pyrv3d, &preview_osl))
{ {
return NULL; return NULL;
@@ -225,6 +225,10 @@ static PyObject *create_func(PyObject * /*self*/, PyObject *args)
RNA_main_pointer_create((Main*)PyLong_AsVoidPtr(pydata), &dataptr); RNA_main_pointer_create((Main*)PyLong_AsVoidPtr(pydata), &dataptr);
BL::BlendData data(dataptr); BL::BlendData data(dataptr);
PointerRNA sceneptr;
RNA_id_pointer_create((ID*)PyLong_AsVoidPtr(pyscene), &sceneptr);
BL::Scene scene(sceneptr);
PointerRNA regionptr; PointerRNA regionptr;
RNA_pointer_create(NULL, &RNA_Region, pylong_as_voidptr_typesafe(pyregion), &regionptr); RNA_pointer_create(NULL, &RNA_Region, pylong_as_voidptr_typesafe(pyregion), &regionptr);
BL::Region region(regionptr); BL::Region region(regionptr);
@@ -245,13 +249,27 @@ static PyObject *create_func(PyObject * /*self*/, PyObject *args)
int width = region.width(); int width = region.width();
int height = region.height(); int height = region.height();
session = new BlenderSession(engine, userpref, data, v3d, rv3d, width, height); session = new BlenderSession(engine, userpref, data, scene, v3d, rv3d, width, height);
} }
else { else {
/* override some settings for preview */
if(engine.is_preview()) {
PointerRNA cscene = RNA_pointer_get(&sceneptr, "cycles");
RNA_boolean_set(&cscene, "shading_system", preview_osl);
RNA_boolean_set(&cscene, "use_progressive_refine", true);
}
/* offline session or preview render */ /* offline session or preview render */
session = new BlenderSession(engine, userpref, data, preview_osl); session = new BlenderSession(engine, userpref, data, scene);
} }
python_thread_state_save(&session->python_thread_state);
session->create();
python_thread_state_restore(&session->python_thread_state);
return PyLong_FromVoidPtr(session); return PyLong_FromVoidPtr(session);
} }
@@ -298,7 +316,7 @@ static PyObject *bake_func(PyObject * /*self*/, PyObject *args)
BlenderSession *session = (BlenderSession*)PyLong_AsVoidPtr(pysession); BlenderSession *session = (BlenderSession*)PyLong_AsVoidPtr(pysession);
PointerRNA depsgraphptr; PointerRNA depsgraphptr;
RNA_pointer_create(NULL, &RNA_Depsgraph, PyLong_AsVoidPtr(pydepsgraph), &depsgraphptr); RNA_id_pointer_create((ID*)PyLong_AsVoidPtr(pydepsgraph), &depsgraphptr);
BL::Depsgraph b_depsgraph(depsgraphptr); BL::Depsgraph b_depsgraph(depsgraphptr);
PointerRNA objectptr; PointerRNA objectptr;
@@ -342,9 +360,9 @@ static PyObject *draw_func(PyObject * /*self*/, PyObject *args)
static PyObject *reset_func(PyObject * /*self*/, PyObject *args) static PyObject *reset_func(PyObject * /*self*/, PyObject *args)
{ {
PyObject *pysession, *pydata, *pydepsgraph; PyObject *pysession, *pydata, *pyscene;
if(!PyArg_ParseTuple(args, "OOO", &pysession, &pydata, &pydepsgraph)) if(!PyArg_ParseTuple(args, "OOO", &pysession, &pydata, &pyscene))
return NULL; return NULL;
BlenderSession *session = (BlenderSession*)PyLong_AsVoidPtr(pysession); BlenderSession *session = (BlenderSession*)PyLong_AsVoidPtr(pysession);
@@ -353,13 +371,13 @@ static PyObject *reset_func(PyObject * /*self*/, PyObject *args)
RNA_main_pointer_create((Main*)PyLong_AsVoidPtr(pydata), &dataptr); RNA_main_pointer_create((Main*)PyLong_AsVoidPtr(pydata), &dataptr);
BL::BlendData b_data(dataptr); BL::BlendData b_data(dataptr);
PointerRNA depsgraphptr; PointerRNA sceneptr;
RNA_pointer_create(NULL, &RNA_Depsgraph, PyLong_AsVoidPtr(pydepsgraph), &depsgraphptr); RNA_id_pointer_create((ID*)PyLong_AsVoidPtr(pyscene), &sceneptr);
BL::Depsgraph b_depsgraph(depsgraphptr); BL::Scene b_scene(sceneptr);
python_thread_state_save(&session->python_thread_state); python_thread_state_save(&session->python_thread_state);
session->reset_session(b_data, b_depsgraph); session->reset_session(b_data, b_scene);
python_thread_state_restore(&session->python_thread_state); python_thread_state_restore(&session->python_thread_state);
@@ -376,7 +394,7 @@ static PyObject *sync_func(PyObject * /*self*/, PyObject *args)
BlenderSession *session = (BlenderSession*)PyLong_AsVoidPtr(pysession); BlenderSession *session = (BlenderSession*)PyLong_AsVoidPtr(pysession);
PointerRNA depsgraphptr; PointerRNA depsgraphptr;
RNA_pointer_create(NULL, &RNA_Depsgraph, PyLong_AsVoidPtr(pydepsgraph), &depsgraphptr); RNA_id_pointer_create((ID*)PyLong_AsVoidPtr(pydepsgraph), &depsgraphptr);
BL::Depsgraph b_depsgraph(depsgraphptr); BL::Depsgraph b_depsgraph(depsgraphptr);
python_thread_state_save(&session->python_thread_state); python_thread_state_save(&session->python_thread_state);
@@ -410,17 +428,13 @@ static PyObject *available_devices_func(PyObject * /*self*/, PyObject * /*args*/
static PyObject *osl_update_node_func(PyObject * /*self*/, PyObject *args) static PyObject *osl_update_node_func(PyObject * /*self*/, PyObject *args)
{ {
PyObject *pydata, *pynodegroup, *pynode; PyObject *pynodegroup, *pynode;
const char *filepath = NULL; const char *filepath = NULL;
if(!PyArg_ParseTuple(args, "OOOs", &pydata, &pynodegroup, &pynode, &filepath)) if(!PyArg_ParseTuple(args, "OOs", &pynodegroup, &pynode, &filepath))
return NULL; return NULL;
/* RNA */ /* RNA */
PointerRNA dataptr;
RNA_main_pointer_create((Main*)PyLong_AsVoidPtr(pydata), &dataptr);
BL::BlendData b_data(dataptr);
PointerRNA nodeptr; PointerRNA nodeptr;
RNA_pointer_create((ID*)PyLong_AsVoidPtr(pynodegroup), &RNA_ShaderNodeScript, (void*)PyLong_AsVoidPtr(pynode), &nodeptr); RNA_pointer_create((ID*)PyLong_AsVoidPtr(pynodegroup), &RNA_ShaderNodeScript, (void*)PyLong_AsVoidPtr(pynode), &nodeptr);
BL::ShaderNodeScript b_node(nodeptr); BL::ShaderNodeScript b_node(nodeptr);
@@ -518,7 +532,7 @@ static PyObject *osl_update_node_func(PyObject * /*self*/, PyObject *args)
b_sock = b_node.outputs[param->name.string()]; b_sock = b_node.outputs[param->name.string()];
/* remove if type no longer matches */ /* remove if type no longer matches */
if(b_sock && b_sock.bl_idname() != socket_type) { if(b_sock && b_sock.bl_idname() != socket_type) {
b_node.outputs.remove(b_data, b_sock); b_node.outputs.remove(b_sock);
b_sock = BL::NodeSocket(PointerRNA_NULL); b_sock = BL::NodeSocket(PointerRNA_NULL);
} }
} }
@@ -526,7 +540,7 @@ static PyObject *osl_update_node_func(PyObject * /*self*/, PyObject *args)
b_sock = b_node.inputs[param->name.string()]; b_sock = b_node.inputs[param->name.string()];
/* remove if type no longer matches */ /* remove if type no longer matches */
if(b_sock && b_sock.bl_idname() != socket_type) { if(b_sock && b_sock.bl_idname() != socket_type) {
b_node.inputs.remove(b_data, b_sock); b_node.inputs.remove(b_sock);
b_sock = BL::NodeSocket(PointerRNA_NULL); b_sock = BL::NodeSocket(PointerRNA_NULL);
} }
} }
@@ -534,9 +548,9 @@ static PyObject *osl_update_node_func(PyObject * /*self*/, PyObject *args)
if(!b_sock) { if(!b_sock) {
/* create new socket */ /* create new socket */
if(param->isoutput) if(param->isoutput)
b_sock = b_node.outputs.create(b_data, socket_type.c_str(), param->name.c_str(), param->name.c_str()); b_sock = b_node.outputs.create(socket_type.c_str(), param->name.c_str(), param->name.c_str());
else else
b_sock = b_node.inputs.create(b_data, socket_type.c_str(), param->name.c_str(), param->name.c_str()); b_sock = b_node.inputs.create(socket_type.c_str(), param->name.c_str(), param->name.c_str());
/* set default value */ /* set default value */
if(data_type == BL::NodeSocket::type_VALUE) { if(data_type == BL::NodeSocket::type_VALUE) {
@@ -570,7 +584,7 @@ static PyObject *osl_update_node_func(PyObject * /*self*/, PyObject *args)
for(b_node.inputs.begin(b_input); b_input != b_node.inputs.end(); ++b_input) { for(b_node.inputs.begin(b_input); b_input != b_node.inputs.end(); ++b_input) {
if(used_sockets.find(b_input->ptr.data) == used_sockets.end()) { if(used_sockets.find(b_input->ptr.data) == used_sockets.end()) {
b_node.inputs.remove(b_data, *b_input); b_node.inputs.remove(*b_input);
removed = true; removed = true;
break; break;
} }
@@ -578,7 +592,7 @@ static PyObject *osl_update_node_func(PyObject * /*self*/, PyObject *args)
for(b_node.outputs.begin(b_output); b_output != b_node.outputs.end(); ++b_output) { for(b_node.outputs.begin(b_output); b_output != b_node.outputs.end(); ++b_output) {
if(used_sockets.find(b_output->ptr.data) == used_sockets.end()) { if(used_sockets.find(b_output->ptr.data) == used_sockets.end()) {
b_node.outputs.remove(b_data, *b_output); b_node.outputs.remove(*b_output);
removed = true; removed = true;
break; break;
} }

View File

@@ -52,22 +52,22 @@ int BlenderSession::end_resumable_chunk = 0;
BlenderSession::BlenderSession(BL::RenderEngine& b_engine, BlenderSession::BlenderSession(BL::RenderEngine& b_engine,
BL::UserPreferences& b_userpref, BL::UserPreferences& b_userpref,
BL::BlendData& b_data, BL::BlendData& b_data,
bool preview_osl) BL::Scene& b_scene)
: session(NULL), : b_engine(b_engine),
b_engine(b_engine),
b_userpref(b_userpref), b_userpref(b_userpref),
b_data(b_data), b_data(b_data),
b_render(b_engine.render()), b_render(b_engine.render()),
b_depsgraph(PointerRNA_NULL), b_depsgraph(PointerRNA_NULL),
b_scene(PointerRNA_NULL), b_scene(b_scene),
b_v3d(PointerRNA_NULL), b_v3d(PointerRNA_NULL),
b_rv3d(PointerRNA_NULL), b_rv3d(PointerRNA_NULL),
width(0),
height(0),
preview_osl(preview_osl),
python_thread_state(NULL) python_thread_state(NULL)
{ {
/* offline render */ /* offline render */
width = render_resolution_x(b_render);
height = render_resolution_y(b_render);
background = true; background = true;
last_redraw_time = 0.0; last_redraw_time = 0.0;
start_resize_time = 0.0; start_resize_time = 0.0;
@@ -77,24 +77,24 @@ BlenderSession::BlenderSession(BL::RenderEngine& b_engine,
BlenderSession::BlenderSession(BL::RenderEngine& b_engine, BlenderSession::BlenderSession(BL::RenderEngine& b_engine,
BL::UserPreferences& b_userpref, BL::UserPreferences& b_userpref,
BL::BlendData& b_data, BL::BlendData& b_data,
BL::Scene& b_scene,
BL::SpaceView3D& b_v3d, BL::SpaceView3D& b_v3d,
BL::RegionView3D& b_rv3d, BL::RegionView3D& b_rv3d,
int width, int height) int width, int height)
: session(NULL), : b_engine(b_engine),
b_engine(b_engine),
b_userpref(b_userpref), b_userpref(b_userpref),
b_data(b_data), b_data(b_data),
b_render(b_engine.render()), b_render(b_scene.render()),
b_depsgraph(PointerRNA_NULL), b_depsgraph(PointerRNA_NULL),
b_scene(PointerRNA_NULL), b_scene(b_scene),
b_v3d(b_v3d), b_v3d(b_v3d),
b_rv3d(b_rv3d), b_rv3d(b_rv3d),
width(width), width(width),
height(height), height(height),
preview_osl(false),
python_thread_state(NULL) python_thread_state(NULL)
{ {
/* 3d view render */ /* 3d view render */
background = false; background = false;
last_redraw_time = 0.0; last_redraw_time = 0.0;
start_resize_time = 0.0; start_resize_time = 0.0;
@@ -168,40 +168,18 @@ void BlenderSession::create_session()
update_resumable_tile_manager(session_params.samples); update_resumable_tile_manager(session_params.samples);
} }
void BlenderSession::reset_session(BL::BlendData& b_data, BL::Depsgraph& b_depsgraph) void BlenderSession::reset_session(BL::BlendData& b_data_, BL::Scene& b_scene_)
{ {
this->b_data = b_data; b_data = b_data_;
this->b_depsgraph = b_depsgraph; b_render = b_engine.render();
this->b_scene = b_depsgraph.scene_eval(); b_scene = b_scene_;
if (preview_osl) {
PointerRNA cscene = RNA_pointer_get(&b_scene.ptr, "cycles");
RNA_boolean_set(&cscene, "shading_system", preview_osl);
}
if (b_v3d) {
this->b_render = b_scene.render();
}
else {
this->b_render = b_engine.render();
width = render_resolution_x(b_render);
height = render_resolution_y(b_render);
}
if (session == NULL) {
create();
}
if (b_v3d) {
/* NOTE: We need to create session, but all the code from below
* will make viewport render to stuck on initialization.
*/
return;
}
SessionParams session_params = BlenderSync::get_session_params(b_engine, b_userpref, b_scene, background); SessionParams session_params = BlenderSync::get_session_params(b_engine, b_userpref, b_scene, background);
SceneParams scene_params = BlenderSync::get_scene_params(b_scene, background); SceneParams scene_params = BlenderSync::get_scene_params(b_scene, background);
width = render_resolution_x(b_render);
height = render_resolution_y(b_render);
if(scene->params.modified(scene_params) || if(scene->params.modified(scene_params) ||
session->params.modified(session_params) || session->params.modified(session_params) ||
!scene_params.persistent_data) !scene_params.persistent_data)
@@ -394,7 +372,7 @@ void BlenderSession::render(BL::Depsgraph& b_depsgraph_)
BufferParams buffer_params = BlenderSync::get_buffer_params(b_render, b_v3d, b_rv3d, scene->camera, width, height); BufferParams buffer_params = BlenderSync::get_buffer_params(b_render, b_v3d, b_rv3d, scene->camera, width, height);
/* render each layer */ /* render each layer */
BL::ViewLayer b_view_layer = b_depsgraph.view_layer_eval(); BL::ViewLayer b_view_layer = b_depsgraph.view_layer();
/* We do some special meta attributes when we only have single layer. */ /* We do some special meta attributes when we only have single layer. */
const bool is_single_layer = (b_scene.view_layers.length() == 1); const bool is_single_layer = (b_scene.view_layers.length() == 1);
@@ -773,7 +751,7 @@ void BlenderSession::synchronize(BL::Depsgraph& b_depsgraph_)
/* copy recalc flags, outside of mutex so we can decide to do the real /* copy recalc flags, outside of mutex so we can decide to do the real
* synchronization at a later time to not block on running updates */ * synchronization at a later time to not block on running updates */
sync->sync_recalc(b_depsgraph_); sync->sync_recalc();
/* don't do synchronization if on pause */ /* don't do synchronization if on pause */
if(session_pause) { if(session_pause) {

View File

@@ -37,11 +37,12 @@ public:
BlenderSession(BL::RenderEngine& b_engine, BlenderSession(BL::RenderEngine& b_engine,
BL::UserPreferences& b_userpref, BL::UserPreferences& b_userpref,
BL::BlendData& b_data, BL::BlendData& b_data,
bool preview_osl); BL::Scene& b_scene);
BlenderSession(BL::RenderEngine& b_engine, BlenderSession(BL::RenderEngine& b_engine,
BL::UserPreferences& b_userpref, BL::UserPreferences& b_userpref,
BL::BlendData& b_data, BL::BlendData& b_data,
BL::Scene& b_scene,
BL::SpaceView3D& b_v3d, BL::SpaceView3D& b_v3d,
BL::RegionView3D& b_rv3d, BL::RegionView3D& b_rv3d,
int width, int height); int width, int height);
@@ -55,7 +56,7 @@ public:
void free_session(); void free_session();
void reset_session(BL::BlendData& b_data, void reset_session(BL::BlendData& b_data,
BL::Depsgraph& b_depsgraph); BL::Scene& b_scene);
/* offline render */ /* offline render */
void render(BL::Depsgraph& b_depsgraph); void render(BL::Depsgraph& b_depsgraph);
@@ -118,7 +119,6 @@ public:
double last_status_time; double last_status_time;
int width, height; int width, height;
bool preview_osl;
double start_resize_time; double start_resize_time;
void *python_thread_state; void *python_thread_state;

View File

@@ -659,9 +659,7 @@ static ShaderNode *add_node(Scene *scene,
image->animated = b_image_node.image_user().use_auto_refresh(); image->animated = b_image_node.image_user().use_auto_refresh();
image->use_alpha = b_image.use_alpha(); image->use_alpha = b_image.use_alpha();
/* TODO: restore */
/* TODO(sergey): Does not work properly when we change builtin type. */ /* TODO(sergey): Does not work properly when we change builtin type. */
#if 0
if(b_image.is_updated()) { if(b_image.is_updated()) {
scene->image_manager->tag_reload_image( scene->image_manager->tag_reload_image(
image->filename.string(), image->filename.string(),
@@ -670,7 +668,6 @@ static ShaderNode *add_node(Scene *scene,
get_image_extension(b_image_node), get_image_extension(b_image_node),
image->use_alpha); image->use_alpha);
} }
#endif
} }
image->color_space = (NodeImageColorSpace)b_image_node.color_space(); image->color_space = (NodeImageColorSpace)b_image_node.color_space();
image->projection = (NodeImageProjection)b_image_node.projection(); image->projection = (NodeImageProjection)b_image_node.projection();
@@ -710,9 +707,7 @@ static ShaderNode *add_node(Scene *scene,
env->animated = b_env_node.image_user().use_auto_refresh(); env->animated = b_env_node.image_user().use_auto_refresh();
env->use_alpha = b_image.use_alpha(); env->use_alpha = b_image.use_alpha();
/* TODO: restore */
/* TODO(sergey): Does not work properly when we change builtin type. */ /* TODO(sergey): Does not work properly when we change builtin type. */
#if 0
if(b_image.is_updated()) { if(b_image.is_updated()) {
scene->image_manager->tag_reload_image( scene->image_manager->tag_reload_image(
env->filename.string(), env->filename.string(),
@@ -721,7 +716,6 @@ static ShaderNode *add_node(Scene *scene,
EXTENSION_REPEAT, EXTENSION_REPEAT,
env->use_alpha); env->use_alpha);
} }
#endif
} }
env->color_space = (NodeImageColorSpace)b_env_node.color_space(); env->color_space = (NodeImageColorSpace)b_env_node.color_space();
env->interpolation = get_image_interpolation(b_env_node); env->interpolation = get_image_interpolation(b_env_node);
@@ -817,22 +811,6 @@ static ShaderNode *add_node(Scene *scene,
get_tex_mapping(&sky->tex_mapping, b_texture_mapping); get_tex_mapping(&sky->tex_mapping, b_texture_mapping);
node = sky; node = sky;
} }
else if(b_node.is_a(&RNA_ShaderNodeTexIES)) {
BL::ShaderNodeTexIES b_ies_node(b_node);
IESLightNode *ies = new IESLightNode();
switch(b_ies_node.mode()) {
case BL::ShaderNodeTexIES::mode_EXTERNAL:
ies->filename = blender_absolute_path(b_data, b_ntree, b_ies_node.filepath());
break;
case BL::ShaderNodeTexIES::mode_INTERNAL:
ies->ies = get_text_datablock_content(b_ies_node.ies().ptr);
if(ies->ies.empty()) {
ies->ies = "\n";
}
break;
}
node = ies;
}
else if(b_node.is_a(&RNA_ShaderNodeNormalMap)) { else if(b_node.is_a(&RNA_ShaderNodeNormalMap)) {
BL::ShaderNodeNormalMap b_normal_map_node(b_node); BL::ShaderNodeNormalMap b_normal_map_node(b_node);
NormalMapNode *nmap = new NormalMapNode(); NormalMapNode *nmap = new NormalMapNode();
@@ -1244,32 +1222,33 @@ void BlenderSync::sync_materials(BL::Depsgraph& b_depsgraph, bool update_all)
TaskPool pool; TaskPool pool;
set<Shader*> updated_shaders; set<Shader*> updated_shaders;
BL::Depsgraph::ids_iterator b_id; /* material loop */
for(b_depsgraph.ids.begin(b_id); b_id != b_depsgraph.ids.end(); ++b_id) { BL::BlendData::materials_iterator b_mat_orig;
if (!b_id->is_a(&RNA_Material)) { for(b_data.materials.begin(b_mat_orig);
continue; b_mat_orig != b_data.materials.end();
} ++b_mat_orig)
{
BL::Material b_mat(*b_id); /* TODO(sergey): Iterate over evaluated data rather than using mapping. */
BL::Material b_mat_(b_depsgraph.evaluated_id_get(*b_mat_orig));
BL::Material *b_mat = &b_mat_;
Shader *shader; Shader *shader;
/* test if we need to sync */ /* test if we need to sync */
if(shader_map.sync(&shader, b_mat) || shader->need_sync_object || update_all) { if(shader_map.sync(&shader, *b_mat) || update_all) {
ShaderGraph *graph = new ShaderGraph(); ShaderGraph *graph = new ShaderGraph();
shader->name = b_mat.name().c_str(); shader->name = b_mat->name().c_str();
shader->pass_id = b_mat.pass_index(); shader->pass_id = b_mat->pass_index();
shader->need_sync_object = false;
/* create nodes */ /* create nodes */
if(b_mat.use_nodes() && b_mat.node_tree()) { if(b_mat->use_nodes() && b_mat->node_tree()) {
BL::ShaderNodeTree b_ntree(b_mat.node_tree()); BL::ShaderNodeTree b_ntree(b_mat->node_tree());
add_nodes(scene, b_engine, b_data, b_depsgraph, b_scene, graph, b_ntree); add_nodes(scene, b_engine, b_data, b_depsgraph, b_scene, graph, b_ntree);
} }
else { else {
DiffuseBsdfNode *diffuse = new DiffuseBsdfNode(); DiffuseBsdfNode *diffuse = new DiffuseBsdfNode();
diffuse->color = get_float3(b_mat.diffuse_color()); diffuse->color = get_float3(b_mat->diffuse_color());
graph->add(diffuse); graph->add(diffuse);
ShaderNode *out = graph->output(); ShaderNode *out = graph->output();
@@ -1277,7 +1256,7 @@ void BlenderSync::sync_materials(BL::Depsgraph& b_depsgraph, bool update_all)
} }
/* settings */ /* settings */
PointerRNA cmat = RNA_pointer_get(&b_mat.ptr, "cycles"); PointerRNA cmat = RNA_pointer_get(&b_mat->ptr, "cycles");
shader->use_mis = get_boolean(cmat, "sample_as_light"); shader->use_mis = get_boolean(cmat, "sample_as_light");
shader->use_transparent_shadow = get_boolean(cmat, "use_transparent_shadow"); shader->use_transparent_shadow = get_boolean(cmat, "use_transparent_shadow");
shader->heterogeneous_volume = !get_boolean(cmat, "homogeneous_volume"); shader->heterogeneous_volume = !get_boolean(cmat, "homogeneous_volume");
@@ -1417,39 +1396,41 @@ void BlenderSync::sync_lamps(BL::Depsgraph& b_depsgraph, bool update_all)
{ {
shader_map.set_default(scene->default_light); shader_map.set_default(scene->default_light);
BL::Depsgraph::ids_iterator b_id; /* lamp loop */
for(b_depsgraph.ids.begin(b_id); b_id != b_depsgraph.ids.end(); ++b_id) { BL::BlendData::lamps_iterator b_lamp_orig;
if (!b_id->is_a(&RNA_Lamp)) { for(b_data.lamps.begin(b_lamp_orig);
continue; b_lamp_orig != b_data.lamps.end();
} ++b_lamp_orig)
{
BL::Lamp b_lamp(*b_id); /* TODO(sergey): Iterate over evaluated data rather than using mapping. */
BL::Lamp b_lamp_(b_depsgraph.evaluated_id_get(*b_lamp_orig));
BL::Lamp *b_lamp = &b_lamp_;
Shader *shader; Shader *shader;
/* test if we need to sync */ /* test if we need to sync */
if(shader_map.sync(&shader, b_lamp) || update_all) { if(shader_map.sync(&shader, *b_lamp) || update_all) {
ShaderGraph *graph = new ShaderGraph(); ShaderGraph *graph = new ShaderGraph();
/* create nodes */ /* create nodes */
if(b_lamp.use_nodes() && b_lamp.node_tree()) { if(b_lamp->use_nodes() && b_lamp->node_tree()) {
shader->name = b_lamp.name().c_str(); shader->name = b_lamp->name().c_str();
BL::ShaderNodeTree b_ntree(b_lamp.node_tree()); BL::ShaderNodeTree b_ntree(b_lamp->node_tree());
add_nodes(scene, b_engine, b_data, b_depsgraph, b_scene, graph, b_ntree); add_nodes(scene, b_engine, b_data, b_depsgraph, b_scene, graph, b_ntree);
} }
else { else {
float strength = 1.0f; float strength = 1.0f;
if(b_lamp.type() == BL::Lamp::type_POINT || if(b_lamp->type() == BL::Lamp::type_POINT ||
b_lamp.type() == BL::Lamp::type_SPOT || b_lamp->type() == BL::Lamp::type_SPOT ||
b_lamp.type() == BL::Lamp::type_AREA) b_lamp->type() == BL::Lamp::type_AREA)
{ {
strength = 100.0f; strength = 100.0f;
} }
EmissionNode *emission = new EmissionNode(); EmissionNode *emission = new EmissionNode();
emission->color = get_float3(b_lamp.color()); emission->color = get_float3(b_lamp->color());
emission->strength = strength; emission->strength = strength;
graph->add(emission); graph->add(emission);

View File

@@ -76,12 +76,31 @@ BlenderSync::~BlenderSync()
/* Sync */ /* Sync */
void BlenderSync::sync_recalc(BL::Depsgraph& b_depsgraph) bool BlenderSync::sync_recalc()
{ {
/* Sync recalc flags from blender to cycles. Actual update is done separate, /* sync recalc flags from blender to cycles. actual update is done separate,
* so we can do it later on if doing it immediate is not suitable. */ * so we can do it later on if doing it immediate is not suitable */
BL::BlendData::materials_iterator b_mat;
bool has_updated_objects = b_data.objects.is_updated();
for(b_data.materials.begin(b_mat); b_mat != b_data.materials.end(); ++b_mat) {
if(b_mat->is_updated() || (b_mat->node_tree() && b_mat->node_tree().is_updated())) {
shader_map.set_recalc(*b_mat);
}
else {
Shader *shader = shader_map.find(*b_mat);
if(has_updated_objects && shader != NULL && shader->has_object_dependency) {
shader_map.set_recalc(*b_mat);
}
}
}
BL::BlendData::lamps_iterator b_lamp;
for(b_data.lamps.begin(b_lamp); b_lamp != b_data.lamps.end(); ++b_lamp)
if(b_lamp->is_updated() || (b_lamp->node_tree() && b_lamp->node_tree().is_updated()))
shader_map.set_recalc(*b_lamp);
bool has_updated_objects = b_depsgraph.id_type_updated(BL::DriverTarget::id_type_OBJECT);
bool dicing_prop_changed = false; bool dicing_prop_changed = false;
if(experimental) { if(experimental) {
@@ -103,77 +122,70 @@ void BlenderSync::sync_recalc(BL::Depsgraph& b_depsgraph)
} }
} }
/* Iterate over all IDs in this depsgraph. */ BL::BlendData::objects_iterator b_ob;
BL::Depsgraph::updates_iterator b_update;
for(b_depsgraph.updates.begin(b_update); b_update != b_depsgraph.updates.end(); ++b_update) {
BL::ID b_id(b_update->id());
/* Material */ for(b_data.objects.begin(b_ob); b_ob != b_data.objects.end(); ++b_ob) {
if (b_id.is_a(&RNA_Material)) { if(b_ob->is_updated()) {
BL::Material b_mat(b_id); object_map.set_recalc(*b_ob);
shader_map.set_recalc(b_mat); light_map.set_recalc(*b_ob);
} }
/* Lamp */
else if (b_id.is_a(&RNA_Lamp)) {
BL::Lamp b_lamp(b_id);
shader_map.set_recalc(b_lamp);
}
/* Object */
else if (b_id.is_a(&RNA_Object)) {
BL::Object b_ob(b_id);
const bool updated_geometry = b_update->updated_geometry();
if (b_update->updated_transform()) { if(object_is_mesh(*b_ob)) {
object_map.set_recalc(b_ob); if(b_ob->is_updated_data() || b_ob->data().is_updated() ||
light_map.set_recalc(b_ob); (dicing_prop_changed && object_subdivision_type(*b_ob, preview, experimental) != Mesh::SUBDIVISION_NONE))
} {
BL::ID key = BKE_object_is_modified(*b_ob)? *b_ob: b_ob->data();
if(object_is_mesh(b_ob)) { mesh_map.set_recalc(key);
if(updated_geometry ||
(dicing_prop_changed && object_subdivision_type(b_ob, preview, experimental) != Mesh::SUBDIVISION_NONE))
{
BL::ID key = BKE_object_is_modified(b_ob)? b_ob: b_ob.data();
mesh_map.set_recalc(key);
}
}
else if(object_is_light(b_ob)) {
if(updated_geometry) {
light_map.set_recalc(b_ob);
}
}
if(updated_geometry) {
BL::Object::particle_systems_iterator b_psys;
for(b_ob.particle_systems.begin(b_psys); b_psys != b_ob.particle_systems.end(); ++b_psys)
particle_system_map.set_recalc(b_ob);
} }
} }
/* Mesh */ else if(object_is_light(*b_ob)) {
else if (b_id.is_a(&RNA_Mesh)) { if(b_ob->is_updated_data() || b_ob->data().is_updated())
BL::Mesh b_mesh(b_id); light_map.set_recalc(*b_ob);
mesh_map.set_recalc(b_mesh);
} }
/* World */
else if (b_id.is_a(&RNA_World)) { if(b_ob->is_updated_data()) {
BL::World b_world(b_id); BL::Object::particle_systems_iterator b_psys;
if(world_map == b_world.ptr.data) { for(b_ob->particle_systems.begin(b_psys); b_psys != b_ob->particle_systems.end(); ++b_psys)
particle_system_map.set_recalc(*b_ob);
}
}
BL::BlendData::meshes_iterator b_mesh;
for(b_data.meshes.begin(b_mesh); b_mesh != b_data.meshes.end(); ++b_mesh) {
if(b_mesh->is_updated()) {
mesh_map.set_recalc(*b_mesh);
}
}
BL::BlendData::worlds_iterator b_world;
for(b_data.worlds.begin(b_world); b_world != b_data.worlds.end(); ++b_world) {
if(world_map == b_world->ptr.data) {
if(b_world->is_updated() ||
(b_world->node_tree() && b_world->node_tree().is_updated()))
{
world_recalc = true; world_recalc = true;
} }
} else if(b_world->node_tree() && b_world->use_nodes()) {
} Shader *shader = scene->default_background;
if(has_updated_objects && shader->has_object_dependency) {
/* Updates shader with object dependency if objects changed. */ world_recalc = true;
if (has_updated_objects) { }
if(scene->default_background->has_object_dependency) {
world_recalc = true;
}
foreach(Shader *shader, scene->shaders) {
if (shader->has_object_dependency) {
shader->need_sync_object = true;
} }
} }
} }
bool recalc =
shader_map.has_recalc() ||
object_map.has_recalc() ||
light_map.has_recalc() ||
mesh_map.has_recalc() ||
particle_system_map.has_recalc() ||
BlendDataObjects_is_updated_get(&b_data.ptr) ||
world_recalc;
return recalc;
} }
void BlenderSync::sync_data(BL::RenderSettings& b_render, void BlenderSync::sync_data(BL::RenderSettings& b_render,
@@ -183,7 +195,7 @@ void BlenderSync::sync_data(BL::RenderSettings& b_render,
int width, int height, int width, int height,
void **python_thread_state) void **python_thread_state)
{ {
BL::ViewLayer b_view_layer = b_depsgraph.view_layer_eval(); BL::ViewLayer b_view_layer = b_depsgraph.view_layer();
sync_view_layer(b_v3d, b_view_layer); sync_view_layer(b_v3d, b_view_layer);
sync_integrator(); sync_integrator();
@@ -784,8 +796,7 @@ SessionParams BlenderSync::get_session_params(BL::RenderEngine& b_engine,
params.text_timeout = (double)get_float(cscene, "debug_text_timeout"); params.text_timeout = (double)get_float(cscene, "debug_text_timeout");
/* progressive refine */ /* progressive refine */
params.progressive_refine = (b_engine.is_preview() || params.progressive_refine = get_boolean(cscene, "use_progressive_refine") &&
get_boolean(cscene, "use_progressive_refine")) &&
!b_r.use_save_buffers(); !b_r.use_save_buffers();
if(params.progressive_refine) { if(params.progressive_refine) {

View File

@@ -59,7 +59,7 @@ public:
~BlenderSync(); ~BlenderSync();
/* sync */ /* sync */
void sync_recalc(BL::Depsgraph& b_depsgraph); bool sync_recalc();
void sync_data(BL::RenderSettings& b_render, void sync_data(BL::RenderSettings& b_render,
BL::Depsgraph& b_depsgraph, BL::Depsgraph& b_depsgraph,
BL::SpaceView3D& b_v3d, BL::SpaceView3D& b_v3d,
@@ -126,7 +126,7 @@ private:
bool motion, bool motion,
int motion_step = 0); int motion_step = 0);
Object *sync_object(BL::Depsgraph& b_depsgraph, Object *sync_object(BL::Depsgraph& b_depsgraph,
BL::DepsgraphObjectInstance& b_instance, BL::Depsgraph::duplis_iterator& b_dupli_iter,
uint layer_flag, uint layer_flag,
float motion_time, float motion_time,
bool hide_tris, bool hide_tris,
@@ -151,7 +151,7 @@ private:
/* particles */ /* particles */
bool sync_dupli_particle(BL::Object& b_ob, bool sync_dupli_particle(BL::Object& b_ob,
BL::DepsgraphObjectInstance& b_instance, BL::DepsgraphIter& b_dup,
Object *object); Object *object);
/* Images. */ /* Images. */

View File

@@ -53,7 +53,6 @@ static inline BL::Mesh object_to_mesh(BL::BlendData& data,
bool subsurf_mod_show_render = false; bool subsurf_mod_show_render = false;
bool subsurf_mod_show_viewport = false; bool subsurf_mod_show_viewport = false;
/* TODO: make this work with copy-on-write, modifiers are already evaluated. */
if(subdivision_type != Mesh::SUBDIVISION_NONE) { if(subdivision_type != Mesh::SUBDIVISION_NONE) {
BL::Modifier subsurf_mod = object.modifiers[object.modifiers.length()-1]; BL::Modifier subsurf_mod = object.modifiers[object.modifiers.length()-1];
@@ -468,21 +467,6 @@ static inline string blender_absolute_path(BL::BlendData& b_data,
return path; return path;
} }
static inline string get_text_datablock_content(const PointerRNA& ptr)
{
if(ptr.data == NULL) {
return "";
}
string content;
BL::Text::lines_iterator iter;
for(iter.begin(ptr); iter; ++iter) {
content += iter->body() + "\n";
}
return content;
}
/* Texture Space */ /* Texture Space */
static inline void mesh_texture_space(BL::Mesh& b_mesh, static inline void mesh_texture_space(BL::Mesh& b_mesh,

View File

@@ -248,7 +248,7 @@ void Device::draw_pixels(
if(rgba.data_type == TYPE_HALF) { if(rgba.data_type == TYPE_HALF) {
GLhalf *data_pointer = (GLhalf*)rgba.host_pointer; GLhalf *data_pointer = (GLhalf*)rgba.host_pointer;
data_pointer += 4 * y * w; data_pointer += 4 * y * w;
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA16F, w, h, 0, GL_RGBA, GL_HALF_FLOAT, data_pointer); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA16F_ARB, w, h, 0, GL_RGBA, GL_HALF_FLOAT, data_pointer);
} }
else { else {
uint8_t *data_pointer = (uint8_t*)rgba.host_pointer; uint8_t *data_pointer = (uint8_t*)rgba.host_pointer;

View File

@@ -1684,7 +1684,7 @@ public:
min_blocks *= 8; min_blocks *= 8;
} }
uint step_samples = divide_up(min_blocks * num_threads_per_block, wtile->w * wtile->h); uint step_samples = divide_up(min_blocks * num_threads_per_block, wtile->w * wtile->h);;
/* Render all samples. */ /* Render all samples. */
int start_sample = rtile.start_sample; int start_sample = rtile.start_sample;
@@ -1893,7 +1893,7 @@ public:
glGenTextures(1, &pmem.cuTexId); glGenTextures(1, &pmem.cuTexId);
glBindTexture(GL_TEXTURE_2D, pmem.cuTexId); glBindTexture(GL_TEXTURE_2D, pmem.cuTexId);
if(mem.data_type == TYPE_HALF) if(mem.data_type == TYPE_HALF)
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA16F, pmem.w, pmem.h, 0, GL_RGBA, GL_HALF_FLOAT, NULL); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA16F_ARB, pmem.w, pmem.h, 0, GL_RGBA, GL_HALF_FLOAT, NULL);
else else
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, pmem.w, pmem.h, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, pmem.w, pmem.h, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);

View File

@@ -73,13 +73,12 @@ struct SocketType
INTERNAL = (1 << 2) | (1 << 3), INTERNAL = (1 << 2) | (1 << 3),
LINK_TEXTURE_GENERATED = (1 << 4), LINK_TEXTURE_GENERATED = (1 << 4),
LINK_TEXTURE_NORMAL = (1 << 5), LINK_TEXTURE_UV = (1 << 5),
LINK_TEXTURE_UV = (1 << 6), LINK_INCOMING = (1 << 6),
LINK_INCOMING = (1 << 7), LINK_NORMAL = (1 << 7),
LINK_NORMAL = (1 << 8), LINK_POSITION = (1 << 8),
LINK_POSITION = (1 << 9), LINK_TANGENT = (1 << 9),
LINK_TANGENT = (1 << 10), DEFAULT_LINK_MASK = (1 << 4) | (1 << 5) | (1 << 6) | (1 << 7) | (1 << 8) | (1 << 9)
DEFAULT_LINK_MASK = (1 << 4) | (1 << 5) | (1 << 6) | (1 << 7) | (1 << 8) | (1 << 9) | (1 << 10)
}; };
ustring name; ustring name;

View File

@@ -178,7 +178,6 @@ set(SRC_SVM_HEADERS
svm/svm_geometry.h svm/svm_geometry.h
svm/svm_gradient.h svm/svm_gradient.h
svm/svm_hsv.h svm/svm_hsv.h
svm/svm_ies.h
svm/svm_image.h svm/svm_image.h
svm/svm_invert.h svm/svm_invert.h
svm/svm_light_path.h svm/svm_light_path.h

View File

@@ -37,22 +37,15 @@ CCL_NAMESPACE_BEGIN
ccl_device void bsdf_transparent_setup(ShaderData *sd, const float3 weight, int path_flag) ccl_device void bsdf_transparent_setup(ShaderData *sd, const float3 weight, int path_flag)
{ {
/* Check cutoff weight. */
float sample_weight = fabsf(average(weight));
if(!(sample_weight >= CLOSURE_WEIGHT_CUTOFF)) {
return;
}
if(sd->flag & SD_TRANSPARENT) { if(sd->flag & SD_TRANSPARENT) {
sd->closure_transparent_extinction += weight; sd->closure_transparent_extinction += weight;
/* Add weight to existing transparent BSDF. */
for(int i = 0; i < sd->num_closure; i++) { for(int i = 0; i < sd->num_closure; i++) {
ShaderClosure *sc = &sd->closure[i]; ShaderClosure *sc = &sd->closure[i];
if(sc->type == CLOSURE_BSDF_TRANSPARENT_ID) { if(sc->type == CLOSURE_BSDF_TRANSPARENT_ID) {
sc->weight += weight; sc->weight += weight;
sc->sample_weight += sample_weight; sc->sample_weight += fabsf(average(weight));
break; break;
} }
} }
@@ -68,15 +61,11 @@ ccl_device void bsdf_transparent_setup(ShaderData *sd, const float3 weight, int
sd->num_closure_left = 1; sd->num_closure_left = 1;
} }
/* Create new transparent BSDF. */ ShaderClosure *bsdf = bsdf_alloc(sd, sizeof(ShaderClosure), weight);
ShaderClosure *bsdf = closure_alloc(sd, sizeof(ShaderClosure), CLOSURE_BSDF_TRANSPARENT_ID, weight);
if(bsdf) { if(bsdf) {
bsdf->sample_weight = sample_weight;
bsdf->N = sd->N; bsdf->N = sd->N;
} bsdf->type = CLOSURE_BSDF_TRANSPARENT_ID;
else if(path_flag & PATH_RAY_TERMINATE) {
sd->num_closure_left = 0;
} }
} }
} }

View File

@@ -61,13 +61,8 @@ ccl_device_inline void kernel_filter_construct_gramian(int x, int y,
make_int2(x+dx, y+dy), buffer + q_offset, make_int2(x+dx, y+dy), buffer + q_offset,
pass_stride, *rank, design_row, transform, stride); pass_stride, *rank, design_row, transform, stride);
#ifdef __KERNEL_GPU__
math_trimatrix_add_gramian_strided(XtWX, (*rank)+1, design_row, weight, stride); math_trimatrix_add_gramian_strided(XtWX, (*rank)+1, design_row, weight, stride);
math_vec3_add_strided(XtWY, (*rank)+1, design_row, weight * q_color, stride); math_vec3_add_strided(XtWY, (*rank)+1, design_row, weight * q_color, stride);
#else
math_trimatrix_add_gramian(XtWX, (*rank)+1, design_row, weight);
math_vec3_add(XtWY, (*rank)+1, design_row, weight * q_color);
#endif
} }
ccl_device_inline void kernel_filter_finalize(int x, int y, ccl_device_inline void kernel_filter_finalize(int x, int y,

View File

@@ -44,7 +44,7 @@ typedef struct LightSample {
* *
* Note: light_p is modified when sample_coord is true. * Note: light_p is modified when sample_coord is true.
*/ */
ccl_device_inline float rect_light_sample(float3 P, ccl_device_inline float area_light_sample(float3 P,
float3 *light_p, float3 *light_p,
float3 axisu, float3 axisv, float3 axisu, float3 axisv,
float randu, float randv, float randu, float randv,
@@ -125,60 +125,6 @@ ccl_device_inline float rect_light_sample(float3 P,
return 0.0f; return 0.0f;
} }
ccl_device_inline float3 ellipse_sample(float3 ru, float3 rv, float randu, float randv)
{
to_unit_disk(&randu, &randv);
return ru*randu + rv*randv;
}
ccl_device float3 disk_light_sample(float3 v, float randu, float randv)
{
float3 ru, rv;
make_orthonormals(v, &ru, &rv);
return ellipse_sample(ru, rv, randu, randv);
}
ccl_device float3 distant_light_sample(float3 D, float radius, float randu, float randv)
{
return normalize(D + disk_light_sample(D, randu, randv)*radius);
}
ccl_device float3 sphere_light_sample(float3 P, float3 center, float radius, float randu, float randv)
{
return disk_light_sample(normalize(P - center), randu, randv)*radius;
}
ccl_device float spot_light_attenuation(float3 dir, float spot_angle, float spot_smooth, LightSample *ls)
{
float3 I = ls->Ng;
float attenuation = dot(dir, I);
if(attenuation <= spot_angle) {
attenuation = 0.0f;
}
else {
float t = attenuation - spot_angle;
if(t < spot_smooth && spot_smooth != 0.0f)
attenuation *= smoothstepf(t/spot_smooth);
}
return attenuation;
}
ccl_device float lamp_light_pdf(KernelGlobals *kg, const float3 Ng, const float3 I, float t)
{
float cos_pi = dot(Ng, I);
if(cos_pi <= 0.0f)
return 0.0f;
return t*t/cos_pi;
}
/* Background Light */ /* Background Light */
#ifdef __BACKGROUND_MIS__ #ifdef __BACKGROUND_MIS__
@@ -224,7 +170,7 @@ float3 background_map_sample(KernelGlobals *kg, float randu, float randv, float
float2 cdf_last_v = kernel_tex_fetch(__light_background_marginal_cdf, res); float2 cdf_last_v = kernel_tex_fetch(__light_background_marginal_cdf, res);
/* importance-sampled V direction */ /* importance-sampled V direction */
float dv = inverse_lerp(cdf_v.y, cdf_next_v.y, randv); float dv = (randv - cdf_v.y) / (cdf_next_v.y - cdf_v.y);
float v = (index_v + dv) / res; float v = (index_v + dv) / res;
/* this is basically std::lower_bound as used by pbrt */ /* this is basically std::lower_bound as used by pbrt */
@@ -250,7 +196,7 @@ float3 background_map_sample(KernelGlobals *kg, float randu, float randv, float
float2 cdf_last_u = kernel_tex_fetch(__light_background_conditional_cdf, index_v * cdf_count + res); float2 cdf_last_u = kernel_tex_fetch(__light_background_conditional_cdf, index_v * cdf_count + res);
/* importance-sampled U direction */ /* importance-sampled U direction */
float du = inverse_lerp(cdf_u.y, cdf_next_u.y, randu); float du = (randu - cdf_u.y) / (cdf_next_u.y - cdf_u.y);
float u = (index_u + du) / res; float u = (index_u + du) / res;
/* compute pdf */ /* compute pdf */
@@ -349,19 +295,11 @@ ccl_device_inline float background_portal_pdf(KernelGlobals *kg,
const ccl_global KernelLight *klight = &kernel_tex_fetch(__lights, portal); const ccl_global KernelLight *klight = &kernel_tex_fetch(__lights, portal);
float3 axisu = make_float3(klight->area.axisu[0], klight->area.axisu[1], klight->area.axisu[2]); float3 axisu = make_float3(klight->area.axisu[0], klight->area.axisu[1], klight->area.axisu[2]);
float3 axisv = make_float3(klight->area.axisv[0], klight->area.axisv[1], klight->area.axisv[2]); float3 axisv = make_float3(klight->area.axisv[0], klight->area.axisv[1], klight->area.axisv[2]);
bool is_round = (klight->area.invarea < 0.0f);
if(!ray_quad_intersect(P, direction, 1e-4f, FLT_MAX, lightpos, axisu, axisv, dir, NULL, NULL, NULL, NULL, is_round)) if(!ray_quad_intersect(P, direction, 1e-4f, FLT_MAX, lightpos, axisu, axisv, dir, NULL, NULL, NULL, NULL))
continue; continue;
if(is_round) { portal_pdf += area_light_sample(P, &lightpos, axisu, axisv, 0.0f, 0.0f, false);
float t;
float3 D = normalize_len(lightpos - P, &t);
portal_pdf += fabsf(klight->area.invarea) * lamp_light_pdf(kg, dir, -D, t);
}
else {
portal_pdf += rect_light_sample(P, &lightpos, axisu, axisv, 0.0f, 0.0f, false);
}
} }
if(ignore_portal >= 0) { if(ignore_portal >= 0) {
@@ -411,26 +349,15 @@ ccl_device float3 background_portal_sample(KernelGlobals *kg,
const ccl_global KernelLight *klight = &kernel_tex_fetch(__lights, portal); const ccl_global KernelLight *klight = &kernel_tex_fetch(__lights, portal);
float3 axisu = make_float3(klight->area.axisu[0], klight->area.axisu[1], klight->area.axisu[2]); float3 axisu = make_float3(klight->area.axisu[0], klight->area.axisu[1], klight->area.axisu[2]);
float3 axisv = make_float3(klight->area.axisv[0], klight->area.axisv[1], klight->area.axisv[2]); float3 axisv = make_float3(klight->area.axisv[0], klight->area.axisv[1], klight->area.axisv[2]);
bool is_round = (klight->area.invarea < 0.0f);
float3 D; *pdf = area_light_sample(P, &lightpos,
if(is_round) { axisu, axisv,
lightpos += ellipse_sample(axisu*0.5f, axisv*0.5f, randu, randv); randu, randv,
float t; true);
D = normalize_len(lightpos - P, &t);
*pdf = fabsf(klight->area.invarea) * lamp_light_pdf(kg, dir, -D, t);
}
else {
*pdf = rect_light_sample(P, &lightpos,
axisu, axisv,
randu, randv,
true);
D = normalize(lightpos - P);
}
*pdf /= num_possible; *pdf /= num_possible;
*sampled_portal = p; *sampled_portal = p;
return D; return normalize(lightpos - P);
} }
portal--; portal--;
@@ -531,6 +458,55 @@ ccl_device float background_light_pdf(KernelGlobals *kg, float3 P, float3 direct
/* Regular Light */ /* Regular Light */
ccl_device float3 disk_light_sample(float3 v, float randu, float randv)
{
float3 ru, rv;
make_orthonormals(v, &ru, &rv);
to_unit_disk(&randu, &randv);
return ru*randu + rv*randv;
}
ccl_device float3 distant_light_sample(float3 D, float radius, float randu, float randv)
{
return normalize(D + disk_light_sample(D, randu, randv)*radius);
}
ccl_device float3 sphere_light_sample(float3 P, float3 center, float radius, float randu, float randv)
{
return disk_light_sample(normalize(P - center), randu, randv)*radius;
}
ccl_device float spot_light_attenuation(float3 dir, float spot_angle, float spot_smooth, LightSample *ls)
{
float3 I = ls->Ng;
float attenuation = dot(dir, I);
if(attenuation <= spot_angle) {
attenuation = 0.0f;
}
else {
float t = attenuation - spot_angle;
if(t < spot_smooth && spot_smooth != 0.0f)
attenuation *= smoothstepf(t/spot_smooth);
}
return attenuation;
}
ccl_device float lamp_light_pdf(KernelGlobals *kg, const float3 Ng, const float3 I, float t)
{
float cos_pi = dot(Ng, I);
if(cos_pi <= 0.0f)
return 0.0f;
return t*t/cos_pi;
}
ccl_device_inline bool lamp_light_sample(KernelGlobals *kg, ccl_device_inline bool lamp_light_sample(KernelGlobals *kg,
int lamp, int lamp,
float randu, float randv, float randu, float randv,
@@ -625,39 +601,26 @@ ccl_device_inline bool lamp_light_sample(KernelGlobals *kg,
float3 D = make_float3(klight->area.dir[0], float3 D = make_float3(klight->area.dir[0],
klight->area.dir[1], klight->area.dir[1],
klight->area.dir[2]); klight->area.dir[2]);
float invarea = fabsf(klight->area.invarea);
bool is_round = (klight->area.invarea < 0.0f);
if(dot(ls->P - P, D) > 0.0f) { if(dot(ls->P - P, D) > 0.0f) {
return false; return false;
} }
float3 inplane; float3 inplane = ls->P;
ls->pdf = area_light_sample(P, &ls->P,
if(is_round) { axisu, axisv,
inplane = ellipse_sample(axisu*0.5f, axisv*0.5f, randu, randv); randu, randv,
ls->P += inplane; true);
ls->pdf = invarea;
}
else {
inplane = ls->P;
ls->pdf = rect_light_sample(P, &ls->P,
axisu, axisv,
randu, randv,
true);
inplane = ls->P - inplane;
}
inplane = ls->P - inplane;
ls->u = dot(inplane, axisu) * (1.0f / dot(axisu, axisu)) + 0.5f; ls->u = dot(inplane, axisu) * (1.0f / dot(axisu, axisu)) + 0.5f;
ls->v = dot(inplane, axisv) * (1.0f / dot(axisv, axisv)) + 0.5f; ls->v = dot(inplane, axisv) * (1.0f / dot(axisv, axisv)) + 0.5f;
ls->Ng = D; ls->Ng = D;
ls->D = normalize_len(ls->P - P, &ls->t); ls->D = normalize_len(ls->P - P, &ls->t);
float invarea = klight->area.invarea;
ls->eval_fac = 0.25f*invarea; ls->eval_fac = 0.25f*invarea;
if(is_round) {
ls->pdf *= lamp_light_pdf(kg, D, -ls->D, ls->t);
}
} }
} }
@@ -768,8 +731,7 @@ ccl_device bool lamp_light_eval(KernelGlobals *kg, int lamp, float3 P, float3 D,
} }
else if(type == LIGHT_AREA) { else if(type == LIGHT_AREA) {
/* area light */ /* area light */
float invarea = fabsf(klight->area.invarea); float invarea = klight->area.invarea;
bool is_round = (klight->area.invarea < 0.0f);
if(invarea == 0.0f) if(invarea == 0.0f)
return false; return false;
@@ -792,20 +754,14 @@ ccl_device bool lamp_light_eval(KernelGlobals *kg, int lamp, float3 P, float3 D,
if(!ray_quad_intersect(P, D, 0.0f, t, light_P, if(!ray_quad_intersect(P, D, 0.0f, t, light_P,
axisu, axisv, Ng, axisu, axisv, Ng,
&ls->P, &ls->t, &ls->P, &ls->t,
&ls->u, &ls->v, &ls->u, &ls->v))
is_round))
{ {
return false; return false;
} }
ls->D = D; ls->D = D;
ls->Ng = Ng; ls->Ng = Ng;
if(is_round) { ls->pdf = area_light_sample(P, &light_P, axisu, axisv, 0, 0, false);
ls->pdf = invarea * lamp_light_pdf(kg, Ng, -D, ls->t);
}
else {
ls->pdf = rect_light_sample(P, &light_P, axisu, axisv, 0, 0, false);
}
ls->eval_fac = 0.25f*invarea; ls->eval_fac = 0.25f*invarea;
} }
else { else {

View File

@@ -81,8 +81,5 @@ KERNEL_TEX(uint, __sobol_directions)
/* image textures */ /* image textures */
KERNEL_TEX(TextureInfo, __texture_info) KERNEL_TEX(TextureInfo, __texture_info)
/* ies lights */
KERNEL_TEX(float, __ies)
#undef KERNEL_TEX #undef KERNEL_TEX

View File

@@ -1452,7 +1452,7 @@ typedef struct KernelObject {
uint attribute_map_offset; uint attribute_map_offset;
uint motion_offset; uint motion_offset;
uint pad; uint pad;
} KernelObject; } KernelObject;;
static_assert_align(KernelObject, 16); static_assert_align(KernelObject, 16);
typedef struct KernelSpotLight { typedef struct KernelSpotLight {

View File

@@ -349,7 +349,7 @@ template<typename T> struct TextureInterpolator {
* Only happens for AVX2 kernel and global __KERNEL_SSE__ vectorization * Only happens for AVX2 kernel and global __KERNEL_SSE__ vectorization
* enabled. * enabled.
*/ */
#if defined(__GNUC__) || defined(__clang__) #ifdef __GNUC__
static ccl_always_inline static ccl_always_inline
#else #else
static ccl_never_inline static ccl_never_inline

View File

@@ -956,15 +956,9 @@ bool OSLRenderServices::texture(ustring filename,
status = true; status = true;
} }
} }
else if(filename[1] == 'l') {
/* IES light. */
int slot = atoi(filename.c_str() + 2);
result[0] = kernel_ies_interp(kg, slot, s, t);
status = true;
}
else { else {
/* Packed texture. */ /* Packed texture. */
int slot = atoi(filename.c_str() + 2); int slot = atoi(filename.c_str() + 1);
float4 rgba = kernel_tex_image_interp(kg, slot, s, 1.0f - t); float4 rgba = kernel_tex_image_interp(kg, slot, s, 1.0f - t);
result[0] = rgba[0]; result[0] = rgba[0];

View File

@@ -39,7 +39,6 @@ set(SRC_OSL
node_principled_volume.osl node_principled_volume.osl
node_holdout.osl node_holdout.osl
node_hsv.osl node_hsv.osl
node_ies_light.osl
node_image_texture.osl node_image_texture.osl
node_invert.osl node_invert.osl
node_layer_weight.osl node_layer_weight.osl

View File

@@ -1,42 +0,0 @@
/*
* Copyright 2011-2015 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.
*/
#include "stdosl.h"
#include "node_texture.h"
/* IES Light */
shader node_ies_light(
int use_mapping = 0,
matrix mapping = matrix(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0),
int slot = 0,
float Strength = 1.0,
point Vector = I,
output float Fac = 0.0)
{
point p = Vector;
if (use_mapping) {
p = transform(mapping, p);
}
p = normalize(p);
float v_angle = acos(-p[2]);
float h_angle = atan2(p[0], p[1]) + M_PI;
Fac = Strength * texture(format("@l%d", slot), h_angle, v_angle);
}

View File

@@ -95,8 +95,6 @@ shader node_math(
Value = safe_modulo(Value1, Value2); Value = safe_modulo(Value1, Value2);
else if (type == "absolute") else if (type == "absolute")
Value = fabs(Value1); Value = fabs(Value1);
else if (type == "arctan2")
Value = atan2(Value1, Value2);
if (use_clamp) if (use_clamp)
Value = clamp(Value, 0.0, 1.0); Value = clamp(Value, 0.0, 1.0);

View File

@@ -59,15 +59,12 @@ ccl_device_inline void kernel_split_path_end(KernelGlobals *kg, int ray_index)
ccl_global char *ray_state = kernel_split_state.ray_state; ccl_global char *ray_state = kernel_split_state.ray_state;
#ifdef __BRANCHED_PATH__ #ifdef __BRANCHED_PATH__
# ifdef __SUBSURFACE__
ccl_addr_space SubsurfaceIndirectRays *ss_indirect = &kernel_split_state.ss_rays[ray_index]; ccl_addr_space SubsurfaceIndirectRays *ss_indirect = &kernel_split_state.ss_rays[ray_index];
if(ss_indirect->num_rays) { if(ss_indirect->num_rays) {
ASSIGN_RAY_STATE(ray_state, ray_index, RAY_UPDATE_BUFFER); ASSIGN_RAY_STATE(ray_state, ray_index, RAY_UPDATE_BUFFER);
} }
else else if(IS_FLAG(ray_state, ray_index, RAY_BRANCHED_INDIRECT_SHARED)) {
# endif /* __SUBSURFACE__ */
if(IS_FLAG(ray_state, ray_index, RAY_BRANCHED_INDIRECT_SHARED)) {
int orig_ray = kernel_split_state.branched_state[ray_index].original_ray; int orig_ray = kernel_split_state.branched_state[ray_index].original_ray;
PathRadiance *L = &kernel_split_state.path_radiance[ray_index]; PathRadiance *L = &kernel_split_state.path_radiance[ray_index];

View File

@@ -157,7 +157,6 @@ CCL_NAMESPACE_END
#include "kernel/svm/svm_camera.h" #include "kernel/svm/svm_camera.h"
#include "kernel/svm/svm_geometry.h" #include "kernel/svm/svm_geometry.h"
#include "kernel/svm/svm_hsv.h" #include "kernel/svm/svm_hsv.h"
#include "kernel/svm/svm_ies.h"
#include "kernel/svm/svm_image.h" #include "kernel/svm/svm_image.h"
#include "kernel/svm/svm_gamma.h" #include "kernel/svm/svm_gamma.h"
#include "kernel/svm/svm_brightness.h" #include "kernel/svm/svm_brightness.h"
@@ -422,9 +421,6 @@ ccl_device_noinline void svm_eval_nodes(KernelGlobals *kg, ShaderData *sd, ccl_a
case NODE_LIGHT_FALLOFF: case NODE_LIGHT_FALLOFF:
svm_node_light_falloff(sd, stack, node); svm_node_light_falloff(sd, stack, node);
break; break;
case NODE_IES:
svm_node_ies(kg, sd, stack, node, &offset);
break;
# endif /* __EXTRA_NODES__ */ # endif /* __EXTRA_NODES__ */
#endif /* NODES_GROUP(NODE_GROUP_LEVEL_2) */ #endif /* NODES_GROUP(NODE_GROUP_LEVEL_2) */

View File

@@ -216,7 +216,7 @@ ccl_device void svm_node_bevel(
if(stack_valid(normal_offset)) { if(stack_valid(normal_offset)) {
/* Preserve input normal. */ /* Preserve input normal. */
float3 ref_N = stack_load_float3(stack, normal_offset); float3 ref_N = stack_load_float3(stack, normal_offset);
bevel_N = normalize(ref_N + (bevel_N - sd->N)); bevel_N = normalize(ref_N + (bevel_N - sd->N));;
} }
stack_store_float3(stack, out_offset, bevel_N); stack_store_float3(stack, out_offset, bevel_N);

View File

@@ -141,7 +141,7 @@ ccl_device void svm_node_vector_displacement(KernelGlobals *kg, ShaderData *sd,
tangent = normalize(sd->dPdu); tangent = normalize(sd->dPdu);
} }
float3 bitangent = normalize(cross(normal, tangent)); float3 bitangent = normalize(cross(normal, tangent));;
const AttributeDescriptor attr_sign = find_attribute(kg, sd, node.w); const AttributeDescriptor attr_sign = find_attribute(kg, sd, node.w);
if(attr_sign.offset != ATTR_STD_NOT_FOUND) { if(attr_sign.offset != ATTR_STD_NOT_FOUND) {
float sign = primitive_attribute_float(kg, sd, attr_sign, NULL, NULL); float sign = primitive_attribute_float(kg, sd, attr_sign, NULL, NULL);

View File

@@ -1,110 +0,0 @@
/*
* Copyright 2011-2013 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.
*/
CCL_NAMESPACE_BEGIN
/* IES Light */
ccl_device_inline float interpolate_ies_vertical(KernelGlobals *kg, int ofs, int v, int v_num, float v_frac, int h)
{
/* Since lookups are performed in spherical coordinates, clamping the coordinates at the low end of v
* (corresponding to the north pole) would result in artifacts.
* The proper way of dealing with this would be to lookup the corresponding value on the other side of the pole,
* but since the horizontal coordinates might be nonuniform, this would require yet another interpolation.
* Therefore, the assumtion is made that the light is going to be symmetrical, which means that we can just take
* the corresponding value at the current horizontal coordinate. */
#define IES_LOOKUP(v) kernel_tex_fetch(__ies, ofs+h*v_num+(v))
/* If v is zero, assume symmetry and read at v=1 instead of v=-1. */
float a = IES_LOOKUP((v == 0)? 1 : v-1);
float b = IES_LOOKUP(v);
float c = IES_LOOKUP(v+1);
float d = IES_LOOKUP(min(v+2, v_num-1));
#undef IES_LOOKUP
return cubic_interp(a, b, c, d, v_frac);
}
ccl_device_inline float kernel_ies_interp(KernelGlobals *kg, int slot, float h_angle, float v_angle)
{
/* Find offset of the IES data in the table. */
int ofs = __float_as_int(kernel_tex_fetch(__ies, slot));
if(ofs == -1) {
return 100.0f;
}
int h_num = __float_as_int(kernel_tex_fetch(__ies, ofs++));
int v_num = __float_as_int(kernel_tex_fetch(__ies, ofs++));
#define IES_LOOKUP_ANGLE_H(h) kernel_tex_fetch(__ies, ofs+(h))
#define IES_LOOKUP_ANGLE_V(v) kernel_tex_fetch(__ies, ofs+h_num+(v))
/* Check whether the angle is within the bounds of the IES texture. */
if(v_angle >= IES_LOOKUP_ANGLE_V(v_num-1)) {
return 0.0f;
}
kernel_assert(v_angle >= IES_LOOKUP_ANGLE_V(0));
kernel_assert(h_angle >= IES_LOOKUP_ANGLE_H(0));
kernel_assert(h_angle <= IES_LOOKUP_ANGLE_H(h_num-1));
/* Lookup the angles to find the table position. */
int h_i, v_i;
/* TODO(lukas): Consider using bisection. Probably not worth it for the vast majority of IES files. */
for(h_i = 0; IES_LOOKUP_ANGLE_H(h_i+1) < h_angle; h_i++);
for(v_i = 0; IES_LOOKUP_ANGLE_V(v_i+1) < v_angle; v_i++);
float h_frac = inverse_lerp(IES_LOOKUP_ANGLE_H(h_i), IES_LOOKUP_ANGLE_H(h_i+1), h_angle);
float v_frac = inverse_lerp(IES_LOOKUP_ANGLE_V(v_i), IES_LOOKUP_ANGLE_V(v_i+1), v_angle);
#undef IES_LOOKUP_ANGLE_H
#undef IES_LOOKUP_ANGLE_V
/* Skip forward to the actual intensity data. */
ofs += h_num+v_num;
/* Perform cubic interpolation along the horizontal coordinate to get the intensity value.
* If h_i is zero, just wrap around since the horizontal angles always go over the full circle.
* However, the last entry (360°) equals the first one, so we need to wrap around to the one before that. */
float a = interpolate_ies_vertical(kg, ofs, v_i, v_num, v_frac, (h_i == 0)? h_num-2 : h_i-1);
float b = interpolate_ies_vertical(kg, ofs, v_i, v_num, v_frac, h_i);
float c = interpolate_ies_vertical(kg, ofs, v_i, v_num, v_frac, h_i+1);
/* Same logic here, wrap around to the second element if necessary. */
float d = interpolate_ies_vertical(kg, ofs, v_i, v_num, v_frac, (h_i+2 == h_num)? 1 : h_i+2);
/* Cubic interpolation can result in negative values, so get rid of them. */
return max(cubic_interp(a, b, c, d, h_frac), 0.0f);
}
ccl_device void svm_node_ies(KernelGlobals *kg, ShaderData *sd, float *stack, uint4 node, int *offset)
{
uint vector_offset, strength_offset, fac_offset, dummy, slot = node.z;
decode_node_uchar4(node.y, &strength_offset, &vector_offset, &fac_offset, &dummy);
float3 vector = stack_load_float3(stack, vector_offset);
float strength = stack_load_float_default(stack, strength_offset, node.w);
vector = normalize(vector);
float v_angle = safe_acosf(-vector.z);
float h_angle = atan2f(vector.x, vector.y) + M_PI_F;
float fac = strength * kernel_ies_interp(kg, slot, h_angle, v_angle);
if(stack_valid(fac_offset)) {
stack_store_float(stack, fac_offset, fac);
}
}
CCL_NAMESPACE_END

View File

@@ -92,8 +92,6 @@ ccl_device float svm_math(NodeMath type, float Fac1, float Fac2)
Fac = safe_modulo(Fac1, Fac2); Fac = safe_modulo(Fac1, Fac2);
else if(type == NODE_MATH_ABSOLUTE) else if(type == NODE_MATH_ABSOLUTE)
Fac = fabsf(Fac1); Fac = fabsf(Fac1);
else if(type == NODE_MATH_ARCTAN2)
Fac = atan2f(Fac1, Fac2);
else if(type == NODE_MATH_CLAMP) else if(type == NODE_MATH_CLAMP)
Fac = saturate(Fac1); Fac = saturate(Fac1);
else else

View File

@@ -136,7 +136,6 @@ typedef enum ShaderNodeType {
NODE_DISPLACEMENT, NODE_DISPLACEMENT,
NODE_VECTOR_DISPLACEMENT, NODE_VECTOR_DISPLACEMENT,
NODE_PRINCIPLED_VOLUME, NODE_PRINCIPLED_VOLUME,
NODE_IES,
} ShaderNodeType; } ShaderNodeType;
typedef enum NodeAttributeType { typedef enum NodeAttributeType {
@@ -260,7 +259,6 @@ typedef enum NodeMath {
NODE_MATH_GREATER_THAN, NODE_MATH_GREATER_THAN,
NODE_MATH_MODULO, NODE_MATH_MODULO,
NODE_MATH_ABSOLUTE, NODE_MATH_ABSOLUTE,
NODE_MATH_ARCTAN2,
NODE_MATH_CLAMP /* used for the clamp UI option */ NODE_MATH_CLAMP /* used for the clamp UI option */
} NodeMath; } NodeMath;

View File

@@ -774,12 +774,6 @@ void ShaderGraph::default_inputs(bool do_osl)
connect(texco->output("Generated"), input); connect(texco->output("Generated"), input);
} }
if(input->flags() & SocketType::LINK_TEXTURE_NORMAL) {
if(!texco)
texco = new TextureCoordinateNode();
connect(texco->output("Normal"), input);
}
else if(input->flags() & SocketType::LINK_TEXTURE_UV) { else if(input->flags() & SocketType::LINK_TEXTURE_UV) {
if(!texco) if(!texco)
texco = new TextureCoordinateNode(); texco = new TextureCoordinateNode();

View File

@@ -25,8 +25,6 @@
#include "render/shader.h" #include "render/shader.h"
#include "util/util_foreach.h" #include "util/util_foreach.h"
#include "util/util_hash.h"
#include "util/util_path.h"
#include "util/util_progress.h" #include "util/util_progress.h"
#include "util/util_logging.h" #include "util/util_logging.h"
@@ -119,7 +117,6 @@ NODE_DEFINE(Light)
SOCKET_FLOAT(sizeu, "Size U", 1.0f); SOCKET_FLOAT(sizeu, "Size U", 1.0f);
SOCKET_VECTOR(axisv, "Axis V", make_float3(0.0f, 0.0f, 0.0f)); SOCKET_VECTOR(axisv, "Axis V", make_float3(0.0f, 0.0f, 0.0f));
SOCKET_FLOAT(sizev, "Size V", 1.0f); SOCKET_FLOAT(sizev, "Size V", 1.0f);
SOCKET_BOOLEAN(round, "Round", false);
SOCKET_INT(map_resolution, "Map Resolution", 512); SOCKET_INT(map_resolution, "Map Resolution", 512);
@@ -178,9 +175,6 @@ LightManager::LightManager()
LightManager::~LightManager() LightManager::~LightManager()
{ {
foreach(IESSlot *slot, ies_slots) {
delete slot;
}
} }
bool LightManager::has_background_light(Scene *scene) bool LightManager::has_background_light(Scene *scene)
@@ -736,15 +730,12 @@ void LightManager::device_update_points(Device *,
float3 axisu = light->axisu*(light->sizeu*light->size); float3 axisu = light->axisu*(light->sizeu*light->size);
float3 axisv = light->axisv*(light->sizev*light->size); float3 axisv = light->axisv*(light->sizev*light->size);
float area = len(axisu)*len(axisv); float area = len(axisu)*len(axisv);
if(light->round) { float invarea = (area > 0.0f)? 1.0f/area: 1.0f;
area *= -M_PI_4_F;
}
float invarea = (area != 0.0f)? 1.0f/area: 1.0f;
float3 dir = light->dir; float3 dir = light->dir;
dir = safe_normalize(dir); dir = safe_normalize(dir);
if(light->use_mis && area != 0.0f) if(light->use_mis && area > 0.0f)
shader_id |= SHADER_USE_MIS; shader_id |= SHADER_USE_MIS;
klights[light_index].co[0] = co.x; klights[light_index].co[0] = co.x;
@@ -812,10 +803,7 @@ void LightManager::device_update_points(Device *,
float3 axisu = light->axisu*(light->sizeu*light->size); float3 axisu = light->axisu*(light->sizeu*light->size);
float3 axisv = light->axisv*(light->sizev*light->size); float3 axisv = light->axisv*(light->sizev*light->size);
float area = len(axisu)*len(axisv); float area = len(axisu)*len(axisv);
if(light->round) { float invarea = (area > 0.0f)? 1.0f/area: 1.0f;
area *= -M_PI_4_F;
}
float invarea = (area != 0.0f)? 1.0f/area: 1.0f;
float3 dir = light->dir; float3 dir = light->dir;
dir = safe_normalize(dir); dir = safe_normalize(dir);
@@ -870,9 +858,6 @@ void LightManager::device_update(Device *device, DeviceScene *dscene, Scene *sce
device_update_background(device, dscene, scene, progress); device_update_background(device, dscene, scene, progress);
if(progress.get_cancel()) return; if(progress.get_cancel()) return;
device_update_ies(dscene);
if(progress.get_cancel()) return;
if(use_light_visibility != scene->film->use_light_visibility) { if(use_light_visibility != scene->film->use_light_visibility) {
scene->film->use_light_visibility = use_light_visibility; scene->film->use_light_visibility = use_light_visibility;
scene->film->tag_update(scene); scene->film->tag_update(scene);
@@ -887,7 +872,6 @@ void LightManager::device_free(Device *, DeviceScene *dscene)
dscene->lights.free(); dscene->lights.free();
dscene->light_background_marginal_cdf.free(); dscene->light_background_marginal_cdf.free();
dscene->light_background_conditional_cdf.free(); dscene->light_background_conditional_cdf.free();
dscene->ies_lights.free();
} }
void LightManager::tag_update(Scene * /*scene*/) void LightManager::tag_update(Scene * /*scene*/)
@@ -895,121 +879,5 @@ void LightManager::tag_update(Scene * /*scene*/)
need_update = true; need_update = true;
} }
int LightManager::add_ies_from_file(ustring filename)
{
string content;
/* If the file can't be opened, call with an empty line */
if(filename.empty() || !path_read_text(filename.c_str(), content)) {
content = "\n";
}
return add_ies(ustring(content));
}
int LightManager::add_ies(ustring content)
{
uint hash = hash_string(content.c_str());
thread_scoped_lock ies_lock(ies_mutex);
/* Check whether this IES already has a slot. */
size_t slot;
for(slot = 0; slot < ies_slots.size(); slot++) {
if(ies_slots[slot]->hash == hash) {
ies_slots[slot]->users++;
return slot;
}
}
/* Try to find an empty slot for the new IES. */
for(slot = 0; slot < ies_slots.size(); slot++) {
if(ies_slots[slot]->users == 0 && ies_slots[slot]->hash == 0) {
break;
}
}
/* If there's no free slot, add one. */
if(slot == ies_slots.size()) {
ies_slots.push_back(new IESSlot());
}
ies_slots[slot]->ies.load(content);
ies_slots[slot]->users = 1;
ies_slots[slot]->hash = hash;
need_update = true;
return slot;
}
void LightManager::remove_ies(int slot)
{
thread_scoped_lock ies_lock(ies_mutex);
if(slot < 0 || slot >= ies_slots.size()) {
assert(false);
return;
}
assert(ies_slots[slot]->users > 0);
ies_slots[slot]->users--;
/* If the slot has no more users, update the device to remove it. */
need_update |= (ies_slots[slot]->users == 0);
}
void LightManager::device_update_ies(DeviceScene *dscene)
{
/* Clear empty slots. */
foreach(IESSlot *slot, ies_slots) {
if(slot->users == 0) {
slot->hash = 0;
slot->ies.clear();
}
}
/* Shrink the slot table by removing empty slots at the end. */
int slot_end;
for(slot_end = ies_slots.size(); slot_end; slot_end--) {
if(ies_slots[slot_end-1]->users > 0) {
/* If the preceding slot has users, we found the new end of the table. */
break;
}
else {
/* The slot will be past the new end of the table, so free it. */
delete ies_slots[slot_end-1];
}
}
ies_slots.resize(slot_end);
if(ies_slots.size() > 0) {
int packed_size = 0;
foreach(IESSlot *slot, ies_slots) {
packed_size += slot->ies.packed_size();
}
/* ies_lights starts with an offset table that contains the offset of every slot,
* or -1 if the slot is invalid.
* Following that table, the packed valid IES lights are stored. */
float *data = dscene->ies_lights.alloc(ies_slots.size() + packed_size);
int offset = ies_slots.size();
for(int i = 0; i < ies_slots.size(); i++) {
int size = ies_slots[i]->ies.packed_size();
if(size > 0) {
data[i] = __int_as_float(offset);
ies_slots[i]->ies.pack(data + offset);
offset += size;
}
else {
data[i] = __int_as_float(-1);
}
}
dscene->ies_lights.copy_to_device();
}
}
CCL_NAMESPACE_END CCL_NAMESPACE_END

View File

@@ -21,8 +21,6 @@
#include "graph/node.h" #include "graph/node.h"
#include "util/util_ies.h"
#include "util/util_thread.h"
#include "util/util_types.h" #include "util/util_types.h"
#include "util/util_vector.h" #include "util/util_vector.h"
@@ -51,7 +49,6 @@ public:
float sizeu; float sizeu;
float3 axisv; float3 axisv;
float sizev; float sizev;
bool round;
Transform tfm; Transform tfm;
@@ -89,11 +86,6 @@ public:
LightManager(); LightManager();
~LightManager(); ~LightManager();
/* IES texture management */
int add_ies(ustring ies);
int add_ies_from_file(ustring filename);
void remove_ies(int slot);
void device_update(Device *device, void device_update(Device *device,
DeviceScene *dscene, DeviceScene *dscene,
Scene *scene, Scene *scene,
@@ -123,19 +115,9 @@ protected:
DeviceScene *dscene, DeviceScene *dscene,
Scene *scene, Scene *scene,
Progress& progress); Progress& progress);
void device_update_ies(DeviceScene *dscene);
/* Check whether light manager can use the object as a light-emissive. */ /* Check whether light manager can use the object as a light-emissive. */
bool object_usable_as_light(Object *object); bool object_usable_as_light(Object *object);
struct IESSlot {
IESFile ies;
uint hash;
int users;
};
vector<IESSlot*> ies_slots;
thread_mutex ies_mutex;
}; };
CCL_NAMESPACE_END CCL_NAMESPACE_END

View File

@@ -1307,7 +1307,7 @@ void MeshManager::update_svm_attributes(Device *, DeviceScene *dscene, Scene *sc
return; return;
/* create attribute map */ /* create attribute map */
uint4 *attr_map = dscene->attributes_map.alloc(attr_map_size); uint4 *attr_map = dscene->attributes_map.alloc(attr_map_size*scene->meshes.size());
memset(attr_map, 0, dscene->attributes_map.size()*sizeof(uint)); memset(attr_map, 0, dscene->attributes_map.size()*sizeof(uint));
for(size_t i = 0; i < scene->meshes.size(); i++) { for(size_t i = 0; i < scene->meshes.size(); i++) {

View File

@@ -16,7 +16,6 @@
#include "render/image.h" #include "render/image.h"
#include "render/integrator.h" #include "render/integrator.h"
#include "render/light.h"
#include "render/nodes.h" #include "render/nodes.h"
#include "render/scene.h" #include "render/scene.h"
#include "render/svm.h" #include "render/svm.h"
@@ -385,10 +384,10 @@ void ImageTextureNode::compile(OSLCompiler& compiler)
/* TODO(sergey): It's not so simple to pass custom attribute /* TODO(sergey): It's not so simple to pass custom attribute
* to the texture() function in order to make builtin images * to the texture() function in order to make builtin images
* support more clear. So we use special file name which is * support more clear. So we use special file name which is
* "@i<slot_number>" and check whether file name matches this * "@<slot_number>" and check whether file name matches this
* mask in the OSLRenderServices::texture(). * mask in the OSLRenderServices::texture().
*/ */
compiler.parameter("filename", string_printf("@i%d", slot).c_str()); compiler.parameter("filename", string_printf("@%d", slot).c_str());
} }
if(is_linear || color_space != NODE_COLOR_SPACE_COLOR) if(is_linear || color_space != NODE_COLOR_SPACE_COLOR)
compiler.parameter("color_space", "linear"); compiler.parameter("color_space", "linear");
@@ -568,7 +567,7 @@ void EnvironmentTextureNode::compile(OSLCompiler& compiler)
compiler.parameter(this, "filename"); compiler.parameter(this, "filename");
} }
else { else {
compiler.parameter("filename", string_printf("@i%d", slot).c_str()); compiler.parameter("filename", string_printf("@%d", slot).c_str());
} }
compiler.parameter(this, "projection"); compiler.parameter(this, "projection");
if(is_linear || color_space != NODE_COLOR_SPACE_COLOR) if(is_linear || color_space != NODE_COLOR_SPACE_COLOR)
@@ -955,97 +954,6 @@ void VoronoiTextureNode::compile(OSLCompiler& compiler)
compiler.add(this, "node_voronoi_texture"); compiler.add(this, "node_voronoi_texture");
} }
/* IES Light */
NODE_DEFINE(IESLightNode)
{
NodeType* type = NodeType::add("ies_light", create, NodeType::SHADER);
TEXTURE_MAPPING_DEFINE(IESLightNode);
SOCKET_STRING(ies, "IES", ustring());
SOCKET_STRING(filename, "File Name", ustring());
SOCKET_IN_FLOAT(strength, "Strength", 1.0f);
SOCKET_IN_POINT(vector, "Vector", make_float3(0.0f, 0.0f, 0.0f), SocketType::LINK_TEXTURE_NORMAL);
SOCKET_OUT_FLOAT(fac, "Fac");
return type;
}
IESLightNode::IESLightNode()
: TextureNode(node_type)
{
light_manager = NULL;
slot = -1;
}
ShaderNode *IESLightNode::clone() const
{
IESLightNode *node = new IESLightNode(*this);
node->light_manager = NULL;
node->slot = -1;
return node;
}
IESLightNode::~IESLightNode()
{
if(light_manager) {
light_manager->remove_ies(slot);
}
}
void IESLightNode::get_slot()
{
assert(light_manager);
if(slot == -1) {
if(ies.empty()) {
slot = light_manager->add_ies_from_file(filename);
}
else {
slot = light_manager->add_ies(ies);
}
}
}
void IESLightNode::compile(SVMCompiler& compiler)
{
light_manager = compiler.light_manager;
get_slot();
ShaderInput *strength_in = input("Strength");
ShaderInput *vector_in = input("Vector");
ShaderOutput *fac_out = output("Fac");
int vector_offset = tex_mapping.compile_begin(compiler, vector_in);
compiler.add_node(NODE_IES,
compiler.encode_uchar4(
compiler.stack_assign_if_linked(strength_in),
vector_offset,
compiler.stack_assign(fac_out),
0),
slot,
__float_as_int(strength));
tex_mapping.compile_end(compiler, vector_in, vector_offset);
}
void IESLightNode::compile(OSLCompiler& compiler)
{
light_manager = compiler.light_manager;
get_slot();
tex_mapping.compile(compiler);
compiler.parameter("slot", slot);
compiler.add(this, "node_ies_light");
}
/* Musgrave Texture */ /* Musgrave Texture */
NODE_DEFINE(MusgraveTextureNode) NODE_DEFINE(MusgraveTextureNode)
@@ -1562,7 +1470,7 @@ void PointDensityTextureNode::compile(OSLCompiler& compiler)
} }
if(slot != -1) { if(slot != -1) {
compiler.parameter("filename", string_printf("@i%d", slot).c_str()); compiler.parameter("filename", string_printf("@%d", slot).c_str());
} }
if(space == NODE_TEX_VOXEL_SPACE_WORLD) { if(space == NODE_TEX_VOXEL_SPACE_WORLD) {
compiler.parameter("mapping", tfm); compiler.parameter("mapping", tfm);
@@ -4693,7 +4601,7 @@ void AttributeNode::compile(SVMCompiler& compiler)
ShaderOutput *vector_out = output("Vector"); ShaderOutput *vector_out = output("Vector");
ShaderOutput *fac_out = output("Fac"); ShaderOutput *fac_out = output("Fac");
ShaderNodeType attr_node = NODE_ATTR; ShaderNodeType attr_node = NODE_ATTR;
int attr = compiler.attribute_standard(attribute); int attr = compiler.attribute_standard(attribute);;
if(bump == SHADER_BUMP_DX) if(bump == SHADER_BUMP_DX)
attr_node = NODE_ATTR_BUMP_DX; attr_node = NODE_ATTR_BUMP_DX;
@@ -5045,7 +4953,6 @@ NODE_DEFINE(MathNode)
type_enum.insert("greater_than", NODE_MATH_GREATER_THAN); type_enum.insert("greater_than", NODE_MATH_GREATER_THAN);
type_enum.insert("modulo", NODE_MATH_MODULO); type_enum.insert("modulo", NODE_MATH_MODULO);
type_enum.insert("absolute", NODE_MATH_ABSOLUTE); type_enum.insert("absolute", NODE_MATH_ABSOLUTE);
type_enum.insert("arctan2", NODE_MATH_ARCTAN2);
SOCKET_ENUM(type, "Type", type_enum, NODE_MATH_ADD); SOCKET_ENUM(type, "Type", type_enum, NODE_MATH_ADD);
SOCKET_BOOLEAN(use_clamp, "Use Clamp", false); SOCKET_BOOLEAN(use_clamp, "Use Clamp", false);

View File

@@ -25,7 +25,6 @@
CCL_NAMESPACE_BEGIN CCL_NAMESPACE_BEGIN
class ImageManager; class ImageManager;
class LightManager;
class Scene; class Scene;
class Shader; class Shader;
@@ -282,27 +281,6 @@ public:
} }
}; };
class IESLightNode : public TextureNode {
public:
SHADER_NODE_NO_CLONE_CLASS(IESLightNode)
~IESLightNode();
ShaderNode *clone() const;
virtual int get_group() { return NODE_GROUP_LEVEL_2; }
ustring filename;
ustring ies;
float strength;
float3 vector;
private:
LightManager *light_manager;
int slot;
void get_slot();
};
class MappingNode : public ShaderNode { class MappingNode : public ShaderNode {
public: public:
SHADER_NODE_CLASS(MappingNode) SHADER_NODE_CLASS(MappingNode)

View File

@@ -480,7 +480,7 @@ void ObjectManager::device_update_object_transform(UpdateObjectTransformState *s
kobject.dupli_uv[1] = ob->dupli_uv[1]; kobject.dupli_uv[1] = ob->dupli_uv[1];
int totalsteps = mesh->motion_steps; int totalsteps = mesh->motion_steps;
kobject.numsteps = (totalsteps - 1)/2; kobject.numsteps = (totalsteps - 1)/2;
kobject.numverts = mesh->verts.size(); kobject.numverts = mesh->verts.size();;
kobject.patch_map_offset = 0; kobject.patch_map_offset = 0;
kobject.attribute_map_offset = 0; kobject.attribute_map_offset = 0;

View File

@@ -99,9 +99,7 @@ void OSLShaderManager::device_update(Device *device, DeviceScene *dscene, Scene
* compile shaders alternating */ * compile shaders alternating */
thread_scoped_lock lock(ss_mutex); thread_scoped_lock lock(ss_mutex);
OSLCompiler compiler((void*)this, (void*)ss, OSLCompiler compiler((void*)this, (void*)ss, scene->image_manager);
scene->image_manager,
scene->light_manager);
compiler.background = (shader == scene->default_background); compiler.background = (shader == scene->default_background);
compiler.compile(scene, og, shader); compiler.compile(scene, og, shader);
@@ -548,14 +546,11 @@ OSLNode *OSLShaderManager::osl_node(const std::string& filepath,
/* Graph Compiler */ /* Graph Compiler */
OSLCompiler::OSLCompiler(void *manager_, void *shadingsys_, OSLCompiler::OSLCompiler(void *manager_, void *shadingsys_, ImageManager *image_manager_)
ImageManager *image_manager_,
LightManager *light_manager_)
{ {
manager = manager_; manager = manager_;
shadingsys = shadingsys_; shadingsys = shadingsys_;
image_manager = image_manager_; image_manager = image_manager_;
light_manager = light_manager_;
current_type = SHADER_TYPE_SURFACE; current_type = SHADER_TYPE_SURFACE;
current_shader = NULL; current_shader = NULL;
background = false; background = false;

View File

@@ -120,9 +120,7 @@ protected:
class OSLCompiler { class OSLCompiler {
public: public:
OSLCompiler(void *manager, void *shadingsys, OSLCompiler(void *manager, void *shadingsys, ImageManager *image_manager);
ImageManager *image_manager,
LightManager *light_manager);
void compile(Scene *scene, OSLGlobals *og, Shader *shader); void compile(Scene *scene, OSLGlobals *og, Shader *shader);
void add(ShaderNode *node, const char *name, bool isfilepath = false); void add(ShaderNode *node, const char *name, bool isfilepath = false);
@@ -148,7 +146,6 @@ public:
bool background; bool background;
ImageManager *image_manager; ImageManager *image_manager;
LightManager *light_manager;
private: private:
#ifdef WITH_OSL #ifdef WITH_OSL

View File

@@ -76,8 +76,7 @@ DeviceScene::DeviceScene(Device *device)
svm_nodes(device, "__svm_nodes", MEM_TEXTURE), svm_nodes(device, "__svm_nodes", MEM_TEXTURE),
shaders(device, "__shaders", MEM_TEXTURE), shaders(device, "__shaders", MEM_TEXTURE),
lookup_table(device, "__lookup_table", MEM_TEXTURE), lookup_table(device, "__lookup_table", MEM_TEXTURE),
sobol_directions(device, "__sobol_directions", MEM_TEXTURE), sobol_directions(device, "__sobol_directions", MEM_TEXTURE)
ies_lights(device, "__ies", MEM_TEXTURE)
{ {
memset(&data, 0, sizeof(data)); memset(&data, 0, sizeof(data));
} }

View File

@@ -119,9 +119,6 @@ public:
/* integrator */ /* integrator */
device_vector<uint> sobol_directions; device_vector<uint> sobol_directions;
/* ies lights */
device_vector<float> ies_lights;
KernelData data; KernelData data;
DeviceScene(Device *device); DeviceScene(Device *device);

View File

@@ -202,7 +202,6 @@ Shader::Shader()
need_update = true; need_update = true;
need_update_mesh = true; need_update_mesh = true;
need_sync_object = false;
} }
Shader::~Shader() Shader::~Shader()

View File

@@ -99,7 +99,6 @@ public:
/* synchronization */ /* synchronization */
bool need_update; bool need_update;
bool need_update_mesh; bool need_update_mesh;
bool need_sync_object;
/* If the shader has only volume components, the surface is assumed to /* If the shader has only volume components, the surface is assumed to
* be transparent. * be transparent.

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