Compare commits
78 Commits
temp-ghash
...
input_meth
Author | SHA1 | Date | |
---|---|---|---|
![]() |
1254e98a48 | ||
![]() |
151f2467a4 | ||
![]() |
6919ea1726 | ||
![]() |
b64b18f8ac | ||
![]() |
36fc98cb0b | ||
![]() |
36652982dd | ||
![]() |
a54d863a93 | ||
![]() |
cce89d04ee | ||
![]() |
d399927749 | ||
![]() |
80496abbf4 | ||
![]() |
b2a5b96ff4 | ||
![]() |
4fc691f619 | ||
![]() |
316bae9fe8 | ||
![]() |
3e5962656a | ||
![]() |
1087b9236f | ||
![]() |
a677da8638 | ||
![]() |
b5cf3cd415 | ||
![]() |
f65879fd51 | ||
![]() |
ff27b12904 | ||
![]() |
30654e186f | ||
![]() |
60a035c52a | ||
fde03ec578 | |||
0f159b7306 | |||
98beae0c11 | |||
![]() |
b68166355a | ||
2bf7215130 | |||
14502a3557 | |||
e0283f8b6c | |||
fffc35c34a | |||
8299602f1f | |||
3d6b912293 | |||
4a55637a0d | |||
4135458c3d | |||
c3eab0e2f4 | |||
9901eed588 | |||
48b3a09c41 | |||
ea671a6e87 | |||
a36778ab8e | |||
b4337e870e | |||
ed01da08fd | |||
e2855b81a4 | |||
6650436d4a | |||
e2e69f6011 | |||
6147ad3596 | |||
b0ea6aecb3 | |||
a7536dfac5 | |||
d472651713 | |||
808c6e383b | |||
70dee80a8b | |||
77447f0401 | |||
157e6ef22d | |||
78b91eb23f | |||
c6b2422db0 | |||
d6931a6ce6 | |||
d5e0613d6e | |||
6a6336ce77 | |||
e0b960a77e | |||
7bd15aa347 | |||
bbe68ddf7e | |||
339147666a | |||
716642379f | |||
b6192bfa3b | |||
15a212ee06 | |||
d813f70382 | |||
3e5de9dc3f | |||
656b868db9 | |||
aee3d19082 | |||
56d4aed17d | |||
c6acfdf2a0 | |||
![]() |
baccf32076 | ||
![]() |
e42f974ae6 | ||
![]() |
122ad8ac6d | ||
![]() |
f086c5a1ea | ||
![]() |
c4b7440bc0 | ||
![]() |
7d281401fd | ||
![]() |
23c7716bbb | ||
![]() |
98f0333110 | ||
![]() |
7907014ed7 |
390
CMakeLists.txt
390
CMakeLists.txt
@@ -53,9 +53,7 @@ if(NOT (${CMAKE_VERSION} VERSION_LESS 3.0))
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(NOT EXECUTABLE_OUTPUT_PATH)
|
if(NOT EXECUTABLE_OUTPUT_PATH)
|
||||||
set(FIRST_RUN TRUE)
|
set(FIRST_RUN "TRUE")
|
||||||
else()
|
|
||||||
set(FIRST_RUN FALSE)
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# this starts out unset
|
# this starts out unset
|
||||||
@@ -73,6 +71,7 @@ set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS_RELEASE NDEBU
|
|||||||
set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS_MINSIZEREL NDEBUG)
|
set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS_MINSIZEREL NDEBUG)
|
||||||
set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS_RELWITHDEBINFO NDEBUG)
|
set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS_RELWITHDEBINFO NDEBUG)
|
||||||
|
|
||||||
|
|
||||||
#-----------------------------------------------------------------------------
|
#-----------------------------------------------------------------------------
|
||||||
# Set policy
|
# Set policy
|
||||||
|
|
||||||
@@ -130,7 +129,7 @@ macro(option_defaults_init)
|
|||||||
set(${_var} ON)
|
set(${_var} ON)
|
||||||
list(APPEND _init_vars "${_var}")
|
list(APPEND _init_vars "${_var}")
|
||||||
endforeach()
|
endforeach()
|
||||||
unset(_var)
|
unset(_INC)
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|
||||||
# remove from namespace
|
# remove from namespace
|
||||||
@@ -198,10 +197,10 @@ option(WITH_PYTHON "Enable Embedded Python API (only disable for develop
|
|||||||
option(WITH_PYTHON_SECURITY "Disables execution of scripts within blend files by default" ON)
|
option(WITH_PYTHON_SECURITY "Disables execution of scripts within blend files by default" ON)
|
||||||
mark_as_advanced(WITH_PYTHON) # dont want people disabling this unless they really know what they are doing.
|
mark_as_advanced(WITH_PYTHON) # dont want people disabling this unless they really know what they are doing.
|
||||||
mark_as_advanced(WITH_PYTHON_SECURITY) # some distributions see this as a security issue, rather than have them patch it, make a build option.
|
mark_as_advanced(WITH_PYTHON_SECURITY) # some distributions see this as a security issue, rather than have them patch it, make a build option.
|
||||||
|
set(WITH_PYTHON_SECURITY ON CACHE BOOL "ON" FORCE) # temp force on.
|
||||||
|
|
||||||
option(WITH_PYTHON_SAFETY "Enable internal API error checking to track invalid data to prevent crash on access (at the expense of some effeciency, only enable for development)." OFF)
|
option(WITH_PYTHON_SAFETY "Enable internal API error checking to track invalid data to prevent crash on access (at the expense of some effeciency, only enable for development)." OFF)
|
||||||
mark_as_advanced(WITH_PYTHON_SAFETY)
|
option(WITH_PYTHON_MODULE "Enable building as a python module which runs without a user interface, like running regular blender in background mode (experimental, only enable for development)" OFF)
|
||||||
option(WITH_PYTHON_MODULE "Enable building as a python module which runs without a user interface, like running regular blender in background mode (experimental, only enable for development), installs to PYTHON_SITE_PACKAGES (or CMAKE_INSTALL_PREFIX if WITH_INSTALL_PORTABLE is enabled)." OFF)
|
|
||||||
if(APPLE)
|
if(APPLE)
|
||||||
option(WITH_PYTHON_FRAMEWORK "Enable building using the Python available in the framework (OSX only)" OFF)
|
option(WITH_PYTHON_FRAMEWORK "Enable building using the Python available in the framework (OSX only)" OFF)
|
||||||
endif()
|
endif()
|
||||||
@@ -261,10 +260,6 @@ endif()
|
|||||||
# (unix defaults to System OpenJPEG On)
|
# (unix defaults to System OpenJPEG On)
|
||||||
option(WITH_SYSTEM_OPENJPEG "Use the operating systems OpenJPEG library" OFF)
|
option(WITH_SYSTEM_OPENJPEG "Use the operating systems OpenJPEG library" OFF)
|
||||||
|
|
||||||
if(UNIX AND NOT APPLE)
|
|
||||||
option(WITH_SYSTEM_EIGEN3 "Use the systems Eigen3 library" OFF)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
|
|
||||||
# Modifiers
|
# Modifiers
|
||||||
option(WITH_MOD_FLUID "Enable Elbeem Modifier (Fluid Simulation)" ON)
|
option(WITH_MOD_FLUID "Enable Elbeem Modifier (Fluid Simulation)" ON)
|
||||||
@@ -313,9 +308,6 @@ endif()
|
|||||||
# Compression
|
# Compression
|
||||||
option(WITH_LZO "Enable fast LZO compression (used for pointcache)" ON)
|
option(WITH_LZO "Enable fast LZO compression (used for pointcache)" ON)
|
||||||
option(WITH_LZMA "Enable best LZMA compression, (used for pointcache)" ON)
|
option(WITH_LZMA "Enable best LZMA compression, (used for pointcache)" ON)
|
||||||
if(UNIX AND NOT APPLE)
|
|
||||||
option(WITH_SYSTEM_LZO "Use the system LZO library" OFF)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# Camera/motion tracking
|
# Camera/motion tracking
|
||||||
option(WITH_LIBMV "Enable libmv structure from motion library" ON)
|
option(WITH_LIBMV "Enable libmv structure from motion library" ON)
|
||||||
@@ -326,8 +318,8 @@ mark_as_advanced(WITH_LIBMV_SCHUR_SPECIALIZATIONS)
|
|||||||
option(WITH_FREESTYLE "Enable Freestyle (advanced edges rendering)" ON)
|
option(WITH_FREESTYLE "Enable Freestyle (advanced edges rendering)" ON)
|
||||||
|
|
||||||
# Misc
|
# Misc
|
||||||
if(WIN32)
|
if (WIN32)
|
||||||
option(WITH_INPUT_IME "Enable Input Method Editor (IME) for complex Asian character input" ON)
|
option(WITH_INPUT_IME "Enable Input Method Editor (IME)" ON)
|
||||||
endif()
|
endif()
|
||||||
option(WITH_INPUT_NDOF "Enable NDOF input devices (SpaceNavigator and friends)" ${_init_INPUT_NDOF})
|
option(WITH_INPUT_NDOF "Enable NDOF input devices (SpaceNavigator and friends)" ${_init_INPUT_NDOF})
|
||||||
option(WITH_RAYOPTIMIZATION "Enable use of SIMD (SSE) optimizations for the raytracer" ON)
|
option(WITH_RAYOPTIMIZATION "Enable use of SIMD (SSE) optimizations for the raytracer" ON)
|
||||||
@@ -359,7 +351,7 @@ option(WITH_CYCLES_STANDALONE "Build cycles standalone application" OFF)
|
|||||||
option(WITH_CYCLES_STANDALONE_GUI "Build cycles standalone with GUI" OFF)
|
option(WITH_CYCLES_STANDALONE_GUI "Build cycles standalone with GUI" OFF)
|
||||||
option(WITH_CYCLES_OSL "Build Cycles with OSL support" ${_init_CYCLES_OSL})
|
option(WITH_CYCLES_OSL "Build Cycles with OSL support" ${_init_CYCLES_OSL})
|
||||||
option(WITH_CYCLES_CUDA_BINARIES "Build cycles CUDA binaries" OFF)
|
option(WITH_CYCLES_CUDA_BINARIES "Build cycles CUDA binaries" OFF)
|
||||||
set(CYCLES_CUDA_BINARIES_ARCH sm_20 sm_21 sm_30 sm_35 sm_50 sm_52 CACHE STRING "CUDA architectures to build binaries for")
|
set(CYCLES_CUDA_BINARIES_ARCH sm_20 sm_21 sm_30 sm_35 sm_50 CACHE STRING "CUDA architectures to build binaries for")
|
||||||
mark_as_advanced(CYCLES_CUDA_BINARIES_ARCH)
|
mark_as_advanced(CYCLES_CUDA_BINARIES_ARCH)
|
||||||
unset(PLATFORM_DEFAULT)
|
unset(PLATFORM_DEFAULT)
|
||||||
option(WITH_CYCLES_LOGGING "Build cycles with logging support" ON)
|
option(WITH_CYCLES_LOGGING "Build cycles with logging support" ON)
|
||||||
@@ -377,7 +369,7 @@ endif()
|
|||||||
mark_as_advanced(LLVM_STATIC)
|
mark_as_advanced(LLVM_STATIC)
|
||||||
|
|
||||||
# disable for now, but plan to support on all platforms eventually
|
# disable for now, but plan to support on all platforms eventually
|
||||||
option(WITH_MEM_JEMALLOC "Enable malloc replacement (http://www.canonware.com/jemalloc)" ON)
|
option(WITH_MEM_JEMALLOC "Enable malloc replacement (http://www.canonware.com/jemalloc)" OFF)
|
||||||
mark_as_advanced(WITH_MEM_JEMALLOC)
|
mark_as_advanced(WITH_MEM_JEMALLOC)
|
||||||
|
|
||||||
# currently only used for BLI_mempool
|
# currently only used for BLI_mempool
|
||||||
@@ -395,7 +387,6 @@ option(WITH_BOOST "Enable features depending on boost" ON)
|
|||||||
|
|
||||||
# Unit testsing
|
# Unit testsing
|
||||||
option(WITH_GTESTS "Enable GTest unit testing" OFF)
|
option(WITH_GTESTS "Enable GTest unit testing" OFF)
|
||||||
option(WITH_TESTS_PERFORMANCE "Enable performance tests" OFF)
|
|
||||||
|
|
||||||
|
|
||||||
# Documentation
|
# Documentation
|
||||||
@@ -412,7 +403,6 @@ option(WITH_GL_EGL "Use the EGL OpenGL system library instead of th
|
|||||||
option(WITH_GL_PROFILE_COMPAT "Support using the OpenGL 'compatibility' profile. (deprecated)" ON )
|
option(WITH_GL_PROFILE_COMPAT "Support using the OpenGL 'compatibility' profile. (deprecated)" ON )
|
||||||
option(WITH_GL_PROFILE_CORE "Support using the OpenGL 3.2+ 'core' profile." OFF)
|
option(WITH_GL_PROFILE_CORE "Support using the OpenGL 3.2+ 'core' profile." OFF)
|
||||||
option(WITH_GL_PROFILE_ES20 "Support using OpenGL ES 2.0. (thru either EGL or the AGL/WGL/XGL 'es20' profile)" OFF)
|
option(WITH_GL_PROFILE_ES20 "Support using OpenGL ES 2.0. (thru either EGL or the AGL/WGL/XGL 'es20' profile)" OFF)
|
||||||
option(WITH_GPU_DEBUG "Create a debug OpenGL context (allows inserting custom messages and getting notifications for bad GL use)" OFF)
|
|
||||||
|
|
||||||
mark_as_advanced(
|
mark_as_advanced(
|
||||||
WITH_GLEW_MX
|
WITH_GLEW_MX
|
||||||
@@ -421,7 +411,6 @@ mark_as_advanced(
|
|||||||
WITH_GL_PROFILE_COMPAT
|
WITH_GL_PROFILE_COMPAT
|
||||||
WITH_GL_PROFILE_CORE
|
WITH_GL_PROFILE_CORE
|
||||||
WITH_GL_PROFILE_ES20
|
WITH_GL_PROFILE_ES20
|
||||||
WITH_GPU_DEBUG
|
|
||||||
)
|
)
|
||||||
|
|
||||||
if(WITH_GL_PROFILE_COMPAT)
|
if(WITH_GL_PROFILE_COMPAT)
|
||||||
@@ -445,14 +434,6 @@ if(MSVC)
|
|||||||
set(CPACK_INSTALL_PREFIX ${CMAKE_GENERIC_PROGRAM_FILES}/${})
|
set(CPACK_INSTALL_PREFIX ${CMAKE_GENERIC_PROGRAM_FILES}/${})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Experimental support of C++11
|
|
||||||
option(WITH_CPP11 "Build with C++11 standard enabled, for development use only!" OFF)
|
|
||||||
mark_as_advanced(WITH_CPP11)
|
|
||||||
|
|
||||||
# Dependency graph
|
|
||||||
option(WITH_LEGACY_DEPSGRAPH "Build Blender with legacy dependency graph" ON)
|
|
||||||
mark_as_advanced(WITH_LEGACY_DEPSGRAPH)
|
|
||||||
|
|
||||||
# avoid using again
|
# avoid using again
|
||||||
option_defaults_clear()
|
option_defaults_clear()
|
||||||
|
|
||||||
@@ -656,13 +637,6 @@ endif()
|
|||||||
# auto enable openimageio for cycles
|
# auto enable openimageio for cycles
|
||||||
if(WITH_CYCLES)
|
if(WITH_CYCLES)
|
||||||
set(WITH_OPENIMAGEIO ON)
|
set(WITH_OPENIMAGEIO ON)
|
||||||
|
|
||||||
# auto enable llvm for cycles_osl
|
|
||||||
if(WITH_CYCLES_OSL)
|
|
||||||
set(WITH_LLVM ON CACHE BOOL "" FORCE)
|
|
||||||
endif()
|
|
||||||
else()
|
|
||||||
set(WITH_CYCLES_OSL OFF)
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# auto enable openimageio linking dependencies
|
# auto enable openimageio linking dependencies
|
||||||
@@ -671,6 +645,11 @@ if(WITH_OPENIMAGEIO)
|
|||||||
set(WITH_IMAGE_TIFF ON)
|
set(WITH_IMAGE_TIFF ON)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
# auto enable llvm for cycles_osl
|
||||||
|
if(WITH_CYCLES_OSL)
|
||||||
|
set(WITH_LLVM ON CACHE BOOL "" FORCE)
|
||||||
|
endif()
|
||||||
|
|
||||||
# don't store paths to libs for portable distribution
|
# don't store paths to libs for portable distribution
|
||||||
if(WITH_INSTALL_PORTABLE)
|
if(WITH_INSTALL_PORTABLE)
|
||||||
set(CMAKE_SKIP_BUILD_RPATH TRUE)
|
set(CMAKE_SKIP_BUILD_RPATH TRUE)
|
||||||
@@ -681,7 +660,6 @@ if(WITH_GHOST_SDL OR WITH_HEADLESS)
|
|||||||
set(WITH_X11_XINPUT OFF)
|
set(WITH_X11_XINPUT OFF)
|
||||||
set(WITH_X11_XF86VMODE OFF)
|
set(WITH_X11_XF86VMODE OFF)
|
||||||
set(WITH_GHOST_XDND OFF)
|
set(WITH_GHOST_XDND OFF)
|
||||||
set(WITH_INPUT_IME OFF)
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(WITH_CPU_SSE)
|
if(WITH_CPU_SSE)
|
||||||
@@ -816,21 +794,6 @@ if(UNIX AND NOT APPLE)
|
|||||||
find_package_wrapper(ZLIB REQUIRED)
|
find_package_wrapper(ZLIB REQUIRED)
|
||||||
find_package_wrapper(Freetype REQUIRED)
|
find_package_wrapper(Freetype REQUIRED)
|
||||||
|
|
||||||
if(WITH_LZO AND WITH_SYSTEM_LZO)
|
|
||||||
find_package_wrapper(LZO)
|
|
||||||
if(NOT LZO_FOUND)
|
|
||||||
message(FATAL_ERROR "Failed finding system LZO version!")
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(WITH_SYSTEM_EIGEN3)
|
|
||||||
find_package_wrapper(Eigen3)
|
|
||||||
if(NOT EIGEN3_FOUND)
|
|
||||||
message(FATAL_ERROR "Failed finding system Eigen3 version!")
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
# else values are set below for all platforms
|
|
||||||
|
|
||||||
if(WITH_PYTHON)
|
if(WITH_PYTHON)
|
||||||
# No way to set py34. remove for now.
|
# No way to set py34. remove for now.
|
||||||
# find_package(PythonLibs)
|
# find_package(PythonLibs)
|
||||||
@@ -875,21 +838,17 @@ if(UNIX AND NOT APPLE)
|
|||||||
|
|
||||||
if(WITH_SDL)
|
if(WITH_SDL)
|
||||||
if(WITH_SDL_DYNLOAD)
|
if(WITH_SDL_DYNLOAD)
|
||||||
|
set(SDLMAIN_LIBRARY)
|
||||||
set(SDL_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/extern/sdlew/include/SDL2")
|
set(SDL_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/extern/sdlew/include/SDL2")
|
||||||
set(SDL_LIBRARY)
|
set(SDL_LIBRARY)
|
||||||
|
set(SDL_LIBRARY_TEMP)
|
||||||
else()
|
else()
|
||||||
find_package_wrapper(SDL2)
|
find_package_wrapper(SDL)
|
||||||
if(SDL2_FOUND)
|
|
||||||
# Use same names for both versions of SDL until we move to 2.x.
|
|
||||||
set(SDL_INCLUDE_DIR "${SDL2_INCLUDE_DIR}")
|
|
||||||
set(SDL_LIBRARY "${SDL2_LIBRARY}")
|
|
||||||
set(SDL_FOUND "${SDL2_FOUND}")
|
|
||||||
else()
|
|
||||||
find_package_wrapper(SDL)
|
|
||||||
endif()
|
|
||||||
mark_as_advanced(
|
mark_as_advanced(
|
||||||
|
SDLMAIN_LIBRARY
|
||||||
SDL_INCLUDE_DIR
|
SDL_INCLUDE_DIR
|
||||||
SDL_LIBRARY
|
SDL_LIBRARY
|
||||||
|
SDL_LIBRARY_TEMP
|
||||||
)
|
)
|
||||||
# unset(SDLMAIN_LIBRARY CACHE)
|
# unset(SDLMAIN_LIBRARY CACHE)
|
||||||
if(NOT SDL_FOUND)
|
if(NOT SDL_FOUND)
|
||||||
@@ -967,24 +926,6 @@ if(UNIX AND NOT APPLE)
|
|||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(WITH_CYCLES_OSL)
|
|
||||||
set(CYCLES_OSL ${LIBDIR}/osl CACHE PATH "Path to OpenShadingLanguage installation")
|
|
||||||
if(NOT OSL_ROOT)
|
|
||||||
set(OSL_ROOT ${CYCLES_OSL})
|
|
||||||
endif()
|
|
||||||
find_package_wrapper(OpenShadingLanguage)
|
|
||||||
if(OSL_FOUND)
|
|
||||||
if(${OSL_LIBRARY_VERSION_MAJOR} EQUAL "1" AND ${OSL_LIBRARY_VERSION_MINOR} LESS "6")
|
|
||||||
# Note: --whole-archive is needed to force loading of all symbols in liboslexec,
|
|
||||||
# otherwise LLVM is missing the osl_allocate_closure_component function
|
|
||||||
set(OSL_LIBRARIES ${OSL_OSLCOMP_LIBRARY} -Wl,--whole-archive ${OSL_OSLEXEC_LIBRARY} -Wl,--no-whole-archive ${OSL_OSLQUERY_LIBRARY})
|
|
||||||
endif()
|
|
||||||
else()
|
|
||||||
message(STATUS "OSL not found, disabling it from Cycles")
|
|
||||||
set(WITH_CYCLES_OSL OFF)
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(WITH_BOOST)
|
if(WITH_BOOST)
|
||||||
# uses in build instructions to override include and library variables
|
# uses in build instructions to override include and library variables
|
||||||
if(NOT BOOST_CUSTOM)
|
if(NOT BOOST_CUSTOM)
|
||||||
@@ -993,12 +934,6 @@ if(UNIX AND NOT APPLE)
|
|||||||
endif()
|
endif()
|
||||||
set(Boost_USE_MULTITHREADED ON)
|
set(Boost_USE_MULTITHREADED ON)
|
||||||
set(__boost_packages filesystem regex system thread date_time)
|
set(__boost_packages filesystem regex system thread date_time)
|
||||||
if(WITH_CYCLES_OSL)
|
|
||||||
if(NOT (${OSL_LIBRARY_VERSION_MAJOR} EQUAL "1" AND ${OSL_LIBRARY_VERSION_MINOR} LESS "6"))
|
|
||||||
list(APPEND __boost_packages wave)
|
|
||||||
else()
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
if(WITH_INTERNATIONAL)
|
if(WITH_INTERNATIONAL)
|
||||||
list(APPEND __boost_packages locale)
|
list(APPEND __boost_packages locale)
|
||||||
endif()
|
endif()
|
||||||
@@ -1028,12 +963,6 @@ if(UNIX AND NOT APPLE)
|
|||||||
|
|
||||||
if(WITH_OPENIMAGEIO)
|
if(WITH_OPENIMAGEIO)
|
||||||
find_package_wrapper(OpenImageIO)
|
find_package_wrapper(OpenImageIO)
|
||||||
if(NOT OPENIMAGEIO_PUGIXML_FOUND AND WITH_CYCLES_STANDALONE)
|
|
||||||
find_package_wrapper(PugiXML)
|
|
||||||
else()
|
|
||||||
set(PUGIXML_INCLUDE_DIR "${OPENIMAGEIO_INCLUDE_DIR/OpenImageIO}")
|
|
||||||
set(PUGIXML_LIBRARIES "")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
set(OPENIMAGEIO_LIBRARIES ${OPENIMAGEIO_LIBRARIES} ${PNG_LIBRARIES} ${JPEG_LIBRARIES} ${ZLIB_LIBRARIES} ${BOOST_LIBRARIES})
|
set(OPENIMAGEIO_LIBRARIES ${OPENIMAGEIO_LIBRARIES} ${PNG_LIBRARIES} ${JPEG_LIBRARIES} ${ZLIB_LIBRARIES} ${BOOST_LIBRARIES})
|
||||||
set(OPENIMAGEIO_LIBPATH) # TODO, remove and reference the absolute path everywhere
|
set(OPENIMAGEIO_LIBPATH) # TODO, remove and reference the absolute path everywhere
|
||||||
@@ -1065,18 +994,97 @@ if(UNIX AND NOT APPLE)
|
|||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
# XXX Maybe most of this section should go into an llvm module?
|
||||||
if(WITH_LLVM)
|
if(WITH_LLVM)
|
||||||
find_package_wrapper(LLVM)
|
# Set llvm version if not specified
|
||||||
|
if(NOT LLVM_VERSION)
|
||||||
if(NOT LLVM_FOUND)
|
set(LLVM_VERSION "3.0")
|
||||||
set(WITH_LLVM OFF)
|
|
||||||
message(STATUS "LLVM not found")
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(LLVM_DIRECTORY)
|
||||||
|
find_program(LLVM_CONFIG llvm-config-${LLVM_VERSION} HINTS ${LLVM_DIRECTORY}/bin NO_CMAKE_PATH)
|
||||||
|
if(NOT LLVM_CONFIG)
|
||||||
|
find_program(LLVM_CONFIG llvm-config HINTS ${LLVM_DIRECTORY}/bin NO_CMAKE_PATH)
|
||||||
|
endif()
|
||||||
|
else()
|
||||||
|
find_program(LLVM_CONFIG llvm-config-${LLVM_VERSION})
|
||||||
|
if(NOT LLVM_CONFIG)
|
||||||
|
find_program(LLVM_CONFIG llvm-config)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(NOT DEFINED LLVM_VERSION)
|
||||||
|
execute_process(COMMAND ${LLVM_CONFIG} --version
|
||||||
|
OUTPUT_VARIABLE LLVM_VERSION
|
||||||
|
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||||
|
set(LLVM_VERSION ${LLVM_VERSION} CACHE STRING "Version of LLVM to use")
|
||||||
|
endif()
|
||||||
|
if(NOT DEFINED LLVM_DIRECTORY)
|
||||||
|
execute_process(COMMAND ${LLVM_CONFIG} --prefix
|
||||||
|
OUTPUT_VARIABLE LLVM_DIRECTORY
|
||||||
|
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||||
|
set(LLVM_DIRECTORY ${LLVM_DIRECTORY} CACHE PATH "Path to the LLVM installation")
|
||||||
|
endif()
|
||||||
|
if(NOT DEFINED LLVM_LIBPATH)
|
||||||
|
execute_process(COMMAND ${LLVM_CONFIG} --libdir
|
||||||
|
OUTPUT_VARIABLE LLVM_LIBPATH
|
||||||
|
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||||
|
set(LLVM_LIBPATH ${LLVM_LIBPATH} CACHE PATH "Path to the LLVM library path")
|
||||||
|
mark_as_advanced(LLVM_LIBPATH)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(LLVM_STATIC)
|
||||||
|
find_library(LLVM_LIBRARY
|
||||||
|
NAMES LLVMAnalysis # first of a whole bunch of libs to get
|
||||||
|
PATHS ${LLVM_LIBPATH})
|
||||||
|
else()
|
||||||
|
find_library(LLVM_LIBRARY
|
||||||
|
NAMES LLVM-${LLVM_VERSION}
|
||||||
|
PATHS ${LLVM_LIBPATH})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
|
||||||
|
if(LLVM_LIBRARY AND LLVM_DIRECTORY AND LLVM_LIBPATH)
|
||||||
|
if(LLVM_STATIC)
|
||||||
|
# if static LLVM libraries were requested, use llvm-config to generate
|
||||||
|
# the list of what libraries we need, and substitute that in the right
|
||||||
|
# way for LLVM_LIBRARY.
|
||||||
|
execute_process(COMMAND ${LLVM_CONFIG} --libfiles
|
||||||
|
OUTPUT_VARIABLE LLVM_LIBRARY
|
||||||
|
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||||
|
string(REPLACE " " ";" LLVM_LIBRARY "${LLVM_LIBRARY}")
|
||||||
|
endif()
|
||||||
|
else()
|
||||||
|
message(FATAL_ERROR "LLVM not found.")
|
||||||
|
endif()
|
||||||
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(WITH_LLVM OR WITH_SDL_DYNLOAD)
|
if(WITH_LLVM OR WITH_SDL_DYNLOAD)
|
||||||
# Fix for conflict with Mesa llvmpipe
|
# Fix for conflict with Mesa llvmpipe
|
||||||
set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -Wl,--version-script='${CMAKE_SOURCE_DIR}/source/creator/blender.map'")
|
set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -Wl,--version-script=${CMAKE_SOURCE_DIR}/source/creator/blender.map")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(WITH_CYCLES_OSL)
|
||||||
|
set(CYCLES_OSL ${LIBDIR}/osl CACHE PATH "Path to OpenShadingLanguage installation")
|
||||||
|
|
||||||
|
message(STATUS "CYCLES_OSL = ${CYCLES_OSL}")
|
||||||
|
|
||||||
|
find_library(OSL_LIB_EXEC NAMES oslexec PATHS ${CYCLES_OSL}/lib)
|
||||||
|
find_library(OSL_LIB_COMP NAMES oslcomp PATHS ${CYCLES_OSL}/lib)
|
||||||
|
find_library(OSL_LIB_QUERY NAMES oslquery PATHS ${CYCLES_OSL}/lib)
|
||||||
|
# Note: --whole-archive is needed to force loading of all symbols in liboslexec,
|
||||||
|
# otherwise LLVM is missing the osl_allocate_closure_component function
|
||||||
|
list(APPEND OSL_LIBRARIES ${OSL_LIB_COMP} -Wl,--whole-archive ${OSL_LIB_EXEC} -Wl,--no-whole-archive ${OSL_LIB_QUERY})
|
||||||
|
find_path(OSL_INCLUDES OSL/oslclosure.h PATHS ${CYCLES_OSL}/include)
|
||||||
|
find_program(OSL_COMPILER NAMES oslc PATHS ${CYCLES_OSL}/bin)
|
||||||
|
|
||||||
|
if(OSL_INCLUDES AND OSL_LIBRARIES AND OSL_COMPILER)
|
||||||
|
set(OSL_FOUND TRUE)
|
||||||
|
else()
|
||||||
|
message(STATUS "OSL not found")
|
||||||
|
set(WITH_CYCLES_OSL OFF)
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# OpenSuse needs lutil, ArchLinux not, for now keep, can avoid by using --as-needed
|
# OpenSuse needs lutil, ArchLinux not, for now keep, can avoid by using --as-needed
|
||||||
@@ -1084,8 +1092,6 @@ if(UNIX AND NOT APPLE)
|
|||||||
|
|
||||||
find_package(Threads REQUIRED)
|
find_package(Threads REQUIRED)
|
||||||
list(APPEND PLATFORM_LINKLIBS ${CMAKE_THREAD_LIBS_INIT})
|
list(APPEND PLATFORM_LINKLIBS ${CMAKE_THREAD_LIBS_INIT})
|
||||||
# used by other platforms
|
|
||||||
set(PTHREADS_LIBRARIES ${CMAKE_THREAD_LIBS_INIT})
|
|
||||||
|
|
||||||
if(CMAKE_DL_LIBS)
|
if(CMAKE_DL_LIBS)
|
||||||
list(APPEND PLATFORM_LINKLIBS ${CMAKE_DL_LIBS})
|
list(APPEND PLATFORM_LINKLIBS ${CMAKE_DL_LIBS})
|
||||||
@@ -1105,25 +1111,6 @@ if(UNIX AND NOT APPLE)
|
|||||||
# GNU Compiler
|
# GNU Compiler
|
||||||
if(CMAKE_COMPILER_IS_GNUCC)
|
if(CMAKE_COMPILER_IS_GNUCC)
|
||||||
set(PLATFORM_CFLAGS "-pipe -fPIC -funsigned-char -fno-strict-aliasing")
|
set(PLATFORM_CFLAGS "-pipe -fPIC -funsigned-char -fno-strict-aliasing")
|
||||||
|
|
||||||
if(NOT "${CMAKE_C_COMPILER_VERSION}" VERSION_LESS "5.0")
|
|
||||||
# GCC5 uses gnu11, until we update, force c89
|
|
||||||
# though some c11 features can still be used.
|
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu89")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# use ld.gold linker if available, could make optional
|
|
||||||
execute_process(
|
|
||||||
COMMAND ${CMAKE_C_COMPILER} -fuse-ld=gold -Wl,--version
|
|
||||||
ERROR_QUIET OUTPUT_VARIABLE LD_VERSION)
|
|
||||||
if ("${LD_VERSION}" MATCHES "GNU gold")
|
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fuse-ld=gold")
|
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fuse-ld=gold")
|
|
||||||
else ()
|
|
||||||
message(INFO "GNU gold linker isn't available, using the default system linker.")
|
|
||||||
endif ()
|
|
||||||
unset(LD_VERSION)
|
|
||||||
|
|
||||||
# CLang is the same as GCC for now.
|
# CLang is the same as GCC for now.
|
||||||
elseif(CMAKE_C_COMPILER_ID MATCHES "Clang")
|
elseif(CMAKE_C_COMPILER_ID MATCHES "Clang")
|
||||||
set(PLATFORM_CFLAGS "-pipe -fPIC -funsigned-char -fno-strict-aliasing")
|
set(PLATFORM_CFLAGS "-pipe -fPIC -funsigned-char -fno-strict-aliasing")
|
||||||
@@ -1165,11 +1152,7 @@ elseif(WIN32)
|
|||||||
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /SAFESEH:NO")
|
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /SAFESEH:NO")
|
||||||
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} /SAFESEH:NO")
|
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} /SAFESEH:NO")
|
||||||
|
|
||||||
list(APPEND PLATFORM_LINKLIBS ws2_32 vfw32 winmm kernel32 user32 gdi32 comdlg32 advapi32 shfolder shell32 ole32 oleaut32 uuid psapi Dbghelp)
|
list(APPEND PLATFORM_LINKLIBS ws2_32 vfw32 winmm kernel32 user32 gdi32 comdlg32 advapi32 shfolder shell32 ole32 oleaut32 uuid psapi imm32)
|
||||||
|
|
||||||
if(WITH_INPUT_IME)
|
|
||||||
list(APPEND PLATFORM_LINKLIBS imm32)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
add_definitions(
|
add_definitions(
|
||||||
-D_CRT_NONSTDC_NO_DEPRECATE
|
-D_CRT_NONSTDC_NO_DEPRECATE
|
||||||
@@ -1254,8 +1237,8 @@ elseif(WIN32)
|
|||||||
|
|
||||||
find_package(png)
|
find_package(png)
|
||||||
if(NOT PNG_FOUND)
|
if(NOT PNG_FOUND)
|
||||||
message(WARNING "Using HARDCODED libpng locations")
|
|
||||||
set(PNG_PNG_INCLUDE_DIR ${LIBDIR}/png/include)
|
set(PNG_PNG_INCLUDE_DIR ${LIBDIR}/png/include)
|
||||||
|
message(WARNING "Using HARDCODED libpng locations")
|
||||||
set(PNG_LIBRARIES libpng)
|
set(PNG_LIBRARIES libpng)
|
||||||
set(PNG "${LIBDIR}/png")
|
set(PNG "${LIBDIR}/png")
|
||||||
set(PNG_INCLUDE_DIRS "${PNG}/include")
|
set(PNG_INCLUDE_DIRS "${PNG}/include")
|
||||||
@@ -1342,19 +1325,19 @@ elseif(WIN32)
|
|||||||
set(OPENEXR_VERSION "2.1")
|
set(OPENEXR_VERSION "2.1")
|
||||||
find_package(OPENEXR REQUIRED)
|
find_package(OPENEXR REQUIRED)
|
||||||
if(NOT OPENEXR_FOUND)
|
if(NOT OPENEXR_FOUND)
|
||||||
message(WARNING "Using HARDCODED OpenEXR locations")
|
message(WARNING "Using HARDCODED OpenEXR locations")
|
||||||
set(OPENEXR ${LIBDIR}/openexr)
|
set(OPENEXR ${LIBDIR}/openexr)
|
||||||
set(OPENEXR_INCLUDE_DIR ${OPENEXR}/include)
|
set(OPENEXR_INCLUDE_DIR ${OPENEXR}/include)
|
||||||
set(OPENEXR_INCLUDE_DIRS ${OPENEXR}/include/OpenEXR)
|
set(OPENEXR_INCLUDE_DIRS ${OPENEXR}/include/OpenEXR)
|
||||||
set(OPENEXR_LIBPATH ${OPENEXR}/lib)
|
set(OPENEXR_LIBPATH ${OPENEXR}/lib)
|
||||||
set(OPENEXR_LIBRARIES
|
set(OPENEXR_LIBRARIES
|
||||||
${OPENEXR_LIBPATH}/Iex-2_2.lib
|
${OPENEXR_LIBPATH}/Iex-2_1.lib
|
||||||
${OPENEXR_LIBPATH}/Half.lib
|
${OPENEXR_LIBPATH}/Half.lib
|
||||||
${OPENEXR_LIBPATH}/IlmImf-2_2.lib
|
${OPENEXR_LIBPATH}/IlmImf-2_1.lib
|
||||||
${OPENEXR_LIBPATH}/Imath-2_2.lib
|
${OPENEXR_LIBPATH}/Imath-2_1.lib
|
||||||
${OPENEXR_LIBPATH}/IlmThread-2_2.lib
|
${OPENEXR_LIBPATH}/IlmThread-2_1.lib
|
||||||
)
|
)
|
||||||
endif()
|
endif(NOT OPENEXR_FOUND)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(WITH_IMAGE_TIFF)
|
if(WITH_IMAGE_TIFF)
|
||||||
@@ -1394,10 +1377,10 @@ elseif(WIN32)
|
|||||||
if(WITH_BOOST)
|
if(WITH_BOOST)
|
||||||
if(WITH_CYCLES_OSL)
|
if(WITH_CYCLES_OSL)
|
||||||
set(boost_extra_libs wave)
|
set(boost_extra_libs wave)
|
||||||
endif()
|
endif(WITH_CYCLES_OSL)
|
||||||
if(WITH_INTERNATIONAL)
|
if(WITH_INTERNATIONAL)
|
||||||
list(APPEND boost_extra_libs locale)
|
list(APPEND boost_extra_libs locale)
|
||||||
endif()
|
endif(WITH_INTERNATIONAL)
|
||||||
set(Boost_USE_STATIC_RUNTIME ON) # prefix lib
|
set(Boost_USE_STATIC_RUNTIME ON) # prefix lib
|
||||||
set(Boost_USE_MULTITHREADED ON) # suffix -mt
|
set(Boost_USE_MULTITHREADED ON) # suffix -mt
|
||||||
set(Boost_USE_STATIC_LIBS ON) # suffix -s
|
set(Boost_USE_STATIC_LIBS ON) # suffix -s
|
||||||
@@ -1450,21 +1433,20 @@ elseif(WIN32)
|
|||||||
set(OPENIMAGEIO_LIBPATH ${OPENIMAGEIO}/lib)
|
set(OPENIMAGEIO_LIBPATH ${OPENIMAGEIO}/lib)
|
||||||
set(OPENIMAGEIO_DEFINITIONS "-DUSE_TBB=0")
|
set(OPENIMAGEIO_DEFINITIONS "-DUSE_TBB=0")
|
||||||
set(OPENCOLORIO_DEFINITIONS "-DOCIO_STATIC_BUILD")
|
set(OPENCOLORIO_DEFINITIONS "-DOCIO_STATIC_BUILD")
|
||||||
set(OPENIMAGEIO_IDIFF "${OPENIMAGEIO}/bin/idiff.exe")
|
|
||||||
add_definitions(-DOIIO_STATIC_BUILD)
|
add_definitions(-DOIIO_STATIC_BUILD)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(WITH_LLVM)
|
if(WITH_LLVM)
|
||||||
set(LLVM_ROOT_DIR ${LIBDIR}/llvm CACHE PATH "Path to the LLVM installation")
|
set(LLVM_DIRECTORY ${LIBDIR}/llvm CACHE PATH "Path to the LLVM installation")
|
||||||
file(GLOB LLVM_LIBRARY_OPTIMIZED ${LLVM_ROOT_DIR}/lib/*.lib)
|
file(GLOB LLVM_LIBRARY_OPTIMIZED ${LLVM_DIRECTORY}/lib/*.lib)
|
||||||
|
|
||||||
if(EXISTS ${LLVM_ROOT_DIR}/debug/lib)
|
if(EXISTS ${LLVM_DIRECTORY}/debug/lib)
|
||||||
foreach(LLVM_OPTIMIZED_LIB ${LLVM_LIBRARY_OPTIMIZED})
|
foreach(LLVM_OPTIMIZED_LIB ${LLVM_LIBRARY_OPTIMIZED})
|
||||||
get_filename_component(LIBNAME ${LLVM_OPTIMIZED_LIB} ABSOLUTE)
|
get_filename_component(LIBNAME ${LLVM_OPTIMIZED_LIB} ABSOLUTE)
|
||||||
list(APPEND LLVM_LIBS optimized ${LIBNAME})
|
list(APPEND LLVM_LIBS optimized ${LIBNAME})
|
||||||
endforeach(LLVM_OPTIMIZED_LIB)
|
endforeach(LLVM_OPTIMIZED_LIB)
|
||||||
|
|
||||||
file(GLOB LLVM_LIBRARY_DEBUG ${LLVM_ROOT_DIR}/debug/lib/*.lib)
|
file(GLOB LLVM_LIBRARY_DEBUG ${LLVM_DIRECTORY}/debug/lib/*.lib)
|
||||||
|
|
||||||
foreach(LLVM_DEBUG_LIB ${LLVM_LIBRARY_DEBUG})
|
foreach(LLVM_DEBUG_LIB ${LLVM_LIBRARY_DEBUG})
|
||||||
get_filename_component(LIBNAME ${LLVM_DEBUG_LIB} ABSOLUTE)
|
get_filename_component(LIBNAME ${LLVM_DEBUG_LIB} ABSOLUTE)
|
||||||
@@ -1499,13 +1481,6 @@ elseif(WIN32)
|
|||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(WITH_SDL)
|
|
||||||
set(SDL ${LIBDIR}/sdl)
|
|
||||||
set(SDL_INCLUDE_DIR ${SDL}/include)
|
|
||||||
set(SDL_LIBRARY SDL2)
|
|
||||||
set(SDL_LIBPATH ${SDL}/lib)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# used in many places so include globally, like OpenGL
|
# used in many places so include globally, like OpenGL
|
||||||
blender_include_dirs_sys("${PTHREADS_INCLUDE_DIRS}")
|
blender_include_dirs_sys("${PTHREADS_INCLUDE_DIRS}")
|
||||||
|
|
||||||
@@ -1523,12 +1498,7 @@ elseif(WIN32)
|
|||||||
|
|
||||||
if(WITH_MINGW64)
|
if(WITH_MINGW64)
|
||||||
message(STATUS "Compiling for 64 bit with MinGW-w64.")
|
message(STATUS "Compiling for 64 bit with MinGW-w64.")
|
||||||
execute_process(COMMAND ${CMAKE_C_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION)
|
set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/mingw64)
|
||||||
if(GCC_VERSION VERSION_GREATER 4.9 OR GCC_VERSION VERSION_EQUAL 4.9)
|
|
||||||
set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/mingw64_gcc49)
|
|
||||||
else()
|
|
||||||
set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/mingw64)
|
|
||||||
endif()
|
|
||||||
else()
|
else()
|
||||||
message(STATUS "Compiling for 32 bit with MinGW-w32.")
|
message(STATUS "Compiling for 32 bit with MinGW-w32.")
|
||||||
set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/mingw32)
|
set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/mingw32)
|
||||||
@@ -1538,12 +1508,7 @@ elseif(WIN32)
|
|||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
list(APPEND PLATFORM_LINKLIBS -lshell32 -lshfolder -lgdi32 -lmsvcrt -lwinmm -lmingw32 -lm -lws2_32 -lz -lstdc++ -lole32 -luuid -lwsock32 -lpsapi -ldbghelp)
|
list(APPEND PLATFORM_LINKLIBS -lshell32 -lshfolder -lgdi32 -lmsvcrt -lwinmm -lmingw32 -lm -lws2_32 -lz -lstdc++ -lole32 -luuid -lwsock32 -lpsapi -limm32)
|
||||||
|
|
||||||
if(WITH_INPUT_IME)
|
|
||||||
list(APPEND PLATFORM_LINKLIBS -limm32)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
set(PLATFORM_CFLAGS "-pipe -funsigned-char -fno-strict-aliasing")
|
set(PLATFORM_CFLAGS "-pipe -funsigned-char -fno-strict-aliasing")
|
||||||
|
|
||||||
if(WITH_MINGW64)
|
if(WITH_MINGW64)
|
||||||
@@ -1697,12 +1662,11 @@ elseif(WIN32)
|
|||||||
set(OPENIMAGEIO_LIBRARIES OpenImageIO)
|
set(OPENIMAGEIO_LIBRARIES OpenImageIO)
|
||||||
set(OPENIMAGEIO_LIBPATH ${OPENIMAGEIO}/lib)
|
set(OPENIMAGEIO_LIBPATH ${OPENIMAGEIO}/lib)
|
||||||
set(OPENIMAGEIO_DEFINITIONS "")
|
set(OPENIMAGEIO_DEFINITIONS "")
|
||||||
set(OPENIMAGEIO_IDIFF "${OPENIMAGEIO}/bin/idiff.exe")
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(WITH_LLVM)
|
if(WITH_LLVM)
|
||||||
set(LLVM_ROOT_DIR ${LIBDIR}/llvm CACHE PATH "Path to the LLVM installation")
|
set(LLVM_DIRECTORY ${LIBDIR}/llvm CACHE PATH "Path to the LLVM installation")
|
||||||
set(LLVM_LIBPATH ${LLVM_ROOT_DIR}/lib)
|
set(LLVM_LIBPATH ${LLVM_DIRECTORY}/lib)
|
||||||
# Explicitly set llvm lib order.
|
# Explicitly set llvm lib order.
|
||||||
#---- WARNING ON GCC ORDER OF LIBS IS IMPORTANT, DO NOT CHANGE! ---------
|
#---- WARNING ON GCC ORDER OF LIBS IS IMPORTANT, DO NOT CHANGE! ---------
|
||||||
set(LLVM_LIBRARY LLVMSelectionDAG LLVMCodeGen LLVMScalarOpts LLVMAnalysis LLVMArchive
|
set(LLVM_LIBRARY LLVMSelectionDAG LLVMCodeGen LLVMScalarOpts LLVMAnalysis LLVMArchive
|
||||||
@@ -1735,13 +1699,6 @@ elseif(WIN32)
|
|||||||
set(OPENCOLORIO_DEFINITIONS)
|
set(OPENCOLORIO_DEFINITIONS)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(WITH_SDL)
|
|
||||||
set(SDL ${LIBDIR}/sdl)
|
|
||||||
set(SDL_INCLUDE_DIR ${SDL}/include)
|
|
||||||
set(SDL_LIBRARY SDL)
|
|
||||||
set(SDL_LIBPATH ${SDL}/lib)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
set(PLATFORM_LINKFLAGS "-Xlinker --stack=2097152")
|
set(PLATFORM_LINKFLAGS "-Xlinker --stack=2097152")
|
||||||
|
|
||||||
## DISABLE - causes linking errors
|
## DISABLE - causes linking errors
|
||||||
@@ -1773,6 +1730,13 @@ elseif(WIN32)
|
|||||||
set(SNDFILE_LIBPATH ${SNDFILE}/lib) # TODO, deprecate
|
set(SNDFILE_LIBPATH ${SNDFILE}/lib) # TODO, deprecate
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(WITH_SDL)
|
||||||
|
set(SDL ${LIBDIR}/sdl)
|
||||||
|
set(SDL_INCLUDE_DIR ${SDL}/include)
|
||||||
|
set(SDL_LIBRARY SDL2)
|
||||||
|
set(SDL_LIBPATH ${SDL}/lib)
|
||||||
|
endif()
|
||||||
|
|
||||||
if(WITH_RAYOPTIMIZATION AND SUPPORT_SSE_BUILD)
|
if(WITH_RAYOPTIMIZATION AND SUPPORT_SSE_BUILD)
|
||||||
add_definitions(-D__SSE__ -D__MMX__)
|
add_definitions(-D__SSE__ -D__MMX__)
|
||||||
endif()
|
endif()
|
||||||
@@ -1787,10 +1751,10 @@ elseif(WIN32)
|
|||||||
find_library(OSL_LIB_COMP_DEBUG NAMES oslcomp_d PATHS ${CYCLES_OSL}/lib)
|
find_library(OSL_LIB_COMP_DEBUG NAMES oslcomp_d PATHS ${CYCLES_OSL}/lib)
|
||||||
find_library(OSL_LIB_QUERY_DEBUG NAMES oslquery_d PATHS ${CYCLES_OSL}/lib)
|
find_library(OSL_LIB_QUERY_DEBUG NAMES oslquery_d PATHS ${CYCLES_OSL}/lib)
|
||||||
list(APPEND OSL_LIBRARIES optimized ${OSL_LIB_COMP} optimized ${OSL_LIB_EXEC} optimized ${OSL_LIB_QUERY} debug ${OSL_LIB_EXEC_DEBUG} debug ${OSL_LIB_COMP_DEBUG} debug ${OSL_LIB_QUERY_DEBUG})
|
list(APPEND OSL_LIBRARIES optimized ${OSL_LIB_COMP} optimized ${OSL_LIB_EXEC} optimized ${OSL_LIB_QUERY} debug ${OSL_LIB_EXEC_DEBUG} debug ${OSL_LIB_COMP_DEBUG} debug ${OSL_LIB_QUERY_DEBUG})
|
||||||
find_path(OSL_INCLUDE_DIR OSL/oslclosure.h PATHS ${CYCLES_OSL}/include)
|
find_path(OSL_INCLUDES OSL/oslclosure.h PATHS ${CYCLES_OSL}/include)
|
||||||
find_program(OSL_COMPILER NAMES oslc PATHS ${CYCLES_OSL}/bin)
|
find_program(OSL_COMPILER NAMES oslc PATHS ${CYCLES_OSL}/bin)
|
||||||
|
|
||||||
if(OSL_INCLUDE_DIR AND OSL_LIBRARIES AND OSL_COMPILER)
|
if(OSL_INCLUDES AND OSL_LIBRARIES AND OSL_COMPILER)
|
||||||
set(OSL_FOUND TRUE)
|
set(OSL_FOUND TRUE)
|
||||||
else()
|
else()
|
||||||
message(STATUS "OSL not found")
|
message(STATUS "OSL not found")
|
||||||
@@ -1848,14 +1812,14 @@ elseif(APPLE)
|
|||||||
if(NOT WITH_PYTHON_MODULE AND NOT WITH_PYTHON_FRAMEWORK)
|
if(NOT WITH_PYTHON_MODULE AND NOT WITH_PYTHON_FRAMEWORK)
|
||||||
# normally cached but not since we include them with blender
|
# normally cached but not since we include them with blender
|
||||||
set(PYTHON_INCLUDE_DIR "${LIBDIR}/python/include/python${PYTHON_VERSION}m")
|
set(PYTHON_INCLUDE_DIR "${LIBDIR}/python/include/python${PYTHON_VERSION}m")
|
||||||
# set(PYTHON_EXECUTABLE "${LIBDIR}/python/bin/python${PYTHON_VERSION}") # not used yet
|
# set(PYTHON_BINARY "${LIBDIR}/python/bin/python${PYTHON_VERSION}") # not used yet
|
||||||
set(PYTHON_LIBRARY python${PYTHON_VERSION}m)
|
set(PYTHON_LIBRARY python${PYTHON_VERSION}m)
|
||||||
set(PYTHON_LIBPATH "${LIBDIR}/python/lib/python${PYTHON_VERSION}")
|
set(PYTHON_LIBPATH "${LIBDIR}/python/lib/python${PYTHON_VERSION}")
|
||||||
# set(PYTHON_LINKFLAGS "-u _PyMac_Error") # won't build with this enabled
|
# set(PYTHON_LINKFLAGS "-u _PyMac_Error") # won't build with this enabled
|
||||||
else()
|
else()
|
||||||
# module must be compiled against Python framework
|
# module must be compiled against Python framework
|
||||||
set(PYTHON_INCLUDE_DIR "/Library/Frameworks/Python.framework/Versions/${PYTHON_VERSION}/include/python${PYTHON_VERSION}m")
|
set(PYTHON_INCLUDE_DIR "/Library/Frameworks/Python.framework/Versions/${PYTHON_VERSION}/include/python${PYTHON_VERSION}m")
|
||||||
set(PYTHON_EXECUTABLE "/Library/Frameworks/Python.framework/Versions/${PYTHON_VERSION}/bin/python${PYTHON_VERSION}")
|
set(PYTHON_BINARY "/Library/Frameworks/Python.framework/Versions/${PYTHON_VERSION}/bin/python${PYTHON_VERSION}")
|
||||||
#set(PYTHON_LIBRARY python${PYTHON_VERSION})
|
#set(PYTHON_LIBRARY python${PYTHON_VERSION})
|
||||||
set(PYTHON_LIBPATH "/Library/Frameworks/Python.framework/Versions/${PYTHON_VERSION}/lib/python${PYTHON_VERSION}/config-${PYTHON_VERSION}m")
|
set(PYTHON_LIBPATH "/Library/Frameworks/Python.framework/Versions/${PYTHON_VERSION}/lib/python${PYTHON_VERSION}/config-${PYTHON_VERSION}m")
|
||||||
#set(PYTHON_LINKFLAGS "-u _PyMac_Error -framework Python") # won't build with this enabled
|
#set(PYTHON_LINKFLAGS "-u _PyMac_Error -framework Python") # won't build with this enabled
|
||||||
@@ -2026,7 +1990,6 @@ elseif(APPLE)
|
|||||||
set(OPENIMAGEIO_LIBRARIES ${OPENIMAGEIO}/lib/libOpenImageIO.a ${PNG_LIBRARIES} ${JPEG_LIBRARIES} ${TIFF_LIBRARY} ${OPENEXR_LIBRARIES} ${ZLIB_LIBRARIES})
|
set(OPENIMAGEIO_LIBRARIES ${OPENIMAGEIO}/lib/libOpenImageIO.a ${PNG_LIBRARIES} ${JPEG_LIBRARIES} ${TIFF_LIBRARY} ${OPENEXR_LIBRARIES} ${ZLIB_LIBRARIES})
|
||||||
set(OPENIMAGEIO_LIBPATH ${OPENIMAGEIO}/lib ${JPEG_LIBPATH} ${PNG_LIBPATH} ${TIFF_LIBPATH} ${OPENEXR_LIBPATH} ${ZLIB_LIBPATH})
|
set(OPENIMAGEIO_LIBPATH ${OPENIMAGEIO}/lib ${JPEG_LIBPATH} ${PNG_LIBPATH} ${TIFF_LIBPATH} ${OPENEXR_LIBPATH} ${ZLIB_LIBPATH})
|
||||||
set(OPENIMAGEIO_DEFINITIONS "-DOIIO_STATIC_BUILD")
|
set(OPENIMAGEIO_DEFINITIONS "-DOIIO_STATIC_BUILD")
|
||||||
set(OPENIMAGEIO_IDIFF "${LIBDIR}/openimageio/bin/idiff")
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(WITH_OPENCOLORIO)
|
if(WITH_OPENCOLORIO)
|
||||||
@@ -2037,10 +2000,10 @@ elseif(APPLE)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(WITH_LLVM)
|
if(WITH_LLVM)
|
||||||
set(LLVM_ROOT_DIR ${LIBDIR}/llvm CACHE PATH "Path to the LLVM installation")
|
set(LLVM_DIRECTORY ${LIBDIR}/llvm CACHE PATH "Path to the LLVM installation")
|
||||||
set(LLVM_VERSION "3.4" CACHE STRING "Version of LLVM to use")
|
set(LLVM_VERSION "3.4" CACHE STRING "Version of LLVM to use")
|
||||||
if(EXISTS "${LLVM_ROOT_DIR}/bin/llvm-config")
|
if(EXISTS "${LLVM_DIRECTORY}/bin/llvm-config")
|
||||||
set(LLVM_CONFIG "${LLVM_ROOT_DIR}/bin/llvm-config")
|
set(LLVM_CONFIG "${LLVM_DIRECTORY}/bin/llvm-config")
|
||||||
else()
|
else()
|
||||||
set(LLVM_CONFIG llvm-config)
|
set(LLVM_CONFIG llvm-config)
|
||||||
endif()
|
endif()
|
||||||
@@ -2048,7 +2011,7 @@ elseif(APPLE)
|
|||||||
OUTPUT_VARIABLE LLVM_VERSION
|
OUTPUT_VARIABLE LLVM_VERSION
|
||||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||||
execute_process(COMMAND ${LLVM_CONFIG} --prefix
|
execute_process(COMMAND ${LLVM_CONFIG} --prefix
|
||||||
OUTPUT_VARIABLE LLVM_ROOT_DIR
|
OUTPUT_VARIABLE LLVM_DIRECTORY
|
||||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||||
execute_process(COMMAND ${LLVM_CONFIG} --libdir
|
execute_process(COMMAND ${LLVM_CONFIG} --libdir
|
||||||
OUTPUT_VARIABLE LLVM_LIBPATH
|
OUTPUT_VARIABLE LLVM_LIBPATH
|
||||||
@@ -2057,7 +2020,7 @@ elseif(APPLE)
|
|||||||
NAMES LLVMAnalysis # first of a whole bunch of libs to get
|
NAMES LLVMAnalysis # first of a whole bunch of libs to get
|
||||||
PATHS ${LLVM_LIBPATH})
|
PATHS ${LLVM_LIBPATH})
|
||||||
|
|
||||||
if(LLVM_LIBRARY AND LLVM_ROOT_DIR AND LLVM_LIBPATH)
|
if(LLVM_LIBRARY AND LLVM_DIRECTORY AND LLVM_LIBPATH)
|
||||||
if(LLVM_STATIC)
|
if(LLVM_STATIC)
|
||||||
# if static LLVM libraries were requested, use llvm-config to generate
|
# if static LLVM libraries were requested, use llvm-config to generate
|
||||||
# the list of what libraries we need, and substitute that in the right
|
# the list of what libraries we need, and substitute that in the right
|
||||||
@@ -2082,10 +2045,10 @@ elseif(APPLE)
|
|||||||
find_library(OSL_LIB_QUERY NAMES oslquery PATHS ${CYCLES_OSL}/lib)
|
find_library(OSL_LIB_QUERY NAMES oslquery PATHS ${CYCLES_OSL}/lib)
|
||||||
# WARNING! depends on correct order of OSL libs linking
|
# WARNING! depends on correct order of OSL libs linking
|
||||||
list(APPEND OSL_LIBRARIES ${OSL_LIB_COMP} -force_load ${OSL_LIB_EXEC} ${OSL_LIB_QUERY})
|
list(APPEND OSL_LIBRARIES ${OSL_LIB_COMP} -force_load ${OSL_LIB_EXEC} ${OSL_LIB_QUERY})
|
||||||
find_path(OSL_INCLUDE_DIR OSL/oslclosure.h PATHS ${CYCLES_OSL}/include)
|
find_path(OSL_INCLUDES OSL/oslclosure.h PATHS ${CYCLES_OSL}/include)
|
||||||
find_program(OSL_COMPILER NAMES oslc PATHS ${CYCLES_OSL}/bin)
|
find_program(OSL_COMPILER NAMES oslc PATHS ${CYCLES_OSL}/bin)
|
||||||
|
|
||||||
if(OSL_INCLUDE_DIR AND OSL_LIBRARIES AND OSL_COMPILER)
|
if(OSL_INCLUDES AND OSL_LIBRARIES AND OSL_COMPILER)
|
||||||
set(OSL_FOUND TRUE)
|
set(OSL_FOUND TRUE)
|
||||||
else()
|
else()
|
||||||
message(STATUS "OSL not found")
|
message(STATUS "OSL not found")
|
||||||
@@ -2228,9 +2191,6 @@ if(WITH_IMAGE_REDCODE)
|
|||||||
set(REDCODE_INC ${REDCODE})
|
set(REDCODE_INC ${REDCODE})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(NOT WITH_SYSTEM_EIGEN3)
|
|
||||||
set(EIGEN3_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/extern/Eigen3)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
#-----------------------------------------------------------------------------
|
#-----------------------------------------------------------------------------
|
||||||
# Configure OpenGL.
|
# Configure OpenGL.
|
||||||
@@ -2352,10 +2312,6 @@ if(WITH_GL_EGL)
|
|||||||
list(APPEND GL_DEFINITIONS -DWITH_EGL)
|
list(APPEND GL_DEFINITIONS -DWITH_EGL)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(WITH_GPU_DEBUG)
|
|
||||||
list(APPEND GL_DEFINITIONS -DWITH_GPU_DEBUG)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
#-----------------------------------------------------------------------------
|
#-----------------------------------------------------------------------------
|
||||||
# Configure OpenMP.
|
# Configure OpenMP.
|
||||||
if(WITH_OPENMP)
|
if(WITH_OPENMP)
|
||||||
@@ -2492,7 +2448,6 @@ if(CMAKE_COMPILER_IS_GNUCC)
|
|||||||
ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_MISSING_INCLUDE_DIRS -Wmissing-include-dirs)
|
ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_MISSING_INCLUDE_DIRS -Wmissing-include-dirs)
|
||||||
ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_NO_DIV_BY_ZERO -Wno-div-by-zero)
|
ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_NO_DIV_BY_ZERO -Wno-div-by-zero)
|
||||||
ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_TYPE_LIMITS -Wtype-limits)
|
ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_TYPE_LIMITS -Wtype-limits)
|
||||||
ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_FORMAT_SIGN -Wformat-signedness)
|
|
||||||
|
|
||||||
# gcc 4.2 gives annoying warnings on every file with this
|
# gcc 4.2 gives annoying warnings on every file with this
|
||||||
if(NOT "${CMAKE_C_COMPILER_VERSION}" VERSION_LESS "4.3")
|
if(NOT "${CMAKE_C_COMPILER_VERSION}" VERSION_LESS "4.3")
|
||||||
@@ -2520,16 +2475,6 @@ if(CMAKE_COMPILER_IS_GNUCC)
|
|||||||
ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_MISSING_INCLUDE_DIRS -Wmissing-include-dirs)
|
ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_MISSING_INCLUDE_DIRS -Wmissing-include-dirs)
|
||||||
ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_NO_DIV_BY_ZERO -Wno-div-by-zero)
|
ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_NO_DIV_BY_ZERO -Wno-div-by-zero)
|
||||||
ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_TYPE_LIMITS -Wtype-limits)
|
ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_TYPE_LIMITS -Wtype-limits)
|
||||||
ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_ERROR_RETURN_TYPE -Werror=return-type)
|
|
||||||
ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_ERROR_DECLARATION_AFTER_STATEMENT -Werror=declaration-after-statement)
|
|
||||||
ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_ERROR_IMPLICIT_FUNCTION_DECLARATION -Werror=implicit-function-declaration)
|
|
||||||
ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_NO_CHAR_SUBSCRIPTS -Wno-char-subscripts)
|
|
||||||
ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_NO_UNKNOWN_PRAGMAS -Wno-unknown-pragmas)
|
|
||||||
ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_POINTER_ARITH -Wpointer-arith)
|
|
||||||
ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_UNUSED_PARAMETER -Wunused-parameter)
|
|
||||||
ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_WRITE_STRINGS -Wwrite-strings)
|
|
||||||
ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_UNDEF -Wundef)
|
|
||||||
ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_FORMAT_SIGN -Wformat-signedness)
|
|
||||||
|
|
||||||
# gcc 4.2 gives annoying warnings on every file with this
|
# gcc 4.2 gives annoying warnings on every file with this
|
||||||
if(NOT "${CMAKE_C_COMPILER_VERSION}" VERSION_LESS "4.3")
|
if(NOT "${CMAKE_C_COMPILER_VERSION}" VERSION_LESS "4.3")
|
||||||
@@ -2663,16 +2608,6 @@ if(WITH_PYTHON)
|
|||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(WITH_CPP11)
|
|
||||||
if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID MATCHES "Clang")
|
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
|
|
||||||
elseif(MSVC12)
|
|
||||||
# Nothing special is needed, C++11 features are available by default.
|
|
||||||
else()
|
|
||||||
message(FATAL_ERROR "Compiler ${CMAKE_C_COMPILER_ID} is not supported for C++11 build yet")
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# Include warnings first, so its possible to disable them with user defined flags
|
# Include warnings first, so its possible to disable them with user defined flags
|
||||||
# eg: -Wno-uninitialized
|
# eg: -Wno-uninitialized
|
||||||
set(CMAKE_C_FLAGS "${C_WARNINGS} ${CMAKE_C_FLAGS} ${PLATFORM_CFLAGS}")
|
set(CMAKE_C_FLAGS "${C_WARNINGS} ${CMAKE_C_FLAGS} ${PLATFORM_CFLAGS}")
|
||||||
@@ -2685,12 +2620,12 @@ mark_as_advanced(
|
|||||||
OSL_COMPILER
|
OSL_COMPILER
|
||||||
OSL_LIB_COMP
|
OSL_LIB_COMP
|
||||||
OSL_LIB_QUERY
|
OSL_LIB_QUERY
|
||||||
OSL_INCLUDE_DIR
|
OSL_INCLUDES
|
||||||
)
|
)
|
||||||
|
|
||||||
mark_as_advanced(
|
mark_as_advanced(
|
||||||
LLVM_CONFIG
|
LLVM_CONFIG
|
||||||
LLVM_ROOT_DIR
|
LLVM_DIRECTORY
|
||||||
LLVM_LIBRARY
|
LLVM_LIBRARY
|
||||||
LLVM_VERSION
|
LLVM_VERSION
|
||||||
)
|
)
|
||||||
@@ -2762,29 +2697,25 @@ include(build_files/cmake/packaging.cmake)
|
|||||||
# Print Final Configuration
|
# Print Final Configuration
|
||||||
|
|
||||||
if(FIRST_RUN)
|
if(FIRST_RUN)
|
||||||
|
set(_config_msg "\n* Blender Configuration *")
|
||||||
set(_config_msg "\nBlender Configuration\n=====================")
|
macro(info_cfg_option
|
||||||
|
_setting)
|
||||||
function(info_cfg_option
|
set(_msg " * ${_setting}")
|
||||||
_setting
|
|
||||||
)
|
|
||||||
|
|
||||||
set(_msg " - ${_setting}")
|
|
||||||
string(LENGTH "${_msg}" _len)
|
string(LENGTH "${_msg}" _len)
|
||||||
while("32" GREATER "${_len}")
|
while("32" GREATER "${_len}")
|
||||||
set(_msg "${_msg} ")
|
set(_msg "${_msg} ")
|
||||||
math(EXPR _len "${_len} + 1")
|
math(EXPR _len "${_len} + 1")
|
||||||
endwhile()
|
endwhile()
|
||||||
|
|
||||||
set(_config_msg "${_config_msg}\n${_msg}${${_setting}}" PARENT_SCOPE)
|
set(_config_msg "${_config_msg}\n${_msg}${${_setting}}")
|
||||||
endfunction()
|
endmacro()
|
||||||
|
|
||||||
function(info_cfg_text
|
macro(info_cfg_text
|
||||||
_text
|
_text)
|
||||||
)
|
set(_config_msg "${_config_msg}\n\n ${_text}")
|
||||||
|
|
||||||
set(_config_msg "${_config_msg}\n\n ${_text}" PARENT_SCOPE)
|
|
||||||
endfunction()
|
endmacro()
|
||||||
|
|
||||||
message(STATUS "C Compiler: \"${CMAKE_C_COMPILER_ID}\"")
|
message(STATUS "C Compiler: \"${CMAKE_C_COMPILER_ID}\"")
|
||||||
message(STATUS "C++ Compiler: \"${CMAKE_CXX_COMPILER_ID}\"")
|
message(STATUS "C++ Compiler: \"${CMAKE_CXX_COMPILER_ID}\"")
|
||||||
@@ -2863,7 +2794,6 @@ if(FIRST_RUN)
|
|||||||
info_cfg_option(WITH_GL_PROFILE_COMPAT)
|
info_cfg_option(WITH_GL_PROFILE_COMPAT)
|
||||||
info_cfg_option(WITH_GL_PROFILE_CORE)
|
info_cfg_option(WITH_GL_PROFILE_CORE)
|
||||||
info_cfg_option(WITH_GL_PROFILE_ES20)
|
info_cfg_option(WITH_GL_PROFILE_ES20)
|
||||||
info_cfg_option(WITH_GPU_DEBUG)
|
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
info_cfg_option(WITH_GL_ANGLE)
|
info_cfg_option(WITH_GL_ANGLE)
|
||||||
endif()
|
endif()
|
||||||
|
168
GNUmakefile
168
GNUmakefile
@@ -43,11 +43,6 @@ ifndef BUILD_DIR
|
|||||||
BUILD_DIR:=$(shell dirname "$(BLENDER_DIR)")/build_$(OS_NCASE)
|
BUILD_DIR:=$(shell dirname "$(BLENDER_DIR)")/build_$(OS_NCASE)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Allow to use alternative binary (pypy3, etc)
|
|
||||||
ifndef PYTHON
|
|
||||||
PYTHON:=python3
|
|
||||||
endif
|
|
||||||
|
|
||||||
|
|
||||||
# -----------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
# additional targets for the build configuration
|
# additional targets for the build configuration
|
||||||
@@ -70,7 +65,7 @@ ifneq "$(findstring cycles, $(MAKECMDGOALS))" ""
|
|||||||
BUILD_CMAKE_ARGS:=$(BUILD_CMAKE_ARGS) -C"$(BLENDER_DIR)/build_files/cmake/config/cycles_standalone.cmake"
|
BUILD_CMAKE_ARGS:=$(BUILD_CMAKE_ARGS) -C"$(BLENDER_DIR)/build_files/cmake/config/cycles_standalone.cmake"
|
||||||
endif
|
endif
|
||||||
ifneq "$(findstring headless, $(MAKECMDGOALS))" ""
|
ifneq "$(findstring headless, $(MAKECMDGOALS))" ""
|
||||||
BUILD_DIR:=$(BUILD_DIR)_headless
|
BUILD_DIR:=$(BUILD_DIR)_bpy
|
||||||
BUILD_CMAKE_ARGS:=$(BUILD_CMAKE_ARGS) -C"$(BLENDER_DIR)/build_files/cmake/config/blender_headless.cmake"
|
BUILD_CMAKE_ARGS:=$(BUILD_CMAKE_ARGS) -C"$(BLENDER_DIR)/build_files/cmake/config/blender_headless.cmake"
|
||||||
endif
|
endif
|
||||||
ifneq "$(findstring bpy, $(MAKECMDGOALS))" ""
|
ifneq "$(findstring bpy, $(MAKECMDGOALS))" ""
|
||||||
@@ -81,20 +76,18 @@ endif
|
|||||||
|
|
||||||
# -----------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
# Get the number of cores for threaded build
|
# Get the number of cores for threaded build
|
||||||
ifndef NPROCS
|
NPROCS:=1
|
||||||
NPROCS:=1
|
ifeq ($(OS), Linux)
|
||||||
ifeq ($(OS), Linux)
|
NPROCS:=$(shell nproc)
|
||||||
NPROCS:=$(shell nproc)
|
endif
|
||||||
endif
|
ifeq ($(OS), Darwin)
|
||||||
ifeq ($(OS), Darwin)
|
NPROCS:=$(shell sysctl -a | grep "hw.ncpu" | cut -d" " -f3)
|
||||||
NPROCS:=$(shell sysctl -a | grep "hw.ncpu" | cut -d" " -f3)
|
endif
|
||||||
endif
|
ifeq ($(OS), FreeBSD)
|
||||||
ifeq ($(OS), FreeBSD)
|
NPROCS:=$(shell sysctl -a | grep "hw.ncpu" | cut -d" " -f2 )
|
||||||
NPROCS:=$(shell sysctl -a | grep "hw.ncpu" | cut -d" " -f2 )
|
endif
|
||||||
endif
|
ifeq ($(OS), NetBSD)
|
||||||
ifeq ($(OS), NetBSD)
|
NPROCS:=$(shell sysctl -a | grep "hw.ncpu" | cut -d" " -f2 )
|
||||||
NPROCS:=$(shell sysctl -a | grep "hw.ncpu" | cut -d" " -f2 )
|
|
||||||
endif
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
||||||
@@ -120,16 +113,16 @@ endif
|
|||||||
|
|
||||||
# -----------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
# Build Blender
|
# Build Blender
|
||||||
all: FORCE
|
all:
|
||||||
@echo
|
@echo
|
||||||
@echo Configuring Blender ...
|
@echo Configuring Blender ...
|
||||||
|
|
||||||
# # if test ! -f $(BUILD_DIR)/CMakeCache.txt ; then \
|
# if test ! -f $(BUILD_DIR)/CMakeCache.txt ; then \
|
||||||
# # $(CMAKE_CONFIG); \
|
# $(CMAKE_CONFIG); \
|
||||||
# # fi
|
# fi
|
||||||
|
|
||||||
# # do this always incase of failed initial build, could be smarter here...
|
# do this always incase of failed initial build, could be smarter here...
|
||||||
@$(CMAKE_CONFIG)
|
$(CMAKE_CONFIG)
|
||||||
|
|
||||||
@echo
|
@echo
|
||||||
@echo Building Blender ...
|
@echo Building Blender ...
|
||||||
@@ -149,13 +142,13 @@ bpy: all
|
|||||||
|
|
||||||
# -----------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
# Configuration (save some cd'ing around)
|
# Configuration (save some cd'ing around)
|
||||||
config: FORCE
|
config:
|
||||||
$(CMAKE_CONFIG_TOOL) "$(BUILD_DIR)"
|
$(CMAKE_CONFIG_TOOL) "$(BUILD_DIR)"
|
||||||
|
|
||||||
|
|
||||||
# -----------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
# Help for build targets
|
# Help for build targets
|
||||||
help: FORCE
|
help:
|
||||||
@echo ""
|
@echo ""
|
||||||
@echo "Convenience targets provided for building blender, (multiple at once can be used)"
|
@echo "Convenience targets provided for building blender, (multiple at once can be used)"
|
||||||
@echo " * debug - build a debug binary"
|
@echo " * debug - build a debug binary"
|
||||||
@@ -178,7 +171,7 @@ help: FORCE
|
|||||||
@echo ""
|
@echo ""
|
||||||
@echo "Package Targets"
|
@echo "Package Targets"
|
||||||
@echo " * package_debian - build a debian package"
|
@echo " * package_debian - build a debian package"
|
||||||
@echo " * package_pacman - build an arch linux pacman package"
|
@echo " * package_pacman - build an arch linux pacmanpackage"
|
||||||
@echo " * package_archive - build an archive package"
|
@echo " * package_archive - build an archive package"
|
||||||
@echo ""
|
@echo ""
|
||||||
@echo "Testing Targets (not associated with building blender)"
|
@echo "Testing Targets (not associated with building blender)"
|
||||||
@@ -208,12 +201,6 @@ help: FORCE
|
|||||||
@echo " * tgz - create a compressed archive of the source code."
|
@echo " * tgz - create a compressed archive of the source code."
|
||||||
@echo " * update - updates git and all submodules"
|
@echo " * update - updates git and all submodules"
|
||||||
@echo ""
|
@echo ""
|
||||||
@echo "Environment Variables"
|
|
||||||
@echo " * BUILD_CMAKE_ARGS - arguments passed to CMake."
|
|
||||||
@echo " * BUILD_DIR - override default build path."
|
|
||||||
@echo " * PYTHON - use this for the Python command (used for checking tools)."
|
|
||||||
@echo " * NPROCS - number of processes to use building (auto-detect when omitted)."
|
|
||||||
@echo ""
|
|
||||||
@echo "Documentation Targets (not associated with building blender)"
|
@echo "Documentation Targets (not associated with building blender)"
|
||||||
@echo " * doc_py - generate sphinx python api docs"
|
@echo " * doc_py - generate sphinx python api docs"
|
||||||
@echo " * doc_doxy - generate doxygen C/C++ docs"
|
@echo " * doc_doxy - generate doxygen C/C++ docs"
|
||||||
@@ -223,18 +210,17 @@ help: FORCE
|
|||||||
@echo "Information"
|
@echo "Information"
|
||||||
@echo " * help - this help message"
|
@echo " * help - this help message"
|
||||||
@echo " * help_features - show a list of optional features when building"
|
@echo " * help_features - show a list of optional features when building"
|
||||||
@echo ""
|
|
||||||
|
|
||||||
# -----------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
# Packages
|
# Packages
|
||||||
#
|
#
|
||||||
package_debian: FORCE
|
package_debian:
|
||||||
cd build_files/package_spec ; DEB_BUILD_OPTIONS="parallel=$(NPROCS)" sh ./build_debian.sh
|
cd build_files/package_spec ; DEB_BUILD_OPTIONS="parallel=$(NPROCS)" sh ./build_debian.sh
|
||||||
|
|
||||||
package_pacman: FORCE
|
package_pacman:
|
||||||
cd build_files/package_spec/pacman ; MAKEFLAGS="-j$(NPROCS)" makepkg
|
cd build_files/package_spec/pacman ; MAKEFLAGS="-j$(NPROCS)" makepkg --asroot
|
||||||
|
|
||||||
package_archive: FORCE
|
package_archive:
|
||||||
make -C "$(BUILD_DIR)" -s package_archive
|
make -C "$(BUILD_DIR)" -s package_archive
|
||||||
@echo archive in "$(BUILD_DIR)/release"
|
@echo archive in "$(BUILD_DIR)/release"
|
||||||
|
|
||||||
@@ -242,35 +228,35 @@ package_archive: FORCE
|
|||||||
# -----------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
# Tests
|
# Tests
|
||||||
#
|
#
|
||||||
test: FORCE
|
test:
|
||||||
cd $(BUILD_DIR) ; ctest . --output-on-failure
|
cd $(BUILD_DIR) ; ctest . --output-on-failure
|
||||||
|
|
||||||
# run pep8 check check on scripts we distribute.
|
# run pep8 check check on scripts we distribute.
|
||||||
test_pep8: FORCE
|
test_pep8:
|
||||||
$(PYTHON) tests/python/pep8.py > test_pep8.log 2>&1
|
python3 tests/python/pep8.py > test_pep8.log 2>&1
|
||||||
@echo "written: test_pep8.log"
|
@echo "written: test_pep8.log"
|
||||||
|
|
||||||
# run some checks on our cmakefiles.
|
# run some checks on our cmakefiles.
|
||||||
test_cmake: FORCE
|
test_cmake:
|
||||||
$(PYTHON) build_files/cmake/cmake_consistency_check.py > test_cmake_consistency.log 2>&1
|
python3 build_files/cmake/cmake_consistency_check.py > test_cmake_consistency.log 2>&1
|
||||||
@echo "written: test_cmake_consistency.log"
|
@echo "written: test_cmake_consistency.log"
|
||||||
|
|
||||||
# run deprecation tests, see if we have anything to remove.
|
# run deprecation tests, see if we have anything to remove.
|
||||||
test_deprecated: FORCE
|
test_deprecated:
|
||||||
$(PYTHON) tests/check_deprecated.py
|
python3 tests/check_deprecated.py
|
||||||
|
|
||||||
test_style_c: FORCE
|
test_style_c:
|
||||||
# run our own checks on C/C++ style
|
# run our own checks on C/C++ style
|
||||||
PYTHONIOENCODING=utf_8 $(PYTHON) \
|
PYTHONIOENCODING=utf_8 python3 \
|
||||||
"$(BLENDER_DIR)/source/tools/check_source/check_style_c.py" \
|
"$(BLENDER_DIR)/source/tools/check_source/check_style_c.py" \
|
||||||
"$(BLENDER_DIR)/source/blender" \
|
"$(BLENDER_DIR)/source/blender" \
|
||||||
"$(BLENDER_DIR)/source/creator" \
|
"$(BLENDER_DIR)/source/creator" \
|
||||||
--no-length-check
|
--no-length-check
|
||||||
|
|
||||||
test_style_c_qtc: FORCE
|
test_style_c_qtc:
|
||||||
# run our own checks on C/C++ style
|
# run our own checks on C/C++ style
|
||||||
USE_QTC_TASK=1 \
|
USE_QTC_TASK=1 \
|
||||||
PYTHONIOENCODING=utf_8 $(PYTHON) \
|
PYTHONIOENCODING=utf_8 python3 \
|
||||||
"$(BLENDER_DIR)/source/tools/check_source/check_style_c.py" \
|
"$(BLENDER_DIR)/source/tools/check_source/check_style_c.py" \
|
||||||
"$(BLENDER_DIR)/source/blender" \
|
"$(BLENDER_DIR)/source/blender" \
|
||||||
"$(BLENDER_DIR)/source/creator" \
|
"$(BLENDER_DIR)/source/creator" \
|
||||||
@@ -280,18 +266,18 @@ test_style_c_qtc: FORCE
|
|||||||
@echo "written: test_style.tasks"
|
@echo "written: test_style.tasks"
|
||||||
|
|
||||||
|
|
||||||
test_style_osl: FORCE
|
test_style_osl:
|
||||||
# run our own checks on C/C++ style
|
# run our own checks on C/C++ style
|
||||||
PYTHONIOENCODING=utf_8 $(PYTHON) \
|
PYTHONIOENCODING=utf_8 python3 \
|
||||||
"$(BLENDER_DIR)/source/tools/check_source/check_style_c.py" \
|
"$(BLENDER_DIR)/source/tools/check_source/check_style_c.py" \
|
||||||
"$(BLENDER_DIR)/intern/cycles/kernel/shaders" \
|
"$(BLENDER_DIR)/intern/cycles/kernel/shaders" \
|
||||||
"$(BLENDER_DIR)/release/scripts/templates_osl"
|
"$(BLENDER_DIR)/release/scripts/templates_osl"
|
||||||
|
|
||||||
|
|
||||||
test_style_osl_qtc: FORCE
|
test_style_osl_qtc:
|
||||||
# run our own checks on C/C++ style
|
# run our own checks on C/C++ style
|
||||||
USE_QTC_TASK=1 \
|
USE_QTC_TASK=1 \
|
||||||
PYTHONIOENCODING=utf_8 $(PYTHON) \
|
PYTHONIOENCODING=utf_8 python3 \
|
||||||
"$(BLENDER_DIR)/source/tools/check_source/check_style_c.py" \
|
"$(BLENDER_DIR)/source/tools/check_source/check_style_c.py" \
|
||||||
"$(BLENDER_DIR)/intern/cycles/kernel/shaders" \
|
"$(BLENDER_DIR)/intern/cycles/kernel/shaders" \
|
||||||
"$(BLENDER_DIR)/release/scripts/templates_osl" \
|
"$(BLENDER_DIR)/release/scripts/templates_osl" \
|
||||||
@@ -303,13 +289,13 @@ test_style_osl_qtc: FORCE
|
|||||||
# Project Files
|
# Project Files
|
||||||
#
|
#
|
||||||
|
|
||||||
project_qtcreator: FORCE
|
project_qtcreator:
|
||||||
$(PYTHON) build_files/cmake/cmake_qtcreator_project.py "$(BUILD_DIR)"
|
python3 build_files/cmake/cmake_qtcreator_project.py "$(BUILD_DIR)"
|
||||||
|
|
||||||
project_netbeans: FORCE
|
project_netbeans:
|
||||||
$(PYTHON) build_files/cmake/cmake_netbeans_project.py "$(BUILD_DIR)"
|
python3 build_files/cmake/cmake_netbeans_project.py "$(BUILD_DIR)"
|
||||||
|
|
||||||
project_eclipse: FORCE
|
project_eclipse:
|
||||||
cmake -G"Eclipse CDT4 - Unix Makefiles" -H"$(BLENDER_DIR)" -B"$(BUILD_DIR)"
|
cmake -G"Eclipse CDT4 - Unix Makefiles" -H"$(BLENDER_DIR)" -B"$(BUILD_DIR)"
|
||||||
|
|
||||||
|
|
||||||
@@ -317,51 +303,51 @@ project_eclipse: FORCE
|
|||||||
# Static Checking
|
# Static Checking
|
||||||
#
|
#
|
||||||
|
|
||||||
check_cppcheck: FORCE
|
check_cppcheck:
|
||||||
$(CMAKE_CONFIG)
|
$(CMAKE_CONFIG)
|
||||||
cd "$(BUILD_DIR)" ; \
|
cd "$(BUILD_DIR)" ; \
|
||||||
$(PYTHON) "$(BLENDER_DIR)/build_files/cmake/cmake_static_check_cppcheck.py" 2> \
|
python3 "$(BLENDER_DIR)/build_files/cmake/cmake_static_check_cppcheck.py" 2> \
|
||||||
"$(BLENDER_DIR)/check_cppcheck.txt"
|
"$(BLENDER_DIR)/check_cppcheck.txt"
|
||||||
@echo "written: check_cppcheck.txt"
|
@echo "written: check_cppcheck.txt"
|
||||||
|
|
||||||
check_clang_array: FORCE
|
check_clang_array:
|
||||||
$(CMAKE_CONFIG)
|
$(CMAKE_CONFIG)
|
||||||
cd "$(BUILD_DIR)" ; \
|
cd "$(BUILD_DIR)" ; \
|
||||||
$(PYTHON) "$(BLENDER_DIR)/build_files/cmake/cmake_static_check_clang_array.py"
|
python3 "$(BLENDER_DIR)/build_files/cmake/cmake_static_check_clang_array.py"
|
||||||
|
|
||||||
check_splint: FORCE
|
check_splint:
|
||||||
$(CMAKE_CONFIG)
|
$(CMAKE_CONFIG)
|
||||||
cd "$(BUILD_DIR)" ; \
|
cd "$(BUILD_DIR)" ; \
|
||||||
$(PYTHON) "$(BLENDER_DIR)/build_files/cmake/cmake_static_check_splint.py"
|
python3 "$(BLENDER_DIR)/build_files/cmake/cmake_static_check_splint.py"
|
||||||
|
|
||||||
check_sparse: FORCE
|
check_sparse:
|
||||||
$(CMAKE_CONFIG)
|
$(CMAKE_CONFIG)
|
||||||
cd "$(BUILD_DIR)" ; \
|
cd "$(BUILD_DIR)" ; \
|
||||||
$(PYTHON) "$(BLENDER_DIR)/build_files/cmake/cmake_static_check_sparse.py"
|
python3 "$(BLENDER_DIR)/build_files/cmake/cmake_static_check_sparse.py"
|
||||||
|
|
||||||
check_smatch: FORCE
|
check_smatch:
|
||||||
$(CMAKE_CONFIG)
|
$(CMAKE_CONFIG)
|
||||||
cd "$(BUILD_DIR)" ; \
|
cd "$(BUILD_DIR)" ; \
|
||||||
$(PYTHON) "$(BLENDER_DIR)/build_files/cmake/cmake_static_check_smatch.py"
|
python3 "$(BLENDER_DIR)/build_files/cmake/cmake_static_check_smatch.py"
|
||||||
|
|
||||||
check_spelling_py: FORCE
|
check_spelling_py:
|
||||||
cd "$(BUILD_DIR)" ; \
|
cd "$(BUILD_DIR)" ; \
|
||||||
PYTHONIOENCODING=utf_8 $(PYTHON) \
|
PYTHONIOENCODING=utf_8 python3 \
|
||||||
"$(BLENDER_DIR)/source/tools/check_source/check_spelling.py" \
|
"$(BLENDER_DIR)/source/tools/check_source/check_spelling.py" \
|
||||||
"$(BLENDER_DIR)/release/scripts"
|
"$(BLENDER_DIR)/release/scripts"
|
||||||
|
|
||||||
check_spelling_c: FORCE
|
check_spelling_c:
|
||||||
cd "$(BUILD_DIR)" ; \
|
cd "$(BUILD_DIR)" ; \
|
||||||
PYTHONIOENCODING=utf_8 $(PYTHON) \
|
PYTHONIOENCODING=utf_8 python3 \
|
||||||
"$(BLENDER_DIR)/source/tools/check_source/check_spelling.py" \
|
"$(BLENDER_DIR)/source/tools/check_source/check_spelling.py" \
|
||||||
"$(BLENDER_DIR)/source" \
|
"$(BLENDER_DIR)/source" \
|
||||||
"$(BLENDER_DIR)/intern/cycles" \
|
"$(BLENDER_DIR)/intern/cycles" \
|
||||||
"$(BLENDER_DIR)/intern/guardedalloc" \
|
"$(BLENDER_DIR)/intern/guardedalloc" \
|
||||||
"$(BLENDER_DIR)/intern/ghost" \
|
"$(BLENDER_DIR)/intern/ghost" \
|
||||||
|
|
||||||
check_spelling_c_qtc: FORCE
|
check_spelling_c_qtc:
|
||||||
cd "$(BUILD_DIR)" ; USE_QTC_TASK=1 \
|
cd "$(BUILD_DIR)" ; USE_QTC_TASK=1 \
|
||||||
PYTHONIOENCODING=utf_8 $(PYTHON) \
|
PYTHONIOENCODING=utf_8 python3 \
|
||||||
"$(BLENDER_DIR)/source/tools/check_source/check_spelling.py" \
|
"$(BLENDER_DIR)/source/tools/check_source/check_spelling.py" \
|
||||||
"$(BLENDER_DIR)/source" \
|
"$(BLENDER_DIR)/source" \
|
||||||
"$(BLENDER_DIR)/intern/cycles" \
|
"$(BLENDER_DIR)/intern/cycles" \
|
||||||
@@ -370,13 +356,13 @@ check_spelling_c_qtc: FORCE
|
|||||||
> \
|
> \
|
||||||
"$(BLENDER_DIR)/check_spelling_c.tasks"
|
"$(BLENDER_DIR)/check_spelling_c.tasks"
|
||||||
|
|
||||||
check_spelling_osl: FORCE
|
check_spelling_osl:
|
||||||
cd "$(BUILD_DIR)" ;\
|
cd "$(BUILD_DIR)" ;\
|
||||||
PYTHONIOENCODING=utf_8 $(PYTHON) \
|
PYTHONIOENCODING=utf_8 python3 \
|
||||||
"$(BLENDER_DIR)/source/tools/check_source/check_spelling.py" \
|
"$(BLENDER_DIR)/source/tools/check_source/check_spelling.py" \
|
||||||
"$(BLENDER_DIR)/intern/cycles/kernel/shaders"
|
"$(BLENDER_DIR)/intern/cycles/kernel/shaders"
|
||||||
|
|
||||||
check_descriptions: FORCE
|
check_descriptions:
|
||||||
"$(BUILD_DIR)/bin/blender" --background -noaudio --factory-startup --python \
|
"$(BUILD_DIR)/bin/blender" --background -noaudio --factory-startup --python \
|
||||||
"$(BLENDER_DIR)/source/tools/check_source/check_descriptions.py"
|
"$(BLENDER_DIR)/source/tools/check_source/check_descriptions.py"
|
||||||
|
|
||||||
@@ -384,14 +370,14 @@ check_descriptions: FORCE
|
|||||||
# Utilities
|
# Utilities
|
||||||
#
|
#
|
||||||
|
|
||||||
tgz: FORCE
|
tgz:
|
||||||
./build_files/utils/build_tgz.sh
|
./build_files/utils/build_tgz.sh
|
||||||
|
|
||||||
icons: FORCE
|
icons:
|
||||||
"$(BLENDER_DIR)/release/datafiles/blender_icons_update.py"
|
"$(BLENDER_DIR)/release/datafiles/blender_icons_update.py"
|
||||||
"$(BLENDER_DIR)/release/datafiles/prvicons_update.py"
|
"$(BLENDER_DIR)/release/datafiles/prvicons_update.py"
|
||||||
|
|
||||||
update: FORCE
|
update:
|
||||||
if [ -d "../lib" ]; then \
|
if [ -d "../lib" ]; then \
|
||||||
svn update ../lib/* ; \
|
svn update ../lib/* ; \
|
||||||
fi
|
fi
|
||||||
@@ -404,24 +390,24 @@ update: FORCE
|
|||||||
#
|
#
|
||||||
|
|
||||||
# Simple version of ./doc/python_api/sphinx_doc_gen.sh with no PDF generation.
|
# Simple version of ./doc/python_api/sphinx_doc_gen.sh with no PDF generation.
|
||||||
doc_py: FORCE
|
doc_py:
|
||||||
"$(BUILD_DIR)/bin/blender" --background -noaudio --factory-startup --python doc/python_api/sphinx_doc_gen.py
|
"$(BUILD_DIR)/bin/blender" --background -noaudio --factory-startup --python doc/python_api/sphinx_doc_gen.py
|
||||||
cd doc/python_api ; sphinx-build -b html sphinx-in sphinx-out
|
cd doc/python_api ; sphinx-build -b html sphinx-in sphinx-out
|
||||||
@echo "docs written into: '$(BLENDER_DIR)/doc/python_api/sphinx-out/contents.html'"
|
@echo "docs written into: '$(BLENDER_DIR)/doc/python_api/sphinx-out/contents.html'"
|
||||||
|
|
||||||
doc_doxy: FORCE
|
doc_doxy:
|
||||||
cd doc/doxygen; doxygen Doxyfile
|
cd doc/doxygen; doxygen Doxyfile
|
||||||
@echo "docs written into: '$(BLENDER_DIR)/doc/doxygen/html/index.html'"
|
@echo "docs written into: '$(BLENDER_DIR)/doc/doxygen/html/index.html'"
|
||||||
|
|
||||||
doc_dna: FORCE
|
doc_dna:
|
||||||
"$(BUILD_DIR)/bin/blender" --background -noaudio --factory-startup --python doc/blender_file_format/BlendFileDnaExporter_25.py
|
"$(BUILD_DIR)/bin/blender" --background -noaudio --factory-startup --python doc/blender_file_format/BlendFileDnaExporter_25.py
|
||||||
@echo "docs written into: '$(BLENDER_DIR)/doc/blender_file_format/dna.html'"
|
@echo "docs written into: '$(BLENDER_DIR)/doc/blender_file_format/dna.html'"
|
||||||
|
|
||||||
doc_man: FORCE
|
doc_man:
|
||||||
$(PYTHON) doc/manpage/blender.1.py "$(BUILD_DIR)/bin/blender"
|
python3 doc/manpage/blender.1.py "$(BUILD_DIR)/bin/blender"
|
||||||
|
|
||||||
help_features: FORCE
|
help_features:
|
||||||
@$(PYTHON) -c \
|
@python3 -c \
|
||||||
"import re; \
|
"import re; \
|
||||||
print('\n'.join([ \
|
print('\n'.join([ \
|
||||||
w for l in open('"$(BLENDER_DIR)"/CMakeLists.txt', 'r').readlines() \
|
w for l in open('"$(BLENDER_DIR)"/CMakeLists.txt', 'r').readlines() \
|
||||||
@@ -431,9 +417,7 @@ help_features: FORCE
|
|||||||
if w.startswith('WITH_')]))" | uniq
|
if w.startswith('WITH_')]))" | uniq
|
||||||
|
|
||||||
|
|
||||||
clean: FORCE
|
clean:
|
||||||
$(MAKE) -C "$(BUILD_DIR)" clean
|
$(MAKE) -C "$(BUILD_DIR)" clean
|
||||||
|
|
||||||
.PHONY: all
|
.PHONY: all
|
||||||
|
|
||||||
FORCE:
|
|
||||||
|
101
SConstruct
101
SConstruct
@@ -266,7 +266,6 @@ if 'blenderlite' in B.targets:
|
|||||||
target_env_defs['WITH_BF_BOOLEAN'] = False
|
target_env_defs['WITH_BF_BOOLEAN'] = False
|
||||||
target_env_defs['WITH_BF_REMESH'] = False
|
target_env_defs['WITH_BF_REMESH'] = False
|
||||||
target_env_defs['WITH_BF_PYTHON'] = False
|
target_env_defs['WITH_BF_PYTHON'] = False
|
||||||
target_env_defs['WITH_BF_IME'] = False
|
|
||||||
target_env_defs['WITH_BF_3DMOUSE'] = False
|
target_env_defs['WITH_BF_3DMOUSE'] = False
|
||||||
target_env_defs['WITH_BF_LIBMV'] = False
|
target_env_defs['WITH_BF_LIBMV'] = False
|
||||||
target_env_defs['WITH_BF_FREESTYLE'] = False
|
target_env_defs['WITH_BF_FREESTYLE'] = False
|
||||||
@@ -470,14 +469,6 @@ if env['OURPLATFORM']=='darwin':
|
|||||||
################### End Automatic configuration for OSX ##################
|
################### End Automatic configuration for OSX ##################
|
||||||
#############################################################################
|
#############################################################################
|
||||||
|
|
||||||
if env['OURPLATFORM'] == 'linux' and not env['C_COMPILER_ID']:
|
|
||||||
command = ["%s"%env['CC'], "--version"]
|
|
||||||
line = btools.get_command_output(command)
|
|
||||||
if line.startswith('gcc'):
|
|
||||||
env['C_COMPILER_ID'] = 'gcc'
|
|
||||||
elif 'clang' in line[0]:
|
|
||||||
env['C_COMPILER_ID'] = 'clang'
|
|
||||||
|
|
||||||
if env['WITH_BF_OPENMP'] == 1:
|
if env['WITH_BF_OPENMP'] == 1:
|
||||||
if env['OURPLATFORM'] in ('win32-vc', 'win64-vc'):
|
if env['OURPLATFORM'] in ('win32-vc', 'win64-vc'):
|
||||||
env['CCFLAGS'].append('/openmp')
|
env['CCFLAGS'].append('/openmp')
|
||||||
@@ -488,13 +479,6 @@ if env['WITH_BF_OPENMP'] == 1:
|
|||||||
else:
|
else:
|
||||||
env.Append(CCFLAGS=['-fopenmp'])
|
env.Append(CCFLAGS=['-fopenmp'])
|
||||||
|
|
||||||
if env['WITH_BF_CPP11']:
|
|
||||||
if env['OURPLATFORM'] in ('win32-vc', 'win64-vc'):
|
|
||||||
# Nothing special is needed, C++11 features are available by default.
|
|
||||||
pass
|
|
||||||
else:
|
|
||||||
env['CXXFLAGS'].append('-std=c++11')
|
|
||||||
|
|
||||||
#check for additional debug libnames
|
#check for additional debug libnames
|
||||||
|
|
||||||
if env.has_key('BF_DEBUG_LIBS'):
|
if env.has_key('BF_DEBUG_LIBS'):
|
||||||
@@ -766,9 +750,6 @@ if B.targets != ['cudakernels']:
|
|||||||
data_to_c_simple("release/datafiles/preview_cycles.blend")
|
data_to_c_simple("release/datafiles/preview_cycles.blend")
|
||||||
|
|
||||||
# --- glsl ---
|
# --- glsl ---
|
||||||
data_to_c_simple("source/blender/gpu/shaders/gpu_program_smoke_frag.glsl")
|
|
||||||
data_to_c_simple("source/blender/gpu/shaders/gpu_program_smoke_color_frag.glsl")
|
|
||||||
|
|
||||||
data_to_c_simple("source/blender/gpu/shaders/gpu_shader_simple_frag.glsl")
|
data_to_c_simple("source/blender/gpu/shaders/gpu_shader_simple_frag.glsl")
|
||||||
data_to_c_simple("source/blender/gpu/shaders/gpu_shader_simple_vert.glsl")
|
data_to_c_simple("source/blender/gpu/shaders/gpu_shader_simple_vert.glsl")
|
||||||
data_to_c_simple("source/blender/gpu/shaders/gpu_shader_material.glsl")
|
data_to_c_simple("source/blender/gpu/shaders/gpu_shader_material.glsl")
|
||||||
@@ -779,15 +760,6 @@ if B.targets != ['cudakernels']:
|
|||||||
data_to_c_simple("source/blender/gpu/shaders/gpu_shader_vertex_world.glsl")
|
data_to_c_simple("source/blender/gpu/shaders/gpu_shader_vertex_world.glsl")
|
||||||
data_to_c_simple("source/blender/gpu/shaders/gpu_shader_vsm_store_frag.glsl")
|
data_to_c_simple("source/blender/gpu/shaders/gpu_shader_vsm_store_frag.glsl")
|
||||||
data_to_c_simple("source/blender/gpu/shaders/gpu_shader_vsm_store_vert.glsl")
|
data_to_c_simple("source/blender/gpu/shaders/gpu_shader_vsm_store_vert.glsl")
|
||||||
data_to_c_simple("source/blender/gpu/shaders/gpu_shader_fx_ssao_frag.glsl")
|
|
||||||
data_to_c_simple("source/blender/gpu/shaders/gpu_shader_fx_dof_frag.glsl")
|
|
||||||
data_to_c_simple("source/blender/gpu/shaders/gpu_shader_fx_dof_vert.glsl")
|
|
||||||
data_to_c_simple("source/blender/gpu/shaders/gpu_shader_fx_dof_hq_frag.glsl")
|
|
||||||
data_to_c_simple("source/blender/gpu/shaders/gpu_shader_fx_dof_hq_vert.glsl")
|
|
||||||
data_to_c_simple("source/blender/gpu/shaders/gpu_shader_fx_dof_hq_geo.glsl")
|
|
||||||
data_to_c_simple("source/blender/gpu/shaders/gpu_shader_fx_lib.glsl")
|
|
||||||
data_to_c_simple("source/blender/gpu/shaders/gpu_shader_fx_depth_resolve.glsl")
|
|
||||||
data_to_c_simple("source/blender/gpu/shaders/gpu_shader_fx_vert.glsl")
|
|
||||||
data_to_c_simple("intern/opencolorio/gpu_shader_display_transform.glsl")
|
data_to_c_simple("intern/opencolorio/gpu_shader_display_transform.glsl")
|
||||||
|
|
||||||
# --- blender ---
|
# --- blender ---
|
||||||
@@ -882,21 +854,19 @@ B.init_lib_dict()
|
|||||||
|
|
||||||
##### END SETUP ##########
|
##### END SETUP ##########
|
||||||
|
|
||||||
## Auto-configuration run-time tests
|
if B.targets != ['cudakernels']:
|
||||||
|
# Put all auto configuration run-time tests here
|
||||||
|
|
||||||
from FindSharedPtr import FindSharedPtr
|
from FindSharedPtr import FindSharedPtr
|
||||||
from FindUnorderedMap import FindUnorderedMap
|
from FindUnorderedMap import FindUnorderedMap
|
||||||
|
|
||||||
conf = Configure(env)
|
conf = Configure(env)
|
||||||
old_linkflags = conf.env['LINKFLAGS']
|
old_linkflags = conf.env['LINKFLAGS']
|
||||||
conf.env.Append(LINKFLAGS=env['PLATFORM_LINKFLAGS'])
|
conf.env.Append(LINKFLAGS=env['PLATFORM_LINKFLAGS'])
|
||||||
|
FindSharedPtr(conf)
|
||||||
# Put all tests here
|
FindUnorderedMap(conf)
|
||||||
FindSharedPtr(conf)
|
conf.env['LINKFLAGS'] = old_linkflags
|
||||||
FindUnorderedMap(conf)
|
env = conf.Finish()
|
||||||
|
|
||||||
conf.env['LINKFLAGS'] = old_linkflags
|
|
||||||
env = conf.Finish()
|
|
||||||
|
|
||||||
# End of auto configuration
|
# End of auto configuration
|
||||||
|
|
||||||
@@ -1028,20 +998,17 @@ if env['OURPLATFORM']!='darwin':
|
|||||||
dir=os.path.join(env['BF_INSTALLDIR'], VERSION, 'scripts', 'addons','cycles', 'kernel')
|
dir=os.path.join(env['BF_INSTALLDIR'], VERSION, 'scripts', 'addons','cycles', 'kernel')
|
||||||
source=os.listdir('intern/cycles/kernel')
|
source=os.listdir('intern/cycles/kernel')
|
||||||
if '__pycache__' in source: source.remove('__pycache__')
|
if '__pycache__' in source: source.remove('__pycache__')
|
||||||
|
source.remove('kernel.cpp')
|
||||||
source.remove('CMakeLists.txt')
|
source.remove('CMakeLists.txt')
|
||||||
source.remove('SConscript')
|
|
||||||
source.remove('svm')
|
source.remove('svm')
|
||||||
source.remove('closure')
|
source.remove('closure')
|
||||||
source.remove('geom')
|
source.remove('geom')
|
||||||
source.remove('shaders')
|
source.remove('shaders')
|
||||||
source.remove('osl')
|
source.remove('osl')
|
||||||
source.remove('split')
|
|
||||||
source=['intern/cycles/kernel/'+s for s in source]
|
source=['intern/cycles/kernel/'+s for s in source]
|
||||||
source.append('intern/cycles/util/util_atomic.h')
|
|
||||||
source.append('intern/cycles/util/util_color.h')
|
source.append('intern/cycles/util/util_color.h')
|
||||||
source.append('intern/cycles/util/util_half.h')
|
source.append('intern/cycles/util/util_half.h')
|
||||||
source.append('intern/cycles/util/util_math.h')
|
source.append('intern/cycles/util/util_math.h')
|
||||||
source.append('intern/cycles/util/util_math_fast.h')
|
|
||||||
source.append('intern/cycles/util/util_transform.h')
|
source.append('intern/cycles/util/util_transform.h')
|
||||||
source.append('intern/cycles/util/util_types.h')
|
source.append('intern/cycles/util/util_types.h')
|
||||||
scriptinstall.append(env.Install(dir=dir,source=source))
|
scriptinstall.append(env.Install(dir=dir,source=source))
|
||||||
@@ -1063,12 +1030,6 @@ if env['OURPLATFORM']!='darwin':
|
|||||||
if '__pycache__' in source: source.remove('__pycache__')
|
if '__pycache__' in source: source.remove('__pycache__')
|
||||||
source=['intern/cycles/kernel/geom/'+s for s in source]
|
source=['intern/cycles/kernel/geom/'+s for s in source]
|
||||||
scriptinstall.append(env.Install(dir=dir,source=source))
|
scriptinstall.append(env.Install(dir=dir,source=source))
|
||||||
# split
|
|
||||||
dir=os.path.join(env['BF_INSTALLDIR'], VERSION, 'scripts', 'addons','cycles', 'kernel', 'split')
|
|
||||||
source=os.listdir('intern/cycles/kernel/split')
|
|
||||||
if '__pycache__' in source: source.remove('__pycache__')
|
|
||||||
source=['intern/cycles/kernel/split/'+s for s in source]
|
|
||||||
scriptinstall.append(env.Install(dir=dir,source=source))
|
|
||||||
|
|
||||||
# licenses
|
# licenses
|
||||||
dir=os.path.join(env['BF_INSTALLDIR'], VERSION, 'scripts', 'addons','cycles', 'license')
|
dir=os.path.join(env['BF_INSTALLDIR'], VERSION, 'scripts', 'addons','cycles', 'license')
|
||||||
@@ -1198,37 +1159,9 @@ if env['OURPLATFORM']=='linuxcross':
|
|||||||
textlist = []
|
textlist = []
|
||||||
texttargetlist = []
|
texttargetlist = []
|
||||||
for tp, tn, tf in os.walk('release/text'):
|
for tp, tn, tf in os.walk('release/text'):
|
||||||
tf.remove("readme.html")
|
|
||||||
for f in tf:
|
for f in tf:
|
||||||
textlist.append(tp+os.sep+f)
|
textlist.append(tp+os.sep+f)
|
||||||
|
|
||||||
def readme_version_patch():
|
|
||||||
readme_src = "release/text/readme.html"
|
|
||||||
readme_dst = os.path.abspath(os.path.normpath(os.path.join(env['BF_BUILDDIR'], "readme.html")))
|
|
||||||
|
|
||||||
if not os.path.exists(readme_dst) or (os.path.getmtime(readme_dst) < os.path.getmtime(readme_src)):
|
|
||||||
f = open(readme_src, "r")
|
|
||||||
data = f.read()
|
|
||||||
f.close()
|
|
||||||
|
|
||||||
data = data.replace("BLENDER_VERSION", VERSION)
|
|
||||||
f = open(readme_dst, "w")
|
|
||||||
f.write(data)
|
|
||||||
f.close()
|
|
||||||
|
|
||||||
textlist.append(readme_dst)
|
|
||||||
|
|
||||||
readme_version_patch()
|
|
||||||
del readme_version_patch
|
|
||||||
|
|
||||||
|
|
||||||
'''Command(
|
|
||||||
"release/text/readme.html"
|
|
||||||
|
|
||||||
)
|
|
||||||
Command("file.out", "file.in", Copy(env['BF_INSTALLDIR'], "release/text/readme.html"))
|
|
||||||
'''
|
|
||||||
|
|
||||||
# Font licenses
|
# Font licenses
|
||||||
textlist.append('release/datafiles/LICENSE-bfont.ttf.txt')
|
textlist.append('release/datafiles/LICENSE-bfont.ttf.txt')
|
||||||
if env['WITH_BF_INTERNATIONAL']:
|
if env['WITH_BF_INTERNATIONAL']:
|
||||||
@@ -1274,6 +1207,7 @@ if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'win64-vc', 'linuxcross'):
|
|||||||
|
|
||||||
if env['WITH_BF_OPENAL']:
|
if env['WITH_BF_OPENAL']:
|
||||||
dllsources.append('${LCGDIR}/openal/lib/OpenAL32.dll')
|
dllsources.append('${LCGDIR}/openal/lib/OpenAL32.dll')
|
||||||
|
dllsources.append('${LCGDIR}/openal/lib/wrap_oal.dll')
|
||||||
|
|
||||||
if env['WITH_BF_SNDFILE']:
|
if env['WITH_BF_SNDFILE']:
|
||||||
dllsources.append('${LCGDIR}/sndfile/lib/libsndfile-1.dll')
|
dllsources.append('${LCGDIR}/sndfile/lib/libsndfile-1.dll')
|
||||||
@@ -1300,15 +1234,6 @@ if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'win64-vc', 'linuxcross'):
|
|||||||
windlls = env.Install(dir=env['BF_INSTALLDIR'], source = dllsources)
|
windlls = env.Install(dir=env['BF_INSTALLDIR'], source = dllsources)
|
||||||
allinstall += windlls
|
allinstall += windlls
|
||||||
|
|
||||||
# TODO(sergey): For unti we've got better way to deal with python binary
|
|
||||||
if env['WITH_BF_PYTHON']:
|
|
||||||
py_target = os.path.join(env['BF_INSTALLDIR'], VERSION, 'python', 'bin')
|
|
||||||
if env['BF_DEBUG']:
|
|
||||||
allinstall += env.Install(dir=py_target, source = ['${BF_PYTHON_LIBPATH}/${BF_PYTHON_DLL}_d.dll'])
|
|
||||||
else:
|
|
||||||
allinstall += env.Install(dir=py_target, source = ['${BF_PYTHON_LIBPATH}/${BF_PYTHON_DLL}.dll'])
|
|
||||||
|
|
||||||
|
|
||||||
if env['OURPLATFORM'] == 'win64-mingw':
|
if env['OURPLATFORM'] == 'win64-mingw':
|
||||||
dllsources = []
|
dllsources = []
|
||||||
|
|
||||||
|
@@ -209,14 +209,14 @@ OCIO_VERSION_MIN="1.0"
|
|||||||
OCIO_FORCE_REBUILD=false
|
OCIO_FORCE_REBUILD=false
|
||||||
OCIO_SKIP=false
|
OCIO_SKIP=false
|
||||||
|
|
||||||
OPENEXR_VERSION="2.2.0"
|
OPENEXR_VERSION="2.1.0"
|
||||||
OPENEXR_VERSION_MIN="2.0.1"
|
OPENEXR_VERSION_MIN="2.0.1"
|
||||||
ILMBASE_VERSION="2.2.0"
|
ILMBASE_VERSION="2.1.0"
|
||||||
OPENEXR_FORCE_REBUILD=false
|
OPENEXR_FORCE_REBUILD=false
|
||||||
OPENEXR_SKIP=false
|
OPENEXR_SKIP=false
|
||||||
_with_built_openexr=false
|
_with_built_openexr=false
|
||||||
|
|
||||||
OIIO_VERSION="1.4.16"
|
OIIO_VERSION="1.4.11"
|
||||||
OIIO_VERSION_MIN="1.4.0"
|
OIIO_VERSION_MIN="1.4.0"
|
||||||
OIIO_FORCE_REBUILD=false
|
OIIO_FORCE_REBUILD=false
|
||||||
OIIO_SKIP=false
|
OIIO_SKIP=false
|
||||||
@@ -228,7 +228,7 @@ LLVM_FORCE_REBUILD=false
|
|||||||
LLVM_SKIP=false
|
LLVM_SKIP=false
|
||||||
|
|
||||||
# OSL needs to be compiled for now!
|
# OSL needs to be compiled for now!
|
||||||
OSL_VERSION="1.5.11"
|
OSL_VERSION="1.5.0"
|
||||||
OSL_VERSION_MIN=$OSL_VERSION
|
OSL_VERSION_MIN=$OSL_VERSION
|
||||||
OSL_FORCE_REBUILD=false
|
OSL_FORCE_REBUILD=false
|
||||||
OSL_SKIP=false
|
OSL_SKIP=false
|
||||||
@@ -485,32 +485,28 @@ BOOST_SOURCE=( "http://sourceforge.net/projects/boost/files/boost/$BOOST_VERSION
|
|||||||
|
|
||||||
OCIO_SOURCE=( "https://github.com/imageworks/OpenColorIO/tarball/v$OCIO_VERSION" )
|
OCIO_SOURCE=( "https://github.com/imageworks/OpenColorIO/tarball/v$OCIO_VERSION" )
|
||||||
|
|
||||||
OPENEXR_USE_REPO=false
|
#OPENEXR_SOURCE=( "http://download.savannah.nongnu.org/releases/openexr/openexr-$OPENEXR_VERSION.tar.gz" )
|
||||||
OPENEXR_SOURCE=( "http://download.savannah.nongnu.org/releases/openexr/openexr-$OPENEXR_VERSION.tar.gz" )
|
OPENEXR_SOURCE=( "https://github.com/mont29/openexr.git" )
|
||||||
OPENEXR_SOURCE_REPO=( "https://github.com/mont29/openexr.git" )
|
OPENEXR_REPO_UID="2787aa1cf652d244ed45ae124eb1553f6cff11ee"
|
||||||
OPENEXR_SOURCE_REPO_UID="2787aa1cf652d244ed45ae124eb1553f6cff11ee"
|
|
||||||
ILMBASE_SOURCE=( "http://download.savannah.nongnu.org/releases/openexr/ilmbase-$ILMBASE_VERSION.tar.gz" )
|
ILMBASE_SOURCE=( "http://download.savannah.nongnu.org/releases/openexr/ilmbase-$ILMBASE_VERSION.tar.gz" )
|
||||||
|
|
||||||
OIIO_USE_REPO=false
|
#OIIO_SOURCE=( "https://github.com/OpenImageIO/oiio/archive/Release-$OIIO_VERSION.tar.gz" )
|
||||||
OIIO_SOURCE=( "https://github.com/OpenImageIO/oiio/archive/Release-$OIIO_VERSION.tar.gz" )
|
OIIO_SOURCE=( "https://github.com/OpenImageIO/oiio.git" )
|
||||||
OIIO_SOURCE_REPO=( "https://github.com/OpenImageIO/oiio.git" )
|
OIIO_REPO_UID="c9e67275a0b248ead96152f6d2221cc0c0f278a4"
|
||||||
OIIO_SOURCE_REPO_UID="c9e67275a0b248ead96152f6d2221cc0c0f278a4"
|
|
||||||
|
|
||||||
LLVM_SOURCE=( "http://llvm.org/releases/$LLVM_VERSION/llvm-$LLVM_VERSION.src.tar.gz" )
|
LLVM_SOURCE=( "http://llvm.org/releases/$LLVM_VERSION/llvm-$LLVM_VERSION.src.tar.gz" )
|
||||||
LLVM_CLANG_SOURCE=( "http://llvm.org/releases/$LLVM_VERSION/clang-$LLVM_VERSION.src.tar.gz" "http://llvm.org/releases/$LLVM_VERSION/cfe-$LLVM_VERSION.src.tar.gz" )
|
LLVM_CLANG_SOURCE=( "http://llvm.org/releases/$LLVM_VERSION/clang-$LLVM_VERSION.src.tar.gz" "http://llvm.org/releases/$LLVM_VERSION/cfe-$LLVM_VERSION.src.tar.gz" )
|
||||||
OSL_USE_REPO=true
|
#OSL_SOURCE=( "https://github.com/imageworks/OpenShadingLanguage/archive/Release-$OSL_VERSION.tar.gz" )
|
||||||
#~ OSL_SOURCE=( "https://github.com/imageworks/OpenShadingLanguage/archive/Release-$OSL_VERSION.tar.gz" )
|
#OSL_SOURCE=( "https://github.com/imageworks/OpenShadingLanguage.git" )
|
||||||
OSL_SOURCE=( "https://github.com/Nazg-Gul/OpenShadingLanguage/archive/Release-1.5.11.tar.gz" )
|
#OSL_SOURCE=( "https://github.com/mont29/OpenShadingLanguage.git" )
|
||||||
#~ OSL_SOURCE_REPO=( "https://github.com/imageworks/OpenShadingLanguage.git" )
|
#OSL_REPO_UID="85179714e1bc69cd25ecb6bb711c1a156685d395"
|
||||||
#~ OSL_SOURCE_REPO=( "https://github.com/mont29/OpenShadingLanguage.git" )
|
#OSL_REPO_BRANCH="master"
|
||||||
#~ OSL_SOURCE_REPO_UID="85179714e1bc69cd25ecb6bb711c1a156685d395"
|
OSL_SOURCE=( "https://github.com/Nazg-Gul/OpenShadingLanguage.git" )
|
||||||
#~ OSL_SOURCE_REPO_BRANCH="master"
|
OSL_REPO_UID="22ee5ea298fd215430dfbd160b5aefd507f06db0"
|
||||||
OSL_SOURCE_REPO=( "https://github.com/Nazg-Gul/OpenShadingLanguage.git" )
|
OSL_REPO_BRANCH="blender-fixes"
|
||||||
OSL_SOURCE_REPO_UID="22ee5ea298fd215430dfbd160b5aefd507f06db0"
|
|
||||||
OSL_SOURCE_REPO_BRANCH="blender-fixes"
|
|
||||||
|
|
||||||
OPENCOLLADA_SOURCE=( "https://github.com/KhronosGroup/OpenCOLLADA.git" )
|
OPENCOLLADA_SOURCE=( "https://github.com/KhronosGroup/OpenCOLLADA.git" )
|
||||||
OPENCOLLADA_REPO_UID="3335ac164e68b2512a40914b14c74db260e6ff7d"
|
OPENCOLLADA_REPO_UID="18da7f4109a8eafaa290a33f5550501cc4c8bae8"
|
||||||
FFMPEG_SOURCE=( "http://ffmpeg.org/releases/ffmpeg-$FFMPEG_VERSION.tar.bz2" )
|
FFMPEG_SOURCE=( "http://ffmpeg.org/releases/ffmpeg-$FFMPEG_VERSION.tar.bz2" )
|
||||||
|
|
||||||
|
|
||||||
@@ -983,7 +979,7 @@ clean_ILMBASE() {
|
|||||||
|
|
||||||
compile_ILMBASE() {
|
compile_ILMBASE() {
|
||||||
# To be changed each time we make edits that would modify the compiled result!
|
# To be changed each time we make edits that would modify the compiled result!
|
||||||
ilmbase_magic=10
|
ilmbase_magic=9
|
||||||
_init_ilmbase
|
_init_ilmbase
|
||||||
|
|
||||||
# Clean install if needed!
|
# Clean install if needed!
|
||||||
@@ -1007,7 +1003,8 @@ compile_ILMBASE() {
|
|||||||
download ILMBASE_SOURCE[@] $_src.tar.gz
|
download ILMBASE_SOURCE[@] $_src.tar.gz
|
||||||
|
|
||||||
INFO "Unpacking ILMBase-$ILMBASE_VERSION"
|
INFO "Unpacking ILMBase-$ILMBASE_VERSION"
|
||||||
tar -C $SRC --transform "s,(.*/?)ilmbase-[^/]*(.*),\1ILMBase-$ILMBASE_VERSION\2,x" -xf $_src.tar.gz
|
tar -C $SRC --transform "s,(.*/?)ilmbase-[^/]*(.*),\1ILMBase-$ILMBASE_VERSION\2,x" \
|
||||||
|
-xf $_src.tar.gz
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -1023,7 +1020,6 @@ compile_ILMBASE() {
|
|||||||
cmake_d="$cmake_d -D CMAKE_PREFIX_PATH=$_inst"
|
cmake_d="$cmake_d -D CMAKE_PREFIX_PATH=$_inst"
|
||||||
cmake_d="$cmake_d -D CMAKE_INSTALL_PREFIX=$_inst"
|
cmake_d="$cmake_d -D CMAKE_INSTALL_PREFIX=$_inst"
|
||||||
cmake_d="$cmake_d -D BUILD_SHARED_LIBS=ON"
|
cmake_d="$cmake_d -D BUILD_SHARED_LIBS=ON"
|
||||||
cmake_d="$cmake_d -D NAMESPACE_VERSIONING=OFF" # VERY IMPORTANT!!!
|
|
||||||
|
|
||||||
if file /bin/cp | grep -q '32-bit'; then
|
if file /bin/cp | grep -q '32-bit'; then
|
||||||
cflags="-fPIC -m32 -march=i686"
|
cflags="-fPIC -m32 -march=i686"
|
||||||
@@ -1096,28 +1092,24 @@ compile_OPENEXR() {
|
|||||||
INFO "Downloading OpenEXR-$OPENEXR_VERSION"
|
INFO "Downloading OpenEXR-$OPENEXR_VERSION"
|
||||||
mkdir -p $SRC
|
mkdir -p $SRC
|
||||||
|
|
||||||
if [ $OPENEXR_USE_REPO == true ]; then
|
# download OPENEXR_SOURCE[@] $_src.tar.gz
|
||||||
git clone ${OPENEXR_SOURCE_REPO[0]} $_src
|
|
||||||
else
|
# INFO "Unpacking OpenEXR-$OPENEXR_VERSION"
|
||||||
download OPENEXR_SOURCE[@] $_src.tar.gz
|
# tar -C $SRC --transform "s,(.*/?)openexr[^/]*(.*),\1OpenEXR-$OPENEXR_VERSION\2,x" \
|
||||||
INFO "Unpacking OpenEXR-$OPENEXR_VERSION"
|
# -xf $_src.tar.gz
|
||||||
tar -C $SRC --transform "s,(.*/?)openexr[^/]*(.*),\1OpenEXR-$OPENEXR_VERSION\2,x" -xf $_src.tar.gz
|
|
||||||
fi
|
git clone ${OPENEXR_SOURCE[0]} $_src
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cd $_src
|
cd $_src
|
||||||
|
|
||||||
if [ $OPENEXR_USE_REPO == true ]; then
|
# XXX For now, always update from latest repo...
|
||||||
# XXX For now, always update from latest repo...
|
git pull origin master
|
||||||
git pull origin master
|
|
||||||
# Stick to same rev as windows' libs...
|
# Stick to same rev as windows' libs...
|
||||||
git checkout $OPENEXR_SOURCE_REPO_UID
|
git checkout $OPENEXR_REPO_UID
|
||||||
git reset --hard
|
git reset --hard
|
||||||
oiio_src_path="../OpenEXR"
|
|
||||||
else
|
|
||||||
oiio_src_path=".."
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Always refresh the whole build!
|
# Always refresh the whole build!
|
||||||
if [ -d build ]; then
|
if [ -d build ]; then
|
||||||
@@ -1131,7 +1123,6 @@ compile_OPENEXR() {
|
|||||||
cmake_d="$cmake_d -D CMAKE_INSTALL_PREFIX=$_inst"
|
cmake_d="$cmake_d -D CMAKE_INSTALL_PREFIX=$_inst"
|
||||||
cmake_d="$cmake_d -D ILMBASE_PACKAGE_PREFIX=$_ilmbase_inst"
|
cmake_d="$cmake_d -D ILMBASE_PACKAGE_PREFIX=$_ilmbase_inst"
|
||||||
cmake_d="$cmake_d -D BUILD_SHARED_LIBS=ON"
|
cmake_d="$cmake_d -D BUILD_SHARED_LIBS=ON"
|
||||||
cmake_d="$cmake_d -D NAMESPACE_VERSIONING=OFF" # VERY IMPORTANT!!!
|
|
||||||
|
|
||||||
if file /bin/cp | grep -q '32-bit'; then
|
if file /bin/cp | grep -q '32-bit'; then
|
||||||
cflags="-fPIC -m32 -march=i686"
|
cflags="-fPIC -m32 -march=i686"
|
||||||
@@ -1139,7 +1130,7 @@ compile_OPENEXR() {
|
|||||||
cflags="-fPIC"
|
cflags="-fPIC"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cmake $cmake_d -D CMAKE_CXX_FLAGS="$cflags" -D CMAKE_EXE_LINKER_FLAGS="-lgcc_s -lgcc" $oiio_src_path
|
cmake $cmake_d -D CMAKE_CXX_FLAGS="$cflags" -D CMAKE_EXE_LINKER_FLAGS="-lgcc_s -lgcc" ../OpenEXR
|
||||||
|
|
||||||
make -j$THREADS && make install
|
make -j$THREADS && make install
|
||||||
|
|
||||||
@@ -1203,25 +1194,24 @@ compile_OIIO() {
|
|||||||
|
|
||||||
if [ ! -d $_src ]; then
|
if [ ! -d $_src ]; then
|
||||||
mkdir -p $SRC
|
mkdir -p $SRC
|
||||||
|
#download OIIO_SOURCE[@] "$_src.tar.gz"
|
||||||
|
#
|
||||||
|
#INFO "Unpacking OpenImageIO-$OIIO_VERSION"
|
||||||
|
#tar -C $SRC --transform "s,(.*/?)oiio-Release-[^/]*(.*),\1OpenImageIO-$OIIO_VERSION\2,x" \
|
||||||
|
#-xf $_src.tar.gz
|
||||||
|
|
||||||
|
git clone ${OIIO_SOURCE[0]} $_src
|
||||||
|
|
||||||
if [ $OIIO_USE_REPO == true ]; then
|
|
||||||
git clone ${OIIO_SOURCE_REPO[0]} $_src
|
|
||||||
else
|
|
||||||
download OIIO_SOURCE[@] "$_src.tar.gz"
|
|
||||||
INFO "Unpacking OpenImageIO-$OIIO_VERSION"
|
|
||||||
tar -C $SRC --transform "s,(.*/?)oiio-Release-[^/]*(.*),\1OpenImageIO-$OIIO_VERSION\2,x" -xf $_src.tar.gz
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cd $_src
|
cd $_src
|
||||||
|
|
||||||
if [ $OIIO_USE_REPO == true ]; then
|
# XXX For now, always update from latest repo...
|
||||||
# XXX For now, always update from latest repo...
|
git pull origin master
|
||||||
git pull origin master
|
|
||||||
# Stick to same rev as windows' libs...
|
# Stick to same rev as windows' libs...
|
||||||
git checkout $OIIO_SOURCE_REPO_UID
|
git checkout $OIIO_REPO_UID
|
||||||
git reset --hard
|
git reset --hard
|
||||||
fi
|
|
||||||
|
|
||||||
# Always refresh the whole build!
|
# Always refresh the whole build!
|
||||||
if [ -d build ]; then
|
if [ -d build ]; then
|
||||||
@@ -1243,7 +1233,6 @@ compile_OIIO() {
|
|||||||
if [ $_with_built_openexr == true ]; then
|
if [ $_with_built_openexr == true ]; then
|
||||||
cmake_d="$cmake_d -D ILMBASE_HOME=$INST/openexr"
|
cmake_d="$cmake_d -D ILMBASE_HOME=$INST/openexr"
|
||||||
cmake_d="$cmake_d -D OPENEXR_HOME=$INST/openexr"
|
cmake_d="$cmake_d -D OPENEXR_HOME=$INST/openexr"
|
||||||
INFO "ILMBASE_HOME=$INST/openexr"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Optional tests and cmd tools
|
# Optional tests and cmd tools
|
||||||
@@ -1374,7 +1363,7 @@ EOF
|
|||||||
cmake_d="$cmake_d -D CMAKE_INSTALL_PREFIX=$_inst"
|
cmake_d="$cmake_d -D CMAKE_INSTALL_PREFIX=$_inst"
|
||||||
cmake_d="$cmake_d -D LLVM_ENABLE_FFI=ON"
|
cmake_d="$cmake_d -D LLVM_ENABLE_FFI=ON"
|
||||||
cmake_d="$cmake_d -D LLVM_TARGETS_TO_BUILD=X86"
|
cmake_d="$cmake_d -D LLVM_TARGETS_TO_BUILD=X86"
|
||||||
cmake_d="$cmake_d -D LLVM_ENABLE_TERMINFO=OFF"
|
cmake_d="$cmake_d -D -DLLVM_ENABLE_TERMINFO=OFF"
|
||||||
|
|
||||||
if [ -d $_FFI_INCLUDE_DIR ]; then
|
if [ -d $_FFI_INCLUDE_DIR ]; then
|
||||||
cmake_d="$cmake_d -D FFI_INCLUDE_DIR=$_FFI_INCLUDE_DIR"
|
cmake_d="$cmake_d -D FFI_INCLUDE_DIR=$_FFI_INCLUDE_DIR"
|
||||||
@@ -1420,15 +1409,15 @@ clean_OSL() {
|
|||||||
|
|
||||||
compile_OSL() {
|
compile_OSL() {
|
||||||
# To be changed each time we make edits that would modify the compiled result!
|
# To be changed each time we make edits that would modify the compiled result!
|
||||||
osl_magic=17
|
osl_magic=16
|
||||||
_init_osl
|
_init_osl
|
||||||
|
|
||||||
# Clean install if needed!
|
# Clean install if needed!
|
||||||
magic_compile_check osl-$OSL_VERSION $osl_magic
|
magic_compile_check osl-$OSL_VERSION $osl_magic
|
||||||
#~ if [ $? -eq 1 -o $OSL_FORCE_REBUILD == true ]; then
|
if [ $? -eq 1 -o $OSL_FORCE_REBUILD == true ]; then
|
||||||
#~ rm -Rf $_src # XXX Radical, but not easy to change remote repo fully automatically
|
rm -Rf $_src # XXX Radical, but not easy to change remote repo fully automatically
|
||||||
#~ clean_OSL
|
clean_OSL
|
||||||
#~ fi
|
fi
|
||||||
|
|
||||||
if [ ! -d $_inst ]; then
|
if [ ! -d $_inst ]; then
|
||||||
INFO "Building OpenShadingLanguage-$OSL_VERSION"
|
INFO "Building OpenShadingLanguage-$OSL_VERSION"
|
||||||
@@ -1438,26 +1427,26 @@ compile_OSL() {
|
|||||||
if [ ! -d $_src ]; then
|
if [ ! -d $_src ]; then
|
||||||
mkdir -p $SRC
|
mkdir -p $SRC
|
||||||
|
|
||||||
if [ $OSL_USE_REPO == true ]; then
|
#download OSL_SOURCE[@] "$_src.tar.gz"
|
||||||
git clone ${OSL_SOURCE_REPO[0]} $_src
|
|
||||||
else
|
#INFO "Unpacking OpenShadingLanguage-$OSL_VERSION"
|
||||||
download OSL_SOURCE[@] "$_src.tar.gz"
|
#tar -C $SRC --transform "s,(.*/?)OpenShadingLanguage-[^/]*(.*),\1OpenShadingLanguage-$OSL_VERSION\2,x" \
|
||||||
INFO "Unpacking OpenShadingLanguage-$OSL_VERSION"
|
#-xf $_src.tar.gz
|
||||||
tar -C $SRC --transform "s,(.*/?)OpenShadingLanguage-[^/]*(.*),\1OpenShadingLanguage-$OSL_VERSION\2,x" \
|
|
||||||
-xf $_src.tar.gz
|
git clone ${OSL_SOURCE[0]} $_src
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cd $_src
|
cd $_src
|
||||||
|
|
||||||
if [ $OSL_USE_REPO == true ]; then
|
git remote set-url origin ${OSL_SOURCE[0]}
|
||||||
git remote set-url origin ${OSL_SOURCE_REPO[0]}
|
|
||||||
# XXX For now, always update from latest repo...
|
# XXX For now, always update from latest repo...
|
||||||
git pull --no-edit -X theirs origin $OSL_SOURCE_REPO_BRANCH
|
git pull --no-edit -X theirs origin $OSL_GIT_BRANCH
|
||||||
# Stick to same rev as windows' libs...
|
|
||||||
git checkout $OSL_SOURCE_REPO_UID
|
# Stick to same rev as windows' libs...
|
||||||
git reset --hard
|
git checkout $OSL_REPO_UID
|
||||||
fi
|
git reset --hard
|
||||||
|
|
||||||
# Always refresh the whole build!
|
# Always refresh the whole build!
|
||||||
if [ -d build ]; then
|
if [ -d build ]; then
|
||||||
@@ -1472,14 +1461,11 @@ compile_OSL() {
|
|||||||
cmake_d="$cmake_d -D STOP_ON_WARNING=OFF"
|
cmake_d="$cmake_d -D STOP_ON_WARNING=OFF"
|
||||||
cmake_d="$cmake_d -D BUILDSTATIC=OFF"
|
cmake_d="$cmake_d -D BUILDSTATIC=OFF"
|
||||||
|
|
||||||
#~ cmake_d="$cmake_d -D ILMBASE_VERSION=$ILMBASE_VERSION"
|
cmake_d="$cmake_d -D ILMBASE_VERSION=$ILMBASE_VERSION"
|
||||||
|
|
||||||
if [ $_with_built_openexr == true ]; then
|
if [ $_with_built_openexr == true ]; then
|
||||||
INFO "ILMBASE_HOME=$INST/openexr"
|
INFO "ILMBASE_HOME=$INST/openexr"
|
||||||
cmake_d="$cmake_d -D ILMBASE_HOME=$INST/openexr"
|
cmake_d="$cmake_d -D ILMBASE_HOME=$INST/openexr"
|
||||||
# XXX Temp workaround... sigh, ILMBase really messed the things up by defining their custom names ON by default :(
|
|
||||||
cmake_d="$cmake_d -D ILMBASE_CUSTOM=ON"
|
|
||||||
cmake_d="$cmake_d -D ILMBASE_CUSTOM_LIBRARIES='Half;Iex;Imath;IlmThread'"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -d $INST/boost ]; then
|
if [ -d $INST/boost ]; then
|
||||||
@@ -1493,7 +1479,7 @@ compile_OSL() {
|
|||||||
if [ ! -z $LLVM_VERSION_FOUND ]; then
|
if [ ! -z $LLVM_VERSION_FOUND ]; then
|
||||||
cmake_d="$cmake_d -D LLVM_VERSION=$LLVM_VERSION_FOUND"
|
cmake_d="$cmake_d -D LLVM_VERSION=$LLVM_VERSION_FOUND"
|
||||||
if [ -d $INST/llvm ]; then
|
if [ -d $INST/llvm ]; then
|
||||||
cmake_d="$cmake_d -D LLVM_ROOT_DIR=$INST/llvm"
|
cmake_d="$cmake_d -D LLVM_DIRECTORY=$INST/llvm"
|
||||||
cmake_d="$cmake_d -D LLVM_STATIC=ON"
|
cmake_d="$cmake_d -D LLVM_STATIC=ON"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
@@ -1537,7 +1523,7 @@ clean_OpenCOLLADA() {
|
|||||||
|
|
||||||
compile_OpenCOLLADA() {
|
compile_OpenCOLLADA() {
|
||||||
# To be changed each time we make edits that would modify the compiled results!
|
# To be changed each time we make edits that would modify the compiled results!
|
||||||
opencollada_magic=9
|
opencollada_magic=8
|
||||||
_init_opencollada
|
_init_opencollada
|
||||||
|
|
||||||
# Clean install if needed!
|
# Clean install if needed!
|
||||||
@@ -1992,7 +1978,7 @@ install_DEB() {
|
|||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
install_packages_DEB libboost-locale$boost_version-dev libboost-filesystem$boost_version-dev \
|
install_packages_DEB libboost-locale$boost_version-dev libboost-filesystem$boost_version-dev \
|
||||||
libboost-regex$boost_version-dev libboost-system$boost_version-dev \
|
libboost-regex$boost_version-dev libboost-system$boost_version-dev \
|
||||||
libboost-thread$boost_version-dev libboost-wave$boost_version-dev
|
libboost-thread$boost_version-dev
|
||||||
clean_Boost
|
clean_Boost
|
||||||
else
|
else
|
||||||
compile_Boost
|
compile_Boost
|
||||||
@@ -2287,7 +2273,7 @@ install_RPM() {
|
|||||||
OGG_DEV="libogg-devel"
|
OGG_DEV="libogg-devel"
|
||||||
THEORA_DEV="libtheora-devel"
|
THEORA_DEV="libtheora-devel"
|
||||||
|
|
||||||
_packages="gcc gcc-c++ make scons libtiff-devel libjpeg-devel\
|
_packages="gcc gcc-c++ make scons libtiff-devel freetype-devel libjpeg-devel\
|
||||||
libpng-devel libX11-devel libXi-devel wget ncurses-devel \
|
libpng-devel libX11-devel libXi-devel wget ncurses-devel \
|
||||||
readline-devel $OPENJPEG_DEV openal-soft-devel \
|
readline-devel $OPENJPEG_DEV openal-soft-devel \
|
||||||
glew-devel yasm $THEORA_DEV $VORBIS_DEV $OGG_DEV patch \
|
glew-devel yasm $THEORA_DEV $VORBIS_DEV $OGG_DEV patch \
|
||||||
@@ -2301,7 +2287,7 @@ install_RPM() {
|
|||||||
if [ $RPM = "FEDORA" -o $RPM = "RHEL" ]; then
|
if [ $RPM = "FEDORA" -o $RPM = "RHEL" ]; then
|
||||||
OPENEXR_DEV="openexr-devel"
|
OPENEXR_DEV="openexr-devel"
|
||||||
|
|
||||||
_packages="$_packages freetype-devel libsqlite3x-devel fftw-devel SDL-devel"
|
_packages="$_packages libsqlite3x-devel fftw-devel SDL-devel"
|
||||||
|
|
||||||
if $WITH_ALL; then
|
if $WITH_ALL; then
|
||||||
_packages="$_packages jack-audio-connection-kit-devel"
|
_packages="$_packages jack-audio-connection-kit-devel"
|
||||||
@@ -2339,7 +2325,7 @@ install_RPM() {
|
|||||||
elif [ $RPM = "SUSE" ]; then
|
elif [ $RPM = "SUSE" ]; then
|
||||||
OPENEXR_DEV="libopenexr-devel"
|
OPENEXR_DEV="libopenexr-devel"
|
||||||
|
|
||||||
_packages="$_packages cmake freetype2-devel sqlite3-devel fftw3-devel libSDL-devel"
|
_packages="$_packages cmake sqlite3-devel fftw3-devel libSDL-devel"
|
||||||
|
|
||||||
PRINT ""
|
PRINT ""
|
||||||
install_packages_RPM $_packages
|
install_packages_RPM $_packages
|
||||||
@@ -2997,7 +2983,7 @@ print_info() {
|
|||||||
_buildargs="$_buildargs $_1"
|
_buildargs="$_buildargs $_1"
|
||||||
fi
|
fi
|
||||||
if [ -d $INST/llvm ]; then
|
if [ -d $INST/llvm ]; then
|
||||||
_1="-D LLVM_ROOT_DIR=$INST/llvm"
|
_1="-D LLVM_DIRECTORY=$INST/llvm"
|
||||||
_2="-D LLVM_STATIC=ON"
|
_2="-D LLVM_STATIC=ON"
|
||||||
PRINT " $_1"
|
PRINT " $_1"
|
||||||
PRINT " $_2"
|
PRINT " $_2"
|
||||||
@@ -3053,10 +3039,10 @@ print_info() {
|
|||||||
PRINT "BF_OPENEXR = '$INST/openexr'"
|
PRINT "BF_OPENEXR = '$INST/openexr'"
|
||||||
|
|
||||||
_ilm_libs_ext=""
|
_ilm_libs_ext=""
|
||||||
#~ version_ge $OPENEXR_VERSION "2.1.0"
|
version_ge $OPENEXR_VERSION "2.1.0"
|
||||||
#~ if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
#~ _ilm_libs_ext=`echo $OPENEXR_VERSION | sed -r 's/([0-9]+)\.([0-9]+).*/-\1_\2/'`
|
_ilm_libs_ext=`echo $OPENEXR_VERSION | sed -r 's/([0-9]+)\.([0-9]+).*/-\1_\2/'`
|
||||||
#~ fi
|
fi
|
||||||
PRINT "BF_OPENEXR_LIB = 'Half IlmImf$_ilm_libs_ext Iex$_ilm_libs_ext Imath$_ilm_libs_ext '"
|
PRINT "BF_OPENEXR_LIB = 'Half IlmImf$_ilm_libs_ext Iex$_ilm_libs_ext Imath$_ilm_libs_ext '"
|
||||||
# BF_OPENEXR_LIB does not work, things like '-lIlmImf-2_1' do not suit ld.
|
# BF_OPENEXR_LIB does not work, things like '-lIlmImf-2_1' do not suit ld.
|
||||||
# For now, hack around!!!
|
# For now, hack around!!!
|
||||||
|
@@ -124,15 +124,13 @@ BF_OIIO_INC = '${BF_OIIO}/include'
|
|||||||
BF_OIIO_LIB_STATIC = '${BF_OIIO_LIBPATH}/libOpenImageIO.a ${BF_OPENEXR}/lib/libIlmImf.a ${BF_JPEG}/lib/libjpeg.a'
|
BF_OIIO_LIB_STATIC = '${BF_OIIO_LIBPATH}/libOpenImageIO.a ${BF_OPENEXR}/lib/libIlmImf.a ${BF_JPEG}/lib/libjpeg.a'
|
||||||
BF_OIIO_LIBPATH = '${BF_OIIO}/lib'
|
BF_OIIO_LIBPATH = '${BF_OIIO}/lib'
|
||||||
|
|
||||||
BF_IS_NEW_OSL = False
|
|
||||||
WITH_BF_CYCLES_OSL = True
|
WITH_BF_CYCLES_OSL = True
|
||||||
WITH_BF_STATICOSL = BF_IS_NEW_OSL
|
WITH_BF_STATICOSL = False
|
||||||
BF_OSL = '/opt/lib/osl'
|
BF_OSL = '/opt/lib/osl'
|
||||||
BF_OSL_INC = '${BF_OSL}/include'
|
BF_OSL_INC = '${BF_OSL}/include'
|
||||||
# note oslexec would passed via program linkflags, which is needed to
|
# note oslexec would passed via program linkflags, which is needed to
|
||||||
# make llvm happy with osl_allocate_closure_component
|
# make llvm happy with osl_allocate_closure_component
|
||||||
BF_OSL_LIB = 'oslcomp oslexec oslquery'
|
BF_OSL_LIB = 'oslcomp oslexec oslquery'
|
||||||
BF_OSL_LIB_STATIC = '${BF_OSL}/lib/liboslcomp.a ${BF_OSL}/lib/liboslexec.a ${BF_OSL}/lib/liboslquery.a'
|
|
||||||
BF_OSL_LIBPATH = '${BF_OSL}/lib'
|
BF_OSL_LIBPATH = '${BF_OSL}/lib'
|
||||||
BF_OSL_COMPILER = '${BF_OSL}/bin/oslc'
|
BF_OSL_COMPILER = '${BF_OSL}/bin/oslc'
|
||||||
|
|
||||||
@@ -159,8 +157,6 @@ BF_BOOST_INC = '${BF_BOOST}/include'
|
|||||||
BF_BOOST_LIB_STATIC = '${BF_BOOST_LIBPATH}/libboost_filesystem.a ${BF_BOOST_LIBPATH}/libboost_date_time.a ' + \
|
BF_BOOST_LIB_STATIC = '${BF_BOOST_LIBPATH}/libboost_filesystem.a ${BF_BOOST_LIBPATH}/libboost_date_time.a ' + \
|
||||||
'${BF_BOOST_LIBPATH}/libboost_regex.a ${BF_BOOST_LIBPATH}/libboost_locale.a ${BF_BOOST_LIBPATH}/libboost_system.a \
|
'${BF_BOOST_LIBPATH}/libboost_regex.a ${BF_BOOST_LIBPATH}/libboost_locale.a ${BF_BOOST_LIBPATH}/libboost_system.a \
|
||||||
${BF_BOOST_LIBPATH}/libboost_thread.a'
|
${BF_BOOST_LIBPATH}/libboost_thread.a'
|
||||||
if BF_IS_NEW_OSL:
|
|
||||||
BF_BOOST_LIB_STATIC += ' ${BF_BOOST_LIBPATH}/libboost_wave.a'
|
|
||||||
BF_BOOST_LIBPATH = '${BF_BOOST}/lib'
|
BF_BOOST_LIBPATH = '${BF_BOOST}/lib'
|
||||||
|
|
||||||
# Ocean Simulation
|
# Ocean Simulation
|
||||||
@@ -170,7 +166,4 @@ WITH_BF_OCEANSIM = True
|
|||||||
BF_DEBUG = False
|
BF_DEBUG = False
|
||||||
REL_CCFLAGS = ['-DNDEBUG', '-O2', '-msse', '-msse2'] # C & C++
|
REL_CCFLAGS = ['-DNDEBUG', '-O2', '-msse', '-msse2'] # C & C++
|
||||||
PLATFORM_LINKFLAGS = ['-lrt']
|
PLATFORM_LINKFLAGS = ['-lrt']
|
||||||
if BF_IS_NEW_OSL:
|
BF_PROGRAM_LINKFLAGS = ['-Wl,--whole-archive', '-loslexec', '-Wl,--no-whole-archive', '-Wl,--version-script=source/creator/blender.map']
|
||||||
BF_PROGRAM_LINKFLAGS = ['-Wl,--version-script=source/creator/blender.map']
|
|
||||||
else:
|
|
||||||
BF_PROGRAM_LINKFLAGS = ['-Wl,--whole-archive', '-loslexec', '-Wl,--no-whole-archive', '-Wl,--version-script=source/creator/blender.map']
|
|
||||||
|
@@ -124,15 +124,13 @@ BF_OIIO_INC = '${BF_OIIO}/include'
|
|||||||
BF_OIIO_LIB_STATIC = '${BF_OIIO_LIBPATH}/libOpenImageIO.a ${BF_OPENEXR}/lib/libIlmImf.a ${BF_JPEG}/lib/libjpeg.a'
|
BF_OIIO_LIB_STATIC = '${BF_OIIO_LIBPATH}/libOpenImageIO.a ${BF_OPENEXR}/lib/libIlmImf.a ${BF_JPEG}/lib/libjpeg.a'
|
||||||
BF_OIIO_LIBPATH = '${BF_OIIO}/lib'
|
BF_OIIO_LIBPATH = '${BF_OIIO}/lib'
|
||||||
|
|
||||||
BF_IS_NEW_OSL = False
|
|
||||||
WITH_BF_CYCLES_OSL = True
|
WITH_BF_CYCLES_OSL = True
|
||||||
WITH_BF_STATICOSL = BF_IS_NEW_OSL
|
WITH_BF_STATICOSL = False
|
||||||
BF_OSL = '/opt/lib/osl'
|
BF_OSL = '/opt/lib/osl'
|
||||||
BF_OSL_INC = '${BF_OSL}/include'
|
BF_OSL_INC = '${BF_OSL}/include'
|
||||||
# note oslexec would passed via program linkflags, which is needed to
|
# note oslexec would passed via program linkflags, which is needed to
|
||||||
# make llvm happy with osl_allocate_closure_component
|
# make llvm happy with osl_allocate_closure_component
|
||||||
BF_OSL_LIB = 'oslcomp oslexec oslquery'
|
BF_OSL_LIB = 'oslcomp oslexec oslquery'
|
||||||
BF_OSL_LIB_STATIC = '${BF_OSL}/lib/liboslcomp.a ${BF_OSL}/lib/liboslexec.a ${BF_OSL}/lib/liboslquery.a'
|
|
||||||
BF_OSL_LIBPATH = '${BF_OSL}/lib'
|
BF_OSL_LIBPATH = '${BF_OSL}/lib'
|
||||||
BF_OSL_COMPILER = '${BF_OSL}/bin/oslc'
|
BF_OSL_COMPILER = '${BF_OSL}/bin/oslc'
|
||||||
|
|
||||||
@@ -159,8 +157,6 @@ BF_BOOST_INC = '${BF_BOOST}/include'
|
|||||||
BF_BOOST_LIB_STATIC = '${BF_BOOST_LIBPATH}/libboost_filesystem.a ${BF_BOOST_LIBPATH}/libboost_date_time.a ' + \
|
BF_BOOST_LIB_STATIC = '${BF_BOOST_LIBPATH}/libboost_filesystem.a ${BF_BOOST_LIBPATH}/libboost_date_time.a ' + \
|
||||||
'${BF_BOOST_LIBPATH}/libboost_regex.a ${BF_BOOST_LIBPATH}/libboost_locale.a ${BF_BOOST_LIBPATH}/libboost_system.a \
|
'${BF_BOOST_LIBPATH}/libboost_regex.a ${BF_BOOST_LIBPATH}/libboost_locale.a ${BF_BOOST_LIBPATH}/libboost_system.a \
|
||||||
${BF_BOOST_LIBPATH}/libboost_thread.a'
|
${BF_BOOST_LIBPATH}/libboost_thread.a'
|
||||||
if BF_IS_NEW_OSL:
|
|
||||||
BF_BOOST_LIB_STATIC += ' ${BF_BOOST_LIBPATH}/libboost_wave.a'
|
|
||||||
BF_BOOST_LIBPATH = '${BF_BOOST}/lib'
|
BF_BOOST_LIBPATH = '${BF_BOOST}/lib'
|
||||||
|
|
||||||
# Ocean Simulation
|
# Ocean Simulation
|
||||||
@@ -170,7 +166,4 @@ WITH_BF_OCEANSIM = True
|
|||||||
BF_DEBUG = False
|
BF_DEBUG = False
|
||||||
REL_CCFLAGS = ['-DNDEBUG', '-O2', '-msse', '-msse2'] # C & C++
|
REL_CCFLAGS = ['-DNDEBUG', '-O2', '-msse', '-msse2'] # C & C++
|
||||||
PLATFORM_LINKFLAGS = ['-lrt']
|
PLATFORM_LINKFLAGS = ['-lrt']
|
||||||
if BF_IS_NEW_OSL:
|
BF_PROGRAM_LINKFLAGS = ['-Wl,--whole-archive', '-loslexec', '-Wl,--no-whole-archive', '-Wl,--version-script=source/creator/blender.map']
|
||||||
BF_PROGRAM_LINKFLAGS = ['-Wl,--version-script=source/creator/blender.map']
|
|
||||||
else:
|
|
||||||
BF_PROGRAM_LINKFLAGS = ['-Wl,--whole-archive', '-loslexec', '-Wl,--no-whole-archive', '-Wl,--version-script=source/creator/blender.map']
|
|
||||||
|
@@ -5,5 +5,3 @@ WITH_BF_CYCLES_CUDA_BINARIES = True
|
|||||||
|
|
||||||
WITH_BF_CYCLES_OSL = False # OSL never worked on OSX 32bit !
|
WITH_BF_CYCLES_OSL = False # OSL never worked on OSX 32bit !
|
||||||
|
|
||||||
WITH_BF_COLLADA = False # we drop 32bit, newest collada is only x86_64 !
|
|
||||||
|
|
||||||
|
@@ -1,6 +1,5 @@
|
|||||||
CC = "../lib/darwin-9.x.universal/clang-omp-3.5/bin/clang"
|
|
||||||
CXX = "../lib/darwin-9.x.universal/clang-omp-3.5/bin/clang++"
|
|
||||||
|
|
||||||
MACOSX_ARCHITECTURE = 'x86_64' # valid archs: ppc, i386, ppc64, x86_64
|
MACOSX_ARCHITECTURE = 'x86_64' # valid archs: ppc, i386, ppc64, x86_64
|
||||||
|
|
||||||
WITH_BF_CYCLES_CUDA_BINARIES = True
|
WITH_BF_CYCLES_CUDA_BINARIES = True
|
||||||
|
|
||||||
|
@@ -4,10 +4,10 @@
|
|||||||
# <pep8 compliant>
|
# <pep8 compliant>
|
||||||
|
|
||||||
# List of the branches being built automatically overnight
|
# List of the branches being built automatically overnight
|
||||||
NIGHT_SCHEDULE_BRANCHES = [None, "gooseberry"]
|
NIGHT_SCHEDULE_BRANCHES=[None, "gooseberry"]
|
||||||
|
|
||||||
# List of the branches available for force build
|
# List of the branches available for force build
|
||||||
FORCE_SCHEDULE_BRANCHES = ["master", "gooseberry", "experimental-build"]
|
FORCE_SCHEDULE_BRANCHES=["master", "gooseberry", "experimental-build"]
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Stock Twisted directory lister doesn't provide any information about last file
|
Stock Twisted directory lister doesn't provide any information about last file
|
||||||
@@ -17,7 +17,6 @@ modification time, we hack the class a bit in order to have such functionaliity
|
|||||||
|
|
||||||
from buildbot.status.web.base import DirectoryLister
|
from buildbot.status.web.base import DirectoryLister
|
||||||
|
|
||||||
|
|
||||||
def get_files_and_directories(self, directory):
|
def get_files_and_directories(self, directory):
|
||||||
from twisted.web.static import (getTypeAndEncoding,
|
from twisted.web.static import (getTypeAndEncoding,
|
||||||
formatFileSize)
|
formatFileSize)
|
||||||
@@ -98,7 +97,6 @@ all_repositories = {
|
|||||||
r'https://svn.blender.org/svnroot/bf-blender/': 'lib svn',
|
r'https://svn.blender.org/svnroot/bf-blender/': 'lib svn',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def codebaseGenerator(chdict):
|
def codebaseGenerator(chdict):
|
||||||
return all_repositories[chdict['repository']]
|
return all_repositories[chdict['repository']]
|
||||||
|
|
||||||
@@ -114,7 +112,6 @@ from buildbot.schedulers import timed, forcesched
|
|||||||
|
|
||||||
c['schedulers'] = []
|
c['schedulers'] = []
|
||||||
|
|
||||||
|
|
||||||
def schedule_force_build(name):
|
def schedule_force_build(name):
|
||||||
c['schedulers'].append(forcesched.ForceScheduler(name='force ' + name,
|
c['schedulers'].append(forcesched.ForceScheduler(name='force ' + name,
|
||||||
builderNames=[name],
|
builderNames=[name],
|
||||||
@@ -146,7 +143,7 @@ def schedule_build(name, hour, minute=0):
|
|||||||
"blender-addons": {"repository": "", "branch": "master"},
|
"blender-addons": {"repository": "", "branch": "master"},
|
||||||
"blender-addons-contrib": {"repository": "", "branch": "master"},
|
"blender-addons-contrib": {"repository": "", "branch": "master"},
|
||||||
"scons": {"repository": "", "branch": "master"},
|
"scons": {"repository": "", "branch": "master"},
|
||||||
"lib svn": {"repository": "", "branch": "trunk"}},
|
"lib svn": {"repository": "", "branch": "master"}},
|
||||||
branch=current_branch,
|
branch=current_branch,
|
||||||
builderNames=[name],
|
builderNames=[name],
|
||||||
hour=hour,
|
hour=hour,
|
||||||
|
@@ -37,7 +37,6 @@ def strip_extension(filename):
|
|||||||
|
|
||||||
return filename
|
return filename
|
||||||
|
|
||||||
|
|
||||||
# extract platform from package name
|
# extract platform from package name
|
||||||
def get_platform(filename):
|
def get_platform(filename):
|
||||||
# name is blender-version-platform.extension. we want to get the
|
# name is blender-version-platform.extension. we want to get the
|
||||||
@@ -65,11 +64,10 @@ def get_platform(filename):
|
|||||||
|
|
||||||
return '-'.join(platform_tokens)
|
return '-'.join(platform_tokens)
|
||||||
|
|
||||||
|
|
||||||
def get_branch(filename):
|
def get_branch(filename):
|
||||||
tokens = filename.split("-")
|
tokens = filename.split("-")
|
||||||
branch = ""
|
branch = ""
|
||||||
|
|
||||||
for token in tokens:
|
for token in tokens:
|
||||||
if token == "blender":
|
if token == "blender":
|
||||||
return branch
|
return branch
|
||||||
@@ -95,7 +93,7 @@ if not os.path.exists(filename):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
z = zipfile.ZipFile(filename, "r")
|
z = zipfile.ZipFile(filename, "r")
|
||||||
except Exception as ex:
|
except Exception, ex:
|
||||||
sys.stderr.write('Failed to open zip file: %s\n' % str(ex))
|
sys.stderr.write('Failed to open zip file: %s\n' % str(ex))
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
@@ -124,16 +122,14 @@ else:
|
|||||||
directory = 'public_html/download'
|
directory = 'public_html/download'
|
||||||
|
|
||||||
try:
|
try:
|
||||||
filename = os.path.join(directory, packagename)
|
|
||||||
zf = z.open(package)
|
zf = z.open(package)
|
||||||
f = file(filename, "wb")
|
f = file(os.path.join(directory, packagename), "wb")
|
||||||
|
|
||||||
shutil.copyfileobj(zf, f)
|
shutil.copyfileobj(zf, f)
|
||||||
os.chmod(filename, 0644)
|
|
||||||
|
|
||||||
zf.close()
|
zf.close()
|
||||||
z.close()
|
z.close()
|
||||||
except Exception as ex:
|
except Exception, ex:
|
||||||
sys.stderr.write('Failed to unzip package: %s\n' % str(ex))
|
sys.stderr.write('Failed to unzip package: %s\n' % str(ex))
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
@@ -143,6 +139,6 @@ try:
|
|||||||
if get_platform(f) == platform and get_branch(f) == branch:
|
if get_platform(f) == platform and get_branch(f) == branch:
|
||||||
if f != packagename:
|
if f != packagename:
|
||||||
os.remove(os.path.join(directory, f))
|
os.remove(os.path.join(directory, f))
|
||||||
except Exception as ex:
|
except Exception, ex:
|
||||||
sys.stderr.write('Failed to remove old packages: %s\n' % str(ex))
|
sys.stderr.write('Failed to remove old packages: %s\n' % str(ex))
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
@@ -47,9 +47,9 @@ if 'cmake' in builder:
|
|||||||
cmake_options.append('-DCMAKE_OSX_ARCHITECTURES:STRING=ppc')
|
cmake_options.append('-DCMAKE_OSX_ARCHITECTURES:STRING=ppc')
|
||||||
|
|
||||||
if 'win64' in builder:
|
if 'win64' in builder:
|
||||||
cmake_options.append(['-G', '"Visual Studio 12 2013 Win64"'])
|
cmake_options.append(['-G','"Visual Studio 12 2013 Win64"'])
|
||||||
elif 'win32' in builder:
|
elif 'win32' in builder:
|
||||||
cmake_options.append(['-G', '"Visual Studio 12 2013"'])
|
cmake_options.append(['-G','"Visual Studio 12 2013"'])
|
||||||
|
|
||||||
cmake_options.append("-C../blender.git/build_files/cmake/config/blender_full.cmake")
|
cmake_options.append("-C../blender.git/build_files/cmake/config/blender_full.cmake")
|
||||||
cmake_options.append("-DWITH_CYCLES_CUDA_BINARIES=1")
|
cmake_options.append("-DWITH_CYCLES_CUDA_BINARIES=1")
|
||||||
@@ -116,8 +116,6 @@ else:
|
|||||||
|
|
||||||
if config.find('player') != -1:
|
if config.find('player') != -1:
|
||||||
scons_options.append('BF_BUILDDIR=%s_player' % (build_dir))
|
scons_options.append('BF_BUILDDIR=%s_player' % (build_dir))
|
||||||
elif config.find('cuda') != -1:
|
|
||||||
scons_options.append('BF_BUILDDIR=%s_cuda' % (build_dir))
|
|
||||||
else:
|
else:
|
||||||
scons_options.append('BF_BUILDDIR=%s' % (build_dir))
|
scons_options.append('BF_BUILDDIR=%s' % (build_dir))
|
||||||
|
|
||||||
@@ -142,7 +140,7 @@ else:
|
|||||||
|
|
||||||
retcode = subprocess.call(cur_scons_cmd + scons_options)
|
retcode = subprocess.call(cur_scons_cmd + scons_options)
|
||||||
if retcode != 0:
|
if retcode != 0:
|
||||||
print('Error building rules with config ' + config)
|
print('Error building rules wuth config ' + config)
|
||||||
sys.exit(retcode)
|
sys.exit(retcode)
|
||||||
|
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
@@ -116,12 +116,12 @@ if builder.find('scons') != -1:
|
|||||||
retcode = subprocess.call([python_bin, 'scons/scons.py'] + scons_options)
|
retcode = subprocess.call([python_bin, 'scons/scons.py'] + scons_options)
|
||||||
sys.exit(retcode)
|
sys.exit(retcode)
|
||||||
else:
|
else:
|
||||||
# CMake
|
#cmake
|
||||||
if 'win' in builder:
|
if 'win' in builder:
|
||||||
files = [f for f in os.listdir('.') if os.path.isfile(f) and f.endswith('.zip')]
|
files = [f for f in os.listdir('.') if os.path.isfile(f) and f.endswith('.zip')]
|
||||||
for f in files:
|
for f in files:
|
||||||
os.remove(f)
|
os.remove(f)
|
||||||
retcode = subprocess.call(['cpack', '-G', 'ZIP'])
|
retcode = subprocess.call(['cpack', '-G','ZIP'])
|
||||||
result_file = [f for f in os.listdir('.') if os.path.isfile(f) and f.endswith('.zip')][0]
|
result_file = [f for f in os.listdir('.') if os.path.isfile(f) and f.endswith('.zip')][0]
|
||||||
os.rename(result_file, "{}.zip".format(builder))
|
os.rename(result_file, "{}.zip".format(builder))
|
||||||
# create zip file
|
# create zip file
|
||||||
@@ -133,7 +133,7 @@ else:
|
|||||||
z.write("{}.zip".format(builder))
|
z.write("{}.zip".format(builder))
|
||||||
z.close()
|
z.close()
|
||||||
sys.exit(retcode)
|
sys.exit(retcode)
|
||||||
except Exception as ex:
|
except Exception, ex:
|
||||||
sys.stderr.write('Create buildbot_upload.zip failed' + str(ex) + '\n')
|
sys.stderr.write('Create buildbot_upload.zip failed' + str(ex) + '\n')
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
@@ -149,7 +149,7 @@ if os.path.exists(release_dir):
|
|||||||
# create release package
|
# create release package
|
||||||
try:
|
try:
|
||||||
subprocess.call(['make', 'package_archive'])
|
subprocess.call(['make', 'package_archive'])
|
||||||
except Exception as ex:
|
except Exception, ex:
|
||||||
sys.stderr.write('Make package release failed' + str(ex) + '\n')
|
sys.stderr.write('Make package release failed' + str(ex) + '\n')
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
@@ -180,6 +180,6 @@ try:
|
|||||||
z = zipfile.ZipFile(upload_zip, "w", compression=zipfile.ZIP_STORED)
|
z = zipfile.ZipFile(upload_zip, "w", compression=zipfile.ZIP_STORED)
|
||||||
z.write(filepath, arcname=file)
|
z.write(filepath, arcname=file)
|
||||||
z.close()
|
z.close()
|
||||||
except Exception as ex:
|
except Exception, ex:
|
||||||
sys.stderr.write('Create buildbot_upload.zip failed' + str(ex) + '\n')
|
sys.stderr.write('Create buildbot_upload.zip failed' + str(ex) + '\n')
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
@@ -1,56 +0,0 @@
|
|||||||
# - Find Eigen3 library
|
|
||||||
# Find the native Eigen3 includes and library
|
|
||||||
# This module defines
|
|
||||||
# EIGEN3_INCLUDE_DIRS, where to find spnav.h, Set when
|
|
||||||
# EIGEN3_INCLUDE_DIR is found.
|
|
||||||
# EIGEN3_ROOT_DIR, The base directory to search for Eigen3.
|
|
||||||
# This can also be an environment variable.
|
|
||||||
# EIGEN3_FOUND, If false, do not try to use Eigen3.
|
|
||||||
#
|
|
||||||
#=============================================================================
|
|
||||||
# Copyright 2015 Blender Foundation.
|
|
||||||
#
|
|
||||||
# Distributed under the OSI-approved BSD License (the "License");
|
|
||||||
# see accompanying file Copyright.txt for details.
|
|
||||||
#
|
|
||||||
# This software is distributed WITHOUT ANY WARRANTY; without even the
|
|
||||||
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
||||||
# See the License for more information.
|
|
||||||
#=============================================================================
|
|
||||||
|
|
||||||
# If EIGEN3_ROOT_DIR was defined in the environment, use it.
|
|
||||||
IF(NOT EIGEN3_ROOT_DIR AND NOT $ENV{EIGEN3_ROOT_DIR} STREQUAL "")
|
|
||||||
SET(EIGEN3_ROOT_DIR $ENV{EIGEN3_ROOT_DIR})
|
|
||||||
ENDIF()
|
|
||||||
|
|
||||||
SET(_eigen3_SEARCH_DIRS
|
|
||||||
${EIGEN3_ROOT_DIR}
|
|
||||||
/usr/local
|
|
||||||
/sw # Fink
|
|
||||||
/opt/local # DarwinPorts
|
|
||||||
/opt/csw # Blastwave
|
|
||||||
)
|
|
||||||
|
|
||||||
FIND_PATH(EIGEN3_INCLUDE_DIR
|
|
||||||
NAMES
|
|
||||||
# header has no '.h' suffix
|
|
||||||
Eigen/Eigen
|
|
||||||
HINTS
|
|
||||||
${_eigen3_SEARCH_DIRS}
|
|
||||||
PATH_SUFFIXES
|
|
||||||
include/eigen3
|
|
||||||
)
|
|
||||||
|
|
||||||
# handle the QUIETLY and REQUIRED arguments and set EIGEN3_FOUND to TRUE if
|
|
||||||
# all listed variables are TRUE
|
|
||||||
INCLUDE(FindPackageHandleStandardArgs)
|
|
||||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Eigen3 DEFAULT_MSG
|
|
||||||
EIGEN3_INCLUDE_DIR)
|
|
||||||
|
|
||||||
IF(EIGEN3_FOUND)
|
|
||||||
SET(EIGEN3_INCLUDE_DIRS ${EIGEN3_INCLUDE_DIR})
|
|
||||||
ENDIF(EIGEN3_FOUND)
|
|
||||||
|
|
||||||
MARK_AS_ADVANCED(
|
|
||||||
EIGEN3_INCLUDE_DIR
|
|
||||||
)
|
|
@@ -33,7 +33,6 @@ SET(_jemalloc_SEARCH_DIRS
|
|||||||
/sw # Fink
|
/sw # Fink
|
||||||
/opt/local # DarwinPorts
|
/opt/local # DarwinPorts
|
||||||
/opt/csw # Blastwave
|
/opt/csw # Blastwave
|
||||||
/opt/lib/jemalloc
|
|
||||||
)
|
)
|
||||||
|
|
||||||
FIND_PATH(JEMALLOC_INCLUDE_DIR
|
FIND_PATH(JEMALLOC_INCLUDE_DIR
|
||||||
|
@@ -1,94 +0,0 @@
|
|||||||
# - Find LLVM library
|
|
||||||
# Find the native LLVM includes and library
|
|
||||||
# This module defines
|
|
||||||
# LLVM_INCLUDE_DIRS, where to find LLVM.h, Set when LLVM_INCLUDE_DIR is found.
|
|
||||||
# LLVM_LIBRARIES, libraries to link against to use LLVM.
|
|
||||||
# LLVM_ROOT_DIR, The base directory to search for LLVM.
|
|
||||||
# This can also be an environment variable.
|
|
||||||
# LLVM_FOUND, If false, do not try to use LLVM.
|
|
||||||
#
|
|
||||||
# also defined, but not for general use are
|
|
||||||
# LLVM_LIBRARY, where to find the LLVM library.
|
|
||||||
|
|
||||||
#=============================================================================
|
|
||||||
# Copyright 2015 Blender Foundation.
|
|
||||||
#
|
|
||||||
# Distributed under the OSI-approved BSD License (the "License");
|
|
||||||
# see accompanying file Copyright.txt for details.
|
|
||||||
#
|
|
||||||
# This software is distributed WITHOUT ANY WARRANTY; without even the
|
|
||||||
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
||||||
# See the License for more information.
|
|
||||||
#=============================================================================
|
|
||||||
|
|
||||||
if(LLVM_ROOT_DIR)
|
|
||||||
if(DEFINED LLVM_VERSION)
|
|
||||||
find_program(LLVM_CONFIG llvm-config-${LLVM_VERSION} HINTS ${LLVM_ROOT_DIR}/bin NO_CMAKE_PATH)
|
|
||||||
endif()
|
|
||||||
if(NOT LLVM_CONFIG)
|
|
||||||
find_program(LLVM_CONFIG llvm-config HINTS ${LLVM_ROOT_DIR}/bin NO_CMAKE_PATH)
|
|
||||||
endif()
|
|
||||||
else()
|
|
||||||
if(DEFINED LLVM_VERSION)
|
|
||||||
message(running llvm-config-${LLVM_VERSION})
|
|
||||||
find_program(LLVM_CONFIG llvm-config-${LLVM_VERSION})
|
|
||||||
endif()
|
|
||||||
if(NOT LLVM_CONFIG)
|
|
||||||
find_program(LLVM_CONFIG llvm-config)
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(NOT DEFINED LLVM_VERSION)
|
|
||||||
execute_process(COMMAND ${LLVM_CONFIG} --version
|
|
||||||
OUTPUT_VARIABLE LLVM_VERSION
|
|
||||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
|
||||||
set(LLVM_VERSION ${LLVM_VERSION} CACHE STRING "Version of LLVM to use")
|
|
||||||
endif()
|
|
||||||
if(NOT LLVM_ROOT_DIR)
|
|
||||||
execute_process(COMMAND ${LLVM_CONFIG} --prefix
|
|
||||||
OUTPUT_VARIABLE LLVM_ROOT_DIR
|
|
||||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
|
||||||
set(LLVM_ROOT_DIR ${LLVM_ROOT_DIR} CACHE PATH "Path to the LLVM installation")
|
|
||||||
endif()
|
|
||||||
if(NOT LLVM_LIBPATH)
|
|
||||||
execute_process(COMMAND ${LLVM_CONFIG} --libdir
|
|
||||||
OUTPUT_VARIABLE LLVM_LIBPATH
|
|
||||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
|
||||||
set(LLVM_LIBPATH ${LLVM_LIBPATH} CACHE PATH "Path to the LLVM library path")
|
|
||||||
mark_as_advanced(LLVM_LIBPATH)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(LLVM_STATIC)
|
|
||||||
find_library(LLVM_LIBRARY
|
|
||||||
NAMES LLVMAnalysis # first of a whole bunch of libs to get
|
|
||||||
PATHS ${LLVM_LIBPATH})
|
|
||||||
else()
|
|
||||||
find_library(LLVM_LIBRARY
|
|
||||||
NAMES LLVM-${LLVM_VERSION}
|
|
||||||
PATHS ${LLVM_LIBPATH})
|
|
||||||
endif()
|
|
||||||
|
|
||||||
|
|
||||||
if(LLVM_LIBRARY AND LLVM_ROOT_DIR AND LLVM_LIBPATH)
|
|
||||||
if(LLVM_STATIC)
|
|
||||||
# if static LLVM libraries were requested, use llvm-config to generate
|
|
||||||
# the list of what libraries we need, and substitute that in the right
|
|
||||||
# way for LLVM_LIBRARY.
|
|
||||||
execute_process(COMMAND ${LLVM_CONFIG} --libfiles
|
|
||||||
OUTPUT_VARIABLE LLVM_LIBRARY
|
|
||||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
|
||||||
string(REPLACE " " ";" LLVM_LIBRARY "${LLVM_LIBRARY}")
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
|
|
||||||
# handle the QUIETLY and REQUIRED arguments and set SDL2_FOUND to TRUE if
|
|
||||||
# all listed variables are TRUE
|
|
||||||
INCLUDE(FindPackageHandleStandardArgs)
|
|
||||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(LLVM DEFAULT_MSG
|
|
||||||
LLVM_LIBRARY)
|
|
||||||
|
|
||||||
MARK_AS_ADVANCED(
|
|
||||||
LLVM_LIBRARY
|
|
||||||
)
|
|
||||||
|
|
@@ -1,68 +0,0 @@
|
|||||||
# - Find LZO library
|
|
||||||
# Find the native LZO includes and library
|
|
||||||
# This module defines
|
|
||||||
# LZO_INCLUDE_DIRS, where to find lzo1x.h, Set when
|
|
||||||
# LZO_INCLUDE_DIR is found.
|
|
||||||
# LZO_LIBRARIES, libraries to link against to use LZO.
|
|
||||||
# LZO_ROOT_DIR, The base directory to search for LZO.
|
|
||||||
# This can also be an environment variable.
|
|
||||||
# LZO_FOUND, If false, do not try to use LZO.
|
|
||||||
#
|
|
||||||
# also defined, but not for general use are
|
|
||||||
# LZO_LIBRARY, where to find the LZO library.
|
|
||||||
|
|
||||||
#=============================================================================
|
|
||||||
# Copyright 2015 Blender Foundation.
|
|
||||||
#
|
|
||||||
# Distributed under the OSI-approved BSD License (the "License");
|
|
||||||
# see accompanying file Copyright.txt for details.
|
|
||||||
#
|
|
||||||
# This software is distributed WITHOUT ANY WARRANTY; without even the
|
|
||||||
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
||||||
# See the License for more information.
|
|
||||||
#=============================================================================
|
|
||||||
|
|
||||||
# If LZO_ROOT_DIR was defined in the environment, use it.
|
|
||||||
IF(NOT LZO_ROOT_DIR AND NOT $ENV{LZO_ROOT_DIR} STREQUAL "")
|
|
||||||
SET(LZO_ROOT_DIR $ENV{LZO_ROOT_DIR})
|
|
||||||
ENDIF()
|
|
||||||
|
|
||||||
SET(_lzo_SEARCH_DIRS
|
|
||||||
${LZO_ROOT_DIR}
|
|
||||||
/usr/local
|
|
||||||
/sw # Fink
|
|
||||||
/opt/local # DarwinPorts
|
|
||||||
/opt/csw # Blastwave
|
|
||||||
)
|
|
||||||
|
|
||||||
FIND_PATH(LZO_INCLUDE_DIR lzo/lzo1x.h
|
|
||||||
HINTS
|
|
||||||
${_lzo_SEARCH_DIRS}
|
|
||||||
PATH_SUFFIXES
|
|
||||||
include
|
|
||||||
)
|
|
||||||
|
|
||||||
FIND_LIBRARY(LZO_LIBRARY
|
|
||||||
NAMES
|
|
||||||
lzo2
|
|
||||||
HINTS
|
|
||||||
${_lzo_SEARCH_DIRS}
|
|
||||||
PATH_SUFFIXES
|
|
||||||
lib64 lib
|
|
||||||
)
|
|
||||||
|
|
||||||
# handle the QUIETLY and REQUIRED arguments and set LZO_FOUND to TRUE if
|
|
||||||
# all listed variables are TRUE
|
|
||||||
INCLUDE(FindPackageHandleStandardArgs)
|
|
||||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(LZO DEFAULT_MSG
|
|
||||||
LZO_LIBRARY LZO_INCLUDE_DIR)
|
|
||||||
|
|
||||||
IF(LZO_FOUND)
|
|
||||||
SET(LZO_LIBRARIES ${LZO_LIBRARY})
|
|
||||||
SET(LZO_INCLUDE_DIRS ${LZO_INCLUDE_DIR})
|
|
||||||
ENDIF(LZO_FOUND)
|
|
||||||
|
|
||||||
MARK_AS_ADVANCED(
|
|
||||||
LZO_INCLUDE_DIR
|
|
||||||
LZO_LIBRARY
|
|
||||||
)
|
|
@@ -51,7 +51,6 @@ SET(_openexr_SEARCH_DIRS
|
|||||||
/sw # Fink
|
/sw # Fink
|
||||||
/opt/local # DarwinPorts
|
/opt/local # DarwinPorts
|
||||||
/opt/csw # Blastwave
|
/opt/csw # Blastwave
|
||||||
/opt/lib/openexr
|
|
||||||
)
|
)
|
||||||
|
|
||||||
FIND_PATH(OPENEXR_INCLUDE_DIR
|
FIND_PATH(OPENEXR_INCLUDE_DIR
|
||||||
|
@@ -71,7 +71,6 @@ ENDIF()
|
|||||||
MARK_AS_ADVANCED(
|
MARK_AS_ADVANCED(
|
||||||
OPENGLES_EGL_INCLUDE_DIR
|
OPENGLES_EGL_INCLUDE_DIR
|
||||||
OPENGLES_EGL_LIBRARY
|
OPENGLES_EGL_LIBRARY
|
||||||
OPENGLES_LIBRARY
|
|
||||||
OPENGLES_INCLUDE_DIR
|
OPENGLES_INCLUDE_DIR
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@@ -7,8 +7,6 @@
|
|||||||
# OPENIMAGEIO_ROOT_DIR, The base directory to search for OpenImageIO.
|
# OPENIMAGEIO_ROOT_DIR, The base directory to search for OpenImageIO.
|
||||||
# This can also be an environment variable.
|
# This can also be an environment variable.
|
||||||
# OPENIMAGEIO_FOUND, If false, do not try to use OpenImageIO.
|
# OPENIMAGEIO_FOUND, If false, do not try to use OpenImageIO.
|
||||||
# OPENIMAGEIO_PUGIXML_FOUND, Indicates whether OIIO has biltin PuguXML parser.
|
|
||||||
# OPENIMAGEIO_IDIFF, full path to idiff application if found.
|
|
||||||
#
|
#
|
||||||
# also defined, but not for general use are
|
# also defined, but not for general use are
|
||||||
# OPENIMAGEIO_LIBRARY, where to find the OpenImageIO library.
|
# OPENIMAGEIO_LIBRARY, where to find the OpenImageIO library.
|
||||||
@@ -56,15 +54,6 @@ FIND_LIBRARY(OPENIMAGEIO_LIBRARY
|
|||||||
lib64 lib
|
lib64 lib
|
||||||
)
|
)
|
||||||
|
|
||||||
FIND_FILE(OPENIMAGEIO_IDIFF
|
|
||||||
NAMES
|
|
||||||
idiff
|
|
||||||
HINTS
|
|
||||||
${OPENIMAGEIO_ROOT_DIR}
|
|
||||||
PATH_SUFFIXES
|
|
||||||
bin
|
|
||||||
)
|
|
||||||
|
|
||||||
# handle the QUIETLY and REQUIRED arguments and set OPENIMAGEIO_FOUND to TRUE if
|
# handle the QUIETLY and REQUIRED arguments and set OPENIMAGEIO_FOUND to TRUE if
|
||||||
# all listed variables are TRUE
|
# all listed variables are TRUE
|
||||||
INCLUDE(FindPackageHandleStandardArgs)
|
INCLUDE(FindPackageHandleStandardArgs)
|
||||||
@@ -74,17 +63,11 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(OpenImageIO DEFAULT_MSG
|
|||||||
IF(OPENIMAGEIO_FOUND)
|
IF(OPENIMAGEIO_FOUND)
|
||||||
SET(OPENIMAGEIO_LIBRARIES ${OPENIMAGEIO_LIBRARY})
|
SET(OPENIMAGEIO_LIBRARIES ${OPENIMAGEIO_LIBRARY})
|
||||||
SET(OPENIMAGEIO_INCLUDE_DIRS ${OPENIMAGEIO_INCLUDE_DIR})
|
SET(OPENIMAGEIO_INCLUDE_DIRS ${OPENIMAGEIO_INCLUDE_DIR})
|
||||||
IF(EXISTS ${OPENIMAGEIO_INCLUDE_DIR}/OpenImageIO/pugixml.hpp)
|
ENDIF(OPENIMAGEIO_FOUND)
|
||||||
SET(OPENIMAGEIO_PUGIXML_FOUND TRUE)
|
|
||||||
ENDIF()
|
|
||||||
ELSE()
|
|
||||||
SET(OPENIMAGEIO_PUGIXML_FOUND FALSE)
|
|
||||||
ENDIF()
|
|
||||||
|
|
||||||
MARK_AS_ADVANCED(
|
MARK_AS_ADVANCED(
|
||||||
OPENIMAGEIO_INCLUDE_DIR
|
OPENIMAGEIO_INCLUDE_DIR
|
||||||
OPENIMAGEIO_LIBRARY
|
OPENIMAGEIO_LIBRARY
|
||||||
OPENIMAGEIO_IDIFF
|
|
||||||
)
|
)
|
||||||
|
|
||||||
UNSET(_openimageio_SEARCH_DIRS)
|
UNSET(_openimageio_SEARCH_DIRS)
|
||||||
|
@@ -1,98 +0,0 @@
|
|||||||
# - Find OpenShadingLanguage library
|
|
||||||
# Find the native OpenShadingLanguage includes and library
|
|
||||||
# This module defines
|
|
||||||
# OSL_INCLUDE_DIRS, where to find OSL headers, Set when
|
|
||||||
# OSL_INCLUDE_DIR is found.
|
|
||||||
# OSL_LIBRARIES, libraries to link against to use OSL.
|
|
||||||
# OSL_ROOT_DIR, the base directory to search for OSL.
|
|
||||||
# This can also be an environment variable.
|
|
||||||
# OSL_COMPILER, full path to OSL script compiler.
|
|
||||||
# OSL_FOUND, if false, do not try to use OSL.
|
|
||||||
# OSL_LIBRARY_VERSION_MAJOR, OSL_LIBRARY_VERSION_MINOR, the major
|
|
||||||
# and minor versions of OSL library if found.
|
|
||||||
#
|
|
||||||
#=============================================================================
|
|
||||||
# Copyright 2014 Blender Foundation.
|
|
||||||
#
|
|
||||||
# Distributed under the OSI-approved BSD License (the "License");
|
|
||||||
# see accompanying file Copyright.txt for details.
|
|
||||||
#
|
|
||||||
# This software is distributed WITHOUT ANY WARRANTY; without even the
|
|
||||||
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
||||||
# See the License for more information.
|
|
||||||
#=============================================================================
|
|
||||||
|
|
||||||
# If OSL_ROOT_DIR was defined in the environment, use it.
|
|
||||||
IF(NOT OSL_ROOT_DIR AND NOT $ENV{OSL_ROOT_DIR} STREQUAL "")
|
|
||||||
SET(OSL_ROOT_DIR $ENV{OSL_ROOT_DIR})
|
|
||||||
ENDIF()
|
|
||||||
|
|
||||||
SET(_osl_FIND_COMPONENTS
|
|
||||||
oslcomp
|
|
||||||
oslexec
|
|
||||||
oslquery
|
|
||||||
)
|
|
||||||
|
|
||||||
SET(_osl_SEARCH_DIRS
|
|
||||||
${OSL_ROOT_DIR}
|
|
||||||
/usr/local
|
|
||||||
/sw # Fink
|
|
||||||
/opt/local # DarwinPorts
|
|
||||||
/opt/csw # Blastwave
|
|
||||||
/opt/lib/osl
|
|
||||||
)
|
|
||||||
|
|
||||||
FIND_PATH(OSL_INCLUDE_DIR
|
|
||||||
NAMES
|
|
||||||
OSL/oslversion.h
|
|
||||||
HINTS
|
|
||||||
${_osl_SEARCH_DIRS}
|
|
||||||
PATH_SUFFIXES
|
|
||||||
include
|
|
||||||
)
|
|
||||||
|
|
||||||
SET(_osl_LIBRARIES)
|
|
||||||
FOREACH(COMPONENT ${_osl_FIND_COMPONENTS})
|
|
||||||
STRING(TOUPPER ${COMPONENT} UPPERCOMPONENT)
|
|
||||||
|
|
||||||
FIND_LIBRARY(OSL_${UPPERCOMPONENT}_LIBRARY
|
|
||||||
NAMES
|
|
||||||
${COMPONENT}
|
|
||||||
HINTS
|
|
||||||
${_osl_SEARCH_DIRS}
|
|
||||||
PATH_SUFFIXES
|
|
||||||
lib64 lib
|
|
||||||
)
|
|
||||||
LIST(APPEND _osl_LIBRARIES "${OSL_${UPPERCOMPONENT}_LIBRARY}")
|
|
||||||
ENDFOREACH()
|
|
||||||
|
|
||||||
FIND_PROGRAM(OSL_COMPILER oslc
|
|
||||||
HINTS ${_osl_SEARCH_DIRS}
|
|
||||||
PATH_SUFFIXES bin)
|
|
||||||
|
|
||||||
# handle the QUIETLY and REQUIRED arguments and set OSL_FOUND to TRUE if
|
|
||||||
# all listed variables are TRUE
|
|
||||||
INCLUDE(FindPackageHandleStandardArgs)
|
|
||||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(OSL DEFAULT_MSG _osl_LIBRARIES OSL_INCLUDE_DIR OSL_COMPILER)
|
|
||||||
|
|
||||||
IF(OSL_FOUND)
|
|
||||||
SET(OSL_LIBRARIES ${_osl_LIBRARIES})
|
|
||||||
SET(OSL_INCLUDE_DIRS ${OSL_INCLUDE_DIR})
|
|
||||||
|
|
||||||
FILE(STRINGS "${OSL_INCLUDE_DIR}/OSL/oslversion.h" OSL_LIBRARY_VERSION_MAJOR
|
|
||||||
REGEX "^[ \t]*#define[ \t]+OSL_LIBRARY_VERSION_MAJOR[ \t]+[0-9]+.*$")
|
|
||||||
FILE(STRINGS "${OSL_INCLUDE_DIR}/OSL/oslversion.h" OSL_LIBRARY_VERSION_MINOR
|
|
||||||
REGEX "^[ \t]*#define[ \t]+OSL_LIBRARY_VERSION_MINOR[ \t]+[0-9]+.*$")
|
|
||||||
STRING(REGEX REPLACE ".*#define[ \t]+OSL_LIBRARY_VERSION_MAJOR[ \t]+([.0-9]+).*"
|
|
||||||
"\\1" OSL_LIBRARY_VERSION_MAJOR ${OSL_LIBRARY_VERSION_MAJOR})
|
|
||||||
STRING(REGEX REPLACE ".*#define[ \t]+OSL_LIBRARY_VERSION_MINOR[ \t]+([.0-9]+).*"
|
|
||||||
"\\1" OSL_LIBRARY_VERSION_MINOR ${OSL_LIBRARY_VERSION_MINOR})
|
|
||||||
ENDIF(OSL_FOUND)
|
|
||||||
|
|
||||||
MARK_AS_ADVANCED(
|
|
||||||
OSL_INCLUDE_DIR
|
|
||||||
)
|
|
||||||
FOREACH(COMPONENT ${_osl_FIND_COMPONENTS})
|
|
||||||
STRING(TOUPPER ${COMPONENT} UPPERCOMPONENT)
|
|
||||||
MARK_AS_ADVANCED(OSL_${UPPERCOMPONENT}_LIBRARY)
|
|
||||||
ENDFOREACH()
|
|
@@ -40,6 +40,7 @@ FIND_PATH(PCRE_INCLUDE_DIR pcre.h
|
|||||||
${_pcre_SEARCH_DIRS}
|
${_pcre_SEARCH_DIRS}
|
||||||
PATH_SUFFIXES
|
PATH_SUFFIXES
|
||||||
include
|
include
|
||||||
|
include
|
||||||
)
|
)
|
||||||
|
|
||||||
FIND_LIBRARY(PCRE_LIBRARY
|
FIND_LIBRARY(PCRE_LIBRARY
|
||||||
|
@@ -1,73 +0,0 @@
|
|||||||
# - Find PugiXML library
|
|
||||||
# Find the native PugiXML includes and library
|
|
||||||
# This module defines
|
|
||||||
# PUGIXML_INCLUDE_DIRS, where to find pugixml.hpp, Set when
|
|
||||||
# PugiXML is found.
|
|
||||||
# PUGIXML_LIBRARIES, libraries to link against to use PugiiXML.
|
|
||||||
# PUGIXML_ROOT_DIR, The base directory to search for PugiXML.
|
|
||||||
# This can also be an environment variable.
|
|
||||||
# PUGIXML_FOUND, If false, do not try to use PugiXML.
|
|
||||||
#
|
|
||||||
# also defined, but not for general use are
|
|
||||||
# PUGIXML_LIBRARY, where to find the PugiXML library.
|
|
||||||
|
|
||||||
#=============================================================================
|
|
||||||
# Copyright 2014 Blender Foundation.
|
|
||||||
#
|
|
||||||
# Distributed under the OSI-approved BSD License (the "License");
|
|
||||||
# see accompanying file Copyright.txt for details.
|
|
||||||
#
|
|
||||||
# This software is distributed WITHOUT ANY WARRANTY; without even the
|
|
||||||
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
||||||
# See the License for more information.
|
|
||||||
#=============================================================================
|
|
||||||
|
|
||||||
# If PUGIXML_ROOT_DIR was defined in the environment, use it.
|
|
||||||
IF(NOT PUGIXML_ROOT_DIR AND NOT $ENV{PUGIXML_ROOT_DIR} STREQUAL "")
|
|
||||||
SET(PUGIXML_ROOT_DIR $ENV{PUGIXML_ROOT_DIR})
|
|
||||||
ENDIF()
|
|
||||||
|
|
||||||
SET(_pugixml_SEARCH_DIRS
|
|
||||||
${PUGIXML_ROOT_DIR}
|
|
||||||
/usr/local
|
|
||||||
/sw # Fink
|
|
||||||
/opt/local # DarwinPorts
|
|
||||||
/opt/csw # Blastwave
|
|
||||||
/opt/lib/oiio
|
|
||||||
)
|
|
||||||
|
|
||||||
FIND_PATH(PUGIXML_INCLUDE_DIR
|
|
||||||
NAMES
|
|
||||||
pugixml.hpp
|
|
||||||
HINTS
|
|
||||||
${_pugixml_SEARCH_DIRS}
|
|
||||||
PATH_SUFFIXES
|
|
||||||
include
|
|
||||||
)
|
|
||||||
|
|
||||||
FIND_LIBRARY(PUGIXML_LIBRARY
|
|
||||||
NAMES
|
|
||||||
pugixml
|
|
||||||
HINTS
|
|
||||||
${_pugixml_SEARCH_DIRS}
|
|
||||||
PATH_SUFFIXES
|
|
||||||
lib64 lib
|
|
||||||
)
|
|
||||||
|
|
||||||
# handle the QUIETLY and REQUIRED arguments and set PUGIXML_FOUND to TRUE if
|
|
||||||
# all listed variables are TRUE
|
|
||||||
INCLUDE(FindPackageHandleStandardArgs)
|
|
||||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(PUGIXML DEFAULT_MSG
|
|
||||||
PUGIXML_LIBRARY PUGIXML_INCLUDE_DIR)
|
|
||||||
|
|
||||||
IF(PUGIXML_FOUND)
|
|
||||||
SET(PUGIXML_LIBRARIES ${PUGIXML_LIBRARY})
|
|
||||||
SET(PUGIXML_INCLUDE_DIRS ${PUGIXML_INCLUDE_DIR})
|
|
||||||
ELSE()
|
|
||||||
SET(PUGIXML_PUGIXML_FOUND FALSE)
|
|
||||||
ENDIF()
|
|
||||||
|
|
||||||
MARK_AS_ADVANCED(
|
|
||||||
PUGIXML_INCLUDE_DIR
|
|
||||||
PUGIXML_LIBRARY
|
|
||||||
)
|
|
@@ -14,7 +14,6 @@
|
|||||||
# PYTHON_INCLUDE_CONFIG_DIRS
|
# PYTHON_INCLUDE_CONFIG_DIRS
|
||||||
# PYTHON_LIBRARIES
|
# PYTHON_LIBRARIES
|
||||||
# PYTHON_LIBPATH, Used for installation
|
# PYTHON_LIBPATH, Used for installation
|
||||||
# PYTHON_SITE_PACKAGES, Used for installation (as a Python module)
|
|
||||||
# PYTHON_LINKFLAGS
|
# PYTHON_LINKFLAGS
|
||||||
# PYTHON_ROOT_DIR, The base directory to search for Python.
|
# PYTHON_ROOT_DIR, The base directory to search for Python.
|
||||||
# This can also be an environment variable.
|
# This can also be an environment variable.
|
||||||
@@ -66,14 +65,6 @@ IF(DEFINED PYTHON_LIBPATH)
|
|||||||
SET(_IS_LIB_PATH_DEF ON)
|
SET(_IS_LIB_PATH_DEF ON)
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
STRING(REPLACE "." "" _PYTHON_VERSION_NO_DOTS ${PYTHON_VERSION})
|
|
||||||
|
|
||||||
SET(_python_SEARCH_DIRS
|
|
||||||
${PYTHON_ROOT_DIR}
|
|
||||||
"$ENV{HOME}/py${_PYTHON_VERSION_NO_DOTS}"
|
|
||||||
"/opt/py${_PYTHON_VERSION_NO_DOTS}"
|
|
||||||
"/opt/lib/python-${PYTHON_VERSION}"
|
|
||||||
)
|
|
||||||
|
|
||||||
# only search for the dirs if we havn't already
|
# only search for the dirs if we havn't already
|
||||||
IF((NOT _IS_INC_DEF) OR (NOT _IS_INC_CONF_DEF) OR (NOT _IS_LIB_DEF) OR (NOT _IS_LIB_PATH_DEF))
|
IF((NOT _IS_INC_DEF) OR (NOT _IS_INC_CONF_DEF) OR (NOT _IS_LIB_DEF) OR (NOT _IS_LIB_PATH_DEF))
|
||||||
@@ -83,7 +74,14 @@ IF((NOT _IS_INC_DEF) OR (NOT _IS_INC_CONF_DEF) OR (NOT _IS_LIB_DEF) OR (NOT _IS_
|
|||||||
"dm;dmu;du;d" # debug
|
"dm;dmu;du;d" # debug
|
||||||
)
|
)
|
||||||
|
|
||||||
|
STRING(REPLACE "." "" _PYTHON_VERSION_NO_DOTS ${PYTHON_VERSION})
|
||||||
|
|
||||||
|
SET(_python_SEARCH_DIRS
|
||||||
|
${PYTHON_ROOT_DIR}
|
||||||
|
"$ENV{HOME}/py${_PYTHON_VERSION_NO_DOTS}"
|
||||||
|
"/opt/py${_PYTHON_VERSION_NO_DOTS}"
|
||||||
|
"/opt/lib/python-${PYTHON_VERSION}"
|
||||||
|
)
|
||||||
|
|
||||||
FOREACH(_CURRENT_ABI_FLAGS ${_python_ABI_FLAGS})
|
FOREACH(_CURRENT_ABI_FLAGS ${_python_ABI_FLAGS})
|
||||||
#IF(CMAKE_BUILD_TYPE STREQUAL Debug)
|
#IF(CMAKE_BUILD_TYPE STREQUAL Debug)
|
||||||
@@ -148,7 +146,6 @@ IF((NOT _IS_INC_DEF) OR (NOT _IS_INC_CONF_DEF) OR (NOT _IS_LIB_DEF) OR (NOT _IS_
|
|||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
IF(PYTHON_LIBRARY AND PYTHON_LIBPATH AND PYTHON_INCLUDE_DIR AND PYTHON_INCLUDE_CONFIG_DIR)
|
IF(PYTHON_LIBRARY AND PYTHON_LIBPATH AND PYTHON_INCLUDE_DIR AND PYTHON_INCLUDE_CONFIG_DIR)
|
||||||
SET(_PYTHON_ABI_FLAGS "${_CURRENT_ABI_FLAGS}")
|
|
||||||
break()
|
break()
|
||||||
ELSE()
|
ELSE()
|
||||||
# ensure we dont find values from 2 different ABI versions
|
# ensure we dont find values from 2 different ABI versions
|
||||||
@@ -171,6 +168,7 @@ IF((NOT _IS_INC_DEF) OR (NOT _IS_INC_CONF_DEF) OR (NOT _IS_LIB_DEF) OR (NOT _IS_
|
|||||||
UNSET(_CURRENT_PATH)
|
UNSET(_CURRENT_PATH)
|
||||||
|
|
||||||
UNSET(_python_ABI_FLAGS)
|
UNSET(_python_ABI_FLAGS)
|
||||||
|
UNSET(_python_SEARCH_DIRS)
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
UNSET(_IS_INC_DEF)
|
UNSET(_IS_INC_DEF)
|
||||||
@@ -189,41 +187,17 @@ IF(PYTHONLIBSUNIX_FOUND)
|
|||||||
SET(PYTHON_INCLUDE_DIRS ${PYTHON_INCLUDE_DIR} ${PYTHON_INCLUDE_CONFIG_DIR})
|
SET(PYTHON_INCLUDE_DIRS ${PYTHON_INCLUDE_DIR} ${PYTHON_INCLUDE_CONFIG_DIR})
|
||||||
SET(PYTHON_LIBRARIES ${PYTHON_LIBRARY})
|
SET(PYTHON_LIBRARIES ${PYTHON_LIBRARY})
|
||||||
|
|
||||||
FIND_FILE(PYTHON_SITE_PACKAGES
|
|
||||||
NAMES
|
|
||||||
# debian specific
|
|
||||||
dist-packages
|
|
||||||
site-packages
|
|
||||||
HINTS
|
|
||||||
${PYTHON_LIBPATH}/python${PYTHON_VERSION}
|
|
||||||
)
|
|
||||||
|
|
||||||
# we need this for installation
|
# we need this for installation
|
||||||
# XXX No more valid with debian-like py3.4 packages...
|
# XXX No more valid with debian-like py3.4 packages...
|
||||||
# GET_FILENAME_COMPONENT(PYTHON_LIBPATH ${PYTHON_LIBRARY} PATH)
|
# GET_FILENAME_COMPONENT(PYTHON_LIBPATH ${PYTHON_LIBRARY} PATH)
|
||||||
|
|
||||||
# not required for build, just used when bundling Python.
|
# not used
|
||||||
FIND_PROGRAM(
|
# SET(PYTHON_BINARY ${PYTHON_EXECUTABLE} CACHE STRING "")
|
||||||
PYTHON_EXECUTABLE
|
|
||||||
NAMES
|
|
||||||
"python${PYTHON_VERSION}${_PYTHON_ABI_FLAGS}"
|
|
||||||
"python${PYTHON_VERSION}"
|
|
||||||
"python"
|
|
||||||
HINTS
|
|
||||||
${_python_SEARCH_DIRS}
|
|
||||||
PATH_SUFFIXES bin
|
|
||||||
)
|
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
UNSET(_PYTHON_VERSION_NO_DOTS)
|
|
||||||
UNSET(_PYTHON_ABI_FLAGS)
|
|
||||||
UNSET(_python_SEARCH_DIRS)
|
|
||||||
|
|
||||||
MARK_AS_ADVANCED(
|
MARK_AS_ADVANCED(
|
||||||
PYTHON_INCLUDE_DIR
|
PYTHON_INCLUDE_DIR
|
||||||
PYTHON_INCLUDE_CONFIG_DIR
|
PYTHON_INCLUDE_CONFIG_DIR
|
||||||
PYTHON_LIBRARY
|
PYTHON_LIBRARY
|
||||||
PYTHON_LIBPATH
|
PYTHON_LIBPATH
|
||||||
PYTHON_SITE_PACKAGES
|
|
||||||
PYTHON_EXECUTABLE
|
|
||||||
)
|
)
|
||||||
|
@@ -1,72 +0,0 @@
|
|||||||
# - Find SDL library
|
|
||||||
# Find the native SDL includes and library
|
|
||||||
# This module defines
|
|
||||||
# SDL2_INCLUDE_DIRS, where to find SDL.h, Set when SDL2_INCLUDE_DIR is found.
|
|
||||||
# SDL2_LIBRARIES, libraries to link against to use SDL.
|
|
||||||
# SDL2_ROOT_DIR, The base directory to search for SDL.
|
|
||||||
# This can also be an environment variable.
|
|
||||||
# SDL2_FOUND, If false, do not try to use SDL.
|
|
||||||
#
|
|
||||||
# also defined, but not for general use are
|
|
||||||
# SDL2_LIBRARY, where to find the SDL library.
|
|
||||||
|
|
||||||
#=============================================================================
|
|
||||||
# Copyright 2015 Blender Foundation.
|
|
||||||
#
|
|
||||||
# Distributed under the OSI-approved BSD License (the "License");
|
|
||||||
# see accompanying file Copyright.txt for details.
|
|
||||||
#
|
|
||||||
# This software is distributed WITHOUT ANY WARRANTY; without even the
|
|
||||||
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
||||||
# See the License for more information.
|
|
||||||
#=============================================================================
|
|
||||||
|
|
||||||
# If SDL2_ROOT_DIR was defined in the environment, use it.
|
|
||||||
IF(NOT SDL2_ROOT_DIR AND NOT $ENV{SDL2_ROOT_DIR} STREQUAL "")
|
|
||||||
SET(SDL2_ROOT_DIR $ENV{SDL2_ROOT_DIR})
|
|
||||||
ENDIF()
|
|
||||||
|
|
||||||
SET(_sdl2_SEARCH_DIRS
|
|
||||||
${SDL2_ROOT_DIR}
|
|
||||||
~/Library/Frameworks
|
|
||||||
/Library/Frameworks
|
|
||||||
/usr/local
|
|
||||||
/usr
|
|
||||||
/sw # Fink
|
|
||||||
/opt/local # DarwinPorts
|
|
||||||
/opt/csw # Blastwave
|
|
||||||
)
|
|
||||||
|
|
||||||
FIND_PATH(SDL2_INCLUDE_DIR
|
|
||||||
NAMES
|
|
||||||
SDL.h
|
|
||||||
HINTS
|
|
||||||
${_sdl2_SEARCH_DIRS}
|
|
||||||
PATH_SUFFIXES
|
|
||||||
include/SDL2 include
|
|
||||||
)
|
|
||||||
|
|
||||||
FIND_LIBRARY(SDL2_LIBRARY
|
|
||||||
NAMES
|
|
||||||
SDL2
|
|
||||||
HINTS
|
|
||||||
${_sdl2_SEARCH_DIRS}
|
|
||||||
PATH_SUFFIXES
|
|
||||||
lib64 lib
|
|
||||||
)
|
|
||||||
|
|
||||||
# handle the QUIETLY and REQUIRED arguments and set SDL2_FOUND to TRUE if
|
|
||||||
# all listed variables are TRUE
|
|
||||||
INCLUDE(FindPackageHandleStandardArgs)
|
|
||||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDL2 DEFAULT_MSG
|
|
||||||
SDL2_LIBRARY SDL2_INCLUDE_DIR)
|
|
||||||
|
|
||||||
IF(SDL2_FOUND)
|
|
||||||
SET(SDL2_LIBRARIES ${SDL2_LIBRARY})
|
|
||||||
SET(SDL2_INCLUDE_DIRS ${SDL2_INCLUDE_DIR})
|
|
||||||
ENDIF(SDL2_FOUND)
|
|
||||||
|
|
||||||
MARK_AS_ADVANCED(
|
|
||||||
SDL2_INCLUDE_DIR
|
|
||||||
SDL2_LIBRARY
|
|
||||||
)
|
|
@@ -32,8 +32,6 @@ macro(BLENDER_SRC_GTEST NAME SRC EXTRA_LIBS)
|
|||||||
bf_testing_main
|
bf_testing_main
|
||||||
bf_intern_guardedalloc
|
bf_intern_guardedalloc
|
||||||
extern_gtest
|
extern_gtest
|
||||||
# needed for glog
|
|
||||||
${PTHREADS_LIBRARIES}
|
|
||||||
extern_glog)
|
extern_glog)
|
||||||
set_target_properties(${NAME}_test PROPERTIES
|
set_target_properties(${NAME}_test PROPERTIES
|
||||||
RUNTIME_OUTPUT_DIRECTORY "${TESTS_OUTPUT_DIR}"
|
RUNTIME_OUTPUT_DIRECTORY "${TESTS_OUTPUT_DIR}"
|
||||||
|
@@ -60,8 +60,7 @@ if(EXISTS ${SOURCE_DIR}/.git)
|
|||||||
execute_process(COMMAND git log HEAD..@{u}
|
execute_process(COMMAND git log HEAD..@{u}
|
||||||
WORKING_DIRECTORY ${SOURCE_DIR}
|
WORKING_DIRECTORY ${SOURCE_DIR}
|
||||||
OUTPUT_VARIABLE _git_below_check
|
OUTPUT_VARIABLE _git_below_check
|
||||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||||
ERROR_QUIET)
|
|
||||||
if(NOT _git_below_check STREQUAL "")
|
if(NOT _git_below_check STREQUAL "")
|
||||||
# If there're commits between HEAD and upstream this means
|
# If there're commits between HEAD and upstream this means
|
||||||
# that we're reset-ed to older revision. Use it's hash then.
|
# that we're reset-ed to older revision. Use it's hash then.
|
||||||
|
@@ -28,17 +28,13 @@ if not sys.version.startswith("3"):
|
|||||||
sys.version.partition(" ")[0])
|
sys.version.partition(" ")[0])
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
from cmake_consistency_check_config import (
|
from cmake_consistency_check_config import IGNORE, UTF8_CHECK, SOURCE_DIR
|
||||||
IGNORE,
|
|
||||||
UTF8_CHECK,
|
|
||||||
SOURCE_DIR,
|
|
||||||
BUILD_DIR,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
import os
|
import os
|
||||||
from os.path import join, dirname, normpath, splitext
|
from os.path import join, dirname, normpath, splitext
|
||||||
|
|
||||||
|
print("Scanning:", SOURCE_DIR)
|
||||||
|
|
||||||
global_h = set()
|
global_h = set()
|
||||||
global_c = set()
|
global_c = set()
|
||||||
global_refs = {}
|
global_refs = {}
|
||||||
@@ -138,7 +134,6 @@ def cmake_get_src(f):
|
|||||||
|
|
||||||
if found:
|
if found:
|
||||||
cmake_base = dirname(f)
|
cmake_base = dirname(f)
|
||||||
cmake_base_bin = os.path.join(BUILD_DIR, os.path.relpath(cmake_base, SOURCE_DIR))
|
|
||||||
|
|
||||||
while it is not None:
|
while it is not None:
|
||||||
i += 1
|
i += 1
|
||||||
@@ -159,8 +154,6 @@ def cmake_get_src(f):
|
|||||||
|
|
||||||
# replace dirs
|
# replace dirs
|
||||||
l = l.replace("${CMAKE_CURRENT_SOURCE_DIR}", cmake_base)
|
l = l.replace("${CMAKE_CURRENT_SOURCE_DIR}", cmake_base)
|
||||||
l = l.replace("${CMAKE_CURRENT_BINARY_DIR}", cmake_base_bin)
|
|
||||||
l = l.strip('"')
|
|
||||||
|
|
||||||
if not l:
|
if not l:
|
||||||
pass
|
pass
|
||||||
@@ -194,22 +187,17 @@ def cmake_get_src(f):
|
|||||||
pass
|
pass
|
||||||
elif new_file.endswith(".osl"): # open shading language
|
elif new_file.endswith(".osl"): # open shading language
|
||||||
pass
|
pass
|
||||||
elif new_file.endswith(".glsl"):
|
|
||||||
pass
|
|
||||||
else:
|
else:
|
||||||
raise Exception("unknown file type - not c or h %s -> %s" % (f, new_file))
|
raise Exception("unknown file type - not c or h %s -> %s" % (f, new_file))
|
||||||
|
|
||||||
elif context_name == "INC":
|
elif context_name == "INC":
|
||||||
if new_file.startswith(BUILD_DIR):
|
if os.path.isdir(new_file):
|
||||||
# assume generated path
|
|
||||||
pass
|
|
||||||
elif os.path.isdir(new_file):
|
|
||||||
new_path_rel = os.path.relpath(new_file, cmake_base)
|
new_path_rel = os.path.relpath(new_file, cmake_base)
|
||||||
|
|
||||||
if new_path_rel != l:
|
if new_path_rel != l:
|
||||||
print("overly relative path:\n %s:%d\n %s\n %s" % (f, i, l, new_path_rel))
|
print("overly relative path:\n %s:%d\n %s\n %s" % (f, i, l, new_path_rel))
|
||||||
|
|
||||||
# # Save time. just replace the line
|
## Save time. just replace the line
|
||||||
# replace_line(f, i - 1, new_path_rel)
|
# replace_line(f, i - 1, new_path_rel)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
@@ -240,6 +228,10 @@ def cmake_get_src(f):
|
|||||||
filen.close()
|
filen.close()
|
||||||
|
|
||||||
|
|
||||||
|
for cmake in source_list(SOURCE_DIR, is_cmake):
|
||||||
|
cmake_get_src(cmake)
|
||||||
|
|
||||||
|
|
||||||
def is_ignore(f):
|
def is_ignore(f):
|
||||||
for ig in IGNORE:
|
for ig in IGNORE:
|
||||||
if ig in f:
|
if ig in f:
|
||||||
@@ -247,83 +239,73 @@ def is_ignore(f):
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
def main():
|
# First do stupid check, do these files exist?
|
||||||
|
print("\nChecking for missing references:")
|
||||||
|
is_err = False
|
||||||
|
errs = []
|
||||||
|
for f in (global_h | global_c):
|
||||||
|
if f.endswith("dna.c"):
|
||||||
|
continue
|
||||||
|
|
||||||
print("Scanning:", SOURCE_DIR)
|
if not os.path.exists(f):
|
||||||
|
refs = global_refs[f]
|
||||||
|
if refs:
|
||||||
|
for cf, i in refs:
|
||||||
|
errs.append((cf, i))
|
||||||
|
else:
|
||||||
|
raise Exception("CMake referenecs missing, internal error, aborting!")
|
||||||
|
is_err = True
|
||||||
|
|
||||||
for cmake in source_list(SOURCE_DIR, is_cmake):
|
errs.sort()
|
||||||
cmake_get_src(cmake)
|
errs.reverse()
|
||||||
|
for cf, i in errs:
|
||||||
# First do stupid check, do these files exist?
|
print("%s:%d" % (cf, i))
|
||||||
print("\nChecking for missing references:")
|
# Write a 'sed' script, useful if we get a lot of these
|
||||||
is_err = False
|
# print("sed '%dd' '%s' > '%s.tmp' ; mv '%s.tmp' '%s'" % (i, cf, cf, cf, cf))
|
||||||
errs = []
|
|
||||||
for f in (global_h | global_c):
|
|
||||||
if f.startswith(BUILD_DIR):
|
|
||||||
continue
|
|
||||||
|
|
||||||
if not os.path.exists(f):
|
|
||||||
refs = global_refs[f]
|
|
||||||
if refs:
|
|
||||||
for cf, i in refs:
|
|
||||||
errs.append((cf, i))
|
|
||||||
else:
|
|
||||||
raise Exception("CMake referenecs missing, internal error, aborting!")
|
|
||||||
is_err = True
|
|
||||||
|
|
||||||
errs.sort()
|
|
||||||
errs.reverse()
|
|
||||||
for cf, i in errs:
|
|
||||||
print("%s:%d" % (cf, i))
|
|
||||||
# Write a 'sed' script, useful if we get a lot of these
|
|
||||||
# print("sed '%dd' '%s' > '%s.tmp' ; mv '%s.tmp' '%s'" % (i, cf, cf, cf, cf))
|
|
||||||
|
|
||||||
|
|
||||||
if is_err:
|
if is_err:
|
||||||
raise Exception("CMake referenecs missing files, aborting!")
|
raise Exception("CMake referenecs missing files, aborting!")
|
||||||
del is_err
|
del is_err
|
||||||
del errs
|
del errs
|
||||||
|
|
||||||
# now check on files not accounted for.
|
# now check on files not accounted for.
|
||||||
print("\nC/C++ Files CMake doesnt know about...")
|
print("\nC/C++ Files CMake doesnt know about...")
|
||||||
for cf in sorted(source_list(SOURCE_DIR, is_c)):
|
for cf in sorted(source_list(SOURCE_DIR, is_c)):
|
||||||
if not is_ignore(cf):
|
if not is_ignore(cf):
|
||||||
if cf not in global_c:
|
if cf not in global_c:
|
||||||
print("missing_c: ", cf)
|
print("missing_c: ", cf)
|
||||||
|
|
||||||
# check if automake builds a corrasponding .o file.
|
# check if automake builds a corrasponding .o file.
|
||||||
'''
|
'''
|
||||||
if cf in global_c:
|
if cf in global_c:
|
||||||
out1 = os.path.splitext(cf)[0] + ".o"
|
out1 = os.path.splitext(cf)[0] + ".o"
|
||||||
out2 = os.path.splitext(cf)[0] + ".Po"
|
out2 = os.path.splitext(cf)[0] + ".Po"
|
||||||
out2_dir, out2_file = out2 = os.path.split(out2)
|
out2_dir, out2_file = out2 = os.path.split(out2)
|
||||||
out2 = os.path.join(out2_dir, ".deps", out2_file)
|
out2 = os.path.join(out2_dir, ".deps", out2_file)
|
||||||
if not os.path.exists(out1) and not os.path.exists(out2):
|
if not os.path.exists(out1) and not os.path.exists(out2):
|
||||||
print("bad_c: ", cf)
|
print("bad_c: ", cf)
|
||||||
'''
|
'''
|
||||||
|
|
||||||
print("\nC/C++ Headers CMake doesnt know about...")
|
print("\nC/C++ Headers CMake doesnt know about...")
|
||||||
for hf in sorted(source_list(SOURCE_DIR, is_c_header)):
|
for hf in sorted(source_list(SOURCE_DIR, is_c_header)):
|
||||||
if not is_ignore(hf):
|
if not is_ignore(hf):
|
||||||
if hf not in global_h:
|
if hf not in global_h:
|
||||||
print("missing_h: ", hf)
|
print("missing_h: ", hf)
|
||||||
|
|
||||||
if UTF8_CHECK:
|
if UTF8_CHECK:
|
||||||
# test encoding
|
# test encoding
|
||||||
import traceback
|
import traceback
|
||||||
for files in (global_c, global_h):
|
for files in (global_c, global_h):
|
||||||
for f in sorted(files):
|
for f in sorted(files):
|
||||||
if os.path.exists(f):
|
if os.path.exists(f):
|
||||||
# ignore outside of our source tree
|
# ignore outside of our source tree
|
||||||
if "extern" not in f:
|
if "extern" not in f:
|
||||||
i = 1
|
i = 1
|
||||||
try:
|
try:
|
||||||
for l in open(f, "r", encoding="utf8"):
|
for l in open(f, "r", encoding="utf8"):
|
||||||
i += 1
|
i += 1
|
||||||
except UnicodeDecodeError:
|
except:
|
||||||
print("Non utf8: %s:%d" % (f, i))
|
print("Non utf8: %s:%d" % (f, i))
|
||||||
if i > 1:
|
if i > 1:
|
||||||
traceback.print_exc()
|
traceback.print_exc()
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
main()
|
|
||||||
|
@@ -74,6 +74,3 @@ IGNORE = (
|
|||||||
UTF8_CHECK = True
|
UTF8_CHECK = True
|
||||||
|
|
||||||
SOURCE_DIR = os.path.normpath(os.path.abspath(os.path.normpath(os.path.join(os.path.dirname(__file__), "..", ".."))))
|
SOURCE_DIR = os.path.normpath(os.path.abspath(os.path.normpath(os.path.join(os.path.dirname(__file__), "..", ".."))))
|
||||||
|
|
||||||
# doesn't have to exist, just use as reference
|
|
||||||
BUILD_DIR = os.path.normpath(os.path.abspath(os.path.normpath(os.path.join(SOURCE_DIR, "..", "build"))))
|
|
||||||
|
@@ -29,20 +29,18 @@ Example linux usage
|
|||||||
Windows not supported so far
|
Windows not supported so far
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from project_info import (
|
from project_info import (SIMPLE_PROJECTFILE,
|
||||||
SIMPLE_PROJECTFILE,
|
SOURCE_DIR,
|
||||||
SOURCE_DIR,
|
CMAKE_DIR,
|
||||||
CMAKE_DIR,
|
PROJECT_DIR,
|
||||||
PROJECT_DIR,
|
source_list,
|
||||||
source_list,
|
is_project_file,
|
||||||
is_project_file,
|
is_c_header,
|
||||||
is_c_header,
|
# is_py,
|
||||||
# is_py,
|
cmake_advanced_info,
|
||||||
cmake_advanced_info,
|
cmake_compiler_defines,
|
||||||
cmake_compiler_defines,
|
project_name_get,
|
||||||
cmake_cache_var,
|
)
|
||||||
project_name_get,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
import os
|
import os
|
||||||
@@ -72,10 +70,6 @@ def create_nb_project_main():
|
|||||||
# be tricky, get the project name from git if we can!
|
# be tricky, get the project name from git if we can!
|
||||||
PROJECT_NAME = project_name_get()
|
PROJECT_NAME = project_name_get()
|
||||||
|
|
||||||
|
|
||||||
make_exe = cmake_cache_var("CMAKE_MAKE_PROGRAM")
|
|
||||||
make_exe_basename = os.path.basename(make_exe)
|
|
||||||
|
|
||||||
# --------------- NB spesific
|
# --------------- NB spesific
|
||||||
defines = [("%s=%s" % cdef) if cdef[1] else cdef[0] for cdef in defines]
|
defines = [("%s=%s" % cdef) if cdef[1] else cdef[0] for cdef in defines]
|
||||||
defines += [cdef.replace("#define", "").strip() for cdef in cmake_compiler_defines()]
|
defines += [cdef.replace("#define", "").strip() for cdef in cmake_compiler_defines()]
|
||||||
@@ -136,9 +130,9 @@ def create_nb_project_main():
|
|||||||
f = open(join(PROJECT_DIR_NB, "configurations.xml"), 'w')
|
f = open(join(PROJECT_DIR_NB, "configurations.xml"), 'w')
|
||||||
|
|
||||||
f.write('<?xml version="1.0" encoding="UTF-8"?>\n')
|
f.write('<?xml version="1.0" encoding="UTF-8"?>\n')
|
||||||
f.write('<configurationDescriptor version="95">\n')
|
f.write('<configurationDescriptor version="94">\n')
|
||||||
f.write(' <logicalFolder name="root" displayName="root" projectFiles="true" kind="ROOT">\n')
|
f.write(' <logicalFolder name="root" displayName="root" projectFiles="true" kind="ROOT">\n')
|
||||||
f.write(' <df root="%s" name="0">\n' % SOURCE_DIR) # base_root_rel
|
f.write(' <df name="0" root="%s">\n' % SOURCE_DIR) # base_root_rel
|
||||||
|
|
||||||
# write files!
|
# write files!
|
||||||
files_rel_local = [normpath(relpath(join(CMAKE_DIR, path), SOURCE_DIR)) for path in files_rel]
|
files_rel_local = [normpath(relpath(join(CMAKE_DIR, path), SOURCE_DIR)) for path in files_rel]
|
||||||
@@ -190,27 +184,16 @@ def create_nb_project_main():
|
|||||||
|
|
||||||
f.write(' <toolsSet>\n')
|
f.write(' <toolsSet>\n')
|
||||||
f.write(' <compilerSet>default</compilerSet>\n')
|
f.write(' <compilerSet>default</compilerSet>\n')
|
||||||
f.write(' <dependencyChecking>false</dependencyChecking>\n')
|
|
||||||
f.write(' <rebuildPropChanged>false</rebuildPropChanged>\n')
|
|
||||||
f.write(' </toolsSet>\n')
|
f.write(' </toolsSet>\n')
|
||||||
f.write(' <codeAssistance>\n')
|
f.write(' <dependencyChecking>false</dependencyChecking>\n')
|
||||||
f.write(' </codeAssistance>\n')
|
f.write(' <rebuildPropChanged>false</rebuildPropChanged>\n')
|
||||||
f.write(' <makefileType>\n')
|
f.write(' <makefileType>\n')
|
||||||
|
|
||||||
f.write(' <makeTool>\n')
|
f.write(' <makeTool>\n')
|
||||||
f.write(' <buildCommandWorkingDir>.</buildCommandWorkingDir>\n')
|
f.write(' <buildCommandWorkingDir>.</buildCommandWorkingDir>\n')
|
||||||
|
f.write(' <buildCommand>${MAKE} -f Makefile</buildCommand>\n')
|
||||||
if make_exe_basename == "ninja":
|
f.write(' <cleanCommand>${MAKE} -f Makefile clean</cleanCommand>\n')
|
||||||
build_cmd = "ninja"
|
|
||||||
clean_cmd = "ninja -t clean"
|
|
||||||
else:
|
|
||||||
build_cmd = "${MAKE} -f Makefile"
|
|
||||||
clean_cmd = "${MAKE} -f Makefile clean"
|
|
||||||
|
|
||||||
f.write(' <buildCommand>%s</buildCommand>\n' % build_cmd)
|
|
||||||
f.write(' <cleanCommand>%s</cleanCommand>\n' % clean_cmd)
|
|
||||||
f.write(' <executablePath>./bin/blender</executablePath>\n')
|
f.write(' <executablePath>./bin/blender</executablePath>\n')
|
||||||
del build_cmd, clean_cmd
|
|
||||||
|
|
||||||
def write_toolinfo():
|
def write_toolinfo():
|
||||||
f.write(' <incDir>\n')
|
f.write(' <incDir>\n')
|
||||||
@@ -237,11 +220,10 @@ def create_nb_project_main():
|
|||||||
f.write(' \n')
|
f.write(' \n')
|
||||||
|
|
||||||
for path in files_rel_local:
|
for path in files_rel_local:
|
||||||
is_c = path.endswith(".c")
|
|
||||||
f.write(' <item path="%s"\n' % path)
|
f.write(' <item path="%s"\n' % path)
|
||||||
f.write(' ex="false"\n')
|
f.write(' ex="false"\n')
|
||||||
f.write(' tool="%d"\n' % (0 if is_c else 1))
|
f.write(' tool="1"\n')
|
||||||
f.write(' flavor2="%d">\n' % (3 if is_c else 0))
|
f.write(' flavor2="0">\n')
|
||||||
f.write(' </item>\n')
|
f.write(' </item>\n')
|
||||||
|
|
||||||
f.write(' <runprofile version="9">\n')
|
f.write(' <runprofile version="9">\n')
|
||||||
|
@@ -22,27 +22,26 @@
|
|||||||
|
|
||||||
# <pep8 compliant>
|
# <pep8 compliant>
|
||||||
|
|
||||||
r"""
|
"""
|
||||||
Example Linux usage:
|
|
||||||
python ~/blender-git/blender/build_files/cmake/cmake_qtcreator_project.py ~/blender-git/cmake
|
|
||||||
|
|
||||||
Example Win32 usage:
|
Example Win32 usage:
|
||||||
c:\Python32\python.exe c:\blender_dev\blender\build_files\cmake\cmake_qtcreator_project.py c:\blender_dev\cmake_build
|
c:\Python32\python.exe c:\blender_dev\blender\build_files\cmake\cmake_qtcreator_project.py c:\blender_dev\cmake_build
|
||||||
|
|
||||||
|
example linux usage
|
||||||
|
python .~/blender-git/blender/build_files/cmake/cmake_qtcreator_project.py ~/blender-git/cmake
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from project_info import (
|
from project_info import (SIMPLE_PROJECTFILE,
|
||||||
SIMPLE_PROJECTFILE,
|
SOURCE_DIR,
|
||||||
SOURCE_DIR,
|
# CMAKE_DIR,
|
||||||
# CMAKE_DIR,
|
PROJECT_DIR,
|
||||||
PROJECT_DIR,
|
source_list,
|
||||||
source_list,
|
is_project_file,
|
||||||
is_project_file,
|
is_c_header,
|
||||||
is_c_header,
|
is_py,
|
||||||
is_py,
|
cmake_advanced_info,
|
||||||
cmake_advanced_info,
|
cmake_compiler_defines,
|
||||||
cmake_compiler_defines,
|
project_name_get,
|
||||||
project_name_get,
|
)
|
||||||
)
|
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
@@ -64,19 +63,18 @@ def create_qtc_project_main():
|
|||||||
if SIMPLE_PROJECTFILE:
|
if SIMPLE_PROJECTFILE:
|
||||||
# --- qtcreator specific, simple format
|
# --- qtcreator specific, simple format
|
||||||
PROJECT_NAME = "Blender"
|
PROJECT_NAME = "Blender"
|
||||||
FILE_NAME = PROJECT_NAME.lower()
|
with open(os.path.join(PROJECT_DIR, "%s.files" % PROJECT_NAME), 'w') as f:
|
||||||
with open(os.path.join(PROJECT_DIR, "%s.files" % FILE_NAME), 'w') as f:
|
|
||||||
f.write("\n".join(files_rel))
|
f.write("\n".join(files_rel))
|
||||||
|
|
||||||
with open(os.path.join(PROJECT_DIR, "%s.includes" % FILE_NAME), 'w') as f:
|
with open(os.path.join(PROJECT_DIR, "%s.includes" % PROJECT_NAME), 'w') as f:
|
||||||
f.write("\n".join(sorted(list(set(os.path.dirname(f)
|
f.write("\n".join(sorted(list(set(os.path.dirname(f)
|
||||||
for f in files_rel if is_c_header(f))))))
|
for f in files_rel if is_c_header(f))))))
|
||||||
|
|
||||||
qtc_prj = os.path.join(PROJECT_DIR, "%s.creator" % FILE_NAME)
|
qtc_prj = os.path.join(PROJECT_DIR, "%s.creator" % PROJECT_NAME)
|
||||||
with open(qtc_prj, 'w') as f:
|
with open(qtc_prj, 'w') as f:
|
||||||
f.write("[General]\n")
|
f.write("[General]\n")
|
||||||
|
|
||||||
qtc_cfg = os.path.join(PROJECT_DIR, "%s.config" % FILE_NAME)
|
qtc_cfg = os.path.join(PROJECT_DIR, "%s.config" % PROJECT_NAME)
|
||||||
if not os.path.exists(qtc_cfg):
|
if not os.path.exists(qtc_cfg):
|
||||||
with open(qtc_cfg, 'w') as f:
|
with open(qtc_cfg, 'w') as f:
|
||||||
f.write("// ADD PREDEFINED MACROS HERE!\n")
|
f.write("// ADD PREDEFINED MACROS HERE!\n")
|
||||||
|
@@ -16,7 +16,6 @@ set(WITH_CODEC_SNDFILE OFF CACHE BOOL "" FORCE)
|
|||||||
set(WITH_CYCLES OFF CACHE BOOL "" FORCE)
|
set(WITH_CYCLES OFF CACHE BOOL "" FORCE)
|
||||||
set(WITH_FFTW3 OFF CACHE BOOL "" FORCE)
|
set(WITH_FFTW3 OFF CACHE BOOL "" FORCE)
|
||||||
set(WITH_LIBMV OFF CACHE BOOL "" FORCE)
|
set(WITH_LIBMV OFF CACHE BOOL "" FORCE)
|
||||||
set(WITH_LLVM OFF CACHE BOOL "" FORCE)
|
|
||||||
set(WITH_GAMEENGINE OFF CACHE BOOL "" FORCE)
|
set(WITH_GAMEENGINE OFF CACHE BOOL "" FORCE)
|
||||||
set(WITH_COMPOSITOR OFF CACHE BOOL "" FORCE)
|
set(WITH_COMPOSITOR OFF CACHE BOOL "" FORCE)
|
||||||
set(WITH_FREESTYLE OFF CACHE BOOL "" FORCE)
|
set(WITH_FREESTYLE OFF CACHE BOOL "" FORCE)
|
||||||
|
@@ -104,48 +104,24 @@ macro(file_list_suffix
|
|||||||
endmacro()
|
endmacro()
|
||||||
|
|
||||||
|
|
||||||
function(target_link_libraries_optimized
|
macro(target_link_libraries_optimized TARGET LIBS)
|
||||||
TARGET
|
|
||||||
LIBS
|
|
||||||
)
|
|
||||||
|
|
||||||
foreach(_LIB ${LIBS})
|
foreach(_LIB ${LIBS})
|
||||||
target_link_libraries(${TARGET} optimized "${_LIB}")
|
target_link_libraries(${TARGET} optimized "${_LIB}")
|
||||||
endforeach()
|
endforeach()
|
||||||
endfunction()
|
unset(_LIB)
|
||||||
|
endmacro()
|
||||||
function(target_link_libraries_debug
|
|
||||||
TARGET
|
|
||||||
LIBS
|
|
||||||
)
|
|
||||||
|
|
||||||
|
macro(target_link_libraries_debug TARGET LIBS)
|
||||||
foreach(_LIB ${LIBS})
|
foreach(_LIB ${LIBS})
|
||||||
target_link_libraries(${TARGET} debug "${_LIB}")
|
target_link_libraries(${TARGET} debug "${_LIB}")
|
||||||
endforeach()
|
endforeach()
|
||||||
endfunction()
|
unset(_LIB)
|
||||||
|
endmacro()
|
||||||
function(target_link_libraries_decoupled
|
|
||||||
target
|
|
||||||
libraries_var
|
|
||||||
)
|
|
||||||
|
|
||||||
if(NOT MSVC)
|
|
||||||
target_link_libraries(${target} ${${libraries_var}})
|
|
||||||
else()
|
|
||||||
# For MSVC we link to different libraries depending whether
|
|
||||||
# release or debug target is being built.
|
|
||||||
file_list_suffix(_libraries_debug "${${libraries_var}}" "_d")
|
|
||||||
target_link_libraries_debug(${target} "${_libraries_debug}")
|
|
||||||
target_link_libraries_optimized(${target} "${${libraries_var}}")
|
|
||||||
endif()
|
|
||||||
endfunction()
|
|
||||||
|
|
||||||
# Nicer makefiles with -I/1/foo/ instead of -I/1/2/3/../../foo/
|
# Nicer makefiles with -I/1/foo/ instead of -I/1/2/3/../../foo/
|
||||||
# use it instead of include_directories()
|
# use it instead of include_directories()
|
||||||
function(blender_include_dirs
|
macro(blender_include_dirs
|
||||||
includes
|
includes)
|
||||||
)
|
|
||||||
|
|
||||||
set(_ALL_INCS "")
|
set(_ALL_INCS "")
|
||||||
foreach(_INC ${ARGV})
|
foreach(_INC ${ARGV})
|
||||||
get_filename_component(_ABS_INC ${_INC} ABSOLUTE)
|
get_filename_component(_ABS_INC ${_INC} ABSOLUTE)
|
||||||
@@ -156,12 +132,13 @@ function(blender_include_dirs
|
|||||||
##endif()
|
##endif()
|
||||||
endforeach()
|
endforeach()
|
||||||
include_directories(${_ALL_INCS})
|
include_directories(${_ALL_INCS})
|
||||||
endfunction()
|
unset(_INC)
|
||||||
|
unset(_ABS_INC)
|
||||||
function(blender_include_dirs_sys
|
unset(_ALL_INCS)
|
||||||
includes
|
endmacro()
|
||||||
)
|
|
||||||
|
|
||||||
|
macro(blender_include_dirs_sys
|
||||||
|
includes)
|
||||||
set(_ALL_INCS "")
|
set(_ALL_INCS "")
|
||||||
foreach(_INC ${ARGV})
|
foreach(_INC ${ARGV})
|
||||||
get_filename_component(_ABS_INC ${_INC} ABSOLUTE)
|
get_filename_component(_ABS_INC ${_INC} ABSOLUTE)
|
||||||
@@ -171,11 +148,13 @@ function(blender_include_dirs_sys
|
|||||||
##endif()
|
##endif()
|
||||||
endforeach()
|
endforeach()
|
||||||
include_directories(SYSTEM ${_ALL_INCS})
|
include_directories(SYSTEM ${_ALL_INCS})
|
||||||
endfunction()
|
unset(_INC)
|
||||||
|
unset(_ABS_INC)
|
||||||
|
unset(_ALL_INCS)
|
||||||
|
endmacro()
|
||||||
|
|
||||||
function(blender_source_group
|
macro(blender_source_group
|
||||||
sources
|
sources)
|
||||||
)
|
|
||||||
|
|
||||||
# Group by location on disk
|
# Group by location on disk
|
||||||
source_group("Source Files" FILES CMakeLists.txt)
|
source_group("Source Files" FILES CMakeLists.txt)
|
||||||
@@ -185,23 +164,23 @@ function(blender_source_group
|
|||||||
if((${_SRC_EXT} MATCHES ".h") OR
|
if((${_SRC_EXT} MATCHES ".h") OR
|
||||||
(${_SRC_EXT} MATCHES ".hpp") OR
|
(${_SRC_EXT} MATCHES ".hpp") OR
|
||||||
(${_SRC_EXT} MATCHES ".hh"))
|
(${_SRC_EXT} MATCHES ".hh"))
|
||||||
|
source_group("Header Files" FILES ${_SRC})
|
||||||
set(GROUP_ID "Header Files")
|
|
||||||
else()
|
else()
|
||||||
set(GROUP_ID "Source Files")
|
source_group("Source Files" FILES ${_SRC})
|
||||||
endif()
|
endif()
|
||||||
source_group("${GROUP_ID}" FILES ${_SRC})
|
|
||||||
endforeach()
|
endforeach()
|
||||||
endfunction()
|
|
||||||
|
unset(_SRC)
|
||||||
|
unset(_SRC_EXT)
|
||||||
|
endmacro()
|
||||||
|
|
||||||
|
|
||||||
# only MSVC uses SOURCE_GROUP
|
# only MSVC uses SOURCE_GROUP
|
||||||
function(blender_add_lib_nolist
|
macro(blender_add_lib_nolist
|
||||||
name
|
name
|
||||||
sources
|
sources
|
||||||
includes
|
includes
|
||||||
includes_sys
|
includes_sys)
|
||||||
)
|
|
||||||
|
|
||||||
# message(STATUS "Configuring library ${name}")
|
# message(STATUS "Configuring library ${name}")
|
||||||
|
|
||||||
@@ -221,24 +200,22 @@ function(blender_add_lib_nolist
|
|||||||
# Not for system includes because they can resolve to the same path
|
# Not for system includes because they can resolve to the same path
|
||||||
# list_assert_duplicates("${includes_sys}")
|
# list_assert_duplicates("${includes_sys}")
|
||||||
|
|
||||||
endfunction()
|
endmacro()
|
||||||
|
|
||||||
|
|
||||||
function(blender_add_lib
|
macro(blender_add_lib
|
||||||
name
|
name
|
||||||
sources
|
sources
|
||||||
includes
|
includes
|
||||||
includes_sys
|
includes_sys)
|
||||||
)
|
|
||||||
|
|
||||||
blender_add_lib_nolist(${name} "${sources}" "${includes}" "${includes_sys}")
|
blender_add_lib_nolist(${name} "${sources}" "${includes}" "${includes_sys}")
|
||||||
|
|
||||||
set_property(GLOBAL APPEND PROPERTY BLENDER_LINK_LIBS ${name})
|
set_property(GLOBAL APPEND PROPERTY BLENDER_LINK_LIBS ${name})
|
||||||
endfunction()
|
endmacro()
|
||||||
|
|
||||||
|
|
||||||
function(SETUP_LIBDIRS)
|
macro(SETUP_LIBDIRS)
|
||||||
|
|
||||||
link_directories(${JPEG_LIBPATH} ${PNG_LIBPATH} ${ZLIB_LIBPATH} ${FREETYPE_LIBPATH})
|
link_directories(${JPEG_LIBPATH} ${PNG_LIBPATH} ${ZLIB_LIBPATH} ${FREETYPE_LIBPATH})
|
||||||
|
|
||||||
if(WITH_PYTHON) # AND NOT WITH_PYTHON_MODULE # WIN32 needs
|
if(WITH_PYTHON) # AND NOT WITH_PYTHON_MODULE # WIN32 needs
|
||||||
@@ -298,27 +275,19 @@ function(SETUP_LIBDIRS)
|
|||||||
if(WIN32 AND NOT UNIX)
|
if(WIN32 AND NOT UNIX)
|
||||||
link_directories(${PTHREADS_LIBPATH})
|
link_directories(${PTHREADS_LIBPATH})
|
||||||
endif()
|
endif()
|
||||||
endfunction()
|
endmacro()
|
||||||
|
|
||||||
function(setup_liblinks
|
macro(setup_liblinks
|
||||||
target
|
target)
|
||||||
)
|
|
||||||
|
|
||||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${PLATFORM_LINKFLAGS}" PARENT_SCOPE)
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${PLATFORM_LINKFLAGS}")
|
||||||
set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} ${PLATFORM_LINKFLAGS_DEBUG}" PARENT_SCOPE)
|
set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} ${PLATFORM_LINKFLAGS_DEBUG}")
|
||||||
|
|
||||||
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${PLATFORM_LINKFLAGS}" PARENT_SCOPE)
|
target_link_libraries(${target}
|
||||||
set(CMAKE_SHARED_LINKER_FLAGS_DEBUG "${CMAKE_SHARED_LINKER_FLAGS_DEBUG} ${PLATFORM_LINKFLAGS_DEBUG}" PARENT_SCOPE)
|
${BLENDER_GL_LIBRARIES}
|
||||||
|
${PNG_LIBRARIES}
|
||||||
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} ${PLATFORM_LINKFLAGS}" PARENT_SCOPE)
|
${ZLIB_LIBRARIES}
|
||||||
set(CMAKE_MODULE_LINKER_FLAGS_DEBUG "${CMAKE_MODULE_LINKER_FLAGS_DEBUG} ${PLATFORM_LINKFLAGS_DEBUG}" PARENT_SCOPE)
|
${FREETYPE_LIBRARY})
|
||||||
|
|
||||||
target_link_libraries(
|
|
||||||
${target}
|
|
||||||
${PNG_LIBRARIES}
|
|
||||||
${ZLIB_LIBRARIES}
|
|
||||||
${FREETYPE_LIBRARY}
|
|
||||||
)
|
|
||||||
|
|
||||||
# since we are using the local libs for python when compiling msvc projects, we need to add _d when compiling debug versions
|
# since we are using the local libs for python when compiling msvc projects, we need to add _d when compiling debug versions
|
||||||
if(WITH_PYTHON) # AND NOT WITH_PYTHON_MODULE # WIN32 needs
|
if(WITH_PYTHON) # AND NOT WITH_PYTHON_MODULE # WIN32 needs
|
||||||
@@ -334,9 +303,6 @@ function(setup_liblinks
|
|||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(WITH_LZO AND WITH_SYSTEM_LZO)
|
|
||||||
target_link_libraries(${target} ${LZO_LIBRARIES})
|
|
||||||
endif()
|
|
||||||
if(WITH_SYSTEM_GLEW)
|
if(WITH_SYSTEM_GLEW)
|
||||||
target_link_libraries(${target} ${BLENDER_GLEW_LIBRARIES})
|
target_link_libraries(${target} ${BLENDER_GLEW_LIBRARIES})
|
||||||
endif()
|
endif()
|
||||||
@@ -370,9 +336,6 @@ function(setup_liblinks
|
|||||||
if(WITH_OPENCOLORIO)
|
if(WITH_OPENCOLORIO)
|
||||||
target_link_libraries(${target} ${OPENCOLORIO_LIBRARIES})
|
target_link_libraries(${target} ${OPENCOLORIO_LIBRARIES})
|
||||||
endif()
|
endif()
|
||||||
if(WITH_CYCLES_OSL)
|
|
||||||
target_link_libraries(${target} ${OSL_LIBRARIES})
|
|
||||||
endif()
|
|
||||||
if(WITH_BOOST)
|
if(WITH_BOOST)
|
||||||
target_link_libraries(${target} ${BOOST_LIBRARIES})
|
target_link_libraries(${target} ${BOOST_LIBRARIES})
|
||||||
if(Boost_USE_STATIC_LIBS AND Boost_USE_ICU)
|
if(Boost_USE_STATIC_LIBS AND Boost_USE_ICU)
|
||||||
@@ -394,6 +357,14 @@ function(setup_liblinks
|
|||||||
target_link_libraries(${target} ${OPENJPEG_LIBRARIES})
|
target_link_libraries(${target} ${OPENJPEG_LIBRARIES})
|
||||||
endif()
|
endif()
|
||||||
if(WITH_CODEC_FFMPEG)
|
if(WITH_CODEC_FFMPEG)
|
||||||
|
|
||||||
|
# Strange! Without this ffmpeg gives linking errors (on linux),
|
||||||
|
# even though it's linked above.
|
||||||
|
# XXX: Does FFMPEG depend on GLU?
|
||||||
|
if(WITH_GLU)
|
||||||
|
target_link_libraries(${target} ${OPENGL_glu_LIBRARY})
|
||||||
|
endif()
|
||||||
|
|
||||||
target_link_libraries(${target} ${FFMPEG_LIBRARIES})
|
target_link_libraries(${target} ${FFMPEG_LIBRARIES})
|
||||||
endif()
|
endif()
|
||||||
if(WITH_OPENCOLLADA)
|
if(WITH_OPENCOLLADA)
|
||||||
@@ -415,13 +386,11 @@ function(setup_liblinks
|
|||||||
unset(EXPAT_LIB_DEBUG)
|
unset(EXPAT_LIB_DEBUG)
|
||||||
endif()
|
endif()
|
||||||
else()
|
else()
|
||||||
target_link_libraries(
|
target_link_libraries(${target}
|
||||||
${target}
|
${OPENCOLLADA_LIBRARIES}
|
||||||
${OPENCOLLADA_LIBRARIES}
|
${PCRE_LIBRARIES}
|
||||||
${PCRE_LIBRARIES}
|
${XML2_LIBRARIES}
|
||||||
${XML2_LIBRARIES}
|
${EXPAT_LIB})
|
||||||
${EXPAT_LIB}
|
|
||||||
)
|
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
if(WITH_MEM_JEMALLOC)
|
if(WITH_MEM_JEMALLOC)
|
||||||
@@ -433,6 +402,9 @@ function(setup_liblinks
|
|||||||
if(WITH_MOD_CLOTH_ELTOPO)
|
if(WITH_MOD_CLOTH_ELTOPO)
|
||||||
target_link_libraries(${target} ${LAPACK_LIBRARIES})
|
target_link_libraries(${target} ${LAPACK_LIBRARIES})
|
||||||
endif()
|
endif()
|
||||||
|
if(WITH_CYCLES_OSL)
|
||||||
|
target_link_libraries(${target} ${OSL_LIBRARIES})
|
||||||
|
endif()
|
||||||
if(WITH_LLVM)
|
if(WITH_LLVM)
|
||||||
target_link_libraries(${target} ${LLVM_LIBRARY})
|
target_link_libraries(${target} ${LLVM_LIBRARY})
|
||||||
endif()
|
endif()
|
||||||
@@ -440,22 +412,16 @@ function(setup_liblinks
|
|||||||
target_link_libraries(${target} ${PTHREADS_LIBRARIES})
|
target_link_libraries(${target} ${PTHREADS_LIBRARIES})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
target_link_libraries(${target} ${PLATFORM_LINKLIBS} ${CMAKE_DL_LIBS})
|
||||||
|
|
||||||
# We put CLEW and CUEW here because OPENSUBDIV_LIBRARIES dpeends on them..
|
# We put CLEW and CUEW here because OPENSUBDIV_LIBRARIES dpeends on them..
|
||||||
if(WITH_CYCLES OR WITH_COMPOSITOR OR WITH_OPENSUBDIV)
|
if(WITH_CYCLES OR WITH_COMPOSITOR OR WITH_OPENSUBDIV)
|
||||||
target_link_libraries(${target} "extern_clew")
|
target_link_libraries(${target} "extern_clew")
|
||||||
target_link_libraries(${target} "extern_cuew")
|
target_link_libraries(${target} "extern_cuew")
|
||||||
endif()
|
endif()
|
||||||
|
endmacro()
|
||||||
|
|
||||||
#system libraries with no dependencies such as platform link libs or opengl should go last
|
macro(SETUP_BLENDER_SORTED_LIBS)
|
||||||
target_link_libraries(${target}
|
|
||||||
${BLENDER_GL_LIBRARIES})
|
|
||||||
|
|
||||||
target_link_libraries(${target} ${PLATFORM_LINKLIBS} ${CMAKE_DL_LIBS})
|
|
||||||
endfunction()
|
|
||||||
|
|
||||||
|
|
||||||
function(SETUP_BLENDER_SORTED_LIBS)
|
|
||||||
|
|
||||||
get_property(BLENDER_LINK_LIBS GLOBAL PROPERTY BLENDER_LINK_LIBS)
|
get_property(BLENDER_LINK_LIBS GLOBAL PROPERTY BLENDER_LINK_LIBS)
|
||||||
|
|
||||||
list(APPEND BLENDER_LINK_LIBS
|
list(APPEND BLENDER_LINK_LIBS
|
||||||
@@ -533,15 +499,13 @@ function(SETUP_BLENDER_SORTED_LIBS)
|
|||||||
bf_ikplugin
|
bf_ikplugin
|
||||||
bf_modifiers
|
bf_modifiers
|
||||||
bf_bmesh
|
bf_bmesh
|
||||||
bf_gpu
|
|
||||||
bf_blenkernel
|
bf_blenkernel
|
||||||
bf_physics
|
|
||||||
bf_nodes
|
bf_nodes
|
||||||
bf_rna
|
bf_rna
|
||||||
|
bf_gpu
|
||||||
bf_blenloader
|
bf_blenloader
|
||||||
bf_imbuf
|
bf_imbuf
|
||||||
bf_blenlib
|
bf_blenlib
|
||||||
bf_depsgraph
|
|
||||||
bf_intern_ghost
|
bf_intern_ghost
|
||||||
bf_intern_string
|
bf_intern_string
|
||||||
bf_avi
|
bf_avi
|
||||||
@@ -560,6 +524,7 @@ function(SETUP_BLENDER_SORTED_LIBS)
|
|||||||
ge_phys_dummy
|
ge_phys_dummy
|
||||||
ge_phys_bullet
|
ge_phys_bullet
|
||||||
bf_intern_smoke
|
bf_intern_smoke
|
||||||
|
extern_minilzo
|
||||||
extern_lzma
|
extern_lzma
|
||||||
extern_colamd
|
extern_colamd
|
||||||
ge_logic_ketsji
|
ge_logic_ketsji
|
||||||
@@ -613,10 +578,6 @@ function(SETUP_BLENDER_SORTED_LIBS)
|
|||||||
list(APPEND BLENDER_SORTED_LIBS extern_eltopo)
|
list(APPEND BLENDER_SORTED_LIBS extern_eltopo)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(NOT WITH_SYSTEM_LZO)
|
|
||||||
list(APPEND BLENDER_SORTED_LIBS extern_minilzo)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(NOT WITH_SYSTEM_GLEW)
|
if(NOT WITH_SYSTEM_GLEW)
|
||||||
list(APPEND BLENDER_SORTED_LIBS ${BLENDER_GLEW_LIBRARIES})
|
list(APPEND BLENDER_SORTED_LIBS ${BLENDER_GLEW_LIBRARIES})
|
||||||
endif()
|
endif()
|
||||||
@@ -691,12 +652,14 @@ function(SETUP_BLENDER_SORTED_LIBS)
|
|||||||
message(STATUS "Blender Skipping: (${REM_MSG})")
|
message(STATUS "Blender Skipping: (${REM_MSG})")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
unset(SEARCHLIB)
|
||||||
set(BLENDER_SORTED_LIBS ${BLENDER_SORTED_LIBS} PARENT_SCOPE)
|
unset(SORTLIB)
|
||||||
|
unset(REMLIB)
|
||||||
|
unset(REM_MSG)
|
||||||
|
|
||||||
# for top-level tests
|
# for top-level tests
|
||||||
set_property(GLOBAL PROPERTY BLENDER_SORTED_LIBS_PROP ${BLENDER_SORTED_LIBS})
|
set_property(GLOBAL PROPERTY BLENDER_SORTED_LIBS_PROP ${BLENDER_SORTED_LIBS})
|
||||||
endfunction()
|
endmacro()
|
||||||
|
|
||||||
macro(TEST_SSE_SUPPORT
|
macro(TEST_SSE_SUPPORT
|
||||||
_sse_flags
|
_sse_flags
|
||||||
@@ -918,22 +881,19 @@ endmacro()
|
|||||||
|
|
||||||
# utility macro
|
# utility macro
|
||||||
macro(remove_cc_flag
|
macro(remove_cc_flag
|
||||||
_flag)
|
flag)
|
||||||
|
|
||||||
foreach(flag ${ARGV})
|
string(REGEX REPLACE ${flag} "" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
|
||||||
string(REGEX REPLACE ${flag} "" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
|
string(REGEX REPLACE ${flag} "" CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG}")
|
||||||
string(REGEX REPLACE ${flag} "" CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG}")
|
string(REGEX REPLACE ${flag} "" CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE}")
|
||||||
string(REGEX REPLACE ${flag} "" CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE}")
|
string(REGEX REPLACE ${flag} "" CMAKE_C_FLAGS_MINSIZEREL "${CMAKE_C_FLAGS_MINSIZEREL}")
|
||||||
string(REGEX REPLACE ${flag} "" CMAKE_C_FLAGS_MINSIZEREL "${CMAKE_C_FLAGS_MINSIZEREL}")
|
string(REGEX REPLACE ${flag} "" CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO}")
|
||||||
string(REGEX REPLACE ${flag} "" CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO}")
|
|
||||||
|
|
||||||
string(REGEX REPLACE ${flag} "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
string(REGEX REPLACE ${flag} "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
||||||
string(REGEX REPLACE ${flag} "" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}")
|
string(REGEX REPLACE ${flag} "" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}")
|
||||||
string(REGEX REPLACE ${flag} "" CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}")
|
string(REGEX REPLACE ${flag} "" CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}")
|
||||||
string(REGEX REPLACE ${flag} "" CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL}")
|
string(REGEX REPLACE ${flag} "" CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL}")
|
||||||
string(REGEX REPLACE ${flag} "" CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}")
|
string(REGEX REPLACE ${flag} "" CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}")
|
||||||
endforeach()
|
|
||||||
unset(flag)
|
|
||||||
|
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|
||||||
@@ -947,34 +907,27 @@ endmacro()
|
|||||||
macro(remove_strict_flags)
|
macro(remove_strict_flags)
|
||||||
|
|
||||||
if(CMAKE_COMPILER_IS_GNUCC)
|
if(CMAKE_COMPILER_IS_GNUCC)
|
||||||
remove_cc_flag(
|
remove_cc_flag("-Wstrict-prototypes")
|
||||||
"-Wstrict-prototypes"
|
remove_cc_flag("-Wmissing-prototypes")
|
||||||
"-Wmissing-prototypes"
|
remove_cc_flag("-Wunused-parameter")
|
||||||
"-Wmissing-format-attribute"
|
remove_cc_flag("-Wwrite-strings")
|
||||||
"-Wunused-local-typedefs"
|
remove_cc_flag("-Wredundant-decls")
|
||||||
"-Wunused-macros"
|
remove_cc_flag("-Wundef")
|
||||||
"-Wunused-parameter"
|
remove_cc_flag("-Wshadow")
|
||||||
"-Wwrite-strings"
|
remove_cc_flag("-Wdouble-promotion")
|
||||||
"-Wredundant-decls"
|
remove_cc_flag("-Wold-style-definition")
|
||||||
"-Wundef"
|
remove_cc_flag("-Werror=[^ ]+")
|
||||||
"-Wshadow"
|
remove_cc_flag("-Werror")
|
||||||
"-Wdouble-promotion"
|
|
||||||
"-Wold-style-definition"
|
|
||||||
"-Werror=[^ ]+"
|
|
||||||
"-Werror"
|
|
||||||
)
|
|
||||||
|
|
||||||
# negate flags implied by '-Wall'
|
# negate flags implied by '-Wall'
|
||||||
add_cc_flag("${CC_REMOVE_STRICT_FLAGS}")
|
add_cc_flag("${CC_REMOVE_STRICT_FLAGS}")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(CMAKE_C_COMPILER_ID MATCHES "Clang")
|
if(CMAKE_C_COMPILER_ID MATCHES "Clang")
|
||||||
remove_cc_flag(
|
remove_cc_flag("-Wunused-parameter")
|
||||||
"-Wunused-parameter"
|
remove_cc_flag("-Wunused-variable")
|
||||||
"-Wunused-variable"
|
remove_cc_flag("-Werror=[^ ]+")
|
||||||
"-Werror=[^ ]+"
|
remove_cc_flag("-Werror")
|
||||||
"-Werror"
|
|
||||||
)
|
|
||||||
|
|
||||||
# negate flags implied by '-Wall'
|
# negate flags implied by '-Wall'
|
||||||
add_cc_flag("${CC_REMOVE_STRICT_FLAGS}")
|
add_cc_flag("${CC_REMOVE_STRICT_FLAGS}")
|
||||||
@@ -986,24 +939,6 @@ macro(remove_strict_flags)
|
|||||||
|
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|
||||||
macro(remove_extra_strict_flags)
|
|
||||||
if(CMAKE_COMPILER_IS_GNUCC)
|
|
||||||
remove_cc_flag(
|
|
||||||
"-Wunused-parameter"
|
|
||||||
)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(CMAKE_C_COMPILER_ID MATCHES "Clang")
|
|
||||||
remove_cc_flag(
|
|
||||||
"-Wunused-parameter"
|
|
||||||
)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(MSVC)
|
|
||||||
# TODO
|
|
||||||
endif()
|
|
||||||
endmacro()
|
|
||||||
|
|
||||||
# note, we can only append flags on a single file so we need to negate the options.
|
# note, we can only append flags on a single file so we need to negate the options.
|
||||||
# at the moment we cant shut up ffmpeg deprecations, so use this, but will
|
# at the moment we cant shut up ffmpeg deprecations, so use this, but will
|
||||||
# probably add more removals here.
|
# probably add more removals here.
|
||||||
@@ -1032,50 +967,39 @@ macro(remove_strict_flags_file
|
|||||||
endmacro()
|
endmacro()
|
||||||
|
|
||||||
|
|
||||||
function(ADD_CHECK_C_COMPILER_FLAG
|
macro(ADD_CHECK_C_COMPILER_FLAG
|
||||||
_CFLAGS
|
_CFLAGS
|
||||||
_CACHE_VAR
|
_CACHE_VAR
|
||||||
_FLAG
|
_FLAG)
|
||||||
)
|
|
||||||
|
|
||||||
include(CheckCCompilerFlag)
|
include(CheckCCompilerFlag)
|
||||||
|
|
||||||
CHECK_C_COMPILER_FLAG("${_FLAG}" "${_CACHE_VAR}")
|
CHECK_C_COMPILER_FLAG("${_FLAG}" "${_CACHE_VAR}")
|
||||||
if(${_CACHE_VAR})
|
if(${_CACHE_VAR})
|
||||||
# message(STATUS "Using CFLAG: ${_FLAG}")
|
# message(STATUS "Using CFLAG: ${_FLAG}")
|
||||||
set(${_CFLAGS} "${${_CFLAGS}} ${_FLAG}" PARENT_SCOPE)
|
set(${_CFLAGS} "${${_CFLAGS}} ${_FLAG}")
|
||||||
else()
|
else()
|
||||||
message(STATUS "Unsupported CFLAG: ${_FLAG}")
|
message(STATUS "Unsupported CFLAG: ${_FLAG}")
|
||||||
endif()
|
endif()
|
||||||
endfunction()
|
endmacro()
|
||||||
|
|
||||||
function(ADD_CHECK_CXX_COMPILER_FLAG
|
macro(ADD_CHECK_CXX_COMPILER_FLAG
|
||||||
_CXXFLAGS
|
_CXXFLAGS
|
||||||
_CACHE_VAR
|
_CACHE_VAR
|
||||||
_FLAG
|
_FLAG)
|
||||||
)
|
|
||||||
|
|
||||||
include(CheckCXXCompilerFlag)
|
include(CheckCXXCompilerFlag)
|
||||||
|
|
||||||
CHECK_CXX_COMPILER_FLAG("${_FLAG}" "${_CACHE_VAR}")
|
CHECK_CXX_COMPILER_FLAG("${_FLAG}" "${_CACHE_VAR}")
|
||||||
if(${_CACHE_VAR})
|
if(${_CACHE_VAR})
|
||||||
# message(STATUS "Using CXXFLAG: ${_FLAG}")
|
# message(STATUS "Using CXXFLAG: ${_FLAG}")
|
||||||
set(${_CXXFLAGS} "${${_CXXFLAGS}} ${_FLAG}" PARENT_SCOPE)
|
set(${_CXXFLAGS} "${${_CXXFLAGS}} ${_FLAG}")
|
||||||
else()
|
else()
|
||||||
message(STATUS "Unsupported CXXFLAG: ${_FLAG}")
|
message(STATUS "Unsupported CXXFLAG: ${_FLAG}")
|
||||||
endif()
|
endif()
|
||||||
endfunction()
|
endmacro()
|
||||||
|
|
||||||
function(get_blender_version)
|
function(get_blender_version)
|
||||||
# extracts header vars and defines them in the parent scope:
|
|
||||||
#
|
|
||||||
# - BLENDER_VERSION (major.minor)
|
|
||||||
# - BLENDER_VERSION_MAJOR
|
|
||||||
# - BLENDER_VERSION_MINOR
|
|
||||||
# - BLENDER_SUBVERSION (used for internal versioning mainly)
|
|
||||||
# - BLENDER_VERSION_CHAR (a, b, c, ...or empty string)
|
|
||||||
# - BLENDER_VERSION_CYCLE (alpha, beta, rc, release)
|
|
||||||
|
|
||||||
# So cmake depends on BKE_blender.h, beware of inf-loops!
|
# So cmake depends on BKE_blender.h, beware of inf-loops!
|
||||||
CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/source/blender/blenkernel/BKE_blender.h
|
CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/source/blender/blenkernel/BKE_blender.h
|
||||||
${CMAKE_BINARY_DIR}/source/blender/blenkernel/BKE_blender.h.done)
|
${CMAKE_BINARY_DIR}/source/blender/blenkernel/BKE_blender.h.done)
|
||||||
@@ -1108,28 +1032,25 @@ function(get_blender_version)
|
|||||||
message(FATAL_ERROR "Version parsing failed for BLENDER_VERSION_CYCLE")
|
message(FATAL_ERROR "Version parsing failed for BLENDER_VERSION_CYCLE")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
math(EXPR _out_version_major "${_out_version} / 100")
|
math(EXPR BLENDER_VERSION_MAJOR "${_out_version} / 100")
|
||||||
math(EXPR _out_version_minor "${_out_version} % 100")
|
math(EXPR BLENDER_VERSION_MINOR "${_out_version} % 100")
|
||||||
|
set(BLENDER_VERSION "${BLENDER_VERSION_MAJOR}.${BLENDER_VERSION_MINOR}" PARENT_SCOPE)
|
||||||
|
|
||||||
|
set(BLENDER_SUBVERSION ${_out_subversion} PARENT_SCOPE)
|
||||||
|
set(BLENDER_VERSION_CHAR ${_out_version_char} PARENT_SCOPE)
|
||||||
|
set(BLENDER_VERSION_CYCLE ${_out_version_cycle} PARENT_SCOPE)
|
||||||
|
|
||||||
# for packaging, alpha to numbers
|
# for packaging, alpha to numbers
|
||||||
string(COMPARE EQUAL "${_out_version_char}" "" _out_version_char_empty)
|
string(COMPARE EQUAL "${BLENDER_VERSION_CHAR}" "" _out_version_char_empty)
|
||||||
if(${_out_version_char_empty})
|
if(${_out_version_char_empty})
|
||||||
set(_out_version_char_index "0")
|
set(BLENDER_VERSION_CHAR_INDEX "0" PARENT_SCOPE)
|
||||||
else()
|
else()
|
||||||
set(_char_ls a b c d e f g h i j k l m n o p q r s t u v w x y z)
|
set(_char_ls a b c d e f g h i j k l m n o p q r s t u v w x y z)
|
||||||
list(FIND _char_ls ${_out_version_char} _out_version_char_index)
|
list(FIND _char_ls ${BLENDER_VERSION_CHAR} _out_version_char_index)
|
||||||
math(EXPR _out_version_char_index "${_out_version_char_index} + 1")
|
math(EXPR BLENDER_VERSION_CHAR_INDEX "${_out_version_char_index} + 1" PARENT_SCOPE)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# output vars
|
# message(STATUS "Version (Internal): ${BLENDER_VERSION}.${BLENDER_SUBVERSION}, Version (external): ${BLENDER_VERSION}${BLENDER_VERSION_CHAR}-${BLENDER_VERSION_CYCLE}")
|
||||||
set(BLENDER_VERSION "${_out_version_major}.${_out_version_minor}" PARENT_SCOPE)
|
|
||||||
set(BLENDER_VERSION_MAJOR "${_out_version_major}" PARENT_SCOPE)
|
|
||||||
set(BLENDER_VERSION_MINOR "${_out_version_minor}" PARENT_SCOPE)
|
|
||||||
set(BLENDER_SUBVERSION "${_out_subversion}" PARENT_SCOPE)
|
|
||||||
set(BLENDER_VERSION_CHAR "${_out_version_char}" PARENT_SCOPE)
|
|
||||||
set(BLENDER_VERSION_CHAR_INDEX "${_out_version_char_index}" PARENT_SCOPE)
|
|
||||||
set(BLENDER_VERSION_CYCLE "${_out_version_cycle}" PARENT_SCOPE)
|
|
||||||
|
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
|
|
||||||
@@ -1167,7 +1088,7 @@ endmacro()
|
|||||||
macro(blender_project_hack_post)
|
macro(blender_project_hack_post)
|
||||||
# --------------
|
# --------------
|
||||||
# MINGW HACK END
|
# MINGW HACK END
|
||||||
if(_reset_standard_libraries)
|
if (_reset_standard_libraries)
|
||||||
# Must come after projecINCt(...)
|
# Must come after projecINCt(...)
|
||||||
#
|
#
|
||||||
# MINGW workaround for -ladvapi32 being included which surprisingly causes
|
# MINGW workaround for -ladvapi32 being included which surprisingly causes
|
||||||
@@ -1214,7 +1135,7 @@ endmacro()
|
|||||||
# pair of macros to allow libraries to be specify files to install, but to
|
# pair of macros to allow libraries to be specify files to install, but to
|
||||||
# only install them at the end so the directories don't get cleared with
|
# only install them at the end so the directories don't get cleared with
|
||||||
# the files in them. used by cycles to install addon.
|
# the files in them. used by cycles to install addon.
|
||||||
function(delayed_install
|
macro(delayed_install
|
||||||
base
|
base
|
||||||
files
|
files
|
||||||
destination)
|
destination)
|
||||||
@@ -1227,7 +1148,8 @@ function(delayed_install
|
|||||||
endif()
|
endif()
|
||||||
set_property(GLOBAL APPEND PROPERTY DELAYED_INSTALL_DESTINATIONS ${destination})
|
set_property(GLOBAL APPEND PROPERTY DELAYED_INSTALL_DESTINATIONS ${destination})
|
||||||
endforeach()
|
endforeach()
|
||||||
endfunction()
|
unset(f)
|
||||||
|
endmacro()
|
||||||
|
|
||||||
# note this is a function instead of a macro so that ${BUILD_TYPE} in targetdir
|
# note this is a function instead of a macro so that ${BUILD_TYPE} in targetdir
|
||||||
# does not get expanded in calling but is preserved
|
# does not get expanded in calling but is preserved
|
||||||
@@ -1246,17 +1168,16 @@ function(delayed_do_install
|
|||||||
list(GET destinations ${i} d)
|
list(GET destinations ${i} d)
|
||||||
install(FILES ${f} DESTINATION ${targetdir}/${d})
|
install(FILES ${f} DESTINATION ${targetdir}/${d})
|
||||||
endforeach()
|
endforeach()
|
||||||
|
unset(f)
|
||||||
endif()
|
endif()
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
|
|
||||||
function(data_to_c
|
macro(data_to_c
|
||||||
file_from file_to
|
file_from file_to
|
||||||
list_to_add
|
list_to_add)
|
||||||
)
|
|
||||||
|
|
||||||
list(APPEND ${list_to_add} ${file_to})
|
list(APPEND ${list_to_add} ${file_to})
|
||||||
set(${list_to_add} ${${list_to_add}} PARENT_SCOPE)
|
|
||||||
|
|
||||||
get_filename_component(_file_to_path ${file_to} PATH)
|
get_filename_component(_file_to_path ${file_to} PATH)
|
||||||
|
|
||||||
@@ -1267,21 +1188,21 @@ function(data_to_c
|
|||||||
DEPENDS ${file_from} datatoc)
|
DEPENDS ${file_from} datatoc)
|
||||||
|
|
||||||
set_source_files_properties(${file_to} PROPERTIES GENERATED TRUE)
|
set_source_files_properties(${file_to} PROPERTIES GENERATED TRUE)
|
||||||
endfunction()
|
|
||||||
|
unset(_file_to_path)
|
||||||
|
endmacro()
|
||||||
|
|
||||||
|
|
||||||
# same as above but generates the var name and output automatic.
|
# same as above but generates the var name and output automatic.
|
||||||
function(data_to_c_simple
|
macro(data_to_c_simple
|
||||||
file_from
|
file_from
|
||||||
list_to_add
|
list_to_add)
|
||||||
)
|
|
||||||
|
|
||||||
# remove ../'s
|
# remove ../'s
|
||||||
get_filename_component(_file_from ${CMAKE_CURRENT_SOURCE_DIR}/${file_from} REALPATH)
|
get_filename_component(_file_from ${CMAKE_CURRENT_SOURCE_DIR}/${file_from} REALPATH)
|
||||||
get_filename_component(_file_to ${CMAKE_CURRENT_BINARY_DIR}/${file_from}.c REALPATH)
|
get_filename_component(_file_to ${CMAKE_CURRENT_BINARY_DIR}/${file_from}.c REALPATH)
|
||||||
|
|
||||||
list(APPEND ${list_to_add} ${_file_to})
|
list(APPEND ${list_to_add} ${_file_to})
|
||||||
set(${list_to_add} ${${list_to_add}} PARENT_SCOPE)
|
|
||||||
|
|
||||||
get_filename_component(_file_to_path ${_file_to} PATH)
|
get_filename_component(_file_to_path ${_file_to} PATH)
|
||||||
|
|
||||||
@@ -1292,13 +1213,17 @@ function(data_to_c_simple
|
|||||||
DEPENDS ${_file_from} datatoc)
|
DEPENDS ${_file_from} datatoc)
|
||||||
|
|
||||||
set_source_files_properties(${_file_to} PROPERTIES GENERATED TRUE)
|
set_source_files_properties(${_file_to} PROPERTIES GENERATED TRUE)
|
||||||
endfunction()
|
|
||||||
|
unset(_file_from)
|
||||||
|
unset(_file_to)
|
||||||
|
unset(_file_to_path)
|
||||||
|
endmacro()
|
||||||
|
|
||||||
# macro for converting pixmap directory to a png and then a c file
|
# macro for converting pixmap directory to a png and then a c file
|
||||||
function(data_to_c_simple_icons
|
macro(data_to_c_simple_icons
|
||||||
path_from
|
path_from
|
||||||
list_to_add
|
list_to_add
|
||||||
)
|
)
|
||||||
|
|
||||||
# Conversion steps
|
# Conversion steps
|
||||||
# path_from -> _file_from -> _file_to
|
# path_from -> _file_from -> _file_to
|
||||||
@@ -1310,7 +1235,6 @@ function(data_to_c_simple_icons
|
|||||||
get_filename_component(_file_to ${CMAKE_CURRENT_BINARY_DIR}/${path_from}.png.c REALPATH)
|
get_filename_component(_file_to ${CMAKE_CURRENT_BINARY_DIR}/${path_from}.png.c REALPATH)
|
||||||
|
|
||||||
list(APPEND ${list_to_add} ${_file_to})
|
list(APPEND ${list_to_add} ${_file_to})
|
||||||
set(${list_to_add} ${${list_to_add}} PARENT_SCOPE)
|
|
||||||
|
|
||||||
get_filename_component(_file_to_path ${_file_to} PATH)
|
get_filename_component(_file_to_path ${_file_to} PATH)
|
||||||
|
|
||||||
@@ -1332,22 +1256,27 @@ function(data_to_c_simple_icons
|
|||||||
)
|
)
|
||||||
|
|
||||||
set_source_files_properties(${_file_from} ${_file_to} PROPERTIES GENERATED TRUE)
|
set_source_files_properties(${_file_from} ${_file_to} PROPERTIES GENERATED TRUE)
|
||||||
endfunction()
|
|
||||||
|
unset(_path_from_abs)
|
||||||
|
unset(_file_from)
|
||||||
|
unset(_file_to)
|
||||||
|
unset(_file_to_path)
|
||||||
|
unset(_icon_files)
|
||||||
|
|
||||||
|
endmacro()
|
||||||
|
|
||||||
# XXX Not used for now...
|
# XXX Not used for now...
|
||||||
function(svg_to_png
|
macro(svg_to_png
|
||||||
file_from
|
file_from
|
||||||
file_to
|
file_to
|
||||||
dpi
|
dpi
|
||||||
list_to_add
|
list_to_add)
|
||||||
)
|
|
||||||
|
|
||||||
# remove ../'s
|
# remove ../'s
|
||||||
get_filename_component(_file_from ${CMAKE_CURRENT_SOURCE_DIR}/${file_from} REALPATH)
|
get_filename_component(_file_from ${CMAKE_CURRENT_SOURCE_DIR}/${file_from} REALPATH)
|
||||||
get_filename_component(_file_to ${CMAKE_CURRENT_SOURCE_DIR}/${file_to} REALPATH)
|
get_filename_component(_file_to ${CMAKE_CURRENT_SOURCE_DIR}/${file_to} REALPATH)
|
||||||
|
|
||||||
list(APPEND ${list_to_add} ${_file_to})
|
list(APPEND ${list_to_add} ${_file_to})
|
||||||
set(${list_to_add} ${${list_to_add}} PARENT_SCOPE)
|
|
||||||
|
|
||||||
find_program(INKSCAPE_EXE inkscape)
|
find_program(INKSCAPE_EXE inkscape)
|
||||||
mark_as_advanced(INKSCAPE_EXE)
|
mark_as_advanced(INKSCAPE_EXE)
|
||||||
@@ -1370,12 +1299,15 @@ function(svg_to_png
|
|||||||
else()
|
else()
|
||||||
message(WARNING "Inkscape not found, could not re-generate ${_file_to} from ${_file_from}!")
|
message(WARNING "Inkscape not found, could not re-generate ${_file_to} from ${_file_from}!")
|
||||||
endif()
|
endif()
|
||||||
endfunction()
|
|
||||||
|
|
||||||
function(msgfmt_simple
|
unset(_file_from)
|
||||||
file_from
|
unset(_file_to)
|
||||||
list_to_add
|
|
||||||
)
|
endmacro()
|
||||||
|
|
||||||
|
macro(msgfmt_simple
|
||||||
|
file_from
|
||||||
|
list_to_add)
|
||||||
|
|
||||||
# remove ../'s
|
# remove ../'s
|
||||||
get_filename_component(_file_from_we ${file_from} NAME_WE)
|
get_filename_component(_file_from_we ${file_from} NAME_WE)
|
||||||
@@ -1384,7 +1316,6 @@ function(msgfmt_simple
|
|||||||
get_filename_component(_file_to ${CMAKE_CURRENT_BINARY_DIR}/${_file_from_we}.mo REALPATH)
|
get_filename_component(_file_to ${CMAKE_CURRENT_BINARY_DIR}/${_file_from_we}.mo REALPATH)
|
||||||
|
|
||||||
list(APPEND ${list_to_add} ${_file_to})
|
list(APPEND ${list_to_add} ${_file_to})
|
||||||
set(${list_to_add} ${${list_to_add}} PARENT_SCOPE)
|
|
||||||
|
|
||||||
get_filename_component(_file_to_path ${_file_to} PATH)
|
get_filename_component(_file_to_path ${_file_to} PATH)
|
||||||
|
|
||||||
@@ -1395,11 +1326,15 @@ function(msgfmt_simple
|
|||||||
DEPENDS msgfmt ${_file_from})
|
DEPENDS msgfmt ${_file_from})
|
||||||
|
|
||||||
set_source_files_properties(${_file_to} PROPERTIES GENERATED TRUE)
|
set_source_files_properties(${_file_to} PROPERTIES GENERATED TRUE)
|
||||||
endfunction()
|
|
||||||
|
|
||||||
function(find_python_package
|
unset(_file_from_we)
|
||||||
package
|
unset(_file_from)
|
||||||
)
|
unset(_file_to)
|
||||||
|
unset(_file_to_path)
|
||||||
|
endmacro()
|
||||||
|
|
||||||
|
macro(find_python_package
|
||||||
|
package)
|
||||||
|
|
||||||
string(TOUPPER ${package} _upper_package)
|
string(TOUPPER ${package} _upper_package)
|
||||||
|
|
||||||
@@ -1437,17 +1372,25 @@ function(find_python_package
|
|||||||
"'${PYTHON_LIBPATH}/python${PYTHON_VERSION}/dist-packages/${package}', "
|
"'${PYTHON_LIBPATH}/python${PYTHON_VERSION}/dist-packages/${package}', "
|
||||||
"'${PYTHON_LIBPATH}/python${_PY_VER_MAJOR}/dist-packages/${package}', "
|
"'${PYTHON_LIBPATH}/python${_PY_VER_MAJOR}/dist-packages/${package}', "
|
||||||
"WITH_PYTHON_INSTALL_${_upper_package} option will be ignored when installing python")
|
"WITH_PYTHON_INSTALL_${_upper_package} option will be ignored when installing python")
|
||||||
set(WITH_PYTHON_INSTALL_${_upper_package} OFF PARENT_SCOPE)
|
set(WITH_PYTHON_INSTALL_${_upper_package} OFF)
|
||||||
else()
|
else()
|
||||||
message(STATUS "${package} found at '${PYTHON_${_upper_package}_PATH}'")
|
message(STATUS "${package} found at '${PYTHON_${_upper_package}_PATH}'")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
unset(_PY_VER_SPLIT)
|
||||||
|
unset(_PY_VER_MAJOR)
|
||||||
endif()
|
endif()
|
||||||
endfunction()
|
|
||||||
|
unset(_upper_package)
|
||||||
|
endmacro()
|
||||||
|
|
||||||
# like Python's 'print(dir())'
|
# like Python's 'print(dir())'
|
||||||
function(print_all_vars)
|
macro(print_all_vars)
|
||||||
get_cmake_property(_vars VARIABLES)
|
get_cmake_property(_vars VARIABLES)
|
||||||
foreach(_var ${_vars})
|
foreach(_var ${_vars})
|
||||||
message("${_var}=${${_var}}")
|
message("${_var}=${${_var}}")
|
||||||
endforeach()
|
endforeach()
|
||||||
endfunction()
|
unset(_vars)
|
||||||
|
unset(_var)
|
||||||
|
endmacro()
|
||||||
|
|
||||||
|
@@ -27,8 +27,7 @@ if(EXISTS ${CMAKE_SOURCE_DIR}/.git/)
|
|||||||
execute_process(COMMAND git rev-parse --short @{u}
|
execute_process(COMMAND git rev-parse --short @{u}
|
||||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||||
OUTPUT_VARIABLE MY_WC_HASH
|
OUTPUT_VARIABLE MY_WC_HASH
|
||||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||||
ERROR_QUIET)
|
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
set(BUILD_REV ${MY_WC_HASH})
|
set(BUILD_REV ${MY_WC_HASH})
|
||||||
@@ -112,9 +111,3 @@ elseif(UNIX)
|
|||||||
"tar.bz2")
|
"tar.bz2")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
unset(MAJOR_VERSION)
|
|
||||||
unset(MINOR_VERSION)
|
|
||||||
unset(PATCH_VERSION)
|
|
||||||
|
|
||||||
unset(BUILD_REV)
|
|
||||||
|
|
||||||
|
@@ -130,7 +130,7 @@ def is_project_file(filename):
|
|||||||
|
|
||||||
|
|
||||||
def cmake_advanced_info():
|
def cmake_advanced_info():
|
||||||
""" Extract includes and defines from cmake.
|
""" Extracr includes and defines from cmake.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
make_exe = cmake_cache_var("CMAKE_MAKE_PROGRAM")
|
make_exe = cmake_cache_var("CMAKE_MAKE_PROGRAM")
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/python
|
||||||
|
|
||||||
# <pep8 compliant>
|
# <pep8 compliant>
|
||||||
|
|
||||||
|
@@ -12,9 +12,9 @@ blender_version_char=$(sed -ne 's/.*BLENDER_VERSION_CHAR.*\([a-z]\)$/\1/p' $blen
|
|||||||
# map the version a -> 1
|
# map the version a -> 1
|
||||||
# not to be confused with blender's internal subversions
|
# not to be confused with blender's internal subversions
|
||||||
if [ "$blender_version_char" ]; then
|
if [ "$blender_version_char" ]; then
|
||||||
blender_version_full=${blender_version}.$(expr index abcdefghijklmnopqrstuvwxyz $blender_version_char)
|
blender_version_full=${blender_version}.$(expr index abcdefghijklmnopqrstuvwxyz $blender_version_char)
|
||||||
else
|
else
|
||||||
blender_version_full=${blender_version}
|
blender_version_full=${blender_version}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
blender_ver_string=$blender_version+git$blender_version_full
|
blender_ver_string=$blender_version+git$blender_version_full
|
||||||
@@ -60,7 +60,7 @@ package() {
|
|||||||
cd $srcdir/build
|
cd $srcdir/build
|
||||||
make DESTDIR="$pkgdir" install
|
make DESTDIR="$pkgdir" install
|
||||||
python -m compileall \
|
python -m compileall \
|
||||||
$pkgdir/usr/share/blender/$blender_version/scripts/startup \
|
$pkgdir/usr/share/blender/$blender_version/scripts/startup \
|
||||||
$pkgdir/usr/share/blender/$blender_version/scripts/modules \
|
$pkgdir/usr/share/blender/$blender_version/scripts/modules \
|
||||||
$pkgdir/usr/share/blender/$blender_version/scripts/addons
|
$pkgdir/usr/share/blender/$blender_version/scripts/addons
|
||||||
}
|
}
|
||||||
|
@@ -144,7 +144,7 @@ BF_REDCODE_LIB = ''
|
|||||||
BF_REDCODE_INC = '${BF_REDCODE}/../' #C files request "libredcode/format.h" which is in "#extern/libredcode/format.h", stupid but compiles for now.
|
BF_REDCODE_INC = '${BF_REDCODE}/../' #C files request "libredcode/format.h" which is in "#extern/libredcode/format.h", stupid but compiles for now.
|
||||||
BF_REDCODE_LIBPATH='${BF_REDCODE}/lib'
|
BF_REDCODE_LIBPATH='${BF_REDCODE}/lib'
|
||||||
|
|
||||||
# Mesa Libs should go here if you're using them as well....
|
# Mesa Libs should go here if your using them as well....
|
||||||
WITH_BF_STATICOPENGL = False
|
WITH_BF_STATICOPENGL = False
|
||||||
BF_OPENGL = '/usr'
|
BF_OPENGL = '/usr'
|
||||||
BF_OPENGL_INC = '${BF_OPENGL}/include'
|
BF_OPENGL_INC = '${BF_OPENGL}/include'
|
||||||
@@ -206,7 +206,7 @@ WITH_BF_CYCLES = WITH_BF_OIIO and WITH_BF_BOOST
|
|||||||
|
|
||||||
WITH_BF_CYCLES_CUDA_BINARIES = False
|
WITH_BF_CYCLES_CUDA_BINARIES = False
|
||||||
BF_CYCLES_CUDA_NVCC = '/usr/local/cuda/bin/nvcc'
|
BF_CYCLES_CUDA_NVCC = '/usr/local/cuda/bin/nvcc'
|
||||||
BF_CYCLES_CUDA_BINARIES_ARCH = ['sm_20', 'sm_21', 'sm_30', 'sm_35', 'sm_50', 'sm_52']
|
BF_CYCLES_CUDA_BINARIES_ARCH = ['sm_20', 'sm_21', 'sm_30', 'sm_35', 'sm_50']
|
||||||
|
|
||||||
WITH_BF_OPENMP = True
|
WITH_BF_OPENMP = True
|
||||||
|
|
||||||
@@ -230,8 +230,7 @@ WITH_BF_FREESTYLE = True
|
|||||||
CC = 'gcc'
|
CC = 'gcc'
|
||||||
CXX = 'g++'
|
CXX = 'g++'
|
||||||
|
|
||||||
CCFLAGS = ['-pipe','-fPIC','-funsigned-char','-fno-strict-aliasing', '-D_LARGEFILE_SOURCE', '-D_FILE_OFFSET_BITS=64','-D_LARGEFILE64_SOURCE']
|
CCFLAGS = ['-pipe','-fPIC','-funsigned-char','-fno-strict-aliasing','-D_LARGEFILE_SOURCE', '-D_FILE_OFFSET_BITS=64','-D_LARGEFILE64_SOURCE']
|
||||||
CFLAGS = ['-std=gnu89']
|
|
||||||
CXXFLAGS = []
|
CXXFLAGS = []
|
||||||
|
|
||||||
CPPFLAGS = []
|
CPPFLAGS = []
|
||||||
|
@@ -145,7 +145,7 @@ BF_OPENCOLLADA_LIBPATH = '${BF_OPENCOLLADA}/lib/opencollada'
|
|||||||
WITH_BF_CYCLES = True
|
WITH_BF_CYCLES = True
|
||||||
WITH_BF_CYCLES_CUDA_BINARIES = False
|
WITH_BF_CYCLES_CUDA_BINARIES = False
|
||||||
BF_CYCLES_CUDA_NVCC = "" # Path to the NVIDIA CUDA compiler
|
BF_CYCLES_CUDA_NVCC = "" # Path to the NVIDIA CUDA compiler
|
||||||
BF_CYCLES_CUDA_BINARIES_ARCH = ['sm_20', 'sm_21', 'sm_30', 'sm_35', 'sm_50', 'sm_52']
|
BF_CYCLES_CUDA_BINARIES_ARCH = ['sm_20', 'sm_21', 'sm_30', 'sm_35', 'sm_50']
|
||||||
|
|
||||||
WITH_BF_OIIO = True
|
WITH_BF_OIIO = True
|
||||||
BF_OIIO = LIBDIR + '/openimageio'
|
BF_OIIO = LIBDIR + '/openimageio'
|
||||||
@@ -170,8 +170,6 @@ BF_BOOST_LIBPATH = '${BF_BOOST}/lib'
|
|||||||
WITH_BF_RAYOPTIMIZATION = True
|
WITH_BF_RAYOPTIMIZATION = True
|
||||||
BF_RAYOPTIMIZATION_SSE_FLAGS = ['-msse']
|
BF_RAYOPTIMIZATION_SSE_FLAGS = ['-msse']
|
||||||
|
|
||||||
WITH_BF_IME = True
|
|
||||||
|
|
||||||
WITH_BF_OPENMP = True
|
WITH_BF_OPENMP = True
|
||||||
|
|
||||||
#CUDA
|
#CUDA
|
||||||
@@ -198,10 +196,7 @@ C_WARN = ['-Wno-char-subscripts', '-Wdeclaration-after-statement', '-Wstrict-pro
|
|||||||
|
|
||||||
CC_WARN = [ '-Wall' ]
|
CC_WARN = [ '-Wall' ]
|
||||||
|
|
||||||
LLIBS = ['-lshell32', '-lshfolder', '-lgdi32', '-lmsvcrt', '-lwinmm', '-lmingw32', '-lm', '-lws2_32', '-lz', '-lstdc++','-lole32','-luuid', '-lwsock32', '-lpsapi', '-ldbghelp']
|
LLIBS = ['-lshell32', '-lshfolder', '-lgdi32', '-lmsvcrt', '-lwinmm', '-lmingw32', '-lm', '-lws2_32', '-lz', '-lstdc++','-lole32','-luuid', '-lwsock32', '-lpsapi', '-limm32']
|
||||||
|
|
||||||
if WITH_BF_IME:
|
|
||||||
LLIBS.append('-limm32')
|
|
||||||
|
|
||||||
PLATFORM_LINKFLAGS = ['-Xlinker', '--stack=2097152']
|
PLATFORM_LINKFLAGS = ['-Xlinker', '--stack=2097152']
|
||||||
|
|
||||||
|
@@ -33,7 +33,7 @@ WITH_BF_PYTHON_INSTALL_NUMPY = True
|
|||||||
WITH_BF_OPENAL = True
|
WITH_BF_OPENAL = True
|
||||||
BF_OPENAL = LIBDIR + '/openal'
|
BF_OPENAL = LIBDIR + '/openal'
|
||||||
BF_OPENAL_INC = '${BF_OPENAL}/include '
|
BF_OPENAL_INC = '${BF_OPENAL}/include '
|
||||||
BF_OPENAL_LIB = 'OpenAL32'
|
BF_OPENAL_LIB = 'wrap_oal'
|
||||||
BF_OPENAL_LIBPATH = '${BF_OPENAL}/lib'
|
BF_OPENAL_LIBPATH = '${BF_OPENAL}/lib'
|
||||||
|
|
||||||
WITH_BF_ICONV = True
|
WITH_BF_ICONV = True
|
||||||
@@ -69,7 +69,7 @@ WITH_BF_OPENEXR = True
|
|||||||
WITH_BF_STATICOPENEXR = False
|
WITH_BF_STATICOPENEXR = False
|
||||||
BF_OPENEXR = LIBDIR + '/openexr'
|
BF_OPENEXR = LIBDIR + '/openexr'
|
||||||
BF_OPENEXR_INC = '${BF_OPENEXR}/include ${BF_OPENEXR}/include/OpenEXR '
|
BF_OPENEXR_INC = '${BF_OPENEXR}/include ${BF_OPENEXR}/include/OpenEXR '
|
||||||
BF_OPENEXR_LIB = ' Iex-2_2 Half IlmImf-2_2 Imath-2_2 IlmThread-2_2 '
|
BF_OPENEXR_LIB = ' Iex-2_1 Half IlmImf-2_1 Imath-2_1 IlmThread-2_1 '
|
||||||
BF_OPENEXR_LIBPATH = '${BF_OPENEXR}/lib'
|
BF_OPENEXR_LIBPATH = '${BF_OPENEXR}/lib'
|
||||||
BF_OPENEXR_LIB_STATIC = '${BF_OPENEXR}/lib/libHalf.a ${BF_OPENEXR}/lib/libIlmImf.a ${BF_OPENEXR}/lib/libIex.a ${BF_OPENEXR}/lib/libImath.a ${BF_OPENEXR}/lib/libIlmThread.a'
|
BF_OPENEXR_LIB_STATIC = '${BF_OPENEXR}/lib/libHalf.a ${BF_OPENEXR}/lib/libIlmImf.a ${BF_OPENEXR}/lib/libIex.a ${BF_OPENEXR}/lib/libImath.a ${BF_OPENEXR}/lib/libIlmThread.a'
|
||||||
|
|
||||||
@@ -151,8 +151,6 @@ BF_OPENCOLLADA_INC = '${BF_OPENCOLLADA}/include/opencollada'
|
|||||||
BF_OPENCOLLADA_LIB = 'OpenCOLLADAStreamWriter OpenCOLLADASaxFrameworkLoader OpenCOLLADAFramework OpenCOLLADABaseUtils GeneratedSaxParser MathMLSolver xml pcre buffer ftoa'
|
BF_OPENCOLLADA_LIB = 'OpenCOLLADAStreamWriter OpenCOLLADASaxFrameworkLoader OpenCOLLADAFramework OpenCOLLADABaseUtils GeneratedSaxParser MathMLSolver xml pcre buffer ftoa'
|
||||||
BF_OPENCOLLADA_LIBPATH = '${BF_OPENCOLLADA}/lib/opencollada'
|
BF_OPENCOLLADA_LIBPATH = '${BF_OPENCOLLADA}/lib/opencollada'
|
||||||
|
|
||||||
WITH_BF_IME = True
|
|
||||||
|
|
||||||
WITH_BF_3DMOUSE = True
|
WITH_BF_3DMOUSE = True
|
||||||
|
|
||||||
WITH_BF_OPENMP = True
|
WITH_BF_OPENMP = True
|
||||||
@@ -237,10 +235,7 @@ C_WARN = []
|
|||||||
CC_WARN = []
|
CC_WARN = []
|
||||||
CXX_WARN = []
|
CXX_WARN = []
|
||||||
|
|
||||||
LLIBS = ['ws2_32', 'vfw32', 'winmm', 'kernel32', 'user32', 'gdi32', 'comdlg32', 'advapi32', 'shfolder', 'shell32', 'ole32', 'oleaut32', 'uuid', 'psapi', 'Dbghelp']
|
LLIBS = ['ws2_32', 'vfw32', 'winmm', 'kernel32', 'user32', 'gdi32', 'comdlg32', 'advapi32', 'shfolder', 'shell32', 'ole32', 'oleaut32', 'uuid', 'psapi', 'imm32']
|
||||||
|
|
||||||
if WITH_BF_IME:
|
|
||||||
LLIBS.append('imm32')
|
|
||||||
|
|
||||||
PLATFORM_LINKFLAGS = ['/SUBSYSTEM:CONSOLE','/MACHINE:IX86','/STACK:2097152','/INCREMENTAL:NO', '/LARGEADDRESSAWARE', '/NODEFAULTLIB:msvcrt.lib', '/NODEFAULTLIB:msvcmrt.lib', '/NODEFAULTLIB:msvcurt.lib', '/NODEFAULTLIB:msvcrtd.lib']
|
PLATFORM_LINKFLAGS = ['/SUBSYSTEM:CONSOLE','/MACHINE:IX86','/STACK:2097152','/INCREMENTAL:NO', '/LARGEADDRESSAWARE', '/NODEFAULTLIB:msvcrt.lib', '/NODEFAULTLIB:msvcmrt.lib', '/NODEFAULTLIB:msvcurt.lib', '/NODEFAULTLIB:msvcrtd.lib']
|
||||||
|
|
||||||
|
@@ -144,7 +144,7 @@ BF_OPENCOLLADA_LIBPATH = '${BF_OPENCOLLADA}/lib/opencollada'
|
|||||||
WITH_BF_CYCLES = True
|
WITH_BF_CYCLES = True
|
||||||
WITH_BF_CYCLES_CUDA_BINARIES = False
|
WITH_BF_CYCLES_CUDA_BINARIES = False
|
||||||
BF_CYCLES_CUDA_NVCC = "" # Path to the NVIDIA CUDA compiler
|
BF_CYCLES_CUDA_NVCC = "" # Path to the NVIDIA CUDA compiler
|
||||||
BF_CYCLES_CUDA_BINARIES_ARCH = ['sm_20', 'sm_21', 'sm_30', 'sm_35', 'sm_50', 'sm_52']
|
BF_CYCLES_CUDA_BINARIES_ARCH = ['sm_20', 'sm_21', 'sm_30', 'sm_35', 'sm_50']
|
||||||
|
|
||||||
WITH_BF_OIIO = True
|
WITH_BF_OIIO = True
|
||||||
BF_OIIO = LIBDIR + '/openimageio'
|
BF_OIIO = LIBDIR + '/openimageio'
|
||||||
@@ -169,8 +169,6 @@ BF_BOOST_LIBPATH = '${BF_BOOST}/lib'
|
|||||||
WITH_BF_RAYOPTIMIZATION = True
|
WITH_BF_RAYOPTIMIZATION = True
|
||||||
BF_RAYOPTIMIZATION_SSE_FLAGS = ['-mmmx', '-msse', '-msse2']
|
BF_RAYOPTIMIZATION_SSE_FLAGS = ['-mmmx', '-msse', '-msse2']
|
||||||
|
|
||||||
WITH_BF_IME = True
|
|
||||||
|
|
||||||
WITH_BF_OPENMP = True
|
WITH_BF_OPENMP = True
|
||||||
|
|
||||||
#Freestyle
|
#Freestyle
|
||||||
@@ -188,15 +186,11 @@ REL_CFLAGS = []
|
|||||||
REL_CXXFLAGS = []
|
REL_CXXFLAGS = []
|
||||||
REL_CCFLAGS = ['-O2', '-ftree-vectorize']
|
REL_CCFLAGS = ['-O2', '-ftree-vectorize']
|
||||||
|
|
||||||
# NOTE: C_WARN seems to get ignored - at least -Wno-char-subscripts doesn't work!
|
|
||||||
C_WARN = ['-Wno-char-subscripts', '-Wdeclaration-after-statement', '-Wstrict-prototypes']
|
C_WARN = ['-Wno-char-subscripts', '-Wdeclaration-after-statement', '-Wstrict-prototypes']
|
||||||
|
|
||||||
CC_WARN = [ '-Wall', '-Wno-char-subscripts' ]
|
CC_WARN = [ '-Wall' ]
|
||||||
|
|
||||||
LLIBS = ['-lshell32', '-lshfolder', '-lgdi32', '-lmsvcrt', '-lwinmm', '-lmingw32', '-lm', '-lws2_32', '-lz', '-lstdc++','-lole32','-luuid', '-lwsock32', '-lpsapi', '-lpthread', '-ldbghelp']
|
LLIBS = ['-lshell32', '-lshfolder', '-lgdi32', '-lmsvcrt', '-lwinmm', '-lmingw32', '-lm', '-lws2_32', '-lz', '-lstdc++','-lole32','-luuid', '-lwsock32', '-lpsapi', '-lpthread', '-limm32']
|
||||||
|
|
||||||
if WITH_BF_IME:
|
|
||||||
LLIBS.append('-limm32')
|
|
||||||
|
|
||||||
PLATFORM_LINKFLAGS = ['-Xlinker', '--stack=2097152']
|
PLATFORM_LINKFLAGS = ['-Xlinker', '--stack=2097152']
|
||||||
|
|
||||||
|
@@ -34,7 +34,7 @@ WITH_BF_PYTHON_INSTALL_NUMPY = True
|
|||||||
WITH_BF_OPENAL = True
|
WITH_BF_OPENAL = True
|
||||||
BF_OPENAL = LIBDIR + '/openal'
|
BF_OPENAL = LIBDIR + '/openal'
|
||||||
BF_OPENAL_INC = '${BF_OPENAL}/include '
|
BF_OPENAL_INC = '${BF_OPENAL}/include '
|
||||||
BF_OPENAL_LIB = 'OpenAL32'
|
BF_OPENAL_LIB = 'wrap_oal'
|
||||||
BF_OPENAL_LIBPATH = '${BF_OPENAL}/lib'
|
BF_OPENAL_LIBPATH = '${BF_OPENAL}/lib'
|
||||||
|
|
||||||
WITH_BF_SNDFILE = True
|
WITH_BF_SNDFILE = True
|
||||||
@@ -66,7 +66,7 @@ WITH_BF_OPENEXR = True
|
|||||||
WITH_BF_STATICOPENEXR = False
|
WITH_BF_STATICOPENEXR = False
|
||||||
BF_OPENEXR = LIBDIR + '/openexr'
|
BF_OPENEXR = LIBDIR + '/openexr'
|
||||||
BF_OPENEXR_INC = '${BF_OPENEXR}/include ${BF_OPENEXR}/include/OpenEXR '
|
BF_OPENEXR_INC = '${BF_OPENEXR}/include ${BF_OPENEXR}/include/OpenEXR '
|
||||||
BF_OPENEXR_LIB = ' Iex-2_2 Half IlmImf-2_2 Imath-2_2 IlmThread-2_2 '
|
BF_OPENEXR_LIB = ' Iex-2_1 Half IlmImf-2_1 Imath-2_1 IlmThread-2_1 '
|
||||||
BF_OPENEXR_LIBPATH = '${BF_OPENEXR}/lib'
|
BF_OPENEXR_LIBPATH = '${BF_OPENEXR}/lib'
|
||||||
BF_OPENEXR_LIB_STATIC = '${BF_OPENEXR}/lib/libHalf.a ${BF_OPENEXR}/lib/libIlmImf.a ${BF_OPENEXR}/lib/libIex.a ${BF_OPENEXR}/lib/libImath.a ${BF_OPENEXR}/lib/libIlmThread.a'
|
BF_OPENEXR_LIB_STATIC = '${BF_OPENEXR}/lib/libHalf.a ${BF_OPENEXR}/lib/libIlmImf.a ${BF_OPENEXR}/lib/libIex.a ${BF_OPENEXR}/lib/libImath.a ${BF_OPENEXR}/lib/libIlmThread.a'
|
||||||
|
|
||||||
@@ -154,8 +154,6 @@ BF_OPENCOLLADA_INC = '${BF_OPENCOLLADA}/include/opencollada'
|
|||||||
BF_OPENCOLLADA_LIB = 'OpenCOLLADAStreamWriter OpenCOLLADASaxFrameworkLoader OpenCOLLADAFramework OpenCOLLADABaseUtils GeneratedSaxParser MathMLSolver xml pcre buffer ftoa'
|
BF_OPENCOLLADA_LIB = 'OpenCOLLADAStreamWriter OpenCOLLADASaxFrameworkLoader OpenCOLLADAFramework OpenCOLLADABaseUtils GeneratedSaxParser MathMLSolver xml pcre buffer ftoa'
|
||||||
BF_OPENCOLLADA_LIBPATH = '${BF_OPENCOLLADA}/lib/opencollada'
|
BF_OPENCOLLADA_LIBPATH = '${BF_OPENCOLLADA}/lib/opencollada'
|
||||||
|
|
||||||
WITH_BF_IME = True
|
|
||||||
|
|
||||||
WITH_BF_3DMOUSE = True
|
WITH_BF_3DMOUSE = True
|
||||||
|
|
||||||
WITH_BF_OPENMP = True
|
WITH_BF_OPENMP = True
|
||||||
@@ -244,10 +242,7 @@ C_WARN = []
|
|||||||
CC_WARN = []
|
CC_WARN = []
|
||||||
CXX_WARN = []
|
CXX_WARN = []
|
||||||
|
|
||||||
LLIBS = ['ws2_32', 'vfw32', 'winmm', 'kernel32', 'user32', 'gdi32', 'comdlg32', 'advapi32', 'shfolder', 'shell32', 'ole32', 'oleaut32', 'uuid', 'psapi', 'Dbghelp']
|
LLIBS = ['ws2_32', 'vfw32', 'winmm', 'kernel32', 'user32', 'gdi32', 'comdlg32', 'advapi32', 'shfolder', 'shell32', 'ole32', 'oleaut32', 'uuid', 'psapi', 'imm32']
|
||||||
|
|
||||||
if WITH_BF_IME:
|
|
||||||
LLIBS.append('imm32')
|
|
||||||
|
|
||||||
PLATFORM_LINKFLAGS = ['/SUBSYSTEM:CONSOLE','/MACHINE:X64','/STACK:2097152','/OPT:NOREF','/INCREMENTAL:NO', '/NODEFAULTLIB:msvcrt.lib', '/NODEFAULTLIB:msvcmrt.lib', '/NODEFAULTLIB:msvcurt.lib', '/NODEFAULTLIB:msvcrtd.lib']
|
PLATFORM_LINKFLAGS = ['/SUBSYSTEM:CONSOLE','/MACHINE:X64','/STACK:2097152','/OPT:NOREF','/INCREMENTAL:NO', '/NODEFAULTLIB:msvcrt.lib', '/NODEFAULTLIB:msvcmrt.lib', '/NODEFAULTLIB:msvcurt.lib', '/NODEFAULTLIB:msvcrtd.lib']
|
||||||
|
|
||||||
|
42
build_files/scons/tools/Blender.py
Normal file → Executable file
42
build_files/scons/tools/Blender.py
Normal file → Executable file
@@ -216,16 +216,16 @@ def setup_staticlibs(lenv):
|
|||||||
if lenv['WITH_BF_STATICOCIO']:
|
if lenv['WITH_BF_STATICOCIO']:
|
||||||
statlibs += Split(lenv['BF_OCIO_LIB_STATIC'])
|
statlibs += Split(lenv['BF_OCIO_LIB_STATIC'])
|
||||||
|
|
||||||
if lenv['WITH_BF_CYCLES_OSL']:
|
|
||||||
libincs += Split(lenv['BF_OSL_LIBPATH'])
|
|
||||||
if lenv['WITH_BF_STATICOSL']:
|
|
||||||
statlibs += Split(lenv['BF_OSL_LIB_STATIC'])
|
|
||||||
|
|
||||||
if lenv['WITH_BF_BOOST']:
|
if lenv['WITH_BF_BOOST']:
|
||||||
libincs += Split(lenv['BF_BOOST_LIBPATH'])
|
libincs += Split(lenv['BF_BOOST_LIBPATH'])
|
||||||
if lenv['WITH_BF_STATICBOOST']:
|
if lenv['WITH_BF_STATICBOOST']:
|
||||||
statlibs += Split(lenv['BF_BOOST_LIB_STATIC'])
|
statlibs += Split(lenv['BF_BOOST_LIB_STATIC'])
|
||||||
|
|
||||||
|
if lenv['WITH_BF_CYCLES_OSL']:
|
||||||
|
libincs += Split(lenv['BF_OSL_LIBPATH'])
|
||||||
|
if lenv['WITH_BF_STATICOSL']:
|
||||||
|
statlibs += Split(lenv['BF_OSL_LIB_STATIC'])
|
||||||
|
|
||||||
if lenv['WITH_BF_LLVM']:
|
if lenv['WITH_BF_LLVM']:
|
||||||
libincs += Split(lenv['BF_LLVM_LIBPATH'])
|
libincs += Split(lenv['BF_LLVM_LIBPATH'])
|
||||||
if lenv['WITH_BF_STATICLLVM']:
|
if lenv['WITH_BF_STATICLLVM']:
|
||||||
@@ -325,16 +325,16 @@ def setup_syslibs(lenv):
|
|||||||
if lenv['WITH_BF_3DMOUSE']:
|
if lenv['WITH_BF_3DMOUSE']:
|
||||||
if not lenv['WITH_BF_STATIC3DMOUSE']:
|
if not lenv['WITH_BF_STATIC3DMOUSE']:
|
||||||
syslibs += Split(lenv['BF_3DMOUSE_LIB'])
|
syslibs += Split(lenv['BF_3DMOUSE_LIB'])
|
||||||
|
|
||||||
|
if lenv['WITH_BF_BOOST'] and not lenv['WITH_BF_STATICBOOST']:
|
||||||
|
syslibs += Split(lenv['BF_BOOST_LIB'])
|
||||||
|
|
||||||
|
if lenv['WITH_BF_INTERNATIONAL']:
|
||||||
|
syslibs += Split(lenv['BF_BOOST_LIB_INTERNATIONAL'])
|
||||||
|
|
||||||
if lenv['WITH_BF_CYCLES_OSL'] and not lenv['WITH_BF_STATICOSL']:
|
if lenv['WITH_BF_CYCLES_OSL'] and not lenv['WITH_BF_STATICOSL']:
|
||||||
syslibs += Split(lenv['BF_OSL_LIB'])
|
syslibs += Split(lenv['BF_OSL_LIB'])
|
||||||
|
|
||||||
if lenv['WITH_BF_BOOST'] and not lenv['WITH_BF_STATICBOOST']:
|
|
||||||
syslibs += Split(lenv['BF_BOOST_LIB'])
|
|
||||||
|
|
||||||
if lenv['WITH_BF_INTERNATIONAL']:
|
|
||||||
syslibs += Split(lenv['BF_BOOST_LIB_INTERNATIONAL'])
|
|
||||||
|
|
||||||
if lenv['WITH_BF_LLVM'] and not lenv['WITH_BF_STATICLLVM']:
|
if lenv['WITH_BF_LLVM'] and not lenv['WITH_BF_STATICLLVM']:
|
||||||
syslibs += Split(lenv['BF_LLVM_LIB'])
|
syslibs += Split(lenv['BF_LLVM_LIB'])
|
||||||
|
|
||||||
@@ -372,7 +372,7 @@ def propose_priorities():
|
|||||||
def creator(env):
|
def creator(env):
|
||||||
sources = ['creator.c']# + Blender.buildinfo(env, "dynamic") + Blender.resources
|
sources = ['creator.c']# + Blender.buildinfo(env, "dynamic") + Blender.resources
|
||||||
|
|
||||||
incs = ['#/intern/guardedalloc', '#/source/blender/blenlib', '#/source/blender/blenkernel', '#/source/blender/depsgraph', '#/source/blender/editors/include', '#/source/blender/blenloader', '#/source/blender/imbuf', '#/source/blender/renderconverter', '#/source/blender/render/extern/include', '#/source/blender/windowmanager', '#/source/blender/makesdna', '#/source/blender/makesrna', '#/source/gameengine/BlenderRoutines', '#/extern/glew/include', '#/source/blender/gpu', env['BF_OPENGL_INC']]
|
incs = ['#/intern/guardedalloc', '#/source/blender/blenlib', '#/source/blender/blenkernel', '#/source/blender/editors/include', '#/source/blender/blenloader', '#/source/blender/imbuf', '#/source/blender/renderconverter', '#/source/blender/render/extern/include', '#/source/blender/windowmanager', '#/source/blender/makesdna', '#/source/blender/makesrna', '#/source/gameengine/BlenderRoutines', '#/extern/glew/include', '#/source/blender/gpu', env['BF_OPENGL_INC']]
|
||||||
|
|
||||||
defs = []
|
defs = []
|
||||||
|
|
||||||
@@ -441,7 +441,7 @@ def buildinfo(lenv, build_type):
|
|||||||
no_upstream = False
|
no_upstream = False
|
||||||
|
|
||||||
try :
|
try :
|
||||||
build_hash = btools.get_command_output(['git', 'rev-parse', '--short', '@{u}'], stderr=subprocess.STDOUT).strip()
|
build_hash = btools.get_command_output(['git', 'rev-parse', '--short', '@{u}']).strip()
|
||||||
except subprocess.CalledProcessError:
|
except subprocess.CalledProcessError:
|
||||||
# assume branch has no upstream configured
|
# assume branch has no upstream configured
|
||||||
build_hash = btools.get_command_output(['git', 'rev-parse', '--short', 'HEAD']).strip()
|
build_hash = btools.get_command_output(['git', 'rev-parse', '--short', 'HEAD']).strip()
|
||||||
@@ -630,7 +630,7 @@ def WinPyBundle(target=None, source=None, env=None):
|
|||||||
py_tar+= '/release/python' + env['BF_PYTHON_VERSION'].replace('.','') + '.tar.gz'
|
py_tar+= '/release/python' + env['BF_PYTHON_VERSION'].replace('.','') + '.tar.gz'
|
||||||
|
|
||||||
py_target = env.subst(env['BF_INSTALLDIR']).lstrip("#")
|
py_target = env.subst(env['BF_INSTALLDIR']).lstrip("#")
|
||||||
py_target = os.path.join(py_target, VERSION, 'python')
|
py_target = os.path.join(py_target, VERSION, 'python', 'lib')
|
||||||
def printexception(func,path,ex):
|
def printexception(func,path,ex):
|
||||||
if os.path.exists(path): #do not report if path does not exist. eg on a fresh build.
|
if os.path.exists(path): #do not report if path does not exist. eg on a fresh build.
|
||||||
print str(func) + ' failed on ' + str(path)
|
print str(func) + ' failed on ' + str(path)
|
||||||
@@ -654,7 +654,7 @@ def WinPyBundle(target=None, source=None, env=None):
|
|||||||
# Extract Numpy
|
# Extract Numpy
|
||||||
if env['WITH_BF_PYTHON_INSTALL_NUMPY']:
|
if env['WITH_BF_PYTHON_INSTALL_NUMPY']:
|
||||||
py_tar = env.subst(env['LCGDIR']).lstrip("#")
|
py_tar = env.subst(env['LCGDIR']).lstrip("#")
|
||||||
py_tar += '/release/python' + env['BF_PYTHON_VERSION'].replace('.','') + '_numpy_1.9.tar.gz'
|
py_tar += '/release/python' + env['BF_PYTHON_VERSION'].replace('.','') + '_numpy_1.8.tar.gz'
|
||||||
|
|
||||||
py_target = env.subst(env['BF_INSTALLDIR']).lstrip("#")
|
py_target = env.subst(env['BF_INSTALLDIR']).lstrip("#")
|
||||||
py_target = os.path.join(py_target, VERSION, 'python', 'lib', 'site-packages')
|
py_target = os.path.join(py_target, VERSION, 'python', 'lib', 'site-packages')
|
||||||
@@ -670,8 +670,6 @@ def WinPyBundle(target=None, source=None, env=None):
|
|||||||
py_dir += '/release/site-packages'
|
py_dir += '/release/site-packages'
|
||||||
# grr, we have to do one by one because the dir exists
|
# grr, we have to do one by one because the dir exists
|
||||||
for f in os.listdir(py_dir):
|
for f in os.listdir(py_dir):
|
||||||
if f == '.svn':
|
|
||||||
continue
|
|
||||||
fn_src = os.path.join(py_dir, f)
|
fn_src = os.path.join(py_dir, f)
|
||||||
fn_dst = os.path.join(py_target, f)
|
fn_dst = os.path.join(py_target, f)
|
||||||
|
|
||||||
@@ -764,7 +762,7 @@ def AppIt(target=None, source=None, env=None):
|
|||||||
commands.getoutput(cmd)
|
commands.getoutput(cmd)
|
||||||
cmd = 'cp -R %s/kernel/*.h %s/kernel/*.cl %s/kernel/*.cu %s/kernel/' % (croot, croot, croot, cinstalldir)
|
cmd = 'cp -R %s/kernel/*.h %s/kernel/*.cl %s/kernel/*.cu %s/kernel/' % (croot, croot, croot, cinstalldir)
|
||||||
commands.getoutput(cmd)
|
commands.getoutput(cmd)
|
||||||
cmd = 'cp -R %s/kernel/svm %s/kernel/closure %s/kernel/geom %s/kernel/split %s/kernel/kernels %s/util/util_color.h %s/util/util_half.h %s/util/util_math.h %s/util/util_math_fast.h %s/util/util_transform.h %s/util/util_types.h %s/util/util_atomic.h %s/kernel/' % (croot, croot, croot, croot, croot, croot, croot, croot, croot, croot, croot, croot, cinstalldir)
|
cmd = 'cp -R %s/kernel/svm %s/kernel/closure %s/kernel/geom %s/util/util_color.h %s/util/util_half.h %s/util/util_math.h %s/util/util_transform.h %s/util/util_types.h %s/kernel/' % (croot, croot, croot, croot, croot, croot, croot, croot, cinstalldir)
|
||||||
commands.getoutput(cmd)
|
commands.getoutput(cmd)
|
||||||
cmd = 'cp -R %s/../intern/cycles/kernel/*.cubin %s/lib/' % (builddir, cinstalldir)
|
cmd = 'cp -R %s/../intern/cycles/kernel/*.cubin %s/lib/' % (builddir, cinstalldir)
|
||||||
commands.getoutput(cmd)
|
commands.getoutput(cmd)
|
||||||
@@ -818,8 +816,6 @@ def AppIt(target=None, source=None, env=None):
|
|||||||
instname = env['LCGDIR'][1:] # made libiomp5 part of blender libs
|
instname = env['LCGDIR'][1:] # made libiomp5 part of blender libs
|
||||||
cmd = 'ditto --arch %s %s/openmp/lib/libiomp5.dylib %s/%s.app/Contents/Resources/lib/'%(osxarch, instname, installdir, binary) # copy libiomp5
|
cmd = 'ditto --arch %s %s/openmp/lib/libiomp5.dylib %s/%s.app/Contents/Resources/lib/'%(osxarch, instname, installdir, binary) # copy libiomp5
|
||||||
commands.getoutput(cmd)
|
commands.getoutput(cmd)
|
||||||
cmd = 'cp %s/openmp/LICENSE.txt %s/LICENSE-libiomp5.txt'%(instname, installdir) # copy libiomp5 license
|
|
||||||
commands.getoutput(cmd)
|
|
||||||
|
|
||||||
# extract copy system python, be sure to update other build systems
|
# extract copy system python, be sure to update other build systems
|
||||||
# when making changes to the files that are copied.
|
# when making changes to the files that are copied.
|
||||||
@@ -843,7 +839,6 @@ def UnixPyBundle(target=None, source=None, env=None):
|
|||||||
|
|
||||||
py_src = env.subst( env['BF_PYTHON_LIBPATH'] + '/python'+env['BF_PYTHON_VERSION'] )
|
py_src = env.subst( env['BF_PYTHON_LIBPATH'] + '/python'+env['BF_PYTHON_VERSION'] )
|
||||||
py_target = env.subst( dir + '/python/' + target_lib + '/python'+env['BF_PYTHON_VERSION'] )
|
py_target = env.subst( dir + '/python/' + target_lib + '/python'+env['BF_PYTHON_VERSION'] )
|
||||||
py_target_bin = env.subst(dir + '/python/bin')
|
|
||||||
|
|
||||||
# This is a bit weak, but dont install if its been installed before, makes rebuilds quite slow.
|
# This is a bit weak, but dont install if its been installed before, makes rebuilds quite slow.
|
||||||
if os.path.exists(py_target):
|
if os.path.exists(py_target):
|
||||||
@@ -863,11 +858,6 @@ def UnixPyBundle(target=None, source=None, env=None):
|
|||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
# install the executable
|
|
||||||
run("rm -rf '%s'" % py_target_bin)
|
|
||||||
os.makedirs(py_target_bin)
|
|
||||||
run("cp '%s' '%s'" % (env.subst(env['BF_PYTHON_BINARY']), py_target_bin))
|
|
||||||
|
|
||||||
run("cp -R '%s' '%s'" % (py_src, os.path.dirname(py_target)))
|
run("cp -R '%s' '%s'" % (py_src, os.path.dirname(py_target)))
|
||||||
run("rm -rf '%s/distutils'" % py_target)
|
run("rm -rf '%s/distutils'" % py_target)
|
||||||
run("rm -rf '%s/lib2to3'" % py_target)
|
run("rm -rf '%s/lib2to3'" % py_target)
|
||||||
|
@@ -174,7 +174,6 @@ def validate_arguments(args, bc):
|
|||||||
'WITH_BF_CXX_GUARDEDALLOC',
|
'WITH_BF_CXX_GUARDEDALLOC',
|
||||||
'WITH_BF_JEMALLOC', 'WITH_BF_STATICJEMALLOC', 'BF_JEMALLOC', 'BF_JEMALLOC_INC', 'BF_JEMALLOC_LIBPATH', 'BF_JEMALLOC_LIB', 'BF_JEMALLOC_LIB_STATIC',
|
'WITH_BF_JEMALLOC', 'WITH_BF_STATICJEMALLOC', 'BF_JEMALLOC', 'BF_JEMALLOC_INC', 'BF_JEMALLOC_LIBPATH', 'BF_JEMALLOC_LIB', 'BF_JEMALLOC_LIB_STATIC',
|
||||||
'BUILDBOT_BRANCH',
|
'BUILDBOT_BRANCH',
|
||||||
'WITH_BF_IME',
|
|
||||||
'WITH_BF_3DMOUSE', 'WITH_BF_STATIC3DMOUSE', 'BF_3DMOUSE', 'BF_3DMOUSE_INC', 'BF_3DMOUSE_LIB', 'BF_3DMOUSE_LIBPATH', 'BF_3DMOUSE_LIB_STATIC',
|
'WITH_BF_3DMOUSE', 'WITH_BF_STATIC3DMOUSE', 'BF_3DMOUSE', 'BF_3DMOUSE_INC', 'BF_3DMOUSE_LIB', 'BF_3DMOUSE_LIBPATH', 'BF_3DMOUSE_LIB_STATIC',
|
||||||
'WITH_BF_CYCLES', 'WITH_BF_CYCLES_CUDA_BINARIES', 'BF_CYCLES_CUDA_NVCC', 'BF_CYCLES_CUDA_NVCC', 'WITH_BF_CYCLES_CUDA_THREADED_COMPILE', 'BF_CYCLES_CUDA_ENV',
|
'WITH_BF_CYCLES', 'WITH_BF_CYCLES_CUDA_BINARIES', 'BF_CYCLES_CUDA_NVCC', 'BF_CYCLES_CUDA_NVCC', 'WITH_BF_CYCLES_CUDA_THREADED_COMPILE', 'BF_CYCLES_CUDA_ENV',
|
||||||
'WITH_BF_OIIO', 'WITH_BF_STATICOIIO', 'BF_OIIO', 'BF_OIIO_INC', 'BF_OIIO_LIB', 'BF_OIIO_LIB_STATIC', 'BF_OIIO_LIBPATH',
|
'WITH_BF_OIIO', 'WITH_BF_STATICOIIO', 'BF_OIIO', 'BF_OIIO_INC', 'BF_OIIO_LIB', 'BF_OIIO_LIB_STATIC', 'BF_OIIO_LIBPATH',
|
||||||
@@ -198,8 +197,7 @@ def validate_arguments(args, bc):
|
|||||||
'C_WARN', 'CC_WARN', 'CXX_WARN',
|
'C_WARN', 'CC_WARN', 'CXX_WARN',
|
||||||
'LLIBS', 'PLATFORM_LINKFLAGS', 'MACOSX_ARCHITECTURE', 'MACOSX_SDK', 'XCODE_CUR_VER', 'C_COMPILER_ID',
|
'LLIBS', 'PLATFORM_LINKFLAGS', 'MACOSX_ARCHITECTURE', 'MACOSX_SDK', 'XCODE_CUR_VER', 'C_COMPILER_ID',
|
||||||
'BF_CYCLES_CUDA_BINARIES_ARCH', 'BF_PROGRAM_LINKFLAGS', 'MACOSX_DEPLOYMENT_TARGET',
|
'BF_CYCLES_CUDA_BINARIES_ARCH', 'BF_PROGRAM_LINKFLAGS', 'MACOSX_DEPLOYMENT_TARGET',
|
||||||
'WITH_BF_CYCLES_DEBUG', 'WITH_BF_CYCLES_LOGGING',
|
'WITH_BF_CYCLES_DEBUG', 'WITH_BF_CYCLES_LOGGING'
|
||||||
'WITH_BF_CPP11', 'WITH_BF_LEGACY_DEPSGRAPH',
|
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
@@ -509,8 +507,6 @@ def read_opts(env, cfg, args):
|
|||||||
(BoolVariable('WITH_BF_PLAYER', 'Build blenderplayer if true', False)),
|
(BoolVariable('WITH_BF_PLAYER', 'Build blenderplayer if true', False)),
|
||||||
(BoolVariable('WITH_BF_NOBLENDER', 'Do not build blender if true', False)),
|
(BoolVariable('WITH_BF_NOBLENDER', 'Do not build blender if true', False)),
|
||||||
|
|
||||||
(BoolVariable('WITH_BF_IME', 'Enable Input Method Editor (IME) for complex Asian character input', False)),
|
|
||||||
|
|
||||||
(BoolVariable('WITH_BF_3DMOUSE', 'Build blender with support of 3D mouses', False)),
|
(BoolVariable('WITH_BF_3DMOUSE', 'Build blender with support of 3D mouses', False)),
|
||||||
(BoolVariable('WITH_BF_STATIC3DMOUSE', 'Staticly link to 3d mouse library', False)),
|
(BoolVariable('WITH_BF_STATIC3DMOUSE', 'Staticly link to 3d mouse library', False)),
|
||||||
('BF_3DMOUSE', '3d mouse library base path', ''),
|
('BF_3DMOUSE', '3d mouse library base path', ''),
|
||||||
@@ -654,11 +650,7 @@ def read_opts(env, cfg, args):
|
|||||||
('BF_LLVM_LIBPATH', 'LLVM library path', ''),
|
('BF_LLVM_LIBPATH', 'LLVM library path', ''),
|
||||||
('BF_LLVM_LIB_STATIC', 'LLVM static library', ''),
|
('BF_LLVM_LIB_STATIC', 'LLVM static library', ''),
|
||||||
|
|
||||||
('BF_PROGRAM_LINKFLAGS', 'Link flags applied only to final binaries (blender and blenderplayer, not makesrna/makesdna)', ''),
|
('BF_PROGRAM_LINKFLAGS', 'Link flags applied only to final binaries (blender and blenderplayer, not makesrna/makesdna)', '')
|
||||||
|
|
||||||
(BoolVariable('WITH_BF_CPP11', '"Build with C++11 standard enabled, for development use only!', False)),
|
|
||||||
|
|
||||||
(BoolVariable('WITH_BF_LEGACY_DEPSGRAPH', 'Build Blender with legacy dependency graph', True)),
|
|
||||||
) # end of opts.AddOptions()
|
) # end of opts.AddOptions()
|
||||||
|
|
||||||
return localopts
|
return localopts
|
||||||
|
@@ -25,16 +25,7 @@ TARBALL="blender-$VERSION.tar.gz"
|
|||||||
cd "$blender_srcdir"
|
cd "$blender_srcdir"
|
||||||
|
|
||||||
# not so nice, but works
|
# not so nice, but works
|
||||||
FILTER_FILES_PY=\
|
FILTER_FILES_PY="import os, sys; [print(l[:-1]) for l in sys.stdin.readlines() if os.path.isfile(l[:-1])]"
|
||||||
"import os, sys; "\
|
|
||||||
"[print(l[:-1]) for l in sys.stdin.readlines() "\
|
|
||||||
"if os.path.isfile(l[:-1]) "\
|
|
||||||
"if os.path.basename(l[:-1]) not in {"\
|
|
||||||
"'.gitignore', "\
|
|
||||||
"'.gitmodules', "\
|
|
||||||
"'.arcconfig', "\
|
|
||||||
"}"\
|
|
||||||
"]"
|
|
||||||
|
|
||||||
# Build master list
|
# Build master list
|
||||||
echo -n "Building manifest of files: \"$BASE_DIR/$MANIFEST\" ..."
|
echo -n "Building manifest of files: \"$BASE_DIR/$MANIFEST\" ..."
|
||||||
|
@@ -35,14 +35,13 @@
|
|||||||
defaults.
|
defaults.
|
||||||
|
|
||||||
Much of the actual functionality can be found in the python scripts
|
Much of the actual functionality can be found in the python scripts
|
||||||
in the directory $BLENDERHOME/build_files/scons/tools, with
|
in the directory $BLENDERHOME/tools, with Blender.py defining the
|
||||||
Blender.py defining the bulk of the functionality. btools.py has some
|
bulk of the functionality. btools.py has some helper functions, and
|
||||||
helper functions, and bcolors.py is for the terminal
|
bcolors.py is for the terminal colors. mstoolkit.py and crossmingw.py
|
||||||
colors. mstoolkit.py and crossmingw.py are modules which set up SCons
|
are modules which set up SCons for the MS VC++ 2003 toolkit and
|
||||||
for the MS VC++ 2003 toolkit and the cross-compile toolset for
|
the cross-compile toolset for compiling Windows binaries on Linux
|
||||||
compiling Windows binaries on Linux respectively. Note: the
|
respectively. Note: the cross-compile doesn't work yet for Blender,
|
||||||
cross-compile doesn't work yet for Blender, but is added in
|
but is added in preparation for having it work in the distant future.
|
||||||
preparation for having it work in the distant future.
|
|
||||||
|
|
||||||
BlenderEnvironment
|
BlenderEnvironment
|
||||||
------------------
|
------------------
|
||||||
|
@@ -29,9 +29,9 @@
|
|||||||
a scons-local installation, which can be found in the scons/ subdirectory.
|
a scons-local installation, which can be found in the scons/ subdirectory.
|
||||||
This document uses the scons-local installation for its examples.
|
This document uses the scons-local installation for its examples.
|
||||||
|
|
||||||
For build instructions, including dependencies, consult the appropriate
|
Check from the page
|
||||||
section for your platform at
|
http://www.blender.org/development/building-blender/getting-dependencies/
|
||||||
http://wiki.blender.org/index.php/Dev:Doc/Building_Blender. Note that for
|
that you have all dependencies needed for building Blender. Note that for
|
||||||
windows many of these dependencies already come in the lib/windows module
|
windows many of these dependencies already come in the lib/windows module
|
||||||
from CVS.
|
from CVS.
|
||||||
|
|
||||||
@@ -53,13 +53,12 @@
|
|||||||
from the command-line is given, then all libraries and binaries to
|
from the command-line is given, then all libraries and binaries to
|
||||||
build are configured.
|
build are configured.
|
||||||
|
|
||||||
The build uses BF_BUILDDIR to build into and BF_INSTALLDIR to finally copy
|
The build uses BF_BUILDDIR to build into and BF_INSTALLDIR to
|
||||||
all needed files to get a proper setup. The BF_DOCDIR is used to generate
|
finally copy all needed files to get a proper setup. The BF_DOCDIR is
|
||||||
Blender Python documentation files to. These variables have default values
|
used to generate Blender Python documentation files to. These
|
||||||
for every platform in
|
variables have default values for every platform in
|
||||||
$BLENDERHOME/build_files/scons/config/(platform)-config.py. See the next
|
$BLENDERHOME/config/(platform)-config.py. After the build successfully
|
||||||
section of this document for how to customize these paths. After the build
|
completes, you can find everything you need in BF_INSTALLDIR.
|
||||||
successfully completes, you can find everything you need in BF_INSTALLDIR.
|
|
||||||
|
|
||||||
If you want to create the installer package of Blender on Windows you'll
|
If you want to create the installer package of Blender on Windows you'll
|
||||||
need to install nullsoft scriptable install system from http://nsis.sf.net.
|
need to install nullsoft scriptable install system from http://nsis.sf.net.
|
||||||
@@ -73,8 +72,8 @@
|
|||||||
---------------------
|
---------------------
|
||||||
|
|
||||||
The default values for your platform can be found in the directory
|
The default values for your platform can be found in the directory
|
||||||
$BLENDERHOME/build_files/scons/config. Your platform specific defaults are
|
$BLENDERHOME/config. Your platform specific defaults are in
|
||||||
in (platform)-config.py, where platform is one of:
|
(platform)-config.py, where platform is one of:
|
||||||
|
|
||||||
- linux, for machines running Linux
|
- linux, for machines running Linux
|
||||||
- win32-vc, for Windows machines, compiling with a Microsoft compiler
|
- win32-vc, for Windows machines, compiling with a Microsoft compiler
|
||||||
@@ -82,13 +81,12 @@
|
|||||||
- darwin, for OS X machines
|
- darwin, for OS X machines
|
||||||
(TBD: add cygwin, solaris and freebsd support)
|
(TBD: add cygwin, solaris and freebsd support)
|
||||||
|
|
||||||
These files you will normally not change. If you need to override a
|
These files you will normally not change. If you need to override
|
||||||
default value, make a file called $BLENDERHOME/user-config.py, and copy
|
a default value, make a file called $BLENDERHOME/user-config.py, and copy
|
||||||
settings from the build_files/scons/config/(platform)-config.py that you
|
settings from the config/(platform)-config.py that you want to change. Don't
|
||||||
want to change. Don't copy the entire file (unless explicitly stated in
|
copy the entire file (unless explicitely stated in the configuration file),
|
||||||
the configuration file), because you may not get updated options you don't
|
because you may not get updated options you don't change yourself, which may
|
||||||
change yourself, which may result in build errors. You should NEVER have
|
result in build errors.
|
||||||
to modify $BLENDERHOME/build_files/scons/config/(platform)-config.py.
|
|
||||||
|
|
||||||
You can use BF_CONFIG argument to override the default user-config.py
|
You can use BF_CONFIG argument to override the default user-config.py
|
||||||
check. This is just like the user-config.py, but just with another name:
|
check. This is just like the user-config.py, but just with another name:
|
||||||
@@ -115,6 +113,11 @@
|
|||||||
(unless you have overridden any of them in your
|
(unless you have overridden any of them in your
|
||||||
$BLENDERHOME/user-config.py).
|
$BLENDERHOME/user-config.py).
|
||||||
|
|
||||||
|
NOTE: The best way to avoid confusion is the
|
||||||
|
copy $BLENDERHOME/config/(platform)-config.py to
|
||||||
|
$BLENDERHOME/user-config.py. You should NEVER have to modify
|
||||||
|
$BLENDERHOME/config/(platform)-config.py
|
||||||
|
|
||||||
Configuring the output
|
Configuring the output
|
||||||
----------------------
|
----------------------
|
||||||
|
|
||||||
|
2384
doc/doxygen/Doxyfile
2384
doc/doxygen/Doxyfile
File diff suppressed because it is too large
Load Diff
@@ -10,14 +10,26 @@
|
|||||||
* \ingroup intern
|
* \ingroup intern
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/** \defgroup boolop boolop
|
||||||
|
* \ingroup intern
|
||||||
|
*/
|
||||||
|
|
||||||
/** \defgroup ctr container
|
/** \defgroup ctr container
|
||||||
* \ingroup intern
|
* \ingroup intern
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/** \defgroup decimation decimation
|
||||||
|
* \ingroup intern
|
||||||
|
*/
|
||||||
|
|
||||||
/** \defgroup elbeem elbeem
|
/** \defgroup elbeem elbeem
|
||||||
* \ingroup intern
|
* \ingroup intern
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/** \defgroup bsp bsp
|
||||||
|
* \ingroup intern
|
||||||
|
*/
|
||||||
|
|
||||||
/** \defgroup iksolver iksolver
|
/** \defgroup iksolver iksolver
|
||||||
* \ingroup intern
|
* \ingroup intern
|
||||||
*/
|
*/
|
@@ -7,7 +7,7 @@
|
|||||||
* These pages document the source code of blender.
|
* These pages document the source code of blender.
|
||||||
*
|
*
|
||||||
* \subsection implinks Important Links
|
* \subsection implinks Important Links
|
||||||
* - <a href="http://developer.blender.org">developer.blender.org</a> with bug tracker
|
* - <a href="http://projects.blender.org">projects.blender.org</a> with <a href="http://projects.blender.org/tracker/index.php?group_id=9&atid=498">bug tracker</a>
|
||||||
* - <a href="http://wiki.blender.org/index.php/Dev:Contents">Development documents</a> on our wiki.
|
* - <a href="http://wiki.blender.org/index.php/Dev:Contents">Development documents</a> on our wiki.
|
||||||
*
|
*
|
||||||
* \subsection blother Other
|
* \subsection blother Other
|
@@ -93,44 +93,36 @@
|
|||||||
|
|
||||||
/* ================================ */
|
/* ================================ */
|
||||||
|
|
||||||
/** \defgroup blender Blender */
|
/** \defgroup blender blender */
|
||||||
|
|
||||||
/** \defgroup blf BlenFont
|
/** \defgroup blf blenfont
|
||||||
* \ingroup blender
|
* \ingroup blender
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** \defgroup bke BlenKernel
|
/** \defgroup bke blenkernel
|
||||||
* \ingroup blender
|
* \ingroup blender
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** \defgroup bli BlenLib
|
/** \defgroup bli blenlib
|
||||||
* \ingroup blender
|
* \ingroup blender
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** \defgroup depsgraph Dependency Graph
|
/** \defgroup nodes nodes
|
||||||
* \ingroup blender
|
* \ingroup blender
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** \defgroup bph Physics
|
/** \defgroup cmpnodes cmpnodes
|
||||||
* \ingroup blender
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** \defgroup nodes Nodes
|
|
||||||
* \ingroup blender
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** \defgroup cmpnodes Nodes (Compositor)
|
|
||||||
* \ingroup nodes
|
* \ingroup nodes
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** \defgroup shdnodes Nodes (Shader)
|
/** \defgroup shdnodes shdnodes
|
||||||
* \ingroup nodes
|
* \ingroup nodes
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** \defgroup texnodes Nodes (Texture)
|
/** \defgroup texnodes texnodes
|
||||||
* \ingroup nodes
|
* \ingroup nodes
|
||||||
*/
|
*/
|
||||||
/** \defgroup modifiers Object Modifiers
|
/** \defgroup modifiers modifiers
|
||||||
* \ingroup blender
|
* \ingroup blender
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -140,29 +132,29 @@
|
|||||||
* \ingroup blender
|
* \ingroup blender
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** \defgroup ikplugin IK Plugin
|
/** \defgroup ikplugin ikplugin
|
||||||
* \ingroup blender
|
* \ingroup blender
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** \defgroup DNA Struct DNA (File Format)
|
/** \defgroup DNA sDNA
|
||||||
* \ingroup blender data
|
* \ingroup blender data
|
||||||
*/
|
*/
|
||||||
/** \defgroup RNA RNA (Data API)
|
/** \defgroup RNA RNA
|
||||||
* \ingroup blender data
|
* \ingroup blender data
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** \defgroup blenloader Blend file IO
|
/** \defgroup blenloader .blend read and write functions
|
||||||
* \ingroup blender data
|
* \ingroup blender data
|
||||||
* \todo check if \ref blo and \ref blenloader groups can be
|
* \todo check if \ref blo and \ref blenloader groups can be
|
||||||
* merged in docs.
|
* merged in docs.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** \defgroup quicktime QuickTime
|
/** \defgroup quicktime quicktime
|
||||||
* \ingroup blender
|
* \ingroup blender
|
||||||
|
|
||||||
/** \defgroup gui GUI */
|
/** \defgroup gui GUI */
|
||||||
|
|
||||||
/** \defgroup wm Window Manager
|
/** \defgroup wm windowmanager
|
||||||
* \ingroup blender gui
|
* \ingroup blender gui
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -332,7 +324,7 @@
|
|||||||
* \ingroup externformats
|
* \ingroup externformats
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** \defgroup imbuf Image Buffer (ImBuf)
|
/** \defgroup imbuf IMage Buffer
|
||||||
* \ingroup blender
|
* \ingroup blender
|
||||||
*/
|
*/
|
||||||
|
|
@@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/python
|
||||||
|
|
||||||
# ##### BEGIN GPL LICENSE BLOCK #####
|
# ##### BEGIN GPL LICENSE BLOCK #####
|
||||||
#
|
#
|
||||||
|
@@ -20,15 +20,15 @@ constraint_type = 2
|
|||||||
physics_id_1 = object_1.getPhysicsId()
|
physics_id_1 = object_1.getPhysicsId()
|
||||||
physics_id_2 = object_2.getPhysicsId()
|
physics_id_2 = object_2.getPhysicsId()
|
||||||
|
|
||||||
# use bottom right edge of Object1 for hinge position
|
# Use bottom right edge of Object1 for hinge position
|
||||||
edge_position_x = 1.0
|
edge_position_x = 1.0
|
||||||
edge_position_y = 0.0
|
edge_position_y = 0.0
|
||||||
edge_position_z = -1.0
|
edge_position_z = -1.0
|
||||||
|
|
||||||
# rotate the pivot z axis about 90 degrees
|
# use Object1 y axis for angle to point hinge
|
||||||
edge_angle_x = 0.0
|
edge_angle_x = 0.0
|
||||||
edge_angle_y = 0.0
|
edge_angle_y = 1.0
|
||||||
edge_angle_z = 90.0
|
edge_angle_z = 0.0
|
||||||
|
|
||||||
# create an edge constraint
|
# create an edge constraint
|
||||||
constraints.createConstraint(physics_id_1, physics_id_2,
|
constraints.createConstraint(physics_id_1, physics_id_2,
|
||||||
|
@@ -1,19 +1,16 @@
|
|||||||
"""
|
"""
|
||||||
.. _operator-execution_context:
|
|
||||||
|
|
||||||
Execution Context
|
Execution Context
|
||||||
-----------------
|
-----------------
|
||||||
|
|
||||||
When calling an operator you may want to pass the execution context.
|
When calling an operator you may want to pass the execution context.
|
||||||
|
|
||||||
This determines the context that is given for the operator to run in, and whether
|
This determines the context thats given to the operator to run in, and weather
|
||||||
invoke() is called or only execute().
|
invoke() is called or execute().
|
||||||
|
|
||||||
'EXEC_DEFAULT' is used by default, running only the execute() method, but you may
|
'EXEC_DEFAULT' is used by default but you may want the operator to take user
|
||||||
want the operator to take user interaction with 'INVOKE_DEFAULT' which will also
|
interaction with 'INVOKE_DEFAULT'.
|
||||||
call invoke() if existing.
|
|
||||||
|
|
||||||
The execution context is one of:
|
The execution context is as a non keyword, string argument in:
|
||||||
('INVOKE_DEFAULT', 'INVOKE_REGION_WIN', 'INVOKE_REGION_CHANNELS',
|
('INVOKE_DEFAULT', 'INVOKE_REGION_WIN', 'INVOKE_REGION_CHANNELS',
|
||||||
'INVOKE_REGION_PREVIEW', 'INVOKE_AREA', 'INVOKE_SCREEN', 'EXEC_DEFAULT',
|
'INVOKE_REGION_PREVIEW', 'INVOKE_AREA', 'INVOKE_SCREEN', 'EXEC_DEFAULT',
|
||||||
'EXEC_REGION_WIN', 'EXEC_REGION_CHANNELS', 'EXEC_REGION_PREVIEW', 'EXEC_AREA',
|
'EXEC_REGION_WIN', 'EXEC_REGION_CHANNELS', 'EXEC_REGION_PREVIEW', 'EXEC_AREA',
|
||||||
|
@@ -3,7 +3,7 @@ PropertyGroup Example
|
|||||||
+++++++++++++++++++++
|
+++++++++++++++++++++
|
||||||
|
|
||||||
PropertyGroups can be used for collecting custom settings into one value
|
PropertyGroups can be used for collecting custom settings into one value
|
||||||
to avoid many individual settings mixed in together.
|
to avoid many indervidual settings mixed in together.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import bpy
|
import bpy
|
||||||
|
@@ -6,7 +6,7 @@ Custom properties can be added to any subclass of an :class:`ID`,
|
|||||||
:class:`Bone` and :class:`PoseBone`.
|
:class:`Bone` and :class:`PoseBone`.
|
||||||
|
|
||||||
These properties can be animated, accessed by the user interface and python
|
These properties can be animated, accessed by the user interface and python
|
||||||
like Blender's existing properties.
|
like blenders existing properties.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import bpy
|
import bpy
|
||||||
|
@@ -1,11 +1,12 @@
|
|||||||
"""
|
"""
|
||||||
Extending Menus
|
Extending Menus
|
||||||
+++++++++++++++
|
+++++++++++++++
|
||||||
When creating menus for addons you can't reference menus in Blender's default
|
When creating menus for addons you can't reference menus in blenders default
|
||||||
scripts.
|
scripts.
|
||||||
Instead, the addon can add menu items to existing menus.
|
|
||||||
|
|
||||||
The function menu_draw acts like :class:`Menu.draw`.
|
Instead the addon can add menu items to existing menus.
|
||||||
|
|
||||||
|
The function menu_draw acts like Menu.draw
|
||||||
"""
|
"""
|
||||||
import bpy
|
import bpy
|
||||||
|
|
||||||
|
@@ -1,20 +1,21 @@
|
|||||||
"""
|
"""
|
||||||
Basic Menu Example
|
Basic Menu Example
|
||||||
++++++++++++++++++
|
++++++++++++++++++
|
||||||
Here is an example of a simple menu. Menus differ from panels in that they must
|
This script is a simple menu, menus differ from panels in that they must
|
||||||
reference from a header, panel or another menu.
|
reference from a header, panel or another menu.
|
||||||
|
|
||||||
Notice the 'CATEGORY_MT_name' in :class:`Menu.bl_idname`, this is a naming
|
Notice the 'CATEGORY_MT_name' :class:`Menu.bl_idname`, this is a naming
|
||||||
convention for menus.
|
convention for menus.
|
||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
|
|
||||||
Menu subclasses must be registered before referencing them from blender.
|
Menu subclasses must be registered before referencing them from blender.
|
||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
Menus have their :class:`Layout.operator_context` initialized as
|
Menu's have their :class:`Layout.operator_context` initialized as
|
||||||
'EXEC_REGION_WIN' rather than 'INVOKE_DEFAULT' (see :ref:`Execution Context <operator-execution_context>`).
|
'EXEC_REGION_WIN' rather then 'INVOKE_DEFAULT', so if the operator context
|
||||||
If the operator context needs to initialize inputs from the
|
needs to initialize inputs from the :class:`Operator.invoke` function
|
||||||
:class:`Operator.invoke` function, then this needs to be explicitly set.
|
then this needs to be explicitly set.
|
||||||
"""
|
"""
|
||||||
import bpy
|
import bpy
|
||||||
|
|
||||||
|
@@ -7,7 +7,7 @@ A mix-in parent class can be used to share common properties and
|
|||||||
import bpy
|
import bpy
|
||||||
|
|
||||||
|
|
||||||
class View3DPanel:
|
class View3DPanel():
|
||||||
bl_space_type = 'VIEW_3D'
|
bl_space_type = 'VIEW_3D'
|
||||||
bl_region_type = 'TOOLS'
|
bl_region_type = 'TOOLS'
|
||||||
|
|
||||||
|
@@ -21,12 +21,3 @@ print(quat_out)
|
|||||||
print("%.2f, %.2f, %.2f" % tuple(math.degrees(a) for a in quat_out.to_euler()))
|
print("%.2f, %.2f, %.2f" % tuple(math.degrees(a) for a in quat_out.to_euler()))
|
||||||
print("(%.2f, %.2f, %.2f), %.2f" % (quat_out.axis[:] +
|
print("(%.2f, %.2f, %.2f), %.2f" % (quat_out.axis[:] +
|
||||||
(math.degrees(quat_out.angle), )))
|
(math.degrees(quat_out.angle), )))
|
||||||
|
|
||||||
# multiple rotations can be interpolated using the exponential map
|
|
||||||
quat_c = mathutils.Quaternion((1.0, 0.0, 0.0), math.radians(15.0))
|
|
||||||
exp_avg = (quat_a.to_exponential_map() +
|
|
||||||
quat_b.to_exponential_map() +
|
|
||||||
quat_c.to_exponential_map()) / 3.0
|
|
||||||
quat_avg = mathutils.Quaternion(exp_avg)
|
|
||||||
print("Average rotation:")
|
|
||||||
print(quat_avg)
|
|
||||||
|
@@ -18,16 +18,16 @@ matrix = mathutils.Matrix()
|
|||||||
|
|
||||||
# Comparison operators can be done on Vector classes:
|
# Comparison operators can be done on Vector classes:
|
||||||
|
|
||||||
# (In)equality operators == and != test component values, e.g. 1,2,3 != 3,2,1
|
# greater and less then test vector length.
|
||||||
vec_a == vec_b
|
|
||||||
vec_a != vec_b
|
|
||||||
|
|
||||||
# Ordering operators >, >=, > and <= test vector length.
|
|
||||||
vec_a > vec_b
|
vec_a > vec_b
|
||||||
vec_a >= vec_b
|
vec_a >= vec_b
|
||||||
vec_a < vec_b
|
vec_a < vec_b
|
||||||
vec_a <= vec_b
|
vec_a <= vec_b
|
||||||
|
|
||||||
|
# ==, != test vector values e.g. 1,2,3 != 3,2,1 even if they are the same length
|
||||||
|
vec_a == vec_b
|
||||||
|
vec_a != vec_b
|
||||||
|
|
||||||
|
|
||||||
# Math can be performed on Vector classes
|
# Math can be performed on Vector classes
|
||||||
vec_a + vec_b
|
vec_a + vec_b
|
||||||
|
@@ -1,47 +0,0 @@
|
|||||||
|
|
||||||
Application Data (bge.app)
|
|
||||||
==========================
|
|
||||||
|
|
||||||
Module to access application values that remain unchanged during runtime.
|
|
||||||
|
|
||||||
.. module:: bge.app
|
|
||||||
|
|
||||||
.. data:: version
|
|
||||||
|
|
||||||
The Blender/BGE version as a tuple of 3 ints, eg. (2, 75, 1).
|
|
||||||
|
|
||||||
.. note:: Version tuples can be compared simply with (in)equality symbols;
|
|
||||||
for example, ``(2, 74, 5) <= (2, 75, 0)`` returns True (lexical order).
|
|
||||||
|
|
||||||
:type: tuple of three ints
|
|
||||||
|
|
||||||
.. data:: version_string
|
|
||||||
|
|
||||||
The Blender/BGE version formatted as a string, eg. "2.75 (sub 1)".
|
|
||||||
|
|
||||||
:type: str
|
|
||||||
|
|
||||||
.. data:: version_char
|
|
||||||
|
|
||||||
The Blender/BGE version character (for minor releases).
|
|
||||||
|
|
||||||
:type: str
|
|
||||||
|
|
||||||
.. data:: has_texture_ffmpeg
|
|
||||||
|
|
||||||
True if the BGE has been built with FFmpeg support, enabling use of :class:`~bge.texture.ImageFFmpeg` and :class:`~bge.texture.VideoFFmpeg`.
|
|
||||||
|
|
||||||
:type: bool
|
|
||||||
|
|
||||||
.. data:: has_joystick
|
|
||||||
|
|
||||||
True if the BGE has been built with joystick support.
|
|
||||||
|
|
||||||
:type: bool
|
|
||||||
|
|
||||||
.. data:: has_physics
|
|
||||||
|
|
||||||
True if the BGE has been built with physics support.
|
|
||||||
|
|
||||||
:type: bool
|
|
||||||
|
|
@@ -4,84 +4,72 @@ Physics Constraints (bge.constraints)
|
|||||||
|
|
||||||
.. module:: bge.constraints
|
.. module:: bge.constraints
|
||||||
|
|
||||||
|
.. literalinclude:: ../examples/bge.constraints.py
|
||||||
Examples
|
:language: rest
|
||||||
--------
|
:lines: 2-4
|
||||||
|
|
||||||
.. include:: ../examples/bge.constraints.py
|
|
||||||
:start-line: 1
|
|
||||||
:end-line: 4
|
|
||||||
|
|
||||||
.. literalinclude:: ../examples/bge.constraints.py
|
.. literalinclude:: ../examples/bge.constraints.py
|
||||||
:lines: 6-
|
:lines: 6-
|
||||||
|
|
||||||
|
.. function:: createConstraint(physicsid, physicsid2, constrainttype, [pivotX, pivotY, pivotZ, [axisX, axisY, axisZ, [flag]]]])
|
||||||
Functions
|
|
||||||
---------
|
|
||||||
|
|
||||||
.. function:: createConstraint( \
|
|
||||||
physicsid_1, physicsid_2, constraint_type, \
|
|
||||||
pivot_x=0.0, pivot_y=0.0, pivot_z=0.0, \
|
|
||||||
axis_x=0.0, axis_y=0.0, axis_z=0.0, flag=0)
|
|
||||||
|
|
||||||
Creates a constraint.
|
Creates a constraint.
|
||||||
|
|
||||||
:arg physicsid_1: The physics id of the first object in constraint.
|
:arg physicsid: the physics id of the first object in constraint
|
||||||
:type physicsid_1: int
|
:type physicsid: int
|
||||||
|
|
||||||
:arg physicsid_2: The physics id of the second object in constraint.
|
:arg physicsid2: the physics id of the second object in constraint
|
||||||
:type physicsid_2: int
|
:type physicsid2: int
|
||||||
|
|
||||||
:arg constraint_type: The type of the constraint, one of...
|
:arg constrainttype: the type of the constraint. The constraint types are:
|
||||||
|
|
||||||
- :class:`POINTTOPOINT_CONSTRAINT`
|
- :class:`POINTTOPOINT_CONSTRAINT`
|
||||||
- :class:`LINEHINGE_CONSTRAINT`
|
- :class:`LINEHINGE_CONSTRAINT`
|
||||||
- :class:`ANGULAR_CONSTRAINT`
|
- :class:`ANGULAR_CONSTRAINT`
|
||||||
- :class:`CONETWIST_CONSTRAINT`
|
- :class:`CONETWIST_CONSTRAINT`
|
||||||
- :class:`VEHICLE_CONSTRAINT`
|
- :class:`VEHICLE_CONSTRAINT`
|
||||||
- :class:`GENERIC_6DOF_CONSTRAINT`
|
- :class:`GENERIC_6DOF_CONSTRAINT`
|
||||||
|
|
||||||
:type constraint_type: int
|
:type constrainttype: int
|
||||||
|
|
||||||
:arg pivot_x: Pivot X position. (optional)
|
:arg pivotX: pivot X position
|
||||||
:type pivot_x: float
|
:type pivotX: float
|
||||||
|
|
||||||
:arg pivot_y: Pivot Y position. (optional)
|
:arg pivotY: pivot Y position
|
||||||
:type pivot_y: float
|
:type pivotY: float
|
||||||
|
|
||||||
:arg pivot_z: Pivot Z position. (optional)
|
:arg pivotZ: pivot Z position
|
||||||
:type pivot_z: float
|
:type pivotZ: float
|
||||||
|
|
||||||
:arg axis_x: X axis angle in degrees. (optional)
|
:arg axisX: X axis
|
||||||
:type axis_x: float
|
:type axisX: float
|
||||||
|
|
||||||
:arg axis_y: Y axis angle in degrees. (optional)
|
:arg axisY: Y axis
|
||||||
:type axis_y: float
|
:type axisY: float
|
||||||
|
|
||||||
:arg axis_z: Z axis angle in degrees. (optional)
|
:arg axisZ: Z axis
|
||||||
:type axis_z: float
|
:type axisZ: float
|
||||||
|
|
||||||
:arg flag: 128 to disable collision between linked bodies. (optional)
|
:arg flag: 128 to disable collision between linked bodies
|
||||||
:type flag: int
|
:type flag: int
|
||||||
|
|
||||||
:return: A constraint wrapper.
|
.. attribute:: error
|
||||||
:rtype: :class:`~bge.types.KX_ConstraintWrapper`
|
|
||||||
|
Simbolic constant string that indicates error.
|
||||||
|
|
||||||
.. function:: exportBulletFile(filename)
|
.. function:: exportBulletFile(filename)
|
||||||
|
|
||||||
Exports a file representing the dynamics world (usually using ``.bullet`` extension).
|
export a .bullet file
|
||||||
|
|
||||||
See `Bullet binary serialization <http://bulletphysics.org/mediawiki-1.5.8/index.php/Bullet_binary_serialization>`__.
|
:arg filename: File name
|
||||||
|
:type filename: string
|
||||||
:arg filename: File path.
|
|
||||||
:type filename: str
|
|
||||||
|
|
||||||
.. function:: getAppliedImpulse(constraintId)
|
.. function:: getAppliedImpulse(constraintId)
|
||||||
|
|
||||||
:arg constraintId: The id of the constraint.
|
:arg constraintId: The id of the constraint.
|
||||||
:type constraintId: int
|
:type constraintId: int
|
||||||
|
|
||||||
:return: The most recent applied impulse.
|
:return: the most recent applied impulse.
|
||||||
:rtype: float
|
:rtype: float
|
||||||
|
|
||||||
.. function:: getVehicleConstraint(constraintId)
|
.. function:: getVehicleConstraint(constraintId)
|
||||||
@@ -89,16 +77,16 @@ Functions
|
|||||||
:arg constraintId: The id of the vehicle constraint.
|
:arg constraintId: The id of the vehicle constraint.
|
||||||
:type constraintId: int
|
:type constraintId: int
|
||||||
|
|
||||||
:return: A vehicle constraint object.
|
:return: a vehicle constraint object.
|
||||||
:rtype: :class:`~bge.types.KX_VehicleWrapper`
|
:rtype: :class:`bge.types.KX_VehicleWrapper`
|
||||||
|
|
||||||
.. function:: getCharacter(gameobj)
|
.. function:: getCharacter(gameobj)
|
||||||
|
|
||||||
:arg gameobj: The game object with the character physics.
|
:arg gameobj: The game object with the character physics.
|
||||||
:type gameobj: :class:`~bge.types.KX_GameObject`
|
:type gameobj: :class:`bge.types.KX_GameObject`
|
||||||
|
|
||||||
:return: Character wrapper.
|
:return: character wrapper
|
||||||
:rtype: :class:`~bge.types.KX_CharacterWrapper`
|
:rtype: :class:`bge.types.KX_CharacterWrapper`
|
||||||
|
|
||||||
.. function:: removeConstraint(constraintId)
|
.. function:: removeConstraint(constraintId)
|
||||||
|
|
||||||
@@ -152,8 +140,7 @@ Functions
|
|||||||
|
|
||||||
Sets the debug mode.
|
Sets the debug mode.
|
||||||
|
|
||||||
:arg mode: The new debug mode.
|
Debug modes:
|
||||||
|
|
||||||
- :class:`DBG_NODEBUG`
|
- :class:`DBG_NODEBUG`
|
||||||
- :class:`DBG_DRAWWIREFRAME`
|
- :class:`DBG_DRAWWIREFRAME`
|
||||||
- :class:`DBG_DRAWAABB`
|
- :class:`DBG_DRAWAABB`
|
||||||
@@ -169,6 +156,7 @@ Functions
|
|||||||
- :class:`DBG_DRAWCONSTRAINTLIMITS`
|
- :class:`DBG_DRAWCONSTRAINTLIMITS`
|
||||||
- :class:`DBG_FASTWIREFRAME`
|
- :class:`DBG_FASTWIREFRAME`
|
||||||
|
|
||||||
|
:arg mode: The new debug mode.
|
||||||
:type mode: int
|
:type mode: int
|
||||||
|
|
||||||
.. function:: setGravity(x, y, z)
|
.. function:: setGravity(x, y, z)
|
||||||
@@ -187,8 +175,7 @@ Functions
|
|||||||
.. function:: setLinearAirDamping(damping)
|
.. function:: setLinearAirDamping(damping)
|
||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
|
Not implemented.
|
||||||
Not implemented
|
|
||||||
|
|
||||||
Sets the linear air damping for rigidbodies.
|
Sets the linear air damping for rigidbodies.
|
||||||
|
|
||||||
@@ -248,111 +235,144 @@ Functions
|
|||||||
|
|
||||||
.. function:: setUseEpa(epa)
|
.. function:: setUseEpa(epa)
|
||||||
|
|
||||||
.. note::
|
Not implemented.
|
||||||
|
|
||||||
Not implemented
|
|
||||||
|
|
||||||
|
|
||||||
Constants
|
|
||||||
+++++++++
|
|
||||||
|
|
||||||
.. attribute:: error
|
|
||||||
|
|
||||||
Symbolic constant string that indicates error.
|
|
||||||
|
|
||||||
:type: str
|
|
||||||
|
|
||||||
|
|
||||||
Debug Mode Constants
|
|
||||||
^^^^^^^^^^^^^^^^^^^^
|
|
||||||
|
|
||||||
Debug mode to be used with :func:`setDebugMode`.
|
|
||||||
|
|
||||||
|
|
||||||
.. data:: DBG_NODEBUG
|
.. data:: DBG_NODEBUG
|
||||||
|
|
||||||
|
.. note::
|
||||||
|
Debug mode to be used with function :class:`setDebugMode`
|
||||||
|
|
||||||
No debug.
|
No debug.
|
||||||
|
|
||||||
.. data:: DBG_DRAWWIREFRAME
|
.. data:: DBG_DRAWWIREFRAME
|
||||||
|
|
||||||
|
.. note::
|
||||||
|
Debug mode to be used with function :class:`setDebugMode`
|
||||||
|
|
||||||
Draw wireframe in debug.
|
Draw wireframe in debug.
|
||||||
|
|
||||||
.. data:: DBG_DRAWAABB
|
.. data:: DBG_DRAWAABB
|
||||||
|
|
||||||
|
.. note::
|
||||||
|
Debug mode to be used with function :class:`setDebugMode`
|
||||||
|
|
||||||
Draw Axis Aligned Bounding Box in debug.
|
Draw Axis Aligned Bounding Box in debug.
|
||||||
|
|
||||||
.. data:: DBG_DRAWFREATURESTEXT
|
.. data:: DBG_DRAWFREATURESTEXT
|
||||||
|
|
||||||
Draw features text in debug.
|
.. note::
|
||||||
|
Debug mode to be used with function :class:`setDebugMode`
|
||||||
|
|
||||||
|
Draw freatures text in debug.
|
||||||
|
|
||||||
.. data:: DBG_DRAWCONTACTPOINTS
|
.. data:: DBG_DRAWCONTACTPOINTS
|
||||||
|
|
||||||
|
.. note::
|
||||||
|
Debug mode to be used with function :class:`setDebugMode`
|
||||||
|
|
||||||
Draw contact points in debug.
|
Draw contact points in debug.
|
||||||
|
|
||||||
.. data:: DBG_NOHELPTEXT
|
.. data:: DBG_NOHELPTEXT
|
||||||
|
|
||||||
|
.. note::
|
||||||
|
Debug mode to be used with function :class:`setDebugMode`
|
||||||
|
|
||||||
Debug without help text.
|
Debug without help text.
|
||||||
|
|
||||||
.. data:: DBG_DRAWTEXT
|
.. data:: DBG_DRAWTEXT
|
||||||
|
|
||||||
|
.. note::
|
||||||
|
Debug mode to be used with function :class:`setDebugMode`
|
||||||
|
|
||||||
Draw text in debug.
|
Draw text in debug.
|
||||||
|
|
||||||
.. data:: DBG_PROFILETIMINGS
|
.. data:: DBG_PROFILETIMINGS
|
||||||
|
|
||||||
|
.. note::
|
||||||
|
Debug mode to be used with function :class:`setDebugMode`
|
||||||
|
|
||||||
Draw profile timings in debug.
|
Draw profile timings in debug.
|
||||||
|
|
||||||
.. data:: DBG_ENABLESATCOMPARISION
|
.. data:: DBG_ENABLESATCOMPARISION
|
||||||
|
|
||||||
|
.. note::
|
||||||
|
Debug mode to be used with function :class:`setDebugMode`
|
||||||
|
|
||||||
Enable sat comparision in debug.
|
Enable sat comparision in debug.
|
||||||
|
|
||||||
.. data:: DBG_DISABLEBULLETLCP
|
.. data:: DBG_DISABLEBULLETLCP
|
||||||
|
|
||||||
|
.. note::
|
||||||
|
Debug mode to be used with function :class:`setDebugMode`
|
||||||
|
|
||||||
Disable Bullet LCP.
|
Disable Bullet LCP.
|
||||||
|
|
||||||
.. data:: DBG_ENABLECCD
|
.. data:: DBG_ENABLECCD
|
||||||
|
|
||||||
Enable Continous Collision Detection in debug.
|
.. note::
|
||||||
|
Debug mode to be used with function :class:`setDebugMode`
|
||||||
|
|
||||||
|
Enable Continous Colision Detection in debug.
|
||||||
|
|
||||||
.. data:: DBG_DRAWCONSTRAINTS
|
.. data:: DBG_DRAWCONSTRAINTS
|
||||||
|
|
||||||
|
.. note::
|
||||||
|
Debug mode to be used with function :class:`setDebugMode`
|
||||||
|
|
||||||
Draw constraints in debug.
|
Draw constraints in debug.
|
||||||
|
|
||||||
.. data:: DBG_DRAWCONSTRAINTLIMITS
|
.. data:: DBG_DRAWCONSTRAINTLIMITS
|
||||||
|
|
||||||
|
.. note::
|
||||||
|
Debug mode to be used with function :class:`setDebugMode`
|
||||||
|
|
||||||
Draw constraint limits in debug.
|
Draw constraint limits in debug.
|
||||||
|
|
||||||
.. data:: DBG_FASTWIREFRAME
|
.. data:: DBG_FASTWIREFRAME
|
||||||
|
|
||||||
|
.. note::
|
||||||
|
Debug mode to be used with function :class:`setDebugMode`
|
||||||
|
|
||||||
Draw a fast wireframe in debug.
|
Draw a fast wireframe in debug.
|
||||||
|
|
||||||
|
|
||||||
Create Constraint Constants
|
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
||||||
|
|
||||||
Constraint type to be used with :func:`createConstraint`.
|
|
||||||
|
|
||||||
|
|
||||||
.. data:: POINTTOPOINT_CONSTRAINT
|
.. data:: POINTTOPOINT_CONSTRAINT
|
||||||
|
|
||||||
|
.. note::
|
||||||
|
Constraint type to be used with function :class:`createConstraint`
|
||||||
|
|
||||||
.. to do
|
.. to do
|
||||||
|
|
||||||
.. data:: LINEHINGE_CONSTRAINT
|
.. data:: LINEHINGE_CONSTRAINT
|
||||||
|
|
||||||
|
.. note::
|
||||||
|
Constraint type to be used with function :class:`createConstraint`
|
||||||
|
|
||||||
.. to do
|
.. to do
|
||||||
|
|
||||||
.. data:: ANGULAR_CONSTRAINT
|
.. data:: ANGULAR_CONSTRAINT
|
||||||
|
|
||||||
|
.. note::
|
||||||
|
Constraint type to be used with function :class:`createConstraint`
|
||||||
|
|
||||||
.. to do
|
.. to do
|
||||||
|
|
||||||
.. data:: CONETWIST_CONSTRAINT
|
.. data:: CONETWIST_CONSTRAINT
|
||||||
|
|
||||||
|
.. note::
|
||||||
|
Constraint type to be used with function :class:`createConstraint`
|
||||||
|
|
||||||
.. to do
|
.. to do
|
||||||
|
|
||||||
.. data:: VEHICLE_CONSTRAINT
|
.. data:: VEHICLE_CONSTRAINT
|
||||||
|
|
||||||
|
.. note::
|
||||||
|
Constraint type to be used with function :class:`createConstraint`
|
||||||
|
|
||||||
.. to do
|
.. to do
|
||||||
|
|
||||||
.. data:: GENERIC_6DOF_CONSTRAINT
|
.. data:: GENERIC_6DOF_CONSTRAINT
|
||||||
|
|
||||||
.. to do
|
.. note::
|
||||||
|
Constraint type to be used with function :class:`createConstraint`
|
||||||
|
|
||||||
|
.. to do
|
||||||
|
@@ -894,8 +894,6 @@ Various
|
|||||||
2D Filter
|
2D Filter
|
||||||
---------
|
---------
|
||||||
|
|
||||||
.. _Two-D-FilterActuator-mode:
|
|
||||||
|
|
||||||
.. data:: RAS_2DFILTER_BLUR
|
.. data:: RAS_2DFILTER_BLUR
|
||||||
|
|
||||||
:value: 2
|
:value: 2
|
||||||
@@ -1290,3 +1288,5 @@ See :class:`bge.types.KX_StateActuator.operation`
|
|||||||
Add bits to state mask
|
Add bits to state mask
|
||||||
|
|
||||||
:value: 3
|
:value: 3
|
||||||
|
|
||||||
|
.. _Two-D-FilterActuator-mode:
|
||||||
|
@@ -8,13 +8,9 @@ Intro
|
|||||||
|
|
||||||
.. module:: bge.render
|
.. module:: bge.render
|
||||||
|
|
||||||
Example of using a :class:`bge.types.SCA_MouseSensor`, and two :class:`bge.types.KX_ObjectActuator` to implement MouseLook:
|
|
||||||
|
|
||||||
.. note::
|
|
||||||
This can also be achieved with the :class:`bge.types.KX_MouseActuator`.
|
|
||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
|
# Example Uses an L{SCA_MouseSensor}, and two L{KX_ObjectActuator}s to implement MouseLook::
|
||||||
# To use a mouse movement sensor "Mouse" and a
|
# To use a mouse movement sensor "Mouse" and a
|
||||||
# motion actuator to mouse look:
|
# motion actuator to mouse look:
|
||||||
import bge
|
import bge
|
||||||
@@ -66,7 +62,7 @@ Constants
|
|||||||
.. data:: KX_BLENDER_GLSL_MATERIAL
|
.. data:: KX_BLENDER_GLSL_MATERIAL
|
||||||
|
|
||||||
Materials approximating blender materials with GLSL.
|
Materials approximating blender materials with GLSL.
|
||||||
|
|
||||||
.. DATA:: VSYNC_OFF
|
.. DATA:: VSYNC_OFF
|
||||||
|
|
||||||
Disables vsync
|
Disables vsync
|
||||||
@@ -79,15 +75,6 @@ Constants
|
|||||||
|
|
||||||
Enables adaptive vsync if supported. Adaptive vsync enables vsync if the framerate is above the monitors refresh rate. Otherwise, vsync is diabled if the framerate is too low.
|
Enables adaptive vsync if supported. Adaptive vsync enables vsync if the framerate is above the monitors refresh rate. Otherwise, vsync is diabled if the framerate is too low.
|
||||||
|
|
||||||
.. data:: LEFT_EYE
|
|
||||||
|
|
||||||
Left eye being used during stereoscopic rendering.
|
|
||||||
|
|
||||||
.. data:: RIGHT_EYE
|
|
||||||
|
|
||||||
Right eye being used during stereoscopic rendering.
|
|
||||||
|
|
||||||
|
|
||||||
*********
|
*********
|
||||||
Functions
|
Functions
|
||||||
*********
|
*********
|
||||||
@@ -95,55 +82,47 @@ Functions
|
|||||||
.. function:: getWindowWidth()
|
.. function:: getWindowWidth()
|
||||||
|
|
||||||
Gets the width of the window (in pixels)
|
Gets the width of the window (in pixels)
|
||||||
|
|
||||||
:rtype: integer
|
:rtype: integer
|
||||||
|
|
||||||
.. function:: getWindowHeight()
|
.. function:: getWindowHeight()
|
||||||
|
|
||||||
Gets the height of the window (in pixels)
|
Gets the height of the window (in pixels)
|
||||||
|
|
||||||
:rtype: integer
|
:rtype: integer
|
||||||
|
|
||||||
.. function:: setWindowSize(width, height)
|
.. function:: setWindowSize(width, height)
|
||||||
|
|
||||||
Set the width and height of the window (in pixels). This also works for fullscreen applications.
|
Set the width and height of the window (in pixels). This also works for fullscreen applications.
|
||||||
|
|
||||||
:type width: integer
|
:type width: integer
|
||||||
:type height: integer
|
:type height: integer
|
||||||
|
|
||||||
.. function:: setFullScreen(enable)
|
.. function:: setFullScreen(enable)
|
||||||
|
|
||||||
Set whether or not the window should be fullscreen.
|
Set whether or not the window should be fullscreen.
|
||||||
|
|
||||||
:type enable: bool
|
:type enable: bool
|
||||||
|
|
||||||
.. function:: getFullScreen()
|
.. function:: getFullScreen()
|
||||||
|
|
||||||
Returns whether or not the window is fullscreen.
|
Returns whether or not the window is fullscreen.
|
||||||
|
|
||||||
:rtype: bool
|
|
||||||
|
|
||||||
.. function:: getDisplayDimensions()
|
|
||||||
|
|
||||||
Get the actual display dimensions, in pixels, of the physical display (e.g., the monitor).
|
|
||||||
|
|
||||||
:type dimension: list [width,heigh]
|
:rtype: bool
|
||||||
|
|
||||||
.. function:: makeScreenshot(filename)
|
.. function:: makeScreenshot(filename)
|
||||||
|
|
||||||
Writes an image file with the current displayed frame.
|
Writes a screenshot to the given filename.
|
||||||
|
|
||||||
The image is written to *'filename'*. The path may be absolute (eg. "/home/foo/image") or relative when started with
|
If filename starts with // the image will be saved relative to the current directory.
|
||||||
"//" (eg. "//image"). Note that absolute paths are not portable between platforms.
|
If the filename contains # it will be replaced with the frame number.
|
||||||
If the filename contains a "#", it will be replaced by an incremental index so that screenshots can be taken multiple
|
|
||||||
times without overwriting the previous ones (eg. "image-#").
|
The standalone player saves .png files. It does not support color space conversion
|
||||||
|
or gamma correction.
|
||||||
Settings for the image are taken from the render settings (file format and respective settings, gamma and colospace
|
|
||||||
conversion, etc). The image resolution matches the framebuffer, meaning, the window size and aspect ratio.
|
When run from Blender, makeScreenshot supports all Blender image file formats like PNG, TGA, Jpeg and OpenEXR.
|
||||||
When running from the standalone player, instead of the embedded player, only PNG files are supported. Additional
|
Gamma, Colorspace conversion and Jpeg compression are taken from the Render settings panels.
|
||||||
color conversions are also not supported.
|
|
||||||
|
|
||||||
:arg filename: path and name of the file to write
|
|
||||||
:type filename: string
|
:type filename: string
|
||||||
|
|
||||||
|
|
||||||
@@ -155,29 +134,65 @@ Functions
|
|||||||
.. function:: showMouse(visible)
|
.. function:: showMouse(visible)
|
||||||
|
|
||||||
Enables or disables the operating system mouse cursor.
|
Enables or disables the operating system mouse cursor.
|
||||||
|
|
||||||
:type visible: boolean
|
:type visible: boolean
|
||||||
|
|
||||||
|
|
||||||
.. function:: setMousePosition(x, y)
|
.. function:: setMousePosition(x, y)
|
||||||
|
|
||||||
Sets the mouse cursor position.
|
Sets the mouse cursor position.
|
||||||
|
|
||||||
:type x: integer
|
:type x: integer
|
||||||
:type y: integer
|
:type y: integer
|
||||||
|
|
||||||
|
|
||||||
.. function:: setBackgroundColor(rgba)
|
.. function:: setBackgroundColor(rgba)
|
||||||
|
|
||||||
Sets the window background color. (Deprecated: use KX_WorldInfo.background_color)
|
Sets the window background color.
|
||||||
|
|
||||||
:type rgba: list [r, g, b, a]
|
:type rgba: list [r, g, b, a]
|
||||||
|
|
||||||
|
|
||||||
|
.. function:: setMistColor(rgb)
|
||||||
|
|
||||||
|
Sets the mist color.
|
||||||
|
|
||||||
|
:type rgb: list [r, g, b]
|
||||||
|
|
||||||
|
|
||||||
|
.. function:: setAmbientColor(rgb)
|
||||||
|
|
||||||
|
Sets the color of ambient light.
|
||||||
|
|
||||||
|
:type rgb: list [r, g, b]
|
||||||
|
|
||||||
|
|
||||||
|
.. function:: setMistStart(start)
|
||||||
|
|
||||||
|
Sets the mist start value. Objects further away than start will have mist applied to them.
|
||||||
|
|
||||||
|
:type start: float
|
||||||
|
|
||||||
|
|
||||||
|
.. function:: setMistEnd(end)
|
||||||
|
|
||||||
|
Sets the mist end value. Objects further away from this will be colored solid with
|
||||||
|
the color set by setMistColor().
|
||||||
|
|
||||||
|
:type end: float
|
||||||
|
|
||||||
|
|
||||||
|
.. function:: disableMist()
|
||||||
|
|
||||||
|
Disables mist.
|
||||||
|
|
||||||
|
.. note:: Set any of the mist properties to enable mist.
|
||||||
|
|
||||||
|
|
||||||
.. function:: setEyeSeparation(eyesep)
|
.. function:: setEyeSeparation(eyesep)
|
||||||
|
|
||||||
Sets the eye separation for stereo mode. Usually Focal Length/30 provides a confortable value.
|
Sets the eye separation for stereo mode. Usually Focal Length/30 provides a confortable value.
|
||||||
|
|
||||||
:arg eyesep: The distance between the left and right eye.
|
:arg eyesep: The distance between the left and right eye.
|
||||||
:type eyesep: float
|
:type eyesep: float
|
||||||
|
|
||||||
@@ -185,36 +200,27 @@ Functions
|
|||||||
.. function:: getEyeSeparation()
|
.. function:: getEyeSeparation()
|
||||||
|
|
||||||
Gets the current eye separation for stereo mode.
|
Gets the current eye separation for stereo mode.
|
||||||
|
|
||||||
:rtype: float
|
:rtype: float
|
||||||
|
|
||||||
|
|
||||||
.. function:: setFocalLength(focallength)
|
.. function:: setFocalLength(focallength)
|
||||||
|
|
||||||
Sets the focal length for stereo mode. It uses the current camera focal length as initial value.
|
Sets the focal length for stereo mode. It uses the current camera focal length as initial value.
|
||||||
|
|
||||||
:arg focallength: The focal length.
|
:arg focallength: The focal length.
|
||||||
:type focallength: float
|
:type focallength: float
|
||||||
|
|
||||||
.. function:: getFocalLength()
|
.. function:: getFocalLength()
|
||||||
|
|
||||||
Gets the current focal length for stereo mode.
|
Gets the current focal length for stereo mode.
|
||||||
|
|
||||||
:rtype: float
|
:rtype: float
|
||||||
|
|
||||||
.. function:: getStereoEye()
|
|
||||||
|
|
||||||
Gets the current stereoscopy eye being rendered.
|
|
||||||
This function is mainly used in a :class:`bge.types.KX_Scene.pre_draw` callback
|
|
||||||
function to customize the camera projection matrices for each
|
|
||||||
stereoscopic eye.
|
|
||||||
|
|
||||||
:rtype: LEFT_EYE, RIGHT_EYE
|
|
||||||
|
|
||||||
.. function:: setMaterialMode(mode)
|
.. function:: setMaterialMode(mode)
|
||||||
|
|
||||||
Set the material mode to use for OpenGL rendering.
|
Set the material mode to use for OpenGL rendering.
|
||||||
|
|
||||||
:type mode: KX_TEXFACE_MATERIAL, KX_BLENDER_MULTITEX_MATERIAL, KX_BLENDER_GLSL_MATERIAL
|
:type mode: KX_TEXFACE_MATERIAL, KX_BLENDER_MULTITEX_MATERIAL, KX_BLENDER_GLSL_MATERIAL
|
||||||
|
|
||||||
.. note:: Changes will only affect newly created scenes.
|
.. note:: Changes will only affect newly created scenes.
|
||||||
@@ -223,14 +229,14 @@ Functions
|
|||||||
.. function:: getMaterialMode(mode)
|
.. function:: getMaterialMode(mode)
|
||||||
|
|
||||||
Get the material mode to use for OpenGL rendering.
|
Get the material mode to use for OpenGL rendering.
|
||||||
|
|
||||||
:rtype: KX_TEXFACE_MATERIAL, KX_BLENDER_MULTITEX_MATERIAL, KX_BLENDER_GLSL_MATERIAL
|
:rtype: KX_TEXFACE_MATERIAL, KX_BLENDER_MULTITEX_MATERIAL, KX_BLENDER_GLSL_MATERIAL
|
||||||
|
|
||||||
|
|
||||||
.. function:: setGLSLMaterialSetting(setting, enable)
|
.. function:: setGLSLMaterialSetting(setting, enable)
|
||||||
|
|
||||||
Enables or disables a GLSL material setting.
|
Enables or disables a GLSL material setting.
|
||||||
|
|
||||||
:type setting: string (lights, shaders, shadows, ramps, nodes, extra_textures)
|
:type setting: string (lights, shaders, shadows, ramps, nodes, extra_textures)
|
||||||
:type enable: boolean
|
:type enable: boolean
|
||||||
|
|
||||||
@@ -238,43 +244,43 @@ Functions
|
|||||||
.. function:: getGLSLMaterialSetting(setting, enable)
|
.. function:: getGLSLMaterialSetting(setting, enable)
|
||||||
|
|
||||||
Get the state of a GLSL material setting.
|
Get the state of a GLSL material setting.
|
||||||
|
|
||||||
:type setting: string (lights, shaders, shadows, ramps, nodes, extra_textures)
|
:type setting: string (lights, shaders, shadows, ramps, nodes, extra_textures)
|
||||||
:rtype: boolean
|
:rtype: boolean
|
||||||
|
|
||||||
.. function:: setAnisotropicFiltering(level)
|
.. function:: setAnisotropicFiltering(level)
|
||||||
|
|
||||||
Set the anisotropic filtering level for textures.
|
Set the anisotropic filtering level for textures.
|
||||||
|
|
||||||
:arg level: The new anisotropic filtering level to use
|
:arg level: The new anisotropic filtering level to use
|
||||||
:type level: integer (must be one of 1, 2, 4, 8, 16)
|
:type level: integer (must be one of 1, 2, 4, 8, 16)
|
||||||
|
|
||||||
.. note:: Changing this value can cause all textures to be recreated, which can be slow.
|
.. note:: Changing this value can cause all textures to be recreated, which can be slow.
|
||||||
|
|
||||||
.. function:: getAnisotropicFiltering()
|
.. function:: getAnisotropicFiltering()
|
||||||
|
|
||||||
Get the anisotropic filtering level used for textures.
|
Get the anisotropic filtering level used for textures.
|
||||||
|
|
||||||
:rtype: integer (one of 1, 2, 4, 8, 16)
|
:rtype: integer (one of 1, 2, 4, 8, 16)
|
||||||
|
|
||||||
.. function:: setMipmapping(value)
|
.. function:: setMipmapping(value)
|
||||||
|
|
||||||
Change how to use mipmapping.
|
Change how to use mipmapping.
|
||||||
|
|
||||||
:type value: RAS_MIPMAP_NONE, RAS_MIPMAP_NEAREST, RAS_MIPMAP_LINEAR
|
:type value: RAS_MIPMAP_NONE, RAS_MIPMAP_NEAREST, RAS_MIPMAP_LINEAR
|
||||||
|
|
||||||
.. note:: Changing this value can cause all textures to be recreated, which can be slow.
|
.. note:: Changing this value can cause all textures to be recreated, which can be slow.
|
||||||
|
|
||||||
.. function:: getMipmapping()
|
.. function:: getMipmapping()
|
||||||
|
|
||||||
Get the current mipmapping setting.
|
Get the current mipmapping setting.
|
||||||
|
|
||||||
:rtype: RAS_MIPMAP_NONE, RAS_MIPMAP_NEAREST, RAS_MIPMAP_LINEAR
|
:rtype: RAS_MIPMAP_NONE, RAS_MIPMAP_NEAREST, RAS_MIPMAP_LINEAR
|
||||||
|
|
||||||
.. function:: drawLine(fromVec,toVec,color)
|
.. function:: drawLine(fromVec,toVec,color)
|
||||||
|
|
||||||
Draw a line in the 3D scene.
|
Draw a line in the 3D scene.
|
||||||
|
|
||||||
:arg fromVec: the origin of the line
|
:arg fromVec: the origin of the line
|
||||||
:type fromVec: list [x, y, z]
|
:type fromVec: list [x, y, z]
|
||||||
:arg toVec: the end of the line
|
:arg toVec: the end of the line
|
||||||
@@ -286,7 +292,7 @@ Functions
|
|||||||
.. function:: enableMotionBlur(factor)
|
.. function:: enableMotionBlur(factor)
|
||||||
|
|
||||||
Enable the motion blur effect.
|
Enable the motion blur effect.
|
||||||
|
|
||||||
:arg factor: the ammount of motion blur to display.
|
:arg factor: the ammount of motion blur to display.
|
||||||
:type factor: float [0.0 - 1.0]
|
:type factor: float [0.0 - 1.0]
|
||||||
|
|
||||||
|
@@ -218,8 +218,6 @@ When the texture object is deleted, the new texture is deleted and the old textu
|
|||||||
|
|
||||||
background color
|
background color
|
||||||
|
|
||||||
:type: int or float list [r, g, b, a] in [0.0, 255.0]
|
|
||||||
|
|
||||||
.. attribute:: capsize
|
.. attribute:: capsize
|
||||||
|
|
||||||
size of render area
|
size of render area
|
||||||
@@ -317,8 +315,6 @@ When the texture object is deleted, the new texture is deleted and the old textu
|
|||||||
|
|
||||||
background color
|
background color
|
||||||
|
|
||||||
:type: int or float list [r, g, b, a] in [0.0, 255.0]
|
|
||||||
|
|
||||||
.. attribute:: capsize
|
.. attribute:: capsize
|
||||||
|
|
||||||
size of render area
|
size of render area
|
||||||
|
@@ -7,66 +7,11 @@ base class --- :class:`PyObjectPlus`
|
|||||||
|
|
||||||
.. class:: KX_BlenderMaterial(PyObjectPlus)
|
.. class:: KX_BlenderMaterial(PyObjectPlus)
|
||||||
|
|
||||||
This is the interface to materials in the game engine.
|
KX_BlenderMaterial
|
||||||
|
|
||||||
Materials define the render state to be applied to mesh objects.
|
|
||||||
|
|
||||||
The example below shows a simple GLSL shader setup allowing to dynamically mix two texture channels
|
|
||||||
in a material. All materials of the object executing this script should have two textures using
|
|
||||||
separate UV maps in the two first texture channels.
|
|
||||||
|
|
||||||
The code works for both Multitexture and GLSL rendering modes.
|
|
||||||
|
|
||||||
.. code-block:: python
|
|
||||||
|
|
||||||
from bge import logic
|
|
||||||
|
|
||||||
vertex_shader = """
|
|
||||||
|
|
||||||
void main(void)
|
|
||||||
{
|
|
||||||
// simple projection of the vertex position to view space
|
|
||||||
gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
|
|
||||||
// coordinate of the 1st texture channel
|
|
||||||
gl_TexCoord[0] = gl_MultiTexCoord0;
|
|
||||||
// coordinate of the 2nd texture channel
|
|
||||||
gl_TexCoord[1] = gl_MultiTexCoord1;
|
|
||||||
}
|
|
||||||
"""
|
|
||||||
|
|
||||||
fragment_shader ="""
|
|
||||||
|
|
||||||
uniform sampler2D texture_0;
|
|
||||||
uniform sampler2D texture_1;
|
|
||||||
uniform float factor;
|
|
||||||
|
|
||||||
void main(void)
|
|
||||||
{
|
|
||||||
vec4 color_0 = texture2D(texture_0, gl_TexCoord[0].st);
|
|
||||||
vec4 color_1 = texture2D(texture_1, gl_TexCoord[1].st);
|
|
||||||
gl_FragColor = mix(color_0, color_1, factor);
|
|
||||||
}
|
|
||||||
"""
|
|
||||||
|
|
||||||
object = logic.getCurrentController().owner
|
|
||||||
|
|
||||||
for mesh in object.meshes:
|
|
||||||
for material in mesh.materials:
|
|
||||||
shader = material.getShader()
|
|
||||||
if shader is not None:
|
|
||||||
if not shader.isValid():
|
|
||||||
shader.setSource(vertex_shader, fragment_shader, True)
|
|
||||||
|
|
||||||
# get the first texture channel of the material
|
|
||||||
shader.setSampler('texture_0', 0)
|
|
||||||
# get the second texture channel of the material
|
|
||||||
shader.setSampler('texture_1', 1)
|
|
||||||
# pass another uniform to the shader
|
|
||||||
shader.setUniform1f('factor', 0.3)
|
|
||||||
|
|
||||||
.. attribute:: shader
|
.. attribute:: shader
|
||||||
|
|
||||||
The material's shader.
|
The materials shader.
|
||||||
|
|
||||||
:type: :class:`BL_Shader`
|
:type: :class:`BL_Shader`
|
||||||
|
|
||||||
@@ -93,37 +38,35 @@ base class --- :class:`PyObjectPlus`
|
|||||||
|
|
||||||
Set the pixel color arithmetic functions.
|
Set the pixel color arithmetic functions.
|
||||||
|
|
||||||
:arg src: Specifies how the red, green, blue, and alpha source blending factors are computed, one of...
|
:arg src: Specifies how the red, green, blue, and alpha source blending factors are computed.
|
||||||
|
:type src: Value in...
|
||||||
* :data:`~bgl.GL_ZERO`
|
|
||||||
* :data:`~bgl.GL_ONE`
|
|
||||||
* :data:`~bgl.GL_SRC_COLOR`
|
|
||||||
* :data:`~bgl.GL_ONE_MINUS_SRC_COLOR`
|
|
||||||
* :data:`~bgl.GL_DST_COLOR`
|
|
||||||
* :data:`~bgl.GL_ONE_MINUS_DST_COLOR`
|
|
||||||
* :data:`~bgl.GL_SRC_ALPHA`
|
|
||||||
* :data:`~bgl.GL_ONE_MINUS_SRC_ALPHA`
|
|
||||||
* :data:`~bgl.GL_DST_ALPHA`
|
|
||||||
* :data:`~bgl.GL_ONE_MINUS_DST_ALPHA`
|
|
||||||
* :data:`~bgl.GL_SRC_ALPHA_SATURATE`
|
|
||||||
|
|
||||||
:type src: int
|
|
||||||
|
|
||||||
:arg dest: Specifies how the red, green, blue, and alpha destination blending factors are computed, one of...
|
* GL_ZERO,
|
||||||
|
* GL_ONE,
|
||||||
* :data:`~bgl.GL_ZERO`
|
* GL_SRC_COLOR,
|
||||||
* :data:`~bgl.GL_ONE`
|
* GL_ONE_MINUS_SRC_COLOR,
|
||||||
* :data:`~bgl.GL_SRC_COLOR`
|
* GL_DST_COLOR,
|
||||||
* :data:`~bgl.GL_ONE_MINUS_SRC_COLOR`
|
* GL_ONE_MINUS_DST_COLOR,
|
||||||
* :data:`~bgl.GL_DST_COLOR`
|
* GL_SRC_ALPHA,
|
||||||
* :data:`~bgl.GL_ONE_MINUS_DST_COLOR`
|
* GL_ONE_MINUS_SRC_ALPHA,
|
||||||
* :data:`~bgl.GL_SRC_ALPHA`
|
* GL_DST_ALPHA,
|
||||||
* :data:`~bgl.GL_ONE_MINUS_SRC_ALPHA`
|
* GL_ONE_MINUS_DST_ALPHA,
|
||||||
* :data:`~bgl.GL_DST_ALPHA`
|
* GL_SRC_ALPHA_SATURATE
|
||||||
* :data:`~bgl.GL_ONE_MINUS_DST_ALPHA`
|
|
||||||
* :data:`~bgl.GL_SRC_ALPHA_SATURATE`
|
:arg dest: Specifies how the red, green, blue, and alpha destination blending factors are computed.
|
||||||
|
:type dest: Value in...
|
||||||
:type dest: int
|
|
||||||
|
* GL_ZERO
|
||||||
|
* GL_ONE
|
||||||
|
* GL_SRC_COLOR
|
||||||
|
* GL_ONE_MINUS_SRC_COLOR
|
||||||
|
* GL_DST_COLOR
|
||||||
|
* GL_ONE_MINUS_DST_COLOR
|
||||||
|
* GL_SRC_ALPHA
|
||||||
|
* GL_ONE_MINUS_SRC_ALPHA
|
||||||
|
* GL_DST_ALPHA
|
||||||
|
* GL_ONE_MINUS_DST_ALPHA
|
||||||
|
* GL_SRC_ALPHA_SATURATE
|
||||||
|
|
||||||
.. method:: getMaterialIndex()
|
.. method:: getMaterialIndex()
|
||||||
|
|
||||||
|
@@ -37,7 +37,7 @@ base class --- :class:`PyObjectPlus`
|
|||||||
|
|
||||||
The speed and direction the character is traveling in using world coordinates. This should be used instead of applyMovement() to properly move the character.
|
The speed and direction the character is traveling in using world coordinates. This should be used instead of applyMovement() to properly move the character.
|
||||||
|
|
||||||
:type: Vector((x, y, z))
|
:type: list [x, y, z]
|
||||||
|
|
||||||
.. method:: jump()
|
.. method:: jump()
|
||||||
|
|
||||||
|
@@ -23,14 +23,15 @@ base class --- :class:`PyObjectPlus`
|
|||||||
:arg axis:
|
:arg axis:
|
||||||
:type axis: integer
|
:type axis: integer
|
||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
* Lowerlimit == Upperlimit -> axis is locked
|
For each axis:
|
||||||
* Lowerlimit > Upperlimit -> axis is free
|
* Lowerlimit == Upperlimit -> axis is locked
|
||||||
* Lowerlimit < Upperlimit -> axis it limited in that range
|
* Lowerlimit > Upperlimit -> axis is free
|
||||||
|
* Lowerlimit < Upperlimit -> axis it limited in that range
|
||||||
For PHY_LINEHINGE_CONSTRAINT = 2 or PHY_ANGULAR_CONSTRAINT = 3:
|
|
||||||
|
|
||||||
|
PHY_LINEHINGE_CONSTRAINT = 2 or PHY_ANGULAR_CONSTRAINT = 3:
|
||||||
axis = 3 is a constraint limit, with low/high limit value
|
axis = 3 is a constraint limit, with low/high limit value
|
||||||
|
|
||||||
* 3: X axis angle
|
* 3: X axis angle
|
||||||
|
|
||||||
:arg value0 (min): Set the minimum limit of the axis
|
:arg value0 (min): Set the minimum limit of the axis
|
||||||
@@ -38,8 +39,7 @@ base class --- :class:`PyObjectPlus`
|
|||||||
:arg value1 (max): Set the maximum limit of the axis
|
:arg value1 (max): Set the maximum limit of the axis
|
||||||
:type value1: float
|
:type value1: float
|
||||||
|
|
||||||
For PHY_CONE_TWIST_CONSTRAINT = 4:
|
PHY_CONE_TWIST_CONSTRAINT = 3:
|
||||||
|
|
||||||
axis = 3..5 are constraint limits, high limit values
|
axis = 3..5 are constraint limits, high limit values
|
||||||
* 3: X axis angle
|
* 3: X axis angle
|
||||||
* 4: Y axis angle
|
* 4: Y axis angle
|
||||||
@@ -50,8 +50,7 @@ base class --- :class:`PyObjectPlus`
|
|||||||
:arg value1 (max): Set the maximum limit of the axis
|
:arg value1 (max): Set the maximum limit of the axis
|
||||||
:type value1: float
|
:type value1: float
|
||||||
|
|
||||||
For PHY_GENERIC_6DOF_CONSTRAINT = 12:
|
PHY_GENERIC_6DOF_CONSTRAINT = 12:
|
||||||
|
|
||||||
axis = 0..2 are constraint limits, with low/high limit value
|
axis = 0..2 are constraint limits, with low/high limit value
|
||||||
* 0: X axis position
|
* 0: X axis position
|
||||||
* 1: Y axis position
|
* 1: Y axis position
|
||||||
@@ -133,10 +132,10 @@ base class --- :class:`PyObjectPlus`
|
|||||||
Returns the contraint type (read only)
|
Returns the contraint type (read only)
|
||||||
|
|
||||||
:type: integer
|
:type: integer
|
||||||
- 1 = :class:`~bge.constraints.POINTTOPOINT_CONSTRAINT`
|
|
||||||
- 2 = :class:`~bge.constraints.LINEHINGE_CONSTRAINT`
|
|
||||||
- 3 = :class:`~bge.constraints.ANGULAR_CONSTRAINT`
|
|
||||||
- 4 = :class:`~bge.constraints.CONETWIST_CONSTRAINT`
|
|
||||||
- 11 = :class:`~bge.constraints.VEHICLE_CONSTRAINT`
|
|
||||||
- 12 = :class:`~bge.constraints.GENERIC_6DOF_CONSTRAINT`
|
|
||||||
|
|
||||||
|
* 1 = POINTTOPOINT_CONSTRAINT
|
||||||
|
* 2 = LINEHINGE_CONSTRAINT
|
||||||
|
* 3 = ANGULAR_CONSTRAINT (aka LINEHINGE_CONSTRAINT)
|
||||||
|
* 4 = CONETWIST_CONSTRAINT
|
||||||
|
* 11 = VEHICLE_CONSTRAINT
|
||||||
|
* 12 = GENERIC_6DOF_CONSTRAINT
|
||||||
|
@@ -7,26 +7,6 @@ base class --- :class:`KX_GameObject`
|
|||||||
|
|
||||||
.. class:: KX_FontObject(KX_GameObject)
|
.. class:: KX_FontObject(KX_GameObject)
|
||||||
|
|
||||||
A Font object.
|
TODO.
|
||||||
|
|
||||||
.. code-block:: python
|
|
||||||
|
|
||||||
# Display a message about the exit key using a Font object.
|
|
||||||
import bge
|
|
||||||
|
|
||||||
co = bge.logic.getCurrentController()
|
|
||||||
font = co.owner
|
|
||||||
|
|
||||||
exit_key = bge.events.EventToString(bge.logic.getExitKey())
|
|
||||||
|
|
||||||
if exit_key.endswith("KEY"):
|
|
||||||
exit_key = exit_key[:-3]
|
|
||||||
|
|
||||||
font.text = "Press key '%s' to quit the game." % exit_key
|
|
||||||
|
|
||||||
.. attribute:: text
|
|
||||||
|
|
||||||
The text displayed by this Font object.
|
|
||||||
|
|
||||||
:type: string
|
|
||||||
|
|
||||||
|
@@ -78,35 +78,6 @@ base class --- :class:`SCA_IObject`
|
|||||||
|
|
||||||
The object must have a physics controller for the mass to be applied, otherwise the mass value will be returned as 0.0.
|
The object must have a physics controller for the mass to be applied, otherwise the mass value will be returned as 0.0.
|
||||||
|
|
||||||
.. attribute:: isSuspendDynamics
|
|
||||||
|
|
||||||
The object's dynamic state (read-only).
|
|
||||||
|
|
||||||
:type: boolean
|
|
||||||
|
|
||||||
.. seealso:: :py:meth:`suspendDynamics` and :py:meth:`restoreDynamics` allow you to change the state.
|
|
||||||
|
|
||||||
.. attribute:: linearDamping
|
|
||||||
|
|
||||||
The object's linear damping, also known as translational damping. Can be set simultaneously with angular damping using the :py:meth:`setDamping` method.
|
|
||||||
|
|
||||||
:type: float between 0 and 1 inclusive.
|
|
||||||
|
|
||||||
.. note::
|
|
||||||
|
|
||||||
The object must have a physics controller for the linear damping to be applied, otherwise the value will be returned as 0.0.
|
|
||||||
|
|
||||||
.. attribute:: angularDamping
|
|
||||||
|
|
||||||
The object's angular damping, also known as rotationation damping. Can be set simultaneously with linear damping using the :py:meth:`setDamping` method.
|
|
||||||
|
|
||||||
:type: float between 0 and 1 inclusive.
|
|
||||||
|
|
||||||
.. note::
|
|
||||||
|
|
||||||
The object must have a physics controller for the angular damping to be applied, otherwise the value will be returned as 0.0.
|
|
||||||
|
|
||||||
|
|
||||||
.. attribute:: linVelocityMin
|
.. attribute:: linVelocityMin
|
||||||
|
|
||||||
Enforces the object keeps moving at a minimum velocity.
|
Enforces the object keeps moving at a minimum velocity.
|
||||||
@@ -139,34 +110,11 @@ base class --- :class:`SCA_IObject`
|
|||||||
|
|
||||||
A value of 0.0 disables this option (rather then setting it stationary).
|
A value of 0.0 disables this option (rather then setting it stationary).
|
||||||
|
|
||||||
.. attribute:: angularVelocityMin
|
|
||||||
|
|
||||||
Enforces the object keeps rotating at a minimum velocity. A value of 0.0 disables this.
|
|
||||||
|
|
||||||
:type: non-negative float
|
|
||||||
|
|
||||||
.. note::
|
|
||||||
|
|
||||||
Applies to dynamic and rigid body objects only.
|
|
||||||
While objects are stationary the minimum velocity will not be applied.
|
|
||||||
|
|
||||||
|
|
||||||
.. attribute:: angularVelocityMax
|
|
||||||
|
|
||||||
Clamp the maximum angular velocity to prevent objects rotating beyond a set speed.
|
|
||||||
A value of 0.0 disables clamping; it does not stop rotation.
|
|
||||||
|
|
||||||
:type: non-negative float
|
|
||||||
|
|
||||||
.. note::
|
|
||||||
|
|
||||||
Applies to dynamic and rigid body objects only.
|
|
||||||
|
|
||||||
.. attribute:: localInertia
|
.. attribute:: localInertia
|
||||||
|
|
||||||
the object's inertia vector in local coordinates. Read only.
|
the object's inertia vector in local coordinates. Read only.
|
||||||
|
|
||||||
:type: Vector((ix, iy, iz))
|
:type: list [ix, iy, iz]
|
||||||
|
|
||||||
.. attribute:: parent
|
.. attribute:: parent
|
||||||
|
|
||||||
@@ -176,70 +124,21 @@ base class --- :class:`SCA_IObject`
|
|||||||
|
|
||||||
.. attribute:: groupMembers
|
.. attribute:: groupMembers
|
||||||
|
|
||||||
Returns the list of group members if the object is a group object (dupli group instance), otherwise None is returned.
|
Returns the list of group members if the object is a group object, otherwise None is returned.
|
||||||
|
|
||||||
:type: :class:`CListValue` of :class:`KX_GameObject` or None
|
:type: :class:`CListValue` of :class:`KX_GameObject` or None
|
||||||
|
|
||||||
.. attribute:: groupObject
|
.. attribute:: groupObject
|
||||||
|
|
||||||
Returns the group object (dupli group instance) that the object belongs to or None if the object is not part of a group.
|
Returns the group object that the object belongs to or None if the object is not part of a group.
|
||||||
|
|
||||||
:type: :class:`KX_GameObject` or None
|
:type: :class:`KX_GameObject` or None
|
||||||
|
|
||||||
.. attribute:: collisionGroup
|
|
||||||
|
|
||||||
The object's collision group.
|
|
||||||
|
|
||||||
:type: bitfield
|
|
||||||
|
|
||||||
.. attribute:: collisionMask
|
|
||||||
|
|
||||||
The object's collision mask.
|
|
||||||
|
|
||||||
:type: bitfield
|
|
||||||
|
|
||||||
.. attribute:: collisionCallbacks
|
.. attribute:: collisionCallbacks
|
||||||
|
|
||||||
A list of functions to be called when a collision occurs.
|
A list of callables to be run when a collision occurs.
|
||||||
|
|
||||||
:type: list of functions and/or methods
|
:type: list
|
||||||
|
|
||||||
Callbacks should either accept one argument `(object)`, or three
|
|
||||||
arguments `(object, point, normal)`. For simplicity, per
|
|
||||||
colliding object only the first collision point is reported.
|
|
||||||
|
|
||||||
.. code-block:: python
|
|
||||||
|
|
||||||
# Function form
|
|
||||||
def callback_three(object, point, normal):
|
|
||||||
print('Hit by %r at %s with normal %s' % (object.name, point, normal))
|
|
||||||
|
|
||||||
def callback_one(object):
|
|
||||||
print('Hit by %r' % object.name)
|
|
||||||
|
|
||||||
def register_callback(controller):
|
|
||||||
controller.owner.collisionCallbacks.append(callback_three)
|
|
||||||
controller.owner.collisionCallbacks.append(callback_one)
|
|
||||||
|
|
||||||
|
|
||||||
# Method form
|
|
||||||
class YourGameEntity(bge.types.KX_GameObject):
|
|
||||||
def __init__(self, old_owner):
|
|
||||||
self.collisionCallbacks.append(self.on_collision_three)
|
|
||||||
self.collisionCallbacks.append(self.on_collision_one)
|
|
||||||
|
|
||||||
def on_collision_three(self, object, point, normal):
|
|
||||||
print('Hit by %r at %s with normal %s' % (object.name, point, normal))
|
|
||||||
|
|
||||||
def on_collision_one(self, object):
|
|
||||||
print('Hit by %r' % object.name)
|
|
||||||
|
|
||||||
.. note::
|
|
||||||
For backward compatibility, a callback with variable number of
|
|
||||||
arguments (using `*args`) will be passed only the `object`
|
|
||||||
argument. Only when there is more than one fixed argument (not
|
|
||||||
counting `self` for methods) will the three-argument form be
|
|
||||||
used.
|
|
||||||
|
|
||||||
.. attribute:: scene
|
.. attribute:: scene
|
||||||
|
|
||||||
@@ -475,12 +374,6 @@ base class --- :class:`SCA_IObject`
|
|||||||
If true, the object's and children's debug properties will be displayed on screen.
|
If true, the object's and children's debug properties will be displayed on screen.
|
||||||
|
|
||||||
:type: boolean
|
:type: boolean
|
||||||
|
|
||||||
.. attribute:: currentLodLevel
|
|
||||||
|
|
||||||
The index of the level of detail (LOD) currently used by this object (read-only).
|
|
||||||
|
|
||||||
:type: int
|
|
||||||
|
|
||||||
.. method:: endObject()
|
.. method:: endObject()
|
||||||
|
|
||||||
@@ -603,7 +496,7 @@ base class --- :class:`SCA_IObject`
|
|||||||
* True: you get the "local" velocity ie: relative to object orientation.
|
* True: you get the "local" velocity ie: relative to object orientation.
|
||||||
:type local: boolean
|
:type local: boolean
|
||||||
:return: the object's linear velocity.
|
:return: the object's linear velocity.
|
||||||
:rtype: Vector((vx, vy, vz))
|
:rtype: list [vx, vy, vz]
|
||||||
|
|
||||||
.. method:: setLinearVelocity(velocity, local=False)
|
.. method:: setLinearVelocity(velocity, local=False)
|
||||||
|
|
||||||
@@ -630,7 +523,7 @@ base class --- :class:`SCA_IObject`
|
|||||||
* True: you get the "local" velocity ie: relative to object orientation.
|
* True: you get the "local" velocity ie: relative to object orientation.
|
||||||
:type local: boolean
|
:type local: boolean
|
||||||
:return: the object's angular velocity.
|
:return: the object's angular velocity.
|
||||||
:rtype: Vector((vx, vy, vz))
|
:rtype: list [vx, vy, vz]
|
||||||
|
|
||||||
.. method:: setAngularVelocity(velocity, local=False)
|
.. method:: setAngularVelocity(velocity, local=False)
|
||||||
|
|
||||||
@@ -654,7 +547,7 @@ base class --- :class:`SCA_IObject`
|
|||||||
:arg point: optional point to return the velocity for, in local coordinates.
|
:arg point: optional point to return the velocity for, in local coordinates.
|
||||||
:type point: 3D Vector
|
:type point: 3D Vector
|
||||||
:return: the velocity at the specified point.
|
:return: the velocity at the specified point.
|
||||||
:rtype: Vector((vx, vy, vz))
|
:rtype: list [vx, vy, vz]
|
||||||
|
|
||||||
.. method:: getReactionForce()
|
.. method:: getReactionForce()
|
||||||
|
|
||||||
@@ -664,7 +557,7 @@ base class --- :class:`SCA_IObject`
|
|||||||
This also includes impulses, eg from collisions.
|
This also includes impulses, eg from collisions.
|
||||||
|
|
||||||
:return: the reaction force of this object.
|
:return: the reaction force of this object.
|
||||||
:rtype: Vector((fx, fy, fz))
|
:rtype: list [fx, fy, fz]
|
||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
|
|
||||||
@@ -687,28 +580,13 @@ base class --- :class:`SCA_IObject`
|
|||||||
* True: you get the "local" impulse ie: relative to local coordinates with object orientation.
|
* True: you get the "local" impulse ie: relative to local coordinates with object orientation.
|
||||||
:type local: boolean
|
:type local: boolean
|
||||||
|
|
||||||
.. method:: setDamping(linear_damping, angular_damping)
|
.. method:: suspendDynamics()
|
||||||
|
|
||||||
Sets both the :py:attr:`linearDamping` and :py:attr:`angularDamping` simultaneously. This is more efficient than setting both properties individually.
|
|
||||||
|
|
||||||
:arg linear_damping: Linear ("translational") damping factor.
|
|
||||||
:type linear_damping: float ∈ [0, 1]
|
|
||||||
:arg angular_damping: Angular ("rotational") damping factor.
|
|
||||||
:type angular_damping: float ∈ [0, 1]
|
|
||||||
|
|
||||||
.. method:: suspendDynamics([ghost])
|
|
||||||
|
|
||||||
Suspends physics for this object.
|
Suspends physics for this object.
|
||||||
|
|
||||||
:arg ghost: When set to `True`, collisions with the object will be ignored, similar to the "ghost" checkbox in
|
|
||||||
Blender. When `False` (the default), the object becomes static but still collide with other objects.
|
|
||||||
:type ghost: bool
|
|
||||||
|
|
||||||
.. seealso:: :py:attr:`isSuspendDynamics` allows you to inspect whether the object is in a suspended state.
|
|
||||||
|
|
||||||
.. method:: restoreDynamics()
|
.. method:: restoreDynamics()
|
||||||
|
|
||||||
Resumes physics for this object. Also reinstates collisions; the object will no longer be a ghost.
|
Resumes physics for this object.
|
||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
|
|
||||||
@@ -998,4 +876,4 @@ base class --- :class:`SCA_IObject`
|
|||||||
:arg name: name of the property that added to the debug list.
|
:arg name: name of the property that added to the debug list.
|
||||||
:type name: string
|
:type name: string
|
||||||
:arg debug: the debug state.
|
:arg debug: the debug state.
|
||||||
:type debug: boolean
|
:type debug: boolean
|
@@ -15,7 +15,7 @@ base class --- :class:`SCA_IActuator`
|
|||||||
|
|
||||||
The force applied by the actuator.
|
The force applied by the actuator.
|
||||||
|
|
||||||
:type: Vector((x, y, z))
|
:type: list [x, y, z]
|
||||||
|
|
||||||
.. attribute:: useLocalForce
|
.. attribute:: useLocalForce
|
||||||
|
|
||||||
@@ -27,7 +27,7 @@ base class --- :class:`SCA_IActuator`
|
|||||||
|
|
||||||
The torque applied by the actuator.
|
The torque applied by the actuator.
|
||||||
|
|
||||||
:type: Vector((x, y, z))
|
:type: list [x, y, z]
|
||||||
|
|
||||||
.. attribute:: useLocalTorque
|
.. attribute:: useLocalTorque
|
||||||
|
|
||||||
@@ -39,7 +39,7 @@ base class --- :class:`SCA_IActuator`
|
|||||||
|
|
||||||
The displacement vector applied by the actuator.
|
The displacement vector applied by the actuator.
|
||||||
|
|
||||||
:type: Vector((x, y, z))
|
:type: list [x, y, z]
|
||||||
|
|
||||||
.. attribute:: useLocalDLoc
|
.. attribute:: useLocalDLoc
|
||||||
|
|
||||||
@@ -51,7 +51,7 @@ base class --- :class:`SCA_IActuator`
|
|||||||
|
|
||||||
The angular displacement vector applied by the actuator
|
The angular displacement vector applied by the actuator
|
||||||
|
|
||||||
:type: Vector((x, y, z))
|
:type: list [x, y, z]
|
||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
|
|
||||||
@@ -67,7 +67,7 @@ base class --- :class:`SCA_IActuator`
|
|||||||
|
|
||||||
The linear velocity applied by the actuator.
|
The linear velocity applied by the actuator.
|
||||||
|
|
||||||
:type: Vector((x, y, z))
|
:type: list [x, y, z]
|
||||||
|
|
||||||
.. attribute:: useLocalLinV
|
.. attribute:: useLocalLinV
|
||||||
|
|
||||||
@@ -83,7 +83,7 @@ base class --- :class:`SCA_IActuator`
|
|||||||
|
|
||||||
The angular velocity applied by the actuator.
|
The angular velocity applied by the actuator.
|
||||||
|
|
||||||
:type: Vector((x, y, z))
|
:type: list [x, y, z]
|
||||||
|
|
||||||
.. attribute:: useLocalAngV
|
.. attribute:: useLocalAngV
|
||||||
|
|
||||||
|
250
doc/python_api/rst/bge_types/bge.types.KX_PolygonMaterial.rst
Normal file
250
doc/python_api/rst/bge_types/bge.types.KX_PolygonMaterial.rst
Normal file
@@ -0,0 +1,250 @@
|
|||||||
|
KX_PolygonMaterial(PyObjectPlus)
|
||||||
|
================================
|
||||||
|
|
||||||
|
.. module:: bge.types
|
||||||
|
|
||||||
|
base class --- :class:`PyObjectPlus`
|
||||||
|
|
||||||
|
.. class:: KX_PolygonMaterial(PyObjectPlus)
|
||||||
|
|
||||||
|
This is the interface to materials in the game engine.
|
||||||
|
|
||||||
|
Materials define the render state to be applied to mesh objects.
|
||||||
|
|
||||||
|
.. warning::
|
||||||
|
|
||||||
|
Some of the methods/variables are CObjects. If you mix these up, you will crash blender.
|
||||||
|
|
||||||
|
.. code-block:: python
|
||||||
|
|
||||||
|
from bge import logic
|
||||||
|
|
||||||
|
vertex_shader = """
|
||||||
|
|
||||||
|
void main(void)
|
||||||
|
{
|
||||||
|
// original vertex position, no changes
|
||||||
|
gl_Position = ftransform();
|
||||||
|
// coordinate of the 1st texture channel
|
||||||
|
gl_TexCoord[0] = gl_MultiTexCoord0;
|
||||||
|
// coordinate of the 2nd texture channel
|
||||||
|
gl_TexCoord[1] = gl_MultiTexCoord1;
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
|
||||||
|
fragment_shader ="""
|
||||||
|
|
||||||
|
uniform sampler2D color_0;
|
||||||
|
uniform sampler2D color_1;
|
||||||
|
uniform float factor;
|
||||||
|
|
||||||
|
void main(void)
|
||||||
|
{
|
||||||
|
vec4 color_0 = texture2D(color_0, gl_TexCoord[0].st);
|
||||||
|
vec4 color_1 = texture2D(color_1, gl_TexCoord[1].st);
|
||||||
|
gl_FragColor = mix(color_0, color_1, factor);
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
|
||||||
|
object = logic.getCurrentController().owner
|
||||||
|
object = cont.owner
|
||||||
|
for mesh in object.meshes:
|
||||||
|
for material in mesh.materials:
|
||||||
|
shader = material.getShader()
|
||||||
|
if shader != None:
|
||||||
|
if not shader.isValid():
|
||||||
|
shader.setSource(vertex_shader, fragment_shader, True)
|
||||||
|
|
||||||
|
# get the first texture channel of the material
|
||||||
|
shader.setSampler('color_0', 0)
|
||||||
|
# get the second texture channel of the material
|
||||||
|
shader.setSampler('color_1', 1)
|
||||||
|
# pass another uniform to the shader
|
||||||
|
shader.setUniform1f('factor', 0.3)
|
||||||
|
|
||||||
|
|
||||||
|
.. attribute:: texture
|
||||||
|
|
||||||
|
Texture name.
|
||||||
|
|
||||||
|
:type: string (read-only)
|
||||||
|
|
||||||
|
.. attribute:: gl_texture
|
||||||
|
|
||||||
|
OpenGL texture handle (eg for glBindTexture(GL_TEXTURE_2D, gl_texture).
|
||||||
|
|
||||||
|
:type: integer (read-only)
|
||||||
|
|
||||||
|
.. attribute:: material
|
||||||
|
|
||||||
|
Material name.
|
||||||
|
|
||||||
|
:type: string (read-only)
|
||||||
|
|
||||||
|
.. attribute:: tface
|
||||||
|
|
||||||
|
Texture face properties.
|
||||||
|
|
||||||
|
:type: CObject (read-only)
|
||||||
|
|
||||||
|
.. attribute:: tile
|
||||||
|
|
||||||
|
Texture is tiling.
|
||||||
|
|
||||||
|
:type: boolean
|
||||||
|
|
||||||
|
.. attribute:: tilexrep
|
||||||
|
|
||||||
|
Number of tile repetitions in x direction.
|
||||||
|
|
||||||
|
:type: integer
|
||||||
|
|
||||||
|
.. attribute:: tileyrep
|
||||||
|
|
||||||
|
Number of tile repetitions in y direction.
|
||||||
|
|
||||||
|
:type: integer
|
||||||
|
|
||||||
|
.. attribute:: drawingmode
|
||||||
|
|
||||||
|
Drawing mode for the material.
|
||||||
|
- 2 (drawingmode & 4) Textured
|
||||||
|
- 4 (drawingmode & 16) Light
|
||||||
|
- 14 (drawingmode & 16384) 3d Polygon Text.
|
||||||
|
|
||||||
|
:type: bitfield
|
||||||
|
|
||||||
|
.. attribute:: transparent
|
||||||
|
|
||||||
|
This material is transparent. All meshes with this
|
||||||
|
material will be rendered after non transparent meshes from back
|
||||||
|
to front.
|
||||||
|
|
||||||
|
:type: boolean
|
||||||
|
|
||||||
|
.. attribute:: zsort
|
||||||
|
|
||||||
|
Transparent polygons in meshes with this material will be sorted back to
|
||||||
|
front before rendering.
|
||||||
|
Non-Transparent polygons will be sorted front to back before rendering.
|
||||||
|
|
||||||
|
:type: boolean
|
||||||
|
|
||||||
|
.. attribute:: diffuse
|
||||||
|
|
||||||
|
The diffuse color of the material. black = [0.0, 0.0, 0.0] white = [1.0, 1.0, 1.0].
|
||||||
|
|
||||||
|
:type: list [r, g, b]
|
||||||
|
|
||||||
|
.. attribute:: specular
|
||||||
|
|
||||||
|
The specular color of the material. black = [0.0, 0.0, 0.0] white = [1.0, 1.0, 1.0].
|
||||||
|
|
||||||
|
:type: list [r, g, b]
|
||||||
|
|
||||||
|
.. attribute:: shininess
|
||||||
|
|
||||||
|
The shininess (specular exponent) of the material. 0.0 <= shininess <= 128.0.
|
||||||
|
|
||||||
|
:type: float
|
||||||
|
|
||||||
|
.. attribute:: specularity
|
||||||
|
|
||||||
|
The amount of specular of the material. 0.0 <= specularity <= 1.0.
|
||||||
|
|
||||||
|
:type: float
|
||||||
|
|
||||||
|
.. method:: updateTexture(tface, rasty)
|
||||||
|
|
||||||
|
Updates a realtime animation.
|
||||||
|
|
||||||
|
:arg tface: Texture face (eg mat.tface)
|
||||||
|
:type tface: CObject
|
||||||
|
:arg rasty: Rasterizer
|
||||||
|
:type rasty: CObject
|
||||||
|
|
||||||
|
.. method:: setTexture(tface)
|
||||||
|
|
||||||
|
Sets texture render state.
|
||||||
|
|
||||||
|
:arg tface: Texture face
|
||||||
|
:type tface: CObject
|
||||||
|
|
||||||
|
.. code-block:: python
|
||||||
|
|
||||||
|
mat.setTexture(mat.tface)
|
||||||
|
|
||||||
|
.. method:: activate(rasty, cachingInfo)
|
||||||
|
|
||||||
|
Sets material parameters for this object for rendering.
|
||||||
|
|
||||||
|
Material Parameters set:
|
||||||
|
|
||||||
|
#. Texture
|
||||||
|
#. Backface culling
|
||||||
|
#. Line drawing
|
||||||
|
#. Specular Colour
|
||||||
|
#. Shininess
|
||||||
|
#. Diffuse Colour
|
||||||
|
#. Polygon Offset.
|
||||||
|
|
||||||
|
:arg rasty: Rasterizer instance.
|
||||||
|
:type rasty: CObject
|
||||||
|
:arg cachingInfo: Material cache instance.
|
||||||
|
:type cachingInfo: CObject
|
||||||
|
|
||||||
|
.. method:: setCustomMaterial(material)
|
||||||
|
|
||||||
|
Sets the material state setup object.
|
||||||
|
|
||||||
|
Using this method, you can extend or completely replace the gameengine material
|
||||||
|
to do your own advanced multipass effects.
|
||||||
|
|
||||||
|
Use this method to register your material class. Instead of the normal material,
|
||||||
|
your class's activate method will be called just before rendering the mesh.
|
||||||
|
This should setup the texture, material, and any other state you would like.
|
||||||
|
It should return True to render the mesh, or False if you are finished. You should
|
||||||
|
clean up any state Blender does not set before returning False.
|
||||||
|
|
||||||
|
Activate Method Definition:
|
||||||
|
|
||||||
|
.. code-block:: python
|
||||||
|
|
||||||
|
def activate(self, rasty, cachingInfo, material):
|
||||||
|
|
||||||
|
:arg material: The material object.
|
||||||
|
:type material: instance
|
||||||
|
|
||||||
|
.. code-block:: python
|
||||||
|
|
||||||
|
class PyMaterial:
|
||||||
|
def __init__(self):
|
||||||
|
self.pass_no = -1
|
||||||
|
|
||||||
|
def activate(self, rasty, cachingInfo, material):
|
||||||
|
# Activate the material here.
|
||||||
|
#
|
||||||
|
# The activate method will be called until it returns False.
|
||||||
|
# Every time the activate method returns True the mesh will
|
||||||
|
# be rendered.
|
||||||
|
#
|
||||||
|
# rasty is a CObject for passing to material.updateTexture()
|
||||||
|
# and material.activate()
|
||||||
|
# cachingInfo is a CObject for passing to material.activate()
|
||||||
|
# material is the KX_PolygonMaterial instance this material
|
||||||
|
# was added to
|
||||||
|
|
||||||
|
# default material properties:
|
||||||
|
self.pass_no += 1
|
||||||
|
if self.pass_no == 0:
|
||||||
|
material.activate(rasty, cachingInfo)
|
||||||
|
# Return True to do this pass
|
||||||
|
return True
|
||||||
|
|
||||||
|
# clean up and return False to finish.
|
||||||
|
self.pass_no = -1
|
||||||
|
return False
|
||||||
|
|
||||||
|
# Create a new Python Material and pass it to the renderer.
|
||||||
|
mat.setCustomMaterial(PyMaterial())
|
||||||
|
|
@@ -83,12 +83,6 @@ base class --- :class:`PyObjectPlus`
|
|||||||
|
|
||||||
This can be set directly from python to avoid using the :class:`KX_SceneActuator`.
|
This can be set directly from python to avoid using the :class:`KX_SceneActuator`.
|
||||||
|
|
||||||
.. attribute:: world
|
|
||||||
|
|
||||||
The current active world, (read-only).
|
|
||||||
|
|
||||||
:type: :class:`KX_WorldInfo`
|
|
||||||
|
|
||||||
.. attribute:: suspended
|
.. attribute:: suspended
|
||||||
|
|
||||||
True if the scene is suspended, (read-only).
|
True if the scene is suspended, (read-only).
|
||||||
@@ -125,27 +119,21 @@ base class --- :class:`PyObjectPlus`
|
|||||||
|
|
||||||
:type: list
|
:type: list
|
||||||
|
|
||||||
.. attribute:: pre_draw_setup
|
|
||||||
|
|
||||||
A list of callables to be run before the drawing setup (i.e., before the model view and projection matrices are computed).
|
|
||||||
|
|
||||||
:type: list
|
|
||||||
|
|
||||||
.. attribute:: gravity
|
.. attribute:: gravity
|
||||||
|
|
||||||
The scene gravity using the world x, y and z axis.
|
The scene gravity using the world x, y and z axis.
|
||||||
|
|
||||||
:type: Vector((gx, gy, gz))
|
:type: list [fx, fy, fz]
|
||||||
|
|
||||||
.. method:: addObject(object, reference, time=0)
|
.. method:: addObject(object, other, time=0)
|
||||||
|
|
||||||
Adds an object to the scene like the Add Object Actuator would.
|
Adds an object to the scene like the Add Object Actuator would.
|
||||||
|
|
||||||
:arg object: The (name of the) object to add.
|
:arg object: The object to add
|
||||||
:type object: :class:`KX_GameObject` or string
|
:type object: :class:`KX_GameObject` or string
|
||||||
:arg reference: The (name of the) object which position, orientation, and scale to copy (optional), if the object to add is a light and there is not reference the light's layer will be the same that the active layer in the blender scene.
|
:arg other: The object's center to use when adding the object
|
||||||
:type reference: :class:`KX_GameObject` or string
|
:type other: :class:`KX_GameObject` or string
|
||||||
:arg time: The lifetime of the added object, in frames. A time of 0 means the object will last forever (optional).
|
:arg time: The lifetime of the added object, in frames. A time of 0 means the object will last forever.
|
||||||
:type time: integer
|
:type time: integer
|
||||||
:return: The newly added object.
|
:return: The newly added object.
|
||||||
:rtype: :class:`KX_GameObject`
|
:rtype: :class:`KX_GameObject`
|
||||||
|
@@ -11,25 +11,22 @@ base class --- :class:`PyObjectPlus`
|
|||||||
|
|
||||||
TODO - description
|
TODO - description
|
||||||
|
|
||||||
.. method:: addWheel(wheel, attachPos, downDir, axleDir, suspensionRestLength, wheelRadius, hasSteering)
|
.. method:: addWheel(wheel, attachPos, attachDir, axleDir, suspensionRestLength, wheelRadius, hasSteering)
|
||||||
|
|
||||||
Add a wheel to the vehicle
|
Add a wheel to the vehicle
|
||||||
|
|
||||||
:arg wheel: The object to use as a wheel.
|
:arg wheel: The object to use as a wheel.
|
||||||
:type wheel: :class:`KX_GameObject` or a :class:`KX_GameObject` name
|
:type wheel: :class:`KX_GameObject` or a KX_GameObject name
|
||||||
:arg attachPos: The position to attach the wheel, relative to the chassis object center.
|
:arg attachPos: The position that this wheel will attach to.
|
||||||
:type attachPos: vector of 3 floats
|
:type attachPos: vector of 3 floats
|
||||||
:arg downDir: The direction vector pointing down to where the vehicle should collide with the floor.
|
:arg attachDir: The direction this wheel points.
|
||||||
:type downDir: vector of 3 floats
|
:type attachDir: vector of 3 floats
|
||||||
:arg axleDir: The axis the wheel rotates around, relative to the chassis.
|
:arg axleDir: The direction of this wheels axle.
|
||||||
:type axleDir: vector of 3 floats
|
:type axleDir: vector of 3 floats
|
||||||
:arg suspensionRestLength: The length of the suspension when no forces are being applied.
|
:arg suspensionRestLength: TODO - Description
|
||||||
:type suspensionRestLength: float
|
:type suspensionRestLength: float
|
||||||
:arg wheelRadius: The radius of the wheel (half the diameter).
|
:arg wheelRadius: The size of the wheel.
|
||||||
:type wheelRadius: float
|
:type wheelRadius: float
|
||||||
:arg hasSteering: True if the wheel should turn with steering, typically used in front wheels.
|
|
||||||
:type hasSteering: boolean
|
|
||||||
|
|
||||||
|
|
||||||
.. method:: applyBraking(force, wheelIndex)
|
.. method:: applyBraking(force, wheelIndex)
|
||||||
|
|
||||||
@@ -41,7 +38,6 @@ base class --- :class:`PyObjectPlus`
|
|||||||
:arg wheelIndex: index of the wheel where the force needs to be applied
|
:arg wheelIndex: index of the wheel where the force needs to be applied
|
||||||
:type wheelIndex: integer
|
:type wheelIndex: integer
|
||||||
|
|
||||||
|
|
||||||
.. method:: applyEngineForce(force, wheelIndex)
|
.. method:: applyEngineForce(force, wheelIndex)
|
||||||
|
|
||||||
Apply an engine force to the specified wheel
|
Apply an engine force to the specified wheel
|
||||||
@@ -52,7 +48,6 @@ base class --- :class:`PyObjectPlus`
|
|||||||
:arg wheelIndex: index of the wheel where the force needs to be applied
|
:arg wheelIndex: index of the wheel where the force needs to be applied
|
||||||
:type wheelIndex: integer
|
:type wheelIndex: integer
|
||||||
|
|
||||||
|
|
||||||
.. method:: getConstraintId()
|
.. method:: getConstraintId()
|
||||||
|
|
||||||
Get the constraint ID
|
Get the constraint ID
|
||||||
|
@@ -17,25 +17,25 @@ base class --- :class:`SCA_IObject`
|
|||||||
|
|
||||||
The position of the vertex.
|
The position of the vertex.
|
||||||
|
|
||||||
:type: Vector((x, y, z))
|
:type: list [x, y, z]
|
||||||
|
|
||||||
.. attribute:: UV
|
.. attribute:: UV
|
||||||
|
|
||||||
The texture coordinates of the vertex.
|
The texture coordinates of the vertex.
|
||||||
|
|
||||||
:type: Vector((u, v))
|
:type: list [u, v]
|
||||||
|
|
||||||
.. attribute:: normal
|
.. attribute:: normal
|
||||||
|
|
||||||
The normal of the vertex.
|
The normal of the vertex.
|
||||||
|
|
||||||
:type: Vector((nx, ny, nz))
|
:type: list [nx, ny, nz]
|
||||||
|
|
||||||
.. attribute:: color
|
.. attribute:: color
|
||||||
|
|
||||||
The color of the vertex.
|
The color of the vertex.
|
||||||
|
|
||||||
:type: Vector((r, g, b, a))
|
:type: list [r, g, b, a]
|
||||||
|
|
||||||
Black = [0.0, 0.0, 0.0, 1.0], White = [1.0, 1.0, 1.0, 1.0]
|
Black = [0.0, 0.0, 0.0, 1.0], White = [1.0, 1.0, 1.0, 1.0]
|
||||||
|
|
||||||
@@ -110,13 +110,13 @@ base class --- :class:`SCA_IObject`
|
|||||||
Gets the position of this vertex.
|
Gets the position of this vertex.
|
||||||
|
|
||||||
:return: this vertexes position in local coordinates.
|
:return: this vertexes position in local coordinates.
|
||||||
:rtype: Vector((x, y, z))
|
:rtype: list [x, y, z]
|
||||||
|
|
||||||
.. method:: setXYZ(pos)
|
.. method:: setXYZ(pos)
|
||||||
|
|
||||||
Sets the position of this vertex.
|
Sets the position of this vertex.
|
||||||
|
|
||||||
:type: Vector((x, y, z))
|
:type: list [x, y, z]
|
||||||
|
|
||||||
:arg pos: the new position for this vertex in local coordinates.
|
:arg pos: the new position for this vertex in local coordinates.
|
||||||
|
|
||||||
@@ -125,26 +125,26 @@ base class --- :class:`SCA_IObject`
|
|||||||
Gets the UV (texture) coordinates of this vertex.
|
Gets the UV (texture) coordinates of this vertex.
|
||||||
|
|
||||||
:return: this vertexes UV (texture) coordinates.
|
:return: this vertexes UV (texture) coordinates.
|
||||||
:rtype: Vector((u, v))
|
:rtype: list [u, v]
|
||||||
|
|
||||||
.. method:: setUV(uv)
|
.. method:: setUV(uv)
|
||||||
|
|
||||||
Sets the UV (texture) coordinates of this vertex.
|
Sets the UV (texture) coordinates of this vertex.
|
||||||
|
|
||||||
:type: Vector((u, v))
|
:type: list [u, v]
|
||||||
|
|
||||||
.. method:: getUV2()
|
.. method:: getUV2()
|
||||||
|
|
||||||
Gets the 2nd UV (texture) coordinates of this vertex.
|
Gets the 2nd UV (texture) coordinates of this vertex.
|
||||||
|
|
||||||
:return: this vertexes UV (texture) coordinates.
|
:return: this vertexes UV (texture) coordinates.
|
||||||
:rtype: Vector((u, v))
|
:rtype: list [u, v]
|
||||||
|
|
||||||
.. method:: setUV2(uv, unit)
|
.. method:: setUV2(uv, unit)
|
||||||
|
|
||||||
Sets the 2nd UV (texture) coordinates of this vertex.
|
Sets the 2nd UV (texture) coordinates of this vertex.
|
||||||
|
|
||||||
:type: Vector((u, v))
|
:type: list [u, v]
|
||||||
|
|
||||||
:arg unit: optional argument, FLAT==1, SECOND_UV==2, defaults to SECOND_UV
|
:arg unit: optional argument, FLAT==1, SECOND_UV==2, defaults to SECOND_UV
|
||||||
:arg unit: integer
|
:arg unit: integer
|
||||||
@@ -197,7 +197,7 @@ base class --- :class:`SCA_IObject`
|
|||||||
Gets the normal vector of this vertex.
|
Gets the normal vector of this vertex.
|
||||||
|
|
||||||
:return: normalized normal vector.
|
:return: normalized normal vector.
|
||||||
:rtype: Vector((nx, ny, nz))
|
:rtype: list [nx, ny, nz]
|
||||||
|
|
||||||
.. method:: setNormal(normal)
|
.. method:: setNormal(normal)
|
||||||
|
|
||||||
|
@@ -1,79 +0,0 @@
|
|||||||
KX_WordlInfo(PyObjectPlus)
|
|
||||||
=============================
|
|
||||||
|
|
||||||
.. module:: bge.types
|
|
||||||
|
|
||||||
base class --- :class:`PyObjectPlus`
|
|
||||||
|
|
||||||
.. class:: KX_WorldInfo(PyObjectPlus)
|
|
||||||
|
|
||||||
A wolrd object.
|
|
||||||
|
|
||||||
.. code-block:: python
|
|
||||||
|
|
||||||
# Set the mist color to red.
|
|
||||||
import bge
|
|
||||||
|
|
||||||
sce = bge.logic.getCurrentScene()
|
|
||||||
|
|
||||||
sce.world.mistColor = [1.0, 0.0, 0.0]
|
|
||||||
|
|
||||||
.. data:: KX_MIST_QUADRATIC
|
|
||||||
|
|
||||||
Type of quadratic attenuation used to fade mist.
|
|
||||||
|
|
||||||
.. data:: KX_MIST_LINEAR
|
|
||||||
|
|
||||||
Type of linear attenuation used to fade mist.
|
|
||||||
|
|
||||||
.. data:: KX_MIST_INV_QUADRATIC
|
|
||||||
|
|
||||||
Type of inverse quadratic attenuation used to fade mist.
|
|
||||||
|
|
||||||
.. attribute:: mistEnable
|
|
||||||
|
|
||||||
Return the state of the mist.
|
|
||||||
|
|
||||||
:type: bool
|
|
||||||
|
|
||||||
.. attribute:: mistStart
|
|
||||||
|
|
||||||
The mist start point.
|
|
||||||
|
|
||||||
:type: float
|
|
||||||
|
|
||||||
.. attribute:: mistDistance
|
|
||||||
|
|
||||||
The mist distance fom the start point to reach 100% mist.
|
|
||||||
|
|
||||||
:type: float
|
|
||||||
|
|
||||||
.. attribute:: mistIntensity
|
|
||||||
|
|
||||||
The mist intensity.
|
|
||||||
|
|
||||||
:type: float
|
|
||||||
|
|
||||||
.. attribute:: mistType
|
|
||||||
|
|
||||||
The type of mist - must be KX_MIST_QUADRATIC, KX_MIST_LINEAR or KX_MIST_INV_QUADRATIC
|
|
||||||
|
|
||||||
.. attribute:: mistColor
|
|
||||||
|
|
||||||
The color of the mist. Black = [0.0, 0.0, 0.0], White = [1.0, 1.0, 1.0].
|
|
||||||
Mist and background color sould always set to the same color.
|
|
||||||
|
|
||||||
:type: :class:`mathutils.Vector`
|
|
||||||
|
|
||||||
.. attribute:: backgroundColor
|
|
||||||
|
|
||||||
The color of the background. Black = [0.0, 0.0, 0.0], White = [1.0, 1.0, 1.0].
|
|
||||||
Mist and background color sould always set to the same color.
|
|
||||||
|
|
||||||
:type: :class:`mathutils.Vector`
|
|
||||||
|
|
||||||
.. attribute:: ambientColor
|
|
||||||
|
|
||||||
The color of the ambient light. Black = [0.0, 0.0, 0.0], White = [1.0, 1.0, 1.0].
|
|
||||||
|
|
||||||
:type: :class:`mathutils.Vector`
|
|
@@ -7,7 +7,7 @@ base class --- :class:`SCA_IActuator`
|
|||||||
|
|
||||||
.. class:: SCA_2DFilterActuator(SCA_IActuator)
|
.. class:: SCA_2DFilterActuator(SCA_IActuator)
|
||||||
|
|
||||||
Create, enable and disable 2D filters.
|
Create, enable and disable 2D filters
|
||||||
|
|
||||||
The following properties don't have an immediate effect.
|
The following properties don't have an immediate effect.
|
||||||
You must active the actuator to get the result.
|
You must active the actuator to get the result.
|
||||||
@@ -29,7 +29,7 @@ base class --- :class:`SCA_IActuator`
|
|||||||
|
|
||||||
.. attribute:: mode
|
.. attribute:: mode
|
||||||
|
|
||||||
Type of 2D filter, use one of :ref:`these constants <Two-D-FilterActuator-mode>`.
|
Type of 2D filter, use one of :ref:`these constants <Two-D-FilterActuator-mode>`
|
||||||
|
|
||||||
:type: integer
|
:type: integer
|
||||||
|
|
||||||
|
@@ -23,14 +23,8 @@ base class --- :class:`SCA_ILogicBrick`
|
|||||||
|
|
||||||
.. attribute:: frequency
|
.. attribute:: frequency
|
||||||
|
|
||||||
The frequency for pulse mode sensors. (Deprecated: use SCA_ISensor.skippedTicks)
|
The frequency for pulse mode sensors.
|
||||||
|
|
||||||
:type: integer
|
|
||||||
|
|
||||||
.. attribute:: skippedTicks
|
|
||||||
|
|
||||||
Number of logic ticks skipped between 2 active pulses
|
|
||||||
|
|
||||||
:type: integer
|
:type: integer
|
||||||
|
|
||||||
.. attribute:: level
|
.. attribute:: level
|
||||||
|
@@ -25,7 +25,7 @@ base class --- :class:`PyObjectPlus`
|
|||||||
|
|
||||||
The normalized x and y position of the mouse cursor.
|
The normalized x and y position of the mouse cursor.
|
||||||
|
|
||||||
:type: tuple (x, y)
|
:type: list [x, y]
|
||||||
|
|
||||||
.. attribute:: visible
|
.. attribute:: visible
|
||||||
|
|
||||||
|
@@ -8,17 +8,19 @@ This module wraps OpenGL constants and functions, making them available from
|
|||||||
within Blender Python.
|
within Blender Python.
|
||||||
|
|
||||||
The complete list can be retrieved from the module itself, by listing its
|
The complete list can be retrieved from the module itself, by listing its
|
||||||
contents: dir(bgl). A simple search on the web can point to more
|
contents: dir(bgl). A simple search on the net can point to more
|
||||||
than enough material to teach OpenGL programming, from books to many
|
than enough material to teach OpenGL programming, from books to many
|
||||||
collections of tutorials.
|
collections of tutorials.
|
||||||
|
|
||||||
Here is a comprehensive `list of books <http://www.opengl.org/documentation/books/>`_ (non free). The `arcsynthesis tutorials <http://www.arcsynthesis.org/gltut/>`_ is one of the best resources to learn modern OpenGL and `g-truc <http://www.g-truc.net/post-tech-content-sample.html>`_ offers a set of extensive examples, including advanced features.
|
The "red book": "I{OpenGL Programming Guide: The Official Guide to Learning
|
||||||
|
OpenGL}" and the online NeHe tutorials are two of the best resources.
|
||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
You can use the :class:`Image` type to load and set textures.
|
You can use the :class:`Image` type to load and set textures.
|
||||||
See :class:`Image.gl_load` and :class:`Image.gl_load`,
|
See :class:`Image.gl_load` and :class:`Image.gl_load`,
|
||||||
for example.
|
for example.
|
||||||
|
`OpenGL.org <http://www.opengl.org>`_
|
||||||
|
`NeHe GameDev <http://nehe.gamedev.net>`_
|
||||||
|
|
||||||
|
|
||||||
.. function:: glAccum(op, value):
|
.. function:: glAccum(op, value):
|
||||||
|
@@ -121,7 +121,7 @@ Here are some more complex examples:
|
|||||||
bpy.context.scene.render.layers["RenderLayer"].samples
|
bpy.context.scene.render.layers["RenderLayer"].samples
|
||||||
|
|
||||||
# access to the current weight paint brush size
|
# access to the current weight paint brush size
|
||||||
bpy.context.tool_settings.weight_paint.brush.size
|
bpy.context.tool_settings.weight_paint.brush.size
|
||||||
|
|
||||||
# check if the window is fullscreen
|
# check if the window is fullscreen
|
||||||
bpy.context.window.screen.show_fullscreen
|
bpy.context.window.screen.show_fullscreen
|
||||||
@@ -141,16 +141,15 @@ When starting out scripting you will often run into the problem where you're not
|
|||||||
|
|
||||||
There are a few ways to do this.
|
There are a few ways to do this.
|
||||||
|
|
||||||
- Use the Python console's auto-complete to inspect properties.
|
- Use the Python console's auto-complete to inspect properties. *This can be hit-and-miss but has the advantage
|
||||||
*This can be hit-and-miss but has the advantage
|
|
||||||
that you can easily see the values of properties and assign them to interactively see the results.*
|
that you can easily see the values of properties and assign them to interactively see the results.*
|
||||||
- Copy the Data-Path from the user interface.
|
|
||||||
*Explained further in :ref:`Copy Data Path <info_data_path_copy>`*
|
- Copy the Data-Path from the user interface. *Explained further in :ref:`Copy Data Path <info_data_path_copy>`*
|
||||||
- Using the documentation to follow references.
|
|
||||||
*Explained further in :ref:`Indirect Data Access <info_data_path_indirect>`*
|
- Using the documentation to follow references. *Explained further in :ref:`Indirect Data Access <info_data_path_indirect>`*
|
||||||
|
|
||||||
|
|
||||||
.. _info_data_path_copy:
|
.. _info_data_path_copy
|
||||||
|
|
||||||
Copy Data Path
|
Copy Data Path
|
||||||
--------------
|
--------------
|
||||||
@@ -173,8 +172,7 @@ you won't be doing collection look-ups on every access and typically you'll want
|
|||||||
then access each :class:`bpy.types.ID` instance by name.
|
then access each :class:`bpy.types.ID` instance by name.
|
||||||
|
|
||||||
|
|
||||||
Type in the ID path into a Python console :mod:`bpy.context.active_object`.
|
Type in the ID path into a Python console :mod:`bpy.context.active_object`. Include the trailing dot and don't hit "enter", yet.
|
||||||
Include the trailing dot and don't hit "enter", yet.
|
|
||||||
|
|
||||||
Now right-click on the button and select **Copy Data Path**, then paste the result into the console.
|
Now right-click on the button and select **Copy Data Path**, then paste the result into the console.
|
||||||
|
|
||||||
@@ -193,7 +191,7 @@ Hit "enter" and you'll get the current value of 1. Now try changing the value to
|
|||||||
You can see the value update in the Subdivision-Surface modifier's UI as well as the cube.
|
You can see the value update in the Subdivision-Surface modifier's UI as well as the cube.
|
||||||
|
|
||||||
|
|
||||||
.. _info_data_path_indirect:
|
.. _info_data_path_indirect
|
||||||
|
|
||||||
Indirect Data Access
|
Indirect Data Access
|
||||||
--------------------
|
--------------------
|
||||||
@@ -203,24 +201,32 @@ For this example we'll go over something more involved, showing the steps to acc
|
|||||||
Lets say we want to access the texture of a brush via Python, to adjust its ``contrast`` for example.
|
Lets say we want to access the texture of a brush via Python, to adjust its ``contrast`` for example.
|
||||||
|
|
||||||
- Start in the default scene and enable 'Sculpt' mode from the 3D-View header.
|
- Start in the default scene and enable 'Sculpt' mode from the 3D-View header.
|
||||||
|
|
||||||
- From the toolbar expand the **Texture** panel and add a new texture.
|
- From the toolbar expand the **Texture** panel and add a new texture.
|
||||||
|
|
||||||
*Notice the texture button its self doesn't have very useful links (you can check the tool-tips).*
|
*Notice the texture button its self doesn't have very useful links (you can check the tool-tips).*
|
||||||
|
|
||||||
- The contrast setting isn't exposed in the sculpt toolbar, so view the texture in the properties panel...
|
- The contrast setting isn't exposed in the sculpt toolbar, so view the texture in the properties panel...
|
||||||
|
|
||||||
- In the properties button select the Texture context.
|
- In the properties button select the Texture context.
|
||||||
|
|
||||||
- Select the Brush icon to show the brush texture.
|
- Select the Brush icon to show the brush texture.
|
||||||
- Expand the *Colors* panel to locate the *Contrast* button.
|
|
||||||
- Right click on the contrast button and select **Online Python Reference**
|
- Expand the **Colors** panel to locate the **Contrast** button.
|
||||||
This takes you to ``bpy.types.Texture.contrast``
|
|
||||||
- Now we can see that ``contrast`` is a property of texture,
|
- Right click on the contrast button and select **Online Python Reference** This takes you to ``bpy.types.Texture.contrast``
|
||||||
so next we'll check on how to access the texture from the brush.
|
|
||||||
|
- Now we can see that ``contrast`` is a property of texture, so next we'll check on how to access the texture from the brush.
|
||||||
|
|
||||||
- Check on the **References** at the bottom of the page, sometimes there are many references, and it may take
|
- Check on the **References** at the bottom of the page, sometimes there are many references, and it may take
|
||||||
some guess work to find the right one, but in this case its obviously ``Brush.texture``.
|
some guess work to find the right one, but in this case its obviously ``Brush.texture``.
|
||||||
|
|
||||||
*Now we know that the texture can be accessed from* ``bpy.data.brushes["BrushName"].texture``
|
*Now we know that the texture can be accessed from* ``bpy.data.brushes["BrushName"].texture``
|
||||||
*but normally you won't want to access the brush by name, so we'll see now to access the active brush instead.*
|
*but normally you won't want to access the brush by name, so we'll see now to access the active brush instead.*
|
||||||
|
|
||||||
- So the next step is to check on where brushes are accessed from via the **References**.
|
- So the next step is to check on where brushes are accessed from via the **References**.
|
||||||
In this case there is simply ``bpy.context.brush`` which is all we need.
|
In this case there is simply ``bpy.context.brush`` which is all we need.
|
||||||
|
|
||||||
|
|
||||||
Now you can use the Python console to form the nested properties needed to access brush textures contrast,
|
Now you can use the Python console to form the nested properties needed to access brush textures contrast,
|
||||||
logically we now know.
|
logically we now know.
|
||||||
@@ -276,8 +282,7 @@ are interested to check on the source code.
|
|||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
|
|
||||||
Not all operators can be called usefully from Python,
|
Not all operators can be called usefully from Python, for more on this see :ref:`using operators <using_operators>`.
|
||||||
for more on this see :ref:`using operators <using_operators>`.
|
|
||||||
|
|
||||||
|
|
||||||
Info View
|
Info View
|
||||||
@@ -289,8 +294,7 @@ This is located above the file-menu which can be dragged down to display its con
|
|||||||
Select the **Script** screen that comes default with Blender to see its output.
|
Select the **Script** screen that comes default with Blender to see its output.
|
||||||
You can perform some actions and see them show up - delete a vertex for example.
|
You can perform some actions and see them show up - delete a vertex for example.
|
||||||
|
|
||||||
Each entry can be selected (Right-Mouse-Button),
|
Each entry can be selected (Right-Mouse-Button), then copied :kbd:`Control-C`, usually to paste in the text editor or python console.
|
||||||
then copied :kbd:`Control-C`, usually to paste in the text editor or python console.
|
|
||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
|
|
||||||
|
@@ -1,20 +1,16 @@
|
|||||||
|
|
||||||
*************
|
*************
|
||||||
Best Practice
|
Best Practice
|
||||||
*************
|
*************
|
||||||
|
|
||||||
When writing your own scripts python is great for new developers to pick up and become productive,
|
When writing your own scripts python is great for new developers to pick up and become productive, but you can also pick up odd habits or at least write scripts that are not easy for others to understand.
|
||||||
but you can also pick up odd habits or at least write scripts that are not easy for others to understand.
|
|
||||||
|
|
||||||
For your own work this is of course fine,
|
For your own work this is of course fine, but if you want to collaborate with others or have your work included with blender there are practices we encourage.
|
||||||
but if you want to collaborate with others or have your work included with blender there are practices we encourage.
|
|
||||||
|
|
||||||
|
|
||||||
Style Conventions
|
Style Conventions
|
||||||
=================
|
=================
|
||||||
|
|
||||||
For Blender/Python development we have chosen to follow python suggested style guide to avoid mixing styles
|
For Blender/Python development we have chosen to follow python suggested style guide to avoid mixing styles amongst our own scripts and make it easier to use python scripts from other projects.
|
||||||
amongst our own scripts and make it easier to use python scripts from other projects.
|
|
||||||
|
|
||||||
Using our style guide for your own scripts makes it easier if you eventually want to contribute them to blender.
|
Using our style guide for your own scripts makes it easier if you eventually want to contribute them to blender.
|
||||||
|
|
||||||
@@ -22,17 +18,22 @@ This style guide is known as pep8 and can be found `here <http://www.python.org/
|
|||||||
|
|
||||||
A brief listing of pep8 criteria.
|
A brief listing of pep8 criteria.
|
||||||
|
|
||||||
- camel caps for class names: MyClass
|
* camel caps for class names: MyClass
|
||||||
- all lower case underscore separated module names: my_module
|
|
||||||
- indentation of 4 spaces (no tabs)
|
* all lower case underscore separated module names: my_module
|
||||||
- spaces around operators. ``1 + 1``, not ``1+1``
|
|
||||||
- only use explicit imports, (no importing ``*``)
|
* indentation of 4 spaces (no tabs)
|
||||||
- don't use single line: ``if val: body``, separate onto 2 lines instead.
|
|
||||||
|
* spaces around operators. ``1 + 1``, not ``1+1``
|
||||||
|
|
||||||
|
* only use explicit imports, (no importing '*')
|
||||||
|
|
||||||
|
* don't use single line: ``if val: body``, separate onto 2 lines instead.
|
||||||
|
|
||||||
|
|
||||||
As well as pep8 we have other conventions used for blender python scripts.
|
As well as pep8 we have other conventions used for blender python scripts.
|
||||||
|
|
||||||
- Use single quotes for enums, and double quotes for strings.
|
* Use single quotes for enums, and double quotes for strings.
|
||||||
|
|
||||||
Both are of course strings but in our internal API enums are unique items from a limited set. eg.
|
Both are of course strings but in our internal API enums are unique items from a limited set. eg.
|
||||||
|
|
||||||
@@ -41,11 +42,9 @@ As well as pep8 we have other conventions used for blender python scripts.
|
|||||||
bpy.context.scene.render.image_settings.file_format = 'PNG'
|
bpy.context.scene.render.image_settings.file_format = 'PNG'
|
||||||
bpy.context.scene.render.filepath = "//render_out"
|
bpy.context.scene.render.filepath = "//render_out"
|
||||||
|
|
||||||
- pep8 also defines that lines should not exceed 79 characters,
|
* pep8 also defines that lines should not exceed 79 characters, we felt this is too restrictive so this is optional per script.
|
||||||
we felt this is too restrictive so this is optional per script.
|
|
||||||
|
|
||||||
Periodically we run checks for pep8 compliance on blender scripts,
|
Periodically we run checks for pep8 compliance on blender scripts, for scripts to be included in this check add this line as a comment at the top of the script.
|
||||||
for scripts to be included in this check add this line as a comment at the top of the script.
|
|
||||||
|
|
||||||
``# <pep8 compliant>``
|
``# <pep8 compliant>``
|
||||||
|
|
||||||
@@ -59,75 +58,72 @@ User Interface Layout
|
|||||||
|
|
||||||
Some notes to keep in mind when writing UI layouts:
|
Some notes to keep in mind when writing UI layouts:
|
||||||
|
|
||||||
- UI code is quite simple. Layout declarations are there to easily create a decent layout.
|
* UI code is quite simple. Layout declarations are there to easily create a decent layout.
|
||||||
|
|
||||||
General rule here: If you need more code for the layout declaration,
|
|
||||||
then for the actual properties, you do it wrong.
|
|
||||||
|
|
||||||
|
General rule here: If you need more code for the layout declaration, then for the actual properties, you do it wrong.
|
||||||
|
|
||||||
Example layouts:
|
Example layouts:
|
||||||
|
|
||||||
- layout()
|
* layout()
|
||||||
|
|
||||||
The basic layout is a simple Top -> Bottom layout.
|
|
||||||
|
|
||||||
|
The basic layout is a simple Top -> Bottom layout.
|
||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
layout.prop()
|
layout.prop()
|
||||||
layout.prop()
|
layout.prop()
|
||||||
|
|
||||||
- layout.row()
|
* layout.row()
|
||||||
|
|
||||||
Use row(), when you want more than 1 property in one line.
|
|
||||||
|
|
||||||
|
Use row(), when you want more than 1 property in one line.
|
||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
|
row = layout.row()
|
||||||
|
row.prop()
|
||||||
|
row.prop()
|
||||||
|
|
||||||
row = layout.row()
|
* layout.column()
|
||||||
row.prop()
|
|
||||||
row.prop()
|
|
||||||
|
|
||||||
- layout.column()
|
|
||||||
|
|
||||||
Use column(), when you want your properties in a column.
|
Use column(), when you want your properties in a column.
|
||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
|
col = layout.column()
|
||||||
|
col.prop()
|
||||||
|
col.prop()
|
||||||
|
|
||||||
col = layout.column()
|
* layout.split()
|
||||||
col.prop()
|
|
||||||
col.prop()
|
|
||||||
|
|
||||||
- layout.split()
|
This can be used to create more complex layouts. For example you can split the layout and create two column() layouts next to each other.
|
||||||
|
|
||||||
This can be used to create more complex layouts.
|
|
||||||
For example you can split the layout and create two column() layouts next to each other.
|
|
||||||
Don't use split, when you simply want two properties in a row. Use row() for that.
|
Don't use split, when you simply want two properties in a row. Use row() for that.
|
||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
split = layout.split()
|
split = layout.split()
|
||||||
|
|
||||||
col = split.column()
|
col = split.column()
|
||||||
col.prop()
|
col.prop()
|
||||||
col.prop()
|
col.prop()
|
||||||
|
|
||||||
col = split.column()
|
col = split.column()
|
||||||
col.prop()
|
col.prop()
|
||||||
col.prop()
|
col.prop()
|
||||||
|
|
||||||
Declaration names:
|
Declaration names:
|
||||||
|
|
||||||
Try to only use these variable names for layout declarations:
|
Try to only use these variable names for layout declarations:
|
||||||
|
|
||||||
- row for a row() layout
|
* row for a row() layout
|
||||||
- col for a column() layout
|
* col for a column() layout
|
||||||
- split for a split() layout
|
* split for a split() layout
|
||||||
- flow for a column_flow() layout
|
* flow for a column_flow() layout
|
||||||
- sub for a sub layout (a column inside a column for example)
|
* sub for a sub layout (a column inside a column for example)
|
||||||
|
|
||||||
|
|
||||||
Script Efficiency
|
Script Efficiency
|
||||||
=================
|
=================
|
||||||
|
|
||||||
|
|
||||||
List Manipulation (General Python Tips)
|
List Manipulation (General Python Tips)
|
||||||
---------------------------------------
|
---------------------------------------
|
||||||
|
|
||||||
@@ -137,8 +133,7 @@ Searching for list items
|
|||||||
|
|
||||||
In Python there are some handy list functions that save you having to search through the list.
|
In Python there are some handy list functions that save you having to search through the list.
|
||||||
|
|
||||||
Even though you're not looping on the list data **python is**,
|
Even though you're not looping on the list data **python is**, so you need to be aware of functions that will slow down your script by searching the whole list.
|
||||||
so you need to be aware of functions that will slow down your script by searching the whole list.
|
|
||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
@@ -150,16 +145,11 @@ so you need to be aware of functions that will slow down your script by searchin
|
|||||||
|
|
||||||
Modifying Lists
|
Modifying Lists
|
||||||
^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^
|
||||||
In python we can add and remove from a list, this is slower when the list length is modified,
|
In python we can add and remove from a list, this is slower when the list length is modified, especially at the start of the list, since all the data after the index of modification needs to be moved up or down 1 place.
|
||||||
especially at the start of the list, since all the data after the index of
|
|
||||||
modification needs to be moved up or down 1 place.
|
|
||||||
|
|
||||||
The most simple way to add onto the end of the list is to use
|
The most simple way to add onto the end of the list is to use ``my_list.append(list_item)`` or ``my_list.extend(some_list)`` and the fastest way to remove an item is ``my_list.pop()`` or ``del my_list[-1]``.
|
||||||
``my_list.append(list_item)`` or ``my_list.extend(some_list)`` and the fastest way to
|
|
||||||
remove an item is ``my_list.pop()`` or ``del my_list[-1]``.
|
|
||||||
|
|
||||||
To use an index you can use ``my_list.insert(index, list_item)`` or ``list.pop(index)``
|
To use an index you can use ``my_list.insert(index, list_item)`` or ``list.pop(index)`` for list removal, but these are slower.
|
||||||
for list removal, but these are slower.
|
|
||||||
|
|
||||||
Sometimes its faster (but more memory hungry) to just rebuild the list.
|
Sometimes its faster (but more memory hungry) to just rebuild the list.
|
||||||
|
|
||||||
@@ -203,8 +193,7 @@ Use...
|
|||||||
my_list.extend([a, b, c...])
|
my_list.extend([a, b, c...])
|
||||||
|
|
||||||
|
|
||||||
Note that insert can be used when needed,
|
Note that insert can be used when needed, but it is slower than append especially when inserting at the start of a long list.
|
||||||
but it is slower than append especially when inserting at the start of a long list.
|
|
||||||
|
|
||||||
This example shows a very sub-optimal way of making a reversed list.
|
This example shows a very sub-optimal way of making a reversed list.
|
||||||
|
|
||||||
@@ -216,8 +205,7 @@ This example shows a very sub-optimal way of making a reversed list.
|
|||||||
reverse_list.insert(0, list_item)
|
reverse_list.insert(0, list_item)
|
||||||
|
|
||||||
|
|
||||||
Python provides more convenient ways to reverse a list using the slice method,
|
Python provides more convenient ways to reverse a list using the slice method, but you may want to time this before relying on it too much:
|
||||||
but you may want to time this before relying on it too much:
|
|
||||||
|
|
||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
@@ -232,8 +220,7 @@ Use ``my_list.pop(index)`` rather than ``my_list.remove(list_item)``
|
|||||||
|
|
||||||
This requires you to have the index of the list item but is faster since ``remove()`` will search the list.
|
This requires you to have the index of the list item but is faster since ``remove()`` will search the list.
|
||||||
|
|
||||||
Here is an example of how to remove items in 1 loop,
|
Here is an example of how to remove items in 1 loop, removing the last items first, which is faster (as explained above).
|
||||||
removing the last items first, which is faster (as explained above).
|
|
||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
@@ -245,9 +232,7 @@ removing the last items first, which is faster (as explained above).
|
|||||||
my_list.pop(list_index)
|
my_list.pop(list_index)
|
||||||
|
|
||||||
|
|
||||||
This example shows a fast way of removing items,
|
This example shows a fast way of removing items, for use in cases where you can alter the list order without breaking the scripts functionality. This works by swapping 2 list items, so the item you remove is always last.
|
||||||
for use in cases where you can alter the list order without breaking the scripts functionality.
|
|
||||||
This works by swapping 2 list items, so the item you remove is always last.
|
|
||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
@@ -266,9 +251,7 @@ When removing many items in a large list this can provide a good speedup.
|
|||||||
Avoid Copying Lists
|
Avoid Copying Lists
|
||||||
^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
When passing a list/dictionary to a function,
|
When passing a list/dictionary to a function, it is faster to have the function modify the list rather than returning a new list so python doesn't have to duplicate the list in memory.
|
||||||
it is faster to have the function modify the list rather than returning
|
|
||||||
a new list so python doesn't have to duplicate the list in memory.
|
|
||||||
|
|
||||||
Functions that modify a list in-place are more efficient than functions that create new lists.
|
Functions that modify a list in-place are more efficient than functions that create new lists.
|
||||||
|
|
||||||
@@ -313,26 +296,20 @@ Python’s string joining function. To join a list of strings
|
|||||||
>>> file.write(" ".join([str1, str2, str3, "\n"]))
|
>>> file.write(" ".join([str1, str2, str3, "\n"]))
|
||||||
|
|
||||||
|
|
||||||
join is fastest on many strings,
|
join is fastest on many strings, `string formatting <http://docs.python.org/py3k/library/string.html#string-formatting>`_ is quite fast too (better for converting data types). String arithmetic is slowest.
|
||||||
`string formatting <http://docs.python.org/py3k/library/string.html#string-formatting>`__
|
|
||||||
is quite fast too (better for converting data types). String arithmetic is slowest.
|
|
||||||
|
|
||||||
|
|
||||||
Parsing Strings (Import/Exporting)
|
Parsing Strings (Import/Exporting)
|
||||||
----------------------------------
|
----------------------------------
|
||||||
|
|
||||||
Since many file formats are ASCII,
|
Since many file formats are ASCII, the way you parse/export strings can make a large difference in how fast your script runs.
|
||||||
the way you parse/export strings can make a large difference in how fast your script runs.
|
|
||||||
|
|
||||||
There are a few ways to parse strings when importing them into Blender.
|
There are a few ways to parse strings when importing them into Blender.
|
||||||
|
|
||||||
|
|
||||||
Parsing Numbers
|
Parsing Numbers
|
||||||
^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
Use ``float(string)`` rather than ``eval(string)``, if you know the value will be an int then ``int(string)``,
|
Use ``float(string)`` rather than ``eval(string)``, if you know the value will be an int then ``int(string)``, float() will work for an int too but it's faster to read ints with int().
|
||||||
float() will work for an int too but it's faster to read ints with int().
|
|
||||||
|
|
||||||
|
|
||||||
Checking String Start/End
|
Checking String Start/End
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
@@ -345,8 +322,7 @@ Use...
|
|||||||
|
|
||||||
>>> if line.startswith("vert "):
|
>>> if line.startswith("vert "):
|
||||||
|
|
||||||
Using ``startswith()`` is slightly faster (approx 5%) and also avoids a possible
|
Using ``startswith()`` is slightly faster (approx 5%) and also avoids a possible error with the slice length not matching the string length.
|
||||||
error with the slice length not matching the string length.
|
|
||||||
|
|
||||||
my_string.endswith("foo_bar") can be used for line endings too.
|
my_string.endswith("foo_bar") can be used for line endings too.
|
||||||
|
|
||||||
@@ -360,19 +336,15 @@ Use try/except Sparingly
|
|||||||
|
|
||||||
The **try** statement is useful to save time writing error checking code.
|
The **try** statement is useful to save time writing error checking code.
|
||||||
|
|
||||||
However **try** is significantly slower than an **if** since an exception has to be set each time,
|
However **try** is significantly slower than an **if** since an exception has to be set each time, so avoid using **try** in areas of your code that execute in a loop and runs many times.
|
||||||
so avoid using **try** in areas of your code that execute in a loop and runs many times.
|
|
||||||
|
|
||||||
There are cases where using **try** is faster than checking whether the condition will raise an error,
|
There are cases where using **try** is faster than checking whether the condition will raise an error, so it is worth experimenting.
|
||||||
so it is worth experimenting.
|
|
||||||
|
|
||||||
|
|
||||||
Value Comparison
|
Value Comparison
|
||||||
----------------
|
----------------
|
||||||
|
|
||||||
Python has two ways to compare values ``a == b`` and ``a is b``,
|
Python has two ways to compare values ``a == b`` and ``a is b``, the difference is that ``==`` may run the objects comparison function ``__cmp__()`` whereas ``is`` compares identity, that both variables reference the same item in memory.
|
||||||
the difference is that ``==`` may run the objects comparison function ``__cmp__()`` whereas ``is`` compares identity,
|
|
||||||
that both variables reference the same item in memory.
|
|
||||||
|
|
||||||
In cases where you know you are checking for the same value which is referenced from multiple places, ``is`` is faster.
|
In cases where you know you are checking for the same value which is referenced from multiple places, ``is`` is faster.
|
||||||
|
|
||||||
@@ -390,4 +362,3 @@ While developing a script it's good to time it to be aware of any changes in per
|
|||||||
# do something...
|
# do something...
|
||||||
|
|
||||||
print("My Script Finished: %.4f sec" % time.time() - time_start)
|
print("My Script Finished: %.4f sec" % time.time() - time_start)
|
||||||
|
|
||||||
|
@@ -86,15 +86,9 @@ Consider the calculations that might go into working out the object's final tran
|
|||||||
To avoid expensive recalculations every time a property is modified, Blender defers making the actual calculations until they are needed.
|
To avoid expensive recalculations every time a property is modified, Blender defers making the actual calculations until they are needed.
|
||||||
|
|
||||||
However, while the script runs you may want to access the updated values.
|
However, while the script runs you may want to access the updated values.
|
||||||
In this case you need to call :class:`bpy.types.Scene.update` after modifying values, for example:
|
|
||||||
|
|
||||||
.. code-block:: python
|
This can be done by calling :class:`bpy.types.Scene.update` after modifying values which recalculates all data that is tagged to be updated.
|
||||||
|
|
||||||
bpy.context.object.location = 1, 2, 3
|
|
||||||
bpy.context.scene.update()
|
|
||||||
|
|
||||||
|
|
||||||
Now all dependent data (child objects, modifiers, drivers... etc) has been recalculated and is available to the script.
|
|
||||||
|
|
||||||
Can I redraw during the script?
|
Can I redraw during the script?
|
||||||
-------------------------------
|
-------------------------------
|
||||||
|
@@ -1,25 +1,18 @@
|
|||||||
|
|
||||||
.. _info_overview:
|
.. _info_overview:
|
||||||
|
|
||||||
*******************
|
*******************
|
||||||
Python API Overview
|
Python API Overview
|
||||||
*******************
|
*******************
|
||||||
|
|
||||||
This document is to give an understanding of how Python and Blender fit together,
|
This document is to give an understanding of how python and blender fit together, covering some of the functionality that isn't obvious from reading the API reference and example scripts.
|
||||||
covering some of the functionality that isn't obvious from reading the API reference and example scripts.
|
|
||||||
|
|
||||||
|
|
||||||
Python in Blender
|
Python in Blender
|
||||||
=================
|
=================
|
||||||
|
|
||||||
Blender embeds a Python interpreter which is started with Blender and stays active.
|
Blender embeds a python interpreter which is started with blender and stays active. This interpreter runs scripts to draw the user interface and is used for some of Blender's internal tools too.
|
||||||
This interpreter runs scripts to draw the user interface and is used for some of Blender's internal tools too.
|
|
||||||
|
|
||||||
This is a typical Python environment so tutorials on how to write Python scripts
|
This is a typical python environment so tutorials on how to write python scripts will work running the scripts in blender too. Blender provides the :mod:`bpy` module to the python interpreter. This module can be imported in a script and gives access to blender data, classes, and functions. Scripts that deal with blender data will need to import this module.
|
||||||
will work running the scripts in Blender too.
|
|
||||||
Blender provides the :mod:`bpy` module to the Python interpreter.
|
|
||||||
This module can be imported in a script and gives access to Blender data, classes, and functions.
|
|
||||||
Scripts that deal with Blender data will need to import this module.
|
|
||||||
|
|
||||||
Here is a simple example of moving a vertex of the object named **Cube**:
|
Here is a simple example of moving a vertex of the object named **Cube**:
|
||||||
|
|
||||||
@@ -28,96 +21,84 @@ Here is a simple example of moving a vertex of the object named **Cube**:
|
|||||||
import bpy
|
import bpy
|
||||||
bpy.data.objects["Cube"].data.vertices[0].co.x += 1.0
|
bpy.data.objects["Cube"].data.vertices[0].co.x += 1.0
|
||||||
|
|
||||||
This modifies Blender's internal data directly.
|
This modifies Blender's internal data directly. When you run this in the interactive console you will see the 3D viewport update.
|
||||||
When you run this in the interactive console you will see the 3D viewport update.
|
|
||||||
|
|
||||||
|
|
||||||
The Default Environment
|
The Default Environment
|
||||||
=======================
|
=======================
|
||||||
|
|
||||||
When developing your own scripts it may help to understand how Blender sets up its Python environment.
|
When developing your own scripts it may help to understand how blender sets up its python environment. Many python scripts come bundled with blender and can be used as a reference because they use the same API that script authors write tools in. Typical usage for scripts include: user interface, import/export, scene manipulation, automation, defining your own toolset and customization.
|
||||||
Many Python scripts come bundled with Blender and can be used as a reference
|
|
||||||
because they use the same API that script authors write tools in.
|
|
||||||
Typical usage for scripts include: user interface, import/export,
|
|
||||||
scene manipulation, automation, defining your own toolset and customization.
|
|
||||||
|
|
||||||
On startup Blender scans the ``scripts/startup/`` directory for Python modules and imports them.
|
On startup blender scans the ``scripts/startup/`` directory for python modules and imports them. The exact location of this directory depends on your installation. `See the directory layout docs <http://wiki.blender.org/index.php/Doc:2.6/Manual/Introduction/Installing_Blender/DirectoryLayout>`_
|
||||||
The exact location of this directory depends on your installation.
|
|
||||||
`See the directory layout docs
|
|
||||||
<https://www.blender.org/manual/getting_started/installing_blender/directorylayout.html>`__
|
|
||||||
|
|
||||||
|
|
||||||
Script Loading
|
Script Loading
|
||||||
==============
|
==============
|
||||||
|
|
||||||
This may seem obvious but it's important to note the difference
|
This may seem obvious but it's important to note the difference between executing a script directly or importing it as a module.
|
||||||
between executing a script directly or importing it as a module.
|
|
||||||
|
|
||||||
Scripts that extend Blender - define classes that exist beyond the scripts execution,
|
Scripts that extend blender - define classes that exist beyond the scripts execution, this makes future access to these classes (to unregister for example) more difficult than importing as a module where class instance is kept in the module and can be accessed by importing that module later on.
|
||||||
this makes future access to these classes (to unregister for example)
|
|
||||||
more difficult than importing as a module where class instance is kept
|
|
||||||
in the module and can be accessed by importing that module later on.
|
|
||||||
|
|
||||||
For this reason it's preferable to only use directly execute scripts that don't extend Blender by registering classes.
|
For this reason it's preferable to only use directly execute scripts that don't extend blender by registering classes.
|
||||||
|
|
||||||
|
|
||||||
Here are some ways to run scripts directly in Blender.
|
Here are some ways to run scripts directly in blender.
|
||||||
|
|
||||||
- Loaded in the text editor and press **Run Script**.
|
* Loaded in the text editor and press **Run Script**.
|
||||||
- Typed or pasted into the interactive console.
|
|
||||||
- Execute a Python file from the command line with Blender, eg:
|
|
||||||
|
|
||||||
.. code-block:: sh
|
* Typed or pasted into the interactive console.
|
||||||
|
|
||||||
blender --python /home/me/my_script.py
|
* Execute a python file from the command line with blender, eg:
|
||||||
|
|
||||||
|
``blender --python /home/me/my_script.py``
|
||||||
|
|
||||||
|
|
||||||
To run as modules:
|
To run as modules:
|
||||||
|
|
||||||
- The obvious way, ``import some_module`` command from the text window or interactive console.
|
* The obvious way, ``import some_module`` command from the text window or interactive console.
|
||||||
- Open as a text block and tick "Register" option, this will load with the blend file.
|
|
||||||
- copy into one of the directories ``scripts/startup``, where they will be automatically imported on startup.
|
* Open as a text block and tick "Register" option, this will load with the blend file.
|
||||||
- define as an addon, enabling the addon will load it as a Python module.
|
|
||||||
|
* copy into one of the directories ``scripts/startup``, where they will be automatically imported on startup.
|
||||||
|
|
||||||
|
* define as an addon, enabling the addon will load it as a python module.
|
||||||
|
|
||||||
|
|
||||||
Addons
|
Addons
|
||||||
------
|
------
|
||||||
|
|
||||||
Some of Blenders functionality is best kept optional,
|
Some of blenders functionality is best kept optional, alongside scripts loaded at startup we have addons which are kept in their own directory ``scripts/addons``, and only load on startup if selected from the user preferences.
|
||||||
alongside scripts loaded at startup we have addons which are kept in their own directory ``scripts/addons``,
|
|
||||||
and only load on startup if selected from the user preferences.
|
|
||||||
|
|
||||||
The only difference between addons and built-in Python modules is that addons must contain a ``bl_info``
|
The only difference between addons and built-in python modules is that addons must contain a **bl_info** variable which blender uses to read metadata such as name, author, category and URL.
|
||||||
variable which Blender uses to read metadata such as name, author, category and URL.
|
|
||||||
|
|
||||||
The user preferences addon listing uses **bl_info** to display information about each addon.
|
The user preferences addon listing uses **bl_info** to display information about each addon.
|
||||||
|
|
||||||
`See Addons <http://wiki.blender.org/index.php/Dev:2.5/Py/Scripts/Guidelines/Addons>`__
|
`See Addons <http://wiki.blender.org/index.php/Dev:2.5/Py/Scripts/Guidelines/Addons>`_ for details on the **bl_info** dictionary.
|
||||||
for details on the ``bl_info`` dictionary.
|
|
||||||
|
|
||||||
|
|
||||||
Integration through Classes
|
Integration through Classes
|
||||||
===========================
|
===========================
|
||||||
|
|
||||||
Running Python scripts in the text editor is useful for testing but you'll
|
Running python scripts in the text editor is useful for testing but you’ll want to extend blender to make tools accessible like other built-in functionality.
|
||||||
want to extend Blender to make tools accessible like other built-in functionality.
|
|
||||||
|
|
||||||
The Blender Python api allows integration for:
|
The blender python api allows integration for:
|
||||||
|
|
||||||
- :class:`bpy.types.Panel`
|
* :class:`bpy.types.Panel`
|
||||||
- :class:`bpy.types.Menu`
|
|
||||||
- :class:`bpy.types.Operator`
|
* :class:`bpy.types.Menu`
|
||||||
- :class:`bpy.types.PropertyGroup`
|
|
||||||
- :class:`bpy.types.KeyingSet`
|
* :class:`bpy.types.Operator`
|
||||||
- :class:`bpy.types.RenderEngine`
|
|
||||||
|
* :class:`bpy.types.PropertyGroup`
|
||||||
|
|
||||||
|
* :class:`bpy.types.KeyingSet`
|
||||||
|
|
||||||
|
* :class:`bpy.types.RenderEngine`
|
||||||
|
|
||||||
|
|
||||||
This is intentionally limited. Currently, for more advanced features such as mesh modifiers,
|
This is intentionally limited. Currently, for more advanced features such as mesh modifiers, object types, or shader nodes, C/C++ must be used.
|
||||||
object types, or shader nodes, C/C++ must be used.
|
|
||||||
|
|
||||||
For Python integration Blender defines methods which are common to all types.
|
For python intergration Blender defines methods which are common to all types. This works by creating a python subclass of a Blender class which contains variables and functions specified by the parent class which are pre-defined to interface with Blender.
|
||||||
This works by creating a Python subclass of a Blender class which contains variables and functions
|
|
||||||
specified by the parent class which are pre-defined to interface with Blender.
|
|
||||||
|
|
||||||
For example:
|
For example:
|
||||||
|
|
||||||
@@ -134,20 +115,15 @@ For example:
|
|||||||
|
|
||||||
bpy.utils.register_class(SimpleOperator)
|
bpy.utils.register_class(SimpleOperator)
|
||||||
|
|
||||||
First note that we subclass a member of :mod:`bpy.types`,
|
First note that we subclass a member of :mod:`bpy.types`, this is common for all classes which can be integrated with blender and used so we know if this is an Operator and not a Panel when registering.
|
||||||
this is common for all classes which can be integrated with Blender and
|
|
||||||
used so we know if this is an Operator and not a Panel when registering.
|
|
||||||
|
|
||||||
Both class properties start with a ``bl_`` prefix.
|
Both class properties start with a **bl_** prefix. This is a convention used to distinguish blender properties from those you add yourself.
|
||||||
This is a convention used to distinguish Blender properties from those you add yourself.
|
|
||||||
|
|
||||||
Next see the execute function, which takes an instance of the operator and the current context.
|
Next see the execute function, which takes an instance of the operator and the current context. A common prefix is not used for functions.
|
||||||
A common prefix is not used for functions.
|
|
||||||
|
|
||||||
Lastly the register function is called, this takes the class and loads it into Blender. See `Class Registration`_.
|
Lastly the register function is called, this takes the class and loads it into blender. See `Class Registration`_.
|
||||||
|
|
||||||
Regarding inheritance, Blender doesn't impose restrictions on the kinds of class inheritance used,
|
Regarding inheritance, blender doesn't impose restrictions on the kinds of class inheritance used, the registration checks will use attributes and functions defined in parent classes.
|
||||||
the registration checks will use attributes and functions defined in parent classes.
|
|
||||||
|
|
||||||
class mix-in example:
|
class mix-in example:
|
||||||
|
|
||||||
@@ -165,20 +141,11 @@ class mix-in example:
|
|||||||
|
|
||||||
bpy.utils.register_class(SimpleOperator)
|
bpy.utils.register_class(SimpleOperator)
|
||||||
|
|
||||||
Notice these classes don't define an ``__init__(self)`` function.
|
Notice these classes don't define an ``__init__(self)`` function. While ``__init__()`` and ``__del__()`` will be called if defined, the class instances lifetime only spans the execution. So a panel for example will have a new instance for every redraw, for this reason there is rarely a cause to store variables in the panel instance. Instead, persistent variables should be stored in Blenders data so that the state can be restored when blender is restarted.
|
||||||
While ``__init__()`` and ``__del__()`` will be called if defined,
|
|
||||||
the class instances lifetime only spans the execution.
|
|
||||||
So a panel for example will have a new instance for every redraw,
|
|
||||||
for this reason there is rarely a cause to store variables in the panel instance.
|
|
||||||
Instead, persistent variables should be stored in Blenders
|
|
||||||
ata so that the state can be restored when Blender is restarted.
|
|
||||||
|
|
||||||
.. note::
|
.. note:: Modal operators are an exception, keeping their instance variable as blender runs, see modal operator template.
|
||||||
|
|
||||||
Modal operators are an exception, keeping their instance variable as Blender runs, see modal operator template.
|
So once the class is registered with blender, instancing the class and calling the functions is left up to blender. In fact you cannot instance these classes from the script as you would expect with most python API's.
|
||||||
|
|
||||||
So once the class is registered with Blender, instancing the class and calling the functions is left up to Blender.
|
|
||||||
In fact you cannot instance these classes from the script as you would expect with most Python API's.
|
|
||||||
|
|
||||||
To run operators you can call them through the operator api, eg:
|
To run operators you can call them through the operator api, eg:
|
||||||
|
|
||||||
@@ -187,8 +154,7 @@ To run operators you can call them through the operator api, eg:
|
|||||||
import bpy
|
import bpy
|
||||||
bpy.ops.object.simple_operator()
|
bpy.ops.object.simple_operator()
|
||||||
|
|
||||||
User interface classes are given a context in which to draw, buttons window, file header, toolbar etc,
|
User interface classes are given a context in which to draw, buttons window, file header, toolbar etc, then they are drawn when that area is displayed so they are never called by python scripts directly.
|
||||||
then they are drawn when that area is displayed so they are never called by Python scripts directly.
|
|
||||||
|
|
||||||
|
|
||||||
Registration
|
Registration
|
||||||
@@ -198,10 +164,9 @@ Registration
|
|||||||
Module Registration
|
Module Registration
|
||||||
-------------------
|
-------------------
|
||||||
|
|
||||||
Blender modules loaded at startup require ``register()`` and ``unregister()`` functions.
|
Blender modules loaded at startup require ``register()`` and ``unregister()`` functions. These are the *only* functions that blender calls from your code, which is otherwise a regular python module.
|
||||||
These are the *only* functions that Blender calls from your code, which is otherwise a regular Python module.
|
|
||||||
|
|
||||||
A simple Blender/Python module can look like this:
|
A simple blender/python module can look like this:
|
||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
@@ -219,16 +184,12 @@ A simple Blender/Python module can look like this:
|
|||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
register()
|
register()
|
||||||
|
|
||||||
These functions usually appear at the bottom of the script containing class registration sometimes adding menu items.
|
These functions usually appear at the bottom of the script containing class registration sometimes adding menu items. You can also use them for internal purposes setting up data for your own tools but take care since register won't re-run when a new blend file is loaded.
|
||||||
You can also use them for internal purposes setting up data for your own tools but take care
|
|
||||||
since register won't re-run when a new blend file is loaded.
|
|
||||||
|
|
||||||
The register/unregister calls are used so it's possible to toggle addons and reload scripts while Blender runs.
|
The register/unregister calls are used so it's possible to toggle addons and reload scripts while blender runs.
|
||||||
If the register calls were placed in the body of the script, registration would be called on import,
|
If the register calls were placed in the body of the script, registration would be called on import, meaning there would be no distinction between importing a module or loading its classes into blender.
|
||||||
meaning there would be no distinction between importing a module or loading its classes into Blender.
|
|
||||||
|
|
||||||
This becomes problematic when a script imports classes from another module
|
This becomes problematic when a script imports classes from another module making it difficult to manage which classes are being loaded and when.
|
||||||
making it difficult to manage which classes are being loaded and when.
|
|
||||||
|
|
||||||
The last 2 lines are only for testing:
|
The last 2 lines are only for testing:
|
||||||
|
|
||||||
@@ -238,24 +199,19 @@ The last 2 lines are only for testing:
|
|||||||
register()
|
register()
|
||||||
|
|
||||||
This allows the script to be run directly in the text editor to test changes.
|
This allows the script to be run directly in the text editor to test changes.
|
||||||
This ``register()`` call won't run when the script is imported as a module
|
This ``register()`` call won't run when the script is imported as a module since ``__main__`` is reserved for direct execution.
|
||||||
since ``__main__`` is reserved for direct execution.
|
|
||||||
|
|
||||||
|
|
||||||
Class Registration
|
Class Registration
|
||||||
------------------
|
------------------
|
||||||
|
|
||||||
Registering a class with Blender results in the class definition being loaded into Blender,
|
Registering a class with blender results in the class definition being loaded into blender, where it becomes available alongside existing functionality.
|
||||||
where it becomes available alongside existing functionality.
|
|
||||||
|
|
||||||
Once this class is loaded you can access it from :mod:`bpy.types`,
|
Once this class is loaded you can access it from :mod:`bpy.types`, using the bl_idname rather than the classes original name.
|
||||||
using the bl_idname rather than the classes original name.
|
|
||||||
|
|
||||||
When loading a class, Blender performs sanity checks making sure all required properties and functions are found,
|
When loading a class, blender performs sanity checks making sure all required properties and functions are found, that properties have the correct type, and that functions have the right number of arguments.
|
||||||
that properties have the correct type, and that functions have the right number of arguments.
|
|
||||||
|
|
||||||
Mostly you will not need concern yourself with this but if there is a problem
|
Mostly you will not need concern yourself with this but if there is a problem with the class definition it will be raised on registering:
|
||||||
with the class definition it will be raised on registering:
|
|
||||||
|
|
||||||
Using the function arguments ``def execute(self, context, spam)``, will raise an exception:
|
Using the function arguments ``def execute(self, context, spam)``, will raise an exception:
|
||||||
|
|
||||||
@@ -269,13 +225,9 @@ Using ``bl_idname = 1`` will raise.
|
|||||||
Multiple-Classes
|
Multiple-Classes
|
||||||
^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
Loading classes into Blender is described above,
|
Loading classes into blender is described above, for simple cases calling :mod:`bpy.utils.register_class` (SomeClass) is sufficient, but when there are many classes or a packages submodule has its own classes it can be tedious to list them all for registration.
|
||||||
for simple cases calling :mod:`bpy.utils.register_class` (SomeClass) is sufficient,
|
|
||||||
but when there are many classes or a packages submodule has its own
|
|
||||||
classes it can be tedious to list them all for registration.
|
|
||||||
|
|
||||||
For more convenient loading/unloading :mod:`bpy.utils.register_module` (module)
|
For more convenient loading/unloading :mod:`bpy.utils.register_module` (module) and :mod:`bpy.utils.unregister_module` (module) functions exist.
|
||||||
and :mod:`bpy.utils.unregister_module` (module) functions exist.
|
|
||||||
|
|
||||||
A script which defines many of its own operators, panels menus etc. you only need to write:
|
A script which defines many of its own operators, panels menus etc. you only need to write:
|
||||||
|
|
||||||
@@ -287,19 +239,13 @@ A script which defines many of its own operators, panels menus etc. you only nee
|
|||||||
def unregister():
|
def unregister():
|
||||||
bpy.utils.unregister_module(__name__)
|
bpy.utils.unregister_module(__name__)
|
||||||
|
|
||||||
Internally Blender collects subclasses on registrable types, storing them by the module in which they are defined.
|
Internally blender collects subclasses on registrable types, storing them by the module in which they are defined. By passing the module name to :mod:`bpy.utils.register_module` blender can register all classes created by this module and its submodules.
|
||||||
By passing the module name to :mod:`bpy.utils.register_module`
|
|
||||||
Blender can register all classes created by this module and its submodules.
|
|
||||||
|
|
||||||
|
|
||||||
Inter Classes Dependencies
|
Inter Classes Dependencies
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
When customizing Blender you may want to group your own settings together,
|
When customizing blender you may want to group your own settings together, after all, they will likely have to co-exist with other scripts. To group these properties classes need to be defined, for groups within groups or collections within groups you can find yourself having to deal with order of registration/unregistration.
|
||||||
after all, they will likely have to co-exist with other scripts.
|
|
||||||
To group these properties classes need to be defined,
|
|
||||||
for groups within groups or collections within groups
|
|
||||||
you can find yourself having to deal with order of registration/unregistration.
|
|
||||||
|
|
||||||
Custom properties groups are themselves classes which need to be registered.
|
Custom properties groups are themselves classes which need to be registered.
|
||||||
|
|
||||||
@@ -365,9 +311,7 @@ Say you want to store material settings for a custom engine.
|
|||||||
Manipulating Classes
|
Manipulating Classes
|
||||||
^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
Properties can be added and removed as Blender runs,
|
Properties can be added and removed as blender runs, normally happens on register or unregister but for some special cases it may be useful to modify types as the script runs.
|
||||||
normally happens on register or unregister but for some
|
|
||||||
special cases it may be useful to modify types as the script runs.
|
|
||||||
|
|
||||||
For example:
|
For example:
|
||||||
|
|
||||||
@@ -397,8 +341,7 @@ This works just as well for PropertyGroup subclasses you define yourself.
|
|||||||
Dynamic Defined-Classes (Advanced)
|
Dynamic Defined-Classes (Advanced)
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
In some cases the specifier for data may not be in Blender,
|
In some cases the specifier for data may not be in blender, renderman shader definitions for example and it may be useful to define types and remove them on the fly.
|
||||||
renderman shader definitions for example and it may be useful to define types and remove them on the fly.
|
|
||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
@@ -417,8 +360,7 @@ renderman shader definitions for example and it may be useful to define types an
|
|||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
|
|
||||||
``type()`` is called to define the class.
|
Notice ``type()`` is called to define the class. This is an alternative syntax for class creation in python, better suited to constructing classes dynamically.
|
||||||
This is an alternative syntax for class creation in Python, better suited to constructing classes dynamically.
|
|
||||||
|
|
||||||
|
|
||||||
Calling these operators:
|
Calling these operators:
|
||||||
|
@@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
.. _info_quickstart:
|
.. _info_quickstart:
|
||||||
|
|
||||||
***********************
|
***********************
|
||||||
@@ -12,61 +11,67 @@ This API is generally stable but some areas are still being added and improved.
|
|||||||
|
|
||||||
The Blender/Python API can do the following:
|
The Blender/Python API can do the following:
|
||||||
|
|
||||||
- Edit any data the user interface can (Scenes, Meshes, Particles etc.)
|
* Edit any data the user interface can (Scenes, Meshes, Particles etc.)
|
||||||
- Modify user preferences, keymaps and themes
|
|
||||||
- Run tools with own settings
|
* Modify user preferences, keymaps and themes
|
||||||
- Create user interface elements such as menus, headers and panels
|
|
||||||
- Create new tools
|
* Run tools with own settings
|
||||||
- Create interactive tools
|
|
||||||
- Create new rendering engines that integrate with Blender
|
* Create user interface elements such as menus, headers and panels
|
||||||
- Define new settings in existing Blender data
|
|
||||||
- Draw in the 3D view using OpenGL commands from Python
|
* Create new tools
|
||||||
|
|
||||||
|
* Create interactive tools
|
||||||
|
|
||||||
|
* Create new rendering engines that integrate with Blender
|
||||||
|
|
||||||
|
* Define new settings in existing Blender data
|
||||||
|
|
||||||
|
* Draw in the 3D view using OpenGL commands from Python
|
||||||
|
|
||||||
|
|
||||||
The Blender/Python API **can't** (yet)...
|
The Blender/Python API **can't** (yet)...
|
||||||
|
|
||||||
- Create new space types.
|
* Create new space types.
|
||||||
- Assign custom properties to every type.
|
|
||||||
- Define callbacks or listeners to be notified when data is changed.
|
* Assign custom properties to every type.
|
||||||
|
|
||||||
|
* Define callbacks or listeners to be notified when data is changed.
|
||||||
|
|
||||||
|
|
||||||
Before Starting
|
Before Starting
|
||||||
===============
|
===============
|
||||||
|
|
||||||
This document isn't intended to fully cover each topic.
|
This document isn't intended to fully cover each topic. Rather, its purpose is to familiarize you with Blender Python API.
|
||||||
Rather, its purpose is to familiarize you with Blender Python API.
|
|
||||||
|
|
||||||
|
|
||||||
A quick list of helpful things to know before starting:
|
A quick list of helpful things to know before starting:
|
||||||
|
|
||||||
- Blender uses Python 3.x; some online documentation still assumes 2.x.
|
* Blender uses Python 3.x; some 3rd party extensions are not available yet.
|
||||||
- The interactive console is great for testing one-liners.
|
|
||||||
It also has autocompletion so you can inspect the API quickly.
|
|
||||||
- Button tool tips show Python attributes and operator names.
|
|
||||||
- Right clicking on buttons and menu items directly links to API documentation.
|
|
||||||
- For more examples, the text menu has a templates section where some example operators can be found.
|
|
||||||
- To examine further scripts distributed with Blender, see:
|
|
||||||
|
|
||||||
| ``~/.blender/scripts/startup/bl_ui`` for the user interface,
|
* The interactive console is great for testing one-liners, It also has autocompletion so you can inspect the api quickly.
|
||||||
| ``~/.blender/scripts/startup/bl_op`` for operators.
|
|
||||||
|
* Button tool tips show Python attributes and operator names.
|
||||||
|
|
||||||
|
* Right clicking on buttons and menu items directly links to API documentation.
|
||||||
|
|
||||||
|
* For more examples, the text menu has a templates section where some example operators can be found.
|
||||||
|
|
||||||
|
* To examine further scripts distributed with Blender, see ``~/.blender/scripts/startup/bl_ui`` for the user interface and ``~/.blender/scripts/startup/bl_op`` for operators.
|
||||||
|
|
||||||
|
|
||||||
Running Scripts
|
Running Scripts
|
||||||
---------------
|
---------------
|
||||||
|
|
||||||
The two most common ways to execute Python scripts are using the built-in
|
The two most common ways to execute python scripts are using the built-in text editor or entering commands in the python console.
|
||||||
text editor or entering commands in the Python console.
|
|
||||||
|
|
||||||
Both the *Text Editor* and *Python Console* are space types you can select from the view header.
|
Both the **Text Editor** and **Python Console** are space types you can select from the view header.
|
||||||
|
|
||||||
Rather then manually configuring your spaces for Python development,
|
Rather then manually configuring your spaces for Python development, you may prefer to use the **Scripting** screen, included default with Blender, accessible from the top headers screen selector.
|
||||||
you may prefer to use the *Scripting* screen, included default with Blender,
|
|
||||||
accessible from the top headers screen selector.
|
|
||||||
|
|
||||||
From the text editor you can open ``.py`` files or paste then from the clipboard, then test using *Run Script*.
|
From the text editor you can open ``.py`` files or paste then from the clipboard, then test using **Run Script**.
|
||||||
|
|
||||||
The Python Console is typically used for typing in snippets and for testing to get immediate feedback,
|
The Python Console is typically used for typing in snippets and for testing to get immediate feedback, but can also have entire scripts pasted into it.
|
||||||
but can also have entire scripts pasted into it.
|
|
||||||
|
|
||||||
Scripts can also run from the command line with Blender but to learn Blender/Python this isn't essential.
|
Scripts can also run from the command line with Blender but to learn Blender/Python this isn't essential.
|
||||||
|
|
||||||
@@ -77,14 +82,12 @@ Key Concepts
|
|||||||
Data Access
|
Data Access
|
||||||
-----------
|
-----------
|
||||||
|
|
||||||
Accessing DataBlocks
|
Accessing datablocks
|
||||||
^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
Python accesses Blender's data in the same way as the animation system and user interface;
|
Python accesses Blender's data in the same way as the animation system and user interface; this implies that any setting that can be changed via a button can also be changed from Python.
|
||||||
this implies that any setting that can be changed via a button can also be changed from Python.
|
|
||||||
|
|
||||||
Accessing data from the currently loaded blend file is done with the module :mod:`bpy.data`.
|
Accessing data from the currently loaded blend file is done with the module :mod:`bpy.data`. This gives access to library data. For example:
|
||||||
This gives access to library data. For example:
|
|
||||||
|
|
||||||
>>> bpy.data.objects
|
>>> bpy.data.objects
|
||||||
<bpy_collection[3], BlendDataObjects>
|
<bpy_collection[3], BlendDataObjects>
|
||||||
@@ -101,8 +104,7 @@ About Collections
|
|||||||
|
|
||||||
You'll notice that an index as well as a string can be used to access members of the collection.
|
You'll notice that an index as well as a string can be used to access members of the collection.
|
||||||
|
|
||||||
Unlike Python's dictionaries, both methods are acceptable;
|
Unlike Python's dictionaries, both methods are acceptable; however, the index of a member may change while running Blender.
|
||||||
however, the index of a member may change while running Blender.
|
|
||||||
|
|
||||||
>>> list(bpy.data.objects)
|
>>> list(bpy.data.objects)
|
||||||
[bpy.data.objects["Cube"], bpy.data.objects["Plane"]]
|
[bpy.data.objects["Cube"], bpy.data.objects["Plane"]]
|
||||||
@@ -114,13 +116,10 @@ however, the index of a member may change while running Blender.
|
|||||||
bpy.data.objects["Cube"]
|
bpy.data.objects["Cube"]
|
||||||
|
|
||||||
|
|
||||||
Accessing Attributes
|
Accessing attributes
|
||||||
^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
Once you have a data block, such as a material, object, groups etc.,
|
Once you have a data block, such as a material, object, groups etc., its attributes can be accessed much like you would change a setting using the graphical interface. In fact, the tooltip for each button also displays the Python attribute which can help in finding what settings to change in a script.
|
||||||
its attributes can be accessed much like you would change a setting using the graphical interface.
|
|
||||||
In fact, the tooltip for each button also displays the Python attribute
|
|
||||||
which can help in finding what settings to change in a script.
|
|
||||||
|
|
||||||
>>> bpy.data.objects[0].name
|
>>> bpy.data.objects[0].name
|
||||||
'Camera'
|
'Camera'
|
||||||
@@ -132,8 +131,7 @@ which can help in finding what settings to change in a script.
|
|||||||
bpy.data.materials['MyMaterial']
|
bpy.data.materials['MyMaterial']
|
||||||
|
|
||||||
|
|
||||||
For testing what data to access it's useful to use the "Console", which is its own space type.
|
For testing what data to access it's useful to use the "Console", which is its own space type. This supports auto-complete, giving you a fast way to dig into different data in your file.
|
||||||
This supports auto-complete, giving you a fast way to dig into different data in your file.
|
|
||||||
|
|
||||||
Example of a data path that can be quickly found via the console:
|
Example of a data path that can be quickly found via the console:
|
||||||
|
|
||||||
@@ -146,8 +144,7 @@ Example of a data path that can be quickly found via the console:
|
|||||||
Data Creation/Removal
|
Data Creation/Removal
|
||||||
^^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
Those of you familiar with other Python API's may be surprised that
|
Those of you familiar with other python api's may be surprised that new datablocks in the bpy api can't be created by calling the class:
|
||||||
new datablocks in the bpy API can't be created by calling the class:
|
|
||||||
|
|
||||||
>>> bpy.types.Mesh()
|
>>> bpy.types.Mesh()
|
||||||
Traceback (most recent call last):
|
Traceback (most recent call last):
|
||||||
@@ -156,10 +153,9 @@ new datablocks in the bpy API can't be created by calling the class:
|
|||||||
|
|
||||||
|
|
||||||
This is an intentional part of the API design.
|
This is an intentional part of the API design.
|
||||||
The Blender/Python API can't create Blender data that exists outside the main Blender database
|
The blender/python api can't create blender data that exists outside the main blender database (accessed through bpy.data), because this data is managed by blender (save/load/undo/append... etc).
|
||||||
(accessed through :mod:`bpy.data`), because this data is managed by Blender (save/load/undo/append... etc).
|
|
||||||
|
|
||||||
Data is added and removed via methods on the collections in :mod:`bpy.data`, eg:
|
Data is added and removed via methods on the collections in bpy.data, eg:
|
||||||
|
|
||||||
>>> mesh = bpy.data.meshes.new(name="MyMesh")
|
>>> mesh = bpy.data.meshes.new(name="MyMesh")
|
||||||
>>> print(mesh)
|
>>> print(mesh)
|
||||||
@@ -171,10 +167,7 @@ Data is added and removed via methods on the collections in :mod:`bpy.data`, eg:
|
|||||||
Custom Properties
|
Custom Properties
|
||||||
^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
Python can access properties on any datablock that has an ID
|
Python can access properties on any datablock that has an ID (data that can be linked in and accessed from :mod:`bpy.data`. When assigning a property, you can make up your own names, these will be created when needed or overwritten if they exist.
|
||||||
(data that can be linked in and accessed from :mod:`bpy.data`.
|
|
||||||
When assigning a property, you can make up your own names,
|
|
||||||
these will be created when needed or overwritten if they exist.
|
|
||||||
|
|
||||||
This data is saved with the blend file and copied with objects.
|
This data is saved with the blend file and copied with objects.
|
||||||
|
|
||||||
@@ -187,7 +180,7 @@ Example:
|
|||||||
if "SomeProp" in bpy.context.object:
|
if "SomeProp" in bpy.context.object:
|
||||||
print("Property found")
|
print("Property found")
|
||||||
|
|
||||||
# Use the get function like a Python dictionary
|
# Use the get function like a python dictionary
|
||||||
# which can have a fallback value.
|
# which can have a fallback value.
|
||||||
value = bpy.data.scenes["Scene"].get("test_prop", "fallback value")
|
value = bpy.data.scenes["Scene"].get("test_prop", "fallback value")
|
||||||
|
|
||||||
@@ -200,9 +193,11 @@ Example:
|
|||||||
|
|
||||||
Note that these properties can only be assigned basic Python types.
|
Note that these properties can only be assigned basic Python types.
|
||||||
|
|
||||||
- int, float, string
|
* int, float, string
|
||||||
- array of ints/floats
|
|
||||||
- dictionary (only string keys are supported, values must be basic types too)
|
* array of ints/floats
|
||||||
|
|
||||||
|
* dictionary (only string keys are supported, values must be basic types too)
|
||||||
|
|
||||||
These properties are valid outside of Python. They can be animated by curves or used in driver paths.
|
These properties are valid outside of Python. They can be animated by curves or used in driver paths.
|
||||||
|
|
||||||
@@ -210,10 +205,7 @@ These properties are valid outside of Python. They can be animated by curves or
|
|||||||
Context
|
Context
|
||||||
-------
|
-------
|
||||||
|
|
||||||
While it's useful to be able to access data directly by name or as a list,
|
While it's useful to be able to access data directly by name or as a list, it's more common to operate on the user's selection. The context is always available from '''bpy.context''' and can be used to get the active object, scene, tool settings along with many other attributes.
|
||||||
it's more common to operate on the user's selection.
|
|
||||||
The context is always available from ``bpy.context`` and can be used to get the active object, scene,
|
|
||||||
tool settings along with many other attributes.
|
|
||||||
|
|
||||||
Common-use cases:
|
Common-use cases:
|
||||||
|
|
||||||
@@ -221,28 +213,22 @@ Common-use cases:
|
|||||||
>>> bpy.context.selected_objects
|
>>> bpy.context.selected_objects
|
||||||
>>> bpy.context.visible_bones
|
>>> bpy.context.visible_bones
|
||||||
|
|
||||||
Note that the context is read-only.
|
Note that the context is read-only. These values cannot be modified directly, though they may be changed by running API functions or by using the data API.
|
||||||
These values cannot be modified directly,
|
|
||||||
though they may be changed by running API functions or by using the data API.
|
|
||||||
|
|
||||||
So ``bpy.context.object = obj`` will raise an error.
|
So ``bpy.context.object = obj`` will raise an error.
|
||||||
|
|
||||||
But ``bpy.context.scene.objects.active = obj`` will work as expected.
|
But ``bpy.context.scene.objects.active = obj`` will work as expected.
|
||||||
|
|
||||||
|
|
||||||
The context attributes change depending on where they are accessed.
|
The context attributes change depending on where they are accessed. The 3D view has different context members than the console, so take care when accessing context attributes that the user state is known.
|
||||||
The 3D view has different context members than the console,
|
|
||||||
so take care when accessing context attributes that the user state is known.
|
|
||||||
|
|
||||||
See :mod:`bpy.context` API reference.
|
See :mod:`bpy.context` API reference
|
||||||
|
|
||||||
|
|
||||||
Operators (Tools)
|
Operators (Tools)
|
||||||
-----------------
|
-----------------
|
||||||
|
|
||||||
Operators are tools generally accessed by the user from buttons, menu items or key shortcuts.
|
Operators are tools generally accessed by the user from buttons, menu items or key shortcuts. From the user perspective they are a tool but Python can run these with its own settings through the :mod:`bpy.ops` module.
|
||||||
From the user perspective they are a tool but Python can run these with its own settings
|
|
||||||
through the :mod:`bpy.ops` module.
|
|
||||||
|
|
||||||
Examples:
|
Examples:
|
||||||
|
|
||||||
@@ -255,19 +241,16 @@ Examples:
|
|||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
|
|
||||||
The menu item: :menuselection:`Help --> Operator Cheat Sheet`
|
The menu item: Help -> Operator Cheat Sheet" gives a list of all operators and their default values in Python syntax, along with the generated docs. This is a good way to get an overview of all blender's operators.
|
||||||
gives a list of all operators and their default values in Python syntax, along with the generated docs.
|
|
||||||
This is a good way to get an overview of all Blender's operators.
|
|
||||||
|
|
||||||
|
|
||||||
Operator Poll()
|
Operator Poll()
|
||||||
^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
Many operators have a "poll" function which may check that the cursor
|
Many operators have a "poll" function which may check that the mouse is in a valid area or that the object is in the correct mode (Edit Mode, Weight Paint etc).
|
||||||
is in a valid area or that the object is in the correct mode (Edit Mode, Weight Paint etc).
|
When an operator's poll function fails within python, an exception is raised.
|
||||||
When an operator's poll function fails within Python, an exception is raised.
|
|
||||||
|
|
||||||
For example, calling ``bpy.ops.view3d.render_border()`` from the console raises the following error:
|
For example, calling bpy.ops.view3d.render_border() from the console raises the following error:
|
||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
@@ -275,8 +258,7 @@ For example, calling ``bpy.ops.view3d.render_border()`` from the console raises
|
|||||||
|
|
||||||
In this case the context must be the 3d view with an active camera.
|
In this case the context must be the 3d view with an active camera.
|
||||||
|
|
||||||
To avoid using try/except clauses wherever operators are called you can call the operators
|
To avoid using try/except clauses wherever operators are called you can call the operators own .poll() function to check if it can run in the current context.
|
||||||
own ``poll()`` function to check if it can run in the current context.
|
|
||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
@@ -289,10 +271,13 @@ Integration
|
|||||||
|
|
||||||
Python scripts can integrate with Blender in the following ways:
|
Python scripts can integrate with Blender in the following ways:
|
||||||
|
|
||||||
- By defining a rendering engine.
|
* By defining a rendering engine.
|
||||||
- By defining operators.
|
|
||||||
- By defining menus, headers and panels.
|
* By defining operators.
|
||||||
- By inserting new buttons into existing menus, headers and panels
|
|
||||||
|
* By defining menus, headers and panels.
|
||||||
|
|
||||||
|
* By inserting new buttons into existing menus, headers and panels
|
||||||
|
|
||||||
|
|
||||||
In Python, this is done by defining a class, which is a subclass of an existing type.
|
In Python, this is done by defining a class, which is a subclass of an existing type.
|
||||||
@@ -303,52 +288,62 @@ Example Operator
|
|||||||
|
|
||||||
.. literalinclude:: ../../../release/scripts/templates_py/operator_simple.py
|
.. literalinclude:: ../../../release/scripts/templates_py/operator_simple.py
|
||||||
|
|
||||||
Once this script runs, ``SimpleOperator`` is registered with Blender
|
Once this script runs, ``SimpleOperator`` is registered with Blender and can be called from the operator search popup or added to the toolbar.
|
||||||
and can be called from the operator search popup or added to the toolbar.
|
|
||||||
|
|
||||||
To run the script:
|
To run the script:
|
||||||
|
|
||||||
#. Highlight the above code then press :kbd:`Ctrl-C` to copy it.
|
#. Highlight the above code then press Ctrl+C to copy it.
|
||||||
|
|
||||||
#. Start Blender
|
#. Start Blender
|
||||||
#. Press :kbd:`Ctrl-Right` twice to change to the Scripting layout.
|
|
||||||
|
#. Press Ctrl+Right twice to change to the Scripting layout.
|
||||||
|
|
||||||
#. Click the button labeled ``New`` and the confirmation pop up in order to create a new text block.
|
#. Click the button labeled ``New`` and the confirmation pop up in order to create a new text block.
|
||||||
#. Press :kbd:`Ctrl-V` to paste the code into the text panel (the upper left frame).
|
|
||||||
|
#. Press Ctrl+V to paste the code into the text panel (the upper left frame).
|
||||||
|
|
||||||
#. Click on the button **Run Script**.
|
#. Click on the button **Run Script**.
|
||||||
#. Move your cursor into the 3D view, press spacebar for the operator search menu, and type "Simple".
|
|
||||||
|
#. Move your mouse into the 3D view, press spacebar for the operator search menu, and type "Simple".
|
||||||
|
|
||||||
#. Click on the "Simple Operator" item found in search.
|
#. Click on the "Simple Operator" item found in search.
|
||||||
|
|
||||||
|
|
||||||
.. seealso:: The class members with the ``bl_`` prefix are documented in the API
|
.. seealso:: The class members with the **bl_** prefix are documented in the API
|
||||||
reference :class:`bpy.types.Operator`
|
reference :class:`bpy.types.Operator`
|
||||||
|
|
||||||
.. note::
|
.. note:: The output from the ``main`` function is sent to the terminal; in order to see this, be sure to :ref:`use the terminal <use_the_terminal>`.
|
||||||
|
|
||||||
The output from the ``main`` function is sent to the terminal;
|
|
||||||
in order to see this, be sure to :ref:`use the terminal <use_the_terminal>`.
|
|
||||||
|
|
||||||
Example Panel
|
Example Panel
|
||||||
-------------
|
-------------
|
||||||
|
|
||||||
Panels register themselves as a class, like an operator.
|
Panels register themselves as a class, like an operator. Notice the extra **bl_** variables used to set the context they display in.
|
||||||
Notice the extra ``bl_`` variables used to set the context they display in.
|
|
||||||
|
|
||||||
.. literalinclude:: ../../../release/scripts/templates_py/ui_panel_simple.py
|
.. literalinclude:: ../../../release/scripts/templates_py/ui_panel_simple.py
|
||||||
|
|
||||||
To run the script:
|
To run the script:
|
||||||
|
|
||||||
#. Highlight the above code then press :kbd:`Ctrl-C` to copy it
|
#. Highlight the above code then press Ctrl+C to copy it
|
||||||
|
|
||||||
#. Start Blender
|
#. Start Blender
|
||||||
#. Press :kbd:`Ctrl-Right` twice to change to the Scripting layout
|
|
||||||
|
#. Press Ctrl+Right twice to change to the Scripting layout
|
||||||
|
|
||||||
#. Click the button labeled ``New`` and the confirmation pop up in order to create a new text block.
|
#. Click the button labeled ``New`` and the confirmation pop up in order to create a new text block.
|
||||||
#. Press :kbd:`Ctrl-V` to paste the code into the text panel (the upper left frame)
|
|
||||||
|
#. Press Ctrl+V to paste the code into the text panel (the upper left frame)
|
||||||
|
|
||||||
#. Click on the button **Run Script**.
|
#. Click on the button **Run Script**.
|
||||||
|
|
||||||
|
|
||||||
To view the results:
|
To view the results:
|
||||||
|
|
||||||
#. Select the the default cube.
|
#. Select the the default cube.
|
||||||
|
|
||||||
#. Click on the Object properties icon in the buttons panel (far right; appears as a tiny cube).
|
#. Click on the Object properties icon in the buttons panel (far right; appears as a tiny cube).
|
||||||
|
|
||||||
#. Scroll down to see a panel named **Hello World Panel**.
|
#. Scroll down to see a panel named **Hello World Panel**.
|
||||||
|
|
||||||
#. Changing the object name also updates **Hello World Panel's** Name: field.
|
#. Changing the object name also updates **Hello World Panel's** Name: field.
|
||||||
|
|
||||||
Note the row distribution and the label and properties that are available through the code.
|
Note the row distribution and the label and properties that are available through the code.
|
||||||
@@ -367,15 +362,16 @@ Blender's Python API can be split up into 3 categories.
|
|||||||
Native Types
|
Native Types
|
||||||
------------
|
------------
|
||||||
|
|
||||||
In simple cases returning a number or a string as a custom type would be cumbersome,
|
In simple cases returning a number or a string as a custom type would be cumbersome, so these are accessed as normal python types.
|
||||||
so these are accessed as normal Python types.
|
|
||||||
|
|
||||||
- Blender float/int/boolean -> float/int/boolean
|
* blender float/int/boolean -> float/int/boolean
|
||||||
- Blender enumerator -> string
|
|
||||||
|
* blender enumerator -> string
|
||||||
|
|
||||||
>>> C.object.rotation_mode = 'AXIS_ANGLE'
|
>>> C.object.rotation_mode = 'AXIS_ANGLE'
|
||||||
|
|
||||||
- Blender enumerator (multiple) -> set of strings
|
|
||||||
|
* blender enumerator (multiple) -> set of strings
|
||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
@@ -393,8 +389,7 @@ Used for Blender datablocks and collections: :class:`bpy.types.bpy_struct`
|
|||||||
|
|
||||||
For data that contains its own attributes groups/meshes/bones/scenes... etc.
|
For data that contains its own attributes groups/meshes/bones/scenes... etc.
|
||||||
|
|
||||||
There are 2 main types that wrap Blenders data, one for datablocks
|
There are 2 main types that wrap Blenders data, one for datablocks (known internally as bpy_struct), another for properties.
|
||||||
(known internally as ``bpy_struct``), another for properties.
|
|
||||||
|
|
||||||
>>> bpy.context.object
|
>>> bpy.context.object
|
||||||
bpy.data.objects['Cube']
|
bpy.data.objects['Cube']
|
||||||
@@ -410,9 +405,7 @@ Mathutils Types
|
|||||||
|
|
||||||
Used for vectors, quaternion, eulers, matrix and color types, accessible from :mod:`mathutils`
|
Used for vectors, quaternion, eulers, matrix and color types, accessible from :mod:`mathutils`
|
||||||
|
|
||||||
Some attributes such as :class:`bpy.types.Object.location`,
|
Some attributes such as :class:`bpy.types.Object.location`, :class:`bpy.types.PoseBone.rotation_euler` and :class:`bpy.types.Scene.cursor_location` can be accessed as special math types which can be used together and manipulated in various useful ways.
|
||||||
:class:`bpy.types.PoseBone.rotation_euler` and :class:`bpy.types.Scene.cursor_location`
|
|
||||||
can be accessed as special math types which can be used together and manipulated in various useful ways.
|
|
||||||
|
|
||||||
Example of a matrix, vector multiplication:
|
Example of a matrix, vector multiplication:
|
||||||
|
|
||||||
@@ -447,9 +440,7 @@ Animation
|
|||||||
|
|
||||||
There are 2 ways to add keyframes through Python.
|
There are 2 ways to add keyframes through Python.
|
||||||
|
|
||||||
The first is through key properties directly, which is similar to inserting a keyframe from the button as a user.
|
The first is through key properties directly, which is similar to inserting a keyframe from the button as a user. You can also manually create the curves and keyframe data, then set the path to the property. Here are examples of both methods.
|
||||||
You can also manually create the curves and keyframe data, then set the path to the property.
|
|
||||||
Here are examples of both methods.
|
|
||||||
|
|
||||||
Both examples insert a keyframe on the active object's Z axis.
|
Both examples insert a keyframe on the active object's Z axis.
|
||||||
|
|
||||||
|
@@ -1,12 +1,10 @@
|
|||||||
|
|
||||||
***************
|
***************
|
||||||
Tips and Tricks
|
Tips and Tricks
|
||||||
***************
|
***************
|
||||||
|
|
||||||
Here are various suggestions that you might find useful when writing scripts.
|
Here are various suggestions that you might find useful when writing scripts.
|
||||||
|
|
||||||
Some of these are just Python features that scripters may not have thought to use with Blender,
|
Some of these are just python features that scripters may not have thought to use with blender, others are blender specific.
|
||||||
others are Blender specific.
|
|
||||||
|
|
||||||
|
|
||||||
.. _use_the_terminal:
|
.. _use_the_terminal:
|
||||||
@@ -14,21 +12,18 @@ others are Blender specific.
|
|||||||
Use The Terminal
|
Use The Terminal
|
||||||
================
|
================
|
||||||
|
|
||||||
When writing Python scripts, it's useful to have a terminal open,
|
When writing python scripts, it's useful to have a terminal open, this is not the built-in python console but a terminal application which is used to start blender.
|
||||||
this is not the built-in Python console but a terminal application which is used to start Blender.
|
|
||||||
|
|
||||||
There are 3 main uses for the terminal, these are:
|
There are 3 main uses for the terminal, these are:
|
||||||
|
|
||||||
- You can see the output of ``print()`` as your script runs, which is useful to view debug info.
|
* You can see the output of ``print()`` as your script runs, which is useful to view debug info.
|
||||||
- The error trace-back is printed in full to the terminal which won't always generate an error popup in
|
|
||||||
Blender's user interface (depending on how the script is executed).
|
* The error trace-back is printed in full to the terminal which won't always generate an error popup in blender's user interface (depending on how the script is executed).
|
||||||
- If the script runs for too long or you accidentally enter an infinite loop,
|
|
||||||
:kbd:`Ctrl-C` in the terminal (:kbd:`Ctrl-Break` on Windows) will quit the script early.
|
* If the script runs for too long or you accidentally enter an infinite loop, Ctrl+C in the terminal (Ctrl+Break on Windows) will quit the script early.
|
||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
|
For Linux and OSX users this means starting the terminal first, then running blender from within it. On Windows the terminal can be enabled from the help menu.
|
||||||
For Linux and OSX users this means starting the terminal first, then running Blender from within it.
|
|
||||||
On Windows the terminal can be enabled from the help menu.
|
|
||||||
|
|
||||||
|
|
||||||
Interface Tricks
|
Interface Tricks
|
||||||
@@ -38,56 +33,43 @@ Interface Tricks
|
|||||||
Access Operator Commands
|
Access Operator Commands
|
||||||
------------------------
|
------------------------
|
||||||
|
|
||||||
You may have noticed that the tooltip for menu items and buttons includes the ``bpy.ops.[...])`` command
|
You may have noticed that the tooltip for menu items and buttons includes the ``bpy.ops``... command to run that button, a handy (hidden) feature is that you can press Ctrl+C over any menu item/button to copy this command into the clipboard.
|
||||||
to run that button, a handy (hidden) feature is that you can press :kbd:`Ctrl-C` over
|
|
||||||
any menu item/button to copy this command into the clipboard.
|
|
||||||
|
|
||||||
|
|
||||||
Access Data Path
|
Access Data Path
|
||||||
----------------
|
----------------
|
||||||
|
|
||||||
To find the path from an :class:`ID` datablock to its setting isn't always so simple since it may be nested away.
|
To find the path from an :class:`ID` datablock to its setting isn't always so simple since it may be nested away. To get this quickly you can right click on the setting and select select **Copy Data Path**,
|
||||||
To get this quickly you can right click on the setting and select select **Copy Data Path**,
|
|
||||||
if this can't be generated, only the property name is copied.
|
if this can't be generated, only the property name is copied.
|
||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
|
|
||||||
This uses the same method for creating the animation path used by
|
This uses the same method for creating the animation path used by :class:`bpy.types.FCurve.data_path` and :class:`bpy.types.DriverTarget.data_path` drivers.
|
||||||
:class:`bpy.types.FCurve.data_path` and
|
|
||||||
:class:`bpy.types.DriverTarget.data_path` drivers.
|
|
||||||
|
|
||||||
|
|
||||||
.. _info_show_all_operators:
|
.. _info_show_all_operators
|
||||||
|
|
||||||
Show All Operators
|
Show All Operators
|
||||||
==================
|
==================
|
||||||
|
|
||||||
While Blender logs operators in the Info space,
|
While blender logs operators in the Info space, this only reports operators with the ``REGISTER`` option enabeld so as not to flood the Info view with calls to ``bpy.ops.view3d.smoothview`` and ``bpy.ops.view3d.zoom``.
|
||||||
this only reports operators with the ``REGISTER`` option enabeld so as not to flood the *Info* view
|
|
||||||
with calls to ``bpy.ops.view3d.smoothview`` and ``bpy.ops.view3d.zoom``.
|
|
||||||
|
|
||||||
However, for testing it can be useful to see **every** operator called in a terminal,
|
However, for testing it can be useful to see **every** operator called in a terminal, do this by enabling the debug option either by passing the ``--debug-wm`` argument when starting blender or by setting :mod:`bpy.app.debug_wm` to True while blender is running.
|
||||||
do this by enabling the debug option either by passing the ``--debug-wm`` argument when starting Blender
|
|
||||||
or by setting :mod:`bpy.app.debug_wm` to ``True`` while Blender is running.
|
|
||||||
|
|
||||||
|
|
||||||
Use an External Editor
|
Use an External Editor
|
||||||
======================
|
======================
|
||||||
|
|
||||||
Blenders text editor is fine for small changes and writing tests but its not full featured,
|
Blenders text editor is fine for small changes and writing tests but its not full featured, for larger projects you'll probably want to use a standalone editor or python IDE.
|
||||||
for larger projects you'll probably want to use a standalone editor or Python IDE.
|
|
||||||
|
|
||||||
Editing a text file externally and having the same text open in Blender does work but isn't that optimal
|
Editing a text file externally and having the same text open in blender does work but isn't that optimal so here are 2 ways you can easily use an external file from blender.
|
||||||
so here are 2 ways you can easily use an external file from Blender.
|
|
||||||
|
|
||||||
Using the following examples you'll still need textblock in Blender to execute,
|
|
||||||
but reference an external file rather then including it directly.
|
|
||||||
|
|
||||||
|
Using the following examples you'll still need textblock in blender to execute, but reference an external file rather then including it directly.
|
||||||
|
|
||||||
Executing External Scripts
|
Executing External Scripts
|
||||||
--------------------------
|
--------------------------
|
||||||
|
|
||||||
This is the equivalent to running the script directly, referencing a scripts path from a 2 line text-block.
|
This is the equivalent to running the script directly, referencing a scripts path from a 2 line textblock.
|
||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
@@ -120,17 +102,12 @@ This example shows loading a script in as a module and executing a module functi
|
|||||||
myscript.main()
|
myscript.main()
|
||||||
|
|
||||||
|
|
||||||
Notice that the script is reloaded every time, this forces use of the modified version,
|
Notice that the script is reloaded every time, this forces use of the modified version, otherwise the cached one in ``sys.modules`` would be used until blender was restarted.
|
||||||
otherwise the cached one in ``sys.modules`` would be used until Blender was restarted.
|
|
||||||
|
|
||||||
The important difference between this and executing the script directly is it
|
The important difference between this and executing the script directly is it has to call a function in the module, in this case ``main()`` but it can be any function, an advantage with this is you can pass arguments to the function from this small script which is often useful for testing different settings quickly.
|
||||||
has to call a function in the module, in this case ``main()`` but it can be any function,
|
|
||||||
an advantage with this is you can pass arguments to the function from this
|
|
||||||
small script which is often useful for testing different settings quickly.
|
|
||||||
|
|
||||||
The other issue with this is the script has to be in Pythons module search path.
|
The other issue with this is the script has to be in pythons module search path.
|
||||||
While this is not best practice - for testing you can extend the search path,
|
While this is not best practice - for testing you can extend the search path, this example adds the current blend files directory to the search path, then loads the script as a module.
|
||||||
this example adds the current blend files directory to the search path, then loads the script as a module.
|
|
||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
@@ -151,86 +128,71 @@ this example adds the current blend files directory to the search path, then loa
|
|||||||
Don't Use Blender!
|
Don't Use Blender!
|
||||||
==================
|
==================
|
||||||
|
|
||||||
While developing your own scripts Blenders interface can get in the way,
|
While developing your own scripts blenders interface can get in the way, manually reloading, running the scripts, opening file import etc. adds overhead.
|
||||||
manually reloading, running the scripts, opening file import etc. adds overhead.
|
|
||||||
|
|
||||||
For scripts that are not interactive it can end up being more efficient not to use
|
For scripts that are not interactive it can end up being more efficient not to use blenders interface at all and instead execute the script on the command line.
|
||||||
Blenders interface at all and instead execute the script on the command line.
|
|
||||||
|
|
||||||
.. code-block:: sh
|
.. code-block:: python
|
||||||
|
|
||||||
blender --background --python myscript.py
|
blender --background --python myscript.py
|
||||||
|
|
||||||
|
|
||||||
You might want to run this with a blend file so the script has some data to operate on.
|
You might want to run this with a blend file so the script has some data to operate on.
|
||||||
|
|
||||||
.. code-block:: sh
|
.. code-block:: python
|
||||||
|
|
||||||
blender myscene.blend --background --python myscript.py
|
blender myscene.blend --background --python myscript.py
|
||||||
|
|
||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
|
|
||||||
Depending on your setup you might have to enter the full path to the Blender executable.
|
Depending on your setup you might have to enter the full path to the blender executable.
|
||||||
|
|
||||||
|
|
||||||
Once the script is running properly in background mode, you'll want to check the output of the script,
|
Once the script is running properly in background mode, you'll want to check the output of the script, this depends completely on the task at hand however here are some suggestions.
|
||||||
this depends completely on the task at hand however here are some suggestions.
|
|
||||||
|
|
||||||
- render the output to an image, use an image viewer and keep writing over the same image each time.
|
* render the output to an image, use an image viewer and keep writing over the same image each time.
|
||||||
- save a new blend file, or export the file using one of Blenders exporters.
|
|
||||||
- if the results can be displayed as text - print them or write them to a file.
|
* save a new blend file, or export the file using one of blenders exporters.
|
||||||
|
|
||||||
|
* if the results can be displayed as text - print them or write them to a file.
|
||||||
|
|
||||||
|
|
||||||
While this can take a little time to setup, it can be well worth the effort
|
This can take a little time to setup, but it can be well worth the effort to reduce the time it takes to test changes - you can even have blender running the script ever few seconds with a viewer updating the results, so no need to leave your text editor to see changes.
|
||||||
to reduce the time it takes to test changes - you can even have
|
|
||||||
Blender running the script every few seconds with a viewer updating the results,
|
|
||||||
so no need to leave your text editor to see changes.
|
|
||||||
|
|
||||||
|
|
||||||
Use External Tools
|
Use External Tools
|
||||||
==================
|
==================
|
||||||
|
|
||||||
When there are no readily available Python modules to perform specific tasks it's
|
When there are no readily available python modules to perform specific tasks it's worth keeping in mind you may be able to have python execute an external command on your data and read the result back in.
|
||||||
worth keeping in mind you may be able to have Python execute an external command
|
|
||||||
on your data and read the result back in.
|
|
||||||
|
|
||||||
Using external programs adds an extra dependency and may limit who can use the script
|
Using external programs adds an extra dependency and may limit who can use the script but to quickly setup your own custom pipeline or writing one-off scripts this can be handy.
|
||||||
but to quickly setup your own custom pipeline or writing one-off scripts this can be handy.
|
|
||||||
|
|
||||||
Examples include:
|
Examples include:
|
||||||
|
|
||||||
- Run The Gimp in batch mode to execute custom scripts for advanced image processing.
|
* Run The Gimp in batch mode to execute custom scripts for advanced image processing.
|
||||||
- Write out 3D models to use external mesh manipulation tools and read back in the results.
|
|
||||||
- Convert files into recognizable formats before reading.
|
* Write out 3D models to use external mesh manipulation tools and read back in the results.
|
||||||
|
|
||||||
|
* Convert files into recognizable formats before reading.
|
||||||
|
|
||||||
|
|
||||||
Bundled Python & Extensions
|
Bundled Python & Extensions
|
||||||
===========================
|
===========================
|
||||||
|
|
||||||
The Blender releases distributed from blender.org include a complete Python installation on all platforms,
|
The Blender releases distributed from blender.org include a complete python installation on all platforms, this has the disadvantage that any extensions you have installed in your systems python wont be found by blender.
|
||||||
this has the disadvantage that any extensions you have installed in your systems Python wont be found by Blender.
|
|
||||||
|
|
||||||
There are 2 ways around this:
|
There are 2 ways around this:
|
||||||
|
|
||||||
- remove Blender Python sub-directory, Blender will then fallback on the systems Python and use that instead
|
* remove blender python sub-directory, blender will then fallback on the systems python and use that instead **python version must match the one that blender comes with**.
|
||||||
.. warning::
|
|
||||||
|
|
||||||
The Python version must match the one that Blender comes with.
|
* copy the extensions into blender's python sub-directory so blender can access them, you could also copy the entire python installation into blenders sub-directory, replacing the one blender comes with. This works as long as the python versions match and the paths are created in the same relative locations. Doing this has the advantage that you can redistribute this bundle to others with blender and/or the game player, including any extensions you rely on.
|
||||||
|
|
||||||
- copy the extensions into Blender's Python sub-directory so Blender can access them,
|
|
||||||
you could also copy the entire Python installation into Blenders sub-directory,
|
|
||||||
replacing the one Blender comes with.
|
|
||||||
This works as long as the Python versions match and the paths are created in the same relative locations.
|
|
||||||
Doing this has the advantage that you can redistribute this bundle to others with Blender and/or the game player,
|
|
||||||
including any extensions you rely on.
|
|
||||||
|
|
||||||
|
|
||||||
Drop Into a Python Interpreter in Your Script
|
Drop Into a Python Interpreter in Your Script
|
||||||
=============================================
|
=============================================
|
||||||
|
|
||||||
In the middle of a script you may want to inspect some variables,
|
In the middle of a script you may want to inspect some variables, run some function and generally dig about to see whats going on.
|
||||||
run some function and generally dig about to see whats going on.
|
|
||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
@@ -255,13 +217,10 @@ The next example is an equivalent single line version of the script above which
|
|||||||
__import__('code').interact(local=dict(globals(), **locals()))
|
__import__('code').interact(local=dict(globals(), **locals()))
|
||||||
|
|
||||||
|
|
||||||
``code.interact`` can be added at any line in the script
|
``code.interact`` can be added at any line in the script and will pause the script an launch an interactive interpreter in the terminal, when you're done you can quit the interpreter and the script will continue execution.
|
||||||
and will pause the script an launch an interactive interpreter in the terminal,
|
|
||||||
when you're done you can quit the interpreter and the script will continue execution.
|
|
||||||
|
|
||||||
|
|
||||||
If you have **IPython** installed you can use its ``embed()`` function which uses the current namespace.
|
If you have **IPython** installed you can use their ``embed()`` function which will implicitly use the current namespace, this has autocomplete and some useful features that the standard python eval-loop doesn't have.
|
||||||
The IPython prompt has auto-complete and some useful features that the standard Python eval-loop doesn't have.
|
|
||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
@@ -269,7 +228,7 @@ The IPython prompt has auto-complete and some useful features that the standard
|
|||||||
IPython.embed()
|
IPython.embed()
|
||||||
|
|
||||||
|
|
||||||
Admittedly this highlights the lack of any Python debugging support built into Blender, but its still handy to know.
|
Admittedly this highlights the lack of any python debugging support built into blender, but its still handy to know.
|
||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
|
|
||||||
@@ -283,32 +242,27 @@ Advanced
|
|||||||
Blender as a module
|
Blender as a module
|
||||||
-------------------
|
-------------------
|
||||||
|
|
||||||
From a Python perspective it's nicer to have everything as an extension
|
From a python perspective it's nicer to have everything as an extension which lets the python script combine many components.
|
||||||
which lets the Python script combine many components.
|
|
||||||
|
|
||||||
Advantages include:
|
Advantages include:
|
||||||
|
|
||||||
- you can use external editors/IDE's with Blenders Python API and execute scripts within the IDE
|
* you can use external editors/IDE's with blenders python API and execute scripts within the IDE (step over code, inspect variables as the script runs).
|
||||||
(step over code, inspect variables as the script runs).
|
|
||||||
- editors/IDE's can auto complete Blender modules & variables.
|
* editors/IDE's can auto complete blender modules & variables.
|
||||||
- existing scripts can import Blender API's without having to run inside Blender.
|
|
||||||
|
* existing scripts can import blender API's without having to run inside blender.
|
||||||
|
|
||||||
|
|
||||||
This is marked advanced because to run Blender as a Python module requires a special build option.
|
This is marked advanced because to run blender as a python module requires a special build option.
|
||||||
|
|
||||||
For instructions on building see
|
For instructions on building see `Building blender as a python module <http://wiki.blender.org/index.php/User:Ideasman42/BlenderAsPyModule>`_
|
||||||
`Building Blender as a Python module <http://wiki.blender.org/index.php/User:Ideasman42/BlenderAsPyModule>`_
|
|
||||||
|
|
||||||
|
|
||||||
Python Safety (Build Option)
|
Python Safety (Build Option)
|
||||||
----------------------------
|
----------------------------
|
||||||
|
|
||||||
Since it's possible to access data which has been removed (see Gotcha's),
|
Since it's possible to access data which has been removed (see Gotcha's), this can be hard to track down the cause of crashes.
|
||||||
this can be hard to track down the cause of crashes.
|
|
||||||
|
|
||||||
To raise Python exceptions on accessing freed data (rather then crashing),
|
To raise python exceptions on accessing freed data (rather then crashing), enable the CMake build option WITH_PYTHON_SAFETY.
|
||||||
enable the CMake build option WITH_PYTHON_SAFETY.
|
|
||||||
|
|
||||||
This enables data tracking which makes data access about 2x slower
|
|
||||||
which is why the option isn't enabled in release builds.
|
|
||||||
|
|
||||||
|
This enables data tracking which makes data access about 2x slower which is why the option is not enabled in release builds.
|
||||||
|
@@ -19,17 +19,21 @@ Prerequisites
|
|||||||
|
|
||||||
Before going through the tutorial you should...
|
Before going through the tutorial you should...
|
||||||
|
|
||||||
- Familiarity with the basics of working in Blender.
|
* Familiarity with the basics of working in Blender.
|
||||||
- Know how to run a script in Blender's text editor (as documented in the quick-start)
|
|
||||||
- Have an understanding of Python primitive types (int, boolean, string, list, tuple, dictionary, and set).
|
* Know how to run a script in Blender's text editor (as documented in the quick-start)
|
||||||
- Be familiar with the concept of Python modules.
|
|
||||||
- Basic understanding of classes (object orientation) in Python.
|
* Have an understanding of Python primitive types (int, boolean, string, list, tuple, dictionary, and set).
|
||||||
|
|
||||||
|
* Be familiar with the concept of Python modules.
|
||||||
|
|
||||||
|
* Basic understanding of classes (object orientation) in Python.
|
||||||
|
|
||||||
|
|
||||||
Suggested reading before starting this tutorial.
|
Suggested reading before starting this tutorial.
|
||||||
|
|
||||||
- `Dive Into Python <http://getpython3.com/diveintopython3/index.html>`_ sections (1, 2, 3, 4, and 7).
|
* `Dive Into Python <http://getpython3.com/diveintopython3/index.html>`_ sections (1, 2, 3, 4, and 7).
|
||||||
- :ref:`Blender API Quickstart <info_quickstart>`
|
* :ref:`Blender API Quickstart <info_quickstart>`
|
||||||
to help become familiar with Blender/Python basics.
|
to help become familiar with Blender/Python basics.
|
||||||
|
|
||||||
|
|
||||||
@@ -41,11 +45,13 @@ Documentation Links
|
|||||||
|
|
||||||
While going through the tutorial you may want to look into our reference documentation.
|
While going through the tutorial you may want to look into our reference documentation.
|
||||||
|
|
||||||
- :ref:`Blender API Overview <info_overview>`. -
|
* :ref:`Blender API Overview <info_overview>`. -
|
||||||
*This document is rather detailed but helpful if you want to know more on a topic.*
|
*This document is rather detailed but helpful if you want to know more on a topic.*
|
||||||
- :mod:`bpy.context` api reference. -
|
|
||||||
|
* :mod:`bpy.context` api reference. -
|
||||||
*Handy to have a list of available items your script may operate on.*
|
*Handy to have a list of available items your script may operate on.*
|
||||||
- :class:`bpy.types.Operator`. -
|
|
||||||
|
* :class:`bpy.types.Operator`. -
|
||||||
*The following addons define operators, these docs give details and more examples of operators.*
|
*The following addons define operators, these docs give details and more examples of operators.*
|
||||||
|
|
||||||
|
|
||||||
@@ -72,11 +78,11 @@ To give an example, here is the simplest possible addon.
|
|||||||
print("Goodbye World")
|
print("Goodbye World")
|
||||||
|
|
||||||
|
|
||||||
- ``bl_info`` is a dictionary containing addon meta-data such as the title, version and author to be displayed in the
|
* ``bl_info`` is a dictionary containing addon meta-data such as the title, version and author to be displayed in the
|
||||||
user preferences addon list.
|
user preferences addon list.
|
||||||
- ``register`` is a function which only runs when enabling the addon, this means the module can be loaded without
|
* ``register`` is a function which only runs when enabling the addon, this means the module can be loaded without
|
||||||
activating the addon.
|
activating the addon.
|
||||||
- ``unregister`` is a function to unload anything setup by ``register``, this is called when the addon is disabled.
|
* ``unregister`` is a function to unload anything setup by ``register``, this is called when the addon is disabled.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -178,15 +184,12 @@ This addon takes the body of the script above, and adds them to an operator's ``
|
|||||||
register()
|
register()
|
||||||
|
|
||||||
|
|
||||||
.. note::
|
.. note:: ``bl_info`` is split across multiple lines, this is just a style convention used to more easily add items.
|
||||||
|
|
||||||
``bl_info`` is split across multiple lines, this is just a style convention used to more easily add items.
|
.. note:: Rather than using ``bpy.context.scene``, we use the ``context.scene`` argument passed to ``execute()``.
|
||||||
|
In most cases these will be the same however in some cases operators will be passed a custom context
|
||||||
.. note::
|
so script authors should prefer the ``context`` argument passed to operators.
|
||||||
|
|
||||||
Rather than using ``bpy.context.scene``, we use the ``context.scene`` argument passed to ``execute()``.
|
|
||||||
In most cases these will be the same however in some cases operators will be passed a custom context
|
|
||||||
so script authors should prefer the ``context`` argument passed to operators.
|
|
||||||
|
|
||||||
To test the script you can copy and paste this into Blender text editor and run it, this will execute the script
|
To test the script you can copy and paste this into Blender text editor and run it, this will execute the script
|
||||||
directly and call register immediately.
|
directly and call register immediately.
|
||||||
@@ -199,8 +202,8 @@ However running the script wont move any objects, for this you need to execute t
|
|||||||
:height: 574px
|
:height: 574px
|
||||||
:alt: Spacebar
|
:alt: Spacebar
|
||||||
|
|
||||||
Do this by pressing :kbd:`Spacebar` to bring up the operator search dialog and type in
|
Do this by pressing ``SpaceBar`` to bring up the operator search dialog and type in "Move X by One" (the ``bl_label``),
|
||||||
"Move X by One" (the ``bl_label``), then :kbd:`Enter`.
|
then press ``Enter``.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -208,12 +211,11 @@ The objects should move as before.
|
|||||||
|
|
||||||
*Keep this addon open in Blender for the next step - Installing.*
|
*Keep this addon open in Blender for the next step - Installing.*
|
||||||
|
|
||||||
|
|
||||||
Install The Addon
|
Install The Addon
|
||||||
-----------------
|
-----------------
|
||||||
|
|
||||||
Once you have your addon within in Blender's text editor,
|
Once you have your addon within in Blender's text editor, you will want to be able to install it so it can be enabled in
|
||||||
you will want to be able to install it so it can be enabled in the user preferences to load on startup.
|
the user preferences to load on startup.
|
||||||
|
|
||||||
Even though the addon above is a test, lets go through the steps anyway so you know how to do it for later.
|
Even though the addon above is a test, lets go through the steps anyway so you know how to do it for later.
|
||||||
|
|
||||||
@@ -222,11 +224,10 @@ restrictions that apply to Python modules and end with a ``.py`` extension.
|
|||||||
|
|
||||||
Once the file is on disk, you can install it as you would for an addon downloaded online.
|
Once the file is on disk, you can install it as you would for an addon downloaded online.
|
||||||
|
|
||||||
Open the user :menuselection:`File -> User Preferences`,
|
Open the user **File -> User Preferences**, Select the **Addon** section, press **Install Addon...** and select the file.
|
||||||
Select the *Addon* section, press *Install Addon...* and select the file.
|
|
||||||
|
|
||||||
Now the addon will be listed and you can enable it by pressing the check-box,
|
Now the addon will be listed and you can enable it by pressing the check-box, if you want it to be enabled on restart,
|
||||||
if you want it to be enabled on restart, press *Save as Default*.
|
press **Save as Default**.
|
||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
|
|
||||||
@@ -240,7 +241,7 @@ if you want it to be enabled on restart, press *Save as Default*.
|
|||||||
print(addon_utils.paths())
|
print(addon_utils.paths())
|
||||||
|
|
||||||
More is written on this topic here:
|
More is written on this topic here:
|
||||||
`Directory Layout <https://www.blender.org/manual/getting_started/installing_blender/directorylayout.html>`_
|
`Directory Layout <http://wiki.blender.org/index.php/Doc:2.6/Manual/Introduction/Installing_Blender/DirectoryLayout>`_
|
||||||
|
|
||||||
|
|
||||||
Your Second Addon
|
Your Second Addon
|
||||||
@@ -632,12 +633,15 @@ you want to see example code for, this is a good place to start.
|
|||||||
|
|
||||||
Here are some sites you might like to check on after completing this tutorial.
|
Here are some sites you might like to check on after completing this tutorial.
|
||||||
|
|
||||||
- :ref:`Blender/Python API Overview <info_overview>` -
|
* :ref:`Blender/Python API Overview <info_overview>` -
|
||||||
*For more background details on Blender/Python integration.*
|
*For more background details on Blender/Python integration.*
|
||||||
- `How to Think Like a Computer Scientist <http://interactivepython.org/courselib/static/thinkcspy/index.html>`_ -
|
|
||||||
|
* `How to Think Like a Computer Scientist <http://interactivepython.org/courselib/static/thinkcspy/index.html>`_ -
|
||||||
*Great info for those who are still learning Python.*
|
*Great info for those who are still learning Python.*
|
||||||
- `Blender Development (Wiki) <http://wiki.blender.org/index.php/Dev:Contents>`_ -
|
|
||||||
|
* `Blender Development (Wiki) <http://wiki.blender.org/index.php/Dev:Contents>`_ -
|
||||||
*Blender Development, general information and helpful links.*
|
*Blender Development, general information and helpful links.*
|
||||||
- `Blender Artists (Coding Section) <http://blenderartists.org/forum/forumdisplay.php?47-Coding>`_ -
|
|
||||||
|
* `Blender Artists (Coding Section) <http://blenderartists.org/forum/forumdisplay.php?47-Coding>`_ -
|
||||||
*forum where people ask Python development questions*
|
*forum where people ask Python development questions*
|
||||||
|
|
||||||
|
@@ -316,7 +316,7 @@ def main():
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
import argparse
|
import argparse
|
||||||
except ImportError:
|
except:
|
||||||
print("Old Blender, just dumping")
|
print("Old Blender, just dumping")
|
||||||
api_dump()
|
api_dump()
|
||||||
return
|
return
|
||||||
|
@@ -138,9 +138,19 @@ def handle_args():
|
|||||||
parser.add_argument("-T", "--sphinx-theme",
|
parser.add_argument("-T", "--sphinx-theme",
|
||||||
dest="sphinx_theme",
|
dest="sphinx_theme",
|
||||||
type=str,
|
type=str,
|
||||||
default="classic",
|
default='default',
|
||||||
help="Sphinx theme (default='classic'), "
|
help=
|
||||||
"see: http://sphinx-doc.org/theming.html",
|
# see SPHINX_THEMES below
|
||||||
|
"Sphinx theme (default='default')\n"
|
||||||
|
"Available themes\n"
|
||||||
|
"----------------\n"
|
||||||
|
"(Blender Foundation) blender-org\n" # naiad
|
||||||
|
"(Sphinx) agogo, basic, epub, haiku, nature, "
|
||||||
|
"scrolls, sphinxdoc, traditional\n",
|
||||||
|
# choices=['naiad', 'blender-org'] + # bf
|
||||||
|
# ['agogo', 'basic', 'epub',
|
||||||
|
# 'haiku', 'nature', 'scrolls',
|
||||||
|
# 'sphinxdoc', 'traditional'], # sphinx
|
||||||
required=False)
|
required=False)
|
||||||
|
|
||||||
parser.add_argument("-N", "--sphinx-named-output",
|
parser.add_argument("-N", "--sphinx-named-output",
|
||||||
@@ -234,7 +244,6 @@ else:
|
|||||||
EXCLUDE_MODULES = [
|
EXCLUDE_MODULES = [
|
||||||
"aud",
|
"aud",
|
||||||
"bge",
|
"bge",
|
||||||
"bge.app"
|
|
||||||
"bge.constraints",
|
"bge.constraints",
|
||||||
"bge.events",
|
"bge.events",
|
||||||
"bge.logic",
|
"bge.logic",
|
||||||
@@ -258,7 +267,6 @@ else:
|
|||||||
"bpy.props",
|
"bpy.props",
|
||||||
"bpy.types", # supports filtering
|
"bpy.types", # supports filtering
|
||||||
"bpy.utils",
|
"bpy.utils",
|
||||||
"bpy.utils.previews",
|
|
||||||
"bpy_extras",
|
"bpy_extras",
|
||||||
"gpu",
|
"gpu",
|
||||||
"mathutils",
|
"mathutils",
|
||||||
@@ -411,7 +419,23 @@ BLENDER_ZIP_FILENAME = "%s.zip" % REFERENCE_NAME
|
|||||||
|
|
||||||
# -------------------------------SPHINX-----------------------------------------
|
# -------------------------------SPHINX-----------------------------------------
|
||||||
|
|
||||||
if ARGS.sphinx_theme == "blender-org":
|
SPHINX_THEMES = {'bf': ['blender-org'], # , 'naiad',
|
||||||
|
'sphinx': ['agogo',
|
||||||
|
'basic',
|
||||||
|
'default',
|
||||||
|
'epub',
|
||||||
|
'haiku',
|
||||||
|
'nature',
|
||||||
|
'scrolls',
|
||||||
|
'sphinxdoc',
|
||||||
|
'traditional']}
|
||||||
|
|
||||||
|
available_themes = SPHINX_THEMES['bf'] + SPHINX_THEMES['sphinx']
|
||||||
|
if ARGS.sphinx_theme not in available_themes:
|
||||||
|
print("Please choose a theme among: %s" % ', '.join(available_themes))
|
||||||
|
sys.exit()
|
||||||
|
|
||||||
|
if ARGS.sphinx_theme in SPHINX_THEMES['bf']:
|
||||||
SPHINX_THEME_DIR = os.path.join(ARGS.output_dir, ARGS.sphinx_theme)
|
SPHINX_THEME_DIR = os.path.join(ARGS.output_dir, ARGS.sphinx_theme)
|
||||||
SPHINX_THEME_SVN_DIR = os.path.join(SCRIPT_DIR, ARGS.sphinx_theme)
|
SPHINX_THEME_SVN_DIR = os.path.join(SCRIPT_DIR, ARGS.sphinx_theme)
|
||||||
|
|
||||||
@@ -456,11 +480,9 @@ ClassMethodDescriptorType = type(dict.__dict__['fromkeys'])
|
|||||||
MethodDescriptorType = type(dict.get)
|
MethodDescriptorType = type(dict.get)
|
||||||
GetSetDescriptorType = type(int.real)
|
GetSetDescriptorType = type(int.real)
|
||||||
StaticMethodType = type(staticmethod(lambda: None))
|
StaticMethodType = type(staticmethod(lambda: None))
|
||||||
from types import (
|
from types import (MemberDescriptorType,
|
||||||
MemberDescriptorType,
|
MethodType,
|
||||||
MethodType,
|
)
|
||||||
FunctionType,
|
|
||||||
)
|
|
||||||
|
|
||||||
_BPY_STRUCT_FAKE = "bpy_struct"
|
_BPY_STRUCT_FAKE = "bpy_struct"
|
||||||
_BPY_PROP_COLLECTION_FAKE = "bpy_prop_collection"
|
_BPY_PROP_COLLECTION_FAKE = "bpy_prop_collection"
|
||||||
@@ -637,26 +659,19 @@ def pyfunc2sphinx(ident, fw, module_name, type_name, identifier, py_func, is_cla
|
|||||||
func_type = "function"
|
func_type = "function"
|
||||||
|
|
||||||
# ther rest are class methods
|
# ther rest are class methods
|
||||||
elif arg_str.startswith("(self, ") or arg_str == "(self)":
|
elif arg_str.startswith("(self, "):
|
||||||
arg_str = "()" if (arg_str == "(self)") else ("(" + arg_str[7:])
|
arg_str = "(" + arg_str[7:]
|
||||||
func_type = "method"
|
func_type = "method"
|
||||||
elif arg_str.startswith("(cls, "):
|
elif arg_str.startswith("(cls, "):
|
||||||
arg_str = "()" if (arg_str == "(cls)") else ("(" + arg_str[6:])
|
arg_str = "(" + arg_str[6:]
|
||||||
func_type = "classmethod"
|
func_type = "classmethod"
|
||||||
else:
|
else:
|
||||||
func_type = "staticmethod"
|
func_type = "staticmethod"
|
||||||
|
|
||||||
doc = py_func.__doc__
|
fw(ident + ".. %s:: %s%s\n\n" % (func_type, identifier, arg_str))
|
||||||
if (not doc) or (not doc.startswith(".. %s:: " % func_type)):
|
if py_func.__doc__:
|
||||||
fw(ident + ".. %s:: %s%s\n\n" % (func_type, identifier, arg_str))
|
write_indented_lines(ident + " ", fw, py_func.__doc__)
|
||||||
ident_temp = ident + " "
|
|
||||||
else:
|
|
||||||
ident_temp = ident
|
|
||||||
|
|
||||||
if doc:
|
|
||||||
write_indented_lines(ident_temp, fw, doc)
|
|
||||||
fw("\n")
|
fw("\n")
|
||||||
del doc, ident_temp
|
|
||||||
|
|
||||||
if is_class:
|
if is_class:
|
||||||
write_example_ref(ident + " ", fw, module_name + "." + type_name + "." + identifier)
|
write_example_ref(ident + " ", fw, module_name + "." + type_name + "." + identifier)
|
||||||
@@ -872,7 +887,7 @@ def pymodule2sphinx(basepath, module_name, module, title):
|
|||||||
module_dir_value_type.sort(key=lambda triple: str(triple[2]))
|
module_dir_value_type.sort(key=lambda triple: str(triple[2]))
|
||||||
|
|
||||||
for attribute, value, value_type in module_dir_value_type:
|
for attribute, value, value_type in module_dir_value_type:
|
||||||
if value_type == FunctionType:
|
if value_type == types.FunctionType:
|
||||||
pyfunc2sphinx("", fw, module_name, None, attribute, value, is_class=False)
|
pyfunc2sphinx("", fw, module_name, None, attribute, value, is_class=False)
|
||||||
elif value_type in {types.BuiltinMethodType, types.BuiltinFunctionType}: # both the same at the moment but to be future proof
|
elif value_type in {types.BuiltinMethodType, types.BuiltinFunctionType}: # both the same at the moment but to be future proof
|
||||||
# note: can't get args from these, so dump the string as is
|
# note: can't get args from these, so dump the string as is
|
||||||
@@ -922,29 +937,18 @@ def pymodule2sphinx(basepath, module_name, module, title):
|
|||||||
fw(title_string(heading, heading_char))
|
fw(title_string(heading, heading_char))
|
||||||
|
|
||||||
# May need to be its own function
|
# May need to be its own function
|
||||||
|
fw(".. class:: %s\n\n" % type_name)
|
||||||
if value.__doc__:
|
if value.__doc__:
|
||||||
if value.__doc__.startswith(".. class::"):
|
write_indented_lines(" ", fw, value.__doc__, False)
|
||||||
fw(value.__doc__)
|
fw("\n")
|
||||||
else:
|
|
||||||
fw(".. class:: %s\n\n" % type_name)
|
|
||||||
write_indented_lines(" ", fw, value.__doc__, True)
|
|
||||||
else:
|
|
||||||
fw(".. class:: %s\n\n" % type_name)
|
|
||||||
fw("\n")
|
|
||||||
|
|
||||||
write_example_ref(" ", fw, module_name + "." + type_name)
|
write_example_ref(" ", fw, module_name + "." + type_name)
|
||||||
|
|
||||||
descr_items = [(key, descr) for key, descr in sorted(value.__dict__.items()) if not key.startswith("_")]
|
descr_items = [(key, descr) for key, descr in sorted(value.__dict__.items()) if not key.startswith("__")]
|
||||||
|
|
||||||
for key, descr in descr_items:
|
for key, descr in descr_items:
|
||||||
if type(descr) == ClassMethodDescriptorType:
|
if type(descr) == ClassMethodDescriptorType:
|
||||||
py_descr2sphinx(" ", fw, descr, module_name, type_name, key)
|
py_descr2sphinx(" ", fw, descr, module_name, type_name, key)
|
||||||
|
|
||||||
# needed for pure python classes
|
|
||||||
for key, descr in descr_items:
|
|
||||||
if type(descr) == FunctionType:
|
|
||||||
pyfunc2sphinx(" ", fw, module_name, type_name, key, descr, is_class=True)
|
|
||||||
|
|
||||||
for key, descr in descr_items:
|
for key, descr in descr_items:
|
||||||
if type(descr) == MethodDescriptorType:
|
if type(descr) == MethodDescriptorType:
|
||||||
py_descr2sphinx(" ", fw, descr, module_name, type_name, key)
|
py_descr2sphinx(" ", fw, descr, module_name, type_name, key)
|
||||||
@@ -967,12 +971,10 @@ def pymodule2sphinx(basepath, module_name, module, title):
|
|||||||
context_type_map = {
|
context_type_map = {
|
||||||
"active_base": ("ObjectBase", False),
|
"active_base": ("ObjectBase", False),
|
||||||
"active_bone": ("EditBone", False),
|
"active_bone": ("EditBone", False),
|
||||||
"active_gpencil_frame": ("GreasePencilLayer", True),
|
|
||||||
"active_gpencil_layer": ("GPencilLayer", True),
|
|
||||||
"active_node": ("Node", False),
|
|
||||||
"active_object": ("Object", False),
|
"active_object": ("Object", False),
|
||||||
"active_operator": ("Operator", False),
|
"active_operator": ("Operator", False),
|
||||||
"active_pose_bone": ("PoseBone", False),
|
"active_pose_bone": ("PoseBone", False),
|
||||||
|
"active_node": ("Node", False),
|
||||||
"armature": ("Armature", False),
|
"armature": ("Armature", False),
|
||||||
"bone": ("Bone", False),
|
"bone": ("Bone", False),
|
||||||
"brush": ("Brush", False),
|
"brush": ("Brush", False),
|
||||||
@@ -988,11 +990,7 @@ context_type_map = {
|
|||||||
"edit_object": ("Object", False),
|
"edit_object": ("Object", False),
|
||||||
"edit_text": ("Text", False),
|
"edit_text": ("Text", False),
|
||||||
"editable_bones": ("EditBone", True),
|
"editable_bones": ("EditBone", True),
|
||||||
"editable_gpencil_layers": ("GPencilLayer", True),
|
|
||||||
"editable_gpencil_strokes": ("GPencilStroke", True),
|
|
||||||
"fluid": ("FluidSimulationModifier", False),
|
"fluid": ("FluidSimulationModifier", False),
|
||||||
"gpencil_data": ("GreasePencel", False),
|
|
||||||
"gpencil_data_owner": ("ID", False),
|
|
||||||
"image_paint_object": ("Object", False),
|
"image_paint_object": ("Object", False),
|
||||||
"lamp": ("Lamp", False),
|
"lamp": ("Lamp", False),
|
||||||
"lattice": ("Lattice", False),
|
"lattice": ("Lattice", False),
|
||||||
@@ -1032,7 +1030,6 @@ context_type_map = {
|
|||||||
"vertex_paint_object": ("Object", False),
|
"vertex_paint_object": ("Object", False),
|
||||||
"visible_bases": ("ObjectBase", True),
|
"visible_bases": ("ObjectBase", True),
|
||||||
"visible_bones": ("EditBone", True),
|
"visible_bones": ("EditBone", True),
|
||||||
"visible_gpencil_layers": ("GPencilLayer", True),
|
|
||||||
"visible_objects": ("Object", True),
|
"visible_objects": ("Object", True),
|
||||||
"visible_pose_bones": ("PoseBone", True),
|
"visible_pose_bones": ("PoseBone", True),
|
||||||
"weight_paint_object": ("Object", False),
|
"weight_paint_object": ("Object", False),
|
||||||
@@ -1255,7 +1252,6 @@ def pyrna2sphinx(basepath):
|
|||||||
fw("\n\n")
|
fw("\n\n")
|
||||||
|
|
||||||
subclass_ids = [s.identifier for s in structs.values() if s.base is struct if not rna_info.rna_id_ignore(s.identifier)]
|
subclass_ids = [s.identifier for s in structs.values() if s.base is struct if not rna_info.rna_id_ignore(s.identifier)]
|
||||||
subclass_ids.sort()
|
|
||||||
if subclass_ids:
|
if subclass_ids:
|
||||||
fw("subclasses --- \n" + ", ".join((":class:`%s`" % s) for s in subclass_ids) + "\n\n")
|
fw("subclasses --- \n" + ", ".join((":class:`%s`" % s) for s in subclass_ids) + "\n\n")
|
||||||
|
|
||||||
@@ -1563,7 +1559,7 @@ def write_sphinx_conf_py(basepath):
|
|||||||
if ARGS.sphinx_theme != 'default':
|
if ARGS.sphinx_theme != 'default':
|
||||||
fw("html_theme = '%s'\n" % ARGS.sphinx_theme)
|
fw("html_theme = '%s'\n" % ARGS.sphinx_theme)
|
||||||
|
|
||||||
if ARGS.sphinx_theme == "blender-org":
|
if ARGS.sphinx_theme in SPHINX_THEMES['bf']:
|
||||||
fw("html_theme_path = ['../']\n")
|
fw("html_theme_path = ['../']\n")
|
||||||
# copied with the theme, exclude else we get an error [#28873]
|
# copied with the theme, exclude else we get an error [#28873]
|
||||||
fw("html_favicon = 'favicon.ico'\n") # in <theme>/static/
|
fw("html_favicon = 'favicon.ico'\n") # in <theme>/static/
|
||||||
@@ -1624,7 +1620,6 @@ def write_rst_contents(basepath):
|
|||||||
|
|
||||||
# py modules
|
# py modules
|
||||||
"bpy.utils",
|
"bpy.utils",
|
||||||
"bpy.utils.previews",
|
|
||||||
"bpy.path",
|
"bpy.path",
|
||||||
"bpy.app",
|
"bpy.app",
|
||||||
"bpy.app.handlers",
|
"bpy.app.handlers",
|
||||||
@@ -1670,7 +1665,6 @@ def write_rst_contents(basepath):
|
|||||||
fw(" bge.texture.rst\n\n")
|
fw(" bge.texture.rst\n\n")
|
||||||
fw(" bge.events.rst\n\n")
|
fw(" bge.events.rst\n\n")
|
||||||
fw(" bge.constraints.rst\n\n")
|
fw(" bge.constraints.rst\n\n")
|
||||||
fw(" bge.app.rst\n\n")
|
|
||||||
|
|
||||||
# rna generated change log
|
# rna generated change log
|
||||||
fw(title_string("API Info", "=", double=True))
|
fw(title_string("API Info", "=", double=True))
|
||||||
@@ -1827,7 +1821,6 @@ def copy_handwritten_rsts(basepath):
|
|||||||
"bge.texture",
|
"bge.texture",
|
||||||
"bge.events",
|
"bge.events",
|
||||||
"bge.constraints",
|
"bge.constraints",
|
||||||
"bge.app",
|
|
||||||
"bgl", # "Blender OpenGl wrapper"
|
"bgl", # "Blender OpenGl wrapper"
|
||||||
"gpu", # "GPU Shader Module"
|
"gpu", # "GPU Shader Module"
|
||||||
|
|
||||||
@@ -1981,7 +1974,7 @@ def main():
|
|||||||
copy_function=shutil.copy)
|
copy_function=shutil.copy)
|
||||||
|
|
||||||
# eventually, copy the theme dir
|
# eventually, copy the theme dir
|
||||||
if ARGS.sphinx_theme == "blender-org":
|
if ARGS.sphinx_theme in SPHINX_THEMES['bf']:
|
||||||
if os.path.exists(SPHINX_THEME_DIR):
|
if os.path.exists(SPHINX_THEME_DIR):
|
||||||
shutil.rmtree(SPHINX_THEME_DIR, True)
|
shutil.rmtree(SPHINX_THEME_DIR, True)
|
||||||
shutil.copytree(SPHINX_THEME_SVN_DIR,
|
shutil.copytree(SPHINX_THEME_SVN_DIR,
|
||||||
|
7
extern/CMakeLists.txt
vendored
7
extern/CMakeLists.txt
vendored
@@ -26,14 +26,11 @@
|
|||||||
# Otherwise we get warnings here that we cant fix in external projects
|
# Otherwise we get warnings here that we cant fix in external projects
|
||||||
remove_strict_flags()
|
remove_strict_flags()
|
||||||
|
|
||||||
|
add_subdirectory(colamd)
|
||||||
add_subdirectory(rangetree)
|
add_subdirectory(rangetree)
|
||||||
add_subdirectory(wcwidth)
|
add_subdirectory(wcwidth)
|
||||||
add_subdirectory(libmv)
|
add_subdirectory(libmv)
|
||||||
|
|
||||||
if(WITH_OPENNL)
|
|
||||||
add_subdirectory(colamd)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(WITH_BULLET)
|
if(WITH_BULLET)
|
||||||
if(NOT WITH_SYSTEM_BULLET)
|
if(NOT WITH_SYSTEM_BULLET)
|
||||||
add_subdirectory(bullet2)
|
add_subdirectory(bullet2)
|
||||||
@@ -69,7 +66,7 @@ if(WITH_IMAGE_REDCODE)
|
|||||||
add_subdirectory(libredcode)
|
add_subdirectory(libredcode)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(WITH_LZO AND NOT WITH_SYSTEM_LZO)
|
if(WITH_LZO)
|
||||||
add_subdirectory(lzo)
|
add_subdirectory(lzo)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
5
extern/bullet2/readme.txt
vendored
5
extern/bullet2/readme.txt
vendored
@@ -6,8 +6,3 @@ Erwin
|
|||||||
|
|
||||||
Apply patches/convex_hull.patch to add access to the convex hull
|
Apply patches/convex_hull.patch to add access to the convex hull
|
||||||
operation, used in the BMesh convex hull operator.
|
operation, used in the BMesh convex hull operator.
|
||||||
|
|
||||||
Documentation is available at:
|
|
||||||
http://code.google.com/p/bullet/source/browse/trunk/Bullet_User_Manual.pdf
|
|
||||||
and:
|
|
||||||
https://github.com/bulletphysics/bullet3/tree/master/docs
|
|
||||||
|
1
extern/bullet2/src/Bullet-C-Api.h
vendored
1
extern/bullet2/src/Bullet-C-Api.h
vendored
@@ -171,7 +171,6 @@ extern "C" {
|
|||||||
/* Convex Hull */
|
/* Convex Hull */
|
||||||
PL_DECLARE_HANDLE(plConvexHull);
|
PL_DECLARE_HANDLE(plConvexHull);
|
||||||
plConvexHull plConvexHullCompute(float (*coords)[3], int count);
|
plConvexHull plConvexHullCompute(float (*coords)[3], int count);
|
||||||
void plConvexHullDelete(plConvexHull hull);
|
|
||||||
int plConvexHullNumVertices(plConvexHull hull);
|
int plConvexHullNumVertices(plConvexHull hull);
|
||||||
int plConvexHullNumFaces(plConvexHull hull);
|
int plConvexHullNumFaces(plConvexHull hull);
|
||||||
void plConvexHullGetVertex(plConvexHull hull, int n, float coords[3], int *original_index);
|
void plConvexHullGetVertex(plConvexHull hull, int n, float coords[3], int *original_index);
|
||||||
|
@@ -15,7 +15,7 @@ subject to the following restrictions:
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @page Bullet Documentation
|
* @mainpage Bullet Documentation
|
||||||
*
|
*
|
||||||
* @section intro_sec Introduction
|
* @section intro_sec Introduction
|
||||||
* Bullet is a Collision Detection and Rigid Body Dynamics Library. The Library is Open Source and free for commercial use, under the ZLib license ( http://opensource.org/licenses/zlib-license.php ).
|
* Bullet is a Collision Detection and Rigid Body Dynamics Library. The Library is Open Source and free for commercial use, under the ZLib license ( http://opensource.org/licenses/zlib-license.php ).
|
||||||
|
0
extern/bullet2/src/BulletDynamics/ConstraintSolver/btSliderConstraint.cpp
vendored
Normal file → Executable file
0
extern/bullet2/src/BulletDynamics/ConstraintSolver/btSliderConstraint.cpp
vendored
Normal file → Executable file
0
extern/bullet2/src/BulletDynamics/ConstraintSolver/btSliderConstraint.h
vendored
Normal file → Executable file
0
extern/bullet2/src/BulletDynamics/ConstraintSolver/btSliderConstraint.h
vendored
Normal file → Executable file
@@ -413,12 +413,6 @@ plConvexHull plConvexHullCompute(float (*coords)[3], int count)
|
|||||||
return reinterpret_cast<plConvexHull>(computer);
|
return reinterpret_cast<plConvexHull>(computer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void plConvexHullDelete(plConvexHull hull)
|
|
||||||
{
|
|
||||||
btConvexHullComputer *computer(reinterpret_cast< btConvexHullComputer* >(hull));
|
|
||||||
delete computer;
|
|
||||||
}
|
|
||||||
|
|
||||||
int plConvexHullNumVertices(plConvexHull hull)
|
int plConvexHullNumVertices(plConvexHull hull)
|
||||||
{
|
{
|
||||||
btConvexHullComputer *computer(reinterpret_cast< btConvexHullComputer* >(hull));
|
btConvexHullComputer *computer(reinterpret_cast< btConvexHullComputer* >(hull));
|
||||||
|
2
extern/carve/bundle.sh
vendored
2
extern/carve/bundle.sh
vendored
@@ -105,6 +105,8 @@ blender_add_lib(extern_carve "\${SRC}" "\${INC}" "\${INC_SYS}")
|
|||||||
EOF
|
EOF
|
||||||
|
|
||||||
cat > SConscript << EOF
|
cat > SConscript << EOF
|
||||||
|
#!/usr/bin/python
|
||||||
|
|
||||||
# NOTE: This file is automatically generated by bundle.sh script
|
# NOTE: This file is automatically generated by bundle.sh script
|
||||||
# If you're doing changes in this file, please update template
|
# If you're doing changes in this file, please update template
|
||||||
# in that script too
|
# in that script too
|
||||||
|
24
extern/clew/include/clew.h
vendored
24
extern/clew/include/clew.h
vendored
@@ -2751,30 +2751,6 @@ CLEW_FUN_EXPORT PFNCLGETGLCONTEXTINFOKHR __clewGetGLContextInfoKH
|
|||||||
#endif
|
#endif
|
||||||
#define clGetGLContextInfoKHR CLEW_GET_FUN(__clewGetGLContextInfoKHR )
|
#define clGetGLContextInfoKHR CLEW_GET_FUN(__clewGetGLContextInfoKHR )
|
||||||
|
|
||||||
/* cl_ext */
|
|
||||||
|
|
||||||
/******************************************
|
|
||||||
* cl_nv_device_attribute_query extension *
|
|
||||||
******************************************/
|
|
||||||
/* cl_nv_device_attribute_query extension - no extension #define since it has no functions */
|
|
||||||
#define CL_DEVICE_COMPUTE_CAPABILITY_MAJOR_NV 0x4000
|
|
||||||
#define CL_DEVICE_COMPUTE_CAPABILITY_MINOR_NV 0x4001
|
|
||||||
#define CL_DEVICE_REGISTERS_PER_BLOCK_NV 0x4002
|
|
||||||
#define CL_DEVICE_WARP_SIZE_NV 0x4003
|
|
||||||
#define CL_DEVICE_GPU_OVERLAP_NV 0x4004
|
|
||||||
#define CL_DEVICE_KERNEL_EXEC_TIMEOUT_NV 0x4005
|
|
||||||
#define CL_DEVICE_INTEGRATED_MEMORY_NV 0x4006
|
|
||||||
|
|
||||||
/*********************************
|
|
||||||
* cl_amd_device_attribute_query *
|
|
||||||
*********************************/
|
|
||||||
#define CL_DEVICE_PROFILING_TIMER_OFFSET_AMD 0x4036
|
|
||||||
|
|
||||||
/*********************************
|
|
||||||
* cl_arm_printf extension
|
|
||||||
*********************************/
|
|
||||||
#define CL_PRINTF_CALLBACK_ARM 0x40B0
|
|
||||||
#define CL_PRINTF_BUFFERSIZE_ARM 0x40B1
|
|
||||||
|
|
||||||
#define CLEW_SUCCESS 0 //!< Success error code
|
#define CLEW_SUCCESS 0 //!< Success error code
|
||||||
#define CLEW_ERROR_OPEN_FAILED -1 //!< Error code for failing to open the dynamic library
|
#define CLEW_ERROR_OPEN_FAILED -1 //!< Error code for failing to open the dynamic library
|
||||||
|
7
extern/gtest/CMakeLists.txt
vendored
7
extern/gtest/CMakeLists.txt
vendored
@@ -21,13 +21,6 @@
|
|||||||
#
|
#
|
||||||
# ***** END GPL LICENSE BLOCK *****
|
# ***** END GPL LICENSE BLOCK *****
|
||||||
|
|
||||||
# avoid noisy warnings
|
|
||||||
if(CMAKE_COMPILER_IS_GNUCC)
|
|
||||||
remove_cc_flag(
|
|
||||||
"-Wmissing-declarations"
|
|
||||||
)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
set(INC
|
set(INC
|
||||||
.
|
.
|
||||||
include
|
include
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user