Compare commits
5 Commits
temp-eevee
...
temp-keyma
Author | SHA1 | Date | |
---|---|---|---|
de94b6baf6 | |||
6af169f536 | |||
9eb4a74e9f | |||
15dd7bdf1e | |||
e2edea18c9 |
@@ -1,44 +0,0 @@
|
||||
# C/C++
|
||||
[*.{c,cc,h,hh,inl,glsl}]
|
||||
charset = utf-8
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = true
|
||||
indent_style = tab
|
||||
indent_size = 4
|
||||
max_line_length = 120
|
||||
|
||||
# CMake & Text
|
||||
[*.{cmake,txt}]
|
||||
charset = utf-8
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = true
|
||||
indent_style = tab
|
||||
indent_size = 4
|
||||
max_line_length = 120
|
||||
|
||||
# Python
|
||||
[*.py]
|
||||
charset = utf-8
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = true
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
max_line_length = 120
|
||||
|
||||
# Shell
|
||||
[*.sh]
|
||||
charset = utf-8
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = true
|
||||
indent_style = tab
|
||||
indent_size = 4
|
||||
max_line_length = 120
|
||||
|
||||
# reStructuredText
|
||||
[*.rst]
|
||||
charset = utf-8
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = true
|
||||
indent_style = space
|
||||
indent_size = 3
|
||||
max_line_length = 120
|
@@ -196,7 +196,7 @@ mark_as_advanced(WITH_BLENDER)
|
||||
option(WITH_INTERNATIONAL "Enable I18N (International fonts and text)" ON)
|
||||
|
||||
option(WITH_PYTHON "Enable Embedded Python API (only disable for development)" ON)
|
||||
option(WITH_PYTHON_SECURITY "Disables execution of scripts within blend files by default" ON)
|
||||
option(WITH_PYTHON_SECURITY "Disables execution of scripts within blend files by default" ON)
|
||||
mark_as_advanced(WITH_PYTHON) # dont want people disabling this unless they really know what they are doing.
|
||||
mark_as_advanced(WITH_PYTHON_SECURITY) # some distributions see this as a security issue, rather than have them patch it, make a build option.
|
||||
|
||||
@@ -227,6 +227,8 @@ option(WITH_SYSTEM_BULLET "Use the systems bullet library (currently unsupported
|
||||
mark_as_advanced(WITH_SYSTEM_BULLET)
|
||||
option(WITH_OPENCOLORIO "Enable OpenColorIO color management" ${_init_OPENCOLORIO})
|
||||
|
||||
option(WITH_CLAY_ENGINE "Enable Clay engine" ON)
|
||||
|
||||
# Compositor
|
||||
option(WITH_COMPOSITOR "Enable the tile based nodal compositor" ON)
|
||||
|
||||
@@ -439,7 +441,7 @@ mark_as_advanced(WITH_MEM_VALGRIND)
|
||||
option(WITH_CXX_GUARDEDALLOC "Enable GuardedAlloc for C++ memory allocation tracking (only enable for development)" OFF)
|
||||
mark_as_advanced(WITH_CXX_GUARDEDALLOC)
|
||||
|
||||
option(WITH_ASSERT_ABORT "Call abort() when raising an assertion through BLI_assert()" ON)
|
||||
option(WITH_ASSERT_ABORT "Call abort() when raising an assertion through BLI_assert()" OFF)
|
||||
mark_as_advanced(WITH_ASSERT_ABORT)
|
||||
|
||||
option(WITH_BOOST "Enable features depending on boost" ON)
|
||||
@@ -458,13 +460,11 @@ endif()
|
||||
|
||||
# OpenGL
|
||||
|
||||
option(WITH_OPENGL "When off limits visibility of the opengl headers to just bf_gpu and gawain (temporary option for development purposes)" ON)
|
||||
option(WITH_GLEW_ES "Switches to experimental copy of GLEW that has support for OpenGL ES. (temporary option for development purposes)" OFF)
|
||||
option(WITH_GL_EGL "Use the EGL OpenGL system library instead of the platform specific OpenGL system library (CGL, glX, or WGL)" OFF)
|
||||
option(WITH_GL_PROFILE_ES20 "Support using OpenGL ES 2.0. (thru either EGL or the AGL/WGL/XGL 'es20' profile)" OFF)
|
||||
|
||||
mark_as_advanced(
|
||||
WITH_OPENGL
|
||||
WITH_GLEW_ES
|
||||
WITH_GL_EGL
|
||||
WITH_GL_PROFILE_ES20
|
||||
@@ -545,11 +545,10 @@ if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID MATCHES "Clang")
|
||||
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()
|
||||
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()
|
||||
@@ -806,8 +805,7 @@ set(C_WARNINGS)
|
||||
set(CXX_WARNINGS)
|
||||
|
||||
# for gcc -Wno-blah-blah
|
||||
set(C_REMOVE_STRICT_FLAGS)
|
||||
set(CXX_REMOVE_STRICT_FLAGS)
|
||||
set(CC_REMOVE_STRICT_FLAGS)
|
||||
|
||||
# libraries to link the binary with passed to target_link_libraries()
|
||||
# known as LLIBS to scons
|
||||
@@ -819,20 +817,18 @@ set(PLATFORM_LINKLIBS "")
|
||||
set(PLATFORM_LINKFLAGS "")
|
||||
set(PLATFORM_LINKFLAGS_DEBUG "")
|
||||
|
||||
if (NOT CMAKE_BUILD_TYPE MATCHES "Release")
|
||||
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}")
|
||||
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}")
|
||||
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()
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
@@ -1006,10 +1002,6 @@ endif()
|
||||
find_package(OpenGL)
|
||||
blender_include_dirs_sys("${OPENGL_INCLUDE_DIR}")
|
||||
|
||||
if(WITH_OPENGL)
|
||||
add_definitions(-DWITH_OPENGL)
|
||||
endif()
|
||||
|
||||
if(WITH_SYSTEM_GLES)
|
||||
find_package_wrapper(OpenGLES)
|
||||
endif()
|
||||
@@ -1212,7 +1204,7 @@ else()
|
||||
|
||||
list(APPEND GL_DEFINITIONS -DGLEW_STATIC)
|
||||
|
||||
# This won't affect the non-experimental glew library,
|
||||
# This won't affect the non-experimental glew library,
|
||||
# but is used for conditional compilation elsewhere.
|
||||
list(APPEND GL_DEFINITIONS -DGLEW_NO_ES)
|
||||
|
||||
@@ -1416,22 +1408,16 @@ if(CMAKE_COMPILER_IS_GNUCC)
|
||||
endif()
|
||||
|
||||
# flags to undo strict flags
|
||||
ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_DEPRECATED_DECLARATIONS -Wno-deprecated-declarations)
|
||||
ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_UNUSED_PARAMETER -Wno-unused-parameter)
|
||||
ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_UNUSED_FUNCTION -Wno-unused-function)
|
||||
ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_TYPE_LIMITS -Wno-type-limits)
|
||||
ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_INT_IN_BOOL_CONTEXT -Wno-int-in-bool-context)
|
||||
ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_FORMAT -Wno-format)
|
||||
ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_SWITCH -Wno-switch)
|
||||
|
||||
ADD_CHECK_CXX_COMPILER_FLAG(CXX_REMOVE_STRICT_FLAGS CXX_WARN_NO_CLASS_MEMACCESS -Wno-class-memaccess)
|
||||
ADD_CHECK_C_COMPILER_FLAG(CC_REMOVE_STRICT_FLAGS C_WARN_NO_DEPRECATED_DECLARATIONS -Wno-deprecated-declarations)
|
||||
ADD_CHECK_C_COMPILER_FLAG(CC_REMOVE_STRICT_FLAGS C_WARN_NO_UNUSED_PARAMETER -Wno-unused-parameter)
|
||||
ADD_CHECK_C_COMPILER_FLAG(CC_REMOVE_STRICT_FLAGS C_WARN_NO_UNUSED_FUNCTION -Wno-unused-function)
|
||||
|
||||
if(CMAKE_COMPILER_IS_GNUCC AND (NOT "${CMAKE_C_COMPILER_VERSION}" VERSION_LESS "7.0"))
|
||||
ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_IMPLICIT_FALLTHROUGH -Wno-implicit-fallthrough)
|
||||
ADD_CHECK_C_COMPILER_FLAG(CC_REMOVE_STRICT_FLAGS C_WARN_NO_IMPLICIT_FALLTHROUGH -Wno-implicit-fallthrough)
|
||||
endif()
|
||||
|
||||
if(NOT APPLE)
|
||||
ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_ERROR_UNUSED_BUT_SET_VARIABLE -Wno-error=unused-but-set-variable)
|
||||
ADD_CHECK_C_COMPILER_FLAG(CC_REMOVE_STRICT_FLAGS C_WARN_NO_ERROR_UNUSED_BUT_SET_VARIABLE -Wno-error=unused-but-set-variable)
|
||||
endif()
|
||||
|
||||
elseif(CMAKE_C_COMPILER_ID MATCHES "Clang")
|
||||
@@ -1460,23 +1446,23 @@ elseif(CMAKE_C_COMPILER_ID MATCHES "Clang")
|
||||
# ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_UNUSED_MACROS -Wunused-macros)
|
||||
|
||||
# flags to undo strict flags
|
||||
ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_UNUSED_PARAMETER -Wno-unused-parameter)
|
||||
ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_UNUSED_MACROS -Wno-unused-macros)
|
||||
ADD_CHECK_C_COMPILER_FLAG(CC_REMOVE_STRICT_FLAGS C_WARN_NO_UNUSED_PARAMETER -Wno-unused-parameter)
|
||||
ADD_CHECK_C_COMPILER_FLAG(CC_REMOVE_STRICT_FLAGS C_WARN_NO_UNUSED_MACROS -Wno-unused-macros)
|
||||
|
||||
ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_MISSING_VARIABLE_DECLARATIONS -Wno-missing-variable-declarations)
|
||||
ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_INCOMPAT_PTR_DISCARD_QUAL -Wno-incompatible-pointer-types-discards-qualifiers)
|
||||
ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_UNUSED_FUNCTION -Wno-unused-function)
|
||||
ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_INT_TO_VOID_POINTER_CAST -Wno-int-to-void-pointer-cast)
|
||||
ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_MISSING_PROTOTYPES -Wno-missing-prototypes)
|
||||
ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_DUPLICATE_ENUM -Wno-duplicate-enum)
|
||||
ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_UNDEF -Wno-undef)
|
||||
ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_MISSING_NORETURN -Wno-missing-noreturn)
|
||||
ADD_CHECK_C_COMPILER_FLAG(CC_REMOVE_STRICT_FLAGS C_WARN_NO_MISSING_VARIABLE_DECLARATIONS -Wno-missing-variable-declarations)
|
||||
ADD_CHECK_C_COMPILER_FLAG(CC_REMOVE_STRICT_FLAGS C_WARN_NO_INCOMPAT_PTR_DISCARD_QUAL -Wno-incompatible-pointer-types-discards-qualifiers)
|
||||
ADD_CHECK_C_COMPILER_FLAG(CC_REMOVE_STRICT_FLAGS C_WARN_NO_UNUSED_FUNCTION -Wno-unused-function)
|
||||
ADD_CHECK_C_COMPILER_FLAG(CC_REMOVE_STRICT_FLAGS C_WARN_NO_INT_TO_VOID_POINTER_CAST -Wno-int-to-void-pointer-cast)
|
||||
ADD_CHECK_C_COMPILER_FLAG(CC_REMOVE_STRICT_FLAGS C_WARN_NO_MISSING_PROTOTYPES -Wno-missing-prototypes)
|
||||
ADD_CHECK_C_COMPILER_FLAG(CC_REMOVE_STRICT_FLAGS C_WARN_NO_DUPLICATE_ENUM -Wno-duplicate-enum)
|
||||
ADD_CHECK_C_COMPILER_FLAG(CC_REMOVE_STRICT_FLAGS C_WARN_NO_UNDEF -Wno-undef)
|
||||
ADD_CHECK_C_COMPILER_FLAG(CC_REMOVE_STRICT_FLAGS C_WARN_NO_MISSING_NORETURN -Wno-missing-noreturn)
|
||||
|
||||
ADD_CHECK_CXX_COMPILER_FLAG(CXX_REMOVE_STRICT_FLAGS CXX_WARN_NO_UNUSED_PRIVATE_FIELD -Wno-unused-private-field)
|
||||
ADD_CHECK_CXX_COMPILER_FLAG(CXX_REMOVE_STRICT_FLAGS CXX_WARN_NO_CXX11_NARROWING -Wno-c++11-narrowing)
|
||||
ADD_CHECK_CXX_COMPILER_FLAG(CXX_REMOVE_STRICT_FLAGS CXX_WARN_NO_NON_VIRTUAL_DTOR -Wno-non-virtual-dtor)
|
||||
ADD_CHECK_CXX_COMPILER_FLAG(CXX_REMOVE_STRICT_FLAGS CXX_WARN_NO_UNUSED_MACROS -Wno-unused-macros)
|
||||
ADD_CHECK_CXX_COMPILER_FLAG(CXX_REMOVE_STRICT_FLAGS CXX_WARN_NO_REORDER -Wno-reorder)
|
||||
ADD_CHECK_CXX_COMPILER_FLAG(CC_REMOVE_STRICT_FLAGS CXX_WARN_NO_UNUSED_PRIVATE_FIELD -Wno-unused-private-field)
|
||||
ADD_CHECK_CXX_COMPILER_FLAG(CC_REMOVE_STRICT_FLAGS CXX_WARN_NO_CXX11_NARROWING -Wno-c++11-narrowing)
|
||||
ADD_CHECK_CXX_COMPILER_FLAG(CC_REMOVE_STRICT_FLAGS CXX_WARN_NO_NON_VIRTUAL_DTOR -Wno-non-virtual-dtor)
|
||||
ADD_CHECK_CXX_COMPILER_FLAG(CC_REMOVE_STRICT_FLAGS CXX_WARN_NO_UNUSED_MACROS -Wno-unused-macros)
|
||||
ADD_CHECK_CXX_COMPILER_FLAG(CC_REMOVE_STRICT_FLAGS CXX_WARN_NO_REORDER -Wno-reorder)
|
||||
|
||||
elseif(CMAKE_C_COMPILER_ID MATCHES "Intel")
|
||||
|
||||
@@ -1508,7 +1494,7 @@ elseif(CMAKE_C_COMPILER_ID MATCHES "MSVC")
|
||||
"/wd4267" # conversion from 'size_t' to 'type', possible loss of data
|
||||
"/wd4305" # truncation from 'type1' to 'type2'
|
||||
"/wd4800" # forcing value to bool 'true' or 'false'
|
||||
"/wd4828" # The file contains a character that is illegal
|
||||
"/wd4828" # The file contains a character that is illegal
|
||||
# errors:
|
||||
"/we4013" # 'function' undefined; assuming extern returning int
|
||||
"/we4133" # incompatible pointer types
|
||||
|
@@ -58,3 +58,4 @@ if(MSVC)
|
||||
DEPENDEES mkdir update patch download configure build install
|
||||
)
|
||||
endif()
|
||||
|
||||
|
@@ -33,8 +33,8 @@ set(NUMPY_POSTFIX)
|
||||
if(WIN32)
|
||||
set(NUMPY_INSTALL
|
||||
${CMAKE_COMMAND} -E copy_directory "${BUILD_DIR}/python/src/external_python/run/lib/site-packages/numpy/core/include/numpy" "${LIBDIR}/python/include/python${PYTHON_SHORT_VERSION}/numpy" &&
|
||||
${CMAKE_COMMAND} -E chdir "${BUILD_DIR}/numpy/src/external_numpy/build/lib.${PYTHON_ARCH2}-${PYTHON_SHORT_VERSION}${NUMPY_DIR_POSTFIX}"
|
||||
${CMAKE_COMMAND} -E tar "cfvz" "${LIBDIR}/python${PYTHON_SHORT_VERSION_NO_DOTS}_numpy_${NUMPY_SHORT_VERSION}${NUMPY_ARCHIVE_POSTFIX}.tar.gz" "."
|
||||
${CMAKE_COMMAND} -E chdir "${BUILD_DIR}/numpy/src/external_numpy/build/lib.${PYTHON_ARCH2}-${PYTHON_SHORT_VERSION}${NUMPY_DIR_POSTFIX}"
|
||||
${CMAKE_COMMAND} -E tar "cfvz" "${LIBDIR}/python${PYTHON_SHORT_VERSION_NO_DOTS}_numpy_${NUMPY_SHORT_VERSION}${NUMPY_ARCHIVE_POSTFIX}.tar.gz" "."
|
||||
)
|
||||
set(NUMPY_PATCH ${PATCH_CMD} --verbose -p 1 -N -d ${BUILD_DIR}/numpy/src/external_numpy < ${PATCH_DIR}/numpy.diff )
|
||||
else()
|
||||
|
@@ -39,6 +39,6 @@ if(BUILD_MODE STREQUAL Release)
|
||||
PREFIX ${BUILD_DIR}/openal
|
||||
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/openal ${DEFAULT_CMAKE_FLAGS} ${OPENAL_EXTRA_ARGS}
|
||||
INSTALL_DIR ${LIBDIR}/openal
|
||||
PATCH_COMMAND ${PATCH_CMD} -p 1 -d ${BUILD_DIR}/openal/src/external_openal < ${PATCH_DIR}/openal.diff
|
||||
PATCH_COMMAND ${PATCH_CMD} -p 1 -d ${BUILD_DIR}/openal/src/external_openal < ${PATCH_DIR}/openal.diff
|
||||
)
|
||||
endif()
|
||||
|
@@ -46,7 +46,7 @@ if(MSVC)
|
||||
DOWNLOAD_DIR ${DOWNLOAD_DIR}
|
||||
URL_HASH SHA256=${OPENJPEG_HASH}
|
||||
PREFIX ${BUILD_DIR}/openjpeg_msvc
|
||||
CMAKE_ARGS ${OPENJPEG_EXTRA_ARGS} -DCMAKE_INSTALL_PREFIX=${LIBDIR}/openjpeg_msvc -DBUILD_SHARED_LIBS=Off -DBUILD_THIRDPARTY=OFF
|
||||
CMAKE_ARGS ${OPENJPEG_EXTRA_ARGS} -DCMAKE_INSTALL_PREFIX=${LIBDIR}/openjpeg_msvc -DBUILD_SHARED_LIBS=Off -DBUILD_THIRDPARTY=OFF
|
||||
INSTALL_DIR ${LIBDIR}/openjpeg_msvc
|
||||
)
|
||||
if(BUILD_MODE STREQUAL Release)
|
||||
|
@@ -57,9 +57,9 @@ if(WIN32)
|
||||
set(COMMON_DEFINES /DPSAPI_VERSION=1 /DOIIO_STATIC_BUILD /DTINYFORMAT_ALLOW_WCHAR_STRINGS)
|
||||
|
||||
if(MSVC_VERSION GREATER 1909)
|
||||
set(COMMON_MSVC_FLAGS "/Wv:18") #some deps with warnings as error aren't quite ready for dealing with the new 2017 warnings.
|
||||
set(COMMON_MSVC_FLAGS "/Wv:18") #some deps with warnings as error aren't quite ready for dealing with the new 2017 warnings.
|
||||
endif()
|
||||
|
||||
|
||||
if(WITH_OPTIMIZED_DEBUG)
|
||||
set(BLENDER_CMAKE_C_FLAGS_DEBUG "/MTd ${COMMON_MSVC_FLAGS} /O2 /Ob2 /DNDEBUG /DPSAPI_VERSION=1 /DOIIO_STATIC_BUILD /DTINYFORMAT_ALLOW_WCHAR_STRINGS")
|
||||
else()
|
||||
|
@@ -216,3 +216,4 @@ if(NOT EXISTS "${DOWNLOAD_DIR}/mingw/mingw32/bin/i686-w64-mingw32-ranlib.exe")
|
||||
COMMAND ${CMAKE_COMMAND} -E copy "${DOWNLOAD_DIR}/mingw/mingw32/bin/ranlib.exe" "${DOWNLOAD_DIR}/mingw/mingw32/bin/i686-w64-mingw32-ranlib.exe"
|
||||
)
|
||||
endif()
|
||||
|
||||
|
@@ -216,3 +216,4 @@ if(NOT EXISTS "${DOWNLOAD_DIR}/mingw/mingw64/bin/x86_64-w64-mingw32-ranlib.exe")
|
||||
COMMAND ${CMAKE_COMMAND} -E copy "${DOWNLOAD_DIR}/mingw/mingw64/bin/ranlib.exe" "${DOWNLOAD_DIR}/mingw/mingw64/bin/x86_64-w64-mingw32-ranlib.exe"
|
||||
)
|
||||
endif()
|
||||
|
||||
|
@@ -25,7 +25,7 @@ ExternalProject_Add(external_x264
|
||||
DOWNLOAD_DIR ${DOWNLOAD_DIR}
|
||||
URL_HASH SHA256=${X264_HASH}
|
||||
PREFIX ${BUILD_DIR}/x264
|
||||
CONFIGURE_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/x264/src/external_x264/ && ${CONFIGURE_COMMAND} --prefix=${LIBDIR}/x264
|
||||
CONFIGURE_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/x264/src/external_x264/ && ${CONFIGURE_COMMAND} --prefix=${LIBDIR}/x264
|
||||
--enable-static
|
||||
--enable-pic
|
||||
--disable-lavf
|
||||
|
@@ -37,3 +37,4 @@ endif()
|
||||
if(MSVC)
|
||||
set_target_properties(external_zlib_mingw PROPERTIES FOLDER Mingw)
|
||||
endif()
|
||||
|
||||
|
@@ -75,7 +75,7 @@ macro(PREFIX_FIND_LIB prefix libname libpath_var liblist_var cachelist_var)
|
||||
# Handle new library names for OpenEXR 2.1 build via cmake
|
||||
string(REPLACE "." "_" _ILMBASE_VERSION ${ILMBASE_VERSION})
|
||||
string(SUBSTRING ${_ILMBASE_VERSION} 0 3 _ILMBASE_VERSION )
|
||||
|
||||
|
||||
find_library(${tmp_prefix}_LIBRARY_RELEASE
|
||||
NAMES ${libname} ${libname}-${_ILMBASE_VERSION}
|
||||
HINTS ${${libpath_var}}
|
||||
@@ -177,7 +177,7 @@ if(ILMBASE_INCLUDE_DIR)
|
||||
"\\1" XYZ ${ILMBASE_BUILD_SPECIFICATION})
|
||||
set("ILMBASE_VERSION" ${XYZ} CACHE STRING "Version of ILMBase lib")
|
||||
else()
|
||||
# Old versions (before 2.0?) do not have any version string, just assuming 2.0 should be fine though.
|
||||
# Old versions (before 2.0?) do not have any version string, just assuming 2.0 should be fine though.
|
||||
message(WARNING "Could not determine ILMBase library version, assuming 2.0.")
|
||||
set("ILMBASE_VERSION" "2.0" CACHE STRING "Version of ILMBase lib")
|
||||
endif()
|
||||
|
@@ -175,7 +175,7 @@ if(OPENEXR_INCLUDE_DIR)
|
||||
"\\1" XYZ ${OPENEXR_BUILD_SPECIFICATION})
|
||||
set("OPENEXR_VERSION" ${XYZ} CACHE STRING "Version of OpenEXR lib")
|
||||
else()
|
||||
# Old versions (before 2.0?) do not have any version string, just assuming 2.0 should be fine though.
|
||||
# Old versions (before 2.0?) do not have any version string, just assuming 2.0 should be fine though.
|
||||
message(WARNING "Could not determine ILMBase library version, assuming 2.0.")
|
||||
set("OPENEXR_VERSION" "2.0" CACHE STRING "Version of OpenEXR lib")
|
||||
endif()
|
||||
|
@@ -6,7 +6,7 @@
|
||||
# basename_LIBRARY_RELEASE is defined, basename_LIBRARY, basename_LIBRARY_DEBUG,
|
||||
# and basename_LIBRARY_RELEASE will be set to the release value. If only
|
||||
# basename_LIBRARY_DEBUG is defined, then basename_LIBRARY,
|
||||
# basename_LIBRARY_DEBUG and basename_LIBRARY_RELEASE will take the debug value.
|
||||
# basename_LIBRARY_DEBUG and basename_LIBRARY_RELEASE will take the debug value.
|
||||
#
|
||||
# If the generator supports configuration types, then basename_LIBRARY and
|
||||
# basename_LIBRARIES will be set with debug and optimized flags specifying the
|
||||
@@ -53,10 +53,10 @@ macro( select_library_configurations basename )
|
||||
# if the generator supports configuration types or CMAKE_BUILD_TYPE
|
||||
# is set, then set optimized and debug options.
|
||||
if( CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE )
|
||||
set( ${basename}_LIBRARY
|
||||
set( ${basename}_LIBRARY
|
||||
optimized ${${basename}_LIBRARY_RELEASE}
|
||||
debug ${${basename}_LIBRARY_DEBUG} )
|
||||
set( ${basename}_LIBRARIES
|
||||
set( ${basename}_LIBRARIES
|
||||
optimized ${${basename}_LIBRARY_RELEASE}
|
||||
debug ${${basename}_LIBRARY_DEBUG} )
|
||||
else( CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE )
|
||||
@@ -67,15 +67,16 @@ macro( select_library_configurations basename )
|
||||
endif( CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE )
|
||||
endif( ${basename}_LIBRARY_DEBUG AND ${basename}_LIBRARY_RELEASE )
|
||||
|
||||
set( ${basename}_LIBRARY ${${basename}_LIBRARY} CACHE FILEPATH
|
||||
set( ${basename}_LIBRARY ${${basename}_LIBRARY} CACHE FILEPATH
|
||||
"The ${basename} library" )
|
||||
|
||||
if( ${basename}_LIBRARY )
|
||||
set( ${basename}_FOUND TRUE )
|
||||
endif( ${basename}_LIBRARY )
|
||||
|
||||
mark_as_advanced( ${basename}_LIBRARY
|
||||
mark_as_advanced( ${basename}_LIBRARY
|
||||
${basename}_LIBRARY_RELEASE
|
||||
${basename}_LIBRARY_DEBUG
|
||||
)
|
||||
endmacro( select_library_configurations )
|
||||
|
||||
|
@@ -51,7 +51,7 @@ FIND_LIBRARY(ALEMBIC_LIBRARY
|
||||
lib64 lib lib/static
|
||||
)
|
||||
|
||||
# handle the QUIETLY and REQUIRED arguments and set ALEMBIC_FOUND to TRUE if
|
||||
# handle the QUIETLY and REQUIRED arguments and set ALEMBIC_FOUND to TRUE if
|
||||
# all listed variables are TRUE
|
||||
INCLUDE(FindPackageHandleStandardArgs)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(ALEMBIC DEFAULT_MSG ALEMBIC_LIBRARY ALEMBIC_INCLUDE_DIR)
|
||||
|
@@ -40,7 +40,7 @@ FIND_PATH(EIGEN3_INCLUDE_DIR
|
||||
include/eigen3
|
||||
)
|
||||
|
||||
# handle the QUIETLY and REQUIRED arguments and set EIGEN3_FOUND to TRUE if
|
||||
# handle the QUIETLY and REQUIRED arguments and set EIGEN3_FOUND to TRUE if
|
||||
# all listed variables are TRUE
|
||||
INCLUDE(FindPackageHandleStandardArgs)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Eigen3 DEFAULT_MSG
|
||||
|
@@ -52,7 +52,7 @@ FIND_LIBRARY(FFTW3_LIBRARY
|
||||
lib64 lib
|
||||
)
|
||||
|
||||
# handle the QUIETLY and REQUIRED arguments and set FFTW3_FOUND to TRUE if
|
||||
# handle the QUIETLY and REQUIRED arguments and set FFTW3_FOUND to TRUE if
|
||||
# all listed variables are TRUE
|
||||
INCLUDE(FindPackageHandleStandardArgs)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Fftw3 DEFAULT_MSG
|
||||
|
@@ -49,7 +49,7 @@ FIND_LIBRARY(GLEW_LIBRARY
|
||||
lib64 lib
|
||||
)
|
||||
|
||||
# handle the QUIETLY and REQUIRED arguments and set GLEW_FOUND to TRUE if
|
||||
# handle the QUIETLY and REQUIRED arguments and set GLEW_FOUND to TRUE if
|
||||
# all listed variables are TRUE
|
||||
INCLUDE(FindPackageHandleStandardArgs)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Glew DEFAULT_MSG
|
||||
|
@@ -115,7 +115,7 @@ if(Boost_USE_STATIC_LIBS)
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES ${_icu_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES})
|
||||
endif()
|
||||
|
||||
# handle the QUIETLY and REQUIRED arguments and set ICU_FOUND to TRUE if
|
||||
# handle the QUIETLY and REQUIRED arguments and set ICU_FOUND to TRUE if
|
||||
# all listed variables are TRUE
|
||||
INCLUDE(FindPackageHandleStandardArgs)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Icu DEFAULT_MSG
|
||||
|
@@ -52,7 +52,7 @@ FIND_LIBRARY(JACK_LIBRARY
|
||||
lib64 lib
|
||||
)
|
||||
|
||||
# handle the QUIETLY and REQUIRED arguments and set JACK_FOUND to TRUE if
|
||||
# handle the QUIETLY and REQUIRED arguments and set JACK_FOUND to TRUE if
|
||||
# all listed variables are TRUE
|
||||
INCLUDE(FindPackageHandleStandardArgs)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Jack DEFAULT_MSG
|
||||
|
@@ -53,7 +53,7 @@ FIND_LIBRARY(JEMALLOC_LIBRARY
|
||||
lib64 lib
|
||||
)
|
||||
|
||||
# handle the QUIETLY and REQUIRED arguments and set JEMALLOC_FOUND to TRUE if
|
||||
# handle the QUIETLY and REQUIRED arguments and set JEMALLOC_FOUND to TRUE if
|
||||
# all listed variables are TRUE
|
||||
INCLUDE(FindPackageHandleStandardArgs)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(JeMalloc DEFAULT_MSG
|
||||
|
@@ -93,3 +93,4 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(LLVM DEFAULT_MSG
|
||||
MARK_AS_ADVANCED(
|
||||
LLVM_LIBRARY
|
||||
)
|
||||
|
||||
|
@@ -50,7 +50,7 @@ FIND_LIBRARY(LZO_LIBRARY
|
||||
lib64 lib
|
||||
)
|
||||
|
||||
# handle the QUIETLY and REQUIRED arguments and set LZO_FOUND to TRUE if
|
||||
# handle the QUIETLY and REQUIRED arguments and set LZO_FOUND to TRUE if
|
||||
# all listed variables are TRUE
|
||||
INCLUDE(FindPackageHandleStandardArgs)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(LZO DEFAULT_MSG
|
||||
|
@@ -1,7 +1,7 @@
|
||||
# - Find OpenCOLLADA library
|
||||
# Find the native OpenCOLLADA includes and library
|
||||
# This module defines
|
||||
# OPENCOLLADA_INCLUDE_DIRS, where to find COLLADABaseUtils/ and
|
||||
# OPENCOLLADA_INCLUDE_DIRS, where to find COLLADABaseUtils/ and
|
||||
# COLLADAFramework/, Set when OPENCOLLADA_INCLUDE_DIR is found.
|
||||
# OPENCOLLADA_LIBRARIES, libraries to link against to use OpenCOLLADA.
|
||||
# OPENCOLLADA_ROOT_DIR, The base directory to search for OpenCOLLADA.
|
||||
@@ -129,7 +129,7 @@ FOREACH(COMPONENT ${_opencollada_FIND_STATIC_COMPONENTS})
|
||||
ENDFOREACH()
|
||||
|
||||
|
||||
# handle the QUIETLY and REQUIRED arguments and set OPENCOLLADA_FOUND to TRUE if
|
||||
# handle the QUIETLY and REQUIRED arguments and set OPENCOLLADA_FOUND to TRUE if
|
||||
# all listed variables are TRUE
|
||||
INCLUDE(FindPackageHandleStandardArgs)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(OpenCOLLADA DEFAULT_MSG
|
||||
|
@@ -68,7 +68,7 @@ FOREACH(COMPONENT ${_opencolorio_FIND_COMPONENTS})
|
||||
ENDFOREACH()
|
||||
|
||||
|
||||
# handle the QUIETLY and REQUIRED arguments and set OPENCOLORIO_FOUND to TRUE if
|
||||
# handle the QUIETLY and REQUIRED arguments and set OPENCOLORIO_FOUND to TRUE if
|
||||
# all listed variables are TRUE
|
||||
INCLUDE(FindPackageHandleStandardArgs)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(OpenColorIO DEFAULT_MSG
|
||||
|
@@ -106,7 +106,7 @@ FOREACH(COMPONENT ${_openexr_FIND_COMPONENTS})
|
||||
|
||||
FIND_LIBRARY(OPENEXR_${UPPERCOMPONENT}_LIBRARY
|
||||
NAMES
|
||||
${COMPONENT}-${_openexr_libs_ver} ${COMPONENT}
|
||||
${COMPONENT}-${_openexr_libs_ver} ${COMPONENT}
|
||||
HINTS
|
||||
${_openexr_SEARCH_DIRS}
|
||||
PATH_SUFFIXES
|
||||
@@ -117,7 +117,7 @@ ENDFOREACH()
|
||||
|
||||
UNSET(_openexr_libs_ver)
|
||||
|
||||
# handle the QUIETLY and REQUIRED arguments and set OPENEXR_FOUND to TRUE if
|
||||
# handle the QUIETLY and REQUIRED arguments and set OPENEXR_FOUND to TRUE if
|
||||
# all listed variables are TRUE
|
||||
INCLUDE(FindPackageHandleStandardArgs)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(OpenEXR DEFAULT_MSG
|
||||
|
@@ -64,7 +64,7 @@ FIND_FILE(OPENIMAGEIO_IDIFF
|
||||
bin
|
||||
)
|
||||
|
||||
# handle the QUIETLY and REQUIRED arguments and set OPENIMAGEIO_FOUND to TRUE if
|
||||
# handle the QUIETLY and REQUIRED arguments and set OPENIMAGEIO_FOUND to TRUE if
|
||||
# all listed variables are TRUE
|
||||
INCLUDE(FindPackageHandleStandardArgs)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(OpenImageIO DEFAULT_MSG
|
||||
|
@@ -53,7 +53,7 @@ FIND_LIBRARY(OPENJPEG_LIBRARY
|
||||
lib64 lib
|
||||
)
|
||||
|
||||
# handle the QUIETLY and REQUIRED arguments and set OPENJPEG_FOUND to TRUE if
|
||||
# handle the QUIETLY and REQUIRED arguments and set OPENJPEG_FOUND to TRUE if
|
||||
# all listed variables are TRUE
|
||||
INCLUDE(FindPackageHandleStandardArgs)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(OpenJPEG DEFAULT_MSG
|
||||
|
@@ -50,7 +50,7 @@ FIND_LIBRARY(PCRE_LIBRARY
|
||||
lib64 lib
|
||||
)
|
||||
|
||||
# handle the QUIETLY and REQUIRED arguments and set PCRE_FOUND to TRUE if
|
||||
# handle the QUIETLY and REQUIRED arguments and set PCRE_FOUND to TRUE if
|
||||
# all listed variables are TRUE
|
||||
INCLUDE(FindPackageHandleStandardArgs)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(PCRE DEFAULT_MSG
|
||||
|
@@ -53,7 +53,7 @@ FIND_LIBRARY(PUGIXML_LIBRARY
|
||||
lib64 lib
|
||||
)
|
||||
|
||||
# handle the QUIETLY and REQUIRED arguments and set PUGIXML_FOUND to TRUE if
|
||||
# handle the QUIETLY and REQUIRED arguments and set PUGIXML_FOUND to TRUE if
|
||||
# all listed variables are TRUE
|
||||
INCLUDE(FindPackageHandleStandardArgs)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(PUGIXML DEFAULT_MSG
|
||||
|
@@ -175,7 +175,7 @@ UNSET(_IS_INC_CONF_DEF)
|
||||
UNSET(_IS_LIB_DEF)
|
||||
UNSET(_IS_LIB_PATH_DEF)
|
||||
|
||||
# handle the QUIETLY and REQUIRED arguments and SET PYTHONLIBSUNIX_FOUND to TRUE IF
|
||||
# handle the QUIETLY and REQUIRED arguments and SET PYTHONLIBSUNIX_FOUND to TRUE IF
|
||||
# all listed variables are TRUE
|
||||
INCLUDE(FindPackageHandleStandardArgs)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(PythonLibsUnix DEFAULT_MSG
|
||||
|
@@ -50,7 +50,7 @@ FIND_LIBRARY(LIBSNDFILE_LIBRARY
|
||||
lib64 lib
|
||||
)
|
||||
|
||||
# handle the QUIETLY and REQUIRED arguments and set LIBSNDFILE_FOUND to TRUE if
|
||||
# handle the QUIETLY and REQUIRED arguments and set LIBSNDFILE_FOUND to TRUE if
|
||||
# all listed variables are TRUE
|
||||
INCLUDE(FindPackageHandleStandardArgs)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(SndFile DEFAULT_MSG
|
||||
|
@@ -52,7 +52,7 @@ FIND_LIBRARY(SPACENAV_LIBRARY
|
||||
lib64 lib
|
||||
)
|
||||
|
||||
# handle the QUIETLY and REQUIRED arguments and set SPACENAV_FOUND to TRUE if
|
||||
# handle the QUIETLY and REQUIRED arguments and set SPACENAV_FOUND to TRUE if
|
||||
# all listed variables are TRUE
|
||||
INCLUDE(FindPackageHandleStandardArgs)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Spacenav DEFAULT_MSG
|
||||
|
@@ -50,7 +50,7 @@ FIND_LIBRARY(XML2_LIBRARY
|
||||
lib64 lib
|
||||
)
|
||||
|
||||
# handle the QUIETLY and REQUIRED arguments and set XML2_FOUND to TRUE if
|
||||
# handle the QUIETLY and REQUIRED arguments and set XML2_FOUND to TRUE if
|
||||
# all listed variables are TRUE
|
||||
INCLUDE(FindPackageHandleStandardArgs)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(XML2 DEFAULT_MSG
|
||||
|
@@ -13,7 +13,7 @@ if(NOT DEFINED RPMBUILD)
|
||||
|
||||
if(RPMBUILD)
|
||||
message(STATUS "RPM Build Found: ${RPMBUILD}")
|
||||
else()
|
||||
else()
|
||||
message(STATUS "RPM Build Not Found (rpmbuild). RPM generation will not be available")
|
||||
endif()
|
||||
|
||||
@@ -21,6 +21,6 @@ endif()
|
||||
|
||||
if(RPMBUILD)
|
||||
set(RPMBUILD_FOUND TRUE)
|
||||
else()
|
||||
else()
|
||||
set(RPMBUILD_FOUND FALSE)
|
||||
endif()
|
||||
endif()
|
@@ -5,7 +5,7 @@
|
||||
# cmake -C../blender/build_files/cmake/config/blender_headless.cmake ../blender
|
||||
#
|
||||
|
||||
set(WITH_HEADLESS ON CACHE BOOL "" FORCE)
|
||||
set(WITH_HEADLESS ON CACHE BOOL "" FORCE)
|
||||
|
||||
# disable audio, its possible some devs may want this but for now disable
|
||||
# so the python module doesnt hold the audio device and loads quickly.
|
||||
|
@@ -51,7 +51,7 @@ endmacro()
|
||||
function(list_assert_duplicates
|
||||
list_id
|
||||
)
|
||||
|
||||
|
||||
# message(STATUS "list data: ${list_id}")
|
||||
|
||||
list(LENGTH list_id _len_before)
|
||||
@@ -242,7 +242,7 @@ function(blender_add_lib__impl
|
||||
# listed is helpful for IDE's (QtCreator/MSVC)
|
||||
blender_source_group("${sources}")
|
||||
|
||||
#if enabled, set the FOLDER property for visual studio projects
|
||||
#if enabled, set the FOLDER property for visual studio projects
|
||||
if(WINDOWS_USE_VISUAL_STUDIO_FOLDERS)
|
||||
get_filename_component(FolderDir ${CMAKE_CURRENT_SOURCE_DIR} DIRECTORY)
|
||||
string(REPLACE ${CMAKE_SOURCE_DIR} "" FolderDir ${FolderDir})
|
||||
@@ -674,9 +674,7 @@ function(SETUP_BLENDER_SORTED_LIBS)
|
||||
extern_openjpeg
|
||||
ge_videotex
|
||||
bf_dna
|
||||
|
||||
bf_blenfont
|
||||
bf_gpu # duplicate for blenfont
|
||||
bf_blentranslation
|
||||
bf_intern_audaspace
|
||||
audaspace
|
||||
@@ -1056,19 +1054,13 @@ macro(remove_cc_flag
|
||||
|
||||
endmacro()
|
||||
|
||||
macro(add_c_flag
|
||||
macro(add_cc_flag
|
||||
flag)
|
||||
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${flag}")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${flag}")
|
||||
endmacro()
|
||||
|
||||
macro(add_cxx_flag
|
||||
flag)
|
||||
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${flag}")
|
||||
endmacro()
|
||||
|
||||
macro(remove_strict_flags)
|
||||
|
||||
if(CMAKE_COMPILER_IS_GNUCC)
|
||||
@@ -1091,8 +1083,7 @@ macro(remove_strict_flags)
|
||||
)
|
||||
|
||||
# negate flags implied by '-Wall'
|
||||
add_c_flag("${C_REMOVE_STRICT_FLAGS}")
|
||||
add_cxx_flag("${CXX_REMOVE_STRICT_FLAGS}")
|
||||
add_cc_flag("${CC_REMOVE_STRICT_FLAGS}")
|
||||
endif()
|
||||
|
||||
if(CMAKE_C_COMPILER_ID MATCHES "Clang")
|
||||
@@ -1104,8 +1095,7 @@ macro(remove_strict_flags)
|
||||
)
|
||||
|
||||
# negate flags implied by '-Wall'
|
||||
add_c_flag("${C_REMOVE_STRICT_FLAGS}")
|
||||
add_cxx_flag("${CXX_REMOVE_STRICT_FLAGS}")
|
||||
add_cc_flag("${CC_REMOVE_STRICT_FLAGS}")
|
||||
endif()
|
||||
|
||||
if(MSVC)
|
||||
@@ -1135,39 +1125,28 @@ endmacro()
|
||||
# note, we can only append flags on a single file so we need to negate the options.
|
||||
# at the moment we cant shut up ffmpeg deprecations, so use this, but will
|
||||
# probably add more removals here.
|
||||
macro(remove_strict_c_flags_file
|
||||
macro(remove_strict_flags_file
|
||||
filenames)
|
||||
foreach(_SOURCE ${ARGV})
|
||||
if(CMAKE_COMPILER_IS_GNUCC OR
|
||||
(CMAKE_C_COMPILER_ID MATCHES "Clang"))
|
||||
set_source_files_properties(${_SOURCE}
|
||||
PROPERTIES
|
||||
COMPILE_FLAGS "${C_REMOVE_STRICT_FLAGS}"
|
||||
)
|
||||
endif()
|
||||
if(MSVC)
|
||||
# TODO
|
||||
endif()
|
||||
endforeach()
|
||||
unset(_SOURCE)
|
||||
endmacro()
|
||||
|
||||
macro(remove_strict_cxx_flags_file
|
||||
filenames)
|
||||
remove_strict_c_flags_file(${filenames} ${ARHV})
|
||||
foreach(_SOURCE ${ARGV})
|
||||
|
||||
if(CMAKE_COMPILER_IS_GNUCC OR
|
||||
(CMAKE_CXX_COMPILER_ID MATCHES "Clang"))
|
||||
(CMAKE_C_COMPILER_ID MATCHES "Clang"))
|
||||
|
||||
set_source_files_properties(${_SOURCE}
|
||||
PROPERTIES
|
||||
COMPILE_FLAGS "${CXX_REMOVE_STRICT_FLAGS}"
|
||||
COMPILE_FLAGS "${CC_REMOVE_STRICT_FLAGS}"
|
||||
)
|
||||
endif()
|
||||
|
||||
if(MSVC)
|
||||
# TODO
|
||||
endif()
|
||||
|
||||
endforeach()
|
||||
|
||||
unset(_SOURCE)
|
||||
|
||||
endmacro()
|
||||
|
||||
# External libs may need 'signed char' to be default.
|
||||
|
@@ -51,9 +51,9 @@ string(REPLACE "/Contents/Developer" "" XCODE_BUNDLE ${XCODE_CHECK}) # truncate
|
||||
if(${CMAKE_GENERATOR} MATCHES "Xcode")
|
||||
|
||||
# earlier xcode has no bundled developer dir, no sense in getting xcode path from
|
||||
if(${XCODE_VERSION} VERSION_GREATER 4.2)
|
||||
if(${XCODE_VERSION} VERSION_GREATER 4.2)
|
||||
# reduce to XCode name without dp extension
|
||||
string(SUBSTRING "${XCODE_CHECK}" 14 6 DP_NAME)
|
||||
string(SUBSTRING "${XCODE_CHECK}" 14 6 DP_NAME)
|
||||
if(${DP_NAME} MATCHES Xcode5)
|
||||
set(XCODE_VERSION 5)
|
||||
endif()
|
||||
@@ -64,7 +64,7 @@ if(${CMAKE_GENERATOR} MATCHES "Xcode")
|
||||
message(FATAL_ERROR "Xcode 4.3 and higher must be used with cmake 2.8-8 or higher")
|
||||
endif()
|
||||
### end cmake incompatibility with xcode 4.3 and higher ###
|
||||
|
||||
|
||||
if(${XCODE_VERSION} VERSION_EQUAL 4 OR ${XCODE_VERSION} VERSION_GREATER 4 AND ${XCODE_VERSION} VERSION_LESS 4.3)
|
||||
# Xcode 4 defaults to the Apple LLVM Compiler.
|
||||
# Override the default compiler selection because Blender only compiles with gcc up to xcode 4.2
|
||||
@@ -85,7 +85,7 @@ if(${XCODE_VERSION} VERSION_LESS 4.3)
|
||||
else()
|
||||
# note: xcode-select path could be ambigous,
|
||||
# cause /Applications/Xcode.app/Contents/Developer or /Applications/Xcode.app would be allowed
|
||||
# so i use a selfcomposed bundlepath here
|
||||
# so i use a selfcomposed bundlepath here
|
||||
set(OSX_SYSROOT_PREFIX ${XCODE_BUNDLE}/Contents/Developer/Platforms/MacOSX.platform)
|
||||
message(STATUS "OSX_SYSROOT_PREFIX: " ${OSX_SYSROOT_PREFIX})
|
||||
set(OSX_DEVELOPER_PREFIX /Developer/SDKs/MacOSX${OSX_SYSTEM}.sdk) # use guaranteed existing sdk
|
||||
|
@@ -130,8 +130,8 @@ include(InstallRequiredSystemLibraries)
|
||||
|
||||
remove_cc_flag("/MDd" "/MD")
|
||||
|
||||
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.
|
||||
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 ")
|
||||
@@ -425,7 +425,7 @@ if(WITH_OPENIMAGEIO)
|
||||
set(OIIO_OPTIMIZED optimized ${OPENIMAGEIO_LIBPATH}/OpenImageIO.lib optimized ${OPENIMAGEIO_LIBPATH}/OpenImageIO_Util.lib)
|
||||
set(OIIO_DEBUG debug ${OPENIMAGEIO_LIBPATH}/OpenImageIO_d.lib debug ${OPENIMAGEIO_LIBPATH}/OpenImageIO_Util_d.lib)
|
||||
set(OPENIMAGEIO_LIBRARIES ${OIIO_OPTIMIZED} ${OIIO_DEBUG})
|
||||
|
||||
|
||||
set(OPENIMAGEIO_DEFINITIONS "-DUSE_TBB=0")
|
||||
set(OPENCOLORIO_DEFINITIONS "-DOCIO_STATIC_BUILD")
|
||||
set(OPENIMAGEIO_IDIFF "${OPENIMAGEIO}/bin/idiff.exe")
|
||||
@@ -474,7 +474,7 @@ if(WITH_OPENVDB)
|
||||
set(OPENVDB_LIBPATH ${LIBDIR}/openvdb/lib)
|
||||
set(OPENVDB_INCLUDE_DIRS ${OPENVDB}/include ${TBB_INCLUDE_DIR})
|
||||
set(OPENVDB_LIBRARIES optimized ${OPENVDB_LIBPATH}/openvdb.lib debug ${OPENVDB_LIBPATH}/openvdb_d.lib ${TBB_LIBRARIES} ${BLOSC_LIBRARIES})
|
||||
|
||||
|
||||
endif()
|
||||
|
||||
if(WITH_ALEMBIC)
|
||||
|
@@ -2,7 +2,6 @@ if NOT "%verbose%" == "" (
|
||||
echo Detecting msvc 2017
|
||||
)
|
||||
set BUILD_VS_VER=15
|
||||
set BUILD_VS_YEAR=2017
|
||||
set ProgramFilesX86=%ProgramFiles(x86)%
|
||||
if not exist "%ProgramFilesX86%" set ProgramFilesX86=%ProgramFiles%
|
||||
|
||||
|
@@ -3,10 +3,10 @@ if "%GIT%" == "" (
|
||||
goto EOF
|
||||
)
|
||||
cd "%BLENDER_DIR%"
|
||||
for /f "delims=" %%i in ('"%GIT%" rev-parse HEAD') do echo Branch_hash=%%i
|
||||
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
|
||||
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
|
||||
for /f "delims=" %%i in ('%GIT% rev-parse HEAD') do echo Addons_Hash=%%i
|
||||
cd "%BLENDER_DIR%"
|
||||
:EOF
|
@@ -7,7 +7,7 @@
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
@@ -22,21 +22,21 @@
|
||||
#
|
||||
# Name:
|
||||
# dna.py
|
||||
#
|
||||
#
|
||||
# Description:
|
||||
# Creates a browsable DNA output to HTML.
|
||||
#
|
||||
#
|
||||
# Author:
|
||||
# Jeroen Bakker
|
||||
#
|
||||
#
|
||||
# Version:
|
||||
# v0.1 (12-05-2009) - migration of original source code to python.
|
||||
# Added code to support blender 2.5 branch
|
||||
# v0.2 (25-05-2009) - integrated with BlendFileReader.py
|
||||
#
|
||||
#
|
||||
# Input:
|
||||
# blender build executable
|
||||
#
|
||||
#
|
||||
# Output:
|
||||
# dna.html
|
||||
# dna.css (will only be created when not existing)
|
||||
@@ -76,12 +76,12 @@ class DNACatalogHTML:
|
||||
DNACatalog is a catalog of all information in the DNA1 file-block
|
||||
'''
|
||||
|
||||
def __init__(self, catalog, bpy_module=None):
|
||||
def __init__(self, catalog, bpy_module = None):
|
||||
self.Catalog = catalog
|
||||
self.bpy = bpy_module
|
||||
|
||||
|
||||
def WriteToHTML(self, handle):
|
||||
|
||||
|
||||
dna_html_template = """
|
||||
<!DOCTYPE html PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN http://www.w3.org/TR/html4/loose.dtd>
|
||||
<html>
|
||||
@@ -105,10 +105,10 @@ class DNACatalogHTML:
|
||||
${structs_content}
|
||||
</body>
|
||||
</html>"""
|
||||
|
||||
|
||||
header = self.Catalog.Header
|
||||
bpy = self.bpy
|
||||
|
||||
|
||||
# ${version} and ${revision}
|
||||
if bpy:
|
||||
version = '.'.join(map(str, bpy.app.version))
|
||||
@@ -116,7 +116,7 @@ class DNACatalogHTML:
|
||||
else:
|
||||
version = str(header.Version)
|
||||
revision = 'Unknown'
|
||||
|
||||
|
||||
# ${bitness}
|
||||
if header.PointerSize == 8:
|
||||
bitness = '64 bit'
|
||||
@@ -125,10 +125,10 @@ class DNACatalogHTML:
|
||||
|
||||
# ${endianness}
|
||||
if header.LittleEndianness:
|
||||
endianess = 'Little endianness'
|
||||
endianess= 'Little endianness'
|
||||
else:
|
||||
endianess = 'Big endianness'
|
||||
|
||||
endianess= 'Big endianness'
|
||||
|
||||
# ${structs_list}
|
||||
log.debug("Creating structs index")
|
||||
structs_list = ''
|
||||
@@ -136,7 +136,7 @@ class DNACatalogHTML:
|
||||
structureIndex = 0
|
||||
for structure in self.Catalog.Structs:
|
||||
structs_list += list_item.format(structureIndex, structure.Type.Name)
|
||||
structureIndex += 1
|
||||
structureIndex+=1
|
||||
|
||||
# ${structs_content}
|
||||
log.debug("Creating structs content")
|
||||
@@ -144,20 +144,20 @@ class DNACatalogHTML:
|
||||
for structure in self.Catalog.Structs:
|
||||
log.debug(structure.Type.Name)
|
||||
structs_content += self.Structure(structure)
|
||||
|
||||
|
||||
d = dict(
|
||||
version=version,
|
||||
revision=revision,
|
||||
bitness=bitness,
|
||||
endianness=endianess,
|
||||
structs_list=structs_list,
|
||||
structs_content=structs_content
|
||||
version = version,
|
||||
revision = revision,
|
||||
bitness = bitness,
|
||||
endianness = endianess,
|
||||
structs_list = structs_list,
|
||||
structs_content = structs_content
|
||||
)
|
||||
|
||||
dna_html = Template(dna_html_template).substitute(d)
|
||||
dna_html = self.format(dna_html)
|
||||
handle.write(dna_html)
|
||||
|
||||
|
||||
def Structure(self, structure):
|
||||
struct_table_template = """
|
||||
<table><a name="${struct_name}"></a>
|
||||
@@ -178,23 +178,23 @@ class DNACatalogHTML:
|
||||
</table>
|
||||
<label>Total size: ${size} bytes</label><br/>
|
||||
<label>(<a href="#top">top</a>)</label><br/>"""
|
||||
|
||||
|
||||
d = dict(
|
||||
struct_name=structure.Type.Name,
|
||||
fields=self.StructureFields(structure, None, 0),
|
||||
size=str(structure.Type.Size)
|
||||
struct_name = structure.Type.Name,
|
||||
fields = self.StructureFields(structure, None, 0),
|
||||
size = str(structure.Type.Size)
|
||||
)
|
||||
|
||||
|
||||
struct_table = Template(struct_table_template).substitute(d)
|
||||
return struct_table
|
||||
|
||||
|
||||
def StructureFields(self, structure, parentReference, offset):
|
||||
fields = ''
|
||||
for field in structure.Fields:
|
||||
fields += self.StructureField(field, structure, parentReference, offset)
|
||||
offset += field.Size(self.Catalog.Header)
|
||||
return fields
|
||||
|
||||
|
||||
def StructureField(self, field, structure, parentReference, offset):
|
||||
structure_field_template = """
|
||||
<tr>
|
||||
@@ -205,7 +205,7 @@ class DNACatalogHTML:
|
||||
<td>${offset}</td>
|
||||
<td>${size}</td>
|
||||
</tr>"""
|
||||
|
||||
|
||||
if field.Type.Structure is None or field.Name.IsPointer():
|
||||
|
||||
# ${reference}
|
||||
@@ -216,37 +216,37 @@ class DNACatalogHTML:
|
||||
struct = '<a href="#{0}">{0}</a>'.format(structure.Type.Name)
|
||||
else:
|
||||
struct = structure.Type.Name
|
||||
|
||||
|
||||
# ${type}
|
||||
type = field.Type.Name
|
||||
|
||||
|
||||
# ${name}
|
||||
name = field.Name.Name
|
||||
|
||||
|
||||
# ${offset}
|
||||
# offset already set
|
||||
|
||||
|
||||
# ${size}
|
||||
size = field.Size(self.Catalog.Header)
|
||||
|
||||
|
||||
d = dict(
|
||||
reference=reference,
|
||||
struct=struct,
|
||||
type=type,
|
||||
name=name,
|
||||
offset=offset,
|
||||
size=size
|
||||
reference = reference,
|
||||
struct = struct,
|
||||
type = type,
|
||||
name = name,
|
||||
offset = offset,
|
||||
size = size
|
||||
)
|
||||
|
||||
|
||||
structure_field = Template(structure_field_template).substitute(d)
|
||||
|
||||
|
||||
elif field.Type.Structure is not None:
|
||||
reference = field.Name.AsReference(parentReference)
|
||||
structure_field = self.StructureFields(field.Type.Structure, reference, offset)
|
||||
structure_field = self.StructureFields(field.Type.Structure, reference, offset)
|
||||
|
||||
return structure_field
|
||||
|
||||
def indent(self, input, dent, startswith=''):
|
||||
def indent(self, input, dent, startswith = ''):
|
||||
output = ''
|
||||
if dent < 0:
|
||||
for line in input.split('\n'):
|
||||
@@ -257,19 +257,19 @@ class DNACatalogHTML:
|
||||
output += line.lstrip() + '\n' # remove indentation completely
|
||||
elif dent > 0:
|
||||
for line in input.split('\n'):
|
||||
output += ' ' * dent + line + '\n'
|
||||
output += ' '* dent + line + '\n'
|
||||
return output
|
||||
|
||||
|
||||
def format(self, input):
|
||||
diff = {
|
||||
'\n<!DOCTYPE': '<!DOCTYPE',
|
||||
'\n</ul>': '</ul>',
|
||||
'<a name': '\n<a name',
|
||||
'<tr>\n': '<tr>',
|
||||
'<tr>': ' <tr>',
|
||||
'</th>\n': '</th>',
|
||||
'</td>\n': '</td>',
|
||||
'<tbody>\n': '<tbody>'
|
||||
'\n<!DOCTYPE':'<!DOCTYPE',
|
||||
'\n</ul>' :'</ul>',
|
||||
'<a name' :'\n<a name',
|
||||
'<tr>\n' :'<tr>',
|
||||
'<tr>' :' <tr>',
|
||||
'</th>\n' :'</th>',
|
||||
'</td>\n' :'</td>',
|
||||
'<tbody>\n' :'<tbody>'
|
||||
}
|
||||
output = self.indent(input, 0)
|
||||
for key, value in diff.items():
|
||||
@@ -283,17 +283,17 @@ class DNACatalogHTML:
|
||||
'''
|
||||
css = """
|
||||
@CHARSET "ISO-8859-1";
|
||||
|
||||
|
||||
body {
|
||||
font-family: verdana;
|
||||
font-size: small;
|
||||
}
|
||||
|
||||
|
||||
div.title {
|
||||
font-size: large;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
|
||||
h1 {
|
||||
page-break-before: always;
|
||||
}
|
||||
@@ -304,7 +304,7 @@ class DNACatalogHTML:
|
||||
margin-right: 3%;
|
||||
padding-left: 40px;
|
||||
}
|
||||
|
||||
|
||||
h1:hover{
|
||||
background-color: #EBEBEB;
|
||||
}
|
||||
@@ -312,7 +312,7 @@ class DNACatalogHTML:
|
||||
h3 {
|
||||
padding-left: 40px;
|
||||
}
|
||||
|
||||
|
||||
table {
|
||||
border-width: 1px;
|
||||
border-style: solid;
|
||||
@@ -321,21 +321,21 @@ class DNACatalogHTML:
|
||||
width: 94%;
|
||||
margin: 20px 3% 10px;
|
||||
}
|
||||
|
||||
|
||||
caption {
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
|
||||
|
||||
th {
|
||||
background-color: #000000;
|
||||
color:#ffffff;
|
||||
padding-left:5px;
|
||||
padding-right:5px;
|
||||
}
|
||||
|
||||
|
||||
tr {
|
||||
}
|
||||
|
||||
|
||||
td {
|
||||
border-width: 1px;
|
||||
border-style: solid;
|
||||
@@ -343,12 +343,12 @@ class DNACatalogHTML:
|
||||
padding-left:5px;
|
||||
padding-right:5px;
|
||||
}
|
||||
|
||||
|
||||
label {
|
||||
float:right;
|
||||
margin-right: 3%;
|
||||
}
|
||||
|
||||
|
||||
ul.multicolumn {
|
||||
list-style:none;
|
||||
float:left;
|
||||
@@ -361,18 +361,18 @@ class DNACatalogHTML:
|
||||
width:200px;
|
||||
margin-right:0px;
|
||||
}
|
||||
|
||||
|
||||
a {
|
||||
color:#a000a0;
|
||||
text-decoration:none;
|
||||
}
|
||||
|
||||
|
||||
a:hover {
|
||||
color:#a000a0;
|
||||
text-decoration:underline;
|
||||
}
|
||||
"""
|
||||
|
||||
|
||||
css = self.indent(css, 0)
|
||||
|
||||
handle.write(css)
|
||||
@@ -389,13 +389,13 @@ def usage():
|
||||
print("\tdefault: % blender2.5 --background -noaudio --python BlendFileDnaExporter_25.py")
|
||||
print("\twith options: % blender2.5 --background -noaudio --python BlendFileDnaExporter_25.py -- --dna-keep-blend --dna-debug\n")
|
||||
|
||||
|
||||
|
||||
######################################################
|
||||
# Main
|
||||
######################################################
|
||||
|
||||
def main():
|
||||
|
||||
|
||||
import os, os.path
|
||||
|
||||
try:
|
||||
@@ -408,37 +408,37 @@ def main():
|
||||
else:
|
||||
filename = 'dna'
|
||||
dir = os.path.dirname(__file__)
|
||||
Path_Blend = os.path.join(dir, filename + '.blend') # temporary blend file
|
||||
Path_HTML = os.path.join(dir, filename + '.html') # output html file
|
||||
Path_CSS = os.path.join(dir, 'dna.css') # output css file
|
||||
Path_Blend = os.path.join(dir, filename + '.blend') # temporary blend file
|
||||
Path_HTML = os.path.join(dir, filename + '.html') # output html file
|
||||
Path_CSS = os.path.join(dir, 'dna.css') # output css file
|
||||
|
||||
# create a blend file for dna parsing
|
||||
if not os.path.exists(Path_Blend):
|
||||
log.info("1: write temp blend file with SDNA info")
|
||||
log.info(" saving to: " + Path_Blend)
|
||||
try:
|
||||
bpy.ops.wm.save_as_mainfile(filepath=Path_Blend, copy=True, compress=False)
|
||||
bpy.ops.wm.save_as_mainfile(filepath = Path_Blend, copy = True, compress = False)
|
||||
except:
|
||||
log.error("Filename {0} does not exist and can't be created... quitting".format(Path_Blend))
|
||||
return
|
||||
else:
|
||||
log.info("1: found blend file with SDNA info")
|
||||
log.info(" " + Path_Blend)
|
||||
|
||||
|
||||
# read blend header from blend file
|
||||
log.info("2: read file:")
|
||||
|
||||
|
||||
if not dir in sys.path:
|
||||
sys.path.append(dir)
|
||||
import BlendFileReader
|
||||
|
||||
|
||||
handle = BlendFileReader.openBlendFile(Path_Blend)
|
||||
blendfile = BlendFileReader.BlendFile(handle)
|
||||
catalog = DNACatalogHTML(blendfile.Catalog, bpy)
|
||||
|
||||
# close temp file
|
||||
handle.close()
|
||||
|
||||
|
||||
# deleting or not?
|
||||
if '--dna-keep-blend' in sys.argv:
|
||||
# keep the blend, useful for studying hexdumps
|
||||
@@ -449,7 +449,7 @@ def main():
|
||||
log.info("5: close and delete temp blend:")
|
||||
log.info(" {0}".format(Path_Blend))
|
||||
os.remove(Path_Blend)
|
||||
|
||||
|
||||
# export dna to xhtml
|
||||
log.info("6: export sdna to xhtml file: %r" % Path_HTML)
|
||||
handleHTML = open(Path_HTML, "w")
|
||||
@@ -466,12 +466,12 @@ def main():
|
||||
if not bpy.app.background:
|
||||
log.info("7: quit blender")
|
||||
bpy.ops.wm.exit_blender()
|
||||
|
||||
|
||||
except ImportError:
|
||||
log.warning(" skipping, not running in Blender")
|
||||
usage()
|
||||
sys.exit(2)
|
||||
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
@@ -7,7 +7,7 @@
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
@@ -34,7 +34,6 @@ log = logging.getLogger("BlendFileReader")
|
||||
# module global routines
|
||||
######################################################
|
||||
|
||||
|
||||
def ReadString(handle, length):
|
||||
'''
|
||||
ReadString reads a String of given length or a zero terminating String
|
||||
@@ -46,7 +45,7 @@ def ReadString(handle, length):
|
||||
# length == 0 means we want a zero terminating string
|
||||
result = ""
|
||||
s = ReadString(handle, 1)
|
||||
while s != "\0":
|
||||
while s!="\0":
|
||||
result += s
|
||||
s = ReadString(handle, 1)
|
||||
return result
|
||||
@@ -58,7 +57,7 @@ def Read(type, handle, fileheader):
|
||||
'''
|
||||
def unpacked_bytes(type_char, size):
|
||||
return struct.unpack(fileheader.StructPre + type_char, handle.read(size))[0]
|
||||
|
||||
|
||||
if type == 'ushort':
|
||||
return unpacked_bytes("H", 2) # unsigned short
|
||||
elif type == 'short':
|
||||
@@ -95,10 +94,10 @@ def openBlendFile(filename):
|
||||
log.debug("decompressing started")
|
||||
fs = gzip.open(filename, "rb")
|
||||
handle = tempfile.TemporaryFile()
|
||||
data = fs.read(1024 * 1024)
|
||||
while data:
|
||||
handle.write(data)
|
||||
data = fs.read(1024 * 1024)
|
||||
data = fs.read(1024*1024)
|
||||
while data:
|
||||
handle.write(data)
|
||||
data = fs.read(1024*1024)
|
||||
log.debug("decompressing finished")
|
||||
fs.close()
|
||||
log.debug("resetting decompressed file")
|
||||
@@ -113,7 +112,7 @@ def Align(handle):
|
||||
offset = handle.tell()
|
||||
trim = offset % 4
|
||||
if trim != 0:
|
||||
handle.seek(4 - trim, os.SEEK_CUR)
|
||||
handle.seek(4-trim, os.SEEK_CUR)
|
||||
|
||||
|
||||
######################################################
|
||||
@@ -122,14 +121,14 @@ def Align(handle):
|
||||
|
||||
class BlendFile:
|
||||
'''
|
||||
Reads a blendfile and store the header, all the fileblocks, and catalogue
|
||||
Reads a blendfile and store the header, all the fileblocks, and catalogue
|
||||
structs foound in the DNA fileblock
|
||||
|
||||
|
||||
- BlendFile.Header (BlendFileHeader instance)
|
||||
- BlendFile.Blocks (list of BlendFileBlock instances)
|
||||
- BlendFile.Catalog (DNACatalog instance)
|
||||
'''
|
||||
|
||||
|
||||
def __init__(self, handle):
|
||||
log.debug("initializing reading blend-file")
|
||||
self.Header = BlendFileHeader(handle)
|
||||
@@ -142,13 +141,13 @@ class BlendFile:
|
||||
found_dna_block = True
|
||||
else:
|
||||
fileblock.Header.skip(handle)
|
||||
|
||||
|
||||
self.Blocks.append(fileblock)
|
||||
fileblock = BlendFileBlock(handle, self)
|
||||
|
||||
|
||||
# appending last fileblock, "ENDB"
|
||||
self.Blocks.append(fileblock)
|
||||
|
||||
|
||||
# seems unused?
|
||||
"""
|
||||
def FindBlendFileBlocksWithCode(self, code):
|
||||
@@ -165,27 +164,27 @@ class BlendFileHeader:
|
||||
BlendFileHeader allocates the first 12 bytes of a blend file.
|
||||
It contains information about the hardware architecture.
|
||||
Header example: BLENDER_v254
|
||||
|
||||
|
||||
BlendFileHeader.Magic (str)
|
||||
BlendFileHeader.PointerSize (int)
|
||||
BlendFileHeader.LittleEndianness (bool)
|
||||
BlendFileHeader.StructPre (str) see http://docs.python.org/py3k/library/struct.html#byte-order-size-and-alignment
|
||||
BlendFileHeader.Version (int)
|
||||
'''
|
||||
|
||||
|
||||
def __init__(self, handle):
|
||||
log.debug("reading blend-file-header")
|
||||
|
||||
|
||||
self.Magic = ReadString(handle, 7)
|
||||
log.debug(self.Magic)
|
||||
|
||||
|
||||
pointersize = ReadString(handle, 1)
|
||||
log.debug(pointersize)
|
||||
if pointersize == "-":
|
||||
self.PointerSize = 8
|
||||
if pointersize == "_":
|
||||
self.PointerSize = 4
|
||||
|
||||
|
||||
endianness = ReadString(handle, 1)
|
||||
log.debug(endianness)
|
||||
if endianness == "v":
|
||||
@@ -194,11 +193,11 @@ class BlendFileHeader:
|
||||
if endianness == "V":
|
||||
self.LittleEndianness = False
|
||||
self.StructPre = ">"
|
||||
|
||||
|
||||
version = ReadString(handle, 3)
|
||||
log.debug(version)
|
||||
self.Version = int(version)
|
||||
|
||||
|
||||
log.debug("{0} {1} {2} {3}".format(self.Magic, self.PointerSize, self.LittleEndianness, version))
|
||||
|
||||
|
||||
@@ -207,11 +206,11 @@ class BlendFileBlock:
|
||||
BlendFileBlock.File (BlendFile)
|
||||
BlendFileBlock.Header (FileBlockHeader)
|
||||
'''
|
||||
|
||||
|
||||
def __init__(self, handle, blendfile):
|
||||
self.File = blendfile
|
||||
self.Header = FileBlockHeader(handle, blendfile.Header)
|
||||
|
||||
|
||||
def Get(self, handle, path):
|
||||
log.debug("find dna structure")
|
||||
dnaIndex = self.Header.SDNAIndex
|
||||
@@ -233,7 +232,7 @@ class FileBlockHeader:
|
||||
Count (int)
|
||||
FileOffset (= file pointer of datablock)
|
||||
'''
|
||||
|
||||
|
||||
def __init__(self, handle, fileheader):
|
||||
self.Code = ReadString(handle, 4).strip()
|
||||
if self.Code != "ENDB":
|
||||
@@ -258,28 +257,28 @@ class FileBlockHeader:
|
||||
class DNACatalog:
|
||||
'''
|
||||
DNACatalog is a catalog of all information in the DNA1 file-block
|
||||
|
||||
|
||||
Header = None
|
||||
Names = None
|
||||
Types = None
|
||||
Structs = None
|
||||
'''
|
||||
|
||||
|
||||
def __init__(self, fileheader, handle):
|
||||
log.debug("building DNA catalog")
|
||||
self.Names = []
|
||||
self.Types = []
|
||||
self.Structs = []
|
||||
self.Names=[]
|
||||
self.Types=[]
|
||||
self.Structs=[]
|
||||
self.Header = fileheader
|
||||
|
||||
|
||||
SDNA = ReadString(handle, 4)
|
||||
|
||||
|
||||
# names
|
||||
NAME = ReadString(handle, 4)
|
||||
numberOfNames = Read('uint', handle, fileheader)
|
||||
log.debug("building #{0} names".format(numberOfNames))
|
||||
for i in range(numberOfNames):
|
||||
name = ReadString(handle, 0)
|
||||
name = ReadString(handle,0)
|
||||
self.Names.append(DNAName(name))
|
||||
Align(handle)
|
||||
|
||||
@@ -288,7 +287,7 @@ class DNACatalog:
|
||||
numberOfTypes = Read('uint', handle, fileheader)
|
||||
log.debug("building #{0} types".format(numberOfTypes))
|
||||
for i in range(numberOfTypes):
|
||||
type = ReadString(handle, 0)
|
||||
type = ReadString(handle,0)
|
||||
self.Types.append(DNAType(type))
|
||||
Align(handle)
|
||||
|
||||
@@ -322,24 +321,24 @@ class DNACatalog:
|
||||
class DNAName:
|
||||
'''
|
||||
DNAName is a C-type name stored in the DNA.
|
||||
|
||||
|
||||
Name = str
|
||||
'''
|
||||
|
||||
|
||||
def __init__(self, name):
|
||||
self.Name = name
|
||||
|
||||
|
||||
def AsReference(self, parent):
|
||||
if parent is None:
|
||||
result = ""
|
||||
else:
|
||||
result = parent + "."
|
||||
|
||||
result = parent+"."
|
||||
|
||||
result = result + self.ShortName()
|
||||
return result
|
||||
|
||||
def ShortName(self):
|
||||
result = self.Name
|
||||
result = self.Name;
|
||||
result = result.replace("*", "")
|
||||
result = result.replace("(", "")
|
||||
result = result.replace(")", "")
|
||||
@@ -347,12 +346,12 @@ class DNAName:
|
||||
if Index != -1:
|
||||
result = result[0:Index]
|
||||
return result
|
||||
|
||||
|
||||
def IsPointer(self):
|
||||
return self.Name.find("*") > -1
|
||||
return self.Name.find("*")>-1
|
||||
|
||||
def IsMethodPointer(self):
|
||||
return self.Name.find("(*") > -1
|
||||
return self.Name.find("(*")>-1
|
||||
|
||||
def ArraySize(self):
|
||||
result = 1
|
||||
@@ -361,10 +360,10 @@ class DNAName:
|
||||
|
||||
while Index != -1:
|
||||
Index2 = Temp.find("]")
|
||||
result *= int(Temp[Index + 1:Index2])
|
||||
Temp = Temp[Index2 + 1:]
|
||||
result*=int(Temp[Index+1:Index2])
|
||||
Temp = Temp[Index2+1:]
|
||||
Index = Temp.find("[")
|
||||
|
||||
|
||||
return result
|
||||
|
||||
|
||||
@@ -376,46 +375,46 @@ class DNAType:
|
||||
Size = int
|
||||
Structure = DNAStructure
|
||||
'''
|
||||
|
||||
|
||||
def __init__(self, aName):
|
||||
self.Name = aName
|
||||
self.Structure = None
|
||||
self.Structure=None
|
||||
|
||||
|
||||
class DNAStructure:
|
||||
'''
|
||||
DNAType is a C-type structure stored in the DNA
|
||||
|
||||
|
||||
Type = DNAType
|
||||
Fields = [DNAField]
|
||||
'''
|
||||
|
||||
|
||||
def __init__(self, aType):
|
||||
self.Type = aType
|
||||
self.Type.Structure = self
|
||||
self.Fields = []
|
||||
|
||||
self.Fields=[]
|
||||
|
||||
def GetField(self, header, handle, path):
|
||||
splitted = path.partition(".")
|
||||
name = splitted[0]
|
||||
rest = splitted[2]
|
||||
offset = 0
|
||||
offset = 0;
|
||||
for field in self.Fields:
|
||||
if field.Name.ShortName() == name:
|
||||
log.debug("found " + name + "@" + str(offset))
|
||||
log.debug("found "+name+"@"+str(offset))
|
||||
handle.seek(offset, os.SEEK_CUR)
|
||||
return field.DecodeField(header, handle, rest)
|
||||
else:
|
||||
offset += field.Size(header)
|
||||
|
||||
log.debug("error did not find " + path)
|
||||
log.debug("error did not find "+path)
|
||||
return None
|
||||
|
||||
|
||||
class DNAField:
|
||||
'''
|
||||
DNAField is a coupled DNAType and DNAName.
|
||||
|
||||
|
||||
Type = DNAType
|
||||
Name = DNAName
|
||||
'''
|
||||
@@ -423,24 +422,25 @@ class DNAField:
|
||||
def __init__(self, aType, aName):
|
||||
self.Type = aType
|
||||
self.Name = aName
|
||||
|
||||
|
||||
def Size(self, header):
|
||||
if self.Name.IsPointer() or self.Name.IsMethodPointer():
|
||||
return header.PointerSize * self.Name.ArraySize()
|
||||
return header.PointerSize*self.Name.ArraySize()
|
||||
else:
|
||||
return self.Type.Size * self.Name.ArraySize()
|
||||
return self.Type.Size*self.Name.ArraySize()
|
||||
|
||||
def DecodeField(self, header, handle, path):
|
||||
if path == "":
|
||||
if self.Name.IsPointer():
|
||||
return Read('pointer', handle, header)
|
||||
if self.Type.Name == "int":
|
||||
if self.Type.Name=="int":
|
||||
return Read('int', handle, header)
|
||||
if self.Type.Name == "short":
|
||||
if self.Type.Name=="short":
|
||||
return Read('short', handle, header)
|
||||
if self.Type.Name == "float":
|
||||
if self.Type.Name=="float":
|
||||
return Read('float', handle, header)
|
||||
if self.Type.Name == "char":
|
||||
if self.Type.Name=="char":
|
||||
return ReadString(handle, self.Name.ArraySize())
|
||||
else:
|
||||
return self.Type.Structure.GetField(header, handle, path)
|
||||
|
||||
|
@@ -42,7 +42,6 @@ def man_format(data):
|
||||
data = data.replace("\t", " ")
|
||||
return data
|
||||
|
||||
|
||||
if len(sys.argv) != 3:
|
||||
import getopt
|
||||
raise getopt.GetoptError("Usage: %s <path-to-blender> <output-filename>" % sys.argv[0])
|
||||
|
@@ -15,7 +15,6 @@ font_info = {
|
||||
"handler": None,
|
||||
}
|
||||
|
||||
|
||||
def init():
|
||||
"""init function - runs once"""
|
||||
import os
|
||||
|
@@ -10,22 +10,22 @@ bm = bmesh.new()
|
||||
|
||||
# Add a circle XXX, should return all geometry created, not just verts.
|
||||
bmesh.ops.create_circle(
|
||||
bm,
|
||||
cap_ends=False,
|
||||
radius=0.2,
|
||||
segments=8)
|
||||
bm,
|
||||
cap_ends=False,
|
||||
radius=0.2,
|
||||
segments=8)
|
||||
|
||||
|
||||
# Spin and deal with geometry on side 'a'
|
||||
edges_start_a = bm.edges[:]
|
||||
geom_start_a = bm.verts[:] + edges_start_a
|
||||
ret = bmesh.ops.spin(
|
||||
bm,
|
||||
geom=geom_start_a,
|
||||
angle=math.radians(180.0),
|
||||
steps=8,
|
||||
axis=(1.0, 0.0, 0.0),
|
||||
cent=(0.0, 1.0, 0.0))
|
||||
bm,
|
||||
geom=geom_start_a,
|
||||
angle=math.radians(180.0),
|
||||
steps=8,
|
||||
axis=(1.0, 0.0, 0.0),
|
||||
cent=(0.0, 1.0, 0.0))
|
||||
edges_end_a = [ele for ele in ret["geom_last"]
|
||||
if isinstance(ele, bmesh.types.BMEdge)]
|
||||
del ret
|
||||
@@ -33,8 +33,8 @@ del ret
|
||||
|
||||
# Extrude and create geometry on side 'b'
|
||||
ret = bmesh.ops.extrude_edge_only(
|
||||
bm,
|
||||
edges=edges_start_a)
|
||||
bm,
|
||||
edges=edges_start_a)
|
||||
geom_extrude_mid = ret["geom"]
|
||||
del ret
|
||||
|
||||
@@ -45,19 +45,19 @@ verts_extrude_b = [ele for ele in geom_extrude_mid
|
||||
edges_extrude_b = [ele for ele in geom_extrude_mid
|
||||
if isinstance(ele, bmesh.types.BMEdge) and ele.is_boundary]
|
||||
bmesh.ops.translate(
|
||||
bm,
|
||||
verts=verts_extrude_b,
|
||||
vec=(0.0, 0.0, 1.0))
|
||||
bm,
|
||||
verts=verts_extrude_b,
|
||||
vec=(0.0, 0.0, 1.0))
|
||||
|
||||
|
||||
# Create the circle on side 'b'
|
||||
ret = bmesh.ops.spin(
|
||||
bm,
|
||||
geom=verts_extrude_b + edges_extrude_b,
|
||||
angle=-math.radians(180.0),
|
||||
steps=8,
|
||||
axis=(1.0, 0.0, 0.0),
|
||||
cent=(0.0, 1.0, 1.0))
|
||||
bm,
|
||||
geom=verts_extrude_b + edges_extrude_b,
|
||||
angle=-math.radians(180.0),
|
||||
steps=8,
|
||||
axis=(1.0, 0.0, 0.0),
|
||||
cent=(0.0, 1.0, 1.0))
|
||||
edges_end_b = [ele for ele in ret["geom_last"]
|
||||
if isinstance(ele, bmesh.types.BMEdge)]
|
||||
del ret
|
||||
@@ -65,30 +65,30 @@ del ret
|
||||
|
||||
# Bridge the resulting edge loops of both spins 'a & b'
|
||||
bmesh.ops.bridge_loops(
|
||||
bm,
|
||||
edges=edges_end_a + edges_end_b)
|
||||
bm,
|
||||
edges=edges_end_a + edges_end_b)
|
||||
|
||||
|
||||
# Now we have made a links of the chain, make a copy and rotate it
|
||||
# (so this looks something like a chain)
|
||||
|
||||
ret = bmesh.ops.duplicate(
|
||||
bm,
|
||||
geom=bm.verts[:] + bm.edges[:] + bm.faces[:])
|
||||
bm,
|
||||
geom=bm.verts[:] + bm.edges[:] + bm.faces[:])
|
||||
geom_dupe = ret["geom"]
|
||||
verts_dupe = [ele for ele in geom_dupe if isinstance(ele, bmesh.types.BMVert)]
|
||||
del ret
|
||||
|
||||
# position the new link
|
||||
bmesh.ops.translate(
|
||||
bm,
|
||||
verts=verts_dupe,
|
||||
vec=(0.0, 0.0, 2.0))
|
||||
bm,
|
||||
verts=verts_dupe,
|
||||
vec=(0.0, 0.0, 2.0))
|
||||
bmesh.ops.rotate(
|
||||
bm,
|
||||
verts=verts_dupe,
|
||||
cent=(0.0, 1.0, 0.0),
|
||||
matrix=mathutils.Matrix.Rotation(math.radians(90.0), 3, 'Z'))
|
||||
bm,
|
||||
verts=verts_dupe,
|
||||
cent=(0.0, 1.0, 0.0),
|
||||
matrix=mathutils.Matrix.Rotation(math.radians(90.0), 3, 'Z'))
|
||||
|
||||
# Done with creating the mesh, simply link it into the scene so we can see it
|
||||
|
||||
|
@@ -17,5 +17,4 @@ from bpy.app.handlers import persistent
|
||||
def load_handler(dummy):
|
||||
print("Load Handler:", bpy.data.filepath)
|
||||
|
||||
|
||||
bpy.app.handlers.load_post.append(load_handler)
|
||||
|
@@ -11,5 +11,4 @@ import bpy
|
||||
def my_handler(scene):
|
||||
print("Frame Change", scene.frame_current)
|
||||
|
||||
|
||||
bpy.app.handlers.frame_change_pre.append(my_handler)
|
||||
|
@@ -54,19 +54,19 @@ translations_tuple = (
|
||||
"Copyright (C) 2013 The Blender Foundation.",
|
||||
"This file is distributed under the same license as the Blender package.",
|
||||
"FIRST AUTHOR <EMAIL@ADDRESS>, YEAR."))),
|
||||
),
|
||||
),
|
||||
(("Operator", "Render: Copy Settings"),
|
||||
(("bpy.types.SCENE_OT_render_copy_settings",),
|
||||
()),
|
||||
("fr_FR", "Rendu : copier réglages",
|
||||
(False, ())),
|
||||
),
|
||||
),
|
||||
(("*", "Copy render settings from current scene to others"),
|
||||
(("bpy.types.SCENE_OT_render_copy_settings",),
|
||||
()),
|
||||
("fr_FR", "Copier les réglages de rendu depuis la scène courante vers d’autres",
|
||||
(False, ())),
|
||||
),
|
||||
),
|
||||
# ... etc, all messages from your addon.
|
||||
)
|
||||
|
||||
@@ -81,7 +81,6 @@ for msg in translations_tuple:
|
||||
|
||||
# Define remaining addon (operators, UI...) here.
|
||||
|
||||
|
||||
def register():
|
||||
# Usual operator/UI/etc. registration...
|
||||
|
||||
|
@@ -14,7 +14,6 @@ class MaterialSettings(bpy.types.PropertyGroup):
|
||||
my_float = bpy.props.FloatProperty()
|
||||
my_string = bpy.props.StringProperty()
|
||||
|
||||
|
||||
bpy.utils.register_class(MaterialSettings)
|
||||
|
||||
bpy.types.Material.my_settings = \
|
||||
|
@@ -14,7 +14,6 @@ class SceneSettingItem(bpy.types.PropertyGroup):
|
||||
name = bpy.props.StringProperty(name="Test Prop", default="Unknown")
|
||||
value = bpy.props.IntProperty(name="Test Prop", default=22)
|
||||
|
||||
|
||||
bpy.utils.register_class(SceneSettingItem)
|
||||
|
||||
bpy.types.Scene.my_settings = \
|
||||
|
@@ -14,7 +14,6 @@ import bpy
|
||||
def update_func(self, context):
|
||||
print("my test function", self)
|
||||
|
||||
|
||||
bpy.types.Scene.testprop = bpy.props.FloatProperty(update=update_func)
|
||||
|
||||
bpy.context.scene.testprop = 11.0
|
||||
|
@@ -19,7 +19,6 @@ def get_float(self):
|
||||
def set_float(self, value):
|
||||
self["testprop"] = value
|
||||
|
||||
|
||||
bpy.types.Scene.test_float = bpy.props.FloatProperty(get=get_float, set=set_float)
|
||||
|
||||
|
||||
@@ -28,7 +27,6 @@ def get_date(self):
|
||||
import datetime
|
||||
return str(datetime.datetime.now())
|
||||
|
||||
|
||||
bpy.types.Scene.test_date = bpy.props.StringProperty(get=get_date)
|
||||
|
||||
|
||||
@@ -42,7 +40,6 @@ def get_array(self):
|
||||
def set_array(self, values):
|
||||
self["somebool"] = values[0] and values[1]
|
||||
|
||||
|
||||
bpy.types.Scene.test_array = bpy.props.BoolVectorProperty(size=2, get=get_array, set=set_array)
|
||||
|
||||
|
||||
@@ -53,7 +50,7 @@ test_items = [
|
||||
("GREEN", "Green", "", 2),
|
||||
("BLUE", "Blue", "", 3),
|
||||
("YELLOW", "Yellow", "", 4),
|
||||
]
|
||||
]
|
||||
|
||||
|
||||
def get_enum(self):
|
||||
@@ -64,7 +61,6 @@ def get_enum(self):
|
||||
def set_enum(self, value):
|
||||
print("setting value", value)
|
||||
|
||||
|
||||
bpy.types.Scene.test_enum = bpy.props.EnumProperty(items=test_items, get=get_enum, set=set_enum)
|
||||
|
||||
|
||||
|
@@ -9,7 +9,7 @@ bl_info = {
|
||||
"wiki_url": "",
|
||||
"tracker_url": "",
|
||||
"category": "Object",
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
import bpy
|
||||
@@ -23,17 +23,17 @@ class ExampleAddonPreferences(AddonPreferences):
|
||||
bl_idname = __name__
|
||||
|
||||
filepath = StringProperty(
|
||||
name="Example File Path",
|
||||
subtype='FILE_PATH',
|
||||
)
|
||||
name="Example File Path",
|
||||
subtype='FILE_PATH',
|
||||
)
|
||||
number = IntProperty(
|
||||
name="Example Number",
|
||||
default=4,
|
||||
)
|
||||
name="Example Number",
|
||||
default=4,
|
||||
)
|
||||
boolean = BoolProperty(
|
||||
name="Example Boolean",
|
||||
default=False,
|
||||
)
|
||||
name="Example Boolean",
|
||||
default=False,
|
||||
)
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
@@ -14,5 +14,4 @@ import bpy
|
||||
def menu_draw(self, context):
|
||||
self.layout.operator("wm.save_homefile")
|
||||
|
||||
|
||||
bpy.types.INFO_MT_file.append(menu_draw)
|
||||
|
@@ -32,7 +32,7 @@ class AddPresetObjectDraw(AddPresetBase, Operator):
|
||||
# variable used for all preset values
|
||||
preset_defines = [
|
||||
"obj = bpy.context.object"
|
||||
]
|
||||
]
|
||||
|
||||
# properties to store in the preset
|
||||
preset_values = [
|
||||
@@ -42,7 +42,7 @@ class AddPresetObjectDraw(AddPresetBase, Operator):
|
||||
"obj.show_name",
|
||||
"obj.show_axis",
|
||||
"obj.show_wire",
|
||||
]
|
||||
]
|
||||
|
||||
# where to store the preset
|
||||
preset_subdir = "object/draw"
|
||||
@@ -61,7 +61,7 @@ def panel_func(self, context):
|
||||
classes = (
|
||||
OBJECT_MT_draw_presets,
|
||||
AddPresetObjectDraw,
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
def register():
|
||||
|
@@ -60,7 +60,6 @@ def menu_func(self, context):
|
||||
layout.separator()
|
||||
layout.operator(WM_OT_button_context_test.bl_idname)
|
||||
|
||||
|
||||
classes = (
|
||||
WM_OT_button_context_test,
|
||||
WM_MT_button_context,
|
||||
@@ -78,6 +77,5 @@ def unregister():
|
||||
bpy.utils.unregister_class(cls)
|
||||
bpy.types.WM_MT_button_context.remove(menu_func)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
register()
|
||||
|
@@ -21,5 +21,4 @@ class CyclesNodeTree(bpy.types.NodeTree):
|
||||
def poll(cls, context):
|
||||
return context.scene.render.engine == 'CYCLES'
|
||||
|
||||
|
||||
bpy.utils.register_class(CyclesNodeTree)
|
||||
|
@@ -42,7 +42,6 @@ class SimpleMouseOperator(bpy.types.Operator):
|
||||
self.y = event.mouse_y
|
||||
return self.execute(context)
|
||||
|
||||
|
||||
bpy.utils.register_class(SimpleMouseOperator)
|
||||
|
||||
# Test call to the newly defined operator.
|
||||
|
@@ -42,7 +42,6 @@ def menu_func(self, context):
|
||||
self.layout.operator_context = 'INVOKE_DEFAULT'
|
||||
self.layout.operator(ExportSomeData.bl_idname, text="Text Export Operator")
|
||||
|
||||
|
||||
# Register and add to the file selector
|
||||
bpy.utils.register_class(ExportSomeData)
|
||||
bpy.types.INFO_MT_file_export.append(menu_func)
|
||||
|
@@ -41,7 +41,6 @@ class CustomDrawOperator(bpy.types.Operator):
|
||||
|
||||
col.prop(self, "my_string")
|
||||
|
||||
|
||||
bpy.utils.register_class(CustomDrawOperator)
|
||||
|
||||
# test call
|
||||
|
@@ -22,7 +22,6 @@ class HelloWorldOperator(bpy.types.Operator):
|
||||
print("Hello World")
|
||||
return {'FINISHED'}
|
||||
|
||||
|
||||
bpy.utils.register_class(HelloWorldOperator)
|
||||
|
||||
# test call to the newly defined operator
|
||||
|
@@ -31,7 +31,6 @@ class MyPropertyGroup(bpy.types.PropertyGroup):
|
||||
custom_1 = bpy.props.FloatProperty(name="My Float")
|
||||
custom_2 = bpy.props.IntProperty(name="My Int")
|
||||
|
||||
|
||||
bpy.utils.register_class(MyPropertyGroup)
|
||||
|
||||
bpy.types.Object.my_prop_grp = bpy.props.PointerProperty(type=MyPropertyGroup)
|
||||
|
@@ -10,5 +10,4 @@ import bpy
|
||||
def draw(self, context):
|
||||
self.layout.label("Hello World")
|
||||
|
||||
|
||||
bpy.context.window_manager.popup_menu(draw, title="Greeting", icon='INFO')
|
||||
|
@@ -12,7 +12,6 @@ from bpy.props import PointerProperty
|
||||
class MyPropGroup(bpy.types.PropertyGroup):
|
||||
nested = bpy.props.FloatProperty(name="Nested", default=0.0)
|
||||
|
||||
|
||||
# register it so its available for all bones
|
||||
bpy.utils.register_class(MyPropGroup)
|
||||
bpy.types.Bone.my_prop = PointerProperty(type=MyPropGroup,
|
||||
|
@@ -23,9 +23,9 @@ class OffScreenDraw(bpy.types.Operator):
|
||||
@staticmethod
|
||||
def handle_add(self, context):
|
||||
OffScreenDraw._handle_draw = bpy.types.SpaceView3D.draw_handler_add(
|
||||
self.draw_callback_px, (self, context),
|
||||
'WINDOW', 'POST_PIXEL',
|
||||
)
|
||||
self.draw_callback_px, (self, context),
|
||||
'WINDOW', 'POST_PIXEL',
|
||||
)
|
||||
|
||||
@staticmethod
|
||||
def handle_remove():
|
||||
@@ -58,20 +58,20 @@ class OffScreenDraw(bpy.types.Operator):
|
||||
|
||||
modelview_matrix = camera.matrix_world.inverted()
|
||||
projection_matrix = camera.calc_matrix_camera(
|
||||
render.resolution_x,
|
||||
render.resolution_y,
|
||||
render.pixel_aspect_x,
|
||||
render.pixel_aspect_y,
|
||||
)
|
||||
render.resolution_x,
|
||||
render.resolution_y,
|
||||
render.pixel_aspect_x,
|
||||
render.pixel_aspect_y,
|
||||
)
|
||||
|
||||
offscreen.draw_view3d(
|
||||
scene,
|
||||
render_layer,
|
||||
context.space_data,
|
||||
context.region,
|
||||
projection_matrix,
|
||||
modelview_matrix,
|
||||
)
|
||||
scene,
|
||||
render_layer,
|
||||
context.space_data,
|
||||
context.region,
|
||||
projection_matrix,
|
||||
modelview_matrix,
|
||||
)
|
||||
|
||||
@staticmethod
|
||||
def _opengl_draw(context, texture, aspect_ratio, scale):
|
||||
|
@@ -73,8 +73,6 @@ def rna_info_BuildRNAInfo_cache():
|
||||
if rna_info_BuildRNAInfo_cache.ret is None:
|
||||
rna_info_BuildRNAInfo_cache.ret = rna_info.BuildRNAInfo()
|
||||
return rna_info_BuildRNAInfo_cache.ret
|
||||
|
||||
|
||||
rna_info_BuildRNAInfo_cache.ret = None
|
||||
# --- end rna_info cache
|
||||
|
||||
@@ -436,7 +434,7 @@ else:
|
||||
BLENDER_VERSION_DOTS = ".".join(blender_version_strings)
|
||||
if BLENDER_REVISION != "Unknown":
|
||||
# '2.62a SHA1' (release) or '2.62.1 SHA1' (non-release)
|
||||
BLENDER_VERSION_DOTS += " " + BLENDER_REVISION
|
||||
BLENDER_VERSION_DOTS += " " + BLENDER_REVISION
|
||||
|
||||
if is_release:
|
||||
# '2_62a_release'
|
||||
@@ -518,8 +516,6 @@ def escape_rst(text):
|
||||
""" Escape plain text which may contain characters used by RST.
|
||||
"""
|
||||
return text.translate(escape_rst.trans)
|
||||
|
||||
|
||||
escape_rst.trans = str.maketrans({
|
||||
"`": "\\`",
|
||||
"|": "\\|",
|
||||
@@ -1022,7 +1018,6 @@ def pymodule2sphinx(basepath, module_name, module, title):
|
||||
|
||||
file.close()
|
||||
|
||||
|
||||
# Changes in Blender will force errors here
|
||||
context_type_map = {
|
||||
"active_base": ("ObjectBase", False),
|
||||
|
@@ -21,7 +21,7 @@
|
||||
# <pep8 compliant>
|
||||
|
||||
bpy_types_Operator_bl_property__doc__ = (
|
||||
"""
|
||||
"""
|
||||
The name of a property to use as this operators primary property.
|
||||
Currently this is only used to select the default property when
|
||||
expanding an operator into a menu.
|
||||
|
@@ -29,7 +29,7 @@ You'll need to specify your user login and password, obviously.
|
||||
|
||||
Example usage:
|
||||
|
||||
./sphinx_doc_update.py --mirror ../../../docs/remote_api_backup/ --source ../.. --blender ../../../build_cmake/bin/blender --user foobar --password barfoo
|
||||
./sphinx_doc_update.py --mirror ../../../docs/remote_api_backup/ --source ../.. --blender ../../../build_cmake/bin/blender --user foobar --password barfoo
|
||||
|
||||
"""
|
||||
|
||||
@@ -107,16 +107,14 @@ def main():
|
||||
|
||||
with tempfile.TemporaryDirectory() as tmp_dir:
|
||||
# II) Generate doc source in temp dir.
|
||||
doc_gen_cmd = (
|
||||
args.blender, "--background", "-noaudio", "--factory-startup", "--python-exit-code", "1",
|
||||
"--python", "%s/doc/python_api/sphinx_doc_gen.py" % args.source_dir, "--",
|
||||
"--output", tmp_dir
|
||||
)
|
||||
doc_gen_cmd = (args.blender, "--background", "-noaudio", "--factory-startup", "--python-exit-code", "1",
|
||||
"--python", "%s/doc/python_api/sphinx_doc_gen.py" % args.source_dir, "--",
|
||||
"--output", tmp_dir)
|
||||
subprocess.run(doc_gen_cmd)
|
||||
|
||||
# III) Get Blender version info.
|
||||
getver_file = os.path.join(tmp_dir, "blendver.txt")
|
||||
getver_script = (
|
||||
getver_script = (""
|
||||
"import sys, bpy\n"
|
||||
"with open(sys.argv[-1], 'w') as f:\n"
|
||||
" is_release = bpy.app.version_cycle in {'rc', 'release'}\n"
|
||||
@@ -126,8 +124,7 @@ def main():
|
||||
" f.write('%d.%d%s\\n' % (bpy.app.version[0], bpy.app.version[1], bpy.app.version_char)\n"
|
||||
" if is_release else '%s\\n' % branch)\n"
|
||||
" f.write('%d_%d%s_release' % (bpy.app.version[0], bpy.app.version[1], bpy.app.version_char)\n"
|
||||
" if is_release else '%d_%d_%d' % bpy.app.version)\n"
|
||||
)
|
||||
" if is_release else '%d_%d_%d' % bpy.app.version)\n")
|
||||
get_ver_cmd = (args.blender, "--background", "-noaudio", "--factory-startup", "--python-exit-code", "1",
|
||||
"--python-expr", getver_script, "--", getver_file)
|
||||
subprocess.run(get_ver_cmd)
|
||||
|
6
extern/audaspace/CMakeLists.txt
vendored
6
extern/audaspace/CMakeLists.txt
vendored
@@ -88,7 +88,7 @@ set(SRC
|
||||
src/fx/Volume.cpp
|
||||
src/fx/VolumeReader.cpp
|
||||
src/fx/VolumeSound.cpp
|
||||
src/fx/VolumeStorage.cpp
|
||||
src/fx/VolumeStorage.cpp
|
||||
src/generator/Sawtooth.cpp
|
||||
src/generator/SawtoothReader.cpp
|
||||
src/generator/Silence.cpp
|
||||
@@ -729,8 +729,8 @@ set(LIB_DESTINATION "lib${LIB_SUFFIX}")
|
||||
# library
|
||||
|
||||
add_library(audaspace ${LIBRARY_TYPE} ${SRC} ${HDR})
|
||||
target_link_libraries(audaspace ${LIBRARIES})
|
||||
set_target_properties(audaspace PROPERTIES SOVERSION ${AUDASPACE_VERSION})
|
||||
target_link_libraries(audaspace ${LIBRARIES})
|
||||
set_target_properties(audaspace PROPERTIES SOVERSION ${AUDASPACE_VERSION})
|
||||
|
||||
if(AUDASPACE_STANDALONE)
|
||||
install(TARGETS audaspace
|
||||
|
2
extern/audaspace/plugins/ffmpeg/FFMPEG.cpp
vendored
2
extern/audaspace/plugins/ffmpeg/FFMPEG.cpp
vendored
@@ -23,9 +23,7 @@ AUD_NAMESPACE_BEGIN
|
||||
|
||||
FFMPEG::FFMPEG()
|
||||
{
|
||||
#if LIBAVCODEC_VERSION_MAJOR < 58
|
||||
av_register_all();
|
||||
#endif
|
||||
}
|
||||
|
||||
void FFMPEG::registerPlugin()
|
||||
|
124
extern/audaspace/plugins/ffmpeg/FFMPEGReader.cpp
vendored
124
extern/audaspace/plugins/ffmpeg/FFMPEGReader.cpp
vendored
@@ -22,37 +22,37 @@
|
||||
extern "C" {
|
||||
#include <libavcodec/avcodec.h>
|
||||
#include <libavformat/avio.h>
|
||||
#include <libavutil/avutil.h>
|
||||
}
|
||||
|
||||
AUD_NAMESPACE_BEGIN
|
||||
|
||||
#if LIBAVCODEC_VERSION_MAJOR < 58
|
||||
#define FFMPEG_OLD_CODE
|
||||
#endif
|
||||
|
||||
int FFMPEGReader::decode(AVPacket& packet, Buffer& buffer)
|
||||
{
|
||||
int buf_size = buffer.getSize();
|
||||
int buf_pos = 0;
|
||||
|
||||
#ifdef FFMPEG_OLD_CODE
|
||||
AVFrame* frame = nullptr;
|
||||
int got_frame;
|
||||
int read_length;
|
||||
uint8_t* orig_data = packet.data;
|
||||
int orig_size = packet.size;
|
||||
|
||||
int buf_size = buffer.getSize();
|
||||
int buf_pos = 0;
|
||||
|
||||
while(packet.size > 0)
|
||||
{
|
||||
got_frame = 0;
|
||||
|
||||
read_length = avcodec_decode_audio4(m_codecCtx, m_frame, &got_frame, &packet);
|
||||
if(!frame)
|
||||
frame = av_frame_alloc();
|
||||
else
|
||||
av_frame_unref(frame);
|
||||
|
||||
read_length = avcodec_decode_audio4(m_codecCtx, frame, &got_frame, &packet);
|
||||
if(read_length < 0)
|
||||
break;
|
||||
|
||||
if(got_frame)
|
||||
{
|
||||
int data_size = av_samples_get_buffer_size(nullptr, m_codecCtx->channels, m_frame->nb_samples, m_codecCtx->sample_fmt, 1);
|
||||
int data_size = av_samples_get_buffer_size(nullptr, m_codecCtx->channels, frame->nb_samples, m_codecCtx->sample_fmt, 1);
|
||||
|
||||
if(buf_size - buf_pos < data_size)
|
||||
{
|
||||
@@ -62,18 +62,18 @@ int FFMPEGReader::decode(AVPacket& packet, Buffer& buffer)
|
||||
|
||||
if(m_tointerleave)
|
||||
{
|
||||
int single_size = data_size / m_codecCtx->channels / m_frame->nb_samples;
|
||||
int single_size = data_size / m_codecCtx->channels / frame->nb_samples;
|
||||
for(int channel = 0; channel < m_codecCtx->channels; channel++)
|
||||
{
|
||||
for(int i = 0; i < m_frame->nb_samples; i++)
|
||||
for(int i = 0; i < frame->nb_samples; i++)
|
||||
{
|
||||
std::memcpy(((data_t*)buffer.getBuffer()) + buf_pos + ((m_codecCtx->channels * i) + channel) * single_size,
|
||||
m_frame->data[channel] + i * single_size, single_size);
|
||||
frame->data[channel] + i * single_size, single_size);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
std::memcpy(((data_t*)buffer.getBuffer()) + buf_pos, m_frame->data[0], data_size);
|
||||
std::memcpy(((data_t*)buffer.getBuffer()) + buf_pos, frame->data[0], data_size);
|
||||
|
||||
buf_pos += data_size;
|
||||
}
|
||||
@@ -83,42 +83,7 @@ int FFMPEGReader::decode(AVPacket& packet, Buffer& buffer)
|
||||
|
||||
packet.data = orig_data;
|
||||
packet.size = orig_size;
|
||||
#else
|
||||
avcodec_send_packet(m_codecCtx, &packet);
|
||||
|
||||
while(true)
|
||||
{
|
||||
auto ret = avcodec_receive_frame(m_codecCtx, m_frame);
|
||||
|
||||
if(ret != 0)
|
||||
break;
|
||||
|
||||
int data_size = av_samples_get_buffer_size(nullptr, m_codecCtx->channels, m_frame->nb_samples, m_codecCtx->sample_fmt, 1);
|
||||
|
||||
if(buf_size - buf_pos < data_size)
|
||||
{
|
||||
buffer.resize(buf_size + data_size, true);
|
||||
buf_size += data_size;
|
||||
}
|
||||
|
||||
if(m_tointerleave)
|
||||
{
|
||||
int single_size = data_size / m_codecCtx->channels / m_frame->nb_samples;
|
||||
for(int channel = 0; channel < m_codecCtx->channels; channel++)
|
||||
{
|
||||
for(int i = 0; i < m_frame->nb_samples; i++)
|
||||
{
|
||||
std::memcpy(((data_t*)buffer.getBuffer()) + buf_pos + ((m_codecCtx->channels * i) + channel) * single_size,
|
||||
m_frame->data[channel] + i * single_size, single_size);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
std::memcpy(((data_t*)buffer.getBuffer()) + buf_pos, m_frame->data[0], data_size);
|
||||
|
||||
buf_pos += data_size;
|
||||
}
|
||||
#endif
|
||||
av_free(frame);
|
||||
|
||||
return buf_pos;
|
||||
}
|
||||
@@ -136,11 +101,7 @@ void FFMPEGReader::init()
|
||||
|
||||
for(unsigned int i = 0; i < m_formatCtx->nb_streams; i++)
|
||||
{
|
||||
#ifdef FFMPEG_OLD_CODE
|
||||
if((m_formatCtx->streams[i]->codec->codec_type == AVMEDIA_TYPE_AUDIO)
|
||||
#else
|
||||
if((m_formatCtx->streams[i]->codecpar->codec_type == AVMEDIA_TYPE_AUDIO)
|
||||
#endif
|
||||
&& (m_stream < 0))
|
||||
{
|
||||
m_stream=i;
|
||||
@@ -151,34 +112,12 @@ void FFMPEGReader::init()
|
||||
if(m_stream == -1)
|
||||
AUD_THROW(FileException, "File couldn't be read, no audio stream found by ffmpeg.");
|
||||
|
||||
// get a decoder and open it
|
||||
#ifndef FFMPEG_OLD_CODE
|
||||
AVCodec* aCodec = avcodec_find_decoder(m_formatCtx->streams[m_stream]->codecpar->codec_id);
|
||||
|
||||
if(!aCodec)
|
||||
AUD_THROW(FileException, "File couldn't be read, no decoder found with ffmpeg.");
|
||||
#endif
|
||||
|
||||
m_frame = av_frame_alloc();
|
||||
|
||||
if(!m_frame)
|
||||
AUD_THROW(FileException, "File couldn't be read, ffmpeg frame couldn't be allocated.");
|
||||
|
||||
#ifdef FFMPEG_OLD_CODE
|
||||
m_codecCtx = m_formatCtx->streams[m_stream]->codec;
|
||||
|
||||
// get a decoder and open it
|
||||
AVCodec* aCodec = avcodec_find_decoder(m_codecCtx->codec_id);
|
||||
#else
|
||||
m_codecCtx = avcodec_alloc_context3(aCodec);
|
||||
#endif
|
||||
|
||||
if(!m_codecCtx)
|
||||
AUD_THROW(FileException, "File couldn't be read, ffmpeg context couldn't be allocated.");
|
||||
|
||||
#ifndef FFMPEG_OLD_CODE
|
||||
if(avcodec_parameters_to_context(m_codecCtx, m_formatCtx->streams[m_stream]->codecpar) < 0)
|
||||
AUD_THROW(FileException, "File couldn't be read, ffmpeg decoder parameters couldn't be copied to decoder context.");
|
||||
#endif
|
||||
if(!aCodec)
|
||||
AUD_THROW(FileException, "File couldn't be read, no decoder found with ffmpeg.");
|
||||
|
||||
if(avcodec_open2(m_codecCtx, aCodec, nullptr) < 0)
|
||||
AUD_THROW(FileException, "File couldn't be read, ffmpeg codec couldn't be opened.");
|
||||
@@ -218,8 +157,6 @@ void FFMPEGReader::init()
|
||||
FFMPEGReader::FFMPEGReader(std::string filename) :
|
||||
m_pkgbuf(),
|
||||
m_formatCtx(nullptr),
|
||||
m_codecCtx(nullptr),
|
||||
m_frame(nullptr),
|
||||
m_aviocontext(nullptr),
|
||||
m_membuf(nullptr)
|
||||
{
|
||||
@@ -240,14 +177,12 @@ FFMPEGReader::FFMPEGReader(std::string filename) :
|
||||
|
||||
FFMPEGReader::FFMPEGReader(std::shared_ptr<Buffer> buffer) :
|
||||
m_pkgbuf(),
|
||||
m_codecCtx(nullptr),
|
||||
m_frame(nullptr),
|
||||
m_membuffer(buffer),
|
||||
m_membufferpos(0)
|
||||
{
|
||||
m_membuf = reinterpret_cast<data_t*>(av_malloc(AV_INPUT_BUFFER_MIN_SIZE + AV_INPUT_BUFFER_PADDING_SIZE));
|
||||
m_membuf = reinterpret_cast<data_t*>(av_malloc(FF_MIN_BUFFER_SIZE + FF_INPUT_BUFFER_PADDING_SIZE));
|
||||
|
||||
m_aviocontext = avio_alloc_context(m_membuf, AV_INPUT_BUFFER_MIN_SIZE, 0, this, read_packet, nullptr, seek_packet);
|
||||
m_aviocontext = avio_alloc_context(m_membuf, FF_MIN_BUFFER_SIZE, 0, this, read_packet, nullptr, seek_packet);
|
||||
|
||||
if(!m_aviocontext)
|
||||
{
|
||||
@@ -277,14 +212,7 @@ FFMPEGReader::FFMPEGReader(std::shared_ptr<Buffer> buffer) :
|
||||
|
||||
FFMPEGReader::~FFMPEGReader()
|
||||
{
|
||||
if(m_frame)
|
||||
av_frame_free(&m_frame);
|
||||
#ifdef FFMPEG_OLD_CODE
|
||||
avcodec_close(m_codecCtx);
|
||||
#else
|
||||
if(m_codecCtx)
|
||||
avcodec_free_context(&m_codecCtx);
|
||||
#endif
|
||||
avformat_close_input(&m_formatCtx);
|
||||
}
|
||||
|
||||
@@ -384,7 +312,7 @@ void FFMPEGReader::seek(int position)
|
||||
}
|
||||
}
|
||||
}
|
||||
av_packet_unref(&packet);
|
||||
av_free_packet(&packet);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -415,7 +343,7 @@ Specs FFMPEGReader::getSpecs() const
|
||||
void FFMPEGReader::read(int& length, bool& eos, sample_t* buffer)
|
||||
{
|
||||
// read packages and decode them
|
||||
AVPacket packet = {};
|
||||
AVPacket packet;
|
||||
int data_size = 0;
|
||||
int pkgbuf_pos;
|
||||
int left = length;
|
||||
@@ -431,7 +359,7 @@ void FFMPEGReader::read(int& length, bool& eos, sample_t* buffer)
|
||||
data_size = std::min(pkgbuf_pos, left * sample_size);
|
||||
m_convert((data_t*) buf, (data_t*) m_pkgbuf.getBuffer(), data_size / AUD_FORMAT_SIZE(m_specs.format));
|
||||
buf += data_size / AUD_FORMAT_SIZE(m_specs.format);
|
||||
left -= data_size / sample_size;
|
||||
left -= data_size/sample_size;
|
||||
}
|
||||
|
||||
// for each frame read as long as there isn't enough data already
|
||||
@@ -447,9 +375,9 @@ void FFMPEGReader::read(int& length, bool& eos, sample_t* buffer)
|
||||
data_size = std::min(pkgbuf_pos, left * sample_size);
|
||||
m_convert((data_t*) buf, (data_t*) m_pkgbuf.getBuffer(), data_size / AUD_FORMAT_SIZE(m_specs.format));
|
||||
buf += data_size / AUD_FORMAT_SIZE(m_specs.format);
|
||||
left -= data_size / sample_size;
|
||||
left -= data_size/sample_size;
|
||||
}
|
||||
av_packet_unref(&packet);
|
||||
av_free_packet(&packet);
|
||||
}
|
||||
// read more data than necessary?
|
||||
if(pkgbuf_pos > data_size)
|
||||
|
@@ -79,11 +79,6 @@ private:
|
||||
*/
|
||||
AVCodecContext* m_codecCtx;
|
||||
|
||||
/**
|
||||
* The AVFrame structure for using ffmpeg.
|
||||
*/
|
||||
AVFrame* m_frame;
|
||||
|
||||
/**
|
||||
* The AVIOContext to read the data from.
|
||||
*/
|
||||
|
216
extern/audaspace/plugins/ffmpeg/FFMPEGWriter.cpp
vendored
216
extern/audaspace/plugins/ffmpeg/FFMPEGWriter.cpp
vendored
@@ -27,10 +27,6 @@ extern "C" {
|
||||
|
||||
AUD_NAMESPACE_BEGIN
|
||||
|
||||
#if LIBAVCODEC_VERSION_MAJOR < 58
|
||||
#define FFMPEG_OLD_CODE
|
||||
#endif
|
||||
|
||||
void FFMPEGWriter::encode()
|
||||
{
|
||||
sample_t* data = m_input_buffer.getBuffer();
|
||||
@@ -62,106 +58,82 @@ void FFMPEGWriter::encode()
|
||||
if(m_input_size)
|
||||
m_convert(reinterpret_cast<data_t*>(data), reinterpret_cast<data_t*>(data), m_input_samples * m_specs.channels);
|
||||
|
||||
#ifdef FFMPEG_OLD_CODE
|
||||
m_packet->data = nullptr;
|
||||
m_packet->size = 0;
|
||||
AVPacket packet;
|
||||
|
||||
av_init_packet(m_packet);
|
||||
packet.data = nullptr;
|
||||
packet.size = 0;
|
||||
|
||||
av_frame_unref(m_frame);
|
||||
av_init_packet(&packet);
|
||||
|
||||
AVFrame* frame = av_frame_alloc();
|
||||
av_frame_unref(frame);
|
||||
int got_packet;
|
||||
#endif
|
||||
|
||||
m_frame->nb_samples = m_input_samples;
|
||||
m_frame->format = m_codecCtx->sample_fmt;
|
||||
m_frame->channel_layout = m_codecCtx->channel_layout;
|
||||
frame->nb_samples = m_input_samples;
|
||||
frame->format = m_codecCtx->sample_fmt;
|
||||
frame->channel_layout = m_codecCtx->channel_layout;
|
||||
|
||||
if(avcodec_fill_audio_frame(m_frame, m_specs.channels, m_codecCtx->sample_fmt, reinterpret_cast<data_t*>(data), m_input_buffer.getSize(), 0) < 0)
|
||||
if(avcodec_fill_audio_frame(frame, m_specs.channels, m_codecCtx->sample_fmt, reinterpret_cast<data_t*>(data), m_input_buffer.getSize(), 0) < 0)
|
||||
AUD_THROW(FileException, "File couldn't be written, filling the audio frame failed with ffmpeg.");
|
||||
|
||||
AVRational sample_time = { 1, static_cast<int>(m_specs.rate) };
|
||||
m_frame->pts = av_rescale_q(m_position - m_input_samples, m_codecCtx->time_base, sample_time);
|
||||
frame->pts = av_rescale_q(m_position - m_input_samples, m_codecCtx->time_base, sample_time);
|
||||
|
||||
#ifdef FFMPEG_OLD_CODE
|
||||
if(avcodec_encode_audio2(m_codecCtx, m_packet, m_frame, &got_packet))
|
||||
if(avcodec_encode_audio2(m_codecCtx, &packet, frame, &got_packet))
|
||||
{
|
||||
av_frame_free(&frame);
|
||||
AUD_THROW(FileException, "File couldn't be written, audio encoding failed with ffmpeg.");
|
||||
}
|
||||
|
||||
if(got_packet)
|
||||
{
|
||||
m_packet->flags |= AV_PKT_FLAG_KEY;
|
||||
m_packet->stream_index = m_stream->index;
|
||||
if(av_write_frame(m_formatCtx, m_packet) < 0)
|
||||
packet.flags |= AV_PKT_FLAG_KEY;
|
||||
packet.stream_index = m_stream->index;
|
||||
if(av_write_frame(m_formatCtx, &packet) < 0)
|
||||
{
|
||||
av_free_packet(m_packet);
|
||||
av_free_packet(&packet);
|
||||
av_frame_free(&frame);
|
||||
AUD_THROW(FileException, "Frame couldn't be writen to the file with ffmpeg.");
|
||||
}
|
||||
av_free_packet(m_packet);
|
||||
av_free_packet(&packet);
|
||||
}
|
||||
#else
|
||||
if(avcodec_send_frame(m_codecCtx, m_frame) < 0)
|
||||
AUD_THROW(FileException, "File couldn't be written, audio encoding failed with ffmpeg.");
|
||||
|
||||
while(avcodec_receive_packet(m_codecCtx, m_packet) == 0)
|
||||
{
|
||||
m_packet->stream_index = m_stream->index;
|
||||
|
||||
if(av_write_frame(m_formatCtx, m_packet) < 0)
|
||||
AUD_THROW(FileException, "Frame couldn't be writen to the file with ffmpeg.");
|
||||
}
|
||||
#endif
|
||||
av_frame_free(&frame);
|
||||
}
|
||||
|
||||
void FFMPEGWriter::close()
|
||||
{
|
||||
#ifdef FFMPEG_OLD_CODE
|
||||
int got_packet = true;
|
||||
|
||||
while(got_packet)
|
||||
{
|
||||
m_packet->data = nullptr;
|
||||
m_packet->size = 0;
|
||||
AVPacket packet;
|
||||
|
||||
av_init_packet(m_packet);
|
||||
packet.data = nullptr;
|
||||
packet.size = 0;
|
||||
|
||||
if(avcodec_encode_audio2(m_codecCtx, m_packet, nullptr, &got_packet))
|
||||
av_init_packet(&packet);
|
||||
|
||||
if(avcodec_encode_audio2(m_codecCtx, &packet, nullptr, &got_packet))
|
||||
AUD_THROW(FileException, "File end couldn't be written, audio encoding failed with ffmpeg.");
|
||||
|
||||
if(got_packet)
|
||||
{
|
||||
m_packet->flags |= AV_PKT_FLAG_KEY;
|
||||
m_packet->stream_index = m_stream->index;
|
||||
if(av_write_frame(m_formatCtx, m_packet))
|
||||
packet.flags |= AV_PKT_FLAG_KEY;
|
||||
packet.stream_index = m_stream->index;
|
||||
if(av_write_frame(m_formatCtx, &packet))
|
||||
{
|
||||
av_free_packet(m_packet);
|
||||
av_free_packet(&packet);
|
||||
AUD_THROW(FileException, "Final frames couldn't be writen to the file with ffmpeg.");
|
||||
}
|
||||
av_free_packet(m_packet);
|
||||
av_free_packet(&packet);
|
||||
}
|
||||
}
|
||||
#else
|
||||
if(avcodec_send_frame(m_codecCtx, nullptr) < 0)
|
||||
AUD_THROW(FileException, "File couldn't be written, audio encoding failed with ffmpeg.");
|
||||
|
||||
while(avcodec_receive_packet(m_codecCtx, m_packet) == 0)
|
||||
{
|
||||
m_packet->stream_index = m_stream->index;
|
||||
|
||||
if(av_write_frame(m_formatCtx, m_packet) < 0)
|
||||
AUD_THROW(FileException, "Frame couldn't be writen to the file with ffmpeg.");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
FFMPEGWriter::FFMPEGWriter(std::string filename, DeviceSpecs specs, Container format, Codec codec, unsigned int bitrate) :
|
||||
m_position(0),
|
||||
m_specs(specs),
|
||||
m_formatCtx(nullptr),
|
||||
m_codecCtx(nullptr),
|
||||
m_stream(nullptr),
|
||||
m_packet(nullptr),
|
||||
m_frame(nullptr),
|
||||
m_input_samples(0),
|
||||
m_deinterleave(false)
|
||||
{
|
||||
@@ -170,105 +142,75 @@ FFMPEGWriter::FFMPEGWriter(std::string filename, DeviceSpecs specs, Container fo
|
||||
if(avformat_alloc_output_context2(&m_formatCtx, nullptr, formats[format], filename.c_str()) < 0)
|
||||
AUD_THROW(FileException, "File couldn't be written, format couldn't be found with ffmpeg.");
|
||||
|
||||
AVOutputFormat* outputFmt = m_formatCtx->oformat;
|
||||
m_outputFmt = m_formatCtx->oformat;
|
||||
|
||||
if(!outputFmt) {
|
||||
if(!m_outputFmt) {
|
||||
avformat_free_context(m_formatCtx);
|
||||
AUD_THROW(FileException, "File couldn't be written, output format couldn't be found with ffmpeg.");
|
||||
}
|
||||
|
||||
outputFmt->audio_codec = AV_CODEC_ID_NONE;
|
||||
m_outputFmt->audio_codec = AV_CODEC_ID_NONE;
|
||||
|
||||
switch(codec)
|
||||
{
|
||||
case CODEC_AAC:
|
||||
outputFmt->audio_codec = AV_CODEC_ID_AAC;
|
||||
m_outputFmt->audio_codec = AV_CODEC_ID_AAC;
|
||||
break;
|
||||
case CODEC_AC3:
|
||||
outputFmt->audio_codec = AV_CODEC_ID_AC3;
|
||||
m_outputFmt->audio_codec = AV_CODEC_ID_AC3;
|
||||
break;
|
||||
case CODEC_FLAC:
|
||||
outputFmt->audio_codec = AV_CODEC_ID_FLAC;
|
||||
m_outputFmt->audio_codec = AV_CODEC_ID_FLAC;
|
||||
break;
|
||||
case CODEC_MP2:
|
||||
outputFmt->audio_codec = AV_CODEC_ID_MP2;
|
||||
m_outputFmt->audio_codec = AV_CODEC_ID_MP2;
|
||||
break;
|
||||
case CODEC_MP3:
|
||||
outputFmt->audio_codec = AV_CODEC_ID_MP3;
|
||||
m_outputFmt->audio_codec = AV_CODEC_ID_MP3;
|
||||
break;
|
||||
case CODEC_OPUS:
|
||||
outputFmt->audio_codec = AV_CODEC_ID_OPUS;
|
||||
m_outputFmt->audio_codec = AV_CODEC_ID_OPUS;
|
||||
break;
|
||||
case CODEC_PCM:
|
||||
switch(specs.format)
|
||||
{
|
||||
case FORMAT_U8:
|
||||
outputFmt->audio_codec = AV_CODEC_ID_PCM_U8;
|
||||
m_outputFmt->audio_codec = AV_CODEC_ID_PCM_U8;
|
||||
break;
|
||||
case FORMAT_S16:
|
||||
outputFmt->audio_codec = AV_CODEC_ID_PCM_S16LE;
|
||||
m_outputFmt->audio_codec = AV_CODEC_ID_PCM_S16LE;
|
||||
break;
|
||||
case FORMAT_S24:
|
||||
outputFmt->audio_codec = AV_CODEC_ID_PCM_S24LE;
|
||||
m_outputFmt->audio_codec = AV_CODEC_ID_PCM_S24LE;
|
||||
break;
|
||||
case FORMAT_S32:
|
||||
outputFmt->audio_codec = AV_CODEC_ID_PCM_S32LE;
|
||||
m_outputFmt->audio_codec = AV_CODEC_ID_PCM_S32LE;
|
||||
break;
|
||||
case FORMAT_FLOAT32:
|
||||
outputFmt->audio_codec = AV_CODEC_ID_PCM_F32LE;
|
||||
m_outputFmt->audio_codec = AV_CODEC_ID_PCM_F32LE;
|
||||
break;
|
||||
case FORMAT_FLOAT64:
|
||||
outputFmt->audio_codec = AV_CODEC_ID_PCM_F64LE;
|
||||
m_outputFmt->audio_codec = AV_CODEC_ID_PCM_F64LE;
|
||||
break;
|
||||
default:
|
||||
outputFmt->audio_codec = AV_CODEC_ID_NONE;
|
||||
m_outputFmt->audio_codec = AV_CODEC_ID_NONE;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case CODEC_VORBIS:
|
||||
outputFmt->audio_codec = AV_CODEC_ID_VORBIS;
|
||||
m_outputFmt->audio_codec = AV_CODEC_ID_VORBIS;
|
||||
break;
|
||||
default:
|
||||
outputFmt->audio_codec = AV_CODEC_ID_NONE;
|
||||
break;
|
||||
}
|
||||
|
||||
uint64_t channel_layout = 0;
|
||||
|
||||
switch(m_specs.channels)
|
||||
{
|
||||
case CHANNELS_MONO:
|
||||
channel_layout = AV_CH_LAYOUT_MONO;
|
||||
break;
|
||||
case CHANNELS_STEREO:
|
||||
channel_layout = AV_CH_LAYOUT_STEREO;
|
||||
break;
|
||||
case CHANNELS_STEREO_LFE:
|
||||
channel_layout = AV_CH_LAYOUT_2POINT1;
|
||||
break;
|
||||
case CHANNELS_SURROUND4:
|
||||
channel_layout = AV_CH_LAYOUT_QUAD;
|
||||
break;
|
||||
case CHANNELS_SURROUND5:
|
||||
channel_layout = AV_CH_LAYOUT_5POINT0_BACK;
|
||||
break;
|
||||
case CHANNELS_SURROUND51:
|
||||
channel_layout = AV_CH_LAYOUT_5POINT1_BACK;
|
||||
break;
|
||||
case CHANNELS_SURROUND61:
|
||||
channel_layout = AV_CH_LAYOUT_6POINT1_BACK;
|
||||
break;
|
||||
case CHANNELS_SURROUND71:
|
||||
channel_layout = AV_CH_LAYOUT_7POINT1;
|
||||
m_outputFmt->audio_codec = AV_CODEC_ID_NONE;
|
||||
break;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
if(outputFmt->audio_codec == AV_CODEC_ID_NONE)
|
||||
if(m_outputFmt->audio_codec == AV_CODEC_ID_NONE)
|
||||
AUD_THROW(FileException, "File couldn't be written, audio codec not found with ffmpeg.");
|
||||
|
||||
AVCodec* codec = avcodec_find_encoder(outputFmt->audio_codec);
|
||||
AVCodec* codec = avcodec_find_encoder(m_outputFmt->audio_codec);
|
||||
if(!codec)
|
||||
AUD_THROW(FileException, "File couldn't be written, audio encoder couldn't be found with ffmpeg.");
|
||||
|
||||
@@ -278,14 +220,7 @@ FFMPEGWriter::FFMPEGWriter(std::string filename, DeviceSpecs specs, Container fo
|
||||
|
||||
m_stream->id = m_formatCtx->nb_streams - 1;
|
||||
|
||||
#ifdef FFMPEG_OLD_CODE
|
||||
m_codecCtx = m_stream->codec;
|
||||
#else
|
||||
m_codecCtx = avcodec_alloc_context3(codec);
|
||||
#endif
|
||||
|
||||
if(!m_codecCtx)
|
||||
AUD_THROW(FileException, "File couldn't be written, context creation failed with ffmpeg.");
|
||||
|
||||
switch(m_specs.format)
|
||||
{
|
||||
@@ -312,7 +247,7 @@ FFMPEGWriter::FFMPEGWriter(std::string filename, DeviceSpecs specs, Container fo
|
||||
}
|
||||
|
||||
if(m_formatCtx->oformat->flags & AVFMT_GLOBALHEADER)
|
||||
m_codecCtx->flags |= AV_CODEC_FLAG_GLOBAL_HEADER;
|
||||
m_codecCtx->flags |= CODEC_FLAG_GLOBAL_HEADER;
|
||||
|
||||
bool format_supported = false;
|
||||
|
||||
@@ -393,13 +328,9 @@ FFMPEGWriter::FFMPEGWriter(std::string filename, DeviceSpecs specs, Container fo
|
||||
|
||||
m_specs.rate = m_codecCtx->sample_rate;
|
||||
|
||||
#ifdef FFMPEG_OLD_CODE
|
||||
m_codecCtx->codec_id = outputFmt->audio_codec;
|
||||
#endif
|
||||
|
||||
m_codecCtx->codec_id = m_outputFmt->audio_codec;
|
||||
m_codecCtx->codec_type = AVMEDIA_TYPE_AUDIO;
|
||||
m_codecCtx->bit_rate = bitrate;
|
||||
m_codecCtx->channel_layout = channel_layout;
|
||||
m_codecCtx->channels = m_specs.channels;
|
||||
m_stream->time_base.num = m_codecCtx->time_base.num = 1;
|
||||
m_stream->time_base.den = m_codecCtx->time_base.den = m_codecCtx->sample_rate;
|
||||
@@ -407,11 +338,6 @@ FFMPEGWriter::FFMPEGWriter(std::string filename, DeviceSpecs specs, Container fo
|
||||
if(avcodec_open2(m_codecCtx, codec, nullptr) < 0)
|
||||
AUD_THROW(FileException, "File couldn't be written, encoder couldn't be opened with ffmpeg.");
|
||||
|
||||
#ifndef FFMPEG_OLD_CODE
|
||||
if(avcodec_parameters_from_context(m_stream->codecpar, m_codecCtx) < 0)
|
||||
AUD_THROW(FileException, "File couldn't be written, codec parameters couldn't be copied to the context.");
|
||||
#endif
|
||||
|
||||
int samplesize = std::max(int(AUD_SAMPLE_SIZE(m_specs)), AUD_DEVICE_SAMPLE_SIZE(m_specs));
|
||||
|
||||
if((m_input_size = m_codecCtx->frame_size))
|
||||
@@ -420,26 +346,13 @@ FFMPEGWriter::FFMPEGWriter(std::string filename, DeviceSpecs specs, Container fo
|
||||
if(avio_open(&m_formatCtx->pb, filename.c_str(), AVIO_FLAG_WRITE))
|
||||
AUD_THROW(FileException, "File couldn't be written, file opening failed with ffmpeg.");
|
||||
|
||||
if(avformat_write_header(m_formatCtx, nullptr) < 0)
|
||||
AUD_THROW(FileException, "File couldn't be written, writing the header failed.");
|
||||
avformat_write_header(m_formatCtx, nullptr);
|
||||
}
|
||||
catch(Exception&)
|
||||
{
|
||||
#ifndef FFMPEG_OLD_CODE
|
||||
if(m_codecCtx)
|
||||
avcodec_free_context(&m_codecCtx);
|
||||
#endif
|
||||
avformat_free_context(m_formatCtx);
|
||||
throw;
|
||||
}
|
||||
|
||||
#ifdef FFMPEG_OLD_CODE
|
||||
m_packet = new AVPacket({});
|
||||
#else
|
||||
m_packet = av_packet_alloc();
|
||||
#endif
|
||||
|
||||
m_frame = av_frame_alloc();
|
||||
}
|
||||
|
||||
FFMPEGWriter::~FFMPEGWriter()
|
||||
@@ -452,26 +365,9 @@ FFMPEGWriter::~FFMPEGWriter()
|
||||
|
||||
av_write_trailer(m_formatCtx);
|
||||
|
||||
if(m_frame)
|
||||
av_frame_free(&m_frame);
|
||||
|
||||
if(m_packet)
|
||||
{
|
||||
#ifdef FFMPEG_OLD_CODE
|
||||
delete m_packet;
|
||||
#else
|
||||
av_packet_free(&m_packet);
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef FFMPEG_OLD_CODE
|
||||
avcodec_close(m_codecCtx);
|
||||
#else
|
||||
if(m_codecCtx)
|
||||
avcodec_free_context(&m_codecCtx);
|
||||
#endif
|
||||
|
||||
avio_closep(&m_formatCtx->pb);
|
||||
avio_close(m_formatCtx->pb);
|
||||
avformat_free_context(m_formatCtx);
|
||||
}
|
||||
|
||||
|
15
extern/audaspace/plugins/ffmpeg/FFMPEGWriter.h
vendored
15
extern/audaspace/plugins/ffmpeg/FFMPEGWriter.h
vendored
@@ -65,21 +65,16 @@ private:
|
||||
*/
|
||||
AVCodecContext* m_codecCtx;
|
||||
|
||||
/**
|
||||
* The AVOutputFormat structure for using ffmpeg.
|
||||
*/
|
||||
AVOutputFormat* m_outputFmt;
|
||||
|
||||
/**
|
||||
* The AVStream structure for using ffmpeg.
|
||||
*/
|
||||
AVStream* m_stream;
|
||||
|
||||
/**
|
||||
* The AVPacket structure for using ffmpeg.
|
||||
*/
|
||||
AVPacket* m_packet;
|
||||
|
||||
/**
|
||||
* The AVFrame structure for using ffmpeg.
|
||||
*/
|
||||
AVFrame* m_frame;
|
||||
|
||||
/**
|
||||
* The input buffer for the format converted data before encoding.
|
||||
*/
|
||||
|
1
extern/rangetree/CMakeLists.txt
vendored
1
extern/rangetree/CMakeLists.txt
vendored
@@ -28,3 +28,4 @@ set(SRC
|
||||
)
|
||||
|
||||
blender_add_lib(extern_rangetree "${SRC}" "${INC}" "")
|
||||
|
||||
|
8
extern/xdnd/xdnd.c
vendored
8
extern/xdnd/xdnd.c
vendored
@@ -121,10 +121,10 @@ char *xdnd_debug_milliseconds (void)
|
||||
#define dnd_debug3(a,b,c) printf("%s: %d: %s: " a "\n", __FILE__, __LINE__, xdnd_debug_milliseconds (), b, c)
|
||||
#define dnd_debug4(a,b,c,d) printf("%s: %d: %s: " a "\n", __FILE__, __LINE__, xdnd_debug_milliseconds (), b, c, d)
|
||||
#else
|
||||
#define dnd_debug1(a) do {} while (0)
|
||||
#define dnd_debug2(a,b) do {} while (0)
|
||||
#define dnd_debug3(a,b,c) do {} while (0)
|
||||
#define dnd_debug4(a,b,c,d) do {} while (0)
|
||||
#define dnd_debug1(a)
|
||||
#define dnd_debug2(a,b)
|
||||
#define dnd_debug3(a,b,c)
|
||||
#define dnd_debug4(a,b,c,d)
|
||||
#endif
|
||||
|
||||
#define dnd_warning(a) fprintf (stderr, a)
|
||||
|
@@ -326,14 +326,6 @@ if(WITH_CYCLES_NETWORK)
|
||||
add_definitions(-DWITH_NETWORK)
|
||||
endif()
|
||||
|
||||
if(WITH_OPENCOLORIO)
|
||||
add_definitions(-DWITH_OCIO)
|
||||
include_directories(
|
||||
SYSTEM
|
||||
${OPENCOLORIO_INCLUDE_DIRS}
|
||||
)
|
||||
endif()
|
||||
|
||||
if(WITH_CYCLES_STANDALONE OR WITH_CYCLES_NETWORK OR WITH_CYCLES_CUBIN_COMPILER)
|
||||
add_subdirectory(app)
|
||||
endif()
|
||||
@@ -355,3 +347,4 @@ endif()
|
||||
if(NOT WITH_BLENDER AND WITH_CYCLES_STANDALONE)
|
||||
delayed_do_install(${CMAKE_BINARY_DIR}/bin)
|
||||
endif()
|
||||
|
||||
|
@@ -80,10 +80,6 @@ macro(cycles_target_link_libraries target)
|
||||
if(WITH_CYCLES_OPENSUBDIV)
|
||||
target_link_libraries(${target} ${OPENSUBDIV_LIBRARIES})
|
||||
endif()
|
||||
if(WITH_OPENCOLORIO)
|
||||
link_directories(${OPENCOLORIO_LIBPATH})
|
||||
target_link_libraries(${target} ${OPENCOLORIO_LIBRARIES})
|
||||
endif()
|
||||
target_link_libraries(
|
||||
${target}
|
||||
${OPENIMAGEIO_LIBRARIES}
|
||||
|
@@ -164,7 +164,7 @@ bool link_ptxas(CompilationSettings &settings)
|
||||
ptx += " --verbose";
|
||||
printf("%s\n", ptx.c_str());
|
||||
}
|
||||
|
||||
|
||||
int pxresult = system(ptx.c_str());
|
||||
if(pxresult) {
|
||||
fprintf(stderr, "Error: ptxas failed (%x)\n\n", pxresult);
|
||||
|
@@ -112,3 +112,4 @@ int main(int argc, const char **argv)
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@@ -524,3 +524,4 @@ int main(int argc, const char **argv)
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@@ -184,7 +184,7 @@ static bool xml_equal_string(xml_node node, const char *name, const char *value)
|
||||
|
||||
if(attr)
|
||||
return string_iequals(attr.value(), value);
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -697,3 +697,4 @@ void xml_read_file(Scene *scene, const char *filepath)
|
||||
}
|
||||
|
||||
CCL_NAMESPACE_END
|
||||
|
||||
|
@@ -39,7 +39,7 @@ def write(node, fname):
|
||||
|
||||
f = open(fname, "w")
|
||||
f.write(s)
|
||||
|
||||
|
||||
class CyclesXMLSettings(bpy.types.PropertyGroup):
|
||||
@classmethod
|
||||
def register(cls):
|
||||
@@ -53,11 +53,11 @@ class CyclesXMLSettings(bpy.types.PropertyGroup):
|
||||
maxlen=256,
|
||||
default='',
|
||||
subtype='FILE_PATH')
|
||||
|
||||
|
||||
@classmethod
|
||||
def unregister(cls):
|
||||
del bpy.types.Scene.cycles_xml
|
||||
|
||||
|
||||
# User Interface Drawing Code
|
||||
class RenderButtonsPanel():
|
||||
bl_space_type = 'PROPERTIES'
|
||||
@@ -74,13 +74,13 @@ class PHYSICS_PT_fluid_export(RenderButtonsPanel, bpy.types.Panel):
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
|
||||
cycles = context.scene.cycles_xml
|
||||
|
||||
|
||||
#layout.prop(cycles, "filepath")
|
||||
layout.operator("export_mesh.cycles_xml")
|
||||
|
||||
|
||||
|
||||
# Export Operator
|
||||
class ExportCyclesXML(bpy.types.Operator, ExportHelper):
|
||||
bl_idname = "export_mesh.cycles_xml"
|
||||
@@ -117,23 +117,23 @@ class ExportCyclesXML(bpy.types.Operator, ExportHelper):
|
||||
P += "%f %f %f " % (v.co[0], v.co[1], v.co[2])
|
||||
|
||||
verts_and_uvs = zip(mesh.tessfaces, mesh.tessface_uv_textures.active.data)
|
||||
|
||||
|
||||
for f, uvf in verts_and_uvs:
|
||||
vcount = len(f.vertices)
|
||||
nverts += str(vcount) + " "
|
||||
|
||||
for v in f.vertices:
|
||||
verts += str(v) + " "
|
||||
|
||||
|
||||
uvs += str(uvf.uv1[0]) + " " + str(uvf.uv1[1]) + " "
|
||||
uvs += str(uvf.uv2[0]) + " " + str(uvf.uv2[1]) + " "
|
||||
uvs += str(uvf.uv3[0]) + " " + str(uvf.uv3[1]) + " "
|
||||
if vcount==4:
|
||||
uvs += " " + str(uvf.uv4[0]) + " " + str(uvf.uv4[1]) + " "
|
||||
|
||||
|
||||
|
||||
node = etree.Element('mesh', attrib={'nverts': nverts.strip(), 'verts': verts.strip(), 'P': P, 'UV' : uvs.strip()})
|
||||
|
||||
|
||||
# write to file
|
||||
write(node, filepath)
|
||||
|
||||
@@ -147,3 +147,5 @@ def unregister():
|
||||
|
||||
if __name__ == "__main__":
|
||||
register()
|
||||
|
||||
|
||||
|
@@ -39,7 +39,7 @@ set(SRC
|
||||
|
||||
set(ADDON_FILES
|
||||
addon/__init__.py
|
||||
addon/engine.py
|
||||
addon/engine.py
|
||||
addon/osl.py
|
||||
addon/presets.py
|
||||
addon/properties.py
|
||||
@@ -63,3 +63,4 @@ endif()
|
||||
add_dependencies(bf_intern_cycles bf_rna)
|
||||
|
||||
delayed_install(${CMAKE_CURRENT_SOURCE_DIR} "${ADDON_FILES}" ${CYCLES_INSTALL_PATH})
|
||||
|
||||
|
@@ -128,12 +128,6 @@ enum_volume_interpolation = (
|
||||
('CUBIC', "Cubic", "Smoothed high quality interpolation, but slower")
|
||||
)
|
||||
|
||||
enum_world_mis = (
|
||||
('NONE', "None", "Don't sample the background, faster but might cause noise for non-solid backgrounds"),
|
||||
('AUTOMATIC', "Auto", "Automatically try to determine the best setting"),
|
||||
('MANUAL', "Manual", "Manually set the resolution of the sampling map, higher values are slower and require more memory but reduce noise")
|
||||
)
|
||||
|
||||
enum_device_type = (
|
||||
('CPU', "CPU", "CPU", 0),
|
||||
('CUDA', "CUDA", "CUDA", 1),
|
||||
@@ -887,17 +881,17 @@ class CyclesMaterialSettings(bpy.types.PropertyGroup):
|
||||
del bpy.types.Material.cycles
|
||||
|
||||
|
||||
class CyclesLightSettings(bpy.types.PropertyGroup):
|
||||
class CyclesLampSettings(bpy.types.PropertyGroup):
|
||||
@classmethod
|
||||
def register(cls):
|
||||
bpy.types.Light.cycles = PointerProperty(
|
||||
name="Cycles Light Settings",
|
||||
description="Cycles light settings",
|
||||
bpy.types.Lamp.cycles = PointerProperty(
|
||||
name="Cycles Lamp Settings",
|
||||
description="Cycles lamp settings",
|
||||
type=cls,
|
||||
)
|
||||
cls.cast_shadow = BoolProperty(
|
||||
name="Cast Shadow",
|
||||
description="Light casts shadows",
|
||||
description="Lamp casts shadows",
|
||||
default=True,
|
||||
)
|
||||
cls.samples = IntProperty(
|
||||
@@ -914,20 +908,20 @@ class CyclesLightSettings(bpy.types.PropertyGroup):
|
||||
)
|
||||
cls.use_multiple_importance_sampling = BoolProperty(
|
||||
name="Multiple Importance Sample",
|
||||
description="Use multiple importance sampling for the light, "
|
||||
"reduces noise for area lights and sharp glossy materials",
|
||||
description="Use multiple importance sampling for the lamp, "
|
||||
"reduces noise for area lamps and sharp glossy materials",
|
||||
default=True,
|
||||
)
|
||||
cls.is_portal = BoolProperty(
|
||||
name="Is Portal",
|
||||
description="Use this area light to guide sampling of the background, "
|
||||
"note that this will make the light invisible",
|
||||
description="Use this area lamp to guide sampling of the background, "
|
||||
"note that this will make the lamp invisible",
|
||||
default=False,
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def unregister(cls):
|
||||
del bpy.types.Light.cycles
|
||||
del bpy.types.Lamp.cycles
|
||||
|
||||
|
||||
class CyclesWorldSettings(bpy.types.PropertyGroup):
|
||||
@@ -938,15 +932,15 @@ class CyclesWorldSettings(bpy.types.PropertyGroup):
|
||||
description="Cycles world settings",
|
||||
type=cls,
|
||||
)
|
||||
cls.sampling_method = EnumProperty(
|
||||
name="Sampling method",
|
||||
description="How to sample the background light",
|
||||
items=enum_world_mis,
|
||||
default='AUTOMATIC',
|
||||
cls.sample_as_light = BoolProperty(
|
||||
name="Multiple Importance Sample",
|
||||
description="Use multiple importance sampling for the environment, "
|
||||
"enabling for non-solid colors is recommended",
|
||||
default=True,
|
||||
)
|
||||
cls.sample_map_resolution = IntProperty(
|
||||
name="Map Resolution",
|
||||
description="Importance map size is resolution x resolution/2; "
|
||||
description="Importance map size is resolution x resolution; "
|
||||
"higher values potentially produce less noise, at the cost of memory and speed",
|
||||
min=4, max=8192,
|
||||
default=1024,
|
||||
@@ -1460,7 +1454,7 @@ def register():
|
||||
bpy.utils.register_class(CyclesRenderSettings)
|
||||
bpy.utils.register_class(CyclesCameraSettings)
|
||||
bpy.utils.register_class(CyclesMaterialSettings)
|
||||
bpy.utils.register_class(CyclesLightSettings)
|
||||
bpy.utils.register_class(CyclesLampSettings)
|
||||
bpy.utils.register_class(CyclesWorldSettings)
|
||||
bpy.utils.register_class(CyclesVisibilitySettings)
|
||||
bpy.utils.register_class(CyclesMeshSettings)
|
||||
@@ -1475,7 +1469,7 @@ def unregister():
|
||||
bpy.utils.unregister_class(CyclesRenderSettings)
|
||||
bpy.utils.unregister_class(CyclesCameraSettings)
|
||||
bpy.utils.unregister_class(CyclesMaterialSettings)
|
||||
bpy.utils.unregister_class(CyclesLightSettings)
|
||||
bpy.utils.unregister_class(CyclesLampSettings)
|
||||
bpy.utils.unregister_class(CyclesWorldSettings)
|
||||
bpy.utils.unregister_class(CyclesMeshSettings)
|
||||
bpy.utils.unregister_class(CyclesObjectSettings)
|
||||
|
@@ -17,8 +17,7 @@
|
||||
# <pep8 compliant>
|
||||
|
||||
import bpy
|
||||
from bpy_extras.node_utils import find_node_input
|
||||
from bl_operators.presets import PresetMenu
|
||||
from bpy_extras.node_utils import find_node_input, find_output_node
|
||||
|
||||
from bpy.types import (
|
||||
Panel,
|
||||
@@ -27,20 +26,20 @@ from bpy.types import (
|
||||
)
|
||||
|
||||
|
||||
class CYCLES_MT_sampling_presets(PresetMenu):
|
||||
class CYCLES_MT_sampling_presets(Menu):
|
||||
bl_label = "Sampling Presets"
|
||||
preset_subdir = "cycles/sampling"
|
||||
preset_operator = "script.execute_preset"
|
||||
preset_add_operator = "render.cycles_sampling_preset_add"
|
||||
COMPAT_ENGINES = {'CYCLES'}
|
||||
draw = Menu.draw_preset
|
||||
|
||||
|
||||
class CYCLES_MT_integrator_presets(PresetMenu):
|
||||
class CYCLES_MT_integrator_presets(Menu):
|
||||
bl_label = "Integrator Presets"
|
||||
preset_subdir = "cycles/integrator"
|
||||
preset_operator = "script.execute_preset"
|
||||
preset_add_operator = "render.cycles_integrator_preset_add"
|
||||
COMPAT_ENGINES = {'CYCLES'}
|
||||
draw = Menu.draw_preset
|
||||
|
||||
|
||||
class CyclesButtonsPanel:
|
||||
@@ -145,9 +144,6 @@ class CYCLES_RENDER_PT_sampling(CyclesButtonsPanel, Panel):
|
||||
bl_label = "Sampling"
|
||||
bl_options = {'DEFAULT_CLOSED'}
|
||||
|
||||
def draw_header_preset(self, context):
|
||||
CYCLES_MT_sampling_presets.draw_panel_header(self.layout)
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
layout.use_property_split = False
|
||||
@@ -155,6 +151,11 @@ class CYCLES_RENDER_PT_sampling(CyclesButtonsPanel, Panel):
|
||||
scene = context.scene
|
||||
cscene = scene.cycles
|
||||
|
||||
row = layout.row(align=True)
|
||||
row.menu("CYCLES_MT_sampling_presets", text=bpy.types.CYCLES_MT_sampling_presets.bl_label)
|
||||
row.operator("render.cycles_sampling_preset_add", text="", icon="ZOOMIN")
|
||||
row.operator("render.cycles_sampling_preset_add", text="", icon="ZOOMOUT").remove_active = True
|
||||
|
||||
layout.use_property_split = True
|
||||
|
||||
layout.prop(cscene, "progressive")
|
||||
@@ -193,7 +194,7 @@ class CYCLES_RENDER_PT_sampling(CyclesButtonsPanel, Panel):
|
||||
|
||||
row = layout.row(align=True)
|
||||
row.prop(cscene, "seed")
|
||||
row.prop(cscene, "use_animated_seed", text="", icon='TIME')
|
||||
row.prop(cscene, "use_animated_seed", text="", icon="TIME")
|
||||
|
||||
layout.prop(cscene, "sampling_pattern", text="Pattern")
|
||||
|
||||
@@ -314,11 +315,17 @@ class CYCLES_RENDER_PT_light_paths(CyclesButtonsPanel, Panel):
|
||||
bl_label = "Light Paths"
|
||||
bl_options = {'DEFAULT_CLOSED'}
|
||||
|
||||
def draw_header_preset(self, context):
|
||||
CYCLES_MT_integrator_presets.draw_panel_header(self.layout)
|
||||
|
||||
def draw(self, context):
|
||||
pass
|
||||
layout = self.layout
|
||||
layout.use_property_split = True
|
||||
|
||||
scene = context.scene
|
||||
cscene = scene.cycles
|
||||
|
||||
row = layout.row(align=True)
|
||||
row.menu("CYCLES_MT_integrator_presets", text=bpy.types.CYCLES_MT_integrator_presets.bl_label)
|
||||
row.operator("render.cycles_integrator_preset_add", text="", icon="ZOOMIN")
|
||||
row.operator("render.cycles_integrator_preset_add", text="", icon="ZOOMOUT").remove_active = True
|
||||
|
||||
|
||||
class CYCLES_RENDER_PT_light_paths_max_bounces(CyclesButtonsPanel, Panel):
|
||||
@@ -820,7 +827,6 @@ class CYCLES_CAMERA_PT_dof(CyclesButtonsPanel, Panel):
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
layout.use_property_split = True
|
||||
|
||||
cam = context.camera
|
||||
ccam = cam.cycles
|
||||
@@ -829,62 +835,16 @@ class CYCLES_CAMERA_PT_dof(CyclesButtonsPanel, Panel):
|
||||
split = layout.split()
|
||||
|
||||
col = split.column()
|
||||
col.prop(cam, "dof_object", text="Focus Object")
|
||||
col.label("Focus:")
|
||||
col.prop(cam, "dof_object", text="")
|
||||
|
||||
sub = col.row()
|
||||
sub.active = cam.dof_object is None
|
||||
sub.prop(cam, "dof_distance", text="Distance")
|
||||
|
||||
|
||||
class CYCLES_CAMERA_PT_dof_aperture(CyclesButtonsPanel, Panel):
|
||||
bl_label = "Aperture"
|
||||
bl_parent_id = "CYCLES_CAMERA_PT_dof"
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
return context.camera and CyclesButtonsPanel.poll(context)
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
layout.use_property_split = True
|
||||
flow = layout.grid_flow(row_major=True, columns=0, even_columns=True, even_rows=False, align=False)
|
||||
|
||||
cam = context.camera
|
||||
ccam = cam.cycles
|
||||
dof_options = cam.gpu_dof
|
||||
|
||||
col = flow.column()
|
||||
col.prop(ccam, "aperture_type")
|
||||
if ccam.aperture_type == 'RADIUS':
|
||||
col.prop(ccam, "aperture_size", text="Size")
|
||||
elif ccam.aperture_type == 'FSTOP':
|
||||
col.prop(ccam, "aperture_fstop", text="Number")
|
||||
col.separator()
|
||||
|
||||
col = flow.column()
|
||||
col.prop(ccam, "aperture_blades", text="Blades")
|
||||
col.prop(ccam, "aperture_rotation", text="Rotation")
|
||||
col.prop(ccam, "aperture_ratio", text="Ratio")
|
||||
|
||||
|
||||
class CYCLES_CAMERA_PT_dof_viewport(CyclesButtonsPanel, Panel):
|
||||
bl_label = "Viewport"
|
||||
bl_parent_id = "CYCLES_CAMERA_PT_dof"
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
return context.camera and CyclesButtonsPanel.poll(context)
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
layout.use_property_split = True
|
||||
flow = layout.grid_flow(row_major=True, columns=0, even_columns=True, even_rows=False, align=False)
|
||||
|
||||
cam = context.camera
|
||||
dof_options = cam.gpu_dof
|
||||
|
||||
hq_support = dof_options.is_hq_supported
|
||||
sub = flow.column(align=True)
|
||||
sub = col.column(align=True)
|
||||
sub.label("Viewport:")
|
||||
subhq = sub.column()
|
||||
subhq.active = hq_support
|
||||
subhq.prop(dof_options, "use_high_quality")
|
||||
@@ -892,6 +852,21 @@ class CYCLES_CAMERA_PT_dof_viewport(CyclesButtonsPanel, Panel):
|
||||
if dof_options.use_high_quality and hq_support:
|
||||
sub.prop(dof_options, "blades")
|
||||
|
||||
col = split.column()
|
||||
|
||||
col.label("Aperture:")
|
||||
sub = col.column(align=True)
|
||||
sub.prop(ccam, "aperture_type", text="")
|
||||
if ccam.aperture_type == 'RADIUS':
|
||||
sub.prop(ccam, "aperture_size", text="Size")
|
||||
elif ccam.aperture_type == 'FSTOP':
|
||||
sub.prop(ccam, "aperture_fstop", text="Number")
|
||||
|
||||
sub = col.column(align=True)
|
||||
sub.prop(ccam, "aperture_blades", text="Blades")
|
||||
sub.prop(ccam, "aperture_rotation", text="Rotation")
|
||||
sub.prop(ccam, "aperture_ratio", text="Ratio")
|
||||
|
||||
|
||||
class CYCLES_PT_context_material(CyclesButtonsPanel, Panel):
|
||||
bl_label = ""
|
||||
@@ -1008,7 +983,7 @@ class CYCLES_OBJECT_PT_cycles_settings(CyclesButtonsPanel, Panel):
|
||||
def poll(cls, context):
|
||||
ob = context.object
|
||||
return (CyclesButtonsPanel.poll(context) and
|
||||
ob and ((ob.type in {'MESH', 'CURVE', 'SURFACE', 'FONT', 'META', 'LIGHT'}) or
|
||||
ob and ((ob.type in {'MESH', 'CURVE', 'SURFACE', 'FONT', 'META', 'LAMP'}) or
|
||||
(ob.dupli_type == 'COLLECTION' and ob.dupli_group)))
|
||||
|
||||
def draw(self, context):
|
||||
@@ -1029,7 +1004,7 @@ class CYCLES_OBJECT_PT_cycles_settings(CyclesButtonsPanel, Panel):
|
||||
flow.prop(visibility, "transmission")
|
||||
flow.prop(visibility, "scatter")
|
||||
|
||||
if ob.type != 'LIGHT':
|
||||
if ob.type != 'LAMP':
|
||||
flow.prop(visibility, "shadow")
|
||||
|
||||
row = layout.row()
|
||||
@@ -1049,7 +1024,7 @@ class CYCLES_OBJECT_PT_cycles_settings(CyclesButtonsPanel, Panel):
|
||||
|
||||
|
||||
class CYCLES_OT_use_shading_nodes(Operator):
|
||||
"""Enable nodes on a material, world or light"""
|
||||
"""Enable nodes on a material, world or lamp"""
|
||||
bl_idname = "cycles.use_shading_nodes"
|
||||
bl_label = "Use Nodes"
|
||||
|
||||
@@ -1063,20 +1038,20 @@ class CYCLES_OT_use_shading_nodes(Operator):
|
||||
context.material.use_nodes = True
|
||||
elif context.world:
|
||||
context.world.use_nodes = True
|
||||
elif context.light:
|
||||
context.light.use_nodes = True
|
||||
elif context.lamp:
|
||||
context.lamp.use_nodes = True
|
||||
|
||||
return {'FINISHED'}
|
||||
|
||||
|
||||
def panel_node_draw(layout, id_data, output_type, input_name):
|
||||
def panel_node_draw(layout, id_data, output_types, input_name):
|
||||
if not id_data.use_nodes:
|
||||
layout.operator("cycles.use_shading_nodes", icon='NODETREE')
|
||||
return False
|
||||
|
||||
ntree = id_data.node_tree
|
||||
|
||||
node = ntree.get_output_node('CYCLES')
|
||||
node = find_output_node(ntree, output_types)
|
||||
if node:
|
||||
input = find_node_input(node, input_name)
|
||||
if input:
|
||||
@@ -1089,7 +1064,7 @@ def panel_node_draw(layout, id_data, output_type, input_name):
|
||||
return True
|
||||
|
||||
|
||||
class CYCLES_LIGHT_PT_preview(CyclesButtonsPanel, Panel):
|
||||
class CYCLES_LAMP_PT_preview(CyclesButtonsPanel, Panel):
|
||||
bl_label = "Preview"
|
||||
bl_context = "data"
|
||||
bl_options = {'DEFAULT_CLOSED'}
|
||||
@@ -1097,107 +1072,113 @@ class CYCLES_LIGHT_PT_preview(CyclesButtonsPanel, Panel):
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
return (
|
||||
context.light and
|
||||
context.lamp and
|
||||
not (
|
||||
context.light.type == 'AREA' and
|
||||
context.light.cycles.is_portal
|
||||
context.lamp.type == 'AREA' and
|
||||
context.lamp.cycles.is_portal
|
||||
) and
|
||||
CyclesButtonsPanel.poll(context)
|
||||
)
|
||||
|
||||
def draw(self, context):
|
||||
self.layout.template_preview(context.light)
|
||||
self.layout.template_preview(context.lamp)
|
||||
|
||||
|
||||
class CYCLES_LIGHT_PT_light(CyclesButtonsPanel, Panel):
|
||||
bl_label = "Light"
|
||||
class CYCLES_LAMP_PT_lamp(CyclesButtonsPanel, Panel):
|
||||
bl_label = "Lamp"
|
||||
bl_context = "data"
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
return context.light and CyclesButtonsPanel.poll(context)
|
||||
return context.lamp and CyclesButtonsPanel.poll(context)
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
light = context.light
|
||||
clamp = light.cycles
|
||||
lamp = context.lamp
|
||||
clamp = lamp.cycles
|
||||
# cscene = context.scene.cycles
|
||||
|
||||
layout.prop(light, "type", expand=True)
|
||||
layout.prop(lamp, "type", expand=True)
|
||||
|
||||
layout.use_property_split = True
|
||||
split = layout.split()
|
||||
col = split.column(align=True)
|
||||
|
||||
col = layout.column()
|
||||
|
||||
if light.type in {'POINT', 'SUN', 'SPOT'}:
|
||||
col.prop(light, "shadow_soft_size", text="Size")
|
||||
elif light.type == 'AREA':
|
||||
col.prop(light, "shape", text="Shape")
|
||||
if lamp.type in {'POINT', 'SUN', 'SPOT'}:
|
||||
col.prop(lamp, "shadow_soft_size", text="Size")
|
||||
elif lamp.type == 'AREA':
|
||||
col.prop(lamp, "shape", text="")
|
||||
sub = col.column(align=True)
|
||||
|
||||
if light.shape in {'SQUARE', 'DISK'}:
|
||||
sub.prop(light, "size")
|
||||
elif light.shape in {'RECTANGLE', 'ELLIPSE'}:
|
||||
sub.prop(light, "size", text="Size X")
|
||||
sub.prop(light, "size_y", text="Y")
|
||||
if lamp.shape in {'SQUARE', 'DISK'}:
|
||||
sub.prop(lamp, "size")
|
||||
elif lamp.shape in {'RECTANGLE', 'ELLIPSE'}:
|
||||
sub.prop(lamp, "size", text="Size X")
|
||||
sub.prop(lamp, "size_y", text="Size Y")
|
||||
|
||||
if not (light.type == 'AREA' and clamp.is_portal):
|
||||
sub = col.column()
|
||||
if not (lamp.type == 'AREA' and clamp.is_portal):
|
||||
sub = col.column(align=True)
|
||||
if use_branched_path(context):
|
||||
subsub = sub.row(align=True)
|
||||
subsub.active = use_sample_all_lights(context)
|
||||
subsub.prop(clamp, "samples")
|
||||
sub.prop(clamp, "max_bounces")
|
||||
|
||||
col = split.column()
|
||||
|
||||
sub = col.column(align=True)
|
||||
sub.active = not (light.type == 'AREA' and clamp.is_portal)
|
||||
sub.active = not (lamp.type == 'AREA' and clamp.is_portal)
|
||||
sub.prop(clamp, "cast_shadow")
|
||||
sub.prop(clamp, "use_multiple_importance_sampling", text="Multiple Importance")
|
||||
|
||||
if light.type == 'AREA':
|
||||
if lamp.type == 'AREA':
|
||||
col.prop(clamp, "is_portal", text="Portal")
|
||||
|
||||
if light.type == 'HEMI':
|
||||
layout.label(text="Not supported, interpreted as sun light")
|
||||
if lamp.type == 'HEMI':
|
||||
layout.label(text="Not supported, interpreted as sun lamp")
|
||||
|
||||
|
||||
class CYCLES_LIGHT_PT_nodes(CyclesButtonsPanel, Panel):
|
||||
class CYCLES_LAMP_PT_nodes(CyclesButtonsPanel, Panel):
|
||||
bl_label = "Nodes"
|
||||
bl_context = "data"
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
return context.light and not (context.light.type == 'AREA' and
|
||||
context.light.cycles.is_portal) and \
|
||||
return context.lamp and not (context.lamp.type == 'AREA' and
|
||||
context.lamp.cycles.is_portal) and \
|
||||
CyclesButtonsPanel.poll(context)
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
light = context.light
|
||||
if not panel_node_draw(layout, light, 'OUTPUT_LIGHT', 'Surface'):
|
||||
layout.prop(light, "color")
|
||||
lamp = context.lamp
|
||||
if not panel_node_draw(layout, lamp, ('OUTPUT_LAMP',), 'Surface'):
|
||||
layout.prop(lamp, "color")
|
||||
|
||||
|
||||
class CYCLES_LIGHT_PT_spot(CyclesButtonsPanel, Panel):
|
||||
class CYCLES_LAMP_PT_spot(CyclesButtonsPanel, Panel):
|
||||
bl_label = "Spot Shape"
|
||||
bl_context = "data"
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
light = context.light
|
||||
return (light and light.type == 'SPOT') and CyclesButtonsPanel.poll(context)
|
||||
lamp = context.lamp
|
||||
return (lamp and lamp.type == 'SPOT') and CyclesButtonsPanel.poll(context)
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
light = context.light
|
||||
layout.use_property_split = True
|
||||
|
||||
col = layout.column()
|
||||
col.prop(light, "spot_size", text="Size")
|
||||
col.prop(light, "spot_blend", text="Blend", slider=True)
|
||||
col.prop(light, "show_cone")
|
||||
lamp = context.lamp
|
||||
|
||||
split = layout.split()
|
||||
|
||||
col = split.column()
|
||||
sub = col.column()
|
||||
sub.prop(lamp, "spot_size", text="Size")
|
||||
sub.prop(lamp, "spot_blend", text="Blend", slider=True)
|
||||
|
||||
col = split.column()
|
||||
col.prop(lamp, "show_cone")
|
||||
|
||||
|
||||
class CYCLES_WORLD_PT_preview(CyclesButtonsPanel, Panel):
|
||||
@@ -1226,7 +1207,7 @@ class CYCLES_WORLD_PT_surface(CyclesButtonsPanel, Panel):
|
||||
|
||||
world = context.world
|
||||
|
||||
if not panel_node_draw(layout, world, 'OUTPUT_WORLD', 'Surface'):
|
||||
if not panel_node_draw(layout, world, ('OUTPUT_WORLD',), 'Surface'):
|
||||
layout.prop(world, "horizon_color", text="Color")
|
||||
|
||||
|
||||
@@ -1244,7 +1225,7 @@ class CYCLES_WORLD_PT_volume(CyclesButtonsPanel, Panel):
|
||||
layout = self.layout
|
||||
|
||||
world = context.world
|
||||
panel_node_draw(layout, world, 'OUTPUT_WORLD', 'Volume')
|
||||
panel_node_draw(layout, world, ('OUTPUT_WORLD',), 'Volume')
|
||||
|
||||
|
||||
class CYCLES_WORLD_PT_ambient_occlusion(CyclesButtonsPanel, Panel):
|
||||
@@ -1361,13 +1342,11 @@ class CYCLES_WORLD_PT_settings_surface(CyclesButtonsPanel, Panel):
|
||||
cworld = world.cycles
|
||||
|
||||
col = layout.column()
|
||||
col.prop(cworld, "sampling_method", text="Sampling")
|
||||
col.prop(cworld, "sample_as_light", text="Multiple Importance")
|
||||
|
||||
sub = col.column()
|
||||
sub.active = cworld.sampling_method != 'NONE'
|
||||
subsub = sub.row(align=True)
|
||||
subsub.active = cworld.sampling_method == 'MANUAL'
|
||||
subsub.prop(cworld, "sample_map_resolution")
|
||||
sub.active = cworld.sample_as_light
|
||||
sub.prop(cworld, "sample_map_resolution")
|
||||
if use_branched_path(context):
|
||||
subsub = sub.column(align=True)
|
||||
subsub.active = use_sample_all_lights(context)
|
||||
@@ -1425,7 +1404,7 @@ class CYCLES_MATERIAL_PT_surface(CyclesButtonsPanel, Panel):
|
||||
layout = self.layout
|
||||
|
||||
mat = context.material
|
||||
if not panel_node_draw(layout, mat, 'OUTPUT_MATERIAL', 'Surface'):
|
||||
if not panel_node_draw(layout, mat, ('OUTPUT_MATERIAL', 'OUTPUT_EEVEE_MATERIAL'), 'Surface'):
|
||||
layout.prop(mat, "diffuse_color")
|
||||
|
||||
|
||||
@@ -1445,7 +1424,7 @@ class CYCLES_MATERIAL_PT_volume(CyclesButtonsPanel, Panel):
|
||||
mat = context.material
|
||||
# cmat = mat.cycles
|
||||
|
||||
panel_node_draw(layout, mat, 'OUTPUT_MATERIAL', 'Volume')
|
||||
panel_node_draw(layout, mat, ('OUTPUT_MATERIAL', 'OUTPUT_EEVEE_MATERIAL'), 'Volume')
|
||||
|
||||
|
||||
class CYCLES_MATERIAL_PT_displacement(CyclesButtonsPanel, Panel):
|
||||
@@ -1461,7 +1440,7 @@ class CYCLES_MATERIAL_PT_displacement(CyclesButtonsPanel, Panel):
|
||||
layout = self.layout
|
||||
|
||||
mat = context.material
|
||||
panel_node_draw(layout, mat, 'OUTPUT_MATERIAL', 'Displacement')
|
||||
panel_node_draw(layout, mat, ('OUTPUT_MATERIAL', 'OUTPUT_EEVEE_MATERIAL'), 'Displacement')
|
||||
|
||||
|
||||
class CYCLES_MATERIAL_PT_settings(CyclesButtonsPanel, Panel):
|
||||
@@ -1539,7 +1518,6 @@ class CYCLES_RENDER_PT_bake(CyclesButtonsPanel, Panel):
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
layout.use_property_split = True
|
||||
layout.use_property_decorate = False # No animation.
|
||||
|
||||
scene = context.scene
|
||||
cscene = scene.cycles
|
||||
@@ -1568,7 +1546,7 @@ class CYCLES_RENDER_PT_bake(CyclesButtonsPanel, Panel):
|
||||
if cscene.bake_type == 'NORMAL':
|
||||
col.prop(cbk, "normal_space", text="Space")
|
||||
|
||||
sub = col.column(align=True)
|
||||
sub = col.row(align=True)
|
||||
sub.prop(cbk, "normal_r", text="Swizzle R")
|
||||
sub.prop(cbk, "normal_g", text="G")
|
||||
sub.prop(cbk, "normal_b", text="B")
|
||||
@@ -1590,7 +1568,6 @@ class CYCLES_RENDER_PT_bake(CyclesButtonsPanel, Panel):
|
||||
|
||||
elif cscene.bake_type in {'DIFFUSE', 'GLOSSY', 'TRANSMISSION', 'SUBSURFACE'}:
|
||||
row = col.row(align=True)
|
||||
row.use_property_split = False
|
||||
row.prop(cbk, "use_pass_direct", toggle=True)
|
||||
row.prop(cbk, "use_pass_indirect", toggle=True)
|
||||
row.prop(cbk, "use_pass_color", toggle=True)
|
||||
@@ -1609,12 +1586,10 @@ class CYCLES_RENDER_PT_bake(CyclesButtonsPanel, Panel):
|
||||
sub.prop(cbk, "use_cage", text="Cage")
|
||||
if cbk.use_cage:
|
||||
sub.prop(cbk, "cage_extrusion", text="Extrusion")
|
||||
sub.prop_search(cbk, "cage_object", scene, "objects", text="Cage Object")
|
||||
sub.prop_search(cbk, "cage_object", scene, "objects", text="")
|
||||
else:
|
||||
sub.prop(cbk, "cage_extrusion", text="Ray Distance")
|
||||
|
||||
layout.separator()
|
||||
|
||||
layout.operator("object.bake", icon='RENDER_STILL').type = cscene.bake_type
|
||||
|
||||
|
||||
@@ -1781,7 +1756,7 @@ def draw_pause(self, context):
|
||||
|
||||
if view.shading.type == 'RENDERED':
|
||||
cscene = scene.cycles
|
||||
layout.prop(cscene, "preview_pause", icon='PAUSE', text="")
|
||||
layout.prop(cscene, "preview_pause", icon="PAUSE", text="")
|
||||
|
||||
|
||||
def get_panels():
|
||||
@@ -1789,7 +1764,7 @@ def get_panels():
|
||||
'DATA_PT_area',
|
||||
'DATA_PT_camera_dof',
|
||||
'DATA_PT_falloff_curve',
|
||||
'DATA_PT_light',
|
||||
'DATA_PT_lamp',
|
||||
'DATA_PT_preview',
|
||||
'DATA_PT_spot',
|
||||
'MATERIAL_PT_context_material',
|
||||
@@ -1837,16 +1812,14 @@ classes = (
|
||||
CYCLES_RENDER_PT_denoising,
|
||||
CYCLES_PT_post_processing,
|
||||
CYCLES_CAMERA_PT_dof,
|
||||
CYCLES_CAMERA_PT_dof_aperture,
|
||||
CYCLES_CAMERA_PT_dof_viewport,
|
||||
CYCLES_PT_context_material,
|
||||
CYCLES_OBJECT_PT_motion_blur,
|
||||
CYCLES_OBJECT_PT_cycles_settings,
|
||||
CYCLES_OT_use_shading_nodes,
|
||||
CYCLES_LIGHT_PT_preview,
|
||||
CYCLES_LIGHT_PT_light,
|
||||
CYCLES_LIGHT_PT_nodes,
|
||||
CYCLES_LIGHT_PT_spot,
|
||||
CYCLES_LAMP_PT_preview,
|
||||
CYCLES_LAMP_PT_lamp,
|
||||
CYCLES_LAMP_PT_nodes,
|
||||
CYCLES_LAMP_PT_spot,
|
||||
CYCLES_WORLD_PT_preview,
|
||||
CYCLES_WORLD_PT_surface,
|
||||
CYCLES_WORLD_PT_volume,
|
||||
|
@@ -22,6 +22,45 @@ import math
|
||||
from bpy.app.handlers import persistent
|
||||
|
||||
|
||||
def check_is_new_shading_ntree(node_tree):
|
||||
for node in node_tree.nodes:
|
||||
# If material has any node with ONLY new shading system
|
||||
# compatibility then it's considered a Cycles material
|
||||
# and versioning code would need to perform on it.
|
||||
#
|
||||
# We can not check for whether NEW_SHADING in compatibility
|
||||
# because some nodes could have compatibility with both old
|
||||
# and new shading system and they can't be used for any
|
||||
# decision here.
|
||||
if node.shading_compatibility == {'NEW_SHADING'}:
|
||||
return True
|
||||
|
||||
# If node is only compatible with old shading system
|
||||
# then material can not be Cycles material and we
|
||||
# can stopiterating nodes now.
|
||||
if node.shading_compatibility == {'OLD_SHADING'}:
|
||||
return False
|
||||
return False
|
||||
|
||||
|
||||
def check_is_new_shading_material(material):
|
||||
if not material.node_tree:
|
||||
return False
|
||||
return check_is_new_shading_ntree(material.node_tree)
|
||||
|
||||
|
||||
def check_is_new_shading_world(world):
|
||||
if not world.node_tree:
|
||||
return False
|
||||
return check_is_new_shading_ntree(world.node_tree)
|
||||
|
||||
|
||||
def check_is_new_shading_lamp(lamp):
|
||||
if not lamp.node_tree:
|
||||
return False
|
||||
return check_is_new_shading_ntree(lamp.node_tree)
|
||||
|
||||
|
||||
def foreach_notree_node(nodetree, callback, traversed):
|
||||
if nodetree in traversed:
|
||||
return
|
||||
@@ -35,20 +74,20 @@ def foreach_notree_node(nodetree, callback, traversed):
|
||||
def foreach_cycles_node(callback):
|
||||
traversed = set()
|
||||
for material in bpy.data.materials:
|
||||
if material.node_tree:
|
||||
foreach_notree_node(material.node_tree,
|
||||
callback,
|
||||
traversed)
|
||||
if check_is_new_shading_material(material):
|
||||
foreach_notree_node(material.node_tree,
|
||||
callback,
|
||||
traversed)
|
||||
for world in bpy.data.worlds:
|
||||
if world.node_tree:
|
||||
foreach_notree_node(world.node_tree,
|
||||
callback,
|
||||
traversed)
|
||||
for light in bpy.data.lights:
|
||||
if light.node_tree:
|
||||
foreach_notree_node(light.node_tree,
|
||||
callback,
|
||||
traversed)
|
||||
if check_is_new_shading_world(world):
|
||||
foreach_notree_node(world.node_tree,
|
||||
callback,
|
||||
traversed)
|
||||
for lamp in bpy.data.lamps:
|
||||
if check_is_new_shading_world(lamp):
|
||||
foreach_notree_node(lamp.node_tree,
|
||||
callback,
|
||||
traversed)
|
||||
|
||||
|
||||
def displacement_node_insert(material, nodetree, traversed):
|
||||
@@ -89,7 +128,7 @@ def displacement_node_insert(material, nodetree, traversed):
|
||||
def displacement_nodes_insert():
|
||||
traversed = set()
|
||||
for material in bpy.data.materials:
|
||||
if material.node_tree:
|
||||
if check_is_new_shading_material(material):
|
||||
displacement_node_insert(material, material.node_tree, traversed)
|
||||
|
||||
def displacement_principled_nodes(node):
|
||||
@@ -147,7 +186,7 @@ def square_roughness_node_insert(material, nodetree, traversed):
|
||||
def square_roughness_nodes_insert():
|
||||
traversed = set()
|
||||
for material in bpy.data.materials:
|
||||
if material.node_tree:
|
||||
if check_is_new_shading_material(material):
|
||||
square_roughness_node_insert(material, material.node_tree, traversed)
|
||||
|
||||
|
||||
@@ -232,40 +271,6 @@ def custom_bake_remap(scene):
|
||||
scene.render.bake.use_pass_indirect = False
|
||||
|
||||
|
||||
def ambient_occlusion_node_relink(material, nodetree, traversed):
|
||||
if nodetree in traversed:
|
||||
return
|
||||
traversed.add(nodetree)
|
||||
|
||||
for node in nodetree.nodes:
|
||||
if node.bl_idname == 'ShaderNodeAmbientOcclusion':
|
||||
node.samples = 1
|
||||
node.only_local = False
|
||||
node.inputs['Distance'].default_value = 0.0
|
||||
elif node.bl_idname == 'ShaderNodeGroup':
|
||||
ambient_occlusion_node_relink(material, node.node_tree, traversed)
|
||||
|
||||
# Gather links to replace
|
||||
ao_links = []
|
||||
for link in nodetree.links:
|
||||
if link.from_node.bl_idname == 'ShaderNodeAmbientOcclusion':
|
||||
ao_links.append(link)
|
||||
|
||||
# Replace links
|
||||
for link in ao_links:
|
||||
from_node = link.from_node
|
||||
to_socket = link.to_socket
|
||||
|
||||
nodetree.links.remove(link)
|
||||
nodetree.links.new(from_node.outputs['Color'], to_socket)
|
||||
|
||||
def ambient_occlusion_nodes_relink():
|
||||
traversed = set()
|
||||
for material in bpy.data.materials:
|
||||
if material.node_tree:
|
||||
ambient_occlusion_node_relink(material, material.node_tree, traversed)
|
||||
|
||||
|
||||
@persistent
|
||||
def do_versions(self):
|
||||
if bpy.context.user_preferences.version <= (2, 78, 1):
|
||||
@@ -354,12 +359,12 @@ def do_versions(self):
|
||||
if not cscene.is_property_set("tile_order"):
|
||||
cscene.tile_order = 'CENTER'
|
||||
|
||||
for light in bpy.data.lights:
|
||||
clight = light.cycles
|
||||
for lamp in bpy.data.lamps:
|
||||
clamp = lamp.cycles
|
||||
|
||||
# MIS
|
||||
if not clight.is_property_set("use_multiple_importance_sampling"):
|
||||
clight.use_multiple_importance_sampling = False
|
||||
if not clamp.is_property_set("use_multiple_importance_sampling"):
|
||||
clamp.use_multiple_importance_sampling = False
|
||||
|
||||
for mat in bpy.data.materials:
|
||||
cmat = mat.cycles
|
||||
@@ -372,6 +377,10 @@ def do_versions(self):
|
||||
for world in bpy.data.worlds:
|
||||
cworld = world.cycles
|
||||
|
||||
# World MIS
|
||||
if not cworld.is_property_set("sample_as_light"):
|
||||
cworld.sample_as_light = False
|
||||
|
||||
# World MIS Samples
|
||||
if not cworld.is_property_set("samples"):
|
||||
cworld.samples = 4
|
||||
@@ -435,16 +444,3 @@ def do_versions(self):
|
||||
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)
|
||||
|
||||
if bpy.data.version <= (2, 79, 4) or \
|
||||
(bpy.data.version >= (2, 80, 0) and bpy.data.version <= (2, 80, 18)):
|
||||
for world in bpy.data.worlds:
|
||||
cworld = world.cycles
|
||||
# World MIS
|
||||
if not cworld.is_property_set("sampling_method"):
|
||||
if cworld.get("sample_as_light", True):
|
||||
cworld.sampling_method = 'MANUAL'
|
||||
else:
|
||||
cworld.sampling_method = 'NONE'
|
||||
|
||||
ambient_occlusion_nodes_relink()
|
||||
|
@@ -90,7 +90,7 @@ struct BlenderCamera {
|
||||
static void blender_camera_init(BlenderCamera *bcam,
|
||||
BL::RenderSettings& b_render)
|
||||
{
|
||||
memset((void *)bcam, 0, sizeof(BlenderCamera));
|
||||
memset(bcam, 0, sizeof(BlenderCamera));
|
||||
|
||||
bcam->type = CAMERA_PERSPECTIVE;
|
||||
bcam->zoom = 1.0f;
|
||||
@@ -124,7 +124,7 @@ static float blender_camera_focal_distance(BL::RenderEngine& b_engine,
|
||||
|
||||
if(!b_dof_object)
|
||||
return b_camera.dof_distance();
|
||||
|
||||
|
||||
/* for dof object, return distance along camera Z direction */
|
||||
BL::Array<float, 16> b_ob_matrix;
|
||||
b_engine.camera_model_matrix(b_ob, bcam->use_spherical_stereo, b_ob_matrix);
|
||||
@@ -232,7 +232,7 @@ static void blender_camera_from_object(BlenderCamera *bcam,
|
||||
bcam->motion_steps = object_motion_steps(b_ob, b_ob);
|
||||
}
|
||||
else {
|
||||
/* from light not implemented yet */
|
||||
/* from lamp not implemented yet */
|
||||
}
|
||||
}
|
||||
|
||||
@@ -457,7 +457,6 @@ static void blender_camera_sync(Camera *cam,
|
||||
cam->matrix = blender_camera_matrix(bcam->matrix,
|
||||
bcam->type,
|
||||
bcam->panorama_type);
|
||||
cam->motion.clear();
|
||||
cam->motion.resize(bcam->motion_steps, cam->matrix);
|
||||
cam->use_perspective_motion = false;
|
||||
cam->shuttertime = bcam->shuttertime;
|
||||
@@ -726,7 +725,7 @@ static void blender_camera_view_subset(BL::RenderEngine& b_engine,
|
||||
|
||||
blender_camera_viewplane(&cam_bcam, cam_bcam.full_width, cam_bcam.full_height,
|
||||
&cam, &cam_aspect, &sensor_size);
|
||||
|
||||
|
||||
/* return */
|
||||
*view_box = view * (1.0f/view_aspect);
|
||||
*cam_box = cam * (1.0f/cam_aspect);
|
||||
@@ -895,3 +894,4 @@ BufferParams BlenderSync::get_buffer_params(BL::RenderSettings& b_render,
|
||||
}
|
||||
|
||||
CCL_NAMESPACE_END
|
||||
|
||||
|
@@ -770,18 +770,17 @@ static void ExportCurveTriangleVcol(ParticleCurveData *CData,
|
||||
|
||||
for(int curvekey = CData->curve_firstkey[curve]; curvekey < CData->curve_firstkey[curve] + CData->curve_keynum[curve] - 1; curvekey++) {
|
||||
for(int section = 0; section < resol; section++) {
|
||||
/* Encode vertex color using the sRGB curve. */
|
||||
cdata[vertexindex] = color_float_to_byte(color_srgb_to_linear_v3(CData->curve_vcol[curve]));
|
||||
cdata[vertexindex] = color_float_to_byte(color_srgb_to_scene_linear_v3(CData->curve_vcol[curve]));
|
||||
vertexindex++;
|
||||
cdata[vertexindex] = color_float_to_byte(color_srgb_to_linear_v3(CData->curve_vcol[curve]));
|
||||
cdata[vertexindex] = color_float_to_byte(color_srgb_to_scene_linear_v3(CData->curve_vcol[curve]));
|
||||
vertexindex++;
|
||||
cdata[vertexindex] = color_float_to_byte(color_srgb_to_linear_v3(CData->curve_vcol[curve]));
|
||||
cdata[vertexindex] = color_float_to_byte(color_srgb_to_scene_linear_v3(CData->curve_vcol[curve]));
|
||||
vertexindex++;
|
||||
cdata[vertexindex] = color_float_to_byte(color_srgb_to_linear_v3(CData->curve_vcol[curve]));
|
||||
cdata[vertexindex] = color_float_to_byte(color_srgb_to_scene_linear_v3(CData->curve_vcol[curve]));
|
||||
vertexindex++;
|
||||
cdata[vertexindex] = color_float_to_byte(color_srgb_to_linear_v3(CData->curve_vcol[curve]));
|
||||
cdata[vertexindex] = color_float_to_byte(color_srgb_to_scene_linear_v3(CData->curve_vcol[curve]));
|
||||
vertexindex++;
|
||||
cdata[vertexindex] = color_float_to_byte(color_srgb_to_linear_v3(CData->curve_vcol[curve]));
|
||||
cdata[vertexindex] = color_float_to_byte(color_srgb_to_scene_linear_v3(CData->curve_vcol[curve]));
|
||||
vertexindex++;
|
||||
}
|
||||
}
|
||||
@@ -994,10 +993,9 @@ void BlenderSync::sync_curves(Mesh *mesh,
|
||||
if(fdata) {
|
||||
size_t i = 0;
|
||||
|
||||
/* Encode vertex color using the sRGB curve. */
|
||||
for(size_t curve = 0; curve < CData.curve_vcol.size(); curve++)
|
||||
if(!(CData.curve_keynum[curve] <= 1 || CData.curve_length[curve] == 0.0f))
|
||||
fdata[i++] = color_srgb_to_linear_v3(CData.curve_vcol[curve]);
|
||||
fdata[i++] = color_srgb_to_scene_linear_v3(CData.curve_vcol[curve]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -401,8 +401,7 @@ static void attr_create_vertex_color(Scene *scene,
|
||||
int n = p->loop_total();
|
||||
for(int i = 0; i < n; i++) {
|
||||
float3 color = get_float3(l->data[p->loop_start() + i].color());
|
||||
/* Encode vertex color using the sRGB curve. */
|
||||
*(cdata++) = color_float_to_byte(color_srgb_to_linear_v3(color));
|
||||
*(cdata++) = color_float_to_byte(color_srgb_to_scene_linear_v3(color));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -425,13 +424,12 @@ static void attr_create_vertex_color(Scene *scene,
|
||||
int tri_a[3], tri_b[3];
|
||||
face_split_tri_indices(face_flags[i], tri_a, tri_b);
|
||||
|
||||
/* Encode vertex color using the sRGB curve. */
|
||||
uchar4 colors[4];
|
||||
colors[0] = color_float_to_byte(color_srgb_to_linear_v3(get_float3(c->color1())));
|
||||
colors[1] = color_float_to_byte(color_srgb_to_linear_v3(get_float3(c->color2())));
|
||||
colors[2] = color_float_to_byte(color_srgb_to_linear_v3(get_float3(c->color3())));
|
||||
colors[0] = color_float_to_byte(color_srgb_to_scene_linear_v3(get_float3(c->color1())));
|
||||
colors[1] = color_float_to_byte(color_srgb_to_scene_linear_v3(get_float3(c->color2())));
|
||||
colors[2] = color_float_to_byte(color_srgb_to_scene_linear_v3(get_float3(c->color3())));
|
||||
if(nverts[i] == 4) {
|
||||
colors[3] = color_float_to_byte(color_srgb_to_linear_v3(get_float3(c->color4())));
|
||||
colors[3] = color_float_to_byte(color_srgb_to_scene_linear_v3(get_float3(c->color4())));
|
||||
}
|
||||
|
||||
cdata[0] = colors[tri_a[0]];
|
||||
|
@@ -89,7 +89,7 @@ bool BlenderSync::object_is_light(BL::Object& b_ob)
|
||||
{
|
||||
BL::ID b_ob_data = b_ob.data();
|
||||
|
||||
return (b_ob_data && b_ob_data.is_a(&RNA_Light));
|
||||
return (b_ob_data && b_ob_data.is_a(&RNA_Lamp));
|
||||
}
|
||||
|
||||
static uint object_ray_visibility(BL::Object& b_ob)
|
||||
@@ -126,57 +126,57 @@ void BlenderSync::sync_light(BL::Object& b_parent,
|
||||
*use_portal = true;
|
||||
return;
|
||||
}
|
||||
|
||||
BL::Light b_light(b_ob.data());
|
||||
|
||||
BL::Lamp b_lamp(b_ob.data());
|
||||
|
||||
/* type */
|
||||
switch(b_light.type()) {
|
||||
case BL::Light::type_POINT: {
|
||||
BL::PointLight b_point_light(b_light);
|
||||
light->size = b_point_light.shadow_soft_size();
|
||||
switch(b_lamp.type()) {
|
||||
case BL::Lamp::type_POINT: {
|
||||
BL::PointLamp b_point_lamp(b_lamp);
|
||||
light->size = b_point_lamp.shadow_soft_size();
|
||||
light->type = LIGHT_POINT;
|
||||
break;
|
||||
}
|
||||
case BL::Light::type_SPOT: {
|
||||
BL::SpotLight b_spot_light(b_light);
|
||||
light->size = b_spot_light.shadow_soft_size();
|
||||
case BL::Lamp::type_SPOT: {
|
||||
BL::SpotLamp b_spot_lamp(b_lamp);
|
||||
light->size = b_spot_lamp.shadow_soft_size();
|
||||
light->type = LIGHT_SPOT;
|
||||
light->spot_angle = b_spot_light.spot_size();
|
||||
light->spot_smooth = b_spot_light.spot_blend();
|
||||
light->spot_angle = b_spot_lamp.spot_size();
|
||||
light->spot_smooth = b_spot_lamp.spot_blend();
|
||||
break;
|
||||
}
|
||||
case BL::Light::type_HEMI: {
|
||||
case BL::Lamp::type_HEMI: {
|
||||
light->type = LIGHT_DISTANT;
|
||||
light->size = 0.0f;
|
||||
break;
|
||||
}
|
||||
case BL::Light::type_SUN: {
|
||||
BL::SunLight b_sun_light(b_light);
|
||||
light->size = b_sun_light.shadow_soft_size();
|
||||
case BL::Lamp::type_SUN: {
|
||||
BL::SunLamp b_sun_lamp(b_lamp);
|
||||
light->size = b_sun_lamp.shadow_soft_size();
|
||||
light->type = LIGHT_DISTANT;
|
||||
break;
|
||||
}
|
||||
case BL::Light::type_AREA: {
|
||||
BL::AreaLight b_area_light(b_light);
|
||||
case BL::Lamp::type_AREA: {
|
||||
BL::AreaLamp b_area_lamp(b_lamp);
|
||||
light->size = 1.0f;
|
||||
light->axisu = transform_get_column(&tfm, 0);
|
||||
light->axisv = transform_get_column(&tfm, 1);
|
||||
light->sizeu = b_area_light.size();
|
||||
switch(b_area_light.shape()) {
|
||||
case BL::AreaLight::shape_SQUARE:
|
||||
light->sizeu = b_area_lamp.size();
|
||||
switch(b_area_lamp.shape()) {
|
||||
case BL::AreaLamp::shape_SQUARE:
|
||||
light->sizev = light->sizeu;
|
||||
light->round = false;
|
||||
break;
|
||||
case BL::AreaLight::shape_RECTANGLE:
|
||||
light->sizev = b_area_light.size_y();
|
||||
case BL::AreaLamp::shape_RECTANGLE:
|
||||
light->sizev = b_area_lamp.size_y();
|
||||
light->round = false;
|
||||
break;
|
||||
case BL::AreaLight::shape_DISK:
|
||||
case BL::AreaLamp::shape_DISK:
|
||||
light->sizev = light->sizeu;
|
||||
light->round = true;
|
||||
break;
|
||||
case BL::AreaLight::shape_ELLIPSE:
|
||||
light->sizev = b_area_light.size_y();
|
||||
case BL::AreaLamp::shape_ELLIPSE:
|
||||
light->sizev = b_area_lamp.size_y();
|
||||
light->round = true;
|
||||
break;
|
||||
}
|
||||
@@ -192,22 +192,22 @@ void BlenderSync::sync_light(BL::Object& b_parent,
|
||||
|
||||
/* shader */
|
||||
vector<Shader*> used_shaders;
|
||||
find_shader(b_light, used_shaders, scene->default_light);
|
||||
find_shader(b_lamp, used_shaders, scene->default_light);
|
||||
light->shader = used_shaders[0];
|
||||
|
||||
/* shadow */
|
||||
PointerRNA cscene = RNA_pointer_get(&b_scene.ptr, "cycles");
|
||||
PointerRNA clight = RNA_pointer_get(&b_light.ptr, "cycles");
|
||||
light->cast_shadow = get_boolean(clight, "cast_shadow");
|
||||
light->use_mis = get_boolean(clight, "use_multiple_importance_sampling");
|
||||
|
||||
int samples = get_int(clight, "samples");
|
||||
PointerRNA clamp = RNA_pointer_get(&b_lamp.ptr, "cycles");
|
||||
light->cast_shadow = get_boolean(clamp, "cast_shadow");
|
||||
light->use_mis = get_boolean(clamp, "use_multiple_importance_sampling");
|
||||
|
||||
int samples = get_int(clamp, "samples");
|
||||
if(get_boolean(cscene, "use_square_samples"))
|
||||
light->samples = samples * samples;
|
||||
else
|
||||
light->samples = samples;
|
||||
|
||||
light->max_bounces = get_int(clight, "max_bounces");
|
||||
light->max_bounces = get_int(clamp, "max_bounces");
|
||||
|
||||
if(b_ob != b_ob_instance) {
|
||||
light->random_id = random_id;
|
||||
@@ -217,7 +217,7 @@ void BlenderSync::sync_light(BL::Object& b_parent,
|
||||
}
|
||||
|
||||
if(light->type == LIGHT_AREA)
|
||||
light->is_portal = get_boolean(clight, "is_portal");
|
||||
light->is_portal = get_boolean(clamp, "is_portal");
|
||||
else
|
||||
light->is_portal = false;
|
||||
|
||||
@@ -242,15 +242,7 @@ void BlenderSync::sync_background_light(bool use_portal)
|
||||
if(b_world) {
|
||||
PointerRNA cscene = RNA_pointer_get(&b_scene.ptr, "cycles");
|
||||
PointerRNA cworld = RNA_pointer_get(&b_world.ptr, "cycles");
|
||||
|
||||
enum SamplingMethod {
|
||||
SAMPLING_NONE = 0,
|
||||
SAMPLING_AUTOMATIC,
|
||||
SAMPLING_MANUAL,
|
||||
SAMPLING_NUM
|
||||
};
|
||||
int sampling_method = get_enum(cworld, "sampling_method", SAMPLING_NUM, SAMPLING_AUTOMATIC);
|
||||
bool sample_as_light = (sampling_method != SAMPLING_NONE);
|
||||
bool sample_as_light = get_boolean(cworld, "sample_as_light");
|
||||
|
||||
if(sample_as_light || use_portal) {
|
||||
/* test if we need to sync */
|
||||
@@ -262,12 +254,7 @@ void BlenderSync::sync_background_light(bool use_portal)
|
||||
b_world.ptr.data != world_map)
|
||||
{
|
||||
light->type = LIGHT_BACKGROUND;
|
||||
if(sampling_method == SAMPLING_MANUAL) {
|
||||
light->map_resolution = get_int(cworld, "sample_map_resolution");
|
||||
}
|
||||
else {
|
||||
light->map_resolution = 0;
|
||||
}
|
||||
light->map_resolution = get_int(cworld, "sample_map_resolution");
|
||||
light->shader = scene->default_background;
|
||||
light->use_mis = sample_as_light;
|
||||
light->max_bounces = get_int(cworld, "max_bounces");
|
||||
@@ -315,7 +302,7 @@ Object *BlenderSync::sync_object(BL::Depsgraph& b_depsgraph,
|
||||
|
||||
/* light is handled separately */
|
||||
if(object_is_light(b_ob)) {
|
||||
/* don't use lights for excluded layers used as mask layer */
|
||||
/* don't use lamps for excluded layers used as mask layer */
|
||||
if(!motion && !((layer_flag & view_layer.holdout_layer) &&
|
||||
(layer_flag & view_layer.exclude_layer)))
|
||||
{
|
||||
@@ -394,7 +381,7 @@ Object *BlenderSync::sync_object(BL::Depsgraph& b_depsgraph,
|
||||
|
||||
if(object_map.sync(&object, b_ob, b_parent, key))
|
||||
object_updated = true;
|
||||
|
||||
|
||||
/* mesh sync */
|
||||
object->mesh = sync_mesh(b_depsgraph, b_ob, b_ob_instance, object_updated, hide_tris);
|
||||
|
||||
@@ -448,7 +435,6 @@ Object *BlenderSync::sync_object(BL::Depsgraph& b_depsgraph,
|
||||
mesh->motion_steps = motion_steps;
|
||||
}
|
||||
|
||||
object->motion.clear();
|
||||
object->motion.resize(motion_steps, transform_empty());
|
||||
|
||||
if(motion_steps) {
|
||||
@@ -543,7 +529,7 @@ static bool object_render_hide(BL::Object& b_ob,
|
||||
}
|
||||
parent = parent.parent();
|
||||
}
|
||||
|
||||
|
||||
hide_triangles = hide_emitter;
|
||||
|
||||
if(show_emitter) {
|
||||
@@ -563,7 +549,7 @@ void BlenderSync::sync_objects(BL::Depsgraph& b_depsgraph, float motion_time)
|
||||
{
|
||||
/* layer data */
|
||||
bool motion = motion_time != 0.0f;
|
||||
|
||||
|
||||
if(!motion) {
|
||||
/* prepare for sync */
|
||||
light_map.pre_sync();
|
||||
@@ -592,6 +578,9 @@ void BlenderSync::sync_objects(BL::Depsgraph& b_depsgraph, float motion_time)
|
||||
{
|
||||
BL::DepsgraphObjectInstance b_instance = *b_instance_iter;
|
||||
BL::Object b_ob = b_instance.object();
|
||||
if(!b_ob.is_visible()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
progress.set_sync_status("Synchronizing object", b_ob.name());
|
||||
|
||||
@@ -729,3 +718,4 @@ void BlenderSync::sync_motion(BL::RenderSettings& b_render,
|
||||
}
|
||||
|
||||
CCL_NAMESPACE_END
|
||||
|
||||
|
@@ -146,3 +146,4 @@ bool BlenderObjectCulling::test_distance(Scene *scene, float3 bb[8])
|
||||
}
|
||||
|
||||
CCL_NAMESPACE_END
|
||||
|
||||
|
@@ -68,7 +68,7 @@ bool BlenderSync::sync_dupli_particle(BL::Object& b_ob,
|
||||
/* add particle */
|
||||
BL::Particle b_pa = b_psys.particles[persistent_id[0]];
|
||||
Particle pa;
|
||||
|
||||
|
||||
pa.index = persistent_id[0];
|
||||
pa.age = b_scene.frame_current() - b_pa.birth_time();
|
||||
pa.lifetime = b_pa.lifetime();
|
||||
|
@@ -326,7 +326,7 @@ static PyObject *draw_func(PyObject * /*self*/, PyObject *args)
|
||||
|
||||
if(!PyArg_ParseTuple(args, "OOOO", &pysession, &pygraph, &pyv3d, &pyrv3d))
|
||||
return NULL;
|
||||
|
||||
|
||||
BlenderSession *session = (BlenderSession*)PyLong_AsVoidPtr(pysession);
|
||||
|
||||
if(PyLong_AsVoidPtr(pyrv3d)) {
|
||||
@@ -594,7 +594,7 @@ static PyObject *osl_compile_func(PyObject * /*self*/, PyObject *args)
|
||||
|
||||
if(!PyArg_ParseTuple(args, "ss", &inputfile, &outputfile))
|
||||
return NULL;
|
||||
|
||||
|
||||
/* return */
|
||||
if(!OSLShaderManager::osl_compile(inputfile, outputfile))
|
||||
Py_RETURN_FALSE;
|
||||
|
@@ -54,7 +54,6 @@ BlenderSession::BlenderSession(BL::RenderEngine& b_engine,
|
||||
BL::BlendData& b_data,
|
||||
bool preview_osl)
|
||||
: session(NULL),
|
||||
sync(NULL),
|
||||
b_engine(b_engine),
|
||||
b_userpref(b_userpref),
|
||||
b_data(b_data),
|
||||
@@ -82,7 +81,6 @@ BlenderSession::BlenderSession(BL::RenderEngine& b_engine,
|
||||
BL::RegionView3D& b_rv3d,
|
||||
int width, int height)
|
||||
: session(NULL),
|
||||
sync(NULL),
|
||||
b_engine(b_engine),
|
||||
b_userpref(b_userpref),
|
||||
b_data(b_data),
|
||||
@@ -211,8 +209,11 @@ void BlenderSession::reset_session(BL::BlendData& b_data, BL::Depsgraph& b_depsg
|
||||
/* if scene or session parameters changed, it's easier to simply re-create
|
||||
* them rather than trying to distinguish which settings need to be updated
|
||||
*/
|
||||
free_session();
|
||||
|
||||
delete session;
|
||||
|
||||
create_session();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -448,12 +449,11 @@ void BlenderSession::render(BL::Depsgraph& b_depsgraph_)
|
||||
BL::Object b_camera_override(b_engine.camera_override());
|
||||
sync->sync_camera(b_render, b_camera_override, width, height, b_rview_name.c_str());
|
||||
sync->sync_data(b_render,
|
||||
b_depsgraph,
|
||||
b_v3d,
|
||||
b_camera_override,
|
||||
width, height,
|
||||
&python_thread_state);
|
||||
builtin_images_load();
|
||||
b_depsgraph,
|
||||
b_v3d,
|
||||
b_camera_override,
|
||||
width, height,
|
||||
&python_thread_state);
|
||||
|
||||
/* Make sure all views have different noise patterns. - hardcoded value just to make it random */
|
||||
if(view_index != 0) {
|
||||
@@ -609,12 +609,11 @@ void BlenderSession::bake(BL::Depsgraph& b_depsgraph_,
|
||||
BL::Object b_camera_override(b_engine.camera_override());
|
||||
sync->sync_camera(b_render, b_camera_override, width, height, "");
|
||||
sync->sync_data(b_render,
|
||||
b_depsgraph,
|
||||
b_v3d,
|
||||
b_camera_override,
|
||||
width, height,
|
||||
&python_thread_state);
|
||||
builtin_images_load();
|
||||
b_depsgraph,
|
||||
b_v3d,
|
||||
b_camera_override,
|
||||
width, height,
|
||||
&python_thread_state);
|
||||
}
|
||||
|
||||
BakeData *bake_data = NULL;
|
||||
@@ -804,8 +803,6 @@ void BlenderSession::synchronize(BL::Depsgraph& b_depsgraph_)
|
||||
else
|
||||
sync->sync_camera(b_render, b_camera_override, width, height, "");
|
||||
|
||||
builtin_images_load();
|
||||
|
||||
/* unlock */
|
||||
session->scene->mutex.unlock();
|
||||
|
||||
@@ -1330,16 +1327,6 @@ bool BlenderSession::builtin_image_float_pixels(const string &builtin_name,
|
||||
return false;
|
||||
}
|
||||
|
||||
void BlenderSession::builtin_images_load()
|
||||
{
|
||||
/* Force builtin images to be loaded along with Blender data sync. This
|
||||
* is needed because we may be reading from depsgraph evaluated data which
|
||||
* can be freed by Blender before Cycles reads it. */
|
||||
ImageManager *manager = session->scene->image_manager;
|
||||
Device *device = session->device;
|
||||
manager->device_load_builtin(device, session->scene, session->progress);
|
||||
}
|
||||
|
||||
void BlenderSession::update_resumable_tile_manager(int num_samples)
|
||||
{
|
||||
const int num_resumable_chunks = BlenderSession::num_resumable_chunks,
|
||||
|
@@ -166,7 +166,6 @@ protected:
|
||||
float *pixels,
|
||||
const size_t pixels_size,
|
||||
const bool free_cache);
|
||||
void builtin_images_load();
|
||||
|
||||
/* Update tile manager to reflect resumable render settings. */
|
||||
void update_resumable_tile_manager(int num_samples);
|
||||
|
@@ -154,7 +154,7 @@ static SocketType::Type convert_socket_type(BL::NodeSocket& b_socket)
|
||||
return SocketType::STRING;
|
||||
case BL::NodeSocket::type_SHADER:
|
||||
return SocketType::CLOSURE;
|
||||
|
||||
|
||||
default:
|
||||
return SocketType::UNDEFINED;
|
||||
}
|
||||
@@ -436,7 +436,7 @@ static ShaderNode *add_node(Scene *scene,
|
||||
else if(b_node.is_a(&RNA_ShaderNodeBsdfGlossy)) {
|
||||
BL::ShaderNodeBsdfGlossy b_glossy_node(b_node);
|
||||
GlossyBsdfNode *glossy = new GlossyBsdfNode();
|
||||
|
||||
|
||||
switch(b_glossy_node.distribution()) {
|
||||
case BL::ShaderNodeBsdfGlossy::distribution_SHARP:
|
||||
glossy->distribution = CLOSURE_BSDF_REFLECTION_ID;
|
||||
@@ -551,12 +551,7 @@ static ShaderNode *add_node(Scene *scene,
|
||||
node = new EmissionNode();
|
||||
}
|
||||
else if(b_node.is_a(&RNA_ShaderNodeAmbientOcclusion)) {
|
||||
BL::ShaderNodeAmbientOcclusion b_ao_node(b_node);
|
||||
AmbientOcclusionNode *ao = new AmbientOcclusionNode();
|
||||
ao->samples = b_ao_node.samples();
|
||||
ao->inside = b_ao_node.inside();
|
||||
ao->only_local = b_ao_node.only_local();
|
||||
node = ao;
|
||||
node = new AmbientOcclusionNode();
|
||||
}
|
||||
else if(b_node.is_a(&RNA_ShaderNodeVolumeScatter)) {
|
||||
node = new ScatterVolumeNode();
|
||||
@@ -867,11 +862,9 @@ static ShaderNode *add_node(Scene *scene,
|
||||
point_density->space = (NodeTexVoxelSpace)b_point_density_node.space();
|
||||
point_density->interpolation = get_image_interpolation(b_point_density_node);
|
||||
point_density->builtin_data = b_point_density_node.ptr.data;
|
||||
point_density->image_manager = scene->image_manager;
|
||||
|
||||
/* TODO(sergey): Use more proper update flag. */
|
||||
if(true) {
|
||||
point_density->add_image();
|
||||
b_point_density_node.cache_point_density(b_depsgraph);
|
||||
scene->image_manager->tag_reload_image(
|
||||
point_density->filename.string(),
|
||||
@@ -940,7 +933,7 @@ static ShaderInput *node_find_input_by_name(ShaderNode *node,
|
||||
BL::NodeSocket& b_socket)
|
||||
{
|
||||
string name = b_socket.name();
|
||||
|
||||
|
||||
if(node_use_modified_socket_name(node)) {
|
||||
BL::Node::inputs_iterator b_input;
|
||||
bool found = false;
|
||||
@@ -1001,6 +994,31 @@ static ShaderOutput *node_find_output_by_name(ShaderNode *node,
|
||||
return node->output(name.c_str());
|
||||
}
|
||||
|
||||
static BL::ShaderNode find_output_node(BL::ShaderNodeTree& b_ntree)
|
||||
{
|
||||
BL::ShaderNodeTree::nodes_iterator b_node;
|
||||
BL::ShaderNode output_node(PointerRNA_NULL);
|
||||
|
||||
for(b_ntree.nodes.begin(b_node); b_node != b_ntree.nodes.end(); ++b_node) {
|
||||
BL::ShaderNodeOutputMaterial b_output_node(*b_node);
|
||||
|
||||
if (b_output_node.is_a(&RNA_ShaderNodeOutputMaterial) ||
|
||||
b_output_node.is_a(&RNA_ShaderNodeOutputWorld) ||
|
||||
b_output_node.is_a(&RNA_ShaderNodeOutputLamp)) {
|
||||
/* regular Cycles output node */
|
||||
if(b_output_node.is_active_output()) {
|
||||
output_node = b_output_node;
|
||||
break;
|
||||
}
|
||||
else if(!output_node.ptr.data) {
|
||||
output_node = b_output_node;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return output_node;
|
||||
}
|
||||
|
||||
static void add_nodes(Scene *scene,
|
||||
BL::RenderEngine& b_engine,
|
||||
BL::BlendData& b_data,
|
||||
@@ -1020,7 +1038,7 @@ static void add_nodes(Scene *scene,
|
||||
BL::Node::outputs_iterator b_output;
|
||||
|
||||
/* find the node to use for output if there are multiple */
|
||||
BL::ShaderNode output_node = b_ntree.get_output_node(BL::ShaderNodeOutputMaterial::target_CYCLES);
|
||||
BL::ShaderNode output_node = find_output_node(b_ntree);
|
||||
|
||||
/* add nodes */
|
||||
for(b_ntree.nodes.begin(b_node); b_node != b_ntree.nodes.end(); ++b_node) {
|
||||
@@ -1043,7 +1061,7 @@ static void add_nodes(Scene *scene,
|
||||
}
|
||||
}
|
||||
else if(b_node->is_a(&RNA_ShaderNodeGroup) || b_node->is_a(&RNA_NodeCustomGroup)) {
|
||||
|
||||
|
||||
BL::ShaderNodeTree b_group_ntree(PointerRNA_NULL);
|
||||
if(b_node->is_a(&RNA_ShaderNodeGroup))
|
||||
b_group_ntree = BL::ShaderNodeTree(((BL::NodeGroup)(*b_node)).node_tree());
|
||||
@@ -1085,7 +1103,7 @@ static void add_nodes(Scene *scene,
|
||||
|
||||
output_map[b_output->ptr.data] = proxy->outputs[0];
|
||||
}
|
||||
|
||||
|
||||
if(b_group_ntree) {
|
||||
add_nodes(scene,
|
||||
b_engine,
|
||||
@@ -1393,45 +1411,45 @@ void BlenderSync::sync_world(BL::Depsgraph& b_depsgraph, bool update_all)
|
||||
background->tag_update(scene);
|
||||
}
|
||||
|
||||
/* Sync Lights */
|
||||
/* Sync Lamps */
|
||||
|
||||
void BlenderSync::sync_lights(BL::Depsgraph& b_depsgraph, bool update_all)
|
||||
void BlenderSync::sync_lamps(BL::Depsgraph& b_depsgraph, bool update_all)
|
||||
{
|
||||
shader_map.set_default(scene->default_light);
|
||||
|
||||
BL::Depsgraph::ids_iterator b_id;
|
||||
for(b_depsgraph.ids.begin(b_id); b_id != b_depsgraph.ids.end(); ++b_id) {
|
||||
if (!b_id->is_a(&RNA_Light)) {
|
||||
if (!b_id->is_a(&RNA_Lamp)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
BL::Light b_light(*b_id);
|
||||
BL::Lamp b_lamp(*b_id);
|
||||
Shader *shader;
|
||||
|
||||
/* test if we need to sync */
|
||||
if(shader_map.sync(&shader, b_light) || update_all) {
|
||||
if(shader_map.sync(&shader, b_lamp) || update_all) {
|
||||
ShaderGraph *graph = new ShaderGraph();
|
||||
|
||||
/* create nodes */
|
||||
if(b_light.use_nodes() && b_light.node_tree()) {
|
||||
shader->name = b_light.name().c_str();
|
||||
if(b_lamp.use_nodes() && b_lamp.node_tree()) {
|
||||
shader->name = b_lamp.name().c_str();
|
||||
|
||||
BL::ShaderNodeTree b_ntree(b_light.node_tree());
|
||||
BL::ShaderNodeTree b_ntree(b_lamp.node_tree());
|
||||
|
||||
add_nodes(scene, b_engine, b_data, b_depsgraph, b_scene, graph, b_ntree);
|
||||
}
|
||||
else {
|
||||
float strength = 1.0f;
|
||||
|
||||
if(b_light.type() == BL::Light::type_POINT ||
|
||||
b_light.type() == BL::Light::type_SPOT ||
|
||||
b_light.type() == BL::Light::type_AREA)
|
||||
if(b_lamp.type() == BL::Lamp::type_POINT ||
|
||||
b_lamp.type() == BL::Lamp::type_SPOT ||
|
||||
b_lamp.type() == BL::Lamp::type_AREA)
|
||||
{
|
||||
strength = 100.0f;
|
||||
}
|
||||
|
||||
EmissionNode *emission = new EmissionNode();
|
||||
emission->color = get_float3(b_light.color());
|
||||
emission->color = get_float3(b_lamp.color());
|
||||
emission->strength = strength;
|
||||
graph->add(emission);
|
||||
|
||||
@@ -1459,7 +1477,7 @@ void BlenderSync::sync_shaders(BL::Depsgraph& b_depsgraph)
|
||||
shader_map.pre_sync();
|
||||
|
||||
sync_world(b_depsgraph, auto_refresh_update);
|
||||
sync_lights(b_depsgraph, auto_refresh_update);
|
||||
sync_lamps(b_depsgraph, auto_refresh_update);
|
||||
sync_materials(b_depsgraph, auto_refresh_update);
|
||||
|
||||
/* false = don't delete unused shaders, not supported */
|
||||
@@ -1467,3 +1485,4 @@ void BlenderSync::sync_shaders(BL::Depsgraph& b_depsgraph)
|
||||
}
|
||||
|
||||
CCL_NAMESPACE_END
|
||||
|
||||
|
@@ -113,17 +113,17 @@ void BlenderSync::sync_recalc(BL::Depsgraph& b_depsgraph)
|
||||
BL::Material b_mat(b_id);
|
||||
shader_map.set_recalc(b_mat);
|
||||
}
|
||||
/* Light */
|
||||
else if (b_id.is_a(&RNA_Light)) {
|
||||
BL::Light b_light(b_id);
|
||||
shader_map.set_recalc(b_light);
|
||||
/* 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->is_dirty_geometry();
|
||||
const bool updated_geometry = b_update->updated_geometry();
|
||||
|
||||
if (!b_update->is_dirty_transform()) {
|
||||
if (b_update->updated_transform()) {
|
||||
object_map.set_recalc(b_ob);
|
||||
light_map.set_recalc(b_ob);
|
||||
}
|
||||
@@ -177,7 +177,7 @@ void BlenderSync::sync_recalc(BL::Depsgraph& b_depsgraph)
|
||||
}
|
||||
|
||||
void BlenderSync::sync_data(BL::RenderSettings& b_render,
|
||||
BL::Depsgraph& b_depsgraph,
|
||||
BL::Depsgraph& b_depsgraph,
|
||||
BL::SpaceView3D& b_v3d,
|
||||
BL::Object& b_override,
|
||||
int width, int height,
|
||||
@@ -292,7 +292,7 @@ void BlenderSync::sync_integrator()
|
||||
integrator->mesh_light_samples = mesh_light_samples * mesh_light_samples;
|
||||
integrator->subsurface_samples = subsurface_samples * subsurface_samples;
|
||||
integrator->volume_samples = volume_samples * volume_samples;
|
||||
}
|
||||
}
|
||||
else {
|
||||
integrator->diffuse_samples = diffuse_samples;
|
||||
integrator->glossy_samples = glossy_samples;
|
||||
@@ -327,7 +327,7 @@ void BlenderSync::sync_film()
|
||||
|
||||
Film *film = scene->film;
|
||||
Film prevfilm = *film;
|
||||
|
||||
|
||||
film->exposure = get_float(cscene, "film_exposure");
|
||||
film->filter_type = (FilterType)get_enum(cscene,
|
||||
"pixel_filter_type",
|
||||
@@ -580,7 +580,7 @@ SceneParams BlenderSync::get_scene_params(BL::Scene& b_scene,
|
||||
params.shadingsystem = SHADINGSYSTEM_SVM;
|
||||
else if(shadingsystem == 1)
|
||||
params.shadingsystem = SHADINGSYSTEM_OSL;
|
||||
|
||||
|
||||
if(background || DebugFlags().viewport_static_bvh)
|
||||
params.bvh_type = SceneParams::BVH_STATIC;
|
||||
else
|
||||
@@ -645,7 +645,7 @@ SessionParams BlenderSync::get_session_params(BL::RenderEngine& b_engine,
|
||||
|
||||
/* device type */
|
||||
vector<DeviceInfo>& devices = Device::available_devices();
|
||||
|
||||
|
||||
/* device default CPU */
|
||||
foreach(DeviceInfo& device, devices) {
|
||||
if(device.type == DEVICE_CPU) {
|
||||
@@ -720,7 +720,7 @@ SessionParams BlenderSync::get_session_params(BL::RenderEngine& b_engine,
|
||||
int aa_samples = get_int(cscene, "aa_samples");
|
||||
int preview_samples = get_int(cscene, "preview_samples");
|
||||
int preview_aa_samples = get_int(cscene, "preview_aa_samples");
|
||||
|
||||
|
||||
if(get_boolean(cscene, "use_square_samples")) {
|
||||
aa_samples = aa_samples * aa_samples;
|
||||
preview_aa_samples = preview_aa_samples * preview_aa_samples;
|
||||
@@ -817,7 +817,7 @@ SessionParams BlenderSync::get_session_params(BL::RenderEngine& b_engine,
|
||||
params.shadingsystem = SHADINGSYSTEM_SVM;
|
||||
else if(shadingsystem == 1)
|
||||
params.shadingsystem = SHADINGSYSTEM_OSL;
|
||||
|
||||
|
||||
/* color managagement */
|
||||
params.display_buffer_linear = GLEW_ARB_half_float_pixel &&
|
||||
b_engine.support_display_space_shader(b_scene);
|
||||
@@ -833,3 +833,4 @@ SessionParams BlenderSync::get_session_params(BL::RenderEngine& b_engine,
|
||||
}
|
||||
|
||||
CCL_NAMESPACE_END
|
||||
|
||||
|
@@ -100,7 +100,7 @@ public:
|
||||
|
||||
private:
|
||||
/* sync */
|
||||
void sync_lights(BL::Depsgraph& b_depsgraph, bool update_all);
|
||||
void sync_lamps(BL::Depsgraph& b_depsgraph, bool update_all);
|
||||
void sync_materials(BL::Depsgraph& b_depsgraph, bool update_all);
|
||||
void sync_objects(BL::Depsgraph& b_depsgraph, float motion_time = 0.0f);
|
||||
void sync_motion(BL::RenderSettings& b_render,
|
||||
@@ -218,3 +218,4 @@ private:
|
||||
CCL_NAMESPACE_END
|
||||
|
||||
#endif /* __BLENDER_SYNC_H__ */
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user