Merge branch 'master' into microfacet_hair
This commit is contained in:
commit
a8608aab3d
|
@ -117,8 +117,8 @@ enable_testing()
|
|||
# Keep in sync with: https://wiki.blender.org/wiki/Building_Blender
|
||||
|
||||
if(CMAKE_COMPILER_IS_GNUCC)
|
||||
if("${CMAKE_C_COMPILER_VERSION}" VERSION_LESS "9.3.1")
|
||||
message(FATAL_ERROR "The minimum supported version of GCC is 9.3.1")
|
||||
if("${CMAKE_C_COMPILER_VERSION}" VERSION_LESS "11.0.0")
|
||||
message(FATAL_ERROR "The minimum supported version of GCC is 11.0.0")
|
||||
endif()
|
||||
elseif(CMAKE_C_COMPILER_ID MATCHES "Clang")
|
||||
if(CMAKE_COMPILER_IS_GNUCC AND ("${CMAKE_C_COMPILER_VERSION}" VERSION_LESS "8.0"))
|
||||
|
@ -576,8 +576,8 @@ 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_GPU_BUILDTIME_SHADER_BUILDER "Shader builder is a developer option enabling linting on GLSL during compilation" OFF)
|
||||
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_GPU_BUILDTIME_SHADER_BUILDER "Shader builder is a developer option enabling linting on GLSL during compilation" OFF)
|
||||
|
||||
mark_as_advanced(
|
||||
WITH_OPENGL
|
||||
|
@ -2011,7 +2011,7 @@ set(LIBDIR_STALE)
|
|||
|
||||
if(UNIX AND NOT APPLE)
|
||||
# Only search for the path if it's found on the system.
|
||||
if (EXISTS "../lib/linux_centos7_x86_64")
|
||||
if(EXISTS "../lib/linux_centos7_x86_64")
|
||||
set(LIBDIR_STALE "/lib/linux_centos7_x86_64/")
|
||||
endif()
|
||||
endif()
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
|
||||
set(SBOMCONTENTS)
|
||||
get_cmake_property(_variableNames VARIABLES)
|
||||
foreach (_variableName ${_variableNames})
|
||||
foreach(_variableName ${_variableNames})
|
||||
if(_variableName MATCHES "CPE$")
|
||||
string(REPLACE ":" ";" CPE_LIST ${${_variableName}})
|
||||
string(REPLACE "_CPE" "_ID" CPE_DEPNAME ${_variableName})
|
||||
|
|
|
@ -10,22 +10,22 @@ function(download_source dep)
|
|||
if(PACKAGE_USE_UPSTREAM_SOURCES)
|
||||
set(TARGET_URI ${${dep}_URI})
|
||||
elseif(BLENDER_VERSION)
|
||||
set(TARGET_URI https://svn.blender.org/svnroot/bf-blender/tags/blender-${BLENDER_VERSION}-release/lib/packages/${TARGET_FILE})
|
||||
set(TARGET_URI https://svn.blender.org/svnroot/bf-blender/tags/blender-${BLENDER_VERSION}-release/lib/packages/${TARGET_FILE})
|
||||
else()
|
||||
set(TARGET_URI https://svn.blender.org/svnroot/bf-blender/trunk/lib/packages/${TARGET_FILE})
|
||||
set(TARGET_URI https://svn.blender.org/svnroot/bf-blender/trunk/lib/packages/${TARGET_FILE})
|
||||
endif()
|
||||
# Validate all required variables are set and give an explicit error message
|
||||
# rather than CMake erroring out later on with a more ambigious error.
|
||||
if (NOT DEFINED TARGET_FILE)
|
||||
if(NOT DEFINED TARGET_FILE)
|
||||
message(FATAL_ERROR "${dep}_FILE variable not set")
|
||||
endif()
|
||||
if (NOT DEFINED TARGET_HASH)
|
||||
if(NOT DEFINED TARGET_HASH)
|
||||
message(FATAL_ERROR "${dep}_HASH variable not set")
|
||||
endif()
|
||||
if (NOT DEFINED TARGET_HASH_TYPE)
|
||||
if(NOT DEFINED TARGET_HASH_TYPE)
|
||||
message(FATAL_ERROR "${dep}_HASH_TYPE variable not set")
|
||||
endif()
|
||||
if (NOT DEFINED TARGET_URI)
|
||||
if(NOT DEFINED TARGET_URI)
|
||||
message(FATAL_ERROR "${dep}_URI variable not set")
|
||||
endif()
|
||||
set(TARGET_FILE ${PACKAGE_DIR}/${TARGET_FILE})
|
||||
|
@ -43,11 +43,11 @@ function(download_source dep)
|
|||
if(EXISTS ${TARGET_FILE})
|
||||
# Sometimes the download fails, but that is not a
|
||||
# fail condition for "file(DOWNLOAD" it will warn about
|
||||
# a crc mismatch and just carry on, we need to explicitly
|
||||
# a CRC mismatch and just carry on, we need to explicitly
|
||||
# catch this and remove the bogus 0 byte file so we can
|
||||
# retry without having to go find the file and manually
|
||||
# delete it.
|
||||
file (SIZE ${TARGET_FILE} TARGET_SIZE)
|
||||
file(SIZE ${TARGET_FILE} TARGET_SIZE)
|
||||
if(${TARGET_SIZE} EQUAL 0)
|
||||
file(REMOVE ${TARGET_FILE})
|
||||
message(FATAL_ERROR "for ${TARGET_FILE} file size 0, download likely failed, deleted...")
|
||||
|
|
|
@ -15,10 +15,11 @@ set(EMBREE_EXTRA_ARGS
|
|||
-DTBB_ROOT=${LIBDIR}/tbb
|
||||
)
|
||||
|
||||
if (NOT BLENDER_PLATFORM_ARM)
|
||||
if(NOT BLENDER_PLATFORM_ARM)
|
||||
set(EMBREE_EXTRA_ARGS
|
||||
${EMBREE_EXTRA_ARGS}
|
||||
-DEMBREE_MAX_ISA=AVX2)
|
||||
-DEMBREE_MAX_ISA=AVX2
|
||||
)
|
||||
endif()
|
||||
|
||||
if(TBB_STATIC_LIBRARY)
|
||||
|
@ -52,17 +53,17 @@ if(WIN32)
|
|||
)
|
||||
else()
|
||||
ExternalProject_Add_Step(external_embree after_install
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/embree/lib/embree3.lib ${HARVEST_TARGET}/embree/lib/embree3_d.lib
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/embree/lib/embree_avx.lib ${HARVEST_TARGET}/embree/lib/embree_avx_d.lib
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/embree/lib/embree_avx2.lib ${HARVEST_TARGET}/embree/lib/embree_avx2_d.lib
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/embree/lib/embree_sse42.lib ${HARVEST_TARGET}/embree/lib/embree_sse42_d.lib
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/embree/lib/lexers.lib ${HARVEST_TARGET}/embree/lib/lexers_d.lib
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/embree/lib/math.lib ${HARVEST_TARGET}/embree/lib/math_d.lib
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/embree/lib/simd.lib ${HARVEST_TARGET}/embree/lib/simd_d.lib
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/embree/lib/sys.lib ${HARVEST_TARGET}/embree/lib/sys_d.lib
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/embree/lib/tasking.lib ${HARVEST_TARGET}/embree/lib/tasking_d.lib
|
||||
DEPENDEES install
|
||||
)
|
||||
endif()
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/embree/lib/embree3.lib ${HARVEST_TARGET}/embree/lib/embree3_d.lib
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/embree/lib/embree_avx.lib ${HARVEST_TARGET}/embree/lib/embree_avx_d.lib
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/embree/lib/embree_avx2.lib ${HARVEST_TARGET}/embree/lib/embree_avx2_d.lib
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/embree/lib/embree_sse42.lib ${HARVEST_TARGET}/embree/lib/embree_sse42_d.lib
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/embree/lib/lexers.lib ${HARVEST_TARGET}/embree/lib/lexers_d.lib
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/embree/lib/math.lib ${HARVEST_TARGET}/embree/lib/math_d.lib
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/embree/lib/simd.lib ${HARVEST_TARGET}/embree/lib/simd_d.lib
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/embree/lib/sys.lib ${HARVEST_TARGET}/embree/lib/sys_d.lib
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/embree/lib/tasking.lib ${HARVEST_TARGET}/embree/lib/tasking_d.lib
|
||||
DEPENDEES install
|
||||
)
|
||||
endif()
|
||||
|
||||
endif()
|
||||
|
|
|
@ -40,10 +40,10 @@ endif()
|
|||
|
||||
if(BUILD_MODE STREQUAL Release AND WIN32)
|
||||
ExternalProject_Add_Step(external_gmp after_install
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${BUILD_DIR}/gmp/src/external_gmp/.libs/libgmp-3.dll.def ${BUILD_DIR}/gmp/src/external_gmp/.libs/libgmp-10.def
|
||||
COMMAND lib /def:${BUILD_DIR}/gmp/src/external_gmp/.libs/libgmp-10.def /machine:x64 /out:${BUILD_DIR}/gmp/src/external_gmp/.libs/libgmp-10.lib
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/gmp/bin/libgmp-10.dll ${HARVEST_TARGET}/gmp/lib/libgmp-10.dll
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${BUILD_DIR}/gmp/src/external_gmp/.libs/libgmp-10.lib ${HARVEST_TARGET}/gmp/lib/libgmp-10.lib
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${BUILD_DIR}/gmp/src/external_gmp/.libs/libgmp-3.dll.def ${BUILD_DIR}/gmp/src/external_gmp/.libs/libgmp-10.def
|
||||
COMMAND lib /def:${BUILD_DIR}/gmp/src/external_gmp/.libs/libgmp-10.def /machine:x64 /out:${BUILD_DIR}/gmp/src/external_gmp/.libs/libgmp-10.lib
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/gmp/bin/libgmp-10.dll ${HARVEST_TARGET}/gmp/lib/libgmp-10.dll
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${BUILD_DIR}/gmp/src/external_gmp/.libs/libgmp-10.lib ${HARVEST_TARGET}/gmp/lib/libgmp-10.lib
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/gmp/include ${HARVEST_TARGET}/gmp/include
|
||||
|
||||
DEPENDEES install
|
||||
|
@ -52,8 +52,8 @@ endif()
|
|||
|
||||
if(BUILD_MODE STREQUAL Debug AND WIN32)
|
||||
ExternalProject_Add_Step(external_gmp after_install
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${BUILD_DIR}/gmp/src/external_gmp/.libs/libgmp-3.dll.def ${BUILD_DIR}/gmp/src/external_gmp/.libs/libgmp-10.def
|
||||
COMMAND lib /def:${BUILD_DIR}/gmp/src/external_gmp/.libs/libgmp-10.def /machine:x64 /out:${BUILD_DIR}/gmp/src/external_gmp/.libs/libgmp-10.lib
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${BUILD_DIR}/gmp/src/external_gmp/.libs/libgmp-3.dll.def ${BUILD_DIR}/gmp/src/external_gmp/.libs/libgmp-10.def
|
||||
COMMAND lib /def:${BUILD_DIR}/gmp/src/external_gmp/.libs/libgmp-10.def /machine:x64 /out:${BUILD_DIR}/gmp/src/external_gmp/.libs/libgmp-10.lib
|
||||
|
||||
DEPENDEES install
|
||||
)
|
||||
|
|
|
@ -11,276 +11,301 @@ message("HARVEST_TARGET = ${HARVEST_TARGET}")
|
|||
|
||||
if(WIN32)
|
||||
|
||||
if(BUILD_MODE STREQUAL Release)
|
||||
add_custom_target(Harvest_Release_Results
|
||||
COMMAND # jpeg rename libfile + copy include
|
||||
if(BUILD_MODE STREQUAL Release)
|
||||
add_custom_target(Harvest_Release_Results
|
||||
COMMAND # JPEG rename lib-file + copy include.
|
||||
${CMAKE_COMMAND} -E copy ${LIBDIR}/jpeg/lib/jpeg-static.lib ${HARVEST_TARGET}/jpeg/lib/libjpeg.lib &&
|
||||
${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/jpeg/include/ ${HARVEST_TARGET}/jpeg/include/ &&
|
||||
# png
|
||||
# PNG.
|
||||
${CMAKE_COMMAND} -E copy ${LIBDIR}/png/lib/libpng16_static.lib ${HARVEST_TARGET}/png/lib/libpng.lib &&
|
||||
${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/png/include/ ${HARVEST_TARGET}/png/include/ &&
|
||||
# freeglut-> opengl
|
||||
# FREEGLUT -> OPENGL.
|
||||
${CMAKE_COMMAND} -E copy ${LIBDIR}/freeglut/lib/freeglut_static.lib ${HARVEST_TARGET}/opengl/lib/freeglut_static.lib &&
|
||||
${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/freeglut/include/ ${HARVEST_TARGET}/opengl/include/ &&
|
||||
DEPENDS
|
||||
)
|
||||
endif()
|
||||
|
||||
else(WIN32)
|
||||
|
||||
function(harvest from to)
|
||||
set(pattern "")
|
||||
foreach(f ${ARGN})
|
||||
set(pattern ${f})
|
||||
endforeach()
|
||||
|
||||
if(pattern STREQUAL "")
|
||||
get_filename_component(dirpath ${to} DIRECTORY)
|
||||
get_filename_component(filename ${to} NAME)
|
||||
install(
|
||||
FILES ${LIBDIR}/${from}
|
||||
DESTINATION ${HARVEST_TARGET}/${dirpath}
|
||||
RENAME ${filename}
|
||||
)
|
||||
else()
|
||||
install(
|
||||
DIRECTORY ${LIBDIR}/${from}/
|
||||
DESTINATION ${HARVEST_TARGET}/${to}
|
||||
USE_SOURCE_PERMISSIONS
|
||||
FILES_MATCHING PATTERN ${pattern}
|
||||
PATTERN "pkgconfig" EXCLUDE
|
||||
PATTERN "cmake" EXCLUDE
|
||||
PATTERN "__pycache__" EXCLUDE
|
||||
PATTERN "tests" EXCLUDE
|
||||
PATTERN "meson*" EXCLUDE
|
||||
DEPENDS
|
||||
)
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
# Set rpath on shared libraries to $ORIGIN since all will be installed in the same
|
||||
# lib folder, and remove any absolute paths.
|
||||
#
|
||||
# Ideally this would be done as part of the Blender build since it makes assumptions
|
||||
# about where the files will be installed. However it would add patchelf as a new
|
||||
# dependency for building.
|
||||
#
|
||||
# Also removes versioned symlinks, which give errors with macOS notarization.
|
||||
if(APPLE)
|
||||
set(set_rpath_cmd python3 ${CMAKE_CURRENT_SOURCE_DIR}/darwin/set_rpath.py @loader_path)
|
||||
else()
|
||||
set(set_rpath_cmd patchelf --set-rpath $ORIGIN)
|
||||
endif()
|
||||
|
||||
function(harvest_rpath_lib from to pattern)
|
||||
harvest(${from} ${to} ${pattern})
|
||||
function(harvest from to)
|
||||
set(pattern "")
|
||||
foreach(f ${ARGN})
|
||||
set(pattern ${f})
|
||||
endforeach()
|
||||
|
||||
install(CODE "\
|
||||
cmake_policy(SET CMP0009 NEW)\n
|
||||
file(GLOB_RECURSE shared_libs ${HARVEST_TARGET}/${to}/${pattern}) \n
|
||||
foreach(f \${shared_libs}) \n
|
||||
if(IS_SYMLINK \${f})\n
|
||||
if(APPLE)\n
|
||||
file(REMOVE_RECURSE \${f})
|
||||
if(pattern STREQUAL "")
|
||||
get_filename_component(dirpath ${to} DIRECTORY)
|
||||
get_filename_component(filename ${to} NAME)
|
||||
install(
|
||||
FILES ${LIBDIR}/${from}
|
||||
DESTINATION ${HARVEST_TARGET}/${dirpath}
|
||||
RENAME ${filename}
|
||||
)
|
||||
else()
|
||||
install(
|
||||
DIRECTORY ${LIBDIR}/${from}/
|
||||
DESTINATION ${HARVEST_TARGET}/${to}
|
||||
USE_SOURCE_PERMISSIONS
|
||||
FILES_MATCHING PATTERN ${pattern}
|
||||
PATTERN "pkgconfig" EXCLUDE
|
||||
PATTERN "cmake" EXCLUDE
|
||||
PATTERN "__pycache__" EXCLUDE
|
||||
PATTERN "tests" EXCLUDE
|
||||
PATTERN "meson*" EXCLUDE
|
||||
)
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
# Set rpath on shared libraries to $ORIGIN since all will be installed in the same
|
||||
# lib folder, and remove any absolute paths.
|
||||
#
|
||||
# Ideally this would be done as part of the Blender build since it makes assumptions
|
||||
# about where the files will be installed. However it would add patchelf as a new
|
||||
# dependency for building.
|
||||
#
|
||||
# Also removes versioned symlinks, which give errors with macOS notarization.
|
||||
if(APPLE)
|
||||
set(set_rpath_cmd python3 ${CMAKE_CURRENT_SOURCE_DIR}/darwin/set_rpath.py @loader_path)
|
||||
else()
|
||||
set(set_rpath_cmd patchelf --set-rpath $ORIGIN)
|
||||
endif()
|
||||
|
||||
function(harvest_rpath_lib from to pattern)
|
||||
harvest(${from} ${to} ${pattern})
|
||||
|
||||
install(CODE "\
|
||||
cmake_policy(SET CMP0009 NEW)\n
|
||||
file(GLOB_RECURSE shared_libs ${HARVEST_TARGET}/${to}/${pattern}) \n
|
||||
foreach(f \${shared_libs}) \n
|
||||
if(IS_SYMLINK \${f})\n
|
||||
if(APPLE)\n
|
||||
file(REMOVE_RECURSE \${f})
|
||||
endif()\n
|
||||
else()\n
|
||||
execute_process(COMMAND ${set_rpath_cmd} \${f}) \n
|
||||
endif()\n
|
||||
else()\n
|
||||
execute_process(COMMAND ${set_rpath_cmd} \${f}) \n
|
||||
endif()\n
|
||||
endforeach()")
|
||||
endfunction()
|
||||
endforeach()")
|
||||
endfunction()
|
||||
|
||||
# Set rpath on utility binaries assuming they are run from their install location.
|
||||
function(harvest_rpath_bin from to pattern)
|
||||
harvest(${from} ${to} ${pattern})
|
||||
# Set rpath on utility binaries assuming they are run from their install location.
|
||||
function(harvest_rpath_bin from to pattern)
|
||||
harvest(${from} ${to} ${pattern})
|
||||
|
||||
install(CODE "\
|
||||
file(GLOB_RECURSE shared_libs ${HARVEST_TARGET}/${to}/${pattern}) \n
|
||||
foreach(f \${shared_libs}) \n
|
||||
execute_process(COMMAND ${set_rpath_cmd}/../lib; \${f}) \n
|
||||
endforeach()")
|
||||
endfunction()
|
||||
install(CODE "\
|
||||
file(GLOB_RECURSE shared_libs ${HARVEST_TARGET}/${to}/${pattern}) \n
|
||||
foreach(f \${shared_libs}) \n
|
||||
execute_process(COMMAND ${set_rpath_cmd}/../lib; \${f}) \n
|
||||
endforeach()")
|
||||
endfunction()
|
||||
|
||||
# Set rpath on Python module to point to the shared libraries folder in the Blender
|
||||
# installation.
|
||||
function(harvest_rpath_python from to pattern)
|
||||
harvest(${from} ${to} ${pattern})
|
||||
# Set rpath on Python module to point to the shared libraries folder in the Blender
|
||||
# installation.
|
||||
function(harvest_rpath_python from to pattern)
|
||||
harvest(${from} ${to} ${pattern})
|
||||
|
||||
install(CODE "\
|
||||
file(GLOB_RECURSE shared_libs ${HARVEST_TARGET}/${to}/${pattern}\.so*) \n
|
||||
foreach(f \${shared_libs}) \n
|
||||
if(IS_SYMLINK \${f})\n
|
||||
if(APPLE)\n
|
||||
file(REMOVE_RECURSE \${f})
|
||||
install(CODE "\
|
||||
file(GLOB_RECURSE shared_libs ${HARVEST_TARGET}/${to}/${pattern}\.so*) \n
|
||||
foreach(f \${shared_libs}) \n
|
||||
if(IS_SYMLINK \${f})\n
|
||||
if(APPLE)\n
|
||||
file(REMOVE_RECURSE \${f})
|
||||
endif()\n
|
||||
else()\n
|
||||
get_filename_component(f_dir \${f} DIRECTORY) \n
|
||||
file(RELATIVE_PATH relative_dir \${f_dir} ${HARVEST_TARGET}) \n
|
||||
execute_process(COMMAND ${set_rpath_cmd}/\${relative_dir}../lib \${f}) \n
|
||||
endif()\n
|
||||
else()\n
|
||||
get_filename_component(f_dir \${f} DIRECTORY) \n
|
||||
file(RELATIVE_PATH relative_dir \${f_dir} ${HARVEST_TARGET}) \n
|
||||
execute_process(COMMAND ${set_rpath_cmd}/\${relative_dir}../lib \${f}) \n
|
||||
endif()\n
|
||||
endforeach()")
|
||||
endfunction()
|
||||
endforeach()")
|
||||
endfunction()
|
||||
|
||||
harvest(alembic/include alembic/include "*.h")
|
||||
harvest(alembic/lib/libAlembic.a alembic/lib/libAlembic.a)
|
||||
harvest_rpath_bin(alembic/bin alembic/bin "*")
|
||||
harvest(brotli/include brotli/include "*.h")
|
||||
harvest(brotli/lib brotli/lib "*.a")
|
||||
harvest(boost/include boost/include "*")
|
||||
harvest_rpath_lib(boost/lib boost/lib "*${SHAREDLIBEXT}*")
|
||||
harvest(imath/include imath/include "*.h")
|
||||
harvest_rpath_lib(imath/lib imath/lib "*${SHAREDLIBEXT}*")
|
||||
harvest(ffmpeg/include ffmpeg/include "*.h")
|
||||
harvest(ffmpeg/lib ffmpeg/lib "*.a")
|
||||
harvest(fftw3/include fftw3/include "*.h")
|
||||
harvest(fftw3/lib fftw3/lib "*.a")
|
||||
harvest(flac/lib sndfile/lib "libFLAC.a")
|
||||
harvest(freetype/include freetype/include "*.h")
|
||||
harvest(freetype/lib/libfreetype2ST.a freetype/lib/libfreetype.a)
|
||||
harvest(fribidi/include fribidi/include "*.h")
|
||||
harvest(fribidi/lib fribidi/lib "*.a")
|
||||
harvest(epoxy/include epoxy/include "*.h")
|
||||
harvest(epoxy/lib epoxy/lib "*.a")
|
||||
harvest(gmp/include gmp/include "*.h")
|
||||
harvest(gmp/lib gmp/lib "*.a")
|
||||
harvest(harfbuzz/include harfbuzz/include "*.h")
|
||||
harvest(harfbuzz/lib harfbuzz/lib "*.a")
|
||||
harvest(jemalloc/include jemalloc/include "*.h")
|
||||
harvest(jemalloc/lib jemalloc/lib "*.a")
|
||||
harvest(jpeg/include jpeg/include "*.h")
|
||||
harvest(jpeg/lib jpeg/lib "libjpeg.a")
|
||||
harvest(lame/lib ffmpeg/lib "*.a")
|
||||
if(NOT APPLE)
|
||||
harvest(level-zero/include/level_zero level-zero/include/level_zero "*.h")
|
||||
harvest(level-zero/lib level-zero/lib "*${SHAREDLIBEXT}*")
|
||||
endif()
|
||||
harvest(llvm/bin llvm/bin "clang-format")
|
||||
if(BUILD_CLANG_TOOLS)
|
||||
harvest(llvm/bin llvm/bin "clang-tidy")
|
||||
harvest(llvm/share/clang llvm/share "run-clang-tidy.py")
|
||||
endif()
|
||||
harvest(llvm/include llvm/include "*")
|
||||
harvest(llvm/bin llvm/bin "llvm-config")
|
||||
harvest(llvm/lib llvm/lib "libLLVM*.a")
|
||||
harvest(llvm/lib llvm/lib "libclang*.a")
|
||||
harvest(llvm/lib/clang llvm/lib/clang "*.h")
|
||||
if(APPLE)
|
||||
harvest(openmp/lib openmp/lib "libomp.dylib")
|
||||
harvest(openmp/include openmp/include "*.h")
|
||||
endif()
|
||||
if(BLENDER_PLATFORM_ARM)
|
||||
harvest(sse2neon sse2neon "*.h")
|
||||
endif()
|
||||
harvest(ogg/lib ffmpeg/lib "*.a")
|
||||
harvest(openal/include openal/include "*.h")
|
||||
if(UNIX AND NOT APPLE)
|
||||
harvest(openal/lib openal/lib "*.a")
|
||||
harvest(alembic/include alembic/include "*.h")
|
||||
harvest(alembic/lib/libAlembic.a alembic/lib/libAlembic.a)
|
||||
harvest_rpath_bin(alembic/bin alembic/bin "*")
|
||||
harvest(brotli/include brotli/include "*.h")
|
||||
harvest(brotli/lib brotli/lib "*.a")
|
||||
harvest(boost/include boost/include "*")
|
||||
harvest_rpath_lib(boost/lib boost/lib "*${SHAREDLIBEXT}*")
|
||||
harvest(imath/include imath/include "*.h")
|
||||
harvest_rpath_lib(imath/lib imath/lib "*${SHAREDLIBEXT}*")
|
||||
harvest(ffmpeg/include ffmpeg/include "*.h")
|
||||
harvest(ffmpeg/lib ffmpeg/lib "*.a")
|
||||
harvest(fftw3/include fftw3/include "*.h")
|
||||
harvest(fftw3/lib fftw3/lib "*.a")
|
||||
harvest(flac/lib sndfile/lib "libFLAC.a")
|
||||
harvest(freetype/include freetype/include "*.h")
|
||||
harvest(freetype/lib/libfreetype2ST.a freetype/lib/libfreetype.a)
|
||||
harvest(fribidi/include fribidi/include "*.h")
|
||||
harvest(fribidi/lib fribidi/lib "*.a")
|
||||
harvest(epoxy/include epoxy/include "*.h")
|
||||
harvest(epoxy/lib epoxy/lib "*.a")
|
||||
harvest(gmp/include gmp/include "*.h")
|
||||
harvest(gmp/lib gmp/lib "*.a")
|
||||
harvest(harfbuzz/include harfbuzz/include "*.h")
|
||||
harvest(harfbuzz/lib harfbuzz/lib "*.a")
|
||||
harvest(jemalloc/include jemalloc/include "*.h")
|
||||
harvest(jemalloc/lib jemalloc/lib "*.a")
|
||||
harvest(jpeg/include jpeg/include "*.h")
|
||||
harvest(jpeg/lib jpeg/lib "libjpeg.a")
|
||||
harvest(lame/lib ffmpeg/lib "*.a")
|
||||
if(NOT APPLE)
|
||||
harvest(level-zero/include/level_zero level-zero/include/level_zero "*.h")
|
||||
harvest(level-zero/lib level-zero/lib "*${SHAREDLIBEXT}*")
|
||||
endif()
|
||||
harvest(llvm/bin llvm/bin "clang-format")
|
||||
if(BUILD_CLANG_TOOLS)
|
||||
harvest(llvm/bin llvm/bin "clang-tidy")
|
||||
harvest(llvm/share/clang llvm/share "run-clang-tidy.py")
|
||||
endif()
|
||||
harvest(llvm/include llvm/include "*")
|
||||
harvest(llvm/bin llvm/bin "llvm-config")
|
||||
harvest(llvm/lib llvm/lib "libLLVM*.a")
|
||||
harvest(llvm/lib llvm/lib "libclang*.a")
|
||||
harvest(llvm/lib/clang llvm/lib/clang "*.h")
|
||||
if(APPLE)
|
||||
harvest(openmp/lib openmp/lib "libomp.dylib")
|
||||
harvest(openmp/include openmp/include "*.h")
|
||||
endif()
|
||||
if(BLENDER_PLATFORM_ARM)
|
||||
harvest(sse2neon sse2neon "*.h")
|
||||
endif()
|
||||
harvest(ogg/lib ffmpeg/lib "*.a")
|
||||
harvest(openal/include openal/include "*.h")
|
||||
if(UNIX AND NOT APPLE)
|
||||
harvest(openal/lib openal/lib "*.a")
|
||||
|
||||
harvest(zlib/include zlib/include "*.h")
|
||||
harvest(zlib/lib zlib/lib "*.a")
|
||||
harvest(zlib/include zlib/include "*.h")
|
||||
harvest(zlib/lib zlib/lib "*.a")
|
||||
|
||||
harvest(xml2/include xml2/include "*.h")
|
||||
harvest(xml2/lib xml2/lib "*.a")
|
||||
harvest(xml2/include xml2/include "*.h")
|
||||
harvest(xml2/lib xml2/lib "*.a")
|
||||
|
||||
harvest(wayland-protocols/share/wayland-protocols wayland-protocols/share/wayland-protocols/ "*.xml")
|
||||
harvest(
|
||||
wayland-protocols/share/wayland-protocols
|
||||
wayland-protocols/share/wayland-protocols/
|
||||
"*.xml"
|
||||
)
|
||||
harvest(wayland/bin wayland/bin "wayland-scanner")
|
||||
harvest(wayland/include wayland/include "*.h")
|
||||
harvest(wayland_libdecor/include wayland_libdecor/include "*.h")
|
||||
else()
|
||||
harvest(blosc/lib openvdb/lib "*.a")
|
||||
harvest(xml2/lib opencollada/lib "*.a")
|
||||
endif()
|
||||
harvest(opencollada/include/opencollada opencollada/include "*.h")
|
||||
harvest(opencollada/lib/opencollada opencollada/lib "*.a")
|
||||
harvest(opencolorio/include opencolorio/include "*.h")
|
||||
harvest_rpath_lib(opencolorio/lib opencolorio/lib "*${SHAREDLIBEXT}*")
|
||||
harvest_rpath_python(opencolorio/lib/python${PYTHON_SHORT_VERSION} python/lib/python${PYTHON_SHORT_VERSION} "*")
|
||||
harvest(openexr/include openexr/include "*.h")
|
||||
harvest_rpath_lib(openexr/lib openexr/lib "*${SHAREDLIBEXT}*")
|
||||
harvest_rpath_bin(openimageio/bin openimageio/bin "idiff")
|
||||
harvest_rpath_bin(openimageio/bin openimageio/bin "maketx")
|
||||
harvest_rpath_bin(openimageio/bin openimageio/bin "oiiotool")
|
||||
harvest(openimageio/include openimageio/include "*")
|
||||
harvest_rpath_lib(openimageio/lib openimageio/lib "*${SHAREDLIBEXT}*")
|
||||
harvest_rpath_python(openimageio/lib/python${PYTHON_SHORT_VERSION} python/lib/python${PYTHON_SHORT_VERSION} "*")
|
||||
harvest(openimagedenoise/include openimagedenoise/include "*")
|
||||
harvest(openimagedenoise/lib openimagedenoise/lib "*.a")
|
||||
harvest(embree/include embree/include "*.h")
|
||||
harvest(embree/lib embree/lib "*.a")
|
||||
harvest(openpgl/include openpgl/include "*.h")
|
||||
harvest(openpgl/lib openpgl/lib "*.a")
|
||||
harvest(openpgl/lib/cmake/openpgl-${OPENPGL_SHORT_VERSION} openpgl/lib/cmake/openpgl "*.cmake")
|
||||
harvest(openjpeg/include/openjpeg-${OPENJPEG_SHORT_VERSION} openjpeg/include "*.h")
|
||||
harvest(openjpeg/lib openjpeg/lib "*.a")
|
||||
harvest(opensubdiv/include opensubdiv/include "*.h")
|
||||
harvest_rpath_lib(opensubdiv/lib opensubdiv/lib "*${SHAREDLIBEXT}*")
|
||||
harvest(openvdb/include/openvdb openvdb/include/openvdb "*.h")
|
||||
harvest(openvdb/include/nanovdb openvdb/include/nanovdb "*.h")
|
||||
harvest_rpath_lib(openvdb/lib openvdb/lib "*${SHAREDLIBEXT}*")
|
||||
harvest_rpath_python(openvdb/lib/python${PYTHON_SHORT_VERSION} python/lib/python${PYTHON_SHORT_VERSION} "*pyopenvdb*")
|
||||
harvest(xr_openxr_sdk/include/openxr xr_openxr_sdk/include/openxr "*.h")
|
||||
harvest(xr_openxr_sdk/lib xr_openxr_sdk/lib "*.a")
|
||||
harvest_rpath_bin(osl/bin osl/bin "oslc")
|
||||
harvest(osl/include osl/include "*.h")
|
||||
harvest(osl/lib osl/lib "*.a")
|
||||
harvest(osl/share/OSL/shaders osl/share/OSL/shaders "*.h")
|
||||
harvest(png/include png/include "*.h")
|
||||
harvest(png/lib png/lib "*.a")
|
||||
harvest(pugixml/include pugixml/include "*.hpp")
|
||||
harvest(pugixml/lib pugixml/lib "*.a")
|
||||
harvest(python/bin python/bin "python${PYTHON_SHORT_VERSION}")
|
||||
harvest(python/include python/include "*h")
|
||||
harvest(python/lib python/lib "*")
|
||||
harvest(sdl/include/SDL2 sdl/include "*.h")
|
||||
harvest(sdl/lib sdl/lib "libSDL2.a")
|
||||
harvest(sndfile/include sndfile/include "*.h")
|
||||
harvest(sndfile/lib sndfile/lib "*.a")
|
||||
harvest(spnav/include spnav/include "*.h")
|
||||
harvest(spnav/lib spnav/lib "*.a")
|
||||
harvest(tbb/include tbb/include "*.h")
|
||||
harvest_rpath_lib(tbb/lib tbb/lib "libtbb${SHAREDLIBEXT}")
|
||||
harvest(theora/lib ffmpeg/lib "*.a")
|
||||
harvest(tiff/include tiff/include "*.h")
|
||||
harvest(tiff/lib tiff/lib "*.a")
|
||||
harvest(vorbis/lib ffmpeg/lib "*.a")
|
||||
harvest(opus/lib ffmpeg/lib "*.a")
|
||||
harvest(vpx/lib ffmpeg/lib "*.a")
|
||||
harvest(x264/lib ffmpeg/lib "*.a")
|
||||
harvest(xvidcore/lib ffmpeg/lib "*.a")
|
||||
harvest(aom/lib ffmpeg/lib "*.a")
|
||||
harvest(webp/lib webp/lib "*.a")
|
||||
harvest(webp/include webp/include "*.h")
|
||||
harvest(usd/include usd/include "*.h")
|
||||
harvest_rpath_lib(usd/lib usd/lib "libusd_ms${SHAREDLIBEXT}")
|
||||
harvest(usd/lib/usd usd/lib/usd "*")
|
||||
harvest_rpath_python(usd/lib/python/pxr python/lib/python${PYTHON_SHORT_VERSION}/site-packages/pxr "*")
|
||||
harvest(usd/plugin usd/plugin "*")
|
||||
harvest(materialx/include materialx/include "*.h")
|
||||
harvest_rpath_lib(materialx/lib materialx/lib "*${SHAREDLIBEXT}*")
|
||||
harvest(materialx/libraries materialx/libraries "*")
|
||||
harvest(materialx/lib/cmake/MaterialX materialx/lib/cmake/MaterialX "*.cmake")
|
||||
harvest_rpath_python(materialx/python/MaterialX python/lib/python${PYTHON_SHORT_VERSION}/site-packages/MaterialX "*")
|
||||
# We do not need anything from the resources folder, but the MaterialX config
|
||||
# file will complain if the folder does not exist, so just copy the readme.md
|
||||
# files to ensure the folder will exist.
|
||||
harvest(materialx/resources materialx/resources "README.md")
|
||||
harvest(potrace/include potrace/include "*.h")
|
||||
harvest(potrace/lib potrace/lib "*.a")
|
||||
harvest(haru/include haru/include "*.h")
|
||||
harvest(haru/lib haru/lib "*.a")
|
||||
harvest(zstd/include zstd/include "*.h")
|
||||
harvest(zstd/lib zstd/lib "*.a")
|
||||
harvest(shaderc shaderc "*")
|
||||
harvest(vulkan_headers vulkan "*")
|
||||
harvest_rpath_lib(vulkan_loader/lib vulkan/lib "*${SHAREDLIBEXT}*")
|
||||
if(APPLE)
|
||||
harvest(vulkan_loader/loader vulkan/loader "*")
|
||||
endif()
|
||||
harvest(xml2/lib opencollada/lib "*.a")
|
||||
endif()
|
||||
harvest(opencollada/include/opencollada opencollada/include "*.h")
|
||||
harvest(opencollada/lib/opencollada opencollada/lib "*.a")
|
||||
harvest(opencolorio/include opencolorio/include "*.h")
|
||||
harvest_rpath_lib(opencolorio/lib opencolorio/lib "*${SHAREDLIBEXT}*")
|
||||
harvest_rpath_python(
|
||||
opencolorio/lib/python${PYTHON_SHORT_VERSION}
|
||||
python/lib/python${PYTHON_SHORT_VERSION}
|
||||
"*"
|
||||
)
|
||||
harvest(openexr/include openexr/include "*.h")
|
||||
harvest_rpath_lib(openexr/lib openexr/lib "*${SHAREDLIBEXT}*")
|
||||
harvest_rpath_bin(openimageio/bin openimageio/bin "idiff")
|
||||
harvest_rpath_bin(openimageio/bin openimageio/bin "maketx")
|
||||
harvest_rpath_bin(openimageio/bin openimageio/bin "oiiotool")
|
||||
harvest(openimageio/include openimageio/include "*")
|
||||
harvest_rpath_lib(openimageio/lib openimageio/lib "*${SHAREDLIBEXT}*")
|
||||
harvest_rpath_python(
|
||||
openimageio/lib/python${PYTHON_SHORT_VERSION}
|
||||
python/lib/python${PYTHON_SHORT_VERSION}
|
||||
"*"
|
||||
)
|
||||
harvest(openimagedenoise/include openimagedenoise/include "*")
|
||||
harvest(openimagedenoise/lib openimagedenoise/lib "*.a")
|
||||
harvest(embree/include embree/include "*.h")
|
||||
harvest(embree/lib embree/lib "*.a")
|
||||
harvest(openpgl/include openpgl/include "*.h")
|
||||
harvest(openpgl/lib openpgl/lib "*.a")
|
||||
harvest(openpgl/lib/cmake/openpgl-${OPENPGL_SHORT_VERSION} openpgl/lib/cmake/openpgl "*.cmake")
|
||||
harvest(openjpeg/include/openjpeg-${OPENJPEG_SHORT_VERSION} openjpeg/include "*.h")
|
||||
harvest(openjpeg/lib openjpeg/lib "*.a")
|
||||
harvest(opensubdiv/include opensubdiv/include "*.h")
|
||||
harvest_rpath_lib(opensubdiv/lib opensubdiv/lib "*${SHAREDLIBEXT}*")
|
||||
harvest(openvdb/include/openvdb openvdb/include/openvdb "*.h")
|
||||
harvest(openvdb/include/nanovdb openvdb/include/nanovdb "*.h")
|
||||
harvest_rpath_lib(openvdb/lib openvdb/lib "*${SHAREDLIBEXT}*")
|
||||
harvest_rpath_python(
|
||||
openvdb/lib/python${PYTHON_SHORT_VERSION}
|
||||
python/lib/python${PYTHON_SHORT_VERSION}
|
||||
"*pyopenvdb*"
|
||||
)
|
||||
harvest(xr_openxr_sdk/include/openxr xr_openxr_sdk/include/openxr "*.h")
|
||||
harvest(xr_openxr_sdk/lib xr_openxr_sdk/lib "*.a")
|
||||
harvest_rpath_bin(osl/bin osl/bin "oslc")
|
||||
harvest(osl/include osl/include "*.h")
|
||||
harvest(osl/lib osl/lib "*.a")
|
||||
harvest(osl/share/OSL/shaders osl/share/OSL/shaders "*.h")
|
||||
harvest(png/include png/include "*.h")
|
||||
harvest(png/lib png/lib "*.a")
|
||||
harvest(pugixml/include pugixml/include "*.hpp")
|
||||
harvest(pugixml/lib pugixml/lib "*.a")
|
||||
harvest(python/bin python/bin "python${PYTHON_SHORT_VERSION}")
|
||||
harvest(python/include python/include "*h")
|
||||
harvest(python/lib python/lib "*")
|
||||
harvest(sdl/include/SDL2 sdl/include "*.h")
|
||||
harvest(sdl/lib sdl/lib "libSDL2.a")
|
||||
harvest(sndfile/include sndfile/include "*.h")
|
||||
harvest(sndfile/lib sndfile/lib "*.a")
|
||||
harvest(spnav/include spnav/include "*.h")
|
||||
harvest(spnav/lib spnav/lib "*.a")
|
||||
harvest(tbb/include tbb/include "*.h")
|
||||
harvest_rpath_lib(tbb/lib tbb/lib "libtbb${SHAREDLIBEXT}")
|
||||
harvest(theora/lib ffmpeg/lib "*.a")
|
||||
harvest(tiff/include tiff/include "*.h")
|
||||
harvest(tiff/lib tiff/lib "*.a")
|
||||
harvest(vorbis/lib ffmpeg/lib "*.a")
|
||||
harvest(opus/lib ffmpeg/lib "*.a")
|
||||
harvest(vpx/lib ffmpeg/lib "*.a")
|
||||
harvest(x264/lib ffmpeg/lib "*.a")
|
||||
harvest(xvidcore/lib ffmpeg/lib "*.a")
|
||||
harvest(aom/lib ffmpeg/lib "*.a")
|
||||
harvest(webp/lib webp/lib "*.a")
|
||||
harvest(webp/include webp/include "*.h")
|
||||
harvest(usd/include usd/include "*.h")
|
||||
harvest_rpath_lib(usd/lib usd/lib "libusd_ms${SHAREDLIBEXT}")
|
||||
harvest(usd/lib/usd usd/lib/usd "*")
|
||||
harvest_rpath_python(
|
||||
usd/lib/python/pxr
|
||||
python/lib/python${PYTHON_SHORT_VERSION}/site-packages/pxr
|
||||
"*"
|
||||
)
|
||||
harvest(usd/plugin usd/plugin "*")
|
||||
harvest(materialx/include materialx/include "*.h")
|
||||
harvest_rpath_lib(materialx/lib materialx/lib "*${SHAREDLIBEXT}*")
|
||||
harvest(materialx/libraries materialx/libraries "*")
|
||||
harvest(materialx/lib/cmake/MaterialX materialx/lib/cmake/MaterialX "*.cmake")
|
||||
harvest_rpath_python(
|
||||
materialx/python/MaterialX
|
||||
python/lib/python${PYTHON_SHORT_VERSION}/site-packages/MaterialX
|
||||
"*"
|
||||
)
|
||||
# We do not need anything from the resources folder, but the MaterialX config
|
||||
# file will complain if the folder does not exist, so just copy the readme.md
|
||||
# files to ensure the folder will exist.
|
||||
harvest(materialx/resources materialx/resources "README.md")
|
||||
harvest(potrace/include potrace/include "*.h")
|
||||
harvest(potrace/lib potrace/lib "*.a")
|
||||
harvest(haru/include haru/include "*.h")
|
||||
harvest(haru/lib haru/lib "*.a")
|
||||
harvest(zstd/include zstd/include "*.h")
|
||||
harvest(zstd/lib zstd/lib "*.a")
|
||||
harvest(shaderc shaderc "*")
|
||||
harvest(vulkan_headers vulkan "*")
|
||||
harvest_rpath_lib(vulkan_loader/lib vulkan/lib "*${SHAREDLIBEXT}*")
|
||||
if(APPLE)
|
||||
harvest(vulkan_loader/loader vulkan/loader "*")
|
||||
endif()
|
||||
|
||||
if(UNIX AND NOT APPLE)
|
||||
harvest(libglu/lib mesa/lib "*${SHAREDLIBEXT}*")
|
||||
harvest(mesa/lib64 mesa/lib "*${SHAREDLIBEXT}*")
|
||||
if(UNIX AND NOT APPLE)
|
||||
harvest(libglu/lib mesa/lib "*${SHAREDLIBEXT}*")
|
||||
harvest(mesa/lib64 mesa/lib "*${SHAREDLIBEXT}*")
|
||||
|
||||
harvest(dpcpp dpcpp "*")
|
||||
harvest(igc dpcpp/lib/igc "*")
|
||||
harvest(ocloc dpcpp/lib/ocloc "*")
|
||||
endif()
|
||||
harvest(dpcpp dpcpp "*")
|
||||
harvest(igc dpcpp/lib/igc "*")
|
||||
harvest(ocloc dpcpp/lib/ocloc "*")
|
||||
endif()
|
||||
endif()
|
||||
|
|
|
@ -26,9 +26,9 @@ else()
|
|||
-DLIBXML2_INCLUDE_DIR=${LIBDIR}/xml2/include/libxml2
|
||||
)
|
||||
if(BUILD_MODE STREQUAL Release)
|
||||
list(APPEND OPENCOLLADA_EXTRA_ARGS -DLIBXML2_LIBRARIES=${LIBDIR}/xml2/lib/libxml2s.lib)
|
||||
list(APPEND OPENCOLLADA_EXTRA_ARGS -DLIBXML2_LIBRARIES=${LIBDIR}/xml2/lib/libxml2s.lib)
|
||||
else()
|
||||
list(APPEND OPENCOLLADA_EXTRA_ARGS -DLIBXML2_LIBRARIES=${LIBDIR}/xml2/lib/libxml2sd.lib)
|
||||
list(APPEND OPENCOLLADA_EXTRA_ARGS -DLIBXML2_LIBRARIES=${LIBDIR}/xml2/lib/libxml2sd.lib)
|
||||
endif()
|
||||
set(PATCH_MAYBE_DOS2UNIX_CMD)
|
||||
endif()
|
||||
|
|
|
@ -1,20 +1,5 @@
|
|||
# ***** BEGIN GPL LICENSE BLOCK *****
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# ***** END GPL LICENSE BLOCK *****
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
set(SHADERC_EXTRA_ARGS
|
||||
-DSHADERC_SKIP_TESTS=On
|
||||
-DSHADERC_SPIRV_TOOLS_DIR=${BUILD_DIR}/shaderc_spirv_tools/src/external_shaderc_spirv_tools
|
||||
|
@ -60,5 +45,3 @@ if(WIN32)
|
|||
)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
||||
|
|
|
@ -1,20 +1,4 @@
|
|||
# ***** BEGIN GPL LICENSE BLOCK *****
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# ***** END GPL LICENSE BLOCK *****
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
# These are build time requirements for shaderc. We only have to unpack these
|
||||
# shaderc will build them.
|
||||
|
@ -48,4 +32,3 @@ ExternalProject_Add(external_shaderc_spirv_tools
|
|||
BUILD_COMMAND echo .
|
||||
INSTALL_COMMAND echo .
|
||||
)
|
||||
|
||||
|
|
|
@ -34,7 +34,8 @@ elseif(UNIX)
|
|||
if(APPLE)
|
||||
set(USD_SHARED_LINKER_FLAGS "-Xlinker -undefined -Xlinker dynamic_lookup")
|
||||
list(APPEND USD_PLATFORM_FLAGS
|
||||
-DCMAKE_SHARED_LINKER_FLAGS=${USD_SHARED_LINKER_FLAGS})
|
||||
-DCMAKE_SHARED_LINKER_FLAGS=${USD_SHARED_LINKER_FLAGS}
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
@ -112,7 +113,7 @@ add_dependencies(
|
|||
# Since USD 21.11 the libraries are prefixed with "usd_", i.e. "libusd_m.a" became "libusd_usd_m.a".
|
||||
# See https://github.com/PixarAnimationStudios/USD/blob/release/CHANGELOG.md#2111---2021-11-01
|
||||
if(NOT WIN32)
|
||||
if (USD_VERSION VERSION_LESS 21.11)
|
||||
if(USD_VERSION VERSION_LESS 21.11)
|
||||
set(PXR_LIB_PREFIX "")
|
||||
else()
|
||||
set(PXR_LIB_PREFIX "usd_")
|
||||
|
|
|
@ -1,20 +1,4 @@
|
|||
# ***** BEGIN GPL LICENSE BLOCK *****
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# ***** END GPL LICENSE BLOCK *****
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
set(VULKAN_HEADERS_EXTRA_ARGS)
|
||||
|
||||
|
@ -68,4 +52,3 @@ elseif(WIN32)
|
|||
)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
#!/usr/bin/env python3
|
||||
# macOS utility to remove all rpaths and add a new one.
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
# macOS utility to remove all `rpaths` and add a new one.
|
||||
|
||||
import os
|
||||
import re
|
||||
|
|
|
@ -27,4 +27,4 @@ set(LIBDIR "${CMAKE_CURRENT_LIST_DIR}/../../../../lib/${LIBDIR_NAME}" CACHE STRI
|
|||
# Platform specific configuration, to ensure static linking against everything.
|
||||
|
||||
# Additional linking libraries
|
||||
set(CMAKE_EXE_LINKER_FLAGS "-lrt -no-pie" CACHE STRING "" FORCE)
|
||||
set(CMAKE_EXE_LINKER_FLAGS "-lrt -no-pie" CACHE STRING "" FORCE)
|
||||
|
|
|
@ -172,7 +172,7 @@ ENDIF()
|
|||
# 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
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(OpenEXR DEFAULT_MSG
|
||||
_openexr_LIBRARIES OPENEXR_INCLUDE_DIR)
|
||||
|
||||
IF(OPENEXR_FOUND)
|
||||
|
|
|
@ -22,7 +22,7 @@ endif()
|
|||
|
||||
# Used for: `source/blender/blenlib/intern/system.c`.
|
||||
# `execinfo` is not available on non-GLIBC systems (at least not on MUSL-LIBC),
|
||||
# so check the presence of the header before including it and using the it for back-trace.
|
||||
# so check the presence of the header before including it and using the it for back-trace.
|
||||
set(HAVE_EXECINFO_H OFF)
|
||||
if(NOT MSVC)
|
||||
include(CheckIncludeFiles)
|
||||
|
|
|
@ -326,8 +326,8 @@ function(blender_add_lib__impl
|
|||
# NOTE: If separated libraries for debug and release are needed every library is the list are
|
||||
# to be prefixed explicitly.
|
||||
#
|
||||
# Use: "optimized libfoo optimized libbar debug libfoo_d debug libbar_d"
|
||||
# NOT: "optimized libfoo libbar debug libfoo_d libbar_d"
|
||||
# Use: "optimized libfoo optimized libbar debug libfoo_d debug libbar_d"
|
||||
# NOT: "optimized libfoo libbar debug libfoo_d libbar_d"
|
||||
if(NOT "${library_deps}" STREQUAL "")
|
||||
set(next_library_mode "")
|
||||
foreach(library ${library_deps})
|
||||
|
@ -535,7 +535,7 @@ function(setup_platform_linker_flags
|
|||
set_property(TARGET ${target} APPEND_STRING PROPERTY LINK_FLAGS_DEBUG " ${PLATFORM_LINKFLAGS_DEBUG}")
|
||||
|
||||
get_target_property(target_type ${target} TYPE)
|
||||
if (target_type STREQUAL "EXECUTABLE")
|
||||
if(target_type STREQUAL "EXECUTABLE")
|
||||
set_property(TARGET ${target} APPEND_STRING PROPERTY LINK_FLAGS " ${PLATFORM_LINKFLAGS_EXECUTABLE}")
|
||||
endif()
|
||||
endfunction()
|
||||
|
@ -1219,7 +1219,7 @@ function(print_cached_vars_containing_value
|
|||
set(_found)
|
||||
get_cmake_property(_vars VARIABLES)
|
||||
foreach(_var ${_vars})
|
||||
if (DEFINED CACHE{${_var}})
|
||||
if(DEFINED CACHE{${_var}})
|
||||
# Skip "_" prefixed variables, these are used for internal book-keeping,
|
||||
# not under user control.
|
||||
string(FIND "${_var}" "_" _found)
|
||||
|
@ -1256,10 +1256,10 @@ macro(openmp_delayload
|
|||
else()
|
||||
set(OPENMP_DLL_NAME "vcomp140")
|
||||
endif()
|
||||
set_property(TARGET ${projectname} APPEND_STRING PROPERTY LINK_FLAGS_RELEASE " /DELAYLOAD:${OPENMP_DLL_NAME}.dll delayimp.lib")
|
||||
set_property(TARGET ${projectname} APPEND_STRING PROPERTY LINK_FLAGS_DEBUG " /DELAYLOAD:${OPENMP_DLL_NAME}d.dll delayimp.lib")
|
||||
set_property(TARGET ${projectname} APPEND_STRING PROPERTY LINK_FLAGS_RELWITHDEBINFO " /DELAYLOAD:${OPENMP_DLL_NAME}.dll delayimp.lib")
|
||||
set_property(TARGET ${projectname} APPEND_STRING PROPERTY LINK_FLAGS_MINSIZEREL " /DELAYLOAD:${OPENMP_DLL_NAME}.dll delayimp.lib")
|
||||
set_property(TARGET ${projectname} APPEND_STRING PROPERTY LINK_FLAGS_RELEASE " /DELAYLOAD:${OPENMP_DLL_NAME}.dll delayimp.lib")
|
||||
set_property(TARGET ${projectname} APPEND_STRING PROPERTY LINK_FLAGS_DEBUG " /DELAYLOAD:${OPENMP_DLL_NAME}d.dll delayimp.lib")
|
||||
set_property(TARGET ${projectname} APPEND_STRING PROPERTY LINK_FLAGS_RELWITHDEBINFO " /DELAYLOAD:${OPENMP_DLL_NAME}.dll delayimp.lib")
|
||||
set_property(TARGET ${projectname} APPEND_STRING PROPERTY LINK_FLAGS_MINSIZEREL " /DELAYLOAD:${OPENMP_DLL_NAME}.dll delayimp.lib")
|
||||
endif()
|
||||
endif()
|
||||
endmacro()
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
function(unset_cache_variables pattern)
|
||||
get_cmake_property(_cache_variables CACHE_VARIABLES)
|
||||
foreach (_cache_variable ${_cache_variables})
|
||||
foreach(_cache_variable ${_cache_variables})
|
||||
if("${_cache_variable}" MATCHES "${pattern}")
|
||||
unset(${_cache_variable} CACHE)
|
||||
endif()
|
||||
|
|
|
@ -789,7 +789,7 @@ if(WITH_GHOST_X11)
|
|||
endif()
|
||||
|
||||
if(WITH_X11_ALPHA)
|
||||
find_library(X11_Xrender_LIB Xrender ${X11_LIB_SEARCH_PATH})
|
||||
find_library(X11_Xrender_LIB Xrender ${X11_LIB_SEARCH_PATH})
|
||||
mark_as_advanced(X11_Xrender_LIB)
|
||||
if(NOT X11_Xrender_LIB)
|
||||
message(FATAL_ERROR "libXrender not found. Disable WITH_X11_ALPHA if you
|
||||
|
|
|
@ -302,7 +302,7 @@ endif()
|
|||
file(GLOB children RELATIVE ${LIBDIR} ${LIBDIR}/*)
|
||||
foreach(child ${children})
|
||||
if(IS_DIRECTORY ${LIBDIR}/${child})
|
||||
list(APPEND CMAKE_PREFIX_PATH ${LIBDIR}/${child})
|
||||
list(APPEND CMAKE_PREFIX_PATH ${LIBDIR}/${child})
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
|
@ -555,7 +555,7 @@ if(WITH_BOOST)
|
|||
set(BOOST_PREFIX "")
|
||||
# This is file new in 3.4 if it does not exist, assume we are building against 3.3 libs
|
||||
set(BOOST_34_TRIGGER_FILE ${BOOST_LIBPATH}/${BOOST_PREFIX}boost_python310-${BOOST_DEBUG_POSTFIX}.lib)
|
||||
if (NOT EXISTS ${BOOST_34_TRIGGER_FILE})
|
||||
if(NOT EXISTS ${BOOST_34_TRIGGER_FILE})
|
||||
set(BOOST_DEBUG_POSTFIX "vc142-mt-gd-x64-${BOOST_VERSION}")
|
||||
set(BOOST_PREFIX "lib")
|
||||
endif()
|
||||
|
@ -573,7 +573,7 @@ if(WITH_BOOST)
|
|||
debug ${BOOST_LIBPATH}/${BOOST_PREFIX}boost_thread-${BOOST_DEBUG_POSTFIX}.lib
|
||||
debug ${BOOST_LIBPATH}/${BOOST_PREFIX}boost_chrono-${BOOST_DEBUG_POSTFIX}.lib
|
||||
)
|
||||
if (EXISTS ${BOOST_34_TRIGGER_FILE})
|
||||
if(EXISTS ${BOOST_34_TRIGGER_FILE})
|
||||
if(WITH_USD)
|
||||
set(BOOST_PYTHON_LIBRARIES
|
||||
debug ${BOOST_LIBPATH}/${BOOST_PREFIX}boost_python310-${BOOST_DEBUG_POSTFIX}.lib
|
||||
|
@ -624,7 +624,7 @@ endif()
|
|||
|
||||
if(WITH_LLVM)
|
||||
set(LLVM_ROOT_DIR ${LIBDIR}/llvm CACHE PATH "Path to the LLVM installation")
|
||||
set(LLVM_INCLUDE_DIRS ${LLVM_ROOT_DIR}/$<$<CONFIG:Debug>:Debug>/include CACHE PATH "Path to the LLVM include directory")
|
||||
set(LLVM_INCLUDE_DIRS ${LLVM_ROOT_DIR}/$<$<CONFIG:Debug>:Debug>/include CACHE PATH "Path to the LLVM include directory")
|
||||
file(GLOB LLVM_LIBRARY_OPTIMIZED ${LLVM_ROOT_DIR}/lib/*.lib)
|
||||
|
||||
if(EXISTS ${LLVM_ROOT_DIR}/debug/lib)
|
||||
|
@ -1030,7 +1030,7 @@ if(WITH_CYCLES AND WITH_CYCLES_DEVICE_ONEAPI)
|
|||
${SYCL_ROOT_DIR}/bin/pi_*.dll
|
||||
)
|
||||
list(REMOVE_ITEM _sycl_pi_runtime_libraries_glob "${SYCL_ROOT_DIR}/bin/pi_opencl.dll")
|
||||
list (APPEND _sycl_runtime_libraries ${_sycl_pi_runtime_libraries_glob})
|
||||
list(APPEND _sycl_runtime_libraries ${_sycl_pi_runtime_libraries_glob})
|
||||
unset(_sycl_pi_runtime_libraries_glob)
|
||||
|
||||
list(APPEND PLATFORM_BUNDLED_LIBRARIES ${_sycl_runtime_libraries})
|
||||
|
|
|
@ -298,7 +298,7 @@ if(WITH_CYCLES_DEVICE_METAL)
|
|||
add_definitions(-DWITH_METAL)
|
||||
endif()
|
||||
|
||||
if (WITH_CYCLES_DEVICE_ONEAPI)
|
||||
if(WITH_CYCLES_DEVICE_ONEAPI)
|
||||
add_definitions(-DWITH_ONEAPI)
|
||||
endif()
|
||||
|
||||
|
|
|
@ -45,8 +45,8 @@ macro(cycles_add_library target library_deps)
|
|||
# NOTE: If separated libraries for debug and release ar eneeded every library is the list are
|
||||
# to be prefixed explicitly.
|
||||
#
|
||||
# Use: "optimized libfoo optimized libbar debug libfoo_d debug libbar_d"
|
||||
# NOT: "optimized libfoo libbar debug libfoo_d libbar_d"
|
||||
# Use: "optimized libfoo optimized libbar debug libfoo_d debug libbar_d"
|
||||
# NOT: "optimized libfoo libbar debug libfoo_d libbar_d"
|
||||
#
|
||||
# TODO(sergey): This is the same as Blender's side CMake. Find a way to avoid duplication
|
||||
# somehow in a way which allows to have Cycles standalone.
|
||||
|
|
|
@ -162,7 +162,7 @@ if(WITH_CYCLES_DEVICE_METAL)
|
|||
)
|
||||
endif()
|
||||
|
||||
if (WITH_CYCLES_DEVICE_ONEAPI)
|
||||
if(WITH_CYCLES_DEVICE_ONEAPI)
|
||||
if(WITH_CYCLES_ONEAPI_BINARIES)
|
||||
set(cycles_kernel_oneapi_lib_suffix "_aot")
|
||||
else()
|
||||
|
|
|
@ -10,4 +10,4 @@ set(LICENSES
|
|||
Zlib-license.txt
|
||||
)
|
||||
|
||||
delayed_install(${CMAKE_CURRENT_SOURCE_DIR} "${LICENSES}" ${CYCLES_INSTALL_PATH}/license)
|
||||
delayed_install(${CMAKE_CURRENT_SOURCE_DIR} "${LICENSES}" ${CYCLES_INSTALL_PATH}/license)
|
||||
|
|
|
@ -26,8 +26,7 @@ class HdCyclesVolumeLoader : public VDBImageLoader {
|
|||
HdCyclesVolumeLoader(const std::string &filePath, const std::string &gridName)
|
||||
: VDBImageLoader(gridName)
|
||||
{
|
||||
/* Disably delay loading and file copying, this has poor performance
|
||||
* on network drivers. */
|
||||
/* Disable delay loading and file copying, this has poor performance on network drivers. */
|
||||
const bool delay_load = false;
|
||||
openvdb::io::File file(filePath);
|
||||
file.setCopyMaxBytes(0);
|
||||
|
|
|
@ -729,8 +729,8 @@ if(WITH_CYCLES_DEVICE_ONEAPI)
|
|||
${SRC_UTIL_HEADERS}
|
||||
)
|
||||
|
||||
set (SYCL_OFFLINE_COMPILER_PARALLEL_JOBS 1 CACHE STRING "Number of parallel compiler instances to use for device binaries compilation (expect ~8GB peak memory usage per instance).")
|
||||
if (WITH_CYCLES_ONEAPI_BINARIES)
|
||||
set(SYCL_OFFLINE_COMPILER_PARALLEL_JOBS 1 CACHE STRING "Number of parallel compiler instances to use for device binaries compilation (expect ~8GB peak memory usage per instance).")
|
||||
if(WITH_CYCLES_ONEAPI_BINARIES)
|
||||
message(STATUS "${SYCL_OFFLINE_COMPILER_PARALLEL_JOBS} instance(s) of oneAPI offline compiler will be used.")
|
||||
endif()
|
||||
# SYCL_CPP_FLAGS is a variable that the user can set to pass extra compiler options
|
||||
|
@ -754,25 +754,25 @@ if(WITH_CYCLES_DEVICE_ONEAPI)
|
|||
)
|
||||
|
||||
# Set defaults for spir64 and spir64_gen options
|
||||
if (NOT DEFINED CYCLES_ONEAPI_SYCL_OPTIONS_spir64)
|
||||
if(NOT DEFINED CYCLES_ONEAPI_SYCL_OPTIONS_spir64)
|
||||
set(CYCLES_ONEAPI_SYCL_OPTIONS_spir64 "-options '-ze-opt-large-register-file -ze-opt-regular-grf-kernel integrator_intersect'")
|
||||
endif()
|
||||
if (NOT DEFINED CYCLES_ONEAPI_SYCL_OPTIONS_spir64_gen)
|
||||
SET (CYCLES_ONEAPI_SYCL_OPTIONS_spir64_gen "${CYCLES_ONEAPI_SYCL_OPTIONS_spir64}" CACHE STRING "Extra build options for spir64_gen target")
|
||||
if(NOT DEFINED CYCLES_ONEAPI_SYCL_OPTIONS_spir64_gen)
|
||||
set(CYCLES_ONEAPI_SYCL_OPTIONS_spir64_gen "${CYCLES_ONEAPI_SYCL_OPTIONS_spir64}" CACHE STRING "Extra build options for spir64_gen target")
|
||||
endif()
|
||||
# Enable zebin, a graphics binary format with improved compatibility.
|
||||
string(PREPEND CYCLES_ONEAPI_SYCL_OPTIONS_spir64_gen "--format zebin ")
|
||||
string(PREPEND CYCLES_ONEAPI_SYCL_OPTIONS_spir64_gen "-device ${CYCLES_ONEAPI_SPIR64_GEN_DEVICES} ")
|
||||
|
||||
if (WITH_CYCLES_ONEAPI_BINARIES)
|
||||
if(WITH_CYCLES_ONEAPI_BINARIES)
|
||||
# AoT binaries aren't currently reused when calling sycl::build.
|
||||
list (APPEND sycl_compiler_flags -DSYCL_SKIP_KERNELS_PRELOAD)
|
||||
list(APPEND sycl_compiler_flags -DSYCL_SKIP_KERNELS_PRELOAD)
|
||||
# Iterate over all targest and their options
|
||||
list (JOIN CYCLES_ONEAPI_SYCL_TARGETS "," targets_string)
|
||||
list (APPEND sycl_compiler_flags -fsycl-targets=${targets_string})
|
||||
list(JOIN CYCLES_ONEAPI_SYCL_TARGETS "," targets_string)
|
||||
list(APPEND sycl_compiler_flags -fsycl-targets=${targets_string})
|
||||
foreach(target ${CYCLES_ONEAPI_SYCL_TARGETS})
|
||||
if(DEFINED CYCLES_ONEAPI_SYCL_OPTIONS_${target})
|
||||
list (APPEND sycl_compiler_flags -Xsycl-target-backend=${target} "${CYCLES_ONEAPI_SYCL_OPTIONS_${target}}")
|
||||
list(APPEND sycl_compiler_flags -Xsycl-target-backend=${target} "${CYCLES_ONEAPI_SYCL_OPTIONS_${target}}")
|
||||
endif()
|
||||
endforeach()
|
||||
else()
|
||||
|
|
|
@ -33,6 +33,12 @@ ccl_device_inline void film_write_data_passes(KernelGlobals kg,
|
|||
return;
|
||||
}
|
||||
|
||||
/* Don't write data passes for paths that were split off for shadow catchers
|
||||
* to avoid double-counting. */
|
||||
if (path_flag & PATH_RAY_SHADOW_CATCHER_PASS) {
|
||||
return;
|
||||
}
|
||||
|
||||
const int flag = kernel_data.film.pass_flag;
|
||||
|
||||
if (!(flag & PASS_ANY)) {
|
||||
|
|
|
@ -16,7 +16,8 @@ ccl_device_forceinline void film_write_denoising_features_surface(KernelGlobals
|
|||
ccl_global float *ccl_restrict
|
||||
render_buffer)
|
||||
{
|
||||
if (!(INTEGRATOR_STATE(state, path, flag) & PATH_RAY_DENOISING_FEATURES)) {
|
||||
const uint32_t path_flag = INTEGRATOR_STATE(state, path, flag);
|
||||
if (!(path_flag & PATH_RAY_DENOISING_FEATURES)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -25,6 +26,12 @@ ccl_device_forceinline void film_write_denoising_features_surface(KernelGlobals
|
|||
return;
|
||||
}
|
||||
|
||||
/* Don't write denoising passes for paths that were split off for shadow catchers
|
||||
* to avoid double-counting. */
|
||||
if (path_flag & PATH_RAY_SHADOW_CATCHER_PASS) {
|
||||
return;
|
||||
}
|
||||
|
||||
ccl_global float *buffer = film_pass_pixel_render_buffer(kg, state, render_buffer);
|
||||
|
||||
if (kernel_data.film.pass_denoising_depth != PASS_UNUSED) {
|
||||
|
|
|
@ -16,18 +16,40 @@
|
|||
|
||||
CCL_NAMESPACE_BEGIN
|
||||
|
||||
/* This helps with AA but it's not the real solution as it does not AA the geometry
|
||||
* but it's better than nothing, thus committed. */
|
||||
ccl_device_inline float bake_clamp_mirror_repeat(float u, float max)
|
||||
/* In order to perform anti-aliasing during baking, we jitter the input barycentric coordinates
|
||||
* (which are for the center of the texel) within the texel.
|
||||
* However, the baking code currently doesn't support going to neighboring triangle, so if the
|
||||
* jittered location falls outside of the input triangle, we need to bring it back in somehow.
|
||||
* Clamping is a bad choice here since it can produce noticeable artifacts at triangle edges,
|
||||
* but properly uniformly sampling the intersection of triangle and texel would be very
|
||||
* performance-heavy, so cheat by just trying different jittering until we end up inside the
|
||||
* triangle.
|
||||
* For triangles that are smaller than a texel, this might take too many attempts, so eventually
|
||||
* we just give up and don't jitter in that case.
|
||||
* This is not a particularly elegant solution, but it's probably the best we can do. */
|
||||
ccl_device_inline void bake_jitter_barycentric(float &u,
|
||||
float &v,
|
||||
float2 rand_filter,
|
||||
const float dudx,
|
||||
const float dudy,
|
||||
const float dvdx,
|
||||
const float dvdy)
|
||||
{
|
||||
/* use mirror repeat (like opengl texture) so that if the barycentric
|
||||
* coordinate goes past the end of the triangle it is not always clamped
|
||||
* to the same value, gives ugly patterns */
|
||||
u /= max;
|
||||
float fu = floorf(u);
|
||||
u = u - fu;
|
||||
|
||||
return ((((int)fu) & 1) ? 1.0f - u : u) * max;
|
||||
for (int i = 0; i < 10; i++) {
|
||||
/* Offset UV according to differentials. */
|
||||
float jitterU = u + (rand_filter.x - 0.5f) * dudx + (rand_filter.y - 0.5f) * dudy;
|
||||
float jitterV = v + (rand_filter.x - 0.5f) * dvdx + (rand_filter.y - 0.5f) * dvdy;
|
||||
/* If this location is inside the triangle, return. */
|
||||
if (jitterU > 0.0f && jitterV > 0.0f && jitterU + jitterV < 1.0f) {
|
||||
u = jitterU;
|
||||
v = jitterV;
|
||||
return;
|
||||
}
|
||||
/* Retry with new jitter value. */
|
||||
rand_filter = hash_float2_to_float2(rand_filter);
|
||||
}
|
||||
/* Retries exceeded, give up and just use center value. */
|
||||
return;
|
||||
}
|
||||
|
||||
/* Offset towards center of triangle to avoid ray-tracing precision issues. */
|
||||
|
@ -144,12 +166,7 @@ ccl_device bool integrator_init_from_bake(KernelGlobals kg,
|
|||
}
|
||||
|
||||
/* Sub-pixel offset. */
|
||||
if (sample > 0) {
|
||||
u = bake_clamp_mirror_repeat(u + dudx * (rand_filter.x - 0.5f) + dudy * (rand_filter.y - 0.5f),
|
||||
1.0f);
|
||||
v = bake_clamp_mirror_repeat(v + dvdx * (rand_filter.x - 0.5f) + dvdy * (rand_filter.y - 0.5f),
|
||||
1.0f - u);
|
||||
}
|
||||
bake_jitter_barycentric(u, v, rand_filter, dudx, dudy, dvdx, dvdy);
|
||||
|
||||
/* Convert from Blender to Cycles/Embree/OptiX barycentric convention. */
|
||||
const float tmp = u;
|
||||
|
|
|
@ -1030,7 +1030,7 @@ ccl_device VolumeIntegrateEvent volume_integrate(KernelGlobals kg,
|
|||
const float3 initial_throughput = INTEGRATOR_STATE(state, path, throughput);
|
||||
/* The path throughput used to calculate the throughput for direct light. */
|
||||
float3 unlit_throughput = initial_throughput;
|
||||
/* If a new path segment is generated at the direct scatter position.*/
|
||||
/* If a new path segment is generated at the direct scatter position. */
|
||||
bool guiding_generated_new_segment = false;
|
||||
float rand_phase_guiding = 0.5f;
|
||||
# endif
|
||||
|
|
|
@ -136,7 +136,7 @@ foreach(_file ${SRC_OSL})
|
|||
string(REPLACE ${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} _OSO_FILE ${_OSO_FILE})
|
||||
add_custom_command(
|
||||
OUTPUT ${_OSO_FILE}
|
||||
COMMAND ${CMAKE_COMMAND} -E env ${PLATFORM_ENV_BUILD} ${OSL_COMPILER} -q -O2 -I"${CMAKE_CURRENT_SOURCE_DIR}" -I"${OSL_SHADER_DIR}" -o ${_OSO_FILE} ${_OSL_FILE}
|
||||
COMMAND ${CMAKE_COMMAND} -E env ${PLATFORM_ENV_BUILD} ${OSL_COMPILER} -q -O2 -I"${CMAKE_CURRENT_SOURCE_DIR}" -I"${OSL_SHADER_DIR}" -o ${_OSO_FILE} ${_OSL_FILE}
|
||||
DEPENDS ${_OSL_FILE} ${SRC_OSL_HEADERS} ${OSL_COMPILER}
|
||||
)
|
||||
list(APPEND SRC_OSO
|
||||
|
|
|
@ -73,6 +73,11 @@ color node_mix_diff(float t, color col1, color col2)
|
|||
return mix(col1, abs(col1 - col2), t);
|
||||
}
|
||||
|
||||
color node_mix_exclusion(float t, color col1, color col2)
|
||||
{
|
||||
return max(mix(col1, col1 + col2 - 2.0 * col1 * col2, t), 0.0);
|
||||
}
|
||||
|
||||
color node_mix_dark(float t, color col1, color col2)
|
||||
{
|
||||
return mix(col1, min(col1, col2), t);
|
||||
|
|
|
@ -76,6 +76,11 @@ color node_mix_diff(float t, color col1, color col2)
|
|||
return mix(col1, abs(col1 - col2), t);
|
||||
}
|
||||
|
||||
color node_mix_exclusion(float t, color col1, color col2)
|
||||
{
|
||||
return max(mix(col1, col1 + col2 - 2.0 * col1 * col2, t), 0.0);
|
||||
}
|
||||
|
||||
color node_mix_dark(float t, color col1, color col2)
|
||||
{
|
||||
return mix(col1, min(col1, col2), t);
|
||||
|
@ -291,6 +296,8 @@ shader node_mix(string mix_type = "mix",
|
|||
Color = node_mix_div(t, Color1, Color2);
|
||||
if (mix_type == "difference")
|
||||
Color = node_mix_diff(t, Color1, Color2);
|
||||
if (mix_type == "exclusion")
|
||||
Color = node_mix_exclusion(t, Color1, Color2);
|
||||
if (mix_type == "darken")
|
||||
Color = node_mix_dark(t, Color1, Color2);
|
||||
if (mix_type == "lighten")
|
||||
|
|
|
@ -31,6 +31,8 @@ shader node_mix_color(string blend_type = "mix",
|
|||
Result = node_mix_div(t, A, B);
|
||||
if (blend_type == "difference")
|
||||
Result = node_mix_diff(t, A, B);
|
||||
if (blend_type == "exclusion")
|
||||
Result = node_mix_exclusion(t, A, B);
|
||||
if (blend_type == "darken")
|
||||
Result = node_mix_dark(t, A, B);
|
||||
if (blend_type == "lighten")
|
||||
|
|
|
@ -79,6 +79,11 @@ ccl_device float3 svm_mix_diff(float t, float3 col1, float3 col2)
|
|||
return interp(col1, fabs(col1 - col2), t);
|
||||
}
|
||||
|
||||
ccl_device float3 svm_mix_exclusion(float t, float3 col1, float3 col2)
|
||||
{
|
||||
return max(interp(col1, col1 + col2 - 2.0f * col1 * col2, t), zero_float3());
|
||||
}
|
||||
|
||||
ccl_device float3 svm_mix_dark(float t, float3 col1, float3 col2)
|
||||
{
|
||||
return interp(col1, min(col1, col2), t);
|
||||
|
@ -266,6 +271,8 @@ ccl_device_noinline_cpu float3 svm_mix(NodeMix type, float t, float3 c1, float3
|
|||
return svm_mix_div(t, c1, c2);
|
||||
case NODE_MIX_DIFF:
|
||||
return svm_mix_diff(t, c1, c2);
|
||||
case NODE_MIX_EXCLUSION:
|
||||
return svm_mix_exclusion(t, c1, c2);
|
||||
case NODE_MIX_DARK:
|
||||
return svm_mix_dark(t, c1, c2);
|
||||
case NODE_MIX_LIGHT:
|
||||
|
|
|
@ -136,6 +136,7 @@ typedef enum NodeMix {
|
|||
NODE_MIX_COL,
|
||||
NODE_MIX_SOFT,
|
||||
NODE_MIX_LINEAR,
|
||||
NODE_MIX_EXCLUSION,
|
||||
NODE_MIX_CLAMP /* used for the clamp UI option */
|
||||
} NodeMix;
|
||||
|
||||
|
|
|
@ -5139,6 +5139,7 @@ NODE_DEFINE(MixNode)
|
|||
type_enum.insert("color", NODE_MIX_COL);
|
||||
type_enum.insert("soft_light", NODE_MIX_SOFT);
|
||||
type_enum.insert("linear_light", NODE_MIX_LINEAR);
|
||||
type_enum.insert("exclusion", NODE_MIX_EXCLUSION);
|
||||
SOCKET_ENUM(mix_type, "Type", type_enum, NODE_MIX_BLEND);
|
||||
|
||||
SOCKET_BOOLEAN(use_clamp, "Use Clamp", false);
|
||||
|
@ -5217,6 +5218,7 @@ NODE_DEFINE(MixColorNode)
|
|||
type_enum.insert("color", NODE_MIX_COL);
|
||||
type_enum.insert("soft_light", NODE_MIX_SOFT);
|
||||
type_enum.insert("linear_light", NODE_MIX_LINEAR);
|
||||
type_enum.insert("exclusion", NODE_MIX_EXCLUSION);
|
||||
SOCKET_ENUM(blend_type, "Type", type_enum, NODE_MIX_BLEND);
|
||||
|
||||
SOCKET_IN_FLOAT(fac, "Factor", 0.5f);
|
||||
|
|
|
@ -129,7 +129,7 @@ list(APPEND SRC
|
|||
|
||||
if(WITH_HEADLESS)
|
||||
add_definitions(-DWITH_HEADLESS)
|
||||
elseif (WITH_GHOST_SDL)
|
||||
elseif(WITH_GHOST_SDL)
|
||||
list(APPEND SRC
|
||||
intern/GHOST_ContextSDL.cpp
|
||||
intern/GHOST_DisplayManagerSDL.cpp
|
||||
|
|
|
@ -1061,16 +1061,11 @@ GHOST_EventCursor *GHOST_SystemWin32::processCursorEvent(GHOST_WindowWin32 *wind
|
|||
|
||||
int32_t x_screen = screen_co[0], y_screen = screen_co[1];
|
||||
if (window->getCursorGrabModeIsWarp()) {
|
||||
static uint64_t last_warp_time = 0;
|
||||
{
|
||||
/* WORKAROUND: Check the mouse event timestamp so we can ignore mousemove events that were
|
||||
* already in the queue before we changed the cursor position. */
|
||||
MOUSEMOVEPOINT mp = {x_screen, y_screen};
|
||||
::GetMouseMovePointsEx(sizeof(MOUSEMOVEPOINT), &mp, &mp, 1, GMMP_USE_DISPLAY_POINTS);
|
||||
if (mp.time <= last_warp_time) {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
/* WORKAROUND:
|
||||
* Sometimes Windows ignores `SetCursorPos()` or `SendInput()` calls or the mouse event is
|
||||
* outdated. Identify these cases by checking if the cursor is not yet within bounds. */
|
||||
static bool is_warping_x = false;
|
||||
static bool is_warping_y = false;
|
||||
|
||||
int32_t x_new = x_screen;
|
||||
int32_t y_new = y_screen;
|
||||
|
@ -1117,35 +1112,31 @@ GHOST_EventCursor *GHOST_SystemWin32::processCursorEvent(GHOST_WindowWin32 *wind
|
|||
|
||||
window->getCursorGrabAccum(x_accum, y_accum);
|
||||
if (x_new != x_screen || y_new != y_screen) {
|
||||
/* WORKAROUND: Store the current time so that we ignore outdated mousemove events. */
|
||||
last_warp_time = ::GetTickCount64();
|
||||
system->setCursorPosition(x_new, y_new); /* wrap */
|
||||
|
||||
/* For more control over which timestamp to store in the event, we use `SendInput` instead of
|
||||
* `SetCursorPos` here.
|
||||
* It is quite unlikely to happen, but still possible that some event between
|
||||
* `last_warp_time` and `GHOST_SystemWin32::setCursorPosition` is sent. */
|
||||
INPUT input[3] = {0};
|
||||
input[0].type = INPUT_MOUSE;
|
||||
input[0].mi.dx = (LONG)(x_new * (65535.0f / GetSystemMetrics(SM_CXSCREEN)));
|
||||
input[0].mi.dy = (LONG)(y_new * (65535.0f / GetSystemMetrics(SM_CYSCREEN)));
|
||||
input[0].mi.dwFlags = MOUSEEVENTF_MOVE | MOUSEEVENTF_ABSOLUTE;
|
||||
input[0].mi.time = last_warp_time;
|
||||
/* Do not update the accum values if we are an outdated or failed pos-warp event. */
|
||||
if (!is_warping_x) {
|
||||
is_warping_x = x_new != x_screen;
|
||||
if (is_warping_x) {
|
||||
x_accum += (x_screen - x_new);
|
||||
}
|
||||
}
|
||||
|
||||
/* Send 3 events with a jitter to make sure Windows does not occasionally and
|
||||
* inexplicably ignore `SetCursorPos` or `SendInput`. */
|
||||
input[2] = input[1] = input[0];
|
||||
input[1].mi.dx += 1;
|
||||
::SendInput(3, input, sizeof(INPUT));
|
||||
|
||||
x_accum += (x_screen - x_new);
|
||||
y_accum += (y_screen - y_new);
|
||||
if (!is_warping_y) {
|
||||
is_warping_y = y_new != y_screen;
|
||||
if (is_warping_y) {
|
||||
y_accum += (y_screen - y_new);
|
||||
}
|
||||
}
|
||||
window->setCursorGrabAccum(x_accum, y_accum);
|
||||
|
||||
/* When wrapping we don't need to add an event because the `SendInput` call will cause new
|
||||
* events after. */
|
||||
/* When wrapping we don't need to add an event because the setCursorPosition call will cause
|
||||
* a new event after. */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
is_warping_x = false;
|
||||
is_warping_y = false;
|
||||
x_screen += x_accum;
|
||||
y_screen += y_accum;
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ set(LIB
|
|||
if(WIN32)
|
||||
# This is set in platform_win32.cmake, will exist for 3.4+ library
|
||||
# folders which are dynamic, but not for 3.3 which will be static.
|
||||
if (EXISTS ${BOOST_34_TRIGGER_FILE})
|
||||
if(EXISTS ${BOOST_34_TRIGGER_FILE})
|
||||
add_definitions (-DBOOST_ALL_DYN_LINK=1)
|
||||
endif()
|
||||
endif()
|
||||
|
|
|
@ -59,10 +59,8 @@ def url_prefill_from_blender(*, addon_info=None):
|
|||
"\n"
|
||||
)
|
||||
|
||||
fh.seek(0)
|
||||
|
||||
form_number = 2 if addon_info else 1
|
||||
return (
|
||||
"https://developer.blender.org/maniphest/task/edit/form/%i?description=" % form_number +
|
||||
urllib.parse.quote(fh.read())
|
||||
urllib.parse.quote(fh.getvalue())
|
||||
)
|
||||
|
|
|
@ -156,11 +156,8 @@ def execute(context, is_interactive):
|
|||
if _BPY_MAIN_OWN:
|
||||
sys.modules["__main__"] = main_mod_back
|
||||
|
||||
stdout.seek(0)
|
||||
stderr.seek(0)
|
||||
|
||||
output = stdout.read()
|
||||
output_err = stderr.read()
|
||||
output = stdout.getvalue()
|
||||
output_err = stderr.getvalue()
|
||||
|
||||
# cleanup
|
||||
sys.last_traceback = None
|
||||
|
|
|
@ -16,6 +16,11 @@
|
|||
#include "DNA_object_enums.h"
|
||||
#include "RNA_types.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
# include "BLI_string_ref.hh"
|
||||
# include "BLI_vector.hh"
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
@ -84,22 +89,25 @@ typedef int /*eContextResult*/ (*bContextDataCallback)(const bContext *C,
|
|||
const char *member,
|
||||
bContextDataResult *result);
|
||||
|
||||
typedef struct bContextStoreEntry {
|
||||
struct bContextStoreEntry *next, *prev;
|
||||
#ifdef __cplusplus
|
||||
|
||||
char name[128];
|
||||
struct bContextStoreEntry {
|
||||
std::string name;
|
||||
PointerRNA ptr;
|
||||
} bContextStoreEntry;
|
||||
};
|
||||
|
||||
typedef struct bContextStore {
|
||||
struct bContextStore *next, *prev;
|
||||
struct bContextStore {
|
||||
bContextStore *next = nullptr;
|
||||
bContextStore *prev = nullptr;
|
||||
|
||||
ListBase entries;
|
||||
bool used;
|
||||
} bContextStore;
|
||||
blender::Vector<bContextStoreEntry> entries;
|
||||
bool used = false;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
/* for the context's rna mode enum
|
||||
* keep aligned with data_mode_strings in context.c */
|
||||
* keep aligned with data_mode_strings in context.cc */
|
||||
typedef enum eContextObjectMode {
|
||||
CTX_MODE_EDIT_MESH = 0,
|
||||
CTX_MODE_EDIT_CURVE,
|
||||
|
@ -132,18 +140,23 @@ void CTX_free(bContext *C);
|
|||
|
||||
bContext *CTX_copy(const bContext *C);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
/* Stored Context */
|
||||
|
||||
bContextStore *CTX_store_add(ListBase *contexts, const char *name, const PointerRNA *ptr);
|
||||
bContextStore *CTX_store_add(ListBase *contexts,
|
||||
blender::StringRefNull name,
|
||||
const PointerRNA *ptr);
|
||||
bContextStore *CTX_store_add_all(ListBase *contexts, bContextStore *context);
|
||||
bContextStore *CTX_store_get(bContext *C);
|
||||
void CTX_store_set(bContext *C, bContextStore *store);
|
||||
const PointerRNA *CTX_store_ptr_lookup(const bContextStore *store,
|
||||
const char *name,
|
||||
const StructRNA *type CPP_ARG_DEFAULT(nullptr));
|
||||
bContextStore *CTX_store_copy(bContextStore *store);
|
||||
blender::StringRefNull name,
|
||||
const StructRNA *type = nullptr);
|
||||
bContextStore *CTX_store_copy(const bContextStore *store);
|
||||
void CTX_store_free(bContextStore *store);
|
||||
void CTX_store_free_list(ListBase *contexts);
|
||||
|
||||
#endif
|
||||
|
||||
/* need to store if python is initialized or not */
|
||||
bool CTX_py_init_get(bContext *C);
|
||||
|
|
|
@ -139,15 +139,15 @@ void BKE_keyblock_convert_to_mesh(const struct KeyBlock *kb, struct MVert *mvert
|
|||
*
|
||||
* \param kb: the KeyBlock to use to compute normals.
|
||||
* \param mesh: the Mesh to apply key-block to.
|
||||
* \param r_vertnors: if non-NULL, an array of vectors, same length as number of vertices.
|
||||
* \param r_polynors: if non-NULL, an array of vectors, same length as number of polygons.
|
||||
* \param r_loopnors: if non-NULL, an array of vectors, same length as number of loops.
|
||||
* \param r_vert_normals: if non-NULL, an array of vectors, same length as number of vertices.
|
||||
* \param r_poly_normals: if non-NULL, an array of vectors, same length as number of polygons.
|
||||
* \param r_loop_normals: if non-NULL, an array of vectors, same length as number of loops.
|
||||
*/
|
||||
void BKE_keyblock_mesh_calc_normals(const struct KeyBlock *kb,
|
||||
const struct Mesh *mesh,
|
||||
float (*r_vertnors)[3],
|
||||
float (*r_polynors)[3],
|
||||
float (*r_loopnors)[3]);
|
||||
float (*r_vert_normals)[3],
|
||||
float (*r_poly_normals)[3],
|
||||
float (*r_loop_normals)[3]);
|
||||
|
||||
void BKE_keyblock_update_from_vertcos(const struct Object *ob,
|
||||
struct KeyBlock *kb,
|
||||
|
@ -157,6 +157,7 @@ void BKE_keyblock_convert_from_vertcos(const struct Object *ob,
|
|||
const float (*vertCos)[3]);
|
||||
float (*BKE_keyblock_convert_to_vertcos(const struct Object *ob, const struct KeyBlock *kb))[3];
|
||||
|
||||
/** RAW coordinates offsets. */
|
||||
void BKE_keyblock_update_from_offset(const struct Object *ob,
|
||||
struct KeyBlock *kb,
|
||||
const float (*ofs)[3]);
|
||||
|
|
|
@ -481,7 +481,7 @@ void BKE_edges_sharp_from_angle_set(struct MEdge *medges,
|
|||
const struct MLoop *mloops,
|
||||
int numLoops,
|
||||
const struct MPoly *mpolys,
|
||||
const float (*polynors)[3],
|
||||
const float (*poly_normals)[3],
|
||||
int numPolys,
|
||||
float split_angle);
|
||||
|
||||
|
@ -603,10 +603,10 @@ void BKE_mesh_normals_loop_split(const struct MVert *mverts,
|
|||
const struct MEdge *medges,
|
||||
int numEdges,
|
||||
const struct MLoop *mloops,
|
||||
float (*r_loopnors)[3],
|
||||
float (*r_loop_normals)[3],
|
||||
int numLoops,
|
||||
const struct MPoly *mpolys,
|
||||
const float (*polynors)[3],
|
||||
const float (*poly_normals)[3],
|
||||
int numPolys,
|
||||
bool use_split_normals,
|
||||
float split_angle,
|
||||
|
@ -620,22 +620,22 @@ void BKE_mesh_normals_loop_custom_set(const struct MVert *mverts,
|
|||
struct MEdge *medges,
|
||||
int numEdges,
|
||||
const struct MLoop *mloops,
|
||||
float (*r_custom_loopnors)[3],
|
||||
float (*r_custom_loop_normals)[3],
|
||||
int numLoops,
|
||||
const struct MPoly *mpolys,
|
||||
const float (*polynors)[3],
|
||||
const float (*poly_normals)[3],
|
||||
int numPolys,
|
||||
short (*r_clnors_data)[2]);
|
||||
void BKE_mesh_normals_loop_custom_from_verts_set(const struct MVert *mverts,
|
||||
const float (*vert_normals)[3],
|
||||
float (*r_custom_vertnors)[3],
|
||||
float (*r_custom_vert_normals)[3],
|
||||
int numVerts,
|
||||
struct MEdge *medges,
|
||||
int numEdges,
|
||||
const struct MLoop *mloops,
|
||||
int numLoops,
|
||||
const struct MPoly *mpolys,
|
||||
const float (*polynors)[3],
|
||||
const float (*poly_normals)[3],
|
||||
int numPolys,
|
||||
short (*r_clnors_data)[2]);
|
||||
|
||||
|
@ -672,18 +672,18 @@ void BKE_mesh_calc_normals_split_ex(struct Mesh *mesh,
|
|||
* Higher level functions hiding most of the code needed around call to
|
||||
* #BKE_mesh_normals_loop_custom_set().
|
||||
*
|
||||
* \param r_custom_loopnors: is not const, since code will replace zero_v3 normals there
|
||||
* \param r_custom_loop_normals: is not const, since code will replace zero_v3 normals there
|
||||
* with automatically computed vectors.
|
||||
*/
|
||||
void BKE_mesh_set_custom_normals(struct Mesh *mesh, float (*r_custom_loopnors)[3]);
|
||||
void BKE_mesh_set_custom_normals(struct Mesh *mesh, float (*r_custom_loop_normals)[3]);
|
||||
/**
|
||||
* Higher level functions hiding most of the code needed around call to
|
||||
* #BKE_mesh_normals_loop_custom_from_verts_set().
|
||||
*
|
||||
* \param r_custom_vertnors: is not const, since code will replace zero_v3 normals there
|
||||
* \param r_custom_vert_normals: is not const, since code will replace zero_v3 normals there
|
||||
* with automatically computed vectors.
|
||||
*/
|
||||
void BKE_mesh_set_custom_normals_from_verts(struct Mesh *mesh, float (*r_custom_vertnors)[3]);
|
||||
void BKE_mesh_set_custom_normals_from_verts(struct Mesh *mesh, float (*r_custom_vert_normals)[3]);
|
||||
|
||||
/* *** mesh_evaluate.cc *** */
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ struct Scene;
|
|||
int BKE_mesh_runtime_looptri_len(const struct Mesh *mesh);
|
||||
|
||||
/**
|
||||
* Return mesh triangulation data, calculated lazily when necessary necessary.
|
||||
* Return mesh triangulation data, calculated lazily when necessary.
|
||||
* See #MLoopTri for further description of mesh triangulation.
|
||||
*
|
||||
* \note Prefer #Mesh::looptris() in C++ code.
|
||||
|
|
|
@ -21,7 +21,7 @@ void BKE_mesh_calc_loop_tangent_single_ex(const struct MVert *mverts,
|
|||
int numVerts,
|
||||
const struct MLoop *mloops,
|
||||
float (*r_looptangent)[4],
|
||||
const float (*loopnors)[3],
|
||||
const float (*loop_normals)[3],
|
||||
const struct MLoopUV *loopuv,
|
||||
int numLoops,
|
||||
const struct MPoly *mpolys,
|
||||
|
|
|
@ -141,6 +141,8 @@ class bNodeTreeRuntime : NonCopyable, NonMovable {
|
|||
bool has_undefined_nodes_or_sockets = false;
|
||||
bNode *group_output_node = nullptr;
|
||||
Vector<bNode *> root_frames;
|
||||
Vector<bNodeSocket *> interface_inputs;
|
||||
Vector<bNodeSocket *> interface_outputs;
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -426,6 +428,18 @@ inline blender::Span<const bNode *> bNodeTree::group_input_nodes() const
|
|||
return this->nodes_by_type("NodeGroupInput");
|
||||
}
|
||||
|
||||
inline blender::Span<const bNodeSocket *> bNodeTree::interface_inputs() const
|
||||
{
|
||||
BLI_assert(blender::bke::node_tree_runtime::topology_cache_is_available(*this));
|
||||
return this->runtime->interface_inputs;
|
||||
}
|
||||
|
||||
inline blender::Span<const bNodeSocket *> bNodeTree::interface_outputs() const
|
||||
{
|
||||
BLI_assert(blender::bke::node_tree_runtime::topology_cache_is_available(*this));
|
||||
return this->runtime->interface_outputs;
|
||||
}
|
||||
|
||||
inline blender::Span<const bNodeSocket *> bNodeTree::all_input_sockets() const
|
||||
{
|
||||
BLI_assert(blender::bke::node_tree_runtime::topology_cache_is_available(*this));
|
||||
|
|
|
@ -665,7 +665,7 @@ float psys_get_current_display_percentage(struct ParticleSystem *psys, bool use_
|
|||
/* psys_reset */
|
||||
#define PSYS_RESET_ALL 1
|
||||
#define PSYS_RESET_DEPSGRAPH 2
|
||||
/* #define PSYS_RESET_CHILDREN 3 */ /*UNUSED*/
|
||||
// #define PSYS_RESET_CHILDREN 3 /*UNUSED*/
|
||||
#define PSYS_RESET_CACHE_MISS 4
|
||||
|
||||
/* index_dmcache */
|
||||
|
|
|
@ -71,7 +71,7 @@ struct PBVHPublic {
|
|||
|
||||
/* A generic PBVH vertex.
|
||||
*
|
||||
* Note: in PBVH_GRIDS we consider the final grid points
|
||||
* NOTE: in PBVH_GRIDS we consider the final grid points
|
||||
* to be vertices. This is not true of edges or faces which are pulled from
|
||||
* the base mesh.
|
||||
*/
|
||||
|
@ -79,12 +79,12 @@ typedef struct PBVHVertRef {
|
|||
intptr_t i;
|
||||
} PBVHVertRef;
|
||||
|
||||
/* Note: edges in PBVH_GRIDS are always pulled from the base mesh.*/
|
||||
/* NOTE: edges in PBVH_GRIDS are always pulled from the base mesh. */
|
||||
typedef struct PBVHEdgeRef {
|
||||
intptr_t i;
|
||||
} PBVHEdgeRef;
|
||||
|
||||
/* Note: faces in PBVH_GRIDS are always puled from the base mesh.*/
|
||||
/* NOTE: faces in PBVH_GRIDS are always puled from the base mesh. */
|
||||
typedef struct PBVHFaceRef {
|
||||
intptr_t i;
|
||||
} PBVHFaceRef;
|
||||
|
|
|
@ -27,7 +27,7 @@ extern "C" {
|
|||
#define PTCACHE_RESET_DEPSGRAPH 0
|
||||
#define PTCACHE_RESET_BAKED 1
|
||||
#define PTCACHE_RESET_OUTDATED 2
|
||||
/* #define PTCACHE_RESET_FREE 3 */ /*UNUSED*/
|
||||
// #define PTCACHE_RESET_FREE 3 /*UNUSED*/
|
||||
|
||||
/* Add the blend-file name after `blendcache_`. */
|
||||
#define PTCACHE_EXT ".bphys"
|
||||
|
|
|
@ -75,7 +75,7 @@ typedef struct ShrinkwrapTreeData {
|
|||
|
||||
const struct MPoly *polys;
|
||||
const float (*vert_normals)[3];
|
||||
const float (*pnors)[3];
|
||||
const float (*poly_normals)[3];
|
||||
const float (*clnors)[3];
|
||||
ShrinkwrapBoundaryData *boundary;
|
||||
} ShrinkwrapTreeData;
|
||||
|
|
|
@ -1,746 +0,0 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <fstream>
|
||||
#include <optional>
|
||||
|
||||
#include "BLI_array.hh"
|
||||
#include "BLI_edgehash.h"
|
||||
#include "BLI_float3x3.hh"
|
||||
#include "BLI_map.hh"
|
||||
#include "BLI_math.h"
|
||||
#include "BLI_math_vec_types.hh"
|
||||
#include "BLI_rect.h"
|
||||
#include "BLI_vector.hh"
|
||||
#include "BLI_vector_list.hh"
|
||||
|
||||
#include "DNA_meshdata_types.h"
|
||||
|
||||
namespace blender::bke::uv_islands {
|
||||
|
||||
struct MeshEdge;
|
||||
struct MeshPrimitive;
|
||||
struct UVBorder;
|
||||
struct UVEdge;
|
||||
struct UVIslands;
|
||||
struct UVIslandsMask;
|
||||
struct UVPrimitive;
|
||||
struct UVPrimitiveEdge;
|
||||
struct UVVertex;
|
||||
|
||||
struct MeshVertex {
|
||||
int64_t v;
|
||||
Vector<MeshEdge *> edges;
|
||||
};
|
||||
|
||||
struct MeshUVVert {
|
||||
MeshVertex *vertex;
|
||||
float2 uv;
|
||||
int64_t loop;
|
||||
};
|
||||
|
||||
struct MeshEdge {
|
||||
MeshVertex *vert1;
|
||||
MeshVertex *vert2;
|
||||
Vector<MeshPrimitive *> primitives;
|
||||
};
|
||||
|
||||
/** Represents a triangle in 3d space (MLoopTri) */
|
||||
struct MeshPrimitive {
|
||||
int64_t index;
|
||||
int64_t poly;
|
||||
Vector<MeshEdge *, 3> edges;
|
||||
Vector<MeshUVVert, 3> vertices;
|
||||
|
||||
/**
|
||||
* UV island this primitive belongs to. This is used to speed up the initial uv island
|
||||
* extraction, but should not be used when extending uv islands.
|
||||
*/
|
||||
int64_t uv_island_id;
|
||||
|
||||
MeshUVVert *get_other_uv_vertex(const MeshVertex *v1, const MeshVertex *v2)
|
||||
{
|
||||
BLI_assert(vertices[0].vertex == v1 || vertices[1].vertex == v1 || vertices[2].vertex == v1);
|
||||
BLI_assert(vertices[0].vertex == v2 || vertices[1].vertex == v2 || vertices[2].vertex == v2);
|
||||
for (MeshUVVert &uv_vertex : vertices) {
|
||||
if (uv_vertex.vertex != v1 && uv_vertex.vertex != v2) {
|
||||
return &uv_vertex;
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
rctf uv_bounds() const;
|
||||
|
||||
bool has_shared_uv_edge(const MeshPrimitive *other) const
|
||||
{
|
||||
int shared_uv_verts = 0;
|
||||
for (const MeshUVVert &vert : vertices) {
|
||||
for (const MeshUVVert &other_vert : other->vertices) {
|
||||
if (vert.uv == other_vert.uv) {
|
||||
shared_uv_verts += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
return shared_uv_verts >= 2;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* MeshData contains input geometry data converted in a list of primitives, edges and vertices for
|
||||
* quick access for both local space and uv space.
|
||||
*/
|
||||
struct MeshData {
|
||||
public:
|
||||
const MLoopTri *looptri;
|
||||
const int64_t looptri_len;
|
||||
const int64_t vert_len;
|
||||
const MLoop *mloop;
|
||||
const MLoopUV *mloopuv;
|
||||
|
||||
public:
|
||||
Vector<MeshPrimitive> primitives;
|
||||
Vector<MeshEdge> edges;
|
||||
Vector<MeshVertex> vertices;
|
||||
/** Total number of uv islands detected. */
|
||||
int64_t uv_island_len;
|
||||
|
||||
explicit MeshData(const MLoopTri *looptri,
|
||||
const int64_t looptri_len,
|
||||
const int64_t vert_len,
|
||||
const MLoop *mloop,
|
||||
const MLoopUV *mloopuv)
|
||||
: looptri(looptri),
|
||||
looptri_len(looptri_len),
|
||||
vert_len(vert_len),
|
||||
mloop(mloop),
|
||||
mloopuv(mloopuv)
|
||||
{
|
||||
init_vertices();
|
||||
init_primitives();
|
||||
init_edges();
|
||||
init_primitive_uv_island_ids();
|
||||
}
|
||||
|
||||
void init_vertices()
|
||||
{
|
||||
vertices.reserve(vert_len);
|
||||
for (int64_t i = 0; i < vert_len; i++) {
|
||||
MeshVertex vert;
|
||||
vert.v = i;
|
||||
vertices.append(vert);
|
||||
}
|
||||
}
|
||||
|
||||
void init_primitives()
|
||||
{
|
||||
primitives.reserve(looptri_len);
|
||||
for (int64_t i = 0; i < looptri_len; i++) {
|
||||
const MLoopTri &tri = looptri[i];
|
||||
MeshPrimitive primitive;
|
||||
primitive.index = i;
|
||||
primitive.poly = tri.poly;
|
||||
|
||||
for (int j = 0; j < 3; j++) {
|
||||
MeshUVVert uv_vert;
|
||||
uv_vert.loop = tri.tri[j];
|
||||
uv_vert.vertex = &vertices[mloop[uv_vert.loop].v];
|
||||
uv_vert.uv = mloopuv[uv_vert.loop].uv;
|
||||
primitive.vertices.append(uv_vert);
|
||||
}
|
||||
primitives.append(primitive);
|
||||
}
|
||||
}
|
||||
|
||||
void init_edges()
|
||||
{
|
||||
edges.reserve(looptri_len * 2);
|
||||
EdgeHash *eh = BLI_edgehash_new_ex(__func__, looptri_len * 3);
|
||||
for (int64_t i = 0; i < looptri_len; i++) {
|
||||
const MLoopTri &tri = looptri[i];
|
||||
MeshPrimitive &primitive = primitives[i];
|
||||
for (int j = 0; j < 3; j++) {
|
||||
int v1 = mloop[tri.tri[j]].v;
|
||||
int v2 = mloop[tri.tri[(j + 1) % 3]].v;
|
||||
/* TODO: Use lookup_ptr to be able to store edge 0. */
|
||||
void *v = BLI_edgehash_lookup(eh, v1, v2);
|
||||
int64_t edge_index;
|
||||
if (v == nullptr) {
|
||||
edge_index = edges.size();
|
||||
BLI_edgehash_insert(eh, v1, v2, POINTER_FROM_INT(edge_index + 1));
|
||||
MeshEdge edge;
|
||||
edge.vert1 = &vertices[v1];
|
||||
edge.vert2 = &vertices[v2];
|
||||
edges.append(edge);
|
||||
MeshEdge *edge_ptr = &edges.last();
|
||||
vertices[v1].edges.append(edge_ptr);
|
||||
vertices[v2].edges.append(edge_ptr);
|
||||
}
|
||||
else {
|
||||
edge_index = POINTER_AS_INT(v) - 1;
|
||||
}
|
||||
|
||||
MeshEdge *edge = &edges[edge_index];
|
||||
edge->primitives.append(&primitive);
|
||||
primitive.edges.append(edge);
|
||||
}
|
||||
}
|
||||
BLI_edgehash_free(eh, nullptr);
|
||||
}
|
||||
|
||||
static const int64_t INVALID_UV_ISLAND_ID = -1;
|
||||
/**
|
||||
* NOTE: doesn't support weird topology where unconnected mesh primitives share the same uv
|
||||
* island. For a accurate implementation we should use implement an uv_prim_lookup.
|
||||
*/
|
||||
static void extract_uv_neighbors(Vector<MeshPrimitive *> &prims_to_add, MeshPrimitive *primitive)
|
||||
{
|
||||
for (MeshEdge *edge : primitive->edges) {
|
||||
for (MeshPrimitive *other_primitive : edge->primitives) {
|
||||
if (primitive == other_primitive) {
|
||||
continue;
|
||||
}
|
||||
if (other_primitive->uv_island_id != MeshData::INVALID_UV_ISLAND_ID) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (primitive->has_shared_uv_edge(other_primitive)) {
|
||||
prims_to_add.append(other_primitive);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void init_primitive_uv_island_ids()
|
||||
{
|
||||
for (MeshPrimitive &primitive : primitives) {
|
||||
primitive.uv_island_id = INVALID_UV_ISLAND_ID;
|
||||
}
|
||||
|
||||
int64_t uv_island_id = 0;
|
||||
Vector<MeshPrimitive *> prims_to_add;
|
||||
for (MeshPrimitive &primitive : primitives) {
|
||||
/* Early exit when uv island id is already extracted during uv neighbor extractions. */
|
||||
if (primitive.uv_island_id != INVALID_UV_ISLAND_ID) {
|
||||
continue;
|
||||
}
|
||||
|
||||
prims_to_add.append(&primitive);
|
||||
while (!prims_to_add.is_empty()) {
|
||||
MeshPrimitive *primitive = prims_to_add.pop_last();
|
||||
primitive->uv_island_id = uv_island_id;
|
||||
extract_uv_neighbors(prims_to_add, primitive);
|
||||
}
|
||||
uv_island_id++;
|
||||
}
|
||||
uv_island_len = uv_island_id;
|
||||
}
|
||||
};
|
||||
|
||||
struct UVVertex {
|
||||
MeshVertex *vertex;
|
||||
/* Position in uv space. */
|
||||
float2 uv;
|
||||
|
||||
/* uv edges that share this UVVertex. */
|
||||
Vector<UVEdge *> uv_edges;
|
||||
|
||||
struct {
|
||||
bool is_border : 1;
|
||||
bool is_extended : 1;
|
||||
} flags;
|
||||
|
||||
explicit UVVertex()
|
||||
{
|
||||
flags.is_border = false;
|
||||
flags.is_extended = false;
|
||||
}
|
||||
|
||||
explicit UVVertex(const MeshUVVert &vert) : vertex(vert.vertex), uv(vert.uv)
|
||||
{
|
||||
flags.is_border = false;
|
||||
flags.is_extended = false;
|
||||
}
|
||||
};
|
||||
|
||||
struct UVEdge {
|
||||
std::array<UVVertex *, 2> vertices;
|
||||
Vector<UVPrimitive *, 2> uv_primitives;
|
||||
|
||||
bool has_shared_edge(const MeshUVVert &v1, const MeshUVVert &v2) const
|
||||
{
|
||||
return (vertices[0]->uv == v1.uv && vertices[1]->uv == v2.uv) ||
|
||||
(vertices[0]->uv == v2.uv && vertices[1]->uv == v1.uv);
|
||||
}
|
||||
|
||||
bool has_shared_edge(const UVVertex &v1, const UVVertex &v2) const
|
||||
{
|
||||
return (vertices[0]->uv == v1.uv && vertices[1]->uv == v2.uv) ||
|
||||
(vertices[0]->uv == v2.uv && vertices[1]->uv == v1.uv);
|
||||
}
|
||||
|
||||
bool has_shared_edge(const UVEdge &other) const
|
||||
{
|
||||
return has_shared_edge(*other.vertices[0], *other.vertices[1]);
|
||||
}
|
||||
|
||||
bool has_same_vertices(const MeshVertex &vert1, const MeshVertex &vert2) const
|
||||
{
|
||||
return (vertices[0]->vertex == &vert1 && vertices[1]->vertex == &vert2) ||
|
||||
(vertices[0]->vertex == &vert2 && vertices[1]->vertex == &vert1);
|
||||
}
|
||||
|
||||
bool has_same_uv_vertices(const UVEdge &other) const
|
||||
{
|
||||
return has_shared_edge(other) &&
|
||||
has_same_vertices(*other.vertices[0]->vertex, *other.vertices[1]->vertex);
|
||||
;
|
||||
}
|
||||
|
||||
bool has_same_vertices(const MeshEdge &edge) const
|
||||
{
|
||||
return has_same_vertices(*edge.vert1, *edge.vert2);
|
||||
}
|
||||
|
||||
bool is_border_edge() const
|
||||
{
|
||||
return uv_primitives.size() == 1;
|
||||
}
|
||||
|
||||
void append_to_uv_vertices()
|
||||
{
|
||||
for (UVVertex *vertex : vertices) {
|
||||
vertex->uv_edges.append_non_duplicates(this);
|
||||
}
|
||||
}
|
||||
|
||||
UVVertex *get_other_uv_vertex(const MeshVertex *vertex)
|
||||
{
|
||||
if (vertices[0]->vertex == vertex) {
|
||||
return vertices[1];
|
||||
}
|
||||
return vertices[0];
|
||||
}
|
||||
};
|
||||
|
||||
struct UVPrimitive {
|
||||
/**
|
||||
* Index of the primitive in the original mesh.
|
||||
*/
|
||||
MeshPrimitive *primitive;
|
||||
Vector<UVEdge *, 3> edges;
|
||||
|
||||
explicit UVPrimitive(MeshPrimitive *primitive) : primitive(primitive)
|
||||
{
|
||||
}
|
||||
|
||||
void append_to_uv_edges()
|
||||
{
|
||||
for (UVEdge *uv_edge : edges) {
|
||||
uv_edge->uv_primitives.append_non_duplicates(this);
|
||||
}
|
||||
}
|
||||
void append_to_uv_vertices()
|
||||
{
|
||||
for (UVEdge *uv_edge : edges) {
|
||||
uv_edge->append_to_uv_vertices();
|
||||
}
|
||||
}
|
||||
|
||||
Vector<std::pair<UVEdge *, UVEdge *>> shared_edges(UVPrimitive &other)
|
||||
{
|
||||
Vector<std::pair<UVEdge *, UVEdge *>> result;
|
||||
for (int i = 0; i < 3; i++) {
|
||||
for (int j = 0; j < 3; j++) {
|
||||
if (edges[i]->has_shared_edge(*other.edges[j])) {
|
||||
result.append(std::pair<UVEdge *, UVEdge *>(edges[i], other.edges[j]));
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
bool has_shared_edge(const UVPrimitive &other) const
|
||||
{
|
||||
for (int i = 0; i < 3; i++) {
|
||||
for (int j = 0; j < 3; j++) {
|
||||
if (edges[i]->has_shared_edge(*other.edges[j])) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool has_shared_edge(const MeshPrimitive &primitive) const
|
||||
{
|
||||
for (const UVEdge *uv_edge : edges) {
|
||||
const MeshUVVert *v1 = &primitive.vertices.last();
|
||||
for (int i = 0; i < primitive.vertices.size(); i++) {
|
||||
const MeshUVVert *v2 = &primitive.vertices[i];
|
||||
if (uv_edge->has_shared_edge(*v1, *v2)) {
|
||||
return true;
|
||||
}
|
||||
v1 = v2;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the UVVertex in the order that the verts are ordered in the MeshPrimitive.
|
||||
*/
|
||||
const UVVertex *get_uv_vertex(const uint8_t mesh_vert_index) const
|
||||
{
|
||||
const MeshVertex *mesh_vertex = primitive->vertices[mesh_vert_index].vertex;
|
||||
for (const UVEdge *uv_edge : edges) {
|
||||
for (const UVVertex *uv_vert : uv_edge->vertices) {
|
||||
if (uv_vert->vertex == mesh_vertex) {
|
||||
return uv_vert;
|
||||
}
|
||||
}
|
||||
}
|
||||
BLI_assert_unreachable();
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the UVEdge that share the given uv coordinates.
|
||||
* Will assert when no UVEdge found.
|
||||
*/
|
||||
UVEdge *get_uv_edge(const float2 uv1, const float2 uv2) const
|
||||
{
|
||||
for (UVEdge *uv_edge : edges) {
|
||||
const float2 &e1 = uv_edge->vertices[0]->uv;
|
||||
const float2 &e2 = uv_edge->vertices[1]->uv;
|
||||
if ((e1 == uv1 && e2 == uv2) || (e1 == uv2 && e2 == uv1)) {
|
||||
return uv_edge;
|
||||
}
|
||||
}
|
||||
BLI_assert_unreachable();
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
UVEdge *get_uv_edge(const MeshVertex *v1, const MeshVertex *v2) const
|
||||
{
|
||||
for (UVEdge *uv_edge : edges) {
|
||||
const MeshVertex *e1 = uv_edge->vertices[0]->vertex;
|
||||
const MeshVertex *e2 = uv_edge->vertices[1]->vertex;
|
||||
if ((e1 == v1 && e2 == v2) || (e1 == v2 && e2 == v1)) {
|
||||
return uv_edge;
|
||||
}
|
||||
}
|
||||
BLI_assert_unreachable();
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const bool contains_uv_vertex(const UVVertex *uv_vertex) const
|
||||
{
|
||||
for (UVEdge *edge : edges) {
|
||||
if (std::find(edge->vertices.begin(), edge->vertices.end(), uv_vertex) !=
|
||||
edge->vertices.end()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
const UVVertex *get_other_uv_vertex(const UVVertex *v1, const UVVertex *v2) const
|
||||
{
|
||||
BLI_assert(contains_uv_vertex(v1));
|
||||
BLI_assert(contains_uv_vertex(v2));
|
||||
|
||||
for (const UVEdge *edge : edges) {
|
||||
for (const UVVertex *uv_vertex : edge->vertices) {
|
||||
if (uv_vertex != v1 && uv_vertex != v2) {
|
||||
return uv_vertex;
|
||||
}
|
||||
}
|
||||
}
|
||||
BLI_assert_unreachable();
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
UVBorder extract_border() const;
|
||||
};
|
||||
|
||||
struct UVBorderEdge {
|
||||
UVEdge *edge;
|
||||
bool tag = false;
|
||||
UVPrimitive *uv_primitive;
|
||||
/* Should the vertices of the edge be evaluated in reverse order. */
|
||||
bool reverse_order = false;
|
||||
|
||||
int64_t index = -1;
|
||||
int64_t prev_index = -1;
|
||||
int64_t next_index = -1;
|
||||
int64_t border_index = -1;
|
||||
|
||||
explicit UVBorderEdge(UVEdge *edge, UVPrimitive *uv_primitive)
|
||||
: edge(edge), uv_primitive(uv_primitive)
|
||||
{
|
||||
}
|
||||
|
||||
UVVertex *get_uv_vertex(int index)
|
||||
{
|
||||
int actual_index = reverse_order ? 1 - index : index;
|
||||
return edge->vertices[actual_index];
|
||||
}
|
||||
|
||||
const UVVertex *get_uv_vertex(int index) const
|
||||
{
|
||||
int actual_index = reverse_order ? 1 - index : index;
|
||||
return edge->vertices[actual_index];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the uv vertex from the primitive that is not part of the edge.
|
||||
*/
|
||||
const UVVertex *get_other_uv_vertex() const
|
||||
{
|
||||
return uv_primitive->get_other_uv_vertex(edge->vertices[0], edge->vertices[1]);
|
||||
}
|
||||
|
||||
float length() const
|
||||
{
|
||||
return len_v2v2(edge->vertices[0]->uv, edge->vertices[1]->uv);
|
||||
}
|
||||
};
|
||||
|
||||
struct UVBorderCorner {
|
||||
UVBorderEdge *first;
|
||||
UVBorderEdge *second;
|
||||
float angle;
|
||||
|
||||
UVBorderCorner(UVBorderEdge *first, UVBorderEdge *second, float angle)
|
||||
: first(first), second(second), angle(angle)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculate a uv coordinate between the edges of the corner.
|
||||
*
|
||||
* 'min_uv_distance' is the minimum distance between the corner and the
|
||||
* resulting uv coordinate. The distance is in uv space.
|
||||
*/
|
||||
float2 uv(float factor, float min_uv_distance);
|
||||
};
|
||||
|
||||
struct UVBorder {
|
||||
/** Ordered list of UV Verts of the border of this island. */
|
||||
// TODO: support multiple rings + order (CW, CCW)
|
||||
Vector<UVBorderEdge> edges;
|
||||
|
||||
/**
|
||||
* Check if the border is counter clock wise from its island.
|
||||
*/
|
||||
bool is_ccw() const;
|
||||
|
||||
/**
|
||||
* Flip the order of the verts, changing the order between CW and CCW.
|
||||
*/
|
||||
void flip();
|
||||
|
||||
/**
|
||||
* Calculate the outside angle of the given vert.
|
||||
*/
|
||||
float outside_angle(const UVBorderEdge &vert) const;
|
||||
|
||||
void update_indexes(uint64_t border_index);
|
||||
|
||||
static std::optional<UVBorder> extract_from_edges(Vector<UVBorderEdge> &edges);
|
||||
|
||||
/** Remove edge from the border. updates the indexes. */
|
||||
void remove(int64_t index)
|
||||
{
|
||||
/* Could read the border_index from any border edge as they are consistent. */
|
||||
uint64_t border_index = edges[0].border_index;
|
||||
edges.remove(index);
|
||||
update_indexes(border_index);
|
||||
}
|
||||
};
|
||||
|
||||
struct UVIsland {
|
||||
VectorList<UVVertex> uv_vertices;
|
||||
VectorList<UVEdge> uv_edges;
|
||||
VectorList<UVPrimitive> uv_primitives;
|
||||
/**
|
||||
* List of borders of this island. There can be multiple borders per island as a border could
|
||||
* be completely encapsulated by another one.
|
||||
*/
|
||||
Vector<UVBorder> borders;
|
||||
|
||||
/**
|
||||
* Key is mesh vert index, Value is list of UVVertices that refer to the mesh vertex with that
|
||||
* index. Map is used internally to quickly lookup similar UVVertices.
|
||||
*/
|
||||
Map<int64_t, Vector<UVVertex *>> uv_vertex_lookup;
|
||||
|
||||
UVVertex *lookup(const UVVertex &vertex)
|
||||
{
|
||||
int64_t vert_index = vertex.vertex->v;
|
||||
Vector<UVVertex *> &vertices = uv_vertex_lookup.lookup_or_add_default(vert_index);
|
||||
for (UVVertex *v : vertices) {
|
||||
if (v->uv == vertex.uv) {
|
||||
return v;
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
UVVertex *lookup_or_create(const UVVertex &vertex)
|
||||
{
|
||||
UVVertex *found_vertex = lookup(vertex);
|
||||
if (found_vertex != nullptr) {
|
||||
return found_vertex;
|
||||
}
|
||||
|
||||
uv_vertices.append(vertex);
|
||||
UVVertex *result = &uv_vertices.last();
|
||||
result->uv_edges.clear();
|
||||
/* v is already a key. Ensured by UVIsland::lookup in this method. */
|
||||
uv_vertex_lookup.lookup(vertex.vertex->v).append(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
UVEdge *lookup(const UVEdge &edge)
|
||||
{
|
||||
UVVertex *found_vertex = lookup(*edge.vertices[0]);
|
||||
if (found_vertex == nullptr) {
|
||||
return nullptr;
|
||||
}
|
||||
for (UVEdge *e : found_vertex->uv_edges) {
|
||||
UVVertex *other_vertex = e->get_other_uv_vertex(found_vertex->vertex);
|
||||
if (other_vertex->vertex == edge.vertices[1]->vertex &&
|
||||
other_vertex->uv == edge.vertices[1]->uv) {
|
||||
return e;
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
UVEdge *lookup_or_create(const UVEdge &edge)
|
||||
{
|
||||
UVEdge *found_edge = lookup(edge);
|
||||
if (found_edge != nullptr) {
|
||||
return found_edge;
|
||||
}
|
||||
|
||||
uv_edges.append(edge);
|
||||
UVEdge *result = &uv_edges.last();
|
||||
result->uv_primitives.clear();
|
||||
return result;
|
||||
}
|
||||
|
||||
/** Initialize the border attribute. */
|
||||
void extract_borders();
|
||||
/** Iterative extend border to fit the mask. */
|
||||
void extend_border(const UVIslandsMask &mask, const short island_index);
|
||||
|
||||
private:
|
||||
void append(const UVPrimitive &primitive)
|
||||
{
|
||||
uv_primitives.append(primitive);
|
||||
UVPrimitive *new_prim_ptr = &uv_primitives.last();
|
||||
for (int i = 0; i < 3; i++) {
|
||||
UVEdge *other_edge = primitive.edges[i];
|
||||
UVEdge uv_edge_template;
|
||||
uv_edge_template.vertices[0] = lookup_or_create(*other_edge->vertices[0]);
|
||||
uv_edge_template.vertices[1] = lookup_or_create(*other_edge->vertices[1]);
|
||||
new_prim_ptr->edges[i] = lookup_or_create(uv_edge_template);
|
||||
new_prim_ptr->edges[i]->append_to_uv_vertices();
|
||||
new_prim_ptr->edges[i]->uv_primitives.append(new_prim_ptr);
|
||||
}
|
||||
}
|
||||
|
||||
public:
|
||||
bool has_shared_edge(const UVPrimitive &primitive) const
|
||||
{
|
||||
for (const VectorList<UVPrimitive>::UsedVector &prims : uv_primitives) {
|
||||
for (const UVPrimitive &prim : prims) {
|
||||
if (prim.has_shared_edge(primitive)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool has_shared_edge(const MeshPrimitive &primitive) const
|
||||
{
|
||||
for (const VectorList<UVPrimitive>::UsedVector &primitives : uv_primitives) {
|
||||
for (const UVPrimitive &prim : primitives) {
|
||||
if (prim.has_shared_edge(primitive)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
const void extend_border(const UVPrimitive &primitive)
|
||||
{
|
||||
for (const VectorList<UVPrimitive>::UsedVector &primitives : uv_primitives) {
|
||||
for (const UVPrimitive &prim : primitives) {
|
||||
if (prim.has_shared_edge(primitive)) {
|
||||
append(primitive);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
struct UVIslands {
|
||||
Vector<UVIsland> islands;
|
||||
|
||||
explicit UVIslands(MeshData &mesh_data);
|
||||
|
||||
void extract_borders();
|
||||
void extend_borders(const UVIslandsMask &islands_mask);
|
||||
};
|
||||
|
||||
/** Mask to find the index of the UVIsland for a given UV coordinate. */
|
||||
struct UVIslandsMask {
|
||||
|
||||
/** Mask for each udim tile. */
|
||||
struct Tile {
|
||||
float2 udim_offset;
|
||||
ushort2 tile_resolution;
|
||||
ushort2 mask_resolution;
|
||||
Array<uint16_t> mask;
|
||||
|
||||
Tile(float2 udim_offset, ushort2 tile_resolution);
|
||||
|
||||
bool is_masked(const uint16_t island_index, const float2 uv) const;
|
||||
bool contains(const float2 uv) const;
|
||||
float get_pixel_size_in_uv_space() const;
|
||||
};
|
||||
|
||||
Vector<Tile> tiles;
|
||||
|
||||
void add_tile(float2 udim_offset, ushort2 resolution);
|
||||
|
||||
/**
|
||||
* Find a tile containing the given uv coordinate.
|
||||
*/
|
||||
const Tile *find_tile(const float2 uv) const;
|
||||
|
||||
/**
|
||||
* Is the given uv coordinate part of the given island_index mask.
|
||||
*
|
||||
* true - part of the island mask.
|
||||
* false - not part of the island mask.
|
||||
*/
|
||||
bool is_masked(const uint16_t island_index, const float2 uv) const;
|
||||
|
||||
/**
|
||||
* Add the given UVIslands to the mask. Tiles should be added beforehand using the 'add_tile'
|
||||
* method.
|
||||
*/
|
||||
void add(const UVIslands &islands);
|
||||
|
||||
void dilate(int max_iterations);
|
||||
};
|
||||
|
||||
} // namespace blender::bke::uv_islands
|
|
@ -97,7 +97,7 @@ set(SRC
|
|||
intern/colortools.c
|
||||
intern/compute_contexts.cc
|
||||
intern/constraint.c
|
||||
intern/context.c
|
||||
intern/context.cc
|
||||
intern/cpp_types.cc
|
||||
intern/crazyspace.cc
|
||||
intern/cryptomatte.cc
|
||||
|
@ -480,7 +480,6 @@ set(SRC
|
|||
BKE_type_conversions.hh
|
||||
BKE_undo_system.h
|
||||
BKE_unit.h
|
||||
BKE_uv_islands.hh
|
||||
BKE_vfont.h
|
||||
BKE_vfontdata.h
|
||||
BKE_viewer_path.h
|
||||
|
|
|
@ -4,9 +4,9 @@
|
|||
* \ingroup bke
|
||||
*/
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <cstddef>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
|
@ -58,15 +58,15 @@ struct bContext {
|
|||
|
||||
/* windowmanager context */
|
||||
struct {
|
||||
struct wmWindowManager *manager;
|
||||
struct wmWindow *window;
|
||||
struct WorkSpace *workspace;
|
||||
struct bScreen *screen;
|
||||
struct ScrArea *area;
|
||||
struct ARegion *region;
|
||||
struct ARegion *menu;
|
||||
struct wmGizmoGroup *gizmo_group;
|
||||
struct bContextStore *store;
|
||||
wmWindowManager *manager;
|
||||
wmWindow *window;
|
||||
WorkSpace *workspace;
|
||||
bScreen *screen;
|
||||
ScrArea *area;
|
||||
ARegion *region;
|
||||
ARegion *menu;
|
||||
wmGizmoGroup *gizmo_group;
|
||||
bContextStore *store;
|
||||
|
||||
/* Operator poll. */
|
||||
/**
|
||||
|
@ -82,8 +82,8 @@ struct bContext {
|
|||
|
||||
/* data context */
|
||||
struct {
|
||||
struct Main *main;
|
||||
struct Scene *scene;
|
||||
Main *main;
|
||||
Scene *scene;
|
||||
|
||||
int recursion;
|
||||
/** True if python is initialized. */
|
||||
|
@ -101,14 +101,15 @@ struct bContext {
|
|||
|
||||
bContext *CTX_create(void)
|
||||
{
|
||||
bContext *C = MEM_callocN(sizeof(bContext), "bContext");
|
||||
bContext *C = MEM_cnew<bContext>(__func__);
|
||||
|
||||
return C;
|
||||
}
|
||||
|
||||
bContext *CTX_copy(const bContext *C)
|
||||
{
|
||||
bContext *newC = MEM_dupallocN((void *)C);
|
||||
bContext *newC = MEM_new<bContext>(__func__);
|
||||
*newC = *C;
|
||||
|
||||
memset(&newC->wm.operator_poll_msg_dyn_params, 0, sizeof(newC->wm.operator_poll_msg_dyn_params));
|
||||
|
||||
|
@ -125,30 +126,26 @@ void CTX_free(bContext *C)
|
|||
|
||||
/* store */
|
||||
|
||||
bContextStore *CTX_store_add(ListBase *contexts, const char *name, const PointerRNA *ptr)
|
||||
bContextStore *CTX_store_add(ListBase *contexts,
|
||||
const blender::StringRefNull name,
|
||||
const PointerRNA *ptr)
|
||||
{
|
||||
/* ensure we have a context to put the entry in, if it was already used
|
||||
* we have to copy the context to ensure */
|
||||
bContextStore *ctx = contexts->last;
|
||||
bContextStore *ctx = static_cast<bContextStore *>(contexts->last);
|
||||
|
||||
if (!ctx || ctx->used) {
|
||||
if (ctx) {
|
||||
bContextStore *lastctx = ctx;
|
||||
ctx = MEM_dupallocN(lastctx);
|
||||
BLI_duplicatelist(&ctx->entries, &lastctx->entries);
|
||||
ctx = MEM_new<bContextStore>(__func__, *ctx);
|
||||
}
|
||||
else {
|
||||
ctx = MEM_callocN(sizeof(bContextStore), "bContextStore");
|
||||
ctx = MEM_new<bContextStore>(__func__);
|
||||
}
|
||||
|
||||
BLI_addtail(contexts, ctx);
|
||||
}
|
||||
|
||||
bContextStoreEntry *entry = MEM_callocN(sizeof(bContextStoreEntry), "bContextStoreEntry");
|
||||
BLI_strncpy(entry->name, name, sizeof(entry->name));
|
||||
entry->ptr = *ptr;
|
||||
|
||||
BLI_addtail(&ctx->entries, entry);
|
||||
ctx->entries.append(bContextStoreEntry{name, *ptr});
|
||||
|
||||
return ctx;
|
||||
}
|
||||
|
@ -157,24 +154,21 @@ bContextStore *CTX_store_add_all(ListBase *contexts, bContextStore *context)
|
|||
{
|
||||
/* ensure we have a context to put the entries in, if it was already used
|
||||
* we have to copy the context to ensure */
|
||||
bContextStore *ctx = contexts->last;
|
||||
bContextStore *ctx = static_cast<bContextStore *>(contexts->last);
|
||||
|
||||
if (!ctx || ctx->used) {
|
||||
if (ctx) {
|
||||
bContextStore *lastctx = ctx;
|
||||
ctx = MEM_dupallocN(lastctx);
|
||||
BLI_duplicatelist(&ctx->entries, &lastctx->entries);
|
||||
ctx = MEM_new<bContextStore>(__func__, *ctx);
|
||||
}
|
||||
else {
|
||||
ctx = MEM_callocN(sizeof(bContextStore), "bContextStore");
|
||||
ctx = MEM_new<bContextStore>(__func__);
|
||||
}
|
||||
|
||||
BLI_addtail(contexts, ctx);
|
||||
}
|
||||
|
||||
LISTBASE_FOREACH (bContextStoreEntry *, tentry, &context->entries) {
|
||||
bContextStoreEntry *entry = MEM_dupallocN(tentry);
|
||||
BLI_addtail(&ctx->entries, entry);
|
||||
for (const bContextStoreEntry &src_entry : context->entries) {
|
||||
ctx->entries.append(src_entry);
|
||||
}
|
||||
|
||||
return ctx;
|
||||
|
@ -191,41 +185,27 @@ void CTX_store_set(bContext *C, bContextStore *store)
|
|||
}
|
||||
|
||||
const PointerRNA *CTX_store_ptr_lookup(const bContextStore *store,
|
||||
const char *name,
|
||||
const blender::StringRefNull name,
|
||||
const StructRNA *type)
|
||||
{
|
||||
bContextStoreEntry *entry = BLI_rfindstring(
|
||||
&store->entries, name, offsetof(bContextStoreEntry, name));
|
||||
if (!entry) {
|
||||
return NULL;
|
||||
for (auto entry = store->entries.rbegin(); entry != store->entries.rend(); ++entry) {
|
||||
if (entry->name == name) {
|
||||
if (type && RNA_struct_is_a(entry->ptr.type, type)) {
|
||||
return &entry->ptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (type && !RNA_struct_is_a(entry->ptr.type, type)) {
|
||||
return NULL;
|
||||
}
|
||||
return &entry->ptr;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bContextStore *CTX_store_copy(bContextStore *store)
|
||||
bContextStore *CTX_store_copy(const bContextStore *store)
|
||||
{
|
||||
bContextStore *ctx = MEM_dupallocN(store);
|
||||
BLI_duplicatelist(&ctx->entries, &store->entries);
|
||||
|
||||
return ctx;
|
||||
return MEM_new<bContextStore>(__func__, *store);
|
||||
}
|
||||
|
||||
void CTX_store_free(bContextStore *store)
|
||||
{
|
||||
BLI_freelistN(&store->entries);
|
||||
MEM_freeN(store);
|
||||
}
|
||||
|
||||
void CTX_store_free_list(ListBase *contexts)
|
||||
{
|
||||
bContextStore *ctx;
|
||||
while ((ctx = BLI_pophead(contexts))) {
|
||||
CTX_store_free(ctx);
|
||||
}
|
||||
MEM_delete(store);
|
||||
}
|
||||
|
||||
/* is python initialized? */
|
||||
|
@ -248,7 +228,7 @@ void *CTX_py_dict_get_orig(const bContext *C)
|
|||
return C->data.py_context_orig;
|
||||
}
|
||||
|
||||
void CTX_py_state_push(bContext *C, struct bContext_PyState *pystate, void *value)
|
||||
void CTX_py_state_push(bContext *C, bContext_PyState *pystate, void *value)
|
||||
{
|
||||
pystate->py_context = C->data.py_context;
|
||||
pystate->py_context_orig = C->data.py_context_orig;
|
||||
|
@ -256,7 +236,7 @@ void CTX_py_state_push(bContext *C, struct bContext_PyState *pystate, void *valu
|
|||
C->data.py_context = value;
|
||||
C->data.py_context_orig = value;
|
||||
}
|
||||
void CTX_py_state_pop(bContext *C, struct bContext_PyState *pystate)
|
||||
void CTX_py_state_pop(bContext *C, bContext_PyState *pystate)
|
||||
{
|
||||
C->data.py_context = pystate->py_context;
|
||||
C->data.py_context_orig = pystate->py_context_orig;
|
||||
|
@ -300,7 +280,7 @@ static void *ctx_wm_python_context_get(const bContext *C,
|
|||
|
||||
/* don't allow UI context access from non-main threads */
|
||||
if (!BLI_thread_is_main()) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return fall_through;
|
||||
|
@ -318,14 +298,14 @@ static eContextResult ctx_data_get(bContext *C, const char *member, bContextData
|
|||
#ifdef WITH_PYTHON
|
||||
if (CTX_py_dict_get(C)) {
|
||||
if (BPY_context_member_get(C, member, result)) {
|
||||
return 1;
|
||||
return CTX_RESULT_OK;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/* don't allow UI context access from non-main threads */
|
||||
if (!BLI_thread_is_main()) {
|
||||
return done;
|
||||
return CTX_RESULT_MEMBER_NOT_FOUND;
|
||||
}
|
||||
|
||||
/* we check recursion to ensure that we do not get infinite
|
||||
|
@ -340,7 +320,7 @@ static eContextResult ctx_data_get(bContext *C, const char *member, bContextData
|
|||
if (done != 1 && recursion < 1 && C->wm.store) {
|
||||
C->data.recursion = 1;
|
||||
|
||||
const PointerRNA *ptr = CTX_store_ptr_lookup(C->wm.store, member, NULL);
|
||||
const PointerRNA *ptr = CTX_store_ptr_lookup(C->wm.store, member, nullptr);
|
||||
|
||||
if (ptr) {
|
||||
result->ptr = *ptr;
|
||||
|
@ -367,7 +347,7 @@ static eContextResult ctx_data_get(bContext *C, const char *member, bContextData
|
|||
}
|
||||
|
||||
if (done != 1 && recursion < 4 && (screen = CTX_wm_screen(C))) {
|
||||
bContextDataCallback cb = screen->context;
|
||||
bContextDataCallback cb = reinterpret_cast<bContextDataCallback>(screen->context);
|
||||
C->data.recursion = 4;
|
||||
if (cb) {
|
||||
ret = cb(C, member, result);
|
||||
|
@ -379,7 +359,7 @@ static eContextResult ctx_data_get(bContext *C, const char *member, bContextData
|
|||
|
||||
C->data.recursion = recursion;
|
||||
|
||||
return done;
|
||||
return eContextResult(done);
|
||||
}
|
||||
|
||||
static void *ctx_data_pointer_get(const bContext *C, const char *member)
|
||||
|
@ -390,14 +370,14 @@ static void *ctx_data_pointer_get(const bContext *C, const char *member)
|
|||
return result.ptr.data;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
static bool ctx_data_pointer_verify(const bContext *C, const char *member, void **pointer)
|
||||
{
|
||||
/* if context is NULL, pointer must be NULL too and that is a valid return */
|
||||
if (C == NULL) {
|
||||
*pointer = NULL;
|
||||
/* if context is nullptr, pointer must be nullptr too and that is a valid return */
|
||||
if (C == nullptr) {
|
||||
*pointer = nullptr;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -408,7 +388,7 @@ static bool ctx_data_pointer_verify(const bContext *C, const char *member, void
|
|||
return true;
|
||||
}
|
||||
|
||||
*pointer = NULL;
|
||||
*pointer = nullptr;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -445,10 +425,11 @@ static int ctx_data_base_collection_get(const bContext *C, const char *member, L
|
|||
bool ok = false;
|
||||
|
||||
CollectionPointerLink *ctx_object;
|
||||
for (ctx_object = ctx_object_list.first; ctx_object; ctx_object = ctx_object->next) {
|
||||
Object *ob = ctx_object->ptr.data;
|
||||
for (ctx_object = static_cast<CollectionPointerLink *>(ctx_object_list.first); ctx_object;
|
||||
ctx_object = ctx_object->next) {
|
||||
Object *ob = static_cast<Object *>(ctx_object->ptr.data);
|
||||
Base *base = BKE_view_layer_base_find(view_layer, ob);
|
||||
if (base != NULL) {
|
||||
if (base != nullptr) {
|
||||
CTX_data_list_add(&result, &scene->id, &RNA_ObjectBase, base);
|
||||
ok = true;
|
||||
}
|
||||
|
@ -509,7 +490,7 @@ ListBase CTX_data_collection_get(const bContext *C, const char *member)
|
|||
return result.list;
|
||||
}
|
||||
|
||||
ListBase list = {NULL, NULL};
|
||||
ListBase list = {nullptr, nullptr};
|
||||
return list;
|
||||
}
|
||||
|
||||
|
@ -545,7 +526,7 @@ static void data_dir_add(ListBase *lb, const char *member, const bool use_all)
|
|||
return;
|
||||
}
|
||||
|
||||
link = MEM_callocN(sizeof(LinkData), "LinkData");
|
||||
link = MEM_cnew<LinkData>(__func__);
|
||||
link->data = (void *)member;
|
||||
BLI_addtail(lb, link);
|
||||
}
|
||||
|
@ -570,7 +551,7 @@ ListBase CTX_data_dir_get_ex(const bContext *C,
|
|||
|
||||
PropertyRNA *iterprop;
|
||||
PointerRNA ctx_ptr;
|
||||
RNA_pointer_create(NULL, &RNA_Context, (void *)C, &ctx_ptr);
|
||||
RNA_pointer_create(nullptr, &RNA_Context, (void *)C, &ctx_ptr);
|
||||
|
||||
iterprop = RNA_struct_iterator_property(ctx_ptr.type);
|
||||
|
||||
|
@ -586,10 +567,8 @@ ListBase CTX_data_dir_get_ex(const bContext *C,
|
|||
RNA_PROP_END;
|
||||
}
|
||||
if (use_store && C->wm.store) {
|
||||
bContextStoreEntry *entry;
|
||||
|
||||
for (entry = C->wm.store->entries.first; entry; entry = entry->next) {
|
||||
data_dir_add(&lb, entry->name, use_all);
|
||||
for (const bContextStoreEntry &entry : C->wm.store->entries) {
|
||||
data_dir_add(&lb, entry.name.c_str(), use_all);
|
||||
}
|
||||
}
|
||||
if ((region = CTX_wm_region(C)) && region->type && region->type->context) {
|
||||
|
@ -613,7 +592,7 @@ ListBase CTX_data_dir_get_ex(const bContext *C,
|
|||
}
|
||||
}
|
||||
if ((screen = CTX_wm_screen(C)) && screen->context) {
|
||||
bContextDataCallback cb = screen->context;
|
||||
bContextDataCallback cb = reinterpret_cast<bContextDataCallback>(screen->context);
|
||||
memset(&result, 0, sizeof(result));
|
||||
cb(C, "", &result);
|
||||
|
||||
|
@ -659,7 +638,7 @@ void CTX_data_pointer_set_ptr(bContextDataResult *result, const PointerRNA *ptr)
|
|||
|
||||
void CTX_data_id_list_add(bContextDataResult *result, ID *id)
|
||||
{
|
||||
CollectionPointerLink *link = MEM_callocN(sizeof(CollectionPointerLink), "CTX_data_id_list_add");
|
||||
CollectionPointerLink *link = MEM_cnew<CollectionPointerLink>(__func__);
|
||||
RNA_id_pointer_create(id, &link->ptr);
|
||||
|
||||
BLI_addtail(&result->list, link);
|
||||
|
@ -667,7 +646,7 @@ void CTX_data_id_list_add(bContextDataResult *result, ID *id)
|
|||
|
||||
void CTX_data_list_add(bContextDataResult *result, ID *id, StructRNA *type, void *data)
|
||||
{
|
||||
CollectionPointerLink *link = MEM_callocN(sizeof(CollectionPointerLink), "CTX_data_list_add");
|
||||
CollectionPointerLink *link = MEM_cnew<CollectionPointerLink>(__func__);
|
||||
RNA_pointer_create(id, type, data, &link->ptr);
|
||||
|
||||
BLI_addtail(&result->list, link);
|
||||
|
@ -675,7 +654,7 @@ void CTX_data_list_add(bContextDataResult *result, ID *id, StructRNA *type, void
|
|||
|
||||
void CTX_data_list_add_ptr(bContextDataResult *result, const PointerRNA *ptr)
|
||||
{
|
||||
CollectionPointerLink *link = MEM_callocN(sizeof(CollectionPointerLink), "CTX_data_list_add");
|
||||
CollectionPointerLink *link = MEM_cnew<CollectionPointerLink>(__func__);
|
||||
link->ptr = *ptr;
|
||||
|
||||
BLI_addtail(&result->list, link);
|
||||
|
@ -718,77 +697,79 @@ wmWindowManager *CTX_wm_manager(const bContext *C)
|
|||
|
||||
bool CTX_wm_interface_locked(const bContext *C)
|
||||
{
|
||||
return (bool)C->wm.manager->is_interface_locked;
|
||||
return bool(C->wm.manager->is_interface_locked);
|
||||
}
|
||||
|
||||
wmWindow *CTX_wm_window(const bContext *C)
|
||||
{
|
||||
return ctx_wm_python_context_get(C, "window", &RNA_Window, C->wm.window);
|
||||
return static_cast<wmWindow *>(
|
||||
ctx_wm_python_context_get(C, "window", &RNA_Window, C->wm.window));
|
||||
}
|
||||
|
||||
WorkSpace *CTX_wm_workspace(const bContext *C)
|
||||
{
|
||||
return ctx_wm_python_context_get(C, "workspace", &RNA_WorkSpace, C->wm.workspace);
|
||||
return static_cast<WorkSpace *>(
|
||||
ctx_wm_python_context_get(C, "workspace", &RNA_WorkSpace, C->wm.workspace));
|
||||
}
|
||||
|
||||
bScreen *CTX_wm_screen(const bContext *C)
|
||||
{
|
||||
return ctx_wm_python_context_get(C, "screen", &RNA_Screen, C->wm.screen);
|
||||
return static_cast<bScreen *>(ctx_wm_python_context_get(C, "screen", &RNA_Screen, C->wm.screen));
|
||||
}
|
||||
|
||||
ScrArea *CTX_wm_area(const bContext *C)
|
||||
{
|
||||
return ctx_wm_python_context_get(C, "area", &RNA_Area, C->wm.area);
|
||||
return static_cast<ScrArea *>(ctx_wm_python_context_get(C, "area", &RNA_Area, C->wm.area));
|
||||
}
|
||||
|
||||
SpaceLink *CTX_wm_space_data(const bContext *C)
|
||||
{
|
||||
ScrArea *area = CTX_wm_area(C);
|
||||
return (area) ? area->spacedata.first : NULL;
|
||||
return (area) ? static_cast<SpaceLink *>(area->spacedata.first) : nullptr;
|
||||
}
|
||||
|
||||
ARegion *CTX_wm_region(const bContext *C)
|
||||
{
|
||||
return ctx_wm_python_context_get(C, "region", &RNA_Region, C->wm.region);
|
||||
return static_cast<ARegion *>(ctx_wm_python_context_get(C, "region", &RNA_Region, C->wm.region));
|
||||
}
|
||||
|
||||
void *CTX_wm_region_data(const bContext *C)
|
||||
{
|
||||
ARegion *region = CTX_wm_region(C);
|
||||
return (region) ? region->regiondata : NULL;
|
||||
return (region) ? region->regiondata : nullptr;
|
||||
}
|
||||
|
||||
struct ARegion *CTX_wm_menu(const bContext *C)
|
||||
ARegion *CTX_wm_menu(const bContext *C)
|
||||
{
|
||||
return C->wm.menu;
|
||||
}
|
||||
|
||||
struct wmGizmoGroup *CTX_wm_gizmo_group(const bContext *C)
|
||||
wmGizmoGroup *CTX_wm_gizmo_group(const bContext *C)
|
||||
{
|
||||
return C->wm.gizmo_group;
|
||||
}
|
||||
|
||||
struct wmMsgBus *CTX_wm_message_bus(const bContext *C)
|
||||
wmMsgBus *CTX_wm_message_bus(const bContext *C)
|
||||
{
|
||||
return C->wm.manager ? C->wm.manager->message_bus : NULL;
|
||||
return C->wm.manager ? C->wm.manager->message_bus : nullptr;
|
||||
}
|
||||
|
||||
struct ReportList *CTX_wm_reports(const bContext *C)
|
||||
ReportList *CTX_wm_reports(const bContext *C)
|
||||
{
|
||||
if (C->wm.manager) {
|
||||
return &(C->wm.manager->reports);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
View3D *CTX_wm_view3d(const bContext *C)
|
||||
{
|
||||
ScrArea *area = CTX_wm_area(C);
|
||||
if (area && area->spacetype == SPACE_VIEW3D) {
|
||||
return area->spacedata.first;
|
||||
return static_cast<View3D *>(area->spacedata.first);
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
RegionView3D *CTX_wm_region_view3d(const bContext *C)
|
||||
|
@ -798,163 +779,163 @@ RegionView3D *CTX_wm_region_view3d(const bContext *C)
|
|||
|
||||
if (area && area->spacetype == SPACE_VIEW3D) {
|
||||
if (region && region->regiontype == RGN_TYPE_WINDOW) {
|
||||
return region->regiondata;
|
||||
return static_cast<RegionView3D *>(region->regiondata);
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
struct SpaceText *CTX_wm_space_text(const bContext *C)
|
||||
SpaceText *CTX_wm_space_text(const bContext *C)
|
||||
{
|
||||
ScrArea *area = CTX_wm_area(C);
|
||||
if (area && area->spacetype == SPACE_TEXT) {
|
||||
return area->spacedata.first;
|
||||
return static_cast<SpaceText *>(area->spacedata.first);
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
struct SpaceConsole *CTX_wm_space_console(const bContext *C)
|
||||
SpaceConsole *CTX_wm_space_console(const bContext *C)
|
||||
{
|
||||
ScrArea *area = CTX_wm_area(C);
|
||||
if (area && area->spacetype == SPACE_CONSOLE) {
|
||||
return area->spacedata.first;
|
||||
return static_cast<SpaceConsole *>(area->spacedata.first);
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
struct SpaceImage *CTX_wm_space_image(const bContext *C)
|
||||
SpaceImage *CTX_wm_space_image(const bContext *C)
|
||||
{
|
||||
ScrArea *area = CTX_wm_area(C);
|
||||
if (area && area->spacetype == SPACE_IMAGE) {
|
||||
return area->spacedata.first;
|
||||
return static_cast<SpaceImage *>(area->spacedata.first);
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
struct SpaceProperties *CTX_wm_space_properties(const bContext *C)
|
||||
SpaceProperties *CTX_wm_space_properties(const bContext *C)
|
||||
{
|
||||
ScrArea *area = CTX_wm_area(C);
|
||||
if (area && area->spacetype == SPACE_PROPERTIES) {
|
||||
return area->spacedata.first;
|
||||
return static_cast<SpaceProperties *>(area->spacedata.first);
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
struct SpaceFile *CTX_wm_space_file(const bContext *C)
|
||||
SpaceFile *CTX_wm_space_file(const bContext *C)
|
||||
{
|
||||
ScrArea *area = CTX_wm_area(C);
|
||||
if (area && area->spacetype == SPACE_FILE) {
|
||||
return area->spacedata.first;
|
||||
return static_cast<SpaceFile *>(area->spacedata.first);
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
struct SpaceSeq *CTX_wm_space_seq(const bContext *C)
|
||||
SpaceSeq *CTX_wm_space_seq(const bContext *C)
|
||||
{
|
||||
ScrArea *area = CTX_wm_area(C);
|
||||
if (area && area->spacetype == SPACE_SEQ) {
|
||||
return area->spacedata.first;
|
||||
return static_cast<SpaceSeq *>(area->spacedata.first);
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
struct SpaceOutliner *CTX_wm_space_outliner(const bContext *C)
|
||||
SpaceOutliner *CTX_wm_space_outliner(const bContext *C)
|
||||
{
|
||||
ScrArea *area = CTX_wm_area(C);
|
||||
if (area && area->spacetype == SPACE_OUTLINER) {
|
||||
return area->spacedata.first;
|
||||
return static_cast<SpaceOutliner *>(area->spacedata.first);
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
struct SpaceNla *CTX_wm_space_nla(const bContext *C)
|
||||
SpaceNla *CTX_wm_space_nla(const bContext *C)
|
||||
{
|
||||
ScrArea *area = CTX_wm_area(C);
|
||||
if (area && area->spacetype == SPACE_NLA) {
|
||||
return area->spacedata.first;
|
||||
return static_cast<SpaceNla *>(area->spacedata.first);
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
struct SpaceNode *CTX_wm_space_node(const bContext *C)
|
||||
SpaceNode *CTX_wm_space_node(const bContext *C)
|
||||
{
|
||||
ScrArea *area = CTX_wm_area(C);
|
||||
if (area && area->spacetype == SPACE_NODE) {
|
||||
return area->spacedata.first;
|
||||
return static_cast<SpaceNode *>(area->spacedata.first);
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
struct SpaceGraph *CTX_wm_space_graph(const bContext *C)
|
||||
SpaceGraph *CTX_wm_space_graph(const bContext *C)
|
||||
{
|
||||
ScrArea *area = CTX_wm_area(C);
|
||||
if (area && area->spacetype == SPACE_GRAPH) {
|
||||
return area->spacedata.first;
|
||||
return static_cast<SpaceGraph *>(area->spacedata.first);
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
struct SpaceAction *CTX_wm_space_action(const bContext *C)
|
||||
SpaceAction *CTX_wm_space_action(const bContext *C)
|
||||
{
|
||||
ScrArea *area = CTX_wm_area(C);
|
||||
if (area && area->spacetype == SPACE_ACTION) {
|
||||
return area->spacedata.first;
|
||||
return static_cast<SpaceAction *>(area->spacedata.first);
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
struct SpaceInfo *CTX_wm_space_info(const bContext *C)
|
||||
SpaceInfo *CTX_wm_space_info(const bContext *C)
|
||||
{
|
||||
ScrArea *area = CTX_wm_area(C);
|
||||
if (area && area->spacetype == SPACE_INFO) {
|
||||
return area->spacedata.first;
|
||||
return static_cast<SpaceInfo *>(area->spacedata.first);
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
struct SpaceUserPref *CTX_wm_space_userpref(const bContext *C)
|
||||
SpaceUserPref *CTX_wm_space_userpref(const bContext *C)
|
||||
{
|
||||
ScrArea *area = CTX_wm_area(C);
|
||||
if (area && area->spacetype == SPACE_USERPREF) {
|
||||
return area->spacedata.first;
|
||||
return static_cast<SpaceUserPref *>(area->spacedata.first);
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
struct SpaceClip *CTX_wm_space_clip(const bContext *C)
|
||||
SpaceClip *CTX_wm_space_clip(const bContext *C)
|
||||
{
|
||||
ScrArea *area = CTX_wm_area(C);
|
||||
if (area && area->spacetype == SPACE_CLIP) {
|
||||
return area->spacedata.first;
|
||||
return static_cast<SpaceClip *>(area->spacedata.first);
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
struct SpaceTopBar *CTX_wm_space_topbar(const bContext *C)
|
||||
SpaceTopBar *CTX_wm_space_topbar(const bContext *C)
|
||||
{
|
||||
ScrArea *area = CTX_wm_area(C);
|
||||
if (area && area->spacetype == SPACE_TOPBAR) {
|
||||
return area->spacedata.first;
|
||||
return static_cast<SpaceTopBar *>(area->spacedata.first);
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
struct SpaceSpreadsheet *CTX_wm_space_spreadsheet(const bContext *C)
|
||||
SpaceSpreadsheet *CTX_wm_space_spreadsheet(const bContext *C)
|
||||
{
|
||||
ScrArea *area = CTX_wm_area(C);
|
||||
if (area && area->spacetype == SPACE_SPREADSHEET) {
|
||||
return area->spacedata.first;
|
||||
return static_cast<SpaceSpreadsheet *>(area->spacedata.first);
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void CTX_wm_manager_set(bContext *C, wmWindowManager *wm)
|
||||
{
|
||||
C->wm.manager = wm;
|
||||
C->wm.window = NULL;
|
||||
C->wm.screen = NULL;
|
||||
C->wm.area = NULL;
|
||||
C->wm.region = NULL;
|
||||
C->wm.window = nullptr;
|
||||
C->wm.screen = nullptr;
|
||||
C->wm.area = nullptr;
|
||||
C->wm.region = nullptr;
|
||||
}
|
||||
|
||||
#ifdef WITH_PYTHON
|
||||
|
@ -970,14 +951,16 @@ void CTX_wm_window_set(bContext *C, wmWindow *win)
|
|||
if (win) {
|
||||
C->data.scene = win->scene;
|
||||
}
|
||||
C->wm.workspace = (win) ? BKE_workspace_active_get(win->workspace_hook) : NULL;
|
||||
C->wm.screen = (win) ? BKE_workspace_active_screen_get(win->workspace_hook) : NULL;
|
||||
C->wm.area = NULL;
|
||||
C->wm.region = NULL;
|
||||
C->wm.workspace = (win) ? BKE_workspace_active_get(win->workspace_hook) : nullptr;
|
||||
C->wm.screen = (win) ? BKE_workspace_active_screen_get(win->workspace_hook) : nullptr;
|
||||
C->wm.area = nullptr;
|
||||
C->wm.region = nullptr;
|
||||
|
||||
#ifdef WITH_PYTHON
|
||||
if (C->data.py_context != NULL) {
|
||||
BPY_context_dict_clear_members(C, PYCTX_WINDOW_MEMBERS);
|
||||
if (C->data.py_context != nullptr) {
|
||||
const char *members[] = {PYCTX_WINDOW_MEMBERS};
|
||||
BPY_context_dict_clear_members_array(
|
||||
&C->data.py_context, C->data.py_context_orig, members, ARRAY_SIZE(members));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
@ -985,12 +968,14 @@ void CTX_wm_window_set(bContext *C, wmWindow *win)
|
|||
void CTX_wm_screen_set(bContext *C, bScreen *screen)
|
||||
{
|
||||
C->wm.screen = screen;
|
||||
C->wm.area = NULL;
|
||||
C->wm.region = NULL;
|
||||
C->wm.area = nullptr;
|
||||
C->wm.region = nullptr;
|
||||
|
||||
#ifdef WITH_PYTHON
|
||||
if (C->data.py_context != NULL) {
|
||||
BPY_context_dict_clear_members(C, PYCTX_SCREEN_MEMBERS);
|
||||
if (C->data.py_context != nullptr) {
|
||||
const char *members[] = {PYCTX_SCREEN_MEMBERS};
|
||||
BPY_context_dict_clear_members_array(
|
||||
&C->data.py_context, C->data.py_context_orig, members, ARRAY_SIZE(members));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
@ -998,11 +983,13 @@ void CTX_wm_screen_set(bContext *C, bScreen *screen)
|
|||
void CTX_wm_area_set(bContext *C, ScrArea *area)
|
||||
{
|
||||
C->wm.area = area;
|
||||
C->wm.region = NULL;
|
||||
C->wm.region = nullptr;
|
||||
|
||||
#ifdef WITH_PYTHON
|
||||
if (C->data.py_context != NULL) {
|
||||
BPY_context_dict_clear_members(C, PYCTX_AREA_MEMBERS);
|
||||
if (C->data.py_context != nullptr) {
|
||||
const char *members[] = {PYCTX_AREA_MEMBERS};
|
||||
BPY_context_dict_clear_members_array(
|
||||
&C->data.py_context, C->data.py_context_orig, members, ARRAY_SIZE(members));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
@ -1012,8 +999,10 @@ void CTX_wm_region_set(bContext *C, ARegion *region)
|
|||
C->wm.region = region;
|
||||
|
||||
#ifdef WITH_PYTHON
|
||||
if (C->data.py_context != NULL) {
|
||||
BPY_context_dict_clear_members(C, PYCTX_REGION_MEMBERS);
|
||||
if (C->data.py_context != nullptr) {
|
||||
const char *members[] = {PYCTX_REGION_MEMBERS};
|
||||
BPY_context_dict_clear_members_array(
|
||||
&C->data.py_context, C->data.py_context_orig, members, ARRAY_SIZE(members));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
@ -1023,22 +1012,22 @@ void CTX_wm_menu_set(bContext *C, ARegion *menu)
|
|||
C->wm.menu = menu;
|
||||
}
|
||||
|
||||
void CTX_wm_gizmo_group_set(bContext *C, struct wmGizmoGroup *gzgroup)
|
||||
void CTX_wm_gizmo_group_set(bContext *C, wmGizmoGroup *gzgroup)
|
||||
{
|
||||
C->wm.gizmo_group = gzgroup;
|
||||
}
|
||||
|
||||
void CTX_wm_operator_poll_msg_clear(bContext *C)
|
||||
{
|
||||
struct bContextPollMsgDyn_Params *params = &C->wm.operator_poll_msg_dyn_params;
|
||||
if (params->free_fn != NULL) {
|
||||
bContextPollMsgDyn_Params *params = &C->wm.operator_poll_msg_dyn_params;
|
||||
if (params->free_fn != nullptr) {
|
||||
params->free_fn(C, params->user_data);
|
||||
}
|
||||
params->get_fn = NULL;
|
||||
params->free_fn = NULL;
|
||||
params->user_data = NULL;
|
||||
params->get_fn = nullptr;
|
||||
params->free_fn = nullptr;
|
||||
params->user_data = nullptr;
|
||||
|
||||
C->wm.operator_poll_msg = NULL;
|
||||
C->wm.operator_poll_msg = nullptr;
|
||||
}
|
||||
void CTX_wm_operator_poll_msg_set(bContext *C, const char *msg)
|
||||
{
|
||||
|
@ -1047,8 +1036,7 @@ void CTX_wm_operator_poll_msg_set(bContext *C, const char *msg)
|
|||
C->wm.operator_poll_msg = msg;
|
||||
}
|
||||
|
||||
void CTX_wm_operator_poll_msg_set_dynamic(bContext *C,
|
||||
const struct bContextPollMsgDyn_Params *params)
|
||||
void CTX_wm_operator_poll_msg_set_dynamic(bContext *C, const bContextPollMsgDyn_Params *params)
|
||||
{
|
||||
CTX_wm_operator_poll_msg_clear(C);
|
||||
|
||||
|
@ -1057,10 +1045,10 @@ void CTX_wm_operator_poll_msg_set_dynamic(bContext *C,
|
|||
|
||||
const char *CTX_wm_operator_poll_msg_get(bContext *C, bool *r_free)
|
||||
{
|
||||
struct bContextPollMsgDyn_Params *params = &C->wm.operator_poll_msg_dyn_params;
|
||||
if (params->get_fn != NULL) {
|
||||
bContextPollMsgDyn_Params *params = &C->wm.operator_poll_msg_dyn_params;
|
||||
if (params->get_fn != nullptr) {
|
||||
char *msg = params->get_fn(C, params->user_data);
|
||||
if (msg != NULL) {
|
||||
if (msg != nullptr) {
|
||||
*r_free = true;
|
||||
}
|
||||
return msg;
|
||||
|
@ -1075,7 +1063,7 @@ const char *CTX_wm_operator_poll_msg_get(bContext *C, bool *r_free)
|
|||
Main *CTX_data_main(const bContext *C)
|
||||
{
|
||||
Main *bmain;
|
||||
if (ctx_data_pointer_verify(C, "blend_data", (void *)&bmain)) {
|
||||
if (ctx_data_pointer_verify(C, "blend_data", (void **)&bmain)) {
|
||||
return bmain;
|
||||
}
|
||||
|
||||
|
@ -1091,7 +1079,7 @@ void CTX_data_main_set(bContext *C, Main *bmain)
|
|||
Scene *CTX_data_scene(const bContext *C)
|
||||
{
|
||||
Scene *scene;
|
||||
if (ctx_data_pointer_verify(C, "scene", (void *)&scene)) {
|
||||
if (ctx_data_pointer_verify(C, "scene", (void **)&scene)) {
|
||||
return scene;
|
||||
}
|
||||
|
||||
|
@ -1102,7 +1090,7 @@ ViewLayer *CTX_data_view_layer(const bContext *C)
|
|||
{
|
||||
ViewLayer *view_layer;
|
||||
|
||||
if (ctx_data_pointer_verify(C, "view_layer", (void *)&view_layer)) {
|
||||
if (ctx_data_pointer_verify(C, "view_layer", (void **)&view_layer)) {
|
||||
return view_layer;
|
||||
}
|
||||
|
||||
|
@ -1129,7 +1117,7 @@ LayerCollection *CTX_data_layer_collection(const bContext *C)
|
|||
ViewLayer *view_layer = CTX_data_view_layer(C);
|
||||
LayerCollection *layer_collection;
|
||||
|
||||
if (ctx_data_pointer_verify(C, "layer_collection", (void *)&layer_collection)) {
|
||||
if (ctx_data_pointer_verify(C, "layer_collection", (void **)&layer_collection)) {
|
||||
if (BKE_view_layer_has_collection(view_layer, layer_collection->collection)) {
|
||||
return layer_collection;
|
||||
}
|
||||
|
@ -1142,7 +1130,7 @@ LayerCollection *CTX_data_layer_collection(const bContext *C)
|
|||
Collection *CTX_data_collection(const bContext *C)
|
||||
{
|
||||
Collection *collection;
|
||||
if (ctx_data_pointer_verify(C, "collection", (void *)&collection)) {
|
||||
if (ctx_data_pointer_verify(C, "collection", (void **)&collection)) {
|
||||
return collection;
|
||||
}
|
||||
|
||||
|
@ -1229,8 +1217,8 @@ enum eContextObjectMode CTX_data_mode_enum_ex(const Object *obedit,
|
|||
enum eContextObjectMode CTX_data_mode_enum(const bContext *C)
|
||||
{
|
||||
Object *obedit = CTX_data_edit_object(C);
|
||||
Object *obact = obedit ? NULL : CTX_data_active_object(C);
|
||||
return CTX_data_mode_enum_ex(obedit, obact, obact ? obact->mode : OB_MODE_OBJECT);
|
||||
Object *obact = obedit ? nullptr : CTX_data_active_object(C);
|
||||
return CTX_data_mode_enum_ex(obedit, obact, obact ? eObjectMode(obact->mode) : OB_MODE_OBJECT);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1260,7 +1248,7 @@ static const char *data_mode_strings[] = {
|
|||
"greasepencil_weight",
|
||||
"greasepencil_vertex",
|
||||
"curves_sculpt",
|
||||
NULL,
|
||||
nullptr,
|
||||
};
|
||||
BLI_STATIC_ASSERT(ARRAY_SIZE(data_mode_strings) == CTX_MODE_NUM + 1,
|
||||
"Must have a string for each context mode")
|
||||
|
@ -1274,8 +1262,9 @@ void CTX_data_scene_set(bContext *C, Scene *scene)
|
|||
C->data.scene = scene;
|
||||
|
||||
#ifdef WITH_PYTHON
|
||||
if (C->data.py_context != NULL) {
|
||||
BPY_context_dict_clear_members(C, "scene");
|
||||
if (C->data.py_context != nullptr) {
|
||||
const char *members[] = {"scene"};
|
||||
BPY_context_dict_clear_members_array(&C->data.py_context, C->data.py_context_orig, members, 1);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
@ -1288,7 +1277,7 @@ ToolSettings *CTX_data_tool_settings(const bContext *C)
|
|||
return scene->toolsettings;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool CTX_data_selected_ids(const bContext *C, ListBase *list)
|
||||
|
@ -1351,17 +1340,17 @@ bool CTX_data_selectable_bases(const bContext *C, ListBase *list)
|
|||
return ctx_data_base_collection_get(C, "selectable_objects", list);
|
||||
}
|
||||
|
||||
struct Object *CTX_data_active_object(const bContext *C)
|
||||
Object *CTX_data_active_object(const bContext *C)
|
||||
{
|
||||
return ctx_data_pointer_get(C, "active_object");
|
||||
return static_cast<Object *>(ctx_data_pointer_get(C, "active_object"));
|
||||
}
|
||||
|
||||
struct Base *CTX_data_active_base(const bContext *C)
|
||||
Base *CTX_data_active_base(const bContext *C)
|
||||
{
|
||||
Object *ob = ctx_data_pointer_get(C, "active_object");
|
||||
Object *ob = CTX_data_active_object(C);
|
||||
|
||||
if (ob == NULL) {
|
||||
return NULL;
|
||||
if (ob == nullptr) {
|
||||
return nullptr;
|
||||
}
|
||||
const Scene *scene = CTX_data_scene(C);
|
||||
ViewLayer *view_layer = CTX_data_view_layer(C);
|
||||
|
@ -1369,39 +1358,39 @@ struct Base *CTX_data_active_base(const bContext *C)
|
|||
return BKE_view_layer_base_find(view_layer, ob);
|
||||
}
|
||||
|
||||
struct Object *CTX_data_edit_object(const bContext *C)
|
||||
Object *CTX_data_edit_object(const bContext *C)
|
||||
{
|
||||
return ctx_data_pointer_get(C, "edit_object");
|
||||
return static_cast<Object *>(ctx_data_pointer_get(C, "edit_object"));
|
||||
}
|
||||
|
||||
struct Image *CTX_data_edit_image(const bContext *C)
|
||||
Image *CTX_data_edit_image(const bContext *C)
|
||||
{
|
||||
return ctx_data_pointer_get(C, "edit_image");
|
||||
return static_cast<Image *>(ctx_data_pointer_get(C, "edit_image"));
|
||||
}
|
||||
|
||||
struct Text *CTX_data_edit_text(const bContext *C)
|
||||
Text *CTX_data_edit_text(const bContext *C)
|
||||
{
|
||||
return ctx_data_pointer_get(C, "edit_text");
|
||||
return static_cast<Text *>(ctx_data_pointer_get(C, "edit_text"));
|
||||
}
|
||||
|
||||
struct MovieClip *CTX_data_edit_movieclip(const bContext *C)
|
||||
MovieClip *CTX_data_edit_movieclip(const bContext *C)
|
||||
{
|
||||
return ctx_data_pointer_get(C, "edit_movieclip");
|
||||
return static_cast<MovieClip *>(ctx_data_pointer_get(C, "edit_movieclip"));
|
||||
}
|
||||
|
||||
struct Mask *CTX_data_edit_mask(const bContext *C)
|
||||
Mask *CTX_data_edit_mask(const bContext *C)
|
||||
{
|
||||
return ctx_data_pointer_get(C, "edit_mask");
|
||||
return static_cast<Mask *>(ctx_data_pointer_get(C, "edit_mask"));
|
||||
}
|
||||
|
||||
struct EditBone *CTX_data_active_bone(const bContext *C)
|
||||
EditBone *CTX_data_active_bone(const bContext *C)
|
||||
{
|
||||
return ctx_data_pointer_get(C, "active_bone");
|
||||
return static_cast<EditBone *>(ctx_data_pointer_get(C, "active_bone"));
|
||||
}
|
||||
|
||||
struct CacheFile *CTX_data_edit_cachefile(const bContext *C)
|
||||
CacheFile *CTX_data_edit_cachefile(const bContext *C)
|
||||
{
|
||||
return ctx_data_pointer_get(C, "edit_cachefile");
|
||||
return static_cast<CacheFile *>(ctx_data_pointer_get(C, "edit_cachefile"));
|
||||
}
|
||||
|
||||
bool CTX_data_selected_bones(const bContext *C, ListBase *list)
|
||||
|
@ -1424,9 +1413,9 @@ bool CTX_data_editable_bones(const bContext *C, ListBase *list)
|
|||
return ctx_data_collection_get(C, "editable_bones", list);
|
||||
}
|
||||
|
||||
struct bPoseChannel *CTX_data_active_pose_bone(const bContext *C)
|
||||
bPoseChannel *CTX_data_active_pose_bone(const bContext *C)
|
||||
{
|
||||
return ctx_data_pointer_get(C, "active_pose_bone");
|
||||
return static_cast<bPoseChannel *>(ctx_data_pointer_get(C, "active_pose_bone"));
|
||||
}
|
||||
|
||||
bool CTX_data_selected_pose_bones(const bContext *C, ListBase *list)
|
||||
|
@ -1446,17 +1435,17 @@ bool CTX_data_visible_pose_bones(const bContext *C, ListBase *list)
|
|||
|
||||
bGPdata *CTX_data_gpencil_data(const bContext *C)
|
||||
{
|
||||
return ctx_data_pointer_get(C, "gpencil_data");
|
||||
return static_cast<bGPdata *>(ctx_data_pointer_get(C, "gpencil_data"));
|
||||
}
|
||||
|
||||
bGPDlayer *CTX_data_active_gpencil_layer(const bContext *C)
|
||||
{
|
||||
return ctx_data_pointer_get(C, "active_gpencil_layer");
|
||||
return static_cast<bGPDlayer *>(ctx_data_pointer_get(C, "active_gpencil_layer"));
|
||||
}
|
||||
|
||||
bGPDframe *CTX_data_active_gpencil_frame(const bContext *C)
|
||||
{
|
||||
return ctx_data_pointer_get(C, "active_gpencil_frame");
|
||||
return static_cast<bGPDframe *>(ctx_data_pointer_get(C, "active_gpencil_frame"));
|
||||
}
|
||||
|
||||
bool CTX_data_visible_gpencil_layers(const bContext *C, ListBase *list)
|
||||
|
@ -1476,7 +1465,7 @@ bool CTX_data_editable_gpencil_strokes(const bContext *C, ListBase *list)
|
|||
|
||||
const AssetLibraryReference *CTX_wm_asset_library_ref(const bContext *C)
|
||||
{
|
||||
return ctx_data_pointer_get(C, "asset_library_ref");
|
||||
return static_cast<AssetLibraryReference *>(ctx_data_pointer_get(C, "asset_library_ref"));
|
||||
}
|
||||
|
||||
AssetHandle CTX_wm_asset_handle(const bContext *C, bool *r_is_valid)
|
||||
|
@ -1497,11 +1486,11 @@ AssetHandle CTX_wm_asset_handle(const bContext *C, bool *r_is_valid)
|
|||
(FileDirEntry *)CTX_data_pointer_get_type(C, "active_file", &RNA_FileSelectEntry).data;
|
||||
if (file && file->asset) {
|
||||
*r_is_valid = true;
|
||||
return (AssetHandle){.file_data = file};
|
||||
return AssetHandle{file};
|
||||
}
|
||||
|
||||
*r_is_valid = false;
|
||||
return (AssetHandle){0};
|
||||
return AssetHandle{nullptr};
|
||||
}
|
||||
|
||||
Depsgraph *CTX_data_depsgraph_pointer(const bContext *C)
|
|
@ -203,7 +203,7 @@ IDTypeInfo IDType_ID_CV = {
|
|||
/* id_filter */ FILTER_ID_CV,
|
||||
/* main_listbase_index */ INDEX_ID_CV,
|
||||
/* struct_size */ sizeof(Curves),
|
||||
/* name*/ "Curves",
|
||||
/* name */ "Curves",
|
||||
/* name_plural */ "hair_curves",
|
||||
/* translation_context */ BLT_I18NCONTEXT_ID_CURVES,
|
||||
/* flags */ IDTYPE_FLAGS_APPEND_IS_REUSABLE,
|
||||
|
|
|
@ -3029,7 +3029,7 @@ int dynamicPaint_createUVSurface(Scene *scene,
|
|||
#if 0
|
||||
/* -----------------------------------------------------------------
|
||||
* For debug, write a dump of adjacency data to a file.
|
||||
* -----------------------------------------------------------------*/
|
||||
* ----------------------------------------------------------------- */
|
||||
FILE *dump_file = fopen("dynpaint-adj-data.txt", "w");
|
||||
int *tmp = MEM_callocN(sizeof(int) * active_points, "tmp");
|
||||
for (int ty = 0; ty < h; ty++) {
|
||||
|
@ -3140,7 +3140,7 @@ int dynamicPaint_createUVSurface(Scene *scene,
|
|||
#if 0
|
||||
/* -----------------------------------------------------------------
|
||||
* For debug, output pixel statuses to the color map
|
||||
* -----------------------------------------------------------------*/
|
||||
* ----------------------------------------------------------------- */
|
||||
for (index = 0; index < sData->total_points; index++) {
|
||||
ImgSeqFormatData *f_data = (ImgSeqFormatData *)sData->format_data;
|
||||
PaintUVPoint *uvPoint = &((PaintUVPoint *)f_data->uv_p)[index];
|
||||
|
|
|
@ -58,8 +58,6 @@ static size_t idp_size_table[] = {
|
|||
|
||||
#define GETPROP(prop, i) &(IDP_IDPArray(prop)[i])
|
||||
|
||||
/* --------- property array type -------------*/
|
||||
|
||||
IDProperty *IDP_NewIDPArray(const char *name)
|
||||
{
|
||||
IDProperty *prop = MEM_callocN(sizeof(IDProperty), "IDProperty prop array");
|
||||
|
|
|
@ -890,8 +890,8 @@ static void key_evaluate_relative(const int start,
|
|||
end = tot;
|
||||
}
|
||||
|
||||
/* in case of beztriple */
|
||||
elemstr[0] = 1; /* nr of ipofloats */
|
||||
/* In case of Bezier-triple. */
|
||||
elemstr[0] = 1; /* Number of IPO-floats. */
|
||||
elemstr[1] = IPO_BEZTRIPLE;
|
||||
elemstr[2] = 0;
|
||||
|
||||
|
@ -1132,8 +1132,8 @@ static void do_key(const int start,
|
|||
}
|
||||
}
|
||||
|
||||
/* in case of beztriple */
|
||||
elemstr[0] = 1; /* nr of ipofloats */
|
||||
/* In case of bezier-triples. */
|
||||
elemstr[0] = 1; /* Number of IPO-floats. */
|
||||
elemstr[1] = IPO_BEZTRIPLE;
|
||||
elemstr[2] = 0;
|
||||
|
||||
|
@ -2240,11 +2240,11 @@ void BKE_keyblock_convert_to_mesh(const KeyBlock *kb, MVert *mvert, const int to
|
|||
|
||||
void BKE_keyblock_mesh_calc_normals(const KeyBlock *kb,
|
||||
const Mesh *mesh,
|
||||
float (*r_vertnors)[3],
|
||||
float (*r_polynors)[3],
|
||||
float (*r_loopnors)[3])
|
||||
float (*r_vert_normals)[3],
|
||||
float (*r_poly_normals)[3],
|
||||
float (*r_loop_normals)[3])
|
||||
{
|
||||
if (r_vertnors == nullptr && r_polynors == nullptr && r_loopnors == nullptr) {
|
||||
if (r_vert_normals == nullptr && r_poly_normals == nullptr && r_loop_normals == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -2254,21 +2254,21 @@ void BKE_keyblock_mesh_calc_normals(const KeyBlock *kb,
|
|||
const MPoly *polys = BKE_mesh_polys(mesh);
|
||||
const MLoop *loops = BKE_mesh_loops(mesh);
|
||||
|
||||
const bool loop_normals_needed = r_loopnors != nullptr;
|
||||
const bool vert_normals_needed = r_vertnors != nullptr || loop_normals_needed;
|
||||
const bool poly_normals_needed = r_polynors != nullptr || vert_normals_needed ||
|
||||
const bool loop_normals_needed = r_loop_normals != nullptr;
|
||||
const bool vert_normals_needed = r_vert_normals != nullptr || loop_normals_needed;
|
||||
const bool poly_normals_needed = r_poly_normals != nullptr || vert_normals_needed ||
|
||||
loop_normals_needed;
|
||||
|
||||
float(*vert_normals)[3] = r_vertnors;
|
||||
float(*poly_normals)[3] = r_polynors;
|
||||
float(*vert_normals)[3] = r_vert_normals;
|
||||
float(*poly_normals)[3] = r_poly_normals;
|
||||
bool free_vert_normals = false;
|
||||
bool free_poly_normals = false;
|
||||
if (vert_normals_needed && r_vertnors == nullptr) {
|
||||
if (vert_normals_needed && r_vert_normals == nullptr) {
|
||||
vert_normals = static_cast<float(*)[3]>(
|
||||
MEM_malloc_arrayN(mesh->totvert, sizeof(float[3]), __func__));
|
||||
free_vert_normals = true;
|
||||
}
|
||||
if (poly_normals_needed && r_polynors == nullptr) {
|
||||
if (poly_normals_needed && r_poly_normals == nullptr) {
|
||||
poly_normals = static_cast<float(*)[3]>(
|
||||
MEM_malloc_arrayN(mesh->totpoly, sizeof(float[3]), __func__));
|
||||
free_poly_normals = true;
|
||||
|
@ -2297,7 +2297,7 @@ void BKE_keyblock_mesh_calc_normals(const KeyBlock *kb,
|
|||
edges,
|
||||
mesh->totedge,
|
||||
loops,
|
||||
r_loopnors,
|
||||
r_loop_normals,
|
||||
mesh->totloop,
|
||||
polys,
|
||||
poly_normals,
|
||||
|
@ -2472,8 +2472,6 @@ float (*BKE_keyblock_convert_to_vertcos(const Object *ob, const KeyBlock *kb))[3
|
|||
return vertCos;
|
||||
}
|
||||
|
||||
/************************* raw coord offsets ************************/
|
||||
|
||||
void BKE_keyblock_update_from_offset(const Object *ob, KeyBlock *kb, const float (*ofs)[3])
|
||||
{
|
||||
int a;
|
||||
|
@ -2509,8 +2507,6 @@ void BKE_keyblock_update_from_offset(const Object *ob, KeyBlock *kb, const float
|
|||
}
|
||||
}
|
||||
|
||||
/* ==========================================================*/
|
||||
|
||||
bool BKE_keyblock_move(Object *ob, int org_index, int new_index)
|
||||
{
|
||||
Key *key = BKE_key_from_object(ob);
|
||||
|
|
|
@ -1689,6 +1689,14 @@ void ramp_blend(int type, float r_col[3], const float fac, const float col[3])
|
|||
r_col[1] = facm * (r_col[1]) + fac * fabsf(r_col[1] - col[1]);
|
||||
r_col[2] = facm * (r_col[2]) + fac * fabsf(r_col[2] - col[2]);
|
||||
break;
|
||||
case MA_RAMP_EXCLUSION:
|
||||
r_col[0] = max_ff(facm * (r_col[0]) + fac * (r_col[0] + col[0] - 2.0f * r_col[0] * col[0]),
|
||||
0.0f);
|
||||
r_col[1] = max_ff(facm * (r_col[1]) + fac * (r_col[1] + col[1] - 2.0f * r_col[1] * col[1]),
|
||||
0.0f);
|
||||
r_col[2] = max_ff(facm * (r_col[2]) + fac * (r_col[2] + col[2] - 2.0f * r_col[2] * col[2]),
|
||||
0.0f);
|
||||
break;
|
||||
case MA_RAMP_DARK:
|
||||
r_col[0] = min_ff(r_col[0], col[0]) * fac + r_col[0] * facm;
|
||||
r_col[1] = min_ff(r_col[1], col[1]) * fac + r_col[1] * facm;
|
||||
|
|
|
@ -1792,17 +1792,17 @@ void BKE_mesh_vert_coords_apply_with_mat4(Mesh *mesh,
|
|||
|
||||
static float (*ensure_corner_normal_layer(Mesh &mesh))[3]
|
||||
{
|
||||
float(*r_loopnors)[3];
|
||||
float(*r_loop_normals)[3];
|
||||
if (CustomData_has_layer(&mesh.ldata, CD_NORMAL)) {
|
||||
r_loopnors = (float(*)[3])CustomData_get_layer(&mesh.ldata, CD_NORMAL);
|
||||
memset(r_loopnors, 0, sizeof(float[3]) * mesh.totloop);
|
||||
r_loop_normals = (float(*)[3])CustomData_get_layer(&mesh.ldata, CD_NORMAL);
|
||||
memset(r_loop_normals, 0, sizeof(float[3]) * mesh.totloop);
|
||||
}
|
||||
else {
|
||||
r_loopnors = (float(*)[3])CustomData_add_layer(
|
||||
r_loop_normals = (float(*)[3])CustomData_add_layer(
|
||||
&mesh.ldata, CD_NORMAL, CD_SET_DEFAULT, nullptr, mesh.totloop);
|
||||
CustomData_set_layer_flag(&mesh.ldata, CD_NORMAL, CD_FLAG_TEMPORARY);
|
||||
}
|
||||
return r_loopnors;
|
||||
return r_loop_normals;
|
||||
}
|
||||
|
||||
void BKE_mesh_calc_normals_split_ex(Mesh *mesh,
|
||||
|
|
|
@ -163,10 +163,10 @@ void BKE_mesh_foreach_mapped_loop(Mesh *mesh,
|
|||
const float(*vertexCos)[3] = mesh->runtime->edit_data->vertexCos;
|
||||
|
||||
/* XXX: investigate using EditMesh data. */
|
||||
const float(*lnors)[3] = (flag & MESH_FOREACH_USE_NORMAL) ?
|
||||
static_cast<const float(*)[3]>(
|
||||
CustomData_get_layer(&mesh->ldata, CD_NORMAL)) :
|
||||
nullptr;
|
||||
const float(*loop_normals)[3] = (flag & MESH_FOREACH_USE_NORMAL) ?
|
||||
static_cast<const float(*)[3]>(
|
||||
CustomData_get_layer(&mesh->ldata, CD_NORMAL)) :
|
||||
nullptr;
|
||||
|
||||
int f_idx;
|
||||
|
||||
|
@ -179,16 +179,16 @@ void BKE_mesh_foreach_mapped_loop(Mesh *mesh,
|
|||
do {
|
||||
const BMVert *eve = l_iter->v;
|
||||
const int v_idx = BM_elem_index_get(eve);
|
||||
const float *no = lnors ? *lnors++ : nullptr;
|
||||
const float *no = loop_normals ? *loop_normals++ : nullptr;
|
||||
func(userData, v_idx, f_idx, vertexCos ? vertexCos[v_idx] : eve->co, no);
|
||||
} while ((l_iter = l_iter->next) != l_first);
|
||||
}
|
||||
}
|
||||
else {
|
||||
const float(*lnors)[3] = (flag & MESH_FOREACH_USE_NORMAL) ?
|
||||
static_cast<const float(*)[3]>(
|
||||
CustomData_get_layer(&mesh->ldata, CD_NORMAL)) :
|
||||
nullptr;
|
||||
const float(*loop_normals)[3] = (flag & MESH_FOREACH_USE_NORMAL) ?
|
||||
static_cast<const float(*)[3]>(
|
||||
CustomData_get_layer(&mesh->ldata, CD_NORMAL)) :
|
||||
nullptr;
|
||||
|
||||
const MVert *mv = BKE_mesh_verts(mesh);
|
||||
const MLoop *ml = BKE_mesh_loops(mesh);
|
||||
|
@ -204,7 +204,7 @@ void BKE_mesh_foreach_mapped_loop(Mesh *mesh,
|
|||
for (i = 0; i < mp->totloop; i++, ml++) {
|
||||
const int v_idx = v_index ? v_index[ml->v] : ml->v;
|
||||
const int f_idx = f_index ? f_index[p_idx] : p_idx;
|
||||
const float *no = lnors ? *lnors++ : nullptr;
|
||||
const float *no = loop_normals ? *loop_normals++ : nullptr;
|
||||
if (ELEM(ORIGINDEX_NONE, v_idx, f_idx)) {
|
||||
continue;
|
||||
}
|
||||
|
@ -217,7 +217,7 @@ void BKE_mesh_foreach_mapped_loop(Mesh *mesh,
|
|||
for (i = 0; i < mp->totloop; i++, ml++) {
|
||||
const int v_idx = ml->v;
|
||||
const int f_idx = p_idx;
|
||||
const float *no = lnors ? *lnors++ : nullptr;
|
||||
const float *no = loop_normals ? *loop_normals++ : nullptr;
|
||||
func(userData, v_idx, f_idx, mv[ml->v].co, no);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -326,12 +326,13 @@ static void bm_corners_to_loops_ex(ID *id,
|
|||
}
|
||||
|
||||
if (CustomData_has_layer(fdata, CD_TESSLOOPNORMAL)) {
|
||||
float(*lnors)[3] = (float(*)[3])CustomData_get(ldata, loopstart, CD_NORMAL);
|
||||
const short(*tlnors)[3] = (short(*)[3])CustomData_get(fdata, findex, CD_TESSLOOPNORMAL);
|
||||
float(*loop_normals)[3] = (float(*)[3])CustomData_get(ldata, loopstart, CD_NORMAL);
|
||||
const short(*tessloop_normals)[3] = (short(*)[3])CustomData_get(
|
||||
fdata, findex, CD_TESSLOOPNORMAL);
|
||||
const int max = mf->v4 ? 4 : 3;
|
||||
|
||||
for (int i = 0; i < max; i++, lnors++, tlnors++) {
|
||||
normal_short_to_float_v3(*lnors, *tlnors);
|
||||
for (int i = 0; i < max; i++, loop_normals++, tessloop_normals++) {
|
||||
normal_short_to_float_v3(*loop_normals, *tessloop_normals);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -544,11 +545,15 @@ static void update_active_fdata_layers(Mesh &mesh, CustomData *fdata, CustomData
|
|||
}
|
||||
|
||||
if (CustomData_has_layer(ldata, CD_PROP_BYTE_COLOR)) {
|
||||
act = CustomData_get_named_layer(ldata, CD_PROP_BYTE_COLOR, mesh.active_color_attribute);
|
||||
CustomData_set_layer_active(fdata, CD_MCOL, act);
|
||||
if (mesh.active_color_attribute != NULL) {
|
||||
act = CustomData_get_named_layer(ldata, CD_PROP_BYTE_COLOR, mesh.active_color_attribute);
|
||||
CustomData_set_layer_active(fdata, CD_MCOL, act);
|
||||
}
|
||||
|
||||
act = CustomData_get_named_layer(ldata, CD_PROP_BYTE_COLOR, mesh.default_color_attribute);
|
||||
CustomData_set_layer_render(fdata, CD_MCOL, act);
|
||||
if (mesh.default_color_attribute != NULL) {
|
||||
act = CustomData_get_named_layer(ldata, CD_PROP_BYTE_COLOR, mesh.default_color_attribute);
|
||||
CustomData_set_layer_render(fdata, CD_MCOL, act);
|
||||
}
|
||||
|
||||
act = CustomData_get_clone_layer(ldata, CD_PROP_BYTE_COLOR);
|
||||
CustomData_set_layer_clone(fdata, CD_MCOL, act);
|
||||
|
@ -838,12 +843,12 @@ static void mesh_loops_to_tessdata(CustomData *fdata,
|
|||
}
|
||||
|
||||
if (hasLoopNormal) {
|
||||
short(*fnors)[4][3] = (short(*)[4][3])CustomData_get_layer(fdata, CD_TESSLOOPNORMAL);
|
||||
const float(*lnors)[3] = (const float(*)[3])CustomData_get_layer(ldata, CD_NORMAL);
|
||||
short(*face_normals)[4][3] = (short(*)[4][3])CustomData_get_layer(fdata, CD_TESSLOOPNORMAL);
|
||||
const float(*loop_normals)[3] = (const float(*)[3])CustomData_get_layer(ldata, CD_NORMAL);
|
||||
|
||||
for (findex = 0, lidx = loopindices; findex < num_faces; lidx++, findex++, fnors++) {
|
||||
for (findex = 0, lidx = loopindices; findex < num_faces; lidx++, findex++, face_normals++) {
|
||||
for (j = (mface ? mface[findex].v4 : (*lidx)[3]) ? 4 : 3; j--;) {
|
||||
normal_float_to_short_v3((*fnors)[j], lnors[(*lidx)[j]]);
|
||||
normal_float_to_short_v3((*face_normals)[j], loop_normals[(*lidx)[j]]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -814,7 +814,7 @@ struct LoopSplitTaskDataCommon {
|
|||
* Note we do not need to protect it, though, since two different tasks will *always* affect
|
||||
* different elements in the arrays. */
|
||||
MLoopNorSpaceArray *lnors_spacearr;
|
||||
MutableSpan<float3> loopnors;
|
||||
MutableSpan<float3> loop_normals;
|
||||
MutableSpan<short2> clnors_data;
|
||||
|
||||
/* Read-only. */
|
||||
|
@ -824,7 +824,7 @@ struct LoopSplitTaskDataCommon {
|
|||
Span<MPoly> polys;
|
||||
Span<int2> edge_to_loops;
|
||||
Span<int> loop_to_poly;
|
||||
Span<float3> polynors;
|
||||
Span<float3> poly_normals;
|
||||
Span<float3> vert_normals;
|
||||
};
|
||||
|
||||
|
@ -906,7 +906,7 @@ void BKE_edges_sharp_from_angle_set(MEdge *medges,
|
|||
const MLoop *mloops,
|
||||
const int numLoops,
|
||||
const MPoly *mpolys,
|
||||
const float (*polynors)[3],
|
||||
const float (*poly_normals)[3],
|
||||
const int numPolys,
|
||||
const float split_angle)
|
||||
{
|
||||
|
@ -929,7 +929,7 @@ void BKE_edges_sharp_from_angle_set(MEdge *medges,
|
|||
{mpolys, numPolys},
|
||||
{mloops, numLoops},
|
||||
loop_to_poly,
|
||||
{reinterpret_cast<const float3 *>(polynors), numPolys},
|
||||
{reinterpret_cast<const float3 *>(poly_normals), numPolys},
|
||||
true,
|
||||
split_angle,
|
||||
edge_to_loops,
|
||||
|
@ -996,8 +996,8 @@ static void split_loop_nor_single_do(LoopSplitTaskDataCommon *common_data, LoopS
|
|||
const Span<MVert> verts = common_data->verts;
|
||||
const Span<MEdge> edges = common_data->edges;
|
||||
const Span<MLoop> loops = common_data->loops;
|
||||
const Span<float3> polynors = common_data->polynors;
|
||||
MutableSpan<float3> loop_normals = common_data->loopnors;
|
||||
const Span<float3> poly_normals = common_data->poly_normals;
|
||||
MutableSpan<float3> loop_normals = common_data->loop_normals;
|
||||
|
||||
MLoopNorSpace *lnor_space = data->lnor_space;
|
||||
const int ml_curr_index = data->ml_curr_index;
|
||||
|
@ -1007,7 +1007,7 @@ static void split_loop_nor_single_do(LoopSplitTaskDataCommon *common_data, LoopS
|
|||
/* Simple case (both edges around that vertex are sharp in current polygon),
|
||||
* this loop just takes its poly normal.
|
||||
*/
|
||||
loop_normals[ml_curr_index] = polynors[mp_index];
|
||||
loop_normals[ml_curr_index] = poly_normals[mp_index];
|
||||
|
||||
#if 0
|
||||
printf("BASIC: handling loop %d / edge %d / vert %d / poly %d\n",
|
||||
|
@ -1051,7 +1051,7 @@ static void split_loop_nor_fan_do(LoopSplitTaskDataCommon *common_data,
|
|||
BLI_Stack *edge_vectors)
|
||||
{
|
||||
MLoopNorSpaceArray *lnors_spacearr = common_data->lnors_spacearr;
|
||||
MutableSpan<float3> loopnors = common_data->loopnors;
|
||||
MutableSpan<float3> loop_normals = common_data->loop_normals;
|
||||
MutableSpan<short2> clnors_data = common_data->clnors_data;
|
||||
|
||||
const Span<MVert> verts = common_data->verts;
|
||||
|
@ -1060,7 +1060,7 @@ static void split_loop_nor_fan_do(LoopSplitTaskDataCommon *common_data,
|
|||
const Span<MLoop> loops = common_data->loops;
|
||||
const Span<int2> edge_to_loops = common_data->edge_to_loops;
|
||||
const Span<int> loop_to_poly = common_data->loop_to_poly;
|
||||
const Span<float3> polynors = common_data->polynors;
|
||||
const Span<float3> poly_normals = common_data->poly_normals;
|
||||
|
||||
MLoopNorSpace *lnor_space = data->lnor_space;
|
||||
#if 0 /* Not needed for 'fan' loops. */
|
||||
|
@ -1143,7 +1143,7 @@ static void split_loop_nor_fan_do(LoopSplitTaskDataCommon *common_data,
|
|||
/* Calculate angle between the two poly edges incident on this vertex. */
|
||||
const float fac = saacos(dot_v3v3(vec_curr, vec_prev));
|
||||
/* Accumulate */
|
||||
madd_v3_v3fl(lnor, polynors[mpfan_curr_index], fac);
|
||||
madd_v3_v3fl(lnor, poly_normals[mpfan_curr_index], fac);
|
||||
|
||||
if (!clnors_data.is_empty()) {
|
||||
/* Accumulate all clnors, if they are not all equal we have to fix that! */
|
||||
|
@ -1157,13 +1157,13 @@ static void split_loop_nor_fan_do(LoopSplitTaskDataCommon *common_data,
|
|||
clnors_avg[0] += (*clnor)[0];
|
||||
clnors_avg[1] += (*clnor)[1];
|
||||
clnors_count++;
|
||||
/* We store here a pointer to all custom lnors processed. */
|
||||
/* We store here a pointer to all custom loop_normals processed. */
|
||||
BLI_SMALLSTACK_PUSH(clnors, (short *)*clnor);
|
||||
}
|
||||
}
|
||||
|
||||
/* We store here a pointer to all loop-normals processed. */
|
||||
BLI_SMALLSTACK_PUSH(normal, (float *)(loopnors[mlfan_vert_index]));
|
||||
BLI_SMALLSTACK_PUSH(normal, (float *)(loop_normals[mlfan_vert_index]));
|
||||
|
||||
if (lnors_spacearr) {
|
||||
/* Assign current lnor space to current 'vertex' loop. */
|
||||
|
@ -1203,7 +1203,7 @@ static void split_loop_nor_fan_do(LoopSplitTaskDataCommon *common_data,
|
|||
if (lnors_spacearr) {
|
||||
if (UNLIKELY(lnor_len == 0.0f)) {
|
||||
/* Use vertex normal as fallback! */
|
||||
copy_v3_v3(lnor, loopnors[mlfan_vert_index]);
|
||||
copy_v3_v3(lnor, loop_normals[mlfan_vert_index]);
|
||||
lnor_len = 1.0f;
|
||||
}
|
||||
|
||||
|
@ -1497,10 +1497,10 @@ void BKE_mesh_normals_loop_split(const MVert *mverts,
|
|||
const MEdge *medges,
|
||||
const int numEdges,
|
||||
const MLoop *mloops,
|
||||
float (*r_loopnors)[3],
|
||||
float (*r_loop_normals)[3],
|
||||
const int numLoops,
|
||||
const MPoly *mpolys,
|
||||
const float (*polynors)[3],
|
||||
const float (*poly_normals)[3],
|
||||
const int numPolys,
|
||||
const bool use_split_normals,
|
||||
const float split_angle,
|
||||
|
@ -1515,11 +1515,11 @@ void BKE_mesh_normals_loop_split(const MVert *mverts,
|
|||
BLI_assert(use_split_normals || !(r_lnors_spacearr));
|
||||
|
||||
if (!use_split_normals) {
|
||||
/* In this case, we simply fill lnors with vnors (or fnors for flat faces), quite simple!
|
||||
/* In this case, simply fill `r_loop_normals` with `vert_normals`
|
||||
* (or `poly_normals` for flat faces), quite simple!
|
||||
* Note this is done here to keep some logic and consistency in this quite complex code,
|
||||
* since we may want to use lnors even when mesh's 'autosmooth' is disabled
|
||||
* (see e.g. mesh mapping code).
|
||||
* As usual, we could handle that on case-by-case basis,
|
||||
* since we may want to use loop_normals even when mesh's 'autosmooth' is disabled
|
||||
* (see e.g. mesh mapping code). As usual, we could handle that on case-by-case basis,
|
||||
* but simpler to keep it well confined here. */
|
||||
int mp_index;
|
||||
|
||||
|
@ -1531,10 +1531,10 @@ void BKE_mesh_normals_loop_split(const MVert *mverts,
|
|||
|
||||
for (; ml_index < ml_index_end; ml_index++) {
|
||||
if (is_poly_flat) {
|
||||
copy_v3_v3(r_loopnors[ml_index], polynors[mp_index]);
|
||||
copy_v3_v3(r_loop_normals[ml_index], poly_normals[mp_index]);
|
||||
}
|
||||
else {
|
||||
copy_v3_v3(r_loopnors[ml_index], vert_normals[mloops[ml_index].v]);
|
||||
copy_v3_v3(r_loop_normals[ml_index], vert_normals[mloops[ml_index].v]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1591,7 +1591,7 @@ void BKE_mesh_normals_loop_split(const MVert *mverts,
|
|||
/* Init data common to all tasks. */
|
||||
LoopSplitTaskDataCommon common_data;
|
||||
common_data.lnors_spacearr = r_lnors_spacearr;
|
||||
common_data.loopnors = {reinterpret_cast<float3 *>(r_loopnors), numLoops};
|
||||
common_data.loop_normals = {reinterpret_cast<float3 *>(r_loop_normals), numLoops};
|
||||
common_data.clnors_data = {reinterpret_cast<short2 *>(clnors_data), clnors_data ? numLoops : 0};
|
||||
common_data.verts = {mverts, numVerts};
|
||||
common_data.edges = {medges, numEdges};
|
||||
|
@ -1599,7 +1599,7 @@ void BKE_mesh_normals_loop_split(const MVert *mverts,
|
|||
common_data.loops = loops;
|
||||
common_data.edge_to_loops = edge_to_loops;
|
||||
common_data.loop_to_poly = loop_to_poly;
|
||||
common_data.polynors = {reinterpret_cast<const float3 *>(polynors), numPolys};
|
||||
common_data.poly_normals = {reinterpret_cast<const float3 *>(poly_normals), numPolys};
|
||||
common_data.vert_normals = {reinterpret_cast<const float3 *>(vert_normals), numVerts};
|
||||
|
||||
/* Pre-populate all loop normals as if their verts were all smooth.
|
||||
|
@ -1608,7 +1608,7 @@ void BKE_mesh_normals_loop_split(const MVert *mverts,
|
|||
for (const int poly_i : range) {
|
||||
const MPoly &poly = polys[poly_i];
|
||||
for (const int loop_i : IndexRange(poly.loopstart, poly.totloop)) {
|
||||
copy_v3_v3(r_loopnors[loop_i], vert_normals[loops[loop_i].v]);
|
||||
copy_v3_v3(r_loop_normals[loop_i], vert_normals[loops[loop_i].v]);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -1618,7 +1618,7 @@ void BKE_mesh_normals_loop_split(const MVert *mverts,
|
|||
polys,
|
||||
loops,
|
||||
loop_to_poly,
|
||||
{reinterpret_cast<const float3 *>(polynors), numPolys},
|
||||
{reinterpret_cast<const float3 *>(poly_normals), numPolys},
|
||||
check_angle,
|
||||
split_angle,
|
||||
edge_to_loops,
|
||||
|
@ -1653,9 +1653,9 @@ void BKE_mesh_normals_loop_split(const MVert *mverts,
|
|||
* Compute internal representation of given custom normals (as an array of float[2]).
|
||||
* It also makes sure the mesh matches those custom normals, by setting sharp edges flag as needed
|
||||
* to get a same custom lnor for all loops sharing a same smooth fan.
|
||||
* If use_vertices if true, r_custom_loopnors is assumed to be per-vertex, not per-loop
|
||||
* If use_vertices if true, r_custom_loop_normals is assumed to be per-vertex, not per-loop
|
||||
* (this allows to set whole vert's normals at once, useful in some cases).
|
||||
* r_custom_loopnors is expected to have normalized normals, or zero ones,
|
||||
* r_custom_loop_normals is expected to have normalized normals, or zero ones,
|
||||
* in which case they will be replaced by default loop/vertex normal.
|
||||
*/
|
||||
static void mesh_normals_loop_custom_set(const MVert *mverts,
|
||||
|
@ -1664,10 +1664,10 @@ static void mesh_normals_loop_custom_set(const MVert *mverts,
|
|||
MEdge *medges,
|
||||
const int numEdges,
|
||||
const MLoop *mloops,
|
||||
float (*r_custom_loopnors)[3],
|
||||
float (*r_custom_loop_normals)[3],
|
||||
const int numLoops,
|
||||
const MPoly *mpolys,
|
||||
const float (*polynors)[3],
|
||||
const float (*poly_normals)[3],
|
||||
const int numPolys,
|
||||
short (*r_clnors_data)[2],
|
||||
const bool use_vertices)
|
||||
|
@ -1682,7 +1682,8 @@ static void mesh_normals_loop_custom_set(const MVert *mverts,
|
|||
* So better to keep some simplicity here, and just call #BKE_mesh_normals_loop_split() twice! */
|
||||
MLoopNorSpaceArray lnors_spacearr = {nullptr};
|
||||
BitVector<> done_loops(numLoops, false);
|
||||
float(*lnors)[3] = (float(*)[3])MEM_calloc_arrayN(size_t(numLoops), sizeof(*lnors), __func__);
|
||||
float(*loop_normals)[3] = (float(*)[3])MEM_calloc_arrayN(
|
||||
size_t(numLoops), sizeof(*loop_normals), __func__);
|
||||
const Array<int> loop_to_poly = mesh_topology::build_loop_to_poly_map({mpolys, numPolys},
|
||||
numLoops);
|
||||
/* In this case we always consider split nors as ON,
|
||||
|
@ -1699,10 +1700,10 @@ static void mesh_normals_loop_custom_set(const MVert *mverts,
|
|||
medges,
|
||||
numEdges,
|
||||
mloops,
|
||||
lnors,
|
||||
loop_normals,
|
||||
numLoops,
|
||||
mpolys,
|
||||
polynors,
|
||||
poly_normals,
|
||||
numPolys,
|
||||
use_split_normals,
|
||||
split_angle,
|
||||
|
@ -1713,15 +1714,15 @@ static void mesh_normals_loop_custom_set(const MVert *mverts,
|
|||
/* Set all given zero vectors to their default value. */
|
||||
if (use_vertices) {
|
||||
for (int i = 0; i < numVerts; i++) {
|
||||
if (is_zero_v3(r_custom_loopnors[i])) {
|
||||
copy_v3_v3(r_custom_loopnors[i], vert_normals[i]);
|
||||
if (is_zero_v3(r_custom_loop_normals[i])) {
|
||||
copy_v3_v3(r_custom_loop_normals[i], vert_normals[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (int i = 0; i < numLoops; i++) {
|
||||
if (is_zero_v3(r_custom_loopnors[i])) {
|
||||
copy_v3_v3(r_custom_loopnors[i], lnors[i]);
|
||||
if (is_zero_v3(r_custom_loop_normals[i])) {
|
||||
copy_v3_v3(r_custom_loop_normals[i], loop_normals[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1729,9 +1730,9 @@ static void mesh_normals_loop_custom_set(const MVert *mverts,
|
|||
BLI_assert(lnors_spacearr.data_type == MLNOR_SPACEARR_LOOP_INDEX);
|
||||
|
||||
/* Now, check each current smooth fan (one lnor space per smooth fan!),
|
||||
* and if all its matching custom lnors are not (enough) equal, add sharp edges as needed.
|
||||
* and if all its matching custom loop_normals are not (enough) equal, add sharp edges as needed.
|
||||
* This way, next time we run BKE_mesh_normals_loop_split(), we'll get lnor spacearr/smooth fans
|
||||
* matching given custom lnors.
|
||||
* matching given custom loop_normals.
|
||||
* Note this code *will never* unsharp edges! And quite obviously,
|
||||
* when we set custom normals per vertices, running this is absolutely useless. */
|
||||
if (use_vertices) {
|
||||
|
@ -1775,7 +1776,7 @@ static void mesh_normals_loop_custom_set(const MVert *mverts,
|
|||
const int lidx = POINTER_AS_INT(loops->link);
|
||||
const MLoop *ml = &mloops[lidx];
|
||||
const int nidx = lidx;
|
||||
float *nor = r_custom_loopnors[nidx];
|
||||
float *nor = r_custom_loop_normals[nidx];
|
||||
|
||||
if (!org_nor) {
|
||||
org_nor = nor;
|
||||
|
@ -1807,7 +1808,7 @@ static void mesh_normals_loop_custom_set(const MVert *mverts,
|
|||
const int lidx = POINTER_AS_INT(loops->link);
|
||||
const MLoop *ml = &mloops[lidx];
|
||||
const int nidx = lidx;
|
||||
float *nor = r_custom_loopnors[nidx];
|
||||
float *nor = r_custom_loop_normals[nidx];
|
||||
|
||||
if (dot_v3v3(org_nor, nor) < LNOR_SPACE_TRIGO_THRESHOLD) {
|
||||
const MPoly *mp = &mpolys[loop_to_poly[lidx]];
|
||||
|
@ -1818,7 +1819,7 @@ static void mesh_normals_loop_custom_set(const MVert *mverts,
|
|||
}
|
||||
}
|
||||
|
||||
/* And now, recompute our new auto lnors and lnor spacearr! */
|
||||
/* And now, recompute our new auto `loop_normals` and lnor spacearr! */
|
||||
BKE_lnor_spacearr_clear(&lnors_spacearr);
|
||||
BKE_mesh_normals_loop_split(mverts,
|
||||
vert_normals,
|
||||
|
@ -1826,10 +1827,10 @@ static void mesh_normals_loop_custom_set(const MVert *mverts,
|
|||
medges,
|
||||
numEdges,
|
||||
mloops,
|
||||
lnors,
|
||||
loop_normals,
|
||||
numLoops,
|
||||
mpolys,
|
||||
polynors,
|
||||
poly_normals,
|
||||
numPolys,
|
||||
use_split_normals,
|
||||
split_angle,
|
||||
|
@ -1858,7 +1859,7 @@ static void mesh_normals_loop_custom_set(const MVert *mverts,
|
|||
if (lnors_spacearr.lspacearr[i]->flags & MLNOR_SPACE_IS_SINGLE) {
|
||||
BLI_assert(POINTER_AS_INT(loops) == i);
|
||||
const int nidx = use_vertices ? int(mloops[i].v) : i;
|
||||
float *nor = r_custom_loopnors[nidx];
|
||||
float *nor = r_custom_loop_normals[nidx];
|
||||
|
||||
BKE_lnor_space_custom_normal_to_data(lnors_spacearr.lspacearr[i], nor, r_clnors_data[i]);
|
||||
done_loops[i].reset();
|
||||
|
@ -1872,7 +1873,7 @@ static void mesh_normals_loop_custom_set(const MVert *mverts,
|
|||
while (loops) {
|
||||
const int lidx = POINTER_AS_INT(loops->link);
|
||||
const int nidx = use_vertices ? int(mloops[lidx].v) : lidx;
|
||||
float *nor = r_custom_loopnors[nidx];
|
||||
float *nor = r_custom_loop_normals[nidx];
|
||||
|
||||
avg_nor_count++;
|
||||
add_v3_v3(avg_nor, nor);
|
||||
|
@ -1893,7 +1894,7 @@ static void mesh_normals_loop_custom_set(const MVert *mverts,
|
|||
}
|
||||
}
|
||||
|
||||
MEM_freeN(lnors);
|
||||
MEM_freeN(loop_normals);
|
||||
BKE_lnor_spacearr_free(&lnors_spacearr);
|
||||
}
|
||||
|
||||
|
@ -1903,10 +1904,10 @@ void BKE_mesh_normals_loop_custom_set(const MVert *mverts,
|
|||
MEdge *medges,
|
||||
const int numEdges,
|
||||
const MLoop *mloops,
|
||||
float (*r_custom_loopnors)[3],
|
||||
float (*r_custom_loop_normals)[3],
|
||||
const int numLoops,
|
||||
const MPoly *mpolys,
|
||||
const float (*polynors)[3],
|
||||
const float (*poly_normals)[3],
|
||||
const int numPolys,
|
||||
short (*r_clnors_data)[2])
|
||||
{
|
||||
|
@ -1916,10 +1917,10 @@ void BKE_mesh_normals_loop_custom_set(const MVert *mverts,
|
|||
medges,
|
||||
numEdges,
|
||||
mloops,
|
||||
r_custom_loopnors,
|
||||
r_custom_loop_normals,
|
||||
numLoops,
|
||||
mpolys,
|
||||
polynors,
|
||||
poly_normals,
|
||||
numPolys,
|
||||
r_clnors_data,
|
||||
false);
|
||||
|
@ -1927,14 +1928,14 @@ void BKE_mesh_normals_loop_custom_set(const MVert *mverts,
|
|||
|
||||
void BKE_mesh_normals_loop_custom_from_verts_set(const MVert *mverts,
|
||||
const float (*vert_normals)[3],
|
||||
float (*r_custom_vertnors)[3],
|
||||
float (*r_custom_vert_normals)[3],
|
||||
const int numVerts,
|
||||
MEdge *medges,
|
||||
const int numEdges,
|
||||
const MLoop *mloops,
|
||||
const int numLoops,
|
||||
const MPoly *mpolys,
|
||||
const float (*polynors)[3],
|
||||
const float (*poly_normals)[3],
|
||||
const int numPolys,
|
||||
short (*r_clnors_data)[2])
|
||||
{
|
||||
|
@ -1944,10 +1945,10 @@ void BKE_mesh_normals_loop_custom_from_verts_set(const MVert *mverts,
|
|||
medges,
|
||||
numEdges,
|
||||
mloops,
|
||||
r_custom_vertnors,
|
||||
r_custom_vert_normals,
|
||||
numLoops,
|
||||
mpolys,
|
||||
polynors,
|
||||
poly_normals,
|
||||
numPolys,
|
||||
r_clnors_data,
|
||||
true);
|
||||
|
@ -1986,14 +1987,14 @@ static void mesh_set_custom_normals(Mesh *mesh, float (*r_custom_nors)[3], const
|
|||
use_vertices);
|
||||
}
|
||||
|
||||
void BKE_mesh_set_custom_normals(Mesh *mesh, float (*r_custom_loopnors)[3])
|
||||
void BKE_mesh_set_custom_normals(Mesh *mesh, float (*r_custom_loop_normals)[3])
|
||||
{
|
||||
mesh_set_custom_normals(mesh, r_custom_loopnors, false);
|
||||
mesh_set_custom_normals(mesh, r_custom_loop_normals, false);
|
||||
}
|
||||
|
||||
void BKE_mesh_set_custom_normals_from_verts(Mesh *mesh, float (*r_custom_vertnors)[3])
|
||||
void BKE_mesh_set_custom_normals_from_verts(Mesh *mesh, float (*r_custom_vert_normals)[3])
|
||||
{
|
||||
mesh_set_custom_normals(mesh, r_custom_vertnors, true);
|
||||
mesh_set_custom_normals(mesh, r_custom_vert_normals, true);
|
||||
}
|
||||
|
||||
void BKE_mesh_normals_loop_to_vertex(const int numVerts,
|
||||
|
|
|
@ -58,7 +58,7 @@ struct BKEMeshToTangent {
|
|||
|
||||
mikk::float3 GetNormal(const uint face_num, const uint vert_num)
|
||||
{
|
||||
return mikk::float3(lnors[uint(mpolys[face_num].loopstart) + vert_num]);
|
||||
return mikk::float3(loop_normals[uint(mpolys[face_num].loopstart) + vert_num]);
|
||||
}
|
||||
|
||||
void SetTangentSpace(const uint face_num, const uint vert_num, mikk::float3 T, bool orientation)
|
||||
|
@ -67,20 +67,20 @@ struct BKEMeshToTangent {
|
|||
copy_v4_fl4(p_res, T.x, T.y, T.z, orientation ? 1.0f : -1.0f);
|
||||
}
|
||||
|
||||
const MPoly *mpolys; /* faces */
|
||||
const MLoop *mloops; /* faces vertices */
|
||||
const MVert *mverts; /* vertices */
|
||||
const MLoopUV *luvs; /* texture coordinates */
|
||||
const float (*lnors)[3]; /* loops' normals */
|
||||
float (*tangents)[4]; /* output tangents */
|
||||
int num_polys; /* number of polygons */
|
||||
const MPoly *mpolys; /* faces */
|
||||
const MLoop *mloops; /* faces vertices */
|
||||
const MVert *mverts; /* vertices */
|
||||
const MLoopUV *luvs; /* texture coordinates */
|
||||
const float (*loop_normals)[3]; /* loops' normals */
|
||||
float (*tangents)[4]; /* output tangents */
|
||||
int num_polys; /* number of polygons */
|
||||
};
|
||||
|
||||
void BKE_mesh_calc_loop_tangent_single_ex(const MVert *mverts,
|
||||
const int /*numVerts*/,
|
||||
const MLoop *mloops,
|
||||
float (*r_looptangent)[4],
|
||||
const float (*loopnors)[3],
|
||||
const float (*loop_normals)[3],
|
||||
const MLoopUV *loopuvs,
|
||||
const int /*numLoops*/,
|
||||
const MPoly *mpolys,
|
||||
|
@ -93,7 +93,7 @@ void BKE_mesh_calc_loop_tangent_single_ex(const MVert *mverts,
|
|||
mesh_to_tangent.mloops = mloops;
|
||||
mesh_to_tangent.mverts = mverts;
|
||||
mesh_to_tangent.luvs = loopuvs;
|
||||
mesh_to_tangent.lnors = loopnors;
|
||||
mesh_to_tangent.loop_normals = loop_normals;
|
||||
mesh_to_tangent.tangents = r_looptangent;
|
||||
mesh_to_tangent.num_polys = numPolys;
|
||||
|
||||
|
@ -133,9 +133,9 @@ void BKE_mesh_calc_loop_tangent_single(Mesh *mesh,
|
|||
return;
|
||||
}
|
||||
|
||||
const float(*loopnors)[3] = static_cast<const float(*)[3]>(
|
||||
const float(*loop_normals)[3] = static_cast<const float(*)[3]>(
|
||||
CustomData_get_layer(&mesh->ldata, CD_NORMAL));
|
||||
if (!loopnors) {
|
||||
if (!loop_normals) {
|
||||
BKE_report(
|
||||
reports, RPT_ERROR, "Tangent space computation needs loop normals, none found, aborting");
|
||||
return;
|
||||
|
@ -145,7 +145,7 @@ void BKE_mesh_calc_loop_tangent_single(Mesh *mesh,
|
|||
mesh->totvert,
|
||||
BKE_mesh_loops(mesh),
|
||||
r_looptangents,
|
||||
loopnors,
|
||||
loop_normals,
|
||||
loopuvs,
|
||||
mesh->totloop,
|
||||
BKE_mesh_polys(mesh),
|
||||
|
|
|
@ -670,7 +670,7 @@ static void multires_del_higher(MultiresModifierData *mmd, Object *ob, int lvl)
|
|||
|
||||
if (mdisps && levels > 0) {
|
||||
if (lvl > 0) {
|
||||
/* MLoop *ml = me->mloop; */ /*UNUSED*/
|
||||
// MLoop *ml = me->mloop; /*UNUSED*/
|
||||
int nsize = multires_side_tot[lvl];
|
||||
int hsize = multires_side_tot[mmd->totlvl];
|
||||
int i, j;
|
||||
|
|
|
@ -2326,6 +2326,10 @@ bNode *node_copy_with_mapping(bNodeTree *dst_tree,
|
|||
node_src.typeinfo->copyfunc(dst_tree, node_dst, &node_src);
|
||||
}
|
||||
|
||||
if (dst_tree) {
|
||||
BKE_ntree_update_tag_node_new(dst_tree, node_dst);
|
||||
}
|
||||
|
||||
/* Only call copy function when a copy is made for the main database, not
|
||||
* for cases like the dependency graph and localization. */
|
||||
if (node_dst->typeinfo->copyfunc_api && !(flag & LIB_ID_CREATE_NO_MAIN)) {
|
||||
|
@ -2335,10 +2339,6 @@ bNode *node_copy_with_mapping(bNodeTree *dst_tree,
|
|||
node_dst->typeinfo->copyfunc_api(&ptr, &node_src);
|
||||
}
|
||||
|
||||
if (dst_tree) {
|
||||
BKE_ntree_update_tag_node_new(dst_tree, node_dst);
|
||||
}
|
||||
|
||||
/* Reset the declaration of the new node. */
|
||||
nodeDeclarationEnsure(dst_tree, node_dst);
|
||||
|
||||
|
|
|
@ -42,6 +42,13 @@ static void double_checked_lock_with_task_isolation(std::mutex &mutex,
|
|||
double_checked_lock(mutex, data_is_dirty, [&]() { threading::isolate_task(fn); });
|
||||
}
|
||||
|
||||
static void update_interface_sockets(const bNodeTree &ntree)
|
||||
{
|
||||
bNodeTreeRuntime &tree_runtime = *ntree.runtime;
|
||||
tree_runtime.interface_inputs = ntree.inputs;
|
||||
tree_runtime.interface_outputs = ntree.outputs;
|
||||
}
|
||||
|
||||
static void update_node_vector(const bNodeTree &ntree)
|
||||
{
|
||||
bNodeTreeRuntime &tree_runtime = *ntree.runtime;
|
||||
|
@ -429,6 +436,7 @@ static void ensure_topology_cache(const bNodeTree &ntree)
|
|||
bNodeTreeRuntime &tree_runtime = *ntree.runtime;
|
||||
double_checked_lock_with_task_isolation(
|
||||
tree_runtime.topology_cache_mutex, tree_runtime.topology_cache_is_dirty, [&]() {
|
||||
update_interface_sockets(ntree);
|
||||
update_node_vector(ntree);
|
||||
update_link_vector(ntree);
|
||||
update_socket_vectors_and_owner_node(ntree);
|
||||
|
|
|
@ -142,7 +142,7 @@ void BKE_object_handle_data_update(Depsgraph *depsgraph, Scene *scene, Object *o
|
|||
CustomData_MeshMasks_update(&cddata_masks, &CD_MASK_BAREMESH);
|
||||
/* Custom attributes should not be removed automatically. They might be used by the render
|
||||
* engine or scripts. They can still be removed explicitly using geometry nodes.
|
||||
* Crease can be be used in generic situations with geometry nodes as well. */
|
||||
* Crease can be used in generic situations with geometry nodes as well. */
|
||||
cddata_masks.vmask |= CD_MASK_PROP_ALL | CD_MASK_CREASE;
|
||||
cddata_masks.emask |= CD_MASK_PROP_ALL | CD_MASK_CREASE;
|
||||
cddata_masks.fmask |= CD_MASK_PROP_ALL;
|
||||
|
|
|
@ -3332,7 +3332,8 @@ void psys_cache_paths(ParticleSimulationData *sim, float cfra, const bool use_re
|
|||
PARTICLE_P;
|
||||
|
||||
float birthtime = 0.0, dietime = 0.0;
|
||||
float t, time = 0.0, dfra = 1.0 /* , frs_sec = sim->scene->r.frs_sec*/ /*UNUSED*/;
|
||||
float t, time = 0.0, dfra = 1.0;
|
||||
// float frs_sec = sim->scene->r.frs_sec; /*UNUSED*/
|
||||
float col[4] = {0.5f, 0.5f, 0.5f, 1.0f};
|
||||
float prev_tangent[3] = {0.0f, 0.0f, 0.0f}, hairmat[4][4];
|
||||
float rotmat[3][3];
|
||||
|
|
|
@ -1335,7 +1335,7 @@ typedef struct PBVHUpdateData {
|
|||
PBVHNode **nodes;
|
||||
int totnode;
|
||||
|
||||
float (*vnors)[3];
|
||||
float (*vert_normals)[3];
|
||||
int flag;
|
||||
bool show_sculpt_face_sets;
|
||||
PBVHAttrReq *attrs;
|
||||
|
@ -1349,7 +1349,7 @@ static void pbvh_update_normals_clear_task_cb(void *__restrict userdata,
|
|||
PBVHUpdateData *data = userdata;
|
||||
PBVH *pbvh = data->pbvh;
|
||||
PBVHNode *node = data->nodes[n];
|
||||
float(*vnors)[3] = data->vnors;
|
||||
float(*vert_normals)[3] = data->vert_normals;
|
||||
|
||||
if (node->flag & PBVH_UpdateNormals) {
|
||||
const int *verts = node->vert_indices;
|
||||
|
@ -1357,7 +1357,7 @@ static void pbvh_update_normals_clear_task_cb(void *__restrict userdata,
|
|||
for (int i = 0; i < totvert; i++) {
|
||||
const int v = verts[i];
|
||||
if (pbvh->vert_bitmap[v]) {
|
||||
zero_v3(vnors[v]);
|
||||
zero_v3(vert_normals[v]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1371,7 +1371,7 @@ static void pbvh_update_normals_accum_task_cb(void *__restrict userdata,
|
|||
|
||||
PBVH *pbvh = data->pbvh;
|
||||
PBVHNode *node = data->nodes[n];
|
||||
float(*vnors)[3] = data->vnors;
|
||||
float(*vert_normals)[3] = data->vert_normals;
|
||||
|
||||
if (node->flag & PBVH_UpdateNormals) {
|
||||
uint mpoly_prev = UINT_MAX;
|
||||
|
@ -1405,7 +1405,7 @@ static void pbvh_update_normals_accum_task_cb(void *__restrict userdata,
|
|||
* Not exact equivalent though, since atomicity is only ensured for one component
|
||||
* of the vector at a time, but here it shall not make any sensible difference. */
|
||||
for (int k = 3; k--;) {
|
||||
atomic_add_and_fetch_fl(&vnors[v][k], fn[k]);
|
||||
atomic_add_and_fetch_fl(&vert_normals[v][k], fn[k]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1420,7 +1420,7 @@ static void pbvh_update_normals_store_task_cb(void *__restrict userdata,
|
|||
PBVHUpdateData *data = userdata;
|
||||
PBVH *pbvh = data->pbvh;
|
||||
PBVHNode *node = data->nodes[n];
|
||||
float(*vnors)[3] = data->vnors;
|
||||
float(*vert_normals)[3] = data->vert_normals;
|
||||
|
||||
if (node->flag & PBVH_UpdateNormals) {
|
||||
const int *verts = node->vert_indices;
|
||||
|
@ -1432,7 +1432,7 @@ static void pbvh_update_normals_store_task_cb(void *__restrict userdata,
|
|||
/* No atomics necessary because we are iterating over uniq_verts only,
|
||||
* so we know only this thread will handle this vertex. */
|
||||
if (pbvh->vert_bitmap[v]) {
|
||||
normalize_v3(vnors[v]);
|
||||
normalize_v3(vert_normals[v]);
|
||||
pbvh->vert_bitmap[v] = false;
|
||||
}
|
||||
}
|
||||
|
@ -1456,7 +1456,7 @@ static void pbvh_faces_update_normals(PBVH *pbvh, PBVHNode **nodes, int totnode)
|
|||
PBVHUpdateData data = {
|
||||
.pbvh = pbvh,
|
||||
.nodes = nodes,
|
||||
.vnors = pbvh->vert_normals,
|
||||
.vert_normals = pbvh->vert_normals,
|
||||
};
|
||||
|
||||
TaskParallelSettings settings;
|
||||
|
|
|
@ -134,7 +134,7 @@ bool BKE_shrinkwrap_init_tree(
|
|||
}
|
||||
|
||||
if (force_normals || BKE_shrinkwrap_needs_normals(shrinkType, shrinkMode)) {
|
||||
data->pnors = BKE_mesh_poly_normals_ensure(mesh);
|
||||
data->poly_normals = BKE_mesh_poly_normals_ensure(mesh);
|
||||
if ((mesh->flag & ME_AUTOSMOOTH) != 0) {
|
||||
data->clnors = static_cast<const float(*)[3]>(CustomData_get_layer(&mesh->ldata, CD_NORMAL));
|
||||
}
|
||||
|
@ -1218,8 +1218,8 @@ void BKE_shrinkwrap_compute_smooth_normal(const ShrinkwrapTreeData *tree,
|
|||
}
|
||||
}
|
||||
/* Use the polygon normal if flat. */
|
||||
else if (tree->pnors != nullptr) {
|
||||
copy_v3_v3(r_no, tree->pnors[tri->poly]);
|
||||
else if (tree->poly_normals != nullptr) {
|
||||
copy_v3_v3(r_no, tree->poly_normals[tri->poly]);
|
||||
}
|
||||
/* Finally fallback to the looptri normal. */
|
||||
else {
|
||||
|
|
|
@ -233,7 +233,7 @@ static float _final_mass(Object *ob, BodyPoint *bp)
|
|||
CLOG_ERROR(&LOG, "sb or bp == NULL");
|
||||
return 1.0f;
|
||||
}
|
||||
/* helper functions for everything is animateble jow_go_for2_5 ------*/
|
||||
/* Helper functions for everything is animateble jow_go_for2_5. */
|
||||
|
||||
/* +++ collider caching and dicing +++ */
|
||||
|
||||
|
|
|
@ -152,7 +152,7 @@ template<typename T> class Span {
|
|||
|
||||
/**
|
||||
* Returns a contiguous part of the array. This invokes undefined behavior when the start or size
|
||||
* is negative. Clamps the size of the new new span so it fits in the current one.
|
||||
* is negative. Clamps the size of the new span so it fits in the current one.
|
||||
*/
|
||||
constexpr Span slice_safe(const int64_t start, const int64_t size) const
|
||||
{
|
||||
|
@ -608,7 +608,7 @@ template<typename T> class MutableSpan {
|
|||
|
||||
/**
|
||||
* Returns a contiguous part of the array. This invokes undefined behavior when the start or size
|
||||
* is negative. Clamps the size of the new new span so it fits in the current one.
|
||||
* is negative. Clamps the size of the new span so it fits in the current one.
|
||||
*/
|
||||
constexpr MutableSpan slice_safe(const int64_t start, const int64_t size) const
|
||||
{
|
||||
|
|
|
@ -902,11 +902,11 @@ class Vector {
|
|||
|
||||
std::reverse_iterator<const T *> rbegin() const
|
||||
{
|
||||
return std::reverse_iterator<T *>(this->end());
|
||||
return std::reverse_iterator<const T *>(this->end());
|
||||
}
|
||||
std::reverse_iterator<const T *> rend() const
|
||||
{
|
||||
return std::reverse_iterator<T *>(this->begin());
|
||||
return std::reverse_iterator<const T *>(this->begin());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -267,7 +267,7 @@ size_t BLI_strncpy_utf8_rlen(char *__restrict dst, const char *__restrict src, s
|
|||
|
||||
#undef BLI_STR_UTF8_CPY
|
||||
|
||||
/* --------------------------------------------------------------------------*/
|
||||
/* -------------------------------------------------------------------- */
|
||||
/* wchar_t / utf8 functions */
|
||||
|
||||
size_t BLI_strncpy_wchar_as_utf8(char *__restrict dst,
|
||||
|
@ -359,7 +359,7 @@ size_t BLI_strncpy_wchar_from_utf8(wchar_t *__restrict dst_w,
|
|||
}
|
||||
|
||||
/* end wchar_t / utf8 functions */
|
||||
/* --------------------------------------------------------------------------*/
|
||||
/* -------------------------------------------------------------------- */
|
||||
|
||||
int BLI_wcwidth(char32_t ucs)
|
||||
{
|
||||
|
@ -399,7 +399,7 @@ int BLI_str_utf8_char_width_safe(const char *p)
|
|||
return (columns < 0) ? 1 : columns;
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------*/
|
||||
/* -------------------------------------------------------------------- */
|
||||
|
||||
/* copied from glib's gutf8.c, added 'Err' arg */
|
||||
|
||||
|
|
|
@ -463,7 +463,7 @@ TEST(string, StrCursorStepNextUtf32AllCombining)
|
|||
|
||||
TEST(string, StrCursorStepNextUtf32Complex)
|
||||
{
|
||||
/* Combining character, "A", two combining characters, "B".*/
|
||||
/* Combining character, "A", two combining characters, "B". */
|
||||
const char32_t complex[] = U"\u0300\u0041\u0300\u0320\u0042";
|
||||
const size_t len = 5;
|
||||
int pos = 0;
|
||||
|
@ -486,7 +486,7 @@ TEST(string, StrCursorStepNextUtf32Complex)
|
|||
|
||||
TEST(string, StrCursorStepNextUtf32Invalid)
|
||||
{
|
||||
/* Latin1 "À", tab, carriage return, linefeed, separated by combining characters.*/
|
||||
/* Latin1 "À", tab, carriage return, linefeed, separated by combining characters. */
|
||||
const char32_t invalid[] = U"\u00C0\u0300\u0009\u0300\u000D\u0300\u000A\u0300";
|
||||
const size_t len = 8;
|
||||
int pos = 0;
|
||||
|
@ -573,7 +573,7 @@ TEST(string, StrCursorStepPrevUtf32AllCombining)
|
|||
|
||||
TEST(string, StrCursorStepPrevUtf32Complex)
|
||||
{
|
||||
/* Combining character, "A", two combining characters, "B".*/
|
||||
/* Combining character, "A", two combining characters, "B". */
|
||||
const char32_t complex[] = U"\u0300\u0041\u0300\u0320\u0042";
|
||||
const size_t len = 5;
|
||||
int pos = 5;
|
||||
|
@ -596,7 +596,7 @@ TEST(string, StrCursorStepPrevUtf32Complex)
|
|||
|
||||
TEST(string, StrCursorStepPrevUtf32Invalid)
|
||||
{
|
||||
/* Latin1 "À", tab, carriage return, linefeed, separated by combining characters.*/
|
||||
/* Latin1 "À", tab, carriage return, linefeed, separated by combining characters. */
|
||||
const char32_t invalid[] = U"\u00C0\u0300\u0009\u0300\u000D\u0300\u000A\u0300";
|
||||
const size_t len = 8;
|
||||
int pos = 8;
|
||||
|
@ -690,7 +690,7 @@ TEST(string, StrCursorStepNextUtf8AllCombining)
|
|||
|
||||
TEST(string, StrCursorStepNextUtf8AllComplex)
|
||||
{
|
||||
/* Combining character, "A", "©", two combining characters, "B".*/
|
||||
/* Combining character, "A", "©", two combining characters, "B". */
|
||||
const char complex[] = "\xCC\x80\x41\xC2\xA9\xCC\x80\xCC\xA0\x42";
|
||||
const size_t len = 10;
|
||||
int pos = 0;
|
||||
|
@ -723,7 +723,7 @@ TEST(string, StrCursorStepNextUtf8AllComplex)
|
|||
|
||||
TEST(string, StrCursorStepNextUtf8Invalid)
|
||||
{
|
||||
/* Latin1 "À", combining, tab, carriage return, linefeed, combining.*/
|
||||
/* Latin1 "À", combining, tab, carriage return, linefeed, combining. */
|
||||
const char invalid[] = "\xC0\xCC\x80\x09\x0D\x0A\xCC\x80";
|
||||
const size_t len = 8;
|
||||
int pos = 0;
|
||||
|
@ -818,7 +818,7 @@ TEST(string, StrCursorStepPrevUtf8AllCombining)
|
|||
|
||||
TEST(string, StrCursorStepPrevUtf8Complex)
|
||||
{
|
||||
/* Combining character, "A", "©", two combining characters, "B".*/
|
||||
/* Combining character, "A", "©", two combining characters, "B". */
|
||||
const char complex[] = "\xCC\x80\x41\xC2\xA9\xCC\x80\xCC\xA0\x42";
|
||||
const size_t len = 10;
|
||||
int pos = 10;
|
||||
|
@ -851,7 +851,7 @@ TEST(string, StrCursorStepPrevUtf8Complex)
|
|||
|
||||
TEST(string, StrCursorStepPrevUtf8Invalid)
|
||||
{
|
||||
/* Latin1 "À", combining, tab, carriage return, linefeed, combining.*/
|
||||
/* Latin1 "À", combining, tab, carriage return, linefeed, combining. */
|
||||
const char invalid[] = "\xC0\xCC\x80\x09\x0D\x0A\xCC\x80";
|
||||
const size_t len = 8;
|
||||
int pos = 8;
|
||||
|
|
|
@ -57,6 +57,9 @@ void MixNode::convert_to_operations(NodeConverter &converter,
|
|||
case MA_RAMP_DIFF:
|
||||
convert_prog = new MixDifferenceOperation();
|
||||
break;
|
||||
case MA_RAMP_EXCLUSION:
|
||||
convert_prog = new MixExclusionOperation();
|
||||
break;
|
||||
case MA_RAMP_SAT:
|
||||
convert_prog = new MixSaturationOperation();
|
||||
break;
|
||||
|
|
|
@ -494,7 +494,65 @@ void MixDifferenceOperation::update_memory_buffer_row(PixelCursor &p)
|
|||
}
|
||||
}
|
||||
|
||||
/* ******** Mix Difference Operation ******** */
|
||||
/* ******** Mix Exclusion Operation ******** */
|
||||
|
||||
void MixExclusionOperation::execute_pixel_sampled(float output[4],
|
||||
float x,
|
||||
float y,
|
||||
PixelSampler sampler)
|
||||
{
|
||||
float input_color1[4];
|
||||
float input_color2[4];
|
||||
float input_value[4];
|
||||
|
||||
input_value_operation_->read_sampled(input_value, x, y, sampler);
|
||||
input_color1_operation_->read_sampled(input_color1, x, y, sampler);
|
||||
input_color2_operation_->read_sampled(input_color2, x, y, sampler);
|
||||
|
||||
float value = input_value[0];
|
||||
if (this->use_value_alpha_multiply()) {
|
||||
value *= input_color2[3];
|
||||
}
|
||||
float valuem = 1.0f - value;
|
||||
output[0] = max_ff(valuem * input_color1[0] + value * (input_color1[0] + input_color2[0] -
|
||||
2.0f * input_color1[0] * input_color2[0]),
|
||||
0.0f);
|
||||
output[1] = max_ff(valuem * input_color1[1] + value * (input_color1[1] + input_color2[1] -
|
||||
2.0f * input_color1[1] * input_color2[1]),
|
||||
0.0f);
|
||||
output[2] = max_ff(valuem * input_color1[2] + value * (input_color1[2] + input_color2[2] -
|
||||
2.0f * input_color1[2] * input_color2[2]),
|
||||
0.0f);
|
||||
output[3] = input_color1[3];
|
||||
|
||||
clamp_if_needed(output);
|
||||
}
|
||||
|
||||
void MixExclusionOperation::update_memory_buffer_row(PixelCursor &p)
|
||||
{
|
||||
while (p.out < p.row_end) {
|
||||
float value = p.value[0];
|
||||
if (this->use_value_alpha_multiply()) {
|
||||
value *= p.color2[3];
|
||||
}
|
||||
const float value_m = 1.0f - value;
|
||||
p.out[0] = max_ff(value_m * p.color1[0] +
|
||||
value * (p.color1[0] + p.color2[0] - 2.0f * p.color1[0] * p.color2[0]),
|
||||
0.0f);
|
||||
p.out[1] = max_ff(value_m * p.color1[1] +
|
||||
value * (p.color1[1] + p.color2[1] - 2.0f * p.color1[1] * p.color2[1]),
|
||||
0.0f);
|
||||
p.out[2] = max_ff(value_m * p.color1[2] +
|
||||
value * (p.color1[2] + p.color2[2] - 2.0f * p.color1[2] * p.color2[2]),
|
||||
0.0f);
|
||||
p.out[3] = p.color1[3];
|
||||
|
||||
clamp_if_needed(p.out);
|
||||
p.next();
|
||||
}
|
||||
}
|
||||
|
||||
/* ******** Mix Divide Operation ******** */
|
||||
|
||||
void MixDivideOperation::execute_pixel_sampled(float output[4],
|
||||
float x,
|
||||
|
|
|
@ -143,6 +143,14 @@ class MixDifferenceOperation : public MixBaseOperation {
|
|||
void update_memory_buffer_row(PixelCursor &p) override;
|
||||
};
|
||||
|
||||
class MixExclusionOperation : public MixBaseOperation {
|
||||
public:
|
||||
void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override;
|
||||
|
||||
protected:
|
||||
void update_memory_buffer_row(PixelCursor &p) override;
|
||||
};
|
||||
|
||||
class MixDivideOperation : public MixBaseOperation {
|
||||
public:
|
||||
void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override;
|
||||
|
|
|
@ -106,6 +106,8 @@ set(GLSL_SRC
|
|||
shaders/compositor_glare_simple_star_diagonal_pass.glsl
|
||||
shaders/compositor_glare_simple_star_horizontal_pass.glsl
|
||||
shaders/compositor_glare_simple_star_vertical_pass.glsl
|
||||
shaders/compositor_glare_streaks_accumulate.glsl
|
||||
shaders/compositor_glare_streaks_filter.glsl
|
||||
shaders/compositor_image_crop.glsl
|
||||
shaders/compositor_morphological_distance.glsl
|
||||
shaders/compositor_morphological_distance_feather.glsl
|
||||
|
@ -119,6 +121,7 @@ set(GLSL_SRC
|
|||
shaders/compositor_set_alpha.glsl
|
||||
shaders/compositor_split_viewer.glsl
|
||||
shaders/compositor_symmetric_blur.glsl
|
||||
shaders/compositor_symmetric_blur_variable_size.glsl
|
||||
shaders/compositor_symmetric_separable_blur.glsl
|
||||
shaders/compositor_tone_map_photoreceptor.glsl
|
||||
shaders/compositor_tone_map_simple.glsl
|
||||
|
@ -206,6 +209,7 @@ set(SRC_SHADER_CREATE_INFOS
|
|||
shaders/infos/compositor_set_alpha_info.hh
|
||||
shaders/infos/compositor_split_viewer_info.hh
|
||||
shaders/infos/compositor_symmetric_blur_info.hh
|
||||
shaders/infos/compositor_symmetric_blur_variable_size_info.hh
|
||||
shaders/infos/compositor_symmetric_separable_blur_info.hh
|
||||
shaders/infos/compositor_tone_map_photoreceptor_info.hh
|
||||
shaders/infos/compositor_tone_map_simple_info.hh
|
||||
|
|
|
@ -6,7 +6,7 @@ void main()
|
|||
ivec2 input_size = texture_size(input_ghost_tx);
|
||||
|
||||
/* Add 0.5 to evaluate the input sampler at the center of the pixel and divide by the image size
|
||||
* to get the coordinates into the sampler's expected [0, 1] range*/
|
||||
* to get the coordinates into the sampler's expected [0, 1] range. */
|
||||
vec2 coordinates = (vec2(texel) + vec2(0.5)) / input_size;
|
||||
|
||||
/* We accumulate four variants of the input ghost texture, each is scaled by some amount and
|
||||
|
|
|
@ -6,7 +6,7 @@ void main()
|
|||
ivec2 input_size = texture_size(small_ghost_tx);
|
||||
|
||||
/* Add 0.5 to evaluate the input sampler at the center of the pixel and divide by the image size
|
||||
* to get the coordinates into the sampler's expected [0, 1] range*/
|
||||
* to get the coordinates into the sampler's expected [0, 1] range. */
|
||||
vec2 coordinates = (vec2(texel) + vec2(0.5)) / input_size;
|
||||
|
||||
/* The small ghost is scaled down with the origin as the center of the image by a factor of 2.13,
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
#pragma BLENDER_REQUIRE(gpu_shader_compositor_texture_utilities.glsl)
|
||||
|
||||
void main()
|
||||
{
|
||||
ivec2 texel = ivec2(gl_GlobalInvocationID.xy);
|
||||
vec4 attenuated_streak = texture_load(streak_tx, texel) * attenuation_factor;
|
||||
vec4 current_accumulated_streaks = imageLoad(accumulated_streaks_img, texel);
|
||||
imageStore(accumulated_streaks_img, texel, current_accumulated_streaks + attenuated_streak);
|
||||
}
|
|
@ -0,0 +1,41 @@
|
|||
#pragma BLENDER_REQUIRE(gpu_shader_compositor_texture_utilities.glsl)
|
||||
|
||||
void main()
|
||||
{
|
||||
ivec2 texel = ivec2(gl_GlobalInvocationID.xy);
|
||||
ivec2 input_size = texture_size(input_streak_tx);
|
||||
|
||||
/* Add 0.5 to evaluate the input sampler at the center of the pixel and divide by the image size
|
||||
* to get the coordinates into the sampler's expected [0, 1] range. Similarly, transform the
|
||||
* vector into the sampler's space by dividing by the input size. */
|
||||
vec2 coordinates = (vec2(texel) + vec2(0.5)) / input_size;
|
||||
vec2 vector = streak_vector / input_size;
|
||||
|
||||
/* Load three equally spaced neighbours to the current pixel in the direction of the streak
|
||||
* vector. */
|
||||
vec4 neighbours[3];
|
||||
neighbours[0] = texture(input_streak_tx, coordinates + vector);
|
||||
neighbours[1] = texture(input_streak_tx, coordinates + vector * 2.0);
|
||||
neighbours[2] = texture(input_streak_tx, coordinates + vector * 3.0);
|
||||
|
||||
/* Attenuate the value of two of the channels for each of the neighbours by multiplying by the
|
||||
* color modulator. The particular channels for each neighbour were chosen to be visually similar
|
||||
* to the modulation pattern of chromatic aberration. */
|
||||
neighbours[0].gb *= color_modulator;
|
||||
neighbours[1].rg *= color_modulator;
|
||||
neighbours[2].rb *= color_modulator;
|
||||
|
||||
/* Compute the weighted sum of all neighbours using the given fade factors as weights. The
|
||||
* weights are expected to be lower for neighbours that are further away. */
|
||||
vec4 weighted_neighbours_sum = vec4(0.0);
|
||||
for (int i = 0; i < 3; i++) {
|
||||
weighted_neighbours_sum += fade_factors[i] * neighbours[i];
|
||||
}
|
||||
|
||||
/* The output is the average between the center color and the weighted sum of the neighbours.
|
||||
* Which intuitively mean that highlights will spread in the direction of the streak, which is
|
||||
* the desired result. */
|
||||
vec4 center_color = texture(input_streak_tx, coordinates);
|
||||
vec4 output_color = (center_color + weighted_neighbours_sum) / 2.0;
|
||||
imageStore(output_streak_img, texel, output_color);
|
||||
}
|
|
@ -1,16 +1,20 @@
|
|||
#pragma BLENDER_REQUIRE(gpu_shader_compositor_blur_common.glsl)
|
||||
#pragma BLENDER_REQUIRE(gpu_shader_compositor_texture_utilities.glsl)
|
||||
|
||||
/* Loads the input color of the pixel at the given texel. If gamma correction is enabled, the color
|
||||
* is gamma corrected. If bounds are extended, then the input is treated as padded by a blur size
|
||||
* amount of pixels of zero color, and the given texel is assumed to be in the space of the image
|
||||
* after padding. So we offset the texel by the blur radius amount and fallback to a zero color if
|
||||
* it is out of bounds. For instance, if the input is padded by 5 pixels to the left of the image,
|
||||
* the first 5 pixels should be out of bounds and thus zero, hence the introduced offset. */
|
||||
vec4 load_input(ivec2 texel)
|
||||
{
|
||||
vec4 color;
|
||||
if (extend_bounds) {
|
||||
/* If bounds are extended, then we treat the input as padded by a radius amount of pixels. So
|
||||
* we load the input with an offset by the radius amount and fallback to a transparent color if
|
||||
* it is out of bounds. Notice that we subtract 1 because the weights texture have an extra
|
||||
* center weight, see the SymmetricBlurWeights for more information. */
|
||||
ivec2 blur_size = texture_size(weights_tx) - 1;
|
||||
color = texture_load(input_tx, texel - blur_size, vec4(0.0));
|
||||
/* Notice that we subtract 1 because the weights texture have an extra center weight, see the
|
||||
* SymmetricBlurWeights class for more information. */
|
||||
ivec2 blur_radius = texture_size(weights_tx) - 1;
|
||||
color = texture_load(input_tx, texel - blur_radius, vec4(0.0));
|
||||
}
|
||||
else {
|
||||
color = texture_load(input_tx, texel);
|
||||
|
|
|
@ -0,0 +1,155 @@
|
|||
#pragma BLENDER_REQUIRE(gpu_shader_common_math_utils.glsl)
|
||||
#pragma BLENDER_REQUIRE(gpu_shader_compositor_blur_common.glsl)
|
||||
#pragma BLENDER_REQUIRE(gpu_shader_compositor_texture_utilities.glsl)
|
||||
|
||||
/* Loads the input color of the pixel at the given texel. If gamma correction is enabled, the color
|
||||
* is gamma corrected. If bounds are extended, then the input is treated as padded by a blur size
|
||||
* amount of pixels of zero color, and the given texel is assumed to be in the space of the image
|
||||
* after padding. So we offset the texel by the blur radius amount and fallback to a zero color if
|
||||
* it is out of bounds. For instance, if the input is padded by 5 pixels to the left of the image,
|
||||
* the first 5 pixels should be out of bounds and thus zero, hence the introduced offset. */
|
||||
vec4 load_input(ivec2 texel)
|
||||
{
|
||||
vec4 color;
|
||||
if (extend_bounds) {
|
||||
/* Notice that we subtract 1 because the weights texture have an extra center weight, see the
|
||||
* SymmetricBlurWeights class for more information. */
|
||||
ivec2 blur_radius = texture_size(weights_tx) - 1;
|
||||
color = texture_load(input_tx, texel - blur_radius, vec4(0.0));
|
||||
}
|
||||
else {
|
||||
color = texture_load(input_tx, texel);
|
||||
}
|
||||
|
||||
if (gamma_correct) {
|
||||
color = gamma_correct_blur_input(color);
|
||||
}
|
||||
|
||||
return color;
|
||||
}
|
||||
|
||||
/* Similar to load_input but loads the size instead, has no gamma correction, and clamps to borders
|
||||
* instead of returning zero for out of bound access. See load_input for more information. */
|
||||
float load_size(ivec2 texel)
|
||||
{
|
||||
if (extend_bounds) {
|
||||
ivec2 blur_radius = texture_size(weights_tx) - 1;
|
||||
return texture_load(size_tx, texel - blur_radius).x;
|
||||
}
|
||||
else {
|
||||
return texture_load(size_tx, texel).x;
|
||||
}
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
ivec2 texel = ivec2(gl_GlobalInvocationID.xy);
|
||||
|
||||
vec4 accumulated_color = vec4(0.0);
|
||||
vec4 accumulated_weight = vec4(0.0);
|
||||
|
||||
/* First, compute the contribution of the center pixel. */
|
||||
vec4 center_color = load_input(texel);
|
||||
float center_weight = texture_load(weights_tx, ivec2(0)).x;
|
||||
accumulated_color += center_color * center_weight;
|
||||
accumulated_weight += center_weight;
|
||||
|
||||
ivec2 weights_size = texture_size(weights_tx);
|
||||
|
||||
/* Then, compute the contributions of the pixels along the x axis of the filter, but only
|
||||
* accumulate them if their distance to the center is less their computed variable blur size,
|
||||
* noting that the weights texture only stores the weights for the positive half, but since the
|
||||
* filter is symmetric, the same weight is used for the negative half and we add both of their
|
||||
* contributions. */
|
||||
for (int x = 1; x < weights_size.x; x++) {
|
||||
float weight = texture_load(weights_tx, ivec2(x, 0)).x;
|
||||
|
||||
float right_size = load_size(texel + ivec2(x, 0));
|
||||
float right_blur_radius = right_size * weights_size.x;
|
||||
if (x < right_blur_radius) {
|
||||
accumulated_color += load_input(texel + ivec2(x, 0)) * weight;
|
||||
accumulated_weight += weight;
|
||||
}
|
||||
|
||||
float left_size = load_size(texel + ivec2(-x, 0));
|
||||
float left_blur_radius = right_size * weights_size.x;
|
||||
if (x < left_blur_radius) {
|
||||
accumulated_color += load_input(texel + ivec2(-x, 0)) * weight;
|
||||
accumulated_weight += weight;
|
||||
}
|
||||
}
|
||||
|
||||
/* Then, compute the contributions of the pixels along the y axis of the filter, but only
|
||||
* accumulate them if their distance to the center is less their computed variable blur size,
|
||||
* noting that the weights texture only stores the weights for the positive half, but since the
|
||||
* filter is symmetric, the same weight is used for the negative half and we add both of their
|
||||
* contributions. */
|
||||
for (int y = 1; y < weights_size.y; y++) {
|
||||
float weight = texture_load(weights_tx, ivec2(0, y)).x;
|
||||
|
||||
float top_size = load_size(texel + ivec2(0, y));
|
||||
float top_blur_radius = top_size * weights_size.y;
|
||||
if (y < top_blur_radius) {
|
||||
accumulated_color += load_input(texel + ivec2(0, y)) * weight;
|
||||
accumulated_weight += weight;
|
||||
}
|
||||
|
||||
float bottom_size = load_size(texel + ivec2(0, -y));
|
||||
float bottom_blur_radius = bottom_size * weights_size.x;
|
||||
if (y < bottom_blur_radius) {
|
||||
accumulated_color += load_input(texel + ivec2(0, -y)) * weight;
|
||||
accumulated_weight += weight;
|
||||
}
|
||||
}
|
||||
|
||||
/* Finally, compute the contributions of the pixels in the four quadrants of the filter, but only
|
||||
* accumulate them if the center lies inside the rectangle centered at the pixel whose width and
|
||||
* height is the variable blur size, noting that the weights texture only stores the weights for
|
||||
* the upper right quadrant, but since the filter is symmetric, the same weight is used for the
|
||||
* rest of the quadrants and we add all four of their contributions. */
|
||||
for (int y = 1; y < weights_size.y; y++) {
|
||||
for (int x = 1; x < weights_size.x; x++) {
|
||||
float weight = texture_load(weights_tx, ivec2(x, y)).x;
|
||||
|
||||
/* Upper right quadrant. */
|
||||
float upper_right_size = load_size(texel + ivec2(x, y));
|
||||
vec2 upper_right_blur_radius = upper_right_size * weights_size;
|
||||
if (x < upper_right_blur_radius.x && y < upper_right_blur_radius.y) {
|
||||
accumulated_color += load_input(texel + ivec2(x, y)) * weight;
|
||||
accumulated_weight += weight;
|
||||
}
|
||||
|
||||
/* Upper left quadrant. */
|
||||
float upper_left_size = load_size(texel + ivec2(-x, y));
|
||||
vec2 upper_left_blur_radius = upper_left_size * weights_size;
|
||||
if (x < upper_left_blur_radius.x && y < upper_left_blur_radius.y) {
|
||||
accumulated_color += load_input(texel + ivec2(-x, y)) * weight;
|
||||
accumulated_weight += weight;
|
||||
}
|
||||
|
||||
/* Bottom right quadrant. */
|
||||
float bottom_right_size = load_size(texel + ivec2(x, -y));
|
||||
vec2 bottom_right_blur_radius = bottom_right_size * weights_size;
|
||||
if (x < bottom_right_blur_radius.x && y < bottom_right_blur_radius.y) {
|
||||
accumulated_color += load_input(texel + ivec2(x, -y)) * weight;
|
||||
accumulated_weight += weight;
|
||||
}
|
||||
|
||||
/* Bottom left quadrant. */
|
||||
float bottom_left_size = load_size(texel + ivec2(-x, -y));
|
||||
vec2 bottom_left_blur_radius = bottom_left_size * weights_size;
|
||||
if (x < bottom_left_blur_radius.x && y < bottom_left_blur_radius.y) {
|
||||
accumulated_color += load_input(texel + ivec2(-x, -y)) * weight;
|
||||
accumulated_weight += weight;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
accumulated_color = safe_divide(accumulated_color, accumulated_weight);
|
||||
|
||||
if (gamma_correct) {
|
||||
accumulated_color = gamma_uncorrect_blur_output(accumulated_color);
|
||||
}
|
||||
|
||||
imageStore(output_img, texel, accumulated_color);
|
||||
}
|
|
@ -82,3 +82,25 @@ GPU_SHADER_CREATE_INFO(compositor_glare_simple_star_anti_diagonal_pass)
|
|||
.image(0, GPU_RGBA16F, Qualifier::READ_WRITE, ImageType::FLOAT_2D, "anti_diagonal_img")
|
||||
.compute_source("compositor_glare_simple_star_anti_diagonal_pass.glsl")
|
||||
.do_static_compilation(true);
|
||||
|
||||
/* -------
|
||||
* Streaks
|
||||
* ------- */
|
||||
|
||||
GPU_SHADER_CREATE_INFO(compositor_glare_streaks_filter)
|
||||
.local_group_size(16, 16)
|
||||
.push_constant(Type::FLOAT, "color_modulator")
|
||||
.push_constant(Type::VEC3, "fade_factors")
|
||||
.push_constant(Type::VEC2, "streak_vector")
|
||||
.sampler(0, ImageType::FLOAT_2D, "input_streak_tx")
|
||||
.image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_streak_img")
|
||||
.compute_source("compositor_glare_streaks_filter.glsl")
|
||||
.do_static_compilation(true);
|
||||
|
||||
GPU_SHADER_CREATE_INFO(compositor_glare_streaks_accumulate)
|
||||
.local_group_size(16, 16)
|
||||
.push_constant(Type::FLOAT, "attenuation_factor")
|
||||
.sampler(0, ImageType::FLOAT_2D, "streak_tx")
|
||||
.image(0, GPU_RGBA16F, Qualifier::READ_WRITE, ImageType::FLOAT_2D, "accumulated_streaks_img")
|
||||
.compute_source("compositor_glare_streaks_accumulate.glsl")
|
||||
.do_static_compilation(true);
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
||||
|
||||
#include "gpu_shader_create_info.hh"
|
||||
|
||||
GPU_SHADER_CREATE_INFO(compositor_symmetric_blur_variable_size)
|
||||
.local_group_size(16, 16)
|
||||
.push_constant(Type::BOOL, "extend_bounds")
|
||||
.push_constant(Type::BOOL, "gamma_correct")
|
||||
.sampler(0, ImageType::FLOAT_2D, "input_tx")
|
||||
.sampler(1, ImageType::FLOAT_2D, "weights_tx")
|
||||
.sampler(2, ImageType::FLOAT_2D, "size_tx")
|
||||
.image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img")
|
||||
.compute_source("compositor_symmetric_blur_variable_size.glsl")
|
||||
.do_static_compilation(true);
|
|
@ -162,7 +162,7 @@ typedef struct DEGObjectIterSettings {
|
|||
} DEGObjectIterSettings;
|
||||
|
||||
/**
|
||||
* Flags to to get objects for draw manager and final render.
|
||||
* Flags to get objects for draw manager and final render.
|
||||
*/
|
||||
#define DEG_OBJECT_ITER_FOR_RENDER_ENGINE_FLAGS \
|
||||
DEG_ITER_OBJECT_FLAG_LINKED_DIRECTLY | DEG_ITER_OBJECT_FLAG_LINKED_VIA_SET | \
|
||||
|
|
|
@ -139,9 +139,9 @@ struct OperationKey {
|
|||
int name_tag = -1;
|
||||
};
|
||||
|
||||
/* Similar to the the OperationKey but does not contain external references, which makes it
|
||||
/* Similar to the #OperationKey but does not contain external references, which makes it
|
||||
* suitable to identify operations even after the original database or graph was destroyed.
|
||||
* The downside of this key over the OperationKey is that it performs string allocation upon
|
||||
* The downside of this key over the #OperationKey is that it performs string allocation upon
|
||||
* the key construction. */
|
||||
struct PersistentOperationKey : public OperationKey {
|
||||
/* Create the key which identifies the given operation node. */
|
||||
|
@ -151,11 +151,11 @@ struct PersistentOperationKey : public OperationKey {
|
|||
const IDNode *id_node = component_node->owner;
|
||||
|
||||
/* Copy names over to our object, so that the key stays valid even after the `operation_node`
|
||||
* is destroyed.*/
|
||||
* is destroyed. */
|
||||
component_name_storage_ = component_node->name;
|
||||
name_storage_ = operation_node->name;
|
||||
|
||||
/* Assign fields used by the OperationKey API. */
|
||||
/* Assign fields used by the #OperationKey API. */
|
||||
id = id_node->id_orig;
|
||||
component_type = component_node->type;
|
||||
component_name = component_name_storage_.c_str();
|
||||
|
|
|
@ -31,7 +31,7 @@ GPU_SHADER_CREATE_INFO(basic_curves)
|
|||
.vertex_source("basic_depth_curves_vert.glsl")
|
||||
.additional_info("draw_hair");
|
||||
|
||||
/* Geometry-shader alterantive paths. */
|
||||
/* Geometry-shader alternative paths. */
|
||||
GPU_SHADER_CREATE_INFO(basic_mesh_conservative_no_geom)
|
||||
.vertex_in(0, Type::VEC3, "pos")
|
||||
.vertex_source("basic_depth_vert_conservative_no_geom.glsl")
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
||||
|
||||
#ifndef GPU_SHADER_EEVEE_LEGACY_DEFINES
|
||||
#define GPU_SHADER_EEVEE_LEGACY_DEFINES
|
||||
|
@ -20,11 +21,11 @@
|
|||
/* Motion Blur. */
|
||||
#define EEVEE_VELOCITY_TILE_SIZE 32
|
||||
|
||||
/* Depth of Field*/
|
||||
/* Depth of Field. */
|
||||
#define DOF_TILE_DIVISOR 16
|
||||
#define DOF_BOKEH_LUT_SIZE 32
|
||||
#define DOF_GATHER_RING_COUNT 5
|
||||
#define DOF_DILATE_RING_COUNT 3
|
||||
#define DOF_FAST_GATHER_COC_ERROR 0.05
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
||||
|
||||
#include "gpu_shader_create_info.hh"
|
||||
|
||||
|
@ -53,4 +54,4 @@ GPU_SHADER_CREATE_INFO(eevee_legacy_bloom_resolve)
|
|||
GPU_SHADER_CREATE_INFO(eevee_legacy_bloom_resolve_hq)
|
||||
.define("HIGH_QUALITY")
|
||||
.additional_info("eevee_legacy_bloom_resolve")
|
||||
.do_static_compilation(true);
|
||||
.do_static_compilation(true);
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
||||
|
||||
#include "gpu_shader_create_info.hh"
|
||||
|
||||
|
@ -199,7 +200,7 @@ GPU_SHADER_CREATE_INFO(eevee_legacy_closure_eval_translucent_lib)
|
|||
.additional_info("eevee_legacy_closure_eval_lib")
|
||||
.additional_info("eevee_legacy_renderpass_lib");
|
||||
|
||||
/* eevee_legacy_closure_eval_surface_lib*/
|
||||
/* eevee_legacy_closure_eval_surface_lib */
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_closure_eval_surface_lib)
|
||||
.additional_info("eevee_legacy_closure_eval_diffuse_lib")
|
||||
.additional_info("eevee_legacy_closure_eval_glossy_lib")
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
||||
|
||||
#include "gpu_shader_create_info.hh"
|
||||
|
||||
/* DOF Lib */
|
||||
|
@ -286,4 +288,4 @@ GPU_SHADER_CREATE_INFO(eevee_legacy_depth_of_field_resolve_HQ_BOKEH)
|
|||
GPU_SHADER_CREATE_INFO(eevee_legacy_depth_of_field_resolve_LQ_BOKEH)
|
||||
.additional_info("eevee_legacy_depth_of_field_resolve_LQ")
|
||||
.additional_info("eevee_legacy_depth_of_field_resolve_bokeh")
|
||||
.do_static_compilation(true);
|
||||
.do_static_compilation(true);
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
||||
|
||||
#include "gpu_shader_create_info.hh"
|
||||
|
||||
/* effect_minmaxz_frag permutation inputs. */
|
||||
|
@ -349,4 +351,4 @@ GPU_SHADER_CREATE_INFO(eevee_legacy_cryptomatte_mesh)
|
|||
.additional_info("eevee_legacy_cryptomatte_common")
|
||||
.additional_info("eevee_legacy_material_surface_vert")
|
||||
.auto_resource_location(true)
|
||||
.do_static_compilation(true);
|
||||
.do_static_compilation(true);
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
||||
|
||||
#include "gpu_shader_create_info.hh"
|
||||
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
||||
|
||||
#include "eevee_legacy_volume_info.hh"
|
||||
#include "gpu_shader_create_info.hh"
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
||||
|
||||
#include "gpu_shader_create_info.hh"
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
||||
|
||||
#include "gpu_shader_create_info.hh"
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue