Compare commits
321 Commits
cmake-lib-
...
alembic_po
Author | SHA1 | Date | |
---|---|---|---|
9ad96b2689 | |||
0919a3d56d | |||
8c142af0b0 | |||
4b451838ed | |||
c27ef5692c | |||
045350c3b1 | |||
1d2aa62366 | |||
4ce017b4c8 | |||
6db876bef6 | |||
3e44712895 | |||
b01037b81d | |||
e84b0d456f | |||
5950b48328 | |||
229befd147 | |||
f77d75ed65 | |||
481ef9704d | |||
9ceb29d3cb | |||
65c1e00fb5 | |||
0a7a4d504b | |||
08017eef62 | |||
f3eb33c476 | |||
20a678f240 | |||
29b46e4ef2 | |||
bdae7f4aaa | |||
40d3784dc3 | |||
babaf408c4 | |||
21fa96a72b | |||
97410d71b3 | |||
5d04ddea64 | |||
279dfe6a18 | |||
b5fb274f43 | |||
878d09e65b | |||
238f3ac972 | |||
a0a3c29ae4 | |||
cf2c1a9062 | |||
2392ee9505 | |||
7c7d5645ca | |||
3079019ec1 | |||
8a021a7d1f | |||
59ed1d0a67 | |||
56acbcaa0e | |||
16258ddd03 | |||
aad1c616ca | |||
bafa8da0ca | |||
6f7b613715 | |||
67b7263d37 | |||
9772bae88e | |||
92598a6e22 | |||
e3a0736716 | |||
be4c8e6645 | |||
7677f393b4 | |||
b6b1eb5cbf | |||
ae87d1f50d | |||
06ebb145ae | |||
ed75af586e | |||
dfdb657427 | |||
3910ff3a50 | |||
b26ca84a82 | |||
2f1429a648 | |||
d71489b095 | |||
7945354567 | |||
d75dcf88d2 | |||
36be233e27 | |||
91c263f492 | |||
2b02c0b650 | |||
26b788e9bd | |||
a45805ed2f | |||
a7706b3642 | |||
e46dd19911 | |||
511d8a98c5 | |||
0a71eea5f1 | |||
a48d2e605c | |||
91f6635e09 | |||
b1bb3f8c82 | |||
3e16951ec6 | |||
3bd45d384b | |||
1a9706ceae | |||
5f62c931d1 | |||
16d259c842 | |||
4f5f03115b | |||
38342e444a | |||
6d67e67022 | |||
5bd80e9d2c | |||
752e396fcc | |||
4e0b7d2f18 | |||
fe840e6365 | |||
8cc679b8d6 | |||
a4f853ed6e | |||
f555bb8c61 | |||
ea601a4814 | |||
367278e1b5 | |||
ca4735a485 | |||
8cc176c14d | |||
9edeff8a04 | |||
47afa53913 | |||
5a86b97991 | |||
5dc9f664d0 | |||
a7e2ab42df | |||
bb2e8ee262 | |||
dd1cbab715 | |||
5c15fc8021 | |||
0798382397 | |||
4e0c2b4e4e | |||
806a276f30 | |||
a597d07011 | |||
56d2ad98b4 | |||
24c6137d46 | |||
33060f829a | |||
1a9c74a3a8 | |||
800299008a | |||
b3f4814a56 | |||
489a7cb7b7 | |||
814624ced9 | |||
26119375cc | |||
a83a61b03b | |||
901eae21d0 | |||
91aaf8df00 | |||
a26eecf2a1 | |||
7c991a601a | |||
4e5ee121af | |||
08b3ba5ecf | |||
9e2e24a1d0 | |||
97a4905d37 | |||
15d3314611 | |||
cce6123911 | |||
7f442aa4b1 | |||
5fa7283f86 | |||
8a2e1b5c16 | |||
a7178954bf | |||
4b7500353a | |||
58375c6f38 | |||
29c0a6b435 | |||
48c1a8a1d1 | |||
928aab7b4e | |||
4d8c66ddc1 | |||
1c20be94bc | |||
240768ec7c | |||
05e93c0b7f | |||
424bc7f3eb | |||
034b281f96 | |||
7a89dd778b | |||
205879263a | |||
0de4284c33 | |||
79b7817af3 | |||
b2a8b366eb | |||
43a89c3e93 | |||
b29d9de7ad | |||
517c95e723 | |||
2dc88a3715 | |||
5f4bde826b | |||
fca2eddf22 | |||
a2006f37b2 | |||
59727c736a | |||
d0a9f20257 | |||
386415509e | |||
4f2ab75bd4 | |||
212210b7ee | |||
d88cd0765c | |||
4716a87636 | |||
7a462c3e35 | |||
06338dbefd | |||
861e553f1d | |||
a7f5d1d662 | |||
7b16850073 | |||
0e2ae9007b | |||
ba2a3efddb | |||
1be812f426 | |||
90ce1a3e8f | |||
a7747a3e0c | |||
940c17af81 | |||
39a39a1474 | |||
b66c1f538e | |||
fe04d8b176 | |||
31d41d9b20 | |||
c3459108a3 | |||
b8b9788158 | |||
eae8bb4c8d | |||
7d89274d14 | |||
dc882a008c | |||
2366663ebb | |||
617ce27ffc | |||
3fb8d5a99a | |||
deeb09a5cb | |||
1309ca51fa | |||
12d4db406d | |||
f464829daf | |||
ca94528d71 | |||
8072c476b4 | |||
f4f7ab735b | |||
cee1ea5533 | |||
e7bdd29192 | |||
7d6779f88e | |||
567b10dc16 | |||
304e5a440a | |||
40a8ef5ef0 | |||
4edbd9586f | |||
5d9db8192d | |||
d3ef995912 | |||
743ee837b0 | |||
036d4fc3e0 | |||
a4644c3605 | |||
e89fd502d7 | |||
6cd3ebfc9f | |||
97a50e78ca | |||
8f4d98283d | |||
a920b652f9 | |||
e2e0a529d9 | |||
943691814c | |||
534760173b | |||
cdfe06bf51 | |||
74afc56120 | |||
6fac43eb87 | |||
f9b3d1c900 | |||
f306805ba2 | |||
721806fa76 | |||
8d2b7e552f | |||
501aae3aef | |||
66689345f0 | |||
8c6ca4499e | |||
9df9ee568a | |||
4b2fbebc27 | |||
e6f9f593f6 | |||
5a48a83663 | |||
c334b2862d | |||
c1343ab498 | |||
8e97a13d3d | |||
dd1f70ffb5 | |||
45e4ef57dc | |||
21577a64f6 | |||
e45e593c35 | |||
6ac889f2b3 | |||
c118d3d739 | |||
aa8e249136 | |||
a281b69bd2 | |||
a5b549bc63 | |||
f3b9f0c619 | |||
f065d25653 | |||
0da2707387 | |||
c5dc9b60ca | |||
9ba99ebd95 | |||
f237f67a99 | |||
ba90765050 | |||
df5cfbdc47 | |||
cb82ec10bd | |||
775a1287f5 | |||
2f5ef128b9 | |||
44057bdffb | |||
de604e1b6e | |||
8aa35aa014 | |||
6789e32e1d | |||
bea5cec25e | |||
b69a448531 | |||
47e2f7cf99 | |||
13f3b8ebdb | |||
a12f3d1e86 | |||
6ac4add2cc | |||
642b27fed1 | |||
af02fe2d2f | |||
001930bda0 | |||
2a66bf8acb | |||
c5d3303faf | |||
17bbbf1843 | |||
74aec79e0a | |||
117f4c7d0e | |||
dfc42af50b | |||
4acd9ac0a4 | |||
9c247486aa | |||
acb4e9fe2f | |||
3497e27bb2 | |||
67655f2a7f | |||
f4cf45dd0b | |||
9061ac3d99 | |||
a148ec6191 | |||
9e10e191c8 | |||
011b6e5b18 | |||
8cc7969925 | |||
5852d77fe7 | |||
75c6a496e9 | |||
aae656f9a3 | |||
72c6fe9b8c | |||
b2d6e736ea | |||
b633ea4854 | |||
ff0296184c | |||
a91f8543c7 | |||
9c05df76ad | |||
761248fa05 | |||
7c732da27b | |||
523ff63a82 | |||
290fe64048 | |||
42c0fdc276 | |||
039a1e76ee | |||
fe303b7294 | |||
527e8ce74d | |||
3d01d027a0 | |||
2f1554c176 | |||
98b67f1d97 | |||
db237d837a | |||
a33c9d2a24 | |||
1ffe06d066 | |||
704ec0da44 | |||
1d7bd0c5b2 | |||
4774c1f076 | |||
156a5f15b2 | |||
c1411359a9 | |||
7859dde7fe | |||
7b0b538a78 | |||
684ad4f91e | |||
34f8a87ca5 | |||
f956ff1fab | |||
453eccc1c8 | |||
66bfa1e35c | |||
e60715b9f1 | |||
201f43e2ff | |||
715a9b9ee3 | |||
5f6d8f2bc0 | |||
e223de3f37 | |||
5a014df0fc | |||
f038524278 | |||
d95d8b0928 | |||
1fe78b1378 | |||
fe781f7e4d |
339
CMakeLists.txt
339
CMakeLists.txt
@@ -53,9 +53,7 @@ if(NOT (${CMAKE_VERSION} VERSION_LESS 3.0))
|
||||
endif()
|
||||
|
||||
if(NOT EXECUTABLE_OUTPUT_PATH)
|
||||
set(FIRST_RUN TRUE)
|
||||
else()
|
||||
set(FIRST_RUN FALSE)
|
||||
set(FIRST_RUN "TRUE")
|
||||
endif()
|
||||
|
||||
# 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_RELWITHDEBINFO NDEBUG)
|
||||
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Set policy
|
||||
|
||||
@@ -130,7 +129,7 @@ macro(option_defaults_init)
|
||||
set(${_var} ON)
|
||||
list(APPEND _init_vars "${_var}")
|
||||
endforeach()
|
||||
unset(_var)
|
||||
unset(_INC)
|
||||
endmacro()
|
||||
|
||||
# remove from namespace
|
||||
@@ -158,30 +157,25 @@ option_defaults_init(
|
||||
_init_SDL
|
||||
_init_FFTW3
|
||||
_init_GAMEENGINE
|
||||
_init_OPENSUBDIV
|
||||
)
|
||||
|
||||
# customize...
|
||||
if (UNIX AND NOT APPLE)
|
||||
if(UNIX AND NOT APPLE)
|
||||
# some of these libraries are problematic on Linux
|
||||
# disable less important dependencies by default
|
||||
set(_init_BUILDINFO OFF)
|
||||
set(_init_CODEC_FFMPEG OFF)
|
||||
set(_init_CYCLES_OSL OFF)
|
||||
set(_init_IMAGE_OPENEXR OFF)
|
||||
set(_init_IMAGE_REDCODE OFF)
|
||||
set(_init_INPUT_NDOF OFF)
|
||||
set(_init_JACK OFF)
|
||||
set(_init_LIBMV_SCHUR_SPECIALIZATION OFF)
|
||||
set(_init_OPENCOLLADA OFF)
|
||||
set(_init_OPENCOLORIO OFF)
|
||||
set(_init_SDL OFF)
|
||||
set(_init_FFTW3 OFF)
|
||||
set(_init_OPENSUBDIV OFF)
|
||||
elseif(WIN32)
|
||||
set(_init_JACK OFF)
|
||||
elseif(APPLE)
|
||||
set(_init_INPUT_NDOF OFF)
|
||||
set(_init_JACK OFF)
|
||||
set(_init_OPENSUBDIV OFF)
|
||||
set(_init_GAMEENGINE OFF)
|
||||
endif()
|
||||
|
||||
|
||||
@@ -203,10 +197,11 @@ 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)
|
||||
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.
|
||||
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)
|
||||
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), installs to PYTHON_SITE_PACKAGES (or CMAKE_INSTALL_PREFIX if WITH_INSTALL_PORTABLE is enabled)." 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)" OFF)
|
||||
if(APPLE)
|
||||
option(WITH_PYTHON_FRAMEWORK "Enable building using the Python available in the framework (OSX only)" OFF)
|
||||
endif()
|
||||
@@ -226,15 +221,7 @@ mark_as_advanced(WITH_SYSTEM_BULLET)
|
||||
option(WITH_GAMEENGINE "Enable Game Engine" ${_init_GAMEENGINE})
|
||||
option(WITH_PLAYER "Build Player" OFF)
|
||||
option(WITH_OPENCOLORIO "Enable OpenColorIO color management" ${_init_OPENCOLORIO})
|
||||
|
||||
# Compositor
|
||||
option(WITH_COMPOSITOR "Enable the tile based nodal compositor" ON)
|
||||
option(WITH_COMPOSITOR_WERROR "Treat warnings as errors in compositor code" OFF)
|
||||
mark_as_advanced(WITH_COMPOSITOR_WERROR)
|
||||
|
||||
option(WITH_OPENSUBDIV "Enable OpenSubdiv for surface subdivision" _init_OPENSUBDIV)
|
||||
option(WITH_SUBSURF_WERROR "Treat warnings as errors in subsurf code" OFF)
|
||||
mark_as_advanced(WITH_COMPOSITOR_WERROR)
|
||||
option(WITH_COMPOSITOR "Enable the tile based nodal compositor" ON)
|
||||
|
||||
# GHOST Windowing Library Options
|
||||
option(WITH_GHOST_DEBUG "Enable debugging output for the GHOST library" OFF)
|
||||
@@ -252,13 +239,7 @@ option(WITH_HEADLESS "Build without graphical support (renderfarm, server m
|
||||
mark_as_advanced(WITH_HEADLESS)
|
||||
|
||||
option(WITH_AUDASPACE "Build with blenders audio library (only disable if you know what you're doing!)" ON)
|
||||
option(WITH_SYSTEM_AUDASPACE "Build with external audaspace library installed on the system (only enable if you know what you're doing!)" OFF)
|
||||
mark_as_advanced(WITH_AUDASPACE)
|
||||
mark_as_advanced(WITH_SYSTEM_AUDASPACE)
|
||||
|
||||
if(NOT WITH_AUDASPACE)
|
||||
set(WITH_SYSTEM_AUDASPACE OFF)
|
||||
endif()
|
||||
|
||||
option(WITH_OPENMP "Enable OpenMP (has to be supported by the compiler)" ON)
|
||||
|
||||
@@ -294,6 +275,10 @@ option(WITH_MOD_REMESH "Enable Remesh Modifier" ON)
|
||||
# mark_as_advanced(WITH_MOD_CLOTH_ELTOPO)
|
||||
option(WITH_MOD_OCEANSIM "Enable Ocean Modifier" OFF)
|
||||
|
||||
# Alembic
|
||||
option(WITH_ALEMBIC "Enable Alembic Support" OFF)
|
||||
option(WITH_HDF5 "Enable HDF5 Support for Alembic" OFF)
|
||||
|
||||
# Image format support
|
||||
option(WITH_OPENIMAGEIO "Enable OpenImageIO Support (http://www.openimageio.org)" ON)
|
||||
option(WITH_IMAGE_OPENEXR "Enable OpenEXR Support (http://www.openexr.com)" ${_init_IMAGE_OPENEXR})
|
||||
@@ -337,11 +322,9 @@ if(UNIX AND NOT APPLE)
|
||||
endif()
|
||||
|
||||
# Camera/motion tracking
|
||||
option(WITH_LIBMV "Enable Libmv structure from motion library" ON)
|
||||
option(WITH_LIBMV "Enable libmv structure from motion library" ON)
|
||||
option(WITH_LIBMV_SCHUR_SPECIALIZATIONS "Enable fixed-size schur specializations." ${_init_LIBMV_SCHUR_SPECIALIZATION})
|
||||
option(WITH_LIBMV_WERROR "Treat warnings as errors in Libmv (and Blender's motion tracking) code")
|
||||
mark_as_advanced(WITH_LIBMV_SCHUR_SPECIALIZATIONS)
|
||||
mark_as_advanced(WITH_LIBMV_WERROR)
|
||||
|
||||
# Freestyle
|
||||
option(WITH_FREESTYLE "Enable Freestyle (advanced edges rendering)" ON)
|
||||
@@ -375,20 +358,18 @@ if(UNIX AND NOT APPLE)
|
||||
endif()
|
||||
|
||||
# Cycles
|
||||
option(WITH_CYCLES "Enable Cycles Render Engine" ON)
|
||||
option(WITH_CYCLES_STANDALONE "Build Cycles standalone application" OFF)
|
||||
option(WITH_CYCLES_STANDALONE_GUI "Build Cycles standalone with GUI" OFF)
|
||||
option(WITH_CYCLES "Enable cycles Render Engine" ON)
|
||||
option(WITH_CYCLES_STANDALONE "Build cycles standalone application" 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_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")
|
||||
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 CACHE STRING "CUDA architectures to build binaries for")
|
||||
mark_as_advanced(CYCLES_CUDA_BINARIES_ARCH)
|
||||
unset(PLATFORM_DEFAULT)
|
||||
option(WITH_CYCLES_LOGGING "Build Cycles with logging support" ON)
|
||||
option(WITH_CYCLES_DEBUG "Build Cycles with extra debug capabilities" OFF)
|
||||
option(WITH_CYCLES_WERROR "Treat warnings as errors in Cycles code" OFF)
|
||||
option(WITH_CYCLES_LOGGING "Build cycles with logging support" ON)
|
||||
option(WITH_CYCLES_DEBUG "Build cycles with extra debug capabilities" OFF)
|
||||
mark_as_advanced(WITH_CYCLES_LOGGING)
|
||||
mark_as_advanced(WITH_CYCLES_DEBUG)
|
||||
mark_as_advanced(WITH_CYCLES_WERROR)
|
||||
|
||||
# LLVM
|
||||
option(WITH_LLVM "Use LLVM" OFF)
|
||||
@@ -434,6 +415,7 @@ 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_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_GPU_DEBUG "Create a debug OpenGL context (allows inserting custom messages and getting notifications for bad GL use)" OFF)
|
||||
|
||||
mark_as_advanced(
|
||||
WITH_GLEW_MX
|
||||
@@ -442,6 +424,7 @@ mark_as_advanced(
|
||||
WITH_GL_PROFILE_COMPAT
|
||||
WITH_GL_PROFILE_CORE
|
||||
WITH_GL_PROFILE_ES20
|
||||
WITH_GPU_DEBUG
|
||||
)
|
||||
|
||||
if(WITH_GL_PROFILE_COMPAT)
|
||||
@@ -469,10 +452,6 @@ endif()
|
||||
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
|
||||
option_defaults_clear()
|
||||
|
||||
@@ -511,11 +490,7 @@ if(APPLE)
|
||||
endif()
|
||||
|
||||
execute_process(COMMAND uname -r OUTPUT_VARIABLE MAC_SYS) # check for actual system-version
|
||||
if(${MAC_SYS} MATCHES 15)
|
||||
set(OSX_SYSTEM 10.11)
|
||||
# throw an error here, older cmake cannot handle 2 digit subversion!
|
||||
cmake_minimum_required(VERSION 3.0.0)
|
||||
elseif(${MAC_SYS} MATCHES 14)
|
||||
if(${MAC_SYS} MATCHES 14)
|
||||
set(OSX_SYSTEM 10.10)
|
||||
# throw an error here, older cmake cannot handle 2 digit subversion!
|
||||
cmake_minimum_required(VERSION 3.0.0)
|
||||
@@ -532,11 +507,13 @@ if(APPLE)
|
||||
else()
|
||||
set(OSX_SYSTEM unsupported)
|
||||
endif()
|
||||
message(STATUS "Detected system-version: " ${OSX_SYSTEM})
|
||||
|
||||
# workaround for incorrect cmake xcode lookup for developer previews - XCODE_VERSION does not take xcode-select path into accout
|
||||
# but would always look into /Applications/Xcode.app while dev versions are named Xcode<version>-DP<preview_number>
|
||||
execute_process(COMMAND xcode-select --print-path OUTPUT_VARIABLE XCODE_CHECK OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
string(REPLACE "/Contents/Developer" "" XCODE_BUNDLE ${XCODE_CHECK}) # truncate to bundlepath in any case
|
||||
message(STATUS "Xcode-bundle : " ${XCODE_BUNDLE})
|
||||
|
||||
if(${CMAKE_GENERATOR} MATCHES "Xcode")
|
||||
|
||||
@@ -564,8 +541,8 @@ if(APPLE)
|
||||
string(SUBSTRING "${XCODE_VERS_BUILD_NR}" 6 3 XCODE_VERSION) # truncate away build-nr
|
||||
unset(XCODE_VERS_BUILD_NR)
|
||||
endif()
|
||||
|
||||
message(STATUS "Detected OS X ${OSX_SYSTEM} and Xcode ${XCODE_VERSION} at ${XCODE_BUNDLE}")
|
||||
|
||||
message(STATUS "Detected Xcode-version: " ${XCODE_VERSION})
|
||||
|
||||
if(${XCODE_VERSION} VERSION_LESS 4.3)
|
||||
set(CMAKE_OSX_SYSROOT /Developer/SDKs/MacOSX${OSX_SYSTEM}.sdk CACHE PATH "" FORCE) # use guaranteed existing sdk
|
||||
@@ -664,27 +641,26 @@ if(NOT WITH_BOOST)
|
||||
|
||||
set_and_warn(WITH_CYCLES OFF)
|
||||
set_and_warn(WITH_AUDASPACE OFF)
|
||||
set_and_warn(WITH_ALEMBIC OFF)
|
||||
set_and_warn(WITH_INTERNATIONAL OFF)
|
||||
|
||||
set_and_warn(WITH_OPENAL OFF) # depends on AUDASPACE
|
||||
set_and_warn(WITH_GAMEENGINE OFF) # depends on AUDASPACE
|
||||
elseif(WITH_CYCLES OR WITH_OPENIMAGEIO OR WITH_AUDASPACE OR WITH_INTERNATIONAL)
|
||||
elseif(WITH_CYCLES OR WITH_OPENIMAGEIO OR WITH_AUDASPACE OR WITH_ALEMBIC OR WITH_INTERNATIONAL)
|
||||
# Keep enabled
|
||||
else()
|
||||
# Enabled but we don't need it
|
||||
set(WITH_BOOST OFF)
|
||||
endif()
|
||||
|
||||
# disable hdf5 if Alembic is disabled
|
||||
if(NOT WITH_ALEMBIC)
|
||||
set(WITH_HDF5 OFF)
|
||||
endif()
|
||||
|
||||
# auto enable openimageio for cycles
|
||||
if(WITH_CYCLES)
|
||||
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()
|
||||
|
||||
# auto enable openimageio linking dependencies
|
||||
@@ -693,6 +669,11 @@ if(WITH_OPENIMAGEIO)
|
||||
set(WITH_IMAGE_TIFF ON)
|
||||
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
|
||||
if(WITH_INSTALL_PORTABLE)
|
||||
set(CMAKE_SKIP_BUILD_RPATH TRUE)
|
||||
@@ -719,34 +700,6 @@ if(HAVE_STDBOOL_H)
|
||||
add_definitions(-DHAVE_STDBOOL_H)
|
||||
endif()
|
||||
|
||||
if(WITH_AUDASPACE)
|
||||
if(WITH_SYSTEM_AUDASPACE)
|
||||
set(AUDASPACE_DEFINITIONS
|
||||
-DWITH_AUDASPACE
|
||||
-DWITH_SYSTEM_AUDASPACE
|
||||
"-DAUD_DEVICE_H=<AUD_Device.h>"
|
||||
"-DAUD_SPECIAL_H=<AUD_Special.h>"
|
||||
"-DAUD_SOUND_H=<AUD_Sound.h>"
|
||||
"-DAUD_HANDLE_H=<AUD_Handle.h>"
|
||||
"-DAUD_SEQUENCE_H=<AUD_Sequence.h>"
|
||||
"-DAUD_TYPES_H=<AUD_Types.h>"
|
||||
"-DAUD_PYTHON_H=<python/PyAPI.h>"
|
||||
)
|
||||
else()
|
||||
set(AUDASPACE_C_INCLUDE_DIRS "${CMAKE_SOURCE_DIR}/intern/audaspace/intern")
|
||||
set(AUDASPACE_PY_INCLUDE_DIRS "${CMAKE_SOURCE_DIR}/intern/audaspace/intern")
|
||||
set(AUDASPACE_DEFINITIONS
|
||||
-DWITH_AUDASPACE
|
||||
"-DAUD_DEVICE_H=<AUD_C-API.h>"
|
||||
"-DAUD_SPECIAL_H=<AUD_C-API.h>"
|
||||
"-DAUD_SOUND_H=<AUD_C-API.h>"
|
||||
"-DAUD_HANDLE_H=<AUD_C-API.h>"
|
||||
"-DAUD_SEQUENCE_H=<AUD_C-API.h>"
|
||||
"-DAUD_TYPES_H=<AUD_Space.h>"
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Check for valid directories
|
||||
# ... a partial checkout may cause this.
|
||||
@@ -848,14 +801,6 @@ if(WITH_X11)
|
||||
|
||||
endif()
|
||||
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# Main Platform Checks
|
||||
#
|
||||
# - UNIX
|
||||
# - WIN32
|
||||
# - APPLE
|
||||
|
||||
if(UNIX AND NOT APPLE)
|
||||
macro(find_package_wrapper)
|
||||
if(WITH_STATIC_LIBS)
|
||||
@@ -924,13 +869,6 @@ if(UNIX AND NOT APPLE)
|
||||
endif()
|
||||
|
||||
# Audio IO
|
||||
if(WITH_SYSTEM_AUDASPACE)
|
||||
find_package_wrapper(Audaspace)
|
||||
if(NOT AUDASPACE_FOUND OR NOT AUDASPACE_C_FOUND)
|
||||
message(FATAL_ERROR "Audaspace external library not found!")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(WITH_OPENAL)
|
||||
find_package_wrapper(OpenAL)
|
||||
if(NOT OPENAL_FOUND)
|
||||
@@ -1130,30 +1068,84 @@ if(UNIX AND NOT APPLE)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# XXX Maybe most of this section should go into an llvm module?
|
||||
if(WITH_LLVM)
|
||||
find_package_wrapper(LLVM)
|
||||
|
||||
if(NOT LLVM_FOUND)
|
||||
set(WITH_LLVM OFF)
|
||||
message(STATUS "LLVM not found")
|
||||
if(LLVM_ROOT_DIR)
|
||||
if(NOT 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(NOT DEFINED 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 DEFINED 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 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_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()
|
||||
else()
|
||||
message(FATAL_ERROR "LLVM not found.")
|
||||
endif()
|
||||
|
||||
endif()
|
||||
|
||||
if(WITH_LLVM OR WITH_SDL_DYNLOAD)
|
||||
# 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_OPENSUBDIV)
|
||||
find_package_wrapper(OpenSubdiv)
|
||||
if(WITH_ALEMBIC)
|
||||
find_package_wrapper(Alembic)
|
||||
set(ALEMBIC_LIBRARIES ${ALEMBIC_LIBRARIES} ${BOOST_LIBRARIES})
|
||||
endif()
|
||||
|
||||
set(OPENSUBDIV_LIBRARIES ${OPENSUBDIV_LIBRARIES})
|
||||
set(OPENSUBDIV_LIBPATH) # TODO, remove and reference the absolute path everywhere
|
||||
|
||||
if(NOT OPENSUBDIV_FOUND)
|
||||
set(WITH_OPENSUBDIV OFF)
|
||||
message(STATUS "OpenSubdiv not found")
|
||||
endif()
|
||||
if(WITH_HDF5)
|
||||
find_package_wrapper(HDF5)
|
||||
endif()
|
||||
|
||||
# OpenSuse needs lutil, ArchLinux not, for now keep, can avoid by using --as-needed
|
||||
@@ -1182,25 +1174,6 @@ if(UNIX AND NOT APPLE)
|
||||
# GNU Compiler
|
||||
if(CMAKE_COMPILER_IS_GNUCC)
|
||||
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(STATUS "GNU gold linker isn't available, using the default system linker.")
|
||||
endif()
|
||||
unset(LD_VERSION)
|
||||
|
||||
# CLang is the same as GCC for now.
|
||||
elseif(CMAKE_C_COMPILER_ID MATCHES "Clang")
|
||||
set(PLATFORM_CFLAGS "-pipe -fPIC -funsigned-char -fno-strict-aliasing")
|
||||
@@ -1576,13 +1549,6 @@ elseif(WIN32)
|
||||
)
|
||||
endif()
|
||||
|
||||
if(WITH_OPENSUBDIV)
|
||||
set(OPENSUBDIV_INCLUDE_DIR ${LIBDIR}/opensubdiv/include)
|
||||
set(OPENSUBDIV_LIBPATH ${LIBDIR}/opensubdiv/lib)
|
||||
set(OPENSUBDIV_LIBRARIES ${OPENSUBDIV_LIBPATH}/osdCPU.lib ${OPENSUBDIV_LIBPATH}/osdGPU.lib)
|
||||
find_package(OpenSubdiv)
|
||||
endif()
|
||||
|
||||
if(WITH_SDL)
|
||||
set(SDL ${LIBDIR}/sdl)
|
||||
set(SDL_INCLUDE_DIR ${SDL}/include)
|
||||
@@ -1590,16 +1556,6 @@ elseif(WIN32)
|
||||
set(SDL_LIBPATH ${SDL}/lib)
|
||||
endif()
|
||||
|
||||
# Audio IO
|
||||
if(WITH_SYSTEM_AUDASPACE)
|
||||
set(AUDASPACE_INCLUDE_DIRS ${LIBDIR}/audaspace/include/audaspace)
|
||||
set(AUDASPACE_LIBRARIES ${LIBDIR}/audaspace/lib/audaspace.lib)
|
||||
set(AUDASPACE_C_INCLUDE_DIRS ${LIBDIR}/audaspace/include/audaspace)
|
||||
set(AUDASPACE_C_LIBRARIES ${LIBDIR}/audaspace/lib/audaspace-c.lib)
|
||||
set(AUDASPACE_PY_INCLUDE_DIRS ${LIBDIR}/audaspace/include/audaspace)
|
||||
set(AUDASPACE_PY_LIBRARIES ${LIBDIR}/audaspace/lib/audaspace-py.lib)
|
||||
endif()
|
||||
|
||||
# used in many places so include globally, like OpenGL
|
||||
blender_include_dirs_sys("${PTHREADS_INCLUDE_DIRS}")
|
||||
|
||||
@@ -1919,17 +1875,6 @@ elseif(APPLE)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(WITH_OPENSUBDIV)
|
||||
set(OPENSUBDIV ${LIBDIR}/opensubdiv)
|
||||
set(OPENSUBDIV_LIBPATH ${OPENSUBDIV}/lib)
|
||||
find_library(OSL_LIB_UTIL NAMES osdutil PATHS ${OPENSUBDIV_LIBPATH})
|
||||
find_library(OSL_LIB_CPU NAMES osdCPU PATHS ${OPENSUBDIV_LIBPATH})
|
||||
find_library(OSL_LIB_GPU NAMES osdGPU PATHS ${OPENSUBDIV_LIBPATH})
|
||||
set(OPENSUBDIV_INCLUDE_DIR ${OPENSUBDIV}/include)
|
||||
set(OPENSUBDIV_INCLUDE_DIRS ${OPENSUBDIV_INCLUDE_DIR})
|
||||
list(APPEND OPENSUBDIV_LIBRARIES ${OSL_LIB_UTIL} ${OSL_LIB_CPU} ${OSL_LIB_GPU})
|
||||
endif()
|
||||
|
||||
if(WITH_JACK)
|
||||
find_library(JACK_FRAMEWORK
|
||||
NAMES jackmp
|
||||
@@ -1953,14 +1898,14 @@ elseif(APPLE)
|
||||
if(NOT WITH_PYTHON_MODULE AND NOT WITH_PYTHON_FRAMEWORK)
|
||||
# normally cached but not since we include them with blender
|
||||
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_LIBPATH "${LIBDIR}/python/lib/python${PYTHON_VERSION}")
|
||||
# set(PYTHON_LINKFLAGS "-u _PyMac_Error") # won't build with this enabled
|
||||
else()
|
||||
# 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_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_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
|
||||
@@ -2270,6 +2215,12 @@ if(WITH_CYCLES)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(WITH_ALEMBIC)
|
||||
if(NOT WITH_BOOST)
|
||||
message(FATAL_ERROR "Alembic requires WITH_BOOST, the library may not have been found. Configure BOOST or disable WITH_ALEMBIC")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(WITH_INTERNATIONAL)
|
||||
if(NOT WITH_BOOST)
|
||||
message(FATAL_ERROR "Internationalization requires WITH_BOOST, the library may not have been found. Configure BOOST or disable WITH_INTERNATIONAL")
|
||||
@@ -2322,21 +2273,9 @@ endif()
|
||||
if(WITH_IMAGE_OPENJPEG)
|
||||
if(WITH_SYSTEM_OPENJPEG)
|
||||
# dealt with above
|
||||
set(OPENJPEG_DEFINES "")
|
||||
else()
|
||||
set(OPENJPEG_INCLUDE_DIRS "${CMAKE_SOURCE_DIR}/extern/libopenjpeg")
|
||||
set(OPENJPEG_DEFINES "-DOPJ_STATIC")
|
||||
set(OPENJPEG_LIBRARIES "extern_openjpeg")
|
||||
endif()
|
||||
# Special handling of Windows platform where openjpeg is always static.
|
||||
if(WIN32)
|
||||
set(OPENJPEG_DEFINES "-DOPJ_STATIC")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(WITH_LZO)
|
||||
if(NOT WITH_SYSTEM_LZO)
|
||||
set(LZO_LIBRARIES "extern_minilzo")
|
||||
add_definitions(-DOPJ_STATIC)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
@@ -2469,6 +2408,10 @@ if(WITH_GL_EGL)
|
||||
list(APPEND GL_DEFINITIONS -DWITH_EGL)
|
||||
endif()
|
||||
|
||||
if(WITH_GPU_DEBUG)
|
||||
list(APPEND GL_DEFINITIONS -DWITH_GPU_DEBUG)
|
||||
endif()
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Configure OpenMP.
|
||||
if(WITH_OPENMP)
|
||||
@@ -2605,7 +2548,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_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_FORMAT_SIGN -Wformat-signedness)
|
||||
|
||||
# gcc 4.2 gives annoying warnings on every file with this
|
||||
if(NOT "${CMAKE_C_COMPILER_VERSION}" VERSION_LESS "4.3")
|
||||
@@ -2633,16 +2575,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_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_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
|
||||
if(NOT "${CMAKE_C_COMPILER_VERSION}" VERSION_LESS "4.3")
|
||||
@@ -2875,29 +2807,25 @@ include(build_files/cmake/packaging.cmake)
|
||||
# Print Final Configuration
|
||||
|
||||
if(FIRST_RUN)
|
||||
|
||||
set(_config_msg "\nBlender Configuration\n=====================")
|
||||
|
||||
function(info_cfg_option
|
||||
_setting
|
||||
)
|
||||
|
||||
set(_msg " - ${_setting}")
|
||||
set(_config_msg "\n* Blender Configuration *")
|
||||
macro(info_cfg_option
|
||||
_setting)
|
||||
set(_msg " * ${_setting}")
|
||||
string(LENGTH "${_msg}" _len)
|
||||
while("32" GREATER "${_len}")
|
||||
set(_msg "${_msg} ")
|
||||
math(EXPR _len "${_len} + 1")
|
||||
endwhile()
|
||||
|
||||
set(_config_msg "${_config_msg}\n${_msg}${${_setting}}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
set(_config_msg "${_config_msg}\n${_msg}${${_setting}}")
|
||||
endmacro()
|
||||
|
||||
function(info_cfg_text
|
||||
_text
|
||||
)
|
||||
macro(info_cfg_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_CXX_COMPILER_ID}\"")
|
||||
@@ -2976,6 +2904,7 @@ if(FIRST_RUN)
|
||||
info_cfg_option(WITH_GL_PROFILE_COMPAT)
|
||||
info_cfg_option(WITH_GL_PROFILE_CORE)
|
||||
info_cfg_option(WITH_GL_PROFILE_ES20)
|
||||
info_cfg_option(WITH_GPU_DEBUG)
|
||||
if(WIN32)
|
||||
info_cfg_option(WITH_GL_ANGLE)
|
||||
endif()
|
||||
|
94
GNUmakefile
94
GNUmakefile
@@ -43,11 +43,6 @@ ifndef BUILD_DIR
|
||||
BUILD_DIR:=$(shell dirname "$(BLENDER_DIR)")/build_$(OS_NCASE)
|
||||
endif
|
||||
|
||||
# Allow to use alternative binary (pypy3, etc)
|
||||
ifndef PYTHON
|
||||
PYTHON:=python3
|
||||
endif
|
||||
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# additional targets for the build configuration
|
||||
@@ -81,20 +76,18 @@ endif
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Get the number of cores for threaded build
|
||||
ifndef NPROCS
|
||||
NPROCS:=1
|
||||
ifeq ($(OS), Linux)
|
||||
NPROCS:=$(shell nproc)
|
||||
endif
|
||||
ifeq ($(OS), Darwin)
|
||||
NPROCS:=$(shell sysctl -a | grep "hw.ncpu" | cut -d" " -f3)
|
||||
endif
|
||||
ifeq ($(OS), FreeBSD)
|
||||
NPROCS:=$(shell sysctl -a | grep "hw.ncpu" | cut -d" " -f2 )
|
||||
endif
|
||||
ifeq ($(OS), NetBSD)
|
||||
NPROCS:=$(shell sysctl -a | grep "hw.ncpu" | cut -d" " -f2 )
|
||||
endif
|
||||
NPROCS:=1
|
||||
ifeq ($(OS), Linux)
|
||||
NPROCS:=$(shell nproc)
|
||||
endif
|
||||
ifeq ($(OS), Darwin)
|
||||
NPROCS:=$(shell sysctl -a | grep "hw.ncpu" | cut -d" " -f3)
|
||||
endif
|
||||
ifeq ($(OS), FreeBSD)
|
||||
NPROCS:=$(shell sysctl -a | grep "hw.ncpu" | cut -d" " -f2 )
|
||||
endif
|
||||
ifeq ($(OS), NetBSD)
|
||||
NPROCS:=$(shell sysctl -a | grep "hw.ncpu" | cut -d" " -f2 )
|
||||
endif
|
||||
|
||||
|
||||
@@ -122,14 +115,14 @@ endif
|
||||
# Build Blender
|
||||
all: FORCE
|
||||
@echo
|
||||
@echo Configuring Blender in \"$(BUILD_DIR)\" ...
|
||||
@echo Configuring Blender ...
|
||||
|
||||
# # if test ! -f $(BUILD_DIR)/CMakeCache.txt ; then \
|
||||
# # $(CMAKE_CONFIG); \
|
||||
# # fi
|
||||
# if test ! -f $(BUILD_DIR)/CMakeCache.txt ; then \
|
||||
# $(CMAKE_CONFIG); \
|
||||
# fi
|
||||
|
||||
# # do this always incase of failed initial build, could be smarter here...
|
||||
@$(CMAKE_CONFIG)
|
||||
# do this always incase of failed initial build, could be smarter here...
|
||||
$(CMAKE_CONFIG)
|
||||
|
||||
@echo
|
||||
@echo Building Blender ...
|
||||
@@ -178,7 +171,7 @@ help: FORCE
|
||||
@echo ""
|
||||
@echo "Package Targets"
|
||||
@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 ""
|
||||
@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 " * update - updates git and all submodules"
|
||||
@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 " * doc_py - generate sphinx python api docs"
|
||||
@echo " * doc_doxy - generate doxygen C/C++ docs"
|
||||
@@ -223,7 +210,6 @@ help: FORCE
|
||||
@echo "Information"
|
||||
@echo " * help - this help message"
|
||||
@echo " * help_features - show a list of optional features when building"
|
||||
@echo ""
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Packages
|
||||
@@ -232,7 +218,7 @@ package_debian: FORCE
|
||||
cd build_files/package_spec ; DEB_BUILD_OPTIONS="parallel=$(NPROCS)" sh ./build_debian.sh
|
||||
|
||||
package_pacman: FORCE
|
||||
cd build_files/package_spec/pacman ; MAKEFLAGS="-j$(NPROCS)" makepkg
|
||||
cd build_files/package_spec/pacman ; MAKEFLAGS="-j$(NPROCS)" makepkg --asroot
|
||||
|
||||
package_archive: FORCE
|
||||
make -C "$(BUILD_DIR)" -s package_archive
|
||||
@@ -247,21 +233,21 @@ test: FORCE
|
||||
|
||||
# run pep8 check check on scripts we distribute.
|
||||
test_pep8: FORCE
|
||||
$(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"
|
||||
|
||||
# run some checks on our cmakefiles.
|
||||
test_cmake: FORCE
|
||||
$(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"
|
||||
|
||||
# run deprecation tests, see if we have anything to remove.
|
||||
test_deprecated: FORCE
|
||||
$(PYTHON) tests/check_deprecated.py
|
||||
python3 tests/check_deprecated.py
|
||||
|
||||
test_style_c: FORCE
|
||||
# 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/blender" \
|
||||
"$(BLENDER_DIR)/source/creator" \
|
||||
@@ -270,7 +256,7 @@ test_style_c: FORCE
|
||||
test_style_c_qtc: FORCE
|
||||
# run our own checks on C/C++ style
|
||||
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/blender" \
|
||||
"$(BLENDER_DIR)/source/creator" \
|
||||
@@ -282,7 +268,7 @@ test_style_c_qtc: FORCE
|
||||
|
||||
test_style_osl: FORCE
|
||||
# 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)/intern/cycles/kernel/shaders" \
|
||||
"$(BLENDER_DIR)/release/scripts/templates_osl"
|
||||
@@ -291,7 +277,7 @@ test_style_osl: FORCE
|
||||
test_style_osl_qtc: FORCE
|
||||
# run our own checks on C/C++ style
|
||||
USE_QTC_TASK=1 \
|
||||
PYTHONIOENCODING=utf_8 $(PYTHON) \
|
||||
PYTHONIOENCODING=utf_8 python3 \
|
||||
"$(BLENDER_DIR)/source/tools/check_source/check_style_c.py" \
|
||||
"$(BLENDER_DIR)/intern/cycles/kernel/shaders" \
|
||||
"$(BLENDER_DIR)/release/scripts/templates_osl" \
|
||||
@@ -304,10 +290,10 @@ test_style_osl_qtc: FORCE
|
||||
#
|
||||
|
||||
project_qtcreator: FORCE
|
||||
$(PYTHON) build_files/cmake/cmake_qtcreator_project.py "$(BUILD_DIR)"
|
||||
python3 build_files/cmake/cmake_qtcreator_project.py "$(BUILD_DIR)"
|
||||
|
||||
project_netbeans: FORCE
|
||||
$(PYTHON) build_files/cmake/cmake_netbeans_project.py "$(BUILD_DIR)"
|
||||
python3 build_files/cmake/cmake_netbeans_project.py "$(BUILD_DIR)"
|
||||
|
||||
project_eclipse: FORCE
|
||||
cmake -G"Eclipse CDT4 - Unix Makefiles" -H"$(BLENDER_DIR)" -B"$(BUILD_DIR)"
|
||||
@@ -320,39 +306,39 @@ project_eclipse: FORCE
|
||||
check_cppcheck: FORCE
|
||||
$(CMAKE_CONFIG)
|
||||
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"
|
||||
@echo "written: check_cppcheck.txt"
|
||||
|
||||
check_clang_array: FORCE
|
||||
$(CMAKE_CONFIG)
|
||||
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
|
||||
$(CMAKE_CONFIG)
|
||||
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
|
||||
$(CMAKE_CONFIG)
|
||||
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
|
||||
$(CMAKE_CONFIG)
|
||||
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
|
||||
cd "$(BUILD_DIR)" ; \
|
||||
PYTHONIOENCODING=utf_8 $(PYTHON) \
|
||||
PYTHONIOENCODING=utf_8 python3 \
|
||||
"$(BLENDER_DIR)/source/tools/check_source/check_spelling.py" \
|
||||
"$(BLENDER_DIR)/release/scripts"
|
||||
|
||||
check_spelling_c: FORCE
|
||||
cd "$(BUILD_DIR)" ; \
|
||||
PYTHONIOENCODING=utf_8 $(PYTHON) \
|
||||
PYTHONIOENCODING=utf_8 python3 \
|
||||
"$(BLENDER_DIR)/source/tools/check_source/check_spelling.py" \
|
||||
"$(BLENDER_DIR)/source" \
|
||||
"$(BLENDER_DIR)/intern/cycles" \
|
||||
@@ -361,7 +347,7 @@ check_spelling_c: FORCE
|
||||
|
||||
check_spelling_c_qtc: FORCE
|
||||
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" \
|
||||
"$(BLENDER_DIR)/intern/cycles" \
|
||||
@@ -372,7 +358,7 @@ check_spelling_c_qtc: FORCE
|
||||
|
||||
check_spelling_osl: FORCE
|
||||
cd "$(BUILD_DIR)" ;\
|
||||
PYTHONIOENCODING=utf_8 $(PYTHON) \
|
||||
PYTHONIOENCODING=utf_8 python3 \
|
||||
"$(BLENDER_DIR)/source/tools/check_source/check_spelling.py" \
|
||||
"$(BLENDER_DIR)/intern/cycles/kernel/shaders"
|
||||
|
||||
@@ -418,10 +404,10 @@ doc_dna: FORCE
|
||||
@echo "docs written into: '$(BLENDER_DIR)/doc/blender_file_format/dna.html'"
|
||||
|
||||
doc_man: FORCE
|
||||
$(PYTHON) doc/manpage/blender.1.py "$(BUILD_DIR)/bin/blender"
|
||||
python3 doc/manpage/blender.1.py "$(BUILD_DIR)/bin/blender"
|
||||
|
||||
help_features: FORCE
|
||||
@$(PYTHON) -c \
|
||||
@python3 -c \
|
||||
"import re; \
|
||||
print('\n'.join([ \
|
||||
w for l in open('"$(BLENDER_DIR)"/CMakeLists.txt', 'r').readlines() \
|
||||
|
80
SConstruct
80
SConstruct
@@ -331,10 +331,7 @@ if env['OURPLATFORM']=='darwin':
|
||||
print B.bc.OKGREEN + "Available SDK's: \n" + B.bc.ENDC + MACOSX_SDK_CHECK.replace('\t', '')
|
||||
|
||||
if env['MACOSX_SDK'] == '': # no set sdk, choosing best one found
|
||||
if 'OS X 10.11' in MACOSX_SDK_CHECK:
|
||||
env['MACOSX_DEPLOYMENT_TARGET'] = '10.6'
|
||||
env['MACOSX_SDK']='/Developer/SDKs/MacOSX10.11.sdk'
|
||||
elif 'OS X 10.10' in MACOSX_SDK_CHECK:
|
||||
if 'OS X 10.10' in MACOSX_SDK_CHECK:
|
||||
env['MACOSX_DEPLOYMENT_TARGET'] = '10.6'
|
||||
env['MACOSX_SDK']='/Developer/SDKs/MacOSX10.10.sdk'
|
||||
elif 'OS X 10.9' in MACOSX_SDK_CHECK:
|
||||
@@ -473,14 +470,6 @@ if env['OURPLATFORM']=='darwin':
|
||||
################### 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['OURPLATFORM'] in ('win32-vc', 'win64-vc'):
|
||||
env['CCFLAGS'].append('/openmp')
|
||||
@@ -517,10 +506,6 @@ if env['WITH_BF_STATICCXX']:
|
||||
else:
|
||||
print '\tcould not remove stdc++ library from LLIBS, WITH_BF_STATICCXX may not work for your platform'
|
||||
|
||||
# audaspace is needed for the game engine
|
||||
if not env['WITH_BF_AUDASPACE']:
|
||||
env['WITH_BF_GAMEENGINE'] = False
|
||||
|
||||
# check target for blenderplayer. Set WITH_BF_PLAYER if found on cmdline
|
||||
if 'blenderplayer' in B.targets:
|
||||
env['WITH_BF_PLAYER'] = True
|
||||
@@ -547,25 +532,13 @@ else:
|
||||
env['CPPFLAGS'].append('-D__LITTLE_ENDIAN__')
|
||||
|
||||
# TODO, make optional (as with CMake)
|
||||
env['CPPFLAGS'].append('-DWITH_AUDASPACE')
|
||||
env['CPPFLAGS'].append('-DWITH_AVI')
|
||||
env['CPPFLAGS'].append('-DWITH_OPENNL')
|
||||
|
||||
if env['OURPLATFORM'] not in ('win32-vc', 'win64-vc'):
|
||||
env['CPPFLAGS'].append('-DHAVE_STDBOOL_H')
|
||||
|
||||
# Audaspace
|
||||
|
||||
if env['WITH_BF_AUDASPACE']:
|
||||
env['BF_AUDASPACE_C_INC'] = '#intern/audaspace/intern'
|
||||
env['BF_AUDASPACE_PY_INC'] = '#intern/audaspace/intern'
|
||||
env['BF_AUDASPACE_DEF'] = ['WITH_AUDASPACE']
|
||||
env['BF_AUDASPACE_DEF'].append('AUD_DEVICE_H="<AUD_C-API.h>"')
|
||||
env['BF_AUDASPACE_DEF'].append('AUD_SPECIAL_H="<AUD_C-API.h>"')
|
||||
env['BF_AUDASPACE_DEF'].append('AUD_SOUND_H="<AUD_C-API.h>"')
|
||||
env['BF_AUDASPACE_DEF'].append('AUD_HANDLE_H="<AUD_C-API.h>"')
|
||||
env['BF_AUDASPACE_DEF'].append('AUD_SEQUENCE_H="<AUD_C-API.h>"')
|
||||
env['BF_AUDASPACE_DEF'].append('AUD_TYPES_H="<AUD_Space.h>"')
|
||||
|
||||
# OpenGL
|
||||
|
||||
if env['WITH_BF_GL_PROFILE_COMPAT']:
|
||||
@@ -785,11 +758,6 @@ if B.targets != ['cudakernels']:
|
||||
data_to_c_simple("release/datafiles/preview_cycles.blend")
|
||||
|
||||
# --- glsl ---
|
||||
data_to_c_simple("source/blender/gpu/shaders/gpu_shader_geometry.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_vert.glsl")
|
||||
data_to_c_simple("source/blender/gpu/shaders/gpu_shader_material.glsl")
|
||||
@@ -810,7 +778,6 @@ if B.targets != ['cudakernels']:
|
||||
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/opensubdiv/gpu_shader_opensubd_display.glsl")
|
||||
|
||||
# --- blender ---
|
||||
data_to_c_simple("release/datafiles/bfont.pfb")
|
||||
@@ -904,21 +871,19 @@ B.init_lib_dict()
|
||||
|
||||
##### END SETUP ##########
|
||||
|
||||
## Auto-configuration run-time tests
|
||||
if B.targets != ['cudakernels']:
|
||||
# Put all auto configuration run-time tests here
|
||||
|
||||
from FindSharedPtr import FindSharedPtr
|
||||
from FindUnorderedMap import FindUnorderedMap
|
||||
from FindSharedPtr import FindSharedPtr
|
||||
from FindUnorderedMap import FindUnorderedMap
|
||||
|
||||
conf = Configure(env)
|
||||
old_linkflags = conf.env['LINKFLAGS']
|
||||
conf.env.Append(LINKFLAGS=env['PLATFORM_LINKFLAGS'])
|
||||
|
||||
# Put all tests here
|
||||
FindSharedPtr(conf)
|
||||
FindUnorderedMap(conf)
|
||||
|
||||
conf.env['LINKFLAGS'] = old_linkflags
|
||||
env = conf.Finish()
|
||||
conf = Configure(env)
|
||||
old_linkflags = conf.env['LINKFLAGS']
|
||||
conf.env.Append(LINKFLAGS=env['PLATFORM_LINKFLAGS'])
|
||||
FindSharedPtr(conf)
|
||||
FindUnorderedMap(conf)
|
||||
conf.env['LINKFLAGS'] = old_linkflags
|
||||
env = conf.Finish()
|
||||
|
||||
# End of auto configuration
|
||||
|
||||
@@ -1050,16 +1015,14 @@ if env['OURPLATFORM']!='darwin':
|
||||
dir=os.path.join(env['BF_INSTALLDIR'], VERSION, 'scripts', 'addons','cycles', 'kernel')
|
||||
source=os.listdir('intern/cycles/kernel')
|
||||
if '__pycache__' in source: source.remove('__pycache__')
|
||||
source.remove('kernel.cpp')
|
||||
source.remove('CMakeLists.txt')
|
||||
source.remove('SConscript')
|
||||
source.remove('svm')
|
||||
source.remove('closure')
|
||||
source.remove('geom')
|
||||
source.remove('shaders')
|
||||
source.remove('osl')
|
||||
source.remove('split')
|
||||
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_half.h')
|
||||
source.append('intern/cycles/util/util_math.h')
|
||||
@@ -1085,12 +1048,6 @@ if env['OURPLATFORM']!='darwin':
|
||||
if '__pycache__' in source: source.remove('__pycache__')
|
||||
source=['intern/cycles/kernel/geom/'+s for s in 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
|
||||
dir=os.path.join(env['BF_INSTALLDIR'], VERSION, 'scripts', 'addons','cycles', 'license')
|
||||
@@ -1322,15 +1279,6 @@ if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'win64-vc', 'linuxcross'):
|
||||
windlls = env.Install(dir=env['BF_INSTALLDIR'], source = dllsources)
|
||||
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':
|
||||
dllsources = []
|
||||
|
||||
|
@@ -27,16 +27,13 @@ getopt \
|
||||
-o s:i:t:h \
|
||||
--long source:,install:,tmp:,info:,threads:,help,no-sudo,with-all,with-opencollada,\
|
||||
ver-ocio:,ver-oiio:,ver-llvm:,ver-osl:,\
|
||||
force-all,force-python,force-numpy,force-boost,force-ocio,force-oiio,force-llvm,force-osl,force-osd,\
|
||||
force-ffmpeg,force-opencollada,\
|
||||
skip-python,skip-numpy,skip-boost,skip-ocio,skip-openexr,skip-oiio,skip-llvm,skip-osl,skip-osd,\
|
||||
skip-ffmpeg,skip-opencollada,\
|
||||
force-all,force-python,force-numpy,force-boost,force-ocio,force-oiio,force-llvm,force-osl,force-opencollada,\
|
||||
force-ffmpeg,\
|
||||
skip-python,skip-numpy,skip-boost,skip-ocio,skip-openexr,skip-oiio,skip-llvm,skip-osl,skip-ffmpeg,skip-opencollada,\
|
||||
required-numpy: \
|
||||
-- "$@" \
|
||||
)
|
||||
|
||||
COMMANDLINE=$@
|
||||
|
||||
DISTRO=""
|
||||
RPM=""
|
||||
SRC="$HOME/src/blender-deps"
|
||||
@@ -44,7 +41,6 @@ INST="/opt/lib"
|
||||
TMP="/tmp"
|
||||
CWD=$PWD
|
||||
INFO_PATH=$CWD
|
||||
SCRIPT_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
|
||||
|
||||
# Do not install some optional, potentially conflicting libs by default...
|
||||
WITH_ALL=false
|
||||
@@ -99,6 +95,9 @@ ARGUMENTS_INFO="\"COMMAND LINE ARGUMENTS:
|
||||
--with-opencollada
|
||||
Build and install the OpenCOLLADA libraries.
|
||||
|
||||
--with-alembic
|
||||
Build and install the Alembic library.
|
||||
|
||||
--ver-ocio=<ver>
|
||||
Force version of OCIO library.
|
||||
|
||||
@@ -142,15 +141,15 @@ ARGUMENTS_INFO="\"COMMAND LINE ARGUMENTS:
|
||||
--force-osl
|
||||
Force the rebuild of OpenShadingLanguage.
|
||||
|
||||
--force-osd
|
||||
Force the rebuild of OpenSubdiv.
|
||||
|
||||
--force-opencollada
|
||||
Force the rebuild of OpenCOLLADA.
|
||||
|
||||
--force-ffmpeg
|
||||
Force the rebuild of FFMpeg.
|
||||
|
||||
--force-alembic
|
||||
Force the rebuild of Alembic.
|
||||
|
||||
Note about the --force-foo options:
|
||||
* They obviously only have an effect if those libraries are built by this script
|
||||
(i.e. if there is no available and satisfactory package)!
|
||||
@@ -181,15 +180,15 @@ ARGUMENTS_INFO="\"COMMAND LINE ARGUMENTS:
|
||||
--skip-osl
|
||||
Unconditionally skip OpenShadingLanguage installation/building.
|
||||
|
||||
--skip-osd
|
||||
Unconditionally skip OpenSubdiv installation/building.
|
||||
|
||||
--skip-opencollada
|
||||
Unconditionally skip OpenCOLLADA installation/building.
|
||||
|
||||
--skip-ffmpeg
|
||||
Unconditionally skip FFMpeg installation/building.
|
||||
|
||||
--skip-alembic
|
||||
Unconditionally skip Alembic installation/building.
|
||||
|
||||
--required-numpy
|
||||
Use this in case your distro features a valid python package, but no matching Numpy one.
|
||||
It will force compilation of both python and numpy\""
|
||||
@@ -243,12 +242,6 @@ OSL_VERSION_MIN=$OSL_VERSION
|
||||
OSL_FORCE_REBUILD=false
|
||||
OSL_SKIP=false
|
||||
|
||||
# OpenSubdiv needs to be compiled for now
|
||||
OSD_VERSION="3.0.2"
|
||||
OSD_VERSION_MIN=$OSD_VERSION
|
||||
OSD_FORCE_REBUILD=false
|
||||
OSD_SKIP=false
|
||||
|
||||
# Version??
|
||||
OPENCOLLADA_VERSION="1.3"
|
||||
OPENCOLLADA_FORCE_REBUILD=false
|
||||
@@ -280,6 +273,11 @@ MP3LAME_DEV=""
|
||||
OPENJPEG_USE=false
|
||||
OPENJPEG_DEV=""
|
||||
|
||||
ALEMBIC_VERSION="1.5.5"
|
||||
ALEMBIC_VERSION_MIN="1.5.5"
|
||||
ALEMBIC_FORCE_REBUILD=false
|
||||
ALEMBIC_SKIP=false
|
||||
|
||||
# Switch to english language, else some things (like check_package_DEB()) won't work!
|
||||
LANG_BACK=$LANG
|
||||
LANG=""
|
||||
@@ -391,11 +389,6 @@ while true; do
|
||||
OSL_VERSION_MIN=$OSL_VERSION
|
||||
shift; shift; continue
|
||||
;;
|
||||
--ver-osd)
|
||||
OSD_VERSION="$2"
|
||||
OSD_VERSION_MIN=$OSD_VERSION
|
||||
shift; shift; continue
|
||||
;;
|
||||
--force-all)
|
||||
PYTHON_FORCE_REBUILD=true
|
||||
NUMPY_FORCE_REBUILD=true
|
||||
@@ -405,7 +398,6 @@ while true; do
|
||||
OIIO_FORCE_REBUILD=true
|
||||
LLVM_FORCE_REBUILD=true
|
||||
OSL_FORCE_REBUILD=true
|
||||
OSD_FORCE_REBUILD=true
|
||||
OPENCOLLADA_FORCE_REBUILD=true
|
||||
FFMPEG_FORCE_REBUILD=true
|
||||
shift; continue
|
||||
@@ -439,15 +431,15 @@ while true; do
|
||||
--force-osl)
|
||||
OSL_FORCE_REBUILD=true; shift; continue
|
||||
;;
|
||||
--force-osd)
|
||||
OSD_FORCE_REBUILD=true; shift; continue
|
||||
;;
|
||||
--force-opencollada)
|
||||
OPENCOLLADA_FORCE_REBUILD=true; shift; continue
|
||||
;;
|
||||
--force-ffmpeg)
|
||||
FFMPEG_FORCE_REBUILD=true; shift; continue
|
||||
;;
|
||||
--force-alembic)
|
||||
ALEMBIC_FORCE_REBUILD=true; shift; continue
|
||||
;;
|
||||
--skip-python)
|
||||
PYTHON_SKIP=true; shift; continue
|
||||
;;
|
||||
@@ -472,15 +464,15 @@ while true; do
|
||||
--skip-osl)
|
||||
OSL_SKIP=true; shift; continue
|
||||
;;
|
||||
--skip-osd)
|
||||
OSD_SKIP=true; shift; continue
|
||||
;;
|
||||
--skip-opencollada)
|
||||
OPENCOLLADA_SKIP=true; shift; continue
|
||||
;;
|
||||
--skip-ffmpeg)
|
||||
FFMPEG_SKIP=true; shift; continue
|
||||
;;
|
||||
--skip-alembic)
|
||||
ALEMBIC_SKIP=true; shift; continue
|
||||
;;
|
||||
--required-numpy)
|
||||
NUMPY_REQUIRED=true; shift; continue
|
||||
;;
|
||||
@@ -537,18 +529,13 @@ OSL_SOURCE_REPO=( "https://github.com/Nazg-Gul/OpenShadingLanguage.git" )
|
||||
OSL_SOURCE_REPO_UID="22ee5ea298fd215430dfbd160b5aefd507f06db0"
|
||||
OSL_SOURCE_REPO_BRANCH="blender-fixes"
|
||||
|
||||
OSD_USE_REPO=true
|
||||
# Script foo to make the version string compliant with the archive name:
|
||||
# ${Varname//SearchForThisChar/ReplaceWithThisChar}
|
||||
OSD_SOURCE=( "https://github.com/PixarAnimationStudios/OpenSubdiv/archive/v${OSD_VERSION//./_}.tar.gz" )
|
||||
OSD_SOURCE_REPO=( "https://github.com/PixarAnimationStudios/OpenSubdiv.git" )
|
||||
OSD_SOURCE_REPO_UID="404659fffa659da075d1c9416e4fc939139a84ee"
|
||||
OSD_SOURCE_REPO_BRANCH="dev"
|
||||
|
||||
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" )
|
||||
|
||||
ALEMBIC_SOURCE=( "https://code.google.com/p/alembic/" )
|
||||
ALEMBIC_REPO_UID=( "1_05_05" )
|
||||
|
||||
|
||||
##### Generic Helpers #####
|
||||
|
||||
@@ -875,6 +862,7 @@ compile_Boost() {
|
||||
# Rebuild dependecies as well!
|
||||
OIIO_FORCE_REBUILD=true
|
||||
OSL_FORCE_REBUILD=true
|
||||
ALEMBIC_FORCE_REBUILD=true
|
||||
|
||||
prepare_opt
|
||||
|
||||
@@ -1379,7 +1367,19 @@ compile_LLVM() {
|
||||
cd $_src
|
||||
|
||||
# XXX Ugly patching hack!
|
||||
patch -p1 -i "$SCRIPT_DIR/install_deps_patches/llvm.patch"
|
||||
cat << EOF | patch -p1
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -13,7 +13,7 @@
|
||||
set(LLVM_VERSION_MAJOR 3)
|
||||
set(LLVM_VERSION_MINOR 1)
|
||||
|
||||
-set(PACKAGE_VERSION "\${LLVM_VERSION_MAJOR}.\${LLVM_VERSION_MINOR}svn")
|
||||
+set(PACKAGE_VERSION "\${LLVM_VERSION_MAJOR}.\${LLVM_VERSION_MINOR}")
|
||||
|
||||
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
|
||||
|
||||
EOF
|
||||
|
||||
cd $CWD
|
||||
|
||||
@@ -1398,7 +1398,7 @@ compile_LLVM() {
|
||||
cmake_d="$cmake_d -D CMAKE_INSTALL_PREFIX=$_inst"
|
||||
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_ENABLE_TERMINFO=OFF"
|
||||
cmake_d="$cmake_d -D -DLLVM_ENABLE_TERMINFO=OFF"
|
||||
|
||||
if [ -d $_FFI_INCLUDE_DIR ]; then
|
||||
cmake_d="$cmake_d -D FFI_INCLUDE_DIR=$_FFI_INCLUDE_DIR"
|
||||
@@ -1449,10 +1449,10 @@ compile_OSL() {
|
||||
|
||||
# Clean install if needed!
|
||||
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
|
||||
clean_OSL
|
||||
fi
|
||||
#~ clean_OSL
|
||||
#~ fi
|
||||
|
||||
if [ ! -d $_inst ]; then
|
||||
INFO "Building OpenShadingLanguage-$OSL_VERSION"
|
||||
@@ -1481,9 +1481,6 @@ compile_OSL() {
|
||||
# Stick to same rev as windows' libs...
|
||||
git checkout $OSL_SOURCE_REPO_UID
|
||||
git reset --hard
|
||||
|
||||
# XXX Ugly patching hack!
|
||||
patch -p1 -i "$SCRIPT_DIR/install_deps_patches/osl.patch"
|
||||
fi
|
||||
|
||||
# Always refresh the whole build!
|
||||
@@ -1525,9 +1522,6 @@ compile_OSL() {
|
||||
fi
|
||||
fi
|
||||
|
||||
#~ cmake_d="$cmake_d -D CMAKE_EXPORT_COMPILE_COMMANDS=ON"
|
||||
#~ cmake_d="$cmake_d -D CMAKE_VERBOSE_MAKEFILE=ON"
|
||||
|
||||
cmake $cmake_d ..
|
||||
|
||||
make -j$THREADS && make install
|
||||
@@ -1552,99 +1546,6 @@ compile_OSL() {
|
||||
run_ldconfig "osl"
|
||||
}
|
||||
|
||||
#### Build OSD ####
|
||||
_init_osd() {
|
||||
_src=$SRC/OpenSubdiv-$OSD_VERSION
|
||||
_git=true
|
||||
_inst=$INST/osd-$OSD_VERSION
|
||||
_inst_shortcut=$INST/osd
|
||||
}
|
||||
|
||||
clean_OSD() {
|
||||
_init_osd
|
||||
_clean
|
||||
}
|
||||
|
||||
compile_OSD() {
|
||||
# To be changed each time we make edits that would modify the compiled result!
|
||||
osd_magic=0
|
||||
_init_osd
|
||||
|
||||
# Clean install if needed!
|
||||
magic_compile_check osd-$OSD_VERSION $osd_magic
|
||||
if [ $? -eq 1 -o $OSD_FORCE_REBUILD == true ]; then
|
||||
clean_OSD
|
||||
fi
|
||||
|
||||
if [ ! -d $_inst ]; then
|
||||
INFO "Building OpenSubdiv-$OSD_VERSION"
|
||||
|
||||
prepare_opt
|
||||
|
||||
if [ ! -d $_src ]; then
|
||||
mkdir -p $SRC
|
||||
|
||||
if [ $OSD_USE_REPO == true ]; then
|
||||
git clone ${OSD_SOURCE_REPO[0]} $_src
|
||||
else
|
||||
download OSD_SOURCE[@] "$_src.tar.gz"
|
||||
INFO "Unpacking OpenSubdiv-$OSD_VERSION"
|
||||
tar -C $SRC --transform "s,(.*/?)OpenSubdiv-[^/]*(.*),\1OpenSubdiv-$OSD_VERSION\2,x" \
|
||||
-xf $_src.tar.gz
|
||||
fi
|
||||
fi
|
||||
|
||||
cd $_src
|
||||
|
||||
if [ $OSD_USE_REPO == true ]; then
|
||||
git remote set-url origin ${OSD_SOURCE_REPO[0]}
|
||||
# XXX For now, always update from latest repo...
|
||||
git pull --no-edit -X theirs origin $OSD_SOURCE_REPO_BRANCH
|
||||
# Stick to same rev as windows' libs...
|
||||
git checkout $OSD_SOURCE_REPO_UID
|
||||
git reset --hard
|
||||
fi
|
||||
|
||||
# Always refresh the whole build!
|
||||
if [ -d build ]; then
|
||||
rm -rf build
|
||||
fi
|
||||
mkdir build
|
||||
cd build
|
||||
|
||||
cmake_d="-D CMAKE_BUILD_TYPE=Release"
|
||||
cmake_d="$cmake_d -D CMAKE_INSTALL_PREFIX=$_inst"
|
||||
# ptex is only needed when nicholas bishop is ready
|
||||
cmake_d="$cmake_d -D NO_PTEX=1"
|
||||
cmake_d="$cmake_d -D NO_CLEW=1"
|
||||
# maya plugin, docs, tutorials, regression tests and examples are not needed
|
||||
cmake_d="$cmake_d -D NO_MAYA=1 -D NO_DOC=1 -D NO_TUTORIALS=1 -D NO_REGRESSION=1 -DNO_EXAMPLES=1"
|
||||
|
||||
cmake $cmake_d ..
|
||||
|
||||
make -j$THREADS && make install
|
||||
make clean
|
||||
|
||||
if [ -d $_inst ]; then
|
||||
_create_inst_shortcut
|
||||
else
|
||||
ERROR "OpenSubdiv-$OSD_VERSION failed to compile, exiting"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
magic_compile_set osd-$OSD_VERSION $osd_magic
|
||||
|
||||
cd $CWD
|
||||
INFO "Done compiling OpenSubdiv-$OSD_VERSION!"
|
||||
else
|
||||
INFO "Own OpenSubdiv-$OSD_VERSION is up to date, nothing to do!"
|
||||
INFO "If you want to force rebuild of this lib, use the --force-osd option."
|
||||
fi
|
||||
|
||||
run_ldconfig "osd"
|
||||
}
|
||||
|
||||
|
||||
#### Build OpenCOLLADA ####
|
||||
_init_opencollada() {
|
||||
_src=$SRC/OpenCOLLADA-$OPENCOLLADA_VERSION
|
||||
@@ -1660,7 +1561,7 @@ clean_OpenCOLLADA() {
|
||||
|
||||
compile_OpenCOLLADA() {
|
||||
# To be changed each time we make edits that would modify the compiled results!
|
||||
opencollada_magic=9
|
||||
opencollada_magic=8
|
||||
_init_opencollada
|
||||
|
||||
# Clean install if needed!
|
||||
@@ -1829,6 +1730,165 @@ compile_FFmpeg() {
|
||||
fi
|
||||
}
|
||||
|
||||
#### Build ALEMBIC ####
|
||||
_init_alembic() {
|
||||
_src=$SRC/Alembic-$ALEMBIC_VERSION
|
||||
_hg=false
|
||||
_inst=$INST/alembic-$ALEMBIC_VERSION
|
||||
_inst_shortcut=$INST/alembic
|
||||
}
|
||||
|
||||
clean_alembic() {
|
||||
_init_alembic
|
||||
_clean
|
||||
}
|
||||
|
||||
compile_alembic() {
|
||||
# To be changed each time we make edits that would modify the compiled result!
|
||||
alembic_magic=1
|
||||
_init_alembic
|
||||
|
||||
# Clean install if needed!
|
||||
magic_compile_check alembic-$ALEMBIC_VERSION $alembic_magic
|
||||
if [ $? -eq 1 -o $ALEMBIC_FORCE_REBUILD == true ]; then
|
||||
clean_alembic
|
||||
fi
|
||||
|
||||
if [ ! -d $_inst ]; then
|
||||
INFO "Building Alembic-$ALEMBIC_VERSION"
|
||||
|
||||
prepare_opt
|
||||
|
||||
if [ ! -d $_src ]; then
|
||||
mkdir -p $SRC
|
||||
hg clone -u $ALEMBIC_REPO_UID $ALEMBIC_SOURCE $_src
|
||||
fi
|
||||
|
||||
cd $_src
|
||||
|
||||
# XXX Ugly patching hack!
|
||||
# Alembice cmake files are erratic, to say the least
|
||||
# have to manually disable a bunch of crap here
|
||||
cat << EOF | patch -p1
|
||||
--- a/CMakeLists.txt Mon Jul 28 10:09:21 2014 -0700
|
||||
+++ b/CMakeLists.txt Thu Oct 16 15:03:27 2014 +0200
|
||||
@@ -57,9 +57,9 @@
|
||||
${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH} )
|
||||
SET( VERSION ${PROJECT_VERSION} )
|
||||
|
||||
-SET( ALEMBIC_NO_TESTS FALSE )
|
||||
-SET( ALEMBIC_NO_BOOTSTRAP FALSE )
|
||||
-SET( ALEMBIC_NO_OPENGL FALSE )
|
||||
+SET( ALEMBIC_NO_TESTS TRUE )
|
||||
+SET( ALEMBIC_NO_BOOTSTRAP TRUE )
|
||||
+SET( ALEMBIC_NO_OPENGL TRUE )
|
||||
|
||||
MESSAGE(STATUS "CMAKE SYSTEM NAME = ${CMAKE_SYSTEM_NAME}" )
|
||||
|
||||
@@ -306,15 +306,15 @@
|
||||
ENDIF()
|
||||
|
||||
# Include PyAlembic stuff
|
||||
-IF(DEFINED USE_PYALEMBIC AND NOT USE_PYALEMBIC)
|
||||
- MESSAGE(STATUS "Skipping Alembic Python bindings")
|
||||
-ELSE()
|
||||
- MESSAGE(STATUS "About to include Python cmake files")
|
||||
- ADD_SUBDIRECTORY( python )
|
||||
-ENDIF()
|
||||
+#IF(DEFINED USE_PYALEMBIC AND NOT USE_PYALEMBIC)
|
||||
+# MESSAGE(STATUS "Skipping Alembic Python bindings")
|
||||
+#ELSE()
|
||||
+# MESSAGE(STATUS "About to include Python cmake files")
|
||||
+# ADD_SUBDIRECTORY( python )
|
||||
+#ENDIF()
|
||||
|
||||
# Example code not supported
|
||||
-ADD_SUBDIRECTORY( examples )
|
||||
+#ADD_SUBDIRECTORY( examples )
|
||||
|
||||
# Uncomment to build python docs Makefile (requires Sphinx)
|
||||
# Run `make docs` from build root
|
||||
|
||||
EOF
|
||||
|
||||
cat << EOF | patch -p1
|
||||
--- a/lib/Alembic/Util/CMakeLists.txt Mon Jul 28 10:09:21 2014 -0700
|
||||
+++ b/lib/Alembic/Util/CMakeLists.txt Thu Oct 16 15:03:27 2014 +0200
|
||||
@@ -65,7 +65,7 @@
|
||||
DESTINATION include/Alembic/Util
|
||||
PERMISSIONS OWNER_READ GROUP_READ WORLD_READ )
|
||||
|
||||
-IF( NOT ALEMBIC_NO_TESTS )
|
||||
- ADD_SUBDIRECTORY( Tests )
|
||||
-ENDIF()
|
||||
+#IF( NOT ALEMBIC_NO_TESTS )
|
||||
+# ADD_SUBDIRECTORY( Tests )
|
||||
+#ENDIF()
|
||||
|
||||
EOF
|
||||
|
||||
cat << EOF | patch -p1
|
||||
--- a/python/CMakeLists.txt Mon Jul 28 10:09:21 2014 -0700
|
||||
+++ b/python/CMakeLists.txt Thu Oct 16 14:20:25 2014 +0200
|
||||
@@ -35,4 +35,4 @@
|
||||
|
||||
ADD_SUBDIRECTORY( PyAlembic )
|
||||
ADD_SUBDIRECTORY( PyAbcOpenGL )
|
||||
-ADD_SUBDIRECTORY( examples )
|
||||
+#ADD_SUBDIRECTORY( examples )
|
||||
|
||||
EOF
|
||||
|
||||
# Always refresh the whole build!
|
||||
# XXX 'build' directory is included in Alembic sources, don't touch that
|
||||
if [ -d blender_build ]; then
|
||||
rm -rf blender_build
|
||||
fi
|
||||
mkdir blender_build
|
||||
cd blender_build
|
||||
|
||||
# XXX Alembic cmake doesn't take these as options
|
||||
# XXX Alembic creates a subfolder itself ... rather than fix their
|
||||
# stupid build files, just expect this here by using $INST as prefix
|
||||
export ALEMBIC_INSTALL_PREFIX=$INST
|
||||
|
||||
cmake_d="-D CMAKE_BUILD_TYPE=Release"
|
||||
cmake_d="$cmake_d -D CMAKE_INSTALL_PREFIX=$INST"
|
||||
cmake_d="$cmake_d -D BUILD_SHARED_LIBS=ON"
|
||||
cmake_d="$cmake_d -D BUILD_STATIC_LIBS=ON"
|
||||
cmake_d="$cmake_d -D USE_PYTHON=OFF"
|
||||
cmake_d="$cmake_d -D USE_PYALEMBIC=OFF"
|
||||
cmake_d="$cmakd_d -D ALEMBIC_PYTHON_INCLUDE_DIR=/use/include/python2.7" # XXX BAD
|
||||
cmake_d="$cmakd_d -D ALEMBIC_PYTHON_LIBRARY=/use/lib/python2.7" # XXX BAD
|
||||
cmake_d="$cmake_d -D USE_PYILMBASE=OFF"
|
||||
cmake_d="$cmake_d -D ILMBASE_ROOT=$INST/openexr"
|
||||
cmake_d="$cmake_d -D ALEMBIC_ILMBASE_HALF_LIB=$INST/openexr/lib/libHalf.la"
|
||||
cmake_d="$cmake_d -D ALEMBIC_ILMBASE_IEX_LIB=$INST/openexr/lib/libIex-2_1.la"
|
||||
cmake_d="$cmake_d -D ALEMBIC_ILMBASE_ILMTHREAD_LIB=$INST/openexr/lib/libIlmThread-2_1.la"
|
||||
cmake_d="$cmake_d -D ALEMBIC_ILMBASE_IMATH_LIB=$INST/openexr/lib/libImath-2_1.la"
|
||||
|
||||
cmake $cmake_d ../
|
||||
|
||||
make -j$THREADS && make install
|
||||
make clean
|
||||
|
||||
if [ -d $_inst ]; then
|
||||
_create_inst_shortcut
|
||||
else
|
||||
ERROR "Alembic-$ALEMBIC_VERSION failed to compile, exiting"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
magic_compile_set alembic-$ALEMBIC_VERSION $alembic_magic
|
||||
|
||||
cd $CWD
|
||||
INFO "Done compiling Alembic-$ALEMBIC_VERSION!"
|
||||
else
|
||||
INFO "Own Alembic-$ALEMBIC_VERSION is up to date, nothing to do!"
|
||||
INFO "If you want to force rebuild of this lib, use the --force-alembic option."
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
#### Install on DEB-like ####
|
||||
get_package_version_DEB() {
|
||||
@@ -1936,9 +1996,8 @@ install_DEB() {
|
||||
THEORA_DEV="libtheora-dev"
|
||||
|
||||
_packages="gawk cmake cmake-curses-gui scons build-essential libjpeg-dev libpng-dev \
|
||||
libfreetype6-dev libx11-dev \
|
||||
libxcursor-dev libxi-dev wget libsqlite3-dev libxrandr-dev libxinerama-dev \
|
||||
libbz2-dev libncurses5-dev libssl-dev liblzma-dev libreadline-dev $OPENJPEG_DEV \
|
||||
libfreetype6-dev libx11-dev libxi-dev wget libsqlite3-dev libbz2-dev \
|
||||
libncurses5-dev libssl-dev liblzma-dev libreadline-dev $OPENJPEG_DEV \
|
||||
libopenal-dev libglew-dev libglewmx-dev yasm $THEORA_DEV $VORBIS_DEV $OGG_DEV \
|
||||
libsdl1.2-dev libfftw3-dev patch bzip2 libxml2-dev libtinyxml-dev"
|
||||
|
||||
@@ -2116,7 +2175,8 @@ install_DEB() {
|
||||
if [ $? -eq 0 ]; then
|
||||
install_packages_DEB libboost-locale$boost_version-dev libboost-filesystem$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 libboost-python$boost_version-dev \
|
||||
libboost-program-options$boost_version-dev libboost-wave$boost_version-dev
|
||||
clean_Boost
|
||||
else
|
||||
compile_Boost
|
||||
@@ -2213,20 +2273,6 @@ install_DEB() {
|
||||
fi
|
||||
fi
|
||||
|
||||
PRINT ""
|
||||
if $OSD_SKIP; then
|
||||
WARNING "Skipping OpenSubdiv installation, as requested..."
|
||||
else
|
||||
if $have_llvm; then
|
||||
install_packages_DEB flex bison libtbb-dev
|
||||
# No package currently!
|
||||
PRINT ""
|
||||
compile_OSD
|
||||
else
|
||||
WARNING "No LLVM available, cannot build OSD!"
|
||||
fi
|
||||
fi
|
||||
|
||||
if $WITH_OPENCOLLADA; then
|
||||
PRINT ""
|
||||
if $OPENCOLLADA_SKIP; then
|
||||
@@ -2263,6 +2309,14 @@ install_DEB() {
|
||||
# fi
|
||||
compile_FFmpeg
|
||||
fi
|
||||
|
||||
if $ALEMBIC_SKIP; then
|
||||
WARNING "Skipping Alembic installation, as requested..."
|
||||
else
|
||||
install_packages_DEB libhdf5-dev
|
||||
install_packages_DEB libpython2.7-dev # XXX nasty hack, should be done better ...
|
||||
compile_alembic
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
@@ -2425,9 +2479,9 @@ install_RPM() {
|
||||
OGG_DEV="libogg-devel"
|
||||
THEORA_DEV="libtheora-devel"
|
||||
|
||||
_packages="gcc gcc-c++ git make cmake scons libtiff-devel libjpeg-devel\
|
||||
libpng-devel libX11-devel libXi-devel libXcursor-devel libXrandr-devel libXinerama-devel \
|
||||
wget ncurses-devel readline-devel $OPENJPEG_DEV openal-soft-devel \
|
||||
_packages="gcc gcc-c++ make scons libtiff-devel freetype-devel libjpeg-devel\
|
||||
libpng-devel libX11-devel libXi-devel wget ncurses-devel \
|
||||
readline-devel $OPENJPEG_DEV openal-soft-devel \
|
||||
glew-devel yasm $THEORA_DEV $VORBIS_DEV $OGG_DEV patch \
|
||||
libxml2-devel yaml-cpp-devel tinyxml-devel"
|
||||
|
||||
@@ -2439,7 +2493,7 @@ install_RPM() {
|
||||
if [ $RPM = "FEDORA" -o $RPM = "RHEL" ]; then
|
||||
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
|
||||
_packages="$_packages jack-audio-connection-kit-devel"
|
||||
@@ -2477,7 +2531,7 @@ install_RPM() {
|
||||
elif [ $RPM = "SUSE" ]; then
|
||||
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 ""
|
||||
install_packages_RPM $_packages
|
||||
@@ -2533,7 +2587,7 @@ install_RPM() {
|
||||
if $NUMPY_SKIP; then
|
||||
WARNING "Skipping NumPy installation, as requested..."
|
||||
else
|
||||
check_package_version_ge_RPM python3-numpy $NUMPY_VERSION_MIN
|
||||
check_package_version_match_RPM python3-numpy $NUMPY_VERSION_MIN
|
||||
if [ $? -eq 0 ]; then
|
||||
install_packages_RPM python3-numpy
|
||||
elif $NUMPY_REQUIRED; then
|
||||
@@ -2654,7 +2708,7 @@ install_RPM() {
|
||||
else
|
||||
if $have_llvm; then
|
||||
# No package currently!
|
||||
install_packages_RPM flex bison
|
||||
install_packages_RPM flex bison git
|
||||
if [ $RPM = "FEDORA" -o $RPM = "RHEL" ]; then
|
||||
install_packages_RPM tbb-devel
|
||||
fi
|
||||
@@ -2665,29 +2719,12 @@ install_RPM() {
|
||||
fi
|
||||
fi
|
||||
|
||||
PRINT ""
|
||||
if $OSD_SKIP; then
|
||||
WARNING "Skipping OpenSubdiv installation, as requested..."
|
||||
else
|
||||
if $have_llvm; then
|
||||
# No package currently!
|
||||
install_packages_RPM flex bison
|
||||
if [ $RPM = "FEDORA" -o $RPM = "RHEL" ]; then
|
||||
install_packages_RPM tbb-devel
|
||||
fi
|
||||
PRINT ""
|
||||
compile_OSD
|
||||
else
|
||||
WARNING "No LLVM available, cannot build OSD!"
|
||||
fi
|
||||
fi
|
||||
|
||||
if $WITH_OPENCOLLADA; then
|
||||
PRINT ""
|
||||
if $OPENCOLLADA_SKIP; then
|
||||
WARNING "Skipping OpenCOLLADA installation, as requested..."
|
||||
else
|
||||
install_packages_RPM pcre-devel
|
||||
install_packages_RPM pcre-devel git
|
||||
# Find path to libxml shared lib...
|
||||
_XML2_LIB=`rpm -ql libxml2-devel | grep -e ".*/libxml2.so"`
|
||||
# No package...
|
||||
@@ -2795,8 +2832,7 @@ install_ARCH() {
|
||||
OGG_DEV="libogg"
|
||||
THEORA_DEV="libtheora"
|
||||
|
||||
_packages="base-devel git scons cmake \
|
||||
libxi libxcursor libxrandr libxinerama glew libpng libtiff wget openal \
|
||||
_packages="base-devel scons cmake libxi glew libpng libtiff wget openal \
|
||||
$OPENJPEG_DEV $VORBIS_DEV $OGG_DEV $THEORA_DEV yasm sdl fftw \
|
||||
libxml2 yaml-cpp tinyxml"
|
||||
|
||||
@@ -2983,7 +3019,7 @@ install_ARCH() {
|
||||
clean_OSL
|
||||
else
|
||||
#XXX Note: will fail to build with LLVM 3.2!
|
||||
install_packages_ARCH intel-tbb
|
||||
install_packages_ARCH git intel-tbb
|
||||
PRINT ""
|
||||
compile_OSL
|
||||
fi
|
||||
@@ -2992,20 +3028,6 @@ install_ARCH() {
|
||||
fi
|
||||
fi
|
||||
|
||||
PRINT ""
|
||||
if $OSD_SKIP; then
|
||||
WARNING "Skipping OpenSubdiv installation, as requested..."
|
||||
else
|
||||
if $have_llvm; then
|
||||
# No package currently? Just build for now!
|
||||
install_packages_ARCH intel-tbb
|
||||
PRINT ""
|
||||
compile_OSD
|
||||
else
|
||||
WARNING "No LLVM available, cannot build OSD!"
|
||||
fi
|
||||
fi
|
||||
|
||||
if $WITH_OPENCOLLADA; then
|
||||
PRINT ""
|
||||
if $OPENCOLLADA_SKIP; then
|
||||
@@ -3016,7 +3038,7 @@ install_ARCH() {
|
||||
install_packages_ARCH opencollada
|
||||
clean_OpenCOLLADA
|
||||
else
|
||||
install_packages_ARCH pcre
|
||||
install_packages_ARCH pcre git
|
||||
PRINT ""
|
||||
compile_OpenCOLLADA
|
||||
fi
|
||||
@@ -3117,10 +3139,6 @@ print_info() {
|
||||
PRINT "Often, changes in the libs built by this script, or in your distro package, cannot be handled simply, so..."
|
||||
PRINT ""
|
||||
PRINT ""
|
||||
PRINT "Ran with:"
|
||||
PRINT " install_deps.sh $COMMANDLINE"
|
||||
PRINT ""
|
||||
PRINT ""
|
||||
PRINT "If you're using CMake add this to your configuration flags:"
|
||||
|
||||
_buildargs=""
|
||||
@@ -3185,14 +3203,6 @@ print_info() {
|
||||
_buildargs="$_buildargs $_1 $_2"
|
||||
fi
|
||||
|
||||
if [ -d $INST/osd ]; then
|
||||
_1="-D WITH_OPENSUBDIV=ON"
|
||||
_2="-D OPENSUBDIV_ROOT_DIR=$INST/osd"
|
||||
PRINT " $_1"
|
||||
PRINT " $_2"
|
||||
_buildargs="$_buildargs $_1 $_2"
|
||||
fi
|
||||
|
||||
if $WITH_OPENCOLLADA; then
|
||||
_1="-D WITH_OPENCOLLADA=ON"
|
||||
PRINT " $_1"
|
||||
@@ -3212,6 +3222,12 @@ print_info() {
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -d $INST/alembic ]; then
|
||||
_1="-D ALEMBIC_ROOT_DIR=$INST/alembic"
|
||||
PRINT " $_1"
|
||||
_buildargs="$_buildargs $_1"
|
||||
fi
|
||||
|
||||
PRINT ""
|
||||
PRINT "Or even simpler, just run (in your blender-source dir):"
|
||||
PRINT " make -j$THREADS BUILD_CMAKE_ARGS=\"$_buildargs\""
|
||||
@@ -3259,13 +3275,6 @@ print_info() {
|
||||
PRINT "BF_OSL = '$INST/osl'"
|
||||
fi
|
||||
|
||||
if [ "$OSD_SKIP" = false ]; then
|
||||
PRINT "WITH_BF_OPENSUBDIV = True"
|
||||
if [ -d $INST/osd ]; then
|
||||
PRINT "BF_OPENSUBDIV = '$INST/osd'"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$BOOST_SKIP" = false ]; then
|
||||
PRINT "WITH_BF_BOOST = True"
|
||||
if [ -d $INST/boost ]; then
|
||||
@@ -3288,6 +3297,13 @@ print_info() {
|
||||
PRINT "BF_FFMPEG_LIB = 'avformat avcodec swscale avutil avdevice `print_info_ffmpeglink`'"
|
||||
fi
|
||||
|
||||
if [ "$ALEMBIC_SKIP" = false ]; then
|
||||
PRINT "WITH_BF_ALEMBIC = True"
|
||||
if [ -d $INST/alembic ]; then
|
||||
PRINT "BF_ALEMBIC = '$INST/alembic'"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$WITH_ALL" = false ]; then
|
||||
PRINT "WITH_BF_3DMOUSE = False"
|
||||
# No libspacenav in official arch repos...
|
||||
@@ -3312,27 +3328,7 @@ elif [ -f /etc/redhat-release -o /etc/SuSE-release ]; then
|
||||
DISTRO="RPM"
|
||||
install_RPM
|
||||
else
|
||||
ERROR "Failed to detect distribution type."
|
||||
PRINT ""
|
||||
PRINT "Your distribution is not supported by this script, you'll have to install dependencies and"
|
||||
PRINT "dev packages yourself (list non-exhaustive, but should cover most needs):"
|
||||
PRINT " * Basics of dev environment (cmake or scons, gcc, svn , git, ...)."
|
||||
PRINT " * Python$PYTHON_VERSION_MIN, numpy."
|
||||
PRINT " * libboost$BOOST_VERSION_MIN (locale, filesystem, regex, system, thread, wave)."
|
||||
PRINT " * libjpeg, libpng, libtiff, libopenjpeg, libopenal."
|
||||
PRINT " * ffmpeg (with libvorbis, libogg, libtheora, libx264, libmp3lame, libxvidcore, libvpx, ...)."
|
||||
PRINT " * libx11, libxcursor, libxi, libxrandr, libxinerama (and other libx... as needed)."
|
||||
PRINT " * libsqlite3, libbz2, libssl, libfftw3, libxml2, libtinyxml, yasm, libyaml-cpp."
|
||||
PRINT " * libsdl1.2, libglew, libglewmx."
|
||||
PRINT " * libopencolorio$OCIO_VERSION_MIN, libopenexr$OPENEXR_VERSION_MIN, libopenimageio$OIIO_VERSION_MIN."
|
||||
PRINT " * llvm-$LLVM_VERSION (with clang)."
|
||||
PRINT ""
|
||||
PRINT "Most of up-listed packages are available in recent distributions. The following are likely not,"
|
||||
PRINT "you'll have to build them (they are all optional, though):"
|
||||
PRINT " * OpenShadingLanguage (from https://github.com/Nazg-Gul/OpenShadingLanguage.git, branch blender-fixes, commit 22ee5ea298fd215430dfbd160b5aefd507f06db0)."
|
||||
PRINT " * OpenSubDiv (from https://github.com/PixarAnimationStudios/OpenSubdiv.git, branch dev, commit 404659fffa659da075d1c9416e4fc939139a84ee)."
|
||||
PRINT " * OpenCollada (from https://github.com/KhronosGroup/OpenCOLLADA.git, branch master, commit 3335ac164e68b2512a40914b14c74db260e6ff7d)."
|
||||
PRINT ""
|
||||
ERROR "Failed to detect distribution type"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
@@ -1,12 +0,0 @@
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -13,7 +13,7 @@
|
||||
set(LLVM_VERSION_MAJOR 3)
|
||||
set(LLVM_VERSION_MINOR 1)
|
||||
|
||||
-set(PACKAGE_VERSION "\${LLVM_VERSION_MAJOR}.\${LLVM_VERSION_MINOR}svn")
|
||||
+set(PACKAGE_VERSION "\${LLVM_VERSION_MAJOR}.\${LLVM_VERSION_MINOR}")
|
||||
|
||||
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
|
||||
|
||||
|
@@ -1,12 +0,0 @@
|
||||
--- a/src/shaders/CMakeLists.txt
|
||||
+++ b/src/shaders/CMakeLists.txt
|
||||
@@ -27,7 +27,7 @@ macro (osl_compile oslsrc objlist headers)
|
||||
message (STATUS "cmd: ${CMAKE_CURRENT_BINARY_DIR}/../oslc/oslc ${oslsrc}")
|
||||
endif ()
|
||||
add_custom_command (OUTPUT ${osofile}
|
||||
- COMMAND "${CMAKE_CURRENT_BINARY_DIR}/../oslc/oslc" ${oslsrc}
|
||||
+ COMMAND "${CMAKE_CURRENT_BINARY_DIR}/../oslc/oslc" "-o" ${osofile} ${oslsrc}
|
||||
MAIN_DEPENDENCY ${oslsrc}
|
||||
DEPENDS ${${headers}} ${oslsrc} "${CMAKE_CURRENT_BINARY_DIR}/stdosl.h" "${CMAKE_CURRENT_BINARY_DIR}/../oslc/oslc"
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
||||
|
@@ -2,5 +2,4 @@ BF_BUILDDIR = '../blender-build/linux-glibc211-i686'
|
||||
BF_INSTALLDIR = '../blender-install/linux-glibc211-i686'
|
||||
BF_NUMJOBS = 1
|
||||
|
||||
#BF_CYCLES_CUDA_BINARIES_ARCH = ['sm_20', 'sm_21', 'sm_30', 'sm_35', 'sm_50', 'sm_52']
|
||||
BF_CYCLES_CUDA_BINARIES_ARCH = []
|
||||
BF_CYCLES_CUDA_BINARIES_ARCH = ['sm_20', 'sm_21', 'sm_30', 'sm_35', 'sm_50', 'sm_52']
|
||||
|
@@ -166,14 +166,18 @@ BF_BOOST_LIBPATH = '${BF_BOOST}/lib'
|
||||
# Ocean Simulation
|
||||
WITH_BF_OCEANSIM = True
|
||||
|
||||
# OpenSubdiv
|
||||
WITH_BF_OPENSUBDIV = True
|
||||
WITH_BF_STATICOPENSUBDIV = True
|
||||
BF_OPENSUBDIV = '/opt/lib/opensubdiv'
|
||||
BF_OPENSUBDIV_INC = '${BF_OPENSUBDIV}/include'
|
||||
BF_OPENSUBDIV_LIB = 'osdCPU osdGPU'
|
||||
BF_OPENSUBDIV_LIBPATH = '${BF_OPENSUBDIV}/lib'
|
||||
BF_OPENSUBDIV_LIB_STATIC = '${BF_OPENSUBDIV}/lib/libosdCPU.a ${BF_OPENSUBDIV}/lib/libosdGPU.a'
|
||||
# Alembic
|
||||
WITH_BF_HDF5 = False
|
||||
WITH_BF_ALEMBIC = True
|
||||
WITH_BF_STATICALEMBIC = True
|
||||
BF_ALEMBIC = '/opt/lib/alembic'
|
||||
BF_ALEMBIC_INC = '${BF_ALEMBIC}/include'
|
||||
BF_ALEMBIC_LIBPATH = '${BF_ALEMBIC}/lib/static'
|
||||
BF_ALEMBIC_LIB_STATIC = '${BF_ALEMBIC_LIBPATH}/libAlembicAbcGeom.a ${BF_ALEMBIC_LIBPATH}/libAlembicAbc.a ' + \
|
||||
'${BF_ALEMBIC_LIBPATH}/libAlembicAbcCollection.a ${BF_ALEMBIC_LIBPATH}/libAlembicAbcCoreFactory.a ' + \
|
||||
'${BF_ALEMBIC_LIBPATH}/libAlembicAbcCoreOgawa.a ${BF_ALEMBIC_LIBPATH}/libAlembicAbcMaterial.a ' + \
|
||||
'${BF_ALEMBIC_LIBPATH}/libAlembicOgawa.a ${BF_ALEMBIC_LIBPATH}/libAlembicAbcCoreAbstract.a ' + \
|
||||
'${BF_ALEMBIC_LIBPATH}/libAlembicUtil.a'
|
||||
|
||||
# Compilation and optimization
|
||||
BF_DEBUG = False
|
||||
|
@@ -166,14 +166,18 @@ BF_BOOST_LIBPATH = '${BF_BOOST}/lib'
|
||||
# Ocean Simulation
|
||||
WITH_BF_OCEANSIM = True
|
||||
|
||||
# OpenSubdiv
|
||||
WITH_BF_OPENSUBDIV = True
|
||||
WITH_BF_STATICOPENSUBDIV = True
|
||||
BF_OPENSUBDIV = '/opt/lib/opensubdiv'
|
||||
BF_OPENSUBDIV_INC = '${BF_OPENSUBDIV}/include'
|
||||
BF_OPENSUBDIV_LIB = 'osdCPU osdGPU'
|
||||
BF_OPENSUBDIV_LIBPATH = '${BF_OPENSUBDIV}/lib'
|
||||
BF_OPENSUBDIV_LIB_STATIC = '${BF_OPENSUBDIV}/lib/libosdCPU.a ${BF_OPENSUBDIV}/lib/libosdGPU.a'
|
||||
# Alembic
|
||||
WITH_BF_HDF5 = False
|
||||
WITH_BF_ALEMBIC = True
|
||||
WITH_BF_STATICALEMBIC = True
|
||||
BF_ALEMBIC = '/opt/lib/alembic'
|
||||
BF_ALEMBIC_INC = '${BF_ALEMBIC}/include'
|
||||
BF_ALEMBIC_LIBPATH = '${BF_ALEMBIC}/lib/static'
|
||||
BF_ALEMBIC_LIB_STATIC = '${BF_ALEMBIC_LIBPATH}/libAlembicAbcGeom.a ${BF_ALEMBIC_LIBPATH}/libAlembicAbc.a ' + \
|
||||
'${BF_ALEMBIC_LIBPATH}/libAlembicAbcCollection.a ${BF_ALEMBIC_LIBPATH}/libAlembicAbcCoreFactory.a ' + \
|
||||
'${BF_ALEMBIC_LIBPATH}/libAlembicAbcCoreOgawa.a ${BF_ALEMBIC_LIBPATH}/libAlembicAbcMaterial.a ' + \
|
||||
'${BF_ALEMBIC_LIBPATH}/libAlembicOgawa.a ${BF_ALEMBIC_LIBPATH}/libAlembicAbcCoreAbstract.a ' + \
|
||||
'${BF_ALEMBIC_LIBPATH}/libAlembicUtil.a'
|
||||
|
||||
# Compilation and optimization
|
||||
BF_DEBUG = False
|
||||
|
@@ -5,5 +5,3 @@ WITH_BF_CYCLES_CUDA_BINARIES = True
|
||||
|
||||
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
|
||||
|
||||
WITH_BF_CYCLES_CUDA_BINARIES = True
|
||||
|
||||
|
@@ -4,7 +4,7 @@
|
||||
# <pep8 compliant>
|
||||
|
||||
# List of the branches being built automatically overnight
|
||||
NIGHT_SCHEDULE_BRANCHES = [None]
|
||||
NIGHT_SCHEDULE_BRANCHES = [None, "gooseberry"]
|
||||
|
||||
# List of the branches available for force build
|
||||
FORCE_SCHEDULE_BRANCHES = ["master", "gooseberry", "experimental-build"]
|
||||
@@ -305,12 +305,12 @@ add_builder(c, 'mac_x86_64_10_6_scons', 'darwin-9.x.universal', generic_builder,
|
||||
add_builder(c, 'mac_i386_10_6_scons', 'darwin-9.x.universal', generic_builder, hour=11)
|
||||
add_builder(c, 'linux_glibc211_i386_scons', '', generic_builder, hour=1)
|
||||
add_builder(c, 'linux_glibc211_x86_64_scons', '', generic_builder, hour=2)
|
||||
#add_builder(c, 'win32_scons_vc2013', 'windows_vc12', generic_builder, hour=1)
|
||||
#add_builder(c, 'win64_scons_vc2013', 'win64_vc12', generic_builder, hour=2)
|
||||
add_builder(c, 'win32_scons_vc2013', 'windows_vc12', generic_builder, hour=1)
|
||||
add_builder(c, 'win64_scons_vc2013', 'win64_vc12', generic_builder, hour=2)
|
||||
add_builder(c, 'win32_cmake_vc2013', 'windows_vc12', generic_builder, hour=3)
|
||||
add_builder(c, 'win64_cmake_vc2013', 'win64_vc12', generic_builder, hour=4)
|
||||
#add_builder(c, 'mingw_win32_scons', 'mingw32', generic_builder, hour=4)
|
||||
#add_builder(c, 'mingw_win64_scons', 'mingw64', generic_builder, hour=3)
|
||||
add_builder(c, 'mingw_win64_scons', 'mingw64', generic_builder, hour=3)
|
||||
#add_builder(c, 'freebsd_i386_cmake', '', generic_builder, hour=1)
|
||||
#add_builder(c, 'freebsd_x86_64_cmake', '', generic_builder, hour=2)
|
||||
|
||||
|
@@ -124,12 +124,10 @@ else:
|
||||
directory = 'public_html/download'
|
||||
|
||||
try:
|
||||
filename = os.path.join(directory, packagename)
|
||||
zf = z.open(package)
|
||||
f = file(filename, "wb")
|
||||
f = file(os.path.join(directory, packagename), "wb")
|
||||
|
||||
shutil.copyfileobj(zf, f)
|
||||
os.chmod(filename, 0644)
|
||||
|
||||
zf.close()
|
||||
z.close()
|
||||
|
@@ -52,18 +52,12 @@ if 'cmake' in builder:
|
||||
cmake_options.append(['-G', '"Visual Studio 12 2013"'])
|
||||
|
||||
cmake_options.append("-C../blender.git/build_files/cmake/config/blender_full.cmake")
|
||||
if 'win32' not in builder:
|
||||
cmake_options.append("-DWITH_CYCLES_CUDA_BINARIES=1")
|
||||
else:
|
||||
cmake_options.append("-DWITH_CYCLES_CUDA_BINARIES=0")
|
||||
cmake_options.append("-DWITH_CYCLES_CUDA_BINARIES=1")
|
||||
# configure and make
|
||||
retcode = subprocess.call(['cmake', blender_dir] + cmake_options)
|
||||
if retcode != 0:
|
||||
sys.exit(retcode)
|
||||
|
||||
if 'win32' in builder:
|
||||
retcode = subprocess.call(['msbuild', 'INSTALL.vcxproj', '/Property:PlatformToolset=v120_xp', '/p:Configuration=Release'])
|
||||
elif 'win64' in builder:
|
||||
if 'win' in builder:
|
||||
retcode = subprocess.call(['msbuild', 'INSTALL.vcxproj', '/p:Configuration=Release'])
|
||||
else:
|
||||
retcode = subprocess.call(['make', '-s', '-j4', 'install'])
|
||||
@@ -122,8 +116,6 @@ else:
|
||||
|
||||
if config.find('player') != -1:
|
||||
scons_options.append('BF_BUILDDIR=%s_player' % (build_dir))
|
||||
elif config.find('cuda') != -1:
|
||||
scons_options.append('BF_BUILDDIR=%s_cuda' % (build_dir))
|
||||
else:
|
||||
scons_options.append('BF_BUILDDIR=%s' % (build_dir))
|
||||
|
||||
@@ -148,7 +140,7 @@ else:
|
||||
|
||||
retcode = subprocess.call(cur_scons_cmd + scons_options)
|
||||
if retcode != 0:
|
||||
print('Error building rules with config ' + config)
|
||||
print('Error building rules wuth config ' + config)
|
||||
sys.exit(retcode)
|
||||
|
||||
sys.exit(0)
|
||||
|
@@ -123,26 +123,14 @@ else:
|
||||
os.remove(f)
|
||||
retcode = subprocess.call(['cpack', '-G', 'ZIP'])
|
||||
result_file = [f for f in os.listdir('.') if os.path.isfile(f) and f.endswith('.zip')][0]
|
||||
|
||||
# TODO(sergey): Such magic usually happens in SCon's packaging bu we don't have it
|
||||
# in the CMake yet. For until then we do some magic here.
|
||||
tokens = result_file.split('-')
|
||||
blender_version = tokens[1].split('.')
|
||||
blender_full_version = '.'.join(blender_version[0:2])
|
||||
git_hash = tokens[2].split('.')[1]
|
||||
platform = builder.split('_')[0]
|
||||
builderified_name = 'blender-{}-{}-{}'.format(blender_full_version, git_hash, platform)
|
||||
if branch != '':
|
||||
builderified_name = branch + "-" + builderified_name
|
||||
|
||||
os.rename(result_file, "{}.zip".format(builderified_name))
|
||||
os.rename(result_file, "{}.zip".format(builder))
|
||||
# create zip file
|
||||
try:
|
||||
upload_zip = "buildbot_upload.zip"
|
||||
if os.path.exists(upload_zip):
|
||||
os.remove(upload_zip)
|
||||
z = zipfile.ZipFile(upload_zip, "w", compression=zipfile.ZIP_STORED)
|
||||
z.write("{}.zip".format(builderified_name))
|
||||
z.write("{}.zip".format(builder))
|
||||
z.close()
|
||||
sys.exit(retcode)
|
||||
except Exception as ex:
|
||||
|
84
build_files/cmake/Modules/FindAlembic.cmake
Normal file
84
build_files/cmake/Modules/FindAlembic.cmake
Normal file
@@ -0,0 +1,84 @@
|
||||
# - Find Alembic library
|
||||
# Find the native Alembic includes and library
|
||||
# This module defines
|
||||
# ALEMBIC_INCLUDE_DIRS, where to find Alembic headers.
|
||||
# ALEMBIC_LIBRARIES, libraries to link against to use Alembic.
|
||||
# ALEMBIC_ROOT_DIR, The base directory to search for Alembic.
|
||||
# This can also be an environment variable.
|
||||
# ALEMBIC_FOUND, If false, do not try to use Alembic.
|
||||
|
||||
#=============================================================================
|
||||
# Copyright 2013 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 ALEMBIC_ROOT_DIR was defined in the environment, use it.
|
||||
IF(NOT ALEMBIC_ROOT_DIR AND NOT $ENV{ALEMBIC_ROOT_DIR} STREQUAL "")
|
||||
SET(ALEMBIC_ROOT_DIR $ENV{ALEMBIC_ROOT_DIR})
|
||||
ENDIF()
|
||||
|
||||
SET(_alembic_SEARCH_DIRS
|
||||
${ALEMBIC_ROOT_DIR}
|
||||
/usr/local
|
||||
/sw # Fink
|
||||
/opt/local # DarwinPorts
|
||||
/opt/csw # Blastwave
|
||||
/opt/lib/alembic
|
||||
)
|
||||
|
||||
SET(_alembic_FIND_COMPONENTS
|
||||
AlembicAbc
|
||||
AlembicAbcCoreAbstract
|
||||
AlembicAbcGeom
|
||||
AlembicAbcCoreHDF5
|
||||
AlembicAbcCoreOgawa
|
||||
AlembicOgawa
|
||||
AlembicUtil
|
||||
)
|
||||
|
||||
FIND_PATH(_alembic_INCLUDE_DIRS
|
||||
NAMES
|
||||
Alembic/Abc/All.h
|
||||
HINTS
|
||||
${_alembic_SEARCH_DIRS}
|
||||
PATH_SUFFIXES
|
||||
include
|
||||
)
|
||||
|
||||
SET(_alembic_LIBRARIES)
|
||||
FOREACH(COMPONENT ${_alembic_FIND_COMPONENTS})
|
||||
STRING(TOUPPER ${COMPONENT} UPPERCOMPONENT)
|
||||
|
||||
FIND_LIBRARY(ALEMBIC_${UPPERCOMPONENT}_LIBRARY
|
||||
NAMES
|
||||
${COMPONENT}
|
||||
HINTS
|
||||
${_alembic_SEARCH_DIRS}
|
||||
PATH_SUFFIXES
|
||||
lib/static
|
||||
)
|
||||
MARK_AS_ADVANCED(ALEMBIC_${UPPERCOMPONENT}_LIBRARY)
|
||||
LIST(APPEND _alembic_LIBRARIES "${ALEMBIC_${UPPERCOMPONENT}_LIBRARY}")
|
||||
ENDFOREACH()
|
||||
|
||||
# handle the QUIETLY and REQUIRED arguments and set ALEMBIC_FOUND to TRUE if
|
||||
# all listed variables are TRUE
|
||||
INCLUDE(FindPackageHandleStandardArgs)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Alembic DEFAULT_MSG
|
||||
_alembic_LIBRARIES _alembic_INCLUDE_DIRS)
|
||||
|
||||
IF(ALEMBIC_FOUND)
|
||||
SET(ALEMBIC_LIBRARIES ${_alembic_LIBRARIES})
|
||||
SET(ALEMBIC_INCLUDE_DIRS ${_alembic_INCLUDE_DIRS})
|
||||
ENDIF(ALEMBIC_FOUND)
|
||||
|
||||
MARK_AS_ADVANCED(
|
||||
ALEMBIC_INCLUDE_DIRS
|
||||
ALEMBIC_LIBRARIES
|
||||
)
|
@@ -1,113 +0,0 @@
|
||||
# - Try to find audaspace
|
||||
# Once done, this will define
|
||||
#
|
||||
# AUDASPACE_FOUND - system has audaspace
|
||||
# AUDASPACE_INCLUDE_DIRS - the audaspace include directories
|
||||
# AUDASPACE_LIBRARIES - link these to use audaspace
|
||||
# AUDASPACE_C_FOUND - system has audaspace's C binding
|
||||
# AUDASPACE_C_INCLUDE_DIRS - the audaspace's C binding include directories
|
||||
# AUDASPACE_C_LIBRARIES - link these to use audaspace's C binding
|
||||
# AUDASPACE_PY_FOUND - system has audaspace's python binding
|
||||
# AUDASPACE_PY_INCLUDE_DIRS - the audaspace's python binding include directories
|
||||
# AUDASPACE_PY_LIBRARIES - link these to use audaspace's python binding
|
||||
|
||||
IF(NOT AUDASPACE_ROOT_DIR AND NOT $ENV{AUDASPACE_ROOT_DIR} STREQUAL "")
|
||||
SET(AUDASPACE_ROOT_DIR $ENV{AUDASPACE_ROOT_DIR})
|
||||
ENDIF()
|
||||
|
||||
SET(_audaspace_SEARCH_DIRS
|
||||
${AUDASPACE_ROOT_DIR}
|
||||
/usr/local
|
||||
/sw # Fink
|
||||
/opt/local # DarwinPorts
|
||||
/opt/csw # Blastwave
|
||||
)
|
||||
|
||||
# Use pkg-config to get hints about paths
|
||||
FIND_PACKAGE(PkgConfig)
|
||||
IF(PKG_CONFIG_FOUND)
|
||||
PKG_CHECK_MODULES(AUDASPACE_PKGCONF audaspace)
|
||||
ENDIF(PKG_CONFIG_FOUND)
|
||||
|
||||
# Include dir
|
||||
FIND_PATH(AUDASPACE_INCLUDE_DIR
|
||||
NAMES ISound.h
|
||||
HINTS ${_audaspace_SEARCH_DIRS}
|
||||
PATHS ${AUDASPACE_PKGCONF_INCLUDE_DIRS}
|
||||
PATH_SUFFIXES include/audaspace
|
||||
)
|
||||
|
||||
# Library
|
||||
FIND_LIBRARY(AUDASPACE_LIBRARY
|
||||
NAMES audaspace
|
||||
HINTS ${_audaspace_SEARCH_DIRS}
|
||||
PATHS ${AUDASPACE_PKGCONF_LIBRARY_DIRS}
|
||||
PATH_SUFFIXES lib lib64
|
||||
)
|
||||
|
||||
# Include dir
|
||||
FIND_PATH(AUDASPACE_C_INCLUDE_DIR
|
||||
NAMES AUD_Sound.h
|
||||
HINTS ${_audaspace_SEARCH_DIRS}
|
||||
PATHS ${AUDASPACE_PKGCONF_INCLUDE_DIRS}
|
||||
PATH_SUFFIXES include/audaspace
|
||||
)
|
||||
|
||||
# Library
|
||||
FIND_LIBRARY(AUDASPACE_C_LIBRARY
|
||||
NAMES audaspace-c
|
||||
HINTS ${_audaspace_SEARCH_DIRS}
|
||||
PATHS ${AUDASPACE_PKGCONF_LIBRARY_DIRS}
|
||||
PATH_SUFFIXES lib lib64
|
||||
)
|
||||
|
||||
# Include dir
|
||||
FIND_PATH(AUDASPACE_PY_INCLUDE_DIR
|
||||
NAMES python/PyAPI.h
|
||||
HINTS ${_audaspace_SEARCH_DIRS}
|
||||
PATHS ${AUDASPACE_PKGCONF_INCLUDE_DIRS}
|
||||
PATH_SUFFIXES include/audaspace
|
||||
)
|
||||
|
||||
# Library
|
||||
FIND_LIBRARY(AUDASPACE_PY_LIBRARY
|
||||
NAMES audaspace-py
|
||||
HINTS ${_audaspace_SEARCH_DIRS}
|
||||
PATHS ${AUDASPACE_PKGCONF_LIBRARY_DIRS}
|
||||
PATH_SUFFIXES lib lib64
|
||||
)
|
||||
|
||||
FIND_PACKAGE(PackageHandleStandardArgs)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Audaspace DEFAULT_MSG AUDASPACE_LIBRARY AUDASPACE_INCLUDE_DIR)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Audaspace_C DEFAULT_MSG AUDASPACE_C_LIBRARY AUDASPACE_C_INCLUDE_DIR)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Audaspace_Py DEFAULT_MSG AUDASPACE_PY_LIBRARY AUDASPACE_PY_INCLUDE_DIR)
|
||||
|
||||
IF(AUDASPACE_FOUND)
|
||||
SET(AUDASPACE_LIBRARIES ${AUDASPACE_LIBRARY})
|
||||
SET(AUDASPACE_INCLUDE_DIRS ${AUDASPACE_INCLUDE_DIR})
|
||||
ENDIF(AUDASPACE_FOUND)
|
||||
|
||||
IF(AUDASPACE_C_FOUND)
|
||||
SET(AUDASPACE_C_LIBRARIES ${AUDASPACE_C_LIBRARY})
|
||||
SET(AUDASPACE_C_INCLUDE_DIRS ${AUDASPACE_C_INCLUDE_DIR})
|
||||
ENDIF(AUDASPACE_C_FOUND)
|
||||
|
||||
IF(AUDASPACE_PY_FOUND)
|
||||
SET(AUDASPACE_PY_LIBRARIES ${AUDASPACE_PY_LIBRARY})
|
||||
SET(AUDASPACE_PY_INCLUDE_DIRS ${AUDASPACE_PY_INCLUDE_DIR})
|
||||
ENDIF(AUDASPACE_PY_FOUND)
|
||||
|
||||
MARK_AS_ADVANCED(
|
||||
AUDASPACE_LIBRARY
|
||||
AUDASPACE_LIBRARIES
|
||||
AUDASPACE_INCLUDE_DIR
|
||||
AUDASPACE_INCLUDE_DIRS
|
||||
AUDASPACE_C_LIBRARY
|
||||
AUDASPACE_C_LIBRARIES
|
||||
AUDASPACE_C_INCLUDE_DIR
|
||||
AUDASPACE_C_INCLUDE_DIRS
|
||||
AUDASPACE_PY_LIBRARY
|
||||
AUDASPACE_PY_LIBRARIES
|
||||
AUDASPACE_PY_INCLUDE_DIR
|
||||
AUDASPACE_PY_INCLUDE_DIRS
|
||||
)
|
75
build_files/cmake/Modules/FindHDF5.cmake
Normal file
75
build_files/cmake/Modules/FindHDF5.cmake
Normal file
@@ -0,0 +1,75 @@
|
||||
# - Find HDF5 library
|
||||
# Find the native hdf5 includes and library
|
||||
# This module defines
|
||||
# HDF5_INCLUDE_DIRS, where to find hdf5 headers.
|
||||
# HDF5_LIBRARIES, libraries to link against to use hdf5.
|
||||
# HDF5_ROOT_DIR, The base directory to search for hdf5.
|
||||
# This can also be an environment variable.
|
||||
# HDF5_FOUND, If false, do not try to use hdf5.
|
||||
|
||||
#=============================================================================
|
||||
# Copyright 2013 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 HDF5_ROOT_DIR was defined in the environment, use it.
|
||||
IF(NOT HDF5_ROOT_DIR AND NOT $ENV{HDF5_ROOT_DIR} STREQUAL "")
|
||||
SET(HDF5_ROOT_DIR $ENV{HDF5_ROOT_DIR})
|
||||
ENDIF()
|
||||
|
||||
SET(_hdf5_SEARCH_DIRS
|
||||
${HDF5_ROOT_DIR}
|
||||
/usr/local
|
||||
/sw # Fink
|
||||
/opt/local # DarwinPorts
|
||||
/opt/csw # Blastwave
|
||||
/opt/lib/hdf5
|
||||
)
|
||||
|
||||
SET(_hdf5_FIND_COMPONENTS
|
||||
hdf5
|
||||
hdf5_hl
|
||||
)
|
||||
|
||||
FIND_PATH(_hdf5_INCLUDE_DIRS
|
||||
NAMES
|
||||
hdf5.h
|
||||
HINTS
|
||||
${_hdf5_SEARCH_DIRS}
|
||||
)
|
||||
|
||||
SET(_hdf5_LIBRARIES)
|
||||
FOREACH(COMPONENT ${_hdf5_FIND_COMPONENTS})
|
||||
STRING(TOUPPER ${COMPONENT} UPPERCOMPONENT)
|
||||
|
||||
FIND_LIBRARY(HDF5_${UPPERCOMPONENT}_LIBRARY
|
||||
NAMES
|
||||
${COMPONENT}
|
||||
HINTS
|
||||
${_hdf5_SEARCH_DIRS}
|
||||
)
|
||||
MARK_AS_ADVANCED(HDF5_${UPPERCOMPONENT}_LIBRARY)
|
||||
LIST(APPEND _hdf5_LIBRARIES "${HDF5_${UPPERCOMPONENT}_LIBRARY}")
|
||||
ENDFOREACH()
|
||||
|
||||
# handle the QUIETLY and REQUIRED arguments and set HDF5_FOUND to TRUE if
|
||||
# all listed variables are TRUE
|
||||
INCLUDE(FindPackageHandleStandardArgs)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(hdf5 DEFAULT_MSG
|
||||
_hdf5_LIBRARIES _hdf5_INCLUDE_DIRS)
|
||||
|
||||
IF(HDF5_FOUND)
|
||||
SET(HDF5_LIBRARIES ${_hdf5_LIBRARIES})
|
||||
SET(HDF5_INCLUDE_DIRS ${_hdf5_INCLUDE_DIRS})
|
||||
ENDIF(HDF5_FOUND)
|
||||
|
||||
MARK_AS_ADVANCED(
|
||||
HDF5_INCLUDE_DIRS
|
||||
HDF5_LIBRARIES
|
||||
)
|
@@ -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
|
||||
)
|
||||
|
@@ -59,8 +59,7 @@ FIND_LIBRARY(OPENIMAGEIO_LIBRARY
|
||||
FIND_FILE(OPENIMAGEIO_IDIFF
|
||||
NAMES
|
||||
idiff
|
||||
HINTS
|
||||
${OPENIMAGEIO_ROOT_DIR}
|
||||
${OPENIMAGEIO_ROOT_DIR}
|
||||
PATH_SUFFIXES
|
||||
bin
|
||||
)
|
||||
|
@@ -1,111 +0,0 @@
|
||||
# - Find OpenSubdiv library
|
||||
# Find the native OpenSubdiv includes and library
|
||||
# This module defines
|
||||
# OPENSUBDIV_INCLUDE_DIRS, where to find OpenSubdiv headers, Set when
|
||||
# OPENSUBDIV_INCLUDE_DIR is found.
|
||||
# OPENSUBDIV_LIBRARIES, libraries to link against to use OpenSubdiv.
|
||||
# OPENSUBDIV_ROOT_DIR, the base directory to search for OpenSubdiv.
|
||||
# This can also be an environment variable.
|
||||
# OPENSUBDIV_FOUND, if false, do not try to use OpenSubdiv.
|
||||
#
|
||||
# also defined, but not for general use are
|
||||
# OPENSUBDIV_LIBRARY, where to find the OpenSubdiv library.
|
||||
|
||||
#=============================================================================
|
||||
# Copyright 2013 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 OPENSUBDIV_ROOT_DIR was defined in the environment, use it.
|
||||
IF(NOT OPENSUBDIV_ROOT_DIR AND NOT $ENV{OPENSUBDIV_ROOT_DIR} STREQUAL "")
|
||||
SET(OPENSUBDIV_ROOT_DIR $ENV{OPENSUBDIV_ROOT_DIR})
|
||||
ENDIF()
|
||||
|
||||
SET(_opensubdiv_FIND_COMPONENTS
|
||||
osdGPU
|
||||
osdCPU
|
||||
)
|
||||
|
||||
SET(_opensubdiv_SEARCH_DIRS
|
||||
${OPENSUBDIV_ROOT_DIR}
|
||||
/usr/local
|
||||
/sw # Fink
|
||||
/opt/local # DarwinPorts
|
||||
/opt/csw # Blastwave
|
||||
/opt/lib/opensubdiv
|
||||
)
|
||||
|
||||
FIND_PATH(OPENSUBDIV_INCLUDE_DIR
|
||||
NAMES
|
||||
opensubdiv/osd/mesh.h
|
||||
HINTS
|
||||
${_opensubdiv_SEARCH_DIRS}
|
||||
PATH_SUFFIXES
|
||||
include
|
||||
)
|
||||
|
||||
SET(_opensubdiv_LIBRARIES)
|
||||
FOREACH(COMPONENT ${_opensubdiv_FIND_COMPONENTS})
|
||||
STRING(TOUPPER ${COMPONENT} UPPERCOMPONENT)
|
||||
|
||||
FIND_LIBRARY(OPENSUBDIV_${UPPERCOMPONENT}_LIBRARY
|
||||
NAMES
|
||||
${COMPONENT}
|
||||
HINTS
|
||||
${_opensubdiv_SEARCH_DIRS}
|
||||
PATH_SUFFIXES
|
||||
lib64 lib
|
||||
)
|
||||
LIST(APPEND _opensubdiv_LIBRARIES "${OPENSUBDIV_${UPPERCOMPONENT}_LIBRARY}")
|
||||
ENDFOREACH()
|
||||
|
||||
MACRO(OPENSUBDIV_CHECK_CONTROLLER
|
||||
controller_include_file
|
||||
variable_name)
|
||||
IF(EXISTS "${OPENSUBDIV_INCLUDE_DIR}/opensubdiv/osd/${controller_include_file}")
|
||||
SET(${variable_name} TRUE)
|
||||
ELSE()
|
||||
SET(${variable_name} FALSE)
|
||||
ENDIF()
|
||||
ENDMACRO()
|
||||
|
||||
|
||||
# handle the QUIETLY and REQUIRED arguments and set OPENSUBDIV_FOUND to TRUE if
|
||||
# all listed variables are TRUE
|
||||
INCLUDE(FindPackageHandleStandardArgs)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(OpenSubdiv DEFAULT_MSG
|
||||
_opensubdiv_LIBRARIES OPENSUBDIV_INCLUDE_DIR)
|
||||
|
||||
IF(OPENSUBDIV_FOUND)
|
||||
SET(OPENSUBDIV_LIBRARIES ${_opensubdiv_LIBRARIES})
|
||||
SET(OPENSUBDIV_INCLUDE_DIRS ${OPENSUBDIV_INCLUDE_DIR})
|
||||
|
||||
# Find available compute controllers.
|
||||
|
||||
FIND_PACKAGE(OpenMP)
|
||||
IF(OPENMP_FOUND)
|
||||
SET(OPENSUBDIV_HAS_OPENMP TRUE)
|
||||
ELSE()
|
||||
SET(OPENSUBDIV_HAS_OPENMP FALSE)
|
||||
ENDIF()
|
||||
|
||||
OPENSUBDIV_CHECK_CONTROLLER("tbbEvaluator.h" OPENSUBDIV_HAS_TBB)
|
||||
OPENSUBDIV_CHECK_CONTROLLER("clEvaluator.h" OPENSUBDIV_HAS_OPENCL)
|
||||
OPENSUBDIV_CHECK_CONTROLLER("cudaEvaluator.h" OPENSUBDIV_HAS_CUDA)
|
||||
OPENSUBDIV_CHECK_CONTROLLER("glXFBEvaluator.h" OPENSUBDIV_HAS_GLSL_TRANSFORM_FEEDBACK)
|
||||
OPENSUBDIV_CHECK_CONTROLLER("glComputeEvaluator.h" OPENSUBDIV_HAS_GLSL_COMPUTE)
|
||||
ENDIF(OPENSUBDIV_FOUND)
|
||||
|
||||
MARK_AS_ADVANCED(
|
||||
OPENSUBDIV_INCLUDE_DIR
|
||||
)
|
||||
FOREACH(COMPONENT ${_opensubdiv_FIND_COMPONENTS})
|
||||
STRING(TOUPPER ${COMPONENT} UPPERCOMPONENT)
|
||||
MARK_AS_ADVANCED(OPENSUBDIV_${UPPERCOMPONENT}_LIBRARY)
|
||||
ENDFOREACH()
|
@@ -14,7 +14,6 @@
|
||||
# PYTHON_INCLUDE_CONFIG_DIRS
|
||||
# PYTHON_LIBRARIES
|
||||
# PYTHON_LIBPATH, Used for installation
|
||||
# PYTHON_SITE_PACKAGES, Used for installation (as a Python module)
|
||||
# PYTHON_LINKFLAGS
|
||||
# PYTHON_ROOT_DIR, The base directory to search for Python.
|
||||
# This can also be an environment variable.
|
||||
@@ -66,14 +65,6 @@ IF(DEFINED PYTHON_LIBPATH)
|
||||
SET(_IS_LIB_PATH_DEF ON)
|
||||
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
|
||||
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
|
||||
)
|
||||
|
||||
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})
|
||||
#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()
|
||||
|
||||
IF(PYTHON_LIBRARY AND PYTHON_LIBPATH AND PYTHON_INCLUDE_DIR AND PYTHON_INCLUDE_CONFIG_DIR)
|
||||
SET(_PYTHON_ABI_FLAGS "${_CURRENT_ABI_FLAGS}")
|
||||
break()
|
||||
ELSE()
|
||||
# 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(_python_ABI_FLAGS)
|
||||
UNSET(_python_SEARCH_DIRS)
|
||||
ENDIF()
|
||||
|
||||
UNSET(_IS_INC_DEF)
|
||||
@@ -189,41 +187,17 @@ IF(PYTHONLIBSUNIX_FOUND)
|
||||
SET(PYTHON_INCLUDE_DIRS ${PYTHON_INCLUDE_DIR} ${PYTHON_INCLUDE_CONFIG_DIR})
|
||||
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
|
||||
# XXX No more valid with debian-like py3.4 packages...
|
||||
# GET_FILENAME_COMPONENT(PYTHON_LIBPATH ${PYTHON_LIBRARY} PATH)
|
||||
|
||||
# not required for build, just used when bundling Python.
|
||||
FIND_PROGRAM(
|
||||
PYTHON_EXECUTABLE
|
||||
NAMES
|
||||
"python${PYTHON_VERSION}${_PYTHON_ABI_FLAGS}"
|
||||
"python${PYTHON_VERSION}"
|
||||
"python"
|
||||
HINTS
|
||||
${_python_SEARCH_DIRS}
|
||||
PATH_SUFFIXES bin
|
||||
)
|
||||
# not used
|
||||
# SET(PYTHON_BINARY ${PYTHON_EXECUTABLE} CACHE STRING "")
|
||||
ENDIF()
|
||||
|
||||
UNSET(_PYTHON_VERSION_NO_DOTS)
|
||||
UNSET(_PYTHON_ABI_FLAGS)
|
||||
UNSET(_python_SEARCH_DIRS)
|
||||
|
||||
MARK_AS_ADVANCED(
|
||||
PYTHON_INCLUDE_DIR
|
||||
PYTHON_INCLUDE_CONFIG_DIR
|
||||
PYTHON_LIBRARY
|
||||
PYTHON_LIBPATH
|
||||
PYTHON_SITE_PACKAGES
|
||||
PYTHON_EXECUTABLE
|
||||
)
|
||||
|
@@ -12,7 +12,7 @@
|
||||
#
|
||||
#=============================================================================
|
||||
|
||||
macro(BLENDER_SRC_GTEST_EX NAME SRC EXTRA_LIBS DO_ADD_TEST)
|
||||
macro(BLENDER_SRC_GTEST NAME SRC EXTRA_LIBS)
|
||||
if(WITH_GTESTS)
|
||||
get_property(_current_include_directories
|
||||
DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
@@ -40,20 +40,10 @@ macro(BLENDER_SRC_GTEST_EX NAME SRC EXTRA_LIBS DO_ADD_TEST)
|
||||
RUNTIME_OUTPUT_DIRECTORY_RELEASE "${TESTS_OUTPUT_DIR}"
|
||||
RUNTIME_OUTPUT_DIRECTORY_DEBUG "${TESTS_OUTPUT_DIR}"
|
||||
INCLUDE_DIRECTORIES "${TEST_INC}")
|
||||
if(${DO_ADD_TEST})
|
||||
add_test(${NAME}_test ${TESTS_OUTPUT_DIR}/${NAME}_test)
|
||||
endif()
|
||||
add_test(${NAME}_test ${TESTS_OUTPUT_DIR}/${NAME}_test)
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
macro(BLENDER_SRC_GTEST NAME SRC EXTRA_LIBS)
|
||||
BLENDER_SRC_GTEST_EX("${NAME}" "${SRC}" "${EXTRA_LIBS}" "TRUE")
|
||||
endmacro()
|
||||
|
||||
macro(BLENDER_TEST NAME EXTRA_LIBS)
|
||||
BLENDER_SRC_GTEST_EX("${NAME}" "${NAME}_test.cc" "${EXTRA_LIBS}" "TRUE")
|
||||
endmacro()
|
||||
|
||||
macro(BLENDER_TEST_PERFORMANCE NAME EXTRA_LIBS)
|
||||
BLENDER_SRC_GTEST_EX("${NAME}" "${NAME}_test.cc" "${EXTRA_LIBS}" "FALSE")
|
||||
BLENDER_SRC_GTEST("${NAME}" "${NAME}_test.cc" "${EXTRA_LIBS}")
|
||||
endmacro()
|
||||
|
@@ -10,9 +10,9 @@ set(MY_WC_COMMIT_TIMESTAMP 0)
|
||||
# Guess if this is a git working copy and then look up the revision
|
||||
if(EXISTS ${SOURCE_DIR}/.git)
|
||||
# The FindGit.cmake module is part of the standard distribution
|
||||
find_package(Git)
|
||||
include(FindGit)
|
||||
if(GIT_FOUND)
|
||||
message(STATUS "Found Git: ${GIT_EXECUTABLE}")
|
||||
message(STATUS "-- Found Git: ${GIT_EXECUTABLE}")
|
||||
|
||||
execute_process(COMMAND git rev-parse --abbrev-ref HEAD
|
||||
WORKING_DIRECTORY ${SOURCE_DIR}
|
||||
@@ -97,10 +97,6 @@ if(EXISTS ${SOURCE_DIR}/.git)
|
||||
WORKING_DIRECTORY ${SOURCE_DIR}
|
||||
OUTPUT_VARIABLE MY_WC_COMMIT_TIMESTAMP
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
# May fail in rare cases
|
||||
if(MY_WC_COMMIT_TIMESTAMP STREQUAL "")
|
||||
set(MY_WC_COMMIT_TIMESTAMP 0)
|
||||
endif()
|
||||
|
||||
# Update GIT index before getting dirty files
|
||||
execute_process(COMMAND git update-index -q --refresh
|
||||
|
@@ -28,17 +28,13 @@ if not sys.version.startswith("3"):
|
||||
sys.version.partition(" ")[0])
|
||||
sys.exit(1)
|
||||
|
||||
from cmake_consistency_check_config import (
|
||||
IGNORE,
|
||||
UTF8_CHECK,
|
||||
SOURCE_DIR,
|
||||
BUILD_DIR,
|
||||
)
|
||||
|
||||
from cmake_consistency_check_config import IGNORE, UTF8_CHECK, SOURCE_DIR
|
||||
|
||||
import os
|
||||
from os.path import join, dirname, normpath, splitext
|
||||
|
||||
print("Scanning:", SOURCE_DIR)
|
||||
|
||||
global_h = set()
|
||||
global_c = set()
|
||||
global_refs = {}
|
||||
@@ -138,7 +134,6 @@ def cmake_get_src(f):
|
||||
|
||||
if found:
|
||||
cmake_base = dirname(f)
|
||||
cmake_base_bin = os.path.join(BUILD_DIR, os.path.relpath(cmake_base, SOURCE_DIR))
|
||||
|
||||
while it is not None:
|
||||
i += 1
|
||||
@@ -159,8 +154,6 @@ def cmake_get_src(f):
|
||||
|
||||
# replace dirs
|
||||
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:
|
||||
pass
|
||||
@@ -200,16 +193,13 @@ def cmake_get_src(f):
|
||||
raise Exception("unknown file type - not c or h %s -> %s" % (f, new_file))
|
||||
|
||||
elif context_name == "INC":
|
||||
if new_file.startswith(BUILD_DIR):
|
||||
# assume generated path
|
||||
pass
|
||||
elif os.path.isdir(new_file):
|
||||
if os.path.isdir(new_file):
|
||||
new_path_rel = os.path.relpath(new_file, cmake_base)
|
||||
|
||||
if new_path_rel != l:
|
||||
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)
|
||||
|
||||
else:
|
||||
@@ -240,6 +230,10 @@ def cmake_get_src(f):
|
||||
filen.close()
|
||||
|
||||
|
||||
for cmake in source_list(SOURCE_DIR, is_cmake):
|
||||
cmake_get_src(cmake)
|
||||
|
||||
|
||||
def is_ignore(f):
|
||||
for ig in IGNORE:
|
||||
if ig in f:
|
||||
@@ -247,83 +241,73 @@ def is_ignore(f):
|
||||
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):
|
||||
cmake_get_src(cmake)
|
||||
|
||||
# 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.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))
|
||||
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:
|
||||
raise Exception("CMake referenecs missing files, aborting!")
|
||||
del is_err
|
||||
del errs
|
||||
if is_err:
|
||||
raise Exception("CMake referenecs missing files, aborting!")
|
||||
del is_err
|
||||
del errs
|
||||
|
||||
# now check on files not accounted for.
|
||||
print("\nC/C++ Files CMake doesnt know about...")
|
||||
for cf in sorted(source_list(SOURCE_DIR, is_c)):
|
||||
if not is_ignore(cf):
|
||||
if cf not in global_c:
|
||||
print("missing_c: ", cf)
|
||||
# now check on files not accounted for.
|
||||
print("\nC/C++ Files CMake doesnt know about...")
|
||||
for cf in sorted(source_list(SOURCE_DIR, is_c)):
|
||||
if not is_ignore(cf):
|
||||
if cf not in global_c:
|
||||
print("missing_c: ", cf)
|
||||
|
||||
# check if automake builds a corrasponding .o file.
|
||||
'''
|
||||
if cf in global_c:
|
||||
out1 = os.path.splitext(cf)[0] + ".o"
|
||||
out2 = os.path.splitext(cf)[0] + ".Po"
|
||||
out2_dir, out2_file = out2 = os.path.split(out2)
|
||||
out2 = os.path.join(out2_dir, ".deps", out2_file)
|
||||
if not os.path.exists(out1) and not os.path.exists(out2):
|
||||
print("bad_c: ", cf)
|
||||
'''
|
||||
# check if automake builds a corrasponding .o file.
|
||||
'''
|
||||
if cf in global_c:
|
||||
out1 = os.path.splitext(cf)[0] + ".o"
|
||||
out2 = os.path.splitext(cf)[0] + ".Po"
|
||||
out2_dir, out2_file = out2 = os.path.split(out2)
|
||||
out2 = os.path.join(out2_dir, ".deps", out2_file)
|
||||
if not os.path.exists(out1) and not os.path.exists(out2):
|
||||
print("bad_c: ", cf)
|
||||
'''
|
||||
|
||||
print("\nC/C++ Headers CMake doesnt know about...")
|
||||
for hf in sorted(source_list(SOURCE_DIR, is_c_header)):
|
||||
if not is_ignore(hf):
|
||||
if hf not in global_h:
|
||||
print("missing_h: ", hf)
|
||||
print("\nC/C++ Headers CMake doesnt know about...")
|
||||
for hf in sorted(source_list(SOURCE_DIR, is_c_header)):
|
||||
if not is_ignore(hf):
|
||||
if hf not in global_h:
|
||||
print("missing_h: ", hf)
|
||||
|
||||
if UTF8_CHECK:
|
||||
# test encoding
|
||||
import traceback
|
||||
for files in (global_c, global_h):
|
||||
for f in sorted(files):
|
||||
if os.path.exists(f):
|
||||
# ignore outside of our source tree
|
||||
if "extern" not in f:
|
||||
i = 1
|
||||
try:
|
||||
for l in open(f, "r", encoding="utf8"):
|
||||
i += 1
|
||||
except UnicodeDecodeError:
|
||||
print("Non utf8: %s:%d" % (f, i))
|
||||
if i > 1:
|
||||
traceback.print_exc()
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
if UTF8_CHECK:
|
||||
# test encoding
|
||||
import traceback
|
||||
for files in (global_c, global_h):
|
||||
for f in sorted(files):
|
||||
if os.path.exists(f):
|
||||
# ignore outside of our source tree
|
||||
if "extern" not in f:
|
||||
i = 1
|
||||
try:
|
||||
for l in open(f, "r", encoding="utf8"):
|
||||
i += 1
|
||||
except UnicodeDecodeError:
|
||||
print("Non utf8: %s:%d" % (f, i))
|
||||
if i > 1:
|
||||
traceback.print_exc()
|
||||
|
@@ -74,6 +74,3 @@ IGNORE = (
|
||||
UTF8_CHECK = True
|
||||
|
||||
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"))))
|
||||
|
@@ -40,7 +40,6 @@ from project_info import (
|
||||
# is_py,
|
||||
cmake_advanced_info,
|
||||
cmake_compiler_defines,
|
||||
cmake_cache_var,
|
||||
project_name_get,
|
||||
)
|
||||
|
||||
@@ -50,8 +49,6 @@ from os.path import join, dirname, normpath, relpath, exists
|
||||
|
||||
|
||||
def create_nb_project_main():
|
||||
from xml.sax.saxutils import escape
|
||||
|
||||
files = list(source_list(SOURCE_DIR, filename_check=is_project_file))
|
||||
files_rel = [relpath(f, start=PROJECT_DIR) for f in files]
|
||||
files_rel.sort()
|
||||
@@ -74,10 +71,6 @@ def create_nb_project_main():
|
||||
# be tricky, get the project name from git if we can!
|
||||
PROJECT_NAME = project_name_get()
|
||||
|
||||
|
||||
make_exe = cmake_cache_var("CMAKE_MAKE_PROGRAM")
|
||||
make_exe_basename = os.path.basename(make_exe)
|
||||
|
||||
# --------------- NB spesific
|
||||
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()]
|
||||
@@ -138,9 +131,9 @@ def create_nb_project_main():
|
||||
f = open(join(PROJECT_DIR_NB, "configurations.xml"), 'w')
|
||||
|
||||
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(' <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!
|
||||
files_rel_local = [normpath(relpath(join(CMAKE_DIR, path), SOURCE_DIR)) for path in files_rel]
|
||||
@@ -192,27 +185,16 @@ def create_nb_project_main():
|
||||
|
||||
f.write(' <toolsSet>\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(' <codeAssistance>\n')
|
||||
f.write(' </codeAssistance>\n')
|
||||
f.write(' <dependencyChecking>false</dependencyChecking>\n')
|
||||
f.write(' <rebuildPropChanged>false</rebuildPropChanged>\n')
|
||||
f.write(' <makefileType>\n')
|
||||
|
||||
f.write(' <makeTool>\n')
|
||||
f.write(' <buildCommandWorkingDir>.</buildCommandWorkingDir>\n')
|
||||
|
||||
if make_exe_basename == "ninja":
|
||||
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' % escape(build_cmd))
|
||||
f.write(' <cleanCommand>%s</cleanCommand>\n' % escape(clean_cmd))
|
||||
f.write(' <buildCommand>${MAKE} -f Makefile</buildCommand>\n')
|
||||
f.write(' <cleanCommand>${MAKE} -f Makefile clean</cleanCommand>\n')
|
||||
f.write(' <executablePath>./bin/blender</executablePath>\n')
|
||||
del build_cmd, clean_cmd
|
||||
|
||||
def write_toolinfo():
|
||||
f.write(' <incDir>\n')
|
||||
@@ -221,7 +203,7 @@ def create_nb_project_main():
|
||||
f.write(' </incDir>\n')
|
||||
f.write(' <preprocessorList>\n')
|
||||
for cdef in defines:
|
||||
f.write(' <Elem>%s</Elem>\n' % escape(cdef))
|
||||
f.write(' <Elem>%s</Elem>\n' % cdef)
|
||||
f.write(' </preprocessorList>\n')
|
||||
|
||||
f.write(' <cTool>\n')
|
||||
@@ -239,11 +221,10 @@ def create_nb_project_main():
|
||||
f.write(' \n')
|
||||
|
||||
for path in files_rel_local:
|
||||
is_c = path.endswith(".c")
|
||||
f.write(' <item path="%s"\n' % path)
|
||||
f.write(' ex="false"\n')
|
||||
f.write(' tool="%d"\n' % (0 if is_c else 1))
|
||||
f.write(' flavor2="%d">\n' % (3 if is_c else 0))
|
||||
f.write(' tool="1"\n')
|
||||
f.write(' flavor2="0">\n')
|
||||
f.write(' </item>\n')
|
||||
|
||||
f.write(' <runprofile version="9">\n')
|
||||
|
@@ -1,4 +1,5 @@
|
||||
# Turn everything ON thats expected for an official release builds.
|
||||
# turn everything OFF except for python which defaults to ON
|
||||
# and is needed for the UI
|
||||
#
|
||||
# Example usage:
|
||||
# cmake -C../blender/build_files/cmake/config/blender_full.cmake ../blender
|
||||
@@ -12,7 +13,6 @@ set(WITH_CODEC_SNDFILE ON CACHE BOOL "" FORCE)
|
||||
set(WITH_CYCLES ON CACHE BOOL "" FORCE)
|
||||
set(WITH_FFTW3 ON CACHE BOOL "" FORCE)
|
||||
set(WITH_LIBMV ON CACHE BOOL "" FORCE)
|
||||
set(WITH_LIBMV_SCHUR_SPECIALIZATIONS ON CACHE BOOL "" FORCE)
|
||||
set(WITH_GAMEENGINE ON CACHE BOOL "" FORCE)
|
||||
set(WITH_COMPOSITOR ON CACHE BOOL "" FORCE)
|
||||
set(WITH_FREESTYLE ON CACHE BOOL "" FORCE)
|
||||
@@ -52,18 +52,11 @@ set(WITH_X11_XF86VMODE ON CACHE BOOL "" FORCE)
|
||||
set(WITH_PLAYER ON CACHE BOOL "" FORCE)
|
||||
set(WITH_MEM_JEMALLOC ON CACHE BOOL "" FORCE)
|
||||
|
||||
|
||||
# platform dependant options
|
||||
if(UNIX AND NOT APPLE)
|
||||
set(WITH_JACK ON CACHE BOOL "" FORCE)
|
||||
set(WITH_DOC_MANPAGE ON CACHE BOOL "" FORCE)
|
||||
set(WITH_OPENSUBDIV ON CACHE BOOL "" FORCE)
|
||||
elseif(WIN32)
|
||||
set(WITH_JACK OFF CACHE BOOL "" FORCE)
|
||||
set(WITH_OPENSUBDIV ON CACHE BOOL "" FORCE)
|
||||
elseif (APPLE)
|
||||
set(WITH_JACK ON CACHE BOOL "" FORCE)
|
||||
set(WITH_CODEC_QUICKTIME ON CACHE BOOL "" FORCE)
|
||||
set(WITH_OPENSUBDIV OFF CACHE BOOL "" FORCE)
|
||||
endif()
|
||||
|
||||
if(APPLE)
|
||||
set(WITH_CODEC_QUICKTIME ON CACHE BOOL "" FORCE)
|
||||
endif()
|
||||
|
||||
|
@@ -16,7 +16,6 @@ set(WITH_CODEC_SNDFILE OFF CACHE BOOL "" FORCE)
|
||||
set(WITH_CYCLES OFF CACHE BOOL "" FORCE)
|
||||
set(WITH_FFTW3 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_COMPOSITOR OFF CACHE BOOL "" FORCE)
|
||||
set(WITH_FREESTYLE OFF CACHE BOOL "" FORCE)
|
||||
@@ -48,6 +47,7 @@ set(WITH_OPENCOLORIO OFF CACHE BOOL "" FORCE)
|
||||
set(WITH_OPENIMAGEIO OFF CACHE BOOL "" FORCE)
|
||||
set(WITH_OPENMP OFF CACHE BOOL "" FORCE)
|
||||
set(WITH_OPENNL OFF CACHE BOOL "" FORCE)
|
||||
set(WITH_PYTHON_INSTALL OFF CACHE BOOL "" FORCE)
|
||||
set(WITH_RAYOPTIMIZATION OFF CACHE BOOL "" FORCE)
|
||||
set(WITH_SDL OFF CACHE BOOL "" FORCE)
|
||||
set(WITH_X11_XINPUT OFF CACHE BOOL "" FORCE)
|
||||
|
@@ -48,7 +48,7 @@ macro(list_insert_before
|
||||
unset(_index)
|
||||
endmacro()
|
||||
|
||||
function(list_assert_duplicates
|
||||
function (list_assert_duplicates
|
||||
list_id
|
||||
)
|
||||
|
||||
@@ -104,31 +104,21 @@ macro(file_list_suffix
|
||||
endmacro()
|
||||
|
||||
|
||||
function(target_link_libraries_optimized
|
||||
TARGET
|
||||
LIBS
|
||||
)
|
||||
|
||||
macro(target_link_libraries_optimized TARGET LIBS)
|
||||
foreach(_LIB ${LIBS})
|
||||
target_link_libraries(${TARGET} optimized "${_LIB}")
|
||||
endforeach()
|
||||
endfunction()
|
||||
|
||||
function(target_link_libraries_debug
|
||||
TARGET
|
||||
LIBS
|
||||
)
|
||||
unset(_LIB)
|
||||
endmacro()
|
||||
|
||||
macro(target_link_libraries_debug TARGET LIBS)
|
||||
foreach(_LIB ${LIBS})
|
||||
target_link_libraries(${TARGET} debug "${_LIB}")
|
||||
endforeach()
|
||||
endfunction()
|
||||
|
||||
function(target_link_libraries_decoupled
|
||||
target
|
||||
libraries_var
|
||||
)
|
||||
unset(_LIB)
|
||||
endmacro()
|
||||
|
||||
macro(target_link_libraries_decoupled target libraries_var)
|
||||
if(NOT MSVC)
|
||||
target_link_libraries(${target} ${${libraries_var}})
|
||||
else()
|
||||
@@ -137,15 +127,14 @@ function(target_link_libraries_decoupled
|
||||
file_list_suffix(_libraries_debug "${${libraries_var}}" "_d")
|
||||
target_link_libraries_debug(${target} "${_libraries_debug}")
|
||||
target_link_libraries_optimized(${target} "${${libraries_var}}")
|
||||
unset(_libraries_debug)
|
||||
endif()
|
||||
endfunction()
|
||||
endmacro()
|
||||
|
||||
# Nicer makefiles with -I/1/foo/ instead of -I/1/2/3/../../foo/
|
||||
# use it instead of include_directories()
|
||||
function(blender_include_dirs
|
||||
includes
|
||||
)
|
||||
|
||||
macro(blender_include_dirs
|
||||
includes)
|
||||
set(_ALL_INCS "")
|
||||
foreach(_INC ${ARGV})
|
||||
get_filename_component(_ABS_INC ${_INC} ABSOLUTE)
|
||||
@@ -156,12 +145,13 @@ function(blender_include_dirs
|
||||
##endif()
|
||||
endforeach()
|
||||
include_directories(${_ALL_INCS})
|
||||
endfunction()
|
||||
|
||||
function(blender_include_dirs_sys
|
||||
includes
|
||||
)
|
||||
unset(_INC)
|
||||
unset(_ABS_INC)
|
||||
unset(_ALL_INCS)
|
||||
endmacro()
|
||||
|
||||
macro(blender_include_dirs_sys
|
||||
includes)
|
||||
set(_ALL_INCS "")
|
||||
foreach(_INC ${ARGV})
|
||||
get_filename_component(_ABS_INC ${_INC} ABSOLUTE)
|
||||
@@ -171,11 +161,13 @@ function(blender_include_dirs_sys
|
||||
##endif()
|
||||
endforeach()
|
||||
include_directories(SYSTEM ${_ALL_INCS})
|
||||
endfunction()
|
||||
unset(_INC)
|
||||
unset(_ABS_INC)
|
||||
unset(_ALL_INCS)
|
||||
endmacro()
|
||||
|
||||
function(blender_source_group
|
||||
sources
|
||||
)
|
||||
macro(blender_source_group
|
||||
sources)
|
||||
|
||||
# Group by location on disk
|
||||
source_group("Source Files" FILES CMakeLists.txt)
|
||||
@@ -185,23 +177,23 @@ function(blender_source_group
|
||||
if((${_SRC_EXT} MATCHES ".h") OR
|
||||
(${_SRC_EXT} MATCHES ".hpp") OR
|
||||
(${_SRC_EXT} MATCHES ".hh"))
|
||||
|
||||
set(GROUP_ID "Header Files")
|
||||
source_group("Header Files" FILES ${_SRC})
|
||||
else()
|
||||
set(GROUP_ID "Source Files")
|
||||
source_group("Source Files" FILES ${_SRC})
|
||||
endif()
|
||||
source_group("${GROUP_ID}" FILES ${_SRC})
|
||||
endforeach()
|
||||
endfunction()
|
||||
|
||||
unset(_SRC)
|
||||
unset(_SRC_EXT)
|
||||
endmacro()
|
||||
|
||||
|
||||
# only MSVC uses SOURCE_GROUP
|
||||
function(blender_add_lib_nolist
|
||||
macro(blender_add_lib_nolist
|
||||
name
|
||||
sources
|
||||
includes
|
||||
includes_sys
|
||||
)
|
||||
includes_sys)
|
||||
|
||||
# message(STATUS "Configuring library ${name}")
|
||||
|
||||
@@ -212,8 +204,6 @@ function(blender_add_lib_nolist
|
||||
|
||||
add_library(${name} ${sources})
|
||||
|
||||
target_link_libraries(${name} ${lib_depends})
|
||||
|
||||
# works fine without having the includes
|
||||
# listed is helpful for IDE's (QtCreator/MSVC)
|
||||
blender_source_group("${sources}")
|
||||
@@ -223,27 +213,22 @@ function(blender_add_lib_nolist
|
||||
# Not for system includes because they can resolve to the same path
|
||||
# list_assert_duplicates("${includes_sys}")
|
||||
|
||||
endfunction()
|
||||
endmacro()
|
||||
|
||||
|
||||
function(blender_add_lib
|
||||
macro(blender_add_lib
|
||||
name
|
||||
sources
|
||||
includes
|
||||
includes_sys
|
||||
libs
|
||||
)
|
||||
includes_sys)
|
||||
|
||||
blender_add_lib_nolist(${name} "${sources}" "${includes}" "${includes_sys}")
|
||||
|
||||
target_link_libraries(${name} "${libs}")
|
||||
|
||||
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})
|
||||
|
||||
if(WITH_PYTHON) # AND NOT WITH_PYTHON_MODULE # WIN32 needs
|
||||
@@ -303,27 +288,24 @@ function(SETUP_LIBDIRS)
|
||||
if(WIN32 AND NOT UNIX)
|
||||
link_directories(${PTHREADS_LIBPATH})
|
||||
endif()
|
||||
endfunction()
|
||||
endmacro()
|
||||
|
||||
function(setup_liblinks
|
||||
target
|
||||
)
|
||||
macro(setup_liblinks
|
||||
target)
|
||||
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${PLATFORM_LINKFLAGS}" PARENT_SCOPE)
|
||||
set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} ${PLATFORM_LINKFLAGS_DEBUG}" 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}")
|
||||
|
||||
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${PLATFORM_LINKFLAGS}" PARENT_SCOPE)
|
||||
set(CMAKE_SHARED_LINKER_FLAGS_DEBUG "${CMAKE_SHARED_LINKER_FLAGS_DEBUG} ${PLATFORM_LINKFLAGS_DEBUG}" PARENT_SCOPE)
|
||||
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${PLATFORM_LINKFLAGS}")
|
||||
set(CMAKE_SHARED_LINKER_FLAGS_DEBUG "${CMAKE_SHARED_LINKER_FLAGS_DEBUG} ${PLATFORM_LINKFLAGS_DEBUG}")
|
||||
|
||||
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} ${PLATFORM_LINKFLAGS}" PARENT_SCOPE)
|
||||
set(CMAKE_MODULE_LINKER_FLAGS_DEBUG "${CMAKE_MODULE_LINKER_FLAGS_DEBUG} ${PLATFORM_LINKFLAGS_DEBUG}" PARENT_SCOPE)
|
||||
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} ${PLATFORM_LINKFLAGS}")
|
||||
set(CMAKE_MODULE_LINKER_FLAGS_DEBUG "${CMAKE_MODULE_LINKER_FLAGS_DEBUG} ${PLATFORM_LINKFLAGS_DEBUG}")
|
||||
|
||||
target_link_libraries(
|
||||
${target}
|
||||
${PNG_LIBRARIES}
|
||||
${ZLIB_LIBRARIES}
|
||||
${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
|
||||
if(WITH_PYTHON) # AND NOT WITH_PYTHON_MODULE # WIN32 needs
|
||||
@@ -348,9 +330,6 @@ function(setup_liblinks
|
||||
if(WITH_BULLET AND WITH_SYSTEM_BULLET)
|
||||
target_link_libraries(${target} ${BULLET_LIBRARIES})
|
||||
endif()
|
||||
if(WITH_AUDASPACE AND WITH_SYSTEM_AUDASPACE)
|
||||
target_link_libraries(${target} ${AUDASPACE_C_LIBRARIES} ${AUDASPACE_PY_LIBRARIES})
|
||||
endif()
|
||||
if(WITH_OPENAL)
|
||||
target_link_libraries(${target} ${OPENAL_LIBRARY})
|
||||
endif()
|
||||
@@ -378,16 +357,6 @@ function(setup_liblinks
|
||||
if(WITH_OPENCOLORIO)
|
||||
target_link_libraries(${target} ${OPENCOLORIO_LIBRARIES})
|
||||
endif()
|
||||
if(WITH_OPENSUBDIV)
|
||||
if(WIN32 AND NOT UNIX)
|
||||
file_list_suffix(OPENSUBDIV_LIBRARIES_DEBUG "${OPENSUBDIV_LIBRARIES}" "_d")
|
||||
target_link_libraries_debug(${target} "${OPENSUBDIV_LIBRARIES_DEBUG}")
|
||||
target_link_libraries_optimized(${target} "${OPENSUBDIV_LIBRARIES}")
|
||||
unset(OPENSUBDIV_LIBRARIES_DEBUG)
|
||||
else()
|
||||
target_link_libraries(${target} ${OPENSUBDIV_LIBRARIES})
|
||||
endif()
|
||||
endif()
|
||||
if(WITH_CYCLES_OSL)
|
||||
target_link_libraries(${target} ${OSL_LIBRARIES})
|
||||
endif()
|
||||
@@ -433,13 +402,11 @@ function(setup_liblinks
|
||||
unset(EXPAT_LIB_DEBUG)
|
||||
endif()
|
||||
else()
|
||||
target_link_libraries(
|
||||
${target}
|
||||
${OPENCOLLADA_LIBRARIES}
|
||||
${PCRE_LIBRARIES}
|
||||
${XML2_LIBRARIES}
|
||||
${EXPAT_LIB}
|
||||
)
|
||||
target_link_libraries(${target}
|
||||
${OPENCOLLADA_LIBRARIES}
|
||||
${PCRE_LIBRARIES}
|
||||
${XML2_LIBRARIES}
|
||||
${EXPAT_LIB})
|
||||
endif()
|
||||
endif()
|
||||
if(WITH_MEM_JEMALLOC)
|
||||
@@ -454,6 +421,12 @@ function(setup_liblinks
|
||||
if(WITH_LLVM)
|
||||
target_link_libraries(${target} ${LLVM_LIBRARY})
|
||||
endif()
|
||||
if(WITH_ALEMBIC)
|
||||
target_link_libraries(${target} ${ALEMBIC_LIBRARIES})
|
||||
endif()
|
||||
if(WITH_HDF5)
|
||||
target_link_libraries(${target} ${HDF5_LIBRARIES})
|
||||
endif()
|
||||
if(WIN32 AND NOT UNIX)
|
||||
target_link_libraries(${target} ${PTHREADS_LIBRARIES})
|
||||
endif()
|
||||
@@ -469,13 +442,10 @@ function(setup_liblinks
|
||||
${BLENDER_GL_LIBRARIES})
|
||||
|
||||
target_link_libraries(${target} ${PLATFORM_LINKLIBS} ${CMAKE_DL_LIBS})
|
||||
endfunction()
|
||||
endmacro()
|
||||
|
||||
|
||||
function(SETUP_BLENDER_SORTED_LIBS)
|
||||
|
||||
# get_property(BLENDER_LINK_LIBS GLOBAL PROPERTY BLENDER_LINK_LIBS)
|
||||
set(BLENDER_LINK_LIBS)
|
||||
macro(SETUP_BLENDER_SORTED_LIBS)
|
||||
get_property(BLENDER_LINK_LIBS GLOBAL PROPERTY BLENDER_LINK_LIBS)
|
||||
|
||||
list(APPEND BLENDER_LINK_LIBS
|
||||
bf_windowmanager
|
||||
@@ -552,15 +522,14 @@ function(SETUP_BLENDER_SORTED_LIBS)
|
||||
bf_ikplugin
|
||||
bf_modifiers
|
||||
bf_bmesh
|
||||
bf_gpu
|
||||
bf_blenkernel
|
||||
bf_physics
|
||||
bf_nodes
|
||||
bf_rna
|
||||
bf_gpu
|
||||
bf_blenloader
|
||||
bf_imbuf
|
||||
bf_blenlib
|
||||
bf_depsgraph
|
||||
bf_intern_ghost
|
||||
bf_intern_string
|
||||
bf_avi
|
||||
@@ -597,7 +566,8 @@ function(SETUP_BLENDER_SORTED_LIBS)
|
||||
ge_videotex
|
||||
bf_dna
|
||||
bf_blenfont
|
||||
bf_blentranslation
|
||||
bf_pointcache_alembic
|
||||
bf_pointcache
|
||||
bf_intern_audaspace
|
||||
bf_intern_mikktspace
|
||||
bf_intern_dualcon
|
||||
@@ -615,7 +585,6 @@ function(SETUP_BLENDER_SORTED_LIBS)
|
||||
extern_libmv
|
||||
extern_glog
|
||||
extern_sdlew
|
||||
extern_eigen3
|
||||
|
||||
bf_intern_glew_mx
|
||||
)
|
||||
@@ -694,10 +663,6 @@ function(SETUP_BLENDER_SORTED_LIBS)
|
||||
list_insert_after(BLENDER_SORTED_LIBS "ge_logic_ngnetwork" "extern_bullet")
|
||||
endif()
|
||||
|
||||
if(WITH_OPENSUBDIV)
|
||||
list(APPEND BLENDER_SORTED_LIBS bf_intern_opensubdiv)
|
||||
endif()
|
||||
|
||||
foreach(SORTLIB ${BLENDER_SORTED_LIBS})
|
||||
set(REMLIB ${SORTLIB})
|
||||
foreach(SEARCHLIB ${BLENDER_LINK_LIBS})
|
||||
@@ -716,12 +681,14 @@ function(SETUP_BLENDER_SORTED_LIBS)
|
||||
message(STATUS "Blender Skipping: (${REM_MSG})")
|
||||
endif()
|
||||
|
||||
|
||||
set(BLENDER_SORTED_LIBS ${BLENDER_SORTED_LIBS} PARENT_SCOPE)
|
||||
unset(SEARCHLIB)
|
||||
unset(SORTLIB)
|
||||
unset(REMLIB)
|
||||
unset(REM_MSG)
|
||||
|
||||
# for top-level tests
|
||||
set_property(GLOBAL PROPERTY BLENDER_SORTED_LIBS_PROP ${BLENDER_SORTED_LIBS})
|
||||
endfunction()
|
||||
endmacro()
|
||||
|
||||
macro(TEST_SSE_SUPPORT
|
||||
_sse_flags
|
||||
@@ -943,22 +910,19 @@ endmacro()
|
||||
|
||||
# utility macro
|
||||
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_DEBUG "${CMAKE_C_FLAGS_DEBUG}")
|
||||
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_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO}")
|
||||
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_RELEASE "${CMAKE_C_FLAGS_RELEASE}")
|
||||
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_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
||||
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_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL}")
|
||||
string(REGEX REPLACE ${flag} "" CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}")
|
||||
endforeach()
|
||||
unset(flag)
|
||||
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_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}")
|
||||
string(REGEX REPLACE ${flag} "" CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL}")
|
||||
string(REGEX REPLACE ${flag} "" CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}")
|
||||
|
||||
endmacro()
|
||||
|
||||
@@ -972,34 +936,28 @@ endmacro()
|
||||
macro(remove_strict_flags)
|
||||
|
||||
if(CMAKE_COMPILER_IS_GNUCC)
|
||||
remove_cc_flag(
|
||||
"-Wstrict-prototypes"
|
||||
"-Wmissing-prototypes"
|
||||
"-Wmissing-format-attribute"
|
||||
"-Wunused-local-typedefs"
|
||||
"-Wunused-macros"
|
||||
"-Wunused-parameter"
|
||||
"-Wwrite-strings"
|
||||
"-Wredundant-decls"
|
||||
"-Wundef"
|
||||
"-Wshadow"
|
||||
"-Wdouble-promotion"
|
||||
"-Wold-style-definition"
|
||||
"-Werror=[^ ]+"
|
||||
"-Werror"
|
||||
)
|
||||
remove_cc_flag("-Wstrict-prototypes")
|
||||
remove_cc_flag("-Wmissing-prototypes")
|
||||
remove_cc_flag("-Wunused-parameter")
|
||||
remove_cc_flag("-Wunused-macros")
|
||||
remove_cc_flag("-Wwrite-strings")
|
||||
remove_cc_flag("-Wredundant-decls")
|
||||
remove_cc_flag("-Wundef")
|
||||
remove_cc_flag("-Wshadow")
|
||||
remove_cc_flag("-Wdouble-promotion")
|
||||
remove_cc_flag("-Wold-style-definition")
|
||||
remove_cc_flag("-Werror=[^ ]+")
|
||||
remove_cc_flag("-Werror")
|
||||
|
||||
# negate flags implied by '-Wall'
|
||||
add_cc_flag("${CC_REMOVE_STRICT_FLAGS}")
|
||||
endif()
|
||||
|
||||
if(CMAKE_C_COMPILER_ID MATCHES "Clang")
|
||||
remove_cc_flag(
|
||||
"-Wunused-parameter"
|
||||
"-Wunused-variable"
|
||||
"-Werror=[^ ]+"
|
||||
"-Werror"
|
||||
)
|
||||
remove_cc_flag("-Wunused-parameter")
|
||||
remove_cc_flag("-Wunused-variable")
|
||||
remove_cc_flag("-Werror=[^ ]+")
|
||||
remove_cc_flag("-Werror")
|
||||
|
||||
# negate flags implied by '-Wall'
|
||||
add_cc_flag("${CC_REMOVE_STRICT_FLAGS}")
|
||||
@@ -1011,24 +969,6 @@ macro(remove_strict_flags)
|
||||
|
||||
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.
|
||||
# at the moment we cant shut up ffmpeg deprecations, so use this, but will
|
||||
# probably add more removals here.
|
||||
@@ -1057,39 +997,37 @@ macro(remove_strict_flags_file
|
||||
endmacro()
|
||||
|
||||
|
||||
function(ADD_CHECK_C_COMPILER_FLAG
|
||||
macro(ADD_CHECK_C_COMPILER_FLAG
|
||||
_CFLAGS
|
||||
_CACHE_VAR
|
||||
_FLAG
|
||||
)
|
||||
_FLAG)
|
||||
|
||||
include(CheckCCompilerFlag)
|
||||
|
||||
CHECK_C_COMPILER_FLAG("${_FLAG}" "${_CACHE_VAR}")
|
||||
if(${_CACHE_VAR})
|
||||
# message(STATUS "Using CFLAG: ${_FLAG}")
|
||||
set(${_CFLAGS} "${${_CFLAGS}} ${_FLAG}" PARENT_SCOPE)
|
||||
set(${_CFLAGS} "${${_CFLAGS}} ${_FLAG}")
|
||||
else()
|
||||
message(STATUS "Unsupported CFLAG: ${_FLAG}")
|
||||
endif()
|
||||
endfunction()
|
||||
endmacro()
|
||||
|
||||
function(ADD_CHECK_CXX_COMPILER_FLAG
|
||||
macro(ADD_CHECK_CXX_COMPILER_FLAG
|
||||
_CXXFLAGS
|
||||
_CACHE_VAR
|
||||
_FLAG
|
||||
)
|
||||
_FLAG)
|
||||
|
||||
include(CheckCXXCompilerFlag)
|
||||
|
||||
CHECK_CXX_COMPILER_FLAG("${_FLAG}" "${_CACHE_VAR}")
|
||||
if(${_CACHE_VAR})
|
||||
# message(STATUS "Using CXXFLAG: ${_FLAG}")
|
||||
set(${_CXXFLAGS} "${${_CXXFLAGS}} ${_FLAG}" PARENT_SCOPE)
|
||||
set(${_CXXFLAGS} "${${_CXXFLAGS}} ${_FLAG}")
|
||||
else()
|
||||
message(STATUS "Unsupported CXXFLAG: ${_FLAG}")
|
||||
endif()
|
||||
endfunction()
|
||||
endmacro()
|
||||
|
||||
function(get_blender_version)
|
||||
# extracts header vars and defines them in the parent scope:
|
||||
@@ -1239,7 +1177,7 @@ endmacro()
|
||||
# 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
|
||||
# the files in them. used by cycles to install addon.
|
||||
function(delayed_install
|
||||
macro(delayed_install
|
||||
base
|
||||
files
|
||||
destination)
|
||||
@@ -1252,7 +1190,8 @@ function(delayed_install
|
||||
endif()
|
||||
set_property(GLOBAL APPEND PROPERTY DELAYED_INSTALL_DESTINATIONS ${destination})
|
||||
endforeach()
|
||||
endfunction()
|
||||
unset(f)
|
||||
endmacro()
|
||||
|
||||
# note this is a function instead of a macro so that ${BUILD_TYPE} in targetdir
|
||||
# does not get expanded in calling but is preserved
|
||||
@@ -1271,59 +1210,62 @@ function(delayed_do_install
|
||||
list(GET destinations ${i} d)
|
||||
install(FILES ${f} DESTINATION ${targetdir}/${d})
|
||||
endforeach()
|
||||
unset(f)
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
|
||||
function(data_to_c
|
||||
file_from file_to
|
||||
list_to_add
|
||||
)
|
||||
macro(data_to_c
|
||||
file_from file_to
|
||||
list_to_add)
|
||||
|
||||
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)
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT ${file_to}
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory ${_file_to_path}
|
||||
COMMAND "$<TARGET_FILE:datatoc>" ${file_from} ${file_to}
|
||||
COMMAND ${CMAKE_BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}/datatoc ${file_from} ${file_to}
|
||||
DEPENDS ${file_from} datatoc)
|
||||
|
||||
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.
|
||||
function(data_to_c_simple
|
||||
file_from
|
||||
list_to_add
|
||||
)
|
||||
macro(data_to_c_simple
|
||||
file_from
|
||||
list_to_add)
|
||||
|
||||
# remove ../'s
|
||||
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)
|
||||
|
||||
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)
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT ${_file_to}
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory ${_file_to_path}
|
||||
COMMAND "$<TARGET_FILE:datatoc>" ${_file_from} ${_file_to}
|
||||
COMMAND ${CMAKE_BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}/datatoc ${_file_from} ${_file_to}
|
||||
DEPENDS ${_file_from} datatoc)
|
||||
|
||||
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
|
||||
function(data_to_c_simple_icons
|
||||
path_from
|
||||
list_to_add
|
||||
)
|
||||
macro(data_to_c_simple_icons
|
||||
path_from
|
||||
list_to_add
|
||||
)
|
||||
|
||||
# Conversion steps
|
||||
# path_from -> _file_from -> _file_to
|
||||
@@ -1335,7 +1277,6 @@ function(data_to_c_simple_icons
|
||||
get_filename_component(_file_to ${CMAKE_CURRENT_BINARY_DIR}/${path_from}.png.c REALPATH)
|
||||
|
||||
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)
|
||||
|
||||
@@ -1346,8 +1287,8 @@ function(data_to_c_simple_icons
|
||||
OUTPUT ${_file_from} ${_file_to}
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory ${_file_to_path}
|
||||
#COMMAND python3 ${CMAKE_SOURCE_DIR}/source/blender/datatoc/datatoc_icon.py ${_path_from_abs} ${_file_from}
|
||||
COMMAND "$<TARGET_FILE:datatoc_icon>" ${_path_from_abs} ${_file_from}
|
||||
COMMAND "$<TARGET_FILE:datatoc>" ${_file_from} ${_file_to}
|
||||
COMMAND ${CMAKE_BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}/datatoc_icon ${_path_from_abs} ${_file_from}
|
||||
COMMAND ${CMAKE_BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}/datatoc ${_file_from} ${_file_to}
|
||||
DEPENDS
|
||||
${_icon_files}
|
||||
datatoc_icon
|
||||
@@ -1357,22 +1298,27 @@ function(data_to_c_simple_icons
|
||||
)
|
||||
|
||||
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...
|
||||
function(svg_to_png
|
||||
file_from
|
||||
file_to
|
||||
dpi
|
||||
list_to_add
|
||||
)
|
||||
macro(svg_to_png
|
||||
file_from
|
||||
file_to
|
||||
dpi
|
||||
list_to_add)
|
||||
|
||||
# remove ../'s
|
||||
get_filename_component(_file_from ${CMAKE_CURRENT_SOURCE_DIR}/${file_from} REALPATH)
|
||||
get_filename_component(_file_to ${CMAKE_CURRENT_SOURCE_DIR}/${file_to} REALPATH)
|
||||
|
||||
list(APPEND ${list_to_add} ${_file_to})
|
||||
set(${list_to_add} ${${list_to_add}} PARENT_SCOPE)
|
||||
|
||||
find_program(INKSCAPE_EXE inkscape)
|
||||
mark_as_advanced(INKSCAPE_EXE)
|
||||
@@ -1395,12 +1341,15 @@ function(svg_to_png
|
||||
else()
|
||||
message(WARNING "Inkscape not found, could not re-generate ${_file_to} from ${_file_from}!")
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
function(msgfmt_simple
|
||||
file_from
|
||||
list_to_add
|
||||
)
|
||||
unset(_file_from)
|
||||
unset(_file_to)
|
||||
|
||||
endmacro()
|
||||
|
||||
macro(msgfmt_simple
|
||||
file_from
|
||||
list_to_add)
|
||||
|
||||
# remove ../'s
|
||||
get_filename_component(_file_from_we ${file_from} NAME_WE)
|
||||
@@ -1409,22 +1358,25 @@ function(msgfmt_simple
|
||||
get_filename_component(_file_to ${CMAKE_CURRENT_BINARY_DIR}/${_file_from_we}.mo REALPATH)
|
||||
|
||||
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)
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT ${_file_to}
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory ${_file_to_path}
|
||||
COMMAND "$<TARGET_FILE:msgfmt>" ${_file_from} ${_file_to}
|
||||
COMMAND ${CMAKE_BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}/msgfmt ${_file_from} ${_file_to}
|
||||
DEPENDS msgfmt ${_file_from})
|
||||
|
||||
set_source_files_properties(${_file_to} PROPERTIES GENERATED TRUE)
|
||||
endfunction()
|
||||
|
||||
function(find_python_package
|
||||
package
|
||||
)
|
||||
unset(_file_from_we)
|
||||
unset(_file_from)
|
||||
unset(_file_to)
|
||||
unset(_file_to_path)
|
||||
endmacro()
|
||||
|
||||
macro(find_python_package
|
||||
package)
|
||||
|
||||
string(TOUPPER ${package} _upper_package)
|
||||
|
||||
@@ -1462,17 +1414,25 @@ function(find_python_package
|
||||
"'${PYTHON_LIBPATH}/python${PYTHON_VERSION}/dist-packages/${package}', "
|
||||
"'${PYTHON_LIBPATH}/python${_PY_VER_MAJOR}/dist-packages/${package}', "
|
||||
"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()
|
||||
message(STATUS "${package} found at '${PYTHON_${_upper_package}_PATH}'")
|
||||
endif()
|
||||
|
||||
unset(_PY_VER_SPLIT)
|
||||
unset(_PY_VER_MAJOR)
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
unset(_upper_package)
|
||||
endmacro()
|
||||
|
||||
# like Python's 'print(dir())'
|
||||
function(print_all_vars)
|
||||
macro(print_all_vars)
|
||||
get_cmake_property(_vars VARIABLES)
|
||||
foreach(_var ${_vars})
|
||||
message("${_var}=${${_var}}")
|
||||
endforeach()
|
||||
endfunction()
|
||||
unset(_vars)
|
||||
unset(_var)
|
||||
endmacro()
|
||||
|
||||
|
@@ -21,10 +21,10 @@ SET(CPACK_PACKAGE_VERSION_PATCH "${PATCH_VERSION}")
|
||||
# Get the build revision, note that this can get out-of-sync, so for packaging run cmake first.
|
||||
set(MY_WC_HASH "unknown")
|
||||
if(EXISTS ${CMAKE_SOURCE_DIR}/.git/)
|
||||
find_package(Git)
|
||||
include(FindGit)
|
||||
if(GIT_FOUND)
|
||||
message(STATUS "Found Git: ${GIT_EXECUTABLE}")
|
||||
execute_process(COMMAND git rev-parse --short HEAD
|
||||
message(STATUS "-- Found Git: ${GIT_EXECUTABLE}")
|
||||
execute_process(COMMAND git rev-parse --short @{u}
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||
OUTPUT_VARIABLE MY_WC_HASH
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
@@ -37,8 +37,7 @@ unset(MY_WC_HASH)
|
||||
|
||||
# Force Package Name
|
||||
execute_process(COMMAND date "+%Y%m%d" OUTPUT_VARIABLE CPACK_DATE OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
string(TOLOWER ${PROJECT_NAME} PROJECT_NAME_LOWER)
|
||||
set(CPACK_PACKAGE_FILE_NAME ${PROJECT_NAME_LOWER}-${MAJOR_VERSION}.${MINOR_VERSION}.${PATCH_VERSION}-git${CPACK_DATE}.${BUILD_REV}-${CMAKE_SYSTEM_PROCESSOR})
|
||||
set(CPACK_PACKAGE_FILE_NAME ${PROJECT_NAME}-${MAJOR_VERSION}.${MINOR_VERSION}.${PATCH_VERSION}-git${CPACK_DATE}.${BUILD_REV}-${CMAKE_SYSTEM_PROCESSOR})
|
||||
|
||||
if(CMAKE_SYSTEM_NAME MATCHES "Linux")
|
||||
# RPM packages
|
||||
@@ -74,7 +73,6 @@ if(WIN32)
|
||||
set(CPACK_WIX_PRODUCT_ICON ${CMAKE_SOURCE_DIR}/source/icons/winblender.ico)
|
||||
set(CPACK_WIX_UPGRADE_GUID "B767E4FD-7DE7-4094-B051-3AE62E13A17A")
|
||||
|
||||
set(CPACK_WIX_TEMPLATE ${LIBDIR}/package/installer_wix/WIX.template)
|
||||
set(CPACK_WIX_UI_BANNER ${LIBDIR}/package/installer_wix/WIX_UI_BANNER.bmp)
|
||||
set(CPACK_WIX_UI_DIALOG ${LIBDIR}/package/installer_wix/WIX_UI_DIALOG.bmp)
|
||||
|
||||
@@ -114,9 +112,3 @@ elseif(UNIX)
|
||||
"tar.bz2")
|
||||
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():
|
||||
""" Extract includes and defines from cmake.
|
||||
""" Extracr includes and defines from cmake.
|
||||
"""
|
||||
|
||||
make_exe = cmake_cache_var("CMAKE_MAKE_PROGRAM")
|
||||
|
@@ -59,21 +59,14 @@ def is_c_any(filename):
|
||||
CMAKE_DIR = "."
|
||||
|
||||
|
||||
def cmake_cache_var_iter():
|
||||
import re
|
||||
re_cache = re.compile(r'([A-Za-z0-9_\-]+)?:?([A-Za-z0-9_\-]+)?=(.*)$')
|
||||
with open(join(CMAKE_DIR, "CMakeCache.txt"), 'r', encoding='utf-8') as cache_file:
|
||||
for l in cache_file:
|
||||
match = re_cache.match(l.strip())
|
||||
if match is not None:
|
||||
var, type_, val = match.groups()
|
||||
yield (var, type_ or "", val)
|
||||
|
||||
|
||||
def cmake_cache_var(var):
|
||||
for var_iter, type_iter, value_iter in cmake_cache_var_iter():
|
||||
if var == var_iter:
|
||||
return value_iter
|
||||
cache_file = open(join(CMAKE_DIR, "CMakeCache.txt"))
|
||||
lines = [l_strip for l in cache_file for l_strip in (l.strip(),) if l_strip if not l_strip.startswith("//") if not l_strip.startswith("#")]
|
||||
cache_file.close()
|
||||
|
||||
for l in lines:
|
||||
if l.split(":")[0] == var:
|
||||
return l.split("=", 1)[-1]
|
||||
return None
|
||||
|
||||
|
||||
|
@@ -12,9 +12,9 @@ blender_version_char=$(sed -ne 's/.*BLENDER_VERSION_CHAR.*\([a-z]\)$/\1/p' $blen
|
||||
# map the version a -> 1
|
||||
# not to be confused with blender's internal subversions
|
||||
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
|
||||
blender_version_full=${blender_version}
|
||||
blender_version_full=${blender_version}
|
||||
fi
|
||||
|
||||
blender_ver_string=$blender_version+git$blender_version_full
|
||||
@@ -60,7 +60,7 @@ package() {
|
||||
cd $srcdir/build
|
||||
make DESTDIR="$pkgdir" install
|
||||
python -m compileall \
|
||||
$pkgdir/usr/share/blender/$blender_version/scripts/startup \
|
||||
$pkgdir/usr/share/blender/$blender_version/scripts/modules \
|
||||
$pkgdir/usr/share/blender/$blender_version/scripts/addons
|
||||
$pkgdir/usr/share/blender/$blender_version/scripts/startup \
|
||||
$pkgdir/usr/share/blender/$blender_version/scripts/modules \
|
||||
$pkgdir/usr/share/blender/$blender_version/scripts/addons
|
||||
}
|
||||
|
@@ -52,8 +52,6 @@ BF_CXX = '/usr'
|
||||
WITH_BF_STATICCXX = False
|
||||
BF_CXX_LIB_STATIC = '${BF_CXX}/lib/libstdc++.a'
|
||||
|
||||
WITH_BF_AUDASPACE = True
|
||||
|
||||
# we use simply jack framework
|
||||
WITH_BF_JACK = True
|
||||
BF_JACK = '/Library/Frameworks/Jackmp.framework'
|
||||
@@ -215,12 +213,6 @@ WITH_BF_FREESTYLE = True
|
||||
#OpenMP ( will be checked for compiler support and turned off eventually )
|
||||
WITH_BF_OPENMP = True
|
||||
|
||||
WITH_BF_OPENSUBDIV = False
|
||||
BF_OPENSUBDIV = LIBDIR + '/opensubdiv'
|
||||
BF_OPENSUBDIV_INC = '${BF_OPENSUBDIV}/include'
|
||||
BF_OPENSUBDIV_LIB = 'osdCPU osdGPU'
|
||||
BF_OPENSUBDIV_LIBPATH = '${BF_OPENSUBDIV}/lib'
|
||||
|
||||
#Ray trace optimization
|
||||
WITH_BF_RAYOPTIMIZATION = True
|
||||
BF_RAYOPTIMIZATION_SSE_FLAGS = []
|
||||
|
@@ -26,8 +26,6 @@ BF_CXX = '/usr'
|
||||
WITH_BF_STATICCXX = False
|
||||
BF_CXX_LIB_STATIC = '${BF_CXX}/lib/libstdc++.a'
|
||||
|
||||
WITH_BF_AUDASPACE = True
|
||||
|
||||
WITH_BF_JACK = False
|
||||
BF_JACK = '/usr'
|
||||
BF_JACK_INC = '${BF_JACK}/include/jack'
|
||||
@@ -54,9 +52,9 @@ BF_OPENEXR = '/usr'
|
||||
# BF_OPENEXR_INC = '${BF_OPENEXR}/include/OpenEXR ${BF_OPENEXR}/include'
|
||||
|
||||
BF_OPENEXR_INC = '${BF_OPENEXR}/include/OpenEXR'
|
||||
BF_OPENEXR_LIB = 'Half IlmImf Iex Imath '
|
||||
BF_OPENEXR_LIB = 'Half IlmImf-2_1 Iex-2_1 Imath-2_1 '
|
||||
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_LIBPATH = '${BF_OPENEXR}/lib'
|
||||
BF_OPENEXR_LIBPATH = '${BF_OPENEXR}/lib'
|
||||
|
||||
|
||||
WITH_BF_DDS = True
|
||||
@@ -208,7 +206,7 @@ WITH_BF_CYCLES = WITH_BF_OIIO and WITH_BF_BOOST
|
||||
|
||||
WITH_BF_CYCLES_CUDA_BINARIES = False
|
||||
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
|
||||
|
||||
@@ -228,20 +226,24 @@ BF_3DMOUSE_LIB_STATIC = '${BF_3DMOUSE_LIBPATH}/libspnav.a'
|
||||
#Freestyle
|
||||
WITH_BF_FREESTYLE = True
|
||||
|
||||
WITH_BF_OPENSUBDIV = False
|
||||
WITH_BF_STATICOPENSUBDIV = False
|
||||
BF_OPENSUBDIV = '/usr'
|
||||
BF_OPENSUBDIV_INC = '${BF_OPENSUBDIV}/include'
|
||||
BF_OPENSUBDIV_LIB = 'osdCPU osdGPU'
|
||||
BF_OPENSUBDIV_LIB_STATIC = '${BF_OPENSUBDIV_LIBPATH}/libosdGPU.a ${BF_OPENSUBDIV_LIBPATH}/libosdCPU.a'
|
||||
BF_OPENSUBDIV_LIBPATH = '${BF_OPENSUBDIV}/lib'
|
||||
# HDF5
|
||||
WITH_BF_HDF5 = True
|
||||
BF_HDF5 = '/usr'
|
||||
BF_HDF5_LIB = 'hdf5 hdf5_hl'
|
||||
BF_HDF5_LIBPATH='${BF_HDF5}/lib'
|
||||
|
||||
# Alembic
|
||||
WITH_BF_ALEMBIC = True
|
||||
BF_ALEMBIC = '/opt/lib/alembic'
|
||||
BF_ALEMBIC_LIB = 'AlembicAbcGeom AlembicAbc AlembicAbcCollection AlembicAbcCoreFactory AlembicAbcCoreHDF5 AlembicAbcCoreAbstract AlembicAbcCoreOgawa AlembicAbcMaterial AlembicOgawa AlembicUtil'
|
||||
BF_ALEMBIC_INC = '${BF_ALEMBIC}/include'
|
||||
BF_ALEMBIC_LIBPATH='${BF_ALEMBIC}/lib/static'
|
||||
|
||||
##
|
||||
CC = 'gcc'
|
||||
CXX = 'g++'
|
||||
|
||||
CCFLAGS = ['-pipe','-fPIC','-funsigned-char','-fno-strict-aliasing', '-D_LARGEFILE_SOURCE', '-D_FILE_OFFSET_BITS=64','-D_LARGEFILE64_SOURCE']
|
||||
CFLAGS = ['-std=gnu89']
|
||||
CCFLAGS = ['-pipe','-fPIC','-funsigned-char','-fno-strict-aliasing','-D_LARGEFILE_SOURCE', '-D_FILE_OFFSET_BITS=64','-D_LARGEFILE64_SOURCE']
|
||||
CXXFLAGS = []
|
||||
|
||||
CPPFLAGS = []
|
||||
|
@@ -23,8 +23,6 @@ BF_FFMPEG_LIBPATH = LIBDIR + '/ffmpeg/lib'
|
||||
BF_FFMPEG_INC = LIBDIR + '/ffmpeg/include'
|
||||
BF_FFMPEG_DLL = '${BF_FFMPEG_LIBPATH}/avformat-55.dll ${BF_FFMPEG_LIBPATH}/avcodec-55.dll ${BF_FFMPEG_LIBPATH}/avdevice-55.dll ${BF_FFMPEG_LIBPATH}/avutil-52.dll ${BF_FFMPEG_LIBPATH}/swscale-2.dll'
|
||||
|
||||
WITH_BF_AUDASPACE = True
|
||||
|
||||
WITH_BF_JACK = False
|
||||
BF_JACK = LIBDIR + '/jack'
|
||||
BF_JACK_INC = '${BF_JACK}/include'
|
||||
@@ -147,7 +145,7 @@ BF_OPENCOLLADA_LIBPATH = '${BF_OPENCOLLADA}/lib/opencollada'
|
||||
WITH_BF_CYCLES = True
|
||||
WITH_BF_CYCLES_CUDA_BINARIES = False
|
||||
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
|
||||
BF_OIIO = LIBDIR + '/openimageio'
|
||||
@@ -168,12 +166,6 @@ BF_BOOST_LIB = 'boost_date_time-mgw46-mt-s-1_49 boost_filesystem-mgw46-mt-s-1_49
|
||||
BF_BOOST_LIB_INTERNATIONAL = 'boost_locale-mgw46-mt-s-1_49'
|
||||
BF_BOOST_LIBPATH = '${BF_BOOST}/lib'
|
||||
|
||||
WITH_BF_OPENSUBDIV = False
|
||||
BF_OPENSUBDIV = LIBDIR + '/opensubdiv'
|
||||
BF_OPENSUBDIV_INC = '${BF_OPENSUBDIV}/include'
|
||||
BF_OPENSUBDIV_LIB = 'osdCPU osdGPU'
|
||||
BF_OPENSUBDIV_LIBPATH = '${BF_OPENSUBDIV}/lib'
|
||||
|
||||
#Ray trace optimization
|
||||
WITH_BF_RAYOPTIMIZATION = True
|
||||
BF_RAYOPTIMIZATION_SSE_FLAGS = ['-msse']
|
||||
|
@@ -42,8 +42,6 @@ BF_ICONV_INC = '${BF_ICONV}/include'
|
||||
BF_ICONV_LIB = 'iconv'
|
||||
BF_ICONV_LIBPATH = '${BF_ICONV}/lib'
|
||||
|
||||
WITH_BF_AUDASPACE = True
|
||||
|
||||
WITH_BF_JACK = False
|
||||
BF_JACK = LIBDIR + '/jack'
|
||||
BF_JACK_INC = '${BF_JACK}/include ${BF_FFMPEG}/include/msvc'
|
||||
@@ -210,12 +208,6 @@ BF_RAYOPTIMIZATION_SSE_FLAGS = ['/arch:SSE']
|
||||
#Freestyle
|
||||
WITH_BF_FREESTYLE = True
|
||||
|
||||
WITH_BF_OPENSUBDIV = True
|
||||
BF_OPENSUBDIV = LIBDIR + '/opensubdiv'
|
||||
BF_OPENSUBDIV_INC = '${BF_OPENSUBDIV}/include'
|
||||
BF_OPENSUBDIV_LIB = 'osdCPU osdGPU'
|
||||
BF_OPENSUBDIV_LIBPATH = '${BF_OPENSUBDIV}/lib'
|
||||
|
||||
WITH_BF_STATICOPENGL = False
|
||||
BF_OPENGL_INC = '${BF_OPENGL}/include'
|
||||
BF_OPENGL_LIBINC = '${BF_OPENGL}/lib'
|
||||
|
@@ -22,8 +22,6 @@ BF_FFMPEG_LIBPATH = LIBDIR + '/ffmpeg/lib'
|
||||
BF_FFMPEG_INC = LIBDIR + '/ffmpeg/include'
|
||||
BF_FFMPEG_DLL = '${BF_FFMPEG_LIBPATH}/avformat-53.dll ${BF_FFMPEG_LIBPATH}/avcodec-53.dll ${BF_FFMPEG_LIBPATH}/avdevice-53.dll ${BF_FFMPEG_LIBPATH}/avutil-51.dll ${BF_FFMPEG_LIBPATH}/swscale-2.dll ${BF_FFMPEG_LIBPATH}/swresample-0.dll ${BF_FFMPEG_LIBPATH}/xvidcore.dll'
|
||||
|
||||
WITH_BF_AUDASPACE = True
|
||||
|
||||
WITH_BF_JACK = False
|
||||
BF_JACK = LIBDIR + '/jack'
|
||||
BF_JACK_INC = '${BF_JACK}/include'
|
||||
@@ -146,7 +144,7 @@ BF_OPENCOLLADA_LIBPATH = '${BF_OPENCOLLADA}/lib/opencollada'
|
||||
WITH_BF_CYCLES = True
|
||||
WITH_BF_CYCLES_CUDA_BINARIES = False
|
||||
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
|
||||
BF_OIIO = LIBDIR + '/openimageio'
|
||||
@@ -167,12 +165,6 @@ BF_BOOST_LIB = 'boost_date_time-mgw47-mt-s-1_49 boost_date_time-mgw47-mt-sd-1_49
|
||||
BF_BOOST_LIB_INTERNATIONAL = ' boost_locale-mgw47-mt-s-1_49 boost_locale-mgw47-mt-sd-1_49'
|
||||
BF_BOOST_LIBPATH = '${BF_BOOST}/lib'
|
||||
|
||||
WITH_BF_OPENSUBDIV = False
|
||||
BF_OPENSUBDIV = LIBDIR + '/opensubdiv'
|
||||
BF_OPENSUBDIV_INC = '${BF_OPENSUBDIV}/include'
|
||||
BF_OPENSUBDIV_LIB = 'osdCPU osdGPU'
|
||||
BF_OPENSUBDIV_LIBPATH = '${BF_OPENSUBDIV}/lib'
|
||||
|
||||
#Ray trace optimization
|
||||
WITH_BF_RAYOPTIMIZATION = True
|
||||
BF_RAYOPTIMIZATION_SSE_FLAGS = ['-mmmx', '-msse', '-msse2']
|
||||
|
@@ -55,8 +55,6 @@ BF_SDL_INC = '${BF_SDL}/include'
|
||||
BF_SDL_LIB = 'SDL2.lib'
|
||||
BF_SDL_LIBPATH = '${BF_SDL}/lib'
|
||||
|
||||
WITH_BF_AUDASPACE = True
|
||||
|
||||
WITH_BF_JACK = False
|
||||
|
||||
BF_PTHREADS = LIBDIR + '/pthreads'
|
||||
@@ -214,12 +212,6 @@ BF_RAYOPTIMIZATION_SSE_FLAGS = ['']
|
||||
#Freestyle
|
||||
WITH_BF_FREESTYLE = True
|
||||
|
||||
WITH_BF_OPENSUBDIV = True
|
||||
BF_OPENSUBDIV = LIBDIR + '/opensubdiv'
|
||||
BF_OPENSUBDIV_INC = '${BF_OPENSUBDIV}/include'
|
||||
BF_OPENSUBDIV_LIB = 'osdCPU osdGPU'
|
||||
BF_OPENSUBDIV_LIBPATH = '${BF_OPENSUBDIV}/lib'
|
||||
|
||||
WITH_BF_STATICOPENGL = False
|
||||
BF_OPENGL_INC = '${BF_OPENGL}/include'
|
||||
BF_OPENGL_LIBINC = '${BF_OPENGL}/lib'
|
||||
|
@@ -204,10 +204,20 @@ def setup_staticlibs(lenv):
|
||||
libincs += Split(lenv['BF_OIIO_LIBPATH'])
|
||||
if lenv['WITH_BF_STATICOIIO']:
|
||||
statlibs += Split(lenv['BF_OIIO_LIB_STATIC'])
|
||||
|
||||
if lenv['WITH_BF_HDF5']:
|
||||
libincs += Split(lenv['BF_HDF5_LIBPATH'])
|
||||
|
||||
if lenv['WITH_BF_ALEMBIC']:
|
||||
libincs += Split(lenv['BF_ALEMBIC_LIBPATH'])
|
||||
if lenv['WITH_BF_STATICALEMBIC']:
|
||||
statlibs += Split(lenv['BF_ALEMBIC_LIB_STATIC'])
|
||||
|
||||
if lenv['WITH_BF_OPENEXR']:
|
||||
libincs += Split(lenv['BF_OPENEXR_LIBPATH'])
|
||||
if lenv['WITH_BF_STATICOPENEXR']:
|
||||
statlibs += Split(lenv['BF_OPENEXR_LIB_STATIC'])
|
||||
|
||||
if lenv['WITH_BF_ZLIB'] and lenv['WITH_BF_STATICZLIB']:
|
||||
statlibs += Split(lenv['BF_ZLIB_LIB_STATIC'])
|
||||
|
||||
@@ -242,11 +252,6 @@ def setup_staticlibs(lenv):
|
||||
if lenv['WITH_BF_STATIC3DMOUSE']:
|
||||
statlibs += Split(lenv['BF_3DMOUSE_LIB_STATIC'])
|
||||
|
||||
if lenv['WITH_BF_OPENSUBDIV']:
|
||||
libincs += Split(lenv['BF_OPENSUBDIV_LIBPATH'])
|
||||
if lenv['WITH_BF_STATICOPENSUBDIV']:
|
||||
statlibs += Split(lenv['BF_OPENSUBDIV_LIB_STATIC'])
|
||||
|
||||
# setting this last so any overriding of manually libs could be handled
|
||||
if lenv['OURPLATFORM'] not in ('win32-vc', 'win32-mingw', 'win64-vc', 'linuxcross', 'win64-mingw'):
|
||||
# We must remove any previous items defining this path, for same reason stated above!
|
||||
@@ -288,8 +293,16 @@ def setup_syslibs(lenv):
|
||||
if not lenv['WITH_BF_STATICOCIO']:
|
||||
syslibs += Split(lenv['BF_OCIO_LIB'])
|
||||
|
||||
if lenv['WITH_BF_HDF5']:
|
||||
syslibs += Split(lenv['BF_HDF5_LIB'])
|
||||
|
||||
if lenv['WITH_BF_ALEMBIC']:
|
||||
if not lenv['WITH_BF_STATICALEMBIC']:
|
||||
syslibs += Split(lenv['BF_ALEMBIC_LIB'])
|
||||
|
||||
if lenv['WITH_BF_OPENEXR'] and not lenv['WITH_BF_STATICOPENEXR']:
|
||||
syslibs += Split(lenv['BF_OPENEXR_LIB'])
|
||||
|
||||
if lenv['WITH_BF_ZLIB'] and not lenv['WITH_BF_STATICZLIB']:
|
||||
syslibs += Split(lenv['BF_ZLIB_LIB'])
|
||||
if lenv['WITH_BF_TIFF'] and not lenv['WITH_BF_STATICTIFF']:
|
||||
@@ -349,13 +362,6 @@ def setup_syslibs(lenv):
|
||||
if not lenv['WITH_BF_STATICPNG']:
|
||||
syslibs += Split(lenv['BF_PNG_LIB'])
|
||||
|
||||
if lenv['WITH_BF_OPENSUBDIV']:
|
||||
if not lenv['WITH_BF_STATICOPENSUBDIV']:
|
||||
if lenv['BF_DEBUG'] and lenv['OURPLATFORM'] in ('win32-vc', 'win64-vc', 'win32-mingw', 'win64-mingw'):
|
||||
syslibs += [osdlib+'_d' for osdlib in Split(lenv['BF_OPENSUBDIV_LIB'])]
|
||||
else:
|
||||
syslibs += Split(lenv['BF_OPENSUBDIV_LIB'])
|
||||
|
||||
# Hack to pass OSD libraries to linker before extern_{clew,cuew}
|
||||
for syslib in create_blender_liblist(lenv, 'system'):
|
||||
syslibs.append(os.path.basename(syslib))
|
||||
@@ -384,7 +390,22 @@ def propose_priorities():
|
||||
def creator(env):
|
||||
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/blender/pointcache',
|
||||
'#/source/gameengine/BlenderRoutines',
|
||||
'#/extern/glew/include',
|
||||
'#/source/blender/gpu',
|
||||
env['BF_OPENGL_INC']]
|
||||
|
||||
defs = []
|
||||
|
||||
@@ -642,7 +663,7 @@ def WinPyBundle(target=None, source=None, env=None):
|
||||
py_tar+= '/release/python' + env['BF_PYTHON_VERSION'].replace('.','') + '.tar.gz'
|
||||
|
||||
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):
|
||||
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)
|
||||
@@ -682,8 +703,6 @@ def WinPyBundle(target=None, source=None, env=None):
|
||||
py_dir += '/release/site-packages'
|
||||
# grr, we have to do one by one because the dir exists
|
||||
for f in os.listdir(py_dir):
|
||||
if f == '.svn':
|
||||
continue
|
||||
fn_src = os.path.join(py_dir, f)
|
||||
fn_dst = os.path.join(py_target, f)
|
||||
|
||||
@@ -776,7 +795,7 @@ def AppIt(target=None, source=None, env=None):
|
||||
commands.getoutput(cmd)
|
||||
cmd = 'cp -R %s/kernel/*.h %s/kernel/*.cl %s/kernel/*.cu %s/kernel/' % (croot, croot, croot, cinstalldir)
|
||||
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_math_fast.h %s/util/util_transform.h %s/util/util_types.h %s/kernel/' % (croot, croot, croot, croot, croot, croot, croot, croot, croot, cinstalldir)
|
||||
commands.getoutput(cmd)
|
||||
cmd = 'cp -R %s/../intern/cycles/kernel/*.cubin %s/lib/' % (builddir, cinstalldir)
|
||||
commands.getoutput(cmd)
|
||||
@@ -796,8 +815,6 @@ def AppIt(target=None, source=None, env=None):
|
||||
commands.getoutput(cmd)
|
||||
cmd = 'cp -R %s/release/site-packages/ %s/%s.app/Contents/Resources/%s/python/lib/python%s/site-packages/'%(libdir,installdir,binary,VERSION,env['BF_PYTHON_VERSION'])
|
||||
commands.getoutput(cmd)
|
||||
cmd = 'cp -r %s/python/bin -d %s/%s.app/Contents/Resources/%s/python/'%(libdir,installdir,binary,VERSION)
|
||||
commands.getoutput(cmd)
|
||||
|
||||
cmd = 'chmod +x %s/%s.app/Contents/MacOS/%s'%(installdir,binary, binary)
|
||||
commands.getoutput(cmd)
|
||||
@@ -832,8 +849,6 @@ def AppIt(target=None, source=None, env=None):
|
||||
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
|
||||
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
|
||||
# when making changes to the files that are copied.
|
||||
@@ -857,7 +872,6 @@ def UnixPyBundle(target=None, source=None, env=None):
|
||||
|
||||
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_bin = env.subst(dir + '/python/bin')
|
||||
|
||||
# This is a bit weak, but dont install if its been installed before, makes rebuilds quite slow.
|
||||
if os.path.exists(py_target):
|
||||
@@ -877,11 +891,6 @@ def UnixPyBundle(target=None, source=None, env=None):
|
||||
except:
|
||||
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("rm -rf '%s/distutils'" % py_target)
|
||||
run("rm -rf '%s/lib2to3'" % py_target)
|
||||
|
@@ -107,7 +107,6 @@ def print_arguments(args, bc):
|
||||
def validate_arguments(args, bc):
|
||||
opts_list = [
|
||||
'WITH_BF_FREESTYLE', 'WITH_BF_PYTHON', 'WITH_BF_PYTHON_SAFETY', 'WITH_BF_PYTHON_SECURITY', 'BF_PYTHON', 'BF_PYTHON_VERSION', 'BF_PYTHON_INC', 'BF_PYTHON_BINARY', 'BF_PYTHON_LIB', 'BF_PYTHON_LIBPATH', 'BF_PYTHON_LIBPATH_ARCH', 'WITH_BF_STATICPYTHON', 'WITH_OSX_STATICPYTHON', 'BF_PYTHON_LIB_STATIC', 'BF_PYTHON_DLL', 'BF_PYTHON_ABI_FLAGS',
|
||||
'WITH_BF_AUDASPACE', 'BF_AUDASPACE_C_INC', 'BF_AUDASPACE_PY_INC', 'BF_AUDASPACE_DEF',
|
||||
'WITH_BF_OPENAL', 'BF_OPENAL', 'BF_OPENAL_INC', 'BF_OPENAL_LIB', 'BF_OPENAL_LIBPATH', 'WITH_BF_STATICOPENAL', 'BF_OPENAL_LIB_STATIC',
|
||||
'WITH_BF_SDL', 'BF_SDL', 'BF_SDL_INC', 'BF_SDL_LIB', 'BF_SDL_LIBPATH', 'WITH_BF_SDL_DYNLOAD',
|
||||
'WITH_BF_JACK', 'BF_JACK', 'BF_JACK_INC', 'BF_JACK_LIB', 'BF_JACK_LIBPATH', 'WITH_BF_JACK_DYNLOAD',
|
||||
@@ -184,7 +183,7 @@ def validate_arguments(args, bc):
|
||||
'WITH_BF_LIBMV', 'WITH_BF_LIBMV_SCHUR_SPECIALIZATIONS',
|
||||
'WITH_BF_CYCLES_OSL', 'WITH_BF_STATICOSL', 'BF_OSL', 'BF_OSL_INC', 'BF_OSL_LIB', 'BF_OSL_LIBPATH', 'BF_OSL_LIB_STATIC', 'BF_OSL_COMPILER',
|
||||
'WITH_BF_LLVM', 'WITH_BF_STATICLLVM', 'BF_LLVM', 'BF_LLVM_LIB', 'BF_LLVM_LIBPATH', 'BF_LLVM_LIB_STATIC', 'BF_PROGRAM_LINKFLAGS',
|
||||
'WITH_BF_OPENSUBDIV', 'WITH_BF_STATICOPENSUBDIV', 'BF_OPENSUBDIV', 'BF_OPENSUBDIV_INC', 'BF_OPENSUBDIV_LIB', 'BF_OPENSUBDIV_LIBPATH', 'BF_OPENSUBDIV_LIB_STATIC'
|
||||
'WITH_BF_ALEMBIC', 'BF_ALEMBIC', 'BF_ALEMBIC_INC', 'BF_ALEMBIC_LIB', 'BF_ALEMBIC_LIBPATH',
|
||||
]
|
||||
|
||||
# Have options here that scons expects to be lists
|
||||
@@ -201,7 +200,7 @@ def validate_arguments(args, bc):
|
||||
'LLIBS', 'PLATFORM_LINKFLAGS', 'MACOSX_ARCHITECTURE', 'MACOSX_SDK', 'XCODE_CUR_VER', 'C_COMPILER_ID',
|
||||
'BF_CYCLES_CUDA_BINARIES_ARCH', 'BF_PROGRAM_LINKFLAGS', 'MACOSX_DEPLOYMENT_TARGET',
|
||||
'WITH_BF_CYCLES_DEBUG', 'WITH_BF_CYCLES_LOGGING',
|
||||
'WITH_BF_CPP11', 'WITH_BF_LEGACY_DEPSGRAPH',
|
||||
'WITH_BF_CPP11'
|
||||
]
|
||||
|
||||
|
||||
@@ -299,11 +298,6 @@ def read_opts(env, cfg, args):
|
||||
('BF_OPENAL_LIBPATH', 'Path to OpenAL library', ''),
|
||||
(BoolVariable('WITH_BF_STATICOPENAL', 'Staticly link to openal', False)),
|
||||
|
||||
(BoolVariable('WITH_BF_AUDASPACE', 'Build with audaspace if true', True)),
|
||||
('BF_AUDASPACE_C_INC', 'audaspace-c include path', ''),
|
||||
('BF_AUDASPACE_PY_INC', 'audaspace-py include path', ''),
|
||||
('BF_AUDASPACE_DEF', 'audaspace defines', ''),
|
||||
|
||||
(BoolVariable('WITH_BF_SDL', 'Use SDL if true', False)),
|
||||
('BF_SDL', 'SDL base path', ''),
|
||||
('BF_SDL_INC', 'SDL include path', ''),
|
||||
@@ -588,6 +582,19 @@ def read_opts(env, cfg, args):
|
||||
(BoolVariable('WITH_BF_LIBMV_SCHUR_SPECIALIZATIONS', 'Enable fixed-size schur specializations', True)),
|
||||
|
||||
(BoolVariable('WITH_BF_COMPOSITOR', 'Enable the tile based nodal compositor', True)),
|
||||
|
||||
(BoolVariable('WITH_BF_HDF5', 'Use HDF5 if true', False)),
|
||||
('BF_HDF5', 'HDF5 base path', ''),
|
||||
('BF_HDF5_LIB', 'HDF5 library', ''),
|
||||
('BF_HDF5_LIBPATH', 'HDF5 library path', ''),
|
||||
|
||||
(BoolVariable('WITH_BF_ALEMBIC', 'Use Alembic if true', False)),
|
||||
(BoolVariable('WITH_BF_STATICALEMBIC', 'Staticly link to Alembic', False)),
|
||||
('BF_ALEMBIC', 'Alembic base path', ''),
|
||||
('BF_ALEMBIC_INC', 'Alembic include path', ''),
|
||||
('BF_ALEMBIC_LIB', 'Alembic library', ''),
|
||||
('BF_ALEMBIC_LIB_STATIC', 'Alembic static libraries', ''),
|
||||
('BF_ALEMBIC_LIBPATH', 'Alembic library path', ''),
|
||||
) # end of opts.AddOptions()
|
||||
|
||||
localopts.AddVariables(
|
||||
@@ -663,17 +670,7 @@ def read_opts(env, cfg, args):
|
||||
|
||||
('BF_PROGRAM_LINKFLAGS', 'Link flags applied only to final binaries (blender and blenderplayer, not makesrna/makesdna)', ''),
|
||||
|
||||
(BoolVariable('WITH_BF_OPENSUBDIV', 'Build with OpenSubdiv library', False)),
|
||||
(BoolVariable('WITH_BF_STATICOPENSUBDIV', 'Staticly link to OpenColorIO', False)),
|
||||
('BF_OPENSUBDIV', 'OpenSubdiv root path', ''),
|
||||
('BF_OPENSUBDIV_INC', 'OpenSubdiv include path', ''),
|
||||
('BF_OPENSUBDIV_LIB', 'OpenSubdiv library', ''),
|
||||
('BF_OPENSUBDIV_LIBPATH', 'OpenSubdiv library path', ''),
|
||||
('BF_OPENSUBDIV_LIB_STATIC', 'OpenSubdiv static library', ''),
|
||||
|
||||
(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()
|
||||
|
||||
return localopts
|
||||
|
104
doc/build_systems/cmake.txt
Normal file
104
doc/build_systems/cmake.txt
Normal file
@@ -0,0 +1,104 @@
|
||||
|
||||
Blender CMake build system
|
||||
============================
|
||||
|
||||
Contents
|
||||
---------------
|
||||
|
||||
1. Introduction
|
||||
2. Obtaining CMake
|
||||
3. Building Blender
|
||||
4. Generic Setup
|
||||
5. Configuring the build after SVN updates
|
||||
|
||||
1. Introduction
|
||||
---------------
|
||||
|
||||
This document describes general usage of the new CMake scripts. The
|
||||
inner workings will be described in blender-cmake-dev.txt (TODO).
|
||||
|
||||
2. Obtaining CMake
|
||||
------------------
|
||||
|
||||
CMake for can either be downloaded using your favorite package manager
|
||||
or is also available from the CMake website at http://www.cmake.org
|
||||
The website also contains some documentation on CMake usage but I found
|
||||
the man page alone pretty helpful.
|
||||
|
||||
3. Building Blender
|
||||
-------------------
|
||||
|
||||
Building Blender requires obtaining a compiler, library dependencies,
|
||||
and correct setup depending on the system. For details on how to set
|
||||
up a build on various operating systems, see the wiki documentation:
|
||||
|
||||
http://wiki.blender.org/index.php/Dev:Doc/Building_Blender
|
||||
|
||||
4. Generic Setup
|
||||
----------------
|
||||
|
||||
CMake allows one to generate the build project files and binary objects
|
||||
outside the source tree which can be pretty handy in working and experimenting
|
||||
with different Blender configurations (Audio/NoAudio, GameEngine/NoGameEngine etc.)
|
||||
while maintaining a clean source tree. It also makes it possible to generate files
|
||||
for different build systems on the same source tree. This also has benefits for
|
||||
general SVN management for the developer as patches and submit logs are much cleaner.
|
||||
|
||||
Create a directory outside the blender source tree where you would like to build
|
||||
Blender (from now on called $BLENDERBUILD). On the commandline you can then run
|
||||
the cmake command to generate your initial build files. First just run 'cmake' which
|
||||
will inform you what the available generators are. Thn you can run
|
||||
'cmake -G generator $BLENDERSOURCE' to generate the build files. Here is an example
|
||||
of all this for Xcode:
|
||||
|
||||
% mkdir $BLENDERBUILD
|
||||
% cd $BLENDERBUILD
|
||||
% cmake
|
||||
|
||||
...
|
||||
...
|
||||
--version [file] = Show program name/version banner and exit.
|
||||
|
||||
Generators
|
||||
|
||||
The following generators are available on this platform:
|
||||
KDevelop3 = Generates KDevelop 3 project files.
|
||||
Unix Makefiles = Generates standard UNIX makefiles.
|
||||
Xcode = Generate XCode project files.
|
||||
|
||||
|
||||
|
||||
% cmake -G Xcode $BLENDERSOURCE
|
||||
...
|
||||
...
|
||||
-- Configuring blender
|
||||
-- Configuring blenderplayer
|
||||
-- Configuring done
|
||||
-- Generating done
|
||||
-- Build files have been written to: $BLENDERBUILD
|
||||
|
||||
This will generate the build files with default values. Specific features can
|
||||
be enabled or disabled by running the ccmake "GUI" from $BLENDERBUILD as follows:
|
||||
|
||||
% ccmake $BLENDERSOURCE
|
||||
|
||||
A number of options appear which can be changed depending on your needs and
|
||||
available dependencies (e.g. setting WITH_OPENEXR to OFF will disable support
|
||||
for OpenEXR). It will also allow you to override default and detected paths
|
||||
(e.g. Python directories) and compile and link flags. When you are satisfied
|
||||
used ccmake to re-configure the build files and exit.
|
||||
|
||||
It is also possible to use the commandline of 'cmake' to override certain
|
||||
of these settings.
|
||||
|
||||
5. Configuring the build after SVN updates
|
||||
------------------------------------------
|
||||
|
||||
The $BLENDERBUILD directory maintains a file called CMakeCache.txt which
|
||||
remembers the initial run's settings for subsequent generation runs. After
|
||||
SVN updates that contain changes to the build system, rebuilding Blender will
|
||||
automatically invoke CMake to regenerate the CMakeCache.txt and other files
|
||||
as needed.
|
||||
|
||||
/Jacques Beaurain (jbinto)
|
||||
|
2382
doc/doxygen/Doxyfile
2382
doc/doxygen/Doxyfile
File diff suppressed because it is too large
Load Diff
@@ -10,14 +10,26 @@
|
||||
* \ingroup intern
|
||||
*/
|
||||
|
||||
/** \defgroup boolop boolop
|
||||
* \ingroup intern
|
||||
*/
|
||||
|
||||
/** \defgroup ctr container
|
||||
* \ingroup intern
|
||||
*/
|
||||
|
||||
/** \defgroup decimation decimation
|
||||
* \ingroup intern
|
||||
*/
|
||||
|
||||
/** \defgroup elbeem elbeem
|
||||
* \ingroup intern
|
||||
*/
|
||||
|
||||
/** \defgroup bsp bsp
|
||||
* \ingroup intern
|
||||
*/
|
||||
|
||||
/** \defgroup iksolver iksolver
|
||||
* \ingroup intern
|
||||
*/
|
@@ -7,7 +7,7 @@
|
||||
* These pages document the source code of blender.
|
||||
*
|
||||
* \subsection implinks Important Links
|
||||
* - <a href="http://developer.blender.org">developer.blender.org</a> with bug tracker.
|
||||
* - <a href="http://developer.blender.org">developer.blender.org</a> with bug tracker
|
||||
* - <a href="http://wiki.blender.org/index.php/Dev:Contents">Development documents</a> on our wiki.
|
||||
*
|
||||
* \subsection blother Other
|
@@ -11,6 +11,7 @@
|
||||
/** \defgroup bmesh BMesh
|
||||
* \ingroup blender
|
||||
*/
|
||||
/** \defgroup texture Texturing */
|
||||
/** \defgroup compositor Compositing */
|
||||
|
||||
/** \defgroup python Python
|
||||
@@ -92,48 +93,36 @@
|
||||
|
||||
/* ================================ */
|
||||
|
||||
/** \defgroup blender Blender */
|
||||
/** \defgroup blender blender */
|
||||
|
||||
/** \defgroup blt BlenTranslation
|
||||
/** \defgroup blf blenfont
|
||||
* \ingroup blender
|
||||
*/
|
||||
|
||||
/** \defgroup blf BlenFont
|
||||
/** \defgroup bke blenkernel
|
||||
* \ingroup blender
|
||||
*/
|
||||
|
||||
/** \defgroup bke BlenKernel
|
||||
/** \defgroup bli blenlib
|
||||
* \ingroup blender
|
||||
*/
|
||||
|
||||
/** \defgroup bli BlenLib
|
||||
/** \defgroup nodes nodes
|
||||
* \ingroup blender
|
||||
*/
|
||||
|
||||
/** \defgroup depsgraph Dependency Graph
|
||||
* \ingroup blender
|
||||
*/
|
||||
|
||||
/** \defgroup bph Physics
|
||||
* \ingroup blender
|
||||
*/
|
||||
|
||||
/** \defgroup nodes Nodes
|
||||
* \ingroup blender
|
||||
*/
|
||||
|
||||
/** \defgroup cmpnodes Nodes (Compositor)
|
||||
/** \defgroup cmpnodes cmpnodes
|
||||
* \ingroup nodes
|
||||
*/
|
||||
|
||||
/** \defgroup shdnodes Nodes (Shader)
|
||||
/** \defgroup shdnodes shdnodes
|
||||
* \ingroup nodes
|
||||
*/
|
||||
|
||||
/** \defgroup texnodes Nodes (Texture)
|
||||
/** \defgroup texnodes texnodes
|
||||
* \ingroup nodes
|
||||
*/
|
||||
/** \defgroup modifiers Object Modifiers
|
||||
/** \defgroup modifiers modifiers
|
||||
* \ingroup blender
|
||||
*/
|
||||
|
||||
@@ -143,29 +132,29 @@
|
||||
* \ingroup blender
|
||||
*/
|
||||
|
||||
/** \defgroup ikplugin IK Plugin
|
||||
/** \defgroup ikplugin ikplugin
|
||||
* \ingroup blender
|
||||
*/
|
||||
|
||||
/** \defgroup DNA Struct DNA (File Format)
|
||||
/** \defgroup DNA sDNA
|
||||
* \ingroup blender data
|
||||
*/
|
||||
/** \defgroup RNA RNA (Data API)
|
||||
/** \defgroup RNA RNA
|
||||
* \ingroup blender data
|
||||
*/
|
||||
|
||||
/** \defgroup blenloader Blend file IO
|
||||
/** \defgroup blenloader .blend read and write functions
|
||||
* \ingroup blender data
|
||||
* \todo check if \ref blo and \ref blenloader groups can be
|
||||
* merged in docs.
|
||||
*/
|
||||
|
||||
/** \defgroup quicktime QuickTime
|
||||
/** \defgroup quicktime quicktime
|
||||
* \ingroup blender
|
||||
|
||||
/** \defgroup gui GUI */
|
||||
|
||||
/** \defgroup wm Window Manager
|
||||
/** \defgroup wm windowmanager
|
||||
* \ingroup blender gui
|
||||
*/
|
||||
|
||||
@@ -325,7 +314,7 @@
|
||||
* \ingroup gui
|
||||
*/
|
||||
|
||||
/** \defgroup externformats External Formats */
|
||||
/** \defgroup externformats external formats */
|
||||
|
||||
/** \defgroup collada COLLADA
|
||||
* \ingroup externformats
|
||||
@@ -335,7 +324,7 @@
|
||||
* \ingroup externformats
|
||||
*/
|
||||
|
||||
/** \defgroup imbuf Image Buffer (ImBuf)
|
||||
/** \defgroup imbuf IMage Buffer
|
||||
* \ingroup blender
|
||||
*/
|
||||
|
@@ -1,7 +1,6 @@
|
||||
"""
|
||||
Basic Sound Playback
|
||||
++++++++++++++++++++
|
||||
|
||||
This script shows how to use the classes: :class:`Device`, :class:`Factory` and
|
||||
:class:`Handle`.
|
||||
"""
|
||||
|
@@ -20,15 +20,15 @@ constraint_type = 2
|
||||
physics_id_1 = object_1.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_y = 0.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_y = 0.0
|
||||
edge_angle_z = 90.0
|
||||
edge_angle_y = 1.0
|
||||
edge_angle_z = 0.0
|
||||
|
||||
# create an edge constraint
|
||||
constraints.createConstraint(physics_id_1, physics_id_2,
|
||||
|
@@ -1,10 +1,9 @@
|
||||
"""
|
||||
Texture Replacement
|
||||
+++++++++++++++++++
|
||||
|
||||
Example of how to replace a texture in game with an external image.
|
||||
``createTexture()`` and ``removeTexture()`` are to be called from a
|
||||
module Python Controller.
|
||||
createTexture() and removeTexture() are to be called from a module Python
|
||||
Controller.
|
||||
"""
|
||||
from bge import logic
|
||||
from bge import texture
|
||||
|
@@ -1,8 +1,7 @@
|
||||
"""
|
||||
Basic Video Playback
|
||||
++++++++++++++++++++
|
||||
Example of how to replace a texture in game with a video. It needs to run
|
||||
everyframe.
|
||||
Example of how to replace a texture in game with a video. It needs to run everyframe
|
||||
"""
|
||||
import bge
|
||||
from bge import texture
|
||||
|
@@ -1,7 +1,6 @@
|
||||
"""
|
||||
Basic Handler Example
|
||||
+++++++++++++++++++++
|
||||
|
||||
This script shows the most simple example of adding a handler.
|
||||
"""
|
||||
|
||||
|
@@ -7,9 +7,8 @@ act on specified rather than the selected or active data, or to execute an
|
||||
operator in the different part of the user interface.
|
||||
|
||||
The context overrides are passed as a dictionary, with keys matching the context
|
||||
member names in bpy.context.
|
||||
For example to override ``bpy.context.active_object``,
|
||||
you would pass ``{'active_object': object}``.
|
||||
member names in bpy.context. For example to override bpy.context.active_object,
|
||||
you would pass {'active_object': object}.
|
||||
"""
|
||||
|
||||
# remove all objects in scene rather than the selected ones
|
||||
|
@@ -1,19 +1,16 @@
|
||||
"""
|
||||
.. _operator-execution_context:
|
||||
|
||||
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
|
||||
invoke() is called or only execute().
|
||||
This determines the context thats given to the operator to run in, and weather
|
||||
invoke() is called or execute().
|
||||
|
||||
'EXEC_DEFAULT' is used by default, running only the execute() method, but you may
|
||||
want the operator to take user interaction with 'INVOKE_DEFAULT' which will also
|
||||
call invoke() if existing.
|
||||
'EXEC_DEFAULT' is used by default but you may want the operator to take user
|
||||
interaction with 'INVOKE_DEFAULT'.
|
||||
|
||||
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_REGION_PREVIEW', 'INVOKE_AREA', 'INVOKE_SCREEN', 'EXEC_DEFAULT',
|
||||
'EXEC_REGION_WIN', 'EXEC_REGION_CHANNELS', 'EXEC_REGION_PREVIEW', 'EXEC_AREA',
|
||||
|
@@ -3,21 +3,21 @@ Calling Operators
|
||||
-----------------
|
||||
|
||||
Provides python access to calling operators, this includes operators written in
|
||||
C, Python or macros.
|
||||
C, Python or Macros.
|
||||
|
||||
Only keyword arguments can be used to pass operator properties.
|
||||
|
||||
Operators don't have return values as you might expect,
|
||||
instead they return a set() which is made up of:
|
||||
``{'RUNNING_MODAL', 'CANCELLED', 'FINISHED', 'PASS_THROUGH'}``.
|
||||
Common return values are ``{'FINISHED'}`` and ``{'CANCELLED'}``.
|
||||
Operators don't have return values as you might expect, instead they return a
|
||||
set() which is made up of: {'RUNNING_MODAL', 'CANCELLED', 'FINISHED',
|
||||
'PASS_THROUGH'}.
|
||||
Common return values are {'FINISHED'} and {'CANCELLED'}.
|
||||
|
||||
|
||||
Calling an operator in the wrong context will raise a ``RuntimeError``,
|
||||
Calling an operator in the wrong context will raise a RuntimeError,
|
||||
there is a poll() method to avoid this problem.
|
||||
|
||||
Note that the operator ID (bl_idname) in this example is ``mesh.subdivide``,
|
||||
``bpy.ops`` is just the access path for python.
|
||||
Note that the operator ID (bl_idname) in this example is 'mesh.subdivide',
|
||||
'bpy.ops' is just the access path for python.
|
||||
|
||||
|
||||
Keywords and Positional Arguments
|
||||
@@ -32,9 +32,9 @@ There are 3 optional positional arguments (documented in detail below).
|
||||
|
||||
bpy.ops.test.operator(override_context, execution_context, undo)
|
||||
|
||||
- override_context - ``dict`` type.
|
||||
- execution_context - ``str`` (enum).
|
||||
- undo - ``bool`` type.
|
||||
* override_context - dict type
|
||||
* execution_context - string (enum)
|
||||
* undo - boolean
|
||||
|
||||
|
||||
Each of these arguments is optional, but must be given in the order above.
|
||||
|
@@ -3,7 +3,7 @@ PropertyGroup Example
|
||||
+++++++++++++++++++++
|
||||
|
||||
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
|
||||
|
@@ -6,7 +6,7 @@ Custom properties can be added to any subclass of an :class:`ID`,
|
||||
:class:`Bone` and :class:`PoseBone`.
|
||||
|
||||
These properties can be animated, accessed by the user interface and python
|
||||
like Blender's existing properties.
|
||||
like blenders existing properties.
|
||||
"""
|
||||
|
||||
import bpy
|
||||
|
@@ -8,8 +8,7 @@ bl_info = {
|
||||
"warning": "",
|
||||
"wiki_url": "",
|
||||
"tracker_url": "",
|
||||
"category": "Object",
|
||||
}
|
||||
"category": "Object"}
|
||||
|
||||
|
||||
import bpy
|
||||
|
@@ -1,7 +1,6 @@
|
||||
"""
|
||||
Submenus
|
||||
++++++++
|
||||
|
||||
This menu demonstrates some different functions.
|
||||
"""
|
||||
import bpy
|
||||
|
@@ -1,12 +1,12 @@
|
||||
"""
|
||||
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.
|
||||
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
|
||||
|
||||
|
@@ -1,21 +1,21 @@
|
||||
"""
|
||||
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.
|
||||
|
||||
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.
|
||||
|
||||
.. note::
|
||||
|
||||
Menu subclasses must be registered before referencing them from blender.
|
||||
|
||||
.. note::
|
||||
Menus have their :class:`Layout.operator_context` initialized as
|
||||
'EXEC_REGION_WIN' rather than 'INVOKE_DEFAULT' (see :ref:`Execution Context <operator-execution_context>`).
|
||||
If the operator context needs to initialize inputs from the
|
||||
:class:`Operator.invoke` function, then this needs to be explicitly set.
|
||||
Menu's have their :class:`Layout.operator_context` initialized as
|
||||
'EXEC_REGION_WIN' rather then 'INVOKE_DEFAULT', so if the operator context
|
||||
needs to initialize inputs from the :class:`Operator.invoke` function
|
||||
then this needs to be explicitly set.
|
||||
"""
|
||||
import bpy
|
||||
|
||||
|
@@ -7,10 +7,10 @@ for more flexible mesh editing from python see :mod:`bmesh`.
|
||||
|
||||
Blender stores 4 main arrays to define mesh geometry.
|
||||
|
||||
- :class:`Mesh.vertices` (3 points in space)
|
||||
- :class:`Mesh.edges` (reference 2 vertices)
|
||||
- :class:`Mesh.loops` (reference a single vertex and edge)
|
||||
- :class:`Mesh.polygons`: (reference a range of loops)
|
||||
* :class:`Mesh.vertices` (3 points in space)
|
||||
* :class:`Mesh.edges` (reference 2 vertices)
|
||||
* :class:`Mesh.loops` (reference a single vertex and edge)
|
||||
* :class:`Mesh.polygons`: (reference a range of loops)
|
||||
|
||||
|
||||
Each polygon reference a slice in the loop array, this way, polygons do not store vertices or corner data such as UV's directly,
|
||||
|
@@ -1,7 +1,6 @@
|
||||
"""
|
||||
Poll Function
|
||||
+++++++++++++++
|
||||
|
||||
The :class:`NodeTree.poll` function determines if a node tree is visible
|
||||
in the given context (similar to how :class:`Panel.poll`
|
||||
and :class:`Menu.poll` define visibility). If it returns False,
|
||||
|
@@ -1,7 +1,6 @@
|
||||
"""
|
||||
Basic Object Operations Example
|
||||
+++++++++++++++++++++++++++++++
|
||||
|
||||
This script demonstrates basic operations on object like creating new
|
||||
object, placing it into scene, selecting it and making it active.
|
||||
"""
|
||||
|
@@ -1,7 +1,6 @@
|
||||
"""
|
||||
Invoke Function
|
||||
+++++++++++++++
|
||||
|
||||
:class:`Operator.invoke` is used to initialize the operator from the context
|
||||
at the moment the operator is called.
|
||||
invoke() is typically used to assign properties which are then used by
|
||||
@@ -32,7 +31,7 @@ class SimpleMouseOperator(bpy.types.Operator):
|
||||
y = bpy.props.IntProperty()
|
||||
|
||||
def execute(self, context):
|
||||
# rather than printing, use the report function,
|
||||
# rather then printing, use the report function,
|
||||
# this way the message appears in the header,
|
||||
self.report({'INFO'}, "Mouse coords are %d %d" % (self.x, self.y))
|
||||
return {'FINISHED'}
|
||||
|
@@ -4,7 +4,7 @@ Calling a File Selector
|
||||
This example shows how an operator can use the file selector.
|
||||
|
||||
Notice the invoke function calls a window manager method and returns
|
||||
``{'RUNNING_MODAL'}``, this means the file selector stays open and the operator does not
|
||||
RUNNING_MODAL, this means the file selector stays open and the operator does not
|
||||
exit immediately after invoke finishes.
|
||||
|
||||
The file selector runs the operator, calling :class:`Operator.execute` when the
|
||||
|
@@ -1,7 +1,6 @@
|
||||
"""
|
||||
Dialog Box
|
||||
++++++++++
|
||||
|
||||
This operator uses its :class:`Operator.invoke` function to call a popup.
|
||||
"""
|
||||
import bpy
|
||||
|
@@ -1,7 +1,6 @@
|
||||
"""
|
||||
Custom Drawing
|
||||
++++++++++++++
|
||||
|
||||
By default operator properties use an automatic user interface layout.
|
||||
If you need more control you can create your own layout with a
|
||||
:class:`Operator.draw` function.
|
||||
|
@@ -1,9 +1,8 @@
|
||||
"""
|
||||
Modal Execution
|
||||
+++++++++++++++
|
||||
|
||||
This operator defines a :class:`Operator.modal` function which running,
|
||||
handling events until it returns ``{'FINISHED'}`` or ``{'CANCELLED'}``.
|
||||
handling events until it returns {'FINISHED'} or {'CANCELLED'}.
|
||||
|
||||
Grab, Rotate, Scale and Fly-Mode are examples of modal operators.
|
||||
They are especially useful for interactive tools,
|
||||
@@ -11,9 +10,9 @@ your operator can have its own state where keys toggle options as the operator
|
||||
runs.
|
||||
|
||||
:class:`Operator.invoke` is used to initialize the operator as being by
|
||||
returning ``{'RUNNING_MODAL'}``, initializing the modal loop.
|
||||
returning {'RUNNING_MODAL'}, initializing the modal loop.
|
||||
|
||||
Notice ``__init__()`` and ``__del__()`` are declared.
|
||||
Notice __init__() and __del__() are declared.
|
||||
For other operator types they are not useful but for modal operators they will
|
||||
be called before the :class:`Operator.invoke` and after the operator finishes.
|
||||
"""
|
||||
|
@@ -1,7 +1,6 @@
|
||||
"""
|
||||
Basic Operator Example
|
||||
++++++++++++++++++++++
|
||||
|
||||
This script shows simple operator which prints a message.
|
||||
|
||||
Since the operator only has an :class:`Operator.execute` function it takes no
|
||||
|
@@ -1,7 +1,6 @@
|
||||
"""
|
||||
Simple Object Panel
|
||||
+++++++++++++++++++
|
||||
|
||||
This panel has a :class:`Panel.poll` and :class:`Panel.draw_header` function,
|
||||
even though the contents is basic this closely resembles blenders panels.
|
||||
"""
|
||||
|
@@ -1,7 +1,6 @@
|
||||
"""
|
||||
Basic Panel Example
|
||||
+++++++++++++++++++
|
||||
|
||||
This script is a simple panel which will draw into the object properties
|
||||
section.
|
||||
|
||||
|
@@ -1,8 +1,7 @@
|
||||
"""
|
||||
Advanced UIList Example - Filtering and Reordering
|
||||
++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
|
||||
This script is an extended version of the ``UIList`` subclass used to show vertex groups. It is not used 'as is',
|
||||
This script is an extended version of the UIList subclass used to show vertex groups. It is not used 'as is',
|
||||
because iterating over all vertices in a 'draw' function is a very bad idea for UI performances! However, it's a good
|
||||
example of how to create/use filtering/reordering callbacks.
|
||||
"""
|
||||
|
@@ -1,7 +1,7 @@
|
||||
"""
|
||||
Note that when keying data paths which contain nested properties this must be
|
||||
done from the :class:`ID` subclass, in this case the :class:`Armature` rather
|
||||
than the bone.
|
||||
then the bone.
|
||||
"""
|
||||
|
||||
import bpy
|
||||
|
@@ -1,192 +0,0 @@
|
||||
# Draws an off-screen buffer and display it in the corner of the view.
|
||||
import bpy
|
||||
from bgl import *
|
||||
|
||||
|
||||
class OffScreenDraw(bpy.types.Operator):
|
||||
bl_idname = "view3d.offscreen_draw"
|
||||
bl_label = "View3D Offscreen Draw"
|
||||
|
||||
_handle_calc = None
|
||||
_handle_draw = None
|
||||
is_enabled = False
|
||||
|
||||
# manage draw handler
|
||||
@staticmethod
|
||||
def draw_callback_px(self, context):
|
||||
scene = context.scene
|
||||
aspect_ratio = scene.render.resolution_x / scene.render.resolution_y
|
||||
|
||||
self._update_offscreen(context, self._offscreen)
|
||||
self._opengl_draw(context, self._texture, aspect_ratio, 0.2)
|
||||
|
||||
@staticmethod
|
||||
def handle_add(self, context):
|
||||
OffScreenDraw._handle_draw = bpy.types.SpaceView3D.draw_handler_add(
|
||||
self.draw_callback_px, (self, context),
|
||||
'WINDOW', 'POST_PIXEL',
|
||||
)
|
||||
|
||||
@staticmethod
|
||||
def handle_remove():
|
||||
if OffScreenDraw._handle_draw is not None:
|
||||
bpy.types.SpaceView3D.draw_handler_remove(OffScreenDraw._handle_draw, 'WINDOW')
|
||||
|
||||
OffScreenDraw._handle_draw = None
|
||||
|
||||
# off-screen buffer
|
||||
@staticmethod
|
||||
def _setup_offscreen(context):
|
||||
import gpu
|
||||
scene = context.scene
|
||||
aspect_ratio = scene.render.resolution_x / scene.render.resolution_y
|
||||
|
||||
try:
|
||||
offscreen = gpu.offscreen.new(512, int(512 / aspect_ratio))
|
||||
except Exception as e:
|
||||
print(e)
|
||||
offscreen = None
|
||||
|
||||
return offscreen
|
||||
|
||||
@staticmethod
|
||||
def _update_offscreen(context, offscreen):
|
||||
scene = context.scene
|
||||
render = scene.render
|
||||
camera = scene.camera
|
||||
|
||||
modelview_matrix = camera.matrix_world.inverted()
|
||||
projection_matrix = camera.calc_matrix_camera(
|
||||
render.resolution_x,
|
||||
render.resolution_y,
|
||||
render.pixel_aspect_x,
|
||||
render.pixel_aspect_y,
|
||||
)
|
||||
|
||||
|
||||
offscreen.draw_view3d(
|
||||
scene,
|
||||
context.space_data,
|
||||
context.region,
|
||||
projection_matrix,
|
||||
modelview_matrix,
|
||||
)
|
||||
|
||||
@staticmethod
|
||||
def _opengl_draw(context, texture, aspect_ratio, scale):
|
||||
"""
|
||||
OpenGL code to draw a rectangle in the viewport
|
||||
"""
|
||||
|
||||
glDisable(GL_DEPTH_TEST)
|
||||
|
||||
# view setup
|
||||
glMatrixMode(GL_PROJECTION)
|
||||
glPushMatrix()
|
||||
glLoadIdentity()
|
||||
|
||||
glMatrixMode(GL_MODELVIEW)
|
||||
glPushMatrix()
|
||||
glLoadIdentity()
|
||||
|
||||
glOrtho(-1, 1, -1, 1, -15, 15)
|
||||
gluLookAt(0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0)
|
||||
|
||||
act_tex = Buffer(GL_INT, 1)
|
||||
glGetIntegerv(GL_TEXTURE_2D, act_tex)
|
||||
|
||||
viewport = Buffer(GL_INT, 4)
|
||||
glGetIntegerv(GL_VIEWPORT, viewport)
|
||||
|
||||
width = int(scale * viewport[2])
|
||||
height = int(width / aspect_ratio)
|
||||
|
||||
glViewport(viewport[0], viewport[1], width, height)
|
||||
glScissor(viewport[0], viewport[1], width, height)
|
||||
|
||||
# draw routine
|
||||
glEnable(GL_TEXTURE_2D)
|
||||
glActiveTexture(GL_TEXTURE0)
|
||||
|
||||
glBindTexture(GL_TEXTURE_2D, texture)
|
||||
|
||||
texco = [(1, 1), (0, 1), (0, 0), (1, 0)]
|
||||
verco = [(1.0, 1.0), (-1.0, 1.0), (-1.0, -1.0), (1.0, -1.0)]
|
||||
|
||||
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL)
|
||||
|
||||
glColor4f(1.0, 1.0, 1.0, 1.0)
|
||||
|
||||
glBegin(GL_QUADS)
|
||||
for i in range(4):
|
||||
glTexCoord3f(texco[i][0], texco[i][1], 0.0)
|
||||
glVertex2f(verco[i][0], verco[i][1])
|
||||
glEnd()
|
||||
|
||||
# restoring settings
|
||||
glBindTexture(GL_TEXTURE_2D, act_tex[0])
|
||||
|
||||
glDisable(GL_TEXTURE_2D)
|
||||
|
||||
# reset view
|
||||
glMatrixMode(GL_PROJECTION)
|
||||
glPopMatrix()
|
||||
|
||||
glMatrixMode(GL_MODELVIEW)
|
||||
glPopMatrix()
|
||||
|
||||
glViewport(viewport[0], viewport[1], viewport[2], viewport[3])
|
||||
glScissor(viewport[0], viewport[1], viewport[2], viewport[3])
|
||||
|
||||
# operator functions
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
return context.area.type == 'VIEW_3D'
|
||||
|
||||
def modal(self, context, event):
|
||||
if context.area:
|
||||
context.area.tag_redraw()
|
||||
|
||||
return {'PASS_THROUGH'}
|
||||
|
||||
def invoke(self, context, event):
|
||||
if OffScreenDraw.is_enabled:
|
||||
self.cancel(context)
|
||||
|
||||
return {'FINISHED'}
|
||||
|
||||
else:
|
||||
self._offscreen = OffScreenDraw._setup_offscreen(context)
|
||||
if self._offscreen:
|
||||
self._texture = self._offscreen.color_texture
|
||||
else:
|
||||
self.report({'ERROR'}, "Error initializing offscreen buffer. More details in the console")
|
||||
return {'CANCELLED'}
|
||||
|
||||
OffScreenDraw.handle_add(self, context)
|
||||
OffScreenDraw.is_enabled = True
|
||||
|
||||
if context.area:
|
||||
context.area.tag_redraw()
|
||||
|
||||
context.window_manager.modal_handler_add(self)
|
||||
return {'RUNNING_MODAL'}
|
||||
|
||||
def cancel(self, context):
|
||||
OffScreenDraw.handle_remove()
|
||||
OffScreenDraw.is_enabled = False
|
||||
|
||||
if context.area:
|
||||
context.area.tag_redraw()
|
||||
|
||||
|
||||
def register():
|
||||
bpy.utils.register_class(OffScreenDraw)
|
||||
|
||||
|
||||
def unregister():
|
||||
bpy.utils.unregister_class(OffScreenDraw)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
register()
|
@@ -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,77 +4,72 @@ Physics Constraints (bge.constraints)
|
||||
|
||||
.. module:: bge.constraints
|
||||
|
||||
|
||||
Examples
|
||||
--------
|
||||
|
||||
.. include:: ../examples/bge.constraints.py
|
||||
:start-line: 1
|
||||
:end-line: 4
|
||||
.. literalinclude:: ../examples/bge.constraints.py
|
||||
:language: rest
|
||||
:lines: 2-4
|
||||
|
||||
.. literalinclude:: ../examples/bge.constraints.py
|
||||
:lines: 6-
|
||||
|
||||
|
||||
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)
|
||||
.. function:: createConstraint(physicsid, physicsid2, constrainttype, [pivotX, pivotY, pivotZ, [axisX, axisY, axisZ, [flag]]]])
|
||||
|
||||
Creates a constraint.
|
||||
|
||||
:arg physicsid_1: The physics id of the first object in constraint.
|
||||
:type physicsid_1: int
|
||||
:arg physicsid: the physics id of the first object in constraint
|
||||
:type physicsid: int
|
||||
|
||||
:arg physicsid_2: The physics id of the second object in constraint.
|
||||
:type physicsid_2: int
|
||||
:arg physicsid2: the physics id of the second object in constraint
|
||||
:type physicsid2: int
|
||||
|
||||
:arg constraint_type: The type of the constraint, see `Create Constraint Constants`_.
|
||||
:arg constrainttype: the type of the constraint. The constraint types are:
|
||||
|
||||
:type constraint_type: int
|
||||
- :class:`POINTTOPOINT_CONSTRAINT`
|
||||
- :class:`LINEHINGE_CONSTRAINT`
|
||||
- :class:`ANGULAR_CONSTRAINT`
|
||||
- :class:`CONETWIST_CONSTRAINT`
|
||||
- :class:`VEHICLE_CONSTRAINT`
|
||||
- :class:`GENERIC_6DOF_CONSTRAINT`
|
||||
|
||||
:arg pivot_x: Pivot X position. (optional)
|
||||
:type pivot_x: float
|
||||
:type constrainttype: int
|
||||
|
||||
:arg pivot_y: Pivot Y position. (optional)
|
||||
:type pivot_y: float
|
||||
:arg pivotX: pivot X position
|
||||
:type pivotX: float
|
||||
|
||||
:arg pivot_z: Pivot Z position. (optional)
|
||||
:type pivot_z: float
|
||||
:arg pivotY: pivot Y position
|
||||
:type pivotY: float
|
||||
|
||||
:arg axis_x: X axis angle in degrees. (optional)
|
||||
:type axis_x: float
|
||||
:arg pivotZ: pivot Z position
|
||||
:type pivotZ: float
|
||||
|
||||
:arg axis_y: Y axis angle in degrees. (optional)
|
||||
:type axis_y: float
|
||||
:arg axisX: X axis
|
||||
:type axisX: float
|
||||
|
||||
:arg axis_z: Z axis angle in degrees. (optional)
|
||||
:type axis_z: float
|
||||
:arg axisY: Y axis
|
||||
:type axisY: float
|
||||
|
||||
:arg flag: 128 to disable collision between linked bodies. (optional)
|
||||
:arg axisZ: Z axis
|
||||
:type axisZ: float
|
||||
|
||||
:arg flag: 128 to disable collision between linked bodies
|
||||
:type flag: int
|
||||
|
||||
:return: A constraint wrapper.
|
||||
:rtype: :class:`~bge.types.KX_ConstraintWrapper`
|
||||
.. attribute:: error
|
||||
|
||||
Simbolic constant string that indicates error.
|
||||
|
||||
.. 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 path.
|
||||
:type filename: str
|
||||
:arg filename: File name
|
||||
:type filename: string
|
||||
|
||||
.. function:: getAppliedImpulse(constraintId)
|
||||
|
||||
:arg constraintId: The id of the constraint.
|
||||
:type constraintId: int
|
||||
|
||||
:return: The most recent applied impulse.
|
||||
:return: the most recent applied impulse.
|
||||
:rtype: float
|
||||
|
||||
.. function:: getVehicleConstraint(constraintId)
|
||||
@@ -82,16 +77,16 @@ Functions
|
||||
:arg constraintId: The id of the vehicle constraint.
|
||||
:type constraintId: int
|
||||
|
||||
:return: A vehicle constraint object.
|
||||
:rtype: :class:`~bge.types.KX_VehicleWrapper`
|
||||
:return: a vehicle constraint object.
|
||||
:rtype: :class:`bge.types.KX_VehicleWrapper`
|
||||
|
||||
.. function:: getCharacter(gameobj)
|
||||
|
||||
: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.
|
||||
:rtype: :class:`~bge.types.KX_CharacterWrapper`
|
||||
:return: character wrapper
|
||||
:rtype: :class:`bge.types.KX_CharacterWrapper`
|
||||
|
||||
.. function:: removeConstraint(constraintId)
|
||||
|
||||
@@ -145,8 +140,23 @@ Functions
|
||||
|
||||
Sets the debug mode.
|
||||
|
||||
:arg mode: The new debug mode, see `Debug Mode Constants`_.
|
||||
Debug modes:
|
||||
- :class:`DBG_NODEBUG`
|
||||
- :class:`DBG_DRAWWIREFRAME`
|
||||
- :class:`DBG_DRAWAABB`
|
||||
- :class:`DBG_DRAWFREATURESTEXT`
|
||||
- :class:`DBG_DRAWCONTACTPOINTS`
|
||||
- :class:`DBG_NOHELPTEXT`
|
||||
- :class:`DBG_DRAWTEXT`
|
||||
- :class:`DBG_PROFILETIMINGS`
|
||||
- :class:`DBG_ENABLESATCOMPARISION`
|
||||
- :class:`DBG_DISABLEBULLETLCP`
|
||||
- :class:`DBG_ENABLECCD`
|
||||
- :class:`DBG_DRAWCONSTRAINTS`
|
||||
- :class:`DBG_DRAWCONSTRAINTLIMITS`
|
||||
- :class:`DBG_FASTWIREFRAME`
|
||||
|
||||
:arg mode: The new debug mode.
|
||||
:type mode: int
|
||||
|
||||
.. function:: setGravity(x, y, z)
|
||||
@@ -165,8 +175,7 @@ Functions
|
||||
.. function:: setLinearAirDamping(damping)
|
||||
|
||||
.. note::
|
||||
|
||||
Not implemented
|
||||
Not implemented.
|
||||
|
||||
Sets the linear air damping for rigidbodies.
|
||||
|
||||
@@ -226,111 +235,144 @@ Functions
|
||||
|
||||
.. function:: setUseEpa(epa)
|
||||
|
||||
.. note::
|
||||
|
||||
Not implemented
|
||||
|
||||
|
||||
Constants
|
||||
+++++++++
|
||||
|
||||
.. attribute:: error
|
||||
|
||||
Symbolic constant string that indicates error.
|
||||
|
||||
:type: str
|
||||
|
||||
|
||||
Debug Mode Constants
|
||||
^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
Debug mode to be used with :func:`setDebugMode`.
|
||||
|
||||
Not implemented.
|
||||
|
||||
.. data:: DBG_NODEBUG
|
||||
|
||||
.. note::
|
||||
Debug mode to be used with function :class:`setDebugMode`
|
||||
|
||||
No debug.
|
||||
|
||||
.. data:: DBG_DRAWWIREFRAME
|
||||
|
||||
.. note::
|
||||
Debug mode to be used with function :class:`setDebugMode`
|
||||
|
||||
Draw wireframe in debug.
|
||||
|
||||
.. data:: DBG_DRAWAABB
|
||||
|
||||
.. note::
|
||||
Debug mode to be used with function :class:`setDebugMode`
|
||||
|
||||
Draw Axis Aligned Bounding Box in debug.
|
||||
|
||||
.. 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
|
||||
|
||||
.. note::
|
||||
Debug mode to be used with function :class:`setDebugMode`
|
||||
|
||||
Draw contact points in debug.
|
||||
|
||||
.. data:: DBG_NOHELPTEXT
|
||||
|
||||
.. note::
|
||||
Debug mode to be used with function :class:`setDebugMode`
|
||||
|
||||
Debug without help text.
|
||||
|
||||
.. data:: DBG_DRAWTEXT
|
||||
|
||||
.. note::
|
||||
Debug mode to be used with function :class:`setDebugMode`
|
||||
|
||||
Draw text in debug.
|
||||
|
||||
.. data:: DBG_PROFILETIMINGS
|
||||
|
||||
.. note::
|
||||
Debug mode to be used with function :class:`setDebugMode`
|
||||
|
||||
Draw profile timings in debug.
|
||||
|
||||
.. data:: DBG_ENABLESATCOMPARISION
|
||||
|
||||
.. note::
|
||||
Debug mode to be used with function :class:`setDebugMode`
|
||||
|
||||
Enable sat comparision in debug.
|
||||
|
||||
.. data:: DBG_DISABLEBULLETLCP
|
||||
|
||||
.. note::
|
||||
Debug mode to be used with function :class:`setDebugMode`
|
||||
|
||||
Disable Bullet LCP.
|
||||
|
||||
.. 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
|
||||
|
||||
.. note::
|
||||
Debug mode to be used with function :class:`setDebugMode`
|
||||
|
||||
Draw constraints in debug.
|
||||
|
||||
.. data:: DBG_DRAWCONSTRAINTLIMITS
|
||||
|
||||
.. note::
|
||||
Debug mode to be used with function :class:`setDebugMode`
|
||||
|
||||
Draw constraint limits in debug.
|
||||
|
||||
.. data:: DBG_FASTWIREFRAME
|
||||
|
||||
.. note::
|
||||
Debug mode to be used with function :class:`setDebugMode`
|
||||
|
||||
Draw a fast wireframe in debug.
|
||||
|
||||
|
||||
Create Constraint Constants
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
Constraint type to be used with :func:`createConstraint`.
|
||||
|
||||
|
||||
.. data:: POINTTOPOINT_CONSTRAINT
|
||||
|
||||
.. note::
|
||||
Constraint type to be used with function :class:`createConstraint`
|
||||
|
||||
.. to do
|
||||
|
||||
.. data:: LINEHINGE_CONSTRAINT
|
||||
|
||||
.. note::
|
||||
Constraint type to be used with function :class:`createConstraint`
|
||||
|
||||
.. to do
|
||||
|
||||
.. data:: ANGULAR_CONSTRAINT
|
||||
|
||||
.. note::
|
||||
Constraint type to be used with function :class:`createConstraint`
|
||||
|
||||
.. to do
|
||||
|
||||
.. data:: CONETWIST_CONSTRAINT
|
||||
|
||||
.. note::
|
||||
Constraint type to be used with function :class:`createConstraint`
|
||||
|
||||
.. to do
|
||||
|
||||
.. data:: VEHICLE_CONSTRAINT
|
||||
|
||||
.. note::
|
||||
Constraint type to be used with function :class:`createConstraint`
|
||||
|
||||
.. to do
|
||||
|
||||
.. data:: GENERIC_6DOF_CONSTRAINT
|
||||
|
||||
.. to do
|
||||
.. note::
|
||||
Constraint type to be used with function :class:`createConstraint`
|
||||
|
||||
.. to do
|
||||
|
@@ -258,8 +258,7 @@ General functions
|
||||
|
||||
Sets the world gravity.
|
||||
|
||||
:arg gravity: gravity vector
|
||||
:type gravity: Vector((fx, fy, fz))
|
||||
:type gravity: list [fx, fy, fz]
|
||||
|
||||
.. function:: getSpectrum()
|
||||
|
||||
@@ -338,28 +337,6 @@ General functions
|
||||
|
||||
.. warning: Not implimented yet
|
||||
|
||||
.. function:: getAnimRecordFrame()
|
||||
|
||||
Gets the current frame number used for recording animations. This
|
||||
number is incremented automatically by Blender when the "Record
|
||||
animation" feature is turned on.
|
||||
|
||||
:rtype: int
|
||||
|
||||
.. function:: setAnimRecordFrame(framenr)
|
||||
|
||||
Sets the current frame number used for recording animations. This
|
||||
number is automatically incremented by Blender when the "Record
|
||||
animation" feature is turned on.
|
||||
|
||||
The frame number Must be non-negative, unless Blender has
|
||||
:attr:`bpy.types.UserPreferencesEdit.use_negative_frames` enabled
|
||||
in its user preferences. Only use non-negative numbers to be on
|
||||
the safe side, unless you know what you are doing.
|
||||
|
||||
:arg framenr: The new frame number.
|
||||
:type framenr: int
|
||||
|
||||
.. function:: getExitKey()
|
||||
|
||||
Gets the key used to exit the game engine
|
||||
@@ -917,8 +894,6 @@ Various
|
||||
2D Filter
|
||||
---------
|
||||
|
||||
.. _Two-D-FilterActuator-mode:
|
||||
|
||||
.. data:: RAS_2DFILTER_BLUR
|
||||
|
||||
:value: 2
|
||||
@@ -1313,3 +1288,5 @@ See :class:`bge.types.KX_StateActuator.operation`
|
||||
Add bits to state mask
|
||||
|
||||
:value: 3
|
||||
|
||||
.. _Two-D-FilterActuator-mode:
|
||||
|
@@ -8,8 +8,7 @@ Intro
|
||||
|
||||
.. module:: bge.render
|
||||
|
||||
Example of using a :class:`bge.types.SCA_MouseSensor`,
|
||||
and two :class:`bge.types.KX_ObjectActuator` to implement MouseLook:
|
||||
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`.
|
||||
@@ -67,7 +66,7 @@ Constants
|
||||
.. data:: KX_BLENDER_GLSL_MATERIAL
|
||||
|
||||
Materials approximating blender materials with GLSL.
|
||||
|
||||
|
||||
.. DATA:: VSYNC_OFF
|
||||
|
||||
Disables vsync
|
||||
@@ -78,9 +77,7 @@ Constants
|
||||
|
||||
.. DATA:: VSYNC_ADAPTIVE
|
||||
|
||||
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
|
||||
|
||||
@@ -90,7 +87,6 @@ Constants
|
||||
|
||||
Right eye being used during stereoscopic rendering.
|
||||
|
||||
|
||||
*********
|
||||
Functions
|
||||
*********
|
||||
@@ -98,105 +94,117 @@ Functions
|
||||
.. function:: getWindowWidth()
|
||||
|
||||
Gets the width of the window (in pixels)
|
||||
|
||||
|
||||
:rtype: integer
|
||||
|
||||
.. function:: getWindowHeight()
|
||||
|
||||
Gets the height of the window (in pixels)
|
||||
|
||||
|
||||
:rtype: integer
|
||||
|
||||
.. function:: setWindowSize(width, height)
|
||||
|
||||
Set the width and height of the window (in pixels). This also works for fullscreen applications.
|
||||
|
||||
.. note:: Only works in the standalone player, not the Blender-embedded player.
|
||||
|
||||
:arg width: width in pixels
|
||||
|
||||
:type width: integer
|
||||
:arg height: height in pixels
|
||||
:type height: integer
|
||||
|
||||
.. function:: setFullScreen(enable)
|
||||
|
||||
Set whether or not the window should be fullscreen.
|
||||
|
||||
.. note:: Only works in the standalone player, not the Blender-embedded player.
|
||||
|
||||
:arg enable: ``True`` to set full screen, ``False`` to set windowed.
|
||||
|
||||
:type enable: bool
|
||||
|
||||
.. function:: getFullScreen()
|
||||
|
||||
Returns whether or not the window is fullscreen.
|
||||
|
||||
.. note:: Only works in the standalone player, not the Blender-embedded player; there it always returns False.
|
||||
|
||||
:rtype: bool
|
||||
|
||||
.. function:: getDisplayDimensions()
|
||||
|
||||
Get the display dimensions, in pixels, of the display (e.g., the
|
||||
monitor). Can return the size of the entire view, so the
|
||||
combination of all monitors; for example, ``(3840, 1080)`` for two
|
||||
side-by-side 1080p monitors.
|
||||
|
||||
:rtype: tuple (width, height)
|
||||
:rtype: bool
|
||||
|
||||
.. function:: makeScreenshot(filename)
|
||||
|
||||
Writes an image file with the current displayed frame.
|
||||
|
||||
The image is written to *'filename'*.
|
||||
The path may be absolute (eg. ``/home/foo/image``) or relative when started with
|
||||
``//`` (eg. ``//image``). Note that absolute paths are not portable between platforms.
|
||||
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-#``).
|
||||
|
||||
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 running from the standalone player, instead of the embedded player, only PNG files are supported.
|
||||
Additional color conversions are also not supported.
|
||||
|
||||
:arg filename: path and name of the file to write
|
||||
Writes a screenshot to the given filename.
|
||||
|
||||
If filename starts with // the image will be saved relative to the current directory.
|
||||
If the filename contains # it will be replaced with the frame number.
|
||||
|
||||
The standalone player saves .png files. It does not support color space conversion
|
||||
or gamma correction.
|
||||
|
||||
When run from Blender, makeScreenshot supports all Blender image file formats like PNG, TGA, Jpeg and OpenEXR.
|
||||
Gamma, Colorspace conversion and Jpeg compression are taken from the Render settings panels.
|
||||
|
||||
:type filename: string
|
||||
|
||||
|
||||
.. function:: enableVisibility(visible)
|
||||
|
||||
Deprecated; doesn't do anything.
|
||||
Doesn't really do anything...
|
||||
|
||||
|
||||
.. function:: showMouse(visible)
|
||||
|
||||
Enables or disables the operating system mouse cursor.
|
||||
|
||||
:arg visible:
|
||||
|
||||
:type visible: boolean
|
||||
|
||||
|
||||
.. function:: setMousePosition(x, y)
|
||||
|
||||
Sets the mouse cursor position.
|
||||
|
||||
:arg x: X-coordinate in screen pixel coordinates.
|
||||
|
||||
:type x: integer
|
||||
:arg y: Y-coordinate in screen pixel coordinates.
|
||||
:type y: integer
|
||||
|
||||
|
||||
.. function:: setBackgroundColor(rgba)
|
||||
|
||||
Deprecated and no longer functional. Use :py:meth:`bge.types.KX_WorldInfo.backgroundColor` instead.
|
||||
Sets the window background color.
|
||||
|
||||
: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)
|
||||
|
||||
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.
|
||||
:type eyesep: float
|
||||
|
||||
@@ -204,21 +212,21 @@ Functions
|
||||
.. function:: getEyeSeparation()
|
||||
|
||||
Gets the current eye separation for stereo mode.
|
||||
|
||||
|
||||
:rtype: float
|
||||
|
||||
|
||||
|
||||
.. function:: setFocalLength(focallength)
|
||||
|
||||
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
|
||||
|
||||
.. function:: getFocalLength()
|
||||
|
||||
Gets the current focal length for stereo mode.
|
||||
|
||||
|
||||
:rtype: float
|
||||
|
||||
.. function:: getStereoEye()
|
||||
@@ -233,8 +241,7 @@ Functions
|
||||
.. function:: setMaterialMode(mode)
|
||||
|
||||
Set the material mode to use for OpenGL rendering.
|
||||
|
||||
:arg mode: material mode
|
||||
|
||||
:type mode: KX_TEXFACE_MATERIAL, KX_BLENDER_MULTITEX_MATERIAL, KX_BLENDER_GLSL_MATERIAL
|
||||
|
||||
.. note:: Changes will only affect newly created scenes.
|
||||
@@ -243,61 +250,58 @@ Functions
|
||||
.. function:: getMaterialMode(mode)
|
||||
|
||||
Get the material mode to use for OpenGL rendering.
|
||||
|
||||
|
||||
:rtype: KX_TEXFACE_MATERIAL, KX_BLENDER_MULTITEX_MATERIAL, KX_BLENDER_GLSL_MATERIAL
|
||||
|
||||
|
||||
.. function:: setGLSLMaterialSetting(setting, enable)
|
||||
|
||||
Enables or disables a GLSL material setting.
|
||||
|
||||
:arg setting:
|
||||
|
||||
:type setting: string (lights, shaders, shadows, ramps, nodes, extra_textures)
|
||||
:arg enable:
|
||||
:type enable: boolean
|
||||
|
||||
|
||||
.. function:: getGLSLMaterialSetting(setting)
|
||||
.. function:: getGLSLMaterialSetting(setting, enable)
|
||||
|
||||
Get the state of a GLSL material setting.
|
||||
|
||||
:arg setting:
|
||||
|
||||
:type setting: string (lights, shaders, shadows, ramps, nodes, extra_textures)
|
||||
:rtype: boolean
|
||||
|
||||
.. function:: setAnisotropicFiltering(level)
|
||||
|
||||
Set the anisotropic filtering level for textures.
|
||||
|
||||
|
||||
:arg level: The new anisotropic filtering level to use
|
||||
: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.
|
||||
|
||||
|
||||
.. function:: getAnisotropicFiltering()
|
||||
|
||||
Get the anisotropic filtering level used for textures.
|
||||
|
||||
|
||||
:rtype: integer (one of 1, 2, 4, 8, 16)
|
||||
|
||||
.. function:: setMipmapping(value)
|
||||
|
||||
Change how to use mipmapping.
|
||||
|
||||
|
||||
: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.
|
||||
|
||||
.. function:: getMipmapping()
|
||||
|
||||
Get the current mipmapping setting.
|
||||
|
||||
|
||||
:rtype: RAS_MIPMAP_NONE, RAS_MIPMAP_NEAREST, RAS_MIPMAP_LINEAR
|
||||
|
||||
|
||||
.. function:: drawLine(fromVec,toVec,color)
|
||||
|
||||
Draw a line in the 3D scene.
|
||||
|
||||
|
||||
:arg fromVec: the origin of the line
|
||||
:type fromVec: list [x, y, z]
|
||||
:arg toVec: the end of the line
|
||||
@@ -309,7 +313,7 @@ Functions
|
||||
.. function:: enableMotionBlur(factor)
|
||||
|
||||
Enable the motion blur effect.
|
||||
|
||||
|
||||
:arg factor: the ammount of motion blur to display.
|
||||
:type factor: float [0.0 - 1.0]
|
||||
|
||||
@@ -322,28 +326,24 @@ Functions
|
||||
|
||||
Show or hide the framerate.
|
||||
|
||||
:arg enable:
|
||||
:type enable: boolean
|
||||
|
||||
.. function:: showProfile(enable)
|
||||
|
||||
Show or hide the profile.
|
||||
|
||||
:arg enable:
|
||||
:type enable: boolean
|
||||
|
||||
.. function:: showProperties(enable)
|
||||
|
||||
Show or hide the debug properties.
|
||||
|
||||
:arg enable:
|
||||
:type enable: boolean
|
||||
|
||||
.. function:: autoDebugList(enable)
|
||||
|
||||
Enable or disable auto adding debug properties to the debug list.
|
||||
|
||||
:arg enable:
|
||||
:type enable: boolean
|
||||
|
||||
.. function:: clearDebugList()
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -7,66 +7,11 @@ base class --- :class:`PyObjectPlus`
|
||||
|
||||
.. class:: KX_BlenderMaterial(PyObjectPlus)
|
||||
|
||||
This is the interface to materials in the game engine.
|
||||
|
||||
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)
|
||||
KX_BlenderMaterial
|
||||
|
||||
.. attribute:: shader
|
||||
|
||||
The material's shader.
|
||||
The materials shader.
|
||||
|
||||
:type: :class:`BL_Shader`
|
||||
|
||||
@@ -89,83 +34,39 @@ base class --- :class:`PyObjectPlus`
|
||||
:return: the material's shader
|
||||
:rtype: :class:`BL_Shader`
|
||||
|
||||
.. attribute:: alpha
|
||||
|
||||
The material's alpha transparency.
|
||||
|
||||
:type: float between 0.0 and 1.0 inclusive
|
||||
|
||||
.. attribute:: hardness
|
||||
|
||||
How hard (sharp) the material's specular reflection is.
|
||||
|
||||
:type: integer between 1 and 511 inclusive
|
||||
|
||||
.. attribute:: emit
|
||||
|
||||
Amount of light to emit.
|
||||
|
||||
:type: float between 0.0 and 2.0 inclusive
|
||||
|
||||
.. attribute:: specularIntensity
|
||||
|
||||
How intense (bright) the material's specular reflection is.
|
||||
|
||||
:type: float between 0.0 and 1.0 inclusive
|
||||
|
||||
.. attribute:: diffuseIntensity
|
||||
|
||||
The material's amount of diffuse reflection.
|
||||
|
||||
:type: float between 0.0 and 1.0 inclusive
|
||||
|
||||
.. attribute:: specularColor
|
||||
|
||||
The material's specular color.
|
||||
|
||||
:type: :class:`mathutils.Color`
|
||||
|
||||
.. attribute:: diffuseColor
|
||||
|
||||
The material's diffuse color.
|
||||
|
||||
:type: :class:`mathutils.Color`
|
||||
|
||||
.. method:: setBlending(src, dest)
|
||||
|
||||
Set the pixel color arithmetic functions.
|
||||
|
||||
:arg src: Specifies how the red, green, blue, and alpha source blending factors are computed, one of...
|
||||
|
||||
* :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 src: Specifies how the red, green, blue, and alpha source blending factors are computed.
|
||||
:type src: Value in...
|
||||
|
||||
:arg dest: Specifies how the red, green, blue, and alpha destination blending factors are computed, one of...
|
||||
|
||||
* :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 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
|
||||
|
||||
:arg dest: Specifies how the red, green, blue, and alpha destination blending factors are computed.
|
||||
:type dest: Value in...
|
||||
|
||||
* 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()
|
||||
|
||||
|
@@ -51,18 +51,6 @@ base class --- :class:`KX_GameObject`
|
||||
|
||||
:type: float
|
||||
|
||||
.. attribute:: shift_x
|
||||
|
||||
The camera's horizontal shift.
|
||||
|
||||
:type: float
|
||||
|
||||
.. attribute:: shift_y
|
||||
|
||||
The camera's vertical shift.
|
||||
|
||||
:type: float
|
||||
|
||||
.. attribute:: perspective
|
||||
|
||||
True if this camera has a perspective transform, False for an orthographic projection.
|
||||
|
@@ -25,7 +25,7 @@ base class --- :class:`PyObjectPlus`
|
||||
|
||||
The maximum number of jumps a character can perform before having to touch the ground. By default this is set to 1. 2 allows for a double jump, etc.
|
||||
|
||||
:type: int in [0, 255], default 1
|
||||
:type: int
|
||||
|
||||
.. attribute:: jumpCount
|
||||
|
||||
|
@@ -23,14 +23,15 @@ base class --- :class:`PyObjectPlus`
|
||||
:arg axis:
|
||||
:type axis: integer
|
||||
|
||||
.. note::
|
||||
* Lowerlimit == Upperlimit -> axis is locked
|
||||
* Lowerlimit > Upperlimit -> axis is free
|
||||
* Lowerlimit < Upperlimit -> axis it limited in that range
|
||||
|
||||
For PHY_LINEHINGE_CONSTRAINT = 2 or PHY_ANGULAR_CONSTRAINT = 3:
|
||||
.. note::
|
||||
For each axis:
|
||||
* Lowerlimit == Upperlimit -> axis is locked
|
||||
* Lowerlimit > Upperlimit -> axis is free
|
||||
* Lowerlimit < Upperlimit -> axis it limited in that range
|
||||
|
||||
PHY_LINEHINGE_CONSTRAINT = 2 or PHY_ANGULAR_CONSTRAINT = 3:
|
||||
axis = 3 is a constraint limit, with low/high limit value
|
||||
|
||||
* 3: X axis angle
|
||||
|
||||
: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
|
||||
:type value1: float
|
||||
|
||||
For PHY_CONE_TWIST_CONSTRAINT = 4:
|
||||
|
||||
PHY_CONE_TWIST_CONSTRAINT = 3:
|
||||
axis = 3..5 are constraint limits, high limit values
|
||||
* 3: X axis angle
|
||||
* 4: Y axis angle
|
||||
@@ -50,8 +50,7 @@ base class --- :class:`PyObjectPlus`
|
||||
:arg value1 (max): Set the maximum limit of the axis
|
||||
: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
|
||||
* 0: X axis position
|
||||
* 1: Y axis position
|
||||
@@ -134,10 +133,9 @@ base class --- :class:`PyObjectPlus`
|
||||
|
||||
:type: integer
|
||||
|
||||
- :class:`~bge.constraints.POINTTOPOINT_CONSTRAINT`
|
||||
- :class:`~bge.constraints.LINEHINGE_CONSTRAINT`
|
||||
- :class:`~bge.constraints.ANGULAR_CONSTRAINT`
|
||||
- :class:`~bge.constraints.CONETWIST_CONSTRAINT`
|
||||
- :class:`~bge.constraints.VEHICLE_CONSTRAINT`
|
||||
- :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)
|
||||
|
||||
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,14 +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.
|
||||
|
||||
.. 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.
|
||||
@@ -137,30 +129,7 @@ base class --- :class:`SCA_IObject`
|
||||
|
||||
.. note::
|
||||
|
||||
A value of 0.0 disables this option (rather than 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.
|
||||
A value of 0.0 disables this option (rather then setting it stationary).
|
||||
|
||||
.. attribute:: localInertia
|
||||
|
||||
@@ -186,18 +155,6 @@ base class --- :class:`SCA_IObject`
|
||||
|
||||
: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
|
||||
|
||||
A list of functions to be called when a collision occurs.
|
||||
@@ -696,19 +653,13 @@ base class --- :class:`SCA_IObject`
|
||||
:arg angular_damping: Angular ("rotational") damping factor.
|
||||
:type angular_damping: float ∈ [0, 1]
|
||||
|
||||
.. method:: suspendDynamics([ghost])
|
||||
.. method:: suspendDynamics()
|
||||
|
||||
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()
|
||||
|
||||
Resumes physics for this object. Also reinstates collisions; the object will no longer be a ghost.
|
||||
Resumes physics for this object.
|
||||
|
||||
.. note::
|
||||
|
||||
@@ -799,7 +750,7 @@ base class --- :class:`SCA_IObject`
|
||||
:return: the first object hit or None if no object or object does not match prop
|
||||
:rtype: :class:`KX_GameObject`
|
||||
|
||||
.. method:: rayCast(objto, objfrom, dist, prop, face, xray, poly, mask)
|
||||
.. method:: rayCast(objto, objfrom, dist, prop, face, xray, poly)
|
||||
|
||||
Look from a point/object to another point/object and find first object hit within dist that matches prop.
|
||||
if poly is 0, returns a 3-tuple with object reference, hit point and hit normal or (None, None, None) if no hit.
|
||||
@@ -851,8 +802,6 @@ base class --- :class:`SCA_IObject`
|
||||
* 2: return value is a 5-tuple and the 5th element is a 2-tuple (u, v) with the UV mapping of the hit point or None if no hit, or the object doesn't use a mesh collision shape, or doesn't have a UV mapping.
|
||||
|
||||
:type poly: integer
|
||||
:arg mask: collision mask: The collision mask (16 layers mapped to a 16-bit integer) is combined with each object's collision group, to hit only a subset of the objects in the scene. Only those objects for which ``collisionGroup & mask`` is true can be hit.
|
||||
:type mask: bitfield
|
||||
:return: (object, hitpoint, hitnormal) or (object, hitpoint, hitnormal, polygon) or (object, hitpoint, hitnormal, polygon, hituv).
|
||||
|
||||
* object, hitpoint and hitnormal are None if no hit.
|
||||
@@ -974,16 +923,6 @@ base class --- :class:`SCA_IObject`
|
||||
:return: The current frame of the action
|
||||
:rtype: float
|
||||
|
||||
.. method:: getActionName(layer=0)
|
||||
|
||||
Gets the name of the current action playing in the supplied layer.
|
||||
|
||||
:arg layer: The layer that you want to get the action name from.
|
||||
:type layer: integer
|
||||
|
||||
:return: The name of the current action
|
||||
:rtype: string
|
||||
|
||||
.. method:: setActionFrame(frame, layer=0)
|
||||
|
||||
Set the current frame of the action playing in the supplied layer.
|
||||
|
65
doc/python_api/rst/bge_types/bge.types.KX_IpoActuator.rst
Normal file
65
doc/python_api/rst/bge_types/bge.types.KX_IpoActuator.rst
Normal file
@@ -0,0 +1,65 @@
|
||||
KX_IpoActuator(SCA_IActuator)
|
||||
=============================
|
||||
|
||||
.. module:: bge.types
|
||||
|
||||
base class --- :class:`SCA_IActuator`
|
||||
|
||||
.. class:: KX_IpoActuator(SCA_IActuator)
|
||||
|
||||
IPO actuator activates an animation.
|
||||
|
||||
.. attribute:: frameStart
|
||||
|
||||
Start frame.
|
||||
|
||||
:type: float
|
||||
|
||||
.. attribute:: frameEnd
|
||||
|
||||
End frame.
|
||||
|
||||
:type: float
|
||||
|
||||
.. attribute:: propName
|
||||
|
||||
Use this property to define the Ipo position.
|
||||
|
||||
:type: string
|
||||
|
||||
.. attribute:: framePropName
|
||||
|
||||
Assign this property this action current frame number.
|
||||
|
||||
:type: string
|
||||
|
||||
.. attribute:: mode
|
||||
|
||||
Play mode for the ipo. Can be on of :ref:`these constants <ipo-actuator>`
|
||||
|
||||
:type: integer
|
||||
|
||||
.. attribute:: useIpoAsForce
|
||||
|
||||
Apply Ipo as a global or local force depending on the local option (dynamic objects only).
|
||||
|
||||
:type: boolean
|
||||
|
||||
.. attribute:: useIpoAdd
|
||||
|
||||
Ipo is added to the current loc/rot/scale in global or local coordinate according to Local flag.
|
||||
|
||||
:type: boolean
|
||||
|
||||
.. attribute:: useIpoLocal
|
||||
|
||||
Let the ipo acts in local coordinates, used in Force and Add mode.
|
||||
|
||||
:type: boolean
|
||||
|
||||
.. attribute:: useChildren
|
||||
|
||||
Update IPO on all children Objects as well.
|
||||
|
||||
:type: boolean
|
||||
|
@@ -25,12 +25,6 @@ base class --- :class:`PyObjectPlus`
|
||||
|
||||
:type: callable
|
||||
|
||||
.. attribute:: finished
|
||||
|
||||
The current status of the lib load.
|
||||
|
||||
:type: boolean
|
||||
|
||||
.. attribute:: progress
|
||||
|
||||
The current progress of the lib load as a normalized value from 0.0 to 1.0.
|
||||
|
@@ -51,7 +51,7 @@ base class --- :class:`SCA_IObject`
|
||||
|
||||
.. attribute:: materials
|
||||
|
||||
:type: list of :class:`KX_BlenderMaterial` type
|
||||
:type: list of :class:`KX_BlenderMaterial` or :class:`KX_PolygonMaterial` types
|
||||
|
||||
.. attribute:: numPolygons
|
||||
|
||||
|
@@ -23,7 +23,7 @@ base class --- :class:`SCA_IObject`
|
||||
|
||||
The material of the polygon.
|
||||
|
||||
:type: :class:`KX_BlenderMaterial`
|
||||
:type: :class:`KX_PolygonMaterial` or :class:`KX_BlenderMaterial`
|
||||
|
||||
.. attribute:: texture_name
|
||||
|
||||
@@ -84,7 +84,7 @@ base class --- :class:`SCA_IObject`
|
||||
.. method:: getMaterial()
|
||||
|
||||
:return: The polygon material
|
||||
:rtype: :class:`KX_BlenderMaterial`
|
||||
:rtype: :class:`KX_PolygonMaterial` or :class:`KX_BlenderMaterial`
|
||||
|
||||
.. method:: getTextureName()
|
||||
|
||||
|
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`.
|
||||
|
||||
.. attribute:: world
|
||||
|
||||
The current active world, (read-only).
|
||||
|
||||
:type: :class:`KX_WorldInfo`
|
||||
|
||||
.. attribute:: suspended
|
||||
|
||||
True if the scene is suspended, (read-only).
|
||||
@@ -125,27 +119,21 @@ base class --- :class:`PyObjectPlus`
|
||||
|
||||
: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
|
||||
|
||||
The scene gravity using the world x, y and z axis.
|
||||
|
||||
:type: Vector((gx, gy, gz))
|
||||
|
||||
.. method:: addObject(object, reference, time=0)
|
||||
.. method:: addObject(object, other, time=0)
|
||||
|
||||
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
|
||||
: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.
|
||||
:type reference: :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 other: The object's center to use when adding the object
|
||||
: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.
|
||||
:type time: integer
|
||||
:return: The newly added object.
|
||||
:rtype: :class:`KX_GameObject`
|
||||
|
@@ -1,79 +0,0 @@
|
||||
KX_WorldInfo(PyObjectPlus)
|
||||
=============================
|
||||
|
||||
.. module:: bge.types
|
||||
|
||||
base class --- :class:`PyObjectPlus`
|
||||
|
||||
.. class:: KX_WorldInfo(PyObjectPlus)
|
||||
|
||||
A world 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.Color`
|
||||
|
||||
.. 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.Color`
|
||||
|
||||
.. 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.Color`
|
@@ -7,7 +7,7 @@ base class --- :class:`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.
|
||||
You must active the actuator to get the result.
|
||||
@@ -29,7 +29,7 @@ base class --- :class:`SCA_IActuator`
|
||||
|
||||
.. 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
|
||||
|
||||
|
@@ -23,14 +23,8 @@ base class --- :class:`SCA_ILogicBrick`
|
||||
|
||||
.. attribute:: frequency
|
||||
|
||||
The frequency for pulse mode sensors. (Deprecated: use SCA_ISensor.skippedTicks)
|
||||
|
||||
:type: integer
|
||||
|
||||
.. attribute:: skippedTicks
|
||||
|
||||
Number of logic ticks skipped between 2 active pulses
|
||||
|
||||
The frequency for pulse mode sensors.
|
||||
|
||||
:type: integer
|
||||
|
||||
.. attribute:: level
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -16,24 +16,24 @@ and in the game engine.
|
||||
|
||||
.. warning::
|
||||
|
||||
The API provided by this module is subject to change.
|
||||
The data exposed by the API are are closely related to Blender's internal GLSL code
|
||||
and may change if the GLSL code is modified (e.g. new uniform type).
|
||||
The API provided by this module should be consider unstable. The data exposed by the API
|
||||
are are closely related to Blender's internal GLSL code and may change if the GLSL code
|
||||
is modified (e.g. new uniform type).
|
||||
|
||||
|
||||
Constants
|
||||
=========
|
||||
|
||||
|
||||
GLSL Data Type
|
||||
GLSL data type
|
||||
--------------
|
||||
|
||||
.. _data-type:
|
||||
|
||||
Type of GLSL data.
|
||||
For shader uniforms, the data type determines which ``glUniform`` function
|
||||
For shader uniforms, the data type determines which glUniform function
|
||||
variant to use to send the uniform value to the GPU.
|
||||
For vertex attributes, the data type determines which ``glVertexAttrib`` function
|
||||
For vertex attributes, the data type determines which glVertexAttrib function
|
||||
variant to use to send the vertex attribute to the GPU.
|
||||
|
||||
See export_shader_
|
||||
@@ -42,37 +42,53 @@ See export_shader_
|
||||
|
||||
one integer
|
||||
|
||||
:value: 1
|
||||
|
||||
.. data:: GPU_DATA_1F
|
||||
|
||||
one float
|
||||
|
||||
:value: 2
|
||||
|
||||
.. data:: GPU_DATA_2F
|
||||
|
||||
two floats
|
||||
|
||||
:value: 3
|
||||
|
||||
.. data:: GPU_DATA_3F
|
||||
|
||||
three floats
|
||||
|
||||
:value: 4
|
||||
|
||||
.. data:: GPU_DATA_4F
|
||||
|
||||
four floats
|
||||
|
||||
:value: 5
|
||||
|
||||
.. data:: GPU_DATA_9F
|
||||
|
||||
matrix 3x3 in column-major order
|
||||
|
||||
:value: 6
|
||||
|
||||
.. data:: GPU_DATA_16F
|
||||
|
||||
matrix 4x4 in column-major order
|
||||
|
||||
:value: 7
|
||||
|
||||
.. data:: GPU_DATA_4UB
|
||||
|
||||
four unsigned byte
|
||||
|
||||
:value: 8
|
||||
|
||||
GLSL Uniform Types
|
||||
------------------
|
||||
|
||||
GLSL uniform type
|
||||
-----------------
|
||||
|
||||
.. _uniform-type:
|
||||
|
||||
@@ -85,7 +101,7 @@ The calculation of some of the uniforms is based on matrices available in the sc
|
||||
.. _mat4_cam_to_world:
|
||||
.. _mat4_world_to_cam:
|
||||
|
||||
``mat4_cam_to_world``
|
||||
*mat4_cam_to_world*
|
||||
Model matrix of the camera. OpenGL 4x4 matrix that converts
|
||||
camera local coordinates to world coordinates. In blender this is obtained from the
|
||||
'matrix_world' attribute of the camera object.
|
||||
@@ -96,7 +112,7 @@ The calculation of some of the uniforms is based on matrices available in the sc
|
||||
.. _mat4_object_to_world:
|
||||
.. _mat4_world_to_object:
|
||||
|
||||
``mat4_object_to_world``
|
||||
*mat4_object_to_world*
|
||||
Model matrix of the object that is being rendered. OpenGL 4x4 matric that converts
|
||||
object local coordinates to world coordinates. In blender this is obtained from the
|
||||
'matrix_world' attribute of the object.
|
||||
@@ -106,7 +122,7 @@ The calculation of some of the uniforms is based on matrices available in the sc
|
||||
.. _mat4_lamp_to_world:
|
||||
.. _mat4_world_to_lamp:
|
||||
|
||||
``mat4_lamp_to_world``
|
||||
*mat4_lamp_to_world*
|
||||
Model matrix of the lamp lighting the object. OpenGL 4x4 matrix that converts lamp
|
||||
local coordinates to world coordinates. In blender this is obtained from the
|
||||
'matrix_world' attribute of the lamp object.
|
||||
@@ -114,305 +130,151 @@ The calculation of some of the uniforms is based on matrices available in the sc
|
||||
Some uniform will need the *mat4_world_to_lamp* matrix
|
||||
computed as the inverse of this matrix.
|
||||
|
||||
|
||||
.. note::
|
||||
|
||||
Any uniforms used for view projections or transformations (object, lamp matrices for eg),
|
||||
can only be set once per frame.
|
||||
|
||||
|
||||
GLSL Object Uniforms
|
||||
^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
.. note::
|
||||
|
||||
- Object transformations and color must be set before drawing the object.
|
||||
- There is at most one uniform of these types per shader.
|
||||
|
||||
.. data:: GPU_DYNAMIC_OBJECT_VIEWMAT
|
||||
|
||||
A matrix that converts world coordinates to camera coordinates (see mat4_world_to_cam_).
|
||||
The uniform is a 4x4 GL matrix that converts world coordinates to
|
||||
camera coordinates (see mat4_world_to_cam_). Can be set once per frame.
|
||||
There is at most one uniform of that type per shader.
|
||||
|
||||
:type: matrix4x4
|
||||
:value: 1
|
||||
|
||||
.. data:: GPU_DYNAMIC_OBJECT_MAT
|
||||
|
||||
A matrix that converts object coordinates to world coordinates (see mat4_object_to_world_).
|
||||
The uniform is a 4x4 GL matrix that converts object coordinates
|
||||
to world coordinates (see mat4_object_to_world_). Must be set before drawing the object.
|
||||
There is at most one uniform of that type per shader.
|
||||
|
||||
:type: matrix4x4
|
||||
:value: 2
|
||||
|
||||
.. data:: GPU_DYNAMIC_OBJECT_VIEWIMAT
|
||||
|
||||
The uniform is a 4x4 GL matrix that converts coordinates
|
||||
in camera space to world coordinates (see mat4_cam_to_world_).
|
||||
Can be set once per frame.
|
||||
There is at most one uniform of that type per shader.
|
||||
|
||||
:type: matrix4x4
|
||||
:value: 3
|
||||
|
||||
.. data:: GPU_DYNAMIC_OBJECT_IMAT
|
||||
|
||||
The uniform is a 4x4 GL matrix that converts world coodinates
|
||||
to object coordinates (see mat4_world_to_object_).
|
||||
Must be set before drawing the object.
|
||||
There is at most one uniform of that type per shader.
|
||||
|
||||
:type: matrix4x4
|
||||
:value: 4
|
||||
|
||||
.. data:: GPU_DYNAMIC_OBJECT_COLOR
|
||||
|
||||
An RGB color + alpha defined at object level.
|
||||
Each values between 0.0 and 1.0.
|
||||
The uniform is a vector of 4 float representing a RGB color + alpha defined at object level.
|
||||
Each values between 0.0 and 1.0. In blender it corresponds to the 'color' attribute of the object.
|
||||
Must be set before drawing the object.
|
||||
There is at most one uniform of that type per shader.
|
||||
|
||||
See :class:`bpy.types.Object.color`.
|
||||
|
||||
:type: float4
|
||||
|
||||
.. data:: GPU_DYNAMIC_OBJECT_AUTOBUMPSCALE
|
||||
|
||||
Multiplier for bump-map scaling.
|
||||
|
||||
:type: float
|
||||
|
||||
|
||||
GLSL Lamp Uniforms
|
||||
^^^^^^^^^^^^^^^^^^
|
||||
|
||||
.. note::
|
||||
|
||||
There is one uniform of that type per lamp lighting the material.
|
||||
:value: 5
|
||||
|
||||
.. data:: GPU_DYNAMIC_LAMP_DYNVEC
|
||||
|
||||
Represents the direction of light in camera space.
|
||||
The uniform is a vector of 3 float representing the direction of light in camera space.
|
||||
In Blender, this is computed by
|
||||
|
||||
Computed as:
|
||||
mat4_world_to_cam_ * (-vec3_lamp_Z_axis)
|
||||
mat4_world_to_cam_ * (-vec3_lamp_Z_axis)
|
||||
|
||||
.. note::
|
||||
- The lamp Z axis points to the opposite direction of light.
|
||||
- The norm of the vector should be unit length.
|
||||
as the lamp Z axis points to the opposite direction of light.
|
||||
The norm of the vector should be unity. Can be set once per frame.
|
||||
There is one uniform of that type per lamp lighting the material.
|
||||
|
||||
:type: float3
|
||||
:value: 6
|
||||
|
||||
.. data:: GPU_DYNAMIC_LAMP_DYNCO
|
||||
|
||||
Represents the position of the light in camera space.
|
||||
The uniform is a vector of 3 float representing the position of the light in camera space.
|
||||
Computed as
|
||||
|
||||
Computed as:
|
||||
mat4_world_to_cam_ * vec3_lamp_pos
|
||||
mat4_world_to_cam_ * vec3_lamp_pos
|
||||
|
||||
:type: float3
|
||||
Can be set once per frame.
|
||||
There is one uniform of that type per lamp lighting the material.
|
||||
|
||||
:value: 7
|
||||
|
||||
.. data:: GPU_DYNAMIC_LAMP_DYNIMAT
|
||||
|
||||
Matrix that converts vector in camera space to lamp space.
|
||||
The uniform is a 4x4 GL matrix that converts vector in camera space to lamp space.
|
||||
Computed as
|
||||
|
||||
Computed as:
|
||||
mat4_world_to_lamp_ * mat4_cam_to_world_
|
||||
mat4_world_to_lamp_ * mat4_cam_to_world_
|
||||
|
||||
:type: matrix4x4
|
||||
Can be set once per frame.
|
||||
There is one uniform of that type per lamp lighting the material.
|
||||
|
||||
:value: 8
|
||||
|
||||
.. data:: GPU_DYNAMIC_LAMP_DYNPERSMAT
|
||||
|
||||
Matrix that converts a vector in camera space to shadow buffer depth space.
|
||||
The uniform is a 4x4 GL matrix that converts a vector in camera space to shadow buffer depth space.
|
||||
Computed as
|
||||
|
||||
Computed as:
|
||||
mat4_perspective_to_depth_ * mat4_lamp_to_perspective_ * mat4_world_to_lamp_ * mat4_cam_to_world_.
|
||||
mat4_perspective_to_depth_ * mat4_lamp_to_perspective_ * mat4_world_to_lamp_ * mat4_cam_to_world_.
|
||||
|
||||
.. _mat4_perspective_to_depth:
|
||||
|
||||
``mat4_perspective_to_depth`` is a fixed matrix defined as follow::
|
||||
*mat4_perspective_to_depth* is a fixed matrix defined as follow::
|
||||
|
||||
0.5 0.0 0.0 0.5
|
||||
0.0 0.5 0.0 0.5
|
||||
0.0 0.0 0.5 0.5
|
||||
0.0 0.0 0.0 1.0
|
||||
|
||||
.. note::
|
||||
This uniform can be set once per frame. There is one uniform of that type per lamp casting shadow in the scene.
|
||||
|
||||
- There is one uniform of that type per lamp casting shadow in the scene.
|
||||
|
||||
:type: matrix4x4
|
||||
:value: 9
|
||||
|
||||
.. data:: GPU_DYNAMIC_LAMP_DYNENERGY
|
||||
|
||||
See :class:`bpy.types.Lamp.energy`.
|
||||
The uniform is a single float representing the lamp energy. In blender it corresponds
|
||||
to the 'energy' attribute of the lamp data block.
|
||||
There is one uniform of that type per lamp lighting the material.
|
||||
|
||||
:type: float
|
||||
:value: 10
|
||||
|
||||
.. data:: GPU_DYNAMIC_LAMP_DYNCOL
|
||||
|
||||
See :class:`bpy.types.Lamp.color`.
|
||||
The uniform is a vector of 3 float representing the lamp color.
|
||||
Color elements are between 0.0 and 1.0. In blender it corresponds
|
||||
to the 'color' attribute of the lamp data block.
|
||||
There is one uniform of that type per lamp lighting the material.
|
||||
|
||||
:type: float3
|
||||
|
||||
.. data:: GPU_DYNAMIC_LAMP_DISTANCE
|
||||
|
||||
See :class:`bpy.types.Lamp.distance`.
|
||||
|
||||
:type: float
|
||||
|
||||
.. data:: GPU_DYNAMIC_LAMP_ATT1
|
||||
|
||||
See
|
||||
:class:`bpy.types.PointLamp.linear_attenuation`,
|
||||
:class:`bpy.types.SpotLamp.linear_attenuation`.
|
||||
|
||||
:type: float
|
||||
|
||||
.. data:: GPU_DYNAMIC_LAMP_ATT2
|
||||
|
||||
See
|
||||
:class:`bpy.types.PointLamp.quadratic_attenuation`,
|
||||
:class:`bpy.types.SpotLamp.quadratic_attenuation`.
|
||||
|
||||
:type: float
|
||||
|
||||
.. data:: GPU_DYNAMIC_LAMP_SPOTSIZE
|
||||
|
||||
See :class:`bpy.types.SpotLamp.spot_size`.
|
||||
|
||||
:type: float
|
||||
|
||||
.. data:: GPU_DYNAMIC_LAMP_SPOTBLEND
|
||||
|
||||
See :class:`bpy.types.SpotLamp.spot_blend`.
|
||||
|
||||
:type: float
|
||||
|
||||
.. data:: GPU_DYNAMIC_LAMP_SPOTSCALE
|
||||
|
||||
Represents the SpotLamp local scale.
|
||||
|
||||
:type: float2
|
||||
|
||||
|
||||
GLSL Sampler Uniforms
|
||||
^^^^^^^^^^^^^^^^^^^^^
|
||||
:value: 11
|
||||
|
||||
.. data:: GPU_DYNAMIC_SAMPLER_2DBUFFER
|
||||
|
||||
Represents an internal texture used for certain effect
|
||||
The uniform is an integer representing an internal texture used for certain effect
|
||||
(color band, etc).
|
||||
|
||||
:type: integer
|
||||
:value: 12
|
||||
|
||||
.. data:: GPU_DYNAMIC_SAMPLER_2DIMAGE
|
||||
|
||||
Represents a texture loaded from an image file.
|
||||
The uniform is an integer representing a texture loaded from an image file.
|
||||
|
||||
:type: integer
|
||||
:value: 13
|
||||
|
||||
.. data:: GPU_DYNAMIC_SAMPLER_2DSHADOW
|
||||
|
||||
Represents a texture loaded from a shadow buffer file.
|
||||
The uniform is an float representing the bumpmap scaling.
|
||||
|
||||
:type: integer
|
||||
:value: 14
|
||||
|
||||
.. data:: GPU_DYNAMIC_OBJECT_AUTOBUMPSCALE
|
||||
|
||||
The uniform is an integer representing a shadow buffer corresponding to a lamp
|
||||
casting shadow.
|
||||
|
||||
:value: 15
|
||||
|
||||
|
||||
GLSL Mist Uniforms
|
||||
^^^^^^^^^^^^^^^^^^
|
||||
|
||||
.. data:: GPU_DYNAMIC_MIST_ENABLE:
|
||||
|
||||
See :class:`bpy.types.WorldMistSettings.use_mist`.
|
||||
|
||||
:type: float (0 or 1)
|
||||
|
||||
.. data:: GPU_DYNAMIC_MIST_START
|
||||
|
||||
See :class:`bpy.types.WorldMistSettings.start`.
|
||||
|
||||
:type: float
|
||||
|
||||
See :class:`bpy.types.WorldMistSettings.depth`.
|
||||
|
||||
.. data:: GPU_DYNAMIC_MIST_DISTANCE
|
||||
|
||||
:type: float
|
||||
|
||||
See :class:`bpy.types.WorldMistSettings.intensity`.
|
||||
|
||||
.. data:: GPU_DYNAMIC_MIST_INTENSITY
|
||||
|
||||
:type: float
|
||||
|
||||
.. data:: GPU_DYNAMIC_MIST_TYPE
|
||||
|
||||
See :class:`bpy.types.WorldMistSettings.falloff`.
|
||||
|
||||
:type: float (used as an index into the type)
|
||||
|
||||
.. data:: GPU_DYNAMIC_MIST_COLOR
|
||||
|
||||
|
||||
GLSL World Uniforms
|
||||
^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
.. data:: GPU_DYNAMIC_HORIZON_COLOR
|
||||
|
||||
See :class:`bpy.types.World.horizon_color`.
|
||||
|
||||
:type: float3
|
||||
|
||||
.. data:: GPU_DYNAMIC_AMBIENT_COLOR
|
||||
|
||||
See :class:`bpy.types.World.ambient_color`.
|
||||
|
||||
:type: float3
|
||||
|
||||
|
||||
GLSL Material Uniforms
|
||||
^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
.. data:: GPU_DYNAMIC_MAT_DIFFRGB
|
||||
|
||||
See :class:`bpy.types.Material.diffuse_color`.
|
||||
|
||||
:type: float3
|
||||
|
||||
.. data:: GPU_DYNAMIC_MAT_REF
|
||||
|
||||
See :class:`bpy.types.Material.diffuse_intensity`.
|
||||
|
||||
:type: float
|
||||
|
||||
.. data:: GPU_DYNAMIC_MAT_SPECRGB
|
||||
|
||||
See :class:`bpy.types.Material.specular_color`.
|
||||
|
||||
:type: float3
|
||||
|
||||
.. data:: GPU_DYNAMIC_MAT_SPEC
|
||||
|
||||
See :class:`bpy.types.Material.specular_intensity`.
|
||||
|
||||
:type: float
|
||||
|
||||
.. data:: GPU_DYNAMIC_MAT_HARD
|
||||
|
||||
See :class:`bpy.types.Material.specular_hardness`.
|
||||
|
||||
:type: float
|
||||
|
||||
.. data:: GPU_DYNAMIC_MAT_EMIT
|
||||
|
||||
See :class:`bpy.types.Material.emit`.
|
||||
|
||||
:type: float
|
||||
|
||||
.. data:: GPU_DYNAMIC_MAT_AMB
|
||||
|
||||
See :class:`bpy.types.Material.ambient`.
|
||||
|
||||
:type: float
|
||||
|
||||
.. data:: GPU_DYNAMIC_MAT_ALPHA
|
||||
|
||||
See :class:`bpy.types.Material.alpha`.
|
||||
|
||||
:type: float
|
||||
|
||||
|
||||
|
||||
GLSL Attribute Type
|
||||
GLSL attribute type
|
||||
-------------------
|
||||
|
||||
.. _attribute-type:
|
||||
@@ -429,7 +291,9 @@ layer that contains the vertex attribute.
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
mesh.uv_layers[attribute["name"]]
|
||||
mesh.uv_textures[attribute["name"]]
|
||||
|
||||
:value: 5
|
||||
|
||||
.. data:: CD_MCOL
|
||||
|
||||
@@ -442,6 +306,8 @@ layer that contains the vertex attribute.
|
||||
|
||||
mesh.vertex_colors[attribute["name"]]
|
||||
|
||||
:value: 6
|
||||
|
||||
.. data:: CD_ORCO
|
||||
|
||||
Vertex attribute is original coordinates. Data type is vector 3 float.
|
||||
@@ -453,6 +319,8 @@ layer that contains the vertex attribute.
|
||||
|
||||
mesh.vertices
|
||||
|
||||
:value: 14
|
||||
|
||||
.. data:: CD_TANGENT
|
||||
|
||||
Vertex attribute is the tangent vector. Data type is vector 4 float.
|
||||
@@ -462,6 +330,8 @@ layer that contains the vertex attribute.
|
||||
C function to compute the tangent layer from the other layers can be obtained from
|
||||
blender.org.
|
||||
|
||||
:value: 18
|
||||
|
||||
|
||||
Functions
|
||||
=========
|
||||
@@ -471,12 +341,8 @@ Functions
|
||||
.. function:: export_shader(scene,material)
|
||||
|
||||
Extracts the GLSL shader producing the visual effect of material in scene for the purpose of
|
||||
reusing the shader in an external engine.
|
||||
|
||||
This function is meant to be used in material exporter
|
||||
so that the GLSL shader can be exported entirely.
|
||||
|
||||
The return value is a dictionary containing the
|
||||
reusing the shader in an external engine. This function is meant to be used in material exporter
|
||||
so that the GLSL shader can be exported entirely. The return value is a dictionary containing the
|
||||
shader source code and all associated data.
|
||||
|
||||
:arg scene: the scene in which the material in rendered.
|
||||
@@ -488,91 +354,76 @@ Functions
|
||||
|
||||
The dictionary contains the following elements:
|
||||
|
||||
- ``["fragment"]``: string
|
||||
* ["fragment"] : string
|
||||
fragment shader source code.
|
||||
|
||||
- ``["vertex"]``: string
|
||||
* ["vertex"] : string
|
||||
vertex shader source code.
|
||||
|
||||
- ``["uniforms"]``: sequence
|
||||
* ["uniforms"] : sequence
|
||||
list of uniforms used in fragment shader, can be empty list. Each element of the
|
||||
sequence is a dictionary with the following elements:
|
||||
|
||||
- ``["varname"]``: string
|
||||
* ["varname"] : string
|
||||
name of the uniform in the fragment shader. Always of the form 'unf<number>'.
|
||||
|
||||
- ``["datatype"]``: integer
|
||||
* ["datatype"] : integer
|
||||
data type of the uniform variable. Can be one of the following:
|
||||
|
||||
.. hlist::
|
||||
:columns: 2
|
||||
* :data:`gpu.GPU_DATA_1I` : use glUniform1i
|
||||
* :data:`gpu.GPU_DATA_1F` : use glUniform1fv
|
||||
* :data:`gpu.GPU_DATA_2F` : use glUniform2fv
|
||||
* :data:`gpu.GPU_DATA_3F` : use glUniform3fv
|
||||
* :data:`gpu.GPU_DATA_4F` : use glUniform4fv
|
||||
* :data:`gpu.GPU_DATA_9F` : use glUniformMatrix3fv
|
||||
* :data:`gpu.GPU_DATA_16F` : use glUniformMatrix4fv
|
||||
|
||||
- :data:`gpu.GPU_DATA_1I` : use ``glUniform1i``
|
||||
- :data:`gpu.GPU_DATA_1F` : use ``glUniform1fv``
|
||||
- :data:`gpu.GPU_DATA_2F` : use ``glUniform2fv``
|
||||
- :data:`gpu.GPU_DATA_3F` : use ``glUniform3fv``
|
||||
- :data:`gpu.GPU_DATA_4F` : use ``glUniform4fv``
|
||||
- :data:`gpu.GPU_DATA_9F` : use ``glUniformMatrix3fv``
|
||||
- :data:`gpu.GPU_DATA_16F` : use ``glUniformMatrix4fv``
|
||||
|
||||
- ``["type"]``: integer
|
||||
* ["type"] : integer
|
||||
type of uniform, determines the origin and method of calculation. See uniform-type_.
|
||||
Depending on the type, more elements will be be present.
|
||||
|
||||
- ``["lamp"]``: :class:`bpy.types.Object`
|
||||
Reference to the lamp object from which the uniforms value are extracted.
|
||||
Set for the following uniforms types:
|
||||
* ["lamp"] : :class:`bpy.types.Object`
|
||||
Reference to the lamp object from which the uniforms value are extracted. Set for the following uniforms types:
|
||||
|
||||
.. hlist::
|
||||
:columns: 2
|
||||
:columns: 3
|
||||
|
||||
- :data:`gpu.GPU_DYNAMIC_LAMP_DYNVEC`
|
||||
- :data:`gpu.GPU_DYNAMIC_LAMP_DYNCO`
|
||||
- :data:`gpu.GPU_DYNAMIC_LAMP_DYNIMAT`
|
||||
- :data:`gpu.GPU_DYNAMIC_LAMP_DYNPERSMAT`
|
||||
- :data:`gpu.GPU_DYNAMIC_LAMP_DYNENERGY`
|
||||
- :data:`gpu.GPU_DYNAMIC_LAMP_DYNCOL`
|
||||
- :data:`gpu.GPU_DYNAMIC_SAMPLER_2DSHADOW`
|
||||
* :data:`gpu.GPU_DYNAMIC_LAMP_DYNVEC`
|
||||
* :data:`gpu.GPU_DYNAMIC_LAMP_DYNCO`
|
||||
* :data:`gpu.GPU_DYNAMIC_LAMP_DYNIMAT`
|
||||
* :data:`gpu.GPU_DYNAMIC_LAMP_DYNPERSMAT`
|
||||
* :data:`gpu.GPU_DYNAMIC_LAMP_DYNENERGY`
|
||||
* :data:`gpu.GPU_DYNAMIC_LAMP_DYNCOL`
|
||||
* :data:`gpu.GPU_DYNAMIC_SAMPLER_2DSHADOW`
|
||||
|
||||
Notes:
|
||||
|
||||
- The uniforms
|
||||
:data:`gpu.GPU_DYNAMIC_LAMP_DYNVEC`,
|
||||
:data:`gpu.GPU_DYNAMIC_LAMP_DYNCO`,
|
||||
:data:`gpu.GPU_DYNAMIC_LAMP_DYNIMAT` and
|
||||
:data:`gpu.GPU_DYNAMIC_LAMP_DYNPERSMAT`
|
||||
refer to the lamp object position and orientation,
|
||||
both of can be derived from the object world matrix:
|
||||
* The uniforms :data:`gpu.GPU_DYNAMIC_LAMP_DYNVEC`, :data:`gpu.GPU_DYNAMIC_LAMP_DYNCO`, :data:`gpu.GPU_DYNAMIC_LAMP_DYNIMAT` and :data:`gpu.GPU_DYNAMIC_LAMP_DYNPERSMAT`
|
||||
refer to the lamp object position and orientation, both of can be derived from the object world matrix:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
obmat = uniform["lamp"].matrix_world
|
||||
|
||||
where obmat is the mat4_lamp_to_world_ matrix of the lamp as a 2 dimensional array,
|
||||
the lamp world location location is in ``obmat[3]``.
|
||||
the lamp world location location is in obmat[3].
|
||||
|
||||
- The uniform types
|
||||
:data:`gpu.GPU_DYNAMIC_LAMP_DYNENERGY` and
|
||||
:data:`gpu.GPU_DYNAMIC_LAMP_DYNCOL`
|
||||
refer to the lamp data bloc that you get from:
|
||||
* The uniform types :data:`gpu.GPU_DYNAMIC_LAMP_DYNENERGY` and :data:`gpu.GPU_DYNAMIC_LAMP_DYNCOL` refer to the lamp data bloc that you get from:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
la = uniform["lamp"].data
|
||||
|
||||
from which you get ``lamp.energy`` and ``lamp.color``
|
||||
from which you get la.energy and la.color
|
||||
|
||||
- Lamp duplication is not supported: if you have duplicated lamps in your scene
|
||||
* Lamp duplication is not supported: if you have duplicated lamps in your scene
|
||||
(i.e. lamp that are instantiated by dupligroup, etc), this element will only
|
||||
give you a reference to the orignal lamp and you will not know which instance
|
||||
of the lamp it is refering too. You can still handle that case in the exporter
|
||||
by distributing the uniforms amongst the duplicated lamps.
|
||||
|
||||
- ``["image"]``: :class:`bpy.types.Image`
|
||||
Reference to the image databloc.
|
||||
Set for uniform type
|
||||
:data:`gpu.GPU_DYNAMIC_SAMPLER_2DIMAGE`.
|
||||
You can get the image data from:
|
||||
* ["image"] : :class:`bpy.types.Image`
|
||||
Reference to the image databloc. Set for uniform type :data:`gpu.GPU_DYNAMIC_SAMPLER_2DIMAGE`. You can get the image data from:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
@@ -581,63 +432,60 @@ Functions
|
||||
# image size as a 2-dimensional array of int
|
||||
uniform["image"].size
|
||||
|
||||
- ``["texnumber"]``: integer
|
||||
* ["texnumber"] : integer
|
||||
Channel number to which the texture is bound when drawing the object.
|
||||
Set for uniform types
|
||||
:data:`gpu.GPU_DYNAMIC_SAMPLER_2DBUFFER`,
|
||||
:data:`gpu.GPU_DYNAMIC_SAMPLER_2DIMAGE` and
|
||||
:data:`gpu.GPU_DYNAMIC_SAMPLER_2DSHADOW`.
|
||||
Set for uniform types :data:`gpu.GPU_DYNAMIC_SAMPLER_2DBUFFER`, :data:`gpu.GPU_DYNAMIC_SAMPLER_2DIMAGE` and :data:`gpu.GPU_DYNAMIC_SAMPLER_2DSHADOW`.
|
||||
|
||||
This is provided for information only: when reusing the shader outside blencer,
|
||||
you are free to assign the textures to the channel of your choice and to pass
|
||||
that number channel to the GPU in the uniform.
|
||||
|
||||
- ``["texpixels"]``: byte array
|
||||
texture data for uniform type :data:`gpu.GPU_DYNAMIC_SAMPLER_2DBUFFER`.
|
||||
Although the corresponding uniform is a 2D sampler,
|
||||
the texture is always a 1D texture of n x 1 pixel.
|
||||
The texture size n is provided in ["texsize"] element.
|
||||
* ["texpixels"] : byte array
|
||||
texture data for uniform type :data:`gpu.GPU_DYNAMIC_SAMPLER_2DBUFFER`. Although
|
||||
the corresponding uniform is a 2D sampler, the texture is always a 1D texture
|
||||
of n x 1 pixel. The texture size n is provided in ["texsize"] element.
|
||||
These texture are only used for computer generated texture (colorband, etc).
|
||||
The texture data is provided so that you can make a real image out of it in the exporter.
|
||||
The texture data is provided so that you can make a real image out of it in the
|
||||
exporter.
|
||||
|
||||
- ``["texsize"]``: integer
|
||||
* ["texsize"] : integer
|
||||
horizontal size of texture for uniform type :data:`gpu.GPU_DYNAMIC_SAMPLER_2DBUFFER`.
|
||||
The texture data is in ["texpixels"].
|
||||
|
||||
- ``["attributes"]``: sequence
|
||||
* ["attributes"] : sequence
|
||||
list of attributes used in vertex shader, can be empty. Blender doesn't use
|
||||
standard attributes except for vertex position and normal. All other vertex
|
||||
attributes must be passed using the generic ``glVertexAttrib`` functions.
|
||||
attributes must be passed using the generic glVertexAttrib functions.
|
||||
The attribute data can be found in the derived mesh custom data using RNA.
|
||||
Each element of the sequence is a dictionary containing the following elements:
|
||||
|
||||
- ``["varname"]``: string
|
||||
* ["varname"] : string
|
||||
name of the uniform in the vertex shader. Always of the form 'att<number>'.
|
||||
|
||||
- ``["datatype"]``: integer
|
||||
* ["datatype"] : integer
|
||||
data type of vertex attribute, can be one of the following:
|
||||
|
||||
- :data:`gpu.GPU_DATA_2F`: use ``glVertexAttrib2fv``
|
||||
- :data:`gpu.GPU_DATA_3F`: use ``glVertexAttrib3fv``
|
||||
- :data:`gpu.GPU_DATA_4F`: use ``glVertexAttrib4fv``
|
||||
- :data:`gpu.GPU_DATA_4UB`: use ``glVertexAttrib4ubv``
|
||||
* :data:`gpu.GPU_DATA_2F` : use glVertexAttrib2fv
|
||||
* :data:`gpu.GPU_DATA_3F` : use glVertexAttrib3fv
|
||||
* :data:`gpu.GPU_DATA_4F` : use glVertexAttrib4fv
|
||||
* :data:`gpu.GPU_DATA_4UB` : use glVertexAttrib4ubv
|
||||
|
||||
- ``["number"]``: integer
|
||||
Generic attribute number. This is provided for information only.
|
||||
Blender doesn't use ``glBindAttribLocation`` to place generic attributes at specific location,
|
||||
* ["number"] : integer
|
||||
generic attribute number. This is provided for information only. Blender
|
||||
doesn't use glBindAttribLocation to place generic attributes at specific location,
|
||||
it lets the shader compiler place the attributes automatically and query the
|
||||
placement with ``glGetAttribLocation``.
|
||||
The result of this placement is returned in this element.
|
||||
placement with glGetAttribLocation. The result of this placement is returned in
|
||||
this element.
|
||||
|
||||
When using this shader in a render engine, you should either use
|
||||
``glBindAttribLocation`` to force the attribute at this location or use
|
||||
``glGetAttribLocation`` to get the placement chosen by the compiler of your GPU.
|
||||
glBindAttribLocation to force the attribute at this location or use
|
||||
glGetAttribLocation to get the placement chosen by the compiler of your GPU.
|
||||
|
||||
- ``["type"]``: integer
|
||||
* ["type"] : integer
|
||||
type of the mesh custom data from which the vertex attribute is loaded.
|
||||
See attribute-type_.
|
||||
|
||||
- ``["name"]``: string or integer
|
||||
* ["name"] : string or integer
|
||||
custom data layer name, used for attribute type :data:`gpu.CD_MTFACE` and :data:`gpu.CD_MCOL`.
|
||||
|
||||
Example:
|
||||
@@ -664,14 +512,14 @@ Notes
|
||||
|
||||
.. _mat4_lamp_to_perspective:
|
||||
|
||||
#. Calculation of the ``mat4_lamp_to_perspective`` matrix for a spot lamp.
|
||||
1. Calculation of the *mat4_lamp_to_perspective* matrix for a spot lamp.
|
||||
|
||||
The following pseudo code shows how the ``mat4_lamp_to_perspective`` matrix is computed
|
||||
The following pseudo code shows how the *mat4_lamp_to_perspective* matrix is computed
|
||||
in blender for uniforms of :data:`gpu.GPU_DYNAMIC_LAMP_DYNPERSMAT` type:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
# Get the lamp datablock with:
|
||||
#Get the lamp datablock with:
|
||||
lamp = bpy.data.objects[uniform["lamp"]].data
|
||||
|
||||
# Compute the projection matrix:
|
||||
@@ -683,11 +531,11 @@ Notes
|
||||
# The size of the projection plane is computed with the usual formula:
|
||||
wsize = lamp.clista * tan(lamp.spotsize/2)
|
||||
|
||||
# And the projection matrix:
|
||||
#And the projection matrix:
|
||||
mat4_lamp_to_perspective = glFrustum(-wsize, wsize, -wsize, wsize, lamp.clista, lamp.clipend)
|
||||
|
||||
#. Creation of the shadow map for a spot lamp.
|
||||
2. Creation of the shadow map for a spot lamp.
|
||||
|
||||
The shadow map is the depth buffer of a render performed by placing the camera at the
|
||||
spot light position. The size of the shadow map is given by the attribute ``lamp.bufsize``:
|
||||
spot light position. The size of the shadow map is given by the attribute lamp.bufsize :
|
||||
shadow map size in pixel, same size in both dimensions.
|
||||
|
@@ -121,7 +121,7 @@ Here are some more complex examples:
|
||||
bpy.context.scene.render.layers["RenderLayer"].samples
|
||||
|
||||
# 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
|
||||
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.
|
||||
|
||||
- Use the Python console's auto-complete to inspect properties.
|
||||
*This can be hit-and-miss but has the advantage
|
||||
- Use the Python console's auto-complete to inspect properties. *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.*
|
||||
- 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>`*
|
||||
|
||||
- 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>`*
|
||||
|
||||
|
||||
.. _info_data_path_copy:
|
||||
.. _info_data_path_copy
|
||||
|
||||
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.
|
||||
|
||||
|
||||
Type in the ID path into a Python console :mod:`bpy.context.active_object`.
|
||||
Include the trailing dot and don't hit "enter", yet.
|
||||
Type in the ID path into a Python console :mod:`bpy.context.active_object`. 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.
|
||||
|
||||
@@ -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.
|
||||
|
||||
|
||||
.. _info_data_path_indirect:
|
||||
.. _info_data_path_indirect
|
||||
|
||||
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.
|
||||
|
||||
- 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.
|
||||
|
||||
*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...
|
||||
|
||||
- In the properties button select the Texture context.
|
||||
|
||||
- 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**
|
||||
This takes you to ``bpy.types.Texture.contrast``
|
||||
- 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.
|
||||
|
||||
- Expand the **Colors** panel to locate the **Contrast** button.
|
||||
|
||||
- Right click on the contrast button and select **Online Python Reference** This takes you to ``bpy.types.Texture.contrast``
|
||||
|
||||
- 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
|
||||
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``
|
||||
*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**.
|
||||
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,
|
||||
logically we now know.
|
||||
@@ -276,8 +282,7 @@ are interested to check on the source code.
|
||||
|
||||
.. note::
|
||||
|
||||
Not all operators can be called usefully from Python,
|
||||
for more on this see :ref:`using operators <using_operators>`.
|
||||
Not all operators can be called usefully from Python, for more on this see :ref:`using operators <using_operators>`.
|
||||
|
||||
|
||||
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.
|
||||
You can perform some actions and see them show up - delete a vertex for example.
|
||||
|
||||
Each entry can be selected (Right-Mouse-Button),
|
||||
then copied :kbd:`Control-C`, usually to paste in the text editor or python console.
|
||||
Each entry can be selected (Right-Mouse-Button), then copied :kbd:`Control-C`, usually to paste in the text editor or python console.
|
||||
|
||||
.. note::
|
||||
|
||||
|
@@ -1,20 +1,16 @@
|
||||
|
||||
*************
|
||||
Best Practice
|
||||
*************
|
||||
|
||||
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.
|
||||
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.
|
||||
|
||||
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.
|
||||
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.
|
||||
|
||||
|
||||
Style Conventions
|
||||
=================
|
||||
|
||||
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.
|
||||
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.
|
||||
|
||||
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.
|
||||
|
||||
- camel caps for class names: MyClass
|
||||
- all lower case underscore separated module names: my_module
|
||||
- indentation of 4 spaces (no tabs)
|
||||
- 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.
|
||||
* camel caps for class names: MyClass
|
||||
|
||||
* all lower case underscore separated module names: my_module
|
||||
|
||||
* indentation of 4 spaces (no tabs)
|
||||
|
||||
* 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.
|
||||
|
||||
- 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.
|
||||
|
||||
@@ -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.filepath = "//render_out"
|
||||
|
||||
- pep8 also defines that lines should not exceed 79 characters,
|
||||
we felt this is too restrictive so this is optional per script.
|
||||
* pep8 also defines that lines should not exceed 79 characters, we felt this is too restrictive so this is optional per script.
|
||||
|
||||
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.
|
||||
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.
|
||||
|
||||
``# <pep8 compliant>``
|
||||
|
||||
@@ -59,75 +58,72 @@ User Interface Layout
|
||||
|
||||
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.
|
||||
|
||||
General rule here: If you need more code for the layout declaration,
|
||||
then for the actual properties, you do it wrong.
|
||||
* 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.
|
||||
|
||||
Example layouts:
|
||||
|
||||
- layout()
|
||||
|
||||
The basic layout is a simple Top -> Bottom layout.
|
||||
* layout()
|
||||
|
||||
The basic layout is a simple Top -> Bottom layout.
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
layout.prop()
|
||||
layout.prop()
|
||||
layout.prop()
|
||||
layout.prop()
|
||||
|
||||
- layout.row()
|
||||
|
||||
Use row(), when you want more than 1 property in one line.
|
||||
* layout.row()
|
||||
|
||||
Use row(), when you want more than 1 property in one line.
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
row = layout.row()
|
||||
row.prop()
|
||||
row.prop()
|
||||
|
||||
row = layout.row()
|
||||
row.prop()
|
||||
row.prop()
|
||||
|
||||
- layout.column()
|
||||
* layout.column()
|
||||
|
||||
Use column(), when you want your properties in a column.
|
||||
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
col = layout.column()
|
||||
col.prop()
|
||||
col.prop()
|
||||
|
||||
col = layout.column()
|
||||
col.prop()
|
||||
col.prop()
|
||||
* layout.split()
|
||||
|
||||
- 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.
|
||||
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
split = layout.split()
|
||||
|
||||
col = split.column()
|
||||
col.prop()
|
||||
col.prop()
|
||||
|
||||
col = split.column()
|
||||
col.prop()
|
||||
col.prop()
|
||||
|
||||
|
||||
split = layout.split()
|
||||
|
||||
col = split.column()
|
||||
col.prop()
|
||||
col.prop()
|
||||
|
||||
col = split.column()
|
||||
col.prop()
|
||||
col.prop()
|
||||
|
||||
Declaration names:
|
||||
|
||||
Try to only use these variable names for layout declarations:
|
||||
|
||||
- row for a row() layout
|
||||
- col for a column() layout
|
||||
- split for a split() layout
|
||||
- flow for a column_flow() layout
|
||||
- sub for a sub layout (a column inside a column for example)
|
||||
* row for a row() layout
|
||||
* col for a column() layout
|
||||
* split for a split() layout
|
||||
* flow for a column_flow() layout
|
||||
* sub for a sub layout (a column inside a column for example)
|
||||
|
||||
|
||||
Script Efficiency
|
||||
=================
|
||||
|
||||
|
||||
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.
|
||||
|
||||
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.
|
||||
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.
|
||||
|
||||
.. 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
|
||||
^^^^^^^^^^^^^^^
|
||||
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.
|
||||
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.
|
||||
|
||||
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]``.
|
||||
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]``.
|
||||
|
||||
To use an index you can use ``my_list.insert(index, list_item)`` or ``list.pop(index)``
|
||||
for list removal, but these are slower.
|
||||
To use an index you can use ``my_list.insert(index, list_item)`` or ``list.pop(index)`` for list removal, but these are slower.
|
||||
|
||||
Sometimes its faster (but more memory hungry) to just rebuild the list.
|
||||
|
||||
@@ -203,8 +193,7 @@ Use...
|
||||
my_list.extend([a, b, c...])
|
||||
|
||||
|
||||
Note that insert can be used when needed,
|
||||
but it is slower than append especially when inserting at the start of a long list.
|
||||
Note that insert can be used when needed, 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.
|
||||
|
||||
@@ -216,8 +205,7 @@ This example shows a very sub-optimal way of making a reversed list.
|
||||
reverse_list.insert(0, list_item)
|
||||
|
||||
|
||||
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:
|
||||
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:
|
||||
|
||||
|
||||
.. 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.
|
||||
|
||||
Here is an example of how to remove items in 1 loop,
|
||||
removing the last items first, which is faster (as explained above).
|
||||
Here is an example of how to remove items in 1 loop, removing the last items first, which is faster (as explained above).
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
@@ -245,9 +232,7 @@ removing the last items first, which is faster (as explained above).
|
||||
my_list.pop(list_index)
|
||||
|
||||
|
||||
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.
|
||||
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.
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
@@ -266,9 +251,7 @@ When removing many items in a large list this can provide a good speedup.
|
||||
Avoid Copying Lists
|
||||
^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
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.
|
||||
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.
|
||||
|
||||
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"]))
|
||||
|
||||
|
||||
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.
|
||||
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.
|
||||
|
||||
|
||||
Parsing Strings (Import/Exporting)
|
||||
----------------------------------
|
||||
|
||||
Since many file formats are ASCII,
|
||||
the way you parse/export strings can make a large difference in how fast your script runs.
|
||||
Since many file formats are ASCII, 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.
|
||||
|
||||
|
||||
Parsing Numbers
|
||||
^^^^^^^^^^^^^^^
|
||||
|
||||
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().
|
||||
|
||||
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().
|
||||
|
||||
Checking String Start/End
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@@ -345,8 +322,7 @@ Use...
|
||||
|
||||
>>> if line.startswith("vert "):
|
||||
|
||||
Using ``startswith()`` is slightly faster (approx 5%) and also avoids a possible
|
||||
error with the slice length not matching the string length.
|
||||
Using ``startswith()`` is slightly faster (approx 5%) and also avoids a possible error with the slice length not matching the string length.
|
||||
|
||||
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.
|
||||
|
||||
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.
|
||||
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.
|
||||
|
||||
There are cases where using **try** is faster than checking whether the condition will raise an error,
|
||||
so it is worth experimenting.
|
||||
There are cases where using **try** is faster than checking whether the condition will raise an error, so it is worth experimenting.
|
||||
|
||||
|
||||
Value Comparison
|
||||
----------------
|
||||
|
||||
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.
|
||||
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.
|
||||
|
||||
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...
|
||||
|
||||
print("My Script Finished: %.4f sec" % time.time() - time_start)
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user